From fe4c01a6f25e77d918e7eb89eaf3f828ef5aad38 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 16 Sep 2014 10:34:51 +0200 Subject: [PATCH] Kicad manager: fix an issue when starting eeschema from its button: if the library editor was previously running, and if the quasimodal field editor dialog was called, eeschema dis not start on Windows, or started but dis not load the schematic project on Linux. Enhancement: if a tool is running but is iconized, clicking on its button bring the window on screen. --- .../dialog_edit_component_in_schematic.cpp | 2 +- kicad/mainframe.cpp | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index 7e44707dbf..55d2ef8a16 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -106,7 +106,7 @@ private: void setRowItem( int aFieldNdx, const SCH_FIELD& aField ); // event handlers - void OnCloseDialog( wxCloseEvent& event ); + void OnCloseDialog( wxCloseEvent& event ); void OnListItemDeselected( wxListEvent& event ); void OnListItemSelected( wxListEvent& event ); void OnCancelButtonClick( wxCommandEvent& event ); diff --git a/kicad/mainframe.cpp b/kicad/mainframe.cpp index 1d3aa08156..d50f4b174c 100644 --- a/kicad/mainframe.cpp +++ b/kicad/mainframe.cpp @@ -278,12 +278,25 @@ void KICAD_MANAGER_FRAME::Execute( wxWindow* frame, const wxString& execFile, void KICAD_MANAGER_FRAME::RunEeschema( const wxString& aProjectSchematicFileName ) { KIWAY_PLAYER* frame = Kiway.Player( FRAME_SCH, false ); + + // Please: note: DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers() calls + // Kiway.Player( FRAME_SCH, true ) + // therefore, the schematic editor is sometimes running, but the schematic project + // is not loaded, if the library editor was called, and the dialog field editor was used. if( !frame ) { frame = Kiway.Player( FRAME_SCH, true ); + } + + if( !frame->IsShown() ) // the frame exists, but no project loaded. + { frame->OpenProjectFiles( std::vector( 1, aProjectSchematicFileName ) ); frame->Show( true ); } + + if( frame->IsIconized() ) + frame->Iconize( false ); + frame->Raise(); } @@ -301,12 +314,17 @@ void KICAD_MANAGER_FRAME::OnRunEeschema( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::OnRunSchLibEditor( wxCommandEvent& event ) { KIWAY_PLAYER* frame = Kiway.Player( FRAME_SCH_LIB_EDITOR, false ); + if( !frame ) { frame = Kiway.Player( FRAME_SCH_LIB_EDITOR, true ); // frame->OpenProjectFiles( std::vector( 1, aProjectSchematicFileName ) ); frame->Show( true ); } + + if( frame->IsIconized() ) + frame->Iconize( false ); + frame->Raise(); } @@ -331,6 +349,10 @@ void KICAD_MANAGER_FRAME::RunPcbNew( const wxString& aProjectBoardFileName ) } #endif + + if( frame->IsIconized() ) + frame->Iconize( false ); + frame->Raise(); } @@ -358,6 +380,9 @@ void KICAD_MANAGER_FRAME::OnRunPcbFpEditor( wxCommandEvent& event ) frame->Show( true ); } + if( frame->IsIconized() ) + frame->Iconize( false ); + frame->Raise(); } @@ -392,6 +417,10 @@ void KICAD_MANAGER_FRAME::OnRunCvpcb( wxCommandEvent& event ) frame->OpenProjectFiles( std::vector( 1, fn.GetFullPath() ) ); frame->Show( true ); } + + if( frame->IsIconized() ) + frame->Iconize( false ); + frame->Raise(); }