forked from 1b-agent/opencadstudio-upstream
feat(ui): right-edge side toolbar; drop the paper-space ribbon tab
Switching to a paper layout used to hijack the ribbon with a contextual "Layout" tab. Replace that with a reusable right-edge vertical toolbar: a single centred column of icon buttons floated over the canvas, built from a flat ToolDef list and dispatching through the existing RibbonToolClick path (ui::side_toolbar). Paper space now shows Viewport / Page Setup / Export PDF there and leaves the ribbon on the user's tab; the contextual layout tab and its three auto-switch hooks are removed. The toolbar is generic infrastructure for future context action sets. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
c9071579a2
commit
71837895b0
6 files changed
+145
-17
No files matched your search
+3
-16
@@ -5005,13 +5005,9 @@ impl OpenCADStudio {
|
||||
self.tabs[i].scene.deselect_all();
|
||||
self.tabs[i].scene.restore_saved_camera();
|
||||
self.tabs[i].last_synced_camera_gen = self.tabs[i].scene.camera_generation;
|
||||
if going_to_paper {
|
||||
if let Some(idx) = self.ribbon.layout_module_index() {
|
||||
self.ribbon.select(idx);
|
||||
}
|
||||
} else if self.ribbon.active_is_layout() {
|
||||
self.ribbon.select(0);
|
||||
}
|
||||
// Paper-space tools live in the right-edge side toolbar now, so
|
||||
// entering/leaving a layout no longer hijacks the ribbon tab.
|
||||
let _ = going_to_paper;
|
||||
// Refresh VP freeze columns for the new layout.
|
||||
let doc_layers = self.tabs[i].scene.document.layers.clone();
|
||||
let vp_info = self.tabs[i].scene.viewport_list();
|
||||
@@ -5054,9 +5050,6 @@ impl OpenCADStudio {
|
||||
self.tabs[i].scene.ensure_sheet_viewport(&new_name);
|
||||
self.tabs[i].scene.deselect_all();
|
||||
self.tabs[i].scene.fit_all();
|
||||
if let Some(idx) = self.ribbon.layout_module_index() {
|
||||
self.ribbon.select(idx);
|
||||
}
|
||||
self.command_line.push_output(&format!(
|
||||
"Layout \"{new_name}\" created — use MVIEW to add a viewport"
|
||||
));
|
||||
@@ -5075,12 +5068,6 @@ impl OpenCADStudio {
|
||||
if self.tabs[i].scene.delete_layout(&name) {
|
||||
self.layout_context_menu = None;
|
||||
self.layout_rename_state = None;
|
||||
// If we fell back to Model space, update ribbon.
|
||||
if self.tabs[i].scene.current_layout == "Model"
|
||||
&& self.ribbon.active_is_layout()
|
||||
{
|
||||
self.ribbon.select(0);
|
||||
}
|
||||
self.command_line
|
||||
.push_output(&format!("Layout \"{name}\" silindi"));
|
||||
self.tabs[i].dirty = true;
|
||||
|
||||
@@ -1119,6 +1119,16 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
// Paper-space context actions: a right-edge vertical toolbar
|
||||
// (viewport / page setup / plot) instead of a contextual ribbon tab.
|
||||
if is_paper && !tab.is_start {
|
||||
if let Some(tb) = crate::ui::side_toolbar::view(
|
||||
&crate::modules::layout::paper_space_tools(),
|
||||
) {
|
||||
viewport_stack = viewport_stack.push(tb);
|
||||
}
|
||||
}
|
||||
|
||||
// Quick Properties: compact floating property panel on selection,
|
||||
// anchored at the canvas top-left so it doesn't track the cursor.
|
||||
if self.quick_properties && !tab.is_start {
|
||||
|
||||
Reference in new issue
Block a user