mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Sidebar margin & spacing fixes (#6238)
* fix alignments for tab and sidebar icons * minimize code changes * minimize code changes * minimize code changes * Align config label with group title * minimize changes * Update Plater.cpp * Update spacing after titlebar text and comments * Update Plater.cpp * Update OG_CustomCtrl.cpp * Use class to control values from one place * fix error * Update Plater.cpp * update
This commit is contained in:
parent
632eff6a3a
commit
d9f4e6b8ba
5 changed files with 64 additions and 47 deletions
|
@ -313,6 +313,11 @@ enum class ActionButtonType : int {
|
|||
abSendGCode
|
||||
};
|
||||
|
||||
int SidebarProps::TitlebarMargin() { return 8; } // Use as side margins on titlebar. Has less margin on sides to create separation with its content
|
||||
int SidebarProps::ContentMargin() { return 12; } // Use as side margins contents of title
|
||||
int SidebarProps::IconSpacing() { return 10; } // Use on main elements
|
||||
int SidebarProps::ElementSpacing() { return 5; } // Use if elements has relation between them like edit button for combo box etc.
|
||||
|
||||
struct Sidebar::priv
|
||||
{
|
||||
Plater *plater;
|
||||
|
@ -714,11 +719,12 @@ Sidebar::Sidebar(Plater *parent)
|
|||
});
|
||||
|
||||
wxBoxSizer* h_sizer_title = new wxBoxSizer(wxHORIZONTAL);
|
||||
h_sizer_title->Add(p->m_printer_icon, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, em);
|
||||
h_sizer_title->Add(p->m_printer_icon, 0, wxALIGN_CENTRE | wxLEFT, FromDIP(SidebarProps::TitlebarMargin()));
|
||||
h_sizer_title->AddSpacer(FromDIP(SidebarProps::ElementSpacing()));
|
||||
h_sizer_title->Add(p->m_text_printer_settings, 0, wxALIGN_CENTER);
|
||||
h_sizer_title->AddStretchSpacer();
|
||||
h_sizer_title->Add(p->m_printer_setting, 0, wxALIGN_CENTER);
|
||||
h_sizer_title->Add(15 * em / 10, 0, 0, 0, 0);
|
||||
h_sizer_title->AddSpacer(FromDIP(SidebarProps::TitlebarMargin()));
|
||||
h_sizer_title->SetMinSize(-1, 3 * em);
|
||||
|
||||
p->m_panel_printer_title->SetSizer(h_sizer_title);
|
||||
|
@ -775,11 +781,10 @@ Sidebar::Sidebar(Plater *parent)
|
|||
wxBoxSizer* hsizer_printer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
vsizer_printer->AddSpacer(FromDIP(16));
|
||||
hsizer_printer->Add(combo_printer, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(3));
|
||||
hsizer_printer->Add(edit_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(3));
|
||||
hsizer_printer->Add(FromDIP(8), 0, 0, 0, 0);
|
||||
hsizer_printer->Add(connection_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(3));
|
||||
hsizer_printer->Add(FromDIP(8), 0, 0, 0, 0);
|
||||
hsizer_printer->Add(combo_printer, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::ContentMargin()));
|
||||
hsizer_printer->Add(edit_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::ElementSpacing()));
|
||||
hsizer_printer->Add(connection_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::IconSpacing()));
|
||||
hsizer_printer->AddSpacer(FromDIP(SidebarProps::ContentMargin()));
|
||||
vsizer_printer->Add(hsizer_printer, 0, wxEXPAND, 0);
|
||||
|
||||
// Bed type selection
|
||||
|
@ -825,8 +830,9 @@ Sidebar::Sidebar(Plater *parent)
|
|||
|
||||
int bed_type_idx = bed_type_value - 1;
|
||||
m_bed_type_list->Select(bed_type_idx);
|
||||
bed_type_sizer->Add(bed_type_title, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, FromDIP(10));
|
||||
bed_type_sizer->Add(m_bed_type_list, 1, wxLEFT | wxRIGHT | wxEXPAND, FromDIP(10));
|
||||
bed_type_sizer->Add(bed_type_title, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(SidebarProps::ContentMargin()));
|
||||
bed_type_sizer->Add(m_bed_type_list, 1, wxLEFT | wxEXPAND, FromDIP(SidebarProps::ElementSpacing()));
|
||||
bed_type_sizer->AddSpacer(FromDIP(SidebarProps::ContentMargin()));
|
||||
vsizer_printer->Add(bed_type_sizer, 0, wxEXPAND | wxTOP, FromDIP(5));
|
||||
vsizer_printer->AddSpacer(FromDIP(16));
|
||||
|
||||
|
@ -865,7 +871,8 @@ Sidebar::Sidebar(Plater *parent)
|
|||
bSizer39 = new wxBoxSizer( wxHORIZONTAL );
|
||||
p->m_filament_icon = new ScalableButton(p->m_panel_filament_title, wxID_ANY, "filament");
|
||||
p->m_staticText_filament_settings = new Label(p->m_panel_filament_title, _L("Filament"), LB_PROPAGATE_MOUSE_EVENT);
|
||||
bSizer39->Add(p->m_filament_icon, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(10));
|
||||
bSizer39->Add(p->m_filament_icon, 0, wxALIGN_CENTER | wxLEFT, FromDIP(SidebarProps::TitlebarMargin()));
|
||||
bSizer39->AddSpacer(FromDIP(SidebarProps::ElementSpacing()));
|
||||
bSizer39->Add( p->m_staticText_filament_settings, 0, wxALIGN_CENTER );
|
||||
bSizer39->Add(FromDIP(10), 0, 0, 0, 0);
|
||||
bSizer39->SetMinSize(-1, FromDIP(30));
|
||||
|
@ -937,7 +944,6 @@ Sidebar::Sidebar(Plater *parent)
|
|||
|
||||
bSizer39->Add(p->m_flushing_volume_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(5));
|
||||
bSizer39->Hide(p->m_flushing_volume_btn);
|
||||
bSizer39->Add(FromDIP(10), 0, 0, 0, 0 );
|
||||
|
||||
ScalableButton* add_btn = new ScalableButton(p->m_panel_filament_title, wxID_ANY, "add_filament");
|
||||
add_btn->SetToolTip(_L("Add one filament"));
|
||||
|
@ -981,10 +987,9 @@ Sidebar::Sidebar(Plater *parent)
|
|||
});
|
||||
p->m_bpButton_del_filament = del_btn;
|
||||
|
||||
bSizer39->Add(del_btn, 0, wxALIGN_CENTER_VERTICAL, FromDIP(5));
|
||||
bSizer39->Add(FromDIP(10), 0, 0, 0, 0);
|
||||
bSizer39->Add(add_btn, 0, wxALIGN_CENTER | wxALL, FromDIP(5)); // ORCA Moved add button after delete button to prevent add button position change when remove icon automatically hidden
|
||||
bSizer39->Add(FromDIP(20), 0, 0, 0, 0);
|
||||
bSizer39->Add(del_btn, 0, wxALIGN_CENTER | wxLEFT, FromDIP(SidebarProps::IconSpacing()));
|
||||
bSizer39->Add(add_btn, 0, wxALIGN_CENTER | wxLEFT, FromDIP(SidebarProps::IconSpacing())); // ORCA Moved add button after delete button to prevent add button position change when remove icon automatically hidden
|
||||
bSizer39->AddSpacer(FromDIP(20));
|
||||
|
||||
if (p->combos_filament.size() <= 1) { // ORCA Fix Flushing button and Delete filament button not hidden on launch while only 1 filament exist
|
||||
bSizer39->Hide(p->m_flushing_volume_btn);
|
||||
|
@ -999,8 +1004,8 @@ Sidebar::Sidebar(Plater *parent)
|
|||
});
|
||||
p->m_bpButton_ams_filament = ams_btn;
|
||||
|
||||
bSizer39->Add(ams_btn, 0, wxALIGN_CENTER|wxALL, FromDIP(5));
|
||||
bSizer39->Add(FromDIP(10), 0, 0, 0, 0 );
|
||||
bSizer39->Add(ams_btn, 0, wxALIGN_CENTER | wxLEFT, FromDIP(SidebarProps::IconSpacing()));
|
||||
//bSizer39->Add(FromDIP(10), 0, 0, 0, 0 );
|
||||
|
||||
ScalableButton* set_btn = new ScalableButton(p->m_panel_filament_title, wxID_ANY, "settings");
|
||||
set_btn->SetToolTip(_L("Set filaments to use"));
|
||||
|
@ -1012,8 +1017,8 @@ Sidebar::Sidebar(Plater *parent)
|
|||
});
|
||||
p->m_bpButton_set_filament = set_btn;
|
||||
|
||||
bSizer39->Add(set_btn, 0, wxALIGN_CENTER);
|
||||
bSizer39->Add(FromDIP(15), 0, 0, 0, 0);
|
||||
bSizer39->Add(set_btn, 0, wxALIGN_CENTER | wxLEFT, FromDIP(SidebarProps::IconSpacing()));
|
||||
bSizer39->AddSpacer(FromDIP(SidebarProps::TitlebarMargin()));
|
||||
|
||||
// add filament content
|
||||
p->m_panel_filament_content = new wxPanel( p->scrolled, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||
|
@ -1033,10 +1038,10 @@ Sidebar::Sidebar(Plater *parent)
|
|||
p->combos_filament[0] = new PlaterPresetComboBox(p->m_panel_filament_content, Preset::TYPE_FILAMENT);
|
||||
auto combo_and_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
// BBS: filament double columns
|
||||
combo_and_btn_sizer->Add(FromDIP(8), 0, 0, 0, 0);
|
||||
combo_and_btn_sizer->AddSpacer(FromDIP(SidebarProps::ContentMargin()));
|
||||
if (p->combos_filament[0]->clr_picker) {
|
||||
p->combos_filament[0]->clr_picker->SetLabel("1");
|
||||
combo_and_btn_sizer->Add(p->combos_filament[0]->clr_picker, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(3));
|
||||
combo_and_btn_sizer->Add(p->combos_filament[0]->clr_picker, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT,FromDIP(SidebarProps::ElementSpacing()) - FromDIP(2)); // ElementSpacing - 2 (from combo box))
|
||||
}
|
||||
combo_and_btn_sizer->Add(p->combos_filament[0], 1, wxALL | wxEXPAND, FromDIP(2))->SetMinSize({-1, FromDIP(30) });
|
||||
|
||||
|
@ -1052,8 +1057,8 @@ Sidebar::Sidebar(Plater *parent)
|
|||
});
|
||||
combobox->edit_btn = edit_btn;
|
||||
|
||||
combo_and_btn_sizer->Add(edit_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(3));
|
||||
combo_and_btn_sizer->Add(FromDIP(8), 0, 0, 0, 0);
|
||||
combo_and_btn_sizer->Add(edit_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::ElementSpacing()) - FromDIP(2)); // ElementSpacing - 2 (from combo box))
|
||||
combo_and_btn_sizer->AddSpacer(FromDIP(SidebarProps::ContentMargin()));
|
||||
|
||||
p->combos_filament[0]->set_filament_idx(0);
|
||||
p->sizer_filaments->GetItem((size_t)0)->GetSizer()->Add(combo_and_btn_sizer, 1, wxEXPAND);
|
||||
|
@ -1164,10 +1169,13 @@ void Sidebar::init_filament_combo(PlaterPresetComboBox **combo, const int filame
|
|||
auto combo_and_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
// BBS: filament double columns
|
||||
int em = wxGetApp().em_unit();
|
||||
combo_and_btn_sizer->Add(FromDIP(8), 0, 0, 0, 0 );
|
||||
|
||||
// int em = wxGetApp().em_unit();
|
||||
if ((filament_idx % 2) == 0) // Dont add right column item. this one create equal spacing on left, right & middle
|
||||
combo_and_btn_sizer->AddSpacer(FromDIP((filament_idx % 2) == 0 ? 12 : 3)); // Content Margin
|
||||
|
||||
(*combo)->clr_picker->SetLabel(wxString::Format("%d", filament_idx + 1));
|
||||
combo_and_btn_sizer->Add((*combo)->clr_picker, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(3));
|
||||
combo_and_btn_sizer->Add((*combo)->clr_picker, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(SidebarProps::ElementSpacing()) - FromDIP(2)); // ElementSpacing - 2 (from combo box))
|
||||
combo_and_btn_sizer->Add(*combo, 1, wxALL | wxEXPAND, FromDIP(2))->SetMinSize({-1, FromDIP(30)});
|
||||
|
||||
/* BBS hide del_btn
|
||||
|
@ -1196,9 +1204,9 @@ void Sidebar::init_filament_combo(PlaterPresetComboBox **combo, const int filame
|
|||
});
|
||||
combobox->edit_btn = edit_btn;
|
||||
|
||||
combo_and_btn_sizer->Add(edit_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(3));
|
||||
combo_and_btn_sizer->Add(edit_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::ElementSpacing()) - FromDIP(2)); // ElementSpacing - 2 (from combo box))
|
||||
|
||||
combo_and_btn_sizer->Add(FromDIP(8), 0, 0, 0, 0);
|
||||
combo_and_btn_sizer->AddSpacer(FromDIP(SidebarProps::ContentMargin()));
|
||||
|
||||
// BBS: filament double columns
|
||||
auto side = filament_idx % 2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue