feat(config): persist general edge-stack dock layout

This commit is contained in:
Karim Jerbi committed 2026-08-11 23:13:05 +01:00
1 parent 20be91ccaa
commit dce555f5bc
3 files changed
+16

No files matched your search

+5
View File
@@ -29,6 +29,10 @@ pub struct AppConfig {
pub statusbar: StatusBarConfig,
/// Dock position, width and auto-collapse behavior of the Properties panel.
pub properties: PropertiesDockConfig,
/// General edge-stack dock layout (which panels are docked, side, order,
/// width and auto-collapse). Newer dock state; the Properties dock is
/// folded into this when its panel is migrated.
pub dock: crate::ui::dock::DockState,
/// Add a newly selected annotation scale to existing annotative objects.
pub annotation_auto_scale: i8,
/// Ribbon collapse density.
@@ -49,6 +53,7 @@ impl Default for AppConfig {
start: StartConfig::default(),
statusbar: StatusBarConfig::default(),
properties: PropertiesDockConfig::default(),
dock: crate::ui::dock::DockState::default(),
annotation_auto_scale: -4,
ribbon: RibbonConfig::default(),
plot: PlotDialogState::default(),
+3
View File
@@ -591,6 +591,8 @@ pub(super) struct OpenCADStudio {
show_properties: bool,
/// Docked Insert Block panel visibility.
pub(crate) show_block_palette: bool,
/// General edge-stack dock layout for the side panels.
pub(crate) dock: crate::ui::dock::DockState,
/// Docked Insert Block panel state (search, preview size, cached thumbnails).
pub(crate) block_palette: crate::ui::window::block_palette::BlockPalette,
/// Whether the narrow-window block-palette bar is expanded.
@@ -3159,6 +3161,7 @@ impl OpenCADStudio {
show_block_palette: false,
block_palette: Default::default(),
block_palette_expanded: false,
dock: Default::default(),
show_file_tabs: true,
show_layout_tabs: true,
last_point: None,
+8
View File
@@ -558,6 +558,11 @@ impl OpenCADStudio {
width: self.properties_width,
auto_collapse: self.properties_auto_collapse,
},
dock: {
let mut dock = self.dock.clone();
dock.ensure_settings();
dock
},
annotation_auto_scale: self.annotation_auto_scale,
ribbon: crate::app::config::RibbonConfig {
collapse: self.ribbon.collapse_mode(),
@@ -602,6 +607,9 @@ impl OpenCADStudio {
250.0
};
self.properties_auto_collapse = cfg.properties.auto_collapse;
let mut dock = cfg.dock;
dock.ensure_settings();
self.dock = dock;
self.annotation_auto_scale = cfg.annotation_auto_scale.clamp(-4, 4);
self.ribbon.set_collapse_mode(cfg.ribbon.collapse);
self.plot_dialog = cfg.plot;