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)
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() )
{
wxMessageDialog saveDlg( aParent,
_( "Modifications have been made to one or more symbol "
"libraries. Changes must be saved or discarded before "
"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" ) ) );
wxString msg = _( "Modifications have been made to one or more symbol libraries.\n"
"Changes must be saved or discarded before the symbol library "
"table can be modified." );
int resp = saveDlg.ShowModal();
if( resp == wxID_CANCEL )
switch( UnsavedChangesDialog( aParent, msg ) )
{
libEditor->ThawSearchTree();
return;
case wxID_YES: libEditor->SaveAll(); break;
case wxID_NO: libEditor->RevertAll(); break;
default:
case wxID_CANCEL: libEditor->ThawSearchTree(); return;
}
if( resp == wxID_YES )
libEditor->SaveAll();
else
libEditor->RevertAll();
}
}