First experiment to fix layouts on hdpi

This commit is contained in:
YuSanka 2019-01-31 15:55:09 +01:00
parent 1605c23e25
commit ba6206ab62
5 changed files with 15 additions and 4 deletions

View File

@ -246,6 +246,7 @@ void GUI_App::init_fonts()
{ {
m_small_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); m_small_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
m_bold_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold(); m_bold_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT).Bold();
#ifdef __WXMAC__ #ifdef __WXMAC__
m_small_font.SetPointSize(11); m_small_font.SetPointSize(11);
m_bold_font.SetPointSize(13); m_bold_font.SetPointSize(13);

View File

@ -80,6 +80,8 @@ class GUI_App : public wxApp
wxFont m_small_font; wxFont m_small_font;
wxFont m_bold_font; wxFont m_bold_font;
size_t m_width_unit;
wxLocale* m_wxLocale{ nullptr }; wxLocale* m_wxLocale{ nullptr };
#if ENABLE_IMGUI #if ENABLE_IMGUI
@ -106,6 +108,8 @@ public:
const wxFont& small_font() { return m_small_font; } const wxFont& small_font() { return m_small_font; }
const wxFont& bold_font() { return m_bold_font; } const wxFont& bold_font() { return m_bold_font; }
size_t width_unit() const { return m_width_unit; }
void set_width_unit(const size_t width_unit) { m_width_unit = width_unit; }
void recreate_GUI(); void recreate_GUI();
void system_info(); void system_info();

View File

@ -53,6 +53,12 @@ wxFrame(NULL, wxID_ANY, SLIC3R_BUILD, wxDefaultPosition, wxDefaultSize, wxDEFAUL
SLIC3R_VERSION + SLIC3R_VERSION +
_(L(" - Remember to check for updates at http://github.com/prusa3d/slic3r/releases"))); _(L(" - Remember to check for updates at http://github.com/prusa3d/slic3r/releases")));
// initialize default width_unit according to the width of the one symbol ("x") of the current system font
const wxString x_str = "x";
const wxSize size = GetTextExtent(x_str);
wxGetApp().set_width_unit(size.x);
// initialize tabpanel and menubar // initialize tabpanel and menubar
init_tabpanel(); init_tabpanel();
init_menubar(); init_menubar();

View File

@ -213,7 +213,7 @@ void SlicedInfo::SetTextAndShow(SlisedInfoIdx idx, const wxString& text, const w
} }
PresetComboBox::PresetComboBox(wxWindow *parent, Preset::Type preset_type) : PresetComboBox::PresetComboBox(wxWindow *parent, Preset::Type preset_type) :
wxBitmapComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200,-1), 0, nullptr, wxCB_READONLY), wxBitmapComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(30 * wxGetApp().width_unit()/*200*/, -1), 0, nullptr, wxCB_READONLY),
preset_type(preset_type), preset_type(preset_type),
last_selected(wxNOT_FOUND) last_selected(wxNOT_FOUND)
{ {
@ -519,7 +519,7 @@ void Sidebar::priv::show_preset_comboboxes()
Sidebar::Sidebar(Plater *parent) Sidebar::Sidebar(Plater *parent)
: wxPanel(parent), p(new priv(parent)) : wxPanel(parent), p(new priv(parent))
{ {
p->scrolled = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(400, -1)); p->scrolled = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(60 * wxGetApp().width_unit()/*400*/, -1));
p->scrolled->SetScrollbars(0, 20, 1, 2); p->scrolled->SetScrollbars(0, 20, 1, 2);
// Sizer in the scrolled area // Sizer in the scrolled area

View File

@ -96,7 +96,7 @@ void Tab::create_preset_tab()
#endif //__WXOSX__ #endif //__WXOSX__
// preset chooser // preset chooser
m_presets_choice = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(270, -1), 0, 0,wxCB_READONLY); m_presets_choice = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(40 * wxGetApp().width_unit()/*270*/, -1), 0, 0, wxCB_READONLY);
auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW);
@ -201,7 +201,7 @@ void Tab::create_preset_tab()
m_hsizer->Add(m_left_sizer, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 3); m_hsizer->Add(m_left_sizer, 0, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 3);
// tree // tree
m_treectrl = new wxTreeCtrl(panel, wxID_ANY, wxDefaultPosition, wxSize(185, -1), m_treectrl = new wxTreeCtrl(panel, wxID_ANY, wxDefaultPosition, wxSize(30 * wxGetApp().width_unit()/*185*/, -1),
wxTR_NO_BUTTONS | wxTR_HIDE_ROOT | wxTR_SINGLE | wxTR_NO_LINES | wxBORDER_SUNKEN | wxWANTS_CHARS); wxTR_NO_BUTTONS | wxTR_HIDE_ROOT | wxTR_SINGLE | wxTR_NO_LINES | wxBORDER_SUNKEN | wxWANTS_CHARS);
m_left_sizer->Add(m_treectrl, 1, wxEXPAND); m_left_sizer->Add(m_treectrl, 1, wxEXPAND);
m_icons = new wxImageList(16, 16, true, 1); m_icons = new wxImageList(16, 16, true, 1);