From f30cd67411b7df2aef07e43524f860b26e045869 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 14 Jul 2019 21:39:44 +0100 Subject: [PATCH] Use standard save-changes dialog. (It also has the buttons in the right order for Mac.) --- eeschema/dialogs/panel_sym_lib_table.cpp | 29 +++++++----------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/eeschema/dialogs/panel_sym_lib_table.cpp b/eeschema/dialogs/panel_sym_lib_table.cpp index 845548849a..74ba10353f 100644 --- a/eeschema/dialogs/panel_sym_lib_table.cpp +++ b/eeschema/dialogs/panel_sym_lib_table.cpp @@ -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(); } }