diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 326b8ebabf..dff9cc4474 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -236,10 +236,11 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : updateTitle(); // Create GAL canvas - PCB_BASE_FRAME* parentFrame = static_cast( Kiway().Player( FRAME_PCB, true ) ); + bool boardEditorWasRunning = Kiway().Player( FRAME_PCB, false ) != nullptr; + PCB_BASE_FRAME* pcbFrame = static_cast( Kiway().Player( FRAME_PCB, true ) ); PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize, GetGalDisplayOptions(), - parentFrame->GetGalCanvas()->GetBackend() ); + pcbFrame->GetGalCanvas()->GetBackend() ); SetGalCanvas( drawPanel ); 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 setupTools(); GetGalCanvas()->GetGAL()->SetAxesEnabled( true ); - UseGalCanvas( parentFrame->IsGalCanvasActive() ); + UseGalCanvas( pcbFrame->IsGalCanvasActive() ); if( m_auimgr.GetPane( "m_LayersManagerToolBar" ).IsShown() ) { @@ -356,6 +357,9 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_Layers->OnLayerSelected(); } + if( !boardEditorWasRunning ) + pcbFrame->Destroy(); + m_auimgr.Update(); Raise(); // On some window managers, this is needed diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index 02fb2a643f..7bc0c803b5 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -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) { - wxMessageBox( _("No board currently edited" ) ); + DisplayErrorMessage( this, _("No board currently open." ) ); break; }