Implemented SearchCtrl class instead of SearchComboBox
Search string are synchronized between Plater and Tabs. List with options and filtered list are in Sidebar. All options list on tabs and Plater use this data from Sidebar Note: SearchComboBox.cpp(hpp) was renamed to Search.cpp(hpp)
This commit is contained in:
parent
5f31d9ed41
commit
5ca6b9f8d0
@ -1 +1,4 @@
|
||||
<svg fill="#808080" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24px" height="24px"><path d="M 13.261719 14.867188 L 15.742188 17.347656 C 15.363281 18.070313 15.324219 18.789063 15.722656 19.1875 L 20.25 23.714844 C 20.820313 24.285156 22.0625 23.972656 23.015625 23.015625 C 23.972656 22.058594 24.285156 20.820313 23.714844 20.25 L 19.191406 15.722656 C 18.789063 15.324219 18.070313 15.363281 17.347656 15.738281 L 14.867188 13.261719 Z M 8.5 0 C 3.804688 0 0 3.804688 0 8.5 C 0 13.195313 3.804688 17 8.5 17 C 13.195313 17 17 13.195313 17 8.5 C 17 3.804688 13.195313 0 8.5 0 Z M 8.5 15 C 4.910156 15 2 12.089844 2 8.5 C 2 4.910156 4.910156 2 8.5 2 C 12.089844 2 15 4.910156 15 8.5 C 15 12.089844 12.089844 15 8.5 15 Z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24px" height="24px">
|
||||
<path fill="#808080" d="M 13.261719 14.867188 L 15.742188 17.347656 C 15.363281 18.070313 15.324219 18.789063 15.722656 19.1875 L 20.25 23.714844 C 20.820313 24.285156 22.0625 23.972656 23.015625 23.015625 C 23.972656 22.058594 24.285156 20.820313 23.714844 20.25 L 19.191406 15.722656 C 18.789063 15.324219 18.070313 15.363281 17.347656 15.738281 L 14.867188 13.261719 Z M 8.5 0 C 3.804688 0 0 3.804688 0 8.5 C 0 13.195313 3.804688 17 8.5 17 C 13.195313 17 17 13.195313 17 8.5 C 17 3.804688 13.195313 0 8.5 0 Z M 8.5 15 C 4.910156 15 2 12.089844 2 8.5 C 2 4.910156 4.910156 2 8.5 2 C 12.089844 2 15 4.910156 15 8.5 C 15 12.089844 12.089844 15 8.5 15 Z"/>
|
||||
<path fill="#ED6B21" d="M 13.261719 14.867188 L 19.191406 15.722656 C 18.789063 15.324219 18.070313 15.363281 17.347656 15.738281 M 8.5 0 C 3.804688 0 0 3.804688 0 8.5 C 0 13.195313 3.804688 17 8.5 17 C 13.195313 17 17 13.195313 17 8.5 C 17 3.804688 13.195313 0 8.5 0 Z M 8.5 15 C 4.910156 15 2 12.089844 2 8.5 C 2 4.910156 4.910156 2 8.5 2 C 12.089844 2 15 4.910156 15 8.5 C 15 12.089844 12.089844 15 8.5 15 Z"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 748 B After Width: | Height: | Size: 1.1 KiB |
@ -151,8 +151,8 @@ set(SLIC3R_GUI_SOURCES
|
||||
GUI/DoubleSlider.hpp
|
||||
GUI/ObjectDataViewModel.cpp
|
||||
GUI/ObjectDataViewModel.hpp
|
||||
GUI/SearchComboBox.cpp
|
||||
GUI/SearchComboBox.hpp
|
||||
GUI/Search.cpp
|
||||
GUI/Search.hpp
|
||||
Utils/Http.cpp
|
||||
Utils/Http.hpp
|
||||
Utils/FixModelByWin10.cpp
|
||||
|
@ -4477,7 +4477,7 @@ bool GLCanvas3D::_render_search_list(float pos_x) const
|
||||
|
||||
std::string& search_line = wxGetApp().sidebar().get_search_line();
|
||||
char *s = new char[255];
|
||||
strcpy(s, search_line.empty() ? _utf8(L("Type here to search")).c_str() : search_line.c_str());
|
||||
strcpy(s, search_line.empty() ? _u8L("Type here to search").c_str() : search_line.c_str());
|
||||
|
||||
imgui->search_list(ImVec2(22 * em, 30 * em), &search_string_getter, s, selected, edited);
|
||||
|
||||
|
@ -80,7 +80,6 @@
|
||||
#include "../Utils/FixModelByWin10.hpp"
|
||||
#include "../Utils/UndoRedo.hpp"
|
||||
#include "RemovableDriveManager.hpp"
|
||||
#include "SearchComboBox.hpp"
|
||||
|
||||
#if ENABLE_NON_STATIC_CANVAS_MANAGER
|
||||
#ifdef __APPLE__
|
||||
@ -1095,6 +1094,7 @@ void Sidebar::msw_rescale()
|
||||
void Sidebar::apply_search_filter()
|
||||
{
|
||||
p->search_list.apply_filters(p->search_line);
|
||||
apply_search_line_on_tabs();
|
||||
}
|
||||
|
||||
void Sidebar::jump_to_option(size_t selected)
|
||||
@ -1373,16 +1373,21 @@ static std::vector<SearchInput> get_search_inputs(ConfigOptionMode mode)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void Sidebar::update_search_list()
|
||||
void Sidebar::apply_search_line_on_tabs()
|
||||
{
|
||||
p->search_list.init(get_search_inputs(m_mode));
|
||||
|
||||
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))
|
||||
tab->get_search_cb()->init(p->search_list);
|
||||
//tab->get_search_cb()->update_combobox();
|
||||
tab->set_search_line(p->search_line);
|
||||
}
|
||||
|
||||
void Sidebar::update_search_list()
|
||||
{
|
||||
p->search_list.init(get_search_inputs(m_mode));
|
||||
apply_search_line_on_tabs();
|
||||
}
|
||||
|
||||
void Sidebar::update_mode()
|
||||
@ -5345,7 +5350,7 @@ bool Plater::search_string_getter(int idx, const char** out_text)
|
||||
const SearchOptions& search_list = p->sidebar->get_search_list();
|
||||
|
||||
if (0 <= idx && (size_t)idx < search_list.size()) {
|
||||
search_list[idx].get_label(out_text);
|
||||
search_list[idx].get_marked_label(out_text);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include "libslic3r/BoundingBox.hpp"
|
||||
#include "wxExtensions.hpp"
|
||||
#include "SearchComboBox.hpp"
|
||||
#include "Search.hpp"
|
||||
|
||||
class wxButton;
|
||||
class ScalableButton;
|
||||
@ -132,6 +132,7 @@ public:
|
||||
void update_mode();
|
||||
bool is_collapsed();
|
||||
void collapse(bool collapse);
|
||||
void apply_search_line_on_tabs();
|
||||
void update_search_list();
|
||||
|
||||
std::vector<PresetComboBox*>& combos_filament();
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "SearchComboBox.hpp"
|
||||
#include "Search.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <algorithm>
|
||||
@ -13,8 +13,7 @@
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/log/trivial.hpp>
|
||||
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/bmpcbox.h>
|
||||
//#include <wx/bmpcbox.h>
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "Tab.hpp"
|
||||
@ -77,6 +76,11 @@ void SearchOptions::Filter::get_label(const char** out_text) const
|
||||
*out_text = label.utf8_str();
|
||||
}
|
||||
|
||||
void SearchOptions::Filter::get_marked_label(const char** out_text) const
|
||||
{
|
||||
*out_text = marked_label.utf8_str();
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void change_opt_key(std::string& opt_key, DynamicPrintConfig* config)
|
||||
{
|
||||
@ -169,18 +173,18 @@ void SearchOptions::apply_filters(const std::string& search)
|
||||
for (size_t i=0; i < options.size(); i++)
|
||||
{
|
||||
if (full_list) {
|
||||
filters.emplace_back(Filter{ options[i].label, i, 0 });
|
||||
filters.emplace_back(Filter{ options[i].label, options[i].label, i, 0 });
|
||||
continue;
|
||||
}
|
||||
|
||||
int score = 0;
|
||||
if (options[i].fuzzy_match_simple(search)/*fuzzy_match(search, score)*/)
|
||||
{
|
||||
wxString label = options[i].label;
|
||||
mark_string(label, from_u8(search));
|
||||
clear_marked_string(label);
|
||||
wxString marked_label = options[i].label;
|
||||
mark_string(marked_label, from_u8(search));
|
||||
clear_marked_string(marked_label);
|
||||
|
||||
filters.emplace_back(Filter{ label, i, score });
|
||||
filters.emplace_back(Filter{ options[i].label, marked_label, i, score });
|
||||
}
|
||||
}
|
||||
|
||||
@ -203,23 +207,24 @@ const SearchOptions::Option& SearchOptions::get_option(size_t pos_in_filter) con
|
||||
assert(pos_in_filter != size_t(-1) && filters[pos_in_filter].option_idx != size_t(-1));
|
||||
return options[filters[pos_in_filter].option_idx];
|
||||
}
|
||||
|
||||
SearchComboBox::SearchComboBox(wxWindow *parent) :
|
||||
/*
|
||||
SearchComboBox::SearchComboBox(wxWindow *parent, SearchOptions& search_list) :
|
||||
wxBitmapComboBox(parent, wxID_ANY, _(L("Type here to search")) + dots, wxDefaultPosition, wxSize(25 * wxGetApp().em_unit(), -1)),
|
||||
em_unit(wxGetApp().em_unit())
|
||||
em_unit(wxGetApp().em_unit()),
|
||||
search_list(search_list)
|
||||
{
|
||||
SetFont(wxGetApp().normal_font());
|
||||
default_search_line = search_line = _(L("Type here to search")) + dots;
|
||||
bmp = ScalableBitmap(this, "search");
|
||||
|
||||
#ifdef _WIN32
|
||||
// Workaround for ignoring CBN_EDITCHANGE events, which are processed after the content of the combo box changes, so that
|
||||
// the index of the item inside CBN_EDITCHANGE may no more be valid.
|
||||
// EnableTextChangedEvents(false);
|
||||
#endif /* _WIN32 */
|
||||
|
||||
Bind(wxEVT_COMBOBOX, [this](wxCommandEvent &evt) {
|
||||
auto selected_item = this->GetSelection();
|
||||
if (selected_item < 0)
|
||||
return;
|
||||
|
||||
wxGetApp().sidebar().jump_to_option(selected_item);
|
||||
|
||||
return;
|
||||
SearchOptions::Option* opt = reinterpret_cast<SearchOptions::Option*>(this->GetClientData(selected_item));
|
||||
wxGetApp().get_tab(opt->type)->activate_option(opt->opt_key, opt->category);
|
||||
|
||||
@ -230,7 +235,7 @@ wxBitmapComboBox(parent, wxID_ANY, _(L("Type here to search")) + dots, wxDefault
|
||||
});
|
||||
|
||||
Bind(wxEVT_TEXT, [this](wxCommandEvent &e) {
|
||||
if (prevent_update)
|
||||
/* if (prevent_update)
|
||||
return;
|
||||
|
||||
if (this->IsTextEmpty())
|
||||
@ -238,7 +243,10 @@ wxBitmapComboBox(parent, wxID_ANY, _(L("Type here to search")) + dots, wxDefault
|
||||
return;
|
||||
}
|
||||
|
||||
if (search_line != this->GetValue()) {
|
||||
* / if (search_line != this->GetValue()) {
|
||||
std::string& search_str = wxGetApp().sidebar().get_search_line();
|
||||
search_str = into_u8(this->GetValue());
|
||||
wxGetApp().sidebar().apply_search_filter();
|
||||
update_combobox();
|
||||
search_line = this->GetValue();
|
||||
}
|
||||
@ -293,6 +301,14 @@ void SearchComboBox::init(const SearchOptions& new_search_list)
|
||||
|
||||
void SearchComboBox::update_combobox()
|
||||
{
|
||||
this->Clear();
|
||||
for (const SearchOptions::Filter& item : search_list.filters)
|
||||
append(item.label);
|
||||
|
||||
// SuppressUpdate su(this);
|
||||
// this->SetValue(default_search_line);
|
||||
|
||||
return;
|
||||
wxString search_str = this->GetValue();
|
||||
if (search_str.IsEmpty() || search_str == default_search_line)
|
||||
// add whole options list to the controll
|
||||
@ -332,5 +348,153 @@ void SearchComboBox::append_items(const wxString& search)
|
||||
this->SetValue(search);
|
||||
this->SetInsertionPointEnd();
|
||||
}
|
||||
*/
|
||||
|
||||
//------------------------------------------
|
||||
// PopupSearchList
|
||||
//------------------------------------------
|
||||
|
||||
PopupSearchList::PopupSearchList(wxWindow* parent) :
|
||||
wxPopupTransientWindow(parent)
|
||||
{
|
||||
panel = new wxPanel(this, wxID_ANY);
|
||||
|
||||
int em_unit = wxGetApp().em_unit();
|
||||
|
||||
search_ctrl = new wxListCtrl(panel, wxID_ANY, wxDefaultPosition, wxSize(25 * em_unit, 35 * em_unit), wxLC_NO_HEADER | wxLC_REPORT);
|
||||
search_ctrl->AppendColumn("");
|
||||
search_ctrl->SetColumnWidth(0, 23 * em_unit);
|
||||
search_ctrl->Bind(wxEVT_LIST_ITEM_SELECTED, &PopupSearchList::OnSelect, this);
|
||||
|
||||
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
topSizer->Add(search_ctrl, 0, wxEXPAND | wxALL, 2);
|
||||
|
||||
panel->SetSizer(topSizer);
|
||||
|
||||
topSizer->Fit(panel);
|
||||
SetClientSize(panel->GetSize());
|
||||
}
|
||||
|
||||
void PopupSearchList::Popup(wxWindow* WXUNUSED(focus))
|
||||
{
|
||||
wxPopupTransientWindow::Popup();
|
||||
}
|
||||
|
||||
void PopupSearchList::OnDismiss()
|
||||
{
|
||||
wxPopupTransientWindow::OnDismiss();
|
||||
}
|
||||
|
||||
bool PopupSearchList::ProcessLeftDown(wxMouseEvent& event)
|
||||
{
|
||||
return wxPopupTransientWindow::ProcessLeftDown(event);
|
||||
}
|
||||
bool PopupSearchList::Show(bool show)
|
||||
{
|
||||
return wxPopupTransientWindow::Show(show);
|
||||
}
|
||||
|
||||
void PopupSearchList::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void PopupSearchList::OnSetFocus(wxFocusEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void PopupSearchList::OnKillFocus(wxFocusEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void PopupSearchList::OnSelect(wxListEvent& event)
|
||||
{
|
||||
int selection = event.GetIndex();
|
||||
if (selection>=0)
|
||||
wxGetApp().sidebar().jump_to_option(selection);
|
||||
|
||||
OnDismiss();
|
||||
}
|
||||
|
||||
void PopupSearchList::update_list(std::vector<SearchOptions::Filter>& filters)
|
||||
{
|
||||
search_ctrl->DeleteAllItems();
|
||||
for (const SearchOptions::Filter& item : filters)
|
||||
search_ctrl->InsertItem(search_ctrl->GetItemCount(), item.label);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------
|
||||
// SearchCtrl
|
||||
//------------------------------------------
|
||||
|
||||
SearchCtrl::SearchCtrl(wxWindow* parent):
|
||||
parent(parent)
|
||||
{
|
||||
popup_win = new PopupSearchList(parent);
|
||||
box_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
search_line = new wxTextCtrl(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(25 * wxGetApp().em_unit(), -1), wxTE_PROCESS_ENTER);
|
||||
search_line->Bind(wxEVT_TEXT, &SearchCtrl::OnInputText, this);
|
||||
search_line->Bind(wxEVT_TEXT_ENTER, &SearchCtrl::PopupList, this);
|
||||
|
||||
search_btn = new ScalableButton(parent, wxID_ANY, "search");
|
||||
search_btn->Bind(wxEVT_BUTTON, &SearchCtrl::PopupList, this);
|
||||
|
||||
box_sizer->Add(search_line, 0, wxALIGN_CENTER_VERTICAL);
|
||||
box_sizer->AddSpacer(5);
|
||||
box_sizer->Add(search_btn, 0, wxALIGN_CENTER_VERTICAL);
|
||||
}
|
||||
|
||||
SearchCtrl::~SearchCtrl()
|
||||
{
|
||||
if (search_btn)
|
||||
search_btn->Destroy();
|
||||
if (popup_win)
|
||||
popup_win->Destroy();
|
||||
}
|
||||
|
||||
void SearchCtrl::OnInputText(wxCommandEvent& )
|
||||
{
|
||||
if (prevent_update)
|
||||
return;
|
||||
std::string& search_str = wxGetApp().sidebar().get_search_line();
|
||||
search_str = into_u8(search_line->GetValue());
|
||||
wxGetApp().sidebar().apply_search_filter();
|
||||
|
||||
popup_win->update_list(wxGetApp().sidebar().get_search_list().filters);
|
||||
}
|
||||
|
||||
void SearchCtrl::PopupList(wxCommandEvent& )
|
||||
{
|
||||
popup_win->update_list(wxGetApp().sidebar().get_search_list().filters);
|
||||
|
||||
wxPoint pos = search_line->ClientToScreen(wxPoint(0, 0));
|
||||
wxSize sz = search_line->GetSize();
|
||||
pos.x -= sz.GetWidth();
|
||||
popup_win->Position(pos, sz);
|
||||
|
||||
popup_win->Popup();
|
||||
}
|
||||
|
||||
void SearchCtrl::set_search_line(const std::string& line)
|
||||
{
|
||||
prevent_update = true;
|
||||
search_line->SetValue(line.empty() ? _L("Type here to search") : from_u8(line));
|
||||
prevent_update = false;
|
||||
}
|
||||
|
||||
void SearchCtrl::msw_rescale()
|
||||
{
|
||||
wxSize size = wxSize(25 * wxGetApp().em_unit(), -1);
|
||||
// Set rescaled min height to correct layout
|
||||
search_line->SetMinSize(size);
|
||||
// Set rescaled size
|
||||
search_btn->msw_rescale();
|
||||
}
|
||||
|
||||
|
||||
}} // namespace Slic3r::GUI
|
@ -1,11 +1,13 @@
|
||||
#ifndef slic3r_SearchComboBox_hpp_
|
||||
#define slic3r_SearchComboBox_hpp_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include <wx/bmpcbox.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/sizer.h>
|
||||
//#include <wx/bmpcbox.h>
|
||||
#include <wx/popupwin.h>
|
||||
#include <wx/listctrl.h>
|
||||
|
||||
#include "Preset.hpp"
|
||||
#include "wxExtensions.hpp"
|
||||
@ -46,15 +48,20 @@ public:
|
||||
|
||||
struct Filter {
|
||||
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;
|
||||
};
|
||||
std::vector<Filter> filters {};
|
||||
|
||||
void clear_options() { options.clear(); }
|
||||
void clear_filters() { filters.clear(); }
|
||||
|
||||
void init(std::vector<SearchInput> input_values);
|
||||
|
||||
void append_options(DynamicPrintConfig* config, Preset::Type type, ConfigOptionMode mode);
|
||||
void apply_filters(const std::string& search);
|
||||
|
||||
@ -67,16 +74,14 @@ public:
|
||||
return f1.outScore > f2.outScore; });
|
||||
};
|
||||
|
||||
void init(std::vector<SearchInput> input_values);
|
||||
size_t options_size() const { return options.size(); }
|
||||
size_t filters_size() const { return filters.size(); }
|
||||
|
||||
size_t size() const { return filters_size(); }
|
||||
|
||||
const Filter& operator[](const size_t pos) const noexcept { return filters[pos]; }
|
||||
const Option& get_option(size_t pos_in_filter) const;
|
||||
};
|
||||
|
||||
/*
|
||||
class SearchComboBox : public wxBitmapComboBox
|
||||
{
|
||||
class SuppressUpdate
|
||||
@ -89,9 +94,10 @@ class SearchComboBox : public wxBitmapComboBox
|
||||
};
|
||||
|
||||
public:
|
||||
SearchComboBox(wxWindow *parent);
|
||||
SearchComboBox(wxWindow *parent, SearchOptions& search_list);
|
||||
~SearchComboBox();
|
||||
|
||||
int append(const wxString& item) { return Append(item, bmp.bmp()); }
|
||||
int append(const wxString& item, void* clientData) { return Append(item, bmp.bmp(), clientData); }
|
||||
int append(const wxString& item, wxClientData* clientData) { return Append(item, bmp.bmp(), clientData); }
|
||||
|
||||
@ -105,8 +111,9 @@ public:
|
||||
void init(const SearchOptions& new_search_list);
|
||||
void update_combobox();
|
||||
|
||||
|
||||
private:
|
||||
SearchOptions search_list;
|
||||
SearchOptions& search_list;
|
||||
wxString default_search_line;
|
||||
wxString search_line;
|
||||
|
||||
@ -115,6 +122,53 @@ private:
|
||||
|
||||
ScalableBitmap bmp;
|
||||
};
|
||||
*/
|
||||
class PopupSearchList : public wxPopupTransientWindow
|
||||
{
|
||||
public:
|
||||
PopupSearchList(wxWindow* parent);
|
||||
~PopupSearchList() {}
|
||||
|
||||
// wxPopupTransientWindow virtual methods are all overridden to log them
|
||||
void Popup(wxWindow* focus = NULL) wxOVERRIDE;
|
||||
void OnDismiss() wxOVERRIDE;
|
||||
bool ProcessLeftDown(wxMouseEvent& event) wxOVERRIDE;
|
||||
bool Show(bool show = true) wxOVERRIDE;
|
||||
|
||||
void update_list(std::vector<SearchOptions::Filter>& filters);
|
||||
|
||||
private:
|
||||
wxWindow* panel;
|
||||
wxListCtrl* search_ctrl{ nullptr };
|
||||
|
||||
void OnSize(wxSizeEvent& event);
|
||||
void OnSetFocus(wxFocusEvent& event);
|
||||
void OnKillFocus(wxFocusEvent& event);
|
||||
void OnSelect(wxListEvent& event);
|
||||
};
|
||||
|
||||
class SearchCtrl
|
||||
{
|
||||
wxWindow* parent {nullptr};
|
||||
wxBoxSizer* box_sizer {nullptr};
|
||||
wxTextCtrl* search_line {nullptr};
|
||||
ScalableButton* search_btn {nullptr};
|
||||
PopupSearchList* popup_win {nullptr};
|
||||
|
||||
bool prevent_update{ false };
|
||||
|
||||
void PopupList(wxCommandEvent& event);
|
||||
void OnInputText(wxCommandEvent& event);
|
||||
|
||||
public:
|
||||
SearchCtrl(wxWindow* parent);
|
||||
~SearchCtrl();
|
||||
|
||||
wxBoxSizer* sizer() const { return box_sizer; }
|
||||
|
||||
void set_search_line(const std::string& search_line);
|
||||
void msw_rescale();
|
||||
};
|
||||
|
||||
}}
|
||||
|
@ -116,7 +116,8 @@ void Tab::create_preset_tab()
|
||||
m_presets_choice = new PresetBitmapComboBox(panel, wxSize(35 * m_em_unit, -1));
|
||||
|
||||
// search combox
|
||||
m_search_cb = new SearchComboBox(panel);
|
||||
// m_search_cb = new SearchComboBox(panel, wxGetApp().sidebar().get_search_list());
|
||||
m_search = new SearchCtrl(panel);
|
||||
|
||||
auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
|
||||
|
||||
@ -198,7 +199,8 @@ void Tab::create_preset_tab()
|
||||
m_hsizer->Add(m_undo_to_sys_btn, 0, wxALIGN_CENTER_VERTICAL);
|
||||
m_hsizer->Add(m_undo_btn, 0, wxALIGN_CENTER_VERTICAL);
|
||||
m_hsizer->AddSpacer(int(/*32*/16 * scale_factor));
|
||||
m_hsizer->Add(m_search_cb, 0, wxALIGN_CENTER_VERTICAL);
|
||||
// m_hsizer->Add(m_search_cb, 0, wxALIGN_CENTER_VERTICAL);
|
||||
m_hsizer->Add(m_search->sizer(), 0, wxALIGN_CENTER_VERTICAL);
|
||||
m_hsizer->AddSpacer(int(16 * scale_factor));
|
||||
// m_hsizer->AddSpacer(int(32 * scale_factor));
|
||||
// m_hsizer->Add(m_question_btn, 0, wxALIGN_CENTER_VERTICAL);
|
||||
@ -767,9 +769,6 @@ void Tab::update_mode()
|
||||
update_visibility();
|
||||
|
||||
update_changed_tree_ui();
|
||||
|
||||
// update list of options for search
|
||||
// m_search_cb->init(m_config, type(), m_mode);
|
||||
}
|
||||
|
||||
void Tab::update_visibility()
|
||||
@ -796,7 +795,8 @@ void Tab::msw_rescale()
|
||||
m_em_unit = wxGetApp().em_unit();
|
||||
|
||||
m_mode_sizer->msw_rescale();
|
||||
m_search_cb->msw_rescale();
|
||||
// m_search_cb->msw_rescale();
|
||||
m_search->msw_rescale();
|
||||
|
||||
m_presets_choice->SetSize(35 * m_em_unit, -1);
|
||||
m_treectrl->SetMinSize(wxSize(20 * m_em_unit, -1));
|
||||
@ -899,6 +899,11 @@ static wxString pad_combo_value_for_config(const DynamicPrintConfig &config)
|
||||
return config.opt_bool("pad_enable") ? (config.opt_bool("pad_around_object") ? _("Around object") : _("Below object")) : _("None");
|
||||
}
|
||||
|
||||
void Tab::set_search_line(const std::string& search_line)
|
||||
{
|
||||
m_search->set_search_line(search_line);
|
||||
}
|
||||
|
||||
void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
||||
{
|
||||
if (wxGetApp().plater() == nullptr) {
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "Event.hpp"
|
||||
#include "wxExtensions.hpp"
|
||||
#include "ConfigManipulation.hpp"
|
||||
#include "SearchComboBox.hpp"
|
||||
#include "Search.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
@ -122,7 +122,8 @@ protected:
|
||||
std::string m_name;
|
||||
const wxString m_title;
|
||||
PresetBitmapComboBox* m_presets_choice;
|
||||
SearchComboBox* m_search_cb;
|
||||
// SearchComboBox* m_search_cb;
|
||||
SearchCtrl* m_search;
|
||||
ScalableButton* m_btn_save_preset;
|
||||
ScalableButton* m_btn_delete_preset;
|
||||
ScalableButton* m_btn_hide_incompatible_presets;
|
||||
@ -308,9 +309,11 @@ public:
|
||||
|
||||
DynamicPrintConfig* get_config() { return m_config; }
|
||||
PresetCollection* get_presets() { return m_presets; }
|
||||
SearchComboBox* get_search_cb() { return m_search_cb; }
|
||||
// SearchComboBox* get_search_cb() { return m_search_cb; }
|
||||
size_t get_selected_preset_item() { return m_selected_preset_item; }
|
||||
|
||||
void set_search_line(const std::string& search_line);
|
||||
|
||||
void on_value_change(const std::string& opt_key, const boost::any& value);
|
||||
|
||||
void update_wiping_button_visibility();
|
||||
|
Loading…
Reference in New Issue
Block a user