Fix for #6958 - GUI Setting non modal window: Search broken when main window hidden (minimized)

This commit is contained in:
YuSanka 2021-09-22 15:53:19 +02:00
parent e477903d3e
commit e48c320f6d
3 changed files with 22 additions and 9 deletions

View File

@ -6536,12 +6536,7 @@ void Plater::search(bool plater_is_active)
canvas3D()->on_char(evt);
}
else
{
wxPoint pos = this->ClientToScreen(wxPoint(0, 0));
pos.x += em_unit(this) * 40;
pos.y += em_unit(this) * 4;
p->sidebar->get_searcher().search_dialog->Popup(pos);
}
p->sidebar->get_searcher().show_dialog();
}
void Plater::msw_rescale()

View File

@ -289,7 +289,6 @@ bool OptionsSearcher::search(const std::string& search, bool force/* = false*/)
OptionsSearcher::OptionsSearcher()
{
search_dialog = new SearchDialog(this);
}
OptionsSearcher::~OptionsSearcher()
@ -386,6 +385,22 @@ Option OptionsSearcher::get_option(const std::string& opt_key, const wxString& l
return create_option(opt_key, label, type, gc);
}
void OptionsSearcher::show_dialog()
{
if (!search_dialog) {
search_dialog = new SearchDialog(this);
auto parent = search_dialog->GetParent();
wxPoint pos = parent->ClientToScreen(wxPoint(0, 0));
pos.x += em_unit(parent) * 40;
pos.y += em_unit(parent) * 4;
search_dialog->SetPosition(pos);
}
search_dialog->Popup();
}
void OptionsSearcher::add_key(const std::string& opt_key, Preset::Type type, const wxString& group, const wxString& category)
{
groups_and_categories[get_key(opt_key, type)] = GroupAndCategory{group, category};
@ -405,7 +420,7 @@ static const std::map<const char, int> icon_idxs = {
};
SearchDialog::SearchDialog(OptionsSearcher* searcher)
: GUI::DPIDialog(NULL, wxID_ANY, _L("Search"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
: GUI::DPIDialog(GUI::wxGetApp().tab_panel(), wxID_ANY, _L("Search"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER),
searcher(searcher)
{
SetFont(GUI::wxGetApp().normal_font());
@ -506,7 +521,8 @@ void SearchDialog::Popup(wxPoint position /*= wxDefaultPosition*/)
if (check_english)
check_english->SetValue(params.english);
this->SetPosition(position);
if (position != wxDefaultPosition)
this->SetPosition(position);
this->ShowModal();
}

View File

@ -134,6 +134,8 @@ public:
return o1.key < o2.key; });
}
void sort_options_by_label() { sort_options(); }
void show_dialog();
};