From 25526aa9e102feef1d01e822962532fbdcff27e2 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Tue, 8 Feb 2022 10:28:54 +0100 Subject: [PATCH] preferences option to suppress common --- src/libslic3r/AppConfig.cpp | 2 ++ src/slic3r/GUI/ConfigWizard.cpp | 6 +++++- src/slic3r/GUI/Preferences.cpp | 12 ++++++++++++ src/slic3r/GUI/PresetComboBoxes.cpp | 4 +++- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 5b4bb34a3c..8e8f74e132 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -67,6 +67,8 @@ void AppConfig::set_defaults() // If set, the "- default -" selections of print/filament/printer are suppressed, if there is a valid preset available. if (get("no_defaults").empty()) set("no_defaults", "1"); + if (get("no_common").empty()) + set("no_common", "0"); if (get("show_incompatible_presets").empty()) set("show_incompatible_presets", "0"); diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index e2228101f3..c90e66abe6 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -719,7 +719,11 @@ void PageMaterials::reload_presets() clear(); list_printer->append(_L("(All)"), &EMPTY); - list_printer->append(_L("(Custom)"), &CUSTOM); + + const AppConfig* app_config = wxGetApp().app_config; + if (app_config->get("no_common") == "0") + list_printer->append(_L("(Custom)"), &CUSTOM); + //list_printer->SetLabelMarkup("bald"); for (const Preset* printer : materials->printers) { list_printer->append(printer->name, &printer->name); diff --git a/src/slic3r/GUI/Preferences.cpp b/src/slic3r/GUI/Preferences.cpp index 996d6b2c2e..eda9a1e052 100644 --- a/src/slic3r/GUI/Preferences.cpp +++ b/src/slic3r/GUI/Preferences.cpp @@ -187,6 +187,13 @@ void PreferencesDialog::build(size_t selected_tab) option = Option(def, "no_defaults"); m_optgroup_general->append_single_option_line(option); + def.label = L("Suppress \" Common \" filament presets"); + def.type = coBool; + def.tooltip = L("Suppress \" Common \" filament presets in configuration wizard and sidebar visibility."); + def.set_default_value(new ConfigOptionBool{ app_config->get("no_common") == "1" }); + option = Option(def, "no_common"); + m_optgroup_general->append_single_option_line(option); + def.label = L("Show incompatible print and filament presets"); def.type = coBool; def.tooltip = L("When checked, the print and filament presets are shown in the preset editor " @@ -569,6 +576,8 @@ void PreferencesDialog::accept(wxEvent&) { // if (m_values.find("no_defaults") != m_values.end() // warning_catcher(this, wxString::Format(_L("You need to restart %s to make the changes effective."), SLIC3R_APP_NAME)); + bool update_filament_sidebar = (m_values.find("no_common") != m_values.end()); + std::vector options_to_recreate_GUI = { "no_defaults", "tabs_as_menu", "sys_menu_enabled" }; @@ -653,6 +662,9 @@ void PreferencesDialog::accept(wxEvent&) else // Nothify the UI to update itself from the ini file. wxGetApp().update_ui_from_settings(); + + if (update_filament_sidebar) + wxGetApp().plater()->sidebar().update_presets(Preset::Type::TYPE_FILAMENT); } void PreferencesDialog::on_dpi_changed(const wxRect &suggested_rect) diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index c6d880d2c2..fa457f9a01 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -857,7 +857,9 @@ void PlaterPresetComboBox::update() if (i + 1 == m_collection->num_default_presets()) set_label_marker(Append(separator(L("System presets")), wxNullBitmap)); } - if (!common_presets.empty()) + + const AppConfig* app_config = wxGetApp().app_config; + if (!common_presets.empty() && app_config->get("no_common") == "0") { set_label_marker(Append(separator(L("Common presets")), wxNullBitmap)); for (std::map::iterator it = common_presets.begin(); it != common_presets.end(); ++it) {