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:
parent
25ec6f66e5
commit
8078c4c9da
7 changed files with 187 additions and 1 deletions
|
|
@ -906,6 +906,28 @@ impl H7CAD {
|
|||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
"DDEDIT"|"ED" => {
|
||||
use crate::modules::annotate::ddedit::{DdeditCommand, entity_text};
|
||||
// If a single text/mtext entity is already selected, skip the pick step.
|
||||
let sel = self.tabs[i].scene.selected_entities();
|
||||
if sel.len() == 1 {
|
||||
let (h, _) = sel[0];
|
||||
if let Some(e) = self.tabs[i].scene.document.get_entity(h) {
|
||||
if let Some(cur) = entity_text(e) {
|
||||
let cmd = DdeditCommand::with_handle(h, cur.clone());
|
||||
self.command_line.push_info(&format!("DDEDIT Enter new text <{cur}>:"));
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
} else {
|
||||
self.command_line.push_error("DDEDIT: selected entity is not text.");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let cmd = DdeditCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
}
|
||||
|
||||
"MTEXT"|"MT" => {
|
||||
use crate::modules::annotate::mtext::MTextCommand;
|
||||
let new_cmd = MTextCommand::new();
|
||||
|
|
|
|||
Loading…
Reference in a new issue