From a65b33a9c303bd5119135953d340a5c0a63c0125 Mon Sep 17 00:00:00 2001 From: n8bot <22458343+n8bot@users.noreply.github.com> Date: Fri, 17 Dec 2021 22:08:10 -0800 Subject: [PATCH] Set new min width for mainframe windows Set to ~1/4 of 1366x768 screen resolution Fix (potential) problem when changing DPI, for both Windows and Mac. --- src/slic3r/GUI/GUI_App.cpp | 2 +- src/slic3r/GUI/MainFrame.cpp | 14 ++++++++++---- src/slic3r/GUI/OptionsGroup.hpp | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 4e5e882fadd..7ea5181edf8 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -1547,7 +1547,7 @@ bool GUI_App::tabs_as_menu() const wxSize GUI_App::get_min_size() const { - return wxSize(76*m_em_unit, 49 * m_em_unit); + return wxSize(68 * m_em_unit, 38 * m_em_unit); } float GUI_App::toolbar_icon_scale(const bool is_limited/* = false*/) const diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index d32a080bbfc..30fb6260c08 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -2214,7 +2214,7 @@ SettingsDialog::SettingsDialog(MainFrame* mainframe) SetSizer(sizer); //Fit(); // not useful for non-modal dialog - const wxSize min_size = wxSize(85 * em_unit(), 50 * em_unit()); + const wxSize min_size = wxSize(68 * em_unit(), 38 * em_unit()); #ifdef __APPLE__ // Using SetMinSize() on Mac messes up the window position in some cases // cf. https://groups.google.com/forum/#!topic/wx-users/yUKPBBfXWO0 @@ -2232,7 +2232,7 @@ void SettingsDialog::on_dpi_changed(const wxRect& suggested_rect) return; const int& em = em_unit(); - const wxSize& size = wxSize(85 * em, 50 * em); + const wxSize& size = wxSize(68 * em, 38 * em); #ifdef _MSW_DARK_MODE // update common mode sizer @@ -2244,9 +2244,15 @@ void SettingsDialog::on_dpi_changed(const wxRect& suggested_rect) for (auto tab : wxGetApp().tabs_list) tab->msw_rescale(); +#ifdef __APPLE__ + // Using SetMinSize() on Mac messes up the window position in some cases + // cf. https://groups.google.com/forum/#!topic/wx-users/yUKPBBfXWO0 + SetSize(size); +#else SetMinSize(size); - //Fit(); // not useful for non-modal dialog - Refresh(); + SetSize(GetMinSize()); +#endif + Layout(); } diff --git a/src/slic3r/GUI/OptionsGroup.hpp b/src/slic3r/GUI/OptionsGroup.hpp index 67c3fbdbdeb..94f79718ec5 100644 --- a/src/slic3r/GUI/OptionsGroup.hpp +++ b/src/slic3r/GUI/OptionsGroup.hpp @@ -96,7 +96,7 @@ class OptionsGroup { public: const bool staticbox {true}; const wxString title; - size_t label_width = 20 ;// {200}; + size_t label_width = 18 ;// {200}; wxSizer* sizer {nullptr}; OG_CustomCtrl* custom_ctrl{ nullptr }; int ctrl_horiz_alignment{ wxALIGN_LEFT};