forked from 1b-agent/opencadstudio-upstream
feat(plot): PSETUPIN and page-setup import, page setup for new layouts
- PSETUPIN / -PSETUPIN: with no arguments a file picker offers the chosen drawing's named page setups in the Plot dialog; `PSETUPIN <file>` opens the same chooser on that file; `PSETUPIN <file> *` or `PSETUPIN <file> name,name` import straight away. Same-named setups are replaced, the import is one undo step, and the report counts both. - The Plot dialog's page-setup list gains "Import…": the chooser shows the source drawing's setups with a tick each, All, Import and Cancel, and selects the first imported setup afterwards. The source is read off the UI thread with the same reader the editor uses for its own setups (`scene::document_page_setups`), and handles that only meant something in the source drawing (plot view, visual style) are dropped on import. - Options → General → Plotting: "Show the page setup for new layouts" opens the Plot / Page Setup dialog whenever a layout is created (persisted with the plot preferences). Tests: the document reader, the command (all / named / unknown / missing file / undo) against a drawing saved by the app, the chooser flow, and the new-layout option. Nine new strings in all 21 locales. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7efb04a666
commit
74936063f9
35 files changed
+786
-48
No files matched your search
@@ -1,9 +1,11 @@
|
||||
//! Plot system variables. `PLOTOFFSET`, `PAPERUPDATE`, `PLOTROTMODE`,
|
||||
//! `PLOTTRANSPARENCYOVERRIDE` and `BACKGROUNDPLOT` are plot preferences of
|
||||
//! the application, kept with the Plot dialog's persisted settings; `CTAB`
|
||||
//! and `TILEMODE` say which layout of the drawing is current. Each is
|
||||
//! typeable on its own (`PLOTOFFSET 1`, `CTAB Layout1`) and through
|
||||
//! `SETVAR`, and a bare name prompts for the value like the other variables.
|
||||
//! Plot system variables and the page-setup import command. `PLOTOFFSET`,
|
||||
//! `PAPERUPDATE`, `PLOTROTMODE`, `PLOTTRANSPARENCYOVERRIDE` and
|
||||
//! `BACKGROUNDPLOT` are plot preferences of the application, kept with the
|
||||
//! Plot dialog's persisted settings; `CTAB` and `TILEMODE` say which layout
|
||||
//! of the drawing is current. Each is typeable on its own (`PLOTOFFSET 1`,
|
||||
//! `CTAB Layout1`) and through `SETVAR`, and a bare name prompts for the
|
||||
//! value like the other variables. `PSETUPIN` brings named page setups in
|
||||
//! from another drawing (see `app::update::page_setup_import`).
|
||||
|
||||
use crate::app::{Message, OpenCADStudio};
|
||||
use iced::Task;
|
||||
@@ -39,6 +41,16 @@ enum Outcome {
|
||||
|
||||
impl OpenCADStudio {
|
||||
pub(super) fn dispatch_plotvars(&mut self, cmd: &str, i: usize) -> Option<Task<Message>> {
|
||||
// PSETUPIN [file [* | name,name…]] — the dash form is the same
|
||||
// command; both read the file and report on the command line.
|
||||
for name in ["PSETUPIN", "-PSETUPIN"] {
|
||||
if cmd == name {
|
||||
return Some(self.on_psetupin(""));
|
||||
}
|
||||
if let Some(args) = cmd.strip_prefix(name).filter(|rest| rest.starts_with(' ')) {
|
||||
return Some(self.on_psetupin(args));
|
||||
}
|
||||
}
|
||||
let rest = cmd.strip_prefix("SETVAR ").map(str::trim).unwrap_or(cmd);
|
||||
let mut parts = rest.splitn(2, char::is_whitespace);
|
||||
let name = parts.next().unwrap_or("").to_ascii_uppercase();
|
||||
|
||||
Reference in new issue
Block a user