mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts: # docs/ui-parity.md
This commit is contained in:
commit
4c6d5e259a
43 files changed
+1422
-48
No files matched your search
@@ -54,9 +54,10 @@ fn can_split(s: &Session) -> std::result::Result<(), String> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
/// Merge Channels needs a document per colour channel: three at least (RGB and Lab; CMYK four).
|
||||
fn can_merge(s: &Session) -> std::result::Result<(), String> {
|
||||
has_doc(s)?;
|
||||
if mergeable(s).len() >= 2 { Ok(()) } else { Err("Merge Channels needs at least two open grayscale documents of the same size".into()) }
|
||||
if mergeable(s).len() >= 3 { Ok(()) } else { Err("Merge Channels needs at least three open grayscale documents of the same size".into()) }
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -1238,3 +1238,21 @@ fn split_refuses_an_image_with_more_than_one_layer() {
|
||||
assert!(s.execute("channel.split", json!({})).is_err());
|
||||
assert_eq!(s.documents().len(), 1);
|
||||
}
|
||||
|
||||
/// Merge Channels is offered from three grayscale documents of one size, the fewest a mode
|
||||
/// (RGB or Lab) merges; two never merge (#11451).
|
||||
#[test]
|
||||
fn merge_channels_waits_for_three_grayscale_documents() {
|
||||
let mut s = Session::new();
|
||||
for _ in 0..2 {
|
||||
s.execute("file.new", json!({"width": 8, "height": 8, "mode": "grayscale"})).unwrap();
|
||||
}
|
||||
s.execute("file.new", json!({"width": 9, "height": 8, "mode": "grayscale"})).unwrap();
|
||||
s.set_active(0);
|
||||
let why = s.disabled_reason("channel.merge").expect("two of one size are not enough");
|
||||
assert!(why.contains("three"), "{why}");
|
||||
s.execute("file.new", json!({"width": 8, "height": 8, "mode": "grayscale"})).unwrap();
|
||||
assert!(s.is_enabled("channel.merge"));
|
||||
s.execute("channel.merge", json!({"mode": "lab"})).unwrap();
|
||||
assert_eq!(s.documents().len(), 2, "the three of one size merged; the other is left");
|
||||
}
|
||||
@@ -317,6 +317,7 @@ fn command_body(app: &mut PhotocraftApp, ui: &mut egui::Ui, d: &Dialog, fields:
|
||||
fn command_body_more(app: &mut PhotocraftApp, ui: &mut egui::Ui, d: &Dialog, fields: &mut Fields, id: egui::Id) -> Option<bool> {
|
||||
let mut outcome: Option<bool> = None;
|
||||
match d.kind {
|
||||
_ if merge_channels_ui::owns(fields) => merge_channels_ui::body(ui, fields),
|
||||
_ if crate::file_ui::owns(fields) => crate::file_ui::body(app, ui, fields, d.id),
|
||||
_ if crate::color_picker_ui::owns(fields) => {
|
||||
outcome = crate::color_picker_ui::body(ui, fields);
|
||||
@@ -454,7 +455,7 @@ fn button_row(
|
||||
} else {
|
||||
let ok_label = ok_label(d);
|
||||
// Dialogs that need an input first (a preset name, a selection) grey OK out.
|
||||
let can_ok = crate::crop_presets::can_confirm(app, fields) && crate::stack_dialog::can_confirm(fields);
|
||||
let can_ok = crate::crop_presets::can_confirm(app, fields) && crate::stack_dialog::can_confirm(fields) && merge_channels_ui::can_confirm(fields);
|
||||
let ok = DialogButton::new(ButtonRole::Default, ok_label, 84.0).enabled(can_ok);
|
||||
// Photoshop: holding Alt turns Cancel into Reset (the dialog stays open).
|
||||
// Dialogs opt in via `dialog_alt_reset::supported` (per marker).
|
||||
@@ -860,6 +861,7 @@ const ROUTES: &[fn(&Fields) -> bool] = &[
|
||||
crate::stroke_ui::owns,
|
||||
crate::channel_options_ui::owns,
|
||||
crate::channel_options_ui::owns_new_spot,
|
||||
merge_channels_ui::owns,
|
||||
crate::shape_dialog::owns,
|
||||
crate::delete_layer_prompt::owns,
|
||||
crate::disk_change_prompt::owns,
|
||||
@@ -1011,6 +1013,8 @@ pub(crate) fn confirm_preflight(app: &mut PhotocraftApp, id: u64) -> Result<(),
|
||||
if let Some(d) = app.ui.dialogs.iter().find(|d| d.id == id).filter(|d| crate::guide_layout_ui::owns(&d.fields)) {
|
||||
crate::guide_layout_ui::validate(app, &d.fields)?;
|
||||
}
|
||||
// Merge Channels with too few, repeated, closed or changed documents stays open (#11451).
|
||||
merge_channels_ui::preflight(app, id)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1054,6 +1058,7 @@ fn confirm_command(app: &mut PhotocraftApp, d: Dialog) -> Result<Value, String>
|
||||
/// The rest of the command dialogs: files, colour, preferences and export, then any other command.
|
||||
fn confirm_command_more(app: &mut PhotocraftApp, d: Dialog) -> Result<Value, String> {
|
||||
match d.kind {
|
||||
_ if merge_channels_ui::owns(&d.fields) => merge_channels_ui::confirm(app, &d.fields),
|
||||
_ if crate::file_ui::owns(&d.fields) => crate::file_ui::confirm(app, &d.fields),
|
||||
_ if crate::new_guide_ui::owns(&d.fields) => crate::new_guide_ui::confirm(app, &d.fields),
|
||||
_ if crate::color_picker_ui::owns(&d.fields) => {
|
||||
@@ -1212,6 +1217,7 @@ pub mod layer_picker;
|
||||
pub mod layer_style;
|
||||
pub mod liquify_ui;
|
||||
pub mod mask_trash_prompt;
|
||||
pub mod merge_channels_ui;
|
||||
pub mod new_doc_ui;
|
||||
pub mod new_group_ui;
|
||||
pub mod new_guide_ui;
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
//!
|
||||
//! On the layer mask (double-click its Channels row, or Mask Options… on its Layers thumbnail)
|
||||
//! it is Photoshop's Layer Mask Display Options: just the rubylith's colour and opacity.
|
||||
//!
|
||||
//! The Channels panel's New Channel… is the same dialog for a channel still to be made (name,
|
||||
//! Masked / Selected Areas, colour, opacity); OK runs `channel.new` (#11451).
|
||||
|
||||
use egui::{Align2, Sense, pos2, vec2};
|
||||
use photocraft_doc::ColorIndicates;
|
||||
@@ -15,6 +18,8 @@ use crate::theme::Tokens;
|
||||
|
||||
pub const COMMAND: &str = "channel.options";
|
||||
const MARK: &str = "__channelOptions";
|
||||
pub const NEW_CHANNEL: &str = "channel.new";
|
||||
const NEW_CHANNEL_MARK: &str = "__newChannel";
|
||||
|
||||
pub fn owns(fields: &Map<String, Value>) -> bool {
|
||||
fields.contains_key(MARK)
|
||||
@@ -75,6 +80,28 @@ pub fn open(app: &mut PhotocraftApp, channel: &Value) -> Option<u64> {
|
||||
Some(app.ui.open_dialog(crate::state::DialogKind::Command, f))
|
||||
}
|
||||
|
||||
/// The New Channel fields: Channel Options' for a channel still to be made (the next "Alpha N"
|
||||
/// name, Masked Areas, red at 50%), or `None` without a document. OK runs `channel.new`.
|
||||
pub fn new_channel_fields(app: &PhotocraftApp) -> Option<Map<String, Value>> {
|
||||
let doc = &app.session.active()?.doc;
|
||||
let mut f = Map::new();
|
||||
f.insert(MARK.into(), json!(true));
|
||||
f.insert(NEW_CHANNEL_MARK.into(), json!(true));
|
||||
f.insert("__command".into(), json!(NEW_CHANNEL));
|
||||
f.insert("__label".into(), json!("New Channel…"));
|
||||
f.insert("name".into(), json!(photocraft_engine::channel_cmds::next_alpha_name(doc, "Alpha")));
|
||||
f.insert("indicates".into(), json!("masked"));
|
||||
f.insert("color".into(), json!("#ff0000"));
|
||||
f.insert("opacity".into(), json!(50.0));
|
||||
Some(f)
|
||||
}
|
||||
|
||||
/// Opens New Channel, or `None` without a document.
|
||||
pub fn open_new_channel(app: &mut PhotocraftApp) -> Option<u64> {
|
||||
let f = new_channel_fields(app)?;
|
||||
Some(app.ui.open_dialog(crate::state::DialogKind::Command, f))
|
||||
}
|
||||
|
||||
/// The `channel.options` params for the dialog's fields: spot channels take `solidity`, the
|
||||
/// others `opacity`.
|
||||
pub fn params(f: &Map<String, Value>) -> Value {
|
||||
@@ -92,7 +119,7 @@ pub fn params(f: &Map<String, Value>) -> Value {
|
||||
}
|
||||
|
||||
pub fn confirm(app: &mut PhotocraftApp, f: &Map<String, Value>) -> Result<Value, String> {
|
||||
app.run(COMMAND, params(f))
|
||||
app.run(if f.contains_key(NEW_CHANNEL_MARK) { NEW_CHANNEL } else { COMMAND }, params(f))
|
||||
}
|
||||
|
||||
fn label(ui: &mut egui::Ui, text: &str) {
|
||||
@@ -122,8 +149,8 @@ pub fn body(ui: &mut egui::Ui, f: &mut Map<String, Value>) {
|
||||
ui.indent("channel-options-indicates", |ui| {
|
||||
ui.radio_value(&mut indicates, "masked".to_string(), tl!("Masked Areas"));
|
||||
ui.radio_value(&mut indicates, "selected".to_string(), tl!("Selected Areas"));
|
||||
// Quick Mask can't be a spot channel.
|
||||
if !quick {
|
||||
// Quick Mask can't be a spot channel; New Spot Channel… makes spot channels.
|
||||
if !quick && !f.contains_key(NEW_CHANNEL_MARK) {
|
||||
ui.radio_value(&mut indicates, "spot".to_string(), tl!("Spot Color"));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,365 @@
|
||||
//! Channels panel › Merge Channels…: the mode (RGB, CMYK or Lab Color) and, for each of its
|
||||
//! channels, the open grayscale document that becomes it. Photoshop asks in two steps (the mode,
|
||||
//! then the documents); here both are one dialog. Only the modes the open documents can fill are
|
||||
//! offered (RGB and Lab need three, CMYK four), OK waits for a different document per channel,
|
||||
//! and a merge that still fails opens the dialog again with the reason. OK runs the engine's
|
||||
//! `channel.merge`, which closes the sources; agents call it directly with params (#11451).
|
||||
//!
|
||||
//! The dialog names documents by their [`photocraft_doc::DocId`], not their tab index: work that
|
||||
//! runs while it is open (a script moving or closing a document) can shift the indices, and OK
|
||||
//! must merge, and close, the documents that were picked. They are looked up again at OK.
|
||||
|
||||
use photocraft_doc::ColorMode;
|
||||
use photocraft_engine::channel_cmds;
|
||||
use serde_json::{Map, Value, json};
|
||||
|
||||
use crate::PhotocraftApp;
|
||||
use crate::theme::Tokens;
|
||||
|
||||
pub const COMMAND: &str = "channel.merge";
|
||||
const MARK: &str = "__mergeChannels";
|
||||
/// The most channels a mode has (CMYK).
|
||||
const SLOTS: usize = 4;
|
||||
const MODES: [(&str, &str); 3] = [("rgb", "RGB Color"), ("cmyk", "CMYK Color"), ("lab", "Lab Color")];
|
||||
const TOO_FEW: &str = "Not enough grayscale documents for this mode.";
|
||||
const REPEATED: &str = "Pick a different document for each channel.";
|
||||
const CLOSED: &str = "A picked document is no longer open.";
|
||||
const CHANGED: &str = "A picked document is no longer a grayscale document of the same size.";
|
||||
|
||||
pub fn owns(fields: &Map<String, Value>) -> bool {
|
||||
fields.contains_key(MARK)
|
||||
}
|
||||
|
||||
fn mode_of(key: &str) -> ColorMode {
|
||||
match key {
|
||||
"cmyk" => ColorMode::Cmyk,
|
||||
"lab" => ColorMode::Lab,
|
||||
_ => ColorMode::Rgb,
|
||||
}
|
||||
}
|
||||
|
||||
/// The modes `count` documents can fill, in the menu's order.
|
||||
fn modes(count: usize) -> Vec<(String, &'static str)> {
|
||||
MODES.iter().filter(|(key, _)| mode_of(key).color_channels() <= count).map(|(key, label)| (key.to_string(), *label)).collect()
|
||||
}
|
||||
|
||||
/// The documents that can be merged, by document id and name: the open grayscale ones of the
|
||||
/// active document's size, the active one first, as the engine picks them without params.
|
||||
fn sources(app: &PhotocraftApp) -> Vec<(u64, String)> {
|
||||
let Some(active) = app.session.active() else { return Vec::new() };
|
||||
let docs = app.session.documents();
|
||||
let fits = |i: usize| docs.get(i).filter(|d| d.doc.mode == ColorMode::Grayscale && d.doc.size == active.doc.size);
|
||||
let current = app.session.active_index();
|
||||
let others = (0..docs.len()).filter(|i| Some(*i) != current);
|
||||
current.into_iter().chain(others).filter_map(|i| fits(i).map(|d| (d.doc.id.0, d.doc.name.clone()))).collect()
|
||||
}
|
||||
|
||||
fn mode_field(f: &Map<String, Value>) -> &str {
|
||||
f.get("mode").and_then(Value::as_str).unwrap_or("rgb")
|
||||
}
|
||||
|
||||
fn sources_field(f: &Map<String, Value>) -> Vec<(u64, String)> {
|
||||
f.get("__sources").and_then(|v| serde_json::from_value(v.clone()).ok()).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// The picked document ids, one per channel of the mode.
|
||||
fn picks(f: &Map<String, Value>) -> Vec<u64> {
|
||||
let all: Vec<u64> = f.get("documents").and_then(|v| serde_json::from_value(v.clone()).ok()).unwrap_or_default();
|
||||
all.into_iter().take(mode_of(mode_field(f)).color_channels()).collect()
|
||||
}
|
||||
|
||||
/// The dialog's fields: the first mode the documents can fill (RGB Color from three) and the
|
||||
/// merge-able documents in order, one per channel, or `None` without a document.
|
||||
pub fn fields(app: &PhotocraftApp) -> Option<Map<String, Value>> {
|
||||
app.session.active()?;
|
||||
let sources = sources(app);
|
||||
let picks: Vec<u64> = sources.iter().take(SLOTS).map(|(id, _)| *id).collect();
|
||||
let mode = modes(sources.len()).first().map_or_else(|| "rgb".to_string(), |(key, _)| key.clone());
|
||||
let mut f = Map::new();
|
||||
f.insert(MARK.into(), json!(true));
|
||||
f.insert("__command".into(), json!(COMMAND));
|
||||
f.insert("__label".into(), json!("Merge Channels…"));
|
||||
f.insert("__sources".into(), json!(sources));
|
||||
f.insert("mode".into(), json!(mode));
|
||||
f.insert("documents".into(), json!(picks));
|
||||
Some(f)
|
||||
}
|
||||
|
||||
/// Opens Merge Channels, or `None` without a document.
|
||||
pub fn open(app: &mut PhotocraftApp) -> Option<u64> {
|
||||
let f = fields(app)?;
|
||||
Some(app.ui.open_dialog(crate::state::DialogKind::Command, f))
|
||||
}
|
||||
|
||||
/// Why OK is greyed (English, for `tl!`): the mode needs more documents than are offered, or the
|
||||
/// picks repeat a document or name one the dialog did not offer. `None` when OK can merge, and
|
||||
/// for another dialog's fields.
|
||||
pub fn problem(f: &Map<String, Value>) -> Option<&'static str> {
|
||||
if !owns(f) {
|
||||
return None;
|
||||
}
|
||||
let n = mode_of(mode_field(f)).color_channels();
|
||||
let sources = sources_field(f);
|
||||
let picks = picks(f);
|
||||
if sources.len() < n || picks.len() < n {
|
||||
return Some(TOO_FEW);
|
||||
}
|
||||
let mut seen = std::collections::HashSet::new();
|
||||
let offered = |p: &u64| sources.iter().any(|(id, _)| id == p);
|
||||
if picks.iter().any(|p| !seen.insert(*p) || !offered(p)) {
|
||||
return Some(REPEATED);
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Whether OK is live: always for other dialogs, here while [`problem`] finds none.
|
||||
pub fn can_confirm(f: &Map<String, Value>) -> bool {
|
||||
problem(f).is_none()
|
||||
}
|
||||
|
||||
/// The picked documents' current tab indices, looked up by id; refused (English, for `tl!`)
|
||||
/// when one was closed, or is no longer a grayscale document of the others' size.
|
||||
fn resolve(app: &PhotocraftApp, f: &Map<String, Value>) -> Result<Vec<usize>, &'static str> {
|
||||
if let Some(why) = problem(f) {
|
||||
return Err(why);
|
||||
}
|
||||
let docs = app.session.documents();
|
||||
let indices = picks(f).iter().map(|id| docs.iter().position(|d| d.doc.id.0 == *id).ok_or(CLOSED)).collect::<Result<Vec<_>, _>>()?;
|
||||
let first = indices.first().and_then(|&i| docs.get(i)).map(|d| d.doc.size);
|
||||
let fits = |i: &usize| docs.get(*i).is_some_and(|d| d.doc.mode == ColorMode::Grayscale && Some(d.doc.size) == first);
|
||||
if indices.iter().all(fits) { Ok(indices) } else { Err(CHANGED) }
|
||||
}
|
||||
|
||||
/// Checked before the dialog closes (`dialogs::confirm_preflight`), so a refused OK keeps it
|
||||
/// open with the reason under the pickers: too few or repeated documents, or a picked one that
|
||||
/// was closed or changed while the dialog was open.
|
||||
pub fn preflight(app: &mut PhotocraftApp, id: u64) -> Result<(), String> {
|
||||
let Some(f) = app.ui.dialogs.iter().find(|d| d.id == id).map(|d| &d.fields).filter(|f| owns(f)) else { return Ok(()) };
|
||||
let Err(why) = resolve(app, f) else { return Ok(()) };
|
||||
if let Some(d) = app.ui.dialog_mut(id) {
|
||||
d.fields.insert("__error".into(), json!(why));
|
||||
}
|
||||
Err(why.to_string())
|
||||
}
|
||||
|
||||
/// The `channel.merge` params for the dialog's fields: the mode and the picked documents' current
|
||||
/// indices, one per channel.
|
||||
pub fn params(app: &PhotocraftApp, f: &Map<String, Value>) -> Result<Value, String> {
|
||||
let documents = resolve(app, f).map_err(str::to_string)?;
|
||||
Ok(json!({ "mode": mode_field(f), "documents": documents }))
|
||||
}
|
||||
|
||||
/// Runs the merge. Should it still be refused, the dialog opens again with its picks and the
|
||||
/// reason, rather than going away.
|
||||
pub fn confirm(app: &mut PhotocraftApp, f: &Map<String, Value>) -> Result<Value, String> {
|
||||
let result = params(app, f).and_then(|p| app.run(COMMAND, p));
|
||||
if let Err(e) = &result {
|
||||
let mut again = f.clone();
|
||||
again.insert("__error".into(), json!(e));
|
||||
app.ui.open_dialog(crate::state::DialogKind::Command, again);
|
||||
}
|
||||
result
|
||||
}
|
||||
|
||||
pub fn body(ui: &mut egui::Ui, f: &mut Map<String, Value>) {
|
||||
ui.spacing_mut().item_spacing.y = 6.0;
|
||||
let sources = sources_field(f);
|
||||
let mut mode = mode_field(f).to_string();
|
||||
let modes = modes(sources.len());
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(tl!("Mode:"));
|
||||
if crate::widgets::dropdown(ui, "merge-channels-mode", tl!("Mode:"), &mut mode, &modes, 160.0) {
|
||||
f.insert("mode".into(), json!(mode));
|
||||
f.remove("__error");
|
||||
}
|
||||
});
|
||||
crate::widgets::section_label(ui, tl!("Specify Channels:"));
|
||||
crate::widgets::hairline(ui);
|
||||
let options: Vec<(u64, &str)> = sources.iter().map(|(id, name)| (*id, name.as_str())).collect();
|
||||
let mut picks: Vec<u64> = f.get("documents").and_then(|v| serde_json::from_value(v.clone()).ok()).unwrap_or_default();
|
||||
let mut changed = false;
|
||||
for (k, channel) in channel_cmds::color_names(mode_of(&mode)).iter().enumerate() {
|
||||
let Some(pick) = picks.get_mut(k) else { break };
|
||||
ui.horizontal(|ui| {
|
||||
let caption = format!("{}:", tl!(channel));
|
||||
ui.add_sized([84.0, 22.0], egui::Label::new(&caption));
|
||||
changed |= crate::widgets::dropdown_literal(ui, &format!("merge-channels-{k}"), &caption, pick, &options, 200.0);
|
||||
});
|
||||
}
|
||||
if changed {
|
||||
f.insert("documents".into(), json!(picks));
|
||||
f.remove("__error");
|
||||
}
|
||||
// Why OK is greyed, or why the last OK was refused (the dialog's reasons are catalogued; the
|
||||
// engine's own are shown as they come).
|
||||
let why: Option<&str> = problem(f);
|
||||
let why = why.or_else(|| f.get("__error").and_then(Value::as_str)).map(|w| tl!(w).to_string());
|
||||
if let Some(why) = why {
|
||||
ui.label(egui::RichText::new(why).color(Tokens::get(ui.ctx()).danger).size(11.0));
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn app(docs: usize) -> PhotocraftApp {
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
|
||||
for _ in 0..docs {
|
||||
app.run("file.new", json!({"width": 8, "height": 8, "mode": "grayscale"})).unwrap();
|
||||
}
|
||||
app
|
||||
}
|
||||
|
||||
fn id(app: &PhotocraftApp, index: usize) -> u64 {
|
||||
app.session.documents()[index].doc.id.0
|
||||
}
|
||||
|
||||
fn offered(f: &Map<String, Value>) -> Vec<String> {
|
||||
modes(sources_field(f).len()).into_iter().map(|(key, _)| key).collect()
|
||||
}
|
||||
|
||||
/// The merged document's first pixel as 8-bit RGB.
|
||||
fn merged_pixel(app: &PhotocraftApp) -> [u8; 3] {
|
||||
let doc = &app.session.active().unwrap().doc;
|
||||
let px = photocraft_compose::render(doc, doc.bounds()).px[0];
|
||||
[px[0], px[1], px[2]].map(|v| (v * 255.0).round() as u8)
|
||||
}
|
||||
|
||||
/// Three grayscale documents filled black, mid gray and white, then the active one is `active`.
|
||||
fn shaded(active: usize) -> PhotocraftApp {
|
||||
let mut app = app(3);
|
||||
for (i, gray) in ["#000000", "#808080", "#ffffff"].into_iter().enumerate() {
|
||||
app.session.set_active(i);
|
||||
app.run("edit.fill", json!({"color": gray})).unwrap();
|
||||
}
|
||||
app.session.set_active(active);
|
||||
app
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fields_list_the_sources_by_id_and_params_take_their_indices() {
|
||||
let mut app = app(3);
|
||||
app.run("file.new", json!({"width": 9, "height": 8, "mode": "grayscale"})).unwrap();
|
||||
app.run("file.new", json!({"width": 8, "height": 8, "mode": "rgb"})).unwrap();
|
||||
app.session.set_active(2);
|
||||
let f = fields(&app).unwrap();
|
||||
let ids = [id(&app, 2), id(&app, 0), id(&app, 1)];
|
||||
assert_eq!(f["__sources"].as_array().unwrap().iter().map(|s| s[0].as_u64().unwrap()).collect::<Vec<_>>(), ids, "the active one first");
|
||||
assert_eq!((f["mode"].clone(), f["documents"].clone()), (json!("rgb"), json!(ids)), "one each, none repeated");
|
||||
assert_eq!(params(&app, &f).unwrap(), json!({"mode": "rgb", "documents": [2, 0, 1]}));
|
||||
assert!(fields(&PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default())).is_none());
|
||||
}
|
||||
|
||||
/// Three documents fill RGB and Lab, not CMYK; four fill CMYK too.
|
||||
#[test]
|
||||
fn only_the_modes_the_documents_fill_are_offered() {
|
||||
let f = fields(&app(3)).unwrap();
|
||||
assert_eq!(offered(&f), ["rgb", "lab"]);
|
||||
assert!(can_confirm(&f));
|
||||
let mut cmyk = f.clone();
|
||||
cmyk.insert("mode".into(), json!("cmyk"));
|
||||
assert_eq!(problem(&cmyk), Some(TOO_FEW), "CMYK from three documents (as automation could ask) greys OK");
|
||||
let app = app(4);
|
||||
let f = fields(&app).unwrap();
|
||||
assert_eq!(offered(&f), ["rgb", "cmyk", "lab"]);
|
||||
let mut cmyk = f.clone();
|
||||
cmyk.insert("mode".into(), json!("cmyk"));
|
||||
assert!(can_confirm(&cmyk));
|
||||
assert_eq!(params(&app, &cmyk).unwrap()["documents"], json!([3, 0, 1, 2]), "the active (last opened) one first");
|
||||
}
|
||||
|
||||
/// A document picked for two channels greys OK with the reason; a refused OK keeps the dialog
|
||||
/// open and merges nothing.
|
||||
#[test]
|
||||
fn repeated_picks_grey_ok_and_keep_the_dialog_open() {
|
||||
let mut app = app(3);
|
||||
let (a, b) = (id(&app, 0), id(&app, 1));
|
||||
let id = open(&mut app).unwrap();
|
||||
let d = app.ui.dialog_mut(id).unwrap();
|
||||
d.fields.insert("documents".into(), json!([a, a, b]));
|
||||
assert_eq!(problem(&d.fields), Some(REPEATED));
|
||||
assert!(!can_confirm(&d.fields));
|
||||
d.fields.insert("documents".into(), json!([a, b, 999_999]));
|
||||
assert_eq!(problem(&d.fields), Some(REPEATED), "a document the dialog did not offer");
|
||||
assert!(crate::dialogs::confirm(&mut app, id).is_err());
|
||||
assert!(app.ui.dialogs.iter().any(|d| d.id == id), "the dialog stays open");
|
||||
assert_eq!(app.session.documents().len(), 3, "nothing merged or closed");
|
||||
assert!(can_confirm(&Map::new()), "other dialogs are not affected");
|
||||
}
|
||||
|
||||
/// Documents moved while the dialog is open: OK still merges the ones picked, by id, into the
|
||||
/// channels picked for them.
|
||||
#[test]
|
||||
fn ok_merges_the_picked_documents_after_a_reorder() {
|
||||
let mut app = shaded(0);
|
||||
let (black, gray, white) = (id(&app, 0), id(&app, 1), id(&app, 2));
|
||||
let dialog = open(&mut app).unwrap();
|
||||
app.ui.dialog_mut(dialog).unwrap().fields.insert("documents".into(), json!([black, white, gray]));
|
||||
// A script reorders the tabs while the dialog is open: white first, black last.
|
||||
app.session.execute("document.move", json!({"document": 2, "to": 0})).unwrap();
|
||||
app.session.execute("document.move", json!({"document": 1, "to": 2})).unwrap();
|
||||
assert_eq!([id(&app, 0), id(&app, 1), id(&app, 2)], [white, gray, black]);
|
||||
crate::dialogs::confirm(&mut app, dialog).unwrap();
|
||||
assert_eq!((app.session.documents().len(), app.session.active().unwrap().doc.mode), (1, ColorMode::Rgb));
|
||||
assert_eq!(merged_pixel(&app), [0, 255, 128], "red, green and blue from the documents picked, not their old tabs");
|
||||
}
|
||||
|
||||
/// A picked document closed while the dialog is open: OK refuses with the reason, keeps the
|
||||
/// dialog and closes nothing, even when another same-size grayscale document took its tab.
|
||||
#[test]
|
||||
fn a_closed_pick_is_refused_and_no_other_document_merges() {
|
||||
let mut app = shaded(0);
|
||||
app.run("file.new", json!({"width": 8, "height": 8, "mode": "grayscale"})).unwrap();
|
||||
app.session.set_active(0);
|
||||
let spare = id(&app, 3);
|
||||
let dialog = open(&mut app).unwrap();
|
||||
let picked: Vec<u64> = (0..3).map(|i| id(&app, i)).collect();
|
||||
app.ui.dialog_mut(dialog).unwrap().fields.insert("documents".into(), json!(picked));
|
||||
app.session.execute("file.close", json!({"document": 1})).unwrap();
|
||||
assert_eq!(id(&app, 2), spare, "the spare document is where a picked one was");
|
||||
let why = crate::dialogs::confirm(&mut app, dialog).unwrap_err();
|
||||
assert_eq!(why, CLOSED);
|
||||
let d = app.ui.dialogs.iter().find(|d| d.id == dialog).expect("the dialog stays open");
|
||||
assert_eq!(d.fields["__error"], json!(CLOSED), "with the reason under the pickers");
|
||||
assert_eq!(app.session.documents().len(), 3, "nothing merged or closed");
|
||||
assert!(app.session.documents().iter().any(|d| d.doc.id.0 == spare));
|
||||
}
|
||||
|
||||
/// A picked document turned into another mode while the dialog is open is refused too; should
|
||||
/// the engine refuse a merge after OK, the dialog comes back with the reason.
|
||||
#[test]
|
||||
fn a_changed_pick_or_a_refused_merge_keeps_the_dialog() {
|
||||
let mut app = app(3);
|
||||
let dialog = open(&mut app).unwrap();
|
||||
let f = app.ui.dialog_mut(dialog).unwrap().fields.clone();
|
||||
app.run("image.mode.rgb", json!({})).unwrap();
|
||||
assert_eq!(crate::dialogs::confirm(&mut app, dialog).unwrap_err(), CHANGED);
|
||||
assert!(app.ui.dialogs.iter().any(|d| d.id == dialog));
|
||||
app.ui.dialogs.clear();
|
||||
assert!(confirm(&mut app, &f).is_err());
|
||||
let again = &app.ui.dialogs.last().expect("the dialog again").fields;
|
||||
assert!(owns(again) && again["__error"].is_string());
|
||||
assert_eq!(app.session.documents().len(), 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn body_renders_every_mode_and_the_reason() {
|
||||
let app = app(4);
|
||||
let ids: Vec<u64> = (0..4).map(|i| id(&app, i)).collect();
|
||||
let ctx = egui::Context::default();
|
||||
crate::theme::install_fonts(&ctx);
|
||||
for (mode, docs, error) in
|
||||
[("rgb", json!(ids[..3]), None), ("cmyk", json!([ids[0], ids[1], ids[2], ids[2]]), None), ("lab", json!(ids[1..]), Some(CLOSED))]
|
||||
{
|
||||
let mut f = fields(&app).unwrap();
|
||||
f.insert("mode".into(), json!(mode));
|
||||
f.insert("documents".into(), docs);
|
||||
if let Some(e) = error {
|
||||
f.insert("__error".into(), json!(e));
|
||||
}
|
||||
ctx.run_ui(Default::default(), |ui| body(ui, &mut f)).textures_delta.clear();
|
||||
assert!(owns(&f));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
//! #11481: File › Export › Artboards to Files (and Layers / Layer Comps to Files) has a JPEG
|
||||
//! Quality field behind a Custom checkbox, as Batch has (#3956). The quality reaches the command
|
||||
//! only for a JPEG with Custom on: left alone, an export writes what the command writes with no
|
||||
//! quality (the source JPEG's own quality, else the encoder default), a WebP stays lossless and
|
||||
//! PNG has none.
|
||||
use crate::PhotocraftApp;
|
||||
use egui::accesskit::Role;
|
||||
use egui::vec2;
|
||||
use egui_kittest::Harness;
|
||||
use egui_kittest::kittest::{NodeT, Queryable};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
const ARTBOARDS: &str = "file.export.artboardsToFiles";
|
||||
const EXPORTS: [&str; 3] = [ARTBOARDS, "file.export.layersToFiles", "file.export.layerCompsToFiles"];
|
||||
|
||||
fn harness() -> Harness<'static, PhotocraftApp> {
|
||||
let mut h = Harness::builder().with_size(vec2(1440.0, 900.0)).with_max_steps(64).build_eframe(|cc| {
|
||||
PhotocraftApp::setup_context(&cc.egui_ctx, Default::default());
|
||||
PhotocraftApp::new(photocraft_engine::Session::new(), Default::default())
|
||||
});
|
||||
let app = h.state_mut();
|
||||
app.run("file.new", json!({"width": 64, "height": 64})).unwrap();
|
||||
// A noisy layer inside the board, so the JPEG quality shows in the file.
|
||||
app.run("layer.new.layer", json!({})).unwrap();
|
||||
app.run("edit.fill", json!({"color": "#8A42B3"})).unwrap();
|
||||
app.run("filter.noise.addNoise", json!({"amount": 60})).unwrap();
|
||||
app.run("layer.new.artboardFromLayers", json!({"name": "Board"})).unwrap();
|
||||
app.run("layerComp.new", json!({"name": "Comp"})).unwrap();
|
||||
app.sync_views();
|
||||
h
|
||||
}
|
||||
|
||||
fn open(h: &mut Harness<'_, PhotocraftApp>, id: &str, dir: &str, format: &str) -> u64 {
|
||||
let ctx = h.ctx.clone();
|
||||
let dialog = crate::menus::invoke(h.state_mut(), &ctx, id, json!({})).unwrap()["dialog"].as_u64().unwrap();
|
||||
let fields = &mut h.state_mut().ui.dialog_mut(dialog).unwrap().fields;
|
||||
fields.insert("dir".into(), json!(dir));
|
||||
fields.insert("prefix".into(), json!("out"));
|
||||
fields.insert("format".into(), json!(format));
|
||||
h.run_steps(4);
|
||||
dialog
|
||||
}
|
||||
|
||||
fn params(h: &mut Harness<'_, PhotocraftApp>, dialog: u64) -> Value {
|
||||
crate::filter_dialog::params_of(&h.state_mut().ui.dialog_mut(dialog).unwrap().fields)
|
||||
}
|
||||
|
||||
fn exported(h: &mut Harness<'_, PhotocraftApp>, dialog: u64) -> Vec<u8> {
|
||||
let r = crate::dialogs::confirm(h.state_mut(), dialog).unwrap();
|
||||
std::fs::read(r["files"][0].as_str().unwrap()).unwrap()
|
||||
}
|
||||
|
||||
/// The same export run straight through the command, into `dir`.
|
||||
fn direct(h: &mut Harness<'_, PhotocraftApp>, dir: &str, format: &str, quality: Option<i64>) -> Vec<u8> {
|
||||
let mut p = json!({"dir": dir, "prefix": "out", "format": format});
|
||||
if let Some(q) = quality {
|
||||
p["quality"] = json!(q);
|
||||
}
|
||||
let r = h.state_mut().run(ARTBOARDS, p).unwrap();
|
||||
std::fs::read(r["files"][0].as_str().unwrap()).unwrap()
|
||||
}
|
||||
|
||||
/// Whether the Quality number field (not its row label) takes input.
|
||||
fn quality_enabled(h: &Harness<'_, PhotocraftApp>) -> bool {
|
||||
let fields: Vec<bool> =
|
||||
h.query_all_by_label("Quality").filter(|n| n.accesskit_node().role() != Role::Label).map(|n| !n.accesskit_node().is_disabled()).collect();
|
||||
assert!(!fields.is_empty(), "the dialog shows a Quality field");
|
||||
assert!(fields.iter().all(|e| *e == fields[0]), "{fields:?}");
|
||||
fields[0]
|
||||
}
|
||||
|
||||
/// Whether the Custom checkbox is ticked.
|
||||
fn custom_ticked(h: &Harness<'_, PhotocraftApp>) -> bool {
|
||||
h.get_by_role_and_label(Role::CheckBox, "Custom").accesskit_node().toggled() == Some(egui::accesskit::Toggled::True)
|
||||
}
|
||||
|
||||
/// The value the Quality field shows.
|
||||
fn shown_quality(h: &Harness<'_, PhotocraftApp>) -> Option<f64> {
|
||||
h.get_by_role_and_label(Role::SpinButton, "Quality").accesskit_node().numeric_value()
|
||||
}
|
||||
|
||||
fn tick_custom(h: &mut Harness<'_, PhotocraftApp>) {
|
||||
h.get_by_role_and_label(Role::CheckBox, "Custom").click();
|
||||
h.run_steps(2);
|
||||
}
|
||||
|
||||
/// Types `text` into the Quality field and commits it with Tab, as a user does.
|
||||
fn type_quality(h: &mut Harness<'_, PhotocraftApp>, text: &str) {
|
||||
h.get_by_role_and_label(Role::SpinButton, "Quality").click();
|
||||
h.run_steps(1);
|
||||
h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A);
|
||||
h.run_steps(1);
|
||||
for ch in text.chars() {
|
||||
h.event(egui::Event::Text(ch.to_string()));
|
||||
h.run_steps(1);
|
||||
}
|
||||
h.key_press(egui::Key::Tab);
|
||||
h.run_steps(2);
|
||||
}
|
||||
|
||||
/// Holds Alt, which turns Cancel into Reset, and clicks it.
|
||||
fn alt_reset(h: &mut Harness<'_, PhotocraftApp>) {
|
||||
let alt = egui::Modifiers::ALT;
|
||||
h.event(egui::Event::ModifiersChanged(alt));
|
||||
h.run_steps(2);
|
||||
let at = h.get_by_label("Reset").rect().center();
|
||||
h.event(egui::Event::PointerMoved(at));
|
||||
h.run_steps(1);
|
||||
for pressed in [true, false] {
|
||||
h.event(egui::Event::PointerButton { pos: at, button: egui::PointerButton::Primary, pressed, modifiers: alt });
|
||||
h.run_steps(1);
|
||||
}
|
||||
h.event(egui::Event::ModifiersChanged(egui::Modifiers::NONE));
|
||||
h.run_steps(3);
|
||||
}
|
||||
|
||||
fn tmp() -> (tempfile::TempDir, String) {
|
||||
let t = tempfile::tempdir().unwrap();
|
||||
let s = t.path().to_string_lossy().into_owned();
|
||||
(t, s)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn artboards_to_files_sends_a_custom_jpeg_quality() {
|
||||
let mut h = harness();
|
||||
let (_a, via_dialog) = tmp();
|
||||
let (_b, via_command) = tmp();
|
||||
let mut sizes = Vec::new();
|
||||
for quality in [0, 3, 12] {
|
||||
let dialog = open(&mut h, ARTBOARDS, &via_dialog, "jpg");
|
||||
assert!(!custom_ticked(&h) && !quality_enabled(&h), "JPEG with Custom off: the field is greyed out");
|
||||
tick_custom(&mut h);
|
||||
assert!(custom_ticked(&h) && quality_enabled(&h), "JPEG with Custom on: the field takes input");
|
||||
assert_eq!(params(&mut h, dialog)["quality"], json!(10), "Custom starts at quality 10");
|
||||
type_quality(&mut h, &quality.to_string());
|
||||
assert_eq!(shown_quality(&h), Some(quality as f64), "the field shows the typed quality");
|
||||
assert_eq!(params(&mut h, dialog)["quality"], json!(quality), "the typed quality reaches the command");
|
||||
let bytes = exported(&mut h, dialog);
|
||||
assert!(bytes == direct(&mut h, &via_command, "jpg", Some(quality)), "quality {quality}: the file the command writes at that quality");
|
||||
sizes.push(bytes.len());
|
||||
}
|
||||
assert!(sizes[0] < sizes[1] && sizes[1] < sizes[2], "a higher quality writes a bigger JPEG: {sizes:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn an_untouched_jpeg_export_writes_what_the_command_writes_with_no_quality() {
|
||||
let mut h = harness();
|
||||
let (_a, via_dialog) = tmp();
|
||||
let (_b, via_command) = tmp();
|
||||
let dialog = open(&mut h, ARTBOARDS, &via_dialog, "jpg");
|
||||
assert!(params(&mut h, dialog).get("quality").is_none_or(Value::is_null), "no quality is sent");
|
||||
let bytes = exported(&mut h, dialog);
|
||||
assert!(bytes == direct(&mut h, &via_command, "jpg", None), "the untouched dialog keeps the command's own JPEG quality");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn export_to_files_quality_leaves_png_and_webp_as_they_were() {
|
||||
let mut h = harness();
|
||||
let (_a, dir) = tmp();
|
||||
for id in EXPORTS {
|
||||
for format in ["png", "webp"] {
|
||||
let dialog = open(&mut h, id, &dir, format);
|
||||
// Custom on from an earlier JPEG choice still sends nothing for these formats.
|
||||
h.state_mut().ui.dialog_mut(dialog).unwrap().fields.insert("__jpegCustom".into(), json!(true));
|
||||
h.run_steps(2);
|
||||
assert!(!quality_enabled(&h), "{id} {format}: the field is greyed out");
|
||||
assert!(params(&mut h, dialog).get("quality").is_none_or(Value::is_null), "{id} {format}: no quality is sent");
|
||||
let bytes = exported(&mut h, dialog);
|
||||
if format == "webp" {
|
||||
// The default WebP stays lossless (a VP8L bitstream, not lossy VP8).
|
||||
assert!(bytes.windows(4).any(|w| w == b"VP8L"), "{id}: the WebP stays lossless");
|
||||
}
|
||||
}
|
||||
// Back to JPEG with Custom on, the field sends its quality again.
|
||||
let dialog = open(&mut h, id, &dir, "jpg");
|
||||
h.state_mut().ui.dialog_mut(dialog).unwrap().fields.insert("__jpegCustom".into(), json!(true));
|
||||
h.run_steps(2);
|
||||
assert!(quality_enabled(&h), "{id}");
|
||||
assert_eq!(params(&mut h, dialog)["quality"], json!(10), "{id}");
|
||||
crate::dialogs::cancel(h.state_mut(), dialog).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
/// A Custom quality survives a switch to another format and back in the same dialog.
|
||||
#[test]
|
||||
fn the_custom_quality_survives_a_format_round_trip() {
|
||||
let mut h = harness();
|
||||
let (_a, dir) = tmp();
|
||||
let dialog = open(&mut h, ARTBOARDS, &dir, "jpg");
|
||||
tick_custom(&mut h);
|
||||
type_quality(&mut h, "4");
|
||||
assert_eq!(params(&mut h, dialog)["quality"], json!(4));
|
||||
for format in ["png", "webp"] {
|
||||
h.state_mut().ui.dialog_mut(dialog).unwrap().fields.insert("format".into(), json!(format));
|
||||
h.run_steps(2);
|
||||
assert!(!quality_enabled(&h), "{format}: the field is greyed out");
|
||||
assert!(params(&mut h, dialog)["quality"].is_null(), "{format}: no quality is sent");
|
||||
h.state_mut().ui.dialog_mut(dialog).unwrap().fields.insert("format".into(), json!("jpg"));
|
||||
h.run_steps(2);
|
||||
assert!(custom_ticked(&h) && quality_enabled(&h), "back from {format}: Custom is still on");
|
||||
assert_eq!(shown_quality(&h), Some(4.0), "back from {format}: the field still shows 4");
|
||||
assert_eq!(params(&mut h, dialog)["quality"], json!(4), "back from {format}: quality 4 is sent");
|
||||
}
|
||||
}
|
||||
|
||||
/// Alt+Reset (Alt held, Cancel clicked as Reset) puts the Custom checkbox and its quality back to
|
||||
/// how the dialog opened, and keeps the dialog open.
|
||||
#[test]
|
||||
fn alt_reset_restores_the_custom_quality() {
|
||||
let mut h = harness();
|
||||
let ctx = h.ctx.clone();
|
||||
let dialog = crate::menus::invoke(h.state_mut(), &ctx, ARTBOARDS, json!({})).unwrap()["dialog"].as_u64().unwrap();
|
||||
// JPEG chosen in the dialog, after it opened: Reset puts the format back too.
|
||||
h.state_mut().ui.dialog_mut(dialog).unwrap().fields.insert("format".into(), json!("jpg"));
|
||||
h.run_steps(4);
|
||||
tick_custom(&mut h);
|
||||
type_quality(&mut h, "4");
|
||||
assert_eq!(params(&mut h, dialog)["quality"], json!(4));
|
||||
alt_reset(&mut h);
|
||||
assert!(h.state().ui.dialogs.iter().any(|d| d.id == dialog), "Reset keeps the dialog open");
|
||||
let p = params(&mut h, dialog);
|
||||
assert_eq!((&p["format"], &p["quality"]), (&json!("png"), &Value::Null), "the opening format, no quality");
|
||||
assert!(!custom_ticked(&h) && !quality_enabled(&h), "Custom is off again");
|
||||
assert_eq!(shown_quality(&h), Some(10.0), "the field shows the opening quality");
|
||||
// Choosing JPEG again still sends no quality until Custom is ticked.
|
||||
h.state_mut().ui.dialog_mut(dialog).unwrap().fields.insert("format".into(), json!("jpg"));
|
||||
h.run_steps(2);
|
||||
assert!(!custom_ticked(&h), "JPEG after Reset: Custom stays off");
|
||||
assert!(params(&mut h, dialog)["quality"].is_null(), "JPEG after Reset: no quality is sent");
|
||||
}
|
||||
@@ -3564,3 +3564,18 @@ curves Smooth تنعيم
|
||||
Pause For إيقاف مؤقت لمدة
|
||||
seconds ثانية
|
||||
Create a single history state إنشاء حالة سجل واحدة
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
New Channel… قناة جديدة…
|
||||
Duplicate Channel تكرار القناة
|
||||
Delete Channel حذف القناة
|
||||
New Spot Channel… قناة لون موضعي جديدة…
|
||||
Merge Spot Channel دمج قناة اللون الموضعي
|
||||
Channel Options… خيارات القناة…
|
||||
Split Channels تقسيم القنوات
|
||||
Merge Channels… دمج القنوات…
|
||||
Specify Channels: تحديد القنوات:
|
||||
Not enough grayscale documents for this mode. لا توجد مستندات كافية بتدرج الرمادي لهذا الوضع.
|
||||
Pick a different document for each channel. اختر مستندًا مختلفًا لكل قناة.
|
||||
A picked document is no longer open. أحد المستندات المختارة لم يعد مفتوحًا.
|
||||
A picked document is no longer a grayscale document of the same size. أحد المستندات المختارة لم يعد مستندًا بتدرج الرمادي بالحجم نفسه.
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4605,3 +4605,11 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
Stop Color Boja tačke
|
||||
Shapes can't use patterns yet Oblici još ne mogu koristiti uzorke
|
||||
Edit Brush… Uredi četkicu…
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
Channel Options… Opcije kanala…
|
||||
Specify Channels: Odredi kanale:
|
||||
Not enough grayscale documents for this mode. Nema dovoljno dokumenata u nijansama sive za ovaj način.
|
||||
Pick a different document for each channel. Odaberite drugi dokument za svaki kanal.
|
||||
A picked document is no longer open. Jedan odabrani dokument više nije otvoren.
|
||||
A picked document is no longer a grayscale document of the same size. Jedan odabrani dokument više nije dokument u nijansama sive iste veličine.
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4316,3 +4316,11 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
Replace Image… Nahradit obrázek…
|
||||
The frame is locked Rámeček je zamčený
|
||||
The frame is unavailable Rámeček není dostupný
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
Channel Options… Možnosti kanálu…
|
||||
Specify Channels: Určit kanály:
|
||||
Not enough grayscale documents for this mode. Pro tento režim není dost dokumentů ve stupních šedi.
|
||||
Pick a different document for each channel. Pro každý kanál vyberte jiný dokument.
|
||||
A picked document is no longer open. Jeden z vybraných dokumentů už není otevřený.
|
||||
A picked document is no longer a grayscale document of the same size. Jeden z vybraných dokumentů už není dokument ve stupních šedi stejné velikosti.
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4787,3 +4787,11 @@ cameraRaw White Balance: As Shot Hvidbalance: Som fotograferet
|
||||
Pause For Pause i
|
||||
seconds sekunder
|
||||
Create a single history state Opret én historiktilstand
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
Channel Options… Kanalindstillinger…
|
||||
Specify Channels: Angiv kanaler:
|
||||
Not enough grayscale documents for this mode. Der er ikke nok dokumenter i gråtoner til denne tilstand.
|
||||
Pick a different document for each channel. Vælg et andet dokument til hver kanal.
|
||||
A picked document is no longer open. Et af de valgte dokumenter er ikke længere åbent.
|
||||
A picked document is no longer a grayscale document of the same size. Et af de valgte dokumenter er ikke længere et dokument i gråtoner i samme størrelse.
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3602,3 +3602,18 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
The frame is unavailable Der Rahmen ist nicht verfügbar
|
||||
X X
|
||||
Y Y
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
New Channel… Neuer Kanal…
|
||||
Duplicate Channel Kanal duplizieren
|
||||
Delete Channel Kanal löschen
|
||||
New Spot Channel… Neuer Schmuckfarbenkanal…
|
||||
Merge Spot Channel Schmuckfarbenkanal zusammenfügen
|
||||
Channel Options… Kanaloptionen…
|
||||
Split Channels Kanäle teilen
|
||||
Merge Channels… Kanäle zusammenfügen…
|
||||
Specify Channels: Kanäle angeben:
|
||||
Not enough grayscale documents for this mode. Nicht genug Graustufen-Dokumente für diesen Modus.
|
||||
Pick a different document for each channel. Wählen Sie für jeden Kanal ein anderes Dokument.
|
||||
A picked document is no longer open. Ein ausgewähltes Dokument ist nicht mehr geöffnet.
|
||||
A picked document is no longer a grayscale document of the same size. Ein ausgewähltes Dokument ist kein Graustufen-Dokument derselben Größe mehr.
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4268,3 +4268,18 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
The frame is unavailable Το πλαίσιο δεν είναι διαθέσιμο
|
||||
X X
|
||||
Y Y
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
New Channel… Νέο κανάλι…
|
||||
Duplicate Channel Δημιουργία αντιγράφου καναλιού
|
||||
Delete Channel Διαγραφή καναλιού
|
||||
New Spot Channel… Νέο κανάλι πλακάτου χρώματος…
|
||||
Merge Spot Channel Συγχώνευση καναλιού πλακάτου χρώματος
|
||||
Channel Options… Επιλογές καναλιού…
|
||||
Split Channels Διαχωρισμός καναλιών
|
||||
Merge Channels… Συγχώνευση καναλιών…
|
||||
Specify Channels: Καθορισμός καναλιών:
|
||||
Not enough grayscale documents for this mode. Δεν υπάρχουν αρκετά έγγραφα σε κλίμακα του γκρι για αυτή τη λειτουργία.
|
||||
Pick a different document for each channel. Επιλέξτε διαφορετικό έγγραφο για κάθε κανάλι.
|
||||
A picked document is no longer open. Ένα από τα επιλεγμένα έγγραφα δεν είναι πλέον ανοιχτό.
|
||||
A picked document is no longer a grayscale document of the same size. Ένα από τα επιλεγμένα έγγραφα δεν είναι πλέον έγγραφο σε κλίμακα του γκρι ίδιου μεγέθους.
|
||||
|
Can't render this file because it contains an unexpected character in line 47 and column 53.
|
@@ -4477,3 +4477,11 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
Replace Image… Reemplazar imagen…
|
||||
The frame is locked El marco está bloqueado
|
||||
The frame is unavailable El marco no está disponible
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
Channel Options… Opciones de canal…
|
||||
Specify Channels: Especificar canales:
|
||||
Not enough grayscale documents for this mode. No hay suficientes documentos en escala de grises para este modo.
|
||||
Pick a different document for each channel. Elija un documento distinto para cada canal.
|
||||
A picked document is no longer open. Uno de los documentos elegidos ya no está abierto.
|
||||
A picked document is no longer a grayscale document of the same size. Uno de los documentos elegidos ya no es un documento en escala de grises del mismo tamaño.
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 47.
|
@@ -4788,3 +4788,11 @@ cameraRaw White Balance: As Shot Valkotasapaino: kuvauksen mukainen
|
||||
Pause For Tauko
|
||||
seconds sekuntia
|
||||
Create a single history state Luo yksi historiatila
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
Channel Options… Kanavan asetukset…
|
||||
Specify Channels: Määritä kanavat:
|
||||
Not enough grayscale documents for this mode. Harmaasävyasiakirjoja ei ole tarpeeksi tähän tilaan.
|
||||
Pick a different document for each channel. Valitse jokaiselle kanavalle eri asiakirja.
|
||||
A picked document is no longer open. Yksi valituista asiakirjoista ei ole enää auki.
|
||||
A picked document is no longer a grayscale document of the same size. Yksi valituista asiakirjoista ei ole enää samankokoinen harmaasävyasiakirja.
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4600,3 +4600,11 @@ shape Appearance Apparence
|
||||
Replace Image… Remplacer l’image…
|
||||
The frame is locked Le cadre est verrouillé
|
||||
The frame is unavailable Le cadre n’est pas disponible
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
Channel Options… Options de canal…
|
||||
Specify Channels: Indiquer les canaux :
|
||||
Not enough grayscale documents for this mode. Pas assez de documents en niveaux de gris pour ce mode.
|
||||
Pick a different document for each channel. Choisissez un document différent pour chaque canal.
|
||||
A picked document is no longer open. Un des documents choisis n'est plus ouvert.
|
||||
A picked document is no longer a grayscale document of the same size. Un des documents choisis n'est plus un document en niveaux de gris de même taille.
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -645,3 +645,18 @@ cameraRaw Yellow पीला
|
||||
Pause For इतने समय रुकें
|
||||
seconds सेकंड
|
||||
Create a single history state एक ही इतिहास स्थिति बनाएँ
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
New Channel… नया चैनल…
|
||||
Duplicate Channel चैनल को डुप्लीकेट करें
|
||||
Delete Channel चैनल हटाएँ
|
||||
New Spot Channel… नया स्पॉट चैनल…
|
||||
Merge Spot Channel स्पॉट चैनल मर्ज करें
|
||||
Channel Options… चैनल विकल्प…
|
||||
Split Channels चैनल्स विभाजित करें
|
||||
Merge Channels… चैनल्स मर्ज करें…
|
||||
Specify Channels: चैनल्स निर्दिष्ट करें:
|
||||
Not enough grayscale documents for this mode. इस मोड के लिए पर्याप्त ग्रेस्केल डॉक्यूमेंट नहीं हैं।
|
||||
Pick a different document for each channel. हर चैनल के लिए अलग डॉक्यूमेंट चुनें।
|
||||
A picked document is no longer open. चुना गया एक डॉक्यूमेंट अब खुला नहीं है।
|
||||
A picked document is no longer a grayscale document of the same size. चुना गया एक डॉक्यूमेंट अब उसी आकार का ग्रेस्केल डॉक्यूमेंट नहीं है।
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4484,3 +4484,11 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
Replace Image… Kép cseréje…
|
||||
The frame is locked A keret zárolva van
|
||||
The frame is unavailable A keret nem érhető el
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
Channel Options… Csatornabeállítások…
|
||||
Specify Channels: Csatornák megadása:
|
||||
Not enough grayscale documents for this mode. Nincs elég szürkeárnyalatos dokumentum ehhez a módhoz.
|
||||
Pick a different document for each channel. Minden csatornához másik dokumentumot válasszon.
|
||||
A picked document is no longer open. Az egyik kiválasztott dokumentum már nincs megnyitva.
|
||||
A picked document is no longer a grayscale document of the same size. Az egyik kiválasztott dokumentum már nem azonos méretű szürkeárnyalatos dokumentum.
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3590,3 +3590,18 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
The frame is locked Bingkai terkunci
|
||||
The frame is unavailable Bingkai tidak tersedia
|
||||
Frame Bingkai
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
New Channel… Channel Baru…
|
||||
Duplicate Channel Duplikat Channel
|
||||
Delete Channel Hapus Channel
|
||||
New Spot Channel… Spot Channel Baru…
|
||||
Merge Spot Channel Gabungkan Spot Channel
|
||||
Channel Options… Opsi Channel…
|
||||
Split Channels Pisahkan Channel
|
||||
Merge Channels… Gabungkan Channel…
|
||||
Specify Channels: Tentukan Channel:
|
||||
Not enough grayscale documents for this mode. Dokumen grayscale tidak cukup untuk mode ini.
|
||||
Pick a different document for each channel. Pilih dokumen yang berbeda untuk setiap channel.
|
||||
A picked document is no longer open. Salah satu dokumen yang dipilih sudah tidak terbuka.
|
||||
A picked document is no longer a grayscale document of the same size. Salah satu dokumen yang dipilih bukan lagi dokumen grayscale dengan ukuran yang sama.
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 47.
|
@@ -4676,3 +4676,11 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
Replace Image… Sostituisci immagine…
|
||||
The frame is locked La cornice è bloccata
|
||||
The frame is unavailable La cornice non è disponibile
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
Channel Options… Opzioni canale…
|
||||
Specify Channels: Specifica canali:
|
||||
Not enough grayscale documents for this mode. Documenti in scala di grigio insufficienti per questo metodo.
|
||||
Pick a different document for each channel. Scegli un documento diverso per ogni canale.
|
||||
A picked document is no longer open. Uno dei documenti scelti non è più aperto.
|
||||
A picked document is no longer a grayscale document of the same size. Uno dei documenti scelti non è più un documento in scala di grigio delle stesse dimensioni.
|
||||
|
Can't render this file because it contains an unexpected character in line 79 and column 53.
|
@@ -4245,3 +4245,11 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
Replace Image… 画像を置き換え…
|
||||
The frame is locked フレームはロックされています
|
||||
The frame is unavailable フレームを利用できません
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
Channel Options… チャンネルオプション…
|
||||
Specify Channels: チャンネルを指定:
|
||||
Not enough grayscale documents for this mode. このモードに必要なグレースケールのドキュメントが足りません。
|
||||
Pick a different document for each channel. チャンネルごとに別のドキュメントを選択してください。
|
||||
A picked document is no longer open. 選択したドキュメントの一つが開かれていません。
|
||||
A picked document is no longer a grayscale document of the same size. 選択したドキュメントの一つが、同じサイズのグレースケールのドキュメントではなくなりました。
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3793,3 +3793,18 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
The frame is unavailable 프레임을 사용할 수 없습니다
|
||||
X X
|
||||
Y Y
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
New Channel… 새 채널…
|
||||
Duplicate Channel 채널 복제
|
||||
Delete Channel 채널 삭제
|
||||
New Spot Channel… 새 별색 채널…
|
||||
Merge Spot Channel 별색 채널 병합
|
||||
Channel Options… 채널 옵션…
|
||||
Split Channels 채널 분할
|
||||
Merge Channels… 채널 병합…
|
||||
Specify Channels: 채널 지정:
|
||||
Not enough grayscale documents for this mode. 이 모드에 필요한 회색 음영 문서가 부족합니다.
|
||||
Pick a different document for each channel. 채널마다 다른 문서를 선택하십시오.
|
||||
A picked document is no longer open. 선택한 문서 중 하나가 더 이상 열려 있지 않습니다.
|
||||
A picked document is no longer a grayscale document of the same size. 선택한 문서 중 하나가 더 이상 같은 크기의 회색 음영 문서가 아닙니다.
|
||||
|
Can't render this file because it contains an unexpected character in line 63 and column 53.
|
@@ -4787,3 +4787,11 @@ cameraRaw White Balance: As Shot Hvitbalanse: som fotografert
|
||||
Pause For Pause i
|
||||
seconds sekunder
|
||||
Create a single history state Opprett én historikktilstand
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
Channel Options… Kanalalternativer…
|
||||
Specify Channels: Angi kanaler:
|
||||
Not enough grayscale documents for this mode. Ikke nok dokumenter i gråtoner for denne modusen.
|
||||
Pick a different document for each channel. Velg et annet dokument for hver kanal.
|
||||
A picked document is no longer open. Et av de valgte dokumentene er ikke lenger åpent.
|
||||
A picked document is no longer a grayscale document of the same size. Et av de valgte dokumentene er ikke lenger et dokument i gråtoner av samme størrelse.
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4322,3 +4322,18 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
Replace Image… Afbeelding vervangen…
|
||||
The frame is locked Het kader is vergrendeld
|
||||
The frame is unavailable Het kader is niet beschikbaar
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
New Channel… Nieuw kanaal…
|
||||
Duplicate Channel Kanaal dupliceren
|
||||
Delete Channel Kanaal verwijderen
|
||||
New Spot Channel… Nieuw steunkleurkanaal…
|
||||
Merge Spot Channel Steunkleurkanaal samenvoegen
|
||||
Channel Options… Kanaalopties…
|
||||
Split Channels Kanalen splitsen
|
||||
Merge Channels… Kanalen samenvoegen…
|
||||
Specify Channels: Kanalen opgeven:
|
||||
Not enough grayscale documents for this mode. Niet genoeg grijswaardendocumenten voor deze modus.
|
||||
Pick a different document for each channel. Kies voor elk kanaal een ander document.
|
||||
A picked document is no longer open. Een gekozen document is niet meer geopend.
|
||||
A picked document is no longer a grayscale document of the same size. Een gekozen document is geen grijswaardendocument van hetzelfde formaat meer.
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 34.
|
@@ -4185,3 +4185,18 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
Replace Image… Zastąp obraz…
|
||||
The frame is locked Ramka jest zablokowana
|
||||
The frame is unavailable Ramka jest niedostępna
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
New Channel… Nowy kanał…
|
||||
Duplicate Channel Duplikuj kanał
|
||||
Delete Channel Usuń kanał
|
||||
New Spot Channel… Nowy kanał kolorów dodatkowych…
|
||||
Merge Spot Channel Scal kanał kolorów dodatkowych
|
||||
Channel Options… Opcje kanału…
|
||||
Split Channels Podziel kanały
|
||||
Merge Channels… Scal kanały…
|
||||
Specify Channels: Określ kanały:
|
||||
Not enough grayscale documents for this mode. Za mało dokumentów w skali szarości dla tego trybu.
|
||||
Pick a different document for each channel. Wybierz inny dokument dla każdego kanału.
|
||||
A picked document is no longer open. Jeden z wybranych dokumentów nie jest już otwarty.
|
||||
A picked document is no longer a grayscale document of the same size. Jeden z wybranych dokumentów nie jest już dokumentem w skali szarości o tym samym rozmiarze.
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4491,3 +4491,11 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
Replace Image… Substituir imagem…
|
||||
The frame is locked A moldura está bloqueada
|
||||
The frame is unavailable A moldura não está disponível
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
Channel Options… Opções de canal…
|
||||
Specify Channels: Especificar canais:
|
||||
Not enough grayscale documents for this mode. Não há documentos em tons de cinza suficientes para este modo.
|
||||
Pick a different document for each channel. Escolha um documento diferente para cada canal.
|
||||
A picked document is no longer open. Um dos documentos escolhidos não está mais aberto.
|
||||
A picked document is no longer a grayscale document of the same size. Um dos documentos escolhidos não é mais um documento em tons de cinza do mesmo tamanho.
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4762,3 +4762,11 @@ shape Appearance Оформление
|
||||
Replace Image… Заменить изображение…
|
||||
The frame is locked Рамка заблокирована
|
||||
The frame is unavailable Рамка недоступна
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
Channel Options… Параметры канала…
|
||||
Specify Channels: Указать каналы:
|
||||
Not enough grayscale documents for this mode. Недостаточно документов в градациях серого для этого режима.
|
||||
Pick a different document for each channel. Выберите отдельный документ для каждого канала.
|
||||
A picked document is no longer open. Один из выбранных документов больше не открыт.
|
||||
A picked document is no longer a grayscale document of the same size. Один из выбранных документов больше не является документом в градациях серого того же размера.
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4643,3 +4643,11 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
Replace Image… Замени слику…
|
||||
The frame is locked Оквир је закључан
|
||||
The frame is unavailable Оквир није доступан
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
Channel Options… Opcije kanala…
|
||||
Specify Channels: Odredi kanale:
|
||||
Not enough grayscale documents for this mode. Nema dovoljno dokumenata u nijansama sive za ovaj režim.
|
||||
Pick a different document for each channel. Izaberite drugi dokument za svaki kanal.
|
||||
A picked document is no longer open. Jedan izabrani dokument više nije otvoren.
|
||||
A picked document is no longer a grayscale document of the same size. Jedan izabrani dokument više nije dokument u nijansama sive iste veličine.
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4785,3 +4785,11 @@ cameraRaw White Balance: As Shot Vitbalans: som tagen
|
||||
Pause For Paus i
|
||||
seconds sekunder
|
||||
Create a single history state Skapa ett enda historikläge
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
Channel Options… Kanalalternativ…
|
||||
Specify Channels: Ange kanaler:
|
||||
Not enough grayscale documents for this mode. Det finns inte tillräckligt många gråskaledokument för det här läget.
|
||||
Pick a different document for each channel. Välj ett annat dokument för varje kanal.
|
||||
A picked document is no longer open. Ett av de valda dokumenten är inte längre öppet.
|
||||
A picked document is no longer a grayscale document of the same size. Ett av de valda dokumenten är inte längre ett gråskaledokument i samma storlek.
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -4299,3 +4299,18 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
Replace Image… Görüntüyü Değiştir…
|
||||
The frame is locked Çerçeve kilitli
|
||||
The frame is unavailable Çerçeve kullanılamıyor
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
New Channel… Yeni Kanal…
|
||||
Duplicate Channel Kanalı Çoğalt
|
||||
Delete Channel Kanalı Sil
|
||||
New Spot Channel… Yeni Spot Kanal…
|
||||
Merge Spot Channel Spot Kanalı Birleştir
|
||||
Channel Options… Kanal Seçenekleri…
|
||||
Split Channels Kanalları Ayır
|
||||
Merge Channels… Kanalları Birleştir…
|
||||
Specify Channels: Kanalları Belirt:
|
||||
Not enough grayscale documents for this mode. Bu mod için yeterli gri tonlamalı belge yok.
|
||||
Pick a different document for each channel. Her kanal için farklı bir belge seçin.
|
||||
A picked document is no longer open. Seçilen belgelerden biri artık açık değil.
|
||||
A picked document is no longer a grayscale document of the same size. Seçilen belgelerden biri artık aynı boyutta gri tonlamalı bir belge değil.
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 34.
|
@@ -4278,3 +4278,18 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
Replace Image… Замінити зображення…
|
||||
The frame is locked Рамку заблоковано
|
||||
The frame is unavailable Рамка недоступна
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
New Channel… Новий канал…
|
||||
Duplicate Channel Дублювати канал
|
||||
Delete Channel Видалити канал
|
||||
New Spot Channel… Новий канал плашкового кольору…
|
||||
Merge Spot Channel Об'єднати канал плашкового кольору
|
||||
Channel Options… Параметри каналу…
|
||||
Split Channels Розділити канали
|
||||
Merge Channels… Об'єднати канали…
|
||||
Specify Channels: Вказати канали:
|
||||
Not enough grayscale documents for this mode. Недостатньо документів у градаціях сірого для цього режиму.
|
||||
Pick a different document for each channel. Виберіть окремий документ для кожного каналу.
|
||||
A picked document is no longer open. Один із вибраних документів більше не відкрито.
|
||||
A picked document is no longer a grayscale document of the same size. Один із вибраних документів більше не є документом у градаціях сірого того самого розміру.
|
||||
|
Can't render this file because it contains an unexpected character in line 152 and column 53.
|
@@ -4078,3 +4078,11 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
Replace Image… Thay ảnh…
|
||||
The frame is locked Khung đã bị khóa
|
||||
The frame is unavailable Khung không khả dụng
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
Channel Options… Tùy chọn kênh…
|
||||
Specify Channels: Chỉ định kênh:
|
||||
Not enough grayscale documents for this mode. Không đủ tài liệu thang xám cho chế độ này.
|
||||
Pick a different document for each channel. Chọn một tài liệu khác cho mỗi kênh.
|
||||
A picked document is no longer open. Một tài liệu đã chọn không còn mở.
|
||||
A picked document is no longer a grayscale document of the same size. Một tài liệu đã chọn không còn là tài liệu thang xám cùng kích thước.
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -3259,3 +3259,18 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
Frame 框架
|
||||
X X
|
||||
Y Y
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
New Channel… 新建通道…
|
||||
Duplicate Channel 复制通道
|
||||
Delete Channel 删除通道
|
||||
New Spot Channel… 新建专色通道…
|
||||
Merge Spot Channel 合并专色通道
|
||||
Channel Options… 通道选项…
|
||||
Split Channels 分离通道
|
||||
Merge Channels… 合并通道…
|
||||
Specify Channels: 指定通道:
|
||||
Not enough grayscale documents for this mode. 灰度文档不足,无法使用此模式。
|
||||
Pick a different document for each channel. 请为每个通道选择不同的文档。
|
||||
A picked document is no longer open. 所选的一个文档已不再打开。
|
||||
A picked document is no longer a grayscale document of the same size. 所选的一个文档已不再是同样大小的灰度文档。
|
||||
|
Can't render this file because it contains an unexpected character in line 63 and column 53.
|
@@ -3215,3 +3215,18 @@ smartSvg AI/PDF/EPS contents will be edited as SVG. Saving replaces the embedded
|
||||
Frame 框架
|
||||
X X
|
||||
Y Y
|
||||
|
||||
# Channels panel menu (#11451)
|
||||
New Channel… 新增色版…
|
||||
Duplicate Channel 複製色版
|
||||
Delete Channel 刪除色版
|
||||
New Spot Channel… 新增特別色色版…
|
||||
Merge Spot Channel 合併特別色色版
|
||||
Channel Options… 色版選項…
|
||||
Split Channels 分離色版
|
||||
Merge Channels… 合併色版…
|
||||
Specify Channels: 指定色版:
|
||||
Not enough grayscale documents for this mode. 灰階文件不足,無法使用此模式。
|
||||
Pick a different document for each channel. 請為每個色版選擇不同的文件。
|
||||
A picked document is no longer open. 所選的一個文件已不再開啟。
|
||||
A picked document is no longer a grayscale document of the same size. 所選的一個文件已不再是相同大小的灰階文件。
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -927,6 +927,8 @@ mod window_frame_tests;
|
||||
#[cfg(test)]
|
||||
mod browse_field_tests;
|
||||
#[cfg(test)]
|
||||
mod export_quality_tests;
|
||||
#[cfg(test)]
|
||||
mod options_hit_area_tests;
|
||||
#[cfg(test)]
|
||||
mod select_and_mask_button_tests;
|
||||
|
||||
@@ -415,20 +415,36 @@ pub(crate) fn invoke_unguarded(app: &mut PhotocraftApp, ctx: &egui::Context, id:
|
||||
Ok(json!({"dialog": crate::new_group_ui::open(app, id)}))
|
||||
}
|
||||
// Channels › Channel Options… without params: the dialog on the targeted alpha/spot
|
||||
// channel, Layer Mask Display Options on a targeted layer mask, or Quick Mask Options while
|
||||
// in Quick Mask (with params: the engine directly).
|
||||
// channel (also in Quick Mask mode, where its row is the selected one), Quick Mask Options
|
||||
// in Quick Mask otherwise, or Layer Mask Display Options on a targeted layer mask (with
|
||||
// params: the engine directly).
|
||||
crate::channel_options_ui::COMMAND if params.as_object().is_none_or(|o| o.is_empty()) => {
|
||||
let mask = app.layer_mask_targeted();
|
||||
let st = app.session.active().ok_or("no document is open")?;
|
||||
let channel = match st.channel_view.target {
|
||||
_ if st.doc.quick_mask.is_some() => json!("quickMask"),
|
||||
photocraft_engine::channel_cmds::ChannelTarget::Alpha(i) => json!(i),
|
||||
_ if st.doc.quick_mask.is_some() => json!("quickMask"),
|
||||
_ if mask => json!("mask"),
|
||||
_ => return Err("target an alpha or spot channel, or a layer mask, first".into()),
|
||||
};
|
||||
let dialog = crate::channel_options_ui::open(app, &channel).ok_or("no such channel")?;
|
||||
Ok(json!({"dialog": dialog}))
|
||||
}
|
||||
// Channels › New Channel… without params: its dialog (with params: the engine). The
|
||||
// panel's New button makes one at once, as Photoshop's does.
|
||||
crate::channel_options_ui::NEW_CHANNEL if params.as_object().is_none_or(|o| o.is_empty()) => {
|
||||
let dialog = crate::channel_options_ui::open_new_channel(app).ok_or("no document is open")?;
|
||||
Ok(json!({"dialog": dialog}))
|
||||
}
|
||||
// Channels › Merge Channels… without params: its dialog, which picks the mode and the
|
||||
// documents (with params: the engine).
|
||||
crate::dialogs::merge_channels_ui::COMMAND if params.as_object().is_none_or(|o| o.is_empty()) => {
|
||||
if let Some(Err(why)) = photocraft_engine::commands::find(id).map(|c| (c.enabled)(&app.session)) {
|
||||
return Err(why);
|
||||
}
|
||||
let dialog = crate::dialogs::merge_channels_ui::open(app).ok_or("no document is open")?;
|
||||
Ok(json!({"dialog": dialog}))
|
||||
}
|
||||
// Channels › New Spot Channel… without params: its dialog (with params: the engine).
|
||||
crate::channel_options_ui::NEW_SPOT if params.as_object().is_none_or(|o| o.is_empty()) => {
|
||||
let dialog = crate::channel_options_ui::open_new_spot(app).ok_or("no document is open")?;
|
||||
|
||||
@@ -66,8 +66,10 @@ pub(super) fn form(app: &mut PhotocraftApp, command: &str, label: &str, fields:
|
||||
if let Value::Object(m) = fields {
|
||||
f.extend(m);
|
||||
}
|
||||
// Snapshot user-facing params at open so Alt+Reset can restore them.
|
||||
let orig: Map<String, Value> = f.iter().filter(|(k, _)| !k.starts_with("__")).map(|(k, v)| (k.clone(), v.clone())).collect();
|
||||
// Snapshot user-facing params at open so Alt+Reset can restore them, with the Custom
|
||||
// quality rows' inactive state.
|
||||
let orig: Map<String, Value> =
|
||||
f.iter().filter(|(k, _)| !k.starts_with("__") || RESET_SHELL_KEYS.contains(&k.as_str())).map(|(k, v)| (k.clone(), v.clone())).collect();
|
||||
f.insert("__formOrig".into(), Value::Object(orig));
|
||||
app.ui.open_dialog(DialogKind::Command, f)
|
||||
}
|
||||
@@ -166,18 +168,21 @@ pub fn form_body(ui: &mut egui::Ui, f: &mut Map<String, Value>) {
|
||||
if k == "quality" && f.get("__command").and_then(Value::as_str) == Some("file.automate.batch") {
|
||||
ui.label(label(&k));
|
||||
let mut custom = v.as_f64().is_some();
|
||||
let mut quality = v.as_f64().or_else(|| f.get("__batchQuality").and_then(Value::as_f64)).unwrap_or(8.0).clamp(0.0, 12.0) as f32;
|
||||
ui.horizontal(|ui| {
|
||||
crate::widgets::checkbox(ui, &mut custom, tl!("Custom"));
|
||||
ui.add_enabled_ui(custom, |ui| crate::widgets::value_field(ui, &mut quality, 0.0..=12.0, "", 74.0).accessible_name(tl!("Quality")));
|
||||
});
|
||||
let mut quality = v.as_f64().or_else(|| f.get(BATCH_QUALITY).and_then(Value::as_f64)).unwrap_or(8.0).clamp(0.0, 12.0) as f32;
|
||||
custom_quality_row(ui, &mut custom, &mut quality, true);
|
||||
// None preserves the command's existing JPEG and lossless WebP defaults.
|
||||
// The inactive custom value is shell state, never a command parameter.
|
||||
f.insert("__batchQuality".into(), json!(quality));
|
||||
f.insert(BATCH_QUALITY.into(), json!(quality));
|
||||
f.insert(k, if custom { json!(quality) } else { Value::Null });
|
||||
ui.end_row();
|
||||
continue;
|
||||
}
|
||||
if k == "quality" && f.contains_key(JPEG_QUALITY) {
|
||||
ui.label(label(&k));
|
||||
jpeg_quality_field(ui, f);
|
||||
ui.end_row();
|
||||
continue;
|
||||
}
|
||||
let new = match &v {
|
||||
Value::Array(_) | Value::Object(_) | Value::Null => continue,
|
||||
Value::Bool(b) => {
|
||||
@@ -246,6 +251,42 @@ pub fn form_body(ui: &mut egui::Ui, f: &mut Map<String, Value>) {
|
||||
camera_data(ui, f);
|
||||
}
|
||||
|
||||
/// Batch's inactive Custom quality (#3956): shell state, never a command parameter.
|
||||
const BATCH_QUALITY: &str = "__batchQuality";
|
||||
/// An export-to-files dialog's Custom checkbox and its quality (#11481), kept while the format
|
||||
/// is not JPEG or Custom is off: shell state, never command parameters.
|
||||
const JPEG_CUSTOM: &str = "__jpegCustom";
|
||||
const JPEG_QUALITY: &str = "__jpegQuality";
|
||||
/// The shell keys Alt+Reset restores along with a form's params.
|
||||
const RESET_SHELL_KEYS: [&str; 3] = [BATCH_QUALITY, JPEG_CUSTOM, JPEG_QUALITY];
|
||||
|
||||
/// A Custom checkbox and the 0..12 Quality field it enables (Batch, the exports to files). Off,
|
||||
/// the command gets no quality and keeps its own defaults; `usable` false greys out both.
|
||||
fn custom_quality_row(ui: &mut egui::Ui, custom: &mut bool, quality: &mut f32, usable: bool) {
|
||||
ui.add_enabled_ui(usable, |ui| {
|
||||
ui.horizontal(|ui| {
|
||||
crate::widgets::checkbox(ui, custom, tl!("Custom"));
|
||||
ui.add_enabled_ui(*custom, |ui| crate::widgets::value_field(ui, quality, 0.0..=12.0, "", 74.0).accessible_name(tl!("Quality")));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/// Layers, Layer Comps and Artboards to Files: the JPEG quality, sent only for a JPEG with Custom
|
||||
/// on. Left alone, the export writes what the command writes with no quality (the source JPEG's
|
||||
/// own quality, else the encoder default), as Batch does; a quality would also make a WebP lossy
|
||||
/// (its default is lossless), and PNG, PSD, TIFF and BMP have none.
|
||||
fn jpeg_quality_field(ui: &mut egui::Ui, f: &mut Map<String, Value>) {
|
||||
let jpeg = f.get("format").and_then(Value::as_str).is_some_and(|x| x.eq_ignore_ascii_case("jpg") || x.eq_ignore_ascii_case("jpeg"));
|
||||
let sent = f.get("quality").and_then(Value::as_f64);
|
||||
let mut custom = sent.is_some() || f.get(JPEG_CUSTOM).and_then(Value::as_bool).unwrap_or(false);
|
||||
let mut quality = sent.or_else(|| f.get(JPEG_QUALITY).and_then(Value::as_f64)).unwrap_or(10.0).clamp(0.0, 12.0) as f32;
|
||||
custom_quality_row(ui, &mut custom, &mut quality, jpeg);
|
||||
let quality = quality.round().clamp(0.0, 12.0) as i64;
|
||||
f.insert(JPEG_CUSTOM.into(), json!(custom));
|
||||
f.insert(JPEG_QUALITY.into(), json!(quality));
|
||||
f.insert("quality".into(), if jpeg && custom { json!(quality) } else { Value::Null });
|
||||
}
|
||||
|
||||
/// File Info's read-only Camera Data section (`__camera`, from the document's EXIF/XMP).
|
||||
fn camera_data(ui: &mut egui::Ui, f: &Map<String, Value>) {
|
||||
let Some(camera) = f.get("__camera").and_then(Value::as_object).filter(|c| !c.is_empty()) else { return };
|
||||
@@ -428,7 +469,8 @@ pub(super) fn front(app: &mut PhotocraftApp, ctx: &egui::Context, id: &str, para
|
||||
let (_, _, name) = doc?;
|
||||
dialog(
|
||||
app,
|
||||
json!({"dir": dir, "prefix": name.rsplit_once('.').map_or(name.as_str(), |(a, _)| a), "format": "png", "visibleOnly": true, "trim": false}),
|
||||
json!({"dir": dir, "prefix": name.rsplit_once('.').map_or(name.as_str(), |(a, _)| a), "format": "png", "quality": null, JPEG_CUSTOM: false,
|
||||
JPEG_QUALITY: 10, "visibleOnly": true, "trim": false, "__order": ["dir", "prefix", "visibleOnly", "format", "quality", "trim"]}),
|
||||
json!({"format": ["png", "jpg", "psd", "tiff", "webp", "bmp"]}),
|
||||
)
|
||||
}
|
||||
@@ -436,9 +478,10 @@ pub(super) fn front(app: &mut PhotocraftApp, ctx: &egui::Context, id: &str, para
|
||||
let (_, _, name) = doc?;
|
||||
let prefix = name.rsplit_once('.').map_or(name.as_str(), |(a, _)| a).to_string();
|
||||
let fields = if id == "file.export.layerCompsToFiles" {
|
||||
json!({"dir": dir, "prefix": prefix, "format": "png", "selectedOnly": false})
|
||||
json!({"dir": dir, "prefix": prefix, "format": "png", "quality": null, JPEG_CUSTOM: false, JPEG_QUALITY: 10, "selectedOnly": false,
|
||||
"__order": ["dir", "prefix", "selectedOnly", "format", "quality"]})
|
||||
} else {
|
||||
json!({"dir": dir, "prefix": prefix, "format": "png"})
|
||||
json!({"dir": dir, "prefix": prefix, "format": "png", "quality": null, JPEG_CUSTOM: false, JPEG_QUALITY: 10, "__order": ["dir", "prefix", "format", "quality"]})
|
||||
};
|
||||
dialog(app, fields, json!({"format": ["png", "jpg", "psd", "tiff", "webp", "bmp"]}))
|
||||
}
|
||||
|
||||
@@ -90,13 +90,15 @@ struct RowInteractions<'a> {
|
||||
masked: Option<&'a photocraft_doc::Layer>,
|
||||
actions: &'a mut Vec<(String, Value)>,
|
||||
mask_click: &'a mut Option<bool>,
|
||||
/// Whether Merge Channels… can run (enough grayscale documents of one size).
|
||||
merge_enabled: bool,
|
||||
}
|
||||
|
||||
fn handle_row_interactions(ui: &mut egui::Ui, mut row: RowInteractions<'_>) {
|
||||
let rename_id = egui::Id::unique(("chan-rename", row.doc.id.0, format!("{:?}", row.row.reference())));
|
||||
handle_channel_row_click(ui, &mut row);
|
||||
handle_channel_row_double_click(ui, &mut row, rename_id);
|
||||
row.response.context_menu(|ui| draw_row_menu(ui, row.row, row.doc, row.masked, row.actions));
|
||||
row.response.context_menu(|ui| draw_row_menu(ui, row.row, row.doc, row.masked, row.merge_enabled, row.actions));
|
||||
}
|
||||
|
||||
fn handle_channel_row_click(ui: &egui::Ui, row: &mut RowInteractions<'_>) {
|
||||
@@ -167,7 +169,14 @@ fn handle_alpha_double_click(ui: &mut egui::Ui, row: &mut RowInteractions<'_>, i
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_row_menu(ui: &mut egui::Ui, row: Row, doc: &photocraft_doc::Document, masked: Option<&photocraft_doc::Layer>, actions: &mut Vec<(String, Value)>) {
|
||||
fn draw_row_menu(
|
||||
ui: &mut egui::Ui,
|
||||
row: Row,
|
||||
doc: &photocraft_doc::Document,
|
||||
masked: Option<&photocraft_doc::Layer>,
|
||||
merge_enabled: bool,
|
||||
actions: &mut Vec<(String, Value)>,
|
||||
) {
|
||||
crate::widgets::menu_scroll(ui, |ui| {
|
||||
ui.set_min_width(210.0);
|
||||
match row {
|
||||
@@ -177,11 +186,11 @@ fn draw_row_menu(ui: &mut egui::Ui, row: Row, doc: &photocraft_doc::Document, ma
|
||||
Row::LayerMask => draw_mask_menu(ui, masked, actions),
|
||||
}
|
||||
ui.separator();
|
||||
item(ui, actions, "New Channel…", "channel.new", json!({}));
|
||||
item(ui, actions, "New Channel…", "ui.newChannel", json!({}));
|
||||
item(ui, actions, "New Spot Channel…", "ui.newSpotChannel", json!({}));
|
||||
ui.separator();
|
||||
item(ui, actions, "Split Channels", "channel.split", json!({}));
|
||||
item(ui, actions, "Merge Channels…", "channel.merge", json!({}));
|
||||
item_enabled(ui, actions, "Merge Channels…", "ui.mergeChannels", json!({}), merge_enabled);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -288,14 +297,14 @@ fn row_presentation(row: Row, context: &RowPresentationContext<'_>, mask_visible
|
||||
!context.view.quick_mask_hidden,
|
||||
context.view.target == ChannelTarget::Composite,
|
||||
),
|
||||
Row::LayerMask => {
|
||||
(context.masked.map_or_else(String::new, |layer| format!("{} Mask", layer.name)), usize::MAX, None, mask_visible, context.mask_targeted)
|
||||
}
|
||||
Row::LayerMask => (context.masked.map_or_else(String::new, mask_row_name), usize::MAX, None, mask_visible, context.mask_targeted),
|
||||
};
|
||||
RowPresentation { name, thumb_idx, slot, visible, selected }
|
||||
}
|
||||
|
||||
pub fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
// Greyed in the rows' menu as in the panel menu and the command palette.
|
||||
let merge_enabled = crate::menus::is_enabled(app, "channel.merge");
|
||||
let t = Tokens::get(ui.ctx());
|
||||
let Some(st) = app.session.active() else {
|
||||
ui.add_space(6.0);
|
||||
@@ -316,10 +325,7 @@ pub fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
// The active layer's mask (Photoshop lists it, in italics, below the colour channels).
|
||||
let masked = active_layer.and_then(|id| doc.layer(id)).filter(|l| l.mask.is_some());
|
||||
let mask_tex = masked.as_ref().and_then(|l| Some(app.mask_thumb(&ctx, &doc, l.id, l.mask.as_ref()?)));
|
||||
let mask_targeted = masked.is_some()
|
||||
&& (app.ui.mask_target || view.target == ChannelTarget::LayerMask)
|
||||
&& (view.target == ChannelTarget::Composite || view.target == ChannelTarget::LayerMask)
|
||||
&& !quick;
|
||||
let mask_targeted = mask_row_targeted(masked.is_some(), app.ui.mask_target, view.target, quick);
|
||||
// Multichannel images are their ink channels only (no composite or colour rows).
|
||||
let multichannel = doc.mode == photocraft_doc::ColorMode::Multichannel;
|
||||
let mut rows = if multichannel { Vec::new() } else { vec![Row::Composite] };
|
||||
@@ -436,6 +442,7 @@ pub fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
masked,
|
||||
actions: &mut actions,
|
||||
mask_click: &mut mask_click,
|
||||
merge_enabled,
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -467,13 +474,7 @@ pub fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
};
|
||||
// Photoshop's order from the left: Load as selection, Save selection, New, Delete.
|
||||
widgets::panel_footer(ui, |ui| {
|
||||
let target_ref = match view.target {
|
||||
ChannelTarget::Alpha(i) => json!(i),
|
||||
ChannelTarget::Color(k) => json!({ "color": k }),
|
||||
ChannelTarget::Composite => json!("composite"),
|
||||
ChannelTarget::LayerMask => json!("mask"),
|
||||
ChannelTarget::VectorMask => json!("vectorMask"),
|
||||
};
|
||||
let target_ref = target_reference(view.target);
|
||||
let trash = icons::button(ui, "trash", 26.0, false, tl!("Delete current channel"));
|
||||
if trash.clicked() {
|
||||
actions.push(("channel.delete".into(), json!({})));
|
||||
@@ -510,6 +511,20 @@ pub fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
// The row menu's New Channel… and Merge Channels… ask first, as the panel menu's do
|
||||
// (the footer's New button makes a channel at once).
|
||||
let asks = match id.as_str() {
|
||||
"ui.newChannel" => Some("channel.new"),
|
||||
"ui.mergeChannels" => Some("channel.merge"),
|
||||
_ => None,
|
||||
};
|
||||
if let Some(cmd) = asks {
|
||||
if let Err(e) = crate::menus::invoke(app, &ctx, cmd, json!({})) {
|
||||
app.ui.status = e;
|
||||
app.ui.status_error = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if id == "ui.newSpotChannel" {
|
||||
crate::channel_options_ui::open_new_spot(app);
|
||||
continue;
|
||||
@@ -526,6 +541,91 @@ pub fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
}
|
||||
}
|
||||
|
||||
/// The engine reference of the targeted channel (`channel.*` and `select.loadSelection` take it).
|
||||
fn target_reference(target: ChannelTarget) -> Value {
|
||||
match target {
|
||||
ChannelTarget::Alpha(i) => json!(i),
|
||||
ChannelTarget::Color(k) => json!({ "color": k }),
|
||||
ChannelTarget::Composite => json!("composite"),
|
||||
ChannelTarget::LayerMask => json!("mask"),
|
||||
ChannelTarget::VectorMask => json!("vectorMask"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the selected layer's mask row is the one shown targeted: the layer has a mask, and it
|
||||
/// (not the composite) is what painting edits, outside Quick Mask.
|
||||
fn mask_row_targeted(has_mask: bool, mask_target: bool, target: ChannelTarget, quick: bool) -> bool {
|
||||
has_mask && (mask_target || target == ChannelTarget::LayerMask) && matches!(target, ChannelTarget::Composite | ChannelTarget::LayerMask) && !quick
|
||||
}
|
||||
|
||||
/// The layer mask row's name, "<layer> Mask", as Photoshop lists it.
|
||||
fn mask_row_name(layer: &photocraft_doc::Layer) -> String {
|
||||
format!("{} Mask", layer.name)
|
||||
}
|
||||
|
||||
/// The Channels panel's own items at the top of its panel menu (☰, #11451), in Photoshop's
|
||||
/// order: New Channel…, Duplicate Channel, Delete Channel, New Spot Channel…, Merge Spot Channel,
|
||||
/// Channel Options…, Split Channels, Merge Channels…. The ones that act on one channel take the
|
||||
/// targeted row and are greyed without one (a colour composite, several colour channels). New
|
||||
/// Channel…, New Spot Channel…, Channel Options… and Merge Channels… open their dialogs, as from
|
||||
/// the command palette; Split Channels runs at once.
|
||||
pub fn panel_menu(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
use crate::layers_panel_ui::run_menu_command;
|
||||
let target = MenuTarget::of(app);
|
||||
run_menu_command(app, ui, tl!("New Channel…"), "channel.new", Some(json!({})));
|
||||
run_menu_command(app, ui, tl!("Duplicate Channel"), "channel.duplicate", target.duplicate);
|
||||
run_menu_command(app, ui, tl!("Delete Channel"), "channel.delete", target.alpha.map(|i| json!({ "channel": i })));
|
||||
ui.separator();
|
||||
run_menu_command(app, ui, tl!("New Spot Channel…"), "channel.newSpot", Some(json!({})));
|
||||
run_menu_command(app, ui, tl!("Merge Spot Channel"), "channel.mergeSpot", target.spot.map(|i| json!({ "channel": i })));
|
||||
run_menu_command(app, ui, tl!("Channel Options…"), "channel.options", target.options.then(|| json!({})));
|
||||
ui.separator();
|
||||
run_menu_command(app, ui, tl!("Split Channels"), "channel.split", Some(json!({})));
|
||||
run_menu_command(app, ui, tl!("Merge Channels…"), "channel.merge", Some(json!({})));
|
||||
}
|
||||
|
||||
/// What the panel menu's single-channel items act on: the targeted row.
|
||||
#[derive(Default)]
|
||||
struct MenuTarget {
|
||||
/// The `channel.duplicate` params: the targeted row as its footer's New button copies it.
|
||||
duplicate: Option<Value>,
|
||||
/// The targeted alpha or spot channel.
|
||||
alpha: Option<usize>,
|
||||
/// The targeted spot channel.
|
||||
spot: Option<usize>,
|
||||
/// Whether Channel Options… has something to show (an alpha / spot channel, Quick Mask or a
|
||||
/// layer mask), as the menu bar's command decides.
|
||||
options: bool,
|
||||
}
|
||||
|
||||
impl MenuTarget {
|
||||
fn of(app: &PhotocraftApp) -> Self {
|
||||
let mask = app.layer_mask_targeted();
|
||||
let Some(st) = app.session.active() else { return Self::default() };
|
||||
let view = &st.channel_view;
|
||||
let alpha = match view.target {
|
||||
ChannelTarget::Alpha(i) if i < st.doc.channels.len() => Some(i),
|
||||
_ => None,
|
||||
};
|
||||
let quick = st.doc.quick_mask.is_some();
|
||||
let masked = st.active_layer.and_then(|id| st.doc.layer(id)).filter(|l| l.mask.is_some());
|
||||
let duplicate = match view.target {
|
||||
// The composite targeted in Quick Mask mode: the Quick Mask row is the selected one.
|
||||
ChannelTarget::Composite if quick => Some(json!({ "channel": "quickMask" })),
|
||||
_ if mask_row_targeted(masked.is_some(), app.ui.mask_target, view.target, quick) => {
|
||||
masked.and_then(|layer| drop_action(Row::LayerMask, &mask_row_name(layer), Some(layer.id.0), Footer::New)).map(|(_, p)| p)
|
||||
}
|
||||
ChannelTarget::Alpha(_) if alpha.is_some() => Some(json!({ "channel": target_reference(view.target) })),
|
||||
ChannelTarget::Color(_) if view.selected_colors.len() <= 1 => Some(json!({ "channel": target_reference(view.target) })),
|
||||
// A one-channel image (Grayscale, Bitmap, Duotone): the composite is its channel.
|
||||
ChannelTarget::Composite if channel_cmds::color_count(&st.doc) == 1 => Some(json!({ "channel": "composite" })),
|
||||
_ => None,
|
||||
};
|
||||
let spot = alpha.filter(|&i| st.doc.channels.get(i).is_some_and(|c| c.spot.is_some()));
|
||||
Self { duplicate, alpha, spot, options: alpha.is_some() || quick || mask }
|
||||
}
|
||||
}
|
||||
|
||||
/// The footer buttons a row can be dropped on.
|
||||
#[derive(Clone, Copy)]
|
||||
enum Footer {
|
||||
@@ -575,7 +675,12 @@ pub fn fit_thumb(cell: Rect, w: u32, h: u32) -> (Rect, Rect) {
|
||||
}
|
||||
|
||||
fn item(ui: &mut egui::Ui, actions: &mut Vec<(String, Value)>, label: &str, cmd: &str, p: Value) {
|
||||
if ui.button(tl!(&label)).clicked() {
|
||||
item_enabled(ui, actions, label, cmd, p, true);
|
||||
}
|
||||
|
||||
/// [`item`], greyed unless `enabled`.
|
||||
fn item_enabled(ui: &mut egui::Ui, actions: &mut Vec<(String, Value)>, label: &str, cmd: &str, p: Value, enabled: bool) {
|
||||
if ui.add_enabled(enabled, egui::Button::new(tl!(&label))).clicked() {
|
||||
actions.push((cmd.into(), p));
|
||||
ui.close();
|
||||
}
|
||||
|
||||
@@ -440,3 +440,212 @@ fn recording_a_colour_row_click_saves_as_photoshop_select() {
|
||||
assert_eq!(reloaded, &vec![("channel.target".to_string(), json!({"channel": {"color": name}}))], "{mode}");
|
||||
}
|
||||
}
|
||||
|
||||
/// The panel menu's single-channel items act on the targeted channel (#11451): a targeted spot
|
||||
/// channel can be duplicated, given options, merged or deleted; a colour channel duplicated.
|
||||
#[test]
|
||||
fn panel_menu_items_act_on_the_targeted_channel() {
|
||||
use egui_kittest::kittest::{NodeT, Queryable};
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
|
||||
app.run("file.new", json!({"width": 32, "height": 24})).unwrap();
|
||||
app.run("channel.newSpot", json!({"name": "Ink", "fromSelection": false})).unwrap();
|
||||
app.run("channel.target", json!({"channel": 0})).unwrap();
|
||||
let mut h = egui_kittest::Harness::builder().with_size(vec2(260.0, 420.0)).build_ui_state(|ui, app: &mut PhotocraftApp| panel_menu(app, ui), app);
|
||||
h.run_steps(2);
|
||||
for label in ["Duplicate Channel", "Delete Channel", "Merge Spot Channel", "Channel Options…"] {
|
||||
assert!(!h.get_by_label(label).accesskit_node().is_disabled(), "{label} acts on the targeted spot channel");
|
||||
}
|
||||
h.get_by_label("Channel Options…").click();
|
||||
h.run_steps(2);
|
||||
assert!(h.state().ui.dialogs.iter().any(|d| crate::channel_options_ui::owns(&d.fields) && d.fields["channel"] == json!(0)));
|
||||
h.get_by_label("Duplicate Channel").click();
|
||||
h.run_steps(2);
|
||||
assert_eq!(alpha_names(h.state()), ["Ink", "Ink copy"]);
|
||||
h.get_by_label("Delete Channel").click();
|
||||
h.run_steps(2);
|
||||
assert_eq!(alpha_names(h.state()), ["Ink copy"], "the targeted channel is deleted");
|
||||
h.state_mut().run("channel.target", json!({"channel": {"color": 1}})).unwrap();
|
||||
h.run_steps(2);
|
||||
assert!(h.get_by_label("Delete Channel").accesskit_node().is_disabled(), "colour channels aren't deleted here");
|
||||
h.get_by_label("Duplicate Channel").click();
|
||||
h.run_steps(2);
|
||||
assert_eq!(alpha_names(h.state()), ["Ink copy", "Green copy"]);
|
||||
assert!(!h.state().ui.status_error, "{}", h.state().ui.status);
|
||||
}
|
||||
|
||||
fn alpha_names(app: &PhotocraftApp) -> Vec<String> {
|
||||
app.session.active().unwrap().doc.channels.iter().map(|c| c.name.clone()).collect()
|
||||
}
|
||||
|
||||
fn menu_app(mode: &str) -> PhotocraftApp {
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
|
||||
app.run("file.new", json!({"width": 32, "height": 24, "mode": mode})).unwrap();
|
||||
app
|
||||
}
|
||||
|
||||
fn menu_harness(app: PhotocraftApp) -> egui_kittest::Harness<'static, PhotocraftApp> {
|
||||
let mut h = egui_kittest::Harness::builder().with_size(vec2(260.0, 420.0)).build_ui_state(|ui, app: &mut PhotocraftApp| panel_menu(app, ui), app);
|
||||
h.run_steps(2);
|
||||
h
|
||||
}
|
||||
|
||||
fn menu_disabled(h: &egui_kittest::Harness<'static, PhotocraftApp>, label: &str) -> bool {
|
||||
use egui_kittest::kittest::{NodeT, Queryable};
|
||||
h.get_by_label(label).accesskit_node().is_disabled()
|
||||
}
|
||||
|
||||
fn menu_click(h: &mut egui_kittest::Harness<'static, PhotocraftApp>, label: &str) {
|
||||
use egui_kittest::kittest::Queryable;
|
||||
h.get_by_label(label).click();
|
||||
h.run_steps(2);
|
||||
assert!(!h.state().ui.status_error, "{label}: {}", h.state().ui.status);
|
||||
}
|
||||
|
||||
/// A grayscale image's composite is its one channel: Duplicate Channel copies it, as the row
|
||||
/// menu does; an RGB composite stays greyed.
|
||||
#[test]
|
||||
fn panel_menu_duplicates_the_gray_composite() {
|
||||
assert!(menu_disabled(&menu_harness(menu_app("rgb")), "Duplicate Channel"), "nothing to duplicate on the RGB composite");
|
||||
let mut h = menu_harness(menu_app("grayscale"));
|
||||
assert!(!menu_disabled(&h, "Duplicate Channel"));
|
||||
menu_click(&mut h, "Duplicate Channel");
|
||||
assert_eq!(alpha_names(h.state()), ["Gray copy"]);
|
||||
}
|
||||
|
||||
/// Duplicate Channel copies a targeted Quick Mask or layer mask, as dropping the row on New does
|
||||
/// (the mask's copy is "<layer> Mask copy").
|
||||
#[test]
|
||||
fn panel_menu_duplicates_quick_mask_and_layer_mask() {
|
||||
let mut app = menu_app("rgb");
|
||||
app.run("select.editInQuickMaskMode", json!({})).unwrap();
|
||||
let mut h = menu_harness(app);
|
||||
assert!(!menu_disabled(&h, "Duplicate Channel"), "the Quick Mask can be duplicated");
|
||||
menu_click(&mut h, "Duplicate Channel");
|
||||
assert_eq!(h.state().session.active().unwrap().doc.channels.len(), 1);
|
||||
|
||||
let mut app = menu_app("rgb");
|
||||
app.run("layer.new.layer", json!({"name": "Masked"})).unwrap();
|
||||
app.run("layer.layerMask.revealAll", json!({})).unwrap();
|
||||
app.run("channel.target", json!({"channel": "mask"})).unwrap();
|
||||
let mut h = menu_harness(app);
|
||||
assert!(!menu_disabled(&h, "Duplicate Channel"), "the layer mask can be duplicated");
|
||||
menu_click(&mut h, "Duplicate Channel");
|
||||
assert_eq!(alpha_names(h.state()), ["Masked Mask copy"]);
|
||||
}
|
||||
|
||||
/// In Quick Mask mode, Channel Options… on a targeted alpha channel opens that channel's options,
|
||||
/// from the panel menu and the command palette (`menus::invoke`) alike; with the composite
|
||||
/// targeted it is Quick Mask's.
|
||||
#[test]
|
||||
fn channel_options_in_quick_mask_take_the_targeted_alpha() {
|
||||
let mut app = menu_app("rgb");
|
||||
app.run("channel.new", json!({"name": "Alpha 1"})).unwrap();
|
||||
app.run("select.editInQuickMaskMode", json!({})).unwrap();
|
||||
let ctx = egui::Context::default();
|
||||
crate::menus::invoke(&mut app, &ctx, "channel.options", json!({})).unwrap();
|
||||
assert_eq!(app.ui.dialogs.last().unwrap().fields["channel"], json!("quickMask"), "the composite targeted: Quick Mask Options");
|
||||
app.ui.dialogs.clear();
|
||||
app.run("channel.target", json!({"channel": 0})).unwrap();
|
||||
crate::menus::invoke(&mut app, &ctx, "channel.options", json!({})).unwrap();
|
||||
assert_eq!(app.ui.dialogs.last().unwrap().fields["channel"], json!(0), "the dispatcher opens the alpha's options");
|
||||
app.ui.dialogs.clear();
|
||||
let mut h = menu_harness(app);
|
||||
menu_click(&mut h, "Channel Options…");
|
||||
assert_eq!(h.state().ui.dialogs.last().unwrap().fields["channel"], json!(0), "so does the panel menu");
|
||||
}
|
||||
|
||||
/// Duplicate Channel waits for one channel: not several colour channels at once. Without a
|
||||
/// document every item is greyed.
|
||||
#[test]
|
||||
fn panel_menu_greys_items_without_one_channel_or_a_document() {
|
||||
let mut app = menu_app("rgb");
|
||||
app.run("channel.target", json!({"channel": {"color": 0}})).unwrap();
|
||||
app.run("channel.target", json!({"channel": {"color": 1}, "extend": true})).unwrap();
|
||||
assert_eq!(app.session.active().unwrap().channel_view.selected_colors.len(), 2);
|
||||
assert!(menu_disabled(&menu_harness(app), "Duplicate Channel"), "two colour channels are targeted");
|
||||
let h = menu_harness(PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default()));
|
||||
for label in [
|
||||
"New Channel…",
|
||||
"Duplicate Channel",
|
||||
"Delete Channel",
|
||||
"New Spot Channel…",
|
||||
"Merge Spot Channel",
|
||||
"Channel Options…",
|
||||
"Split Channels",
|
||||
"Merge Channels…",
|
||||
] {
|
||||
assert!(menu_disabled(&h, label), "{label} waits for a document");
|
||||
}
|
||||
}
|
||||
|
||||
/// Merge Spot Channel prints the targeted spot channel into the image and removes it: a solid
|
||||
/// blue ink over the left half turns those pixels blue and leaves the rest white.
|
||||
#[test]
|
||||
fn panel_menu_merges_the_targeted_spot_channel() {
|
||||
let mut app = menu_app("rgb");
|
||||
app.run("channel.new", json!({"name": "Alpha 1"})).unwrap();
|
||||
app.run("select.rect", json!({"x": 0, "y": 0, "width": 16, "height": 24})).unwrap();
|
||||
app.run("channel.newSpot", json!({"name": "Ink", "color": "#0000ff", "solidity": 100})).unwrap();
|
||||
app.run("select.deselect", json!({})).unwrap();
|
||||
app.run("channel.target", json!({"channel": 1})).unwrap();
|
||||
let pixel = |app: &PhotocraftApp, x: usize, y: usize| {
|
||||
let doc = &app.session.active().unwrap().doc;
|
||||
let comp = photocraft_compose::render(doc, doc.bounds());
|
||||
let p = comp.px[y * doc.size.width as usize + x];
|
||||
[p[0], p[1], p[2]].map(|v| (v * 255.0).round() as u8)
|
||||
};
|
||||
assert_eq!((pixel(&app, 4, 4), pixel(&app, 24, 4)), ([255, 255, 255], [255, 255, 255]), "the ink is not in the image yet");
|
||||
let mut h = menu_harness(app);
|
||||
menu_click(&mut h, "Merge Spot Channel");
|
||||
assert_eq!(alpha_names(h.state()), ["Alpha 1"], "the spot channel is merged, the alpha kept");
|
||||
assert_eq!(pixel(h.state(), 4, 4), [0, 0, 255], "the ink is printed where the channel had it");
|
||||
assert_eq!(pixel(h.state(), 24, 4), [255, 255, 255], "and nowhere else");
|
||||
}
|
||||
|
||||
/// Merge Channels… asks first, as in Photoshop: the dialog picks the mode and the document for
|
||||
/// each channel; nothing merges until OK. With params the command runs directly.
|
||||
#[test]
|
||||
fn panel_menu_merge_channels_opens_its_dialog() {
|
||||
let mut app = menu_app("grayscale");
|
||||
for _ in 0..2 {
|
||||
app.run("file.new", json!({"width": 32, "height": 24, "mode": "grayscale"})).unwrap();
|
||||
}
|
||||
let mut h = menu_harness(app);
|
||||
menu_click(&mut h, "Merge Channels…");
|
||||
assert_eq!(h.state().session.documents().len(), 3, "nothing is merged before OK");
|
||||
let d = h.state().ui.dialogs.last().expect("the Merge Channels dialog");
|
||||
assert_eq!(d.fields["__label"], json!("Merge Channels…"));
|
||||
let id = d.id;
|
||||
h.state_mut().ui.dialog_mut(id).unwrap().fields.insert("mode".into(), json!("lab"));
|
||||
crate::dialogs::confirm(h.state_mut(), id).unwrap();
|
||||
let docs = h.state().session.documents();
|
||||
assert_eq!(docs.len(), 1, "the sources close");
|
||||
assert_eq!(docs[0].doc.mode, photocraft_doc::ColorMode::Lab, "in the mode picked");
|
||||
|
||||
let ctx = egui::Context::default();
|
||||
let mut app = menu_app("grayscale");
|
||||
for _ in 0..2 {
|
||||
app.run("file.new", json!({"width": 32, "height": 24, "mode": "grayscale"})).unwrap();
|
||||
}
|
||||
let r = crate::menus::invoke(&mut app, &ctx, "channel.merge", json!({})).unwrap();
|
||||
assert!(r["dialog"].is_u64() && app.session.documents().len() == 3, "the dispatcher asks too");
|
||||
app.ui.dialogs.clear();
|
||||
crate::menus::invoke(&mut app, &ctx, "channel.merge", json!({"mode": "rgb"})).unwrap();
|
||||
assert!(app.ui.dialogs.is_empty() && app.session.documents().len() == 1, "explicit params merge directly");
|
||||
}
|
||||
|
||||
/// Two grayscale documents fill no mode: Merge Channels… is greyed in the panel menu, and the
|
||||
/// dispatcher says why instead of opening the dialog; a third one enables it.
|
||||
#[test]
|
||||
fn merge_channels_waits_for_three_grayscale_documents() {
|
||||
let mut app = menu_app("grayscale");
|
||||
app.run("file.new", json!({"width": 32, "height": 24, "mode": "grayscale"})).unwrap();
|
||||
let ctx = egui::Context::default();
|
||||
let why = crate::menus::invoke(&mut app, &ctx, "channel.merge", json!({})).unwrap_err();
|
||||
assert!(why.contains("three") && app.ui.dialogs.is_empty(), "{why}");
|
||||
let mut h = menu_harness(app);
|
||||
assert!(menu_disabled(&h, "Merge Channels…"), "two documents are not enough");
|
||||
h.state_mut().run("file.new", json!({"width": 32, "height": 24, "mode": "grayscale"})).unwrap();
|
||||
h.run_steps(2);
|
||||
assert!(!menu_disabled(&h, "Merge Channels…"), "three are");
|
||||
}
|
||||
@@ -277,21 +277,21 @@ pub fn panel_menu(app: &mut crate::PhotocraftApp, ui: &mut egui::Ui) {
|
||||
}
|
||||
}
|
||||
ui.separator();
|
||||
run_menu_command(app, ui, tl!("Flatten Image"), "layer.flattenImage");
|
||||
run_menu_command(app, ui, tl!("Flatten Image"), "layer.flattenImage", Some(json!({})));
|
||||
ui.separator();
|
||||
if ui.add_enabled(app.session.is_enabled("layer.lockLayers"), egui::Button::new(tl!("Lock Layers…"))).clicked() {
|
||||
app.ui.layers_panel_dialog = Some(LayersPanelDialog::LockLayers { transparency: false, pixels: false, position: false, artboard: false, all: true });
|
||||
ui.close();
|
||||
}
|
||||
run_menu_command(app, ui, tl!("Rename Layer…"), "layer.renameLayer");
|
||||
run_menu_command(app, ui, tl!("Rename Layer…"), "layer.renameLayer", Some(json!({})));
|
||||
let any_hidden = app.session.active().is_some_and(|st| st.selected_layers().iter().any(|id| st.doc.layer(*id).is_some_and(|l| !l.visible)));
|
||||
if any_hidden {
|
||||
run_menu_command(app, ui, tl!("Show Layers"), "layer.showLayers");
|
||||
run_menu_command(app, ui, tl!("Show Layers"), "layer.showLayers", Some(json!({})));
|
||||
} else {
|
||||
run_menu_command(app, ui, tl!("Hide Layers"), "layer.hideLayers");
|
||||
run_menu_command(app, ui, tl!("Hide Layers"), "layer.hideLayers", Some(json!({})));
|
||||
}
|
||||
ui.separator();
|
||||
run_menu_command(app, ui, tl!("New Artboard…"), "layer.new.artboard");
|
||||
run_menu_command(app, ui, tl!("New Artboard…"), "layer.new.artboard", Some(json!({})));
|
||||
ui.separator();
|
||||
ui.menu_button(tl!("Filter Options"), |ui| {
|
||||
let mut show = app.ui.layers_panel_options.show_filters;
|
||||
|
||||
@@ -27,11 +27,17 @@ pub fn restore_options(app: &mut PhotocraftApp) {
|
||||
}
|
||||
}
|
||||
|
||||
/// The real menu command dispatcher handles rename's in-place editor and other shell routing.
|
||||
pub fn run_menu_command(app: &mut PhotocraftApp, ui: &mut Ui, label: &str, id: &str) {
|
||||
if ui.add_enabled(app.session.is_enabled(id), egui::Button::new(label)).clicked() {
|
||||
/// A panel-menu item running menu command `id` with `params` (`{}` for none) through the real
|
||||
/// menu command dispatcher, which handles rename's in-place editor, opens a command's dialog where
|
||||
/// it has one and does other shell routing. Greyed when `params` is `None` (nothing to act on) or
|
||||
/// where the menu bar greys the command.
|
||||
pub fn run_menu_command(app: &mut PhotocraftApp, ui: &mut Ui, label: &str, id: &str, params: Option<serde_json::Value>) {
|
||||
let on = params.is_some() && crate::menus::is_enabled(app, id);
|
||||
if ui.add_enabled(on, egui::Button::new(label)).clicked()
|
||||
&& let Some(params) = params
|
||||
{
|
||||
let ctx = ui.ctx().clone();
|
||||
if let Err(e) = crate::menus::invoke(app, &ctx, id, json!({})) {
|
||||
if let Err(e) = crate::menus::invoke(app, &ctx, id, params) {
|
||||
app.ui.status = e;
|
||||
app.ui.status_error = true;
|
||||
}
|
||||
|
||||
@@ -1206,6 +1206,10 @@ fn panel_menu(app: &mut PhotocraftApp, ui: &mut egui::Ui, panel: &str) {
|
||||
crate::histogram_panel::panel_menu(app, ui);
|
||||
ui.separator();
|
||||
}
|
||||
"channels" => {
|
||||
crate::channels_panel::panel_menu(app, ui);
|
||||
ui.separator();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -763,6 +763,46 @@ fn actions_panel_menu_includes_load_and_save_actions() {
|
||||
assert!(menu.query_all_by_label("New Action…").count() > 0);
|
||||
}
|
||||
|
||||
/// The Channels panel menu (☰) has the channel items, not only the rows' context menu (#11451):
|
||||
/// New Spot Channel… and New Channel… open their dialogs, and OK in New Channel adds a channel.
|
||||
#[test]
|
||||
fn channels_panel_menu_opens_new_spot_and_adds_a_channel() {
|
||||
use egui_kittest::kittest::NodeT;
|
||||
let mut app = self::app();
|
||||
app.run("file.new", json!({"width": 32, "height": 24})).unwrap();
|
||||
let mut ready = false;
|
||||
let mut menu = Harness::builder().with_size(vec2(260.0, 420.0)).build_ui_state(
|
||||
move |ui, app: &mut PhotocraftApp| {
|
||||
if !ready {
|
||||
PhotocraftApp::setup_context(ui.ctx(), crate::theme::ThemeKind::ProMedium);
|
||||
ready = true;
|
||||
}
|
||||
panel_menu(app, ui, "channels");
|
||||
},
|
||||
app,
|
||||
);
|
||||
menu.run_steps(2);
|
||||
let disabled = |menu: &Harness<'static, PhotocraftApp>, label: &str| menu.get_by_label(label).accesskit_node().is_disabled();
|
||||
// The composite is targeted: nothing to duplicate, delete or give options to.
|
||||
for label in ["Duplicate Channel", "Delete Channel", "Merge Spot Channel", "Channel Options…"] {
|
||||
assert!(disabled(&menu, label), "{label} waits for a targeted channel");
|
||||
}
|
||||
menu.get_by_label("New Spot Channel…").click();
|
||||
menu.run_steps(2);
|
||||
let dialogs = &menu.state().ui.dialogs;
|
||||
assert!(dialogs.iter().any(|d| crate::channel_options_ui::owns_new_spot(&d.fields)), "New Spot Channel… opens its dialog");
|
||||
menu.state_mut().ui.dialogs.clear();
|
||||
menu.get_by_label("New Channel…").click();
|
||||
menu.run_steps(2);
|
||||
assert!(menu.state().session.active().unwrap().doc.channels.is_empty(), "New Channel… asks first");
|
||||
let dialog = menu.state().ui.dialogs.last().expect("the New Channel dialog");
|
||||
assert_eq!(dialog.fields["__label"], json!("New Channel…"));
|
||||
let id = dialog.id;
|
||||
crate::dialogs::confirm(menu.state_mut(), id).unwrap();
|
||||
assert_eq!(menu.state().session.active().unwrap().doc.channels.len(), 1, "OK adds an alpha channel");
|
||||
assert!(!menu.state().ui.status_error, "{}", menu.state().ui.status);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn custom_workspace_saves_shared_layout_and_timeline_without_embedding_flags() {
|
||||
let mut app = app();
|
||||
|
||||
+3
-1
@@ -1,6 +1,6 @@
|
||||
# UI parity: tools, handles, modifiers and feel
|
||||
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (History Options snapshot options, #3634; a Color Picker for another dialog's colour or the Crop shield shows the picked colour there before OK, #9886; Edit › Transform › Distort side handles move their edge, Perspective side handles skew, #10085; Ctrl + Alt + wheel zooms the canvas like ⌥ + wheel on Windows and Linux, where winit reports a held Ctrl as both ctrl and command, #10488; Layers panel filter by Color, #5898; 11 of 183 preferences do nothing: startup reads Graphics Adapter through the typed Performance section, so the scorecard audit sees it; Shape Fill/Stroke popover as Photoshop's, every colour swatch opens the full Color Picker with a live preview; the text and gradient stop Color Pickers show the picked colour on the canvas before OK, #5530; selected colour sets edit drawing, tone and supported filters; geometry remains open; a paragraph box that can't hold its text enlarges its lower-right handle and shows a black + in it, as the reference application; Free Transform of several selected layers, #6501; Path Operations fixes: the first component keeps combining, a hidden component selection is left alone, a dragged live shape stays live, a refused Pen draft ends once; Pen, Freeform Pen, Curvature Pen and Path Selection Path Operations menu, which changes selected components, `+` / `-` keys, #1397; the Pen carries on an open shape or vector mask path; selection-aware font controls, pending caret fonts and focused commit, plus direct font-name editing with a compact no-match message, #9338; New Group dialog and button modifiers; new layers go into an open active group and join a clipping mask, except that type, shapes, pastes and placed files go above a group whose lock would refuse them; Color panel Hue and Brightness Cube show the out-of-gamut ⚠ and nearest printable colour when the field is at least 53 pt tall, #8672; Art History Brush in the History group of the Y flyout, partial, TOOL-213-20, #1610; Histogram panel: Compact / Expanded / All Channels views, Luminosity and Colors channels, Source, range statistics, Uncached Refresh, live adjustment overlay, Cache Levels preference; the font menu opens on the current family, marked in the recent group when it is a recent one, #9160; Type options bar alignment and direction follow the target paragraph; a swatch click recolours selected type and shape layers with any tool, #9238; UI scale presets done: 105–120% steps, #3222; ⇧⌥ blend mode letters; painting tool Mode menus; ⌥ + an adjustment's shortcut reopens it at its last settings, ⌥⌘L / ⌥⌘M, #8900; Crop default mode: moving the image under the box snaps the frame's edges and centre, #8580; View › Extras hides the Move transform controls, #6699; adjustment clipping stays visible in compact Properties, #5231; Color panel modes from its panel menu, the same in every theme, UI-217-17, #6000; a picked colour recolours the selected type and shapes; Hand tool ⌘ / ⌥ are Zoom In / Zoom Out while held, #6434; the wheel steps value fields, #5473; a dragged guide shows its X or Y beside the pointer, #7680; Type options bar "T" icon scrubs the font size, #6437; Move tool: dragged selected pixels take their own outline as the selection, #7538; artboard backgrounds remain below child Free Transform previews; ⌫/Delete removes the selected smart filter, #4751; Object Finder foreground/background discrimination (#6548); rounded triangle, polygon and star corners; shape Fill/Stroke popovers accept hex RGB values, #6176; a guide let go over either ruler is removed, #6286; Crop rows corrected: saved crop presets and Delete Cropped Pixels off are done, #6562; marching ants in device pixels, #7489; Animated Zoom: holding the Zoom tool zooms continuously, #6210; shape Density and Feather, TOOL-214-12, #5846; Pen Auto Add/Delete on the path being drawn, #6140; Show Transform Controls frames every selected layer; guide keys and clicks; menu bar from the keyboard, #4988; Crop tool Content-Aware Fill; on-canvas corner radius widgets, TOOL-214-12; Curvature Pen edits the active path; Clip Thumbnails to Layer Bounds; Pen ⇧ 45°; last selected tool restored at launch; Layers panel filter-type dropdown with Kind, Name and Mode, #5048; Free Transform box and marching ants follow the selection, #5297; History: the trash deletes the selected snapshot, rows drag onto the trash, #5324; smart filter reordering by drag; smart object perspective row corrected to done, #426; Free Transform H/V skew fields; toolbar tool shortcuts can be reassigned; ⇧-dragged guides land on ruler ticks; layer and selection keys; tool keys; spring-loaded tool letters; type formatting keys; Pen Auto Add/Delete, #4144; smart filter rows; stale missing-tool rows corrected: Color Replacement, Red Eye and the Add/Delete Anchor Point pair are live toolbar tools, Frame landed; no percentage changed; selection-modifier and ⌥-wheel rows maLine truncated
|
||||
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (History Options snapshot options, #3634; Channels panel menu: New Channel…, Duplicate Channel, Delete Channel, New Spot Channel…, Merge Spot Channel, Channel Options…, Split Channels, Merge Channels…, #11451; a Color Picker for another dialog's colour or the Crop shield shows the picked colour there before OK, #9886; Edit › Transform › Distort side handles move their edge, Perspective side handles skew, #10085; Ctrl + Alt + wheel zooms the canvas like ⌥ + wheel on Windows and Linux, where winit reports a held Ctrl as both ctrl and command, #10488; Layers panel filter by Color, #5898; 11 of 183 preferences do nothing: startup reads Graphics Adapter through the typed Performance section, so the scorecard audit sees it; Shape Fill/Stroke popover as Photoshop's, every colour swatch opens the full Color Picker with a live preview; the text and gradient stop Color Pickers show the picked colour on the canvas before OK, #5530; selected colour sets edit drawing, tone and supported filters; geometry remains open; a paragraph box that can't hold its text enlarges its lower-right handle and shows a black + in it, as the reference application; Free Transform of several selected layers, #6501; Path Operations fixes: the first component keeps combining, a hidden component selection is left alone, a dragged live shape stays live, a refused Pen draft ends once; Pen, Freeform Pen, Curvature Pen and Path Selection Path Operations menu, which changes selected components, `+` / `-` keys, #1397; the Pen carries on an open shape or vector mask path; selection-aware font controls, pending caret fonts and focused commit, plus direct font-name editing with a compact no-match message, #9338; New Group dialog and button modifiers; new layers go into an open active group and join a clipping mask, except that type, shapes, pastes and placed files go above a group whose lock would refuse them; Color panel Hue and Brightness Cube show the out-of-gamut ⚠ and nearest printable colour when the field is at least 53 pt tall, #8672; Art History Brush in the History group of the Y flyout, partial, TOOL-213-20, #1610; Histogram panel: Compact / Expanded / All Channels views, Luminosity and Colors channels, Source, range statistics, Uncached Refresh, live adjustment overlay, Cache Levels preference; the font menu opens on the current family, marked in the recent group when it is a recent one, #9160; Type options bar alignment and direction follow the target paragraph; a swatch click recolours selected type and shape layers with any tool, #9238; UI scale presets done: 105–120% steps, #3222; ⇧⌥ blend mode letters; painting tool Mode menus; ⌥ + an adjustment's shortcut reopens it at its last settings, ⌥⌘L / ⌥⌘M, #8900; Crop default mode: moving the image under the box snaps the frame's edges and centre, #8580; View › Extras hides the Move transform controls, #6699; adjustment clipping stays visible in compact Properties, #5231; Color panel modes from its panel menu, the same in every theme, UI-217-17, #6000; a picked colour recolours the selected type and shapes; Hand tool ⌘ / ⌥ are Zoom In / Zoom Out while held, #6434; the wheel steps value fields, #5473; a dragged guide shows its X or Y beside the pointer, #7680; Type options bar "T" icon scrubs the font size, #6437; Move tool: dragged selected pixels take their own outline as the selection, #7538; artboard backgrounds remain below child Free Transform previews; ⌫/Delete removes the selected smart filter, #4751; Object Finder foreground/background discrimination (#6548); rounded triangle, polygon and star corners; shape Fill/Stroke popovers accept hex RGB values, #6176; a guide let go over either ruler is removed, #6286; Crop rows corrected: saved crop presets and Delete Cropped Pixels off are done, #6562; marching ants in device pixels, #7489; Animated Zoom: holding the Zoom tool zooms continuously, #6210; shape Density and Feather, TOOL-214-12, #5846; Pen Auto Add/Delete on the path being drawn, #6140; Show Transform Controls frames every selected layer; guide keys and clicks; menu bar from the keyboard, #4988; Crop tool Content-Aware Fill; on-canvas corner radius widgets, TOOL-214-12; Curvature Pen edits the active path; Clip Thumbnails to Layer Bounds; Pen ⇧ 45°; last selected tool restored at launch; Layers panel filter-type dropdown with Kind, Name and Mode, #5048; Free Transform box and marching ants follow the selection, #5297; History: the trash deletes the selected snapshot, rows drag onto the trash, #5324; smart filter reordering by drag; smart object perspective row corrected to done, #426; Free Transform H/V skew fields; toolbar tool shortcuts can be reassigned; ⇧-dragged guides land on ruler ticks; layer and selection keys; tool keys; spring-loaded tool letters; type formatting keys; Pen Auto Add/Delete, #4144; smart filter rows; stale missing-tool rows Line truncated
|
||||
|
||||
How PhotoCraft's direct manipulation compares with Photoshop 2026 (27.11.0): the toolbox, the
|
||||
handles and modifier keys of each gesture, nudging, snapping, numeric precision, navigation,
|
||||
@@ -263,11 +263,13 @@ Paragraph; the rest open as in-app floating windows.
|
||||
| Smart filter rows: click selects, drag onto another smart object moves, ⌥-drag copies, drag onto Delete removes; with a row selected, the Delete button and the ⌫/Delete key remove that filter, not the smart object | done | `smart_ui.rs`, `layer.smartFilter.transfer` (#4271), `smart_ui::keys` (#4751) |
|
||||
| Layers panel: Clip Thumbnails to Layer Bounds (panel menu, `interface.clipThumbnailsToLayerBounds`) | done (2026-10-12) | `layer_thumb_bounds_tests.rs`; #4281. Thumbnail size and the Panel Options dialog to come |
|
||||
| Smart filter rows: drag up or down the stack to reorder (a line marks the drop; the bottom filter is applied first) | done | `smart_ui.rs` `reorder_drop`, `layer.smartFilter.move` |
|
||||
| Channels panel menu: New Channel…, Duplicate Channel, Delete Channel, New Spot Channel…, Merge Spot Channel, Channel Options…, Split Channels, Merge Channels…; the single-channel items act on the targeted row (a colour, alpha or spot channel, Quick Mask, the layer mask, a one-channel image's composite) and are greyed without one; New Channel…, New Spot Channel…, Channel Options… and Merge Channels… (only the modes the open grayscale documents fill, a different document per channel; greyed below three documents) open their dialogs, here and in the rows' menu, and Split Channels runs at once | done (2026-11-06) | `channels_panel.rs` `panel_menu`, `channels_panel/tests.rs`, `panel_docking/tests.rs`, `dialogs/merge_channels_ui.rs`; #11451. Panel Options (thumbnail size) to come |
|
||||
|
||||
## Revision history
|
||||
|
||||
| Date | Change | Summary |
|
||||
|---|---|---|
|
||||
| 2026-11-06 | minor | Channels panel menu (☰): the channel items, not only the rows' context menu; New Channel…, New Spot Channel…, Channel Options… and Merge Channels… open their dialogs (New Channel and Merge Channels are new), and Channel Options… in Quick Mask mode opens a targeted alpha channel's options (#11451). No percentage changed |
|
||||
| 2026-11-02 | minor | Edit › Transform › Distort: the side handles move their edge freely, both its corners by the drag, stopping before the box folds as a corner does; Perspective's side handles skew along their edge, as in Photoshop (#10085). Not a new command, so no percentage changed |
|
||||
| 2026-11-01 | minor | Every preference takes effect: 11 of 183 do nothing (was 12); Graphics Adapter always worked, but startup read it by raw JSON key, which the scorecard audit can't see |
|
||||
| 2026-10-31 | minor | Layers panel filter-type dropdown: Color filters by the layers' label colour (#5898); Kind, Name, Mode, Color, Smart Object and Artboard, the other three missing; no percentage changed |
|
||||
|
||||
Reference in new issue
Block a user