Commit 5249b1a6 authored by Maciej Suminski's avatar Maciej Suminski

Renamed TOOL_MOUSE_BUTTONS constants to avoid name conflict with Windows MB_RIGHT constant.

parent 853b32df
...@@ -89,9 +89,9 @@ struct TOOL_DISPATCHER::BUTTON_STATE ...@@ -89,9 +89,9 @@ struct TOOL_DISPATCHER::BUTTON_STATE
TOOL_DISPATCHER::TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr, PCB_BASE_FRAME* aEditFrame ) : TOOL_DISPATCHER::TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr, PCB_BASE_FRAME* aEditFrame ) :
m_toolMgr( aToolMgr ), m_editFrame( 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( BUT_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( BUT_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_MIDDLE, wxEVT_MIDDLE_DOWN, wxEVT_MIDDLE_UP ) );
ResetState(); ResetState();
} }
......
...@@ -98,10 +98,10 @@ const std::string TOOL_EVENT::Format() const ...@@ -98,10 +98,10 @@ const std::string TOOL_EVENT::Format() const
const FlagString buttons[] = const FlagString buttons[] =
{ {
{ MB_NONE, "none" }, { BUT_NONE, "none" },
{ MB_LEFT, "left" }, { BUT_LEFT, "left" },
{ MB_RIGHT, "right" }, { BUT_RIGHT, "right" },
{ MB_MIDDLE, "middle" }, { BUT_MIDDLE, "middle" },
{ 0, "" } { 0, "" }
}; };
......
...@@ -433,7 +433,7 @@ bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent ) ...@@ -433,7 +433,7 @@ bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent )
// or immediately (CMENU_NOW) mode. The latter is used for clarification lists. // or immediately (CMENU_NOW) mode. The latter is used for clarification lists.
if( st->contextMenuTrigger != CMENU_OFF ) if( st->contextMenuTrigger != CMENU_OFF )
{ {
if( st->contextMenuTrigger == CMENU_BUTTON && !aEvent.IsClick( MB_RIGHT ) ) if( st->contextMenuTrigger == CMENU_BUTTON && !aEvent.IsClick( BUT_RIGHT ) )
break; break;
st->pendingWait = true; st->pendingWait = true;
......
...@@ -93,12 +93,12 @@ enum TOOL_ACTIONS ...@@ -93,12 +93,12 @@ enum TOOL_ACTIONS
enum TOOL_MOUSE_BUTTONS enum TOOL_MOUSE_BUTTONS
{ {
MB_NONE = 0x0, BUT_NONE = 0x0,
MB_LEFT = 0x1, BUT_LEFT = 0x1,
MB_RIGHT = 0x2, BUT_RIGHT = 0x2,
MB_MIDDLE = 0x4, BUT_MIDDLE = 0x4,
MB_BUTTON_MASK = MB_LEFT | MB_RIGHT | MB_MIDDLE, BUT_BUTTON_MASK = BUT_LEFT | BUT_RIGHT | BUT_MIDDLE,
MB_ANY = 0xffffffff BUT_ANY = 0xffffffff
}; };
enum TOOL_MODIFIERS enum TOOL_MODIFIERS
...@@ -158,7 +158,7 @@ public: ...@@ -158,7 +158,7 @@ public:
{ {
if( aCategory == TC_MOUSE ) if( aCategory == TC_MOUSE )
{ {
m_mouseButtons = aExtraParam & MB_BUTTON_MASK; m_mouseButtons = aExtraParam & BUT_BUTTON_MASK;
} }
else if( aCategory == TC_KEYBOARD ) else if( aCategory == TC_KEYBOARD )
{ {
...@@ -227,18 +227,18 @@ public: ...@@ -227,18 +227,18 @@ public:
return m_mouseButtons; return m_mouseButtons;
} }
bool IsClick( int aButtonMask = MB_ANY ) const bool IsClick( int aButtonMask = BUT_ANY ) const
{ {
return ( m_actions == TA_MOUSE_CLICK ) return ( m_actions == TA_MOUSE_CLICK )
&& ( ( m_mouseButtons & aButtonMask ) == aButtonMask ); && ( ( 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 ); 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 ); return ( m_actions == TA_MOUSE_UP ) && ( ( m_mouseButtons & aButtonMask ) == aButtonMask );
} }
......
...@@ -111,10 +111,10 @@ protected: ...@@ -111,10 +111,10 @@ protected:
const TOOL_EVENT evCommand( int aCommandId = -1 ); const TOOL_EVENT evCommand( int aCommandId = -1 );
const TOOL_EVENT evCommand( std::string aCommandStr = "" ); const TOOL_EVENT evCommand( std::string aCommandStr = "" );
const TOOL_EVENT evMotion(); const TOOL_EVENT evMotion();
const TOOL_EVENT evClick( int aButton = MB_ANY ); const TOOL_EVENT evClick( int aButton = BUT_ANY );
const TOOL_EVENT evDrag( int aButton = MB_ANY ); const TOOL_EVENT evDrag( int aButton = BUT_ANY );
const TOOL_EVENT evButtonUp( int aButton = MB_ANY ); const TOOL_EVENT evButtonUp( int aButton = BUT_ANY );
const TOOL_EVENT evButtonDown(int aButton = MB_ANY ); const TOOL_EVENT evButtonDown(int aButton = BUT_ANY );
private: private:
void goInternal( TOOL_STATE_FUNC& aState, const TOOL_EVENT_LIST& aConditions ); void goInternal( TOOL_STATE_FUNC& aState, const TOOL_EVENT_LIST& aConditions );
......
...@@ -323,7 +323,7 @@ void ROUTER_TOOL::startRouting() ...@@ -323,7 +323,7 @@ void ROUTER_TOOL::startRouting()
updateEndItem( *evt ); updateEndItem( *evt );
m_router->Move( m_endSnapPoint, m_endItem ); m_router->Move( m_endSnapPoint, m_endItem );
} }
else if( evt->IsClick( MB_LEFT ) ) else if( evt->IsClick( BUT_LEFT ) )
{ {
updateEndItem( *evt ); updateEndItem( *evt );
...@@ -396,7 +396,7 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent ) ...@@ -396,7 +396,7 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent )
break; // Finish break; // Finish
else if( evt->IsMotion() ) else if( evt->IsMotion() )
updateStartItem( *evt ); updateStartItem( *evt );
else if( evt->IsClick( MB_LEFT ) ) else if( evt->IsClick( BUT_LEFT ) )
{ {
updateStartItem( *evt ); updateStartItem( *evt );
startRouting(); startRouting();
......
...@@ -118,7 +118,7 @@ int MOVE_TOOL::Main( TOOL_EVENT& aEvent ) ...@@ -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 ) if( dragging )
{ {
...@@ -143,7 +143,7 @@ int MOVE_TOOL::Main( TOOL_EVENT& aEvent ) ...@@ -143,7 +143,7 @@ int MOVE_TOOL::Main( TOOL_EVENT& aEvent )
selection.group->ViewUpdate( VIEW_ITEM::GEOMETRY ); selection.group->ViewUpdate( VIEW_ITEM::GEOMETRY );
dragPosition = evt->Position(); 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 break; // Finish
} }
......
...@@ -103,11 +103,11 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent ) ...@@ -103,11 +103,11 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
} }
// single click? Select single object // single click? Select single object
if( evt->IsClick( MB_LEFT ) ) if( evt->IsClick( BUT_LEFT ) )
selectSingle( evt->Position() ); selectSingle( evt->Position() );
// drag with LMB? Select multiple objects (or at least draw a selection box) or drag them // 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 ) if( m_selection.Empty() || m_additive )
{ {
...@@ -299,7 +299,7 @@ bool SELECTION_TOOL::selectMultiple() ...@@ -299,7 +299,7 @@ bool SELECTION_TOOL::selectMultiple()
break; break;
} }
if( evt->IsDrag( MB_LEFT ) ) if( evt->IsDrag( BUT_LEFT ) )
{ {
if( !m_additive ) if( !m_additive )
clearSelection(); clearSelection();
...@@ -311,7 +311,7 @@ bool SELECTION_TOOL::selectMultiple() ...@@ -311,7 +311,7 @@ bool SELECTION_TOOL::selectMultiple()
m_selArea->ViewUpdate( VIEW_ITEM::GEOMETRY ); m_selArea->ViewUpdate( VIEW_ITEM::GEOMETRY );
} }
if( evt->IsMouseUp( MB_LEFT ) ) if( evt->IsMouseUp( BUT_LEFT ) )
{ {
// End drawing the selection box // End drawing the selection box
m_selArea->ViewSetVisible( false ); m_selArea->ViewSetVisible( false );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment