fix(pdfimport): reference geometry precision, file and page messages, picker automation

- The page transform is read as 16.16 fixed point held in single precision
  and each user-space coordinate as a single-precision value kept to six
  decimals, so imported coordinates match the reference to the last digit.
- Paths wholly outside the page (crop box) or the current clip are left out.
- The page's /UserUnit scales the import.
- Unreadable files (no trailer, empty, not a PDF) print the "This file
  cannot be opened." block; encrypted files are asked for again silently.
- Page prompt: digits only, "There is no N in <file>." past the last page;
  page list prompt keeps asking with "Please enter page number or *.".
- Automation: pdf_import_pick (the path the next PDF picker returns) and
  pdf_import_dialog (page / on_screen / scale / rotation / ok / cancel).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
ramox81andClaude Opus 5.5 committed 2026-10-16 12:37:20 +03:00
1 parent 218150c76a
commit dae01bdb14
6 files changed
+199 -35

No files matched your search

+12
View File
@@ -602,6 +602,18 @@ pub fn set_file_dia(on: bool) {
FILE_DIA.store(on, std::sync::atomic::Ordering::Relaxed);
}
/// A file the next PDF import picker returns without showing itself (set
/// by automation, used once).
static PDF_IMPORT_PICK: std::sync::Mutex<Option<std::path::PathBuf>> = std::sync::Mutex::new(None);
pub fn set_pdf_import_pick(path: std::path::PathBuf) {
*PDF_IMPORT_PICK.lock().unwrap_or_else(|e| e.into_inner()) = Some(path);
}
pub fn take_pdf_import_pick() -> Option<std::path::PathBuf> {
PDF_IMPORT_PICK.lock().unwrap_or_else(|e| e.into_inner()).take()
}
/// The file type ATTACH's picker was last left on (1-based; 7 = Drawing).
static ATTACH_FILTER: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(7);