diff --git a/src/slic3r/GUI/OG_CustomCtrl.cpp b/src/slic3r/GUI/OG_CustomCtrl.cpp index bfeb550d3d..2d85b27e5e 100644 --- a/src/slic3r/GUI/OG_CustomCtrl.cpp +++ b/src/slic3r/GUI/OG_CustomCtrl.cpp @@ -328,7 +328,7 @@ void OG_CustomCtrl::OnPaint(wxPaintEvent&) wxPaintDC dc(this); - wxCoord h_pos = get_title_width() * m_em_unit; + wxCoord h_pos = get_title_width() * m_em_unit + 4; // ORCA Align label with group title. StaticLine.cpp uses 18px for icon 5px for spacing. Spacing doesnt scales on messureSize() wxCoord v_pos = 0; // BBS: new layout if (!GetLabel().IsEmpty()) { diff --git a/src/slic3r/GUI/ParamsPanel.cpp b/src/slic3r/GUI/ParamsPanel.cpp index 629537420d..4435519a42 100644 --- a/src/slic3r/GUI/ParamsPanel.cpp +++ b/src/slic3r/GUI/ParamsPanel.cpp @@ -360,9 +360,9 @@ void ParamsPanel::create_layout() if (m_top_panel) { m_mode_sizer = new wxBoxSizer( wxHORIZONTAL ); - m_mode_sizer->AddSpacer(FromDIP(11)); + m_mode_sizer->AddSpacer(FromDIP(SidebarProps::TitlebarMargin())); m_mode_sizer->Add(m_process_icon, 0, wxALIGN_CENTER); - m_mode_sizer->AddSpacer(FromDIP(11)); + m_mode_sizer->AddSpacer(FromDIP(SidebarProps::ElementSpacing())); m_mode_sizer->Add( m_title_label, 0, wxALIGN_CENTER ); m_mode_sizer->AddStretchSpacer(2); m_mode_sizer->Add(m_mode_region, 0, wxALIGN_CENTER); @@ -370,14 +370,14 @@ void ParamsPanel::create_layout() m_mode_sizer->Add(m_tips_arrow, 0, wxALIGN_CENTER); m_mode_sizer->AddStretchSpacer(8); m_mode_sizer->Add( m_title_view, 0, wxALIGN_CENTER ); - m_mode_sizer->AddSpacer(FromDIP(2)); + m_mode_sizer->AddSpacer(FromDIP(SidebarProps::ElementSpacing())); m_mode_sizer->Add(m_mode_view, 0, wxALIGN_CENTER); m_mode_sizer->AddStretchSpacer(2); m_mode_sizer->Add(m_setting_btn, 0, wxALIGN_CENTER); - m_mode_sizer->AddSpacer(FromDIP(2)); + m_mode_sizer->AddSpacer(FromDIP(SidebarProps::IconSpacing())); m_mode_sizer->Add(m_compare_btn, 0, wxALIGN_CENTER); - m_mode_sizer->AddSpacer(FromDIP(8)); + m_mode_sizer->AddSpacer(FromDIP(SidebarProps::TitlebarMargin())); //m_mode_sizer->Add( m_search_btn, 0, wxALIGN_CENTER ); //m_mode_sizer->AddSpacer(16); m_mode_sizer->SetMinSize(-1, FromDIP(30)); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 5a68b1a45a..9f8c5270a2 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -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; diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 4086a15771..dfa7728712 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -107,6 +107,15 @@ using ColorEvent = Event; wxDECLARE_EVENT(EVT_ADD_CUSTOM_FILAMENT, ColorEvent); const wxString DEFAULT_PROJECT_NAME = "Untitled"; +class SidebarProps +{ +public: + static int TitlebarMargin(); + static int ContentMargin(); + static int IconSpacing(); + static int ElementSpacing(); +}; + class Sidebar : public wxPanel { ConfigOptionMode m_mode; @@ -833,4 +842,4 @@ std::vector get_min_flush_volumes(const DynamicPrintConfig& full_config); } // namespace GUI } // namespace Slic3r -#endif +#endif \ No newline at end of file diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 6ed31dd223..d7452465c2 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -358,25 +358,25 @@ void Tab::create_preset_tab() m_main_sizer = new wxBoxSizer( wxVERTICAL ); m_top_sizer = new wxBoxSizer( wxHORIZONTAL ); - m_top_sizer->Add(m_undo_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 5); + m_top_sizer->Add(m_undo_btn, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(SidebarProps::ContentMargin())); // BBS: model config if (m_presets_choice) { m_presets_choice->Reparent(m_top_panel); - m_top_sizer->Add(m_presets_choice, 1, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, 8); + m_top_sizer->Add(m_presets_choice, 1, wxLEFT | wxALIGN_CENTER_VERTICAL, FromDIP(SidebarProps::ElementSpacing())); } else { - m_top_sizer->AddSpacer(10); + m_top_sizer->AddSpacer(FromDIP(SidebarProps::ElementSpacing())); m_top_sizer->AddStretchSpacer(1); } const float scale_factor = /*wxGetApp().*/em_unit(this)*0.1;// GetContentScaleFactor(); #ifndef DISABLE_UNDO_SYS - m_top_sizer->Add( m_undo_to_sys_btn, 0, wxALIGN_CENTER_VERTICAL); - m_top_sizer->AddSpacer(8); + m_top_sizer->Add(m_undo_to_sys_btn, 0, wxALIGN_CENTER_VERTICAL); + m_top_sizer->AddSpacer(FromDIP(SidebarProps::IconSpacing())); #endif - m_top_sizer->Add( m_btn_save_preset, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 8 ); - m_top_sizer->Add( m_btn_delete_preset, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 8 ); - m_top_sizer->Add( m_btn_search, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 8 ); - m_top_sizer->Add( m_search_item, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT , 8 ); + m_top_sizer->Add(m_btn_save_preset, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::IconSpacing())); + m_top_sizer->Add(m_btn_delete_preset, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::IconSpacing())); + m_top_sizer->Add(m_btn_search, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::IconSpacing())); + m_top_sizer->Add(m_search_item, 1, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::ContentMargin())); if (dynamic_cast(this) == nullptr) { m_static_title = new Label(m_top_panel, Label::Body_12, _L("Advance")); @@ -385,13 +385,13 @@ void Tab::create_preset_tab() m_static_title->Bind(wxEVT_LEFT_UP, [this](auto& e) { restore_last_select_item(); }); - m_top_sizer->Add( m_static_title, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 8 ); + m_top_sizer->Add(m_static_title, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(SidebarProps::IconSpacing())); m_mode_view = new SwitchButton(m_top_panel, wxID_ABOUT); - m_top_sizer->AddSpacer(4); + m_top_sizer->AddSpacer(FromDIP(SidebarProps::ElementSpacing())); m_top_sizer->Add( m_mode_view, 0, wxALIGN_CENTER_VERTICAL); } - m_top_sizer->AddSpacer(10); + m_top_sizer->AddSpacer(FromDIP(SidebarProps::ContentMargin())); m_top_sizer->SetMinSize(-1, 3 * m_em_unit); m_top_panel->SetSizer(m_top_sizer);