forked from 1b-agent/opencadstudio-upstream
feat: DDEDIT command and double-click text editing
Add DDEDIT (ED alias) command that edits Text/MText/Attribute entities in-place via the command line. Double-clicking a text entity in model space now auto-launches DDEDIT for that entity. Supports Text, MText, AttributeDefinition, and AttributeEntity types. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
25ec6f66e5
commit
8078c4c9da
7 files changed
+187
-1
No files matched your search
@@ -619,6 +619,29 @@ impl H7CAD {
|
||||
self.tabs[i].scene.clear_preview_wire();
|
||||
self.restore_pre_cmd_tangent();
|
||||
}
|
||||
CmdResult::DdeditEntity { handle, new_text } => {
|
||||
let mut updated = false;
|
||||
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
match entity {
|
||||
acadrust::EntityType::Text(t) => { t.value = new_text; updated = true; }
|
||||
acadrust::EntityType::MText(t) => { t.value = new_text; updated = true; }
|
||||
acadrust::EntityType::AttributeDefinition(a) => { a.default_value = new_text; updated = true; }
|
||||
acadrust::EntityType::AttributeEntity(a) => { a.set_value(new_text); updated = true; }
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
if updated {
|
||||
self.push_undo_snapshot(i, "DDEDIT");
|
||||
self.tabs[i].dirty = true;
|
||||
self.command_line.push_output("DDEDIT: text updated.");
|
||||
} else {
|
||||
self.command_line.push_error("DDEDIT: entity type not supported.");
|
||||
}
|
||||
self.tabs[i].active_cmd = None;
|
||||
self.tabs[i].snap_result = None;
|
||||
self.tabs[i].scene.clear_preview_wire();
|
||||
self.restore_pre_cmd_tangent();
|
||||
}
|
||||
}
|
||||
// Focus the command-line input while a command is active; blur it when the command ends.
|
||||
if self.tabs[i].active_cmd.is_some() {
|
||||
|
||||
Reference in new issue
Block a user