Make sure PCB document is opened when doing an update.

Fixes: lp:1830256
* https://bugs.launchpad.net/kicad/+bug/1830256
This commit is contained in:
Jeff Young 2019-05-24 20:41:29 +01:00
parent a73f3fe36d
commit 94c8e84d3b
1 changed files with 13 additions and 0 deletions

View File

@ -745,6 +745,10 @@ void SCH_EDIT_FRAME::CloseErc()
void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
{
wxFileName fn = Prj().AbsolutePath( g_RootSheet->GetScreen()->GetFileName() );
fn.SetExt( PcbFileExtension );
if( Kiface().IsSingle() )
{
DisplayError( this, _( "Cannot update the PCB, because the Schematic Editor is"
@ -756,6 +760,15 @@ void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event )
KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB, true );
// a pcb frame can be already existing, but not yet used.
// this is the case when running the footprint editor, or the footprint viewer first
// if the frame is not visible, the board is not yet loaded
if( !frame->IsVisible() )
{
frame->OpenProjectFiles( std::vector<wxString>( 1, fn.GetFullPath() ) );
frame->Show( true );
}
// On Windows, Raise() does not bring the window on screen, when iconized
if( frame->IsIconized() )
frame->Iconize( false );