Removed a redundant pointer to EDA_EDIT_FRAME.

This commit is contained in:
Maciej Suminski 2014-07-09 11:22:42 +02:00
parent e46c5cb778
commit f5325f8d79
3 changed files with 7 additions and 10 deletions

View File

@ -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<PCB_BASE_FRAME*>( 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<PCB_BASE_FRAME*>( 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<PCB_BASE_FRAME*>( m_toolMgr->GetEditFrame() )->GetGalCanvas()->SetFocus();
#endif /* __APPLE__ */
}

View File

@ -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

View File

@ -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