Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Keep custom paper for Windows PDF exports and repair merged catalogs

skylar taylor-barrick3a2d657b9aa0
diff --git a/crates/ui-egui/src/file_ui.rs b/crates/ui-egui/src/file_ui.rs
index d86f9cf12..ba7efccaf 100644
--- a/crates/ui-egui/src/file_ui.rs
+++ b/crates/ui-egui/src/file_ui.rs
@@ -726,7 +726,6 @@ pub fn open_print(app: &mut PhotocraftApp) -> u64 {
f.insert("printer".into(), json!(fallback));
f.remove("printerSettings");
}
- driver_page(&mut f);
}
app.ui.open_dialog(DialogKind::Command, f)
}
@@ -828,6 +827,22 @@ fn print_paper_controls(ui: &mut egui::Ui, f: &mut Map<String, Value>) {
fn print_body(app: &mut PhotocraftApp, ui: &mut egui::Ui, f: &mut Map<String, Value>) {
let t = Tokens::get(ui.ctx());
let Some(doc) = app.session.active().map(|d| d.doc.clone()) else { return };
+ // PDF exports and previews retain editable paper on Windows too. Only a real native
+ // submission takes its media from the printer; entering that mode refreshes the driver
+ // geometry after any export-only paper edits.
+ let printers: Option<Vec<String>> = if !b(f, "dryRun", false) && s(f, "output", "").is_empty() {
+ f.get("__printers").and_then(Value::as_array).map(|a| a.iter().filter_map(|v| v.as_str().map(str::to_string)).collect())
+ } else {
+ None
+ };
+ if printers.is_some() {
+ if !b(f, "__driverPageInitialized", false) {
+ driver_page(f);
+ f.insert("__driverPageInitialized".into(), json!(true));
+ }
+ } else {
+ f.remove("__driverPageInitialized");
+ }
let p = params(f);
ui.horizontal_top(|ui| {
// Page preview.
@@ -904,8 +919,6 @@ fn print_body(app: &mut PhotocraftApp, ui: &mut egui::Ui, f: &mut Map<String, Va
ui.label(egui::RichText::new(s).font(crate::theme::semibold(12.0)).color(t.text));
};
head(ui, tl!("Printer Setup"));
- let printers: Option<Vec<String>> =
- f.get("__printers").and_then(Value::as_array).map(|a| a.iter().filter_map(|v| v.as_str().map(str::to_string)).collect());
if let Some(printers) = &printers {
// Windows: Photoshop's Printer menu and Print Settings… (the driver's own dialog).
ui.horizontal(|ui| {
diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv
index d382744c5..905c62874 100644
--- a/crates/ui-egui/src/i18n/ja.tsv
+++ b/crates/ui-egui/src/i18n/ja.tsv
@@ -3796,13 +3796,6 @@ curves Smooth スムーズ
Sent to {printer} {printer} に送信しました
set in Print Settings… 印刷設定で指定…
# Restored rows (custom print paper #3820, brush presets, Vanishing Point help, brush panel menu)
- Paper Width 用紙の幅
- Paper Height 用紙の高さ
- Capture Brush Size in Preset ブラシサイズをプリセットに保存
- Include Tool Settings ツール設定を含める
- Include Color カラーを含める
- Enter a name for the brush preset ブラシプリセットの名前を入力してください
- A brush preset with this name already exists この名前のブラシプリセットは既に存在します
Drag to pan · Scroll to zoom · Double-click to fit ドラッグで移動 · スクロールでズーム · ダブルクリックで全体表示
Clear Brush Controls ブラシのコントロールを消去
Reset All Locked Settings ロックされた設定をすべて初期化
diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsv
index 3d01325ef..66fd394b2 100644
--- a/crates/ui-egui/src/i18n/sr.tsv
+++ b/crates/ui-egui/src/i18n/sr.tsv
@@ -4192,10 +4192,11 @@ shape Appearance Izgled
Remember to turn off the printer's own colour management in Print Settings… Ne zaboravite da isključite upravljanje bojama samog štampača u podešavanjima štampanja…
Sent to {printer} Poslato na {printer}
set in Print Settings… podešava se u podešavanjima štampanja…
- Soft dark Blaga tamna
- Soft light Blaga svetla
- Soft Dark Theme Blaga tamna tema
- Soft Light Theme Blaga svetla tema
# Custom print paper (#3820)
Paper Width Širina papira
Paper Height Visina papira
+
+# Layer mask selection commands
+ Add Mask to Selection Dodaj masku izboru
+ Subtract Mask from Selection Oduzmi masku od izbora
+ Intersect Mask with Selection Presek maske i izbora
diff --git a/crates/ui-egui/tests/custom_print_paper.rs b/crates/ui-egui/tests/custom_print_paper.rs
index 7361468bb..d0d81dea6 100644
--- a/crates/ui-egui/tests/custom_print_paper.rs
+++ b/crates/ui-egui/tests/custom_print_paper.rs
@@ -10,6 +10,8 @@ fn app() -> (PhotocraftApp, u64) {
let id = open_print(&mut app);
// Every UI path in these fixtures is safe even if an unexpected Enter confirms the dialog.
app.ui.dialog_mut(id).unwrap().fields.insert("dryRun".into(), json!(true));
+ // Exercise PDF paper controls even when native printers are available, on every OS.
+ app.ui.dialog_mut(id).unwrap().fields.insert("__printers".into(), json!(["Test native printer"]));
(app, id)
}