Fixed update(clear) of the search_line, when search dialog was opened and closed without changing

This commit is contained in:
YuSanka 2020-04-27 11:51:17 +02:00
parent 270e815eeb
commit 93170870e8
4 changed files with 9 additions and 22 deletions

View File

@ -4523,15 +4523,13 @@ bool GLCanvas3D::_render_search_list(float pos_x) const
search_line = s; search_line = s;
delete [] s; delete [] s;
if (edited) {
if (search_line == _u8L("Type here to search")) if (search_line == _u8L("Type here to search"))
search_line.clear(); search_line.clear();
sidebar.search();
}
if (selected != size_t(-1)) if (edited)
{ sidebar.search();
if (selected != size_t(-1)) {
// selected == 9999 means that Esc kye was pressed // selected == 9999 means that Esc kye was pressed
if (selected != 9999) if (selected != 9999)
sidebar.jump_to_option(selected); sidebar.jump_to_option(selected);
@ -5252,7 +5250,7 @@ bool GLCanvas3D::_init_collapse_toolbar()
m_collapse_toolbar.set_tooltip(id, new_tooltip); m_collapse_toolbar.set_tooltip(id, new_tooltip);
set_tooltip(""); set_tooltip("");
post_event(SimpleEvent(EVT_GLCANVAS_COLLAPSE_SIDEBAR)); wxGetApp().plater()->collapse_sidebur(!wxGetApp().plater()->is_sidebar_collapsed());
}; };
if (!m_collapse_toolbar.add_item(item)) if (!m_collapse_toolbar.add_item(item))
@ -5266,7 +5264,6 @@ bool GLCanvas3D::_init_collapse_toolbar()
item.tooltip = _utf8(L("Switch to Print Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "2]"; item.tooltip = _utf8(L("Switch to Print Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "2]";
item.sprite_id = 1; item.sprite_id = 1;
item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*0*/1); }; item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*0*/1); };
item.visibility_callback = [this]() { return wxGetApp().plater()->is_sidebar_collapsed(); };
if (!m_collapse_toolbar.add_item(item)) if (!m_collapse_toolbar.add_item(item))
return false; return false;
@ -5276,8 +5273,7 @@ bool GLCanvas3D::_init_collapse_toolbar()
item.tooltip = _utf8(L("Switch to Filament Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "3]"; item.tooltip = _utf8(L("Switch to Filament Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "3]";
item.sprite_id = 2; item.sprite_id = 2;
item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*1*/2); }; item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*1*/2); };
item.visibility_callback = [this]() { return wxGetApp().plater()->is_sidebar_collapsed() && item.visibility_callback = [this]() { return wxGetApp().plater()->printer_technology() == ptFFF; };
wxGetApp().plater()->printer_technology() == ptFFF; };
if (!m_collapse_toolbar.add_item(item)) if (!m_collapse_toolbar.add_item(item))
return false; return false;
@ -5296,8 +5292,7 @@ bool GLCanvas3D::_init_collapse_toolbar()
item.tooltip = _utf8(L("Switch to SLA Material Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "3]"; item.tooltip = _utf8(L("Switch to SLA Material Settings")) + " [" + GUI::shortkey_ctrl_prefix() + "3]";
item.sprite_id = 4; item.sprite_id = 4;
item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*1*/2); }; item.left.action_callback = [this]() { wxGetApp().mainframe->select_tab(/*1*/2); };
item.visibility_callback = [this]() { return wxGetApp().plater()->is_sidebar_collapsed() && item.visibility_callback = [this]() { return m_process->current_printer_technology() == ptSLA; };
(m_process->current_printer_technology() == ptSLA); };
if (!m_collapse_toolbar.add_item(item)) if (!m_collapse_toolbar.add_item(item))
return false; return false;

View File

@ -271,6 +271,7 @@ bool Preview::init(wxWindow* parent, Bed3D& bed, Camera& camera, GLToolbar& view
m_canvas->set_process(m_process); m_canvas->set_process(m_process);
m_canvas->enable_legend_texture(true); m_canvas->enable_legend_texture(true);
m_canvas->enable_dynamic_background(true); m_canvas->enable_dynamic_background(true);
m_canvas->enable_collapse_toolbar(true);
m_double_slider_sizer = new wxBoxSizer(wxHORIZONTAL); m_double_slider_sizer = new wxBoxSizer(wxHORIZONTAL);
create_double_slider(); create_double_slider();

View File

@ -189,9 +189,6 @@ void Tab::create_preset_tab()
add_scaled_button(panel, &m_search_btn, "search"); add_scaled_button(panel, &m_search_btn, "search");
m_search_btn->SetToolTip(format_wxstr(_L("Click to start a search or use %1% shortcut"), "Ctrl+F")); m_search_btn->SetToolTip(format_wxstr(_L("Click to start a search or use %1% shortcut"), "Ctrl+F"));
add_scaled_button(panel, &m_to_plater_btn, "plater");
m_to_plater_btn->SetToolTip(_L("Switch to the Plater"));
// Determine the theme color of OS (dark or light) // Determine the theme color of OS (dark or light)
auto luma = wxGetApp().get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); auto luma = wxGetApp().get_colour_approx_luma(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
// Bitmaps to be shown on the "Revert to system" aka "Lock to system" button next to each input field. // Bitmaps to be shown on the "Revert to system" aka "Lock to system" button next to each input field.
@ -223,7 +220,6 @@ void Tab::create_preset_tab()
} }
})); }));
m_search_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent) { wxGetApp().plater()->search(false); }); m_search_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent) { wxGetApp().plater()->search(false); });
m_to_plater_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent) { wxGetApp().mainframe->switch_to(true); });
// Colors for ui "decoration" // Colors for ui "decoration"
m_sys_label_clr = wxGetApp().get_label_clr_sys(); m_sys_label_clr = wxGetApp().get_label_clr_sys();
@ -253,12 +249,8 @@ void Tab::create_preset_tab()
// m_hsizer->AddStretchSpacer(32); // m_hsizer->AddStretchSpacer(32);
// StretchSpacer has a strange behavior under OSX, so // StretchSpacer has a strange behavior under OSX, so
// There is used just additional sizer for m_mode_sizer with right alignment // There is used just additional sizer for m_mode_sizer with right alignment
wxBoxSizer* top_right_sizer = new wxBoxSizer(wxHORIZONTAL);
top_right_sizer->Add(m_to_plater_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, wxOSX ? 15 : 10);
top_right_sizer->Add(m_mode_sizer, 0, wxALIGN_CENTER_VERTICAL);
auto mode_sizer = new wxBoxSizer(wxVERTICAL); auto mode_sizer = new wxBoxSizer(wxVERTICAL);
// mode_sizer->Add(m_mode_sizer, 1, wxALIGN_RIGHT); mode_sizer->Add(m_mode_sizer, 1, wxALIGN_RIGHT);
mode_sizer->Add(top_right_sizer, 1, wxALIGN_RIGHT);
m_hsizer->Add(mode_sizer, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, wxOSX ? 15 : 10); m_hsizer->Add(mode_sizer, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT, wxOSX ? 15 : 10);
//Horizontal sizer to hold the tree and the selected page. //Horizontal sizer to hold the tree and the selected page.

View File

@ -126,7 +126,6 @@ protected:
ScalableButton* m_btn_save_preset; ScalableButton* m_btn_save_preset;
ScalableButton* m_btn_delete_preset; ScalableButton* m_btn_delete_preset;
ScalableButton* m_btn_hide_incompatible_presets; ScalableButton* m_btn_hide_incompatible_presets;
ScalableButton* m_to_plater_btn;
wxBoxSizer* m_hsizer; wxBoxSizer* m_hsizer;
wxBoxSizer* m_left_sizer; wxBoxSizer* m_left_sizer;
wxTreeCtrl* m_treectrl; wxTreeCtrl* m_treectrl;