forked from 1b-agent/opencadstudio-upstream
feat(block-editor): add functional Visibility ribbon controls
Add the current-state selector, Visibility States dialog and mode/show/hide controls to the contextual ribbon, using shared icons, tooltips, modal UI and adaptive flyouts. Disable the controls until a Visibility parameter exists. Stage state creation, rename, deletion, current-state changes and reordering until OK. Support copied, show-all and hide-all new states in one undo step, preserve native graph metadata, and restore current-state identity on undo/redo. Implement nonsaved BVMODE and display-only reveal during BVSHOW selection. Cancelling selection leaves saved visibility flags and history unchanged. Keep the existing command-line state workflows available. Validation: 6 targeted tests; 277 block, 31 app dock, 35 ribbon and 12 history checks passed (overlapping filters). All 17 local DWG fixtures passed in-memory DWG/DXF preservation checks with unchanged original checksums.
This commit is contained in:
1 parent
308990e672
commit
daa26007f9
24 files changed
+1341
-34
No files matched your search
@@ -94,6 +94,41 @@ impl CadModule for BlockEditorModule {
|
||||
),
|
||||
);
|
||||
}
|
||||
groups.push(RibbonGroup {
|
||||
title: "Visibility",
|
||||
tools: vec![
|
||||
RibbonItem::LargeTool(ToolDef {
|
||||
id: "BVSTATE_MANAGER",
|
||||
label: "Visibility States",
|
||||
icon: IconKind::Svg(include_bytes!("../../../assets/icons/ui/list.svg")),
|
||||
event: ModuleEvent::Command("BVSTATE DIALOG".into()),
|
||||
}),
|
||||
RibbonItem::Tool(ToolDef {
|
||||
id: "BVMODE_TOGGLE",
|
||||
label: "Visibility Mode",
|
||||
icon: IconKind::Svg(include_bytes!(
|
||||
"../../../assets/icons/constrain/show_all.svg"
|
||||
)),
|
||||
event: ModuleEvent::Command("BVMODE TOGGLE".into()),
|
||||
}),
|
||||
RibbonItem::Tool(ToolDef {
|
||||
id: "BVSHOW",
|
||||
label: "Make Visible",
|
||||
icon: IconKind::Svg(include_bytes!(
|
||||
"../../../assets/icons/constrain/show.svg"
|
||||
)),
|
||||
event: ModuleEvent::Command("BVSHOW".into()),
|
||||
}),
|
||||
RibbonItem::Tool(ToolDef {
|
||||
id: "BVHIDE",
|
||||
label: "Make Invisible",
|
||||
icon: IconKind::Svg(include_bytes!(
|
||||
"../../../assets/icons/constrain/hide_all.svg"
|
||||
)),
|
||||
event: ModuleEvent::Command("BVHIDE".into()),
|
||||
}),
|
||||
],
|
||||
});
|
||||
groups
|
||||
})
|
||||
}
|
||||
|
||||
@@ -66,7 +66,8 @@ impl CadCommand for BvStateCommand {
|
||||
fn prompt(&self) -> String {
|
||||
match &self.step {
|
||||
Step::Option => {
|
||||
crate::t!("BVSTATE Enter an option [New/Set/Rename/Delete] <Set>:").into_owned()
|
||||
crate::t!("BVSTATE Enter an option [New/Set/Rename/Delete/Dialog] <Set>:")
|
||||
.into_owned()
|
||||
}
|
||||
Step::NewName => crate::t!("BVSTATE Enter name of new visibility state:").into_owned(),
|
||||
Step::SetName => crate::tf!(
|
||||
@@ -93,6 +94,7 @@ impl CadCommand for BvStateCommand {
|
||||
CmdOption::new(crate::t!("Set").as_ref(), "S"),
|
||||
CmdOption::new(crate::t!("Rename").as_ref(), "R"),
|
||||
CmdOption::new(crate::t!("Delete").as_ref(), "D"),
|
||||
CmdOption::new(crate::t!("Dialog").as_ref(), "DIALOG"),
|
||||
],
|
||||
_ => Vec::new(),
|
||||
}
|
||||
@@ -114,6 +116,7 @@ impl CadCommand for BvStateCommand {
|
||||
match &self.step {
|
||||
Step::Option => {
|
||||
self.step = match text.trim_start_matches('_').to_ascii_uppercase().as_str() {
|
||||
"DIALOG" => return Some(CmdResult::Dispatch("BVSTATE DIALOG".into())),
|
||||
"N" | "NEW" => Step::NewName,
|
||||
"" | "S" | "SET" => Step::SetName,
|
||||
"R" | "RENAME" => Step::RenameFrom,
|
||||
@@ -196,5 +199,5 @@ impl CadCommand for BvStateCommand {
|
||||
}
|
||||
|
||||
inventory::submit!(crate::command::CommandRegistration {
|
||||
names: &["BVSTATE", "BVHIDE", "BVSHOW"]
|
||||
names: &["BVSTATE", "BVHIDE", "BVSHOW", "BVMODE"]
|
||||
});
|
||||
@@ -177,6 +177,10 @@ impl SelectObjectsCommand {
|
||||
}
|
||||
|
||||
impl CadCommand for SelectObjectsCommand {
|
||||
fn reveals_hidden_block_objects(&self) -> bool {
|
||||
self.pending_cmd == "_BVSHOW"
|
||||
}
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"SELECT"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user