From 8f064dd15511710641d08d0f3303494e90f0b352 Mon Sep 17 00:00:00 2001 From: Oleksandra Yushchenko Date: Wed, 22 Sep 2021 12:44:13 +0200 Subject: [PATCH] Check unsaved changes (#6991) * Check Unsaved changes (partially related to #5903) + Allow create new project when Plater is empty, but some of presets are modified (related to #5903) + When creating new project allow Keep or Discard modification from previous project + Added check of changes: * before any load project (including DnD and "Load From Recent Projects") * before preset updater * when configuration is changing from the ConfigWizard + Dialog caption is added for each check + Create/Destroy ConfigWizard every time when it's called * Check Unsaved changes: Next Improvements + For dialog "Save project changes" added a reason of saving and name of the current project (or "Untitled") + UnsavedChangesDialog: Headers are extended to better explain the reason + Preferences: Fixed tooltiops for "Always ask for unsaved changes when..." + Suppress "Remember my choice" checkbox for actions which are not frequently used * Fixed behavior of the application when try to save changed project but "Cancel" button is selected in "Save file as..." dialog * Check unsaved changes: Improvements for Config Wizard - Check all cases when presets should be updated + Fixed info line for Materials pages. Text of the info relates to the printer technology now * Improved suggested name for a project when Application is closing * Fixed Linux/OSX build warnings --- src/libslic3r/AppConfig.cpp | 3 + src/slic3r/GUI/ConfigWizard.cpp | 84 ++++++++++-- src/slic3r/GUI/ConfigWizard_private.hpp | 2 +- src/slic3r/GUI/ExtraRenderers.cpp | 18 ++- src/slic3r/GUI/GUI_App.cpp | 174 ++++++++++++++++++------ src/slic3r/GUI/GUI_App.hpp | 7 +- src/slic3r/GUI/GUI_ObjectList.cpp | 2 +- src/slic3r/GUI/MainFrame.cpp | 26 ++-- src/slic3r/GUI/MainFrame.hpp | 2 +- src/slic3r/GUI/Plater.cpp | 84 ++++++++---- src/slic3r/GUI/Plater.hpp | 2 +- src/slic3r/GUI/Preferences.cpp | 17 ++- src/slic3r/GUI/Tab.cpp | 20 ++- src/slic3r/GUI/Tab.hpp | 2 +- src/slic3r/GUI/UnsavedChangesDialog.cpp | 151 ++++++++++++-------- src/slic3r/GUI/UnsavedChangesDialog.hpp | 24 +++- src/slic3r/Utils/PresetUpdater.cpp | 22 +-- 17 files changed, 462 insertions(+), 178 deletions(-) diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 177d8d708b..f3a1d59881 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -139,6 +139,9 @@ void AppConfig::set_defaults() if (get("default_action_on_select_preset").empty()) set("default_action_on_select_preset", "none"); // , "transfer", "discard" or "save" + if (get("default_action_on_new_project").empty()) + set("default_action_on_new_project", "none"); // , "keep(transfer)", "discard" or "save" + if (get("color_mapinulation_panel").empty()) set("color_mapinulation_panel", "0"); diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 3f388f4850..ee6e3d5ab5 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -41,6 +41,7 @@ #include "format.hpp" #include "MsgDialog.hpp" #include "libslic3r/libslic3r.h" +#include "UnsavedChangesDialog.hpp" #if defined(__linux__) && defined(__WXGTK3__) #define wxLinux_gtk3 true @@ -741,10 +742,10 @@ void PageMaterials::set_compatible_printers_html_window(const std::vector* are not compatible with some installed printers."); + wxString first_line = format_wxstr(_L("%1% marked with * are not compatible with some installed printers."), materials->technology == T_FFF ? _L("Filaments") : _L("SLA materials")); wxString text; if (all_printers) { - wxString second_line = _L("All installed printers are compatible with the selected filament."); + wxString second_line = format_wxstr(_L("All installed printers are compatible with the selected %1%."), materials->technology == T_FFF ? _L("filament") : _L("SLA material")); text = wxString::Format( "" "