diff options
-rw-r--r-- | src/libslic3r/PrintConfig.cpp | 2 | ||||
-rw-r--r-- | src/slic3r/GUI/MainFrame.cpp | 16 | ||||
-rw-r--r-- | src/slic3r/GUI/Search.cpp | 48 | ||||
-rw-r--r-- | src/slic3r/GUI/Search.hpp | 7 | ||||
-rw-r--r-- | src/slic3r/GUI/Tab.cpp | 7 |
5 files changed, 52 insertions, 28 deletions
diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 3d106b597..098225b01 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2347,7 +2347,7 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionFloat(0)); def = this->add("fan_speedup_overhangs", coBool); - def->label = L("Fan startup delay"); + def->label = L("Allow fan delay on overhangs"); def->category = OptionCategory::firmware; def->tooltip = L("Will only take into account the delay for the cooling of overhangs."); def->mode = comAdvanced; diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 8bd4a56b7..30b309be9 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -1884,13 +1884,19 @@ void MainFrame::select_tab(Tab* tab) { if (!tab) return; - std::vector<Tab*>& tabs_list = wxGetApp().tabs_list; - std::vector<Tab*>::iterator it_tab = std::find(tabs_list.begin(), tabs_list.end(), tab); - if (it_tab != tabs_list.end()) { - select_tab((ETabType)((uint8_t)ETabType::PrintSettings + uint8_t(it_tab - tabs_list.begin()))); + ETabType tab_type = ETabType::LastSettings; + switch (tab->type()) { + case Preset::Type::TYPE_FILAMENT: + case Preset::Type::TYPE_SLA_MATERIAL: + tab_type = ETabType::FilamentSettings; + case Preset::Type::TYPE_PRINT: + case Preset::Type::TYPE_SLA_PRINT: + tab_type = ETabType::PrintSettings; + case Preset::Type::TYPE_PRINTER: + tab_type = ETabType::PrinterSettings; } + select_tab(tab_type); - select_tab(ETabType::LastSettings); } void MainFrame::select_tab(ETabType tab /* = Any*/, bool keep_tab_type) diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp index 1542067b3..a1c2d8895 100644 --- a/src/slic3r/GUI/Search.cpp +++ b/src/slic3r/GUI/Search.cpp @@ -108,6 +108,10 @@ void OptionsSearcher::append_options(DynamicPrintConfig* config, Preset::Type ty wxString label = opt.full_label.empty() ? opt.label : opt.full_label; + if (label_override.find(opt.opt_key) != label_override.end()) { + label = label_override[opt.opt_key][1].empty() ? label_override[opt.opt_key][0] : label_override[opt.opt_key][1]; + } + if (cnt == 0) emplace(opt_key, label); else @@ -185,34 +189,34 @@ bool OptionsSearcher::search(const std::string& search, bool force/* = false*/) { std::wstring out; out += marker_by_type(opt.type, printer_technology); - const std::wstring *prev = nullptr; - for (const std::wstring * const s : { - view_params.category ? &opt.category_local : nullptr, - &opt.group_local, &opt.label_local }) - if (s != nullptr && (prev == nullptr || *prev != *s)) { - if (out.size()>2) - out += sep; - out += *s; - prev = s; - } - return out; + const std::wstring* prev = nullptr; + for (const std::wstring* const s : { + view_params.category ? &opt.category_local : nullptr, + & opt.group_local, & opt.label_local }) + if (s != nullptr && (prev == nullptr || *prev != *s)) { + if (out.size() > 2) + out += sep; + out += *s; + prev = s; + } + return out; }; auto get_label_english = [this, &sep](const Option& opt) { std::wstring out; out += marker_by_type(opt.type, printer_technology); - const std::wstring*prev = nullptr; - for (const std::wstring * const s : { - view_params.category ? &opt.category : nullptr, - &opt.group, &opt.label }) - if (s != nullptr && (prev == nullptr || *prev != *s)) { - if (out.size()>2) - out += sep; - out += *s; - prev = s; - } - return out; + const std::wstring* prev = nullptr; + for (const std::wstring* const s : { + view_params.category ? &opt.category : nullptr, + & opt.group, & opt.label }) + if (s != nullptr && (prev == nullptr || *prev != *s)) { + if (out.size() > 2) + out += sep; + out += *s; + prev = s; + } + return out; }; auto get_tooltip = [this, &sep](const Option& opt) diff --git a/src/slic3r/GUI/Search.hpp b/src/slic3r/GUI/Search.hpp index f8c9dffa6..c3ae7f914 100644 --- a/src/slic3r/GUI/Search.hpp +++ b/src/slic3r/GUI/Search.hpp @@ -128,6 +128,13 @@ public: std::sort(options.begin(), options.end(), [](const Option& o1, const Option& o2) { return o1.opt_key < o2.opt_key; }); } + + static void register_label_override(t_config_option_key key, std::string label, std::string full_label, std::string tooltip) { + label_override.insert({ key, {label, full_label, tooltip} }); + } + +private: + inline static std::unordered_map< t_config_option_key, std::array<std::string, 3>> label_override; }; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index ba528684a..d7011117b 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -48,6 +48,7 @@ #include "PhysicalPrinterDialog.hpp" #include "UnsavedChangesDialog.hpp" #include "SavePresetDialog.hpp" +#include "Search.hpp" #ifdef WIN32 #include <commctrl.h> @@ -1771,6 +1772,7 @@ bool Tab::create_pages(std::string setting_type_name, int idx_page) if (current_group->sidetext_width >= 0) option.opt.sidetext_width = current_group->sidetext_width; + bool need_to_notified_search = false; bool colored = false; wxString label_path; for (int i = 1; i < params.size() - 1; i++) { @@ -1789,10 +1791,12 @@ bool Tab::create_pages(std::string setting_type_name, int idx_page) else if (params[i] == "full_label") { option.opt.label = option.opt.full_label; + need_to_notified_search = true; } else if (params[i].find("label$") != std::string::npos) { option.opt.label = params[i].substr(6, params[i].size() - 6); + need_to_notified_search = true; } else if (boost::starts_with(params[i], "label_width$")) { option.opt.label_width = atoi(params[i].substr(12, params[i].size() - 12).c_str()); @@ -1822,6 +1826,9 @@ bool Tab::create_pages(std::string setting_type_name, int idx_page) } } + if (need_to_notified_search) + Search::OptionsSearcher::register_label_override(option.opt.opt_key, option.opt.label, option.opt.full_label, option.opt.tooltip); + if(height>0) option.opt.height = height; |