Commit 9195409f authored by Maciej Suminski's avatar Maciej Suminski

pcbnew: GAL updates the worksheet layout when it is reloaded.

parent 2c1cef33
......@@ -135,7 +135,7 @@ public:
*/
EDA_RECT GetBoardBoundingBox( bool aBoardEdgesOnly = false ) const;
void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload
virtual void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload
const PAGE_INFO& GetPageSettings() const; // overload
const wxSize GetPageSizeIU() const; // overload
......
......@@ -855,9 +855,12 @@ public:
*/
bool Clear_Pcb( bool aQuery );
/// @copydoc PCB_BASE_FRAME::SetBoard()
///> @copydoc PCB_BASE_FRAME::SetBoard()
void SetBoard( BOARD* aBoard );
///> @copydoc PCB_BASE_FRAME::SetPageSettings()
void SetPageSettings( const PAGE_INFO& aPageSettings ); // overload
// Drc control
/* function GetDrcController
......
......@@ -500,10 +500,32 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
drawPanel->DisplayBoard( aBoard );
aBoard->GetRatsnest()->Recalculate();
// reload the worksheet
SetPageSettings( aBoard->GetPageSettings() );
// update the tool manager with the new board and its view.
if( m_toolManager )
{
m_toolManager->SetEnvironment( aBoard, drawPanel->GetView(),
drawPanel->GetViewControls(), this );
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
}
}
}
void PCB_EDIT_FRAME::SetPageSettings( const PAGE_INFO& aPageSettings )
{
PCB_BASE_FRAME::SetPageSettings( aPageSettings );
if( IsGalCanvasActive() )
{
PCB_DRAW_PANEL_GAL* drawPanel = static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() );
// Prepare worksheet template
KIGFX::WORKSHEET_VIEWITEM* worksheet;
worksheet = new KIGFX::WORKSHEET_VIEWITEM( &aBoard->GetPageSettings(),
&aBoard->GetTitleBlock() );
worksheet = new KIGFX::WORKSHEET_VIEWITEM( &m_Pcb->GetPageSettings(),
&m_Pcb->GetTitleBlock() );
worksheet->SetSheetName( std::string( GetScreenDesc().mb_str() ) );
BASE_SCREEN* screen = GetScreen();
......@@ -516,14 +538,6 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
// PCB_DRAW_PANEL_GAL takes ownership of the worksheet
drawPanel->SetWorksheet( worksheet );
// update the tool manager with the new board and its view.
if( m_toolManager )
{
m_toolManager->SetEnvironment( aBoard, drawPanel->GetView(),
drawPanel->GetViewControls(), this );
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
}
}
}
......
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