forked from 1b-agent/opencadstudio-upstream
TXT2MTXT: combine text into MText, with its settings dialog
TEXT and MTEXT objects are merged into one MTEXT (top-down or in selection order, word-wrapped or one paragraph per object, with the original pitch kept as line spacing) or each TEXT and MTEXT line becomes an MTEXT of its own. The SEttings option opens the Combine Text settings dialog; the settings persist as profile values and are exposed as the TXT2MTXT* variables and the txt2mtxt_settings automation action. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
39c3e9af58
commit
4e4dc86908
40 files changed
+1244
-4
No files matched your search
@@ -44,6 +44,8 @@ pub struct SelectObjectsCommand {
|
||||
/// The kinds of object the command takes; the host drops the rest of
|
||||
/// each completed selection silently, and Enter on nothing ends quietly.
|
||||
keep: Option<fn(&codec::EntityType) -> bool>,
|
||||
/// A SEttings keyword at the prompt, and what it does.
|
||||
settings: Option<fn() -> CmdResult>,
|
||||
}
|
||||
|
||||
impl SelectObjectsCommand {
|
||||
@@ -61,6 +63,7 @@ impl SelectObjectsCommand {
|
||||
prompt_text: None,
|
||||
associative_dimensions_only: false,
|
||||
keep: None,
|
||||
settings: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +82,7 @@ impl SelectObjectsCommand {
|
||||
prompt_text: None,
|
||||
associative_dimensions_only: false,
|
||||
keep: None,
|
||||
settings: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,6 +101,7 @@ impl SelectObjectsCommand {
|
||||
prompt_text: None,
|
||||
associative_dimensions_only: false,
|
||||
keep: None,
|
||||
settings: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +120,7 @@ impl SelectObjectsCommand {
|
||||
prompt_text: None,
|
||||
associative_dimensions_only: false,
|
||||
keep: None,
|
||||
settings: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,6 +156,19 @@ impl SelectObjectsCommand {
|
||||
command
|
||||
}
|
||||
|
||||
/// The command's own wording with a SEttings keyword; Enter on nothing
|
||||
/// ends quietly.
|
||||
pub fn with_settings(
|
||||
prompt_cmd: &str,
|
||||
pending_cmd: &str,
|
||||
prompt_text: &'static str,
|
||||
settings: fn() -> CmdResult,
|
||||
) -> Self {
|
||||
let mut command = Self::filtered(prompt_cmd, pending_cmd, prompt_text, |_| true);
|
||||
command.settings = Some(settings);
|
||||
command
|
||||
}
|
||||
|
||||
pub fn auto_constrain(pending_cmd: &str) -> Self {
|
||||
let mut command = Self::new(pending_cmd);
|
||||
command.auto_constrain_settings = true;
|
||||
@@ -242,6 +261,9 @@ impl CadCommand for SelectObjectsCommand {
|
||||
// they work typed as well — these buttons only surface them, which is what
|
||||
// the on-screen keyboard-less case needs.
|
||||
fn options(&self) -> Vec<CmdOption> {
|
||||
if self.settings.is_some() && self.pick.is_none() {
|
||||
return vec![CmdOption::new("SEttings", "SE")];
|
||||
}
|
||||
if self.commit_on_enter && self.show_options {
|
||||
if self.auto_constrain_settings {
|
||||
return vec![CmdOption::new(t!("Settings").as_ref(), "S")];
|
||||
@@ -297,6 +319,12 @@ impl CadCommand for SelectObjectsCommand {
|
||||
if !self.commit_on_enter {
|
||||
return None;
|
||||
}
|
||||
let word = text.trim().trim_start_matches('_').to_uppercase();
|
||||
if let Some(settings) = self.settings {
|
||||
if word.len() >= 2 && "SETTINGS".starts_with(word.as_str()) {
|
||||
return Some(settings());
|
||||
}
|
||||
}
|
||||
match text.trim().to_uppercase().as_str() {
|
||||
"S" | "SETTINGS" if self.auto_constrain_settings => {
|
||||
Some(CmdResult::OpenAutoConstrainSettings)
|
||||
|
||||
Reference in new issue
Block a user