From 4b7fb4052963d2a7f0f6e090848a1a7c412a383e Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Tue, 13 Oct 2026 15:27:22 +0300 Subject: [PATCH] XDWGFADECTL: ask again after an invalid value, keep it in the profile Co-Authored-By: Claude Opus 5.5 --- src/app/commands/styleprops.rs | 17 ++++++++++++----- src/app/settings.rs | 3 +++ src/app/update/file.rs | 3 +++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/app/commands/styleprops.rs b/src/app/commands/styleprops.rs index c556efa81..c12790896 100644 --- a/src/app/commands/styleprops.rs +++ b/src/app/commands/styleprops.rs @@ -1347,9 +1347,15 @@ impl OpenCADStudio { if let Some(value) = &value { match value.parse::().ok().filter(|v| (-90..=90).contains(v)) { Some(fade) => self.set_xref_fade(fade), - None => self - .command_line - .push_error("Requires an integer between -90 and 90."), + // Refused: say why and ask again. + None => { + self.command_line + .push_error("Requires an integer between -90 and 90."); + self.command_line.push_output(&format!( + "Enter new value for XDWGFADECTL <{current}>:" + )); + self.pending_setvar = Some(name.clone()); + } } } else { self.command_line.push_output(&format!( @@ -4441,11 +4447,12 @@ mod scale_validation_tests { } impl OpenCADStudio { - /// XDWGFADECTL: store it, show it on the ribbon and redraw every tab's - /// referenced drawings. + /// XDWGFADECTL: store it in the profile, show it on the ribbon and redraw + /// every tab's referenced drawings. pub(in crate::app) fn set_xref_fade(&mut self, fade: i32) { crate::scene::cache::block_cache::set_xref_fade_ctl(fade); self.ribbon.xref_fade = crate::scene::cache::block_cache::xref_fade_ctl(); + self.save_config(); for tab in &mut self.tabs { if !tab.is_start { tab.scene.recolor_meshes(); diff --git a/src/app/settings.rs b/src/app/settings.rs index 960a2a54c..e56c2c2dd 100644 --- a/src/app/settings.rs +++ b/src/app/settings.rs @@ -417,6 +417,8 @@ pub struct UserSettings { pub attdef_on_screen: bool, /// FIELDDISPLAY: fields show on a gray background. pub field_display: bool, + /// XDWGFADECTL: how much referenced drawings fade (-90..=90; negative is off). + pub xref_fade: i32, /// SURFACEASSOCIATIVITY: new surfaces stay associative to their sources. pub surface_associativity: bool, /// UCSORTHO: an orthographic view preset also sets its orthographic UCS. @@ -842,6 +844,7 @@ impl Default for UserSettings { image_frame: 1, attdef_on_screen: true, field_display: true, + xref_fade: 50, surface_associativity: true, ucs_ortho: true, ucs_view: true, diff --git a/src/app/update/file.rs b/src/app/update/file.rs index 9d78560ef..5a4f6d0a4 100644 --- a/src/app/update/file.rs +++ b/src/app/update/file.rs @@ -793,6 +793,7 @@ impl OpenCADStudio { image_frame: crate::scene::frame::profile_image_mode(), attdef_on_screen: crate::modules::draw::draw::attdef::session().on_screen, field_display: crate::entities::field::display(), + xref_fade: crate::scene::cache::block_cache::xref_fade_ctl(), surface_associativity: crate::scene::model::sweep_model::surface_associativity(), ucs_ortho: crate::modules::view::view_cmd::ucs_ortho(), ucs_view: crate::modules::view::view_cmd::ucs_view(), @@ -909,6 +910,8 @@ impl OpenCADStudio { crate::scene::frame::set_profile_image_mode(s.image_frame); crate::modules::draw::draw::attdef::session().on_screen = s.attdef_on_screen; crate::entities::field::set_display(s.field_display); + crate::scene::cache::block_cache::set_xref_fade_ctl(s.xref_fade); + self.ribbon.xref_fade = crate::scene::cache::block_cache::xref_fade_ctl(); crate::scene::model::sweep_model::set_surface_associativity(s.surface_associativity); crate::modules::view::view_cmd::set_ucs_ortho(s.ucs_ortho); crate::modules::view::view_cmd::set_ucs_view(s.ucs_view);