Don't save project for legacy board without explicit action

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7368
This commit is contained in:
Jon Evans 2021-04-21 21:27:23 -04:00
parent e5d029af6b
commit e7d3bf29aa
4 changed files with 8 additions and 5 deletions

View File

@ -912,9 +912,6 @@ void SETTINGS_MANAGER::SaveProjectAs( const wxString& aFullPath )
{
wxString oldName = Prj().GetProjectFullName();
// Side effect: clear read-only status
Prj().SetReadOnly( false );
if( aFullPath.IsSameAs( oldName ) )
{
SaveProject( aFullPath );

View File

@ -274,12 +274,15 @@ public:
/**
* Sets the currently loaded project path and saves it (pointers remain valid)
* Note that this will not modify the read-only state of the project, so it will have no effect
* if the project is marked as read-only!
* @param aFullPath is the full filename to set for the project
*/
void SaveProjectAs( const wxString& aFullPath );
/**
* Saves a copy of the current project under the given path
* Saves a copy of the current project under the given path. Will save the copy even if the
* current project is marked as read-only.
*/
void SaveProjectCopy( const wxString& aFullPath );

View File

@ -939,7 +939,10 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool addToHistory,
rulesFile.SetExt( DesignRulesFileExtension );
if( !projectFile.FileExists() && aChangeProject )
{
Prj().SetReadOnly( false );
GetSettingsManager()->SaveProjectAs( projectFile.GetFullPath() );
}
wxFileName currentRules( GetDesignRulesPath() );

View File

@ -237,6 +237,6 @@ void PCB_EDIT_FRAME::SaveProjectSettings()
* The explicit save action in PCB_EDIT_FRAME::SavePcbFile will call SaveProject directly,
* so if the user does choose to save the board, the project file will get created then.
*/
if( !Prj().IsNullProject() && ( fn.Exists() || GetBoard()->m_LegacyDesignSettingsLoaded ) )
if( !Prj().IsNullProject() && fn.Exists() )
GetSettingsManager()->SaveProject();
}