mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Merge pull request #11563 from davidmann4/integration-batch-18
Integration batch 18: 23 epic PRs (toolbar, move, selection, artboard, menus)
This commit is contained in:
136 files changed
+6397
-356
No files matched your search
@@ -778,6 +778,8 @@ pub fn tone_range(px: &[[f32; 4]], lo: f32, hi: f32, falloff: f32) -> Vec<f32> {
|
||||
}
|
||||
|
||||
mod distance;
|
||||
#[cfg(test)]
|
||||
mod ellipse_aa_edge_tests;
|
||||
mod inverse;
|
||||
mod lasso;
|
||||
mod marquee;
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
//! The Elliptical Marquee's anti-aliased edge against the reference measurement (#11391):
|
||||
//! document 400 × 350, ellipse 100,100–300,250, the patch x 127–132, y 119–124 on the 45° part
|
||||
//! of its top-left edge. Grids hold what a black fill of the selection reads there (255 outside,
|
||||
//! 0 fully selected), as the issue's tables do.
|
||||
|
||||
use photocraft_geom::Rect;
|
||||
use photocraft_raster::Surface;
|
||||
|
||||
use super::ellipse_surface;
|
||||
|
||||
const AREA: Rect = Rect { x0: 0, y0: 0, x1: 400, y1: 350 };
|
||||
const ELLIPSE: Rect = Rect { x0: 100, y0: 100, x1: 300, y1: 250 };
|
||||
const PATCH: (i32, i32) = (127, 119);
|
||||
|
||||
/// The reference with Anti-alias on.
|
||||
const SOFT: [[u8; 6]; 6] = [
|
||||
[255, 255, 255, 255, 255, 152],
|
||||
[255, 255, 255, 212, 106, 0],
|
||||
[255, 255, 172, 64, 0, 0],
|
||||
[247, 137, 26, 0, 0, 0],
|
||||
[105, 0, 0, 0, 0, 0],
|
||||
[0, 0, 0, 0, 0, 0],
|
||||
];
|
||||
|
||||
/// Anti-alias off: the reference and PhotoCraft before #11391 agree.
|
||||
const HARD: [[u8; 6]; 6] =
|
||||
[[255, 255, 255, 255, 255, 255], [255, 255, 255, 255, 0, 0], [255, 255, 255, 0, 0, 0], [255, 255, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
|
||||
|
||||
/// The grey a black fill of selection `s` gives at `(x, y)` on white.
|
||||
fn grey(s: &Surface, x: i32, y: i32) -> u8 {
|
||||
let v = s.pixel(x, y).first().copied().unwrap_or(0.0);
|
||||
(255.0 - v * 255.0).round() as u8
|
||||
}
|
||||
|
||||
fn patch(s: &Surface) -> [[u8; 6]; 6] {
|
||||
std::array::from_fn(|j| std::array::from_fn(|i| grey(s, PATCH.0 + i as i32, PATCH.1 + j as i32)))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_anti_aliased_patch_matches_the_reference_within_three_levels() {
|
||||
let got = patch(&ellipse_surface(ELLIPSE, AREA, true));
|
||||
for (j, (row, want)) in got.iter().zip(&SOFT).enumerate() {
|
||||
for (i, (g, w)) in row.iter().zip(want).enumerate() {
|
||||
assert!(g.abs_diff(*w) <= 3, "{},{}: {g} vs reference {w}\n{got:?}", PATCH.0 + i as i32, PATCH.1 + j as i32);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_other_three_quadrants_mirror_the_measured_one() {
|
||||
let s = ellipse_surface(ELLIPSE, AREA, true);
|
||||
// Symmetric about x = 200 and y = 175: pixel x mirrors to 399 - x, y to 349 - y.
|
||||
for y in PATCH.1..PATCH.1 + 6 {
|
||||
for x in PATCH.0..PATCH.0 + 6 {
|
||||
let here = s.pixel(x, y);
|
||||
assert_eq!(s.pixel(399 - x, y), here, "{x},{y} mirrored across x");
|
||||
assert_eq!(s.pixel(x, 349 - y), here, "{x},{y} mirrored across y");
|
||||
assert_eq!(s.pixel(399 - x, 349 - y), here, "{x},{y} mirrored through the centre");
|
||||
}
|
||||
}
|
||||
// A few partial pixels, so the mirror is not of 0s and 1s alone.
|
||||
assert_eq!(grey(&s, 399 - 129, 122), grey(&s, 129, 122));
|
||||
assert!((1..255).contains(&grey(&s, 399 - 129, 349 - 121)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_hard_edge_is_unchanged() {
|
||||
assert_eq!(patch(&ellipse_surface(ELLIPSE, AREA, false)), HARD);
|
||||
}
|
||||
|
||||
/// Fully inside reads exactly 1 and outside exactly 0, so Add / Subtract / Intersect combine as
|
||||
/// before; the edge is soft only in a band at most √2 px wide.
|
||||
#[test]
|
||||
fn inside_is_exactly_selected_and_outside_exactly_empty() {
|
||||
let s = ellipse_surface(ELLIPSE, AREA, true);
|
||||
// Every pixel whose square lies inside, here all of the axes but the end pixels (whose
|
||||
// corners poke out by a sliver).
|
||||
for x in 101..299 {
|
||||
assert_eq!(s.pixel(x, 175), vec![1.0], "{x},175 on the horizontal axis");
|
||||
}
|
||||
for y in 101..249 {
|
||||
assert_eq!(s.pixel(200, y), vec![1.0], "200,{y} on the vertical axis");
|
||||
}
|
||||
for (x, y) in [(100, 175), (299, 175), (200, 100), (200, 249)] {
|
||||
assert!(s.pixel(x, y)[0] > 0.99, "{x},{y}: the axis ends are all but full");
|
||||
}
|
||||
for (x, y) in [(99, 175), (300, 175), (200, 99), (200, 250), (100, 100), (299, 249), (0, 0)] {
|
||||
assert_eq!(s.pixel(x, y), vec![0.0], "{x},{y} outside");
|
||||
}
|
||||
let partial = (0..350).flat_map(|y| (0..400).map(move |x| (x, y))).filter(|&(x, y)| (1..255).contains(&grey(&s, x, y))).count();
|
||||
let (hard_in, soft_in) = {
|
||||
let h = ellipse_surface(ELLIPSE, AREA, false);
|
||||
let sum = |s: &Surface| s.read_region(AREA).iter().map(|v| f64::from(*v)).sum::<f64>();
|
||||
(sum(&h), sum(&s))
|
||||
};
|
||||
// The perimeter (≈ 556 px) times a band 1 to √2 px across, and the hard ellipse's area.
|
||||
assert!((556..787).contains(&partial), "{partial} partial pixels");
|
||||
let exact = std::f64::consts::PI * 100.0 * 75.0;
|
||||
assert!((soft_in - exact).abs() < 0.002 * exact && (hard_in - exact).abs() < 0.002 * exact, "{soft_in} {hard_in} vs {exact}");
|
||||
}
|
||||
@@ -30,14 +30,22 @@ fn decode8(b: u8) -> f32 {
|
||||
}
|
||||
|
||||
/// An ellipse inscribed in a rectangle, tested in `f32` exactly as the Elliptical Marquee
|
||||
/// always has (so its anti-aliased edge keeps the same bytes).
|
||||
/// always has (so its hard edge keeps the same bytes).
|
||||
struct Ellipse {
|
||||
cx: f32,
|
||||
cy: f32,
|
||||
rx: f32,
|
||||
ry: f32,
|
||||
/// At most 3 px across: the anti-aliased edge keeps its 4×4 sub-samples (#11391 measured
|
||||
/// only larger ellipses).
|
||||
small: bool,
|
||||
/// `1 / rx`, `1 / ry`, `1 / rx²` and `1 / ry²` for [`Ellipse::ramp`].
|
||||
inv: [f64; 4],
|
||||
}
|
||||
|
||||
/// The widest an ellipse is across and still [`Ellipse::small`].
|
||||
const SMALL: u32 = 3;
|
||||
|
||||
impl Ellipse {
|
||||
fn new(r: Rect) -> Self {
|
||||
Self {
|
||||
@@ -45,42 +53,82 @@ impl Ellipse {
|
||||
cy: (i64::from(r.y0) + i64::from(r.y1)) as f32 / 2.0,
|
||||
rx: r.width() as f32 / 2.0,
|
||||
ry: r.height() as f32 / 2.0,
|
||||
small: r.width().min(r.height()) <= SMALL,
|
||||
inv: {
|
||||
let (rx, ry) = (f64::from(r.width()) / 2.0, f64::from(r.height()) / 2.0);
|
||||
[1.0 / rx, 1.0 / ry, 1.0 / (rx * rx), 1.0 / (ry * ry)]
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// The anti-aliased edge's coverage of pixel `(x, y)`, as Photoshop draws it (#11391): with
|
||||
/// `F` the normalised radius at the pixel's centre, `(F - 1) / (|∂F/∂x| + |∂F/∂y|)` is the
|
||||
/// centre's distance to the edge measured in the pixel's own width across the edge, and the
|
||||
/// coverage ramps linearly over that width. An axis-aligned edge gets the pixel's exact
|
||||
/// area; a 45° edge ramps over √2 px. 1 exactly at and around the centre.
|
||||
#[inline]
|
||||
fn ramp(&self, x: i32, y: i32) -> f64 {
|
||||
let [irx, iry, irx2, iry2] = self.inv;
|
||||
let (dx, dy) = (f64::from(x) + 0.5 - f64::from(self.cx), f64::from(y) + 0.5 - f64::from(self.cy));
|
||||
let (u, v) = (dx * irx, dy * iry);
|
||||
let f = (u * u + v * v).sqrt();
|
||||
// `f · (|∂F/∂x| + |∂F/∂y|)`; 0 only at the centre itself.
|
||||
let across = dx.abs() * irx2 + dy.abs() * iry2;
|
||||
if across <= 0.0 {
|
||||
return 1.0;
|
||||
}
|
||||
(0.5 - (f - 1.0) * f / across).clamp(0.0, 1.0)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn inside(&self, x: f32, y: f32) -> bool {
|
||||
let (dx, dy) = ((x - self.cx) / self.rx, (y - self.cy) / self.ry);
|
||||
dx * dx + dy * dy <= 1.0
|
||||
}
|
||||
|
||||
/// Whether every point of pixel `(x, y)` that the coverage samples is inside: its four
|
||||
/// corners (anti-aliased) or its centre. Along a row the pixels where this holds form one
|
||||
/// run: each test is monotonic in the distance from the centre (IEEE rounding is monotonic).
|
||||
/// Whether pixel `(x, y)` is fully selected: its centre is inside (hard edge), its four
|
||||
/// corners are (a small anti-aliased ellipse), or its [`Ellipse::ramp`] is 1. Along a row
|
||||
/// the pixels where this holds form one run: each test grows with the distance from the
|
||||
/// centre; [`row_span`] checks both ends of the run.
|
||||
#[inline]
|
||||
fn full(&self, x: i32, y: i32, aa: bool) -> bool {
|
||||
let (fx, fy) = (x as f32, y as f32);
|
||||
if !aa {
|
||||
return self.inside(fx + 0.5, fy + 0.5);
|
||||
}
|
||||
self.inside(fx, fy) && self.inside(fx + 1.0, fy) && self.inside(fx, fy + 1.0) && self.inside(fx + 1.0, fy + 1.0)
|
||||
if self.small {
|
||||
return self.inside(fx, fy) && self.inside(fx + 1.0, fy) && self.inside(fx, fy + 1.0) && self.inside(fx + 1.0, fy + 1.0);
|
||||
}
|
||||
self.ramp(x, y) >= 1.0
|
||||
}
|
||||
|
||||
/// Coverage of pixel `(x, y)` in sixteenths: 16 when [`Ellipse::full`], else (anti-aliased)
|
||||
/// the number of its 4×4 sub-samples inside.
|
||||
/// The byte pixel `(x, y)` stores: `one` when [`Ellipse::full`], 0 outside a hard edge, and
|
||||
/// otherwise the fraction of its 4×4 sub-samples inside (small) or its [`Ellipse::ramp`].
|
||||
#[inline]
|
||||
fn coverage(&self, x: i32, y: i32, aa: bool) -> u8 {
|
||||
fn coverage(&self, x: i32, y: i32, aa: bool, enc: &[u8; 17]) -> u8 {
|
||||
let one = enc[16];
|
||||
if aa && !self.small {
|
||||
// One ramp: a full pixel's is 1, which encodes as `one`.
|
||||
// `encode8`'s rounding, inline: this runs for every edge pixel.
|
||||
return (self.ramp(x, y) as f32 * 255.0 + 0.5) as u8;
|
||||
}
|
||||
if self.full(x, y, aa) {
|
||||
return 16;
|
||||
return one;
|
||||
}
|
||||
if !aa {
|
||||
return 0;
|
||||
}
|
||||
let (fx, fy) = (x as f32, y as f32);
|
||||
(0..16u8).filter(|i| self.inside(fx + ((i % 4) as f32 + 0.5) / 4.0, fy + ((i / 4) as f32 + 0.5) / 4.0)).count() as u8
|
||||
let n = (0..16u8).filter(|i| self.inside(fx + ((i % 4) as f32 + 0.5) / 4.0, fy + ((i / 4) as f32 + 0.5) / 4.0)).count();
|
||||
enc.get(n).copied().unwrap_or(one)
|
||||
}
|
||||
}
|
||||
|
||||
/// The bytes for 0/16 … 16/16 coverage.
|
||||
fn sixteenths() -> [u8; 17] {
|
||||
std::array::from_fn(|n| encode8(n as f32 / 16.0))
|
||||
}
|
||||
|
||||
/// One row of the ellipse: nothing outside `lo..hi`, fully selected in `full_lo..full_hi`, and
|
||||
/// the edge pixels in between (`lo..full_lo`, `full_hi..hi`) need the exact coverage test.
|
||||
#[derive(Clone, Copy)]
|
||||
@@ -94,7 +142,7 @@ struct RowSpan {
|
||||
/// Bounds row `y` of `e` within `cut.x0..cut.x1` from the exact (f64) ellipse, widened by a
|
||||
/// margin that covers the f32 tests' rounding. The bounds are then checked with the exact tests
|
||||
/// (the fully selected run at both ends, nothing just outside); any doubt evaluates the whole row.
|
||||
fn row_span(e: &Ellipse, y: i32, cut: Rect, aa: bool) -> RowSpan {
|
||||
fn row_span(e: &Ellipse, y: i32, cut: Rect, aa: bool, enc: &[u8; 17]) -> RowSpan {
|
||||
let exact = RowSpan { lo: cut.x0, full_lo: cut.x1, full_hi: cut.x1, hi: cut.x1 };
|
||||
let (cx, cy, rx, ry) = (f64::from(e.cx), f64::from(e.cy), f64::from(e.rx), f64::from(e.ry));
|
||||
// Every point the tests sample in this row lies in `y..y + 1`.
|
||||
@@ -118,14 +166,15 @@ fn row_span(e: &Ellipse, y: i32, cut: Rect, aa: bool) -> RowSpan {
|
||||
if inner < 0.0 || full_lo >= full_hi {
|
||||
(full_lo, full_hi) = (hi, hi);
|
||||
}
|
||||
let empty = |x: i32| e.coverage(x, y, aa) == 0;
|
||||
let empty = |x: i32| e.coverage(x, y, aa, enc) == 0;
|
||||
let ok = (lo <= cut.x0 || empty(lo - 1)) && (hi >= cut.x1 || empty(hi)) && (full_lo >= full_hi || (e.full(full_lo, y, aa) && e.full(full_hi - 1, y, aa)));
|
||||
if ok { RowSpan { lo, full_lo, full_hi, hi } } else { exact }
|
||||
}
|
||||
|
||||
/// The Elliptical Marquee's shape: the ellipse inscribed in `r`, cut to `clip`, as a GRAY8
|
||||
/// selection. Anti-aliased edge pixels hold the fraction of their 4×4 sub-samples inside;
|
||||
/// without anti-aliasing a pixel is selected when its centre is inside.
|
||||
/// selection. Anti-aliased edge pixels ramp across the edge as in Photoshop ([`Ellipse::ramp`];
|
||||
/// an ellipse at most 3 px across keeps the fraction of 4×4 sub-samples inside); without
|
||||
/// anti-aliasing a pixel is selected when its centre is inside.
|
||||
pub fn ellipse_surface(r: Rect, clip: Rect, anti_alias: bool) -> Surface {
|
||||
let mut s = Surface::new(PixelFormat::GRAY8);
|
||||
let cut = r.intersect(&clip);
|
||||
@@ -133,9 +182,9 @@ pub fn ellipse_surface(r: Rect, clip: Rect, anti_alias: bool) -> Surface {
|
||||
return s;
|
||||
}
|
||||
let e = Ellipse::new(r);
|
||||
let enc: [u8; 17] = std::array::from_fn(|n| encode8(n as f32 / 16.0));
|
||||
let enc = sixteenths();
|
||||
let one = encode8(1.0);
|
||||
let rows = par_map(cut.height() as usize, |i| row_span(&e, cut.y0 + i as i32, cut, anti_alias));
|
||||
let rows = par_map(cut.height() as usize, |i| row_span(&e, cut.y0 + i as i32, cut, anti_alias, &enc));
|
||||
let span = |y: i32| rows.get(usize::try_from(y - cut.y0).ok()?);
|
||||
let full = s.solid_tile(&[1.0]);
|
||||
let blank = s.solid_tile(&[0.0]);
|
||||
@@ -159,11 +208,11 @@ pub fn ellipse_surface(r: Rect, clip: Rect, anti_alias: bool) -> Surface {
|
||||
d.fill(one);
|
||||
}
|
||||
for x in (sp.lo.max(tr.x0)..sp.full_lo.min(tr.x1)).chain(sp.full_hi.max(tr.x0)..sp.hi.min(tr.x1)) {
|
||||
let n = e.coverage(x, y, anti_alias);
|
||||
let n = e.coverage(x, y, anti_alias, &enc);
|
||||
if n > 0
|
||||
&& let Some(d) = tile.get_or_insert_with(|| Tile::clone(&blank)).bytes_mut().get_mut(at(x))
|
||||
{
|
||||
*d = enc.get(usize::from(n)).copied().unwrap_or(one);
|
||||
*d = n;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -302,7 +351,8 @@ pub fn combine_sparse(a: &Surface, b: &Surface, area: Rect, f: impl Fn(f32, f32)
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// The Elliptical Marquee as it was: every pixel tested and written one at a time.
|
||||
/// The Elliptical Marquee one pixel at a time: every pixel tested and written on its own (the
|
||||
/// anti-aliased ramp through [`Ellipse::ramp`]).
|
||||
fn old_ellipse(r: Rect, area: Rect, aa: bool) -> Surface {
|
||||
let cut = r.intersect(&area);
|
||||
let mut shape = Surface::new(PixelFormat::GRAY8);
|
||||
@@ -318,6 +368,8 @@ mod tests {
|
||||
let corners = [(fx, fy), (fx + 1.0, fy), (fx, fy + 1.0), (fx + 1.0, fy + 1.0)].iter().filter(|(a, b)| inside(*a, *b)).count();
|
||||
let cov = if !aa {
|
||||
if inside(fx + 0.5, fy + 0.5) { 1.0 } else { 0.0 }
|
||||
} else if r.width().min(r.height()) > SMALL {
|
||||
Ellipse::new(r).ramp(x, y) as f32
|
||||
} else if corners == 4 {
|
||||
1.0
|
||||
} else {
|
||||
|
||||
@@ -762,6 +762,8 @@ fn documents_filesystem_path_params(id: &str, params: &str) -> bool {
|
||||
| "layer.combineShapes.excludeOverlappingShapes"
|
||||
| "layer.combineShapes.mergeShapeComponents"
|
||||
| "layer.new.frame"
|
||||
// `"stepName":"Transform Path"` names the History step, not a host file.
|
||||
| "edit.transform"
|
||||
) || id.starts_with("layer.newFillLayer.")
|
||||
|| id.starts_with("layer.newAdjustmentLayer.")
|
||||
{
|
||||
|
||||
@@ -289,10 +289,19 @@ fn new_artboard(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
};
|
||||
let background = background_param(p, cmd)?.unwrap_or_default();
|
||||
let name = p.get("name").and_then(Value::as_str).filter(|n| !n.is_empty()).map(str::to_string);
|
||||
let take_background = match p.get("takeBackground") {
|
||||
None => false,
|
||||
Some(v) => v.as_bool().ok_or_else(|| bad(cmd, "`takeBackground` must be true or false"))?,
|
||||
};
|
||||
let id = s.edit("New Artboard", |doc, active| {
|
||||
let mut g = Layer::group(name.unwrap_or_else(|| next_artboard_name(doc)), vec![]);
|
||||
set_artboard(&mut g, Artboard { rect, background, preset });
|
||||
// Only the first board takes the Background in (decided before the board exists).
|
||||
let take = take_background && doc.artboards().is_empty() && doc.background().is_some();
|
||||
let id = doc.insert_above(None, g);
|
||||
if take {
|
||||
move_background_into(doc, id);
|
||||
}
|
||||
fit_canvas(doc);
|
||||
*active = Some(id);
|
||||
Ok(id)
|
||||
@@ -301,6 +310,19 @@ fn new_artboard(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
Ok(json!({"layer": id.0, "rect": [rect.x0, rect.y0, rect.width(), rect.height()]}))
|
||||
}
|
||||
|
||||
/// Turns the Background into a normal layer ("Layer 0") and makes it the child of board `board`,
|
||||
/// as the reference does when the first artboard is drawn. Does nothing without a Background.
|
||||
fn move_background_into(doc: &mut Document, board: LayerId) {
|
||||
let Some(bg) = doc.background().map(|l| l.id) else { return };
|
||||
let Some(mut layer) = doc.remove(bg) else { return };
|
||||
crate::extra_cmds::unlock_background(&mut layer);
|
||||
match doc.layer_mut(board).and_then(Layer::children_mut) {
|
||||
Some(children) => children.push(layer),
|
||||
// Unreachable for a group; put the layer back rather than lose it.
|
||||
None => doc.layers.insert(0, layer),
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert a plain group at its content bounds; recorded guide IDs are ignored session metadata.
|
||||
fn artboard_from_group(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let cmd = "layer.new.artboardFromGroup";
|
||||
@@ -705,7 +727,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"layer.new.artboard",
|
||||
"Artboard…",
|
||||
&["Layer", "New"],
|
||||
r##"{"rect":[x,y,w,h]? | "x","y","width","height"? (default: canvas size, right of the last board),"preset":"iPhone 14|Web 1920|A4|…"?,"name":str?,"background":"white|black|transparent|custom"="white","color":[r,g,b]|"#rrggbb"? (custom)} → {layer, rect}"##,
|
||||
r##"{"rect":[x,y,w,h]? | "x","y","width","height"? (default: canvas size, right of the last board),"preset":"iPhone 14|Web 1920|A4|…"?,"name":str?,"background":"white|black|transparent|custom"="white","color":[r,g,b]|"#rrggbb"? (custom),"takeBackground":bool=false (the first board in the document also takes in the Background as a normal layer "Layer 0"; the Artboard tool's drag sets it)} → {layer, rect}"##,
|
||||
has_doc,
|
||||
new_artboard
|
||||
),
|
||||
@@ -768,6 +790,9 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
]
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "artboard_cmds/first_board_background_tests.rs"]
|
||||
mod first_board_background_tests;
|
||||
#[cfg(test)]
|
||||
#[path = "artboard_cmds/tests.rs"]
|
||||
mod tests;
|
||||
@@ -0,0 +1,127 @@
|
||||
//! The first drawn artboard takes the Background in as "Layer 0" (#11387): `takeBackground` on
|
||||
//! `layer.new.artboard`, at 8, 16 and 32 bit, with the cases that keep today's result.
|
||||
|
||||
use super::*;
|
||||
use photocraft_geom::Rect;
|
||||
|
||||
/// 800 x 600 with the white Background and a pixel layer "Red" at 100,100 to 300,250.
|
||||
fn session(depth: u32) -> Session {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", json!({"width": 800, "height": 600, "depth": depth, "background": "white"})).unwrap();
|
||||
s.edit("Red", |doc, active| {
|
||||
let fmt = doc.pixel_format();
|
||||
let mut l = Layer::raster("Red", fmt);
|
||||
l.surface_mut().unwrap().fill_rect(Rect { x0: 100, y0: 100, x1: 300, y1: 250 }, &photocraft_raster::from_rgba(&fmt, [1.0, 0.0, 0.0, 1.0]));
|
||||
let id = doc.insert_above(None, l);
|
||||
*active = Some(id);
|
||||
Ok(id)
|
||||
})
|
||||
.unwrap();
|
||||
s
|
||||
}
|
||||
|
||||
const WHITE: [f32; 4] = [1.0, 1.0, 1.0, 1.0];
|
||||
|
||||
fn doc(s: &Session) -> &Document {
|
||||
&s.active().unwrap().doc
|
||||
}
|
||||
|
||||
fn names(layers: &[Layer]) -> Vec<&str> {
|
||||
layers.iter().map(|l| l.name.as_str()).collect()
|
||||
}
|
||||
|
||||
fn steps(s: &Session) -> Vec<String> {
|
||||
s.active().unwrap().history.entries()
|
||||
}
|
||||
|
||||
fn draw(s: &mut Session, take: serde_json::Value) -> Result<Value> {
|
||||
s.execute("layer.new.artboard", json!({"rect": [400, 300, 200, 200], "takeBackground": take}))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_first_board_takes_the_background_in_as_layer_0() {
|
||||
for depth in [8, 16, 32] {
|
||||
let mut s = session(depth);
|
||||
let before = steps(&s).len();
|
||||
let r = draw(&mut s, json!(true)).unwrap();
|
||||
let board = LayerId(r["layer"].as_u64().unwrap());
|
||||
let d = doc(&s);
|
||||
assert_eq!(names(&d.layers), ["Red", "Artboard 1"], "{depth} bit");
|
||||
assert!(d.background().is_none(), "{depth} bit");
|
||||
let b = d.layer(board).unwrap();
|
||||
assert_eq!(r["rect"], json!([400, 300, 200, 200]));
|
||||
let kids = b.children().unwrap();
|
||||
assert_eq!(names(kids), ["Layer 0"], "{depth} bit");
|
||||
let l0 = kids.first().unwrap();
|
||||
assert!(!l0.locks.transparency && !l0.locks.position, "{depth} bit");
|
||||
// The Background's own pixels travel with it: white at both samples, and Red still red.
|
||||
assert_eq!(l0.surface().unwrap().rgba(150, 150), WHITE, "{depth} bit");
|
||||
assert_eq!(l0.surface().unwrap().rgba(700, 500), WHITE, "{depth} bit");
|
||||
let red = d.layers.first().unwrap();
|
||||
assert_eq!(red.surface().unwrap().rgba(150, 150), [1.0, 0.0, 0.0, 1.0], "{depth} bit");
|
||||
assert_eq!((d.size.width, d.size.height), (800, 600), "{depth} bit");
|
||||
assert_eq!(s.active().unwrap().active_layer, Some(board));
|
||||
let after = steps(&s);
|
||||
assert_eq!(after.len(), before + 1, "one history step");
|
||||
assert_eq!(after.last().map(String::as_str), Some("New Artboard"));
|
||||
// One undo brings the Background back at the bottom with its name and locks.
|
||||
s.undo();
|
||||
let d = doc(&s);
|
||||
assert_eq!(names(&d.layers), ["Background", "Red"], "{depth} bit");
|
||||
let bg = d.background().unwrap();
|
||||
assert!(bg.locks.transparency && bg.locks.position, "{depth} bit");
|
||||
assert_eq!(bg.surface().unwrap().rgba(150, 150), WHITE, "{depth} bit");
|
||||
assert_eq!(bg.surface().unwrap().rgba(700, 500), WHITE, "{depth} bit");
|
||||
assert!(d.artboards().is_empty());
|
||||
assert_eq!((d.size.width, d.size.height), (800, 600));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn without_the_param_or_with_false_the_background_stays_outside() {
|
||||
for p in [json!({"rect": [400, 300, 200, 200]}), json!({"rect": [400, 300, 200, 200], "takeBackground": false})] {
|
||||
let mut s = session(8);
|
||||
s.execute("layer.new.artboard", p).unwrap();
|
||||
assert_eq!(names(&doc(&s).layers), ["Background", "Red", "Artboard 1"]);
|
||||
assert!(doc(&s).background().is_some());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn with_a_board_already_present_the_result_is_as_today() {
|
||||
let mut s = session(8);
|
||||
s.execute("layer.new.artboard", json!({"rect": [0, 0, 100, 100]})).unwrap();
|
||||
draw(&mut s, json!(true)).unwrap();
|
||||
let d = doc(&s);
|
||||
assert_eq!(names(&d.layers), ["Background", "Red", "Artboard 1", "Artboard 2"]);
|
||||
assert!(d.background().is_some());
|
||||
assert!(d.artboards().iter().all(|b| b.1 != "Layer 0"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn without_a_background_the_result_is_as_today() {
|
||||
let mut s = session(8);
|
||||
s.execute("layer.new.layerFromBackground", json!({})).unwrap();
|
||||
assert!(doc(&s).background().is_none());
|
||||
draw(&mut s, json!(true)).unwrap();
|
||||
assert_eq!(names(&doc(&s).layers), ["Layer 0", "Red", "Artboard 1"]);
|
||||
assert!(doc(&s).layers.last().unwrap().children().unwrap().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_non_boolean_take_background_is_an_error_and_changes_nothing() {
|
||||
for bad in [json!("true"), json!(1), json!([true])] {
|
||||
let mut s = session(8);
|
||||
let (n, count) = (steps(&s).len(), doc(&s).layers.len());
|
||||
assert!(draw(&mut s, bad.clone()).is_err(), "{bad}");
|
||||
assert_eq!(steps(&s).len(), n, "{bad}");
|
||||
assert_eq!(doc(&s).layers.len(), count, "{bad}");
|
||||
assert!(doc(&s).background().is_some(), "{bad}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_param_is_listed_in_the_command_params_doc() {
|
||||
let spec = specs().into_iter().find(|c| c.id == "layer.new.artboard").unwrap();
|
||||
assert!(spec.params.contains("takeBackground"));
|
||||
}
|
||||
@@ -48,13 +48,16 @@ mod steps_layer;
|
||||
mod steps_layer_style;
|
||||
mod steps_lookup;
|
||||
mod steps_make;
|
||||
mod steps_perspective_warp;
|
||||
mod steps_type_path;
|
||||
|
||||
mod steps_other;
|
||||
mod steps_render;
|
||||
mod steps_selection;
|
||||
mod steps_shape_blur;
|
||||
mod steps_stack;
|
||||
mod steps_stylize;
|
||||
mod steps_video;
|
||||
mod tables;
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -77,6 +77,8 @@ fn convert_action(file: &AtnFile, a: &AtnAction, set: &str, unsupported: &mut Ve
|
||||
let (new_steps, enabled) = match mapped {
|
||||
Mapped::Steps(mut s) => {
|
||||
super::steps_gallery::remember_event(item, &mut s);
|
||||
super::steps_stack::remember_item(item, &mut s);
|
||||
super::steps_video::remember(item, &mut s);
|
||||
(s, item.enabled)
|
||||
}
|
||||
Mapped::Unsupported { harmless } => {
|
||||
@@ -165,7 +167,9 @@ pub(super) fn export_item(id: &str, params: &Value, set: &str) -> Option<AtnItem
|
||||
return Some(AtnItem { event, dictionary: name, descriptor: Some(descriptor), ..Default::default() });
|
||||
}
|
||||
let event = if e.code.is_empty() { AtnEvent::name(e.name) } else { AtnEvent::Code(e.code.as_bytes().try_into().ok()?) };
|
||||
Some(AtnItem { event, dictionary: e.label.as_bytes().to_vec(), descriptor: Some(descriptor), ..Default::default() })
|
||||
let omit_descriptor = super::steps_stack::without_descriptor(id, ¶ms) || super::steps_video::omitted(id, ¶ms);
|
||||
let descriptor = (!omit_descriptor).then_some(descriptor);
|
||||
Some(AtnItem { event, dictionary: e.label.as_bytes().to_vec(), descriptor, ..Default::default() })
|
||||
}
|
||||
|
||||
/// Photoshop applies only the rename when a Set mixes it with opacity or blend mode (#8304).
|
||||
|
||||
@@ -786,6 +786,30 @@ pub(super) const EVENTS: &[Event] = &[
|
||||
target_event!("disableLayerStyle", "Clear Layer Style", "layer.layerStyle.clear"),
|
||||
target_event!("rasterizeAll", "Rasterize All Layers", "layer.rasterize.allLayers"),
|
||||
target_event!("addBlankVideoLayer", "New Blank Video Layer", "layer.videoLayers.newBlankVideoLayer"),
|
||||
Event {
|
||||
code: "",
|
||||
name: "insertBlankFrame",
|
||||
label: "Insert Blank Frame",
|
||||
ids: &["layer.videoLayers.insertBlankFrame"],
|
||||
from: |d| super::steps_video::from(d, "layer.videoLayers.insertBlankFrame"),
|
||||
to: |_, p| super::steps_video::to(p),
|
||||
},
|
||||
Event {
|
||||
code: "",
|
||||
name: "duplicateFrame",
|
||||
label: "Duplicate Frame",
|
||||
ids: &["layer.videoLayers.duplicateFrame"],
|
||||
from: |d| super::steps_video::from(d, "layer.videoLayers.duplicateFrame"),
|
||||
to: |_, p| super::steps_video::to(p),
|
||||
},
|
||||
Event {
|
||||
code: "",
|
||||
name: "deleteFrame",
|
||||
label: "Delete Frame",
|
||||
ids: &["layer.videoLayers.deleteFrame"],
|
||||
from: |d| super::steps_video::from(d, "layer.videoLayers.deleteFrame"),
|
||||
to: |_, p| super::steps_video::to(p),
|
||||
},
|
||||
target_event!("isolateLayers", "Isolate Layers", "select.isolateLayers"),
|
||||
target_event!("textLoadDefaultTypeStyles", "Load Default Type Styles", "type.loadDefaultTypeStyles"),
|
||||
target_event!("textSaveDefaultTypeStyles", "Save Default Type Styles", "type.saveDefaultTypeStyles"),
|
||||
@@ -931,6 +955,22 @@ pub(super) const EVENTS: &[Event] = &[
|
||||
ev!("", "newPlacedLayer", "Convert to Smart Object", "layer.smartObjects.convertToSmartObject", &[]),
|
||||
ev!("", "placedLayerEditContents", "Edit Contents", "layer.smartObjects.editContents", &[]),
|
||||
ev!("", "updatePlacedLayer", "Update Smart Objects", "layer.smartObjects.updateModifiedContent", &[]),
|
||||
Event {
|
||||
code: "",
|
||||
name: "applyImageStackPluginRenderer",
|
||||
label: "Stack Mode",
|
||||
ids: super::steps_stack::MODE_IDS,
|
||||
from: super::steps_stack::mode_from,
|
||||
to: super::steps_stack::mode_to,
|
||||
},
|
||||
Event {
|
||||
code: "",
|
||||
name: "imageStackConvertSmartObject",
|
||||
label: "Stack Mode: None",
|
||||
ids: &[super::steps_stack::NONE],
|
||||
from: super::steps_stack::none_from,
|
||||
to: super::steps_stack::none_to,
|
||||
},
|
||||
target_event!("placedLayerMakeCopy", "New Smart Object via Copy", "layer.smartObjects.newSmartObjectViaCopy"),
|
||||
target_event!("placedLayerConvertToLayers", "Convert to Layers", "layer.smartObjects.convertToLayers"),
|
||||
target_event!("placedLayerConvertToEmbedded", "Convert to Embedded", "layer.smartObjects.convertToEmbedded"),
|
||||
@@ -1068,6 +1108,14 @@ pub(super) const EVENTS: &[Event] = &[
|
||||
ev!("", "autoCutout", "Select Subject", "select.subject", &[F("sampleAllLayers", "sampleAllLayers", Kind::Bool)]),
|
||||
Event { code: "ClrR", name: "colorRange", label: "Color Range", ids: &["select.colorRange"], from: color_range_from, to: color_range_to },
|
||||
// Edit.
|
||||
Event {
|
||||
code: "",
|
||||
name: "perspectiveWarpTransform",
|
||||
label: "Perspective Warp",
|
||||
ids: &[crate::distort_cmds::PERSPECTIVE],
|
||||
from: super::steps_perspective_warp::from,
|
||||
to: super::steps_perspective_warp::to,
|
||||
},
|
||||
Event {
|
||||
code: "Grdn",
|
||||
name: "gradientClassEvent",
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
//! Recorded Perspective Warp layout and warp planes (#10710).
|
||||
|
||||
use std::collections::BTreeSet;
|
||||
|
||||
use photocraft_algo::perspective::{Plane, linked_corners};
|
||||
use photocraft_algo::transform::{WARP_REACH, convex_quad};
|
||||
use photocraft_io::smart_map::{MAX_PERSPECTIVE_WARP_PLANES as MAX_PLANES, perspective_warp_geometry, perspective_warp_indexed_geometry};
|
||||
|
||||
use super::convert::normalise;
|
||||
use super::descriptors::{desc, enm, get_obj, get_ref, layer_ref, layer_target, px, ref_class};
|
||||
use super::events::pixel_target;
|
||||
use super::fields::{Mapped, step};
|
||||
use super::{D, Descriptor, ReferenceItem, Value, json};
|
||||
use crate::distort_cmds::PERSPECTIVE;
|
||||
|
||||
const EVENT: &str = "perspectiveWarpTransform";
|
||||
const SOURCE: &str = "__atnPerspectiveWarp";
|
||||
const RECT: &str = "__atnPerspectiveWarpRect";
|
||||
const MAX_DESCRIPTOR_BYTES: usize = 256 * 1024;
|
||||
|
||||
/// Allows exactly the measured keys, once each. The preserved descriptor retains their order.
|
||||
fn exact_keys(d: &Descriptor, keys: &[&str]) -> bool {
|
||||
d.name.0.len() <= 1024 && d.items.len() == keys.len() && keys.iter().all(|key| d.items.iter().filter(|(id, _)| id.is(key)).count() == 1)
|
||||
}
|
||||
|
||||
fn coordinate(value: f64) -> bool {
|
||||
value.abs() <= f64::from(WARP_REACH)
|
||||
}
|
||||
|
||||
fn rect_valid([left, top, right, bottom]: [f64; 4]) -> bool {
|
||||
[left, top, right, bottom].into_iter().all(coordinate) && left < right && top < bottom
|
||||
}
|
||||
|
||||
fn reference_rect(d: &Descriptor) -> Option<[f64; 4]> {
|
||||
let r = get_obj(d, "referenceRect")?;
|
||||
if !r.class_id.is("Rctn") || !exact_keys(r, &["Top ", "Left", "Btom", "Rght"]) {
|
||||
return None;
|
||||
}
|
||||
let number = |key| match r.get(key)? {
|
||||
D::UnitFloat { unit: [b'#', b'P', b'x', b'l'], value } => Some(*value),
|
||||
_ => None,
|
||||
};
|
||||
let r = [number("Left")?, number("Top ")?, number("Rght")?, number("Btom")?];
|
||||
rect_valid(r).then_some(r)
|
||||
}
|
||||
|
||||
fn objects<'a>(d: &'a Descriptor, key: &str, class: &str, keys: &[&str], max: usize) -> Option<&'a [D]> {
|
||||
let D::List(items) = d.get(key)? else { return None };
|
||||
(!items.is_empty() && items.len() <= max && items.iter().all(|item| matches!(item, D::Descriptor(d) if d.class_id.is(class) && exact_keys(d, keys))))
|
||||
.then_some(items)
|
||||
}
|
||||
|
||||
/// Each recorded index must link exactly the corners the native command would link. Edges
|
||||
/// shared by two faces must have opposite winding, since the native map has one neighbour per edge.
|
||||
fn same_topology(planes: &[Plane], indices: &[[usize; 4]], vertices: usize) -> Option<()> {
|
||||
let at = |plane: usize, corner: usize| indices.get(plane)?.get(corner);
|
||||
let mut linked = BTreeSet::new();
|
||||
for group in linked_corners(planes) {
|
||||
let &(plane, corner) = group.first()?;
|
||||
let index = at(plane, corner)?;
|
||||
if !linked.insert(*index) || !group.iter().all(|&(p, c)| at(p, c) == Some(index)) {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
let mut edges = BTreeSet::new();
|
||||
let distinct = indices.iter().all(|&[a, b, c, d]| [(a, b), (b, c), (c, d), (d, a)].into_iter().all(|edge| edges.insert(edge)));
|
||||
(linked.len() == vertices && distinct).then_some(())
|
||||
}
|
||||
|
||||
/// Decodes the recorded target and its document-space planes, retaining the reference rectangle
|
||||
/// for export. Unmodelled references and geometry stay as kept steps.
|
||||
fn parameters(d: &Descriptor) -> Option<Value> {
|
||||
if !(d.class_id.is(EVENT) || d.class_id.is("null")) || !exact_keys(d, &["null", "Md ", "referenceRect", "vertices", "warpedVertices", "quads"]) {
|
||||
return None;
|
||||
}
|
||||
if !matches!(d.get("Md ")?, D::Enumerated { type_id, value } if type_id.is("perspectiveWarpMode") && value.is("warp")) {
|
||||
return None;
|
||||
}
|
||||
let target = get_ref(d, "null")?;
|
||||
if target.len() != 1 || ref_class(target).as_deref() != Some("Lyr") {
|
||||
return None;
|
||||
}
|
||||
match target.first()? {
|
||||
ReferenceItem::Enumerated { type_id, value, .. } if type_id.is("Ordn") && value.is("Trgt") => {}
|
||||
ReferenceItem::Name { name, .. } if name.0.len() <= 1024 && String::from_utf16(&name.0).is_ok() && !name.to_string_lossy().is_empty() => {}
|
||||
ReferenceItem::Property { key, .. } if key.is("Bckg") => {}
|
||||
_ => return None,
|
||||
}
|
||||
let mut p = layer_target(target)?;
|
||||
let rect = reference_rect(d)?;
|
||||
let src = objects(d, "vertices", "Pnt ", &["Hrzn", "Vrtc"], 4 * MAX_PLANES)?;
|
||||
objects(d, "warpedVertices", "Pnt ", &["Hrzn", "Vrtc"], 4 * MAX_PLANES)?;
|
||||
objects(d, "quads", "perspectiveWarpQuad", &["indices"], MAX_PLANES)?;
|
||||
let (planes, indices) = perspective_warp_indexed_geometry(d)?;
|
||||
if !planes.iter().all(|p| p.src.iter().chain(&p.dst).flatten().copied().all(coordinate) && convex_quad(&p.src) && convex_quad(&p.dst)) {
|
||||
return None;
|
||||
}
|
||||
same_topology(&planes, &indices, src.len())?;
|
||||
p.insert("planes".into(), json!(planes));
|
||||
p.insert("target".into(), json!("pixels"));
|
||||
p.insert(RECT.into(), json!(rect));
|
||||
Some(Value::Object(p))
|
||||
}
|
||||
|
||||
/// Keep the exact recorded descriptor after decoding its executable settings.
|
||||
pub(super) fn from(d: &Descriptor) -> Mapped {
|
||||
let mapped = || {
|
||||
let mut p = parameters(d)?;
|
||||
let bytes = d.to_bytes();
|
||||
if bytes.len() > MAX_DESCRIPTOR_BYTES {
|
||||
return None;
|
||||
}
|
||||
p[SOURCE] = json!(crate::paint::tile::b64_encode(&bytes));
|
||||
Some(p)
|
||||
};
|
||||
mapped().map_or(Mapped::Unsupported { harmless: false }, |p| step(PERSPECTIVE, p))
|
||||
}
|
||||
|
||||
/// Emits the measured field order when the caller supplies the original reference rectangle.
|
||||
fn canonical(p: &Value) -> Option<Descriptor> {
|
||||
let [left, top, right, bottom] = serde_json::from_value(p.get(RECT)?.clone()).ok()?;
|
||||
if !rect_valid([left, top, right, bottom]) {
|
||||
return None;
|
||||
}
|
||||
let planes = p.get("planes")?.as_array().filter(|planes| (1..=MAX_PLANES).contains(&planes.len()))?;
|
||||
let planes: Vec<Plane> = serde_json::from_value(Value::Array(planes.clone())).ok()?;
|
||||
let rect = desc("Rctn").with("Top ", px(top)).with("Left", px(left)).with("Btom", px(bottom)).with("Rght", px(right));
|
||||
let (src, dst, quads) = perspective_warp_geometry(&planes);
|
||||
Some(
|
||||
desc(EVENT)
|
||||
.with("null", layer_ref(p)?)
|
||||
.with("Md ", enm("perspectiveWarpMode", "warp"))
|
||||
.with("referenceRect", D::Descriptor(rect))
|
||||
.with("vertices", src)
|
||||
.with("warpedVertices", dst)
|
||||
.with("quads", quads),
|
||||
)
|
||||
}
|
||||
|
||||
/// Reuses source bytes only while they still describe the same target, rectangle and planes.
|
||||
/// A changed recorded mesh cannot silently replace its indexed topology.
|
||||
pub(super) fn to(_: &str, p: &Value) -> Option<Descriptor> {
|
||||
if !pixel_target(p) || !p.as_object()?.keys().all(|k| ["layer", "planes", "target", "interpolation", RECT, SOURCE].contains(&k.as_str())) {
|
||||
return None;
|
||||
}
|
||||
if p.get("interpolation").is_some_and(|v| v.as_str() != Some("bicubic")) {
|
||||
return None;
|
||||
}
|
||||
let descriptor = if let Some(source) = p.get(SOURCE) {
|
||||
let text = source.as_str().filter(|v| v.len() <= MAX_DESCRIPTOR_BYTES * 2)?;
|
||||
let bytes = crate::paint::tile::b64_decode(text)?;
|
||||
if bytes.len() > MAX_DESCRIPTOR_BYTES {
|
||||
return None;
|
||||
}
|
||||
Descriptor::from_bytes(&bytes).ok()?
|
||||
} else {
|
||||
canonical(p)?
|
||||
};
|
||||
let mut expected = parameters(&descriptor)?;
|
||||
let mut actual = p.clone();
|
||||
let m = actual.as_object_mut()?;
|
||||
m.remove(SOURCE);
|
||||
m.remove("interpolation");
|
||||
if m.get("layer").is_some_and(Value::is_null) {
|
||||
m.remove("layer");
|
||||
}
|
||||
m.insert("target".into(), json!("pixels"));
|
||||
normalise(&mut actual);
|
||||
normalise(&mut expected);
|
||||
(actual == expected).then_some(descriptor)
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
//! Recorded Smart Object Stack Modes use the existing native mode commands.
|
||||
|
||||
use photocraft_doc::StackMode;
|
||||
|
||||
use super::descriptors::{class, desc, jstr, text};
|
||||
use super::fields::{Mapped, step};
|
||||
use super::{AtnItem, D, Descriptor, Value, json};
|
||||
|
||||
const PREFIX: &str = "layer.smartObjects.stackMode.";
|
||||
const SOURCE: &str = "_atnStackDescriptor";
|
||||
pub(super) const NONE: &str = "layer.smartObjects.stackMode.none";
|
||||
|
||||
pub(super) const MODE_IDS: &[&str] = &[
|
||||
"layer.smartObjects.stackMode.range",
|
||||
"layer.smartObjects.stackMode.entropy",
|
||||
"layer.smartObjects.stackMode.kurtosis",
|
||||
"layer.smartObjects.stackMode.maximum",
|
||||
"layer.smartObjects.stackMode.median",
|
||||
"layer.smartObjects.stackMode.minimum",
|
||||
"layer.smartObjects.stackMode.mean",
|
||||
"layer.smartObjects.stackMode.skewness",
|
||||
"layer.smartObjects.stackMode.standardDeviation",
|
||||
"layer.smartObjects.stackMode.summation",
|
||||
"layer.smartObjects.stackMode.variance",
|
||||
];
|
||||
|
||||
const MODES: &[(&str, StackMode)] = &[
|
||||
("rang", StackMode::Range),
|
||||
("entr", StackMode::Entropy),
|
||||
("kurt", StackMode::Kurtosis),
|
||||
("maxx", StackMode::Maximum),
|
||||
("medn", StackMode::Median),
|
||||
("minn", StackMode::Minimum),
|
||||
("avrg", StackMode::Mean),
|
||||
("skew", StackMode::Skewness),
|
||||
("stdv", StackMode::StandardDeviation),
|
||||
("summ", StackMode::Summation),
|
||||
("vari", StackMode::Variance),
|
||||
];
|
||||
|
||||
/// The plug-in class selects the mode; its localized display name does not.
|
||||
fn recorded_mode(d: &Descriptor) -> Option<(&'static str, StackMode)> {
|
||||
if d.items.len() != 2 {
|
||||
return None;
|
||||
}
|
||||
let (Some(D::Class(plugin)), Some(D::Text(_))) = (d.get("imageStackPlugin"), d.get("Nm ")) else { return None };
|
||||
MODES.iter().copied().find(|(code, _)| plugin.class_id.is(code))
|
||||
}
|
||||
|
||||
fn descriptor(code: &str, mode: StackMode) -> Descriptor {
|
||||
desc("null").with("imageStackPlugin", D::Class(class(code))).with("Nm ", text(mode.label()))
|
||||
}
|
||||
|
||||
/// Keep descriptor names, key order, class encodings and original UTF-16 text on unchanged saves.
|
||||
fn params(d: &Descriptor, canonical: &Descriptor) -> Value {
|
||||
let mut p = json!({});
|
||||
if d != canonical {
|
||||
p[SOURCE] = photocraft_paint::tile::b64_encode(&d.to_bytes()).into();
|
||||
}
|
||||
p
|
||||
}
|
||||
|
||||
fn original(p: &Value) -> Option<Descriptor> {
|
||||
Descriptor::from_bytes(&photocraft_paint::tile::b64_decode(jstr(p, SOURCE)?)?).ok()
|
||||
}
|
||||
|
||||
/// The descriptorless form reaches the mapper as a default empty `null` descriptor.
|
||||
fn is_none_descriptor(d: &Descriptor) -> bool {
|
||||
d.items.is_empty() && d.class_id.is("null")
|
||||
}
|
||||
|
||||
/// Unknown mode classes, types, duplicate keys and extra settings stay complete kept steps.
|
||||
pub(super) fn mode_from(d: &Descriptor) -> Mapped {
|
||||
let Some((code, mode)) = recorded_mode(d) else { return Mapped::Unsupported { harmless: false } };
|
||||
step(&format!("{PREFIX}{}", mode.id()), params(d, &descriptor(code, mode)))
|
||||
}
|
||||
|
||||
/// The measured form targets the active Smart Object; explicit native targets refuse export.
|
||||
pub(super) fn mode_to(id: &str, p: &Value) -> Option<Descriptor> {
|
||||
if p.as_object()?.keys().any(|key| key != SOURCE) {
|
||||
return None;
|
||||
}
|
||||
let suffix = id.strip_prefix(PREFIX)?;
|
||||
let (code, mode) = MODES.iter().copied().find(|(_, mode)| suffix == mode.id())?;
|
||||
let canonical = descriptor(code, mode);
|
||||
if p.get(SOURCE).is_none() {
|
||||
return Some(canonical);
|
||||
}
|
||||
let source = original(p)?;
|
||||
if is_none_descriptor(&source) {
|
||||
return Some(canonical);
|
||||
}
|
||||
let (_, recorded) = recorded_mode(&source)?;
|
||||
Some(if recorded == mode { source } else { canonical })
|
||||
}
|
||||
|
||||
/// None has no recorded settings and removes the native Smart Object stack mode.
|
||||
pub(super) fn none_from(d: &Descriptor) -> Mapped {
|
||||
if is_none_descriptor(d) { step(NONE, json!({})) } else { Mapped::Unsupported { harmless: false } }
|
||||
}
|
||||
|
||||
pub(super) fn none_to(_: &str, p: &Value) -> Option<Descriptor> {
|
||||
if p.as_object()?.keys().any(|key| key != SOURCE) {
|
||||
return None;
|
||||
}
|
||||
if p.get(SOURCE).is_none() {
|
||||
return Some(desc("null"));
|
||||
}
|
||||
let source = original(p)?;
|
||||
if is_none_descriptor(&source) {
|
||||
return Some(source);
|
||||
}
|
||||
recorded_mode(&source).map(|_| desc("null"))
|
||||
}
|
||||
|
||||
/// Import otherwise presents an absent descriptor as an empty one. Retain the distinction for None.
|
||||
pub(super) fn remember_item(item: &AtnItem, steps: &mut [(String, Value)]) {
|
||||
if let [(id, Value::Object(p))] = steps
|
||||
&& id.as_str() == NONE
|
||||
&& let Some(d) = &item.descriptor
|
||||
{
|
||||
p.insert(SOURCE.into(), photocraft_paint::tile::b64_encode(&d.to_bytes()).into());
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn without_descriptor(id: &str, p: &Value) -> bool {
|
||||
id == NONE && p.get(SOURCE).is_none()
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
//! The three measured, option-free edits of the active video layer's current frame.
|
||||
use super::{
|
||||
AtnItem, Descriptor, Value,
|
||||
fields::{Mapped, step},
|
||||
json,
|
||||
};
|
||||
|
||||
const NO_DESCRIPTOR: &str = "_atnVideoFrameNoDescriptor";
|
||||
|
||||
/// These events edit video footage, separately from document frame animation.
|
||||
fn frame_command(id: &str) -> bool {
|
||||
matches!(id, "layer.videoLayers.insertBlankFrame" | "layer.videoLayers.duplicateFrame" | "layer.videoLayers.deleteFrame")
|
||||
}
|
||||
|
||||
/// Only the measured empty descriptor is executable; extra settings remain kept.
|
||||
pub(super) fn from(d: &Descriptor, id: &str) -> Mapped {
|
||||
if *d == Descriptor::default() { step(id, json!({})) } else { Mapped::Unsupported { harmless: false } }
|
||||
}
|
||||
|
||||
/// Import's absent-descriptor placeholder must not become a descriptor on save.
|
||||
pub(super) fn remember(item: &AtnItem, steps: &mut [(String, Value)]) {
|
||||
if item.descriptor.is_none() {
|
||||
for (id, params) in steps {
|
||||
if frame_command(id)
|
||||
&& let Some(params) = params.as_object_mut()
|
||||
{
|
||||
params.insert(NO_DESCRIPTOR.into(), Value::Bool(true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Refuse native options and malformed transport data that have no wire field.
|
||||
pub(super) fn to(p: &Value) -> Option<Descriptor> {
|
||||
p.as_object()?.iter().all(|(key, value)| key == NO_DESCRIPTOR && value == &Value::Bool(true)).then(Descriptor::default)
|
||||
}
|
||||
|
||||
/// Called only after `to` has validated the complete native parameter object.
|
||||
pub(super) fn omitted(id: &str, p: &Value) -> bool {
|
||||
frame_command(id) && p.get(NO_DESCRIPTOR) == Some(&Value::Bool(true))
|
||||
}
|
||||
@@ -658,6 +658,11 @@ fn settings_at_the_value_the_event_plays_still_export() {
|
||||
/// Each mapped command retains its parameters through its corresponding ATN descriptor.
|
||||
fn every_mapped_command_exports_and_imports_back() {
|
||||
let cases: Vec<(&str, Value)> = vec![
|
||||
(
|
||||
"edit.perspectiveWarp",
|
||||
json!({"planes":[{"src":[[4,4],[16,4],[16,20],[4,20]],"dst":[[5,5],[17,4],[18,20],[4,19]]}],
|
||||
"target":"pixels","__atnPerspectiveWarpRect":[0,0,32,24]}),
|
||||
),
|
||||
(
|
||||
"paint.gradient",
|
||||
json!({"from":[1,1],"to":[6,2],"style":"linear","method":"classic","smoothness":100,
|
||||
@@ -680,6 +685,18 @@ fn every_mapped_command_exports_and_imports_back() {
|
||||
),
|
||||
("edit.fade", json!({"opacity":50,"mode":"Multiply"})),
|
||||
("layer.linkLayers", json!({})),
|
||||
("layer.smartObjects.stackMode.range", json!({})),
|
||||
("layer.smartObjects.stackMode.entropy", json!({})),
|
||||
("layer.smartObjects.stackMode.kurtosis", json!({})),
|
||||
("layer.smartObjects.stackMode.maximum", json!({})),
|
||||
("layer.smartObjects.stackMode.median", json!({})),
|
||||
("layer.smartObjects.stackMode.minimum", json!({})),
|
||||
("layer.smartObjects.stackMode.mean", json!({})),
|
||||
("layer.smartObjects.stackMode.skewness", json!({})),
|
||||
("layer.smartObjects.stackMode.standardDeviation", json!({})),
|
||||
("layer.smartObjects.stackMode.summation", json!({})),
|
||||
("layer.smartObjects.stackMode.variance", json!({})),
|
||||
("layer.smartObjects.stackMode.none", json!({})),
|
||||
("layer.distribute.leftEdges", json!({})),
|
||||
("layer.distribute.horizontalCenters", json!({})),
|
||||
("layer.distribute.rightEdges", json!({})),
|
||||
@@ -826,6 +843,9 @@ fn every_mapped_command_exports_and_imports_back() {
|
||||
("type.loadDefaultTypeStyles", json!({})),
|
||||
("type.saveDefaultTypeStyles", json!({})),
|
||||
("image.analysis.recordMeasurements", json!({})),
|
||||
("layer.videoLayers.insertBlankFrame", json!({})),
|
||||
("layer.videoLayers.duplicateFrame", json!({})),
|
||||
("layer.videoLayers.deleteFrame", json!({})),
|
||||
("file.automate.cropAndStraightenPhotos", json!({})),
|
||||
("file.automate.cropAndStraightenPhotos", json!({"_atnNoTarget": true})),
|
||||
("layer.new.artboardFromGroup", json!({})),
|
||||
@@ -1054,7 +1074,9 @@ fn every_mapped_command_exports_and_imports_back() {
|
||||
continue;
|
||||
}
|
||||
let e = event_for(&item.event).unwrap_or_else(|| panic!("{id} exported as an unknown event {}", item.event.id()));
|
||||
match (e.from)(item.descriptor.as_ref().unwrap()) {
|
||||
assert_eq!(item.descriptor.is_none(), *id == super::steps_stack::NONE, "{id}: unexpected descriptor presence");
|
||||
let descriptor = item.descriptor.unwrap_or_default();
|
||||
match (e.from)(&descriptor) {
|
||||
Mapped::Steps(steps) => {
|
||||
assert_eq!(steps.len(), 1, "{id}: {steps:?}");
|
||||
let navigation = match *id {
|
||||
@@ -1080,6 +1102,9 @@ fn every_mapped_command_exports_and_imports_back() {
|
||||
// Executable values match; independent public tests verify the source carrier.
|
||||
back.as_object_mut().unwrap().remove("__atnClassicGradient");
|
||||
}
|
||||
if *id == "edit.perspectiveWarp" {
|
||||
back.as_object_mut().unwrap().remove("__atnPerspectiveWarp");
|
||||
}
|
||||
normalise(&mut back);
|
||||
if *id == "actions.play" || *id == "actions.conditional" {
|
||||
back["set"] = json!("S");
|
||||
|
||||
@@ -407,7 +407,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
CommandSpec {
|
||||
id: PUPPET_SMART,
|
||||
label: "Puppet Warp",
|
||||
menu: &["Layer", "Smart Objects"],
|
||||
menu: &[],
|
||||
shortcut: None,
|
||||
params: P,
|
||||
enabled: smart_layer,
|
||||
@@ -427,7 +427,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
CommandSpec {
|
||||
id: PERSPECTIVE_SMART,
|
||||
label: "Perspective Warp",
|
||||
menu: &["Layer", "Smart Objects"],
|
||||
menu: &[],
|
||||
shortcut: None,
|
||||
params: Q,
|
||||
enabled: smart_layer,
|
||||
|
||||
@@ -279,7 +279,7 @@ fn content_aware_native_with_options(
|
||||
let window = sampling_window(hole_bounds, canvas);
|
||||
let n = surf.format().channels();
|
||||
let (w, h) = window_size(window)?;
|
||||
let img = surf.read_region(window);
|
||||
let img = crate::allocation::read_region(surf, window, "Content-Aware fill samples")?;
|
||||
let len = w.checked_mul(h).ok_or_else(|| EngineError::Other("the area is too large for Content-Aware fill".into()))?;
|
||||
let mut hole = crate::allocation::filled(len, false, "Content-Aware fill")?;
|
||||
let mut source = crate::allocation::filled(len, false, "Content-Aware fill")?;
|
||||
|
||||
@@ -243,6 +243,8 @@ pub struct Floating {
|
||||
/// The piece has been moved at least once, even if it is back where it was cut (nudged away
|
||||
/// and back): its selection is the moved pixels' then, as each of Photoshop's nudges leaves it.
|
||||
pub moved: bool,
|
||||
/// History step name when dropped; `None` is "Move". The Move tool names a ⌥-drag copy "Duplicate".
|
||||
pub step_name: Option<String>,
|
||||
}
|
||||
|
||||
/// The floating piece of `st`, if it is still valid (the document hasn't changed under it).
|
||||
@@ -289,12 +291,14 @@ pub fn locked_for_float(doc: &Document, l: &photocraft_doc::Layer) -> bool {
|
||||
fn float(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let (dx, dy) = (int_param(p, "dx"), int_param(p, "dy"));
|
||||
let copy = p.get("copy").and_then(Value::as_bool).unwrap_or(false);
|
||||
// A name for the History step that drops the piece: short and not blank, else the default.
|
||||
let step_name = p.get("stepName").and_then(Value::as_str).map(str::trim).filter(|s| !s.is_empty() && s.chars().count() <= 64).map(str::to_string);
|
||||
let background = s.tools.background;
|
||||
let st = s.active_mut().ok_or(EngineError::NoDocument)?;
|
||||
if floating(st).is_none() {
|
||||
let layer = st.active_layer.ok_or_else(|| EngineError::Other("no active layer".into()))?;
|
||||
let parts = CutParts::new(&st.doc, layer, copy, background, crate::channel_cmds::target_of(p) == crate::channel_cmds::Target::Mask)?;
|
||||
st.floating = Some(Floating { layer, offset: (0, 0), revision: st.revision, parts: Arc::new(parts), moved: false });
|
||||
st.floating = Some(Floating { layer, offset: (0, 0), revision: st.revision, parts: Arc::new(parts), moved: false, step_name });
|
||||
}
|
||||
let f = st.floating.as_mut().ok_or(EngineError::NoDocument)?;
|
||||
f.offset = (f.offset.0.saturating_add(dx), f.offset.1.saturating_add(dy));
|
||||
@@ -311,20 +315,21 @@ pub fn drop_floating(s: &mut Session) -> Result<Value> {
|
||||
return Ok(json!({"dropped": false}));
|
||||
};
|
||||
st.floating = None;
|
||||
let name = f.step_name.clone().unwrap_or_else(|| "Move".to_string());
|
||||
let (dx, dy) = f.offset;
|
||||
if (dx, dy) == (0, 0) {
|
||||
// Back where it was cut: the pixels are as they were. A piece that never moved (a click)
|
||||
// changes nothing; one nudged away and back keeps the moved pixels' selection (#7538).
|
||||
if let Some(outline) = f.parts.outline().filter(|_| f.moved) {
|
||||
let outline = outline.clone();
|
||||
s.edit("Move", |doc, _| {
|
||||
s.edit(&name, |doc, _| {
|
||||
doc.selection = Some(outline);
|
||||
Ok(())
|
||||
})?;
|
||||
}
|
||||
return Ok(json!({"dropped": true, "offset": [0, 0]}));
|
||||
}
|
||||
s.edit("Move", |doc, _| {
|
||||
s.edit(&name, |doc, _| {
|
||||
f.parts.place(doc, dx, dy)?;
|
||||
let sel = f.parts.outline().or(doc.selection.as_ref());
|
||||
doc.selection = sel.map(|sel| photocraft_algo::resample::translate_surface(sel, dx, dy));
|
||||
@@ -374,7 +379,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
label: "Float Selection",
|
||||
menu: &[],
|
||||
shortcut: None,
|
||||
params: r##"{"dx":px=0,"dy":px=0,"copy":bool=false,"target":"pixels"|"mask"="pixels" (mask: float the selected part of the layer's mask, the hole takes the background colour)} → {layer, offset} (cuts the selected pixels of the active layer into a floating piece the first time, or with copy leaves them and floats a duplicate; on the Background the hole takes the background colour; then moves it by whole pixels; dropped by select.drop or any other command, put back by edit.undo)"##,
|
||||
params: r##"{"dx":px=0,"dy":px=0,"copy":bool=false,"stepName":string="Move" (History name of the step that drops the piece; blank or over 64 characters falls back to Move),"target":"pixels"|"mask"="pixels" (mask: float the selected part of the layer's mask, the hole takes the background colour)} → {layer, offset} (cuts the selected pixels of the active layer into a floating piece the first time, or with copy leaves them and floats a duplicate; on the Background the hole takes the background colour; then moves it by whole pixels; dropped by select.drop or any other command, put back by edit.undo)"##,
|
||||
enabled: can_float,
|
||||
journal: true,
|
||||
run: float,
|
||||
|
||||
@@ -798,6 +798,7 @@ fn crop_with(s: &mut Session, p: &Value, keep_background: bool) -> Result<Value>
|
||||
// Only the Crop tool's frame (an explicit rectangle) resizes a canvas-sized artboard; a
|
||||
// selection crop leaves boards as they are.
|
||||
let tool_frame = explicit.is_some();
|
||||
let mut filled = false;
|
||||
s.edit("Crop", |doc, active| {
|
||||
let original = doc.size;
|
||||
let board = if tool_frame { canvas_artboard(doc) } else { None };
|
||||
@@ -809,11 +810,14 @@ fn crop_with(s: &mut Session, p: &Value, keep_background: bool) -> Result<Value>
|
||||
// A straight crop fills all of the area past the old canvas, pixels an earlier Delete Cropped
|
||||
// Pixels off crop hid there included, as Photoshop does; only a turned frame keeps them (#8060).
|
||||
if content_aware {
|
||||
crate::crop_fill::fill_uncovered(doc, *active, &crate::crop_fill::Coverage::crop(r, original.width, original.height))?;
|
||||
filled = crate::crop_fill::fill_uncovered(doc, *active, &crate::crop_fill::Coverage::crop(r, original.width, original.height), delete)?;
|
||||
}
|
||||
doc.selection = None;
|
||||
target.apply(doc)
|
||||
})?;
|
||||
if filled && let Some(st) = s.active_mut() {
|
||||
st.history.set_current_label("Content-aware Crop");
|
||||
}
|
||||
Ok(crop_result(s, json!({ "x": r.x0, "y": r.y0, "width": r.width(), "height": r.height() })))
|
||||
}
|
||||
|
||||
@@ -981,6 +985,7 @@ fn rotated_crop(s: &mut Session, r: Rect, angle: f64, delete: bool, content_awar
|
||||
};
|
||||
// The canvas board, found before the turn, fits the frame as in a straight crop.
|
||||
let board = s.active().and_then(|d| canvas_artboard(&d.doc));
|
||||
let mut filled = false;
|
||||
crate::analysis_cmds::compound(s, "Crop", |s| {
|
||||
// Pixels the crop deletes needn't be turned first: keeping only what lands in the frame
|
||||
// makes the rotation cost the frame's size, not the canvas's (a small turned crop of a
|
||||
@@ -1018,12 +1023,15 @@ fn rotated_crop(s: &mut Session, r: Rect, angle: f64, delete: bool, content_awar
|
||||
crop_doc(doc, CMD, target, delete, extension)?;
|
||||
fit_canvas_artboard(doc, board);
|
||||
if content_aware {
|
||||
crate::crop_fill::fill_uncovered(doc, *active, &coverage)?;
|
||||
filled = crate::crop_fill::fill_uncovered(doc, *active, &coverage, delete)?;
|
||||
}
|
||||
doc.selection = None;
|
||||
crop_target.apply(doc)
|
||||
})
|
||||
})?;
|
||||
if filled && let Some(st) = s.active_mut() {
|
||||
st.history.set_current_label("Content-aware Crop");
|
||||
}
|
||||
Ok(crop_result(s, json!({ "x": r.x0, "y": r.y0, "width": r.width(), "height": r.height(), "angle": angle })))
|
||||
}
|
||||
|
||||
@@ -1192,7 +1200,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"image.crop",
|
||||
"Crop",
|
||||
["Image"],
|
||||
r##"{"x":px,"y":px,"width":px,"height":px,"angle":-3600..3600=0,"deleteCroppedPixels":bool=true,"contentAware":bool=false,"targetWidth":px,"targetHeight":px,"resolution":ppi,"resample":"bicubic|bilinear|nearest|lanczos|preserveDetails"="bicubic"} → {x,y,width,height,documentWidth,documentHeight,resolution} (targetWidth/targetHeight, both or neither: the cropped area is resampled to exactly that size, as Image Size, in the same undo step; resolution: the document's new ppi; deleteCroppedPixels false: the pixels past the frame are kept and, unless contentAware, the Background becomes a normal layer, "Layer 0", so an extension is transparent on every layer (with contentAware the Background stays); contentAware: the Crop tool's Fill › Content-Aware Fill, the area a rotated or extending crop uncovers filled from its surroundings on the Background, else the active pixel layer)"##,
|
||||
r##"{"x":px,"y":px,"width":px,"height":px,"angle":-3600..3600=0,"deleteCroppedPixels":bool=true,"contentAware":bool=false,"targetWidth":px,"targetHeight":px,"resolution":ppi,"resample":"bicubic|bilinear|nearest|lanczos|preserveDetails"="bicubic"} → {x,y,width,height,documentWidth,documentHeight,resolution} (targetWidth/targetHeight, both or neither: the cropped area is resampled to exactly that size, as Image Size, in the same undo step; resolution: the document's new ppi; deleteCroppedPixels false: the pixels past the frame are kept and, unless contentAware, the Background becomes a normal layer, "Layer 0", so an extension is transparent on every layer (with contentAware the Background stays); contentAware: the Crop tool's Fill › Content-Aware Fill uses surrounding pixels to fill areas uncovered by a rotated or extending crop. The fill targets the Background, or the active pixel layer if there is no Background. With Delete Cropped Pixels on, it also targets a separate active pixel layer if it is visible and unlocked.)"##,
|
||||
has_doc,
|
||||
crop
|
||||
),
|
||||
|
||||
@@ -158,7 +158,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"layer.lockLayers",
|
||||
"Lock Layers…",
|
||||
&["Layer"],
|
||||
None,
|
||||
Some("Cmd+/"),
|
||||
r##"{"transparency":bool?,"pixels":bool?,"position":bool?,"artboard":bool?,"all":bool?} (none given: toggle lock all)"##,
|
||||
has_layer,
|
||||
lock_layers
|
||||
|
||||
@@ -163,6 +163,11 @@ fn affine_params(cmd: &str, p: &Value, r: [f64; 4]) -> Result<Homography> {
|
||||
/// scale/rotate/move, refused when the result would not fit the transform budget.
|
||||
fn transform_selection(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
const CMD: &str = "select.transformSelection";
|
||||
let step_name = match p.get("stepName") {
|
||||
None | Some(Value::Null) => "Transform Selection",
|
||||
Some(Value::String(n)) if n == "Move Selection" => "Move Selection",
|
||||
Some(_) => return Err(bad(CMD, "`stepName` must be \"Move Selection\"")),
|
||||
};
|
||||
let d = s.active().ok_or(EngineError::NoDocument)?;
|
||||
let sel = d.doc.selection.as_ref().ok_or_else(|| EngineError::Other("no selection".into()))?;
|
||||
let b = sel.content_bounds();
|
||||
@@ -206,7 +211,7 @@ fn transform_selection(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
if h.0.iter().zip(Homography::IDENTITY.0).all(|(a, b)| (a - b).abs() < 1e-12) {
|
||||
return Ok(json!({"changed": false, "selected": true}));
|
||||
}
|
||||
let selected = s.edit("Transform Selection", |doc, _| {
|
||||
let selected = s.edit(step_name, |doc, _| {
|
||||
if let Some(sel) = &doc.selection {
|
||||
crate::transform_cmds::check_budget(sel.content_bounds(), &h, "selection", sel.format())?;
|
||||
doc.selection = Some(crate::transform_cmds::warp_gray(sel, &h, interp)?).filter(|s| !s.content_bounds().is_empty());
|
||||
@@ -250,7 +255,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
label: "Transform Selection",
|
||||
menu: &["Select"],
|
||||
shortcut: None,
|
||||
params: r##"{"rect":[x0,y0,x1,y1]? (frame; default = selection bounds),"quad"|"corners":[[x,y]×4]? (where the frame's corners go: distort/perspective),"matrix":[a,b,c,d,e,f]?,"scaleX":%=100,"scaleY":%=100,"rotate":deg=0,"skewX":deg=0,"skewY":deg=0,"dx":px=0,"dy":px=0,"reference":"center|topLeft|top|topRight|left|right|bottomLeft|bottom|bottomRight"|[x,y]="center","style"|"mesh"|"grid"|"warp":… (warp, as edit.transform.warp),"interpolation":"bilinear|bicubic|nearest|bicubicSharper|bicubicSmoother|bicubicAutomatic"="bilinear" (Photoshop's bicubic variants render as Bicubic)}"##,
|
||||
params: r##"{"rect":[x0,y0,x1,y1]? (frame; default = selection bounds),"quad"|"corners":[[x,y]×4]? (where the frame's corners go: distort/perspective),"matrix":[a,b,c,d,e,f]?,"scaleX":%=100,"scaleY":%=100,"rotate":deg=0,"skewX":deg=0,"skewY":deg=0,"dx":px=0,"dy":px=0,"stepName":"Move Selection"? (History step name for a plain move; the UI sends it for a drag of the outline; default "Transform Selection"; any other value is refused),"reference":"center|topLeft|top|topRight|left|right|bottomLeft|bottom|bottomRight"|[x,y]="center","style"|"mesh"|"grid"|"warp":… (warp, as edit.transform.warp),"interpolation":"bilinear|bicubic|nearest|bicubicSharper|bicubicSmoother|bicubicAutomatic"="bilinear" (Photoshop's bicubic variants render as Bicubic)}"##,
|
||||
enabled: has_selection,
|
||||
run: transform_selection,
|
||||
journal: true,
|
||||
@@ -422,6 +427,23 @@ mod tests {
|
||||
assert!(s.execute("select.transformSelection", json!({"scaleX": 0})).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transform_selection_step_name_is_restricted() {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", json!({"width": 60, "height": 40})).unwrap();
|
||||
s.execute("select.rect", json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap();
|
||||
let last = |s: &Session| s.active().unwrap().history.entries().last().cloned().unwrap();
|
||||
s.execute("select.transformSelection", json!({"dx": 5, "dy": 0})).unwrap();
|
||||
assert_eq!(last(&s), "Transform Selection");
|
||||
s.execute("select.transformSelection", json!({"dx": 5, "dy": 0, "stepName": "Move Selection"})).unwrap();
|
||||
assert_eq!(last(&s), "Move Selection");
|
||||
let n = s.active().unwrap().history.past_len();
|
||||
for bad_name in [json!("Crop"), json!(""), json!(7)] {
|
||||
assert!(s.execute("select.transformSelection", json!({"dx": 5, "dy": 0, "stepName": bad_name})).is_err());
|
||||
}
|
||||
assert_eq!(s.active().unwrap().history.past_len(), n);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transform_selection_needs_a_selection() {
|
||||
let mut s = Session::new();
|
||||
|
||||
@@ -621,7 +621,9 @@ fn lasso(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
if pts.len() < 3 {
|
||||
return Err(EngineError::BadParams { cmd: "select.lasso".into(), msg: "needs at least 3 points".into() });
|
||||
}
|
||||
polygon_selection(s, "select.lasso", "Lasso", &pts, p)
|
||||
// The History step is named after the tool: the Polygonal Lasso sends `polygonal` (Photoshop).
|
||||
let step = if b(p, "polygonal", false) { "Polygonal Lasso" } else { "Lasso" };
|
||||
polygon_selection(s, "select.lasso", step, &pts, p)
|
||||
}
|
||||
|
||||
/// Selects the polygon `pts` with the lasso tools' `mode`, `antiAlias` and `feather` params, as
|
||||
@@ -754,7 +756,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"select.lasso",
|
||||
"Lasso",
|
||||
[],
|
||||
r##"{"points":[[x,y],…],"mode":"replace|add|subtract|intersect"="replace","antiAlias":bool=true,"feather":px=0}"##,
|
||||
r##"{"points":[[x,y],…],"mode":"replace|add|subtract|intersect"="replace","antiAlias":bool=true,"feather":px=0,"polygonal":bool=false}"##,
|
||||
has_doc,
|
||||
lasso
|
||||
),
|
||||
|
||||
@@ -101,6 +101,48 @@ fn has_linked(s: &Session) -> std::result::Result<(), String> {
|
||||
_ => Err("the smart object is embedded".into()),
|
||||
}
|
||||
}
|
||||
fn linked_layers(doc: &Document) -> Vec<LayerId> {
|
||||
doc.walk()
|
||||
.into_iter()
|
||||
.filter(|(_, _, l)| matches!(&l.content, LayerContent::Smart(sm) if matches!(sm.source, SmartSource::Linked { .. })))
|
||||
.map(|(_, _, l)| l.id)
|
||||
.collect()
|
||||
}
|
||||
fn has_any_linked(s: &Session) -> std::result::Result<(), String> {
|
||||
let d = s.active().ok_or("no document open")?;
|
||||
if linked_layers(&d.doc).is_empty() { Err("the document has no linked smart object".into()) } else { Ok(()) }
|
||||
}
|
||||
/// Embed All Linked: reads every linked file first, so a missing one refuses the whole step.
|
||||
fn embed_all_linked(s: &mut Session, _p: &Value) -> Result<Value> {
|
||||
let doc = &s.active().ok_or(EngineError::NoDocument)?.doc;
|
||||
let ids = linked_layers(doc);
|
||||
if ids.is_empty() {
|
||||
return Err(other("the document has no linked smart object"));
|
||||
}
|
||||
let mut sources = Vec::with_capacity(ids.len());
|
||||
for id in &ids {
|
||||
let src = &smart(doc, *id)?.source;
|
||||
let (file_name, bytes) = source_bytes(&doc.metadata, src).ok_or_else(|| {
|
||||
let path = match src {
|
||||
SmartSource::Linked { path } => path.as_str(),
|
||||
SmartSource::Embedded { .. } => "",
|
||||
};
|
||||
other(format!("the linked file can't be read: {path}"))
|
||||
})?;
|
||||
sources.push(SmartSource::Embedded { file_name, bytes });
|
||||
}
|
||||
let parent = doc.id;
|
||||
let contents: Vec<SmartContentsId> = ids.iter().map(|id| smart(doc, *id).map(|sm| sm.contents_id)).collect::<Result<_>>()?;
|
||||
s.edit("Embed All Linked", |doc, _| {
|
||||
for (id, src) in ids.iter().zip(sources) {
|
||||
smart_mut(doc, *id)?.source = src;
|
||||
refresh_or_fail(doc, *id)?;
|
||||
}
|
||||
Ok(())
|
||||
})?;
|
||||
s.smart_links.retain(|l| l.parent != parent || !contents.contains(&l.contents_id));
|
||||
Ok(json!({"embedded": ids.iter().map(|l| l.0).collect::<Vec<_>>()}))
|
||||
}
|
||||
fn has_doc(s: &Session) -> std::result::Result<(), String> {
|
||||
s.active().map(|_| ()).ok_or_else(|| "no document open".into())
|
||||
}
|
||||
@@ -146,7 +188,6 @@ mod source;
|
||||
pub(crate) use contents::on_close;
|
||||
pub use contents::{commit_child, contents_of, replace_contents_bytes, replace_contents_from_bytes};
|
||||
use contents::{edit_contents, export_contents, is_smart_child, path_param, replace_contents, set_source, update_all};
|
||||
#[cfg(test)]
|
||||
use filters::smart_mut;
|
||||
pub(crate) use filters::{add_smart_filter, add_smart_filter_in, filter_mask_paintable, filter_mask_surface, refresh_after_filter_mask_edit};
|
||||
use filters::{blending_options, delete_filter, edit_filters, move_filter, set_filter_params, set_filter_visible, smart, transfer_filters};
|
||||
@@ -244,12 +285,20 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
has_smart,
|
||||
unpack::convert_to_layers
|
||||
),
|
||||
spec!("layer.smartObjects.convertToEmbedded", "Convert to Embedded", SO, r##"{"layer":id?}"##, has_linked, |s, p| {
|
||||
spec!("layer.smartObjects.convertToEmbedded", "Embed Linked", SO, r##"{"layer":id?}"##, has_linked, |s, p| {
|
||||
set_source(s, p, "Convert to Embedded", true, |meta, src| {
|
||||
let (file_name, bytes) = source_bytes(meta, src).ok_or_else(|| other("the linked file can't be read"))?;
|
||||
Ok(SmartSource::Embedded { file_name, bytes })
|
||||
})
|
||||
}),
|
||||
spec!(
|
||||
"layer.smartObjects.embedAllLinked",
|
||||
"Embed All Linked",
|
||||
SO,
|
||||
"{} (every linked smart object of the active document becomes embedded in one history step; a linked file that can't be read refuses the whole step and the error names it) -> {embedded: [layer ids]}",
|
||||
has_any_linked,
|
||||
embed_all_linked
|
||||
),
|
||||
spec!(
|
||||
"layer.smartObjects.convertToLinked",
|
||||
"Convert to Linked…",
|
||||
|
||||
@@ -17,6 +17,9 @@ fn has_layer(s: &Session) -> std::result::Result<(), String> {
|
||||
s.active().and_then(|d| d.active_layer).map(|_| ()).ok_or_else(|| "no active layer".into())
|
||||
}
|
||||
|
||||
/// The History step name of a shape-tool bounding box scale (`edit.transform` `stepName`).
|
||||
pub const TRANSFORM_PATH: &str = "Transform Path";
|
||||
|
||||
fn bad(msg: impl Into<String>) -> EngineError {
|
||||
EngineError::BadParams { cmd: "edit.transform".into(), msg: msg.into() }
|
||||
}
|
||||
@@ -841,6 +844,13 @@ fn with_panel_target(s: &Session, p: &Value) -> Value {
|
||||
}
|
||||
|
||||
fn transform(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
// The shape tools' bounding box scales live shapes with this command and names the step as
|
||||
// the reference does. Passed in, not renamed after: the edit may land later as a job.
|
||||
let step_name = match p.get("stepName") {
|
||||
None | Some(Value::Null) => "Free Transform",
|
||||
Some(Value::String(n)) if n == TRANSFORM_PATH => TRANSFORM_PATH,
|
||||
Some(_) => return Err(bad("`stepName` must be \"Transform Path\"")),
|
||||
};
|
||||
let p = &with_panel_target(s, p);
|
||||
let st = s.active().ok_or(EngineError::NoDocument)?;
|
||||
let many = layers_param(&st.doc, p)?;
|
||||
@@ -920,7 +930,7 @@ fn transform(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
// on a worker with progress, and can be cancelled.
|
||||
crate::jobs::edit_job(
|
||||
s,
|
||||
"Free Transform",
|
||||
step_name,
|
||||
move |doc, _, ctx| ctx.stage(0.0, 1.0, "Transforming", |ctl| transform_doc(doc, id, &ids, &p, lone, &h, affine, interp, ctl)),
|
||||
move |()| json!({"rect": rect, "layers": layers}),
|
||||
)
|
||||
@@ -1006,7 +1016,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
label: "Free Transform",
|
||||
menu: &[],
|
||||
shortcut: None,
|
||||
params: r##"{"layer":id?,"layers":[id,…]? (several layers moved by one box, one step; default with neither = the selected layers but the Background, as Photoshop's Free Transform with several selected),"rect":[x0,y0,x1,y1]? (source frame; default = the layers' content ∩ selection),"quad":[[x,y]×4]? (where the frame's corners go, clockwise from top-left),"matrix":[a,b,c,d,e,f]? (affine alternative),"scaleX":%?,"scaleY":%?,"rotate":deg?,"dx":px?,"dy":px?,"reference":"center|topLeft|top|topRight|left|right|bottomLeft|bottom|bottomRight"|[x,y]="center" (relative alternative: scale and rotate about this point, then move),"interpolation":"bicubic|bilinear|nearest|bicubicSharper|bicubicSmoother|bicubicAutomatic"="bicubic" (Photoshop's bicubic variants render as Bicubic),"target":"pixels"|"mask"|"quickMask"|{"channel":i}=Channels panel target (an unlinked mask, an alpha channel or the Quick Mask transforms alone; a linked mask moves with its layer)}"##,
|
||||
params: r##"{"layer":id?,"layers":[id,…]? (several layers moved by one box, one step; default with neither = the selected layers but the Background, as Photoshop's Free Transform with several selected),"rect":[x0,y0,x1,y1]? (source frame; default = the layers' content ∩ selection),"quad":[[x,y]×4]? (where the frame's corners go, clockwise from top-left),"matrix":[a,b,c,d,e,f]? (affine alternative),"scaleX":%?,"scaleY":%?,"rotate":deg?,"dx":px?,"dy":px?,"reference":"center|topLeft|top|topRight|left|right|bottomLeft|bottom|bottomRight"|[x,y]="center" (relative alternative: scale and rotate about this point, then move),"interpolation":"bicubic|bilinear|nearest|bicubicSharper|bicubicSmoother|bicubicAutomatic"="bicubic" (Photoshop's bicubic variants render as Bicubic),"stepName":"Transform Path"? (History step name; the shape tools' bounding box sends it; default "Free Transform"; any other value is refused),"target":"pixels"|"mask"|"quickMask"|{"channel":i}=Channels panel target (an unlinked mask, an alpha channel or the Quick Mask transforms alone; a linked mask moves with its layer)}"##,
|
||||
enabled: has_layer,
|
||||
journal: true,
|
||||
run: transform,
|
||||
|
||||
@@ -970,3 +970,24 @@ fn split_selected_lifts_up_to_the_selection_and_leaves_the_rest() {
|
||||
assert!((l + r - a).abs() < 1e-6, "k = {k}: lifted {l} + left {r} != {a}");
|
||||
}
|
||||
}
|
||||
|
||||
/// `stepName` names the step "Transform Path" (the shape tools' bounding box); without it the
|
||||
/// step stays "Free Transform"; any other name is refused and changes nothing.
|
||||
#[test]
|
||||
fn step_name_transform_path_is_the_only_name_taken() {
|
||||
let mut s = session();
|
||||
let p = json!({"scaleX": 50, "scaleY": 50});
|
||||
s.execute("edit.transform", p.clone()).unwrap();
|
||||
assert_eq!(s.active().unwrap().history.entries().last().map(String::as_str), Some("Free Transform"));
|
||||
let mut named = p.clone();
|
||||
named["stepName"] = json!("Transform Path");
|
||||
s.execute("edit.transform", named).unwrap();
|
||||
assert_eq!(s.active().unwrap().history.entries().last().map(String::as_str), Some("Transform Path"));
|
||||
let steps = s.active().unwrap().history.past_len();
|
||||
for bad_name in [json!("Free Transform"), json!("Move"), json!(""), json!(3), json!(["Transform Path"])] {
|
||||
let mut wrong = p.clone();
|
||||
wrong["stepName"] = bad_name.clone();
|
||||
assert!(s.execute("edit.transform", wrong).is_err(), "{bad_name}");
|
||||
}
|
||||
assert_eq!(s.active().unwrap().history.past_len(), steps, "a refused name changes nothing");
|
||||
}
|
||||
@@ -315,13 +315,13 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
"subtract",
|
||||
"Subtract Front Shape"
|
||||
)),
|
||||
spec!("layer.combineShapes.intersectShapeAreas", "Intersect Shape Areas", [], COMBINE_PARAMS, has_layer, |s, p| combine_shapes(
|
||||
spec!("layer.combineShapes.intersectShapeAreas", "Unite Shapes at Overlap", [], COMBINE_PARAMS, has_layer, |s, p| combine_shapes(
|
||||
s,
|
||||
p,
|
||||
"intersect",
|
||||
"Intersect Shape Areas"
|
||||
)),
|
||||
spec!("layer.combineShapes.excludeOverlappingShapes", "Exclude Overlapping Shapes", [], COMBINE_PARAMS, has_layer, |s, p| {
|
||||
spec!("layer.combineShapes.excludeOverlappingShapes", "Subtract Shapes at Overlap", [], COMBINE_PARAMS, has_layer, |s, p| {
|
||||
combine_shapes(s, p, "exclude", "Exclude Overlapping Shapes")
|
||||
}),
|
||||
spec!(
|
||||
|
||||
@@ -110,6 +110,15 @@ fn blank_of(fmt: photocraft_color::PixelFormat) -> Surface {
|
||||
Surface::new(fmt)
|
||||
}
|
||||
|
||||
/// Both the altered and original footage stacks must have room for an added frame.
|
||||
fn check_frame_growth(frames: usize, original_frames: Option<usize>) -> Result<()> {
|
||||
let limit = crate::timeline_cmds::MAX_DURATION;
|
||||
if frames.max(original_frames.unwrap_or(0)) >= limit {
|
||||
return Err(EngineError::Other(format!("a video layer is limited to {limit} frames")));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn new_blank(s: &mut Session, _p: &Value) -> Result<Value> {
|
||||
let id = s.edit("New Blank Video Layer", |doc, active| {
|
||||
store(doc);
|
||||
@@ -138,7 +147,8 @@ fn new_blank(s: &mut Session, _p: &Value) -> Result<Value> {
|
||||
fn insert_blank(s: &mut Session, _p: &Value) -> Result<Value> {
|
||||
let fmt = s.active().ok_or(EngineError::NoDocument)?.doc.pixel_format();
|
||||
edit_video(s, "Insert Blank Frame", move |v, cur| {
|
||||
let at = (cur + 1).min(v.frames.len());
|
||||
check_frame_growth(v.frames.len(), v.original_frames.as_ref().map(Vec::len))?;
|
||||
let at = cur.saturating_add(1).min(v.frames.len());
|
||||
v.frames.insert(at, blank_of(fmt));
|
||||
if let Some(original) = &mut v.original_frames {
|
||||
// The stacks stay aligned, but never index past a shorter one.
|
||||
@@ -150,7 +160,9 @@ fn insert_blank(s: &mut Session, _p: &Value) -> Result<Value> {
|
||||
|
||||
fn duplicate_frame(s: &mut Session, _p: &Value) -> Result<Value> {
|
||||
edit_video(s, "Duplicate Frame", |v, cur| {
|
||||
if let Some(f) = v.frames.get(cur).cloned() {
|
||||
if let Some(f) = v.frames.get(cur) {
|
||||
check_frame_growth(v.frames.len(), v.original_frames.as_ref().map(Vec::len))?;
|
||||
let f = f.clone();
|
||||
if let Some(original) = &mut v.original_frames {
|
||||
let orig = original.get(cur).cloned().unwrap_or_else(|| blank_of(f.format()));
|
||||
original.insert((cur + 1).min(original.len()), orig);
|
||||
|
||||
@@ -29,6 +29,17 @@ fn new_blank_insert_duplicate_delete_frames() {
|
||||
assert!(s.active().unwrap().doc.timeline.as_ref().unwrap().duration >= frames(&s, id));
|
||||
}
|
||||
|
||||
/// Check the shared growth limit without constructing a million-frame document.
|
||||
#[test]
|
||||
fn frame_growth_stops_at_the_limit_of_either_stack() {
|
||||
let limit = crate::timeline_cmds::MAX_DURATION;
|
||||
assert!(check_frame_growth(limit - 1, None).is_ok());
|
||||
assert!(check_frame_growth(limit - 1, Some(limit - 1)).is_ok());
|
||||
assert!(check_frame_growth(limit, None).is_err());
|
||||
assert!(check_frame_growth(limit - 1, Some(limit)).is_err());
|
||||
assert!(check_frame_growth(limit + 1, None).is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rasterize_drops_the_stack() {
|
||||
let mut s = session();
|
||||
|
||||
@@ -664,7 +664,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
CommandSpec {
|
||||
id: "layer.smartObjects.warp",
|
||||
label: "Warp",
|
||||
menu: &["Layer", "Smart Objects"],
|
||||
menu: &[],
|
||||
shortcut: None,
|
||||
params: P,
|
||||
enabled: active_smart,
|
||||
|
||||
+138
-46
@@ -3,9 +3,10 @@
|
||||
//! strips an extension adds) is filled from its surroundings instead of holding the background
|
||||
//! colour or transparency.
|
||||
//!
|
||||
//! Which layer: the Background when the document has one (the layer the crop filled with the
|
||||
//! background colour), otherwise the active pixel layer (where the crop left transparency). Other
|
||||
//! layers keep their transparency there, as after a plain crop. Each connected piece of the
|
||||
//! Which layers: the Background and the active pixel layer, each sampled independently. Unmeasured
|
||||
//! cases (Delete Cropped Pixels off, or a hidden, locked or nonpixel active layer) retain the
|
||||
//! Background-else-active target. Other layers keep their transparency, as after a plain crop.
|
||||
//! Each connected piece of the
|
||||
//! uncovered area (each corner, each edge strip) is filled on its own, with Photoshop's sampling
|
||||
//! window around that piece, and only pixels the image covers are sampled.
|
||||
//!
|
||||
@@ -27,6 +28,9 @@ const SEED: u64 = 1;
|
||||
/// The largest canvas (pixels) the uncovered area is worked out for: the Content-Aware window cap.
|
||||
const MAX_PIXELS: u64 = 400_000_000;
|
||||
|
||||
/// Limit for the dense native-float input read when reaching beyond the normal sampling window.
|
||||
const MAX_WIDENED_SAMPLE_BYTES: usize = 512 << 20;
|
||||
|
||||
/// Where the cropped canvas came from in the original document.
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct Coverage {
|
||||
@@ -38,10 +42,10 @@ pub(crate) struct Coverage {
|
||||
pub height: f64,
|
||||
/// Whether the map rotates (its resampled edge is antialiased against the background colour).
|
||||
pub rotated: bool,
|
||||
/// The filled layer's pixels before a turned crop (original document px), set by
|
||||
/// Each candidate target's pixels before a turned crop (original document px), set by
|
||||
/// [`Coverage::holding`]: where they lie past the old canvas they are hidden image, not
|
||||
/// uncovered area. A straight crop has none: Photoshop fills over hidden pixels there.
|
||||
pub held: Option<Surface>,
|
||||
pub held: Option<Vec<(LayerId, Surface)>>,
|
||||
}
|
||||
|
||||
impl Coverage {
|
||||
@@ -53,7 +57,14 @@ impl Coverage {
|
||||
/// Takes the pixels of the layer the fill will go to from `doc` before a turned crop (the
|
||||
/// surface is shared, not copied), so hidden pixels past the old canvas count as covered.
|
||||
pub fn holding(mut self, doc: &Document, active: Option<LayerId>) -> Self {
|
||||
self.held = target_layer(doc, active).ok().and_then(|id| doc.layer(id)).and_then(|l| l.surface()).cloned();
|
||||
self.held = Some(
|
||||
target_layer(doc, active)
|
||||
.ok()
|
||||
.into_iter()
|
||||
.chain(additional_target(doc, active))
|
||||
.filter_map(|id| doc.layer(id).and_then(|l| l.surface()).map(|surface| (id, surface.clone())))
|
||||
.collect(),
|
||||
);
|
||||
self
|
||||
}
|
||||
|
||||
@@ -61,19 +72,19 @@ impl Coverage {
|
||||
/// the original canvas by at least half the pixel's projected size (exact for an unrotated
|
||||
/// crop); a rotated crop also refills the one-pixel antialiased edge, which the resampling
|
||||
/// blended with the background colour.
|
||||
fn covered(&self, u: i32, v: i32, margin: f64) -> bool {
|
||||
fn covered(&self, u: i32, v: i32, margin: f64, held: Option<&Surface>) -> bool {
|
||||
let [a, b, c, d, e, f] = self.map;
|
||||
let (cu, cv) = (f64::from(u) + 0.5, f64::from(v) + 0.5);
|
||||
let (x, y) = (a * cu + b * cv + e, c * cu + d * cv + f);
|
||||
(x >= margin && y >= margin && x <= self.width - margin && y <= self.height - margin) || self.holds(x, y)
|
||||
(x >= margin && y >= margin && x <= self.width - margin && y <= self.height - margin) || Self::holds(held, x, y)
|
||||
}
|
||||
|
||||
/// Whether the layer held an image pixel at original document point (x, y) past the canvas
|
||||
/// (#8060): mostly opaque there and one pixel around it too (the turned edge is blended with
|
||||
/// the background colour, as at the canvas edge). Without an alpha channel
|
||||
/// hidden pixels can't be told from empty ones: nothing is held.
|
||||
fn holds(&self, x: f64, y: f64) -> bool {
|
||||
let Some(surf) = &self.held else { return false };
|
||||
fn holds(held: Option<&Surface>, x: f64, y: f64) -> bool {
|
||||
let Some(surf) = held else { return false };
|
||||
let format = surf.format();
|
||||
if !(format.alpha && x.is_finite() && y.is_finite()) {
|
||||
return false;
|
||||
@@ -100,8 +111,20 @@ const UNLABELLED: u32 = u32::MAX;
|
||||
|
||||
/// Fills the area of the cropped `doc` that `cov` says the original image doesn't cover (see the
|
||||
/// module docs). Nothing uncovered: nothing changes. Errors leave `doc` to be rolled back by the
|
||||
/// caller's history step.
|
||||
pub(crate) fn fill_uncovered(doc: &mut Document, active: Option<LayerId>, cov: &Coverage) -> Result<()> {
|
||||
/// caller's history step. Returns whether any uncovered pixels were filled, for the history name.
|
||||
pub(crate) fn fill_uncovered(doc: &mut Document, active: Option<LayerId>, cov: &Coverage, delete: bool) -> Result<bool> {
|
||||
let first = target_layer(doc, active);
|
||||
let additional = if delete { additional_target(doc, active) } else { None };
|
||||
let mut filled = fill_layer(doc, first, cov, false)?;
|
||||
if let Some(id) = additional {
|
||||
filled |= fill_layer(doc, Ok(id), cov, true)?;
|
||||
}
|
||||
Ok(filled)
|
||||
}
|
||||
|
||||
/// One target at a time keeps the label/window allocations bounded to one canvas. The caller's
|
||||
/// existing edit/compound transaction rolls every target back if a later fill fails.
|
||||
fn fill_layer(doc: &mut Document, id: Result<LayerId>, cov: &Coverage, own_pixels: bool) -> Result<bool> {
|
||||
let canvas = doc.bounds();
|
||||
let (w, h) = (canvas.width(), canvas.height());
|
||||
if u64::from(w) * u64::from(h) > MAX_PIXELS {
|
||||
@@ -110,62 +133,131 @@ pub(crate) fn fill_uncovered(doc: &mut Document, active: Option<LayerId>, cov: &
|
||||
let (w, h) = (w as usize, h as usize);
|
||||
let len = w.checked_mul(h).ok_or_else(|| EngineError::Other("the crop is too large for Content-Aware fill".into()))?;
|
||||
if len == 0 {
|
||||
return Ok(());
|
||||
return Ok(false);
|
||||
}
|
||||
let margin = cov.margin();
|
||||
let held = id.as_ref().ok().and_then(|id| cov.held.as_ref()?.iter().find(|(held_id, _)| held_id == id).map(|(_, surface)| surface));
|
||||
let mut labels = crate::allocation::filled(len, 0u32, "Content-Aware crop fill")?;
|
||||
labels.par_chunks_mut(w).enumerate().for_each(|(y, row)| {
|
||||
for (x, l) in row.iter_mut().enumerate() {
|
||||
if !cov.covered(x as i32, y as i32, margin) {
|
||||
if !cov.covered(x as i32, y as i32, margin, held) {
|
||||
*l = UNLABELLED;
|
||||
}
|
||||
}
|
||||
});
|
||||
if !labels.contains(&UNLABELLED) {
|
||||
return Ok(());
|
||||
return Ok(false);
|
||||
}
|
||||
if !labels.contains(&0) {
|
||||
return Err(EngineError::Other("Content-Aware fill needs some of the image inside the crop to sample from".into()));
|
||||
return if own_pixels {
|
||||
Ok(false)
|
||||
} else {
|
||||
Err(EngineError::Other("Content-Aware fill needs some of the image inside the crop to sample from".into()))
|
||||
};
|
||||
}
|
||||
let id = target_layer(doc, active)?;
|
||||
let pieces = label_components(&mut labels, w, h)?;
|
||||
// Resolve an absent target only after the no-fill/sample checks, preserving the legacy path.
|
||||
let id = id?;
|
||||
let surf = doc.layer(id).and_then(|l| l.surface()).ok_or_else(|| EngineError::Other("Content-Aware fill needs a pixel layer".into()))?;
|
||||
let n = surf.format().channels().max(1);
|
||||
let has_alpha = surf.format().alpha;
|
||||
let has_pixel = |x, y| !has_alpha || surf.sample_channel(x, y, n - 1) > 0.0;
|
||||
let donor_bounds = own_pixels.then(|| if has_alpha { surf.content_bounds().intersect(&canvas) } else { canvas });
|
||||
// The added target is optional when it has no covered pixels of its own to sample.
|
||||
// This check does not absorb errors from synthesis or allocation.
|
||||
if donor_bounds.is_some_and(|bounds| {
|
||||
!contains_donor(bounds, |x, y| {
|
||||
let at = usize::try_from(y).ok().and_then(|y| y.checked_mul(w)).zip(usize::try_from(x).ok()).and_then(|(r, x)| r.checked_add(x));
|
||||
at.and_then(|i| labels.get(i)) == Some(&0) && has_pixel(x, y)
|
||||
})
|
||||
}) {
|
||||
return Ok(false);
|
||||
}
|
||||
let pieces = label_components(&mut labels, w, h)?;
|
||||
let label = |x: i32, y: i32| -> u32 {
|
||||
if x < 0 || y < 0 {
|
||||
return 0;
|
||||
}
|
||||
(y as usize).checked_mul(w).and_then(|i| i.checked_add(x as usize)).and_then(|i| labels.get(i)).copied().unwrap_or(0)
|
||||
};
|
||||
let n = surf.format().channels().max(1);
|
||||
let filled: Vec<(Rect, Vec<f32>)> = pieces
|
||||
.par_iter()
|
||||
.enumerate()
|
||||
.map(|(k, bounds)| -> Result<(Rect, Vec<f32>)> {
|
||||
let k = k as u32 + 1;
|
||||
let (window, px) = crate::fill_cmds::content_aware_native(surf, *bounds, canvas, true, SEED, |x, y| label(x, y) == k, |x, y| label(x, y) == 0)?;
|
||||
// The piece's bounds, its pixels from the fill and the rest as they were.
|
||||
let mut out = surf.read_region(*bounds);
|
||||
let ww = window.width() as usize;
|
||||
for y in bounds.y0..bounds.y1 {
|
||||
for x in bounds.x0..bounds.x1 {
|
||||
if label(x, y) != k || !window.contains(x, y) {
|
||||
continue;
|
||||
}
|
||||
let src = ((y - window.y0) as usize * ww + (x - window.x0) as usize) * n;
|
||||
let dst = ((y - bounds.y0) as usize * bounds.width() as usize + (x - bounds.x0) as usize) * n;
|
||||
if let (Some(s), Some(d)) = (px.get(src..src + n), out.get_mut(dst..dst + n)) {
|
||||
d.copy_from_slice(s);
|
||||
}
|
||||
let fill_piece = |(k, bounds): (usize, &Rect)| -> Result<(Rect, Vec<f32>)> {
|
||||
let k = k as u32 + 1;
|
||||
// A partial active layer can have no donor near a distant turned corner. Only that
|
||||
// added target may widen its sampling envelope; its hole and output stay unchanged.
|
||||
let usable = |x, y| label(x, y) == 0 && (!own_pixels || has_pixel(x, y));
|
||||
let sampling_bounds = if let Some(donor_bounds) = donor_bounds {
|
||||
let window = crate::fill_cmds::sampling_window(*bounds, canvas).intersect(&donor_bounds);
|
||||
if contains_donor(window, usable) { *bounds } else { widened_sampling_bounds(*bounds, donor_bounds, canvas, n)? }
|
||||
} else {
|
||||
*bounds
|
||||
};
|
||||
let (window, px) = crate::fill_cmds::content_aware_native(
|
||||
surf,
|
||||
sampling_bounds,
|
||||
canvas,
|
||||
true,
|
||||
SEED,
|
||||
|x, y| label(x, y) == k,
|
||||
// A partial active layer (EdgeHalf in #10868) must extend its own image, not
|
||||
// sample its empty canvas rows into the new strip. Keep legacy sampling intact.
|
||||
usable,
|
||||
)?;
|
||||
// The piece's bounds, its pixels from the fill and the rest as they were.
|
||||
let mut out = crate::allocation::read_region(surf, *bounds, "Content-Aware crop output")?;
|
||||
let ww = window.width() as usize;
|
||||
for y in bounds.y0..bounds.y1 {
|
||||
for x in bounds.x0..bounds.x1 {
|
||||
if label(x, y) != k || !window.contains(x, y) {
|
||||
continue;
|
||||
}
|
||||
let src = ((y - window.y0) as usize * ww + (x - window.x0) as usize) * n;
|
||||
let dst = ((y - bounds.y0) as usize * bounds.width() as usize + (x - bounds.x0) as usize) * n;
|
||||
if let (Some(s), Some(d)) = (px.get(src..src + n), out.get_mut(dst..dst + n)) {
|
||||
d.copy_from_slice(s);
|
||||
}
|
||||
}
|
||||
Ok((*bounds, out))
|
||||
})
|
||||
.collect::<Result<_>>()?;
|
||||
}
|
||||
Ok((*bounds, out))
|
||||
};
|
||||
let filled: Vec<(Rect, Vec<f32>)> = if own_pixels {
|
||||
// A fallback window can span the canvas: keep only one added-target window live.
|
||||
pieces.iter().enumerate().map(fill_piece).collect::<Result<_>>()?
|
||||
} else {
|
||||
pieces.par_iter().enumerate().map(fill_piece).collect::<Result<_>>()?
|
||||
};
|
||||
let surf = doc.layer_mut(id).and_then(|l| l.surface_mut()).ok_or_else(|| EngineError::Other("Content-Aware fill needs a pixel layer".into()))?;
|
||||
for (r, px) in filled {
|
||||
surf.write_region(r, &px);
|
||||
}
|
||||
Ok(())
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
/// Checks the candidate rectangle for a covered pixel that passes the target's donor policy.
|
||||
fn contains_donor(bounds: Rect, usable: impl Fn(i32, i32) -> bool) -> bool {
|
||||
(bounds.y0..bounds.y1).any(|y| (bounds.x0..bounds.x1).any(|x| usable(x, y)))
|
||||
}
|
||||
|
||||
/// Widens the sampling envelope to include distant donors, after pricing the actual float read.
|
||||
fn widened_sampling_bounds(piece: Rect, donors: Rect, canvas: Rect, channels: usize) -> Result<Rect> {
|
||||
let expanded = piece.union(&donors);
|
||||
let window = crate::fill_cmds::sampling_window(expanded, canvas);
|
||||
let bytes = (window.width() as usize)
|
||||
.checked_mul(window.height() as usize)
|
||||
.and_then(|pixels| pixels.checked_mul(channels))
|
||||
.and_then(|samples| samples.checked_mul(std::mem::size_of::<f32>()));
|
||||
if bytes.is_none_or(|bytes| bytes > MAX_WIDENED_SAMPLE_BYTES) {
|
||||
return Err(EngineError::Other("the expanded Content-Aware crop sampling window is too large".into()));
|
||||
}
|
||||
Ok(expanded)
|
||||
}
|
||||
|
||||
/// Only the measured, editable active-raster case adds a target to the Background. Ancestor
|
||||
/// visibility and locks count too; all unmeasured cases keep the original target selection.
|
||||
fn additional_target(doc: &Document, active: Option<LayerId>) -> Option<LayerId> {
|
||||
let background = doc.background()?.id;
|
||||
let id = active.filter(|id| *id != background)?;
|
||||
let path = doc.path_of(id)?;
|
||||
let layer = doc.layer_at(&path)?;
|
||||
(matches!(layer.content, photocraft_doc::LayerContent::Raster(_)) && doc.shown_at(&path) && !doc.locks_at(&path).any()).then_some(id)
|
||||
}
|
||||
|
||||
/// The Background, else the active pixel layer.
|
||||
@@ -242,9 +334,9 @@ mod tests {
|
||||
fn unrotated_coverage_is_exact() {
|
||||
let c = Coverage::crop(Rect::new(-2, 0, 8, 4), 5, 4);
|
||||
let m = c.margin();
|
||||
assert!(!c.covered(1, 0, m), "x = -1");
|
||||
assert!(c.covered(2, 0, m), "x = 0");
|
||||
assert!(c.covered(6, 0, m), "x = 4");
|
||||
assert!(!c.covered(7, 0, m), "x = 5");
|
||||
assert!(!c.covered(1, 0, m, None), "x = -1");
|
||||
assert!(c.covered(2, 0, m, None), "x = 0");
|
||||
assert!(c.covered(6, 0, m, None), "x = 4");
|
||||
assert!(!c.covered(7, 0, m, None), "x = 5");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
//! Layer > Smart Objects > Embed Linked and Embed All Linked (#11401).
|
||||
|
||||
use photocraft_doc::{LayerContent, SmartSource};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::Session;
|
||||
use crate::cmd::command_specs;
|
||||
|
||||
fn label(id: &str) -> &'static str {
|
||||
command_specs().iter().find(|c| c.id == id).map(|c| c.label).unwrap_or_else(|| panic!("{id} is not registered"))
|
||||
}
|
||||
|
||||
/// Adds a layer with a few painted pixels (an empty layer can't become a smart object).
|
||||
fn painted_layer(s: &mut Session, red: f32) {
|
||||
s.execute("layer.new.layer", json!({})).unwrap();
|
||||
s.edit("setup", |doc, active| {
|
||||
let surf = doc.layer_mut(active.unwrap()).unwrap().surface_mut().unwrap();
|
||||
surf.fill_rect(photocraft_geom::Rect::new(2, 2, 10, 10), &[red, 1.0 - red, 0.0, 1.0]);
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
/// Three smart objects: the first two linked to files in `dir`, the third embedded.
|
||||
fn three(dir: &std::path::Path) -> (Session, [u64; 3]) {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", json!({"width": 32, "height": 24})).unwrap();
|
||||
let mut ids = [0u64; 3];
|
||||
for (i, slot) in ids.iter_mut().enumerate() {
|
||||
painted_layer(&mut s, 0.25 * (i + 1) as f32);
|
||||
*slot = s.execute("layer.smartObjects.convertToSmartObject", json!({})).unwrap()["layer"].as_u64().unwrap();
|
||||
if i < 2 {
|
||||
let path = dir.join(format!("linked{i}.pcraft"));
|
||||
s.execute("layer.smartObjects.convertToLinked", json!({"path": path.to_str().unwrap()})).unwrap();
|
||||
}
|
||||
}
|
||||
(s, ids)
|
||||
}
|
||||
|
||||
fn is_linked(s: &Session, id: u64) -> bool {
|
||||
let doc = &s.active().unwrap().doc;
|
||||
let layer = doc.walk().into_iter().map(|(_, _, l)| l).find(|l| l.id.0 == id).unwrap();
|
||||
match &layer.content {
|
||||
LayerContent::Smart(sm) => matches!(sm.source, SmartSource::Linked { .. }),
|
||||
other => panic!("not smart: {}", other.kind_name()),
|
||||
}
|
||||
}
|
||||
|
||||
/// The file name and bytes an embedded smart object carries.
|
||||
fn embedded(s: &Session, id: u64) -> (String, Vec<u8>) {
|
||||
let doc = &s.active().unwrap().doc;
|
||||
let layer = doc.walk().into_iter().map(|(_, _, l)| l).find(|l| l.id.0 == id).unwrap();
|
||||
match &layer.content {
|
||||
LayerContent::Smart(sm) => match &sm.source {
|
||||
SmartSource::Embedded { file_name, bytes } => (file_name.clone(), bytes.to_vec()),
|
||||
SmartSource::Linked { .. } => panic!("still linked"),
|
||||
},
|
||||
other => panic!("not smart: {}", other.kind_name()),
|
||||
}
|
||||
}
|
||||
|
||||
fn temp_dir(name: &str) -> std::path::PathBuf {
|
||||
let dir = std::env::temp_dir().join(format!("pc-embed-all-{name}-{}", std::process::id()));
|
||||
std::fs::remove_dir_all(&dir).ok();
|
||||
std::fs::create_dir_all(&dir).unwrap();
|
||||
dir
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn embed_linked_and_embed_all_linked_are_named_in_the_engine() {
|
||||
assert_eq!(label("layer.smartObjects.convertToEmbedded"), "Embed Linked");
|
||||
assert_eq!(label("layer.smartObjects.embedAllLinked"), "Embed All Linked");
|
||||
// The warp commands stay registered for scripts and the Edit menu routes.
|
||||
for id in ["layer.smartObjects.warp", "layer.smartObjects.perspectiveWarp", "layer.smartObjects.puppetWarp"] {
|
||||
label(id);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn embed_all_linked_embeds_both_linked_objects_in_one_undoable_step() {
|
||||
let dir = temp_dir("both");
|
||||
let (mut s, ids) = three(&dir);
|
||||
assert!(is_linked(&s, ids[0]) && is_linked(&s, ids[1]) && !is_linked(&s, ids[2]));
|
||||
assert!(s.is_enabled("layer.smartObjects.embedAllLinked"));
|
||||
let before = s.active().unwrap().history.entries().len();
|
||||
let files: Vec<Vec<u8>> = (0..2).map(|i| photocraft_format::read_file(&dir.join(format!("linked{i}.pcraft"))).unwrap()).collect();
|
||||
assert_ne!(files[0], files[1], "the fixtures differ");
|
||||
let third = embedded(&s, ids[2]);
|
||||
|
||||
let r = s.execute("layer.smartObjects.embedAllLinked", json!({})).unwrap();
|
||||
assert_eq!(r["embedded"], json!([ids[0], ids[1]]));
|
||||
assert!(ids.iter().all(|&id| !is_linked(&s, id)));
|
||||
for (i, file) in files.iter().enumerate() {
|
||||
let (name, bytes) = embedded(&s, ids[i]);
|
||||
assert_eq!(name, format!("linked{i}.pcraft"), "object {i} keeps its own file name");
|
||||
assert_eq!(&bytes, file, "object {i} carries its own linked file's bytes");
|
||||
}
|
||||
assert_eq!(embedded(&s, ids[2]), third, "the already embedded object is untouched");
|
||||
let entries = s.active().unwrap().history.entries();
|
||||
assert_eq!(entries.len(), before + 1, "one history step");
|
||||
assert_eq!(entries.last().map(String::as_str), Some("Embed All Linked"));
|
||||
assert!(!s.is_enabled("layer.smartObjects.embedAllLinked"), "nothing left to embed");
|
||||
|
||||
s.execute("edit.undo", json!({})).unwrap();
|
||||
assert!(is_linked(&s, ids[0]) && is_linked(&s, ids[1]) && !is_linked(&s, ids[2]));
|
||||
assert_eq!(s.active().unwrap().history.entries().len(), before);
|
||||
std::fs::remove_dir_all(&dir).ok();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn embed_all_linked_with_no_linked_object_is_an_error_not_a_panic() {
|
||||
let mut s = Session::new();
|
||||
assert!(!s.is_enabled("layer.smartObjects.embedAllLinked"), "no document");
|
||||
assert!(s.execute("layer.smartObjects.embedAllLinked", json!({})).is_err());
|
||||
s.execute("file.new", json!({"width": 16, "height": 16})).unwrap();
|
||||
painted_layer(&mut s, 1.0);
|
||||
s.execute("layer.smartObjects.convertToSmartObject", json!({})).unwrap();
|
||||
assert!(!s.is_enabled("layer.smartObjects.embedAllLinked"), "only embedded objects");
|
||||
let before = s.active().unwrap().history.entries().len();
|
||||
assert!(s.execute("layer.smartObjects.embedAllLinked", json!({})).is_err());
|
||||
assert_eq!(s.active().unwrap().history.entries().len(), before);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn embed_all_linked_refuses_the_whole_step_when_a_linked_file_is_missing() {
|
||||
let dir = temp_dir("missing");
|
||||
let (mut s, ids) = three(&dir);
|
||||
std::fs::remove_file(dir.join("linked1.pcraft")).unwrap();
|
||||
let before = s.active().unwrap().history.entries().len();
|
||||
let err = s.execute("layer.smartObjects.embedAllLinked", json!({})).unwrap_err().to_string();
|
||||
assert!(err.contains("linked1.pcraft"), "the error names the missing file: {err}");
|
||||
assert!(is_linked(&s, ids[0]) && is_linked(&s, ids[1]), "nothing was embedded");
|
||||
assert_eq!(s.active().unwrap().history.entries().len(), before);
|
||||
std::fs::remove_dir_all(&dir).ok();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn embed_linked_still_embeds_one_object_under_its_old_id() {
|
||||
let dir = temp_dir("one");
|
||||
let (mut s, ids) = three(&dir);
|
||||
s.execute("layer.smartObjects.convertToEmbedded", json!({"layer": ids[0]})).unwrap();
|
||||
assert!(!is_linked(&s, ids[0]) && is_linked(&s, ids[1]));
|
||||
std::fs::remove_dir_all(&dir).ok();
|
||||
}
|
||||
@@ -332,11 +332,15 @@ pub struct Session {
|
||||
pub damage_misses: usize,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod embed_all_linked_tests;
|
||||
#[cfg(test)]
|
||||
mod fill_layer_mode_tests;
|
||||
#[cfg(test)]
|
||||
mod pattern_mode_tests;
|
||||
#[cfg(test)]
|
||||
mod second_keys_zoom_actions_tests;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -177,7 +177,7 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
section!("edit.preferences.transparencyAndGamut", "Transparency & Gamut…"),
|
||||
section!("edit.preferences.unitsAndRulers", "Units & Rulers…"),
|
||||
section!("edit.preferences.guidesGridAndSlices", "Guides, Grid & Slices…"),
|
||||
section!("edit.preferences.plugIns", "Plug-ins…"),
|
||||
section!("edit.preferences.plugIns", "Plugins…"),
|
||||
section!("edit.preferences.type", "Type…"),
|
||||
section!("edit.preferences.enhancedControls", "Enhanced Controls…"),
|
||||
section!("edit.preferences.rawDefaults", "Camera Raw…"),
|
||||
|
||||
@@ -124,6 +124,8 @@ pub const TEMPORARY_TOOLS: &[(&str, &str, &str)] = &[
|
||||
/// legacy function keys F2 Cut, F3 Copy, F4 Paste and Shift+F7 Inverse; Shift+Backspace
|
||||
/// (Shift+Delete on a Mac) for Fill; ⌘+ beside ⌘= for Zoom In; and off the Mac, Ctrl+F4 beside
|
||||
/// Ctrl+W for Close (Windows' close-document key; macOS keeps Ctrl+F4 for window focus).
|
||||
/// Also Alt+Ctrl+0 beside Ctrl+1 for 100% and F9 beside Alt+F9 for Window > Actions (#11396;
|
||||
/// measured on Windows, so the Mac gets the usual Cmd mapping of the first).
|
||||
pub const ALTERNATE_SHORTCUTS: &[(&str, &str)] = &[
|
||||
("edit.cut", "F2"),
|
||||
("edit.copy", "F3"),
|
||||
@@ -131,6 +133,8 @@ pub const ALTERNATE_SHORTCUTS: &[(&str, &str)] = &[
|
||||
("edit.fill", "Shift+Backspace"),
|
||||
("select.inverse", "Shift+F7"),
|
||||
("view.zoomIn", "Cmd++"),
|
||||
("view.actualPixels", "Cmd+Alt+0"),
|
||||
("window.panel.actions", "F9"),
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
("file.close", "Cmd+F4"),
|
||||
];
|
||||
|
||||
@@ -21,7 +21,7 @@ pub const SECTIONS: [(&str, &str); 18] = [
|
||||
("transparencyAndGamut", "Transparency & Gamut"),
|
||||
("unitsAndRulers", "Units & Rulers"),
|
||||
("guidesGridAndSlices", "Guides, Grid & Slices"),
|
||||
("plugIns", "Plug-ins"),
|
||||
("plugIns", "Plugins"),
|
||||
("type", "Type"),
|
||||
("enhancedControls", "Enhanced Controls"),
|
||||
("rawDefaults", "Camera Raw Defaults"),
|
||||
|
||||
@@ -305,8 +305,8 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
kind_spec!("view.proofSetup.workingMagentaPlate", "Working Magenta Plate"),
|
||||
kind_spec!("view.proofSetup.workingYellowPlate", "Working Yellow Plate"),
|
||||
kind_spec!("view.proofSetup.workingBlackPlate", "Working Black Plate"),
|
||||
kind_spec!("view.proofSetup.workingCmyPlate", "Working CMY Plate"),
|
||||
kind_spec!("view.proofSetup.legacyMacintoshRgb", "Legacy Macintosh RGB"),
|
||||
kind_spec!("view.proofSetup.workingCmyPlate", "Working CMY Plates"),
|
||||
kind_spec!("view.proofSetup.legacyMacintoshRgb", "Legacy Macintosh RGB (Gamma 1.8)"),
|
||||
kind_spec!("view.proofSetup.colorBlindnessProtanopia", "Color Blindness — Protanopia-type"),
|
||||
kind_spec!("view.proofSetup.colorBlindnessDeuteranopia", "Color Blindness — Deuteranopia-type"),
|
||||
CommandSpec {
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
//! The reference application's second default keys for View > 100% and Window > Actions (#11396):
|
||||
//! Alt+Ctrl+0 beside Ctrl+1, and F9 beside Alt+F9.
|
||||
//!
|
||||
//! The engine owns the key tables and the Keyboard Shortcuts command. The zoom itself and the
|
||||
//! Actions panel are UI state (`window.panel.actions` is a menu item the engine does not run), so
|
||||
//! these tests check that each key resolves to its command exactly as the main key does and
|
||||
//! that the user can remove it. They do not exercise key dispatch; `alternate_keys_run_their_command`
|
||||
//! in the UI crate's `shortcut_dispatch` tests does, and lists both keys.
|
||||
|
||||
use crate::Session;
|
||||
use crate::prefs::{ALTERNATE_SHORTCUTS, default_alternates, normalize_shortcut};
|
||||
use serde_json::json;
|
||||
|
||||
/// The menus' main keys (`menu_catalog.rs`): what View > 100% and Window > Actions show.
|
||||
const ACTUAL_PIXELS_MAIN: &str = "Cmd+1";
|
||||
const ACTIONS_MAIN: &str = "Alt+F9";
|
||||
|
||||
/// Our notation: `Cmd` is Ctrl off the Mac, so this is Ctrl+Alt+0 on Windows and Linux.
|
||||
const ACTUAL_PIXELS_ALT: &str = "Cmd+Alt+0";
|
||||
|
||||
fn session() -> Session {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", json!({"width": 32, "height": 32})).unwrap();
|
||||
s
|
||||
}
|
||||
|
||||
/// The command a key press runs among the engine's bindable commands and the two this issue
|
||||
/// adds keys to: a command's main key (given for the UI-only one), else its alternates in effect.
|
||||
fn resolve(s: &Session, key: &str) -> Vec<&'static str> {
|
||||
let want = normalize_shortcut(key).unwrap();
|
||||
let mains = [("view.actualPixels", Some(ACTUAL_PIXELS_MAIN)), ("window.panel.actions", Some(ACTIONS_MAIN))];
|
||||
let mut ids: Vec<&'static str> = Vec::new();
|
||||
for (id, main) in mains {
|
||||
let main_in_effect = s.prefs().shortcut(id, main);
|
||||
let is_main = main_in_effect.and_then(normalize_shortcut).as_ref() == Some(&want);
|
||||
if is_main || s.prefs().alternates(id, main_in_effect).contains(&want) {
|
||||
ids.push(id);
|
||||
}
|
||||
}
|
||||
ids
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn both_keys_are_default_alternates() {
|
||||
assert!(ALTERNATE_SHORTCUTS.contains(&("view.actualPixels", "Cmd+Alt+0")));
|
||||
assert!(ALTERNATE_SHORTCUTS.contains(&("window.panel.actions", "F9")));
|
||||
assert_eq!(default_alternates("view.actualPixels").collect::<Vec<_>>(), ["Cmd+Alt+0"]);
|
||||
assert_eq!(default_alternates("window.panel.actions").collect::<Vec<_>>(), ["F9"]);
|
||||
let s = session();
|
||||
let zoom = s.prefs().alternates("view.actualPixels", Some(ACTUAL_PIXELS_MAIN));
|
||||
assert_eq!(zoom, [normalize_shortcut(ACTUAL_PIXELS_ALT).unwrap()]);
|
||||
assert_eq!(s.prefs().alternates("window.panel.actions", Some(ACTIONS_MAIN)), ["F9"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_key_resolves_to_its_command_like_the_main_key() {
|
||||
let s = session();
|
||||
assert_eq!(resolve(&s, ACTUAL_PIXELS_ALT), ["view.actualPixels"]);
|
||||
assert_eq!(resolve(&s, ACTUAL_PIXELS_MAIN), ["view.actualPixels"]);
|
||||
assert_eq!(resolve(&s, "F9"), ["window.panel.actions"]);
|
||||
assert_eq!(resolve(&s, ACTIONS_MAIN), ["window.panel.actions"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_menu_shows_only_the_main_key() {
|
||||
// The menus print the catalogue's key, and an alternate is never the main key in effect.
|
||||
let s = session();
|
||||
assert_eq!(s.prefs().shortcut("view.actualPixels", Some(ACTUAL_PIXELS_MAIN)), Some(ACTUAL_PIXELS_MAIN));
|
||||
assert_eq!(s.prefs().shortcut("window.panel.actions", Some(ACTIONS_MAIN)), Some(ACTIONS_MAIN));
|
||||
assert_eq!(crate::shell_commands::SHELL_COMMANDS.iter().find(|c| c.0 == "view.actualPixels").and_then(|c| c.3), Some(ACTUAL_PIXELS_MAIN));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keyboard_shortcuts_lists_the_second_key_and_removing_it_stops_it() {
|
||||
let mut s = session();
|
||||
let r = s.execute("edit.keyboardShortcuts", json!({"filter": "view.actualPixels"})).unwrap();
|
||||
let row = r["commands"].as_array().unwrap().iter().find(|c| c["id"] == "view.actualPixels").unwrap().clone();
|
||||
assert_eq!(row["shortcut"], ACTUAL_PIXELS_MAIN);
|
||||
assert_eq!(row["alternates"], json!([normalize_shortcut(ACTUAL_PIXELS_ALT).unwrap()]));
|
||||
assert_eq!(row["defaultAlternates"], json!(["Cmd+Alt+0"]));
|
||||
|
||||
s.execute("edit.keyboardShortcuts", json!({"alternates": {"view.actualPixels": []}})).unwrap();
|
||||
assert!(resolve(&s, ACTUAL_PIXELS_ALT).is_empty());
|
||||
assert_eq!(resolve(&s, ACTUAL_PIXELS_MAIN), ["view.actualPixels"], "the main key still works");
|
||||
|
||||
// Window > Actions is a menu item, so it is not in the engine's list, but its second key can
|
||||
// still be set and removed, as the Keyboard Shortcuts dialog does.
|
||||
s.execute("edit.keyboardShortcuts", json!({"alternates": {"window.panel.actions": []}})).unwrap();
|
||||
assert!(resolve(&s, "F9").is_empty());
|
||||
assert_eq!(resolve(&s, ACTIONS_MAIN), ["window.panel.actions"]);
|
||||
|
||||
s.execute("edit.keyboardShortcuts", json!({"reset": true})).unwrap();
|
||||
assert_eq!(resolve(&s, "F9"), ["window.panel.actions"]);
|
||||
assert_eq!(resolve(&s, ACTUAL_PIXELS_ALT), ["view.actualPixels"]);
|
||||
}
|
||||
@@ -42,7 +42,9 @@ pub const SHELL_COMMANDS: &[(&str, &str, &[&str], Option<&str>)] = &[
|
||||
("view.show.grid", "Grid", &["View", "Show"], Some("Cmd+'")),
|
||||
("view.show.guides", "Guides", &["View", "Show"], Some("Cmd+;")),
|
||||
("view.snap", "Snap", &["View"], Some("Cmd+Shift+;")),
|
||||
("view.lockGuides", "Lock Guides", &["View"], Some("Cmd+Alt+;")),
|
||||
("view.lockGuides", "Lock Guides", &["View", "Guides"], Some("Cmd+Alt+;")),
|
||||
("view.editSelectedGuides", "Edit Selected Guides", &["View", "Guides"], None),
|
||||
("view.clearSelectedGuides", "Clear Selected Guides", &["View", "Guides"], None),
|
||||
("view.extras", "Extras", &["View"], Some("Cmd+H")),
|
||||
("view.show.targetPath", "Target Path", &["View", "Show"], Some("Cmd+Shift+H")),
|
||||
("view.screenMode.cycle", "Cycle Screen Mode", &[], Some("F")),
|
||||
@@ -57,7 +59,7 @@ pub const SHELL_COMMANDS: &[(&str, &str, &[&str], Option<&str>)] = &[
|
||||
("view.actualPixels", "100%", &["View"], Some("Cmd+1")),
|
||||
("view.rotateView", "Rotate View", &[], None),
|
||||
("view.resetView", "Reset View", &["View"], None),
|
||||
("window.newWindowForDocument", "New Window for Document", &["Window", "Arrange"], None),
|
||||
("window.newWindowForDocument", "New Window", &["Window", "Arrange"], None),
|
||||
("window.toggle.layers", "Layers", &["Window"], Some("F7")),
|
||||
("window.toggle.history", "History", &["Window"], None),
|
||||
("window.toggle.properties", "Properties", &["Window"], None),
|
||||
@@ -122,8 +124,8 @@ pub const TOOLS: &[(&str, &str, Option<&str>)] = &[
|
||||
("tools.select.count", "Count Tool", Some("I")),
|
||||
("tools.select.brush", "Brush Tool", Some("B")),
|
||||
("tools.select.pencil", "Pencil Tool", Some("B")),
|
||||
("tools.select.mixerBrush", "Mixer Brush Tool", Some("B")),
|
||||
("tools.select.colorReplacement", "Color Replacement Tool", Some("B")),
|
||||
("tools.select.mixerBrush", "Mixer Brush Tool", Some("B")),
|
||||
("tools.select.eraser", "Eraser Tool", Some("E")),
|
||||
("tools.select.backgroundEraser", "Background Eraser Tool", Some("E")),
|
||||
("tools.select.magicEraser", "Magic Eraser Tool", Some("E")),
|
||||
@@ -136,8 +138,8 @@ pub const TOOLS: &[(&str, &str, Option<&str>)] = &[
|
||||
("tools.select.hand", "Hand Tool", Some("H")),
|
||||
("tools.select.rotateView", "Rotate View Tool", Some("R")),
|
||||
("tools.select.zoom", "Zoom Tool", Some("Z")),
|
||||
("tools.select.remove", "Remove Tool", Some("J")),
|
||||
("tools.select.spotHealing", "Spot Healing Brush Tool", Some("J")),
|
||||
("tools.select.remove", "Remove Tool", Some("J")),
|
||||
("tools.select.healing", "Healing Brush Tool", Some("J")),
|
||||
("tools.select.patch", "Patch Tool", Some("J")),
|
||||
("tools.select.contentAwareMove", "Content-Aware Move Tool", Some("J")),
|
||||
@@ -157,9 +159,9 @@ pub const TOOLS: &[(&str, &str, Option<&str>)] = &[
|
||||
("tools.select.pen", "Pen Tool", Some("P")),
|
||||
("tools.select.freeformPen", "Freeform Pen Tool", Some("P")),
|
||||
("tools.select.curvaturePen", "Curvature Pen Tool", Some("P")),
|
||||
("tools.select.addAnchorPoint", "Add Anchor Point Tool", Some("P")),
|
||||
("tools.select.deleteAnchorPoint", "Delete Anchor Point Tool", Some("P")),
|
||||
("tools.select.convertPoint", "Convert Point Tool", Some("P")),
|
||||
("tools.select.addAnchorPoint", "Add Anchor Point Tool", None),
|
||||
("tools.select.deleteAnchorPoint", "Delete Anchor Point Tool", None),
|
||||
("tools.select.convertPoint", "Convert Point Tool", None),
|
||||
("tools.select.pathSelection", "Path Selection Tool", Some("A")),
|
||||
("tools.select.directSelection", "Direct Selection Tool", Some("A")),
|
||||
("tools.select.rectangle", "Rectangle Tool", Some("U")),
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
//! The measured Perspective Warp descriptor shape through ATN conversion and action playback.
|
||||
|
||||
use photocraft_doc::{LayerContent, LayerId};
|
||||
use photocraft_engine::{Session, actions_cmds::Action, atn_cmds};
|
||||
use photocraft_geom::Rect;
|
||||
use photocraft_psd::{
|
||||
atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem},
|
||||
descriptor::{Class, Descriptor, Id, ReferenceItem, UnicodeString, Value as D},
|
||||
};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
const EVENT: &str = "perspectiveWarpTransform";
|
||||
const COMMAND: &str = "edit.perspectiveWarp";
|
||||
|
||||
fn px(value: f64) -> D {
|
||||
D::UnitFloat { unit: *b"#Pxl", value }
|
||||
}
|
||||
|
||||
fn points(points: &[[f64; 2]]) -> D {
|
||||
D::List(points.iter().map(|&[x, y]| D::Descriptor(Descriptor::new("Pnt ").with("Hrzn", px(x)).with("Vrtc", px(y)))).collect())
|
||||
}
|
||||
|
||||
fn quad(indices: [i32; 4]) -> D {
|
||||
D::Descriptor(Descriptor::new("perspectiveWarpQuad").with("indices", D::List(indices.into_iter().map(D::Integer).collect())))
|
||||
}
|
||||
|
||||
/// Two planes sharing a seam. Vertices appear out of corner order to distinguish exact export.
|
||||
fn fixture(name: Option<&str>) -> Descriptor {
|
||||
let class = Class { class_id: Id::new("Lyr "), name: UnicodeString::new_nul("") };
|
||||
let target = match name {
|
||||
Some(name) => ReferenceItem::Name { class, name: UnicodeString::new_nul(name) },
|
||||
None => ReferenceItem::Enumerated { class, type_id: Id::new("Ordn"), value: Id::new("Trgt") },
|
||||
};
|
||||
let rect = Descriptor::new("Rctn").with("Top ", px(0.0)).with("Left", px(0.0)).with("Btom", px(24.0)).with("Rght", px(32.0));
|
||||
Descriptor::new(EVENT)
|
||||
.with("null", D::Reference(vec![target]))
|
||||
.with("Md ", D::Enumerated { type_id: Id::new("perspectiveWarpMode"), value: Id::new("warp") })
|
||||
.with("referenceRect", D::Descriptor(rect))
|
||||
.with("vertices", points(&[[16.0, 20.0], [4.0, 4.0], [28.0, 4.0], [4.0, 20.0], [16.0, 4.0], [28.0, 20.0]]))
|
||||
.with("warpedVertices", points(&[[17.0, 20.0], [5.5, 5.0], [27.0, 6.0], [4.0, 19.0], [18.0, 4.0], [26.0, 17.0]]))
|
||||
.with("quads", D::List(vec![quad([1, 4, 0, 3]), quad([4, 2, 5, 0])]))
|
||||
}
|
||||
|
||||
fn imported(d: Descriptor, with_dialog: bool, enabled: bool) -> atn_cmds::Imported {
|
||||
let item =
|
||||
AtnItem { event: AtnEvent::name(EVENT), dictionary: b"Perspective Warp".to_vec(), descriptor: Some(d), with_dialog, enabled, ..Default::default() };
|
||||
let file = AtnFile {
|
||||
name: UnicodeString::new_nul("Set"),
|
||||
actions: vec![AtnAction { name: UnicodeString::new_nul("Warp"), items: vec![item], ..Default::default() }],
|
||||
..Default::default()
|
||||
};
|
||||
atn_cmds::import(&atn::write(&file).unwrap()).unwrap()
|
||||
}
|
||||
|
||||
fn saved(action: &Action) -> AtnItem {
|
||||
let (bytes, skipped) = atn_cmds::export("Set", &[action], &[], false).unwrap();
|
||||
assert!(skipped.is_empty());
|
||||
atn::parse(&bytes).unwrap().actions[0].items[0].clone()
|
||||
}
|
||||
|
||||
fn planes() -> Value {
|
||||
json!([
|
||||
{"src":[[4,4],[16,4],[16,20],[4,20]],"dst":[[5.5,5],[18,4],[17,20],[4,19]]},
|
||||
{"src":[[16,4],[28,4],[28,20],[16,20]],"dst":[[18,4],[27,6],[26,17],[17,20]]}
|
||||
])
|
||||
}
|
||||
|
||||
fn value_mut<'a>(d: &'a mut Descriptor, key: &str) -> &'a mut D {
|
||||
&mut d.items.iter_mut().find(|(id, _)| id.is(key)).unwrap().1
|
||||
}
|
||||
|
||||
/// Exact export preserves the original indexed mesh, target, rectangle and step flags.
|
||||
#[test]
|
||||
fn descriptor_round_trip_preserves_shared_indices_and_flags() {
|
||||
for name in [None, Some("Façade")] {
|
||||
let d = fixture(name);
|
||||
let loaded = imported(d.clone(), true, false);
|
||||
assert!(loaded.unsupported.is_empty());
|
||||
let action = &loaded.actions[0];
|
||||
assert_eq!(action.steps[0].0, COMMAND);
|
||||
let params = &action.steps[0].1;
|
||||
assert_eq!(params["planes"], planes());
|
||||
assert_eq!(params["layer"].as_str(), name);
|
||||
assert_eq!(params["target"], "pixels");
|
||||
assert_eq!(params["__atnPerspectiveWarpRect"], json!([0, 0, 32, 24]));
|
||||
let item = saved(action);
|
||||
assert_eq!(item.event.id(), EVENT);
|
||||
assert_eq!(item.descriptor.unwrap().to_bytes(), d.to_bytes());
|
||||
assert!(item.with_dialog);
|
||||
assert!(!item.enabled);
|
||||
}
|
||||
}
|
||||
|
||||
/// Unsupported targets, units, modes and geometry retain the original bytes as kept steps.
|
||||
#[test]
|
||||
fn unsupported_recordings_are_kept_without_partial_mapping() {
|
||||
let d = fixture(None);
|
||||
let mut layout = d.clone();
|
||||
*value_mut(&mut layout, "Md ") = D::Enumerated { type_id: Id::new("perspectiveWarpMode"), value: Id::new("layout") };
|
||||
let mut wrong_target = d.clone();
|
||||
*value_mut(&mut wrong_target, "null") = D::Reference(vec![ReferenceItem::Class(Class { class_id: Id::new("Chnl"), name: UnicodeString::new_nul("") })]);
|
||||
let mut bad_index = d.clone();
|
||||
*value_mut(&mut bad_index, "quads") = D::List(vec![quad([1, 4, 99, 3])]);
|
||||
let mut wrong_units = d.clone();
|
||||
let D::Descriptor(rect) = value_mut(&mut wrong_units, "referenceRect") else { panic!("reference rectangle") };
|
||||
*value_mut(rect, "Rght") = D::UnitFloat { unit: *b"#Prc", value: 32.0 };
|
||||
let mut incompatible_topology = d.clone();
|
||||
for key in ["vertices", "warpedVertices"] {
|
||||
let D::List(points) = value_mut(&mut incompatible_topology, key) else { panic!("vertex list") };
|
||||
points.push(points[4].clone());
|
||||
}
|
||||
*value_mut(&mut incompatible_topology, "quads") = D::List(vec![quad([1, 4, 0, 3]), quad([6, 2, 5, 0])]);
|
||||
let mut duplicate = d.clone();
|
||||
duplicate.items.push((Id::new("quads"), d.get("quads").unwrap().clone()));
|
||||
for descriptor in [layout, wrong_target, bad_index, wrong_units, incompatible_topology, duplicate] {
|
||||
let loaded = imported(descriptor.clone(), false, true);
|
||||
assert_eq!(loaded.unsupported.len(), 1, "{descriptor:?}");
|
||||
assert_eq!(loaded.actions[0].steps[0].0, "actions.photoshopStep");
|
||||
assert_eq!(saved(&loaded.actions[0]).descriptor.unwrap().to_bytes(), descriptor.to_bytes());
|
||||
}
|
||||
}
|
||||
|
||||
/// Native export needs a reference rectangle. A stale recorded topology must not be substituted.
|
||||
#[test]
|
||||
fn native_export_requires_known_rectangle_and_rejects_stale_source() {
|
||||
let mut action = Action::new("Warp", vec![(COMMAND.into(), json!({"planes": planes()}))]);
|
||||
assert!(atn_cmds::export("Set", &[&action], &[], false).is_err());
|
||||
action.steps[0].1["__atnPerspectiveWarpRect"] = json!([0, 0, 32, 24]);
|
||||
let d = saved(&action).descriptor.unwrap();
|
||||
let keys: Vec<_> = d.items.iter().map(|(id, _)| id.as_bytes()).collect();
|
||||
assert_eq!(keys, [b"null".as_slice(), b"Md ", b"referenceRect", b"vertices", b"warpedVertices", b"quads"]);
|
||||
let mut recorded = imported(d, false, true).actions.remove(0);
|
||||
recorded.steps[0].1["planes"][0]["dst"][0][0] = json!(6);
|
||||
assert!(atn_cmds::export("Set", &[&recorded], &[], false).is_err());
|
||||
action.steps[0].1["interpolation"] = json!("nearest");
|
||||
assert!(atn_cmds::export("Set", &[&action], &[], false).is_err());
|
||||
}
|
||||
|
||||
fn session(depth: u8) -> (Session, LayerId) {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", json!({"width":32,"height":24,"depth":depth})).unwrap();
|
||||
s.execute("layer.new.layer", json!({})).unwrap();
|
||||
let id = s.active().unwrap().active_layer.unwrap();
|
||||
s.edit("Fixture", |doc, _| {
|
||||
let layer = doc.layer_mut(id).unwrap();
|
||||
layer.name = "Facade".into();
|
||||
let surf = layer.surface_mut().unwrap();
|
||||
let fmt = surf.format();
|
||||
surf.fill_rect(Rect::new(4, 4, 16, 20), &photocraft_raster::from_rgba(&fmt, [0.9, 0.2, 0.1, 1.0]));
|
||||
surf.fill_rect(Rect::new(16, 4, 28, 20), &photocraft_raster::from_rgba(&fmt, [0.1, 0.2, 0.9, 1.0]));
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
(s, id)
|
||||
}
|
||||
|
||||
/// A named raster is warped, while the active decoy stays unchanged.
|
||||
#[test]
|
||||
fn action_playback_matches_the_native_raster_warp() {
|
||||
for depth in [8, 16, 32] {
|
||||
let (mut actual, id) = session(depth);
|
||||
let (mut direct, did) = session(depth);
|
||||
let before = actual.active().unwrap().doc.layer(id).unwrap().surface().unwrap().clone();
|
||||
for s in [&mut actual, &mut direct] {
|
||||
s.execute("layer.new.layer", json!({})).unwrap();
|
||||
}
|
||||
let decoy = actual.active().unwrap().active_layer.unwrap();
|
||||
let decoy_before = actual.active().unwrap().doc.layer(decoy).unwrap().clone();
|
||||
actual.actions.list.extend(imported(fixture(Some("Facade")), false, true).actions);
|
||||
actual.execute("actions.play", json!({"action":0})).unwrap();
|
||||
direct.execute(COMMAND, json!({"planes":planes(),"layer":"Facade","target":"pixels"})).unwrap();
|
||||
let result = actual.active().unwrap().doc.layer(id).unwrap().surface().unwrap();
|
||||
assert_ne!(*result, before);
|
||||
assert_eq!(result, direct.active().unwrap().doc.layer(did).unwrap().surface().unwrap());
|
||||
assert_eq!(actual.active().unwrap().doc.layer(decoy), Some(&decoy_before));
|
||||
actual.execute("edit.undo", json!({})).unwrap();
|
||||
assert_eq!(actual.active().unwrap().doc.layer(id).unwrap().surface(), Some(&before));
|
||||
}
|
||||
}
|
||||
|
||||
/// The same active-layer recording adds a native Smart Filter and keeps PSD export available.
|
||||
#[test]
|
||||
fn active_smart_object_playback_matches_the_native_filter() {
|
||||
let (mut actual, _) = session(8);
|
||||
let (mut direct, _) = session(8);
|
||||
for s in [&mut actual, &mut direct] {
|
||||
s.execute("layer.smartObjects.convertToSmartObject", json!({})).unwrap();
|
||||
}
|
||||
actual.actions.list.extend(imported(fixture(None), false, true).actions);
|
||||
actual.execute("actions.play", json!({"action":0})).unwrap();
|
||||
direct.execute("layer.smartObjects.perspectiveWarp", json!({"planes":planes()})).unwrap();
|
||||
let [actual, direct] = [&actual, &direct].map(|s| {
|
||||
let st = s.active().unwrap();
|
||||
let LayerContent::Smart(sm) = &st.doc.layer(st.active_layer.unwrap()).unwrap().content else { panic!("smart object") };
|
||||
sm
|
||||
});
|
||||
assert_eq!(actual.cache, direct.cache);
|
||||
assert_eq!(actual.smart_filters.len(), 1);
|
||||
assert_eq!(actual.smart_filters[0].command, COMMAND);
|
||||
assert_eq!(actual.smart_filters[0].params["planes"], planes());
|
||||
assert!(photocraft_io::smart_map::item_for_filter(&actual.smart_filters[0]).is_ok());
|
||||
}
|
||||
@@ -0,0 +1,243 @@
|
||||
//! The measured Smart Object Stack Mode events retain their descriptor and native behavior.
|
||||
|
||||
use photocraft_doc::{Group, Layer, LayerContent, StackMode};
|
||||
use photocraft_engine::{Session, actions_cmds::Action, atn_cmds};
|
||||
use photocraft_geom::Rect;
|
||||
use photocraft_psd::{
|
||||
atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem},
|
||||
descriptor::{Class, Descriptor, Id, UnicodeString, Value as D},
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
const APPLY: &str = "applyImageStackPluginRenderer";
|
||||
const CLEAR: &str = "imageStackConvertSmartObject";
|
||||
const ORIGIN: &str = "_atnStackDescriptor";
|
||||
|
||||
/// Independent pairs from the measured table in docs/atn.md.
|
||||
const MODES: &[(&str, &str, StackMode)] = &[
|
||||
("rang", "Range", StackMode::Range),
|
||||
("entr", "Entropy", StackMode::Entropy),
|
||||
("kurt", "Kurtosis", StackMode::Kurtosis),
|
||||
("maxx", "Maximum", StackMode::Maximum),
|
||||
("medn", "Median", StackMode::Median),
|
||||
("minn", "Minimum", StackMode::Minimum),
|
||||
("avrg", "Mean", StackMode::Mean),
|
||||
("skew", "Skewness", StackMode::Skewness),
|
||||
("stdv", "Standard Deviation", StackMode::StandardDeviation),
|
||||
("summ", "Summation", StackMode::Summation),
|
||||
("vari", "Variance", StackMode::Variance),
|
||||
];
|
||||
|
||||
fn descriptor(code: &str, name: &str) -> Descriptor {
|
||||
Descriptor::new("null")
|
||||
.with("imageStackPlugin", D::Class(Class { name: UnicodeString::new_nul(""), class_id: Id::new(code) }))
|
||||
.with("Nm ", D::Text(UnicodeString::new_nul(name)))
|
||||
}
|
||||
|
||||
fn item(event: &str, descriptor: Option<Descriptor>) -> AtnItem {
|
||||
AtnItem { event: AtnEvent::name(event), descriptor, ..Default::default() }
|
||||
}
|
||||
|
||||
fn load(item: AtnItem) -> atn_cmds::Imported {
|
||||
let file = AtnFile {
|
||||
name: UnicodeString::new_nul("Stacks"),
|
||||
actions: vec![AtnAction { name: UnicodeString::new_nul("Mode"), items: vec![item], ..Default::default() }],
|
||||
..Default::default()
|
||||
};
|
||||
atn_cmds::import(&atn::write(&file).unwrap()).unwrap()
|
||||
}
|
||||
|
||||
fn saved(action: &Action) -> AtnItem {
|
||||
let (bytes, skipped) = atn_cmds::export("Stacks", &[action], &[], false).unwrap();
|
||||
assert!(skipped.is_empty());
|
||||
atn::parse(&bytes).unwrap().actions.remove(0).items.remove(0)
|
||||
}
|
||||
|
||||
/// Exercise actual load/save bytes for all plugin classes and the separate None event.
|
||||
#[test]
|
||||
fn measured_stack_modes_and_none_import_export_and_reload() {
|
||||
for &(code, name, mode) in MODES {
|
||||
let original = item(APPLY, Some(descriptor(code, name)));
|
||||
let imported = load(original.clone());
|
||||
assert!(imported.unsupported.is_empty());
|
||||
assert_eq!(imported.actions[0].steps, vec![(format!("layer.smartObjects.stackMode.{}", mode.id()), json!({}))]);
|
||||
let out = saved(&imported.actions[0]);
|
||||
assert_eq!(out.event, original.event);
|
||||
assert_eq!(out.descriptor, original.descriptor);
|
||||
assert_eq!(load(out).actions[0].steps, imported.actions[0].steps);
|
||||
}
|
||||
for original in [item(CLEAR, None), item(CLEAR, Some(Descriptor::new("null")))] {
|
||||
let imported = load(original.clone());
|
||||
assert!(imported.unsupported.is_empty());
|
||||
assert_eq!(imported.actions[0].steps[0].0, "layer.smartObjects.stackMode.none");
|
||||
let out = saved(&imported.actions[0]);
|
||||
assert_eq!(out.event, original.event);
|
||||
assert_eq!(out.descriptor, original.descriptor);
|
||||
assert_eq!(load(out).actions[0].steps, imported.actions[0].steps);
|
||||
}
|
||||
let native = Action::new("Mode", vec![("layer.smartObjects.stackMode.none".into(), json!({}))]);
|
||||
let out = saved(&native);
|
||||
assert_eq!(out.event, AtnEvent::name(CLEAR));
|
||||
assert!(out.descriptor.is_none());
|
||||
}
|
||||
|
||||
/// Localized names and noncanonical wire metadata still replay the class-selected mode.
|
||||
#[test]
|
||||
fn localized_stack_descriptors_keep_original_metadata_and_flags() {
|
||||
for name in [UnicodeString::new("Moyenne"), UnicodeString::new_nul("平均值"), UnicodeString(vec![0xd800, 0, 0])] {
|
||||
let mut d = descriptor("avrg", "Mean");
|
||||
d.name = UnicodeString::new_nul("Recorded stack");
|
||||
d.class_id = Id::Str(b"null".to_vec());
|
||||
d.items[1].1 = D::Text(name);
|
||||
d.items[1].0 = Id::Str(b"Nm ".to_vec());
|
||||
d.items.reverse();
|
||||
let mut original = item(APPLY, Some(d));
|
||||
original.enabled = false;
|
||||
original.with_dialog = true;
|
||||
original.dialog_options = 2;
|
||||
let imported = load(original.clone());
|
||||
assert!(imported.unsupported.is_empty());
|
||||
assert_eq!(imported.actions[0].steps[0].0, "layer.smartObjects.stackMode.mean");
|
||||
let out = saved(&imported.actions[0]);
|
||||
assert_eq!(out.descriptor, original.descriptor);
|
||||
assert!(!out.enabled);
|
||||
assert!(out.with_dialog);
|
||||
assert_eq!(out.dialog_options, 2);
|
||||
}
|
||||
let mut d = Descriptor::new("null");
|
||||
d.name = UnicodeString(vec![0xd800, 0]);
|
||||
d.class_id = Id::Str(b"null".to_vec());
|
||||
let imported = load(item(CLEAR, Some(d.clone())));
|
||||
assert!(imported.unsupported.is_empty());
|
||||
assert_eq!(saved(&imported.actions[0]).descriptor, Some(d));
|
||||
}
|
||||
|
||||
fn stack(depth: u32) -> Session {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", json!({"width":3,"height":2,"depth":depth})).unwrap();
|
||||
s.edit("Fixture", |doc, active| {
|
||||
let fmt = doc.pixel_format();
|
||||
let children = [0.2, 0.2, 0.8]
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
.map(|(index, value)| {
|
||||
let mut layer = Layer::raster(format!("Frame {index}"), fmt);
|
||||
let pixel = photocraft_raster::from_rgba(&fmt, [value, value, value, 1.0]);
|
||||
layer.surface_mut().unwrap().write_region(Rect::new(0, 0, 3, 2), &pixel.repeat(6));
|
||||
layer
|
||||
})
|
||||
.collect();
|
||||
let group = Layer::new("Stack", LayerContent::Group(Group { children, expanded: true, artboard: None, frame_stroke: None }));
|
||||
let smart = photocraft_engine::smart_cmds::layer_to_smart(doc, &group)?;
|
||||
*active = Some(smart.id);
|
||||
doc.layers = vec![smart];
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
s
|
||||
}
|
||||
|
||||
/// Compare the adapter with existing native commands, including pixel output and one Undo/Redo.
|
||||
#[test]
|
||||
fn stack_recordings_play_native_modes_and_undo_at_each_depth() {
|
||||
for depth in [8, 16, 32] {
|
||||
let mut s = stack(depth);
|
||||
let modes = MODES.iter().map(|&(code, _, mode)| (item(APPLY, Some(descriptor(code, "Recorded name"))), Some(mode)));
|
||||
let clear_forms = [None, Some(Descriptor::new("null"))].into_iter().map(|d| (item(CLEAR, d), None));
|
||||
for (source, mode) in modes.chain(clear_forms) {
|
||||
let starting = if mode == Some(StackMode::Maximum) { "none" } else { "maximum" };
|
||||
s.execute(&format!("layer.smartObjects.stackMode.{starting}"), json!({})).unwrap();
|
||||
let before = s.active().unwrap().doc.clone();
|
||||
let before_steps = s.active().unwrap().history.past_len();
|
||||
let command = format!("layer.smartObjects.stackMode.{}", mode.map_or("none", StackMode::id));
|
||||
s.execute(&command, json!({})).unwrap();
|
||||
let expected = s.active().unwrap().doc.clone();
|
||||
s.execute("edit.undo", json!({})).unwrap();
|
||||
let imported = load(source);
|
||||
s.actions.list = imported.actions;
|
||||
let result = s.execute("actions.play", json!({"action":"Mode","set":"Stacks"})).unwrap();
|
||||
assert_eq!(result["ran"], 1, "{result}");
|
||||
let actual = s.active().unwrap();
|
||||
assert_eq!(actual.doc.layers, expected.layers, "{command} at {depth}-bit");
|
||||
assert_eq!(actual.history.past_len(), before_steps + 1);
|
||||
s.execute("edit.undo", json!({})).unwrap();
|
||||
assert_eq!(s.active().unwrap().doc.layers, before.layers);
|
||||
s.execute("edit.redo", json!({})).unwrap();
|
||||
assert_eq!(s.active().unwrap().doc.layers, expected.layers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Unrepresented types, duplicate keys and extra settings stay complete kept steps.
|
||||
#[test]
|
||||
fn unsupported_stack_recordings_save_whole_and_refuse_playback() {
|
||||
let canonical = descriptor("medn", "Median");
|
||||
let mut duplicate = canonical.clone();
|
||||
duplicate.items.push(duplicate.items[0].clone());
|
||||
let mut wrong_name = canonical.clone();
|
||||
wrong_name.items[1].1 = D::Integer(5);
|
||||
let mut global_class = canonical.clone();
|
||||
let D::Class(class) = global_class.items[0].1.clone() else { unreachable!() };
|
||||
global_class.items[0].1 = D::GlobalClass(class);
|
||||
let extra = canonical.clone().with("unknown", D::Boolean(true));
|
||||
for original in [
|
||||
item(APPLY, Some(duplicate)),
|
||||
item(APPLY, Some(wrong_name)),
|
||||
item(APPLY, Some(global_class)),
|
||||
item(APPLY, Some(extra)),
|
||||
item(APPLY, Some(descriptor("nope", "Median"))),
|
||||
item(APPLY, None),
|
||||
item(CLEAR, Some(canonical)),
|
||||
item(CLEAR, Some(Descriptor::new("nope"))),
|
||||
] {
|
||||
let imported = load(original.clone());
|
||||
assert_eq!(imported.unsupported.len(), 1);
|
||||
assert_eq!(imported.actions[0].steps[0].0, atn_cmds::PHOTOSHOP_STEP);
|
||||
let out = saved(&imported.actions[0]);
|
||||
assert_eq!(out.event, original.event);
|
||||
assert_eq!(out.descriptor, original.descriptor);
|
||||
let mut s = stack(8);
|
||||
s.execute("layer.smartObjects.stackMode.maximum", json!({})).unwrap();
|
||||
let before = s.active().unwrap().doc.clone();
|
||||
let history = s.active().unwrap().history.past_len();
|
||||
s.actions.list = imported.actions;
|
||||
let result = s.execute("actions.play", json!({"action":"Mode","set":"Stacks"})).unwrap();
|
||||
assert!(result.get("failed").is_some(), "{result}");
|
||||
assert_eq!(s.active().unwrap().doc.layers, before.layers);
|
||||
assert_eq!(s.active().unwrap().history.past_len(), history);
|
||||
}
|
||||
}
|
||||
|
||||
/// Native mode edits replace the old class; explicit targets and damaged origin metadata refuse export.
|
||||
#[test]
|
||||
fn stack_mode_edits_and_unrepresented_native_parameters_are_safe() {
|
||||
let imported = load(item(APPLY, Some(descriptor("medn", "Médiane"))));
|
||||
let mut action = imported.actions[0].clone();
|
||||
action.steps[0].0 = "layer.smartObjects.stackMode.maximum".into();
|
||||
assert_eq!(saved(&action).descriptor, Some(descriptor("maxx", "Maximum")));
|
||||
|
||||
action.steps[0].0 = "layer.smartObjects.stackMode.none".into();
|
||||
let cleared = saved(&action);
|
||||
assert_eq!(cleared.event, AtnEvent::name(CLEAR));
|
||||
assert_eq!(cleared.descriptor, Some(Descriptor::new("null")));
|
||||
|
||||
let mut action = load(item(CLEAR, Some(Descriptor::new("null")))).actions.remove(0);
|
||||
action.steps[0].0 = "layer.smartObjects.stackMode.mean".into();
|
||||
let applied = saved(&action);
|
||||
assert_eq!(applied.event, AtnEvent::name(APPLY));
|
||||
assert_eq!(applied.descriptor, Some(descriptor("avrg", "Mean")));
|
||||
|
||||
let unknown_empty = photocraft_engine::paint::tile::b64_encode(&Descriptor::new("nope").to_bytes());
|
||||
let unknown_class = photocraft_engine::paint::tile::b64_encode(&descriptor("nope", "Mean").to_bytes());
|
||||
for command in ["layer.smartObjects.stackMode.mean", "layer.smartObjects.stackMode.none"] {
|
||||
for params in [json!(null), json!([]), json!({"layer":12}), json!({"layer":"Named"}), json!({"target":"mask"}), json!({"unknown":true})] {
|
||||
let action = Action::new("Mode", vec![(command.into(), params)]);
|
||||
assert!(atn_cmds::export("Stacks", &[&action], &[], false).is_err());
|
||||
}
|
||||
for origin in [json!(false), json!("!invalid-base64"), json!(""), json!(unknown_class), json!(unknown_empty)] {
|
||||
let mut action = Action::new("Mode", vec![(command.into(), json!({}))]);
|
||||
action.steps[0].1[ORIGIN] = origin;
|
||||
assert!(atn_cmds::export("Stacks", &[&action], &[], false).is_err());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
//! #10723: recorded frame edits use the active video layer and the current playhead.
|
||||
use photocraft_doc::{LayerContent, LayerId};
|
||||
use photocraft_engine::{Session, actions_cmds::Action, atn_cmds};
|
||||
use photocraft_psd::{
|
||||
atn::{self, AtnAction, AtnEvent, AtnFile, AtnItem},
|
||||
descriptor::{Descriptor, UnicodeString, Value as D},
|
||||
};
|
||||
use serde_json::json;
|
||||
use std::sync::Arc;
|
||||
|
||||
const EVENTS: [(&str, &str); 3] = [
|
||||
("insertBlankFrame", "layer.videoLayers.insertBlankFrame"),
|
||||
("duplicateFrame", "layer.videoLayers.duplicateFrame"),
|
||||
("deleteFrame", "layer.videoLayers.deleteFrame"),
|
||||
];
|
||||
|
||||
/// Build typed source fixtures without asking the mapper to generate its own oracle.
|
||||
fn file(item: AtnItem) -> Vec<u8> {
|
||||
atn::write(&AtnFile {
|
||||
name: UnicodeString::new_nul("Video"),
|
||||
actions: vec![AtnAction { name: UnicodeString::new_nul("Frame edit"), items: vec![item], ..Default::default() }],
|
||||
..Default::default()
|
||||
})
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn item(event: &str, descriptor: Option<Descriptor>) -> AtnItem {
|
||||
AtnItem { event: AtnEvent::name(event), descriptor, ..Default::default() }
|
||||
}
|
||||
|
||||
/// Exercise strict public export: skipping an unrepresentable step cannot pass this check.
|
||||
fn saved(action: &Action) -> AtnItem {
|
||||
let (bytes, skipped) = atn_cmds::export("Video", &[action], &[], false).unwrap();
|
||||
assert!(skipped.is_empty());
|
||||
atn::parse(&bytes).unwrap().actions[0].items[0].clone()
|
||||
}
|
||||
|
||||
/// Playback tests require a native mapping, rather than a successfully loaded kept step.
|
||||
fn load(s: &mut Session, source: AtnItem) {
|
||||
let bytes = file(source);
|
||||
let report = s.execute("actions.load", json!({"data":photocraft_engine::paint::tile::b64_encode(&bytes)})).unwrap();
|
||||
assert_eq!(report["unsupported"], json!([]));
|
||||
}
|
||||
|
||||
/// Compare actual pixel markers; VideoData equality checks only stack shape.
|
||||
fn pixels(s: &Session, id: LayerId, original: bool) -> Vec<Vec<f32>> {
|
||||
let video = s.active().unwrap().doc.layer(id).unwrap().video.as_ref().unwrap();
|
||||
let frames = if original { video.original_frames.as_ref().unwrap() } else { &video.frames };
|
||||
frames.iter().map(|frame| frame.pixel(0, 0)).collect()
|
||||
}
|
||||
|
||||
/// Distinguish both frame order and original footage from the altered display cache.
|
||||
fn fixture(depth: u32) -> (Session, LayerId) {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", json!({"width":2,"height":2,"depth":depth,"background":"transparent"})).unwrap();
|
||||
s.execute("timeline.create", json!({"duration":3,"fps":24})).unwrap();
|
||||
let result = s.execute("layer.videoLayers.newBlankVideoLayer", json!({})).unwrap();
|
||||
let id = LayerId(result["layer"].as_u64().unwrap());
|
||||
let state = s.active_mut().unwrap();
|
||||
let doc = Arc::make_mut(&mut state.doc);
|
||||
let mut frames = Vec::new();
|
||||
for red in [0.25, 0.5, 0.75] {
|
||||
let mut frame = photocraft_raster::Surface::new(doc.pixel_format());
|
||||
frame.write_pixel(0, 0, &[red, 0.0, 0.0, 1.0]);
|
||||
frames.push(frame);
|
||||
}
|
||||
let layer = doc.layer_mut(id).unwrap();
|
||||
layer.content = LayerContent::Raster(frames[1].clone());
|
||||
let video = layer.video.as_mut().unwrap();
|
||||
video.original_frames = Some(
|
||||
frames
|
||||
.iter()
|
||||
.rev()
|
||||
.map(|frame| {
|
||||
let mut original = frame.clone();
|
||||
let red = original.pixel(0, 0)[0];
|
||||
original.write_pixel(0, 0, &[red, 1.0, 0.0, 1.0]);
|
||||
original
|
||||
})
|
||||
.collect(),
|
||||
);
|
||||
video.frames = frames;
|
||||
let timeline = doc.timeline.as_mut().unwrap();
|
||||
timeline.current = 1;
|
||||
timeline.work_start = 1;
|
||||
timeline.work_end = 2;
|
||||
(s, id)
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// Import's empty placeholder must not erase the wire's descriptor-presence distinction.
|
||||
fn descriptors_and_step_flags_round_trip_including_an_absent_descriptor() {
|
||||
for (event, command) in EVENTS {
|
||||
for descriptor in [None, Some(Descriptor::default())] {
|
||||
for enabled in [false, true] {
|
||||
let mut source = item(event, descriptor.clone());
|
||||
source.enabled = enabled;
|
||||
source.with_dialog = true;
|
||||
let imported = atn_cmds::import(&file(source)).unwrap();
|
||||
assert!(imported.unsupported.is_empty());
|
||||
let action = &imported.actions[0];
|
||||
assert_eq!(action.steps[0].0, command);
|
||||
assert_eq!(action.disabled.contains(&0), !enabled);
|
||||
assert!(action.dialogs.contains(&0));
|
||||
let back = saved(action);
|
||||
assert_eq!(back.event, AtnEvent::name(event));
|
||||
assert_eq!(back.descriptor, descriptor);
|
||||
assert_eq!(back.enabled, enabled);
|
||||
assert!(back.with_dialog);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// One recorded command must change the correct stack position and remain one undoable edit.
|
||||
fn playback_edits_the_current_frame_and_original_stack_with_undo_redo_at_each_depth() {
|
||||
for (depth, has_descriptor) in [(8, true), (16, true), (32, true), (8, false)] {
|
||||
for (event, _) in EVENTS {
|
||||
let (mut s, id) = fixture(depth);
|
||||
let before = pixels(&s, id, false);
|
||||
let originals = pixels(&s, id, true);
|
||||
let timeline = s.active().unwrap().doc.timeline.clone();
|
||||
let expected = |frames: &[Vec<f32>]| match event {
|
||||
"insertBlankFrame" => vec![frames[0].clone(), frames[1].clone(), vec![0.0; 4], frames[2].clone()],
|
||||
"duplicateFrame" => vec![frames[0].clone(), frames[1].clone(), frames[1].clone(), frames[2].clone()],
|
||||
"deleteFrame" => vec![frames[0].clone(), frames[2].clone()],
|
||||
_ => panic!("fixture event"),
|
||||
};
|
||||
load(&mut s, item(event, has_descriptor.then(Descriptor::default)));
|
||||
let report = s.execute("actions.play", json!({"action":0})).unwrap();
|
||||
assert!(report.get("failed").is_none(), "{depth}/{event}: {report}");
|
||||
assert_eq!(report["ran"], 1);
|
||||
assert_eq!(pixels(&s, id, false), expected(&before), "{depth}/{event}");
|
||||
assert_eq!(pixels(&s, id, true), expected(&originals), "original {depth}/{event}");
|
||||
let t = s.active().unwrap().doc.timeline.as_ref().unwrap();
|
||||
assert_eq!((t.current, t.work_start, t.work_end), (1, 1, 2));
|
||||
assert_eq!(t.duration, if event == "deleteFrame" { 3 } else { 4 });
|
||||
let LayerContent::Raster(display) = &s.active().unwrap().doc.layer(id).unwrap().content else { panic!("video display") };
|
||||
assert_eq!(display.pixel(0, 0), expected(&before)[1]);
|
||||
s.execute("history.undo", json!({})).unwrap();
|
||||
assert_eq!(pixels(&s, id, false), before);
|
||||
assert_eq!(pixels(&s, id, true), originals);
|
||||
assert_eq!(s.active().unwrap().doc.timeline, timeline);
|
||||
s.execute("history.redo", json!({})).unwrap();
|
||||
assert_eq!(pixels(&s, id, false), expected(&before));
|
||||
assert_eq!(pixels(&s, id, true), expected(&originals));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// The native last-frame protection must also hold through recorded playback.
|
||||
fn deleting_the_last_frame_keeps_its_pixels() {
|
||||
let (mut s, id) = fixture(8);
|
||||
let state = s.active_mut().unwrap();
|
||||
let doc = Arc::make_mut(&mut state.doc);
|
||||
let layer = doc.layer_mut(id).unwrap();
|
||||
let video = layer.video.as_mut().unwrap();
|
||||
video.frames.truncate(1);
|
||||
video.original_frames.as_mut().unwrap().truncate(1);
|
||||
layer.content = LayerContent::Raster(video.frames[0].clone());
|
||||
let t = doc.timeline.as_mut().unwrap();
|
||||
*t = photocraft_doc::video::Timeline::new(1, 24.0);
|
||||
let before = pixels(&s, id, false);
|
||||
let original = pixels(&s, id, true);
|
||||
load(&mut s, item("deleteFrame", Some(Descriptor::default())));
|
||||
let report = s.execute("actions.play", json!({"action":0})).unwrap();
|
||||
assert!(report.get("failed").is_none(), "{report}");
|
||||
assert_eq!(pixels(&s, id, false), before);
|
||||
assert_eq!(pixels(&s, id, true), original);
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// Recognizing an event name must never discard settings or reinterpret its unknown header.
|
||||
fn unrepresented_settings_and_descriptor_metadata_stay_complete_kept_steps() {
|
||||
let named = Descriptor { name: UnicodeString::new_nul("Unmeasured metadata"), ..Default::default() };
|
||||
for (event, _) in EVENTS {
|
||||
for descriptor in [Descriptor::default().with("frame", D::Integer(2)), Descriptor::new("other"), named.clone()] {
|
||||
let imported = atn_cmds::import(&file(item(event, Some(descriptor.clone())))).unwrap();
|
||||
assert_eq!(imported.unsupported.len(), 1);
|
||||
assert_eq!(imported.actions[0].steps[0].0, "actions.photoshopStep");
|
||||
assert_eq!(saved(&imported.actions[0]).descriptor, Some(descriptor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// Current-frame recordings cannot serialize an explicit frame, layer or mask selector.
|
||||
fn native_options_and_damaged_absence_metadata_refuse_export() {
|
||||
for (_, command) in EVENTS {
|
||||
for params in [
|
||||
json!({"frame":2}),
|
||||
json!({"layer":3}),
|
||||
json!({"target":"mask"}),
|
||||
json!({"_atnVideoFrameNoDescriptor":false}),
|
||||
json!({"_atnVideoFrameNoDescriptor":"true"}),
|
||||
] {
|
||||
let action = Action::new("Invalid", vec![(command.into(), params)]);
|
||||
assert!(atn_cmds::export("Video", &[&action], &[], false).is_err(), "{command}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
/// Mapping a known event cannot bypass the native video-target precondition.
|
||||
fn playback_without_a_video_target_fails_without_editing_a_document() {
|
||||
for (event, _) in EVENTS {
|
||||
for document in [false, true] {
|
||||
let mut s = Session::new();
|
||||
if document {
|
||||
s.execute("file.new", json!({"width":2,"height":2})).unwrap();
|
||||
}
|
||||
let before = s.active().map(|state| state.doc.clone());
|
||||
load(&mut s, item(event, Some(Descriptor::default())));
|
||||
let report = s.execute("actions.play", json!({"action":0})).unwrap();
|
||||
assert!(report.get("failed").is_some(), "{event}: {report}");
|
||||
match before {
|
||||
Some(before) => assert!(Arc::ptr_eq(&before, &s.active().unwrap().doc)),
|
||||
None => assert!(s.active().is_none()),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,392 @@
|
||||
//! #10868: crop fill samples the Background and editable active raster independently.
|
||||
|
||||
use photocraft_doc::{Document, Layer, LayerContent, LayerId, TextLayer};
|
||||
use photocraft_engine::Session;
|
||||
use photocraft_geom::Rect;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
const WHITE: [f32; 4] = [1.0, 1.0, 1.0, 1.0];
|
||||
const RED: [f32; 4] = [1.0, 0.0, 0.0, 1.0];
|
||||
const GREEN: [f32; 4] = [0.0, 1.0, 0.0, 1.0];
|
||||
const BLUE: [f32; 4] = [0.0, 0.0, 1.0, 1.0];
|
||||
const YELLOW: [f32; 4] = [1.0, 1.0, 0.0, 1.0];
|
||||
|
||||
struct Layers {
|
||||
background: LayerId,
|
||||
quads: LayerId,
|
||||
small: LayerId,
|
||||
edge: LayerId,
|
||||
hidden: LayerId,
|
||||
text: LayerId,
|
||||
}
|
||||
|
||||
fn doc(s: &Session) -> &Document {
|
||||
&s.active().unwrap().doc
|
||||
}
|
||||
|
||||
fn raster(d: &Document, name: &str, bounds: Rect, color: [f32; 4]) -> Layer {
|
||||
let fmt = d.pixel_format();
|
||||
let mut layer = Layer::raster(name, fmt);
|
||||
layer.surface_mut().unwrap().fill_rect(bounds, &photocraft_raster::from_rgba(&fmt, color));
|
||||
layer
|
||||
}
|
||||
|
||||
/// Keeps the measured straight geometry and fits turned controls under the 1 MiB transform limit
|
||||
/// that the preference test can set process-wide.
|
||||
fn scene_divisor(turned: bool) -> i32 {
|
||||
if turned { 2 } else { 1 }
|
||||
}
|
||||
|
||||
/// The measured scene, with a deliberately different crop extension colour.
|
||||
fn scene(turned: bool) -> (Session, Layers) {
|
||||
let divisor = scene_divisor(turned);
|
||||
let rect = |x0, y0, x1, y1| Rect::new(x0 / divisor, y0 / divisor, x1 / divisor, y1 / divisor);
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", json!({"width":800/divisor,"height":500/divisor,"depth":8,"background":"white"})).unwrap();
|
||||
s.execute("tools.setColors", json!({"background":"#ff00ff"})).unwrap();
|
||||
let ids = s
|
||||
.edit("Fixture", |d, _| {
|
||||
let background = d.background().unwrap().id;
|
||||
let mut quads = raster(d, "Quads", rect(0, 0, 800, 500), RED);
|
||||
let fmt = d.pixel_format();
|
||||
let surf = quads.surface_mut().unwrap();
|
||||
for (bounds, color) in [(rect(400, 0, 800, 250), GREEN), (rect(0, 250, 400, 500), BLUE), (rect(400, 250, 800, 500), YELLOW)] {
|
||||
surf.fill_rect(bounds, &photocraft_raster::from_rgba(&fmt, color));
|
||||
}
|
||||
let small = raster(d, "Small", rect(350, 200, 450, 300), RED);
|
||||
let edge = raster(d, "EdgeHalf", rect(600, 0, 800, 250), BLUE);
|
||||
let mut hidden = raster(d, "Hidden", rect(0, 0, 800, 500), RED);
|
||||
hidden.visible = false;
|
||||
let text = Layer::new("T", LayerContent::Text(TextLayer { text: "T".into(), ..Default::default() }));
|
||||
let ids = Layers { background, quads: quads.id, small: small.id, edge: edge.id, hidden: hidden.id, text: text.id };
|
||||
d.layers.extend([quads, small, edge, hidden, text]);
|
||||
Ok(ids)
|
||||
})
|
||||
.unwrap();
|
||||
(s, ids)
|
||||
}
|
||||
|
||||
fn select(s: &mut Session, id: LayerId) {
|
||||
s.execute("layer.select", json!({"layer":id.0})).unwrap();
|
||||
}
|
||||
|
||||
/// Extends the frame to the right by one eighth of the original width.
|
||||
fn frame(turned: bool) -> Value {
|
||||
let divisor = scene_divisor(turned);
|
||||
json!({"x":0,"y":0,"width":900/divisor,"height":500/divisor,"angle":if turned { 10 } else { 0 },"deleteCroppedPixels":true})
|
||||
}
|
||||
|
||||
/// Samples the same relative point inside the new strip in both fixture sizes.
|
||||
fn extension_sample(turned: bool) -> (i32, i32) {
|
||||
let divisor = scene_divisor(turned);
|
||||
(850 / divisor, 400 / divisor)
|
||||
}
|
||||
|
||||
fn crop(s: &mut Session, mut p: Value, aware: bool) {
|
||||
p["contentAware"] = json!(aware);
|
||||
s.execute("image.crop", p).unwrap();
|
||||
}
|
||||
|
||||
fn plain_control(s: &mut Session, p: &Value) -> Document {
|
||||
crop(s, p.clone(), false);
|
||||
let plain = doc(s).clone();
|
||||
s.execute("edit.undo", json!({})).unwrap();
|
||||
plain
|
||||
}
|
||||
|
||||
/// Checks donor colour with room for the resampling and synthesis tolerance.
|
||||
fn pixel(d: &Document, id: LayerId, x: i32, y: i32, want: [f32; 4]) {
|
||||
let actual = d.layer(id).unwrap().surface().unwrap().rgba(x, y);
|
||||
assert!(actual.iter().zip(want).all(|(a, b)| (a - b).abs() < 0.06), "layer {id:?} at ({x},{y}): {actual:?}, expected {want:?}");
|
||||
}
|
||||
|
||||
/// Compares complete layers with plain crop, including any legitimate turn or clipping.
|
||||
fn unchanged(d: &Document, plain: &Document, ids: &[LayerId]) {
|
||||
for id in ids {
|
||||
// Includes bounds, pixels and metadata; turned crops legitimately transform these layers.
|
||||
assert_eq!(d.layer(*id), plain.layer(*id), "non-target {id:?} differs from plain crop");
|
||||
}
|
||||
}
|
||||
|
||||
/// Every pixel of `id` inside `area` (the old canvas) is the plain crop's.
|
||||
fn covered_as_plain(d: &Document, plain: &Document, id: LayerId, area: Rect) {
|
||||
let (got, want) = (d.layer(id).unwrap().surface().unwrap(), plain.layer(id).unwrap().surface().unwrap());
|
||||
for y in (area.y0..area.y1).step_by(7) {
|
||||
for x in (area.x0..area.x1).step_by(7) {
|
||||
assert_eq!(got.rgba(x, y), want.rgba(x, y), "layer {id:?} at ({x},{y}) differs from the plain crop");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn named_one_step(s: &Session, past: usize, name: &str) {
|
||||
let st = s.active().unwrap();
|
||||
assert_eq!(st.history.past_len(), past + 1);
|
||||
assert_eq!(st.history.undo_label(), Some(name));
|
||||
}
|
||||
|
||||
fn undo_redo(s: &mut Session, before: &Document) {
|
||||
let after = doc(s).clone();
|
||||
s.execute("edit.undo", json!({})).unwrap();
|
||||
assert_eq!(doc(s), before);
|
||||
s.execute("edit.redo", json!({})).unwrap();
|
||||
assert_eq!(doc(s), &after);
|
||||
assert_eq!(s.active().unwrap().history.undo_label(), Some("Content-aware Crop"));
|
||||
}
|
||||
|
||||
/// Matches the three measured rows at their original size, bounds and sample points.
|
||||
#[test]
|
||||
fn measured_straight_rows_fill_background_and_only_the_active_raster() {
|
||||
for row in 0..3 {
|
||||
let (mut s, ids) = scene(false);
|
||||
let active = if row == 1 { ids.edge } else { ids.quads };
|
||||
if row == 2 {
|
||||
s.edit("Layer 0", |d, _| {
|
||||
let bg = d.layer_mut(ids.background).unwrap();
|
||||
bg.name = "Layer 0".into();
|
||||
bg.locks = Default::default();
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
select(&mut s, active);
|
||||
let before = doc(&s).clone();
|
||||
let p = frame(false);
|
||||
let plain = plain_control(&mut s, &p);
|
||||
let past = s.active().unwrap().history.past_len();
|
||||
crop(&mut s, p, true);
|
||||
let d = doc(&s);
|
||||
assert_eq!((d.size.width, d.size.height), (900, 500));
|
||||
let mut untouched = vec![ids.small, ids.hidden, ids.text];
|
||||
untouched.push(if row == 1 { ids.quads } else { ids.edge });
|
||||
if row == 2 {
|
||||
assert!(d.background().is_none());
|
||||
untouched.push(ids.background);
|
||||
} else {
|
||||
assert_eq!(d.layer(ids.background).unwrap().surface().unwrap().content_bounds(), Rect::new(0, 0, 900, 500));
|
||||
pixel(d, ids.background, 850, 400, WHITE);
|
||||
}
|
||||
let bounds = if row == 1 { Rect::new(600, 0, 900, 500) } else { Rect::new(0, 0, 900, 500) };
|
||||
assert_eq!(d.layer(active).unwrap().surface().unwrap().content_bounds(), bounds);
|
||||
pixel(d, active, 850, if row == 1 { 400 } else { 125 }, if row == 1 { BLUE } else { GREEN });
|
||||
// The fill adds pixels only where the crop uncovered the canvas: the active layer's own
|
||||
// pixels inside the old canvas are the plain crop's.
|
||||
covered_as_plain(d, &plain, active, Rect::new(0, 0, 800, 500));
|
||||
unchanged(d, &plain, &untouched);
|
||||
named_one_step(&s, past, "Content-aware Crop");
|
||||
undo_redo(&mut s, &before);
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks own-layer donors and exact non-target parity after rotation.
|
||||
#[test]
|
||||
fn turned_rows_sample_each_target_and_leave_other_layers_at_plain_crop() {
|
||||
let (x, y) = extension_sample(true);
|
||||
for row in 0..3 {
|
||||
let (mut s, ids) = scene(true);
|
||||
// Uniform donors isolate target selection from the existing turned-fill sampling policy.
|
||||
s.edit("Uniform Quads", |d, _| {
|
||||
let fmt = d.pixel_format();
|
||||
let bounds = d.bounds();
|
||||
d.layer_mut(ids.quads).unwrap().surface_mut().unwrap().fill_rect(bounds, &photocraft_raster::from_rgba(&fmt, GREEN));
|
||||
if row == 2 {
|
||||
d.layer_mut(ids.background).unwrap().locks = Default::default();
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
let active = if row == 1 { ids.edge } else { ids.quads };
|
||||
select(&mut s, active);
|
||||
let before = doc(&s).clone();
|
||||
let p = frame(true);
|
||||
let plain = plain_control(&mut s, &p);
|
||||
let past = s.active().unwrap().history.past_len();
|
||||
let mut p = p;
|
||||
p["contentAware"] = json!(true);
|
||||
s.execute("image.crop", p).unwrap_or_else(|error| panic!("turned row {row}, active {active:?}: {error}"));
|
||||
let d = doc(&s);
|
||||
pixel(d, active, x, y, if row == 1 { BLUE } else { GREEN });
|
||||
assert!(d.layer(active).unwrap().surface().unwrap().content_bounds().contains(x, y));
|
||||
let mut untouched = vec![ids.small, ids.hidden, ids.text, if row == 1 { ids.quads } else { ids.edge }];
|
||||
if row == 2 {
|
||||
untouched.push(ids.background);
|
||||
} else {
|
||||
pixel(d, ids.background, x, y, WHITE);
|
||||
}
|
||||
unchanged(d, &plain, &untouched);
|
||||
named_one_step(&s, past, "Content-aware Crop");
|
||||
undo_redo(&mut s, &before);
|
||||
}
|
||||
}
|
||||
|
||||
/// Selecting the Background leaves each other layer identical to its plain crop.
|
||||
#[test]
|
||||
fn background_active_is_not_a_second_target() {
|
||||
for turned in [false, true] {
|
||||
let (x, y) = extension_sample(turned);
|
||||
let (mut s, ids) = scene(turned);
|
||||
select(&mut s, ids.background);
|
||||
let p = frame(turned);
|
||||
let plain = plain_control(&mut s, &p);
|
||||
let past = s.active().unwrap().history.past_len();
|
||||
crop(&mut s, p, true);
|
||||
pixel(doc(&s), ids.background, x, y, WHITE);
|
||||
unchanged(doc(&s), &plain, &[ids.quads, ids.small, ids.edge, ids.hidden, ids.text]);
|
||||
named_one_step(&s, past, "Content-aware Crop");
|
||||
}
|
||||
}
|
||||
|
||||
/// Verifies Background-only fill for ineligible active layers and Delete Cropped Pixels off.
|
||||
#[test]
|
||||
fn unmeasured_active_targets_and_delete_off_keep_the_legacy_target() {
|
||||
for turned in [false, true] {
|
||||
let (x, y) = extension_sample(turned);
|
||||
for case in 0..10 {
|
||||
let (mut s, ids) = scene(turned);
|
||||
let active = match case {
|
||||
0 => ids.text,
|
||||
1 => ids.hidden,
|
||||
_ => ids.quads,
|
||||
};
|
||||
if (2..7).contains(&case) {
|
||||
s.edit("Lock active", |d, _| {
|
||||
assert!(d.layer_mut(active).unwrap().locks.set(["all", "pixels", "transparency", "position", "artboard"][case - 2], true));
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
if case >= 8 {
|
||||
s.edit("Group active", |d, _| {
|
||||
let i = d.layers.iter().position(|layer| layer.id == active).unwrap();
|
||||
let child = d.layers.remove(i);
|
||||
let mut group = Layer::group("Ancestor", vec![child]);
|
||||
if case == 8 {
|
||||
group.visible = false;
|
||||
} else {
|
||||
assert!(group.locks.set("pixels", true));
|
||||
}
|
||||
d.layers.insert(i, group);
|
||||
Ok(())
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
select(&mut s, active);
|
||||
let mut p = frame(turned);
|
||||
if case == 7 {
|
||||
p["deleteCroppedPixels"] = json!(false);
|
||||
}
|
||||
let plain = plain_control(&mut s, &p);
|
||||
crop(&mut s, p, true);
|
||||
pixel(doc(&s), ids.background, x, y, WHITE);
|
||||
unchanged(doc(&s), &plain, &[ids.quads, ids.small, ids.edge, ids.hidden, ids.text]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks the plain history name for interior crops and crops with synthesis disabled.
|
||||
#[test]
|
||||
fn no_fill_or_content_aware_off_keeps_the_crop_history_name() {
|
||||
for (p, aware, turned) in [
|
||||
(json!({"x":20,"y":20,"width":40,"height":30}), true, false),
|
||||
(json!({"x":20,"y":20,"width":40,"height":30,"angle":10}), true, true),
|
||||
(frame(false), false, false),
|
||||
(frame(true), false, true),
|
||||
] {
|
||||
let (mut s, ids) = scene(turned);
|
||||
select(&mut s, ids.quads);
|
||||
let past = s.active().unwrap().history.past_len();
|
||||
crop(&mut s, p, aware);
|
||||
named_one_step(&s, past, "Crop");
|
||||
}
|
||||
}
|
||||
|
||||
/// Gives exactly one target a strip of held pixels outside the original canvas.
|
||||
fn overhang_scene(held_active: bool) -> (Session, LayerId, LayerId) {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", json!({"width":64,"height":48,"background":"white"})).unwrap();
|
||||
s.execute("tools.setColors", json!({"background":"#ff00ff"})).unwrap();
|
||||
let (bg, active) = s
|
||||
.edit("Distinct hidden pixels", |d, active| {
|
||||
let bg = d.background().unwrap().id;
|
||||
let mut layer = raster(d, "Active", Rect::new(0, 0, 64, 48), GREEN);
|
||||
let fmt = d.pixel_format();
|
||||
let surf = if held_active { layer.surface_mut().unwrap() } else { d.layer_mut(bg).unwrap().surface_mut().unwrap() };
|
||||
surf.fill_rect(Rect::new(-16, 0, 0, 48), &photocraft_raster::from_rgba(&fmt, if held_active { BLUE } else { RED }));
|
||||
let id = layer.id;
|
||||
d.layers.push(layer);
|
||||
*active = Some(id);
|
||||
Ok((bg, id))
|
||||
})
|
||||
.unwrap();
|
||||
(s, bg, active)
|
||||
}
|
||||
|
||||
/// Confirms that held pixels protect only the layer that owned them before the turn.
|
||||
#[test]
|
||||
fn turned_hidden_overhang_coverage_belongs_to_each_layer() {
|
||||
for held_active in [false, true] {
|
||||
let (mut s, bg, active) = overhang_scene(held_active);
|
||||
crop(&mut s, json!({"x":-10,"y":14,"width":20,"height":20,"angle":45}), true);
|
||||
let mut held_pixels = 0;
|
||||
for y in 0..20 {
|
||||
for x in 0..20 {
|
||||
let (held, other, want) = if held_active { (active, bg, WHITE) } else { (bg, active, GREEN) };
|
||||
pixel(doc(&s), other, x, y, want);
|
||||
let px = doc(&s).layer(held).unwrap().surface().unwrap().rgba(x, y);
|
||||
let color = if held_active { BLUE } else { RED };
|
||||
held_pixels += usize::from(px.iter().zip(color).all(|(a, b)| (a - b).abs() < 0.06));
|
||||
}
|
||||
}
|
||||
assert!(held_pixels >= 100, "the target's own hidden pixels survive: {held_pixels}");
|
||||
}
|
||||
}
|
||||
|
||||
/// An empty active raster leaves the successful Background fill and undo step intact.
|
||||
#[test]
|
||||
fn donorless_added_target_keeps_the_background_fill() {
|
||||
for turned in [false, true] {
|
||||
let (x, y) = extension_sample(turned);
|
||||
let (mut s, ids) = scene(turned);
|
||||
let empty = s
|
||||
.edit("Empty target", |d, active| {
|
||||
let layer = Layer::raster("Empty", d.pixel_format());
|
||||
let id = layer.id;
|
||||
d.layers.push(layer);
|
||||
*active = Some(id);
|
||||
Ok(id)
|
||||
})
|
||||
.unwrap();
|
||||
assert_ne!(empty, ids.background);
|
||||
let before = doc(&s).clone();
|
||||
let p = frame(turned);
|
||||
let plain = plain_control(&mut s, &p);
|
||||
let past = s.active().unwrap().history.past_len();
|
||||
crop(&mut s, p, true);
|
||||
pixel(doc(&s), ids.background, x, y, WHITE);
|
||||
unchanged(doc(&s), &plain, &[empty, ids.quads, ids.small, ids.edge, ids.hidden, ids.text]);
|
||||
assert_eq!(s.active().unwrap().active_layer, Some(empty));
|
||||
named_one_step(&s, past, "Content-aware Crop");
|
||||
undo_redo(&mut s, &before);
|
||||
}
|
||||
}
|
||||
|
||||
/// Confirms both layers synthesize their own colours at every RGB depth.
|
||||
#[test]
|
||||
fn both_target_colours_remain_native_at_each_rgb_depth() {
|
||||
for depth in [8, 16, 32] {
|
||||
let mut s = Session::new();
|
||||
s.execute("file.new", json!({"width":32,"height":24,"depth":depth,"background":"white"})).unwrap();
|
||||
let (bg, active) = s
|
||||
.edit("Own colours", |d, active| {
|
||||
let bg = d.background().unwrap().id;
|
||||
let layer = raster(d, "Green", Rect::new(0, 0, 32, 24), GREEN);
|
||||
let id = layer.id;
|
||||
d.layers.push(layer);
|
||||
*active = Some(id);
|
||||
Ok((bg, id))
|
||||
})
|
||||
.unwrap();
|
||||
crop(&mut s, json!({"x":0,"y":0,"width":40,"height":24}), true);
|
||||
pixel(doc(&s), bg, 36, 12, WHITE);
|
||||
pixel(doc(&s), active, 36, 12, GREEN);
|
||||
}
|
||||
}
|
||||
@@ -13,15 +13,18 @@ mod atn_dialog_filters;
|
||||
mod atn_direct_adjustments;
|
||||
mod atn_layer_style;
|
||||
mod atn_newer_events;
|
||||
mod atn_perspective_warp;
|
||||
mod atn_reference_forms;
|
||||
mod atn_review_regressions;
|
||||
mod atn_ripple_amount;
|
||||
mod atn_selective_color;
|
||||
mod atn_shape_blur;
|
||||
mod atn_shear;
|
||||
mod atn_stack_modes;
|
||||
mod atn_stroke_width;
|
||||
mod atn_type_path;
|
||||
mod atn_v12;
|
||||
mod atn_video_frames;
|
||||
mod background_and_mask_depth;
|
||||
mod background_layer_consistency;
|
||||
mod brush_smoothing;
|
||||
@@ -35,6 +38,7 @@ mod convert_keeps_references;
|
||||
mod copy_shape_placement;
|
||||
mod corpus_atn;
|
||||
mod crop_content_aware;
|
||||
mod crop_content_aware_layers;
|
||||
mod crop_delete_off_background;
|
||||
mod current_affinity_artboards;
|
||||
mod duplicate_layer_comps;
|
||||
|
||||
@@ -38,7 +38,7 @@ const FILTER_ID: i32 = 1023;
|
||||
const NAME: &str = "Perspective Warp...";
|
||||
pub(super) const TEMPLATE_KEY: &str = "__perspectiveWarpPsd";
|
||||
/// Far more planes than anyone lays out by hand; bounds the corner linking (quadratic).
|
||||
const MAX_QUADS: usize = 256;
|
||||
pub const MAX_QUADS: usize = 256;
|
||||
const MAX_VERTICES: usize = 4 * MAX_QUADS;
|
||||
const MAX_TEMPLATE_BYTES: usize = 1 << 20;
|
||||
|
||||
@@ -74,29 +74,29 @@ fn quads(f: &Descriptor) -> Option<Vec<[usize; 4]>> {
|
||||
.map(|q| {
|
||||
let Value::Descriptor(q) = q else { return None };
|
||||
let Some(Value::List(ix)) = q.get("indices") else { return None };
|
||||
let ix: Vec<usize> = ix
|
||||
.iter()
|
||||
.map(|i| match i {
|
||||
Value::Integer(i) => usize::try_from(*i).ok(),
|
||||
_ => None,
|
||||
})
|
||||
.collect::<Option<_>>()?;
|
||||
ix.try_into().ok()
|
||||
let [Value::Integer(a), Value::Integer(b), Value::Integer(c), Value::Integer(d)] = ix.as_slice() else { return None };
|
||||
Some([usize::try_from(*a).ok()?, usize::try_from(*b).ok()?, usize::try_from(*c).ok()?, usize::try_from(*d).ok()?])
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The planes a `perspectiveWarpTransform` descriptor describes; `None` when it is inconsistent.
|
||||
fn planes_of(f: &Descriptor) -> Option<Vec<Plane>> {
|
||||
/// Reads the document-space planes and original corner indices from Perspective Warp geometry.
|
||||
/// Callers validate the enclosing descriptor and target according to the file format.
|
||||
pub fn indexed_geometry(f: &Descriptor) -> Option<(Vec<Plane>, Vec<[usize; 4]>)> {
|
||||
let (src, dst) = (points(f, "vertices")?, points(f, "warpedVertices")?);
|
||||
if src.len() != dst.len() {
|
||||
return None;
|
||||
}
|
||||
let corners =
|
||||
|list: &[[f64; 2]], q: &[usize; 4]| -> Option<[[f64; 2]; 4]> { Some([*list.get(q[0])?, *list.get(q[1])?, *list.get(q[2])?, *list.get(q[3])?]) };
|
||||
let planes: Vec<Plane> = quads(f)?.iter().map(|q| Some(Plane { src: corners(&src, q)?, dst: corners(&dst, q)? })).collect::<Option<_>>()?;
|
||||
let indices = quads(f)?;
|
||||
let planes: Vec<Plane> = indices.iter().map(|q| Some(Plane { src: corners(&src, q)?, dst: corners(&dst, q)? })).collect::<Option<_>>()?;
|
||||
PerspectiveMap::new(&planes)?;
|
||||
Some(planes)
|
||||
Some((planes, indices))
|
||||
}
|
||||
|
||||
fn planes_of(f: &Descriptor) -> Option<Vec<Plane>> {
|
||||
indexed_geometry(f).map(|(planes, _)| planes)
|
||||
}
|
||||
|
||||
/// `layer.smartObjects.perspectiveWarp` params for a Perspective Warp item.
|
||||
@@ -137,7 +137,8 @@ fn template(params: &J) -> Result<Option<Descriptor>, String> {
|
||||
/// The planes to write: as rendered, so a `straighten` is baked in.
|
||||
fn export_planes(params: &J) -> Result<Vec<Plane>, String> {
|
||||
let object = params.as_object().ok_or("Perspective Warp parameters must be an object")?;
|
||||
if let Some(k) = object.keys().find(|k| !super::is_meta(k) && !["planes", "straighten", "interpolation"].contains(&k.as_str())) {
|
||||
let supported = |k: &str| super::is_meta(k) || ["planes", "straighten", "interpolation"].contains(&k) || (k == "target" && params["target"] == "pixels");
|
||||
if let Some(k) = object.keys().find(|k| !supported(k)) {
|
||||
return Err(format!("Perspective Warp setting `{k}` has no PSD equivalent"));
|
||||
}
|
||||
let mut planes: Vec<Plane> =
|
||||
@@ -161,7 +162,7 @@ fn pnt(p: [f64; 2]) -> Value {
|
||||
|
||||
/// `vertices`, `warpedVertices` and `quads` for `planes`; a corner shared by several planes (same
|
||||
/// layout and warped position) is written once.
|
||||
fn geometry(planes: &[Plane]) -> (Value, Value, Value) {
|
||||
pub fn geometry(planes: &[Plane]) -> (Value, Value, Value) {
|
||||
let mut corners: Vec<([f64; 2], [f64; 2])> = Vec::new();
|
||||
let mut quads = Vec::with_capacity(planes.len());
|
||||
for p in planes {
|
||||
|
||||
@@ -51,6 +51,9 @@ mod hue_sat;
|
||||
mod perspective_warp;
|
||||
|
||||
pub use displace::{embed_map as displace_embed_map, embedded_map as displace_embedded_map, without_map as displace_without_map};
|
||||
pub use perspective_warp::{
|
||||
MAX_QUADS as MAX_PERSPECTIVE_WARP_PLANES, geometry as perspective_warp_geometry, indexed_geometry as perspective_warp_indexed_geometry,
|
||||
};
|
||||
|
||||
mod export;
|
||||
mod import;
|
||||
|
||||
@@ -313,6 +313,8 @@ impl PhotocraftApp {
|
||||
self.ui.selected_path = None;
|
||||
}
|
||||
self.path_document = document;
|
||||
// A shape box handle drag belongs to its document, revision and tool.
|
||||
crate::shape_bounds_box::cancel_stale(self);
|
||||
vector_ui::cancel_stale_pen(self);
|
||||
crate::direct_select::cancel_stale(self);
|
||||
canvas::cancel_stale_vector_drag(self);
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
//! The Artboard tool's Add New Artboard placing mode (#11386): with the mode on, a click on empty
|
||||
//! canvas puts a board of the bar's size with its top-left corner at the click.
|
||||
|
||||
use egui::Modifiers;
|
||||
use photocraft_geom::Rect;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::PhotocraftApp;
|
||||
use crate::canvas::{ToolEvent, tool_event};
|
||||
use crate::state::Tool;
|
||||
|
||||
/// The measured document: two boards, the 750 x 1334 one selected, the other one apart from it.
|
||||
fn app_with_selected_board() -> PhotocraftApp {
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 800, "height": 600, "background": "white"})).unwrap();
|
||||
app.run("layer.new.artboard", json!({"rect": [2000, 0, 300, 300]})).unwrap();
|
||||
app.run("layer.new.artboard", json!({"rect": [900, 0, 750, 1334]})).unwrap();
|
||||
app.sync_views();
|
||||
app.ui.extras.snap = false;
|
||||
app.ui.view.show.smart_guides = false;
|
||||
app.ui.tool = Tool::Artboard;
|
||||
app
|
||||
}
|
||||
|
||||
fn click(app: &mut PhotocraftApp, x: f64, y: f64) {
|
||||
let m = Modifiers::NONE;
|
||||
tool_event(app, ToolEvent::Down { x, y, pressure: 1.0 }, m);
|
||||
tool_event(app, ToolEvent::Up { x, y }, m);
|
||||
}
|
||||
|
||||
fn boards(app: &PhotocraftApp) -> Vec<Rect> {
|
||||
app.session.active().unwrap().doc.artboards().iter().map(|b| b.2.rect).collect()
|
||||
}
|
||||
|
||||
fn last_step(app: &PhotocraftApp) -> Option<String> {
|
||||
app.session.active().unwrap().history.entries().last().cloned()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_click_with_the_mode_on_puts_a_bar_sized_board_at_the_click() {
|
||||
let mut app = app_with_selected_board();
|
||||
app.ui.artboard_tool.adding = true;
|
||||
let before = boards(&app);
|
||||
click(&mut app, 222.0, 600.0);
|
||||
assert!(!app.ui.status_error, "{}", app.ui.status);
|
||||
let after = boards(&app);
|
||||
assert_eq!(after.len(), before.len() + 1);
|
||||
// 750 x 1334, top-left at the click, over the selected board (it did not move aside).
|
||||
assert_eq!(after.last().copied(), Some(Rect::new(222, 600, 972, 1934)));
|
||||
assert_eq!(after.get(..before.len()), Some(before.as_slice()));
|
||||
let st = app.session.active().unwrap();
|
||||
assert_eq!(st.doc.layers.last().map(|l| l.name.as_str()), Some("Artboard 3"));
|
||||
assert_eq!(st.active_layer, Some(st.doc.artboards().last().unwrap().0));
|
||||
assert_eq!(last_step(&app).as_deref(), Some("New Artboard"));
|
||||
// One undo step.
|
||||
app.run("edit.undo", json!({})).unwrap();
|
||||
assert_eq!(boards(&app), before);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_click_is_rounded_to_whole_pixels() {
|
||||
let mut app = app_with_selected_board();
|
||||
app.ui.artboard_tool.adding = true;
|
||||
click(&mut app, 222.4, 600.6);
|
||||
assert_eq!(boards(&app).last().copied(), Some(Rect::new(222, 601, 972, 1935)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_mode_stays_on_after_a_board_is_placed() {
|
||||
let mut app = app_with_selected_board();
|
||||
app.ui.artboard_tool.adding = true;
|
||||
click(&mut app, 222.0, 600.0);
|
||||
assert!(app.ui.artboard_tool.adding);
|
||||
// The next click is another placement, at the new selected board's size.
|
||||
click(&mut app, 3000.0, 100.0);
|
||||
assert_eq!(boards(&app).last().copied(), Some(Rect::new(3000, 100, 3750, 1434)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_click_with_the_mode_off_still_places_nothing() {
|
||||
let mut app = app_with_selected_board();
|
||||
let before = boards(&app);
|
||||
click(&mut app, 222.0, 600.0);
|
||||
assert_eq!(boards(&app), before);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn with_no_board_the_click_uses_the_canvas_size() {
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 800, "height": 600, "background": "white"})).unwrap();
|
||||
app.sync_views();
|
||||
app.ui.tool = Tool::Artboard;
|
||||
app.ui.artboard_tool.adding = true;
|
||||
click(&mut app, 40.0, 50.0);
|
||||
assert_eq!(boards(&app), vec![Rect::new(40, 50, 840, 650)]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_drag_with_the_mode_on_still_draws_the_dragged_board() {
|
||||
let mut app = app_with_selected_board();
|
||||
app.ui.artboard_tool.adding = true;
|
||||
let m = Modifiers::NONE;
|
||||
tool_event(&mut app, ToolEvent::Down { x: 20.0, y: 30.0, pressure: 1.0 }, m);
|
||||
tool_event(&mut app, ToolEvent::Move { x: 80.0, y: 70.0, pressure: 1.0 }, m);
|
||||
tool_event(&mut app, ToolEvent::Move { x: 120.0, y: 110.0, pressure: 1.0 }, m);
|
||||
tool_event(&mut app, ToolEvent::Up { x: 120.0, y: 110.0 }, m);
|
||||
assert_eq!(boards(&app).last().copied(), Some(Rect::new(20, 30, 120, 110)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_click_on_an_existing_board_selects_it_and_places_nothing() {
|
||||
let mut app = app_with_selected_board();
|
||||
app.ui.artboard_tool.adding = true;
|
||||
let before = boards(&app);
|
||||
click(&mut app, 2100.0, 100.0);
|
||||
assert_eq!(boards(&app), before);
|
||||
let st = app.session.active().unwrap();
|
||||
assert_eq!(st.active_layer, Some(st.doc.artboards()[0].0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn another_tool_turns_the_mode_off() {
|
||||
let mut app = app_with_selected_board();
|
||||
app.ui.artboard_tool.adding = true;
|
||||
assert_eq!(serde_json::to_value(&app.ui.artboard_tool).unwrap()["adding"], json!(true));
|
||||
app.ui.tool = Tool::Move;
|
||||
click(&mut app, 3000.0, 100.0);
|
||||
assert!(!app.ui.artboard_tool.adding);
|
||||
app.ui.tool = Tool::Artboard;
|
||||
let before = boards(&app);
|
||||
click(&mut app, 3000.0, 100.0);
|
||||
assert_eq!(boards(&app), before);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ui_inspect_reports_the_mode_on_and_off() {
|
||||
let ctx = egui::Context::default();
|
||||
let mut app = app_with_selected_board();
|
||||
let adding = |app: &mut PhotocraftApp| {
|
||||
let (req, _) = crate::control::ControlRequest::new("ui.inspect", json!({}));
|
||||
let crate::control::Outcome::Done(v) = crate::control::handle(app, &ctx, &req) else { panic!("inspect") };
|
||||
v["result"]["artboardTool"]["adding"].clone()
|
||||
};
|
||||
assert_eq!(adding(&mut app), json!(false));
|
||||
app.ui.artboard_tool.adding = true;
|
||||
assert_eq!(adding(&mut app), json!(true));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn selecting_another_tool_and_coming_back_leaves_the_mode_off() {
|
||||
let mut app = app_with_selected_board();
|
||||
app.ui.artboard_tool.adding = true;
|
||||
// Both changes in one pass, with no pointer or options-bar call between them.
|
||||
crate::tool_memory::select(&mut app, Tool::Move);
|
||||
crate::tool_memory::select(&mut app, Tool::Artboard);
|
||||
assert!(!app.ui.artboard_tool.adding);
|
||||
let before = boards(&app);
|
||||
click(&mut app, 222.0, 600.0);
|
||||
assert_eq!(boards(&app), before);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_add_new_artboard_button_toggles_the_mode_and_adds_no_board() {
|
||||
use egui_kittest::Harness;
|
||||
use egui_kittest::kittest::Queryable;
|
||||
|
||||
let mut app = app_with_selected_board();
|
||||
app.ui.tool = Tool::Artboard;
|
||||
let before = boards(&app);
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1400.0, 200.0)).build_ui_state(
|
||||
|ui, app: &mut PhotocraftApp| {
|
||||
if ui.ctx().fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
crate::panels::options_bar(app, ui);
|
||||
}
|
||||
},
|
||||
app,
|
||||
);
|
||||
PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::Pro);
|
||||
h.run_steps(4);
|
||||
assert!(!h.state().ui.artboard_tool.adding);
|
||||
h.get_by_label("Add New Artboard").click();
|
||||
h.run_steps(4);
|
||||
assert!(h.state().ui.artboard_tool.adding, "the first click turns the mode on");
|
||||
assert_eq!(boards(h.state()), before);
|
||||
h.get_by_label("Add New Artboard").click();
|
||||
h.run_steps(4);
|
||||
assert!(!h.state().ui.artboard_tool.adding, "the second click turns it off");
|
||||
assert_eq!(boards(h.state()), before);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_tool_shortcuts_away_and_back_leave_the_mode_off() {
|
||||
let mut app = app_with_selected_board();
|
||||
app.ui.artboard_tool.adding = true;
|
||||
let ctx = egui::Context::default();
|
||||
let press = |app: &mut PhotocraftApp, modifiers| {
|
||||
let key = egui::Key::V;
|
||||
let raw = egui::RawInput {
|
||||
events: vec![
|
||||
egui::Event::ModifiersChanged(modifiers),
|
||||
egui::Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers },
|
||||
egui::Event::Key { key, physical_key: None, pressed: false, repeat: false, modifiers },
|
||||
],
|
||||
..Default::default()
|
||||
};
|
||||
ctx.begin_pass(raw);
|
||||
crate::shortcuts::handle(app, &ctx);
|
||||
ctx.end_pass().textures_delta.clear();
|
||||
};
|
||||
// Shift+V leaves the Artboard tool for Move, and Shift+V again comes back, with no pointer or options-bar call between.
|
||||
press(&mut app, Modifiers::SHIFT);
|
||||
assert_eq!(app.ui.tool, Tool::Move);
|
||||
press(&mut app, Modifiers::SHIFT);
|
||||
assert_eq!(app.ui.tool, Tool::Artboard);
|
||||
assert!(!app.ui.artboard_tool.adding);
|
||||
let before = boards(&app);
|
||||
click(&mut app, 222.0, 600.0);
|
||||
assert_eq!(boards(&app), before);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//! The Artboard tool's first drag takes the Background in as "Layer 0" (#11387): the drag over
|
||||
//! the measured 800 x 600 document gives Artboard 1 (holding Layer 0) and Red at the top level.
|
||||
|
||||
use egui::Modifiers;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::PhotocraftApp;
|
||||
use crate::canvas::{ToolEvent, tool_event};
|
||||
use crate::state::Tool;
|
||||
|
||||
#[test]
|
||||
fn the_tools_first_drag_moves_the_background_into_the_board() {
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 800, "height": 600, "background": "white"})).unwrap();
|
||||
app.run("layer.new.layer", json!({"name": "Red"})).unwrap();
|
||||
app.run("select.rect", json!({"x": 100, "y": 100, "width": 200, "height": 150})).unwrap();
|
||||
app.run("edit.fill", json!({"color": "#ff0000"})).unwrap();
|
||||
app.run("select.deselect", json!({})).unwrap();
|
||||
app.ui.tool = Tool::Artboard;
|
||||
let m = Modifiers::NONE;
|
||||
tool_event(&mut app, ToolEvent::Down { x: 400.0, y: 300.0, pressure: 1.0 }, m);
|
||||
tool_event(&mut app, ToolEvent::Move { x: 500.0, y: 400.0, pressure: 1.0 }, m);
|
||||
tool_event(&mut app, ToolEvent::Move { x: 600.0, y: 500.0, pressure: 1.0 }, m);
|
||||
tool_event(&mut app, ToolEvent::Up { x: 600.0, y: 500.0 }, m);
|
||||
assert!(!app.ui.status_error, "{}", app.ui.status);
|
||||
let st = app.session.active().unwrap();
|
||||
let top: Vec<&str> = st.doc.layers.iter().map(|l| l.name.as_str()).collect();
|
||||
assert_eq!(top, ["Red", "Artboard 1"]);
|
||||
assert!(st.doc.background().is_none());
|
||||
let board = st.doc.layers.last().unwrap();
|
||||
let kids: Vec<&str> = board.children().unwrap().iter().map(|l| l.name.as_str()).collect();
|
||||
assert_eq!(kids, ["Layer 0"]);
|
||||
assert_eq!((st.doc.size.width, st.doc.size.height), (800, 600));
|
||||
assert_eq!(st.history.entries().last().map(String::as_str), Some("New Artboard"));
|
||||
}
|
||||
@@ -45,7 +45,7 @@ mod selection;
|
||||
pub mod snap_ui;
|
||||
mod start_screen;
|
||||
mod strokes;
|
||||
mod tabs;
|
||||
pub(crate) mod tabs;
|
||||
mod textures;
|
||||
pub(super) mod tile_overlay;
|
||||
pub mod tool_cursor;
|
||||
@@ -1422,6 +1422,9 @@ fn draw_canvas_tool_cursor(app: &mut PhotocraftApp, ui: &mut egui::Ui, input: &C
|
||||
// corner badge, as Photoshop's corner radius cursor.
|
||||
ui.ctx().set_cursor_icon(egui::CursorIcon::Default);
|
||||
crate::icons::cursor_badge(ctx, "scan", p);
|
||||
} else if let Some(c) = response.hover_pos().and_then(|p| crate::shape_bounds_box::cursor(app, xf, xf.to_doc(p))) {
|
||||
// Over a handle of the box round several selected shapes: its scale cursor.
|
||||
ui.ctx().set_cursor_icon(c);
|
||||
} else if let Some((r, p, c)) =
|
||||
response.hover_pos().and_then(|p| transform_controls_rect(app, xf).and_then(|r| transform_controls_cursor(r, p).map(|c| (r, p, c))))
|
||||
{
|
||||
|
||||
@@ -184,9 +184,9 @@ const ENDS_TYPE_EDIT: [&str; 5] =
|
||||
pub const PASTEBOARD_PICK: &str = "pasteboard.selectCustomColor";
|
||||
|
||||
/// The guide menu's Edit Selected Guides row: New Guide's dialog on the selected guide.
|
||||
pub const GUIDE_EDIT: &str = "guides.editSelected";
|
||||
pub const GUIDE_EDIT: &str = "view.editSelectedGuides";
|
||||
/// The guide menu's Clear Selected Guides row.
|
||||
pub const GUIDE_CLEAR: &str = "guides.clearSelected";
|
||||
pub const GUIDE_CLEAR: &str = "view.clearSelectedGuides";
|
||||
|
||||
/// Photoshop's guide menu (right-click on a guide), in its order. Its two Selected Guides rows act
|
||||
/// on the guide the right-click selected; the rest are the View menu's.
|
||||
@@ -753,14 +753,9 @@ pub fn open_guide(app: &mut PhotocraftApp, ctx: &Context, tool: Tool, mods: egui
|
||||
true
|
||||
}
|
||||
|
||||
/// A guide row: the two Selected Guides rows act on the selected guide; the rest are the View
|
||||
/// menu's commands.
|
||||
/// A guide row: every row is a View › Guides command, the two Selected Guides ones included.
|
||||
fn choose_guide(app: &mut PhotocraftApp, ctx: &Context, command: &str) -> Result<(), String> {
|
||||
match command {
|
||||
GUIDE_EDIT => crate::new_guide_ui::open_edit(app).map(|_| ()),
|
||||
GUIDE_CLEAR => crate::guide_select::delete_selected(app).map(|_| ()),
|
||||
_ => crate::menus::invoke(app, ctx, command, json!({})).map(|_| ()),
|
||||
}
|
||||
crate::menus::invoke(app, ctx, command, json!({})).map(|_| ())
|
||||
}
|
||||
|
||||
/// A pasteboard row: set the colour, or open the Color Picker on the custom one.
|
||||
|
||||
@@ -37,6 +37,10 @@ pub struct Drag {
|
||||
/// Freeform Pen and Path Selection gestures belong to their source document and target.
|
||||
pub(super) vector_owner: Option<VectorGestureOwner>,
|
||||
pub(super) pen_owner: Option<crate::vector_ui::PenOwner>,
|
||||
/// The document had a selection (one with content) when the drag was pressed. A modifier held
|
||||
/// at the press picks the selection mode only then; without one it constrains the shape from
|
||||
/// the first move (#11389). `true` until recorded, which keeps that rule for drags that don't.
|
||||
pub selection_at_press: bool,
|
||||
}
|
||||
|
||||
impl Drag {
|
||||
@@ -58,9 +62,16 @@ impl Drag {
|
||||
lasso: None,
|
||||
vector_owner: None,
|
||||
pen_owner: None,
|
||||
selection_at_press: true,
|
||||
}
|
||||
}
|
||||
|
||||
/// Record whether the document has a selection at the press; an empty one counts as none, as
|
||||
/// `tool_feedback::document_selection_mode` counts it (#11389).
|
||||
pub(crate) fn capture_selection_at_press(&mut self, app: &PhotocraftApp) {
|
||||
self.selection_at_press = app.session.active().and_then(|st| st.doc.selection.as_ref()).is_some_and(|s| !s.content_bounds().is_empty());
|
||||
}
|
||||
|
||||
/// Vector drags capture their owner at the press, the Freeform Pen also its destination, before
|
||||
/// later ⌥-clicks or a temporary Direct Selection can finish them.
|
||||
pub(crate) fn capture_vector_owners(&mut self, app: &PhotocraftApp) {
|
||||
@@ -96,13 +107,22 @@ impl Drag {
|
||||
self.released.alt |= !mods.alt;
|
||||
}
|
||||
|
||||
/// ⇧ (square / circle) and ⌥ (from the centre) for a marquee drag. A modifier held at the press
|
||||
/// picks the selection mode instead (add / subtract, #188) until it is released and pressed
|
||||
/// again, as in Photoshop.
|
||||
/// ⇧ (square / circle) and ⌥ (from the centre) for a marquee drag. With a selection at the
|
||||
/// press, a modifier held at the press picks the selection mode instead (add / subtract, #188)
|
||||
/// until it is released and pressed again, as in Photoshop; without one it constrains the
|
||||
/// shape from the first move (#11389).
|
||||
pub fn marquee_mods(&self) -> (bool, bool) {
|
||||
let fresh = |now: bool, at_press: bool, released: bool| now && (!at_press || released);
|
||||
let picks_mode = self.selection_at_press;
|
||||
let fresh = |now: bool, at_press: bool, released: bool| now && (!at_press || released || !picks_mode);
|
||||
(fresh(self.live.shift, self.modifiers.shift, self.released.shift), fresh(self.live.alt, self.modifiers.alt, self.released.alt))
|
||||
}
|
||||
|
||||
/// ⇧ held since the press with no selection: the square takes the drag's shorter side, as the
|
||||
/// reference application does (a 200 × 100 drag selects 100 × 100, #11389). ⇧ pressed during
|
||||
/// the drag keeps the longer side (not measured, so as before).
|
||||
fn square_from_press(&self) -> bool {
|
||||
!self.selection_at_press && self.modifiers.shift && !self.released.shift && self.live.shift
|
||||
}
|
||||
}
|
||||
|
||||
/// The marquee dragged from `d.start` to `end` as two document-space corners: the options-bar
|
||||
@@ -117,7 +137,13 @@ pub fn marquee_corners(o: &crate::state::ToolOptions, d: &Drag, end: [f64; 2]) -
|
||||
let a = if alt { [end[0] - w / 2.0, end[1] - h / 2.0] } else { end };
|
||||
return (a, [a[0] + w, a[1] + h]);
|
||||
}
|
||||
let e = crate::chrome_ui::marquee_end(&o.marquee_style, o.marquee_width as f64, o.marquee_height as f64, shift, d.start, end);
|
||||
let e = if shift && d.square_from_press() && !matches!(o.marquee_style.as_str(), "fixedRatio" | "fixedSize") {
|
||||
let (dx, dy) = (end[0] - d.start[0], end[1] - d.start[1]);
|
||||
let m = dx.abs().min(dy.abs());
|
||||
[d.start[0] + m.copysign(dx), d.start[1] + m.copysign(dy)]
|
||||
} else {
|
||||
crate::chrome_ui::marquee_end(&o.marquee_style, o.marquee_width as f64, o.marquee_height as f64, shift, d.start, end)
|
||||
};
|
||||
if !alt {
|
||||
return (d.start, e);
|
||||
}
|
||||
|
||||
@@ -209,6 +209,8 @@ pub(crate) fn selection_mode(app: &PhotocraftApp, m: egui::Modifiers) -> &'stati
|
||||
|
||||
/// Shift constrains a Polygonal Lasso segment to Photoshop's 45° directions.
|
||||
/// Work in document coordinates so zoom, view rotation and mirroring cannot skew it.
|
||||
/// A diagonal keeps the shorter of the two offsets on both axes, as Photoshop does (#11393);
|
||||
/// a horizontal or vertical snap keeps the segment's length.
|
||||
pub(crate) fn constrained_polygon_point(from: [f64; 2], point: [f64; 2]) -> [f64; 2] {
|
||||
let dx = point[0] - from[0];
|
||||
let dy = point[1] - from[1];
|
||||
@@ -219,7 +221,12 @@ pub(crate) fn constrained_polygon_point(from: [f64; 2], point: [f64; 2]) -> [f64
|
||||
if length == 0.0 {
|
||||
return point;
|
||||
}
|
||||
let angle = (dy.atan2(dx) / std::f64::consts::FRAC_PI_4).round() * std::f64::consts::FRAC_PI_4;
|
||||
let octant = (dy.atan2(dx) / std::f64::consts::FRAC_PI_4).round();
|
||||
let angle = octant * std::f64::consts::FRAC_PI_4;
|
||||
if octant.rem_euclid(2.0) == 1.0 {
|
||||
let m = dx.abs().min(dy.abs());
|
||||
return [from[0] + m * angle.cos().signum(), from[1] + m * angle.sin().signum()];
|
||||
}
|
||||
[from[0] + length * angle.cos(), from[1] + length * angle.sin()]
|
||||
}
|
||||
|
||||
@@ -294,7 +301,7 @@ pub fn commit_polygon(app: &mut PhotocraftApp) {
|
||||
if pts.len() >= 3 {
|
||||
let mode = if mode.is_empty() { selection_mode(app, egui::Modifiers::NONE).to_owned() } else { mode };
|
||||
let o = &app.ui.tool_options;
|
||||
let _ = app.run("select.lasso", json!({"points": pts, "mode": mode, "antiAlias": o.anti_alias, "feather": o.feather}));
|
||||
let _ = app.run("select.lasso", json!({"points": pts, "mode": mode, "antiAlias": o.anti_alias, "feather": o.feather, "polygonal": true}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,9 +36,19 @@ pub(crate) fn moves_selected_pixels_with(app: &PhotocraftApp, tool: Tool) -> boo
|
||||
/// time, or with `copy` (⌥) floats a duplicate and leaves them; `copy` on a piece already floating
|
||||
/// drops it where it is and floats a copy of it. False when it failed (reported in the status bar).
|
||||
pub(crate) fn float_selected(app: &mut PhotocraftApp, copy: bool, dx: f64, dy: f64) -> bool {
|
||||
float_selected_as(app, copy, dx, dy, None)
|
||||
}
|
||||
|
||||
/// The start of a Move-tool drag of the selected pixels. An ⌥-drag copy is one "Duplicate" step,
|
||||
/// as in Photoshop (#11383); a plain drag is "Move".
|
||||
pub(crate) fn float_selected_for_drag(app: &mut PhotocraftApp, copy: bool) -> bool {
|
||||
float_selected_as(app, copy, 0.0, 0.0, copy.then(|| tl!("Duplicate")))
|
||||
}
|
||||
|
||||
fn float_selected_as(app: &mut PhotocraftApp, copy: bool, dx: f64, dy: f64, step_name: Option<&str>) -> bool {
|
||||
let floating = app.session.active().is_some_and(|st| photocraft_engine::float_cmds::floating(st).is_some());
|
||||
let dropped = if copy && floating { app.run("select.drop", json!({})) } else { Ok(json!(null)) };
|
||||
match dropped.and_then(|_| app.run("select.float", json!({"dx": dx, "dy": dy, "copy": copy}))) {
|
||||
match dropped.and_then(|_| app.run("select.float", json!({"dx": dx, "dy": dy, "copy": copy, "stepName": step_name}))) {
|
||||
Ok(_) => {
|
||||
crate::snap_ui::follow_cut(app);
|
||||
true
|
||||
|
||||
@@ -96,7 +96,7 @@ pub(super) fn finish_selection_drag(app: &mut PhotocraftApp, floating: bool, sta
|
||||
(false, true) if app.session.is_enabled("select.deselect") => app.run("select.deselect", json!({})),
|
||||
(false, true) => return,
|
||||
(true, false) => app.run("select.float", json!({"dx": dx, "dy": dy})),
|
||||
(false, false) => app.run("select.transformSelection", json!({"dx": dx, "dy": dy})),
|
||||
(false, false) => app.run("select.transformSelection", json!({"dx": dx, "dy": dy, "stepName": "Move Selection"})),
|
||||
};
|
||||
if let Err(e) = r {
|
||||
app.ui.status = e;
|
||||
|
||||
@@ -327,25 +327,39 @@ fn tab_close_clicked(resp: &egui::Response, xresp: &egui::Response) -> bool {
|
||||
xresp.clicked() || xresp.middle_clicked() || resp.middle_clicked()
|
||||
}
|
||||
|
||||
/// All tab actions go through the same guarded File commands as the menu bar, including the
|
||||
/// Rows of the document tab menu after which a separator is drawn: after Move to New Window and
|
||||
/// after Open Document…, as in the reference (#11403).
|
||||
pub(crate) const TAB_MENU_SEPARATORS_AFTER: [usize; 2] = [4, 6];
|
||||
|
||||
pub(crate) type TabMenuItem = (&'static str, &'static str, serde_json::Value, bool);
|
||||
|
||||
/// All tab actions go through the same guarded commands as the menu bar, including the
|
||||
/// unsaved-changes prompt. The clicked tab is explicit even when another document is active.
|
||||
pub(super) fn tab_context_items(index: usize, count: usize, has_path: bool) -> [(&'static str, &'static str, serde_json::Value, bool); 4] {
|
||||
/// Order and separators follow the reference application (#11403); see [`TAB_MENU_SEPARATORS_AFTER`].
|
||||
pub(crate) fn tab_context_items(index: usize, count: usize, has_path: bool) -> [TabMenuItem; 8] {
|
||||
[
|
||||
("Consolidate All to Here", "window.arrange.consolidateAllToTabs", json!({}), count > 1),
|
||||
("Close", "file.close", json!({"document": index}), true),
|
||||
("Close Others", "file.closeOthers", json!({"document": index}), count > 1),
|
||||
("Close All", "file.closeAll", json!({}), true),
|
||||
("Close Others", "file.closeOthers", json!({"document": index}), count > 1),
|
||||
("Move to New Window", "window.arrange.floatInWindow", json!({"document": index}), true),
|
||||
("New Document…", "file.new", json!({}), true),
|
||||
("Open Document…", "file.open", json!({}), true),
|
||||
(crate::menus::reveal_label(), "file.revealInFinder", json!({"document": index}), has_path),
|
||||
]
|
||||
}
|
||||
|
||||
fn tab_context_menu(ui: &mut egui::Ui, index: usize, count: usize, has_path: bool) -> Option<(&'static str, serde_json::Value)> {
|
||||
pub(crate) fn tab_context_menu(ui: &mut egui::Ui, index: usize, count: usize, has_path: bool) -> Option<(&'static str, serde_json::Value)> {
|
||||
crate::widgets::menu_scroll(ui, |ui| {
|
||||
ui.set_min_width(170.0);
|
||||
for (label, id, params, enabled) in tab_context_items(index, count, has_path) {
|
||||
for (row, (label, id, params, enabled)) in tab_context_items(index, count, has_path).into_iter().enumerate() {
|
||||
if ui.add_enabled(enabled, egui::Button::new(tl!(label))).clicked() {
|
||||
ui.close();
|
||||
return Some((id, params));
|
||||
}
|
||||
if TAB_MENU_SEPARATORS_AFTER.contains(&row) {
|
||||
ui.separator();
|
||||
}
|
||||
}
|
||||
None
|
||||
})
|
||||
|
||||
@@ -935,20 +935,38 @@ fn navigator_damage_updates_match_a_full_thumbnail() {
|
||||
#[test]
|
||||
fn tab_context_uses_clicked_document_and_existing_close_commands() {
|
||||
let items = tab_context_items(2, 3, true);
|
||||
assert_eq!(items.iter().map(|(_, id, _, _)| *id).collect::<Vec<_>>(), ["file.close", "file.closeOthers", "file.closeAll", "file.revealInFinder"]);
|
||||
assert_eq!(items[0].2, json!({"document": 2}));
|
||||
assert_eq!(
|
||||
items.iter().map(|(_, id, _, _)| *id).collect::<Vec<_>>(),
|
||||
[
|
||||
"window.arrange.consolidateAllToTabs",
|
||||
"file.close",
|
||||
"file.closeAll",
|
||||
"file.closeOthers",
|
||||
"window.arrange.floatInWindow",
|
||||
"file.new",
|
||||
"file.open",
|
||||
"file.revealInFinder"
|
||||
]
|
||||
);
|
||||
assert_eq!(items[1].2, json!({"document": 2}));
|
||||
assert_eq!(items[2].2, json!({}));
|
||||
assert_eq!(items[3].2, json!({"document": 2}));
|
||||
assert!(items[3].3, "a saved document can be revealed in the file manager");
|
||||
assert!(!tab_context_items(2, 3, false)[3].3, "an unsaved document cannot");
|
||||
assert!(!tab_context_items(0, 1, false)[1].3);
|
||||
assert!(items.iter().all(|(_, id, _, _)| photocraft_engine::commands::find(id).is_some()));
|
||||
assert_eq!(items[2].2, json!({}));
|
||||
assert_eq!(items[7].2, json!({"document": 2}));
|
||||
assert!(items[7].3, "a saved document can be revealed in the file manager");
|
||||
assert!(!tab_context_items(2, 3, false)[7].3, "an unsaved document cannot");
|
||||
assert!(!tab_context_items(0, 1, false)[3].3);
|
||||
// The window.* rows and file.new / file.open are UI commands; the doc_tab_menu tests check them.
|
||||
assert!(
|
||||
items
|
||||
.iter()
|
||||
.filter(|r| r.1.starts_with("file.close") || r.1 == "file.revealInFinder")
|
||||
.all(|(_, id, _, _)| photocraft_engine::commands::find(id).is_some())
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tab_context_reveal_names_the_platform_file_manager() {
|
||||
let (label, id, _, _) = &tab_context_items(0, 1, true)[3];
|
||||
let (label, id, _, _) = &tab_context_items(0, 1, true)[7];
|
||||
assert_eq!((*label, *id), (crate::menus::reveal_label(), "file.revealInFinder"));
|
||||
}
|
||||
|
||||
@@ -1099,7 +1117,7 @@ fn tab_close_others_prompts_for_unsaved_nonactive_document() {
|
||||
app.run("file.new", json!({"width": 8, "height": 8, "name": "Edited"})).unwrap();
|
||||
app.run("edit.fill", json!({"color": "#ff0000"})).unwrap();
|
||||
assert_eq!(app.session.active_index(), Some(1));
|
||||
let (_, id, params, _) = tab_context_items(0, 2, false)[1].clone();
|
||||
let (_, id, params, _) = tab_context_items(0, 2, false)[3].clone();
|
||||
crate::menus::invoke(&mut app, &egui::Context::default(), id, params).unwrap();
|
||||
assert!(app.discard.is_some(), "close others must ask before discarding the edited tab");
|
||||
assert_eq!(app.session.documents().len(), 2);
|
||||
|
||||
@@ -166,6 +166,11 @@ fn filter_event_before_tool(app: &mut PhotocraftApp, ev: ToolEvent, mods: egui::
|
||||
if crate::corner_radius::pointer(app, raw, mods) {
|
||||
return None;
|
||||
}
|
||||
// The box round several selected shape layers: its handles scale them (Path Selection and the
|
||||
// shape tools).
|
||||
if crate::shape_bounds_box::pointer(app, raw, mods) {
|
||||
return None;
|
||||
}
|
||||
// Direct Selection, and the Pen's ⌘ (Direct Selection) and ⌥ (Convert Point) modes (#790).
|
||||
if crate::direct_select::pointer(app, ev, mods) {
|
||||
return None;
|
||||
@@ -282,7 +287,7 @@ fn handle_move_pointer(app: &mut PhotocraftApp, ev: ToolEvent, tool: Tool, mods:
|
||||
// With a selection: cut the selected pixels (⌥ copies them) and drag them as a floating
|
||||
// piece, from anywhere, as a marquee ⌘-drag does.
|
||||
if crate::move_ui::moves_selected_pixels_with(app, tool) {
|
||||
if crate::move_ui::float_selected(app, mods.alt, 0.0, 0.0) {
|
||||
if crate::move_ui::float_selected_for_drag(app, mods.alt) {
|
||||
let mut d = Drag::new(tool, [x, y], vec![[x, y, pressure as f64]], mods, false);
|
||||
d.sel_move = Some(true);
|
||||
app.drag = Some(d);
|
||||
@@ -521,6 +526,7 @@ pub fn tool_event(app: &mut PhotocraftApp, ev: ToolEvent, mods: egui::Modifiers)
|
||||
let tool = crate::retouch_ui::alt_flipped(tool, mods.alt);
|
||||
let mut drag = Drag { clear, ..Drag::new(tool, from.map_or([x, y], |p| [p[0], p[1]]), points, mods, erase) };
|
||||
drag.capture_vector_owners(app);
|
||||
drag.capture_selection_at_press(app);
|
||||
app.drag = Some(drag);
|
||||
app.trail = None;
|
||||
app.stylus.begin_stroke();
|
||||
|
||||
@@ -35,6 +35,7 @@ pub fn inspect(app: &PhotocraftApp, ctx: &egui::Context) -> Value {
|
||||
"memory": photocraft_raster::memory::stats(),
|
||||
"tool": app.ui.tool,
|
||||
"toolOptions": app.ui.tool_options,
|
||||
"artboardTool": app.ui.artboard_tool,
|
||||
"perspectiveCrop": app.ui.perspective_crop,
|
||||
"strokeEditor": app.ui.stroke_editor,
|
||||
"magnetic": app.ui.magnetic,
|
||||
|
||||
@@ -1408,6 +1408,11 @@ pub fn keys(app: &mut PhotocraftApp, ctx: &egui::Context) {
|
||||
w.pick(t);
|
||||
}
|
||||
}
|
||||
// E cycles the tool mode (add, subtract); Hand and Zoom edit nothing, so it leaves them alone.
|
||||
let bare_e = ctx.input(|i| i.events.iter().any(|e| matches!(e, egui::Event::Key { key: Key::E, pressed: true, modifiers, .. } if modifiers.is_none())));
|
||||
if bare_e && w.tool.edits() && pressed(Key::E, Modifiers::NONE) {
|
||||
w.add = !w.add;
|
||||
}
|
||||
if pressed(Key::OpenBracket, Modifiers::NONE) {
|
||||
let s = w.size();
|
||||
w.set_size((s * 0.9).min(s - 1.0));
|
||||
@@ -1973,5 +1978,7 @@ pub fn show(app: &mut PhotocraftApp, ctx: &egui::Context) {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod cycle_tool_mode_tests;
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
@@ -0,0 +1,158 @@
|
||||
use super::*;
|
||||
use egui::{Key, Modifiers};
|
||||
|
||||
fn opened() -> PhotocraftApp {
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default());
|
||||
app.session.execute("file.new", json!({"width": 160, "height": 100, "depth": 8})).unwrap();
|
||||
app.session.execute("select.rect", json!({"x": 0, "y": 0, "width": 20, "height": 20})).unwrap();
|
||||
app.session.prefs.edit(|p| {
|
||||
p.dialogs.remove(REMEMBERED);
|
||||
});
|
||||
app.sync_views();
|
||||
open(&mut app).unwrap();
|
||||
app
|
||||
}
|
||||
|
||||
fn ws(app: &PhotocraftApp) -> &SelectMaskWorkspace {
|
||||
app.distort.select_mask.as_ref().unwrap()
|
||||
}
|
||||
|
||||
fn ui_selected(app: &mut PhotocraftApp) -> u64 {
|
||||
control(app, &json!({"waitPreview": true})).unwrap()["selectedProxyPixels"].as_u64().unwrap()
|
||||
}
|
||||
|
||||
fn press(app: &mut PhotocraftApp, ctx: &egui::Context, key: Key, modifiers: Modifiers) {
|
||||
let ev = egui::Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers };
|
||||
let input = egui::RawInput { events: vec![ev], ..Default::default() };
|
||||
ctx.run_ui(input, |ui| keys(app, ui.ctx())).textures_delta.clear();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn e_switches_between_add_and_subtract_and_back() {
|
||||
let mut app = opened();
|
||||
let ctx = egui::Context::default();
|
||||
assert!(ws(&app).add);
|
||||
press(&mut app, &ctx, Key::E, Modifiers::NONE);
|
||||
assert!(!ws(&app).add);
|
||||
assert_eq!(ws(&app).describe()["mode"].as_str(), Some("subtract"));
|
||||
press(&mut app, &ctx, Key::E, Modifiers::NONE);
|
||||
assert!(ws(&app).add);
|
||||
assert_eq!(ws(&app).describe()["mode"].as_str(), Some("add"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn e_works_with_every_editing_tool_and_keeps_the_tool() {
|
||||
let ctx = egui::Context::default();
|
||||
for tool in [SmTool::Quick, SmTool::RefineEdge, SmTool::Brush, SmTool::Object, SmTool::Lasso, SmTool::PolygonalLasso] {
|
||||
let mut app = opened();
|
||||
app.distort.select_mask.as_mut().unwrap().pick(tool);
|
||||
press(&mut app, &ctx, Key::E, Modifiers::NONE);
|
||||
assert!(!ws(&app).add, "{tool:?}");
|
||||
assert_eq!(ws(&app).tool, tool);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn e_does_nothing_with_hand_or_zoom() {
|
||||
let ctx = egui::Context::default();
|
||||
for tool in [SmTool::Hand, SmTool::Zoom] {
|
||||
let mut app = opened();
|
||||
app.distort.select_mask.as_mut().unwrap().pick(tool);
|
||||
press(&mut app, &ctx, Key::E, Modifiers::NONE);
|
||||
assert!(ws(&app).add, "{tool:?}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn e_with_command_alt_or_shift_does_nothing_new() {
|
||||
let ctx = egui::Context::default();
|
||||
for m in [Modifiers::COMMAND, Modifiers::ALT, Modifiers::SHIFT, Modifiers::CTRL] {
|
||||
let mut app = opened();
|
||||
press(&mut app, &ctx, Key::E, m);
|
||||
assert!(ws(&app).add, "{m:?}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn e_is_ignored_while_a_popup_has_the_keys() {
|
||||
let mut app = opened();
|
||||
let ctx = egui::Context::default();
|
||||
ctx.run_ui(egui::RawInput::default(), |ui| {
|
||||
egui::Popup::open_id(ui.ctx(), egui::Id::unique("sm-test-popup"));
|
||||
})
|
||||
.textures_delta
|
||||
.clear();
|
||||
assert!(egui::Popup::is_any_open(&ctx));
|
||||
press(&mut app, &ctx, Key::E, Modifiers::NONE);
|
||||
assert!(ws(&app).add);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn e_chooses_the_mode_alt_swaps_while_held() {
|
||||
let mut app = opened();
|
||||
let ctx = egui::Context::default();
|
||||
press(&mut app, &ctx, Key::E, Modifiers::NONE);
|
||||
assert!(!ws(&app).add);
|
||||
// Alt held on top of subtract: the stroke adds, so the pixel under it becomes selected.
|
||||
let before = ui_selected(&mut app);
|
||||
let stroke = json!({"tool": "brush", "size": 10, "hardness": 50, "stroke": {"points": [[100.0, 10.0], [100.0, 90.0]], "alt": true}});
|
||||
control(&mut app, &stroke).unwrap();
|
||||
assert!(!ws(&app).add, "Alt does not change the chosen mode");
|
||||
assert!(ui_selected(&mut app) > before, "Alt over subtract adds");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_polygon_in_progress_keeps_its_starting_mode() {
|
||||
let mut app = opened();
|
||||
let ctx = egui::Context::default();
|
||||
app.distort.select_mask.as_mut().unwrap().pick(SmTool::PolygonalLasso);
|
||||
app.distort.select_mask.as_mut().unwrap().poly = Some((true, vec![[10.0, 10.0], [50.0, 10.0], [50.0, 50.0]]));
|
||||
press(&mut app, &ctx, Key::E, Modifiers::NONE);
|
||||
assert!(!ws(&app).add);
|
||||
assert_eq!(ws(&app).poly.as_ref().map(|(a, _)| *a), Some(true));
|
||||
assert!(enter(&mut app), "Enter closes the polygon");
|
||||
let edit = ws(&app).edits.last().expect("the closed polygon is recorded");
|
||||
assert_eq!(edit["tool"].as_str(), Some("lasso"));
|
||||
assert_eq!(edit["mode"].as_str(), Some("add"), "the mode the polygon started with");
|
||||
assert!(!ws(&app).add, "the workspace mode is still the one E chose");
|
||||
}
|
||||
|
||||
fn e_event() -> egui::RawInput {
|
||||
let ev = egui::Event::Key { key: Key::E, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE };
|
||||
egui::RawInput { events: vec![ev], ..Default::default() }
|
||||
}
|
||||
|
||||
/// Through the shortcut handler, as the app runs it: a focused text field keeps the E.
|
||||
#[test]
|
||||
fn e_through_handle_is_ignored_while_a_text_field_has_focus() {
|
||||
let mut app = opened();
|
||||
let ctx = egui::Context::default();
|
||||
let mut text = String::new();
|
||||
ctx.run_ui(Default::default(), |ui| {
|
||||
ui.text_edit_singleline(&mut text).request_focus();
|
||||
})
|
||||
.textures_delta
|
||||
.clear();
|
||||
ctx.run_ui(e_event(), |ui| {
|
||||
assert!(ui.ctx().text_edit_focused());
|
||||
crate::shortcuts::handle(&mut app, ui.ctx());
|
||||
ui.text_edit_singleline(&mut text);
|
||||
})
|
||||
.textures_delta
|
||||
.clear();
|
||||
assert!(ws(&app).add);
|
||||
}
|
||||
|
||||
/// The same path with no text field focused: E flips the mode.
|
||||
#[test]
|
||||
fn e_through_handle_flips_the_mode_without_a_focused_text_field() {
|
||||
let mut app = opened();
|
||||
let ctx = egui::Context::default();
|
||||
ctx.run_ui(e_event(), |ui| {
|
||||
assert!(!ui.ctx().text_edit_focused());
|
||||
crate::shortcuts::handle(&mut app, ui.ctx());
|
||||
})
|
||||
.textures_delta
|
||||
.clear();
|
||||
assert!(!ws(&app).add);
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
//! #11403: the document tab's right-click menu lists the reference application's eight entries in
|
||||
//! order, with its two separators, and each entry runs the command it names on the clicked tab.
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
||||
use egui::vec2;
|
||||
use egui_kittest::Harness;
|
||||
use egui_kittest::kittest::{NodeT, Queryable};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use crate::canvas::tabs::{TAB_MENU_SEPARATORS_AFTER, tab_context_items, tab_context_menu};
|
||||
use crate::state::DialogKind;
|
||||
use crate::{FileDialogRequest, PhotocraftApp, Services};
|
||||
|
||||
/// The app, what the menu is drawn for, and the command the last click returned.
|
||||
struct Probe {
|
||||
app: PhotocraftApp,
|
||||
index: usize,
|
||||
has_path: bool,
|
||||
picked: Option<(&'static str, Value)>,
|
||||
}
|
||||
|
||||
type Requests = Rc<RefCell<Vec<FileDialogRequest>>>;
|
||||
|
||||
fn probe(documents: usize, index: usize, has_path: bool) -> (Harness<'static, Probe>, Requests) {
|
||||
let requests: Requests = Default::default();
|
||||
let held = requests.clone();
|
||||
let services = Services { file_dialog: Some(Box::new(move |request, _parent, _reply| held.borrow_mut().push(request))), ..Default::default() };
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), services);
|
||||
for n in 0..documents {
|
||||
app.run("file.new", json!({"width": 10 + n, "height": 8})).unwrap();
|
||||
}
|
||||
let state = Probe { app, index, has_path, picked: None };
|
||||
let mut h = Harness::builder().with_size(vec2(400.0, 500.0)).build_ui_state(
|
||||
|ui, p: &mut Probe| {
|
||||
let count = p.app.session.documents().len();
|
||||
if let Some(hit) = tab_context_menu(ui, p.index, count, p.has_path) {
|
||||
p.picked = Some(hit);
|
||||
}
|
||||
},
|
||||
state,
|
||||
);
|
||||
PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::ALL[0]);
|
||||
h.run_steps(3);
|
||||
(h, requests)
|
||||
}
|
||||
|
||||
/// The drawn rows top to bottom: label, top edge, enabled.
|
||||
fn rows(h: &Harness<'static, Probe>) -> Vec<(String, f32, bool)> {
|
||||
let mut rows: Vec<(String, f32, bool)> = h
|
||||
.query_all_by_role(egui::accesskit::Role::Button)
|
||||
.map(|n| {
|
||||
let a = n.accesskit_node();
|
||||
(a.label().unwrap_or_default().to_string(), n.rect().top(), !a.is_disabled())
|
||||
})
|
||||
.collect();
|
||||
rows.sort_by(|a, b| a.1.total_cmp(&b.1));
|
||||
rows
|
||||
}
|
||||
|
||||
/// Each document's width, which tells the documents apart (`probe` makes them 10, 11, 12 wide).
|
||||
fn widths(h: &Harness<'static, Probe>) -> Vec<u32> {
|
||||
h.state().app.session.documents().iter().map(|d| d.doc.size.width).collect()
|
||||
}
|
||||
|
||||
fn click(h: &mut Harness<'static, Probe>, label: &str) -> (&'static str, Value) {
|
||||
h.get_by_label(label).click();
|
||||
h.run_steps(3);
|
||||
h.state_mut().picked.take().unwrap_or_else(|| panic!("clicking {label} returned no command"))
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_menu_lists_the_eight_reference_entries_in_order() {
|
||||
let (h, _) = probe(1, 0, false);
|
||||
let labels: Vec<String> = rows(&h).into_iter().map(|r| r.0).collect();
|
||||
assert_eq!(
|
||||
labels,
|
||||
[
|
||||
"Consolidate All to Here",
|
||||
"Close",
|
||||
"Close All",
|
||||
"Close Others",
|
||||
"Move to New Window",
|
||||
"New Document…",
|
||||
"Open Document…",
|
||||
crate::menus::reveal_label(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn separators_follow_move_to_new_window_and_open_document() {
|
||||
assert_eq!(TAB_MENU_SEPARATORS_AFTER, [4, 6]);
|
||||
let (h, _) = probe(1, 0, false);
|
||||
let tops: Vec<f32> = rows(&h).into_iter().map(|r| r.1).collect();
|
||||
let gaps: Vec<f32> = tops.windows(2).map(|w| w[1] - w[0]).collect();
|
||||
let plain = gaps[0];
|
||||
for (i, gap) in gaps.iter().enumerate() {
|
||||
let separated = TAB_MENU_SEPARATORS_AFTER.contains(&i);
|
||||
assert_eq!(*gap > plain + 1.0, separated, "gap after row {i} is {gap} against a plain {plain}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_row_names_its_command_and_the_clicked_tabs_index() {
|
||||
let items = tab_context_items(2, 3, true);
|
||||
let menu = crate::menus::menu_items(&PhotocraftApp::new(photocraft_engine::Session::new(), Services::default()));
|
||||
let want = [
|
||||
("Consolidate All to Here", "window.arrange.consolidateAllToTabs", json!({})),
|
||||
("Close", "file.close", json!({"document": 2})),
|
||||
("Close All", "file.closeAll", json!({})),
|
||||
("Close Others", "file.closeOthers", json!({"document": 2})),
|
||||
("Move to New Window", "window.arrange.floatInWindow", json!({"document": 2})),
|
||||
("New Document…", "file.new", json!({})),
|
||||
("Open Document…", "file.open", json!({})),
|
||||
(crate::menus::reveal_label(), "file.revealInFinder", json!({"document": 2})),
|
||||
];
|
||||
for ((label, id, params, _), (wl, wi, wp)) in items.iter().zip(want) {
|
||||
assert_eq!((*label, *id, params), (wl, wi, &wp));
|
||||
assert!(menu.iter().any(|i| i.id == *id) || photocraft_engine::commands::find(id).is_some(), "{id} is a command");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn enabled_states_for_one_saved_one_unsaved_and_two_documents() {
|
||||
let enabled = |documents: usize, has_path: bool| -> Vec<bool> {
|
||||
let (h, _) = probe(documents, 0, has_path);
|
||||
rows(&h).into_iter().map(|r| r.2).collect()
|
||||
};
|
||||
// Consolidate, Close, Close All, Close Others, Move, New, Open, Reveal.
|
||||
assert_eq!(enabled(1, true), [false, true, true, false, true, true, true, true], "one saved document");
|
||||
assert_eq!(enabled(1, false), [false, true, true, false, true, true, true, false], "one unsaved document");
|
||||
assert_eq!(enabled(2, true), [true, true, true, true, true, true, true, true], "two documents");
|
||||
assert_eq!(enabled(2, false), [true, true, true, true, true, true, true, false], "two documents, the clicked one unsaved");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn close_close_all_and_close_others_act_on_the_clicked_tab() {
|
||||
let (mut h, _) = probe(3, 1, true);
|
||||
let (id, params) = click(&mut h, "Close");
|
||||
assert_eq!((id, ¶ms), ("file.close", &json!({"document": 1})));
|
||||
let ctx = h.ctx.clone();
|
||||
crate::menus::invoke(&mut h.state_mut().app, &ctx, id, params).unwrap();
|
||||
let names = widths(&h);
|
||||
assert_eq!(names, [10, 12]);
|
||||
|
||||
let (mut h, _) = probe(3, 1, true);
|
||||
let (id, params) = click(&mut h, "Close Others");
|
||||
crate::menus::invoke(&mut h.state_mut().app, &ctx, id, params).unwrap();
|
||||
let names = widths(&h);
|
||||
assert_eq!(names, [11]);
|
||||
|
||||
let (mut h, _) = probe(3, 1, true);
|
||||
let (id, params) = click(&mut h, "Close All");
|
||||
crate::menus::invoke(&mut h.state_mut().app, &ctx, id, params).unwrap();
|
||||
assert!(h.state().app.session.documents().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn move_to_new_window_floats_the_clicked_tab_even_with_one_document() {
|
||||
let ctx = egui::Context::default();
|
||||
let (mut h, _) = probe(1, 0, false);
|
||||
let (id, params) = click(&mut h, "Move to New Window");
|
||||
assert_eq!((id, ¶ms), ("window.arrange.floatInWindow", &json!({"document": 0})));
|
||||
crate::menus::invoke(&mut h.state_mut().app, &ctx, id, params).unwrap();
|
||||
assert!(h.state().app.ui.windows.iter().any(|w| w.floating && w.document == 0));
|
||||
|
||||
// The clicked tab (2) is not the active document (0).
|
||||
let (mut h, _) = probe(3, 2, true);
|
||||
h.state_mut().app.session.set_active(0);
|
||||
assert_eq!(h.state().app.session.active_index(), Some(0));
|
||||
let (id, params) = click(&mut h, "Move to New Window");
|
||||
crate::menus::invoke(&mut h.state_mut().app, &ctx, id, params).unwrap();
|
||||
let windows = &h.state().app.ui.windows;
|
||||
assert!(windows.iter().any(|w| w.floating && w.document == 2), "the clicked tab floats");
|
||||
assert!(!windows.iter().any(|w| w.document == 0), "the active document does not float");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn consolidate_all_to_here_brings_floating_windows_back() {
|
||||
let ctx = egui::Context::default();
|
||||
let (mut h, _) = probe(2, 0, true);
|
||||
crate::menus::invoke(&mut h.state_mut().app, &ctx, "window.arrange.floatAllInWindows", json!({})).unwrap();
|
||||
assert_eq!(h.state().app.ui.windows.len(), 2);
|
||||
let (id, params) = click(&mut h, "Consolidate All to Here");
|
||||
assert_eq!((id, ¶ms), ("window.arrange.consolidateAllToTabs", &json!({})));
|
||||
crate::menus::invoke(&mut h.state_mut().app, &ctx, id, params).unwrap();
|
||||
assert!(h.state().app.ui.windows.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn new_document_opens_the_new_document_dialog() {
|
||||
let ctx = egui::Context::default();
|
||||
let (mut h, _) = probe(1, 0, false);
|
||||
let (id, params) = click(&mut h, "New Document…");
|
||||
assert_eq!((id, ¶ms), ("file.new", &json!({})));
|
||||
crate::menus::invoke(&mut h.state_mut().app, &ctx, id, params).unwrap();
|
||||
assert!(h.state().app.ui.dialogs.iter().any(|d| d.kind == DialogKind::NewDocument));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn open_document_asks_for_files_like_file_open() {
|
||||
let ctx = egui::Context::default();
|
||||
let (mut h, requests) = probe(1, 0, false);
|
||||
let (id, params) = click(&mut h, "Open Document…");
|
||||
assert_eq!((id, ¶ms), ("file.open", &json!({})));
|
||||
crate::menus::invoke(&mut h.state_mut().app, &ctx, id, params).unwrap();
|
||||
h.state_mut().app.poll_file_dialog(&ctx, None);
|
||||
let asked = requests.borrow();
|
||||
assert!(matches!(asked.as_slice(), [FileDialogRequest::Open { multiple: true, .. }]), "{asked:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn reveal_keeps_its_platform_label_and_command() {
|
||||
let (mut h, _) = probe(1, 0, true);
|
||||
let (id, params) = click(&mut h, crate::menus::reveal_label());
|
||||
assert_eq!((id, ¶ms), ("file.revealInFinder", &json!({"document": 0})));
|
||||
}
|
||||
@@ -81,6 +81,7 @@
|
||||
Right يمين
|
||||
Open Recent فتح الملفات الأخيرة
|
||||
Clear Recent Files مسح الملفات الأخيرة
|
||||
Clear Recent File List مسح الملفات الأخيرة
|
||||
Remove from Recent إزالة من الملفات الأخيرة
|
||||
Remove {name} from Recent إزالة {name} من الملفات الأخيرة
|
||||
Close إغلاق
|
||||
@@ -89,6 +90,10 @@
|
||||
Restore استعادة
|
||||
Close All إغلاق الكل
|
||||
Close Others إغلاق المستندات الأخرى
|
||||
New Document… مستند جديد…
|
||||
Open Document… فتح…
|
||||
Consolidate All to Here توحيد الكل هنا
|
||||
Move to New Window نقل إلى نافذة جديدة
|
||||
Save حفظ
|
||||
Save As… حفظ باسم…
|
||||
Save a Copy… حفظ نسخة…
|
||||
@@ -141,6 +146,7 @@
|
||||
Create Smart Object after Loading Layers إنشاء كائن ذكي بعد تحميل الطبقات
|
||||
Reveal in Finder إظهار في Finder
|
||||
Show in Explorer إظهار في Explorer
|
||||
Reveal in Explorer إظهار في Explorer
|
||||
Show in Folder إظهار في المجلد
|
||||
File Info… معلومات الملف…
|
||||
Print… طباعة…
|
||||
@@ -229,6 +235,7 @@
|
||||
Units & Rulers… الوحدات والمساطر…
|
||||
Guides, Grid & Slices… خطوط التوجيه والشبكة والشرائح…
|
||||
Plug-ins… المكونات الإضافية…
|
||||
Plugins… المكونات الإضافية…
|
||||
Type… النص…
|
||||
Enhanced Controls… عناصر التحكم المحسنة…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -386,6 +393,8 @@
|
||||
Smart Object كائن ذكي
|
||||
Convert to Smart Object تحويل إلى كائن ذكي
|
||||
Convert to Embedded تحويل إلى مضمّن
|
||||
Embed Linked تضمين المرتبط
|
||||
Embed All Linked تضمين كل المرتبط
|
||||
Convert to Layers تحويل إلى طبقات
|
||||
Convert to Linked… تحويل إلى مرتبط…
|
||||
Edit Contents تحرير المحتويات
|
||||
@@ -459,7 +468,9 @@
|
||||
Unite Shapes توحيد الأشكال
|
||||
Subtract Front Shape طرح الشكل الأمامي
|
||||
Intersect Shape Areas تقاطع مناطق الأشكال
|
||||
Unite Shapes at Overlap تقاطع مناطق الأشكال
|
||||
Exclude Overlapping Shapes استبعاد الأشكال المتداخلة
|
||||
Subtract Shapes at Overlap استبعاد الأشكال المتداخلة
|
||||
Merge Shape Components دمج مكونات الشكل
|
||||
Align محاذاة
|
||||
Top Edges الحواف العلوية
|
||||
@@ -660,6 +671,7 @@
|
||||
Minimum… الحد الأدنى…
|
||||
Offset… إزاحة…
|
||||
Plug-ins المكونات الإضافية
|
||||
Plugins المكونات الإضافية
|
||||
Proof Setup إعداد المعاينة الطباعية
|
||||
Proof Colors ألوان المعاينة الطباعية
|
||||
Gamut Warning تحذير النطاق اللوني
|
||||
@@ -668,9 +680,9 @@
|
||||
Working Magenta Plate لوح الأرجواني العامل
|
||||
Working Yellow Plate لوح الأصفر العامل
|
||||
Working Black Plate لوح الأسود العامل
|
||||
Working CMY Plate لوح CMY العامل
|
||||
Legacy Macintosh RGB RGB القديم لنظام Macintosh
|
||||
Internet Standard RGB RGB القياسي للإنترنت
|
||||
Working CMY Plates لوح CMY العامل
|
||||
Legacy Macintosh RGB (Gamma 1.8) RGB القديم لنظام Macintosh (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) RGB القياسي للإنترنت (sRGB)
|
||||
Monitor RGB RGB الشاشة
|
||||
Color Blindness — Protanopia-type عمى الألوان — نوع بروتانوبيا
|
||||
Color Blindness — Deuteranopia-type عمى الألوان — نوع ديوتيرانوبيا
|
||||
@@ -752,7 +764,7 @@
|
||||
Consolidate All to Tabs توحيد الكل في علامات تبويب
|
||||
Float in Window تعويم في نافذة
|
||||
Float All in Windows تعويم الكل في نوافذ
|
||||
New Window for Document نافذة جديدة للمستند
|
||||
New Window نافذة جديدة للمستند
|
||||
Workspace مساحة العمل
|
||||
Essentials الأساسيات
|
||||
Graphic and Web الرسومات والويب
|
||||
@@ -1924,6 +1936,11 @@
|
||||
Show canvas dots إظهار نقاط مساحة الرسم
|
||||
Clip thumbnails to layer bounds قصر الصور المصغرة على حدود الطبقة
|
||||
Clip Thumbnails to Layer Bounds قصر الصور المصغرة على حدود الطبقة
|
||||
No Thumbnails بلا صور مصغرة
|
||||
Small Thumbnails صور مصغرة صغيرة
|
||||
Medium Thumbnails صور مصغرة متوسطة
|
||||
Large Thumbnails صور مصغرة كبيرة
|
||||
Clip Thumbnails to Document Bounds قصر الصور المصغرة على حدود المستند
|
||||
Canvas color لون مساحة الرسم
|
||||
Canvas custom color لون مخصص لمساحة الرسم
|
||||
Color picker منتقي الألوان
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -64,6 +64,7 @@
|
||||
Right Desno
|
||||
Open Recent Otvori nedavno
|
||||
Clear Recent Files Očisti nedavne datoteke
|
||||
Clear Recent File List Očisti nedavne datoteke
|
||||
Remove from Recent Ukloni iz nedavnih
|
||||
Remove {name} from Recent Ukloni {name} iz nedavnih
|
||||
Close Zatvori
|
||||
@@ -72,6 +73,10 @@
|
||||
Restore Vrati
|
||||
Close All Zatvori sve
|
||||
Close Others Zatvori ostale
|
||||
New Document… Novi dokument…
|
||||
Open Document… Otvori…
|
||||
Consolidate All to Here Objedini sve ovdje
|
||||
Move to New Window Premjesti u novi prozor
|
||||
Save Sačuvaj
|
||||
Save As… Sačuvaj kao…
|
||||
Save a Copy… Sačuvaj kopiju…
|
||||
@@ -123,6 +128,7 @@
|
||||
Create Smart Object after Loading Layers Kreiraj pametni objekat nakon učitavanja slojeva
|
||||
Reveal in Finder Prikaži u Finderu
|
||||
Show in Explorer Prikaži u Exploreru
|
||||
Reveal in Explorer Prikaži u Exploreru
|
||||
Show in Folder Prikaži u folderu
|
||||
File Info… Informacije o datoteci…
|
||||
Print… Štampaj…
|
||||
@@ -207,6 +213,7 @@
|
||||
Units & Rulers… Jedinice i ravnala…
|
||||
Guides, Grid & Slices… Vodilice, mreža i isječci…
|
||||
Plug-ins… Dodaci…
|
||||
Plugins… Dodaci…
|
||||
Type… Vrsta…
|
||||
Enhanced Controls… Poboljšane kontrole…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -355,6 +362,8 @@
|
||||
Smart Object Pametni objekat
|
||||
Convert to Smart Object Pretvori u pametni objekat
|
||||
Convert to Embedded Pretvori u ugrađeno
|
||||
Embed Linked Ugradi povezano
|
||||
Embed All Linked Ugradi sve povezano
|
||||
Convert to Layers Pretvori u slojeve
|
||||
Convert to Linked… Pretvori u povezano…
|
||||
Edit Contents Uredi sadržaj
|
||||
@@ -605,6 +614,7 @@
|
||||
Minimum… Minimum…
|
||||
Offset… Pomak…
|
||||
Plug-ins Dodaci
|
||||
Plugins Dodaci
|
||||
Proof Setup Postavke probnog prikaza
|
||||
Proof Colors Probne boje
|
||||
Gamut Warning Upozorenje o gamutu
|
||||
@@ -613,9 +623,9 @@
|
||||
Working Magenta Plate Radna magenta ploča
|
||||
Working Yellow Plate Radna žuta ploča
|
||||
Working Black Plate Radna crna ploča
|
||||
Working CMY Plate Radna CMY ploča
|
||||
Legacy Macintosh RGB Naslijeđeni Macintosh RGB
|
||||
Internet Standard RGB Internet standardni RGB
|
||||
Working CMY Plates Radna CMY ploča
|
||||
Legacy Macintosh RGB (Gamma 1.8) Naslijeđeni Macintosh RGB (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) Internet standardni RGB (sRGB)
|
||||
Monitor RGB RGB monitora
|
||||
Color Blindness — Protanopia-type Daltonizam — tip protanopije
|
||||
Color Blindness — Deuteranopia-type Daltonizam — tip deuteranopije
|
||||
@@ -707,7 +717,6 @@
|
||||
Consolidate All to Tabs Objedini sve u kartice
|
||||
Float in Window Odvoji u prozor
|
||||
Float All in Windows Odvoji sve u prozore
|
||||
New Window for Document Novi prozor za dokument
|
||||
Workspace Radni prostor
|
||||
Essentials Osnove
|
||||
Graphic and Web Grafika i web
|
||||
@@ -1851,6 +1860,11 @@
|
||||
Show canvas dots Prikaži tačke platna
|
||||
Clip thumbnails to layer bounds Ograniči sličice na granice sloja
|
||||
Clip Thumbnails to Layer Bounds Ograniči sličice na granice sloja
|
||||
No Thumbnails Bez sličica
|
||||
Small Thumbnails Male sličice
|
||||
Medium Thumbnails Srednje sličice
|
||||
Large Thumbnails Velike sličice
|
||||
Clip Thumbnails to Document Bounds Ograniči sličice na granice dokumenta
|
||||
Canvas color Boja platna
|
||||
Canvas custom color Prilagođena boja platna
|
||||
Color picker Birač boja
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -203,6 +203,7 @@
|
||||
Right Vpravo
|
||||
Open Recent Otevřít nedávné
|
||||
Clear Recent Files Vymazat nedávné soubory
|
||||
Clear Recent File List Vymazat nedávné soubory
|
||||
Remove from Recent Odebrat z nedávných
|
||||
Remove {name} from Recent Odebrat {name} z nedávných
|
||||
Close Zavřít
|
||||
@@ -211,6 +212,10 @@
|
||||
Restore Obnovit
|
||||
Close All Zavřít vše
|
||||
Close Others Zavřít ostatní
|
||||
New Document… Nový dokument…
|
||||
Open Document… Otevřít…
|
||||
Consolidate All to Here Sloučit vše sem
|
||||
Move to New Window Přesunout do nového okna
|
||||
Save Uložit
|
||||
Save As… Uložit jako…
|
||||
Save a Copy… Uložit kopii…
|
||||
@@ -262,6 +267,7 @@
|
||||
Create Smart Object after Loading Layers Po načtení vrstev vytvořit chytrý objekt
|
||||
Reveal in Finder Zobrazit ve Finderu
|
||||
Show in Explorer Zobrazit v Průzkumníkovi
|
||||
Reveal in Explorer Zobrazit v Průzkumníkovi
|
||||
Show in Folder Zobrazit ve složce
|
||||
File Info… Informace o souboru…
|
||||
Print… Tisk…
|
||||
@@ -350,6 +356,7 @@
|
||||
Units & Rulers… Jednotky a pravítka…
|
||||
Guides, Grid & Slices… Vodítka, mřížka a řezy…
|
||||
Plug-ins… Zásuvné moduly…
|
||||
Plugins… Zásuvné moduly…
|
||||
Type… Text…
|
||||
Enhanced Controls… Rozšířené ovládání…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -507,6 +514,8 @@
|
||||
Smart Object Chytrý objekt
|
||||
Convert to Smart Object Převést na chytrý objekt
|
||||
Convert to Embedded Převést na vložený
|
||||
Embed Linked Vložit propojené
|
||||
Embed All Linked Vložit všechna propojená
|
||||
Convert to Layers Převést na vrstvy
|
||||
Convert to Linked… Převést na propojený…
|
||||
Edit Contents Upravit obsah
|
||||
@@ -764,6 +773,7 @@
|
||||
Minimum… Minimum…
|
||||
Offset… Posun…
|
||||
Plug-ins Zásuvné moduly
|
||||
Plugins Zásuvné moduly
|
||||
Proof Setup Nastavení nátisku
|
||||
Proof Colors Nátiskové barvy
|
||||
Gamut Warning Upozornění na gamut
|
||||
@@ -772,9 +782,9 @@
|
||||
Working Magenta Plate Pracovní purpurový výtažek
|
||||
Working Yellow Plate Pracovní žlutý výtažek
|
||||
Working Black Plate Pracovní černý výtažek
|
||||
Working CMY Plate Pracovní výtažky CMY
|
||||
Legacy Macintosh RGB Starší Macintosh RGB
|
||||
Internet Standard RGB Internetový standard RGB
|
||||
Working CMY Plates Pracovní výtažky CMY
|
||||
Legacy Macintosh RGB (Gamma 1.8) Starší Macintosh RGB (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) Internetový standard RGB (sRGB)
|
||||
Monitor RGB RGB monitoru
|
||||
Color Blindness — Protanopia-type Barvoslepost — protanopie
|
||||
Color Blindness — Deuteranopia-type Barvoslepost — deuteranopie
|
||||
@@ -866,7 +876,7 @@
|
||||
Consolidate All to Tabs Sloučit vše do záložek
|
||||
Float in Window Uvolnit do plovoucího okna
|
||||
Float All in Windows Uvolnit vše do plovoucích oken
|
||||
New Window for Document Nové okno dokumentu
|
||||
New Window Nové okno dokumentu
|
||||
Workspace Pracovní prostor
|
||||
Essentials Základy
|
||||
Graphic and Web Grafika a web
|
||||
@@ -2041,6 +2051,11 @@
|
||||
Show canvas dots Zobrazit tečky plátna
|
||||
Clip thumbnails to layer bounds Oříznout miniatury na hranice vrstvy
|
||||
Clip Thumbnails to Layer Bounds Oříznout miniatury na hranice vrstvy
|
||||
No Thumbnails Bez miniatur
|
||||
Small Thumbnails Malé miniatury
|
||||
Medium Thumbnails Střední miniatury
|
||||
Large Thumbnails Velké miniatury
|
||||
Clip Thumbnails to Document Bounds Oříznout miniatury na hranice dokumentu
|
||||
Canvas color Barva plátna
|
||||
Canvas custom color Vlastní barva plátna
|
||||
Color picker Výběr barvy
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -86,6 +86,7 @@
|
||||
Right Højre
|
||||
Open Recent Åbn seneste
|
||||
Clear Recent Files Ryd seneste filer
|
||||
Clear Recent File List Ryd seneste filer
|
||||
Remove from Recent Fjern fra seneste
|
||||
Remove {name} from Recent Fjern {name} fra seneste
|
||||
Close Luk
|
||||
@@ -94,6 +95,10 @@
|
||||
Restore Gendan
|
||||
Close All Luk alle
|
||||
Close Others Luk andre
|
||||
New Document… Nyt dokument…
|
||||
Open Document… Åbn…
|
||||
Consolidate All to Here Saml alle her
|
||||
Move to New Window Flyt til nyt vindue
|
||||
Save Gem
|
||||
Save As… Gem som…
|
||||
Save a Copy… Gem en kopi…
|
||||
@@ -508,7 +513,6 @@
|
||||
Match Location Afstem placering
|
||||
Match Rotation Afstem rotation
|
||||
Match All Afstem alle
|
||||
New Window for Document Nyt vindue til dokument
|
||||
Workspace Arbejdsområde
|
||||
Extensions Udvidelser
|
||||
Panels Paneler
|
||||
@@ -686,6 +690,7 @@
|
||||
Units & Rulers… Enheder og linealer…
|
||||
Guides, Grid & Slices… Hjælpelinjer, gitter og udsnit…
|
||||
Plug-ins… Plug-ins…
|
||||
Plugins… Plug-ins…
|
||||
Technology Previews Teknologieksempler
|
||||
Scratch Disks… Arbejdsdiske…
|
||||
Export Preferences… Eksportpræferencer…
|
||||
@@ -920,8 +925,8 @@
|
||||
ACES ACES
|
||||
Industry Standard Industristandard
|
||||
Web Web
|
||||
Internet Standard RGB Internetstandard-RGB
|
||||
Legacy Macintosh RGB Ældre Macintosh RGB
|
||||
Internet Standard RGB (sRGB) Internetstandard-RGB (sRGB)
|
||||
Legacy Macintosh RGB (Gamma 1.8) Ældre Macintosh RGB (Gamma 1.8)
|
||||
Monitor RGB Skærm-RGB
|
||||
Windows LCD Windows LCD
|
||||
Coated CMYK Bestrøget CMYK
|
||||
@@ -1742,6 +1747,7 @@
|
||||
Saved Gemt
|
||||
Reveal in Finder Vis i Finder
|
||||
Show in Explorer Vis i Stifinder
|
||||
Reveal in Explorer Vis i Stifinder
|
||||
Show in Folder Vis i mappe
|
||||
Before (Y) Før (Y)
|
||||
Save Settings… Gem indstillinger…
|
||||
@@ -1921,6 +1927,8 @@
|
||||
Combine Shapes Kombinér former
|
||||
Contract… Formindsk…
|
||||
Convert to Embedded Konvertér til indlejret
|
||||
Embed Linked Indlejr sammenkædet
|
||||
Embed All Linked Indlejr alle sammenkædede
|
||||
Convert to Layers Konvertér til lag
|
||||
Convert to Linked… Konvertér til sammenkædet…
|
||||
Count Optælling
|
||||
@@ -2008,6 +2016,7 @@
|
||||
Pixelate Pixelér
|
||||
Place Scale Marker… Placér skalamarkør…
|
||||
Plug-ins Plug-ins
|
||||
Plugins Plug-ins
|
||||
Print One Copy Udskriv én kopi
|
||||
Print… Udskriv…
|
||||
Range Spændvidde
|
||||
@@ -2052,7 +2061,7 @@
|
||||
Vertical Centers Lodrette midtpunkter
|
||||
Video Frames to Layers… Videobilleder til lag…
|
||||
WIA Support… WIA-support…
|
||||
Working CMY Plate Arbejds-CMY-plade
|
||||
Working CMY Plates Arbejds-CMY-plade
|
||||
|
||||
# tl! literals (third pass)
|
||||
Absolute Absolut
|
||||
@@ -2338,6 +2347,11 @@
|
||||
Show canvas dots Vis lærredsprikker
|
||||
Clip thumbnails to layer bounds Klip miniaturer til laggrænser
|
||||
Clip Thumbnails to Layer Bounds Klip miniaturer til laggrænser
|
||||
No Thumbnails Ingen miniaturer
|
||||
Small Thumbnails Små miniaturer
|
||||
Medium Thumbnails Mellemstore miniaturer
|
||||
Large Thumbnails Store miniaturer
|
||||
Clip Thumbnails to Document Bounds Klip miniaturer til dokumentgrænser
|
||||
Canvas color Lærredsfarve
|
||||
Canvas custom color Brugerdefineret lærredsfarve
|
||||
Classic Klassisk
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -173,6 +173,7 @@
|
||||
Right Rechts
|
||||
Open Recent Zuletzt geöffnete Dateien
|
||||
Clear Recent Files Zuletzt geöffnete Dateien leeren
|
||||
Clear Recent File List Zuletzt geöffnete Dateien leeren
|
||||
Remove from Recent Aus zuletzt geöffneten Dateien entfernen
|
||||
Remove {name} from Recent {name} aus zuletzt geöffneten Dateien entfernen
|
||||
Close Schließen
|
||||
@@ -181,6 +182,10 @@
|
||||
Restore Wiederherstellen
|
||||
Close All Alle schließen
|
||||
Close Others Andere schließen
|
||||
New Document… Neues Dokument…
|
||||
Open Document… Öffnen…
|
||||
Consolidate All to Here Alle hier zusammenfassen
|
||||
Move to New Window In neues Fenster verschieben
|
||||
Save Speichern
|
||||
Save As… Speichern unter…
|
||||
Save a Copy… Kopie speichern…
|
||||
@@ -233,6 +238,7 @@
|
||||
Create Smart Object after Loading Layers Nach dem Laden der Ebenen Smart-Objekt erstellen
|
||||
Reveal in Finder Im Finder anzeigen
|
||||
Show in Explorer Im Explorer anzeigen
|
||||
Reveal in Explorer Im Explorer anzeigen
|
||||
Show in Folder Im Ordner anzeigen
|
||||
File Info… Dateiinformationen…
|
||||
Print… Drucken…
|
||||
@@ -321,6 +327,7 @@
|
||||
Units & Rulers… Einheiten & Lineale…
|
||||
Guides, Grid & Slices… Hilfslinien, Raster & Slices…
|
||||
Plug-ins… Plug-ins…
|
||||
Plugins… Plug-ins…
|
||||
Type… Text…
|
||||
Enhanced Controls… Erweiterte Bedienelemente…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -478,6 +485,8 @@
|
||||
Smart Object Smart-Objekt
|
||||
Convert to Smart Object In Smart-Objekt konvertieren
|
||||
Convert to Embedded In eingebettetes Smart-Objekt konvertieren
|
||||
Embed Linked Verknüpftes einbetten
|
||||
Embed All Linked Alle verknüpften einbetten
|
||||
Convert to Layers In Ebenen konvertieren
|
||||
Convert to Linked… In verknüpftes Smart-Objekt konvertieren…
|
||||
Edit Contents Inhalt bearbeiten
|
||||
@@ -551,7 +560,9 @@
|
||||
Unite Shapes Formen vereinigen
|
||||
Subtract Front Shape Vordere Form subtrahieren
|
||||
Intersect Shape Areas Schnittmenge der Formen
|
||||
Unite Shapes at Overlap Schnittmenge der Formen
|
||||
Exclude Overlapping Shapes Überlappende Formen ausschließen
|
||||
Subtract Shapes at Overlap Überlappende Formen ausschließen
|
||||
Merge Shape Components Formkomponenten zusammenfügen
|
||||
Path operations Pfadvorgänge
|
||||
Align Ausrichten
|
||||
@@ -735,6 +746,7 @@
|
||||
Minimum… Minimum…
|
||||
Offset… Versatz…
|
||||
Plug-ins Plug-ins
|
||||
Plugins Plug-ins
|
||||
Proof Setup Proof-Setup
|
||||
Proof Colors Proof-Farben
|
||||
Gamut Warning Farbumfang-Warnung
|
||||
@@ -743,9 +755,9 @@
|
||||
Working Magenta Plate Arbeits-Magenta-Druckplatte
|
||||
Working Yellow Plate Arbeits-Gelb-Druckplatte
|
||||
Working Black Plate Arbeits-Schwarz-Druckplatte
|
||||
Working CMY Plate Arbeits-CMY-Druckplatte
|
||||
Legacy Macintosh RGB Legacy-Macintosh-RGB
|
||||
Internet Standard RGB Internet-Standard-RGB
|
||||
Working CMY Plates Arbeits-CMY-Druckplatte
|
||||
Legacy Macintosh RGB (Gamma 1.8) Legacy-Macintosh-RGB (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) Internet-Standard-RGB (sRGB)
|
||||
Monitor RGB Monitor-RGB
|
||||
Color Blindness — Protanopia-type Farbenblindheit — Protanopie-Typ
|
||||
Color Blindness — Deuteranopia-type Farbenblindheit — Deuteranopie-Typ
|
||||
@@ -827,7 +839,7 @@
|
||||
Consolidate All to Tabs Alle in Registerkarten zusammenfassen
|
||||
Float in Window In Fenster schweben lassen
|
||||
Float All in Windows Alle in Fenstern schweben lassen
|
||||
New Window for Document Neues Fenster für Dokument
|
||||
New Window Neues Fenster für Dokument
|
||||
Workspace Arbeitsbereich
|
||||
Essentials Essentials
|
||||
Graphic and Web Grafik und Web
|
||||
@@ -2000,6 +2012,11 @@
|
||||
Show canvas dots Punkte der Zeichenfläche anzeigen
|
||||
Clip thumbnails to layer bounds Miniaturbilder auf Ebenenbegrenzung beschneiden
|
||||
Clip Thumbnails to Layer Bounds Miniaturbilder auf Ebenenbegrenzung beschneiden
|
||||
No Thumbnails Keine Miniaturbilder
|
||||
Small Thumbnails Kleine Miniaturbilder
|
||||
Medium Thumbnails Mittlere Miniaturbilder
|
||||
Large Thumbnails Große Miniaturbilder
|
||||
Clip Thumbnails to Document Bounds Miniaturbilder auf Dokumentbegrenzung beschneiden
|
||||
Canvas color Zeichenflächenfarbe
|
||||
Canvas custom color Benutzerdefinierte Zeichenflächenfarbe
|
||||
Color picker Farbwähler
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -144,6 +144,7 @@
|
||||
Right Δεξιά
|
||||
Open Recent Πρόσφατα αρχεία
|
||||
Clear Recent Files Εκκαθάριση πρόσφατων αρχείων
|
||||
Clear Recent File List Εκκαθάριση πρόσφατων αρχείων
|
||||
Remove from Recent Αφαίρεση από τα πρόσφατα
|
||||
Remove {name} from Recent Αφαίρεση του {name} από τα πρόσφατα
|
||||
Close Κλείσιμο
|
||||
@@ -152,6 +153,10 @@
|
||||
Restore Επαναφορά
|
||||
Close All Κλείσιμο όλων
|
||||
Close Others Κλείσιμο των υπόλοιπων
|
||||
New Document… Νέο έγγραφο…
|
||||
Open Document… Άνοιγμα…
|
||||
Consolidate All to Here Συγκέντρωση όλων εδώ
|
||||
Move to New Window Μετακίνηση σε νέο παράθυρο
|
||||
Save Αποθήκευση
|
||||
Save As… Αποθήκευση ως…
|
||||
Save a Copy… Αποθήκευση αντιγράφου…
|
||||
@@ -203,6 +208,7 @@
|
||||
Create Smart Object after Loading Layers Δημιουργία έξυπνου αντικειμένου μετά τη φόρτωση επιπέδων
|
||||
Reveal in Finder Εμφάνιση στο Finder
|
||||
Show in Explorer Εμφάνιση στην Εξερεύνηση αρχείων
|
||||
Reveal in Explorer Εμφάνιση στην Εξερεύνηση αρχείων
|
||||
Show in Folder Εμφάνιση στον φάκελο
|
||||
File Info… Πληροφορίες αρχείου…
|
||||
Print… Εκτύπωση…
|
||||
@@ -1766,6 +1772,11 @@
|
||||
Show canvas dots Εμφάνιση κουκκίδων καμβά
|
||||
Clip thumbnails to layer bounds Περικοπή μικρογραφιών στα όρια του επιπέδου
|
||||
Clip Thumbnails to Layer Bounds Περικοπή μικρογραφιών στα όρια του επιπέδου
|
||||
No Thumbnails Χωρίς μικρογραφίες
|
||||
Small Thumbnails Μικρές μικρογραφίες
|
||||
Medium Thumbnails Μεσαίες μικρογραφίες
|
||||
Large Thumbnails Μεγάλες μικρογραφίες
|
||||
Clip Thumbnails to Document Bounds Περικοπή μικρογραφιών στα όρια του εγγράφου
|
||||
Canvas color Χρώμα καμβά
|
||||
Canvas custom color Προσαρμοσμένο χρώμα καμβά
|
||||
Color picker Επιλογέας χρώματος
|
||||
@@ -1847,6 +1858,7 @@
|
||||
Units & Rulers… Μονάδες και χάρακες…
|
||||
Guides, Grid & Slices… Οδηγοί, πλέγμα και τομές…
|
||||
Plug-ins… Πρόσθετα…
|
||||
Plugins… Πρόσθετα…
|
||||
Type… Κείμενο…
|
||||
Enhanced Controls… Προηγμένα χειριστήρια…
|
||||
Raw Defaults… Προεπιλογές RAW…
|
||||
@@ -1951,6 +1963,8 @@
|
||||
Hide Selection Απόκρυψη επιλογής
|
||||
From Transparency Από διαφάνεια
|
||||
Convert to Embedded Μετατροπή σε ενσωματωμένο
|
||||
Embed Linked Ενσωμάτωση συνδεδεμένου
|
||||
Embed All Linked Ενσωμάτωση όλων των συνδεδεμένων
|
||||
Convert to Linked… Μετατροπή σε συνδεδεμένο…
|
||||
Edit Contents Επεξεργασία περιεχομένου
|
||||
Replace Contents… Αντικατάσταση περιεχομένου…
|
||||
@@ -2009,7 +2023,9 @@
|
||||
Unite Shapes Ένωση σχημάτων
|
||||
Subtract Front Shape Αφαίρεση μπροστινού σχήματος
|
||||
Intersect Shape Areas Τομή περιοχών σχημάτων
|
||||
Unite Shapes at Overlap Τομή περιοχών σχημάτων
|
||||
Exclude Overlapping Shapes Εξαίρεση επικαλυπτόμενων σχημάτων
|
||||
Subtract Shapes at Overlap Εξαίρεση επικαλυπτόμενων σχημάτων
|
||||
Merge Shape Components Συγχώνευση συστατικών σχήματος
|
||||
Path operations Λειτουργίες διαδρομών
|
||||
Top Edges Επάνω ακμές
|
||||
@@ -2665,7 +2681,7 @@
|
||||
Install Plug-in Εγκατάσταση προσθέτου
|
||||
Integrations Ενσωματώσεις
|
||||
Interlaced Πεπλεγμένο
|
||||
Internet Standard RGB Τυπικό RGB διαδικτύου
|
||||
Internet Standard RGB (sRGB) Τυπικό RGB διαδικτύου (sRGB)
|
||||
Interpolation: Παρεμβολή:
|
||||
Interpret Footage Ερμηνεία πλάνων
|
||||
Intersect with selection ({key}) Τομή με την επιλογή ({key})
|
||||
@@ -2718,7 +2734,7 @@
|
||||
Leave as is (don't color manage) Διατήρηση ως έχει (χωρίς διαχείριση χρώματος)
|
||||
Left align text Αριστερή στοίχιση κειμένου
|
||||
Legacy Παλαιού τύπου
|
||||
Legacy Macintosh RGB Παλαιό Macintosh RGB
|
||||
Legacy Macintosh RGB (Gamma 1.8) Παλαιό Macintosh RGB (Gamma 1.8)
|
||||
Legacy compositing Παλαιός τρόπος σύνθεσης
|
||||
Legal Μέγεθος Legal
|
||||
Length: Μήκος:
|
||||
@@ -2855,7 +2871,6 @@
|
||||
New Video Group Νέα ομάδα βίντεο
|
||||
New Video Layer Νέο επίπεδο βίντεο
|
||||
New Video Layer from File Νέο επίπεδο βίντεο από αρχείο
|
||||
New Window for Document Νέο παράθυρο για το έγγραφο
|
||||
New Workspace Νέος χώρος εργασίας
|
||||
New Workspace… Νέος χώρος εργασίας…
|
||||
New document… Νέο έγγραφο…
|
||||
@@ -2948,6 +2963,7 @@
|
||||
Play Αναπαραγωγή
|
||||
Play selection Αναπαραγωγή επιλογής
|
||||
Plug-ins Πρόσθετα
|
||||
Plugins Πρόσθετα
|
||||
Point size Μέγεθος σε σημεία
|
||||
Pointillize Πουαντιγισμός
|
||||
Pointillize… Πουαντιγισμός…
|
||||
@@ -3371,7 +3387,7 @@
|
||||
Word Spacing Διάστημα λέξεων
|
||||
Work Path Διαδρομή εργασίας
|
||||
Working Black Plate Κανάλι μαύρου εργασίας
|
||||
Working CMY Plate Κανάλια CMY εργασίας
|
||||
Working CMY Plates Κανάλια CMY εργασίας
|
||||
Working CMYK Χώρος εργασίας CMYK
|
||||
Working Cyan Plate Κανάλι κυανού εργασίας
|
||||
Working Gray Plate Κανάλι γκρι εργασίας
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 47 and column 53.
|
@@ -139,6 +139,7 @@
|
||||
Right Derecha
|
||||
Open Recent Abrir recientes
|
||||
Clear Recent Files Vaciar archivos recientes
|
||||
Clear Recent File List Vaciar archivos recientes
|
||||
Remove from Recent Quitar de recientes
|
||||
Remove {name} from Recent Quitar {name} de recientes
|
||||
Close Cerrar
|
||||
@@ -147,6 +148,10 @@
|
||||
Restore Restaurar
|
||||
Close All Cerrar todo
|
||||
Close Others Cerrar otros
|
||||
New Document… Documento nuevo…
|
||||
Open Document… Abrir…
|
||||
Consolidate All to Here Consolidar todo aquí
|
||||
Move to New Window Mover a una nueva ventana
|
||||
Save Guardar
|
||||
Save As… Guardar como…
|
||||
Save a Copy… Guardar una copia…
|
||||
@@ -199,6 +204,7 @@
|
||||
Create Smart Object after Loading Layers Crear objeto inteligente tras cargar las capas
|
||||
Reveal in Finder Mostrar en Finder
|
||||
Show in Explorer Mostrar en el Explorador
|
||||
Reveal in Explorer Mostrar en el Explorador
|
||||
Show in Folder Mostrar en la carpeta
|
||||
File Info… Información del archivo…
|
||||
Print… Imprimir…
|
||||
@@ -287,6 +293,7 @@
|
||||
Units & Rulers… Unidades y reglas…
|
||||
Guides, Grid & Slices… Guías, cuadrícula y sectores…
|
||||
Plug-ins… Plugins…
|
||||
Plugins… Plugins…
|
||||
Type… Texto…
|
||||
Enhanced Controls… Controles mejorados…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -444,6 +451,8 @@
|
||||
Smart Object Objeto inteligente
|
||||
Convert to Smart Object Convertir en objeto inteligente
|
||||
Convert to Embedded Convertir en incrustado
|
||||
Embed Linked Incrustar vinculado
|
||||
Embed All Linked Incrustar todos los vinculados
|
||||
Convert to Layers Convertir en capas
|
||||
Convert to Linked… Convertir en vinculado…
|
||||
Edit Contents Editar contenido
|
||||
@@ -702,6 +711,7 @@
|
||||
Minimum… Mínimo…
|
||||
Offset… Desplazamiento…
|
||||
Plug-ins Plugins
|
||||
Plugins Plugins
|
||||
Proof Setup Ajuste de prueba
|
||||
Proof Colors Colores de prueba
|
||||
Gamut Warning Advertencia de gama
|
||||
@@ -710,9 +720,9 @@
|
||||
Working Magenta Plate Placa magenta de trabajo
|
||||
Working Yellow Plate Placa amarilla de trabajo
|
||||
Working Black Plate Placa negra de trabajo
|
||||
Working CMY Plate Placa CMY de trabajo
|
||||
Legacy Macintosh RGB RGB heredado de Macintosh
|
||||
Internet Standard RGB RGB estándar de Internet
|
||||
Working CMY Plates Placa CMY de trabajo
|
||||
Legacy Macintosh RGB (Gamma 1.8) RGB heredado de Macintosh (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) RGB estándar de Internet (sRGB)
|
||||
Monitor RGB RGB del monitor
|
||||
Color Blindness — Protanopia-type Daltonismo — tipo protanopia
|
||||
Color Blindness — Deuteranopia-type Daltonismo — tipo deuteranopia
|
||||
@@ -804,7 +814,6 @@
|
||||
Consolidate All to Tabs Consolidar todo en pestañas
|
||||
Float in Window Hacer flotante en ventana
|
||||
Float All in Windows Hacer flotantes todas en ventanas
|
||||
New Window for Document Nueva ventana para el documento
|
||||
Workspace Espacio de trabajo
|
||||
Essentials Esenciales
|
||||
Graphic and Web Gráficos y web
|
||||
@@ -1973,6 +1982,11 @@
|
||||
Show canvas dots Mostrar puntos del lienzo
|
||||
Clip thumbnails to layer bounds Recortar miniaturas a los límites de la capa
|
||||
Clip Thumbnails to Layer Bounds Recortar miniaturas a los límites de la capa
|
||||
No Thumbnails Sin miniaturas
|
||||
Small Thumbnails Miniaturas pequeñas
|
||||
Medium Thumbnails Miniaturas medianas
|
||||
Large Thumbnails Miniaturas grandes
|
||||
Clip Thumbnails to Document Bounds Recortar miniaturas a los límites del documento
|
||||
Canvas color Color del lienzo
|
||||
Canvas custom color Color personalizado del lienzo
|
||||
Color picker Selector de color
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 47.
|
@@ -87,6 +87,7 @@
|
||||
Right Oikea
|
||||
Open Recent Viimeksi avatut
|
||||
Clear Recent Files Tyhjennä viimeisimmät tiedostot
|
||||
Clear Recent File List Tyhjennä viimeisimmät tiedostot
|
||||
Remove from Recent Poista viimeisimmistä
|
||||
Remove {name} from Recent Poista {name} viimeisimmistä
|
||||
Close Sulje
|
||||
@@ -95,6 +96,10 @@
|
||||
Restore Palauta
|
||||
Close All Sulje kaikki
|
||||
Close Others Sulje muut
|
||||
New Document… Uusi asiakirja…
|
||||
Open Document… Avaa…
|
||||
Consolidate All to Here Kokoa kaikki tähän
|
||||
Move to New Window Siirrä uuteen ikkunaan
|
||||
Save Tallenna
|
||||
Save As… Tallenna nimellä…
|
||||
Save a Copy… Tallenna kopio…
|
||||
@@ -509,7 +514,6 @@
|
||||
Match Location Täsmäytä sijainti
|
||||
Match Rotation Täsmäytä kierto
|
||||
Match All Täsmäytä kaikki
|
||||
New Window for Document Uusi ikkuna asiakirjalle
|
||||
Workspace Työtila
|
||||
Extensions Laajennukset
|
||||
Panels Paneelit
|
||||
@@ -687,6 +691,7 @@
|
||||
Units & Rulers… Yksiköt ja viivaimet…
|
||||
Guides, Grid & Slices… Apuviivat, ruudukko ja viipaleet…
|
||||
Plug-ins… Laajennukset…
|
||||
Plugins… Laajennukset…
|
||||
Technology Previews Teknologian esikatselut
|
||||
Scratch Disks… Työlevyt…
|
||||
Export Preferences… Vientiasetukset…
|
||||
@@ -921,8 +926,8 @@
|
||||
ACES ACES
|
||||
Industry Standard Alan standardi
|
||||
Web Verkko
|
||||
Internet Standard RGB Internetin standardi-RGB
|
||||
Legacy Macintosh RGB Vanha Macintosh RGB
|
||||
Internet Standard RGB (sRGB) Internetin standardi-RGB (sRGB)
|
||||
Legacy Macintosh RGB (Gamma 1.8) Vanha Macintosh RGB (Gamma 1.8)
|
||||
Monitor RGB Näytön RGB
|
||||
Windows LCD Windows LCD
|
||||
Coated CMYK CMYK, päällystetty paperi
|
||||
@@ -1743,6 +1748,7 @@
|
||||
Saved Tallennettu
|
||||
Reveal in Finder Näytä Finderissa
|
||||
Show in Explorer Näytä Resurssienhallinnassa
|
||||
Reveal in Explorer Näytä Resurssienhallinnassa
|
||||
Show in Folder Näytä kansiossa
|
||||
Before (Y) Ennen (Y)
|
||||
Save Settings… Tallenna asetukset…
|
||||
@@ -1922,6 +1928,8 @@
|
||||
Combine Shapes Yhdistä muodot
|
||||
Contract… Supista…
|
||||
Convert to Embedded Muunna upotetuksi
|
||||
Embed Linked Upota linkitetty
|
||||
Embed All Linked Upota kaikki linkitetyt
|
||||
Convert to Layers Muunna tasoiksi
|
||||
Convert to Linked… Muunna linkitetyksi…
|
||||
Count Laskuri
|
||||
@@ -2009,6 +2017,7 @@
|
||||
Pixelate Pikselöinti
|
||||
Place Scale Marker… Sijoita mittakaavamerkki…
|
||||
Plug-ins Laajennukset
|
||||
Plugins Laajennukset
|
||||
Print One Copy Tulosta yksi kopio
|
||||
Print… Tulosta…
|
||||
Range Alue
|
||||
@@ -2053,7 +2062,7 @@
|
||||
Vertical Centers Pystykeskikohdat
|
||||
Video Frames to Layers… Videoruudut tasoiksi…
|
||||
WIA Support… WIA-tuki…
|
||||
Working CMY Plate Työ-CMY-levy
|
||||
Working CMY Plates Työ-CMY-levy
|
||||
|
||||
# tl! literals (third pass)
|
||||
Absolute Absoluuttinen
|
||||
@@ -2339,6 +2348,11 @@
|
||||
Show canvas dots Näytä kankaan pisteet
|
||||
Clip thumbnails to layer bounds Rajaa pikkukuvat tason rajoihin
|
||||
Clip Thumbnails to Layer Bounds Rajaa pikkukuvat tason rajoihin
|
||||
No Thumbnails Ei pikkukuvia
|
||||
Small Thumbnails Pienet pikkukuvat
|
||||
Medium Thumbnails Keskikokoiset pikkukuvat
|
||||
Large Thumbnails Suuret pikkukuvat
|
||||
Clip Thumbnails to Document Bounds Rajaa pikkukuvat asiakirjan rajoihin
|
||||
Canvas color Kankaan väri
|
||||
Canvas custom color Kankaan mukautettu väri
|
||||
Classic Klassinen
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -171,6 +171,7 @@
|
||||
Right Droite
|
||||
Open Recent Ouvrir un fichier récent
|
||||
Clear Recent Files Effacer la liste des fichiers récents
|
||||
Clear Recent File List Effacer la liste des fichiers récents
|
||||
Remove from Recent Retirer des fichiers récents
|
||||
Remove {name} from Recent Retirer {name} des fichiers récents
|
||||
Close Fermer
|
||||
@@ -179,6 +180,10 @@
|
||||
Restore Restaurer
|
||||
Close All Tout fermer
|
||||
Close Others Fermer les autres
|
||||
New Document… Nouveau document…
|
||||
Open Document… Ouvrir…
|
||||
Consolidate All to Here Tout regrouper ici
|
||||
Move to New Window Déplacer vers une nouvelle fenêtre
|
||||
Save Enregistrer
|
||||
Save As… Enregistrer sous…
|
||||
Save a Copy… Enregistrer une copie…
|
||||
@@ -231,6 +236,7 @@
|
||||
Create Smart Object after Loading Layers Créer un objet intelligent après le chargement des calques
|
||||
Reveal in Finder Afficher dans le Finder
|
||||
Show in Explorer Afficher dans l'Explorateur
|
||||
Reveal in Explorer Afficher dans l'Explorateur
|
||||
Show in Folder Afficher dans le dossier
|
||||
File Info… Informations sur le fichier…
|
||||
Print… Imprimer…
|
||||
@@ -317,6 +323,7 @@
|
||||
Units & Rulers… Unités et règles…
|
||||
Guides, Grid & Slices… Repères, grille et tranches…
|
||||
Plug-ins… Extensions…
|
||||
Plugins… Extensions…
|
||||
Type… Texte…
|
||||
Enhanced Controls… Commandes avancées…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -466,6 +473,8 @@
|
||||
Smart Object Objet intelligent
|
||||
Convert to Smart Object Convertir en objet intelligent
|
||||
Convert to Embedded Convertir en objet incorporé
|
||||
Embed Linked Incorporer le lié
|
||||
Embed All Linked Incorporer tous les liés
|
||||
Convert to Layers Convertir en calques
|
||||
Convert to Linked… Convertir en objet lié…
|
||||
Edit Contents Modifier le contenu
|
||||
@@ -718,6 +727,7 @@
|
||||
Minimum… Minimum…
|
||||
Offset… Décalage…
|
||||
Plug-ins Extensions
|
||||
Plugins Extensions
|
||||
Proof Setup Configuration d'épreuve
|
||||
Proof Colors Couleurs d'épreuve
|
||||
Gamut Warning Alerte de gamut
|
||||
@@ -726,9 +736,9 @@
|
||||
Working Magenta Plate Plaque magenta de travail
|
||||
Working Yellow Plate Plaque jaune de travail
|
||||
Working Black Plate Plaque noire de travail
|
||||
Working CMY Plate Plaque CMJ de travail
|
||||
Legacy Macintosh RGB RVB Macintosh (ancien)
|
||||
Internet Standard RGB RVB standard d'Internet
|
||||
Working CMY Plates Plaque CMJ de travail
|
||||
Legacy Macintosh RGB (Gamma 1.8) RVB Macintosh (ancien) (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) RVB standard d'Internet (sRGB)
|
||||
Monitor RGB RVB du moniteur
|
||||
Color Blindness — Protanopia-type Daltonisme — type protanopie
|
||||
Color Blindness — Deuteranopia-type Daltonisme — type deutéranopie
|
||||
@@ -820,7 +830,6 @@
|
||||
Consolidate All to Tabs Tout regrouper dans des onglets
|
||||
Float in Window Flottante dans une fenêtre
|
||||
Float All in Windows Toutes flottantes dans des fenêtres
|
||||
New Window for Document Nouvelle fenêtre pour le document
|
||||
Workspace Espace de travail
|
||||
Essentials Essentiel
|
||||
Graphic and Web Graphisme et Web
|
||||
@@ -1979,6 +1988,11 @@
|
||||
Show canvas dots Afficher les points du canevas
|
||||
Clip thumbnails to layer bounds Rogner les vignettes aux limites du calque
|
||||
Clip Thumbnails to Layer Bounds Rogner les vignettes aux limites du calque
|
||||
No Thumbnails Aucune vignette
|
||||
Small Thumbnails Petites vignettes
|
||||
Medium Thumbnails Vignettes moyennes
|
||||
Large Thumbnails Grandes vignettes
|
||||
Clip Thumbnails to Document Bounds Rogner les vignettes aux limites du document
|
||||
Canvas color Couleur du canevas
|
||||
Canvas custom color Couleur personnalisée du canevas
|
||||
Color picker Sélecteur de couleurs
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -65,6 +65,10 @@
|
||||
Close बंद करें
|
||||
Close All सभी बंद करें
|
||||
Close Others अन्य सभी बंद करें
|
||||
New Document… New Document…
|
||||
Open Document… खोलें…
|
||||
Consolidate All to Here सभी को यहाँ समेकित करें
|
||||
Move to New Window नई विंडो में ले जाएँ
|
||||
Save सहेजें
|
||||
Save As… इस रूप में सहेजें…
|
||||
Save a Copy… एक प्रति सहेजें…
|
||||
@@ -630,6 +634,8 @@ cameraRaw Yellow पीला
|
||||
@plural {n} action file loaded|{n} action files loaded {n} एक्शन फ़ाइल लोड हुई|{n} एक्शन फ़ाइलें लोड हुईं
|
||||
{set} from {file} replaced the one from {earlier} {file} के सेट {set} ने {earlier} वाले सेट की जगह ले ली
|
||||
@plural {n} file could not be loaded: {errors}|{n} files could not be loaded: {errors} {n} फ़ाइल लोड नहीं हो सकी: {errors}|{n} फ़ाइलें लोड नहीं हो सकीं: {errors}
|
||||
Embed Linked लिंक किए गए को एम्बेड करें
|
||||
Embed All Linked सभी लिंक किए गए को एम्बेड करें
|
||||
Toggle reference point संदर्भ बिंदु दिखाएँ/छिपाएँ
|
||||
|
||||
# Action Stop message (#8386)
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -158,6 +158,10 @@
|
||||
Clipboard Vágólap
|
||||
Close All Összes bezárása
|
||||
Close Others Többi bezárása
|
||||
New Document… Új dokumentum…
|
||||
Open Document… Megnyitás…
|
||||
Consolidate All to Here Összes ide
|
||||
Move to New Window Áthelyezés új ablakba
|
||||
Color Balance… Színegyensúly…
|
||||
Color Lookup Tables… Színleképezési táblák…
|
||||
Color Lookup… Színleképezés…
|
||||
@@ -257,6 +261,7 @@
|
||||
Place Linked… Csatolt elhelyezése…
|
||||
Place Scale Marker… Méretarány-jelölő elhelyezése…
|
||||
Plug-ins… Bővítmények…
|
||||
Plugins… Bővítmények…
|
||||
Posterize… Poszterizálás…
|
||||
Preferences Beállítások
|
||||
Preset Manager… Előbeállítás-kezelő…
|
||||
@@ -342,6 +347,8 @@
|
||||
Combine Shapes Alakzatok kombinálása
|
||||
Contract… Szűkítés…
|
||||
Convert to Embedded Átalakítás beágyazottá
|
||||
Embed Linked Csatolt beágyazása
|
||||
Embed All Linked Összes csatolt beágyazása
|
||||
Convert to Layers Átalakítás rétegekké
|
||||
Convert to Linked… Átalakítás csatolttá…
|
||||
Convert to Smart Object Átalakítás intelligens objektummá
|
||||
@@ -550,6 +557,7 @@
|
||||
Clear Canvas Guides Vászon-segédvonalak törlése
|
||||
Clear Guides Segédvonalak törlése
|
||||
Clear Recent Files Legutóbbi fájlok listájának törlése
|
||||
Clear Recent File List Legutóbbi fájlok listájának törlése
|
||||
Clear Selected Artboard Guides Kijelölt rajztábla segédvonalainak törlése
|
||||
Clear Slices Szeletek törlése
|
||||
Clipping Mask Vágómaszk
|
||||
@@ -681,7 +689,7 @@
|
||||
Info Információ
|
||||
Install Plug-in Bővítmény telepítése
|
||||
Install Plug-in… Bővítmény telepítése…
|
||||
Internet Standard RGB Internetes szabványos RGB
|
||||
Internet Standard RGB (sRGB) Internetes szabványos RGB (sRGB)
|
||||
Inverse Megfordítás
|
||||
Iris Blur… Íriszelmosás…
|
||||
Join the ArtCraft Discord Csatlakozás az ArtCraft Discordhoz
|
||||
@@ -698,7 +706,7 @@
|
||||
Layer From Background… Réteg a háttérből…
|
||||
Layers Rétegek
|
||||
Layers to Files Rétegek fájlokba
|
||||
Legacy Macintosh RGB Régi Macintosh RGB
|
||||
Legacy Macintosh RGB (Gamma 1.8) Régi Macintosh RGB (Gamma 1.8)
|
||||
Lens Blur… Objektívelmosás…
|
||||
Lens Flare… Lencsecsillanás…
|
||||
Light gray Világosszürke
|
||||
@@ -746,7 +754,6 @@
|
||||
New Type Layer Új szövegréteg
|
||||
New Video Layer Új videoréteg
|
||||
New Window Új ablak
|
||||
New Window for Document Új ablak a dokumentumhoz
|
||||
New Workspace… Új munkaterület…
|
||||
Next Appearance Mode Következő megjelenési mód
|
||||
Next Document Következő dokumentum
|
||||
@@ -791,6 +798,7 @@
|
||||
Pixel Grid Pixelrács
|
||||
Pixelate Pixelesítés
|
||||
Plug-ins Bővítmények
|
||||
Plugins Bővítmények
|
||||
Pointillize… Pontozás…
|
||||
Polar Coordinates… Polárkoordináták…
|
||||
Preferences… Beállítások…
|
||||
@@ -854,6 +862,7 @@
|
||||
Show All Összes megjelenítése
|
||||
Show Extras Options… Segédelemek beállításai…
|
||||
Show in Explorer Megjelenítés az Intézőben
|
||||
Reveal in Explorer Megjelenítés az Intézőben
|
||||
Show in Folder Megjelenítés mappában
|
||||
Show menu colors Menüszínek megjelenítése
|
||||
Show/Hide All Panels Összes panel megjelenítése/elrejtése
|
||||
@@ -919,7 +928,7 @@
|
||||
Windows LCD Windows LCD
|
||||
Wind… Szél…
|
||||
Working Black Plate Fekete munkalemez
|
||||
Working CMY Plate CMY munkalemezek
|
||||
Working CMY Plates CMY munkalemezek
|
||||
Working CMYK Munka-CMYK
|
||||
Working Cyan Plate Cián munkalemez
|
||||
Working Magenta Plate Magenta munkalemez
|
||||
@@ -3630,6 +3639,11 @@ cameraRaw Yellow Sárga
|
||||
Show canvas dots Vászonpontok megjelenítése
|
||||
Clip thumbnails to layer bounds Bélyegképek levágása a réteg határaira
|
||||
Clip Thumbnails to Layer Bounds Bélyegképek levágása a réteg határaira
|
||||
No Thumbnails Nincs bélyegkép
|
||||
Small Thumbnails Kis bélyegképek
|
||||
Medium Thumbnails Közepes bélyegképek
|
||||
Large Thumbnails Nagy bélyegképek
|
||||
Clip Thumbnails to Document Bounds Bélyegképek levágása a dokumentum határaira
|
||||
Show channels in color Csatornák megjelenítése színesen
|
||||
Show crosshair in brush tip Szálkereszt az ecsethegyben
|
||||
Show extension panels Bővítménypanelek megjelenítése
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -164,6 +164,7 @@
|
||||
Right Kanan
|
||||
Open Recent Terakhir Dibuka
|
||||
Clear Recent Files Hapus Daftar Berkas Terakhir
|
||||
Clear Recent File List Hapus Daftar Berkas Terakhir
|
||||
Remove from Recent Hapus dari Daftar Terakhir
|
||||
Remove {name} from Recent Hapus {name} dari Daftar Terakhir
|
||||
Close Tutup
|
||||
@@ -172,6 +173,10 @@
|
||||
Restore Pulihkan
|
||||
Close All Tutup Semua
|
||||
Close Others Tutup Lainnya
|
||||
New Document… Dokumen Baru…
|
||||
Open Document… Buka…
|
||||
Consolidate All to Here Gabungkan Semua ke Sini
|
||||
Move to New Window Pindahkan ke Jendela Baru
|
||||
Save Simpan
|
||||
Save As… Simpan Sebagai…
|
||||
Save a Copy… Simpan Salinan…
|
||||
@@ -224,6 +229,7 @@
|
||||
Create Smart Object after Loading Layers Buat Smart Object setelah Memuat Layer
|
||||
Reveal in Finder Tampilkan di Finder
|
||||
Show in Explorer Tampilkan di Explorer
|
||||
Reveal in Explorer Tampilkan di Explorer
|
||||
Show in Folder Tampilkan di Folder
|
||||
File Info… Info Berkas…
|
||||
Print… Cetak…
|
||||
@@ -310,6 +316,7 @@
|
||||
Units & Rulers… Satuan & Penggaris…
|
||||
Guides, Grid & Slices… Panduan, Grid & Slice…
|
||||
Plug-ins… Plug-in…
|
||||
Plugins… Plug-in…
|
||||
Type… Teks…
|
||||
Enhanced Controls… Kontrol Lanjutan…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -459,6 +466,8 @@
|
||||
Smart Object Smart Object
|
||||
Convert to Smart Object Konversi ke Smart Object
|
||||
Convert to Embedded Konversi ke Tertanam
|
||||
Embed Linked Tanamkan yang Tertaut
|
||||
Embed All Linked Tanamkan Semua yang Tertaut
|
||||
Convert to Layers Konversi ke Layer
|
||||
Convert to Linked… Konversi ke Tertaut…
|
||||
Edit Contents Edit Isi
|
||||
@@ -526,7 +535,9 @@
|
||||
Unite Shapes Satukan Bentuk
|
||||
Subtract Front Shape Kurangi Bentuk Depan
|
||||
Intersect Shape Areas Irisan Area Bentuk
|
||||
Unite Shapes at Overlap Irisan Area Bentuk
|
||||
Exclude Overlapping Shapes Kecualikan Bentuk yang Tumpang Tindih
|
||||
Subtract Shapes at Overlap Kecualikan Bentuk yang Tumpang Tindih
|
||||
Merge Shape Components Gabungkan Komponen Bentuk
|
||||
Path operations Operasi path
|
||||
Align Rata
|
||||
@@ -711,6 +722,7 @@
|
||||
Minimum… Minimum…
|
||||
Offset… Offset…
|
||||
Plug-ins Plug-in
|
||||
Plugins Plug-in
|
||||
Proof Setup Pengaturan Proof
|
||||
Proof Colors Warna Proof
|
||||
Gamut Warning Peringatan Gamut
|
||||
@@ -719,9 +731,9 @@
|
||||
Working Magenta Plate Pelat Magenta Kerja
|
||||
Working Yellow Plate Pelat Kuning Kerja
|
||||
Working Black Plate Pelat Hitam Kerja
|
||||
Working CMY Plate Pelat CMY Kerja
|
||||
Legacy Macintosh RGB RGB Macintosh Lawas
|
||||
Internet Standard RGB RGB Standar Internet
|
||||
Working CMY Plates Pelat CMY Kerja
|
||||
Legacy Macintosh RGB (Gamma 1.8) RGB Macintosh Lawas (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) RGB Standar Internet (sRGB)
|
||||
Monitor RGB RGB Monitor
|
||||
Color Blindness — Protanopia-type Buta Warna — Tipe Protanopia
|
||||
Color Blindness — Deuteranopia-type Buta Warna — Tipe Deuteranopia
|
||||
@@ -813,7 +825,7 @@
|
||||
Consolidate All to Tabs Gabungkan Semua ke Tab
|
||||
Float in Window Mengambang di Jendela
|
||||
Float All in Windows Mengambangkan Semua di Jendela
|
||||
New Window for Document Jendela Baru untuk Dokumen
|
||||
New Window Jendela Baru untuk Dokumen
|
||||
Workspace Ruang Kerja
|
||||
Essentials Esensial
|
||||
Graphic and Web Grafis dan Web
|
||||
@@ -1987,6 +1999,11 @@
|
||||
Show canvas dots Tampilkan titik kanvas
|
||||
Clip thumbnails to layer bounds Pangkas thumbnail ke batas layer
|
||||
Clip Thumbnails to Layer Bounds Pangkas Thumbnail ke Batas Layer
|
||||
No Thumbnails Tanpa Thumbnail
|
||||
Small Thumbnails Thumbnail Kecil
|
||||
Medium Thumbnails Thumbnail Sedang
|
||||
Large Thumbnails Thumbnail Besar
|
||||
Clip Thumbnails to Document Bounds Pangkas Thumbnail ke Batas Dokumen
|
||||
Canvas color Warna kanvas
|
||||
Canvas custom color Warna kustom kanvas
|
||||
Color picker Pemilih warna
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 4 and column 47.
|
@@ -186,6 +186,7 @@
|
||||
Right Destra
|
||||
Open Recent Apri recenti
|
||||
Clear Recent Files Cancella file recenti
|
||||
Clear Recent File List Cancella file recenti
|
||||
Remove from Recent Rimuovi dai recenti
|
||||
Remove {name} from Recent Rimuovi {name} dai recenti
|
||||
Close Chiudi
|
||||
@@ -194,6 +195,10 @@
|
||||
Restore Ripristina
|
||||
Close All Chiudi tutto
|
||||
Close Others Chiudi altri
|
||||
New Document… Nuovo documento…
|
||||
Open Document… Apri…
|
||||
Consolidate All to Here Raggruppa tutto qui
|
||||
Move to New Window Sposta in una nuova finestra
|
||||
Save Salva
|
||||
Save As… Salva con nome…
|
||||
Save a Copy… Salva una copia…
|
||||
@@ -245,6 +250,7 @@
|
||||
Create Smart Object after Loading Layers Crea oggetto avanzato dopo il caricamento dei livelli
|
||||
Reveal in Finder Mostra nel Finder
|
||||
Show in Explorer Mostra in Esplora file
|
||||
Reveal in Explorer Mostra in Esplora file
|
||||
Show in Folder Mostra nella cartella
|
||||
File Info… Info file…
|
||||
Print… Stampa…
|
||||
@@ -333,6 +339,7 @@
|
||||
Units & Rulers… Unità e righelli…
|
||||
Guides, Grid & Slices… Guide, griglia e sezioni…
|
||||
Plug-ins… Plug-in…
|
||||
Plugins… Plug-in…
|
||||
Type… Testo…
|
||||
Enhanced Controls… Controlli avanzati…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -490,6 +497,8 @@
|
||||
Smart Object Oggetto avanzato
|
||||
Convert to Smart Object Converti in oggetto avanzato
|
||||
Convert to Embedded Converti in incorporato
|
||||
Embed Linked Incorpora collegato
|
||||
Embed All Linked Incorpora tutti i collegati
|
||||
Convert to Linked… Converti in oggetto collegato…
|
||||
Edit Contents Modifica contenuto
|
||||
Replace Contents… Sostituisci contenuto…
|
||||
@@ -745,6 +754,7 @@
|
||||
Minimum… Minimo…
|
||||
Offset… Scostamento…
|
||||
Plug-ins Plug-in
|
||||
Plugins Plug-in
|
||||
Proof Setup Configurazione prova
|
||||
Proof Colors Colori di prova
|
||||
Gamut Warning Avviso gamma
|
||||
@@ -753,9 +763,9 @@
|
||||
Working Magenta Plate Lastra magenta di lavoro
|
||||
Working Yellow Plate Lastra gialla di lavoro
|
||||
Working Black Plate Lastra nera di lavoro
|
||||
Working CMY Plate Lastra CMY di lavoro
|
||||
Legacy Macintosh RGB RGB legacy Macintosh
|
||||
Internet Standard RGB RGB standard Internet
|
||||
Working CMY Plates Lastra CMY di lavoro
|
||||
Legacy Macintosh RGB (Gamma 1.8) RGB legacy Macintosh (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) RGB standard Internet (sRGB)
|
||||
Monitor RGB RGB monitor
|
||||
Color Blindness — Protanopia-type Daltonismo — tipo protanopia
|
||||
Color Blindness — Deuteranopia-type Daltonismo — tipo deuteranopia
|
||||
@@ -847,7 +857,6 @@
|
||||
Consolidate All to Tabs Raggruppa tutto in schede
|
||||
Float in Window Flottante in finestra
|
||||
Float All in Windows Flottante tutto in finestre
|
||||
New Window for Document Nuova finestra per documento
|
||||
Workspace Area di lavoro
|
||||
Essentials Essenziali
|
||||
Graphic and Web Grafica e web
|
||||
@@ -2018,6 +2027,11 @@
|
||||
Show canvas dots Mostra punti del quadro
|
||||
Clip thumbnails to layer bounds Ritaglia le miniature ai limiti del livello
|
||||
Clip Thumbnails to Layer Bounds Ritaglia le miniature ai limiti del livello
|
||||
No Thumbnails Nessuna miniatura
|
||||
Small Thumbnails Miniature piccole
|
||||
Medium Thumbnails Miniature medie
|
||||
Large Thumbnails Miniature grandi
|
||||
Clip Thumbnails to Document Bounds Ritaglia le miniature ai limiti del documento
|
||||
Canvas color Colore quadro
|
||||
Canvas custom color Colore personalizzato quadro
|
||||
Color picker Selettore colore
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 79 and column 53.
|
@@ -195,6 +195,7 @@
|
||||
Right 右
|
||||
Open Recent 最近使ったファイルを開く
|
||||
Clear Recent Files 最近使ったファイルを消去
|
||||
Clear Recent File List 最近使ったファイルを消去
|
||||
Remove from Recent 最近使ったファイルから削除
|
||||
Remove {name} from Recent {name} を最近使ったファイルから削除
|
||||
Close 閉じる
|
||||
@@ -203,6 +204,10 @@
|
||||
Restore 元に戻す (縮小)
|
||||
Close All すべて閉じる
|
||||
Close Others ほかを閉じる
|
||||
New Document… 新規ドキュメント…
|
||||
Open Document… 開く…
|
||||
Consolidate All to Here すべてをここに統合
|
||||
Move to New Window 新規ウィンドウに移動
|
||||
Save 保存
|
||||
Save As… 名前を付けて保存…
|
||||
Save a Copy… コピーを保存…
|
||||
@@ -255,6 +260,7 @@
|
||||
Create Smart Object after Loading Layers レイヤーの読み込み後にスマートオブジェクトを作成
|
||||
Reveal in Finder Finder で表示
|
||||
Show in Explorer エクスプローラーで表示
|
||||
Reveal in Explorer エクスプローラーで表示
|
||||
Show in Folder フォルダーで表示
|
||||
File Info… ファイル情報…
|
||||
Print… プリント…
|
||||
@@ -343,6 +349,7 @@
|
||||
Units & Rulers… 単位・定規…
|
||||
Guides, Grid & Slices… ガイド・グリッド・スライス…
|
||||
Plug-ins… プラグイン…
|
||||
Plugins… プラグイン…
|
||||
Type… 文字…
|
||||
Enhanced Controls… 拡張コントロール…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -499,6 +506,8 @@
|
||||
Smart Object スマートオブジェクト
|
||||
Convert to Smart Object スマートオブジェクトに変換
|
||||
Convert to Embedded 埋め込みに変換
|
||||
Embed Linked リンクを埋め込む
|
||||
Embed All Linked すべてのリンクを埋め込む
|
||||
Convert to Layers レイヤーに変換
|
||||
Convert to Linked… リンクに変換…
|
||||
Edit Contents コンテンツを編集
|
||||
@@ -572,7 +581,9 @@
|
||||
Unite Shapes シェイプを結合
|
||||
Subtract Front Shape 前面シェイプで型抜き
|
||||
Intersect Shape Areas シェイプの重なりを抽出
|
||||
Unite Shapes at Overlap シェイプの重なりを抽出
|
||||
Exclude Overlapping Shapes シェイプの重なりを除外
|
||||
Subtract Shapes at Overlap シェイプの重なりを除外
|
||||
Merge Shape Components シェイプの構成要素を結合
|
||||
Path operations パスの操作
|
||||
Align 整列
|
||||
@@ -756,6 +767,7 @@
|
||||
Minimum… 最小値…
|
||||
Offset… オフセット…
|
||||
Plug-ins プラグイン
|
||||
Plugins プラグイン
|
||||
Proof Setup 校正設定
|
||||
Proof Colors 色の校正
|
||||
Gamut Warning 色域外警告
|
||||
@@ -764,9 +776,9 @@
|
||||
Working Magenta Plate 作業用マゼンタ版
|
||||
Working Yellow Plate 作業用イエロー版
|
||||
Working Black Plate 作業用ブラック版
|
||||
Working CMY Plate 作業用 CMY 版
|
||||
Legacy Macintosh RGB 旧 Macintosh RGB
|
||||
Internet Standard RGB インターネット標準 RGB
|
||||
Working CMY Plates 作業用 CMY 版
|
||||
Legacy Macintosh RGB (Gamma 1.8) 旧 Macintosh RGB (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) インターネット標準 RGB (sRGB)
|
||||
Monitor RGB モニター RGB
|
||||
Color Blindness — Protanopia-type 色覚特性 — 1 型(P 型)
|
||||
Color Blindness — Deuteranopia-type 色覚特性 — 2 型(D 型)
|
||||
@@ -858,7 +870,7 @@
|
||||
Consolidate All to Tabs すべてをタブに統合
|
||||
Float in Window ウィンドウ内に浮動
|
||||
Float All in Windows すべてをウィンドウ内に浮動
|
||||
New Window for Document ドキュメントの新規ウィンドウ
|
||||
New Window ドキュメントの新規ウィンドウ
|
||||
Workspace ワークスペース
|
||||
Essentials 基本
|
||||
Graphic and Web グラフィックと Web
|
||||
@@ -2026,6 +2038,11 @@
|
||||
Show canvas dots カンバスのドットを表示
|
||||
Clip thumbnails to layer bounds サムネールをレイヤーの境界でクリップ
|
||||
Clip Thumbnails to Layer Bounds サムネールをレイヤーの境界でクリップ
|
||||
No Thumbnails サムネールなし
|
||||
Small Thumbnails 小さいサムネール
|
||||
Medium Thumbnails 中サイズのサムネール
|
||||
Large Thumbnails 大きいサムネール
|
||||
Clip Thumbnails to Document Bounds サムネールをドキュメントの境界でクリップ
|
||||
Canvas color カンバスの色
|
||||
Canvas custom color カンバスのカスタム色
|
||||
Color picker カラーピッカー
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -166,6 +166,7 @@
|
||||
Right 오른쪽
|
||||
Open Recent 최근 파일 열기
|
||||
Clear Recent Files 최근 파일 목록 지우기
|
||||
Clear Recent File List 최근 파일 목록 지우기
|
||||
Remove from Recent 최근 항목에서 제거
|
||||
Remove {name} from Recent 최근 항목에서 {name} 제거
|
||||
Close 닫기
|
||||
@@ -174,6 +175,10 @@
|
||||
Restore 이전 크기로 복원
|
||||
Close All 모두 닫기
|
||||
Close Others 다른 문서 닫기
|
||||
New Document… 새 문서…
|
||||
Open Document… 열기…
|
||||
Consolidate All to Here 모두 여기로 통합
|
||||
Move to New Window 새 창으로 이동
|
||||
Save 저장
|
||||
Save As… 다른 이름으로 저장…
|
||||
Save a Copy… 사본 저장…
|
||||
@@ -226,6 +231,7 @@
|
||||
Create Smart Object after Loading Layers 레이어를 불러온 후 스마트 오브젝트 만들기
|
||||
Reveal in Finder Finder에서 보기
|
||||
Show in Explorer 파일 탐색기에서 보기
|
||||
Reveal in Explorer 파일 탐색기에서 보기
|
||||
Show in Folder 폴더에서 보기
|
||||
File Info… 파일 정보…
|
||||
Print… 인쇄…
|
||||
@@ -314,6 +320,7 @@
|
||||
Units & Rulers… 단위 및 눈금자…
|
||||
Guides, Grid & Slices… 안내선, 격자 및 분할 영역…
|
||||
Plug-ins… 플러그인…
|
||||
Plugins… 플러그인…
|
||||
Type… 문자…
|
||||
Enhanced Controls… 고급 컨트롤…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -464,6 +471,8 @@
|
||||
Smart Object 스마트 오브젝트
|
||||
Convert to Smart Object 스마트 오브젝트로 변환
|
||||
Convert to Embedded 포함된 오브젝트로 변환
|
||||
Embed Linked 연결된 항목 포함
|
||||
Embed All Linked 모든 연결된 항목 포함
|
||||
Convert to Layers 레이어로 변환
|
||||
Convert to Linked… 연결된 오브젝트로 변환…
|
||||
Edit Contents 내용 편집
|
||||
@@ -537,7 +546,9 @@
|
||||
Unite Shapes 모양 합치기
|
||||
Subtract Front Shape 앞쪽 모양 빼기
|
||||
Intersect Shape Areas 모양 영역 교차
|
||||
Unite Shapes at Overlap 모양 영역 교차
|
||||
Exclude Overlapping Shapes 겹치는 모양 제외
|
||||
Subtract Shapes at Overlap 겹치는 모양 제외
|
||||
Merge Shape Components 모양 구성 요소 병합
|
||||
Path operations 패스 작업
|
||||
Align 정렬
|
||||
@@ -721,6 +732,7 @@
|
||||
Minimum… 최소값…
|
||||
Offset… 오프셋…
|
||||
Plug-ins 플러그인
|
||||
Plugins 플러그인
|
||||
Proof Setup 교정 설정
|
||||
Proof Colors 교정 색상
|
||||
Gamut Warning 색상 범위 경고
|
||||
@@ -729,9 +741,9 @@
|
||||
Working Magenta Plate 작업용 마젠타 판
|
||||
Working Yellow Plate 작업용 노랑 판
|
||||
Working Black Plate 작업용 검정 판
|
||||
Working CMY Plate 작업용 CMY 판
|
||||
Legacy Macintosh RGB 기존 Macintosh RGB
|
||||
Internet Standard RGB 인터넷 표준 RGB
|
||||
Working CMY Plates 작업용 CMY 판
|
||||
Legacy Macintosh RGB (Gamma 1.8) 기존 Macintosh RGB (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) 인터넷 표준 RGB (sRGB)
|
||||
Monitor RGB 모니터 RGB
|
||||
Color Blindness — Protanopia-type 색각 이상 — 적색맹
|
||||
Color Blindness — Deuteranopia-type 색각 이상 — 녹색맹
|
||||
@@ -813,7 +825,7 @@
|
||||
Consolidate All to Tabs 모두 탭으로 통합
|
||||
Float in Window 별도 창으로 띄우기
|
||||
Float All in Windows 모두 별도 창으로 띄우기
|
||||
New Window for Document 문서의 새 창
|
||||
New Window 문서의 새 창
|
||||
Workspace 작업 영역
|
||||
Essentials 필수
|
||||
Graphic and Web 그래픽 및 웹
|
||||
@@ -1999,6 +2011,11 @@
|
||||
Show canvas dots 캔버스 점 표시
|
||||
Clip thumbnails to layer bounds 썸네일을 레이어 경계로 자르기
|
||||
Clip Thumbnails to Layer Bounds 썸네일을 레이어 경계로 자르기
|
||||
No Thumbnails 썸네일 없음
|
||||
Small Thumbnails 작은 썸네일
|
||||
Medium Thumbnails 중간 썸네일
|
||||
Large Thumbnails 큰 썸네일
|
||||
Clip Thumbnails to Document Bounds 썸네일을 문서 경계로 자르기
|
||||
Canvas color 캔버스 색상
|
||||
Canvas custom color 캔버스 사용자 정의 색상
|
||||
Color picker 색상 피커
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 63 and column 53.
|
@@ -86,6 +86,7 @@
|
||||
Right Høyre
|
||||
Open Recent Åpne nylig brukte
|
||||
Clear Recent Files Tøm nylig brukte filer
|
||||
Clear Recent File List Tøm nylig brukte filer
|
||||
Remove from Recent Fjern fra nylig brukte
|
||||
Remove {name} from Recent Fjern {name} fra nylig brukte
|
||||
Close Lukk
|
||||
@@ -94,6 +95,10 @@
|
||||
Restore Gjenopprett
|
||||
Close All Lukk alle
|
||||
Close Others Lukk andre
|
||||
New Document… Nytt dokument…
|
||||
Open Document… Åpne…
|
||||
Consolidate All to Here Samle alle her
|
||||
Move to New Window Flytt til nytt vindu
|
||||
Save Lagre
|
||||
Save As… Lagre som…
|
||||
Save a Copy… Lagre en kopi…
|
||||
@@ -508,7 +513,6 @@
|
||||
Match Location Samkjør plassering
|
||||
Match Rotation Samkjør rotasjon
|
||||
Match All Samkjør alle
|
||||
New Window for Document Nytt vindu for dokument
|
||||
Workspace Arbeidsområde
|
||||
Extensions Utvidelser
|
||||
Panels Paneler
|
||||
@@ -686,6 +690,7 @@
|
||||
Units & Rulers… Enheter og linjaler…
|
||||
Guides, Grid & Slices… Hjelpelinjer, rutenett og segmenter…
|
||||
Plug-ins… Programtillegg…
|
||||
Plugins… Programtillegg…
|
||||
Technology Previews Teknologiforhåndsvisninger
|
||||
Scratch Disks… Arbeidsdisker…
|
||||
Export Preferences… Eksportinnstillinger…
|
||||
@@ -920,8 +925,8 @@
|
||||
ACES ACES
|
||||
Industry Standard Bransjestandard
|
||||
Web Web
|
||||
Internet Standard RGB Internettstandard RGB
|
||||
Legacy Macintosh RGB Eldre Macintosh RGB
|
||||
Internet Standard RGB (sRGB) Internettstandard RGB (sRGB)
|
||||
Legacy Macintosh RGB (Gamma 1.8) Eldre Macintosh RGB (Gamma 1.8)
|
||||
Monitor RGB Skjerm-RGB
|
||||
Windows LCD Windows LCD
|
||||
Coated CMYK Bestrøket CMYK
|
||||
@@ -1742,6 +1747,7 @@
|
||||
Saved Lagret
|
||||
Reveal in Finder Vis i Finder
|
||||
Show in Explorer Vis i Utforsker
|
||||
Reveal in Explorer Vis i Utforsker
|
||||
Show in Folder Vis i mappe
|
||||
Before (Y) Før (Y)
|
||||
Save Settings… Lagre innstillinger…
|
||||
@@ -1921,6 +1927,8 @@
|
||||
Combine Shapes Kombiner former
|
||||
Contract… Trekk sammen…
|
||||
Convert to Embedded Konverter til innebygd
|
||||
Embed Linked Bygg inn koblet
|
||||
Embed All Linked Bygg inn alle koblede
|
||||
Convert to Layers Konverter til lag
|
||||
Convert to Linked… Konverter til koblet…
|
||||
Count Telling
|
||||
@@ -2008,6 +2016,7 @@
|
||||
Pixelate Pikseler
|
||||
Place Scale Marker… Plasser skalamarkør…
|
||||
Plug-ins Programtillegg
|
||||
Plugins Programtillegg
|
||||
Print One Copy Skriv ut ett eksemplar
|
||||
Print… Skriv ut…
|
||||
Range Område
|
||||
@@ -2052,7 +2061,7 @@
|
||||
Vertical Centers Loddrette sentre
|
||||
Video Frames to Layers… Videorammer til lag…
|
||||
WIA Support… WIA-støtte…
|
||||
Working CMY Plate Arbeidsplate for CMY
|
||||
Working CMY Plates Arbeidsplate for CMY
|
||||
|
||||
# tl! literals (third pass)
|
||||
Absolute Absolutt
|
||||
@@ -2338,6 +2347,11 @@
|
||||
Show canvas dots Vis lerretprikker
|
||||
Clip thumbnails to layer bounds Klipp miniatyrer til laggrensene
|
||||
Clip Thumbnails to Layer Bounds Klipp miniatyrer til laggrensene
|
||||
No Thumbnails Ingen miniatyrer
|
||||
Small Thumbnails Små miniatyrer
|
||||
Medium Thumbnails Middels miniatyrer
|
||||
Large Thumbnails Store miniatyrer
|
||||
Clip Thumbnails to Document Bounds Klipp miniatyrer til dokumentgrensene
|
||||
Canvas color Lerretfarge
|
||||
Canvas custom color Egendefinert lerretfarge
|
||||
Classic Klassisk
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -128,6 +128,7 @@
|
||||
Right Rechts
|
||||
Open Recent Recent geopend
|
||||
Clear Recent Files Recente bestanden wissen
|
||||
Clear Recent File List Recente bestanden wissen
|
||||
Remove from Recent Verwijderen uit recente bestanden
|
||||
Remove {name} from Recent {name} verwijderen uit recente bestanden
|
||||
Close Sluiten
|
||||
@@ -136,6 +137,10 @@
|
||||
Restore Herstellen
|
||||
Close All Alles sluiten
|
||||
Close Others Andere sluiten
|
||||
New Document… Nieuw document…
|
||||
Open Document… Openen…
|
||||
Consolidate All to Here Alles hier samenvoegen
|
||||
Move to New Window Verplaatsen naar nieuw venster
|
||||
Save Opslaan
|
||||
Save As… Opslaan als…
|
||||
Save a Copy… Kopie opslaan…
|
||||
@@ -187,6 +192,7 @@
|
||||
Create Smart Object after Loading Layers Slim object maken na laden van lagen
|
||||
Reveal in Finder Weergeven in Finder
|
||||
Show in Explorer Weergeven in Verkenner
|
||||
Reveal in Explorer Weergeven in Verkenner
|
||||
Show in Folder Weergeven in map
|
||||
File Info… Bestandsinformatie…
|
||||
Print… Afdrukken…
|
||||
@@ -275,6 +281,7 @@
|
||||
Units & Rulers… Eenheden en linialen…
|
||||
Guides, Grid & Slices… Hulplijnen, raster en segmenten…
|
||||
Plug-ins… Plug-ins…
|
||||
Plugins… Plug-ins…
|
||||
Type… Tekst…
|
||||
Enhanced Controls… Uitgebreide bediening…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -431,6 +438,8 @@
|
||||
Smart Object Slim object
|
||||
Convert to Smart Object Omzetten naar slim object
|
||||
Convert to Embedded Omzetten naar ingesloten
|
||||
Embed Linked Gekoppeld insluiten
|
||||
Embed All Linked Alles gekoppeld insluiten
|
||||
Convert to Layers Omzetten naar lagen
|
||||
Convert to Linked… Omzetten naar gekoppeld…
|
||||
Edit Contents Inhoud bewerken
|
||||
@@ -504,7 +513,9 @@
|
||||
Unite Shapes Vormen verenigen
|
||||
Subtract Front Shape Voorste vorm aftrekken
|
||||
Intersect Shape Areas Overlappende vormgebieden
|
||||
Unite Shapes at Overlap Overlappende vormgebieden
|
||||
Exclude Overlapping Shapes Overlappende vormen uitsluiten
|
||||
Subtract Shapes at Overlap Overlappende vormen uitsluiten
|
||||
Merge Shape Components Vormcomponenten samenvoegen
|
||||
Path operations Padbewerkingen
|
||||
Align Uitlijnen
|
||||
@@ -687,6 +698,7 @@
|
||||
Minimum… Minimum…
|
||||
Offset… Verschuiving…
|
||||
Plug-ins Plug-ins
|
||||
Plugins Plug-ins
|
||||
Proof Setup Proefinstellingen
|
||||
Proof Colors Proefkleuren
|
||||
Gamut Warning Waarschuwing kleurbereik
|
||||
@@ -695,9 +707,9 @@
|
||||
Working Magenta Plate Werkplaat magenta
|
||||
Working Yellow Plate Werkplaat geel
|
||||
Working Black Plate Werkplaat zwart
|
||||
Working CMY Plate Werkplaat CMY
|
||||
Legacy Macintosh RGB Verouderde Macintosh RGB
|
||||
Internet Standard RGB Internetstandaard RGB
|
||||
Working CMY Plates Werkplaat CMY
|
||||
Legacy Macintosh RGB (Gamma 1.8) Verouderde Macintosh RGB (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) Internetstandaard RGB (sRGB)
|
||||
Monitor RGB Monitor-RGB
|
||||
Color Blindness — Protanopia-type Kleurenblindheid — type protanopie
|
||||
Color Blindness — Deuteranopia-type Kleurenblindheid — type deuteranopie
|
||||
@@ -779,7 +791,6 @@
|
||||
Consolidate All to Tabs Alles samenvoegen in tabbladen
|
||||
Float in Window Zwevend in venster
|
||||
Float All in Windows Alles zwevend in vensters
|
||||
New Window for Document Nieuw venster voor document
|
||||
Workspace Werkruimte
|
||||
Essentials Basis
|
||||
Graphic and Web Grafisch en web
|
||||
@@ -1948,6 +1959,11 @@
|
||||
Show canvas dots Canvasstippen tonen
|
||||
Clip thumbnails to layer bounds Miniaturen bijsnijden tot laaggrenzen
|
||||
Clip Thumbnails to Layer Bounds Miniaturen bijsnijden tot laaggrenzen
|
||||
No Thumbnails Geen miniaturen
|
||||
Small Thumbnails Kleine miniaturen
|
||||
Medium Thumbnails Middelgrote miniaturen
|
||||
Large Thumbnails Grote miniaturen
|
||||
Clip Thumbnails to Document Bounds Miniaturen bijsnijden tot documentgrenzen
|
||||
Canvas color Canvaskleur
|
||||
Canvas custom color Aangepaste canvaskleur
|
||||
Color picker Kleurkiezer
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 34.
|
@@ -171,6 +171,7 @@
|
||||
Right Prawa
|
||||
Open Recent Otwórz ostatnie
|
||||
Clear Recent Files Wyczyść listę ostatnich plików
|
||||
Clear Recent File List Wyczyść listę ostatnich plików
|
||||
Remove from Recent Usuń z ostatnich plików
|
||||
Remove {name} from Recent Usuń {name} z ostatnich plików
|
||||
Close Zamknij
|
||||
@@ -179,6 +180,10 @@
|
||||
Restore Przywróć
|
||||
Close All Zamknij wszystko
|
||||
Close Others Zamknij pozostałe
|
||||
New Document… Nowy dokument…
|
||||
Open Document… Otwórz…
|
||||
Consolidate All to Here Połącz wszystko tutaj
|
||||
Move to New Window Przenieś do nowego okna
|
||||
Save Zapisz
|
||||
Save As… Zapisz jako…
|
||||
Save a Copy… Zapisz kopię…
|
||||
@@ -231,6 +236,7 @@
|
||||
Create Smart Object after Loading Layers Utwórz obiekt inteligentny po wczytaniu warstw
|
||||
Reveal in Finder Pokaż w Finderze
|
||||
Show in Explorer Pokaż w Eksploratorze
|
||||
Reveal in Explorer Pokaż w Eksploratorze
|
||||
Show in Folder Pokaż w folderze
|
||||
File Info… Informacje o pliku…
|
||||
Print… Drukuj…
|
||||
@@ -318,6 +324,7 @@
|
||||
Units & Rulers… Jednostki i linijki…
|
||||
Guides, Grid & Slices… Prowadnice, siatka i plasterki…
|
||||
Plug-ins… Wtyczki…
|
||||
Plugins… Wtyczki…
|
||||
Type… Tekst…
|
||||
Enhanced Controls… Ulepszone elementy sterujące…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -474,6 +481,8 @@
|
||||
Smart Object Obiekt inteligentny
|
||||
Convert to Smart Object Konwertuj na obiekt inteligentny
|
||||
Convert to Embedded Konwertuj na osadzony
|
||||
Embed Linked Osadź połączony
|
||||
Embed All Linked Osadź wszystkie połączone
|
||||
Convert to Layers Konwertuj na warstwy
|
||||
Convert to Linked… Konwertuj na połączony…
|
||||
Edit Contents Edytuj zawartość
|
||||
@@ -547,7 +556,9 @@
|
||||
Unite Shapes Złącz kształty
|
||||
Subtract Front Shape Odejmij kształt z przodu
|
||||
Intersect Shape Areas Część wspólna obszarów kształtów
|
||||
Unite Shapes at Overlap Część wspólna obszarów kształtów
|
||||
Exclude Overlapping Shapes Wyklucz nakładające się kształty
|
||||
Subtract Shapes at Overlap Wyklucz nakładające się kształty
|
||||
Merge Shape Components Scal składniki kształtu
|
||||
Path operations Operacje na ścieżkach
|
||||
Align Wyrównaj
|
||||
@@ -732,6 +743,7 @@
|
||||
Minimum… Minimum…
|
||||
Offset… Przesunięcie…
|
||||
Plug-ins Wtyczki
|
||||
Plugins Wtyczki
|
||||
Proof Setup Ustawienia próbnego wydruku
|
||||
Proof Colors Kolory próbne
|
||||
Gamut Warning Ostrzeżenie o gamucie
|
||||
@@ -740,9 +752,9 @@
|
||||
Working Magenta Plate Robocza płyta magenty
|
||||
Working Yellow Plate Robocza płyta żółci
|
||||
Working Black Plate Robocza płyta czerni
|
||||
Working CMY Plate Robocza płyta CMY
|
||||
Legacy Macintosh RGB Starszy Macintosh RGB
|
||||
Internet Standard RGB Standardowy RGB dla Internetu
|
||||
Working CMY Plates Robocza płyta CMY
|
||||
Legacy Macintosh RGB (Gamma 1.8) Starszy Macintosh RGB (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) Standardowy RGB dla Internetu (sRGB)
|
||||
Monitor RGB RGB monitora
|
||||
Color Blindness — Protanopia-type Ślepota barw — typ protanopii
|
||||
Color Blindness — Deuteranopia-type Ślepota barw — typ deuteranopii
|
||||
@@ -834,7 +846,7 @@
|
||||
Consolidate All to Tabs Połącz wszystko w karty
|
||||
Float in Window Odłącz do okna
|
||||
Float All in Windows Odłącz wszystko do okien
|
||||
New Window for Document Nowe okno dla dokumentu
|
||||
New Window Nowe okno dla dokumentu
|
||||
Workspace Obszar roboczy
|
||||
Essentials Podstawowe
|
||||
Graphic and Web Grafika i Internet
|
||||
@@ -2012,6 +2024,11 @@
|
||||
Show canvas dots Pokaż kropki płótna
|
||||
Clip thumbnails to layer bounds Przycinaj miniatury do granic warstwy
|
||||
Clip Thumbnails to Layer Bounds Przycinaj miniatury do granic warstwy
|
||||
No Thumbnails Bez miniaturek
|
||||
Small Thumbnails Małe miniaturki
|
||||
Medium Thumbnails Średnie miniaturki
|
||||
Large Thumbnails Duże miniaturki
|
||||
Clip Thumbnails to Document Bounds Przycinaj miniatury do granic dokumentu
|
||||
Canvas color Kolor płótna
|
||||
Canvas custom color Własny kolor płótna
|
||||
Color picker Próbnik kolorów
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -168,6 +168,7 @@
|
||||
Right Direita
|
||||
Open Recent Abrir recentes
|
||||
Clear Recent Files Limpar arquivos recentes
|
||||
Clear Recent File List Limpar arquivos recentes
|
||||
Remove from Recent Remover dos recentes
|
||||
Remove {name} from Recent Remover {name} dos recentes
|
||||
Close Fechar
|
||||
@@ -176,6 +177,10 @@
|
||||
Restore Restaurar
|
||||
Close All Fechar tudo
|
||||
Close Others Fechar outros
|
||||
New Document… Novo documento…
|
||||
Open Document… Abrir…
|
||||
Consolidate All to Here Consolidar tudo aqui
|
||||
Move to New Window Mover para nova janela
|
||||
Save Salvar
|
||||
Save As… Salvar como…
|
||||
Save a Copy… Salvar uma cópia…
|
||||
@@ -227,6 +232,7 @@
|
||||
Create Smart Object after Loading Layers Criar objeto inteligente após carregar as camadas
|
||||
Reveal in Finder Mostrar no Finder
|
||||
Show in Explorer Mostrar no Explorador
|
||||
Reveal in Explorer Mostrar no Explorador
|
||||
Show in Folder Mostrar na pasta
|
||||
File Info… Informações do arquivo…
|
||||
Print… Imprimir…
|
||||
@@ -313,6 +319,7 @@
|
||||
Units & Rulers… Unidades e réguas…
|
||||
Guides, Grid & Slices… Guias, grade e fatias…
|
||||
Plug-ins… Plug-ins…
|
||||
Plugins… Plug-ins…
|
||||
Type… Tipo…
|
||||
Enhanced Controls… Controles aprimorados…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -462,6 +469,8 @@
|
||||
Smart Object Objeto inteligente
|
||||
Convert to Smart Object Converter em objeto inteligente
|
||||
Convert to Embedded Converter em incorporado
|
||||
Embed Linked Incorporar vinculado
|
||||
Embed All Linked Incorporar todos os vinculados
|
||||
Convert to Layers Converter em camadas
|
||||
Convert to Linked… Converter em vinculado…
|
||||
Edit Contents Editar conteúdo
|
||||
@@ -712,6 +721,7 @@
|
||||
Minimum… Mínimo…
|
||||
Offset… Deslocamento…
|
||||
Plug-ins Plug-ins
|
||||
Plugins Plug-ins
|
||||
Proof Setup Configuração de prova
|
||||
Proof Colors Cores de prova
|
||||
Gamut Warning Aviso de gama
|
||||
@@ -720,9 +730,9 @@
|
||||
Working Magenta Plate Chapa magenta de trabalho
|
||||
Working Yellow Plate Chapa amarela de trabalho
|
||||
Working Black Plate Chapa preta de trabalho
|
||||
Working CMY Plate Chapa CMY de trabalho
|
||||
Legacy Macintosh RGB RGB Macintosh legado
|
||||
Internet Standard RGB RGB padrão da Internet
|
||||
Working CMY Plates Chapa CMY de trabalho
|
||||
Legacy Macintosh RGB (Gamma 1.8) RGB Macintosh legado (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) RGB padrão da Internet (sRGB)
|
||||
Monitor RGB RGB do monitor
|
||||
Color Blindness — Protanopia-type Daltonismo — tipo protanopia
|
||||
Color Blindness — Deuteranopia-type Daltonismo — tipo deuteranopia
|
||||
@@ -814,7 +824,6 @@
|
||||
Consolidate All to Tabs Consolidar tudo em guias
|
||||
Float in Window Flutuar na janela
|
||||
Float All in Windows Flutuar tudo em janelas
|
||||
New Window for Document Nova janela para o documento
|
||||
Workspace Espaço de trabalho
|
||||
Essentials Essenciais
|
||||
Graphic and Web Gráficos e Web
|
||||
@@ -1973,6 +1982,11 @@
|
||||
Show canvas dots Mostrar pontos da tela de pintura
|
||||
Clip thumbnails to layer bounds Recortar miniaturas aos limites da camada
|
||||
Clip Thumbnails to Layer Bounds Recortar miniaturas aos limites da camada
|
||||
No Thumbnails Sem miniaturas
|
||||
Small Thumbnails Miniaturas pequenas
|
||||
Medium Thumbnails Miniaturas médias
|
||||
Large Thumbnails Miniaturas grandes
|
||||
Clip Thumbnails to Document Bounds Recortar miniaturas aos limites do documento
|
||||
Canvas color Cor da tela de pintura
|
||||
Canvas custom color Cor personalizada da tela de pintura
|
||||
Color picker Seletor de cores
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -272,6 +272,7 @@
|
||||
Right Правый
|
||||
Open Recent Открыть недавние
|
||||
Clear Recent Files Очистить список недавних файлов
|
||||
Clear Recent File List Очистить список недавних файлов
|
||||
Remove from Recent Удалить из недавних
|
||||
Remove {name} from Recent Удалить {name} из недавних
|
||||
Close Закрыть
|
||||
@@ -280,6 +281,10 @@
|
||||
Restore Свернуть в окно
|
||||
Close All Закрыть все
|
||||
Close Others Закрыть остальные
|
||||
New Document… Новый документ…
|
||||
Open Document… Открыть…
|
||||
Consolidate All to Here Объединить всё здесь
|
||||
Move to New Window Переместить в новое окно
|
||||
Save Сохранить
|
||||
Save As… Сохранить как…
|
||||
Save a Copy… Сохранить копию…
|
||||
@@ -676,7 +681,6 @@
|
||||
Match Location Согласовать положение
|
||||
Match Rotation Согласовать поворот
|
||||
Match All Согласовать всё
|
||||
New Window for Document Новое окно документа
|
||||
Workspace Рабочая среда
|
||||
Extensions Расширения
|
||||
Panels Панели
|
||||
@@ -846,6 +850,7 @@
|
||||
Units & Rulers… Единицы и линейки…
|
||||
Guides, Grid & Slices… Направляющие, сетка и фрагменты…
|
||||
Plug-ins… Плагины…
|
||||
Plugins… Плагины…
|
||||
Technology Previews Предпросмотр технологий
|
||||
Scratch Disks… Рабочие диски…
|
||||
Export Preferences… Экспорт настроек…
|
||||
@@ -1068,8 +1073,8 @@
|
||||
ACES ACES
|
||||
Industry Standard Отраслевой стандарт
|
||||
Web Web
|
||||
Internet Standard RGB Стандартный RGB для Интернета
|
||||
Legacy Macintosh RGB Устаревший RGB Macintosh
|
||||
Internet Standard RGB (sRGB) Стандартный RGB для Интернета (sRGB)
|
||||
Legacy Macintosh RGB (Gamma 1.8) Устаревший RGB Macintosh (Gamma 1.8)
|
||||
Monitor RGB Монитор RGB
|
||||
Windows LCD Windows LCD
|
||||
Coated CMYK Мелованная бумага CMYK
|
||||
@@ -1853,6 +1858,7 @@
|
||||
Saved Сохранено
|
||||
Reveal in Finder Показать в Finder
|
||||
Show in Explorer Показать в Проводнике
|
||||
Reveal in Explorer Показать в Проводнике
|
||||
Show in Folder Показать в папке
|
||||
Before (Y) До (Y)
|
||||
Save Settings… Сохранить настройки…
|
||||
@@ -2018,6 +2024,8 @@
|
||||
Combine Shapes Комбинировать фигуры
|
||||
Contract… Сжать…
|
||||
Convert to Embedded Преобразовать во встроенный
|
||||
Embed Linked Встроить связанный
|
||||
Embed All Linked Встроить все связанные
|
||||
Convert to Layers Преобразовать в слои
|
||||
Convert to Linked… Преобразовать в связанный…
|
||||
Count Счёт
|
||||
@@ -2106,6 +2114,7 @@
|
||||
Pixelate Оформление пикселями
|
||||
Place Scale Marker… Шкала масштаба…
|
||||
Plug-ins Плагины
|
||||
Plugins Плагины
|
||||
Print One Copy Печать одной копии
|
||||
Print… Печать…
|
||||
Range Диапазон
|
||||
@@ -2150,7 +2159,7 @@
|
||||
Vertical Centers Центры по вертикали
|
||||
Video Frames to Layers… Видеокадры в слои…
|
||||
WIA Support… Поддержка WIA…
|
||||
Working CMY Plate Рабочая голубая форма
|
||||
Working CMY Plates Рабочая голубая форма
|
||||
Absolute Абсолютный
|
||||
Action Операция
|
||||
Adaptive Адаптивный
|
||||
@@ -2431,6 +2440,11 @@
|
||||
Show canvas dots Показывать точки холста
|
||||
Clip thumbnails to layer bounds Обрезать миниатюры по границам слоя
|
||||
Clip Thumbnails to Layer Bounds Обрезать миниатюры по границам слоя
|
||||
No Thumbnails Без миниатюр
|
||||
Small Thumbnails Мелкие миниатюры
|
||||
Medium Thumbnails Средние миниатюры
|
||||
Large Thumbnails Крупные миниатюры
|
||||
Clip Thumbnails to Document Bounds Обрезать миниатюры по границам документа
|
||||
Canvas color Цвет холста
|
||||
Canvas custom color Свой цвет холста
|
||||
Classic Классическая
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -196,6 +196,7 @@
|
||||
Right Desno
|
||||
Open Recent Otvori nedavno
|
||||
Clear Recent Files Obriši spisak nedavnih datoteka
|
||||
Clear Recent File List Obriši spisak nedavnih datoteka
|
||||
Remove from Recent Ukloni iz nedavnih
|
||||
Remove {name} from Recent Ukloni {name} iz nedavnih
|
||||
Close Zatvori
|
||||
@@ -204,6 +205,10 @@
|
||||
Restore Vrati
|
||||
Close All Zatvori sve
|
||||
Close Others Zatvori ostale
|
||||
New Document… Novi dokument…
|
||||
Open Document… Otvori…
|
||||
Consolidate All to Here Objedini sve ovde
|
||||
Move to New Window Premesti u novi prozor
|
||||
Save Sačuvaj
|
||||
Save As… Sačuvaj kao…
|
||||
Save a Copy… Sačuvaj kopiju…
|
||||
@@ -255,6 +260,7 @@
|
||||
Create Smart Object after Loading Layers Napravi pametni objekat posle učitavanja slojeva
|
||||
Reveal in Finder Prikaži u Finderu
|
||||
Show in Explorer Prikaži u Exploreru
|
||||
Reveal in Explorer Prikaži u Exploreru
|
||||
Show in Folder Prikaži u fascikli
|
||||
File Info… Informacije o datoteci…
|
||||
Print… Štampaj…
|
||||
@@ -339,6 +345,7 @@
|
||||
Units & Rulers… Jedinice i lenjiri…
|
||||
Guides, Grid & Slices… Vodilje, mreža i isečci…
|
||||
Plug-ins… Dodaci…
|
||||
Plugins… Dodaci…
|
||||
Type… Tekst…
|
||||
Enhanced Controls… Napredne kontrole…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -487,6 +494,8 @@
|
||||
Smart Object Pametni objekat
|
||||
Convert to Smart Object Pretvori u pametni objekat
|
||||
Convert to Embedded Pretvori u ugrađeni
|
||||
Embed Linked Ugradi povezani
|
||||
Embed All Linked Ugradi sve povezane
|
||||
Convert to Layers Pretvori u slojeve
|
||||
Convert to Linked… Pretvori u povezani…
|
||||
Edit Contents Uredi sadržaj
|
||||
@@ -738,6 +747,7 @@
|
||||
Minimum… Minimum…
|
||||
Offset… Pomak…
|
||||
Plug-ins Dodaci
|
||||
Plugins Dodaci
|
||||
Proof Setup Podešavanje probnog prikaza
|
||||
Proof Colors Probne boje
|
||||
Gamut Warning Upozorenje o gamutu
|
||||
@@ -746,9 +756,9 @@
|
||||
Working Magenta Plate Radna magenta ploča
|
||||
Working Yellow Plate Radna žuta ploča
|
||||
Working Black Plate Radna crna ploča
|
||||
Working CMY Plate Radna CMY ploča
|
||||
Legacy Macintosh RGB Stari Macintosh RGB
|
||||
Internet Standard RGB Internet standard RGB
|
||||
Working CMY Plates Radna CMY ploča
|
||||
Legacy Macintosh RGB (Gamma 1.8) Stari Macintosh RGB (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) Internet standard RGB (sRGB)
|
||||
Monitor RGB RGB monitora
|
||||
Color Blindness — Protanopia-type Daltonizam — tip protanopije
|
||||
Color Blindness — Deuteranopia-type Daltonizam — tip deuteranopije
|
||||
@@ -840,7 +850,6 @@
|
||||
Consolidate All to Tabs Objedini sve u kartice
|
||||
Float in Window Odvoji u prozor
|
||||
Float All in Windows Odvoji sve u prozore
|
||||
New Window for Document Novi prozor za dokument
|
||||
Workspace Radni prostor
|
||||
Essentials Osnovno
|
||||
Graphic and Web Grafika i veb
|
||||
@@ -1989,6 +1998,11 @@
|
||||
Show canvas dots Prikaži tačke na platnu
|
||||
Clip thumbnails to layer bounds Iseci sličice prema granicama sloja
|
||||
Clip Thumbnails to Layer Bounds Iseci sličice prema granicama sloja
|
||||
No Thumbnails Bez sličica
|
||||
Small Thumbnails Male sličice
|
||||
Medium Thumbnails Srednje sličice
|
||||
Large Thumbnails Velike sličice
|
||||
Clip Thumbnails to Document Bounds Iseci sličice prema granicama dokumenta
|
||||
Canvas color Boja platna
|
||||
Canvas custom color Prilagođena boja platna
|
||||
Color picker Birač boja
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -84,6 +84,7 @@
|
||||
Right Höger
|
||||
Open Recent Öppna senaste
|
||||
Clear Recent Files Rensa senaste filer
|
||||
Clear Recent File List Rensa senaste filer
|
||||
Remove from Recent Ta bort från senaste
|
||||
Remove {name} from Recent Ta bort {name} från senaste
|
||||
Close Stäng
|
||||
@@ -92,6 +93,10 @@
|
||||
Restore Återställ
|
||||
Close All Stäng alla
|
||||
Close Others Stäng övriga
|
||||
New Document… Nytt dokument…
|
||||
Open Document… Öppna…
|
||||
Consolidate All to Here Samla alla här
|
||||
Move to New Window Flytta till nytt fönster
|
||||
Save Spara
|
||||
Save As… Spara som…
|
||||
Save a Copy… Spara en kopia…
|
||||
@@ -506,7 +511,6 @@
|
||||
Match Location Matcha plats
|
||||
Match Rotation Matcha rotation
|
||||
Match All Matcha alla
|
||||
New Window for Document Nytt fönster för dokument
|
||||
Workspace Arbetsyta
|
||||
Extensions Tillägg
|
||||
Panels Paneler
|
||||
@@ -684,6 +688,7 @@
|
||||
Units & Rulers… Enheter och linjaler…
|
||||
Guides, Grid & Slices… Stödlinjer, rutnät och skivor…
|
||||
Plug-ins… Plugin-program…
|
||||
Plugins… Plugin-program…
|
||||
Technology Previews Teknikförhandsgranskningar
|
||||
Scratch Disks… Arbetsdiskar…
|
||||
Export Preferences… Exportinställningar…
|
||||
@@ -918,8 +923,8 @@
|
||||
ACES ACES
|
||||
Industry Standard Branschstandard
|
||||
Web Webb
|
||||
Internet Standard RGB Internetstandard-RGB
|
||||
Legacy Macintosh RGB Äldre Macintosh RGB
|
||||
Internet Standard RGB (sRGB) Internetstandard-RGB (sRGB)
|
||||
Legacy Macintosh RGB (Gamma 1.8) Äldre Macintosh RGB (Gamma 1.8)
|
||||
Monitor RGB Bildskärms-RGB
|
||||
Windows LCD Windows LCD
|
||||
Coated CMYK Bestruket CMYK
|
||||
@@ -1740,6 +1745,7 @@
|
||||
Saved Sparat
|
||||
Reveal in Finder Visa i Finder
|
||||
Show in Explorer Visa i Utforskaren
|
||||
Reveal in Explorer Visa i Utforskaren
|
||||
Show in Folder Visa i mapp
|
||||
Before (Y) Före (Y)
|
||||
Save Settings… Spara inställningar…
|
||||
@@ -1919,6 +1925,8 @@
|
||||
Combine Shapes Kombinera former
|
||||
Contract… Dra ihop…
|
||||
Convert to Embedded Konvertera till inbäddat
|
||||
Embed Linked Bädda in länkat
|
||||
Embed All Linked Bädda in alla länkade
|
||||
Convert to Layers Konvertera till lager
|
||||
Convert to Linked… Konvertera till länkat…
|
||||
Count Antal
|
||||
@@ -2006,6 +2014,7 @@
|
||||
Pixelate Pixla
|
||||
Place Scale Marker… Placera skalmarkör…
|
||||
Plug-ins Plugin-program
|
||||
Plugins Plugin-program
|
||||
Print One Copy Skriv ut en kopia
|
||||
Print… Skriv ut…
|
||||
Range Intervall
|
||||
@@ -2050,7 +2059,7 @@
|
||||
Vertical Centers Lodräta mittpunkter
|
||||
Video Frames to Layers… Videobildrutor till lager…
|
||||
WIA Support… WIA-stöd…
|
||||
Working CMY Plate CMY-arbetsplåt
|
||||
Working CMY Plates CMY-arbetsplåt
|
||||
|
||||
# tl! literals (third pass)
|
||||
Absolute Absolut
|
||||
@@ -2336,6 +2345,11 @@
|
||||
Show canvas dots Visa punkter på arbetsytan
|
||||
Clip thumbnails to layer bounds Begränsa miniatyrer till lagergränser
|
||||
Clip Thumbnails to Layer Bounds Begränsa miniatyrer till lagergränser
|
||||
No Thumbnails Inga miniatyrer
|
||||
Small Thumbnails Små miniatyrer
|
||||
Medium Thumbnails Medelstora miniatyrer
|
||||
Large Thumbnails Stora miniatyrer
|
||||
Clip Thumbnails to Document Bounds Begränsa miniatyrer till dokumentgränser
|
||||
Canvas color Arbetsytans färg
|
||||
Canvas custom color Anpassad färg för arbetsytan
|
||||
Classic Klassisk
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -95,6 +95,7 @@
|
||||
Right Sağ
|
||||
Open Recent Son Kullanılanları Aç
|
||||
Clear Recent Files Son Dosyaları Temizle
|
||||
Clear Recent File List Son Dosyaları Temizle
|
||||
Remove from Recent Son Kullanılanlardan Kaldır
|
||||
Remove {name} from Recent {name} öğesini Son Kullanılanlardan kaldır
|
||||
Close Kapat
|
||||
@@ -103,6 +104,10 @@
|
||||
Restore Geri yükle
|
||||
Close All Tümünü Kapat
|
||||
Close Others Diğerlerini Kapat
|
||||
New Document… Yeni Belge…
|
||||
Open Document… Aç…
|
||||
Consolidate All to Here Tümünü Buraya Birleştir
|
||||
Move to New Window Yeni Pencereye Taşı
|
||||
Save Kaydet
|
||||
Save As… Farklı Kaydet…
|
||||
Save a Copy… Bir Kopyasını Kaydet…
|
||||
@@ -154,6 +159,7 @@
|
||||
Create Smart Object after Loading Layers Katmanları Yükledikten Sonra Akıllı Nesne Oluştur
|
||||
Reveal in Finder Finder'da Göster
|
||||
Show in Explorer Explorer'da Göster
|
||||
Reveal in Explorer Explorer'da Göster
|
||||
Show in Folder Klasörde Göster
|
||||
File Info… Dosya Bilgileri…
|
||||
Print… Yazdır…
|
||||
@@ -242,6 +248,7 @@
|
||||
Units & Rulers… Birimler ve Cetveller…
|
||||
Guides, Grid & Slices… Kılavuzlar, Izgaralar ve Dilimler…
|
||||
Plug-ins… Eklentiler…
|
||||
Plugins… Eklentiler…
|
||||
Type… Metin…
|
||||
Enhanced Controls… Gelişmiş Kontroller…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -397,6 +404,8 @@
|
||||
Smart Object Akıllı Nesne
|
||||
Convert to Smart Object Akıllı Nesneye Dönüştür
|
||||
Convert to Embedded Gömülüye Dönüştür
|
||||
Embed Linked Bağlantılıyı Göm
|
||||
Embed All Linked Tüm Bağlantılıları Göm
|
||||
Convert to Layers Katmanlara Dönüştür
|
||||
Convert to Linked… Bağlantılıya Dönüştür…
|
||||
Edit Contents İçeriği Düzenle
|
||||
@@ -469,7 +478,9 @@
|
||||
Unite Shapes Şekil Alanlarını Birleştir
|
||||
Subtract Front Shape Ön Şekli Çıkar
|
||||
Intersect Shape Areas Şekil Alanlarını Kesiştir
|
||||
Unite Shapes at Overlap Şekil Alanlarını Kesiştir
|
||||
Exclude Overlapping Shapes Çakışan Şekilleri Hariç Tut
|
||||
Subtract Shapes at Overlap Çakışan Şekilleri Hariç Tut
|
||||
Merge Shape Components Şekil Bileşenlerini Birleştir
|
||||
Path operations Yol işlemleri
|
||||
Align Hizala
|
||||
@@ -652,6 +663,7 @@
|
||||
Minimum… Minimum…
|
||||
Offset… Kaydırma…
|
||||
Plug-ins Eklentiler
|
||||
Plugins Eklentiler
|
||||
Proof Setup Prova Kurulumu
|
||||
Proof Colors Prova Renkleri
|
||||
Gamut Warning Gamut Uyarısı
|
||||
@@ -660,9 +672,9 @@
|
||||
Working Magenta Plate Çalışma Macenta Plakası
|
||||
Working Yellow Plate Çalışma Sarı Plakası
|
||||
Working Black Plate Çalışma Siyah Plakası
|
||||
Working CMY Plate Çalışma CMY Plakası
|
||||
Legacy Macintosh RGB Eski Macintosh RGB
|
||||
Internet Standard RGB İnternet Standardı RGB
|
||||
Working CMY Plates Çalışma CMY Plakası
|
||||
Legacy Macintosh RGB (Gamma 1.8) Eski Macintosh RGB (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) İnternet Standardı RGB (sRGB)
|
||||
Monitor RGB Monitör RGB
|
||||
Color Blindness — Protanopia-type Renk Körlüğü — Protanopi tipi
|
||||
Color Blindness — Deuteranopia-type Renk Körlüğü — Döteranopi tipi
|
||||
@@ -744,7 +756,6 @@
|
||||
Consolidate All to Tabs Tümünü Sekmelerde Birleştir
|
||||
Float in Window Pencerede Yüzdür
|
||||
Float All in Windows Tümünü Pencerelerde Yüzdür
|
||||
New Window for Document Belge için Yeni Pencere
|
||||
Workspace Çalışma alanı
|
||||
Essentials Temel Öğeler
|
||||
Graphic and Web Grafik ve Web
|
||||
@@ -1901,6 +1912,11 @@
|
||||
Show canvas dots Tuval noktalarını göster
|
||||
Clip thumbnails to layer bounds Küçük resimleri katman sınırlarına kırp
|
||||
Clip Thumbnails to Layer Bounds Küçük resimleri katman sınırlarına kırp
|
||||
No Thumbnails Küçük Resim Yok
|
||||
Small Thumbnails Küçük Boyutlu Küçük Resimler
|
||||
Medium Thumbnails Orta Boyutlu Küçük Resimler
|
||||
Large Thumbnails Büyük Boyutlu Küçük Resimler
|
||||
Clip Thumbnails to Document Bounds Küçük resimleri belge sınırlarına kırp
|
||||
Canvas color Tuval rengi
|
||||
Canvas custom color Tuval özel rengi
|
||||
Color picker Renk seçici
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 8 and column 34.
|
@@ -255,6 +255,7 @@
|
||||
Right Правий
|
||||
Open Recent Нещодавні файли
|
||||
Clear Recent Files Очистити список нещодавніх файлів
|
||||
Clear Recent File List Очистити список нещодавніх файлів
|
||||
Remove from Recent Вилучити з нещодавніх
|
||||
Remove {name} from Recent Вилучити {name} з нещодавніх
|
||||
Close Закрити
|
||||
@@ -263,6 +264,10 @@
|
||||
Restore Відновити
|
||||
Close All Закрити всі
|
||||
Close Others Закрити інші
|
||||
New Document… Новий документ…
|
||||
Open Document… Відкрити…
|
||||
Consolidate All to Here Об'єднати все тут
|
||||
Move to New Window Перемістити в нове вікно
|
||||
Save Зберегти
|
||||
Save As… Зберегти як…
|
||||
Save a Copy… Зберегти копію…
|
||||
@@ -646,7 +651,7 @@
|
||||
Match Location Узгодити розташування
|
||||
Match Rotation Узгодити поворот
|
||||
Match All Узгодити все
|
||||
New Window for Document Нове вікно для документа
|
||||
New Window Нове вікно для документа
|
||||
Workspace Робочий простір
|
||||
Extensions Розширення
|
||||
Panels Панелі
|
||||
@@ -816,6 +821,7 @@
|
||||
Units & Rulers… Одиниці та лінійки…
|
||||
Guides, Grid & Slices… Напрямні, сітка та фрагменти…
|
||||
Plug-ins… Плагіни…
|
||||
Plugins… Плагіни…
|
||||
Technology Previews Попередній перегляд технологій
|
||||
Scratch Disks… Робочі диски…
|
||||
Export Preferences… Налаштування експорту…
|
||||
@@ -1038,8 +1044,8 @@
|
||||
ACES ACES
|
||||
Industry Standard Галузевий стандарт
|
||||
Web Веб
|
||||
Internet Standard RGB Стандартний RGB для інтернету
|
||||
Legacy Macintosh RGB Застарілий Macintosh RGB
|
||||
Internet Standard RGB (sRGB) Стандартний RGB для інтернету (sRGB)
|
||||
Legacy Macintosh RGB (Gamma 1.8) Застарілий Macintosh RGB (Gamma 1.8)
|
||||
Monitor RGB RGB монітора
|
||||
Windows LCD Windows LCD
|
||||
Coated CMYK CMYK для крейдованого паперу
|
||||
@@ -1822,6 +1828,7 @@
|
||||
Saved Збережено
|
||||
Reveal in Finder Показати у Finder
|
||||
Show in Explorer Показати у Провіднику
|
||||
Reveal in Explorer Показати у Провіднику
|
||||
Show in Folder Показати в теці
|
||||
Before (Y) До (Y)
|
||||
Save Settings… Зберегти налаштування…
|
||||
@@ -1985,6 +1992,8 @@
|
||||
Combine Shapes Об'єднати фігури
|
||||
Contract… Стиснути…
|
||||
Convert to Embedded Перетворити на вбудований
|
||||
Embed Linked Вбудувати пов'язаний
|
||||
Embed All Linked Вбудувати всі пов'язані
|
||||
Convert to Layers Перетворити на шари
|
||||
Convert to Linked… Перетворити на пов'язаний…
|
||||
Count Підрахунок
|
||||
@@ -2007,6 +2016,7 @@
|
||||
Enhanced Controls… Розширені елементи керування…
|
||||
Entropy Ентропія
|
||||
Exclude Overlapping Shapes Виключити перекриття фігур
|
||||
Subtract Shapes at Overlap Виключити перекриття фігур
|
||||
Exit Вийти
|
||||
Expand… Розширити…
|
||||
Extra Large Дуже великий
|
||||
@@ -2032,6 +2042,7 @@
|
||||
Indexed Color… Індексований колір…
|
||||
Integrations… Інтеграції…
|
||||
Intersect Shape Areas Перетин областей фігур
|
||||
Unite Shapes at Overlap Перетин областей фігур
|
||||
Kurtosis Ексцес
|
||||
Large Великий
|
||||
Layer Edges Краї шару
|
||||
@@ -2073,6 +2084,7 @@
|
||||
Pixelate Пікселізація
|
||||
Place Scale Marker… Розмістити маркер масштабу…
|
||||
Plug-ins Плагіни
|
||||
Plugins Плагіни
|
||||
Print One Copy Надрукувати одну копію
|
||||
Print… Друк…
|
||||
Range Діапазон
|
||||
@@ -2117,7 +2129,7 @@
|
||||
Vertical Centers Вертикальні центри
|
||||
Video Frames to Layers… Відеокадри в шари…
|
||||
WIA Support… Підтримка WIA…
|
||||
Working CMY Plate Робоча форма CMY
|
||||
Working CMY Plates Робоча форма CMY
|
||||
Absolute Абсолютний
|
||||
Action Дія
|
||||
Adaptive Адаптивний
|
||||
@@ -2394,6 +2406,11 @@
|
||||
Show canvas dots Показувати крапки полотна
|
||||
Clip thumbnails to layer bounds Обрізати мініатюри до меж шару
|
||||
Clip Thumbnails to Layer Bounds Обрізати мініатюри до меж шару
|
||||
No Thumbnails Без мініатюр
|
||||
Small Thumbnails Малі мініатюри
|
||||
Medium Thumbnails Середні мініатюри
|
||||
Large Thumbnails Великі мініатюри
|
||||
Clip Thumbnails to Document Bounds Обрізати мініатюри до меж документа
|
||||
Canvas color Колір полотна
|
||||
Canvas custom color Довільний колір полотна
|
||||
Classic Класична
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 152 and column 53.
|
@@ -188,10 +188,15 @@
|
||||
Check Spelling… Kiểm tra chính tả…
|
||||
Clear Xóa
|
||||
Clear Recent Files Xóa tệp gần đây
|
||||
Clear Recent File List Xóa tệp gần đây
|
||||
Clipboard Bảng tạm
|
||||
Close Đóng
|
||||
Close All Đóng tất cả
|
||||
Close Others Đóng các tệp khác
|
||||
New Document… Tài liệu mới…
|
||||
Open Document… Mở…
|
||||
Consolidate All to Here Gom tất cả vào đây
|
||||
Move to New Window Di chuyển sang cửa sổ mới
|
||||
Color Lookup Tables… Bảng tra màu…
|
||||
Color Settings… Cài đặt màu…
|
||||
Conditional Mode Change… Đổi chế độ có điều kiện…
|
||||
@@ -275,6 +280,7 @@
|
||||
Place Embedded… Đặt nhúng…
|
||||
Place Linked… Đặt liên kết…
|
||||
Plug-ins… Plug-in…
|
||||
Plugins… Plug-in…
|
||||
Preferences Tùy chọn
|
||||
Preset Manager… Quản lý thiết lập sẵn…
|
||||
Presets Thiết lập sẵn
|
||||
@@ -373,6 +379,8 @@
|
||||
Color Table… Bảng màu…
|
||||
Combine Shapes Kết hợp hình
|
||||
Convert to Embedded Chuyển thành nhúng
|
||||
Embed Linked Nhúng mục liên kết
|
||||
Embed All Linked Nhúng tất cả mục liên kết
|
||||
Convert to Layers Chuyển thành lớp
|
||||
Convert to Linked… Chuyển thành liên kết…
|
||||
Convert to Smart Object Chuyển thành đối tượng thông minh
|
||||
@@ -404,6 +412,7 @@
|
||||
Entropy Entropy
|
||||
Equalize Cân bằng histogram
|
||||
Exclude Overlapping Shapes Loại phần chồng hình
|
||||
Subtract Shapes at Overlap Loại phần chồng hình
|
||||
Export Contents… Xuất nội dung…
|
||||
Exposure… Phơi sáng…
|
||||
Fill Content Nội dung tô
|
||||
@@ -438,6 +447,7 @@
|
||||
Insert Blank Frame Chèn khung trống
|
||||
Interpret Footage… Diễn giải footage…
|
||||
Intersect Shape Areas Giao vùng hình
|
||||
Unite Shapes at Overlap Giao vùng hình
|
||||
Invert Đảo màu
|
||||
Invert… Đảo màu…
|
||||
Kurtosis Kurtosis
|
||||
@@ -733,10 +743,10 @@
|
||||
Grid Lưới
|
||||
Guides Đường căn
|
||||
HDV 1080/DVCPRO HD 720 (1.33) HDV 1080/DVCPRO HD 720 (1.33)
|
||||
Internet Standard RGB RGB chuẩn Internet
|
||||
Internet Standard RGB (sRGB) RGB chuẩn Internet (sRGB)
|
||||
Layer Edges Cạnh lớp
|
||||
Layers Các lớp
|
||||
Legacy Macintosh RGB RGB Macintosh cũ
|
||||
Legacy Macintosh RGB (Gamma 1.8) RGB Macintosh cũ (Gamma 1.8)
|
||||
Lock Guides Khóa đường căn
|
||||
Lock Slices Khóa lát cắt
|
||||
Mesh Lưới
|
||||
@@ -766,7 +776,7 @@
|
||||
Standard Screen Mode Chế độ màn hình chuẩn
|
||||
Target Path Đường dẫn đích
|
||||
Working Black Plate Bản Black làm việc
|
||||
Working CMY Plate Bản CMY làm việc
|
||||
Working CMY Plates Bản CMY làm việc
|
||||
Working CMYK CMYK làm việc
|
||||
Working Cyan Plate Bản Cyan làm việc
|
||||
Working Magenta Plate Bản Magenta làm việc
|
||||
@@ -813,7 +823,7 @@
|
||||
Modifier Keys Phím bổ trợ
|
||||
Motion Chuyển động
|
||||
Navigator Điều hướng
|
||||
New Window for Document Cửa sổ mới cho tài liệu
|
||||
New Window Cửa sổ mới cho tài liệu
|
||||
New Workspace… Không gian làm việc mới…
|
||||
Next Theme Chủ đề tiếp theo
|
||||
Options Thanh tùy chọn
|
||||
@@ -1605,6 +1615,7 @@ cameraRaw Shadows Vùng tối
|
||||
Picas Pica
|
||||
Pixels Pixel
|
||||
Plug-ins Plug-in
|
||||
Plugins Plug-in
|
||||
Png PNG
|
||||
Point size Cỡ point
|
||||
Points Point
|
||||
@@ -2614,6 +2625,7 @@ shape Appearance Diện mạo
|
||||
(coming soon) (sắp có)
|
||||
Add beauty precomp from the AOVs Thêm precomp beauty từ các AOV
|
||||
Show in Explorer Hiện trong Explorer
|
||||
Reveal in Explorer Hiện trong Explorer
|
||||
Show in Folder Hiện trong thư mục
|
||||
Delete and Fill Selection Xoá và tô vùng chọn
|
||||
Transform Again on a Copy Biến đổi lại trên một bản sao
|
||||
@@ -2755,6 +2767,11 @@ shape Appearance Diện mạo
|
||||
Show canvas dots Hiện chấm vùng vẽ
|
||||
Clip thumbnails to layer bounds Cắt hình thu nhỏ theo biên của lớp
|
||||
Clip Thumbnails to Layer Bounds Cắt hình thu nhỏ theo biên của lớp
|
||||
No Thumbnails Không có hình thu nhỏ
|
||||
Small Thumbnails Hình thu nhỏ cỡ nhỏ
|
||||
Medium Thumbnails Hình thu nhỏ cỡ vừa
|
||||
Large Thumbnails Hình thu nhỏ cỡ lớn
|
||||
Clip Thumbnails to Document Bounds Cắt hình thu nhỏ theo biên của tài liệu
|
||||
Color picker Bộ chọn màu
|
||||
Color space Không gian màu
|
||||
Column width Độ rộng cột
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -174,6 +174,7 @@
|
||||
Right 右
|
||||
Open Recent 打开最近文件
|
||||
Clear Recent Files 清除最近文件
|
||||
Clear Recent File List 清除最近文件
|
||||
Remove from Recent 从最近文件中移除
|
||||
Remove {name} from Recent 从最近文件中移除 {name}
|
||||
Close 关闭
|
||||
@@ -182,6 +183,10 @@
|
||||
Restore 向下还原
|
||||
Close All 关闭全部
|
||||
Close Others 关闭其他
|
||||
New Document… 新建文档…
|
||||
Open Document… 打开…
|
||||
Consolidate All to Here 将所有窗口合并到此处
|
||||
Move to New Window 移到新窗口
|
||||
Save 保存
|
||||
Save As… 另存为…
|
||||
Save a Copy… 保存副本…
|
||||
@@ -234,6 +239,7 @@
|
||||
Create Smart Object after Loading Layers 载入图层后创建智能对象
|
||||
Reveal in Finder 在 Finder 中显示
|
||||
Show in Explorer 在文件资源管理器中显示
|
||||
Reveal in Explorer 在文件资源管理器中显示
|
||||
Show in Folder 在文件夹中显示
|
||||
File Info… 文件信息…
|
||||
Print… 打印…
|
||||
@@ -323,6 +329,7 @@
|
||||
Units & Rulers… 单位与标尺…
|
||||
Guides, Grid & Slices… 参考线、网格与切片…
|
||||
Plug-ins… 插件…
|
||||
Plugins… 插件…
|
||||
Type… 文字…
|
||||
3D… 3D…
|
||||
Enhanced Controls… 增强控件…
|
||||
@@ -482,6 +489,8 @@
|
||||
Smart Object 智能对象
|
||||
Convert to Smart Object 转换为智能对象
|
||||
Convert to Embedded 转换为嵌入对象
|
||||
Embed Linked 嵌入链接对象
|
||||
Embed All Linked 嵌入所有链接对象
|
||||
Convert to Layers 转换为图层
|
||||
Convert to Linked… 转换为链接对象…
|
||||
Edit Contents 编辑内容
|
||||
@@ -555,7 +564,9 @@
|
||||
Unite Shapes 合并形状
|
||||
Subtract Front Shape 减去前面形状
|
||||
Intersect Shape Areas 形状区域相交
|
||||
Unite Shapes at Overlap 形状区域相交
|
||||
Exclude Overlapping Shapes 排除重叠形状
|
||||
Subtract Shapes at Overlap 排除重叠形状
|
||||
Merge Shape Components 合并形状组件
|
||||
Path operations 路径操作
|
||||
Align 对齐
|
||||
@@ -740,6 +751,7 @@
|
||||
Minimum… 最小值…
|
||||
Offset… 位移…
|
||||
Plug-ins 插件
|
||||
Plugins 插件
|
||||
Proof Setup 校样设置
|
||||
Proof Colors 校样颜色
|
||||
Gamut Warning 色域警告
|
||||
@@ -748,9 +760,9 @@
|
||||
Working Magenta Plate 工作洋红版
|
||||
Working Yellow Plate 工作黄色版
|
||||
Working Black Plate 工作黑色版
|
||||
Working CMY Plate 工作 CMY 版
|
||||
Legacy Macintosh RGB 旧版 Macintosh RGB
|
||||
Internet Standard RGB 互联网标准 RGB
|
||||
Working CMY Plates 工作 CMY 版
|
||||
Legacy Macintosh RGB (Gamma 1.8) 旧版 Macintosh RGB (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) 互联网标准 RGB (sRGB)
|
||||
Monitor RGB 显示器 RGB
|
||||
Color Blindness — Protanopia-type 色盲 — 红色盲型
|
||||
Color Blindness — Deuteranopia-type 色盲 — 绿色盲型
|
||||
@@ -842,7 +854,7 @@
|
||||
Consolidate All to Tabs 将所有窗口合并为选项卡
|
||||
Float in Window 在窗口中浮动
|
||||
Float All in Windows 使所有文档在窗口中浮动
|
||||
New Window for Document 为文档新建窗口
|
||||
New Window 为文档新建窗口
|
||||
Workspace 工作区
|
||||
Essentials 基本功能
|
||||
Graphic and Web 图形与 Web
|
||||
@@ -2052,6 +2064,11 @@
|
||||
Show canvas dots 显示画布圆点
|
||||
Clip thumbnails to layer bounds 将缩略图裁剪到图层边界
|
||||
Clip Thumbnails to Layer Bounds 将缩略图裁剪到图层边界
|
||||
No Thumbnails 无缩略图
|
||||
Small Thumbnails 小缩略图
|
||||
Medium Thumbnails 中缩略图
|
||||
Large Thumbnails 大缩略图
|
||||
Clip Thumbnails to Document Bounds 将缩略图裁剪到文档边界
|
||||
Canvas color 画布颜色
|
||||
Canvas custom color 画布自定颜色
|
||||
Color picker 拾色器
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 63 and column 53.
|
@@ -176,6 +176,7 @@
|
||||
Right 右
|
||||
Open Recent 最近開啟的檔案
|
||||
Clear Recent Files 清除最近檔案
|
||||
Clear Recent File List 清除最近檔案
|
||||
Remove from Recent 從最近檔案中移除
|
||||
Remove {name} from Recent 從最近檔案中移除 {name}
|
||||
Close 關閉
|
||||
@@ -184,6 +185,10 @@
|
||||
Restore 向下還原
|
||||
Close All 全部關閉
|
||||
Close Others 關閉其他
|
||||
New Document… 新增文件…
|
||||
Open Document… 開啟…
|
||||
Consolidate All to Here 將所有視窗合併至此處
|
||||
Move to New Window 移至新視窗
|
||||
Save 儲存
|
||||
Save As… 另存新檔…
|
||||
Save a Copy… 儲存拷貝…
|
||||
@@ -236,6 +241,7 @@
|
||||
Create Smart Object after Loading Layers 載入圖層後建立智慧型物件
|
||||
Reveal in Finder 在 Finder 中顯示
|
||||
Show in Explorer 在檔案總管中顯示
|
||||
Reveal in Explorer 在檔案總管中顯示
|
||||
Show in Folder 在資料夾中顯示
|
||||
File Info… 檔案資訊…
|
||||
Print… 列印…
|
||||
@@ -324,6 +330,7 @@
|
||||
Units & Rulers… 單位和尺標…
|
||||
Guides, Grid & Slices… 參考線、格點和切片…
|
||||
Plug-ins… 增效模組…
|
||||
Plugins… 增效模組…
|
||||
Type… 文字…
|
||||
Enhanced Controls… 增強控制項…
|
||||
Camera Raw… Camera Raw…
|
||||
@@ -481,6 +488,8 @@
|
||||
Smart Object 智慧型物件
|
||||
Convert to Smart Object 轉換為智慧型物件
|
||||
Convert to Embedded 轉換為嵌入
|
||||
Embed Linked 嵌入連結
|
||||
Embed All Linked 嵌入所有連結
|
||||
Convert to Layers 轉換為圖層
|
||||
Convert to Linked… 轉換為連結…
|
||||
Edit Contents 編輯內容
|
||||
@@ -554,7 +563,9 @@
|
||||
Unite Shapes 聯集形狀
|
||||
Subtract Front Shape 減去前方形狀
|
||||
Intersect Shape Areas 交集形狀區域
|
||||
Unite Shapes at Overlap 交集形狀區域
|
||||
Exclude Overlapping Shapes 排除重疊形狀
|
||||
Subtract Shapes at Overlap 排除重疊形狀
|
||||
Merge Shape Components 合併形狀元件
|
||||
Path operations 路徑操作
|
||||
Align 對齊
|
||||
@@ -739,6 +750,7 @@
|
||||
Minimum… 最小…
|
||||
Offset… 畫面錯位…
|
||||
Plug-ins 增效模組
|
||||
Plugins 增效模組
|
||||
Proof Setup 校樣設定
|
||||
Proof Colors 校樣色彩
|
||||
Gamut Warning 色域警告
|
||||
@@ -747,9 +759,9 @@
|
||||
Working Magenta Plate 使用中的洋紅版
|
||||
Working Yellow Plate 使用中的黃色版
|
||||
Working Black Plate 使用中的黑色版
|
||||
Working CMY Plate 使用中的 CMY 版
|
||||
Legacy Macintosh RGB 舊版 Macintosh RGB
|
||||
Internet Standard RGB 網際網路標準 RGB
|
||||
Working CMY Plates 使用中的 CMY 版
|
||||
Legacy Macintosh RGB (Gamma 1.8) 舊版 Macintosh RGB (Gamma 1.8)
|
||||
Internet Standard RGB (sRGB) 網際網路標準 RGB (sRGB)
|
||||
Monitor RGB 顯示器 RGB
|
||||
Color Blindness — Protanopia-type 色盲 — 紅色盲型
|
||||
Color Blindness — Deuteranopia-type 色盲 — 綠色盲型
|
||||
@@ -841,7 +853,7 @@
|
||||
Consolidate All to Tabs 全部合併至標籤頁
|
||||
Float in Window 在視窗中浮動
|
||||
Float All in Windows 全部在視窗中浮動
|
||||
New Window for Document 為文件新增視窗
|
||||
New Window 為文件新增視窗
|
||||
Workspace 工作區
|
||||
Essentials 基本功能
|
||||
Graphic and Web 繪圖和網頁
|
||||
@@ -2020,6 +2032,11 @@
|
||||
Show canvas dots 顯示畫布圓點
|
||||
Clip thumbnails to layer bounds 將縮圖裁切至圖層邊界
|
||||
Clip Thumbnails to Layer Bounds 將縮圖裁切至圖層邊界
|
||||
No Thumbnails 無縮圖
|
||||
Small Thumbnails 小縮圖
|
||||
Medium Thumbnails 中縮圖
|
||||
Large Thumbnails 大縮圖
|
||||
Clip Thumbnails to Document Bounds 將縮圖裁切至文件邊界
|
||||
Canvas color 畫布顏色
|
||||
Canvas custom color 畫布自訂顏色
|
||||
Color picker 檢色器
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -612,7 +612,8 @@ fn cmd_alt_drag_duplicates_the_layer_then_moves_the_copy() {
|
||||
assert_eq!(bounds(&h, orig), Rect::new(100, 100, 160, 160), "the original stays");
|
||||
assert_eq!(bounds(&h, copy), Rect::new(140, 120, 200, 180), "the copy moved");
|
||||
assert_eq!(st.history.past_len(), h0 + 1, "one undo step");
|
||||
assert_eq!(st.history.undo_label(), Some(crate::move_mods::DUPLICATE_MOVE_LABEL));
|
||||
// A drag that copies a layer is one "Move" step, as in Photoshop (#11383).
|
||||
assert_eq!(st.history.undo_label(), Some(tl!("Move")));
|
||||
assert_eq!(h.state().ui.tool, tool);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,6 +386,8 @@ fn alternate_keys_run_their_command() {
|
||||
("Cmd+Shift+I", "select.inverse"),
|
||||
("Cmd++", "view.zoomIn"),
|
||||
("Shift+Backspace", "edit.fill"),
|
||||
("Cmd+Alt+0", "view.actualPixels"),
|
||||
("F9", "window.panel.actions"),
|
||||
] {
|
||||
press(&mut h, key);
|
||||
let log = take_log(&h.ctx);
|
||||
|
||||
@@ -708,6 +708,11 @@ fn handle_pen_and_work_path_keys(app: &mut PhotocraftApp, ctx: &egui::Context, f
|
||||
crate::vector_ui::pen_end(app);
|
||||
return true;
|
||||
}
|
||||
// A shape box handle drag: Esc drops it, the shapes keep their size (#11107).
|
||||
if app.ui.shape_box.is_some() && ctx.input_mut(|i| i.consume_key(Modifiers::NONE, Key::Escape)) {
|
||||
crate::shape_bounds_box::cancel(app);
|
||||
return true;
|
||||
}
|
||||
// A finished work path shown by the Pen or Path Selection: ⌫/Delete deletes it, as in
|
||||
// Photoshop (#5702), never Edit › Clear on the pixels under it.
|
||||
if focus != crate::shortcut_dispatch::Focus::DeletingWidget && crate::vector_ui::delete_key_deletes_work_path(app) {
|
||||
@@ -909,12 +914,18 @@ fn select_tool_by_key(app: &mut PhotocraftApp, ctx: &egui::Context, pressed: &im
|
||||
let cycle_shift = shift_switch && ctx.input_mut(|i| i.consume_key(Modifiers::SHIFT, k));
|
||||
if cycle_shift || pressed(k) {
|
||||
let before = app.ui.tool;
|
||||
let group: Vec<Tool> = Tool::ALL.iter().copied().filter(|x| x.key() == t.key() && crate::tool_shortcuts::uses_default(app, *x)).collect();
|
||||
let mut group: Vec<Tool> = Tool::ALL.iter().copied().filter(|x| x.key() == t.key() && crate::tool_shortcuts::uses_default(app, *x)).collect();
|
||||
// Shift+key (the cycle and the fallback to the group's first tool) uses the toolbar
|
||||
// flyout's order; plain keys keep the `Tool::ALL` order.
|
||||
if cycle_shift {
|
||||
group.sort_by_key(|x| crate::panels::toolbar::toolbar_position(*x));
|
||||
}
|
||||
app.ui.tool = match group.iter().position(|x| *x == app.ui.tool) {
|
||||
Some(i) if shift_switch && !cycle_shift => group[i],
|
||||
Some(i) => group[(i + 1) % group.len()],
|
||||
None => app.ui.group_tool(t.key()).filter(|last| group.contains(last)).unwrap_or(group[0]),
|
||||
};
|
||||
crate::tool_memory::ended_by_tool(app);
|
||||
// `consume_key` ignores extra ⇧ and ⌥: a ⇧/⌥ switch is never spring-loaded.
|
||||
let (plain, now) = ctx.input(|i| (!cycle_shift && !i.modifiers.shift && !i.modifiers.alt, i.time));
|
||||
crate::spring_tools::pressed(app, t.key(), before, plain, now);
|
||||
|
||||
@@ -336,6 +336,8 @@ impl Stylus {
|
||||
Some(true) if app.ui.tool != Tool::Eraser => {
|
||||
app.stylus.tool_before_eraser = Some(app.ui.tool);
|
||||
app.ui.tool = Tool::Eraser;
|
||||
// A tool switch like any other: Add New Artboard's placing mode ends (#11386).
|
||||
crate::tool_memory::ended_by_tool(app);
|
||||
true
|
||||
}
|
||||
Some(false) => match app.stylus.tool_before_eraser.take() {
|
||||
|
||||
@@ -350,3 +350,22 @@ fn eraser_end_switches_tools_once_and_never_mid_drag() {
|
||||
assert!(!Stylus::sync_eraser_tool(&mut app));
|
||||
assert_eq!(app.ui.tool, Tool::Eraser);
|
||||
}
|
||||
|
||||
/// The pen's eraser end is a tool switch like any other: Add New Artboard's placing mode ends
|
||||
/// (#11386), and coming back to the Artboard tool on the tip leaves it off.
|
||||
#[test]
|
||||
fn the_eraser_end_ends_the_artboard_placing_mode() {
|
||||
use crate::state::Tool;
|
||||
let mut app = crate::PhotocraftApp::new(photocraft_engine::Session::new(), Default::default());
|
||||
app.session.execute("file.new", serde_json::json!({"width": 60, "height": 60})).unwrap();
|
||||
app.ui.tool = Tool::Artboard;
|
||||
app.ui.artboard_tool.adding = true;
|
||||
let pen = |eraser| Some(PenSample { pressure: 0.5, eraser, ..Default::default() });
|
||||
app.stylus.feed.set(pen(true));
|
||||
assert!(Stylus::sync_eraser_tool(&mut app));
|
||||
assert!(!app.ui.artboard_tool.adding, "the eraser end ends the mode");
|
||||
app.stylus.feed.set(pen(false));
|
||||
assert!(Stylus::sync_eraser_tool(&mut app));
|
||||
assert_eq!(app.ui.tool, Tool::Artboard);
|
||||
assert!(!app.ui.artboard_tool.adding);
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
//! #11404: a right-click on the empty area below the last layer row opens the thumbnail size and
|
||||
//! clipping choices; a left click there still deselects, and a layer row keeps its own menu.
|
||||
|
||||
use egui::{PointerButton, Pos2, pos2};
|
||||
use egui_kittest::Harness;
|
||||
use egui_kittest::kittest::{NodeT, Queryable};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::PhotocraftApp;
|
||||
use crate::state::LayerThumbnailSize;
|
||||
|
||||
const SIZES: [&str; 4] = ["No Thumbnails", "Small Thumbnails", "Medium Thumbnails", "Large Thumbnails"];
|
||||
const CLIPS: [&str; 2] = ["Clip Thumbnails to Layer Bounds", "Clip Thumbnails to Document Bounds"];
|
||||
|
||||
fn panel(open_document: bool) -> Harness<'static, PhotocraftApp> {
|
||||
let mut s = photocraft_engine::Session::new();
|
||||
if open_document {
|
||||
s.execute("file.new", json!({"width": 8, "height": 8})).unwrap();
|
||||
s.execute("layer.new.layer", json!({})).unwrap();
|
||||
}
|
||||
let mut h = Harness::builder().with_size(egui::vec2(1200.0, 800.0)).with_max_steps(64).build_eframe(|cc| {
|
||||
PhotocraftApp::setup_context(&cc.egui_ctx, Default::default());
|
||||
PhotocraftApp::new(s, crate::Services::default())
|
||||
});
|
||||
h.run_steps(6);
|
||||
h
|
||||
}
|
||||
|
||||
/// A point in the Layers panel well below its last row (above the panel's bottom buttons).
|
||||
fn empty_point(h: &Harness<'static, PhotocraftApp>) -> Pos2 {
|
||||
let button = h.get_by_label("Create a new layer").rect();
|
||||
pos2(button.center().x - 20.0, button.top() - 80.0)
|
||||
}
|
||||
|
||||
fn click(h: &mut Harness<'static, PhotocraftApp>, p: Pos2, button: PointerButton) {
|
||||
h.event(egui::Event::PointerMoved(p));
|
||||
h.run_steps(1);
|
||||
h.event(egui::Event::PointerButton { pos: p, button, pressed: true, modifiers: egui::Modifiers::NONE });
|
||||
h.run_steps(1);
|
||||
h.event(egui::Event::PointerButton { pos: p, button, pressed: false, modifiers: egui::Modifiers::NONE });
|
||||
h.run_steps(3);
|
||||
}
|
||||
|
||||
fn open_menu(h: &mut Harness<'static, PhotocraftApp>) {
|
||||
let p = empty_point(h);
|
||||
click(h, p, PointerButton::Secondary);
|
||||
}
|
||||
|
||||
fn pick(h: &mut Harness<'static, PhotocraftApp>, label: &str) {
|
||||
h.get_by_label(label).click();
|
||||
h.run_steps(4);
|
||||
}
|
||||
|
||||
fn menu_open(h: &Harness<'static, PhotocraftApp>) -> bool {
|
||||
SIZES.iter().chain(CLIPS.iter()).any(|l| h.query_by_label(l).is_some())
|
||||
}
|
||||
|
||||
fn checked(h: &Harness<'static, PhotocraftApp>, label: &str) -> bool {
|
||||
h.get_by_label(label).accesskit_node().toggled() == Some(egui::accesskit::Toggled::True)
|
||||
}
|
||||
|
||||
fn size(h: &Harness<'static, PhotocraftApp>) -> LayerThumbnailSize {
|
||||
h.state().ui.layers_panel_options.thumbnail_size
|
||||
}
|
||||
|
||||
fn clip(h: &Harness<'static, PhotocraftApp>) -> bool {
|
||||
h.state().session.prefs().interface.clip_thumbnails_to_layer_bounds
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_menu_lists_the_six_entries_in_order_with_a_separator() {
|
||||
let mut h = panel(true);
|
||||
open_menu(&mut h);
|
||||
let ys: Vec<f32> = SIZES.iter().chain(CLIPS.iter()).map(|l| h.get_by_label(l).rect().top()).collect();
|
||||
assert_eq!(ys.len(), 6);
|
||||
assert!(ys.windows(2).all(|w| w[0] < w[1]), "entries top to bottom in the issue's order: {ys:?}");
|
||||
let step = ys[1] - ys[0];
|
||||
assert!(ys[4] - ys[3] > step + 1.0, "the separator sits between Large Thumbnails and the clip entries: {ys:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_current_size_and_clip_choice_are_the_ones_checked() {
|
||||
let mut h = panel(true);
|
||||
h.state_mut().ui.layers_panel_options.thumbnail_size = LayerThumbnailSize::Large;
|
||||
h.state_mut().run("prefs.set", json!({"path": "interface.clipThumbnailsToLayerBounds", "value": true})).unwrap();
|
||||
h.run_steps(2);
|
||||
open_menu(&mut h);
|
||||
assert!(menu_open(&h));
|
||||
assert!(checked(&h, "Large Thumbnails"), "Large is the current size");
|
||||
for other in ["No Thumbnails", "Small Thumbnails", "Medium Thumbnails"] {
|
||||
assert!(!checked(&h, other), "{other}");
|
||||
}
|
||||
assert!(checked(&h, "Clip Thumbnails to Layer Bounds"));
|
||||
assert!(!checked(&h, "Clip Thumbnails to Document Bounds"));
|
||||
|
||||
pick(&mut h, "Clip Thumbnails to Document Bounds");
|
||||
assert!(!clip(&h));
|
||||
open_menu(&mut h);
|
||||
assert!(checked(&h, "Clip Thumbnails to Document Bounds"));
|
||||
assert!(!checked(&h, "Clip Thumbnails to Layer Bounds"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_size_pick_sets_the_panel_option_and_saves_it() {
|
||||
for (label, want) in [
|
||||
("No Thumbnails", LayerThumbnailSize::None),
|
||||
("Small Thumbnails", LayerThumbnailSize::Small),
|
||||
("Large Thumbnails", LayerThumbnailSize::Large),
|
||||
("Medium Thumbnails", LayerThumbnailSize::Medium),
|
||||
] {
|
||||
let mut h = panel(true);
|
||||
h.state_mut().ui.layers_panel_options.thumbnail_size =
|
||||
if want == LayerThumbnailSize::Large { LayerThumbnailSize::Small } else { LayerThumbnailSize::Large };
|
||||
h.run_steps(2);
|
||||
open_menu(&mut h);
|
||||
pick(&mut h, label);
|
||||
assert_eq!(size(&h), want, "{label}");
|
||||
assert!(!menu_open(&h), "{label}: the menu closes");
|
||||
let saved = h.state().session.prefs().dialogs.get("ui.layersPanelOptions").cloned();
|
||||
let saved = saved.expect("the choice is saved as Panel Options saves it");
|
||||
assert_eq!(saved, serde_json::to_value(&h.state().ui.layers_panel_options).unwrap(), "{label}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn each_clip_pick_sets_the_preference() {
|
||||
let mut h = panel(true);
|
||||
assert!(!clip(&h));
|
||||
open_menu(&mut h);
|
||||
pick(&mut h, "Clip Thumbnails to Layer Bounds");
|
||||
assert!(clip(&h));
|
||||
assert_eq!(crate::panels::layers_panel_ui::thumbnail_contents(h.state()), crate::state::LayerThumbnailContents::LayerBounds, "Panel Options agrees");
|
||||
open_menu(&mut h);
|
||||
pick(&mut h, "Clip Thumbnails to Document Bounds");
|
||||
assert!(!clip(&h));
|
||||
assert_eq!(crate::panels::layers_panel_ui::thumbnail_contents(h.state()), crate::state::LayerThumbnailContents::EntireDocument);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_left_click_on_the_empty_area_still_deselects_and_a_right_click_does_not() {
|
||||
let mut h = panel(true);
|
||||
let selected = |h: &Harness<'static, PhotocraftApp>| h.state().session.active().unwrap().selected_layers().len();
|
||||
h.run_steps(3);
|
||||
let before = selected(&h);
|
||||
assert!(before > 0);
|
||||
open_menu(&mut h);
|
||||
assert!(menu_open(&h));
|
||||
assert_eq!(selected(&h), before, "a right-click does not deselect");
|
||||
h.key_press(egui::Key::Escape);
|
||||
h.run_steps(3);
|
||||
let p = empty_point(&h);
|
||||
click(&mut h, p, PointerButton::Primary);
|
||||
assert_eq!(selected(&h), 0, "a left click deselects every layer");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn with_no_document_nothing_opens() {
|
||||
let mut h = panel(false);
|
||||
let p = pos2(1100.0, 400.0);
|
||||
click(&mut h, p, PointerButton::Secondary);
|
||||
assert!(!menu_open(&h));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_right_click_on_a_layer_row_still_opens_the_layer_menu() {
|
||||
let mut h = panel(true);
|
||||
let row = h.get_all_by_label("Layer 1").next().expect("the new layer's row").rect();
|
||||
click(&mut h, row.center(), PointerButton::Secondary);
|
||||
assert!(h.query_by_label("Duplicate Layer…").is_some() || h.query_by_label("Duplicate Layer").is_some(), "the layer menu opened");
|
||||
assert!(h.query_by_label("No Thumbnails").is_none(), "not the empty-area menu");
|
||||
}
|
||||
|
||||
/// A filter that matches no layer draws no row: the whole list is empty space, and its
|
||||
/// right-click still opens the menu.
|
||||
#[test]
|
||||
fn with_no_row_shown_by_the_filter_the_right_click_still_opens_the_menu() {
|
||||
let mut h = panel(true);
|
||||
h.state_mut().ui.layer_filter_by = crate::layer_filter_ui::FilterBy::Name;
|
||||
h.state_mut().ui.layer_filter_name = "no layer has this name".into();
|
||||
h.run_steps(4);
|
||||
assert!(h.query_by_label("Layer 1").is_none(), "the filter hides every row");
|
||||
open_menu(&mut h);
|
||||
assert!(menu_open(&h), "the empty list's right-click opens the menu");
|
||||
}
|
||||
@@ -306,6 +306,7 @@ pub use tools::perspective_crop_ui;
|
||||
pub use tools::perspective_ui;
|
||||
pub use tools::puppet_ui;
|
||||
pub use tools::retouch_ui;
|
||||
pub use tools::shape_bounds_box;
|
||||
use tools::shape_gradient_ui;
|
||||
use tools::shape_options;
|
||||
use tools::shape_paint_ui;
|
||||
@@ -757,6 +758,11 @@ impl SyntheticTarget {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod artboard_add_mode_tests;
|
||||
#[cfg(test)]
|
||||
mod shape_bounds_box_tests;
|
||||
|
||||
#[cfg(test)]
|
||||
mod lifecycle_tests;
|
||||
|
||||
@@ -793,11 +799,19 @@ mod layer_shortcut_tests;
|
||||
#[cfg(test)]
|
||||
mod live_retouch_tests;
|
||||
#[cfg(test)]
|
||||
mod lock_layers_shortcut_tests;
|
||||
#[cfg(test)]
|
||||
mod pencil_tests;
|
||||
#[cfg(test)]
|
||||
mod smart_objects_menu_tests;
|
||||
#[cfg(test)]
|
||||
mod tool_options_theme_tests;
|
||||
#[cfg(test)]
|
||||
mod tool_shift_cycle_order_tests;
|
||||
#[cfg(test)]
|
||||
mod tool_shortcut_tests;
|
||||
#[cfg(test)]
|
||||
mod toolbar_group_order_tests;
|
||||
|
||||
#[cfg(test)]
|
||||
mod pixel_aspect_tests;
|
||||
@@ -839,6 +853,11 @@ mod save_identity_tests;
|
||||
#[cfg(test)]
|
||||
mod move_auto_select_tests;
|
||||
|
||||
#[cfg(test)]
|
||||
mod move_history_names_tests;
|
||||
#[cfg(test)]
|
||||
mod move_shift_diagonal_tests;
|
||||
|
||||
#[cfg(test)]
|
||||
mod new_group_button_tests;
|
||||
|
||||
@@ -893,6 +912,8 @@ mod field_wheel_app_tests;
|
||||
#[cfg(test)]
|
||||
mod dropdown_press_tests;
|
||||
|
||||
#[cfg(test)]
|
||||
mod marquee_press_mods_tests;
|
||||
#[cfg(test)]
|
||||
mod marquee_tests;
|
||||
|
||||
@@ -920,10 +941,14 @@ mod stamp_tests;
|
||||
#[cfg(test)]
|
||||
mod alt_click_tests;
|
||||
#[cfg(test)]
|
||||
mod artboard_first_board_tests;
|
||||
#[cfg(test)]
|
||||
mod status_bar_tests;
|
||||
#[cfg(test)]
|
||||
mod stroke_timing_tests;
|
||||
|
||||
#[cfg(test)]
|
||||
mod polygon_lasso_step_snap_tests;
|
||||
#[cfg(test)]
|
||||
mod polygon_lasso_tests;
|
||||
|
||||
@@ -942,5 +967,18 @@ mod select_and_mask_button_tests;
|
||||
#[cfg(test)]
|
||||
mod saved_path_edit_tests;
|
||||
|
||||
#[cfg(test)]
|
||||
mod menu_item_labels_tests;
|
||||
#[cfg(test)]
|
||||
mod pen_path_ownership_tests;
|
||||
|
||||
#[cfg(test)]
|
||||
mod doc_tab_menu_tests;
|
||||
#[cfg(test)]
|
||||
mod layers_empty_area_menu_tests;
|
||||
#[cfg(test)]
|
||||
mod preferences_submenu_tests;
|
||||
#[cfg(test)]
|
||||
mod selection_move_step_tests;
|
||||
#[cfg(test)]
|
||||
mod view_guides_submenu_tests;
|
||||
@@ -0,0 +1,143 @@
|
||||
//! Ctrl+/ (Cmd+/ on the Mac) opens Layer > Lock Layers..., and the Layer menu and the Layers panel
|
||||
//! menu show the command's current key. Plain / still toggles Lock Transparent Pixels (#11397).
|
||||
|
||||
use egui::{Key, Modifiers};
|
||||
use serde_json::json;
|
||||
|
||||
use crate::PhotocraftApp;
|
||||
|
||||
fn app() -> PhotocraftApp {
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
|
||||
app.run("file.new", json!({"width": 20, "height": 10})).unwrap();
|
||||
app.run("layer.new.layer", json!({})).unwrap();
|
||||
app
|
||||
}
|
||||
|
||||
fn press(app: &mut PhotocraftApp, key: Key, modifiers: Modifiers) {
|
||||
let ctx = egui::Context::default();
|
||||
let raw = egui::RawInput {
|
||||
events: vec![egui::Event::ModifiersChanged(modifiers), egui::Event::Key { key, physical_key: None, pressed: true, repeat: false, modifiers }],
|
||||
..Default::default()
|
||||
};
|
||||
ctx.begin_pass(raw);
|
||||
crate::shortcuts::handle(app, &ctx);
|
||||
ctx.end_pass().textures_delta.clear();
|
||||
}
|
||||
|
||||
fn locks(app: &PhotocraftApp) -> photocraft_doc::Locks {
|
||||
let st = app.session.active().unwrap();
|
||||
st.doc.layer(st.active_layer.unwrap()).unwrap().locks
|
||||
}
|
||||
|
||||
fn set_shortcut(app: &mut PhotocraftApp, value: &str) {
|
||||
app.session.prefs.edit(|prefs| prefs.shortcuts.insert("layer.lockLayers".into(), value.into()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lock_layers_defaults_to_command_slash_in_the_engine_and_the_menu() {
|
||||
assert_eq!(photocraft_engine::commands::find("layer.lockLayers").unwrap().shortcut, Some("Cmd+/"));
|
||||
let row = crate::menu_catalog::CATALOG.iter().find(|c| c.3 == "layer.lockLayers").unwrap();
|
||||
assert_eq!(row.2, Some("Cmd+/"));
|
||||
assert_eq!(crate::shortcuts::default_shortcut("layer.lockLayers").as_deref(), Some("Cmd+/"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn command_slash_runs_what_the_menu_item_runs() {
|
||||
let mut via_key = app();
|
||||
press(&mut via_key, Key::Slash, Modifiers::COMMAND);
|
||||
let mut via_menu = app();
|
||||
crate::menus::invoke(&mut via_menu, &egui::Context::default(), "layer.lockLayers", json!({})).unwrap();
|
||||
assert_eq!(locks(&via_key), locks(&via_menu));
|
||||
assert!(locks(&via_key).all, "Lock Layers... with no choices locks the layer");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn command_slash_does_nothing_when_the_menu_item_is_greyed() {
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
|
||||
assert!(!crate::menus::is_enabled(&app, "layer.lockLayers"));
|
||||
press(&mut app, Key::Slash, Modifiers::COMMAND);
|
||||
assert!(app.session.active().is_none());
|
||||
assert!(app.ui.layers_panel_dialog.is_none());
|
||||
}
|
||||
|
||||
/// Every text the Layers panel menu paints in one frame (the row labels and their shortcut texts).
|
||||
fn painted_text(app: &mut PhotocraftApp) -> Vec<String> {
|
||||
fn collect(shape: &egui::Shape, out: &mut Vec<String>) {
|
||||
match shape {
|
||||
egui::Shape::Text(text) => out.push(text.galley.job.text.clone()),
|
||||
egui::Shape::Vec(shapes) => shapes.iter().for_each(|s| collect(s, out)),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
let ctx = egui::Context::default();
|
||||
ctx.begin_pass(egui::RawInput::default());
|
||||
let mut ui = egui::Ui::new(
|
||||
ctx.clone(),
|
||||
egui::Id::unique("lock-layers-panel-menu"),
|
||||
egui::UiBuilder::new().max_rect(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(300.0, 900.0))),
|
||||
);
|
||||
crate::panels::layer_row_ui::panel_menu(app, &mut ui);
|
||||
// The texture deltas go nowhere in a test: clear them, or epaint's drop check complains.
|
||||
let mut pass = ctx.end_pass();
|
||||
pass.textures_delta.clear();
|
||||
let mut out = Vec::new();
|
||||
for clipped in pass.shapes {
|
||||
collect(&clipped.shape, &mut out);
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn panel_menu_row_shows_the_current_key_and_follows_a_change() {
|
||||
let mut app = app();
|
||||
let default_key = crate::shortcuts::pretty("Cmd+/");
|
||||
assert_eq!(crate::shortcuts::shortcut_label(&app, "layer.lockLayers"), Some(default_key.clone()));
|
||||
// The panel menu paints the key beside Lock Layers…
|
||||
let texts = painted_text(&mut app);
|
||||
assert!(texts.iter().any(|t| t == "Lock Layers…"), "{texts:?}");
|
||||
assert!(texts.contains(&default_key), "the default key is painted: {texts:?}");
|
||||
// A changed key is painted instead of the default.
|
||||
set_shortcut(&mut app, "Cmd+Shift+L");
|
||||
let changed = crate::shortcuts::pretty("Cmd+Shift+L");
|
||||
assert_eq!(crate::shortcuts::shortcut_label(&app, "layer.lockLayers"), Some(changed.clone()));
|
||||
let texts = painted_text(&mut app);
|
||||
assert!(texts.contains(&changed), "{texts:?}");
|
||||
assert!(!texts.contains(&default_key), "the old key is gone: {texts:?}");
|
||||
// A removed key paints no key at all.
|
||||
let mut app = app_with_removed_key();
|
||||
let texts = painted_text(&mut app);
|
||||
assert!(texts.iter().any(|t| t == "Lock Layers…"), "{texts:?}");
|
||||
assert!(!texts.contains(&default_key) && !texts.contains(&changed), "{texts:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_key_can_be_changed_and_removed() {
|
||||
let mut app = app();
|
||||
set_shortcut(&mut app, "Cmd+Shift+L");
|
||||
press(&mut app, Key::Slash, Modifiers::COMMAND);
|
||||
assert!(!locks(&app).all, "the old key no longer runs the command");
|
||||
press(&mut app, Key::L, Modifiers::COMMAND | Modifiers::SHIFT);
|
||||
assert!(locks(&app).all, "the new key does");
|
||||
let mut app = app_with_removed_key();
|
||||
press(&mut app, Key::Slash, Modifiers::COMMAND);
|
||||
assert!(!locks(&app).all);
|
||||
assert_eq!(crate::shortcuts::shortcut_label(&app, "layer.lockLayers"), None);
|
||||
}
|
||||
|
||||
fn app_with_removed_key() -> PhotocraftApp {
|
||||
let mut app = app();
|
||||
set_shortcut(&mut app, "");
|
||||
app
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plain_slash_toggles_lock_transparency_and_command_slash_does_not() {
|
||||
let mut app = app();
|
||||
press(&mut app, Key::Slash, Modifiers::NONE);
|
||||
assert!(locks(&app).transparency && !locks(&app).all);
|
||||
press(&mut app, Key::Slash, Modifiers::NONE);
|
||||
assert!(!locks(&app).transparency);
|
||||
press(&mut app, Key::Slash, Modifiers::COMMAND);
|
||||
assert!(locks(&app).all);
|
||||
assert!(!locks(&app).transparency, "Ctrl+/ leaves Lock Transparent Pixels alone");
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
//! A Shift or Alt held from the start of a Rectangular or Elliptical Marquee drag picks the
|
||||
//! selection mode only when the document already has a selection (#11389). Without one the same
|
||||
//! keys constrain the shape from the first move, as in the reference application: Shift squares to
|
||||
//! the drag's shorter side, Alt draws from the centre.
|
||||
|
||||
use egui::{Modifiers, PointerButton, Pos2, vec2};
|
||||
use egui_kittest::Harness;
|
||||
use egui_kittest::kittest::Queryable;
|
||||
use photocraft_geom::Rect;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::PhotocraftApp;
|
||||
use crate::canvas::ViewXform;
|
||||
use crate::state::Tool;
|
||||
|
||||
fn harness(tool: Tool) -> Harness<'static, PhotocraftApp> {
|
||||
harness_with_step_dt(tool, 0.25)
|
||||
}
|
||||
|
||||
fn harness_with_step_dt(tool: Tool, step_dt: f32) -> Harness<'static, PhotocraftApp> {
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
|
||||
app.run("file.new", json!({"width": 800, "height": 600})).unwrap();
|
||||
app.sync_views();
|
||||
app.ui.extras.rulers = false;
|
||||
app.ui.tool = tool;
|
||||
let mut h = Harness::builder().with_size(vec2(1100.0, 800.0)).with_step_dt(step_dt).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;
|
||||
}
|
||||
crate::shortcuts::handle(app, &ctx);
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
PhotocraftApp::setup_context(&h.ctx, crate::theme::ThemeKind::ALL[0]);
|
||||
h.run_steps(4);
|
||||
// 100 %: one document pixel per point, so drags land on whole pixels.
|
||||
let v = &mut h.state_mut().ui.views[0];
|
||||
v.zoom = 1.0;
|
||||
v.center = [400.0, 300.0];
|
||||
v.fit_pending = false;
|
||||
h.run_steps(2);
|
||||
h
|
||||
}
|
||||
|
||||
fn view_xform(h: &Harness<'static, PhotocraftApp>) -> ViewXform {
|
||||
let app = h.state();
|
||||
let v = &app.ui.views[0];
|
||||
ViewXform {
|
||||
rect: crate::rulers::content_rect(app, app.last_canvas_rect),
|
||||
zoom: v.zoom,
|
||||
center: v.center,
|
||||
flip: app.ui.view.flip_horizontal,
|
||||
rotation: v.rotation,
|
||||
aspect: app.ui.view.display_aspect(),
|
||||
}
|
||||
}
|
||||
|
||||
fn screen(h: &Harness<'static, PhotocraftApp>, x: f32, y: f32) -> Pos2 {
|
||||
view_xform(h).to_screen(x, y)
|
||||
}
|
||||
|
||||
fn mods(h: &mut Harness<'static, PhotocraftApp>, m: Modifiers) {
|
||||
h.event(egui::Event::ModifiersChanged(m));
|
||||
h.run_steps(1);
|
||||
}
|
||||
|
||||
fn button(h: &mut Harness<'static, PhotocraftApp>, p: Pos2, down: bool, m: Modifiers) {
|
||||
h.event(egui::Event::PointerButton { pos: p, button: PointerButton::Primary, pressed: down, modifiers: m });
|
||||
h.run_steps(1);
|
||||
}
|
||||
|
||||
/// Move the pointer to document point `(x, y)` in a few steps.
|
||||
fn move_to(h: &mut Harness<'static, PhotocraftApp>, x: f32, y: f32) {
|
||||
let p = screen(h, x, y);
|
||||
h.event(egui::Event::PointerMoved(p));
|
||||
h.run_steps(2);
|
||||
}
|
||||
|
||||
fn press_at(h: &mut Harness<'static, PhotocraftApp>, x: f32, y: f32, m: Modifiers) {
|
||||
let p = screen(h, x, y);
|
||||
h.event(egui::Event::PointerMoved(p));
|
||||
h.run_steps(1);
|
||||
button(h, p, true, m);
|
||||
// Past egui's click distance, so the drag starts at the press point.
|
||||
move_to(h, x + 8.0, y + 6.0);
|
||||
}
|
||||
|
||||
fn release_at(h: &mut Harness<'static, PhotocraftApp>, x: f32, y: f32, m: Modifiers) {
|
||||
move_to(h, x, y);
|
||||
button(h, screen(h, x, y), false, m);
|
||||
h.run_steps(2);
|
||||
}
|
||||
|
||||
fn selection(h: &Harness<'static, PhotocraftApp>) -> Rect {
|
||||
h.state().session.active().unwrap().doc.selection.as_ref().map_or(Rect::EMPTY, |s| s.content_bounds())
|
||||
}
|
||||
|
||||
/// The two-row readout shows `W: {w} px` and `H: {ht} px` (Photoshop's format).
|
||||
fn readout(h: &Harness<'static, PhotocraftApp>, w: i32, ht: i32) -> bool {
|
||||
let labels = h.query_by_label("W:").is_some() && h.query_by_label("H:").is_some();
|
||||
let count = |v: i32| h.query_all_by_label(&format!("{v} px")).count();
|
||||
let values = if w == ht { count(w) == 2 } else { count(w) == 1 && count(ht) == 1 };
|
||||
labels && values && h.query_all_by_label_contains(" px").count() == 2
|
||||
}
|
||||
|
||||
/// Drag a marquee from `from` to `to` with `m` held from before the press to after the release.
|
||||
fn drag_held(h: &mut Harness<'static, PhotocraftApp>, m: Modifiers, from: [f32; 2], to: [f32; 2]) {
|
||||
mods(h, m);
|
||||
press_at(h, from[0], from[1], m);
|
||||
move_to(h, to[0], to[1]);
|
||||
release_at(h, to[0], to[1], m);
|
||||
mods(h, Modifiers::NONE);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn without_a_selection_keys_held_from_the_press_constrain_the_shape() {
|
||||
let shift_alt = Modifiers { shift: true, alt: true, ..Modifiers::NONE };
|
||||
let cases = [
|
||||
// ⇧ from the press: a 200 × 100 drag selects a 100 × 100 square (the shorter side).
|
||||
(Modifiers::SHIFT, [100.0, 100.0], [300.0, 200.0], Rect::new(100, 100, 200, 200)),
|
||||
// ⌥ from the press: drawn from the centre.
|
||||
(Modifiers::ALT, [400.0, 300.0], [500.0, 350.0], Rect::new(300, 250, 500, 350)),
|
||||
// Both: a square from the centre, half extent the shorter drag.
|
||||
(shift_alt, [400.0, 300.0], [500.0, 350.0], Rect::new(350, 250, 450, 350)),
|
||||
];
|
||||
for tool in [Tool::RectMarquee, Tool::EllipseMarquee] {
|
||||
for (m, from, to, want) in cases {
|
||||
let mut h = harness(tool);
|
||||
h.state_mut().ui.extras.snap = false;
|
||||
drag_held(&mut h, m, from, to);
|
||||
assert_eq!(selection(&h), want, "{tool:?} with {m:?} held from the press");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_live_readout_shows_the_constrained_shape_from_the_first_move() {
|
||||
let mut h = harness(Tool::RectMarquee);
|
||||
h.state_mut().ui.extras.snap = false;
|
||||
mods(&mut h, Modifiers::SHIFT);
|
||||
press_at(&mut h, 100.0, 100.0, Modifiers::SHIFT);
|
||||
move_to(&mut h, 300.0, 200.0);
|
||||
assert!(readout(&h, 100, 100), "the readout agrees with what the release selects");
|
||||
release_at(&mut h, 300.0, 200.0, Modifiers::SHIFT);
|
||||
mods(&mut h, Modifiers::NONE);
|
||||
assert_eq!(selection(&h), Rect::new(100, 100, 200, 200));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn with_a_selection_keys_held_from_the_press_still_pick_the_mode() {
|
||||
let mut h = harness(Tool::RectMarquee);
|
||||
h.state_mut().ui.extras.snap = false;
|
||||
h.state_mut().run("select.rect", json!({"x": 100, "y": 100, "width": 200, "height": 200})).unwrap();
|
||||
// ⇧ adds, and the added rectangle is as drawn, not squared: the union reaches 600.
|
||||
drag_held(&mut h, Modifiers::SHIFT, [400.0, 100.0], [600.0, 150.0]);
|
||||
assert_eq!(selection(&h), Rect::new(100, 100, 600, 300));
|
||||
let st = h.state().session.active().unwrap();
|
||||
let sel = st.doc.selection.as_ref().unwrap();
|
||||
assert!(sel.sample_channel(150, 150, 0) > 0.99 && sel.sample_channel(550, 125, 0) > 0.99 && sel.sample_channel(550, 250, 0) < 0.01);
|
||||
}
|
||||
@@ -149,6 +149,7 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[
|
||||
(&["Edit"], "Toolbar…", None, "edit.toolbar"),
|
||||
(&["Edit"], "---", None, "---"),
|
||||
(&["Edit", "Preferences"], "Settings…", Some("Cmd+K"), "edit.preferences.general"),
|
||||
(&["Edit", "Preferences"], "---", None, "---"),
|
||||
(&["Edit", "Preferences"], "AI Integrations…", None, "edit.preferences.integrations"),
|
||||
(&["Edit", "Preferences"], "Interface…", None, "edit.preferences.interface"),
|
||||
(&["Edit", "Preferences"], "Workspace…", None, "edit.preferences.workspace"),
|
||||
@@ -162,10 +163,11 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[
|
||||
(&["Edit", "Preferences"], "Transparency & Gamut…", None, "edit.preferences.transparencyAndGamut"),
|
||||
(&["Edit", "Preferences"], "Units & Rulers…", None, "edit.preferences.unitsAndRulers"),
|
||||
(&["Edit", "Preferences"], "Guides, Grid & Slices…", None, "edit.preferences.guidesGridAndSlices"),
|
||||
(&["Edit", "Preferences"], "Plug-ins…", None, "edit.preferences.plugIns"),
|
||||
(&["Edit", "Preferences"], "Plugins…", None, "edit.preferences.plugIns"),
|
||||
(&["Edit", "Preferences"], "Type…", None, "edit.preferences.type"),
|
||||
(&["Edit", "Preferences"], "Enhanced Controls…", None, "edit.preferences.enhancedControls"),
|
||||
(&["Edit", "Preferences"], "Raw Defaults…", None, "edit.preferences.rawDefaults"),
|
||||
(&["Edit", "Preferences"], "---", None, "---"),
|
||||
(&["Edit", "Preferences"], "Camera Raw…", None, "edit.preferences.rawDefaults"),
|
||||
(&["Image", "Mode"], "Bitmap", None, "image.mode.bitmap"),
|
||||
(&["Image", "Mode"], "Grayscale", None, "image.mode.grayscale"),
|
||||
(&["Image", "Mode"], "Duotone", None, "image.mode.duotone"),
|
||||
@@ -350,8 +352,9 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[
|
||||
(&["Layer", "Smart Objects"], "Replace Contents…", None, "layer.smartObjects.replaceContents"),
|
||||
(&["Layer", "Smart Objects"], "Export Contents…", None, "layer.smartObjects.exportContents"),
|
||||
(&["Layer", "Smart Objects"], "---", None, "---"),
|
||||
(&["Layer", "Smart Objects"], "Embed Linked", None, "layer.smartObjects.convertToEmbedded"),
|
||||
(&["Layer", "Smart Objects"], "Embed All Linked", None, "layer.smartObjects.embedAllLinked"),
|
||||
(&["Layer", "Smart Objects"], "Convert to Linked…", None, "layer.smartObjects.convertToLinked"),
|
||||
(&["Layer", "Smart Objects"], "Convert to Embedded", None, "layer.smartObjects.convertToEmbedded"),
|
||||
(&["Layer", "Smart Objects"], "Convert to Layers", None, "layer.smartObjects.convertToLayers"),
|
||||
(&["Layer", "Smart Objects"], "---", None, "---"),
|
||||
(&["Layer", "Smart Objects", "Stack Mode"], "Entropy", None, "layer.smartObjects.stackMode.entropy"),
|
||||
@@ -367,10 +370,6 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[
|
||||
(&["Layer", "Smart Objects", "Stack Mode"], "Variance", None, "layer.smartObjects.stackMode.variance"),
|
||||
(&["Layer", "Smart Objects"], "---", None, "---"),
|
||||
(&["Layer", "Smart Objects"], "Rasterize", None, "layer.smartObjects.rasterize"),
|
||||
(&["Layer", "Smart Objects"], "---", None, "---"),
|
||||
(&["Layer", "Smart Objects"], "Warp", None, "layer.smartObjects.warp"),
|
||||
(&["Layer", "Smart Objects"], "Perspective Warp", None, "layer.smartObjects.perspectiveWarp"),
|
||||
(&["Layer", "Smart Objects"], "Puppet Warp", None, "layer.smartObjects.puppetWarp"),
|
||||
(&["Layer", "Video Layers"], "New Blank Video Layer", None, "layer.videoLayers.newBlankVideoLayer"),
|
||||
(&["Layer", "Video Layers"], "New Video Layer from File…", None, "layer.videoLayers.newVideoLayerFromFile"),
|
||||
(&["Layer", "Video Layers"], "---", None, "---"),
|
||||
@@ -413,8 +412,8 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[
|
||||
(&["Layer", "Arrange"], "Reverse", None, "layer.arrange.reverse"),
|
||||
(&["Layer", "Combine Shapes"], "Unite Shapes", None, "layer.combineShapes.unite"),
|
||||
(&["Layer", "Combine Shapes"], "Subtract Front Shape", None, "layer.combineShapes.subtractFrontShape"),
|
||||
(&["Layer", "Combine Shapes"], "Intersect Shape Areas", None, "layer.combineShapes.intersectShapeAreas"),
|
||||
(&["Layer", "Combine Shapes"], "Exclude Overlapping Shapes", None, "layer.combineShapes.excludeOverlappingShapes"),
|
||||
(&["Layer", "Combine Shapes"], "Unite Shapes at Overlap", None, "layer.combineShapes.intersectShapeAreas"),
|
||||
(&["Layer", "Combine Shapes"], "Subtract Shapes at Overlap", None, "layer.combineShapes.excludeOverlappingShapes"),
|
||||
(&["Layer", "Combine Shapes"], "---", None, "---"),
|
||||
(&["Layer", "Combine Shapes"], "Merge Shape Components", None, "layer.combineShapes.mergeShapeComponents"),
|
||||
(&["Layer", "Align"], "Top Edges", None, "layer.align.topEdges"),
|
||||
@@ -435,7 +434,7 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[
|
||||
(&["Layer", "Distribute"], "Horizontally", None, "layer.distribute.horizontally"),
|
||||
(&["Layer", "Distribute"], "Vertically", None, "layer.distribute.vertically"),
|
||||
(&["Layer"], "---", None, "---"),
|
||||
(&["Layer"], "Lock Layers…", None, "layer.lockLayers"),
|
||||
(&["Layer"], "Lock Layers…", Some("Cmd+/"), "layer.lockLayers"),
|
||||
(&["Layer"], "---", None, "---"),
|
||||
(&["Layer"], "Link Layers", None, "layer.linkLayers"),
|
||||
(&["Layer"], "Select Linked Layers", None, "layer.selectLinkedLayers"),
|
||||
@@ -650,10 +649,10 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[
|
||||
(&["View", "Proof Setup"], "Working Magenta Plate", None, "view.proofSetup.workingMagentaPlate"),
|
||||
(&["View", "Proof Setup"], "Working Yellow Plate", None, "view.proofSetup.workingYellowPlate"),
|
||||
(&["View", "Proof Setup"], "Working Black Plate", None, "view.proofSetup.workingBlackPlate"),
|
||||
(&["View", "Proof Setup"], "Working CMY Plate", None, "view.proofSetup.workingCmyPlate"),
|
||||
(&["View", "Proof Setup"], "Working CMY Plates", None, "view.proofSetup.workingCmyPlate"),
|
||||
(&["View", "Proof Setup"], "---", None, "---"),
|
||||
(&["View", "Proof Setup"], "Legacy Macintosh RGB", None, "view.proofSetup.legacyMacintoshRgb"),
|
||||
(&["View", "Proof Setup"], "Internet Standard RGB", None, "view.proofSetup.internetStandardRgb"),
|
||||
(&["View", "Proof Setup"], "Legacy Macintosh RGB (Gamma 1.8)", None, "view.proofSetup.legacyMacintoshRgb"),
|
||||
(&["View", "Proof Setup"], "Internet Standard RGB (sRGB)", None, "view.proofSetup.internetStandardRgb"),
|
||||
(&["View", "Proof Setup"], "Monitor RGB", None, "view.proofSetup.monitorRgb"),
|
||||
(&["View", "Proof Setup"], "---", None, "---"),
|
||||
(&["View", "Proof Setup"], "Color Blindness — Protanopia-type", None, "view.proofSetup.colorBlindnessProtanopia"),
|
||||
@@ -720,13 +719,15 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[
|
||||
(&["View", "Snap To"], "---", None, "---"),
|
||||
(&["View", "Snap To"], "All", None, "view.snapTo.all"),
|
||||
(&["View"], "---", None, "---"),
|
||||
(&["View"], "Lock Guides", Some("Cmd+Alt+;"), "view.lockGuides"),
|
||||
(&["View"], "Clear Guides", None, "view.clearGuides"),
|
||||
(&["View"], "Clear Selected Artboard Guides", None, "view.clearSelectedArtboardGuides"),
|
||||
(&["View"], "Clear Canvas Guides", None, "view.clearCanvasGuides"),
|
||||
(&["View"], "New Guide…", None, "view.newGuide"),
|
||||
(&["View"], "New Guide Layout…", None, "view.newGuideLayout"),
|
||||
(&["View"], "New Guides From Shape", None, "view.newGuidesFromShape"),
|
||||
(&["View", "Guides"], "Edit Selected Guides", None, "view.editSelectedGuides"),
|
||||
(&["View", "Guides"], "Lock Guides", Some("Cmd+Alt+;"), "view.lockGuides"),
|
||||
(&["View", "Guides"], "Clear Guides", None, "view.clearGuides"),
|
||||
(&["View", "Guides"], "Clear Selected Guides", None, "view.clearSelectedGuides"),
|
||||
(&["View", "Guides"], "Clear Selected Artboard Guides", None, "view.clearSelectedArtboardGuides"),
|
||||
(&["View", "Guides"], "Clear Canvas Guides", None, "view.clearCanvasGuides"),
|
||||
(&["View", "Guides"], "New Guide…", None, "view.newGuide"),
|
||||
(&["View", "Guides"], "New Guide Layout…", None, "view.newGuideLayout"),
|
||||
(&["View", "Guides"], "New Guides From Shape", None, "view.newGuidesFromShape"),
|
||||
(&["View"], "---", None, "---"),
|
||||
(&["View"], "Lock Slices", None, "view.lockSlices"),
|
||||
(&["View"], "Clear Slices", None, "view.clearSlices"),
|
||||
@@ -750,7 +751,7 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[
|
||||
(&["Window", "Arrange"], "Float in Window", None, "window.arrange.floatInWindow"),
|
||||
(&["Window", "Arrange"], "Float All in Windows", None, "window.arrange.floatAllInWindows"),
|
||||
(&["Window", "Arrange"], "---", None, "---"),
|
||||
(&["Window", "Arrange"], "New Window for Document", None, "window.arrange.newWindowForDocument"),
|
||||
(&["Window", "Arrange"], "New Window", None, "window.arrange.newWindowForDocument"),
|
||||
(&["Window", "Arrange"], "---", None, "---"),
|
||||
(&["Window", "Arrange"], "Match Zoom", None, "window.arrange.matchZoom"),
|
||||
(&["Window", "Arrange"], "Match Location", None, "window.arrange.matchLocation"),
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
//! #11399: the Combine Shapes, Open Recent, Arrange and Proof Setup items carry the reference
|
||||
//! application's names, in the live menu tree and in the engine's command labels.
|
||||
|
||||
use crate::PhotocraftApp;
|
||||
use crate::menus::menu_items;
|
||||
|
||||
/// (command id, label the live menu must show).
|
||||
const LABELS: [(&str, &str); 7] = [
|
||||
("layer.combineShapes.intersectShapeAreas", "Unite Shapes at Overlap"),
|
||||
("layer.combineShapes.excludeOverlappingShapes", "Subtract Shapes at Overlap"),
|
||||
("file.clearRecent", "Clear Recent File List"),
|
||||
("window.arrange.newWindowForDocument", "New Window"),
|
||||
("view.proofSetup.workingCmyPlate", "Working CMY Plates"),
|
||||
("view.proofSetup.legacyMacintoshRgb", "Legacy Macintosh RGB (Gamma 1.8)"),
|
||||
("view.proofSetup.internetStandardRgb", "Internet Standard RGB (sRGB)"),
|
||||
];
|
||||
|
||||
fn app() -> PhotocraftApp {
|
||||
PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn live_menu_shows_the_reference_names() {
|
||||
let app = app();
|
||||
let items = menu_items(&app);
|
||||
for (id, label) in LABELS {
|
||||
let item = items.iter().find(|i| i.id == id).unwrap_or_else(|| panic!("{id} is in the menu tree"));
|
||||
assert_eq!(item.label, label, "{id}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn open_recent_clear_item_is_labelled_with_and_without_recent_files() {
|
||||
let mut app = app();
|
||||
app.ui.recent_files = vec!["/tmp/a.png".into()];
|
||||
let items = menu_items(&app);
|
||||
let clear = items.iter().find(|i| i.id == "file.clearRecent").expect("clear item");
|
||||
assert_eq!(clear.label, "Clear Recent File List");
|
||||
assert!(clear.enabled);
|
||||
assert_eq!(clear.path, vec!["File".to_string(), "Open Recent".to_string()]);
|
||||
// With nothing to clear the item stays in the submenu, greyed.
|
||||
app.ui.recent_files.clear();
|
||||
let items = menu_items(&app);
|
||||
let clear = items.iter().find(|i| i.id == "file.clearRecent").expect("clear item");
|
||||
assert_eq!(clear.label, "Clear Recent File List");
|
||||
assert!(!clear.enabled);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn engine_command_labels_match_the_menu() {
|
||||
let specs = photocraft_engine::cmd::command_specs();
|
||||
// The two Combine Shapes and the three Proof Setup commands have an engine command under the
|
||||
// same id as the menu row.
|
||||
for (id, label) in LABELS {
|
||||
if let Some(spec) = specs.iter().find(|s| s.id == id) {
|
||||
assert_eq!(spec.label, label, "engine label of {id}");
|
||||
}
|
||||
}
|
||||
let engine_ids = [
|
||||
"layer.combineShapes.intersectShapeAreas",
|
||||
"layer.combineShapes.excludeOverlappingShapes",
|
||||
"view.proofSetup.workingCmyPlate",
|
||||
"view.proofSetup.legacyMacintoshRgb",
|
||||
];
|
||||
for id in engine_ids {
|
||||
assert!(specs.iter().any(|s| s.id == id), "{id} is an engine command");
|
||||
}
|
||||
// The shell command for the extra window is registered under its own id.
|
||||
let shell = photocraft_engine::shell_commands::SHELL_COMMANDS.iter().find(|c| c.0 == "window.newWindowForDocument").expect("shell command");
|
||||
assert_eq!(shell.1, "New Window");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn history_step_names_and_other_labels_are_unchanged() {
|
||||
// The Home screen keeps its own button label (#11399 "not measured").
|
||||
let src = include_str!("home_recent_ui.rs");
|
||||
assert!(src.contains("tl!(\"Clear Recent Files\")"));
|
||||
// Merge Shape Components stays in Combine Shapes.
|
||||
let app = app();
|
||||
let items = menu_items(&app);
|
||||
assert!(items.iter().any(|i| i.id == "layer.combineShapes.mergeShapeComponents"));
|
||||
}
|
||||
@@ -203,7 +203,7 @@ mod reveal_label_tests {
|
||||
let expected = if cfg!(target_os = "macos") {
|
||||
"Reveal in Finder"
|
||||
} else if cfg!(windows) {
|
||||
"Show in Explorer"
|
||||
"Reveal in Explorer"
|
||||
} else {
|
||||
"Show in Folder"
|
||||
};
|
||||
|
||||
@@ -626,6 +626,10 @@ fn type_command_target(app: &PhotocraftApp) -> Option<Value> {
|
||||
fn invoke_view_command(app: &mut PhotocraftApp, ctx: &egui::Context, id: &str, params: &Value) -> Option<Result<Value, String>> {
|
||||
match id {
|
||||
"view.zoomIn" | "view.zoomOut" | "view.fitOnScreen" | "view.actualPixels" => Some(app.run(id, params.clone())),
|
||||
"view.editSelectedGuides" => Some(crate::new_guide_ui::open_edit(app).map(|_| Value::Null)),
|
||||
"view.clearSelectedGuides" => {
|
||||
Some(crate::guide_select::delete_selected(app).and_then(|done| if done { Ok(Value::Null) } else { Err("No guide is selected".to_string()) }))
|
||||
}
|
||||
"view.rulers" | "view.show.grid" | "view.show.guides" | "view.snap" | "view.lockGuides" => {
|
||||
let extras = &mut app.ui.extras;
|
||||
let slot = match id {
|
||||
|
||||
@@ -154,7 +154,7 @@ pub fn menu_items(app: &PhotocraftApp) -> Vec<MenuItem> {
|
||||
}
|
||||
recent.push(MenuItem {
|
||||
id: "file.clearRecent".into(),
|
||||
label: "Clear Recent Files".into(),
|
||||
label: "Clear Recent File List".into(),
|
||||
path: rp.clone(),
|
||||
shortcut: None,
|
||||
enabled: !app.ui.recent_files.is_empty(),
|
||||
|
||||
Loaded 100 of 136 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user