forked from 1b-agent/opencadstudio-upstream
feat(commands): prompt ATTDISP and LAYERSTATE by keyword
Add KeywordCommand, a generic stepped front-end for keyword sub-verb commands: bare NAME shows the sub-verbs as clickable buttons, and picking one either dispatches `NAME <verb>` (action verbs like ATTDISP On/Off/Normal) or prompts for an argument and dispatches `NAME <verb> <value>` (LAYERSTATE Save/Restore/Delete <name>). It delegates to the existing inline handler, so the logic stays in one place. First two of bucket B converted; the rest (VIEW, LINETYPE, SCALELISTEDIT, SETVAR, LAYDEL/LAYMRG, and the selection-first XDATA/UNDERLAY/ADJUST/DRAWORDER/CHPROP) can follow the same pattern.
This commit is contained in:
1 parent
97cc647055
commit
4fa6c49445
3 files changed
+127
-5
No files matched your search
@@ -149,7 +149,21 @@ impl OpenCADStudio {
|
||||
// ATTDISP ON — make all AttributeDefinitions visible
|
||||
// ATTDISP OFF — make all AttributeDefinitions invisible
|
||||
// ATTDISP NORMAL — restore: show only those without the invisible flag
|
||||
cmd if cmd == "ATTDISP" || cmd.starts_with("ATTDISP ") => {
|
||||
"ATTDISP" => {
|
||||
use crate::command::KeywordCommand;
|
||||
let c = KeywordCommand::new(
|
||||
"ATTDISP",
|
||||
"ATTDISP attribute display [On / Off / Normal]:",
|
||||
vec![
|
||||
("On", "ON", None),
|
||||
("Off", "OFF", None),
|
||||
("Normal", "NORMAL", None),
|
||||
],
|
||||
);
|
||||
self.command_line.push_info(&c.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(c));
|
||||
}
|
||||
cmd if cmd.starts_with("ATTDISP ") => {
|
||||
let sub = cmd.split_whitespace().nth(1).unwrap_or("").to_uppercase();
|
||||
match sub.as_str() {
|
||||
"ON" | "OFF" | "NORMAL" => {
|
||||
|
||||
@@ -191,10 +191,22 @@ impl OpenCADStudio {
|
||||
// LAYERSTATE — save / restore named snapshots of all layer states
|
||||
// (on/off, freeze, lock, colour, linetype, lineweight).
|
||||
// LAYERSTATE SAVE <name> | RESTORE <name> | DELETE <name> | ? (list)
|
||||
cmd if cmd == "LAYERSTATE"
|
||||
|| cmd == "LAS"
|
||||
|| cmd == "LMAN"
|
||||
|| cmd.starts_with("LAYERSTATE ")
|
||||
"LAYERSTATE" | "LAS" | "LMAN" => {
|
||||
use crate::command::KeywordCommand;
|
||||
let c = KeywordCommand::new(
|
||||
"LAYERSTATE",
|
||||
"LAYERSTATE [List / Save / Restore / Delete]:",
|
||||
vec![
|
||||
("List", "LIST", None),
|
||||
("Save", "SAVE", Some("LAYERSTATE SAVE new state name:")),
|
||||
("Restore", "RESTORE", Some("LAYERSTATE RESTORE state name:")),
|
||||
("Delete", "DELETE", Some("LAYERSTATE DELETE state name:")),
|
||||
],
|
||||
);
|
||||
self.command_line.push_info(&c.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(c));
|
||||
}
|
||||
cmd if cmd.starts_with("LAYERSTATE ")
|
||||
|| cmd.starts_with("LAS ")
|
||||
|| cmd.starts_with("LMAN ") =>
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user