diff --git a/resources/data/hints.ini b/resources/data/hints.ini index b0bced57b98..dcfa7fbf34b 100644 --- a/resources/data/hints.ini +++ b/resources/data/hints.ini @@ -21,7 +21,7 @@ # Settings highlight (like search feature) # hypertext_type = settings # hypertext_settings_opt = name_of_settings (hover over settings value and copy last line of hover text) -# hypertext_settings_type = 1 (1 - 5 according to settings tab - to be channged to name of tabs instead of numbers) +# hypertext_settings_type = print ( {print, filament, sla_print, sla_material, printer} according to settings tab) # hypertext_settings_category = Infill (name of panel - written on left in settings) # # Plater top toolbar highlight @@ -67,7 +67,7 @@ text = Fuzzy skin\nDid you know that you can create rough fibre-like texture on the sides of your models using theFuzzy skinfeature? You can also use modifiers to apply fuzzy-skin only to a portion of your model. hypertext_type = settings hypertext_settings_opt = fuzzy_skin -hypertext_settings_type = 1 +hypertext_settings_type = print hypertext_settings_category = Layers and perimeters disabled_tags = SLA @@ -118,7 +118,7 @@ text = Set number of instances\nDid you know that you can right-click a model an text = Combine infill\nDid you know that you can print the infill with a higher layer height compared to perimeters to save print time using the settingCombine infill every. hypertext_type = settings hypertext_settings_opt = infill_every_layers -hypertext_settings_type = 1 +hypertext_settings_type = print hypertext_settings_category = Infill disabled_tags = SLA; simple @@ -142,7 +142,7 @@ disabled_tags = SLA text = Solid infill threshold area\nDid you know that you can make parts of your model with a small cross-section be filled with solid infill automatically? Set theSolid infill threshold area. (Expert mode only.) hypertext_type = settings hypertext_settings_opt = solid_infill_below_area -hypertext_settings_type = 1 +hypertext_settings_type = print hypertext_settings_category = Infill enabled_tags = FFF; expert @@ -207,7 +207,7 @@ hypertext_menubar_item_name = &Configuration Snapshots text = Minimum shell thickness\nDid you know that instead of the number of top and bottom layers, you can define theMinimum shell thicknessin millimeters? This feature is especially useful when using the variable layer height function. hypertext_type = settings hypertext_settings_opt = top_solid_min_thickness -hypertext_settings_type = 1 +hypertext_settings_type = print hypertext_settings_category = Layers and perimeters disabled_tags = SLA diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index c2a68acdca5..52a0c4e872e 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -1743,6 +1743,20 @@ std::string Preset::type_name(Type t) { } } +Preset::Type Preset::type_from_name(std::string name) { + if ("print" == name) + return Preset::TYPE_FFF_PRINT; + if ("filament" == name) + return Preset::TYPE_FFF_FILAMENT; + if ("sla_print" == name) + return Preset::TYPE_SLA_PRINT; + if ("sla_material" == name) + return Preset::TYPE_SLA_MATERIAL; + if ("printer" == name) + return Preset::TYPE_PRINTER; + return Preset::TYPE_INVALID; +} + std::string PresetCollection::section_name() const { return Preset::type_name(this->type()); diff --git a/src/libslic3r/Preset.hpp b/src/libslic3r/Preset.hpp index d70fa6c3474..f4a07870889 100644 --- a/src/libslic3r/Preset.hpp +++ b/src/libslic3r/Preset.hpp @@ -142,6 +142,7 @@ class Preset return PrinterTechnology::ptUnknown; } static std::string type_name(Type t); + static Type type_from_name(std::string name); Type type = TYPE_INVALID; diff --git a/src/slic3r/GUI/HintNotification.cpp b/src/slic3r/GUI/HintNotification.cpp index dbedd0ac632..5d5ada87604 100644 --- a/src/slic3r/GUI/HintNotification.cpp +++ b/src/slic3r/GUI/HintNotification.cpp @@ -415,7 +415,8 @@ void HintDatabase::load_hints_from_file(const boost::filesystem::path& path) // highlight settings } else if (dict["hypertext_type"] == "settings") { std::string opt = dict["hypertext_settings_opt"]; - Preset::Type type = static_cast(std::atoi(dict["hypertext_settings_type"].c_str())); + Preset::Type type = static_cast(Preset::type_from_name(dict["hypertext_settings_type"])); + assert(type != Preset::Type::TYPE_INVALID && wxGetApp().get_tab(type) != nullptr); std::wstring category = boost::nowide::widen(dict["hypertext_settings_category"]); HintData hint_data{ id_string, text1, weight, was_displayed, hypertext_text, follow_text, disabled_tags, enabled_tags, true, documentation_link, [opt, type, category]() { GUI::wxGetApp().sidebar().jump_to_option(opt, type, category); } }; m_loaded_hints.emplace_back(hint_data);