Only save changed severities etc. if the modify bit is set.

(Also means we need to set said bit when changing them.)

Fixes https://gitlab.com/kicad/code/kicad/issues/4164
This commit is contained in:
Jeff Young 2020-04-24 22:59:57 +01:00
parent 2fb2eac4d5
commit fd6dffe170
3 changed files with 21 additions and 15 deletions

View File

@ -331,6 +331,8 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
menu.Append( 6, _( "Edit violation severities..." ), _( "Open the Board Setup... dialog" ) );
bool modified = false;
switch( GetPopupMenuSelectionFromUser( menu ) )
{
case 1:
@ -338,7 +340,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
// Update view
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
updateDisplayedCounts();
modified = true;
break;
case 2:
@ -350,7 +352,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
else
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->DeleteCurrentItem( false );
updateDisplayedCounts();
modified = true;
break;
case 3:
@ -359,7 +361,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
// Rebuild model and view
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
updateDisplayedCounts();
modified = true;
break;
case 4:
@ -368,7 +370,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
// Rebuild model and view
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
updateDisplayedCounts();
modified = true;
break;
case 5:
@ -383,13 +385,20 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
// Rebuild model and view
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
updateDisplayedCounts();
modified = true;
break;
case 6:
m_brdEditor->DoShowBoardSetupDialog( _( "Violation Severity" ) );
break;
}
if( modified )
{
updateDisplayedCounts();
m_brdEditor->OnModify();
m_brdEditor->SyncToolbars();
}
}

View File

@ -734,10 +734,13 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
GetBoard()->SynchronizeNetsAndNetClasses();
// Select default Netclass before writing file.
// Useful to save default values in headers
// Select default Netclass before writing file. Useful to save default values in headers.
SetCurrentNetClass( NETCLASS::Default );
// Save various DRC parameters, such as violation severities (which may have been
// edited via the DRC dialog as well as the Board Setup dialog), DRC exclusions, etc.
SaveProjectSettings();
ClearMsgPanel();
wxString upperTxt;
@ -770,10 +773,8 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
GetBoard()->SetFileName( pcbFileName.GetFullPath() );
UpdateTitle();
// Put the saved file in File History, unless aCreateBackupFile
// is false.
// aCreateBackupFile == false is mainly used to write autosave files
// and not need to have an autosave file in file history
// Put the saved file in File History, unless aCreateBackupFile is false (which indicates
// an autosave -- and we don't want autosave files in the file history).
if( aCreateBackupFile )
UpdateFileHistory( GetBoard()->GetFileName() );

View File

@ -531,10 +531,6 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
if( open_dlg )
open_dlg->Close( true );
// Save various DRC parameters, such as violation severities (which may have been
// edited via the DRC dialog as well as the Board Setup dialog), DRC exclusions, etc.
SaveProjectSettings();
if( IsContentModified() )
{
wxFileName fileName = GetBoard()->GetFileName();