FIX: layout in sidebar

Change-Id: I8f76d4f035c7458b98f285405e01404f2629df65
This commit is contained in:
chunmao.guo 2022-08-01 18:02:16 +08:00 committed by Lane.Wei
parent 179d2ec120
commit f56e9b4b21
7 changed files with 27 additions and 31 deletions

View file

@ -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);

View file

@ -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;
}

View file

@ -462,8 +462,8 @@ bool OptionsGroup::activate(std::function<void()> 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();

View file

@ -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 );

View file

@ -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);

View file

@ -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);

View file

@ -4732,7 +4732,7 @@ void Page::activate(ConfigOptionMode mode, std::function<void()> 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();