mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-06 14:37:36 -06:00
Modernize Object Search Box & Improvements for Parameter Search Box (#9434)
* update * Update Plater.cpp * Update Plater.cpp * Update Plater.cpp * Update Plater.cpp * Update Plater.cpp * Update Tab.cpp * update * Update Tab.cpp * Update Plater.cpp * Update Tab.cpp
This commit is contained in:
parent
0d3683c3e1
commit
9f4cd93817
2 changed files with 42 additions and 17 deletions
|
@ -352,7 +352,8 @@ struct Sidebar::priv
|
|||
wxPanel* m_panel_project_title;
|
||||
ScalableButton* m_filament_icon = nullptr;
|
||||
Button * m_flushing_volume_btn = nullptr;
|
||||
wxSearchCtrl* m_search_bar = nullptr;
|
||||
TextInput* m_search_item = nullptr;
|
||||
StaticBox* m_search_bar = nullptr;
|
||||
Search::SearchObjectDialog* dia = nullptr;
|
||||
|
||||
// BBS printer config
|
||||
|
@ -426,7 +427,7 @@ void Sidebar::priv::on_search_update()
|
|||
{
|
||||
m_object_list->assembly_plate_object_name();
|
||||
|
||||
wxString search_text = m_search_bar->GetValue();
|
||||
wxString search_text = m_search_item->GetTextCtrl()->GetValue();
|
||||
m_object_list->GetModel()->search_object(search_text);
|
||||
dia->update_list();
|
||||
}
|
||||
|
@ -439,7 +440,7 @@ void Sidebar::priv::jump_to_object(ObjectDataViewModelNode* item)
|
|||
void Sidebar::priv::can_search()
|
||||
{
|
||||
if (m_search_bar->IsShown()) {
|
||||
m_search_bar->SetFocus();
|
||||
m_search_item->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1092,25 +1093,45 @@ Sidebar::Sidebar(Plater *parent)
|
|||
//add project content
|
||||
p->sizer_params = new wxBoxSizer(wxVERTICAL);
|
||||
|
||||
p->m_search_bar = new wxSearchCtrl(p->scrolled, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
|
||||
p->m_search_bar->ShowSearchButton(true);
|
||||
p->m_search_bar->ShowCancelButton(true);
|
||||
p->m_search_bar->SetDescriptiveText(_L("Search plate, object and part."));
|
||||
// ORCA: Update search box to modern style
|
||||
p->m_search_bar = new StaticBox(p->scrolled);
|
||||
p->m_search_bar->SetCornerRadius(0);
|
||||
p->m_search_bar->SetBorderColor(wxColour("#CECECE"));
|
||||
|
||||
p->m_search_bar->Bind(wxEVT_SET_FOCUS, [this](wxFocusEvent&) {
|
||||
p->m_search_item = new TextInput(p->m_search_bar, wxEmptyString, wxEmptyString, "", wxDefaultPosition, wxDefaultSize, 0 | wxBORDER_NONE);
|
||||
p->m_search_item->SetIcon(*BitmapCache().load_svg("search", FromDIP(16), FromDIP(16))); // ORCA: Add search icon to search box
|
||||
|
||||
wxTextCtrl* text_ctrl = p->m_search_item->GetTextCtrl();
|
||||
text_ctrl->SetHint(_L("Search plate, object and part."));
|
||||
text_ctrl->SetForegroundColour(wxColour("#262E30"));
|
||||
text_ctrl->SetFont(Label::Body_13);
|
||||
text_ctrl->SetSize(wxSize(-1, FromDIP(16))); // Centers text vertically
|
||||
|
||||
text_ctrl->Bind(wxEVT_SET_FOCUS, [this](wxFocusEvent& e) {
|
||||
this->p->on_search_update();
|
||||
p->m_search_bar->SetBorderColor(wxColour("#009688"));
|
||||
wxPoint pos = this->p->m_search_bar->ClientToScreen(wxPoint(0, 0));
|
||||
pos.y += this->p->m_search_bar->GetRect().height;
|
||||
p->dia->SetPosition(pos);
|
||||
p->dia->Popup();
|
||||
});
|
||||
p->m_search_bar->Bind(wxEVT_COMMAND_TEXT_UPDATED, [this](wxCommandEvent&) {
|
||||
e.Skip(); // required to show caret
|
||||
});
|
||||
text_ctrl->Bind(wxEVT_COMMAND_TEXT_UPDATED, [this](wxCommandEvent&) {
|
||||
this->p->on_search_update();
|
||||
});
|
||||
p->m_search_bar->Bind(wxEVT_KILL_FOCUS, [this](wxFocusEvent& e) {
|
||||
});
|
||||
text_ctrl->Bind(wxEVT_KILL_FOCUS, [this](wxFocusEvent& e) {
|
||||
p->dia->Dismiss();
|
||||
p->m_search_bar->SetBorderColor(wxColour("#CECECE"));
|
||||
p->m_search_item->GetTextCtrl()->SetValue(""); // reset value when loose focus
|
||||
e.Skip();
|
||||
});
|
||||
});
|
||||
|
||||
auto search_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
search_sizer->Add(new wxWindow(p->m_search_bar, wxID_ANY, wxDefaultPosition, wxSize(0, 0)), 0, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(1));
|
||||
search_sizer->Add(p->m_search_item, 1, wxEXPAND | wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(2));
|
||||
p->m_search_bar->SetSizer(search_sizer);
|
||||
p->m_search_bar->Layout();
|
||||
search_sizer->Fit(p->m_search_bar);
|
||||
|
||||
p->m_object_list = new ObjectList(p->scrolled);
|
||||
|
||||
|
@ -1122,7 +1143,7 @@ Sidebar::Sidebar(Plater *parent)
|
|||
// Frequently Object Settings
|
||||
p->object_settings = new ObjectSettings(p->scrolled);
|
||||
|
||||
p->dia = new Search::SearchObjectDialog(p->m_object_list, p->m_search_bar);
|
||||
p->dia = new Search::SearchObjectDialog(p->m_object_list, text_ctrl);
|
||||
#if !NEW_OBJECT_SETTING
|
||||
p->object_settings->Hide();
|
||||
p->sizer_params->Add(p->object_settings->get_sizer(), 0, wxEXPAND | wxTOP, 5 * em / 10);
|
||||
|
@ -1511,6 +1532,9 @@ void Sidebar::msw_rescale()
|
|||
// BBS
|
||||
//p->object_manipulation->msw_rescale();
|
||||
p->object_settings->msw_rescale();
|
||||
p->m_search_item->Rescale();
|
||||
p->m_search_item->GetTextCtrl()->SetSize(wxSize(-1, FromDIP(16)));
|
||||
p->m_search_bar->Layout();
|
||||
|
||||
// BBS
|
||||
#if 0
|
||||
|
|
|
@ -273,7 +273,7 @@ void Tab::create_preset_tab()
|
|||
//search input
|
||||
m_search_item = new StaticBox(m_top_panel);
|
||||
StateColor box_colour(std::pair<wxColour, int>(*wxWHITE, StateColor::Normal));
|
||||
StateColor box_border_colour(std::pair<wxColour, int>(wxColour("#DBDBDB"), StateColor::Normal)); // ORCA match border color with other input/combo boxes
|
||||
StateColor box_border_colour(std::pair<wxColour, int>(wxColour("#009688"), StateColor::Normal)); // ORCA match border color with other input/combo boxes
|
||||
|
||||
m_search_item->SetBackgroundColor(box_colour);
|
||||
m_search_item->SetBorderColor(box_border_colour);
|
||||
|
@ -286,8 +286,9 @@ void Tab::create_preset_tab()
|
|||
m_search_input->SetBackgroundColour(wxColour(238, 238, 238));
|
||||
m_search_input->SetForegroundColour(wxColour(43, 52, 54));
|
||||
m_search_input->SetFont(wxGetApp().bold_font());
|
||||
|
||||
search_sizer->Add(new wxWindow(m_search_item, wxID_ANY, wxDefaultPosition, wxSize(0, 0)), 0, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(6));
|
||||
m_search_input->SetIcon(*BitmapCache().load_svg("search", FromDIP(16), FromDIP(16)));
|
||||
m_search_input->GetTextCtrl()->SetHint(_L("Search in preset") + dots);
|
||||
search_sizer->Add(new wxWindow(m_search_item, wxID_ANY, wxDefaultPosition, wxSize(0, 0)), 0, wxEXPAND|wxLEFT|wxRIGHT, FromDIP(2));
|
||||
search_sizer->Add(m_search_input, 1, wxEXPAND | wxALL, FromDIP(2));
|
||||
//bbl for linux
|
||||
//search_sizer->Add(new wxWindow(m_search_input, wxID_ANY, wxDefaultPosition, wxSize(0, 0)), 0, wxEXPAND | wxLEFT, 16);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue