Close pcb opened just to get its GAL canvas settings.

Fixes: lp:1752541
* https://bugs.launchpad.net/kicad/+bug/1752541
This commit is contained in:
Jeff Young 2018-03-08 23:50:23 +00:00
parent 4693fd6200
commit c7cc795095
2 changed files with 8 additions and 4 deletions

View File

@ -236,10 +236,11 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
updateTitle(); updateTitle();
// Create GAL canvas // Create GAL canvas
PCB_BASE_FRAME* parentFrame = static_cast<PCB_BASE_FRAME*>( Kiway().Player( FRAME_PCB, true ) ); bool boardEditorWasRunning = Kiway().Player( FRAME_PCB, false ) != nullptr;
PCB_BASE_FRAME* pcbFrame = static_cast<PCB_BASE_FRAME*>( Kiway().Player( FRAME_PCB, true ) );
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize, PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
GetGalDisplayOptions(), GetGalDisplayOptions(),
parentFrame->GetGalCanvas()->GetBackend() ); pcbFrame->GetGalCanvas()->GetBackend() );
SetGalCanvas( drawPanel ); SetGalCanvas( drawPanel );
SetBoard( new BOARD() ); SetBoard( new BOARD() );
@ -344,7 +345,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// Create the manager and dispatcher & route draw panel events to the dispatcher // Create the manager and dispatcher & route draw panel events to the dispatcher
setupTools(); setupTools();
GetGalCanvas()->GetGAL()->SetAxesEnabled( true ); GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
UseGalCanvas( parentFrame->IsGalCanvasActive() ); UseGalCanvas( pcbFrame->IsGalCanvasActive() );
if( m_auimgr.GetPane( "m_LayersManagerToolBar" ).IsShown() ) if( m_auimgr.GetPane( "m_LayersManagerToolBar" ).IsShown() )
{ {
@ -356,6 +357,9 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_Layers->OnLayerSelected(); m_Layers->OnLayerSelected();
} }
if( !boardEditorWasRunning )
pcbFrame->Destroy();
m_auimgr.Update(); m_auimgr.Update();
Raise(); // On some window managers, this is needed Raise(); // On some window managers, this is needed

View File

@ -395,7 +395,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( pcbframe == NULL ) // happens when the board editor is not active (or closed) if( pcbframe == NULL ) // happens when the board editor is not active (or closed)
{ {
wxMessageBox( _("No board currently edited" ) ); DisplayErrorMessage( this, _("No board currently open." ) );
break; break;
} }