diff --git a/src/slic3r/GUI/Field.hpp b/src/slic3r/GUI/Field.hpp index 1f8b642b10..03fa28b2bb 100644 --- a/src/slic3r/GUI/Field.hpp +++ b/src/slic3r/GUI/Field.hpp @@ -460,6 +460,7 @@ public: x_textctrl->Disable(); y_textctrl->Disable(); } wxSizer* getSizer() override { return sizer; } + wxWindow* getWindow() override { return dynamic_cast(x_textctrl); } }; class StaticText : public Field { diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 5a1fa7487a..ab303b7b04 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -834,8 +834,8 @@ Sidebar::Sidebar(Plater *parent) p->sizer_params->Add(p->frequently_changed_parameters->get_sizer(), 0, wxEXPAND | wxTOP | wxBOTTOM, wxOSX ? 1 : margin_5); // Search combobox - p->search_cb = new SearchComboBox(p->scrolled); - p->sizer_params->Add(p->search_cb, 0, wxEXPAND | wxTOP | wxBOTTOM, wxOSX ? 1 : margin_5); +// p->search_cb = new SearchComboBox(p->scrolled); +// p->sizer_params->Add(p->search_cb, 0, wxEXPAND | wxTOP | wxBOTTOM, wxOSX ? 1 : margin_5); // Object List p->object_list = new ObjectList(p->scrolled); @@ -1362,7 +1362,21 @@ static std::vector get_search_inputs(ConfigOptionMode mode) void Sidebar::update_search_list() { - p->search_cb->init(get_search_inputs(m_mode)); + if (p->search_cb) + p->search_cb->init(get_search_inputs(m_mode)); + + std::vector search_list{}; + + auto& tabs_list = wxGetApp().tabs_list; + auto print_tech = wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology(); + + for (auto tab : tabs_list) + if (tab->supports_printer_technology(print_tech)) + search_list.emplace_back(SearchInput{ tab->get_config(), tab->type(), m_mode }); + + for (auto tab : tabs_list) + if (tab->supports_printer_technology(print_tech)) + tab->get_search_cb()->init(search_list); } void Sidebar::update_mode() diff --git a/src/slic3r/GUI/SearchComboBox.cpp b/src/slic3r/GUI/SearchComboBox.cpp index b17643bc95..11742f25c8 100644 --- a/src/slic3r/GUI/SearchComboBox.cpp +++ b/src/slic3r/GUI/SearchComboBox.cpp @@ -34,7 +34,6 @@ bool SearchOptions::Option::containes(const wxString& search_) const return (opt_key.find(into_u8(search)) != std::string::npos || label_.Find(search) != wxNOT_FOUND || category_.Find(search) != wxNOT_FOUND); -/* */ auto search_str = into_u8(search); auto pos = opt_key.find(into_u8(search)); @@ -87,11 +86,11 @@ void SearchOptions::append_options(DynamicPrintConfig* config, Preset::Type type SearchComboBox::SearchComboBox(wxWindow *parent) : -wxBitmapComboBox(parent, wxID_ANY, "", wxDefaultPosition, wxSize(25 * wxGetApp().em_unit(), -1)), +wxBitmapComboBox(parent, wxID_ANY, _(L("Type here to search")) + dots, wxDefaultPosition, wxSize(25 * wxGetApp().em_unit(), -1)), em_unit(wxGetApp().em_unit()) { SetFont(wxGetApp().normal_font()); - default_search_line = search_line = _(L("Search through options")) + dots; + default_search_line = search_line = _(L("Type here to search")) + dots; bmp = ScalableBitmap(this, "search"); #ifdef _WIN32 @@ -124,14 +123,9 @@ wxBitmapComboBox(parent, wxID_ANY, "", wxDefaultPosition, wxSize(25 * wxGetApp() update_combobox(); search_line = this->GetValue(); } - }); - Bind(wxEVT_KILL_FOCUS, [this](wxEvent & e) { e.Skip(); - - SuppressUpdate su(this); - this->SetValue(search_line.IsEmpty() ? default_search_line : search_line); - }); + }); } SearchComboBox::~SearchComboBox() @@ -202,7 +196,7 @@ void SearchComboBox::append_items(const wxString& search) if (option.containes(search)) append(option.label, (void*)&option); - this->Popup(); +// this->Popup(); SuppressUpdate su(this); this->SetValue(search); this->SetInsertionPointEnd(); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 9193249563..f9501069df 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -762,7 +762,7 @@ void Tab::update_mode() update_changed_tree_ui(); // update list of options for search - m_search_cb->init(m_config, type(), m_mode); +// m_search_cb->init(m_config, type(), m_mode); } void Tab::update_visibility() diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index 8805d8d9e0..705a806a3e 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -308,6 +308,7 @@ public: DynamicPrintConfig* get_config() { return m_config; } PresetCollection* get_presets() { return m_presets; } + SearchComboBox* get_search_cb() { return m_search_cb; } size_t get_selected_preset_item() { return m_selected_preset_item; } void on_value_change(const std::string& opt_key, const boost::any& value);