forked from 1b-agent/opencadstudio-upstream
Layouts: a viewport on first opening (LAYOUTCREATEVIEWPORT)
A layout opened for the first time - one whose sheet viewport had to be made, or one created in this session - gets a viewport centred on the printable area, 0.8 of its width and height, zoomed to the model's extents, while LAYOUTCREATEVIEWPORT is on. The profile variable takes ON/OFF or 1/0 and is kept with the settings. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
5d0390bcdf
commit
e3a0ff1bad
9 files changed
+117
-14
No files matched your search
@@ -712,6 +712,7 @@ inventory::submit!(crate::command::CommandRegistration {
|
||||
"UOSNAP",
|
||||
"FIELDDISPLAY",
|
||||
"SURFACEASSOCIATIVITY",
|
||||
"LAYOUTCREATEVIEWPORT",
|
||||
"FIELDEVAL",
|
||||
"PDFIMPORTMODE",
|
||||
"PDFIMPORTFILTER",
|
||||
|
||||
@@ -1213,6 +1213,7 @@ impl OpenCADStudio {
|
||||
| "SURFACEASSOCIATIVITY"
|
||||
| "UCSORTHO"
|
||||
| "UCSVIEW"
|
||||
| "LAYOUTCREATEVIEWPORT"
|
||||
| "PDFIMPORTMODE"
|
||||
| "PDFIMPORTFILTER"
|
||||
| "PDFIMPORTLAYERS"
|
||||
@@ -1451,6 +1452,39 @@ impl OpenCADStudio {
|
||||
}
|
||||
return Some(self.finish_dispatch(cmd));
|
||||
}
|
||||
if name == "LAYOUTCREATEVIEWPORT" {
|
||||
// A profile switch shown and taken as ON / OFF or 1 / 0.
|
||||
let current = if crate::scene::layout_create_viewport() { "ON" } else { "OFF" };
|
||||
let parsed = value.as_deref().map(|v| {
|
||||
match v.trim().trim_start_matches('_').to_ascii_uppercase().as_str() {
|
||||
"1" | "ON" => Some(true),
|
||||
"0" | "OFF" => Some(false),
|
||||
_ => None,
|
||||
}
|
||||
});
|
||||
match parsed {
|
||||
Some(Some(on)) => {
|
||||
if crate::scene::layout_create_viewport() != on {
|
||||
crate::scene::set_layout_create_viewport(on);
|
||||
self.save_config();
|
||||
}
|
||||
}
|
||||
Some(None) => {
|
||||
self.command_line.push_error(
|
||||
crate::t!("Requires 0 or 1 only, or option keyword.").as_ref(),
|
||||
);
|
||||
self.command_line
|
||||
.push_output(&format!("Enter new value for {name} <{current}>:"));
|
||||
self.pending_setvar = Some(name.clone());
|
||||
}
|
||||
None => {
|
||||
self.command_line
|
||||
.push_output(&format!("Enter new value for {name} <{current}>:"));
|
||||
self.pending_setvar = Some(name.clone());
|
||||
}
|
||||
}
|
||||
return Some(self.finish_dispatch(cmd));
|
||||
}
|
||||
if matches!(name.as_str(), "UCSORTHO" | "UCSVIEW") {
|
||||
use crate::modules::view::view_cmd;
|
||||
let current = i16::from(if name == "UCSORTHO" { view_cmd::ucs_ortho() } else { view_cmd::ucs_view() });
|
||||
|
||||
Reference in new issue
Block a user