From e8b7c6df54987fd1dbfa06b929e171a160996715 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 7 Jan 2014 14:16:47 +0100 Subject: [PATCH] Tools have possibility to react to GAL switching or model (board) reload. --- pcbnew/pcbframe.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 56e80d84bc..32e8c27ba7 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -334,16 +334,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, SetBoard( new BOARD() ); - if( GetGalCanvas() ) - { - ViewReloadBoard( m_Pcb ); - - // update the tool manager with the new board and its view. - if( m_toolManager ) - m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(), - GetGalCanvas()->GetViewControls(), this ); - } - // Create the PCB_LAYER_WIDGET *after* SetBoard(): wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); @@ -543,8 +533,11 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard ) // update the tool manager with the new board and its view. if( m_toolManager ) + { m_toolManager->SetEnvironment( aBoard, GetGalCanvas()->GetView(), GetGalCanvas()->GetViewControls(), this ); + m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); + } } } @@ -749,10 +742,14 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable ) { EDA_DRAW_FRAME::UseGalCanvas( aEnable ); - m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(), - GetGalCanvas()->GetViewControls(), this ); - ViewReloadBoard( m_Pcb ); + + if( aEnable ) + { + m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(), + GetGalCanvas()->GetViewControls(), this ); + m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH ); + } }