From f7ddddcff58b1c3de8740c70e3c297f2734602f5 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Sat, 13 Apr 2019 23:46:52 +0200 Subject: Application Scaling for MSW: Next big step - Added rescale() function for the most of controls - Created PrusaBitmap and PrusaButton classes like a wrap to wxBitmap and wxButton accordingly --- src/slic3r/GUI/Field.cpp | 120 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 100 insertions(+), 20 deletions(-) (limited to 'src/slic3r/GUI/Field.cpp') diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index d77405230..22229d764 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -33,22 +33,21 @@ wxString double_to_string(double const value, const int max_precision /*= 4*/) void Field::PostInitialize() { auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); - m_Undo_btn = new MyButton(m_parent, wxID_ANY, "", wxDefaultPosition,wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER); - m_Undo_to_sys_btn = new MyButton(m_parent, wxID_ANY, "", wxDefaultPosition,wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER); - if (wxMSW) { - m_Undo_btn->SetBackgroundColour(color); - m_Undo_btn->SetBackgroundStyle(wxBG_STYLE_PAINT); - m_Undo_to_sys_btn->SetBackgroundColour(color); - m_Undo_to_sys_btn->SetBackgroundStyle(wxBG_STYLE_PAINT); - } + m_Undo_btn = new RevertButton(m_parent, "bullet_white.png");//(m_parent, wxID_ANY, "", wxDefaultPosition,wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER); + m_Undo_to_sys_btn = new RevertButton(m_parent, "bullet_white.png");//(m_parent, wxID_ANY, "", wxDefaultPosition,wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER); +// if (wxMSW) { +// m_Undo_btn->SetBackgroundColour(color); +// m_Undo_btn->SetBackgroundStyle(wxBG_STYLE_PAINT); +// m_Undo_to_sys_btn->SetBackgroundColour(color); +// m_Undo_to_sys_btn->SetBackgroundStyle(wxBG_STYLE_PAINT); +// } m_Undo_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_initial_value(); })); m_Undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_sys_value(); })); //set default bitmap - wxBitmap bmp; - bmp.LoadFile(from_u8(var("bullet_white.png")), wxBITMAP_TYPE_PNG); - set_undo_bitmap(&bmp); - set_undo_to_sys_bitmap(&bmp); +// wxBitmap bmp = create_scaled_bitmap(m_parent, "bullet_white.png" ); +// set_undo_bitmap(&bmp); +// set_undo_to_sys_bitmap(&bmp); switch (m_opt.type) { @@ -213,8 +212,8 @@ bool is_defined_input_value(wxWindow* win, const ConfigOptionType& type) void TextCtrl::BUILD() { auto size = wxSize(wxDefaultSize); - if (m_opt.height >= 0) size.SetHeight(m_opt.height); - if (m_opt.width >= 0) size.SetWidth(m_opt.width); + if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit()); + if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit()); wxString text_value = wxString(""); @@ -358,6 +357,21 @@ boost::any& TextCtrl::get_value() return m_value; } +void TextCtrl::rescale() +{ + Field::rescale(); + auto size = wxSize(wxDefaultSize); + if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit()); + if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit()); + + if (size != wxDefaultSize) + { + wxTextCtrl* field = dynamic_cast(window); + field->SetMinSize(size); + } + +} + void TextCtrl::enable() { dynamic_cast(window)->Enable(); dynamic_cast(window)->SetEditable(true); } void TextCtrl::disable() { dynamic_cast(window)->Disable(); dynamic_cast(window)->SetEditable(false); } @@ -380,7 +394,8 @@ void CheckBox::BUILD() { static_cast(m_opt.default_value)->get_at(m_opt_idx) : false; - auto temp = new wxCheckBox(m_parent, wxID_ANY, wxString(""), wxDefaultPosition, size); + // Set Label as a string of at least one space simbol to correct system scaling of a CheckBox + auto temp = new wxCheckBox(m_parent, wxID_ANY, wxString(" "), wxDefaultPosition, size); temp->SetFont(Slic3r::GUI::wxGetApp().normal_font()); temp->SetBackgroundStyle(wxBG_STYLE_PAINT); temp->SetValue(check_value); @@ -505,10 +520,18 @@ void SpinCtrl::propagate_value() on_change_field(); } +void SpinCtrl::rescale() +{ + Field::rescale(); + + wxSpinCtrl* field = dynamic_cast(window); + field->SetMinSize(wxSize(-1, int(1.9f*field->GetFont().GetPixelSize().y))); +} + void Choice::BUILD() { - wxSize size(15 * wxGetApp().em_unit(), -1); - if (m_opt.height >= 0) size.SetHeight(m_opt.height); - if (m_opt.width >= 0) size.SetWidth(m_opt.width); + wxSize size(m_width * wxGetApp().em_unit(), -1); + if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit()); + if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit()); wxBitmapComboBox* temp; if (!m_opt.gui_type.empty() && m_opt.gui_type.compare("select_open") != 0) { @@ -817,6 +840,48 @@ boost::any& Choice::get_value() return m_value; } +void Choice::rescale() +{ + Field::rescale(); + + wxBitmapComboBox* field = dynamic_cast(window); + + const wxString selection = field->GetStringSelection(); + + /* To correct scaling (set new controll size) of a wxBitmapCombobox + * we need to refill control with new bitmaps. So, in our case : + * 1. clear conrol + * 2. add content + * 3. add scaled "empty" bitmap to the at least one item + */ + field->Clear(); + wxSize size(wxDefaultSize); + if (m_opt.height >= 0) size.SetHeight(m_opt.height * wxGetApp().em_unit()); + size.SetWidth((m_opt.width > 0 ? m_opt.width : m_width) * wxGetApp().em_unit()); + + field->SetSize(size); + + size_t idx, counter = idx = 0; + if (m_opt.enum_labels.empty() && m_opt.enum_values.empty()) {} + else{ + for (auto el : m_opt.enum_labels.empty() ? m_opt.enum_values : m_opt.enum_labels) { + const wxString& str = _(el); + field->Append(str); + if (el.compare(selection) == 0) + idx = counter; + ++counter; + } + } + + wxBitmap empty_bmp(1, field->GetFont().GetPixelSize().y + 2); + empty_bmp.SetWidth(0); + field->SetItemBitmap(0, empty_bmp); + + idx == m_opt.enum_values.size() ? + field->SetValue(selection) : + field->SetSelection(idx); +} + void ColourPicker::BUILD() { auto size = wxSize(wxDefaultSize); @@ -944,8 +1009,8 @@ boost::any& PointCtrl::get_value() void StaticText::BUILD() { auto size = wxSize(wxDefaultSize); - if (m_opt.height >= 0) size.SetHeight(m_opt.height); - if (m_opt.width >= 0) size.SetWidth(m_opt.width); + if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit()); + if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit()); const wxString legend(static_cast(m_opt.default_value)->value); auto temp = new wxStaticText(m_parent, wxID_ANY, legend, wxDefaultPosition, size, wxST_ELLIPSIZE_MIDDLE); @@ -959,6 +1024,21 @@ void StaticText::BUILD() temp->SetToolTip(get_tooltip_text(legend)); } +void StaticText::rescale() +{ + Field::rescale(); + + auto size = wxSize(wxDefaultSize); + if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit()); + if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit()); + + if (size != wxDefaultSize) + { + wxStaticText* field = dynamic_cast(window); + field->SetSize(size); + } +} + void SliderCtrl::BUILD() { auto size = wxSize(wxDefaultSize); -- cgit v1.2.3 From ae2c61160f15e5e8f49e98ff7c329a2ebc4a4df2 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 16 Apr 2019 10:05:45 +0200 Subject: Application Scaling for MSW: Added rescale function for DoubleSlider (from Preview), ObjectList, ManipulationPanel and SettingsPanel + Set wider default size for Preset Comboboxes from Tabs (#2023) --- src/slic3r/GUI/Field.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/slic3r/GUI/Field.cpp') diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 22229d764..80d2753ab 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -424,8 +424,8 @@ int undef_spin_val = -9999; //! Probably, It's not necessary void SpinCtrl::BUILD() { auto size = wxSize(wxDefaultSize); - if (m_opt.height >= 0) size.SetHeight(m_opt.height); - if (m_opt.width >= 0) size.SetWidth(m_opt.width); + if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit()); + if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit()); wxString text_value = wxString(""); int default_value = 0; @@ -885,8 +885,8 @@ void Choice::rescale() void ColourPicker::BUILD() { auto size = wxSize(wxDefaultSize); - if (m_opt.height >= 0) size.SetHeight(m_opt.height); - if (m_opt.width >= 0) size.SetWidth(m_opt.width); + if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit()); + if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit()); // Validate the color wxString clr_str(static_cast(m_opt.default_value)->get_at(m_opt_idx)); -- cgit v1.2.3 From 3b9803ba6ec02c2471ff03c05a7df70e8e40cff5 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 16 Apr 2019 14:06:09 +0200 Subject: Fixed crash of build under OSX and Linux. + Added flag to control if application rescale is possible --- src/slic3r/GUI/Field.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/slic3r/GUI/Field.cpp') diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 80d2753ab..8a98a1ed7 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -846,7 +846,7 @@ void Choice::rescale() wxBitmapComboBox* field = dynamic_cast(window); - const wxString selection = field->GetStringSelection(); + const wxString selection = field->GetString(field->GetSelection()); /* To correct scaling (set new controll size) of a wxBitmapCombobox * we need to refill control with new bitmaps. So, in our case : -- cgit v1.2.3 From 077321b228814fbca66937812ea204842582f4b2 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Wed, 17 Apr 2019 21:35:53 +0200 Subject: Implemented em_unit() function for getting of em_unit value from correct parent. + Added correct em_unit to Fields --- src/slic3r/GUI/Field.cpp | 49 ++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) (limited to 'src/slic3r/GUI/Field.cpp') diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 8a98a1ed7..89310e7c3 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -65,6 +65,9 @@ void Field::PostInitialize() break; } + // initialize m_unit_value + m_em_unit = em_unit(m_parent); + BUILD(); } @@ -212,8 +215,8 @@ bool is_defined_input_value(wxWindow* win, const ConfigOptionType& type) void TextCtrl::BUILD() { auto size = wxSize(wxDefaultSize); - if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit()); - if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit()); + if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit); + if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit); wxString text_value = wxString(""); @@ -361,8 +364,8 @@ void TextCtrl::rescale() { Field::rescale(); auto size = wxSize(wxDefaultSize); - if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit()); - if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit()); + if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit); + if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit); if (size != wxDefaultSize) { @@ -424,8 +427,8 @@ int undef_spin_val = -9999; //! Probably, It's not necessary void SpinCtrl::BUILD() { auto size = wxSize(wxDefaultSize); - if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit()); - if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit()); + if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit); + if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit); wxString text_value = wxString(""); int default_value = 0; @@ -529,9 +532,9 @@ void SpinCtrl::rescale() } void Choice::BUILD() { - wxSize size(m_width * wxGetApp().em_unit(), -1); - if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit()); - if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit()); + wxSize size(m_width * m_em_unit, -1); + if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit); + if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit); wxBitmapComboBox* temp; if (!m_opt.gui_type.empty() && m_opt.gui_type.compare("select_open") != 0) { @@ -856,8 +859,8 @@ void Choice::rescale() */ field->Clear(); wxSize size(wxDefaultSize); - if (m_opt.height >= 0) size.SetHeight(m_opt.height * wxGetApp().em_unit()); - size.SetWidth((m_opt.width > 0 ? m_opt.width : m_width) * wxGetApp().em_unit()); + if (m_opt.height >= 0) size.SetHeight(m_opt.height * m_em_unit); + size.SetWidth((m_opt.width > 0 ? m_opt.width : m_width) * m_em_unit); field->SetSize(size); @@ -885,8 +888,8 @@ void Choice::rescale() void ColourPicker::BUILD() { auto size = wxSize(wxDefaultSize); - if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit()); - if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit()); + if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit); + if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit); // Validate the color wxString clr_str(static_cast(m_opt.default_value)->get_at(m_opt_idx)); @@ -921,7 +924,7 @@ void PointCtrl::BUILD() { auto temp = new wxBoxSizer(wxHORIZONTAL); - const wxSize field_size(4 * wxGetApp().em_unit(), -1); + const wxSize field_size(4 * m_em_unit, -1); auto default_pt = static_cast(m_opt.default_value)->values.at(0); double val = default_pt(0); @@ -964,6 +967,16 @@ void PointCtrl::BUILD() y_textctrl->SetToolTip(get_tooltip_text(X+", "+Y)); } +void PointCtrl::rescale() +{ + Field::rescale(); + + const wxSize field_size(4 * m_em_unit, -1); + + x_textctrl->SetMinSize(field_size); + y_textctrl->SetMinSize(field_size); +} + void PointCtrl::propagate_value(wxTextCtrl* win) { if (!win->GetValue().empty()) @@ -1009,8 +1022,8 @@ boost::any& PointCtrl::get_value() void StaticText::BUILD() { auto size = wxSize(wxDefaultSize); - if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit()); - if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit()); + if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit); + if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit); const wxString legend(static_cast(m_opt.default_value)->value); auto temp = new wxStaticText(m_parent, wxID_ANY, legend, wxDefaultPosition, size, wxST_ELLIPSIZE_MIDDLE); @@ -1029,8 +1042,8 @@ void StaticText::rescale() Field::rescale(); auto size = wxSize(wxDefaultSize); - if (m_opt.height >= 0) size.SetHeight(m_opt.height*wxGetApp().em_unit()); - if (m_opt.width >= 0) size.SetWidth(m_opt.width*wxGetApp().em_unit()); + if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit); + if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit); if (size != wxDefaultSize) { -- cgit v1.2.3 From 065448e9e5f63f412ac59c8fbbea560f2cccf77e Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 25 Apr 2019 01:45:00 +0200 Subject: Big Refactoring: - deleted/renamed all _Prusa_ prefixes, - cleaned code from commented parts - rescale() -> msw_rescale() --- src/slic3r/GUI/Field.cpp | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) (limited to 'src/slic3r/GUI/Field.cpp') diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 89310e7c3..822361c5d 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -33,21 +33,11 @@ wxString double_to_string(double const value, const int max_precision /*= 4*/) void Field::PostInitialize() { auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); - m_Undo_btn = new RevertButton(m_parent, "bullet_white.png");//(m_parent, wxID_ANY, "", wxDefaultPosition,wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER); - m_Undo_to_sys_btn = new RevertButton(m_parent, "bullet_white.png");//(m_parent, wxID_ANY, "", wxDefaultPosition,wxDefaultSize, wxBU_EXACTFIT | wxNO_BORDER); -// if (wxMSW) { -// m_Undo_btn->SetBackgroundColour(color); -// m_Undo_btn->SetBackgroundStyle(wxBG_STYLE_PAINT); -// m_Undo_to_sys_btn->SetBackgroundColour(color); -// m_Undo_to_sys_btn->SetBackgroundStyle(wxBG_STYLE_PAINT); -// } - m_Undo_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_initial_value(); })); - m_Undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_sys_value(); })); + m_Undo_btn = new RevertButton(m_parent, "bullet_white.png"); + m_Undo_to_sys_btn = new RevertButton(m_parent, "bullet_white.png"); - //set default bitmap -// wxBitmap bmp = create_scaled_bitmap(m_parent, "bullet_white.png" ); -// set_undo_bitmap(&bmp); -// set_undo_to_sys_bitmap(&bmp); + m_Undo_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_initial_value(); })); + m_Undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_back_to_sys_value(); })); switch (m_opt.type) { @@ -360,9 +350,9 @@ boost::any& TextCtrl::get_value() return m_value; } -void TextCtrl::rescale() +void TextCtrl::msw_rescale() { - Field::rescale(); + Field::msw_rescale(); auto size = wxSize(wxDefaultSize); if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit); if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit); @@ -523,9 +513,9 @@ void SpinCtrl::propagate_value() on_change_field(); } -void SpinCtrl::rescale() +void SpinCtrl::msw_rescale() { - Field::rescale(); + Field::msw_rescale(); wxSpinCtrl* field = dynamic_cast(window); field->SetMinSize(wxSize(-1, int(1.9f*field->GetFont().GetPixelSize().y))); @@ -843,9 +833,9 @@ boost::any& Choice::get_value() return m_value; } -void Choice::rescale() +void Choice::msw_rescale() { - Field::rescale(); + Field::msw_rescale(); wxBitmapComboBox* field = dynamic_cast(window); @@ -967,9 +957,9 @@ void PointCtrl::BUILD() y_textctrl->SetToolTip(get_tooltip_text(X+", "+Y)); } -void PointCtrl::rescale() +void PointCtrl::msw_rescale() { - Field::rescale(); + Field::msw_rescale(); const wxSize field_size(4 * m_em_unit, -1); @@ -1037,9 +1027,9 @@ void StaticText::BUILD() temp->SetToolTip(get_tooltip_text(legend)); } -void StaticText::rescale() +void StaticText::msw_rescale() { - Field::rescale(); + Field::msw_rescale(); auto size = wxSize(wxDefaultSize); if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit); -- cgit v1.2.3 From 708037158e78dfe0552b3ed5d9498da1832e031b Mon Sep 17 00:00:00 2001 From: YuSanka Date: Thu, 25 Apr 2019 15:06:44 +0200 Subject: Added msw_buttons_rescale() - Function for a scaling Dialog's buttons under MSW --- src/slic3r/GUI/Field.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/slic3r/GUI/Field.cpp') diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 822361c5d..738ec2e00 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -379,8 +379,8 @@ void TextCtrl::change_field_value(wxEvent& event) void CheckBox::BUILD() { auto size = wxSize(wxDefaultSize); - if (m_opt.height >= 0) size.SetHeight(m_opt.height); - if (m_opt.width >= 0) size.SetWidth(m_opt.width); + if (m_opt.height >= 0) size.SetHeight(m_opt.height*m_em_unit); + if (m_opt.width >= 0) size.SetWidth(m_opt.width*m_em_unit); bool check_value = m_opt.type == coBool ? m_opt.default_value->getBool() : m_opt.type == coBools ? @@ -413,6 +413,14 @@ boost::any& CheckBox::get_value() return m_value; } +void CheckBox::msw_rescale() +{ + Field::msw_rescale(); + + wxCheckBox* field = dynamic_cast(window); + field->SetMinSize(wxSize(-1, int(1.5f*field->GetFont().GetPixelSize().y +0.5f))); +} + int undef_spin_val = -9999; //! Probably, It's not necessary void SpinCtrl::BUILD() { @@ -849,9 +857,11 @@ void Choice::msw_rescale() */ field->Clear(); wxSize size(wxDefaultSize); - if (m_opt.height >= 0) size.SetHeight(m_opt.height * m_em_unit); size.SetWidth((m_opt.width > 0 ? m_opt.width : m_width) * m_em_unit); - + + // Set rescaled min height to correct layout + field->SetMinSize(wxSize(-1, int(1.5f*field->GetFont().GetPixelSize().y + 0.5f))); + // Set rescaled size field->SetSize(size); size_t idx, counter = idx = 0; -- cgit v1.2.3 From 7560de07040455ef0f2081d233607df965c9944a Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 26 Apr 2019 10:52:38 +0200 Subject: Fixed app name interpolation for : GUI_App, MainFrame, MsgDialog, Preferences, Tab and UpdateDialogs + added edit_tooltip(), wich replaces Slic3r for SLIC3R_APP_KEY --- src/slic3r/GUI/Field.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/slic3r/GUI/Field.cpp') diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 738ec2e00..88ed7a445 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -100,6 +100,7 @@ wxString Field::get_tooltip_text(const wxString& default_string) { wxString tooltip_text(""); wxString tooltip = _(m_opt.tooltip); + edit_tooltip(tooltip); if (tooltip.length() > 0) tooltip_text = tooltip + "\n" + _(L("default value")) + "\t: " + (boost::iends_with(m_opt_id, "_gcode") ? "\n" : "") + default_string + -- cgit v1.2.3 From 046466164fb4989cb701e694feb3d188c0426bac Mon Sep 17 00:00:00 2001 From: YuSanka Date: Fri, 26 Apr 2019 13:05:43 +0200 Subject: OSX: Forced set the input value for SpinControl, since the value inserted from the clipboard is not updated --- src/slic3r/GUI/Field.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/slic3r/GUI/Field.cpp') diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 88ed7a445..655a81ce4 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -505,6 +505,11 @@ void SpinCtrl::BUILD() { else tmp_value = -9999; #ifdef __WXOSX__ propagate_value(); + + // Forcibly set the input value for SpinControl, since the value + // inserted from the clipboard is not updated under OSX + if (tmp_value > -9999) + dynamic_cast(window)->SetValue(tmp_value); #endif }), temp->GetId()); -- cgit v1.2.3