forked from 1b-agent/opencadstudio-upstream
Block Definition dialog: preview, empty-block band, open in editor
The name card draws the selected objects, or the existing definition the name picks. OK with no objects shows an in-window band offering to select objects or to define an empty block. A switch opens the new block in the block editor once it is defined; it is remembered with the other dialog choices. Automation gains block_def_dialog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
39c3e9af58
commit
d69a5f0ac4
30 files changed
+329
-13
No files matched your search
@@ -118,6 +118,7 @@ pub(super) const NAMES: &[&str] = &[
|
||||
"ribbon_dropdown",
|
||||
"keytips",
|
||||
"dialog_ok",
|
||||
"block_def_dialog",
|
||||
"attdef_dialog",
|
||||
"field_dialog",
|
||||
"sheet_set",
|
||||
@@ -1502,6 +1503,26 @@ impl OpenCADStudio {
|
||||
}
|
||||
return Ok(Task::none());
|
||||
}
|
||||
// The open Block Definition dialog: `name=…`, `open_in_editor=0|1`,
|
||||
// `base_on_screen=0|1`, `objects_on_screen=0|1`, `create_empty`,
|
||||
// `select_objects`.
|
||||
"block_def_dialog" => {
|
||||
if self.block_definition.is_none() {
|
||||
return Err(failure("no_dialog", "The Block Definition dialog is not open"));
|
||||
}
|
||||
let value = string(req, "value")?;
|
||||
let (key, v) = value.split_once('=').unwrap_or((value, ""));
|
||||
let on = v == "1";
|
||||
match key {
|
||||
"name" => Message::BlockDefNameSelect(v.to_string()),
|
||||
"open_in_editor" => Message::BlockDefOpenInEditor(on),
|
||||
"base_on_screen" => Message::BlockDefBaseOnScreen(on),
|
||||
"objects_on_screen" => Message::BlockDefObjectsOnScreen(on),
|
||||
"create_empty" => Message::BlockDefCreateEmpty,
|
||||
"select_objects" => Message::BlockDefSelectObjects,
|
||||
_ => return Err(failure("invalid_value", "Unknown block definition field")),
|
||||
}
|
||||
}
|
||||
// One field of the open attribute definition dialog: `tag=…`,
|
||||
// `prompt=…`, `default=…`, `justify=MC`, `style=…`, `height=…`,
|
||||
// `rotation=…`, `width=…`, `on_screen=0|1`, `x=…` / `y=…` / `z=…`,
|
||||
|
||||
Reference in new issue
Block a user