Make the Design tab sidebar dockable and collapsible like Prepare's

The sidebar can move to either side, float, be resized, and collapse with
the canvas button or Shift+Tab. Its layout is remembered separately from
Prepare's, starts where Prepare's sidebar is, and View > Reset Window
Layout resets both tabs.
This commit is contained in:
SoftFever committed 2026-10-03 19:05:53 +08:00
1 parent a9c8721380
commit d47fb804c3
17 files changed
+420 -164

No files matched your search

+14 -1
View File
@@ -21,6 +21,7 @@
#include "libslic3r/CAD/CadDocument.hpp"
#include "slic3r/GUI/CAD/DesignInteraction.hpp" // CadLevel: what one Esc press means
#include "slic3r/GUI/AuiMgr.hpp"
#include "slic3r/GUI/Lazy.hpp"
class ComboBox; // Orca dropdown (Widgets/ComboBox.hpp) — replaces wxChoice everywhere here
@@ -70,6 +71,8 @@ public:
void on_sys_color_changed();
void unbind_canvas_event_handlers(); // app close / language switch, from the plater's teardown
void reset_canvas_volumes();
void shutdown(); // app close / language switch, from MainFrame: save the window layout
void reset_window_layout(); // View > Reset Window Layout, with Prepare's
void clear_document(); // New Project / Open Project: drop the document with the project
// Rebuild off the UI thread (progress dialog only if it turns out to be slow), so a feature
// op on a heavy imported solid does not freeze the window. Returns m_doc.recompute()'s result.
@@ -497,6 +500,17 @@ private:
wxScrolledWindow* m_form{nullptr};
DesignCanvas* m_viewport{nullptr};
// Below the toolbar, m_form docks beside the viewport column like Prepare's sidebar: it can
// move to the other side, float, be resized and be collapsed, and the layout is kept between
// sessions.
AuiMgr m_aui;
wxString m_default_layout;
bool m_sidebar_collapsed{false};
void load_window_layout();
void load_default_layout();
void collapse_sidebar(bool collapse);
void update_sidebar_pane(bool force_update = false);
// Top contextual toolbar (parented to the panel, above the form/viewport row).
UiMode m_ui_mode{UiMode::Feature};
// Sketch environment banner: a strip across the top of the viewport saying, in words, that
@@ -938,7 +952,6 @@ private:
int tree_selection() const; // selected feature row, or wxNOT_FOUND
int tree_body_selection() const; // selected Parts-list body index, or -1
void refresh_parts(); // rebuild the Bodies list under the feature tree
void sync_sidebar_width(); // keep the panel as wide as Prepare's sidebar
void set_tree_selection(int row);
static int tree_icon_for(CadFeatureType t);