Loading common/drawpanel_gal.cpp +2 −3 Original line number Original line Diff line number Diff line Loading @@ -47,7 +47,6 @@ #define METRIC_UNIT_LENGTH (1e9) #define METRIC_UNIT_LENGTH (1e9) EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, const wxPoint& aPosition, const wxSize& aSize, const wxPoint& aPosition, const wxSize& aSize, GalType aGalType ) : GalType aGalType ) : Loading Loading @@ -91,8 +90,8 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin Connect( wxEVT_KEY_UP, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this ); Connect( wxEVT_KEY_UP, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this ); Connect( wxEVT_KEY_DOWN, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this ); Connect( wxEVT_KEY_DOWN, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this ); Connect( wxEVT_ENTER_WINDOW, wxEventHandler( EDA_DRAW_PANEL_GAL::onEnter ), NULL, this ); Connect( wxEVT_ENTER_WINDOW, wxEventHandler( EDA_DRAW_PANEL_GAL::onEnter ), NULL, this ); Connect( TOOL_DISPATCHER::EVT_REFRESH_MOUSE, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), Connect( KiGfx::WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE, NULL, this ); wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this ); m_refreshTimer.SetOwner( this ); m_refreshTimer.SetOwner( this ); Connect( wxEVT_TIMER, wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onRefreshTimer ), NULL, this ); Connect( wxEVT_TIMER, wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onRefreshTimer ), NULL, this ); Loading common/tool/tool_dispatcher.cpp +3 −8 Original line number Original line Diff line number Diff line Loading @@ -22,16 +22,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ */ #include <wx/wx.h> #include <wx/event.h> #include <wxPcbStruct.h> #include <wxPcbStruct.h> #include <wxBasePcbFrame.h> #include <wxBasePcbFrame.h> #include <tool/tool_manager.h> #include <tool/tool_manager.h> #include <tool/tool_dispatcher.h> #include <tool/tool_dispatcher.h> #include <view/view.h> #include <view/view.h> #include <view/view_controls.h> #include <view/wx_view_controls.h> #include <class_drawpanel_gal.h> #include <class_drawpanel_gal.h> Loading @@ -42,8 +39,6 @@ using boost::optional; using boost::optional; const wxEventType TOOL_DISPATCHER::EVT_REFRESH_MOUSE = wxNewEventType(); struct TOOL_DISPATCHER::ButtonState struct TOOL_DISPATCHER::ButtonState { { ButtonState( TOOL_MouseButtons aButton, const wxEventType& aDownEvent, ButtonState( TOOL_MouseButtons aButton, const wxEventType& aDownEvent, Loading Loading @@ -209,11 +204,11 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) type == wxEVT_LEFT_DOWN || type == wxEVT_LEFT_UP || type == wxEVT_LEFT_DOWN || type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_DOWN || type == wxEVT_MIDDLE_UP || type == wxEVT_MIDDLE_DOWN || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_DOWN || type == wxEVT_RIGHT_UP || type == wxEVT_RIGHT_DOWN || type == wxEVT_RIGHT_UP || type == EVT_REFRESH_MOUSE ) type == KiGfx::WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE ) { { VECTOR2D screenPos = m_toolMgr->GetViewControls()->GetCursorPosition(); VECTOR2D screenPos = m_toolMgr->GetViewControls()->GetCursorPosition(); VECTOR2D pos = getView()->ToWorld( screenPos ); VECTOR2D pos = getView()->ToWorld( screenPos ); if( pos != m_lastMousePos || type == EVT_REFRESH_MOUSE ) if( pos != m_lastMousePos || type == KiGfx::WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE ) { { motion = true; motion = true; m_lastMousePos = pos; m_lastMousePos = pos; Loading common/view/wx_view_controls.cpp +3 −1 Original line number Original line Diff line number Diff line Loading @@ -32,6 +32,8 @@ using namespace KiGfx; using namespace KiGfx; const wxEventType WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE = wxNewEventType(); WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxWindow* aParentPanel ) : WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxWindow* aParentPanel ) : VIEW_CONTROLS( aView ), VIEW_CONTROLS( aView ), m_state( IDLE ), m_state( IDLE ), Loading Loading @@ -207,7 +209,7 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent ) m_view->SetCenter( m_view->GetCenter() + dir * m_autoPanSpeed ); m_view->SetCenter( m_view->GetCenter() + dir * m_autoPanSpeed ); // Notify tools that the cursor position has changed in the world coordinates // Notify tools that the cursor position has changed in the world coordinates wxCommandEvent moveEvent( TOOL_DISPATCHER::EVT_REFRESH_MOUSE ); wxCommandEvent moveEvent( EVT_REFRESH_MOUSE ); wxPostEvent( m_parentPanel, moveEvent ); wxPostEvent( m_parentPanel, moveEvent ); } } break; break; Loading include/tool/tool_dispatcher.h +1 −4 Original line number Original line Diff line number Diff line Loading @@ -29,7 +29,7 @@ #include <tool/tool_event.h> #include <tool/tool_event.h> #include <wx/event.h> //#include <wx/event.h> #include <wx/kbdstate.h> #include <wx/kbdstate.h> class TOOL_MANAGER; class TOOL_MANAGER; Loading Loading @@ -65,9 +65,6 @@ public: virtual void DispatchWxEvent( wxEvent& aEvent ); virtual void DispatchWxEvent( wxEvent& aEvent ); virtual void DispatchWxCommand( wxCommandEvent& aEvent ); virtual void DispatchWxCommand( wxCommandEvent& aEvent ); /// Event that forces mouse move event in the dispatcher static const wxEventType EVT_REFRESH_MOUSE; private: private: static const int MouseButtonCount = 3; static const int MouseButtonCount = 3; static const int DragTimeThreshold = 300; static const int DragTimeThreshold = 300; Loading include/view/wx_view_controls.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -84,6 +84,9 @@ public: /// @copydoc VIEW_CONTROLS::GetCursorPosition() /// @copydoc VIEW_CONTROLS::GetCursorPosition() virtual const VECTOR2D GetCursorPosition() const; virtual const VECTOR2D GetCursorPosition() const; /// Event that forces mouse move event in the dispatcher static const wxEventType EVT_REFRESH_MOUSE; private: private: /// Possible states for WX_VIEW_CONTROLS /// Possible states for WX_VIEW_CONTROLS enum State { enum State { Loading Loading
common/drawpanel_gal.cpp +2 −3 Original line number Original line Diff line number Diff line Loading @@ -47,7 +47,6 @@ #define METRIC_UNIT_LENGTH (1e9) #define METRIC_UNIT_LENGTH (1e9) EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWindowId, const wxPoint& aPosition, const wxSize& aSize, const wxPoint& aPosition, const wxSize& aSize, GalType aGalType ) : GalType aGalType ) : Loading Loading @@ -91,8 +90,8 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin Connect( wxEVT_KEY_UP, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this ); Connect( wxEVT_KEY_UP, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this ); Connect( wxEVT_KEY_DOWN, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this ); Connect( wxEVT_KEY_DOWN, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this ); Connect( wxEVT_ENTER_WINDOW, wxEventHandler( EDA_DRAW_PANEL_GAL::onEnter ), NULL, this ); Connect( wxEVT_ENTER_WINDOW, wxEventHandler( EDA_DRAW_PANEL_GAL::onEnter ), NULL, this ); Connect( TOOL_DISPATCHER::EVT_REFRESH_MOUSE, wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), Connect( KiGfx::WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE, NULL, this ); wxEventHandler( EDA_DRAW_PANEL_GAL::onEvent ), NULL, this ); m_refreshTimer.SetOwner( this ); m_refreshTimer.SetOwner( this ); Connect( wxEVT_TIMER, wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onRefreshTimer ), NULL, this ); Connect( wxEVT_TIMER, wxTimerEventHandler( EDA_DRAW_PANEL_GAL::onRefreshTimer ), NULL, this ); Loading
common/tool/tool_dispatcher.cpp +3 −8 Original line number Original line Diff line number Diff line Loading @@ -22,16 +22,13 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ */ #include <wx/wx.h> #include <wx/event.h> #include <wxPcbStruct.h> #include <wxPcbStruct.h> #include <wxBasePcbFrame.h> #include <wxBasePcbFrame.h> #include <tool/tool_manager.h> #include <tool/tool_manager.h> #include <tool/tool_dispatcher.h> #include <tool/tool_dispatcher.h> #include <view/view.h> #include <view/view.h> #include <view/view_controls.h> #include <view/wx_view_controls.h> #include <class_drawpanel_gal.h> #include <class_drawpanel_gal.h> Loading @@ -42,8 +39,6 @@ using boost::optional; using boost::optional; const wxEventType TOOL_DISPATCHER::EVT_REFRESH_MOUSE = wxNewEventType(); struct TOOL_DISPATCHER::ButtonState struct TOOL_DISPATCHER::ButtonState { { ButtonState( TOOL_MouseButtons aButton, const wxEventType& aDownEvent, ButtonState( TOOL_MouseButtons aButton, const wxEventType& aDownEvent, Loading Loading @@ -209,11 +204,11 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) type == wxEVT_LEFT_DOWN || type == wxEVT_LEFT_UP || type == wxEVT_LEFT_DOWN || type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_DOWN || type == wxEVT_MIDDLE_UP || type == wxEVT_MIDDLE_DOWN || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_DOWN || type == wxEVT_RIGHT_UP || type == wxEVT_RIGHT_DOWN || type == wxEVT_RIGHT_UP || type == EVT_REFRESH_MOUSE ) type == KiGfx::WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE ) { { VECTOR2D screenPos = m_toolMgr->GetViewControls()->GetCursorPosition(); VECTOR2D screenPos = m_toolMgr->GetViewControls()->GetCursorPosition(); VECTOR2D pos = getView()->ToWorld( screenPos ); VECTOR2D pos = getView()->ToWorld( screenPos ); if( pos != m_lastMousePos || type == EVT_REFRESH_MOUSE ) if( pos != m_lastMousePos || type == KiGfx::WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE ) { { motion = true; motion = true; m_lastMousePos = pos; m_lastMousePos = pos; Loading
common/view/wx_view_controls.cpp +3 −1 Original line number Original line Diff line number Diff line Loading @@ -32,6 +32,8 @@ using namespace KiGfx; using namespace KiGfx; const wxEventType WX_VIEW_CONTROLS::EVT_REFRESH_MOUSE = wxNewEventType(); WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxWindow* aParentPanel ) : WX_VIEW_CONTROLS::WX_VIEW_CONTROLS( VIEW* aView, wxWindow* aParentPanel ) : VIEW_CONTROLS( aView ), VIEW_CONTROLS( aView ), m_state( IDLE ), m_state( IDLE ), Loading Loading @@ -207,7 +209,7 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent ) m_view->SetCenter( m_view->GetCenter() + dir * m_autoPanSpeed ); m_view->SetCenter( m_view->GetCenter() + dir * m_autoPanSpeed ); // Notify tools that the cursor position has changed in the world coordinates // Notify tools that the cursor position has changed in the world coordinates wxCommandEvent moveEvent( TOOL_DISPATCHER::EVT_REFRESH_MOUSE ); wxCommandEvent moveEvent( EVT_REFRESH_MOUSE ); wxPostEvent( m_parentPanel, moveEvent ); wxPostEvent( m_parentPanel, moveEvent ); } } break; break; Loading
include/tool/tool_dispatcher.h +1 −4 Original line number Original line Diff line number Diff line Loading @@ -29,7 +29,7 @@ #include <tool/tool_event.h> #include <tool/tool_event.h> #include <wx/event.h> //#include <wx/event.h> #include <wx/kbdstate.h> #include <wx/kbdstate.h> class TOOL_MANAGER; class TOOL_MANAGER; Loading Loading @@ -65,9 +65,6 @@ public: virtual void DispatchWxEvent( wxEvent& aEvent ); virtual void DispatchWxEvent( wxEvent& aEvent ); virtual void DispatchWxCommand( wxCommandEvent& aEvent ); virtual void DispatchWxCommand( wxCommandEvent& aEvent ); /// Event that forces mouse move event in the dispatcher static const wxEventType EVT_REFRESH_MOUSE; private: private: static const int MouseButtonCount = 3; static const int MouseButtonCount = 3; static const int DragTimeThreshold = 300; static const int DragTimeThreshold = 300; Loading
include/view/wx_view_controls.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -84,6 +84,9 @@ public: /// @copydoc VIEW_CONTROLS::GetCursorPosition() /// @copydoc VIEW_CONTROLS::GetCursorPosition() virtual const VECTOR2D GetCursorPosition() const; virtual const VECTOR2D GetCursorPosition() const; /// Event that forces mouse move event in the dispatcher static const wxEventType EVT_REFRESH_MOUSE; private: private: /// Possible states for WX_VIEW_CONTROLS /// Possible states for WX_VIEW_CONTROLS enum State { enum State { Loading