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" ) ); menu.Append( 6, _( "Edit violation severities..." ), _( "Open the Board Setup... dialog" ) );
bool modified = false;
switch( GetPopupMenuSelectionFromUser( menu ) ) switch( GetPopupMenuSelectionFromUser( menu ) )
{ {
case 1: case 1:
@ -338,7 +340,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
// Update view // Update view
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node ); static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->ValueChanged( node );
updateDisplayedCounts(); modified = true;
break; break;
case 2: case 2:
@ -350,7 +352,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
else else
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->DeleteCurrentItem( false ); static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->DeleteCurrentItem( false );
updateDisplayedCounts(); modified = true;
break; break;
case 3: case 3:
@ -359,7 +361,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
// Rebuild model and view // Rebuild model and view
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider ); static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
updateDisplayedCounts(); modified = true;
break; break;
case 4: case 4:
@ -368,7 +370,7 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
// Rebuild model and view // Rebuild model and view
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider ); static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
updateDisplayedCounts(); modified = true;
break; break;
case 5: case 5:
@ -383,13 +385,20 @@ void DIALOG_DRC::OnDRCItemRClick( wxDataViewEvent& aEvent )
// Rebuild model and view // Rebuild model and view
static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider ); static_cast<RC_TREE_MODEL*>( aEvent.GetModel() )->SetProvider( m_markersProvider );
updateDisplayedCounts(); modified = true;
break; break;
case 6: case 6:
m_brdEditor->DoShowBoardSetupDialog( _( "Violation Severity" ) ); m_brdEditor->DoShowBoardSetupDialog( _( "Violation Severity" ) );
break; 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(); GetBoard()->SynchronizeNetsAndNetClasses();
// Select default Netclass before writing file. // Select default Netclass before writing file. Useful to save default values in headers.
// Useful to save default values in headers
SetCurrentNetClass( NETCLASS::Default ); 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(); ClearMsgPanel();
wxString upperTxt; wxString upperTxt;
@ -770,10 +773,8 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
GetBoard()->SetFileName( pcbFileName.GetFullPath() ); GetBoard()->SetFileName( pcbFileName.GetFullPath() );
UpdateTitle(); UpdateTitle();
// Put the saved file in File History, unless aCreateBackupFile // Put the saved file in File History, unless aCreateBackupFile is false (which indicates
// is false. // an autosave -- and we don't want autosave files in the file history).
// aCreateBackupFile == false is mainly used to write autosave files
// and not need to have an autosave file in file history
if( aCreateBackupFile ) if( aCreateBackupFile )
UpdateFileHistory( GetBoard()->GetFileName() ); UpdateFileHistory( GetBoard()->GetFileName() );

View File

@ -531,10 +531,6 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
if( open_dlg ) if( open_dlg )
open_dlg->Close( true ); 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() ) if( IsContentModified() )
{ {
wxFileName fileName = GetBoard()->GetFileName(); wxFileName fileName = GetBoard()->GetFileName();