Fix issues when in Pcbnew the Update PCB from schematic command is run.

Now, if not yet opened, the schematic editor frame is created, and shown iconized.
(although iconize it is perhaps not the best option)

It fixes a few (minor) issues (when the schematic editor frame is created, but not shown):
- On OSX the schematic frame is shown as a "ghost" frame.
- If later, the schematic editor is opened from Kicad, a message saying the schematic is already opened is shown.
This is technically true, but unexpected by user.
- If symbols need an annotation, the annotation dialog is opened, can can modify the schematics.
  So it could be better to really open the schematic editor frame.
This commit is contained in:
jean-pierre charras 2018-01-16 13:01:38 +01:00
parent d4ddc009e1
commit 6b9740e681
2 changed files with 17 additions and 3 deletions

View File

@ -329,7 +329,12 @@ void KICAD_MANAGER_FRAME::RunEeschema( const wxString& aProjectSchematicFileName
// On Windows, Raise() does not bring the window on screen, when iconized or not shown
// On linux, Raise() brings the window on screen, but this code works fine
if( frame->IsIconized() )
{
frame->Iconize( false );
// If an iconized frame was created by Pcbnew, Iconize( false ) is not enough
// to show the frame at its normal size: Maximize should be called.
frame->Maximize( false );
}
frame->Raise();
}

View File

@ -1228,13 +1228,22 @@ void PCB_EDIT_FRAME::OnUpdatePCBFromSch( wxCommandEvent& event )
}
else
{
// Update PCB requires a netlist. Therefore the schematic editor must be running
// If this is not the case, open the schematic editor
KIWAY_PLAYER* frame = Kiway().Player( FRAME_SCH, true );
wxFileName schfn( Prj().GetProjectPath(), Prj().GetProjectName(), SchematicFileExtension );
if( !frame->IsVisible() )
if( !frame->IsShown() )
{
wxFileName schfn( Prj().GetProjectPath(), Prj().GetProjectName(), SchematicFileExtension );
frame->OpenProjectFiles( std::vector<wxString>( 1, schfn.GetFullPath() ) );
frame->Show( false );
// Because the schematic editor frame is not on screen, iconize it:
// However, an other valid option is to do not iconize the schematic editor frame
// and show it
frame->Iconize( true );
// we show the schematic editor frame, because do not show is seen as
// a not yet opened schematic by Kicad manager, which is not the case
frame->Show( true );
}
Kiway().ExpressMail( FRAME_SCH, MAIL_SCH_PCB_UPDATE_REQUEST, "", this );