diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 07b4971244..4fbfe99994 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -602,10 +602,6 @@ void SCH_EDIT_FRAME::OnModify() void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event ) { - wxFileName fn = Prj().AbsolutePath( Schematic().GetFileName() ); - - fn.SetExt( PcbFileExtension ); - if( Kiface().IsSingle() ) { DisplayError( this, _( "Cannot update the PCB, because the Schematic Editor is opened" @@ -614,17 +610,20 @@ void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event ) return; } - KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, true ); + KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false ); - // 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() ) + if( !frame ) { + wxFileName fn = Prj().GetProjectFullName(); + fn.SetExt( PcbFileExtension ); + + frame = Kiway().Player( FRAME_PCB_EDITOR, true ); frame->OpenProjectFiles( std::vector( 1, fn.GetFullPath() ) ); - frame->Show( true ); } + if( !frame->IsVisible() ) + frame->Show( true ); + // On Windows, Raise() does not bring the window on screen, when iconized if( frame->IsIconized() ) frame->Iconize( false ); @@ -798,17 +797,17 @@ void SCH_EDIT_FRAME::OnOpenPcbnew( wxCommandEvent& event ) } else { - KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, true ); + KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_EDITOR, false ); - // 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() ) + if( !frame ) { + frame = Kiway().Player( FRAME_PCB_EDITOR, true ); frame->OpenProjectFiles( std::vector( 1, boardfn.GetFullPath() ) ); - frame->Show( true ); } + if( !frame->IsVisible() ) + frame->Show( true ); + // On Windows, Raise() does not bring the window on screen, when iconized if( frame->IsIconized() ) frame->Iconize( false ); diff --git a/eeschema/tools/backannotate.cpp b/eeschema/tools/backannotate.cpp index 67186d101b..b92ea48a0a 100644 --- a/eeschema/tools/backannotate.cpp +++ b/eeschema/tools/backannotate.cpp @@ -33,7 +33,7 @@ #include #include #include - +#include BACK_ANNOTATE::BACK_ANNOTATE( SCH_EDIT_FRAME* aFrame, REPORTER& aReporter, bool aProcessFootprints, bool aProcessValues, @@ -97,7 +97,17 @@ bool BACK_ANNOTATE::FetchNetlistFromPCB( std::string& aNetlist ) return false; } - m_frame->Kiway().Player( FRAME_PCB_EDITOR, true ); + KIWAY_PLAYER* frame = m_frame->Kiway().Player( FRAME_PCB_EDITOR, false ); + + if( !frame ) + { + wxFileName fn( m_frame->Prj().GetProjectFullName() ); + fn.SetExt( PcbFileExtension ); + + frame = m_frame->Kiway().Player( FRAME_PCB_EDITOR, true ); + frame->OpenProjectFiles( std::vector( 1, fn.GetFullPath() ) ); + } + m_frame->Kiway().ExpressMail( FRAME_PCB_EDITOR, MAIL_PCB_GET_NETLIST, aNetlist ); return true; } @@ -200,6 +210,7 @@ void BACK_ANNOTATE::getChangeList() // If module linked to multi unit symbol, we add all symbol's units to // the change list foundInMultiunit = true; + for( size_t i = 0; i < refList.GetCount(); ++i ) { refList[i].GetComp()->ClearFlags( SKIP_STRUCT ); diff --git a/kicad/import_project.cpp b/kicad/import_project.cpp index 366f5b9329..cfb42aeb11 100644 --- a/kicad/import_project.cpp +++ b/kicad/import_project.cpp @@ -31,17 +31,12 @@ #include #include -#include -#include -#include #include #include -#include #include #include #include -#include #include #include #include "pgm_kicad.h" @@ -114,7 +109,8 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event ) } } - wxFileName pcb( sch ); + wxFileName pcb( sch ); + std::string packet; pro.SetExt( ProjectFileExtension ); pcb.SetExt( LegacyPcbFileExtension ); // enforce extension @@ -126,67 +122,29 @@ void KICAD_MANAGER_FRAME::OnImportEagleFiles( wxCommandEvent& event ) if( sch.FileExists() ) { - KIWAY_PLAYER* schframe = Kiway().Player( FRAME_SCH, false ); + KIWAY_PLAYER* schframe = Kiway().Player( FRAME_SCH, true ); - if( !schframe ) - { - try // SCH frame was not available, try to start it - { - schframe = Kiway().Player( FRAME_SCH, true ); - } - catch( const IO_ERROR& err ) - { - wxMessageBox( _( "Eeschema failed to load:\n" ) + err.What(), - _( "KiCad Error" ), wxOK | wxICON_ERROR, this ); - return; - } - } - - std::string packet = StrPrintf( "%d\n%s", SCH_IO_MGR::SCH_EAGLE, - TO_UTF8( sch.GetFullPath() ) ); + packet = StrPrintf( "%d\n%s", SCH_IO_MGR::SCH_EAGLE, TO_UTF8( sch.GetFullPath() ) ); schframe->Kiway().ExpressMail( FRAME_SCH, MAIL_IMPORT_FILE, packet, this ); - if( !schframe->IsShown() ) // the frame exists, (created by the dialog field editor) - // but no project loaded. - { + if( !schframe->IsShown() ) schframe->Show( true ); - } + // On Windows, Raise() does not bring the window on screen, when iconized if( schframe->IsIconized() ) schframe->Iconize( false ); schframe->Raise(); } - if( pcb.FileExists() ) { - KIWAY_PLAYER* pcbframe = Kiway().Player( FRAME_PCB_EDITOR, false ); + KIWAY_PLAYER* pcbframe = Kiway().Player( FRAME_PCB_EDITOR, true ); - if( !pcbframe ) - { - try // PCB frame was not available, try to start it - { - pcbframe = Kiway().Player( FRAME_PCB_EDITOR, true ); - } - catch( const IO_ERROR& err ) - { - wxMessageBox( _( "Pcbnew failed to load:\n" ) + err.What(), _( "KiCad Error" ), - wxOK | wxICON_ERROR, this ); - return; - } - } - - // 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( !pcbframe->IsVisible() ) - { pcbframe->Show( true ); - } - std::string packet = StrPrintf( "%d\n%s", IO_MGR::EAGLE, - TO_UTF8( pcb.GetFullPath() ) ); + packet = StrPrintf( "%d\n%s", IO_MGR::EAGLE, TO_UTF8( pcb.GetFullPath() ) ); pcbframe->Kiway().ExpressMail( FRAME_PCB_EDITOR, MAIL_IMPORT_FILE, packet, this ); // On Windows, Raise() does not bring the window on screen, when iconized diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index aca29ee8e2..f8261e21f5 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -764,7 +764,7 @@ bool FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard( bool aAddNew ) if( pcbframe == NULL ) // happens when the board editor is not active (or closed) { - DisplayErrorMessage( this, _("No board currently open." ) ); + DisplayErrorMessage( this, _( "No board currently open." ) ); return false; }