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

This commit is contained in:
Maciej Suminski 2014-09-08 14:06:38 +02:00
parent 2c1cef339f
commit 9195409f5e
3 changed files with 29 additions and 12 deletions

View File

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

View File

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

View File

@ -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 );
}
}
}