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 );
SCH_SHEET* loadedSheet =
pi->LoadSchematicFile( aFileName, &Schematic(), nullptr, aProperties );
SCH_SHEET* loadedSheet = pi->LoadSchematicFile( aFileName, &Schematic(), nullptr,
aProperties );
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
// this same PROJECT. It can be very harmful if that calling code is stupid.
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
SaveProjectLocalSettings();
@ -901,10 +909,11 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
}
{
wxFileName fn = fullFileName;
wxFileName fn;
if( converted )
fn.SetExt( FILEEXT::PcbFileExtension );
fn.SetPath( Prj().GetProjectPath() );
fn.SetName( Prj().GetProjectName() );
fn.SetExt( FILEEXT::KiCadPcbFileExtension );
wxString fname = fn.GetFullPath();