Use standard save-changes dialog.

(It also has the buttons in the right order for Mac.)
This commit is contained in:
Jeff Young 2019-07-14 21:39:44 +01:00
parent d767e83dac
commit f30cd67411
1 changed files with 8 additions and 21 deletions

View File

@ -724,32 +724,19 @@ void InvokeSchEditSymbolLibTable( KIWAY* aKiway, wxWindow *aParent )
// This prevents an ugly crash on OSX (https://bugs.launchpad.net/kicad/+bug/1765286) // This prevents an ugly crash on OSX (https://bugs.launchpad.net/kicad/+bug/1765286)
libEditor->FreezeSearchTree(); libEditor->FreezeSearchTree();
// Check the symbol library editor for modifications to give the user a chance to save
// or revert changes before allowing changes to the library table.
if( libEditor->HasLibModifications() ) if( libEditor->HasLibModifications() )
{ {
wxMessageDialog saveDlg( aParent, wxString msg = _( "Modifications have been made to one or more symbol libraries.\n"
_( "Modifications have been made to one or more symbol " "Changes must be saved or discarded before the symbol library "
"libraries. Changes must be saved or discarded before " "table can be modified." );
"the symbol library table can be modified." ),
_( "Warning" ),
wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxCENTER );
saveDlg.SetYesNoCancelLabels( wxMessageDialog::ButtonLabel( _( "Save Changes" ) ),
wxMessageDialog::ButtonLabel(_( "Discard Changes" ) ),
wxMessageDialog::ButtonLabel( _( "Cancel" ) ) );
int resp = saveDlg.ShowModal(); switch( UnsavedChangesDialog( aParent, msg ) )
if( resp == wxID_CANCEL )
{ {
libEditor->ThawSearchTree(); case wxID_YES: libEditor->SaveAll(); break;
return; case wxID_NO: libEditor->RevertAll(); break;
default:
case wxID_CANCEL: libEditor->ThawSearchTree(); return;
} }
if( resp == wxID_YES )
libEditor->SaveAll();
else
libEditor->RevertAll();
} }
} }