From 25f755c43453078e711f84adfd3076b3c8698422 Mon Sep 17 00:00:00 2001 From: SoftFever Date: Sat, 3 Oct 2026 21:01:56 +0800 Subject: [PATCH] Open the Design tab sidebar at Prepare's width instead of its minimum --- .../references/webview-gl-aui-media.md | 15 ++++++++++++++- src/slic3r/GUI/CAD/DesignPanel.cpp | 7 +++++-- src/slic3r/GUI/CAD/DesignPanel.hpp | 1 + 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.claude/skills/orca-wxwidgets/references/webview-gl-aui-media.md b/.claude/skills/orca-wxwidgets/references/webview-gl-aui-media.md index 0e6df9f63f..b8856b21ca 100644 --- a/.claude/skills/orca-wxwidgets/references/webview-gl-aui-media.md +++ b/.claude/skills/orca-wxwidgets/references/webview-gl-aui-media.md @@ -88,6 +88,7 @@ available; GTK2/WebKit1 is an opt-out configuration the GUI does not support. 24. ImGui text uses `_u8L`; ImGui sizes are physical pixels (scale by `GLCanvas3D::get_scale()`); a font atlas must fit `GL_MAX_TEXTURE_SIZE`. §[ImGui boundary](#the-imgui-layer-boundary) 25. After `AddPane` or any `wxAuiPaneInfo` change, call `wxAuiManager::Update()` once for the batch. + Keep a docked pane hidden until the managed window has been laid out. §[AUI](#wxauimanager-and-orcas-docking) 26. Give every pane a unique, stable `Name()` free of layout delimiters (`|`, `;`, `=`, `\`). §[AUI](#wxauimanager-and-orcas-docking) @@ -920,6 +921,16 @@ widgets beside the canvas (a sibling, not a child over it), or in a popup. - **Update.** "Update() must be invoked after AddPane() or InsertPane() … any number of changes may be made to wxAuiPaneInfo structures (retrieved with wxAuiManager::GetPane), but to realize the changes, Update() must be called" (`interface/wx/aui/framemanager.h:747-756`). Batch, then `Update()` once. +- **Dock size** [source]. The docs limit "any new dock" to a `SetDockSizeConstraint` fraction of the + window (`interface/wx/aui/framemanager.h:660-672`). The source applies it to the managed window's client + size at the `Update()` that creates the dock, sizing the dock from its panes' `best_size` and then + raising it to their `min_size` (`src/aui/framemanager.cpp:2748-2848`); a dock with a resizable pane + keeps that size (`2674-2677`), and resizing the managed window only re-lays the docks out + (`4542-4546`). A pane first shown before its managed window is laid out — a `wxDefaultSize` window is + 20×20 until its first sizer layout (`references/sizers-layout.md`) — docks at that width or its + `min_size` and stays there. Hiding a dock's last shown pane empties it, and the next `Update()` + removes it (`2733-2738`) with any `dock_size` a `LoadPerspective` restored, so the pane comes back + at its `best_size`. - **Names** [source]. A duplicate `Name()` hits `wxFAIL` (silent in Orca); duplicate and empty names get a random identifier (`src/aui/framemanager.cpp:949-1010`), which `LoadPerspective` can never match. `AddPane` rejects a null window, but its "already managed" check looks up `paneInfo.window` @@ -983,7 +994,9 @@ Plater (Prepare and Preview); `DesignPanel::m_aui` manages the Design tab's body takes `AuiMgr::sidebar_pane_info()`; the layout has its own app-config key, is reset from `Plater::reset_window_layout`, and is saved by a `shutdown()` called from `MainFrame::shutdown`, which also detaches a floating pane (Lifetime below). Where floating is disabled it forces - `Dock().Floatable(false)` after loading, as plugin panes do. `DesignPanel` is the model + `Dock().Floatable(false)` after loading, as plugin panes do. A `LazyPage` builds its panel at 20×20 + and lays it out only as the tab shows, so the sidebar stays hidden until the tab is first shown (Dock + size above). `DesignPanel` is the model (`docs/HLSD/design-tab.md`). A `GLCanvas3D` beside such a sidebar gets that sidebar's collapse button with `set_collapse_toolbar`; without it the canvas falls back to the Plater's button, which collapses Prepare's sidebar. diff --git a/src/slic3r/GUI/CAD/DesignPanel.cpp b/src/slic3r/GUI/CAD/DesignPanel.cpp index e4335e18e1..617699b376 100644 --- a/src/slic3r/GUI/CAD/DesignPanel.cpp +++ b/src/slic3r/GUI/CAD/DesignPanel.cpp @@ -7255,6 +7255,7 @@ void DesignPanel::on_tab_shown() update_reference_planes(); // entering the Design tab: show the XY/XZ/YZ planes if no object yet if (show_clock.Time() > 100) // a slow first show is what users report; the usual one is not news BOOST_LOG_TRIVIAL(info) << "Design tab shown: bed, project recipe and planes in " << show_clock.Time() << " ms"; + m_laid_out = true; update_sidebar_pane(); if (m_viewport) m_viewport->force_repaint(); // the page was just re-shown: paint it for real } @@ -7414,12 +7415,14 @@ void DesignPanel::collapse_sidebar(bool collapse) update_sidebar_pane(); } -// The sidebar shows unless collapsed; a floating one also only while the tab is shown, since it is +// The sidebar shows unless collapsed, and not before the tab is first shown: wxAUI caps a new dock at +// the managed panel's width at that Update() and the dock keeps that size, while the panel is 20 px +// wide until the page lays it out. A floating one also shows only while the tab is shown, since it is // a top-level window and does not hide with the page. void DesignPanel::update_sidebar_pane(bool force_update) { wxAuiPaneInfo& sidebar = m_aui.GetPane(m_form); - const bool show = !m_sidebar_collapsed && (sidebar.IsDocked() || IsShownOnScreen()); + const bool show = !m_sidebar_collapsed && m_laid_out && (sidebar.IsDocked() || IsShownOnScreen()); if (sidebar.IsOk() && sidebar.IsShown() != show) { sidebar.Show(show); force_update = true; diff --git a/src/slic3r/GUI/CAD/DesignPanel.hpp b/src/slic3r/GUI/CAD/DesignPanel.hpp index 4c7bc643ac..0cf670c191 100644 --- a/src/slic3r/GUI/CAD/DesignPanel.hpp +++ b/src/slic3r/GUI/CAD/DesignPanel.hpp @@ -506,6 +506,7 @@ private: AuiMgr m_aui; wxString m_default_layout; bool m_sidebar_collapsed{false}; + bool m_laid_out{false}; // the tab has been shown, so the panel has its size void load_window_layout(); void load_default_layout(); void collapse_sidebar(bool collapse);