Add Graphic Attributes palette toggle and persistence

This commit is contained in:
Marcel committed 2026-09-29 21:34:31 +02:00
1 parent 3b74c7e7ea
commit 3e45331de1
14 files changed
+220 -71

No files matched your search

+15
View File
@@ -30,6 +30,8 @@ pub struct AppConfig {
/// General edge-stack dock layout (which panels are docked, side, order,
/// width and auto-collapse) for the Properties panel and block palette.
pub dock: crate::ui::dock::DockState,
/// Whether the optional Graphic Attributes palette is visible.
pub show_graphic_attributes: bool,
/// Add a newly selected annotation scale to existing annotative objects.
pub annotation_auto_scale: i8,
/// Ribbon collapse density.
@@ -52,6 +54,7 @@ impl Default for AppConfig {
start: StartConfig::default(),
statusbar: StatusBarConfig::default(),
dock: crate::ui::dock::DockState::default(),
show_graphic_attributes: false,
annotation_auto_scale: -4,
ribbon: RibbonConfig::default(),
plot: PlotDialogState::default(),
@@ -601,6 +604,18 @@ mod tests {
assert_eq!(deserialized.model_space.selection_window_color, 5);
}
#[test]
fn graphic_attributes_visibility_defaults_off_and_round_trips() {
let missing: AppConfig = serde_json::from_str("{}").expect("deserialize old config");
assert!(!missing.show_graphic_attributes);
let mut original = AppConfig::default();
original.show_graphic_attributes = true;
let serialized = serde_json::to_string(&original).expect("serialize config");
let restored: AppConfig = serde_json::from_str(&serialized).expect("deserialize config");
assert!(restored.show_graphic_attributes);
}
#[test]
fn test_parse_theme_name() {
assert_eq!(parse_theme_name("light"), Some(iced::Theme::Light));