forked from 1b-agent/opencadstudio-upstream
Merge pull request #1756 from ramox81/codex/xref-fade-setting
XDWGFADECTL: ask again after an invalid value and keep it in the profile
This commit is contained in:
commit
d0dddb03cb
3 files changed
+18
-5
No files matched your search
@@ -1350,9 +1350,15 @@ impl OpenCADStudio {
|
||||
if let Some(value) = &value {
|
||||
match value.parse::<i32>().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!(
|
||||
@@ -4521,11 +4527,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();
|
||||
|
||||
@@ -423,6 +423,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.
|
||||
@@ -853,6 +855,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,
|
||||
|
||||
@@ -796,6 +796,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(),
|
||||
@@ -916,6 +917,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);
|
||||
|
||||
Reference in new issue
Block a user