Search: Added shortkey Ctrl+F on Plater

This commit is contained in:
YuSanka 2020-04-08 09:47:33 +02:00
parent 05f4b7aa60
commit 8ab7956c26
3 changed files with 27 additions and 2 deletions

View file

@ -3032,6 +3032,16 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
break;
#ifdef __APPLE__
case 'f':
case 'F':
#else /* __APPLE__ */
case WXK_CONTROL_F:
#endif /* __APPLE__ */
_activate_search_toolbar_item();
break;
#ifdef __APPLE__
case 'y':
case 'Y':
@ -5029,7 +5039,7 @@ bool GLCanvas3D::_init_main_toolbar()
item.name = "search";
item.icon_filename = "search_.svg";
item.tooltip = _utf8(L("Search"));
item.tooltip = _utf8(L("Search")) + " [" + GUI::shortkey_ctrl_prefix() + "F]";
item.sprite_id = 11;
item.left.render_callback = [this](float left, float right, float, float) {
if (m_canvas != nullptr)
@ -7237,6 +7247,17 @@ bool GLCanvas3D::_deactivate_search_toolbar_item()
return false;
}
bool GLCanvas3D::_activate_search_toolbar_item()
{
if (!m_main_toolbar.is_item_pressed("search"))
{
m_main_toolbar.force_left_action(m_main_toolbar.get_item_id("search"), *this);
return true;
}
return false;
}
const Print* GLCanvas3D::fff_print() const
{
return (m_process == nullptr) ? nullptr : m_process->fff_print();

View file

@ -838,6 +838,7 @@ private:
bool _deactivate_undo_redo_toolbar_items();
bool _deactivate_search_toolbar_item();
bool _activate_search_toolbar_item();
static std::vector<float> _parse_colors(const std::vector<std::string>& colors);

View file

@ -219,7 +219,7 @@ const SearchOptions::Option& SearchOptions::get_option(size_t pos_in_filter) con
//------------------------------------------
SearchCtrl::SearchCtrl(wxWindow* parent) :
wxComboCtrl(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(25 * wxGetApp().em_unit(), -1), wxTE_PROCESS_ENTER)
wxComboCtrl(parent, wxID_ANY, _L("Type here to search"), wxDefaultPosition, wxSize(25 * wxGetApp().em_unit(), -1), wxTE_PROCESS_ENTER)
{
default_string = _L("Type here to search");
@ -263,6 +263,9 @@ void SearchCtrl::OnInputText(wxCommandEvent& )
void SearchCtrl::PopupList(wxCommandEvent& e)
{
update_list(wxGetApp().sidebar().get_search_list().filters);
if (e.GetEventType() == wxEVT_TEXT_ENTER)
this->Popup();
e.Skip();
}