feat: implement TEXTEDIT command and TEXTEDITMODE system variable

- Adds TEXTEDIT command to seamlessly edit annotation objects in-place.
- Matches industry-standard CAD tools' prompt behavior and "Current settings" banner logic.
- Implements the TEXTEDITMODE system variable (0/1) for Multiple vs Single editing modes.
- Enhances command lifecycle with CmdResult::SuspendForTextEdit and post_editor_closed hooks, allowing commands to cleanly pause and resume after external UI editors close.
This commit is contained in:
Karim Jerbi committed 2026-06-18 15:56:27 +01:00
1 parent 4d8ea95974
commit 9a258f29ce
9 files changed
+351 -6

No files matched your search

+20 -5
View File
@@ -196,6 +196,7 @@ impl OpenCADStudio {
v
},
plugin_repos: self.plugin_repos.clone(),
texteditmode: self.texteditmode,
}
}
@@ -212,9 +213,23 @@ impl OpenCADStudio {
self.default_assoc_prompted = s.default_assoc_prompted;
self.disabled_plugins = s.disabled_plugins.iter().cloned().collect();
self.plugin_repos = s.plugin_repos.clone();
self.texteditmode = s.texteditmode;
self.rebuild_ribbon_modules();
}
/// Check if a suspended command exists on the active tab and resume it
/// with the outcome of the text editor.
pub(super) fn post_editor_closed(&mut self, committed: bool) -> Task<Message> {
let i = self.active_tab;
if let Some(mut cmd) = self.tabs[i].suspended_cmd.take() {
let res = cmd.on_editor_closed(committed);
self.tabs[i].active_cmd = Some(cmd);
self.apply_cmd_result(res)
} else {
Task::none()
}
}
/// Rebuild the ribbon's tab list from the registry, dropping the tabs of any
/// disabled plugins. Call after `disabled_plugins` changes.
pub(super) fn rebuild_ribbon_modules(&mut self) {
@@ -1704,12 +1719,12 @@ impl OpenCADStudio {
// Open MText editor swallows Escape (cancel without committing).
if self.mtext_editor.is_some() {
self.mtext_cancel();
return Task::none();
return self.post_editor_closed(false);
}
// The in-place TEXT editor likewise cancels on Escape.
if self.text_inline.is_some() {
self.text_inline_cancel();
return Task::none();
return self.post_editor_closed(false);
}
// Grip popup intercepts Escape — dismisses the menu
// without doing anything else.
@@ -4679,11 +4694,11 @@ impl OpenCADStudio {
}
Message::MTextOk => {
self.mtext_commit();
Task::none()
self.post_editor_closed(true)
}
Message::MTextCancel => {
self.mtext_cancel();
Task::none()
self.post_editor_closed(false)
}
Message::TextInlineInput(s) => {
@@ -4694,7 +4709,7 @@ impl OpenCADStudio {
}
Message::TextInlineOk => {
self.text_inline_commit();
Task::none()
self.post_editor_closed(true)
}
Message::DrawOrderSubmenuToggle => {