#ifndef slic3r_SearchComboBox_hpp_ #define slic3r_SearchComboBox_hpp_ #include #include #include #include #include #include #include #include #include #include #include "wxExtensions.hpp" #include "GUI_Utils.hpp" #include "libslic3r/Preset.hpp" #include "Widgets/ScrolledWindow.hpp" #include "Widgets/TextInput.hpp" #include "Widgets/PopupWindow.hpp" #include "GUI_ObjectList.hpp" namespace Slic3r { wxDECLARE_EVENT(wxCUSTOMEVT_JUMP_TO_OPTION, wxCommandEvent); wxDECLARE_EVENT(wxCUSTOMEVT_EXIT_SEARCH, wxCommandEvent); wxDECLARE_EVENT(wxCUSTOMEVT_JUMP_TO_OBJECT, wxCommandEvent); namespace Search { class SearchDialog; struct InputInfo { DynamicPrintConfig *config{nullptr}; Preset::Type type{Preset::TYPE_INVALID}; ConfigOptionMode mode{comSimple}; }; struct GroupAndCategory { wxString group; wxString category; }; 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::wstring category; std::wstring category_local; std::string opt_key() const; }; struct FoundOption { // UTF8 encoding, to be consumed by ImGUI by reference. std::string label; std::string marked_label; std::string tooltip; size_t option_idx{0}; int outScore{0}; // Returning pointers to contents of std::string members, to be used by ImGUI for rendering. void get_marked_label_and_tooltip(const char **label, const char **tooltip) const; }; struct OptionViewParameters { bool category{false}; bool english{false}; int hovered_id{0}; }; class OptionsSearcher { std::string search_line; Preset::Type search_type = Preset::TYPE_INVALID; std::map groups_and_categories; PrinterTechnology printer_technology; std::vector