← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2796: Remove some cruft

 

------------------------------------------------------------
revno: 2796
committer: Jacek Sieka <arnetheduck@xxxxxxxxx>
branch nick: dcplusplus
timestamp: Sat 2012-01-07 21:25:42 +0100
message:
  Remove some cruft
removed:
  dwt/include/dwt/widgets/WidgetListViewEditBox.h
modified:
  dwt/include/dwt/widgets/Table.h
  dwt/src/widgets/Menu.cpp
  win32/WinUtil.cpp
  win32/WinUtil.h


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'dwt/include/dwt/widgets/Table.h'
--- dwt/include/dwt/widgets/Table.h	2011-12-23 16:21:08 +0000
+++ dwt/include/dwt/widgets/Table.h	2012-01-07 20:25:42 +0000
@@ -118,21 +118,6 @@
 		SORT_FLOAT
 	};
 
-#ifdef PORT_ME
-	/// \ingroup EventHandlersTable
-	/// Validation event handler setter
-	/** If supplied event handler is called after a cell has been edited but before
-	  * the value is actually changed. <br>
-	  * If the event handler returns false, the new value is NOT inserted; if the
-	  * return value is true, the old value is replaced with the new. Parameters
-	  * passed is unsigned column, unsigned row and tstring reference
-	  * which is the new value, the value can be manipulated and changed within your
-	  * event handler.
-	  */
-	void onValidate( typename MessageMapType::itsBoolValidationFunc eventHandler );
-	void onValidate( typename MessageMapType::boolValidationFunc eventHandler );
-
-#endif
 	/// \ingroup EventHandlersTable
 	/// Event handler for the SortItems event
 	/** When you sort a Table you need to supply a callback function for
@@ -506,10 +491,6 @@
 	void setIndex(LVITEM& item, int index) const;
 	void initGroupSupport();
 	void updateArrow();
-#ifdef PORT_ME
-	// Private validate function, this ones returns the "read only" property of the list
-	static bool defaultValidate( EventHandlerClass * parent, Table * list, unsigned int col, unsigned int row, tstring & newValue );
-#endif
 	// Calculates the adjustment from the columns of an item.
 	int xoffFromColumn( int column, int & logicalColumn );
 
@@ -558,48 +539,6 @@
 	return Message(WM_NOTIFY, NM_DBLCLK);
 }
 
-#ifdef PORT_ME
-
-void Table::onValidate( typename MessageMapControl< EventHandlerClass, Table >::itsBoolValidationFunc eventHandler )
-{
-	if ( this->getReadOnly() )
-		this->setReadOnly( false );
-	MessageMapType * ptrThis = boost::polymorphic_cast< MessageMapType * >( this );
-	ptrThis->addCallback(
-		typename MessageMapType::SignalTupleType(
-			private_::SignalContent(
-				Message( WM_NOTIFY, LVN_ENDLABELEDIT ),
-				reinterpret_cast< itsVoidFunction >( eventHandler ),
-				ptrThis
-			),
-			typename MessageMapType::SignalType(
-				typename MessageMapType::SignalType::SlotType( & DispatcherList::dispatchBoolIntIntStringThis )
-			)
-		)
-	);
-}
-
-void Table::onValidate( typename MessageMapControl< EventHandlerClass, Table >::boolValidationFunc eventHandler )
-{
-	if ( this->getReadOnly() )
-		this->setReadOnly( false );
-	MessageMapType * ptrThis = boost::polymorphic_cast< MessageMapType * >( this );
-	ptrThis->addCallback(
-		typename MessageMapType::SignalTupleType(
-			private_::SignalContent(
-				Message( WM_NOTIFY, LVN_ENDLABELEDIT ),
-				reinterpret_cast< private_::SignalContent::voidFunctionTakingVoid >( eventHandler ),
-				ptrThis
-			),
-			typename MessageMapType::SignalType(
-				typename MessageMapType::SignalType::SlotType( & DispatcherList::dispatchBoolIntIntString )
-			)
-		)
-	);
-}
-
-#endif
-
 inline void Table::resort() {
 	if(sortColumn != -1) {
 		if(sortType == SORT_CALLBACK) {
@@ -699,13 +638,6 @@
 	return ListView_GetItemCount( handle() );
 }
 
-#ifdef PORT_ME
-bool Table::defaultValidate( EventHandlerClass * parent, Table * list, unsigned int col, unsigned int row, tstring & newValue )
-{
-	list->updateWidget();
-	return !list->getReadOnly();
-}
-#endif
 // Calculates the adjustment from the columns of an item.
 
 inline Rectangle Table::getRect( int item, int code )
@@ -766,175 +698,6 @@
 	ListView_SetBkColor(handle(), background);
 }
 
-#ifdef PORT_ME
-// TODO: Should these
-
-LRESULT Table::sendWidgetMessage( HWND hWnd, UINT msg, WPARAM & wPar, LPARAM & lPar )
-{
-	switch ( msg )
-	{
-	// WinCE can't retrieve mouse pos in Double Click message handler since mouse
-	// isn't around... therefore we need to "store" it like we do here...!!
-	case WM_LBUTTONDOWN :
-		{
-			// TODO: Dispatch events
-			itsXMousePosition = LOWORD( lPar );
-			itsYMousePosition = HIWORD( lPar );
-		} break;
-
-	case WM_PAINT :
-		if ( itsEditingCurrently )
-		{
-			// In order to prevent a mistaken update of the first column which leads
-			// to a blank cell while editing an inner cell's contents, we
-			// validate this area and thus prevent its repaint.
-			// Don't need to update to the left or right of the editing rect.
-			RECT editRect = getSubItemRect( itsEditRow, itsEditColumn, LVIR_LABEL );
-			RECT rowRect = getItemRect( itsEditRow, LVIR_LABEL );
-			RECT validRect;
-			if ( editRect.left > rowRect.left )
-			{
-				validRect = rowRect; validRect.right = editRect.left;
-				ValidateRect( handle(), & validRect );
-			}
-			ValidateRect( handle(), & rowRect );
-		}
-		break;
-
-	// TODO: Dispatch events
-	case WM_NOTIFY :
-		{
-			NMHDR * na = reinterpret_cast< NMHDR * >( lPar );
-			switch ( na->code )
-			{
-			case LVN_BEGINLABELEDIT :
-				{
-					itsEditingCurrently = true;
-					int logicalColumn;
-					int xOffset = xoffFromColumn( itsEditColumn, logicalColumn );
-
-					// NOW we have found our "sub" label!
-					RECT r = getItemRect( itsEditRow, LVIR_BOUNDS );
-					RECT rs = getSubItemRect( itsEditRow, itsEditColumn, LVIR_BOUNDS );
-
-#ifndef WINCE // WinCE doesn't support repositioning the edit control anyway...
-					// Checking to see if we need to scroll
-					RECT cr;
-					::GetClientRect( handle(), & cr );
-					if ( xOffset + r.left < 0 || xOffset + r.left > cr.right )
-					{
-						int x = xOffset - r.left;
-						ListView_Scroll( handle(), x, 0 );
-						r.left -= x;
-					}
-					// Get column alignment
-					LV_COLUMN lv =
-					{0
-					};
-					lv.mask = LVCF_FMT;
-					ListView_GetColumn( handle(), logicalColumn, & lv );
-					DWORD dwStyle;
-					if ( ( lv.fmt & LVCFMT_JUSTIFYMASK ) == LVCFMT_LEFT )
-						dwStyle = ES_LEFT;
-					else if ( ( lv.fmt & LVCFMT_JUSTIFYMASK ) == LVCFMT_RIGHT )
-						dwStyle = ES_RIGHT;
-					else
-						dwStyle = ES_CENTER;
-					r.left += xOffset + 4;
-					r.right = r.left + ( ListView_GetColumnWidth( handle(), itsEditColumn ) - 3 );
-					if ( r.right > cr.right )
-						r.right = cr.right;
-					dwStyle |= WS_BORDER | WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL;
-#endif
-
-					// Creating text Widget and placing it above cell
-					HWND editControl = ListView_GetEditControl( handle() );
-					if ( editControl == 0 )
-					{
-						xCeption err( _T( "Couldn't attach to List View editcontrol" ) );
-						throw err;
-					}
-
-					private_::TableEditBox< Table > * text
-						= new private_::TableEditBox< Table >( this );
-					text->createSubclass( editControl );
-
-#ifndef WINCE
-					text->itsRect = dwt::Rectangle( r.left, r.top, r.right, r.bottom );
-					text->setBounds( text->itsRect );
-					text->setScrollBarHorizontally( false );
-					text->setScrollBarVertically( false );
-					::SetWindowLong( editControl, GWL_STYLE, dwStyle );
-#endif
-					// Getting text of cell and inserting into text Widget
-					const int BUFFER_MAX = 260; // List view cells have a maximum of 260 characters
-					TCHAR buffer[BUFFER_MAX];
-					ListView_GetItemText( handle(), itsEditRow, itsEditColumn, buffer, BUFFER_MAX );
-					text->setText( buffer );
-
-					// Select all end give focus
-					text->setSelection();
-					text->setFocus();
-					return FALSE;
-				} break;
-
-			case LVN_ENDLABELEDIT :
-				{ itsEditingCurrently = false;
-					break;
-				}
-
-			case NM_CLICK :
-				{
-					//TODO: only works with comctl v4.71, is this OK?
-#ifdef WINCE
-					LPNMTable item = (LPNMTable) lPar;
-#else
-					LPNMITEMACTIVATE item = (LPNMITEMACTIVATE) lPar;
-#endif
-					itsXMousePosition = item->ptAction.x;
-					itsYMousePosition = item->ptAction.y;
-				} break;
-
-			// TODO: Dispatch events
-			case NM_DBLCLK :
-				{
-					LVHITTESTINFO info;
-					info.pt.x = itsXMousePosition;
-					info.pt.y = itsYMousePosition;
-					ListView_SubItemHitTest( handle(), & info );
-					// User has clicked the Table
-					if ( info.iItem != - 1 )
-					{
-						// User has clicked an ITEM in Table
-						if ( info.iSubItem >= 0 )
-						{
-							UINT state = ListView_GetItemState( handle(), info.iItem, LVIS_FOCUSED );
-							if ( ! ( state & LVIS_FOCUSED ) )
-							{
-								//SetFocus( itsHandle );   // TODO: This was catched by devcpp ... what was intended?
-								SetFocus( handle() ); // ASW add
-							}
-
-							// Check to verify items are editable
-							if ( ::GetWindowLong( handle(), GWL_STYLE ) & LVS_EDITLABELS )
-							{
-								itsEditRow = info.iItem;
-								itsEditColumn = info.iSubItem;
-								ListView_EditLabel( handle(), info.iItem );
-								return 0; // Processed
-							}
-						}
-					}
-				} break;
-			default:
-				return MessageMapType::sendWidgetMessage( hWnd, msg, wPar, lPar );
-			}
-		} break;
-	}
-	return MessageMapType::sendWidgetMessage( hWnd, msg, wPar, lPar );
-}
-#endif
-
 }
 
 #endif

=== removed file 'dwt/include/dwt/widgets/WidgetListViewEditBox.h'
--- dwt/include/dwt/widgets/WidgetListViewEditBox.h	2011-01-02 17:12:02 +0000
+++ dwt/include/dwt/widgets/WidgetListViewEditBox.h	1970-01-01 00:00:00 +0000
@@ -1,111 +0,0 @@
-/*
-  DC++ Widget Toolkit
-
-  Copyright (c) 2007-2011, Jacek Sieka
-
-  SmartWin++
-
-  Copyright (c) 2005 Thomas Hansen
-
-  All rights reserved.
-
-  Redistribution and use in source and binary forms, with or without modification,
-  are permitted provided that the following conditions are met:
-
-      * Redistributions of source code must retain the above copyright notice,
-        this list of conditions and the following disclaimer.
-      * Redistributions in binary form must reproduce the above copyright notice,
-        this list of conditions and the following disclaimer in the documentation
-        and/or other materials provided with the distribution.
-      * Neither the name of the DWT nor SmartWin++ nor the names of its contributors
-        may be used to endorse or promote products derived from this software
-        without specific prior written permission.
-
-  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#ifndef DWT_TableViewEditBox_h
-#define DWT_TableViewEditBox_h
-
-#include "TextBox.h"
-
-namespace dwt {
-
-namespace private_
-{
-// begin namespace private_
-
-#ifdef PORT_ME
-
-// Class is only to make attaching of Edit Control in List View possible
-// TODO: Make window NOT hide the leftmost cell of row when entering "edit modus"..
-class TableEditBox : TextBox
-{
-public:
-	// Class type
-	typedef TableEditBox ThisType;
-
-	// Object type
-	typedef ThisType * ObjectType;
-
-	explicit TableEditBox( dwt::Widget * parent );
-
-	virtual ~TableEditBox()
-	{}
-
-	Rectangle itsRect;
-};
-
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// Implementation of class
-///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-inline TableEditBox::TableEditBox( dwt::Widget * parent )
-	: TextBox( parent )
-{
-	// Can't have a text box without a parent...
-	dwtassert( parent, _T( "Cant have a TextBox without a parent..." ) );
-}
-
-template< class EventHandlerClass >
-LRESULT TableEditBox< EventHandlerClass >::sendWidgetMessage( HWND hWnd, UINT msg, WPARAM & wPar, LPARAM & lPar )
-{
-#ifdef _MSC_VER
-#pragma warning( disable : 4060 )
-#endif
-	switch ( msg )
-	{
-			// Windows CE doesn't support WM_WINDOWPOSCHANGING message
-			// therefore we can't reposition the EditControl in the Table
-			// edit modus...!
-#ifndef WINCE
-		case WM_WINDOWPOSCHANGING :
-		{
-			// Ensuring position is "locked" in the rectangle initially set in
-			// Table's create func And then letting message "pass
-			// through" the rest of the hierarchy...
-			WINDOWPOS * pos = ( WINDOWPOS * ) lPar;
-			pos->x = itsRect.pos.x;
-			pos->y = itsRect.pos.y;
-			pos->cx = itsRect.width() - itsRect.pos.x;
-			pos->cy = itsRect.size.y - itsRect.pos.y;
-		} break;
-#endif
-	}
-	return TextBox< EventHandlerClass >::sendWidgetMessage( hWnd, msg, wPar, lPar );
-}
-#endif
-// end namespace private_
-}
-
-}
-
-#endif

=== modified file 'dwt/src/widgets/Menu.cpp'
--- dwt/src/widgets/Menu.cpp	2011-12-23 14:07:18 +0000
+++ dwt/src/widgets/Menu.cpp	2012-01-07 20:25:42 +0000
@@ -265,26 +265,6 @@
 	return sub;
 }
 
-#ifdef PORT_ME
-Menu::ObjectType Menu::getSystemMenu()
-{
-	// get system menu for the utmost parent
-	HMENU handle = ::GetSystemMenu( getParent()->handle(), FALSE );
-
-	// create pointer to system menu
-	ObjectType sysMenu( new Menu( getParent()->handle() ) );
-
-	// create(take) system menu
-	sysMenu->create( handle, false );
-
-	// We're assuming that the system menu has the same lifespan as the "this" menu, we must keep a reference to te system menu
-	// otherwise it will be "lost", therefore we add it up as a child to the "this" menu...
-	itsChildren.push_back( sysMenu );
-
-	return sysMenu;
-}
-#endif
-
 Menu::~Menu()
 {
 	// Destroy this menu

=== modified file 'win32/WinUtil.cpp'
--- win32/WinUtil.cpp	2012-01-07 20:02:47 +0000
+++ win32/WinUtil.cpp	2012-01-07 20:25:42 +0000
@@ -1474,24 +1474,3 @@
 dwt::IconPtr WinUtil::toolbarIcon(unsigned id) {
 	return createIcon(id, SETTING(TOOLBAR_SIZE));
 }
-
-#ifdef PORT_ME
-
-double WinUtil::toBytes(TCHAR* aSize) {
-	double bytes = _tstof(aSize);
-
-	if (_tcsstr(aSize, CT_("PiB"))) {
-		return bytes * 1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0;
-	} else if (_tcsstr(aSize, CT_("TiB"))) {
-		return bytes * 1024.0 * 1024.0 * 1024.0 * 1024.0;
-	} else if (_tcsstr(aSize, CT_("GiB"))) {
-		return bytes * 1024.0 * 1024.0 * 1024.0;
-	} else if (_tcsstr(aSize, CT_("MiB"))) {
-		return bytes * 1024.0 * 1024.0;
-	} else if (_tcsstr(aSize, CT_("KiB"))) {
-		return bytes * 1024.0;
-	} else {
-		return bytes;
-	}
-}
-#endif

=== modified file 'win32/WinUtil.h'
--- win32/WinUtil.h	2011-12-23 16:21:08 +0000
+++ win32/WinUtil.h	2012-01-07 20:25:42 +0000
@@ -311,10 +311,6 @@
 	static inline dwt::IconPtr tabIcon(unsigned id) { return createIcon(id, 16); }
 	static dwt::IconPtr toolbarIcon(unsigned id);
 
-#ifdef PORT_ME
-	static double toBytes(TCHAR* aSize);
-#endif
-
 private:
 	static bool handleBoxDblClick(dwt::TextBoxBase* box, const dwt::MouseEvent& ev);