Loading common/tool/tool_dispatcher.cpp +2 −17 Original line number Diff line number Diff line Loading @@ -117,21 +117,6 @@ KiGfx::VIEW* TOOL_DISPATCHER::getView() } int TOOL_DISPATCHER::decodeModifiers( const wxKeyboardState* aState ) const { int mods = 0; if( aState->ControlDown() ) mods |= MD_ModCtrl; if( aState->AltDown() ) mods |= MD_ModAlt; if( aState->ShiftDown() ) mods |= MD_ModShift; return mods; } bool TOOL_DISPATCHER::handleMouseButton( wxEvent& aEvent, int aIndex, bool aMotion ) { ButtonState* st = m_buttons[aIndex]; Loading @@ -142,7 +127,7 @@ bool TOOL_DISPATCHER::handleMouseButton( wxEvent& aEvent, int aIndex, bool aMoti bool up = type == st->upEvent; bool down = type == st->downEvent; int mods = decodeModifiers( static_cast<wxMouseEvent*>( &aEvent ) ); int mods = decodeModifiers<wxMouseEvent>( static_cast<wxMouseEvent*>( &aEvent ) ); int args = st->button | mods; if( down ) // Handle mouse button press Loading Loading @@ -246,7 +231,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) { wxKeyEvent* ke = static_cast<wxKeyEvent*>( &aEvent ); int key = ke->GetKeyCode(); int mods = decodeModifiers( ke ); int mods = decodeModifiers<wxKeyEvent>( ke ); if( type == wxEVT_KEY_UP ) { Loading include/tool/tool_dispatcher.h +14 −3 Original line number Diff line number Diff line Loading @@ -29,8 +29,6 @@ #include <tool/tool_event.h> #include <wx/kbdstate.h> class TOOL_MANAGER; class PCB_BASE_FRAME; Loading Loading @@ -98,7 +96,20 @@ private: bool handleMouseButton( wxEvent& aEvent, int aIndex, bool aMotion ); ///> Saves the state of key modifiers (Alt, Ctrl and so on). int decodeModifiers( const wxKeyboardState* aState ) const; template<class EventType> static int decodeModifiers( const EventType* aState ) { int mods = 0; if( aState->ControlDown() ) mods |= MD_ModCtrl; if( aState->AltDown() ) mods |= MD_ModAlt; if( aState->ShiftDown() ) mods |= MD_ModShift; return mods; } ///> Stores all the informations regarding a mouse button state. Loading Loading
common/tool/tool_dispatcher.cpp +2 −17 Original line number Diff line number Diff line Loading @@ -117,21 +117,6 @@ KiGfx::VIEW* TOOL_DISPATCHER::getView() } int TOOL_DISPATCHER::decodeModifiers( const wxKeyboardState* aState ) const { int mods = 0; if( aState->ControlDown() ) mods |= MD_ModCtrl; if( aState->AltDown() ) mods |= MD_ModAlt; if( aState->ShiftDown() ) mods |= MD_ModShift; return mods; } bool TOOL_DISPATCHER::handleMouseButton( wxEvent& aEvent, int aIndex, bool aMotion ) { ButtonState* st = m_buttons[aIndex]; Loading @@ -142,7 +127,7 @@ bool TOOL_DISPATCHER::handleMouseButton( wxEvent& aEvent, int aIndex, bool aMoti bool up = type == st->upEvent; bool down = type == st->downEvent; int mods = decodeModifiers( static_cast<wxMouseEvent*>( &aEvent ) ); int mods = decodeModifiers<wxMouseEvent>( static_cast<wxMouseEvent*>( &aEvent ) ); int args = st->button | mods; if( down ) // Handle mouse button press Loading Loading @@ -246,7 +231,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) { wxKeyEvent* ke = static_cast<wxKeyEvent*>( &aEvent ); int key = ke->GetKeyCode(); int mods = decodeModifiers( ke ); int mods = decodeModifiers<wxKeyEvent>( ke ); if( type == wxEVT_KEY_UP ) { Loading
include/tool/tool_dispatcher.h +14 −3 Original line number Diff line number Diff line Loading @@ -29,8 +29,6 @@ #include <tool/tool_event.h> #include <wx/kbdstate.h> class TOOL_MANAGER; class PCB_BASE_FRAME; Loading Loading @@ -98,7 +96,20 @@ private: bool handleMouseButton( wxEvent& aEvent, int aIndex, bool aMotion ); ///> Saves the state of key modifiers (Alt, Ctrl and so on). int decodeModifiers( const wxKeyboardState* aState ) const; template<class EventType> static int decodeModifiers( const EventType* aState ) { int mods = 0; if( aState->ControlDown() ) mods |= MD_ModCtrl; if( aState->AltDown() ) mods |= MD_ModAlt; if( aState->ShiftDown() ) mods |= MD_ModShift; return mods; } ///> Stores all the informations regarding a mouse button state. Loading