mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-27 02:23:43 +00:00
Merge branch 'pr-14413' into pr-14454
# Conflicts: # crates/engine/src/cmd/artboard_cmds.rs
This commit is contained in:
@@ -16,7 +16,7 @@ use photocraft_raster::Surface;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::commands::{CommandSpec, color_param, int, int_i32, parse_hex};
|
||||
use crate::file_cmds::{SaveOpts, encode, f64_param, join, native_doc, sanitize, stem, str_param, write_file};
|
||||
use crate::file_cmds::{encode, f64_param, join, native_doc, sanitize, stem, str_param, write_file};
|
||||
use crate::{EngineError, Result, Session};
|
||||
|
||||
/// Artboard size presets (name, width, height) in pixels, Photoshop's common devices and pages.
|
||||
@@ -1076,7 +1076,9 @@ fn artboards_to_files(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
Some(_) if truecolour && one.mode != ColorMode::Rgb => encode(&rgb_copy(&one)?, &path, save)?,
|
||||
Some(_) => encode(&one, &path, save)?,
|
||||
// The PNG-8 writer does not interlace; say so, as the palette PNG path of a save does.
|
||||
None if save.png_interlaced == Some(true) => (png8(&one, cmd)?, vec!["written without interlacing: the PNG-8 exporter does not interlace".to_owned()]),
|
||||
None if save.png_interlaced == Some(true) => {
|
||||
(png8(&one, cmd)?, vec!["written without interlacing: the PNG-8 exporter does not interlace".to_owned()])
|
||||
}
|
||||
None => (png8(&one, cmd)?, Vec::new()),
|
||||
};
|
||||
guard.check()?;
|
||||
@@ -1458,11 +1460,11 @@ mod file_types_tests;
|
||||
#[path = "artboard_cmds/first_board_background_tests.rs"]
|
||||
mod first_board_background_tests;
|
||||
#[cfg(test)]
|
||||
#[path = "artboard_cmds/include_name_tests.rs"]
|
||||
mod include_name_tests;
|
||||
#[cfg(test)]
|
||||
#[path = "artboard_cmds/from_group_reset_props_tests.rs"]
|
||||
mod from_group_reset_props_tests;
|
||||
#[cfg(test)]
|
||||
#[path = "artboard_cmds/include_name_tests.rs"]
|
||||
mod include_name_tests;
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "artboard_cmds/from_layers_history_name_tests.rs"]
|
||||
|
||||
@@ -38,6 +38,11 @@ fn export(s: &mut Session, tag: &str, params: Value) -> Vec<u8> {
|
||||
let path = std::env::temp_dir().join(format!("photocraft-abpdf-bg-{}-{tag}.pdf", std::process::id()));
|
||||
let mut p = params;
|
||||
p["path"] = json!(path.to_string_lossy());
|
||||
// Artboard Content Only unless a test says otherwise: Red and Blue Board overlap, and Include Overlapping Areas
|
||||
// (#13646, the default) would put Blue Board's pixels on the Red Board page.
|
||||
if p.get("content").is_none() {
|
||||
p["content"] = json!("artboard");
|
||||
}
|
||||
s.execute("file.export.artboardsToPdf", p).unwrap();
|
||||
let bytes = std::fs::read(&path).unwrap();
|
||||
let _ = std::fs::remove_file(&path);
|
||||
|
||||
@@ -35,6 +35,8 @@ fn open(h: &mut H, path: &str) -> DialogId {
|
||||
let dialog = h.state().framework.dialogs.open_dialogs().into_iter().map(|d| d.id).find(|d| d.value().to_string() == want).unwrap();
|
||||
h.run_steps(4);
|
||||
h.state_mut().framework.dialogs.set_json_field(&ctx, dialog, "path", json!(path)).unwrap();
|
||||
// Every board, not only the selected one: Export Selected Artboards opens ticked while a board is selected (#13647).
|
||||
h.state_mut().framework.dialogs.set_json_field(&ctx, dialog, "artboards", serde_json::Value::Null).unwrap();
|
||||
h.run_steps(4);
|
||||
dialog
|
||||
}
|
||||
|
||||
@@ -322,10 +322,15 @@ pub(super) fn params_for(app: &mut PhotocraftApp, id: &str) -> Option<(Vec<Param
|
||||
// The reference application's list, PSD chosen when the dialog opens (#13635).
|
||||
choice("format", tl!("File Type"), artboard_formats(), "psd"),
|
||||
];
|
||||
// Export Options and each file type's settings (#13636); the JPEG quality is one of them.
|
||||
rows.extend(artboard_export_options::rows());
|
||||
// Include Artboard Name and its Name Options (#13637).
|
||||
rows.extend(artboard_name_options::rows(&crate::type_tool::families()));
|
||||
// Export Options and each file type's settings (#13636; the JPEG quality is one of them), then Include Artboard
|
||||
// Name and its Name Options (#13637). A section's body runs to the next section and hides with it, so both
|
||||
// checkboxes come before the Options section: after it, Include Artboard Name would show only with Export Options.
|
||||
let mut export = artboard_export_options::rows().into_iter();
|
||||
let mut name = artboard_name_options::rows(&crate::type_tool::families()).into_iter();
|
||||
rows.extend(export.next());
|
||||
rows.extend(name.next());
|
||||
rows.extend(export);
|
||||
rows.extend(name);
|
||||
plain(rows)
|
||||
}
|
||||
"file.export.artboardsToPdf" => {
|
||||
|
||||
Reference in New Issue
Block a user