From 418aca7186cfd259478ef1fff0200abb84f000d1 Mon Sep 17 00:00:00 2001 From: Noisyfox Date: Wed, 17 Jan 2024 23:36:43 +0800 Subject: [PATCH] Remember the sidebar size (#3700) Store the current sidebar size using `best_size` --- src/slic3r/GUI/Plater.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index f5d017eb00..20f65758a0 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2646,6 +2646,15 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) sidebar_layout.is_collapsed = !sidebar.IsShown(); } + // Keep tracking the current sidebar size, by storing it using `best_size`, which will be stored + // in the config and re-applied when the app is opened again. + this->sidebar->Bind(wxEVT_IDLE, [&sidebar, this](wxIdleEvent& e) { + if (sidebar.IsShown() && sidebar.IsDocked() && sidebar.rect.GetWidth() > 0) { + sidebar.BestSize(sidebar.rect.GetWidth(), sidebar.best_size.GetHeight()); + } + e.Skip(); + }); + // Hide sidebar initially, will re-show it after initialization when we got proper window size sidebar.Hide(); m_aui_mgr.Update();