From 7a335590e2770679876a898f1a4a0c3dc6ddeccf Mon Sep 17 00:00:00 2001 From: A Koolen-Bourke Date: Mon, 20 May 2024 02:20:08 +1200 Subject: [PATCH] =?UTF-8?q?Added=20a=20deactivate()=20function=20to=20Tab?= =?UTF-8?q?=20so=20when=20switching=20tabs=20it=20hides=20=E2=80=A6=20(#53?= =?UTF-8?q?86)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a deactivate() function to Tab so when switching tabs it hides the active contents. Also removed clearing of the pages so it's not destroyed each time. Co-authored-by: SoftFever --- src/slic3r/GUI/Tab.cpp | 13 +++++++++++-- src/slic3r/GUI/Tab.hpp | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 2bd2f1ea55..595434a9be 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -5199,6 +5199,10 @@ bool Tab::tree_sel_change_delayed(wxCommandEvent& event) if (m_active_page == page) return false; + if (m_active_page != nullptr) { + m_active_page->deactivate(); + } + m_active_page = page; auto throw_if_canceled = std::function([this](){ @@ -5216,8 +5220,6 @@ bool Tab::tree_sel_change_delayed(wxCommandEvent& event) try { m_page_view->Freeze(); - // clear pages from the controls - clear_pages(); throw_if_canceled(); //BBS: GUI refactor @@ -5922,6 +5924,13 @@ void Page::activate(ConfigOptionMode mode, std::function throw_if_cancel #endif } +void Page::deactivate() +{ + for (auto group : m_optgroups) { + group->Hide(); + } +} + void Page::clear() { for (auto group : m_optgroups) diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index 707e076aaa..71f3e3ef22 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -104,6 +104,7 @@ public: void reload_config(); void update_visibility(ConfigOptionMode mode, bool update_contolls_visibility); void activate(ConfigOptionMode mode, std::function throw_if_canceled); + void deactivate(); void clear(); void msw_rescale(); void sys_color_changed();