diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index 9053a56b87..8ac79c2dd3 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -972,15 +972,22 @@ void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event ) } else { - KIWAY_PLAYER* player = Kiway().Player( FRAME_PCB, false ); // test open already. + KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB, true ); - if( !player ) + // 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() ) { - player = Kiway().Player( FRAME_PCB, true ); - player->OpenProjectFiles( std::vector( 1, fn.GetFullPath() ) ); - player->Show( true ); + frame->OpenProjectFiles( std::vector( 1, fn.GetFullPath() ) ); + frame->Show( true ); } - player->Raise(); + + // On Windows, Raise() does not bring the window on screen, when iconized + if( frame->IsIconized() ) + frame->Iconize( false ); + + frame->Raise(); } } else diff --git a/kicad/mainframe.cpp b/kicad/mainframe.cpp index 33a039bdf4..d5c5c4fe16 100644 --- a/kicad/mainframe.cpp +++ b/kicad/mainframe.cpp @@ -340,25 +340,17 @@ void KICAD_MANAGER_FRAME::OnRunSchLibEditor( wxCommandEvent& event ) void KICAD_MANAGER_FRAME::RunPcbNew( const wxString& aProjectBoardFileName ) { -#if 0 // line 171 of modview_frame.cpp breaks this code - KIWAY_PLAYER* frame = Kiway.Player( FRAME_PCB, false ); - if( !frame ) - { - frame = Kiway.Player( FRAME_PCB, true ); - frame->OpenProjectFiles( std::vector( 1, aProjectBoardFileName ) ); - frame->Show( true ); - } -#else 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( 1, aProjectBoardFileName ) ); frame->Show( true ); } -#endif - // On Windows, Raise() does not bring the window on screen, when iconized if( frame->IsIconized() ) frame->Iconize( false );