Eeschema: fix a minor bug: the board editor was not launched from the toolbar, if the footprint viewer or the footprint editor was previously run from Eeschema.

This commit is contained in:
jean-pierre charras 2015-06-23 12:59:38 +02:00
parent 5a4e528d6a
commit 35fe8b7a36
2 changed files with 16 additions and 17 deletions

View File

@ -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<wxString>( 1, fn.GetFullPath() ) );
player->Show( true );
frame->OpenProjectFiles( std::vector<wxString>( 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

View File

@ -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<wxString>( 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<wxString>( 1, aProjectBoardFileName ) );
frame->Show( true );
}
#endif
// On Windows, Raise() does not bring the window on screen, when iconized
if( frame->IsIconized() )
frame->Iconize( false );