Fix some bugs in file save as.
The order of operations *appeared* to be a bit out of joint. We need to create a new project in project mode as well as in standalone. Fixes https://gitlab.com/kicad/code/kicad/issues/8143
This commit is contained in:
parent
296a9df530
commit
55d2d0d93e
|
@ -264,7 +264,7 @@ bool AskSaveBoardFileName( PCB_EDIT_FRAME* aParent, wxString* aFileName, bool* a
|
||||||
|
|
||||||
if( wxWindow* extraControl = dlg.GetExtraControl() )
|
if( wxWindow* extraControl = dlg.GetExtraControl() )
|
||||||
*aCreateProject = static_cast<CREATE_PROJECT_CHECKBOX*>( extraControl )->GetValue();
|
*aCreateProject = static_cast<CREATE_PROJECT_CHECKBOX*>( extraControl )->GetValue();
|
||||||
else if( Kiface().IsSingle() && !aParent->Prj().IsNullProject() )
|
else if( !aParent->Prj().IsNullProject() )
|
||||||
*aCreateProject = true;
|
*aCreateProject = true;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -951,8 +951,12 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory,
|
||||||
|
|
||||||
// If no project to load then initialize project text vars with board properties
|
// If no project to load then initialize project text vars with board properties
|
||||||
if( !mgr->LoadProject( projectFile.GetFullPath() ) )
|
if( !mgr->LoadProject( projectFile.GetFullPath() ) )
|
||||||
|
{
|
||||||
Prj().GetTextVars() = GetBoard()->GetProperties();
|
Prj().GetTextVars() = GetBoard()->GetProperties();
|
||||||
|
|
||||||
|
// TODO: save netclasses from currentProject to new project...
|
||||||
|
}
|
||||||
|
|
||||||
GetBoard()->SetProject( &Prj() );
|
GetBoard()->SetProject( &Prj() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1107,21 +1111,28 @@ bool PCB_EDIT_FRAME::SavePcbCopy( const wxString& aFileName, bool aCreateProject
|
||||||
|
|
||||||
SETTINGS_MANAGER* mgr = GetSettingsManager();
|
SETTINGS_MANAGER* mgr = GetSettingsManager();
|
||||||
|
|
||||||
|
// Shelve the current project
|
||||||
GetBoard()->ClearProject();
|
GetBoard()->ClearProject();
|
||||||
|
|
||||||
mgr->SaveProject( currentProject );
|
mgr->SaveProject( currentProject );
|
||||||
mgr->UnloadProject( &Prj() );
|
mgr->UnloadProject( &Prj() );
|
||||||
|
|
||||||
mgr->LoadProject( projectFile.GetFullPath() );
|
// Create a new project for the saved-as-copy
|
||||||
mgr->SaveProject();
|
|
||||||
|
|
||||||
mgr->UnloadProject( &Prj() );
|
|
||||||
mgr->LoadProject( currentProject );
|
|
||||||
|
|
||||||
// If no project to load then initialize project text vars with board properties
|
// If no project to load then initialize project text vars with board properties
|
||||||
if( !mgr->LoadProject( currentProject ) )
|
if( !mgr->LoadProject( projectFile.GetFullPath() ) )
|
||||||
|
{
|
||||||
Prj().GetTextVars() = GetBoard()->GetProperties();
|
Prj().GetTextVars() = GetBoard()->GetProperties();
|
||||||
|
|
||||||
|
// TODO: save netclasses from currentProject to new project...
|
||||||
|
}
|
||||||
|
|
||||||
|
mgr->SaveProject();
|
||||||
|
|
||||||
|
// Now go back to our own project
|
||||||
|
mgr->UnloadProject( &Prj() );
|
||||||
|
mgr->LoadProject( currentProject );
|
||||||
|
|
||||||
GetBoard()->SetProject( &Prj() );
|
GetBoard()->SetProject( &Prj() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,7 +332,7 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply high-contrast dimming
|
// Apply high-contrast dimming
|
||||||
if( m_hiContrastEnabled && !highlighted && !selected )
|
if( m_hiContrastEnabled && m_highContrastLayers.size() && !highlighted && !selected )
|
||||||
{
|
{
|
||||||
PCB_LAYER_ID primary = GetPrimaryHighContrastLayer();
|
PCB_LAYER_ID primary = GetPrimaryHighContrastLayer();
|
||||||
bool isActive = m_highContrastLayers.count( aLayer );
|
bool isActive = m_highContrastLayers.count( aLayer );
|
||||||
|
|
Loading…
Reference in New Issue