From 21d41bbbec7fc90c0dbb8cd3fb97b0b933d7d7ec Mon Sep 17 00:00:00 2001 From: "yifan.wu" Date: Wed, 27 Jul 2022 11:51:22 +0800 Subject: [PATCH] ENH: optimize object list display 1. add filament title 2. adjust the layout propotion of object list and per-object parameter setting panel 3. replace wxScrollWindow with wxPanel for the Sidebar to avoid ugly double scrollbars 4. remove the auto height logic in object list to avoid it occupies too much height, causing no enough space for per-object setting panel Signed-off-by: yifan.wu Change-Id: I2201b61e5a654e86427ce7f377d0e4c4ef593748 (cherry picked from commit dd0413d6c22a20059e9042b88a15391518fb54c7) --- src/slic3r/GUI/GUI_ObjectList.cpp | 6 +++++- src/slic3r/GUI/Plater.cpp | 12 ++++++------ src/slic3r/GUI/Plater.hpp | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 099353157..ed55b8ad0 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -289,10 +289,14 @@ void ObjectList::update_min_height() wxDataViewItemArray all_items; m_objects_model->GetAllChildren(wxDataViewItem(nullptr), all_items); size_t items_cnt = all_items.Count(); +#if 0 if (items_cnt < 7) items_cnt = 7; else if (items_cnt >= 15) items_cnt = 15; +#else + items_cnt = 8; +#endif if (m_items_count == items_cnt) return; @@ -356,7 +360,7 @@ void ObjectList::create_objects_ctrl() bmp_choice_renderer->set_default_extruder_idx([this]() { return m_objects_model->GetDefaultExtruderIdx(GetSelection()); }); - AppendColumn(new wxDataViewColumn(_L(""), bmp_choice_renderer, + AppendColumn(new wxDataViewColumn(_L("Fila."), bmp_choice_renderer, colFilament, m_columns_width[colFilament] * em, wxALIGN_CENTER_HORIZONTAL, 0)); // BBS diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index c3c166fca..1d7f30743 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -268,7 +268,7 @@ struct Sidebar::priv { Plater *plater; - wxScrolledWindow *scrolled; + wxPanel *scrolled; PlaterPresetComboBox *combo_print; std::vector combos_filament; int editing_filament = -1; @@ -407,12 +407,12 @@ void Sidebar::priv::hide_rich_tip(wxButton* btn) Sidebar::Sidebar(Plater *parent) : wxPanel(parent, wxID_ANY, wxDefaultPosition, wxSize(42 * wxGetApp().em_unit(), -1)), p(new priv(parent)) { - p->scrolled = new wxScrolledWindow(this); + p->scrolled = new wxPanel(this); // p->scrolled->SetScrollbars(0, 100, 1, 2); // ys_DELETE_after_testing. pixelsPerUnitY = 100 // but this cause the bad layout of the sidebar, when all infoboxes appear. // As a result we can see the empty block at the bottom of the sidebar // But if we set this value to 5, layout will be better - p->scrolled->SetScrollRate(0, 5); + //p->scrolled->SetScrollRate(0, 5); p->scrolled->SetBackgroundColour(*wxWHITE); @@ -724,7 +724,7 @@ Sidebar::Sidebar(Plater *parent) p->sizer_params = new wxBoxSizer(wxVERTICAL); p->m_object_list = new ObjectList(p->scrolled); p->sizer_params->Add(p->m_object_list, 1, wxEXPAND | wxTOP, 0); - scrolled_sizer->Add(p->sizer_params, 3, wxEXPAND | wxLEFT, 0); + scrolled_sizer->Add(p->sizer_params, 2, wxEXPAND | wxLEFT, 0); p->m_object_list->Hide(); p->m_auxiliary_dialog = new AuxiliaryDialog(this); @@ -737,7 +737,7 @@ Sidebar::Sidebar(Plater *parent) #else if (params_panel) { params_panel->Reparent(p->scrolled); - scrolled_sizer->Add(params_panel, 2, wxEXPAND); + scrolled_sizer->Add(params_panel, 3, wxEXPAND); } #endif @@ -1202,7 +1202,7 @@ ObjectSettings* Sidebar::obj_settings() return p->object_settings; } -wxScrolledWindow* Sidebar::scrolled_panel() +wxPanel* Sidebar::scrolled_panel() { return p->scrolled; } diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 95d3f635b..a8f0b812c 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -122,7 +122,7 @@ public: ObjectList* obj_list(); ObjectSettings* obj_settings(); - wxScrolledWindow* scrolled_panel(); + wxPanel* scrolled_panel(); wxPanel* print_panel(); wxPanel* filament_panel();