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
@@ -216,6 +216,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
let selected: Vec<Handle> = self.tabs[i].scene.selected.iter().copied().collect();
|
||||
let delta = DeltaSnapshot {
|
||||
visibility_states: None,
|
||||
entities,
|
||||
current_layout_before: self.tabs[i].scene.current_layout.clone(),
|
||||
current_layout_after: self.tabs[i].scene.current_layout.clone(),
|
||||
@@ -346,7 +347,11 @@ impl OpenCADStudio {
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
let visibility_after = self.tabs[i].scene.visibility_states.clone();
|
||||
let visibility_states = (pending.visibility_states_before != visibility_after)
|
||||
.then_some((pending.visibility_states_before, visibility_after));
|
||||
if !pending.keep_empty
|
||||
&& visibility_states.is_none()
|
||||
&& entities.is_empty()
|
||||
&& reference_designations.is_empty()
|
||||
&& !structure_changed
|
||||
@@ -357,6 +362,7 @@ impl OpenCADStudio {
|
||||
return;
|
||||
}
|
||||
let delta = DeltaSnapshot {
|
||||
visibility_states,
|
||||
entities,
|
||||
current_layout_before: pending.current_layout,
|
||||
current_layout_after: self.tabs[i].scene.current_layout.clone(),
|
||||
@@ -403,6 +409,7 @@ impl OpenCADStudio {
|
||||
let structure_before = self.tabs[i].scene.document.snapshot_structure();
|
||||
let recorder = self.tabs[i].scene.document.begin_entity_change_recording();
|
||||
self.tabs[i].history.pending = Some(PendingHistorySnapshot {
|
||||
visibility_states_before: self.tabs[i].scene.visibility_states.clone(),
|
||||
label,
|
||||
current_layout,
|
||||
active_layer: self.tabs[i].active_layer.clone(),
|
||||
@@ -514,6 +521,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
let selected_after = self.tabs[i].scene.selected.iter().copied().collect();
|
||||
let delta = DeltaSnapshot {
|
||||
visibility_states: None,
|
||||
entities: Vec::new(),
|
||||
current_layout_before: pending.current_layout,
|
||||
current_layout_after: self.tabs[i].scene.current_layout.clone(),
|
||||
@@ -572,6 +580,7 @@ impl OpenCADStudio {
|
||||
return;
|
||||
}
|
||||
let delta = DeltaSnapshot {
|
||||
visibility_states: None,
|
||||
entities: Vec::new(),
|
||||
current_layout_before: pending.current_layout,
|
||||
current_layout_after: self.tabs[i].scene.current_layout.clone(),
|
||||
@@ -630,6 +639,7 @@ impl OpenCADStudio {
|
||||
return;
|
||||
}
|
||||
let delta = DeltaSnapshot {
|
||||
visibility_states: None,
|
||||
entities: Vec::new(),
|
||||
current_layout_before: pending.current_layout,
|
||||
current_layout_after: self.tabs[i].scene.current_layout.clone(),
|
||||
@@ -696,6 +706,7 @@ impl OpenCADStudio {
|
||||
return;
|
||||
}
|
||||
let delta = DeltaSnapshot {
|
||||
visibility_states: None,
|
||||
entities: Vec::new(),
|
||||
current_layout_before: pending.current_layout,
|
||||
current_layout_after: self.tabs[i].scene.current_layout.clone(),
|
||||
@@ -726,6 +737,7 @@ impl OpenCADStudio {
|
||||
self.finish_pending_history(i);
|
||||
let (text_names, dim_names, object_handles) = after.changed_keys(&before);
|
||||
let delta = DeltaSnapshot {
|
||||
visibility_states: None,
|
||||
entities: Vec::new(),
|
||||
current_layout_before: self.tabs[i].scene.current_layout.clone(),
|
||||
current_layout_after: self.tabs[i].scene.current_layout.clone(),
|
||||
@@ -932,6 +944,7 @@ impl OpenCADStudio {
|
||||
structure = Some(StructureSnapshot::Objects(objects));
|
||||
}
|
||||
let delta = DeltaSnapshot {
|
||||
visibility_states: None,
|
||||
entities,
|
||||
current_layout_before: pending.current_layout,
|
||||
current_layout_after: self.tabs[i].scene.current_layout.clone(),
|
||||
@@ -1131,6 +1144,10 @@ impl OpenCADStudio {
|
||||
let value = if undo { &entry.before } else { &entry.after };
|
||||
*scene.parametric_constraint_set_mut(entry.scope) = value.clone();
|
||||
}
|
||||
if let Some((before, after)) = &d.visibility_states {
|
||||
scene.visibility_states = if undo { before } else { after }.clone();
|
||||
scene.bump_geometry();
|
||||
}
|
||||
if let Some((before, after)) = &d.named_parameters {
|
||||
scene.named_parameters = if undo { before } else { after }.clone();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user