diff --git a/assets/ocad.pgp b/assets/ocad.pgp index 78aa32244..54f24f703 100644 --- a/assets/ocad.pgp +++ b/assets/ocad.pgp @@ -71,6 +71,9 @@ BE, *BEDIT IAT, *IMAGEATTACH XA, *XATTACH XR, *XREF +-XR, *-XREF +XC, *XCLIP +ICL, *IMAGECLIP ADC, *ADCENTER W, *WBLOCK diff --git a/src/app/alias.rs b/src/app/alias.rs index f6db65401..09112798a 100644 --- a/src/app/alias.rs +++ b/src/app/alias.rs @@ -80,7 +80,7 @@ const WEB_ALIAS_KEY: &str = "opencadstudio.aliases"; /// migrated forward (see `introduced_at` / `migrate_aliases`). Version 1 shipped /// the pre-REDRAW table; version 2 introduced the REDRAW-family aliases; version 3 /// introduced HB (HATCHTOBACK); version 4 introduced ER (EXTERNALREFERENCES). -const DEFAULT_ALIASES_VERSION: u32 = 7; +const DEFAULT_ALIASES_VERSION: u32 = 8; #[cfg(target_arch = "wasm32")] const WEB_ALIAS_VERSION_KEY: &str = "opencadstudio.aliases.version"; @@ -102,6 +102,7 @@ fn introduced_at(version: u32) -> &'static [(&'static str, &'static str)] { 5 => &[("-ATT", "-ATTDEF")], 6 => &[("VV", "QLAYER")], 7 => &[("DV", "DVIEW")], + 8 => &[("-XR", "-XREF"), ("XC", "XCLIP"), ("ICL", "IMAGECLIP")], _ => &[], } } diff --git a/src/app/commands/blocks.rs b/src/app/commands/blocks.rs index b9a74490b..7bf4e2c44 100644 --- a/src/app/commands/blocks.rs +++ b/src/app/commands/blocks.rs @@ -951,17 +951,30 @@ impl OpenCADStudio { } } - // EXTERNALREFERENCES — toggle the docked External References panel. + // EXTERNALREFERENCES opens the docked External References panel + // (an open one stays open); EXTERNALREFERENCESCLOSE closes it. // (XREFMAN was a provisional name and is not kept, not even as an // alias.) The XREF command below is untouched. "EXTERNALREFERENCES" => { - self.show_external_references ^= true; - if self.show_external_references { - // Always open expanded so the panel is immediately usable; - // dock it on the right if the user closed it from the layout. - self.dock_open_at_default(crate::ui::dock::PanelId::ExternalReferences); - self.refresh_xref_manager(); - } + self.show_external_references = true; + // Always open expanded so the panel is immediately usable; + // dock it on the right if the user closed it from the layout. + self.dock_open_at_default(crate::ui::dock::PanelId::ExternalReferences); + self.refresh_xref_manager(); + } + "EXTERNALREFERENCESCLOSE" => self.show_external_references = false, + // ERSTATE (read only): whether the panel is open. + cmd if cmd + .strip_prefix("SETVAR ") + .unwrap_or(cmd) + .split_whitespace() + .next() + .is_some_and(|name| name.eq_ignore_ascii_case("ERSTATE")) => + { + self.command_line.push_output(&format!( + "ERSTATE = {} (read only)", + u8::from(self.show_external_references) + )); } cmd if cmd.eq_ignore_ascii_case("XREF") diff --git a/src/app/commands/mod.rs b/src/app/commands/mod.rs index ba82aeeba..7fa3919e6 100644 --- a/src/app/commands/mod.rs +++ b/src/app/commands/mod.rs @@ -819,6 +819,8 @@ inventory::submit!(crate::command::CommandRegistration { "EXPORTSTEP", "EXPORTSTL", "EXTERNALREFERENCES", + "EXTERNALREFERENCESCLOSE", + "ERSTATE", "POINTCLOUDMANAGER", "POINTCLOUDMANAGERCLOSE", "EXTRIM", diff --git a/src/ui/ribbon/draw_panel.rs b/src/ui/ribbon/draw_panel.rs index a140ac1d4..daf71a345 100644 --- a/src/ui/ribbon/draw_panel.rs +++ b/src/ui/ribbon/draw_panel.rs @@ -311,7 +311,8 @@ pub(super) fn group_title<'a>( if panel.id != REFERENCE_PANEL_ID { return title_button; } - // The corner arrow opens the External References palette. + // The corner arrow opens the External References palette, or closes it + // when it is open. let launcher = tooltip( // A right arrow turned to point into the corner. button( @@ -323,10 +324,7 @@ pub(super) fn group_title<'a>( color: Some(theme.palette().background.base.text), }), ) - .on_press(Message::RibbonToolClick { - tool_id: "EXTERNALREFERENCES".to_string(), - event: crate::modules::ModuleEvent::Command("EXTERNALREFERENCES".to_string()), - }) + .on_press(Message::ToggleXrefManager) .style(move |theme: &Theme, status| tool_btn_style(theme, false, status)) .padding([0, 3]), make_tip(format!(