From 5249b1a6da238839083a5a95a6e1bc21293f3bc7 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 15 Oct 2013 10:41:00 +0200 Subject: [PATCH] Renamed TOOL_MOUSE_BUTTONS constants to avoid name conflict with Windows MB_RIGHT constant. --- common/tool/tool_dispatcher.cpp | 6 +++--- common/tool/tool_event.cpp | 8 ++++---- common/tool/tool_manager.cpp | 2 +- include/tool/tool_event.h | 20 ++++++++++---------- include/tool/tool_interactive.h | 8 ++++---- pcbnew/router/router_tool.cpp | 4 ++-- pcbnew/tools/move_tool.cpp | 4 ++-- pcbnew/tools/selection_tool.cpp | 8 ++++---- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/common/tool/tool_dispatcher.cpp b/common/tool/tool_dispatcher.cpp index 71c0998b6d..49ab4382ac 100644 --- a/common/tool/tool_dispatcher.cpp +++ b/common/tool/tool_dispatcher.cpp @@ -89,9 +89,9 @@ struct TOOL_DISPATCHER::BUTTON_STATE TOOL_DISPATCHER::TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr, PCB_BASE_FRAME* aEditFrame ) : m_toolMgr( aToolMgr ), m_editFrame( aEditFrame ) { - m_buttons.push_back( new BUTTON_STATE( MB_LEFT, wxEVT_LEFT_DOWN, wxEVT_LEFT_UP ) ); - m_buttons.push_back( new BUTTON_STATE( MB_RIGHT, wxEVT_RIGHT_DOWN, wxEVT_RIGHT_UP ) ); - m_buttons.push_back( new BUTTON_STATE( MB_MIDDLE, wxEVT_MIDDLE_DOWN, wxEVT_MIDDLE_UP ) ); + m_buttons.push_back( new BUTTON_STATE( BUT_LEFT, wxEVT_LEFT_DOWN, wxEVT_LEFT_UP ) ); + m_buttons.push_back( new BUTTON_STATE( BUT_RIGHT, wxEVT_RIGHT_DOWN, wxEVT_RIGHT_UP ) ); + m_buttons.push_back( new BUTTON_STATE( BUT_MIDDLE, wxEVT_MIDDLE_DOWN, wxEVT_MIDDLE_UP ) ); ResetState(); } diff --git a/common/tool/tool_event.cpp b/common/tool/tool_event.cpp index b064b87624..15ae3314e7 100644 --- a/common/tool/tool_event.cpp +++ b/common/tool/tool_event.cpp @@ -98,10 +98,10 @@ const std::string TOOL_EVENT::Format() const const FlagString buttons[] = { - { MB_NONE, "none" }, - { MB_LEFT, "left" }, - { MB_RIGHT, "right" }, - { MB_MIDDLE, "middle" }, + { BUT_NONE, "none" }, + { BUT_LEFT, "left" }, + { BUT_RIGHT, "right" }, + { BUT_MIDDLE, "middle" }, { 0, "" } }; diff --git a/common/tool/tool_manager.cpp b/common/tool/tool_manager.cpp index 0604aa80f3..02019f25ef 100644 --- a/common/tool/tool_manager.cpp +++ b/common/tool/tool_manager.cpp @@ -433,7 +433,7 @@ bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent ) // or immediately (CMENU_NOW) mode. The latter is used for clarification lists. if( st->contextMenuTrigger != CMENU_OFF ) { - if( st->contextMenuTrigger == CMENU_BUTTON && !aEvent.IsClick( MB_RIGHT ) ) + if( st->contextMenuTrigger == CMENU_BUTTON && !aEvent.IsClick( BUT_RIGHT ) ) break; st->pendingWait = true; diff --git a/include/tool/tool_event.h b/include/tool/tool_event.h index 33f512b668..44cb4379cd 100644 --- a/include/tool/tool_event.h +++ b/include/tool/tool_event.h @@ -93,12 +93,12 @@ enum TOOL_ACTIONS enum TOOL_MOUSE_BUTTONS { - MB_NONE = 0x0, - MB_LEFT = 0x1, - MB_RIGHT = 0x2, - MB_MIDDLE = 0x4, - MB_BUTTON_MASK = MB_LEFT | MB_RIGHT | MB_MIDDLE, - MB_ANY = 0xffffffff + BUT_NONE = 0x0, + BUT_LEFT = 0x1, + BUT_RIGHT = 0x2, + BUT_MIDDLE = 0x4, + BUT_BUTTON_MASK = BUT_LEFT | BUT_RIGHT | BUT_MIDDLE, + BUT_ANY = 0xffffffff }; enum TOOL_MODIFIERS @@ -158,7 +158,7 @@ public: { if( aCategory == TC_MOUSE ) { - m_mouseButtons = aExtraParam & MB_BUTTON_MASK; + m_mouseButtons = aExtraParam & BUT_BUTTON_MASK; } else if( aCategory == TC_KEYBOARD ) { @@ -227,18 +227,18 @@ public: return m_mouseButtons; } - bool IsClick( int aButtonMask = MB_ANY ) const + bool IsClick( int aButtonMask = BUT_ANY ) const { return ( m_actions == TA_MOUSE_CLICK ) && ( ( m_mouseButtons & aButtonMask ) == aButtonMask ); } - bool IsDrag( int aButtonMask = MB_ANY ) const + bool IsDrag( int aButtonMask = BUT_ANY ) const { return ( m_actions == TA_MOUSE_DRAG ) && ( ( m_mouseButtons & aButtonMask ) == aButtonMask ); } - bool IsMouseUp( int aButtonMask = MB_ANY ) const + bool IsMouseUp( int aButtonMask = BUT_ANY ) const { return ( m_actions == TA_MOUSE_UP ) && ( ( m_mouseButtons & aButtonMask ) == aButtonMask ); } diff --git a/include/tool/tool_interactive.h b/include/tool/tool_interactive.h index d66b17ae05..855f84af5c 100644 --- a/include/tool/tool_interactive.h +++ b/include/tool/tool_interactive.h @@ -111,10 +111,10 @@ protected: const TOOL_EVENT evCommand( int aCommandId = -1 ); const TOOL_EVENT evCommand( std::string aCommandStr = "" ); const TOOL_EVENT evMotion(); - const TOOL_EVENT evClick( int aButton = MB_ANY ); - const TOOL_EVENT evDrag( int aButton = MB_ANY ); - const TOOL_EVENT evButtonUp( int aButton = MB_ANY ); - const TOOL_EVENT evButtonDown(int aButton = MB_ANY ); + const TOOL_EVENT evClick( int aButton = BUT_ANY ); + const TOOL_EVENT evDrag( int aButton = BUT_ANY ); + const TOOL_EVENT evButtonUp( int aButton = BUT_ANY ); + const TOOL_EVENT evButtonDown(int aButton = BUT_ANY ); private: void goInternal( TOOL_STATE_FUNC& aState, const TOOL_EVENT_LIST& aConditions ); diff --git a/pcbnew/router/router_tool.cpp b/pcbnew/router/router_tool.cpp index 1d97f0c2a4..d85b1470ae 100644 --- a/pcbnew/router/router_tool.cpp +++ b/pcbnew/router/router_tool.cpp @@ -323,7 +323,7 @@ void ROUTER_TOOL::startRouting() updateEndItem( *evt ); m_router->Move( m_endSnapPoint, m_endItem ); } - else if( evt->IsClick( MB_LEFT ) ) + else if( evt->IsClick( BUT_LEFT ) ) { updateEndItem( *evt ); @@ -396,7 +396,7 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent ) break; // Finish else if( evt->IsMotion() ) updateStartItem( *evt ); - else if( evt->IsClick( MB_LEFT ) ) + else if( evt->IsClick( BUT_LEFT ) ) { updateStartItem( *evt ); startRouting(); diff --git a/pcbnew/tools/move_tool.cpp b/pcbnew/tools/move_tool.cpp index 016b2c4071..6eaea40418 100644 --- a/pcbnew/tools/move_tool.cpp +++ b/pcbnew/tools/move_tool.cpp @@ -118,7 +118,7 @@ int MOVE_TOOL::Main( TOOL_EVENT& aEvent ) } } - else if( evt->IsMotion() || evt->IsDrag( MB_LEFT ) ) + else if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) { if( dragging ) { @@ -143,7 +143,7 @@ int MOVE_TOOL::Main( TOOL_EVENT& aEvent ) selection.group->ViewUpdate( VIEW_ITEM::GEOMETRY ); dragPosition = evt->Position(); } - else if( evt->IsMouseUp( MB_LEFT ) || evt->IsClick( MB_LEFT ) ) + else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) ) break; // Finish } diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index ca36c73281..45523ab76a 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -103,11 +103,11 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent ) } // single click? Select single object - if( evt->IsClick( MB_LEFT ) ) + if( evt->IsClick( BUT_LEFT ) ) selectSingle( evt->Position() ); // drag with LMB? Select multiple objects (or at least draw a selection box) or drag them - if( evt->IsDrag( MB_LEFT ) ) + if( evt->IsDrag( BUT_LEFT ) ) { if( m_selection.Empty() || m_additive ) { @@ -299,7 +299,7 @@ bool SELECTION_TOOL::selectMultiple() break; } - if( evt->IsDrag( MB_LEFT ) ) + if( evt->IsDrag( BUT_LEFT ) ) { if( !m_additive ) clearSelection(); @@ -311,7 +311,7 @@ bool SELECTION_TOOL::selectMultiple() m_selArea->ViewUpdate( VIEW_ITEM::GEOMETRY ); } - if( evt->IsMouseUp( MB_LEFT ) ) + if( evt->IsMouseUp( BUT_LEFT ) ) { // End drawing the selection box m_selArea->ViewSetVisible( false );