#ifndef slic3r_SearchComboBox_hpp_ #define slic3r_SearchComboBox_hpp_ #include #include #include #include #include #include #include "Preset.hpp" #include "wxExtensions.hpp" namespace Slic3r { namespace Search{ struct InputInfo { DynamicPrintConfig* config {nullptr}; Preset::Type type {Preset::TYPE_INVALID}; ConfigOptionMode mode {comSimple}; }; struct GroupAndCategory { wxString group; wxString category; }; // fuzzy_match flag enum FMFlag { fmUndef = 0, // didn't find fmOptKey, fmLabel, fmLabelLocal, fmGroup, fmGroupLocal, fmCategory, fmCategoryLocal }; struct Option { bool operator<(const Option& other) const { return other.label > this->label; } bool operator>(const Option& other) const { return other.label < this->label; } std::string opt_key; Preset::Type type {Preset::TYPE_INVALID}; wxString label; wxString label_local; wxString group; wxString group_local; wxString category; wxString category_local; FMFlag fuzzy_match_simple(char const *search_pattern) const; FMFlag fuzzy_match_simple(const wxString& search) const; FMFlag fuzzy_match_simple(const std::string &search) const; FMFlag fuzzy_match(char const *search_pattern, int &outScore) const; FMFlag fuzzy_match(const wxString &search, int &outScore) const ; FMFlag fuzzy_match(const std::string &search, int &outScore) const ; }; struct FoundOption { wxString label; wxString marked_label; size_t option_idx {0}; int outScore {0}; void get_label(const char** out_text) const; void get_marked_label(const char** out_text) const; }; class OptionsSearcher { std::string search_line; std::map groups_and_categories; std::vector