From a316bdfa2231cfb3625356f9910532cc6065ec2e Mon Sep 17 00:00:00 2001 From: tao wang Date: Fri, 25 Nov 2022 14:53:40 +0800 Subject: [PATCH] ENH:notify the user to save the project before switching languages Change-Id: Ife8acc0aeaef013d9dbbb753686ad4b4a319bf80 --- src/slic3r/GUI/Preferences.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index e1a289576..83a771689 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -153,6 +153,17 @@ wxBoxSizer *PreferencesDialog::create_item_language_combobox( if (e.GetString().mb_str() != app_config->get(param)) { { + //check if the project has changed + if (wxGetApp().plater()->is_project_dirty()) { + auto result = MessageDialog(static_cast(this), _L("The current project has unsaved changes, save it before continue?"), + wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Save"), wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxCENTRE).ShowModal(); + + if (result == wxID_YES) { + wxGetApp().plater()->save_project(); + } + } + + // the dialog needs to be destroyed before the call to switch_language() // or sometimes the application crashes into wxDialogBase() destructor // so we put it into an inner scope