mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-05 14:51:06 +00:00
Open the Design tab quickly on Windows the first time
A page built on first click is now built before it is shown, as the idle prebuild already does, so its controls are not created inside a visible window. This takes the Design tab's first open on Windows from ~9 s to ~1 s.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user