Skip to content

Commit

Permalink
Set new min width for mainframe windows
Browse files Browse the repository at this point in the history
Set to ~1/4 of 1366x768 screen resolution

Fix (potential) problem when changing DPI, for both Windows and Mac.
  • Loading branch information
n8bot committed Dec 21, 2021
1 parent 190d95c commit a65b33a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/slic3r/GUI/GUI_App.cpp
Expand Up @@ -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
Expand Down
14 changes: 10 additions & 4 deletions src/slic3r/GUI/MainFrame.cpp
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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();
}


Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/OptionsGroup.hpp
Expand Up @@ -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};
Expand Down

0 comments on commit a65b33a

Please sign in to comment.