feat(commands): step the rest of the keyword/value commands

Convert the remaining bucket-B commands to prompt step by step instead of
requiring arguments or printing usage:

- KeywordCommand (buttons): VIEW, LINETYPE, SCALELISTEDIT, UCSICON, VSCURRENT.
- ValuePromptCommand (one value): LAYDEL (layer), ATTSYNC (block).
- TwoValuePromptCommand (new; two values): LAYMRG (source + target),
  SETVAR (variable + value, blank second reads).

Each bare form now starts the stepped front-end and delegates to the existing
inline handler; the argument form is kept and is the dispatch target. The
direct visual-style shortcuts (HIDDENLINE / XRAY / …) and UCSICON's argument
form are untouched.

COUNT is intentionally left alone: bare COUNT already reports the tally (a
useful inquiry action, not a usage line), so prompting would only add friction.
This commit is contained in:
Hakan Seven 2026-07-16 13:29:04 +03:00
commit 4c3509fa51
7 changed files with 186 additions and 16 deletions

View file

@ -75,7 +75,13 @@ impl OpenCADStudio {
}
// LAYDEL <name> — delete a layer and erase the objects on it.
cmd if cmd == "LAYDEL" || cmd.starts_with("LAYDEL ") => {
"LAYDEL" => {
use crate::command::ValuePromptCommand;
let c = ValuePromptCommand::new("LAYDEL", "LAYDEL layer to delete:");
self.command_line.push_info(&c.prompt());
self.tabs[i].active_cmd = Some(Box::new(c));
}
cmd if cmd.starts_with("LAYDEL ") => {
let name = cmd.trim_start_matches("LAYDEL").trim();
if name.is_empty() {
self.command_line.push_info("Usage: LAYDEL <layer name>");
@ -127,7 +133,17 @@ impl OpenCADStudio {
// LAYMRG <source> <target> — move every object from <source> onto
// <target>, then delete the emptied <source> layer.
cmd if cmd == "LAYMRG" || cmd.starts_with("LAYMRG ") => {
"LAYMRG" => {
use crate::command::TwoValuePromptCommand;
let c = TwoValuePromptCommand::new(
"LAYMRG",
"LAYMRG source layer (merged away):",
"LAYMRG target layer (kept):",
);
self.command_line.push_info(&c.prompt());
self.tabs[i].active_cmd = Some(Box::new(c));
}
cmd if cmd.starts_with("LAYMRG ") => {
let rest = cmd.trim_start_matches("LAYMRG").trim();
let parts: Vec<&str> = rest.split_whitespace().collect();
if parts.len() != 2 {