Commit f56e2e14 authored by Maciej Suminski's avatar Maciej Suminski

Fixed switching between GAL canvases error.

parent 9a47f4c6
...@@ -489,11 +489,14 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard ) ...@@ -489,11 +489,14 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
if( IsGalCanvasActive() ) if( IsGalCanvasActive() )
{ {
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->DisplayBoard( aBoard ); PCB_DRAW_PANEL_GAL* drawPanel = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() );
drawPanel->DisplayBoard( aBoard );
aBoard->GetRatsnest()->Recalculate(); aBoard->GetRatsnest()->Recalculate();
// Prepare worksheet template // Prepare worksheet template
KIGFX::WORKSHEET_VIEWITEM* worksheet = new KIGFX::WORKSHEET_VIEWITEM( &aBoard->GetPageSettings(), KIGFX::WORKSHEET_VIEWITEM* worksheet;
worksheet = new KIGFX::WORKSHEET_VIEWITEM( &aBoard->GetPageSettings(),
&aBoard->GetTitleBlock() ); &aBoard->GetTitleBlock() );
worksheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) ); worksheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
...@@ -506,13 +509,13 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard ) ...@@ -506,13 +509,13 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
} }
// PCB_DRAW_PANEL_GAL takes ownership of the worksheet // PCB_DRAW_PANEL_GAL takes ownership of the worksheet
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SetWorksheet( worksheet ); drawPanel->SetWorksheet( worksheet );
// update the tool manager with the new board and its view. // update the tool manager with the new board and its view.
if( m_toolManager ) if( m_toolManager )
{ {
m_toolManager->SetEnvironment( aBoard, GetGalCanvas()->GetView(), m_toolManager->SetEnvironment( aBoard, drawPanel->GetView(),
GetGalCanvas()->GetViewControls(), this ); drawPanel->GetViewControls(), this );
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD ); m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
} }
} }
...@@ -638,7 +641,7 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable ) ...@@ -638,7 +641,7 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable )
if( aEnable ) if( aEnable )
{ {
SetBoard( m_Pcb ); SetBoard( m_Pcb );
GetGalCanvas()->GetView()->RecacheAllItems( true );
GetGalCanvas()->StartDrawing(); GetGalCanvas()->StartDrawing();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment