forked from 1b-agent/opencadstudio-upstream
Merge pull request #1755 from ramox81/codex/external-references-close
External References palette: open/close commands, ERSTATE and reference aliases
This commit is contained in:
commit
7f143d5be2
5 files changed
+31
-14
No files matched your search
@@ -71,6 +71,9 @@ BE, *BEDIT
|
|||||||
IAT, *IMAGEATTACH
|
IAT, *IMAGEATTACH
|
||||||
XA, *XATTACH
|
XA, *XATTACH
|
||||||
XR, *XREF
|
XR, *XREF
|
||||||
|
-XR, *-XREF
|
||||||
|
XC, *XCLIP
|
||||||
|
ICL, *IMAGECLIP
|
||||||
ADC, *ADCENTER
|
ADC, *ADCENTER
|
||||||
W, *WBLOCK
|
W, *WBLOCK
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -80,7 +80,7 @@ const WEB_ALIAS_KEY: &str = "opencadstudio.aliases";
|
|||||||
/// migrated forward (see `introduced_at` / `migrate_aliases`). Version 1 shipped
|
/// migrated forward (see `introduced_at` / `migrate_aliases`). Version 1 shipped
|
||||||
/// the pre-REDRAW table; version 2 introduced the REDRAW-family aliases; version 3
|
/// the pre-REDRAW table; version 2 introduced the REDRAW-family aliases; version 3
|
||||||
/// introduced HB (HATCHTOBACK); version 4 introduced ER (EXTERNALREFERENCES).
|
/// introduced HB (HATCHTOBACK); version 4 introduced ER (EXTERNALREFERENCES).
|
||||||
const DEFAULT_ALIASES_VERSION: u32 = 7;
|
const DEFAULT_ALIASES_VERSION: u32 = 8;
|
||||||
|
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
const WEB_ALIAS_VERSION_KEY: &str = "opencadstudio.aliases.version";
|
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")],
|
5 => &[("-ATT", "-ATTDEF")],
|
||||||
6 => &[("VV", "QLAYER")],
|
6 => &[("VV", "QLAYER")],
|
||||||
7 => &[("DV", "DVIEW")],
|
7 => &[("DV", "DVIEW")],
|
||||||
|
8 => &[("-XR", "-XREF"), ("XC", "XCLIP"), ("ICL", "IMAGECLIP")],
|
||||||
_ => &[],
|
_ => &[],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -990,17 +990,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
|
// (XREFMAN was a provisional name and is not kept, not even as an
|
||||||
// alias.) The XREF command below is untouched.
|
// alias.) The XREF command below is untouched.
|
||||||
"EXTERNALREFERENCES" => {
|
"EXTERNALREFERENCES" => {
|
||||||
self.show_external_references ^= true;
|
self.show_external_references = true;
|
||||||
if self.show_external_references {
|
// Always open expanded so the panel is immediately usable;
|
||||||
// Always open expanded so the panel is immediately usable;
|
// dock it on the right if the user closed it from the layout.
|
||||||
// dock it on the right if the user closed it from the layout.
|
self.dock_open_at_default(crate::ui::dock::PanelId::ExternalReferences);
|
||||||
self.dock_open_at_default(crate::ui::dock::PanelId::ExternalReferences);
|
self.refresh_xref_manager();
|
||||||
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")
|
cmd if cmd.eq_ignore_ascii_case("XREF")
|
||||||
|
|||||||
@@ -824,6 +824,8 @@ inventory::submit!(crate::command::CommandRegistration {
|
|||||||
"EXPORTSTEP",
|
"EXPORTSTEP",
|
||||||
"EXPORTSTL",
|
"EXPORTSTL",
|
||||||
"EXTERNALREFERENCES",
|
"EXTERNALREFERENCES",
|
||||||
|
"EXTERNALREFERENCESCLOSE",
|
||||||
|
"ERSTATE",
|
||||||
"POINTCLOUDMANAGER",
|
"POINTCLOUDMANAGER",
|
||||||
"POINTCLOUDMANAGERCLOSE",
|
"POINTCLOUDMANAGERCLOSE",
|
||||||
"EXTRIM",
|
"EXTRIM",
|
||||||
|
|||||||
@@ -311,7 +311,8 @@ pub(super) fn group_title<'a>(
|
|||||||
if panel.id != REFERENCE_PANEL_ID {
|
if panel.id != REFERENCE_PANEL_ID {
|
||||||
return title_button;
|
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(
|
let launcher = tooltip(
|
||||||
// A right arrow turned to point into the corner.
|
// A right arrow turned to point into the corner.
|
||||||
button(
|
button(
|
||||||
@@ -323,10 +324,7 @@ pub(super) fn group_title<'a>(
|
|||||||
color: Some(theme.palette().background.base.text),
|
color: Some(theme.palette().background.base.text),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.on_press(Message::RibbonToolClick {
|
.on_press(Message::ToggleXrefManager)
|
||||||
tool_id: "EXTERNALREFERENCES".to_string(),
|
|
||||||
event: crate::modules::ModuleEvent::Command("EXTERNALREFERENCES".to_string()),
|
|
||||||
})
|
|
||||||
.style(move |theme: &Theme, status| tool_btn_style(theme, false, status))
|
.style(move |theme: &Theme, status| tool_btn_style(theme, false, status))
|
||||||
.padding([0, 3]),
|
.padding([0, 3]),
|
||||||
make_tip(format!(
|
make_tip(format!(
|
||||||
|
|||||||
Reference in new issue
Block a user