Bug fixing:

OSX specific: 1. For slNew and slDlg settings layout modes main frame could be minimized to the ridicules size.
                 So, set size for the Plater (as a min(default) size for the wxPanel)
              2. model->Clear() invoke wxEVT_DATAVIEW_SELECTION_CHANGED. So, set prevent_list_events before this call.
              3. Added a rounding for the scale value

Fix of #4261 (for the English version was called GetValue for non-created check control)
This commit is contained in:
YuSanka 2020-05-18 15:56:33 +02:00
parent 3f68229f1e
commit 5c142ccfd6
3 changed files with 11 additions and 7 deletions

View file

@ -613,7 +613,7 @@ void GUI_App::set_auto_toolbar_icon_scale(float scale) const
const float icon_sc = m_em_unit * 0.1f;
#endif // __APPLE__
int int_val = std::min(int(scale / icon_sc * 100), 100);
long int_val = std::min(int(std::lround(scale / icon_sc * 100)), 100);
std::string val = std::to_string(int_val);
app_config->set("auto_toolbar_size", val);

View file

@ -4278,7 +4278,7 @@ void Sidebar::set_btn_label(const ActionButtonType btn_type, const wxString& lab
// Plater / Public
Plater::Plater(wxWindow *parent, MainFrame *main_frame)
: wxPanel(parent)
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(76 * wxGetApp().em_unit(), 49 * wxGetApp().em_unit()))
, p(new priv(this, main_frame))
{
// Initialization performed in the private c-tor

View file

@ -460,7 +460,7 @@ SearchDialog::SearchDialog(OptionsSearcher* searcher)
check_sizer->Add(new wxStaticText(this, wxID_ANY, _L("Use for search") + ":"), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, border);
check_sizer->Add(check_category, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, border);
if (GUI::wxGetApp().is_localized())
if (check_english)
check_sizer->Add(check_english, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, border);
check_sizer->AddStretchSpacer(border);
check_sizer->Add(cancel_btn, 0, wxALIGN_CENTER_VERTICAL);
@ -484,7 +484,7 @@ SearchDialog::SearchDialog(OptionsSearcher* searcher)
#endif //__WXMSW__
check_category->Bind(wxEVT_CHECKBOX, &SearchDialog::OnCheck, this);
if (GUI::wxGetApp().is_localized())
if (check_english)
check_english ->Bind(wxEVT_CHECKBOX, &SearchDialog::OnCheck, this);
Bind(wxEVT_MOTION, &SearchDialog::OnMotion, this);
@ -505,7 +505,8 @@ void SearchDialog::Popup(wxPoint position /*= wxDefaultPosition*/)
const OptionViewParameters& params = searcher->view_params;
check_category->SetValue(params.category);
check_english->SetValue(params.english);
if (check_english)
check_english->SetValue(params.english);
this->SetPosition(position);
this->ShowModal();
@ -594,6 +595,9 @@ void SearchDialog::OnSelect(wxDataViewEvent& event)
void SearchDialog::update_list()
{
// Under OSX model->Clear invoke wxEVT_DATAVIEW_SELECTION_CHANGED, so
// set prevent_list_events to true already here
prevent_list_events = true;
search_list_model->Clear();
const std::vector<FoundOption>& filters = searcher->found_options();
@ -601,7 +605,6 @@ void SearchDialog::update_list()
search_list_model->Prepend(item.label);
// select first item
prevent_list_events = true;
search_list->Select(search_list_model->GetItem(0));
prevent_list_events = false;
}
@ -609,7 +612,8 @@ void SearchDialog::update_list()
void SearchDialog::OnCheck(wxCommandEvent& event)
{
OptionViewParameters& params = searcher->view_params;
params.english = check_english->GetValue();
if (check_english)
params.english = check_english->GetValue();
params.category = check_category->GetValue();
searcher->search();