#ifndef slic3r_SettingsIndex_hpp_ #define slic3r_SettingsIndex_hpp_ #include #include #include "libslic3r/PrintConfig.hpp" #include #include #include #include #include #include namespace Slic3r { namespace Search { struct InputInfo { DynamicPrintConfig *config{nullptr}; Preset::Type type{Preset::TYPE_INVALID}; ConfigOptionMode mode{comSimple}; }; struct GroupAndCategory { wxString group; wxString category; wxString icon; // icon of the group's own header, or empty wxString line_label; // label the settings row actually draws (Line::label), or empty wxString line_label_en; // untranslated English of line_label, or empty std::string path; // wiki path (Line::label_path) of the option's line, or empty }; // Title for a setting: the row label, qualified with the field leaf when the row packs several // options (e.g. "Cool Plate \u2013 First layer"). Pure; both inputs are in the same language (the // localized title, or its English counterpart). inline wxString compose_display_label(const wxString& line_label, const wxString& leaf_label, bool multi) { if (line_label.empty()) return leaf_label; if (!multi || leaf_label.empty() || leaf_label == line_label) return line_label; return line_label + L" \u2013 " + leaf_label; // en dash separator } // Title to show. A single-option row uses its live label, which can be renamed at runtime // (brim_width -> "Brim ear radius"); otherwise fall back to the precomposed label. inline wxString resolve_setting_title(const wxString& precomposed, const wxString& live_label, bool live_multi) { if (!live_multi && !live_label.empty()) return live_label; return precomposed; } struct Option { // bool operator<(const Option& other) const { return other.label > this->label; } bool operator<(const Option &other) const { return other.key > this->key; } // Fuzzy matching works at a character level. Thus matching with wide characters is a safer bet than with short characters, // though for some languages (Chinese?) it may not work correctly. std::wstring key; Preset::Type type{Preset::TYPE_INVALID}; std::wstring label; std::wstring label_local; std::wstring group; std::wstring group_local; std::string group_icon; // SVG base name of the group's own header icon, or empty std::wstring category; std::wstring category_local; bool multi_category { false }; ConfigOptionMode mode{comSimple}; // option's visibility threshold; drives the Speed Dial's mode prompt std::string tooltip; // localized ConfigOptionDef::tooltip, or empty std::string wiki_path; // Line::label_path for the option's row, or empty std::string display_label; // label the settings row draws (localized); empty falls back to label std::string display_label_en; // untranslated English of display_label, or empty std::string opt_key() const; }; // Catalog of settings and their metadata. Owns the group/category registry populated by the // settings pages, plus two views of the options: the mode-filtered view the sidebar search // queries, and every option regardless of mode for the Speed Dial. class SettingsIndex { std::map m_groups_and_categories; std::vector