diff --git a/docs/HLSD/deferred-page-construction.md b/docs/HLSD/deferred-page-construction.md index 6a25d16fc3..921468c533 100644 --- a/docs/HLSD/deferred-page-construction.md +++ b/docs/HLSD/deferred-page-construction.md @@ -38,7 +38,11 @@ no wx dependency and is unit-tested. The notebook needs a page object for a tab to exist and for tabs to be inserted and removed by pointer, and the placeholder is that object. It builds the real panel inside itself the first time it is shown and forwards showing and hiding afterwards, so a panel's -own show handling stays its activation hook. Nothing builds while the main window is +own show handling stays its activation hook. The build runs before the placeholder shows +itself, so a panel built on demand is created in a hidden window as a prebuilt one is: on +Windows every control created or moved inside a shown window re-clips and repaints its +shown siblings, which makes building a large panel into a shown page many times slower. +Nothing builds while the main window is hidden; the window's first show builds the start page. A page that is out of the book is not prebuilt. A panel built while its page is hidden stays hidden, and gets the theming the window applied before the panel existed. diff --git a/src/slic3r/GUI/LazyPage.hpp b/src/slic3r/GUI/LazyPage.hpp index fc85f69285..d07ee27b1b 100644 --- a/src/slic3r/GUI/LazyPage.hpp +++ b/src/slic3r/GUI/LazyPage.hpp @@ -57,6 +57,11 @@ public: // virtual from the book's ShowWithEffect() only for wxSHOW_EFFECT_NONE, the default. bool Show(bool show = true) override { + // Built before this page is shown, as an idle prebuild builds it. On MSW every control + // created or moved inside a shown window re-clips and repaints its shown siblings, so + // building a large panel into a shown page took seconds. + if (show && wxGetTopLevelParent(this)->IsShown()) + this->ensure(); const bool changed = wxPanel::Show(show); if (show) { // The book shows its first page as it is inserted, before startup has chosen the