From 46f32d091aaf3251ea18744e2f0415ae17d47610 Mon Sep 17 00:00:00 2001 From: YuSanka <yusanka@gmail.com> Date: Wed, 6 Feb 2019 09:49:32 +0100 Subject: [PATCH] Fixed scaling of the controls and InfoDialogs (Sys and About) --- src/slic3r/GUI/2DBed.cpp | 2 +- src/slic3r/GUI/AboutDialog.cpp | 14 ++++++++------ src/slic3r/GUI/BedShapeDialog.cpp | 5 +++-- src/slic3r/GUI/BedShapeDialog.hpp | 2 +- src/slic3r/GUI/Field.cpp | 9 ++------- src/slic3r/GUI/GUI_ObjectManipulation.cpp | 4 ++-- src/slic3r/GUI/GUI_ObjectSettings.cpp | 8 ++++---- src/slic3r/GUI/KBShortcutsDialog.cpp | 2 +- src/slic3r/GUI/OptionsGroup.cpp | 2 +- src/slic3r/GUI/OptionsGroup.hpp | 2 +- src/slic3r/GUI/Plater.cpp | 4 ++-- src/slic3r/GUI/SysInfoDialog.cpp | 14 ++++++++------ src/slic3r/GUI/Tab.cpp | 22 +++++++++++----------- 13 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/slic3r/GUI/2DBed.cpp b/src/slic3r/GUI/2DBed.cpp index 9f8b787de..eb55d5fdc 100644 --- a/src/slic3r/GUI/2DBed.cpp +++ b/src/slic3r/GUI/2DBed.cpp @@ -12,7 +12,7 @@ namespace GUI { Bed_2D::Bed_2D(wxWindow* parent) : - wxPanel(parent, wxID_ANY, wxDefaultPosition, FromDIP(wxSize(250,-1))/*wxSize(20 * wxGetApp().em_unit(), -1)*/, wxTAB_TRAVERSAL) +wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(25 * wxGetApp().em_unit(), -1), wxTAB_TRAVERSAL) { SetBackgroundStyle(wxBG_STYLE_PAINT); // to avoid assert message after wxAutoBufferedPaintDC #ifdef __APPLE__ diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp index d1b4c5b20..a800ea832 100644 --- a/src/slic3r/GUI/AboutDialog.cpp +++ b/src/slic3r/GUI/AboutDialog.cpp @@ -2,6 +2,7 @@ #include "I18N.hpp" #include "libslic3r/Utils.hpp" +#include "GUI_App.hpp" namespace Slic3r { namespace GUI { @@ -41,15 +42,15 @@ AboutDialog::AboutDialog() // logo wxBitmap logo_bmp = wxBitmap(from_u8(Slic3r::var("Slic3r_192px.png")), wxBITMAP_TYPE_PNG); - auto *logo = new wxStaticBitmap(this, wxID_ANY, std::move(logo_bmp), wxDefaultPosition, FromDIP(logo_bmp.GetSize())); - hsizer->Add(logo, 1, wxEXPAND | wxTOP | wxBOTTOM, 35); + auto *logo = new wxStaticBitmap(this, wxID_ANY, std::move(logo_bmp)); + hsizer->Add(logo, 1, wxALIGN_CENTER_VERTICAL); wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL); -#ifdef __WXMSW__ - int proportion = 2; -#else +// #ifdef __WXMSW__ +// int proportion = 2; +// #else int proportion = 3; -#endif +// #endif hsizer->Add(vsizer, proportion, wxEXPAND|wxLEFT, 20); // title @@ -80,6 +81,7 @@ AboutDialog::AboutDialog() // text wxHtmlWindow* html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO/*NEVER*/); { + html->SetMinSize(wxSize(-1, 16 * wxGetApp().em_unit())); wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); const auto text_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); auto text_clr_str = wxString::Format(wxT("#%02X%02X%02X"), text_clr.Red(), text_clr.Green(), text_clr.Blue()); diff --git a/src/slic3r/GUI/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp index 4cd7083d2..7bbf1ac7f 100644 --- a/src/slic3r/GUI/BedShapeDialog.cpp +++ b/src/slic3r/GUI/BedShapeDialog.cpp @@ -44,7 +44,8 @@ void BedShapePanel::build_panel(ConfigOptionPoints* default_pt) auto sbsizer = new wxStaticBoxSizer(box, wxVERTICAL); // shape options - m_shape_options_book = new wxChoicebook(this, wxID_ANY, wxDefaultPosition, FromDIP(wxSize(300, -1))/*wxSize(23 * wxGetApp().em_unit(), -1)*/, wxCHB_TOP); + m_shape_options_book = new wxChoicebook(this, wxID_ANY, wxDefaultPosition, + wxSize(25*wxGetApp().em_unit(), -1), wxCHB_TOP); sbsizer->Add(m_shape_options_book); auto optgroup = init_shape_options_page(_(L("Rectangular"))); @@ -124,7 +125,7 @@ ConfigOptionsGroupShp BedShapePanel::init_shape_options_page(wxString title) ConfigOptionsGroupShp optgroup; optgroup = std::make_shared<ConfigOptionsGroup>(panel, _(L("Settings"))); - optgroup->label_width = int(7.7*wxGetApp().em_unit() + 0.5);//100; + optgroup->label_width = 10*wxGetApp().em_unit();//100; optgroup->m_on_change = [this](t_config_option_key opt_key, boost::any value) { update_shape(); }; diff --git a/src/slic3r/GUI/BedShapeDialog.hpp b/src/slic3r/GUI/BedShapeDialog.hpp index fee4fbcc4..538fccc34 100644 --- a/src/slic3r/GUI/BedShapeDialog.hpp +++ b/src/slic3r/GUI/BedShapeDialog.hpp @@ -42,7 +42,7 @@ class BedShapeDialog : public wxDialog BedShapePanel* m_panel; public: BedShapeDialog(wxWindow* parent) : wxDialog(parent, wxID_ANY, _(L("Bed Shape")), - wxDefaultPosition, wxSize(27 * wxGetApp().em_unit(), 54 * wxGetApp().em_unit()), wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {} + wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {} ~BedShapeDialog() {} void build_dialog(ConfigOptionPoints* default_pt); diff --git a/src/slic3r/GUI/Field.cpp b/src/slic3r/GUI/Field.cpp index 862f1b107..e26ba79c7 100644 --- a/src/slic3r/GUI/Field.cpp +++ b/src/slic3r/GUI/Field.cpp @@ -780,14 +780,9 @@ boost::any& ColourPicker::get_value() void PointCtrl::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); - auto temp = new wxBoxSizer(wxHORIZONTAL); - // $self->wxSizer($sizer); - // - wxSize field_size(40, -1); + + const wxSize field_size(4 * wxGetApp().em_unit(), -1); auto default_pt = static_cast<const ConfigOptionPoints*>(m_opt.default_value)->values.at(0); double val = default_pt(0); diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp index 91caada8f..1ec961b3e 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp @@ -22,7 +22,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) : #endif // __APPLE__ { m_og->set_name(_(L("Object Manipulation"))); - m_og->label_width = 9 * wxGetApp().em_unit();//125; + m_og->label_width = 12 * wxGetApp().em_unit();//125; m_og->set_grid_vgap(5); m_og->m_on_change = std::bind(&ObjectManipulation::on_change, this, std::placeholders::_1, std::placeholders::_2); @@ -49,7 +49,7 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) : def.default_value = new ConfigOptionString{ " " }; m_og->append_single_option_line(Option(def, "object_name")); - const int field_width = int(3.8 * wxGetApp().em_unit()+0.5)/*50*/; + const int field_width = 5 * wxGetApp().em_unit()/*50*/; // Legend for object modification auto line = Line{ "", "" }; diff --git a/src/slic3r/GUI/GUI_ObjectSettings.cpp b/src/slic3r/GUI/GUI_ObjectSettings.cpp index 477b0530b..a07a99c87 100644 --- a/src/slic3r/GUI/GUI_ObjectSettings.cpp +++ b/src/slic3r/GUI/GUI_ObjectSettings.cpp @@ -98,7 +98,7 @@ void ObjectSettings::update_settings_list() std::vector<std::string> categories; if (!(opt_keys.size() == 1 && opt_keys[0] == "extruder"))// return; { - auto extruders_cnt = wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology() == ptSLA ? 1 : + const int extruders_cnt = wxGetApp().preset_bundle->printers.get_selected_preset().printer_technology() == ptSLA ? 1 : wxGetApp().preset_bundle->printers.get_edited_preset().config.option<ConfigOptionFloats>("nozzle_diameter")->values.size(); for (auto& opt_key : opt_keys) { @@ -119,8 +119,8 @@ void ObjectSettings::update_settings_list() continue; auto optgroup = std::make_shared<ConfigOptionsGroup>(m_parent, cat.first, config, false, extra_column); - optgroup->label_width = 150; - optgroup->sidetext_width = 70; + optgroup->label_width = 15 * wxGetApp().em_unit();//150; + optgroup->sidetext_width = 7 * wxGetApp().em_unit();//70; optgroup->m_on_change = [](const t_config_option_key& opt_id, const boost::any& value) { wxGetApp().obj_list()->part_settings_changed(); }; @@ -130,7 +130,7 @@ void ObjectSettings::update_settings_list() if (opt == "extruder") continue; Option option = optgroup->get_option(opt); - option.opt.width = 70; + option.opt.width = 7 * wxGetApp().em_unit();//70; optgroup->append_single_option_line(option); } optgroup->reload_config(); diff --git a/src/slic3r/GUI/KBShortcutsDialog.cpp b/src/slic3r/GUI/KBShortcutsDialog.cpp index c78353919..60a32fbc5 100644 --- a/src/slic3r/GUI/KBShortcutsDialog.cpp +++ b/src/slic3r/GUI/KBShortcutsDialog.cpp @@ -54,7 +54,7 @@ KBShortcutsDialog::KBShortcutsDialog() hsizer->Add(logo, 0, wxEXPAND | wxLEFT | wxRIGHT, 15); // head - wxStaticText* head = new wxStaticText(panel, wxID_ANY, sc.first, wxDefaultPosition, wxSize(15 * wxGetApp().em_unit(), -1)); + wxStaticText* head = new wxStaticText(panel, wxID_ANY, sc.first, wxDefaultPosition, wxSize(20 * wxGetApp().em_unit(), -1)); head->SetFont(head_font); hsizer->Add(head, 0, wxALIGN_CENTER_VERTICAL); diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 1ec7a3a4b..9e5d94ca7 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -593,7 +593,7 @@ Field* ConfigOptionsGroup::get_fieldc(const t_config_option_key& opt_key, int op void ogStaticText::SetText(const wxString& value, bool wrap/* = true*/) { SetLabel(value); - if (wrap) Wrap(35 * wxGetApp().em_unit()/*400*/); + if (wrap) Wrap(40 * wxGetApp().em_unit()); GetParent()->Layout(); } diff --git a/src/slic3r/GUI/OptionsGroup.hpp b/src/slic3r/GUI/OptionsGroup.hpp index ac355bdf3..d9ff6a01a 100644 --- a/src/slic3r/GUI/OptionsGroup.hpp +++ b/src/slic3r/GUI/OptionsGroup.hpp @@ -82,7 +82,7 @@ class OptionsGroup { public: const bool staticbox {true}; const wxString title {wxString("")}; - size_t label_width = 15 * wxGetApp().em_unit();// {200}; + size_t label_width = 20 * wxGetApp().em_unit();// {200}; wxSizer* sizer {nullptr}; column_t extra_column {nullptr}; t_change m_on_change { nullptr }; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 80d231bc4..24328ebe1 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -519,7 +519,7 @@ void Sidebar::priv::show_preset_comboboxes() Sidebar::Sidebar(Plater *parent) : wxPanel(parent), p(new priv(parent)) { - p->scrolled = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(30 * wxGetApp().em_unit(), -1)); + p->scrolled = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(40 * wxGetApp().em_unit(), -1)); p->scrolled->SetScrollbars(0, 20, 1, 2); // Sizer in the scrolled area @@ -562,7 +562,7 @@ Sidebar::Sidebar(Plater *parent) // calculate width of the preset labels p->sizer_presets->Layout(); const wxArrayInt& ar = p->sizer_presets->GetColWidths(); - int label_width = ar.IsEmpty() ? int(7.7*wxGetApp().em_unit()+0.5) : ar.front()-4; + const int label_width = ar.IsEmpty() ? 10*wxGetApp().em_unit() : ar.front()-4; p->sizer_params = new wxBoxSizer(wxVERTICAL); diff --git a/src/slic3r/GUI/SysInfoDialog.cpp b/src/slic3r/GUI/SysInfoDialog.cpp index 52da9f182..f1f459982 100644 --- a/src/slic3r/GUI/SysInfoDialog.cpp +++ b/src/slic3r/GUI/SysInfoDialog.cpp @@ -43,15 +43,15 @@ SysInfoDialog::SysInfoDialog() wxColour bgr_clr = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); SetBackgroundColour(bgr_clr); wxBoxSizer* hsizer = new wxBoxSizer(wxHORIZONTAL); - hsizer->SetMinSize(wxSize(45 * wxGetApp().em_unit(), -1)); + hsizer->SetMinSize(wxSize(50 * wxGetApp().em_unit(), -1)); auto main_sizer = new wxBoxSizer(wxVERTICAL); main_sizer->Add(hsizer, 0, wxEXPAND | wxALL, 10); // logo wxBitmap logo_bmp = wxBitmap(from_u8(Slic3r::var("Slic3r_192px.png")), wxBITMAP_TYPE_PNG); - auto *logo = new wxStaticBitmap(this, wxID_ANY, std::move(logo_bmp), wxDefaultPosition, FromDIP(logo_bmp.GetSize())); - hsizer->Add(logo, 0, wxEXPAND | wxTOP | wxBOTTOM, 15); + auto *logo = new wxStaticBitmap(this, wxID_ANY, std::move(logo_bmp)); + hsizer->Add(logo, 0, wxALIGN_CENTER_VERTICAL); wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL); hsizer->Add(vsizer, 1, wxEXPAND|wxLEFT, 20); @@ -64,7 +64,7 @@ SysInfoDialog::SysInfoDialog() title_font.SetFamily(wxFONTFAMILY_ROMAN); title_font.SetPointSize(22); title->SetFont(title_font); - vsizer->Add(title, 0, wxALIGN_LEFT | wxTOP, 50); + vsizer->Add(title, 0, wxEXPAND | wxALIGN_LEFT | wxTOP, wxGetApp().em_unit()/*50*/); } // main_info_text @@ -90,13 +90,15 @@ SysInfoDialog::SysInfoDialog() "</html>", bgr_clr_str, text_clr_str, text_clr_str, get_main_info(true)); html->SetPage(text); - vsizer->Add(html, 1, wxEXPAND); + vsizer->Add(html, 1, wxEXPAND | wxBOTTOM, wxGetApp().em_unit()); } +// hsizer->Add(vsizer, 1, wxEXPAND | wxLEFT, 20); +// main_sizer->Add(hsizer, 1, wxEXPAND | wxALL, 10); // opengl_info wxHtmlWindow* opengl_info_html = new wxHtmlWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO); { - opengl_info_html->SetMinSize(wxSize(-1, 15 * wxGetApp().em_unit())); + opengl_info_html->SetMinSize(wxSize(-1, 16 * wxGetApp().em_unit())); opengl_info_html->SetFonts(font.GetFaceName(), font.GetFaceName(), size); opengl_info_html->SetBorders(10); const auto text = wxString::Format( diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 21277535e..4fa7e9d1f 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -98,7 +98,7 @@ void Tab::create_preset_tab() #endif //__WXOSX__ // preset chooser - m_presets_choice = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(20 * m_em_unit, -1), 0, 0, wxCB_READONLY); + m_presets_choice = new wxBitmapComboBox(panel, wxID_ANY, "", wxDefaultPosition, wxSize(25 * m_em_unit, -1), 0, 0, wxCB_READONLY); auto color = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); @@ -1107,14 +1107,14 @@ void TabPrint::build() optgroup = page->new_optgroup(_(L("Post-processing scripts")), 0); option = optgroup->get_option("post_process"); option.opt.full_width = true; - option.opt.height = 4 * m_em_unit;//50; + option.opt.height = 5 * m_em_unit;//50; optgroup->append_single_option_line(option); page = add_options_page(_(L("Notes")), "note.png"); optgroup = page->new_optgroup(_(L("Notes")), 0); option = optgroup->get_option("notes"); option.opt.full_width = true; - option.opt.height = 19 * m_em_unit;//250; + option.opt.height = 25 * m_em_unit;//250; optgroup->append_single_option_line(option); page = add_options_page(_(L("Dependencies")), "wrench.png"); @@ -1470,8 +1470,8 @@ void TabFilament::build() }; optgroup->append_line(line); - const int gcode_field_height = int(11.5 * m_em_unit + 0.5); // 150 - const int notes_field_height = 19 * m_em_unit; // 250 + const int gcode_field_height = 15 * m_em_unit; // 150 + const int notes_field_height = 25 * m_em_unit; // 250 page = add_options_page(_(L("Custom G-code")), "cog.png"); optgroup = page->new_optgroup(_(L("Start G-code")), 0); @@ -1850,8 +1850,8 @@ void TabPrinter::build_fff() optgroup->append_single_option_line("use_volumetric_e"); optgroup->append_single_option_line("variable_layer_height"); - const int gcode_field_height = int(11.5 * m_em_unit + 0.5); // 150 - const int notes_field_height = 19 * m_em_unit; // 250 + const int gcode_field_height = 15 * m_em_unit; // 150 + const int notes_field_height = 25 * m_em_unit; // 250 page = add_options_page(_(L("Custom G-code")), "cog.png"); optgroup = page->new_optgroup(_(L("Start G-code")), 0); option = optgroup->get_option("start_gcode"); @@ -1970,7 +1970,7 @@ void TabPrinter::build_sla() optgroup = page->new_optgroup(_(L("Print Host upload"))); build_printhost(optgroup.get()); - const int notes_field_height = 19 * m_em_unit; // 250 + const int notes_field_height = 25 * m_em_unit; // 250 page = add_options_page(_(L("Notes")), "note.png"); optgroup = page->new_optgroup(_(L("Notes")), 0); @@ -2025,7 +2025,7 @@ PageShp TabPrinter::build_kinematics_page() // Legend for OptionsGroups auto optgroup = page->new_optgroup(""); optgroup->set_show_modified_btns_val(false); - optgroup->label_width = 18 * m_em_unit;// 230; + optgroup->label_width = 23 * m_em_unit;// 230; auto line = Line{ "", "" }; ConfigOptionDef def; @@ -3111,7 +3111,7 @@ void TabSLAMaterial::build() optgroup->append_single_option_line("initial_exposure_time"); optgroup = page->new_optgroup(_(L("Corrections"))); - optgroup->label_width = int(14.5 * m_em_unit+0.5);//190; + optgroup->label_width = 19 * m_em_unit;//190; std::vector<std::string> corrections = { "material_correction_printing", "material_correction_curing" }; std::vector<std::string> axes{ "X", "Y", "Z" }; for (auto& opt_key : corrections) { @@ -3132,7 +3132,7 @@ void TabSLAMaterial::build() optgroup->label_width = 0; Option option = optgroup->get_option("material_notes"); option.opt.full_width = true; - option.opt.height = 19 * m_em_unit;//250; + option.opt.height = 25 * m_em_unit;//250; optgroup->append_single_option_line(option); page = add_options_page(_(L("Dependencies")), "wrench.png");