Merge remote-tracking branch 'origin/main' into claude/selective-colours-isolation-329d87

# Conflicts:
#	docs/ui-parity.md
This commit is contained in:
Khawar Zamman Wani committed 2026-11-06 14:39:03 +05:30
commit 04be226762
22 files changed
+513 -47

No files matched your search

+2
View File
@@ -424,6 +424,8 @@ impl Headless {
if let Some(st) = this.session.active_mut() {
st.saved_to(target.to_string_lossy().into_owned());
}
// History Options › Automatically Create New Snapshot When Saving (#2966).
photocraft_engine::history_options_cmds::snapshot_on_save(&mut this.session);
Ok(())
})?;
}
+47
View File
@@ -0,0 +1,47 @@
//! History Options › Automatically Create New Snapshot When Saving (#2966) through the headless
//! server: a save of the document to its own layered file adds a snapshot when the option is on;
//! a flat export is a copy and adds none, and with the option off no save does.
use photocraft_automation::Headless;
use serde_json::json;
fn tmp() -> std::path::PathBuf {
let dir = std::env::temp_dir().join(format!(
"pc-save-snapshot-{}-{}",
std::process::id(),
std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_nanos()
));
std::fs::create_dir_all(&dir).unwrap();
dir
}
fn snapshots(h: &Headless) -> usize {
h.session.active().unwrap().snapshots.len()
}
#[test]
fn a_document_save_adds_a_snapshot_only_with_the_option() {
let dir = tmp();
let psd = dir.join("a.psd");
let png = dir.join("a.png");
let mut h = Headless::trusted_local();
h.handle("doc.new", json!({"width": 8, "height": 8, "background": "white"})).unwrap();
assert_eq!(snapshots(&h), 1, "the first snapshot");
// Off (the default): saving adds nothing.
h.handle("doc.save", json!({"path": psd.to_str().unwrap()})).unwrap();
assert_eq!(snapshots(&h), 1);
h.handle("engine.execute", json!({"command": "history.options", "params": {"automaticallyCreateNewSnapshotWhenSaving": true}})).unwrap();
h.handle("engine.execute", json!({"command": "image.adjustments.invert", "params": {}})).unwrap();
h.handle("doc.save", json!({})).unwrap();
assert_eq!(snapshots(&h), 2, "the save added one");
let st = h.session.active().unwrap();
assert!(std::sync::Arc::ptr_eq(&st.snapshots[1].doc, &st.doc), "of the document as saved");
assert!(!st.is_dirty(), "and the document stays saved");
// A flat export is a copy, not a save of the document.
h.handle("doc.save", json!({"path": png.to_str().unwrap()})).unwrap();
assert_eq!(snapshots(&h), 2);
std::fs::remove_dir_all(dir).unwrap();
}
+3
View File
@@ -46,6 +46,9 @@ semver = "1"
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tempfile = "3"
# `clock`: the local time that names History Options' snapshot on save (#2966); already in the
# tree through rmcp. The web build has no local clock here and names it "Snapshot N".
chrono = { workspace = true, features = ["clock"] }
# `file_cmds::same_file` on Windows: the volume serial number and file index, so a hard link to a
# file is that file (std's `MetadataExt::file_index` is unstable).
+247 -19
View File
@@ -1,35 +1,113 @@
//! History panel › History Options… (#2966): Allow Non-Linear History and Make Layer Visibility
//! Changes Undoable. The values are preferences (`historyOptions.*`, also `prefs.set`), applied
//! by [`Session::apply_prefs`] and [`Session::edit_visibility`]. Without params the command
//! reports them; the GUI opens its dialog instead and runs it with the dialog's values on OK.
//!
//! Photoshop's three snapshot options (Automatically Create First Snapshot, Automatically
//! Create New Snapshot When Saving, Show New Snapshot Dialog by Default) come with #3634, which
//! makes the snapshots act on them.
//! History panel › History Options… (#2966), Photoshop's five checkboxes: Automatically Create
//! First Snapshot, Automatically Create New Snapshot When Saving, Allow Non-Linear History, Show
//! New Snapshot Dialog by Default and Make Layer Visibility Changes Undoable. The values are
//! preferences (`historyOptions.*`, also `prefs.set`), applied by [`Session::add_document`],
//! [`snapshot_on_save`], [`Session::apply_prefs`], [`Session::edit_visibility`] and the GUI's
//! camera button. Without params the command reports them; the GUI opens its dialog instead and
//! runs it with the dialog's values on OK.
use serde_json::{Map, Value};
use crate::commands::CommandSpec;
use crate::history_cmds::Snapshot;
use crate::prefs::HistoryOptions;
use crate::{EngineError, Result, Session};
const CMD: &str = "history.options";
/// The option keys, as in `prefs.get historyOptions` and the command's params.
pub const OPTIONS: [&str; 2] = ["allowNonLinearHistory", "makeLayerVisibilityChangesUndoable"];
/// The option keys, as in `prefs.get historyOptions` and the command's params, in the order of
/// Photoshop's dialog.
pub const OPTIONS: [&str; 5] = [
"automaticallyCreateFirstSnapshot",
"automaticallyCreateNewSnapshotWhenSaving",
"allowNonLinearHistory",
"showNewSnapshotDialogByDefault",
"makeLayerVisibilityChangesUndoable",
];
/// The option named `key` (one of [`OPTIONS`]).
fn option_mut<'a>(o: &'a mut HistoryOptions, key: &str) -> Option<&'a mut bool> {
Some(match key {
"automaticallyCreateFirstSnapshot" => &mut o.automatically_create_first_snapshot,
"automaticallyCreateNewSnapshotWhenSaving" => &mut o.automatically_create_new_snapshot_when_saving,
"allowNonLinearHistory" => &mut o.allow_non_linear_history,
"showNewSnapshotDialogByDefault" => &mut o.show_new_snapshot_dialog_by_default,
"makeLayerVisibilityChangesUndoable" => &mut o.make_layer_visibility_changes_undoable,
_ => return None,
})
}
fn bad(msg: impl Into<String>) -> EngineError {
EngineError::BadParams { cmd: CMD.into(), msg: msg.into() }
}
/// The current History Options as `{allowNonLinearHistory, makeLayerVisibilityChangesUndoable}`.
/// The current History Options, keyed by [`OPTIONS`].
pub fn current(s: &Session) -> Value {
let o = &s.prefs().history_options;
serde_json::json!({
"automaticallyCreateFirstSnapshot": o.automatically_create_first_snapshot,
"automaticallyCreateNewSnapshotWhenSaving": o.automatically_create_new_snapshot_when_saving,
"allowNonLinearHistory": o.allow_non_linear_history,
"showNewSnapshotDialogByDefault": o.show_new_snapshot_dialog_by_default,
"makeLayerVisibilityChangesUndoable": o.make_layer_visibility_changes_undoable,
})
}
/// History Options › Show New Snapshot Dialog by Default: whether a plain click on the History
/// panel's camera button opens New Snapshot.
pub fn show_new_snapshot_dialog(s: &Session) -> bool {
s.prefs().history_options.show_new_snapshot_dialog_by_default
}
/// History Options › Automatically Create New Snapshot When Saving: after the active document
/// was saved to its own file (not a copy or an export), add a snapshot of it named with the local
/// time of the save, as Photoshop does. Not a history state. Returns the new snapshot's id, or
/// `None` when the option is off, no document is active, or the document is unchanged since the
/// snapshot the previous save added (and that snapshot is still there), so saving a clean
/// document again doesn't add a duplicate row. Shells call it where they record a document save.
///
/// Memory: like every History panel snapshot, each one pins a copy of the document for the
/// session (only the tiles that differ from the document and the other snapshots cost memory).
/// [`crate::DocState::trim_history`] counts those tiles against the History & Cache budget by
/// dropping the oldest history states, but never drops a snapshot itself: many saves of a
/// changing document can hold more than the budget until snapshots are deleted or the document
/// is closed.
pub fn snapshot_on_save(s: &mut Session) -> Option<u64> {
if !s.prefs().history_options.automatically_create_new_snapshot_when_saving {
return None;
}
let st = s.active_mut()?;
// Saved again without a change: the previous save's snapshot already shows this document.
if let Some(prev) = st.save_snapshot
&& st.snapshots.iter().any(|snap| snap.id == prev && std::sync::Arc::ptr_eq(&snap.doc, &st.doc))
{
return None;
}
let name = save_snapshot_name().unwrap_or_else(|| crate::history_cmds::next_snapshot_name(st));
let id = st.next_snapshot;
st.next_snapshot = id.saturating_add(1);
let (doc, layers) = (st.doc.clone(), st.layer_target());
// Like the camera button: the document and its saved state are unchanged.
st.snapshots.push(Snapshot { id, name, doc, layers });
st.save_snapshot = Some(id);
// The snapshot's tiles count against the history budget.
st.trim_history();
Some(id)
}
/// The local time as `HH:MM:SS`, the name of a snapshot made on save; `None` without a clock
/// (the web build), where the snapshot gets the camera button's "Snapshot N" instead.
fn save_snapshot_name() -> Option<String> {
#[cfg(not(target_arch = "wasm32"))]
{
Some(chrono::Local::now().format("%H:%M:%S").to_string())
}
#[cfg(target_arch = "wasm32")]
{
None
}
}
fn options(s: &mut Session, p: &Value) -> Result<Value> {
let given: Map<String, Value> = match p {
Value::Null => Map::new(),
@@ -39,7 +117,7 @@ fn options(s: &mut Session, p: &Value) -> Result<Value> {
// Validate everything before changing anything.
let mut set = Vec::new();
for (k, v) in &given {
if !OPTIONS.contains(&k.as_str()) {
if option_mut(&mut HistoryOptions::default(), k).is_none() {
return Err(bad(format!("unknown option `{k}` (expected {})", OPTIONS.join(", "))));
}
let b = v.as_bool().ok_or_else(|| bad(format!("`{k}` must be true or false")))?;
@@ -48,9 +126,8 @@ fn options(s: &mut Session, p: &Value) -> Result<Value> {
if !set.is_empty() {
s.edit_prefs(|prefs| {
for (k, b) in &set {
match k.as_str() {
"allowNonLinearHistory" => prefs.history_options.allow_non_linear_history = *b,
_ => prefs.history_options.make_layer_visibility_changes_undoable = *b,
if let Some(o) = option_mut(&mut prefs.history_options, k) {
*o = *b;
}
}
});
@@ -120,7 +197,7 @@ pub fn specs() -> Vec<CommandSpec> {
label: "History Options…",
menu: &[],
shortcut: None,
params: r##"{"allowNonLinearHistory":bool?,"makeLayerVisibilityChangesUndoable":bool?} → both values (no params: report them). Allow Non-Linear History: an edit after stepping back keeps the later states and is appended at the end; deleting a state deletes only it (default off). Make Layer Visibility Changes Undoable: showing or hiding a layer is a history state (default on). Also `prefs.set historyOptions.*`"##,
params: r##"{"automaticallyCreateFirstSnapshot":bool?,"automaticallyCreateNewSnapshotWhenSaving":bool?,"allowNonLinearHistory":bool?,"showNewSnapshotDialogByDefault":bool?,"makeLayerVisibilityChangesUndoable":bool?} → all five values (no params: report them). Automatically Create First Snapshot: a new or opened document starts with a snapshot of itself, named after it (default on). Automatically Create New Snapshot When Saving: each save of the document (not a copy) adds a snapshot named with the time of the save (default off). Allow Non-Linear History: an edit after stepping back keeps the later states and is appended at the end; deleting a state deletes only it (default off). Show New Snapshot Dialog by Default: a click on the History panel's camera button opens New Snapshot, not only ⌥-click (default off). Make Layer Visibility Changes Undoable: showing or hiding a layer is a history state (default on). Also `prefs.set historyOptions.*`"##,
enabled: always,
run: options,
journal: false,
@@ -148,10 +225,21 @@ mod tests {
#[test]
fn defaults_match_photoshop_and_round_trip_through_prefs() {
let mut s = Session::new();
assert_eq!(s.execute(CMD, json!({})).unwrap(), json!({"allowNonLinearHistory": false, "makeLayerVisibilityChangesUndoable": true}));
let defaults = json!({
"automaticallyCreateFirstSnapshot": true,
"automaticallyCreateNewSnapshotWhenSaving": false,
"allowNonLinearHistory": false,
"showNewSnapshotDialogByDefault": false,
"makeLayerVisibilityChangesUndoable": true,
});
assert_eq!(s.execute(CMD, json!({})).unwrap(), defaults);
assert_eq!(s.execute("prefs.get", json!({"path": "historyOptions"})).unwrap(), current(&s));
let r = s.execute(CMD, json!({"allowNonLinearHistory": true, "makeLayerVisibilityChangesUndoable": false})).unwrap();
assert_eq!(r, json!({"allowNonLinearHistory": true, "makeLayerVisibilityChangesUndoable": false}));
let flipped: Map<String, Value> = defaults.as_object().unwrap().iter().map(|(k, v)| (k.clone(), json!(!v.as_bool().unwrap()))).collect();
let r = s.execute(CMD, Value::Object(flipped.clone())).unwrap();
assert_eq!(r, Value::Object(flipped));
for key in OPTIONS {
assert_eq!(s.execute("prefs.get", json!({"path": format!("historyOptions.{key}")})).unwrap(), r[key], "{key}");
}
assert_eq!(s.execute("prefs.get", json!({"path": "historyOptions.allowNonLinearHistory"})).unwrap(), json!(true));
// Saved and restored with the other preferences.
let saved = s.prefs_to_json();
@@ -177,6 +265,11 @@ mod tests {
json!({"allowNonLinearHistory": 1}),
json!({"makeLayerVisibilityChangesUndoable": null}),
json!({"allowNonLinearHistory": true, "snapshots": true}),
json!({"automaticallyCreateFirstSnapshot": "true"}),
json!({"automaticallyCreateNewSnapshotWhenSaving": 0}),
json!({"showNewSnapshotDialogByDefault": [true]}),
json!({"showNewSnapshotDialogByDefault": true, "showNewSnapshotDialog": true}),
json!({"AutomaticallyCreateFirstSnapshot": false}),
json!([true]),
json!("x"),
json!(3),
@@ -185,6 +278,8 @@ mod tests {
assert_eq!(current(&s), before, "{p} changed nothing");
}
assert!(s.execute("prefs.set", json!({"path": "historyOptions.allowNonLinearHistory", "value": "on"})).is_err());
assert!(s.execute("prefs.set", json!({"path": "historyOptions.automaticallyCreateFirstSnapshot", "value": 1})).is_err());
assert!(s.execute("prefs.set", json!({"path": "historyOptions.showNewSnapshotDialogByDefault", "value": null})).is_err());
assert_eq!(current(&s), before);
}
@@ -358,6 +453,139 @@ mod tests {
assert!(s.active().unwrap().history.non_linear);
}
fn snapshot_names(s: &Session) -> Vec<String> {
s.active().unwrap().snapshots.iter().map(|snap| snap.name.clone()).collect()
}
/// PNG bytes of a small image, to open.
fn png() -> Vec<u8> {
let mut s = Session::new();
s.execute("file.new", json!({"width": 8, "height": 6})).unwrap();
crate::file_cmds::encode(&s.active().unwrap().doc, "a.png", None::<f64>).unwrap().0
}
/// Automatically Create First Snapshot (checked against Photoshop): on (the default), a new or
/// opened document starts with a snapshot named after it; off, it starts with none and the
/// camera's first snapshot is still "Snapshot 1".
#[test]
fn first_snapshot_follows_the_option_on_new_and_open() {
let mut s = Session::new();
s.execute("file.new", json!({"width": 8, "height": 8})).unwrap();
let name = s.active().unwrap().doc.name.clone();
assert_eq!(snapshot_names(&s), [name]);
crate::file_cmds::open_bytes_as(&mut s, "photo.png", &png(), None, None).unwrap();
assert_eq!(snapshot_names(&s), ["photo.png"], "named after the file, as Photoshop does");
s.execute(CMD, json!({"automaticallyCreateFirstSnapshot": false})).unwrap();
s.execute("file.new", json!({"width": 8, "height": 8})).unwrap();
assert!(snapshot_names(&s).is_empty());
assert_eq!(entries(&s).len(), 1, "the opening state is still there");
crate::file_cmds::open_bytes_as(&mut s, "photo.png", &png(), None, None).unwrap();
assert!(snapshot_names(&s).is_empty());
assert_eq!(s.execute("history.newSnapshot", json!({})).unwrap(), json!({"snapshot": 1, "name": "Snapshot 1"}));
assert_eq!(crate::inspect::document(s.active().unwrap())["snapshots"], json!([{"id": 1, "name": "Snapshot 1"}]));
// Documents opened earlier keep theirs: the option applies when a document opens.
s.set_active(0);
assert_eq!(snapshot_names(&s).len(), 1);
}
/// Automatically Create New Snapshot When Saving: off (the default), a save adds nothing; on,
/// each save adds a snapshot of the document as saved, named with the time, and not a
/// history state.
#[test]
fn a_save_adds_a_snapshot_only_with_the_option() {
let mut s = Session::new();
s.execute("file.new", json!({"width": 8, "height": 8})).unwrap();
assert_eq!(snapshot_on_save(&mut s), None);
assert_eq!(snapshot_names(&s).len(), 1, "only the first snapshot");
s.execute(CMD, json!({"automaticallyCreateNewSnapshotWhenSaving": true})).unwrap();
s.execute("edit.fill", json!({"color": "#ff0000"})).unwrap();
s.active_mut().unwrap().saved_to("saved.psd".into());
let states = entries(&s);
let id = snapshot_on_save(&mut s).unwrap();
let st = s.active().unwrap();
let snap = st.snapshots.last().unwrap();
assert_eq!(snap.id, id);
assert!(std::sync::Arc::ptr_eq(&snap.doc, &st.doc), "the document as saved");
// HH:MM:SS, the local time of the save.
let parts: Vec<&str> = snap.name.split(':').collect();
assert!(parts.len() == 3 && parts.iter().all(|p| p.len() == 2 && p.bytes().all(|b| b.is_ascii_digit())), "{}", snap.name);
assert_eq!(entries(&s), states, "not a history state");
assert!(!s.active().unwrap().is_dirty(), "the saved document stays clean");
// Each save adds one; selecting it brings that save back.
s.execute("edit.fill", json!({"color": "#0000ff"})).unwrap();
let second = snapshot_on_save(&mut s).unwrap();
assert_eq!(snapshot_names(&s).len(), 3);
s.execute("history.selectSnapshot", json!({"snapshot": id})).unwrap();
assert_eq!(s.active().unwrap().doc.layers[0].surface().unwrap().rgba(1, 1), [1.0, 0.0, 0.0, 1.0]);
assert!(second > id);
// No document: nothing to do, no panic.
let mut empty = Session::new();
empty.execute(CMD, json!({"automaticallyCreateNewSnapshotWhenSaving": true})).unwrap();
assert_eq!(snapshot_on_save(&mut empty), None);
}
/// Saving an unchanged document again (⌘S on a clean document) adds no duplicate row; a
/// change, or deleting the previous save's snapshot, makes the next save add one again.
#[test]
fn saving_an_unchanged_document_adds_no_duplicate_snapshot() {
let mut s = Session::new();
s.execute("file.new", json!({"width": 8, "height": 8})).unwrap();
s.execute(CMD, json!({"automaticallyCreateNewSnapshotWhenSaving": true})).unwrap();
let first = snapshot_on_save(&mut s).unwrap();
assert_eq!(snapshot_on_save(&mut s), None, "unchanged since the last save snapshot");
assert_eq!(snapshot_names(&s).len(), 2, "the first snapshot and one save snapshot");
// A view-only change (no document change) doesn't count either.
s.active_mut().unwrap().revision += 1;
assert_eq!(snapshot_on_save(&mut s), None);
// An edit does.
s.execute("edit.fill", json!({"color": "#ff0000"})).unwrap();
let second = snapshot_on_save(&mut s).unwrap();
assert!(second > first);
assert_eq!(snapshot_on_save(&mut s), None);
// The previous save's snapshot deleted: the next save shows the document again.
s.execute("history.deleteSnapshot", json!({"snapshot": second})).unwrap();
assert!(snapshot_on_save(&mut s).is_some());
assert_eq!(snapshot_names(&s).len(), 3);
}
#[test]
fn show_new_snapshot_dialog_reads_the_option() {
let mut s = Session::new();
assert!(!show_new_snapshot_dialog(&s));
s.execute("prefs.set", json!({"path": "historyOptions.showNewSnapshotDialogByDefault", "value": true})).unwrap();
assert!(show_new_snapshot_dialog(&s));
assert_eq!(crate::inspect::session(&s)["historyOptions"]["showNewSnapshotDialogByDefault"], json!(true));
}
/// The first snapshot and a save snapshot are recorded steps like any other: with Make Layer
/// Visibility Changes Undoable off, selecting one that shows a layer the eye hid, then Undo,
/// hides the layer again, and Redo shows it (the step changed it, #3535's rule).
#[test]
fn selecting_a_snapshot_undoes_its_own_visibility_change() {
let mut s = Session::new();
s.execute("file.new", json!({"width": 16, "height": 16})).unwrap();
let id = s.active().unwrap().active_layer.unwrap().0;
// Red, not the white document as opened (`red` only reads the red channel).
let red = |s: &Session| s.active().unwrap().doc.layer(photocraft_doc::LayerId(id)).unwrap().surface().unwrap().pixel(1, 1)[1] < 0.5;
s.execute(CMD, json!({"makeLayerVisibilityChangesUndoable": false, "automaticallyCreateNewSnapshotWhenSaving": true})).unwrap();
s.execute("edit.fill", json!({"color": "#ff0000"})).unwrap();
s.active_mut().unwrap().saved_to("saved.psd".into());
let saved = snapshot_on_save(&mut s).unwrap();
// The eye hides the layer: no state.
s.execute("layer.setProps", json!({"layer": id, "visible": false})).unwrap();
for (snap, is_red) in [(0, false), (saved, true)] {
s.execute("history.selectSnapshot", json!({"snapshot": snap})).unwrap();
assert!(visible(&s, id) && red(&s) == is_red, "snapshot {snap} shows the layer as it was");
s.execute("edit.undo", json!({})).unwrap();
assert!(!visible(&s, id) && red(&s), "undoing snapshot {snap} hides the layer again");
s.execute("edit.redo", json!({})).unwrap();
assert!(visible(&s, id) && red(&s) == is_red, "redoing snapshot {snap} shows it");
s.execute("edit.undo", json!({})).unwrap();
}
}
/// With the oldest state current, non-linear Delete is still enabled for a later (dimmed)
/// state (the History panel's trash and its drop target ask for it); linear history has
/// nothing to delete there.
+2 -1
View File
@@ -366,6 +366,7 @@ mod tests {
json!({"state": 1.5}),
json!({"state": "1"}),
json!({"state": [1]}),
json!({"snapshot": 99}),
json!({"snapshot": 1}),
json!({"snapshot": -1}),
json!({"snapshot": "Open"}),
@@ -375,7 +376,7 @@ mod tests {
assert!(s.execute(CMD, p.clone()).is_err(), "{p}");
}
assert_eq!(s.active().unwrap().history.brush_source(), Some(0), "nothing changed");
// Snapshot 0 is the document as opened, so it is a valid source.
// Snapshot 0 is the document as opened (Automatically Create First Snapshot), so it is a valid source.
assert_eq!(s.execute(CMD, json!({"snapshot": 0})).unwrap()["snapshot"], 0);
}
}
+6 -1
View File
@@ -48,11 +48,15 @@ pub struct DocState {
/// to `.pcraft` or PSD, and not a history step.
pub color_samplers: Vec<[f64; 2]>,
/// History panel snapshots, oldest first (`history.newSnapshot`, #2966): the first (id 0) is
/// the document as opened. Kept for the session only, as in Photoshop: not history states,
/// the document as opened (unless History Options › Automatically Create First Snapshot is
/// off). Kept for the session only, as in Photoshop: not history states,
/// and not saved with the document.
pub snapshots: Vec<history_cmds::Snapshot>,
/// The id the next snapshot gets; ids are never reused, so deleting one keeps the others.
pub(crate) next_snapshot: u64,
/// The snapshot the latest save added (History Options › Automatically Create New Snapshot
/// When Saving), so saving an unchanged document again doesn't add a duplicate row.
pub(crate) save_snapshot: Option<u64>,
/// The snapshot set as the History Brush's source (`history.setSource {snapshot}`); `None`:
/// the source is a state, kept by the history ([`photocraft_ops::History::brush_source`]).
pub(crate) source_snapshot: Option<u64>,
@@ -114,6 +118,7 @@ impl DocState {
color_samplers: Vec::new(),
snapshots: vec![first],
next_snapshot: 1,
save_snapshot: None,
source_snapshot: None,
typed_names: Default::default(),
}
+18 -3
View File
@@ -1119,21 +1119,36 @@ impl Actions {
}
}
/// The History panel's History Options… (not part of Edit › Preferences in Photoshop either).
/// Photoshop's snapshot options come with #3634.
/// The History panel's History Options… (not part of Edit › Preferences in Photoshop either),
/// in the dialog's order.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct HistoryOptions {
/// Automatically Create First Snapshot: a new or opened document starts with a snapshot of
/// itself, named after it (the History panel's top row).
pub automatically_create_first_snapshot: bool,
/// Automatically Create New Snapshot When Saving: every save of the document (not a copy)
/// adds a snapshot named with the time of the save.
pub automatically_create_new_snapshot_when_saving: bool,
/// Allow Non-Linear History: editing after selecting an earlier state keeps the later
/// states (the new step is appended at the end), and deleting a state deletes only it.
pub allow_non_linear_history: bool,
/// Show New Snapshot Dialog by Default: a plain click on the History panel's camera button
/// opens New Snapshot (otherwise only ⌥-click does).
pub show_new_snapshot_dialog_by_default: bool,
/// Make Layer Visibility Changes Undoable: showing or hiding a layer is a history state.
pub make_layer_visibility_changes_undoable: bool,
}
impl Default for HistoryOptions {
fn default() -> Self {
Self { allow_non_linear_history: false, make_layer_visibility_changes_undoable: true }
Self {
automatically_create_first_snapshot: true,
automatically_create_new_snapshot_when_saving: false,
allow_non_linear_history: false,
show_new_snapshot_dialog_by_default: false,
make_layer_visibility_changes_undoable: true,
}
}
}
+5
View File
@@ -142,6 +142,11 @@ impl Session {
st.history.max_states = self.prefs.get().performance.history_states.max(1) as usize;
st.history.max_bytes = self.prefs.get().performance.history_cap_bytes();
st.history.non_linear = self.prefs.get().history_options.allow_non_linear_history;
// History Options › Automatically Create First Snapshot off: no snapshot of the document
// as opened, so the History panel starts at the opening state (#2966).
if !self.prefs.get().history_options.automatically_create_first_snapshot {
st.snapshots.clear();
}
self.docs.push(st);
let i = self.docs.len() - 1;
self.active = Some(i);
+2
View File
@@ -637,6 +637,8 @@ impl PhotocraftApp {
// The job locked the document, but record the revision that was written.
st.saved_revision = revision;
app.remember_stamp(doc, path);
// History Options › Automatically Create New Snapshot When Saving (#2966).
photocraft_engine::history_options_cmds::snapshot_on_save(&mut app.session);
}
// "Save Document" script events and File › Generate › Image Assets.
if hooks && let Some(r) = photocraft_engine::automate_cmds::document_saved(&mut app.session, doc) {
@@ -1,8 +1,8 @@
//! The History Options dialog (History panel menu › History Options…, #2966): a form over the
//! engine's `history.options` with its two checkboxes, filled with the current values. OK runs
//! the command with the dialog's values (the generic command-dialog confirm), Cancel changes
//! nothing. Agents can also run `history.options` with params directly, or `prefs.set
//! historyOptions.*`; a call with params skips the dialog.
//! engine's `history.options` with Photoshop's five checkboxes in its order, filled with the
//! current values. OK runs the command with the dialog's values (the generic command-dialog
//! confirm), Cancel changes nothing. Agents can also run `history.options` with params directly,
//! or `prefs.set historyOptions.*`; a call with params skips the dialog.
use serde_json::{Map, Value, json};
@@ -27,11 +27,16 @@ pub fn open(app: &mut PhotocraftApp) -> u64 {
f.insert("__label".into(), json!("History Options…"));
f.insert("__form".into(), json!(true));
f.insert("__choices".into(), json!({}));
// Photoshop's capitalised labels, in the UI language (the form would sentence-case the keys).
// Photoshop's order and capitalised labels, in the UI language (the form would sort the keys
// and sentence-case them).
f.insert("__order".into(), json!(photocraft_engine::history_options_cmds::OPTIONS));
f.insert(
"__labels".into(),
json!({
"automaticallyCreateFirstSnapshot": tl!("Automatically Create First Snapshot"),
"automaticallyCreateNewSnapshotWhenSaving": tl!("Automatically Create New Snapshot When Saving"),
"allowNonLinearHistory": tl!("Allow Non-Linear History"),
"showNewSnapshotDialogByDefault": tl!("Show New Snapshot Dialog by Default"),
"makeLayerVisibilityChangesUndoable": tl!("Make Layer Visibility Changes Undoable"),
}),
);
@@ -58,19 +63,25 @@ mod tests {
let d = app.ui.dialogs.iter().find(|d| d.id == id).unwrap();
assert_eq!(d.fields["allowNonLinearHistory"], json!(false));
assert_eq!(d.fields["makeLayerVisibilityChangesUndoable"], json!(true));
assert_eq!(d.fields["automaticallyCreateFirstSnapshot"], json!(true));
assert_eq!(d.fields["automaticallyCreateNewSnapshotWhenSaving"], json!(false));
assert_eq!(d.fields["showNewSnapshotDialogByDefault"], json!(false));
assert_eq!(crate::dialogs::title(d), "History Options");
// Cancel changes nothing.
app.ui.dialog_mut(id).unwrap().fields.insert("allowNonLinearHistory".into(), json!(true));
crate::dialogs::cancel(&mut app, id).unwrap();
assert!(!app.session.prefs().history_options.allow_non_linear_history);
// OK applies both checkboxes.
// OK applies every checkbox.
let id = open(&mut app);
let fields = &mut app.ui.dialog_mut(id).unwrap().fields;
fields.insert("allowNonLinearHistory".into(), json!(true));
fields.insert("makeLayerVisibilityChangesUndoable".into(), json!(false));
for key in photocraft_engine::history_options_cmds::OPTIONS {
let on = fields[key].as_bool().unwrap();
fields.insert(key.into(), json!(!on));
}
crate::dialogs::confirm(&mut app, id).unwrap();
let o = &app.session.prefs().history_options;
assert!(o.allow_non_linear_history && !o.make_layer_visibility_changes_undoable);
assert!(!o.automatically_create_first_snapshot && o.automatically_create_new_snapshot_when_saving && o.show_new_snapshot_dialog_by_default);
assert!(app.ui.dialogs.is_empty());
// Reopened, it shows what was chosen; with params the command runs without a dialog.
let id = open(&mut app);
@@ -82,16 +93,24 @@ mod tests {
assert!(crate::menus::invoke(&mut app, &ctx, COMMAND, json!({"allowNonLinearHistory": "no"})).is_err());
}
/// The five checkboxes with Photoshop's labels, top to bottom in its dialog's order.
#[test]
fn the_dialog_draws_both_checkboxes_with_photoshops_labels() {
fn the_dialog_draws_the_checkboxes_in_photoshops_order() {
use egui_kittest::{Harness, kittest::Queryable};
let mut h = Harness::builder().with_size(egui::vec2(700.0, 400.0)).build_ui_state(|ui, app| crate::dialogs::show(app, ui.ctx()), app());
PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::ALL[0]);
open(h.state_mut());
h.run_steps(3);
h.get_by_label("History Options");
h.get_by_label("Allow Non-Linear History");
h.get_by_label("Make Layer Visibility Changes Undoable");
let labels = [
"Automatically Create First Snapshot",
"Automatically Create New Snapshot When Saving",
"Allow Non-Linear History",
"Show New Snapshot Dialog by Default",
"Make Layer Visibility Changes Undoable",
];
let tops: Vec<f32> = labels.iter().map(|l| h.get_by_label(l).rect().min.y).collect();
assert!(tops.windows(2).all(|w| w[0] < w[1]), "top to bottom: {tops:?}");
h.get_by_label("OK");
h.get_by_label("Cancel");
}
+3
View File
@@ -3910,6 +3910,9 @@ navigator Zoom Zvětšení
Sent to {printer} Odesláno do {printer}
set in Print Settings… nastavuje se v nastavení tisku…
ICO is limited to 256 × 256 pixels ICO je omezen na 256 × 256 pixelů
Automatically Create First Snapshot Automaticky vytvořit první snímek
Automatically Create New Snapshot When Saving Automaticky vytvořit nový snímek při ukládání
Show New Snapshot Dialog by Default Ve výchozím nastavení zobrazit dialog Nový snímek
Memory usage percent Využití paměti (%)
Show Favorite Fonts Zobrazit oblíbená písma
No favorite fonts yet: click the star beside a font to add it. Zatím žádná oblíbená písma: přidejte písmo kliknutím na hvězdičku vedle něj.
Can't render this file because it contains an unexpected character in line 6 and column 47.
+3
View File
@@ -3309,6 +3309,9 @@ curves Smooth Glätten
Sent to {printer} An {printer} gesendet
set in Print Settings… in den Druckeinstellungen festlegen…
ICO is limited to 256 × 256 pixels ICO ist auf 256 × 256 Pixel begrenzt
Automatically Create First Snapshot Ersten Snapshot automatisch erstellen
Automatically Create New Snapshot When Saving Beim Speichern automatisch neuen Snapshot erstellen
Show New Snapshot Dialog by Default Dialogfeld „Neuer Snapshot“ standardmäßig anzeigen
Memory usage percent Speichernutzung (%)
Show Favorite Fonts Favorisierte Schriften anzeigen
No favorite fonts yet: click the star beside a font to add it. Noch keine favorisierten Schriften: Klicken Sie auf den Stern neben einer Schrift, um sie hinzuzufügen.
Can't render this file because it contains an unexpected character in line 6 and column 47.
+3
View File
@@ -3499,6 +3499,9 @@ curves Smooth 매끄럽게
Sent to {printer} {printer}(으)로 전송됨
set in Print Settings… 인쇄 설정에서 지정…
ICO is limited to 256 × 256 pixels ICO는 256 × 256픽셀로 제한됩니다
Automatically Create First Snapshot 첫 번째 스냅샷 자동 만들기
Automatically Create New Snapshot When Saving 저장할 때 새 스냅샷 자동 만들기
Show New Snapshot Dialog by Default 기본적으로 새 스냅샷 대화 상자 표시
Memory usage percent 메모리 사용 비율(%)
Show Favorite Fonts 즐겨찾는 글꼴 표시
No favorite fonts yet: click the star beside a font to add it. 아직 즐겨찾는 글꼴이 없습니다. 글꼴 옆의 별을 클릭하여 추가하세요.
Can't render this file because it contains an unexpected character in line 63 and column 53.
+4
View File
@@ -3761,6 +3761,10 @@ curves Smooth Làm mượt
Sent to {printer} Đã gửi tới {printer}
set in Print Settings… đặt trong thiết lập in…
ICO is limited to 256 × 256 pixels ICO giới hạn ở 256 × 256 pixel
# History panel › History Options… (#2966)
Automatically Create First Snapshot Tự động tạo ảnh chụp trạng thái đầu tiên
Automatically Create New Snapshot When Saving Tự động tạo ảnh chụp trạng thái mới khi lưu
Show New Snapshot Dialog by Default Mặc định hiện hộp thoại Ảnh chụp trạng thái mới
Memory usage percent Tỷ lệ sử dụng bộ nhớ
Show Favorite Fonts Hiển thị phông chữ yêu thích
No favorite fonts yet: click the star beside a font to add it. Chưa có phông chữ yêu thích: nhấp vào ngôi sao bên cạnh phông chữ để thêm.
Can't render this file because it contains an unexpected character in line 6 and column 47.
+3
View File
@@ -2950,6 +2950,9 @@ curves Smooth 平滑
Sent to {printer} 已发送到 {printer}
set in Print Settings… 在打印设置中设置…
ICO is limited to 256 × 256 pixels ICO 最大为 256 × 256 像素
Automatically Create First Snapshot 自动创建第一幅快照
Automatically Create New Snapshot When Saving 存储时自动创建新快照
Show New Snapshot Dialog by Default 默认显示新建快照对话框
Memory usage percent 内存使用比例 (%)
Show Favorite Fonts 显示收藏的字体
No favorite fonts yet: click the star beside a font to add it. 还没有收藏的字体:点击字体旁边的星标即可添加。
Can't render this file because it contains an unexpected character in line 63 and column 53.
+3
View File
@@ -2911,6 +2911,9 @@ curves Smooth 平滑
Sent to {printer} 已傳送至 {printer}
set in Print Settings… 在列印設定中設定…
ICO is limited to 256 × 256 pixels ICO 最大為 256 × 256 像素
Automatically Create First Snapshot 自動建立第一個快照
Automatically Create New Snapshot When Saving 儲存時自動建立新快照
Show New Snapshot Dialog by Default 預設顯示新增快照對話框
Memory usage percent 記憶體使用比例 (%)
Show Favorite Fonts 顯示我的最愛字體
No favorite fonts yet: click the star beside a font to add it. 尚無我的最愛字體:按一下字體旁的星號即可加入。
Can't render this file because it contains an unexpected character in line 6 and column 47.
+71 -4
View File
@@ -829,7 +829,7 @@ mod snapshot_row_tests {
let p = trash(&h);
click(&mut h, p);
let st = h.state().session.active().unwrap();
assert_eq!(st.snapshots.len(), 1, "the trash deleted the snapshot (the first snapshot stays)");
assert_eq!(st.snapshots.len(), 1, "the trash deleted the snapshot, leaving the first one");
assert_eq!(st.history.entries().len(), steps, "and left the states alone");
// An edit after the click deselects the snapshot: the trash deletes the state.
@@ -843,7 +843,7 @@ mod snapshot_row_tests {
let p = trash(&h);
click(&mut h, p);
let st = h.state().session.active().unwrap();
assert_eq!(st.snapshots.len(), 2, "the snapshot is kept");
assert_eq!(st.snapshots.len(), 2, "the snapshot is kept, after the first one");
assert_eq!(st.history.entries().len(), steps - 1, "the current state is deleted");
}
@@ -856,7 +856,7 @@ mod snapshot_row_tests {
let to = trash(&h);
drag(&mut h, egui::pos2(row.x, row.y), to);
let st = h.state().session.active().unwrap();
assert_eq!(st.snapshots.len(), 1, "the dragged snapshot is deleted (the first snapshot stays)");
assert_eq!(st.snapshots.len(), 1, "the dragged snapshot is deleted, leaving the first one");
assert_eq!(st.history.entries().len(), steps, "no state is");
// The second-to-last state: it and the state after it go, as with Delete.
@@ -869,7 +869,7 @@ mod snapshot_row_tests {
drag(&mut h, egui::pos2(row.x, row.y), to);
let st = h.state().session.active().unwrap();
assert_eq!(st.history.entries().len(), 1, "the dragged state and the ones after it are deleted");
assert_eq!(st.snapshots.len(), 2, "the snapshot is kept");
assert_eq!(st.snapshots.len(), 2, "the snapshot is kept, after the first one");
}
/// With Allow Non-Linear History and only the oldest state current, a click on the trash has
@@ -1008,6 +1008,73 @@ mod snapshot_row_tests {
assert!(h.state().ui.dialogs.is_empty());
}
/// History Options › Show New Snapshot Dialog by Default (#2966): a plain click on the camera
/// opens New Snapshot as ⌥-click does, and ⌥-click still opens it (Photoshop's button always
/// prompts with the option on). Off, a plain click takes the snapshot at once.
#[test]
fn show_new_snapshot_dialog_by_default_makes_a_click_open_the_dialog() {
for (dialog_by_default, modifiers) in [(true, egui::Modifiers::NONE), (true, egui::Modifiers::ALT), (false, egui::Modifiers::NONE)] {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
app.run("file.new", json!({"width": 200, "height": 150})).unwrap();
app.run("history.options", json!({"showNewSnapshotDialogByDefault": dialog_by_default})).unwrap();
let mut h = Harness::builder().with_size(vec2(900.0, 700.0)).build_ui_state(
|ui, app: &mut PhotocraftApp| {
let ctx = ui.ctx().clone();
if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
return;
}
history(app, ui);
crate::dialogs::show(app, &ctx);
},
app,
);
PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::ProMedium);
h.state_mut().ui.theme = crate::theme::ThemeKind::ProMedium;
h.run_steps(4);
let mut buttons: Vec<Rect> = h
.ctx
.viewport(|v| v.prev_pass.widgets.layers().flat_map(|(_, w)| w.iter()).filter(|w| w.rect.size() == vec2(26.0, 26.0)).map(|w| w.rect).collect());
buttons.sort_by(|a, b| b.center().x.total_cmp(&a.center().x));
let camera = buttons[1].center();
h.event(egui::Event::ModifiersChanged(modifiers));
h.event(egui::Event::PointerMoved(camera));
h.run_steps(1);
for pressed in [true, false] {
h.event(egui::Event::PointerButton { pos: camera, button: egui::PointerButton::Primary, pressed, modifiers });
h.run_steps(1);
}
h.event(egui::Event::ModifiersChanged(egui::Modifiers::NONE));
h.run_steps(3);
let snaps = h.state().session.active().unwrap().snapshots.len();
let dialog = h.state().ui.dialogs.last().is_some_and(|d| crate::snapshot_dialog::owns(&d.fields));
if dialog_by_default {
assert!(dialog, "{modifiers:?}: the dialog opens");
assert_eq!(snaps, 1, "{modifiers:?}: no snapshot until OK");
h.get_by_label("OK").click();
h.run_steps(3);
assert_eq!(h.state().session.active().unwrap().snapshots.last().unwrap().name, "Snapshot 1");
} else {
assert!(!dialog, "off: no dialog");
assert_eq!(snaps, 2, "off: the click takes the snapshot");
}
}
}
/// History Options › Automatically Create First Snapshot: on, the panel's top row is a
/// snapshot named after the document; off, there is none above the opening state.
#[test]
fn the_first_snapshot_row_follows_the_option() {
for first in [true, false] {
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
app.run("history.options", json!({"automaticallyCreateFirstSnapshot": first})).unwrap();
app.run("file.new", json!({"width": 200, "height": 150})).unwrap();
let name = app.session.active().unwrap().doc.name.clone();
let mut h = Harness::builder().with_size(vec2(300.0, 400.0)).build_ui_state(|ui, app: &mut PhotocraftApp| history(app, ui), app);
h.run_steps(3);
assert_eq!(h.query_by_label(&name).is_some(), first, "a snapshot row named after the document: {first}");
}
}
/// Snapshot thumbnails belong to the snapshot's document (#6087): closing a document drops
/// them, and a document reopened with the same id (a `.pcraft` keeps it) gets fresh ones
/// rather than the closed document's, even before the views are synced.
+4 -2
View File
@@ -144,9 +144,11 @@ pub(super) fn history(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
});
}
let can_snap = app.session.is_enabled("history.newSnapshot");
// ⌥-click opens New Snapshot (name, From) instead, as in Photoshop.
// ⌥-click opens New Snapshot (name, From) instead, as in Photoshop; with History
// Options › Show New Snapshot Dialog by Default a plain click does too.
let dialog_by_default = photocraft_engine::history_options_cmds::show_new_snapshot_dialog(&app.session);
if ui.add_enabled_ui(can_snap, |ui| icons::button(ui, "scan", 26.0, false, tl!("Create new snapshot"))).inner.clicked() {
if ui.input(|i| i.modifiers.alt) {
if dialog_by_default || ui.input(|i| i.modifiers.alt) {
snapshot_dialog = true;
} else {
footer_cmd = Some(("history.newSnapshot", json!({})));
+50
View File
@@ -298,6 +298,56 @@ fn save_settings_start_at_the_opened_files_encoding() {
assert!(app.save_settings().webp_lossless);
}
/// The names of the active document's History panel snapshots.
fn snapshots(app: &PhotocraftApp) -> Vec<String> {
app.session.active().unwrap().snapshots.iter().map(|s| s.name.clone()).collect()
}
/// History Options › Automatically Create New Snapshot When Saving (#2966) through the desktop
/// save path: a save adds one snapshot, saving again unchanged adds none, Save a Copy adds none.
#[test]
fn a_save_adds_one_snapshot_and_a_copy_none() {
let mut app = app();
app.run("history.options", json!({"automaticallyCreateNewSnapshotWhenSaving": true})).unwrap();
let before = snapshots(&app).len();
app.save_as(Some("saved.psd".into())).unwrap();
assert_eq!(snapshots(&app).len(), before + 1, "the save adds a snapshot");
let st = app.session.active().unwrap();
assert!(std::sync::Arc::ptr_eq(&st.snapshots.last().unwrap().doc, &st.doc), "of the document as saved");
app.save_as(Some("saved.psd".into())).unwrap();
assert_eq!(snapshots(&app).len(), before + 1, "saving an unchanged document adds no duplicate");
app.run("layer.new.layer", json!({})).unwrap();
app.write_document("copy.psd".into(), &ExportSettings::default(), true).unwrap();
assert_eq!(snapshots(&app).len(), before + 1, "Save a Copy adds none");
app.save_as(Some("saved.psd".into())).unwrap();
assert_eq!(snapshots(&app).len(), before + 2);
}
/// A background save that finishes while another document is active snapshots the document it
/// saved, not the active one.
#[test]
fn a_background_save_snapshots_its_own_document() {
let mut app = app();
app.run("history.options", json!({"automaticallyCreateNewSnapshotWhenSaving": true})).unwrap();
let (saved_doc, revision) = {
let st = app.session.active().unwrap();
(st.doc.id, st.revision)
};
let saved_snaps = snapshots(&app).len();
app.run("file.new", json!({"width": 4, "height": 4, "name": "Untitled-2"})).unwrap();
let active = app.active_doc_id().unwrap();
assert_ne!(active, saved_doc);
let active_snaps = snapshots(&app).len();
// What jobs_ui does when the save job of `saved_doc` ends.
app.saved(saved_doc, revision, "background.psd", &[], false);
assert_eq!(app.active_doc_id(), Ok(active), "the active document stays active");
assert_eq!(snapshots(&app).len(), active_snaps, "the active document gets no snapshot");
let st = app.session.documents().iter().find(|st| st.doc.id == saved_doc).unwrap();
assert_eq!(st.snapshots.len(), saved_snaps + 1, "the saved document gets one");
assert_eq!(st.path.as_deref(), Some("background.psd"));
}
/// A browser download is only requested: the document takes the name but keeps its unsaved
/// changes, so the leave-page guard stays armed (#4962). A confirmed write still saves it.
#[test]
+1 -1
View File
@@ -138,7 +138,7 @@ store expose and persist the same setting; scripts keep using canonical command
| `layer.newAdjustmentLayer.hueSaturation` | `{"hue":30,"saturation":10}` |
| `paint.stroke` | `{"points":[[x,y,pressure],…],"size":20,"color":"#ff0000"}` |
| `select.rect` | `{"x":0,"y":0,"width":100,"height":50,"mode":"add","ellipse":false}` |
| `document.inspect` | `{}`: layer tree, history, snapshots (`[{id, name}]`, for `history.selectSnapshot`; id 0 is the document as opened), selection bounds |
| `document.inspect` | `{}`: layer tree, history, snapshots (`[{id, name}]`, for `history.selectSnapshot`; id 0 is the document as opened, unless `history.options` `automaticallyCreateFirstSnapshot` is off; with `automaticallyCreateNewSnapshotWhenSaving` on, each save of a changed document adds one named `HH:MM:SS`, or `Snapshot N` in the browser; every snapshot keeps its copy of the document for the session: its tiles count against the History & Cache budget by dropping the oldest history states, but snapshots are never dropped themselves), selection bounds |
| `layer.list` | `{"document":index?,"flat":bool?}`: just the layers, top-down: `id`, `name`, `kind`, `visible`, `bounds` (`[x,y,w,h]` or null), `selected`, `active`; groups list their `children`, or with `flat` every layer is one row with its `depth` and `parent` group id |
| `document.pixel` | `{"x":10,"y":10}`: composite RGBA, four floats 0..1 (not 0..255) |
| `document.presets.list` | `{}` → `{presets:[{name,settings}]}`: saved New Document configurations |
+2 -2
View File
@@ -9,7 +9,7 @@ Generated by `cargo xtask scorecard` from `perf/budgets.toml`, `perf/baseline.js
| [Performance](#performance) | 3 | 22 | 51 | 85 scenarios: 3 within budget, 22 over budget or failing, 9 tracked only, 47 not run, 4 not measurable yet (baseline 2026-10-05) |
| [File compatibility](#file-compatibility) | 11 | 14 | 2 | io corpus: oracle ≥ 148/170, round trip ≥ 169/170; psd-tools corpus: oracle ≥ 249/309, round trip ≥ 308/309; photoshop oracles: oracle ≥ 190/258, round trip ≥ 258/258 |
| [Tools](#tools) | 36 | 9 | 0 | |
| [Workspace and UI](#workspace-and-ui) | 15 | 6 | 2 | settings that do nothing: 10 of 189 (target 0) |
| [Workspace and UI](#workspace-and-ui) | 15 | 6 | 2 | settings that do nothing: 10 of 192 (target 0) |
| [Type](#type) | 5 | 5 | 0 | |
| [Automation](#automation) | 5 | 3 | 3 | 660 of 660 menu items live (100.0%) |
| [Reliability](#reliability) | 5 | 2 | 0 | never-crash lints on 30 of 30 crates; panic_hunt present |
@@ -209,7 +209,7 @@ Corpus floors (`crates/io/tests/it/corpus.rs`): the enforced minimums; the corpu
## Workspace and UI
**Settings that do nothing: 10 of 189** (target 0, #204). Counted by the prefs audit (`xtask/src/scorecard.rs`): a `Preferences` field counts as read when code outside the prefs model (`prefs.rs` except its `impl Session` blocks; tests excluded; the schema-driven dialog never names a field) accesses `section.field`, or `.section` and `.field` in the same file, or calls a section method that reads `self.field`. It is a heuristic lower bound: a generic name can look read when it isn't.
**Settings that do nothing: 10 of 192** (target 0, #204). Counted by the prefs audit (`xtask/src/scorecard.rs`): a `Preferences` field counts as read when code outside the prefs model (`prefs.rs` except its `impl Session` blocks; tests excluded; the schema-driven dialog never names a field) accesses `section.field`, or `.section` and `.field` in the same file, or calls a section method that reads `self.field`. It is a heuristic lower bound: a generic name can look read when it isn't.
Unread: `general.color_picker`, `workspace.auto_show_hidden_panels`, `workspace.enable_floating_document_window_docking`, `performance.legacy_compositing`, `units_and_rulers.column_width`, `units_and_rulers.gutter`, `plug_ins.show_extension_panels`, `plug_ins.allow_scripts_to_connect`, `type_.text_engine`, `enhanced_controls.scrubby_slider_acceleration`.
+4 -3
View File
@@ -1,6 +1,6 @@
# UI parity: tools, handles, modifiers and feel
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Image › Adjustments › Selective Color keeps each colour's own values and applies all nine, #11463; 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 Line truncated
> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-06 · **Change:** minor (Image › Adjustments › Selective Color keeps each colour's own values and applies all nine, #11463; 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 toolLine 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,
@@ -247,9 +247,9 @@ Paragraph; the rest open as in-app floating windows.
| Histogram panel: Compact (the default, of the entire image), Expanded and All Channels views (the channel kept across them); RGB/CMYK/Lab/Gray channels, Luminosity and Colors (overlaid, mixed where they overlap); Show Channels in Color and Show Statistics; Source (Entire Image, Selected Layer, Adjustment Composite) for multilayer documents; Mean, Std Dev, Median, Pixels, Level, Count, Percentile and Cache Level for the pointer level or a dragged range; the cached-data warning, Uncached Refresh (menu, button, warning click, double-click); the adjusted histogram over the original while an adjustment previews; Cache Levels 1–8 in Preferences › Performance; Color Sampler levels marked on the graph | partial | `histogram_panel.rs`, `histogram_panel_tests.rs`, `tone.rs`; differs: filter dialogs that preview on the CPU proxy aren't counted live, a selection doesn't limit the histogram yet, with Source Selected Layer an adjustment dialog's preview isn't counted, and new strings are English-only so far |
| Command palette with recents | done | UI-217-7 |
| Menu bar from the keyboard: Alt / F10 focus the bar, ← → ↓ ↩ drive it, Alt+letter opens a menu, underlined mnemonics run items | done | `menu_keys.rs`, #4988; macOS uses the native bar |
| Every preference takes effect | partial | 11 of 183 do nothing (scorecard, 2026-11-01) |
| Every preference takes effect | partial | 10 of 192 do nothing (scorecard, 2026-11-06) |
| UI scale presets | done | UI-217-9; 75–125% in 5% steps (#2492, #3222) |
| History snapshots: camera button, New Snapshot dialog (⌥-click: Name, From), the first snapshot (the document as opened), snapshot rows (click returns and selects, rename, delete; the trash deletes the selected snapshot, and a snapshot or state dragged onto it, #5324), `history.*Snapshot` commands | partial | `history_cmds.rs`, `snapshot_rows` in `panels.rs`, `snapshot_dialog.rs`; the snapshot History Options and History Brush sources to come (#2966) |
| History snapshots: camera button, New Snapshot dialog (⌥-click: Name, From), the first snapshot (the document as opened), snapshot rows (click returns and selects, rename, delete; the trash deletes the selected snapshot, and a snapshot or state dragged onto it, #5324), `history.*Snapshot` commands; History Options' snapshot options (Automatically Create First Snapshot, New Snapshot When Saving, Show New Snapshot Dialog by Default) | partial | `history_cmds.rs`, `history_options_cmds.rs`, `snapshot_rows` in `panels.rs`, `snapshot_dialog.rs`; History Brush sources to come (#2966) |
| Themes: Photoshop's four greys | partial | five themes; #2661 |
| Document tabs: overflow, context menu, reorder | done | UI-217-6; middle-click close #2570 |
| Layers panel: wheel steps blend modes, drop on New/Trash | partial | UI-217-14 |
@@ -332,6 +332,7 @@ Paragraph; the rest open as in-app floating windows.
| 2026-10-12 | minor | Toolbar tool shortcuts can be reassigned, removed and reset in Keyboard Shortcuts (#4086); capture, restart, group cycling, conflict and text-focus regressions |
| 2026-10-12 | minor | Smart filter rows can be selected, and dragged (⌥: copied) onto another smart object or onto Delete (#4271) |
| 2026-10-12 | minor | Free Transform options bar: H and V skew fields; a sheared box reads as skew instead of a taller H |
| 2026-10-12 | minor | History Options: Automatically Create First Snapshot, Automatically Create New Snapshot When Saving, Show New Snapshot Dialog by Default (#2966) |
| 2026-10-12 | minor | Crop tool Fill › Content-Aware Fill done (#3823); Delete Cropped Pixels off split into its own row, still partial |
| 2026-10-12 | minor | Layers panel: Clip Thumbnails to Layer Bounds frames each layer's pixels instead of the canvas (#4281) |
| 2026-10-12 | minor | Guides: ⌥-click turns a guide through the click; double-click opens Preferences › Guides, Grid & Slices |