From 27a6ce3aedf9dec66a8429ed43cac31f0cacb534 Mon Sep 17 00:00:00 2001 From: supermerill Date: Sun, 3 May 2020 19:15:55 +0200 Subject: [PATCH] Use full_label on setting override for object/modifiers. --- src/libslic3r/Config.hpp | 1 + src/slic3r/GUI/GUI_ObjectList.cpp | 2 +- src/slic3r/GUI/GUI_ObjectSettings.cpp | 6 ++++++ src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp | 6 +++--- src/slic3r/GUI/Tab.cpp | 6 ++---- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/libslic3r/Config.hpp b/src/libslic3r/Config.hpp index 667de0cb4..6cd4915b9 100644 --- a/src/libslic3r/Config.hpp +++ b/src/libslic3r/Config.hpp @@ -1453,6 +1453,7 @@ public: // The full label is shown, when adding an override parameter for an object or a modified object. std::string label; std::string full_label; + std::string get_full_label() const { return !full_label.empty() ? full_label : label; } // With which printer technology is this configuration valid? PrinterTechnology printer_technology = ptUnknown; // Category of a configuration field, from the GUI perspective. diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 91472bd25..241907423 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1216,7 +1216,7 @@ void ObjectList::get_options_menu(settings_menu_hierarchy& settings_menu, const if (improper_category(category, extruders_cnt, !is_part)) continue; - const std::string& label = !opt->full_label.empty() ? opt->full_label : opt->label; + const std::string& label = opt->get_full_label(); std::pair option_label(option, label); std::vector< std::pair > new_category; std::vector< std::pair >& cat_opt_label = diff --git a/src/slic3r/GUI/GUI_ObjectSettings.cpp b/src/slic3r/GUI/GUI_ObjectSettings.cpp index 8abc38612..4b547c0e4 100644 --- a/src/slic3r/GUI/GUI_ObjectSettings.cpp +++ b/src/slic3r/GUI/GUI_ObjectSettings.cpp @@ -145,7 +145,13 @@ bool ObjectSettings::update_settings_list() option.opt.width = 12; if (is_extruders_cat) option.opt.max = wxGetApp().extruders_edited_cnt(); + //use the full label in the gui item + std::string label = option.opt.label; + option.opt.label = option.opt.get_full_label(); + //create the gui item optgroup->append_single_option_line(option); + //restore label, in case of it's ised afterwards. + option.opt.label = label; optgroup->get_field(opt)->m_on_change = [optgroup](const std::string& opt_id, const boost::any& value) { // first of all take a snapshot and then change value in configuration diff --git a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp index f33a7bd8b..1ebf1300e 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp @@ -708,9 +708,9 @@ void GLGizmoHollow::on_render_input_window(float x, float y, float bottom_limit) double closing_d_max = opts[2].second->max; ConfigOptionMode closing_d_mode = opts[2].second->mode; - m_desc["offset"] = _(opts[0].second->label) + ":"; - m_desc["quality"] = _(opts[1].second->label) + ":"; - m_desc["closing_distance"] = _(opts[2].second->label) + ":"; + m_desc["offset"] = _(opts[0].second->get_full_label()) + ":"; + m_desc["quality"] = _(opts[1].second->get_full_label()) + ":"; + m_desc["closing_distance"] = _(opts[2].second->get_full_label()) + ":"; RENDER_AGAIN: diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 9c47fc38e..15787e958 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1946,7 +1946,7 @@ void TabFilament::add_filament_overrides_page() Line line {"",""}; if (opt_key == "filament_retract_lift_above" || opt_key == "filament_retract_lift_below") { Option opt = optgroup->get_option(opt_key); - opt.opt.label = opt.opt.full_label; + opt.opt.label = opt.opt.get_full_label(); line = optgroup->create_single_option_line(opt); } else @@ -3528,9 +3528,7 @@ bool Tab::may_discard_current_dirty_preset(PresetCollection* presets /*= nullptr /*std::string*/wxString name = ""; if (opt.category != OptionCategory::none) name += _(toString(opt.category)) + " > "; - name += !opt.full_label.empty() ? - _(opt.full_label) : - _(opt.label); + name += opt.get_full_label(); changes += tab + /*from_u8*/(name) + "\n"; } // Show a confirmation dialog with the list of dirty options.