mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-10 13:49:08 +08:00
Removed SearchCombobox from the Sidebar.
Tab->SearchCombobox works with all parameters now. Overridden GetWindow() for PointCtrl.
This commit is contained in:
parent
8898dd5618
commit
ebfaf7abb0
@ -460,6 +460,7 @@ public:
|
||||
x_textctrl->Disable();
|
||||
y_textctrl->Disable(); }
|
||||
wxSizer* getSizer() override { return sizer; }
|
||||
wxWindow* getWindow() override { return dynamic_cast<wxWindow*>(x_textctrl); }
|
||||
};
|
||||
|
||||
class StaticText : public Field {
|
||||
|
@ -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<SearchInput> 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<SearchInput> 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()
|
||||
|
@ -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();
|
||||
|
@ -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()
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user