Import PCB into existing project.

Or, to be more direct: don't pull the project rug
out from under EESchema when importing in non-
stand-alone mode.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18241
This commit is contained in:
Jeff Young 2024-06-25 11:48:42 +01:00
parent 14a55facf2
commit a2f7edde2e
2 changed files with 15 additions and 6 deletions

View File

@ -1403,8 +1403,8 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType,
pi->SetProgressReporter( &progressReporter ); pi->SetProgressReporter( &progressReporter );
SCH_SHEET* loadedSheet = SCH_SHEET* loadedSheet = pi->LoadSchematicFile( aFileName, &Schematic(), nullptr,
pi->LoadSchematicFile( aFileName, &Schematic(), nullptr, aProperties ); aProperties );
if( loadedSheet ) if( loadedSheet )
{ {

View File

@ -598,8 +598,16 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
// it knows what consequences that will have on other KIFACEs running and using // it knows what consequences that will have on other KIFACEs running and using
// this same PROJECT. It can be very harmful if that calling code is stupid. // this same PROJECT. It can be very harmful if that calling code is stupid.
SETTINGS_MANAGER* mgr = GetSettingsManager(); SETTINGS_MANAGER* mgr = GetSettingsManager();
bool setProject;
if( pro.GetFullPath() != mgr->Prj().GetProjectFullName() ) if( Kiface().IsSingle() || !( aCtl & KICTL_NONKICAD_ONLY ) )
setProject = pro.GetFullPath() != mgr->Prj().GetProjectFullName();
else
setProject = Prj().GetProjectFullName().IsEmpty();
wxString path = wxPathOnly( Prj().GetProjectFullName() );
if( setProject )
{ {
// calls SaveProject // calls SaveProject
SaveProjectLocalSettings(); SaveProjectLocalSettings();
@ -901,10 +909,11 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
} }
{ {
wxFileName fn = fullFileName; wxFileName fn;
if( converted ) fn.SetPath( Prj().GetProjectPath() );
fn.SetExt( FILEEXT::PcbFileExtension ); fn.SetName( Prj().GetProjectName() );
fn.SetExt( FILEEXT::KiCadPcbFileExtension );
wxString fname = fn.GetFullPath(); wxString fname = fn.GetFullPath();