From b721f9431af9869fc9d85c2207fddefd84595951 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 13 Nov 2018 12:19:56 +0100 Subject: [PATCH] Fixed show_info_sizer according to selected mode. + fixed right panel layouts + deleted unused functions --- src/slic3r/GUI/GUI_App.cpp | 8 +++----- src/slic3r/GUI/GUI_ObjectList.cpp | 22 +++++----------------- src/slic3r/GUI/GUI_ObjectList.hpp | 2 -- src/slic3r/GUI/GUI_ObjectSettings.cpp | 2 +- src/slic3r/GUI/Plater.cpp | 21 +++++---------------- src/slic3r/GUI/Plater.hpp | 5 +++-- 6 files changed, 17 insertions(+), 43 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index eba84db39..258d153cd 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -481,18 +481,16 @@ ConfigMenuIDs GUI_App::get_view_mode() // Update view mode according to selected menu void GUI_App::update_mode() { - wxWindowUpdateLocker noUpdates(mainframe->m_plater); + wxWindowUpdateLocker noUpdates(&sidebar()); ConfigMenuIDs mode = wxGetApp().get_view_mode(); obj_list()->get_sizer()->Show(mode == ConfigMenuModeExpert); - sidebar().show_info_sizer(mode == ConfigMenuModeExpert); + sidebar().set_mode_value(mode); sidebar().show_buttons(mode == ConfigMenuModeExpert); - obj_manipul()->show_object_name(mode == ConfigMenuModeSimple); - obj_list()->update_manipulation_sizer(mode == ConfigMenuModeSimple); + obj_list()->update_selections(); sidebar().Layout(); - mainframe->m_plater->Layout(); ConfigOptionMode opt_mode = mode == ConfigMenuModeSimple ? comSimple : mode == ConfigMenuModeExpert ? comExpert : comAdvanced; diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index a088e13e5..c52c3c7ba 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1016,7 +1016,6 @@ void ObjectList::part_selection_changed() bool update_and_show_manipulations = false; bool update_and_show_settings = false; - bool show_info_sizer = false; if (multiple_selection()) { og_name = _(L("Group manipulation")); @@ -1033,7 +1032,6 @@ void ObjectList::part_selection_changed() og_name = _(L("Object manipulation")); m_config = &(*m_objects)[obj_idx]->config; update_and_show_manipulations = true; - show_info_sizer = true; } else { auto parent = m_objects_model->GetParent(item); @@ -1082,25 +1080,15 @@ void ObjectList::part_selection_changed() if (update_and_show_settings) wxGetApp().obj_settings()->get_og()->set_name(" " + og_name + " "); - auto panel = wxGetApp().sidebar().scrolled_panel(); - panel->Freeze(); + Sidebar& panel = wxGetApp().sidebar(); + panel.Freeze(); wxGetApp().obj_manipul() ->UpdateAndShow(update_and_show_manipulations); wxGetApp().obj_settings()->UpdateAndShow(update_and_show_settings); - show_info_sizer ? wxGetApp().sidebar().update_info_sizer() : wxGetApp().sidebar().show_info_sizer(false); + wxGetApp().sidebar().show_info_sizer(); - panel->Thaw(); -} - -void ObjectList::update_manipulation_sizer(const bool is_simple_mode) -{ - auto item = GetSelection(); /// #ys_FIXME_to_multi_sel - if (!item || !is_simple_mode) - return; - - if (m_objects_model->IsSettingsItem(item)) { - select_item(m_objects_model->GetParent(item)); - } + panel.Layout(); + panel.Thaw(); } void ObjectList::add_object_to_list(size_t obj_idx) diff --git a/src/slic3r/GUI/GUI_ObjectList.hpp b/src/slic3r/GUI/GUI_ObjectList.hpp index dd0b27bd7..826eb9a7d 100644 --- a/src/slic3r/GUI/GUI_ObjectList.hpp +++ b/src/slic3r/GUI/GUI_ObjectList.hpp @@ -110,8 +110,6 @@ public: void parts_changed(int obj_idx); void part_selection_changed(); - void update_manipulation_sizer(const bool is_simple_mode); - // Add object to the list void add_object_to_list(size_t obj_idx); // Delete object from the list diff --git a/src/slic3r/GUI/GUI_ObjectSettings.cpp b/src/slic3r/GUI/GUI_ObjectSettings.cpp index 50274ec99..ec463dfb5 100644 --- a/src/slic3r/GUI/GUI_ObjectSettings.cpp +++ b/src/slic3r/GUI/GUI_ObjectSettings.cpp @@ -38,7 +38,7 @@ void OG_Settings::Hide() void OG_Settings::UpdateAndShow(const bool show) { Show(show); - m_parent->Layout(); +// m_parent->Layout(); } wxSizer* OG_Settings::get_sizer() diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 3cd396d70..3e909c7a2 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -690,19 +690,11 @@ void Sidebar::update_objects_list_extruder_column(int extruders_count) p->object_list->update_objects_list_extruder_column(extruders_count); } -void Sidebar::show_info_sizer(const bool show) +void Sidebar::show_info_sizer() { - p->object_info->show_sizer(show); - p->scrolled->Layout(); -} - -void Sidebar::update_info_sizer() -{ - wxWindowUpdateLocker freeze_guard(p->scrolled); - - if (/*obj_idx < 0 || */!p->plater->is_single_full_object_selection()) { + if (!p->plater->is_single_full_object_selection() || + m_mode < ConfigMenuModeExpert ) { p->object_info->Show(false); - p->scrolled->Layout(); return; } @@ -743,12 +735,11 @@ void Sidebar::update_info_sizer() } p->object_info->show_sizer(true); - p->scrolled->Layout(); } void Sidebar::show_sliced_info_sizer(const bool show) { - wxWindowUpdateLocker freeze_guard(p->scrolled); + wxWindowUpdateLocker freeze_guard(this); p->sliced_info->Show(show); if (show) { @@ -777,7 +768,7 @@ void Sidebar::show_sliced_info_sizer(const bool show) p->sliced_info->SetTextAndShow(siWTNumbetOfToolchanges, is_wipe_tower ? wxString::Format("%.d", p->plater->print().wipe_tower_data().number_of_toolchanges) : "N/A"); } - p->scrolled->Layout(); + Layout(); } void Sidebar::show_buttons(const bool show) @@ -1413,8 +1404,6 @@ void Plater::priv::selection_changed() _3DScene::enable_toolbar_item(canvas3D, "layersediting", layers_height_allowed()); // forces a frame render to update the view (to avoid a missed update if, for example, the context menu appears) _3DScene::render(canvas3D); - - sidebar->update_info_sizer(); } void Plater::priv::object_list_changed() diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 2a6d09dfd..5cc89f351 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -62,6 +62,7 @@ enum ButtonAction class Sidebar : public wxPanel { + /*ConfigMenuIDs*/int m_mode; public: Sidebar(Plater *parent); Sidebar(Sidebar &&) = delete; @@ -82,13 +83,13 @@ public: ConfigOptionsGroup* og_freq_chng_params(); wxButton* get_wiping_dialog_button(); void update_objects_list_extruder_column(int extruders_count); - void show_info_sizer(const bool show); - void update_info_sizer(); + void show_info_sizer(); void show_sliced_info_sizer(const bool show); void show_buttons(const bool show); void show_button(ButtonAction but_action, bool show); void enable_buttons(bool enable); bool is_multifilament(); + void set_mode_value(const /*ConfigMenuIDs*/int mode) { m_mode = mode; } std::vector& combos_filament(); private: