From c416f5a1e5202d1ff16a977ba1932ed3ca10e8e0 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Wed, 9 Jul 2014 11:22:42 +0200 Subject: [PATCH] Removed a redundant pointer to EDA_EDIT_FRAME. --- common/tool/tool_dispatcher.cpp | 10 +++++----- include/tool/tool_dispatcher.h | 5 +---- pcbnew/tools/pcb_tools.cpp | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/common/tool/tool_dispatcher.cpp b/common/tool/tool_dispatcher.cpp index 4e66a1271c..89c09a16ec 100644 --- a/common/tool/tool_dispatcher.cpp +++ b/common/tool/tool_dispatcher.cpp @@ -88,8 +88,8 @@ struct TOOL_DISPATCHER::BUTTON_STATE }; -TOOL_DISPATCHER::TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr, PCB_BASE_FRAME* aEditFrame ) : - m_toolMgr( aToolMgr ), m_editFrame( aEditFrame ) +TOOL_DISPATCHER::TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr ) : + m_toolMgr( aToolMgr ) { m_buttons.push_back( new BUTTON_STATE( BUT_LEFT, wxEVT_LEFT_DOWN, wxEVT_LEFT_UP, wxEVT_LEFT_DCLICK ) ); @@ -118,7 +118,7 @@ void TOOL_DISPATCHER::ResetState() KIGFX::VIEW* TOOL_DISPATCHER::getView() { - return m_editFrame->GetGalCanvas()->GetView(); + return static_cast( m_toolMgr->GetEditFrame() )->GetGalCanvas()->GetView(); } @@ -229,7 +229,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) { motion = true; m_lastMousePos = pos; - m_editFrame->UpdateStatusBar(); + static_cast( m_toolMgr->GetEditFrame() )->UpdateStatusBar(); } for( unsigned int i = 0; i < m_buttons.size(); i++ ) @@ -245,7 +245,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) // TODO That's a big ugly workaround, somehow DRAWPANEL_GAL loses focus // after second LMB click and currently I have no means to do better debugging if( type == wxEVT_LEFT_UP ) - m_editFrame->GetGalCanvas()->SetFocus(); + static_cast( m_toolMgr->GetEditFrame() )->GetGalCanvas()->SetFocus(); #endif /* __APPLE__ */ } diff --git a/include/tool/tool_dispatcher.h b/include/tool/tool_dispatcher.h index 8ecd893db1..bea510bc0b 100644 --- a/include/tool/tool_dispatcher.h +++ b/include/tool/tool_dispatcher.h @@ -56,7 +56,7 @@ public: * @param aToolMgr: tool manager instance the events will be sent to * @param aEditFrame: the frame wx events come from */ - TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr, PCB_BASE_FRAME* aEditFrame ); + TOOL_DISPATCHER( TOOL_MANAGER* aToolMgr ); virtual ~TOOL_DISPATCHER(); /** @@ -128,9 +128,6 @@ private: ///> Instance of tool manager that cooperates with the dispatcher. TOOL_MANAGER* m_toolMgr; - - ///> Instance of wxFrame that is the source of UI events. - PCB_BASE_FRAME* m_editFrame; }; #endif diff --git a/pcbnew/tools/pcb_tools.cpp b/pcbnew/tools/pcb_tools.cpp index eaefa97678..cde76c1591 100644 --- a/pcbnew/tools/pcb_tools.cpp +++ b/pcbnew/tools/pcb_tools.cpp @@ -47,7 +47,7 @@ void PCB_EDIT_FRAME::setupTools() { // Create the manager and dispatcher & route draw panel events to the dispatcher m_toolManager = new TOOL_MANAGER; - m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, this ); + m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager ); GetGalCanvas()->SetEventDispatcher( m_toolDispatcher ); // Connect handlers to toolbar buttons