diff --git a/src/slic3r/GUI/Search.cpp b/src/slic3r/GUI/Search.cpp index 1478e725ab..90566c370d 100644 --- a/src/slic3r/GUI/Search.cpp +++ b/src/slic3r/GUI/Search.cpp @@ -89,15 +89,10 @@ FMFlag Option::fuzzy_match(const std::string& search, int& outScore) const return fuzzy_match(search_pattern, outScore); } -void FoundOption::get_label(const char** out_text) const -{ - *out_text = label.utf8_str(); -} - void FoundOption::get_marked_label_and_tooltip(const char** label_, const char** tooltip_) const { - *label_ = marked_label.utf8_str(); - *tooltip_ = tooltip.utf8_str(); + *label_ = marked_label.c_str(); + *tooltip_ = tooltip.c_str(); } template @@ -254,8 +249,8 @@ bool OptionsSearcher::search(const std::string& search, bool force/* = false*/) { const Option &opt = options[i]; if (full_list) { - wxString label = get_label(opt); - found.emplace_back(FoundOption{ label, label, get_tooltip(opt), i, 0 }); + std::string label = into_u8(get_label(opt)); + found.emplace_back(FoundOption{ label, label, into_u8(get_tooltip(opt)), i, 0 }); continue; } @@ -275,7 +270,7 @@ bool OptionsSearcher::search(const std::string& search, bool force/* = false*/) mark_string(marked_label, from_u8(search)); clear_marked_string(marked_label); - found.emplace_back(FoundOption{ label, marked_label, get_tooltip(opt), i, score }); + found.emplace_back(FoundOption{ into_u8(label), into_u8(marked_label), into_u8(get_tooltip(opt)), i, score }); } } @@ -357,7 +352,7 @@ bool SearchComboPopup::Create(wxWindow* parent) void SearchComboPopup::SetStringValue(const wxString& s) { int n = wxListBox::FindString(s); - if (n >= 0 && n < wxListBox::GetCount()) + if (n >= 0 && n < int(wxListBox::GetCount())) wxListBox::Select(n); // save a combo control's string @@ -549,7 +544,7 @@ void SearchDialog::update_list() const std::vector& filters = searcher->found_options(); for (const FoundOption& item : filters) - search_list->Append(item.label); + search_list->Append(from_u8(item.label)); } void SearchDialog::OnKeyDown(wxKeyEvent& event) diff --git a/src/slic3r/GUI/Search.hpp b/src/slic3r/GUI/Search.hpp index d6e2689de0..37767b0c68 100644 --- a/src/slic3r/GUI/Search.hpp +++ b/src/slic3r/GUI/Search.hpp @@ -71,13 +71,13 @@ struct Option { }; struct FoundOption { - wxString label; - wxString marked_label; - wxString tooltip; + std::string label; + std::string marked_label; + std::string tooltip; size_t option_idx {0}; int outScore {0}; - void get_label(const char** out_text) const; + // 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; }; diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 9c9c8b2a69..a21947b15c 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -11,6 +11,7 @@ #include "BonjourDialog.hpp" #include "WipeTowerDialog.hpp" #include "ButtonsDescription.hpp" +#include "Search.hpp" #include #include diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index 7b231daf89..a13d13f2db 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -33,7 +33,6 @@ #include "Event.hpp" #include "wxExtensions.hpp" #include "ConfigManipulation.hpp" -#include "Search.hpp" namespace Slic3r { namespace GUI {