From 6b9740e681bce35b177a1afc206bd300ddd72cad Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 16 Jan 2018 13:01:38 +0100 Subject: [PATCH] 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. --- kicad/mainframe.cpp | 5 +++++ pcbnew/pcbframe.cpp | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/kicad/mainframe.cpp b/kicad/mainframe.cpp index 9d2fe5b7b3..c4587fd2d7 100644 --- a/kicad/mainframe.cpp +++ b/kicad/mainframe.cpp @@ -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(); } diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 36c76a66f1..6c7b7e022f 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -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( 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 );