From f56e9b4b217ad82048996c2c67277f028e772c51 Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Mon, 1 Aug 2022 18:02:16 +0800 Subject: [PATCH] FIX: layout in sidebar Change-Id: I8f76d4f035c7458b98f285405e01404f2629df65 --- src/slic3r/GUI/GUI_App.cpp | 8 +++---- src/slic3r/GUI/OG_CustomCtrl.cpp | 3 ++- src/slic3r/GUI/OptionsGroup.cpp | 4 ++-- src/slic3r/GUI/ParamsPanel.cpp | 1 + src/slic3r/GUI/Plater.cpp | 34 ++++++++++++----------------- src/slic3r/GUI/PresetComboBoxes.cpp | 6 ++--- src/slic3r/GUI/Tab.cpp | 2 +- 7 files changed, 27 insertions(+), 31 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 7e6b70559..d6eaa81ec 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -187,9 +187,9 @@ public: scale_bitmap(m_main_bitmap, m_scale); // init constant texts and scale fonts - m_constant_text.init(get_default_font(this)); + m_constant_text.init(Label::Body_16); scale_font(m_constant_text.title_font, 2.0f); - scale_font(m_constant_text.version_font, 1.5f); + scale_font(m_constant_text.version_font, 1.2f); // this font will be used for the action string m_action_font = m_constant_text.credits_font; @@ -2268,11 +2268,11 @@ const wxColour GUI_App::get_label_default_clr_modified() void GUI_App::init_label_colours() { m_color_label_modified = wxColour("#F1754E"); - m_color_label_sys = wxColour("#2B3436"); + m_color_label_sys = wxColour("#323A3D"); bool is_dark_mode = dark_mode(); #ifdef _WIN32 - m_color_label_default = is_dark_mode ? wxColour(250, 250, 250): wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); + m_color_label_default = is_dark_mode ? wxColour(250, 250, 250) : m_color_label_sys; // wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); m_color_highlight_label_default = is_dark_mode ? wxColour(230, 230, 230): wxSystemSettings::GetColour(/*wxSYS_COLOUR_HIGHLIGHTTEXT*/wxSYS_COLOUR_WINDOWTEXT); m_color_highlight_default = is_dark_mode ? wxColour(78, 78, 78) : wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT); m_color_hovered_btn_label = is_dark_mode ? wxColour(253, 111, 40) : wxColour(252, 77, 1); diff --git a/src/slic3r/GUI/OG_CustomCtrl.cpp b/src/slic3r/GUI/OG_CustomCtrl.cpp index 5d03efe4c..a51083f5c 100644 --- a/src/slic3r/GUI/OG_CustomCtrl.cpp +++ b/src/slic3r/GUI/OG_CustomCtrl.cpp @@ -848,7 +848,8 @@ void OG_CustomCtrl::CtrlLine::render(wxDC& dc, wxCoord h_pos, wxCoord v_pos) // is_url_string = false; //else if(opt == option_set.front()) // is_url_string = !suppress_hyperlinks && !og_line.label_path.empty(); - h_pos = draw_text(dc, wxPoint(h_pos, v_pos), label, field ? (field->blink() ? &blink_color : field->label_color()) : nullptr, ctrl->opt_group->sublabel_width * ctrl->m_em_unit); + static wxColor c("#6B6B6B"); + h_pos = draw_text(dc, wxPoint(h_pos, v_pos), label, field ? (field->blink() ? &blink_color : &c) : nullptr, ctrl->opt_group->sublabel_width * ctrl->m_em_unit); h_pos += 8; } diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 53af54745..57d819e3c 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -462,8 +462,8 @@ bool OptionsGroup::activate(std::function throw_if_canceled/* = [](){}*/ else { // BBS: new layout ::StaticLine* stl = new ::StaticLine(m_parent, false, _(title)); - stl->SetFont(wxGetApp().normal_font()); - stl->SetForegroundColour("#6B6B6B"); + stl->SetFont(Label::Head_14); + stl->SetForegroundColour("#262E30"); sizer = new wxBoxSizer(wxVERTICAL); if (title.IsEmpty()) { stl->Hide(); diff --git a/src/slic3r/GUI/ParamsPanel.cpp b/src/slic3r/GUI/ParamsPanel.cpp index 679efeb09..13574f3f4 100644 --- a/src/slic3r/GUI/ParamsPanel.cpp +++ b/src/slic3r/GUI/ParamsPanel.cpp @@ -402,6 +402,7 @@ void ParamsPanel::create_layout() //m_top_sizer->Add( m_right_sizer, 1, wxEXPAND, 5 ); // BBS: new layout + m_left_sizer->AddSpacer(6 * em_unit(this) / 10); #if __WXOSX__ m_left_sizer->Add(m_tmp_panel, 1, wxEXPAND | wxALL, 0); m_tmp_panel->GetSizer()->Add( m_page_view, 1, wxEXPAND ); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index ad9f269fd..d8e5a4022 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -474,16 +474,16 @@ Sidebar::Sidebar(Plater *parent) // 1.2 Add spliters around title bar // add spliter 1 - auto spliter_1 = new ::StaticLine(p->scrolled); - spliter_1->SetBackgroundColour("#A6A9AA"); - scrolled_sizer->Add(spliter_1, 0, wxEXPAND); + //auto spliter_1 = new ::StaticLine(p->scrolled); + //spliter_1->SetBackgroundColour("#A6A9AA"); + //scrolled_sizer->Add(spliter_1, 0, wxEXPAND); // add printer title scrolled_sizer->Add(p->m_panel_printer_title, 0, wxEXPAND | wxALL, 0); // add spliter 2 auto spliter_2 = new ::StaticLine(p->scrolled); - spliter_2->SetBackgroundColour("#ACACAC"); + spliter_2->SetLineColour("#CECECE"); scrolled_sizer->Add(spliter_2, 0, wxEXPAND); @@ -516,7 +516,7 @@ Sidebar::Sidebar(Plater *parent) wxStaticText* bed_type_title = new wxStaticText(p->m_panel_printer_content, wxID_ANY, _L("Bed type")); bed_type_title->Wrap(-1); bed_type_title->SetFont(Label::Body_14); - m_bed_type_list = new ComboBox(p->m_panel_printer_content, wxID_ANY, wxString(""), wxDefaultPosition, {-1, FromDIP(30)}, 0, nullptr, wxCB_READONLY); + m_bed_type_list = new ComboBox(p->m_panel_printer_content, wxID_ANY, wxString(""), wxDefaultPosition, {-1, FromDIP(24)}, 0, nullptr, wxCB_READONLY); const ConfigOptionDef* bed_type_def = print_config_def.get("curr_bed_type"); if (bed_type_def && bed_type_def->enum_keys_map) { for (auto item : *bed_type_def->enum_keys_map) @@ -530,8 +530,8 @@ Sidebar::Sidebar(Plater *parent) p->m_panel_printer_content->SetSizer(vsizer_printer); p->m_panel_printer_content->Layout(); - scrolled_sizer->Add(p->m_panel_printer_content, 0, wxTOP | wxEXPAND, FromDIP(5)); - scrolled_sizer->AddSpacer(FromDIP(20)); + scrolled_sizer->Add(p->m_panel_printer_content, 0, wxTOP | wxEXPAND, FromDIP(14)); + scrolled_sizer->AddSpacer(FromDIP(16)); } { @@ -555,11 +555,11 @@ Sidebar::Sidebar(Plater *parent) p->m_panel_filament_title->SetSizer( bSizer39 ); p->m_panel_filament_title->Layout(); auto spliter_1 = new ::StaticLine(p->scrolled); - spliter_1->SetBackgroundColour("#A6A9AA"); + spliter_1->SetLineColour("#A6A9AA"); scrolled_sizer->Add(spliter_1, 0, wxEXPAND); scrolled_sizer->Add(p->m_panel_filament_title, 0, wxEXPAND | wxALL, 0); auto spliter_2 = new ::StaticLine(p->scrolled); - spliter_2->SetBackgroundColour("#ACACAC"); + spliter_2->SetLineColour("#CECECE"); scrolled_sizer->Add(spliter_2, 0, wxEXPAND); // BBS @@ -700,8 +700,8 @@ Sidebar::Sidebar(Plater *parent) //bSizer_filament_content->Add(p->sizer_filaments, 1, wxALIGN_CENTER | wxALL); p->m_panel_filament_content->SetSizer(p->sizer_filaments); p->m_panel_filament_content->Layout(); - scrolled_sizer->Add(p->m_panel_filament_content, 0, wxTOP | wxEXPAND, FromDIP(5)); - scrolled_sizer->AddSpacer(FromDIP(20)); + scrolled_sizer->Add(p->m_panel_filament_content, 0, wxTOP | wxEXPAND, FromDIP(14)); + scrolled_sizer->AddSpacer(FromDIP(16)); } { @@ -710,14 +710,11 @@ Sidebar::Sidebar(Plater *parent) if (params_panel) { params_panel->get_top_panel()->Reparent(p->scrolled); auto spliter_1 = new ::StaticLine(p->scrolled); - spliter_1->SetBackgroundColour("#A6A9AA"); - scrolled_sizer->Add(spliter_1, 0, wxEXPAND); - spliter_1 = new ::StaticLine(p->scrolled); // double line - spliter_1->SetBackgroundColour("#A6A9AA"); + spliter_1->SetLineColour("#A6A9AA"); scrolled_sizer->Add(spliter_1, 0, wxEXPAND); scrolled_sizer->Add(params_panel->get_top_panel(), 0, wxEXPAND); auto spliter_2 = new ::StaticLine(p->scrolled); - spliter_2->SetBackgroundColour("#ACACAC"); + spliter_2->SetLineColour("#CECECE"); scrolled_sizer->Add(spliter_2, 0, wxEXPAND); } @@ -1992,11 +1989,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) // BBS: move sidebar to left side hsizer->Add(sidebar, 0, wxEXPAND | wxLEFT | wxRIGHT, 0); auto spliter_1 = new ::StaticLine(q, true); - spliter_1->SetBackgroundColour("#A6A9AA"); + spliter_1->SetLineColour("#A6A9AA"); hsizer->Add(spliter_1, 0, wxEXPAND); - auto spliter_2 = new ::StaticLine(q, true); - spliter_2->SetBackgroundColour("#A6A9AA"); - hsizer->Add(spliter_2, 0, wxEXPAND); panel_sizer = new wxBoxSizer(wxHORIZONTAL); panel_sizer->Add(view3D, 1, wxEXPAND | wxALL, 0); diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index dcf71dcd5..21e6963e4 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -609,7 +609,7 @@ bool PresetComboBox::selection_is_changed_according_to_physical_printers() // --------------------------------- PlaterPresetComboBox::PlaterPresetComboBox(wxWindow *parent, Preset::Type preset_type) : - PresetComboBox(parent, preset_type, wxSize(15 * wxGetApp().em_unit(), 3 * wxGetApp().em_unit())) + PresetComboBox(parent, preset_type, wxSize(15 * wxGetApp().em_unit(), 24 * wxGetApp().em_unit() / 10)) { GetDropDown().SetUseContentWidth(true); @@ -1092,7 +1092,7 @@ void PlaterPresetComboBox::update() void PlaterPresetComboBox::msw_rescale() { PresetComboBox::msw_rescale(); - SetMinSize({-1, 3 * m_em_unit}); + SetMinSize({-1, 24 * m_em_unit / 10}); if (clr_picker) clr_picker->SetSize(20 * m_em_unit / 10, 20 * m_em_unit / 10); @@ -1322,7 +1322,7 @@ void TabPresetComboBox::update() void TabPresetComboBox::msw_rescale() { - PresetComboBox::msw_rescale(); + PresetComboBox::Rescale(); // BBS: new layout wxSize sz = wxSize(20 * m_em_unit, GetSize().GetHeight()); SetMinSize(sz); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 638c7f18d..d6333bcb9 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -4732,7 +4732,7 @@ void Page::activate(ConfigOptionMode mode, std::function throw_if_cancel for (auto group : m_optgroups) { if (!group->activate(throw_if_canceled)) continue; - m_vsizer->Add(group->sizer, 0, wxEXPAND | (group->is_legend_line() ? (wxLEFT|wxTOP) : wxALL), 10); + m_vsizer->Add(group->sizer, 0, wxEXPAND | (group->is_legend_line() ? (wxLEFT|wxTOP) : wxALL), 5); group->update_visibility(mode); #if HIDE_FIRST_SPLIT_LINE if (first) group->stb->Hide();