From f6fd65f6c1637ff82067852a5058018ad074c324 Mon Sep 17 00:00:00 2001 From: Michael Anderson Date: Sat, 17 Oct 2026 08:22:53 -0500 Subject: [PATCH 01/93] Never crash: Refuse an ERF or MEF whose raw strip runs past the file (#2119) --- crates/raw/src/vendor/erf.rs | 37 +++++++++++++++++++++++++++++++++++- crates/raw/src/vendor/mef.rs | 37 +++++++++++++++++++++++++++++++++++- docs/whats-new.md | 7 +++++++ 3 files changed, 79 insertions(+), 2 deletions(-) diff --git a/crates/raw/src/vendor/erf.rs b/crates/raw/src/vendor/erf.rs index b9861ef386..7f88dae2af 100644 --- a/crates/raw/src/vendor/erf.rs +++ b/crates/raw/src/vendor/erf.rs @@ -95,8 +95,12 @@ pub(crate) fn decode(bytes: &[u8], mode: Mode) -> Result { _ => Rect::new(0, 0, w, h), }; // the white balance is measured from the samples, so the header probe reads them too + // the strip length is the tag value, so a short file must fail before the sample buffer is sized from it let chunks = info.chunks(bytes.len() as u64); - let src = chunks.first().and_then(|c| chunk_bytes(bytes, c)).ok_or_else(|| RawError::Corrupt("Erf strip outside file".into()))?; + let src = chunks + .first() + .and_then(|c| chunk_bytes(bytes, c).filter(|s| s.len() as u64 == c.len)) + .ok_or_else(|| RawError::Corrupt("Erf strip outside file".into()))?; let mut d = vec![0u16; n]; unpack(src, &mut d); let white = super::white_from_data(&d, 12); @@ -196,4 +200,35 @@ mod tests { } } } + + /// Rewrite the raw IFD's height, rows per strip and strip length in place (the strip data stays as written). + fn declare(f: &mut [u8], rows: u32, strip_len: u32) { + let tiff = Tiff::parse(f).unwrap(); + let raw = &tiff.ifds[0].sub_ifds[0]; + let spots: Vec<_> = [(t::IMAGE_LENGTH, rows), (t::ROWS_PER_STRIP, rows), (t::STRIP_BYTE_COUNTS, strip_len)] + .into_iter() + .map(|(tag, v)| { + let e = raw.entries.iter().find(|e| e.tag == tag).unwrap(); + (e.offset as usize, matches!(e.value, Value::Short(_)), v) + }) + .collect(); + for (at, short, v) in spots { + if short { + f[at..at + 2].copy_from_slice(&u16::try_from(v).unwrap().to_be_bytes()); + } else { + f[at..at + 4].copy_from_slice(&v.to_be_bytes()); + } + } + } + + #[test] + fn a_strip_longer_than_the_file_is_an_error() { + // #2119: the declared strip length matched the size, so a few bytes of data were decoded as a full frame + let px: Vec = (0..40).map(|i| (i * 13 % 4096) as u16).collect(); + let mut f = sample(20, 2, &px); + declare(&mut f, 2000, 32 * 2000); + assert_eq!(crate::probe(&f), Some(RawFormat::Erf)); + assert!(matches!(crate::probe_info(&f), Err(RawError::Corrupt(_)))); + assert!(matches!(crate::decode(&f), Err(RawError::Corrupt(_)))); + } } diff --git a/crates/raw/src/vendor/mef.rs b/crates/raw/src/vendor/mef.rs index 207bc8871e..30993ad729 100644 --- a/crates/raw/src/vendor/mef.rs +++ b/crates/raw/src/vendor/mef.rs @@ -87,8 +87,12 @@ pub(crate) fn decode(bytes: &[u8], mode: Mode) -> Result { None => Rect::new(0, 0, w, h), }; // the white balance is measured from the samples, so the header probe reads them too + // the strip length is the tag value, so a short file must fail before the sample buffer is sized from it let chunks = info.chunks(bytes.len() as u64); - let src = chunks.first().and_then(|c| chunk_bytes(bytes, c)).ok_or_else(|| RawError::Corrupt("Mef strip outside file".into()))?; + let src = chunks + .first() + .and_then(|c| chunk_bytes(bytes, c).filter(|s| s.len() as u64 == c.len)) + .ok_or_else(|| RawError::Corrupt("Mef strip outside file".into()))?; let mut d = vec![0u16; n]; crate::unpack::unpack_msb(src, 12, &mut d); let white = super::white_from_data(&d, 12); @@ -184,4 +188,35 @@ mod tests { } } } + + /// Rewrite the raw IFD's height, rows per strip and strip length in place (the strip data stays as written). + fn declare(f: &mut [u8], rows: u32, strip_len: u32) { + let tiff = Tiff::parse(f).unwrap(); + let raw = &tiff.ifds[0].sub_ifds[0]; + let spots: Vec<_> = [(t::IMAGE_LENGTH, rows), (t::ROWS_PER_STRIP, rows), (t::STRIP_BYTE_COUNTS, strip_len)] + .into_iter() + .map(|(tag, v)| { + let e = raw.entries.iter().find(|e| e.tag == tag).unwrap(); + (e.offset as usize, matches!(e.value, Value::Short(_)), v) + }) + .collect(); + for (at, short, v) in spots { + if short { + f[at..at + 2].copy_from_slice(&u16::try_from(v).unwrap().to_be_bytes()); + } else { + f[at..at + 4].copy_from_slice(&v.to_be_bytes()); + } + } + } + + #[test] + fn a_strip_longer_than_the_file_is_an_error() { + // #2119: the declared strip length matched the size, so a few bytes of data were decoded as a full frame + let px: Vec = (0..40).map(|i| (i * 13 % 4096) as u16).collect(); + let mut f = sample(20, 2, &px); + declare(&mut f, 2000, 30 * 2000); + assert_eq!(crate::probe(&f), Some(RawFormat::Mef)); + assert!(matches!(crate::probe_info(&f), Err(RawError::Corrupt(_)))); + assert!(matches!(crate::decode(&f), Err(RawError::Corrupt(_)))); + } } diff --git a/docs/whats-new.md b/docs/whats-new.md index 97e1367a89..6d4a3fcbab 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -1,5 +1,12 @@ # What's new in LightCraft +## 2026-10-17 + +### Short Epson and Mamiya raws are refused +- An Epson ERF or Mamiya MEF whose raw strip runs past the end of the file is now an error on import (issue #2119). + Before, the header probe trusted the declared strip length and sized its sample buffer from it, so a few KB of file + could make it allocate gigabytes. + ## 2026-10-14 ### Lightroom radial masks on the right side From 2b518b55fe65340a2bc62f3a271c8b7963022556 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Thu, 22 Oct 2026 10:58:54 +0200 Subject: [PATCH 02/93] Reject non-finite values when parsing .cube LUTs Found while testing crates/pipeline/src/lut.rs:25 (Lut3d::parse_cube, the `three` helper) Co-Authored-By: Claude Opus 5.5 --- crates/pipeline/src/lut.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/pipeline/src/lut.rs b/crates/pipeline/src/lut.rs index b66c3444ed..fccb34e8f6 100644 --- a/crates/pipeline/src/lut.rs +++ b/crates/pipeline/src/lut.rs @@ -24,7 +24,7 @@ impl Lut3d { let mut data = Vec::new(); let three = |rest: &str| -> Option<[f32; 3]> { let v: Vec = rest.split_whitespace().filter_map(|x| x.parse().ok()).collect(); - (v.len() == 3).then(|| [v[0], v[1], v[2]]) + (v.len() == 3 && v.iter().all(|x| x.is_finite())).then(|| [v[0], v[1], v[2]]) }; for line in text.lines() { let l = line.trim(); @@ -140,4 +140,19 @@ mod tests { assert!(Lut3d::parse_cube("LUT_1D_SIZE 4\n0 0 0").is_err()); assert!(Lut3d::parse_cube("LUT_3D_SIZE 2\n0 0 0\n").is_err(), "too few entries"); } + + #[test] + fn non_finite_entries_rejected() { + let bad_line = |body: &str| { + let e = Lut3d::parse_cube(body).expect_err(body); + assert!(e.starts_with("bad line"), "{e}"); + }; + bad_line(&format!("LUT_3D_SIZE 2\n{}", "-inf inf nan\n".repeat(8))); + bad_line(&format!("LUT_3D_SIZE 2\n{}", "1e39 0 0\n".repeat(8))); + bad_line(&format!("LUT_3D_SIZE 2\n-inf 0 0\n{}", "0 0 0\n".repeat(7))); + let ok = cube(|c| c, 2); + assert!(Lut3d::parse_cube(&ok).is_ok()); + assert!(Lut3d::parse_cube(&format!("DOMAIN_MIN nan 0 0\n{ok}")).is_err()); + assert!(Lut3d::parse_cube(&format!("DOMAIN_MAX inf 1 1\n{ok}")).is_err()); + } } From 4ef14cc4b3a97db1b56e24f0a101ce63fdbe7e8e Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sat, 24 Oct 2026 20:38:36 +0200 Subject: [PATCH 03/93] Strip trailing NULs from non-UTF-8 IPTC text Found while testing crates/meta/src/iptc.rs:8 (decode) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/meta/src/iptc.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/meta/src/iptc.rs b/crates/meta/src/iptc.rs index 24955748fb..391774287f 100644 --- a/crates/meta/src/iptc.rs +++ b/crates/meta/src/iptc.rs @@ -8,8 +8,8 @@ use crate::{DateTime, Metadata}; fn decode(b: &[u8], utf8: bool) -> String { match std::str::from_utf8(b) { Ok(s) => s.trim_end_matches('\0').trim().to_string(), - Err(_) if utf8 => String::from_utf8_lossy(b).trim().to_string(), - Err(_) => b.iter().map(|&c| c as char).collect::().trim().to_string(), + Err(_) if utf8 => String::from_utf8_lossy(b).trim_end_matches('\0').trim().to_string(), + Err(_) => b.iter().map(|&c| c as char).collect::().trim_end_matches('\0').trim().to_string(), } } @@ -106,6 +106,20 @@ pub(crate) mod tests { assert_eq!(m.capture_time.unwrap().to_iso(), "2021-03-04T10:11:12+01:00"); } + #[test] + fn non_utf8_text_drops_trailing_nul() { + let mut v = Vec::new(); + ds(&mut v, 2, 5, &[0x43, 0xe9, 0x00]); + ds(&mut v, 2, 25, &[0x6b, 0xe9, 0x00]); + let m = parse_iptc(&v); + assert_eq!(m.title.as_deref(), Some("Cé")); + assert_eq!(m.keywords, vec!["ké".to_string()]); + let mut u = Vec::new(); + ds(&mut u, 1, 90, b"\x1b%G"); + ds(&mut u, 2, 5, &[0x43, 0xff, 0x00]); + assert_eq!(parse_iptc(&u).title.as_deref(), Some("C\u{fffd}")); + } + #[test] fn latin1_and_extended_and_garbage() { let mut v = Vec::new(); From 89e08db8b84a5dd11904bf7de39f6ee06144db49 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sat, 24 Oct 2026 18:50:11 +0000 Subject: [PATCH 04/93] Clamp negative signals to zero in hlg_decode Found while testing crates/color/src/transfer.rs:52 Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/color/src/transfer.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/color/src/transfer.rs b/crates/color/src/transfer.rs index 8a7e4fdbf1..72ff76fc78 100644 --- a/crates/color/src/transfer.rs +++ b/crates/color/src/transfer.rs @@ -49,6 +49,7 @@ pub fn hlg_encode(e: f64) -> f64 { } pub fn hlg_decode(s: f64) -> f64 { + let s = s.max(0.0); if s <= 0.5 { s * s / 3.0 } else { (((s - HLG_C) / HLG_A).exp() + HLG_B) / 12.0 } } @@ -112,6 +113,11 @@ mod tests { } } + #[test] + fn hlg_decode_clamps_negative() { + assert_eq!(hlg_decode(-0.5), 0.0); + } + #[test] fn pq_hlg_roundtrip() { for i in 0..=50 { From dd119ca0074c9ae5324f38c2b8e08c8e84b0c4f4 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sun, 25 Oct 2026 06:01:52 +0000 Subject: [PATCH 05/93] Reject signed strings in Hash128::parse Found while testing crates/preview/src/hash.rs:21 Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/preview/src/hash.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/preview/src/hash.rs b/crates/preview/src/hash.rs index e3ab51fe8e..63650fd167 100644 --- a/crates/preview/src/hash.rs +++ b/crates/preview/src/hash.rs @@ -18,7 +18,8 @@ impl fmt::Display for Hash128 { impl Hash128 { pub fn parse(s: &str) -> Option { - (s.len() == 32).then(|| u128::from_str_radix(s, 16).ok().map(Hash128)).flatten() + // `from_str_radix` also accepts a leading '+', so check the digits explicitly. + (s.len() == 32 && s.bytes().all(|b| b.is_ascii_hexdigit())).then(|| u128::from_str_radix(s, 16).ok().map(Hash128)).flatten() } } @@ -59,3 +60,16 @@ impl Hasher128 { pub fn hash_bytes(bytes: &[u8]) -> Hash128 { Hasher128::new().update(bytes).finish() } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn parse_rejects_signed_and_non_hex() { + assert_eq!(Hash128::parse(&format!("+{}", "1".repeat(31))), None); + assert_eq!(Hash128::parse(&format!("-{}", "1".repeat(31))), None); + let h = "0123456789abcdefABCDEF0123456789"; + assert_eq!(Hash128::parse(h).map(|x| x.to_string()), Some(h.to_lowercase())); + } +} From 8fe7198dbdac3d90ee0f6bd15f6150e5b4649611 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 24 Oct 2026 21:20:42 +0000 Subject: [PATCH 06/93] LR-FILT-SEARCH-META: >= and <= in fielded search tokens `rating:>=3`, `iso:<=400`, `f:>=2.8` read the `=` as part of the number, the parse failed, and the token silently matched no photo. Parse the two-character operators first and compare inclusively; `>`, `<`, `=` and bare numbers are unchanged. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01SqKgSkHi5MfTQFrZvDKBjm --- crates/catalog/src/query.rs | 24 +++++++++++++----------- crates/catalog/src/tests.rs | 36 ++++++++++++++++++++++++++++++++++++ docs/parity-checklist.md | 4 ++-- docs/whats-new.md | 6 ++++++ 4 files changed, 57 insertions(+), 13 deletions(-) diff --git a/crates/catalog/src/query.rs b/crates/catalog/src/query.rs index ff94268a8b..7dea42e3fd 100644 --- a/crates/catalog/src/query.rs +++ b/crates/catalog/src/query.rs @@ -20,7 +20,7 @@ pub enum RatingOp { #[serde(default, rename_all = "camelCase")] pub struct Filter { /// Free-text search: every token must match filename, title, caption, keywords, camera, lens, - /// location or format. Tokens like `rating:3`, `flag:pick`, `iso:>800`, `camera:x2` are fielded. + /// location or format. Tokens like `rating:3`, `rating:>=3`, `flag:pick`, `iso:>800`, `camera:x2` are fielded. pub text: String, pub rating: u8, pub rating_op: RatingOp, @@ -179,23 +179,25 @@ fn token_matches(p: &Photo, tok: &str) -> bool { // a token that starts with a quote is a phrase, even with a colon in it if let Some((field, quoted)) = t.split_once(':').filter(|_| !t.starts_with('"')) { let val = unquote(quoted); - let num = |s: &str| -> Option<(char, f64)> { - let (op, rest) = match s.chars().next()? { - c @ ('>' | '<' | '=') => (c, &s[1..]), - _ => ('=', s), - }; - rest.parse().ok().map(|v| (op, v)) + // `>=` / `<=` before `>` / `<`: otherwise `rating:>=3` reads `=3` as the number and matches nothing + let num = |s: &str| -> Option<(&str, f64)> { + let op = [">=", "<=", ">", "<", "="].into_iter().find(|op| s.starts_with(op)).unwrap_or(""); + s.get(op.len()..)?.parse().ok().map(|v| (op, v)) }; let cmp = |x: f64, s: &str| match num(s) { - Some(('>', v)) => x > v, - Some(('<', v)) => x < v, + Some((">", v)) => x > v, + Some(("<", v)) => x < v, + Some((">=", v)) => x > v || (x - v).abs() < 1e-9, + Some(("<=", v)) => x < v || (x - v).abs() < 1e-9, Some((_, v)) => (x - v).abs() < 1e-9, None => false, }; // Fields stored as `f32` compare at f32 precision: 2.8f32 widened to f64 is not 2.8. let cmp32 = |x: f32, s: &str| match num(s) { - Some(('>', v)) => x > v as f32, - Some(('<', v)) => x < v as f32, + Some((">", v)) => x > v as f32, + Some(("<", v)) => x < v as f32, + Some((">=", v)) => x >= v as f32, + Some(("<=", v)) => x <= v as f32, Some((_, v)) => x == v as f32, None => false, }; diff --git a/crates/catalog/src/tests.rs b/crates/catalog/src/tests.rs index 579175086e..c27d1514b7 100644 --- a/crates/catalog/src/tests.rs +++ b/crates/catalog/src/tests.rs @@ -163,6 +163,42 @@ fn search_tokens_match_f32_aperture_and_focal() { assert!(q("f:>2.8").is_empty(), "f:>2.8"); assert!(q("focal:<5.6").is_empty(), "focal:<5.6"); assert_eq!(q("f:>2.7"), vec![a], "f:>2.7"); + assert_eq!(q("f:>=2.8"), vec![a], "f:>=2.8 counts the photo's own value"); + assert_eq!(q("focal:<=5.6"), vec![a], "focal:<=5.6"); + assert!(q("f:>=2.9").is_empty(), "f:>=2.9"); + assert!(q("focal:<=5.5").is_empty(), "focal:<=5.5"); +} + +/// `>=` and `<=` in a fielded token are the inclusive comparisons. They used to read the `=` as +/// part of the number, so `rating:>=3` or `iso:<=400` silently matched no photo at all. +#[test] +fn search_tokens_compare_inclusively() { + let mut c = Catalog::new(); + let (two, three, four) = ( + photo(&mut c, "two.jpg", "2026-05-01T10:00:00"), + photo(&mut c, "three.jpg", "2026-05-02T10:00:00"), + photo(&mut c, "four.jpg", "2026-05-03T10:00:00"), + ); + for (id, rating, iso) in [(two, 2, 200), (three, 3, 400), (four, 4, 800)] { + c.apply(Op::SetRating { id, rating }).unwrap(); + let mut m = c.photo(id).unwrap().meta.clone(); + m.iso = Some(iso); + c.apply(Op::SetMeta { id, meta: Box::new(m) }).unwrap(); + } + let q = |t: &str| { + let mut ids = c.query(&Filter { text: t.into(), ..Default::default() }, &Sort::default()); + ids.sort(); + ids + }; + assert_eq!(q("rating:>=3"), vec![three, four]); + assert_eq!(q("stars:<=3"), vec![two, three]); + assert_eq!(q("iso:>=400"), vec![three, four]); + assert_eq!(q("iso:<=400"), vec![two, three]); + assert_eq!(q("rating:>3"), vec![four], "strict comparisons are unchanged"); + assert_eq!(q("rating:=3"), vec![three]); + assert_eq!(q("rating:3"), vec![three]); + assert!(q("rating:>=").is_empty(), "an operator without a number matches nothing"); + assert!(q("rating:=>3").is_empty(), "not an operator"); } /// A `captured` string that is not ASCII (the Lightroom importer copies `captureTime` into an diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index 080680b9ff..90cc314f7e 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -1,6 +1,6 @@ # Lightroom parity checklist -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-24 · **Change:** minor (KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-25 · **Change:** minor (LR-FILT-SEARCH-META: `>=` / `<=` in fielded search tokens; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 The measured, row-by-row checklist: one row per Lightroom feature, menu item and shortcut, what we have and what is missing. It answers *does the feature exist?* (feature breadth). Whether it is good @@ -146,7 +146,7 @@ differences and missing bindings are in [ui-parity.md](ui-parity.md#shortcuts). | Id | Feature | Tier | Status | Evidence | Missing / notes | |---|---|---|---|---|---| -| LR-FILT-SEARCH-META | Text search | P0 | ✅ | `cmd:library.filter` (`text`), `crates/ui-egui/src/panels/topbar.rs`, `crates/catalog/src/query.rs` | fielded tokens (`rating:3`, `iso:>800`, `camera:…`); plain words also match the people named on faces; double quotes keep several words in one token (`person:"Jane Doe"`, `"jane doe"`, issue #1449); no suggestions dropdown | +| LR-FILT-SEARCH-META | Text search | P0 | ✅ | `cmd:library.filter` (`text`), `crates/ui-egui/src/panels/topbar.rs`, `crates/catalog/src/query.rs` | fielded tokens (`rating:3`, `iso:>800`, `rating:>=3` / `iso:<=400`, `camera:…`); plain words also match the people named on faces; double quotes keep several words in one token (`person:"Jane Doe"`, `"jane doe"`, issue #1449); no suggestions dropdown | | LR-FILT-SEARCH-AI | Natural-language search | P2 | ⬜ | | | | LR-FILT-RATING | Rating filter | P0 | ✅ | `cmd:library.filter` (`rating`, `ratingOp`), `crates/ui-egui/src/panels/filterbar.rs` | ≥ / = / ≤ stars in the filter bar (`cmd:view.filterBar`) | | LR-FILT-FLAG | Flag filter | P0 | ✅ | `cmd:library.filter` (`flag`), `crates/ui-egui/src/panels/filterbar.rs` | picked / rejected / unflagged (one at a time) | diff --git a/docs/whats-new.md b/docs/whats-new.md index c6c2592003..cacd78b3d2 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -1,5 +1,11 @@ # What's new in LightCraft +## 2026-10-25 + +### `>=` and `<=` work in the search box +- Fielded search tokens now take inclusive comparisons: `rating:>=3`, `iso:<=400`, `f:>=2.8`, `focal:<=50`. Before, + the `=` was read as part of the number, so such a search quietly showed no photos at all. + ## 2026-10-24 ### Relative-date filters and smart albums follow the clock From e4da1d1db74a24030b09902af3efefcf0dd08cfa Mon Sep 17 00:00:00 2001 From: softwaregames1 <167585946+softwaregames1@users.noreply.github.com> Date: Sun, 25 Oct 2026 09:25:07 +0000 Subject: [PATCH 07/93] Update crates/catalog/src/query.rs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- crates/catalog/src/query.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/catalog/src/query.rs b/crates/catalog/src/query.rs index 7dea42e3fd..94cfa17640 100644 --- a/crates/catalog/src/query.rs +++ b/crates/catalog/src/query.rs @@ -187,8 +187,8 @@ fn token_matches(p: &Photo, tok: &str) -> bool { let cmp = |x: f64, s: &str| match num(s) { Some((">", v)) => x > v, Some(("<", v)) => x < v, - Some((">=", v)) => x > v || (x - v).abs() < 1e-9, - Some(("<=", v)) => x < v || (x - v).abs() < 1e-9, + Some((">=", v)) => x >= v, + Some(("<=", v)) => x <= v, Some((_, v)) => (x - v).abs() < 1e-9, None => false, }; From f790e057787b3e8c05a373ad4c7195f2ea7cb967 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sun, 25 Oct 2026 09:32:10 +0000 Subject: [PATCH 08/93] Keep hue below 360 in rgb_to_hsv and rgb_to_hsl Found while testing crates/color/src/perceptual.rs:129 (hue_of) Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Sonnet 5.5 --- crates/color/src/perceptual.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/crates/color/src/perceptual.rs b/crates/color/src/perceptual.rs index 78824321c9..fb5b89b758 100644 --- a/crates/color/src/perceptual.rs +++ b/crates/color/src/perceptual.rs @@ -132,7 +132,9 @@ fn hue_of(c: [f32; 3], max: f32, d: f32) -> f32 { } else { (c[0] - c[1]) / d + 4.0 }; - h * 60.0 + let deg = h * 60.0; + // rem_euclid can round up to exactly 6.0 in f32; keep the range [0, 360). + if deg >= 360.0 { 0.0 } else { deg } } #[cfg(test)] @@ -173,4 +175,11 @@ mod tests { } assert_eq!(rgb_to_hsv([0.0, 1.0, 0.0])[0], 120.0); } + + #[test] + fn hue_below_360_for_tiny_blue() { + let c = [1.0, 0.0, 1e-9]; + assert!(rgb_to_hsv(c)[0] < 360.0, "hsv hue {}", rgb_to_hsv(c)[0]); + assert!(rgb_to_hsl(c)[0] < 360.0, "hsl hue {}", rgb_to_hsl(c)[0]); + } } From 26fc9c1fa4dd136ced965270d2f546b0883cd49f Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Sun, 25 Oct 2026 17:55:02 +0000 Subject: [PATCH 09/93] Report a photo's custom white balance left out of an imported look Fixes #2938 Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/preset_import.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/preset_import.rs b/crates/engine/src/preset_import.rs index f1d787ae09..d1dbc946c6 100644 --- a/crates/engine/src/preset_import.rs +++ b/crates/engine/src/preset_import.rs @@ -502,12 +502,16 @@ pub fn group_from_dir(dir: &str) -> Option { } pub(crate) fn build(props: &Props, values: &crate::crs_masks::Values, name: String, group: Option, from_photo: bool) -> Option { - let (mut settings, unmapped) = crate::crs::to_partial_report(props, Some(values), crate::crs::Target::Any, crate::crs_masks::DEFAULT_ASPECT); + let (mut settings, mut unmapped) = crate::crs::to_partial_report(props, Some(values), crate::crs::Target::Any, crate::crs_masks::DEFAULT_ASPECT); if from_photo && let Some(o) = settings.as_object_mut() { // a photo's own framing and absolute white balance don't belong in a look o.remove("crop"); o.remove("geometry"); - if o.get("wb").and_then(|w| w.get("mode")).and_then(Value::as_str).is_none_or(|m| m == "custom" || m == "asShot") { + let mode = o.get("wb").and_then(|w| w.get("mode")).and_then(Value::as_str); + if mode == Some("custom") { + unmapped.push("Temperature, Tint (custom white balance of a photo: not kept in a look)".into()); + } + if mode.is_none_or(|m| m == "custom" || m == "asShot") { o.remove("wb"); } } @@ -750,6 +754,23 @@ text]], z = ZSTR "loc" }"#, assert!(read_presets("plain.jpg", b"\xff\xd8 no xmp", None).is_err()); } + #[test] + fn photo_custom_white_balance_left_out_is_reported() { + // issue #2938: a photo's custom Kelvin that the look leaves out is reported + let photo = |wb: &str| { + let mut file = b"\xff\xd8\xff\xe1 http://ns.adobe.com/xap/1.0/\0".to_vec(); + file.extend_from_slice(XMP.replace(r#"crs:WhiteBalance="As Shot" crs:Temperature="5600""#, wb).as_bytes()); + read_presets("/x/repro.jpg", &file, None).unwrap().remove(0) + }; + let custom = photo(r#"crs:WhiteBalance="Custom" crs:Temperature="8000" crs:Tint="+16""#); + assert!(custom.unmapped.iter().any(|u| u.starts_with("Temperature, Tint (")), "{:?}", custom.unmapped); + // a named white balance stays, unreported; As Shot is no loss + let daylight = photo(r#"crs:WhiteBalance="Daylight""#); + assert_eq!(daylight.preset.settings["wb"]["mode"], json!("daylight")); + assert!(daylight.unmapped.is_empty(), "{:?}", daylight.unmapped); + assert!(photo(r#"crs:WhiteBalance="As Shot""#).unmapped.is_empty()); + } + #[test] fn zip_bombs_are_refused() { // an entry unpacking past the limit (3 MB of zeros pack into a few kB): refused, named From 7ebbb17a8252291229386a4e1d31214467a10c10 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 25 Oct 2026 15:31:09 -0700 Subject: [PATCH 10/93] Originals: on Windows a hard link to an original counts as that original safe_file::same_file compared length and canonical paths on every platform other than Unix. On Windows canonicalize returns a hard link's own path, so a hard link to a library original under another name was not the same file, and pin_write_target accepted it as a screenshot destination. For this reason the engine test write_targets_pin_absent_paths_and_recheck_the_current_library failed on Windows. On Windows same_file now first compares the volume serial number and file index through the same-file crate (already in Cargo.lock through walkdir), then falls back to the resolved-path comparison. The catalog crate takes same-file as a Windows-only dependency. --- Cargo.lock | 1 + Cargo.toml | 1 + crates/catalog/Cargo.toml | 3 +++ crates/catalog/src/safe_file.rs | 26 +++++++++++++++++++++++++- 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index b695339580..455758fb03 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3220,6 +3220,7 @@ dependencies = [ "lightcraft-raw", "log", "proptest", + "same-file", "serde", "serde_json", "thiserror 2.0.21", diff --git a/Cargo.toml b/Cargo.toml index 5c0418d307..fc2d90d2e1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,6 +53,7 @@ log = "0.4" # All date/time conversion goes through chrono (no hand-rolled calendar code beyond the 400-year range extension; AGENTS.md). chrono = { version = "0.4.45", default-features = false, features = ["std"] } rayon = "1" +same-file = "1" # lightcraft-catalog reads a file's volume serial number and file index with it on Windows proptest = "1" bytemuck = { version = "1", features = ["derive"] } crc32fast = "1" diff --git a/crates/catalog/Cargo.toml b/crates/catalog/Cargo.toml index 27273d5c4c..e9df631668 100644 --- a/crates/catalog/Cargo.toml +++ b/crates/catalog/Cargo.toml @@ -20,6 +20,9 @@ log = { workspace = true } chrono = { workspace = true } web-time = { workspace = true } +[target.'cfg(windows)'.dependencies] +same-file = { workspace = true } + [dev-dependencies] lightcraft-geom = { workspace = true } proptest = { workspace = true } diff --git a/crates/catalog/src/safe_file.rs b/crates/catalog/src/safe_file.rs index fa067de0fd..83139756c0 100644 --- a/crates/catalog/src/safe_file.rs +++ b/crates/catalog/src/safe_file.rs @@ -23,6 +23,7 @@ //! replacing anything** (a hard link, which fails on a taken name; where the volume has no hard //! links, an exclusive create that claims the name, then a rename over that placeholder). //! - [`same_file`] tells whether two paths name the same file on disk (device + inode on Unix, +//! volume serial number + file index on Windows, //! resolved paths elsewhere), for "is this target an original?" checks. use std::cell::Cell; @@ -267,7 +268,8 @@ fn same_content(path: &Path, data: &[u8]) -> io::Result { } } -/// Do `a` and `b` name the same existing file (through links, `..`, case-insensitive names)? +/// Do `a` and `b` name the same existing file (through hard links, symlinks, `..`, +/// case-insensitive names)? pub fn same_file(a: &Path, b: &Path) -> bool { let (Ok(ma), Ok(mb)) = (fs::metadata(a), fs::metadata(b)) else { return false }; #[cfg(unix)] @@ -277,6 +279,14 @@ pub fn same_file(a: &Path, b: &Path) -> bool { } #[cfg(not(unix))] { + // A hard link has its own path but shares the volume serial number and file index with + // its original. A volume that does not report them is compared by resolved path below. + #[cfg(windows)] + { + if ::same_file::is_same_file(a, b).unwrap_or(false) { + return true; + } + } if ma.len() != mb.len() { return false; } @@ -397,6 +407,20 @@ mod tests { let _ = fs::remove_dir_all(&d); } + #[test] + fn same_file_sees_a_hard_link_under_another_name() { + let d = temp("same-link"); + let p = d.join("IMG_1.jpg"); + fs::write(&p, b"original").unwrap(); + let linked = d.join("linked.png"); + fs::hard_link(&p, &linked).unwrap(); + fs::write(d.join("copy.png"), b"original").unwrap(); + assert!(same_file(&p, &linked), "a hard link is the same file"); + assert!(same_file(&linked, &p)); + assert!(!same_file(&p, &d.join("copy.png")), "a copy with the same content and length is another file"); + let _ = fs::remove_dir_all(&d); + } + #[test] fn same_file_sees_through_other_spellings() { let d = temp("same"); From a97f19605c9fbfa9e52379faf5ff339742b71e41 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sun, 25 Oct 2026 22:32:37 -0700 Subject: [PATCH 11/93] Originals: compare lengths before the Windows file identity On ReFS two files can share the 64-bit file index that same_file compares, so same_file now rejects files of different lengths before it checks the volume serial number and file index. The hard-link test skips with a recorded reason when the temporary folder's volume has no hard links (FAT/exFAT, some shares), the same errors publish_new treats as a volume without hard links. --- Cargo.lock | 1 + crates/catalog/Cargo.toml | 1 + crates/catalog/src/safe_file.rs | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 455758fb03..3e9acf98c1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3218,6 +3218,7 @@ dependencies = [ "lightcraft-geom", "lightcraft-meta", "lightcraft-raw", + "lightcraft-testkit", "log", "proptest", "same-file", diff --git a/crates/catalog/Cargo.toml b/crates/catalog/Cargo.toml index e9df631668..7a9c804394 100644 --- a/crates/catalog/Cargo.toml +++ b/crates/catalog/Cargo.toml @@ -25,4 +25,5 @@ same-file = { workspace = true } [dev-dependencies] lightcraft-geom = { workspace = true } +lightcraft-testkit = { workspace = true } proptest = { workspace = true } diff --git a/crates/catalog/src/safe_file.rs b/crates/catalog/src/safe_file.rs index 83139756c0..f7737bf78a 100644 --- a/crates/catalog/src/safe_file.rs +++ b/crates/catalog/src/safe_file.rs @@ -279,17 +279,18 @@ pub fn same_file(a: &Path, b: &Path) -> bool { } #[cfg(not(unix))] { + if ma.len() != mb.len() { + return false; + } // A hard link has its own path but shares the volume serial number and file index with // its original. A volume that does not report them is compared by resolved path below. + // On ReFS two files can share the 64-bit file index, so the lengths are compared first. #[cfg(windows)] { if ::same_file::is_same_file(a, b).unwrap_or(false) { return true; } } - if ma.len() != mb.len() { - return false; - } match (fs::canonicalize(a), fs::canonicalize(b)) { (Ok(x), Ok(y)) => x == y || x.to_string_lossy().to_lowercase() == y.to_string_lossy().to_lowercase(), _ => false, @@ -413,7 +414,16 @@ mod tests { let p = d.join("IMG_1.jpg"); fs::write(&p, b"original").unwrap(); let linked = d.join("linked.png"); - fs::hard_link(&p, &linked).unwrap(); + match fs::hard_link(&p, &linked) { + Ok(()) => {} + Err(e) if e.kind() == io::ErrorKind::AlreadyExists => panic!("{}: {e}", linked.display()), + // no hard links on this volume (FAT/exFAT, some shares), as in `publish_new` + Err(e) => { + let _ = fs::remove_dir_all(&d); + lightcraft_testkit::skip!(System, "no hard links in {}: {e}", d.display()); + return; + } + } fs::write(d.join("copy.png"), b"original").unwrap(); assert!(same_file(&p, &linked), "a hard link is the same file"); assert!(same_file(&linked, &p)); From ff913833de19cbb017c79c596cc31d3cbe75f2b4 Mon Sep 17 00:00:00 2001 From: Florent Siegenthaler <64897087+Atalantis@users.noreply.github.com> Date: Mon, 26 Oct 2026 09:24:28 +0100 Subject: [PATCH 12/93] Declare the UI languages to AppKit so the open and save panels are translated --- packaging/macos/Info.plist.in | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packaging/macos/Info.plist.in b/packaging/macos/Info.plist.in index fd87f601e6..f93cfda0ec 100644 --- a/packaging/macos/Info.plist.in +++ b/packaging/macos/Info.plist.in @@ -6,6 +6,29 @@ CFBundleDevelopmentRegion en + + CFBundleLocalizations + + en + cs + de + es + fi + fr + id + it + ja + ka + pl + pt-BR + ru + sv + uk + vi + zh-Hans + zh-Hant + CFBundleDisplayName LightCraft CFBundleName From 1bb11ff321a1385647cecce8058f43da4dd94dfc Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 26 Oct 2026 03:03:39 -0700 Subject: [PATCH 13/93] Local: on Windows the folder trees leave out hidden folders such as AppData The Local trees left out folders whose names start with a dot, but on Windows a folder is hidden by its attribute. Home's tree listed AppData, and browsing a folder inside the temp folder opened Home's tree down through AppData\Local\Temp, drawing one row for every folder there on each frame. On a machine with 148,400 folders in Temp each frame took about 4 s, and tests_panels::local_photos_cannot_be_added_to_albums_until_they_join_my_photos timed out on its ui.drag. list_subfolders now also skips folders with FILE_ATTRIBUTE_HIDDEN set. Test: panels::left::tests::subfolders_leave_out_hidden_folders. --- crates/ui-egui/src/panels/left.rs | 37 ++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/panels/left.rs b/crates/ui-egui/src/panels/left.rs index 5a81edfab8..3304b4b8fc 100644 --- a/crates/ui-egui/src/panels/left.rs +++ b/crates/ui-egui/src/panels/left.rs @@ -1040,7 +1040,7 @@ fn list_subfolders(path: &str) -> Vec<(String, String)> { let mut v: Vec<(String, String)> = std::fs::read_dir(path) .map(|rd| { rd.flatten() - .filter(|e| e.file_type().is_ok_and(|t| t.is_dir())) + .filter(|e| e.file_type().is_ok_and(|t| t.is_dir()) && !hidden_attribute(e)) .filter_map(|e| { let name = e.file_name().to_string_lossy().to_string(); (!name.starts_with('.')).then(|| (name, e.path().to_string_lossy().to_string())) @@ -1052,6 +1052,20 @@ fn list_subfolders(path: &str) -> Vec<(String, String)> { v } +/// On Windows a folder is hidden by an attribute (AppData in the home folder is), not by a +/// leading dot. +#[cfg(windows)] +fn hidden_attribute(e: &std::fs::DirEntry) -> bool { + use std::os::windows::fs::MetadataExt; + const FILE_ATTRIBUTE_HIDDEN: u32 = 0x2; + e.metadata().is_ok_and(|m| m.file_attributes() & FILE_ATTRIBUTE_HIDDEN != 0) +} + +#[cfg(not(windows))] +fn hidden_attribute(_: &std::fs::DirEntry) -> bool { + false +} + /// How many [`fs_cached`] answers for `ctx` are being worked out right now. Rows appear (and /// the sidebar below them moves) when they land, so the headless driver counts them as pending /// work and waits for them before acting on widget positions. @@ -2370,6 +2384,27 @@ mod tests { assert_eq!((names(&l.places), l.owner), (vec!["Pictures"], Some(0))); } + /// A folder tree leaves out hidden subfolders: a leading dot everywhere, and on Windows the + /// hidden attribute, so Home's tree does not list AppData and open down into its temp folder. + #[test] + fn subfolders_leave_out_hidden_folders() { + let dir = std::env::temp_dir().join(format!("lc-ui-hidden-subfolders-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + for name in ["Shown", ".dot", "Hidden"] { + std::fs::create_dir_all(dir.join(name)).unwrap(); + } + let expected = if cfg!(windows) { + let status = std::process::Command::new("attrib").arg("+h").arg(dir.join("Hidden")).status().unwrap(); + assert!(status.success(), "attrib +h: {status}"); + vec!["Shown"] + } else { + vec!["Hidden", "Shown"] + }; + let listed = super::list_subfolders(&dir.to_string_lossy()); + let _ = std::fs::remove_dir_all(&dir); + assert_eq!(listed.iter().map(|(n, _)| n.as_str()).collect::>(), expected); + } + #[test] fn a_local_folder_lines_up_with_the_rows_above_and_its_triangle_stays_left_of_the_icon() { use crate::Services; From 545ed92d6a1b28ed29117b43b7b8f7f1e0094cd1 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 26 Oct 2026 07:16:41 -0700 Subject: [PATCH 14/93] Originals: refuse a screenshot target whose file identity cannot be read On Windows the identity check opens both files to read the volume serial number and file index. When that open failed (another process holds the file without sharing it, or the file cannot be read), the hard link was treated as an ordinary file. The screenshot target check now refuses the target in that case. A missing original is still not a match, and other callers of same_file keep the current comparison. --- crates/catalog/src/safe_file.rs | 30 ++++++++++++---- crates/engine/src/originals.rs | 63 ++++++++++++++++++++++++++------- 2 files changed, 73 insertions(+), 20 deletions(-) diff --git a/crates/catalog/src/safe_file.rs b/crates/catalog/src/safe_file.rs index f7737bf78a..b0974961f0 100644 --- a/crates/catalog/src/safe_file.rs +++ b/crates/catalog/src/safe_file.rs @@ -271,30 +271,46 @@ fn same_content(path: &Path, data: &[u8]) -> io::Result { /// Do `a` and `b` name the same existing file (through hard links, symlinks, `..`, /// case-insensitive names)? pub fn same_file(a: &Path, b: &Path) -> bool { - let (Ok(ma), Ok(mb)) = (fs::metadata(a), fs::metadata(b)) else { return false }; + compare_files(a, b, false).unwrap_or(false) +} + +/// [`same_file`] for a check that must not let an unknown identity pass: `Err` when both paths +/// exist with the same length but the file identity of either cannot be read (on Windows, when +/// either file cannot be opened). A path that does not exist is still `Ok(false)`. +pub fn same_file_strict(a: &Path, b: &Path) -> io::Result { + compare_files(a, b, true) +} + +fn compare_files(a: &Path, b: &Path, strict: bool) -> io::Result { + #[cfg(not(windows))] + let _ = strict; + let (Ok(ma), Ok(mb)) = (fs::metadata(a), fs::metadata(b)) else { return Ok(false) }; #[cfg(unix)] { use std::os::unix::fs::MetadataExt; - ma.dev() == mb.dev() && ma.ino() == mb.ino() + Ok(ma.dev() == mb.dev() && ma.ino() == mb.ino()) } #[cfg(not(unix))] { if ma.len() != mb.len() { - return false; + return Ok(false); } // A hard link has its own path but shares the volume serial number and file index with // its original. A volume that does not report them is compared by resolved path below. // On ReFS two files can share the 64-bit file index, so the lengths are compared first. #[cfg(windows)] { - if ::same_file::is_same_file(a, b).unwrap_or(false) { - return true; + match ::same_file::is_same_file(a, b) { + Ok(true) => return Ok(true), + Ok(false) => {} + Err(e) if strict => return Err(e), + Err(_) => {} } } - match (fs::canonicalize(a), fs::canonicalize(b)) { + Ok(match (fs::canonicalize(a), fs::canonicalize(b)) { (Ok(x), Ok(y)) => x == y || x.to_string_lossy().to_lowercase() == y.to_string_lossy().to_lowercase(), _ => false, - } + }) } } diff --git a/crates/engine/src/originals.rs b/crates/engine/src/originals.rs index 890e98f812..e20a9378b8 100644 --- a/crates/engine/src/originals.rs +++ b/crates/engine/src/originals.rs @@ -9,7 +9,7 @@ use std::path::{Path, PathBuf}; #[cfg(not(any(unix, windows)))] use std::time::SystemTime; -use lightcraft_catalog::safe_file::same_file; +use lightcraft_catalog::safe_file::{same_file, same_file_strict}; use lightcraft_catalog::{Catalog, Source}; /// The directory entry a screenshot is about to write, pinned at request admission. @@ -147,14 +147,30 @@ impl OriginalGuard { if let Some(n) = std::fs::canonicalize(target).ok().and_then(|c| c.file_name().map(|n| n.to_string_lossy().to_lowercase())) { names.push(n); } + // The identity check refuses a target whose file identity cannot be read, so an unreadable + // hard link to an original is not taken for an ordinary file. + let refuse_if_same = |p: &Path, what: &str| -> Result<(), String> { + let same = if hard_links { + same_file_strict(p, target).map_err(|e| { + format!( + "{}: LightCraft cannot tell whether this is {what} in the library ({e}) and never writes over an original (choose another folder or file name)", + target.display() + ) + })? + } else { + same_file(p, target) + }; + if same { + return Err(format!( + "{} is {what} in the library: LightCraft never writes over an original (choose another folder or file name)", + target.display() + )); + } + Ok(()) + }; for n in &names { for (p, what) in self.by_name.get(n).into_iter().flatten() { - if same_file(p, target) { - return Err(format!( - "{} is {what} in the library: LightCraft never writes over an original (choose another folder or file name)", - target.display() - )); - } + refuse_if_same(p, what)?; } } // An imported hard link or symlink can have a different name from its original. A write @@ -166,12 +182,7 @@ impl OriginalGuard { if !hard_links && std::fs::read_link(p).is_err() { continue; } - if same_file(p, target) { - return Err(format!( - "{} is {what} in the library: LightCraft never writes over an original (choose another folder or file name)", - target.display() - )); - } + refuse_if_same(p, what)?; } Ok(()) } @@ -339,4 +350,30 @@ mod tests { } let _ = std::fs::remove_dir_all(&d); } + + #[cfg(windows)] + #[test] + fn a_hard_link_whose_identity_cannot_be_read_is_refused() { + use std::os::windows::fs::OpenOptionsExt; + let d = std::env::temp_dir().join(format!("lc-unreadable-link-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&d); + std::fs::create_dir_all(&d).unwrap(); + let mut s = crate::Session::new(); + let original = d.join("IMG_1.jpg"); + std::fs::write(&original, b"original").unwrap(); + let photo = Photo::new(PhotoId(1), Source::File { path: original.to_string_lossy().to_string() }, "IMG_1.jpg", "JPEG", 10, 10, "2026-01-01"); + s.catalog.apply(Op::AddPhoto { photo: Box::new(photo) }).unwrap(); + let linked = d.join("shot.png"); + std::fs::hard_link(&original, &linked).unwrap(); + + // A handle that shares nothing makes every other open of the file fail, so the file + // identity of either name cannot be read while it is held. + let held = std::fs::OpenOptions::new().read(true).share_mode(0).open(&original).unwrap(); + let refused = s.pin_write_target(&linked.to_string_lossy()).unwrap_err(); + assert!(refused.contains("original"), "{refused}"); + drop(held); + + assert!(s.pin_write_target(&linked.to_string_lossy()).unwrap_err().contains("original")); + let _ = std::fs::remove_dir_all(&d); + } } From 86f2ba81eb5fe5fec35606dca597ce116ad77927 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 26 Oct 2026 11:01:51 -0700 Subject: [PATCH 15/93] Originals: refuse a screenshot target when an original cannot be queried same_file_strict returned false when the metadata of either path could not be read, so a hard link to an original in a folder the process cannot enter was accepted as a screenshot target. It now returns the error unless the path does not exist. --- crates/catalog/src/safe_file.rs | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/crates/catalog/src/safe_file.rs b/crates/catalog/src/safe_file.rs index b0974961f0..9b8bf5bcd8 100644 --- a/crates/catalog/src/safe_file.rs +++ b/crates/catalog/src/safe_file.rs @@ -274,17 +274,22 @@ pub fn same_file(a: &Path, b: &Path) -> bool { compare_files(a, b, false).unwrap_or(false) } -/// [`same_file`] for a check that must not let an unknown identity pass: `Err` when both paths -/// exist with the same length but the file identity of either cannot be read (on Windows, when -/// either file cannot be opened). A path that does not exist is still `Ok(false)`. +/// [`same_file`] for a check that must not let an unknown identity pass: `Err` when the metadata +/// of either path cannot be read for a reason other than the path not existing (for example a +/// folder it cannot enter), or when both paths exist with the same length but the file identity +/// of either cannot be read (on Windows, when either file cannot be opened). A path that does not +/// exist is still `Ok(false)`. pub fn same_file_strict(a: &Path, b: &Path) -> io::Result { compare_files(a, b, true) } fn compare_files(a: &Path, b: &Path, strict: bool) -> io::Result { - #[cfg(not(windows))] - let _ = strict; - let (Ok(ma), Ok(mb)) = (fs::metadata(a), fs::metadata(b)) else { return Ok(false) }; + let missing = |e: &io::Error| matches!(e.kind(), io::ErrorKind::NotFound | io::ErrorKind::NotADirectory); + let (ma, mb) = match (fs::metadata(a), fs::metadata(b)) { + (Ok(ma), Ok(mb)) => (ma, mb), + (Err(e), _) | (_, Err(e)) if strict && !missing(&e) => return Err(e), + _ => return Ok(false), + }; #[cfg(unix)] { use std::os::unix::fs::MetadataExt; @@ -459,4 +464,20 @@ mod tests { assert!(!same_file(&p, &d.join("missing.jpg"))); let _ = fs::remove_dir_all(&d); } + + #[test] + fn strict_comparison_reports_a_path_it_cannot_query() { + let d = temp("strict-query"); + let p = d.join("x.jpg"); + fs::write(&p, b"x").unwrap(); + // A NUL byte makes the metadata lookup fail with an error other than "not found" on + // every platform, as a folder the process cannot enter does. + let unreadable = Path::new("IMG_1\0.jpg"); + assert!(same_file_strict(unreadable, &p).is_err()); + assert!(same_file_strict(&p, unreadable).is_err()); + assert!(!same_file(unreadable, &p), "the lenient comparison still answers false"); + assert!(!same_file_strict(&d.join("missing.jpg"), &p).unwrap(), "a missing original is another file"); + assert!(!same_file_strict(&p.join("under-a-file.jpg"), &p).unwrap()); + let _ = fs::remove_dir_all(&d); + } } From 4826fff7346f831d5bd7d17ef3218ac3dd7e1012 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 26 Oct 2026 11:34:06 -0700 Subject: [PATCH 16/93] Originals: a Windows file index of 0 does not identify a file same_file::is_same_file treats two files with the same volume serial number and file index as one file, also when both report index 0. The Windows comparison now reads both identities through winapi-util and accepts a match only when both file indexes are nonzero; otherwise the resolved paths are compared, as for a volume without file indexes. --- Cargo.lock | 2 +- Cargo.toml | 2 +- crates/catalog/Cargo.toml | 2 +- crates/catalog/src/safe_file.rs | 33 +++++++++++++++++++++++++++++---- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3e9acf98c1..0fcf8a35c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3221,11 +3221,11 @@ dependencies = [ "lightcraft-testkit", "log", "proptest", - "same-file", "serde", "serde_json", "thiserror 2.0.21", "web-time", + "winapi-util", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index fc2d90d2e1..4e122eb243 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -53,7 +53,7 @@ log = "0.4" # All date/time conversion goes through chrono (no hand-rolled calendar code beyond the 400-year range extension; AGENTS.md). chrono = { version = "0.4.45", default-features = false, features = ["std"] } rayon = "1" -same-file = "1" # lightcraft-catalog reads a file's volume serial number and file index with it on Windows +winapi-util = "0.1" # lightcraft-catalog reads a file's volume serial number and file index with it on Windows proptest = "1" bytemuck = { version = "1", features = ["derive"] } crc32fast = "1" diff --git a/crates/catalog/Cargo.toml b/crates/catalog/Cargo.toml index 7a9c804394..b12e188036 100644 --- a/crates/catalog/Cargo.toml +++ b/crates/catalog/Cargo.toml @@ -21,7 +21,7 @@ chrono = { workspace = true } web-time = { workspace = true } [target.'cfg(windows)'.dependencies] -same-file = { workspace = true } +winapi-util = { workspace = true } [dev-dependencies] lightcraft-geom = { workspace = true } diff --git a/crates/catalog/src/safe_file.rs b/crates/catalog/src/safe_file.rs index 9b8bf5bcd8..bc05d41391 100644 --- a/crates/catalog/src/safe_file.rs +++ b/crates/catalog/src/safe_file.rs @@ -301,13 +301,13 @@ fn compare_files(a: &Path, b: &Path, strict: bool) -> io::Result { return Ok(false); } // A hard link has its own path but shares the volume serial number and file index with - // its original. A volume that does not report them is compared by resolved path below. + // its original. A volume that reports file index 0 is compared by resolved path below. // On ReFS two files can share the 64-bit file index, so the lengths are compared first. #[cfg(windows)] { - match ::same_file::is_same_file(a, b) { - Ok(true) => return Ok(true), - Ok(false) => {} + match file_ids(a, b) { + Ok((ia, ib)) if same_file_id(ia, ib) => return Ok(true), + Ok(_) => {} Err(e) if strict => return Err(e), Err(_) => {} } @@ -319,6 +319,22 @@ fn compare_files(a: &Path, b: &Path, strict: bool) -> io::Result { } } +/// The volume serial number and file index of `a` and `b`, read while both files are open. +#[cfg(windows)] +fn file_ids(a: &Path, b: &Path) -> io::Result<((u64, u64), (u64, u64))> { + use winapi_util::{Handle, file::information}; + let (ha, hb) = (Handle::from_path_any(a)?, Handle::from_path_any(b)?); + let (ia, ib) = (information(&ha)?, information(&hb)?); + Ok(((ia.volume_serial_number(), ia.file_index()), (ib.volume_serial_number(), ib.file_index()))) +} + +/// Whether two (volume serial number, file index) pairs name one file. A file index of 0 is not +/// an identity and matches nothing. +#[cfg(any(windows, test))] +fn same_file_id(a: (u64, u64), b: (u64, u64)) -> bool { + a.1 != 0 && b.1 != 0 && a == b +} + #[cfg(test)] mod tests { use super::*; @@ -480,4 +496,13 @@ mod tests { assert!(!same_file_strict(&p.join("under-a-file.jpg"), &p).unwrap()); let _ = fs::remove_dir_all(&d); } + + #[test] + fn a_zero_file_index_is_not_a_file_identity() { + assert!(same_file_id((7, 42), (7, 42))); + assert!(!same_file_id((7, 42), (7, 43))); + assert!(!same_file_id((7, 42), (8, 42))); + assert!(!same_file_id((7, 0), (7, 0)), "two files on a volume that reports index 0 are not the same file"); + assert!(!same_file_id((0, 0), (0, 0))); + } } From 662df66f1c08bdb1b1f1d0c1c638c4cef936d0b0 Mon Sep 17 00:00:00 2001 From: skylar taylor-barrick Date: Mon, 26 Oct 2026 20:50:41 -0600 Subject: [PATCH 17/93] Preserve queued file drops across dialogs and restore Flatpak sources (#2975) --- .github/workflows/sonarcloud.yml | 8 +- apps/lightcraft-cli/tests/it/cli.rs | 86 +- apps/lightcraft-cli/tests/it/main.rs | 5 + apps/lightcraft-cli/tests/it/mcp_shutdown.rs | 8 +- apps/lightcraft-web/Cargo.toml | 3 + apps/lightcraft-web/src/drop_gate.rs | 391 + apps/lightcraft-web/src/lib.rs | 4 + apps/lightcraft-web/src/web.rs | 47 +- crates/engine/src/cmd/activity.rs | 2 +- crates/engine/src/cmd/previews.rs | 143 +- crates/engine/src/tests.rs | 47 +- crates/engine/src/tests/face_recognize.rs | 127 +- crates/mcp/tests/it/e2e.rs | 56 +- crates/raw/src/preview.rs | 50 +- crates/raw/src/preview/tests.rs | 92 +- .../ui-egui/examples/thumb_request_bench.rs | 2 +- crates/ui-egui/src/app.rs | 1 + crates/ui-egui/src/app/frame.rs | 12 +- crates/ui-egui/src/app/input.rs | 48 +- crates/ui-egui/src/app/screenshot.rs | 45 +- .../ui-egui/src/dialogs/slideshow_export.rs | 26 +- crates/ui-egui/src/drop_overlay.rs | 18 +- crates/ui-egui/src/headless/tests.rs | 38 +- crates/ui-egui/src/lib.rs | 6 + crates/ui-egui/src/panels/detail.rs | 9 +- crates/ui-egui/src/panels/grid.rs | 13 +- crates/ui-egui/src/panels/library_problem.rs | 24 + crates/ui-egui/src/render.rs | 179 +- crates/ui-egui/src/render/thumbnail_tests.rs | 420 +- crates/ui-egui/src/sync.rs | 22 + crates/ui-egui/src/tests.rs | 3 + crates/ui-egui/src/tests/activity.rs | 21 +- crates/ui-egui/src/tests/before_after.rs | 29 +- crates/ui-egui/src/tests/capture_time.rs | 14 +- crates/ui-egui/src/tests/crop_rotate.rs | 23 +- crates/ui-egui/src/tests/dialog_settings.rs | 32 +- .../ui-egui/src/tests/docking_acceptance.rs | 17 +- crates/ui-egui/src/tests/drop_import.rs | 755 +- crates/ui-egui/src/tests/filmstrip.rs | 15 +- crates/ui-egui/src/tests/fixtures.rs | 86 + crates/ui-egui/src/tests/keyword_files.rs | 34 +- crates/ui-egui/src/tests/library_problem.rs | 38 +- crates/ui-egui/src/tests/lifecycle_037.rs | 113 +- crates/ui-egui/src/tests/panels.rs | 8 +- crates/ui-egui/src/tests/preset_import.rs | 11 +- crates/ui-egui/src/tests/preview_limit.rs | 398 +- crates/ui-egui/src/tests/print.rs | 9 +- crates/ui-egui/src/tests/render_fixtures.rs | 179 + crates/ui-egui/src/tests/slideshow.rs | 131 +- crates/ui-egui/src/tests/zoom.rs | 67 + crates/ui-egui/tests/it/docking_workflows.rs | 15 +- packaging/linux/flatpak/README.md | 120 + .../flatpak/ai.storyteller.lightcraft.yml | 7 +- packaging/linux/flatpak/cargo-sources.json | 8593 +++++++++++++++++ .../linux/flatpak/generate-cargo-sources.py | 398 + .../flatpak/test_generate_cargo_sources.py | 483 + sonar-project.properties | 6 + 57 files changed, 13099 insertions(+), 438 deletions(-) create mode 100644 apps/lightcraft-web/src/drop_gate.rs create mode 100644 crates/ui-egui/src/tests/fixtures.rs create mode 100644 crates/ui-egui/src/tests/render_fixtures.rs create mode 100644 packaging/linux/flatpak/README.md create mode 100644 packaging/linux/flatpak/cargo-sources.json create mode 100755 packaging/linux/flatpak/generate-cargo-sources.py create mode 100644 packaging/linux/flatpak/test_generate_cargo_sources.py diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index e78fe1ea3b..d13c3cb4a7 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -16,6 +16,12 @@ concurrency: jobs: sonarcloud: - # Tracked at @main so org-wide CI improvements propagate without PR churn. + # Track shared CI improvements on main. uses: storytold/craft-common-actions/.github/workflows/sonarcloud.yml@main + with: + shards: 8 + python-coverage-source: packaging/linux/flatpak + python-coverage-script: packaging/linux/flatpak/test_generate_cargo_sources.py + timeout-minutes: 120 + fonts-ref: b076417b5880bd4154bd22f00695b1d28c6bea83 secrets: inherit diff --git a/apps/lightcraft-cli/tests/it/cli.rs b/apps/lightcraft-cli/tests/it/cli.rs index 1c8910d9d8..8a11f5c9ab 100644 --- a/apps/lightcraft-cli/tests/it/cli.rs +++ b/apps/lightcraft-cli/tests/it/cli.rs @@ -5,7 +5,7 @@ use std::process::{Command, Stdio}; use serde_json::{Value, json}; -const BIN: &str = env!("CARGO_BIN_EXE_lightcraft-cli"); +use super::binary; #[test] fn contact_sheet_exports_pdf_and_protects_originals() { @@ -106,7 +106,7 @@ fn calibrate_reads_raf_inputs_and_reports_bad_files() { let input = tmp("invalid.RAF"); std::fs::write(&input, b"FUJIFILMCCD-RAW").unwrap(); let out = tmp("raf-profiles"); - let result = Command::new(BIN).args(["calibrate", "--out"]).arg(&out).arg(&input).output().unwrap(); + let result = Command::new(binary()).args(["calibrate", "--out"]).arg(&out).arg(&input).output().unwrap(); assert!(!result.status.success()); let stderr = String::from_utf8_lossy(&result.stderr); assert!(stderr.contains("1 of 1 raw files"), "RAF was silently ignored: {stderr}"); @@ -124,8 +124,13 @@ fn mean(path: &std::path::Path) -> f64 { fn mcp_over_stdio_sets_exposure_and_renders() { let input = tmp("in.png"); gradient_png(&input); - let mut child = - Command::new(BIN).args(["mcp", input.to_str().unwrap()]).stdin(Stdio::piped()).stdout(Stdio::piped()).stderr(Stdio::null()).spawn().unwrap(); + let mut child = Command::new(binary()) + .args(["mcp", input.to_str().unwrap()]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::null()) + .spawn() + .unwrap(); let mut stdin = child.stdin.take().unwrap(); let mut stdout = BufReader::new(child.stdout.take().unwrap()); let mut rpc = |id: u64, method: &str, params: Value| -> Value { @@ -163,9 +168,9 @@ fn render_subcommand() { gradient_png(&input); let plain = tmp("r-plain.png"); let out = tmp("r-out.jpg"); - let st = Command::new(BIN).args(["render", input.to_str().unwrap(), "-o", plain.to_str().unwrap()]).status().unwrap(); + let st = Command::new(binary()).args(["render", input.to_str().unwrap(), "-o", plain.to_str().unwrap()]).status().unwrap(); assert!(st.success()); - let st = Command::new(BIN) + let st = Command::new(binary()) .args(["render", input.to_str().unwrap(), "-o", out.to_str().unwrap(), "--set", "light.exposure=1", "--size", "60"]) .status() .unwrap(); @@ -176,7 +181,7 @@ fn render_subcommand() { assert_eq!((d.width, d.height), (120, 80)); assert!(mean(&out) > mean(&plain) + 10.0); // Bad control id fails cleanly. - let o = Command::new(BIN).args(["render", input.to_str().unwrap(), "-o", out.to_str().unwrap(), "--set", "nope=1"]).output().unwrap(); + let o = Command::new(binary()).args(["render", input.to_str().unwrap(), "-o", out.to_str().unwrap(), "--set", "nope=1"]).output().unwrap(); assert!(!o.status.success()); assert!(String::from_utf8_lossy(&o.stderr).contains("unknown control")); } @@ -204,10 +209,10 @@ fn render_settings_applies_an_lcpreset_and_refuses_unknown_files() { ); assert!(ok, "{err}: {lines:?}"); let plain = tmp("lcpreset-plain.png"); - let st = Command::new(BIN).args(["render", input.to_str().unwrap(), "-o", plain.to_str().unwrap()]).status().unwrap(); + let st = Command::new(binary()).args(["render", input.to_str().unwrap(), "-o", plain.to_str().unwrap()]).status().unwrap(); assert!(st.success()); let bright = tmp("lcpreset-bright.png"); - let o = Command::new(BIN) + let o = Command::new(binary()) .args(["render", input.to_str().unwrap(), "-o", bright.to_str().unwrap(), "--settings", preset.to_str().unwrap()]) .output() .unwrap(); @@ -217,7 +222,7 @@ fn render_settings_applies_an_lcpreset_and_refuses_unknown_files() { let other = tmp("other.lcpreset"); std::fs::write(&other, r#"{"format": "other", "version": 1, "presets": []}"#).unwrap(); let out = tmp("lcpreset-other.png"); - let o = Command::new(BIN) + let o = Command::new(binary()) .args(["render", input.to_str().unwrap(), "-o", out.to_str().unwrap(), "--settings", other.to_str().unwrap()]) .output() .unwrap(); @@ -236,8 +241,10 @@ fn render_refuses_to_overwrite_its_input() { std::fs::create_dir_all(dir.join("sub")).unwrap(); let other_spelling = dir.join("sub/../self-in.png"); for out in [&input, &other_spelling] { - let o = - Command::new(BIN).args(["render", input.to_str().unwrap(), "-o", out.to_str().unwrap(), "--set", "light.exposure=1"]).output().unwrap(); + let o = Command::new(binary()) + .args(["render", input.to_str().unwrap(), "-o", out.to_str().unwrap(), "--set", "light.exposure=1"]) + .output() + .unwrap(); assert!(!o.status.success()); assert!(String::from_utf8_lossy(&o.stderr).contains("never writes over an original"), "{}", String::from_utf8_lossy(&o.stderr)); } @@ -249,7 +256,7 @@ fn render_export_options() { let input = tmp("o-in.png"); gradient_png(&input); let out = tmp("o-out.tif"); - let st = Command::new(BIN) + let st = Command::new(binary()) .args(["render", input.to_str().unwrap(), "-o", out.to_str().unwrap()]) .args(["--opt", "shortEdge=40", "--opt", "colorSpace=displayP3", "--opt", "bitDepth=16"]) .status() @@ -260,7 +267,7 @@ fn render_export_options() { assert_eq!(d.space.named, Some(lightcraft_codecs::NamedSpace::DisplayP3)); // original + sidecar named after the output let out = tmp("o-copy.png"); - let st = Command::new(BIN) + let st = Command::new(binary()) .args(["render", input.to_str().unwrap(), "-o", out.to_str().unwrap(), "--set", "light.exposure=1", "--opt", "format=original"]) .status() .unwrap(); @@ -269,26 +276,26 @@ fn render_export_options() { let xmp = std::fs::read_to_string(out.with_extension("xmp")).unwrap(); assert!(xmp.contains("exposure"), "{xmp}"); // unknown extension fails with a hint - let o = Command::new(BIN).args(["render", input.to_str().unwrap(), "-o", tmp("x.bmp").to_str().unwrap()]).output().unwrap(); + let o = Command::new(binary()).args(["render", input.to_str().unwrap(), "-o", tmp("x.bmp").to_str().unwrap()]).output().unwrap(); assert!(!o.status.success() && String::from_utf8_lossy(&o.stderr).contains("unknown extension")); } #[test] fn commands_subcommand_lists_registry() { - let o = Command::new(BIN).args(["commands", "--json"]).output().unwrap(); + let o = Command::new(binary()).args(["commands", "--json"]).output().unwrap(); assert!(o.status.success()); let v: Value = serde_json::from_slice(&o.stdout).unwrap(); let ids: Vec<&str> = v.as_array().unwrap().iter().filter_map(|c| c["id"].as_str()).collect(); for id in ["develop.set", "photo.rate", "library.import", "edit.undo", "app.export"] { assert!(ids.contains(&id), "{id}"); } - let o = Command::new(BIN).arg("controls").output().unwrap(); + let o = Command::new(binary()).arg("controls").output().unwrap(); assert!(String::from_utf8_lossy(&o.stdout).contains("light.exposure")); } #[test] fn commands_subcommand_lists_commands_sorted_by_id() { - let o = Command::new(BIN).args(["commands", "--json"]).output().unwrap(); + let o = Command::new(binary()).args(["commands", "--json"]).output().unwrap(); assert!(o.status.success()); let v: Value = serde_json::from_slice(&o.stdout).unwrap(); let cmds = v.as_array().unwrap(); @@ -302,7 +309,7 @@ fn commands_subcommand_lists_commands_sorted_by_id() { let unsorted = ids.windows(2).find(|w| w[0] >= w[1]); assert!(unsorted.is_none(), "--json should list commands sorted by id, but {unsorted:?} are out of order"); - let o = Command::new(BIN).arg("commands").output().unwrap(); + let o = Command::new(binary()).arg("commands").output().unwrap(); assert!(o.status.success()); let text = String::from_utf8_lossy(&o.stdout); let lines: Vec<&str> = text.lines().collect(); @@ -338,7 +345,7 @@ fn snapshot_subcommand_renders_the_ui_headlessly() { ), ) .unwrap(); - let o = Command::new(BIN) + let o = Command::new(binary()) .args(["snapshot", "--demo", "--script", script.to_str().unwrap(), "-o", a.to_str().unwrap(), "--size", "640x400"]) .output() .unwrap(); @@ -353,7 +360,7 @@ fn snapshot_subcommand_renders_the_ui_headlessly() { assert_eq!(mean(p) < mean(&a) - 2.0, dimmed, "{}", p.display()); } // no script: one settled screenshot, at 2× scale - let o = Command::new(BIN).args(["snapshot", "-o", a.to_str().unwrap(), "--size", "320x240", "--scale", "2"]).output().unwrap(); + let o = Command::new(binary()).args(["snapshot", "-o", a.to_str().unwrap(), "--size", "320x240", "--scale", "2"]).output().unwrap(); assert!(o.status.success(), "{}", String::from_utf8_lossy(&o.stderr)); let d = lightcraft_codecs::decode(&std::fs::read(&a).unwrap(), Default::default()).unwrap(); assert_eq!((d.width, d.height), (640, 480)); @@ -375,7 +382,7 @@ fn snapshot_script_failure_exits_non_zero() { ) .unwrap(); let _ = std::fs::remove_file(&out); - let o = Command::new(BIN) + let o = Command::new(binary()) .args(["snapshot", "--demo", "--script", script.to_str().unwrap(), "-o", out.to_str().unwrap(), "--size", "320x200"]) .output() .unwrap(); @@ -400,7 +407,7 @@ fn snapshot_script_with_non_object_params_is_an_error() { let script = tmp("snap-bad-params.jsonl"); let out = tmp("snap-bad-params.png"); std::fs::write(&script, format!("{}\n", json!({"method": "ui.screenshot", "params": [1]}))).unwrap(); - let o = Command::new(BIN) + let o = Command::new(binary()) .args(["snapshot", "--demo", "--script", script.to_str().unwrap(), "-o", out.to_str().unwrap(), "--size", "320x200"]) .output() .unwrap(); @@ -417,7 +424,7 @@ fn snapshot_ui_zoom_keeps_requested_pixel_dimensions() { .unwrap(); for (size, scale, expected) in [("400x240", "1", (400, 240)), ("345x200", "0.9", (311, 180))] { let out = tmp(&format!("snap-ui-zoom-{scale}.png")); - let o = Command::new(BIN) + let o = Command::new(binary()) .args(["snapshot", "--script", script.to_str().unwrap(), "-o", out.to_str().unwrap(), "--size", size, "--scale", scale]) .output() .unwrap(); @@ -440,7 +447,7 @@ fn snapshot_defaults_to_cpu_without_gpu_environment_overrides() { ) .unwrap(); let image = tmp("default-cpu.png"); - let output = Command::new(BIN) + let output = Command::new(binary()) .env_remove("LIGHTCRAFT_GPU") .env_remove("LIGHTCRAFT_GPU_BACKEND") .env_remove("WGPU_BACKEND") @@ -476,7 +483,7 @@ fn snapshot_starts_without_a_gpu() { .unwrap(); for (var, value, reason) in [("LIGHTCRAFT_GPU", "0", "LIGHTCRAFT_GPU=0"), ("LIGHTCRAFT_GPU_BACKEND", "off", "LIGHTCRAFT_GPU_BACKEND=off")] { let out = tmp(&format!("nogpu-{var}.png")); - let o = Command::new(BIN) + let o = Command::new(binary()) .env_remove("LIGHTCRAFT_GPU") .env_remove("LIGHTCRAFT_GPU_BACKEND") .env(var, value) @@ -496,7 +503,7 @@ fn snapshot_starts_without_a_gpu() { } fn run_cli(args: &[&str], stdin: Option<&str>) -> (bool, Vec, String) { - let mut child = Command::new(BIN).arg("run").args(args).stdin(Stdio::piped()).stdout(Stdio::piped()).stderr(Stdio::piped()).spawn().unwrap(); + let mut child = Command::new(binary()).arg("run").args(args).stdin(Stdio::piped()).stdout(Stdio::piped()).stderr(Stdio::piped()).spawn().unwrap(); if let Some(text) = stdin { child.stdin.take().unwrap().write_all(text.as_bytes()).unwrap(); } @@ -561,7 +568,7 @@ fn devices_are_listed_and_imported_from() { let _ = std::fs::remove_dir_all(&base); std::fs::create_dir_all(base.join("CARD/DCIM/100TEST")).unwrap(); gradient_png(&base.join("CARD/DCIM/100TEST/IMG_0001.png")); - let o = Command::new(BIN).env("LIGHTCRAFT_DEVICE_ROOTS", &base).args(["run", "--demo", "library.devices"]).output().unwrap(); + let o = Command::new(binary()).env("LIGHTCRAFT_DEVICE_ROOTS", &base).args(["run", "--demo", "library.devices"]).output().unwrap(); assert!(o.status.success(), "{}", String::from_utf8_lossy(&o.stderr)); let line: Value = serde_json::from_slice(o.stdout.split(|b| *b == b'\n').next().unwrap()).unwrap(); let dev = &line["result"][0]; @@ -570,7 +577,7 @@ fn devices_are_listed_and_imported_from() { let dcim = dev["path"].as_str().unwrap().to_string(); // JSON-escaped: a Windows path has backslashes let paths = serde_json::to_string(&[&dcim]).unwrap(); - let o = Command::new(BIN).args(["run", "library.importPreview", &format!("paths={paths}")]).output().unwrap(); + let o = Command::new(binary()).args(["run", "library.importPreview", &format!("paths={paths}")]).output().unwrap(); let line: Value = serde_json::from_slice(o.stdout.split(|b| *b == b'\n').next().unwrap()).unwrap(); assert_eq!(line["result"]["candidates"].as_array().map(Vec::len), Some(1), "{line}"); } @@ -583,7 +590,7 @@ fn a_library_open_in_another_process_is_refused() { let _ = std::fs::remove_dir_all(&lib); let lib_s = lib.to_str().unwrap(); let mut holder = - Command::new(BIN).args(["mcp", "--library", lib_s]).stdin(Stdio::piped()).stdout(Stdio::null()).stderr(Stdio::piped()).spawn().unwrap(); + Command::new(binary()).args(["mcp", "--library", lib_s]).stdin(Stdio::piped()).stdout(Stdio::null()).stderr(Stdio::piped()).spawn().unwrap(); let mut err = BufReader::new(holder.stderr.take().unwrap()); let mut line = String::new(); while !line.contains("opened library") { @@ -643,7 +650,7 @@ fn warnings_are_logged_on_stderr() { gradient_png(&input); let out = tmp("log-out.jpg"); let run = |level: &str| { - let o = Command::new(BIN) + let o = Command::new(binary()) .args(["render", input.to_str().unwrap(), "-o", out.to_str().unwrap()]) .env("LIGHTCRAFT_GPU_BACKEND", "bogus") .env("RUST_LOG", level) @@ -667,7 +674,7 @@ fn snapshot_rejects_invalid_dimensions_before_creating_an_image() { [("NaNx100", "1"), ("100x100", "inf"), ("9000x9000", "1"), ("9000x100", "2"), ("100x100", "0.001")].into_iter().enumerate() { let image = tmp(&format!("invalid-viewport-{index}.png")); - let output = Command::new(BIN).args(["snapshot", "--size", size, "--scale", scale, "-o"]).arg(&image).output().unwrap(); + let output = Command::new(binary()).args(["snapshot", "--size", size, "--scale", scale, "-o"]).arg(&image).output().unwrap(); assert!(!output.status.success()); assert!(String::from_utf8_lossy(&output.stderr).contains("snapshot: bad --size/--scale"), "{}", String::from_utf8_lossy(&output.stderr)); assert!(!image.exists()); @@ -677,8 +684,12 @@ fn snapshot_rejects_invalid_dimensions_before_creating_an_image() { #[test] fn snapshot_preserves_fractional_scale_rounding() { let image = tmp("fractional-scale-rounding.png"); - let output = - Command::new(BIN).env("LIGHTCRAFT_GPU", "0").args(["snapshot", "--size", "345x200", "--scale", "0.9", "-o"]).arg(&image).output().unwrap(); + let output = Command::new(binary()) + .env("LIGHTCRAFT_GPU", "0") + .args(["snapshot", "--size", "345x200", "--scale", "0.9", "-o"]) + .arg(&image) + .output() + .unwrap(); assert!(output.status.success(), "{}", String::from_utf8_lossy(&output.stderr)); let decoded = lightcraft_codecs::decode(&std::fs::read(image).unwrap(), Default::default()).unwrap(); assert_eq!((decoded.width, decoded.height), (311, 180)); @@ -709,7 +720,7 @@ fn snapshot_leaves_desktop_gpu_preferences_untouched() { .unwrap(); for gpu_environment in [None, Some("1")] { let image = dir.join(format!("{}.png", gpu_environment.unwrap_or("default"))); - let mut cmd = Command::new(BIN); + let mut cmd = Command::new(binary()); cmd.env("XDG_CONFIG_HOME", &config).env_remove("LIGHTCRAFT_GPU").env_remove("LIGHTCRAFT_GPU_BACKEND").env_remove("WGPU_BACKEND"); if let Some(value) = gpu_environment { cmd.env("LIGHTCRAFT_GPU", value); @@ -770,13 +781,14 @@ fn denoise_serve_runs_tiles_for_another_computer() { let sha = lightcraft_denoise::hash::sha256_file(&onnx).unwrap(); // without its token the server doesn't start - let o = Command::new(BIN).args(["denoise-serve", "--models", models.to_str().unwrap(), "--token-env", "LC_TEST_NO_SUCH_VAR"]).output().unwrap(); + let o = + Command::new(binary()).args(["denoise-serve", "--models", models.to_str().unwrap(), "--token-env", "LC_TEST_NO_SUCH_VAR"]).output().unwrap(); assert!(!o.status.success() && String::from_utf8_lossy(&o.stderr).contains("LC_TEST_NO_SUCH_VAR")); let port = std::net::TcpListener::bind("127.0.0.1:0").unwrap().local_addr().unwrap().port(); let addr = format!("127.0.0.1:{port}"); let token = "cli-test-token-0123456789"; - let mut child = Command::new(BIN) + let mut child = Command::new(binary()) .args(["denoise-serve", "--models", models.to_str().unwrap(), "--listen", &addr, "--run-on", "cpu"]) .env("LIGHTCRAFT_DENOISE_TOKEN", token) .stderr(Stdio::piped()) diff --git a/apps/lightcraft-cli/tests/it/main.rs b/apps/lightcraft-cli/tests/it/main.rs index 0c07c64385..596ffb21d9 100644 --- a/apps/lightcraft-cli/tests/it/main.rs +++ b/apps/lightcraft-cli/tests/it/main.rs @@ -2,3 +2,8 @@ mod cli; mod mcp_shutdown; + +/// Nextest archives relocate the executable; plain Cargo uses its compile-time path. +fn binary() -> std::ffi::OsString { + std::env::var_os("NEXTEST_BIN_EXE_lightcraft_cli").unwrap_or_else(|| env!("CARGO_BIN_EXE_lightcraft-cli").into()) +} diff --git a/apps/lightcraft-cli/tests/it/mcp_shutdown.rs b/apps/lightcraft-cli/tests/it/mcp_shutdown.rs index 29d1ace937..0237b6b37d 100644 --- a/apps/lightcraft-cli/tests/it/mcp_shutdown.rs +++ b/apps/lightcraft-cli/tests/it/mcp_shutdown.rs @@ -6,13 +6,7 @@ use std::time::{Duration, Instant}; #[test] fn broken_stdout_exits_with_stdin_still_open() { - let mut child = Command::new(env!("CARGO_BIN_EXE_lightcraft-cli")) - .arg("mcp") - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .spawn() - .unwrap(); + let mut child = Command::new(super::binary()).arg("mcp").stdin(Stdio::piped()).stdout(Stdio::piped()).stderr(Stdio::piped()).spawn().unwrap(); let mut input = child.stdin.take().unwrap(); drop(child.stdout.take()); input.write_all(b"{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"initialize\"}\n{\"jsonrpc\":").unwrap(); diff --git a/apps/lightcraft-web/Cargo.toml b/apps/lightcraft-web/Cargo.toml index aaa14a648b..d4ae0f6674 100644 --- a/apps/lightcraft-web/Cargo.toml +++ b/apps/lightcraft-web/Cargo.toml @@ -77,3 +77,6 @@ web-sys = { workspace = true, features = [ # it (HEVC patents); build with `--features heif` to include it. On wasm32 panics abort, so # heic-rs's `catch_unwind` guard does not apply there. heif = ["lightcraft-codecs/heif"] + +[dev-dependencies] +egui = { workspace = true } diff --git a/apps/lightcraft-web/src/drop_gate.rs b/apps/lightcraft-web/src/drop_gate.rs new file mode 100644 index 0000000000..f21efced49 --- /dev/null +++ b/apps/lightcraft-web/src/drop_gate.rs @@ -0,0 +1,391 @@ +//! When the browser host may consume queued drops. Kept out of the wasm-only `web` module so the +//! rule that keeps stored drops out of a library behind a foreground window is testable natively. + +use lightcraft_ui_egui::LightcraftApp; + +/// The browser host's two drop queues: file handles not yet read, and originals whose asynchronous +/// storage has finished and that wait to be imported. Taking either only through this trait keeps +/// the gate and the drain together. +pub trait QueuedDrops { + type Dropped; + type Pending; + /// Whether a prompt or the blocking library window owns input right now. + fn drops_wait(&self) -> bool; + /// Record that all currently unread handles are held by this foreground barrier. + fn defer_dropped(&mut self); + fn take_dropped(&mut self) -> Vec; + /// Take fresh arrivals only, retaining handles protected by an earlier foreground barrier. + fn take_unprotected_dropped(&mut self) -> Vec; + fn take_pending(&mut self) -> Vec; +} + +/// A prompt or the blocking library window (over an already open library, or its own New Library +/// name prompt or asynchronous folder picker) owns input: leaves the dropped-file queue and the +/// originals still being stored for a later UI pass, instead of importing them behind the window. +/// With no library open and no dialog in front, the existing drop path is unchanged. +pub fn drops_wait(app: &LightcraftApp) -> bool { + lightcraft_ui_egui::panels::notices::blocks_input(app) || lightcraft_ui_egui::panels::library_problem::blocks_file_drops(app) +} + +/// One UI pass's queues, drained by [`drain_ready`]. +pub struct Drained { + pub dropped: Vec, + /// `None` when new file handles were refused behind a dialog: the originals already stored + /// stay queued for a later pass (as before), rather than importing behind that dialog. + pub pending: Option>, +} + +/// The actual queue drain `WebApp` runs each UI pass: while [`drops_wait`] holds, neither queue is +/// touched. With an ordinary dialog open, only fresh handles are taken for refusal; earlier +/// barrier-held handles remain queued. If fresh handles are refused, stored originals are left +/// queued as well. Otherwise the existing stored-original drain policy is unchanged. +pub fn drain_ready(queues: &mut Q, dialog_open: bool) -> Option> { + if queues.drops_wait() { + queues.defer_dropped(); + return None; + } + let dropped = if dialog_open { queues.take_unprotected_dropped() } else { queues.take_dropped() }; + let pending = if !dropped.is_empty() && dialog_open { None } else { Some(queues.take_pending()) }; + Some(Drained { dropped, pending }) +} + +#[cfg(all(test, not(target_arch = "wasm32")))] +mod tests { + use super::{QueuedDrops, drain_ready, drops_wait}; + use lightcraft_engine::Session; + use lightcraft_ui_egui::panels::library_problem::LibraryProblem; + use lightcraft_ui_egui::state::Dialog; + use lightcraft_ui_egui::{LightcraftApp, Services}; + + struct Scratch(std::path::PathBuf); + + impl Drop for Scratch { + fn drop(&mut self) { + let _ = std::fs::remove_dir_all(&self.0); + } + } + + type Asked = std::sync::Arc>>>>; + + fn app_with_library(tag: &str) -> Result<(Scratch, LightcraftApp), String> { + let dir = std::env::temp_dir().join(format!("lc-web-drop-gate-{tag}-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(&dir).map_err(|error| error.to_string())?; + let scratch = Scratch(dir); + let mut session = Session::new().with_fs(); + session.open_library(&scratch.0, false).map_err(|error| error.to_string())?; + Ok((scratch, LightcraftApp::new(session, Services::default()))) + } + + /// Stands in for `WebApp`: the same shared orchestration over two real queues, so a test sees + /// that a held window leaves both queues untouched, that the ready path drains both, and that + /// a refused new drop keeps the already stored originals queued. + struct FakeQueues { + app: LightcraftApp, + dropped: Vec, + protected: usize, + pending: Vec, + } + + impl FakeQueues { + fn new(app: LightcraftApp) -> Self { + Self { app, dropped: vec!["dropped-photo".into()], protected: 0, pending: vec!["web/hash/photo.png".into()] } + } + } + + impl QueuedDrops for FakeQueues { + type Dropped = String; + type Pending = String; + + fn drops_wait(&self) -> bool { + drops_wait(&self.app) + } + + fn defer_dropped(&mut self) { + self.protected = self.dropped.len(); + } + + fn take_dropped(&mut self) -> Vec { + self.protected = 0; + std::mem::take(&mut self.dropped) + } + + fn take_unprotected_dropped(&mut self) -> Vec { + self.dropped.split_off(self.protected.min(self.dropped.len())) + } + + fn take_pending(&mut self) -> Vec { + std::mem::take(&mut self.pending) + } + } + + #[test] + fn stored_drops_wait_through_the_choosers_new_library_prompt_and_drain_after_it() { + let (_dir, mut app) = app_with_library("chooser").expect("create chooser test library"); + let mut problem = LibraryProblem::choose_later(&app.ui.settings); + if let Some(c) = problem.chooser.as_mut() { + c.over = Some(app.session.library_generation()); + } + app.library_problem = Some(problem); + let mut queues = FakeQueues::new(app); + + // The list's own New Library name prompt hides the list but still owns the library. + queues.app.ui.dialog = Some(Dialog::TextPrompt { + title: "New Library".into(), + hint: "Library name".into(), + value: String::new(), + command: "app.newLibrary".into(), + params: serde_json::json!({}), + key: "name".into(), + }); + assert!(drain_ready(&mut queues, false).is_none(), "the name prompt holds both queues"); + assert_eq!((queues.dropped.len(), queues.pending.len()), (1, 1), "the queued drop survived the prompt"); + + // Cancelling the prompt brings the list back; it still owns the drop until it goes. + queues.app.ui.dialog = None; + assert!(drain_ready(&mut queues, false).is_none(), "the list is back and still holds the queue"); + queues.app.library_problem = None; + let got = drain_ready(&mut queues, false).expect("the queues should be ready"); + assert_eq!(got.dropped, vec!["dropped-photo".to_string()]); + assert_eq!(got.pending, Some(vec!["web/hash/photo.png".to_string()])); + assert!(queues.dropped.is_empty() && queues.pending.is_empty(), "both queues drained once the window was gone"); + } + + #[test] + fn a_refused_new_drop_behind_a_dialog_keeps_stored_originals_queued() { + let (_dir, app) = app_with_library("refused").expect("create refused-drop test library"); + // not held by the gate: the dialog alone refuses the newly dropped handles + let mut queues = FakeQueues::new(app); + let got = drain_ready(&mut queues, true).expect("the queues should be ready"); + assert_eq!(got.dropped, vec!["dropped-photo".to_string()]); + assert_eq!(got.pending, None, "the refused drop must not drain originals behind the dialog"); + assert_eq!(queues.pending.len(), 1, "the earlier originals stayed queued"); + + // Nothing new was dropped: originals read from an earlier drop still finish, as before. + let got = drain_ready(&mut queues, true).expect("the queues should be ready"); + assert!(got.dropped.is_empty()); + assert_eq!(got.pending, Some(vec!["web/hash/photo.png".to_string()])); + assert!(queues.pending.is_empty()); + } + + #[test] + fn a_no_library_library_picker_holds_both_queues() { + let mut app = LightcraftApp::new(Session::new().with_fs(), Services::default()); + let asked: Asked = Default::default(); + app.services.picker = Some(Box::new(move |_| { + let (tx, rx) = std::sync::mpsc::channel(); + asked.lock().unwrap().push(tx); + Ok(rx) + })); + // New Library's name prompt was confirmed; the asynchronous place picker is still open. + assert_eq!(app.run("app.newLibrary", serde_json::json!({"name": "Queued"})).unwrap(), serde_json::Value::Null); + assert!(app.session.library.is_none()); + app.library_problem = Some(LibraryProblem::choose_later(&app.ui.settings)); + let mut queues = FakeQueues::new(app); + assert!(drain_ready(&mut queues, false).is_none(), "a library picker that will open one holds both queues"); + assert_eq!((queues.dropped.len(), queues.pending.len()), (1, 1), "nothing was drained while the picker is up"); + } + + #[test] + fn a_no_library_window_lets_the_existing_drop_path_consume_the_queues() { + let mut app = LightcraftApp::new(Session::with_demo(), Services::default()); + app.library_problem = Some(LibraryProblem::new("/no/such/library", "missing")); + let mut queues = FakeQueues::new(app); + assert!(!drops_wait(&queues.app), "with no library open the existing drop path is unchanged"); + let got = drain_ready(&mut queues, false).expect("the queues should be ready"); + assert_eq!(got.dropped, vec!["dropped-photo".to_string()]); + assert_eq!(got.pending, Some(vec!["web/hash/photo.png".to_string()])); + assert!(queues.dropped.is_empty() && queues.pending.is_empty(), "the host consumed both queues"); + + queues.app.notices.push("The settings file could not be read and was reset.".into()); + queues.dropped.push("late-drop".into()); + queues.pending.push("web/hash/late.png".into()); + assert!(drain_ready(&mut queues, false).is_none(), "a prompt still owns input"); + assert_eq!((queues.dropped.len(), queues.pending.len()), (1, 1), "the prompt left both queues alone"); + } + + /// Uses the product's actual raw-handle queue and provenance APIs. Only the stored-original + /// vector is host-owned; there is no test copy of protected-prefix bookkeeping or policy. + struct RealAppQueues { + h: lightcraft_ui_egui::headless::Headless, + pending: Vec, + pending_takes: usize, + } + + impl QueuedDrops for RealAppQueues { + type Dropped = egui::DroppedFileHandle; + type Pending = String; + + fn drops_wait(&self) -> bool { + drops_wait(&self.h.app) + } + + fn defer_dropped(&mut self) { + self.h.app.defer_dropped_files(); + } + + fn take_dropped(&mut self) -> Vec { + self.h.app.take_dropped_files() + } + + fn take_unprotected_dropped(&mut self) -> Vec { + self.h.app.take_unprotected_dropped_files() + } + + fn take_pending(&mut self) -> Vec { + self.pending_takes += 1; + std::mem::take(&mut self.pending) + } + } + + #[derive(Debug)] + struct UnreadDrop { + path: std::path::PathBuf, + reads: std::sync::Arc, + } + + impl egui::DroppedFile for UnreadDrop { + fn path(&self) -> &std::path::Path { + &self.path + } + + fn bytes(&self) -> Result, String> { + self.reads.fetch_add(1, std::sync::atomic::Ordering::SeqCst); + Err("the queue gate must not read dropped bytes".into()) + } + } + + fn unread(path: &str) -> (egui::DroppedFileHandle, std::sync::Arc) { + let reads = std::sync::Arc::new(std::sync::atomic::AtomicUsize::new(0)); + let handle = std::sync::Arc::new(UnreadDrop { path: path.into(), reads: reads.clone() }); + (handle, reads) + } + + fn queue_raw(queues: &mut RealAppQueues, handles: &[egui::DroppedFileHandle]) { + let mut raw = egui::RawInput { dropped_files: handles.to_vec(), ..Default::default() }; + queues.h.app.raw_input_hook(&queues.h.view.ctx, &mut raw); + assert!(raw.dropped_files.is_empty(), "the product takes raw ownership once"); + } + + fn hold_library(queues: &mut RealAppQueues) -> Result<(), String> { + let mut problem = LibraryProblem::choose_later(&queues.h.app.ui.settings); + problem.chooser.as_mut().ok_or("the launch list has no chooser")?.over = Some(queues.h.app.session.library_generation()); + queues.h.app.library_problem = Some(problem); + Ok(()) + } + + fn real_queues(tag: &str) -> Result<(Scratch, RealAppQueues), String> { + let (dir, app) = app_with_library(tag)?; + let h = lightcraft_ui_egui::headless::Headless::new(app, [1300.0, 900.0], 1.0); + Ok((dir, RealAppQueues { h, pending: vec!["web/hash/stored.png".into()], pending_takes: 0 })) + } + + fn protect(queues: &mut RealAppQueues, handle: &egui::DroppedFileHandle) -> Result<(), String> { + hold_library(queues)?; + queue_raw(queues, std::slice::from_ref(handle)); + // WebApp's gate runs before App.ui, including the cold first frame. The gate + // itself must establish provenance; a warmed native UI pass cannot stand in for it. + assert_eq!(queues.h.frames(), 0, "this starts before the first native UI pass"); + assert!(drops_wait(&queues.h.app)); + assert!(drain_ready(queues, false).is_none()); + assert_eq!(queues.h.frames(), 0, "the host gate protects ownership without drawing"); + assert_eq!(queues.pending_takes, 0); + assert!(queues.h.app.scan.is_none() && queues.h.app.import.is_none()); + assert_eq!(queues.h.app.session.catalog.len(), 0); + Ok(()) + } + + #[test] + fn real_unread_barrier_drop_survives_a_dialog_while_stored_originals_finish() { + let (_dir, mut queues) = real_queues("real-held-dialog").expect("create real-queue library"); + let (a, reads) = unread("A.png"); + protect(&mut queues, &a).expect("hold the library barrier"); + queues.h.app.library_problem = None; + queues.h.app.ui.dialog = Some(Dialog::WhatsNew); + // WebApp drains BEFORE App.ui. A native UI pass here would conceal the host-order bug. + let got = drain_ready(&mut queues, true).expect("only the ordinary dialog remains"); + assert!(got.dropped.is_empty(), "the earlier unread A must not be drained for dialog refusal"); + assert_eq!( + got.pending, + Some(vec!["web/hash/stored.png".into()]), + "with no fresh refusal, earlier stored originals retain their existing completion policy" + ); + assert_eq!(queues.pending_takes, 1); + let again = drain_ready(&mut queues, true).unwrap(); + assert!(again.dropped.is_empty(), "A stays protected across another host pass"); + queues.h.app.ui.dialog = None; + let released = drain_ready(&mut queues, false).unwrap(); + assert_eq!(released.dropped.len(), 1); + assert!(std::sync::Arc::ptr_eq(&released.dropped[0], &a), "the original A handle is released"); + assert!(drain_ready(&mut queues, false).unwrap().dropped.is_empty(), "A transfers exactly once"); + assert!(queues.h.app.take_dropped_files().is_empty()); + assert_eq!(reads.load(std::sync::atomic::Ordering::SeqCst), 0); + } + + #[test] + fn real_fresh_dialog_drop_is_refused_without_consuming_protected_or_stored_files() { + let (_dir, mut queues) = real_queues("real-mixed-dialog").expect("create real-queue library"); + let (a, reads_a) = unread("A.png"); + let (b, reads_b) = unread("B.png"); + protect(&mut queues, &a).expect("hold the library barrier"); + queues.h.app.library_problem = None; + queues.h.app.ui.dialog = Some(Dialog::WhatsNew); + queue_raw(&mut queues, std::slice::from_ref(&b)); + let got = drain_ready(&mut queues, true).unwrap(); + assert_eq!(got.dropped.len(), 1, "only fresh B is offered to the browser's existing refusal branch"); + assert!(std::sync::Arc::ptr_eq(&got.dropped[0], &b)); + assert_eq!(got.pending, None, "refusing B must not consume stored originals"); + assert_eq!(queues.pending_takes, 0); + assert_eq!(queues.pending, vec!["web/hash/stored.png".to_string()]); + assert!(matches!(queues.h.app.ui.dialog, Some(Dialog::WhatsNew))); + queues.h.app.ui.dialog = None; + let released = drain_ready(&mut queues, false).unwrap(); + assert_eq!(released.dropped.len(), 1, "protected A survived B's refusal"); + assert!(std::sync::Arc::ptr_eq(&released.dropped[0], &a)); + assert_eq!(released.pending, Some(vec!["web/hash/stored.png".into()])); + let empty = drain_ready(&mut queues, false).unwrap(); + assert!(empty.dropped.is_empty()); + assert_eq!(empty.pending, Some(Vec::::new())); + assert_eq!(reads_a.load(std::sync::atomic::Ordering::SeqCst), 0); + assert_eq!(reads_b.load(std::sync::atomic::Ordering::SeqCst), 0); + // Consuming A clears its protection: a later ordinary drop is still fresh. + let (c, reads_c) = unread("C.png"); + queues.h.app.ui.dialog = Some(Dialog::WhatsNew); + queue_raw(&mut queues, std::slice::from_ref(&c)); + let fresh = drain_ready(&mut queues, true).unwrap(); + assert_eq!(fresh.dropped.len(), 1); + assert!(std::sync::Arc::ptr_eq(&fresh.dropped[0], &c)); + assert_eq!(fresh.pending, None); + queues.h.app.ui.dialog = None; + assert!(drain_ready(&mut queues, false).unwrap().dropped.is_empty()); + assert_eq!(reads_c.load(std::sync::atomic::Ordering::SeqCst), 0); + } + + #[test] + fn real_protected_drops_keep_order_through_barrier_reentry_and_transfer_once() { + let (_dir, mut queues) = real_queues("real-reentered").expect("create real-queue library"); + let (a, reads_a) = unread("A.png"); + let (b, reads_b) = unread("B.png"); + protect(&mut queues, &a).expect("hold the library barrier"); + queues.h.app.library_problem = None; + queues.h.app.ui.dialog = Some(Dialog::WhatsNew); + assert!(drain_ready(&mut queues, true).unwrap().dropped.is_empty()); + queues.h.app.ui.dialog = None; + hold_library(&mut queues).expect("reenter the library barrier"); // Before a pass can consume A. + queue_raw(&mut queues, std::slice::from_ref(&b)); + assert!(drain_ready(&mut queues, false).is_none(), "the reentered host gate protects B before native UI"); + assert_eq!(queues.h.frames(), 0, "neither protected arrival depends on font readiness or a completed UI pass"); + queues.h.app.library_problem = None; + queues.h.app.ui.dialog = Some(Dialog::WhatsNew); + assert!(drain_ready(&mut queues, true).unwrap().dropped.is_empty(), "both real barrier arrivals remain protected"); + queues.h.app.ui.dialog = None; + let released = drain_ready(&mut queues, false).unwrap(); + assert_eq!(released.dropped.len(), 2); + assert!(std::sync::Arc::ptr_eq(&released.dropped[0], &a)); + assert!(std::sync::Arc::ptr_eq(&released.dropped[1], &b)); + assert!(drain_ready(&mut queues, false).unwrap().dropped.is_empty()); + assert!(queues.h.app.take_dropped_files().is_empty()); + assert_eq!(reads_a.load(std::sync::atomic::Ordering::SeqCst), 0); + assert_eq!(reads_b.load(std::sync::atomic::Ordering::SeqCst), 0); + } +} diff --git a/apps/lightcraft-web/src/lib.rs b/apps/lightcraft-web/src/lib.rs index f984cb34c3..5d3c011589 100644 --- a/apps/lightcraft-web/src/lib.rs +++ b/apps/lightcraft-web/src/lib.rs @@ -19,6 +19,10 @@ pub mod automation; pub mod backup; pub mod bench; +// The web host's drop gate, also compiled natively so its queue handling has tests (the module is +// unused in a native, non-test library build and would otherwise be dead code there). +#[cfg(any(test, target_arch = "wasm32"))] +mod drop_gate; pub mod files; pub mod store; pub mod wire; diff --git a/apps/lightcraft-web/src/web.rs b/apps/lightcraft-web/src/web.rs index 31fe2cb0aa..6e9e855960 100644 --- a/apps/lightcraft-web/src/web.rs +++ b/apps/lightcraft-web/src/web.rs @@ -422,6 +422,33 @@ struct WebApp { ui_written: Vec, } +/// The browser host's drop queues, taken only through the shared gate: a prompt or blocking +/// library window leaves both untouched for a later UI pass. +impl crate::drop_gate::QueuedDrops for WebApp { + type Dropped = egui::DroppedFileHandle; + type Pending = String; + + fn drops_wait(&self) -> bool { + crate::drop_gate::drops_wait(&self.app) + } + + fn defer_dropped(&mut self) { + self.app.defer_dropped_files(); + } + + fn take_dropped(&mut self) -> Vec { + self.app.take_dropped_files() + } + + fn take_unprotected_dropped(&mut self) -> Vec { + self.app.take_unprotected_dropped_files() + } + + fn take_pending(&mut self) -> Vec { + self.originals.take_pending() + } +} + impl WebApp { /// Construct the web app from the boot options: install originals and open the library from /// browser storage (a read failure starts an empty session and a blocking `LibraryProblem`), @@ -534,14 +561,18 @@ impl WebApp { /// Consume the drops the raw-input hook queued once (never re-read `raw.dropped_files` in a /// hidden logic tick), and add originals whose bytes have arrived. fn import_dropped(&mut self, ctx: &egui::Context) { - let dropped = self.app.take_dropped_files(); + // A prompt or the blocking library window (including the chooser's own New Library name + // prompt or asynchronous folder picker) holds both queues for a later UI pass: nothing is + // read or imported behind it. `drain_ready` is the same orchestration the native tests run. + let dialog_open = self.app.ui.dialog.is_some(); + let Some(drained) = crate::drop_gate::drain_ready(self, dialog_open) else { return }; // a dialog is on screen (the card said so while the files hovered): nothing is read or imported // (files read from an earlier drop still finish below) - if !dropped.is_empty() && self.app.ui.dialog.is_some() { + if !drained.dropped.is_empty() && dialog_open { self.app.toast(ctx, lightcraft_ui_egui::i18n::tr("Close the open dialog, then drop the files again")); return; } - for f in dropped { + for f in drained.dropped { let (originals, backend, ctx) = (self.originals.clone(), self.backend.clone(), ctx.clone()); wasm_bindgen_futures::spawn_local(async move { let name = egui::DroppedFile::path(f.as_ref()).to_string_lossy().to_string(); @@ -551,7 +582,7 @@ impl WebApp { } }); } - let paths = self.originals.take_pending(); + let Some(paths) = drained.pending else { return }; if !paths.is_empty() { match self.app.run("library.import", json!({"paths": paths})) { // what the import did, not what was submitted: duplicates and unsupported files add nothing, @@ -723,12 +754,10 @@ impl eframe::App for WebApp { /// page title, and advance the benchmark once per root pass. fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) { // Drops are the UI phase's: a hidden `logic`/`run_logic` tick must not import them twice. - // A prompt owns the library too: keep taking the queue only after it is gone, so a drop - // during a notice cannot add photos behind it. + // `import_dropped` itself takes both queues only through the gate, so a prompt or the + // blocking library window (over an already open library) keeps a stored drop queued. let ctx = ui.ctx().clone(); - if !lightcraft_ui_egui::panels::notices::blocks_input(&self.app) { - self.import_dropped(&ctx); - } + self.import_dropped(&ctx); self.app.ui(ui); // eframe's web runner ignores `ViewportCommand::Title`: name the open photo in the page title let title = self.app.page_title(self.files.is_dirty() || self.flushing.get()); diff --git a/crates/engine/src/cmd/activity.rs b/crates/engine/src/cmd/activity.rs index af86677287..ed4e8d35c7 100644 --- a/crates/engine/src/cmd/activity.rs +++ b/crates/engine/src/cmd/activity.rs @@ -20,7 +20,7 @@ pub fn specs() -> Vec { "Cancel Background Task", [], None, - "{id} | {all: true} → {cancelled: n} — ask a task (or every cancellable task) to stop; it stops at its next file or photo. An unknown id (it may have just finished) or a task that can't be cancelled is an error", + "{id} | {all: true} → {cancelled: n} — ask a task (or every cancellable task) to stop; it stops at its next file or photo (a preview build also stops between a photo's own previews). An unknown id (it may have just finished) or a task that can't be cancelled is an error", always, |s, p| { const C: &str = "activity.cancel"; diff --git a/crates/engine/src/cmd/previews.rs b/crates/engine/src/cmd/previews.rs index bef292f8f7..e1b33cc714 100644 --- a/crates/engine/src/cmd/previews.rs +++ b/crates/engine/src/cmd/previews.rs @@ -31,6 +31,10 @@ pub struct PreviewBuild { pub what: &'static str, /// Why the whole build failed (e.g. the smart previews folder isn't there). pub error: std::sync::Mutex>, + /// Test-only: the gate this build's lanes wait at before a photo's first render (see + /// [`test_gate`]). Captured by `build` on the calling thread; production builds never have one. + #[cfg(test)] + pub(crate) gate: Option>, } impl PreviewBuild { @@ -79,10 +83,15 @@ fn task_for(s: &Session, state: &PreviewBuild) -> TaskGuard { /// Render one photo's jobs in order. The source the first job decodes serves the ones after it /// (the grid thumbnail is made from the view's source instead of decoding the file again). -pub(crate) fn run_photo(jobs: Vec) -> bool { +/// `None` when `cancel` was asked for before a job started: that photo is not counted as done. +fn run_photo_cancellable(jobs: Vec, cancel: Option<&AtomicBool>) -> Option { let mut decoded: Option = None; let mut ok = true; for mut j in jobs { + // between a photo's own previews too (a cancelled 1:1 view skips its grid thumbnail) + if cancel.is_some_and(|c| c.load(Ordering::Relaxed)) { + return None; + } if let Some(src) = &decoded && !matches!(j.source, crate::media::SourceRef::Loaded(_)) { @@ -94,7 +103,13 @@ pub(crate) fn run_photo(jobs: Vec) -> bool { decoded = r.loaded; } } - ok + Some(ok) +} + +/// [`run_photo_cancellable`] for callers that render a photo without a cancel flag. +#[cfg(test)] +pub(crate) fn run_photo(jobs: Vec) -> bool { + run_photo_cancellable(jobs, None) == Some(true) } /// How many photos render side by side: as many as an export batch for standard previews (each @@ -105,6 +120,112 @@ fn lanes(n: usize, full: bool) -> usize { if full { l.min(2) } else { l } } +/// A test-only rendezvous at the start of a photo's jobs, so a cancel can be delivered at a known +/// point instead of racing a render. One gate belongs to the build `build` starts on the test +/// thread that installed it ([`install`]); it is never global and production builds have none. +#[cfg(test)] +pub(crate) mod test_gate { + use std::sync::{Arc, Condvar, Mutex, PoisonError}; + use std::time::{Duration, Instant}; + + /// The longest a lane waits for a test to open the gate: if a test ends without its + /// [`ReleaseOnDrop`] running, the build still finishes instead of stranding its worker. + const MAX_HOLD: Duration = Duration::from_secs(30); + /// The longest a test waits for a lane to reach the gate. + const MAX_ENTER_WAIT: Duration = Duration::from_secs(10); + + #[derive(Default)] + struct State { + entered: usize, + released: bool, + } + + /// The gate a test's preview build waits at before rendering a photo (see `install`). + #[derive(Default)] + pub(crate) struct PreviewGate { + state: Mutex, + opened: Condvar, + } + + impl std::fmt::Debug for PreviewGate { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("PreviewGate").finish_non_exhaustive() + } + } + + impl PreviewGate { + pub(crate) fn new() -> Arc { + Arc::new(Self::default()) + } + + /// Called by a lane about to render a photo's first job; returns once the test opens the + /// gate, or after `MAX_HOLD` so a lost test cannot strand the worker. + pub(crate) fn enter(&self) { + let mut st = self.state.lock().unwrap_or_else(PoisonError::into_inner); + st.entered = st.entered.saturating_add(1); + self.opened.notify_all(); + let deadline = Instant::now() + MAX_HOLD; + while !st.released { + let remaining = deadline.saturating_duration_since(Instant::now()); + if remaining.is_zero() { + break; + } + let (next, _) = self.opened.wait_timeout(st, remaining).unwrap_or_else(|e| e.into_inner()); + st = next; + } + } + + /// Wait (at most `MAX_ENTER_WAIT`) until at least `n` lanes have reached the gate. + pub(crate) fn wait_entered(&self, n: usize) -> bool { + let mut st = self.state.lock().unwrap_or_else(PoisonError::into_inner); + let deadline = Instant::now() + MAX_ENTER_WAIT; + loop { + if st.entered >= n { + return true; + } + let remaining = deadline.saturating_duration_since(Instant::now()); + if remaining.is_zero() { + return false; + } + let (next, _) = self.opened.wait_timeout(st, remaining).unwrap_or_else(|e| e.into_inner()); + st = next; + } + } + + /// Open the gate: every lane waiting, or arriving later, passes without waiting. + pub(crate) fn release(&self) { + let mut st = self.state.lock().unwrap_or_else(PoisonError::into_inner); + st.released = true; + self.opened.notify_all(); + } + } + + /// Opens the gate when dropped, wherever a test ends (assertion failure, panic, early return). + pub(crate) struct ReleaseOnDrop(pub(crate) Arc); + + impl Drop for ReleaseOnDrop { + fn drop(&mut self) { + self.0.release(); + } + } + + thread_local! { + /// The gate for the next preview build started on this thread, taken by `build` so it is + /// per invocation (never shared by two builds or two tests). + static NEXT_GATE: std::cell::RefCell>> = const { std::cell::RefCell::new(None) }; + } + + /// Have the next preview build started on this thread wait at `gate` before its first photo. + pub(crate) fn install(gate: Arc) { + NEXT_GATE.with(|g| *g.borrow_mut() = Some(gate)); + } + + /// Take the gate installed for this build, leaving none for later builds. + pub(crate) fn take() -> Option> { + NEXT_GATE.with(|g| g.borrow_mut().take()) + } +} + fn run_all(jobs: Vec>, state: &PreviewBuild, task: &TaskGuard, lanes: usize) { let total = jobs.len(); let queue = std::sync::Mutex::new(jobs.into_iter()); @@ -115,7 +236,17 @@ fn run_all(jobs: Vec>, state: &PreviewBuild, task: &TaskGuard, la } let next = queue.lock().unwrap_or_else(std::sync::PoisonError::into_inner).next(); let Some(photo_jobs) = next else { break }; - let ok = crate::guard::catch("building previews", || run_photo(photo_jobs)).unwrap_or(false); + // A cancel accepted while this lane waited for the queue (or for another lane's + // photo) stops before this photo's first render; a cancelled photo is not counted. + if state.cancel.load(Ordering::Relaxed) { + break; + } + #[cfg(test)] + if let Some(gate) = &state.gate { + gate.enter(); + } + let outcome = crate::guard::catch("building previews", || run_photo_cancellable(photo_jobs, Some(&state.cancel))).unwrap_or(Some(false)); + let Some(ok) = outcome else { break }; if !ok { state.failed.fetch_add(1, Ordering::Relaxed); } @@ -143,6 +274,9 @@ fn run_all(jobs: Vec>, state: &PreviewBuild, task: &TaskGuard, la fn build(s: &mut Session, p: &Value) -> Result { const C: &str = "library.buildPreviews"; + // tests: this invocation's gate, consumed here so an early error cannot attach it to a later build + #[cfg(test)] + let gate = test_gate::take(); let edge = match str_param(p, "size").unwrap_or("standard") { "standard" => Some(p.get("edge").and_then(Value::as_u64).map_or(STANDARD_EDGE, |e| e.clamp(256, 8192) as usize)), "full" | "1:1" => None, @@ -154,6 +288,9 @@ fn build(s: &mut Session, p: &Value) -> Result { // explicit ids, else the selection, else everything in view let ids = if p.get("ids").is_some() || p.get("id").is_some() || !s.selection.ids.is_empty() { s.targets(p)? } else { s.visible_cloned() }; let jobs: Vec> = ids.iter().map(|id| jobs_for(s, *id, edge)).filter(|j| !j.is_empty()).collect(); + #[cfg(test)] + let state = Arc::new(PreviewBuild { total: jobs.len(), gate, ..Default::default() }); + #[cfg(not(test))] let state = Arc::new(PreviewBuild { total: jobs.len(), ..Default::default() }); s.preview_build = Some(state.clone()); let task = task_for(s, &state); diff --git a/crates/engine/src/tests.rs b/crates/engine/src/tests.rs index 185c94f63b..ae03859d21 100644 --- a/crates/engine/src/tests.rs +++ b/crates/engine/src/tests.rs @@ -601,6 +601,12 @@ fn degenerate_crops_render_with_spots_and_masks() { s.execute("develop.set", &json!({"control": "effects.clarity", "value": 80})).unwrap(); s.execute("develop.set", &json!({"control": "effects.dehaze", "value": 50})).unwrap(); set_crop_unchecked(&mut s, rect, 30.0); + // Measure the degenerate render, not procedural demo generation. Load exactly the + // source level this crop requests; keep the original photo, effects and output size. + let level = s.render_job(id, 700, 450, false, true).unwrap().level; + let source = s.source_now(id, level).unwrap(); + assert!(source.width > 0 && source.height > 0); + assert!(s.media.has_source(id, level), "the timed render must reuse the prepared source"); let t = std::time::Instant::now(); let r = s.render_now(id, 700, 450).unwrap(); assert!(r.image.width >= 1 && r.image.height >= 1, "{rect:?}"); @@ -1194,18 +1200,51 @@ fn preview_build_shows_in_activity_until_it_finishes() { assert_eq!(s.execute("library.previewProgress", &json!({})).unwrap()["running"], false); } -/// Issue #345: `activity.cancel` stops a preview build like `library.cancelPreviews`. +/// Issue #345: `activity.cancel` stops a preview build like `library.cancelPreviews`. A test-only +/// gate holds the lane at its first photo, so the cancel lands before any render instead of racing +/// a 24 MP one; the accepted cancel must not count that photo. #[test] fn activity_cancel_stops_a_preview_build() { + use crate::cmd::previews::test_gate::{self, PreviewGate, ReleaseOnDrop}; let mut s = demo(); - let ids: Vec = s.catalog.photos().map(|p| p.id.0).collect(); - s.execute("library.buildPreviews", &json!({"ids": ids, "size": "full"})).unwrap(); + let ids: Vec = s.catalog.photos().take(2).map(|p| p.id.0).collect(); + let gate = PreviewGate::new(); + // also opens the gate if an assertion below panics, so the worker is never stranded + let release = ReleaseOnDrop(gate.clone()); + test_gate::install(gate.clone()); + s.execute("library.buildPreviews", &json!({"ids": ids, "size": "standard", "edge": 256})).unwrap(); let id = s.activity.list().first().map(|t| t.id).expect("a previews row"); + assert!(gate.wait_entered(1), "a lane reached its first photo"); s.execute("activity.cancel", &json!({"id": id})).unwrap(); + let row = s.activity.list().into_iter().find(|t| t.id == id).expect("the row stays while the lane is held"); + assert!(row.cancelling, "the row shows the accepted cancel: {row:?}"); + drop(release); wait_activity_empty(&s); let p = s.execute("library.previewProgress", &json!({})).unwrap(); assert_eq!(p["cancelled"], true, "{p}"); - assert!(p["done"].as_u64() < p["total"].as_u64(), "stopped part-way: {p}"); + assert_eq!(p["done"], json!(0), "no photo rendered after the accepted cancel: {p}"); + assert_eq!(p["running"], false, "{p}"); +} + +/// The gated fixture is real work: without a cancel, both photos render and are counted. +#[test] +fn preview_build_at_the_test_gate_completes_without_cancel() { + use crate::cmd::previews::test_gate::{self, PreviewGate, ReleaseOnDrop}; + let mut s = demo(); + let ids: Vec = s.catalog.photos().take(2).map(|p| p.id.0).collect(); + let gate = PreviewGate::new(); + let release = ReleaseOnDrop(gate.clone()); + test_gate::install(gate.clone()); + let r = s.execute("library.buildPreviews", &json!({"ids": ids, "size": "standard", "edge": 256})).unwrap(); + assert_eq!(r["total"], json!(2), "{r}"); + assert!(gate.wait_entered(1), "a lane reached its first photo"); + drop(release); + wait_activity_empty(&s); + let p = s.execute("library.previewProgress", &json!({})).unwrap(); + assert_eq!(p["running"], false, "{p}"); + assert_eq!(p["cancelled"], false, "{p}"); + assert_eq!(p["done"], json!(2), "both photos rendered: {p}"); + assert_eq!(p["failed"], json!(0), "{p}"); } /// Colour range: a click samples the colour under it, so the mask selects that colour (white diff --git a/crates/engine/src/tests/face_recognize.rs b/crates/engine/src/tests/face_recognize.rs index b24a7bbb92..f6ca874940 100644 --- a/crates/engine/src/tests/face_recognize.rs +++ b/crates/engine/src/tests/face_recognize.rs @@ -18,10 +18,24 @@ pub(crate) fn temp(name: &str) -> PathBuf { d } +/// Seed CPU-only settings before installing models in a fresh test folder. These tests cover catalog and +/// model logic; GPU kernels have separate tests. Calling the settings mutation command here would also +/// detach the process-wide detector accelerator, interfering with other tests in the same process. +fn keep_on_cpu(s: &mut Session) { + let dir = s.face_models_dir.as_ref().unwrap(); + let settings = dir.join("settings.json"); + assert!(!settings.exists(), "only seed a fresh fixture's settings"); + std::fs::create_dir_all(dir).unwrap(); + std::fs::write(settings, br#"{"cpuOnly":true}"#).unwrap(); + let r = s.execute("faces.gpu", &json!({})).unwrap(); + assert_eq!(r["cpuOnly"], true, "the test session must run face models on the CPU: {r}"); +} + /// A demo session with a tiny model installed and chosen. pub(crate) fn setup(d: &std::path::Path, dim: u64) -> (Session, String) { let mut s = Session::with_demo(); s.face_models_dir = Some(d.join("models")); + keep_on_cpu(&mut s); let model = d.join(format!("tiny{dim}.onnx")); std::fs::write(&model, lightcraft_faces::synthetic::tiny_embedder_model(dim)).unwrap(); let r = s.execute("faces.models.install", &json!({"path": model.to_string_lossy(), "acknowledged": true})).unwrap(); @@ -30,6 +44,47 @@ pub(crate) fn setup(d: &std::path::Path, dim: u64) -> (Session, String) { (s, id) } +/// A fresh empty library with the tiny model installed and chosen. The tests below only need a decodable +/// picture (and enough pixels for an optional real detector), not the demo's 12 procedural 24 MP scenes: +/// each demo photo costs a full develop render before the 112 px model input. +fn fresh_library(d: &std::path::Path, dim: u64) -> (Session, PathBuf) { + let lib = d.join("lib"); + let mut s = Session::new().with_fs(); + s.face_models_dir = Some(d.join("models")); + keep_on_cpu(&mut s); + s.open_library(&lib, false).unwrap(); + let model = d.join(format!("tiny{dim}.onnx")); + std::fs::write(&model, lightcraft_faces::synthetic::tiny_embedder_model(dim)).unwrap(); + s.execute("faces.models.install", &json!({"path": model.to_string_lossy(), "acknowledged": true})).unwrap(); + (s, lib) +} + +/// A real, distinct 1024×768 PNG (seed picks its colours). +fn write_photo(path: &std::path::Path, seed: u8) { + let (w, h) = (1024usize, 768usize); + let data: Vec<[u8; 4]> = (0..w * h) + .map(|i| [((i % w * 3 + seed as usize * 17) % 256) as u8, ((i / w * 5 + seed as usize * 29) % 256) as u8, seed.wrapping_mul(41), 255]) + .collect(); + let img = lightcraft_raster::Rgba8 { width: w, height: h, data }; + let bytes = lightcraft_codecs::encode_png(&lightcraft_codecs::EncodeImage::rgba8(&img), &lightcraft_codecs::EncodeMeta::default()).unwrap(); + std::fs::create_dir_all(path.parent().unwrap()).unwrap(); + std::fs::write(path, bytes).unwrap(); +} + +/// Import three distinct real file-backed photos: two for faces and one with none for the optional detector. +fn import_three_photos(s: &mut Session, d: &std::path::Path) -> (PhotoId, PhotoId, PhotoId) { + let mut paths = Vec::new(); + for (i, name) in ["ann.png", "bea.png", "empty.png"].iter().enumerate() { + let path = d.join("photos").join(name); + write_photo(&path, i as u8 + 1); + paths.push(path.to_string_lossy().into_owned()); + } + let r = s.execute("library.import", &json!({"paths": paths})).unwrap(); + let ids: Vec = r["imported"].as_array().unwrap().iter().map(|v| PhotoId(v.as_u64().unwrap())).collect(); + assert_eq!(ids.len(), 3, "three real photos imported: {r}"); + (ids[0], ids[1], ids[2]) +} + /// Installs the real YuNet from `LC_YUNET_MODEL=` (what Settings > Faces downloads; nothing is /// committed) and says whether it did: the parts of a test that need to find faces run only then. pub(crate) fn install_yunet(s: &mut Session) -> bool { @@ -61,35 +116,52 @@ pub(crate) fn two_photos(s: &Session) -> (PhotoId, PhotoId) { #[test] fn indexing_embeds_each_face_once_and_reports_progress() { let d = temp("index"); - let (mut s, _) = setup(&d, 64); - let (a, b) = two_photos(&s); + let (mut s, _) = fresh_library(&d, 64); + let (a, b, c) = import_three_photos(&mut s, &d); set_regions(&mut s, a, vec![region(0.1, Some("Ann")), region(0.5, None)]); set_regions(&mut s, b, vec![region(0.3, None)]); // only a report let r = s.execute("faces.index", &json!({"budgetMs": 0})).unwrap(); assert_eq!((r["embedded"].clone(), r["photosDone"].clone(), r["pendingPhotos"].clone()), (json!(0), json!(0), json!(2)), "{r}"); - // a generous budget does it all, the named photo first - let r = s.execute("faces.index", &json!({"budgetMs": 60_000})).unwrap(); - assert_eq!((r["embedded"].clone(), r["pendingPhotos"].clone(), r["indexedFaces"].clone()), (json!(3), json!(0), json!(3)), "{r}"); + // `faces.index` stops between whole photos once the budget is spent, so follow its documented contract: + // call again until `pendingPhotos` is 0. Two photos need at most two productive calls; the named photo is + // first in the queue, and every face is embedded exactly once. + let mut embedded = 0u64; + for call in 0..2 { + let r = s.execute("faces.index", &json!({"budgetMs": 60_000})).unwrap(); + embedded += r["embedded"].as_u64().unwrap(); + if call == 0 { + assert!(s.faces.index.contains(a.0, ®ion(0.1, Some("Ann")).rect), "the named photo is done first: {r}"); + assert!(s.faces.index.contains(a.0, ®ion(0.5, None).rect), "both of its faces are embedded: {r}"); + } + if r["pendingPhotos"] == 0 { + break; + } + } + let r = s.execute("faces.index", &json!({"budgetMs": 0})).unwrap(); + assert_eq!((r["pendingPhotos"].clone(), r["indexedFaces"].clone()), (json!(0), json!(3)), "{r}"); + assert_eq!(embedded, 3, "each of the three faces was embedded exactly once across calls"); // nothing is embedded twice let r = s.execute("faces.index", &json!({"budgetMs": 60_000})).unwrap(); assert_eq!((r["embedded"].clone(), r["photosDone"].clone()), (json!(0), json!(0))); // a small budget still makes progress (at least one photo per call), and `ids` go first - let c = s.catalog.photos().map(|p| p.id).find(|id| *id != a && *id != b).unwrap(); set_regions(&mut s, c, vec![region(0.2, None)]); set_regions(&mut s, b, vec![region(0.3, None), region(0.6, None)]); let r = s.execute("faces.index", &json!({"budgetMs": 1, "ids": [c.0]})).unwrap(); assert_eq!(r["photosDone"], 1, "{r}"); assert_eq!(r["pendingPhotos"], 1, "{r}"); assert!(s.faces.index.contains(c.0, ®ion(0.2, None).rect), "the photo asked for first was done first"); + // keep the imported files until the session that references them is gone + drop(s); let _ = std::fs::remove_dir_all(&d); } #[test] fn suggestions_come_from_the_named_faces_and_are_never_applied() { let d = temp("suggest"); - let (mut s, _) = setup(&d, 64); - let (a, b) = two_photos(&s); + // Gallery and candidate semantics need real embeddings, not full 24 MP demo renders. + let (mut s, _) = fresh_library(&d, 64); + let (a, b, _) = import_three_photos(&mut s, &d); set_regions(&mut s, a, vec![region(0.1, Some("Ann"))]); set_regions(&mut s, b, vec![region(0.1, None), region(0.5, Some("Pet?")), region(0.7, None)]); // thresholds that accept anything: Ann is the only person with a named face except "Pet?" @@ -173,6 +245,7 @@ fn embeddings_are_cached_beside_the_library_and_reset_for_another_model() { }; let mut s = Session::new().with_fs(); s.face_models_dir = Some(models.clone()); + keep_on_cpu(&mut s); s.open_library(&lib, true).unwrap(); let (a, _) = two_photos(&s); set_regions(&mut s, a, vec![region(0.1, Some("Ann")), region(0.5, None)]); @@ -214,8 +287,9 @@ fn without_a_chosen_model_recognition_says_so() { #[test] fn the_background_pump_indexes_by_itself_once_recognition_is_on() { let d = temp("pump"); - let (mut s, _) = setup(&d, 64); - let (a, b) = two_photos(&s); + // Exercise real background embedding without unrelated full 24 MP demo renders. + let (mut s, _) = fresh_library(&d, 64); + let (a, b, _) = import_three_photos(&mut s, &d); set_regions(&mut s, a, vec![region(0.1, Some("Ann")), region(0.5, None)]); set_regions(&mut s, b, vec![region(0.3, None)]); // installing the model switched recognition on; switched off, the pump does nothing, and says so @@ -251,31 +325,33 @@ fn the_background_pump_indexes_by_itself_once_recognition_is_on() { #[test] fn the_background_pump_saves_what_it_embeds_for_the_next_launch() { let d = temp("pumpsave"); - let (lib, models) = (d.join("lib"), d.join("models")); - let mut s = Session::new().with_fs(); - s.face_models_dir = Some(models); - s.open_library(&lib, true).unwrap(); - let model = d.join("tiny64.onnx"); - std::fs::write(&model, lightcraft_faces::synthetic::tiny_embedder_model(64)).unwrap(); - // installing switches recognition on: nothing else is asked for - s.execute("faces.models.install", &json!({"path": model.to_string_lossy(), "acknowledged": true})).unwrap(); + // Installing the tiny model switches recognition on: nothing else is asked for. + let (mut s, lib) = fresh_library(&d, 64); // without the detector (not bundled) photos without faces are left unsearched let searching = install_yunet(&mut s); - let (a, b) = two_photos(&s); + let (a, b, c) = import_three_photos(&mut s, &d); set_regions(&mut s, a, vec![region(0.1, Some("Ann")), region(0.5, None)]); set_regions(&mut s, b, vec![region(0.3, None)]); + assert!(s.catalog.photo(c).unwrap().meta.regions.is_empty(), "the third photo has no face to find"); let photos = s.catalog.photos().count(); - let searched_photos = if searching { photos - 2 } else { 0 }; + assert_eq!(photos, 3, "a fresh library holds only the three imported photos"); + // only the one photo without a face region is searched when the optional detector is installed + let searched_photos = usize::from(searching); let deadline = std::time::Instant::now() + std::time::Duration::from_secs(120); - let mut last = json!(null); + let (mut last, mut embedded) = (json!(null), 0u64); while std::time::Instant::now() < deadline { last = s.execute("faces.pump", &json!({})).unwrap(); + embedded += last["embedded"].as_u64().unwrap_or(0); if last["pendingPhotos"] == 0 && s.faces.index.len() == 3 && s.faces.scanned.len() == searched_photos { break; } std::thread::sleep(std::time::Duration::from_millis(50)); } assert_eq!((s.faces.index.len(), s.faces.scanned.len()), (3, searched_photos), "{last}"); + assert_eq!(embedded, 3, "the background worker embedded each face exactly once: {last}"); + // once everything is done another pump starts no work and reports no new embedding + let idle = s.execute("faces.pump", &json!({})).unwrap(); + assert_eq!((idle["embedded"].clone(), idle["inFlight"].clone(), idle["pendingPhotos"].clone()), (json!(0), json!(0), json!(0)), "{idle}"); let (tag, path) = (s.faces.index.tag.clone(), s.faces.index.path.clone().unwrap()); assert!(path.file_name().unwrap().to_string_lossy().starts_with("face-embeddings-custom-"), "one cache file per model: {}", path.display()); // the first batch is written at once; whatever is left is written when the session ends, so a launch never redoes @@ -491,12 +567,9 @@ fn every_scanned_face_is_shown_by_the_same_kind_of_box() { #[test] fn face_scan_row_follows_pending_photos() { let d = temp("activity"); - let (mut s, _) = setup(&d, 64); - // the last two demo photos, not the first two the other scan tests use: two sessions scanning the same demo scene - // at once can deadlock (issue #630), and this test is about the row, not that - let mut ids = s.catalog.photos().map(|p| p.id).collect::>(); - ids.sort(); - let (a, b) = (ids[ids.len() - 2], ids[ids.len() - 1]); + // The activity row needs real background embedding, not full 24 MP demo renders. + let (mut s, _) = fresh_library(&d, 64); + let (a, b, _) = import_three_photos(&mut s, &d); set_regions(&mut s, a, vec![region(0.1, None), region(0.5, None)]); set_regions(&mut s, b, vec![region(0.3, None)]); let faces_rows = |s: &Session| s.activity.list().into_iter().filter(|t| t.kind == "faces").collect::>(); diff --git a/crates/mcp/tests/it/e2e.rs b/crates/mcp/tests/it/e2e.rs index 66cb934605..03d77c7e26 100644 --- a/crates/mcp/tests/it/e2e.rs +++ b/crates/mcp/tests/it/e2e.rs @@ -8,7 +8,7 @@ use std::sync::Arc; use std::sync::atomic::{AtomicBool, Ordering}; use std::time::{Duration, Instant}; -use lightcraft_mcp::{Backend, Headless, ProgressHook, Remote, Server, base64_decode}; +use lightcraft_mcp::{Backend, Headless, ProgressHook, Remote, Server, base64_decode, call_tool}; use serde_json::{Value, json}; /// Feed a whole session through `Server::serve` and return the replies by id. @@ -184,6 +184,28 @@ fn remote_unreachable_is_a_tool_error() { assert!(r[0]["result"]["content"][0]["text"].as_str().unwrap().contains("not reachable")); } +/// Eight distinct 1200×800 PNGs on disk, imported into a filesystem session with their real +/// metadata: a library of actual files for the batch export to read and develop. Generating the +/// procedural 6000×4000 demo library (and rendering from it) costs far more than this test's +/// contract — progress, cancellation and atomic 1200-edge PNG writes — needs. +fn file_backed_photos(dir: &std::path::Path) -> Headless { + let originals = dir.join("originals"); + std::fs::create_dir_all(&originals).unwrap(); + let mut paths = Vec::new(); + for i in 0..8usize { + let path = originals.join(format!("frame-{i:02}.png")); + let img = lightcraft_raster::Rgba8::from_fn(1200, 800, |x, y| { + [((x + i * 37) % 256) as u8, ((y * 3 + i * 11) % 256) as u8, ((x / 4 + y / 2 + i * 23) % 256) as u8, 255] + }); + lightcraft_mcp::write_image(&path, &img, 90).unwrap(); + paths.push(path.to_string_lossy().to_string()); + } + let mut headless = Headless::new(lightcraft_engine::Session::new().with_fs()); + let imported = call_tool(&mut headless, "import", &json!({"paths": paths})); + assert!(!imported.is_error, "{imported:?}"); + headless +} + /// [`Headless`] whose batch export, while `hold` is set, waits once its first photo is written: /// it keeps asking the server's progress hook at that photo boundary (which answers pings and /// reads cancels meanwhile) until the request is cancelled or the test clears `hold`. A ping or @@ -236,7 +258,7 @@ fn export_progress_and_cancel() { let (input, mut send) = std::io::pipe().unwrap(); let (output, write) = std::io::pipe().unwrap(); let hold = Arc::new(AtomicBool::new(true)); - let backend = HoldAfterFirst { inner: Headless::demo(), hold: hold.clone() }; + let backend = HoldAfterFirst { inner: file_backed_photos(&dir), hold: hold.clone() }; let server = std::thread::spawn(move || Server::new(Box::new(backend)).serve(BufReader::new(input), write).unwrap()); let (tx, rx) = std::sync::mpsc::channel(); let reader = std::thread::spawn(move || { @@ -250,8 +272,16 @@ fn export_progress_and_cancel() { let next = || rx.recv_timeout(Duration::from_secs(30)).expect("MCP reply/progress"); writeln!(send, "{}", call(1, "query_photos", json!({"limit":8}))).unwrap(); let query = next(); - let ids: Vec<_> = query["result"]["structuredContent"]["photos"].as_array().unwrap().iter().map(|p| p["id"].clone()).collect(); - assert_eq!(ids.len(), 8); + let photos = query["result"]["structuredContent"]["photos"].as_array().unwrap(); + assert_eq!(photos.len(), 8); + // Real files, real metadata: eight distinct 1200×800 PNGs probed from disk, not synthesized. + let names: std::collections::HashSet<&str> = photos.iter().map(|p| p["fileName"].as_str().unwrap()).collect(); + assert_eq!(names.len(), 8, "{names:?}"); + for p in photos { + assert_eq!((p["width"].as_u64(), p["height"].as_u64()), (Some(1200), Some(800)), "{p}"); + assert_eq!(p["format"], "PNG", "{p}"); + } + let ids: Vec<_> = photos.iter().map(|p| p["id"].clone()).collect(); let mut request = call(2, "export", json!({"ids":ids,"dir":dir.join("complete"),"longEdge":1200,"format":"png"})); request["params"]["_meta"] = json!({"progressToken":"photos","io.modelcontextprotocol/protocolVersion":"2026-07-28"}); writeln!(send, "{request}").unwrap(); @@ -314,10 +344,24 @@ fn export_progress_and_cancel() { let photos: Vec<_> = std::fs::read_dir(&out).unwrap().map(|e| e.unwrap().path()).filter(|p| *p != decoy).collect(); assert_eq!(photos.len(), 1, "only the photo completed before the cancel remains: {photos:?}"); for path in &photos { - lightcraft_codecs::decode(&std::fs::read(path).unwrap(), Default::default()).expect("complete image, no partial/temp file"); + let d = lightcraft_codecs::decode(&std::fs::read(path).unwrap(), Default::default()).expect("complete image, no partial/temp file"); + assert_eq!((d.width, d.height), (1200, 800), "{}", path.display()); } - assert_eq!(std::fs::read_dir(dir.join("complete")).unwrap().count(), 8, "earlier export retained"); + // The finished export's eight outputs are real 1200×800 PNGs, one per distinct original. + let complete: Vec<_> = std::fs::read_dir(dir.join("complete")).unwrap().map(|e| e.unwrap().path()).collect(); + assert_eq!(complete.len(), 8, "earlier export retained: {complete:?}"); + let mut exported = std::collections::HashSet::new(); + for path in &complete { + let bytes = std::fs::read(path).unwrap(); + assert_eq!(&bytes[1..4], b"PNG", "{}", path.display()); + let d = lightcraft_codecs::decode(&bytes, Default::default()).unwrap_or_else(|e| panic!("{}: {e}", path.display())); + assert_eq!((d.width, d.height), (1200, 800), "{}", path.display()); + exported.insert(bytes); + } + assert_eq!(exported.len(), 8, "eight distinct outputs, not copies of one export"); drop(send); + // The fixture's files stay in place until the server (which owns the session) and the reader + // have finished: the session reads the originals; the output is what the checks above read. server.join().unwrap(); reader.join().unwrap(); std::fs::remove_dir_all(dir).unwrap(); diff --git a/crates/raw/src/preview.rs b/crates/raw/src/preview.rs index 245b24f750..2047174da2 100644 --- a/crates/raw/src/preview.rs +++ b/crates/raw/src/preview.rs @@ -324,7 +324,13 @@ fn walk_jpeg(b: &[u8], i: &mut usize) -> Option<(usize, u8)> { if m == 0xda { // entropy-coded data up to the next marker that is not a stuffed 0xff or a restart loop { - *i += b.get(*i..)?.iter().position(|&x| x == 0xff)?; + let Some(p) = b.get(*i..)?.iter().position(|&x| x == 0xff) else { + // the terminal search examined the rest of the slice: charge it before failing, + // or a crafted file can repeat full-file searches while the budget stays positive + *i = b.len(); + return None; + }; + *i += p; match *b.get(*i + 1)? { 0x00 | 0xd0..=0xd7 => *i += 2, 0xff => *i += 1, @@ -348,9 +354,29 @@ fn walk_jpeg(b: &[u8], i: &mut usize) -> Option<(usize, u8)> { /// share a budget of eight times the file's size, so the scan stays linear (a real file's candidates /// fail within a few bytes, or are the preview itself). fn scan_for_jpeg(data: &[u8]) -> Option> { + scan_with_budget(data, scan_budget(data.len())).0 +} + +/// The walks' shared budget: eight times the file's size, at least 1 MiB (a tiny file still gets a +/// useful allowance), saturating so a hostile length cannot wrap it. +fn scan_budget(len: usize) -> usize { + len.saturating_mul(8).max(1 << 20) +} + +/// [`scan_for_jpeg`] with the walks' shared budget passed in, returning the walks' charged extent: +/// `(preview, bytes charged)`. The counter records the work each walk did whether or not budget +/// remains, so it stays a measure of work rather than of `budget - left`; a last walk may overshoot +/// the remaining budget by its own reach. It is a conservative charged-work measure, not literally +/// the bytes read: marker payloads skipped by `*i += len` are charged without being read, and a +/// failed terminal search is charged to the end of the slice. That over-count is safe for the +/// budget. It is a `u64` with saturating addition because the unbudgeted worst case is quadratic in +/// the file size (32-bit `usize` could otherwise overflow), and it costs one addition per +/// candidate, no allocation. +fn scan_with_budget(data: &[u8], budget: usize) -> (Option>, u64) { let mut best: Option<(usize, usize)> = None; let mut at = 1; - let mut budget = data.len().saturating_mul(8).max(1 << 20); + let mut left = budget; + let mut walked = 0u64; while let Some(off) = data.get(at..).and_then(|s| s.iter().position(|&b| b == 0xd8)) { let d8 = at + off; at = d8 + 1; @@ -360,8 +386,10 @@ fn scan_for_jpeg(data: &[u8]) -> Option> { let start = d8 - 1; // `at` starts at 1, so d8 >= 1 let mut reach = start; let found = jpeg_extent(data, start, &mut reach); - budget = budget.saturating_sub(reach.saturating_sub(start)); - if budget == 0 { + let spent = reach.saturating_sub(start); + left = left.saturating_sub(spent); + walked = walked.saturating_add(spent as u64); + if left == 0 { break; } if let Some((end, 3)) = found { @@ -371,12 +399,14 @@ fn scan_for_jpeg(data: &[u8]) -> Option> { at = end; } } - let (start, end) = best?; - let mut jpeg = data.get(start..end)?.to_vec(); - if let Some(first) = jpeg.first_mut() { - *first = 0xff; - } - Some(jpeg) + let jpeg = best.and_then(|(start, end)| { + let mut jpeg = data.get(start..end)?.to_vec(); + if let Some(first) = jpeg.first_mut() { + *first = 0xff; + } + Some(jpeg) + }); + (jpeg, walked) } /// Canon CR3: the full-size JPEG track (see [`lightcraft_meta::cr3`]), else the `PRVW` / `THMB` boxes. diff --git a/crates/raw/src/preview/tests.rs b/crates/raw/src/preview/tests.rs index 286ad1d777..2ee098414f 100644 --- a/crates/raw/src/preview/tests.rs +++ b/crates/raw/src/preview/tests.rs @@ -300,19 +300,97 @@ fn scan_jpeg(nc: u8, n: usize) -> Vec { j } -/// A crafted container full of JPEG-like starts (each walk running on through the ones after it) -/// is scanned in linear time: the walks share a budget (without it this 40 MB file takes about a minute). -#[test] -fn a_scan_through_many_fake_jpegs_stays_linear() { +/// `units` copies of a 200-byte record whose `d8 ff db` start runs each walk on through the +/// starts after it (a crafted Minolta-like container). +fn many_fake_jpegs(units: usize) -> Vec { let mut unit = vec![0u8, 0xd8, 0xff, 0xdb, 0x00, 0x02, 0xff, 0xda, 0x00, 0x02]; unit.extend(std::iter::repeat_n(0x55u8, 190)); let mut f = b"\0MRM\0\x01\0\0".to_vec(); - for _ in 0..200_000 { + f.reserve(units * unit.len()); + for _ in 0..units { f.extend_from_slice(&unit); } - let t = std::time::Instant::now(); + f +} + +/// The production scan's budget policy, restated here so the tests assert an expected bound +/// independently instead of calling the helper under test: eight times the file's size, at +/// least 1 MiB. +fn policy_budget(len: usize) -> u64 { + (len as u64 * 8).max(1 << 20) +} + +/// A crafted 40 MB container full of JPEG-like starts (each walk running on through the starts +/// after it) is scanned in bounded work: the walks share a budget (without it this file would +/// walk about 8·10^10 bytes), so the charged work stays within the policy budget plus one walk's +/// reach. No wall clock: this cannot fail on a slow runner, and removing the budget shows up as +/// the work exploding. +#[test] +fn a_scan_through_many_fake_jpegs_stays_linear() { + let f = many_fake_jpegs(200_000); + assert_eq!(f.len(), 40_000_008, "the adversarial fixture the budget was measured on"); + let (found, walked) = scan_with_budget(&f, policy_budget(f.len()) as usize); + assert_eq!(found, None); + let bound = policy_budget(f.len()) + f.len() as u64; + assert!(walked <= bound, "walked {walked} bytes of a {} byte file (bound {bound})", f.len()); +} + +/// A walk whose final entropy search finds no `ff` has examined the rest of the file, so that +/// search is charged to the budget before the walk fails. Without the charge the 40 MB tail is +/// scanned for free and only the few KB before it are reported, while `left` stays positive and +/// the budget no longer bounds the work. +#[test] +fn a_failed_terminal_search_is_charged_to_the_budget() { + let mut f = many_fake_jpegs(20); + f.extend(std::iter::repeat_n(0x55u8, 40_000_000)); + let (found, walked) = scan_with_budget(&f, 1); + assert_eq!(found, None); + assert!(walked >= 40_000_000, "terminal search was not charged: {walked} of {} bytes", f.len()); +} + +/// The production wrapper stops at the same shared budget. Eighteen fake candidates each declare +/// a segment length that makes their walk jump 0xFFF0 bytes, exhausting the tiny file's 1 MiB +/// allowance before the valid JPEG after them: the wrapper finds nothing. A `usize::MAX` budget +/// (or no budget at all) would walk on and return that JPEG. +#[test] +fn the_production_wrapper_stops_at_the_shared_budget() { + let mut f = b"\0MRM\0\x01\0\0".to_vec(); + for _ in 0..18 { + f.extend_from_slice(&[0x00, 0xd8, 0xff, 0xe1, 0xff, 0xf0]); + } + f.extend_from_slice(&scan_jpeg(3, 100)); assert_eq!(scan_for_jpeg(&f), None); - assert!(t.elapsed() < std::time::Duration::from_secs(10), "{:?}", t.elapsed()); +} + +/// The shared budget is what bounds the work, and the counter reports the work itself. The same +/// generator at 200 starts is a 40 KB file: without the budget (never decremented, or restarted +/// for each candidate) the scan walks all 200 walks, 4 MB, instead of about 1 MB — so a negative +/// run costs megabytes, not the 8·10^10 bytes of the 40 MB fixture. +#[test] +fn the_scan_budget_bounds_the_work_a_crafted_file_can_cause() { + let f = many_fake_jpegs(200); + let budget = policy_budget(f.len()); + let (found, walked) = scan_with_budget(&f, budget as usize); + assert_eq!(found, None); + assert!(walked >= (f.len() as u64) / 2, "the walks ran: {walked} bytes of {}", f.len()); + assert!(walked <= budget + (f.len() as u64), "walked {walked} with a {budget} byte budget"); + // The counter records the work, not the unspent budget: a budget of one file size is spent + // by the first walk, and the second walk is still counted in full (it overshoots). + let (_, spent) = scan_with_budget(&f, f.len()); + let len = f.len() as u64; + assert!(spent > len && spent <= 2 * len, "spent {spent} with a {len}-byte budget"); + // No candidate, no work counted. + let none = b"no jpeg here"; + assert_eq!(scan_with_budget(none, policy_budget(none.len()) as usize).1, 0); + // One real candidate: the counter counts exactly the reach of its walk. + let mut one = vec![0u8]; + let jpeg = scan_jpeg(3, 100); + one.extend_from_slice(&jpeg); + let (found, walked) = scan_with_budget(&one, policy_budget(one.len()) as usize); + assert!(found.is_some()); + assert_eq!(walked, jpeg.len() as u64, "one walk of the JPEG's {} bytes", jpeg.len()); + // The production wrapper takes the same path and returns the counter's preview. + assert_eq!(scan_for_jpeg(&one).as_deref(), found.as_deref()); } /// Containers whose structure we do not walk give up their largest colour JPEG, found by scanning. diff --git a/crates/ui-egui/examples/thumb_request_bench.rs b/crates/ui-egui/examples/thumb_request_bench.rs index 166c0e9b62..34fe5fc883 100644 --- a/crates/ui-egui/examples/thumb_request_bench.rs +++ b/crates/ui-egui/examples/thumb_request_bench.rs @@ -113,7 +113,7 @@ fn micro(points: usize, pending: bool) { let key = app.session.thumb_job(id, 384).unwrap().key; app.renderer.textures.insert( Slot::Thumb(id), - Tex { key, photo: id, tex: texture.clone(), size: [1, 1], histogram: None, ms: 0.0, quick: None, pixels: None }, + Tex { look: None, key, photo: id, tex: texture.clone(), size: [1, 1], histogram: None, ms: 0.0, quick: None, pixels: None }, ); } request_thumb(&mut app, id, 384, 10); diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 30a672c52c..98f8458c9d 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -53,6 +53,7 @@ impl LightcraftApp { slideshow_hidden_at: None, slideshow_auto_paused: false, dropped_files: vec![], + deferred_dropped_file_count: 0, synthetic_in_flight: false, ui_passes: 0, #[cfg(test)] diff --git a/crates/ui-egui/src/app/frame.rs b/crates/ui-egui/src/app/frame.rs index 5d9ed2f37c..efae98a9b0 100644 --- a/crates/ui-egui/src/app/frame.rs +++ b/crates/ui-egui/src/app/frame.rs @@ -215,9 +215,15 @@ impl LightcraftApp { self.last_time = t; panels::denoise::pump_ui_input(self, ctx, now); panels::faces::pump_ui_input(self, ctx, now); - // A prompt owns the library too: files dropped while it is up wait in the queue and are - // imported on the first UI pass after it goes away, never behind it. - if !panels::notices::blocks_input(self) { + // A prompt or the blocking library window owns the library too: files dropped while either + // is up wait in the queue and are imported on the first UI pass after it goes away, never + // behind it. With no library open the window's `hold_dropped` path still takes the photos + // once its own dialog and asynchronous library picker are gone, so `blocks_file_drops` + // only holds them back until then. Mark those drops: once the barrier opens they may find + // a dialog, Lightroom import or import that the library's own open started still running. + if panels::notices::blocks_input(self) || panels::library_problem::blocks_file_drops(self) { + self.defer_dropped_files(); + } else { self.import_dropped_files(ctx); } self.check_external_editor(ctx); diff --git a/crates/ui-egui/src/app/input.rs b/crates/ui-egui/src/app/input.rs index 0757ecbe09..f94108ce01 100644 --- a/crates/ui-egui/src/app/input.rs +++ b/crates/ui-egui/src/app/input.rs @@ -1,15 +1,50 @@ use super::*; impl LightcraftApp { + /// Preserve the currently queued handles while a prompt or blocking library window owns + /// drops. Hosts call this in their UI phase even if the app is not ready to draw yet. + pub fn defer_dropped_files(&mut self) { + self.deferred_dropped_file_count = self.dropped_files.len(); + } + /// Take the host's dropped files, exactly once. The queue is filled by `raw_input_hook`, so a /// hidden logic tick can never replay the last pass's drop. Web hosts call this in their UI /// phase (they need `bytes_async`, which is not available on a native file path). pub fn take_dropped_files(&mut self) -> Vec { + self.deferred_dropped_file_count = 0; std::mem::take(&mut self.dropped_files) } + /// Take only drops that did not wait behind a prompt or blocking library window. + /// Hosts call this in the UI phase to refuse fresh arrivals behind an ordinary dialog + /// while preserving the earlier protected prefix for a later pass. + pub fn take_unprotected_dropped_files(&mut self) -> Vec { + if self.deferred_dropped_file_count == 0 { + return self.take_dropped_files(); + } + self.dropped_files.split_off(self.deferred_dropped_file_count.min(self.dropped_files.len())) + } + /// Import native drops as presets, face models or photos. pub(super) fn import_dropped_files(&mut self, ctx: &egui::Context) { + // A drop that waited behind a prompt or the library window is not dropped again just + // because a dialog, Lightroom catalog import, a running Synchronize Folder or the import + // a library open started is still running when the barrier goes. Keep it queued and try + // the next pass. A drop made outside the barrier keeps the deliberate "close the + // dialog"/"An import is running" refusal below. + if self.deferred_dropped_file_count > 0 + && (self.ui.dialog.is_some() || self.lightroom.is_some() || self.sync_run.is_some() || import::running(self)) + { + // Only the earlier barrier-held prefix waits. Fresh drops must still be handled + // under the current dialog/import policy instead of inheriting that protection. + #[cfg(not(target_arch = "wasm32"))] + { + let fresh = self.take_unprotected_dropped_files(); + self.handle_dropped_files(ctx, fresh); + } + ctx.request_repaint_after(std::time::Duration::from_millis(100)); + return; + } let dropped = self.take_dropped_files(); if dropped.is_empty() { return; @@ -35,10 +70,15 @@ impl LightcraftApp { return; } let drop = drop_overlay::classify(dropped); - if let Some(model) = drop.models.first() - && let Err(e) = panels::faces::open_dialog(self, model) - { - self.toast(ctx, e); + if let Some(model) = drop.models.first() { + // no library open yet (the launch list, a library that failed to open): its licence + // dialog would open behind the window that owns input. The drop is refused like a + // preset; photos below still wait for the library chosen. + if panels::library_problem::holds_drops(self) { + self.toast(ctx, crate::i18n::tr("Open a library first, then drop the model again")); + } else if let Err(e) = panels::faces::open_dialog(self, model) { + self.toast(ctx, e); + } } if !drop.presets.is_empty() { // presets live in a library: with none open they would go with the session it replaces diff --git a/crates/ui-egui/src/app/screenshot.rs b/crates/ui-egui/src/app/screenshot.rs index e97d257eac..c2de3aae61 100644 --- a/crates/ui-egui/src/app/screenshot.rs +++ b/crates/ui-egui/src/app/screenshot.rs @@ -131,6 +131,25 @@ impl LightcraftApp { Ok(()) } + /// Finish a rendered headless capture, growing its reservation before writing if needed. + /// Every path replies once and releases the request's reserved bytes. + pub(crate) fn finish_headless_shot(&mut self, shot: &mut PendingShot, img: &egui::ColorImage) { + let bytes = img.size[0].checked_mul(img.size[1]).and_then(|p| p.checked_mul(std::mem::size_of::())); + let result = match bytes { + Some(bytes) if bytes > shot.reserved => self.grow_shot_reservation(shot.reserved, bytes).map(|()| { + shot.reserved = bytes; + }), + Some(_) => Ok(()), + None => Err("ui.screenshot: the rendered image has invalid dimensions".to_owned()), + }; + let reply = match result { + Ok(()) => control::save_screenshot(self, img, shot.target.as_ref()), + Err(error) => serde_json::json!({"ok": false, "error": error}), + }; + let _ = shot.reply.send(reply); + self.release_shot_bytes(shot.reserved); + } + /// Advance pending screenshots: wait (≥ 3 completed UI frames, ≥ 120 ms) until no renders are /// in flight — or until the forced-capture instant, so sustained rendering cannot turn a /// request into a timeout — then capture through the compositor's one-shot callback, or @@ -183,31 +202,7 @@ impl LightcraftApp { let img = if shadow_ticked { None } else { self.headless_screenshot(ctx, true) }; shadow_ticked = true; if let Some(img) = img { - let bytes = img.size[0].checked_mul(img.size[1]).and_then(|p| p.checked_mul(std::mem::size_of::())); - match bytes { - Some(bytes) if bytes > shot.reserved => { - // A stale/undersized reservation is not a user error: grow it to the - // actual image and encode it when the per-image and aggregate caps allow. - if let Err(error) = self.grow_shot_reservation(shot.reserved, bytes) { - let _ = shot.reply.send(serde_json::json!({"ok": false, "error": error})); - self.release_shot_bytes(shot.reserved); - continue; - } - shot.reserved = bytes; - } - Some(_) => {} - None => { - let reply = serde_json::json!({ - "ok": false, - "error": "ui.screenshot: the rendered image has invalid dimensions", - }); - let _ = shot.reply.send(reply); - self.release_shot_bytes(shot.reserved); - continue; - } - } - let _ = shot.reply.send(control::save_screenshot(self, &img, shot.target.as_ref())); - self.release_shot_bytes(shot.reserved); + self.finish_headless_shot(&mut shot, &img); continue; } keep.push(shot); diff --git a/crates/ui-egui/src/dialogs/slideshow_export.rs b/crates/ui-egui/src/dialogs/slideshow_export.rs index ed33d0341e..7a898b5db2 100644 --- a/crates/ui-egui/src/dialogs/slideshow_export.rs +++ b/crates/ui-egui/src/dialogs/slideshow_export.rs @@ -132,11 +132,14 @@ pub(super) fn slideshow_export_body(app: &mut LightcraftApp, ui: &mut egui::Ui, mod tests { use super::*; use crate::state::Dialog; + use crate::tests_fixtures::SyntheticLibrary; use std::sync::{Arc, Mutex}; use std::time::{Duration, Instant}; - /// The app with a picker that answers `answer` and remembers what it was asked. - fn app_answering(answer: String) -> (LightcraftApp, Arc>>) { + /// The app, with two real file-backed photos and a picker that answers `answer` and remembers + /// what it was asked. Keep the returned fixture alive until the app is dropped. + fn app_answering(tag: &str, answer: String) -> (SyntheticLibrary, LightcraftApp, Arc>>) { + let files = SyntheticLibrary::with_photos(tag, 2); let asked = Arc::new(Mutex::new(Vec::::new())); let requests = asked.clone(); let services = crate::Services { @@ -148,9 +151,10 @@ mod tests { })), ..Default::default() }; - let mut s = lightcraft_engine::Session::with_demo(); - s.execute("slideshow.playback", &json!({"slideDuration": 1, "fadeDuration": 0.5})).unwrap(); - (LightcraftApp::new(s, services), asked) + let mut app = files.app(); + app.services = services; + app.session.execute("slideshow.playback", &json!({"slideDuration": 1, "fadeDuration": 0.5})).unwrap(); + (files, app, asked) } fn run_dialog(h: &mut crate::headless::Headless) -> Value { @@ -164,7 +168,11 @@ mod tests { if h.app.slideshow_export_reported && h.app.session.slideshow_export.is_some() { break; } - assert!(Instant::now() < deadline, "export did not finish"); + assert!( + Instant::now() < deadline, + "export did not finish: {}", + h.app.session.slideshow_export.as_ref().map_or_else(|| "no export run".into(), |r| r.json().to_string()) + ); std::thread::sleep(Duration::from_millis(5)); } let run = h.app.session.slideshow_export.clone().unwrap(); @@ -179,7 +187,7 @@ mod tests { let dir = std::env::temp_dir().join(format!("lc-ui-ssexp-{}", std::process::id())); let _ = std::fs::remove_dir_all(&dir); let path = dir.join("Show.pdf").to_string_lossy().to_string(); - let (mut app, asked) = app_answering(path.clone()); + let (_files, mut app, asked) = app_answering("ssexp", path.clone()); assert!(crate::menus::ui_enabled(&app, "dialog.slideshowExport")); app.run("dialog.slideshowExport", json!({"format": "pdf"})).unwrap(); let Some(Dialog::SlideshowExport { settings }) = app.ui.dialog.as_mut() else { panic!("no slideshow export dialog") }; @@ -202,7 +210,7 @@ mod tests { let dir = std::env::temp_dir().join(format!("lc-ui-ssexp-v-{}", std::process::id())); let _ = std::fs::remove_dir_all(&dir); let path = dir.join("Show.mp4").to_string_lossy().to_string(); - let (mut app, asked) = app_answering(path.clone()); + let (_files, mut app, asked) = app_answering("ssexp-v", path.clone()); app.run("dialog.slideshowExport", json!({"format": "video"})).unwrap(); let Some(Dialog::SlideshowExport { settings }) = app.ui.dialog.as_mut() else { panic!("no dialog") }; assert_eq!((settings.size, settings.fps, settings.container.as_str()), (720, 30, "mp4")); @@ -215,7 +223,7 @@ mod tests { assert!(r["sawRow"].as_bool().unwrap(), "the export showed in the activity stack"); assert!(std::path::Path::new(&path).is_file()); // JPEG: a save dialog names the folder (no file type) - let (mut app, asked) = app_answering(dir.join("Frames").to_string_lossy().to_string()); + let (_files_jpeg, mut app, asked) = app_answering("ssexp-jpeg", dir.join("Frames").to_string_lossy().to_string()); app.run("app.slideshowExport", json!({"format": "jpeg", "size": 64})).unwrap(); assert!(asked.lock().unwrap()[0].filter.is_none()); let _ = std::fs::remove_dir_all(&dir); diff --git a/crates/ui-egui/src/drop_overlay.rs b/crates/ui-egui/src/drop_overlay.rs index 8be75ee888..dfe8262c8c 100644 --- a/crates/ui-egui/src/drop_overlay.rs +++ b/crates/ui-egui/src/drop_overlay.rs @@ -32,13 +32,15 @@ fn lines(app: &LightcraftApp, paths: Vec, unknown: bool) -> Vec } let drop = classify(paths); let mut out = Vec::new(); - if !drop.models.is_empty() { - out.push(crate::i18n::tr("Drop to open the face model").to_string()); - } let plural = |n: usize| if n == 1 { "" } else { "s" }; // no library open yet (desktop: the web build's drops import into its session as before): - // photos wait for the library chosen, presets are refused (the drop handler does the same) + // photos wait for the library chosen, presets and models are refused (the drop handler does the same) let waiting = crate::panels::library_problem::holds_drops(app) && !cfg!(target_arch = "wasm32"); + if !drop.models.is_empty() && waiting { + out.push(crate::i18n::tr("Open a library first, then drop the model again").to_string()); + } else if !drop.models.is_empty() { + out.push(crate::i18n::tr("Drop to open the face model").to_string()); + } if !drop.presets.is_empty() && waiting { out.push(crate::i18n::tr("Open a library first, then drop the presets again").to_string()); } else if !drop.presets.is_empty() { @@ -69,9 +71,11 @@ fn lines(app: &LightcraftApp, paths: Vec, unknown: bool) -> Vec /// Veil and card while files are dragged over the window. pub fn show(app: &LightcraftApp, ctx: &Context) { - // This card is an `Order::Tooltip` layer, above the prompt's Foreground window. While a prompt - // owns input the drag can only be background noise: do not paint over or register it. - if crate::panels::notices::blocks_input(app) { + // This card is an `Order::Tooltip` layer, above the prompt's or blocking library window's + // Foreground layer (and any dialog that holds a no-library window's drops). While input is + // owned the drag can only be background noise: do not paint over or register it, or the card + // would promise a drop the barrier is holding back. + if crate::panels::notices::blocks_input(app) || crate::panels::library_problem::blocks_file_drops(app) { return; } let count = ctx.input(|i| i.raw.hovered_files.len()); diff --git a/crates/ui-egui/src/headless/tests.rs b/crates/ui-egui/src/headless/tests.rs index 80d559efc8..f38ed636ae 100644 --- a/crates/ui-egui/src/headless/tests.rs +++ b/crates/ui-egui/src/headless/tests.rs @@ -690,6 +690,14 @@ fn adding_a_face_model_shows_its_terms_and_installs_only_once_accepted() { assert_eq!(r["ok"], true, "{r}"); h.step(); assert!(matches!(&h.app.ui.dialog, Some(Dialog::FaceModel { accepted: true, .. }))); + // Consent is accepted, but no model is installed until confirmation. Keep this UI + // fixture on the CPU so it does not start an unrelated background GPU probe. + let models = dir.join("models"); + std::fs::create_dir_all(&models).unwrap(); + std::fs::write(models.join("settings.json"), br#"{"cpuOnly":true}"#).unwrap(); + assert_eq!(h.app.session.execute("faces.gpu", &json!({})).unwrap()["cpuOnly"], true); + let before_confirm = h.app.session.execute("faces.models.list", &json!({})).unwrap(); + assert!(before_confirm["models"].as_array().unwrap().iter().all(|m| m["installed"] != true), "{before_confirm}"); let r = h.request("ui.dialog.confirm", json!({}), t); assert_eq!(r["ok"], true, "{r}"); let listed = h.app.run("faces.models.list", json!({})).unwrap(); @@ -798,7 +806,13 @@ fn people_and_the_name_box_offer_to_set_face_recognition_up() { let dir = std::env::temp_dir().join(format!("lc-ui-facesetup-{}", std::process::id())); let _ = std::fs::remove_dir_all(&dir); std::fs::create_dir_all(&dir).unwrap(); - h.app.session.face_models_dir = Some(dir.join("models")); + // The setup offer tests recognition controls, not GPU attachment. Seed only this + // fixture's settings before any model can load, without detaching a shared detector. + let models = dir.join("models"); + std::fs::create_dir_all(&models).unwrap(); + std::fs::write(models.join("settings.json"), br#"{"cpuOnly":true}"#).unwrap(); + h.app.session.face_models_dir = Some(models); + assert_eq!(h.app.session.execute("faces.gpu", &json!({})).unwrap()["cpuOnly"], true); let runtime = h.app.session.execute("faces.models.list", &json!({})).unwrap()["runtime"] == true; let id = h.app.session.active().unwrap(); let mut meta = h.app.session.catalog.photo(id).unwrap().meta.clone(); @@ -1244,14 +1258,29 @@ fn a_screenful_of_small_faces_is_not_evicted_and_left_blank() { } // the smallest faces, so a lot of them fit on the screen h.request("ui.set", json!({"thumbSize": 90.0, "view": "people"}), t); - h.settle(SETTLE); + // Lay out the faces before waiting for their workers; a global settle also waits for + // unrelated work and hides a timed-out initial wait. + for _ in 0..4 { + h.step(); + } h.step(); let drawn = h.request("ui.widgets", json!({"filter": "unnamed-face:"}), t)["result"].as_array().map_or(0, Vec::len); assert!(drawn > 96, "the test needs more faces on screen than the usual budget, got {drawn}"); // the pictures are made and kept, well beyond the old budget (a few demo photos share a scene, so two faces can share a // picture: the count is a little under the number of tiles) let started = Instant::now(); - while h.app.renderer.variant_textures() < drawn - 20 && started.elapsed() < Duration::from_secs(60) { + let timeout = Duration::from_secs(300); + while h.app.renderer.variant_textures() < drawn - 20 { + let left = timeout.saturating_sub(started.elapsed()); + assert!( + !left.is_zero(), + "variant renders did not finish: {} pictures for {drawn} faces, pending {:?}", + h.app.renderer.variant_textures(), + h.app.renderer.pending_slots() + ); + // Coverage instrumentation makes the procedural scenes expensive. Wait for actual + // worker progress instead of continuously rebuilding a full People-view frame. + h.app.renderer.wait_for_worker(left.min(Duration::from_millis(250))); h.step(); std::thread::sleep(Duration::from_millis(20)); } @@ -2356,8 +2385,7 @@ fn click_field_in_view(h: &mut Headless, key: &str, timeout: Duration) { /// accessibility and place fields reach the photo. #[test] fn info_fields_keep_typing_and_save() { - // (tall enough for the place fields to show without scrolling) - let mut h = demo([1300.0, 1200.0]); + let mut h = demo([1300.0, 1000.0]); let t = Duration::from_secs(10); h.request("ui.set", json!({"view": "detail", "right": "info"}), t); h.settle(SETTLE); diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 8da88f9aea..9db7035c1d 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -43,6 +43,8 @@ pub mod window_place; mod tests; #[cfg(test)] use tests::panels as tests_panels; +#[cfg(test)] +use tests::{fixtures as tests_fixtures, render_fixtures as tests_render_fixtures}; use std::sync::mpsc::{Receiver, Sender}; @@ -191,6 +193,10 @@ pub struct LightcraftApp { slideshow_auto_paused: bool, /// Files dropped since the last UI pass, consumed exactly once by the UI phase. dropped_files: Vec, + /// Prefix of `dropped_files` that arrived behind a prompt, library window or its picker. + /// Preserve only this prefix through subsequent dialogs/imports; later arrivals still take + /// the ordinary refusal path unless they too arrive while the original barrier is up. + deferred_dropped_file_count: usize, /// A synthetic batch was injected into a pass and has not been consumed by a completed /// (nondiscarded) UI pass yet: a hidden logic tick must not inject another one. synthetic_in_flight: bool, diff --git a/crates/ui-egui/src/panels/detail.rs b/crates/ui-egui/src/panels/detail.rs index 25f3baa240..eee9d7d0c2 100644 --- a/crates/ui-egui/src/panels/detail.rs +++ b/crates/ui-egui/src/panels/detail.rs @@ -184,13 +184,16 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { _ => vec![area], }; let main_area = *areas.last().unwrap_or(&area); + // A previous crop/rotation can stay visible while its replacement renders. Its pixels + // must not override the current frame geometry, even when it is the same photo. + let current_texture = |t: &&crate::render::Tex| t.photo == id && t.look == Some((crate::render::geometry_look(&d), !crop_tool)); let visible_texture_aspect = app .renderer .textures .get(&Slot::Main) - .filter(|t| t.photo == id) - .or_else(|| app.renderer.textures.get(&Slot::Preview).filter(|t| t.photo == id)) - .or_else(|| app.renderer.thumb(id)) + .filter(current_texture) + .or_else(|| app.renderer.textures.get(&Slot::Preview).filter(current_texture)) + .or_else(|| app.renderer.thumb(id).filter(current_texture)) .map(|tex| tex.size[0].max(1) as f32 / tex.size[1].max(1) as f32); // Follow the texture only where it really differs (an unsupported raw's embedded JPEG with // another crop): a texture's whole-pixel size is a little off the exact aspect, and the crop diff --git a/crates/ui-egui/src/panels/grid.rs b/crates/ui-egui/src/panels/grid.rs index c36feadf84..262979cc5f 100644 --- a/crates/ui-egui/src/panels/grid.rs +++ b/crates/ui-egui/src/panels/grid.rs @@ -710,6 +710,15 @@ pub fn request_thumb(app: &mut LightcraftApp, id: PhotoId, size: usize, priority { return; } + // Several cells can show one photo at different sizes (a print page's cells). Before any + // thumbnail arrives, a caller at another bucket would replace the pending request every frame + // and restart it, so none of them ever gets a picture: keep the request in flight. A higher + // priority caller may take it over once; the caller it replaced then coalesces behind it. + if let Some(photo) = app.session.catalog.photo(id) + && app.renderer.thumb_pending_other_bucket(photo, bucket, priority) + { + return; + } let Some(job) = app.session.thumb_job(id, size) else { return }; #[cfg(test)] { @@ -722,9 +731,9 @@ pub fn request_thumb(app: &mut LightcraftApp, id: PhotoId, size: usize, priority quick.is_some() && app.session.catalog.photo(id).is_some_and(|p| skips_the_real_render(app.session.embedded_thumb_is_final(p), true)); if let Some(photo) = app.session.catalog.photo(id) { if embedded_is_final { - app.renderer.remember_embedded_thumb(photo, bucket, job.key); + app.renderer.remember_embedded_thumb(photo, bucket, job.key, priority); } else { - app.renderer.remember_thumb(photo, bucket, job.key, quick.is_some()); + app.renderer.remember_thumb(photo, bucket, job.key, quick.is_some(), priority); } } match quick { diff --git a/crates/ui-egui/src/panels/library_problem.rs b/crates/ui-egui/src/panels/library_problem.rs index 31128e9a9f..544e29449a 100644 --- a/crates/ui-egui/src/panels/library_problem.rs +++ b/crates/ui-egui/src/panels/library_problem.rs @@ -733,6 +733,30 @@ pub fn holds_drops(app: &LightcraftApp) -> bool { app.session.library.is_none() && app.library_problem.as_ref().is_some_and(|p| !p.dismissed) } +/// Whether the blocking library window must hold file drops back. While a library is already +/// open, that window (the launch list over it, or the error of a failed switch) owns input: +/// importing a drop now would add photos, presets or a model dialog behind it. With no library +/// open, the desktop drop handler's [`hold_dropped`] path takes the photos for the library the +/// window opens instead, so the drop still has to be consumed. +/// +/// The launch list hides itself behind its own New Library name prompt (`chooser_owns_dialog`). +/// It still owns the library then: a queued drop must wait for the prompt to close, not be taken +/// and refused by the drop handler's generic open-dialog check. After the prompt, New Library and +/// Open Another… ask for a folder on the host's asynchronous picker; the library opens only when +/// that answer arrives, so the queued drop waits too. With no library open a dialog (or a library +/// picker that will open one) in front of the window would otherwise refuse the drop or consume it +/// before the photos could reach [`hold_dropped`]. +pub fn blocks_file_drops(app: &LightcraftApp) -> bool { + if app.library_problem.as_ref().is_none_or(|p| p.dismissed) { + return false; + } + if app.session.library.is_none() { + let choosing = app.pending_picks.iter().any(|p| p.command == "app.newLibrary" || p.command == "app.openLibrary"); + return app.ui.dialog.is_some() || choosing; + } + true +} + /// Photos dropped on the window while no library is open (the launch list, or the window of a /// library that failed to open): kept with the command line's files and imported once a library /// opens, instead of going into the session the next library replaces. Gives the photos back when diff --git a/crates/ui-egui/src/render.rs b/crates/ui-egui/src/render.rs index 31117b22ef..98356afb7d 100644 --- a/crates/ui-egui/src/render.rs +++ b/crates/ui-egui/src/render.rs @@ -66,7 +66,23 @@ pub enum Slot { HdrHistogram, } +/// Settings that can change the rendered frame. Colour-only edits, including temporarily +/// hidden grading wheels, must not discard a decoded RAW's actual aspect ratio. +pub(crate) fn geometry_look(settings: &lightcraft_develop::DevelopSettings) -> u64 { + let geometry = lightcraft_develop::DevelopSettings { + crop: settings.crop, + orientation: settings.orientation, + geometry: settings.geometry.clone(), + optics: settings.optics, + disabled_sections: settings.disabled_sections.iter().filter(|s| matches!(s.as_str(), "geometry" | "optics")).cloned().collect(), + ..Default::default() + }; + geometry.hash64() +} + pub struct Tex { + /// Frame geometry and crop mode captured when these pixels were requested. + pub look: Option<(u64, bool)>, pub key: u64, pub photo: PhotoId, pub tex: egui::TextureHandle, @@ -93,12 +109,14 @@ pub trait RenderOffload { /// worker (`None` for prefetches and failures). A 10 MP zoom window's conversion took a few ms of /// the UI thread on every slider step. struct Finished { + look: Option<(u64, bool)>, result: RenderResult, color: Option>, } /// Immutable identity captured when a request is submitted, not when its result is collected. struct Requested { + look: Option<(u64, bool)>, id: u64, source: Option, } @@ -190,6 +208,8 @@ pub struct Renderer { #[cfg(test)] pub(crate) thumb_jobs_built: usize, requests: HashMap, + /// Only jobs actually accepted by an offload: queued replacements retain identity in the job. + offload_looks: HashMap, #[cfg(test)] failure_messages: Vec, /// Request id of the pixels each interactive view (loupe, before, hover) shows: a draft that @@ -200,8 +220,9 @@ pub struct Renderer { epoch: u64, preview_generation: Option<(std::sync::Weak, u64)>, /// Last thumbnail inputs; weak identities do not retain photo histories or force deep clones. - /// (photo, size bucket, job key, whether the request went through an embedded stand-in) - thumb_inputs: HashMap, usize, u64, bool)>, + /// (photo, size bucket, job key, whether the request went through an embedded stand-in, and the + /// priority of the caller that queued it — a stand-in's background render runs below that) + thumb_inputs: HashMap, usize, u64, bool, u32)>, /// Photos whose grid thumbnail is the camera's embedded preview itself (no render behind it). embedded_thumbs: HashMap, usize, u64)>, pool: JobPool, @@ -283,6 +304,7 @@ impl Renderer { #[cfg(test)] thumb_jobs_built: 0, requests: HashMap::new(), + offload_looks: HashMap::new(), #[cfg(test)] failure_messages: Vec::new(), shown_ids: HashMap::new(), @@ -323,11 +345,27 @@ impl Renderer { impl Renderer { /// Would asking for this thumbnail again (at `priority`) change nothing? pub fn thumb_current(&self, photo: &Arc, bucket: usize, priority: u32) -> bool { - let Some(&(ref old, size, key, quick)) = self.thumb_inputs.get(&photo.id) else { return false }; - if old.as_ptr() != Arc::as_ptr(photo) || size != bucket { + let Some(&(ref old, size, key, quick, _)) = self.thumb_inputs.get(&photo.id) else { return false }; + if old.as_ptr() != Arc::as_ptr(photo) { return false; } let slot = Slot::Thumb(photo.id); + if size > bucket { + // A larger thumbnail that has already arrived for this photo and settings serves a + // smaller cell too (cells at different sizes share one photo). Asking for the smaller + // bucket would replace the larger picture, and the larger cell would then ask for its + // bucket back on the next frame: two print cells would alternate renders forever. + // The photo identity above is the renderer's `Weak`: `Catalog` edits through + // `Arc::make_mut`, which (per std) moves the value to a new allocation whenever a + // `Weak` exists, even with one strong reference. An edit therefore breaks this match, + // and the key keeps an older picture of the same allocation from being reused. A + // larger request still renders once (below), and while it is in flight + // [`Self::thumb_pending_other_bucket`] holds the smaller callers. + return self.textures.get(&slot).is_some_and(|t| t.key == key); + } + if size != bucket { + return false; + } if quick && !self.textures.contains_key(&slot) { // Stand-in path (`grid::request_thumb`): the embedded preview is still on its way, or // the real thumbnail is requested at the background priority whatever the caller's. @@ -346,16 +384,30 @@ impl Renderer { /// Whether the camera's embedded preview *is* this photo's thumbnail: its quick render arrived /// (so `Slot::ThumbQuick` holds the picture) and no edit has moved the photo on to a settings /// hash of its own. The grid stops here instead of decoding the raw behind a thumbnail the - /// embedded JPEG already covers — see `grid::skips_the_real_render`. + /// embedded JPEG already covers — see `grid::skips_the_real_render`. A preview that arrived at + /// a larger bucket and is still held is final for a smaller cell too, so print cells at + /// different sizes do not replace it every frame. pub fn thumb_quick_is_final(&self, photo: &Arc, bucket: usize, priority: u32) -> bool { let Some((old, size, key)) = self.embedded_thumbs.get(&photo.id) else { return false }; - old.as_ptr() == Arc::as_ptr(photo) && *size == bucket && !self.request_needed(Slot::ThumbQuick(photo.id), *key, priority) + if old.as_ptr() != Arc::as_ptr(photo) || *size < bucket { + return false; + } + let slot = Slot::ThumbQuick(photo.id); + if *size > bucket { + // A larger preview serves a smaller cell only when its pixels are actually here for + // the recorded key. The same-bucket failure memoization below says "no" after a failed + // job, but a missing larger preview is not a final picture: the smaller cell must ask + // for its own bucket rather than stay blank until the catalog revision changes. + return self.textures.get(&slot).is_some_and(|t| t.key == *key); + } + // The requested bucket itself: keep the failure memoization (`failed`) unchanged. + !self.request_needed(slot, *key, priority) } /// Whether this photo's embedded-preview thumbnail is pending at the requested priority, or /// already running. A queued priority change must reach the grid's stand-in request. pub fn thumb_quick_pending(&self, photo: &Arc, bucket: usize, priority: u32) -> bool { - let Some((old, size, key, quick)) = self.thumb_inputs.get(&photo.id) else { return false }; + let Some((old, size, key, quick, _)) = self.thumb_inputs.get(&photo.id) else { return false }; let slot = Slot::ThumbQuick(photo.id); old.as_ptr() == Arc::as_ptr(photo) && *size == bucket @@ -364,10 +416,44 @@ impl Renderer { && !self.request_needed(slot, *key, priority.saturating_add(1)) } + /// Whether a request for this photo's thumbnail is already in flight at another bucket and a + /// caller asking at `bucket` should leave it there. Several cells can show one photo at + /// different sizes at once (a print page's cells), and replacing `Slot::Thumb(id)` from each of + /// them every frame restarts the render, so none of them ever gets a picture. + /// + /// A caller with a higher priority than the one that queued the request takes it over once; + /// from then on the original caller coalesces behind that higher priority instead of replacing + /// it back. Equal priorities keep the request that is in flight (the print cells' case). This + /// only chooses which pending bucket survives; after it completes, a larger bucket is reused by + /// smaller callers ([`Self::thumb_current`]) rather than being replaced every frame. + /// + /// A full render queued behind a stand-in is submitted at [`crate::panels::grid::BACKGROUND_THUMB_PRIORITY`], + /// deliberately below an on-screen caller. That is not the caller's priority, so the comparison + /// uses the priority recorded with the inputs: comparing the background slot's own priority + /// would let two buckets keep replacing each other's background render every frame. + /// + /// A photo that changed (another `Arc`) or a texture for the recorded job key is not + /// coalesced: its callers ask for their own bucket as before. A stale texture from before an + /// edit does not count — it is still displayed while the replacement renders, and comparing + /// the key (not presence) keeps coalescing across buckets in the meantime. + pub fn thumb_pending_other_bucket(&self, photo: &Arc, bucket: usize, priority: u32) -> bool { + let Some(&(ref old, size, key, _, requested_priority)) = self.thumb_inputs.get(&photo.id) else { return false }; + if old.as_ptr() != Arc::as_ptr(photo) || size == bucket { + return false; + } + if self.textures.get(&Slot::Thumb(photo.id)).is_some_and(|t| t.key == key) { + return false; + } + // (the inputs must belong to the request still in flight, not to one that already ended) + let in_flight = self.pending.get(&Slot::ThumbQuick(photo.id)).is_some_and(|p| p.0 == key) + || self.pending.get(&Slot::Thumb(photo.id)).is_some_and(|p| p.0 == key); + in_flight && requested_priority >= priority + } + /// Remember that the camera's embedded preview is this photo's final thumbnail, so the grid's /// per-frame requests stop at it (the quick render's key, which [`Self::thumb_quick_is_final`] /// compares against). - pub fn remember_embedded_thumb(&mut self, photo: &Arc, bucket: usize, key: u64) { + pub fn remember_embedded_thumb(&mut self, photo: &Arc, bucket: usize, key: u64, priority: u32) { let slot = Slot::Thumb(photo.id); if self.pending.get(&slot).is_some_and(|(pending_key, _)| *pending_key != key) { // An edit can still be rendering when Undo restores this embedded-final thumbnail. @@ -377,20 +463,20 @@ impl Renderer { self.pool.reprioritize(|s, p| if *s == slot { None } else { Some(p) }); self.queue.retain(|q| q.slot != slot); } - self.remember_thumb(photo, bucket, key, true); + self.remember_thumb(photo, bucket, key, true, priority); self.embedded_thumbs.insert(photo.id, (Arc::downgrade(photo), bucket, key)); } - pub fn remember_thumb(&mut self, photo: &Arc, bucket: usize, key: u64, quick: bool) { + pub fn remember_thumb(&mut self, photo: &Arc, bucket: usize, key: u64, quick: bool, priority: u32) { if self.thumb_inputs.len() >= 1024 && !self.thumb_inputs.contains_key(&photo.id) { - self.thumb_inputs.retain(|_, (p, _, _, _)| p.strong_count() > 0); + self.thumb_inputs.retain(|_, (p, _, _, _, _)| p.strong_count() > 0); if self.thumb_inputs.len() >= 1024 && let Some(id) = self.thumb_inputs.keys().next().copied() { self.thumb_inputs.remove(&id); } } - self.thumb_inputs.insert(photo.id, (Arc::downgrade(photo), bucket, key, quick)); + self.thumb_inputs.insert(photo.id, (Arc::downgrade(photo), bucket, key, quick, priority)); } /// Views that render straight into the display profile's primaries (wide gamut); everything @@ -442,7 +528,7 @@ impl Renderer { lightcraft_engine::display::present(&mut r, d); } let color = r.rendered.as_ref().ok().map(|x| Arc::new(color_image(&x.image))); - Finished { result: r, color } + Finished { look: None, result: r, color } } fn request_needed(&self, slot: Slot, key: u64, priority: u32) -> bool { @@ -491,7 +577,10 @@ impl Renderer { } self.pending.insert(slot, (job.key, priority)); job.request_id = lightcraft_preview::next_tick(); - self.requests.insert(slot, Requested { id: job.request_id, source: Some(job.origin.clone()) }); + self.requests.insert( + slot, + Requested { look: Some((geometry_look(&job.settings), job.request.apply_crop)), id: job.request_id, source: Some(job.origin.clone()) }, + ); // (an offload keeps its own per-view stage caches; the flag tells it to) let job = if slot.is_view() { job.with_stages(self.stages.entry(slot).or_default().clone()) } else { job }; if self.offload.is_some() { @@ -509,8 +598,9 @@ impl Renderer { key, priority, Box::new(move || { + let look = Some((geometry_look(&job.settings), job.request.apply_crop)); let run = || if background { lightcraft_engine::memory::in_background(|| job.run()) } else { job.run() }; - Self::run_for(run, &display) + Finished { look, ..Self::run_for(run, &display) } }), ); } @@ -544,7 +634,10 @@ impl Renderer { .as_ref() .map(|job| job.origin.clone()) .or_else(|| job.embedded.as_ref().map(|(path, _, _)| lightcraft_catalog::Source::File { path: path.clone() })); - self.requests.insert(slot, Requested { id: job.request_id, source }); + self.requests.insert( + slot, + Requested { look: job.small.as_ref().map(|j| (geometry_look(&j.settings), j.request.apply_crop)), id: job.request_id, source }, + ); let key = job.key; let display = self.display.clone(); self.pool.submit(slot, key, priority, Box::new(move || Self::run_for(|| job.run(), &display))); @@ -563,7 +656,7 @@ impl Renderer { } self.pending.insert(slot, (key, priority)); let request_id = lightcraft_preview::next_tick(); - self.requests.insert(slot, Requested { id: request_id, source: None }); + self.requests.insert(slot, Requested { look: None, id: request_id, source: None }); let display = self.display.clone(); self.pool.submit(slot, key, priority, Box::new(move || Self::run_for(|| compose.result(request_id), &display))); } @@ -577,13 +670,16 @@ impl Renderer { self.prefetched.insert(slot, job.key); self.pending.insert(slot, (job.key, priority)); job.request_id = lightcraft_preview::next_tick(); - self.requests.insert(slot, Requested { id: job.request_id, source: Some(job.origin.clone()) }); + self.requests.insert( + slot, + Requested { look: Some((geometry_look(&job.settings), job.request.apply_crop)), id: job.request_id, source: Some(job.origin.clone()) }, + ); let key = job.key; self.pool.submit( slot, key, priority, - Box::new(move || Finished { result: lightcraft_engine::memory::in_background(|| job.run()), color: None }), + Box::new(move || Finished { look: None, result: lightcraft_engine::memory::in_background(|| job.run()), color: None }), ); } @@ -608,6 +704,7 @@ impl Renderer { /// Drop every texture and cached stage (another library was opened: photo ids changed meaning). pub fn forget_all(&mut self) { self.requests.clear(); + self.offload_looks.clear(); self.shown_ids.clear(); self.epoch = lightcraft_preview::next_tick(); self.preview_generation = None; @@ -653,10 +750,12 @@ impl Renderer { let Some(off) = self.offload.as_mut() else { return }; while let Some(i) = self.queue.iter().enumerate().max_by_key(|(_, q)| (q.priority, q.seq)).map(|(i, _)| i) { let q = self.queue.swap_remove(i); + let identity = (q.job.request_id, (geometry_look(&q.job.settings), q.job.request.apply_crop)); if let Some(job) = off.try_start(q.slot, q.job) { self.queue.push(Queued { job, ..q }); break; } + self.offload_looks.insert(identity.0, identity.1); } } @@ -665,6 +764,22 @@ impl Renderer { self.pending.len() } + /// Requests queued or running, excluding background preparation of neighbouring photos. + pub fn in_flight_without_prefetch(&self) -> usize { + self.pending.keys().filter(|slot| !matches!(slot, Slot::Prefetch(_))).count() + } + + /// Yield to native render workers until a result is ready or the timeout expires. + /// The result remains queued for the next poll. Browser and offloaded renderers do not wait. + /// Any native pending job, including prefetch, can satisfy the wait. A zero-worker test pool + /// must run its jobs inline first, or this call can only time out. + pub fn wait_for_worker(&mut self, timeout: std::time::Duration) -> bool { + if cfg!(target_arch = "wasm32") || self.offload.is_some() || self.pending.is_empty() { + return false; + } + self.pool.wait(timeout) + } + /// Test seam: make the renderer look busy without starting a job (capture deadlines). #[cfg(test)] pub(crate) fn force_in_flight_for_test(&mut self, count: usize) { @@ -832,14 +947,17 @@ impl Renderer { fn collect(&mut self, ctx: &egui::Context, session: &mut Session, inline_ms: f64) -> bool { let mut finished = Vec::new(); while let Some(done) = self.pool.try_recv() { - finished.push((done.slot, done.result.result, done.result.color, if done.ms > 0.0 { done.ms } else { inline_ms })); + finished.push((done.slot, done.result.result, done.result.color, done.result.look, if done.ms > 0.0 { done.ms } else { inline_ms })); } if let Some(off) = self.offload.as_mut() { - finished.extend(off.finished().into_iter().map(|(slot, r, ms)| (slot, r, None, ms))); + finished.extend(off.finished().into_iter().map(|(slot, r, ms)| { + let look = self.offload_looks.remove(&r.request_id); + (slot, r, None, look, ms) + })); } self.dispatch(); let mut changed = false; - for (mut slot, mut r, mut color, ms) in finished { + for (mut slot, mut r, mut color, completed_look, ms) in finished { self.completed += 1; // made for another display profile than the one in use: obsolete if r.display.is_some_and(|id| Some(id) != self.display_id()) { @@ -849,7 +967,7 @@ impl Renderer { // an interactive view still takes a superseded draft that is newer than what it // shows, and the source it decoded: a drag supersedes every request before it // finishes, and a source thrown away with them is decoded again for every tick. - let source = if self.requests.get(&slot).map(|request| request.id) != Some(r.request_id) { + let (source, look) = if self.requests.get(&slot).map(|request| request.id) != Some(r.request_id) { let newer_draft = slot.is_view() && self.requests.contains_key(&slot) && r.request_id >= self.epoch @@ -860,11 +978,13 @@ impl Renderer { continue; } session.accept(&r); - None // superseded successful drafts have no failure diagnostic + (None, completed_look) // retain the geometry of these pixels, never borrow the newer request’s identity } else { - let source = self.requests.remove(&slot).and_then(|request| request.source); + let request = self.requests.remove(&slot); + let look = request.as_ref().and_then(|request| request.look); + let source = request.and_then(|request| request.source); session.accept(&r); - source + (source, look) }; if slot.is_view() { self.shown_ids.insert(slot, r.request_id); @@ -926,6 +1046,7 @@ impl Renderer { Some(t) => { t.tex.set(color, egui::TextureOptions::LINEAR); t.pixels = pixels; + t.look = look; t.key = r.key; t.photo = r.photo; t.size = [img.width, img.height]; @@ -938,6 +1059,7 @@ impl Renderer { self.textures.insert( slot, Tex { + look, key: r.key, photo: r.photo, tex, @@ -1089,7 +1211,10 @@ mod stage_budget_tests { let ctx = egui::Context::default(); let mut r = Renderer::default(); let tex = ctx.load_texture("window", egui::ColorImage::new([1, 1], vec![egui::Color32::BLACK]), Default::default()); - r.textures.insert(Slot::Region, Tex { key: 1, photo: PhotoId(1), tex, size: [1, 1], histogram: None, ms: 0.0, quick: None, pixels: None }); + r.textures.insert( + Slot::Region, + Tex { look: None, key: 1, photo: PhotoId(1), tex, size: [1, 1], histogram: None, ms: 0.0, quick: None, pixels: None }, + ); let long_ago = std::time::Instant::now().checked_sub(IDLE_TRIM * 2).unwrap(); r.idle = Some((long_ago, false)); r.trim_when_idle(&ctx); diff --git a/crates/ui-egui/src/render/thumbnail_tests.rs b/crates/ui-egui/src/render/thumbnail_tests.rs index 984ce0462d..eaf4e8f2ff 100644 --- a/crates/ui-egui/src/render/thumbnail_tests.rs +++ b/crates/ui-egui/src/render/thumbnail_tests.rs @@ -35,13 +35,37 @@ impl RenderOffload for Blocked { fn photo() -> Arc { Arc::new(Photo::new(PhotoId(1), Source::File { path: "audit.jpg".into() }, "audit.jpg", "JPEG", 6000, 4000, "2026-01-01")) } + +#[test] +fn capture_readiness_excludes_prefetch_but_keeps_photo_and_thumbnail_work() { + let p = photo(); + let mut session = Session::new(); + session.catalog.apply(Op::AddPhoto { photo: Box::new((*p).clone()) }).unwrap(); + // Keep real requests queued without starting native workers. + let mut renderer = Renderer { pool: JobPool::new(0), ..Default::default() }; + renderer.prefetch(Slot::Prefetch(0), session.thumb_job(p.id, 384).unwrap(), 1); + renderer.prefetch(Slot::Prefetch(1), session.thumb_job(p.id, 384).unwrap(), 1); + assert_eq!(renderer.in_flight(), 2); + assert_eq!(renderer.in_flight_without_prefetch(), 0); + for (index, slot) in [Slot::Main, Slot::Thumb(p.id), Slot::Variant(7), Slot::Preview, Slot::ThumbQuick(p.id)].into_iter().enumerate() { + renderer.request(slot, session.thumb_job(p.id, 384).unwrap(), 10); + assert_eq!(renderer.in_flight_without_prefetch(), index + 1); + assert_eq!(renderer.in_flight(), index + 3); + } + assert_eq!(renderer.pool.run_inline(7), 7); + // Waiting observes a completed job without swallowing the result needed by poll. + assert!(renderer.wait_for_worker(std::time::Duration::ZERO)); + renderer.poll(&egui::Context::default(), &mut session); + assert_eq!(renderer.in_flight_without_prefetch(), 0); + assert_eq!(renderer.in_flight(), 0); +} #[test] fn snapshot_tracks_cow_edits_undo_reload_and_replacement() { let mut catalog = Catalog::default(); catalog.apply(Op::AddPhoto { photo: Box::new((*photo()).clone()) }).unwrap(); let old = catalog.photo(PhotoId(1)).unwrap().clone(); let mut r = Renderer::default(); - r.remember_thumb(&old, 384, 77, false); + r.remember_thumb(&old, 384, 77, false, 10); r.pending.insert(Slot::Thumb(PhotoId(1)), (77, 10)); assert!(r.thumb_current(&old, 384, 10)); assert!(!r.thumb_current(&old, 512, 10)); @@ -77,7 +101,7 @@ fn queue_promotions_running_work_and_cancellation() { let key = job.key; let mut r = Renderer::default(); r.set_offload(Box::new(Blocked)); - r.remember_thumb(&p, 384, key, false); + r.remember_thumb(&p, 384, key, false, 5); r.request(slot, job, 5); assert!(r.thumb_current(&p, 384, 5)); assert!(!r.thumb_current(&p, 384, 10)); @@ -110,7 +134,7 @@ fn queued_standin_promotes_from_prefetch_to_visible_without_restarting() { let slot = Slot::ThumbQuick(p.id); // Deterministic queue: no native worker starts. let mut r = Renderer { pool: JobPool::new(0), ..Default::default() }; - r.remember_thumb(&p, 384, quick.key, true); + r.remember_thumb(&p, 384, quick.key, true, 5); r.request_quick(slot, quick.clone(), 6); // grid prefetch: 5 + 1 r.request_quick(Slot::ThumbQuick(PhotoId(2)), other, 9); // filmstrip: 8 + 1 let request_id = r.requests[&slot].id; @@ -138,7 +162,7 @@ fn queued_standin_demotes_when_it_leaves_the_visible_grid() { let (_, other) = queued_quick_thumbnail(PhotoId(2)); let slot = Slot::ThumbQuick(p.id); let mut r = Renderer { pool: JobPool::new(0), ..Default::default() }; - r.remember_thumb(&p, 384, quick.key, true); + r.remember_thumb(&p, 384, quick.key, true, 10); r.request_quick(slot, quick.clone(), 11); r.request_quick(Slot::ThumbQuick(PhotoId(2)), other, 9); assert!(!r.thumb_current(&p, 384, 5)); @@ -153,7 +177,7 @@ fn failures_retry_after_revision_and_quick_only_is_not_final() { let p = photo(); let slot = Slot::Thumb(p.id); let mut r = Renderer::default(); - r.remember_thumb(&p, 384, 77, false); + r.remember_thumb(&p, 384, 77, false, 10); r.pending.insert(Slot::ThumbQuick(p.id), (77, 11)); assert!(!r.thumb_current(&p, 384, 10)); r.failed.insert(slot, (77, "no decoder".into(), 0, p.id)); @@ -164,6 +188,36 @@ fn failures_retry_after_revision_and_quick_only_is_not_final() { assert!(!r.thumb_current(&p, 384, 10)); } +/// A larger texture only serves a smaller bucket when it is the recorded request's picture. +/// This isolates the key guard: under a `contains_key`-only check the first assertion below +/// would return `true`. +#[test] +fn larger_texture_for_another_key_does_not_count_as_current() { + let p = photo(); + let slot = Slot::Thumb(p.id); + let ctx = egui::Context::default(); + let tex = |key| Tex { + look: None, + key, + photo: p.id, + tex: ctx.load_texture(format!("thumb-{key}"), egui::ColorImage::new([1, 1], vec![egui::Color32::BLACK]), Default::default()), + size: [1, 1], + histogram: None, + ms: 0.0, + quick: None, + pixels: None, + }; + let mut r = Renderer::default(); + // A completed larger bucket: the remembered request is bucket 512, key 77. + r.remember_thumb(&p, 512, 77, false, 10); + // Another key's pixels (for example the picture from before an edit) may still be + // displayed, but they are not the remembered request's picture. + r.textures.insert(slot, tex(66)); + assert!(!r.thumb_current(&p, 256, 10), "a mismatched texture key must not serve a smaller bucket"); + r.textures.insert(slot, tex(77)); + assert!(r.thumb_current(&p, 256, 10), "the recorded key's larger texture serves the smaller bucket"); +} + #[test] fn a_fast_draft_is_drawn_in_the_frame_that_asked_for_it() { let mut s = Session::new(); @@ -204,6 +258,15 @@ impl RenderOffload for Manual { fn fixture() -> (crate::LightcraftApp, std::rc::Rc>, egui::Context) { fixture_with(Session::new(), (*photo()).clone()) } +/// An unedited raw: its embedded camera preview is its final thumbnail (the grid's quick path). +fn raw_quick_fixture() -> (crate::LightcraftApp, std::rc::Rc>, egui::Context) { + let mut s = Session::new(); + s.media.preview_loader = Some(Arc::new(|_, _| Some(lightcraft_raster::Rgba8 { width: 4, height: 4, data: vec![[200, 100, 50, 255]; 16] }))); + let mut raw = (*photo()).clone(); + raw.kind = lightcraft_catalog::MediaKind::Raw; + raw.develop = Arc::new(raw.camera_defaults()); + fixture_with(s, raw) +} fn fixture_with(mut s: Session, photo: Photo) -> (crate::LightcraftApp, std::rc::Rc>, egui::Context) { s.media.file_loader = Some(Arc::new(|_, _| { let mut image = lightcraft_raster::Rgb32f::new(8, 8); @@ -538,16 +601,65 @@ fn loupe_shows_superseded_drafts_newer_than_its_pixels_during_a_drag() { let keys: Vec = jobs.iter().map(|j| j.key).collect(); let mut jobs = jobs.into_iter(); let (first, second, last) = (jobs.next().unwrap(), jobs.next().unwrap(), jobs.next().unwrap()); - // the first draft lands while the newest is still rendering: the loupe moves on - finish(&mut app, &work, &ctx, Slot::Main, first.run()); + // A decoded embedded preview can differ from the catalog's square metadata. Its + // superseded colour-only draft must retain the identity that enables aspect correction. + let mut first_result = first.run(); + first_result.rendered.as_mut().unwrap().image = lightcraft_raster::Rgba8::new(8, 4); + finish(&mut app, &work, &ctx, Slot::Main, first_result); + assert_eq!(app.renderer.textures[&Slot::Main].size, [8, 4]); assert_eq!(app.renderer.textures.get(&Slot::Main).map(|t| t.key), Some(keys[0])); assert!(app.renderer.is_pending(Slot::Main)); + assert_eq!( + app.renderer.textures[&Slot::Main].look, + Some((geometry_look(&lightcraft_develop::DevelopSettings::default()), true)), + "colour-only superseded pixels retain their geometry" + ); + let current_look = geometry_look(&last.settings); finish(&mut app, &work, &ctx, Slot::Main, last.run()); + assert_eq!(app.renderer.textures[&Slot::Main].look, Some((current_look, true))); assert_eq!(app.renderer.textures.get(&Slot::Main).map(|t| t.key), Some(keys[2])); // a draft older than the pixels shown never replaces them finish(&mut app, &work, &ctx, Slot::Main, second.run()); assert_eq!(app.renderer.textures.get(&Slot::Main).map(|t| t.key), Some(keys[2])); assert!(!app.renderer.is_pending(Slot::Main)); + assert!(app.renderer.offload_looks.is_empty(), "completed offload identities are released"); +} + +#[test] +fn superseded_crop_keeps_its_own_geometry_instead_of_the_latest_requests() { + let (mut app, work, ctx) = fixture(); + let old = app.session.loupe_job(PhotoId(1), 8, 8, true).unwrap().draft(); + let old_look = geometry_look(&old.settings); + app.renderer.request(Slot::Main, old, 100); + let (_, old) = take_job(&work); + let mut settings = lightcraft_develop::DevelopSettings::default(); + settings.crop.geometry.rect = lightcraft_geom::Rect::new(0.0, 0.0, 0.5, 1.0); + let new_look = geometry_look(&settings); + app.session.catalog.apply(Op::SetDevelop { id: PhotoId(1), settings: Arc::new(settings), label: "crop".into(), edited: None }).unwrap(); + let current = app.session.loupe_job(PhotoId(1), 8, 8, true).unwrap().draft(); + app.renderer.request(Slot::Main, current, 100); + let (_, current) = take_job(&work); + finish(&mut app, &work, &ctx, Slot::Main, old.run()); + assert_eq!(app.renderer.textures[&Slot::Main].look, Some((old_look, true))); + assert_ne!(old_look, new_look); + finish(&mut app, &work, &ctx, Slot::Main, current.run()); + assert_eq!(app.renderer.textures[&Slot::Main].look, Some((new_look, true))); +} + +#[test] +fn hidden_grading_keeps_the_completed_textures_geometry_identity() { + let (mut app, work, ctx) = fixture(); + let mut settings = lightcraft_develop::DevelopSettings::default(); + settings.grading.shadows.sat = 40.0; + settings.crop.geometry.rect = lightcraft_geom::Rect::new(0.1, 0.2, 0.8, 0.7); + app.session.catalog.apply(Op::SetDevelop { id: PhotoId(1), settings: Arc::new(settings.clone()), label: "grade".into(), edited: None }).unwrap(); + let expected = geometry_look(&settings); + let job = app.session.loupe_job(PhotoId(1), 8, 8, true).unwrap().with_hidden_grading([true, false, false]); + assert_ne!(job.settings.hash64(), settings.hash64(), "the view really hides a nonzero wheel"); + app.renderer.request(Slot::Main, job, 100); + let (slot, job) = take_job(&work); + finish(&mut app, &work, &ctx, slot, job.run()); + assert_eq!(app.renderer.textures[&Slot::Main].look, Some((expected, true))); } #[test] @@ -662,6 +774,300 @@ fn undo_to_existing_texture_supersedes_pending_edit() { assert_eq!(app.renderer.thumb(PhotoId(1)).unwrap().pixels.as_ref().unwrap().pixels, original.pixels); } +#[test] +fn cells_at_different_thumbnail_buckets_keep_one_pending_request() { + let (mut app, work, ctx) = fixture(); + let id = PhotoId(1); + let slot = Slot::Thumb(id); + // A print page's cells show the same photo at different sizes. Before any texture arrives, + // each frame's other bucket used to replace (and restart) the pending job. + crate::panels::grid::request_thumb(&mut app, id, 256, 10); + let built = app.renderer.thumb_jobs_built; + assert_eq!(built, 1); + let (submitted, pending) = take_job(&work); + assert_eq!(submitted, slot); + for _ in 0..12 { + crate::panels::grid::request_thumb(&mut app, id, 512, 10); + crate::panels::grid::request_thumb(&mut app, id, 384, 8); + crate::panels::grid::request_thumb(&mut app, id, 256, 10); + } + assert_eq!(app.renderer.thumb_jobs_built, built, "another bucket must not replace the pending thumbnail"); + assert!(work.borrow().jobs.is_empty(), "the pending render is not restarted"); + assert_eq!(app.renderer.pending[&slot].0, pending.key); + let pending_key = pending.key; + finish(&mut app, &work, &ctx, slot, pending.run()); + assert_eq!(app.renderer.textures[&slot].key, pending_key); + assert_eq!(app.renderer.thumb_inputs[&id].1, 256, "the completed request's bucket is remembered"); + assert!(!app.renderer.is_pending(slot)); + + // With a completed 256 thumbnail, the larger cell asks for its bucket once; the smaller + // cells then wait behind it instead of replacing it back every frame. + let built = app.renderer.thumb_jobs_built; + crate::panels::grid::request_thumb(&mut app, id, 512, 10); + assert_eq!(app.renderer.thumb_jobs_built, built + 1, "a larger bucket still upgrades"); + let (submitted, larger) = take_job(&work); + assert_eq!(submitted, slot); + assert_ne!(larger.key, pending_key); + let larger_key = app.renderer.pending[&slot].0; + assert_eq!(larger_key, larger.key); + for _ in 0..12 { + crate::panels::grid::request_thumb(&mut app, id, 512, 10); + crate::panels::grid::request_thumb(&mut app, id, 384, 10); + crate::panels::grid::request_thumb(&mut app, id, 256, 10); + } + assert_eq!(app.renderer.thumb_jobs_built, built + 1, "smaller cells keep the larger render in flight"); + assert!(work.borrow().jobs.is_empty(), "the larger render is not restarted"); + assert_eq!(app.renderer.pending[&slot].0, larger_key); + assert_eq!(app.renderer.thumb_inputs[&id].1, 512, "the in-flight bucket is still the larger one"); + finish(&mut app, &work, &ctx, slot, larger.run()); + assert_eq!(app.renderer.textures[&slot].key, larger_key); + assert_eq!(app.renderer.thumb_inputs[&id].1, 512); + assert!(!app.renderer.is_pending(slot)); + + // Once the largest visible bucket is complete, every smaller cell reuses those pixels. + // The 8x8 fixture texture cannot show its requested edge, so the remembered bucket, key + // and photo identity are what prove no render was built. Repeated frames at all sizes + // (the old bug alternated 256/512 forever) must settle with nothing further requested. + let built = app.renderer.thumb_jobs_built; + for _ in 0..24 { + crate::panels::grid::request_thumb(&mut app, id, 256, 10); + crate::panels::grid::request_thumb(&mut app, id, 384, 10); + crate::panels::grid::request_thumb(&mut app, id, 512, 10); + crate::panels::grid::request_thumb(&mut app, id, 384, 8); + } + assert_eq!(app.renderer.thumb_jobs_built, built, "completed larger thumbnails serve smaller cells"); + assert!(work.borrow().jobs.is_empty()); + assert!(!app.renderer.is_pending(slot)); + assert_eq!(app.renderer.textures[&slot].key, larger_key); + assert_eq!(app.renderer.thumb_inputs[&id].1, 512); + assert_eq!(app.renderer.thumb_inputs[&id].2, larger_key); + + // The renderer remembers the photo through a `Weak` only. That is enough for + // `Catalog`'s `Arc::make_mut` to copy the photo on edit (std: an existing weak pointer + // forces a new allocation even with a single strong reference), so the identity below is + // invalidated without this test holding an extra `Arc`. + let remembered = app.renderer.thumb_inputs[&id].0.clone(); + let remembered_ptr = remembered.as_ptr(); + assert!(remembered.upgrade().is_some(), "the remembered Weak points at the live catalog photo"); + assert_eq!(Arc::strong_count(app.session.catalog.photo(id).unwrap()), 1, "the catalog is the only strong owner; the renderer keeps just a Weak"); + + // An edit is a different photo/content key: the completed larger picture must not be + // reused for a smaller cell, and the replacement is requested as before. + let mut edit = lightcraft_develop::DevelopSettings::default(); + edit.light.exposure = 3.0; + app.session.catalog.apply(Op::SetDevelop { id, settings: Arc::new(edit), label: "edit".into(), edited: None }).unwrap(); + let current = app.session.catalog.photo(id).unwrap(); + assert_ne!(Arc::as_ptr(current), remembered_ptr, "make_mut moved the edited photo to a new allocation"); + assert_eq!(remembered.strong_count(), 0, "the renderer's Weak now points at the old, unowned allocation"); + assert_eq!(Arc::strong_count(current), 1, "the edit left one strong owner; no extra Arc was needed"); + let built = app.renderer.thumb_jobs_built; + crate::panels::grid::request_thumb(&mut app, id, 256, 10); + assert_eq!(app.renderer.thumb_jobs_built, built + 1, "an edited photo is requested again"); + let (submitted, edited) = take_job(&work); + assert_eq!(submitted, slot); + assert_ne!(edited.key, larger_key); + let edited_key = edited.key; + finish(&mut app, &work, &ctx, slot, edited.run()); + assert_eq!(app.renderer.textures[&slot].key, edited_key); + assert_eq!(app.renderer.thumb_inputs[&id].1, 256); + assert!(!app.renderer.is_pending(slot)); +} + +/// The remembered larger bucket is not a picture by itself: once its texture is evicted, a +/// smaller cell must render again rather than trust the stale record. +#[test] +fn an_evicted_larger_thumbnail_is_rebuilt_for_a_smaller_cell() { + let (mut app, work, ctx) = fixture(); + let id = PhotoId(1); + let slot = Slot::Thumb(id); + crate::panels::grid::request_thumb(&mut app, id, 512, 10); + let (submitted, larger) = take_job(&work); + assert_eq!(submitted, slot); + let larger_key = larger.key; + finish(&mut app, &work, &ctx, slot, larger.run()); + assert_eq!(app.renderer.textures[&slot].key, larger_key); + assert_eq!(app.renderer.thumb_inputs[&id].1, 512); + assert!(!app.renderer.is_pending(slot)); + + // An LRU trim drops the pixels; the remembered bucket/key must not stand in for them. + app.renderer.textures.remove(&slot); + let built = app.renderer.thumb_jobs_built; + crate::panels::grid::request_thumb(&mut app, id, 256, 10); + assert_eq!(app.renderer.thumb_jobs_built, built + 1, "an evicted larger thumbnail is rebuilt"); + let (submitted, rebuilt) = take_job(&work); + assert_eq!(submitted, slot); + assert_ne!(rebuilt.key, larger_key); + assert_eq!(app.renderer.pending[&slot].0, rebuilt.key); + assert_eq!(app.renderer.thumb_inputs[&id].1, 256); + let rebuilt_key = rebuilt.key; + finish(&mut app, &work, &ctx, slot, rebuilt.run()); + assert_eq!(app.renderer.textures[&slot].key, rebuilt_key); +} + +#[test] +fn a_coalesced_thumbnail_promotes_once_for_a_higher_priority_caller() { + let mut s = Session::new(); + s.catalog.apply(Op::AddPhoto { photo: Box::new((*photo()).clone()) }).unwrap(); + let mut app = crate::LightcraftApp::new(s, crate::Services::default()); + app.renderer.pool = JobPool::new(0); // deterministic: nothing starts + let slot = Slot::Thumb(PhotoId(1)); + crate::panels::grid::request_thumb(&mut app, PhotoId(1), 256, 5); + assert_eq!(app.renderer.pending[&slot].1, 5); + let first = app.renderer.pending[&slot].0; + // An on-screen caller at another bucket takes over the off-screen request once... + crate::panels::grid::request_thumb(&mut app, PhotoId(1), 512, 10); + let promoted = app.renderer.pending[&slot]; + assert_eq!(promoted.1, 10); + assert_ne!(promoted.0, first, "the promoted bucket is the one rendered"); + assert_eq!(app.renderer.thumb_jobs_built, 2, "one promotion"); + // ...and the caller it replaced then waits behind that priority instead of replacing it + // back. Equal priorities also keep the request in flight (the print cells' case). + for _ in 0..6 { + crate::panels::grid::request_thumb(&mut app, PhotoId(1), 256, 5); + crate::panels::grid::request_thumb(&mut app, PhotoId(1), 384, 8); + crate::panels::grid::request_thumb(&mut app, PhotoId(1), 512, 10); + } + assert_eq!(app.renderer.pending[&slot], promoted); + assert_eq!(app.renderer.pool.queued(), 1); + assert_eq!(app.renderer.thumb_jobs_built, 2, "a promoted request is not replaced in turn"); +} + +#[test] +fn a_stale_texture_does_not_disable_cross_bucket_coalescing() { + let (mut app, work, ctx) = fixture(); + let id = PhotoId(1); + let slot = Slot::Thumb(id); + crate::panels::grid::request_thumb(&mut app, id, 256, 10); + let (_, first) = take_job(&work); + finish(&mut app, &work, &ctx, slot, first.run()); + let old_key = app.renderer.textures[&slot].key; + + // The edit leaves the old texture displayed until the replacement renders. + let mut edit = lightcraft_develop::DevelopSettings::default(); + edit.light.exposure = 2.0; + app.session.catalog.apply(Op::SetDevelop { id, settings: Arc::new(edit), label: "edit".into(), edited: None }).unwrap(); + let built = app.renderer.thumb_jobs_built; + crate::panels::grid::request_thumb(&mut app, id, 384, 10); + assert_eq!(app.renderer.thumb_jobs_built, built + 1); + let (_, edited) = take_job(&work); + let new_key = app.renderer.pending[&slot].0; + assert_ne!(new_key, old_key); + assert_eq!(app.renderer.textures[&slot].key, old_key, "the old picture stays until the replacement arrives"); + + // The stale texture is not the recorded request's picture: other buckets must still keep + // the replacement in flight rather than restarting it every frame. + for _ in 0..12 { + crate::panels::grid::request_thumb(&mut app, id, 256, 10); + crate::panels::grid::request_thumb(&mut app, id, 512, 10); + } + assert_eq!(app.renderer.thumb_jobs_built, built + 1, "a stale texture must not disable coalescing"); + assert_eq!(app.renderer.pending[&slot].0, new_key); + assert!(work.borrow().jobs.is_empty()); + + // Once the recorded key has arrived, smaller cells reuse it; a larger cell upgrades. + finish(&mut app, &work, &ctx, slot, edited.run()); + assert_eq!(app.renderer.textures[&slot].key, new_key); + crate::panels::grid::request_thumb(&mut app, id, 256, 10); + assert_eq!(app.renderer.thumb_jobs_built, built + 1); + assert!(!app.renderer.is_pending(slot)); + crate::panels::grid::request_thumb(&mut app, id, 512, 10); + assert_eq!(app.renderer.thumb_jobs_built, built + 2); + assert_ne!(app.renderer.pending[&slot].0, new_key, "the larger bucket is requested once"); +} + +#[test] +fn raw_quick_preview_coalesces_across_buckets_without_priority_ping_pong() { + let mut s = Session::new(); + s.media.preview_loader = Some(Arc::new(|_, _| Some(lightcraft_raster::Rgba8 { width: 4, height: 4, data: vec![[200, 100, 50, 255]; 16] }))); + let mut raw = (*photo()).clone(); + raw.kind = lightcraft_catalog::MediaKind::Raw; + raw.develop = Arc::new(raw.camera_defaults()); + let (mut app, work, ctx) = fixture_with(s, raw); + app.renderer.pool = JobPool::new(0); // deterministic quick renders via run_inline + let id = PhotoId(1); + let quick = Slot::ThumbQuick(id); + let full = Slot::Thumb(id); + + crate::panels::grid::request_thumb(&mut app, id, 384, 5); + assert_eq!(app.renderer.pending[&quick].1, 6); + let first = app.renderer.pending[&quick].0; + assert!(work.borrow().jobs.is_empty(), "the stand-in renders before the real thumbnail"); + + // The on-screen caller at another bucket promotes the queued stand-in once. + crate::panels::grid::request_thumb(&mut app, id, 512, 10); + let promoted = app.renderer.pending[&quick]; + assert_eq!(promoted.1, 11); + assert_ne!(promoted.0, first); + assert_eq!(app.renderer.thumb_jobs_built, 2); + + // The replaced caller waits for it; neither bucket rebuilds the queued stand-in. + for _ in 0..6 { + crate::panels::grid::request_thumb(&mut app, id, 384, 5); + crate::panels::grid::request_thumb(&mut app, id, 512, 10); + } + assert_eq!(app.renderer.pending[&quick], promoted); + assert_eq!(app.renderer.pool.queued(), 1); + assert_eq!(app.renderer.thumb_jobs_built, 2); + + assert_eq!(app.renderer.pool.run_inline(1), 1); + app.renderer.poll(&ctx, &mut app.session); + assert_eq!(app.renderer.textures[&quick].key, promoted.0); + assert!(!app.renderer.is_pending(quick)); + + // An unedited raw's embedded preview is final. Repeating its bucket must not queue + // a full sensor render behind it, and a smaller cell reuses a preview that arrived + // at a larger bucket instead of asking for another one every frame. + let built = app.renderer.thumb_jobs_built; + crate::panels::grid::request_thumb(&mut app, id, 512, 10); + assert!(!app.renderer.is_pending(full)); + assert!(work.borrow().jobs.is_empty()); + assert_eq!(app.renderer.thumb_jobs_built, built); + for _ in 0..6 { + crate::panels::grid::request_thumb(&mut app, id, 384, 10); + crate::panels::grid::request_thumb(&mut app, id, 256, 10); + } + assert!(!app.renderer.is_pending(full)); + assert!(!app.renderer.is_pending(quick)); + assert!(work.borrow().jobs.is_empty(), "the embedded preview is not rebuilt for a smaller cell"); + assert_eq!(app.renderer.thumb_jobs_built, built); + assert_eq!(app.renderer.textures[&quick].key, promoted.0); + assert_eq!(app.renderer.embedded_thumbs[&id].1, 512, "the embedded preview's bucket is remembered"); +} + +/// The embedded preview is final only at the bucket whose pixels actually arrived. A larger +/// preview that was evicted, or whose job failed at that key, must not make a smaller cell +/// believe it is covered: that cell asks for its own quick render. +#[test] +fn missing_or_failed_larger_embedded_preview_does_not_cover_a_smaller_cell() { + for failed_larger in [false, true] { + let (mut app, _work, ctx) = raw_quick_fixture(); + app.renderer.pool = JobPool::new(0); // deterministic quick renders via run_inline + let id = PhotoId(1); + let quick = Slot::ThumbQuick(id); + crate::panels::grid::request_thumb(&mut app, id, 512, 10); + assert_eq!(app.renderer.pool.run_inline(1), 1); + app.renderer.poll(&ctx, &mut app.session); + assert!(app.renderer.textures.contains_key(&quick)); + assert_eq!(app.renderer.embedded_thumbs[&id].1, 512); + let key = app.renderer.embedded_thumbs[&id].2; + assert_eq!(app.renderer.textures[&quick].key, key); + + // The larger picture is gone: evicted, or its job failed at that key. + app.renderer.textures.remove(&quick); + if failed_larger { + app.renderer.failed.insert(quick, (key, "no embedded preview".into(), app.renderer.catalog_rev, id)); + } + let built = app.renderer.thumb_jobs_built; + crate::panels::grid::request_thumb(&mut app, id, 256, 10); + assert_eq!(app.renderer.thumb_jobs_built, built + 1, "a smaller cell must request its own quick render"); + let smaller_key = app.renderer.pending[&quick].0; + assert_ne!(smaller_key, key); + assert_eq!(app.renderer.pool.run_inline(1), 1); + app.renderer.poll(&ctx, &mut app.session); + assert_eq!(app.renderer.textures[&quick].key, smaller_key); + } +} + #[test] fn explicit_clear_repairs_same_key_bad_pixels_and_rejects_old_same_key_job() { let (mut app, work, ctx) = fixture(); diff --git a/crates/ui-egui/src/sync.rs b/crates/ui-egui/src/sync.rs index 3ebf9ce3e1..25d7cd84c5 100644 --- a/crates/ui-egui/src/sync.rs +++ b/crates/ui-egui/src/sync.rs @@ -315,6 +315,28 @@ impl Drop for SyncRun { } } +/// Tests: a synchronize that stays running while the returned sender lives, so a drop that is +/// released when another barrier goes meets a running Synchronize Folder deterministically +/// (without waiting for a real folder's walk). The caller clears `sync_run` when done. +#[cfg(test)] +pub(crate) fn stall_run(app: &mut LightcraftApp, name: &str) -> Box { + let progress = Arc::new(SyncProgress::default()); + let (tx, rx) = std::sync::mpsc::channel(); + let guard = app.session.activity.start("sync", "Synchronizing folder", Cancel::Flag(progress.files.cancel.clone())); + guard.detail(name); + app.sync_run = Some(SyncRun { + name: name.to_string(), + progress, + crashed: Arc::new(std::sync::atomic::AtomicBool::new(false)), + rx, + commit: None, + stopping: false, + not_saved: Vec::new(), + guard, + }); + Box::new(tx) +} + /// Commit what the worker readied (called every frame); when it is done, one undo step and a /// word on what happened. pub fn poll_run(app: &mut LightcraftApp, ctx: &egui::Context) { diff --git a/crates/ui-egui/src/tests.rs b/crates/ui-egui/src/tests.rs index 49174ff0d4..3a102a29a9 100644 --- a/crates/ui-egui/src/tests.rs +++ b/crates/ui-egui/src/tests.rs @@ -82,3 +82,6 @@ mod view_cost; mod wb_selector; mod zoom; mod zoom_keys; + +pub(super) mod fixtures; +pub(super) mod render_fixtures; diff --git a/crates/ui-egui/src/tests/activity.rs b/crates/ui-egui/src/tests/activity.rs index 4ed2b31783..58873a6e2e 100644 --- a/crates/ui-egui/src/tests/activity.rs +++ b/crates/ui-egui/src/tests/activity.rs @@ -422,13 +422,15 @@ fn batch_merge_runs_each_set_in_turn() { let _ = std::fs::remove_dir_all(&dir); std::fs::create_dir_all(&dir).unwrap(); let mut paths = Vec::new(); - // different exposures, or the import would take set B for duplicates of set A - for (set, evs) in [("A", [-2.0, 0.0, 2.0]), ("B", [-1.5, 0.5, 2.5]), ("C", [-1.0, 1.0, 3.0])] { - for (i, bytes) in lightcraft_merge::synth::bracket_dngs(1600, 1200, &evs).unwrap().into_iter().enumerate() { - let p = dir.join(format!("{set}_{i}.dng")); - std::fs::write(&p, bytes).unwrap(); - paths.push(p.to_string_lossy().to_string()); - } + // one `bracket_dngs` call renders the procedural scene once for all nine inputs (three calls + // would render it three times); the exposures stay different, or the import would take one + // set for duplicates of another + let evs = [-2.0, 0.0, 2.0, -1.5, 0.5, 2.5, -1.0, 1.0, 3.0]; + let sets = ["A", "A", "A", "B", "B", "B", "C", "C", "C"]; + for (i, (set, bytes)) in sets.into_iter().zip(lightcraft_merge::synth::bracket_dngs(1600, 1200, &evs).unwrap()).enumerate() { + let p = dir.join(format!("{set}_{}.dng", i % 3)); + std::fs::write(&p, bytes).unwrap(); + paths.push(p.to_string_lossy().to_string()); } let mut session = lightcraft_engine::Session::new().with_fs(); let r = session.execute("library.import", &json!({"paths": paths})).unwrap(); @@ -440,7 +442,10 @@ fn batch_merge_runs_each_set_in_turn() { session.execute("library.select", &json!({"ids": ids})).unwrap(); let app = LightcraftApp::new(session, Services { png: None, ..Default::default() }); let mut h = Headless::new(app, [1200.0, 800.0], 1.0); - h.settle(T); + // the merge ordering does not need the grid's nine thumbnails; one Detail render is enough + let r = h.request("ui.set", json!({"view": "detail", "filmstrip": false}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.settle(T), "the imported photos and the active preview settle"); let r = crate::menus::run_ui_command(&mut h.app, "merge.hdrBatch", &json!({})).unwrap().unwrap(); assert_eq!(r["sets"], 3); assert_eq!(h.app.merge.batch.len(), 2, "one running, two queued"); diff --git a/crates/ui-egui/src/tests/before_after.rs b/crates/ui-egui/src/tests/before_after.rs index 02ee879a1c..ffc3767748 100644 --- a/crates/ui-egui/src/tests/before_after.rs +++ b/crates/ui-egui/src/tests/before_after.rs @@ -7,6 +7,7 @@ use serde_json::json; use crate::headless::{Headless, RenderGate}; use crate::render::Slot; use crate::state::{BeforeAfter, ViewMode, Zoom}; +use crate::tests_render_fixtures::{HEIGHT, RenderFixture, WIDTH}; use crate::{LightcraftApp, Services}; const T: Duration = Duration::from_secs(20); @@ -133,18 +134,30 @@ fn assert_rect(actual: egui::Rect, expected: egui::Rect) { ); } +type AnimationView = (RenderFixture, Headless, [egui::Rect; 2], std::rc::Rc>); + /// Start with both textures ready, then hold replacement renders so worker timing cannot hide -/// a frame of the transition or replace a cached tile under the assertions. -fn animation_view(mode: BeforeAfter, zoom: Zoom) -> (Headless, [egui::Rect; 2], std::rc::Rc>) { - let app = LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() }); +/// a frame of the transition or replace a cached tile under the assertions. One real 6000×4000 +/// file-backed photo keeps the render work the animation needs, without the demo's neighbours. +fn animation_view(mode: BeforeAfter, zoom: Zoom) -> AnimationView { + let fixture = RenderFixture::new("before-after-animation", 1); + let app = LightcraftApp::new(fixture.session(), Services { png: None, ..Default::default() }); let mut h = Headless::new(app, [1400.0, 900.0], 1.0); + assert_eq!(h.app.session.catalog.len(), 1, "one real 24 MP photo"); let r = h.request("ui.set", json!({"view": "detail", "right": "none", "filmstrip": false}), T); assert_eq!(r["ok"], true, "{r}"); - h.app.ui.before_after = mode; + let id = h.app.session.active().expect("a photo is open"); + let photo = h.app.session.catalog.photo(id).expect("it is in the catalog"); + assert_eq!((photo.width, photo.height), (WIDTH, HEIGHT), "the render fixture is a real 24 MP photo"); + // settle the single photo's source and Main render before the second pane exists: both pane + // jobs then reuse the decoded 24 MP source instead of decoding it twice + h.app.ui.before_after = BeforeAfter::Off; h.app.ui.zoom = zoom; h.app.ui.pan = (0.5, 0.5); h.app.ui.click_zoom = 300; - assert!(h.settle(SETTLE), "baseline renders settled"); + assert!(h.settle(SETTLE), "the single photo's source and Main render settle"); + h.app.ui.before_after = mode; + assert!(h.settle(SETTLE), "both pane renders settled"); let before_id = h.app.renderer.textures[&Slot::Before].tex.id(); let before = h .view @@ -162,7 +175,7 @@ fn animation_view(mode: BeforeAfter, zoom: Zoom) -> (Headless, [egui::Rect; 2], assert!(!before.intersects(after), "pane clips do not overlap"); let open = std::rc::Rc::new(std::cell::Cell::new(false)); h.app.renderer.set_offload(Box::new(RenderGate::new(open.clone()))); - (h, [before, after], open) + (fixture, h, [before, after], open) } fn queue_click(h: &mut Headless, pos: egui::Pos2) { @@ -178,7 +191,7 @@ fn queue_click(h: &mut Headless, pos: egui::Pos2) { } fn check_click_animation(mode: BeforeAfter) { - let (mut h, [before, after], open) = animation_view(mode, Zoom::Fit); + let (_fx, mut h, [before, after], open) = animation_view(mode, Zoom::Fit); let shift = before.center() - after.center(); let fit = h.app.image_rect.expect("Fit image"); let id = h.app.session.active().expect("photo"); @@ -234,7 +247,7 @@ fn both_before_after_panes_use_the_animated_rect_top_bottom() { } fn check_region_animation(mode: BeforeAfter) { - let (mut h, [before, after], open) = animation_view(mode, Zoom::Percent(200.0)); + let (_fx, mut h, [before, after], open) = animation_view(mode, Zoom::Percent(200.0)); let shift = before.center() - after.center(); let start = h.app.image_rect.expect("200 percent image"); let tiles = [(Slot::RegionBefore, before, true), (Slot::Region, after, false)].map(|(slot, pane, is_before)| { diff --git a/crates/ui-egui/src/tests/capture_time.rs b/crates/ui-egui/src/tests/capture_time.rs index b5903e0535..c604ecad1a 100644 --- a/crates/ui-egui/src/tests/capture_time.rs +++ b/crates/ui-egui/src/tests/capture_time.rs @@ -59,7 +59,7 @@ fn shift_preview_says_the_photos_capture_time_cant_be_read() { let r = h.request("ui.clickWidget", json!({"id": "button:dialogOk"}), T); assert_eq!(r["ok"], true, "{r}"); - h.settle(SETTLE); + // Inspect the notification before settling advances the simulated clock past its lifetime. assert!(h.app.ui.dialog.is_none(), "OK closes the dialog"); let toast = toast(&h); assert!(toast.contains("can't be read"), "OK says the photo was left as it was: {toast:?}"); @@ -92,7 +92,7 @@ fn set_mode_refuses_moving_others_by_an_unreadable_time_and_repairs_it_alone() { open_set(&mut h, &[bad, other]); let r = h.request("ui.clickWidget", json!({"id": "button:dialogOk"}), T); assert_eq!(r["ok"], true, "{r}"); - h.settle(SETTLE); + // The click is consumed by request; unrelated rendering must not expire its notification. let toast = toast(&h); assert!(toast.contains("can't be read"), "OK says why nothing changed: {toast:?}"); assert!(matches!(h.app.ui.dialog, Some(Dialog::CaptureTime { .. })), "the dialog stays open after the refusal"); @@ -116,7 +116,8 @@ fn set_mode_refuses_moving_others_by_an_unreadable_time_and_repairs_it_alone() { /// button and from the control channel alike; they used to close it without a word. #[test] fn errors_are_shown_and_the_dialog_stays_open() { - let app = LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() }); + let files = crate::tests_fixtures::SyntheticLibrary::new("capture-time-errors"); + let app = files.app(); let mut h = Headless::new(app, [1300.0, 900.0], 1.0); let id = h.app.session.visible_cloned()[0]; set_captured(&mut h, id, "9999-12-31T12:00:00"); @@ -125,9 +126,10 @@ fn errors_are_shown_and_the_dialog_stays_open() { Some(Dialog::CaptureTime { time, .. }) => *time = "yesterday".into(), other => panic!("Edit Capture Time is not open: {other:?}"), } - h.settle(SETTLE); + assert!(h.settle(SETTLE), "capture-time dialog renders settled"); assert_eq!(h.request("ui.clickWidget", json!({"id": "button:dialogOk"}), T)["ok"], true); - h.settle(SETTLE); + // The request consumes the click. Inspect its short-lived notification before waiting + // for unrelated rendering: settling advances the simulated clock and can expire the toast. assert!(toast(&h).contains("not a date"), "OK says the typed time isn't a date: {:?}", toast(&h)); assert!(matches!(&h.app.ui.dialog, Some(Dialog::CaptureTime { time, .. }) if time == "yesterday"), "the dialog stays open with what was typed"); @@ -139,7 +141,7 @@ fn errors_are_shown_and_the_dialog_stays_open() { } other => panic!("Edit Capture Time is not open: {other:?}"), } - h.settle(SETTLE); + assert!(h.settle(SETTLE), "capture-time dialog renders settled"); let r = h.request("ui.dialog.confirm", json!({}), T); assert_ne!(r["ok"], true, "the shift is refused: {r}"); assert!(r.to_string().contains("9999"), "{r}"); diff --git a/crates/ui-egui/src/tests/crop_rotate.rs b/crates/ui-egui/src/tests/crop_rotate.rs index 71368fba21..7cab2f0853 100644 --- a/crates/ui-egui/src/tests/crop_rotate.rs +++ b/crates/ui-egui/src/tests/crop_rotate.rs @@ -6,6 +6,7 @@ use std::time::Duration; use serde_json::json; use crate::headless::Headless; +use crate::tests_fixtures::SyntheticLibrary; use crate::{LightcraftApp, Services}; const T: Duration = Duration::from_secs(20); @@ -13,12 +14,26 @@ const SETTLE: Duration = Duration::from_secs(120); fn crop_tool() -> Headless { let app = LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() }); + crop_view(app, false) +} + +/// The crop tool on `app`, asserting the setup settle: a pixel comparison must not run on a view +/// whose first render never finished. +fn crop_tool_with(app: LightcraftApp) -> Headless { + crop_view(app, true) +} + +fn crop_view(app: LightcraftApp, assert_settle: bool) -> Headless { let mut h = Headless::new(app, [1200.0, 800.0], 1.0); for (method, params) in [("ui.set", json!({"view": "detail"})), ("engine.execute", json!({"command": "panel.crop"}))] { let r = h.request(method, params, T); assert_eq!(r["ok"], true, "{r}"); } - h.settle(SETTLE); + if assert_settle { + assert!(h.settle(SETTLE), "the crop view settles before the snapshot"); + } else { + h.settle(SETTLE); + } h } @@ -385,11 +400,13 @@ fn the_angle_field_writes_the_angle_like_the_readout() { /// box once rotated: dimmed wedges inside it, doubly dark ones outside, growing with the angle.) #[test] fn rotating_the_crop_dims_nothing_inside_the_box() { - let mut h = crop_tool(); + // a real file-backed photo: the regression is a screen-space overlay, not native-resolution detail + let files = SyntheticLibrary::new("crop-dimming"); + let mut h = crop_tool_with(files.app()); let plain = h.paint(); let r = h.request("engine.execute", json!({"command": "develop.set", "params": {"control": "crop.angle", "value": -45.0}}), T); assert_eq!(r["ok"], true, "{r}"); - h.settle(SETTLE); + assert!(h.settle(SETTLE), "the rotated crop view settles before the snapshot"); assert_eq!(angle(&h), -45.0); let rotated = h.paint(); let img = h.app.image_rect.expect("the photo on screen"); diff --git a/crates/ui-egui/src/tests/dialog_settings.rs b/crates/ui-egui/src/tests/dialog_settings.rs index c62bc2f594..950cae6e66 100644 --- a/crates/ui-egui/src/tests/dialog_settings.rs +++ b/crates/ui-egui/src/tests/dialog_settings.rs @@ -67,6 +67,11 @@ fn controls(h: &Headless) -> Vec<(String, egui::Rect)> { h.app.widgets.iter().filter(|(id, _)| named(id)).cloned().collect() } +/// Whether egui has a visible tooltip area, independent of unrelated window text. +fn tooltip_shown(h: &Headless) -> bool { + h.view.ctx.memory(|m| m.areas().visible_layer_ids().into_iter().any(|layer| layer.order == egui::Order::Tooltip)) +} + fn same(a: egui::Rect, b: egui::Rect) -> bool { (a.min - b.min).abs().max_elem() < 0.5 && (a.max - b.max).abs().max_elem() < 0.5 } @@ -184,7 +189,10 @@ fn a_long_library_folder_is_cut_short_and_its_tooltip_has_all_of_it() { ); // And resting the pointer on it shows the whole path assert_eq!(h.request("ui.hoverWidget", json!({"id": "text:settingsLocation"}), T)["ok"], true); - assert!(h.step_until(T, |h| h.painted_text().iter().any(|text| text.contains(&path))), "the tooltip has the whole path"); + assert!( + h.step_until(T, |h| tooltip_shown(h) && h.painted_text().iter().any(|text| text.contains(&path))), + "the tooltip layer shows the whole path" + ); // And the same holds for the folder Auto Import watches, which stays on one line let watched = h.app.run("library.autoImport", json!({"folder": path})); @@ -256,13 +264,23 @@ fn a_short_path_is_shown_whole_and_has_no_tooltip() { // Given the in-memory library, whose Location is a short sentence let mut h = demo([1600.0, 1000.0]); show(&mut h, "general"); - assert!(h.painted_text().iter().any(|text| text == "In memory — nothing is saved"), "it is all there"); - let before = h.painted_text().len(); - // When the pointer rests on it + let location = "In memory — nothing is saved"; + assert!(h.painted_text().iter().any(|text| text == location), "it is all there"); + assert!(!tooltip_shown(&h), "no tooltip before hovering the location"); assert_eq!(h.request("ui.hoverWidget", json!({"id": "text:settingsLocation"}), T)["ok"], true); - let _ = h.step_until(Duration::from_secs(2), |h| h.painted_text().len() > before); - // Then nothing more is drawn: there is nothing a tooltip could add - assert_eq!(h.painted_text().len(), before, "no tooltip for a path that is all there"); + // Observe every frame for two simulated seconds beyond the configured tooltip delay. + // A render completing or a toast disappearing may change other text in the window. + let rest_until = h.time() + f64::from(h.view.ctx.global_style().interaction.tooltip_delay) + 2.0; + assert!(!tooltip_shown(&h), "no tooltip when hovering the complete location"); + while h.time() < rest_until { + h.step(); + assert!(!tooltip_shown(&h), "no tooltip for a path that is all there at {}", h.time()); + assert_eq!( + h.painted_text().iter().filter(|text| text.as_str() == location).count(), + 1, + "the full location is drawn once throughout the hover" + ); + } } /// How many pixels of `rect` are not `colour` (one pixel per point here). diff --git a/crates/ui-egui/src/tests/docking_acceptance.rs b/crates/ui-egui/src/tests/docking_acceptance.rs index 207ad5fae8..2056103f48 100644 --- a/crates/ui-egui/src/tests/docking_acceptance.rs +++ b/crates/ui-egui/src/tests/docking_acceptance.rs @@ -96,10 +96,23 @@ fn inactive_same_mode_commands_reveal_without_closing_or_editing() { #[test] fn crop_canvas_double_click_reveals_edit_in_actual_custom_workspace() { - let mut h = app(); + // This exercises Canvas input and dock routing, not native-resolution rendering. + // Keep the real file alive until after the headless renderer is dropped. + let photo_files = crate::tests_fixtures::SyntheticLibrary::new("dock-crop-double-click"); + let mut fixture_app = photo_files.app(); + fixture_app.ui.left_panel = true; + let mut h = Headless::new(fixture_app, [1400.0, 1000.0], 1.0); + for _ in 0..5 { + h.step(); + } h.app.ui.view = crate::state::ViewMode::Detail; h.app.run("panel.crop", json!({})).unwrap(); - assert!(h.settle(std::time::Duration::from_secs(120)), "the demo photo settles before pointer input"); + assert!(h.settle(std::time::Duration::from_secs(120)), "the file-backed photo settles before pointer input"); + let active = h.app.session.active().expect("the fixture photo is active"); + assert!( + h.app.renderer.textures.get(&crate::render::Slot::Main).is_some_and(|tex| tex.photo == active && tex.size[0] > 0 && tex.size[1] > 0), + "the actual detail render is present before Canvas input" + ); h.app.ui.presets = true; h.step(); dock(&mut h, json!({"operation":"move","panel":"tools","target":"presets","zone":"center"})); diff --git a/crates/ui-egui/src/tests/drop_import.rs b/crates/ui-egui/src/tests/drop_import.rs index 8b6bf3dfdc..3d8031a69b 100644 --- a/crates/ui-egui/src/tests/drop_import.rs +++ b/crates/ui-egui/src/tests/drop_import.rs @@ -2,11 +2,14 @@ //! dropping will do; dropping photos or folders opens the import review (unless Settings ▸ Import //! says to import dropped files directly); a drop while a dialog is open is refused. +use std::sync::mpsc::Sender; +use std::sync::{Arc, Mutex}; use std::time::Duration; use serde_json::json; use crate::headless::Headless; +use crate::pick::PickRequest; use crate::state::Dialog; use crate::{LightcraftApp, Services}; @@ -43,18 +46,68 @@ fn write_png(path: &str, seed: u8) { std::fs::write(path, bytes).unwrap(); } +/// A folder dialog that answers "cancelled": enough to make the launch list's New Library button +/// and its name prompt available. +fn services() -> Services { + Services { png: None, pick_folder: Some(Box::new(|| -> Option { None })), ..Default::default() } +} + /// An empty library, a folder `trip` with two photos, a window big enough for the overlay. fn app(dir: &Scratch) -> Headless { write_png(&dir.path("trip/a.png"), 1); write_png(&dir.path("trip/b.png"), 2); let session = lightcraft_engine::Session::new().with_fs(); - let mut h = Headless::new(LightcraftApp::new(session, Services { png: None, ..Default::default() }), [1300.0, 900.0], 1.0); + let mut h = Headless::new(LightcraftApp::new(session, services()), [1300.0, 900.0], 1.0); for _ in 0..4 { h.step(); } h } +/// Folder dialogs the host shows "elsewhere": each request is recorded with the sender that +/// answers it, so a test can cancel or choose after the app has moved on to its next UI pass. +type Asked = Arc>)>>>; + +/// A no-library window whose New Library and Open Another… folder dialogs are asynchronous, as on +/// the desktop hosts that run pickers off the UI thread (and in the browser). +fn app_with_picker(dir: &Scratch) -> (Headless, Asked) { + write_png(&dir.path("trip/a.png"), 1); + write_png(&dir.path("trip/b.png"), 2); + let session = lightcraft_engine::Session::new().with_fs(); + let mut app = LightcraftApp::new(session, services()); + let asked: Asked = Default::default(); + let a = asked.clone(); + app.services.picker = Some(Box::new(move |req| { + let (tx, rx) = std::sync::mpsc::channel(); + a.lock().unwrap().push((req, tx)); + Ok(rx) + })); + let mut h = Headless::new(app, [1300.0, 900.0], 1.0); + for _ in 0..4 { + h.step(); + } + (h, asked) +} + +fn asked_dialogs(asked: &Asked) -> usize { + asked.lock().unwrap().len() +} + +/// Answer the oldest folder dialog: `paths` empty cancels it. +fn answer_picker(asked: &Asked, paths: Vec) { + let sender = asked.lock().unwrap().remove(0).1; + sender.send(paths).unwrap(); +} + +/// A library folder that can be chosen by Open Another…, made outside the no-library app. +fn library_at(dir: &Scratch, rel: &str) -> String { + let path = dir.path(rel); + let mut session = lightcraft_engine::Session::new().with_fs(); + session.open_library(&path, false).unwrap(); + session.close_library().unwrap(); + path +} + fn drop_files(h: &mut Headless, paths: &[String], hover: bool) { let r = h.request("ui.dropFiles", json!({"paths": paths, "hover": hover}), T); assert_eq!(r["ok"], true, "{r}"); @@ -63,6 +116,47 @@ fn drop_files(h: &mut Headless, paths: &[String], hover: bool) { } } +/// The same window with a library already open, so a launch list over it is the real "over" +/// case rather than a list with no library behind it. +fn app_with_library(dir: &Scratch) -> Headless { + write_png(&dir.path("trip/a.png"), 1); + write_png(&dir.path("trip/b.png"), 2); + let mut session = lightcraft_engine::Session::new().with_fs(); + session.open_library(dir.path("library"), false).unwrap(); + let mut h = Headless::new(LightcraftApp::new(session, services()), [1300.0, 900.0], 1.0); + for _ in 0..4 { + h.step(); + } + h +} + +/// Draw the launch list (`over_open_library`: Alt-at-launch over the library that opened, else the +/// list with no library behind it). +fn draw_launch_list(h: &mut Headless, over_open_library: bool) { + let mut problem = crate::panels::library_problem::LibraryProblem::choose_later(&h.app.ui.settings); + if over_open_library && let Some(c) = problem.chooser.as_mut() { + c.over = Some(h.app.session.library_generation()); + } + h.app.library_problem = Some(problem); + assert!(h.step_until(T, |h| h.app.widgets.iter().any(|(w, _)| w == "button:libraryOpen")), "the launch list is drawn"); +} + +/// The launch list as Alt-at-launch shows it over the library that opened. +fn show_launch_list(h: &mut Headless) { + draw_launch_list(h, true); + assert!(crate::panels::library_problem::blocks_file_drops(&h.app), "the launch list owns the drop barrier"); +} + +/// The same list with no library open: photos still go through the deliberate hold path. +fn show_no_library_launch_list(h: &mut Headless) { + draw_launch_list(h, false); + assert!(!crate::panels::library_problem::blocks_file_drops(&h.app), "with no library open the drop path runs"); +} + +fn user_presets(h: &Headless) -> usize { + h.app.session.presets.iter().filter(|p| !p.builtin).count() +} + fn overlay(h: &Headless) -> bool { h.app.widgets.iter().any(|(w, _)| w == "dropOverlay") } @@ -172,6 +266,497 @@ fn a_drop_and_its_hover_card_wait_behind_a_notice_prompt() { assert_eq!(photos(&h), 0, "the review still imports nothing before it is confirmed"); } +/// A photo dropped while the launch list is over an already open library must wait in the queue: +/// importing it behind the list would add it to the library the list is asking to replace or keep. +#[test] +fn a_photo_drop_waits_behind_the_launch_list_over_an_open_library() { + let dir = Scratch::new("chooser-photo"); + let mut h = app_with_library(&dir); + show_launch_list(&mut h); + drop_files(&mut h, &[dir.path("trip/a.png")], true); + assert!(!overlay(&h), "the drop card must not promise an import above the launch list"); + drop_files(&mut h, &[dir.path("trip/a.png")], false); + assert!(h.app.ui.dialog.is_none(), "no import review opens behind the launch list"); + assert!(h.app.scan.is_none() && h.app.import.is_none(), "no scan or import starts behind the launch list"); + assert_eq!(photos(&h), 0, "nothing is imported behind the launch list"); + assert_eq!(h.app.dropped_files.len(), 1, "the drop waits for the launch list to go"); + // Esc keeps the library that is open (the launch list's own Keep), then the queued drop runs + let r = h.request("ui.key", json!({"key": "Escape"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(SETTLE, |h| h.app.library_problem.is_none()), "the launch list closes"); + assert!(h.step_until(SETTLE, |h| matches!(h.app.ui.dialog, Some(Dialog::Import { .. }))), "the queued drop opens its review"); + assert_eq!(photos(&h), 0, "the review still imports nothing before it is confirmed"); + assert!(h.app.dropped_files.is_empty(), "the queued drop was consumed once the list was gone"); +} + +/// Preset drops run a command directly (no review), so the barrier must hold those too: a preset +/// imported behind the list would change the open library the person has not chosen to keep. +#[test] +fn a_preset_drop_waits_behind_the_launch_list_over_an_open_library() { + let dir = Scratch::new("chooser-preset"); + let mut h = app_with_library(&dir); + std::fs::write(dir.path("warm.lcpreset"), r#"{"id": "user.warm", "name": "Warm", "group": "Test", "settings": {"light": {"exposure": 0.5}}}"#) + .unwrap(); + let before = user_presets(&h); + show_launch_list(&mut h); + drop_files(&mut h, &[dir.path("warm.lcpreset")], false); + for _ in 0..10 { + h.step(); + } + assert_eq!(user_presets(&h), before, "no preset is imported behind the launch list"); + assert_eq!(h.app.dropped_files.len(), 1, "the preset waits for the launch list to go"); + let r = h.request("ui.key", json!({"key": "Escape"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(SETTLE, |h| h.app.library_problem.is_none()), "Keep closes the launch list"); + assert!(h.step_until(SETTLE, |h| user_presets(h) == before + 1), "the queued preset imports once the list is gone"); + assert!(h.app.dropped_files.is_empty()); +} + +/// A queued drop must survive the launch list hiding itself behind its own New Library name prompt: +/// that prompt does not make the list stop owning the library. Cancelling the prompt brings the +/// list back; only after Keep (Esc) does the drop import. +#[test] +fn a_queued_photo_drop_survives_the_choosers_new_library_prompt_and_cancel() { + let dir = Scratch::new("chooser-new-cancel"); + let mut h = app_with_library(&dir); + show_launch_list(&mut h); + drop_files(&mut h, &[dir.path("trip/a.png")], false); + assert_eq!(h.app.dropped_files.len(), 1, "the drop waits for the launch list"); + let r = h.request("ui.clickWidget", json!({"id": "button:libraryNew"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(T, |h| matches!(h.app.ui.dialog, Some(Dialog::TextPrompt { .. }))), "New Library asks for a name"); + for _ in 0..10 { + h.step(); + } + assert_eq!(h.app.dropped_files.len(), 1, "the drop waits behind the name prompt too"); + assert!(matches!(h.app.ui.dialog, Some(Dialog::TextPrompt { .. })), "the prompt stays open"); + assert!(h.app.scan.is_none() && h.app.import.is_none(), "nothing starts behind the prompt"); + assert_eq!(photos(&h), 0); + let r = h.request("ui.clickWidget", json!({"id": "button:dialogCancel"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(T, |h| h.app.ui.dialog.is_none()), "Cancel closes the name prompt"); + for _ in 0..5 { + h.step(); + } + assert!(h.app.widgets.iter().any(|(w, _)| w == "button:libraryOpen"), "the launch list is back"); + assert_eq!(h.app.dropped_files.len(), 1, "cancel kept the queued drop"); + assert!(h.app.ui.dialog.is_none(), "no review opens behind the returning list"); + assert_eq!(photos(&h), 0); + let r = h.request("ui.key", json!({"key": "Escape"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(SETTLE, |h| h.app.library_problem.is_none()), "Keep closes the launch list"); + assert!(h.step_until(SETTLE, |h| matches!(h.app.ui.dialog, Some(Dialog::Import { .. }))), "the queued drop opens its review"); + assert!(h.app.dropped_files.is_empty(), "the queued drop was consumed once the list was gone"); +} + +/// With no library open a drop during the list's New Library name prompt would once have hit the +/// generic "close the open dialog" refusal and been lost. It now waits for the prompt to close, +/// then goes through the deliberate paths: photos are held for the library chosen, presets refused. +#[test] +fn a_drop_during_the_no_library_name_prompt_is_held_or_refused_after_cancel() { + let dir = Scratch::new("newlib-prompt-drop"); + std::fs::write(dir.path("warm.lcpreset"), r#"{"id": "user.warm", "name": "Warm", "group": "Test", "settings": {"light": {"exposure": 0.5}}}"#) + .unwrap(); + let mut h = app(&dir); + show_no_library_launch_list(&mut h); + let r = h.request("ui.clickWidget", json!({"id": "button:libraryNew"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(T, |h| matches!(h.app.ui.dialog, Some(Dialog::TextPrompt { .. }))), "New Library asks for a name"); + drop_files(&mut h, &[dir.path("trip/a.png"), dir.path("warm.lcpreset")], false); + assert_eq!(h.app.dropped_files.len(), 2, "the drop waits behind the name prompt"); + assert_eq!(h.app.library_problem.as_ref().map(|p| p.pending_import.len()), Some(0), "nothing is held behind the prompt"); + let r = h.request("ui.clickWidget", json!({"id": "button:dialogCancel"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(T, |h| h.app.ui.dialog.is_none()), "Cancel closes the name prompt"); + assert!(h.step_until(SETTLE, |h| h.app.dropped_files.is_empty()), "the drop is consumed once the prompt is gone"); + assert_eq!( + h.app.library_problem.as_ref().map(|p| p.pending_import.clone()), + Some(vec![dir.path("trip/a.png")]), + "the photo waits for the library chosen" + ); + assert_eq!(user_presets(&h), 0, "the preset is refused, not imported into the temporary session"); + assert_eq!(photos(&h), 0, "nothing is imported into the temporary session"); +} + +/// The no-library New Library flow asks for a name, then for a place on the host's asynchronous +/// folder picker. A drop queued during either step waits: it must not be consumed before the new +/// library exists. Confirming the picker opens the library and the queued photo imports into it. +#[test] +fn a_queued_photo_drop_survives_the_async_new_library_picker_and_imports_on_confirmation() { + let dir = Scratch::new("newlib-async-confirm"); + let (mut h, asked) = app_with_picker(&dir); + show_no_library_launch_list(&mut h); + h.app.ui.settings.import_dropped_directly = true; + let r = h.request("ui.clickWidget", json!({"id": "button:libraryNew"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(T, |h| matches!(h.app.ui.dialog, Some(Dialog::TextPrompt { .. }))), "New Library asks for a name"); + let r = h.request("ui.clickWidget", json!({"id": "button:dialogOk"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(T, |h| h.app.pending_picks.len() == 1), "the folder picker is up"); + drop_files(&mut h, &[dir.path("trip/a.png")], false); + assert_eq!(asked_dialogs(&asked), 1, "one asynchronous folder dialog was started"); + assert!(h.app.session.library.is_none(), "no library exists until the picker answers"); + assert!(crate::panels::library_problem::blocks_file_drops(&h.app), "the folder picker still owns the drop barrier"); + for _ in 0..10 { + h.step(); + } + assert_eq!(h.app.dropped_files.len(), 1, "the drop waits through the picker"); + assert!(h.app.ui.dialog.is_none(), "the name prompt is gone; only the picker is up"); + assert_eq!(h.app.library_problem.as_ref().map(|p| p.pending_import.len()), Some(0), "nothing is held while the picker is still open"); + assert!(h.app.scan.is_none() && h.app.import.is_none() && photos(&h) == 0, "nothing starts behind the picker"); + + let parent = dir.path("new-library-parent"); + std::fs::create_dir_all(&parent).unwrap(); + answer_picker(&asked, vec![parent]); + assert!(h.step_until(SETTLE, |h| h.app.pending_picks.is_empty()), "the picker answered"); + assert!(h.step_until(SETTLE, |h| h.app.session.library.is_some()), "the new library opens"); + assert!( + h.step_until(SETTLE, |h| h.app.dropped_files.is_empty() && photos(h) == 1 && h.app.import.is_none()), + "the queued photo imports into the new library" + ); + assert_eq!(user_presets(&h), 0); +} + +/// Cancelling the asynchronous place picker leaves the launch list up. The queued photo then takes +/// the no-library hold path (kept for the library chosen) instead of being lost behind the picker. +#[test] +fn a_queued_drop_survives_the_async_new_library_picker_cancel_then_takes_the_no_library_path() { + let dir = Scratch::new("newlib-async-cancel"); + std::fs::write(dir.path("warm.lcpreset"), r#"{"id": "user.warm", "name": "Warm", "group": "Test", "settings": {"light": {"exposure": 0.5}}}"#) + .unwrap(); + let (mut h, asked) = app_with_picker(&dir); + show_no_library_launch_list(&mut h); + let r = h.request("ui.clickWidget", json!({"id": "button:libraryNew"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(T, |h| matches!(h.app.ui.dialog, Some(Dialog::TextPrompt { .. }))), "New Library asks for a name"); + let r = h.request("ui.clickWidget", json!({"id": "button:dialogOk"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(T, |h| h.app.pending_picks.len() == 1), "the folder picker is up"); + drop_files(&mut h, &[dir.path("trip/a.png"), dir.path("warm.lcpreset")], false); + for _ in 0..10 { + h.step(); + } + assert_eq!(h.app.dropped_files.len(), 2, "both files wait through the picker"); + assert!(h.app.session.library.is_none()); + + answer_picker(&asked, vec![]); + assert!(h.step_until(SETTLE, |h| h.app.pending_picks.is_empty()), "the picker was cancelled"); + assert!(h.step_until(SETTLE, |h| h.app.dropped_files.is_empty()), "the drop takes the no-library path now"); + assert!(h.app.session.library.is_none(), "cancel created no library"); + assert!(h.app.widgets.iter().any(|(w, _)| w == "button:libraryOpen"), "the launch list is still up"); + assert_eq!( + h.app.library_problem.as_ref().map(|p| p.pending_import.clone()), + Some(vec![dir.path("trip/a.png")]), + "the photo waits for the library chosen" + ); + assert_eq!(user_presets(&h), 0, "the preset is refused with no library"); + assert_eq!(photos(&h), 0, "nothing is imported into the temporary session"); +} + +/// Open Another… has the same asynchronous folder picker with no library open. A queued drop must +/// wait for it, then import into the library the person opens. +#[test] +fn a_queued_photo_drop_survives_the_async_open_library_picker_and_imports_on_confirmation() { + let dir = Scratch::new("open-async-confirm"); + let target = library_at(&dir, "chosen-library"); + let (mut h, asked) = app_with_picker(&dir); + show_no_library_launch_list(&mut h); + h.app.ui.settings.import_dropped_directly = true; + let r = h.request("ui.clickWidget", json!({"id": "button:libraryOpenAnother"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(T, |h| h.app.pending_picks.len() == 1), "the folder picker is up"); + drop_files(&mut h, &[dir.path("trip/a.png")], false); + assert_eq!(asked_dialogs(&asked), 1); + assert!(h.app.session.library.is_none()); + assert!(crate::panels::library_problem::blocks_file_drops(&h.app), "the folder picker still owns the drop barrier"); + for _ in 0..10 { + h.step(); + } + assert_eq!(h.app.dropped_files.len(), 1, "the drop waits through the picker"); + + answer_picker(&asked, vec![target.clone()]); + assert!(h.step_until(SETTLE, |h| h.app.pending_picks.is_empty()), "the picker answered"); + assert!(h.step_until(SETTLE, |h| h.app.library_problem.is_none()), "opening the library ends the launch list"); + assert!( + h.step_until(SETTLE, |h| h.app.dropped_files.is_empty() && photos(h) == 1 && h.app.import.is_none()), + "the queued photo imports into the opened library" + ); + assert_eq!(h.app.session.library.as_ref().map(|l| l.dir.to_string_lossy().into_owned()), Some(target)); +} + +/// A library opened from the asynchronous picker can start files that were already waiting in +/// `pending_import` (the command line, an earlier no-library drop). A drop queued while the picker +/// was up must not be handed to the ordinary drop path while that import runs: it waits for the +/// pending import to end and is imported too, instead of being refused and lost. +#[test] +fn a_queued_drop_waits_for_the_pending_import_started_when_the_picker_opens_the_library() { + let dir = Scratch::new("pending-import-picker"); + let target = library_at(&dir, "chosen-library"); + let (mut h, asked) = app_with_picker(&dir); + show_no_library_launch_list(&mut h); + h.app.ui.settings.import_dropped_directly = true; + let pending = dir.path("trip/a.png"); + h.app.library_problem.as_mut().unwrap().pending_import.push(pending); + + let r = h.request("ui.clickWidget", json!({"id": "button:libraryOpenAnother"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(T, |h| h.app.pending_picks.len() == 1), "the folder picker is up"); + drop_files(&mut h, &[dir.path("trip/b.png")], false); + for _ in 0..10 { + h.step(); + } + assert_eq!(h.app.dropped_files.len(), 1, "the drop waits through the picker"); + assert!(h.app.session.library.is_none()); + + answer_picker(&asked, vec![target.clone()]); + assert!(h.step_until(SETTLE, |h| h.app.pending_picks.is_empty()), "the picker answered"); + assert!(h.step_until(SETTLE, |h| photos(h) == 1), "the pending import arrives first"); + assert!(h.app.import.is_some(), "the pending import still runs when the drop is released"); + assert_eq!(h.app.dropped_files.len(), 1, "the drop waits for the pending import instead of being refused"); + assert!( + h.step_until(SETTLE, |h| photos(h) == 2 && h.app.dropped_files.is_empty() && h.app.import.is_none()), + "both the pending file and the queued drop are imported (photos: {}, queued: {:?})", + photos(&h), + h.app.dropped_files.len() + ); + assert_eq!(h.app.session.library.as_ref().map(|l| l.dir.to_string_lossy().into_owned()), Some(target)); +} + +/// A drop queued behind the launch list may find another dialog open when the list goes (the +/// person opened one while the barrier was up). It waits for that dialog instead of taking the +/// ordinary "close the open dialog" refusal, so it is not lost. +#[test] +fn a_queued_drop_waits_for_a_dialog_opened_before_the_launch_list_closes() { + let dir = Scratch::new("deferred-dialog"); + let mut h = app_with_library(&dir); + show_launch_list(&mut h); + drop_files(&mut h, &[dir.path("trip/a.png")], false); + assert_eq!(h.app.dropped_files.len(), 1, "the drop waits for the launch list"); + h.app.library_problem = None; + h.app.ui.dialog = Some(Dialog::WhatsNew); + for _ in 0..10 { + h.step(); + } + assert!(matches!(h.app.ui.dialog, Some(Dialog::WhatsNew)), "the dialog stays"); + assert_eq!(h.app.dropped_files.len(), 1, "the deferred drop is not refused while the dialog is open"); + assert!(h.app.scan.is_none() && h.app.import.is_none(), "nothing starts behind the dialog"); + h.app.ui.dialog = None; + assert!(h.step_until(SETTLE, |h| matches!(h.app.ui.dialog, Some(Dialog::Import { .. }))), "the drop opens its review once the dialog is closed"); + assert!(h.app.dropped_files.is_empty(), "the deferred drop was consumed only when safe"); +} + +/// A drop queued behind the launch list may be released while a Synchronize Folder runs. It +/// waits for that run to finish instead of taking `import::start_paths`'s "A folder is being +/// synchronized" refusal and being lost. A drop made while no barrier was up still gets that +/// refusal (see `tests_sync::a_synchronize_and_an_import_never_run_at_once`). +#[test] +fn a_queued_drop_waits_for_a_running_synchronize_instead_of_being_refused() { + let dir = Scratch::new("deferred-sync"); + let mut h = app_with_library(&dir); + h.app.ui.settings.import_dropped_directly = true; + show_launch_list(&mut h); + drop_files(&mut h, &[dir.path("trip/a.png")], false); + assert_eq!(h.app.dropped_files.len(), 1, "the drop waits for the launch list"); + let _run = crate::sync::stall_run(&mut h.app, "trip"); + assert!(h.app.sync_run.is_some(), "the synchronize is running"); + h.app.library_problem = None; + for _ in 0..10 { + h.step(); + } + assert!(h.app.sync_run.is_some(), "the synchronize still runs"); + assert_eq!(h.app.dropped_files.len(), 1, "the deferred drop waits for the running synchronize instead of being refused"); + assert!(!said(&h, "A folder is being synchronized"), "the deferred drop is not refused: {:?}", h.painted_text()); + assert_eq!(photos(&h), 0, "nothing is imported during the synchronize"); + h.app.sync_run = None; + assert!( + h.step_until(SETTLE, |h| h.app.dropped_files.is_empty() && photos(h) == 1 && h.app.import.is_none()), + "the queued drop imports once the synchronize is done (queued: {:?}, photos: {})", + h.app.dropped_files, + photos(&h) + ); +} + +/// The same for a Lightroom catalog import: a drop queued behind the launch list waits while the +/// task owns the catalog, instead of being refused with "Finish Lightroom catalog import…". +#[test] +fn a_queued_drop_waits_for_a_running_lightroom_import_instead_of_being_refused() { + let dir = Scratch::new("deferred-lightroom"); + let mut h = app_with_library(&dir); + h.app.ui.settings.import_dropped_directly = true; + show_launch_list(&mut h); + drop_files(&mut h, &[dir.path("trip/a.png")], false); + assert_eq!(h.app.dropped_files.len(), 1, "the drop waits for the launch list"); + let task = crate::lightroom_import::stall_import(&mut h.app); + h.app.library_problem = None; + for _ in 0..10 { + h.step(); + } + assert!(h.app.lightroom.is_some(), "the Lightroom import still runs"); + assert_eq!(h.app.dropped_files.len(), 1, "the deferred drop waits for the Lightroom import instead of being refused"); + assert!(!said(&h, "Finish Lightroom catalog import"), "the deferred drop is not refused: {:?}", h.painted_text()); + assert_eq!(photos(&h), 0, "nothing is imported during the Lightroom import"); + drop(task); + assert!(h.step_until(SETTLE, |h| h.app.lightroom.is_none()), "the Lightroom task ends"); + // the stub's disconnect reports a stopped task and opens its result window; close it so the + // queued drop is released (a real import's result window is another dialog the guard waits for) + h.app.ui.dialog = None; + assert!( + h.step_until(SETTLE, |h| h.app.dropped_files.is_empty() && photos(h) == 1 && h.app.import.is_none()), + "the queued drop imports once the Lightroom task is done (queued: {:?}, photos: {})", + h.app.dropped_files, + photos(&h) + ); +} + +/// Cancelling Open Another…'s asynchronous picker keeps the launch list up; the queued photo is +/// then held for the library chosen rather than dropped behind the cancelling picker. +#[test] +fn a_queued_photo_drop_survives_the_async_open_library_picker_cancel() { + let dir = Scratch::new("open-async-cancel"); + let (mut h, asked) = app_with_picker(&dir); + show_no_library_launch_list(&mut h); + let r = h.request("ui.clickWidget", json!({"id": "button:libraryOpenAnother"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(T, |h| h.app.pending_picks.len() == 1), "the folder picker is up"); + drop_files(&mut h, &[dir.path("trip/a.png")], false); + for _ in 0..10 { + h.step(); + } + assert_eq!(h.app.dropped_files.len(), 1, "the drop waits through the picker"); + + answer_picker(&asked, vec![]); + assert!(h.step_until(SETTLE, |h| h.app.pending_picks.is_empty()), "the picker was cancelled"); + assert!(h.step_until(SETTLE, |h| h.app.dropped_files.is_empty()), "the drop takes the no-library path now"); + assert!(h.app.session.library.is_none()); + assert!(h.app.widgets.iter().any(|(w, _)| w == "button:libraryOpen"), "the launch list is still up"); + assert_eq!( + h.app.library_problem.as_ref().map(|p| p.pending_import.clone()), + Some(vec![dir.path("trip/a.png")]), + "the photo waits for the library chosen" + ); + assert_eq!(photos(&h), 0); +} + +/// A valid face-model drop on a no-library launch list or error window must not open its licence +/// dialog behind that window; it is refused like a preset, while photos still take the hold path. +#[test] +fn a_model_drop_on_a_no_library_window_does_not_open_its_dialog_behind_it() { + let dir = Scratch::new("model-window"); + std::fs::write(dir.path("face.onnx"), lightcraft_faces::synthetic::tiny_embedder_model(512)).unwrap(); + for (tag, problem) in [ + ("error", crate::panels::library_problem::LibraryProblem::new(dir.path("Gone"), "not found")), + ("chooser", crate::panels::library_problem::LibraryProblem::choose_later(&crate::state::AppSettings::default())), + ] { + let mut h = app(&dir); + h.app.library_problem = Some(problem); + for _ in 0..4 { + h.step(); + } + drop_files(&mut h, &[dir.path("face.onnx")], true); + assert!(said(&h, "drop the model again"), "{tag}: the card says the model waits: {:?}", h.painted_text()); + drop_files(&mut h, &[dir.path("face.onnx")], false); + for _ in 0..10 { + h.step(); + } + assert!(h.app.ui.dialog.is_none(), "{tag}: no face model dialog behind the window"); + let toast = h.app.ui.toast.as_ref().map(|t| t.0.clone()).unwrap_or_default(); + assert!(toast.contains("drop the model again"), "{tag}: {toast}"); + } +} + +/// A model dropped over the launch list is held like a photo/preset, then opens its licence dialog +/// once the list is kept away. +#[test] +fn a_model_drop_waits_behind_the_launch_list_and_opens_after_keep() { + let dir = Scratch::new("chooser-model"); + std::fs::write(dir.path("face.onnx"), lightcraft_faces::synthetic::tiny_embedder_model(512)).unwrap(); + let mut h = app_with_library(&dir); + h.app.session.face_models_dir = Some(std::path::PathBuf::from(dir.path("models"))); + show_launch_list(&mut h); + drop_files(&mut h, &[dir.path("face.onnx")], false); + for _ in 0..10 { + h.step(); + } + assert!(h.app.ui.dialog.is_none(), "no licence dialog opens behind the launch list"); + assert_eq!(h.app.dropped_files.len(), 1, "the model waits for the launch list to go"); + let r = h.request("ui.key", json!({"key": "Escape"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(SETTLE, |h| h.app.library_problem.is_none()), "Keep closes the launch list"); + assert!(h.step_until(SETTLE, |h| matches!(h.app.ui.dialog, Some(Dialog::FaceModel { .. }))), "the queued model opens its licence dialog"); + assert!(h.app.dropped_files.is_empty()); +} + +/// A failed switch leaves the launch list showing its error over the library that stayed open +/// (`Chooser { over: Some(generation), .. }`, not a separate error window). A queued drop must wait +/// there too: importing it would change the library the person has not chosen to keep. +#[test] +fn a_photo_drop_waits_behind_the_choosers_failed_switch_error_until_keep() { + let dir = Scratch::new("failed-switch"); + let mut h = app_with_library(&dir); + let mut problem = crate::panels::library_problem::LibraryProblem::choose_later(&h.app.ui.settings); + let generation = h.app.session.library_generation(); + let Some(c) = problem.chooser.as_mut() else { panic!("the launch list has its chooser") }; + c.over = Some(generation); + problem.path = dir.path("Gone"); + problem.error = format!("{}: the library is no longer there", dir.path("Gone")); + h.app.library_problem = Some(problem); + assert!( + h.step_until(T, |h| h.app.widgets.iter().any(|(w, _)| w == "button:libraryOpen")), + "the launch list is drawn over the library that stayed open" + ); + assert!(said(&h, "no longer there"), "the failed switch's error is shown: {:?}", h.painted_text()); + assert!(crate::panels::library_problem::blocks_file_drops(&h.app), "the failed-switch list owns the drop barrier"); + drop_files(&mut h, &[dir.path("trip/a.png")], false); + assert_eq!(h.app.dropped_files.len(), 1, "the drop waits for the failed-switch list"); + assert!(h.app.ui.dialog.is_none(), "no import review opens behind the list"); + assert!(h.app.scan.is_none() && h.app.import.is_none(), "nothing starts behind the list"); + assert_eq!(photos(&h), 0); + // Esc is the list's Keep: it closes the list and leaves the library that stayed open. + let r = h.request("ui.key", json!({"key": "Escape"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!(h.step_until(SETTLE, |h| h.app.library_problem.is_none()), "Keep closes the launch list"); + assert!(h.step_until(SETTLE, |h| matches!(h.app.ui.dialog, Some(Dialog::Import { .. }))), "the queued drop opens after Keep"); + assert!(h.app.dropped_files.is_empty()); + assert_eq!(photos(&h), 0, "the review still imports nothing before it is confirmed"); +} + +/// A drop queued while the launch list is up belongs to the library the person then opens with +/// its Open button: the switch must not drop it, and it imports into the new library. +#[test] +fn a_queued_photo_drop_imports_into_the_library_opened_from_the_list() { + let dir = Scratch::new("switch-queue"); + // Made (and flushed) by a session that is dropped before the app opens it: `close_library` + // saves but keeps the library and its OS lock until the session is dropped, and the launch + // list's Open would then be refused with "already open" by this same process's other descriptor. + let second = library_at(&dir, "second"); + let mut h = app_with_library(&dir); + h.app.ui.settings.import_dropped_directly = true; + h.app.ui.settings.library_path = dir.path("library"); + h.app.ui.settings.recent_libraries = vec![dir.path("library"), second.clone()]; + show_launch_list(&mut h); + drop_files(&mut h, &[dir.path("trip/a.png")], false); + assert_eq!(h.app.dropped_files.len(), 1); + let r = h.request("ui.clickWidget", json!({"id": "libraryRecent:1"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert_eq!(h.app.library_problem.as_ref().and_then(|p| p.chooser.as_ref()).and_then(|c| c.selected), Some(1), "the second library is selected"); + let r = h.request("ui.clickWidget", json!({"id": "button:libraryOpen"}), T); + assert_eq!(r["ok"], true, "{r}"); + assert!( + h.step_until(SETTLE, |h| h.app.library_problem.is_none()), + "the switch ends the launch list; problem: {:?}", + h.app.library_problem.as_ref().map(|p| (&p.path, &p.error)) + ); + assert!( + h.step_until(SETTLE, |h| h.app.import.is_none() && photos(h) == 1), + "the queued drop imports into the opened library (queued: {:?}, photos: {}, import running: {})", + h.app.dropped_files, + photos(&h), + h.app.import.is_some() + ); + assert_eq!(h.app.session.library.as_ref().map(|l| l.dir.to_string_lossy().into_owned()), Some(second)); + assert!(h.app.dropped_files.is_empty()); +} + /// The scan of a dropped folder finishing while another dialog is open (the face model's licence, Settings…) /// keeps that dialog; the review opens, with the scan's photos, once it is closed. #[test] @@ -354,3 +939,171 @@ fn photos_dropped_with_no_library_open_wait_for_one() { let toast = h.app.ui.toast.as_ref().map(|t| t.0.clone()).unwrap_or_default(); assert!(toast.contains("drop the presets again"), "{toast}"); } + +/// Finish the protected batch through the ordinary review/direct path, checking exact provenance. +fn finish_mixed_drop_batch(h: &mut Headless, expected: &[String], direct: bool) { + if !direct { + assert!(h.step_until(SETTLE, |h| matches!(h.app.ui.dialog, Some(Dialog::Import { .. }))), "the protected batch reaches review"); + let Some(Dialog::Import { opts }) = &h.app.ui.dialog else { panic!("no import review") }; + let mut actual = opts.candidates.iter().map(|c| c.path.clone()).collect::>(); + actual.sort(); + let mut wanted = expected.to_vec(); + wanted.sort(); + assert_eq!(actual, wanted, "review contains exactly the protected arrivals"); + assert_eq!(photos(h), 0, "review mode still requires confirmation"); + let reply = h.request("ui.dialog.confirm", json!({}), T); + assert_eq!(reply["ok"], true, "{reply}"); + } + assert!(h.step_until(SETTLE, |h| photos(h) == expected.len() && !crate::import::running(&h.app)), "the protected batch imports"); + let mut paths = h + .app + .session + .catalog + .photos() + .map(|p| match &p.source { + lightcraft_catalog::Source::File { path } => path.clone(), + other => panic!("unexpected imported source: {other:?}"), + }) + .collect::>(); + paths.sort(); + let mut wanted = expected.to_vec(); + wanted.sort(); + assert_eq!(paths, wanted, "only protected files entered the catalog"); + assert!(h.app.dropped_files.is_empty(), "the protected arrivals were consumed"); + let revision = h.app.session.catalog.revision; + // Inspect every later pass, not only the final catalog count: duplicate import suppression + // must not disguise replay of a consumed raw-input drop. + for _ in 0..60 { + h.step(); + assert!(!crate::import::running(&h.app), "no replay starts another scan/import"); + assert!(h.app.ui.dialog.is_none(), "no replay opens another review"); + assert!(h.app.dropped_files.is_empty()); + assert_eq!(photos(h), expected.len()); + assert_eq!(h.app.session.catalog.revision, revision, "no later import mutates the catalog"); + } +} + +#[test] +fn a_new_drop_outside_the_barrier_is_refused_while_an_older_drop_waits_for_a_dialog() { + for direct in [false, true] { + let dir = Scratch::new("mixed-provenance-dialog"); + let mut h = app_with_library(&dir); + h.app.ui.settings.import_dropped_directly = direct; + let a = dir.path("trip/a.png"); + let b = dir.path("trip/b.png"); + show_launch_list(&mut h); + drop_files(&mut h, std::slice::from_ref(&a), false); + assert_eq!(h.app.dropped_files.len(), 1); + h.app.library_problem = None; + h.app.ui.dialog = Some(Dialog::WhatsNew); + h.step(); + assert!(!crate::panels::library_problem::blocks_file_drops(&h.app)); + assert!(!crate::panels::notices::blocks_input(&h.app)); + drop_files(&mut h, &[b], false); + assert!(matches!(h.app.ui.dialog, Some(Dialog::WhatsNew)), "the ordinary dialog survives B"); + assert!(h.app.scan.is_none() && h.app.import.is_none()); + assert_eq!(photos(&h), 0); + assert!(h.app.ui.toast.as_ref().is_some_and(|t| t.0.contains("Close the open dialog")), "B is refused immediately: {:?}", h.app.ui.toast); + assert_eq!(h.app.dropped_files.len(), 1, "B cannot inherit A's protected provenance"); + h.app.ui.dialog = None; + finish_mixed_drop_batch(&mut h, &[a], direct); + } +} + +#[test] +fn a_new_drop_outside_the_barrier_is_refused_while_an_older_drop_waits_for_an_import() { + for direct in [false, true] { + let dir = Scratch::new("mixed-provenance-import"); + let mut h = app_with_library(&dir); + h.app.ui.settings.import_dropped_directly = direct; + let a = dir.path("trip/a.png"); + let b = dir.path("trip/b.png"); + show_launch_list(&mut h); + drop_files(&mut h, std::slice::from_ref(&a), false); + let stalled = crate::import::stall_scan(&mut h.app); + h.app.library_problem = None; + h.step(); + assert!(!crate::panels::library_problem::blocks_file_drops(&h.app)); + assert!(!crate::panels::notices::blocks_input(&h.app)); + drop_files(&mut h, &[b], false); + assert!(h.app.scan.is_some() && h.app.import.is_none(), "the original stalled import scan survives B"); + assert!(h.app.ui.dialog.is_none()); + assert_eq!(photos(&h), 0); + assert!(h.app.ui.toast.as_ref().is_some_and(|t| t.0.contains("An import is running")), "B is refused immediately: {:?}", h.app.ui.toast); + assert_eq!(h.app.dropped_files.len(), 1, "B cannot inherit A's protected provenance"); + drop(stalled); // Channel-only fixture: no worker/process to stop. + assert!(h.step_until(T, |h| h.app.scan.is_none()), "the original stalled scan ends"); + finish_mixed_drop_batch(&mut h, &[a], direct); + } +} + +#[test] +fn both_drops_really_made_behind_the_barrier_remain_protected() { + for direct in [false, true] { + let dir = Scratch::new("mixed-provenance-both-protected"); + let mut h = app_with_library(&dir); + h.app.ui.settings.import_dropped_directly = direct; + let a = dir.path("trip/a.png"); + let b = dir.path("trip/b.png"); + show_launch_list(&mut h); + drop_files(&mut h, std::slice::from_ref(&a), false); + drop_files(&mut h, std::slice::from_ref(&b), false); + assert_eq!(h.app.dropped_files.len(), 2, "both arrivals really occurred behind the barrier"); + h.app.library_problem = None; + h.app.ui.dialog = Some(Dialog::WhatsNew); + for _ in 0..10 { + h.step(); + } + assert!(matches!(h.app.ui.dialog, Some(Dialog::WhatsNew))); + assert_eq!(h.app.dropped_files.len(), 2, "both protected arrivals survive the later dialog"); + assert!(h.app.scan.is_none() && h.app.import.is_none()); + h.app.ui.dialog = None; + finish_mixed_drop_batch(&mut h, &[a, b], direct); + } +} + +/// Public take also serves web hosts: barrier reentry preserves order and consuming clears +/// protection, so a later ordinary drop cannot inherit the consumed batch's provenance. +#[test] +fn public_drop_take_preserves_reentered_barrier_order_and_clears_protection() { + let dir = Scratch::new("mixed-provenance-public-take"); + let mut h = app_with_library(&dir); + let a = dir.path("trip/a.png"); + let b = dir.path("trip/b.png"); + show_launch_list(&mut h); + drop_files(&mut h, std::slice::from_ref(&a), false); + assert_eq!(h.app.dropped_files.len(), 1); + h.app.library_problem = None; + h.app.ui.dialog = Some(Dialog::WhatsNew); + for _ in 0..3 { + h.step(); + } + assert_eq!(h.app.dropped_files.len(), 1, "A remains held behind the ordinary dialog"); + assert!(matches!(h.app.ui.dialog, Some(Dialog::WhatsNew))); + // Reenter before any pass without a blocker can consume A. + h.app.ui.dialog = None; + show_launch_list(&mut h); + drop_files(&mut h, std::slice::from_ref(&b), false); + assert_eq!(h.app.dropped_files.len(), 2); + assert_eq!(photos(&h), 0); + assert!(h.app.scan.is_none() && h.app.import.is_none()); + // Match the web ownership boundary without stepping a native consuming pass. + h.app.library_problem = None; + let taken = h.app.take_dropped_files(); + let paths = taken.iter().map(|f| egui::DroppedFile::path(f.as_ref()).to_string_lossy().into_owned()).collect::>(); + assert_eq!(paths, vec![a.clone(), b], "public take preserves arrival order through barrier reentry"); + assert!(h.app.take_dropped_files().is_empty(), "ownership transfers only once"); + h.app.ui.dialog = Some(Dialog::WhatsNew); + drop_files(&mut h, &[a], false); + assert!(matches!(h.app.ui.dialog, Some(Dialog::WhatsNew))); + assert!(h.app.ui.toast.as_ref().is_some_and(|t| t.0.contains("Close the open dialog")), "consumed protection cannot shelter a later drop"); + assert!(h.app.dropped_files.is_empty()); + h.app.ui.dialog = None; + for _ in 0..60 { + h.step(); + assert!(h.app.dropped_files.is_empty()); + assert!(!crate::import::running(&h.app)); + assert!(h.app.ui.dialog.is_none()); + assert_eq!(photos(&h), 0, "neither taken handles nor refused arrivals replay"); + } +} diff --git a/crates/ui-egui/src/tests/filmstrip.rs b/crates/ui-egui/src/tests/filmstrip.rs index bf572c1d68..1529bcb41d 100644 --- a/crates/ui-egui/src/tests/filmstrip.rs +++ b/crates/ui-egui/src/tests/filmstrip.rs @@ -31,30 +31,31 @@ fn filmstrip_shows_a_cjk_file_name() { #[test] fn filmstrip_stack_badge_expands_and_collapses_the_stack() { - let mut session = lightcraft_engine::Session::with_demo(); - let vis = session.visible_cloned(); + // Badge routing needs three real photos, not full 24 MP demo renders. + let library = crate::tests_fixtures::SyntheticLibrary::with_photos("filmstrip-stack-badge", 3); + let mut app = library.app(); + let vis = app.session.visible_cloned(); let (loose, top, member) = (vis[0], vis[1], vis[2]); let stack = Stack { id: StackId(1), photos: vec![top, member], collapsed: true }; - session.catalog.apply(Op::AddStack { stack }).unwrap(); - let app = LightcraftApp::new(session, Services { png: None, ..Default::default() }); + app.session.catalog.apply(Op::AddStack { stack }).unwrap(); let mut h = Headless::new(app, [1200.0, 800.0], 1.0); // the loose photo is the one in the loupe: the stack isn't selected let r = h.request("engine.execute", json!({"command": "library.select", "params": {"ids": [loose.0]}}), T); assert_eq!(r["ok"], true, "{r}"); let r = h.request("ui.set", json!({"view": "detail"}), T); assert_eq!(r["ok"], true, "{r}"); - h.settle(SETTLE); + assert!(h.settle(SETTLE), "the filmstrip settles before clicking its stack badge"); assert!(!h.app.session.visible_cloned().contains(&member), "collapsed: only the top shows"); let badge = format!("filmstack:{}", top.0); let r = h.request("ui.clickWidget", json!({"id": badge}), T); assert_eq!(r["ok"], true, "{r}"); - h.settle(SETTLE); + assert!(h.settle(SETTLE), "the expanded stack settles"); assert!(!h.app.session.catalog.stack(StackId(1)).unwrap().collapsed, "a click on the badge expands the stack"); assert!(h.app.session.visible_cloned().contains(&member)); assert_eq!(h.app.session.selection.active, Some(loose), "the loupe keeps its photo"); let r = h.request("ui.clickWidget", json!({"id": badge}), T); assert_eq!(r["ok"], true, "{r}"); - h.settle(SETTLE); + assert!(h.settle(SETTLE), "the collapsed stack settles"); assert!(h.app.session.catalog.stack(StackId(1)).unwrap().collapsed, "a second click collapses it"); assert!(!h.app.session.visible_cloned().contains(&member)); } diff --git a/crates/ui-egui/src/tests/fixtures.rs b/crates/ui-egui/src/tests/fixtures.rs new file mode 100644 index 0000000000..0b07b543db --- /dev/null +++ b/crates/ui-egui/src/tests/fixtures.rs @@ -0,0 +1,86 @@ +//! Test-only fixtures: a small, real, file-backed photo library. +//! +//! The demo library generates 24 MP procedural scenes, which Nextest regenerates in every +//! process. The library/lifecycle tests only need an active detail photo whose file really +//! decodes, so this fixture writes 64×48 gradient PNGs and imports them as the only photos. + +use std::path::PathBuf; + +use lightcraft_catalog::{Op, Photo, Source}; + +use crate::{LightcraftApp, Services}; + +/// A temporary folder holding small PNGs; removes only its own folder when dropped. +/// +/// Keep this guard alive until after the [`Headless`](crate::headless::Headless) built from +/// [`SyntheticLibrary::app`] is dropped: the renderer reads the photo file from disk. +pub(crate) struct SyntheticLibrary { + dir: PathBuf, + photos: Vec, +} + +impl SyntheticLibrary { + /// A fresh folder for `tag`, with a deterministic 64×48 gradient `a.png`. + pub(crate) fn new(tag: &str) -> SyntheticLibrary { + SyntheticLibrary::with_photos(tag, 1) + } + + /// A fresh folder for `tag`, with `n` distinct 64×48 gradient PNGs (`a.png`, `b.png`, …). + pub(crate) fn with_photos(tag: &str, n: usize) -> SyntheticLibrary { + assert!((1..=26).contains(&n), "fixture photo names use a through z"); + let dir = std::env::temp_dir().join(format!("lc-ui-fixture-{tag}-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(&dir).unwrap(); + let (w, h) = (64usize, 48usize); + let mut photos = Vec::new(); + for i in 0..n { + let name = format!("{}.png", char::from(b'a' + i as u8)); + let data: Vec<[u8; 4]> = (0..w * h) + .map(|p| { + let (x, y) = (p % w, p / w); + [((x * 3 + i * 17) % 256) as u8, ((y * 4 + i * 9) % 256) as u8, ((x + y + i) % 256) as u8, 255] + }) + .collect(); + let img = lightcraft_raster::Rgba8 { width: w, height: h, data }; + let png = lightcraft_codecs::encode_png(&lightcraft_codecs::EncodeImage::rgba8(&img), &lightcraft_codecs::EncodeMeta::default()).unwrap(); + let path = dir.join(name); + std::fs::write(&path, png).unwrap(); + photos.push(path); + } + SyntheticLibrary { dir, photos } + } + + /// A session whose library holds only the fixture photos, the first active and selected, with + /// the file system loaders installed so Detail really decodes the PNGs. + pub(crate) fn app(&self) -> LightcraftApp { + let mut session = lightcraft_engine::Session::new().with_fs(); + let mut ids = Vec::new(); + for (i, path) in self.photos.iter().enumerate() { + let id = session.catalog.alloc_photo_id(); + // distinct capture times keep the default (newest first) view order deterministic + let captured = format!("2026-01-01T10:{:02}:00", i % 60); + let mut photo = Photo::new( + id, + Source::File { path: path.to_string_lossy().into_owned() }, + path.file_name().map_or("photo.png", |n| n.to_str().unwrap_or("photo.png")), + "PNG", + 64, + 48, + &captured, + ); + photo.captured = Some(captured); + session.catalog.apply(Op::AddPhoto { photo: Box::new(photo) }).unwrap(); + ids.push(id); + } + if let Some(first) = ids.first() { + session.selection = lightcraft_engine::Selection::single(*first); + } + LightcraftApp::new(session, Services { png: None, ..Default::default() }) + } +} + +impl Drop for SyntheticLibrary { + fn drop(&mut self) { + let _ = std::fs::remove_dir_all(&self.dir); + } +} diff --git a/crates/ui-egui/src/tests/keyword_files.rs b/crates/ui-egui/src/tests/keyword_files.rs index f7180c3175..1d2f66340f 100644 --- a/crates/ui-egui/src/tests/keyword_files.rs +++ b/crates/ui-egui/src/tests/keyword_files.rs @@ -6,15 +6,14 @@ use std::time::Duration; use serde_json::json; use crate::headless::Headless; -use crate::{LightcraftApp, Services}; +use crate::tests_fixtures::SyntheticLibrary; const T: Duration = Duration::from_secs(20); const SETTLE: Duration = Duration::from_secs(120); -fn app() -> Headless { - let app = LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() }); - let mut h = Headless::new(app, [1200.0, 800.0], 1.0); - h.settle(SETTLE); +fn app(library: &SyntheticLibrary) -> Headless { + let mut h = Headless::new(library.app(), [1200.0, 800.0], 1.0); + assert!(h.settle(SETTLE), "keyword fixture did not settle"); h } @@ -26,9 +25,9 @@ fn temp_dir(tag: &str) -> std::path::PathBuf { } fn run(h: &mut Headless, command: &str, params: serde_json::Value) -> serde_json::Value { - let r = h.request("engine.execute", json!({"command": command, "params": params}), T); - h.settle(SETTLE); - r + // These commands finish synchronously, including their toast, before replying. Settling + // unrelated photo renders afterwards advances the simulated clock and can expire it. + h.request("engine.execute", json!({"command": command, "params": params}), T) } fn toast(h: &Headless) -> String { @@ -38,7 +37,8 @@ fn toast(h: &Headless) -> String { /// The File menu offers Import Keywords… and Export Keywords…. #[test] fn the_file_menu_offers_keyword_files() { - let mut h = app(); + let library = SyntheticLibrary::new("keyword-files-menu"); + let mut h = app(&library); let r = h.request("ui.menu.list", json!({}), T); let items = r["result"].to_string(); for id in ["file.importKeywords", "file.exportKeywords"] { @@ -50,7 +50,8 @@ fn the_file_menu_offers_keyword_files() { #[test] fn importing_keywords_says_what_it_added() { let dir = temp_dir("import"); - let mut h = app(); + let library = SyntheticLibrary::new("keyword-files-import"); + let mut h = app(&library); let path = dir.join("vocabulary.utf8"); std::fs::write(&path, "[Places]\r\n\tPortugal\r\n\t\tLisbon\r\n").unwrap(); let r = run(&mut h, "file.importKeywords", json!({"path": path.to_string_lossy()})); @@ -64,7 +65,8 @@ fn importing_keywords_says_what_it_added() { #[test] fn exporting_keywords_warns_about_capture_one() { let dir = temp_dir("export"); - let mut h = app(); + let library = SyntheticLibrary::new("keyword-files-export"); + let mut h = app(&library); let id = h.app.session.visible_cloned()[0].0; run(&mut h, "photo.setMeta", json!({"ids": [id], "addKeywords": ["fish, chips"]})); let path = dir.join("keywords.txt"); @@ -79,7 +81,8 @@ fn exporting_keywords_warns_about_capture_one() { #[test] fn exporting_keywords_names_what_it_left_out() { let dir = temp_dir("export-left-out"); - let mut h = app(); + let library = SyntheticLibrary::new("keyword-files-export-left-out"); + let mut h = app(&library); let id = h.app.session.visible_cloned()[0].0; run(&mut h, "photo.setMeta", json!({"ids": [id], "addKeywords": ["Travel|[draft]"]})); let path = dir.join("keywords.txt"); @@ -96,9 +99,12 @@ fn exporting_keywords_names_what_it_left_out() { /// A list that can't be written (a folder that isn't there) says why, as importing one does. #[test] fn exporting_keywords_says_why_it_failed() { - let mut h = app(); - let path = std::env::temp_dir().join("lc-no-such-folder-for-keywords").join("keywords.txt"); + let library = SyntheticLibrary::new("keyword-files-export-failure"); + let mut h = app(&library); + let dir = temp_dir("export-failure"); + let path = dir.join("missing-folder").join("keywords.txt"); let r = run(&mut h, "file.exportKeywords", json!({"path": path.to_string_lossy()})); assert_eq!(r["ok"], false, "{r}"); assert!(toast(&h).contains("keywords.txt"), "{}", toast(&h)); + let _ = std::fs::remove_dir_all(&dir); } diff --git a/crates/ui-egui/src/tests/library_problem.rs b/crates/ui-egui/src/tests/library_problem.rs index dc7a037a47..1a2e5a2d9b 100644 --- a/crates/ui-egui/src/tests/library_problem.rs +++ b/crates/ui-egui/src/tests/library_problem.rs @@ -8,6 +8,7 @@ use serde_json::json; use crate::headless::Headless; use crate::panels::library_problem::LibraryProblem; +use crate::tests_fixtures::SyntheticLibrary; use crate::{LightcraftApp, Services}; const T: Duration = Duration::from_secs(20); @@ -163,10 +164,10 @@ fn unopenable_library_asks_instead_of_running_a_demo() { /// own buttons are covered: the click then reports a no-op success and the state never changes. #[test] fn a_backdrop_press_keeps_the_library_window_above_its_dim() { - let app = LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() }); - let mut h = Headless::new(app, [1000.0, 760.0], 1.0); + let files = SyntheticLibrary::new("library-backdrop-press"); + let mut h = Headless::new(files.app(), [1000.0, 760.0], 1.0); h.app.library_problem = Some(LibraryProblem::new("/no/such/library", "a test error")); - assert!(h.settle(Duration::from_secs(20)), "the library window settles"); + assert!(h.settle(Duration::from_secs(20)), "the library window settles (pending slots: {:?})", h.app.renderer.pending_slots()); assert!(has(&h, "button:libraryTemporary"), "the window is laid out"); // Outside the centred window: on the full-screen dim, which egui raises when pressed. let at = egui::pos2(10.0, 10.0); @@ -189,17 +190,14 @@ fn a_backdrop_press_keeps_the_library_window_above_its_dim() { /// handlers must stay still while it is on screen, then the dialog keeps its ordinary behaviour. #[test] fn the_library_window_blocks_settings_escape_and_the_backdrop() { - let mut h = Headless::new( - LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() }), - [1200.0, 900.0], - 1.0, - ); + let files = SyntheticLibrary::new("library-blocks-settings"); + let mut h = Headless::new(files.app(), [1200.0, 900.0], 1.0); h.step(); assert!(h.app.run("app.settings", json!({})).is_ok(), "Settings opens"); - assert!(h.settle(Duration::from_secs(20)), "Settings settles"); + assert!(h.settle(Duration::from_secs(20)), "Settings settles (pending slots: {:?})", h.app.renderer.pending_slots()); h.app.ui.settings.close_dialogs_outside = true; h.app.library_problem = Some(LibraryProblem::new("/no/such/library", "a test error")); - assert!(h.settle(Duration::from_secs(20)), "the library window settles"); + assert!(h.settle(Duration::from_secs(20)), "the library window settles (pending slots: {:?})", h.app.renderer.pending_slots()); assert!(has(&h, "button:libraryRetry"), "the library window is laid out"); // Escape belongs to the window, not to Settings behind it (the window has no Escape action // for this error; the launch list handles its own keys separately). @@ -386,14 +384,11 @@ fn alt_launch_creation_after_raw_input_cancels_an_injected_gesture() { /// become a background click. #[test] fn a_held_background_press_is_released_when_a_library_window_appears_after_raw_input() { - let mut h = Headless::new( - LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() }), - [1200.0, 900.0], - 1.0, - ); + let files = SyntheticLibrary::new("library-after-raw-press"); + let mut h = Headless::new(files.app(), [1200.0, 900.0], 1.0); h.step(); assert!(h.app.run("app.settings", json!({})).is_ok(), "Settings opens"); - assert!(h.settle(T), "Settings settles"); + assert!(h.settle(T), "Settings settles (pending slots: {:?})", h.app.renderer.pending_slots()); let id = "check:settings.confirmDelete"; let at = h.app.widgets.iter().rev().find(|(widget, _)| widget == id).map(|(_, rect)| rect.center()).expect("the checkbox is on screen"); let before = h.app.ui.settings.confirm_delete; @@ -738,11 +733,8 @@ fn clipboard_pastes_into_the_launch_lists_own_text_prompt() { /// same field must accept typing again once the window is gone. #[test] fn a_settled_library_window_keeps_a_background_dialogs_text_draft_unchanged() { - let mut h = Headless::new( - LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() }), - [1200.0, 760.0], - 1.0, - ); + let files = SyntheticLibrary::new("library-text-draft"); + let mut h = Headless::new(files.app(), [1200.0, 760.0], 1.0); h.settle(T); h.app.ui.dialog = Some(crate::state::Dialog::NewAlbum { name: "Trip".into(), folder: false, parent: None, include_selected: false }); for _ in 0..4 { @@ -750,7 +742,7 @@ fn a_settled_library_window_keeps_a_background_dialogs_text_draft_unchanged() { } assert!(h.view.ctx.text_edit_focused(), "the dialog's field takes the focus while it is the top modal"); h.app.library_problem = Some(LibraryProblem::new("/no/such/library", "a test error")); - assert!(h.settle(T), "the library window settles over the dialog"); + assert!(h.settle(T), "the library window settles over the dialog (pending slots: {:?})", h.app.renderer.pending_slots()); assert!(has(&h, "button:libraryRetry"), "the library window is laid out"); assert!(crate::panels::library_problem::blocks_dialog_input(&h.app), "the library window owns input"); assert!(!h.view.ctx.text_edit_focused(), "the background dialog's field must not regain the focus behind the library window"); @@ -766,7 +758,7 @@ fn a_settled_library_window_keeps_a_background_dialogs_text_draft_unchanged() { assert!(!h.view.ctx.text_edit_focused(), "several settled barrier frames still leave the field unfocused"); // Positive control: with the library window gone, the same field takes focus and typing again. h.app.library_problem = None; - assert!(h.settle(T), "the dialog settles once the library window is gone"); + assert!(h.settle(T), "the dialog settles once the library window is gone (pending slots: {:?})", h.app.renderer.pending_slots()); assert!(!crate::panels::library_problem::blocks_dialog_input(&h.app), "there is no barrier now"); assert!(h.view.ctx.text_edit_focused(), "the dialog's field is usable again"); h.events.push(egui::Event::Text("Holiday".into())); diff --git a/crates/ui-egui/src/tests/lifecycle_037.rs b/crates/ui-egui/src/tests/lifecycle_037.rs index bfb08f1b49..3c4e8009b3 100644 --- a/crates/ui-egui/src/tests/lifecycle_037.rs +++ b/crates/ui-egui/src/tests/lifecycle_037.rs @@ -7,6 +7,7 @@ use std::time::Duration; use crate::headless::Headless; use crate::render::{Slot, Tex}; +use crate::tests_fixtures::SyntheticLibrary; use crate::{ControlResponse, LightcraftApp, MAX_PENDING_SHOTS, MAX_SHOT_BYTES, PendingShot, Services, ShotGeometry}; use lightcraft_engine::slideshow::Item; @@ -302,6 +303,42 @@ fn a_capture_completed_after_a_catalog_edit_is_still_written() { let _ = std::fs::remove_file(&path); } +#[test] +fn headless_capture_finishes_once_and_releases_only_its_reservation() { + for case in ["success", "overflow", "image-cap", "aggregate-cap"] { + let (mut app, seen) = app_with_screenshot_files(); + let ctx = egui::Context::default(); + let path = temp_png(&format!("headless-finish-{case}")); + let (tx, rx) = reply_channel(); + app.last_shot_geometry = Some(geometry(100.0, 100.0)); + let target = app.session.pin_write_target(&path.to_string_lossy()).expect("pin path"); + app.admit_shot(&ctx, Some(target), true, tx).expect("admit"); + let mut shot = app.pending_screenshots.pop().expect("pending shot"); + let mut image = egui::ColorImage::filled([200, 200], egui::Color32::WHITE); + let other_reservations = if case == "aggregate-cap" { crate::MAX_SHOT_TOTAL_BYTES - shot.reserved } else { 0 }; + app.shot_bytes += other_reservations; + if case == "overflow" { + image.size = [usize::MAX, 2]; + } else if case == "image-cap" { + image.size = [MAX_SHOT_BYTES, 1]; + } + app.finish_headless_shot(&mut shot, &image); + let reply = rx.try_recv().expect("one reply"); + assert_eq!(reply["ok"], case == "success", "{case}: {reply}"); + match case { + "overflow" => assert_eq!(reply["error"], "ui.screenshot: the rendered image has invalid dimensions"), + "image-cap" => assert!(reply["error"].as_str().expect("error message").contains("per-image limit")), + "aggregate-cap" => assert!(reply["error"].as_str().expect("error message").contains("bytes reserved is over")), + _ => {} + } + assert!(rx.try_recv().is_err(), "no duplicate reply"); + assert_eq!(app.shot_bytes, other_reservations, "{case}"); + assert_eq!(path.exists(), case == "success", "{case}"); + assert_eq!(seen.lock().unwrap().is_some(), case == "success", "{case}"); + let _ = std::fs::remove_file(path); + } +} + #[test] fn an_image_larger_than_its_reservation_is_grown_and_written() { // Wayland has no `inner_rect`, so on a hidden tick the reservation can be based on the old @@ -559,9 +596,10 @@ fn hidden_slideshow_pauses_and_keeps_its_remaining_time() { // Every slide is "ready": without the hidden gate, 10 hidden seconds would advance the show. for id in app.session.visible_cloned() { let tex = ctx.load_texture(format!("slide-{}", id.0), egui::ColorImage::filled([2, 2], egui::Color32::WHITE), Default::default()); - app.renderer - .textures - .insert(Slot::Slide(Item::Photo(id)), Tex { key: 0, photo: id, tex, size: [2, 2], histogram: None, ms: 0.0, quick: None, pixels: None }); + app.renderer.textures.insert( + Slot::Slide(Item::Photo(id)), + Tex { look: None, key: 0, photo: id, tex, size: [2, 2], histogram: None, ms: 0.0, quick: None, pixels: None }, + ); } let first = app.ui.slideshow.as_ref().unwrap().play.current(); let selection = app.session.active(); @@ -990,13 +1028,14 @@ fn a_maximum_step_drag_is_delivered_past_the_five_second_stall_limit() { #[test] fn a_click_on_a_control_under_a_nonmodal_overlay_is_refused_without_activating_the_overlay() { - let mut h = Headless::new(app(), [1400.0, 900.0], 1.0); + let files = SyntheticLibrary::new("control-under-overlay"); + let mut h = Headless::new(files.app(), [1400.0, 900.0], 1.0); let photo = h.app.session.visible_cloned()[0]; let t = Duration::from_secs(20); assert_eq!(h.request("engine.execute", serde_json::json!({"command": "library.select", "params": {"ids": [photo.0]}}), t)["ok"], true); assert_eq!(h.request("ui.set", serde_json::json!({"view": "detail", "right": "edit"}), t)["ok"], true); h.app.ui.open_sections = vec!["light".to_string()]; - assert!(h.settle(Duration::from_secs(60)), "the edit panel settles"); + assert!(h.settle(Duration::from_secs(60)), "the edit panel settles (pending slots: {:?})", h.app.renderer.pending_slots()); let id = "slider:light.exposure"; assert!(h.app.widgets.iter().any(|(widget, _)| widget == id), "{id} is on screen"); let before = h.app.session.develop_of(photo).expect("its develop settings").light.exposure; @@ -1028,12 +1067,13 @@ fn a_click_on_a_control_under_a_nonmodal_overlay_is_refused_without_activating_t /// interactive centre). This is the positive control the hover-only probe lacked. #[test] fn an_unobstructed_click_on_a_subrect_reaches_the_widget() { - let mut h = Headless::new(app(), [1400.0, 900.0], 1.0); + let files = SyntheticLibrary::new("unobstructed-subrect"); + let mut h = Headless::new(files.app(), [1400.0, 900.0], 1.0); let photo = h.app.session.visible_cloned()[0]; let t = Duration::from_secs(20); assert_eq!(h.request("engine.execute", serde_json::json!({"command": "library.select", "params": {"ids": [photo.0]}}), t)["ok"], true); assert_eq!(h.request("ui.set", serde_json::json!({"view": "detail", "right": "edit"}), t)["ok"], true); - assert!(h.settle(Duration::from_secs(60)), "the detail view settles"); + assert!(h.settle(Duration::from_secs(60)), "the detail view settles (pending slots: {:?})", h.app.renderer.pending_slots()); let id = "star:bottom:2"; assert!(h.app.widgets.iter().any(|(widget, _)| widget == id), "{id} is on screen"); assert!(h.app.widget_hits.iter().any(|(widget, _)| widget == id), "{id} has a probe"); @@ -1047,11 +1087,12 @@ fn an_unobstructed_click_on_a_subrect_reaches_the_widget() { /// must not turn the release into an overlay click; the pointer is released away from the target. #[test] fn an_overlay_that_appears_after_the_press_cancels_the_release() { - let mut h = Headless::new(app(), [1000.0, 760.0], 1.0); + let files = SyntheticLibrary::new("overlay-after-press"); + let mut h = Headless::new(files.app(), [1000.0, 760.0], 1.0); h.step(); let t = Duration::from_secs(20); assert_eq!(h.request("ui.key", serde_json::json!({"key": ",", "cmd": true}), t)["ok"], true); - assert!(h.settle(Duration::from_secs(60)), "the Settings dialog settles"); + assert!(h.settle(Duration::from_secs(60)), "the Settings dialog settles (pending slots: {:?})", h.app.renderer.pending_slots()); let id = "check:settings.confirmDelete"; let target = h.app.widgets.iter().rev().find(|(widget, _)| widget == id).map(|(_, rect)| *rect).expect("the checkbox is on screen"); let before = h.app.ui.settings.confirm_delete; @@ -1096,13 +1137,14 @@ fn an_overlay_that_appears_after_the_press_cancels_the_release() { /// cleanup moved 8 px to suppress the click, which could start a drag and change a slider/curve. #[test] fn canceling_a_pressed_slider_releases_it_without_dragging_it() { - let mut h = Headless::new(app(), [1400.0, 900.0], 1.0); + let files = SyntheticLibrary::new("canceled-pressed-slider"); + let mut h = Headless::new(files.app(), [1400.0, 900.0], 1.0); let photo = h.app.session.visible_cloned()[0]; let t = Duration::from_secs(20); assert_eq!(h.request("engine.execute", serde_json::json!({"command": "library.select", "params": {"ids": [photo.0]}}), t)["ok"], true); assert_eq!(h.request("ui.set", serde_json::json!({"view": "detail", "right": "edit"}), t)["ok"], true); h.app.ui.open_sections = vec!["light".to_string()]; - assert!(h.settle(Duration::from_secs(60)), "the edit panel settles"); + assert!(h.settle(Duration::from_secs(60)), "the edit panel settles (pending slots: {:?})", h.app.renderer.pending_slots()); let id = "slider:light.exposure"; let target = h.app.widgets.iter().rev().find(|(widget, _)| widget == id).map(|(_, rect)| *rect).expect("the slider is on screen"); let before = h.app.session.develop_of(photo).expect("its develop settings").light.exposure; @@ -1136,11 +1178,12 @@ fn canceling_a_pressed_slider_releases_it_without_dragging_it() { /// makes the target invisible too: the release is refused rather than clicking through it. #[test] fn a_nonprompt_overlay_that_appears_after_the_press_cancels_the_release() { - let mut h = Headless::new(app(), [1000.0, 760.0], 1.0); + let files = SyntheticLibrary::new("nonprompt-overlay-after-press"); + let mut h = Headless::new(files.app(), [1000.0, 760.0], 1.0); h.step(); let t = Duration::from_secs(20); assert_eq!(h.request("ui.key", serde_json::json!({"key": ",", "cmd": true}), t)["ok"], true); - assert!(h.settle(Duration::from_secs(60)), "the Settings dialog settles"); + assert!(h.settle(Duration::from_secs(60)), "the Settings dialog settles (pending slots: {:?})", h.app.renderer.pending_slots()); let id = "check:settings.confirmDelete"; let target = h.app.widgets.iter().rev().find(|(widget, _)| widget == id).map(|(_, rect)| *rect).expect("the checkbox is on screen"); let before = h.app.ui.settings.confirm_delete; @@ -1184,11 +1227,12 @@ fn a_nonprompt_overlay_that_appears_after_the_press_cancels_the_release() { /// `ui.clickWidget` counterpart of the press/release cancellation above. #[test] fn a_library_problem_overlay_blocks_a_control_click_in_settings() { - let mut h = Headless::new(app(), [1000.0, 760.0], 1.0); + let files = SyntheticLibrary::new("library-overlay-settings-click"); + let mut h = Headless::new(files.app(), [1000.0, 760.0], 1.0); let t = Duration::from_secs(20); h.step(); assert!(h.app.run("app.settings", serde_json::json!({})).is_ok(), "Settings opens"); - assert!(h.settle(Duration::from_secs(60)), "Settings settles"); + assert!(h.settle(Duration::from_secs(60)), "Settings settles (pending slots: {:?})", h.app.renderer.pending_slots()); let id = "check:settings.confirmDelete"; let before = h.app.ui.settings.confirm_delete; h.app.library_problem = Some(crate::panels::library_problem::LibraryProblem::new("/no/such/library", "test error")); @@ -1476,10 +1520,15 @@ fn a_prompt_created_after_raw_input_hook_shields_a_held_background_press() { /// success after the prompt filters it. #[test] fn a_synthetic_press_already_delivered_is_canceled_by_a_prompt_created_after_raw_input_hook() { - let mut h = Headless::new(app(), [1200.0, 900.0], 1.0); + let files = SyntheticLibrary::new("press-after-raw-hook"); + let mut h = Headless::new(files.app(), [1200.0, 900.0], 1.0); h.step(); assert!(h.app.run("app.settings", serde_json::json!({})).is_ok(), "Settings opens"); - assert!(h.settle(Duration::from_secs(60)), "the Settings dialog settles before its target rect is captured"); + assert!( + h.settle(Duration::from_secs(60)), + "the Settings dialog settles before its target rect is captured (pending slots: {:?})", + h.app.renderer.pending_slots() + ); let id = "check:settings.confirmDelete"; let target = h.app.widgets.iter().rev().find(|(widget, _)| widget == id).map(|(_, rect)| *rect).expect("the checkbox is on screen"); let before = h.app.ui.settings.confirm_delete; @@ -1512,13 +1561,14 @@ fn a_synthetic_press_already_delivered_is_canceled_by_a_prompt_created_after_raw /// stay unchanged. #[test] fn raw_background_gestures_at_a_settled_prompt_do_not_reach_the_covered_view() { - let mut h = Headless::new(app(), [1400.0, 900.0], 1.0); + let files = SyntheticLibrary::new("raw-gestures-settled-prompt"); + let mut h = Headless::new(files.app(), [1400.0, 900.0], 1.0); let photo = h.app.session.visible_cloned()[0]; let t = Duration::from_secs(20); assert_eq!(h.request("engine.execute", serde_json::json!({"command": "library.select", "params": {"ids": [photo.0]}}), t)["ok"], true); assert_eq!(h.request("ui.set", serde_json::json!({"view": "detail", "right": "edit"}), t)["ok"], true); assert!(h.app.run("app.settings", serde_json::json!({})).is_ok(), "Settings opens"); - assert!(h.settle(Duration::from_secs(60)), "the detail view and Settings settle"); + assert!(h.settle(Duration::from_secs(60)), "the detail view and Settings settle (pending slots: {:?})", h.app.renderer.pending_slots()); let image = h.app.image_rect.expect("the detail image is on screen"); let at = image.min + egui::vec2(12.0, 12.0); let before = h.app.ui.settings.confirm_delete; @@ -1579,13 +1629,14 @@ fn a_prompt_keeps_key_releases_and_clears_held_keys() { /// moves/release are discarded, the pointer is released without a click, and the slider is intact. #[test] fn a_prompt_aborts_an_in_progress_synthetic_drag() { - let mut h = Headless::new(app(), [1400.0, 900.0], 1.0); + let files = SyntheticLibrary::new("prompt-aborts-drag"); + let mut h = Headless::new(files.app(), [1400.0, 900.0], 1.0); let photo = h.app.session.visible_cloned()[0]; let t = Duration::from_secs(20); assert_eq!(h.request("engine.execute", serde_json::json!({"command": "library.select", "params": {"ids": [photo.0]}}), t)["ok"], true); assert_eq!(h.request("ui.set", serde_json::json!({"view": "detail", "right": "edit"}), t)["ok"], true); h.app.ui.open_sections = vec!["light".to_string()]; - assert!(h.settle(Duration::from_secs(60)), "the edit panel settles"); + assert!(h.settle(Duration::from_secs(60)), "the edit panel settles (pending slots: {:?})", h.app.renderer.pending_slots()); let id = "slider:light.exposure"; let before = h.app.session.develop_of(photo).expect("its develop settings").light.exposure; let (tx, rx) = reply_channel(); @@ -1736,12 +1787,13 @@ fn a_settings_notice_blocks_background_input_and_its_ok_button_works() { #[test] fn clipping_changed_between_the_move_and_press_is_seen_in_the_latest_registry() { - let mut h = Headless::new(app(), [1400.0, 900.0], 1.0); + let files = SyntheticLibrary::new("clipping-changed"); + let mut h = Headless::new(files.app(), [1400.0, 900.0], 1.0); let photo = h.app.session.visible_cloned()[0]; let t = Duration::from_secs(20); assert_eq!(h.request("engine.execute", serde_json::json!({"command": "library.select", "params": {"ids": [photo.0]}}), t)["ok"], true); assert_eq!(h.request("ui.set", serde_json::json!({"view": "detail", "right": "edit"}), t)["ok"], true); - assert!(h.settle(Duration::from_secs(60)), "the detail view settles"); + assert!(h.settle(Duration::from_secs(60)), "the detail view settles (pending slots: {:?})", h.app.renderer.pending_slots()); let id = "star:bottom:2"; let (tx, rx) = reply_channel(); h.app.admit_gesture(&h.view.ctx.clone(), "ui.clickWidget".into(), serde_json::json!({"id": id}), tx).expect("the click is admitted"); @@ -1811,12 +1863,13 @@ fn queued_pointer_cleanup_requests_a_repaint_without_a_synthetic_event() { #[test] fn a_moved_widget_cancels_before_its_first_event_and_leaves_a_later_gesture_queued() { - let mut h = Headless::new(app(), [1000.0, 760.0], 1.0); + let files = SyntheticLibrary::new("moved-widget-queued"); + let mut h = Headless::new(files.app(), [1000.0, 760.0], 1.0); h.step(); let t = Duration::from_secs(20); let r = h.request("ui.key", serde_json::json!({"key": ",", "cmd": true}), t); assert_eq!(r["ok"], true, "{r}"); - assert!(h.settle(Duration::from_secs(60)), "the Settings dialog settles"); + assert!(h.settle(Duration::from_secs(60)), "the Settings dialog settles (pending slots: {:?})", h.app.renderer.pending_slots()); assert!(h.app.widgets.iter().any(|(id, _)| id == "check:settings.confirmDelete")); assert!(h.app.widgets.iter().any(|(id, _)| id == "button:settingsStartup-2")); @@ -1862,12 +1915,13 @@ fn a_moved_widget_cancels_before_its_first_event_and_leaves_a_later_gesture_queu #[test] fn a_click_whose_target_vanishes_after_the_press_fails_and_releases_the_pointer() { - let mut h = Headless::new(app(), [1000.0, 760.0], 1.0); + let files = SyntheticLibrary::new("target-vanishes"); + let mut h = Headless::new(files.app(), [1000.0, 760.0], 1.0); h.step(); let t = Duration::from_secs(20); let r = h.request("ui.key", serde_json::json!({"key": ",", "cmd": true}), t); assert_eq!(r["ok"], true, "{r}"); - assert!(h.settle(Duration::from_secs(60)), "the Settings dialog settles"); + assert!(h.settle(Duration::from_secs(60)), "the Settings dialog settles (pending slots: {:?})", h.app.renderer.pending_slots()); let before = h.app.ui.settings.confirm_delete; let (tx, rx) = reply_channel(); @@ -2053,11 +2107,12 @@ fn disclosure_rows_publish_expanded_not_toggled() { /// widget was clipped before delivery is refused, as is one under the non-modal library window. #[test] fn hover_widget_refuses_clipped_and_covered_targets() { - let mut h = Headless::new(app(), [1200.0, 900.0], 1.0); + let files = SyntheticLibrary::new("hover-refuses-clipped"); + let mut h = Headless::new(files.app(), [1200.0, 900.0], 1.0); let t = Duration::from_secs(20); h.step(); assert!(h.app.run("app.settings", serde_json::json!({})).is_ok(), "Settings opens"); - assert!(h.settle(Duration::from_secs(60)), "Settings settles"); + assert!(h.settle(Duration::from_secs(60)), "Settings settles (pending slots: {:?})", h.app.renderer.pending_slots()); let id = "check:settings.confirmDelete"; assert!(h.app.widget_hits.iter().any(|(widget, _)| widget == id), "{id} has a probe"); diff --git a/crates/ui-egui/src/tests/panels.rs b/crates/ui-egui/src/tests/panels.rs index 96b0a1a9d6..569a12910c 100644 --- a/crates/ui-egui/src/tests/panels.rs +++ b/crates/ui-egui/src/tests/panels.rs @@ -2206,7 +2206,13 @@ fn recognise_faces_stays_off_until_a_model_is_chosen() { let dir = std::env::temp_dir().join(format!("lc-ui-faces-toggle-{}", std::process::id())); let _ = std::fs::remove_dir_all(&dir); std::fs::create_dir_all(&dir).unwrap(); - h.app.session.face_models_dir = Some(dir.join("models")); + // This tests the recognition toggle, not GPU attachment. Seed the fresh fixture before + // loading a model; the mutation command also detaches the process-wide detector. + let models = dir.join("models"); + std::fs::create_dir_all(&models).unwrap(); + std::fs::write(models.join("settings.json"), br#"{"cpuOnly":true}"#).unwrap(); + h.app.session.face_models_dir = Some(models); + assert_eq!(h.app.session.execute("faces.gpu", &json!({})).unwrap()["cpuOnly"], true); let r = h.request("engine.execute", json!({"command": "app.settings", "params": {"tab": "faces"}}), T); assert_eq!(r["ok"], true, "{r}"); h.settle(SETTLE); diff --git a/crates/ui-egui/src/tests/preset_import.rs b/crates/ui-egui/src/tests/preset_import.rs index 7a1abf6ee9..0ed804a589 100644 --- a/crates/ui-egui/src/tests/preset_import.rs +++ b/crates/ui-egui/src/tests/preset_import.rs @@ -12,9 +12,10 @@ const T: Duration = Duration::from_secs(20); const SETTLE: Duration = Duration::from_secs(120); fn app() -> Headless { - let app = LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() }); + // Profile import needs no photos. Avoid unrelated demo renders while testing its notice. + let app = LightcraftApp::new(lightcraft_engine::Session::new(), Services { png: None, ..Default::default() }); let mut h = Headless::new(app, [1200.0, 800.0], 1.0); - h.settle(SETTLE); + assert!(h.settle(SETTLE), "the empty library settles before importing profiles"); h } @@ -27,9 +28,9 @@ fn temp_dir(tag: &str) -> std::path::PathBuf { fn import(h: &mut Headless, paths: &[&std::path::Path]) -> serde_json::Value { let paths: Vec = paths.iter().map(|p| p.to_string_lossy().to_string()).collect(); - let r = h.request("engine.execute", json!({"command": "file.importPresets", "params": {"paths": paths}}), T); - h.settle(SETTLE); - r + // Import and its toast complete synchronously before the control reply. Settling + // unrelated rendering afterwards advances simulated time and can expire the notice. + h.request("engine.execute", json!({"command": "file.importPresets", "params": {"paths": paths}}), T) } fn toast(h: &Headless) -> String { diff --git a/crates/ui-egui/src/tests/preview_limit.rs b/crates/ui-egui/src/tests/preview_limit.rs index e87e523551..07a30c8a58 100644 --- a/crates/ui-egui/src/tests/preview_limit.rs +++ b/crates/ui-egui/src/tests/preview_limit.rs @@ -137,23 +137,26 @@ fn saved_limits_round_trip_and_unknown_ones_are_reset() { // ---- Behaviour in the running UI ------------------------------------------------------------- mod in_the_loupe { + use std::cell::RefCell; + use std::rc::Rc; use std::time::Duration; use serde_json::json; use crate::headless::Headless; - use crate::render::Slot; + use crate::render::{RenderOffload, Renderer, Slot}; + use crate::tests_render_fixtures::{HEIGHT, LONG_EDGE, RenderFixture, WIDTH}; use crate::{LightcraftApp, Services}; + use lightcraft_engine::SourceLevel; + use lightcraft_engine::media::{RenderJob, RenderResult, SourceRef}; const T: Duration = Duration::from_secs(20); const SETTLE: Duration = Duration::from_secs(120); - /// The demo library in a 1400×900 window, the first photo open in Detail. - fn detail() -> (Headless, usize) { - detail_in([1400.0, 900.0]) - } - - fn detail_in(size: [f32; 2]) -> (Headless, usize) { + /// The original 24 MP procedural demo library in a 1400×900 window, the first photo open + /// in Detail. Kept for `profile_slider_drag`, whose meaning depends on the demo's render cost + /// and neighbour prefetch. + fn demo_detail_in(size: [f32; 2]) -> (Headless, usize) { let services = Services { png: None, ..Default::default() }; let app = LightcraftApp::new(lightcraft_engine::Session::with_demo(), services); let mut h = Headless::new(app, size, 1.0); @@ -168,6 +171,34 @@ mod in_the_loupe { (h, native) } + /// Two real 6000×4000 file-backed photos in a 1400×900 window, the first open in Detail. + /// Destructure the returned tuple immediately, binding the fixture before `Headless`, so the + /// app drops first. Keeping the tuple intact would drop its fixture field first. + fn detail() -> (RenderFixture, Headless, usize) { + detail_in([1400.0, 900.0]) + } + + fn detail_in(size: [f32; 2]) -> (RenderFixture, Headless, usize) { + detail_with(RenderFixture::new("preview", 2), size) + } + + fn detail_with(fixture: RenderFixture, size: [f32; 2]) -> (RenderFixture, Headless, usize) { + let services = Services { png: None, ..Default::default() }; + let app = LightcraftApp::new(fixture.session(), services); + let mut h = Headless::new(app, size, 1.0); + let r = h.request("ui.set", json!({"view": "detail", "right": "none", "filmstrip": false}), T); + assert_eq!(r["ok"], true, "{r}"); + h.settle(SETTLE); + let (native, dims) = { + let id = h.app.session.active().expect("a photo is open"); + let p = h.app.session.catalog.photo(id).expect("it is in the catalog"); + (p.width.max(p.height) as usize, (p.width, p.height)) + }; + assert_eq!(dims, (WIDTH, HEIGHT), "the render fixture is a real 24 MP landscape 3:2 photo"); + assert_eq!(native, LONG_EDGE, "the render fixture is a real 24 MP photo"); + (fixture, h, native) + } + fn rendered_long_edge(h: &Headless) -> usize { let t = h.app.renderer.textures.get(&Slot::Main).expect("the loupe rendered"); t.size[0].max(t.size[1]) @@ -178,7 +209,7 @@ mod in_the_loupe { // cut from the photo's own pixels #[test] fn one_to_one_is_a_canvas_sized_frame_plus_a_native_window() { - let (mut h, native) = detail(); + let (_fx, mut h, native) = detail(); h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); let main = rendered_long_edge(&h); @@ -195,7 +226,7 @@ mod in_the_loupe { // overlay swaps the window for one with the other look #[test] fn a_mask_overlay_at_one_to_one_is_a_window_and_keeps_zoom_and_pan() { - let (mut h, native) = detail(); + let (_fx, mut h, native) = detail(); for (command, params) in [("panel.masking", json!({})), ("mask.add", json!({"kind": "radial", "center": [0.4, 0.5], "rx": 0.2, "ry": 0.2}))] { let r = h.request("engine.execute", json!({"command": command, "params": params}), T); assert_eq!(r["ok"], true, "{command}: {r}"); @@ -233,7 +264,7 @@ mod in_the_loupe { // size (slower, and its detail stops at the frame render's resolution) #[test] fn an_all_masks_overlay_at_one_to_one_is_a_window() { - let (mut h, native) = detail(); + let (_fx, mut h, native) = detail(); for (command, params) in [ ("panel.masking", json!({})), ("mask.add", json!({"kind": "radial", "center": [0.4, 0.5], "rx": 0.2, "ry": 0.2})), @@ -266,7 +297,7 @@ mod in_the_loupe { // photo's full size; switching the proof off swaps the window back to the plain look #[test] fn soft_proofing_at_one_to_one_is_a_window() { - let (mut h, native) = detail(); + let (_fx, mut h, native) = detail(); h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); let plain = h.app.region_view.expect("a window render without the proof"); @@ -288,7 +319,7 @@ mod in_the_loupe { // window render carrying the overlay, over a canvas-sized whole frame, as without it #[test] fn visualize_spots_at_one_to_one_is_a_window() { - let (mut h, native) = detail(); + let (_fx, mut h, native) = detail(); h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); let plain = h.app.region_view.expect("a window render without the overlay"); @@ -306,7 +337,7 @@ mod in_the_loupe { // Given the user capped the preview at 1600 px, then 1:1 is rendered no larger than that #[test] fn an_explicit_limit_still_caps_one_to_one() { - let (mut h, native) = detail(); + let (_fx, mut h, native) = detail(); assert!(native > 1600, "the demo photo must be larger than the cap for this to mean anything (is {native})"); h.app.ui.settings.preview_limit = 1600; h.request("engine.execute", json!({"command": "view.zoom100"}), T); @@ -321,7 +352,7 @@ mod in_the_loupe { // Given a fit view, the whole-frame render is all there is: no second render, no original decoded #[test] fn a_fit_view_makes_no_window_render() { - let (h, _) = detail(); + let (_fx, h, _) = detail(); assert_eq!(region_tile(&h), None); assert_eq!(h.app.region_view, None); } @@ -330,7 +361,7 @@ mod in_the_loupe { // rendered on its own at the zoom scale and drawn over the whole-frame render #[test] fn a_capped_one_to_one_view_gets_a_sharp_window() { - let (mut h, native) = detail(); + let (_fx, mut h, native) = detail(); h.app.ui.settings.preview_limit = 1600; h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -345,7 +376,7 @@ mod in_the_loupe { // Given 800 % zoom (a frame of 48000 px), the window is rendered and bounded #[test] fn eight_to_one_renders_only_what_is_visible() { - let (mut h, native) = detail(); + let (_fx, mut h, native) = detail(); h.app.ui.zoom = crate::state::Zoom::Percent(800.0); h.settle(SETTLE); let (w, hh) = region_tile(&h).expect("a window render"); @@ -361,7 +392,7 @@ mod in_the_loupe { // same place of the frame (a shift, a flip or a wrong scale would not) #[test] fn the_window_lines_up_with_the_whole_frame_render() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.app.renderer.keep_pixels = true; h.app.ui.settings.preview_limit = 1600; h.request("engine.execute", json!({"command": "view.zoom100"}), T); @@ -369,26 +400,31 @@ mod in_the_loupe { let view = h.app.region_view.expect("a window render"); let tile = h.app.renderer.textures.get(&Slot::Region).and_then(|t| t.pixels.clone()).expect("tile pixels"); let main = h.app.renderer.textures.get(&Slot::Main).and_then(|t| t.pixels.clone()).expect("main pixels"); - let (mut sum, mut n) = (0.0f32, 0.0f32); - for j in (8..tile.size[1] - 8).step_by(37) { - for i in (8..tile.size[0] - 8).step_by(37) { - // the same point of the frame in the whole-frame render - let u = (view.window.x + i) as f32 / view.full.0 as f32; - let v = (view.window.y + j) as f32 / view.full.1 as f32; - let (mx, my) = - (((u * main.size[0] as f32) as usize).min(main.size[0] - 1), ((v * main.size[1] as f32) as usize).min(main.size[1] - 1)); - let (a, b) = (tile.pixels[j * tile.size[0] + i], main.pixels[my * main.size[0] + mx]); - sum += (0..3).map(|k| (a.to_array()[k] as f32 - b.to_array()[k] as f32).abs()).sum::() / 3.0; - n += 1.0; + let mean_difference = |offset: usize| { + let (mut sum, mut n) = (0.0f32, 0.0f32); + for j in (8..tile.size[1] - 8).step_by(37) { + for i in (8..tile.size[0] - 8).step_by(37) { + // the same point of the frame in the whole-frame render + let u = (view.window.x + i + offset) as f32 / view.full.0 as f32; + let v = (view.window.y + j) as f32 / view.full.1 as f32; + let (mx, my) = + (((u * main.size[0] as f32) as usize).min(main.size[0] - 1), ((v * main.size[1] as f32) as usize).min(main.size[1] - 1)); + let (a, b) = (tile.pixels[j * tile.size[0] + i], main.pixels[my * main.size[0] + mx]); + sum += (0..3).map(|k| (a.to_array()[k] as f32 - b.to_array()[k] as f32).abs()).sum::() / 3.0; + n += 1.0; + } } - } - assert!(sum / n < 6.0, "mean difference {:.2} / 255 between the window and the frame render", sum / n); + sum / n + }; + let difference = mean_difference(0); + assert!(difference < 6.0, "mean difference {:.2} / 255 between the window and the frame render", difference); + assert!(mean_difference(16) > 6.0, "the fixture must expose a 16-pixel horizontal misalignment"); } // Given a Fit view, a slider drag (whose Main draft is at 0.6 scale) does not start window renders #[test] fn a_slider_drag_at_fit_makes_no_window_render() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.app.session.begin_interaction("Exposure").unwrap(); for _ in 0..5 { h.step(); @@ -400,7 +436,7 @@ mod in_the_loupe { // Given a zoomed view with a window render, when I zoom back to Fit, then the window's texture is freed #[test] fn the_window_texture_is_freed_when_it_is_not_needed() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.app.ui.settings.preview_limit = 1600; h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -415,7 +451,7 @@ mod in_the_loupe { // too (while one is held the app never counts as idle and keeps the GPU copy of the original) #[test] fn leaving_a_zoomed_detail_view_frees_its_windows() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.app.ui.before_after = crate::state::BeforeAfter::SideBySide; h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -430,7 +466,7 @@ mod in_the_loupe { // is no longer current and is replaced by one for the new look #[test] fn an_edit_replaces_the_window() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.app.ui.settings.preview_limit = 1600; h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -446,7 +482,7 @@ mod in_the_loupe { // Given a photo with spot removal, a zoomed view still gets its sharp window #[test] fn a_photo_with_spots_gets_a_window_too() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); let id = h.app.session.active().unwrap(); let mut s = (*h.app.session.develop_of(id).unwrap()).clone(); s.spots.push(lightcraft_develop::Spot { @@ -466,7 +502,7 @@ mod in_the_loupe { // I zoom to 1:1 and 8:1, then no texture the loupe holds is larger than that #[test] fn no_loupe_texture_exceeds_the_gpu_limit() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.max_texture_side = 2048; h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -486,7 +522,7 @@ mod in_the_loupe { // the whole canvas: no strip of the magnified whole-frame render beside it #[test] fn a_window_covers_a_canvas_wider_than_2048_px() { - let (mut h, native) = detail_in([2600.0, 1200.0]); + let (_fx, mut h, native) = detail_in([2600.0, 1200.0]); assert!(native > 2600, "the photo is wider than the canvas at 1:1: {native}"); h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -507,7 +543,7 @@ mod in_the_loupe { // canvas, not the zoom: a draft of the whole frame at canvas scale and a draft of the window #[test] fn a_slider_drag_when_zoomed_in_renders_canvas_sized_drafts() { - let (mut h, native) = detail(); + let (_fx, mut h, native) = detail(); h.app.ui.zoom = crate::state::Zoom::Percent(400.0); h.settle(SETTLE); h.app.session.begin_interaction("Exposure").unwrap(); @@ -542,7 +578,7 @@ mod in_the_loupe { // the GPU device up front (the loupe never waits for it): with one, it is the earlier // drag's time that makes this drag small let _ = lightcraft_engine::gpu::available(); - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); let id = h.app.session.active().expect("a photo is open"); h.app.drag_scale.remember_slow(id, "Exposure"); let (main, small) = drag_exposure(&mut h); @@ -556,7 +592,7 @@ mod in_the_loupe { // the GPU device up front (the loupe never waits for it): with one, this is the case where // the GPU is there and the render still goes to the CPU let _ = lightcraft_engine::gpu::available(); - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); let lut = lightcraft_pipeline::ProofLut::new(2, vec![[0.5, 0.5, 0.5, 0.0]; 8]).expect("a valid table"); h.app.ui.proof.profile = lightcraft_pipeline::register_proof_profile(0x5eed_9f01, lut); h.app.ui.soft_proof = true; @@ -573,7 +609,7 @@ mod in_the_loupe { // Before is not a 2560 px stand-in beside a full resolution After #[test] fn side_by_side_at_one_to_one_compares_like_with_like() { - let (mut h, native) = detail(); + let (_fx, mut h, native) = detail(); h.app.ui.before_after = crate::state::BeforeAfter::SideBySide; h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -592,7 +628,7 @@ mod in_the_loupe { // beside the After's); both windows still arrive #[test] fn side_by_side_at_one_to_one_decodes_the_original_once() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); let id = h.app.session.active().expect("a photo is open"); h.app.ui.before_after = crate::state::BeforeAfter::SideBySide; h.app.ui.zoom = crate::state::Zoom::Percent(100.0); @@ -612,7 +648,7 @@ mod in_the_loupe { // Given the Before view alone (\), only the Before gets a window #[test] fn the_original_view_windows_only_the_before() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.app.ui.before_after = crate::state::BeforeAfter::Original; h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -624,7 +660,7 @@ mod in_the_loupe { // Given a wipe (Split), both sides are windows, drawn over the same rect #[test] fn a_wipe_windows_both_sides() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.app.ui.before_after = crate::state::BeforeAfter::Split; h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -635,7 +671,7 @@ mod in_the_loupe { // Given the Before view turned off, its window is freed #[test] fn leaving_before_after_frees_the_before_window() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.app.ui.before_after = crate::state::BeforeAfter::SideBySide; h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -651,7 +687,7 @@ mod in_the_loupe { // no stream of renders of every size in between, and the sharp window arrives once it stops #[test] fn a_pinch_holds_the_render_sizes_until_it_stops() { - let (mut h, native) = detail(); + let (_fx, mut h, native) = detail(); let main_at_fit = rendered_long_edge(&h); let at = h.app.canvas_rect.unwrap().center(); h.request("ui.move", json!({"x": at.x, "y": at.y}), T); @@ -674,7 +710,7 @@ mod in_the_loupe { // differently, #280), no window is rendered: its coordinates are the frame's #[test] fn no_window_over_a_picture_that_is_not_the_frame() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); assert!(h.app.region_view.is_some()); @@ -699,7 +735,7 @@ mod in_the_loupe { ([2800.0, 1700.0], 400.0, false), ([1400.0, 900.0], 100.0, true), ] { - let (mut h, native) = detail_in(size); + let (mut h, native) = demo_detail_in(size); h.app.ui.soft_proof = proof; h.app.ui.zoom = if percent == 0.0 { crate::state::Zoom::Fit } else { crate::state::Zoom::Percent(percent) }; h.settle(SETTLE); @@ -739,25 +775,188 @@ mod in_the_loupe { } } - // Given a slider drag that outpaces the renders (each tick supersedes the last), the original - // the window was cut from is kept once it is decoded: not decoded again for every tick - #[test] - fn a_drag_keeps_the_decoded_original_even_when_every_result_is_superseded() { - let (mut h, _) = detail(); - assert_eq!(h.app.session.memory_report().full_source.bytes, 0, "fit needed no original"); - h.app.ui.zoom = crate::state::Zoom::Percent(400.0); - h.app.session.begin_interaction("Exposure").unwrap(); - let mut ticks = 0; - let deadline = std::time::Instant::now() + std::time::Duration::from_secs(60); - while !h.app.renderer.textures.contains_key(&Slot::Region) && std::time::Instant::now() < deadline { - let v = (ticks % 40) as f64 * 0.02; - h.request("engine.execute", json!({"command": "develop.set", "params": {"control": "light.exposure", "value": v}}), T); + /// Work held by a test offload. [`RegionGate`] keeps `Slot::Region` jobs here; [`Held`] + /// keeps every job. `finished` is what the renderer's next `poll` collects. + #[derive(Default)] + struct OffloadWork { + jobs: Vec, + finished: Vec<(Slot, RenderResult, f64)>, + } + + fn take_job(work: &Rc>) -> RenderJob { + let mut w = work.borrow_mut(); + assert!(!w.jobs.is_empty(), "a render job was handed to the offload"); + w.jobs.remove(0) + } + + /// The next window job the UI asked for, stepping a few frames if the request is still a frame + /// away (deterministic frames, no wall-clock wait). + fn next_region_job(h: &mut Headless, work: &Rc>) -> RenderJob { + for _ in 0..3 { + if !work.borrow().jobs.is_empty() { + break; + } h.step(); - ticks += 1; - std::thread::sleep(std::time::Duration::from_millis(5)); } - assert!(h.app.renderer.textures.contains_key(&Slot::Region), "a window arrived"); - assert!(h.app.session.memory_report().full_source.bytes > 0, "the original stayed in the cache while the drag went on"); + take_job(work) + } + + fn deliver(work: &Rc>, slot: Slot, result: RenderResult) { + work.borrow_mut().finished.push((slot, result, 0.0)); + } + + /// Holds the window jobs and runs every other job synchronously, returning it through + /// `finished`: the UI keeps its real `request_window` / `defer_window` / draft path, but the + /// window's original has not arrived until the test says so. + struct RegionGate(Rc>); + + impl RenderOffload for RegionGate { + fn try_start(&mut self, slot: Slot, job: RenderJob) -> Option { + if slot == Slot::Region { + self.0.borrow_mut().jobs.push(job); + } else { + let result = job.run(); + self.0.borrow_mut().finished.push((slot, result, 0.0)); + } + None + } + + fn finished(&mut self) -> Vec<(Slot, RenderResult, f64)> { + std::mem::take(&mut self.0.borrow_mut().finished) + } + } + + /// Holds every job for the test to run and deliver explicitly (the standalone collector test). + struct Held(Rc>); + + impl RenderOffload for Held { + fn try_start(&mut self, _slot: Slot, job: RenderJob) -> Option { + self.0.borrow_mut().jobs.push(job); + None + } + + fn finished(&mut self) -> Vec<(Slot, RenderResult, f64)> { + std::mem::take(&mut self.0.borrow_mut().finished) + } + } + + // Given a 400 % view of a real 24 MP photo, when the first window is decoded and accepted and + // later drag ticks supersede each other, then the original stays in the cache and every later + // window is cut from it. The first accepted result is the actual Detail wiring's job: the + // window `request_window` asked for (respecting `defer_window`), drafted while the drag runs. + #[test] + fn a_drag_keeps_the_decoded_original_after_the_window_is_accepted() { + let (_fx, mut h, native) = detail(); + let id = h.app.session.active().expect("a photo"); + assert_eq!(native, WIDTH as usize); + assert_eq!(h.app.session.memory_report().full_source.bytes, 0, "fit needed no original"); + h.app.session.media.set_on_screen(Some(id)); + let work = Rc::new(RefCell::new(OffloadWork::default())); + h.app.renderer.set_offload(Box::new(RegionGate(work.clone()))); + let discarded = h.app.renderer.discarded; + h.app.ui.zoom = crate::state::Zoom::Percent(400.0); + h.app.session.begin_interaction("Exposure").expect("a drag"); + + let first = next_region_job(&mut h, &work); + let (first_key, first_request) = (first.key, first.request_id); + let view = h.app.region_view.expect("Detail asked for a window"); + assert_eq!(view.photo, id); + assert_eq!(view.full, (WIDTH as usize, HEIGHT as usize), "at 400 % the window's frame is the photo's own pixels"); + assert!(view.window.w >= 1300 && view.window.h >= 700, "the window covers the canvas: {:?}", view.window); + assert!(view.window.x + view.window.w <= view.full.0 && view.window.y + view.window.h <= view.full.1, "inside the frame: {:?}", view.window); + assert_eq!(first.request.window, Some(view.window), "the job is the window on screen"); + assert_eq!((first.request.max_w, first.request.max_h), view.full, "the job renders the frame the view uses"); + assert_eq!(first.request.quality, lightcraft_pipeline::Quality::Draft, "a drag drafts the window"); + assert_eq!(first.level, SourceLevel::Full); + assert!(matches!(&first.source, SourceRef::File { .. }), "the first window decodes the real file"); + assert_ne!(first_request, 0, "the renderer gave the request its own identity"); + + // An edit changes the desired window key while the first original is still held. + // Detail must defer a second decode until this first result has populated the cache. + let reply = h.request("engine.execute", json!({"command": "develop.set", "params": {"control": "light.exposure", "value": 0.5}}), T); + assert_eq!(reply["ok"], true); + h.step(); + assert!(work.borrow().jobs.is_empty(), "a changed window waits for the first original"); + assert_eq!(h.app.renderer.wanted(Slot::Region), Some(first_key)); + assert_eq!(h.app.session.memory_report().full_source.bytes, 0); + + deliver(&work, Slot::Region, first.run()); + h.step(); + assert!(h.app.region_view.is_some()); + assert_eq!(h.app.renderer.textures.get(&Slot::Region).map(|t| t.key), Some(first_key), "the first window arrived"); + assert!(h.app.session.memory_report().full_source.bytes >= WIDTH as usize * HEIGHT as usize * 3 * 4); + assert!(h.app.session.media.has_source(id, SourceLevel::Full), "the original was accepted before any supersession"); + + let second = next_region_job(&mut h, &work); + let (second_key, second_request) = (second.key, second.request_id); + assert_ne!(second_key, first_key); + assert_ne!(second_request, first_request); + assert_eq!(h.app.renderer.wanted(Slot::Region), Some(second_key), "the newer window is pending"); + assert!(matches!(&second.source, SourceRef::Loaded(_)), "the newer window reuses the accepted original"); + + let reply = h.request("engine.execute", json!({"command": "develop.set", "params": {"control": "light.exposure", "value": 1.0}}), T); + assert_eq!(reply["ok"], true); + let third = next_region_job(&mut h, &work); + assert_ne!(third.key, second_key); + assert_eq!(h.app.renderer.wanted(Slot::Region), Some(third.key)); + + deliver(&work, Slot::Region, second.run()); + h.step(); + assert_eq!(h.app.renderer.textures.get(&Slot::Region).map(|t| t.key), Some(second_key), "the superseded draft still reached the screen"); + assert_eq!(h.app.renderer.wanted(Slot::Region), Some(third.key), "the newest request is still pending"); + assert_eq!(h.app.renderer.discarded, discarded, "the superseded draft was accepted, not discarded"); + assert!(h.app.session.memory_report().full_source.bytes >= WIDTH as usize * HEIGHT as usize * 3 * 4); + assert!(matches!(&third.source, SourceRef::Loaded(_)), "the pending window still reuses the original"); + } + + // The collector's accept branch on its own: a superseded window result still carries the + // original it decoded, and `Renderer::poll` must insert it (`session.accept(&r)` at + // render.rs:911) although a newer request for the same slot is pending. The Detail wiring + // above can only reach this once the first original is held; this standalone test proves the + // cache reuse without depending on UI timing. + #[test] + fn a_superseded_window_result_keeps_the_original_it_decoded() { + let fixture = RenderFixture::new("preview-limit-superseded", 1); + let mut session = fixture.session(); + let id = session.active().expect("a photo"); + session.media.set_on_screen(Some(id)); + let (full_w, full_h) = (WIDTH as usize, HEIGHT as usize); + let window = lightcraft_pipeline::PixelWindow { x: 1000, y: 800, w: 1300, h: 700 }; + let next_window = lightcraft_pipeline::PixelWindow { x: 1200, y: 800, w: 1300, h: 700 }; + let mut renderer = Renderer::with_worker_threads(1); + let work = Rc::new(RefCell::new(OffloadWork::default())); + renderer.set_offload(Box::new(Held(work.clone()))); + let ctx = egui::Context::default(); + + let first = session.region_job(id, full_w, full_h, window, true).expect("the first window"); + renderer.request(Slot::Region, first, 100); + let first = take_job(&work); + let old_key = first.key; + let old_request = first.request_id; + + let second = session.region_job(id, full_w, full_h, next_window, true).expect("the newer window"); + renderer.request(Slot::Region, second, 100); + let second = take_job(&work); + let new_key = second.key; + assert_ne!(new_key, old_key, "the newer window has its own identity"); + assert_eq!(renderer.wanted(Slot::Region), Some(new_key)); + + let old = first.run(); + assert!(old.rendered.is_ok(), "{:?}", old.rendered.as_ref().err()); + assert_eq!(old.request_id, old_request); + assert_eq!(old.level, SourceLevel::Full); + let loaded = old.loaded.as_ref().expect("the first window decoded the original"); + assert_eq!((loaded.image.width, loaded.image.height), (WIDTH as usize, HEIGHT as usize)); + deliver(&work, Slot::Region, old); + renderer.poll(&ctx, &mut session); + + assert_eq!(renderer.textures.get(&Slot::Region).map(|t| t.key), Some(old_key)); + assert_eq!(renderer.wanted(Slot::Region), Some(new_key)); + assert_eq!(renderer.discarded, 0, "the superseded result was accepted, not discarded"); + assert!(session.memory_report().full_source.bytes >= full_w * full_h * 3 * 4); + assert!(session.media.has_source(id, SourceLevel::Full)); + let reused = session.region_job(id, full_w, full_h, window, true).expect("another window"); + assert!(matches!(&reused.source, SourceRef::Loaded(_)), "the accepted original is reused"); } // Given an original bigger than the cache budget (a 64 MP raw's 797 MB exceeds the default @@ -765,7 +964,7 @@ mod in_the_loupe { // grid it is let go #[test] fn a_zoomed_original_over_the_budget_stays_until_the_view_changes() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.app.session.media.set_budget(16 << 20); h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -794,7 +993,7 @@ mod in_the_loupe { #[test] fn a_wipe_paints_the_before_window_over_its_stand_in() { for mode in [crate::state::BeforeAfter::Split, crate::state::BeforeAfter::SplitTopBottom] { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.app.ui.before_after = mode; h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -821,7 +1020,7 @@ mod in_the_loupe { // everywhere (not only left of the line) #[test] fn holding_backslash_in_a_wipe_paints_the_before_window_across_the_canvas() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.app.ui.before_after = crate::state::BeforeAfter::Split; h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -848,7 +1047,7 @@ mod in_the_loupe { // margin (a window is wider than what its pane shows) does not spill into the neighbour #[test] fn side_by_side_windows_stay_in_their_panes() { - let (mut h, _) = detail_in([1800.0, 900.0]); + let (_fx, mut h, _) = detail_in([1800.0, 900.0]); h.app.ui.before_after = crate::state::BeforeAfter::SideBySide; h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -864,7 +1063,7 @@ mod in_the_loupe { // apart: the job key is the same, and one tile must not replace the other #[test] fn identical_before_and_after_keep_a_tile_each() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.app.ui.before_after = crate::state::BeforeAfter::SideBySide; h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -875,7 +1074,7 @@ mod in_the_loupe { // to the whole frame at the drawn size, and tries windows again when the look changes #[test] fn a_refused_window_falls_back_to_a_full_size_render() { - let (mut h, native) = detail(); + let (_fx, mut h, native) = detail(); h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); assert!(h.app.region_view.is_some()); @@ -894,7 +1093,7 @@ mod in_the_loupe { // pinch stops: a new, ever wider window every frame is not asked for #[test] fn pinching_out_asks_for_no_new_windows() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.app.ui.zoom = crate::state::Zoom::Percent(400.0); h.settle(SETTLE); let key = h.app.region_view.expect("a window").key; @@ -910,7 +1109,7 @@ mod in_the_loupe { // slider drag still reuses them: they are not cleared every frame #[test] fn a_drag_over_the_stage_budget_does_not_clear_the_open_views() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.app.ui.zoom = crate::state::Zoom::Percent(100.0); h.settle(SETTLE); let held = |h: &Headless| { @@ -947,7 +1146,7 @@ mod in_the_loupe { // whole-frame render, magnified and blurred, was shown) #[test] fn a_display_profile_keeps_the_sharp_window_at_one_to_one() { - let (mut h, native) = detail(); + let (_fx, mut h, native) = detail(); use_display_profile(&mut h); h.request("engine.execute", json!({"command": "view.zoom100"}), T); h.settle(SETTLE); @@ -963,7 +1162,7 @@ mod in_the_loupe { // …and in Compare, each pane's window too #[test] fn a_display_profile_keeps_the_compare_windows_at_one_to_one() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); use_display_profile(&mut h); let r = h.request("engine.execute", json!({"command": "view.compare"}), T); assert_eq!(r["ok"], true, "{r}"); @@ -982,7 +1181,7 @@ mod in_the_loupe { // a display #[test] fn with_the_screen_profile_the_window_is_drawn() { - let (mut h, native) = detail(); + let (_fx, mut h, native) = detail(); h.app.services.screen_profile = Some(Box::new(|| Some(lightcraft_codecs::icc::write_named(lightcraft_codecs::NamedSpace::DisplayP3)))); h.step(); assert!(h.app.ui.settings.display_profile.is_empty(), "no profile chosen"); @@ -1000,20 +1199,20 @@ mod in_the_loupe { /// RAM or more: room for both panes' 24 MP originals (288 MB each as linear float). const COMPARE_CACHE: usize = 768 << 20; - /// Compare view of the demo library at `zoom`, settled. + /// Compare view of the render fixture at `zoom`, settled. /// /// The session's cache budget is set here rather than taken from the process-wide memory /// budget, which other tests change while they run (Settings ▸ Performance ▸ 1 GB leaves a /// 512 MiB share, too small for two originals, so one pane's was evicted). - fn compare_at(zoom: crate::state::Zoom) -> Headless { - let (mut h, _) = detail(); + fn compare_at(zoom: crate::state::Zoom) -> (RenderFixture, Headless) { + let (fixture, mut h, _) = detail(); h.app.session.media.set_budget(COMPARE_CACHE); let r = h.request("engine.execute", json!({"command": "view.compare"}), T); assert_eq!(r["ok"], true, "{r}"); assert_eq!(h.app.ui.view, crate::state::ViewMode::Compare); h.app.ui.zoom = zoom; h.settle(SETTLE); - h + (fixture, h) } fn native_of(h: &Headless, id: lightcraft_catalog::PhotoId) -> usize { @@ -1025,7 +1224,7 @@ mod in_the_loupe { // cut from its own photo's pixels, not the 2560 px whole-frame render magnified #[test] fn compare_at_one_to_one_gets_a_sharp_window_per_pane() { - let h = compare_at(crate::state::Zoom::Percent(100.0)); + let (_fx, h) = compare_at(crate::state::Zoom::Percent(100.0)); let (sel, cand) = h.app.ui.compare.map(|(a, b)| (lightcraft_catalog::PhotoId(a), lightcraft_catalog::PhotoId(b))).expect("a pair"); for (i, id) in [(0u8, sel), (1u8, cand)] { let whole = h.app.renderer.textures.get(&Slot::Compare(i)).expect("the whole-frame render"); @@ -1043,7 +1242,7 @@ mod in_the_loupe { // Given Compare at fit, nothing more is rendered than before windows #[test] fn compare_at_fit_makes_no_window() { - let h = compare_at(crate::state::Zoom::Fit); + let (_fx, h) = compare_at(crate::state::Zoom::Fit); assert_eq!(h.app.compare_windows, [None, None]); assert!(!h.app.renderer.textures.contains_key(&Slot::CompareRegion(0)) && !h.app.renderer.textures.contains_key(&Slot::CompareRegion(1))); } @@ -1052,7 +1251,7 @@ mod in_the_loupe { // are freed, and back in Detail only one original is kept decoded #[test] fn leaving_a_zoomed_compare_frees_its_windows() { - let mut h = compare_at(crate::state::Zoom::Percent(100.0)); + let (_fx, mut h) = compare_at(crate::state::Zoom::Percent(100.0)); assert!(h.app.renderer.textures.contains_key(&Slot::CompareRegion(1))); h.app.ui.zoom = crate::state::Zoom::Fit; h.settle(SETTLE); @@ -1072,7 +1271,7 @@ mod in_the_loupe { // at the same place of the frame, and it is painted over that render, inside the pane #[test] fn a_compare_window_lines_up_with_its_pane() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); h.app.renderer.keep_pixels = true; h.request("engine.execute", json!({"command": "view.compare"}), T); h.app.ui.zoom = crate::state::Zoom::Percent(100.0); @@ -1082,19 +1281,24 @@ mod in_the_loupe { let view = h.app.compare_windows[i as usize].expect("a window"); let tile = h.app.renderer.textures.get(&Slot::CompareRegion(i)).and_then(|t| t.pixels.clone()).expect("tile pixels"); let main = h.app.renderer.textures.get(&Slot::Compare(i)).and_then(|t| t.pixels.clone()).expect("pane pixels"); - let (mut sum, mut n) = (0.0f32, 0.0f32); - for j in (8..tile.size[1] - 8).step_by(37) { - for x in (8..tile.size[0] - 8).step_by(37) { - let u = (view.window.x + x) as f32 / view.full.0 as f32; - let v = (view.window.y + j) as f32 / view.full.1 as f32; - let (mx, my) = - (((u * main.size[0] as f32) as usize).min(main.size[0] - 1), ((v * main.size[1] as f32) as usize).min(main.size[1] - 1)); - let (a, b) = (tile.pixels[j * tile.size[0] + x], main.pixels[my * main.size[0] + mx]); - sum += (0..3).map(|k| (a.to_array()[k] as f32 - b.to_array()[k] as f32).abs()).sum::() / 3.0; - n += 1.0; + let mean_difference = |offset: usize| { + let (mut sum, mut n) = (0.0f32, 0.0f32); + for j in (8..tile.size[1] - 8).step_by(37) { + for x in (8..tile.size[0] - 8).step_by(37) { + let u = (view.window.x + x + offset) as f32 / view.full.0 as f32; + let v = (view.window.y + j) as f32 / view.full.1 as f32; + let (mx, my) = + (((u * main.size[0] as f32) as usize).min(main.size[0] - 1), ((v * main.size[1] as f32) as usize).min(main.size[1] - 1)); + let (a, b) = (tile.pixels[j * tile.size[0] + x], main.pixels[my * main.size[0] + mx]); + sum += (0..3).map(|k| (a.to_array()[k] as f32 - b.to_array()[k] as f32).abs()).sum::() / 3.0; + n += 1.0; + } } - } - assert!(sum / n < 6.0, "pane {i}: mean difference {:.2} / 255 between the window and the pane's render", sum / n); + sum / n + }; + let difference = mean_difference(0); + assert!(difference < 6.0, "pane {i}: mean difference {:.2} / 255 between the window and the pane's render", difference); + assert!(mean_difference(16) > 6.0, "the fixture must expose a 16-pixel horizontal misalignment"); let (whole, window) = (drawn(&h, Slot::Compare(i)), drawn(&h, Slot::CompareRegion(i))); assert!(!whole.is_empty() && !window.is_empty(), "pane {i}: both are painted"); assert!(window[0].0 > whole[0].0, "pane {i}: the window is painted over the whole-frame render"); @@ -1109,7 +1313,7 @@ mod in_the_loupe { // drag on the active photo asks for no new window until it ends #[test] fn reference_view_at_one_to_one_gets_windows_and_a_drag_keeps_them() { - let (mut h, _) = detail(); + let (_fx, mut h, _) = detail(); let r = h.request("engine.execute", json!({"command": "photo.setReference"}), T); assert_eq!(r["ok"], true, "{r}"); let r = h.request("ui.key", json!({"key": "r", "shift": true}), T); diff --git a/crates/ui-egui/src/tests/print.rs b/crates/ui-egui/src/tests/print.rs index 25f7014ee1..68f3d328d0 100644 --- a/crates/ui-egui/src/tests/print.rs +++ b/crates/ui-egui/src/tests/print.rs @@ -8,6 +8,7 @@ use serde_json::{Value, json}; use crate::headless::Headless; use crate::state::Dialog; +use crate::tests_fixtures::SyntheticLibrary; use crate::{LightcraftApp, Services}; const T: Duration = Duration::from_secs(30); @@ -402,8 +403,14 @@ fn print_job_colour_controls_reach_the_job_and_the_pdf() { #[test] fn the_print_preview_does_not_rebuild_thumbnails_every_frame() { - let mut h = demo(Services { png: None, ..Default::default() }); + // This counts thumbnail requests across print-cell sizes, not native-image throughput. + // Keep the demo's twelve-photo contact sheet with real files that decode cheaply. + let library = SyntheticLibrary::with_photos("print-thumbnail-reuse", 12); + let mut h = Headless::new(library.app(), [1400.0, 900.0], 1.0); + assert!(h.settle(T), "the print thumbnail fixture settles"); + assert_eq!(h.app.session.catalog.len(), 12, "the contact sheet retains twelve photos"); let before = h.app.renderer.thumb_jobs_built; + assert!(before > 0, "the fixture exercises actual thumbnail jobs"); cmd(&mut h, "dialog.print", json!({})); for style in ["contactSheet", "picturePackage", "singleImage"] { cmd(&mut h, "print.set", json!({"layout": {"style": style}})); diff --git a/crates/ui-egui/src/tests/render_fixtures.rs b/crates/ui-egui/src/tests/render_fixtures.rs new file mode 100644 index 0000000000..b79bbad366 --- /dev/null +++ b/crates/ui-egui/src/tests/render_fixtures.rs @@ -0,0 +1,179 @@ +//! Test-only, real, file-backed photo fixtures for the render tests. +//! +//! The input/modal tests use a tiny `SyntheticLibrary` (64×48) that cannot exercise native-size +//! decoding, a 1300×700 region window, a >16 MiB decoded original or Compare's two originals. +//! These fixtures write real landscape 3:2 PNGs at the demo library's 24 MP size and register +//! them as ordinary `Source::File` photos, so preview, Before/After and slideshow tests decode +//! and render through the same path as a user's files. + +use std::collections::HashMap; +use std::path::{Path, PathBuf}; +use std::sync::atomic::{AtomicU64, Ordering}; +use std::sync::{Arc, Mutex, OnceLock, Weak}; + +use lightcraft_catalog::{Op, Photo, Source}; +use lightcraft_codecs::{EncodeImage, EncodeMeta, Samples, encode_png}; +use lightcraft_engine::{Selection, Session}; + +/// The demo library's photo size: landscape 3:2, 24 MP. +pub(crate) const WIDTH: u32 = 6000; +pub(crate) const HEIGHT: u32 = 4000; +/// The long edge the native-resolution tests look for. +pub(crate) const LONG_EDGE: usize = WIDTH as usize; +/// The pixel count of every fixture photo. +pub(crate) const MEGAPIXELS: u64 = WIDTH as u64 * HEIGHT as u64; + +static NEXT_FIXTURE: AtomicU64 = AtomicU64::new(0); +type FixtureCache = Mutex>>; +/// One generated set per (tag, count) in this test process: parallel tests share the same +/// read-only PNGs instead of each encoding 2–3 24 MP images (and spiking memory). +static FIXTURES: OnceLock = OnceLock::new(); + +struct FixtureFiles { + dir: PathBuf, + paths: Vec, + sizes: Vec, +} + +impl Drop for FixtureFiles { + fn drop(&mut self) { + let _ = std::fs::remove_dir_all(&self.dir); + } +} + +/// Owns (with other users) a temporary directory of real PNGs. Keep it alive until after the +/// [`crate::headless::Headless`] built from [`RenderFixture::session`] has dropped: the renderer +/// reads these paths lazily. +pub(crate) struct RenderFixture { + files: Arc, +} + +impl RenderFixture { + /// Write (or reuse) `count` deterministic, smooth, non-neutral landscape gradient PNGs. + pub(crate) fn new(tag: &str, count: usize) -> Self { + assert!(count > 0, "a render fixture needs at least one photo"); + let key = (tag.to_string(), count); + let cache = FIXTURES.get_or_init(|| Mutex::new(HashMap::new())); + let mut cache = cache.lock().unwrap_or_else(|e| e.into_inner()); + if let Some(files) = cache.get(&key).and_then(Weak::upgrade) { + return RenderFixture { files }; + } + let files = Arc::new(build_files(tag, count)); + cache.insert(key, Arc::downgrade(&files)); + RenderFixture { files } + } + + /// A session with `with_fs` loaders, one default-edited `Source::File` photo per fixture, + /// distinct ids and captured times in a stable order, with the first visible photo selected. + pub(crate) fn session(&self) -> Session { + let mut session = Session::new().with_fs(); + for (i, path) in self.files.paths.iter().enumerate() { + let id = session.catalog.alloc_photo_id(); + let name = format!("RENDER_{i:04}.PNG"); + let mut photo = Photo::new(id, Source::File { path: path.clone() }, &name, "PNG", WIDTH, HEIGHT, "2026-01-01T10:00:00"); + // Distinct captured times keep `visible_cloned()` deterministic (the default sort is + // capture date, newest first) and make every PhotoId its own file. + photo.captured = Some(format!("2026-01-01T10:{:02}:{:02}", i / 60, i % 60)); + photo.file_size = self.files.sizes.get(i).copied().unwrap_or(0); + session.catalog.apply(Op::AddPhoto { photo: Box::new(photo) }).expect("add a render fixture photo"); + } + session.keep_active_in_view(); + let first = session.visible_cloned().first().copied().expect("the fixture has a visible photo"); + session.selection = Selection::single(first); + session + } + + pub(crate) fn paths(&self) -> &[String] { + &self.files.paths + } +} + +fn build_files(tag: &str, count: usize) -> FixtureFiles { + let n = NEXT_FIXTURE.fetch_add(1, Ordering::Relaxed); + let dir = std::env::temp_dir().join(format!("lightcraft-render-fixtures-{tag}-{}-{n}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(&dir).expect("create the render fixture directory"); + + let mut paths = Vec::with_capacity(count); + let mut sizes = Vec::with_capacity(count); + for i in 0..count { + let path = dir.join(format!("render-{i:02}.png")); + let size = write_gradient(&path, i); + paths.push(path.to_string_lossy().into_owned()); + sizes.push(size); + } + FixtureFiles { dir, paths, sizes } +} + +/// A smooth, non-wrapping, non-neutral gradient: R rises with x, G with y, B falls with x. The +/// superimposed spatial waves make shifted pixels distinguishable in alignment regressions. The +/// centre stays non-neutral, so the white-balance picker sees a real colour and an +/// exposure lift of 1.5 EV is unmistakably brighter. `variant` shifts it slightly so no two +/// fixture files have the same bytes. +fn write_gradient(path: &Path, variant: usize) -> u64 { + let w = WIDTH as usize; + let h = HEIGHT as usize; + let shift_r = (variant % 7) as f32 * 4.0; + let shift_b = (variant % 5) as f32 * 3.0; + let r_base: Vec = (0..w) + .map(|x| { + let u = x as f32 / (w - 1) as f32; + clamp8(80.0 + 120.0 * u + shift_r + 44.0 * (std::f32::consts::TAU * x as f32 / 160.0).sin()) + }) + .collect(); + let b_base: Vec = (0..w) + .map(|x| { + let u = x as f32 / (w - 1) as f32; + clamp8(40.0 + 100.0 * (1.0 - u) + shift_b + 22.0 * (std::f32::consts::TAU * x as f32 / 160.0).sin()) + }) + .collect(); + + let mut bytes = vec![0u8; w * h * 4]; + for (y, row) in bytes.chunks_exact_mut(w * 4).enumerate() { + let v = y as f32 / (h - 1) as f32; + let wave = (std::f32::consts::TAU * y as f32 / 192.0).sin(); + let g = clamp8(60.0 + 100.0 * v + 44.0 * wave); + for (x, pixel) in row.as_chunks_mut::<4>().0.iter_mut().enumerate() { + pixel[0] = r_base[x]; + pixel[1] = g; + pixel[2] = clamp8(f32::from(b_base[x]) + 22.0 * wave); + pixel[3] = 255; + } + } + + let image = EncodeImage::new(WIDTH, HEIGHT, 4, Samples::U8(&bytes)); + let encoded = encode_png(&image, &EncodeMeta::default()).expect("encode a render fixture PNG"); + std::fs::write(path, &encoded).expect("write a render fixture PNG"); + encoded.len() as u64 +} + +fn clamp8(v: f32) -> u8 { + v.clamp(0.0, 255.0).round() as u8 +} + +#[cfg(test)] +mod tests { + use super::*; + + /// The fixture must stay a real 24 MP landscape 3:2 PNG: a fast little image would silently + /// weaken every render assertion that depends on native pixels and a >16 MiB decoded source. + #[test] + fn render_fixtures_are_real_24mp_landscape_pngs() { + assert_eq!((WIDTH, HEIGHT), (6000, 4000)); + assert_eq!(MEGAPIXELS, 24_000_000, "the demo photos these replace are 24 MP"); + let fixture = RenderFixture::new("preview", 2); + assert_eq!(fixture.paths().len(), 2); + for path in fixture.paths() { + let bytes = std::fs::read(path).expect("read the fixture PNG"); + let header = lightcraft_codecs::read_header(&bytes).expect("read the fixture PNG header"); + assert_eq!((header.width, header.height), (WIDTH, HEIGHT), "{path}"); + assert_eq!(header.format, lightcraft_codecs::Format::Png, "{path}"); + // A full-resolution decode is width × height linear RGB f32 samples, well over the + // 16 MiB budget `a_zoomed_original_over_the_budget...` checks. + let decoded_bytes = u64::from(header.width) * u64::from(header.height) * 3 * 4; + assert!(decoded_bytes > (16 << 20), "{path}: a decoded source of {decoded_bytes} bytes"); + } + // The files are distinct so each PhotoId is its own original. + assert_ne!(fixture.paths()[0], fixture.paths()[1]); + } +} diff --git a/crates/ui-egui/src/tests/slideshow.rs b/crates/ui-egui/src/tests/slideshow.rs index 7dc8ae4005..01a468ed89 100644 --- a/crates/ui-egui/src/tests/slideshow.rs +++ b/crates/ui-egui/src/tests/slideshow.rs @@ -2,14 +2,18 @@ //! prepared ahead off the UI thread, transitions only between ready slides, keys and controls. //! Simulated time: every headless frame is 1/60 s, so nothing here sleeps. +use std::cell::Cell; +use std::rc::Rc; use std::time::Duration; use lightcraft_catalog::PhotoId; use lightcraft_engine::slideshow::Item; use serde_json::json; -use crate::headless::Headless; +use crate::headless::{Headless, RenderGate}; use crate::render::Slot; +use crate::tests_fixtures::SyntheticLibrary; +use crate::tests_render_fixtures::{HEIGHT, RenderFixture, WIDTH}; use crate::{LightcraftApp, Services}; const T: Duration = Duration::from_secs(20); @@ -27,6 +31,31 @@ fn grid_sized(size: [f32; 2]) -> Headless { h } +/// The slideshow's 1000×700 window over `count` real 6000×4000 file-backed photos. Used only by +/// `next_slides_are_prepared_before_they_are_due`, where the 24 MP decode/render is the point: +/// destructure the tuple immediately with the fixture binding first, so the renderer drops first. +fn fixture_grid(count: usize, open: Rc>) -> (RenderFixture, Headless) { + let fixture = RenderFixture::new("slideshow", count); + assert_eq!(fixture.paths().len(), count); + for (index, path) in fixture.paths().iter().enumerate() { + assert!(std::path::Path::new(path).is_file(), "the fixture photo exists"); + assert!(!fixture.paths()[..index].contains(path), "each fixture photo has its own path"); + } + let services = Services { png: None, ..Default::default() }; + let app = LightcraftApp::new(fixture.session(), services); + let mut h = Headless::new(app, [1000.0, 700.0], 1.0); + // Control native grid work before its first frame too: asynchronous setup must not + // consume the wall-clock budget before the slideshow scheduling assertions begin. + assert!(open.get(), "the native grid setup gate starts open"); + h.app.renderer.set_offload(Box::new(RenderGate::new(open))); + assert!(h.settle(SETTLE), "the grid renders settle before controlling slide renders"); + assert_eq!(h.app.session.catalog.len(), count, "the slideshow fixture photos"); + let id = h.app.session.active().expect("a photo is open"); + let photo = h.app.session.catalog.photo(id).expect("it is in the catalog"); + assert_eq!((photo.width, photo.height), (WIDTH, HEIGHT), "the slideshow fixture is a real 24 MP photo"); + (fixture, h) +} + fn run(h: &mut Headless, command: &str, params: serde_json::Value) -> serde_json::Value { let r = h.request("engine.execute", json!({"command": command, "params": params}), T); assert_eq!(r["ok"], true, "{command}: {r}"); @@ -61,12 +90,24 @@ fn slides_held(h: &Headless) -> usize { #[test] fn slideshow_advances_pauses_and_ends() { - let mut h = grid(); + // This tests the automatic playback clock and controls; native 24 MP rendering + // is exercised separately by next_slides_are_prepared_before_they_are_due. + let library = SyntheticLibrary::with_photos("slideshow-automatic-controls", 3); + let mut h = Headless::new(library.app(), [1000.0, 700.0], 1.0); + assert!(h.settle(SETTLE), "the automatic playback fixture settles"); let first = h.app.session.visible_cloned()[0]; - run(&mut h, "view.slideshow", json!({"interval": 0.5, "fadeDuration": 0})); + // The fixture selects its first imported photo; newest-first view order differs. + // Establish the same first-in-view starting selection as the original demo test. + run(&mut h, "library.select", json!({"ids": [first.0]})); + assert_eq!(h.app.session.active(), Some(first), "the first visible photo is selected before playback"); + run(&mut h, "view.slideshow", json!({"interval": 0.5, "fadeDuration": 0, "manual": false})); + assert!(!play(&h).settings().manual, "playback advances automatically"); assert!(h.app.ui.fullscreen && h.app.ui.slideshow.is_some()); assert_eq!(h.app.session.active(), Some(first), "starts at the first photo in view"); assert!(h.step_until(SETTLE, |h| h.app.session.active() != Some(first)), "the next photo comes up and is selected"); + let advanced = photo_up(&h); + assert_eq!(h.app.session.active(), Some(advanced), "selection follows automatic playback"); + assert!(has_slide(&h, advanced), "automatic playback shows a rendered next photo"); // Space pauses: nothing moves let r = h.request("ui.key", json!({"key": "space"}), T); assert_eq!(r["ok"], true, "{r}"); @@ -98,33 +139,54 @@ fn turning_off_the_full_screen_preview_frees_the_slides() { #[test] fn next_slides_are_prepared_before_they_are_due() { - let mut h = grid(); - // a long slide: anything rendered for the next ones is rendered ahead of time - run(&mut h, "view.slideshow", json!({"interval": 60, "fadeDuration": 1, "preparePreviews": true, "seed": 7})); + let open = Rc::new(Cell::new(true)); + let (fx, mut h) = fixture_grid(8, open.clone()); + // Grid setup is complete. Hold photo slide jobs until their ahead requests are + // observable; opening the gate runs the actual native decode/render synchronously. + open.set(false); + let reply = run(&mut h, "view.slideshow", json!({"interval": 60, "fadeDuration": 1, "preparePreviews": true, "seed": 7})); + assert_eq!(reply["settings"]["preparePreviews"], true); + assert_eq!(reply["settings"]["slideDuration"], 60.0); let ahead = play(&h).upcoming(crate::panels::slideshow::AHEAD); - assert_eq!(ahead.len(), 2); + assert_eq!(ahead.len(), crate::panels::slideshow::AHEAD); let start = h.time(); - // the slide up and the next two; their renders can finish in any order + // The current photo and next two are queued before any slide render completes. let current = photo_up(&h); + for item in std::iter::once(Item::Photo(current)).chain(ahead.iter().copied()) { + assert!(h.app.renderer.is_pending(Slot::Slide(item)), "requested before it is due: {item:?}"); + assert!(!has_slide(&h, item), "not rendered before the gate opens: {item:?}"); + } + assert!(play(&h).remaining(h.time()) > 59.0, "the first slide is not due before rendering"); + // The gate executes the actual decode/render work synchronously when polled. + open.set(true); assert!( h.step_until(SETTLE, |h| has_slide(h, current) && ahead.iter().all(|id| has_slide(h, *id))), "the slide up and the next two slides are rendered" ); assert!(h.time() - start < 60.0, "before the first is due"); assert_eq!(photo_up(&h), current, "still on the first slide"); - h.settle(SETTLE); + assert!(play(&h).remaining(h.time()) > 59.0, "renders are accepted before the first slide is due"); + assert!(h.settle(SETTLE), "enabled-prefetch renders settle"); + drop(h); + drop(fx); // off: only the slide up is rendered until the next one is due - let mut h = grid(); - run(&mut h, "view.slideshow", json!({"interval": 60, "preparePreviews": false})); + let open = Rc::new(Cell::new(true)); + let (_fx2, mut h) = fixture_grid(8, open.clone()); + open.set(false); + let reply = run(&mut h, "view.slideshow", json!({"interval": 60, "preparePreviews": false})); + assert_eq!(reply["settings"]["preparePreviews"], false); let next = play(&h).upcoming(1)[0]; let current = photo_up(&h); - assert!(h.step_until(SETTLE, |h| has_slide(h, current))); for _ in 0..30 { h.step(); } + assert!(h.app.renderer.is_pending(Slot::Slide(Item::Photo(current))), "the current slide is requested"); assert!(!has_slide(&h, next) && !h.app.renderer.is_pending(Slot::Slide(next)), "not prepared"); - h.settle(SETTLE); + open.set(true); + assert!(h.step_until(SETTLE, |h| has_slide(h, current)), "the current slide renders once allowed"); + assert!(!has_slide(&h, next) && !h.app.renderer.is_pending(Slot::Slide(next)), "still not prepared"); + assert!(h.settle(SETTLE), "disabled-prefetch renders settle"); } #[test] @@ -201,10 +263,40 @@ fn a_manual_slideshow_waits_for_the_arrow_keys() { // the Settings checkbox turns it on run(&mut h, "view.slideshowOptions", json!({})); h.step(); - reveal(&mut h, "check:settings.slideshowManual"); + let target = reveal(&mut h, "check:settings.slideshowManual"); + let diagnose = |phase: &str, h: &Headless| { + let id = "check:settings.slideshowManual"; + let rect = latest_widget_rect(h, id); + let hit = crate::control::widget_hit(&h.app, id); + let visible = rect.is_some_and(|r| crate::control::widget_target_visible(&h.view.ctx, hit, r.center())); + eprintln!( + "manual-checkbox {phase}: manual={} time={} frames={} target={target:?} rect={rect:?} room={:?} hit={hit:?} visible={visible} input={:?} dialog={:?} notices={:?} quit_prompt={} notice_barrier={} library_problem={} library_barrier={} in_flight={} pending={:?} toast={:?}", + h.app.session.slideshow.manual, + h.time(), + h.frames(), + latest_widget_rect(h, "settings:pageRoom"), + h.view.ctx.input(|i| (i.is_scrolling(), i.modifiers, i.keys_down.clone(), i.pointer.any_down())), + h.app.ui.dialog, + h.app.notices, + h.app.quit_prompt.is_some(), + crate::panels::notices::blocks_input(&h.app), + h.app.library_problem.is_some(), + crate::panels::library_problem::blocks_file_drops(&h.app), + h.app.renderer.in_flight(), + h.app.renderer.pending_slots(), + h.app.ui.toast, + ); + }; + diagnose("before-click", &h); + assert!(!h.app.session.slideshow.manual, "the checkbox starts unchecked before the real click"); + let journal_before = h.app.session.journal.len(); let r = h.request("ui.clickWidget", json!({"id": "check:settings.slideshowManual"}), T); + diagnose("after-request", &h); + eprintln!("manual-checkbox reply={r} journal_since_click={:?}", h.app.session.journal.get(journal_before..)); assert_eq!(r["ok"], true, "{r}"); h.step(); + diagnose("after-existing-step", &h); + eprintln!("manual-checkbox journal_after_existing_step={:?}", h.app.session.journal.get(journal_before..)); assert!(h.app.session.slideshow.manual, "the checkbox goes through slideshow.playback"); h.settle(SETTLE); } @@ -440,7 +532,9 @@ fn a_composed_slide_shows_during_playback() { let mut h = grid(); let r = run(&mut h, "slideshow.layout", json!({"margins": 0.1, "backdropColor": "#ff0000"})); assert_eq!(r["marginTop"], 0.1); - run(&mut h, "view.slideshow", json!({"interval": 60, "fadeDuration": 0})); + // This checks composed pixels and explicit navigation. Rendering can take enough + // headless frames to pass any automatic interval before the next slide is ready. + run(&mut h, "view.slideshow", json!({"interval": 60, "fadeDuration": 0, "manual": true})); let current = photo_up(&h); assert!(h.step_until(SETTLE, |h| has_slide(h, current)), "the slide is composed and ready"); h.step(); @@ -457,8 +551,10 @@ fn a_composed_slide_shows_during_playback() { // the next slide is composed too, and stepping shows it let next = play(&h).upcoming(1)[0]; assert!(h.step_until(SETTLE, |h| has_slide(h, next))); + assert_eq!(photo_up(&h), current, "rendering ahead keeps the inspected slide up"); run(&mut h, "slideshow.next", json!({})); h.step(); + assert_eq!(play(&h).current(), next, "navigation shows the prepared slide"); assert_eq!(painted(&h.paint(), 5, 5), [255, 0, 0]); h.settle(SETTLE); } @@ -467,10 +563,13 @@ fn a_composed_slide_shows_during_playback() { fn the_default_layout_plays_the_photo_as_before() { let mut h = grid(); assert!(h.app.session.slide_layout.is_plain()); - run(&mut h, "view.slideshow", json!({"interval": 60, "fadeDuration": 0})); + // Inspect one photo's aspect and backdrop without automatic playback advancing + // the simulated clock past it while the asynchronous renderer catches up. + run(&mut h, "view.slideshow", json!({"interval": 60, "fadeDuration": 0, "manual": true})); let current = photo_up(&h); assert!(h.step_until(SETTLE, |h| has_slide(h, current))); h.step(); + assert_eq!(photo_up(&h), current, "the inspected photo stays up while rendering"); // the photo's own render (its aspect, not the screen's), fitted on black, as before let tex = h.app.renderer.textures.get(&Slot::Slide(current.into())).unwrap(); let aspect = h.app.session.slide_photo_aspect(current).unwrap(); diff --git a/crates/ui-egui/src/tests/zoom.rs b/crates/ui-egui/src/tests/zoom.rs index 580b70615a..ebe3ecd22f 100644 --- a/crates/ui-egui/src/tests/zoom.rs +++ b/crates/ui-egui/src/tests/zoom.rs @@ -41,6 +41,73 @@ fn size_of(h: &Headless) -> (f32, f32) { (p.width as f32, p.height as f32) } +/// Keep an old same-photo texture on screen while the replacement is deliberately held. +/// Geometry must follow the edit immediately, independently of renderer throughput. +#[test] +fn a_pending_crop_or_rotation_does_not_reuse_the_old_textures_aspect() { + use crate::render::{RenderOffload, Slot, Tex, geometry_look}; + use crate::state::{RightPanel, Zoom}; + + struct Held; + impl RenderOffload for Held { + fn try_start(&mut self, _: Slot, job: lightcraft_engine::RenderJob) -> Option { + Some(job) + } + fn finished(&mut self) -> Vec<(Slot, lightcraft_engine::media::RenderResult, f64)> { + Vec::new() + } + } + + let fixture = crate::tests_fixtures::SyntheticLibrary::new("zoom-stale-geometry"); + let mut h = Headless::new(fixture.app(), [1400.0, 900.0], 1.0); + h.app.renderer.set_offload(Box::new(Held)); + let response = h.request("ui.set", json!({"view": "detail", "right": "none", "filmstrip": false}), T); + assert_eq!(response["ok"], true, "{response}"); + h.step(); + h.app.ui.zoom = Zoom::Percent(100.0); + let id = h.app.session.active().expect("fixture photo"); + let old_look = geometry_look(&h.app.session.develop_of(id).expect("settings")); + let tex = h.view.ctx.load_texture("old loupe", egui::ColorImage::filled([4, 3], egui::Color32::BLACK), Default::default()); + h.app.renderer.textures.insert( + Slot::Main, + Tex { look: Some((old_look, true)), key: 0, photo: id, tex, size: [64, 48], histogram: None, ms: 0.0, quick: None, pixels: None }, + ); + edit(&mut h, |d| d.crop.geometry.rect = lightcraft_geom::Rect::new(0.25, 0.2, 0.75, 0.2 + 1.0 / 3.0)); + for (rotate, expected) in [(false, egui::vec2(32.0, 16.0)), (true, egui::vec2(16.0, 32.0))] { + if rotate { + edit(&mut h, |d| { + d.orientation = lightcraft_geom::Orientation::Rotate90; + // Crop coordinates live in the oriented frame, as in library.rotateRight. + d.crop.geometry.rect = lightcraft_geom::Orientation::Rotate90.map_norm_rect(d.crop.geometry.rect); + }); + } + h.app.ui.zoom_anim = false; + h.step(); + let shown = h.app.image_rect.expect("loupe geometry"); + assert!((shown.size() - expected).abs().max_elem() < 0.01, "pending edit: {shown:?}, expected {expected:?}"); + assert_eq!(h.app.renderer.textures[&Slot::Main].look, Some((old_look, true)), "old pixels remain visible"); + assert!(h.app.renderer.is_pending(Slot::Main), "the edited render is still pending"); + } + // Crop mode shows the full oriented image; leaving it must immediately restore the crop. + h.app.ui.right = RightPanel::Crop; + h.app.ui.zoom_anim = false; + h.step(); + assert!((h.app.image_rect.expect("crop tool geometry").size() - egui::vec2(48.0, 64.0)).abs().max_elem() < 0.01); + h.app.ui.right = RightPanel::None; + h.app.ui.zoom_anim = false; + h.step(); + assert!((h.app.image_rect.expect("restored crop geometry").size() - egui::vec2(16.0, 32.0)).abs().max_elem() < 0.01); + // An actual current-settings render can still correct metadata that differs from the + // decoded image (unsupported RAWs may provide only a differently cropped embedded JPEG). + let current = geometry_look(&h.app.session.develop_of(id).expect("settings")); + let tex = h.app.renderer.textures.get_mut(&Slot::Main).expect("old texture"); + tex.look = Some((current, true)); + tex.size = [16, 48]; + h.step(); + let shown = h.app.image_rect.expect("current render geometry"); + assert!((shown.size() - egui::vec2(16.0, 48.0)).abs().max_elem() < 0.01, "current pixels correct metadata: {shown:?}"); +} + // Given an uncropped photo, 100 % is its pixel size #[test] fn an_uncropped_photo_at_100_is_its_pixel_size() { diff --git a/crates/ui-egui/tests/it/docking_workflows.rs b/crates/ui-egui/tests/it/docking_workflows.rs index e13b0ff0ed..54ad8f186f 100644 --- a/crates/ui-egui/tests/it/docking_workflows.rs +++ b/crates/ui-egui/tests/it/docking_workflows.rs @@ -42,13 +42,22 @@ fn settle_photo(h: &mut Harness<'_, LightcraftApp>) { let started = Instant::now(); let mut quiet = 0; while quiet < 4 { - h.run_steps(2); - if h.state().renderer.in_flight() == 0 && h.state().loupe_shown.is_some_and(|(_, source)| source == "render") { + if h.state().renderer.in_flight_without_prefetch() > 0 { + h.state_mut().renderer.wait_for_worker(Duration::from_millis(250)); + } + h.run_steps(1); + // Neighbouring-photo prefetch does not contribute pixels to this capture. + if h.state().renderer.in_flight_without_prefetch() == 0 && h.state().loupe_shown.is_some_and(|(_, source)| source == "render") { quiet += 1; } else { quiet = 0; } - assert!(started.elapsed() < Duration::from_secs(30), "the synthetic photo and panel thumbnails must finish rendering before capture"); + assert!( + started.elapsed() < Duration::from_secs(120), + "the synthetic photo and panel thumbnails must finish rendering before capture: loupe {:?}, pending {:?}", + h.state().loupe_shown, + h.state().renderer.pending_slots() + ); std::thread::sleep(Duration::from_millis(5)); } } diff --git a/packaging/linux/flatpak/README.md b/packaging/linux/flatpak/README.md new file mode 100644 index 0000000000..7f6f7f1a1b --- /dev/null +++ b/packaging/linux/flatpak/README.md @@ -0,0 +1,120 @@ +# From-source Flatpak packaging + +`ai.storyteller.lightcraft.yml` builds LightCraft and `lightcraft-cli` from this +repository inside the Flatpak SDK. Flatpak builders have no network access, so +`cargo-sources.json` lists every crate and git source with a fixed checksum or +commit. Regenerate it after changing `Cargo.lock`: + +```sh +./packaging/linux/flatpak/generate-cargo-sources.py +flatpak-builder --user --install --force-clean build-flatpak packaging/linux/flatpak/ai.storyteller.lightcraft.yml +flatpak run ai.storyteller.lightcraft +``` + +## Regeneration wrapper + +`generate-cargo-sources.py` uses the upstream +[`flatpak-cargo-generator.py`](https://github.com/flatpak/flatpak-builder-tools/blob/9d86d336a39b9af38b86f114b6ce5820fe260f91/cargo/flatpak-cargo-generator.py) +pinned to commit `9d86d336a39b9af38b86f114b6ce5820fe260f91` with SHA-256 +`0a2db6be87d75910facef28ab46d4d6460802e8419ab850d0caa6a364d26b380`. It downloads +the script, verifies that hash, applies the two reviewed patches below, and +invokes it with the current Python interpreter. The upstream script is not +vendored; it is MIT-licensed +([upstream licence](https://github.com/flatpak/flatpak-builder-tools/blob/9d86d336a39b9af38b86f114b6ce5820fe260f91/LICENSE)). +The patched script's hash is also checked before execution. + +Requirements: Python 3.9+ with `aiohttp` and `tomlkit` (`PyYAML` is optional and +only needed for upstream's YAML output), plus `git` and network access to fetch +the generator and git dependencies. Crate archive URLs and checksums are read +from Cargo.lock; Flatpak downloads those archives when materializing the sources. The generator clones git +repositories into `$XDG_CACHE_HOME/lightcraft-flatpak-cargo` by default, or the +directory passed with `--cache-dir`; the wrapper refuses a cache inside the +checkout or `CARGO_TARGET_DIR`. `cargo-sources.json` is written to a temporary +file and atomically renamed only after the generator succeeds, so a failed run +leaves the previous inventory untouched. + +The regenerated inventory keeps the temporary file’s owner-only permissions (0600 on POSIX). +Run the generator and Flatpak builder as the same user; a cross-user packaging workflow +should explicitly install the inventory with its required ownership and permissions. + +Generation is capped at 30 minutes and the generator's stdin is `/dev/null`, so +an interactive credential prompt fails instead of hanging. On POSIX systems +(Linux is the supported Flatpak packaging platform) the generator starts in its +own session; at the cap, the wrapper kills that generator's process group, +including git clone/fetch descendants, and reaps its leader, so no orphan keeps +writing into the cache. On Windows only the direct generator process is +terminated; its git descendants are not tree-killed, and the timeout is +otherwise the same. The timeout path runs before the atomic rename, so the +existing inventory and the temporary-file cleanup behave exactly like any other +generation failure. + +Because the generator no longer shares the wrapper's terminal session, the +wrapper also handles Ctrl-C (`SIGINT`) and `SIGTERM` while it runs: the signal +is recorded, the generator's process group is killed and reaped like the timeout +path, the temporary file and script directory are removed, and only then is the +signal replayed with the handler that was installed before generation started +(`KeyboardInterrupt` for `SIGINT`, the previous or default action for +`SIGTERM`). A cancelled `flatpak-builder` run or an interactive Ctrl-C therefore +leaves neither a detached generator or git clone nor a modified inventory. The +temporary handlers are installed before the generator is spawned, so a signal +that arrives while the child is being created cannot strand the new session +either. A cancellation delivered while those handlers are installed is recorded +once (the first signal wins) and replayed after cleanup with the caller's +restored handler. Signals that cannot be handled by this process at all +(`SIGKILL`, an OOM kill, or a wrapper crash) cannot be cleaned up: the generator +runs in its own session, so it may survive the wrapper, and any temporary output +or script directory it had created remains. A hard termination between creating +the temporary directory or output file and installing the handlers, or after +`run_generator` returns while the output is being validated and renamed, can +likewise leave those temporary paths behind (the complete temporary output in +the latter case), because the default signal action performs no cleanup. + +## Why two patches + +1. **Keep pinned revisions distinct.** Upstream keys `[source]` replacement + entries by the canonical repository URL and then adds `rev`/`tag`/`branch`. + Two different revisions of the same repository therefore overwrite each + other. The patch keys the entry by the full source URL without its `#` + fragment, so `https://github.com/storytold/craft-libs?rev=...` remains a + separate source for each craft-libs revision. +2. **Include `[patch.unused]`.** `Cargo.lock` records patched packages that are + not in the resolved graph under `patch.unused`. Upstream iterates only + `package`, which omits crates such as `egui_demo_lib`; `--locked` offline + dependency resolution then fails because Cargo still loads those patched manifests. The + patch also walks `patch.unused` entries. + +No third patch is needed: upstream's `git_repo_name()` already appends the +first seven characters of the commit, so the two craft-libs checkouts get +different destinations. + +## Offline validation performed + +The committed inventory was generated from the current `Cargo.lock` and then +validated without contacting the network: every git/archive/shell/inline entry +was materialized as Flatpak would, crate archives were checked against their +recorded SHA-256 values, and the generated Cargo config was pointed at the +materialized vendor directory. With an isolated `CARGO_HOME` and +`CARGO_NET_OFFLINE=true`, `cargo --config metadata --offline +--locked --format-version 1` exited 0. The two craft-libs revisions +(`82a24b006eefa036b43c09a67fb9a3fbd17ffe63` and +`25da1314d443171b4adeaad2cd9454b273f35c6f`) are present as separate git sources +and `[source]` entries. The checked-in `cargo-sources.json` has SHA-256 +`c7f515d1178bb79b2cabdfd419ad375a04ff5d84ba9d08b1b34970a460cd0f2c`. + +This validates the source inventory and offline metadata resolution only. A +full `flatpak-builder` build against the `org.freedesktop.Sdk` 25.08 runtime and +Rust extension is still required before release; it was not performed here. + +Run the wrapper failure-path and cancellation regression tests (the real +process-group cases, including Ctrl-C/`SIGTERM` cancellation of a live +generator session, run on Linux only and are skipped elsewhere) with: + +```sh +python3 -B packaging/linux/flatpak/test_generate_cargo_sources.py +``` + +The cancellation and timeout tests check process liveness and a frozen +heartbeat before their teardown kills anything. With +`LIGHTCRAFT_FLATPAK_TEST_BREAK_KILL=1` the group kill is a deliberate no-op and +those tests must fail; run that variant to confirm they do not silently pass on +a broken kill path. diff --git a/packaging/linux/flatpak/ai.storyteller.lightcraft.yml b/packaging/linux/flatpak/ai.storyteller.lightcraft.yml index 4e03df0055..e125475c57 100644 --- a/packaging/linux/flatpak/ai.storyteller.lightcraft.yml +++ b/packaging/linux/flatpak/ai.storyteller.lightcraft.yml @@ -2,11 +2,14 @@ # # Flatpak builds run offline, so the crate sources must be vendored first. From the repo root: # -# curl -fsSLO https://raw.githubusercontent.com/flatpak/flatpak-builder-tools/master/cargo/flatpak-cargo-generator.py -# python3 flatpak-cargo-generator.py Cargo.lock -o packaging/linux/flatpak/cargo-sources.json +# ./packaging/linux/flatpak/generate-cargo-sources.py # flatpak-builder --user --install --force-clean build-flatpak packaging/linux/flatpak/ai.storyteller.lightcraft.yml # flatpak run ai.storyteller.lightcraft # +# The wrapper downloads the pinned upstream flatpak-cargo-generator, verifies its checksum, +# applies the two reviewed patches described in packaging/linux/flatpak/README.md, and writes +# cargo-sources.json atomically. That README also covers dependencies and offline validation. +# # For Flathub, replace the `dir` source with a `git` source pinned to a release tag and commit. # # ai.storyteller.lightcraft.bundle.yml (same directory) builds the .flatpak attached to every diff --git a/packaging/linux/flatpak/cargo-sources.json b/packaging/linux/flatpak/cargo-sources.json new file mode 100644 index 0000000000..8d723f2f41 --- /dev/null +++ b/packaging/linux/flatpak/cargo-sources.json @@ -0,0 +1,8593 @@ +[ + { + "type": "git", + "url": "https://github.com/storytold/craft-libs", + "commit": "82a24b006eefa036b43c09a67fb9a3fbd17ffe63", + "dest": "flatpak-cargo/git/craft-libs-82a24b0" + }, + { + "type": "git", + "url": "https://github.com/storytold/craft-libs", + "commit": "25da1314d443171b4adeaad2cd9454b273f35c6f", + "dest": "flatpak-cargo/git/craft-libs-25da131" + }, + { + "type": "git", + "url": "https://github.com/storytold/egui", + "commit": "6d518fc799681571963842f95b55a6b68431b15a", + "dest": "flatpak-cargo/git/egui-6d518fc" + }, + { + "type": "git", + "url": "https://github.com/storytold/winit", + "commit": "a517b3846ee8457d84ee4975110bfda6797c44dc", + "dest": "flatpak-cargo/git/winit-a517b38" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ab_glyph/ab_glyph-0.2.32.crate", + "sha256": "01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2", + "dest": "cargo/vendor/ab_glyph-0.2.32" + }, + { + "type": "inline", + "contents": "{\"package\": \"01c0457472c38ea5bd1c3b5ada5e368271cb550be7a4ca4a0b4634e9913f6cc2\", \"files\": {}}", + "dest": "cargo/vendor/ab_glyph-0.2.32", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ab_glyph_rasterizer/ab_glyph_rasterizer-0.1.10.crate", + "sha256": "366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618", + "dest": "cargo/vendor/ab_glyph_rasterizer-0.1.10" + }, + { + "type": "inline", + "contents": "{\"package\": \"366ffbaa4442f4684d91e2cd7c5ea7c4ed8add41959a31447066e279e432b618\", \"files\": {}}", + "dest": "cargo/vendor/ab_glyph_rasterizer-0.1.10", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/accesskit/accesskit-0.25.1.crate", + "sha256": "ad442f58ee04714aaa0ba0a2768c1ea1935b29507bb22ddece8cbbc76db02932", + "dest": "cargo/vendor/accesskit-0.25.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"ad442f58ee04714aaa0ba0a2768c1ea1935b29507bb22ddece8cbbc76db02932\", \"files\": {}}", + "dest": "cargo/vendor/accesskit-0.25.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/accesskit_atspi_common/accesskit_atspi_common-0.21.0.crate", + "sha256": "52c182f9c282ac9c5638d876d551d15e5f7d397ec263349a0c6a2b61595dd5e4", + "dest": "cargo/vendor/accesskit_atspi_common-0.21.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"52c182f9c282ac9c5638d876d551d15e5f7d397ec263349a0c6a2b61595dd5e4\", \"files\": {}}", + "dest": "cargo/vendor/accesskit_atspi_common-0.21.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/accesskit_consumer/accesskit_consumer-0.39.1.crate", + "sha256": "8a45e2bb300bea6d5f33a82c3e051c3ddc6f41c209750f68a0acbe991a284344", + "dest": "cargo/vendor/accesskit_consumer-0.39.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"8a45e2bb300bea6d5f33a82c3e051c3ddc6f41c209750f68a0acbe991a284344\", \"files\": {}}", + "dest": "cargo/vendor/accesskit_consumer-0.39.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/accesskit_ios/accesskit_ios-0.2.1.crate", + "sha256": "28e539d64b27fd4c14de8f78ada8f7c944c092f52f7e49fb63316507a57f6937", + "dest": "cargo/vendor/accesskit_ios-0.2.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"28e539d64b27fd4c14de8f78ada8f7c944c092f52f7e49fb63316507a57f6937\", \"files\": {}}", + "dest": "cargo/vendor/accesskit_ios-0.2.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/accesskit_macos/accesskit_macos-0.27.1.crate", + "sha256": "5701624bf6a11efb6d4c8e922bf44126ed96250e5faa9a7a0468c979635839a4", + "dest": "cargo/vendor/accesskit_macos-0.27.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"5701624bf6a11efb6d4c8e922bf44126ed96250e5faa9a7a0468c979635839a4\", \"files\": {}}", + "dest": "cargo/vendor/accesskit_macos-0.27.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/accesskit_unix/accesskit_unix-0.24.0.crate", + "sha256": "202f24df034a7476d07b7f74284de84f6d62aabd858dbe7ee9cad3b7ad6f8f9d", + "dest": "cargo/vendor/accesskit_unix-0.24.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"202f24df034a7476d07b7f74284de84f6d62aabd858dbe7ee9cad3b7ad6f8f9d\", \"files\": {}}", + "dest": "cargo/vendor/accesskit_unix-0.24.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/accesskit_windows/accesskit_windows-0.35.1.crate", + "sha256": "ce63f35d6bdcf59f26b76b3379063f738e6412cef46999cc772d46aa3de35adb", + "dest": "cargo/vendor/accesskit_windows-0.35.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"ce63f35d6bdcf59f26b76b3379063f738e6412cef46999cc772d46aa3de35adb\", \"files\": {}}", + "dest": "cargo/vendor/accesskit_windows-0.35.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/accesskit_winit/accesskit_winit-0.34.1.crate", + "sha256": "ee96dd150375c05912d8a473f98c2fb155fb3234fac88292d396548a2460fa77", + "dest": "cargo/vendor/accesskit_winit-0.34.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"ee96dd150375c05912d8a473f98c2fb155fb3234fac88292d396548a2460fa77\", \"files\": {}}", + "dest": "cargo/vendor/accesskit_winit-0.34.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/addr2line/addr2line-0.25.1.crate", + "sha256": "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b", + "dest": "cargo/vendor/addr2line-0.25.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b\", \"files\": {}}", + "dest": "cargo/vendor/addr2line-0.25.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/adler2/adler2-2.0.1.crate", + "sha256": "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa", + "dest": "cargo/vendor/adler2-2.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa\", \"files\": {}}", + "dest": "cargo/vendor/adler2-2.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/aead/aead-0.5.2.crate", + "sha256": "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0", + "dest": "cargo/vendor/aead-0.5.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0\", \"files\": {}}", + "dest": "cargo/vendor/aead-0.5.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/aes/aes-0.8.4.crate", + "sha256": "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0", + "dest": "cargo/vendor/aes-0.8.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0\", \"files\": {}}", + "dest": "cargo/vendor/aes-0.8.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/aes-gcm/aes-gcm-0.10.3.crate", + "sha256": "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1", + "dest": "cargo/vendor/aes-gcm-0.10.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1\", \"files\": {}}", + "dest": "cargo/vendor/aes-gcm-0.10.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ahash/ahash-0.8.12.crate", + "sha256": "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75", + "dest": "cargo/vendor/ahash-0.8.12" + }, + { + "type": "inline", + "contents": "{\"package\": \"5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75\", \"files\": {}}", + "dest": "cargo/vendor/ahash-0.8.12", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/aligned/aligned-0.4.3.crate", + "sha256": "ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685", + "dest": "cargo/vendor/aligned-0.4.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"ee4508988c62edf04abd8d92897fca0c2995d907ce1dfeaf369dac3716a40685\", \"files\": {}}", + "dest": "cargo/vendor/aligned-0.4.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/aligned-vec/aligned-vec-0.6.4.crate", + "sha256": "dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b", + "dest": "cargo/vendor/aligned-vec-0.6.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"dc890384c8602f339876ded803c97ad529f3842aba97f6392b3dba0dd171769b\", \"files\": {}}", + "dest": "cargo/vendor/aligned-vec-0.6.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/alloc-no-stdlib/alloc-no-stdlib-2.0.4.crate", + "sha256": "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3", + "dest": "cargo/vendor/alloc-no-stdlib-2.0.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3\", \"files\": {}}", + "dest": "cargo/vendor/alloc-no-stdlib-2.0.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/alloc-stdlib/alloc-stdlib-0.2.4.crate", + "sha256": "0e76a019e91224d279006ff972f1e984179a6e9feb050adba6ce8274aef23195", + "dest": "cargo/vendor/alloc-stdlib-0.2.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"0e76a019e91224d279006ff972f1e984179a6e9feb050adba6ce8274aef23195\", \"files\": {}}", + "dest": "cargo/vendor/alloc-stdlib-0.2.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/allocator-api2/allocator-api2-0.2.21.crate", + "sha256": "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923", + "dest": "cargo/vendor/allocator-api2-0.2.21" + }, + { + "type": "inline", + "contents": "{\"package\": \"683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923\", \"files\": {}}", + "dest": "cargo/vendor/allocator-api2-0.2.21", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/android-activity/android-activity-0.6.1.crate", + "sha256": "0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd", + "dest": "cargo/vendor/android-activity-0.6.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"0f2a1bb052857d5dd49572219344a7332b31b76405648eabac5bc68978251bcd\", \"files\": {}}", + "dest": "cargo/vendor/android-activity-0.6.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/android-properties/android-properties-0.2.2.crate", + "sha256": "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04", + "dest": "cargo/vendor/android-properties-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04\", \"files\": {}}", + "dest": "cargo/vendor/android-properties-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/android_system_properties/android_system_properties-0.1.6.crate", + "sha256": "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc", + "dest": "cargo/vendor/android_system_properties-0.1.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc\", \"files\": {}}", + "dest": "cargo/vendor/android_system_properties-0.1.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/anyhow/anyhow-1.0.104.crate", + "sha256": "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470", + "dest": "cargo/vendor/anyhow-1.0.104" + }, + { + "type": "inline", + "contents": "{\"package\": \"330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470\", \"files\": {}}", + "dest": "cargo/vendor/anyhow-1.0.104", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/arbitrary/arbitrary-1.4.2.crate", + "sha256": "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1", + "dest": "cargo/vendor/arbitrary-1.4.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1\", \"files\": {}}", + "dest": "cargo/vendor/arbitrary-1.4.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/arboard/arboard-3.6.1.crate", + "sha256": "0348a1c054491f4bfe6ab86a7b6ab1e44e45d899005de92f58b3df180b36ddaf", + "dest": "cargo/vendor/arboard-3.6.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"0348a1c054491f4bfe6ab86a7b6ab1e44e45d899005de92f58b3df180b36ddaf\", \"files\": {}}", + "dest": "cargo/vendor/arboard-3.6.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/arg_enum_proc_macro/arg_enum_proc_macro-0.3.4.crate", + "sha256": "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea", + "dest": "cargo/vendor/arg_enum_proc_macro-0.3.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea\", \"files\": {}}", + "dest": "cargo/vendor/arg_enum_proc_macro-0.3.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/arrayvec/arrayvec-0.7.8.crate", + "sha256": "d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56", + "dest": "cargo/vendor/arrayvec-0.7.8" + }, + { + "type": "inline", + "contents": "{\"package\": \"d3fb67a6e08acf24fdeccbac2cb6ac4305825bd1f117462e0e6f2f193345ad56\", \"files\": {}}", + "dest": "cargo/vendor/arrayvec-0.7.8", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/as-raw-xcb-connection/as-raw-xcb-connection-1.0.1.crate", + "sha256": "175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b", + "dest": "cargo/vendor/as-raw-xcb-connection-1.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"175571dd1d178ced59193a6fc02dde1b972eb0bc56c892cde9beeceac5bf0f6b\", \"files\": {}}", + "dest": "cargo/vendor/as-raw-xcb-connection-1.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/as-slice/as-slice-0.2.1.crate", + "sha256": "516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516", + "dest": "cargo/vendor/as-slice-0.2.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"516b6b4f0e40d50dcda9365d53964ec74560ad4284da2e7fc97122cd83174516\", \"files\": {}}", + "dest": "cargo/vendor/as-slice-0.2.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ash/ash-0.38.0+1.3.281.crate", + "sha256": "0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f", + "dest": "cargo/vendor/ash-0.38.0+1.3.281" + }, + { + "type": "inline", + "contents": "{\"package\": \"0bb44936d800fea8f016d7f2311c6a4f97aebd5dc86f09906139ec848cf3a46f\", \"files\": {}}", + "dest": "cargo/vendor/ash-0.38.0+1.3.281", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/async-broadcast/async-broadcast-0.7.2.crate", + "sha256": "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532", + "dest": "cargo/vendor/async-broadcast-0.7.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532\", \"files\": {}}", + "dest": "cargo/vendor/async-broadcast-0.7.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/async-channel/async-channel-2.5.0.crate", + "sha256": "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2", + "dest": "cargo/vendor/async-channel-2.5.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2\", \"files\": {}}", + "dest": "cargo/vendor/async-channel-2.5.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/async-executor/async-executor-1.14.0.crate", + "sha256": "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a", + "dest": "cargo/vendor/async-executor-1.14.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a\", \"files\": {}}", + "dest": "cargo/vendor/async-executor-1.14.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/async-io/async-io-2.6.0.crate", + "sha256": "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc", + "dest": "cargo/vendor/async-io-2.6.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc\", \"files\": {}}", + "dest": "cargo/vendor/async-io-2.6.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/async-lock/async-lock-3.4.2.crate", + "sha256": "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311", + "dest": "cargo/vendor/async-lock-3.4.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311\", \"files\": {}}", + "dest": "cargo/vendor/async-lock-3.4.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/async-process/async-process-2.5.0.crate", + "sha256": "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75", + "dest": "cargo/vendor/async-process-2.5.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75\", \"files\": {}}", + "dest": "cargo/vendor/async-process-2.5.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/async-recursion/async-recursion-1.1.1.crate", + "sha256": "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11", + "dest": "cargo/vendor/async-recursion-1.1.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11\", \"files\": {}}", + "dest": "cargo/vendor/async-recursion-1.1.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/async-signal/async-signal-0.2.14.crate", + "sha256": "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485", + "dest": "cargo/vendor/async-signal-0.2.14" + }, + { + "type": "inline", + "contents": "{\"package\": \"52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485\", \"files\": {}}", + "dest": "cargo/vendor/async-signal-0.2.14", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/async-task/async-task-4.7.1.crate", + "sha256": "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de", + "dest": "cargo/vendor/async-task-4.7.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de\", \"files\": {}}", + "dest": "cargo/vendor/async-task-4.7.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/async-trait/async-trait-0.1.92.crate", + "sha256": "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667", + "dest": "cargo/vendor/async-trait-0.1.92" + }, + { + "type": "inline", + "contents": "{\"package\": \"82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667\", \"files\": {}}", + "dest": "cargo/vendor/async-trait-0.1.92", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/atomic-waker/atomic-waker-1.1.2.crate", + "sha256": "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0", + "dest": "cargo/vendor/atomic-waker-1.1.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0\", \"files\": {}}", + "dest": "cargo/vendor/atomic-waker-1.1.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/atspi/atspi-0.29.0.crate", + "sha256": "c77886257be21c9cd89a4ae7e64860c6f0eefca799bb79127913052bd0eefb3d", + "dest": "cargo/vendor/atspi-0.29.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"c77886257be21c9cd89a4ae7e64860c6f0eefca799bb79127913052bd0eefb3d\", \"files\": {}}", + "dest": "cargo/vendor/atspi-0.29.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/atspi-common/atspi-common-0.13.0.crate", + "sha256": "20c5617155740c98003016429ad13fe43ce7a77b007479350a9f8bf95a29f63d", + "dest": "cargo/vendor/atspi-common-0.13.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"20c5617155740c98003016429ad13fe43ce7a77b007479350a9f8bf95a29f63d\", \"files\": {}}", + "dest": "cargo/vendor/atspi-common-0.13.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/atspi-proxies/atspi-proxies-0.13.0.crate", + "sha256": "2230e48787ed3eb4088996eab66a32ca20c0b67bbd4fd6cdfe79f04f1f04c9fc", + "dest": "cargo/vendor/atspi-proxies-0.13.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"2230e48787ed3eb4088996eab66a32ca20c0b67bbd4fd6cdfe79f04f1f04c9fc\", \"files\": {}}", + "dest": "cargo/vendor/atspi-proxies-0.13.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/autocfg/autocfg-1.5.1.crate", + "sha256": "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53", + "dest": "cargo/vendor/autocfg-1.5.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53\", \"files\": {}}", + "dest": "cargo/vendor/autocfg-1.5.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/av-scenechange/av-scenechange-0.14.1.crate", + "sha256": "0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394", + "dest": "cargo/vendor/av-scenechange-0.14.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"0f321d77c20e19b92c39e7471cf986812cbb46659d2af674adc4331ef3f18394\", \"files\": {}}", + "dest": "cargo/vendor/av-scenechange-0.14.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/av1-grain/av1-grain-0.2.5.crate", + "sha256": "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8", + "dest": "cargo/vendor/av1-grain-0.2.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8\", \"files\": {}}", + "dest": "cargo/vendor/av1-grain-0.2.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/avif-serialize/avif-serialize-0.8.9.crate", + "sha256": "e7178fe5f7d460b13895ebb9dcb28a3a6216d2df2574a0806cb51b555d297f38", + "dest": "cargo/vendor/avif-serialize-0.8.9" + }, + { + "type": "inline", + "contents": "{\"package\": \"e7178fe5f7d460b13895ebb9dcb28a3a6216d2df2574a0806cb51b555d297f38\", \"files\": {}}", + "dest": "cargo/vendor/avif-serialize-0.8.9", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/backtrace/backtrace-0.3.76.crate", + "sha256": "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6", + "dest": "cargo/vendor/backtrace-0.3.76" + }, + { + "type": "inline", + "contents": "{\"package\": \"bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6\", \"files\": {}}", + "dest": "cargo/vendor/backtrace-0.3.76", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/base16ct/base16ct-0.2.0.crate", + "sha256": "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf", + "dest": "cargo/vendor/base16ct-0.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf\", \"files\": {}}", + "dest": "cargo/vendor/base16ct-0.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/base64ct/base64ct-1.8.3.crate", + "sha256": "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06", + "dest": "cargo/vendor/base64ct-1.8.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06\", \"files\": {}}", + "dest": "cargo/vendor/base64ct-1.8.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/bit-set/bit-set-0.8.0.crate", + "sha256": "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3", + "dest": "cargo/vendor/bit-set-0.8.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3\", \"files\": {}}", + "dest": "cargo/vendor/bit-set-0.8.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/bit-set/bit-set-0.10.0.crate", + "sha256": "09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d", + "dest": "cargo/vendor/bit-set-0.10.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"09ec2f926cc3060f09db9ebc5b52823d85268d24bb917e472c0c4bea35780a7d\", \"files\": {}}", + "dest": "cargo/vendor/bit-set-0.10.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/bit-vec/bit-vec-0.8.0.crate", + "sha256": "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7", + "dest": "cargo/vendor/bit-vec-0.8.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7\", \"files\": {}}", + "dest": "cargo/vendor/bit-vec-0.8.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/bit-vec/bit-vec-0.9.1.crate", + "sha256": "b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51", + "dest": "cargo/vendor/bit-vec-0.9.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"b71798fca2c1fe1086445a7258a4bc81e6e49dcd24c8d0dd9a1e57395b603f51\", \"files\": {}}", + "dest": "cargo/vendor/bit-vec-0.9.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/bitflags/bitflags-1.3.2.crate", + "sha256": "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a", + "dest": "cargo/vendor/bitflags-1.3.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a\", \"files\": {}}", + "dest": "cargo/vendor/bitflags-1.3.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/bitflags/bitflags-2.13.2.crate", + "sha256": "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06", + "dest": "cargo/vendor/bitflags-2.13.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06\", \"files\": {}}", + "dest": "cargo/vendor/bitflags-2.13.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/bitstream-io/bitstream-io-4.10.0.crate", + "sha256": "7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f", + "dest": "cargo/vendor/bitstream-io-4.10.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"7eff00be299a18769011411c9def0d827e8f2d7bf0c3dbf53633147a8867fd1f\", \"files\": {}}", + "dest": "cargo/vendor/bitstream-io-4.10.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/block/block-0.1.6.crate", + "sha256": "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a", + "dest": "cargo/vendor/block-0.1.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a\", \"files\": {}}", + "dest": "cargo/vendor/block-0.1.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/block-buffer/block-buffer-0.10.4.crate", + "sha256": "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71", + "dest": "cargo/vendor/block-buffer-0.10.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71\", \"files\": {}}", + "dest": "cargo/vendor/block-buffer-0.10.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/block2/block2-0.5.1.crate", + "sha256": "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f", + "dest": "cargo/vendor/block2-0.5.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f\", \"files\": {}}", + "dest": "cargo/vendor/block2-0.5.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/block2/block2-0.6.2.crate", + "sha256": "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5", + "dest": "cargo/vendor/block2-0.6.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5\", \"files\": {}}", + "dest": "cargo/vendor/block2-0.6.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/blocking/blocking-1.7.0.crate", + "sha256": "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa", + "dest": "cargo/vendor/blocking-1.7.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa\", \"files\": {}}", + "dest": "cargo/vendor/blocking-1.7.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/brotli/brotli-8.0.4.crate", + "sha256": "5cc91aac060a7a1e25823bdccbfb6af1875b88f17c6daac97894eed8207166b3", + "dest": "cargo/vendor/brotli-8.0.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"5cc91aac060a7a1e25823bdccbfb6af1875b88f17c6daac97894eed8207166b3\", \"files\": {}}", + "dest": "cargo/vendor/brotli-8.0.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/brotli-decompressor/brotli-decompressor-5.0.3.crate", + "sha256": "3a32acac15fe1967bc3986b2a6347dffc965602354ea6f450ad07e8bfd253583", + "dest": "cargo/vendor/brotli-decompressor-5.0.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"3a32acac15fe1967bc3986b2a6347dffc965602354ea6f450ad07e8bfd253583\", \"files\": {}}", + "dest": "cargo/vendor/brotli-decompressor-5.0.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/built/built-0.8.1.crate", + "sha256": "5c0e531d93d39c34eef561e929e8a7f86d77a5af08aac4f6d6e39976c51858e9", + "dest": "cargo/vendor/built-0.8.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"5c0e531d93d39c34eef561e929e8a7f86d77a5af08aac4f6d6e39976c51858e9\", \"files\": {}}", + "dest": "cargo/vendor/built-0.8.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/bumpalo/bumpalo-3.20.3.crate", + "sha256": "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649", + "dest": "cargo/vendor/bumpalo-3.20.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649\", \"files\": {}}", + "dest": "cargo/vendor/bumpalo-3.20.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/bytemuck/bytemuck-1.25.2.crate", + "sha256": "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797", + "dest": "cargo/vendor/bytemuck-1.25.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797\", \"files\": {}}", + "dest": "cargo/vendor/bytemuck-1.25.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/bytemuck_derive/bytemuck_derive-1.12.1.crate", + "sha256": "6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c", + "dest": "cargo/vendor/bytemuck_derive-1.12.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"6a1f896587b6f2c069c73d2f0913e2d590c3990285cd2f0b6aa02b786b4c679c\", \"files\": {}}", + "dest": "cargo/vendor/bytemuck_derive-1.12.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/byteorder/byteorder-1.5.0.crate", + "sha256": "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b", + "dest": "cargo/vendor/byteorder-1.5.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b\", \"files\": {}}", + "dest": "cargo/vendor/byteorder-1.5.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/byteorder-lite/byteorder-lite-0.1.0.crate", + "sha256": "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495", + "dest": "cargo/vendor/byteorder-lite-0.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495\", \"files\": {}}", + "dest": "cargo/vendor/byteorder-lite-0.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/bytes/bytes-1.12.1.crate", + "sha256": "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04", + "dest": "cargo/vendor/bytes-1.12.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04\", \"files\": {}}", + "dest": "cargo/vendor/bytes-1.12.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/calloop/calloop-0.13.0.crate", + "sha256": "b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec", + "dest": "cargo/vendor/calloop-0.13.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"b99da2f8558ca23c71f4fd15dc57c906239752dd27ff3c00a1d56b685b7cbfec\", \"files\": {}}", + "dest": "cargo/vendor/calloop-0.13.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/calloop/calloop-0.14.4.crate", + "sha256": "4dbf9978365bac10f54d1d4b04f7ce4427e51f71d61f2fe15e3fed5166474df7", + "dest": "cargo/vendor/calloop-0.14.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"4dbf9978365bac10f54d1d4b04f7ce4427e51f71d61f2fe15e3fed5166474df7\", \"files\": {}}", + "dest": "cargo/vendor/calloop-0.14.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/calloop-wayland-source/calloop-wayland-source-0.3.0.crate", + "sha256": "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20", + "dest": "cargo/vendor/calloop-wayland-source-0.3.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20\", \"files\": {}}", + "dest": "cargo/vendor/calloop-wayland-source-0.3.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/calloop-wayland-source/calloop-wayland-source-0.4.1.crate", + "sha256": "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa", + "dest": "cargo/vendor/calloop-wayland-source-0.4.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa\", \"files\": {}}", + "dest": "cargo/vendor/calloop-wayland-source-0.4.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/candle-core/candle-core-0.9.2.crate", + "sha256": "c15b675b80d994b2eadb20a4bbe434eabeb454eac3ee5e2b4cf6f147ee9be091", + "dest": "cargo/vendor/candle-core-0.9.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"c15b675b80d994b2eadb20a4bbe434eabeb454eac3ee5e2b4cf6f147ee9be091\", \"files\": {}}", + "dest": "cargo/vendor/candle-core-0.9.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/candle-metal-kernels/candle-metal-kernels-0.9.2.crate", + "sha256": "2fdfe9d06de16ce49961e49084e5b79a75a9bdf157246e7c7b6328e87a7aa25d", + "dest": "cargo/vendor/candle-metal-kernels-0.9.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"2fdfe9d06de16ce49961e49084e5b79a75a9bdf157246e7c7b6328e87a7aa25d\", \"files\": {}}", + "dest": "cargo/vendor/candle-metal-kernels-0.9.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/candle-nn/candle-nn-0.9.2.crate", + "sha256": "3045fa9e7aef8567d209a27d56b692f60b96f4d0569f4c3011f8ca6715c65e03", + "dest": "cargo/vendor/candle-nn-0.9.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"3045fa9e7aef8567d209a27d56b692f60b96f4d0569f4c3011f8ca6715c65e03\", \"files\": {}}", + "dest": "cargo/vendor/candle-nn-0.9.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/candle-ug/candle-ug-0.9.2.crate", + "sha256": "c22d62be69068bf58987a45f690612739d8d2ea1bf508c1b87dc6815a019575d", + "dest": "cargo/vendor/candle-ug-0.9.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"c22d62be69068bf58987a45f690612739d8d2ea1bf508c1b87dc6815a019575d\", \"files\": {}}", + "dest": "cargo/vendor/candle-ug-0.9.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/cc/cc-1.5.1.crate", + "sha256": "f360145194ee8e21db5ee7f3fcd4fe52210864c75c985dae33218202c8bbe040", + "dest": "cargo/vendor/cc-1.5.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"f360145194ee8e21db5ee7f3fcd4fe52210864c75c985dae33218202c8bbe040\", \"files\": {}}", + "dest": "cargo/vendor/cc-1.5.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/cfg-if/cfg-if-1.0.5.crate", + "sha256": "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600", + "dest": "cargo/vendor/cfg-if-1.0.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600\", \"files\": {}}", + "dest": "cargo/vendor/cfg-if-1.0.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/cfg_aliases/cfg_aliases-0.2.2.crate", + "sha256": "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527", + "dest": "cargo/vendor/cfg_aliases-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527\", \"files\": {}}", + "dest": "cargo/vendor/cfg_aliases-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/cgl/cgl-0.3.2.crate", + "sha256": "0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff", + "dest": "cargo/vendor/cgl-0.3.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"0ced0551234e87afee12411d535648dd89d2e7f34c78b753395567aff3d447ff\", \"files\": {}}", + "dest": "cargo/vendor/cgl-0.3.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/chacha20/chacha20-0.9.1.crate", + "sha256": "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818", + "dest": "cargo/vendor/chacha20-0.9.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818\", \"files\": {}}", + "dest": "cargo/vendor/chacha20-0.9.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/chacha20poly1305/chacha20poly1305-0.10.1.crate", + "sha256": "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35", + "dest": "cargo/vendor/chacha20poly1305-0.10.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35\", \"files\": {}}", + "dest": "cargo/vendor/chacha20poly1305-0.10.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/chrono/chrono-0.4.45.crate", + "sha256": "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327", + "dest": "cargo/vendor/chrono-0.4.45" + }, + { + "type": "inline", + "contents": "{\"package\": \"1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327\", \"files\": {}}", + "dest": "cargo/vendor/chrono-0.4.45", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/cipher/cipher-0.4.4.crate", + "sha256": "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad", + "dest": "cargo/vendor/cipher-0.4.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad\", \"files\": {}}", + "dest": "cargo/vendor/cipher-0.4.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/clipboard-win/clipboard-win-5.4.1.crate", + "sha256": "bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4", + "dest": "cargo/vendor/clipboard-win-5.4.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"bde03770d3df201d4fb868f2c9c59e66a3e4e2bd06692a0fe701e7103c7e84d4\", \"files\": {}}", + "dest": "cargo/vendor/clipboard-win-5.4.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/codespan-reporting/codespan-reporting-0.13.1.crate", + "sha256": "af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681", + "dest": "cargo/vendor/codespan-reporting-0.13.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"af491d569909a7e4dee0ad7db7f5341fef5c614d5b8ec8cf765732aba3cff681\", \"files\": {}}", + "dest": "cargo/vendor/codespan-reporting-0.13.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/coe-rs/coe-rs-0.1.2.crate", + "sha256": "7e8f1e641542c07631228b1e0dc04b69ae3c1d58ef65d5691a439711d805c698", + "dest": "cargo/vendor/coe-rs-0.1.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"7e8f1e641542c07631228b1e0dc04b69ae3c1d58ef65d5691a439711d805c698\", \"files\": {}}", + "dest": "cargo/vendor/coe-rs-0.1.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/color/color-0.3.3.crate", + "sha256": "2ec7c5eb7a16992b1904d76c517d170ab353b0e0b3d5a0c81a8a0cd1037893cf", + "dest": "cargo/vendor/color-0.3.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"2ec7c5eb7a16992b1904d76c517d170ab353b0e0b3d5a0c81a8a0cd1037893cf\", \"files\": {}}", + "dest": "cargo/vendor/color-0.3.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/color_quant/color_quant-1.1.0.crate", + "sha256": "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b", + "dest": "cargo/vendor/color_quant-1.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b\", \"files\": {}}", + "dest": "cargo/vendor/color_quant-1.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/colored/colored-2.2.0.crate", + "sha256": "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c", + "dest": "cargo/vendor/colored-2.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c\", \"files\": {}}", + "dest": "cargo/vendor/colored-2.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/combine/combine-4.6.8.crate", + "sha256": "cfc320937d09e6de266b31b9afb480f197d7a861be86be7cb2ea7e5d1bfffc5e", + "dest": "cargo/vendor/combine-4.6.8" + }, + { + "type": "inline", + "contents": "{\"package\": \"cfc320937d09e6de266b31b9afb480f197d7a861be86be7cb2ea7e5d1bfffc5e\", \"files\": {}}", + "dest": "cargo/vendor/combine-4.6.8", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/concurrent-queue/concurrent-queue-2.5.0.crate", + "sha256": "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973", + "dest": "cargo/vendor/concurrent-queue-2.5.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973\", \"files\": {}}", + "dest": "cargo/vendor/concurrent-queue-2.5.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/const-oid/const-oid-0.9.6.crate", + "sha256": "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8", + "dest": "cargo/vendor/const-oid-0.9.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8\", \"files\": {}}", + "dest": "cargo/vendor/const-oid-0.9.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/core-foundation/core-foundation-0.9.4.crate", + "sha256": "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f", + "dest": "cargo/vendor/core-foundation-0.9.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f\", \"files\": {}}", + "dest": "cargo/vendor/core-foundation-0.9.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/core-foundation-sys/core-foundation-sys-0.8.7.crate", + "sha256": "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b", + "dest": "cargo/vendor/core-foundation-sys-0.8.7" + }, + { + "type": "inline", + "contents": "{\"package\": \"773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b\", \"files\": {}}", + "dest": "cargo/vendor/core-foundation-sys-0.8.7", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/core-graphics/core-graphics-0.23.2.crate", + "sha256": "c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081", + "dest": "cargo/vendor/core-graphics-0.23.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"c07782be35f9e1140080c6b96f0d44b739e2278479f64e02fdab4e32dfd8b081\", \"files\": {}}", + "dest": "cargo/vendor/core-graphics-0.23.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/core-graphics-types/core-graphics-types-0.1.3.crate", + "sha256": "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf", + "dest": "cargo/vendor/core-graphics-types-0.1.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf\", \"files\": {}}", + "dest": "cargo/vendor/core-graphics-types-0.1.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/cpufeatures/cpufeatures-0.2.17.crate", + "sha256": "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280", + "dest": "cargo/vendor/cpufeatures-0.2.17" + }, + { + "type": "inline", + "contents": "{\"package\": \"59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280\", \"files\": {}}", + "dest": "cargo/vendor/cpufeatures-0.2.17", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-82a24b0/crates/docpath\" \"cargo/vendor/craft-docpath\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"craft-docpath\"\ndescription = \"Decide whether a file path or file URL stored in a document refers to a local file.\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrust-version = \"1.95\"\nrepository = \"https://github.com/storytold/craft-libs\"\n\n[lints.rust]\nunsafe_code = \"forbid\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ndbg_macro = \"warn\"\ntodo = \"warn\"\n", + "dest": "cargo/vendor/craft-docpath", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/craft-docpath", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/craft-libs-25da131/crates/ui\" \"cargo/vendor/craft-ui\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"craft-ui\"\nversion = \"0.1.0\"\nedition = \"2024\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https://github.com/storytold/craft-libs\"\nrust-version = \"1.95\"\ndescription = \"Reusable egui controls and icon catalogs for Craft frontends\"\n\n[lints.rust]\nunsafe_code = \"forbid\"\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(craft_pdf_unicode_fixtures)\"]\n\n[lints.clippy]\ndbg_macro = \"warn\"\ntodo = \"warn\"\n\n[dependencies.egui]\nversion = \"0.37\"\ndefault-features = false\n\n[dependencies.serde]\nversion = \"1\"\nfeatures = [\"derive\"]\noptional = true\n\n[features]\nserde = [\"dep:serde\"]\n\n[dev-dependencies]\nserde_json = \"1\"\n\n[dev-dependencies.egui]\nfeatures = [\"default_fonts\"]\nversion = \"0.37\"\ndefault-features = false\n\n[dev-dependencies.egui_extras]\nversion = \"0.37\"\ndefault-features = false\nfeatures = [\"svg\"]\n\n[dev-dependencies.egui_kittest]\nversion = \"0.37\"\nfeatures = [\"wgpu\"]\n\n[dev-dependencies.image]\nversion = \"0.25\"\ndefault-features = false\nfeatures = [\"png\"]\n", + "dest": "cargo/vendor/craft-ui", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/craft-ui", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/crc32fast/crc32fast-1.5.2.crate", + "sha256": "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78", + "dest": "cargo/vendor/crc32fast-1.5.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78\", \"files\": {}}", + "dest": "cargo/vendor/crc32fast-1.5.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/crossbeam-channel/crossbeam-channel-0.5.17.crate", + "sha256": "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1", + "dest": "cargo/vendor/crossbeam-channel-0.5.17" + }, + { + "type": "inline", + "contents": "{\"package\": \"98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1\", \"files\": {}}", + "dest": "cargo/vendor/crossbeam-channel-0.5.17", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/crossbeam-deque/crossbeam-deque-0.8.8.crate", + "sha256": "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a", + "dest": "cargo/vendor/crossbeam-deque-0.8.8" + }, + { + "type": "inline", + "contents": "{\"package\": \"622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a\", \"files\": {}}", + "dest": "cargo/vendor/crossbeam-deque-0.8.8", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/crossbeam-epoch/crossbeam-epoch-0.9.21.crate", + "sha256": "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d", + "dest": "cargo/vendor/crossbeam-epoch-0.9.21" + }, + { + "type": "inline", + "contents": "{\"package\": \"dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d\", \"files\": {}}", + "dest": "cargo/vendor/crossbeam-epoch-0.9.21", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/crossbeam-utils/crossbeam-utils-0.8.23.crate", + "sha256": "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6", + "dest": "cargo/vendor/crossbeam-utils-0.8.23" + }, + { + "type": "inline", + "contents": "{\"package\": \"a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6\", \"files\": {}}", + "dest": "cargo/vendor/crossbeam-utils-0.8.23", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/crunchy/crunchy-0.2.4.crate", + "sha256": "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5", + "dest": "cargo/vendor/crunchy-0.2.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5\", \"files\": {}}", + "dest": "cargo/vendor/crunchy-0.2.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/crypto-bigint/crypto-bigint-0.5.5.crate", + "sha256": "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76", + "dest": "cargo/vendor/crypto-bigint-0.5.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76\", \"files\": {}}", + "dest": "cargo/vendor/crypto-bigint-0.5.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/crypto-common/crypto-common-0.1.7.crate", + "sha256": "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a", + "dest": "cargo/vendor/crypto-common-0.1.7" + }, + { + "type": "inline", + "contents": "{\"package\": \"78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a\", \"files\": {}}", + "dest": "cargo/vendor/crypto-common-0.1.7", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ctr/ctr-0.9.2.crate", + "sha256": "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835", + "dest": "cargo/vendor/ctr-0.9.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835\", \"files\": {}}", + "dest": "cargo/vendor/ctr-0.9.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/cursor-icon/cursor-icon-1.2.0.crate", + "sha256": "f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f", + "dest": "cargo/vendor/cursor-icon-1.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"f27ae1dd37df86211c42e150270f82743308803d90a6f6e6651cd730d5e1732f\", \"files\": {}}", + "dest": "cargo/vendor/cursor-icon-1.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/curve25519-dalek/curve25519-dalek-4.1.3.crate", + "sha256": "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be", + "dest": "cargo/vendor/curve25519-dalek-4.1.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be\", \"files\": {}}", + "dest": "cargo/vendor/curve25519-dalek-4.1.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/curve25519-dalek-derive/curve25519-dalek-derive-0.1.1.crate", + "sha256": "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3", + "dest": "cargo/vendor/curve25519-dalek-derive-0.1.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3\", \"files\": {}}", + "dest": "cargo/vendor/curve25519-dalek-derive-0.1.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/der/der-0.7.10.crate", + "sha256": "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb", + "dest": "cargo/vendor/der-0.7.10" + }, + { + "type": "inline", + "contents": "{\"package\": \"e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb\", \"files\": {}}", + "dest": "cargo/vendor/der-0.7.10", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/dhat/dhat-0.3.3.crate", + "sha256": "98cd11d84628e233de0ce467de10b8633f4ddaecafadefc86e13b84b8739b827", + "dest": "cargo/vendor/dhat-0.3.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"98cd11d84628e233de0ce467de10b8633f4ddaecafadefc86e13b84b8739b827\", \"files\": {}}", + "dest": "cargo/vendor/dhat-0.3.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/dify/dify-0.8.0.crate", + "sha256": "90ce0fb972943b4e88cd03b8f92953df0c71bb05e0bde8e5b684895d808013cc", + "dest": "cargo/vendor/dify-0.8.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"90ce0fb972943b4e88cd03b8f92953df0c71bb05e0bde8e5b684895d808013cc\", \"files\": {}}", + "dest": "cargo/vendor/dify-0.8.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/digest/digest-0.10.7.crate", + "sha256": "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292", + "dest": "cargo/vendor/digest-0.10.7" + }, + { + "type": "inline", + "contents": "{\"package\": \"9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292\", \"files\": {}}", + "dest": "cargo/vendor/digest-0.10.7", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/dispatch/dispatch-0.2.0.crate", + "sha256": "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b", + "dest": "cargo/vendor/dispatch-0.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b\", \"files\": {}}", + "dest": "cargo/vendor/dispatch-0.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/dispatch2/dispatch2-0.3.1.crate", + "sha256": "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38", + "dest": "cargo/vendor/dispatch2-0.3.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38\", \"files\": {}}", + "dest": "cargo/vendor/dispatch2-0.3.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/dlib/dlib-0.5.3.crate", + "sha256": "ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a", + "dest": "cargo/vendor/dlib-0.5.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"ab8ecd87370524b461f8557c119c405552c396ed91fc0a8eec68679eab26f94a\", \"files\": {}}", + "dest": "cargo/vendor/dlib-0.5.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/document-features/document-features-0.2.12.crate", + "sha256": "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61", + "dest": "cargo/vendor/document-features-0.2.12" + }, + { + "type": "inline", + "contents": "{\"package\": \"d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61\", \"files\": {}}", + "dest": "cargo/vendor/document-features-0.2.12", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/downcast-rs/downcast-rs-1.2.1.crate", + "sha256": "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2", + "dest": "cargo/vendor/downcast-rs-1.2.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2\", \"files\": {}}", + "dest": "cargo/vendor/downcast-rs-1.2.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/dpi/dpi-0.1.2.crate", + "sha256": "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76", + "dest": "cargo/vendor/dpi-0.1.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76\", \"files\": {}}", + "dest": "cargo/vendor/dpi-0.1.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/dyn-stack/dyn-stack-0.10.0.crate", + "sha256": "56e53799688f5632f364f8fb387488dd05db9fe45db7011be066fc20e7027f8b", + "dest": "cargo/vendor/dyn-stack-0.10.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"56e53799688f5632f364f8fb387488dd05db9fe45db7011be066fc20e7027f8b\", \"files\": {}}", + "dest": "cargo/vendor/dyn-stack-0.10.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/dyn-stack/dyn-stack-0.13.2.crate", + "sha256": "1c4713e43e2886ba72b8271aa66c93d722116acf7a75555cce11dcde84388fe8", + "dest": "cargo/vendor/dyn-stack-0.13.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"1c4713e43e2886ba72b8271aa66c93d722116acf7a75555cce11dcde84388fe8\", \"files\": {}}", + "dest": "cargo/vendor/dyn-stack-0.13.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/dyn-stack-macros/dyn-stack-macros-0.1.3.crate", + "sha256": "e1d926b4d407d372f141f93bb444696142c29d32962ccbd3531117cf3aa0bfa9", + "dest": "cargo/vendor/dyn-stack-macros-0.1.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"e1d926b4d407d372f141f93bb444696142c29d32962ccbd3531117cf3aa0bfa9\", \"files\": {}}", + "dest": "cargo/vendor/dyn-stack-macros-0.1.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ecdsa/ecdsa-0.16.9.crate", + "sha256": "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca", + "dest": "cargo/vendor/ecdsa-0.16.9" + }, + { + "type": "inline", + "contents": "{\"package\": \"ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca\", \"files\": {}}", + "dest": "cargo/vendor/ecdsa-0.16.9", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/ecolor\" \"cargo/vendor/ecolor\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"ecolor\"\nversion = \"0.37.0\"\nauthors = [\"Emil Ernerfeldt \", \"Andreas Reich \"]\ndescription = \"Color structs and color conversion utilities\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"README.md\"\nrepository = \"https://github.com/emilk/egui\"\ncategories = [\"mathematics\", \"encoding\"]\nkeywords = [\"gui\", \"color\", \"conversion\", \"gamedev\", \"images\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n\n[lib]\n\n[features]\ndefault = []\n\n[dependencies.emath]\nversion = \"0.37.0\"\npath = \"crates/emath\"\ndefault-features = false\n\n[dependencies.bytemuck]\noptional = true\nfeatures = [\"derive\"]\nversion = \"1.25\"\n\n[dependencies.cint]\noptional = true\nversion = \"0.3.1\"\n\n[dependencies.color-hex]\noptional = true\nversion = \"0.2.0\"\n\n[dependencies.document-features]\noptional = true\nversion = \"0.2.12\"\n\n[dependencies.serde]\noptional = true\nversion = \"1.0\"\nfeatures = [\"derive\"]\n", + "dest": "cargo/vendor/ecolor", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/ecolor", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ed25519/ed25519-2.2.3.crate", + "sha256": "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53", + "dest": "cargo/vendor/ed25519-2.2.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53\", \"files\": {}}", + "dest": "cargo/vendor/ed25519-2.2.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ed25519-dalek/ed25519-dalek-2.2.0.crate", + "sha256": "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9", + "dest": "cargo/vendor/ed25519-dalek-2.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9\", \"files\": {}}", + "dest": "cargo/vendor/ed25519-dalek-2.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/eframe\" \"cargo/vendor/eframe\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"eframe\"\nversion = \"0.37.0\"\nauthors = [\"Emil Ernerfeldt \"]\ndescription = \"egui framework - write GUI apps that compiles to web and/or natively\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui/tree/main/crates/eframe\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"README.md\"\nrepository = \"https://github.com/emilk/egui/tree/main/crates/eframe\"\ncategories = [\"gui\", \"game-development\"]\nkeywords = [\"egui\", \"gui\", \"gamedev\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\", \"data/icon.png\"]\n\n[package.metadata.docs.rs]\nall-features = true\ntargets = [\"x86_64-unknown-linux-gnu\", \"wasm32-unknown-unknown\"]\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n\n[lib]\n\n[features]\ndefault = [\"accesskit\", \"clipboard\", \"default_fonts\", \"links\", \"system_fonts\", \"wayland\", \"web_screen_reader\", \"wgpu\", \"winit/default\", \"x11\"]\naccesskit = [\"egui-winit/accesskit\"]\nandroid-game-activity = [\"egui-winit/android-game-activity\"]\nandroid-native-activity = [\"egui-winit/android-native-activity\"]\ndefault_fonts = [\"egui/default_fonts\"]\nexperimental = [\"egui/experimental\"]\nglow = [\"dep:egui_glow\", \"dep:glow\", \"dep:glutin-winit\", \"dep:glutin\"]\npersistence = [\"egui-winit/serde\", \"egui/persistence\", \"ron\", \"serde\"]\nwayland = [\"egui-winit/wayland\", \"egui-wgpu?/wayland\", \"egui_glow?/wayland\", \"glutin?/wayland\", \"glutin-winit?/wayland\"]\nsystem_fonts = [\"dep:egui_system_font_provider\"]\nweb_screen_reader = [\"web-sys/SpeechSynthesis\", \"web-sys/SpeechSynthesisUtterance\"]\nwgpu = [\"wgpu_no_default_features\", \"egui-wgpu/default\"]\nwgpu_no_default_features = [\"dep:wgpu\", \"dep:egui-wgpu\", \"dep:pollster\"]\nx11 = [\"egui-winit/x11\", \"egui-wgpu?/x11\", \"egui_glow?/x11\", \"glutin?/x11\", \"glutin?/glx\", \"glutin-winit?/x11\", \"glutin-winit?/glx\"]\n__screenshot = []\ninspection = [\"dep:egui_inspection\", \"accesskit\"]\nlinks = [\"egui-winit/links\"]\nclipboard = [\"egui-winit/clipboard\", \"egui-winit/clipboard-image\"]\n\n[dependencies]\ndocument-features = \"0.2.12\"\nparking_lot = \"0.12.5\"\nraw-window-handle = \"0.6.2\"\nstatic_assertions = \"1.1\"\nweb-time = \"1.1\"\n\n[dependencies.egui]\ndefault-features = false\nfeatures = [\"bytemuck\"]\nversion = \"0.37.0\"\npath = \"crates/egui\"\n\n[dependencies.ahash]\nversion = \"0.8.12\"\ndefault-features = false\nfeatures = [\"no-rng\", \"std\"]\n\n[dependencies.log]\nversion = \"0.4.34\"\nfeatures = [\"std\"]\n\n[dependencies.profiling]\nversion = \"1.0\"\ndefault-features = false\n\n[dependencies.egui_glow]\noptional = true\ndefault-features = false\nversion = \"0.37.0\"\npath = \"crates/egui_glow\"\n\n[dependencies.egui_inspection]\noptional = true\nfeatures = [\"plugin\"]\nversion = \"0.37.0\"\npath = \"crates/egui_inspection\"\ndefault-features = false\n\n[dependencies.glow]\noptional = true\nversion = \"0.17.0\"\n\n[dependencies.ron]\noptional = true\nfeatures = [\"integer128\"]\nversion = \"0.12.2\"\n\n[dependencies.serde]\noptional = true\nversion = \"1.0\"\nfeatures = [\"derive\"]\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.egui-winit]\ndefault-features = false\nversion = \"0.37.0\"\npath = \"crates/egui-winit\"\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.image]\nfeatures = [\"png\"]\nversion = \"0.25.10\"\ndefault-features = false\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.winit]\ndefault-features = false\nfeatures = [\"rwh_06\"]\nversion = \"0.30.13\"\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.egui_system_font_provider]\noptional = true\nversion = \"0.37.0\"\npath = \"crates/egui_system_font_provider\"\ndefault-features = false\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.egui-wgpu]\noptional = true\nfeatures = [\"winit\", \"capture\"]\nversion = \"0.37.0\"\npath = \"crates/egui-wgpu\"\ndefault-features = false\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.pollster]\noptional = true\nversion = \"1.0\"\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.glutin]\noptional = true\ndefault-features = false\nfeatures = [\"egl\", \"wgl\"]\nversion = \"0.32.3\"\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.glutin-winit]\noptional = true\ndefault-features = false\nfeatures = [\"egl\", \"wgl\"]\nversion = \"0.5.0\"\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dev-dependencies]\ndirectories = \"6.0\"\n\n[target.\"cfg(any(target_os = \\\"macos\\\"))\".dependencies]\nobjc2 = \"0.6.4\"\n\n[target.\"cfg(any(target_os = \\\"macos\\\"))\".dependencies.objc2-foundation]\ndefault-features = false\nfeatures = [\"std\", \"block2\", \"NSData\", \"NSString\"]\nversion = \"0.3.2\"\n\n[target.\"cfg(any(target_os = \\\"macos\\\"))\".dependencies.objc2-app-kit]\ndefault-features = false\nfeatures = [\"std\", \"NSApplication\", \"NSBitmapImageRep\", \"NSButton\", \"NSControl\", \"NSGraphics\", \"NSImage\", \"NSImageRep\", \"NSMenu\", \"NSMenuItem\", \"NSResponder\", \"NSView\", \"NSWindow\"]\nversion = \"0.3.2\"\n\n[target.\"cfg(any(target_os = \\\"windows\\\"))\".dependencies.windows-sys]\nfeatures = [\"Win32_Foundation\", \"Win32_System_Com\", \"Win32_UI_Input_KeyboardAndMouse\", \"Win32_UI_Shell\", \"Win32_UI_WindowsAndMessaging\"]\nversion = \"0.61.2\"\n\n[target.\"cfg(target_arch = \\\"wasm32\\\")\".dependencies]\nbytemuck = \"1.25\"\njs-sys = \"0.3.103\"\npercent-encoding = \"2.3\"\nsend_wrapper = \"0.6\"\nwasm-bindgen = \"0.2.126\"\n\n[target.\"cfg(target_arch = \\\"wasm32\\\")\".dependencies.egui]\nfeatures = [\"web_file\"]\nversion = \"0.37.0\"\npath = \"crates/egui\"\ndefault-features = false\n\n[target.\"cfg(target_arch = \\\"wasm32\\\")\".dependencies.image]\nfeatures = [\"png\"]\nversion = \"0.25.10\"\ndefault-features = false\n\n[target.\"cfg(target_arch = \\\"wasm32\\\")\".dependencies.web-sys]\nfeatures = [\"AddEventListenerOptions\", \"BinaryType\", \"Blob\", \"BlobPropertyBag\", \"Clipboard\", \"ClipboardEvent\", \"ClipboardItem\", \"CanvasRenderingContext2d\", \"CompositionEvent\", \"console\", \"CssStyleDeclaration\", \"DataTransfer\", \"DataTransferItem\", \"DataTransferItemList\", \"Document\", \"DomRect\", \"DragEvent\", \"Element\", \"Event\", \"EventListener\", \"EventTarget\", \"ExtSRgb\", \"File\", \"FileList\", \"FocusEvent\", \"FocusOptions\", \"HtmlCanvasElement\", \"HtmlElement\", \"HtmlInputElement\", \"InputEvent\", \"ImageData\", \"KeyboardEvent\", \"Location\", \"MediaQueryList\", \"MediaQueryListEvent\", \"MouseEvent\", \"Navigator\", \"Node\", \"NodeList\", \"Performance\", \"ResizeObserver\", \"ResizeObserverBoxOptions\", \"ResizeObserverEntry\", \"ResizeObserverOptions\", \"ResizeObserverSize\", \"ShadowRoot\", \"Storage\", \"TextMetrics\", \"Touch\", \"TouchEvent\", \"PointerEvent\", \"TouchList\", \"WebGl2RenderingContext\", \"WebglDebugRendererInfo\", \"WebGlRenderingContext\", \"WheelEvent\", \"Window\"]\nversion = \"0.3.103\"\n\n[target.\"cfg(target_arch = \\\"wasm32\\\")\".dependencies.egui-wgpu]\noptional = true\nfeatures = [\"capture\"]\nversion = \"0.37.0\"\npath = \"crates/egui-wgpu\"\ndefault-features = false\n\n[target.\"cfg(target_arch = \\\"wasm32\\\")\".dependencies.wgpu]\noptional = true\nversion = \"30.0\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[target.\"cfg(target_arch = \\\"wasm32\\\")\".dev-dependencies]\nwasm-bindgen-test = \"=0.3.76\"\n", + "dest": "cargo/vendor/eframe", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/eframe", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/egui\" \"cargo/vendor/egui\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"egui\"\nversion = \"0.37.0\"\nauthors = [\"Emil Ernerfeldt \"]\ndescription = \"An easy-to-use immediate mode GUI that runs on both web and native\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"../../README.md\"\nrepository = \"https://github.com/emilk/egui\"\ncategories = [\"gui\", \"game-development\"]\nkeywords = [\"gui\", \"imgui\", \"immediate\", \"portable\", \"gamedev\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\ntargets = [\"x86_64-unknown-linux-gnu\", \"wasm32-unknown-unknown\"]\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n\n[lib]\n\n[features]\ndefault = []\nbytemuck = [\"epaint/bytemuck\"]\ncallstack = [\"dep:backtrace\"]\ncint = [\"epaint/cint\"]\ncolor-hex = [\"epaint/color-hex\"]\ndefault_fonts = [\"epaint/default_fonts\"]\nexperimental = []\nmint = [\"epaint/mint\"]\nmonochrome_emoji_fonts = [\"default_fonts\", \"epaint/monochrome_emoji_fonts\"]\npersistence = [\"serde\", \"epaint/serde\", \"ron\"]\nrayon = [\"epaint/rayon\"]\nserde = [\"dep:serde\", \"epaint/serde\", \"accesskit/serde\"]\nunity = [\"epaint/unity\"]\nweb_file = [\"dep:web-sys\"]\n_override_unity = [\"epaint/_override_unity\"]\n\n[dependencies]\naccesskit = \"0.25.0\"\nbitflags = \"2.13\"\nitertools = \"0.15.0\"\nnohash-hasher = \"0.2.0\"\nsmallvec = \"1.16\"\nunicode-segmentation = \"1.13\"\n\n[dependencies.emath]\ndefault-features = false\nversion = \"0.37.0\"\npath = \"crates/emath\"\n\n[dependencies.epaint]\ndefault-features = false\nversion = \"0.37.0\"\npath = \"crates/epaint\"\n\n[dependencies.ahash]\nversion = \"0.8.12\"\ndefault-features = false\nfeatures = [\"no-rng\", \"std\"]\n\n[dependencies.log]\nversion = \"0.4.34\"\nfeatures = [\"std\"]\n\n[dependencies.profiling]\nversion = \"1.0\"\ndefault-features = false\n\n[dependencies.backtrace]\noptional = true\nversion = \"0.3.76\"\n\n[dependencies.document-features]\noptional = true\nversion = \"0.2.12\"\n\n[dependencies.ron]\noptional = true\nversion = \"0.12.2\"\n\n[dependencies.serde]\noptional = true\nfeatures = [\"derive\", \"rc\", \"derive\"]\nversion = \"1.0\"\n\n[target.\"cfg(target_arch = \\\"wasm32\\\")\".dependencies.web-sys]\noptional = true\nfeatures = [\"File\"]\nversion = \"0.3.103\"\n\n[dev-dependencies.skrifa]\nversion = \"0.44.0\"\ndefault-features = false\nfeatures = [\"std\", \"autohint_shaping\"]\n", + "dest": "cargo/vendor/egui", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/egui", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/egui-wgpu\" \"cargo/vendor/egui-wgpu\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"egui-wgpu\"\nversion = \"0.37.0\"\ndescription = \"Bindings for using egui natively using the wgpu library\"\nauthors = [\"Nils Hasenbanck \", \"embotech \", \"Emil Ernerfeldt \"]\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui/tree/main/crates/egui-wgpu\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"README.md\"\nrepository = \"https://github.com/emilk/egui/tree/main/crates/egui-wgpu\"\ncategories = [\"gui\", \"game-development\"]\nkeywords = [\"wgpu\", \"egui\", \"gui\", \"gamedev\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"**/*.wgsl\", \"Cargo.toml\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n\n[features]\ndefault = [\"fragile-send-sync-non-atomic-wasm\", \"macos-window-resize-jitter-fix\", \"wgpu/default\", \"wgpu/webgl\"]\ncapture = [\"dep:egui\"]\nwinit = [\"dep:winit\", \"winit/rwh_06\", \"dep:egui\", \"capture\"]\nwayland = [\"winit?/wayland\"]\nx11 = [\"winit?/x11\"]\nfragile-send-sync-non-atomic-wasm = [\"wgpu/fragile-send-sync-non-atomic-wasm\"]\nmacos-window-resize-jitter-fix = [\"wgpu/metal\"]\n\n[dependencies]\nbytemuck = \"1.25\"\ndocument-features = \"0.2.12\"\nthiserror = \"2.0\"\ntype-map = \"0.5.1\"\nweb-time = \"1.1\"\n\n[dependencies.epaint]\ndefault-features = false\nfeatures = [\"bytemuck\"]\nversion = \"0.37.0\"\npath = \"crates/epaint\"\n\n[dependencies.ahash]\nversion = \"0.8.12\"\ndefault-features = false\nfeatures = [\"no-rng\", \"std\"]\n\n[dependencies.log]\nversion = \"0.4.34\"\nfeatures = [\"std\"]\n\n[dependencies.profiling]\nversion = \"1.0\"\ndefault-features = false\n\n[dependencies.wgpu]\nfeatures = [\"wgsl\", \"std\"]\nversion = \"30.0\"\ndefault-features = false\n\n[dependencies.egui]\noptional = true\ndefault-features = false\nversion = \"0.37.0\"\npath = \"crates/egui\"\n\n[dependencies.winit]\noptional = true\ndefault-features = false\nversion = \"0.30.13\"\n", + "dest": "cargo/vendor/egui-wgpu", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/egui-wgpu", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/egui-winit\" \"cargo/vendor/egui-winit\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"egui-winit\"\nversion = \"0.37.0\"\nauthors = [\"Emil Ernerfeldt \"]\ndescription = \"Bindings for using egui with winit\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui/tree/main/crates/egui-winit\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"README.md\"\nrepository = \"https://github.com/emilk/egui/tree/main/crates/egui-winit\"\ncategories = [\"gui\", \"game-development\"]\nkeywords = [\"winit\", \"egui\", \"gui\", \"gamedev\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[package.metadata.cargo-shear]\nignored = [\"wayland-cursor\"]\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n\n[features]\ndefault = [\"clipboard\", \"clipboard-image\", \"links\", \"wayland\", \"winit/default\", \"x11\"]\naccesskit = [\"dep:accesskit_winit\"]\nandroid-game-activity = [\"winit/android-game-activity\"]\nandroid-native-activity = [\"winit/android-native-activity\"]\nbytemuck = [\"egui/bytemuck\", \"dep:bytemuck\"]\nclipboard = [\"arboard\", \"bytemuck\", \"smithay-clipboard\"]\nclipboard-image = [\"clipboard\", \"dep:image\", \"dep:parking_lot\"]\nlinks = [\"webbrowser\"]\nserde = [\"egui/serde\", \"dep:serde\"]\nwayland = [\"winit/wayland\", \"bytemuck\", \"arboard?/wayland-data-control\"]\nx11 = [\"winit/x11\", \"winit/rwh_06\", \"bytemuck\"]\n\n[dependencies]\nraw-window-handle = \"0.6.2\"\nweb-time = \"1.1\"\n\n[dependencies.egui]\ndefault-features = false\nversion = \"0.37.0\"\npath = \"crates/egui\"\n\n[dependencies.log]\nversion = \"0.4.34\"\nfeatures = [\"std\"]\n\n[dependencies.profiling]\nversion = \"1.0\"\ndefault-features = false\n\n[dependencies.winit]\ndefault-features = false\nversion = \"0.30.13\"\n\n[dependencies.accesskit_winit]\noptional = true\nversion = \"0.34.0\"\n\n[dependencies.bytemuck]\noptional = true\nversion = \"1.25\"\n\n[dependencies.document-features]\noptional = true\nversion = \"0.2.12\"\n\n[dependencies.serde]\noptional = true\nversion = \"1.0\"\nfeatures = [\"derive\"]\n\n[dependencies.webbrowser]\noptional = true\nversion = \"1.2.4\"\n\n[dependencies.image]\ndefault-features = false\nfeatures = [\"png\"]\noptional = true\nversion = \"0.25.10\"\n\n[target.\"cfg(target_os = \\\"macos\\\")\".dependencies]\nblock2 = \"0.6.2\"\nobjc2 = \"0.6.4\"\n\n[target.\"cfg(target_os = \\\"macos\\\")\".dependencies.objc2-app-kit]\ndefault-features = false\nfeatures = [\"std\", \"block2\", \"NSEvent\", \"NSResponder\"]\nversion = \"0.3.2\"\n\n[target.\"cfg(target_os = \\\"ios\\\")\".dependencies]\nobjc2 = \"0.6.4\"\n\n[target.\"cfg(target_os = \\\"ios\\\")\".dependencies.objc2-foundation]\nfeatures = [\"std\", \"NSThread\"]\nversion = \"0.3.2\"\ndefault-features = false\n\n[target.\"cfg(target_os = \\\"ios\\\")\".dependencies.objc2-ui-kit]\nfeatures = [\"std\", \"objc2-core-foundation\", \"UIApplication\", \"UIGeometry\", \"UIResponder\", \"UIScene\", \"UISceneDefinitions\", \"UIView\", \"UIWindow\", \"UIWindowScene\"]\nversion = \"0.3.2\"\ndefault-features = false\n\n[target.\"cfg(target_os = \\\"windows\\\")\".dependencies.windows-sys]\nfeatures = [\"Win32_Foundation\", \"Win32_Graphics_Dwm\", \"Win32_UI_Input_KeyboardAndMouse\", \"Win32_UI_WindowsAndMessaging\"]\nversion = \"0.61.2\"\n\n[target.\"cfg(any(target_os=\\\"linux\\\", target_os=\\\"dragonfly\\\", target_os=\\\"freebsd\\\", target_os=\\\"netbsd\\\", target_os=\\\"openbsd\\\"))\".dependencies.smithay-clipboard]\noptional = true\nversion = \"0.7.2\"\n\n[target.\"cfg(any(target_os=\\\"linux\\\", target_os=\\\"dragonfly\\\", target_os=\\\"freebsd\\\", target_os=\\\"netbsd\\\", target_os=\\\"openbsd\\\"))\".dependencies.parking_lot]\noptional = true\nversion = \"0.12.5\"\n\n[target.\"cfg(any(target_os=\\\"linux\\\", target_os=\\\"dragonfly\\\", target_os=\\\"freebsd\\\", target_os=\\\"netbsd\\\", target_os=\\\"openbsd\\\"))\".dependencies.wayland-cursor]\noptional = true\nversion = \"0.31.14\"\ndefault-features = false\n\n[target.\"cfg(not(target_os = \\\"android\\\"))\".dependencies.arboard]\noptional = true\nfeatures = [\"image-data\"]\nversion = \"3.6\"\ndefault-features = false\n\n[target.\"cfg(target_os = \\\"linux\\\")\".dev-dependencies.softbuffer]\nversion = \"0.4.8\"\ndefault-features = false\nfeatures = [\"wayland\", \"wayland-dlopen\"]\n\n[[example]]\nname = \"clipboard_image_probe\"\nrequired-features = [\"wayland\", \"clipboard-image\"]\n", + "dest": "cargo/vendor/egui-winit", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/egui-winit", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/egui_glow\" \"cargo/vendor/egui_glow\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"egui_glow\"\nversion = \"0.37.0\"\nauthors = [\"Emil Ernerfeldt \"]\ndescription = \"Bindings for using egui natively using the glow library\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui/tree/main/crates/egui_glow\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"README.md\"\nrepository = \"https://github.com/emilk/egui/tree/main/crates/egui_glow\"\ncategories = [\"gui\", \"game-development\"]\nkeywords = [\"glow\", \"egui\", \"gui\", \"gamedev\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\", \"src/shader/*.glsl\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n\n[features]\ndefault = []\nclipboard = [\"egui-winit?/clipboard\"]\nlinks = [\"egui-winit?/links\"]\nwinit = [\"egui-winit\", \"dep:winit\"]\nwayland = [\"winit?/wayland\"]\nx11 = [\"winit?/x11\"]\n\n[dependencies]\nbytemuck = \"1.25\"\nglow = \"0.17.0\"\n\n[dependencies.egui]\ndefault-features = false\nfeatures = [\"bytemuck\"]\nversion = \"0.37.0\"\npath = \"crates/egui\"\n\n[dependencies.egui-winit]\noptional = true\ndefault-features = false\nversion = \"0.37.0\"\npath = \"crates/egui-winit\"\n\n[dependencies.log]\nversion = \"0.4.34\"\nfeatures = [\"std\"]\n\n[dependencies.profiling]\nversion = \"1.0\"\ndefault-features = false\n\n[dependencies.document-features]\noptional = true\nversion = \"0.2.12\"\n\n[dependencies.winit]\noptional = true\ndefault-features = false\nfeatures = [\"rwh_06\"]\nversion = \"0.30.13\"\n\n[dev-dependencies.glutin]\ndefault-features = false\nversion = \"0.32.3\"\n\n[dev-dependencies.glutin-winit]\ndefault-features = false\nversion = \"0.5.0\"\n\n[[example]]\nname = \"pure_glow\"\nrequired-features = [\"winit\", \"egui/default_fonts\"]\n", + "dest": "cargo/vendor/egui_glow", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/egui_glow", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/egui_kittest\" \"cargo/vendor/egui_kittest\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"egui_kittest\"\nversion = \"0.37.0\"\nauthors = [\"Lucas Meurer \", \"Emil Ernerfeldt \"]\ndescription = \"Testing library for egui based on kittest and AccessKit\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"./README.md\"\nrepository = \"https://github.com/emilk/egui\"\ncategories = [\"gui\", \"development-tools::testing\", \"accessibility\"]\nkeywords = [\"gui\", \"immediate\", \"egui\", \"testing\", \"accesskit\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[features]\nwgpu = [\"dep:egui-wgpu\", \"dep:pollster\", \"dep:image\", \"dep:wgpu\", \"eframe?/wgpu\"]\nsnapshot = [\"dep:dify\", \"dep:image\", \"dep:open\", \"dep:tempfile\", \"image/png\"]\nvideo = [\"snapshot\"]\neframe = [\"dep:eframe\", \"eframe/accesskit\"]\nx11 = [\"eframe?/x11\"]\n\n[dependencies.egui]\nversion = \"0.37.0\"\npath = \"crates/egui\"\ndefault-features = false\n\n[dependencies.eframe]\noptional = true\nversion = \"0.37.0\"\npath = \"crates/eframe\"\ndefault-features = false\n\n[dependencies.kittest]\nversion = \"0.5.0\"\n\n[dependencies.log]\nversion = \"0.4.34\"\nfeatures = [\"std\"]\n\n[dependencies.serde]\nversion = \"1.0\"\nfeatures = [\"derive\"]\n\n[dependencies.toml]\nfeatures = [\"parse\", \"serde\"]\nversion = \"1.1\"\ndefault-features = false\n\n[dependencies.egui-wgpu]\noptional = true\nversion = \"0.37.0\"\npath = \"crates/egui-wgpu\"\ndefault-features = false\n\n[dependencies.pollster]\noptional = true\nversion = \"1.0\"\n\n[dependencies.image]\noptional = true\nversion = \"0.25.10\"\ndefault-features = false\n\n[dependencies.wgpu]\nfeatures = [\"metal\", \"dx12\", \"vulkan\", \"gles\", \"std\"]\noptional = true\nversion = \"30.0\"\ndefault-features = false\n\n[dependencies.dify]\noptional = true\nversion = \"0.8.0\"\ndefault-features = false\n\n[dependencies.document-features]\noptional = true\nversion = \"0.2.12\"\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.open]\noptional = true\nversion = \"5.4\"\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dependencies.tempfile]\noptional = true\nversion = \"3.27\"\n\n[dev-dependencies]\ntempfile = \"3.27\"\n\n[dev-dependencies.egui]\nfeatures = [\"default_fonts\", \"monochrome_emoji_fonts\"]\nversion = \"0.37.0\"\npath = \"crates/egui\"\ndefault-features = false\n\n[dev-dependencies.image]\nfeatures = [\"png\"]\nversion = \"0.25.10\"\ndefault-features = false\n\n[dev-dependencies.egui_extras]\nfeatures = [\"image\", \"http\"]\nversion = \"0.37.0\"\npath = \"crates/egui_extras\"\ndefault-features = false\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n", + "dest": "cargo/vendor/egui_kittest", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/egui_kittest", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/either/either-1.18.0.crate", + "sha256": "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34", + "dest": "cargo/vendor/either-1.18.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34\", \"files\": {}}", + "dest": "cargo/vendor/either-1.18.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/elliptic-curve/elliptic-curve-0.13.8.crate", + "sha256": "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47", + "dest": "cargo/vendor/elliptic-curve-0.13.8" + }, + { + "type": "inline", + "contents": "{\"package\": \"b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47\", \"files\": {}}", + "dest": "cargo/vendor/elliptic-curve-0.13.8", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/emath\" \"cargo/vendor/emath\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"emath\"\nversion = \"0.37.0\"\nauthors = [\"Emil Ernerfeldt \"]\ndescription = \"Minimal 2D math library for GUI work\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui/tree/main/crates/emath\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"README.md\"\nrepository = \"https://github.com/emilk/egui/tree/main/crates/emath\"\ncategories = [\"mathematics\", \"gui\"]\nkeywords = [\"math\", \"gui\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n\n[lib]\n\n[features]\ndefault = []\n\n[dependencies.bytemuck]\noptional = true\nfeatures = [\"derive\"]\nversion = \"1.25\"\n\n[dependencies.document-features]\noptional = true\nversion = \"0.2.12\"\n\n[dependencies.mint]\noptional = true\nversion = \"0.5.9\"\n\n[dependencies.serde]\noptional = true\nversion = \"1.0\"\nfeatures = [\"derive\"]\n", + "dest": "cargo/vendor/emath", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/emath", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/endi/endi-1.1.1.crate", + "sha256": "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099", + "dest": "cargo/vendor/endi-1.1.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099\", \"files\": {}}", + "dest": "cargo/vendor/endi-1.1.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/enum-as-inner/enum-as-inner-0.6.1.crate", + "sha256": "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc", + "dest": "cargo/vendor/enum-as-inner-0.6.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc\", \"files\": {}}", + "dest": "cargo/vendor/enum-as-inner-0.6.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/enumflags2/enumflags2-0.7.12.crate", + "sha256": "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef", + "dest": "cargo/vendor/enumflags2-0.7.12" + }, + { + "type": "inline", + "contents": "{\"package\": \"1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef\", \"files\": {}}", + "dest": "cargo/vendor/enumflags2-0.7.12", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/enumflags2_derive/enumflags2_derive-0.7.12.crate", + "sha256": "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827", + "dest": "cargo/vendor/enumflags2_derive-0.7.12" + }, + { + "type": "inline", + "contents": "{\"package\": \"67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827\", \"files\": {}}", + "dest": "cargo/vendor/enumflags2_derive-0.7.12", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/epaint\" \"cargo/vendor/epaint\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"epaint\"\nversion = \"0.37.0\"\nauthors = [\"Emil Ernerfeldt \"]\ndescription = \"Minimal 2D graphics library for GUI work\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui/tree/main/crates/epaint\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"README.md\"\nrepository = \"https://github.com/emilk/egui/tree/main/crates/epaint\"\ncategories = [\"graphics\", \"gui\"]\nkeywords = [\"graphics\", \"gui\", \"egui\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n\n[lib]\n\n[features]\ndefault = []\nbytemuck = [\"dep:bytemuck\", \"emath/bytemuck\", \"ecolor/bytemuck\"]\ncint = [\"ecolor/cint\"]\ncolor-hex = [\"ecolor/color-hex\"]\ncolor_fonts = [\"vello_cpu/png\", \"vello_cpu/text\"]\ndefault_fonts = [\"epaint_default_fonts\"]\nmint = [\"emath/mint\"]\nmonochrome_emoji_fonts = [\"default_fonts\", \"epaint_default_fonts/monochrome_emoji_fonts\"]\nrayon = [\"dep:rayon\"]\nserde = [\"dep:serde\", \"ahash/serde\", \"ecolor/serde\", \"emath/serde\", \"font-types/serde\", \"smallvec/serde\"]\nunity = []\n_override_unity = []\n\n[dependencies]\nharfrust = \"0.12.0\"\nnohash-hasher = \"0.2.0\"\nparking_lot = \"0.12.5\"\nself_cell = \"1.3\"\nsmallvec = \"1.16\"\nunicode-general-category = \"1.1\"\nunicode-segmentation = \"1.13\"\n\n[dependencies.emath]\nversion = \"0.37.0\"\npath = \"crates/emath\"\ndefault-features = false\n\n[dependencies.ecolor]\nversion = \"0.37.0\"\npath = \"crates/ecolor\"\ndefault-features = false\n\n[dependencies.ahash]\nversion = \"0.8.12\"\ndefault-features = false\nfeatures = [\"no-rng\", \"std\"]\n\n[dependencies.font-types]\nversion = \"0.12.4\"\ndefault-features = false\nfeatures = [\"std\"]\n\n[dependencies.log]\nversion = \"0.4.34\"\nfeatures = [\"std\"]\n\n[dependencies.profiling]\nversion = \"1.0\"\ndefault-features = false\n\n[dependencies.skrifa]\nversion = \"0.44.0\"\ndefault-features = false\nfeatures = [\"std\", \"autohint_shaping\"]\n\n[dependencies.unicode-bidi]\nversion = \"0.3.18\"\ndefault-features = false\nfeatures = [\"hardcoded-data\", \"std\"]\n\n[dependencies.unicode-properties]\nversion = \"0.1.4\"\ndefault-features = false\nfeatures = [\"emoji\"]\n\n[dependencies.vello_cpu]\nversion = \"0.2.0\"\ndefault-features = false\nfeatures = [\"std\", \"u8_pipeline\", \"f32_pipeline\"]\n\n[dependencies.bytemuck]\noptional = true\nfeatures = [\"derive\"]\nversion = \"1.25\"\n\n[dependencies.document-features]\noptional = true\nversion = \"0.2.12\"\n\n[dependencies.rayon]\noptional = true\nversion = \"1.12\"\n\n[dependencies.serde]\noptional = true\nfeatures = [\"derive\", \"rc\", \"derive\"]\nversion = \"1.0\"\n\n[dependencies.epaint_default_fonts]\noptional = true\nversion = \"0.37.0\"\npath = \"crates/epaint_default_fonts\"\n\n[dev-dependencies]\nmimalloc = \"0.1.52\"\nsimilar-asserts = \"2.0\"\n\n[dev-dependencies.criterion]\nversion = \"0.8.2\"\ndefault-features = false\n\n[target.\"cfg(not(target_arch = \\\"wasm32\\\"))\".dev-dependencies.vello_cpu]\nfeatures = [\"multithreading\", \"std\", \"u8_pipeline\", \"f32_pipeline\"]\nversion = \"0.2.0\"\ndefault-features = false\n\n[[bench]]\nname = \"benchmark\"\nharness = false\n", + "dest": "cargo/vendor/epaint", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/epaint", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/epaint_default_fonts\" \"cargo/vendor/epaint_default_fonts\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"epaint_default_fonts\"\nversion = \"0.37.0\"\nauthors = [\"Emil Ernerfeldt \"]\ndescription = \"Default fonts for use in epaint / egui\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui/tree/main/crates/epaint_default_fonts\"\nlicense = \"(MIT OR Apache-2.0) AND OFL-1.1 AND Ubuntu-font-1.0\"\nreadme = \"README.md\"\nrepository = \"https://github.com/emilk/egui/tree/main/crates/epaint_default_fonts\"\ncategories = [\"graphics\", \"gui\"]\nkeywords = [\"graphics\", \"gui\", \"egui\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\", \"fonts/*.ttf\", \"fonts/*.txt\", \"fonts/OFL.txt\", \"fonts/UFL.txt\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n\n[features]\ndefault = []\nmonochrome_emoji_fonts = []\n", + "dest": "cargo/vendor/epaint_default_fonts", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/epaint_default_fonts", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/equator/equator-0.1.10.crate", + "sha256": "a3b0a88aa91d0ad2b9684e4479aed31a17d3f9051bdbbc634bd2c01bc5a5eee8", + "dest": "cargo/vendor/equator-0.1.10" + }, + { + "type": "inline", + "contents": "{\"package\": \"a3b0a88aa91d0ad2b9684e4479aed31a17d3f9051bdbbc634bd2c01bc5a5eee8\", \"files\": {}}", + "dest": "cargo/vendor/equator-0.1.10", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/equator/equator-0.4.2.crate", + "sha256": "4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc", + "dest": "cargo/vendor/equator-0.4.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"4711b213838dfee0117e3be6ac926007d7f433d7bbe33595975d4190cb07e6fc\", \"files\": {}}", + "dest": "cargo/vendor/equator-0.4.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/equator-macro/equator-macro-0.1.9.crate", + "sha256": "60d08acb9849f7fb4401564f251be5a526829183a3645a90197dea8e786cf3ae", + "dest": "cargo/vendor/equator-macro-0.1.9" + }, + { + "type": "inline", + "contents": "{\"package\": \"60d08acb9849f7fb4401564f251be5a526829183a3645a90197dea8e786cf3ae\", \"files\": {}}", + "dest": "cargo/vendor/equator-macro-0.1.9", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/equator-macro/equator-macro-0.4.2.crate", + "sha256": "44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3", + "dest": "cargo/vendor/equator-macro-0.4.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"44f23cf4b44bfce11a86ace86f8a73ffdec849c9fd00a386a53d278bd9e81fb3\", \"files\": {}}", + "dest": "cargo/vendor/equator-macro-0.4.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/equivalent/equivalent-1.0.2.crate", + "sha256": "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f", + "dest": "cargo/vendor/equivalent-1.0.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f\", \"files\": {}}", + "dest": "cargo/vendor/equivalent-1.0.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/errno/errno-0.3.14.crate", + "sha256": "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb", + "dest": "cargo/vendor/errno-0.3.14" + }, + { + "type": "inline", + "contents": "{\"package\": \"39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb\", \"files\": {}}", + "dest": "cargo/vendor/errno-0.3.14", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/error-code/error-code-3.4.0.crate", + "sha256": "0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7", + "dest": "cargo/vendor/error-code-3.4.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"0b5343afd4a8365a643ac588dab4cf234a190c7f6c88c9f6dd6ffe00837661b7\", \"files\": {}}", + "dest": "cargo/vendor/error-code-3.4.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/euclid/euclid-0.22.14.crate", + "sha256": "f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06", + "dest": "cargo/vendor/euclid-0.22.14" + }, + { + "type": "inline", + "contents": "{\"package\": \"f1a05365e3b1c6d1650318537c7460c6923f1abdd272ad6842baa2b509957a06\", \"files\": {}}", + "dest": "cargo/vendor/euclid-0.22.14", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/event-listener/event-listener-5.4.2.crate", + "sha256": "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2", + "dest": "cargo/vendor/event-listener-5.4.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2\", \"files\": {}}", + "dest": "cargo/vendor/event-listener-5.4.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/event-listener-strategy/event-listener-strategy-0.5.4.crate", + "sha256": "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93", + "dest": "cargo/vendor/event-listener-strategy-0.5.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93\", \"files\": {}}", + "dest": "cargo/vendor/event-listener-strategy-0.5.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/faer-core/faer-core-0.17.1.crate", + "sha256": "32da0f6262445261106407bdfb548df4f8f1c89bcc3cff1bb6d08e7f525b575a", + "dest": "cargo/vendor/faer-core-0.17.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"32da0f6262445261106407bdfb548df4f8f1c89bcc3cff1bb6d08e7f525b575a\", \"files\": {}}", + "dest": "cargo/vendor/faer-core-0.17.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/faer-entity/faer-entity-0.17.0.crate", + "sha256": "93fb12f36da3162b3fefc0c7343d905d5bd2c2bf444a7f63ceeaa2bc003311d3", + "dest": "cargo/vendor/faer-entity-0.17.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"93fb12f36da3162b3fefc0c7343d905d5bd2c2bf444a7f63ceeaa2bc003311d3\", \"files\": {}}", + "dest": "cargo/vendor/faer-entity-0.17.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/fastrand/fastrand-2.5.0.crate", + "sha256": "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223", + "dest": "cargo/vendor/fastrand-2.5.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223\", \"files\": {}}", + "dest": "cargo/vendor/fastrand-2.5.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/fax/fax-0.2.7.crate", + "sha256": "caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a", + "dest": "cargo/vendor/fax-0.2.7" + }, + { + "type": "inline", + "contents": "{\"package\": \"caf1079563223d5d59d83c85886a56e586cfd5c1a26292e971a0fa266531ac5a\", \"files\": {}}", + "dest": "cargo/vendor/fax-0.2.7", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/fdeflate/fdeflate-0.3.7.crate", + "sha256": "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c", + "dest": "cargo/vendor/fdeflate-0.3.7" + }, + { + "type": "inline", + "contents": "{\"package\": \"1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c\", \"files\": {}}", + "dest": "cargo/vendor/fdeflate-0.3.7", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/fearless_simd/fearless_simd-0.4.1.crate", + "sha256": "b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693", + "dest": "cargo/vendor/fearless_simd-0.4.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"b97b65636e5b9ef369943878ac74335ba1c55c1cb6adbf1e2c293c624248d693\", \"files\": {}}", + "dest": "cargo/vendor/fearless_simd-0.4.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ff/ff-0.13.1.crate", + "sha256": "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393", + "dest": "cargo/vendor/ff-0.13.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393\", \"files\": {}}", + "dest": "cargo/vendor/ff-0.13.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/fiat-crypto/fiat-crypto-0.2.9.crate", + "sha256": "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d", + "dest": "cargo/vendor/fiat-crypto-0.2.9" + }, + { + "type": "inline", + "contents": "{\"package\": \"28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d\", \"files\": {}}", + "dest": "cargo/vendor/fiat-crypto-0.2.9", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/find-msvc-tools/find-msvc-tools-0.1.14.crate", + "sha256": "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484", + "dest": "cargo/vendor/find-msvc-tools-0.1.14" + }, + { + "type": "inline", + "contents": "{\"package\": \"aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484\", \"files\": {}}", + "dest": "cargo/vendor/find-msvc-tools-0.1.14", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/fixedbitset/fixedbitset-0.5.7.crate", + "sha256": "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99", + "dest": "cargo/vendor/fixedbitset-0.5.7" + }, + { + "type": "inline", + "contents": "{\"package\": \"1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99\", \"files\": {}}", + "dest": "cargo/vendor/fixedbitset-0.5.7", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/flate2/flate2-1.1.10.crate", + "sha256": "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb", + "dest": "cargo/vendor/flate2-1.1.10" + }, + { + "type": "inline", + "contents": "{\"package\": \"6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb\", \"files\": {}}", + "dest": "cargo/vendor/flate2-1.1.10", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/float8/float8-0.6.1.crate", + "sha256": "719a903cc23e4a89e87962c2a80fdb45cdaad0983a89bd150bb57b4c8571a7d5", + "dest": "cargo/vendor/float8-0.6.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"719a903cc23e4a89e87962c2a80fdb45cdaad0983a89bd150bb57b4c8571a7d5\", \"files\": {}}", + "dest": "cargo/vendor/float8-0.6.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/fnv/fnv-1.0.7.crate", + "sha256": "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1", + "dest": "cargo/vendor/fnv-1.0.7" + }, + { + "type": "inline", + "contents": "{\"package\": \"3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1\", \"files\": {}}", + "dest": "cargo/vendor/fnv-1.0.7", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/foldhash/foldhash-0.1.5.crate", + "sha256": "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2", + "dest": "cargo/vendor/foldhash-0.1.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2\", \"files\": {}}", + "dest": "cargo/vendor/foldhash-0.1.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/foldhash/foldhash-0.2.0.crate", + "sha256": "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb", + "dest": "cargo/vendor/foldhash-0.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb\", \"files\": {}}", + "dest": "cargo/vendor/foldhash-0.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/font-types/font-types-0.12.5.crate", + "sha256": "b8eb065f3251655b3c90e22e5e363f310fc5332fb3402e37bbc94752283248f6", + "dest": "cargo/vendor/font-types-0.12.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"b8eb065f3251655b3c90e22e5e363f310fc5332fb3402e37bbc94752283248f6\", \"files\": {}}", + "dest": "cargo/vendor/font-types-0.12.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/foreign-types/foreign-types-0.5.0.crate", + "sha256": "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965", + "dest": "cargo/vendor/foreign-types-0.5.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965\", \"files\": {}}", + "dest": "cargo/vendor/foreign-types-0.5.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/foreign-types-macros/foreign-types-macros-0.2.4.crate", + "sha256": "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225", + "dest": "cargo/vendor/foreign-types-macros-0.2.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225\", \"files\": {}}", + "dest": "cargo/vendor/foreign-types-macros-0.2.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/foreign-types-shared/foreign-types-shared-0.3.1.crate", + "sha256": "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b", + "dest": "cargo/vendor/foreign-types-shared-0.3.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b\", \"files\": {}}", + "dest": "cargo/vendor/foreign-types-shared-0.3.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/futures-core/futures-core-0.3.34.crate", + "sha256": "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e", + "dest": "cargo/vendor/futures-core-0.3.34" + }, + { + "type": "inline", + "contents": "{\"package\": \"92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e\", \"files\": {}}", + "dest": "cargo/vendor/futures-core-0.3.34", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/futures-io/futures-io-0.3.34.crate", + "sha256": "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed", + "dest": "cargo/vendor/futures-io-0.3.34" + }, + { + "type": "inline", + "contents": "{\"package\": \"53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed\", \"files\": {}}", + "dest": "cargo/vendor/futures-io-0.3.34", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/futures-lite/futures-lite-2.6.1.crate", + "sha256": "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad", + "dest": "cargo/vendor/futures-lite-2.6.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad\", \"files\": {}}", + "dest": "cargo/vendor/futures-lite-2.6.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/futures-macro/futures-macro-0.3.34.crate", + "sha256": "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44", + "dest": "cargo/vendor/futures-macro-0.3.34" + }, + { + "type": "inline", + "contents": "{\"package\": \"9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44\", \"files\": {}}", + "dest": "cargo/vendor/futures-macro-0.3.34", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/futures-task/futures-task-0.3.34.crate", + "sha256": "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd", + "dest": "cargo/vendor/futures-task-0.3.34" + }, + { + "type": "inline", + "contents": "{\"package\": \"cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd\", \"files\": {}}", + "dest": "cargo/vendor/futures-task-0.3.34", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/futures-util/futures-util-0.3.34.crate", + "sha256": "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc", + "dest": "cargo/vendor/futures-util-0.3.34" + }, + { + "type": "inline", + "contents": "{\"package\": \"0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc\", \"files\": {}}", + "dest": "cargo/vendor/futures-util-0.3.34", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm/gemm-0.17.1.crate", + "sha256": "6ab24cc62135b40090e31a76a9b2766a501979f3070fa27f689c27ec04377d32", + "dest": "cargo/vendor/gemm-0.17.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"6ab24cc62135b40090e31a76a9b2766a501979f3070fa27f689c27ec04377d32\", \"files\": {}}", + "dest": "cargo/vendor/gemm-0.17.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm/gemm-0.18.2.crate", + "sha256": "ab96b703d31950f1aeddded248bc95543c9efc7ac9c4a21fda8703a83ee35451", + "dest": "cargo/vendor/gemm-0.18.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"ab96b703d31950f1aeddded248bc95543c9efc7ac9c4a21fda8703a83ee35451\", \"files\": {}}", + "dest": "cargo/vendor/gemm-0.18.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm/gemm-0.19.0.crate", + "sha256": "aa0673db364b12263d103b68337a68fbecc541d6f6b61ba72fe438654709eacb", + "dest": "cargo/vendor/gemm-0.19.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"aa0673db364b12263d103b68337a68fbecc541d6f6b61ba72fe438654709eacb\", \"files\": {}}", + "dest": "cargo/vendor/gemm-0.19.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-c32/gemm-c32-0.17.1.crate", + "sha256": "b9c030d0b983d1e34a546b86e08f600c11696fde16199f971cd46c12e67512c0", + "dest": "cargo/vendor/gemm-c32-0.17.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"b9c030d0b983d1e34a546b86e08f600c11696fde16199f971cd46c12e67512c0\", \"files\": {}}", + "dest": "cargo/vendor/gemm-c32-0.17.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-c32/gemm-c32-0.18.2.crate", + "sha256": "f6db9fd9f40421d00eea9dd0770045a5603b8d684654816637732463f4073847", + "dest": "cargo/vendor/gemm-c32-0.18.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"f6db9fd9f40421d00eea9dd0770045a5603b8d684654816637732463f4073847\", \"files\": {}}", + "dest": "cargo/vendor/gemm-c32-0.18.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-c32/gemm-c32-0.19.0.crate", + "sha256": "086936dbdcb99e37aad81d320f98f670e53c1e55a98bee70573e83f95beb128c", + "dest": "cargo/vendor/gemm-c32-0.19.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"086936dbdcb99e37aad81d320f98f670e53c1e55a98bee70573e83f95beb128c\", \"files\": {}}", + "dest": "cargo/vendor/gemm-c32-0.19.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-c64/gemm-c64-0.17.1.crate", + "sha256": "fbb5f2e79fefb9693d18e1066a557b4546cd334b226beadc68b11a8f9431852a", + "dest": "cargo/vendor/gemm-c64-0.17.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"fbb5f2e79fefb9693d18e1066a557b4546cd334b226beadc68b11a8f9431852a\", \"files\": {}}", + "dest": "cargo/vendor/gemm-c64-0.17.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-c64/gemm-c64-0.18.2.crate", + "sha256": "dfcad8a3d35a43758330b635d02edad980c1e143dc2f21e6fd25f9e4eada8edf", + "dest": "cargo/vendor/gemm-c64-0.18.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"dfcad8a3d35a43758330b635d02edad980c1e143dc2f21e6fd25f9e4eada8edf\", \"files\": {}}", + "dest": "cargo/vendor/gemm-c64-0.18.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-c64/gemm-c64-0.19.0.crate", + "sha256": "20c8aeeeec425959bda4d9827664029ba1501a90a0d1e6228e48bef741db3a3f", + "dest": "cargo/vendor/gemm-c64-0.19.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"20c8aeeeec425959bda4d9827664029ba1501a90a0d1e6228e48bef741db3a3f\", \"files\": {}}", + "dest": "cargo/vendor/gemm-c64-0.19.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-common/gemm-common-0.17.1.crate", + "sha256": "a2e7ea062c987abcd8db95db917b4ffb4ecdfd0668471d8dc54734fdff2354e8", + "dest": "cargo/vendor/gemm-common-0.17.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"a2e7ea062c987abcd8db95db917b4ffb4ecdfd0668471d8dc54734fdff2354e8\", \"files\": {}}", + "dest": "cargo/vendor/gemm-common-0.17.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-common/gemm-common-0.18.2.crate", + "sha256": "a352d4a69cbe938b9e2a9cb7a3a63b7e72f9349174a2752a558a8a563510d0f3", + "dest": "cargo/vendor/gemm-common-0.18.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"a352d4a69cbe938b9e2a9cb7a3a63b7e72f9349174a2752a558a8a563510d0f3\", \"files\": {}}", + "dest": "cargo/vendor/gemm-common-0.18.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-common/gemm-common-0.19.0.crate", + "sha256": "88027625910cc9b1085aaaa1c4bc46bb3a36aad323452b33c25b5e4e7c8e2a3e", + "dest": "cargo/vendor/gemm-common-0.19.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"88027625910cc9b1085aaaa1c4bc46bb3a36aad323452b33c25b5e4e7c8e2a3e\", \"files\": {}}", + "dest": "cargo/vendor/gemm-common-0.19.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-f16/gemm-f16-0.17.1.crate", + "sha256": "7ca4c06b9b11952071d317604acb332e924e817bd891bec8dfb494168c7cedd4", + "dest": "cargo/vendor/gemm-f16-0.17.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"7ca4c06b9b11952071d317604acb332e924e817bd891bec8dfb494168c7cedd4\", \"files\": {}}", + "dest": "cargo/vendor/gemm-f16-0.17.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-f16/gemm-f16-0.18.2.crate", + "sha256": "cff95ae3259432f3c3410eaa919033cd03791d81cebd18018393dc147952e109", + "dest": "cargo/vendor/gemm-f16-0.18.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"cff95ae3259432f3c3410eaa919033cd03791d81cebd18018393dc147952e109\", \"files\": {}}", + "dest": "cargo/vendor/gemm-f16-0.18.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-f16/gemm-f16-0.19.0.crate", + "sha256": "e3df7a55202e6cd6739d82ae3399c8e0c7e1402859b30e4cb780e61525d9486e", + "dest": "cargo/vendor/gemm-f16-0.19.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"e3df7a55202e6cd6739d82ae3399c8e0c7e1402859b30e4cb780e61525d9486e\", \"files\": {}}", + "dest": "cargo/vendor/gemm-f16-0.19.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-f32/gemm-f32-0.17.1.crate", + "sha256": "e9a69f51aaefbd9cf12d18faf273d3e982d9d711f60775645ed5c8047b4ae113", + "dest": "cargo/vendor/gemm-f32-0.17.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"e9a69f51aaefbd9cf12d18faf273d3e982d9d711f60775645ed5c8047b4ae113\", \"files\": {}}", + "dest": "cargo/vendor/gemm-f32-0.17.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-f32/gemm-f32-0.18.2.crate", + "sha256": "bc8d3d4385393304f407392f754cd2dc4b315d05063f62cf09f47b58de276864", + "dest": "cargo/vendor/gemm-f32-0.18.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"bc8d3d4385393304f407392f754cd2dc4b315d05063f62cf09f47b58de276864\", \"files\": {}}", + "dest": "cargo/vendor/gemm-f32-0.18.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-f32/gemm-f32-0.19.0.crate", + "sha256": "02e0b8c9da1fbec6e3e3ab2ce6bc259ef18eb5f6f0d3e4edf54b75f9fd41a81c", + "dest": "cargo/vendor/gemm-f32-0.19.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"02e0b8c9da1fbec6e3e3ab2ce6bc259ef18eb5f6f0d3e4edf54b75f9fd41a81c\", \"files\": {}}", + "dest": "cargo/vendor/gemm-f32-0.19.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-f64/gemm-f64-0.17.1.crate", + "sha256": "aa397a48544fadf0b81ec8741e5c0fba0043008113f71f2034def1935645d2b0", + "dest": "cargo/vendor/gemm-f64-0.17.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"aa397a48544fadf0b81ec8741e5c0fba0043008113f71f2034def1935645d2b0\", \"files\": {}}", + "dest": "cargo/vendor/gemm-f64-0.17.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-f64/gemm-f64-0.18.2.crate", + "sha256": "35b2a4f76ce4b8b16eadc11ccf2e083252d8237c1b589558a49b0183545015bd", + "dest": "cargo/vendor/gemm-f64-0.18.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"35b2a4f76ce4b8b16eadc11ccf2e083252d8237c1b589558a49b0183545015bd\", \"files\": {}}", + "dest": "cargo/vendor/gemm-f64-0.18.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gemm-f64/gemm-f64-0.19.0.crate", + "sha256": "056131e8f2a521bfab322f804ccd652520c79700d81209e9d9275bbdecaadc6a", + "dest": "cargo/vendor/gemm-f64-0.19.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"056131e8f2a521bfab322f804ccd652520c79700d81209e9d9275bbdecaadc6a\", \"files\": {}}", + "dest": "cargo/vendor/gemm-f64-0.19.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/generic-array/generic-array-0.14.7.crate", + "sha256": "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a", + "dest": "cargo/vendor/generic-array-0.14.7" + }, + { + "type": "inline", + "contents": "{\"package\": \"85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a\", \"files\": {}}", + "dest": "cargo/vendor/generic-array-0.14.7", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gethostname/gethostname-1.1.0.crate", + "sha256": "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8", + "dest": "cargo/vendor/gethostname-1.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8\", \"files\": {}}", + "dest": "cargo/vendor/gethostname-1.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/getopts/getopts-0.2.24.crate", + "sha256": "cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df", + "dest": "cargo/vendor/getopts-0.2.24" + }, + { + "type": "inline", + "contents": "{\"package\": \"cfe4fbac503b8d1f88e6676011885f34b7174f46e59956bba534ba83abded4df\", \"files\": {}}", + "dest": "cargo/vendor/getopts-0.2.24", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/getrandom/getrandom-0.2.17.crate", + "sha256": "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0", + "dest": "cargo/vendor/getrandom-0.2.17" + }, + { + "type": "inline", + "contents": "{\"package\": \"ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0\", \"files\": {}}", + "dest": "cargo/vendor/getrandom-0.2.17", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/getrandom/getrandom-0.3.4.crate", + "sha256": "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd", + "dest": "cargo/vendor/getrandom-0.3.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd\", \"files\": {}}", + "dest": "cargo/vendor/getrandom-0.3.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/getrandom/getrandom-0.4.3.crate", + "sha256": "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099", + "dest": "cargo/vendor/getrandom-0.4.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099\", \"files\": {}}", + "dest": "cargo/vendor/getrandom-0.4.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ghash/ghash-0.5.1.crate", + "sha256": "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1", + "dest": "cargo/vendor/ghash-0.5.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1\", \"files\": {}}", + "dest": "cargo/vendor/ghash-0.5.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gif/gif-0.14.2.crate", + "sha256": "ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159", + "dest": "cargo/vendor/gif-0.14.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"ee8cfcc411d9adbbaba82fb72661cc1bcca13e8bba98b364e62b2dba8f960159\", \"files\": {}}", + "dest": "cargo/vendor/gif-0.14.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gimli/gimli-0.32.3.crate", + "sha256": "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7", + "dest": "cargo/vendor/gimli-0.32.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7\", \"files\": {}}", + "dest": "cargo/vendor/gimli-0.32.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gl_generator/gl_generator-0.14.0.crate", + "sha256": "1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d", + "dest": "cargo/vendor/gl_generator-0.14.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"1a95dfc23a2b4a9a2f5ab41d194f8bfda3cabec42af4e39f08c339eb2a0c124d\", \"files\": {}}", + "dest": "cargo/vendor/gl_generator-0.14.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/glifo/glifo-0.3.0.crate", + "sha256": "282a26c1e23de04bdab3e34a21b6f877a479b96737792516b9b8b8f69b6661be", + "dest": "cargo/vendor/glifo-0.3.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"282a26c1e23de04bdab3e34a21b6f877a479b96737792516b9b8b8f69b6661be\", \"files\": {}}", + "dest": "cargo/vendor/glifo-0.3.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/glow/glow-0.17.0.crate", + "sha256": "29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5", + "dest": "cargo/vendor/glow-0.17.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"29038e1c483364cc6bb3cf78feee1816002e127c331a1eec55a4d202b9e1adb5\", \"files\": {}}", + "dest": "cargo/vendor/glow-0.17.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/glutin/glutin-0.32.3.crate", + "sha256": "12124de845cacfebedff80e877bb37b5b75c34c5a4c89e47e1cdd67fb6041325", + "dest": "cargo/vendor/glutin-0.32.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"12124de845cacfebedff80e877bb37b5b75c34c5a4c89e47e1cdd67fb6041325\", \"files\": {}}", + "dest": "cargo/vendor/glutin-0.32.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/glutin-winit/glutin-winit-0.5.0.crate", + "sha256": "85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f", + "dest": "cargo/vendor/glutin-winit-0.5.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"85edca7075f8fc728f28cb8fbb111a96c3b89e930574369e3e9c27eb75d3788f\", \"files\": {}}", + "dest": "cargo/vendor/glutin-winit-0.5.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/glutin_egl_sys/glutin_egl_sys-0.7.1.crate", + "sha256": "4c4680ba6195f424febdc3ba46e7a42a0e58743f2edb115297b86d7f8ecc02d2", + "dest": "cargo/vendor/glutin_egl_sys-0.7.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"4c4680ba6195f424febdc3ba46e7a42a0e58743f2edb115297b86d7f8ecc02d2\", \"files\": {}}", + "dest": "cargo/vendor/glutin_egl_sys-0.7.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/glutin_glx_sys/glutin_glx_sys-0.6.1.crate", + "sha256": "8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185", + "dest": "cargo/vendor/glutin_glx_sys-0.6.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"8a7bb2938045a88b612499fbcba375a77198e01306f52272e692f8c1f3751185\", \"files\": {}}", + "dest": "cargo/vendor/glutin_glx_sys-0.6.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/glutin_wgl_sys/glutin_wgl_sys-0.6.1.crate", + "sha256": "2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e", + "dest": "cargo/vendor/glutin_wgl_sys-0.6.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"2c4ee00b289aba7a9e5306d57c2d05499b2e5dc427f84ac708bd2c090212cf3e\", \"files\": {}}", + "dest": "cargo/vendor/glutin_wgl_sys-0.6.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/gpu-allocator/gpu-allocator-0.28.0.crate", + "sha256": "51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795", + "dest": "cargo/vendor/gpu-allocator-0.28.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"51255ea7cfaadb6c5f1528d43e92a82acb2b96c43365989a28b2d44ee38f8795\", \"files\": {}}", + "dest": "cargo/vendor/gpu-allocator-0.28.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/group/group-0.13.0.crate", + "sha256": "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63", + "dest": "cargo/vendor/group-0.13.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63\", \"files\": {}}", + "dest": "cargo/vendor/group-0.13.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/guillotiere/guillotiere-0.7.0.crate", + "sha256": "6b17e70c989c36bad147b27a58d148c0741c51448aa5653436547323e524d0ab", + "dest": "cargo/vendor/guillotiere-0.7.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"6b17e70c989c36bad147b27a58d148c0741c51448aa5653436547323e524d0ab\", \"files\": {}}", + "dest": "cargo/vendor/guillotiere-0.7.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/half/half-2.7.1.crate", + "sha256": "6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b", + "dest": "cargo/vendor/half-2.7.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"6ea2d84b969582b4b1864a92dc5d27cd2b77b622a8d79306834f1be5ba20d84b\", \"files\": {}}", + "dest": "cargo/vendor/half-2.7.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/harfrust/harfrust-0.12.0.crate", + "sha256": "c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9", + "dest": "cargo/vendor/harfrust-0.12.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"c03d949a14aa089bbb282f7dd76a498a7f684428e4257202efc119ec010376f9\", \"files\": {}}", + "dest": "cargo/vendor/harfrust-0.12.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/hashbrown/hashbrown-0.15.5.crate", + "sha256": "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1", + "dest": "cargo/vendor/hashbrown-0.15.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1\", \"files\": {}}", + "dest": "cargo/vendor/hashbrown-0.15.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/hashbrown/hashbrown-0.16.1.crate", + "sha256": "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100", + "dest": "cargo/vendor/hashbrown-0.16.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100\", \"files\": {}}", + "dest": "cargo/vendor/hashbrown-0.16.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/hashbrown/hashbrown-0.17.1.crate", + "sha256": "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a", + "dest": "cargo/vendor/hashbrown-0.17.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a\", \"files\": {}}", + "dest": "cargo/vendor/hashbrown-0.17.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/heck/heck-0.5.0.crate", + "sha256": "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea", + "dest": "cargo/vendor/heck-0.5.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea\", \"files\": {}}", + "dest": "cargo/vendor/heck-0.5.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/heic-rs/heic-rs-0.1.4.crate", + "sha256": "8883c3bfa6b4ff19a40e52a6dc051c5612cbe21bf408fc6d4875e8dfd777cb66", + "dest": "cargo/vendor/heic-rs-0.1.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"8883c3bfa6b4ff19a40e52a6dc051c5612cbe21bf408fc6d4875e8dfd777cb66\", \"files\": {}}", + "dest": "cargo/vendor/heic-rs-0.1.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/hermit-abi/hermit-abi-0.5.3.crate", + "sha256": "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284", + "dest": "cargo/vendor/hermit-abi-0.5.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284\", \"files\": {}}", + "dest": "cargo/vendor/hermit-abi-0.5.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/hex/hex-0.4.3.crate", + "sha256": "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70", + "dest": "cargo/vendor/hex-0.4.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70\", \"files\": {}}", + "dest": "cargo/vendor/hex-0.4.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/hkdf/hkdf-0.12.4.crate", + "sha256": "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7", + "dest": "cargo/vendor/hkdf-0.12.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7\", \"files\": {}}", + "dest": "cargo/vendor/hkdf-0.12.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/hmac/hmac-0.12.1.crate", + "sha256": "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e", + "dest": "cargo/vendor/hmac-0.12.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e\", \"files\": {}}", + "dest": "cargo/vendor/hmac-0.12.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/image/image-0.25.10.crate", + "sha256": "85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104", + "dest": "cargo/vendor/image-0.25.10" + }, + { + "type": "inline", + "contents": "{\"package\": \"85ab80394333c02fe689eaf900ab500fbd0c2213da414687ebf995a65d5a6104\", \"files\": {}}", + "dest": "cargo/vendor/image-0.25.10", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/image-webp/image-webp-0.2.4.crate", + "sha256": "525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3", + "dest": "cargo/vendor/image-webp-0.2.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"525e9ff3e1a4be2fbea1fdf0e98686a6d98b4d8f937e1bf7402245af1909e8c3\", \"files\": {}}", + "dest": "cargo/vendor/image-webp-0.2.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/imgref/imgref-1.12.3.crate", + "sha256": "6e44b0a4eaa4c82f441d50a963f2d5f05a787240aeee097597033e72accfd22f", + "dest": "cargo/vendor/imgref-1.12.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"6e44b0a4eaa4c82f441d50a963f2d5f05a787240aeee097597033e72accfd22f\", \"files\": {}}", + "dest": "cargo/vendor/imgref-1.12.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/indexmap/indexmap-2.14.2.crate", + "sha256": "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855", + "dest": "cargo/vendor/indexmap-2.14.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855\", \"files\": {}}", + "dest": "cargo/vendor/indexmap-2.14.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/inout/inout-0.1.4.crate", + "sha256": "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01", + "dest": "cargo/vendor/inout-0.1.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01\", \"files\": {}}", + "dest": "cargo/vendor/inout-0.1.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/interpolate_name/interpolate_name-0.2.4.crate", + "sha256": "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60", + "dest": "cargo/vendor/interpolate_name-0.2.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60\", \"files\": {}}", + "dest": "cargo/vendor/interpolate_name-0.2.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/is-docker/is-docker-0.2.0.crate", + "sha256": "928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3", + "dest": "cargo/vendor/is-docker-0.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"928bae27f42bc99b60d9ac7334e3a21d10ad8f1835a4e12ec3ec0464765ed1b3\", \"files\": {}}", + "dest": "cargo/vendor/is-docker-0.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/is-wsl/is-wsl-0.4.0.crate", + "sha256": "173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5", + "dest": "cargo/vendor/is-wsl-0.4.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"173609498df190136aa7dea1a91db051746d339e18476eed5ca40521f02d7aa5\", \"files\": {}}", + "dest": "cargo/vendor/is-wsl-0.4.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/itertools/itertools-0.14.0.crate", + "sha256": "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285", + "dest": "cargo/vendor/itertools-0.14.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285\", \"files\": {}}", + "dest": "cargo/vendor/itertools-0.14.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/itertools/itertools-0.15.0.crate", + "sha256": "8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc", + "dest": "cargo/vendor/itertools-0.15.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"8b4baf93f58d4425749ca49a51c50ebab072c5df6994d08fed93541c331481dc\", \"files\": {}}", + "dest": "cargo/vendor/itertools-0.15.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/itoa/itoa-1.0.18.crate", + "sha256": "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682", + "dest": "cargo/vendor/itoa-1.0.18" + }, + { + "type": "inline", + "contents": "{\"package\": \"8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682\", \"files\": {}}", + "dest": "cargo/vendor/itoa-1.0.18", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jixel/jixel-0.3.4.crate", + "sha256": "278a75e12caacec34be774d62ad05e45fc0b6a52d1f4e9f7fbc0209ecdf794f3", + "dest": "cargo/vendor/jixel-0.3.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"278a75e12caacec34be774d62ad05e45fc0b6a52d1f4e9f7fbc0209ecdf794f3\", \"files\": {}}", + "dest": "cargo/vendor/jixel-0.3.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jni/jni-0.22.4.crate", + "sha256": "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498", + "dest": "cargo/vendor/jni-0.22.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498\", \"files\": {}}", + "dest": "cargo/vendor/jni-0.22.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jni-macros/jni-macros-0.22.4.crate", + "sha256": "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3", + "dest": "cargo/vendor/jni-macros-0.22.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3\", \"files\": {}}", + "dest": "cargo/vendor/jni-macros-0.22.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jni-sys/jni-sys-0.3.1.crate", + "sha256": "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258", + "dest": "cargo/vendor/jni-sys-0.3.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258\", \"files\": {}}", + "dest": "cargo/vendor/jni-sys-0.3.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jni-sys/jni-sys-0.4.1.crate", + "sha256": "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2", + "dest": "cargo/vendor/jni-sys-0.4.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2\", \"files\": {}}", + "dest": "cargo/vendor/jni-sys-0.4.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jni-sys-macros/jni-sys-macros-0.4.1.crate", + "sha256": "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264", + "dest": "cargo/vendor/jni-sys-macros-0.4.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264\", \"files\": {}}", + "dest": "cargo/vendor/jni-sys-macros-0.4.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jobserver/jobserver-0.1.35.crate", + "sha256": "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3", + "dest": "cargo/vendor/jobserver-0.1.35" + }, + { + "type": "inline", + "contents": "{\"package\": \"1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3\", \"files\": {}}", + "dest": "cargo/vendor/jobserver-0.1.35", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jpeg-decoder/jpeg-decoder-0.3.2.crate", + "sha256": "00810f1d8b74be64b13dbf3db89ac67740615d6c891f0e7b6179326533011a07", + "dest": "cargo/vendor/jpeg-decoder-0.3.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"00810f1d8b74be64b13dbf3db89ac67740615d6c891f0e7b6179326533011a07\", \"files\": {}}", + "dest": "cargo/vendor/jpeg-decoder-0.3.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jpeg-encoder/jpeg-encoder-0.7.1.crate", + "sha256": "a0370574b86f7eca156b9f298392b5e69a23f8c86f3f865add60bbc2e79467a6", + "dest": "cargo/vendor/jpeg-encoder-0.7.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"a0370574b86f7eca156b9f298392b5e69a23f8c86f3f865add60bbc2e79467a6\", \"files\": {}}", + "dest": "cargo/vendor/jpeg-encoder-0.7.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/js-sys/js-sys-0.3.106.crate", + "sha256": "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5", + "dest": "cargo/vendor/js-sys-0.3.106" + }, + { + "type": "inline", + "contents": "{\"package\": \"7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5\", \"files\": {}}", + "dest": "cargo/vendor/js-sys-0.3.106", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jxl-bitstream/jxl-bitstream-1.1.0.crate", + "sha256": "b480e752277e29eb4054f69546887a9b84656fe78c08f54ba5850ced98a378fe", + "dest": "cargo/vendor/jxl-bitstream-1.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"b480e752277e29eb4054f69546887a9b84656fe78c08f54ba5850ced98a378fe\", \"files\": {}}", + "dest": "cargo/vendor/jxl-bitstream-1.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jxl-coding/jxl-coding-1.0.1.crate", + "sha256": "cd972bcd125e776f1eb241ac50e39f956095a1c2770c64736c968f8946bd9a3c", + "dest": "cargo/vendor/jxl-coding-1.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"cd972bcd125e776f1eb241ac50e39f956095a1c2770c64736c968f8946bd9a3c\", \"files\": {}}", + "dest": "cargo/vendor/jxl-coding-1.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jxl-color/jxl-color-0.11.0.crate", + "sha256": "f316b1358c1711755b3ee8e8cb5c4a1dad12e796233088a7a513440782de80b2", + "dest": "cargo/vendor/jxl-color-0.11.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"f316b1358c1711755b3ee8e8cb5c4a1dad12e796233088a7a513440782de80b2\", \"files\": {}}", + "dest": "cargo/vendor/jxl-color-0.11.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jxl-frame/jxl-frame-0.13.3.crate", + "sha256": "2d967c6fd669c7c01060b5022d8835fa82fd46b06ffc98b549f17600a097c2b3", + "dest": "cargo/vendor/jxl-frame-0.13.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"2d967c6fd669c7c01060b5022d8835fa82fd46b06ffc98b549f17600a097c2b3\", \"files\": {}}", + "dest": "cargo/vendor/jxl-frame-0.13.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jxl-grid/jxl-grid-0.6.2.crate", + "sha256": "01671307879a033bfa52e6e8784b941aca770b3f3a7d33830b455b6844f793fb", + "dest": "cargo/vendor/jxl-grid-0.6.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"01671307879a033bfa52e6e8784b941aca770b3f3a7d33830b455b6844f793fb\", \"files\": {}}", + "dest": "cargo/vendor/jxl-grid-0.6.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jxl-image/jxl-image-0.13.0.crate", + "sha256": "c5f752d62577c702a94dbbce4045caf08cb58639e8a4d56464b40ecf33ffe565", + "dest": "cargo/vendor/jxl-image-0.13.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"c5f752d62577c702a94dbbce4045caf08cb58639e8a4d56464b40ecf33ffe565\", \"files\": {}}", + "dest": "cargo/vendor/jxl-image-0.13.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jxl-jbr/jxl-jbr-0.2.1.crate", + "sha256": "e35d032bcec660647828527ff42c6f5776d2fd44b8357f9f6d9ac6dc07218e46", + "dest": "cargo/vendor/jxl-jbr-0.2.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"e35d032bcec660647828527ff42c6f5776d2fd44b8357f9f6d9ac6dc07218e46\", \"files\": {}}", + "dest": "cargo/vendor/jxl-jbr-0.2.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jxl-modular/jxl-modular-0.11.3.crate", + "sha256": "2a2f045b24c738dd91d482be385512b512721ae08a671bd4b27bf1c47f215235", + "dest": "cargo/vendor/jxl-modular-0.11.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"2a2f045b24c738dd91d482be385512b512721ae08a671bd4b27bf1c47f215235\", \"files\": {}}", + "dest": "cargo/vendor/jxl-modular-0.11.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jxl-oxide/jxl-oxide-0.12.6.crate", + "sha256": "d36c662923f47586880211f3bc7c0d83fb3a9b410d278c7bde93450748abeef3", + "dest": "cargo/vendor/jxl-oxide-0.12.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"d36c662923f47586880211f3bc7c0d83fb3a9b410d278c7bde93450748abeef3\", \"files\": {}}", + "dest": "cargo/vendor/jxl-oxide-0.12.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jxl-oxide-common/jxl-oxide-common-1.0.0.crate", + "sha256": "b62394c5021b3a9e7e0dbb2d639d555d019090c9946c39f6d3b09d390db4157b", + "dest": "cargo/vendor/jxl-oxide-common-1.0.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"b62394c5021b3a9e7e0dbb2d639d555d019090c9946c39f6d3b09d390db4157b\", \"files\": {}}", + "dest": "cargo/vendor/jxl-oxide-common-1.0.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jxl-render/jxl-render-0.12.4.crate", + "sha256": "d34386bfdb6a19b5a30cc9beb4d475d537422c31ae8c39bb69640fcce3fcaf19", + "dest": "cargo/vendor/jxl-render-0.12.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"d34386bfdb6a19b5a30cc9beb4d475d537422c31ae8c39bb69640fcce3fcaf19\", \"files\": {}}", + "dest": "cargo/vendor/jxl-render-0.12.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jxl-threadpool/jxl-threadpool-1.0.0.crate", + "sha256": "25f15eb830aa77a7f21148d72e153562a26bfe570139bd4922eab1908dd499d3", + "dest": "cargo/vendor/jxl-threadpool-1.0.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"25f15eb830aa77a7f21148d72e153562a26bfe570139bd4922eab1908dd499d3\", \"files\": {}}", + "dest": "cargo/vendor/jxl-threadpool-1.0.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/jxl-vardct/jxl-vardct-0.11.1.crate", + "sha256": "ce72a18c6d3a47172ab6c479be2bdb56f22066b5d7092663f03b4490820b4511", + "dest": "cargo/vendor/jxl-vardct-0.11.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"ce72a18c6d3a47172ab6c479be2bdb56f22066b5d7092663f03b4490820b4511\", \"files\": {}}", + "dest": "cargo/vendor/jxl-vardct-0.11.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/keyboard-types/keyboard-types-0.8.3.crate", + "sha256": "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d", + "dest": "cargo/vendor/keyboard-types-0.8.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d\", \"files\": {}}", + "dest": "cargo/vendor/keyboard-types-0.8.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/khronos-egl/khronos-egl-6.0.0.crate", + "sha256": "6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76", + "dest": "cargo/vendor/khronos-egl-6.0.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"6aae1df220ece3c0ada96b8153459b67eebe9ae9212258bb0134ae60416fdf76\", \"files\": {}}", + "dest": "cargo/vendor/khronos-egl-6.0.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/khronos_api/khronos_api-3.1.0.crate", + "sha256": "e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc", + "dest": "cargo/vendor/khronos_api-3.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"e2db585e1d738fc771bf08a151420d3ed193d9d895a36df7f6f8a9456b911ddc\", \"files\": {}}", + "dest": "cargo/vendor/khronos_api-3.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/kittest/kittest-0.5.0.crate", + "sha256": "0bb81a721ba76aa095b7f45deb180504f786904e56ca4b8e141f66eb89a78b75", + "dest": "cargo/vendor/kittest-0.5.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"0bb81a721ba76aa095b7f45deb180504f786904e56ca4b8e141f66eb89a78b75\", \"files\": {}}", + "dest": "cargo/vendor/kittest-0.5.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/kurbo/kurbo-0.13.1.crate", + "sha256": "4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2", + "dest": "cargo/vendor/kurbo-0.13.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"4b60dfc32f652b926df6192e55525b16d186c69d47876c3ead4da5cc9f8450e2\", \"files\": {}}", + "dest": "cargo/vendor/kurbo-0.13.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/lazy_static/lazy_static-1.5.1.crate", + "sha256": "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb", + "dest": "cargo/vendor/lazy_static-1.5.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb\", \"files\": {}}", + "dest": "cargo/vendor/lazy_static-1.5.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/libc/libc-0.2.189.crate", + "sha256": "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2", + "dest": "cargo/vendor/libc-0.2.189" + }, + { + "type": "inline", + "contents": "{\"package\": \"3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2\", \"files\": {}}", + "dest": "cargo/vendor/libc-0.2.189", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/libfuzzer-sys/libfuzzer-sys-0.4.13.crate", + "sha256": "a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2", + "dest": "cargo/vendor/libfuzzer-sys-0.4.13" + }, + { + "type": "inline", + "contents": "{\"package\": \"a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2\", \"files\": {}}", + "dest": "cargo/vendor/libfuzzer-sys-0.4.13", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/libloading/libloading-0.8.9.crate", + "sha256": "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55", + "dest": "cargo/vendor/libloading-0.8.9" + }, + { + "type": "inline", + "contents": "{\"package\": \"d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55\", \"files\": {}}", + "dest": "cargo/vendor/libloading-0.8.9", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/libm/libm-0.2.16.crate", + "sha256": "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981", + "dest": "cargo/vendor/libm-0.2.16" + }, + { + "type": "inline", + "contents": "{\"package\": \"b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981\", \"files\": {}}", + "dest": "cargo/vendor/libm-0.2.16", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/libredox/libredox-0.1.25.crate", + "sha256": "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d", + "dest": "cargo/vendor/libredox-0.1.25" + }, + { + "type": "inline", + "contents": "{\"package\": \"61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d\", \"files\": {}}", + "dest": "cargo/vendor/libredox-0.1.25", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/linebender_resource_handle/linebender_resource_handle-0.1.1.crate", + "sha256": "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4", + "dest": "cargo/vendor/linebender_resource_handle-0.1.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4\", \"files\": {}}", + "dest": "cargo/vendor/linebender_resource_handle-0.1.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/linux-raw-sys/linux-raw-sys-0.4.15.crate", + "sha256": "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab", + "dest": "cargo/vendor/linux-raw-sys-0.4.15" + }, + { + "type": "inline", + "contents": "{\"package\": \"d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab\", \"files\": {}}", + "dest": "cargo/vendor/linux-raw-sys-0.4.15", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/linux-raw-sys/linux-raw-sys-0.12.1.crate", + "sha256": "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53", + "dest": "cargo/vendor/linux-raw-sys-0.12.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53\", \"files\": {}}", + "dest": "cargo/vendor/linux-raw-sys-0.12.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/litrs/litrs-1.0.0.crate", + "sha256": "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092", + "dest": "cargo/vendor/litrs-1.0.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092\", \"files\": {}}", + "dest": "cargo/vendor/litrs-1.0.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/lock_api/lock_api-0.4.14.crate", + "sha256": "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965", + "dest": "cargo/vendor/lock_api-0.4.14" + }, + { + "type": "inline", + "contents": "{\"package\": \"224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965\", \"files\": {}}", + "dest": "cargo/vendor/lock_api-0.4.14", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/log/log-0.4.34.crate", + "sha256": "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6", + "dest": "cargo/vendor/log-0.4.34" + }, + { + "type": "inline", + "contents": "{\"package\": \"f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6\", \"files\": {}}", + "dest": "cargo/vendor/log-0.4.34", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/loop9/loop9-0.1.5.crate", + "sha256": "0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062", + "dest": "cargo/vendor/loop9-0.1.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"0fae87c125b03c1d2c0150c90365d7d6bcc53fb73a9acaef207d2d065860f062\", \"files\": {}}", + "dest": "cargo/vendor/loop9-0.1.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/malloc_buf/malloc_buf-0.0.6.crate", + "sha256": "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb", + "dest": "cargo/vendor/malloc_buf-0.0.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb\", \"files\": {}}", + "dest": "cargo/vendor/malloc_buf-0.0.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/matrixcompare-core/matrixcompare-core-0.1.0.crate", + "sha256": "b0bdabb30db18805d5290b3da7ceaccbddba795620b86c02145d688e04900a73", + "dest": "cargo/vendor/matrixcompare-core-0.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"b0bdabb30db18805d5290b3da7ceaccbddba795620b86c02145d688e04900a73\", \"files\": {}}", + "dest": "cargo/vendor/matrixcompare-core-0.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/matrixmultiply/matrixmultiply-0.3.11.crate", + "sha256": "3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7", + "dest": "cargo/vendor/matrixmultiply-0.3.11" + }, + { + "type": "inline", + "contents": "{\"package\": \"3f607c237553f086e7043417a51df26b2eb899d3caff94e6a67592ff992fedc7\", \"files\": {}}", + "dest": "cargo/vendor/matrixmultiply-0.3.11", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/maybe-rayon/maybe-rayon-0.1.1.crate", + "sha256": "8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519", + "dest": "cargo/vendor/maybe-rayon-0.1.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"8ea1f30cedd69f0a2954655f7188c6a834246d2bcf1e315e2ac40c4b24dc9519\", \"files\": {}}", + "dest": "cargo/vendor/maybe-rayon-0.1.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/memchr/memchr-2.8.3.crate", + "sha256": "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98", + "dest": "cargo/vendor/memchr-2.8.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98\", \"files\": {}}", + "dest": "cargo/vendor/memchr-2.8.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/memmap2/memmap2-0.9.11.crate", + "sha256": "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0", + "dest": "cargo/vendor/memmap2-0.9.11" + }, + { + "type": "inline", + "contents": "{\"package\": \"d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0\", \"files\": {}}", + "dest": "cargo/vendor/memmap2-0.9.11", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/memoffset/memoffset-0.9.1.crate", + "sha256": "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a", + "dest": "cargo/vendor/memoffset-0.9.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a\", \"files\": {}}", + "dest": "cargo/vendor/memoffset-0.9.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/metal/metal-0.29.0.crate", + "sha256": "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21", + "dest": "cargo/vendor/metal-0.29.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21\", \"files\": {}}", + "dest": "cargo/vendor/metal-0.29.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/miniz_oxide/miniz_oxide-0.8.9.crate", + "sha256": "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316", + "dest": "cargo/vendor/miniz_oxide-0.8.9" + }, + { + "type": "inline", + "contents": "{\"package\": \"1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316\", \"files\": {}}", + "dest": "cargo/vendor/miniz_oxide-0.8.9", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/miniz_oxide/miniz_oxide-0.9.1.crate", + "sha256": "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c", + "dest": "cargo/vendor/miniz_oxide-0.9.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c\", \"files\": {}}", + "dest": "cargo/vendor/miniz_oxide-0.9.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/mintex/mintex-0.1.4.crate", + "sha256": "c505b3e17ed6b70a7ed2e67fbb2c560ee327353556120d6e72f5232b6880d536", + "dest": "cargo/vendor/mintex-0.1.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"c505b3e17ed6b70a7ed2e67fbb2c560ee327353556120d6e72f5232b6880d536\", \"files\": {}}", + "dest": "cargo/vendor/mintex-0.1.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/moxcms/moxcms-0.8.1.crate", + "sha256": "bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b", + "dest": "cargo/vendor/moxcms-0.8.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"bb85c154ba489f01b25c0d36ae69a87e4a1c73a72631fc6c0eb6dde34a73e44b\", \"files\": {}}", + "dest": "cargo/vendor/moxcms-0.8.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/moxcms/moxcms-0.9.1.crate", + "sha256": "396077b717181ce3f9a6b66739b269b82d756be5ec0f76be0bc40a7c51775830", + "dest": "cargo/vendor/moxcms-0.9.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"396077b717181ce3f9a6b66739b269b82d756be5ec0f76be0bc40a7c51775830\", \"files\": {}}", + "dest": "cargo/vendor/moxcms-0.9.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/muda/muda-0.21.0.crate", + "sha256": "c6744ab645ebe79f9c428455c7cb9dfa4275fa3b50a25408e08f927da8dc618c", + "dest": "cargo/vendor/muda-0.21.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"c6744ab645ebe79f9c428455c7cb9dfa4275fa3b50a25408e08f927da8dc618c\", \"files\": {}}", + "dest": "cargo/vendor/muda-0.21.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/naga/naga-30.0.1.crate", + "sha256": "a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130", + "dest": "cargo/vendor/naga-30.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"a616d2fb8c89516ac2723a581f69d6c18576046bed761bd6b305e5618e6ae130\", \"files\": {}}", + "dest": "cargo/vendor/naga-30.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/naga-types/naga-types-30.0.1.crate", + "sha256": "590afbf58a6f4f62873cd5cff4468061844bafa1cdf399cc954537c22d768d49", + "dest": "cargo/vendor/naga-types-30.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"590afbf58a6f4f62873cd5cff4468061844bafa1cdf399cc954537c22d768d49\", \"files\": {}}", + "dest": "cargo/vendor/naga-types-30.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ndarray/ndarray-0.17.2.crate", + "sha256": "520080814a7a6b4a6e9070823bb24b4531daac8c4627e08ba5de8c5ef2f2752d", + "dest": "cargo/vendor/ndarray-0.17.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"520080814a7a6b4a6e9070823bb24b4531daac8c4627e08ba5de8c5ef2f2752d\", \"files\": {}}", + "dest": "cargo/vendor/ndarray-0.17.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ndk/ndk-0.9.0.crate", + "sha256": "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4", + "dest": "cargo/vendor/ndk-0.9.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4\", \"files\": {}}", + "dest": "cargo/vendor/ndk-0.9.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ndk-context/ndk-context-0.1.1.crate", + "sha256": "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b", + "dest": "cargo/vendor/ndk-context-0.1.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b\", \"files\": {}}", + "dest": "cargo/vendor/ndk-context-0.1.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ndk-sys/ndk-sys-0.6.0+11769913.crate", + "sha256": "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873", + "dest": "cargo/vendor/ndk-sys-0.6.0+11769913" + }, + { + "type": "inline", + "contents": "{\"package\": \"ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873\", \"files\": {}}", + "dest": "cargo/vendor/ndk-sys-0.6.0+11769913", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/new_debug_unreachable/new_debug_unreachable-1.0.6.crate", + "sha256": "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086", + "dest": "cargo/vendor/new_debug_unreachable-1.0.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086\", \"files\": {}}", + "dest": "cargo/vendor/new_debug_unreachable-1.0.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/no_std_io2/no_std_io2-0.9.4.crate", + "sha256": "418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003", + "dest": "cargo/vendor/no_std_io2-0.9.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"418abd1b6d34fbf6cae440dc874771b0525a604428704c76e48b29a5e67b8003\", \"files\": {}}", + "dest": "cargo/vendor/no_std_io2-0.9.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/nohash-hasher/nohash-hasher-0.2.0.crate", + "sha256": "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451", + "dest": "cargo/vendor/nohash-hasher-0.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451\", \"files\": {}}", + "dest": "cargo/vendor/nohash-hasher-0.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/nom/nom-8.0.0.crate", + "sha256": "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405", + "dest": "cargo/vendor/nom-8.0.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405\", \"files\": {}}", + "dest": "cargo/vendor/nom-8.0.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/noop_proc_macro/noop_proc_macro-0.3.0.crate", + "sha256": "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8", + "dest": "cargo/vendor/noop_proc_macro-0.3.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8\", \"files\": {}}", + "dest": "cargo/vendor/noop_proc_macro-0.3.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/num/num-0.4.3.crate", + "sha256": "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23", + "dest": "cargo/vendor/num-0.4.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23\", \"files\": {}}", + "dest": "cargo/vendor/num-0.4.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/num-bigint/num-bigint-0.4.8.crate", + "sha256": "c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367", + "dest": "cargo/vendor/num-bigint-0.4.8" + }, + { + "type": "inline", + "contents": "{\"package\": \"c89e69e7e0f03bea5ef08013795c25018e101932225a656383bd384495ecc367\", \"files\": {}}", + "dest": "cargo/vendor/num-bigint-0.4.8", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/num-bigint-dig/num-bigint-dig-0.8.6.crate", + "sha256": "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7", + "dest": "cargo/vendor/num-bigint-dig-0.8.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7\", \"files\": {}}", + "dest": "cargo/vendor/num-bigint-dig-0.8.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/num-complex/num-complex-0.4.6.crate", + "sha256": "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495", + "dest": "cargo/vendor/num-complex-0.4.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495\", \"files\": {}}", + "dest": "cargo/vendor/num-complex-0.4.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/num-derive/num-derive-0.4.2.crate", + "sha256": "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202", + "dest": "cargo/vendor/num-derive-0.4.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202\", \"files\": {}}", + "dest": "cargo/vendor/num-derive-0.4.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/num-integer/num-integer-0.1.47.crate", + "sha256": "7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b", + "dest": "cargo/vendor/num-integer-0.1.47" + }, + { + "type": "inline", + "contents": "{\"package\": \"7ce2d95d4b3734dc35aa2f45e1aa22cd416814592a4f9d9205e11affd5b8e10b\", \"files\": {}}", + "dest": "cargo/vendor/num-integer-0.1.47", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/num-iter/num-iter-0.1.46.crate", + "sha256": "c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b", + "dest": "cargo/vendor/num-iter-0.1.46" + }, + { + "type": "inline", + "contents": "{\"package\": \"c92800bd69a1eac91786bcfe9da64a897eb72911b8dc3095decbd07429e8048b\", \"files\": {}}", + "dest": "cargo/vendor/num-iter-0.1.46", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/num-rational/num-rational-0.4.2.crate", + "sha256": "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824", + "dest": "cargo/vendor/num-rational-0.4.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824\", \"files\": {}}", + "dest": "cargo/vendor/num-rational-0.4.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/num-traits/num-traits-0.2.19.crate", + "sha256": "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841", + "dest": "cargo/vendor/num-traits-0.2.19" + }, + { + "type": "inline", + "contents": "{\"package\": \"071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841\", \"files\": {}}", + "dest": "cargo/vendor/num-traits-0.2.19", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/num_cpus/num_cpus-1.17.0.crate", + "sha256": "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b", + "dest": "cargo/vendor/num_cpus-1.17.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b\", \"files\": {}}", + "dest": "cargo/vendor/num_cpus-1.17.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/num_enum/num_enum-0.7.6.crate", + "sha256": "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26", + "dest": "cargo/vendor/num_enum-0.7.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26\", \"files\": {}}", + "dest": "cargo/vendor/num_enum-0.7.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/num_enum_derive/num_enum_derive-0.7.6.crate", + "sha256": "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8", + "dest": "cargo/vendor/num_enum_derive-0.7.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8\", \"files\": {}}", + "dest": "cargo/vendor/num_enum_derive-0.7.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc/objc-0.2.7.crate", + "sha256": "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1", + "dest": "cargo/vendor/objc-0.2.7" + }, + { + "type": "inline", + "contents": "{\"package\": \"915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1\", \"files\": {}}", + "dest": "cargo/vendor/objc-0.2.7", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc-sys/objc-sys-0.3.5.crate", + "sha256": "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310", + "dest": "cargo/vendor/objc-sys-0.3.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310\", \"files\": {}}", + "dest": "cargo/vendor/objc-sys-0.3.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2/objc2-0.5.2.crate", + "sha256": "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804", + "dest": "cargo/vendor/objc2-0.5.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804\", \"files\": {}}", + "dest": "cargo/vendor/objc2-0.5.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2/objc2-0.6.4.crate", + "sha256": "3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f", + "dest": "cargo/vendor/objc2-0.6.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"3a12a8ed07aefc768292f076dc3ac8c48f3781c8f2d5851dd3d98950e8c5a89f\", \"files\": {}}", + "dest": "cargo/vendor/objc2-0.6.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-app-kit/objc2-app-kit-0.2.2.crate", + "sha256": "e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff", + "dest": "cargo/vendor/objc2-app-kit-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"e4e89ad9e3d7d297152b17d39ed92cd50ca8063a89a9fa569046d41568891eff\", \"files\": {}}", + "dest": "cargo/vendor/objc2-app-kit-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-app-kit/objc2-app-kit-0.3.2.crate", + "sha256": "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c", + "dest": "cargo/vendor/objc2-app-kit-0.3.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c\", \"files\": {}}", + "dest": "cargo/vendor/objc2-app-kit-0.3.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-cloud-kit/objc2-cloud-kit-0.2.2.crate", + "sha256": "74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009", + "dest": "cargo/vendor/objc2-cloud-kit-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"74dd3b56391c7a0596a295029734d3c1c5e7e510a4cb30245f8221ccea96b009\", \"files\": {}}", + "dest": "cargo/vendor/objc2-cloud-kit-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-contacts/objc2-contacts-0.2.2.crate", + "sha256": "a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889", + "dest": "cargo/vendor/objc2-contacts-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"a5ff520e9c33812fd374d8deecef01d4a840e7b41862d849513de77e44aa4889\", \"files\": {}}", + "dest": "cargo/vendor/objc2-contacts-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-core-data/objc2-core-data-0.2.2.crate", + "sha256": "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef", + "dest": "cargo/vendor/objc2-core-data-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef\", \"files\": {}}", + "dest": "cargo/vendor/objc2-core-data-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-core-foundation/objc2-core-foundation-0.3.2.crate", + "sha256": "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536", + "dest": "cargo/vendor/objc2-core-foundation-0.3.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536\", \"files\": {}}", + "dest": "cargo/vendor/objc2-core-foundation-0.3.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-core-graphics/objc2-core-graphics-0.3.2.crate", + "sha256": "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807", + "dest": "cargo/vendor/objc2-core-graphics-0.3.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807\", \"files\": {}}", + "dest": "cargo/vendor/objc2-core-graphics-0.3.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-core-image/objc2-core-image-0.2.2.crate", + "sha256": "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80", + "dest": "cargo/vendor/objc2-core-image-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80\", \"files\": {}}", + "dest": "cargo/vendor/objc2-core-image-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-core-location/objc2-core-location-0.2.2.crate", + "sha256": "000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781", + "dest": "cargo/vendor/objc2-core-location-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"000cfee34e683244f284252ee206a27953279d370e309649dc3ee317b37e5781\", \"files\": {}}", + "dest": "cargo/vendor/objc2-core-location-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-encode/objc2-encode-4.1.0.crate", + "sha256": "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33", + "dest": "cargo/vendor/objc2-encode-4.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33\", \"files\": {}}", + "dest": "cargo/vendor/objc2-encode-4.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-foundation/objc2-foundation-0.2.2.crate", + "sha256": "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8", + "dest": "cargo/vendor/objc2-foundation-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8\", \"files\": {}}", + "dest": "cargo/vendor/objc2-foundation-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-foundation/objc2-foundation-0.3.2.crate", + "sha256": "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272", + "dest": "cargo/vendor/objc2-foundation-0.3.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272\", \"files\": {}}", + "dest": "cargo/vendor/objc2-foundation-0.3.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-io-surface/objc2-io-surface-0.3.2.crate", + "sha256": "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d", + "dest": "cargo/vendor/objc2-io-surface-0.3.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d\", \"files\": {}}", + "dest": "cargo/vendor/objc2-io-surface-0.3.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-link-presentation/objc2-link-presentation-0.2.2.crate", + "sha256": "a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398", + "dest": "cargo/vendor/objc2-link-presentation-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"a1a1ae721c5e35be65f01a03b6d2ac13a54cb4fa70d8a5da293d7b0020261398\", \"files\": {}}", + "dest": "cargo/vendor/objc2-link-presentation-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-metal/objc2-metal-0.2.2.crate", + "sha256": "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6", + "dest": "cargo/vendor/objc2-metal-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6\", \"files\": {}}", + "dest": "cargo/vendor/objc2-metal-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-metal/objc2-metal-0.3.2.crate", + "sha256": "a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794", + "dest": "cargo/vendor/objc2-metal-0.3.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"a0125f776a10d00af4152d74616409f0d4a2053a6f57fa5b7d6aa2854ac04794\", \"files\": {}}", + "dest": "cargo/vendor/objc2-metal-0.3.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-quartz-core/objc2-quartz-core-0.2.2.crate", + "sha256": "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a", + "dest": "cargo/vendor/objc2-quartz-core-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a\", \"files\": {}}", + "dest": "cargo/vendor/objc2-quartz-core-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-quartz-core/objc2-quartz-core-0.3.2.crate", + "sha256": "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f", + "dest": "cargo/vendor/objc2-quartz-core-0.3.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f\", \"files\": {}}", + "dest": "cargo/vendor/objc2-quartz-core-0.3.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-symbols/objc2-symbols-0.2.2.crate", + "sha256": "0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc", + "dest": "cargo/vendor/objc2-symbols-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"0a684efe3dec1b305badae1a28f6555f6ddd3bb2c2267896782858d5a78404dc\", \"files\": {}}", + "dest": "cargo/vendor/objc2-symbols-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-ui-kit/objc2-ui-kit-0.2.2.crate", + "sha256": "b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f", + "dest": "cargo/vendor/objc2-ui-kit-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"b8bb46798b20cd6b91cbd113524c490f1686f4c4e8f49502431415f3512e2b6f\", \"files\": {}}", + "dest": "cargo/vendor/objc2-ui-kit-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-ui-kit/objc2-ui-kit-0.3.2.crate", + "sha256": "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22", + "dest": "cargo/vendor/objc2-ui-kit-0.3.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22\", \"files\": {}}", + "dest": "cargo/vendor/objc2-ui-kit-0.3.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-uniform-type-identifiers/objc2-uniform-type-identifiers-0.2.2.crate", + "sha256": "44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe", + "dest": "cargo/vendor/objc2-uniform-type-identifiers-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"44fa5f9748dbfe1ca6c0b79ad20725a11eca7c2218bceb4b005cb1be26273bfe\", \"files\": {}}", + "dest": "cargo/vendor/objc2-uniform-type-identifiers-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/objc2-user-notifications/objc2-user-notifications-0.2.2.crate", + "sha256": "76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3", + "dest": "cargo/vendor/objc2-user-notifications-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"76cfcbf642358e8689af64cee815d139339f3ed8ad05103ed5eaf73db8d84cb3\", \"files\": {}}", + "dest": "cargo/vendor/objc2-user-notifications-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/object/object-0.37.3.crate", + "sha256": "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe", + "dest": "cargo/vendor/object-0.37.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe\", \"files\": {}}", + "dest": "cargo/vendor/object-0.37.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/once_cell/once_cell-1.21.4.crate", + "sha256": "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50", + "dest": "cargo/vendor/once_cell-1.21.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50\", \"files\": {}}", + "dest": "cargo/vendor/once_cell-1.21.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/opaque-debug/opaque-debug-0.3.1.crate", + "sha256": "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381", + "dest": "cargo/vendor/opaque-debug-0.3.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381\", \"files\": {}}", + "dest": "cargo/vendor/opaque-debug-0.3.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/open/open-5.4.4.crate", + "sha256": "aa576c76302b7b808eecc68061e67336c47833ef9d22caa74dda10fa9675eebc", + "dest": "cargo/vendor/open-5.4.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"aa576c76302b7b808eecc68061e67336c47833ef9d22caa74dda10fa9675eebc\", \"files\": {}}", + "dest": "cargo/vendor/open-5.4.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/orbclient/orbclient-0.3.55.crate", + "sha256": "5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747", + "dest": "cargo/vendor/orbclient-0.3.55" + }, + { + "type": "inline", + "contents": "{\"package\": \"5df339f526ea9a60e371768d50efc2f2508c7203290731565d1f7a6f71d21747\", \"files\": {}}", + "dest": "cargo/vendor/orbclient-0.3.55", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ordered-float/ordered-float-5.5.0.crate", + "sha256": "8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0", + "dest": "cargo/vendor/ordered-float-5.5.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"8c7c9e0d9b23589f26070720bac724174bfec1083e82f7854cdd0267518343c0\", \"files\": {}}", + "dest": "cargo/vendor/ordered-float-5.5.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ordered-stream/ordered-stream-0.2.0.crate", + "sha256": "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50", + "dest": "cargo/vendor/ordered-stream-0.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50\", \"files\": {}}", + "dest": "cargo/vendor/ordered-stream-0.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/os_pipe/os_pipe-1.2.3.crate", + "sha256": "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967", + "dest": "cargo/vendor/os_pipe-1.2.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967\", \"files\": {}}", + "dest": "cargo/vendor/os_pipe-1.2.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/owned_ttf_parser/owned_ttf_parser-0.25.1.crate", + "sha256": "36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b", + "dest": "cargo/vendor/owned_ttf_parser-0.25.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"36820e9051aca1014ddc75770aab4d68bc1e9e632f0f5627c4086bc216fb583b\", \"files\": {}}", + "dest": "cargo/vendor/owned_ttf_parser-0.25.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/p256/p256-0.13.2.crate", + "sha256": "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b", + "dest": "cargo/vendor/p256-0.13.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b\", \"files\": {}}", + "dest": "cargo/vendor/p256-0.13.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/p384/p384-0.13.1.crate", + "sha256": "fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6", + "dest": "cargo/vendor/p384-0.13.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6\", \"files\": {}}", + "dest": "cargo/vendor/p384-0.13.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/parking/parking-2.2.1.crate", + "sha256": "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba", + "dest": "cargo/vendor/parking-2.2.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba\", \"files\": {}}", + "dest": "cargo/vendor/parking-2.2.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/parking_lot/parking_lot-0.12.5.crate", + "sha256": "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a", + "dest": "cargo/vendor/parking_lot-0.12.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a\", \"files\": {}}", + "dest": "cargo/vendor/parking_lot-0.12.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/parking_lot_core/parking_lot_core-0.9.12.crate", + "sha256": "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1", + "dest": "cargo/vendor/parking_lot_core-0.9.12" + }, + { + "type": "inline", + "contents": "{\"package\": \"2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1\", \"files\": {}}", + "dest": "cargo/vendor/parking_lot_core-0.9.12", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/paste/paste-1.0.15.crate", + "sha256": "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a", + "dest": "cargo/vendor/paste-1.0.15" + }, + { + "type": "inline", + "contents": "{\"package\": \"57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a\", \"files\": {}}", + "dest": "cargo/vendor/paste-1.0.15", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pastey/pastey-0.1.1.crate", + "sha256": "35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec", + "dest": "cargo/vendor/pastey-0.1.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"35fb2e5f958ec131621fdd531e9fc186ed768cbe395337403ae56c17a74c68ec\", \"files\": {}}", + "dest": "cargo/vendor/pastey-0.1.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pem-rfc7468/pem-rfc7468-0.7.0.crate", + "sha256": "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412", + "dest": "cargo/vendor/pem-rfc7468-0.7.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412\", \"files\": {}}", + "dest": "cargo/vendor/pem-rfc7468-0.7.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/peniko/peniko-0.6.1.crate", + "sha256": "839c8299360d2e998bdb106dc0a6cd71dcc5f4df51df1b620361bf50e283cca6", + "dest": "cargo/vendor/peniko-0.6.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"839c8299360d2e998bdb106dc0a6cd71dcc5f4df51df1b620361bf50e283cca6\", \"files\": {}}", + "dest": "cargo/vendor/peniko-0.6.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/percent-encoding/percent-encoding-2.3.2.crate", + "sha256": "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220", + "dest": "cargo/vendor/percent-encoding-2.3.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220\", \"files\": {}}", + "dest": "cargo/vendor/percent-encoding-2.3.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/petgraph/petgraph-0.8.3.crate", + "sha256": "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455", + "dest": "cargo/vendor/petgraph-0.8.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455\", \"files\": {}}", + "dest": "cargo/vendor/petgraph-0.8.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/phf/phf-0.14.0.crate", + "sha256": "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6", + "dest": "cargo/vendor/phf-0.14.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6\", \"files\": {}}", + "dest": "cargo/vendor/phf-0.14.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/phf_generator/phf_generator-0.14.0.crate", + "sha256": "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100", + "dest": "cargo/vendor/phf_generator-0.14.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100\", \"files\": {}}", + "dest": "cargo/vendor/phf_generator-0.14.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/phf_macros/phf_macros-0.14.0.crate", + "sha256": "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085", + "dest": "cargo/vendor/phf_macros-0.14.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085\", \"files\": {}}", + "dest": "cargo/vendor/phf_macros-0.14.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/phf_shared/phf_shared-0.14.0.crate", + "sha256": "c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89", + "dest": "cargo/vendor/phf_shared-0.14.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89\", \"files\": {}}", + "dest": "cargo/vendor/phf_shared-0.14.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pin-project/pin-project-1.1.13.crate", + "sha256": "2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924", + "dest": "cargo/vendor/pin-project-1.1.13" + }, + { + "type": "inline", + "contents": "{\"package\": \"2466b2336ed02bcdca6b294417127b90ec92038d1d5c4fbeac971a922e0e0924\", \"files\": {}}", + "dest": "cargo/vendor/pin-project-1.1.13", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pin-project-internal/pin-project-internal-1.1.13.crate", + "sha256": "c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b", + "dest": "cargo/vendor/pin-project-internal-1.1.13" + }, + { + "type": "inline", + "contents": "{\"package\": \"c96395f0a926bc13b1c17622aaddda1ecb55d49c8f1bf9777e4d877800a43f8b\", \"files\": {}}", + "dest": "cargo/vendor/pin-project-internal-1.1.13", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pin-project-lite/pin-project-lite-0.2.17.crate", + "sha256": "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd", + "dest": "cargo/vendor/pin-project-lite-0.2.17" + }, + { + "type": "inline", + "contents": "{\"package\": \"a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd\", \"files\": {}}", + "dest": "cargo/vendor/pin-project-lite-0.2.17", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/piper/piper-0.2.5.crate", + "sha256": "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1", + "dest": "cargo/vendor/piper-0.2.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1\", \"files\": {}}", + "dest": "cargo/vendor/piper-0.2.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pkcs1/pkcs1-0.7.5.crate", + "sha256": "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f", + "dest": "cargo/vendor/pkcs1-0.7.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f\", \"files\": {}}", + "dest": "cargo/vendor/pkcs1-0.7.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pkcs5/pkcs5-0.7.1.crate", + "sha256": "e847e2c91a18bfa887dd028ec33f2fe6f25db77db3619024764914affe8b69a6", + "dest": "cargo/vendor/pkcs5-0.7.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"e847e2c91a18bfa887dd028ec33f2fe6f25db77db3619024764914affe8b69a6\", \"files\": {}}", + "dest": "cargo/vendor/pkcs5-0.7.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pkcs8/pkcs8-0.10.2.crate", + "sha256": "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7", + "dest": "cargo/vendor/pkcs8-0.10.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7\", \"files\": {}}", + "dest": "cargo/vendor/pkcs8-0.10.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pkg-config/pkg-config-0.3.34.crate", + "sha256": "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548", + "dest": "cargo/vendor/pkg-config-0.3.34" + }, + { + "type": "inline", + "contents": "{\"package\": \"f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548\", \"files\": {}}", + "dest": "cargo/vendor/pkg-config-0.3.34", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/plain/plain-0.2.3.crate", + "sha256": "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6", + "dest": "cargo/vendor/plain-0.2.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6\", \"files\": {}}", + "dest": "cargo/vendor/plain-0.2.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/png/png-0.18.1.crate", + "sha256": "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61", + "dest": "cargo/vendor/png-0.18.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61\", \"files\": {}}", + "dest": "cargo/vendor/png-0.18.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/polling/polling-3.11.0.crate", + "sha256": "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218", + "dest": "cargo/vendor/polling-3.11.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218\", \"files\": {}}", + "dest": "cargo/vendor/polling-3.11.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pollster/pollster-0.4.0.crate", + "sha256": "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3", + "dest": "cargo/vendor/pollster-0.4.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3\", \"files\": {}}", + "dest": "cargo/vendor/pollster-0.4.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pollster/pollster-1.0.1.crate", + "sha256": "bc6355899e1c9462875b6757c79f3caa011a1fdae12bbb1a2e72dd1f234f8336", + "dest": "cargo/vendor/pollster-1.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"bc6355899e1c9462875b6757c79f3caa011a1fdae12bbb1a2e72dd1f234f8336\", \"files\": {}}", + "dest": "cargo/vendor/pollster-1.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/poly1305/poly1305-0.8.0.crate", + "sha256": "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf", + "dest": "cargo/vendor/poly1305-0.8.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf\", \"files\": {}}", + "dest": "cargo/vendor/poly1305-0.8.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/polycool/polycool-0.4.0.crate", + "sha256": "50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6", + "dest": "cargo/vendor/polycool-0.4.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"50596ddc09eb5ad5f75cacd40209568e66df71baf86e1499a0e99c4cff12a5a6\", \"files\": {}}", + "dest": "cargo/vendor/polycool-0.4.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/polyval/polyval-0.6.2.crate", + "sha256": "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25", + "dest": "cargo/vendor/polyval-0.6.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25\", \"files\": {}}", + "dest": "cargo/vendor/polyval-0.6.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/portable-atomic/portable-atomic-1.15.0.crate", + "sha256": "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85", + "dest": "cargo/vendor/portable-atomic-1.15.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85\", \"files\": {}}", + "dest": "cargo/vendor/portable-atomic-1.15.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/portable-atomic-util/portable-atomic-util-0.2.8.crate", + "sha256": "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715", + "dest": "cargo/vendor/portable-atomic-util-0.2.8" + }, + { + "type": "inline", + "contents": "{\"package\": \"10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715\", \"files\": {}}", + "dest": "cargo/vendor/portable-atomic-util-0.2.8", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ppv-lite86/ppv-lite86-0.2.21.crate", + "sha256": "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9", + "dest": "cargo/vendor/ppv-lite86-0.2.21" + }, + { + "type": "inline", + "contents": "{\"package\": \"85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9\", \"files\": {}}", + "dest": "cargo/vendor/ppv-lite86-0.2.21", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/presser/presser-0.3.1.crate", + "sha256": "e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa", + "dest": "cargo/vendor/presser-0.3.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"e8cf8e6a8aa66ce33f63993ffc4ea4271eb5b0530a9002db8455ea6050c77bfa\", \"files\": {}}", + "dest": "cargo/vendor/presser-0.3.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/primeorder/primeorder-0.13.6.crate", + "sha256": "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6", + "dest": "cargo/vendor/primeorder-0.13.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6\", \"files\": {}}", + "dest": "cargo/vendor/primeorder-0.13.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/proc-macro-crate/proc-macro-crate-3.5.0.crate", + "sha256": "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f", + "dest": "cargo/vendor/proc-macro-crate-3.5.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f\", \"files\": {}}", + "dest": "cargo/vendor/proc-macro-crate-3.5.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/proc-macro2/proc-macro2-1.0.107.crate", + "sha256": "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9", + "dest": "cargo/vendor/proc-macro2-1.0.107" + }, + { + "type": "inline", + "contents": "{\"package\": \"985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9\", \"files\": {}}", + "dest": "cargo/vendor/proc-macro2-1.0.107", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/profiling/profiling-1.0.18.crate", + "sha256": "3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5", + "dest": "cargo/vendor/profiling-1.0.18" + }, + { + "type": "inline", + "contents": "{\"package\": \"3d595e54a326bc53c1c197b32d295e14b169e3cfeaa8dc82b529f947fba6bcf5\", \"files\": {}}", + "dest": "cargo/vendor/profiling-1.0.18", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/profiling-procmacros/profiling-procmacros-1.0.18.crate", + "sha256": "4488a4a36b9a4ba6b9334a32a39971f77c1436ec82c38707bce707699cc3bbcb", + "dest": "cargo/vendor/profiling-procmacros-1.0.18" + }, + { + "type": "inline", + "contents": "{\"package\": \"4488a4a36b9a4ba6b9334a32a39971f77c1436ec82c38707bce707699cc3bbcb\", \"files\": {}}", + "dest": "cargo/vendor/profiling-procmacros-1.0.18", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/proptest/proptest-1.11.0.crate", + "sha256": "4b45fcc2344c680f5025fe57779faef368840d0bd1f42f216291f0dc4ace4744", + "dest": "cargo/vendor/proptest-1.11.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"4b45fcc2344c680f5025fe57779faef368840d0bd1f42f216291f0dc4ace4744\", \"files\": {}}", + "dest": "cargo/vendor/proptest-1.11.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pulp/pulp-0.18.22.crate", + "sha256": "a0a01a0dc67cf4558d279f0c25b0962bd08fc6dec0137699eae304103e882fe6", + "dest": "cargo/vendor/pulp-0.18.22" + }, + { + "type": "inline", + "contents": "{\"package\": \"a0a01a0dc67cf4558d279f0c25b0962bd08fc6dec0137699eae304103e882fe6\", \"files\": {}}", + "dest": "cargo/vendor/pulp-0.18.22", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pulp/pulp-0.21.5.crate", + "sha256": "96b86df24f0a7ddd5e4b95c94fc9ed8a98f1ca94d3b01bdce2824097e7835907", + "dest": "cargo/vendor/pulp-0.21.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"96b86df24f0a7ddd5e4b95c94fc9ed8a98f1ca94d3b01bdce2824097e7835907\", \"files\": {}}", + "dest": "cargo/vendor/pulp-0.21.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pulp/pulp-0.22.3.crate", + "sha256": "046aa45b989642ec2e4717c8e72d677b13edd831a4d3b6cf37d9a3e54912496a", + "dest": "cargo/vendor/pulp-0.22.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"046aa45b989642ec2e4717c8e72d677b13edd831a4d3b6cf37d9a3e54912496a\", \"files\": {}}", + "dest": "cargo/vendor/pulp-0.22.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pulp-wasm-simd-flag/pulp-wasm-simd-flag-0.1.1.crate", + "sha256": "1d8f70e07b9c3962945a74e59ca1c511bba65b6419468acc217c457d93f3c740", + "dest": "cargo/vendor/pulp-wasm-simd-flag-0.1.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"1d8f70e07b9c3962945a74e59ca1c511bba65b6419468acc217c457d93f3c740\", \"files\": {}}", + "dest": "cargo/vendor/pulp-wasm-simd-flag-0.1.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/pxfm/pxfm-0.1.30.crate", + "sha256": "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea", + "dest": "cargo/vendor/pxfm-0.1.30" + }, + { + "type": "inline", + "contents": "{\"package\": \"d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea\", \"files\": {}}", + "dest": "cargo/vendor/pxfm-0.1.30", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/quick-error/quick-error-1.2.3.crate", + "sha256": "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0", + "dest": "cargo/vendor/quick-error-1.2.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0\", \"files\": {}}", + "dest": "cargo/vendor/quick-error-1.2.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/quick-error/quick-error-2.0.1.crate", + "sha256": "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3", + "dest": "cargo/vendor/quick-error-2.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3\", \"files\": {}}", + "dest": "cargo/vendor/quick-error-2.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/quick-xml/quick-xml-0.41.0.crate", + "sha256": "e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1", + "dest": "cargo/vendor/quick-xml-0.41.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"e660451e55124f798a69a5af3f49ccfbefbd41910eefd25caf2393e1f3473ec1\", \"files\": {}}", + "dest": "cargo/vendor/quick-xml-0.41.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/quote/quote-1.0.47.crate", + "sha256": "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001", + "dest": "cargo/vendor/quote-1.0.47" + }, + { + "type": "inline", + "contents": "{\"package\": \"1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001\", \"files\": {}}", + "dest": "cargo/vendor/quote-1.0.47", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/r-efi/r-efi-5.3.0.crate", + "sha256": "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f", + "dest": "cargo/vendor/r-efi-5.3.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f\", \"files\": {}}", + "dest": "cargo/vendor/r-efi-5.3.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/r-efi/r-efi-6.0.0.crate", + "sha256": "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf", + "dest": "cargo/vendor/r-efi-6.0.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf\", \"files\": {}}", + "dest": "cargo/vendor/r-efi-6.0.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rand/rand-0.8.8.crate", + "sha256": "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c", + "dest": "cargo/vendor/rand-0.8.8" + }, + { + "type": "inline", + "contents": "{\"package\": \"e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c\", \"files\": {}}", + "dest": "cargo/vendor/rand-0.8.8", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rand/rand-0.9.5.crate", + "sha256": "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41", + "dest": "cargo/vendor/rand-0.9.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41\", \"files\": {}}", + "dest": "cargo/vendor/rand-0.9.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rand_chacha/rand_chacha-0.3.1.crate", + "sha256": "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88", + "dest": "cargo/vendor/rand_chacha-0.3.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88\", \"files\": {}}", + "dest": "cargo/vendor/rand_chacha-0.3.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rand_chacha/rand_chacha-0.9.0.crate", + "sha256": "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb", + "dest": "cargo/vendor/rand_chacha-0.9.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb\", \"files\": {}}", + "dest": "cargo/vendor/rand_chacha-0.9.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rand_core/rand_core-0.6.4.crate", + "sha256": "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c", + "dest": "cargo/vendor/rand_core-0.6.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c\", \"files\": {}}", + "dest": "cargo/vendor/rand_core-0.6.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rand_core/rand_core-0.9.5.crate", + "sha256": "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c", + "dest": "cargo/vendor/rand_core-0.9.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c\", \"files\": {}}", + "dest": "cargo/vendor/rand_core-0.9.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rand_distr/rand_distr-0.5.1.crate", + "sha256": "6a8615d50dcf34fa31f7ab52692afec947c4dd0ab803cc87cb3b0b4570ff7463", + "dest": "cargo/vendor/rand_distr-0.5.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"6a8615d50dcf34fa31f7ab52692afec947c4dd0ab803cc87cb3b0b4570ff7463\", \"files\": {}}", + "dest": "cargo/vendor/rand_distr-0.5.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rand_xorshift/rand_xorshift-0.4.0.crate", + "sha256": "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a", + "dest": "cargo/vendor/rand_xorshift-0.4.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a\", \"files\": {}}", + "dest": "cargo/vendor/rand_xorshift-0.4.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/range-alloc/range-alloc-0.1.5.crate", + "sha256": "ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08", + "dest": "cargo/vendor/range-alloc-0.1.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"ca45419789ae5a7899559e9512e58ca889e41f04f1f2445e9f4b290ceccd1d08\", \"files\": {}}", + "dest": "cargo/vendor/range-alloc-0.1.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rav1e/rav1e-0.8.1.crate", + "sha256": "43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b", + "dest": "cargo/vendor/rav1e-0.8.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"43b6dd56e85d9483277cde964fd1bdb0428de4fec5ebba7540995639a21cb32b\", \"files\": {}}", + "dest": "cargo/vendor/rav1e-0.8.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ravif/ravif-0.13.0.crate", + "sha256": "e52310197d971b0f5be7fe6b57530dcd27beb35c1b013f29d66c1ad73fbbcc45", + "dest": "cargo/vendor/ravif-0.13.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"e52310197d971b0f5be7fe6b57530dcd27beb35c1b013f29d66c1ad73fbbcc45\", \"files\": {}}", + "dest": "cargo/vendor/ravif-0.13.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/raw-cpuid/raw-cpuid-10.7.0.crate", + "sha256": "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332", + "dest": "cargo/vendor/raw-cpuid-10.7.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332\", \"files\": {}}", + "dest": "cargo/vendor/raw-cpuid-10.7.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/raw-cpuid/raw-cpuid-11.6.0.crate", + "sha256": "498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186", + "dest": "cargo/vendor/raw-cpuid-11.6.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"498cd0dc59d73224351ee52a95fee0f1a617a2eae0e7d9d720cc622c73a54186\", \"files\": {}}", + "dest": "cargo/vendor/raw-cpuid-11.6.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/raw-window-handle/raw-window-handle-0.6.2.crate", + "sha256": "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539", + "dest": "cargo/vendor/raw-window-handle-0.6.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539\", \"files\": {}}", + "dest": "cargo/vendor/raw-window-handle-0.6.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/raw-window-metal/raw-window-metal-1.1.0.crate", + "sha256": "40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135", + "dest": "cargo/vendor/raw-window-metal-1.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"40d213455a5f1dc59214213c7330e074ddf8114c9a42411eb890c767357ce135\", \"files\": {}}", + "dest": "cargo/vendor/raw-window-metal-1.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rawpointer/rawpointer-0.2.1.crate", + "sha256": "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3", + "dest": "cargo/vendor/rawpointer-0.2.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3\", \"files\": {}}", + "dest": "cargo/vendor/rawpointer-0.2.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rayon/rayon-1.12.0.crate", + "sha256": "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d", + "dest": "cargo/vendor/rayon-1.12.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d\", \"files\": {}}", + "dest": "cargo/vendor/rayon-1.12.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rayon-core/rayon-core-1.13.0.crate", + "sha256": "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91", + "dest": "cargo/vendor/rayon-core-1.13.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91\", \"files\": {}}", + "dest": "cargo/vendor/rayon-core-1.13.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/read-fonts/read-fonts-0.41.0.crate", + "sha256": "046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709", + "dest": "cargo/vendor/read-fonts-0.41.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"046a7d674daf459825b32f5062056d6882db0d2f5a479fbd76ccfc870ac18709\", \"files\": {}}", + "dest": "cargo/vendor/read-fonts-0.41.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/reborrow/reborrow-0.5.5.crate", + "sha256": "03251193000f4bd3b042892be858ee50e8b3719f2b08e5833ac4353724632430", + "dest": "cargo/vendor/reborrow-0.5.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"03251193000f4bd3b042892be858ee50e8b3719f2b08e5833ac4353724632430\", \"files\": {}}", + "dest": "cargo/vendor/reborrow-0.5.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/redox_syscall/redox_syscall-0.4.1.crate", + "sha256": "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa", + "dest": "cargo/vendor/redox_syscall-0.4.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa\", \"files\": {}}", + "dest": "cargo/vendor/redox_syscall-0.4.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/redox_syscall/redox_syscall-0.5.18.crate", + "sha256": "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d", + "dest": "cargo/vendor/redox_syscall-0.5.18" + }, + { + "type": "inline", + "contents": "{\"package\": \"ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d\", \"files\": {}}", + "dest": "cargo/vendor/redox_syscall-0.5.18", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/redox_syscall/redox_syscall-0.9.4.crate", + "sha256": "737970939a87c6fa31e7acad13307bccbb017a073b695b6089a2c484f929e20e", + "dest": "cargo/vendor/redox_syscall-0.9.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"737970939a87c6fa31e7acad13307bccbb017a073b695b6089a2c484f929e20e\", \"files\": {}}", + "dest": "cargo/vendor/redox_syscall-0.9.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/regex-syntax/regex-syntax-0.8.11.crate", + "sha256": "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4", + "dest": "cargo/vendor/regex-syntax-0.8.11" + }, + { + "type": "inline", + "contents": "{\"package\": \"d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4\", \"files\": {}}", + "dest": "cargo/vendor/regex-syntax-0.8.11", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/renderdoc-sys/renderdoc-sys-1.1.0.crate", + "sha256": "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832", + "dest": "cargo/vendor/renderdoc-sys-1.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832\", \"files\": {}}", + "dest": "cargo/vendor/renderdoc-sys-1.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rfc6979/rfc6979-0.4.0.crate", + "sha256": "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2", + "dest": "cargo/vendor/rfc6979-0.4.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2\", \"files\": {}}", + "dest": "cargo/vendor/rfc6979-0.4.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rfd/rfd-0.17.2.crate", + "sha256": "20dafead71c16a34e1ff357ddefc8afc11e7d51d6d2b9fbd07eaa48e3e540220", + "dest": "cargo/vendor/rfd-0.17.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"20dafead71c16a34e1ff357ddefc8afc11e7d51d6d2b9fbd07eaa48e3e540220\", \"files\": {}}", + "dest": "cargo/vendor/rfd-0.17.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rgb/rgb-0.8.53.crate", + "sha256": "47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4", + "dest": "cargo/vendor/rgb-0.8.53" + }, + { + "type": "inline", + "contents": "{\"package\": \"47b34b781b31e5d73e9fbc8689c70551fd1ade9a19e3e28cfec8580a79290cc4\", \"files\": {}}", + "dest": "cargo/vendor/rgb-0.8.53", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ring/ring-0.17.14.crate", + "sha256": "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7", + "dest": "cargo/vendor/ring-0.17.14" + }, + { + "type": "inline", + "contents": "{\"package\": \"a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7\", \"files\": {}}", + "dest": "cargo/vendor/ring-0.17.14", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rsa/rsa-0.9.10.crate", + "sha256": "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d", + "dest": "cargo/vendor/rsa-0.9.10" + }, + { + "type": "inline", + "contents": "{\"package\": \"b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d\", \"files\": {}}", + "dest": "cargo/vendor/rsa-0.9.10", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rustc-demangle/rustc-demangle-0.1.28.crate", + "sha256": "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb", + "dest": "cargo/vendor/rustc-demangle-0.1.28" + }, + { + "type": "inline", + "contents": "{\"package\": \"b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb\", \"files\": {}}", + "dest": "cargo/vendor/rustc-demangle-0.1.28", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rustc-hash/rustc-hash-1.1.0.crate", + "sha256": "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2", + "dest": "cargo/vendor/rustc-hash-1.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2\", \"files\": {}}", + "dest": "cargo/vendor/rustc-hash-1.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rustc-hash/rustc-hash-2.1.3.crate", + "sha256": "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d", + "dest": "cargo/vendor/rustc-hash-2.1.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d\", \"files\": {}}", + "dest": "cargo/vendor/rustc-hash-2.1.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rustc_version/rustc_version-0.4.1.crate", + "sha256": "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92", + "dest": "cargo/vendor/rustc_version-0.4.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92\", \"files\": {}}", + "dest": "cargo/vendor/rustc_version-0.4.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rustix/rustix-0.38.44.crate", + "sha256": "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154", + "dest": "cargo/vendor/rustix-0.38.44" + }, + { + "type": "inline", + "contents": "{\"package\": \"fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154\", \"files\": {}}", + "dest": "cargo/vendor/rustix-0.38.44", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rustix/rustix-1.1.5.crate", + "sha256": "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d", + "dest": "cargo/vendor/rustix-1.1.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d\", \"files\": {}}", + "dest": "cargo/vendor/rustix-1.1.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rustls/rustls-0.23.45.crate", + "sha256": "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634", + "dest": "cargo/vendor/rustls-0.23.45" + }, + { + "type": "inline", + "contents": "{\"package\": \"0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634\", \"files\": {}}", + "dest": "cargo/vendor/rustls-0.23.45", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rustls-pki-types/rustls-pki-types-1.15.1.crate", + "sha256": "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96", + "dest": "cargo/vendor/rustls-pki-types-1.15.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96\", \"files\": {}}", + "dest": "cargo/vendor/rustls-pki-types-1.15.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rustls-rustcrypto/rustls-rustcrypto-0.0.2-alpha.crate", + "sha256": "f12052947763ab8515f753315357599e9b0b4dab3b8ba15f30f725fe6d025557", + "dest": "cargo/vendor/rustls-rustcrypto-0.0.2-alpha" + }, + { + "type": "inline", + "contents": "{\"package\": \"f12052947763ab8515f753315357599e9b0b4dab3b8ba15f30f725fe6d025557\", \"files\": {}}", + "dest": "cargo/vendor/rustls-rustcrypto-0.0.2-alpha", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rustls-webpki/rustls-webpki-0.102.8.crate", + "sha256": "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9", + "dest": "cargo/vendor/rustls-webpki-0.102.8" + }, + { + "type": "inline", + "contents": "{\"package\": \"64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9\", \"files\": {}}", + "dest": "cargo/vendor/rustls-webpki-0.102.8", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rustls-webpki/rustls-webpki-0.103.15.crate", + "sha256": "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2", + "dest": "cargo/vendor/rustls-webpki-0.103.15" + }, + { + "type": "inline", + "contents": "{\"package\": \"f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2\", \"files\": {}}", + "dest": "cargo/vendor/rustls-webpki-0.103.15", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rustversion/rustversion-1.0.23.crate", + "sha256": "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f", + "dest": "cargo/vendor/rustversion-1.0.23" + }, + { + "type": "inline", + "contents": "{\"package\": \"cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f\", \"files\": {}}", + "dest": "cargo/vendor/rustversion-1.0.23", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/rusty-fork/rusty-fork-0.3.1.crate", + "sha256": "cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2", + "dest": "cargo/vendor/rusty-fork-0.3.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"cc6bf79ff24e648f6da1f8d1f011e9cac26491b619e6b9280f2b47f1774e6ee2\", \"files\": {}}", + "dest": "cargo/vendor/rusty-fork-0.3.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/safetensors/safetensors-0.4.5.crate", + "sha256": "44560c11236a6130a46ce36c836a62936dc81ebf8c36a37947423571be0e55b6", + "dest": "cargo/vendor/safetensors-0.4.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"44560c11236a6130a46ce36c836a62936dc81ebf8c36a37947423571be0e55b6\", \"files\": {}}", + "dest": "cargo/vendor/safetensors-0.4.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/safetensors/safetensors-0.7.0.crate", + "sha256": "675656c1eabb620b921efea4f9199f97fc86e36dd6ffd1fbbe48d0f59a4987f5", + "dest": "cargo/vendor/safetensors-0.7.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"675656c1eabb620b921efea4f9199f97fc86e36dd6ffd1fbbe48d0f59a4987f5\", \"files\": {}}", + "dest": "cargo/vendor/safetensors-0.7.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/same-file/same-file-1.0.6.crate", + "sha256": "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502", + "dest": "cargo/vendor/same-file-1.0.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502\", \"files\": {}}", + "dest": "cargo/vendor/same-file-1.0.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/scoped-tls/scoped-tls-1.0.1.crate", + "sha256": "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294", + "dest": "cargo/vendor/scoped-tls-1.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294\", \"files\": {}}", + "dest": "cargo/vendor/scoped-tls-1.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/scopeguard/scopeguard-1.2.0.crate", + "sha256": "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49", + "dest": "cargo/vendor/scopeguard-1.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49\", \"files\": {}}", + "dest": "cargo/vendor/scopeguard-1.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/sec1/sec1-0.7.3.crate", + "sha256": "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc", + "dest": "cargo/vendor/sec1-0.7.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc\", \"files\": {}}", + "dest": "cargo/vendor/sec1-0.7.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/self_cell/self_cell-1.3.0.crate", + "sha256": "2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813", + "dest": "cargo/vendor/self_cell-1.3.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"2ab42ca02749e120097e328d91d415325bdf43b1c72c4c8badf37375fe40a813\", \"files\": {}}", + "dest": "cargo/vendor/self_cell-1.3.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/semver/semver-1.0.28.crate", + "sha256": "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd", + "dest": "cargo/vendor/semver-1.0.28" + }, + { + "type": "inline", + "contents": "{\"package\": \"8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd\", \"files\": {}}", + "dest": "cargo/vendor/semver-1.0.28", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/send_wrapper/send_wrapper-0.6.0.crate", + "sha256": "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73", + "dest": "cargo/vendor/send_wrapper-0.6.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73\", \"files\": {}}", + "dest": "cargo/vendor/send_wrapper-0.6.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/seq-macro/seq-macro-0.3.6.crate", + "sha256": "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc", + "dest": "cargo/vendor/seq-macro-0.3.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc\", \"files\": {}}", + "dest": "cargo/vendor/seq-macro-0.3.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/serde/serde-1.0.229.crate", + "sha256": "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba", + "dest": "cargo/vendor/serde-1.0.229" + }, + { + "type": "inline", + "contents": "{\"package\": \"4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba\", \"files\": {}}", + "dest": "cargo/vendor/serde-1.0.229", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/serde_core/serde_core-1.0.229.crate", + "sha256": "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48", + "dest": "cargo/vendor/serde_core-1.0.229" + }, + { + "type": "inline", + "contents": "{\"package\": \"67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48\", \"files\": {}}", + "dest": "cargo/vendor/serde_core-1.0.229", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/serde_derive/serde_derive-1.0.229.crate", + "sha256": "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348", + "dest": "cargo/vendor/serde_derive-1.0.229" + }, + { + "type": "inline", + "contents": "{\"package\": \"e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348\", \"files\": {}}", + "dest": "cargo/vendor/serde_derive-1.0.229", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/serde_json/serde_json-1.0.151.crate", + "sha256": "c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14", + "dest": "cargo/vendor/serde_json-1.0.151" + }, + { + "type": "inline", + "contents": "{\"package\": \"c841b55ecdae098c80dcae9cf767f6f8a0c2cdb3416bbef72181df4d0fe73f14\", \"files\": {}}", + "dest": "cargo/vendor/serde_json-1.0.151", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/serde_repr/serde_repr-0.1.21.crate", + "sha256": "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906", + "dest": "cargo/vendor/serde_repr-0.1.21" + }, + { + "type": "inline", + "contents": "{\"package\": \"8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906\", \"files\": {}}", + "dest": "cargo/vendor/serde_repr-0.1.21", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/serde_spanned/serde_spanned-1.1.1.crate", + "sha256": "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26", + "dest": "cargo/vendor/serde_spanned-1.1.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26\", \"files\": {}}", + "dest": "cargo/vendor/serde_spanned-1.1.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/sha2/sha2-0.10.9.crate", + "sha256": "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283", + "dest": "cargo/vendor/sha2-0.10.9" + }, + { + "type": "inline", + "contents": "{\"package\": \"a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283\", \"files\": {}}", + "dest": "cargo/vendor/sha2-0.10.9", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/shlex/shlex-2.0.1.crate", + "sha256": "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba", + "dest": "cargo/vendor/shlex-2.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba\", \"files\": {}}", + "dest": "cargo/vendor/shlex-2.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/signal-hook-registry/signal-hook-registry-1.4.8.crate", + "sha256": "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b", + "dest": "cargo/vendor/signal-hook-registry-1.4.8" + }, + { + "type": "inline", + "contents": "{\"package\": \"c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b\", \"files\": {}}", + "dest": "cargo/vendor/signal-hook-registry-1.4.8", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/signature/signature-2.2.0.crate", + "sha256": "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de", + "dest": "cargo/vendor/signature-2.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de\", \"files\": {}}", + "dest": "cargo/vendor/signature-2.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/simd-adler32/simd-adler32-0.3.10.crate", + "sha256": "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea", + "dest": "cargo/vendor/simd-adler32-0.3.10" + }, + { + "type": "inline", + "contents": "{\"package\": \"3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea\", \"files\": {}}", + "dest": "cargo/vendor/simd-adler32-0.3.10", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/simd_cesu8/simd_cesu8-1.2.0.crate", + "sha256": "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520", + "dest": "cargo/vendor/simd_cesu8-1.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520\", \"files\": {}}", + "dest": "cargo/vendor/simd_cesu8-1.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/simd_helpers/simd_helpers-0.1.0.crate", + "sha256": "95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6", + "dest": "cargo/vendor/simd_helpers-0.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"95890f873bec569a0362c235787f3aca6e1e887302ba4840839bcc6459c42da6\", \"files\": {}}", + "dest": "cargo/vendor/simd_helpers-0.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/simdutf8/simdutf8-0.1.5.crate", + "sha256": "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e", + "dest": "cargo/vendor/simdutf8-0.1.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e\", \"files\": {}}", + "dest": "cargo/vendor/simdutf8-0.1.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/siphasher/siphasher-1.0.4.crate", + "sha256": "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256", + "dest": "cargo/vendor/siphasher-1.0.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256\", \"files\": {}}", + "dest": "cargo/vendor/siphasher-1.0.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/skrifa/skrifa-0.44.0.crate", + "sha256": "819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68", + "dest": "cargo/vendor/skrifa-0.44.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"819ab7d62b1d3e72d9d9dea5650bac30424f9111364bb94928dbf5ecad1baa68\", \"files\": {}}", + "dest": "cargo/vendor/skrifa-0.44.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/slab/slab-0.4.12.crate", + "sha256": "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5", + "dest": "cargo/vendor/slab-0.4.12" + }, + { + "type": "inline", + "contents": "{\"package\": \"0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5\", \"files\": {}}", + "dest": "cargo/vendor/slab-0.4.12", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/slotmap/slotmap-1.1.1.crate", + "sha256": "bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038", + "dest": "cargo/vendor/slotmap-1.1.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"bdd58c3c93c3d278ca835519292445cb4b0d4dc59ccfdf7ceadaab3f8aeb4038\", \"files\": {}}", + "dest": "cargo/vendor/slotmap-1.1.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/smallvec/smallvec-1.16.2.crate", + "sha256": "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e", + "dest": "cargo/vendor/smallvec-1.16.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e\", \"files\": {}}", + "dest": "cargo/vendor/smallvec-1.16.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/smithay-client-toolkit/smithay-client-toolkit-0.19.2.crate", + "sha256": "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016", + "dest": "cargo/vendor/smithay-client-toolkit-0.19.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016\", \"files\": {}}", + "dest": "cargo/vendor/smithay-client-toolkit-0.19.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/smithay-client-toolkit/smithay-client-toolkit-0.20.0.crate", + "sha256": "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0", + "dest": "cargo/vendor/smithay-client-toolkit-0.20.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0\", \"files\": {}}", + "dest": "cargo/vendor/smithay-client-toolkit-0.20.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/smithay-clipboard/smithay-clipboard-0.7.3.crate", + "sha256": "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226", + "dest": "cargo/vendor/smithay-clipboard-0.7.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226\", \"files\": {}}", + "dest": "cargo/vendor/smithay-clipboard-0.7.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/smol_str/smol_str-0.2.2.crate", + "sha256": "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead", + "dest": "cargo/vendor/smol_str-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead\", \"files\": {}}", + "dest": "cargo/vendor/smol_str-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/spin/spin-0.9.9.crate", + "sha256": "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e", + "dest": "cargo/vendor/spin-0.9.9" + }, + { + "type": "inline", + "contents": "{\"package\": \"3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e\", \"files\": {}}", + "dest": "cargo/vendor/spin-0.9.9", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/spirv/spirv-0.4.0+sdk-1.4.341.0.crate", + "sha256": "d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f", + "dest": "cargo/vendor/spirv-0.4.0+sdk-1.4.341.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"d9571ea910ebd84c86af4b3ed27f9dbdc6ad06f17c5f96146b2b671e2976744f\", \"files\": {}}", + "dest": "cargo/vendor/spirv-0.4.0+sdk-1.4.341.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/spki/spki-0.7.3.crate", + "sha256": "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d", + "dest": "cargo/vendor/spki-0.7.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d\", \"files\": {}}", + "dest": "cargo/vendor/spki-0.7.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/stable_deref_trait/stable_deref_trait-1.2.1.crate", + "sha256": "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596", + "dest": "cargo/vendor/stable_deref_trait-1.2.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596\", \"files\": {}}", + "dest": "cargo/vendor/stable_deref_trait-1.2.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/static_assertions/static_assertions-1.1.0.crate", + "sha256": "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f", + "dest": "cargo/vendor/static_assertions-1.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f\", \"files\": {}}", + "dest": "cargo/vendor/static_assertions-1.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/subtle/subtle-2.6.1.crate", + "sha256": "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292", + "dest": "cargo/vendor/subtle-2.6.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292\", \"files\": {}}", + "dest": "cargo/vendor/subtle-2.6.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/syn/syn-2.0.119.crate", + "sha256": "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297", + "dest": "cargo/vendor/syn-2.0.119" + }, + { + "type": "inline", + "contents": "{\"package\": \"872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297\", \"files\": {}}", + "dest": "cargo/vendor/syn-2.0.119", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/syn/syn-3.0.6.crate", + "sha256": "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee", + "dest": "cargo/vendor/syn-3.0.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee\", \"files\": {}}", + "dest": "cargo/vendor/syn-3.0.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/synstructure/synstructure-0.13.2.crate", + "sha256": "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2", + "dest": "cargo/vendor/synstructure-0.13.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2\", \"files\": {}}", + "dest": "cargo/vendor/synstructure-0.13.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/synstructure/synstructure-0.14.0.crate", + "sha256": "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02", + "dest": "cargo/vendor/synstructure-0.14.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02\", \"files\": {}}", + "dest": "cargo/vendor/synstructure-0.14.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/sysctl/sysctl-0.5.5.crate", + "sha256": "ec7dddc5f0fee506baf8b9fdb989e242f17e4b11c61dfbb0635b705217199eea", + "dest": "cargo/vendor/sysctl-0.5.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"ec7dddc5f0fee506baf8b9fdb989e242f17e4b11c61dfbb0635b705217199eea\", \"files\": {}}", + "dest": "cargo/vendor/sysctl-0.5.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/sysctl/sysctl-0.6.0.crate", + "sha256": "01198a2debb237c62b6826ec7081082d951f46dbb64b0e8c7649a452230d1dfc", + "dest": "cargo/vendor/sysctl-0.6.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"01198a2debb237c62b6826ec7081082d951f46dbb64b0e8c7649a452230d1dfc\", \"files\": {}}", + "dest": "cargo/vendor/sysctl-0.6.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/tempfile/tempfile-3.27.0.crate", + "sha256": "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd", + "dest": "cargo/vendor/tempfile-3.27.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd\", \"files\": {}}", + "dest": "cargo/vendor/tempfile-3.27.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/termcolor/termcolor-1.4.1.crate", + "sha256": "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755", + "dest": "cargo/vendor/termcolor-1.4.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755\", \"files\": {}}", + "dest": "cargo/vendor/termcolor-1.4.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/thiserror/thiserror-1.0.69.crate", + "sha256": "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52", + "dest": "cargo/vendor/thiserror-1.0.69" + }, + { + "type": "inline", + "contents": "{\"package\": \"b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52\", \"files\": {}}", + "dest": "cargo/vendor/thiserror-1.0.69", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/thiserror/thiserror-2.0.21.crate", + "sha256": "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e", + "dest": "cargo/vendor/thiserror-2.0.21" + }, + { + "type": "inline", + "contents": "{\"package\": \"09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e\", \"files\": {}}", + "dest": "cargo/vendor/thiserror-2.0.21", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/thiserror-impl/thiserror-impl-1.0.69.crate", + "sha256": "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1", + "dest": "cargo/vendor/thiserror-impl-1.0.69" + }, + { + "type": "inline", + "contents": "{\"package\": \"4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1\", \"files\": {}}", + "dest": "cargo/vendor/thiserror-impl-1.0.69", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/thiserror-impl/thiserror-impl-2.0.21.crate", + "sha256": "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524", + "dest": "cargo/vendor/thiserror-impl-2.0.21" + }, + { + "type": "inline", + "contents": "{\"package\": \"fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524\", \"files\": {}}", + "dest": "cargo/vendor/thiserror-impl-2.0.21", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/thousands/thousands-0.2.0.crate", + "sha256": "3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820", + "dest": "cargo/vendor/thousands-0.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"3bf63baf9f5039dadc247375c29eb13706706cfde997d0330d05aa63a77d8820\", \"files\": {}}", + "dest": "cargo/vendor/thousands-0.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/tiff/tiff-0.11.3.crate", + "sha256": "b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52", + "dest": "cargo/vendor/tiff-0.11.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"b63feaf3343d35b6ca4d50483f94843803b0f51634937cc2ec519fc32232bc52\", \"files\": {}}", + "dest": "cargo/vendor/tiff-0.11.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/tokio/tokio-1.53.1.crate", + "sha256": "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed", + "dest": "cargo/vendor/tokio-1.53.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed\", \"files\": {}}", + "dest": "cargo/vendor/tokio-1.53.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/toml/toml-1.1.6+spec-1.1.0.crate", + "sha256": "920602543f0911ab71da12c50d59701da54c196d1a2bf5cb4b75667f137a406a", + "dest": "cargo/vendor/toml-1.1.6+spec-1.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"920602543f0911ab71da12c50d59701da54c196d1a2bf5cb4b75667f137a406a\", \"files\": {}}", + "dest": "cargo/vendor/toml-1.1.6+spec-1.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/toml_datetime/toml_datetime-1.1.1+spec-1.1.0.crate", + "sha256": "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7", + "dest": "cargo/vendor/toml_datetime-1.1.1+spec-1.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7\", \"files\": {}}", + "dest": "cargo/vendor/toml_datetime-1.1.1+spec-1.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/toml_edit/toml_edit-0.25.15+spec-1.1.0.crate", + "sha256": "1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614", + "dest": "cargo/vendor/toml_edit-0.25.15+spec-1.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"1340ea94a5856333492c9064b02c778b191dd2c853778d9609debdcdfea3a614\", \"files\": {}}", + "dest": "cargo/vendor/toml_edit-0.25.15+spec-1.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/toml_parser/toml_parser-1.1.3+spec-1.1.0.crate", + "sha256": "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56", + "dest": "cargo/vendor/toml_parser-1.1.3+spec-1.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56\", \"files\": {}}", + "dest": "cargo/vendor/toml_parser-1.1.3+spec-1.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/toml_writer/toml_writer-1.1.2+spec-1.1.0.crate", + "sha256": "7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2", + "dest": "cargo/vendor/toml_writer-1.1.2+spec-1.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"7d56353a2a665ad0f41a421187180aab746c8c325620617ad883a99a1cbe66d2\", \"files\": {}}", + "dest": "cargo/vendor/toml_writer-1.1.2+spec-1.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/tracing/tracing-0.1.44.crate", + "sha256": "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100", + "dest": "cargo/vendor/tracing-0.1.44" + }, + { + "type": "inline", + "contents": "{\"package\": \"63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100\", \"files\": {}}", + "dest": "cargo/vendor/tracing-0.1.44", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/tracing-attributes/tracing-attributes-0.1.31.crate", + "sha256": "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da", + "dest": "cargo/vendor/tracing-attributes-0.1.31" + }, + { + "type": "inline", + "contents": "{\"package\": \"7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da\", \"files\": {}}", + "dest": "cargo/vendor/tracing-attributes-0.1.31", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/tracing-core/tracing-core-0.1.36.crate", + "sha256": "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a", + "dest": "cargo/vendor/tracing-core-0.1.36" + }, + { + "type": "inline", + "contents": "{\"package\": \"db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a\", \"files\": {}}", + "dest": "cargo/vendor/tracing-core-0.1.36", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/tree_magic_mini/tree_magic_mini-3.2.2.crate", + "sha256": "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6", + "dest": "cargo/vendor/tree_magic_mini-3.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6\", \"files\": {}}", + "dest": "cargo/vendor/tree_magic_mini-3.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ttf-parser/ttf-parser-0.25.1.crate", + "sha256": "d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31", + "dest": "cargo/vendor/ttf-parser-0.25.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"d2df906b07856748fa3f6e0ad0cbaa047052d4a7dd609e231c4f72cee8c36f31\", \"files\": {}}", + "dest": "cargo/vendor/ttf-parser-0.25.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/type-map/type-map-0.5.1.crate", + "sha256": "cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90", + "dest": "cargo/vendor/type-map-0.5.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"cb30dbbd9036155e74adad6812e9898d03ec374946234fbcebd5dfc7b9187b90\", \"files\": {}}", + "dest": "cargo/vendor/type-map-0.5.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/typed-path/typed-path-0.12.3.crate", + "sha256": "8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e", + "dest": "cargo/vendor/typed-path-0.12.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"8e28f89b80c87b8fb0cf04ab448d5dd0dd0ade2f8891bae878de66a75a28600e\", \"files\": {}}", + "dest": "cargo/vendor/typed-path-0.12.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/typenum/typenum-1.20.1.crate", + "sha256": "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20", + "dest": "cargo/vendor/typenum-1.20.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20\", \"files\": {}}", + "dest": "cargo/vendor/typenum-1.20.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/uds_windows/uds_windows-1.2.1.crate", + "sha256": "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e", + "dest": "cargo/vendor/uds_windows-1.2.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e\", \"files\": {}}", + "dest": "cargo/vendor/uds_windows-1.2.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ug/ug-0.5.0.crate", + "sha256": "76b761acf8af3494640d826a8609e2265e19778fb43306c7f15379c78c9b05b0", + "dest": "cargo/vendor/ug-0.5.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"76b761acf8af3494640d826a8609e2265e19778fb43306c7f15379c78c9b05b0\", \"files\": {}}", + "dest": "cargo/vendor/ug-0.5.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/ug-metal/ug-metal-0.5.0.crate", + "sha256": "9f7adf545a99a086d362efc739e7cf4317c18cbeda22706000fd434d70ea3d95", + "dest": "cargo/vendor/ug-metal-0.5.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"9f7adf545a99a086d362efc739e7cf4317c18cbeda22706000fd434d70ea3d95\", \"files\": {}}", + "dest": "cargo/vendor/ug-metal-0.5.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/unarray/unarray-0.1.4.crate", + "sha256": "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94", + "dest": "cargo/vendor/unarray-0.1.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94\", \"files\": {}}", + "dest": "cargo/vendor/unarray-0.1.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/unicode-bidi/unicode-bidi-0.3.18.crate", + "sha256": "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5", + "dest": "cargo/vendor/unicode-bidi-0.3.18" + }, + { + "type": "inline", + "contents": "{\"package\": \"5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5\", \"files\": {}}", + "dest": "cargo/vendor/unicode-bidi-0.3.18", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/unicode-general-category/unicode-general-category-1.1.0.crate", + "sha256": "0b993bddc193ae5bd0d623b49ec06ac3e9312875fdae725a975c51db1cc1677f", + "dest": "cargo/vendor/unicode-general-category-1.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"0b993bddc193ae5bd0d623b49ec06ac3e9312875fdae725a975c51db1cc1677f\", \"files\": {}}", + "dest": "cargo/vendor/unicode-general-category-1.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/unicode-ident/unicode-ident-1.0.26.crate", + "sha256": "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954", + "dest": "cargo/vendor/unicode-ident-1.0.26" + }, + { + "type": "inline", + "contents": "{\"package\": \"d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954\", \"files\": {}}", + "dest": "cargo/vendor/unicode-ident-1.0.26", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/unicode-properties/unicode-properties-0.1.4.crate", + "sha256": "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d", + "dest": "cargo/vendor/unicode-properties-0.1.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d\", \"files\": {}}", + "dest": "cargo/vendor/unicode-properties-0.1.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/unicode-segmentation/unicode-segmentation-1.13.3.crate", + "sha256": "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8", + "dest": "cargo/vendor/unicode-segmentation-1.13.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8\", \"files\": {}}", + "dest": "cargo/vendor/unicode-segmentation-1.13.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/unicode-width/unicode-width-0.2.2.crate", + "sha256": "b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254", + "dest": "cargo/vendor/unicode-width-0.2.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"b4ac048d71ede7ee76d585517add45da530660ef4390e49b098733c6e897f254\", \"files\": {}}", + "dest": "cargo/vendor/unicode-width-0.2.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/universal-hash/universal-hash-0.5.1.crate", + "sha256": "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea", + "dest": "cargo/vendor/universal-hash-0.5.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea\", \"files\": {}}", + "dest": "cargo/vendor/universal-hash-0.5.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/untrusted/untrusted-0.9.0.crate", + "sha256": "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1", + "dest": "cargo/vendor/untrusted-0.9.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1\", \"files\": {}}", + "dest": "cargo/vendor/untrusted-0.9.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/uuid/uuid-1.26.1.crate", + "sha256": "2ef6dac1e96601b4fb3acccccff2139741fcb757cb9a36089bf5be91cfb285ce", + "dest": "cargo/vendor/uuid-1.26.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"2ef6dac1e96601b4fb3acccccff2139741fcb757cb9a36089bf5be91cfb285ce\", \"files\": {}}", + "dest": "cargo/vendor/uuid-1.26.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/v_frame/v_frame-0.3.9.crate", + "sha256": "666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2", + "dest": "cargo/vendor/v_frame-0.3.9" + }, + { + "type": "inline", + "contents": "{\"package\": \"666b7727c8875d6ab5db9533418d7c764233ac9c0cff1d469aec8fa127597be2\", \"files\": {}}", + "dest": "cargo/vendor/v_frame-0.3.9", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/vello_common/vello_common-0.2.0.crate", + "sha256": "bbb2141a2bca6e6d598e471fd4d1d7eed8e020aad6a28187edda07f091a325dd", + "dest": "cargo/vendor/vello_common-0.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"bbb2141a2bca6e6d598e471fd4d1d7eed8e020aad6a28187edda07f091a325dd\", \"files\": {}}", + "dest": "cargo/vendor/vello_common-0.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/vello_cpu/vello_cpu-0.2.0.crate", + "sha256": "ace506ca414548966fcf3c283be94eb1cad8254de488791ee698bf438b0890a9", + "dest": "cargo/vendor/vello_cpu-0.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"ace506ca414548966fcf3c283be94eb1cad8254de488791ee698bf438b0890a9\", \"files\": {}}", + "dest": "cargo/vendor/vello_cpu-0.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/version_check/version_check-0.9.5.crate", + "sha256": "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a", + "dest": "cargo/vendor/version_check-0.9.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a\", \"files\": {}}", + "dest": "cargo/vendor/version_check-0.9.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wait-timeout/wait-timeout-0.2.1.crate", + "sha256": "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11", + "dest": "cargo/vendor/wait-timeout-0.2.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11\", \"files\": {}}", + "dest": "cargo/vendor/wait-timeout-0.2.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/walkdir/walkdir-2.5.0.crate", + "sha256": "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b", + "dest": "cargo/vendor/walkdir-2.5.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b\", \"files\": {}}", + "dest": "cargo/vendor/walkdir-2.5.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wasi/wasi-0.11.1+wasi-snapshot-preview1.crate", + "sha256": "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b", + "dest": "cargo/vendor/wasi-0.11.1+wasi-snapshot-preview1" + }, + { + "type": "inline", + "contents": "{\"package\": \"ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b\", \"files\": {}}", + "dest": "cargo/vendor/wasi-0.11.1+wasi-snapshot-preview1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wasip2/wasip2-1.0.4+wasi-0.2.12.crate", + "sha256": "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487", + "dest": "cargo/vendor/wasip2-1.0.4+wasi-0.2.12" + }, + { + "type": "inline", + "contents": "{\"package\": \"b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487\", \"files\": {}}", + "dest": "cargo/vendor/wasip2-1.0.4+wasi-0.2.12", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wasm-bindgen/wasm-bindgen-0.2.129.crate", + "sha256": "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409", + "dest": "cargo/vendor/wasm-bindgen-0.2.129" + }, + { + "type": "inline", + "contents": "{\"package\": \"9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409\", \"files\": {}}", + "dest": "cargo/vendor/wasm-bindgen-0.2.129", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wasm-bindgen-futures/wasm-bindgen-futures-0.4.79.crate", + "sha256": "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e", + "dest": "cargo/vendor/wasm-bindgen-futures-0.4.79" + }, + { + "type": "inline", + "contents": "{\"package\": \"3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e\", \"files\": {}}", + "dest": "cargo/vendor/wasm-bindgen-futures-0.4.79", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wasm-bindgen-macro/wasm-bindgen-macro-0.2.129.crate", + "sha256": "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535", + "dest": "cargo/vendor/wasm-bindgen-macro-0.2.129" + }, + { + "type": "inline", + "contents": "{\"package\": \"2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535\", \"files\": {}}", + "dest": "cargo/vendor/wasm-bindgen-macro-0.2.129", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wasm-bindgen-macro-support/wasm-bindgen-macro-support-0.2.129.crate", + "sha256": "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7", + "dest": "cargo/vendor/wasm-bindgen-macro-support-0.2.129" + }, + { + "type": "inline", + "contents": "{\"package\": \"6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7\", \"files\": {}}", + "dest": "cargo/vendor/wasm-bindgen-macro-support-0.2.129", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wasm-bindgen-shared/wasm-bindgen-shared-0.2.129.crate", + "sha256": "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6", + "dest": "cargo/vendor/wasm-bindgen-shared-0.2.129" + }, + { + "type": "inline", + "contents": "{\"package\": \"23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6\", \"files\": {}}", + "dest": "cargo/vendor/wasm-bindgen-shared-0.2.129", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wayland-backend/wayland-backend-0.3.17.crate", + "sha256": "38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078", + "dest": "cargo/vendor/wayland-backend-0.3.17" + }, + { + "type": "inline", + "contents": "{\"package\": \"38a91b4eaddff87b1cd1074985e3713da4af2c49742d1b356b2c01670a67a078\", \"files\": {}}", + "dest": "cargo/vendor/wayland-backend-0.3.17", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wayland-client/wayland-client-0.31.15.crate", + "sha256": "e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073", + "dest": "cargo/vendor/wayland-client-0.31.15" + }, + { + "type": "inline", + "contents": "{\"package\": \"e3c36a0f861ad76d0901f2800b46321410d9f73f2ea88aac0650d86c32688073\", \"files\": {}}", + "dest": "cargo/vendor/wayland-client-0.31.15", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wayland-csd-frame/wayland-csd-frame-0.3.0.crate", + "sha256": "625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e", + "dest": "cargo/vendor/wayland-csd-frame-0.3.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"625c5029dbd43d25e6aa9615e88b829a5cad13b2819c4ae129fdbb7c31ab4c7e\", \"files\": {}}", + "dest": "cargo/vendor/wayland-csd-frame-0.3.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wayland-cursor/wayland-cursor-0.31.14.crate", + "sha256": "4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d", + "dest": "cargo/vendor/wayland-cursor-0.31.14" + }, + { + "type": "inline", + "contents": "{\"package\": \"4a52d18780be9b1314328a3de5f930b73d2200112e3849ca6cb11822793fb34d\", \"files\": {}}", + "dest": "cargo/vendor/wayland-cursor-0.31.14", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wayland-protocols/wayland-protocols-0.32.13.crate", + "sha256": "23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6", + "dest": "cargo/vendor/wayland-protocols-0.32.13" + }, + { + "type": "inline", + "contents": "{\"package\": \"23d0c813de3daa2ed6520af85a3bd49b0e722a3078506899aa9686fea58dc4b6\", \"files\": {}}", + "dest": "cargo/vendor/wayland-protocols-0.32.13", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wayland-protocols-experimental/wayland-protocols-experimental-20250721.0.1.crate", + "sha256": "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1", + "dest": "cargo/vendor/wayland-protocols-experimental-20250721.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1\", \"files\": {}}", + "dest": "cargo/vendor/wayland-protocols-experimental-20250721.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wayland-protocols-misc/wayland-protocols-misc-0.3.12.crate", + "sha256": "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8", + "dest": "cargo/vendor/wayland-protocols-misc-0.3.12" + }, + { + "type": "inline", + "contents": "{\"package\": \"6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8\", \"files\": {}}", + "dest": "cargo/vendor/wayland-protocols-misc-0.3.12", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wayland-protocols-plasma/wayland-protocols-plasma-0.3.12.crate", + "sha256": "2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91", + "dest": "cargo/vendor/wayland-protocols-plasma-0.3.12" + }, + { + "type": "inline", + "contents": "{\"package\": \"2b6d8cf1eb2c1c31ed1f5643c88a6e53538129d4af80030c8cabd1f9fa884d91\", \"files\": {}}", + "dest": "cargo/vendor/wayland-protocols-plasma-0.3.12", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wayland-protocols-wlr/wayland-protocols-wlr-0.3.12.crate", + "sha256": "eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234", + "dest": "cargo/vendor/wayland-protocols-wlr-0.3.12" + }, + { + "type": "inline", + "contents": "{\"package\": \"eb04e52f7836d7c7976c78ca0250d61e33873c34156a2a1fc9474828ec268234\", \"files\": {}}", + "dest": "cargo/vendor/wayland-protocols-wlr-0.3.12", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wayland-scanner/wayland-scanner-0.31.11.crate", + "sha256": "338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0", + "dest": "cargo/vendor/wayland-scanner-0.31.11" + }, + { + "type": "inline", + "contents": "{\"package\": \"338e30461b3a2b67d70eb30a6d89f8e0c93a833e07d2ae89085cd070c4a00ac0\", \"files\": {}}", + "dest": "cargo/vendor/wayland-scanner-0.31.11", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wayland-sys/wayland-sys-0.31.11.crate", + "sha256": "d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be", + "dest": "cargo/vendor/wayland-sys-0.31.11" + }, + { + "type": "inline", + "contents": "{\"package\": \"d8eab23fefc9e41f8e841df4a9c707e8a8c4ed26e944ef69297184de2785e3be\", \"files\": {}}", + "dest": "cargo/vendor/wayland-sys-0.31.11", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/web-sys/web-sys-0.3.106.crate", + "sha256": "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4", + "dest": "cargo/vendor/web-sys-0.3.106" + }, + { + "type": "inline", + "contents": "{\"package\": \"88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4\", \"files\": {}}", + "dest": "cargo/vendor/web-sys-0.3.106", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/web-time/web-time-1.1.0.crate", + "sha256": "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb", + "dest": "cargo/vendor/web-time-1.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb\", \"files\": {}}", + "dest": "cargo/vendor/web-time-1.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/webpki-roots/webpki-roots-1.0.9.crate", + "sha256": "7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a", + "dest": "cargo/vendor/webpki-roots-1.0.9" + }, + { + "type": "inline", + "contents": "{\"package\": \"7dcd9d09a39985f5344844e66b0c530a33843579125f23e21e9f0f220850f22a\", \"files\": {}}", + "dest": "cargo/vendor/webpki-roots-1.0.9", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/weezl/weezl-0.1.12.crate", + "sha256": "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88", + "dest": "cargo/vendor/weezl-0.1.12" + }, + { + "type": "inline", + "contents": "{\"package\": \"a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88\", \"files\": {}}", + "dest": "cargo/vendor/weezl-0.1.12", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wgpu/wgpu-30.0.1.crate", + "sha256": "527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e", + "dest": "cargo/vendor/wgpu-30.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"527ccdf43dd5b2e8676eed9984ce00e2bbb0a1b85b70c1969dcb6cd2eb55ab9e\", \"files\": {}}", + "dest": "cargo/vendor/wgpu-30.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wgpu-core/wgpu-core-30.0.1.crate", + "sha256": "14c018fce9b6270aa203c2fdd56f3cce996713534bd757e4ea58c8560b121f14", + "dest": "cargo/vendor/wgpu-core-30.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"14c018fce9b6270aa203c2fdd56f3cce996713534bd757e4ea58c8560b121f14\", \"files\": {}}", + "dest": "cargo/vendor/wgpu-core-30.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wgpu-core-deps-apple/wgpu-core-deps-apple-30.0.1.crate", + "sha256": "061f3d319a40d39d00b1ecc2c33b89fe21d4e6fe01859df3500a3a8ecccd6b68", + "dest": "cargo/vendor/wgpu-core-deps-apple-30.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"061f3d319a40d39d00b1ecc2c33b89fe21d4e6fe01859df3500a3a8ecccd6b68\", \"files\": {}}", + "dest": "cargo/vendor/wgpu-core-deps-apple-30.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wgpu-core-deps-emscripten/wgpu-core-deps-emscripten-30.0.1.crate", + "sha256": "d98b86cf4abf524a902dd35f18ca6a3f08fc2ae9847c8f10b48e30491b1f0b86", + "dest": "cargo/vendor/wgpu-core-deps-emscripten-30.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"d98b86cf4abf524a902dd35f18ca6a3f08fc2ae9847c8f10b48e30491b1f0b86\", \"files\": {}}", + "dest": "cargo/vendor/wgpu-core-deps-emscripten-30.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wgpu-core-deps-wasm/wgpu-core-deps-wasm-30.0.1.crate", + "sha256": "d260ca2ca8adc654f513a869bf3cac0b47f5b8d3f87803d6942015f8de597aae", + "dest": "cargo/vendor/wgpu-core-deps-wasm-30.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"d260ca2ca8adc654f513a869bf3cac0b47f5b8d3f87803d6942015f8de597aae\", \"files\": {}}", + "dest": "cargo/vendor/wgpu-core-deps-wasm-30.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wgpu-core-deps-windows-linux-android/wgpu-core-deps-windows-linux-android-30.0.1.crate", + "sha256": "7586165fd5f6d881cb9ce4bb71f40d6caab2c0f1837e3fc1d9788a197fb6004f", + "dest": "cargo/vendor/wgpu-core-deps-windows-linux-android-30.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"7586165fd5f6d881cb9ce4bb71f40d6caab2c0f1837e3fc1d9788a197fb6004f\", \"files\": {}}", + "dest": "cargo/vendor/wgpu-core-deps-windows-linux-android-30.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wgpu-hal/wgpu-hal-30.0.1.crate", + "sha256": "b6b7fb58561a792bc237628ba0792e332de418fefe145f13b5ed8201e6d52f58", + "dest": "cargo/vendor/wgpu-hal-30.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"b6b7fb58561a792bc237628ba0792e332de418fefe145f13b5ed8201e6d52f58\", \"files\": {}}", + "dest": "cargo/vendor/wgpu-hal-30.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wgpu-naga-bridge/wgpu-naga-bridge-30.0.1.crate", + "sha256": "d2f62e73117bb7a62bfd9c5a5841438a823f6566c6442a808ee269d2d055c081", + "dest": "cargo/vendor/wgpu-naga-bridge-30.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"d2f62e73117bb7a62bfd9c5a5841438a823f6566c6442a808ee269d2d055c081\", \"files\": {}}", + "dest": "cargo/vendor/wgpu-naga-bridge-30.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wgpu-types/wgpu-types-30.0.1.crate", + "sha256": "99dad6f1fbdbbdb4c278a6508b059d44688f5cebddf78d005a46a31340269286", + "dest": "cargo/vendor/wgpu-types-30.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"99dad6f1fbdbbdb4c278a6508b059d44688f5cebddf78d005a46a31340269286\", \"files\": {}}", + "dest": "cargo/vendor/wgpu-types-30.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/winapi-util/winapi-util-0.1.11.crate", + "sha256": "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22", + "dest": "cargo/vendor/winapi-util-0.1.11" + }, + { + "type": "inline", + "contents": "{\"package\": \"c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22\", \"files\": {}}", + "dest": "cargo/vendor/winapi-util-0.1.11", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows/windows-0.62.2.crate", + "sha256": "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580", + "dest": "cargo/vendor/windows-0.62.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580\", \"files\": {}}", + "dest": "cargo/vendor/windows-0.62.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-collections/windows-collections-0.3.2.crate", + "sha256": "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610", + "dest": "cargo/vendor/windows-collections-0.3.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610\", \"files\": {}}", + "dest": "cargo/vendor/windows-collections-0.3.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-core/windows-core-0.62.2.crate", + "sha256": "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb", + "dest": "cargo/vendor/windows-core-0.62.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb\", \"files\": {}}", + "dest": "cargo/vendor/windows-core-0.62.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-future/windows-future-0.3.2.crate", + "sha256": "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb", + "dest": "cargo/vendor/windows-future-0.3.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb\", \"files\": {}}", + "dest": "cargo/vendor/windows-future-0.3.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-implement/windows-implement-0.60.2.crate", + "sha256": "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf", + "dest": "cargo/vendor/windows-implement-0.60.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf\", \"files\": {}}", + "dest": "cargo/vendor/windows-implement-0.60.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-interface/windows-interface-0.59.3.crate", + "sha256": "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358", + "dest": "cargo/vendor/windows-interface-0.59.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358\", \"files\": {}}", + "dest": "cargo/vendor/windows-interface-0.59.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-link/windows-link-0.2.1.crate", + "sha256": "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5", + "dest": "cargo/vendor/windows-link-0.2.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5\", \"files\": {}}", + "dest": "cargo/vendor/windows-link-0.2.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-numerics/windows-numerics-0.3.1.crate", + "sha256": "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26", + "dest": "cargo/vendor/windows-numerics-0.3.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26\", \"files\": {}}", + "dest": "cargo/vendor/windows-numerics-0.3.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-result/windows-result-0.4.1.crate", + "sha256": "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5", + "dest": "cargo/vendor/windows-result-0.4.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5\", \"files\": {}}", + "dest": "cargo/vendor/windows-result-0.4.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-strings/windows-strings-0.5.1.crate", + "sha256": "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091", + "dest": "cargo/vendor/windows-strings-0.5.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091\", \"files\": {}}", + "dest": "cargo/vendor/windows-strings-0.5.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-sys/windows-sys-0.52.0.crate", + "sha256": "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d", + "dest": "cargo/vendor/windows-sys-0.52.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d\", \"files\": {}}", + "dest": "cargo/vendor/windows-sys-0.52.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-sys/windows-sys-0.59.0.crate", + "sha256": "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b", + "dest": "cargo/vendor/windows-sys-0.59.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b\", \"files\": {}}", + "dest": "cargo/vendor/windows-sys-0.59.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-sys/windows-sys-0.60.2.crate", + "sha256": "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb", + "dest": "cargo/vendor/windows-sys-0.60.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb\", \"files\": {}}", + "dest": "cargo/vendor/windows-sys-0.60.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-sys/windows-sys-0.61.2.crate", + "sha256": "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc", + "dest": "cargo/vendor/windows-sys-0.61.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc\", \"files\": {}}", + "dest": "cargo/vendor/windows-sys-0.61.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-targets/windows-targets-0.52.6.crate", + "sha256": "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973", + "dest": "cargo/vendor/windows-targets-0.52.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973\", \"files\": {}}", + "dest": "cargo/vendor/windows-targets-0.52.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-targets/windows-targets-0.53.5.crate", + "sha256": "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3", + "dest": "cargo/vendor/windows-targets-0.53.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3\", \"files\": {}}", + "dest": "cargo/vendor/windows-targets-0.53.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows-threading/windows-threading-0.2.1.crate", + "sha256": "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37", + "dest": "cargo/vendor/windows-threading-0.2.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37\", \"files\": {}}", + "dest": "cargo/vendor/windows-threading-0.2.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_aarch64_gnullvm/windows_aarch64_gnullvm-0.52.6.crate", + "sha256": "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3", + "dest": "cargo/vendor/windows_aarch64_gnullvm-0.52.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3\", \"files\": {}}", + "dest": "cargo/vendor/windows_aarch64_gnullvm-0.52.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_aarch64_gnullvm/windows_aarch64_gnullvm-0.53.1.crate", + "sha256": "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53", + "dest": "cargo/vendor/windows_aarch64_gnullvm-0.53.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53\", \"files\": {}}", + "dest": "cargo/vendor/windows_aarch64_gnullvm-0.53.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_aarch64_msvc/windows_aarch64_msvc-0.52.6.crate", + "sha256": "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469", + "dest": "cargo/vendor/windows_aarch64_msvc-0.52.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469\", \"files\": {}}", + "dest": "cargo/vendor/windows_aarch64_msvc-0.52.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_aarch64_msvc/windows_aarch64_msvc-0.53.1.crate", + "sha256": "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006", + "dest": "cargo/vendor/windows_aarch64_msvc-0.53.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006\", \"files\": {}}", + "dest": "cargo/vendor/windows_aarch64_msvc-0.53.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_i686_gnu/windows_i686_gnu-0.52.6.crate", + "sha256": "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b", + "dest": "cargo/vendor/windows_i686_gnu-0.52.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b\", \"files\": {}}", + "dest": "cargo/vendor/windows_i686_gnu-0.52.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_i686_gnu/windows_i686_gnu-0.53.1.crate", + "sha256": "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3", + "dest": "cargo/vendor/windows_i686_gnu-0.53.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3\", \"files\": {}}", + "dest": "cargo/vendor/windows_i686_gnu-0.53.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_i686_gnullvm/windows_i686_gnullvm-0.52.6.crate", + "sha256": "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66", + "dest": "cargo/vendor/windows_i686_gnullvm-0.52.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66\", \"files\": {}}", + "dest": "cargo/vendor/windows_i686_gnullvm-0.52.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_i686_gnullvm/windows_i686_gnullvm-0.53.1.crate", + "sha256": "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c", + "dest": "cargo/vendor/windows_i686_gnullvm-0.53.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c\", \"files\": {}}", + "dest": "cargo/vendor/windows_i686_gnullvm-0.53.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_i686_msvc/windows_i686_msvc-0.52.6.crate", + "sha256": "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66", + "dest": "cargo/vendor/windows_i686_msvc-0.52.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66\", \"files\": {}}", + "dest": "cargo/vendor/windows_i686_msvc-0.52.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_i686_msvc/windows_i686_msvc-0.53.1.crate", + "sha256": "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2", + "dest": "cargo/vendor/windows_i686_msvc-0.53.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2\", \"files\": {}}", + "dest": "cargo/vendor/windows_i686_msvc-0.53.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_x86_64_gnu/windows_x86_64_gnu-0.52.6.crate", + "sha256": "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78", + "dest": "cargo/vendor/windows_x86_64_gnu-0.52.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78\", \"files\": {}}", + "dest": "cargo/vendor/windows_x86_64_gnu-0.52.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_x86_64_gnu/windows_x86_64_gnu-0.53.1.crate", + "sha256": "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499", + "dest": "cargo/vendor/windows_x86_64_gnu-0.53.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499\", \"files\": {}}", + "dest": "cargo/vendor/windows_x86_64_gnu-0.53.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_x86_64_gnullvm/windows_x86_64_gnullvm-0.52.6.crate", + "sha256": "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d", + "dest": "cargo/vendor/windows_x86_64_gnullvm-0.52.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d\", \"files\": {}}", + "dest": "cargo/vendor/windows_x86_64_gnullvm-0.52.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_x86_64_gnullvm/windows_x86_64_gnullvm-0.53.1.crate", + "sha256": "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1", + "dest": "cargo/vendor/windows_x86_64_gnullvm-0.53.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1\", \"files\": {}}", + "dest": "cargo/vendor/windows_x86_64_gnullvm-0.53.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_x86_64_msvc/windows_x86_64_msvc-0.52.6.crate", + "sha256": "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec", + "dest": "cargo/vendor/windows_x86_64_msvc-0.52.6" + }, + { + "type": "inline", + "contents": "{\"package\": \"589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec\", \"files\": {}}", + "dest": "cargo/vendor/windows_x86_64_msvc-0.52.6", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/windows_x86_64_msvc/windows_x86_64_msvc-0.53.1.crate", + "sha256": "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650", + "dest": "cargo/vendor/windows_x86_64_msvc-0.53.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650\", \"files\": {}}", + "dest": "cargo/vendor/windows_x86_64_msvc-0.53.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/winit-a517b38/.\" \"cargo/vendor/winit\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"winit\"\nversion = \"0.30.13\"\nauthors = [\"The winit contributors\", \"Pierre Krieger \"]\ndescription = \"Cross-platform window creation library.\"\nkeywords = [\"windowing\"]\nreadme = \"README.md\"\ndocumentation = \"https://docs.rs/winit\"\ncategories = [\"gui\"]\nrust-version = \"1.70.0\"\nrepository = \"https://github.com/rust-windowing/winit\"\nlicense = \"Apache-2.0\"\nedition = \"2021\"\ninclude = [\"/build.rs\", \"/docs\", \"/examples\", \"/FEATURES.md\", \"/LICENSE\", \"/src\", \"!/src/platform_impl/web/script\", \"/src/platform_impl/web/script/**/*.min.js\", \"/tests\"]\n\n[package.metadata.docs.rs]\nfeatures = [\"rwh_04\", \"rwh_05\", \"rwh_06\", \"serde\", \"mint\", \"android-native-activity\"]\ntargets = [\"i686-pc-windows-msvc\", \"x86_64-pc-windows-msvc\", \"x86_64-apple-darwin\", \"i686-unknown-linux-gnu\", \"x86_64-unknown-linux-gnu\", \"x86_64-apple-ios\", \"aarch64-linux-android\", \"wasm32-unknown-unknown\"]\nrustdoc-args = [\"--cfg\", \"docsrs\"]\n\n[features]\ndefault = [\"rwh_06\", \"x11\", \"wayland\", \"wayland-dlopen\", \"wayland-csd-adwaita\"]\nx11 = [\"x11-dl\", \"bytemuck\", \"percent-encoding\", \"xkbcommon-dl/x11\", \"x11rb\"]\nwayland = [\"wayland-client\", \"wayland-backend\", \"wayland-protocols\", \"wayland-protocols-plasma\", \"sctk\", \"ahash\", \"memmap2\", \"percent-encoding\"]\nwayland-dlopen = [\"wayland-backend/dlopen\"]\nwayland-csd-adwaita = [\"sctk-adwaita\", \"sctk-adwaita/ab_glyph\"]\nwayland-csd-adwaita-crossfont = [\"sctk-adwaita\", \"sctk-adwaita/crossfont\"]\nwayland-csd-adwaita-notitle = [\"sctk-adwaita\"]\nandroid-native-activity = [\"android-activity/native-activity\"]\nandroid-game-activity = [\"android-activity/game-activity\"]\nserde = [\"dep:serde\", \"cursor-icon/serde\", \"smol_str/serde\", \"dpi/serde\"]\nmint = [\"dpi/mint\"]\nrwh_04 = [\"dep:rwh_04\", \"ndk/rwh_04\"]\nrwh_05 = [\"dep:rwh_05\", \"ndk/rwh_05\"]\nrwh_06 = [\"dep:rwh_06\", \"ndk/rwh_06\"]\n\n[build-dependencies]\ncfg_aliases = \"0.2.1\"\n\n[dependencies]\nbitflags = \"2\"\ncursor-icon = \"1.1.0\"\ndpi = \"0.1.1\"\nsmol_str = \"0.2.0\"\n\n[dependencies.rwh_04]\npackage = \"raw-window-handle\"\nversion = \"0.4\"\noptional = true\n\n[dependencies.rwh_05]\npackage = \"raw-window-handle\"\nversion = \"0.5.2\"\nfeatures = [\"std\"]\noptional = true\n\n[dependencies.rwh_06]\npackage = \"raw-window-handle\"\nversion = \"0.6\"\nfeatures = [\"std\"]\noptional = true\n\n[dependencies.serde]\noptional = true\nversion = \"1\"\nfeatures = [\"serde_derive\"]\n\n[dependencies.tracing]\nversion = \"0.1.40\"\ndefault-features = false\n\n[dev-dependencies.image]\nversion = \"0.25.0\"\ndefault-features = false\nfeatures = [\"png\"]\n\n[dev-dependencies.tracing]\nversion = \"0.1.40\"\ndefault-features = false\nfeatures = [\"log\"]\n\n[dev-dependencies.tracing-subscriber]\nversion = \"0.3.18\"\nfeatures = [\"env-filter\"]\n\n[dev-dependencies.winit]\npath = \".\"\nfeatures = [\"rwh_05\"]\n\n[target.\"cfg(not(any(target_os = \\\"android\\\", target_os = \\\"ios\\\")))\".dev-dependencies.softbuffer]\nversion = \"0.4.0\"\ndefault-features = false\nfeatures = [\"x11\", \"x11-dlopen\", \"wayland\", \"wayland-dlopen\"]\n\n[target.\"cfg(target_os = \\\"android\\\")\".dependencies]\nandroid-activity = \"0.6.0\"\n\n[target.\"cfg(target_os = \\\"android\\\")\".dependencies.ndk]\nversion = \"0.9.0\"\ndefault-features = false\n\n[target.\"cfg(any(target_os = \\\"ios\\\", target_os = \\\"macos\\\"))\".dependencies]\nblock2 = \"0.5.1\"\ncore-foundation = \"0.9.3\"\n\n[target.\"cfg(any(target_os = \\\"ios\\\", target_os = \\\"macos\\\"))\".dependencies.objc2]\nversion = \"0.5.2\"\nfeatures = [\"relax-sign-encoding\"]\n\n[target.\"cfg(target_os = \\\"macos\\\")\".dependencies]\ncore-graphics = \"0.23.1\"\n\n[target.\"cfg(target_os = \\\"macos\\\")\".dependencies.objc2-foundation]\nversion = \"0.2.2\"\nfeatures = [\"block2\", \"dispatch\", \"NSArray\", \"NSAttributedString\", \"NSData\", \"NSDictionary\", \"NSDistributedNotificationCenter\", \"NSEnumerator\", \"NSKeyValueObserving\", \"NSNotification\", \"NSObjCRuntime\", \"NSPathUtilities\", \"NSProcessInfo\", \"NSRunLoop\", \"NSString\", \"NSThread\", \"NSValue\"]\n\n[target.\"cfg(target_os = \\\"macos\\\")\".dependencies.objc2-app-kit]\nversion = \"0.2.2\"\nfeatures = [\"NSAppearance\", \"NSApplication\", \"NSBitmapImageRep\", \"NSButton\", \"NSColor\", \"NSControl\", \"NSCursor\", \"NSDragging\", \"NSEvent\", \"NSGraphics\", \"NSGraphicsContext\", \"NSImage\", \"NSImageRep\", \"NSMenu\", \"NSMenuItem\", \"NSOpenGLView\", \"NSPasteboard\", \"NSResponder\", \"NSRunningApplication\", \"NSScreen\", \"NSTextInputClient\", \"NSTextInputContext\", \"NSView\", \"NSWindow\", \"NSWindowScripting\", \"NSWindowTabGroup\"]\n\n[target.\"cfg(target_os = \\\"ios\\\")\".dependencies.objc2-foundation]\nversion = \"0.2.2\"\nfeatures = [\"block2\", \"dispatch\", \"NSArray\", \"NSEnumerator\", \"NSGeometry\", \"NSObjCRuntime\", \"NSOperation\", \"NSString\", \"NSProcessInfo\", \"NSThread\", \"NSSet\"]\n\n[target.\"cfg(target_os = \\\"ios\\\")\".dependencies.objc2-ui-kit]\nversion = \"0.2.2\"\nfeatures = [\"UIApplication\", \"UIDevice\", \"UIEvent\", \"UIGeometry\", \"UIGestureRecognizer\", \"UITextInput\", \"UITextInputTraits\", \"UIOrientation\", \"UIPanGestureRecognizer\", \"UIPinchGestureRecognizer\", \"UIResponder\", \"UIRotationGestureRecognizer\", \"UIScreen\", \"UIScreenMode\", \"UITapGestureRecognizer\", \"UITouch\", \"UITraitCollection\", \"UIView\", \"UIViewController\", \"UIWindow\"]\n\n[target.\"cfg(target_os = \\\"windows\\\")\".dependencies]\nunicode-segmentation = \"1.7.1\"\n\n[target.\"cfg(target_os = \\\"windows\\\")\".dependencies.windows-sys]\nversion = \"0.52.0\"\nfeatures = [\"Win32_Devices_HumanInterfaceDevice\", \"Win32_Foundation\", \"Win32_Globalization\", \"Win32_Graphics_Dwm\", \"Win32_Graphics_Gdi\", \"Win32_Media\", \"Win32_System_Com_StructuredStorage\", \"Win32_System_Com\", \"Win32_System_LibraryLoader\", \"Win32_System_Ole\", \"Win32_Security\", \"Win32_System_SystemInformation\", \"Win32_System_SystemServices\", \"Win32_System_Threading\", \"Win32_System_WindowsProgramming\", \"Win32_UI_Accessibility\", \"Win32_UI_Controls\", \"Win32_UI_HiDpi\", \"Win32_UI_Input_Ime\", \"Win32_UI_Input_KeyboardAndMouse\", \"Win32_UI_Input_Pointer\", \"Win32_UI_Input_Touch\", \"Win32_UI_Shell\", \"Win32_UI_TextServices\", \"Win32_UI_WindowsAndMessaging\"]\n\n[target.\"cfg(all(unix, not(any(target_os = \\\"redox\\\", target_family = \\\"wasm\\\", target_os = \\\"android\\\", target_os = \\\"ios\\\", target_os = \\\"macos\\\"))))\".dependencies]\ncalloop = \"0.13.0\"\nlibc = \"0.2.64\"\nxkbcommon-dl = \"0.4.2\"\n\n[target.\"cfg(all(unix, not(any(target_os = \\\"redox\\\", target_family = \\\"wasm\\\", target_os = \\\"android\\\", target_os = \\\"ios\\\", target_os = \\\"macos\\\"))))\".dependencies.ahash]\nversion = \"0.8.7\"\nfeatures = [\"no-rng\"]\noptional = true\n\n[target.\"cfg(all(unix, not(any(target_os = \\\"redox\\\", target_family = \\\"wasm\\\", target_os = \\\"android\\\", target_os = \\\"ios\\\", target_os = \\\"macos\\\"))))\".dependencies.bytemuck]\nversion = \"1.13.1\"\ndefault-features = false\noptional = true\n\n[target.\"cfg(all(unix, not(any(target_os = \\\"redox\\\", target_family = \\\"wasm\\\", target_os = \\\"android\\\", target_os = \\\"ios\\\", target_os = \\\"macos\\\"))))\".dependencies.memmap2]\nversion = \"0.9.0\"\noptional = true\n\n[target.\"cfg(all(unix, not(any(target_os = \\\"redox\\\", target_family = \\\"wasm\\\", target_os = \\\"android\\\", target_os = \\\"ios\\\", target_os = \\\"macos\\\"))))\".dependencies.percent-encoding]\nversion = \"2.0\"\noptional = true\n\n[target.\"cfg(all(unix, not(any(target_os = \\\"redox\\\", target_family = \\\"wasm\\\", target_os = \\\"android\\\", target_os = \\\"ios\\\", target_os = \\\"macos\\\"))))\".dependencies.rustix]\nversion = \"0.38.4\"\ndefault-features = false\nfeatures = [\"std\", \"system\", \"thread\", \"process\", \"event\", \"fs\", \"pipe\"]\n\n[target.\"cfg(all(unix, not(any(target_os = \\\"redox\\\", target_family = \\\"wasm\\\", target_os = \\\"android\\\", target_os = \\\"ios\\\", target_os = \\\"macos\\\"))))\".dependencies.sctk]\npackage = \"smithay-client-toolkit\"\nversion = \"0.19.2\"\ndefault-features = false\nfeatures = [\"calloop\"]\noptional = true\n\n[target.\"cfg(all(unix, not(any(target_os = \\\"redox\\\", target_family = \\\"wasm\\\", target_os = \\\"android\\\", target_os = \\\"ios\\\", target_os = \\\"macos\\\"))))\".dependencies.sctk-adwaita]\nversion = \"0.10.1\"\ndefault-features = false\noptional = true\n\n[target.\"cfg(all(unix, not(any(target_os = \\\"redox\\\", target_family = \\\"wasm\\\", target_os = \\\"android\\\", target_os = \\\"ios\\\", target_os = \\\"macos\\\"))))\".dependencies.wayland-backend]\nversion = \"0.3.10\"\ndefault-features = false\nfeatures = [\"client_system\"]\noptional = true\n\n[target.\"cfg(all(unix, not(any(target_os = \\\"redox\\\", target_family = \\\"wasm\\\", target_os = \\\"android\\\", target_os = \\\"ios\\\", target_os = \\\"macos\\\"))))\".dependencies.wayland-client]\nversion = \"0.31.10\"\noptional = true\n\n[target.\"cfg(all(unix, not(any(target_os = \\\"redox\\\", target_family = \\\"wasm\\\", target_os = \\\"android\\\", target_os = \\\"ios\\\", target_os = \\\"macos\\\"))))\".dependencies.wayland-protocols]\nversion = \"0.32.8\"\nfeatures = [\"staging\"]\noptional = true\n\n[target.\"cfg(all(unix, not(any(target_os = \\\"redox\\\", target_family = \\\"wasm\\\", target_os = \\\"android\\\", target_os = \\\"ios\\\", target_os = \\\"macos\\\"))))\".dependencies.wayland-protocols-plasma]\nversion = \"0.3.8\"\nfeatures = [\"client\"]\noptional = true\n\n[target.\"cfg(all(unix, not(any(target_os = \\\"redox\\\", target_family = \\\"wasm\\\", target_os = \\\"android\\\", target_os = \\\"ios\\\", target_os = \\\"macos\\\"))))\".dependencies.x11-dl]\nversion = \"2.19.1\"\noptional = true\n\n[target.\"cfg(all(unix, not(any(target_os = \\\"redox\\\", target_family = \\\"wasm\\\", target_os = \\\"android\\\", target_os = \\\"ios\\\", target_os = \\\"macos\\\"))))\".dependencies.x11rb]\nversion = \"0.13.0\"\ndefault-features = false\nfeatures = [\"allow-unsafe-code\", \"dl-libxcb\", \"randr\", \"resource_manager\", \"xinput\", \"xkb\"]\noptional = true\n\n[target.\"cfg(target_os = \\\"redox\\\")\".dependencies]\nredox_syscall = \"0.4.1\"\n\n[target.\"cfg(target_os = \\\"redox\\\")\".dependencies.orbclient]\nversion = \"0.3.47\"\ndefault-features = false\n\n[target.\"cfg(target_family = \\\"wasm\\\")\".dependencies]\njs-sys = \"0.3.70\"\npin-project = \"1\"\nwasm-bindgen = \"0.2.93\"\nwasm-bindgen-futures = \"0.4.43\"\nweb-time = \"1\"\n\n[target.\"cfg(target_family = \\\"wasm\\\")\".dependencies.web_sys]\npackage = \"web-sys\"\nversion = \"0.3.70\"\nfeatures = [\"AbortController\", \"AbortSignal\", \"Blob\", \"BlobPropertyBag\", \"console\", \"CssStyleDeclaration\", \"Document\", \"DomException\", \"DomRect\", \"DomRectReadOnly\", \"Element\", \"Event\", \"EventTarget\", \"FocusEvent\", \"HtmlCanvasElement\", \"HtmlElement\", \"HtmlImageElement\", \"ImageBitmap\", \"ImageBitmapOptions\", \"ImageBitmapRenderingContext\", \"ImageData\", \"IntersectionObserver\", \"IntersectionObserverEntry\", \"KeyboardEvent\", \"MediaQueryList\", \"MessageChannel\", \"MessagePort\", \"Navigator\", \"Node\", \"OrientationLockType\", \"OrientationType\", \"PageTransitionEvent\", \"Permissions\", \"PermissionState\", \"PermissionStatus\", \"PointerEvent\", \"PremultiplyAlpha\", \"ResizeObserver\", \"ResizeObserverBoxOptions\", \"ResizeObserverEntry\", \"ResizeObserverOptions\", \"ResizeObserverSize\", \"Screen\", \"ScreenOrientation\", \"Url\", \"VisibilityState\", \"WheelEvent\", \"Window\", \"Worker\"]\n\n[target.\"cfg(target_family = \\\"wasm\\\")\".dev-dependencies]\nconsole_error_panic_hook = \"0.1\"\ntracing-web = \"0.1\"\n\n[target.\"cfg(all(target_family = \\\"wasm\\\", target_feature = \\\"atomics\\\"))\".dependencies]\natomic-waker = \"1\"\n\n[target.\"cfg(all(target_family = \\\"wasm\\\", target_feature = \\\"atomics\\\"))\".dependencies.concurrent-queue]\nversion = \"2\"\ndefault-features = false\n\n[[example]]\ndoc-scrape-examples = true\nname = \"window\"\n\n[workspace]\nresolver = \"2\"\nmembers = [\"dpi\"]\n\n[workspace.package]\nrust-version = \"1.70.0\"\nrepository = \"https://github.com/rust-windowing/winit\"\nlicense = \"Apache-2.0\"\nedition = \"2021\"\n\n[workspace.dependencies]\nmint = \"0.5.6\"\n\n[workspace.dependencies.serde]\nversion = \"1\"\nfeatures = [\"serde_derive\"]\n\n[[test]]\nname = \"macos_termination\"\npath = \"tests/macos_termination.rs\"\nharness = false\n\n[[test]]\nname = \"ime_reset_dispatch\"\npath = \"tests/ime_reset_dispatch.rs\"\nharness = false\n", + "dest": "cargo/vendor/winit", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/winit", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/winnow/winnow-1.0.4.crate", + "sha256": "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81", + "dest": "cargo/vendor/winnow-1.0.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81\", \"files\": {}}", + "dest": "cargo/vendor/winnow-1.0.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/winresource/winresource-0.1.31.crate", + "sha256": "0986a8b1d586b7d3e4fe3d9ea39fb451ae22869dcea4aa109d287a374d866087", + "dest": "cargo/vendor/winresource-0.1.31" + }, + { + "type": "inline", + "contents": "{\"package\": \"0986a8b1d586b7d3e4fe3d9ea39fb451ae22869dcea4aa109d287a374d866087\", \"files\": {}}", + "dest": "cargo/vendor/winresource-0.1.31", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wit-bindgen/wit-bindgen-0.57.1.crate", + "sha256": "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e", + "dest": "cargo/vendor/wit-bindgen-0.57.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e\", \"files\": {}}", + "dest": "cargo/vendor/wit-bindgen-0.57.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/wl-clipboard-rs/wl-clipboard-rs-0.9.4.crate", + "sha256": "4d7888ccd4896447b2d14d3a9350a85df2aeb6f181e2e7a31349d104ac46cac1", + "dest": "cargo/vendor/wl-clipboard-rs-0.9.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"4d7888ccd4896447b2d14d3a9350a85df2aeb6f181e2e7a31349d104ac46cac1\", \"files\": {}}", + "dest": "cargo/vendor/wl-clipboard-rs-0.9.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/x11-dl/x11-dl-2.21.0.crate", + "sha256": "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f", + "dest": "cargo/vendor/x11-dl-2.21.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f\", \"files\": {}}", + "dest": "cargo/vendor/x11-dl-2.21.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/x11rb/x11rb-0.13.2.crate", + "sha256": "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414", + "dest": "cargo/vendor/x11rb-0.13.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414\", \"files\": {}}", + "dest": "cargo/vendor/x11rb-0.13.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/x11rb-protocol/x11rb-protocol-0.13.2.crate", + "sha256": "ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd", + "dest": "cargo/vendor/x11rb-protocol-0.13.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"ea6fc2961e4ef194dcbfe56bb845534d0dc8098940c7e5c012a258bfec6701bd\", \"files\": {}}", + "dest": "cargo/vendor/x11rb-protocol-0.13.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/x25519-dalek/x25519-dalek-2.0.1.crate", + "sha256": "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277", + "dest": "cargo/vendor/x25519-dalek-2.0.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277\", \"files\": {}}", + "dest": "cargo/vendor/x25519-dalek-2.0.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/xcursor/xcursor-0.3.11.crate", + "sha256": "163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23", + "dest": "cargo/vendor/xcursor-0.3.11" + }, + { + "type": "inline", + "contents": "{\"package\": \"163b33ed8786455e2fa5d72f554057ce3f3182425434f756cd39c99839d88e23\", \"files\": {}}", + "dest": "cargo/vendor/xcursor-0.3.11", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/xkbcommon-dl/xkbcommon-dl-0.4.2.crate", + "sha256": "d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5", + "dest": "cargo/vendor/xkbcommon-dl-0.4.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"d039de8032a9a8856a6be89cea3e5d12fdd82306ab7c94d74e6deab2460651c5\", \"files\": {}}", + "dest": "cargo/vendor/xkbcommon-dl-0.4.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/xkeysym/xkeysym-0.2.1.crate", + "sha256": "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56", + "dest": "cargo/vendor/xkeysym-0.2.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56\", \"files\": {}}", + "dest": "cargo/vendor/xkeysym-0.2.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/xml-rs/xml-rs-0.8.29.crate", + "sha256": "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7", + "dest": "cargo/vendor/xml-rs-0.8.29" + }, + { + "type": "inline", + "contents": "{\"package\": \"e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7\", \"files\": {}}", + "dest": "cargo/vendor/xml-rs-0.8.29", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/y4m/y4m-0.8.0.crate", + "sha256": "7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448", + "dest": "cargo/vendor/y4m-0.8.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"7a5a4b21e1a62b67a2970e6831bc091d7b87e119e7f9791aef9702e3bef04448\", \"files\": {}}", + "dest": "cargo/vendor/y4m-0.8.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/yoke/yoke-0.7.5.crate", + "sha256": "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40", + "dest": "cargo/vendor/yoke-0.7.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40\", \"files\": {}}", + "dest": "cargo/vendor/yoke-0.7.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/yoke/yoke-0.8.3.crate", + "sha256": "709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5", + "dest": "cargo/vendor/yoke-0.8.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"709fe23a0424b6a435d82152b1bd3fdfb0833487d5fa90d05d42762a9891fef5\", \"files\": {}}", + "dest": "cargo/vendor/yoke-0.8.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/yoke-derive/yoke-derive-0.7.5.crate", + "sha256": "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154", + "dest": "cargo/vendor/yoke-derive-0.7.5" + }, + { + "type": "inline", + "contents": "{\"package\": \"2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154\", \"files\": {}}", + "dest": "cargo/vendor/yoke-derive-0.7.5", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/yoke-derive/yoke-derive-0.8.4.crate", + "sha256": "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71", + "dest": "cargo/vendor/yoke-derive-0.8.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71\", \"files\": {}}", + "dest": "cargo/vendor/yoke-derive-0.8.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zbus/zbus-5.19.0.crate", + "sha256": "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907", + "dest": "cargo/vendor/zbus-5.19.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907\", \"files\": {}}", + "dest": "cargo/vendor/zbus-5.19.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zbus-lockstep/zbus-lockstep-0.5.2.crate", + "sha256": "6998de05217a084b7578728a9443d04ea4cd80f2a0839b8d78770b76ccd45863", + "dest": "cargo/vendor/zbus-lockstep-0.5.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"6998de05217a084b7578728a9443d04ea4cd80f2a0839b8d78770b76ccd45863\", \"files\": {}}", + "dest": "cargo/vendor/zbus-lockstep-0.5.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zbus-lockstep-macros/zbus-lockstep-macros-0.5.2.crate", + "sha256": "10da05367f3a7b7553c8cdf8fa91aee6b64afebe32b51c95177957efc47ca3a0", + "dest": "cargo/vendor/zbus-lockstep-macros-0.5.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"10da05367f3a7b7553c8cdf8fa91aee6b64afebe32b51c95177957efc47ca3a0\", \"files\": {}}", + "dest": "cargo/vendor/zbus-lockstep-macros-0.5.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zbus_macros/zbus_macros-5.19.0.crate", + "sha256": "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40", + "dest": "cargo/vendor/zbus_macros-5.19.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40\", \"files\": {}}", + "dest": "cargo/vendor/zbus_macros-5.19.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zbus_names/zbus_names-4.3.4.crate", + "sha256": "d8bf88b4a3ff53e883001e0e0115b297a9d53c31b9c1edd2bfdd853e3428624e", + "dest": "cargo/vendor/zbus_names-4.3.4" + }, + { + "type": "inline", + "contents": "{\"package\": \"d8bf88b4a3ff53e883001e0e0115b297a9d53c31b9c1edd2bfdd853e3428624e\", \"files\": {}}", + "dest": "cargo/vendor/zbus_names-4.3.4", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zbus_xml/zbus_xml-5.2.1.crate", + "sha256": "d1586c021a01ca0a9216dcd874e546382e156a5cbab5fab6cb5f10087e22682a", + "dest": "cargo/vendor/zbus_xml-5.2.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"d1586c021a01ca0a9216dcd874e546382e156a5cbab5fab6cb5f10087e22682a\", \"files\": {}}", + "dest": "cargo/vendor/zbus_xml-5.2.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zcheapstr/zcheapstr-1.1.0.crate", + "sha256": "d1afec51604565183aeb5c54c20aeab286120d4e4460f7f76e3e8bb8c0d99473", + "dest": "cargo/vendor/zcheapstr-1.1.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"d1afec51604565183aeb5c54c20aeab286120d4e4460f7f76e3e8bb8c0d99473\", \"files\": {}}", + "dest": "cargo/vendor/zcheapstr-1.1.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zerocopy/zerocopy-0.8.59.crate", + "sha256": "6df92bf3d9227be3d53173901ddbffac2babc27ae50f397776ffd6dc33f800cb", + "dest": "cargo/vendor/zerocopy-0.8.59" + }, + { + "type": "inline", + "contents": "{\"package\": \"6df92bf3d9227be3d53173901ddbffac2babc27ae50f397776ffd6dc33f800cb\", \"files\": {}}", + "dest": "cargo/vendor/zerocopy-0.8.59", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zerocopy-derive/zerocopy-derive-0.8.59.crate", + "sha256": "ac4f328cf2f05d084e496c3e9c3f33ed0a183656a16e1fcec4d464d8373aec82", + "dest": "cargo/vendor/zerocopy-derive-0.8.59" + }, + { + "type": "inline", + "contents": "{\"package\": \"ac4f328cf2f05d084e496c3e9c3f33ed0a183656a16e1fcec4d464d8373aec82\", \"files\": {}}", + "dest": "cargo/vendor/zerocopy-derive-0.8.59", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zerofrom/zerofrom-0.1.8.crate", + "sha256": "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272", + "dest": "cargo/vendor/zerofrom-0.1.8" + }, + { + "type": "inline", + "contents": "{\"package\": \"0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272\", \"files\": {}}", + "dest": "cargo/vendor/zerofrom-0.1.8", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zerofrom-derive/zerofrom-derive-0.1.8.crate", + "sha256": "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a", + "dest": "cargo/vendor/zerofrom-derive-0.1.8" + }, + { + "type": "inline", + "contents": "{\"package\": \"f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a\", \"files\": {}}", + "dest": "cargo/vendor/zerofrom-derive-0.1.8", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zeroize/zeroize-1.9.1.crate", + "sha256": "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879", + "dest": "cargo/vendor/zeroize-1.9.1" + }, + { + "type": "inline", + "contents": "{\"package\": \"e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879\", \"files\": {}}", + "dest": "cargo/vendor/zeroize-1.9.1", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zeroize_derive/zeroize_derive-1.5.0.crate", + "sha256": "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328", + "dest": "cargo/vendor/zeroize_derive-1.5.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328\", \"files\": {}}", + "dest": "cargo/vendor/zeroize_derive-1.5.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zip/zip-7.2.0.crate", + "sha256": "c42e33efc22a0650c311c2ef19115ce232583abbe80850bc8b66509ebef02de0", + "dest": "cargo/vendor/zip-7.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"c42e33efc22a0650c311c2ef19115ce232583abbe80850bc8b66509ebef02de0\", \"files\": {}}", + "dest": "cargo/vendor/zip-7.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zlib-rs/zlib-rs-0.6.8.crate", + "sha256": "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112", + "dest": "cargo/vendor/zlib-rs-0.6.8" + }, + { + "type": "inline", + "contents": "{\"package\": \"b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112\", \"files\": {}}", + "dest": "cargo/vendor/zlib-rs-0.6.8", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zmij/zmij-1.0.23.crate", + "sha256": "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b", + "dest": "cargo/vendor/zmij-1.0.23" + }, + { + "type": "inline", + "contents": "{\"package\": \"29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b\", \"files\": {}}", + "dest": "cargo/vendor/zmij-1.0.23", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zune-core/zune-core-0.5.3.crate", + "sha256": "d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b", + "dest": "cargo/vendor/zune-core-0.5.3" + }, + { + "type": "inline", + "contents": "{\"package\": \"d56377fd46368984a170bc5aac5567e52ca5da874caa60bea39fcbca78fb658b\", \"files\": {}}", + "dest": "cargo/vendor/zune-core-0.5.3", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zune-jpeg/zune-jpeg-0.5.15.crate", + "sha256": "27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296", + "dest": "cargo/vendor/zune-jpeg-0.5.15" + }, + { + "type": "inline", + "contents": "{\"package\": \"27bc9d5b815bc103f142aa054f561d9187d191692ec7c2d1e2b4737f8dbd7296\", \"files\": {}}", + "dest": "cargo/vendor/zune-jpeg-0.5.15", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zune-jpegxl/zune-jpegxl-0.5.2.crate", + "sha256": "cba11ecd07cc23351500e840ae03841b7e4997923ec8e4832ee3ae199ea0b6b4", + "dest": "cargo/vendor/zune-jpegxl-0.5.2" + }, + { + "type": "inline", + "contents": "{\"package\": \"cba11ecd07cc23351500e840ae03841b7e4997923ec8e4832ee3ae199ea0b6b4\", \"files\": {}}", + "dest": "cargo/vendor/zune-jpegxl-0.5.2", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zvariant/zvariant-5.15.0.crate", + "sha256": "c1d34c27cc6cdd1f458427519dd6b8612f7b7e3f7b9a0b2355d041dda9869147", + "dest": "cargo/vendor/zvariant-5.15.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"c1d34c27cc6cdd1f458427519dd6b8612f7b7e3f7b9a0b2355d041dda9869147\", \"files\": {}}", + "dest": "cargo/vendor/zvariant-5.15.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zvariant_derive/zvariant_derive-5.15.0.crate", + "sha256": "864155e69b4352db0c7f374917bf45d1e0c8d17659c8b3dbf9795f3673f8c497", + "dest": "cargo/vendor/zvariant_derive-5.15.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"864155e69b4352db0c7f374917bf45d1e0c8d17659c8b3dbf9795f3673f8c497\", \"files\": {}}", + "dest": "cargo/vendor/zvariant_derive-5.15.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "archive", + "archive-type": "tar-gzip", + "url": "https://static.crates.io/crates/zvariant_utils/zvariant_utils-4.2.0.crate", + "sha256": "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3", + "dest": "cargo/vendor/zvariant_utils-4.2.0" + }, + { + "type": "inline", + "contents": "{\"package\": \"bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3\", \"files\": {}}", + "dest": "cargo/vendor/zvariant_utils-4.2.0", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/egui_demo_lib\" \"cargo/vendor/egui_demo_lib\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"egui_demo_lib\"\nversion = \"0.37.0\"\nauthors = [\"Emil Ernerfeldt \"]\ndescription = \"Example library for egui\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui/tree/main/crates/egui_demo_lib\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"README.md\"\nrepository = \"https://github.com/emilk/egui/tree/main/crates/egui_demo_lib\"\ncategories = [\"gui\", \"graphics\"]\nkeywords = [\"glow\", \"egui\", \"gui\", \"gamedev\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\", \"data/*\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[package.metadata.cargo-shear]\nignored = [\"image\"]\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n\n[lib]\n\n[features]\ndefault = []\njiff = [\"egui_extras/datepicker\", \"dep:jiff\"]\nserde = [\"egui/serde\", \"dep:serde\", \"egui_extras/serde\"]\nsyntect = [\"egui_extras/syntect\"]\n\n[dependencies.egui]\ndefault-features = false\nfeatures = [\"color-hex\", \"default_fonts\"]\nversion = \"0.37.0\"\npath = \"crates/egui\"\n\n[dependencies.egui_extras]\nfeatures = [\"image\", \"svg\"]\nversion = \"0.37.0\"\npath = \"crates/egui_extras\"\ndefault-features = false\n\n[dependencies.log]\nversion = \"0.4.34\"\nfeatures = [\"std\"]\n\n[dependencies.unicode_names2]\nversion = \"3.1\"\ndefault-features = false\n\n[dependencies.jiff]\noptional = true\nfeatures = [\"std\", \"js\"]\nversion = \"0.2.35\"\ndefault-features = false\n\n[dependencies.document-features]\noptional = true\nversion = \"0.2.12\"\n\n[dependencies.serde]\noptional = true\nversion = \"1.0\"\nfeatures = [\"derive\"]\n\n[dev-dependencies]\nmimalloc = \"0.1.52\"\nrand = \"0.10.2\"\n\n[dev-dependencies.criterion]\nversion = \"0.8.2\"\ndefault-features = false\n\n[dev-dependencies.egui]\nfeatures = [\"default_fonts\", \"monochrome_emoji_fonts\"]\nversion = \"0.37.0\"\npath = \"crates/egui\"\ndefault-features = false\n\n[dev-dependencies.egui_extras]\nfeatures = [\"image\", \"svg\"]\nversion = \"0.37.0\"\npath = \"crates/egui_extras\"\ndefault-features = false\n\n[dev-dependencies.egui_kittest]\nfeatures = [\"wgpu\", \"snapshot\"]\nversion = \"0.37.0\"\npath = \"crates/egui_kittest\"\ndefault-features = false\n\n[dev-dependencies.image]\nfeatures = [\"png\"]\nversion = \"0.25.10\"\ndefault-features = false\n\n[[bench]]\nname = \"benchmark\"\nharness = false\n", + "dest": "cargo/vendor/egui_demo_lib", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/egui_demo_lib", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/egui_extras\" \"cargo/vendor/egui_extras\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"egui_extras\"\nversion = \"0.37.0\"\nauthors = [\"Dominik R\u00f6ssler \", \"Emil Ernerfeldt \", \"Ren\u00e9 R\u00f6ssler \"]\ndescription = \"Extra functionality and widgets for the egui GUI library\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"README.md\"\nrepository = \"https://github.com/emilk/egui\"\ncategories = [\"gui\", \"game-development\"]\nkeywords = [\"gui\", \"imgui\", \"immediate\", \"portable\", \"gamedev\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n\n[lib]\n\n[features]\ndefault = [\"dep:mime_guess2\"]\nall_loaders = [\"file\", \"http\", \"image\", \"svg\", \"gif\", \"webp\"]\ndatepicker = [\"jiff\"]\nfile = [\"dep:mime_guess2\"]\ngif = [\"image\", \"image/gif\"]\nwebp = [\"image\", \"image/webp\"]\nhttp = [\"dep:ehttp\"]\nimage = [\"dep:image\"]\nserde = [\"egui/serde\", \"enum-map/serde\", \"dep:serde\"]\nsvg = [\"resvg\"]\nsvg_text = [\"svg\", \"resvg/text\", \"resvg/system-fonts\"]\nsvg_images = [\"svg\", \"resvg/raster-images\"]\nsyntect = [\"dep:syntect\"]\n\n[dependencies]\nenum-map = \"3.1\"\nitertools = \"0.15.0\"\n\n[dependencies.egui]\ndefault-features = false\nversion = \"0.37.0\"\npath = \"crates/egui\"\n\n[dependencies.ahash]\nversion = \"0.8.12\"\ndefault-features = false\nfeatures = [\"no-rng\", \"std\"]\n\n[dependencies.log]\nversion = \"0.4.34\"\nfeatures = [\"std\"]\n\n[dependencies.profiling]\nversion = \"1.0\"\ndefault-features = false\n\n[dependencies.serde]\noptional = true\nversion = \"1.0\"\nfeatures = [\"derive\"]\n\n[dependencies.jiff]\noptional = true\nfeatures = [\"std\", \"tz-system\", \"js\"]\nversion = \"0.2.35\"\ndefault-features = false\n\n[dependencies.document-features]\noptional = true\nversion = \"0.2.12\"\n\n[dependencies.image]\noptional = true\nversion = \"0.25.10\"\ndefault-features = false\n\n[dependencies.mime_guess2]\noptional = true\nversion = \"2.3\"\ndefault-features = false\n\n[dependencies.syntect]\noptional = true\nfeatures = [\"default-fancy\"]\nversion = \"5.3\"\ndefault-features = false\n\n[dependencies.resvg]\noptional = true\nversion = \"0.45.1\"\ndefault-features = false\n\n[dependencies.ehttp]\noptional = true\nversion = \"0.7.1\"\ndefault-features = false\n\n[dev-dependencies]\ntempfile = \"3.27\"\n\n[dev-dependencies.egui]\nfeatures = [\"default_fonts\"]\nversion = \"0.37.0\"\npath = \"crates/egui\"\ndefault-features = false\n\n[dev-dependencies.egui_kittest]\npath = \"../egui_kittest\"\nfeatures = [\"snapshot\", \"wgpu\"]\n", + "dest": "cargo/vendor/egui_extras", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/egui_extras", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/egui_inspection\" \"cargo/vendor/egui_inspection\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"egui_inspection\"\nversion = \"0.37.0\"\nauthors = [\"Lucas Meurer \", \"Emil Ernerfeldt \"]\ndescription = \"Protocol and egui::Plugin for inspection of egui apps\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"./README.md\"\nrepository = \"https://github.com/emilk/egui\"\ncategories = [\"gui\", \"development-tools::testing\", \"accessibility\"]\nkeywords = [\"gui\", \"egui\", \"inspector\", \"accesskit\", \"mcp\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[features]\ndefault = []\npng = [\"dep:image\", \"image/png\", \"egui/bytemuck\"]\nplugin = [\"png\", \"dep:log\"]\n\n[dependencies]\nserde_bytes = \"0.11.19\"\nrmp-serde = \"1.3\"\n\n[dependencies.egui]\nfeatures = [\"serde\"]\nversion = \"0.37.0\"\npath = \"crates/egui\"\ndefault-features = false\n\n[dependencies.serde]\nversion = \"1.0\"\nfeatures = [\"derive\"]\n\n[dependencies.image]\noptional = true\nversion = \"0.25.10\"\ndefault-features = false\n\n[dependencies.log]\noptional = true\nversion = \"0.4.34\"\nfeatures = [\"std\"]\n\n[dependencies.document-features]\noptional = true\nversion = \"0.2.12\"\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n", + "dest": "cargo/vendor/egui_inspection", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/egui_inspection", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "shell", + "commands": [ + "cp -r --reflink=auto \"flatpak-cargo/git/egui-6d518fc/crates/egui_system_font_provider\" \"cargo/vendor/egui_system_font_provider\"" + ] + }, + { + "type": "inline", + "contents": "[package]\nname = \"egui_system_font_provider\"\nversion = \"0.37.0\"\nauthors = [\"Emil Ernerfeldt \"]\ndescription = \"Load system fonts on demand for characters the egui fonts lack\"\nedition = \"2024\"\nrust-version = \"1.95\"\nhomepage = \"https://github.com/emilk/egui/tree/main/crates/egui_system_font_provider\"\nlicense = \"MIT OR Apache-2.0\"\nreadme = \"README.md\"\nrepository = \"https://github.com/emilk/egui/tree/main/crates/egui_system_font_provider\"\ncategories = [\"gui\"]\nkeywords = [\"egui\", \"gui\", \"fonts\", \"text\"]\ninclude = [\"../../LICENSE-APACHE\", \"../../LICENSE-MIT\", \"**/*.rs\", \"Cargo.toml\"]\n\n[package.metadata.docs.rs]\nall-features = true\nrustdoc-args = [\"--generate-link-to-definition\"]\n\n[lints.rust]\nunsafe_code = \"deny\"\ntrivial_numeric_casts = \"warn\"\nunused_import_braces = \"warn\"\nunused_lifetimes = \"warn\"\ntrivial_casts = \"allow\"\nunused_qualifications = \"allow\"\n\n[lints.rust.future_incompatible]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.nonstandard_style]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.rust_2018_idioms]\nlevel = \"warn\"\npriority = -1\n\n[lints.rust.unexpected_cfgs]\nlevel = \"warn\"\ncheck-cfg = [\"cfg(web_sys_unstable_apis)\"]\n\n[lints.rustdoc]\nall = \"warn\"\n\n[lints.clippy]\nallow_attributes = \"warn\"\nas_ptr_cast_mut = \"warn\"\nbranches_sharing_code = \"warn\"\nclear_with_drain = \"warn\"\nclone_on_ref_ptr = \"warn\"\ncoerce_container_to_any = \"warn\"\ndbg_macro = \"warn\"\ndebug_assert_with_mut_call = \"warn\"\ndefault_union_representation = \"warn\"\nderive_partial_eq_without_eq = \"warn\"\ndisallowed_script_idents = \"warn\"\ndoc_include_without_cfg = \"warn\"\nempty_enum_variants_with_brackets = \"warn\"\nequatable_if_let = \"warn\"\nexit = \"warn\"\nfallible_impl_from = \"warn\"\nfloat_cmp_const = \"warn\"\nfn_to_numeric_cast_any = \"warn\"\nget_unwrap = \"warn\"\nimprecise_flops = \"warn\"\ninfinite_loop = \"warn\"\niter_on_empty_collections = \"warn\"\niter_on_single_items = \"warn\"\niter_over_hash_type = \"warn\"\nlarge_include_file = \"warn\"\nlarge_stack_frames = \"warn\"\nliteral_string_with_formatting_args = \"warn\"\nlossy_float_literal = \"warn\"\nmap_err_ignore = \"warn\"\nmem_forget = \"warn\"\nmissing_assert_message = \"warn\"\nmutex_integer = \"warn\"\nneedless_pass_by_ref_mut = \"warn\"\nneedless_type_cast = \"warn\"\nnon_zero_suggestions = \"warn\"\nnonstandard_macro_braces = \"warn\"\nor_fun_call = \"warn\"\npath_buf_push_overwrite = \"warn\"\npathbuf_init_then_push = \"warn\"\nprecedence_bits = \"warn\"\nprint_stderr = \"warn\"\nprint_stdout = \"warn\"\npub_without_shorthand = \"warn\"\nrc_mutex = \"warn\"\nredundant_type_annotations = \"warn\"\nref_patterns = \"warn\"\nrest_pat_in_fully_bound_structs = \"warn\"\nreturn_and_then = \"warn\"\nset_contains_or_insert = \"warn\"\nsingle_option_map = \"warn\"\nstd_instead_of_core = \"warn\"\nstr_to_string = \"warn\"\nstring_add = \"warn\"\nstring_lit_as_bytes = \"warn\"\nstring_lit_chars_any = \"warn\"\nsuspicious_xor_used_as_pow = \"warn\"\ntodo = \"warn\"\ntoo_long_first_doc_paragraph = \"warn\"\ntrailing_empty_array = \"warn\"\ntrait_duplication_in_bounds = \"warn\"\ntuple_array_conversions = \"warn\"\nundocumented_unsafe_blocks = \"warn\"\nunimplemented = \"warn\"\nuninhabited_references = \"warn\"\nunnecessary_safety_comment = \"warn\"\nunnecessary_safety_doc = \"warn\"\nunnecessary_self_imports = \"warn\"\nunnecessary_struct_initialization = \"warn\"\nunused_peekable = \"warn\"\nunused_rounding = \"warn\"\nunused_trait_names = \"warn\"\nunwrap_used = \"warn\"\nuse_self = \"warn\"\nuseless_let_if_seq = \"warn\"\nverbose_file_reads = \"warn\"\ncast_lossless = \"allow\"\ncast_possible_truncation = \"allow\"\ncast_possible_wrap = \"allow\"\ncast_precision_loss = \"allow\"\ncast_sign_loss = \"allow\"\ncomparison_chain = \"allow\"\ndefault_trait_access = \"allow\"\nfloat_cmp = \"allow\"\ninline_always = \"allow\"\nitems_after_statements = \"allow\"\nmany_single_char_names = \"allow\"\nmissing_panics_doc = \"allow\"\nmust_use_candidate = \"allow\"\nredundant_closure_for_method_calls = \"allow\"\nreturn_self_not_must_use = \"allow\"\nshould_panic_without_expect = \"allow\"\nsimilar_names = \"allow\"\nstruct_excessive_bools = \"allow\"\nstruct_field_names = \"allow\"\ntoo_many_lines = \"allow\"\ntrivially_copy_pass_by_ref = \"allow\"\nunreadable_literal = \"allow\"\nused_underscore_binding = \"allow\"\nassigning_clones = \"allow\"\nmanual_range_contains = \"allow\"\nmap_unwrap_or = \"allow\"\nmultiple_crate_versions = \"allow\"\nwildcard_imports = \"allow\"\nlet_underscore_must_use = \"allow\"\nlet_underscore_untyped = \"allow\"\nself_named_module_files = \"allow\"\nsignificant_drop_tightening = \"allow\"\n\n[lints.clippy.all]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.cargo]\nlevel = \"warn\"\npriority = -1\n\n[lints.clippy.pedantic]\nlevel = \"warn\"\npriority = -1\n\n[lib]\n\n[dependencies]\nsys-locale = \"0.3.2\"\nunicode-script = \"0.5.8\"\n\n[dependencies.epaint]\nfeatures = [\"color_fonts\"]\nversion = \"0.37.0\"\npath = \"crates/epaint\"\ndefault-features = false\n\n[dependencies.fontique]\nversion = \"0.11.1\"\ndefault-features = false\nfeatures = [\"system\", \"fontconfig-dlopen\"]\n\n[dependencies.log]\nversion = \"0.4.34\"\nfeatures = [\"std\"]\n\n[dependencies.poll-promise]\nversion = \"0.3.0\"\ndefault-features = false\n\n[dependencies.skrifa]\nversion = \"0.44.0\"\ndefault-features = false\nfeatures = [\"std\", \"autohint_shaping\"]\n\n[dev-dependencies.egui]\nversion = \"0.37.0\"\npath = \"crates/egui\"\ndefault-features = false\n", + "dest": "cargo/vendor/egui_system_font_provider", + "dest-filename": "Cargo.toml" + }, + { + "type": "inline", + "contents": "{\"package\": null, \"files\": {}}", + "dest": "cargo/vendor/egui_system_font_provider", + "dest-filename": ".cargo-checksum.json" + }, + { + "type": "inline", + "contents": "[source.vendored-sources]\ndirectory = \"cargo/vendor\"\n\n[source.crates-io]\nreplace-with = \"vendored-sources\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=82a24b006eefa036b43c09a67fb9a3fbd17ffe63\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"vendored-sources\"\nrev = \"82a24b006eefa036b43c09a67fb9a3fbd17ffe63\"\n\n[source.\"https://github.com/storytold/craft-libs?rev=25da1314d443171b4adeaad2cd9454b273f35c6f\"]\ngit = \"https://github.com/storytold/craft-libs\"\nreplace-with = \"vendored-sources\"\nrev = \"25da1314d443171b4adeaad2cd9454b273f35c6f\"\n\n[source.\"https://github.com/storytold/egui.git?rev=6d518fc799681571963842f95b55a6b68431b15a\"]\ngit = \"https://github.com/storytold/egui\"\nreplace-with = \"vendored-sources\"\nrev = \"6d518fc799681571963842f95b55a6b68431b15a\"\n\n[source.\"https://github.com/storytold/winit.git?rev=a517b3846ee8457d84ee4975110bfda6797c44dc\"]\ngit = \"https://github.com/storytold/winit\"\nreplace-with = \"vendored-sources\"\nrev = \"a517b3846ee8457d84ee4975110bfda6797c44dc\"\n", + "dest": "cargo", + "dest-filename": "config" + } +] \ No newline at end of file diff --git a/packaging/linux/flatpak/generate-cargo-sources.py b/packaging/linux/flatpak/generate-cargo-sources.py new file mode 100755 index 0000000000..43ed785a2a --- /dev/null +++ b/packaging/linux/flatpak/generate-cargo-sources.py @@ -0,0 +1,398 @@ +#!/usr/bin/env python3 +"""Regenerate cargo-sources.json for the from-source Flatpak manifest. + +The upstream flatpak-cargo-generator is downloaded from a pinned commit and +verified before use; the full script is intentionally not vendored here. Two +small, reviewed patches are applied in memory: + +1. Key cargo source replacements by the full source URL (including ?rev=...) + instead of only the repository URL, so two different revisions of the same + repository stay distinct. +2. Include Cargo.lock's [patch.unused] entries, so crates such as egui_demo_lib + are vendored even though they are not in the resolved package graph. + +This only produces and validates the source inventory; a full Flatpak SDK +build is still required. See README.md in this directory for details. + +The generator runs with stdin connected to /dev/null and is capped at +GENERATOR_TIMEOUT_SECONDS. On POSIX (the Flatpak build path) it starts in its +own session, so a timeout, Ctrl-C (SIGINT) or SIGTERM terminates the generator +and its git descendants without touching any other process; the recorded signal +is replayed with the handler that was installed before generation started, so +the wrapper keeps its normal cancellation behaviour. On Windows only the direct +generator process is terminated; descendants are not tree-killed. +""" + +from __future__ import annotations + +import argparse +import hashlib +import json +import os +from pathlib import Path +import signal +import subprocess +import sys +import tempfile +from urllib.request import urlopen + +UPSTREAM_COMMIT = "9d86d336a39b9af38b86f114b6ce5820fe260f91" +UPSTREAM_URL = ( + "https://raw.githubusercontent.com/flatpak/flatpak-builder-tools/" + f"{UPSTREAM_COMMIT}/cargo/flatpak-cargo-generator.py" +) +UPSTREAM_SHA256 = "0a2db6be87d75910facef28ab46d4d6460802e8419ab850d0caa6a364d26b380" +PATCHED_SHA256 = "1e7c61d98d18e88156fb8cd4b91f526e04a6c504b185ae7b12f775ec1dd48512" + +# Allow cold git caches while bounding stalled inventory regeneration. +GENERATOR_TIMEOUT_SECONDS = 30 * 60 + +# Signals that cancel regeneration without an exception of their own. +CANCELLATION_SIGNALS = (signal.SIGINT, signal.SIGTERM) + +PATCHES = ( + ( + "preserve pinned source identities", + ''' elif branch: + assert len(branch) == 1 + cargo_vendored_entry[repo_url]["branch"] = branch[0] + + logging.info("Adding package %s from %s", name, repo_url) +''', + ''' elif branch: + assert len(branch) == 1 + cargo_vendored_entry[repo_url]["branch"] = branch[0] + + # Preserve distinct pinned source identities from the same repository. + if rev or tag or branch: + source_key = source.removeprefix("git+").split("#", 1)[0] + cargo_vendored_entry = {source_key: cargo_vendored_entry[repo_url]} + + logging.info("Adding package %s from %s", name, repo_url) +''', + ), + ( + "include Cargo.lock patch.unused entries", + ''' pkg_coros = [ + get_package_sources(p, cargo_lock, git_repos) for p in cargo_lock["package"] + ] +''', + ''' pkg_coros = [ + get_package_sources(p, cargo_lock, git_repos) + for p in cargo_lock["package"] + cargo_lock.get("patch", {}).get("unused", []) + ] +''', + ), +) + + +def sha256(data: bytes) -> str: + return hashlib.sha256(data).hexdigest() + + +def download_upstream() -> bytes: + with urlopen(UPSTREAM_URL, timeout=60) as response: + data = response.read(1_000_001) + if len(data) > 1_000_000: + raise SystemExit("error: upstream generator is unexpectedly large") + actual = sha256(data) + if actual != UPSTREAM_SHA256: + raise SystemExit( + "error: upstream generator checksum mismatch\n" + f" expected {UPSTREAM_SHA256}\n" + f" actual {actual}\n" + f" url {UPSTREAM_URL}" + ) + return data + + +def patched_upstream(data: bytes) -> bytes: + text = data.decode("utf-8") + for name, old, new in PATCHES: + count = text.count(old) + if count != 1: + raise SystemExit( + f"error: patch {name!r} matched {count} times, expected exactly once; " + "the pinned upstream script or patch set changed" + ) + text = text.replace(old, new, 1) + patched = text.encode("utf-8") + actual = sha256(patched) + if actual != PATCHED_SHA256: + raise SystemExit( + "error: patched generator checksum mismatch\n" + f" expected {PATCHED_SHA256}\n" + f" actual {actual}" + ) + return patched + + +def _kill_generator(process: subprocess.Popen) -> None: + """Signal only our generator session; never waits or reaps. + + The reaped check is a plain ``returncode`` read: calling ``Popen.poll`` or + ``Popen.kill`` would wait for the child, which is not safe inside a POSIX + signal handler. On POSIX the generator is a session leader, so its PID is + also the ID of a process group that contains no process we do not own. + Killing that group stops git clones/fetches the generator started. On + Windows only the direct generator process is killed; its descendants may + survive. + """ + if process.returncode is not None: + return + if os.name == "posix": + try: + os.killpg(process.pid, signal.SIGKILL) + except OSError: + # The group is already gone; still try the direct child in case it + # was not a group leader. + try: + os.kill(process.pid, signal.SIGKILL) + except OSError: + pass + else: + try: + process.kill() + except OSError: + # The child exited between the timeout and the kill. + pass + + +def _terminate_generator(process: subprocess.Popen) -> None: + """Stop only our generator session and reap its leader. + + Only called outside signal handlers; the follow-up ``wait`` reaps the + session leader so no zombie or live generator outlives the wrapper. + ``_kill_generator`` skips a child that was already reaped, so this cannot + signal a recycled PID. + """ + _kill_generator(process) + try: + process.wait(timeout=10) + except subprocess.TimeoutExpired: + print( + f"warning: generator process {process.pid} did not exit after SIGKILL", + file=sys.stderr, + ) + + +class _GeneratorRun: + """State shared with the temporary cancellation signal handlers. + + Because the generator runs in its own session, Ctrl-C in the terminal or a + SIGTERM sent to the wrapper no longer reaches it. These handlers record the + signal and stop exactly that session without waiting; ``run_generator`` + then restores the previous handlers and reports the cancellation, so + ``main`` can clean up before the signal is replayed with the caller's own + behaviour. The wait that follows always reaps the leader. + """ + + def __init__(self) -> None: + self.process = None + self.received = None + self.killed = False + + def cancel(self, signum, _frame) -> None: + """Record the first SIGINT/SIGTERM and stop the generator's session.""" + if self.received is None: + self.received = signum + process = self.process + # ``_kill_generator`` reads only ``returncode`` and uses raw POSIX + # signals, so it is safe in a handler. The first signal does the kill; + # later signals must not overwrite the recorded cancellation. + if process is not None and not self.killed: + self.killed = True + _kill_generator(process) + + +class _Cancelled(Exception): + """A cancellation signal arrived while the generator was running.""" + + def __init__(self, signum: int) -> None: + super().__init__(signum) + self.signum = signum + + +def _replay_cancellation(signum: int) -> None: + """Re-deliver a recorded cancellation through the restored handler. + + Called once the temporary handlers are restored and the temporary file and + directory are gone. ``raise_signal`` invokes exactly the handler currently + installed (``KeyboardInterrupt`` for the default SIGINT action, the default + terminating action for SIGTERM, or ``SIG_IGN``), so no handler-kind + branching is needed. + """ + signal.raise_signal(int(signum)) + + +def run_generator( + *, script: Path, cargo_lock: Path, temp_output: str, cwd: Path, environment: dict +) -> int: + """Run the upstream generator in its own session; return its exit status. + + A cancellation or any other error stops the generator's whole session + before it is reported, so no detached generator or git process survives. + """ + run = _GeneratorRun() + previous_handlers = {} + try: + # Install the handlers before Popen: a signal that arrives while the + # child is being spawned (or between Popen returning and the assignment + # below) must not leave an unmanaged session behind. It is recorded, + # and the newly created process is stopped as soon as its PID is known. + # Installing inside the outer try means a partial installation is + # restored even if a later signal.signal() call fails unexpectedly. + for signum in CANCELLATION_SIGNALS: + try: + previous_handlers[signum] = signal.signal(signum, run.cancel) + except (OSError, ValueError): + # signal.signal() only works in the main thread of the main + # interpreter; the exception cleanup below still stops the + # detached generator on KeyboardInterrupt elsewhere. + pass + process = subprocess.Popen( + [sys.executable, str(script), str(cargo_lock), "-o", temp_output], + cwd=str(cwd), + env=environment, + stdin=subprocess.DEVNULL, + start_new_session=os.name == "posix", + ) + run.process = process + if run.received is not None: + _terminate_generator(process) + try: + process.wait(timeout=GENERATOR_TIMEOUT_SECONDS) + except subprocess.TimeoutExpired: + _terminate_generator(process) + if run.received is None: + raise + # A cancellation arrived while reaping the timed-out session; it + # is reported below as the cancellation it is. + except BaseException: + # KeyboardInterrupt without a temporary handler (non-main thread) + # or any other error: never leave the generator detached. + _terminate_generator(process) + raise + returncode = process.returncode + finally: + for signum, handler in previous_handlers.items(): + signal.signal(signum, handler) + # Read the recorded signal after restoring the handlers: a signal that + # arrives between the child being reaped and the restoration above is + # recorded by run.cancel and must still be reported, not silently dropped. + received = run.received + if received is not None: + raise _Cancelled(received) + return returncode + + +def default_cache_dir() -> Path: + base = os.environ.get("XDG_CACHE_HOME") + if base: + return Path(base) / "lightcraft-flatpak-cargo" + return Path.home() / ".cache" / "lightcraft-flatpak-cargo" + + +def ensure_outside_source(cache: Path, repo_root: Path) -> None: + cache = cache.resolve() + if cache == repo_root or repo_root in cache.parents: + raise SystemExit(f"error: cache directory must be outside the source checkout: {cache}") + target = os.environ.get("CARGO_TARGET_DIR") + if target: + target_path = Path(target) + # Cargo runs in repo_root, even when this wrapper was invoked elsewhere. + if not target_path.is_absolute(): + target_path = repo_root / target_path + target_path = target_path.resolve() + if cache == target_path or target_path in cache.parents: + raise SystemExit(f"error: cache directory must be outside CARGO_TARGET_DIR: {cache}") + + +def main() -> int: + repo_root = Path(__file__).resolve().parents[3] + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + "cargo_lock", + nargs="?", + default=str(repo_root / "Cargo.lock"), + help="Cargo.lock to read (default: repository Cargo.lock)", + ) + parser.add_argument( + "-o", + "--output", + default=str(repo_root / "packaging/linux/flatpak/cargo-sources.json"), + help="output path (default: packaging/linux/flatpak/cargo-sources.json)", + ) + parser.add_argument( + "--cache-dir", + default=None, + help=( + "git clone cache root (default: $XDG_CACHE_HOME/lightcraft-flatpak-cargo, " + "or ~/.cache/lightcraft-flatpak-cargo)" + ), + ) + args = parser.parse_args() + + cargo_lock = Path(args.cargo_lock).resolve() + output = Path(args.output).resolve() + cache = Path(args.cache_dir).resolve() if args.cache_dir else default_cache_dir().resolve() + if not cargo_lock.is_file(): + raise SystemExit(f"error: Cargo.lock not found: {cargo_lock}") + ensure_outside_source(cache, repo_root) + cache.mkdir(parents=True, exist_ok=True) + output.parent.mkdir(parents=True, exist_ok=True) + + generator = patched_upstream(download_upstream()) + + cancelled = None + with tempfile.TemporaryDirectory(prefix="lightcraft-flatpak-generator-") as tmpdir: + script = Path(tmpdir) / "flatpak-cargo-generator.py" + script.write_bytes(generator) + + descriptor, temp_output = tempfile.mkstemp( + prefix=f".{output.name}.", suffix=".tmp", dir=output.parent + ) + os.close(descriptor) + try: + environment = os.environ.copy() + environment["XDG_CACHE_HOME"] = str(cache) + returncode = run_generator( + script=script, + cargo_lock=cargo_lock, + temp_output=temp_output, + cwd=repo_root, + environment=environment, + ) + if returncode != 0: + return returncode + if os.path.getsize(temp_output) == 0: + raise SystemExit("error: generator produced an empty file") + with open(temp_output, "r", encoding="utf-8") as handle: + sources = json.load(handle) + if not isinstance(sources, list) or not sources: + raise SystemExit("error: generated sources are not a non-empty list") + # Keep the owner-only mkstemp mode through the atomic replacement. + os.replace(temp_output, output) + except subprocess.TimeoutExpired as error: + raise SystemExit( + f"error: inventory generation exceeded {GENERATOR_TIMEOUT_SECONDS} seconds; " + "the existing inventory was not changed" + ) from error + except _Cancelled as event: + # Replayed below, after the temporary file and script directory are + # removed, so cancellation leaves no leftovers. + cancelled = event + finally: + if os.path.exists(temp_output): + os.unlink(temp_output) + + if cancelled is not None: + _replay_cancellation(cancelled.signum) + raise SystemExit(f"error: generator cancelled by signal {cancelled.signum}") + + print(f"wrote {output}") + return 0 + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/packaging/linux/flatpak/test_generate_cargo_sources.py b/packaging/linux/flatpak/test_generate_cargo_sources.py new file mode 100644 index 0000000000..cfa38bc38e --- /dev/null +++ b/packaging/linux/flatpak/test_generate_cargo_sources.py @@ -0,0 +1,483 @@ +"""Failure-path and cancellation checks for the LightCraft inventory wrapper.""" +import importlib.util +import io +import hashlib +import stat +import os +from pathlib import Path +import shutil +import signal +import subprocess +import sys +import tempfile +import time +import unittest +from unittest.mock import patch + +sys.dont_write_bytecode = True +SOURCE = Path(__file__).resolve().with_name('generate-cargo-sources.py') +spec = importlib.util.spec_from_file_location('inventory_wrapper', SOURCE) +wrapper = importlib.util.module_from_spec(spec) +spec.loader.exec_module(wrapper) + +# Deliberate sabotage for checking that the cancellation tests are meaningful. +# Run with LIGHTCRAFT_FLATPAK_TEST_BREAK_KILL=1: the process-group kill becomes +# a no-op and the cancellation/timeout tests must fail, proving they observe +# real liveness instead of relying on teardown. +BREAK_KILL = os.environ.get('LIGHTCRAFT_FLATPAK_TEST_BREAK_KILL') == '1' +if BREAK_KILL: + wrapper._kill_generator = lambda process: None + +# The process-group tests use POSIX killpg plus /proc to tell an unreaped +# zombie descendant from a running one; both are Linux-specific here, so they +# are skipped explicitly rather than pretending to be portable POSIX. +LINUX_ONLY = sys.platform.startswith('linux') +LINUX_SKIP = 'process-group cancellation is verified on Linux (/proc liveness, killpg)' + +# Process identity recorded with each PID, so teardown never kills a recycled +# PID: /proc//stat starttime is monotonic per PID on Linux. +PYTHON_IDENTITY = ( + 'def write_identity(path, pid):\n' + ' stat = pathlib.Path(f"/proc/{pid}/stat").read_text()\n' + ' starttime = stat.rsplit(")", 1)[1].split()[19]\n' + ' path.write_text(f"{pid} {starttime}")\n' +) + +# A descendant that keeps writing into the cache until it is killed. +DESCENDANT = ( + 'import os, pathlib, sys, time\n' + + PYTHON_IDENTITY + + 'heartbeat, marker, pidfile = (pathlib.Path(arg) for arg in sys.argv[1:])\n' + 'write_identity(pidfile, os.getpid())\n' + 'with heartbeat.open("ab", buffering=0) as handle:\n' + ' for _ in range(1000):\n' + ' handle.write(b"x")\n' + ' time.sleep(0.02)\n' + 'marker.write_bytes(b"descendant survived")\n' +) + + +def detached_generator(): + """Fake generator: starts a heartbeating descendant, then waits.""" + return ( + 'import os, pathlib, subprocess, sys, time\n' + + PYTHON_IDENTITY + + f'CHILD = {DESCENDANT!r}\n' + 'root = pathlib.Path(sys.argv[-1]).parent\n' + 'write_identity(root / "generator.pid", os.getpid())\n' + 'child_script = root / "descendant.py"\n' + 'child_script.write_text(CHILD)\n' + 'subprocess.Popen([sys.executable, str(child_script), str(root / "cache" / "heartbeat"), str(root / "cache" / "after-timeout"), str(root / "descendant.pid")])\n' + 'deadline = time.monotonic() + 10\n' + 'while time.monotonic() < deadline:\n' + ' heartbeat = root / "cache" / "heartbeat"\n' + ' if heartbeat.exists() and heartbeat.stat().st_size:\n' + ' break\n' + ' time.sleep(0.01)\n' + 'else:\n' + ' raise SystemExit("descendant never wrote a heartbeat")\n' + '(root / "ready").write_bytes(b"handshake")\n' + 'time.sleep(30)\n' + ).encode() + + +# Stands in for `python3 generate-cargo-sources.py` so a real signal can be +# delivered to the wrapper while the detached generator is running. The fake +# payload keeps the test offline and the timeout long enough to be cancelled. +DRIVER = '''\ +import importlib.util +import os +from pathlib import Path +import sys + +source, fixture, lock, output, cache = sys.argv[1:6] +spec = importlib.util.spec_from_file_location("inventory_wrapper", source) +wrapper = importlib.util.module_from_spec(spec) +spec.loader.exec_module(wrapper) +if os.environ.get("LIGHTCRAFT_FLATPAK_TEST_BREAK_KILL") == "1": + wrapper._kill_generator = lambda process: None +payload = Path(fixture).read_bytes() +wrapper.download_upstream = lambda: payload +wrapper.patched_upstream = lambda data: data +wrapper.GENERATOR_TIMEOUT_SECONDS = 300 +sys.argv = ["generate", lock, "-o", output, "--cache-dir", cache] +try: + raise SystemExit(wrapper.main()) +except KeyboardInterrupt: + Path(fixture).with_name("interrupted").write_bytes(b"KeyboardInterrupt") + raise SystemExit(130) +''' + + +class InventoryFailures(unittest.TestCase): + def test_download_accepts_verified_bytes(self): + payload = b'verified fixture' + with patch.object(wrapper, 'urlopen', return_value=io.BytesIO(payload)), patch.object(wrapper, 'UPSTREAM_SHA256', hashlib.sha256(payload).hexdigest()): + self.assertEqual(wrapper.download_upstream(), payload) + + def test_patch_applies_both_changes_and_checks_result_hash(self): + source = '\n'.join(old for _, old, _ in wrapper.PATCHES).encode() + expected = '\n'.join(new for _, _, new in wrapper.PATCHES).encode() + with patch.object(wrapper, 'PATCHED_SHA256', hashlib.sha256(expected).hexdigest()): + self.assertEqual(wrapper.patched_upstream(source), expected) + with patch.object(wrapper, 'PATCHED_SHA256', '0' * 64): + with self.assertRaises(SystemExit): + wrapper.patched_upstream(source) + + def test_success_atomically_replaces_inventory_with_owner_only_file(self): + with tempfile.TemporaryDirectory() as temp: + root = Path(temp).resolve() + lock = root / 'Cargo.lock' + lock.write_text('version = 4\n') + output = root / 'sources.json' + output.write_bytes(b'old inventory') + payload = b'[{"type": "archive", "url": "https://example.invalid/source"}]' + def generate(*args, **kwargs): + temporary = Path(kwargs['temp_output']) + self.assertEqual(output.read_bytes(), b'old inventory') + if os.name == 'posix': + self.assertEqual(stat.S_IMODE(temporary.stat().st_mode), 0o600) + temporary.write_bytes(payload) + return 0 + args = ['generate', str(lock), '-o', str(output), '--cache-dir', str(root / 'cache')] + with patch.object(sys, 'argv', args), patch.object(wrapper, 'download_upstream', return_value=b'fixture'), patch.object(wrapper, 'patched_upstream', return_value=b'fixture'), patch.object(wrapper, 'run_generator', side_effect=generate): + self.assertEqual(wrapper.main(), 0) + self.assertEqual(output.read_bytes(), payload) + if os.name == 'posix': + self.assertEqual(stat.S_IMODE(output.stat().st_mode), 0o600) + self.assertEqual(list(root.glob('.sources.json.*.tmp')), []) + + def test_download_rejects_changed_bytes(self): + with patch.object(wrapper, 'urlopen', return_value=io.BytesIO(b'changed upstream')): + with self.assertRaisesRegex(SystemExit, 'checksum mismatch'): + wrapper.download_upstream() + + def test_download_rejects_excessive_size(self): + with patch.object(wrapper, 'urlopen', return_value=io.BytesIO(b'x' * 1_000_001)): + with self.assertRaisesRegex(SystemExit, 'unexpectedly large'): + wrapper.download_upstream() + + def test_patch_refuses_unrecognized_source(self): + with self.assertRaisesRegex(SystemExit, 'matched 0 times'): + wrapper.patched_upstream(b'not the expected generator') + + def test_cache_cannot_be_inside_checkout_or_target(self): + with tempfile.TemporaryDirectory() as temp: + root = Path(temp).resolve() + for cache in (root / 'repo', root / 'repo/subdir', root / 'target', root / 'target/subdir'): + with patch.dict(os.environ, {'CARGO_TARGET_DIR': str(root / 'target')}): + with self.assertRaises(SystemExit): + wrapper.ensure_outside_source(cache, root / 'repo') + + def test_relative_target_uses_generator_working_directory(self): + with tempfile.TemporaryDirectory() as temp: + root = Path(temp).resolve() + # The wrapper can be invoked elsewhere; its child runs in repo_root. + elsewhere = root / 'elsewhere/deeper' + elsewhere.mkdir(parents=True) + previous = Path.cwd() + try: + os.chdir(elsewhere) + with patch.dict(os.environ, {'CARGO_TARGET_DIR': '../target'}): + with self.assertRaisesRegex(SystemExit, 'outside CARGO_TARGET_DIR'): + wrapper.ensure_outside_source(root / 'target/cache', root / 'repo') + finally: + os.chdir(previous) + + def test_timed_out_generator_preserves_inventory(self): + with tempfile.TemporaryDirectory() as temp: + root = Path(temp).resolve() + lock = root / 'Cargo.lock' + lock.write_text('version = 4\n') + output = root / 'sources.json' + output.write_bytes(b'original inventory') + generator = b'import pathlib, sys, time\npathlib.Path(sys.argv[-1]).write_bytes(b"partial")\ntime.sleep(30)\n' + args = ['generate', str(lock), '-o', str(output), '--cache-dir', str(root / 'cache')] + with patch.object(sys, 'argv', args), patch.object(wrapper, 'download_upstream', return_value=generator), patch.object(wrapper, 'patched_upstream', side_effect=lambda data: data), patch.object(wrapper, 'GENERATOR_TIMEOUT_SECONDS', 0.2): + with self.assertRaisesRegex(SystemExit, 'existing inventory was not changed'): + wrapper.main() + self.assertEqual(output.read_bytes(), b'original inventory') + self.assertEqual(list(root.glob('.sources.json.*.tmp')), []) + + def test_generator_signal_handlers_are_restored(self): + with tempfile.TemporaryDirectory() as temp: + root = Path(temp).resolve() + script = root / 'generator.py' + script.write_text( + 'import pathlib, sys\n' + 'pathlib.Path(sys.argv[-1]).write_text("[]")\n' + ) + lock = root / 'Cargo.lock' + lock.write_text('version = 4\n') + temp_output = root / 'sources.json' + watched = (signal.SIGINT, signal.SIGTERM) + before = {number: signal.getsignal(number) for number in watched} + returncode = wrapper.run_generator( + script=script, + cargo_lock=lock, + temp_output=str(temp_output), + cwd=root, + environment=os.environ.copy(), + ) + after = {number: signal.getsignal(number) for number in watched} + self.assertEqual(returncode, 0) + self.assertEqual(temp_output.read_text(), '[]') + self.assertEqual(before, after) + + def test_signal_after_wait_is_not_lost_during_handler_restore(self): + root = self._new_temp_root() + script = root / 'generator.py' + script.write_text( + 'import pathlib, sys\n' + 'pathlib.Path(sys.argv[-1]).write_text("[]")\n' + ) + lock = root / 'Cargo.lock' + lock.write_text('version = 4\n') + temp_output = root / 'sources.json' + watched = (signal.SIGINT, signal.SIGTERM) + before = {number: signal.getsignal(number) for number in watched} + real_signal = signal.signal + calls = {'count': 0} + captured = {} + + def restore_with_signal(signum, handler): + calls['count'] += 1 + if calls['count'] <= len(watched): + captured['handler'] = handler + elif calls['count'] == len(watched) + 1: + # The child has been reaped and run_generator is restoring the + # handlers. Invoke the still-installed run.cancel handler now: + # it records the cancellation after run_generator's old + # snapshot point, so only the post-restoration read can report + # it. This is deterministic, unlike racing a real signal. + captured['handler'](signal.SIGINT, None) + return real_signal(signum, handler) + + environment = os.environ.copy() + output_path = str(temp_output) + try: + with patch.object(wrapper.signal, 'signal', side_effect=restore_with_signal): + with self.assertRaises(wrapper._Cancelled) as caught: + wrapper.run_generator( + script=script, + cargo_lock=lock, + temp_output=output_path, + cwd=root, + environment=environment, + ) + finally: + for number in watched: + real_signal(number, before[number]) + self.assertEqual(caught.exception.signum, signal.SIGINT) + + @unittest.skipUnless(LINUX_ONLY, LINUX_SKIP) + def test_timed_out_generator_stops_descendants(self): + root = self._new_temp_root() + lock = root / 'Cargo.lock' + lock.write_text('version = 4\n') + output = root / 'sources.json' + output.write_bytes(b'original inventory') + args = ['generate', str(lock), '-o', str(output), '--cache-dir', str(root / 'cache')] + try: + with patch.object(sys, 'argv', args), patch.object(wrapper, 'download_upstream', return_value=detached_generator()), patch.object(wrapper, 'patched_upstream', side_effect=lambda data: data), patch.object(wrapper, 'GENERATOR_TIMEOUT_SECONDS', 3.0): + with self.assertRaisesRegex(SystemExit, 'existing inventory was not changed'): + wrapper.main() + + # Assert liveness and a frozen heartbeat before any teardown kill, + # so a broken group kill cannot be masked by the test's cleanup. + self.assertTrue((root / 'ready').exists()) + self._assert_generator_session_gone(root) + self.assertEqual(output.read_bytes(), b'original inventory') + self.assertEqual(list(root.glob('.sources.json.*.tmp')), []) + except BaseException: + self._preserve_failure_evidence(root, 'timeout') + raise + + @unittest.skipUnless(LINUX_ONLY, LINUX_SKIP) + def test_sigint_cancellation_stops_generator_session(self): + self._assert_cancellation(signal.SIGINT, expected_returncode=130) + + @unittest.skipUnless(LINUX_ONLY, LINUX_SKIP) + def test_sigterm_cancellation_stops_generator_session(self): + self._assert_cancellation(signal.SIGTERM, expected_returncode=-signal.SIGTERM) + + def _assert_cancellation(self, number, *, expected_returncode): + root = self._new_temp_root() + driver, output = self._start_generation_driver(root) + try: + driver.send_signal(number) + returncode = driver.wait(timeout=30) + self.assertEqual(returncode, expected_returncode, (root / 'driver.err').read_text()) + if number == signal.SIGINT: + # KeyboardInterrupt reached the wrapper's caller after cleanup. + self.assertEqual((root / 'interrupted').read_bytes(), b'KeyboardInterrupt') + else: + # SIGTERM kept its default terminating action. + self.assertFalse((root / 'interrupted').exists()) + + # Assert the process group is dead and the heartbeat has stopped + # before any teardown kill. Cleanup is registered with addCleanup, + # so it runs after these assertions (also when they fail). + self._assert_generator_session_gone(root) + self.assertEqual(output.read_bytes(), b'original inventory') + self.assertEqual(list(root.glob('.sources.json.*.tmp')), []) + except BaseException: + self._preserve_failure_evidence(root, f'cancel-{int(number)}') + raise + + def _new_temp_root(self): + temp = tempfile.TemporaryDirectory(prefix='lightcraft-flatpak-test-') + self.addCleanup(temp.cleanup) + root = Path(temp.name).resolve() + # Registered after temp.cleanup, so addCleanup's LIFO order stops any + # surviving test processes before their evidence directory disappears. + self.addCleanup(self._stop_pids, root) + return root + + def _start_generation_driver(self, root): + lock = root / 'Cargo.lock' + lock.write_text('version = 4\n') + output = root / 'sources.json' + output.write_bytes(b'original inventory') + fixture = root / 'generator-fixture.py' + fixture.write_bytes(detached_generator()) + driver_path = root / 'driver.py' + driver_path.write_text(DRIVER) + environment = { + key: value for key, value in os.environ.items() if key != 'CARGO_TARGET_DIR' + } + stdout = (root / 'driver.out').open('wb') + stderr = (root / 'driver.err').open('wb') + self.addCleanup(stdout.close) + self.addCleanup(stderr.close) + driver = subprocess.Popen( + [ + sys.executable, '-B', str(driver_path), str(SOURCE), str(fixture), + str(lock), str(output), str(root / 'cache'), + ], + cwd=str(root), + env=environment, + stdout=stdout, + stderr=stderr, + ) + self.addCleanup(self._stop_driver, driver, root) + deadline = time.monotonic() + 20 + while not (root / 'ready').exists(): + if driver.poll() is not None: + self.fail( + 'driver exited before the generator was ready:\n' + + (root / 'driver.err').read_text() + ) + if time.monotonic() > deadline: + self.fail('driver did not start the generator descendant') + time.sleep(0.02) + return driver, output + + def _stop_driver(self, driver, root): + if driver.poll() is None: + driver.kill() + try: + driver.wait(timeout=10) + except subprocess.TimeoutExpired: + pass + self._stop_pids(root) + + @staticmethod + def _read_identity(root, name): + try: + pid_text, starttime = (root / name).read_text().split() + return int(pid_text), starttime + except (OSError, ValueError): + return None + + @staticmethod + def _identity_is_running(pid, starttime): + """True only for the recorded process, never for a recycled PID.""" + try: + stat = Path(f'/proc/{pid}/stat').read_text() + except OSError: + return False + fields = stat.rsplit(')', 1)[1].split() + return len(fields) > 19 and fields[0] not in ('Z', 'X') and fields[19] == starttime + + @classmethod + def _stop_pids(cls, root): + for name in ('generator.pid', 'descendant.pid'): + identity = cls._read_identity(root, name) + if identity is None: + continue + pid, starttime = identity + if not cls._identity_is_running(pid, starttime): + continue + try: + os.kill(pid, signal.SIGKILL) + except OSError: + pass + # Let teardown observe the kill before the evidence directory is + # removed; identity checks make this a no-op for unrelated PIDs. + deadline = time.monotonic() + 2 + while time.monotonic() < deadline: + if not any( + identity is not None and cls._identity_is_running(*identity) + for identity in (cls._read_identity(root, name) for name in ('generator.pid', 'descendant.pid')) + ): + break + time.sleep(0.02) + + @staticmethod + def _preserve_failure_evidence(root, label): + destination = Path(tempfile.mkdtemp(prefix=f'lightcraft-flatpak-{label}-')) + for path in root.rglob('*'): + if not path.is_file(): + continue + target = destination / path.relative_to(root) + try: + target.parent.mkdir(parents=True, exist_ok=True) + shutil.copy2(path, target) + except OSError: + pass + print(f'failure evidence preserved in {destination}', file=sys.stderr) + + def _assert_generator_session_gone(self, root): + for name in ('generator.pid', 'descendant.pid'): + identity = self._read_identity(root, name) + self.assertIsNotNone(identity, f'{name} was not recorded') + pid, starttime = identity + deadline = time.monotonic() + 2 + while self._identity_is_running(pid, starttime) and time.monotonic() < deadline: + time.sleep(0.02) + self.assertFalse( + self._identity_is_running(pid, starttime), + f'{name} process {pid} is still running', + ) + + heartbeat = (root / 'cache' / 'heartbeat').read_bytes() + self.assertTrue(heartbeat) + time.sleep(0.5) + self.assertEqual((root / 'cache' / 'heartbeat').read_bytes(), heartbeat) + self.assertFalse((root / 'cache' / 'after-timeout').exists()) + + def test_failed_or_invalid_generation_preserves_inventory(self): + for code, payload in [(17, b'partial'), (0, b''), (0, b'invalid json'), (0, b'[]'), (0, b'{}')]: + with self.subTest(code=code, payload=payload), tempfile.TemporaryDirectory() as temp: + root = Path(temp).resolve() + lock = root / 'Cargo.lock' + lock.write_text('version = 4\n') + output = root / 'sources.json' + output.write_bytes(b'original inventory') + def generate(*args, **kwargs): + Path(kwargs['temp_output']).write_bytes(payload) + return code + args = ['generate', str(lock), '-o', str(output), '--cache-dir', str(root / 'cache')] + with patch.object(sys, 'argv', args), patch.object(wrapper, 'download_upstream', return_value=b'fixture'), patch.object(wrapper, 'patched_upstream', return_value=b'fixture'), patch.object(wrapper, 'run_generator', side_effect=generate): + if code: + self.assertEqual(wrapper.main(), code) + else: + with self.assertRaises((SystemExit, ValueError)): + wrapper.main() + self.assertEqual(output.read_bytes(), b'original inventory') + self.assertEqual(list(root.glob('.sources.json.*.tmp')), []) + + +if __name__ == '__main__': + unittest.main(verbosity=2) diff --git a/sonar-project.properties b/sonar-project.properties index 336e755db7..717d1dfac0 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,3 +1,9 @@ sonar.projectKey=storytold_lightcraft sonar.organization=storytold sonar.coverage.exclusions=**/tools/**,**/docs/**,**/examples/** + +# Keep packaging tests analyzed as tests, outside production coverage metrics. +sonar.tests=packaging/linux/flatpak +sonar.test.inclusions=packaging/linux/flatpak/test_*.py +sonar.exclusions=packaging/linux/flatpak/test_*.py +sonar.python.coverage.reportPaths=python-coverage.xml From 58f26e02ffb9a28a3252d89be088d0acefeac07e Mon Sep 17 00:00:00 2001 From: Kirill M <176898419+JaffarSk24@users.noreply.github.com> Date: Tue, 27 Oct 2026 10:57:07 +0100 Subject: [PATCH 18/93] i18n(ru): 216 strings the Russian catalog was missing Print and slideshow templates, mask effects and effect presets, external editing, display profiles and HDR, the face model and background task rows, and the smart album Yes/No values. Written from the English meaning by a native speaker. --- crates/ui-egui/locales/ru.json | 218 ++++++++++++++++++++++++++++++++- 1 file changed, 217 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/locales/ru.json b/crates/ui-egui/locales/ru.json index 306804df04..969304fdc2 100644 --- a/crates/ui-egui/locales/ru.json +++ b/crates/ui-egui/locales/ru.json @@ -6,6 +6,7 @@ "A filter is hiding this view's photos: change it, or clear it (View → Clear Filters)": "Фильтр скрывает фото в этом представлении: измените его или сбросьте (Вид → Сбросить фильтры)", "A one-time download of about": "Однократная загрузка около", "A pen's pressure sets the size and flow of the brush": "Нажим пера задаёт размер и поток кисти", + "A slide stays up for its duration, its fade in included. A fade of 0 cuts.": "Слайд показывается заданное время, включая его появление. Нулевое затухание означает резкую смену.", "About LightCraft": "О программе LightCraft", "Activity": "Активность", "Actual size": "Реальный размер", @@ -13,9 +14,13 @@ "Add Catchlight": "Добавить блик в глазах", "Add Folder to Local": "Добавить папку в «Локальное»", "Add Point Color Sample": "Добавить точечный образец цвета", + "Add Print Cell": "Добавить ячейку печати", "Add Red Eye Correction": "Добавить коррекцию красных глаз", "Add Remove Spot": "Добавить удаление пятна", "Add Selected Photos": "Добавить выбранные фото", + "Add a Face Recognition Model": "Добавить модель распознавания лиц", + "Add a cell": "Добавить ячейку", + "Add a model file…": "Добавить файл модели…", "Add a rule (⌥-click: a group)": "Добавить условие (⌥+щелчок: группу)", "Add in place": "Добавить на месте", "Add in place: the library references the files where they are; nothing is copied or moved.": "Добавить на месте: библиотека ссылается на файлы там, где они лежат; ничего не копируется и не перемещается.", @@ -26,7 +31,192 @@ "Add to Album": "Добавить в альбом", "Add to Favorites": "Добавить в избранное", "Add to My Photos": "Добавить в «Мои фото»", + "Already installed. Installing again is harmless.": "Уже установлено. Повторная установка ничего не испортит.", + "Also the masks of the same name on the other selected photos": "Также маски с тем же именем на других выбранных фото", + "Apple Photos Imports": "Импорт из Apple Photos", + "Apply Mask Effect": "Применить эффект маски", + "Apply Print Template": "Применить шаблон печати", + "Apply Slideshow Template": "Применить шаблон слайд-шоу", + "Apply to All Masks": "Применить ко всем маскам", + "Arrange Print Cell": "Упорядочить ячейку печати", + "Auto Layout": "Автомакет", + "Background Tasks": "Фоновые задачи", "Can't be moved here": "Сюда переместить нельзя", + "Cancel Background Task": "Отменить фоновую задачу", + "Choose Layout Image…": "Выбрать изображение макета…", + "Choose Monitor Profile": "Выбрать профиль монитора", + "Choose Profile…": "Выбрать профиль…", + "Choose a group": "Выберите группу", + "Choose at least one setting to include": "Выберите хотя бы один параметр", + "Clear Print Layout": "Очистить макет печати", + "Click a cell to move, resize or arrange it": "Щёлкните ячейку, чтобы переместить её, изменить размер или порядок", + "Click to name this face": "Щёлкните, чтобы назвать это лицо", + "Color Overlay": "Цветное наложение", + "Color Overlay on B&W": "Цветное наложение на Ч/Б", + "Color space: Rec. 2020 HLG (HDR AVIF)": "Цветовое пространство: Rec. 2020 HLG (HDR AVIF)", + "Color wheel": "Цветовой круг", + "Combine with the existing person": "Объединить с существующим человеком", + "Contact Sheet PDF…": "Контактный лист PDF…", + "Copy Settings…": "Копировать настройки…", + "Create Keyword": "Создать ключевое слово", + "Curve channel": "Канал кривой", + "Cycle Flag": "Переключить флаг", + "Cycle Tool Overlay": "Переключить наложение инструмента", + "Decrease Flag Status": "Понизить статус флага", + "Decrease Grid Thumbnail Size": "Уменьшить миниатюры сетки", + "Delete Cell": "Удалить ячейку", + "Delete Mask Effect": "Удалить эффект маски", + "Delete Print Cell": "Удалить ячейку печати", + "Delete Print Template": "Удалить шаблон печати", + "Delete Slideshow Template": "Удалить шаблон слайд-шоу", + "Delete…": "Удалить…", + "Display": "Дисплей", + "Display Profile": "Профиль дисплея", + "Display profile not used": "Профиль дисплея не используется", + "Drag to set hue and saturation. Hold Shift to keep the hue, Cmd/Ctrl to keep the saturation, Alt/Option to fine-adjust. Double-click to reset.": "Перетащите, чтобы задать тон и насыщенность. Удерживайте Shift, чтобы сохранить тон, Cmd/Ctrl, чтобы сохранить насыщенность, Alt/Option для точной настройки. Двойной щелчок сбрасывает.", + "Duplicate Mask Effect": "Дублировать эффект маски", + "Edit In": "Редактировать в", + "Edit Keyword": "Изменить ключевое слово", + "Edit in HDR: highlights above SDR white, for HDR exports and displays": "Правка в HDR: света выше белого SDR, для экспорта и дисплеев HDR", + "Edit in Other Editor": "Редактировать в другом редакторе", + "Edit in Other Editor (⌥⌘E) opens the copy in this application (an app name on macOS, a program path elsewhere).": "«Редактировать в другом редакторе» (⌥⌘E) открывает копию в этом приложении (на macOS это имя приложения, в других системах путь к программе).", + "End Slideshow": "Завершить слайд-шоу", + "Enter to confirm, Esc to cancel": "Enter подтверждает, Esc отменяет", + "Export Contact Sheet PDF": "Экспорт контактного листа PDF", + "Export Effect Presets": "Экспортировать пресеты эффектов", + "Export Effect Presets…": "Экспортировать пресеты эффектов…", + "Export Mask Effects": "Экспортировать эффекты масок", + "External Editing": "Внешнее редактирование", + "Face Models on the GPU": "Модели лиц на ГП", + "Face models (ONNX)": "Модели лиц (ONNX)", + "Fade": "Затухание", + "Fade duration": "Длительность затухания", + "Favorite": "Избранное", + "Favorite Mask Effect": "Избранный эффект маски", + "Filters": "Фильтры", + "Find Blemishes": "Найти дефекты", + "Found automatically": "Найдено автоматически", + "Group (optional)": "Группа (необязательно)", + "HDR Headroom": "Запас HDR", + "Highlighted: sliders this mask changes. Sliders left out stay as they are when the preset is applied.": "Выделены ползунки, которые меняет эта маска. Остальные ползунки при применении пресета остаются как есть.", + "ICC Profiles": "Профили ICC", + "Image on Black": "Изображение на чёрном", + "Image on White": "Изображение на белом", + "Import Mask Effects": "Импортировать эффекты масок", + "Import Slideshow Template": "Импорт шаблона слайд-шоу", + "Include Amount": "Включить количество", + "Include brush size, feather and flow": "Включить размер, растушёвку и поток кисти", + "Include selected photos": "Включить выбранные фото", + "Increase Flag Status": "Повысить статус флага", + "Increase Grid Thumbnail Size": "Увеличить миниатюры сетки", + "Keyword Info": "Сведения о ключевом слове", + "LUT-based": "На основе LUT", + "Layout Image Matte": "Подложка изображения макета", + "Layout Image Opacity": "Непрозрачность изображения макета", + "Left: the standard (SDR) range up to SDR white. Right: the HDR range, one band per stop above SDR white (the orange line: the HDR headroom). With Visualize HDR range on, the bands take its colours.": "Слева: стандартный диапазон (SDR) до белого SDR. Справа: диапазон HDR, по одной полосе на каждую ступень выше белого SDR (оранжевая линия показывает запас HDR). Когда включена визуализация диапазона HDR, полосы окрашиваются в её цвета.", + "LightCraft Effect Presets": "Пресеты эффектов LightCraft", + "Manage Effect Presets…": "Управление пресетами эффектов…", + "Manage Presets…": "Управление пресетами…", + "Managed by Printer (Adobe RGB)": "Управляет принтер (Adobe RGB)", + "Managed by Printer (sRGB)": "Управляет принтер (sRGB)", + "Mask": "Маска", + "Mask Effect Presets": "Пресеты эффектов масок", + "Masks keep their sliders. Export presets first to keep a copy.": "Маски сохранят свои ползунки. Чтобы сохранить копию, сначала экспортируйте пресеты.", + "Monitor profile": "Профиль монитора", + "Move Keyword": "Переместить ключевое слово", + "Move Mask Effect to Group": "Переместить эффект маски в группу", + "Move Print Cell": "Переместить ячейку печати", + "Move Print Cell to Page": "Переместить ячейку печати на страницу", + "Move to Group…": "Переместить в группу…", + "Name the preset": "Назовите пресет", + "New Print Page": "Новая страница печати", + "New group — Return": "Новая группа: Return", + "New spot (Return adds it here)": "Новая точка (Return добавляет её сюда)", + "Next History Step": "Следующий шаг истории", + "Next Slide": "Следующий слайд", + "Next page": "Следующая страница", + "Nikon High Efficiency NEF (HE / HE★) uses intoPIX TicoRAW compression. LightCraft does not currently have a license for this codec, so only the camera's embedded JPEG preview is available, not the raw sensor data. To edit raw data, shoot Lossless compressed NEF or convert existing HE files to DNG using a licensed converter.": "Nikon High Efficiency NEF (HE / HE★) использует сжатие intoPIX TicoRAW. У LightCraft пока нет лицензии на этот кодек, поэтому доступен только встроенный JPEG-просмотр камеры, а не необработанные данные сенсора. Чтобы редактировать RAW-данные, снимайте в NEF со сжатием без потерь или преобразуйте имеющиеся файлы HE в DNG лицензированным конвертером.", + "No Matte": "Без подложки", + "No change": "Без изменений", + "No effect matches": "Подходящих эффектов нет", + "No effect presets yet": "Пресетов эффектов пока нет", + "None (the display is treated as sRGB)": "Нет (дисплей считается sRGB)", + "One photo fills each page inside the margins.": "Одно фото заполняет каждую страницу в пределах полей.", + "Open Original in Other Editor (RAW, no copy)": "Открыть оригинал в другом редакторе (RAW, без копии)", + "Open Settings": "Открыть настройки", + "Other editor": "Другой редактор", + "Overlay color": "Цвет наложения", + "Page": "Страница", + "Pause / Resume Slideshow": "Пауза / продолжение слайд-шоу", + "Photo Above": "Фото выше", + "Photo Below": "Фото ниже", + "Photo ▸ Edit In ▸ Edit in PhotoCraft (⇧⌘E, or right-click a photo) renders a copy with your edits, stacks it with the original and opens it in PhotoCraft. Save there and the copy updates here. As PSD, PhotoCraft saves straight back to it. Leave the location empty unless you use a portable copy.": "Фото › Редактировать в › Редактировать в PhotoCraft (⇧⌘E или щелчок правой кнопкой по фото) создаёт копию с вашими правками, объединяет её в стопку с оригиналом и открывает в PhotoCraft. Сохраните там, и копия обновится здесь. Если копия в формате PSD, PhotoCraft сохраняет прямо в неё. Оставьте расположение пустым, если не пользуетесь переносной копией.", + "Photos are shown through your monitor's ICC profile, so colours are right on wide-gamut and calibrated displays, and the Detail view uses the display's whole gamut. The histogram, the preview caches and exports are not affected.": "Фото показываются через ICC-профиль монитора, поэтому цвета верны на дисплеях с широким охватом и на откалиброванных дисплеях, а режим «Детализация» использует весь цветовой охват дисплея. Гистограмму, кэши просмотров и экспорт это не затрагивает.", + "Photos stay in All Photos. Deleting a folder also deletes its albums. You can undo this.": "Фото останутся во «Всех фото». При удалении папки удаляются и её альбомы. Это действие можно отменить.", + "Previous History Step": "Предыдущий шаг истории", + "Previous Slide": "Предыдущий слайд", + "Previous page": "Предыдущая страница", + "Primaries (x, y)": "Основные цвета (x, y)", + "Print Settings": "Параметры печати", + "Print Templates": "Шаблоны печати", + "Print to PDF": "Печать в PDF", + "Profiles assigned in your desktop's colour settings are usually in ~/.local/share/icc.": "Профили, назначенные в настройках цвета рабочего стола, обычно лежат в ~/.local/share/icc.", + "Progressive": "Прогрессивный", + "Put New Keywords Inside": "Добавлять новые ключевые слова внутрь", + "Read Focus Points in the Background": "Читать точки фокусировки в фоне", + "Recheck Preview-Only Raws": "Перепроверить RAW, доступные только как просмотр", + "Remove Folder Color Label": "Убрать цветовую метку папки", + "Remove region": "Удалить область", + "Rename Mask Effect": "Переименовать эффект маски", + "Rename Mask Effect Group": "Переименовать группу эффектов масок", + "Rename Person": "Переименовать человека", + "Rename Person…": "Переименовать человека…", + "Rename Slideshow Template": "Переименовать шаблон слайд-шоу", + "Renders the next slides while the current one is up, so fades never wait. Off: each slide renders when it is due (less memory and work).": "Готовит следующие слайды, пока показывается текущий, чтобы переходы не ждали. Выключено: каждый слайд готовится, когда подходит его очередь (меньше памяти и работы).", + "Reset Print Settings": "Сбросить параметры печати", + "Reset Sliders": "Сбросить ползунки", + "Resize Print Cell": "Изменить размер ячейки печати", + "Resize region": "Изменить размер области", + "SDR Brightness": "Яркость SDR", + "SDR Clarity": "Чёткость SDR", + "SDR Contrast": "Контрастность SDR", + "SDR Highlights": "Света SDR", + "SDR Shadows": "Тени SDR", + "SDR Whites": "Белые SDR", + "Save Current Settings as New Effect Preset…": "Сохранить текущие настройки как новый пресет эффекта…", + "Save Current Settings as New Preset…": "Сохранить текущие настройки как новый пресет…", + "Save Mask Effect": "Сохранить эффект маски", + "Save Print Template": "Сохранить шаблон печати", + "Save Slideshow Template": "Сохранить шаблон слайд-шоу", + "Scan Folder for Changes": "Проверить папку на изменения", + "Search effects": "Поиск эффектов", + "Select Only Active Photo": "Выбрать только активное фото", + "Select a mask to apply or update presets.": "Выберите маску, чтобы применить или обновить пресеты.", + "Select all": "Выбрать все", + "Select none": "Снять выбор", + "Set Effect for New Masks": "Задать эффект для новых масок", + "Set Folder Color Label": "Назначить цветовую метку папке", + "Set Print Cell Photo": "Задать фото ячейки печати", + "Set Print Settings": "Задать параметры печати", + "Show / hide": "Показать / скрыть", + "Show in Compare": "Показать в сравнении", + "Show mask": "Показать маску", + "Show photos": "Показать фото", + "Show this wheel's effect": "Показать действие этого круга", + "Slide duration": "Длительность слайда", + "Slideshow Export Status": "Состояние экспорта слайд-шоу", + "Slideshow Layout Settings": "Настройки макета слайд-шоу", + "Slideshow Options…": "Параметры слайд-шоу…", + "Slideshow Overlay Settings": "Настройки наложений слайд-шоу", + "Slideshow Playback Settings": "Настройки воспроизведения слайд-шоу", + "Slideshow Slide Preview": "Предпросмотр слайда", + "Slideshow Title Settings": "Настройки титров слайд-шоу", + "Slideshow in the View menu plays the photos in view from the selected one. These settings are saved with the library.": "«Слайд-шоу» в меню «Вид» показывает фото текущего вида, начиная с выбранного. Эти настройки сохраняются в библиотеке.", + "Targeted adjustment on: drag up or down on the photo · Esc to stop": "Целевая коррекция включена: тяните по фото вверх или вниз · Esc для выхода", + "Template name": "Название шаблона", + "The layout image can't be shown": "Не удаётся показать изображение макета", + "Their photos in the grid": "Их фото в сетке", + "This page setup is not valid": "Эти параметры страницы недопустимы", "This row covers more than one disk: drop on a folder inside it": "Эта строка охватывает несколько дисков: перетащите на папку внутри неё", "Local photos aren't in the library yet: Add to My Photos first, then move them": "Локальных фото ещё нет в библиотеке: сначала «Добавить в «Мои фото»», затем перемещайте", "Add to Selected Photos": "Добавить к выбранным фото", @@ -784,8 +974,28 @@ "No new presets": "Новых пресетов нет", "No photo selected": "Фото не выбрано", "No photos": "Нет фото", + "Thumbnail size": "Размер миниатюр", + "Title bar": "Строка заголовка", + "To hand this editor the original file itself instead (the raw, without a copy: DxO PhotoLab, for example), right-click a photo → Edit In → Open Original in Other Editor (RAW, no copy).": "Чтобы передать этому редактору сам исходный файл (RAW без копии, например для DxO PhotoLab), щёлкните фото правой кнопкой → Редактировать в → Открыть оригинал в другом редакторе (RAW, без копии).", + "Tool Overlay": "Наложение инструмента", + "Ungrouped": "Без группы", + "Unknown date": "Дата неизвестна", + "Unnamed face": "Лицо без имени", + "Update Mask Effect": "Обновить эффект маски", + "Update Slideshow Template": "Обновить шаблон слайд-шоу", + "Update to Current Process": "Обновить до текущей версии обработки", + "Use Screen Profile": "Использовать профиль экрана", + "Use sRGB": "Использовать sRGB", + "Visualize HDR": "Показать диапазон HDR", + "When pins show on the photo (Shift+H cycles)": "Когда показывать булавки на фото (Shift+H переключает)", + "White on Black": "Белое на чёрном", + "Write Waiting XMP Sidecars": "Записать ожидающие XMP-файлы", "Your library is empty": "Библиотека пуста", "Photos you import show up here. Nothing is copied or moved unless you choose to.": "Импортированные фото появятся здесь. Ничего не копируется и не перемещается, пока вы сами этого не выберете.", + "cells": "яч.", + "cells overlap": "ячейки перекрываются", + "current edits": "текущие правки", + "or drop a .onnx file on the window": "или перетащите файл .onnx в окно", "or drop photos and folders into this window": "или перетащите фото и папки в это окно", "Import photos to get started": "Импортируйте фото, чтобы начать", "or drop photos into this window": "или перетащите фото в это окно", @@ -1371,7 +1581,12 @@ "not available here": "здесь недоступно", "of the following rules:": "из следующих условий:", "saved in": "сохранено в", + "size": "размер", + "smart album value|No": "Нет", + "smart album value|Yes": "Да", + "source": "источник", "this photo": "это фото", + "this screen's profile": "профиль этого экрана", "− harder border · + softer border": "− жёстче край · + мягче край", "Back to this person": "Вернуться к этому человеку", "AI Denoise": "ИИ-шумоподавление", @@ -2349,5 +2564,6 @@ "Import dropped files without review": "Импортировать перетащенные файлы без проверки", "An import is running": "Импорт уже выполняется", "An import is running. Drop photos when it has finished": "Импорт уже выполняется. Перетащите фото, когда он закончится", - "Finish Lightroom catalog import before adding photos": "Завершите импорт каталога Lightroom, прежде чем добавлять фото" + "Finish Lightroom catalog import before adding photos": "Завершите импорт каталога Lightroom, прежде чем добавлять фото", + "★ Favorites": "★ Избранное" } From 9dd7736666289c2033b46a55b7afda0c7a7938cb Mon Sep 17 00:00:00 2001 From: Kirill M <176898419+JaffarSk24@users.noreply.github.com> Date: Tue, 27 Oct 2026 12:15:11 +0100 Subject: [PATCH 19/93] i18n(ru): printer-managed labels and the grading wheel's eye tooltip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "Managed by Printer" reads as a mode label now (Управляется принтером), "Show this wheel's effect" says эффект, and its pair "Hide this wheel's effect", which no catalog had, is added. --- crates/ui-egui/locales/ru.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/locales/ru.json b/crates/ui-egui/locales/ru.json index 969304fdc2..f740aaed97 100644 --- a/crates/ui-egui/locales/ru.json +++ b/crates/ui-egui/locales/ru.json @@ -98,6 +98,7 @@ "Found automatically": "Найдено автоматически", "Group (optional)": "Группа (необязательно)", "HDR Headroom": "Запас HDR", + "Hide this wheel's effect": "Скрыть эффект этого круга", "Highlighted: sliders this mask changes. Sliders left out stay as they are when the preset is applied.": "Выделены ползунки, которые меняет эта маска. Остальные ползунки при применении пресета остаются как есть.", "ICC Profiles": "Профили ICC", "Image on Black": "Изображение на чёрном", @@ -117,8 +118,8 @@ "LightCraft Effect Presets": "Пресеты эффектов LightCraft", "Manage Effect Presets…": "Управление пресетами эффектов…", "Manage Presets…": "Управление пресетами…", - "Managed by Printer (Adobe RGB)": "Управляет принтер (Adobe RGB)", - "Managed by Printer (sRGB)": "Управляет принтер (sRGB)", + "Managed by Printer (Adobe RGB)": "Управляется принтером (Adobe RGB)", + "Managed by Printer (sRGB)": "Управляется принтером (sRGB)", "Mask": "Маска", "Mask Effect Presets": "Пресеты эффектов масок", "Masks keep their sliders. Export presets first to keep a copy.": "Маски сохранят свои ползунки. Чтобы сохранить копию, сначала экспортируйте пресеты.", @@ -202,7 +203,7 @@ "Show in Compare": "Показать в сравнении", "Show mask": "Показать маску", "Show photos": "Показать фото", - "Show this wheel's effect": "Показать действие этого круга", + "Show this wheel's effect": "Показать эффект этого круга", "Slide duration": "Длительность слайда", "Slideshow Export Status": "Состояние экспорта слайд-шоу", "Slideshow Layout Settings": "Настройки макета слайд-шоу", From ea9130676b8945f0a3e8273b6f680b0e7bd33686 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Mon, 26 Oct 2026 22:18:43 +0000 Subject: [PATCH 20/93] feat(installer): default to a per-user ArtCraft folder --- .github/workflows/packaging-lint.yml | 19 ++ packaging/windows/INSTALLATION.md | 35 ++++ packaging/windows/check-install-policy.ps1 | 195 +++++++++++++++++++++ packaging/windows/install-policy.json | 35 ++++ packaging/windows/install-policy.wxi | 54 ++++++ packaging/windows/lightcraft.wxs | 82 +++------ packaging/windows/package.ps1 | 2 + packaging/windows/test-install-folder.ps1 | 11 +- packaging/windows/test-install-policy.ps1 | 54 ++++++ 9 files changed, 424 insertions(+), 63 deletions(-) create mode 100644 packaging/windows/INSTALLATION.md create mode 100644 packaging/windows/check-install-policy.ps1 create mode 100644 packaging/windows/install-policy.json create mode 100644 packaging/windows/install-policy.wxi create mode 100644 packaging/windows/test-install-policy.ps1 diff --git a/.github/workflows/packaging-lint.yml b/.github/workflows/packaging-lint.yml index 71d3b3063e..04af180059 100644 --- a/.github/workflows/packaging-lint.yml +++ b/.github/workflows/packaging-lint.yml @@ -37,3 +37,22 @@ jobs: run: | ./packaging/windows/test-install-folder.ps1 -Arch x64 ./packaging/windows/test-install-folder.ps1 -Arch x86 + + windows-install-policy: + timeout-minutes: 10 + name: Windows installation policy (no app build) + runs-on: windows-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Install the pinned packaging toolchain + shell: pwsh + run: | + $tools = Join-Path $env:RUNNER_TEMP 'craft-install-policy-wix' + dotnet tool install --tool-path $tools wix --version 5.0.2 + if ($LASTEXITCODE -ne 0) { throw 'WiX installation failed.' } + $tools >> $env:GITHUB_PATH + & (Join-Path $tools 'wix.exe') extension add -g WixToolset.UI.wixext/5.0.2 WixToolset.Util.wixext/5.0.2 + if ($LASTEXITCODE -ne 0) { throw 'WiX extension installation failed.' } + - name: Build and check non-executable installer fixtures + shell: pwsh + run: ./packaging/windows/test-install-policy.ps1 -OutputDirectory (Join-Path $env:RUNNER_TEMP 'craft-install-policy-tests') diff --git a/packaging/windows/INSTALLATION.md b/packaging/windows/INSTALLATION.md new file mode 100644 index 0000000000..982a5b4202 --- /dev/null +++ b/packaging/windows/INSTALLATION.md @@ -0,0 +1,35 @@ +# Windows installation policy checks + +New installations default to the current account under `Programs\ArtCraft\`. +The first setup page offers installation for everyone. Scope is selected before duplicate +checks and directory costing. An update uses the existing context's remembered exact folder; +`INSTALLFOLDER` supplied explicitly is never replaced. It is a secure MSI property so the +chosen folder reaches the elevated installer. Silent machine updates pass `ALLUSERS=1`. +A cross-context copy is refused; changing context means uninstalling the old copy first. + +App registration follows the selected context. Existing optional shortcuts and file-handler +choices stay app-owned. No new cleanup operation or model/settings migration is introduced. +Packaged resources remain package-owned; separately downloaded shared models are not caches +and are outside this installer's ownership. + +## Repeatable metadata tests + +On Windows with WiX 5.0.2 and its matching UI/Util extensions: + +```powershell +./packaging/windows/test-install-policy.ps1 -OutputDirectory ./target/install-policy-tests +``` + +The script builds x64, x86 and arm64 packages with deliberately non-executable payloads. It +uses the actual package source and compiled database. A safe Windows Installer session checks +24 scope/registration/maintenance cases, remembered and explicit custom folders, sequencing, +upgrade identity and the original registration inventory recorded in `install-policy.json`. +The release packaging script runs the compiled checker before signing. Packaging CI runs the +small fixture builds without compiling the Rust application. + +Never install or distribute the `NOT-INSTALLABLE.msi` fixtures as an app. Passing these checks +does not prove real installation, elevation, legacy-version upgrades, registry writes, optional +shortcut/menu behaviour, cancellation, rollback or uninstall. Those still require the real +payload in an authorised clean Windows test environment. Cross-architecture metadata is not +execution evidence on those architectures. Existing open installer/association PRs must be +reconciled before publication. Nothing here changes macOS/Linux native packaging conventions. diff --git a/packaging/windows/check-install-policy.ps1 b/packaging/windows/check-install-policy.ps1 new file mode 100644 index 0000000000..dd28956435 --- /dev/null +++ b/packaging/windows/check-install-policy.ps1 @@ -0,0 +1,195 @@ +<# +.SYNOPSIS + Check the compiled installation policy without installing any product. +.DESCRIPTION + Uses Windows Installer's safe session (OpenPackage option 1). Only property-setting custom + actions are exercised. No AppSearch, install, repair, removal or file-writing action runs. +#> +param([Parameter(Mandatory = $true)] [string] $MsiPath) +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version Latest +$policy = Get-Content -Raw -LiteralPath (Join-Path $PSScriptRoot 'install-policy.json') | ConvertFrom-Json +function Read-Rows($Database, [string] $Sql, [int] $Columns) { + $view = $Database.OpenView($Sql) + try { + [void]$view.Execute() + while ($null -ne ($record = $view.Fetch())) { + try { + $values = @(for ($i = 1; $i -le $Columns; $i++) { + $record.GetType().InvokeMember('StringData', 'GetProperty', $null, $record, @($i)) + }) + ,$values + } finally { [void][Runtime.InteropServices.Marshal]::FinalReleaseComObject($record) } + } + } finally { + [void]$view.Close() + [void][Runtime.InteropServices.Marshal]::FinalReleaseComObject($view) + } +} +function Set-SessionProperty($Session, [string] $Name, [string] $Value) { + [void]$Session.GetType().InvokeMember('Property', 'SetProperty', $null, $Session, @($Name, $Value)) +} +function Get-SessionProperty($Session, [string] $Name) { + $Session.GetType().InvokeMember('Property', 'GetProperty', $null, $Session, @($Name)) +} +$installer = $null; $database = $null; $session = $null +try { + $installer = New-Object -ComObject WindowsInstaller.Installer + $file = (Resolve-Path -LiteralPath $MsiPath).Path + $database = $installer.OpenDatabase($file, 0) + $session = $installer.OpenPackage($file, 1) + $properties = @{} + foreach ($row in (Read-Rows $database 'SELECT `Property`, `Value` FROM `Property`' 2)) { $properties[$row[0]] = $row[1] } + $secureProperties = @($properties['SecureCustomProperties'] -split ';') + if ('INSTALLFOLDER' -notin $secureProperties) { + throw 'The selected installation folder must survive elevation (secure INSTALLFOLDER).' + } + if ($policy.mode -eq 'perUser') { + if ($properties.ContainsKey('ALLUSERS')) { throw 'Launcher must remain per-user; machine self-update is not part of this change.' } + if ($properties['UpgradeCode'].Trim('{}') -ne $policy.upgradeCode) { throw 'Launcher upgrade identity changed.' } + $dirs = @{} + foreach ($row in (Read-Rows $database 'SELECT `Directory`, `Directory_Parent`, `DefaultDir` FROM `Directory`' 3)) { $dirs[$row[0]] = @($row[1],$row[2]) } + if ($dirs['INSTALLFOLDER'][0] -ne 'CraftSuiteFolder' -or $dirs['CraftSuiteFolder'][1] -ne 'ArtCraft' -or + $dirs['CraftSuiteFolder'][0] -ne 'LocalProgramsFolder' -or $dirs['LocalProgramsFolder'][0] -ne 'LocalAppDataFolder') { + throw 'Launcher new-install folder must be under the per-user ArtCraft suite root.' + } + foreach ($explicit in @('', 'F:\Chosen exact launcher')) { + Set-SessionProperty $session 'PREVIOUSINSTALLFOLDER' 'E:\Existing exact launcher' + Set-SessionProperty $session 'INSTALLFOLDER' $explicit + $row = @(Read-Rows $database 'SELECT `Condition` FROM `InstallUISequence` WHERE `Action` = ''CraftRestoreLauncherFolder''' 1)[0] + if ($session.EvaluateCondition($row[0]) -eq 1) { + if ($session.DoAction('CraftRestoreLauncherFolder') -ne 1) { throw 'Launcher restore action failed.' } + } + $expected = if ($explicit) { $explicit } else { 'E:\Existing exact launcher' } + if ((Get-SessionProperty $session 'INSTALLFOLDER') -ne $expected) { throw 'Launcher custom or existing path was lost.' } + } + $rows = @(Read-Rows $database 'SELECT `Root`, `Key`, `Name`, `Value` FROM `Registry`' 4) + if (@($rows | Where-Object { $_[0] -ne '1' }).Count) { throw 'Launcher registration must stay under the current account.' } + foreach ($entry in $policy.registry) { + if (@($rows | Where-Object { $_[0] -eq $entry[0] -and $_[1] -eq $entry[1] -and $_[2] -eq $entry[2] -and $_[3] -eq $entry[3] }).Count -ne 1) { + throw 'Launcher registration or shortcut preference changed unexpectedly.' + } + } + Write-Output 'PASS ArtCraft Launcher: per-user scope, suite folder, remembered/custom paths and existing registration. No installation performed.' + return + } + if ($properties['ALLUSERS'] -ne '2' -or $properties['MSIINSTALLPERUSER'] -ne '1') { + throw 'Policy regression: new packages must default to the per-user dual-scope context.' + } + if ($properties['UpgradeCode'].Trim('{}') -ne $policy.upgradeCode) { throw 'The existing upgrade identity must not change.' } + $directories = @{} + foreach ($row in (Read-Rows $database 'SELECT `Directory`, `Directory_Parent`, `DefaultDir` FROM `Directory`' 3)) { + $directories[$row[0]] = @($row[1], $row[2]) + } + if ($directories['INSTALLFOLDER'][0] -ne 'CraftSuiteFolder' -or + $directories['CraftSuiteFolder'][1] -ne 'ArtCraft') { throw 'Expected the app under the ArtCraft suite folder.' } + $programs = $directories['CraftSuiteFolder'][0] + if ($programs -eq 'ProgramFiles6432Folder') { $programs = $directories[$programs][0] } + if ($programs -notin 'ProgramFilesFolder', 'ProgramFiles64Folder') { + throw 'Use Windows Installer native folder redirection, not a hard-coded profile path.' + } + $guards = @(Read-Rows $database 'SELECT `Condition`, `Description` FROM `LaunchCondition`' 2 | + Where-Object { $_[0] -match 'CRAFT_(USER|MACHINE)_DIR' }) + if ($guards.Count -ne 2) { throw 'Expected both duplicate-installation guards.' } + $cases = 0 + foreach ($scope in @('', '2', '1')) { + foreach ($user in @('', 'D:\Existing user app')) { + foreach ($machine in @('', 'E:\Existing machine app')) { + foreach ($installed in @('', '1')) { + Set-SessionProperty $session 'ALLUSERS' $scope + Set-SessionProperty $session 'Installed' $installed + Set-SessionProperty $session 'CRAFT_USER_DIR' $user + Set-SessionProperty $session 'CRAFT_MACHINE_DIR' $machine + $allowed = $true + foreach ($guard in $guards) { + $value = $session.EvaluateCondition($guard[0]) + if ($value -notin 0, 1) { throw 'Invalid duplicate guard.' } + if ($value -eq 0) { $allowed = $false } + } + $opposite = if ($scope -eq '1') { $user } else { $machine } + $expected = [bool]$installed -or -not [bool]$opposite + if ($allowed -ne $expected) { throw "Scope regression: ALLUSERS='$scope', user=$([bool]$user), machine=$([bool]$machine), maintenance=$([bool]$installed)." } + $cases++ + } + } + } + } + # Execute the actual authored type-51 actions in a safe session, not copied resolver logic. + foreach ($scope in @('', '2', '1')) { + foreach ($explicit in @('', 'F:\Chosen exact app')) { + Set-SessionProperty $session 'ALLUSERS' $scope + Set-SessionProperty $session 'INSTALLFOLDER' $explicit + Set-SessionProperty $session 'CRAFT_USER_DIR' 'D:\Existing user app' + Set-SessionProperty $session 'CRAFT_MACHINE_DIR' 'E:\Existing machine app' + $action = if ($scope -eq '1') { 'CraftRestoreMachineFolder' } else { 'CraftRestoreUserFolder' } + if (-not $explicit) { + if ($session.DoAction($action) -ne 1) { throw 'Remembered-folder property action failed.' } + } + $expected = if ($explicit) { $explicit } elseif ($scope -eq '1') { 'E:\Existing machine app' } else { 'D:\Existing user app' } + if ((Get-SessionProperty $session 'INSTALLFOLDER') -ne $expected) { throw 'Custom or remembered folder was not preserved.' } + } + } + $ui = @{} + foreach ($row in (Read-Rows $database 'SELECT `Action`, `Sequence` FROM `InstallUISequence`' 2)) { $ui[$row[0]] = [int]$row[1] } + if (-not ($ui['AppSearch'] -lt $ui['CraftScopeDlg'] -and $ui['CraftScopeDlg'] -lt $ui['LaunchConditions'] -and + $ui['CraftScopeDlg'] -lt $ui['CraftRestoreUserFolder'] -and $ui['CraftRestoreUserFolder'] -lt $ui['CostInitialize'])) { + throw 'Scope must be chosen after discovery and before duplicate checks, folder restoration and costing.' + } + $execute = @{} + foreach ($row in (Read-Rows $database 'SELECT `Action`, `Sequence` FROM `InstallExecuteSequence`' 2)) { $execute[$row[0]] = [int]$row[1] } + foreach ($action in @('CraftRestoreUserFolder','CraftRestoreMachineFolder')) { + if (-not ($execute['AppSearch'] -lt $execute[$action] -and $execute[$action] -lt $execute['CostInitialize'])) { + throw 'Silent updates must restore the folder before directory costing.' + } + } + # Switching the first-page choice must reset BOTH properties, including a back-and-forth change. + $events = @(Read-Rows $database 'SELECT `Event`, `Argument`, `Condition`, `Ordering` FROM `ControlEvent` WHERE `Dialog_` = ''CraftScopeDlg'' AND `Control_` = ''Next'' ORDER BY `Ordering`' 4) + foreach ($choice in @('user','machine','user')) { + Set-SessionProperty $session 'CRAFT_SCOPE' $choice + foreach ($event in $events) { + if ($event[0] -notmatch '^\[([^\]]+)\]$') { continue } + $property = $Matches[1] + if ($session.EvaluateCondition($event[2]) -eq 1) { + Set-SessionProperty $session $property $(if ($event[1] -eq '{}') { '' } else { $event[1] }) + } + } + $allUsers = Get-SessionProperty $session 'ALLUSERS' + $perUser = Get-SessionProperty $session 'MSIINSTALLPERUSER' + if (($choice -eq 'machine' -and ($allUsers -ne '1' -or $perUser)) -or + ($choice -eq 'user' -and ($allUsers -ne '2' -or $perUser -ne '1'))) { + throw 'Scope selector does not reset the requested installation context.' + } + } + $actions = @(Read-Rows $database 'SELECT `Action`, `Source`, `Target`, `Type` FROM `CustomAction`' 4) + $savedOptions = @($actions | Where-Object { $_[0] -match '^CraftLoadOption[0-9]+M$' }) + foreach ($option in $savedOptions) { + if ([int]$option[3] -ne 51) { throw 'Saved-option test may run only property-setting actions.' } + $number = [regex]::Match($option[0], '[0-9]+').Value + foreach ($scope in @('2','1')) { + Set-SessionProperty $session 'ALLUSERS' $scope + Set-SessionProperty $session "CRAFT_OPTION_${number}_M" 'saved-machine-choice' + Set-SessionProperty $session "CRAFT_OPTION_${number}_U" 'saved-user-choice' + Set-SessionProperty $session $option[1] '' + $action = "CraftLoadOption$number" + $(if ($scope -eq '1') { 'M' } else { 'U' }) + if ($session.DoAction($action) -ne 1) { throw 'Saved-option property action failed.' } + $expected = if ($scope -eq '1') { 'saved-machine-choice' } else { 'saved-user-choice' } + if ((Get-SessionProperty $session $option[1]) -ne $expected) { throw 'Saved installer choices leaked across contexts.' } + } + } + $registry = @(Read-Rows $database 'SELECT `Root`, `Key`, `Name`, `Value` FROM `Registry`' 4) + if (@($registry | Where-Object { $_[0] -in '1', '2' }).Count) { throw 'Registration must follow the selected context, not force HKCU or HKLM.' } + if (@($registry | Where-Object { $_[0] -eq '0' -and $_[1] -match '^Software\\Classes(\\|$)' }).Count) { + throw 'HKCR keys must be relative to Classes.' + } + foreach ($entry in $policy.registry) { + $found = @($registry | Where-Object { $_[0] -eq $entry[0] -and $_[1] -eq $entry[1] -and $_[2] -eq $entry[2] -and $_[3] -eq $entry[3] }) + if ($found.Count -ne 1) { throw "Lost or changed registration: $($entry[1]) / $($entry[2])" } + } + $installDir = @($registry | Where-Object { $_[0] -eq '-1' -and $_[1] -eq "Software\$($policy.name)" -and $_[2] -eq 'InstallDir' -and $_[3] -eq '[INSTALLFOLDER]' }) + if ($installDir.Count -ne 1) { throw 'A context-sensitive installation-folder record is required.' } + Write-Output "PASS $($policy.name): $cases scope cases, folder preservation, action sequencing and registry contract. No installation performed." +} finally { + foreach ($com in @($session, $database, $installer)) { + if ($null -ne $com) { [void][Runtime.InteropServices.Marshal]::FinalReleaseComObject($com) } + } +} diff --git a/packaging/windows/install-policy.json b/packaging/windows/install-policy.json new file mode 100644 index 0000000000..197b2fd8f3 --- /dev/null +++ b/packaging/windows/install-policy.json @@ -0,0 +1,35 @@ +{ + "id": "lightcraft", + "name": "LightCraft", + "upgradeCode": "229BB552-5EFD-479A-BA86-8CB6D926390C", + "sources": [ + "lightcraft.wxs" + ], + "icon": "assets/app-icon/lightcraft.ico", + "localization": [], + "extensions": [ + "UI", + "Util" + ], + "payloads": [ + "FONT-LICENCES.txt", + "NOTICE", + "lightcraft-cli.exe", + "lightcraft.exe" + ], + "registry": [ + [ + "-1", + "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\lightcraft.exe", + "", + "[#LightcraftExe]" + ], + [ + "-1", + "Software\\LightCraft", + "InstallFolder", + "[INSTALLFOLDER]" + ] + ], + "mode": "dualScope" +} diff --git a/packaging/windows/install-policy.wxi b/packaging/windows/install-policy.wxi new file mode 100644 index 0000000000..afe75ee14b --- /dev/null +++ b/packaging/windows/install-policy.wxi @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packaging/windows/lightcraft.wxs b/packaging/windows/lightcraft.wxs index 9e23e54309..4c5a01a2f4 100644 --- a/packaging/windows/lightcraft.wxs +++ b/packaging/windows/lightcraft.wxs @@ -1,30 +1,11 @@ - - + + - + @@ -34,7 +15,9 @@ - + + + - + - + - @@ -96,8 +72,7 @@ - + @@ -108,8 +83,7 @@ event, so silent and passive installs never run it. Return="ignore": a failed launch must not turn a successful install into an error. --> - + @@ -152,35 +126,26 @@ whose OK validates too. --> - - - + + + - - + + - - + + - + - + @@ -194,13 +159,12 @@ - + - - + + + diff --git a/packaging/windows/package.ps1 b/packaging/windows/package.ps1 index 110d8b60c7..9cd0da6a2f 100644 --- a/packaging/windows/package.ps1 +++ b/packaging/windows/package.ps1 @@ -147,6 +147,8 @@ Invoke-Native 'wix build' { -d "UiDialogBmp=$UiDialogBmp" -d "UiBannerBmp=$UiBannerBmp" ` -o $Msi } +# Check the compiled scope, path and registration contract before signing. +& (Join-Path $PSScriptRoot 'check-install-policy.ps1') -MsiPath $Msi # wix writes its debug symbols (.wixpdb) next to the MSI; keep them out of the release assets. Remove-Item -Force -ErrorAction SilentlyContinue ([IO.Path]::ChangeExtension($Msi, '.wixpdb')) & (Join-Path $PSScriptRoot 'sign.ps1') $Msi diff --git a/packaging/windows/test-install-folder.ps1 b/packaging/windows/test-install-folder.ps1 index be7733cdc6..fcb8fdd106 100644 --- a/packaging/windows/test-install-folder.ps1 +++ b/packaging/windows/test-install-folder.ps1 @@ -41,7 +41,10 @@ try { $ns.AddNamespace('w', 'http://wixtoolset.org/schemas/v4/wxs') # Copy the real search/action authoring, changing only registry roots/keys for isolation. # Do not reimplement folder resolution here: removing the fallback must fail the legacy case. - $nodes = $source.SelectNodes('/w:Wix/w:Package/w:Property[w:RegistrySearch] | /w:Wix/w:Package/w:SetProperty[@Id="INSTALLFOLDER"]', $ns) + [xml] $scope = Get-Content (Join-Path $PSScriptRoot 'install-policy.wxi') -Raw + $scopeNs = [Xml.XmlNamespaceManager]::new($scope.NameTable) + $scopeNs.AddNamespace('w', 'http://wixtoolset.org/schemas/v4/wxs') + $nodes = $scope.SelectNodes('/w:Include/w:Property | /w:Include/w:SetProperty[@Sequence="both"]', $scopeNs) $authoring = foreach ($node in $nodes) { $copy = $node.CloneNode($true) foreach ($search in $copy.SelectNodes('.//w:RegistrySearch', $ns)) { @@ -50,11 +53,11 @@ try { } $copy.OuterXml } - $directory = $source.SelectSingleNode('/w:Wix/w:Package/w:StandardDirectory[w:Directory[@Id="INSTALLFOLDER"]]', $ns).OuterXml + $directory = $source.SelectSingleNode('/w:Wix/w:Package/w:StandardDirectory[.//w:Directory[@Id="INSTALLFOLDER"]]', $ns).OuterXml $probe = @" + Version="1.0.0" ProductCode="$product" UpgradeCode="$upgrade" Scope="perUserOrMachine"> $($authoring -join "`n") $directory @@ -77,7 +80,7 @@ try { New-Item -ItemType Directory -Path $legacy, $modern, $explicit, $emptied | Out-Null $legacyExe = Join-Path $legacy 'lightcraft.exe' [IO.File]::WriteAllText($legacyExe, 'test placeholder; never executed') - $programFiles = if ($Arch -eq 'x86' -and ${env:ProgramFiles(x86)}) { ${env:ProgramFiles(x86)} } else { $env:ProgramFiles } + $programFiles = Join-Path ([Environment]::GetFolderPath('LocalApplicationData')) 'Programs\ArtCraft' $cases = @( @{ Name = 'fresh'; Expected = (Join-Path $programFiles 'LightCraft') }, @{ Name = 'legacy-app-paths'; Legacy = $legacyExe; Expected = $legacy }, diff --git a/packaging/windows/test-install-policy.ps1 b/packaging/windows/test-install-policy.ps1 new file mode 100644 index 0000000000..21199ca7f4 --- /dev/null +++ b/packaging/windows/test-install-policy.ps1 @@ -0,0 +1,54 @@ +<# +.SYNOPSIS + Build non-executable installer metadata fixtures; never install them. +#> +param( + [Parameter(Mandatory = $true)] [string] $OutputDirectory, + [ValidateSet('x64','x86','arm64')] [string[]] $Architectures = @('x64','x86','arm64') +) +$ErrorActionPreference = 'Stop' +Set-StrictMode -Version Latest +$root = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path +$policy = Get-Content -Raw -LiteralPath (Join-Path $PSScriptRoot 'install-policy.json') | ConvertFrom-Json +[void](New-Item -ItemType Directory -Force -Path $OutputDirectory) +$output = (Resolve-Path -LiteralPath $OutputDirectory).Path +Add-Type -AssemblyName System.Drawing +foreach ($arch in $Architectures) { + $stage = Join-Path $output $arch + [void](New-Item -ItemType Directory -Force -Path $stage) + foreach ($name in $policy.payloads) { + $destination = Join-Path $stage $name + [void](New-Item -ItemType Directory -Force -Path ([IO.Path]::GetDirectoryName($destination))) + Set-Content -LiteralPath $destination -Encoding Ascii -Value 'NON-EXECUTABLE MSI METADATA TEST FIXTURE' + } + foreach ($folder in @('docs','models','notices')) { + $path = Join-Path $stage $folder + [void](New-Item -ItemType Directory -Force -Path $path) + Set-Content -LiteralPath (Join-Path $path "$folder-fixture.txt") -Value 'Metadata test fixture, not a user file or model.' + } + foreach ($model in @('metadata-one.rten','metadata-two.rten')) { + Set-Content -LiteralPath (Join-Path (Join-Path $stage 'models') $model) -Encoding Ascii -Value 'NON-EXECUTABLE MODEL METADATA FIXTURE' + } + foreach ($spec in @(@('banner.bmp',493,58),@('dialog.bmp',493,312))) { + $bitmap = [Drawing.Bitmap]::new($spec[1],$spec[2],[Drawing.Imaging.PixelFormat]::Format24bppRgb) + try { $bitmap.Save((Join-Path $stage $spec[0]),[Drawing.Imaging.ImageFormat]::Bmp) } + finally { $bitmap.Dispose() } + } + Set-Content -LiteralPath (Join-Path $stage 'licence.rtf') -Encoding Ascii -Value '{\rtf1 Metadata test fixture.}' + $sources = @($policy.sources | ForEach-Object { Join-Path $PSScriptRoot $_ }) + $msi = Join-Path $stage "$($policy.id)-NOT-INSTALLABLE.msi" + $extensions = @($policy.extensions | ForEach-Object { '-ext'; "WixToolset.$_.wixext" }) + & wix build @sources -arch $arch -wx @extensions ` + -culture en-US -d 'Version=0.0.1' -d 'DisplayVersion=0.0.1-metadata-test' ` + -d "BinDir=$stage" -d "IconPath=$(Join-Path $root $policy.icon)" ` + -d "DocsDir=$(Join-Path $stage 'docs')" -d "ModelsDir=$(Join-Path $stage 'models')" ` + -d "AppNoticesDir=$(Join-Path $stage 'notices')" -d 'HasCraftFontLicences=1' -d 'HasCli=1' ` + -d "BannerBmp=$(Join-Path $stage 'banner.bmp')" -d "DialogBmp=$(Join-Path $stage 'dialog.bmp')" ` + -d "UiBannerBmp=$(Join-Path $stage 'banner.bmp')" -d "UiDialogBmp=$(Join-Path $stage 'dialog.bmp')" ` + -d "LicenseRtf=$(Join-Path $stage 'licence.rtf')" -o $msi @($policy.localization | ForEach-Object { '-loc'; Join-Path $PSScriptRoot $_ }) + if ($LASTEXITCODE -ne 0) { throw "WiX validation failed for $arch (exit $LASTEXITCODE)." } + $shell = (Get-Process -Id $PID).Path + & $shell -NoProfile -ExecutionPolicy Bypass -File (Join-Path $PSScriptRoot 'check-install-policy.ps1') -MsiPath $msi + if ($LASTEXITCODE -ne 0) { throw "Compiled installer policy failed for $arch (exit $LASTEXITCODE)." } + Write-Output "PASS $arch metadata-only package. This is not an executable installer." +} From bf869209803ccbf537064f0ca5022ba1d883d32c Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 27 Oct 2026 10:49:52 +0000 Subject: [PATCH 21/93] fix(installer): address scope and ARM64 review feedback --- .github/workflows/windows-arm64.yml | 6 +- packaging/windows/check-install-policy.ps1 | 66 +++++++++++++++++++++- packaging/windows/install-policy.wxi | 6 +- 3 files changed, 72 insertions(+), 6 deletions(-) diff --git a/.github/workflows/windows-arm64.yml b/.github/workflows/windows-arm64.yml index 3321939985..ea74625b94 100644 --- a/.github/workflows/windows-arm64.yml +++ b/.github/workflows/windows-arm64.yml @@ -27,8 +27,10 @@ permissions: jobs: windows-arm64: - # Intentionally tracked at @main (not SHA-pinned) so org-wide CI improvements, security fixes, and build optimizations propagate without PR churn across all craftapp repos. - uses: storytold/craft-common-actions/.github/workflows/windows-arm64.yml@main + # Immutable supporting workflow revision until the new install contract lands upstream. + uses: Jeremy8776/craft-common-actions/.github/workflows/windows-arm64.yml@f4666d5cbf35f9bdeda24f1f88c7fb5c6adf5276 with: app-name: lightcraft app-dir: LightCraft + install-relative-path: Programs/ArtCraft/LightCraft + install-scope: perUser diff --git a/packaging/windows/check-install-policy.ps1 b/packaging/windows/check-install-policy.ps1 index dd28956435..00b683d708 100644 --- a/packaging/windows/check-install-policy.ps1 +++ b/packaging/windows/check-install-policy.ps1 @@ -131,9 +131,12 @@ try { } $ui = @{} foreach ($row in (Read-Rows $database 'SELECT `Action`, `Sequence` FROM `InstallUISequence`' 2)) { $ui[$row[0]] = [int]$row[1] } - if (-not ($ui['AppSearch'] -lt $ui['CraftScopeDlg'] -and $ui['CraftScopeDlg'] -lt $ui['LaunchConditions'] -and + if (-not ($ui['AppSearch'] -lt $ui['CraftPreferMachineScope'] -and + $ui['CraftPreferMachineScope'] -lt $ui['CraftScopeDlg'] -and + $ui['CraftScopeDlg'] -lt $ui['FindRelatedProducts'] -and + $ui['FindRelatedProducts'] -lt $ui['LaunchConditions'] -and $ui['CraftScopeDlg'] -lt $ui['CraftRestoreUserFolder'] -and $ui['CraftRestoreUserFolder'] -lt $ui['CostInitialize'])) { - throw 'Scope must be chosen after discovery and before duplicate checks, folder restoration and costing.' + throw 'Scope must be chosen after AppSearch and before FindRelatedProducts, launch checks and costing.' } $execute = @{} foreach ($row in (Read-Rows $database 'SELECT `Action`, `Sequence` FROM `InstallExecuteSequence`' 2)) { $execute[$row[0]] = [int]$row[1] } @@ -144,7 +147,18 @@ try { } # Switching the first-page choice must reset BOTH properties, including a back-and-forth change. $events = @(Read-Rows $database 'SELECT `Event`, `Argument`, `Condition`, `Ordering` FROM `ControlEvent` WHERE `Dialog_` = ''CraftScopeDlg'' AND `Control_` = ''Next'' ORDER BY `Ordering`' 4) - foreach ($choice in @('user','machine','user')) { + # Model the full-UI upgrade entry with an existing machine-wide copy. Run + # the actual preference action, then the compiled Next events before discovery. + Set-SessionProperty $session 'ALLUSERS' '2' + Set-SessionProperty $session 'CRAFT_SCOPE' 'user' + Set-SessionProperty $session 'CRAFT_USER_DIR' '' + Set-SessionProperty $session 'CRAFT_MACHINE_DIR' 'E:\Existing machine app' + $preference = @(Read-Rows $database 'SELECT `Condition` FROM `InstallUISequence` WHERE `Action` = ''CraftPreferMachineScope''' 1)[0] + if ($session.EvaluateCondition($preference[0]) -ne 1 -or $session.DoAction('CraftPreferMachineScope') -ne 1 -or + (Get-SessionProperty $session 'CRAFT_SCOPE') -ne 'machine') { + throw 'Full-UI machine upgrades must initially select the existing machine context.' + } + foreach ($choice in @('machine','user','machine','user')) { Set-SessionProperty $session 'CRAFT_SCOPE' $choice foreach ($event in $events) { if ($event[0] -notmatch '^\[([^\]]+)\]$') { continue } @@ -176,6 +190,52 @@ try { if ((Get-SessionProperty $session $option[1]) -ne $expected) { throw 'Saved installer choices leaked across contexts.' } } } + # Follow the compiled control conditions, not the source's intended appearance. + $controls = @(Read-Rows $database 'SELECT `Dialog_`, `Control`, `Type`, `Attributes`, `Text` FROM `Control`' 5) + $conditions = @() + if (@(Read-Rows $database 'SELECT `Name` FROM `_Tables` WHERE `Name` = ''ControlCondition''' 1).Count) { + $conditions = @(Read-Rows $database 'SELECT `Dialog_`, `Control_`, `Action`, `Condition` FROM `ControlCondition`' 4) + } + function Test-ControlVisible($Control) { + $visible = ([int]$Control[3] -band 1) -ne 0 + foreach ($condition in $conditions) { + if ($condition[0] -eq $Control[0] -and $condition[1] -eq $Control[1] -and $session.EvaluateCondition($condition[3]) -eq 1) { + if ($condition[2] -eq 'Show') { $visible = $true } + if ($condition[2] -eq 'Hide') { $visible = $false } + } + } + return $visible + } + foreach ($button in @($controls | Where-Object { $_[0] -in 'InstallWelcome','InstallMaintenance','DesktopShortcutDlg' -and ([int]$_[3] -band 8388608) -ne 0 })) { + $plain = @($controls | Where-Object { $_[0] -eq $button[0] -and $_[1] -eq ($button[1] + 'User') }) + if ($plain.Count -ne 1 -or ([int]$plain[0][3] -band 8388608)) { throw 'Scope-aware buttons need an unshielded per-user counterpart.' } + foreach ($scope in @('', '2', '1')) { + Set-SessionProperty $session 'ALLUSERS' $scope + if ((Test-ControlVisible $button) -ne ($scope -eq '1') -or (Test-ControlVisible $plain[0]) -ne ($scope -ne '1')) { + throw 'The elevation shield must follow the selected scope.' + } + } + $dialog = $button[0]; $shieldId = $button[1]; $plainId = $plain[0][1] + $shieldEvents = @(Read-Rows $database "SELECT ``Event``, ``Argument``, ``Condition``, ``Ordering`` FROM ``ControlEvent`` WHERE ``Dialog_`` = '$dialog' AND ``Control_`` = '$shieldId' ORDER BY ``Ordering``" 4 | ForEach-Object { $_ -join '|' }) + $plainEvents = @(Read-Rows $database "SELECT ``Event``, ``Argument``, ``Condition``, ``Ordering`` FROM ``ControlEvent`` WHERE ``Dialog_`` = '$dialog' AND ``Control_`` = '$plainId' ORDER BY ``Ordering``" 4 | ForEach-Object { $_ -join '|' }) + if (($shieldEvents -join "`n") -ne ($plainEvents -join "`n")) { throw 'Per-user and machine buttons must perform the same operation.' } + } + foreach ($scope in @('', '2', '1')) { + Set-SessionProperty $session 'ALLUSERS' $scope + foreach ($text in @($controls | Where-Object { $_[4] -like '*for all users*' })) { + if ((Test-ControlVisible $text) -ne ($scope -eq '1')) { throw 'The welcome-page scope text must follow the selected scope.' } + } + } + if ($policy.id -in 'deckcraft','filmcraft','soundcraft') { + foreach ($route in @(@('WelcomeDlg','Next','InstallDirDlg'),@('InstallDirDlg','Back','WelcomeDlg'))) { + $dialog = $route[0]; $control = $route[1] + $routes = @(Read-Rows $database "SELECT ``Argument``, ``Condition`` FROM ``ControlEvent`` WHERE ``Dialog_`` = '$dialog' AND ``Control_`` = '$control' AND ``Event`` = 'NewDialog' ORDER BY ``Ordering``" 2) + Set-SessionProperty $session 'Installed' '' + $destination = '' + foreach ($event in $routes) { if ($session.EvaluateCondition($event[1]) -eq 1) { $destination = $event[0] } } + if ($destination -ne $route[2]) { throw 'Skipping the licence page must work in both navigation directions.' } + } + } $registry = @(Read-Rows $database 'SELECT `Root`, `Key`, `Name`, `Value` FROM `Registry`' 4) if (@($registry | Where-Object { $_[0] -in '1', '2' }).Count) { throw 'Registration must follow the selected context, not force HKCU or HKLM.' } if (@($registry | Where-Object { $_[0] -eq '0' -and $_[1] -match '^Software\\Classes(\\|$)' }).Count) { diff --git a/packaging/windows/install-policy.wxi b/packaging/windows/install-policy.wxi index afe75ee14b..b0f1c5b1e9 100644 --- a/packaging/windows/install-policy.wxi +++ b/packaging/windows/install-policy.wxi @@ -50,5 +50,9 @@ - + + + + + From 148cc09be12aaa38f9622823d1ff0f7d92502f4e Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 27 Oct 2026 11:46:17 +0000 Subject: [PATCH 22/93] fix(installer): harden install-policy checks and packaging-lint workflow --- .github/workflows/packaging-lint.yml | 9 +++++++-- packaging/windows/check-install-policy.ps1 | 13 ++++++++++--- packaging/windows/test-install-policy.ps1 | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/packaging-lint.yml b/.github/workflows/packaging-lint.yml index 04af180059..dff954e931 100644 --- a/.github/workflows/packaging-lint.yml +++ b/.github/workflows/packaging-lint.yml @@ -44,6 +44,8 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Install the pinned packaging toolchain shell: pwsh run: | @@ -51,8 +53,11 @@ jobs: dotnet tool install --tool-path $tools wix --version 5.0.2 if ($LASTEXITCODE -ne 0) { throw 'WiX installation failed.' } $tools >> $env:GITHUB_PATH - & (Join-Path $tools 'wix.exe') extension add -g WixToolset.UI.wixext/5.0.2 WixToolset.Util.wixext/5.0.2 - if ($LASTEXITCODE -ne 0) { throw 'WiX extension installation failed.' } + $policy = Get-Content -Raw -LiteralPath packaging/windows/install-policy.json | ConvertFrom-Json + foreach ($extension in @($policy.extensions)) { + & (Join-Path $tools 'wix.exe') extension add -g "WixToolset.$extension.wixext/5.0.2" + if ($LASTEXITCODE -ne 0) { throw "WiX extension $extension installation failed." } + } - name: Build and check non-executable installer fixtures shell: pwsh run: ./packaging/windows/test-install-policy.ps1 -OutputDirectory (Join-Path $env:RUNNER_TEMP 'craft-install-policy-tests') diff --git a/packaging/windows/check-install-policy.ps1 b/packaging/windows/check-install-policy.ps1 index 00b683d708..451295a2e4 100644 --- a/packaging/windows/check-install-policy.ps1 +++ b/packaging/windows/check-install-policy.ps1 @@ -122,9 +122,11 @@ try { Set-SessionProperty $session 'CRAFT_USER_DIR' 'D:\Existing user app' Set-SessionProperty $session 'CRAFT_MACHINE_DIR' 'E:\Existing machine app' $action = if ($scope -eq '1') { 'CraftRestoreMachineFolder' } else { 'CraftRestoreUserFolder' } - if (-not $explicit) { - if ($session.DoAction($action) -ne 1) { throw 'Remembered-folder property action failed.' } - } + # Evaluate the compiled condition, so the test exercises it instead of calling the action directly. + $restore = @(Read-Rows $database ('SELECT `Condition` FROM `InstallExecuteSequence` WHERE `Action` = ''{0}''' -f $action) 1)[0] + $selected = $session.EvaluateCondition($restore[0]) -eq 1 + if ($selected -eq [bool]$explicit) { throw "$action must run only when no folder was supplied (condition: $($restore[0]))." } + if ($selected -and $session.DoAction($action) -ne 1) { throw 'Remembered-folder property action failed.' } $expected = if ($explicit) { $explicit } elseif ($scope -eq '1') { 'E:\Existing machine app' } else { 'D:\Existing user app' } if ((Get-SessionProperty $session 'INSTALLFOLDER') -ne $expected) { throw 'Custom or remembered folder was not preserved.' } } @@ -145,6 +147,11 @@ try { throw 'Silent updates must restore the folder before directory costing.' } } + foreach ($resolver in @('CraftUFromLegacyExe','CraftMFromLegacyExe')) { + if (-not ($execute['AppSearch'] -lt $execute[$resolver] -and $execute[$resolver] -lt $execute['LaunchConditions'])) { + throw 'Both legacy folder resolvers must run after AppSearch and before the launch checks.' + } + } # Switching the first-page choice must reset BOTH properties, including a back-and-forth change. $events = @(Read-Rows $database 'SELECT `Event`, `Argument`, `Condition`, `Ordering` FROM `ControlEvent` WHERE `Dialog_` = ''CraftScopeDlg'' AND `Control_` = ''Next'' ORDER BY `Ordering`' 4) # Model the full-UI upgrade entry with an existing machine-wide copy. Run diff --git a/packaging/windows/test-install-policy.ps1 b/packaging/windows/test-install-policy.ps1 index 21199ca7f4..d455d19d16 100644 --- a/packaging/windows/test-install-policy.ps1 +++ b/packaging/windows/test-install-policy.ps1 @@ -38,7 +38,7 @@ foreach ($arch in $Architectures) { $sources = @($policy.sources | ForEach-Object { Join-Path $PSScriptRoot $_ }) $msi = Join-Path $stage "$($policy.id)-NOT-INSTALLABLE.msi" $extensions = @($policy.extensions | ForEach-Object { '-ext'; "WixToolset.$_.wixext" }) - & wix build @sources -arch $arch -wx @extensions ` + & wix build @sources -arch $arch @extensions ` -culture en-US -d 'Version=0.0.1' -d 'DisplayVersion=0.0.1-metadata-test' ` -d "BinDir=$stage" -d "IconPath=$(Join-Path $root $policy.icon)" ` -d "DocsDir=$(Join-Path $stage 'docs')" -d "ModelsDir=$(Join-Path $stage 'models')" ` From 3d40cf08e7db722cadfb0737c10209fedbbb7091 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 27 Oct 2026 12:09:03 +0000 Subject: [PATCH 23/93] docs(installer): describe the per-user default install location and scope --- README.md | 5 +++-- README.zh-hans.md | 5 +++-- README.zh-hant.md | 5 +++-- docs/mcp.md | 6 +++--- docs/user/getting-started/install.md | 4 ++-- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 71f30d4c26..c438a91b19 100644 --- a/README.md +++ b/README.md @@ -563,8 +563,9 @@ Questions, ideas or a bug you'd like to talk through first? Bring them to [Disco | arm64 (Snapdragon and other ARM PCs) | `lightcraft--windows-arm64.msi` | `lightcraft--windows-arm64-portable.zip` | | x86 (32-bit) | `lightcraft--windows-x86.msi` | `lightcraft--windows-x86-portable.zip` | -Installers and executables are code-signed. The installer asks where to install (`C:\Program Files\LightCraft` by -default; upgrades stay in the folder you chose) and ends on a page confirming LightCraft was installed, with an +Installers and executables are code-signed. The installer asks who to install for and where (for your account only, in +`%LOCALAPPDATA%\Programs\ArtCraft\LightCraft`, by default; "Everyone on this computer" uses +`C:\Program Files\ArtCraft\LightCraft`; upgrades stay in the folder you chose) and ends on a page confirming LightCraft was installed, with an option to start it. For unattended installs: `msiexec /i lightcraft--windows-x64.msi /qn INSTALLFOLDER="D:\Apps\LightCraft\"`. ### macOS diff --git a/README.zh-hans.md b/README.zh-hans.md index 2c6ca81916..f7c0808cf6 100644 --- a/README.zh-hans.md +++ b/README.zh-hans.md @@ -484,8 +484,9 @@ egui 前端是一个可替换的 crate;它下面没有任何东西知道 UI | arm64(骁龙及其他 ARM PC) | `lightcraft--windows-arm64.msi` | `lightcraft--windows-arm64-portable.zip` | | x86(32 位) | `lightcraft--windows-x86.msi` | `lightcraft--windows-x86-portable.zip` | -安装程序和可执行文件都有代码签名。安装程序会询问安装位置(默认 -`C:\Program Files\LightCraft`;升级会留在你选择的文件夹),结束时有一页确认 LightCraft 已安装, +安装程序和可执行文件都有代码签名。安装程序会询问为谁安装以及安装位置(默认仅为当前账户,安装到 +`%LOCALAPPDATA%\Programs\ArtCraft\LightCraft`;选择“这台计算机上的所有人”则安装到 +`C:\Program Files\ArtCraft\LightCraft`;升级会留在你选择的文件夹),结束时有一页确认 LightCraft 已安装, 并可选择启动它。无人值守安装:`msiexec /i lightcraft--windows-x64.msi /qn INSTALLFOLDER="D:\Apps\LightCraft\"`。 ### macOS diff --git a/README.zh-hant.md b/README.zh-hant.md index ca624ce68b..0b52419a83 100644 --- a/README.zh-hant.md +++ b/README.zh-hant.md @@ -514,8 +514,9 @@ egui 前端是一個可替換的 crate;它之下沒有任何東西知道 UI | arm64(Snapdragon 及其他 ARM PC) | `lightcraft--windows-arm64.msi` | `lightcraft--windows-arm64-portable.zip` | | x86(32 位元) | `lightcraft--windows-x86.msi` | `lightcraft--windows-x86-portable.zip` | -安裝程式與執行檔都有程式碼簽章。安裝程式會詢問安裝位置(預設為 -`C:\Program Files\LightCraft`;升級時會留在你選擇的資料夾),結束時會有一頁確認 LightCraft 已安裝, +安裝程式與執行檔都有程式碼簽章。安裝程式會詢問為誰安裝以及安裝位置(預設僅為目前帳戶,安裝到 +`%LOCALAPPDATA%\Programs\ArtCraft\LightCraft`;選擇「這台電腦上的所有人」則安裝到 +`C:\Program Files\ArtCraft\LightCraft`;升級時會留在你選擇的資料夾),結束時會有一頁確認 LightCraft 已安裝, 並可選擇立即啟動。無訊息安裝:`msiexec /i lightcraft--windows-x64.msi /qn INSTALLFOLDER="D:\Apps\LightCraft\"`。 ### macOS diff --git a/docs/mcp.md b/docs/mcp.md index 4800c37d81..7be25f7f09 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -96,13 +96,13 @@ The release packages ship `lightcraft-cli` alongside the desktop app, so no buil | Install | CLI | |---|---| -| Windows (MSI) | `C:\Program Files\LightCraft\lightcraft-cli.exe` by default (wherever you installed it otherwise), not on `PATH` | +| Windows (MSI) | `%LOCALAPPDATA%\Programs\ArtCraft\LightCraft\lightcraft-cli.exe` by default (`C:\Program Files\ArtCraft\LightCraft\lightcraft-cli.exe` for an all-users install, or wherever you installed it otherwise), not on `PATH` | | Linux (deb, rpm) | `/usr/bin/lightcraft-cli` | | macOS | the separate `lightcraft-cli--macos-.zip` release asset (the `.app` holds only the desktop app) | ```sh -# Windows, default install folder -claude mcp add lightcraft -- "C:\Program Files\LightCraft\lightcraft-cli.exe" mcp +# Windows (PowerShell), default install folder +claude mcp add lightcraft -- "$env:LOCALAPPDATA\Programs\ArtCraft\LightCraft\lightcraft-cli.exe" mcp # Linux, or macOS with the CLI unzipped onto PATH claude mcp add lightcraft -- lightcraft-cli mcp ``` diff --git a/docs/user/getting-started/install.md b/docs/user/getting-started/install.md index 8327222cb8..a63157d987 100644 --- a/docs/user/getting-started/install.md +++ b/docs/user/getting-started/install.md @@ -11,12 +11,12 @@ Download the file for your system from the [latest release](https://github.com/s 1. Open the [latest release](https://github.com/storytold/lightcraft/releases/latest). 2. Download `lightcraft--windows-x64.msi`. It fits most PCs (Intel and AMD, 64-bit). -3. Run the file. The installer asks where to install. The default is `C:\Program Files\LightCraft`, and upgrades stay in the folder you chose. +3. Run the file. The first page asks who to install LightCraft for. "Only for me" is the default: it needs no administrator permission and installs to `%LOCALAPPDATA%\Programs\ArtCraft\LightCraft`. "Everyone on this computer" asks for an administrator and installs to `C:\Program Files\ArtCraft\LightCraft`. Upgrades stay in the folder you chose. 4. At the end, choose the option to start LightCraft. For a Snapdragon or other Arm PC, download `lightcraft--windows-arm64.msi` instead. For a 32-bit Windows, download `lightcraft--windows-x86.msi`. -Upgrading from an installer older than 0.6.0 also keeps LightCraft in the folder it was installed in. If that folder was deleted, the upgrade installs to `C:\Program Files\LightCraft`. +Upgrading from an installer older than 0.6.0 also keeps LightCraft in the folder it was installed in. If that folder was deleted, the upgrade installs to the default folder for the scope you choose. To run it without installing, download `lightcraft--windows-x64-portable.zip`. Portable builds for `arm64` and `x86` are on the release page too. From 51ecbfece86c0c6ce481d20d5aab9afab7641b2f Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 27 Oct 2026 12:25:19 +0000 Subject: [PATCH 24/93] docs(installer): note that the 32-bit all-users folder is Program Files (x86); tidy wording --- README.md | 2 +- README.zh-hans.md | 2 +- README.zh-hant.md | 2 +- docs/mcp.md | 2 +- docs/user/getting-started/install.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c438a91b19..cac5794deb 100644 --- a/README.md +++ b/README.md @@ -565,7 +565,7 @@ Questions, ideas or a bug you'd like to talk through first? Bring them to [Disco Installers and executables are code-signed. The installer asks who to install for and where (for your account only, in `%LOCALAPPDATA%\Programs\ArtCraft\LightCraft`, by default; "Everyone on this computer" uses -`C:\Program Files\ArtCraft\LightCraft`; upgrades stay in the folder you chose) and ends on a page confirming LightCraft was installed, with an +`C:\Program Files\ArtCraft\LightCraft` (`Program Files (x86)` for the 32-bit build); upgrades stay in the folder you chose) and ends on a page confirming LightCraft was installed, with an option to start it. For unattended installs: `msiexec /i lightcraft--windows-x64.msi /qn INSTALLFOLDER="D:\Apps\LightCraft\"`. ### macOS diff --git a/README.zh-hans.md b/README.zh-hans.md index f7c0808cf6..4acc44bea8 100644 --- a/README.zh-hans.md +++ b/README.zh-hans.md @@ -486,7 +486,7 @@ egui 前端是一个可替换的 crate;它下面没有任何东西知道 UI 安装程序和可执行文件都有代码签名。安装程序会询问为谁安装以及安装位置(默认仅为当前账户,安装到 `%LOCALAPPDATA%\Programs\ArtCraft\LightCraft`;选择“这台计算机上的所有人”则安装到 -`C:\Program Files\ArtCraft\LightCraft`;升级会留在你选择的文件夹),结束时有一页确认 LightCraft 已安装, +`C:\Program Files\ArtCraft\LightCraft`(32 位版本为 `Program Files (x86)`);升级会留在你选择的文件夹),结束时有一页确认 LightCraft 已安装, 并可选择启动它。无人值守安装:`msiexec /i lightcraft--windows-x64.msi /qn INSTALLFOLDER="D:\Apps\LightCraft\"`。 ### macOS diff --git a/README.zh-hant.md b/README.zh-hant.md index 0b52419a83..ef264806aa 100644 --- a/README.zh-hant.md +++ b/README.zh-hant.md @@ -516,7 +516,7 @@ egui 前端是一個可替換的 crate;它之下沒有任何東西知道 UI 安裝程式與執行檔都有程式碼簽章。安裝程式會詢問為誰安裝以及安裝位置(預設僅為目前帳戶,安裝到 `%LOCALAPPDATA%\Programs\ArtCraft\LightCraft`;選擇「這台電腦上的所有人」則安裝到 -`C:\Program Files\ArtCraft\LightCraft`;升級時會留在你選擇的資料夾),結束時會有一頁確認 LightCraft 已安裝, +`C:\Program Files\ArtCraft\LightCraft`(32 位元版本為 `Program Files (x86)`);升級時會留在你選擇的資料夾),結束時會有一頁確認 LightCraft 已安裝, 並可選擇立即啟動。無訊息安裝:`msiexec /i lightcraft--windows-x64.msi /qn INSTALLFOLDER="D:\Apps\LightCraft\"`。 ### macOS diff --git a/docs/mcp.md b/docs/mcp.md index 7be25f7f09..2c155e72c0 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -96,7 +96,7 @@ The release packages ship `lightcraft-cli` alongside the desktop app, so no buil | Install | CLI | |---|---| -| Windows (MSI) | `%LOCALAPPDATA%\Programs\ArtCraft\LightCraft\lightcraft-cli.exe` by default (`C:\Program Files\ArtCraft\LightCraft\lightcraft-cli.exe` for an all-users install, or wherever you installed it otherwise), not on `PATH` | +| Windows (MSI) | `%LOCALAPPDATA%\Programs\ArtCraft\LightCraft\lightcraft-cli.exe` by default (`C:\Program Files\ArtCraft\LightCraft\lightcraft-cli.exe` for an all-users install, under `Program Files (x86)` instead for the 32-bit build, or wherever you installed it otherwise), not on `PATH` | | Linux (deb, rpm) | `/usr/bin/lightcraft-cli` | | macOS | the separate `lightcraft-cli--macos-.zip` release asset (the `.app` holds only the desktop app) | diff --git a/docs/user/getting-started/install.md b/docs/user/getting-started/install.md index a63157d987..255a6a5ed6 100644 --- a/docs/user/getting-started/install.md +++ b/docs/user/getting-started/install.md @@ -11,7 +11,7 @@ Download the file for your system from the [latest release](https://github.com/s 1. Open the [latest release](https://github.com/storytold/lightcraft/releases/latest). 2. Download `lightcraft--windows-x64.msi`. It fits most PCs (Intel and AMD, 64-bit). -3. Run the file. The first page asks who to install LightCraft for. "Only for me" is the default: it needs no administrator permission and installs to `%LOCALAPPDATA%\Programs\ArtCraft\LightCraft`. "Everyone on this computer" asks for an administrator and installs to `C:\Program Files\ArtCraft\LightCraft`. Upgrades stay in the folder you chose. +3. Run the file. The first page asks who to install LightCraft for. **Only for me** is the default: it needs no administrator permission and installs to `%LOCALAPPDATA%\Programs\ArtCraft\LightCraft`. **Everyone on this computer** asks for an administrator and installs to `C:\Program Files\ArtCraft\LightCraft` (`Program Files (x86)` for the 32-bit build). Upgrades stay in the folder you chose. 4. At the end, choose the option to start LightCraft. For a Snapdragon or other Arm PC, download `lightcraft--windows-arm64.msi` instead. For a 32-bit Windows, download `lightcraft--windows-x86.msi`. From ea5db140fb07b7b5ab08019e2aa7311f35d38283 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 27 Oct 2026 12:26:56 +0000 Subject: [PATCH 25/93] docs(installer): say that silent installs are per-user and when the scope page appears --- README.md | 2 ++ README.zh-hans.md | 1 + README.zh-hant.md | 1 + 3 files changed, 4 insertions(+) diff --git a/README.md b/README.md index cac5794deb..6c556e46f4 100644 --- a/README.md +++ b/README.md @@ -567,6 +567,8 @@ Installers and executables are code-signed. The installer asks who to install fo `%LOCALAPPDATA%\Programs\ArtCraft\LightCraft`, by default; "Everyone on this computer" uses `C:\Program Files\ArtCraft\LightCraft` (`Program Files (x86)` for the 32-bit build); upgrades stay in the folder you chose) and ends on a page confirming LightCraft was installed, with an option to start it. For unattended installs: `msiexec /i lightcraft--windows-x64.msi /qn INSTALLFOLDER="D:\Apps\LightCraft\"`. +A silent install is per-user by default. `INSTALLFOLDER` chooses the folder, not who it is installed for; +add `ALLUSERS=1`, from an elevated terminal or deployment tool, for an all-users install. ### macOS diff --git a/README.zh-hans.md b/README.zh-hans.md index 4acc44bea8..fa782ba10f 100644 --- a/README.zh-hans.md +++ b/README.zh-hans.md @@ -488,6 +488,7 @@ egui 前端是一个可替换的 crate;它下面没有任何东西知道 UI `%LOCALAPPDATA%\Programs\ArtCraft\LightCraft`;选择“这台计算机上的所有人”则安装到 `C:\Program Files\ArtCraft\LightCraft`(32 位版本为 `Program Files (x86)`);升级会留在你选择的文件夹),结束时有一页确认 LightCraft 已安装, 并可选择启动它。无人值守安装:`msiexec /i lightcraft--windows-x64.msi /qn INSTALLFOLDER="D:\Apps\LightCraft\"`。 +静默安装默认仅为当前用户安装。`INSTALLFOLDER` 只决定安装文件夹,不决定为谁安装;若要为所有用户安装,请在提升权限的终端或部署工具中加上 `ALLUSERS=1`。 ### macOS diff --git a/README.zh-hant.md b/README.zh-hant.md index ef264806aa..07ac908d2d 100644 --- a/README.zh-hant.md +++ b/README.zh-hant.md @@ -518,6 +518,7 @@ egui 前端是一個可替換的 crate;它之下沒有任何東西知道 UI `%LOCALAPPDATA%\Programs\ArtCraft\LightCraft`;選擇「這台電腦上的所有人」則安裝到 `C:\Program Files\ArtCraft\LightCraft`(32 位元版本為 `Program Files (x86)`);升級時會留在你選擇的資料夾),結束時會有一頁確認 LightCraft 已安裝, 並可選擇立即啟動。無訊息安裝:`msiexec /i lightcraft--windows-x64.msi /qn INSTALLFOLDER="D:\Apps\LightCraft\"`。 +無訊息安裝預設僅為目前使用者安裝。`INSTALLFOLDER` 只決定安裝資料夾,不決定為誰安裝;若要為所有使用者安裝,請在提升權限的終端機或部署工具中加上 `ALLUSERS=1`。 ### macOS From 3a3e49af53aeff55248419234a05d1a262094092 Mon Sep 17 00:00:00 2001 From: aiongg <67543387+aiongg@users.noreply.github.com> Date: Tue, 27 Oct 2026 10:27:42 -0400 Subject: [PATCH 26/93] fix(ui): dropdown menus grow back after a search with no matches (#3154) * Use craft-ui's dropdown so menus grow back after shrinking The album picker keeps its choices and search field in a fixed header and scrolls only the list; combo_box and the print dialog's combos use craft_ui::ComboBox. egui::ComboBox is now disallowed by clippy. * chore(deps): craft-libs 60d60d48 (dropdown fixes) * chore(deps): craft-libs 6af63481 (dropdown fixes) * chore(deps): craft-libs 4d7b82f7 (dropdown fixes) * chore(deps): craft-libs 92d392cf (#387 merged) --- Cargo.lock | 380 ++++++++++++++++++++- Cargo.toml | 8 +- clippy.toml | 3 + crates/ui-egui/src/dialogs/print_view.rs | 4 +- crates/ui-egui/src/tests/album_picker.rs | 42 +++ crates/ui-egui/src/widgets.rs | 4 +- crates/ui-egui/src/widgets/album_picker.rs | 294 ++++++++-------- 7 files changed, 588 insertions(+), 147 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 378669bb9b..4b52046c43 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1031,6 +1031,15 @@ dependencies = [ "error-code", ] +[[package]] +name = "cobs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" +dependencies = [ + "thiserror 2.0.21", +] + [[package]] name = "codespan-reporting" version = "0.13.1" @@ -1175,25 +1184,61 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=1e6f127844ec61b3b8afdcc2bb76e7cfe470153f#1e6f127844ec61b3b8afdcc2bb76e7cfe470153f" +source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0" + +[[package]] +name = "craft-fonts-build" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0" + +[[package]] +name = "craft-i18n" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0" +dependencies = [ + "fixed_decimal", + "icu_decimal", + "icu_locale_core", + "icu_locale_fallback", + "icu_normalizer", + "icu_plurals", + "icu_properties", + "icu_provider", + "icu_provider_adapters", + "icu_provider_blob", + "log", + "objc2-foundation 0.3.2", + "sys-locale", + "unicode-bidi", + "windows-registry", + "writeable", +] [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=1e6f127844ec61b3b8afdcc2bb76e7cfe470153f#1e6f127844ec61b3b8afdcc2bb76e7cfe470153f" +source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0" dependencies = [ + "craft-fonts-build", + "craft-i18n", "egui", + "epaint", + "js-sys", "log", "objc2 0.6.5", "objc2-app-kit 0.3.2", "objc2-foundation 0.3.2", "serde", + "skrifa", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", ] [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=1e6f127844ec61b3b8afdcc2bb76e7cfe470153f#1e6f127844ec61b3b8afdcc2bb76e7cfe470153f" +source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0" dependencies = [ "chrono", "dunce", @@ -1218,7 +1263,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=1e6f127844ec61b3b8afdcc2bb76e7cfe470153f#1e6f127844ec61b3b8afdcc2bb76e7cfe470153f" +source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0" dependencies = [ "egui", "objc2 0.6.5", @@ -1415,6 +1460,17 @@ dependencies = [ "objc2 0.6.5", ] +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + [[package]] name = "dlib" version = "0.5.3" @@ -1947,6 +2003,17 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" +[[package]] +name = "fixed_decimal" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2214fb00f669ee96bee5bb29dfb1ddabe058b2bc426817efc79afa03c9bc55ae" +dependencies = [ + "displaydoc", + "smallvec", + "writeable", +] + [[package]] name = "fixedbitset" version = "0.5.7" @@ -2803,6 +2870,183 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" +[[package]] +name = "icu_collections" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa68d21081c4a05d5a901a1c62add574c77048b6a1c67be3b50ce0b60d4ca513" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke 0.8.3", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_decimal" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eb8f655bba2d0c0459e43a5b0e6cd3cd388109898fb3d85d048165e8b0abd08" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_locale_core", + "icu_pattern", + "icu_plurals", + "icu_provider", + "serde", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56e28588da92eee5c3201a6eff33fabdd49b62269c8938d4ff050ce4d900deb" +dependencies = [ + "displaydoc", + "litemap", + "serde", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locale_fallback" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "251af8e57c9400e3eb58242fe5b8b1152b2a64fdf4cf632f923c38ccee6f2fa9" +dependencies = [ + "icu_locale_core", + "icu_locale_fallback_data", + "icu_provider", + "potential_utf", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locale_fallback_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "decf2a22ec8fa68f1a0c1129a3f8583f8f8bc24e8b9ccbe98ead99f62a4dc3a8" + +[[package]] +name = "icu_normalizer" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f9cf5f235641ed274641dd81c3f28d870e276763d0797aeeab72317b1c646f" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1563da1ed3e0b3bf3d74c9b85917ac9c56464d2f57242270c09c9e752f8021a0" + +[[package]] +name = "icu_pattern" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b3db611446bd92c246b03e4aa0bafa71ddb194af431ddbb42b9d70e4bfce1a0" +dependencies = [ + "displaydoc", + "either", + "serde", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_plurals" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e475e6766ef87b1d3c1f97be6363995b0bfaeddbc789671615df598a97ff0593" +dependencies = [ + "displaydoc", + "fixed_decimal", + "icu_provider", + "serde", + "zerovec", +] + +[[package]] +name = "icu_properties" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7ca276ad3145661a65914e6daf131ca5120cd3dcee8f8f3214b8875184a148" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e590f038c1464a96894fd6d10127e90a8be4509f56ff7ecef851b15cee0b7caa" + +[[package]] +name = "icu_provider" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d27bbb9d3abbefac45d55f647c9de1d44aafcd1186eb91879afef17c396c3e73" +dependencies = [ + "displaydoc", + "icu_locale_core", + "postcard", + "serde", + "stable_deref_trait", + "writeable", + "yoke 0.8.3", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_provider_adapters" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df887bc4f55dbc773c7c45a0c7dfa75be886f7b7812830a71ab7271cc1801820" +dependencies = [ + "icu_locale_fallback", + "icu_provider", +] + +[[package]] +name = "icu_provider_blob" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5916b44fac319d3f58e4d8d805a627df19e27937b582cd99fcde3bb6b7ce1b0e" +dependencies = [ + "icu_provider", + "postcard", + "serde", + "writeable", + "zerotrie", + "zerovec", +] + [[package]] name = "image" version = "0.25.10" @@ -3793,6 +4037,15 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" +dependencies = [ + "serde_core", +] + [[package]] name = "litrs" version = "1.0.0" @@ -4967,6 +5220,27 @@ dependencies = [ "portable-atomic", ] +[[package]] +name = "postcard" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" +dependencies = [ + "cobs", + "serde", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "serde_core", + "writeable", + "zerovec", +] + [[package]] name = "powerfmt" version = "0.2.1" @@ -6145,6 +6419,18 @@ dependencies = [ "syn 3.0.6", ] +[[package]] +name = "sys-locale" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4" +dependencies = [ + "js-sys", + "libc", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "sysctl" version = "0.5.5" @@ -6295,6 +6581,17 @@ dependencies = [ "time-core", ] +[[package]] +name = "tinystr" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e27c91459209c2986af3dcf603a5a74a4368754ce37414f59acc971167f643" +dependencies = [ + "displaydoc", + "serde_core", + "zerovec", +] + [[package]] name = "tokio" version = "1.53.1" @@ -6564,12 +6861,24 @@ dependencies = [ "log", ] +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + [[package]] name = "utf8-zero" version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8c0a043c9540bae7c578c88f91dda8bd82e59ae27c21baca69c8b191aaf5a6e" +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "uuid" version = "1.26.1" @@ -7179,6 +7488,17 @@ dependencies = [ "windows-link", ] +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result", + "windows-strings", +] + [[package]] name = "windows-result" version = "0.4.1" @@ -7406,6 +7726,21 @@ dependencies = [ "wayland-protocols-wlr", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" +dependencies = [ + "either", +] + [[package]] name = "x11-dl" version = "2.21.0" @@ -7710,6 +8045,43 @@ dependencies = [ "syn 2.0.119", ] +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "litemap", + "serde_core", + "yoke 0.8.3", + "zerofrom", + "zerovec", +] + +[[package]] +name = "zerovec" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb0464e17806c1d976d5cba29399c7f08e516e279e2ba493f63123b5fca67dd8" +dependencies = [ + "serde", + "yoke 0.8.3", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.6", +] + [[package]] name = "zip" version = "7.2.0" diff --git a/Cargo.toml b/Cargo.toml index f0a5935e6b..0686b502d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,10 +10,10 @@ rust-version = "1.95" repository = "https://github.com/storytold/lightcraft" [workspace.dependencies] -craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "1e6f127844ec61b3b8afdcc2bb76e7cfe470153f", features = ["serde"] } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "1e6f127844ec61b3b8afdcc2bb76e7cfe470153f" } -craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "1e6f127844ec61b3b8afdcc2bb76e7cfe470153f", features = ["egui"] } -craft-window = { git = "https://github.com/storytold/craft-libs", rev = "1e6f127844ec61b3b8afdcc2bb76e7cfe470153f", features = ["egui"] } +craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["serde"] } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0" } +craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["egui"] } +craft-window = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["egui"] } # internal lightcraft-denoise-core = { path = "crates/denoise-core" } lightcraft-denoise = { path = "crates/denoise", default-features = false } diff --git a/clippy.toml b/clippy.toml index 4b6c79f555..287e14edc1 100644 --- a/clippy.toml +++ b/clippy.toml @@ -2,3 +2,6 @@ allow-unwrap-in-tests = true allow-expect-in-tests = true allow-panic-in-tests = true allow-indexing-slicing-in-tests = true +disallowed-types = [ + { path = "egui::ComboBox", reason = "use craft_ui::ComboBox: egui's combo box menu can't grow back while open (egui#5225)" }, +] diff --git a/crates/ui-egui/src/dialogs/print_view.rs b/crates/ui-egui/src/dialogs/print_view.rs index 4a9940307a..82a2b564d8 100644 --- a/crates/ui-egui/src/dialogs/print_view.rs +++ b/crates/ui-egui/src/dialogs/print_view.rs @@ -407,7 +407,7 @@ fn settings(app: &mut LightcraftApp, ui: &mut Ui, t: &Tokens, pu: &mut PrintUi, heading(ui, t, "Page Setup"); row(ui, t, "Paper", |ui| { let current = current_paper(&l.page.paper); - let c = egui::ComboBox::from_id_salt("printPaper").selected_text(paper_label(current)).show_ui(ui, |ui| { + let c = craft_ui::ComboBox::from_id_salt("printPaper").selected_text(paper_label(current)).show_ui(ui, |ui| { for name in layout::paper_names().chain(std::iter::once("custom")) { if ui.selectable_label(current == name, paper_label(name)).clicked() { patch(app, &ctx, json!({"layout": {"page": {"paper": name}}})); @@ -499,7 +499,7 @@ fn print_job_color(app: &mut LightcraftApp, ui: &mut Ui, t: &Tokens, color: &Pri }; let mut pick = false; row(ui, t, "Profile", |ui| { - let c = egui::ComboBox::from_id_salt("print-profile").width(190.0).selected_text(shown.clone()).show_ui(ui, |ui| { + let c = craft_ui::ComboBox::from_id_salt("print-profile").width(190.0).selected_text(shown.clone()).show_ui(ui, |ui| { for (space, label) in [(ManagedSpace::Srgb, "Managed by Printer (sRGB)"), (ManagedSpace::AdobeRgb, "Managed by Printer (Adobe RGB)")] { let r = ui.selectable_label(color.profile == managed(space), crate::i18n::tr(label)); register(ui, format!("item:printProfile-{}", to_value(space).as_str().unwrap_or_default()), r.rect); diff --git a/crates/ui-egui/src/tests/album_picker.rs b/crates/ui-egui/src/tests/album_picker.rs index 97305cba67..c99f857705 100644 --- a/crates/ui-egui/src/tests/album_picker.rs +++ b/crates/ui-egui/src/tests/album_picker.rs @@ -119,6 +119,48 @@ fn albums_that_would_loop_are_greyed() { assert_eq!(value(&h), json!(null), "but not picked"); } +/// The registered rectangle of `id` in the current frame. +fn rect_of(h: &Headless, id: &str) -> egui::Rect { + h.app.widgets.iter().find(|(w, _)| w == id).map(|(_, r)| *r).unwrap_or_else(|| panic!("no widget {id}")) +} + +/// The height of the smallest area (the popup, not the dialog) that holds the search field, as egui keeps it between frames. +fn popup_height(h: &Headless, search: egui::Rect) -> f32 { + let ctx = &h.view.ctx; + let layers = ctx.memory(|m| m.areas().visible_layer_ids()); + layers + .into_iter() + .filter_map(|layer| egui::AreaState::load(ctx, layer.id)) + .filter(|a| a.rect().contains_rect(search)) + .filter_map(|a| a.size.map(|s| s.y)) + .fold(f32::MAX, f32::min) +} + +/// Filtering to nothing shrinks the popup and clearing the filter grows it back (egui#5225), +/// with the search field in the same place throughout. +#[test] +fn the_popup_grows_back_when_the_search_is_cleared() { + let Library { mut h, .. } = library(); + click(&mut h, "albumPicker:rules-0"); + let search = rect_of(&h, "albumPickerSearch:rules-0"); + let full = popup_height(&h, search); + assert!(full > 80.0, "the open popup shows the tree: {full}"); + let r = h.request("ui.text", json!({"text": "zzzz"}), T); + assert_eq!(r["ok"], true, "{r}"); + h.settle(SETTLE); + let none = popup_height(&h, search); + assert!(none < full - 20.0, "no match shrinks the popup: {none} vs {full}"); + assert_eq!(rect_of(&h, "albumPickerSearch:rules-0"), search, "the search field stays put"); + for _ in 0..4 { + let r = h.request("ui.key", json!({"key": "Backspace"}), T); + assert_eq!(r["ok"], true, "{r}"); + h.settle(SETTLE); + } + let again = popup_height(&h, search); + assert!((again - full).abs() < 1.0, "cleared, the popup is {again} tall, not {full} as when it opened"); + assert_eq!(rect_of(&h, "albumPickerSearch:rules-0"), search, "the search field stays put"); +} + /// After opening a folder, typing still goes to the search: the box keeps the keyboard. #[test] fn typing_after_a_folder_click_still_searches() { diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index 0a613baed1..558edfe8d3 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -9,8 +9,8 @@ use crate::icons::{Icon, paint}; use crate::theme::Tokens; /// Standard dropdown chevrons, including settings, import/export and rule editors. -pub fn combo_box(id: impl egui::AsIdSalt) -> egui::ComboBox<'static> { - egui::ComboBox::from_id_salt(id) +pub fn combo_box(id: impl egui::AsIdSalt) -> craft_ui::ComboBox<'static> { + craft_ui::ComboBox::from_id_salt(id) .icon(|ui, rect, visuals, _| { paint(ui.painter(), Rect::from_center_size(rect.center(), vec2(16.0, 16.0)), Icon::ChevronDown, visuals.fg_stroke.color); }) diff --git a/crates/ui-egui/src/widgets/album_picker.rs b/crates/ui-egui/src/widgets/album_picker.rs index 1c59bcae8e..a88e5f1aaf 100644 --- a/crates/ui-egui/src/widgets/album_picker.rs +++ b/crates/ui-egui/src/widgets/album_picker.rs @@ -166,6 +166,9 @@ struct State { focus: bool, } +/// The popup's maximum height: the search field and the list. +const MENU_HEIGHT: f32 = 320.0; + /// A button that edits an album id; see the module docs. pub struct AlbumPicker<'a> { id: String, @@ -218,151 +221,172 @@ impl<'a> AlbumPicker<'a> { let open = chosen.map(|c| ancestors(entries, c)).unwrap_or_default(); ui.data_mut(|d| d.insert_temp(key, State { open, focus: true, ..Default::default() })); } - let mut state: State = ui.data(|d| d.get_temp(key)).unwrap_or_default(); - let mut picked: Option = None; - egui::Popup::from_toggle_button_response(&button).close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside).show(|ui| { - // A wide popup remembered before a window resize must still fit the current viewport. - let margin = egui::Frame::popup(ui.style()).total_margin().sum().x; - let max_width = (ui.ctx().content_rect().width() - margin).max(1.0); - ui.set_min_width(width.max(260.0).min(max_width)); - ui.set_max_width((width.max(260.0) + 120.0).min(max_width)); - if choices(ui) { - ui.close(); - return; - } - let search_box = - ui.add(egui::TextEdit::singleline(&mut state.query).hint_text(crate::i18n::tr("Search albums")).desired_width(f32::INFINITY)); - register(ui, format!("albumPickerSearch:{id}"), search_box.rect); - if state.focus { - search_box.request_focus(); - state.focus = false; - } - if search_box.changed() { - state.highlight = 0; - } - let t = crate::theme::Tokens::get(ui.ctx()); - // `scroll`: bring the row into view (the arrow keys just moved to it); never every frame, - // which would fight the mouse wheel - let row = |ui: &mut Ui, e: &AlbumEntry, label: &str, indent: f32, highlighted: bool, scroll: bool, picked: &mut Option| { - ui.horizontal(|ui| { - ui.add_space(indent); - let (r, _) = ui.allocate_exact_size(vec2(14.0, 14.0), egui::Sense::hover()); - let icon = if e.smart { Icon::SmartAlbum } else { Icon::Album }; - crate::icons::paint(ui.painter(), r, icon, if e.blocked.is_some() { t.text_disabled } else { t.icon }); - let resp = ui - .add_enabled(e.blocked.is_none(), egui::Button::selectable(Some(e.id) == chosen || highlighted, label).truncate()) - .on_hover_text(label); - register(ui, format!("albumPickerItem:{}:{id}", e.id), resp.rect); - let resp = match &e.blocked { - Some(why) => resp.on_disabled_hover_text(why.as_str()), - None => resp, - }; - if resp.clicked() { - *picked = Some(e.id); + let state: State = ui.data(|d| d.get_temp(key)).unwrap_or_default(); + let state = std::cell::RefCell::new(state); + let picked = craft_ui::combo::Menu::new(ui, &button) + .height(MENU_HEIGHT) + .close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside) + .show_ui_with_header( + |ui| { + // A wide popup remembered before a window resize must still fit the current viewport. + let margin = egui::Frame::popup(ui.style()).total_margin().sum().x; + let max_width = (ui.ctx().content_rect().width() - margin).max(1.0); + ui.set_min_width(width.max(260.0).min(max_width)); + ui.set_max_width((width.max(260.0) + 120.0).min(max_width)); + // Esc closes the popup and stops there: the dialog around it keeps its edits + if ui.input(|i| i.key_pressed(egui::Key::Escape)) { + crate::widgets::take_escape(ui.ctx()); + ui.close(); } - if scroll { - resp.scroll_to_me(None); + if choices(ui) { + ui.close(); + return true; } - }); - }; - egui::ScrollArea::vertical().max_height(320.0).auto_shrink([false, true]).show(ui, |ui| { - if state.query.trim().is_empty() { - for i in visible_tree(entries, &state.open) { - let e = &entries[i]; - let indent = e.depth as f32 * 16.0; - if e.folder { - // a folder row folds and unfolds, like the sidebar's: triangle, icon, name - let open = state.open.contains(&e.id); - let height = ui.spacing().interact_size.y; - let (rect, r) = ui.allocate_exact_size(vec2(ui.available_width(), height), egui::Sense::click()); - if r.hovered() { - ui.painter().rect_filled(rect, 3.0, t.hover); + let mut state = state.borrow_mut(); + let search_box = + ui.add(egui::TextEdit::singleline(&mut state.query).hint_text(crate::i18n::tr("Search albums")).desired_width(f32::INFINITY)); + register(ui, format!("albumPickerSearch:{id}"), search_box.rect); + if state.focus { + search_box.request_focus(); + state.focus = false; + } + if search_box.changed() { + state.highlight = 0; + } + false + }, + |ui, closed| { + let mut picked: Option = None; + if closed { + return picked; + } + let mut state = state.borrow_mut(); + let t = crate::theme::Tokens::get(ui.ctx()); + // `scroll`: bring the row into view (the arrow keys just moved to it); never every frame, + // which would fight the mouse wheel + let row = |ui: &mut Ui, e: &AlbumEntry, label: &str, indent: f32, highlighted: bool, scroll: bool, picked: &mut Option| { + ui.horizontal(|ui| { + ui.add_space(indent); + let (r, _) = ui.allocate_exact_size(vec2(14.0, 14.0), egui::Sense::hover()); + let icon = if e.smart { Icon::SmartAlbum } else { Icon::Album }; + crate::icons::paint(ui.painter(), r, icon, if e.blocked.is_some() { t.text_disabled } else { t.icon }); + let resp = ui + .add_enabled(e.blocked.is_none(), egui::Button::selectable(Some(e.id) == chosen || highlighted, label).truncate()) + .on_hover_text(label); + register(ui, format!("albumPickerItem:{}:{id}", e.id), resp.rect); + let resp = match &e.blocked { + Some(why) => resp.on_disabled_hover_text(why.as_str()), + None => resp, + }; + if resp.clicked() { + *picked = Some(e.id); } - let x = rect.left() + indent; - disclosure(ui.painter(), egui::pos2(x + 7.0, rect.center().y), open, if r.hovered() { t.text } else { t.text_dim }); - let icon = egui::Rect::from_center_size(egui::pos2(x + 23.0, rect.center().y), vec2(14.0, 14.0)); - crate::icons::paint(ui.painter(), icon, Icon::Folder, t.icon); - ui.painter().text( - egui::pos2(x + 36.0, rect.center().y), - egui::Align2::LEFT_CENTER, - &e.name, - egui::TextStyle::Button.resolve(ui.style()), - t.text_label, - ); - register(ui, format!("albumPickerFolder:{}:{id}", e.id), r.rect); - // what assistive tools announce: the folder, and whether it is open - let name = e.name.clone(); - crate::widgets::announce_disclosure(&r, true, open, &name); - if r.clicked() { - // the click took the keyboard from the search box: give it back - state.focus = true; - if open { - state.open.retain(|o| *o != e.id); + if scroll { + resp.scroll_to_me(None); + } + }); + }; + { + if state.query.trim().is_empty() { + for i in visible_tree(entries, &state.open) { + let e = &entries[i]; + let indent = e.depth as f32 * 16.0; + if e.folder { + // a folder row folds and unfolds, like the sidebar's: triangle, icon, name + let open = state.open.contains(&e.id); + let height = ui.spacing().interact_size.y; + let (rect, r) = ui.allocate_exact_size(vec2(ui.available_width(), height), egui::Sense::click()); + if r.hovered() { + ui.painter().rect_filled(rect, 3.0, t.hover); + } + let x = rect.left() + indent; + disclosure( + ui.painter(), + egui::pos2(x + 7.0, rect.center().y), + open, + if r.hovered() { t.text } else { t.text_dim }, + ); + let icon = egui::Rect::from_center_size(egui::pos2(x + 23.0, rect.center().y), vec2(14.0, 14.0)); + crate::icons::paint(ui.painter(), icon, Icon::Folder, t.icon); + ui.painter().text( + egui::pos2(x + 36.0, rect.center().y), + egui::Align2::LEFT_CENTER, + &e.name, + egui::TextStyle::Button.resolve(ui.style()), + t.text_label, + ); + register(ui, format!("albumPickerFolder:{}:{id}", e.id), r.rect); + // what assistive tools announce: the folder, and whether it is open + let name = e.name.clone(); + crate::widgets::announce_disclosure(&r, true, open, &name); + if r.clicked() { + // the click took the keyboard from the search box: give it back + state.focus = true; + if open { + state.open.retain(|o| *o != e.id); + } else { + state.open.push(e.id); + } + } } else { - state.open.push(e.id); + // past the triangle column, so names line up with folder names + row(ui, e, &e.name, indent + 14.0, false, false, &mut picked); } } + if entries.iter().all(|e| e.folder) { + ui.label(RichText::new(crate::i18n::tr("No albums yet")).weak()); + } } else { - // past the triangle column, so names line up with folder names - row(ui, e, &e.name, indent + 14.0, false, false, &mut picked); + let hits = search(entries, &state.query); + // ↑ / ↓ move through the results that can be picked, Enter picks one + let pickable: Vec = hits.iter().copied().filter(|&i| entries[i].blocked.is_none()).collect(); + let (down, up, enter) = ui.input_mut(|i| { + ( + i.consume_key(egui::Modifiers::NONE, egui::Key::ArrowDown), + i.consume_key(egui::Modifiers::NONE, egui::Key::ArrowUp), + i.consume_key(egui::Modifiers::NONE, egui::Key::Enter), + ) + }); + if down { + state.highlight = (state.highlight + 1).min(pickable.len().saturating_sub(1)); + } + if up { + state.highlight = state.highlight.saturating_sub(1); + } + let highlighted = pickable.get(state.highlight).copied(); + if enter { + match highlighted { + Some(i) => picked = Some(entries[i].id), + // Enter took the keyboard from the search box and picked nothing: give it back + None => state.focus = true, + } + } + let by_id = index(entries); + for i in &hits { + let e = &entries[*i]; + row( + ui, + e, + &path_in(entries, &by_id, e.id), + 0.0, + highlighted == Some(*i), + (up || down) && highlighted == Some(*i), + &mut picked, + ); + } + if hits.is_empty() { + ui.label(RichText::new(crate::i18n::tr("No albums match")).weak()); + } } } - if entries.iter().all(|e| e.folder) { - ui.label(RichText::new(crate::i18n::tr("No albums yet")).weak()); + if picked.is_some() { + ui.close(); } - } else { - let hits = search(entries, &state.query); - // ↑ / ↓ move through the results that can be picked, Enter picks one - let pickable: Vec = hits.iter().copied().filter(|&i| entries[i].blocked.is_none()).collect(); - let (down, up, enter) = ui.input_mut(|i| { - ( - i.consume_key(egui::Modifiers::NONE, egui::Key::ArrowDown), - i.consume_key(egui::Modifiers::NONE, egui::Key::ArrowUp), - i.consume_key(egui::Modifiers::NONE, egui::Key::Enter), - ) - }); - if down { - state.highlight = (state.highlight + 1).min(pickable.len().saturating_sub(1)); - } - if up { - state.highlight = state.highlight.saturating_sub(1); - } - let highlighted = pickable.get(state.highlight).copied(); - if enter { - match highlighted { - Some(i) => picked = Some(entries[i].id), - // Enter took the keyboard from the search box and picked nothing: give it back - None => state.focus = true, - } - } - let by_id = index(entries); - for i in &hits { - let e = &entries[*i]; - row( - ui, - e, - &path_in(entries, &by_id, e.id), - 0.0, - highlighted == Some(*i), - (up || down) && highlighted == Some(*i), - &mut picked, - ); - } - if hits.is_empty() { - ui.label(RichText::new(crate::i18n::tr("No albums match")).weak()); - } - } - }); - // Esc closes the popup and stops there: the dialog around it keeps its edits - if ui.input(|i| i.key_pressed(egui::Key::Escape)) { - crate::widgets::take_escape(ui.ctx()); - ui.close(); - } - if picked.is_some() { - ui.close(); - } - }); - ui.data_mut(|d| d.insert_temp(key, state)); + picked + }, + ) + .flatten(); + ui.data_mut(|d| d.insert_temp(key, state.into_inner())); if let Some(p) = picked { *value = Some(p); button.mark_changed(); From 30d0a3705178c0a04089410c0d4c13772f5f2d4d Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Tue, 27 Oct 2026 15:43:41 +0100 Subject: [PATCH 27/93] Add a single-photo export benchmark examples/export_bench imports the files given and runs export_photo (decode, full-size render, encode) N times, forgetting the decoded original between runs like a batch export does, and prints the median and minimum wall time. OPT takes export options as app.export JSON, PHASES=1 times render and encode separately, OUT=dir writes the files for byte comparisons between builds. Co-Authored-By: Claude Opus 5.5 --- crates/engine/examples/export_bench.rs | 81 ++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 crates/engine/examples/export_bench.rs diff --git a/crates/engine/examples/export_bench.rs b/crates/engine/examples/export_bench.rs new file mode 100644 index 0000000000..7fdb1c6c84 --- /dev/null +++ b/crates/engine/examples/export_bench.rs @@ -0,0 +1,81 @@ +//! Single-photo export benchmark (median and minimum of N runs): +//! `cargo run --release -p lightcraft-engine --example export_bench -- corpus/raw/arw-sony-a7m3-compressed.arw` +//! +//! Imports the files given and runs the export path the app, CLI and MCP share +//! ([`lightcraft_engine::export::export_photo`]: decode the original, render it full size, encode) +//! once per file per run, forgetting the decoded original between runs so each export reads and +//! decodes it like a batch export does. `N=9` runs (default), `OPT='{"format":"png"}'` for other +//! export options (JSON as `app.export` takes them), `LIGHTCRAFT_GPU=0` for the CPU pipeline, +//! `PHASES=1` to time render and encode separately, `OUT=dir` to write each file's export there +//! (for byte comparisons between builds). +use std::time::Instant; + +use lightcraft_engine::Session; +use lightcraft_engine::catalog::PhotoId; +use lightcraft_engine::export::{ExportOptions, encode_rendered, export_metadata, export_photo}; + +fn stats(mut v: Vec) -> (f64, f64) { + v.sort_by(f64::total_cmp); + (v[v.len() / 2], v[0]) +} + +fn main() { + let args: Vec = std::env::args().skip(1).collect(); + assert!(!args.is_empty(), "usage: export_bench FILE..."); + let n: usize = std::env::var("N").ok().and_then(|v| v.parse().ok()).unwrap_or(9).max(1); + let opt: serde_json::Value = + std::env::var("OPT").ok().map(|s| serde_json::from_str(&s).expect("OPT is JSON")).unwrap_or_else(|| serde_json::json!({})); + let o = ExportOptions::from_params(&opt).expect("export options"); + let mut s = Session::new().with_fs(); + let paths: Vec = args.iter().map(|p| std::fs::canonicalize(p).expect("input file").to_string_lossy().to_string()).collect(); + let r = s.execute("library.import", &serde_json::json!({"paths": paths})).expect("import"); + let ids: Vec = r["imported"].as_array().expect("ids").iter().filter_map(|v| v.as_u64()).map(PhotoId).collect(); + assert_eq!(ids.len(), args.len(), "every file imports"); + println!("{} file(s), {:?}, {n} runs, gpu {}", ids.len(), o.format, lightcraft_engine::gpu::available()); + let mut times = Vec::new(); + for i in 0..=n { + let t = Instant::now(); + for (k, &id) in ids.iter().enumerate() { + let e = export_photo(&mut s, id, &o, k + 1).expect("export"); + if i == 0 + && let Some(dir) = std::env::var_os("OUT") + { + std::fs::write(std::path::Path::new(&dir).join(&e.file_name), &e.bytes).expect("write"); + println!(" {} {}×{} {} bytes", e.file_name, e.width, e.height, e.bytes.len()); + } + s.media.forget(id); + } + // run 0 warms up (GPU device, allocator, page cache) + if i > 0 { + times.push(t.elapsed().as_secs_f64() * 1e3); + } + } + let (med, min) = stats(times.clone()); + println!("export: median {med:.1} ms, min {min:.1} ms (runs: {})", times.iter().map(|t| format!("{t:.0}")).collect::>().join(" ")); + if std::env::var_os("PHASES").is_none() { + return; + } + let (mut render, mut encode) = (Vec::new(), Vec::new()); + for _ in 0..n { + let (mut tr, mut te) = (0.0, 0.0); + for &id in &ids { + let p = s.catalog.photo(id).expect("photo").clone(); + let (w, h) = lightcraft_engine::export::output_size(&p, &o); + let meta = export_metadata(&p, &s.catalog, &o); + let job = s.export_job(id, w, h, o.effective_space(), o.effective_depth()).expect("job"); + let t = Instant::now(); + let r = job.run().rendered.expect("render"); + tr += t.elapsed().as_secs_f64() * 1e3; + let t = Instant::now(); + std::hint::black_box(encode_rendered(&r, &o, meta.as_ref()).expect("encode")); + te += t.elapsed().as_secs_f64() * 1e3; + s.media.forget(id); + } + render.push(tr); + encode.push(te); + } + let (rm, rn) = stats(render); + let (em, en) = stats(encode); + println!(" decode+render: median {rm:.1} ms, min {rn:.1} ms"); + println!(" encode: median {em:.1} ms, min {en:.1} ms"); +} From 3ce8dbc55b0575a13ae15d4417501b5064f11464 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Tue, 27 Oct 2026 15:43:41 +0100 Subject: [PATCH 28/93] Drop copies and libm calls from 8-bit export encoding - finish_8bit/finish_deep hand back the render itself when there is no output sharpening and no watermark. Before, every export cloned the image (~100 MB at 24 MP) and output_sharpen built a ~290 MB float copy of it even for SharpenFor::None, all on one thread. - Output sharpening's box blurs run row-parallel (par_rows); each pixel is computed as before. - The parallel JPEG encoder converts each band's rows to YCbCr inside the band's task instead of first filling whole-image planes (~290 MB for 4:4:4 at 24 MP, written once and read back). - fdct_quant rounds with plain arithmetic (round_i16) instead of f32::round, a libm call per coefficient without SSE4.1; it equals `x.round() as i16` for all 2^32 inputs. Output is byte-identical (pinned by encoded_bytes_are_pinned and sharpened_pixels_are_pinned, whose hashes come from main). Co-Authored-By: Claude Opus 5.5 --- crates/codecs/src/jpeg_par.rs | 121 +++++++++++++++++---------- crates/engine/src/export/encoding.rs | 40 ++++++--- crates/engine/src/export/tests.rs | 36 ++++++++ 3 files changed, 142 insertions(+), 55 deletions(-) diff --git a/crates/codecs/src/jpeg_par.rs b/crates/codecs/src/jpeg_par.rs index c8d9e5023c..763b73afa1 100644 --- a/crates/codecs/src/jpeg_par.rs +++ b/crates/codecs/src/jpeg_par.rs @@ -255,9 +255,20 @@ fn fdct_quant(block: &[f32; 64], recip: &[f32; 64], out: &mut [i16; 64]) { aan_1d(&mut d, c, 8); } for i in 0..64 { - out[i] = (d[i] * recip[i]).round() as i16; + out[i] = round_i16(d[i] * recip[i]); } } +/// `x.round() as i16` (half away from zero, saturating, NaN to 0) for every `x` (checked for all of them), in plain +/// arithmetic: without SSE4.1 `f32::round` is a libm call, one per coefficient, that keeps the loop from vectorising. +#[inline(always)] +fn round_i16(x: f32) -> i16 { + // (below 2^24 the truncation is exact and so is the remainder) + let c = x.clamp(-65536.0, 65536.0); + let t = c as i32; + let f = c - t as f32; + let r = t + i32::from(f >= 0.5) - i32::from(f <= -0.5); + r.clamp(i32::from(i16::MIN), i32::from(i16::MAX)) as i16 +} #[inline] fn magnitude(v: i32) -> (u32, u32) { @@ -395,31 +406,30 @@ fn encode_with( (true, _) | (false, ChromaSubsampling::S444) => (1usize, 1usize), (false, _) => (2, 2), }; - // colour conversion (JFIF YCbCr, full range, level-shifted) in one pass; chroma averaged 2×2 for 4:2:0 - let n = width * height; #[cfg(feature = "parallel")] use rayon::prelude::*; - // 4:4:4: Y, Cb, Cr at full resolution in one pass; 4:2:0: Y here, chroma below straight from 2×2 RGB means + // colour conversion (JFIF YCbCr, full range, level-shifted) of the pixel rows `rows`, one band's worth at a + // time (in the band's task: the planes of the whole image would be ~290 MB at 24 MP, written and read back + // once): 4:4:4 Y, Cb, Cr at full resolution in one pass; 4:2:0 Y, and chroma (rows `crows` of the + // half-size planes) straight from 2×2 RGB means (conversion is linear: average first, then convert once) let ncomp = if gray || hs == 2 { 1 } else { 3 }; - let mut full: Vec> = (0..ncomp).map(|_| vec![0f32; n]).collect(); - { - let rows: Vec<(usize, Vec<&mut [f32]>)> = { - let mut its: Vec<_> = full.iter_mut().map(|p| p.chunks_mut(width)).collect(); - (0..height).map_while(|y| Some((y, its.iter_mut().map(|it| it.next()).collect::>()?))).collect() - }; - let conv = |(y, mut out): (usize, Vec<&mut [f32]>)| { + let (cw, ch) = (width.div_ceil(2), height.div_ceil(2)); + let convert = |rows: std::ops::Range, crows: std::ops::Range| -> Vec { + let mut full: Vec> = (0..ncomp).map(|_| vec![0f32; rows.len() * width]).collect(); + for (k, y) in rows.clone().enumerate() { let src = &data[y * width * channels..(y + 1) * width * channels]; + let mut out: Vec<&mut [f32]> = full.iter_mut().map(|p| &mut p[k * width..(k + 1) * width]).collect(); if gray { for (o, p) in out[0].iter_mut().zip(src.chunks_exact(channels)) { *o = p[0] as f32 - 128.0; } - return; + continue; } if out.len() == 1 { for (o, p) in out[0].iter_mut().zip(src.chunks_exact(channels)) { *o = 0.299 * p[0] as f32 + 0.587 * p[1] as f32 + 0.114 * p[2] as f32 - 128.0; } - return; + continue; } for (x, p) in src.chunks_exact(channels).enumerate() { let (r, g, b) = (p[0] as f32, p[1] as f32, p[2] as f32); @@ -427,37 +437,26 @@ fn encode_with( out[1][x] = -0.168_736 * r - 0.331_264 * g + 0.5 * b; out[2][x] = 0.5 * r - 0.418_688 * g - 0.081_312 * b; } - }; - #[cfg(feature = "parallel")] - rows.into_par_iter().for_each(conv); - #[cfg(not(feature = "parallel"))] - rows.into_iter().for_each(conv); - } - let mut it = full.into_iter(); - let mut planes = vec![Plane { w: width, h: height, data: it.next().unwrap_or_default() }]; - planes.extend(it.map(|c| Plane { w: width, h: height, data: c })); - if !gray && hs == 2 { - // conversion is linear: average RGB over 2×2 first, then convert once - let (cw, ch) = (width.div_ceil(2), height.div_ceil(2)); - let (mut cb, mut cr) = (vec![0f32; cw * ch], vec![0f32; cw * ch]); - let down = |(cy, (ob, or)): (usize, (&mut [f32], &mut [f32]))| { - let (y0, y1) = (2 * cy, (2 * cy + 1).min(height - 1)); - let (r0, r1) = (&data[y0 * width * channels..], &data[y1 * width * channels..]); - for cx in 0..cw { - let (x0, x1) = (2 * cx * channels, (2 * cx + 1).min(width - 1) * channels); - let s = |k: usize| (r0[x0 + k] as f32 + r0[x1 + k] as f32 + r1[x0 + k] as f32 + r1[x1 + k] as f32) * 0.25; - let (r, g, b) = (s(0), s(1), s(2)); - ob[cx] = -0.168_736 * r - 0.331_264 * g + 0.5 * b; - or[cx] = 0.5 * r - 0.418_688 * g - 0.081_312 * b; + } + let mut planes: Vec = full.into_iter().map(|data| Plane { w: width, h: rows.len(), data }).collect(); + if !gray && hs == 2 { + let (mut cb, mut cr) = (vec![0f32; cw * crows.len()], vec![0f32; cw * crows.len()]); + for (cy, (ob, or)) in crows.clone().zip(cb.chunks_mut(cw).zip(cr.chunks_mut(cw))) { + let (y0, y1) = (2 * cy, (2 * cy + 1).min(height - 1)); + let (r0, r1) = (&data[y0 * width * channels..], &data[y1 * width * channels..]); + for cx in 0..cw { + let (x0, x1) = (2 * cx * channels, (2 * cx + 1).min(width - 1) * channels); + let s = |k: usize| (r0[x0 + k] as f32 + r0[x1 + k] as f32 + r1[x0 + k] as f32 + r1[x1 + k] as f32) * 0.25; + let (r, g, b) = (s(0), s(1), s(2)); + ob[cx] = -0.168_736 * r - 0.331_264 * g + 0.5 * b; + or[cx] = 0.5 * r - 0.418_688 * g - 0.081_312 * b; + } } - }; - #[cfg(feature = "parallel")] - cb.par_chunks_mut(cw).zip(cr.par_chunks_mut(cw)).enumerate().for_each(down); - #[cfg(not(feature = "parallel"))] - cb.chunks_mut(cw).zip(cr.chunks_mut(cw)).enumerate().for_each(down); - planes.push(Plane { w: cw, h: ch, data: cb }); - planes.push(Plane { w: cw, h: ch, data: cr }); - } + planes.push(Plane { w: cw, h: crows.len(), data: cb }); + planes.push(Plane { w: cw, h: crows.len(), data: cr }); + } + planes + }; let ql = scaled_quant(&Q_LUMA, quality); let qc = scaled_quant(&Q_CHROMA, quality); @@ -473,7 +472,12 @@ fn encode_with( let (mut blk, mut q) = ([0f32; 64], [0i16; 64]); let (mut tokens, mut freq) = (Vec::new(), [[0u64; 256]; 4]); let mut pred = [0i32; 3]; - for mcu_y in band * rows_per_band..((band + 1) * rows_per_band).min(my) { + let (m0, m1) = (band * rows_per_band, ((band + 1) * rows_per_band).min(my)); + // the band's planes, its MCU row `m0` at their top (blocks past the image's bottom repeat its last row, + // which is the band's last row then) + let planes = convert(m0 * mcu_h..(m1 * mcu_h).min(height), m0 * 8..(m1 * 8).min(ch)); + for mcu_y in m0..m1 { + let mcu_y = mcu_y - m0; for mcu_x in 0..mx { for vy in 0..vs { for hx in 0..hs { @@ -497,7 +501,6 @@ fn encode_with( let tokenized: Vec<(Vec, [Freq; 4])> = bands.par_iter().map(tokenize_band).collect(); #[cfg(not(feature = "parallel"))] let tokenized: Vec<(Vec, [Freq; 4])> = bands.iter().map(tokenize_band).collect(); - drop(planes); // the tables: DC luma, AC luma, DC chroma, AC chroma let tables: [([u8; 16], Vec); 4] = if optimize { let mut total = [[0u64; 256]; 4]; @@ -746,6 +749,34 @@ mod tests { assert_eq!(jpeg_decoder::Decoder::new(&std[..]).decode().unwrap(), jpeg_decoder::Decoder::new(&opt[..]).decode().unwrap()); } + /// The bytes written for 4:4:4, 4:2:0, grayscale and RGBA input at a size cut into many bands, with partial MCUs + /// at the right and bottom edges, pinned: each band converts its own rows to YCbCr, which must not change a bit. + #[test] + fn encoded_bytes_are_pinned() { + let fnv = |b: &[u8]| b.iter().fold(0xcbf2_9ce4_8422_2325u64, |h, &x| (h ^ u64::from(x)).wrapping_mul(0x100_0000_01b3)); + let (w, h) = (1203, 1037); + let rgb = test_rgb(w, h); + let gray: Vec = rgb.as_chunks::<3>().0.iter().map(|p| p[1]).collect(); + let rgba: Vec = rgb.as_chunks::<3>().0.iter().flat_map(|p| [p[0], p[1], p[2], 255]).collect(); + let got = [ + fnv(&encode(&rgb, w, h, 3, 90, ChromaSubsampling::S444, &[])), + fnv(&encode(&rgb, w, h, 3, 75, ChromaSubsampling::S420, &[])), + fnv(&encode(&gray, w, h, 1, 90, ChromaSubsampling::S444, &[])), + fnv(&encode(&rgba, w, h, 4, 85, ChromaSubsampling::S444, &[])), + ]; + assert_eq!(got, PINNED, "{got:#x?}"); + } + /// [`round_i16`] against `f32::round` at the halves, the ends of `i16`, NaN and infinities, and a spread of every + /// magnitude (all 2^32 inputs were compared once, offline). + #[test] + fn round_i16_is_round_as_i16() { + let special = [0.5f32, -0.5, 1.5, -1.5, 2.5, -2.5, 0.499_999_97, -0.499_999_97, 32767.5, -32768.5, 32766.5, 1e9, -1e9]; + let all = special.into_iter().chain([f32::NAN, f32::INFINITY, f32::NEG_INFINITY]).chain((0..=u32::MAX).step_by(9973).map(f32::from_bits)); + for x in all { + assert_eq!(round_i16(x), x.round() as i16, "{x:e}"); + } + } + const PINNED: [u64; 4] = [0x52ba_772a_589c_1430, 0x013f_8364_821f_1dde, 0xb2a3_b5e5_aef3_7402, 0x08df_d6dc_aa2f_1c78]; #[test] fn grayscale_and_quality_monotone() { let (w, h) = (300, 200); diff --git a/crates/engine/src/export/encoding.rs b/crates/engine/src/export/encoding.rs index c71903ac9d..3cb3be3cbc 100644 --- a/crates/engine/src/export/encoding.rs +++ b/crates/engine/src/export/encoding.rs @@ -1,9 +1,13 @@ use super::options::{ExportFormat, MetadataPolicy, SharpenAmount, SharpenFor}; use super::watermark::{Watermark, draw_watermark, draw_watermark_deep}; use super::*; +use std::borrow::Cow; /// Unsharp mask on an 8-bit image (separable box-blur approximation of a small Gaussian). pub fn output_sharpen(img: &mut Rgba8, target: SharpenFor, amount: SharpenAmount) { + if !sharpens(img.width, img.height, target) { + return; + } let src: Vec<[f32; 3]> = img.data.iter().map(|p| [p[0] as f32, p[1] as f32, p[2] as f32]).collect(); if let Some(out) = unsharp(img.width, img.height, &src, target, amount) { for (p, v) in img.data.iter_mut().zip(out) { @@ -17,6 +21,9 @@ pub fn output_sharpen(img: &mut Rgba8, target: SharpenFor, amount: SharpenAmount /// [`output_sharpen`] on a high-bit-depth image (float images are sharpened in linear light). pub fn output_sharpen_deep(img: &mut DeepImage, target: SharpenFor, amount: SharpenAmount) { let (w, h) = (img.width, img.height); + if !sharpens(w, h, target) { + return; + } match &mut img.samples { DeepSamples::U16(v) => { let src: Vec<[f32; 3]> = v.as_chunks::<3>().0.iter().map(|c| [c[0] as f32, c[1] as f32, c[2] as f32]).collect(); @@ -37,6 +44,11 @@ pub fn output_sharpen_deep(img: &mut DeepImage, target: SharpenFor, amount: Shar } } +/// Whether output sharpening for `target` changes a `w × h` image ([`unsharp`] returns `None` otherwise). +fn sharpens(w: usize, h: usize, target: SharpenFor) -> bool { + target != SharpenFor::None && w >= 3 && h >= 3 +} + /// The sharpened values of `src` (`w × h`), or `None` when nothing is to be done. fn unsharp(w: usize, h: usize, src: &[[f32; 3]], target: SharpenFor, amount: SharpenAmount) -> Option> { let (radius, base) = match target { @@ -57,8 +69,9 @@ fn unsharp(w: usize, h: usize, src: &[[f32; 3]], target: SharpenFor, amount: Sha let r = radius as isize; let box_pass = |inp: &[[f32; 3]], horizontal: bool| -> Vec<[f32; 3]> { let mut out = vec![[0.0; 3]; inp.len()]; - for y in 0..h { - for x in 0..w { + // rows in parallel: each output pixel is computed on its own, so the bits don't depend on the split + lightcraft_raster::par_rows(&mut out, w, |y, row| { + for (x, o) in row.iter_mut().enumerate() { let mut acc = [0.0f32; 3]; for d in -r..=r { let (sx, sy) = if horizontal { @@ -70,9 +83,9 @@ fn unsharp(w: usize, h: usize, src: &[[f32; 3]], target: SharpenFor, amount: Sha acc = [acc[0] + p[0], acc[1] + p[1], acc[2] + p[2]]; } let n = (2 * r + 1) as f32; - out[y * w + x] = acc.map(|v| v / n); + *o = acc.map(|v| v / n); } - } + }); out }; let blur = box_pass(&box_pass(src, true), false); @@ -142,8 +155,12 @@ fn encode_jpeg_with_limit(o: &ExportOptions, jpeg: impl Fn(u8) -> lightcraft_cod best.ok_or_else(|| format!("cannot fit within {kb} KB")) } -/// Output sharpening and the watermark on an 8-bit render in `o.effective_space()`. -fn finish_8bit(img: &Rgba8, o: &ExportOptions) -> Rgba8 { +/// Output sharpening and the watermark on an 8-bit render in `o.effective_space()`: the render itself when +/// there is neither (a copy is ~100 MB at 24 MP). +fn finish_8bit<'a>(img: &'a Rgba8, o: &ExportOptions) -> Cow<'a, Rgba8> { + if o.watermark.is_none() && !sharpens(img.width, img.height, o.sharpen) { + return Cow::Borrowed(img); + } let mut img = img.clone(); output_sharpen(&mut img, o.sharpen, o.sharpen_amount); let space = o.effective_space(); @@ -151,18 +168,21 @@ fn finish_8bit(img: &Rgba8, o: &ExportOptions) -> Rgba8 { let wm = Watermark { color: srgb8_in(space, wm.color), target: Some(space), ..wm.clone() }; draw_watermark(&mut img, &wm); } - img + Cow::Owned(img) } -/// Output sharpening and the watermark on a high-bit-depth render. -fn finish_deep(img: &DeepImage, o: &ExportOptions) -> DeepImage { +/// Output sharpening and the watermark on a high-bit-depth render (the render itself when there is neither). +fn finish_deep<'a>(img: &'a DeepImage, o: &ExportOptions) -> Cow<'a, DeepImage> { + if o.watermark.is_none() && !sharpens(img.width, img.height, o.sharpen) { + return Cow::Borrowed(img); + } let mut img = img.clone(); output_sharpen_deep(&mut img, o.sharpen, o.sharpen_amount); if let Some(wm) = &o.watermark { let wm = Watermark { color: srgb8_in(img.space, wm.color), target: Some(img.space), ..wm.clone() }; draw_watermark_deep(&mut img, &wm); } - img + Cow::Owned(img) } /// Encode an ISO 21496-1 gain map JPEG from the SDR rendition `sdr` (8-bit, in the output space) diff --git a/crates/engine/src/export/tests.rs b/crates/engine/src/export/tests.rs index 5ad311c7d7..80eb134309 100644 --- a/crates/engine/src/export/tests.rs +++ b/crates/engine/src/export/tests.rs @@ -209,6 +209,42 @@ fn sharpen_increases_edge_contrast() { assert!(img.data[3][0] < 80 && img.data[4][0] > 170); } +/// Output sharpening's pixels for every target and amount, pinned (its box blurs run row-parallel, which must not +/// change a bit), on 8- and 16-bit images; with no target the image is left as it is. +#[test] +fn sharpened_pixels_are_pinned() { + let fnv = |b: &[u8]| b.iter().fold(0xcbf2_9ce4_8422_2325u64, |h, &x| (h ^ u64::from(x)).wrapping_mul(0x100_0000_01b3)); + let mut got = Vec::new(); + for target in [SharpenFor::Screen, SharpenFor::Matte, SharpenFor::Glossy] { + for amount in [SharpenAmount::Low, SharpenAmount::High] { + let mut img = test_image(); + output_sharpen(&mut img, target, amount); + got.push(fnv(img.data.as_flattened())); + } + let src = test_image(); + let samples = src.data.iter().flat_map(|p| [p[0], p[1], p[2]].map(|v| u16::from(v) * 257)).collect(); + let mut deep = DeepImage { width: src.width, height: src.height, samples: DeepSamples::U16(samples), space: OutputSpace::Srgb }; + output_sharpen_deep(&mut deep, target, SharpenAmount::Standard); + let DeepSamples::U16(v) = &deep.samples else { unreachable!() }; + got.push(fnv(&v.iter().flat_map(|s| s.to_le_bytes()).collect::>())); + } + assert_eq!(got, SHARPENED, "{got:#x?}"); + let mut img = test_image(); + output_sharpen(&mut img, SharpenFor::None, SharpenAmount::High); + assert_eq!(img, test_image()); +} +const SHARPENED: [u64; 9] = [ + 0x1494_273e_0bdc_a61c, + 0x3fbb_40c4_74f4_b0c3, + 0xa27f_8ff5_82a0_99f9, + 0x6550_6571_a38d_4d9f, + 0x5e28_f4f3_fc8a_9685, + 0xdc2b_6f65_9138_3b1d, + 0x8ce6_f0b8_d8ed_8026, + 0x92d8_12e7_4b2e_81fe, + 0x139f_6d78_b1f2_a910, +]; + /// Exported files carry keywords as Lightroom Classic writes them: names flat in `dc:subject` /// (with the keywords containing them), full paths in `lr:hierarchicalSubject`, and nothing of /// a keyword left out of export. They used to carry the `a|b` paths in `dc:subject`. From 93487af3b367d34c391f9aa720bb33dcbbfc394e Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Tue, 27 Oct 2026 15:43:41 +0100 Subject: [PATCH 29/93] Cut serial work from raw development and GPU transfers - RawImage::develop demosaics only the default crop with AHD when there is no OpcodeList3 (ahd_window), instead of demosaicing the margin too and then copying the crop out of the full picture on one thread. - Gpu::upload writes through queue.write_buffer_with and copies into the staging buffer in parallel parts. create_buffer_init zeroed a staging buffer and then copied over it, two single-threaded passes over a full-size photo's ~290 MB. - finish_and_read copies the mapped readback out in parallel parts (one thread read the 91 MB of a 24 MP export at ~2 GB/s, ~45 ms). Output is byte-identical (ahd_window_is_the_crop_of_the_whole, uploads_read_back_exactly). Export of a 24 MP ARW to full-size JPEG (examples/export_bench, 75 interleaved runs each on a shared 16-thread Ryzen): main 802 ms median / 614 ms min -> this branch 647 / 525 (-19.3% / -14.5%). Co-Authored-By: Claude Opus 5.5 --- crates/gpu/src/ctx.rs | 62 ++++++++++++++++++++++++++++++---- crates/raw/src/demosaic.rs | 36 +++++++++++++++++++- crates/raw/src/demosaic/ahd.rs | 11 ++++-- crates/raw/src/lib.rs | 14 ++++++++ 4 files changed, 113 insertions(+), 10 deletions(-) diff --git a/crates/gpu/src/ctx.rs b/crates/gpu/src/ctx.rs index 33e02fbe4b..7bbbbc68d4 100644 --- a/crates/gpu/src/ctx.rs +++ b/crates/gpu/src/ctx.rs @@ -499,11 +499,31 @@ impl Gpu { self.over_limit(bytes.len() as u64); return Buf { buf: Some(Tracked::new(self.placeholder())), len }; } - let buf = self.device.create_buffer_init(&wgpu::util::BufferInitDescriptor { - label: None, - contents: bytes, - usage: wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_SRC | wgpu::BufferUsages::COPY_DST, - }); + let usage = wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_SRC | wgpu::BufferUsages::COPY_DST; + if let Some(size) = wgpu::BufferSize::new(bytes.len() as u64).filter(|s| s.get() % wgpu::COPY_BUFFER_ALIGNMENT == 0) { + // through the queue: the bytes are copied once, into a staging buffer the next submission copies from, in + // parallel parts (`create_buffer_init` zeroes a staging buffer first and copies over that, two passes on + // one thread over a full-size photo's ~290 MB) + let buf = self.device.create_buffer(&wgpu::BufferDescriptor { label: None, size: size.get(), usage, mapped_at_creation: false }); + if let Some(mut view) = self.queue.write_buffer_with(&buf, 0, size) { + const PART: usize = 1 << 20; + { + let (whole, mut tail) = view.slice(..).into_chunks::(); + let (src, src_tail) = bytes.as_chunks::(); + let mut parts: Vec<_> = whole.into_iter().zip(src).map(Some).collect(); + lightcraft_raster::par_rows(&mut parts, 1, |_, part| { + for (d, s) in part.iter_mut().filter_map(Option::take) { + wgpu::WriteOnly::<[u8]>::from(d).copy_from_slice(s); + } + }); + tail.copy_from_slice(src_tail); + } + // (dropping the view schedules the copy) + drop(view); + return Buf { buf: Some(Tracked::new(buf)), len }; + } + } + let buf = self.device.create_buffer_init(&wgpu::util::BufferInitDescriptor { label: None, contents: bytes, usage }); Buf { buf: Some(Tracked::new(buf)), len } } @@ -612,7 +632,17 @@ impl Gpu { Ok(d) => d, Err(e) => return failed(format!("{e:?}")), }; - let out: Vec = bytemuck::cast_slice(&data).to_vec(); + // copied out in parallel parts: one thread reads mapped memory slowly (~2 GB/s, so ~45 ms for a 24 MP + // export's pixels), and the new vector's pages are first touched there too + let src: &[u8] = &data; + // (`len` counts 32-bit words: as many `T` as they fill) + let mut out = vec![::zeroed(); src.len() / std::mem::size_of::().max(1)]; + const PART: usize = 1 << 20; + lightcraft_raster::par_rows(bytemuck::cast_slice_mut::(&mut out), PART, |k, part| { + if let Some(s) = src.get(k * PART..k * PART + part.len()) { + part.copy_from_slice(s); + } + }); drop(data); staging.unmap(); out @@ -811,6 +841,26 @@ mod tests { Some(stdout) } + /// An upload reaches the device whole: it is copied into staging memory in parallel parts, the last one + /// shorter than the others (and a small upload is that last part alone). + #[test] + fn uploads_read_back_exactly() { + let Some(g) = crate::device() else { + lightcraft_testkit::skip!(Gpu, "no GPU device"); + return; + }; + for len in [1usize, 1000, (3 << 20) / 4 + 777] { + let data: Vec = (0..len as u32).map(|i| i.wrapping_mul(2_654_435_761)).collect(); + let b = g.upload(&data); + let back: Vec = g.finish_and_read(g.encoder(), &b, len); + assert!(back == data, "{len} values"); + } + // read back as wider values (`len` counts 32-bit words), as `read_rgb` does + let data: Vec = (0..3 << 20).collect(); + let b = g.upload(&data); + let back: Vec<[u32; 3]> = g.finish_and_read(g.encoder(), &b, data.len()); + assert!(back.len() == 1 << 20 && back.as_flattened() == data.as_slice()); + } /// Issue #1858: once a Vulkan or DX12 device is lost, wgpu 30 panics in `Device::poll` instead of /// returning an error. A render's readback panicked; while it unwound, a buffer's way back to /// the pool polls again from a destructor, and that second panic aborted the app. diff --git a/crates/raw/src/demosaic.rs b/crates/raw/src/demosaic.rs index b8a3c599a8..75f7674ac3 100644 --- a/crates/raw/src/demosaic.rs +++ b/crates/raw/src/demosaic.rs @@ -15,7 +15,7 @@ mod bilinear; mod ppg; mod xtrans; -use crate::{Cfa, Normalized, Rgb32f}; +use crate::{Cfa, Normalized, Rect, Rgb32f}; use serde::{Deserialize, Serialize}; #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)] @@ -114,6 +114,20 @@ pub fn demosaic(n: &Normalized, method: Method) -> Rgb32f { } } +/// [`demosaic`] with [`Method::Ahd`] of the window `r` alone, for Bayer mosaics (`None` for any other data, or a +/// window not inside the mosaic): the same pixels as demosaicing it all and cropping that to `r`, without +/// demosaicing the rest or copying the window out of it. +pub(crate) fn ahd_window(n: &Normalized, r: Rect) -> Option { + let (w, h) = (n.width, n.height); + let cfa = n.cfa.as_ref()?; + let inside = r.x.checked_add(r.width).is_some_and(|e| e <= w) && r.y.checked_add(r.height).is_some_and(|e| e <= h); + if n.cpp != 1 || !cfa.is_bayer() || w < 4 || h < 4 || n.data.len() != w * h || r.width == 0 || r.height == 0 || !inside { + return None; + } + let m = Mosaic { w, h, data: &n.data, cfa }; + Some(ahd::ahd_window(&m, r.x, r.y, r.width, r.height)) +} + /// Build a mosaic from an RGB image by sampling each pixel's CFA colour (for tests and synthetic data). pub fn mosaic_from_rgb(img: &Rgb32f, cfa: &Cfa) -> Normalized { let data = (0..img.height).flat_map(|y| (0..img.width).map(move |x| (x, y))).map(|(x, y)| img.get(x, y)[cfa.color_at(x, y) as usize]).collect(); @@ -192,6 +206,26 @@ mod tests { assert!(out.data.iter().all(|p| (p[0] - 0.3).abs() < 1e-5 && (p[1] - 0.55).abs() < 1e-5 && (p[2] - 0.8).abs() < 1e-5)); } + /// A window demosaiced alone is the same, bit for bit, as that part of the whole picture: at the edges and + /// corners (where the mosaic is reflected), in the middle, across tile seams, at every CFA phase. + #[test] + fn ahd_window_is_the_crop_of_the_whole() { + let img = edgy_scene(300, 270); + for pat in ["RGGB", "GBRG"] { + let n = mosaic_from_rgb(&img, &Cfa::bayer(pat).unwrap()); + let whole = demosaic(&n, Method::Ahd); + for r in + [Rect::new(0, 0, 300, 270), Rect::new(0, 0, 7, 5), Rect::new(1, 3, 298, 266), Rect::new(121, 130, 140, 9), Rect::new(293, 263, 7, 7)] + { + let part = ahd_window(&n, r).unwrap(); + let want = whole.clone().into_crop(r.x, r.y, r.width, r.height); + assert_eq!((part.width, part.height), (r.width, r.height)); + assert!(part.data.iter().zip(&want.data).all(|(a, b)| a.map(f32::to_bits) == b.map(f32::to_bits)), "{pat} {r:?}"); + } + assert!(ahd_window(&n, Rect::new(1, 0, 300, 270)).is_none(), "a window past the mosaic is refused"); + } + } + #[test] fn known_samples_are_preserved() { let img = edgy_scene(40, 32); diff --git a/crates/raw/src/demosaic/ahd.rs b/crates/raw/src/demosaic/ahd.rs index d9fc27d766..6afcd92511 100644 --- a/crates/raw/src/demosaic/ahd.rs +++ b/crates/raw/src/demosaic/ahd.rs @@ -21,19 +21,24 @@ const TILE: usize = 128; const MARGIN: usize = 6; pub(crate) fn ahd(m: &Mosaic) -> Rgb32f { - let (w, h) = (m.w, m.h); + ahd_window(m, 0, 0, m.w, m.h) +} + +/// The `w × h` pixels at (`x`, `y`) of [`ahd`]'s picture (inside the mosaic), demosaiced alone: every pixel comes +/// from the mosaic around it, so they are the same as when the whole picture is demosaiced and then cropped. +pub(crate) fn ahd_window(m: &Mosaic, x: usize, y: usize, w: usize, h: usize) -> Rgb32f { let mut out = Rgb32f::new(w, h); if w == 0 || h == 0 { return out; } // one row of tiles per task, its tiles in parallel too, written straight into the picture out.data.par_chunks_mut((w * TILE).max(1)).enumerate().for_each(|(ty, band)| { - let (y0, th) = (ty * TILE, band.len() / w.max(1)); + let (y0, th) = (y + ty * TILE, band.len() / w.max(1)); let tiles: Vec<(usize, usize, Vec<[f32; 3]>)> = (0..w.div_ceil(TILE)) .into_par_iter() .map(|tx| { let (x0, tw) = (tx * TILE, TILE.min(w - tx * TILE)); - (x0, tw, tile(m, x0, y0, tw, th)) + (x0, tw, tile(m, x + x0, y0, tw, th)) }) .collect(); for (x0, tw, px) in tiles { diff --git a/crates/raw/src/lib.rs b/crates/raw/src/lib.rs index 6626f10cbd..17152e80f9 100644 --- a/crates/raw/src/lib.rs +++ b/crates/raw/src/lib.rs @@ -866,6 +866,15 @@ impl RawImage { /// The result is camera RGB (not white balanced), white level = 1.0, not oriented. pub fn develop(&self, method: Method) -> Result { let n = self.normalized()?; + // with no `OpcodeList3` to apply to the whole picture first, AHD demosaics just the default crop (the same + // pixels, without demosaicing the margin and then copying the crop out of the full picture) + if self.opcodes.list3.is_empty() && method == Method::Ahd { + let c = self.develop_crop(n.width, n.height); + if let Some(rgb) = demosaic::ahd_window(&n, c) { + drop(n); + return Ok(self.stretched(rgb)); + } + } let rgb = demosaic(&n, method); drop(n); Ok(self.finish_demosaiced(rgb)) @@ -878,6 +887,11 @@ impl RawImage { let c = self.develop_crop(rgb.width, rgb.height); let rgb = if c.x == 0 && c.y == 0 && c.width == rgb.width && c.height == rgb.height { rgb } else { rgb.into_crop(c.x, c.y, c.width, c.height) }; + self.stretched(rgb) + } + + /// The cropped camera RGB with its rows stretched for non-square pixels. + fn stretched(&self, rgb: Rgb32f) -> Rgb32f { let h = stretched_height(rgb.height, self.pixel_aspect); if h == rgb.height { return rgb; From 79f662a5840886d5bc6b8080c2bb767874185efd Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 27 Oct 2026 15:32:29 +0000 Subject: [PATCH 30/93] fix(installer): resolve the wizard scope and folder correctly Real msiexec runs (per-user and all-users, silent and wizard) found two defects that the metadata fixtures cannot see: - "Only for me" published ALLUSERS=2, so FindRelatedProducts treated the run as per-machine and skipped the existing per-user copy. An interactive upgrade left two registered products and uninstall left files behind. The page now leaves ALLUSERS unset for a per-user choice. - Windows Installer resolves Program Files once, for the context it started in, so choosing "Everyone" in the wizard installed into the user profile with a machine-wide registration. The wizard now sets the new-install folder itself after the choice (Program Files, Program Files (x86) for 32-bit, or the per-user Programs folder). Silent installs are unchanged. check-install-policy.ps1 now fails if either regresses. --- packaging/windows/check-install-policy.ps1 | 24 +++++++++++++++++++++- packaging/windows/install-policy.wxi | 15 +++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/packaging/windows/check-install-policy.ps1 b/packaging/windows/check-install-policy.ps1 index 451295a2e4..a4a14bc648 100644 --- a/packaging/windows/check-install-policy.ps1 +++ b/packaging/windows/check-install-policy.ps1 @@ -140,6 +140,28 @@ try { $ui['CraftScopeDlg'] -lt $ui['CraftRestoreUserFolder'] -and $ui['CraftRestoreUserFolder'] -lt $ui['CostInitialize'])) { throw 'Scope must be chosen after AppSearch and before FindRelatedProducts, launch checks and costing.' } + # Windows Installer resolves Program Files for the context it started in, before the wizard's scope choice. + # The wizard therefore sets the new-install folder itself, and only in the wizard. + $defaults = @(Read-Rows $database 'SELECT `Action`, `Sequence`, `Condition` FROM `InstallUISequence`' 3 | Where-Object { $_[0] -like 'CraftDefault*' }) + if ($defaults.Count -lt 2) { throw 'The wizard must set the new-install folder after the scope page; Program Files is resolved before the choice.' } + foreach ($row in $defaults) { + if (-not ($ui['CraftScopeDlg'] -lt [int]$row[1] -and [int]$row[1] -lt $ui['CostInitialize'])) { throw "$($row[0]) must run after the scope page and before costing." } + } + if (@(Read-Rows $database 'SELECT `Action` FROM `InstallExecuteSequence`' 1 | Where-Object { $_[0] -like 'CraftDefault*' }).Count) { + throw 'Silent installs must not use the wizard-only default folder actions.' + } + foreach ($scope in @('1', '')) { + Set-SessionProperty $session 'ALLUSERS' $scope + Set-SessionProperty $session 'INSTALLFOLDER' '' + Set-SessionProperty $session 'CRAFT_MACHINE_DIR' '' + Set-SessionProperty $session 'CRAFT_USER_DIR' '' + foreach ($row in @($defaults | Sort-Object { [int]$_[1] })) { + if ($session.EvaluateCondition($row[2]) -eq 1 -and $session.DoAction($row[0]) -ne 1) { throw "$($row[0]) failed." } + } + $folder = Get-SessionProperty $session 'INSTALLFOLDER' + $wanted = if ($scope -eq '1') { '^[A-Za-z]:\\Program Files( \(x86\))?\\ArtCraft\\[^\\]+\\$' } else { '^' + [regex]::Escape($env:LOCALAPPDATA) + '\\Programs\\ArtCraft\\[^\\]+\\$' } + if ($folder -notmatch $wanted) { throw "Wizard default folder for ALLUSERS='$scope' is '$folder'." } + } $execute = @{} foreach ($row in (Read-Rows $database 'SELECT `Action`, `Sequence` FROM `InstallExecuteSequence`' 2)) { $execute[$row[0]] = [int]$row[1] } foreach ($action in @('CraftRestoreUserFolder','CraftRestoreMachineFolder')) { @@ -177,7 +199,7 @@ try { $allUsers = Get-SessionProperty $session 'ALLUSERS' $perUser = Get-SessionProperty $session 'MSIINSTALLPERUSER' if (($choice -eq 'machine' -and ($allUsers -ne '1' -or $perUser)) -or - ($choice -eq 'user' -and ($allUsers -ne '2' -or $perUser -ne '1'))) { + ($choice -eq 'user' -and ($allUsers -or $perUser -ne '1'))) { throw 'Scope selector does not reset the requested installation context.' } } diff --git a/packaging/windows/install-policy.wxi b/packaging/windows/install-policy.wxi index b0f1c5b1e9..d8531ab87c 100644 --- a/packaging/windows/install-policy.wxi +++ b/packaging/windows/install-policy.wxi @@ -1,6 +1,9 @@ + @@ -25,6 +28,16 @@ + + + + + + + + + @@ -42,7 +55,7 @@ - + From b0485b0427e6eb89f395c7851e823078e0879f92 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 27 Oct 2026 19:13:20 +0000 Subject: [PATCH 31/93] fix(installer): check the exact architecture-specific machine folder The pre-signing check matched any folder named Program Files, so it rejected a valid MSI when Windows resolves Program Files elsewhere, accepted the 64-bit root for an x86 package and accepted a different app name. Build the expected folder from the package architecture's resolved root and the policy name. --- packaging/windows/check-install-policy.ps1 | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packaging/windows/check-install-policy.ps1 b/packaging/windows/check-install-policy.ps1 index a4a14bc648..cc9416e9c9 100644 --- a/packaging/windows/check-install-policy.ps1 +++ b/packaging/windows/check-install-policy.ps1 @@ -32,6 +32,12 @@ function Set-SessionProperty($Session, [string] $Name, [string] $Value) { function Get-SessionProperty($Session, [string] $Name) { $Session.GetType().InvokeMember('Property', 'GetProperty', $null, $Session, @($Name)) } +function Get-PackageTemplate($Database) { + # Summary information property 7 is the platform: "Intel;1033", "x64;1033" or "Arm64;1033". + $summary = $Database.GetType().InvokeMember('SummaryInformation', 'GetProperty', $null, $Database, @(0)) + try { [string]$summary.GetType().InvokeMember('Property', 'GetProperty', $null, $summary, @(7)) } + finally { [void][Runtime.InteropServices.Marshal]::FinalReleaseComObject($summary) } +} $installer = $null; $database = $null; $session = $null try { $installer = New-Object -ComObject WindowsInstaller.Installer @@ -150,6 +156,12 @@ try { if (@(Read-Rows $database 'SELECT `Action` FROM `InstallExecuteSequence`' 1 | Where-Object { $_[0] -like 'CraftDefault*' }).Count) { throw 'Silent installs must not use the wizard-only default folder actions.' } + # The machine default comes from the environment of the package architecture, not from a folder name. + # x86 packages use Program Files (x86) on 64-bit Windows; x64 and Arm64 packages use the 64-bit root. + $machineRoot = if ((Get-PackageTemplate $database) -match '^Intel') { + if (Get-SessionProperty $session 'VersionNT64') { ${env:ProgramFiles(x86)} } else { $env:ProgramFiles } + } elseif ($env:ProgramW6432) { $env:ProgramW6432 } else { $env:ProgramFiles } + $machineFolder = (Join-Path $machineRoot "ArtCraft\$($policy.name)") + '\' foreach ($scope in @('1', '')) { Set-SessionProperty $session 'ALLUSERS' $scope Set-SessionProperty $session 'INSTALLFOLDER' '' @@ -159,8 +171,8 @@ try { if ($session.EvaluateCondition($row[2]) -eq 1 -and $session.DoAction($row[0]) -ne 1) { throw "$($row[0]) failed." } } $folder = Get-SessionProperty $session 'INSTALLFOLDER' - $wanted = if ($scope -eq '1') { '^[A-Za-z]:\\Program Files( \(x86\))?\\ArtCraft\\[^\\]+\\$' } else { '^' + [regex]::Escape($env:LOCALAPPDATA) + '\\Programs\\ArtCraft\\[^\\]+\\$' } - if ($folder -notmatch $wanted) { throw "Wizard default folder for ALLUSERS='$scope' is '$folder'." } + $wanted = if ($scope -eq '1') { $machineFolder } else { (Join-Path $env:LOCALAPPDATA "Programs\ArtCraft\$($policy.name)") + '\' } + if ($folder -ine $wanted) { throw "Wizard default folder for ALLUSERS='$scope' is '$folder', expected '$wanted'." } } $execute = @{} foreach ($row in (Read-Rows $database 'SELECT `Action`, `Sequence` FROM `InstallExecuteSequence`' 2)) { $execute[$row[0]] = [int]$row[1] } From 97eb5fdb83cd7b1dbefd89fe65ff3c13d0f2d471 Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 27 Oct 2026 20:51:53 +0000 Subject: [PATCH 32/93] ci: use storytold/craft-common-actions at the merged installer-policy commit --- .github/workflows/windows-arm64.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-arm64.yml b/.github/workflows/windows-arm64.yml index ea74625b94..8477823bf5 100644 --- a/.github/workflows/windows-arm64.yml +++ b/.github/workflows/windows-arm64.yml @@ -28,7 +28,7 @@ permissions: jobs: windows-arm64: # Immutable supporting workflow revision until the new install contract lands upstream. - uses: Jeremy8776/craft-common-actions/.github/workflows/windows-arm64.yml@f4666d5cbf35f9bdeda24f1f88c7fb5c6adf5276 + uses: storytold/craft-common-actions/.github/workflows/windows-arm64.yml@8bb4e5ab95443171104ad88113fe1ef9b0e5ce3f with: app-name: lightcraft app-dir: LightCraft From 59d482578a7d74d20be804155063ff6ada0f7cfe Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 27 Oct 2026 21:13:28 +0000 Subject: [PATCH 33/93] test(installer): cover the compiled folder searches, resolver chains and wizard folder replay The policy check now reads the compiled AppSearch and RegLocator rows for the remembered-folder properties (registry root, key, value name and type for both scopes) and runs the DIR, FOLDER, PATH and legacy exe actions in sequence order against seeded values, so their precedence and the preset-folder guard cannot regress. It also replays the wizard folder actions in sequence order (a remembered folder beats the new-install default, a typed folder beats both) and requires the machine restore action between the scope page and costing. --- packaging/windows/check-install-policy.ps1 | 76 +++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/packaging/windows/check-install-policy.ps1 b/packaging/windows/check-install-policy.ps1 index cc9416e9c9..5463c0083c 100644 --- a/packaging/windows/check-install-policy.ps1 +++ b/packaging/windows/check-install-policy.ps1 @@ -143,7 +143,8 @@ try { $ui['CraftPreferMachineScope'] -lt $ui['CraftScopeDlg'] -and $ui['CraftScopeDlg'] -lt $ui['FindRelatedProducts'] -and $ui['FindRelatedProducts'] -lt $ui['LaunchConditions'] -and - $ui['CraftScopeDlg'] -lt $ui['CraftRestoreUserFolder'] -and $ui['CraftRestoreUserFolder'] -lt $ui['CostInitialize'])) { + $ui['CraftScopeDlg'] -lt $ui['CraftRestoreUserFolder'] -and $ui['CraftRestoreUserFolder'] -lt $ui['CostInitialize'] -and + $ui['CraftScopeDlg'] -lt $ui['CraftRestoreMachineFolder'] -and $ui['CraftRestoreMachineFolder'] -lt $ui['CostInitialize'])) { throw 'Scope must be chosen after AppSearch and before FindRelatedProducts, launch checks and costing.' } # Windows Installer resolves Program Files for the context it started in, before the wizard's scope choice. @@ -174,6 +175,28 @@ try { $wanted = if ($scope -eq '1') { $machineFolder } else { (Join-Path $env:LOCALAPPDATA "Programs\ArtCraft\$($policy.name)") + '\' } if ($folder -ine $wanted) { throw "Wizard default folder for ALLUSERS='$scope' is '$folder', expected '$wanted'." } } + # Replay the wizard's compiled folder actions in sequence order, as the full UI runs them. A remembered + # folder must win over the new-install default, and a folder the user typed must survive both. + $uiFolderActions = @(Read-Rows $database 'SELECT `Action`, `Sequence`, `Condition` FROM `InstallUISequence`' 3 | + Where-Object { $_[0] -match '^Craft(Restore|Default)' } | Sort-Object { [int]$_[1] }) + $userDefault = (Join-Path $env:LOCALAPPDATA "Programs\ArtCraft\$($policy.name)") + '\' + foreach ($case in @( + @('1', 'D:\Remembered user app', 'E:\Remembered machine app', '', 'E:\Remembered machine app'), + @('', 'D:\Remembered user app', 'E:\Remembered machine app', '', 'D:\Remembered user app'), + @('1', '', '', '', $machineFolder), + @('', '', '', '', $userDefault), + @('1', 'D:\Remembered user app', 'E:\Remembered machine app', 'F:\Chosen exact app', 'F:\Chosen exact app'))) { + Set-SessionProperty $session 'Installed' '' + Set-SessionProperty $session 'ALLUSERS' $case[0] + Set-SessionProperty $session 'CRAFT_USER_DIR' $case[1] + Set-SessionProperty $session 'CRAFT_MACHINE_DIR' $case[2] + Set-SessionProperty $session 'INSTALLFOLDER' $case[3] + foreach ($row in $uiFolderActions) { + if ($session.EvaluateCondition($row[2]) -eq 1 -and $session.DoAction($row[0]) -ne 1) { throw "$($row[0]) failed." } + } + $folder = Get-SessionProperty $session 'INSTALLFOLDER' + if ($folder -ine $case[4]) { throw "Full-UI folder for ALLUSERS='$($case[0])' is '$folder', expected '$($case[4])'." } + } $execute = @{} foreach ($row in (Read-Rows $database 'SELECT `Action`, `Sequence` FROM `InstallExecuteSequence`' 2)) { $execute[$row[0]] = [int]$row[1] } foreach ($action in @('CraftRestoreUserFolder','CraftRestoreMachineFolder')) { @@ -186,6 +209,57 @@ try { throw 'Both legacy folder resolvers must run after AppSearch and before the launch checks.' } } + # AppSearch itself never runs in this safe session, so check the compiled searches and then run the + # property actions that turn the search results into the remembered folder, once per scope. + $appSearch = @{} + foreach ($row in (Read-Rows $database 'SELECT `Property`, `Signature_` FROM `AppSearch`' 2)) { $appSearch[$row[0]] = $row[1] } + $locators = @{} + foreach ($row in (Read-Rows $database 'SELECT `Signature_`, `Root`, `Key`, `Name`, `Type` FROM `RegLocator`' 5)) { $locators[$row[0]] = $row } + $appPaths = '^Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\[^\\]+\.exe$' + # Suffix, how to match the key, key, value name, locator type (2 = raw value, 1 = file; the 64-bit flag is masked off). + $searchContract = @( + @('DIR', 'exact', "Software\$($policy.name)", 'InstallDir', '2'), + @('FOLDER', 'exact', "Software\$($policy.name)", 'InstallFolder', '2'), + @('PATH', 'regex', $appPaths, 'Path', '2'), + @('EXEFOLDER', 'regex', $appPaths, '', '1'), + @('EXE', 'regex', $appPaths, '', '1')) + $resolverCases = @( + @{ name = 'every record, DIR wins'; dir = 'D:\Dir\'; folder = 'D:\Folder\'; path = 'D:\Path\'; exeFolder = 'D:\Exe\'; exe = 'D:\Exe\app.exe'; existing = ''; expected = 'D:\Dir\' }, + @{ name = 'FOLDER wins without DIR'; dir = ''; folder = 'D:\Folder\'; path = 'D:\Path\'; exeFolder = 'D:\Exe\'; exe = 'D:\Exe\app.exe'; existing = ''; expected = 'D:\Folder\' }, + @{ name = 'PATH wins without DIR, FOLDER'; dir = ''; folder = ''; path = 'D:\Path\'; exeFolder = 'D:\Exe\'; exe = 'D:\Exe\app.exe'; existing = ''; expected = 'D:\Path\' }, + @{ name = 'legacy exe folder is last'; dir = ''; folder = ''; path = ''; exeFolder = 'D:\Exe\'; exe = 'D:\Exe\app.exe'; existing = ''; expected = 'D:\Exe\' }, + @{ name = 'legacy folder needs the exe'; dir = ''; folder = ''; path = ''; exeFolder = 'D:\Exe\'; exe = ''; existing = ''; expected = '' }, + @{ name = 'a preset folder is kept'; dir = 'D:\Dir\'; folder = 'D:\Folder\'; path = 'D:\Path\'; exeFolder = 'D:\Exe\'; exe = 'D:\Exe\app.exe'; existing = 'P:\Preset\'; expected = 'P:\Preset\' }) + foreach ($scopeSpec in @(@('U', '1', 'CRAFT_USER_DIR'), @('M', '2', 'CRAFT_MACHINE_DIR'))) { + $letter = $scopeSpec[0]; $target = $scopeSpec[2] + foreach ($item in $searchContract) { + $property = "CRAFT_${letter}_$($item[0])" + $locator = if ($appSearch.ContainsKey($property)) { $locators[$appSearch[$property]] } else { $null } + $keyOk = $null -ne $locator -and $(if ($item[1] -eq 'exact') { $locator[2] -eq $item[2] } else { $locator[2] -match $item[2] }) + if (-not $keyOk -or $locator[1] -ne $scopeSpec[1] -or $locator[3] -ne $item[3] -or ([int]$locator[4] -band 3) -ne [int]$item[4]) { + throw "Compiled search for $property is missing or points at the wrong registry location." + } + } + $chain = @(Read-Rows $database 'SELECT `Action`, `Sequence`, `Condition` FROM `InstallExecuteSequence`' 3 | + Where-Object { $_[0] -match "^Craft${letter}From" } | Sort-Object { [int]$_[1] }) + $order = @($chain | ForEach-Object { $_[0] }) -join ',' + if ($order -ne "Craft${letter}FromDIR,Craft${letter}FromFOLDER,Craft${letter}FromPATH,Craft${letter}FromLegacyExe") { + throw "Remembered-folder resolvers for scope $letter run in the wrong order: $order" + } + foreach ($case in $resolverCases) { + Set-SessionProperty $session $target $case.existing + Set-SessionProperty $session "CRAFT_${letter}_DIR" $case.dir + Set-SessionProperty $session "CRAFT_${letter}_FOLDER" $case.folder + Set-SessionProperty $session "CRAFT_${letter}_PATH" $case.path + Set-SessionProperty $session "CRAFT_${letter}_EXEFOLDER" $case.exeFolder + Set-SessionProperty $session "CRAFT_${letter}_EXE" $case.exe + foreach ($row in $chain) { + if ($session.EvaluateCondition($row[2]) -eq 1 -and $session.DoAction($row[0]) -ne 1) { throw "$($row[0]) failed." } + } + $got = Get-SessionProperty $session $target + if ($got -ne $case.expected) { throw "Resolver chain for scope $letter, case '$($case.name)': got '$got', expected '$($case.expected)'." } + } + } # Switching the first-page choice must reset BOTH properties, including a back-and-forth change. $events = @(Read-Rows $database 'SELECT `Event`, `Argument`, `Condition`, `Ordering` FROM `ControlEvent` WHERE `Dialog_` = ''CraftScopeDlg'' AND `Control_` = ''Next'' ORDER BY `Ordering`' 4) # Model the full-UI upgrade entry with an existing machine-wide copy. Run From 5dea67e3481007dedc8e8382bf4ffa290a4214a1 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Tue, 27 Oct 2026 21:13:30 +0000 Subject: [PATCH 34/93] docs(installer): say that an upgrade reuses the recorded folder even if it was deleted The restore actions use the recorded folder without checking that it still exists, so an upgrade creates it again rather than using the default folder. --- docs/user/getting-started/install.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/getting-started/install.md b/docs/user/getting-started/install.md index 255a6a5ed6..4ea8b09f5e 100644 --- a/docs/user/getting-started/install.md +++ b/docs/user/getting-started/install.md @@ -16,7 +16,7 @@ Download the file for your system from the [latest release](https://github.com/s For a Snapdragon or other Arm PC, download `lightcraft--windows-arm64.msi` instead. For a 32-bit Windows, download `lightcraft--windows-x86.msi`. -Upgrading from an installer older than 0.6.0 also keeps LightCraft in the folder it was installed in. If that folder was deleted, the upgrade installs to the default folder for the scope you choose. +Upgrading from an installer older than 0.6.0 also keeps LightCraft in the folder it was installed in. An upgrade uses the folder that the earlier install recorded and does not check that it still exists, so if you deleted that folder, the upgrade creates it again. To run it without installing, download `lightcraft--windows-x64-portable.zip`. Portable builds for `arm64` and `x86` are on the release page too. From e472ffd6a4e2dbe928db080794e3789c8c54fe9c Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Tue, 27 Oct 2026 16:32:15 -0400 Subject: [PATCH 35/93] MENU-FILE-CLOSE: document that closing the window quits the app --- docs/parity-checklist.md | 7 ++++--- docs/user/faq/closing-the-window.md | 29 +++++++++++++++++++++++++++++ docs/user/faq/index.md | 1 + 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 docs/user/faq/closing-the-window.md diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index 90cfc248f6..762e6ad7db 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -1,6 +1,6 @@ # Lightroom parity checklist -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-25 · **Change:** minor (LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-27 · **Change:** minor (MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say Close Window quits the app, after the same check as Quit; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 The measured, row-by-row checklist: one row per Lightroom feature, menu item and shortcut, what we have and what is missing. It answers *does the feature exist?* (feature breadth). Whether it is good @@ -517,7 +517,7 @@ visible menu bar yet: the menu model is only exposed through the control channel | MENU-FILE-SHOWFINDER | Show in Finder | P0 | ✅ | `cmd:app.showInFinder` | ⌘R; Explorer on Windows, the folder on Linux; disabled for demo scenes and on the web | | MENU-PHOTO-SHOWFOLDERS | Show in Folders | P2 | ✅ | `cmd:app.showInFolders`, `crates/ui-egui/src/panels/left.rs` (`folder_row_of`), tests `show_in_folders_*` in `tests_panels.rs` | Photo ▸ Show in Folders and the photo right-click menu: selects the active photo's folder in the sidebar's Folders section, opens the rows above it and scrolls to it; opens the Library sidebar if it is behind another tab; disabled for demo scenes and photos outside a library folder | | MENU-FILE-OFFLINE | Store album locally | P2 | 🚫 | | not applicable: local-first | -| MENU-FILE-CLOSE | Close Window | P1 | ✅ | `apps/lightcraft/src/native_menu.rs` | the system's Close Window item at the end of File (⌘W) | +| MENU-FILE-CLOSE | Close Window | P1 | ✅ | `apps/lightcraft/src/native_menu.rs` | the system's Close Window item at the end of File (⌘W); closing the main window quits the app, after the check Quit makes (running tasks that can stop, changes not yet written); the second window just closes; kept on purpose, user page `docs/user/faq/closing-the-window.md` | | MENU-EDIT-UNDO | Undo | P0 | ✅ | `cmd:edit.undo` | label does not name the step | | MENU-EDIT-REDO | Redo | P0 | ✅ | `cmd:edit.redo` | | | MENU-EDIT-COPYPASTE | Copy / paste (edit settings) | P0 | ✅ | `cmd:develop.copy`, `cmd:develop.paste` | | @@ -639,7 +639,7 @@ From `06-shortcuts.md` part 1. Evidence is our binding; conflicts are explained | KEY-HIDE | Hide / hide others — ⌘H / ⌥⌘H | P1 | ✅ | `apps/lightcraft/src/native_menu.rs` | native app-menu items | | KEY-QUIT | Quit — ⌘Q | P0 | ✅ | `cmd:app.quit` | ⌘Q (Ctrl+Q off macOS) | | KEY-CREATEVERSION | Create version — ⇧M | P1 | ✅ | `cmd:version.create` | secondary binding (primary ⌘⇧S) | -| KEY-CLOSEWINDOW | Close window — ⌘W | P1 | ✅ | `apps/lightcraft/src/native_menu.rs` | native File ▸ Close Window | +| KEY-CLOSEWINDOW | Close window — ⌘W | P1 | ✅ | `apps/lightcraft/src/native_menu.rs` | native File ▸ Close Window; with the main window in front it quits the app like ⌘Q (see MENU-FILE-CLOSE); the second window just closes | | KEY-DELETE | Delete photo — ⌫ | P0 | ✅ | `cmd:photo.delete`, `cmd:album.removePhotos` | in a normal album ⌫ removes from the album only (`album.removePhotos`, issue #1805); in a smart album it does nothing; elsewhere it deletes (to Recently Deleted) | | KEY-ADDPHOTOS | Import photos — ⇧⌘I | P0 | ✅ | `cmd:file.addPhotos` | | | KEY-VERSIONS | Versions panel — ⇧V | P1 | ✅ | `cmd:panel.versions` | | @@ -959,3 +959,4 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove | 2026-10-23 | patch | LR-BEHAV-ACCESS: the name field of New Album, New Smart Album, Rename and the other one-field dialogs takes the keyboard focus once when the dialog opens instead of every frame, so Tab and Shift+Tab reach the check box, Cancel and OK; status unchanged (🟡) | | 2026-10-22 | minor | LR-CROP-AUTO: Auto straighten turns by at most 10° and only on at least 3 agreeing lines, and says when it finds nothing to level by; measured on 68 photos straightened by hand and 300 left as shot, unwanted turns of more than 1° fell from 79 to 19 of the 300. Downgraded ✅ → 🟡: it still leaves most tilted photos alone | | 2026-10-23 | patch | LRC-LIB-FILTERBAR: showing an album (`library.source`) while the filter holds an album drops the filter's album, as showing a library folder already dropped its folder filter; before, the old album stayed in the filter unseen (the filter bar has no album chip) and narrowed the next source such as All Photos; the row's note says so; status unchanged (✅) | +| 2026-10-27 | patch | MENU-FILE-CLOSE, KEY-CLOSEWINDOW: the notes say that Close Window and the red close button of the main window quit the app, after the check Quit makes; kept on purpose; a user page says so; status unchanged (✅) | diff --git a/docs/user/faq/closing-the-window.md b/docs/user/faq/closing-the-window.md new file mode 100644 index 0000000000..f6dc94f16f --- /dev/null +++ b/docs/user/faq/closing-the-window.md @@ -0,0 +1,29 @@ +--- +title: Does closing the window quit LightCraft? +description: On a Mac, closing the LightCraft window with the red button or ⌘W quits the app, after it checks for running tasks and unsaved changes. +order: 30 +verified: 0.14.0 +--- + +On a Mac, yes. Closing LightCraft's main window quits the app, the same as **LightCraft** > **Quit LightCraft** (⌘Q). Many Mac apps keep running with no window open; LightCraft doesn't. + +These all do the same thing when the main window is the one in front: + +- the red close button in the top-left corner of the window +- **File** > **Close Window** (⌘W) +- **LightCraft** > **Quit LightCraft** (⌘Q) + +## Does it ask first? + +Only when something would be lost: + +- A task that can be stopped is still running, such as an import or an export. LightCraft asks **Quit while tasks are running?** Choose **Cancel** to keep working, or **Quit Anyway** to stop the task and quit. +- Some changes couldn't be written to disk, for example because a drive was unplugged. LightCraft tries to save them again, and if that still fails it asks **Quit with unsaved changes?** Choose **Cancel** to stay, **Try Saving Again** once the drive is back, or **Quit Anyway** to give up those changes. + +With nothing running and everything saved, the window closes and LightCraft quits at once. Your library (including your edits) and settings are saved as the app quits. + +The second window (**Window** > **Second Window**) is different: its red button, or ⌘W while it is in front, closes only that window, and LightCraft keeps running. + +## Can I keep LightCraft open without a window? + +No. To get the window out of the way, minimize it with the yellow button or **Window** > **Minimize** (⌘M), or hide the app with **LightCraft** > **Hide LightCraft** (⌘H). Both keep your place and any running task going. diff --git a/docs/user/faq/index.md b/docs/user/faq/index.md index 1ddafea532..863b0d14ac 100644 --- a/docs/user/faq/index.md +++ b/docs/user/faq/index.md @@ -6,3 +6,4 @@ order: 40 - [Is LightCraft free, and does it need an account?](free-and-private.md) - [Which cameras and file types does LightCraft open?](supported-files.md) +- [Does closing the window quit LightCraft?](closing-the-window.md) From 4f6f4c4ee885d0d7f3fdd2ace2385c9d7d71a024 Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Tue, 27 Oct 2026 19:53:43 -0400 Subject: [PATCH 36/93] MENU-FILE-CLOSE: the page says saving at quit can fail --- docs/user/faq/closing-the-window.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/user/faq/closing-the-window.md b/docs/user/faq/closing-the-window.md index f6dc94f16f..d83f94bbb5 100644 --- a/docs/user/faq/closing-the-window.md +++ b/docs/user/faq/closing-the-window.md @@ -20,7 +20,7 @@ Only when something would be lost: - A task that can be stopped is still running, such as an import or an export. LightCraft asks **Quit while tasks are running?** Choose **Cancel** to keep working, or **Quit Anyway** to stop the task and quit. - Some changes couldn't be written to disk, for example because a drive was unplugged. LightCraft tries to save them again, and if that still fails it asks **Quit with unsaved changes?** Choose **Cancel** to stay, **Try Saving Again** once the drive is back, or **Quit Anyway** to give up those changes. -With nothing running and everything saved, the window closes and LightCraft quits at once. Your library (including your edits) and settings are saved as the app quits. +With nothing running and everything saved, the window closes and LightCraft quits at once. As the app quits, LightCraft saves your settings and closes your library. If either save fails, the error goes to the log file and the app quits anyway. The second window (**Window** > **Second Window**) is different: its red button, or ⌘W while it is in front, closes only that window, and LightCraft keeps running. From e60b7d1787d3e02f640988104f3f7f12470e00a2 Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Tue, 27 Oct 2026 22:40:25 -0400 Subject: [PATCH 37/93] MENU-EDIT-SELECTNONE: Edit lists Select Only Active Photo and Paste Settings from Previous with their kin, and the native Edit menu keeps single separators --- apps/lightcraft/src/native_menu.rs | 36 +++++++++++++++++++---- crates/ui-egui/src/menus/menubar.rs | 2 ++ crates/ui-egui/src/menus/menubar/tests.rs | 17 +++++++++++ docs/parity-checklist.md | 7 +++-- docs/whats-new.md | 5 ++++ 5 files changed, 59 insertions(+), 8 deletions(-) diff --git a/apps/lightcraft/src/native_menu.rs b/apps/lightcraft/src/native_menu.rs index a5a14e2088..d25b565661 100644 --- a/apps/lightcraft/src/native_menu.rs +++ b/apps/lightcraft/src/native_menu.rs @@ -295,12 +295,20 @@ fn label_text(s: &str) -> String { lightcraft_ui_egui::i18n::tr(s).replace('&', "&&") } -/// Drop a trailing separator (left behind when an item moved to the app menu). -fn tidy_separators(mut nodes: Vec) -> Vec { - while matches!(nodes.last(), Some(MenuNode::Separator)) { - nodes.pop(); +/// Drop the separators left behind when an item moved to the app menu: a leading one, a trailing +/// one and the second of two in a row. +fn tidy_separators(nodes: Vec) -> Vec { + let mut out: Vec = Vec::with_capacity(nodes.len()); + for node in nodes { + if node == MenuNode::Separator && out.last().is_none_or(|last| *last == MenuNode::Separator) { + continue; + } + out.push(node); } - nodes + while out.last() == Some(&MenuNode::Separator) { + out.pop(); + } + out } impl NativeMenu { @@ -570,6 +578,24 @@ impl NativeMenu { mod tests { use super::*; + /// An item that moves to the app menu (Settings…) can sit between two separators, or open or + /// close the menu's list: the rows left behind keep at most one separator between them. + #[test] + fn rows_left_after_a_move_keep_single_separators() { + let item = |id: &str| MenuNode::Item { + id: id.to_string(), + label: id.to_string(), + shortcut: None, + enabled: true, + checked: None, + params: Value::Null, + }; + let sep = || MenuNode::Separator; + let tidy = tidy_separators(vec![sep(), item("a"), sep(), sep(), item("b"), sep(), sep()]); + assert_eq!(tidy, vec![item("a"), sep(), item("b")]); + assert_eq!(tidy_separators(vec![sep(), sep()]), Vec::::new()); + } + /// The menu model's titles stay English, so only the language can tell the native menu to /// rebuild its titles (and the macOS app menu): every language switch — also between two CJK /// languages — must change the structure key. diff --git a/crates/ui-egui/src/menus/menubar.rs b/crates/ui-egui/src/menus/menubar.rs index 5c1bcb9fc1..d966743063 100644 --- a/crates/ui-egui/src/menus/menubar.rs +++ b/crates/ui-egui/src/menus/menubar.rs @@ -167,11 +167,13 @@ const LAYOUT: &[(&str, &[&str])] = &[ "dialog.copySettings", "develop.paste", "dialog.pasteSettings", + "develop.pastePrevious", "develop.sync", "develop.autoSync", "---", "library.selectAll", "library.selectNone", + "library.selectOnlyActive", "@Select by", "---", "view.focusSearch", diff --git a/crates/ui-egui/src/menus/menubar/tests.rs b/crates/ui-egui/src/menus/menubar/tests.rs index 1e2fe388dd..c1b4251d37 100644 --- a/crates/ui-egui/src/menus/menubar/tests.rs +++ b/crates/ui-egui/src/menus/menubar/tests.rs @@ -823,3 +823,20 @@ fn no_two_menu_commands_share_a_label() { } assert!(clashes.is_empty(), "{clashes:#?}"); } + +/// Edit lists Select Only Active Photo with the other Select rows and Paste Settings from Previous +/// with the other Paste rows, not after Settings… at the very end of the menu. +#[test] +fn edit_menu_places_the_select_and_paste_rows_with_their_kin() { + let a = app(); + let bar = menu_bar(&a); + let nodes = &bar.iter().find(|(title, _)| title == "Edit").unwrap().1; + let pos = |id: &str| { + nodes.iter().position(|n| matches!(n, MenuNode::Item { id: i, .. } if i == id)).unwrap_or_else(|| panic!("{id} is a top-level Edit row")) + }; + assert_eq!(pos("library.selectOnlyActive"), pos("library.selectNone") + 1, "Select Only Active Photo follows Deselect All"); + assert_eq!(pos("develop.pastePrevious"), pos("dialog.pasteSettings") + 1, "Paste Settings from Previous follows Paste Selected Settings…"); + assert!(pos("app.settings") > pos("library.selectOnlyActive"), "Settings… stays after them"); + let after = &nodes[pos("app.settings") + 1..]; + assert!(!after.iter().any(|n| matches!(n, MenuNode::Item { .. })), "no row follows Settings… but a submenu: {after:?}"); +} diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index 90cfc248f6..4d3d4934f5 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -1,6 +1,6 @@ # Lightroom parity checklist -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-25 · **Change:** minor (LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-27 · **Change:** minor (MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Edit lists Select Only Active Photo after Deselect All and Paste Settings from Previous after Paste Selected Settings…; on macOS no doubled separators are left where Settings… moved to the app menu; LR-BEHAV-TITLEBAR: a double-click follows the system setting, and a panel over the bar keeps the window still; KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 go to the next / previous keyword set; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings; KEYC-METADATA: ⌘K / Ctrl+K Add Keywords; LRC-DEV-HISTOGRAM-DRAG: the histogram's five tonal zones — hover for the value, drag to adjust the Basic control the press locked, double-click to reset; LR-VIEW-HISTOGRAM note updated; MENU-BAR: on macOS a menu item that yields its key to a focused text field or to shortcut recording really lets it go; LR-MERGE-HDR / LR-MERGE-PANO: Lanczos-3 warps; LR-IMP-LOCAL: browsing from the sidebar records the folder; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LR-IMP-ADD-DIALOG: hierarchical import album destination reconciled with main, #2362; KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the row; leaving it disarms them; LR-EDIT-OPTICS-PROFILE: Fujifilm nine-knot lens tables read at the plain radius; LR-VIEW-ZOOM: only a full-size drag within 20 ms clears a slow-drag verdict; LRC-LIB-LIBFOLDERS, LR-BEHAV-BG-TASKS: Synchronize Folder's scan shows its folder listing and stops it on ✕; LRC-LIB-LIBFOLDERS: Synchronize Folder says a folder is up to date; LR-LIB-STACK: filmstrip stack badge click; LRC-LIB-REFVIEW / CATALOG-SWITCH: Escape preserves edits; catalog-local pins; deleted and malformed references refused; LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398; KEYC-RATING: `\` shows / hides the Filter Bar in the grids; LR-VIEW-PHOTOGRID: the grid reads only the photos an import batch or an edit touched, not the whole list; earlier: LRC-PRINT-PAGE: Print Page Options; LR-META-XMP: fewer false unimported-XMP warnings) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 The measured, row-by-row checklist: one row per Lightroom feature, menu item and shortcut, what we have and what is missing. It answers *does the feature exist?* (feature breadth). Whether it is good @@ -522,9 +522,9 @@ visible menu bar yet: the menu model is only exposed through the control channel | MENU-EDIT-REDO | Redo | P0 | ✅ | `cmd:edit.redo` | | | MENU-EDIT-COPYPASTE | Copy / paste (edit settings) | P0 | ✅ | `cmd:develop.copy`, `cmd:develop.paste` | | | MENU-EDIT-CHOOSECOPY | Choose Edit Settings to Copy… | P0 | ✅ | `cmd:dialog.copySettings` | Return copies, Esc cancels | -| MENU-EDIT-PASTESELECTED | Paste Selected Settings | P0 | ✅ | `cmd:dialog.pasteSettings`, `cmd:develop.paste` (`groups`) | checklist prefilled with the copied groups; only copied groups can be pasted; Return pastes, Esc cancels | +| MENU-EDIT-PASTESELECTED | Paste Selected Settings | P0 | ✅ | `cmd:dialog.pasteSettings`, `cmd:develop.paste` (`groups`) | checklist prefilled with the copied groups; only copied groups can be pasted; Return pastes, Esc cancels; Paste Settings from Previous (⌥⌘V) follows it | | MENU-EDIT-SELECTALL | Select All | P0 | ✅ | `cmd:library.selectAll` | | -| MENU-EDIT-SELECTNONE | Select None | P0 | ✅ | `cmd:library.selectNone` | | +| MENU-EDIT-SELECTNONE | Select None | P0 | ✅ | `cmd:library.selectNone` | Select Only Active Photo (⇧⌘D) follows it | | MENU-EDIT-SELECTBY | Select by flag / rating | P1 | ✅ | `cmd:library.selectBy` | Edit → Select by: picks, rejects, unflagged, ★…★★★★★ and higher, unrated, colour labels; `add` extends the selection | | MENU-EDIT-FIND | Find… | P0 | ✅ | `cmd:view.focusSearch`, `crates/ui-egui/src/panels/topbar.rs` | ⌘F focuses the search field | | MENU-VIEW-PHOTOGRID | Photo Grid | P0 | ✅ | `cmd:view.photoGrid` | | @@ -959,3 +959,4 @@ Latin stays upright. Advanced Japanese composition remains open. Regression cove | 2026-10-23 | patch | LR-BEHAV-ACCESS: the name field of New Album, New Smart Album, Rename and the other one-field dialogs takes the keyboard focus once when the dialog opens instead of every frame, so Tab and Shift+Tab reach the check box, Cancel and OK; status unchanged (🟡) | | 2026-10-22 | minor | LR-CROP-AUTO: Auto straighten turns by at most 10° and only on at least 3 agreeing lines, and says when it finds nothing to level by; measured on 68 photos straightened by hand and 300 left as shot, unwanted turns of more than 1° fell from 79 to 19 of the 300. Downgraded ✅ → 🟡: it still leaves most tilted photos alone | | 2026-10-23 | patch | LRC-LIB-FILTERBAR: showing an album (`library.source`) while the filter holds an album drops the filter's album, as showing a library folder already dropped its folder filter; before, the old album stayed in the filter unseen (the filter bar has no album chip) and narrowed the next source such as All Photos; the row's note says so; status unchanged (✅) | +| 2026-10-27 | patch | MENU-EDIT-SELECTNONE, MENU-EDIT-PASTESELECTED: Select Only Active Photo and Paste Settings from Previous were not in the Edit menu's layout and ended up after Settings…, near the end of the menu; they now sit with the other Select and Paste rows. On macOS the Edit menu no longer shows two separators in a row where Settings… moved to the app menu; status unchanged (✅) | diff --git a/docs/whats-new.md b/docs/whats-new.md index c6c2592003..0c177ccf85 100644 --- a/docs/whats-new.md +++ b/docs/whats-new.md @@ -1,5 +1,10 @@ # What's new in LightCraft +## 2026-10-27 + +### The Edit menu groups Select Only Active Photo and Paste Settings from Previous with their kin +- Select Only Active Photo now sits under Deselect All, and Paste Settings from Previous under Paste Selected Settings…, instead of both after Settings…, near the end of the Edit menu. On macOS, where Settings… lives in the application menu, the Edit menu no longer shows two separator lines in a row. + ## 2026-10-24 ### Relative-date filters and smart albums follow the clock From d85d975b3c042821638c32c84b6ab949eed78c6d Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Tue, 27 Oct 2026 23:10:31 -0400 Subject: [PATCH 38/93] MENU-EDIT-SELECTNONE: reword the Edit layout test's comment --- crates/ui-egui/src/menus/menubar/tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ui-egui/src/menus/menubar/tests.rs b/crates/ui-egui/src/menus/menubar/tests.rs index c1b4251d37..72fc077d1a 100644 --- a/crates/ui-egui/src/menus/menubar/tests.rs +++ b/crates/ui-egui/src/menus/menubar/tests.rs @@ -825,7 +825,7 @@ fn no_two_menu_commands_share_a_label() { } /// Edit lists Select Only Active Photo with the other Select rows and Paste Settings from Previous -/// with the other Paste rows, not after Settings… at the very end of the menu. +/// with the other Paste rows, not after Settings…, near the end of the menu. #[test] fn edit_menu_places_the_select_and_paste_rows_with_their_kin() { let a = app(); From 56b5c8b076d143f7f931524e0a9e36271dcac2e7 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 23:18:52 -0400 Subject: [PATCH 39/93] Scan the whole repository again in SonarCloud (#3224) * Scan the whole repository again in SonarCloud * Classify the repository's test files as tests in SonarCloud --- sonar-project.properties | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index 717d1dfac0..462b15b797 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,8 +2,11 @@ sonar.projectKey=storytold_lightcraft sonar.organization=storytold sonar.coverage.exclusions=**/tools/**,**/docs/**,**/examples/** -# Keep packaging tests analyzed as tests, outside production coverage metrics. -sonar.tests=packaging/linux/flatpak -sonar.test.inclusions=packaging/linux/flatpak/test_*.py -sonar.exclusions=packaging/linux/flatpak/test_*.py +# Setting sonar.tests without sonar.sources stops the scanner defaulting to the whole repository, +# which left only the packaging test indexed and the main branch analysed as empty. Sources and +# tests both start at the root; sonar.test.inclusions picks out the test files, so they are +# analysed as tests (outside production metrics and coverage) rather than left out. +sonar.sources=. +sonar.tests=. +sonar.test.inclusions=**/tests/**,**/tests.rs,**/tests_*.rs,**/*_tests.rs,**/test_*.py sonar.python.coverage.reportPaths=python-coverage.xml From 96c3190300a4e31f7ccf612250ee9e859b89c1cf Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 26 Oct 2026 20:09:47 -0400 Subject: [PATCH 40/93] chore(clippy): enforce workspace lint rules --- Cargo.toml | 4 +++- clippy.toml | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 42d4e5209e..cd85d80f34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -122,9 +122,11 @@ web-sys = "0.3" unsafe_code = "deny" [workspace.lints.clippy] +cognitive_complexity = "deny" +too_many_arguments = "deny" +wildcard_imports = "deny" dbg_macro = "warn" todo = "warn" -too_many_arguments = "allow" needless_range_loop = "allow" type_complexity = "allow" excessive_precision = "allow" diff --git a/clippy.toml b/clippy.toml index 287e14edc1..3522a15b69 100644 --- a/clippy.toml +++ b/clippy.toml @@ -5,3 +5,4 @@ allow-indexing-slicing-in-tests = true disallowed-types = [ { path = "egui::ComboBox", reason = "use craft_ui::ComboBox: egui's combo box menu can't grow back while open (egui#5225)" }, ] +cognitive-complexity-threshold = 30 From c7ef259f36d0f06fdfc9fa7af69393b46825520d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 02:54:53 +0000 Subject: [PATCH 41/93] refactor(heif): isolate SPS VUI parsing --- crates/heif/src/vui.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/heif/src/vui.rs b/crates/heif/src/vui.rs index 2266043033..6bc629fa57 100644 --- a/crates/heif/src/vui.rs +++ b/crates/heif/src/vui.rs @@ -201,6 +201,11 @@ fn st_ref_pic_set(r: &mut Bits, idx: usize, num_delta_pocs: &[u32]) -> Option Option { let r = &mut Bits { data: rbsp, pos: 0 }; let (_, _, max_sub_layers_minus1) = sps_size(r)?; + parse_sps_parameters(r, max_sub_layers_minus1)?; + parse_vui(r) +} + +fn parse_sps_parameters(r: &mut Bits<'_>, max_sub_layers_minus1: u32) -> Option<()> { if r.flag()? { for _ in 0..4 { r.ue()?; // conf_win_*_offset @@ -253,6 +258,10 @@ fn parse_sps(rbsp: &[u8]) -> Option { } } r.skip(2)?; // sps_temporal_mvp_enabled_flag, strong_intra_smoothing_enabled_flag + Some(()) +} + +fn parse_vui(r: &mut Bits<'_>) -> Option { let mut signal = Signal::default(); if !r.flag()? { return Some(signal); // no VUI From 59083081aefac0d390626518512f066971420f53 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 02:58:48 +0000 Subject: [PATCH 42/93] fix(sysmem): inherit workspace Clippy denies --- crates/sysmem/Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/sysmem/Cargo.toml b/crates/sysmem/Cargo.toml index 422d8c7110..a7f0492c6e 100644 --- a/crates/sysmem/Cargo.toml +++ b/crates/sysmem/Cargo.toml @@ -12,6 +12,9 @@ description = "LightCraft sysmem (L0): returns freed allocator memory to the OS. unsafe_code = "deny" [lints.clippy] +cognitive_complexity = "deny" +too_many_arguments = "deny" +wildcard_imports = "deny" dbg_macro = "warn" todo = "warn" From 32e4874569b739ef0163dbd3f7a6daa0ace490aa Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 03:02:08 +0000 Subject: [PATCH 43/93] docs: explain workspace lint inheritance --- CLAUDE.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 416ffc0a8d..6034902e93 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -52,10 +52,12 @@ of it. Full standard: `../craftrules/standards/never-crash.md` - **Last-resort guard:** a panic hook plus `catch_unwind` around command dispatch and import/export turns an escaped panic into an error dialog and keeps the document. It's a safety net, not a licence; keep `panic = "unwind"` on native. - **Prove it:** every crash fix lands with a small synthetic regression test that panicked before the fix. -- Enforced by clippy: root `clippy.toml` allows unwrap/expect/panic/indexing in tests only, and every production crate - root (`lib.rs`, each binary's `main.rs`) carries `#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, - clippy::unimplemented, clippy::todo, clippy::unreachable)]`. Not `[workspace.lints]`: those would also hit - integration tests, examples and benches. New crates start with the attribute. +- Enforced by clippy: root `clippy.toml` keeps unwrap/expect/panic/indexing allowances scoped to tests. The workspace + denies `cognitive_complexity`, `too_many_arguments` and `wildcard_imports`; members inherit them with + `[lints] workspace = true`, and `sysmem` repeats those denies in its local lint table. Every production crate root + (`lib.rs`, each binary's `main.rs`) carries `#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, + clippy::unimplemented, clippy::todo, clippy::unreachable)]`. New crates inherit workspace lints and start with the + attribute. ## Non-negotiables - **Clean-room.** Never read/disassemble anything inside Adobe app bundles (names/listings only). Never copy Adobe icons, presets, profiles (DCP), lens profiles (LCP), camera matrices, fonts. Observation of the installed Lightroom is read-only (it syncs the user's personal library: never import/edit/rate/delete there). Never copy GPL/LGPL/AGPL code (darktable, RawTherapee, ART, LibRaw, rawspeed, rawloader, rawler, lensfun, dcraw-derived GPL code…). From 38c3232214e5bea3722a2551c385306b44b504b6 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 11:51:09 +0000 Subject: [PATCH 44/93] refactor(meta): isolate descriptive metadata merging --- crates/meta/src/lib.rs | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/crates/meta/src/lib.rs b/crates/meta/src/lib.rs index 46c7a10432..07887bbdc6 100644 --- a/crates/meta/src/lib.rs +++ b/crates/meta/src/lib.rs @@ -187,7 +187,16 @@ impl Metadata { orientation, gps, width, - height, + height + ); + self.fill_missing_descriptive(other); + } + + /// Fill descriptive metadata separately from the camera and image properties. + fn fill_missing_descriptive(&mut self, other: &Metadata) { + fill!( + self, + other, artist, copyright, copyright_marked, @@ -405,11 +414,22 @@ mod tests { #[test] fn merge_rules() { - let mut a = Metadata { make: Some("A".into()), rating: Some(1), ..Default::default() }; - let b = Metadata { make: Some("B".into()), model: Some("M".into()), rating: Some(4), keywords: vec!["k".into()], ..Default::default() }; + let mut a = Metadata { make: Some("A".into()), title: Some("Original".into()), rating: Some(1), ..Default::default() }; + let b = Metadata { + make: Some("B".into()), + model: Some("M".into()), + title: Some("Replacement".into()), + caption: Some("Caption".into()), + rating: Some(4), + keywords: vec!["k".into()], + ..Default::default() + }; a.fill_missing(&b); assert_eq!(a.make.as_deref(), Some("A")); assert_eq!(a.model.as_deref(), Some("M")); + assert_eq!(a.title.as_deref(), Some("Original")); + assert_eq!(a.caption.as_deref(), Some("Caption")); + assert_eq!(a.keywords, vec!["k".to_string()]); assert_eq!(a.rating, Some(1)); a.overlay_user_fields(&b); assert_eq!(a.rating, Some(4)); From c1766c016b6d68b61750c6ac69e42bc95939c5ba Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 12:32:17 +0000 Subject: [PATCH 45/93] refactor(scenes): model water lighting parameters --- crates/scenes/src/paint.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/scenes/src/paint.rs b/crates/scenes/src/paint.rs index 4f3c4560be..32ca0f053b 100644 --- a/crates/scenes/src/paint.rs +++ b/crates/scenes/src/paint.rs @@ -179,7 +179,14 @@ fn pine(p: &P, x: f32, v: f32, ground: f32, height: f32, density: f32) -> Option best } -fn water(p: &P, x: f32, v: f32, wl: f32, calm: f32, above: &dyn Fn(f32, f32) -> C, tint: C, sun: (f32, f32), sun_col: C) -> C { +struct WaterLight { + tint: C, + sun: (f32, f32), + sun_col: C, +} + +fn water(p: &P, x: f32, v: f32, wl: f32, calm: f32, above: &dyn Fn(f32, f32) -> C, light: WaterLight) -> C { + let WaterLight { tint, sun, sun_col } = light; let d = v - wl; let rip = fbm(x * 9.0, d * 60.0 / (d + 0.05), p.seed ^ 0xaa, 4) * (1.0 - calm); let rv = (wl - d * 1.0 + rip * (0.01 + 0.06 * (1.0 - calm)) * (d * 10.0 + 0.2)).max(0.0); @@ -340,7 +347,7 @@ fn alpine(p: &P, x: f32, v: f32, blue: bool) -> C { }; if v > wl { let tint = if blue { hex(0x1a2440) } else { hex(0x20303a) }; - return water(p, x, v, wl, 0.75, &above, tint, sun, sun_col); + return water(p, x, v, wl, 0.75, &above, WaterLight { tint, sun, sun_col }); } above(x, v) } @@ -419,7 +426,7 @@ fn ocean(p: &P, x: f32, v: f32) -> C { if v < hz + head * 0.3 { return hex(0x120c14); } - return water(p, x, v, hz, 0.35, &above, hex(0x1a2040), sun, sun_col); + return water(p, x, v, hz, 0.35, &above, WaterLight { tint: hex(0x1a2040), sun, sun_col }); } let _ = head; above(x, v) @@ -465,7 +472,7 @@ fn aurora(p: &P, x: f32, v: f32) -> C { add(sky(p, &sk, x, v), aur(x, v)) }; if v > wl { - return water(p, x, v, wl, 0.9, &above, hex(0x020408), (-5.0, 5.0), [0.0; 3]); + return water(p, x, v, wl, 0.9, &above, WaterLight { tint: hex(0x020408), sun: (-5.0, 5.0), sun_col: [0.0; 3] }); } above(x, v) } From 2c7d98b5e24c71d4df2fd24f090dc0877c4d69c8 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 12:46:49 +0000 Subject: [PATCH 46/93] refactor(raw): separate DNG metadata and opcode parsing --- crates/raw/src/dngwrite.rs | 92 +++++----- crates/raw/src/opcodes.rs | 243 +++++++++++++++----------- crates/raw/src/tiffraw.rs | 2 +- crates/raw/tests/it/crx_properties.rs | 76 +++++--- 4 files changed, 246 insertions(+), 167 deletions(-) diff --git a/crates/raw/src/dngwrite.rs b/crates/raw/src/dngwrite.rs index fae6015b6d..bdafb58658 100644 --- a/crates/raw/src/dngwrite.rs +++ b/crates/raw/src/dngwrite.rs @@ -284,48 +284,8 @@ pub fn write_dng(raw: &RawImage, opts: &DngWriteOptions) -> Result> { if let Some(v) = c.baseline_sharpness { ifd.set(t::BASELINE_SHARPNESS, rat_vec(&[v])); } - // the source's own profile look travels with its data (conversions, smart previews, merges) - let p = &c.profile; - let table_tags = |ifd: &mut IfdBuilder, table: &crate::profile::HsvTable, dims: u16, enc: u16| { - ifd.set(dims, Value::Long(vec![table.hue_divisions as u32, table.sat_divisions as u32, table.val_divisions as u32])); - if table.srgb_value { - ifd.set(enc, Value::Long(vec![1])); - } - }; - let flat = |table: &crate::profile::HsvTable| Value::Float(table.data.iter().flatten().copied().collect()); - match &p.hue_sat_map { - [Some(a), b] => { - table_tags(&mut ifd, a, t::PROFILE_HUE_SAT_MAP_DIMS, t::PROFILE_HUE_SAT_MAP_ENCODING); - ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_1, flat(a)); - if let Some(b) = - b.as_ref().filter(|b| (b.hue_divisions, b.sat_divisions, b.val_divisions) == (a.hue_divisions, a.sat_divisions, a.val_divisions)) - { - ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_2, flat(b)); - } - } - [None, Some(b)] => { - table_tags(&mut ifd, b, t::PROFILE_HUE_SAT_MAP_DIMS, t::PROFILE_HUE_SAT_MAP_ENCODING); - ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_1, flat(b)); - } - [None, None] => {} - } - if let Some(l) = &p.look_table { - table_tags(&mut ifd, l, t::PROFILE_LOOK_TABLE_DIMS, t::PROFILE_LOOK_TABLE_ENCODING); - ifd.set(t::PROFILE_LOOK_TABLE_DATA, flat(l)); - } - if let Some(curve) = &p.tone_curve { - ifd.set(t::PROFILE_TONE_CURVE, Value::Float(curve.points.iter().flatten().copied().collect())); - } - if let Some(map) = &p.gain_table_map { - // the raw IFD is IFD 0 here, where both tag versions are valid - let (version2, bytes) = map.to_bytes(opts.order); - ifd.set(if version2 { t::PROFILE_GAIN_TABLE_MAP_2 } else { t::PROFILE_GAIN_TABLE_MAP }, Value::Undefined(bytes)); - } - for (list, tag) in [(&raw.opcodes.list1, t::OPCODE_LIST_1), (&raw.opcodes.list2, t::OPCODE_LIST_2), (&raw.opcodes.list3, t::OPCODE_LIST_3)] { - if !list.is_empty() { - ifd.set(tag, Value::Undefined(opcodes::write_list(list))); - } - } + write_profile_tags(&mut ifd, raw, opts.order); + write_opcode_tags(&mut ifd, raw); match (&raw.data, opts.compression) { (RawData::F32(v), DngCompression::Deflate { tile, half }) => { @@ -495,6 +455,54 @@ pub fn write_dng(raw: &RawImage, opts: &DngWriteOptions) -> Result> { Ok(TiffWriter::new(opts.order, false).write(&[ifd])?) } +fn write_profile_tags(ifd: &mut IfdBuilder, raw: &RawImage, order: ByteOrder) { + // The source's own profile look travels with its data (conversions, smart previews, merges). + let profile = &raw.color.profile; + let table_tags = |ifd: &mut IfdBuilder, table: &crate::profile::HsvTable, dims: u16, enc: u16| { + ifd.set(dims, Value::Long(vec![table.hue_divisions as u32, table.sat_divisions as u32, table.val_divisions as u32])); + if table.srgb_value { + ifd.set(enc, Value::Long(vec![1])); + } + }; + let flat = |table: &crate::profile::HsvTable| Value::Float(table.data.iter().flatten().copied().collect()); + match &profile.hue_sat_map { + [Some(first), second] => { + table_tags(ifd, first, t::PROFILE_HUE_SAT_MAP_DIMS, t::PROFILE_HUE_SAT_MAP_ENCODING); + ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_1, flat(first)); + if let Some(second) = second.as_ref().filter(|second| { + (second.hue_divisions, second.sat_divisions, second.val_divisions) == (first.hue_divisions, first.sat_divisions, first.val_divisions) + }) { + ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_2, flat(second)); + } + } + [None, Some(table)] => { + table_tags(ifd, table, t::PROFILE_HUE_SAT_MAP_DIMS, t::PROFILE_HUE_SAT_MAP_ENCODING); + ifd.set(t::PROFILE_HUE_SAT_MAP_DATA_1, flat(table)); + } + [None, None] => {} + } + if let Some(table) = &profile.look_table { + table_tags(ifd, table, t::PROFILE_LOOK_TABLE_DIMS, t::PROFILE_LOOK_TABLE_ENCODING); + ifd.set(t::PROFILE_LOOK_TABLE_DATA, flat(table)); + } + if let Some(curve) = &profile.tone_curve { + ifd.set(t::PROFILE_TONE_CURVE, Value::Float(curve.points.iter().flatten().copied().collect())); + } + if let Some(map) = &profile.gain_table_map { + // The raw IFD is IFD 0 here, where both tag versions are valid. + let (version2, bytes) = map.to_bytes(order); + ifd.set(if version2 { t::PROFILE_GAIN_TABLE_MAP_2 } else { t::PROFILE_GAIN_TABLE_MAP }, Value::Undefined(bytes)); + } +} + +fn write_opcode_tags(ifd: &mut IfdBuilder, raw: &RawImage) { + for (list, tag) in [(&raw.opcodes.list1, t::OPCODE_LIST_1), (&raw.opcodes.list2, t::OPCODE_LIST_2), (&raw.opcodes.list3, t::OPCODE_LIST_3)] { + if !list.is_empty() { + ifd.set(tag, Value::Undefined(opcodes::write_list(list))); + } + } +} + /// Exif `LightSource` code of a white point the rendered DNG writer knows (D65 = 21, D50 = 23). fn illuminant_of(white: lightcraft_color::Xy) -> u16 { if (white.x - lightcraft_color::D50.x).abs() < 1e-3 && (white.y - lightcraft_color::D50.y).abs() < 1e-3 { 23 } else { 21 } diff --git a/crates/raw/src/opcodes.rs b/crates/raw/src/opcodes.rs index df85e27031..f7750aaac0 100644 --- a/crates/raw/src/opcodes.rs +++ b/crates/raw/src/opcodes.rs @@ -253,6 +253,9 @@ impl Rd<'_> { self.p += 8; Some(v) } + fn finite_f64(&mut self) -> Option { + self.f64().filter(|v| v.is_finite()) + } fn f32(&mut self) -> Option { let v = f32::from_be_bytes(self.d.get(self.p..self.p + 4)?.try_into().ok()?); self.p += 4; @@ -276,109 +279,126 @@ impl Rd<'_> { } fn parse_one(id: u32, flags: u32, params: &[u8]) -> Option { - let mut r = Rd { d: params, p: 0 }; - let f = |r: &mut Rd| r.f64().filter(|v| v.is_finite()); - Some(match id { + let mut reader = Rd { d: params, p: 0 }; + let parsed = match id { + 1 | 2 | 3 | 14 => parse_warp(id, flags, &mut reader)?, + 4 => Opcode::FixBadPixelsConstant { constant: reader.u32()?, bayer_phase: reader.u32()? }, + 5 => parse_bad_pixel_list(&mut reader)?, + 6 => Opcode::TrimBounds { top: reader.u32()?, left: reader.u32()?, bottom: reader.u32()?, right: reader.u32()? }, + 7..=13 => parse_area_opcode(id, &mut reader)?, + _ => Opcode::Unknown { id, flags, params: params.to_vec() }, + }; + Some(parsed) +} + +fn parse_warp(id: u32, flags: u32, reader: &mut Rd<'_>) -> Option { + match id { 1 => { - let n = r.u32()? as usize; - if n == 0 || n > 4 { - return None; - } - let mut planes = Vec::with_capacity(n); - for _ in 0..n { - planes.push([f(&mut r)?, f(&mut r)?, f(&mut r)?, f(&mut r)?, f(&mut r)?, f(&mut r)?]); - } - Opcode::WarpRectilinear { planes, center: [f(&mut r)?, f(&mut r)?] } + let planes = parse_planes(reader, 4, |r| { + Some([r.finite_f64()?, r.finite_f64()?, r.finite_f64()?, r.finite_f64()?, r.finite_f64()?, r.finite_f64()?]) + })?; + Some(Opcode::WarpRectilinear { planes, center: [reader.finite_f64()?, reader.finite_f64()?] }) } 2 => { - let n = r.u32()? as usize; - if n == 0 || n > 4 { - return None; - } - let mut planes = Vec::with_capacity(n); - for _ in 0..n { - planes.push([f(&mut r)?, f(&mut r)?, f(&mut r)?, f(&mut r)?]); - } - Opcode::WarpFisheye { planes, center: [f(&mut r)?, f(&mut r)?] } + let planes = parse_planes(reader, 4, |r| Some([r.finite_f64()?, r.finite_f64()?, r.finite_f64()?, r.finite_f64()?]))?; + Some(Opcode::WarpFisheye { planes, center: [reader.finite_f64()?, reader.finite_f64()?] }) } - 14 => { - let n = r.u32()? as usize; - // N sets of 19 doubles, then the centre (2 doubles) and reciprocalRadial (LONG); nothing else - if n == 0 || n > WR2_MAX_PLANES || params.len() != 4 + n * WR2_LEN * 8 + 16 + 4 { - return None; - } - let mut planes = Vec::with_capacity(n); - for _ in 0..n { - let mut k = [0.0; WR2_LEN]; - for v in k.iter_mut() { - *v = f(&mut r).filter(|v| v.abs() <= WR2_MAX_COEF)?; - } - // the spec requires 0 <= min_valid_radius < max_valid_radius <= 1 - if !(k[17] >= 0.0 && k[17] < k[18] && k[18] <= 1.0) { - return None; - } - planes.push(k); - } - let center = [f(&mut r).filter(|v| v.abs() <= 4.0)?, f(&mut r).filter(|v| v.abs() <= 4.0)?]; - Opcode::WarpRectilinear2 { planes, center, reciprocal: r.u32()? != 0, optional: flags & 1 != 0 } + 3 => Some(Opcode::FixVignetteRadial { + k: [reader.finite_f64()?, reader.finite_f64()?, reader.finite_f64()?, reader.finite_f64()?, reader.finite_f64()?], + center: [reader.finite_f64()?, reader.finite_f64()?], + }), + 14 => parse_warp_rectilinear2(flags, reader), + _ => None, + } +} + +fn parse_planes(reader: &mut Rd<'_>, max: usize, mut parse: impl FnMut(&mut Rd<'_>) -> Option<[f64; N]>) -> Option> { + let count = reader.u32()? as usize; + if count == 0 || count > max { + return None; + } + (0..count).map(|_| parse(reader)).collect() +} + +fn parse_warp_rectilinear2(flags: u32, reader: &mut Rd<'_>) -> Option { + let count = reader.u32()? as usize; + // N sets of 19 doubles, then the centre (2 doubles) and reciprocalRadial (LONG); nothing else. + if count == 0 || count > WR2_MAX_PLANES || reader.remaining() != count * WR2_LEN * 8 + 16 + 4 { + return None; + } + let mut planes = Vec::with_capacity(count); + for _ in 0..count { + let mut coefficients = [0.0; WR2_LEN]; + for value in &mut coefficients { + *value = reader.finite_f64().filter(|value| value.abs() <= WR2_MAX_COEF)?; } - 3 => Opcode::FixVignetteRadial { k: [f(&mut r)?, f(&mut r)?, f(&mut r)?, f(&mut r)?, f(&mut r)?], center: [f(&mut r)?, f(&mut r)?] }, - 4 => Opcode::FixBadPixelsConstant { constant: r.u32()?, bayer_phase: r.u32()? }, - 5 => { - let bayer_phase = r.u32()?; - let (np, nr) = (r.u32()? as usize, r.u32()? as usize); - if np.saturating_mul(8).saturating_add(nr.saturating_mul(16)) > r.remaining() { - return None; - } - let points = (0..np).map(|_| Some((r.u32()?, r.u32()?))).collect::>()?; - let rects = (0..nr).map(|_| Some([r.u32()?, r.u32()?, r.u32()?, r.u32()?])).collect::>()?; - Opcode::FixBadPixelsList { bayer_phase, points, rects } + if !(coefficients[17] >= 0.0 && coefficients[17] < coefficients[18] && coefficients[18] <= 1.0) { + return None; } - 6 => Opcode::TrimBounds { top: r.u32()?, left: r.u32()?, bottom: r.u32()?, right: r.u32()? }, + planes.push(coefficients); + } + let center = [reader.finite_f64().filter(|value| value.abs() <= 4.0)?, reader.finite_f64().filter(|value| value.abs() <= 4.0)?]; + Some(Opcode::WarpRectilinear2 { planes, center, reciprocal: reader.u32()? != 0, optional: flags & 1 != 0 }) +} + +fn parse_bad_pixel_list(reader: &mut Rd<'_>) -> Option { + let bayer_phase = reader.u32()?; + let (point_count, rect_count) = (reader.u32()? as usize, reader.u32()? as usize); + if point_count.saturating_mul(8).saturating_add(rect_count.saturating_mul(16)) > reader.remaining() { + return None; + } + let points = (0..point_count).map(|_| Some((reader.u32()?, reader.u32()?))).collect::>()?; + let rects = (0..rect_count).map(|_| Some([reader.u32()?, reader.u32()?, reader.u32()?, reader.u32()?])).collect::>()?; + Some(Opcode::FixBadPixelsList { bayer_phase, points, rects }) +} + +fn parse_area_opcode(id: u32, reader: &mut Rd<'_>) -> Option { + let area = reader.area()?; + match id { 7 => { - let area = r.area()?; - let n = r.u32()? as usize; - if n == 0 || n > 65536 || n * 2 > r.remaining() { + let count = reader.u32()? as usize; + if count == 0 || count > 65536 || count * 2 > reader.remaining() { return None; } - Opcode::MapTable { area, table: (0..n).map(|_| r.u16()).collect::>()? } + Some(Opcode::MapTable { area, table: (0..count).map(|_| reader.u16()).collect::>()? }) } 8 => { - let area = r.area()?; - let deg = r.u32()? as usize; - if deg > 8 { + let degree = reader.u32()? as usize; + if degree > 8 { return None; } - Opcode::MapPolynomial { area, coefficients: (0..=deg).map(|_| f(&mut r)).collect::>()? } + Some(Opcode::MapPolynomial { area, coefficients: (0..=degree).map(|_| reader.finite_f64()).collect::>()? }) } - 9 => { - let area = r.area()?; - let (pv, ph) = (r.u32()?, r.u32()?); - let spacing = [f(&mut r)?, f(&mut r)?]; - let origin = [f(&mut r)?, f(&mut r)?]; - let mp = r.u32()?; - let n = (pv as usize).checked_mul(ph as usize)?.checked_mul(mp as usize)?; - if n == 0 || n * 4 > r.remaining() { - return None; - } - let gains = (0..n).map(|_| r.f32()).collect::>()?; - Opcode::GainMap { area, points_v: pv, points_h: ph, spacing, origin, map_planes: mp, gains } - } - 10..=13 => { - let area = r.area()?; - let n = r.u32()? as usize; - if n * 4 > r.remaining() { - return None; - } - let v: Vec = (0..n).map(|_| r.f32()).collect::>()?; - match id { - 10 => Opcode::DeltaPerRow { area, deltas: v }, - 11 => Opcode::DeltaPerColumn { area, deltas: v }, - 12 => Opcode::ScalePerRow { area, scales: v }, - _ => Opcode::ScalePerColumn { area, scales: v }, - } - } - _ => Opcode::Unknown { id, flags, params: params.to_vec() }, + 9 => parse_gain_map(area, reader), + 10..=13 => parse_delta_scale(id, area, reader), + _ => None, + } +} + +fn parse_gain_map(area: Area, reader: &mut Rd<'_>) -> Option { + let (points_v, points_h) = (reader.u32()?, reader.u32()?); + let spacing = [reader.finite_f64()?, reader.finite_f64()?]; + let origin = [reader.finite_f64()?, reader.finite_f64()?]; + let map_planes = reader.u32()?; + let count = (points_v as usize).checked_mul(points_h as usize)?.checked_mul(map_planes as usize)?; + if count == 0 || count * 4 > reader.remaining() { + return None; + } + let gains = (0..count).map(|_| reader.f32()).collect::>()?; + Some(Opcode::GainMap { area, points_v, points_h, spacing, origin, map_planes, gains }) +} + +fn parse_delta_scale(id: u32, area: Area, reader: &mut Rd<'_>) -> Option { + let count = reader.u32()? as usize; + if count * 4 > reader.remaining() { + return None; + } + let values: Vec = (0..count).map(|_| reader.f32()).collect::>()?; + Some(match id { + 10 => Opcode::DeltaPerRow { area, deltas: values }, + 11 => Opcode::DeltaPerColumn { area, deltas: values }, + 12 => Opcode::ScalePerRow { area, scales: values }, + _ => Opcode::ScalePerColumn { area, scales: values }, }) } @@ -508,19 +528,29 @@ fn area_iter(a: &Area, w: usize, h: usize, cpp: usize) -> impl Iterator f32 { - let (pv, ph) = (points_v as usize, points_h as usize); - let mp = map_planes as usize; - let p = plane.min(mp - 1); - let fy = if spacing[0] > 0.0 { ((rv - origin[0]) / spacing[0]).clamp(0.0, (pv - 1) as f64) } else { 0.0 }; - let fx = if spacing[1] > 0.0 { ((rh - origin[1]) / spacing[1]).clamp(0.0, (ph - 1) as f64) } else { 0.0 }; - let (y0, x0) = (fy.floor() as usize, fx.floor() as usize); - let (y1, x1) = ((y0 + 1).min(pv - 1), (x0 + 1).min(ph - 1)); - let (ty, tx) = ((fy - y0 as f64) as f32, (fx - x0 as f64) as f32); - let g = |y: usize, x: usize| gains[(y * ph + x) * mp + p]; - let top = g(y0, x0) + (g(y0, x1) - g(y0, x0)) * tx; - let bot = g(y1, x0) + (g(y1, x1) - g(y1, x0)) * tx; - top + (bot - top) * ty +struct GainMapGrid<'a> { + points: [usize; 2], + spacing: [f64; 2], + origin: [f64; 2], + planes: usize, + gains: &'a [f32], +} + +impl GainMapGrid<'_> { + fn sample_at(&self, position: [f64; 2], plane: usize) -> f32 { + let [pv, ph] = self.points; + let mp = self.planes; + let p = plane.min(mp - 1); + let fy = if self.spacing[0] > 0.0 { ((position[0] - self.origin[0]) / self.spacing[0]).clamp(0.0, (pv - 1) as f64) } else { 0.0 }; + let fx = if self.spacing[1] > 0.0 { ((position[1] - self.origin[1]) / self.spacing[1]).clamp(0.0, (ph - 1) as f64) } else { 0.0 }; + let (y0, x0) = (fy.floor() as usize, fx.floor() as usize); + let (y1, x1) = ((y0 + 1).min(pv - 1), (x0 + 1).min(ph - 1)); + let (ty, tx) = ((fy - y0 as f64) as f32, (fx - x0 as f64) as f32); + let g = |y: usize, x: usize| self.gains[(y * ph + x) * mp + p]; + let top = g(y0, x0) + (g(y0, x1) - g(y0, x0)) * tx; + let bot = g(y1, x0) + (g(y1, x1) - g(y1, x0)) * tx; + top + (bot - top) * ty + } } /// Radius normaliser: distance from the centre to the farthest image corner. @@ -556,10 +586,17 @@ pub fn apply_list(list: &[Opcode], buf: &mut [f32], w: usize, h: usize, cpp: usi } } Opcode::GainMap { area, points_v, points_h, spacing, origin, map_planes, gains } => { + let grid = GainMapGrid { + points: [*points_v as usize, *points_h as usize], + spacing: *spacing, + origin: *origin, + planes: *map_planes as usize, + gains, + }; for (x, y, p) in area_iter(area, w, h, cpp) { let rv = y as f64 / h as f64; let rh = x as f64 / w as f64; - let g = gain_at(*points_v, *points_h, *spacing, *origin, *map_planes, gains, rv, rh, p - area.plane as usize); + let g = grid.sample_at([rv, rh], p - area.plane as usize); buf[(y * w + x) * cpp + p] *= g; } } diff --git a/crates/raw/src/tiffraw.rs b/crates/raw/src/tiffraw.rs index 57878b881c..b6a1971ceb 100644 --- a/crates/raw/src/tiffraw.rs +++ b/crates/raw/src/tiffraw.rs @@ -1,6 +1,6 @@ //! Reading the pixel data of a TIFF IFD (strips or tiles; uncompressed, lossless/lossy JPEG, Deflate, JPEG XL), in parallel. -use crate::unpack::*; +use crate::unpack::{f16_to_f32, f24_to_f32, inflate, read_u16s, undo_diff_u16, undo_float_predictor, unpack_lsb, unpack_msb, unpack_words32_msb}; use crate::{MAX_SAMPLES, RawData, RawError, Result, ljpeg}; use lightcraft_tiff::image::{Chunk, ImageInfo, chunk_bytes}; use lightcraft_tiff::{ByteOrder, tags::compression as comp}; diff --git a/crates/raw/tests/it/crx_properties.rs b/crates/raw/tests/it/crx_properties.rs index 804970de43..ec61aa3b81 100644 --- a/crates/raw/tests/it/crx_properties.rs +++ b/crates/raw/tests/it/crx_properties.rs @@ -632,20 +632,23 @@ fn lossless_file((width, height): (usize, usize), values: &[i32]) -> Fixture { /// Constant-coefficient planes for one tile: LL3 flat at `ll3`, band `mid_band.0` flat at `mid_band.1`, /// everything else zero. Encoded at the given level count with the given quant/gain/base parameters. -fn constant_band_planes( - plane_w: usize, - plane_h: usize, +struct ConstantBandPlaneConfig<'a> { + plane_size: (usize, usize), levels: u8, ll3: i32, mid_band: Option<(usize, i32)>, quant: u8, gains: [u32; 10], bases: [u32; 10], - qp: Option<&[i32]>, + qp: Option<&'a [i32]>, qp_padding: usize, - before: bool, - after: bool, -) -> (usize, Vec) { + boundary_bands: (bool, bool), +} + +fn constant_band_planes(config: ConstantBandPlaneConfig<'_>) -> (usize, Vec) { + let ConstantBandPlaneConfig { plane_size: (plane_w, plane_h), levels, ll3, mid_band, quant, gains, bases, qp, qp_padding, boundary_bands } = + config; + let (before, after) = boundary_bands; let planes: [Vec>; 4] = if levels == 0 { let mut encoded: [Vec>; 4] = Default::default(); for bands in encoded.iter_mut() { @@ -681,7 +684,18 @@ fn constant_band_planes( /// A 16×16 three-level C-RAW file built from constant bands at the given uniform quant value. fn constant_bands_file(ll3: i32, mid_band: Option<(usize, i32)>, quant: u8) -> Fixture { - let (header_size, sample) = constant_band_planes(8, 8, 3, ll3, mid_band, quant, [0; 10], [0; 10], None, 0, false, false); + let (header_size, sample) = constant_band_planes(ConstantBandPlaneConfig { + plane_size: (8, 8), + levels: 3, + ll3, + mid_band, + quant, + gains: [0; 10], + bases: [0; 10], + qp: None, + qp_padding: 0, + boundary_bands: (false, false), + }); let coding = cmp1(0x100, 16, 16, 16, 16, 3, header_size as u32); Fixture { file: wrap(&coding, 16, 16, &sample, None), expected: Vec::new() } } @@ -697,7 +711,18 @@ fn v200_mapped_file( bases: [u32; 10], ) -> Fixture { assert_eq!(map.len(), (width / 16) * (height / 4)); - let (header_size, sample) = constant_band_planes(width / 2, height / 2, 3, ll3, mid_band, 4, gains, bases, Some(map), 3, false, false); + let (header_size, sample) = constant_band_planes(ConstantBandPlaneConfig { + plane_size: (width / 2, height / 2), + levels: 3, + ll3, + mid_band, + quant: 4, + gains, + bases, + qp: Some(map), + qp_padding: 3, + boundary_bands: (false, false), + }); let coding = cmp1(0x200, width as u32, height as u32, width as u32, height as u32, 3, header_size as u32); Fixture { file: wrap(&coding, width as u32, height as u32, &sample, None), expected: Vec::new() } } @@ -811,20 +836,18 @@ proptest! { } *b = if i < 4 { base + 1 } else { base }; } - let (header_size, sample) = constant_band_planes( - width / 2, - height / 2, - 3, + let (header_size, sample) = constant_band_planes(ConstantBandPlaneConfig { + plane_size: (width / 2, height / 2), + levels: 3, ll3, - Some((4, mid)), - 4, + mid_band: Some((4, mid)), + quant: 4, gains, bases, - Some(&qp_values[..map_w * map_h]), - 3, - false, - false, - ); + qp: Some(&qp_values[..map_w * map_h]), + qp_padding: 3, + boundary_bands: (false, false), + }); let coding = cmp1(0x200, width as u32, height as u32, width as u32, height as u32, 3, header_size as u32); let file = wrap(&coding, width as u32, height as u32, &sample, None); let image = decode(&file).unwrap(); @@ -879,7 +902,18 @@ fn lossless_sample(value: i32) -> Vec { /// Raw sample bytes of a constant-band 16×16 C-RAW fixture. fn constant_bands_sample(ll3: i32, mid_band: Option<(usize, i32)>, quant: u8) -> Vec { - let (_, sample) = constant_band_planes(8, 8, 3, ll3, mid_band, quant, [0; 10], [0; 10], None, 0, false, false); + let (_, sample) = constant_band_planes(ConstantBandPlaneConfig { + plane_size: (8, 8), + levels: 3, + ll3, + mid_band, + quant, + gains: [0; 10], + bases: [0; 10], + qp: None, + qp_padding: 0, + boundary_bands: (false, false), + }); sample } From 196a0c1a4513257d00c289fb2b15e7b984ca5e88 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 12:59:22 +0000 Subject: [PATCH 47/93] docs: require lint inheritance for new crates --- CLAUDE.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 6034902e93..1ff3defb05 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -56,8 +56,9 @@ of it. Full standard: `../craftrules/standards/never-crash.md` denies `cognitive_complexity`, `too_many_arguments` and `wildcard_imports`; members inherit them with `[lints] workspace = true`, and `sysmem` repeats those denies in its local lint table. Every production crate root (`lib.rs`, each binary's `main.rs`) carries `#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, - clippy::unimplemented, clippy::todo, clippy::unreachable)]`. New crates inherit workspace lints and start with the - attribute. + clippy::unimplemented, clippy::todo, clippy::unreachable)]`. Every new workspace crate must include + `[lints] workspace = true` in `Cargo.toml` to inherit `[workspace.lints]`, and new production crate roots start with + the attribute. ## Non-negotiables - **Clean-room.** Never read/disassemble anything inside Adobe app bundles (names/listings only). Never copy Adobe icons, presets, profiles (DCP), lens profiles (LCP), camera matrices, fonts. Observation of the installed Lightroom is read-only (it syncs the user's personal library: never import/edit/rate/delete there). Never copy GPL/LGPL/AGPL code (darktable, RawTherapee, ART, LibRaw, rawspeed, rawloader, rawler, lensfun, dcraw-derived GPL code…). From 2f42ff894455f655630c7c2ce269ec801c4e78c5 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 13:19:08 +0000 Subject: [PATCH 48/93] refactor(pipeline): group pixel finish parameters --- crates/engine/src/media/render.rs | 4 +- crates/gpu/src/render.rs | 12 +- crates/pipeline/src/finish.rs | 315 +++++++++++++++--------------- 3 files changed, 169 insertions(+), 162 deletions(-) diff --git a/crates/engine/src/media/render.rs b/crates/engine/src/media/render.rs index 1192a98e07..a87a0792c4 100644 --- a/crates/engine/src/media/render.rs +++ b/crates/engine/src/media/render.rs @@ -1,6 +1,8 @@ use super::quick::QuickSource; use super::source::{DecodedSource, SourceLevel, SourceRef}; -use super::*; +use super::{ + Arc, DevelopSettings, Hash128, Histogram, PhotoId, PreviewCache, Quality, RenderRequest, Rendered, Rgb32f, Rgba8, Source, SourceInfo, StageCache, +}; /// Everything needed to render one photo, detached from the session. #[derive(Clone)] diff --git a/crates/gpu/src/render.rs b/crates/gpu/src/render.rs index 64990db0e1..90aed7974c 100644 --- a/crates/gpu/src/render.rs +++ b/crates/gpu/src/render.rs @@ -6,7 +6,7 @@ use std::sync::{Arc, Mutex}; use lightcraft_develop::DevelopSettings; use lightcraft_geom::Orientation; -use lightcraft_pipeline::finish::{FinishParams, MASK_TERMS, mask_terms}; +use lightcraft_pipeline::finish::{FinishParams, FinishParamsInput, MASK_TERMS, mask_terms}; use lightcraft_pipeline::geometry::SampleMode; use lightcraft_pipeline::local::plane_at; use lightcraft_pipeline::{Plan, RenderRequest, Rendered, SourceInfo, local}; @@ -668,7 +668,15 @@ pub fn render( lap("masks", &mut t, &mut cx); // 5. per-pixel stage - let mut fp = FinishParams::new(s, &plan.frame, info, w, h, plan.px_per_long, prep.air, req.space); + let mut fp = FinishParams::new(FinishParamsInput { + settings: s, + frame: &plan.frame, + info, + image_size: (w, h), + px_per_long: plan.px_per_long, + air_pre: prep.air, + space: req.space, + }); // soft proofing as the CPU's `finish` sets it up (an output-device table never gets here: see `render`) fp.proof = req.proof.map(|pr| pr.params(req.space)); if let Some(d) = &req.display { diff --git a/crates/pipeline/src/finish.rs b/crates/pipeline/src/finish.rs index c1e6a9bc20..4fccd11342 100644 --- a/crates/pipeline/src/finish.rs +++ b/crates/pipeline/src/finish.rs @@ -186,19 +186,20 @@ pub struct FinishParams { pub peak: f32, } +pub struct FinishParamsInput<'a> { + pub settings: &'a DevelopSettings, + pub frame: &'a Frame, + pub info: &'a SourceInfo, + pub image_size: (usize, usize), + pub px_per_long: f64, + pub air_pre: f32, + pub space: OutputSpace, +} + impl FinishParams { /// Parameters for a `w × h` render into `space`; `ev`/`air_pre` as in [`crate::Prepared`]. - #[allow(clippy::too_many_arguments)] - pub fn new( - s: &DevelopSettings, - frame: &Frame, - info: &SourceInfo, - w: usize, - h: usize, - px_per_long: f64, - air_pre: f32, - space: OutputSpace, - ) -> FinishParams { + pub fn new(input: FinishParamsInput<'_>) -> FinishParams { + let FinishParamsInput { settings: s, frame, info, image_size: (w, h), px_per_long, air_pre, space } = input; let effects = s.section_enabled("effects"); let (clar, tex, dehaze) = if effects { ((s.effects.clarity / 100.0) as f32, (s.effects.texture / 100.0) as f32, (s.effects.dehaze / 100.0) as f32) @@ -288,7 +289,8 @@ pub(crate) fn finish( proof: Option, ) -> Rgba8 { let (w, h) = (p.img.width, p.img.height); - let mut fp = FinishParams::new(s, frame, info, w, h, p.px_per_long, p.air, space); + let mut fp = + FinishParams::new(FinishParamsInput { settings: s, frame, info, image_size: (w, h), px_per_long: p.px_per_long, air_pre: p.air, space }); fp.proof = proof.map(|pr| pr.params(space)); if let Some(d) = display { fp.for_display(d, proof); @@ -305,7 +307,6 @@ pub(crate) fn finish( } /// [`finish`] into 16-bit display-encoded or 32-bit float linear samples (output primaries). -#[allow(clippy::too_many_arguments)] pub(crate) fn finish_deep( p: &Prepared, s: &DevelopSettings, @@ -317,7 +318,8 @@ pub(crate) fn finish_deep( ) -> DeepImage { use lightcraft_color::transfer::srgb_to_linear; let (w, h) = (p.img.width, p.img.height); - let mut fp = FinishParams::new(s, frame, info, w, h, p.px_per_long, p.air, space); + let mut fp = + FinishParams::new(FinishParamsInput { settings: s, frame, info, image_size: (w, h), px_per_long: p.px_per_long, air_pre: p.air, space }); fp.proof = proof.map(|pr| pr.params(space)); let trc = fp.out_trc; let samples = match depth { @@ -354,29 +356,7 @@ pub(crate) fn finish_with( ) -> Vec { let (w, h) = (p.img.width, p.img.height); let p_lut = fp.lut.clone(); - let FinishParams { - tone, - ops, - curves, - vig, - to_out, - out_luma, - hl, - sh, - clar, - tex, - dehaze, - sharpen, - sharpen_mask, - air, - air_pre, - gain, - ev, - grain, - .. - } = fp; - let (hl, sh, clar, tex, dehaze, sharpen, sharpen_mask, air, air_pre, gain, ev) = - (*hl, *sh, *clar, *tex, *dehaze, *sharpen, *sharpen_mask, *air, *air_pre, *gain, *ev); + let FinishParams { curves, vig, to_out, out_luma, grain, .. } = fp; let terms: Vec<[f32; MASK_TERMS]> = p.masks.iter().map(|m| mask_terms(&m.adjust)).collect(); let out_to_norm = fp.out_to_norm; let long = fp.ow.max(fp.oh); @@ -392,128 +372,17 @@ pub(crate) fn finish_with( for (x, px) in row.iter_mut().enumerate() { let i = y * w + x; let raw = p.img.data[i]; - let mut c = if gain == 1.0 { raw } else { raw.map(|v| v * gain) }; + let local = pixel_local_terms(p, &terms, i); + let l_sat = local.values[11]; + let l_hue = local.values[12]; let l_pre = p.log_l.data[i]; - let l0 = l_pre + ev; - - // --- local (mask) contributions: alpha-weighted sums of the masks' terms - let mut l = [0.0f32; MASK_SUMS]; - let mut tint_col: Option<([f32; 3], f32)> = None; - for (m, t) in p.masks.iter().zip(&terms) { - let a = m.alpha.data[i]; - if a <= 0.0 { - continue; - } - for k in 0..MASK_SUMS { - l[k] += a * t[k]; - } - if t[MASK_SUMS] > 0.0 { - tint_col = Some(([t[MASK_SUMS + 1], t[MASK_SUMS + 2], 0.0], a * t[MASK_SUMS + 3])); - } - } - let [l_exp, l_temp, l_tint, l_con, l_hl, l_sh, l_wh, l_bl, l_tex, l_clar, l_dehaze, l_sat, l_hue, l_sharp, l_noise, l_moire, l_defringe] = - l; - - // --- local Moiré (and the colour part of Noise): chromaticity towards its blur - let mt = (l_moire + 0.5 * l_noise.max(0.0)).clamp(-1.0, 1.0); - if mt != 0.0 - && let Some(cb) = &p.chroma_blur - { - let (y, ch0, cb) = (luminance_2020(c), crate::masks::chromaticity(raw), cb.data[i]); - c = std::array::from_fn(|k| ((ch0[k] + (cb[k] - ch0[k]) * mt) * y).max(0.0)); - } - // --- local Defringe: desaturate purple / green fringes along edges - let df = l_defringe.clamp(0.0, 1.0); - if df > 0.0 - && let Some(b) = &p.texture_blur - { - let k = df * defringe_weight(c, p.log_l.data[i] - b.data[i]); - if k > 0.0 { - let y = luminance_2020(c); - c = c.map(|v| v + (y - v) * k); - } - } - - // --- dehaze (scene linear) - let dz = dehaze + l_dehaze; - if dz != 0.0 - && let Some(dark) = &p.dark - { - // The dark channel is a blur, not a patch minimum: near bright neighbours it credits - // dark pixels with veil they don't hold (and a windowed render borrows the whole - // frame's airlight), so the subtraction went past zero and crushed them to black - // (#2504). Never attribute more veil than the pixel's own minimum channel. - let c_min = c[0].min(c[1]).min(c[2]); - let d = (if air_pre > 0.0 { dark.data[i] / air_pre } else { 0.0 }).min(if air > 0.0 { c_min / air } else { 0.0 }).clamp(0.0, 1.0); - if dz > 0.0 { - let t = (1.0 - 0.95 * dz.min(1.0) * d).max(0.12); - c = c.map(|v| ((v - air * (1.0 - t)) / t).max(0.0)); - } else { - let k = (-dz).min(1.0) * 0.7 * (0.35 + 0.65 * d); - c = c.map(|v| v + (air * 0.9 - v) * k); - } - } - - // --- local exposure / temp / tint - if l_exp != 0.0 { - let g = l_exp.exp2(); - c = c.map(|v| v * g); - } - if l_temp != 0.0 || l_tint != 0.0 { - let y0 = luminance_2020(c); - c = [c[0] * (1.0 + 0.3 * l_temp), c[1] * (1.0 - 0.22 * l_tint), c[2] * (1.0 - 0.3 * l_temp).max(0.0)]; - let y1 = luminance_2020(c).max(1e-9); - c = c.map(|v| v * y0 / y1); - } + let l0 = l_pre + fp.ev; + let (mut c, l1) = adjust_scene_pixel(p, fp, i, raw, &local); // --- local tone in log luminance - let l1 = if dz != 0.0 || l_exp != 0.0 { log_lum(c) } else { l0 }; let shift = l1 - l0; - let base = p.base.data[i] + ev + shift; - let mut delta = 0.0f32; - let (hh, ss) = (hl + l_hl, sh + l_sh); - if hh != 0.0 || ss != 0.0 { - let ws = 1.0 - smooth(-4.8, 0.3, base); - let wh = smooth(-1.0, 2.8, base); - delta += ss * 1.7 * ws * ws.sqrt() + hh * 1.7 * wh; - } - if l_wh != 0.0 { - delta += l_wh * 0.8 * smooth(0.5, 3.0, l1); - } - if l_bl != 0.0 { - delta += l_bl * 0.8 * (1.0 - smooth(-6.0, -1.5, l1)); - } - if l_con != 0.0 { - delta += l_con * 0.14 * l1.clamp(-6.0, 4.0); - } - let cl = clar + l_clar; - if cl != 0.0 - && let Some(b) = &p.clarity_blur - { - let det = (l_pre - b.data[i]).clamp(-2.5, 2.5); - let mid = (-(base / 3.2).powi(2)).exp(); - delta += cl * 0.85 * det * (0.35 + 0.65 * mid); - } - let tx = tex + l_tex; - let sp = l_sharp * 0.6 + sharpen; - if (tx != 0.0 || sp != 0.0) - && let Some(b) = &p.texture_blur - { - let det = l_pre - b.data[i]; - let tame = 1.0 - 0.6 * smooth(0.4, 1.6, det.abs()); - delta += tx * 1.1 * det.clamp(-1.0, 1.0) * tame; - if sp != 0.0 { - let m = if sharpen_mask > 0.0 { smooth(sharpen_mask * 0.25, sharpen_mask * 0.25 + 0.15, det.abs()) } else { 1.0 }; - delta += sp * 1.3 * det.clamp(-0.8, 0.8) * m; - } - } - // local Noise: smooth (or, negative, boost) small-amplitude detail, keep edges - if l_noise != 0.0 - && let Some(b) = &p.texture_blur - { - let det = l_pre - b.data[i]; - delta -= l_noise.clamp(-1.0, 1.0) * 0.9 * det * (1.0 - smooth(0.1, 0.5, det.abs())); - } + let base = p.base.data[i] + fp.ev + shift; + let delta = local_tone_delta(p, fp, i, base, l1, &local); if delta != 0.0 { let g = delta.exp2(); c = c.map(|v| v * g); @@ -526,9 +395,9 @@ pub(crate) fn finish_with( // --- tone map on luminance, highlight desaturation let yl = luminance_2020(c); - let o = tone.apply(yl); + let o = fp.tone.apply(yl); let mut d = if yl > 1e-9 { c.map(|v| v * o / yl) } else { [0.0; 3] }; - let k = tone.chroma_scale(o); + let k = fp.tone.chroma_scale(o); if k != 1.0 { d = d.map(|v| o + (v - o) * k); } @@ -539,8 +408,8 @@ pub(crate) fn finish_with( } // --- colour - d = ops.apply(d, l_sat, l_hue); - if let Some((dir, amt)) = tint_col { + d = fp.ops.apply(d, l_sat, l_hue); + if let Some((dir, amt)) = local.tint { let lab = lightcraft_color::perceptual::oklab_from_2020(d); d = lightcraft_color::perceptual::oklab_to_2020([lab[0], lab[1] + dir[0] * 0.08 * amt, lab[2] + dir[1] * 0.08 * amt]); } @@ -663,6 +532,134 @@ pub(crate) fn finish_with( out } +struct PixelLocalTerms { + values: [f32; MASK_SUMS], + tint: Option<([f32; 3], f32)>, +} + +fn pixel_local_terms(p: &Prepared, terms: &[[f32; MASK_TERMS]], index: usize) -> PixelLocalTerms { + let mut values = [0.0; MASK_SUMS]; + let mut tint = None; + for (mask, terms) in p.masks.iter().zip(terms) { + let alpha = mask.alpha.data[index]; + if alpha <= 0.0 { + continue; + } + for (sum, term) in values.iter_mut().zip(terms.iter().take(MASK_SUMS)) { + *sum += alpha * term; + } + if terms[MASK_SUMS] > 0.0 { + tint = Some(([terms[MASK_SUMS + 1], terms[MASK_SUMS + 2], 0.0], alpha * terms[MASK_SUMS + 3])); + } + } + PixelLocalTerms { values, tint } +} + +fn adjust_scene_pixel(p: &Prepared, fp: &FinishParams, index: usize, raw: [f32; 3], local: &PixelLocalTerms) -> ([f32; 3], f32) { + let [l_exp, l_temp, l_tint, _, _, _, _, _, _, _, l_dehaze, _, _, _, l_noise, l_moire, l_defringe] = local.values; + let mut color = if fp.gain == 1.0 { raw } else { raw.map(|value| value * fp.gain) }; + + let moire = (l_moire + 0.5 * l_noise.max(0.0)).clamp(-1.0, 1.0); + if moire != 0.0 + && let Some(blur) = &p.chroma_blur + { + let (luminance, original, blurred) = (luminance_2020(color), crate::masks::chromaticity(raw), blur.data[index]); + color = std::array::from_fn(|channel| ((original[channel] + (blurred[channel] - original[channel]) * moire) * luminance).max(0.0)); + } + let defringe = l_defringe.clamp(0.0, 1.0); + if defringe > 0.0 + && let Some(blur) = &p.texture_blur + { + let amount = defringe * defringe_weight(color, p.log_l.data[index] - blur.data[index]); + if amount > 0.0 { + let luminance = luminance_2020(color); + color = color.map(|value| value + (luminance - value) * amount); + } + } + + let dehaze = fp.dehaze + l_dehaze; + if dehaze != 0.0 + && let Some(dark) = &p.dark + { + // Limit the estimated veil to the pixel's own minimum channel. This avoids crushing bright + // neighbours when the dark-channel blur spans the edge of a local window. + let min_channel = color[0].min(color[1]).min(color[2]); + let veil = (if fp.air_pre > 0.0 { dark.data[index] / fp.air_pre } else { 0.0 }) + .min(if fp.air > 0.0 { min_channel / fp.air } else { 0.0 }) + .clamp(0.0, 1.0); + if dehaze > 0.0 { + let transmission = (1.0 - 0.95 * dehaze.min(1.0) * veil).max(0.12); + color = color.map(|value| ((value - fp.air * (1.0 - transmission)) / transmission).max(0.0)); + } else { + let amount = (-dehaze).min(1.0) * 0.7 * (0.35 + 0.65 * veil); + color = color.map(|value| value + (fp.air * 0.9 - value) * amount); + } + } + + if l_exp != 0.0 { + let gain = l_exp.exp2(); + color = color.map(|value| value * gain); + } + if l_temp != 0.0 || l_tint != 0.0 { + let luminance_before = luminance_2020(color); + color = [color[0] * (1.0 + 0.3 * l_temp), color[1] * (1.0 - 0.22 * l_tint), color[2] * (1.0 - 0.3 * l_temp).max(0.0)]; + let luminance_after = luminance_2020(color).max(1e-9); + color = color.map(|value| value * luminance_before / luminance_after); + } + + let l0 = p.log_l.data[index] + fp.ev; + let log_luminance = if dehaze != 0.0 || l_exp != 0.0 { log_lum(color) } else { l0 }; + (color, log_luminance) +} + +fn local_tone_delta(p: &Prepared, fp: &FinishParams, index: usize, base: f32, l1: f32, local: &PixelLocalTerms) -> f32 { + let [_, _, _, l_con, l_hl, l_sh, l_wh, l_bl, l_tex, l_clar, _, _, _, l_sharp, l_noise, _, _] = local.values; + let mut delta = 0.0; + let (highlights, shadows) = (fp.hl + l_hl, fp.sh + l_sh); + if highlights != 0.0 || shadows != 0.0 { + let shadow_weight = 1.0 - smooth(-4.8, 0.3, base); + let highlight_weight = smooth(-1.0, 2.8, base); + delta += shadows * 1.7 * shadow_weight * shadow_weight.sqrt() + highlights * 1.7 * highlight_weight; + } + if l_wh != 0.0 { + delta += l_wh * 0.8 * smooth(0.5, 3.0, l1); + } + if l_bl != 0.0 { + delta += l_bl * 0.8 * (1.0 - smooth(-6.0, -1.5, l1)); + } + if l_con != 0.0 { + delta += l_con * 0.14 * l1.clamp(-6.0, 4.0); + } + let clarity = fp.clar + l_clar; + if clarity != 0.0 + && let Some(blur) = &p.clarity_blur + { + let detail = (p.log_l.data[index] - blur.data[index]).clamp(-2.5, 2.5); + let midtone = (-(base / 3.2).powi(2)).exp(); + delta += clarity * 0.85 * detail * (0.35 + 0.65 * midtone); + } + let texture = fp.tex + l_tex; + let sharpen = l_sharp * 0.6 + fp.sharpen; + if (texture != 0.0 || sharpen != 0.0) + && let Some(blur) = &p.texture_blur + { + let detail = p.log_l.data[index] - blur.data[index]; + let tame = 1.0 - 0.6 * smooth(0.4, 1.6, detail.abs()); + delta += texture * 1.1 * detail.clamp(-1.0, 1.0) * tame; + if sharpen != 0.0 { + let mask = if fp.sharpen_mask > 0.0 { smooth(fp.sharpen_mask * 0.25, fp.sharpen_mask * 0.25 + 0.15, detail.abs()) } else { 1.0 }; + delta += sharpen * 1.3 * detail.clamp(-0.8, 0.8) * mask; + } + } + if l_noise != 0.0 + && let Some(blur) = &p.texture_blur + { + let detail = p.log_l.data[index] - blur.data[index]; + delta -= l_noise.clamp(-1.0, 1.0) * 0.9 * detail * (1.0 - smooth(0.1, 0.5, detail.abs())); + } + delta +} + /// A colour needing more desaturation than this (scale < `GAMUT_WARN`) to fit is out of gamut for /// the gamut warnings (tolerates rounding at the gamut boundary). const GAMUT_WARN: f32 = 0.995; From a3da2d1040b2c48b130b6eca96bb533742585ee6 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 13:19:09 +0000 Subject: [PATCH 49/93] refactor(denoise): model Bayer tile regions --- crates/denoise-core/src/bayer.rs | 25 ++++++++++++++++++------- crates/denoise-core/src/run.rs | 9 +++++++-- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/crates/denoise-core/src/bayer.rs b/crates/denoise-core/src/bayer.rs index a4a00d9472..365bec436c 100644 --- a/crates/denoise-core/src/bayer.rs +++ b/crates/denoise-core/src/bayer.rs @@ -14,6 +14,14 @@ pub struct Layout { pub dy: usize, } +/// The mosaic dimensions and cell origin for one square denoiser input tile. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct TileRegion { + pub mosaic_size: (usize, usize), + pub cell_origin: (isize, isize), + pub tile_size: usize, +} + impl Layout { /// The layout of a 2 × 2 colour pattern, row-major, colours 0 = red, 1 = green, 2 = blue; `None` when /// it is not a Bayer cell (one red, one blue, the greens on the other diagonal). @@ -65,7 +73,10 @@ pub fn reflect(i: isize, n: usize) -> usize { /// Pack the `tile × tile` cells whose top-left cell is `(cx0, cy0)` into `out` as four planes `[R, G1, G2, B]` /// (`4 · tile²` values, NCHW). G1 is the green beside the red sample, G2 the green under it. Samples outside /// the picture are mirrored. Returns `false` (and writes nothing) when the sizes do not fit. -pub fn pack_tile(mosaic: &[f32], width: usize, height: usize, layout: Layout, cx0: isize, cy0: isize, tile: usize, out: &mut [f32]) -> bool { +pub fn pack_tile(mosaic: &[f32], layout: Layout, region: TileRegion, out: &mut [f32]) -> bool { + let (width, height) = region.mosaic_size; + let (cx0, cy0) = region.cell_origin; + let tile = region.tile_size; let Some(plane) = tile.checked_mul(tile) else { return false }; let Some(values) = plane.checked_mul(4) else { return false }; if width == 0 @@ -113,7 +124,7 @@ mod tests { let layout = Layout::from_cell([0, 1, 1, 2]).unwrap(); let mut out = [7.0; 4]; for (w, h, tile, x) in [(usize::MAX, 2, 1, 0), (1, 1, usize::MAX, 0), (1, 1, 0, 0), (1, 1, 1, isize::MAX), (1, 1, 1, isize::MIN)] { - assert!(!pack_tile(&[0.5], w, h, layout, x, 0, tile, &mut out)); + assert!(!pack_tile(&[0.5], layout, TileRegion { mosaic_size: (w, h), cell_origin: (x, 0), tile_size: tile }, &mut out)); assert_eq!(out, [7.0; 4]); } for n in [1, 2, isize::MAX as usize, usize::MAX] { @@ -160,7 +171,7 @@ mod tests { let (nx, ny) = layout.cells(w, h); let tile = nx.max(ny); let mut out = vec![0.0; 4 * tile * tile]; - assert!(pack_tile(&mosaic, w, h, layout, 0, 0, tile, &mut out)); + assert!(pack_tile(&mosaic, layout, TileRegion { mosaic_size: (w, h), cell_origin: (0, 0), tile_size: tile }, &mut out)); let plane = tile * tile; for (p, want) in [10.0, 20.0, 20.0, 30.0].into_iter().enumerate() { assert!(out[p * plane..(p + 1) * plane].iter().all(|&v| v == want), "layout {cell:?} plane {p}"); @@ -174,7 +185,7 @@ mod tests { let (w, h) = (4, 4); let mosaic: Vec = (0..16).map(|i| i as f32).collect(); let mut out = vec![0.0; 4 * 4]; - assert!(pack_tile(&mosaic, w, h, Layout { dx: 0, dy: 0 }, 0, 0, 2, &mut out)); + assert!(pack_tile(&mosaic, Layout { dx: 0, dy: 0 }, TileRegion { mosaic_size: (w, h), cell_origin: (0, 0), tile_size: 2 }, &mut out)); // cell (0,0): R = site (0,0)=0, G1 = site (1,0)=1, G2 = site (0,1)=4, B = site (1,1)=5 assert_eq!([out[0], out[4], out[8], out[12]], [0.0, 1.0, 4.0, 5.0]); // cell (1,0): sites (2,0)=2, (3,0)=3, (2,1)=6, (3,1)=7 @@ -184,8 +195,8 @@ mod tests { #[test] fn packing_rejects_wrong_sizes() { let mut out = vec![0.0; 16]; - assert!(!pack_tile(&[0.0; 15], 4, 4, Layout { dx: 0, dy: 0 }, 0, 0, 2, &mut out)); - assert!(!pack_tile(&[0.0; 16], 4, 4, Layout { dx: 0, dy: 0 }, 0, 0, 3, &mut out)); - assert!(!pack_tile(&[], 0, 0, Layout { dx: 0, dy: 0 }, 0, 0, 2, &mut out)); + assert!(!pack_tile(&[0.0; 15], Layout { dx: 0, dy: 0 }, TileRegion { mosaic_size: (4, 4), cell_origin: (0, 0), tile_size: 2 }, &mut out)); + assert!(!pack_tile(&[0.0; 16], Layout { dx: 0, dy: 0 }, TileRegion { mosaic_size: (4, 4), cell_origin: (0, 0), tile_size: 3 }, &mut out)); + assert!(!pack_tile(&[], Layout { dx: 0, dy: 0 }, TileRegion { mosaic_size: (0, 0), cell_origin: (0, 0), tile_size: 2 }, &mut out)); } } diff --git a/crates/denoise-core/src/run.rs b/crates/denoise-core/src/run.rs index 4314ed8c3d..180587d5d6 100644 --- a/crates/denoise-core/src/run.rs +++ b/crates/denoise-core/src/run.rs @@ -9,7 +9,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; use lightcraft_raster::Rgb32f; use rayon::prelude::*; -use crate::bayer::{Layout, pack_tile}; +use crate::bayer::{Layout, TileRegion, pack_tile}; use crate::manifest::Gain; use crate::tiles::{starts, weight}; @@ -139,7 +139,12 @@ pub fn denoise_bayer( .par_iter() .map(|&(x0, y0, bx, ax, by, ay)| { let mut input = allocate(4 * p.tile * p.tile, 0f32)?; - if !pack_tile(mosaic, width, height, layout, x0 as isize, y0 as isize, p.tile, &mut input) { + if !pack_tile( + mosaic, + layout, + TileRegion { mosaic_size: (width, height), cell_origin: (x0 as isize, y0 as isize), tile_size: p.tile }, + &mut input, + ) { return Err(Error::Input("a tile could not be packed".into())); } let mut out = runner.run(&input)?; From 694b237f0a47337d722530893bee81f057f9ecb8 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 13:19:12 +0000 Subject: [PATCH 50/93] refactor(faces): model crop and plane shift inputs --- crates/engine/src/faces_worker.rs | 14 ++++++-------- crates/faces/src/align.rs | 27 +++++++++++++++++++-------- crates/faces/src/net/kernels.rs | 20 ++++++++++++-------- crates/faces/src/net/program.rs | 2 +- crates/faces/src/net/shape.rs | 2 +- 5 files changed, 39 insertions(+), 26 deletions(-) diff --git a/crates/engine/src/faces_worker.rs b/crates/engine/src/faces_worker.rs index 61dbc25443..c9512f6cb0 100644 --- a/crates/engine/src/faces_worker.rs +++ b/crates/engine/src/faces_worker.rs @@ -13,7 +13,7 @@ use std::sync::{Arc, Condvar, Mutex, PoisonError}; use std::time::Duration; use lightcraft_catalog::PhotoId; -use lightcraft_faces::align::{Rgb, align_to_template, crop_box}; +use lightcraft_faces::align::{FaceCrop, Rgb, align_to_template, crop_box}; use lightcraft_faces::runtime::Embedder; use lightcraft_faces::yunet::{Detector, Face, Options}; use lightcraft_geom::Rect; @@ -221,13 +221,11 @@ pub(crate) fn process(p: Prepared, embedder: &Embedder) -> Done { Some((_, f)) => align_to_template(&img, &scaled(f), iw, ih), None => crop_box( &img, - rect.x0 as f32 * w as f32, - rect.y0 as f32 * h as f32, - rect.x1 as f32 * w as f32, - rect.y1 as f32 * h as f32, - BOX_PAD, - iw, - ih, + FaceCrop { + bounds: (rect.x0 as f32 * w as f32, rect.y0 as f32 * h as f32, rect.x1 as f32 * w as f32, rect.y1 as f32 * h as f32), + padding: BOX_PAD, + output_size: (iw, ih), + }, ), }; // shown by the detector's box where it found this face: every face then has the same tightness diff --git a/crates/faces/src/align.rs b/crates/faces/src/align.rs index 4982325aeb..387d028a6e 100644 --- a/crates/faces/src/align.rs +++ b/crates/faces/src/align.rs @@ -19,6 +19,14 @@ pub struct Rgb<'a> { pub height: usize, } +/// Face bounds, padding factor, and output dimensions for box-based alignment. +#[derive(Clone, Copy, Debug, PartialEq)] +pub struct FaceCrop { + pub bounds: (f32, f32, f32, f32), + pub padding: f32, + pub output_size: (usize, usize), +} + impl Rgb<'_> { fn valid(&self) -> bool { self.width > 0 && self.height > 0 && self.width.checked_mul(self.height).and_then(|n| n.checked_mul(3)) == Some(self.data.len()) @@ -145,7 +153,10 @@ pub fn align_to_template(img: &Rgb, landmarks: &[(f32, f32); 5], out_w: usize, o } /// A square around a face box (pixels of `img`), `pad` times its larger side, as `out_w` × `out_h`. -pub fn crop_box(img: &Rgb, x0: f32, y0: f32, x1: f32, y1: f32, pad: f32, out_w: usize, out_h: usize) -> Option> { +pub fn crop_box(img: &Rgb, crop: FaceCrop) -> Option> { + let (x0, y0, x1, y1) = crop.bounds; + let pad = crop.padding; + let (out_w, out_h) = crop.output_size; if ![x0, y0, x1, y1, pad].iter().all(|v| v.is_finite()) { return None; } @@ -247,16 +258,16 @@ mod tests { } } let img = Rgb { data: &data, width: w, height: h }; - let out = crop_box(&img, 90.0, 40.0, 110.0, 60.0, 2.0, 64, 64).unwrap(); + let out = crop_box(&img, FaceCrop { bounds: (90.0, 40.0, 110.0, 60.0), padding: 2.0, output_size: (64, 64) }).unwrap(); // the 20 px block fills the middle half of the 64 px output let at = |x: usize, y: usize| out[(y * 64 + x) * 3 + 1]; assert!(at(32, 32) > 250 && at(20, 20) > 250 && at(44, 44) > 250 && at(5, 5) < 5 && at(60, 32) < 5); - assert!(crop_box(&img, 5.0, 5.0, 5.0, 5.0, 2.0, 64, 64).is_none(), "an empty box"); - assert!(crop_box(&img, f32::NAN, 0.0, 10.0, 10.0, 2.0, 64, 64).is_none()); - assert!(crop_box(&img, 0.0, 0.0, 10.0, 10.0, 2.0, 0, 64).is_none()); - assert!(crop_box(&img, 0.0, 0.0, 10.0, 10.0, 2.0, 100_000, 64).is_none()); + assert!(crop_box(&img, FaceCrop { bounds: (5.0, 5.0, 5.0, 5.0), padding: 2.0, output_size: (64, 64) }).is_none(), "an empty box"); + assert!(crop_box(&img, FaceCrop { bounds: (f32::NAN, 0.0, 10.0, 10.0), padding: 2.0, output_size: (64, 64) }).is_none()); + assert!(crop_box(&img, FaceCrop { bounds: (0.0, 0.0, 10.0, 10.0), padding: 2.0, output_size: (0, 64) }).is_none()); + assert!(crop_box(&img, FaceCrop { bounds: (0.0, 0.0, 10.0, 10.0), padding: 2.0, output_size: (100_000, 64) }).is_none()); let bad = Rgb { data: &data[..10], width: w, height: h }; - assert!(crop_box(&bad, 0.0, 0.0, 10.0, 10.0, 2.0, 64, 64).is_none(), "wrong data length"); + assert!(crop_box(&bad, FaceCrop { bounds: (0.0, 0.0, 10.0, 10.0), padding: 2.0, output_size: (64, 64) }).is_none(), "wrong data length"); } #[test] @@ -264,7 +275,7 @@ mod tests { let data = vec![80u8; 50 * 50 * 3]; let img = Rgb { data: &data, width: 50, height: 50 }; // a box mostly outside the picture is padded by clamping, not an error - assert!(crop_box(&img, -30.0, -30.0, 20.0, 20.0, 1.5, 32, 32).is_some()); + assert!(crop_box(&img, FaceCrop { bounds: (-30.0, -30.0, 20.0, 20.0), padding: 1.5, output_size: (32, 32) }).is_some()); let far: [(f32, f32); 5] = [(1e6, 1e6), (1e6 + 5.0, 1e6), (1e6 + 2.0, 1e6 + 3.0), (1e6, 1e6 + 6.0), (1e6 + 5.0, 1e6 + 6.0)]; let _ = align_to_template(&img, &far, 112, 112); let tiny: [(f32, f32); 5] = [(1.0, 1.0), (1.01, 1.0), (1.0, 1.01), (1.01, 1.01), (1.005, 1.005)]; diff --git a/crates/faces/src/net/kernels.rs b/crates/faces/src/net/kernels.rs index 71ae95874e..6ad7e83ddb 100644 --- a/crates/faces/src/net/kernels.rs +++ b/crates/faces/src/net/kernels.rs @@ -1,5 +1,5 @@ //! Safe CPU kernels shared by detection and recognition. No inner thread pool. -use super::*; +use super::{ConvJob, Graph, MAX_TENSOR, NetError, Node, Result, Tensor, chw, conv_direct, pads, pair, program, shape, shape_err}; use ndarray::{ArrayView2, ArrayViewMut2, linalg::general_mat_mul}; const BLOCK: usize = 256; #[derive(Default)] @@ -30,7 +30,16 @@ fn multiply(w: &[f32], x: &[f32], y: &mut [f32], m: usize, k: usize, n: usize) - } /// For equal-width, unit-stride maps a shifted plane is one contiguous copy. Only horizontal /// border stripes need masking; clipping the flat source range also removes vertical padding. -fn shifted_plane(plane: &[f32], width: usize, ky: usize, kx: usize, pt: usize, pl: usize, start: usize, row: &mut [f32]) -> Result<()> { +#[derive(Clone, Copy)] +struct PlaneShift { + width: usize, + kernel: (usize, usize), + padding: (usize, usize), + start: usize, +} + +fn shifted_plane(plane: &[f32], row: &mut [f32], shift: PlaneShift) -> Result<()> { + let PlaneShift { width, kernel: (ky, kx), padding: (pt, pl), start } = shift; let end = start + row.len(); let delta = (ky as i128 - pt as i128) * width as i128 + kx as i128 - pl as i128; let lo = (-delta).clamp(start as i128, end as i128); @@ -145,13 +154,8 @@ pub(super) fn conv(n: &Node, x: &Tensor, g: &Graph, scratch: &mut Scratch) -> Re if sh == 1 && sw == 1 && ow == w { shifted_plane( plane, - w, - ky, - kx, - pt, - pl, - start, row.get_mut(..len).ok_or_else(|| NetError::Shape("short lower panel".into()))?, + PlaneShift { width: w, kernel: (ky, kx), padding: (pt, pl), start }, )?; continue; } diff --git a/crates/faces/src/net/program.rs b/crates/faces/src/net/program.rs index e00e51da1d..db7dcba5d9 100644 --- a/crates/faces/src/net/program.rs +++ b/crates/faces/src/net/program.rs @@ -9,7 +9,7 @@ use std::borrow::Cow; -use super::*; +use super::{ConvJob, Data, HashMap, Net, NetError, Result, kernels, pads, pair, shape, shape_err, unsupported}; /// Value 0 is the network's input. pub const INPUT: usize = 0; diff --git a/crates/faces/src/net/shape.rs b/crates/faces/src/net/shape.rs index a1594ca6bc..39e585c613 100644 --- a/crates/faces/src/net/shape.rs +++ b/crates/faces/src/net/shape.rs @@ -1,5 +1,5 @@ //! Bounded, allocation-free (apart from small shape lists) graph checking. -use super::*; +use super::{Data, Graph, HashMap, MAX_TENSOR, NetError, Node, Result, pads, pair, shape_err, unsupported}; use crate::graph::{Attr, Weight}; pub(super) fn elements(s: &[usize]) -> Result { From de6cb3cd4120b274dee48e6688b9a5460d8ca2de Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 13:19:14 +0000 Subject: [PATCH 51/93] refactor(codecs): separate TIFF sample encoders --- crates/codecs/src/encode.rs | 126 +++++++++++++++++++++++------------- 1 file changed, 82 insertions(+), 44 deletions(-) diff --git a/crates/codecs/src/encode.rs b/crates/codecs/src/encode.rs index 725980e53d..8aff31c5cb 100644 --- a/crates/codecs/src/encode.rs +++ b/crates/codecs/src/encode.rs @@ -227,7 +227,7 @@ pub enum TiffCompression { /// Encode TIFF: 8/16-bit integer or 32-bit float, gray/RGB with optional (unassociated) alpha. /// ICC and XMP are embedded; EXIF is not (write it through the TIFF writer in `lightcraft-tiff`). pub fn encode_tiff(img: &EncodeImage, compression: TiffCompression, meta: &EncodeMeta) -> Result> { - use tiff::encoder::{Compression, DeflateLevel, TiffEncoder, colortype}; + use tiff::encoder::{Compression, DeflateLevel, TiffEncoder}; use tiff::tags::Predictor; img.validate()?; let e = |e: tiff::TiffError| Error::Encode(e.to_string()); @@ -243,54 +243,92 @@ pub fn encode_tiff(img: &EncodeImage, compression: TiffCompression, meta: &Encod if !float && matches!(compression, TiffCompression::Lzw | TiffCompression::Deflate) { Predictor::Horizontal } else { Predictor::None }; let mut enc = TiffEncoder::new(&mut cur).map_err(e)?.with_compression(comp).with_predictor(predictor); let (w, h) = (img.width, img.height); - let n = w as usize * h as usize; - // Gray + alpha is stored as RGBA (the encoder has no GrayA colour type). - let ch = img.channels as usize; - - macro_rules! write { - ($ct:ty, $data:expr, $alpha:expr) => {{ - let mut im = enc.new_image::<$ct>(w, h).map_err(e)?; - if let Some(ppi) = meta.ppi.filter(|p| *p > 0) { - im.resolution(tiff::tags::ResolutionUnit::Inch, tiff::encoder::Rational { n: ppi as u32, d: 1 }); - } - if let Some(icc) = meta.icc { - im.encoder().write_tag(tiff::tags::Tag::IccProfile, icc).map_err(e)?; - } - if let Some(xmp) = meta.xmp { - im.encoder().write_tag(tiff::tags::Tag::from_u16_exhaustive(700), xmp.as_bytes()).map_err(e)?; - } - if $alpha { - im.encoder().write_tag(tiff::tags::Tag::ExtraSamples, &[2u16][..]).map_err(e)?; - } - im.write_data($data).map_err(e)?; - }}; - } - fn expand_ga(s: &[T], n: usize) -> Vec { - s.as_chunks::<2>().0.iter().take(n).flat_map(|c| [c[0], c[0], c[0], c[1]]).collect() - } + let pixels = w as usize * h as usize; match img.samples { - Samples::U8(s) => match ch { - 1 => write!(colortype::Gray8, &s[..n], false), - 2 => write!(colortype::RGBA8, &expand_ga(s, n), true), - 3 => write!(colortype::RGB8, &s[..n * 3], false), - _ => write!(colortype::RGBA8, &s[..n * 4], true), - }, - Samples::U16(s) => match ch { - 1 => write!(colortype::Gray16, &s[..n], false), - 2 => write!(colortype::RGBA16, &expand_ga(s, n), true), - 3 => write!(colortype::RGB16, &s[..n * 3], false), - _ => write!(colortype::RGBA16, &s[..n * 4], true), - }, - Samples::F32(s) => match ch { - 1 => write!(colortype::Gray32Float, &s[..n], false), - 2 => write!(colortype::RGBA32Float, &expand_ga(s, n), true), - 3 => write!(colortype::RGB32Float, &s[..n * 3], false), - _ => write!(colortype::RGBA32Float, &s[..n * 4], true), - }, + Samples::U8(samples) => write_tiff_u8(&mut enc, samples, pixels, img.channels as usize, img, meta)?, + Samples::U16(samples) => write_tiff_u16(&mut enc, samples, pixels, img.channels as usize, img, meta)?, + Samples::F32(samples) => write_tiff_f32(&mut enc, samples, pixels, img.channels as usize, img, meta)?, } Ok(cur.into_inner()) } +macro_rules! write_tiff_image { + ($encoder:expr, $image:expr, $meta:expr, $color:ty, $data:expr, $alpha:expr) => {{ + let mut image = $encoder.new_image::<$color>($image.width, $image.height).map_err(|e| Error::Encode(e.to_string()))?; + if let Some(ppi) = $meta.ppi.filter(|ppi| *ppi > 0) { + image.resolution(tiff::tags::ResolutionUnit::Inch, tiff::encoder::Rational { n: ppi as u32, d: 1 }); + } + if let Some(icc) = $meta.icc { + image.encoder().write_tag(tiff::tags::Tag::IccProfile, icc).map_err(|e| Error::Encode(e.to_string()))?; + } + if let Some(xmp) = $meta.xmp { + image.encoder().write_tag(tiff::tags::Tag::from_u16_exhaustive(700), xmp.as_bytes()).map_err(|e| Error::Encode(e.to_string()))?; + } + if $alpha { + image.encoder().write_tag(tiff::tags::Tag::ExtraSamples, &[2u16][..]).map_err(|e| Error::Encode(e.to_string()))?; + } + image.write_data($data).map_err(|e| Error::Encode(e.to_string()))?; + }}; +} + +fn expanded_gray_alpha(samples: &[T], pixels: usize) -> Vec { + samples.as_chunks::<2>().0.iter().take(pixels).flat_map(|channel| [channel[0], channel[0], channel[0], channel[1]]).collect() +} + +fn write_tiff_u8( + encoder: &mut tiff::encoder::TiffEncoder, + samples: &[u8], + pixels: usize, + channels: usize, + image: &EncodeImage, + meta: &EncodeMeta, +) -> Result<()> { + use tiff::encoder::colortype; + match channels { + 1 => write_tiff_image!(encoder, image, meta, colortype::Gray8, &samples[..pixels], false), + 2 => write_tiff_image!(encoder, image, meta, colortype::RGBA8, &expanded_gray_alpha(samples, pixels), true), + 3 => write_tiff_image!(encoder, image, meta, colortype::RGB8, &samples[..pixels * 3], false), + _ => write_tiff_image!(encoder, image, meta, colortype::RGBA8, &samples[..pixels * 4], true), + } + Ok(()) +} + +fn write_tiff_u16( + encoder: &mut tiff::encoder::TiffEncoder, + samples: &[u16], + pixels: usize, + channels: usize, + image: &EncodeImage, + meta: &EncodeMeta, +) -> Result<()> { + use tiff::encoder::colortype; + match channels { + 1 => write_tiff_image!(encoder, image, meta, colortype::Gray16, &samples[..pixels], false), + 2 => write_tiff_image!(encoder, image, meta, colortype::RGBA16, &expanded_gray_alpha(samples, pixels), true), + 3 => write_tiff_image!(encoder, image, meta, colortype::RGB16, &samples[..pixels * 3], false), + _ => write_tiff_image!(encoder, image, meta, colortype::RGBA16, &samples[..pixels * 4], true), + } + Ok(()) +} + +fn write_tiff_f32( + encoder: &mut tiff::encoder::TiffEncoder, + samples: &[f32], + pixels: usize, + channels: usize, + image: &EncodeImage, + meta: &EncodeMeta, +) -> Result<()> { + use tiff::encoder::colortype; + match channels { + 1 => write_tiff_image!(encoder, image, meta, colortype::Gray32Float, &samples[..pixels], false), + 2 => write_tiff_image!(encoder, image, meta, colortype::RGBA32Float, &expanded_gray_alpha(samples, pixels), true), + 3 => write_tiff_image!(encoder, image, meta, colortype::RGB32Float, &samples[..pixels * 3], false), + _ => write_tiff_image!(encoder, image, meta, colortype::RGBA32Float, &samples[..pixels * 4], true), + } + Ok(()) +} + /// Encode a flat PSD (8/16-bit gray or RGB, no layers; alpha dropped): the hand-off an image /// editor such as PhotoCraft saves back to in place. ICC, EXIF, XMP and resolution are embedded. pub fn encode_psd(img: &EncodeImage, meta: &EncodeMeta) -> Result> { From 33252920e3f15a576d81aa6f49beb86630af6c69 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 13:19:16 +0000 Subject: [PATCH 52/93] refactor(denoise): model installation requests --- crates/engine/src/cmd/denoise.rs | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/crates/engine/src/cmd/denoise.rs b/crates/engine/src/cmd/denoise.rs index 644d3b89ee..1cb99ccf35 100644 --- a/crates/engine/src/cmd/denoise.rs +++ b/crates/engine/src/cmd/denoise.rs @@ -129,16 +129,18 @@ fn identify(path: &Path, c: &str, sha_known: Option<&str>) -> Result { /// Install the model in `src`. A model that passes its self-test becomes the one in use (`activate`, the default): installing /// a model is how someone says they want it. `verified` is for a download whose hash was already checked. -fn install_file( - dir: &Path, - loader: &crate::denoise::Loader, +struct InstallFile<'a> { + dir: &'a Path, run_on: RunOn, accepted_at: String, - c: &str, - src: &Path, + command: &'a str, + src: &'a Path, acknowledged: bool, verified: bool, -) -> Result<(Value, Arc)> { +} + +fn install_file(loader: &crate::denoise::Loader, request: InstallFile<'_>) -> Result<(Value, Arc)> { + let InstallFile { dir, run_on, accepted_at, command: c, src, acknowledged, verified } = request; let ident = identify(src, c, None)?; let m = ident.manifest.clone(); manifest::validate(&m).map_err(|e| bad(c, e.to_string()))?; @@ -262,7 +264,8 @@ fn start_install(s: &mut Session, src: PathBuf, id: String, activate: bool, veri .spawn(move || { let outcome = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| { let _held = crate::memory::work_gate().acquire(512 * 1024 * 1024); - install_file(&dir, &loader, run_on, at, C, &src, true, verified).map_err(|e| plain(&e)) + install_file(&loader, InstallFile { dir: &dir, run_on, accepted_at: at, command: C, src: &src, acknowledged: true, verified }) + .map_err(|e| plain(&e)) })) .unwrap_or_else(|_| Err("the model installation stopped unexpectedly".into())); if verified { @@ -290,8 +293,18 @@ fn install(s: &mut Session, p: &Value) -> Result { if s.denoise.install.is_some() { return Err(bad(C, "another model is being installed")); } - let (result, model) = - install_file(&models_dir(s, C)?, &s.denoise.loader, s.denoise.settings.run_on(), (s.clock)(), C, Path::new(path), acknowledged, false)?; + let (result, model) = install_file( + &s.denoise.loader, + InstallFile { + dir: &models_dir(s, C)?, + run_on: s.denoise.settings.run_on(), + accepted_at: (s.clock)(), + command: C, + src: Path::new(path), + acknowledged, + verified: false, + }, + )?; activate_install(s, &result, model, activate) } From e8f52cc07e1a7520b9365c26288e68a556d75465 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 13:19:18 +0000 Subject: [PATCH 53/93] refactor(print): define blit rectangles --- crates/engine/src/print/compose.rs | 19 +++++++++++++++---- crates/engine/src/print/compose/tests.rs | 4 ++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/print/compose.rs b/crates/engine/src/print/compose.rs index d8e1eeb876..16c683a84a 100644 --- a/crates/engine/src/print/compose.rs +++ b/crates/engine/src/print/compose.rs @@ -255,6 +255,15 @@ pub struct Image16 { pub rgb: Vec, } +/// A rectangular image region used as a source or destination for `Image16::blit`. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct BlitRect { + pub x: usize, + pub y: usize, + pub w: usize, + pub h: usize, +} + impl Image16 { pub fn filled(w: usize, h: usize, c: [u16; 3]) -> Result { let n = w.checked_mul(h).and_then(|n| n.checked_mul(3)).ok_or("image too large")?; @@ -284,9 +293,11 @@ impl Image16 { } /// Copies the `w` x `h` block of `src` at (`sx`, `sy`) to (`dx`, `dy`), clipped to both images. - pub fn blit(&mut self, src: &Image16, sx: usize, sy: usize, dx: usize, dy: usize, w: usize, h: usize) { - let w = w.min(src.w.saturating_sub(sx)).min(self.w.saturating_sub(dx)); - let h = h.min(src.h.saturating_sub(sy)).min(self.h.saturating_sub(dy)); + pub fn blit(&mut self, src: &Image16, source: BlitRect, destination: BlitRect) { + let BlitRect { x: sx, y: sy, .. } = source; + let BlitRect { x: dx, y: dy, .. } = destination; + let w = source.w.min(destination.w).min(src.w.saturating_sub(sx)).min(self.w.saturating_sub(dx)); + let h = source.h.min(destination.h).min(src.h.saturating_sub(sy)).min(self.h.saturating_sub(dy)); for row in 0..h { let from = src.rgb.get(((sy + row) * src.w + sx) * 3..((sy + row) * src.w + sx + w) * 3); let to = self.rgb.get_mut(((dy + row) * self.w + dx) * 3..((dy + row) * self.w + dx + w) * 3); @@ -424,7 +435,7 @@ pub fn draw_cell(page: &mut Image16, photo: &Image16, cell: PxRect, style: &Cell if border > 0 { page.fill_rect(dx - border, dy - border, w + 2 * border, h + 2 * border, style.border); } - page.blit(&img, sx, sy, dx, dy, w, h); + page.blit(&img, BlitRect { x: sx, y: sy, w, h }, BlitRect { x: dx, y: dy, w, h }); let s = style.stroke_px.min(w.min(h) / 2); if s > 0 { page.fill_rect(dx, dy, w, s, style.stroke); diff --git a/crates/engine/src/print/compose/tests.rs b/crates/engine/src/print/compose/tests.rs index cdec92799e..f1e979cc0a 100644 --- a/crates/engine/src/print/compose/tests.rs +++ b/crates/engine/src/print/compose/tests.rs @@ -182,9 +182,9 @@ fn rotate_and_blit_are_clipped() { let r = img.rotated_cw().unwrap(); assert_eq!((r.w, r.h), (2, 3)); let mut p = page(); - p.blit(&img, 0, 0, 99, 99, 10, 10); + p.blit(&img, BlitRect { x: 0, y: 0, w: 10, h: 10 }, BlitRect { x: 99, y: 99, w: 10, h: 10 }); assert_eq!(at(&p, 99, 99), at(&img, 0, 0)); - p.blit(&img, 5, 5, 0, 0, 3, 3); + p.blit(&img, BlitRect { x: 5, y: 5, w: 3, h: 3 }, BlitRect { x: 0, y: 0, w: 3, h: 3 }); p.fill_rect(95, 95, 50, 50, RED); assert_eq!(at(&p, 99, 99), RED); p.fill_rect(usize::MAX, usize::MAX, usize::MAX, usize::MAX, RED); From 9e1483388f93fc5590c59b198183c36b58b3bab9 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 13:19:20 +0000 Subject: [PATCH 54/93] refactor(import): separate Lightroom collection staging --- crates/engine/src/lightroom_catalog.rs | 146 +++++++++++++------------ 1 file changed, 79 insertions(+), 67 deletions(-) diff --git a/crates/engine/src/lightroom_catalog.rs b/crates/engine/src/lightroom_catalog.rs index 207d1c1489..3066187ce3 100644 --- a/crates/engine/src/lightroom_catalog.rs +++ b/crates/engine/src/lightroom_catalog.rs @@ -858,6 +858,83 @@ pub(crate) struct ApplyPrepared<'a> { pub(crate) undo0: usize, } +fn stage_collections( + s: &mut crate::Session, + data: &CatalogImport, + index: &mut ImportIndex, + ids: &HashMap, + ops: &mut Vec, + warnings: &mut Vec, +) -> usize { + let mut albums = HashMap::new(); + for collection in &data.collections { + if number(collection, "systemOnly") != 0 { + continue; + } + let collection_key = format!("{}:{}", key(&data.source), number(collection, "id_local")); + let id = index + .collections + .get(&collection_key) + .copied() + .map(lightcraft_catalog::AlbumId) + .filter(|id| s.catalog.album(*id).is_some()) + .unwrap_or_else(|| s.catalog.alloc_album_id()); + index.collections.insert(collection_key, id.0); + albums.insert(number(collection, "id_local"), id); + } + let parents: HashMap<_, _> = data.collections.iter().map(|r| (number(r, "id_local"), number(r, "parent"))).collect(); + let mut grouped_members: HashMap> = HashMap::new(); + for member in &data.members { + grouped_members.entry(number(member, "collection")).or_default().push(member); + } + for members in grouped_members.values_mut() { + members.sort_by(|a, b| text(a, "positionInCollection").cmp(text(b, "positionInCollection"))); + } + let mut ordered: Vec<_> = data.collections.iter().collect(); + ordered.sort_by_key(|r| { + let mut depth = 0; + let mut at = number(r, "parent"); + while at != 0 && depth < 64 { + depth += 1; + at = parents.get(&at).copied().unwrap_or(0); + } + depth + }); + for collection in ordered { + let Some(id) = albums.get(&number(collection, "id_local")).copied() else { continue }; + let mut album = Album::new(id, text(collection, "name")); + album.parent = albums.get(&number(collection, "parent")).copied(); + album.folder = text(collection, "creationId").contains("group"); + if text(collection, "creationId").contains("smart") { + warnings.push(format!("{}: smart rules preserved in archive; imported current membership", album.name)); + } + if !album.folder { + album.photos = grouped_members + .get(&number(collection, "id_local")) + .into_iter() + .flatten() + .filter_map(|r| ids.get(&number(r, "image")).copied()) + .collect(); + } + if s.catalog.album(id).is_some() { + // Reimport preserves the user's album name/hierarchy, merges only new membership. + if let Some(old) = s.catalog.album(id).filter(|a| !a.folder && !a.is_smart()) { + let mut photos = old.photos.clone(); + let mut seen: HashSet<_> = photos.iter().copied().collect(); + for photo in album.photos { + if seen.insert(photo) { + photos.push(photo); + } + } + ops.push(Op::SetAlbumPhotos { id, photos }); + } + } else { + ops.push(Op::AddAlbum { album }); + } + } + albums.len() +} + /// Turn the read catalog into library records in one undo step and return the import report /// (added, missing, failed, warnings and skipped images). pub(crate) fn apply_prepared(s: &mut crate::Session, mut data: CatalogImport, context: ApplyPrepared<'_>) -> crate::Result { @@ -1022,78 +1099,13 @@ pub(crate) fn apply_prepared(s: &mut crate::Session, mut data: CatalogImport, co } by_path.entry(key(&src.path)).or_insert(photo_id); } - let mut albums = HashMap::new(); - for collection in &data.collections { - if number(collection, "systemOnly") != 0 { - continue; - } - let collection_key = format!("{}:{}", key(&data.source), number(collection, "id_local")); - let id = index - .collections - .get(&collection_key) - .copied() - .map(lightcraft_catalog::AlbumId) - .filter(|id| s.catalog.album(*id).is_some()) - .unwrap_or_else(|| s.catalog.alloc_album_id()); - index.collections.insert(collection_key, id.0); - albums.insert(number(collection, "id_local"), id); - } - let parents: HashMap<_, _> = data.collections.iter().map(|r| (number(r, "id_local"), number(r, "parent"))).collect(); - let mut grouped_members: HashMap> = HashMap::new(); - for member in &data.members { - grouped_members.entry(number(member, "collection")).or_default().push(member); - } - for members in grouped_members.values_mut() { - members.sort_by(|a, b| text(a, "positionInCollection").cmp(text(b, "positionInCollection"))); - } - let mut ordered: Vec<_> = data.collections.iter().collect(); - ordered.sort_by_key(|r| { - let mut depth = 0; - let mut at = number(r, "parent"); - while at != 0 && depth < 64 { - depth += 1; - at = parents.get(&at).copied().unwrap_or(0); - } - depth - }); - for collection in ordered { - let Some(id) = albums.get(&number(collection, "id_local")).copied() else { continue }; - let mut album = Album::new(id, text(collection, "name")); - album.parent = albums.get(&number(collection, "parent")).copied(); - album.folder = text(collection, "creationId").contains("group"); - if text(collection, "creationId").contains("smart") { - warnings.push(format!("{}: smart rules preserved in archive; imported current membership", album.name)); - } - if !album.folder { - album.photos = grouped_members - .get(&number(collection, "id_local")) - .into_iter() - .flatten() - .filter_map(|r| ids.get(&number(r, "image")).copied()) - .collect(); - } - if s.catalog.album(id).is_some() { - // Reimport preserves the user's album name/hierarchy, merges only new membership. - if let Some(old) = s.catalog.album(id).filter(|a| !a.folder && !a.is_smart()) { - let mut photos = old.photos.clone(); - let mut seen: HashSet<_> = photos.iter().copied().collect(); - for photo in album.photos { - if seen.insert(photo) { - photos.push(photo); - } - } - ops.push(Op::SetAlbumPhotos { id, photos }); - } - } else { - ops.push(Op::AddAlbum { album }); - } - } + let album_count = stage_collections(s, &data, index, &ids, &mut ops, &mut warnings); if !ops.is_empty() { s.commit("Import Lightroom Catalog", Op::Batch { ops })?; } s.merge_undo(s.undo.len().saturating_sub(undo0), "Import Lightroom Catalog"); Ok(AppliedImport { - report: json!({"source":data.source,"photos":ids.len(),"imported":imported,"library":s.library.as_ref().filter(|l| l.on_disk).map(|l| l.dir.to_string_lossy()),"collections":albums.len(),"preservedExistingEdits":preserved,"missing":missing,"failed":files.failed,"warnings":warnings,"skipped":data.skipped,"unmapped":unmapped,"archive":archive_path,"mapping":ids}), + report: json!({"source":data.source,"photos":ids.len(),"imported":imported,"library":s.library.as_ref().filter(|l| l.on_disk).map(|l| l.dir.to_string_lossy()),"collections":album_count,"preservedExistingEdits":preserved,"missing":missing,"failed":files.failed,"warnings":warnings,"skipped":data.skipped,"unmapped":unmapped,"archive":archive_path,"mapping":ids}), index: index.clone(), }) } From 9c1ea73116551d5ff85f9afe925b7ce258883b5c Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 13:19:23 +0000 Subject: [PATCH 55/93] refactor(gpu): extract neural plan validation --- crates/gpu/src/nn.rs | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/crates/gpu/src/nn.rs b/crates/gpu/src/nn.rs index 55420598bd..c5df00a771 100644 --- a/crates/gpu/src/nn.rs +++ b/crates/gpu/src/nn.rs @@ -235,32 +235,35 @@ fn round_up(v: usize, to: usize) -> usize { v.div_ceil(to) * to } -/// Work out the steps, the buffers and the arranged weights for `net` on `tile × tile` input cells. -fn plan(net: &Net, tile: usize, max_binding: u64) -> Result<(Layout, Vec), String> { +fn validate_plan(net: &Net, tile: usize, ops: &[Op]) -> Result<(), String> { if !net.fits_tile(tile) { return unsupported("the tile does not fit the network"); } if tile > MAX_TILE { return unsupported("the tile is larger than the kernels' dispatches reach"); } + if !net.in_channels.is_multiple_of(4) { + return unsupported("the input channel count is not a multiple of 4"); + } + let count = ops.len(); + let ends_right = matches!( + (count.checked_sub(2).and_then(|i| ops.get(i)), ops.last()), + (Some(Op::Conv(conv)), Some(Op::DepthToSpace2 { src })) + if conv.k == 1 && conv.src2.is_none() && *src == count - 1 && conv.cout == 12 && conv.leaky.is_none() + ); + if ends_right { Ok(()) } else { unsupported("the network does not end in a 1 × 1 convolution to 12 channels and depth-to-space") } +} + +/// Work out the steps, the buffers and the arranged weights for `net` on `tile × tile` input cells. +fn plan(net: &Net, tile: usize, max_binding: u64) -> Result<(Layout, Vec), String> { + let ops = net.ops(); + validate_plan(net, tile, ops)?; let side = |t: usize| -> usize { let level = net.shape(t).map_or(0, |s| s.level); if level >= 0 { tile >> level } else { tile << (-level) } }; let chan = |t: usize| net.shape(t).map_or(0, |s| s.channels); - if !net.in_channels.is_multiple_of(4) { - return unsupported("the input channel count is not a multiple of 4"); - } - let ops = net.ops(); - // the network must end in a 1 × 1 convolution and a depth-to-space (they run as one kernel) let n_ops = ops.len(); - let ends_right = matches!( - (n_ops.checked_sub(2).and_then(|i| ops.get(i)), ops.last()), - (Some(Op::Conv(c)), Some(Op::DepthToSpace2 { src })) if c.k == 1 && c.src2.is_none() && *src == n_ops - 1 && c.cout == 12 && c.leaky.is_none() - ); - if !ends_right { - return unsupported("the network does not end in a 1 × 1 convolution to 12 channels and depth-to-space"); - } // the last layer that reads each tensor let mut last_use = vec![0usize; n_ops + 1]; for (i, op) in ops.iter().enumerate() { From 47839a61db4f21b11954d28639e1d64b93893039 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 13:19:26 +0000 Subject: [PATCH 56/93] refactor(bench): dispatch specialized render modes --- crates/engine/examples/render_bench.rs | 188 +++++++++++++------------ 1 file changed, 100 insertions(+), 88 deletions(-) diff --git a/crates/engine/examples/render_bench.rs b/crates/engine/examples/render_bench.rs index 3d7dbc4453..54b6cfe82d 100644 --- a/crates/engine/examples/render_bench.rs +++ b/crates/engine/examples/render_bench.rs @@ -91,107 +91,119 @@ fn diff(a: &lightcraft_raster::Rgba8, b: &lightcraft_raster::Rgba8) -> (u8, f64) (max, sum as f64 / (a.data.len() * 3).max(1) as f64) } +fn benchmark_jpeg(args: &[String], n: usize) { + // a JPEG (e.g. an embedded preview pulled out with exiftool) decoded to fit a few boxes + for path in args { + let bytes = std::fs::read(path).expect("read"); + for edge in [256u32, 512, 1600, 2560] { + let o = lightcraft_codecs::DecodeOptions::fit(edge, edge); + let d = lightcraft_codecs::decode(&bytes, o).expect("decode"); + println!( + " {path} fit {edge}: {}×{} {}", + d.image.width, + d.image.height, + best(n, || drop(lightcraft_codecs::decode(&bytes, o).expect("decode"))) + ); + } + } +} + +fn benchmark_load(args: &[String], n: usize, only: &str) { + // opening a photo in the loupe, step by step: what the app's loaders cost (per file) + for path in args { + let bytes = std::fs::read(path).expect("read"); + println!("{path}"); + if std::env::var("LOADONLY").is_ok() { + // only the preview load (for a profiler) + println!(" {:<36} {}", "load_bytes(2560):", best(n, || drop(lightcraft_engine::files::load_bytes(&bytes, 2560).expect("load")))); + continue; + } + println!(" {:<36} {}", "file read:", best(n, || drop(std::fs::read(path).expect("read")))); + println!(" {:<36} {}", "raw decode:", best(n, || drop(lightcraft_raw::decode(&bytes).expect("decode")))); + let mut raw = lightcraft_raw::decode(&bytes).expect("decode"); + if let lightcraft_raw::RawData::U16(d) = &raw.data { + let sum = d.iter().enumerate().fold(0u64, |a, (i, &v)| a.wrapping_mul(31).wrapping_add(v as u64 ^ i as u64)); + println!(" decode checksum: {sum:016x}"); + } + if only == "load1" { + println!(" {:<36} {}", "load_bytes(2560):", best(n, || drop(lightcraft_engine::files::load_bytes(&bytes, 2560).expect("load")))); + continue; + } + raw.opcodes.list3.retain(|op| !op.is_lens_correction()); + if let Some(k) = lightcraft_engine::files::bin_factor(&raw, 2560) { + println!(" {:<36} {}", format!("binned ×{k} masked:"), best(n, || drop(raw.develop_binned_masked(k, 0.99)))); + } + for edge in [2560usize, 1600] { + println!( + " {:<36} {}", + format!("embedded srgb, whole file ({edge}):"), + best(n, || drop(lightcraft_engine::files::embedded_preview_srgb(&bytes, edge))) + ); + let quick = lightcraft_engine::files::fs_preview_loader(); + println!(" {:<36} {}", format!("fs_preview_loader ({edge}):"), best(n, || drop(quick(path, edge)))); + } + println!(" {:<36} {}", "load_bytes(2560):", best(n, || drop(lightcraft_engine::files::load_bytes(&bytes, 2560).expect("load")))); + let (loader, _) = lightcraft_engine::files::fs_hooks(); + println!(" {:<36} {}", "fs loader (2560, read+load):", best(n, || drop(loader(path, 2560).expect("load")))); + } +} + +fn benchmark_source(args: &[String], n: usize) { + // opening a photo: where the time goes before the first sharp loupe (per file) + for path in args { + let bytes = std::fs::read(path).expect("read"); + println!("{path}"); + let mut raw = lightcraft_raw::decode(&bytes).expect("decode"); + // as the loader does: lens corrections are applied by the pipeline, not in the raw develop + raw.opcodes.list3.retain(|op| !op.is_lens_correction()); + println!(" {}×{} cpp {} cfa {:?}", raw.width, raw.height, raw.cpp, raw.cfa.as_ref().map(|c| c.name())); + println!(" {:<36} {}", "raw decode:", best(n, || drop(lightcraft_raw::decode(&bytes).expect("decode")))); + println!(" {:<36} {}", "normalize:", best(n, || drop(raw.normalized().expect("norm")))); + let norm = raw.normalized().expect("norm"); + println!(" {:<36} {}", "demosaic AHD:", best(n, || drop(lightcraft_raw::demosaic(&norm, lightcraft_raw::Method::Ahd)))); + if let Some(k) = lightcraft_engine::files::bin_factor(&raw, 2560) { + println!(" {:<36} {}", format!("binned ×{k} (2560 preview):"), best(n, || drop(raw.develop_binned(k, 0.99)))); + let img = raw.develop_binned(k, 0.99).expect("bin").expect("binnable"); + let t = lightcraft_raw::color::camera_transform(&raw, lightcraft_raw::color::as_shot_white_xy(&raw)); + println!( + " {:<36} {}", + "highlight reconstruct (binned):", + best(n, || { + let mut i = img.clone(); + lightcraft_raw::highlight::reconstruct(&mut i, t.wb, 0.99); + }) + ); + println!(" {:<36} {}", "clone (binned):", best(n, || drop(img.clone()))); + println!(" {:<36} {}", "fit 2560 (binned):", best(n, || drop(fit(&img, 2560, 2560, Filter::Box)))); + } + println!(" {:<36} {}", "embedded preview (2560):", best(n, || drop(lightcraft_engine::files::load_embedded_preview(&bytes, 2560)))); + for edge in [512usize, 2560, usize::MAX] { + println!( + " {:<36} {}", + format!("load_bytes({edge}):"), + best(n, || drop(lightcraft_engine::files::load_bytes(&bytes, edge).expect("load"))) + ); + } + } +} + fn main() { let args: Vec = std::env::args().skip(1).collect(); let n: usize = std::env::var("N").ok().and_then(|v| v.parse().ok()).unwrap_or(5); let only = std::env::var("ONLY").unwrap_or_default(); - let run = |name: &str| only.is_empty() || only.split(',').any(|o| name.contains(o)); if only == "jpeg" { - // a JPEG (e.g. an embedded preview pulled out with exiftool) decoded to fit a few boxes - for path in &args { - let bytes = std::fs::read(path).expect("read"); - for edge in [256u32, 512, 1600, 2560] { - let o = lightcraft_codecs::DecodeOptions::fit(edge, edge); - let d = lightcraft_codecs::decode(&bytes, o).expect("decode"); - println!( - " {path} fit {edge}: {}×{} {}", - d.image.width, - d.image.height, - best(n, || drop(lightcraft_codecs::decode(&bytes, o).expect("decode"))) - ); - } - } + benchmark_jpeg(&args, n); return; } if only == "load" || only == "load1" { - // opening a photo in the loupe, step by step: what the app's loaders cost (per file) - for path in &args { - let bytes = std::fs::read(path).expect("read"); - println!("{path}"); - if std::env::var("LOADONLY").is_ok() { - // only the preview load (for a profiler) - println!(" {:<36} {}", "load_bytes(2560):", best(n, || drop(lightcraft_engine::files::load_bytes(&bytes, 2560).expect("load")))); - continue; - } - println!(" {:<36} {}", "file read:", best(n, || drop(std::fs::read(path).expect("read")))); - println!(" {:<36} {}", "raw decode:", best(n, || drop(lightcraft_raw::decode(&bytes).expect("decode")))); - let mut raw = lightcraft_raw::decode(&bytes).expect("decode"); - if let lightcraft_raw::RawData::U16(d) = &raw.data { - let sum = d.iter().enumerate().fold(0u64, |a, (i, &v)| a.wrapping_mul(31).wrapping_add(v as u64 ^ i as u64)); - println!(" decode checksum: {sum:016x}"); - } - if only == "load1" { - println!(" {:<36} {}", "load_bytes(2560):", best(n, || drop(lightcraft_engine::files::load_bytes(&bytes, 2560).expect("load")))); - continue; - } - raw.opcodes.list3.retain(|op| !op.is_lens_correction()); - if let Some(k) = lightcraft_engine::files::bin_factor(&raw, 2560) { - println!(" {:<36} {}", format!("binned ×{k} masked:"), best(n, || drop(raw.develop_binned_masked(k, 0.99)))); - } - for edge in [2560usize, 1600] { - println!( - " {:<36} {}", - format!("embedded srgb, whole file ({edge}):"), - best(n, || drop(lightcraft_engine::files::embedded_preview_srgb(&bytes, edge))) - ); - let quick = lightcraft_engine::files::fs_preview_loader(); - println!(" {:<36} {}", format!("fs_preview_loader ({edge}):"), best(n, || drop(quick(path, edge)))); - } - println!(" {:<36} {}", "load_bytes(2560):", best(n, || drop(lightcraft_engine::files::load_bytes(&bytes, 2560).expect("load")))); - let (loader, _) = lightcraft_engine::files::fs_hooks(); - println!(" {:<36} {}", "fs loader (2560, read+load):", best(n, || drop(loader(path, 2560).expect("load")))); - } + benchmark_load(&args, n, &only); return; } if only == "source" { - // opening a photo: where the time goes before the first sharp loupe (per file) - for path in &args { - let bytes = std::fs::read(path).expect("read"); - println!("{path}"); - let mut raw = lightcraft_raw::decode(&bytes).expect("decode"); - // as the loader does: lens corrections are applied by the pipeline, not in the raw develop - raw.opcodes.list3.retain(|op| !op.is_lens_correction()); - println!(" {}×{} cpp {} cfa {:?}", raw.width, raw.height, raw.cpp, raw.cfa.as_ref().map(|c| c.name())); - println!(" {:<36} {}", "raw decode:", best(n, || drop(lightcraft_raw::decode(&bytes).expect("decode")))); - println!(" {:<36} {}", "normalize:", best(n, || drop(raw.normalized().expect("norm")))); - let norm = raw.normalized().expect("norm"); - println!(" {:<36} {}", "demosaic AHD:", best(n, || drop(lightcraft_raw::demosaic(&norm, lightcraft_raw::Method::Ahd)))); - if let Some(k) = lightcraft_engine::files::bin_factor(&raw, 2560) { - println!(" {:<36} {}", format!("binned ×{k} (2560 preview):"), best(n, || drop(raw.develop_binned(k, 0.99)))); - let img = raw.develop_binned(k, 0.99).expect("bin").expect("binnable"); - let t = lightcraft_raw::color::camera_transform(&raw, lightcraft_raw::color::as_shot_white_xy(&raw)); - println!( - " {:<36} {}", - "highlight reconstruct (binned):", - best(n, || { - let mut i = img.clone(); - lightcraft_raw::highlight::reconstruct(&mut i, t.wb, 0.99); - }) - ); - println!(" {:<36} {}", "clone (binned):", best(n, || drop(img.clone()))); - println!(" {:<36} {}", "fit 2560 (binned):", best(n, || drop(fit(&img, 2560, 2560, Filter::Box)))); - } - println!(" {:<36} {}", "embedded preview (2560):", best(n, || drop(lightcraft_engine::files::load_embedded_preview(&bytes, 2560)))); - for edge in [512usize, 2560, usize::MAX] { - println!( - " {:<36} {}", - format!("load_bytes({edge}):"), - best(n, || drop(lightcraft_engine::files::load_bytes(&bytes, edge).expect("load"))) - ); - } - } + benchmark_source(&args, n); return; } + let run = |name: &str| only.is_empty() || only.split(',').any(|o| name.contains(o)); let (full, info) = match args.first() { Some(path) => { let bytes = std::fs::read(path).expect("read"); From 4d8369b09107fc7532140921a5083aebdedfe697 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 13:19:29 +0000 Subject: [PATCH 57/93] test(engine): factor complex regression scenarios --- crates/catalog/src/tests.rs | 43 ++-- crates/engine/src/crs/tests.rs | 18 +- crates/engine/src/export/tests.rs | 10 + .../src/sidecar/tests_repair_companions.rs | 146 ++++++------ .../src/sidecar/tests_repair_provenance.rs | 112 ++++----- .../engine/src/sidecar/tests_repair_saves.rs | 216 +++++++++--------- crates/engine/src/tests/import.rs | 198 +++++++++------- 7 files changed, 401 insertions(+), 342 deletions(-) diff --git a/crates/catalog/src/tests.rs b/crates/catalog/src/tests.rs index 579175086e..bf67b24958 100644 --- a/crates/catalog/src/tests.rs +++ b/crates/catalog/src/tests.rs @@ -904,17 +904,9 @@ fn search_text_finds_people_and_quoted_values() { /// What the catalog remembers of its latest ops: which photos each changed and what of them, as long as that can be /// said photo by photo. #[test] -fn the_catalog_remembers_which_photos_its_latest_ops_changed_and_what_of_them() { +fn photo_ops_record_touched_ids_and_changed_aspects() { let mut c = Catalog::default(); - let photo = |c: &mut Catalog, name: &str| { - let id = c.alloc_photo_id(); - c.apply(Op::AddPhoto { - photo: Box::new(Photo::new(id, Source::File { path: format!("/p/{name}") }, name, "JPEG", 60, 40, "2026-01-01T10:00:00")), - }) - .unwrap(); - id - }; - let (a, b) = (photo(&mut c, "a.jpg"), photo(&mut c, "b.jpg")); + let (a, b) = (photo(&mut c, "a.jpg", "2026-01-01T10:00:00"), photo(&mut c, "b.jpg", "2026-01-01T10:00:00")); let start = c.revision; assert_eq!(c.touched_since(start), Some(vec![])); assert_eq!(c.aspects_since(start), Some(Aspects::NONE)); @@ -940,28 +932,25 @@ fn the_catalog_remembers_which_photos_its_latest_ops_changed_and_what_of_them() assert_eq!(c.touched_since(before), None); assert_eq!(c.aspects_since(start), None); assert_eq!(c.touched_since(c.revision), Some(vec![]), "from after it, it is known again"); - // a revision that is not this catalog's past - assert_eq!(c.touched_since(c.revision + 5), None); - // a revision set from outside (a library just loaded): nothing is known of how the catalog got there, and after - // the next op nothing of before it - let old = c.revision; +} + +#[test] +fn history_handles_loaded_revisions_failed_batches_and_retention() { + let mut c = Catalog::default(); + let a = photo(&mut c, "a.jpg", "2026-01-01T10:00:00"); + let album = c.alloc_album_id(); + c.apply(Op::AddAlbum { album: Album::new(album, "Trip") }).unwrap(); + // a batch that fails midway is undone as a whole; a batch in a batch is remembered photo by photo; a batch + // with an op that changes more than photos is not + let before = c.revision; c.revision = 7 << 32; - assert_eq!(c.touched_since(old), None); + assert_eq!(c.touched_since(before), None); assert_eq!(c.aspects_since(c.revision), None); let loaded = c.revision; c.apply(Op::SetRating { id: a, rating: 1 }).unwrap(); assert_eq!(c.touched_since(loaded), Some(vec![a])); - assert_eq!(c.touched_since(old), None); - // an op that fails changes nothing and is not remembered - let before = c.revision; - assert!(c.apply(Op::SetRating { id: PhotoId(9_999), rating: 1 }).is_err()); - assert_eq!(c.revision, before); - assert_eq!(c.touched_since(before), Some(vec![])); - c.apply(Op::SetFlag { id: a, flag: Flag::Pick }).unwrap(); - assert_eq!(c.touched_since(before), Some(vec![a])); - assert!(c.aspects_since(before).is_some_and(|x| x.any_of(Aspects::FLAG))); - // a batch that fails midway is undone as a whole; a batch in a batch is remembered photo by photo; a batch - // with an op that changes more than photos is not + assert_eq!(c.touched_since(before), None); + let before = c.revision; assert!(c.apply(Op::Batch { ops: vec![Op::SetRating { id: a, rating: 5 }, Op::SetRating { id: PhotoId(9_999), rating: 1 }] }).is_err()); assert_eq!((c.revision, c.photo(a).map(|p| p.rating)), (before, Some(1))); diff --git a/crates/engine/src/crs/tests.rs b/crates/engine/src/crs/tests.rs index 2779194c1f..9f46cf4013 100644 --- a/crates/engine/src/crs/tests.rs +++ b/crates/engine/src/crs/tests.rs @@ -37,9 +37,16 @@ fn props(x: &str) -> Props { #[test] fn maps_common_fields() { let p = props(SIDECAR); - assert!(has_adjustments(&p)); let partial = to_partial(&p, Target::RawAbsolute); let s = apply_partial(&DevelopSettings::for_raw(5000.0, 0.0), &partial, 1.0); + assert!(has_adjustments(&p)); + assert_common_tone_fields(&s); + assert_common_color_fields(&s); + assert_common_detail_fields(&s); + assert_common_geometry_fields(&s); +} + +fn assert_common_tone_fields(s: &DevelopSettings) { assert_eq!(s.wb.mode, WbMode::Custom); assert_eq!((s.wb.temp, s.wb.tint), (5150.0, 12.0)); assert_eq!(s.light.exposure, 0.65); @@ -54,15 +61,24 @@ fn maps_common_fields() { assert_eq!(s.curve.refine_saturation, 40.0); assert!((s.curve.master[1].x - 64.0 / 255.0).abs() < 1e-9 && (s.curve.master[1].y - 52.0 / 255.0).abs() < 1e-9); assert!(s.curve.red.is_empty(), "identity channel curve maps to no curve"); +} + +fn assert_common_color_fields(s: &DevelopSettings) { assert_eq!((s.grading.shadows.hue, s.grading.shadows.sat), (210.0, 14.0)); assert_eq!((s.grading.highlights.hue, s.grading.highlights.sat), (40.0, 9.0)); assert_eq!((s.grading.midtones.hue, s.grading.midtones.sat), (120.0, 6.0)); assert_eq!((s.grading.balance, s.grading.blending), (20.0, 70.0)); +} + +fn assert_common_detail_fields(s: &DevelopSettings) { assert_eq!((s.detail.sharpen_amount, s.detail.sharpen_radius, s.detail.sharpen_detail, s.detail.sharpen_masking), (55.0, 1.2, 30.0, 12.0)); assert_eq!((s.detail.nr_luminance, s.detail.nr_color), (18.0, 25.0)); assert_eq!(s.vignette.amount, -21.0); assert_eq!(s.vignette.style, VignetteStyle::ColorPriority); assert_eq!((s.grain.amount, s.grain.size, s.grain.roughness), (15.0, 30.0, 60.0)); +} + +fn assert_common_geometry_fields(s: &DevelopSettings) { assert_eq!(s.geometry.upright, Upright::Level); assert_eq!(s.geometry.vertical, -10.0); assert!(s.optics.remove_ca); diff --git a/crates/engine/src/export/tests.rs b/crates/engine/src/export/tests.rs index 80eb134309..139939a1d9 100644 --- a/crates/engine/src/export/tests.rs +++ b/crates/engine/src/export/tests.rs @@ -1067,6 +1067,11 @@ fn avif_ten_bit() { /// unknown keys (naming the nearest known one) and values of the wrong kind or range. #[test] fn export_params_are_validated() { + assert_invalid_export_params(); + assert_export_options_round_trip(); +} + +fn assert_invalid_export_params() { use serde_json::json; let err = |p: serde_json::Value| ExportOptions::from_params(&p).err().map(|e| e.to_string()).unwrap_or_default(); let e = err(json!({"longEdgee": 400})); @@ -1092,6 +1097,11 @@ fn export_params_are_validated() { .to_string() .starts_with("invalid parameters for `export.savePreset`") ); +} + +fn assert_export_options_round_trip() { + use serde_json::json; + let err = |p: serde_json::Value| ExportOptions::from_params(&p).err().map(|e| e.to_string()).unwrap_or_default(); // everything the presets, the dialog, Export with Previous and `render --opt` send passes for p in builtin_presets() { ExportOptions::from_params(&p.params).unwrap_or_else(|e| panic!("{}: {e}", p.name)); diff --git a/crates/engine/src/sidecar/tests_repair_companions.rs b/crates/engine/src/sidecar/tests_repair_companions.rs index 94c7996a70..05402f975b 100644 --- a/crates/engine/src/sidecar/tests_repair_companions.rs +++ b/crates/engine/src/sidecar/tests_repair_companions.rs @@ -73,85 +73,85 @@ fn partial_move_companions_allow_save_and_autowrite_without_weakening_collisions for upper_full in [false, true] { for naming in [SidecarNaming::Stem, SidecarNaming::Full] { for auto in [false, true] { - let dir = crate::tests_xmp::temp_dir(&format!("r3-companions-{upper_stem}-{upper_full}-{naming:?}-{auto}")); - let a = dir.join("a.jpg"); - let b = dir.join("Trip.jpg"); - std::fs::write(&a, b"physical fixture; Session rename does not decode").unwrap(); - let path = |photo: &Path, style, upper| { - let path = sidecar_path(&photo.to_string_lossy(), style); - if upper { path.with_extension("XMP") } else { path } - }; - let stem_a = path(&a, SidecarNaming::Stem, upper_stem); - let full_a = path(&a, SidecarNaming::Full, upper_full); - let stem_b = path(&b, SidecarNaming::Stem, upper_stem); - let full_b = path(&b, SidecarNaming::Full, upper_full); - let stem_bytes = packet("stem-keep"); - let full_bytes = packet("full-keep"); - std::fs::write(&stem_a, &stem_bytes).unwrap(); - std::fs::write(&full_a, &full_bytes).unwrap(); - let mut s = session(&a); - s.xmp.naming = naming; - s.xmp.auto_write = auto; - let fs = Faults(vec![full_a.clone(), b.clone()]); - let plans = s.plan_rename_with(&fs, &[PhotoId(1)], "Trip", 1); - assert!(s.execute_fn("photo.rename", |s| Ok(json!({"renamed": s.apply_rename_with(&fs, &plans)?}))).is_err()); - assert_eq!(s.catalog.photo(PhotoId(1)).unwrap().source, Source::File { path: b.to_string_lossy().into_owned() }); - let pending = queues(&s); - assert_eq!(pending.len(), 1); - assert_eq!(std::fs::read_to_string(&stem_b).unwrap(), stem_bytes); - - // Missing packet and an unrelated packet at either case spelling remain protected. - let held = dir.join("held.xmp"); - std::fs::rename(&full_a, &held).unwrap(); - s.execute("photo.setMeta", &json!({"title": "Fresh", "addKeywords": ["café"]})).unwrap(); - assert_eq!(save(&mut s)["failed"].as_array().unwrap().len(), 1); - assert_eq!(queues(&s), pending); - assert_eq!(std::fs::read_to_string(&stem_b).unwrap(), stem_bytes); - std::fs::rename(&held, &full_a).unwrap(); - for collision in [full_b.clone(), full_b.with_extension(if upper_full { "xmp" } else { "XMP" })] { - std::fs::write(&collision, packet("unrelated-packet")).unwrap(); - let occupied = std::fs::read(&collision).unwrap(); - assert_eq!(save(&mut s)["failed"].as_array().unwrap().len(), 1); - assert_eq!(queues(&s), pending); - assert_eq!(std::fs::read(&collision).unwrap(), occupied); - assert_eq!(std::fs::read_to_string(&full_a).unwrap(), full_bytes); - assert_eq!(std::fs::read_to_string(&stem_b).unwrap(), stem_bytes); - std::fs::remove_file(collision).unwrap(); - } - // AutoWrite is the first successful repair when enabled; explicit save otherwise. - s.execute("photo.rate", &json!({"rating": 4})).unwrap(); - if !auto { - assert_eq!(save(&mut s)["failed"].as_array().unwrap().len(), 0); - } - assert!(queues(&s).is_empty()); - assert!(!full_a.exists()); - let (written, untouched, expected) = - if naming == SidecarNaming::Stem { (&stem_b, &full_b, &full_bytes) } else { (&full_b, &stem_b, &stem_bytes) }; - assert_fresh(written); - assert_eq!(std::fs::read_to_string(untouched).unwrap(), *expected); - assert_eq!(parse_sidecar(&std::fs::read_to_string(written).unwrap(), crate::crs::Target::Rendered).unwrap().rating, Some(4)); - for (command, rating) in [("edit.undo", 0), ("edit.redo", 4)] { - s.execute(command, &json!({})).unwrap(); - if !auto { - save(&mut s); - } - assert_fresh(written); - assert_eq!( - parse_sidecar(&std::fs::read_to_string(written).unwrap(), crate::crs::Target::Rendered).unwrap().rating, - Some(rating) - ); - assert_eq!(std::fs::read_to_string(untouched).unwrap(), *expected); - } - assert_eq!(s.xmp.naming, naming); - assert_eq!(s.xmp.auto_write, auto); - drop(s); - std::fs::remove_dir_all(dir).unwrap(); + check_companion_scenario(upper_stem, upper_full, naming, auto); } } } } } +fn check_companion_scenario(upper_stem: bool, upper_full: bool, naming: SidecarNaming, auto: bool) { + let dir = crate::tests_xmp::temp_dir(&format!("r3-companions-{upper_stem}-{upper_full}-{naming:?}-{auto}")); + let a = dir.join("a.jpg"); + let b = dir.join("Trip.jpg"); + std::fs::write(&a, b"physical fixture; Session rename does not decode").unwrap(); + let path = |photo: &Path, style, upper| { + let path = sidecar_path(&photo.to_string_lossy(), style); + if upper { path.with_extension("XMP") } else { path } + }; + let stem_a = path(&a, SidecarNaming::Stem, upper_stem); + let full_a = path(&a, SidecarNaming::Full, upper_full); + let stem_b = path(&b, SidecarNaming::Stem, upper_stem); + let full_b = path(&b, SidecarNaming::Full, upper_full); + let stem_bytes = packet("stem-keep"); + let full_bytes = packet("full-keep"); + std::fs::write(&stem_a, &stem_bytes).unwrap(); + std::fs::write(&full_a, &full_bytes).unwrap(); + let mut s = session(&a); + s.xmp.naming = naming; + s.xmp.auto_write = auto; + let fs = Faults(vec![full_a.clone(), b.clone()]); + let plans = s.plan_rename_with(&fs, &[PhotoId(1)], "Trip", 1); + assert!(s.execute_fn("photo.rename", |s| Ok(json!({"renamed": s.apply_rename_with(&fs, &plans)?}))).is_err()); + assert_eq!(s.catalog.photo(PhotoId(1)).unwrap().source, Source::File { path: b.to_string_lossy().into_owned() }); + let pending = queues(&s); + assert_eq!(pending.len(), 1); + assert_eq!(std::fs::read_to_string(&stem_b).unwrap(), stem_bytes); + + // Missing packet and an unrelated packet at either case spelling remain protected. + let held = dir.join("held.xmp"); + std::fs::rename(&full_a, &held).unwrap(); + s.execute("photo.setMeta", &json!({"title": "Fresh", "addKeywords": ["café"]})).unwrap(); + assert_eq!(save(&mut s)["failed"].as_array().unwrap().len(), 1); + assert_eq!(queues(&s), pending); + assert_eq!(std::fs::read_to_string(&stem_b).unwrap(), stem_bytes); + std::fs::rename(&held, &full_a).unwrap(); + for collision in [full_b.clone(), full_b.with_extension(if upper_full { "xmp" } else { "XMP" })] { + std::fs::write(&collision, packet("unrelated-packet")).unwrap(); + let occupied = std::fs::read(&collision).unwrap(); + assert_eq!(save(&mut s)["failed"].as_array().unwrap().len(), 1); + assert_eq!(queues(&s), pending); + assert_eq!(std::fs::read(&collision).unwrap(), occupied); + assert_eq!(std::fs::read_to_string(&full_a).unwrap(), full_bytes); + assert_eq!(std::fs::read_to_string(&stem_b).unwrap(), stem_bytes); + std::fs::remove_file(collision).unwrap(); + } + // AutoWrite is the first successful repair when enabled; explicit save otherwise. + s.execute("photo.rate", &json!({"rating": 4})).unwrap(); + if !auto { + assert_eq!(save(&mut s)["failed"].as_array().unwrap().len(), 0); + } + assert!(queues(&s).is_empty()); + assert!(!full_a.exists()); + let (written, untouched, expected) = + if naming == SidecarNaming::Stem { (&stem_b, &full_b, &full_bytes) } else { (&full_b, &stem_b, &stem_bytes) }; + assert_fresh(written); + assert_eq!(std::fs::read_to_string(untouched).unwrap(), *expected); + assert_eq!(parse_sidecar(&std::fs::read_to_string(written).unwrap(), crate::crs::Target::Rendered).unwrap().rating, Some(4)); + for (command, rating) in [("edit.undo", 0), ("edit.redo", 4)] { + s.execute(command, &json!({})).unwrap(); + if !auto { + save(&mut s); + } + assert_fresh(written); + assert_eq!(parse_sidecar(&std::fs::read_to_string(written).unwrap(), crate::crs::Target::Rendered).unwrap().rating, Some(rating)); + assert_eq!(std::fs::read_to_string(untouched).unwrap(), *expected); + } + assert_eq!(s.xmp.naming, naming); + assert_eq!(s.xmp.auto_write, auto); + drop(s); + std::fs::remove_dir_all(dir).unwrap(); +} #[test] fn rollback_repair_and_shared_copy_keep_known_companions() { for rollback in [false, true] { diff --git a/crates/engine/src/sidecar/tests_repair_provenance.rs b/crates/engine/src/sidecar/tests_repair_provenance.rs index 86f7d1dd6d..9c9b7c0848 100644 --- a/crates/engine/src/sidecar/tests_repair_provenance.rs +++ b/crates/engine/src/sidecar/tests_repair_provenance.rs @@ -348,64 +348,12 @@ fn detached_history_entry_is_checked_before_unrelated_global_retirement() { // A private-method contract, not a UI reproduction: application reachability of two // simultaneous repair owners is unproven. Native move failures and follow_stuck seed // both records; the second owner's normal apply_rename preflight is deliberately bypassed. - struct NativePartial { - id: PhotoId, - original: PathBuf, - moved: PathBuf, - stem: PathBuf, - full: PathBuf, - companion: PathBuf, - target: PathBuf, - } let root = crate::tests_xmp::temp_dir("detached-history-preflight-contract"); let image = lightcraft_raster::Rgba8::from_fn(4, 3, |_, _| [40, 80, 120, 255]); let png = lightcraft_codecs::encode_png(&lightcraft_codecs::EncodeImage::rgba8(&image), &Default::default()).unwrap(); let mut s = Session::new(); s.xmp.naming = SidecarNaming::Stem; - let mut native = Vec::new(); - for (i, name) in ["first", "second"].into_iter().enumerate() { - let dir = root.join(name); - std::fs::create_dir_all(&dir).unwrap(); - let original = dir.join("a.png"); - let moved = dir.join("Trip.png"); - std::fs::write(&original, &png).unwrap(); - let stem = path(&original, SidecarNaming::Stem, false); - let full = path(&original, SidecarNaming::Full, true); - for (p, marker) in [(&stem, format!("{name}-stem")), (&full, format!("{name}-full"))] { - std::fs::write(p, packet(&marker)).unwrap(); - assert_eq!(parse_sidecar(&std::fs::read_to_string(p).unwrap(), crate::crs::Target::Rendered).unwrap().rating, Some(5)); - } - let id = PhotoId(i as u64 + 1); - let photo = Photo::new(id, Source::File { path: original.to_string_lossy().into_owned() }, "a.png", "PNG", 4, 3, ""); - s.catalog.apply(Op::AddPhoto { photo: Box::new(photo) }).unwrap(); - let fs = Faults(vec![full.clone(), moved.clone()]); - if i == 0 { - let plans = s.plan_rename_with(&fs, &[id], "Trip", 1); - assert!(s.apply_rename_with(&fs, &plans).is_err()); - } else { - // Register the genuine second partial move without draining the first repair. - let moves = vec![(original.to_string_lossy().into_owned(), moved.to_string_lossy().into_owned())]; - let err = crate::rename::move_all(&fs, &moves).unwrap_err(); - assert_eq!(err.stuck, moves); - assert_eq!(err.pending_sidecars.len(), 1); - let op = Op::SetFile { id, source: Source::File { path: moved.to_string_lossy().into_owned() }, file_name: "Trip.png".into() }; - s.follow_stuck(&op, err, true); - } - assert_eq!(s.undo.len(), i + 1); - assert_eq!(queued(&s).len(), i + 1); - assert_eq!(s.catalog.photo(id).unwrap().source, Source::File { path: moved.to_string_lossy().into_owned() }); - let decoded = lightcraft_codecs::decode(&std::fs::read(&moved).unwrap(), Default::default()).unwrap(); - assert_eq!((decoded.width, decoded.height), (4, 3)); - native.push(NativePartial { - id, - original, - companion: path(&moved, SidecarNaming::Stem, false), - target: path(&moved, SidecarNaming::Full, true), - moved, - stem, - full, - }); - } + let native = create_native_partials(&root, &png, &mut s); let first = &native[0]; let second = &native[1]; let first_stem = std::fs::read(&first.companion).unwrap(); @@ -463,3 +411,61 @@ fn detached_history_entry_is_checked_before_unrelated_global_retirement() { drop(s); std::fs::remove_dir_all(root).unwrap(); } + +struct NativePartial { + id: PhotoId, + original: PathBuf, + moved: PathBuf, + stem: PathBuf, + full: PathBuf, + companion: PathBuf, + target: PathBuf, +} + +fn create_native_partials(root: &Path, png: &[u8], s: &mut Session) -> Vec { + let mut native = Vec::new(); + for (i, name) in ["first", "second"].into_iter().enumerate() { + let dir = root.join(name); + std::fs::create_dir_all(&dir).unwrap(); + let original = dir.join("a.png"); + let moved = dir.join("Trip.png"); + std::fs::write(&original, png).unwrap(); + let stem = path(&original, SidecarNaming::Stem, false); + let full = path(&original, SidecarNaming::Full, true); + for (p, marker) in [(&stem, format!("{name}-stem")), (&full, format!("{name}-full"))] { + std::fs::write(p, packet(&marker)).unwrap(); + assert_eq!(parse_sidecar(&std::fs::read_to_string(p).unwrap(), crate::crs::Target::Rendered).unwrap().rating, Some(5)); + } + let id = PhotoId(i as u64 + 1); + let photo = Photo::new(id, Source::File { path: original.to_string_lossy().into_owned() }, "a.png", "PNG", 4, 3, ""); + s.catalog.apply(Op::AddPhoto { photo: Box::new(photo) }).unwrap(); + let fs = Faults(vec![full.clone(), moved.clone()]); + if i == 0 { + let plans = s.plan_rename_with(&fs, &[id], "Trip", 1); + assert!(s.apply_rename_with(&fs, &plans).is_err()); + } else { + // Register the genuine second partial move without draining the first repair. + let moves = vec![(original.to_string_lossy().into_owned(), moved.to_string_lossy().into_owned())]; + let err = crate::rename::move_all(&fs, &moves).unwrap_err(); + assert_eq!(err.stuck, moves); + assert_eq!(err.pending_sidecars.len(), 1); + let op = Op::SetFile { id, source: Source::File { path: moved.to_string_lossy().into_owned() }, file_name: "Trip.png".into() }; + s.follow_stuck(&op, err, true); + } + assert_eq!(s.undo.len(), i + 1); + assert_eq!(queued(s).len(), i + 1); + assert_eq!(s.catalog.photo(id).unwrap().source, Source::File { path: moved.to_string_lossy().into_owned() }); + let decoded = lightcraft_codecs::decode(&std::fs::read(&moved).unwrap(), Default::default()).unwrap(); + assert_eq!((decoded.width, decoded.height), (4, 3)); + native.push(NativePartial { + id, + original, + companion: path(&moved, SidecarNaming::Stem, false), + target: path(&moved, SidecarNaming::Full, true), + moved, + stem, + full, + }); + } + native +} diff --git a/crates/engine/src/sidecar/tests_repair_saves.rs b/crates/engine/src/sidecar/tests_repair_saves.rs index 4b622e6578..6fd50aea6e 100644 --- a/crates/engine/src/sidecar/tests_repair_saves.rs +++ b/crates/engine/src/sidecar/tests_repair_saves.rs @@ -58,118 +58,122 @@ fn autowrite_repairs_partial_rename_before_merging_foreign_xmp_across_library_sw for save_naming in [SidecarNaming::Stem, SidecarNaming::Full] { for upper in [false, true] { for switch in [false, true] { - let root = crate::tests_xmp::temp_dir(&format!("repair-save-{naming:?}-{save_naming:?}-{upper}-{switch}")); - let a = root.join("a.png"); - let b = root.join("Trip.png"); - png(&a); - let mut old = sidecar_path(&a.to_string_lossy(), naming); - if upper { - old = old.with_extension("XMP"); - } - std::fs::write(&old, FOREIGN).unwrap(); - let mut s = Session::new().with_fs(); - s.open_library(root.join("library-a"), false).unwrap(); - s.execute("library.import", &json!({"paths": [a]})).unwrap(); - let mut id = s.catalog.photos().next().unwrap().id; - s.selection = crate::Selection::single(id); - s.undo.clear(); - let fs = PartialRename { sidecar: old.clone(), photo: b.clone() }; - let plans = s.plan_rename_with(&fs, &[id], "Trip", 1); - assert!(s.execute_fn("photo.rename", |s| Ok(json!({"renamed": s.apply_rename_with(&fs, &plans)?}))).is_err()); - assert_eq!(queued(&s).len(), 1); - assert_eq!(s.catalog.photo(id).unwrap().source, Source::File { path: b.to_string_lossy().into_owned() }); - let pending = queued(&s); - let held = root.join("temporarily-unavailable.xmp"); - std::fs::rename(&old, &held).unwrap(); - if switch { - s.close_library().unwrap(); - s.open_library(root.join("library-b"), false).unwrap(); - assert_eq!(s.pending_sidecar_repairs, pending); - s.execute("library.import", &json!({"paths": [b]})).unwrap(); - id = s.catalog.photos().next().unwrap().id; - s.selection = crate::Selection::single(id); - } - s.xmp.naming = save_naming; - s.xmp.auto_write = true; - s.execute("photo.rate", &json!({"rating": 4})).unwrap(); - let preferred = sidecar_path(&b.to_string_lossy(), save_naming); - assert!(!preferred.exists() && !preferred.with_extension("XMP").exists()); - assert!(!pending[0].to.exists()); - assert_eq!(queued(&s), pending, "unavailable repair stays queued after AutoWrite"); - let saved = s.execute("photo.saveMetadataToFile", &json!({})).unwrap(); - assert!(saved["written"].as_array().unwrap().is_empty()); - assert!(saved["failed"][0]["error"].as_str().unwrap().contains("unfinished XMP repair")); - assert_eq!(std::fs::read(&held).unwrap(), FOREIGN); - assert_eq!(queued(&s), pending); - - // A missing sidecar for another photo does not prevent this healthy save. - let healthy = root.join("healthy.png"); - png(&healthy); - let healthy_id = PhotoId(999); - s.commit( - "Healthy Photo", - Op::AddPhoto { - photo: Box::new(Photo::new( - healthy_id, - Source::File { path: healthy.to_string_lossy().into_owned() }, - "healthy.png", - "PNG", - 4, - 3, - "", - )), - }, - ) - .unwrap(); - s.execute("photo.setMeta", &json!({"ids": [healthy_id.0], "title": "Healthy save"})).unwrap(); - let packet = std::fs::read_to_string(sidecar_path(&healthy.to_string_lossy(), save_naming)).unwrap(); - assert_eq!(parse_sidecar(&packet, crate::crs::Target::Rendered).unwrap().title.as_deref(), Some("Healthy save")); - assert_eq!(queued(&s), pending); - - // An existing destination is never overwritten and the original packet remains. - std::fs::rename(&held, &old).unwrap(); - let destination = pending[0].to.clone(); - let collision = String::from_utf8(FOREIGN.to_vec()).unwrap().replace("Rating=\"2\"", "Rating=\"5\"").into_bytes(); - let collision_path = if upper { preferred.clone() } else { destination.clone() }; - std::fs::write(&collision_path, &collision).unwrap(); - s.execute("photo.setMeta", &json!({"ids": [id.0], "title": "Fresh title", "addKeywords": ["café"]})).unwrap(); - assert_eq!(std::fs::read(&old).unwrap(), FOREIGN); - assert_eq!(std::fs::read(&collision_path).unwrap(), collision); - assert_eq!(queued(&s), pending); - s.selection = crate::Selection::single(id); - assert_eq!(s.execute("photo.saveMetadataToFile", &json!({})).unwrap()["failed"].as_array().unwrap().len(), 1); - assert_eq!(std::fs::read(&collision_path).unwrap(), collision); - std::fs::remove_file(&collision_path).unwrap(); // remove only this test's collision - - // The next successful AutoWrite runs the real repair and production XMP merge. - s.execute("photo.setMeta", &json!({"title": "Final title"})).unwrap(); - assert!(queued(&s).is_empty()); - assert!(!old.exists()); - let packet = std::fs::read_to_string(&destination).unwrap(); - assert!(packet.contains("fixture:Marker=\"keep-me\"")); - let parsed = parse_sidecar(&packet, crate::crs::Target::Rendered).unwrap(); - assert_eq!(parsed.rating, Some(4)); - assert_eq!(parsed.title.as_deref(), Some("Final title")); - assert!(parsed.keywords.as_ref().unwrap().contains(&"café".to_string())); - if upper { - // by listing: on a case-insensitive volume `preferred` answers for the upper-case packet - let listed = std::fs::read_dir(&root).unwrap().any(|e| Some(e.unwrap().file_name().as_os_str()) == preferred.file_name()); - assert!(!listed, "merge uses the repaired uppercase packet"); - } - for (step, title) in [("edit.undo", "Fresh title"), ("edit.redo", "Final title")] { - s.execute(step, &json!({})).unwrap(); - let packet = std::fs::read_to_string(&destination).unwrap(); - assert!(packet.contains("fixture:Marker=\"keep-me\"")); - assert_eq!(parse_sidecar(&packet, crate::crs::Target::Rendered).unwrap().title.as_deref(), Some(title)); - } - drop(s); - std::fs::remove_dir_all(root).unwrap(); + check_autowrite_repair_scenario(naming, save_naming, upper, switch); } } } } } +fn check_autowrite_repair_scenario(naming: SidecarNaming, save_naming: SidecarNaming, upper: bool, switch: bool) { + let root = crate::tests_xmp::temp_dir(&format!("repair-save-{naming:?}-{save_naming:?}-{upper}-{switch}")); + let a = root.join("a.png"); + let b = root.join("Trip.png"); + png(&a); + let mut old = sidecar_path(&a.to_string_lossy(), naming); + if upper { + old = old.with_extension("XMP"); + } + std::fs::write(&old, FOREIGN).unwrap(); + let mut s = Session::new().with_fs(); + s.open_library(root.join("library-a"), false).unwrap(); + s.execute("library.import", &json!({"paths": [a]})).unwrap(); + let mut id = s.catalog.photos().next().unwrap().id; + s.selection = crate::Selection::single(id); + s.undo.clear(); + let fs = PartialRename { sidecar: old.clone(), photo: b.clone() }; + let plans = s.plan_rename_with(&fs, &[id], "Trip", 1); + assert!(s.execute_fn("photo.rename", |s| Ok(json!({"renamed": s.apply_rename_with(&fs, &plans)?}))).is_err()); + assert_eq!(queued(&s).len(), 1); + assert_eq!(s.catalog.photo(id).unwrap().source, Source::File { path: b.to_string_lossy().into_owned() }); + let pending = queued(&s); + let held = root.join("temporarily-unavailable.xmp"); + std::fs::rename(&old, &held).unwrap(); + if switch { + s.close_library().unwrap(); + s.open_library(root.join("library-b"), false).unwrap(); + assert_eq!(s.pending_sidecar_repairs, pending); + s.execute("library.import", &json!({"paths": [b]})).unwrap(); + id = s.catalog.photos().next().unwrap().id; + s.selection = crate::Selection::single(id); + } + s.xmp.naming = save_naming; + s.xmp.auto_write = true; + s.execute("photo.rate", &json!({"rating": 4})).unwrap(); + let preferred = sidecar_path(&b.to_string_lossy(), save_naming); + assert!(!preferred.exists() && !preferred.with_extension("XMP").exists()); + assert!(!pending[0].to.exists()); + assert_eq!(queued(&s), pending, "unavailable repair stays queued after AutoWrite"); + let saved = s.execute("photo.saveMetadataToFile", &json!({})).unwrap(); + assert!(saved["written"].as_array().unwrap().is_empty()); + assert!(saved["failed"][0]["error"].as_str().unwrap().contains("unfinished XMP repair")); + assert_eq!(std::fs::read(&held).unwrap(), FOREIGN); + assert_eq!(queued(&s), pending); + + // A missing sidecar for another photo does not prevent this healthy save. + let healthy = root.join("healthy.png"); + png(&healthy); + let healthy_id = PhotoId(999); + s.commit( + "Healthy Photo", + Op::AddPhoto { + photo: Box::new(Photo::new(healthy_id, Source::File { path: healthy.to_string_lossy().into_owned() }, "healthy.png", "PNG", 4, 3, "")), + }, + ) + .unwrap(); + s.execute("photo.setMeta", &json!({"ids": [healthy_id.0], "title": "Healthy save"})).unwrap(); + let packet = std::fs::read_to_string(sidecar_path(&healthy.to_string_lossy(), save_naming)).unwrap(); + assert_eq!(parse_sidecar(&packet, crate::crs::Target::Rendered).unwrap().title.as_deref(), Some("Healthy save")); + assert_eq!(queued(&s), pending); + + // An existing destination is never overwritten and the original packet remains. + std::fs::rename(&held, &old).unwrap(); + let destination = pending[0].to.clone(); + let collision = String::from_utf8(FOREIGN.to_vec()).unwrap().replace("Rating=\"2\"", "Rating=\"5\"").into_bytes(); + let collision_path = if upper { preferred.clone() } else { destination.clone() }; + std::fs::write(&collision_path, &collision).unwrap(); + s.execute("photo.setMeta", &json!({"ids": [id.0], "title": "Fresh title", "addKeywords": ["café"]})).unwrap(); + assert_eq!(std::fs::read(&old).unwrap(), FOREIGN); + assert_eq!(std::fs::read(&collision_path).unwrap(), collision); + assert_eq!(queued(&s), pending); + s.selection = crate::Selection::single(id); + assert_eq!(s.execute("photo.saveMetadataToFile", &json!({})).unwrap()["failed"].as_array().unwrap().len(), 1); + assert_eq!(std::fs::read(&collision_path).unwrap(), collision); + std::fs::remove_file(&collision_path).unwrap(); // remove only this test's collision + + // The next successful AutoWrite runs the real repair and production XMP merge. + s.execute("photo.setMeta", &json!({"title": "Final title"})).unwrap(); + assert!(queued(&s).is_empty()); + assert!(!old.exists()); + let packet = std::fs::read_to_string(&destination).unwrap(); + assert!(packet.contains("fixture:Marker=\"keep-me\"")); + let parsed = parse_sidecar(&packet, crate::crs::Target::Rendered).unwrap(); + assert_eq!(parsed.rating, Some(4)); + assert_eq!(parsed.title.as_deref(), Some("Final title")); + assert!(parsed.keywords.as_ref().unwrap().contains(&"café".to_string())); + assert_repaired_case_spelling(&root, &preferred, upper); + assert_undo_redo_preserve_foreign_packet(&mut s, &destination); + drop(s); + std::fs::remove_dir_all(root).unwrap(); +} + +fn assert_repaired_case_spelling(root: &Path, preferred: &Path, upper: bool) { + if !upper { + return; + } + // By listing, a case-insensitive volume answers for the uppercase packet. + let listed = std::fs::read_dir(root).unwrap().any(|e| Some(e.unwrap().file_name().as_os_str()) == preferred.file_name()); + assert!(!listed, "merge uses the repaired uppercase packet"); +} + +fn assert_undo_redo_preserve_foreign_packet(s: &mut Session, destination: &Path) { + for (step, title) in [("edit.undo", "Fresh title"), ("edit.redo", "Final title")] { + s.execute(step, &json!({})).unwrap(); + let packet = std::fs::read_to_string(destination).unwrap(); + assert!(packet.contains("fixture:Marker=\"keep-me\"")); + assert_eq!(parse_sidecar(&packet, crate::crs::Target::Rendered).unwrap().title.as_deref(), Some(title)); + } +} #[test] fn unowned_shared_stem_repair_does_not_block_healthy_jpeg_full_sidecar_save() { let root = crate::tests_xmp::temp_dir("repair-save-shared-stem"); diff --git a/crates/engine/src/tests/import.rs b/crates/engine/src/tests/import.rs index 6e5585a823..dc1c6c8f20 100644 --- a/crates/engine/src/tests/import.rs +++ b/crates/engine/src/tests/import.rs @@ -1,7 +1,11 @@ //! Import: recursive folders, duplicate detection by content, add vs copy into the library. -use std::path::Path; +use std::{ + path::{Path, PathBuf}, + sync::atomic::AtomicUsize, +}; +use lightcraft_catalog::PhotoId; use serde_json::{Value, json}; use crate::Session; @@ -1711,109 +1715,139 @@ fn smart_previews_from_an_older_look_fit_are_refreshed() { } fn smart_look_refresh_for(format: &str) { - use std::sync::atomic::{AtomicUsize, Ordering}; - let src = temp_dir(&format!("smartlook-src-{format}")); - let lib = temp_dir(&format!("smartlook-lib-{format}")); - write_png(&src.join("a.png"), 3); - write_png(&src.join("b.png"), 9); - let mut s = Session::new().with_fs(); - s.open_library(&lib, false).unwrap(); - s.execute("library.import", &json!({"paths": [src.join("a.png").to_string_lossy(), src.join("b.png").to_string_lossy()]})).unwrap(); - let find = |s: &Session, name: &str| s.catalog.photos().find(|p| p.file_name == name).unwrap().id; - let (id, png) = (find(&s, "a.png"), find(&s, "b.png")); - // `a` stands for a raw that takes the per-file camera look (the test loader decodes its pixels) - let mut raw = (**s.catalog.photo(id).unwrap()).clone(); - raw.format = format.into(); - raw.kind = lightcraft_catalog::MediaKind::Raw; - s.catalog.apply(lightcraft_catalog::Op::RemovePhoto { id }).unwrap(); - s.catalog.apply(lightcraft_catalog::Op::AddPhoto { photo: Box::new(raw) }).unwrap(); - assert_eq!(s.catalog.photo(id).unwrap().relative_wb(), format == "ARW"); - assert!(!s.catalog.photo(png).unwrap().relative_wb()); - s.execute("library.select", &json!({"ids": [id.0, png.0], "active": id.0})).unwrap(); - let dir = s.media.smart_dir.clone().unwrap(); - let file = crate::smart::sharded_file_path(&dir, s.catalog.photo(id).unwrap()); - let png_file = crate::smart::sharded_file_path(&dir, s.catalog.photo(png).unwrap()); - let (old, new) = (test_tone(1.5), test_tone(3.5)); - let calls = std::sync::Arc::new(AtomicUsize::new(0)); - let plain = s.media.file_loader.clone().unwrap(); - s.media.file_loader = Some(look_loader(plain.clone(), old, calls.clone())); - let r = s.execute("library.smartPreviews", &json!({})).unwrap(); + let mut case = SmartLookCase::new(format); + assert_current_smart_look_is_not_rebuilt(&mut case); + let (old_bytes, png_bytes) = keep_offline_previews(&mut case); + refresh_online_previews(&mut case, &old_bytes, &png_bytes); + let _ = std::fs::remove_dir_all(&case.src); + let _ = std::fs::remove_dir_all(&case.lib); +} + +struct SmartLookCase { + src: PathBuf, + lib: PathBuf, + session: Session, + id: PhotoId, + dir: PathBuf, + file: PathBuf, + png_file: PathBuf, + old: lightcraft_pipeline::tone::CameraTone, + new: lightcraft_pipeline::tone::CameraTone, + calls: std::sync::Arc, + plain_loader: crate::media::FileLoader, +} + +impl SmartLookCase { + fn new(format: &str) -> Self { + let src = temp_dir(&format!("smartlook-src-{format}")); + let lib = temp_dir(&format!("smartlook-lib-{format}")); + write_png(&src.join("a.png"), 3); + write_png(&src.join("b.png"), 9); + let mut session = Session::new().with_fs(); + session.open_library(&lib, false).unwrap(); + session.execute("library.import", &json!({"paths": [src.join("a.png").to_string_lossy(), src.join("b.png").to_string_lossy()]})).unwrap(); + let find = |s: &Session, name: &str| s.catalog.photos().find(|p| p.file_name == name).unwrap().id; + let (id, png_id) = (find(&session, "a.png"), find(&session, "b.png")); + // `a` stands for a raw that takes the per-file camera look (the test loader decodes its pixels) + let mut raw = (**session.catalog.photo(id).unwrap()).clone(); + raw.format = format.into(); + raw.kind = lightcraft_catalog::MediaKind::Raw; + session.catalog.apply(lightcraft_catalog::Op::RemovePhoto { id }).unwrap(); + session.catalog.apply(lightcraft_catalog::Op::AddPhoto { photo: Box::new(raw) }).unwrap(); + assert_eq!(session.catalog.photo(id).unwrap().relative_wb(), format == "ARW"); + assert!(!session.catalog.photo(png_id).unwrap().relative_wb()); + session.execute("library.select", &json!({"ids": [id.0, png_id.0], "active": id.0})).unwrap(); + let dir = session.media.smart_dir.clone().unwrap(); + let file = crate::smart::sharded_file_path(&dir, session.catalog.photo(id).unwrap()); + let png_file = crate::smart::sharded_file_path(&dir, session.catalog.photo(png_id).unwrap()); + let (old, new) = (test_tone(1.5), test_tone(3.5)); + let calls = std::sync::Arc::new(AtomicUsize::new(0)); + let plain_loader = session.media.file_loader.clone().unwrap(); + session.media.file_loader = Some(look_loader(plain_loader.clone(), old, calls.clone())); + Self { src, lib, session, id, dir, file, png_file, old, new, calls, plain_loader } + } +} + +fn assert_current_smart_look_is_not_rebuilt(case: &mut SmartLookCase) { + let r = case.session.execute("library.smartPreviews", &json!({})).unwrap(); assert_eq!((r["built"].as_u64(), r["refreshed"].as_u64()), (Some(2), Some(0)), "{r}"); - assert_eq!(smart_header(&file)["look_version"], json!(crate::camera_preview::LOOK_VERSION), "the writer stamps the fit version"); - assert!(!crate::smart::is_stale(&file)); + assert_eq!(smart_header(&case.file)["look_version"], json!(crate::camera_preview::LOOK_VERSION), "the writer stamps the fit version"); + assert!(!crate::smart::is_stale(&case.file)); // current header: kept as it is, the original is not even read - let before = std::fs::read(&file).unwrap(); - calls.store(0, Ordering::SeqCst); - s.media.file_loader = Some(look_loader(plain.clone(), new, calls.clone())); - let r = s.execute("library.smartPreviews", &json!({})).unwrap(); + let before = std::fs::read(&case.file).unwrap(); + case.calls.store(0, std::sync::atomic::Ordering::SeqCst); + case.session.media.file_loader = Some(look_loader(case.plain_loader.clone(), case.new, case.calls.clone())); + let r = case.session.execute("library.smartPreviews", &json!({})).unwrap(); assert_eq!((r["built"].as_u64(), r["refreshed"].as_u64()), (Some(2), Some(0)), "{r}"); - assert!(std::fs::read(&file).unwrap() == before, "a current proxy is not rebuilt"); - assert_eq!(calls.load(Ordering::SeqCst), 0); + assert_eq!(std::fs::read(&case.file).unwrap(), before, "a current proxy is not rebuilt"); + assert_eq!(case.calls.load(std::sync::atomic::Ordering::SeqCst), 0); +} +fn keep_offline_previews(case: &mut SmartLookCase) -> (Vec, Vec) { // old headers (no field), originals offline: kept unchanged, and still marked stale - for f in [&file, &png_file] { + for f in [&case.file, &case.png_file] { edit_smart_header(f, |h| { h.as_object_mut().unwrap().remove("look_version"); }); } - assert!(crate::smart::is_stale(&file), "no field = version 0"); - let old_bytes = std::fs::read(&file).unwrap(); - let png_bytes = std::fs::read(&png_file).unwrap(); - std::fs::rename(&src, src.with_extension("offline")).unwrap(); - s.media.forget(id); - s.media.forget(png); - let r = s.execute("library.smartPreviews", &json!({})).unwrap(); + assert!(crate::smart::is_stale(&case.file), "no field = version 0"); + let old_bytes = std::fs::read(&case.file).unwrap(); + let png_bytes = std::fs::read(&case.png_file).unwrap(); + std::fs::rename(&case.src, case.src.with_extension("offline")).unwrap(); + case.session.media.forget(case.id); + let r = case.session.execute("library.smartPreviews", &json!({})).unwrap(); assert_eq!((r["built"].as_u64(), r["refreshed"].as_u64(), r["staleKept"].as_u64()), (Some(2), Some(0), Some(1)), "{r}"); assert!(r["failed"].as_array().unwrap().is_empty(), "{r}"); - assert!(std::fs::read(&file).unwrap() == old_bytes, "offline: the stored preview and curve are untouched"); - assert!(crate::smart::is_stale(&file), "and it stays marked for the next time"); - assert_eq!(crate::smart::decode(&old_bytes).unwrap().1, Some(old), "the old look is still there"); + assert_eq!(std::fs::read(&case.file).unwrap(), old_bytes, "offline: the stored preview and curve are untouched"); + assert!(crate::smart::is_stale(&case.file), "and it stays marked for the next time"); + assert_eq!(crate::smart::decode(&old_bytes).unwrap().1, Some(case.old), "the old look is still there"); // ... and the opening refresh keeps it too, then marks the folder checked - assert!(!crate::smart::look_checked(&dir)); - crate::cmd::previews::refresh_stale_smart_previews(&mut s).unwrap().join().unwrap(); - assert!(std::fs::read(&file).unwrap() == old_bytes); - assert!(crate::smart::look_checked(&dir)); + assert!(!crate::smart::look_checked(&case.dir)); + crate::cmd::previews::refresh_stale_smart_previews(&mut case.session).unwrap().join().unwrap(); + assert_eq!(std::fs::read(&case.file).unwrap(), old_bytes); + assert!(crate::smart::look_checked(&case.dir)); + (old_bytes, png_bytes) +} +fn refresh_online_previews(case: &mut SmartLookCase, old_bytes: &[u8], png_bytes: &[u8]) { // the original comes back: the scan has run at this version, so the next opening leaves it; // Build Smart Previews rebuilds it with the current look - std::fs::rename(src.with_extension("offline"), &src).unwrap(); - calls.store(0, Ordering::SeqCst); - assert!(crate::cmd::previews::refresh_stale_smart_previews(&mut s).is_none(), "checked once per version"); - assert!(std::fs::read(&file).unwrap() == old_bytes); - let r = s.execute("library.smartPreviews", &json!({})).unwrap(); - assert_eq!((r["refreshed"].as_u64(), calls.load(Ordering::SeqCst)), (Some(1), 1), "{r}"); - assert_eq!(smart_header(&file)["look_version"], json!(crate::camera_preview::LOOK_VERSION)); - assert_eq!(crate::smart::decode(&std::fs::read(&file).unwrap()).unwrap().1, Some(new), "rebuilt with the current look"); - assert!(!crate::smart::is_stale(&file)); - assert!(std::fs::read(&png_file).unwrap() == png_bytes, "a PNG's proxy is never rebuilt for the look"); + std::fs::rename(case.src.with_extension("offline"), &case.src).unwrap(); + case.calls.store(0, std::sync::atomic::Ordering::SeqCst); + assert!(crate::cmd::previews::refresh_stale_smart_previews(&mut case.session).is_none(), "checked once per version"); + assert_eq!(std::fs::read(&case.file).unwrap(), old_bytes); + let r = case.session.execute("library.smartPreviews", &json!({})).unwrap(); + assert_eq!((r["refreshed"].as_u64(), case.calls.load(std::sync::atomic::Ordering::SeqCst)), (Some(1), 1), "{r}"); + assert_eq!(smart_header(&case.file)["look_version"], json!(crate::camera_preview::LOOK_VERSION)); + assert_eq!(crate::smart::decode(&std::fs::read(&case.file).unwrap()).unwrap().1, Some(case.new), "rebuilt with the current look"); + assert!(!crate::smart::is_stale(&case.file)); + assert_eq!(std::fs::read(&case.png_file).unwrap(), png_bytes, "a PNG's proxy is never rebuilt for the look"); // a folder checked at an older version (or not at all) is scanned once at the next opening - edit_smart_header(&file, |h| h["look_version"] = json!(0)); - std::fs::write(dir.join("look-version"), b"0\n").unwrap(); - assert!(!crate::smart::look_checked(&dir)); - s.media.forget(id); - calls.store(0, Ordering::SeqCst); - crate::cmd::previews::refresh_stale_smart_previews(&mut s).unwrap().join().unwrap(); - assert_eq!(calls.load(Ordering::SeqCst), 1, "only the raw's original is read"); - assert!(!crate::smart::is_stale(&file)); - assert!(std::fs::read(&png_file).unwrap() == png_bytes); - assert!(crate::smart::look_checked(&dir)); + edit_smart_header(&case.file, |h| h["look_version"] = json!(0)); + std::fs::write(case.dir.join("look-version"), b"0\n").unwrap(); + assert!(!crate::smart::look_checked(&case.dir)); + case.session.media.forget(case.id); + case.calls.store(0, std::sync::atomic::Ordering::SeqCst); + crate::cmd::previews::refresh_stale_smart_previews(&mut case.session).unwrap().join().unwrap(); + assert_eq!(case.calls.load(std::sync::atomic::Ordering::SeqCst), 1, "only the raw's original is read"); + assert!(!crate::smart::is_stale(&case.file)); + assert_eq!(std::fs::read(&case.png_file).unwrap(), png_bytes); + assert!(crate::smart::look_checked(&case.dir)); // once only - let rebuilt = std::fs::read(&file).unwrap(); - assert!(crate::cmd::previews::refresh_stale_smart_previews(&mut s).is_none()); - let r = s.execute("library.smartPreviews", &json!({})).unwrap(); - assert_eq!((r["refreshed"].as_u64(), calls.load(Ordering::SeqCst)), (Some(0), 1), "{r}"); - assert!(std::fs::read(&file).unwrap() == rebuilt); + let rebuilt = std::fs::read(&case.file).unwrap(); + assert!(crate::cmd::previews::refresh_stale_smart_previews(&mut case.session).is_none()); + let r = case.session.execute("library.smartPreviews", &json!({})).unwrap(); + assert_eq!((r["refreshed"].as_u64(), case.calls.load(std::sync::atomic::Ordering::SeqCst)), (Some(0), 1), "{r}"); + assert_eq!(std::fs::read(&case.file).unwrap(), rebuilt); // Build Smart Previews refreshes a stale one the same way - edit_smart_header(&file, |h| h["look_version"] = json!(0)); - s.media.file_loader = Some(plain); - let r = s.execute("library.smartPreviews", &json!({})).unwrap(); + edit_smart_header(&case.file, |h| h["look_version"] = json!(0)); + case.session.media.file_loader = Some(case.plain_loader.clone()); + let r = case.session.execute("library.smartPreviews", &json!({})).unwrap(); assert_eq!(r["refreshed"], 1, "{r}"); - assert_eq!(crate::smart::decode(&std::fs::read(&file).unwrap()).unwrap().1, None, "this fit gives no curve: none is kept"); - let _ = std::fs::remove_dir_all(&src); - let _ = std::fs::remove_dir_all(&lib); + assert_eq!(crate::smart::decode(&std::fs::read(&case.file).unwrap()).unwrap().1, None, "this fit gives no curve: none is kept"); } /// Issue #1534 (review): a proxy's encoding version is migrated independently of the per-file From c9d44f7804075fa4ecfb48a524bb57d8c1314564 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 13:19:34 +0000 Subject: [PATCH 58/93] style(engine): expand module imports explicitly --- crates/catalog/examples/persist_bench.rs | 2 +- crates/engine/src/camera_preview/colour.rs | 2 +- crates/engine/src/camera_preview/hue_sat.rs | 2 +- crates/engine/src/camera_preview/look_fit.rs | 2 +- crates/engine/src/camera_preview/mono.rs | 2 +- crates/engine/src/camera_preview/pairs.rs | 2 +- crates/engine/src/camera_preview/proxy.rs | 2 +- crates/engine/src/camera_preview/tone.rs | 2 +- crates/engine/src/cmd/geocode.rs | 5 ++++- crates/engine/src/cmd/library/filters.rs | 2 +- crates/engine/src/cmd/library/import.rs | 2 +- crates/engine/src/cmd/library/selection.rs | 2 +- crates/engine/src/cmd/library/specs.rs | 5 ++++- crates/engine/src/denoise/model.rs | 3 +-- crates/engine/src/denoise/products.rs | 5 ++++- crates/engine/src/denoise/session.rs | 5 ++++- crates/engine/src/denoise/settings.rs | 2 +- crates/engine/src/denoise/state.rs | 2 +- crates/engine/src/export/batch.rs | 2 +- crates/engine/src/export/encoding.rs | 5 ++++- crates/engine/src/export/options.rs | 2 +- crates/engine/src/export/params.rs | 2 +- crates/engine/src/export/place.rs | 2 +- crates/engine/src/export/prepare.rs | 2 +- crates/engine/src/export/watermark.rs | 2 +- crates/engine/src/files/fs.rs | 2 +- crates/engine/src/files/load.rs | 2 +- crates/engine/src/files/preview.rs | 2 +- crates/engine/src/files/probe.rs | 2 +- crates/engine/src/import/commit.rs | 2 +- crates/engine/src/import/defaults.rs | 2 +- crates/engine/src/import/files.rs | 3 ++- crates/engine/src/import/job.rs | 2 +- crates/engine/src/import/scan.rs | 2 +- crates/engine/src/import/types.rs | 2 +- crates/engine/src/media/cache.rs | 2 +- crates/engine/src/media/quick.rs | 2 +- crates/engine/src/media/session.rs | 2 +- crates/engine/src/media/settings_hash.rs | 2 +- crates/engine/src/media/source.rs | 2 +- crates/engine/src/rename/fs.rs | 2 +- crates/engine/src/rename/moves.rs | 2 +- crates/engine/src/rename/plan.rs | 2 +- crates/engine/src/rename/sidecar.rs | 2 +- crates/engine/src/rename/tokens.rs | 2 +- xtask/src/ci.rs | 2 +- xtask/src/corpus.rs | 2 +- xtask/src/layers.rs | 2 +- xtask/src/wasm.rs | 2 +- 49 files changed, 65 insertions(+), 50 deletions(-) diff --git a/crates/catalog/examples/persist_bench.rs b/crates/catalog/examples/persist_bench.rs index 693e862d09..1fc05588c6 100644 --- a/crates/catalog/examples/persist_bench.rs +++ b/crates/catalog/examples/persist_bench.rs @@ -14,7 +14,7 @@ use std::sync::Arc; use std::time::Instant; -use lightcraft_catalog::*; +use lightcraft_catalog::{Catalog, DEFAULT_FORGET_DAYS, FsStore, HistoryStep, Journal, MediaKind, Op, Photo, PhotoId, Source, folder_of}; use lightcraft_develop::DevelopSettings; fn ms(t: Instant) -> f64 { diff --git a/crates/engine/src/camera_preview/colour.rs b/crates/engine/src/camera_preview/colour.rs index a33a5c7a57..2681466a91 100644 --- a/crates/engine/src/camera_preview/colour.rs +++ b/crates/engine/src/camera_preview/colour.rs @@ -1,7 +1,7 @@ use super::look_fit::{fit_dng_tone, fit_preview}; use super::mono::{fit_dark_tone, monochrome_look}; use super::proxy::{LensGeometry, proxies}; -use super::*; +use super::{CameraLook, CameraTone, CameraTransform, ColorData, D50, D65, Mat3, ProfileLook, REC2020, RawFormat, RawImage, ToneCurve, Xy, bradford}; /// Long edge of the sensor/JPEG proxy a single photo's look is fitted on (the acceptance gates /// below were set at this size). diff --git a/crates/engine/src/camera_preview/hue_sat.rs b/crates/engine/src/camera_preview/hue_sat.rs index 7e92ba519f..b3692dc4fc 100644 --- a/crates/engine/src/camera_preview/hue_sat.rs +++ b/crates/engine/src/camera_preview/hue_sat.rs @@ -1,6 +1,6 @@ use super::mono::to_prophoto; use super::pairs::{displayed, luma}; -use super::*; +use super::{CameraLook, CameraTone, HsvTable, Mat3, ToneMap, luminance_2020}; /// [`HueSat::apply`] restores the luminance in full only if the table kept at least this share of it. A colour /// the table darkens to [`NO_LUMINANCE_KEPT`] or less (only near-black noise, whose channels go negative) keeps diff --git a/crates/engine/src/camera_preview/look_fit.rs b/crates/engine/src/camera_preview/look_fit.rs index c1588093b3..544db5f5f5 100644 --- a/crates/engine/src/camera_preview/look_fit.rs +++ b/crates/engine/src/camera_preview/look_fit.rs @@ -3,7 +3,7 @@ use super::mono::{fit_tone_only_with, monochrome}; use super::pairs::{Attempt, TONE_FITS, fit_attempt, fit_partial, search_ordered}; use super::proxy::{CLIP_TOLERANCE, LensGeometry, MIN_PREVIEW_FRACTION, proxies, structure_agrees}; use super::tone::{HighlightCheck, highlights}; -use super::*; +use super::{CameraLook, CameraTone, CameraTransform, HsvTable, Mat3, RawImage, Rgb32f, ToneMap, luminance_2020}; /// The look fitted to the file's camera JPEG, and whether that JPEG is black and white ([`monochrome`]). pub(crate) fn fit_preview(raw: &RawImage, bytes: &[u8], transform: &CameraTransform, lens: Option<&LensGeometry>) -> (Option, bool) { diff --git a/crates/engine/src/camera_preview/mono.rs b/crates/engine/src/camera_preview/mono.rs index cfac90c340..3c0bd57364 100644 --- a/crates/engine/src/camera_preview/mono.rs +++ b/crates/engine/src/camera_preview/mono.rs @@ -7,7 +7,7 @@ use super::pairs::{ }; use super::proxy::{LensGeometry, proxies}; use super::tone::{HighlightCheck, ToneFit, fit_tone, highlights, highlights_hold}; -use super::*; +use super::{CameraLook, CameraTransform, D50, D65, HsvTable, Mat3, PROPHOTO, REC2020, RawImage, Rgb32f, ToneMap, bradford, luminance_2020}; /// A camera JPEG pixel's channels may differ by this much (linear) and still count as grey. const GREY_SPREAD: f32 = 0.002; diff --git a/crates/engine/src/camera_preview/pairs.rs b/crates/engine/src/camera_preview/pairs.rs index 2fce1a871f..425f267da5 100644 --- a/crates/engine/src/camera_preview/pairs.rs +++ b/crates/engine/src/camera_preview/pairs.rs @@ -3,7 +3,7 @@ use super::proxy::DARK_FLOOR; #[cfg(test)] use super::tone::highlights; use super::tone::{HighlightCheck, ToneFit, highlights_hold}; -use super::*; +use super::{CameraLook, CameraTone, HsvTable, Mat3, Rgb32f, ToneMap, luminance_2020}; /// A fit must cut the held-out squared error to below this share of the fallback's. pub(super) const MIN_IMPROVEMENT: f64 = 0.7; diff --git a/crates/engine/src/camera_preview/proxy.rs b/crates/engine/src/camera_preview/proxy.rs index 81f170a87d..b3db0a160d 100644 --- a/crates/engine/src/camera_preview/proxy.rs +++ b/crates/engine/src/camera_preview/proxy.rs @@ -2,7 +2,7 @@ use super::colour::{PROFILE_PROXY, PROXY, file_local_look}; use super::hue_sat::fit_hue_sat; use super::look_fit::{FIT_PREVIEW_MAX_PIXELS, SENSOR_CLIP, clip_mask, without_clipped}; use super::pairs::{collect_pairs, fit_matrix}; -use super::*; +use super::{CameraTransform, Filter, HsvTable, Mat3, RawFormat, RawImage, Rgb32f, fit, luminance_2020, resize}; /// The embedded preview's long edge must be at least this share of the raw's (and 384 px): a DNG whose preview is a /// small thumbnail is not fitted. The fit itself runs on a proxy of at most 384 px, so the 1024 px preview diff --git a/crates/engine/src/camera_preview/tone.rs b/crates/engine/src/camera_preview/tone.rs index 19b66948c3..f16b8e8994 100644 --- a/crates/engine/src/camera_preview/tone.rs +++ b/crates/engine/src/camera_preview/tone.rs @@ -1,6 +1,6 @@ use super::look_fit::dro_off; use super::pairs::{Pairs, displayed, luma}; -use super::*; +use super::{CameraTone, Rgb32f, ToneMap, luminance_2020}; /// How the per-photo tone curve is fitted ([`fit_pairs_ordered`] tries them in order). #[derive(Clone, Copy, PartialEq, Eq, Debug)] diff --git a/crates/engine/src/cmd/geocode.rs b/crates/engine/src/cmd/geocode.rs index feb9b033e9..63f8d8f173 100644 --- a/crates/engine/src/cmd/geocode.rs +++ b/crates/engine/src/cmd/geocode.rs @@ -188,7 +188,10 @@ mod download { use lightcraft_geocode::{GEONAMES_BASE, GEONAMES_ZIP}; - use super::*; + use super::{ + Cancel, DownloadOutcome, GEONAMES_ATTRIBUTION, GEONAMES_FILES, GeoNames, PoisonError, Result, Session, Value, bad, dataset_dir, json, + str_param, + }; use crate::activity::Unit; const MAX_ZIP: u64 = 64 * 1024 * 1024; diff --git a/crates/engine/src/cmd/library/filters.rs b/crates/engine/src/cmd/library/filters.rs index 1eaa5223f6..f0a3a504f3 100644 --- a/crates/engine/src/cmd/library/filters.rs +++ b/crates/engine/src/cmd/library/filters.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{AlbumId, LibrarySource, PhotoId, Result, Session, Value, bad}; /// `base` with a partial Filter (JSON) merged on top. /// `patch` merged onto `base`, its rules brought up to date (`RuleSet::upgrade`), unchecked (see diff --git a/crates/engine/src/cmd/library/import.rs b/crates/engine/src/cmd/library/import.rs index 81b82671fb..8437bf1658 100644 --- a/crates/engine/src/cmd/library/import.rs +++ b/crates/engine/src/cmd/library/import.rs @@ -1,5 +1,5 @@ use super::selection::strs; -use super::*; +use super::{AlbumId, PhotoId, Result, Selection, Session, Value, bad, bool_or, json, str_param}; /// The auto-import folder's visible files with their sizes (the file-system half of /// `library.autoImportScan`; the app lists on a worker thread and passes `listing`). diff --git a/crates/engine/src/cmd/library/selection.rs b/crates/engine/src/cmd/library/selection.rs index 1ed1868d73..723b7c3316 100644 --- a/crates/engine/src/cmd/library/selection.rs +++ b/crates/engine/src/cmd/library/selection.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{AlbumId, Flag, Op, PhotoId, Result, Selection, Session, Value, bad, bool_or, json, ok}; /// The selection after photos left the view (deleted, or rated, flagged or labelled out of it). /// Its callers end an open edit (a slider drag) before their own change, as moving to the next diff --git a/crates/engine/src/cmd/library/specs.rs b/crates/engine/src/cmd/library/specs.rs index 07ab6f221c..2e7c1311d0 100644 --- a/crates/engine/src/cmd/library/specs.rs +++ b/crates/engine/src/cmd/library/specs.rs @@ -5,7 +5,10 @@ use super::selection::{ album_param, album_targets, album_targets_or_err, change_flag, change_rating, cull, flip, for_targets, has_library, mark_deleted, opt_album_param, rotate, row_step, select_after_deletion, select_by, step, strs, }; -use super::*; +use super::{ + Album, AlbumId, ColorLabel, CommandSpec, CopyrightStatus, Filter, Flag, GroupBy, LibrarySource, Op, PhotoId, Result, Selection, Sort, SortKey, + Value, always, bad, bool_or, cmd, has_active, has_library_selection, has_selection, json, ok, str_param, +}; /// Seeds stay exactly representable as a JSON double, so web and agent clients read back what they wrote. const MAX_SEED: u64 = 1 << 53; diff --git a/crates/engine/src/denoise/model.rs b/crates/engine/src/denoise/model.rs index 28ff953bfb..fbd13d79cd 100644 --- a/crates/engine/src/denoise/model.rs +++ b/crates/engine/src/denoise/model.rs @@ -4,8 +4,7 @@ use super::gpu::{GPU_CRASHED, GPU_MAX_FALLBACKS, GPU_PARALLEL, GPU_SLOW, GPU_STU use super::settings::{installed_models, read_settings}; #[cfg(feature = "denoise")] use super::state::Pace; -use super::*; - +use super::{Arc, DenoiserManifest, Mutex, Path, TileRunner, Value, json}; /// Stack of the threads that run the model (the runtime recurses through its graph). pub(super) const STACK: usize = 16 << 20; diff --git a/crates/engine/src/denoise/products.rs b/crates/engine/src/denoise/products.rs index 499e8fd6ef..bf601b14d1 100644 --- a/crates/engine/src/denoise/products.rs +++ b/crates/engine/src/denoise/products.rs @@ -1,6 +1,9 @@ use super::model::{Loader, Model, ModelSlot, RunOn, STACK}; use super::settings::EXT; -use super::*; +use super::{ + Arc, AtomicBool, AtomicUsize, ByteReader, Condvar, Control, DenoiserManifest, HashSet, Hasher128, Layout, Mutex, OnceLock, Ordering, Params, + Path, PathBuf, Photo, PoisonError, RunError, Source, SystemTime, denoise_bayer, product, +}; /// Samples at or above this (white = 1) are clipped: the model leaves them as the camera recorded them. const CLIP: f32 = 0.99; diff --git a/crates/engine/src/denoise/session.rs b/crates/engine/src/denoise/session.rs index 6a452f693e..10529d61db 100644 --- a/crates/engine/src/denoise/session.rs +++ b/crates/engine/src/denoise/session.rs @@ -4,7 +4,10 @@ use super::model::STACK; use super::products::{Active, JobSpec, MakeError, Progress, eligible, make_product, product_key, product_path, products_in}; use super::settings::{DIR, SETTINGS_TTL, installed_models, read_settings}; use super::state::{AUTO_LOOK, Failure, MAX_QUEUE, Outcome, Pace, PhotoState, Running}; -use super::*; +use super::{ + Arc, DenoiseSpec, DevelopSettings, HashMap, HashSet, MakeProduct, Mutex, Ordering, PairLoader, Path, PathBuf, Photo, PhotoId, PoisonError, + Selection, Session, Source, Value, json, product, +}; impl Session { /// Where the active model's tiles run (see [`Model::device`]); `{kind: "none"}` while no model is loaded. diff --git a/crates/engine/src/denoise/settings.rs b/crates/engine/src/denoise/settings.rs index f8acd5320e..d71c7b0745 100644 --- a/crates/engine/src/denoise/settings.rs +++ b/crates/engine/src/denoise/settings.rs @@ -1,6 +1,6 @@ use super::gpu::GPU_SETUP_MARKER; use super::model::RunOn; -use super::*; +use super::{DenoiserManifest, Deserialize, Duration, Path, PathBuf, Serialize, Value}; /// Extension of a product file. pub const EXT: &str = "lcdn"; diff --git a/crates/engine/src/denoise/state.rs b/crates/engine/src/denoise/state.rs index 76a4b61306..37b79cf8b9 100644 --- a/crates/engine/src/denoise/state.rs +++ b/crates/engine/src/denoise/state.rs @@ -1,7 +1,7 @@ use super::model::{Loader, default_loader}; use super::products::{Active, Progress}; use super::settings::Settings; -use super::*; +use super::{Arc, Downloads, HashMap, Mutex, PathBuf, PhotoId, Serialize, VecDeque}; /// Most photos waiting in the queue. pub(super) const MAX_QUEUE: usize = 5000; diff --git a/crates/engine/src/export/batch.rs b/crates/engine/src/export/batch.rs index a4bb859e2f..b5d45b1254 100644 --- a/crates/engine/src/export/batch.rs +++ b/crates/engine/src/export/batch.rs @@ -1,6 +1,6 @@ +use super::ExportOptions; use super::place::Placer; use super::prepare::{Destination, Exported, PreparedExport}; -use super::*; /// Run prepared exports in order: pick each one's path, and hand the bytes (and sidecars) to /// `write`. `exists` tells whether a path is taken. The conflict policy applies to a file and its diff --git a/crates/engine/src/export/encoding.rs b/crates/engine/src/export/encoding.rs index 3cb3be3cbc..862c72cd01 100644 --- a/crates/engine/src/export/encoding.rs +++ b/crates/engine/src/export/encoding.rs @@ -1,6 +1,9 @@ use super::options::{ExportFormat, MetadataPolicy, SharpenAmount, SharpenFor}; use super::watermark::{Watermark, draw_watermark, draw_watermark_deep}; -use super::*; +use super::{ + ChromaSubsampling, DateTime, DeepImage, DeepSamples, EncodeImage, EncodeMeta, ExportOptions, Gps, Metadata, NamedSpace, OutputDepth, OutputSpace, + Rgba8, Samples, encode, icc, +}; use std::borrow::Cow; /// Unsharp mask on an 8-bit image (separable box-blur approximation of a small Gaussian). diff --git a/crates/engine/src/export/options.rs b/crates/engine/src/export/options.rs index d1b767be29..5edf078aa5 100644 --- a/crates/engine/src/export/options.rs +++ b/crates/engine/src/export/options.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Deserialize, Serialize}; #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] diff --git a/crates/engine/src/export/params.rs b/crates/engine/src/export/params.rs index 3ef9316da6..795d8f3672 100644 --- a/crates/engine/src/export/params.rs +++ b/crates/engine/src/export/params.rs @@ -1,7 +1,7 @@ use super::options::{Conflict, DestinationMode, ExportFormat, HdrCurve, MetadataPolicy, Resize, ResizeMode, SharpenAmount, SharpenFor}; use super::prepare::DngCompression; use super::watermark::{Anchor, Watermark}; -use super::*; +use super::{ExportOptions, JxlColour, JxlEffort, JxlOptions, OutputDepth, OutputSpace, TiffCompression}; impl Default for ExportOptions { fn default() -> Self { diff --git a/crates/engine/src/export/place.rs b/crates/engine/src/export/place.rs index f0b1ace61b..d223a3a791 100644 --- a/crates/engine/src/export/place.rs +++ b/crates/engine/src/export/place.rs @@ -1,6 +1,6 @@ +use super::ExportOptions; use super::options::{Conflict, DestinationMode}; use super::prepare::{Destination, Exported}; -use super::*; /// Write an exported or rendered file on disk: its folder is created if needed, and the file is /// replaced atomically ([`lightcraft_catalog::safe_file::write_atomic_nosync`]: a temp file diff --git a/crates/engine/src/export/prepare.rs b/crates/engine/src/export/prepare.rs index 1fe9888329..0a3dce119e 100644 --- a/crates/engine/src/export/prepare.rs +++ b/crates/engine/src/export/prepare.rs @@ -2,7 +2,7 @@ use super::batch::run_batch; use super::encoding::{encode_gain_map_jpeg, encode_rendered, export_metadata, removes_location}; use super::options::ExportFormat; use super::params::apple_photos_unsupported; -use super::*; +use super::{ExportOptions, Metadata, OutputDepth}; /// One exported file. pub struct Exported { diff --git a/crates/engine/src/export/watermark.rs b/crates/engine/src/export/watermark.rs index 68633794b4..c074808eae 100644 --- a/crates/engine/src/export/watermark.rs +++ b/crates/engine/src/export/watermark.rs @@ -1,5 +1,5 @@ use super::encoding::srgb8_in; -use super::*; +use super::{DeepImage, DeepSamples, Deserialize, OutputSpace, Rgba8, Serialize}; /// Where a watermark sits. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] diff --git a/crates/engine/src/files/fs.rs b/crates/engine/src/files/fs.rs index dd1f5273cf..7012211af6 100644 --- a/crates/engine/src/files/fs.rs +++ b/crates/engine/src/files/fs.rs @@ -1,7 +1,7 @@ use super::load::{load_vec, load_vec_pair, load_vec_reduced}; use super::preview::{fit_box, fs_preview_loader, preview_orientation}; use super::probe::probe_bytes; -use super::*; +use super::{Arc, DenoiseSpec, FileLoader, FileProbe, Filter, PairLoader, ReducedLoader, fit}; /// The file's first [`lightcraft_raw::PREVIEW_PREFIX`] bytes (or the whole file when it is shorter), /// which is what every format [`lightcraft_raw::bounded_preview`] covers keeps its pointer in. diff --git a/crates/engine/src/files/load.rs b/crates/engine/src/files/load.rs index 52b01d7f73..428a84eda9 100644 --- a/crates/engine/src/files/load.rs +++ b/crates/engine/src/files/load.rs @@ -1,7 +1,7 @@ use super::colour::bin_factor; use super::preview::{fit_box, load_embedded_preview}; use super::probe::preview_reason; -use super::*; +use super::{Arc, CameraColourModel, DenoiseSpec, Filter, HIGHLIGHT_CLIP, Orientation, Rgb32f, SourceInfo, fit, xy_to_temp_tint}; /// Decode a file into a linear Rec.2020 image no larger than `max_edge`, oriented. /// diff --git a/crates/engine/src/files/preview.rs b/crates/engine/src/files/preview.rs index 49430e62a8..825167f5c1 100644 --- a/crates/engine/src/files/preview.rs +++ b/crates/engine/src/files/preview.rs @@ -1,5 +1,5 @@ use super::fs::{quick_image_srgb, raf_preview_extent, read_prefix, read_prefix_at}; -use super::*; +use super::{Arc, Filter, Orientation, PreviewLoader, Rgb32f, SourceInfo, fit}; /// Orientation for an embedded preview: its own EXIF orientation when it has one, else the raw file's. pub(super) fn preview_orientation(raw_bytes: &[u8], jpeg_orientation: u16) -> Orientation { diff --git a/crates/engine/src/files/probe.rs b/crates/engine/src/files/probe.rs index aff0b884c8..12913bc6f3 100644 --- a/crates/engine/src/files/probe.rs +++ b/crates/engine/src/files/probe.rs @@ -1,6 +1,6 @@ use super::load::WbScaleOf; use super::preview::embedded_preview_size; -use super::*; +use super::{MediaKind, Meta, Orientation, ProbeInfo}; pub(super) fn meta_of(m: &lightcraft_meta::Metadata) -> (Meta, Option) { let shutter = m.exposure_time.map(|t| if t >= 1.0 { format!("{t:.0}") } else { format!("1/{:.0}", 1.0 / t) }).unwrap_or_default(); diff --git a/crates/engine/src/import/commit.rs b/crates/engine/src/import/commit.rs index bed8356fbd..7d1a69fddb 100644 --- a/crates/engine/src/import/commit.rs +++ b/crates/engine/src/import/commit.rs @@ -2,7 +2,7 @@ use super::defaults::apply_import_defaults; use super::files::copy_into; use super::job::{Prepared, PreparedItem, ReadyFile}; use super::types::{Duplicate, ImportOptions, ImportReport, Kept, Moved, OnDeleted}; -use super::*; +use super::{HashMap, Op, Path, PathBuf, Photo, PhotoId, ProbeInfo, Session, Source}; /// A batch's items in file order while its transfers are pending ([`ImportJob::run_plan`]). #[derive(Default)] diff --git a/crates/engine/src/import/defaults.rs b/crates/engine/src/import/defaults.rs index 7ca5cecc4f..6fd3feb007 100644 --- a/crates/engine/src/import/defaults.rs +++ b/crates/engine/src/import/defaults.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Deserialize, Photo, Serialize, Session}; /// The develop settings a photo gets on import: raws start from their as-shot white balance with /// default sharpening / colour noise reduction, and file-embedded lens corrections on (as the diff --git a/crates/engine/src/import/files.rs b/crates/engine/src/import/files.rs index 2cbfc85e79..0997945977 100644 --- a/crates/engine/src/import/files.rs +++ b/crates/engine/src/import/files.rs @@ -5,7 +5,7 @@ use super::job::{ImportJob, Prepared, PreparedItem, ReadyFile}; use super::scan::ScanProgress; #[cfg(test)] use super::types::{ImportMode, ImportOptions}; -use super::*; +use super::{Path, PathBuf, ProbeInfo, Session}; /// File extensions offered by import discovery and file pickers (lower case). /// This includes preview-only raws; the file probe decides whether sensor decoding is available. @@ -253,6 +253,7 @@ pub(super) fn copy_into(dir: &Path, src: &str, name: Option<&str>, probe_hash: O #[cfg(test)] mod prepared_tests { use super::*; + use lightcraft_catalog::{Op, Photo, PhotoId, Source}; /// Extensions the picker may offer: every one in [`EXTENSIONS`], minus the /// files this build cannot import (see [`accept_list`]). diff --git a/crates/engine/src/import/job.rs b/crates/engine/src/import/job.rs index 47bc0756f0..1730518d54 100644 --- a/crates/engine/src/import/job.rs +++ b/crates/engine/src/import/job.rs @@ -1,7 +1,7 @@ use super::commit::{How, Plan, Slot, Transfer, commit_prepared, name_family, run_transfers, system_clock}; use super::files::{expand, probe_all}; use super::types::{ImportCandidate, ImportMode, ImportOptions, ImportReport, Kept, OnDeleted}; -use super::*; +use super::{HashMap, MediaKind, Path, PathBuf, Photo, PhotoId, ProbeInfo, Session, Source}; /// Import files/folders. See the module docs. pub fn import(s: &mut Session, paths: &[String], mode: ImportMode) -> crate::Result { diff --git a/crates/engine/src/import/scan.rs b/crates/engine/src/import/scan.rs index 61d8d4690a..ef925fa059 100644 --- a/crates/engine/src/import/scan.rs +++ b/crates/engine/src/import/scan.rs @@ -1,6 +1,6 @@ use super::files::{expand, probe_all}; use super::types::ImportCandidate; -use super::*; +use super::{HashMap, Path, PathBuf, PhotoId, ProbeInfo, Session, Source}; /// What a [`scan`] needs from the session, so it can run on another thread (a folder on a network /// share can take minutes to read). diff --git a/crates/engine/src/import/types.rs b/crates/engine/src/import/types.rs index 4a848015bd..6ad3e21539 100644 --- a/crates/engine/src/import/types.rs +++ b/crates/engine/src/import/types.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Deserialize, MediaKind, Photo, Serialize}; #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub enum ImportMode { diff --git a/crates/engine/src/media/cache.rs b/crates/engine/src/media/cache.rs index c3d323e38c..238870c07a 100644 --- a/crates/engine/src/media/cache.rs +++ b/crates/engine/src/media/cache.rs @@ -1,6 +1,6 @@ use super::settings_hash::SettingsHashes; use super::source::{DecodedSource, DenoiseSpec, PairLoader, RENDERED_MEM_BYTES, SourceLevel, SourceRef, THUMB_SOURCE_BYTES}; -use super::*; +use super::{Arc, DevelopSettings, Hasher128, Lru, MediaCache, Photo, PhotoId, PreviewCache, Rgb32f, Source, SourceInfo}; /// The photos that have a cached denoised picture for the denoise model in use. Only memory: nothing here touches the /// file system, so it can be asked on the UI thread. diff --git a/crates/engine/src/media/quick.rs b/crates/engine/src/media/quick.rs index 6098ed4dde..ca399b5613 100644 --- a/crates/engine/src/media/quick.rs +++ b/crates/engine/src/media/quick.rs @@ -1,6 +1,6 @@ use super::render::{RenderJob, RenderResult}; use super::source::{PreviewLoader, SourceLevel}; -use super::*; +use super::{Arc, Deserialize, Hash128, Histogram, Photo, PhotoId, PreviewCache, Rendered, Rgba8, Serialize, Source, SourceInfo}; /// Where a [`QuickJob`]'s stand-in image came from. #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] diff --git a/crates/engine/src/media/session.rs b/crates/engine/src/media/session.rs index d160b216dd..b222739fed 100644 --- a/crates/engine/src/media/session.rs +++ b/crates/engine/src/media/session.rs @@ -1,7 +1,7 @@ use super::quick::{QuickJob, content_key, source_info}; use super::render::{RenderJob, RenderResult}; use super::source::{PreviewLoader, RENDER_CACHE_VERSION, SourceLevel, SourceRef, THUMB_SIZES, face_edge, source_edge_needed, thumb_bucket}; -use super::*; +use super::{Arc, DevelopSettings, Hash128, Hasher128, MediaKind, Op, Photo, PhotoId, RenderRequest, Rendered, Rgb32f, Source, SourceInfo}; impl crate::Session { /// Build a render job for `id` fitting `max_w × max_h`. `before` renders the unedited look. diff --git a/crates/engine/src/media/settings_hash.rs b/crates/engine/src/media/settings_hash.rs index 5d9c08b93b..802918fb90 100644 --- a/crates/engine/src/media/settings_hash.rs +++ b/crates/engine/src/media/settings_hash.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Arc, DevelopSettings, HashMap, PhotoId, VecDeque, Weak}; pub(super) const SETTINGS_HASH_ENTRIES: usize = 1024; diff --git a/crates/engine/src/media/source.rs b/crates/engine/src/media/source.rs index 51c54c60a9..8f6a9c28c5 100644 --- a/crates/engine/src/media/source.rs +++ b/crates/engine/src/media/source.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Arc, Deserialize, DevelopSettings, MediaKind, Photo, Rgb32f, Rgba8, Serialize, SourceInfo}; /// Bump when the pipeline's output changes, to invalidate cached thumbnails. pub const RENDER_CACHE_VERSION: u64 = 70; diff --git a/crates/engine/src/rename/fs.rs b/crates/engine/src/rename/fs.rs index 352140b38d..71de1a7843 100644 --- a/crates/engine/src/rename/fs.rs +++ b/crates/engine/src/rename/fs.rs @@ -1,5 +1,5 @@ use super::sidecar::PacketVersion; -use super::*; +use super::{Path, PathBuf, SidecarNaming}; /// Every sidecar that may belong to `path` (both naming conventions, `.xmp` and `.XMP`). pub(super) fn sidecars(path: &str) -> Vec<(PathBuf, SidecarNaming, bool)> { diff --git a/crates/engine/src/rename/moves.rs b/crates/engine/src/rename/moves.rs index 6f7c245c9e..07d7fdfc3d 100644 --- a/crates/engine/src/rename/moves.rs +++ b/crates/engine/src/rename/moves.rs @@ -1,6 +1,6 @@ use super::fs::{MoveFs, RealFs, folded_path, is_respelling, move_one, sidecars}; use super::sidecar::{RetainedPacket, SidecarMove, advance_packets, note_companions, packet_aliases}; -use super::*; +use super::{HashMap, HashSet, Op, Path, PathBuf, SidecarNaming, Source}; /// Why [`move_file`] failed, and what it left behind. #[derive(Clone, Debug, PartialEq)] diff --git a/crates/engine/src/rename/plan.rs b/crates/engine/src/rename/plan.rs index 331297ba48..4c9620bf13 100644 --- a/crates/engine/src/rename/plan.rs +++ b/crates/engine/src/rename/plan.rs @@ -2,7 +2,7 @@ use super::fs::{MoveFs, RealFs, folded_path}; use super::moves::{BatchMoveError, move_all, set_file_ops_to}; use super::sidecar::{PacketVersion, retry_sidecars, retry_sidecars_for_paths}; use super::tokens::{expand, split_ext}; -use super::*; +use super::{EngineError, HashMap, HashSet, Op, Path, PathBuf, Photo, PhotoId, RenamePlan, Result, Session, Source}; /// The photos among `ids` a rename handles, in order: photos sharing one file (virtual copies) /// rename once. No file-system calls. diff --git a/crates/engine/src/rename/sidecar.rs b/crates/engine/src/rename/sidecar.rs index 24ebcd3f9d..85f9302d22 100644 --- a/crates/engine/src/rename/sidecar.rs +++ b/crates/engine/src/rename/sidecar.rs @@ -1,5 +1,5 @@ use super::fs::{MoveFs, is_respelling, move_one}; -use super::*; +use super::{Path, PathBuf}; /// An unfinished sidecar operation. Keep its exact paths and any recorded copy requirement: the photo may /// already have followed its new path, so a retry cannot infer this work from the catalog. diff --git a/crates/engine/src/rename/tokens.rs b/crates/engine/src/rename/tokens.rs index 3490e272b7..ee15836e87 100644 --- a/crates/engine/src/rename/tokens.rs +++ b/crates/engine/src/rename/tokens.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{MONTHS, Path, Photo, PhotoId, Serialize, Source}; pub(super) fn split_ext(name: &str) -> (&str, &str) { match name.rsplit_once('.') { diff --git a/xtask/src/ci.rs b/xtask/src/ci.rs index 61e179ce0f..bc3a9b706a 100644 --- a/xtask/src/ci.rs +++ b/xtask/src/ci.rs @@ -1,7 +1,7 @@ use super::layers::cmd_layers; use super::raw_samples::RAW_SAMPLES; use super::wasm::{cmd_wasm, cmd_wasm_for}; -use super::*; +use super::{Command, Path, PathBuf, USAGE, assets, cargo, ci_lock, ci_quick, ci_report, metadata, parity, root, run}; /// CI build jobs: one per 1.5 GB of RAM available when CI starts, at most one per CPU, 4 when it /// is unknown. With line-table debuginfo, 4 jobs measured about 3 GB of RAM in use and 2 jobs diff --git a/xtask/src/corpus.rs b/xtask/src/corpus.rs index 67de8c1ffe..434d48b279 100644 --- a/xtask/src/corpus.rs +++ b/xtask/src/corpus.rs @@ -1,5 +1,5 @@ use super::raw_samples::RAW_SAMPLES; -use super::*; +use super::{Command, Path, root, run}; pub(crate) fn cmd_corpus(download: bool) -> Result<(), String> { let corpus = root().join("corpus"); diff --git a/xtask/src/layers.rs b/xtask/src/layers.rs index 13756002d8..2a881155bc 100644 --- a/xtask/src/layers.rs +++ b/xtask/src/layers.rs @@ -3,7 +3,7 @@ //! The rule engine works on a small, metadata-independent model so it can be //! unit-tested; `from_metadata` builds that model from `cargo metadata`. -use super::*; +use super::{layers, metadata}; use serde_json::Value; /// Where a workspace crate sits. diff --git a/xtask/src/wasm.rs b/xtask/src/wasm.rs index 4f16b2d753..4330769a99 100644 --- a/xtask/src/wasm.rs +++ b/xtask/src/wasm.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{cargo, layers, metadata, run}; /// Workspace packages that must build for wasm32: all L0–L5 crates plus /// the egui shell and the web app. From ca69e74b62c819e4dee07fb50eb674ef39b8557a Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 18:02:32 +0000 Subject: [PATCH 59/93] fix(raw): check opcode byte counts without overflow --- crates/raw/src/opcodes.rs | 4 ++-- crates/raw/src/opcodes/tests.rs | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/raw/src/opcodes.rs b/crates/raw/src/opcodes.rs index f7750aaac0..4d3e463b0e 100644 --- a/crates/raw/src/opcodes.rs +++ b/crates/raw/src/opcodes.rs @@ -381,7 +381,7 @@ fn parse_gain_map(area: Area, reader: &mut Rd<'_>) -> Option { let origin = [reader.finite_f64()?, reader.finite_f64()?]; let map_planes = reader.u32()?; let count = (points_v as usize).checked_mul(points_h as usize)?.checked_mul(map_planes as usize)?; - if count == 0 || count * 4 > reader.remaining() { + if count == 0 || count > reader.remaining() / 4 { return None; } let gains = (0..count).map(|_| reader.f32()).collect::>()?; @@ -390,7 +390,7 @@ fn parse_gain_map(area: Area, reader: &mut Rd<'_>) -> Option { fn parse_delta_scale(id: u32, area: Area, reader: &mut Rd<'_>) -> Option { let count = reader.u32()? as usize; - if count * 4 > reader.remaining() { + if count > reader.remaining() / 4 { return None; } let values: Vec = (0..count).map(|_| reader.f32()).collect::>()?; diff --git a/crates/raw/src/opcodes/tests.rs b/crates/raw/src/opcodes/tests.rs index e63a0bf56c..d1be999e98 100644 --- a/crates/raw/src/opcodes/tests.rs +++ b/crates/raw/src/opcodes/tests.rs @@ -1,5 +1,19 @@ use super::*; +#[test] +fn reject_opcode_counts_whose_bytes_exceed_the_remaining_data() { + let mut gain_map = Vec::new(); + for value in [u32::MAX, 1] { + gain_map.extend_from_slice(&value.to_be_bytes()); + } + gain_map.extend(be(&[1.0, 1.0, 0.0, 0.0])); + gain_map.extend_from_slice(&1u32.to_be_bytes()); + assert!(parse_gain_map(Area::default(), &mut Rd { d: &gain_map, p: 0 }).is_none()); + + let delta_count = u32::MAX.to_be_bytes(); + assert!(parse_delta_scale(10, Area::default(), &mut Rd { d: &delta_count, p: 0 }).is_none()); +} + pub(crate) struct ListWriter(pub Vec, pub u32); impl ListWriter { From b298c79a7d85d47773675ace2e229bcc49da92c6 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 18:04:04 +0000 Subject: [PATCH 60/93] docs: correct clippy indexing guidance --- AGENTS.md | 2 +- CLAUDE.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 959d2808f8..31dfd70f03 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -51,7 +51,7 @@ of it. Full standard: `../craftrules/standards/never-crash.md` - **Last-resort guard:** a panic hook plus `catch_unwind` around command dispatch and import/export turns an escaped panic into an error dialog and keeps the document. It's a safety net, not a licence; keep `panic = "unwind"` on native. - **Prove it:** every crash fix lands with a small synthetic regression test that panicked before the fix. -- Enforced by clippy: root `clippy.toml` allows unwrap/expect/panic/indexing in tests only, and every production crate +- Enforced by clippy: root `clippy.toml` allows unwrap/expect/panic in tests only; indexing is not denied. Every production crate root (`lib.rs`, each binary's `main.rs`) carries `#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]`. Not `[workspace.lints]`: those would also hit integration tests, examples and benches. New crates start with the attribute. diff --git a/CLAUDE.md b/CLAUDE.md index 1ff3defb05..5b116781a0 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -52,7 +52,7 @@ of it. Full standard: `../craftrules/standards/never-crash.md` - **Last-resort guard:** a panic hook plus `catch_unwind` around command dispatch and import/export turns an escaped panic into an error dialog and keeps the document. It's a safety net, not a licence; keep `panic = "unwind"` on native. - **Prove it:** every crash fix lands with a small synthetic regression test that panicked before the fix. -- Enforced by clippy: root `clippy.toml` keeps unwrap/expect/panic/indexing allowances scoped to tests. The workspace +- Enforced by clippy: root `clippy.toml` keeps unwrap/expect/panic allowances scoped to tests; indexing is not denied. The workspace denies `cognitive_complexity`, `too_many_arguments` and `wildcard_imports`; members inherit them with `[lints] workspace = true`, and `sysmem` repeats those denies in its local lint table. Every production crate root (`lib.rs`, each binary's `main.rs`) carries `#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, From eeb63636e80d6e9f44cf9133ce70e4ebb47cda9d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 18:12:55 +0000 Subject: [PATCH 61/93] docs: clarify crate lint attribute placement --- CLAUDE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 5b116781a0..7005cac3b2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -57,8 +57,8 @@ of it. Full standard: `../craftrules/standards/never-crash.md` `[lints] workspace = true`, and `sysmem` repeats those denies in its local lint table. Every production crate root (`lib.rs`, each binary's `main.rs`) carries `#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]`. Every new workspace crate must include - `[lints] workspace = true` in `Cargo.toml` to inherit `[workspace.lints]`, and new production crate roots start with - the attribute. + `[lints] workspace = true` in `Cargo.toml` to inherit `[workspace.lints]`, and new production crate roots include + the attribute before modules or other crate items; crate-level `//!` documentation may precede it. ## Non-negotiables - **Clean-room.** Never read/disassemble anything inside Adobe app bundles (names/listings only). Never copy Adobe icons, presets, profiles (DCP), lens profiles (LCP), camera matrices, fonts. Observation of the installed Lightroom is read-only (it syncs the user's personal library: never import/edit/rate/delete there). Never copy GPL/LGPL/AGPL code (darktable, RawTherapee, ART, LibRaw, rawspeed, rawloader, rawler, lensfun, dcraw-derived GPL code…). From 5b5ddc39049ba7fb5c9532cd6f1f3c33aa4fc83a Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 19:49:11 +0000 Subject: [PATCH 62/93] fix(engine): import denoise model and gpu names explicitly --- crates/engine/src/denoise/gpu.rs | 2 +- crates/engine/src/denoise/model.rs | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/engine/src/denoise/gpu.rs b/crates/engine/src/denoise/gpu.rs index 1577b4edc8..a2a493fab9 100644 --- a/crates/engine/src/denoise/gpu.rs +++ b/crates/engine/src/denoise/gpu.rs @@ -1,7 +1,7 @@ #[cfg(feature = "denoise")] use super::model::{GpuSide, STACK}; #[cfg(feature = "denoise")] -use super::*; +use super::{Arc, Duration, Mutex, Path, PathBuf, PoisonError, SystemTime, TileRunner}; /// Tiles run at once on a graphics card: enough to keep it fed while others are packed and blended. #[cfg(feature = "denoise")] diff --git a/crates/engine/src/denoise/model.rs b/crates/engine/src/denoise/model.rs index fbd13d79cd..b9f75023e3 100644 --- a/crates/engine/src/denoise/model.rs +++ b/crates/engine/src/denoise/model.rs @@ -4,6 +4,8 @@ use super::gpu::{GPU_CRASHED, GPU_MAX_FALLBACKS, GPU_PARALLEL, GPU_SLOW, GPU_STU use super::settings::{installed_models, read_settings}; #[cfg(feature = "denoise")] use super::state::Pace; +#[cfg(feature = "denoise")] +use super::{AtomicBool, AtomicUsize, Ordering, OnceLock, PathBuf, PoisonError, RunError}; use super::{Arc, DenoiserManifest, Mutex, Path, TileRunner, Value, json}; /// Stack of the threads that run the model (the runtime recurses through its graph). pub(super) const STACK: usize = 16 << 20; From 6774d1419f694f138956a87e0a6366c72969e287 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 19:56:22 +0000 Subject: [PATCH 63/93] refactor(ui-egui): replace wildcard imports with explicit lists --- crates/engine/src/denoise/model.rs | 4 ++-- crates/ui-egui/src/app.rs | 8 ++++++- crates/ui-egui/src/app/control.rs | 2 +- crates/ui-egui/src/app/frame.rs | 5 +++- crates/ui-egui/src/app/input.rs | 24 +++++++++---------- crates/ui-egui/src/app/prefs.rs | 2 +- crates/ui-egui/src/app/screenshot.rs | 5 +++- crates/ui-egui/src/caches.rs | 2 +- crates/ui-egui/src/dialogs/confirm.rs | 2 +- crates/ui-egui/src/dialogs/cull.rs | 2 +- crates/ui-egui/src/dialogs/export.rs | 2 +- crates/ui-egui/src/dialogs/frame.rs | 2 +- crates/ui-egui/src/dialogs/import/body.rs | 2 +- crates/ui-egui/src/dialogs/import/scan.rs | 2 +- crates/ui-egui/src/dialogs/import/tags.rs | 2 +- crates/ui-egui/src/dialogs/import/task.rs | 2 +- crates/ui-egui/src/dialogs/rename.rs | 2 +- crates/ui-egui/src/dialogs/sam_model.rs | 2 +- .../src/dialogs/settings/appearance.rs | 2 +- .../ui-egui/src/dialogs/settings/display.rs | 2 +- .../ui-egui/src/dialogs/settings/general.rs | 2 +- crates/ui-egui/src/dialogs/settings/import.rs | 2 +- .../ui-egui/src/dialogs/settings/libraries.rs | 2 +- .../src/dialogs/settings/performance.rs | 2 +- .../ui-egui/src/dialogs/settings/slideshow.rs | 2 +- .../ui-egui/src/dialogs/settings/widgets.rs | 2 +- .../ui-egui/src/dialogs/slideshow_export.rs | 2 +- crates/ui-egui/src/menus/files.rs | 2 +- crates/ui-egui/src/menus/run.rs | 2 +- crates/ui-egui/src/menus/ui_commands.rs | 2 +- crates/ui-egui/src/panels/detail/crop.rs | 4 +++- crates/ui-egui/src/panels/detail/filmstrip.rs | 2 +- crates/ui-egui/src/panels/detail/geometry.rs | 4 ++-- crates/ui-egui/src/panels/detail/info.rs | 2 +- crates/ui-egui/src/panels/detail/masks.rs | 5 +++- crates/ui-egui/src/panels/detail/retouch.rs | 2 +- crates/ui-egui/src/panels/detail/window.rs | 2 +- crates/ui-egui/src/panels/edit/curve.rs | 5 +++- crates/ui-egui/src/panels/edit/grading.rs | 5 +++- crates/ui-egui/src/panels/edit/histogram.rs | 5 +++- crates/ui-egui/src/panels/edit/mixer.rs | 2 +- crates/ui-egui/src/panels/edit/sliders.rs | 5 +++- crates/ui-egui/src/panels/left/albums.rs | 2 +- crates/ui-egui/src/panels/left/dates.rs | 2 +- crates/ui-egui/src/panels/left/folders.rs | 2 +- crates/ui-egui/src/panels/left/keywords.rs | 2 +- crates/ui-egui/src/panels/left/local.rs | 2 +- crates/ui-egui/src/panels/left/rows.rs | 2 +- crates/ui-egui/src/panels/left/sections.rs | 2 +- crates/ui-egui/src/panels/right/crop.rs | 2 +- crates/ui-egui/src/panels/right/history.rs | 2 +- crates/ui-egui/src/panels/right/info.rs | 2 +- crates/ui-egui/src/panels/right/keywords.rs | 2 +- crates/ui-egui/src/services.rs | 2 +- crates/ui-egui/src/state/dialog.rs | 2 +- crates/ui-egui/src/state/settings.rs | 2 +- crates/ui-egui/src/state/view.rs | 2 +- 57 files changed, 99 insertions(+), 70 deletions(-) diff --git a/crates/engine/src/denoise/model.rs b/crates/engine/src/denoise/model.rs index b9f75023e3..c906415746 100644 --- a/crates/engine/src/denoise/model.rs +++ b/crates/engine/src/denoise/model.rs @@ -4,9 +4,9 @@ use super::gpu::{GPU_CRASHED, GPU_MAX_FALLBACKS, GPU_PARALLEL, GPU_SLOW, GPU_STU use super::settings::{installed_models, read_settings}; #[cfg(feature = "denoise")] use super::state::Pace; -#[cfg(feature = "denoise")] -use super::{AtomicBool, AtomicUsize, Ordering, OnceLock, PathBuf, PoisonError, RunError}; use super::{Arc, DenoiserManifest, Mutex, Path, TileRunner, Value, json}; +#[cfg(feature = "denoise")] +use super::{AtomicBool, AtomicUsize, OnceLock, Ordering, PathBuf, PoisonError, RunError}; /// Stack of the threads that run the model (the runtime recurses through its graph). pub(super) const STACK: usize = 16 << 20; diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 98f8458c9d..fa10210f0a 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -1,7 +1,13 @@ use super::clock::{AppClock, monotonic_ms}; use super::services::Services; use super::state::{GestureFrame, InjectedDrop, InjectedPress}; -use super::*; +use super::{ + AiModel, Caches, CommandError, ControlRequest, ControlResponse, ErrorKind, GESTURE_TIMEOUT_MS, LightcraftApp, MAX_PENDING_GESTURES, + MAX_PENDING_SHOTS, MAX_SHOT_BYTES, MAX_SHOT_TOTAL_BYTES, MAX_TEXTURE_SIDE, PendingGesture, PendingShot, Perf, Receiver, SCREEN_PROFILE, + SCREENSHOT_FALLBACK_MS, SCREENSHOT_SETTLE_MS, SHOT_FORCE_BUSY_MS, SHOT_SETTLE_FRAMES, SHOT_SETTLE_MS, Sender, Session, ShotGeometry, + TOAST_SECONDS, UiState, Value, docking, drop_overlay, export_task, focus_scan, frame_rate, headless, i18n, import, lightroom_import, menus, + merge, model_setup, panels, pick, recheck, render, shortcuts, slideshow_export, state, sync, tasks, theme, updates_ui, widgets, +}; mod control; mod frame; diff --git a/crates/ui-egui/src/app/control.rs b/crates/ui-egui/src/app/control.rs index 00b66e4b07..525c5419cd 100644 --- a/crates/ui-egui/src/app/control.rs +++ b/crates/ui-egui/src/app/control.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{ControlResponse, GESTURE_TIMEOUT_MS, GestureFrame, LightcraftApp, MAX_PENDING_GESTURES, PendingGesture, Sender, Value}; use crate::control; impl LightcraftApp { diff --git a/crates/ui-egui/src/app/frame.rs b/crates/ui-egui/src/app/frame.rs index efae98a9b0..6e92091c78 100644 --- a/crates/ui-egui/src/app/frame.rs +++ b/crates/ui-egui/src/app/frame.rs @@ -1,4 +1,7 @@ -use super::*; +use super::{ + LightcraftApp, docking, drop_overlay, export_task, focus_scan, import, lightroom_import, merge, model_setup, monotonic_ms, panels, pick, recheck, + shortcuts, slideshow_export, state, sync, tasks, theme, updates_ui, widgets, +}; impl LightcraftApp { /// Install/refresh fonts once and watch the device and availability caches. Setup, not input. diff --git a/crates/ui-egui/src/app/input.rs b/crates/ui-egui/src/app/input.rs index f94108ce01..35b7991b48 100644 --- a/crates/ui-egui/src/app/input.rs +++ b/crates/ui-egui/src/app/input.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{GESTURE_TIMEOUT_MS, InjectedDrop, InjectedPress, LightcraftApp, drop_overlay, import, panels}; impl LightcraftApp { /// Preserve the currently queued handles while a prompt or blocking library window owns @@ -262,7 +262,7 @@ mod drop_tests { fn photo_sidecars_are_not_presets() { let v = |a: &[&str]| a.iter().map(|s| s.to_string()).collect::>(); let dropped = v(&["/a/IMG_1.CR2", "/a/IMG_1.xmp", "/a/IMG_2.jpg", "/a/IMG_2.jpg.XMP", "/a/Look.xmp", "/b/IMG_1.xmp"]); - let (presets, photos) = super::split_presets(dropped); + let (presets, photos) = crate::split_presets(dropped); assert_eq!(photos, v(&["/a/IMG_1.CR2", "/a/IMG_2.jpg"])); assert_eq!(presets, v(&["/a/Look.xmp", "/b/IMG_1.xmp"])); } @@ -271,31 +271,31 @@ mod drop_tests { fn detection_results_are_summarised_in_words() { let r = |counts: &[usize]| serde_json::json!({"photos": counts.iter().map(|n| serde_json::json!({"faces": vec![0; *n]})).collect::>()}); - assert_eq!(super::detect_summary(&r(&[0])), "No faces found"); - assert_eq!(super::detect_summary(&r(&[1])), "Found 1 face"); - assert_eq!(super::detect_summary(&r(&[3])), "Found 3 faces"); - assert_eq!(super::detect_summary(&r(&[0, 0])), "No faces found in 2 photos"); - assert_eq!(super::detect_summary(&r(&[2, 0, 1])), "Found 3 faces in 2 photos"); - assert_eq!(super::detect_summary(&serde_json::json!({})), "No faces found in 0 photos"); + assert_eq!(crate::app::detect_summary(&r(&[0])), "No faces found"); + assert_eq!(crate::app::detect_summary(&r(&[1])), "Found 1 face"); + assert_eq!(crate::app::detect_summary(&r(&[3])), "Found 3 faces"); + assert_eq!(crate::app::detect_summary(&r(&[0, 0])), "No faces found in 2 photos"); + assert_eq!(crate::app::detect_summary(&r(&[2, 0, 1])), "Found 3 faces in 2 photos"); + assert_eq!(crate::app::detect_summary(&serde_json::json!({})), "No faces found in 0 photos"); } #[test] fn dropped_face_models_are_told_apart() { for p in ["/a/model.onnx", "/a/dir/M.ONNX"] { - assert!(super::is_model_file(p), "{p}"); + assert!(crate::is_model_file(p), "{p}"); } for p in ["/a/model.onnx.jpg", "/a/onnx", "/a/b.png"] { - assert!(!super::is_model_file(p), "{p}"); + assert!(!crate::is_model_file(p), "{p}"); } } #[test] fn dropped_presets_are_told_apart_from_photos() { for p in ["/a/Look.lrtemplate", "/a/b.XMP", "/a/pack.zip", "/a/x.lcpreset", "/a/Magic Hour.mplumpack", "/a/Pop.lmp", "/a/Bundle.LMP"] { - assert!(super::is_preset_file(p), "{p}"); + assert!(crate::is_preset_file(p), "{p}"); } for p in ["/a/IMG_1.CR2", "/a/b.dng", "/a/c.jpg", "/a/folder"] { - assert!(!super::is_preset_file(p), "{p}"); + assert!(!crate::is_preset_file(p), "{p}"); } } } diff --git a/crates/ui-egui/src/app/prefs.rs b/crates/ui-egui/src/app/prefs.rs index a85a5f7518..3dcafeb14b 100644 --- a/crates/ui-egui/src/app/prefs.rs +++ b/crates/ui-egui/src/app/prefs.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{LightcraftApp, SCREEN_PROFILE, theme}; impl LightcraftApp { /// The system's appearance: the host's answer first, then egui's (none: unknown). diff --git a/crates/ui-egui/src/app/screenshot.rs b/crates/ui-egui/src/app/screenshot.rs index c2de3aae61..79b4639954 100644 --- a/crates/ui-egui/src/app/screenshot.rs +++ b/crates/ui-egui/src/app/screenshot.rs @@ -1,4 +1,7 @@ -use super::*; +use super::{ + ControlResponse, LightcraftApp, MAX_PENDING_SHOTS, MAX_SHOT_BYTES, MAX_SHOT_TOTAL_BYTES, PendingShot, SCREENSHOT_FALLBACK_MS, + SCREENSHOT_SETTLE_MS, SHOT_FORCE_BUSY_MS, SHOT_SETTLE_FRAMES, SHOT_SETTLE_MS, Sender, ShotGeometry, headless, +}; use crate::control; impl LightcraftApp { diff --git a/crates/ui-egui/src/caches.rs b/crates/ui-egui/src/caches.rs index 0fb5a4b2cf..93fe551847 100644 --- a/crates/ui-egui/src/caches.rs +++ b/crates/ui-egui/src/caches.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Caches, album_picker, i18n, panels}; /// The left panel's counts. #[derive(Clone, Copy, Debug, Default)] diff --git a/crates/ui-egui/src/dialogs/confirm.rs b/crates/ui-egui/src/dialogs/confirm.rs index 196018e551..6b8998c33c 100644 --- a/crates/ui-egui/src/dialogs/confirm.rs +++ b/crates/ui-egui/src/dialogs/confirm.rs @@ -1,6 +1,6 @@ use super::cull::cull_params; use super::export::export_dialog_params; -use super::*; +use super::{Dialog, LightcraftApp, json}; /// Runs a command that creates an album and asks the Albums tree to open the folders down to it. fn created_in(app: &mut LightcraftApp, command: &str, params: serde_json::Value) -> Result { diff --git a/crates/ui-egui/src/dialogs/cull.rs b/crates/ui-egui/src/dialogs/cull.rs index 2c3d6497a6..a43276a645 100644 --- a/crates/ui-egui/src/dialogs/cull.rs +++ b/crates/ui-egui/src/dialogs/cull.rs @@ -1,4 +1,4 @@ -use super::*; +use super::json; /// Apply a dialog's action (also used by `ui.dialog.confirm`). /// What [`fmt_gap`] writes, read back: `90`, `90 s`, `1 min 30 s`, `2 h 5 min`, `1 day` diff --git a/crates/ui-egui/src/dialogs/export.rs b/crates/ui-egui/src/dialogs/export.rs index 56292605c4..ce9cffe77a 100644 --- a/crates/ui-egui/src/dialogs/export.rs +++ b/crates/ui-egui/src/dialogs/export.rs @@ -1,5 +1,5 @@ use super::frame::{field, num}; -use super::*; +use super::{ControlSpec, LightcraftApp, Section, SettingsGroup, Tokens, Track}; /// The Export dialog's watermark preview: the first exported photo, as wide as the dialog whatever /// its shape, with the watermark drawn on it as the file will have it at size `resize` (`None` = diff --git a/crates/ui-egui/src/dialogs/frame.rs b/crates/ui-egui/src/dialogs/frame.rs index 3d8eb4ef88..007c733cb2 100644 --- a/crates/ui-egui/src/dialogs/frame.rs +++ b/crates/ui-egui/src/dialogs/frame.rs @@ -1,5 +1,5 @@ use super::export::LABEL_W; -use super::*; +use super::{BACKDROP_SHOWN, ControlSpec, Dialog, LightcraftApp, Tokens}; /// A click on the dimmed backdrop around the dialog: it closes the dialog like Esc. Pressed and /// released outside the window, so a slider dragged past its edge doesn't close it; a press while a diff --git a/crates/ui-egui/src/dialogs/import/body.rs b/crates/ui-egui/src/dialogs/import/body.rs index 9ba470660b..8f82ae51dd 100644 --- a/crates/ui-egui/src/dialogs/import/body.rs +++ b/crates/ui-egui/src/dialogs/import/body.rs @@ -1,5 +1,5 @@ use super::tags::{tag_field_width, tag_help, tag_toggle, unknown_tags_warning}; -use super::*; +use super::{Align2, Color32, ImportDialog, LightcraftApp, Rect, Sense, Slot, Stroke, StrokeKind, Tokens, Vec2, pos2, register, vec2}; /// The review dialog's first size (points). It can be resized; the photo grid takes the height. pub(crate) const DIALOG_SIZE: [f32; 2] = [960.0, 720.0]; diff --git a/crates/ui-egui/src/dialogs/import/scan.rs b/crates/ui-egui/src/dialogs/import/scan.rs index a930af00cc..67b1fa176b 100644 --- a/crates/ui-egui/src/dialogs/import/scan.rs +++ b/crates/ui-egui/src/dialogs/import/scan.rs @@ -1,5 +1,5 @@ use super::task::ImportTask; -use super::*; +use super::{ImportDialog, LightcraftApp, Ordering, ScanInput, ScanOutput, ScanProgress, Value, json, scan_with}; /// A folder scan running on a worker thread (a network share can take minutes to read; the /// window must keep answering meanwhile). diff --git a/crates/ui-egui/src/dialogs/import/tags.rs b/crates/ui-egui/src/dialogs/import/tags.rs index 770bb5b309..1ae10ca021 100644 --- a/crates/ui-egui/src/dialogs/import/tags.rs +++ b/crates/ui-egui/src/dialogs/import/tags.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Tokens, register}; /// Reserve the actual translated tag button width beside a template field. pub(crate) fn tag_field_width(ui: &egui::Ui) -> f32 { diff --git a/crates/ui-egui/src/dialogs/import/task.rs b/crates/ui-egui/src/dialogs/import/task.rs index bcef55b11e..c41a941a31 100644 --- a/crates/ui-egui/src/dialogs/import/task.rs +++ b/crates/ui-egui/src/dialogs/import/task.rs @@ -1,5 +1,5 @@ use super::scan::{busy_synchronizing, running}; -use super::*; +use super::{ImportDialog, ImportUprightMode, ImportWarning, ImportWarningCode, LightcraftApp, Ordering, Value, json}; /// Files per batch in the browser build (each batch joins the catalog as it is ready, so the /// progress window updates); the desktop's worker uses [`lightcraft_engine::import::batch_size`]. diff --git a/crates/ui-egui/src/dialogs/rename.rs b/crates/ui-egui/src/dialogs/rename.rs index f178ba6ebe..8632daf412 100644 --- a/crates/ui-egui/src/dialogs/rename.rs +++ b/crates/ui-egui/src/dialogs/rename.rs @@ -1,4 +1,4 @@ -use super::*; +use super::LightcraftApp; /// Rows the Rename dialog previews. pub(super) const RENAME_PREVIEW_ROWS: usize = 6; diff --git a/crates/ui-egui/src/dialogs/sam_model.rs b/crates/ui-egui/src/dialogs/sam_model.rs index fa578440b0..fafa91cebb 100644 --- a/crates/ui-egui/src/dialogs/sam_model.rs +++ b/crates/ui-egui/src/dialogs/sam_model.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{LightcraftApp, Tokens, json}; /// No SAM 3 model, no download running and nowhere to download it from: installing it by hand is /// all the dialog can offer. diff --git a/crates/ui-egui/src/dialogs/settings/appearance.rs b/crates/ui-egui/src/dialogs/settings/appearance.rs index 51159df6bd..571db16fc9 100644 --- a/crates/ui-egui/src/dialogs/settings/appearance.rs +++ b/crates/ui-egui/src/dialogs/settings/appearance.rs @@ -1,5 +1,5 @@ use super::widgets::{choices, heading}; -use super::*; +use super::{RichText, Tokens, register}; /// Appearance Mode (`button:settingsAppearance-{0,1,2}`: Auto, Dark, Light) above the light and /// dark theme cards (`radio:theme-{id}`), each with a preview of the chosen theme. The card in diff --git a/crates/ui-egui/src/dialogs/settings/display.rs b/crates/ui-egui/src/dialogs/settings/display.rs index a54b05cedc..a5b1974d21 100644 --- a/crates/ui-egui/src/dialogs/settings/display.rs +++ b/crates/ui-egui/src/dialogs/settings/display.rs @@ -1,6 +1,6 @@ use super::appearance::appearance; use super::widgets::{check, choices, heading, hint, path_label, row}; -use super::*; +use super::{GridBadges, LightcraftApp, RichText, Tokens, Value, json, register}; // ---------------------------------------------------------------------------------- Interface diff --git a/crates/ui-egui/src/dialogs/settings/general.rs b/crates/ui-egui/src/dialogs/settings/general.rs index 21b94f150f..85866b5fad 100644 --- a/crates/ui-egui/src/dialogs/settings/general.rs +++ b/crates/ui-egui/src/dialogs/settings/general.rs @@ -1,5 +1,5 @@ use super::widgets::{check, choices, heading, hint, path_label, row}; -use super::*; +use super::{LightcraftApp, RichText, StartupView, Tokens, json, register}; // ------------------------------------------------------------------------------------- General diff --git a/crates/ui-egui/src/dialogs/settings/import.rs b/crates/ui-egui/src/dialogs/settings/import.rs index c7272d3668..97f34d6abc 100644 --- a/crates/ui-egui/src/dialogs/settings/import.rs +++ b/crates/ui-egui/src/dialogs/settings/import.rs @@ -1,6 +1,6 @@ use super::general::{cameras, preset_combo}; use super::widgets::{button_width, check, choices, heading, hint, path_label, row}; -use super::*; +use super::{LightcraftApp, RichText, Tokens, json, register}; pub(super) fn import_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) { let d = app.session.import_defaults.clone(); diff --git a/crates/ui-egui/src/dialogs/settings/libraries.rs b/crates/ui-egui/src/dialogs/settings/libraries.rs index 389f79f11d..8e41e8dd42 100644 --- a/crates/ui-egui/src/dialogs/settings/libraries.rs +++ b/crates/ui-egui/src/dialogs/settings/libraries.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{LightcraftApp, Value, json}; // ------------------------------------------------------------------------------- Open Library… diff --git a/crates/ui-egui/src/dialogs/settings/performance.rs b/crates/ui-egui/src/dialogs/settings/performance.rs index daf2fa435f..e65402c200 100644 --- a/crates/ui-egui/src/dialogs/settings/performance.rs +++ b/crates/ui-egui/src/dialogs/settings/performance.rs @@ -1,7 +1,7 @@ use super::widgets::{check, choices, heading, hint, row}; #[cfg(not(target_arch = "wasm32"))] use super::widgets::{label_width, path_label}; -use super::*; +use super::{CACHE_SIZES, LABEL_W, LightcraftApp, PREVIEW_LIMITS, RichText, Tokens, Value, json, register}; // --------------------------------------------------------------------------------- Performance diff --git a/crates/ui-egui/src/dialogs/settings/slideshow.rs b/crates/ui-egui/src/dialogs/settings/slideshow.rs index b67427c408..a11bbfff60 100644 --- a/crates/ui-egui/src/dialogs/settings/slideshow.rs +++ b/crates/ui-egui/src/dialogs/settings/slideshow.rs @@ -1,6 +1,6 @@ use super::display::duration_slider; use super::widgets::{check, choices, heading, hint, row}; -use super::*; +use super::{LightcraftApp, Tokens, Value, json, register}; /// The Slideshow tab: the slide preview, then the settings, in one column the width of the page /// (the page scrolls; a column beside the preview would be wider than the window). Without diff --git a/crates/ui-egui/src/dialogs/settings/widgets.rs b/crates/ui-egui/src/dialogs/settings/widgets.rs index 3aea00b444..7607b12516 100644 --- a/crates/ui-egui/src/dialogs/settings/widgets.rs +++ b/crates/ui-egui/src/dialogs/settings/widgets.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{LABEL_W, RichText, Tokens, register}; /// `path` shortened to fit `max` (as `width` measures it) by dropping leading folders, after /// either kind of separator, so that its end stays (`…/Pictures/Library`, diff --git a/crates/ui-egui/src/dialogs/slideshow_export.rs b/crates/ui-egui/src/dialogs/slideshow_export.rs index 7a898b5db2..0218d613e9 100644 --- a/crates/ui-egui/src/dialogs/slideshow_export.rs +++ b/crates/ui-egui/src/dialogs/slideshow_export.rs @@ -5,8 +5,8 @@ use serde_json::{Value, json}; +use super::Tokens; use super::frame::{choices, field}; -use super::*; use crate::LightcraftApp; use crate::pick::{PickKind, PickRequest, Picked}; diff --git a/crates/ui-egui/src/menus/files.rs b/crates/ui-egui/src/menus/files.rs index 52389d9305..d75282e577 100644 --- a/crates/ui-egui/src/menus/files.rs +++ b/crates/ui-egui/src/menus/files.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Dialog, LightcraftApp, Value, json}; /// The Delete key in an album: a normal album loses the selected photos (`album.removePhotos`), /// which stay in the library and their folder; a smart album keeps them (its rules decide) and diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index c550ff0d4d..9977affacf 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -1,6 +1,6 @@ use super::files::{edit_in, open_log_folder, open_original_in, show_in_finder, show_in_folders}; use super::ui_commands::{UI_COMMANDS, language_from_command}; -use super::*; +use super::{BeforeAfter, Dialog, LightcraftApp, PickRequest, Picked, RightPanel, Value, ViewMode, Zoom, json, thumb_size_view}; fn panel(app: &mut LightcraftApp, ctx: &egui::Context, p: RightPanel, name: &str) { if app.ui.right == p && crate::docking::exposed(app, crate::docking::Panel::Tools) { diff --git a/crates/ui-egui/src/menus/ui_commands.rs b/crates/ui-egui/src/menus/ui_commands.rs index 7236b5528f..2759d21972 100644 --- a/crates/ui-egui/src/menus/ui_commands.rs +++ b/crates/ui-egui/src/menus/ui_commands.rs @@ -1,4 +1,4 @@ -use super::*; +use super::UiCommand; /// The "Edit → Language" entries, one per language in [`crate::i18n::Locale::ALL`], so a language /// has a matching menu command (also listed through the control channel). Tests check coverage. diff --git a/crates/ui-egui/src/panels/detail/crop.rs b/crates/ui-egui/src/panels/detail/crop.rs index 295b8f8197..f88b23fdd8 100644 --- a/crates/ui-egui/src/panels/detail/crop.rs +++ b/crates/ui-egui/src/panels/detail/crop.rs @@ -1,5 +1,7 @@ use super::geometry::CanvasMap; -use super::*; +use super::{ + Affine, Color32, DevelopSettings, Frame, Gesture, LightcraftApp, PhotoId, Point, Pos2, Rect, Stroke, Tokens, json, pos2, register, vec2, +}; // ------------------------------------------------------------------------ crop diff --git a/crates/ui-egui/src/panels/detail/filmstrip.rs b/crates/ui-egui/src/panels/detail/filmstrip.rs index c39fc4442c..4a0de28cf2 100644 --- a/crates/ui-egui/src/panels/detail/filmstrip.rs +++ b/crates/ui-egui/src/panels/detail/filmstrip.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Align2, Color32, LightcraftApp, PhotoId, Pos2, Rect, Sense, Slot, Stroke, StrokeKind, Tokens, json, pos2, register, vec2}; /// Size of the Navigator mini map (points). const NAV_W: f32 = 180.0; diff --git a/crates/ui-egui/src/panels/detail/geometry.rs b/crates/ui-egui/src/panels/detail/geometry.rs index 6424dabd80..d679010f17 100644 --- a/crates/ui-egui/src/panels/detail/geometry.rs +++ b/crates/ui-egui/src/panels/detail/geometry.rs @@ -1,6 +1,6 @@ #[cfg(test)] use super::info::label_badge_rect; -use super::*; +use super::{Affine, Frame, LightcraftApp, PhotoId, Point, Pos2, Rect, Zoom, json, pos2, vec2}; /// Screen ↔ normalized-image mapping for the displayed frame. #[derive(Clone, Copy)] @@ -296,7 +296,7 @@ mod preview_geometry_tests { fn before_label_badge_keeps_clear_of_the_filter_pill_and_the_right_edge() { let text = vec2(40.0, 14.0); let pane = Rect::from_min_size(pos2(100.0, 50.0), vec2(800.0, 600.0)); - let inset = super::FILTER_PILL_INSET + super::FILTER_PILL_HEIGHT; + let inset = crate::panels::detail::FILTER_PILL_INSET + crate::panels::detail::FILTER_PILL_HEIGHT; let past = label_badge_rect(Rect::from_min_size(pos2(-900.0, -700.0), vec2(3000.0, 2000.0)), pane, text, inset); assert_eq!(past.min, pos2(108.0, 50.0 + inset + 8.0)); let under = label_badge_rect(Rect::from_min_size(pos2(200.0, 60.0), vec2(400.0, 300.0)), pane, text, inset); diff --git a/crates/ui-egui/src/panels/detail/info.rs b/crates/ui-egui/src/panels/detail/info.rs index 520ad6213a..da5ae1bed6 100644 --- a/crates/ui-egui/src/panels/detail/info.rs +++ b/crates/ui-egui/src/panels/detail/info.rs @@ -1,5 +1,5 @@ use super::geometry::focus_box; -use super::*; +use super::{Color32, LightcraftApp, PhotoId, Pos2, Rect, Sense, Stroke, Tokens, json, pos2, register, register_geometry, vec2}; /// Draw the camera's focus box over a photo drawn in `img` (View ▸ Focus Point): green corner /// brackets with a dark keyline, the way cameras show their AF frame, never smaller than 14 pt. diff --git a/crates/ui-egui/src/panels/detail/masks.rs b/crates/ui-egui/src/panels/detail/masks.rs index 073de8aa27..50424f6b32 100644 --- a/crates/ui-egui/src/panels/detail/masks.rs +++ b/crates/ui-egui/src/panels/detail/masks.rs @@ -1,5 +1,8 @@ use super::geometry::CanvasMap; -use super::*; +use super::{ + Color32, DevelopSettings, Gesture, LightcraftApp, MaskShape, Point, Pos2, Rect, Sense, Stroke, StrokeKind, Tokens, ToolOverlay, json, pos2, + register, vec2, +}; /// What the user did to a face box this frame. pub(super) enum RegionEdit { diff --git a/crates/ui-egui/src/panels/detail/retouch.rs b/crates/ui-egui/src/panels/detail/retouch.rs index 64f4c22811..d74ead9ba9 100644 --- a/crates/ui-egui/src/panels/detail/retouch.rs +++ b/crates/ui-egui/src/panels/detail/retouch.rs @@ -1,6 +1,6 @@ use super::geometry::CanvasMap; use super::masks::{pin, pins_live}; -use super::*; +use super::{Color32, DevelopSettings, Gesture, LightcraftApp, Point, Pos2, Rect, Stroke, ToolOverlay, json, register, vec2}; // ------------------------------------------------------------------------ remove diff --git a/crates/ui-egui/src/panels/detail/window.rs b/crates/ui-egui/src/panels/detail/window.rs index 0b441913bf..f4ec89c5bf 100644 --- a/crates/ui-egui/src/panels/detail/window.rs +++ b/crates/ui-egui/src/panels/detail/window.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Color32, LightcraftApp, PhotoId, Rect, Slot, pos2, vec2}; /// Whether an overlay can be rendered on a region tile without changing what the tile means. Mask (one or all) /// overlays are evaluated from the same mask alpha as the full render; Point Color range and Visualize diff --git a/crates/ui-egui/src/panels/edit/curve.rs b/crates/ui-egui/src/panels/edit/curve.rs index 856211e66c..0eec3a5e44 100644 --- a/crates/ui-egui/src/panels/edit/curve.rs +++ b/crates/ui-egui/src/panels/edit/curve.rs @@ -1,6 +1,9 @@ use super::histogram::preview_histogram; use super::sliders::control; -use super::*; +use super::{ + Align2, Color32, DevelopSettings, Icon, LightcraftApp, Mesh, PARAM_AMOUNTS, ParametricCurve, PhotoId, Point, Pos2, Rect, RichText, Sense, Stroke, + Tokens, Vertex, controls, hex, json, paint, pos2, register, text_button, vec2, +}; // ------------------------------------------------------------------------------ tone curve diff --git a/crates/ui-egui/src/panels/edit/grading.rs b/crates/ui-egui/src/panels/edit/grading.rs index a0b430acd7..61f154300d 100644 --- a/crates/ui-egui/src/panels/edit/grading.rs +++ b/crates/ui-egui/src/panels/edit/grading.rs @@ -1,5 +1,8 @@ use super::sliders::control; -use super::*; +use super::{ + Align2, Color32, DevelopSettings, Icon, LightcraftApp, Mesh, PhotoId, Pos2, Rect, Sense, Stroke, Tokens, Vertex, json, paint, pos2, register, + vec2, +}; // ------------------------------------------------------------------------------ colour grading diff --git a/crates/ui-egui/src/panels/edit/histogram.rs b/crates/ui-egui/src/panels/edit/histogram.rs index 44d791c4a3..085fbda5d1 100644 --- a/crates/ui-egui/src/panels/edit/histogram.rs +++ b/crates/ui-egui/src/panels/edit/histogram.rs @@ -1,6 +1,9 @@ #[cfg(test)] use super::sliders::reset_tip; -use super::*; +use super::{ + Align2, Color32, Histogram, Icon, LightcraftApp, Mesh, PhotoId, Pos2, Rect, RichText, RightPanel, Sense, Slot, Stroke, Tokens, Vertex, divider, + hex, json, paint, pos2, register, vec2, +}; // ------------------------------------------------------------------------------ histogram diff --git a/crates/ui-egui/src/panels/edit/mixer.rs b/crates/ui-egui/src/panels/edit/mixer.rs index b869b32dd6..0bddba375d 100644 --- a/crates/ui-egui/src/panels/edit/mixer.rs +++ b/crates/ui-egui/src/panels/edit/mixer.rs @@ -1,6 +1,6 @@ use super::curve::set_tat; use super::sliders::{control, sub_title}; -use super::*; +use super::{BAND_COLORS, Color32, DevelopSettings, Icon, LightcraftApp, Sense, Stroke, Tokens, hex, json, paint, register, text_button, vec2}; // ------------------------------------------------------------------------------ colour mixer diff --git a/crates/ui-egui/src/panels/edit/sliders.rs b/crates/ui-egui/src/panels/edit/sliders.rs index aad9cdf6af..00adb9928a 100644 --- a/crates/ui-egui/src/panels/edit/sliders.rs +++ b/crates/ui-egui/src/panels/edit/sliders.rs @@ -1,4 +1,7 @@ -use super::*; +use super::{ + Align2, ControlSpec, DevelopSettings, Icon, LightcraftApp, PhotoId, Section, Sense, SliderOut, Tokens, Track, Value, controls, divider, json, + pos2, register, section_header, slider, vec2, +}; /// Commit a slider interaction: begin → live updates → end, so a drag is one undo step. pub fn apply_slider_out( diff --git a/crates/ui-egui/src/panels/left/albums.rs b/crates/ui-egui/src/panels/left/albums.rs index e0204c826c..bfcc6a219d 100644 --- a/crates/ui-egui/src/panels/left/albums.rs +++ b/crates/ui-egui/src/panels/left/albums.rs @@ -1,6 +1,6 @@ use super::folders::{folder_menu, is_within}; use super::rows::{INDENT_STEP, indent_x, row_sensed, set_tree_open, tree_open, tree_toggle}; -use super::*; +use super::{Album, AlbumId, Align2, Icon, LibrarySource, LightcraftApp, Rect, Sense, Tokens, json, pos2, register, vec2}; /// Albums: the tree of albums and the folders they are sorted into. `reveal`: an album just made, /// whose folders open down to it. diff --git a/crates/ui-egui/src/panels/left/dates.rs b/crates/ui-egui/src/panels/left/dates.rs index 49d8cf8988..9b822c6e55 100644 --- a/crates/ui-egui/src/panels/left/dates.rs +++ b/crates/ui-egui/src/panels/left/dates.rs @@ -1,5 +1,5 @@ use super::rows::{INDENT_STEP, row, tree_open, tree_toggle}; -use super::*; +use super::{Icon, LibrarySource, LightcraftApp, json}; /// By Date: year → month → day; a click filters by that prefix, the triangle opens a level. pub(super) fn date_rows(app: &mut LightcraftApp, ui: &mut egui::Ui) { diff --git a/crates/ui-egui/src/panels/left/folders.rs b/crates/ui-egui/src/panels/left/folders.rs index 95915b7407..1ded12f072 100644 --- a/crates/ui-egui/src/panels/left/folders.rs +++ b/crates/ui-egui/src/panels/left/folders.rs @@ -1,7 +1,7 @@ use super::albums::pointer_over_row; use super::local::{same_folder, subfolders}; use super::rows::{INDENT_STEP, LIBFOLDER_REVEALED, out_of_sight, row, row_sensed, set_tree_open, tree_open, tree_toggle}; -use super::*; +use super::{Album, FolderNode, Icon, LibrarySource, LightcraftApp, Sense, Tokens, json, register, vec2}; /// A folder on disk with a disclosure triangle: click browses it, the triangle lists its /// subfolders. In the tree that holds the folder being browsed (`reveal`), the folders on the diff --git a/crates/ui-egui/src/panels/left/keywords.rs b/crates/ui-egui/src/panels/left/keywords.rs index 81997f2e2a..4342efcc6b 100644 --- a/crates/ui-egui/src/panels/left/keywords.rs +++ b/crates/ui-egui/src/panels/left/keywords.rs @@ -1,6 +1,6 @@ use super::dates::browse_all_photos; use super::rows::{INDENT_STEP, out_of_sight, row, tree_open, tree_toggle}; -use super::*; +use super::{Icon, KeywordNode, LightcraftApp, json}; /// "Keywords": the library's keyword tree with photo counts (`a|b|c` keywords nest). A click /// filters the grid by the keyword (children included), the triangle opens a level, and the diff --git a/crates/ui-egui/src/panels/left/local.rs b/crates/ui-egui/src/panels/left/local.rs index e1a62d8ea2..6d35495701 100644 --- a/crates/ui-egui/src/panels/left/local.rs +++ b/crates/ui-egui/src/panels/left/local.rs @@ -1,6 +1,6 @@ use super::folders::folder_tree; use super::rows::row; -use super::*; +use super::{Icon, LibrarySource, LightcraftApp, SidebarSection, json, register}; /// Local's folders as they stand this frame, and the folder being browsed among them. pub(super) struct LocalNow { diff --git a/crates/ui-egui/src/panels/left/rows.rs b/crates/ui-egui/src/panels/left/rows.rs index 541d98b061..edfdff167d 100644 --- a/crates/ui-egui/src/panels/left/rows.rs +++ b/crates/ui-egui/src/panels/left/rows.rs @@ -1,5 +1,5 @@ use super::albums::MARK_W; -use super::*; +use super::{Align2, Icon, LightcraftApp, Rect, Sense, Tokens, paint, pos2, register, vec2}; /// How wide the sidebar's content needs to be, from the widest row of the last frame: rows are /// drawn at this width (or the panel's, if wider), and the sidebar scrolls sideways when it diff --git a/crates/ui-egui/src/panels/left/sections.rs b/crates/ui-egui/src/panels/left/sections.rs index 42cc631b51..5597904a88 100644 --- a/crates/ui-egui/src/panels/left/sections.rs +++ b/crates/ui-egui/src/panels/left/sections.rs @@ -1,6 +1,6 @@ use super::albums::top_level_drop_target; use super::rows::{ROW_HEIGHT, note_width}; -use super::*; +use super::{Align2, Icon, LightcraftApp, Rect, Sense, SidebarSection, Tokens, icon_button, json, paint, pos2, register, vec2}; /// Space above a section's header. pub(super) const SECTION_GAP: f32 = 10.0; diff --git a/crates/ui-egui/src/panels/right/crop.rs b/crates/ui-egui/src/panels/right/crop.rs index 67efd91f62..0b71fffe8a 100644 --- a/crates/ui-egui/src/panels/right/crop.rs +++ b/crates/ui-egui/src/panels/right/crop.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{LightcraftApp, PhotoId, Tokens, divider, header, json, padded, register, slider, text_button}; /// The aspect presets of the Crop panel: (menu label, `crop.aspect` value). const ASPECT_PRESETS: [(&str, &str); 10] = [ diff --git a/crates/ui-egui/src/panels/right/history.rs b/crates/ui-egui/src/panels/right/history.rs index 49229783bf..d434075adc 100644 --- a/crates/ui-egui/src/panels/right/history.rs +++ b/crates/ui-egui/src/panels/right/history.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Align2, Icon, LightcraftApp, PhotoId, Rect, Sense, Tokens, header, json, padded, paint, pos2, register, text_button, vec2}; pub(super) fn versions(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { let Some(p) = app.session.catalog.photo(id).cloned() else { return }; diff --git a/crates/ui-egui/src/panels/right/info.rs b/crates/ui-egui/src/panels/right/info.rs index 4d7c198a00..5810a0f272 100644 --- a/crates/ui-egui/src/panels/right/info.rs +++ b/crates/ui-egui/src/panels/right/info.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Icon, LightcraftApp, PhotoId, Sense, Tokens, divider, header, json, padded, register, text_button, vec2}; pub(super) fn info(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { let Some(p) = app.session.catalog.photo(id).cloned() else { return }; diff --git a/crates/ui-egui/src/panels/right/keywords.rs b/crates/ui-egui/src/panels/right/keywords.rs index 6d7d5868ba..b6598476ac 100644 --- a/crates/ui-egui/src/panels/right/keywords.rs +++ b/crates/ui-egui/src/panels/right/keywords.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{HOLD, LightcraftApp, PhotoId, Rect, Tokens, fold_header, json, padded, register, text_button, vec2}; pub(super) fn keywords(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { // (the box is the selection's: the active photo only says that there is one) diff --git a/crates/ui-egui/src/services.rs b/crates/ui-egui/src/services.rs index 8eb13aa85e..cc08022484 100644 --- a/crates/ui-egui/src/services.rs +++ b/crates/ui-egui/src/services.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Session, Value, pick}; pub type PickFiles = Box Vec>; diff --git a/crates/ui-egui/src/state/dialog.rs b/crates/ui-egui/src/state/dialog.rs index edc4946cd3..7f9226b6e4 100644 --- a/crates/ui-egui/src/state/dialog.rs +++ b/crates/ui-egui/src/state/dialog.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Deserialize, Serialize}; /// Settings group ids (`SettingsGroup` serde names) a new preset includes by default: everything /// but crop, masks, spots and red eye. diff --git a/crates/ui-egui/src/state/settings.rs b/crates/ui-egui/src/state/settings.rs index 2d748f5a75..fff943b4cf 100644 --- a/crates/ui-egui/src/state/settings.rs +++ b/crates/ui-egui/src/state/settings.rs @@ -1,7 +1,7 @@ use super::view::LoupeInfo; #[cfg(test)] use super::view::{InfoOverlay, LoupeInfoField}; -use super::*; +use super::{Deserialize, Serialize}; /// Which view the app opens in. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] diff --git a/crates/ui-egui/src/state/view.rs b/crates/ui-egui/src/state/view.rs index 1bbfd43495..6110026475 100644 --- a/crates/ui-egui/src/state/view.rs +++ b/crates/ui-egui/src/state/view.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{Deserialize, Serialize}; #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] From 71bf82f7bba0aa6399e8cde4b924ce5163ecbd30 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 20:08:31 +0000 Subject: [PATCH 64/93] refactor(ui-egui): split run_ui_command into parts and per-command functions --- crates/ui-egui/src/menus/run.rs | 1512 +++++++++++++++++-------------- 1 file changed, 827 insertions(+), 685 deletions(-) diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index 9977affacf..52e6006ebd 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -168,6 +168,25 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option Option>; 12] = [ + ui_commands_1, + ui_commands_2, + ui_commands_3, + ui_commands_4, + ui_commands_5, + ui_commands_6, + ui_commands_7, + ui_commands_8, + ui_commands_9, + ui_commands_10, + ui_commands_11, + ui_commands_12, + ]; + PARTS.iter().find_map(|part| part(app, &ctx, id, p)) +} + +/// Part 1 of 12 of the UI commands; `None` means the id is not one of this part's. +fn ui_commands_1(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Option> { let r: Result = match id { "view.photoGrid" => { app.ui.view = ViewMode::PhotoGrid; @@ -203,7 +222,7 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option Option return None, + }; + Some(r) +} + +/// Part 2 of 12 of the UI commands; `None` means the id is not one of this part's. +fn ui_commands_2(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Option> { + let r: Result = match id { "view.detail" => { app.ui.view = ViewMode::Detail; Ok(Value::Null) @@ -369,47 +396,16 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option crate::panels::compare::make_select(app), "view.autoAdvance" => { app.ui.auto_advance = !app.ui.auto_advance; - app.toast(&ctx, crate::i18n::tr(if app.ui.auto_advance { "Auto Advance On" } else { "Auto Advance Off" })); + app.toast(ctx, crate::i18n::tr(if app.ui.auto_advance { "Auto Advance On" } else { "Auto Advance Off" })); Ok(json!({"autoAdvance": app.ui.auto_advance})) } - "view.back" => { - if app.ui.dialog.is_some() { - app.ui.dialog = None; - } else if app.ui.lights_out != crate::state::LightsOut::On { - app.ui.lights_out = crate::state::LightsOut::On; - } else if app.ui.keyword_painter.is_some() { - app.ui.keyword_painter = None; - } else if app.ui.fullscreen { - // Through `slideshow::end`: it also releases the held slide textures. Clearing the - // two fields directly left every rendered slide in the renderer. - crate::panels::slideshow::end(app); - } else if !app.ui.tool.is_empty() { - app.ui.tool.clear(); - } else if app.ui.right == RightPanel::Crop && app.ui.view == ViewMode::Detail { - // Esc leaves the crop tool (the crop stays), as C does; the next Esc goes back - panel(app, &ctx, RightPanel::Crop, "Crop, Rotate, Geometry"); - } else if app.ui.view == ViewMode::People && app.ui.person_page.is_some() { - app.ui.person_page = None; - } else if matches!(app.ui.view, ViewMode::Compare | ViewMode::Survey | ViewMode::Reference) { - app.ui.view = ViewMode::Detail; - } else if app.ui.view == ViewMode::Detail { - // a photo opened from a person's page (or the unnamed faces) goes back there, any other to the grid - match app.ui.person_from.take() { - Some((name, photo)) if app.session.active().is_some_and(|a| a.0 == photo) => { - app.ui.view = ViewMode::People; - app.ui.person_page = name; - } - _ => app.ui.view = ViewMode::PhotoGrid, - } - } - Ok(Value::Null) - } + "view.back" => view_back_command(app, ctx), "view.slideshow" => { // the photos in view, full screen, with the playback settings (see panels::slideshow) let now = app.tick_now(); let r = crate::panels::slideshow::start(app, p, now); if r.is_ok() { - app.toast(&ctx, crate::i18n::tr("Slideshow · Space pauses · Esc ends")); + app.toast(ctx, crate::i18n::tr("Slideshow · Space pauses · Esc ends")); } r } @@ -417,6 +413,14 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option return None, + }; + Some(r) +} + +/// Part 3 of 12 of the UI commands; `None` means the id is not one of this part's. +fn ui_commands_3(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Option> { + let r: Result = match id { "view.slideshowOptions" => { app.ui.dialog = Some(Dialog::Settings { tab: "slideshow".into() }); Ok(Value::Null) @@ -464,51 +468,10 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option "Info Overlay: File", crate::state::InfoOverlay::Exposure => "Info Overlay: Exposure", }; - app.toast(&ctx, crate::i18n::tr(label)); + app.toast(ctx, crate::i18n::tr(label)); Ok(json!({"infoOverlay": app.ui.info_overlay})) } - "view.viewOptions" => { - // `info1` / `info2` set the lines, `briefly` the Info that Show Briefly When Photo Changes - // shows and `loupeMessages` Show message when loading or rendering photos, for an agent; - // without any of them the window opens - let mut info = app.ui.settings.loupe_info; - let mut set = false; - // `loupeMessages` sets Show message when loading or rendering photos - let messages = match p.get("loupeMessages") { - None => app.ui.settings.loupe_messages, - Some(v) => match v.as_bool() { - Some(on) => { - set = true; - on - } - None => return Some(Err("`loupeMessages`: true|false".into())), - }, - }; - for (key, lines) in [("info1", &mut info.info1), ("info2", &mut info.info2)] { - let Some(v) = p.get(key) else { continue }; - match serde_json::from_value(v.clone()) { - Ok(v) => *lines = v, - Err(_) => { - return Some(Err(format!("`{key}`: three of none|fileName|captureDate|dimensions|exposure|camera|lens|cameraAndLens"))); - } - } - set = true; - } - if let Some(v) = p.get("briefly") { - match serde_json::from_value(v.clone()) { - Ok(v) => info.briefly = v, - Err(_) => return Some(Err("`briefly`: off|basic|exposure (neither, Info 1 or Info 2)".into())), - } - set = true; - } - if set { - app.ui.settings.loupe_info = info; - app.ui.settings.loupe_messages = messages; - } else { - app.ui.dialog = Some(Dialog::ViewOptions); - } - Ok(json!({"loupeInfo": app.ui.settings.loupe_info, "loupeMessages": app.ui.settings.loupe_messages})) - } + "view.viewOptions" => view_view_options_command(app, p), "view.chooseLayoutImage" => { let path = match p.get("path").and_then(Value::as_str) { Some(path) => path.trim().to_string(), @@ -531,7 +494,7 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option { @@ -541,7 +504,7 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option { @@ -561,6 +524,14 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option return None, + }; + Some(r) +} + +/// Part 4 of 12 of the UI commands; `None` means the id is not one of this part's. +fn ui_commands_4(app: &mut LightcraftApp, _ctx: &egui::Context, id: &str, p: &Value) -> Option> { + let r: Result = match id { "app.settings" => { let tab = p.get("tab").and_then(Value::as_str).unwrap_or("general"); if !crate::panels::settings::TABS.iter().any(|(id, _)| *id == tab) { @@ -665,6 +636,14 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option return None, + }; + Some(r) +} + +/// Part 5 of 12 of the UI commands; `None` means the id is not one of this part's. +fn ui_commands_5(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Option> { + let r: Result = match id { "view.clickZoom" => { // {ratio?: 1|2|3|4|8} → {ratio} if let Some(r) = p.get("ratio").and_then(Value::as_f64) { @@ -733,67 +712,7 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option { - // {on?, space?, profile?: ICC path | null, intent?: perceptual|relative, paperInk?, - // destWarning?, displayWarning?}; no params toggles - let has = |k: &str| p.get(k).is_some(); - if let Some(s) = p.get("space").and_then(Value::as_str) { - match lightcraft_engine::pipeline::OutputSpace::parse(s) { - Some(sp) => { - app.ui.proof.space = sp; - // a standard space replaces a device profile (unless one is given too) - app.ui.proof_profile = None; - } - None => return Some(Err(format!("view.softProof: unknown space {s:?} (srgb|displayP3|adobeRgb|proPhoto|rec2020)"))), - } - } - if let Some(i) = p.get("intent") { - match i.as_str().and_then(lightcraft_engine::proof::ProofIntent::parse) { - Some(i) => app.ui.proof_intent = i, - None => return Some(Err("view.softProof: intent must be perceptual or relative".into())), - } - } - if let Some(b) = p.get("paperInk").and_then(Value::as_bool) { - app.ui.proof_paper_ink = b; - } - let path = match p.get("profile") { - Some(Value::String(s)) => Some(s.clone()), - Some(Value::Null) => { - app.ui.proof_profile = None; - None - } - Some(_) => return Some(Err("view.softProof: profile must be an ICC file path or null".into())), - None => app.ui.proof_profile.as_ref().map(|(f, _)| f.clone()), - }; - match path { - Some(path) => match lightcraft_engine::proof::load(&path, app.ui.proof_intent, app.ui.proof_paper_ink) { - Ok(pp) => { - app.ui.proof.profile = pp.id; - app.ui.proof_profile = Some((path, pp.name)); - } - Err(e) => return Some(Err(format!("view.softProof: {e}"))), - }, - None => app.ui.proof.profile = 0, - } - if let Some(b) = p.get("destWarning").and_then(Value::as_bool) { - app.ui.proof.dest_warning = b; - } - if let Some(b) = p.get("displayWarning").and_then(Value::as_bool) { - app.ui.proof.display_warning = b; - } - app.ui.soft_proof = match p.get("on").and_then(Value::as_bool) { - Some(b) => b, - None if ["space", "destWarning", "displayWarning", "profile", "intent", "paperInk"].iter().any(|k| has(k)) => app.ui.soft_proof, - None => !app.ui.soft_proof, - }; - if app.ui.soft_proof && !matches!(app.ui.view, ViewMode::Detail | ViewMode::Reference) { - app.ui.view = ViewMode::Detail; - } - let pr = app.ui.proof; - let profile = app.ui.proof_profile.as_ref().map(|(f, n)| json!({"path": f, "name": n})); - Ok(json!({"on": app.ui.soft_proof, "space": pr.space, "profile": profile, "intent": app.ui.proof_intent.name(), - "paperInk": app.ui.proof_paper_ink, "destWarning": pr.dest_warning, "displayWarning": pr.display_warning})) - } + "view.softProof" => view_soft_proof_command(app, id, p), "view.histogram" => { app.ui.histogram = !app.ui.histogram; Ok(Value::Null) @@ -821,9 +740,17 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option return None, + }; + Some(r) +} + +/// Part 6 of 12 of the UI commands; `None` means the id is not one of this part's. +fn ui_commands_6(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Option> { + let r: Result = match id { "view.maskOverlayColor" => { // no params: the next of the panel's swatch colours if p.get("color").is_none() && p.get("opacity").is_none() { @@ -876,7 +803,7 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option { @@ -932,6 +859,14 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option Err("local.hide needs a path".into()), }, + _ => return None, + }; + Some(r) +} + +/// Part 7 of 12 of the UI commands; `None` means the id is not one of this part's. +fn ui_commands_7(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Option> { + let r: Result = match id { "local.restoreHidden" => { // one path, or (no path) every hidden location match p.get("path").and_then(Value::as_str) { @@ -952,7 +887,7 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option { - panel(app, &ctx, RightPanel::Edit, "Edit"); + panel(app, ctx, RightPanel::Edit, "Edit"); Ok(Value::Null) } "panel.profiles" => { @@ -968,47 +903,47 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option { - panel(app, &ctx, RightPanel::Crop, "Crop, Rotate, Geometry"); + panel(app, ctx, RightPanel::Crop, "Crop, Rotate, Geometry"); Ok(Value::Null) } "panel.remove" => { - panel(app, &ctx, RightPanel::Remove, "Remove"); + panel(app, ctx, RightPanel::Remove, "Remove"); if app.ui.right == RightPanel::Remove && app.ui.tool.is_empty() { app.ui.tool = "remove".into(); } Ok(Value::Null) } "panel.masking" => { - panel(app, &ctx, RightPanel::Masking, "Masking"); + panel(app, ctx, RightPanel::Masking, "Masking"); Ok(Value::Null) } "panel.redeye" => { - panel(app, &ctx, RightPanel::RedEye, "Red Eye"); + panel(app, ctx, RightPanel::RedEye, "Red Eye"); Ok(Value::Null) } "panel.info" => { - panel(app, &ctx, RightPanel::Info, "Info"); + panel(app, ctx, RightPanel::Info, "Info"); Ok(Value::Null) } "panel.keywords" => { - panel(app, &ctx, RightPanel::Keywords, "Keywords"); + panel(app, ctx, RightPanel::Keywords, "Keywords"); Ok(Value::Null) } "panel.addKeywords" => { // opens Keywording when it is folded shut; the panel stays open when pressed again if app.ui.right != RightPanel::Keywords { - panel(app, &ctx, RightPanel::Keywords, "Keywords"); + panel(app, ctx, RightPanel::Keywords, "Keywords"); } app.ui.folded_sections.retain(|s| s != "keywording"); app.ui.focus_keywords = Some(ctx.cumulative_pass_nr()); Ok(Value::Null) } "panel.versions" => { - panel(app, &ctx, RightPanel::Versions, "Versions"); + panel(app, ctx, RightPanel::Versions, "Versions"); Ok(Value::Null) } "panel.activity" => { - panel(app, &ctx, RightPanel::Activity, "History"); + panel(app, ctx, RightPanel::Activity, "History"); Ok(Value::Null) } "panel.presets" => { @@ -1033,6 +968,14 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option return None, + }; + Some(r) +} + +/// Part 8 of 12 of the UI commands; `None` means the id is not one of this part's. +fn ui_commands_8(app: &mut LightcraftApp, _ctx: &egui::Context, id: &str, p: &Value) -> Option> { + let r: Result = match id { s if s.starts_with("section.") => bool_param(s, p, "solo").and_then(|solo| { // only the Edit sections listed above: an unknown one would close the real ones if !UI_COMMANDS.iter().any(|c| c.0 == s) { @@ -1133,41 +1076,19 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option { - // {id?}: edit that smart album's rules; without: a new one starting at Rating ≥ 3 - let album = p - .get("id") - .and_then(Value::as_u64) - .and_then(|id| app.session.catalog.album(lightcraft_catalog::AlbumId(id)).filter(|a| a.is_smart()).cloned()); - app.ui.dialog = Some(match album { - Some(a) => Dialog::SmartRules { - id: Some(a.id.0), - name: a.name.clone(), - // older rules read as they always matched (RuleSet::upgrade) - rules: a - .smart - .as_ref() - .and_then(|f| f.rule_set.clone()) - .map(|mut r| { - r.upgrade(); - r - }) - .unwrap_or_default(), - parent: None, - }, - None => Dialog::SmartRules { - id: None, - name: p.get("name").and_then(Value::as_str).unwrap_or("").into(), - rules: lightcraft_catalog::RuleSet { rules: vec![crate::panels::rules_editor::new_rule()], ..Default::default() }, - parent: parent_param(p), - }, - }); - Ok(Value::Null) - } + "dialog.smartAlbum" => dialog_smart_album_command(app, id, p), "dialog.newSmartAlbum" => { app.ui.dialog = Some(Dialog::NewSmartAlbum { name: p.get("name").and_then(Value::as_str).unwrap_or("").into(), parent: parent_param(p) }); Ok(Value::Null) } + _ => return None, + }; + Some(r) +} + +/// Part 9 of 12 of the UI commands; `None` means the id is not one of this part's. +fn ui_commands_9(app: &mut LightcraftApp, _ctx: &egui::Context, id: &str, p: &Value) -> Option> { + let r: Result = match id { "dialog.captureTime" => { // a time that doesn't fully read isn't offered as the starting point (`10:0` would read as midnight) let time = app @@ -1268,6 +1189,14 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option return None, + }; + Some(r) +} + +/// Part 10 of 12 of the UI commands; `None` means the id is not one of this part's. +fn ui_commands_10(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Option> { + let r: Result = match id { "dialog.export" => { let prev = app.session.last_export.clone().unwrap_or_default(); let u = |k: &str, d: u64| prev.get(k).and_then(Value::as_u64).unwrap_or(d); @@ -1303,9 +1232,9 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option crate::updates_ui::check(app), - "photo.editInPhotoCraft" => edit_in(app, &ctx, p, true), - "photo.editInExternal" => edit_in(app, &ctx, p, false), - "photo.openOriginalInExternal" => open_original_in(app, &ctx, p), + "photo.editInPhotoCraft" => edit_in(app, ctx, p, true), + "photo.editInExternal" => edit_in(app, ctx, p, false), + "photo.openOriginalInExternal" => open_original_in(app, ctx, p), "dialog.cull" => { let (burst_gap, similarity) = app.ui.cull_burst.unwrap_or((10.0, 0.93)); app.ui.dialog = Some(Dialog::Cull { reject_below: 0.0, pick_best: true, burst_gap, similarity }); @@ -1315,51 +1244,7 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option { - let info = app.session.execute("library.info", &json!({})).unwrap_or_default(); - let gpu = (lightcraft_engine::gpu::ready() && lightcraft_engine::gpu::available()).then(lightcraft_engine::gpu::adapter_name).flatten(); - let mb = |b: u64| format!("{:.0} MB", b as f64 / (1u64 << 20) as f64); - let mut rows = vec![ - ("Version".to_string(), env!("CARGO_PKG_VERSION").to_string()), - ("System".to_string(), format!("{} ({})", std::env::consts::OS, std::env::consts::ARCH)), - ("CPU threads".to_string(), std::thread::available_parallelism().map(|n| n.get().to_string()).unwrap_or_else(|_| "?".into())), - ( - "GPU".to_string(), - gpu.unwrap_or_else(|| match lightcraft_engine::gpu::unavailable_reason() { - Some(why) => crate::i18n::tr_format!("none (CPU rendering): {why}", why = why), - None => "none (CPU rendering)".into(), - }), - ), - ("GPU rendering".to_string(), if app.ui.settings.gpu { "on".into() } else { "off".into() }), - ("Memory budget".to_string(), mb(lightcraft_engine::memory::default_budget() as u64)), - ( - "Preview size".to_string(), - match app.ui.settings.preview_limit { - 0 => "automatic".to_string(), - n => format!("{n} px"), - }, - ), - ("Photos".to_string(), info["photos"].to_string()), - ("Albums".to_string(), info["albums"].to_string()), - ]; - if let Some(dir) = info["dir"].as_str().or(info["path"].as_str()) { - rows.push(("Library".into(), dir.to_string())); - } - rows.push(("Frame time".into(), format!("{:.1} ms ({:.0} fps)", app.perf.frame_ms, app.perf.fps))); - rows.push(( - "Frame update".into(), - format!("{:.1} ms (logic {:.1} ms; slowest {:.0} ms)", app.perf.update_ms, app.perf.logic_ms, app.perf.max_update_ms), - )); - rows.push(("Last loupe render".into(), format!("{:.0} ms", app.renderer.last_main_ms))); - if let Some(f) = lightcraft_engine::gpu::last_fallback() { - rows.push(("Last GPU fallback".into(), f)); - } - let r = json!(rows.iter().map(|(k, v)| json!({"label": k, "value": v})).collect::>()); - if p.get("open").and_then(Value::as_bool).unwrap_or(true) { - app.ui.dialog = Some(Dialog::SystemInfo { rows }); - } - Ok(r) - } + "app.systemInfo" => app_system_info_command(app, p), "app.shortcuts" => { app.ui.dialog = Some(Dialog::Shortcuts); Ok(Value::Null) @@ -1420,6 +1305,14 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option Ok(Value::Null), } } + _ => return None, + }; + Some(r) +} + +/// Part 11 of 12 of the UI commands; `None` means the id is not one of this part's. +fn ui_commands_11(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Option> { + let r: Result = match id { "app.quit" => { app.ui.quit = true; Ok(Value::Null) @@ -1429,162 +1322,8 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option { - let within = match p.get("within") { - None | Some(Value::Null) => None, - Some(Value::String(path)) if !path.is_empty() => Some(path.clone()), - Some(Value::String(_)) => return Some(Err("file.findMissing: `within` must not be empty".into())), - Some(value) => return Some(Err(format!("file.findMissing: `within` must be a folder path, not {value}"))), - }; - let wait = p.get("wait").and_then(Value::as_bool).unwrap_or(false); - let timeout = match p.get("timeout") { - None | Some(Value::Null) => std::time::Duration::from_secs(600), - Some(Value::Number(n)) => { - if let Some(s) = n.as_f64() { - if s.is_finite() && s >= 0.0 { - match std::time::Duration::try_from_secs_f64(s) { - Ok(d) => d, - Err(_) => return Some(Err("file.findMissing: `timeout` is too large".into())), - } - } else { - return Some(Err("file.findMissing: `timeout` must be a non-negative number of seconds".into())); - } - } else { - return Some(Err("file.findMissing: `timeout` must be a number of seconds".into())); - } - } - Some(other) => return Some(Err(format!("file.findMissing: `timeout` must be a number of seconds, not {other}"))), - }; - let title = if within.is_some() { "Locate Missing Files…" } else { "Find Missing Photos…" }; - let folder = match p.get("folder").and_then(Value::as_str) { - Some(f) => Some(f.to_string()), - None => match crate::pick::ask(app, id, p, "folder", PickRequest::folder(crate::i18n::tr(title)), |s| { - s.pick_folder.as_mut().and_then(|f| f()).map(|x| vec![x]) - }) { - Picked::Now(v) => v.into_iter().next(), - Picked::Later | Picked::Unavailable => None, - }, - }; - let Some(folder) = folder else { return Some(Ok(Value::Null)) }; - // the search (checking every photo's file, walking the folder) runs on a worker thread; - // the relinking happens back here, as one undo step - const LABEL: &str = "Find Missing Photos"; - if app.tasks.is_running(LABEL) { - return Some(Err("Find Missing Photos is already searching".into())); - } - let mut candidates = lightcraft_engine::cmd::missing::find_candidates(&app.session.catalog); - if let Some(within) = within { - candidates.retain(|candidate| lightcraft_catalog::query::folder_within(&candidate.path, &within)); - } - #[cfg(test)] - let test_delay = app.ui.find_missing_test_delay; - let work = move || { - #[cfg(test)] - if let Some(d) = test_delay { - std::thread::sleep(d); - } - lightcraft_engine::cmd::missing::plan_find_missing(&candidates, &folder) - }; - let done = |app: &mut LightcraftApp, ctx: &egui::Context, plan: Result| { - // relinked under the session as it is now: photos relinked meanwhile and files - // now in use are skipped - let r = plan.and_then(|plan| app.run("library.findMissing", plan.to_json())); - match r { - Ok(v) => { - let n = v["found"].as_array().map_or(0, Vec::len); - let left = v["missing"].as_u64().unwrap_or(0); - let unsure = v["ambiguous"].as_array().map_or(0, Vec::len); - let unsure = if unsure > 0 { - crate::i18n::tr_format!(" ({unsure} with several look-alike files: use Locate)", unsure = unsure) - } else { - String::new() - }; - app.toast( - ctx, - crate::i18n::tr_format!( - "Found {n} missing photo{}; {left} still missing{unsure}", - if n == 1 { "" } else { "s" }, - left = left, - n = n, - unsure = unsure - ), - ); - app.ui.last_find_missing = Some(v.clone()); - app.ui.last_find_missing_result = Some(Ok(v)); - } - Err(e) => { - app.toast(ctx, e.clone()); - app.ui.last_find_missing_result = Some(Err(e)); - } - } - }; - app.ui.last_find_missing = None; - app.ui.last_find_missing_result = None; - if let Err(e) = crate::tasks::spawn(app, LABEL, Some("findMissing"), work, done) { - return Some(Err(e)); - } - if wait { - let ctx = app.tasks.repaint.clone().unwrap_or_default(); - let completed = crate::tasks::wait_for(app, &ctx, LABEL, timeout); - if !completed { - return Some(Err("Find Missing Photos: search timed out (search continues in the background)".into())); - } - return match app.ui.last_find_missing_result.take() { - Some(Ok(v)) => Some(Ok(v)), - Some(Err(e)) => Some(Err(e)), - None => Some(Err("Find Missing Photos: worker terminated unexpectedly".into())), - }; - } - Ok(json!({"background": true})) - } - "photo.tagFromTracklog" => { - // a GPX file → GPS for the selected photos by capture time (one undo step) - let path = match p.get("path").and_then(Value::as_str) { - Some(x) => Some(x.to_string()), - None => { - let req = PickRequest::file(crate::i18n::tr("Auto-Tag from Tracklog"), crate::i18n::tr("GPS Track Log"), &["gpx"]); - match crate::pick::ask(app, id, p, "path", req, |s| s.pick_tracklog.as_mut().map(|f| f())) { - Picked::Now(v) => v.into_iter().next(), - Picked::Later | Picked::Unavailable => None, - } - } - }; - let Some(path) = path else { return Some(Ok(Value::Null)) }; - let mut params = p.as_object().cloned().unwrap_or_default(); - params.insert("path".into(), json!(path)); - let ask_zone = !params.contains_key("offset"); - let params = Value::Object(params); - if ask_zone { - // GPX times are UTC, camera clocks are local: ask for the camera's zone, then come back here - crate::panels::dialogs::prompt( - app, - "Auto-Tag from Tracklog", - "Camera time zone, e.g. -07:00 (empty: UTC)", - "", - "photo.tagFromTracklog", - params, - "offset", - ); - return Some(Ok(Value::Null)); - } - let r = app.run("photo.autoTagTracklog", params); - if let Ok(v) = &r { - let n = v["tagged"].as_u64().unwrap_or(0); - let sk = &v["skipped"]; - let mut msg = crate::i18n::tr_format!("Tagged {n} photo{} from the tracklog", if n == 1 { "" } else { "s" }, n = n); - let outside = sk["outside"].as_u64().unwrap_or(0); - if outside > 0 { - msg += &crate::i18n::tr_format!("; {outside} outside its time range", outside = outside); - } - let kept = sk["hasGps"].as_u64().unwrap_or(0); - if kept > 0 { - msg += &crate::i18n::tr_format!("; {kept} already had a location", kept = kept); - } - let ctx = app.tasks.repaint.clone().unwrap_or_default(); - app.toast(&ctx, msg); - } - r - } + "file.findMissing" => file_find_missing_command(app, id, p), + "photo.tagFromTracklog" => photo_tag_from_tracklog_command(app, ctx, id, p), "photo.locate" => { let Some(id) = app.session.active() else { return Some(Err("no photo selected".into())) }; let path = match p.get("path").and_then(Value::as_str) { @@ -1640,208 +1379,9 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option Ok(Value::Null), } } - "file.importPresets" => { - let paths = match p.get("paths").and_then(Value::as_array) { - Some(a) => a.iter().filter_map(Value::as_str).map(str::to_string).collect(), - None => { - let req = PickRequest::files( - Some(crate::i18n::tr("Import Presets").into()), - crate::i18n::tr("Presets & Profiles"), - crate::pick::PRESET_EXTENSIONS, - ); - match crate::pick::ask(app, id, p, "paths", req, |s| s.pick_preset_files.as_mut().map(|f| f())) { - Picked::Now(paths) => paths, - Picked::Later => return Some(Ok(Value::Null)), - Picked::Unavailable => return Some(Err("no file dialog on this platform".into())), - } - } - }; - if paths.is_empty() { - return Some(Ok(Value::Null)); - } - // .cube LUTs (and those inside zips / folders) become profiles - let lut_paths: Vec<&String> = paths - .iter() - .filter(|p| { - let l = p.to_ascii_lowercase(); - l.ends_with(".cube") || l.ends_with(".zip") || std::path::Path::new(p.as_str()).is_dir() - }) - .collect(); - // one toast for both halves (a second toast would replace the first) - let mut parts: Vec = Vec::new(); - // `name: reason` for each file that couldn't be imported - let mut problems: Vec = Vec::new(); - let mut profiles_result = Value::Null; - if !lut_paths.is_empty() { - match app.session.execute("profile.import", &json!({"paths": lut_paths})) { - Ok(v) => { - let profiles = v["imported"].as_array().map_or(0, Vec::len); - if profiles > 0 { - parts.push(crate::i18n::tr_format!( - "Imported {profiles} profile{} (Profile browser ▸ their groups)", - if profiles == 1 { "" } else { "s" }, - profiles = profiles - )); - } - problems.extend(v["failed"].as_array().into_iter().flatten().map(|f| { - let name = f.get(0).and_then(Value::as_str).unwrap_or_default(); - let reason = f.get(1).and_then(Value::as_str).unwrap_or_default(); - format!("{name}: {reason}") - })); - profiles_result = v; - } - Err(e) => { - problems.push(e.to_string()); - profiles_result = json!({"error": e.to_string()}); - } - } - } - let preset_paths: Vec<&String> = paths.iter().filter(|p| !p.to_ascii_lowercase().ends_with(".cube")).collect(); - let r = if preset_paths.is_empty() { - Ok(json!({"imported": [], "failed": [], "skipped": 0})) - } else { - app.session.execute("preset.import", &json!({"paths": preset_paths})).map_err(|e| e.to_string()) - }; - if let (false, Ok(v)) = (preset_paths.is_empty(), &r) { - let n = v["imported"].as_array().map_or(0, Vec::len); - let failed = v["failed"].as_array().map_or(0, Vec::len); - // Lightroom local adjustment presets land in the Masking panel's Effect menu: part of the same toast - let effects = v["effects"].as_array().map_or(0, Vec::len); - if effects > 0 { - parts.push(crate::panels::mask_effects::import_toast(v)); - } - let profile_news = !parts.is_empty() || !problems.is_empty(); - let msg = match (n, failed) { - // a zip of LUTs (or only local presets): the other half already says what happened - (0, 0) if profile_news => None, - (0, 0) => Some("No new presets".to_string()), - (n, 0) => Some(crate::i18n::tr_format!("Imported {n} preset{}", if n == 1 { "" } else { "s" }, n = n)), - (n, f) => Some(crate::i18n::tr_format!( - "Imported {n} preset{}, {f} file{} not readable", - if n == 1 { "" } else { "s" }, - if f == 1 { "" } else { "s" }, - f = f, - n = n - )), - }; - if let Some(mut msg) = msg { - // settings with no counterpart here (the other editor's profiles, masks…) - let mut skipped: Vec<&str> = v["imported"] - .as_array() - .into_iter() - .flatten() - .flat_map(|i| i["unmapped"].as_array().into_iter().flatten()) - .filter_map(Value::as_str) - .collect(); - skipped.sort_unstable(); - skipped.dedup(); - if !skipped.is_empty() { - let names: Vec<&str> = skipped.iter().take(3).copied().collect(); - msg += &crate::i18n::tr_format!(" — not carried over: {}{}", names.join(", "), if skipped.len() > 3 { "…" } else { "" }); - } - parts.push(msg); - } - if n > 0 { - app.ui.presets = true; - } - } - let mut msg = parts.join(" · "); - if !problems.is_empty() { - let detail = - format!("{}{}", problems.iter().take(2).cloned().collect::>().join("; "), if problems.len() > 2 { "…" } else { "" }); - if msg.is_empty() { - msg = crate::i18n::tr_format!("Import failed: {e}", e = detail); - } else { - msg += &crate::i18n::tr_format!(" · {} failed: {}", problems.len(), detail); - } - app.toast_error(&ctx, msg); - } else if !msg.is_empty() { - app.toast(&ctx, msg); - } - let r = r.map(|mut v| { - if !lut_paths.is_empty() - && let Some(o) = v.as_object_mut() - { - o.insert("profiles".into(), profiles_result); - } - v - }); - return Some(r); - } - "file.importKeywords" => { - // a keyword list file: Lightroom Classic's, Capture One's, Photo Supreme's (.utf8) - let path = match p.get("path").and_then(Value::as_str) { - Some(x) => x.to_string(), - None => { - let req = PickRequest::file(crate::i18n::tr("Import Keywords"), crate::i18n::tr("Keyword Lists"), &["txt", "utf8"]); - match crate::pick::ask(app, id, p, "path", req, |s| s.pick_keyword_list.as_mut().map(|f| f())) { - Picked::Now(v) => match v.into_iter().next() { - Some(x) => x, - None => return Some(Ok(Value::Null)), - }, - Picked::Later => return Some(Ok(Value::Null)), - Picked::Unavailable => return Some(Err("no file dialog on this platform".into())), - } - } - }; - let r = app.session.execute("keyword.import", &json!({"path": path})).map_err(|e| e.to_string()); - match &r { - Ok(v) => { - let (added, updated) = (v["added"].as_u64().unwrap_or(0), v["updated"].as_u64().unwrap_or(0)); - let mut msg = crate::i18n::tr_format!("Added {n} keyword{}", if added == 1 { "" } else { "s" }, n = added); - if updated > 0 { - msg.push_str(&crate::i18n::tr_format!("; {n} gained synonyms", n = updated)); - } - app.toast(&ctx, msg); - } - Err(e) => app.toast(&ctx, e.clone()), - } - return Some(r); - } - "file.exportKeywords" => { - let path = match p.get("path").and_then(Value::as_str) { - Some(x) => x.to_string(), - None => { - let name = "Keywords.txt"; - let req = PickRequest::save(crate::i18n::tr("Export Keywords"), crate::i18n::tr("Keyword Lists"), &["txt"], name); - match crate::pick::ask(app, id, p, "path", req, |s| s.save_keyword_list.as_mut().map(|f| f(name).into_iter().collect())) { - Picked::Now(v) => match v.into_iter().next() { - Some(x) => x, - None => return Some(Ok(Value::Null)), - }, - Picked::Later => return Some(Ok(Value::Null)), - Picked::Unavailable => return Some(Err("no file dialog on this platform".into())), - } - } - }; - let r = app.session.execute("keyword.export", &json!({"path": path})).map_err(|e| e.to_string()); - if let Err(e) = &r { - app.toast(&ctx, e.clone()); - } - if let Ok(v) = &r { - let n = v["keywords"].as_u64().unwrap_or(0); - let mut msg = crate::i18n::tr_format!("Exported {n} keyword{}", if n == 1 { "" } else { "s" }, n = n); - // Capture One's importer refuses ; , < > in a list: say which to rename first - let refuses: Vec<&str> = v["captureOneRefuses"].as_array().into_iter().flatten().filter_map(Value::as_str).collect(); - if !refuses.is_empty() { - msg.push_str(&crate::i18n::tr_format!( - " — Capture One won't import a list with ; , < or > in a keyword: {names}", - names = refuses.iter().take(5).copied().collect::>().join(" · ") - )); - } - // what the format can't hold (a name in brackets, a line break…) isn't in the file - let left: Vec<&str> = v["unwritable"].as_array().into_iter().flatten().filter_map(Value::as_str).collect(); - if !left.is_empty() { - msg.push_str(&crate::i18n::tr_format!( - " — left out, as a keyword list can't hold them: {names}", - // escaped: a line break in a name would break the toast - names = left.iter().take(5).map(|n| n.escape_debug().to_string()).collect::>().join(" · ") - )); - } - app.toast(&ctx, msg); - } - return Some(r); - } + "file.importPresets" => file_import_presets_command(app, ctx, id, p), + "file.importKeywords" => file_import_keywords_command(app, ctx, id, p), + "file.exportKeywords" => file_export_keywords_command(app, ctx, id, p), "dialog.saveMaskEffect" => { if app.session.active_mask.is_none() { return Some(Err("select a mask first".into())); @@ -1853,38 +1393,7 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option { - let path = match p.get("path").and_then(Value::as_str) { - Some(x) => Some(x.to_string()), - None => { - let name = format!("{}.lceffect", p.get("group").and_then(Value::as_str).unwrap_or("Effect Presets")); - let req = PickRequest::save( - crate::i18n::tr("Export Effect Presets"), - crate::i18n::tr("LightCraft Effect Presets"), - &["lceffect"], - name.clone(), - ); - match crate::pick::ask(app, id, p, "path", req, |s| s.save_preset_file.as_mut().map(|f| f(&name).into_iter().collect())) { - Picked::Now(v) => v.into_iter().next(), - Picked::Later => return Some(Ok(Value::Null)), - Picked::Unavailable => return Some(Err("no file dialog on this platform".into())), - } - } - }; - let Some(path) = path else { return Some(Ok(Value::Null)) }; - let mut params = json!({"path": path}); - for k in ["names", "group"] { - if let Some(v) = p.get(k) { - params[k] = v.clone(); - } - } - let r = app.session.execute("mask.exportEffects", ¶ms).map_err(|e| e.to_string()); - match &r { - Ok(v) => app.toast(&ctx, crate::i18n::tr_format!("Exported {} effect preset{}", v["count"], if v["count"] == 1 { "" } else { "s" })), - Err(e) => app.toast_error(&ctx, e.clone()), - } - return Some(r); - } + "file.exportMaskEffects" => file_export_mask_effects_command(app, ctx, id, p), "file.exportPresets" => { let group = p.get("group").and_then(Value::as_str).map(str::to_string); let path = match p.get("path").and_then(Value::as_str) { @@ -1909,71 +1418,20 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option { - let paths: Vec = match p.get("paths").and_then(Value::as_array) { - Some(a) => a.iter().filter_map(Value::as_str).map(str::to_string).collect(), - None => { - let req = PickRequest::files( - Some(crate::i18n::tr("Import Point Curve Presets").into()), - crate::i18n::tr("Point Curve Presets"), - crate::pick::CURVE_PRESET_EXTENSIONS, - ); - match crate::pick::ask(app, id, p, "paths", req, |s| s.pick_curve_preset_files.as_mut().map(|f| f())) { - Picked::Now(paths) => paths, - Picked::Later => return Some(Ok(Value::Null)), - Picked::Unavailable => return Some(Err("no file dialog on this platform".into())), - } - } - }; - if paths.is_empty() { - return Some(Ok(Value::Null)); - } - let r = app.session.execute("curve.importPresets", &json!({"paths": paths})).map_err(|e| e.to_string()); - if let Ok(v) = &r { - let n = v["imported"].as_array().map_or(0, Vec::len); - let failed = v["failed"].as_array().map_or(0, Vec::len); - let mut msg = crate::i18n::tr_format!("Imported {n} point curve preset{}", if n == 1 { "" } else { "s" }, n = n); - if failed > 0 { - msg += &crate::i18n::tr_format!(", {failed} file{} not readable", if failed == 1 { "" } else { "s" }, failed = failed); - } - app.toast(&ctx, msg); - } - return Some(r); - } - "file.exportCurvePresets" => { - let path = match p.get("path").and_then(Value::as_str) { - Some(x) => Some(x.to_string()), - None => { - let req = PickRequest::save( - crate::i18n::tr("Export Point Curve Presets"), - crate::i18n::tr("Point Curve Presets"), - &["lccurve"], - "Point Curves.lccurve", - ); - match crate::pick::ask(app, id, p, "path", req, |s| { - s.save_curve_preset_file.as_mut().map(|f| f("Point Curves.lccurve").into_iter().collect()) - }) { - Picked::Now(v) => v.into_iter().next(), - Picked::Later => return Some(Ok(Value::Null)), - Picked::Unavailable => return Some(Err("no file dialog on this platform".into())), - } - } - }; - let Some(path) = path else { return Some(Ok(Value::Null)) }; - let mut params = json!({"path": path}); - if let Some(n) = p.get("names") { - params["names"] = n.clone(); - } - let r = app.session.execute("curve.exportPresets", ¶ms).map_err(|e| e.to_string()); - if let Ok(v) = &r { - app.toast(&ctx, crate::i18n::tr_format!("Exported {} point curve preset{}", v["count"], if v["count"] == 1 { "" } else { "s" })); - } - return Some(r); + r } + "file.importCurvePresets" => file_import_curve_presets_command(app, ctx, id, p), + _ => return None, + }; + Some(r) +} + +/// Part 12 of 12 of the UI commands; `None` means the id is not one of this part's. +fn ui_commands_12(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Option> { + let r: Result = match id { + "file.exportCurvePresets" => file_export_curve_presets_command(app, ctx, id, p), "app.export" => crate::control::export_active(app, p), "app.showInFinder" => show_in_finder(app), "app.showInFolders" => show_in_folders(app, p.get("id").and_then(Value::as_u64).map(lightcraft_catalog::PhotoId)), @@ -1990,3 +1448,687 @@ pub fn run_ui_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Option Result { + if app.ui.dialog.is_some() { + app.ui.dialog = None; + } else if app.ui.lights_out != crate::state::LightsOut::On { + app.ui.lights_out = crate::state::LightsOut::On; + } else if app.ui.keyword_painter.is_some() { + app.ui.keyword_painter = None; + } else if app.ui.fullscreen { + // Through `slideshow::end`: it also releases the held slide textures. Clearing the + // two fields directly left every rendered slide in the renderer. + crate::panels::slideshow::end(app); + } else if !app.ui.tool.is_empty() { + app.ui.tool.clear(); + } else if app.ui.right == RightPanel::Crop && app.ui.view == ViewMode::Detail { + // Esc leaves the crop tool (the crop stays), as C does; the next Esc goes back + panel(app, ctx, RightPanel::Crop, "Crop, Rotate, Geometry"); + } else if app.ui.view == ViewMode::People && app.ui.person_page.is_some() { + app.ui.person_page = None; + } else if matches!(app.ui.view, ViewMode::Compare | ViewMode::Survey | ViewMode::Reference) { + app.ui.view = ViewMode::Detail; + } else if app.ui.view == ViewMode::Detail { + // a photo opened from a person's page (or the unnamed faces) goes back there, any other to the grid + match app.ui.person_from.take() { + Some((name, photo)) if app.session.active().is_some_and(|a| a.0 == photo) => { + app.ui.view = ViewMode::People; + app.ui.person_page = name; + } + _ => app.ui.view = ViewMode::PhotoGrid, + } + } + Ok(Value::Null) +} + +/// The `view.viewOptions` command. +fn view_view_options_command(app: &mut LightcraftApp, p: &Value) -> Result { + // `info1` / `info2` set the lines, `briefly` the Info that Show Briefly When Photo Changes + // shows and `loupeMessages` Show message when loading or rendering photos, for an agent; + // without any of them the window opens + let mut info = app.ui.settings.loupe_info; + let mut set = false; + // `loupeMessages` sets Show message when loading or rendering photos + let messages = match p.get("loupeMessages") { + None => app.ui.settings.loupe_messages, + Some(v) => match v.as_bool() { + Some(on) => { + set = true; + on + } + None => return Err("`loupeMessages`: true|false".into()), + }, + }; + for (key, lines) in [("info1", &mut info.info1), ("info2", &mut info.info2)] { + let Some(v) = p.get(key) else { continue }; + match serde_json::from_value(v.clone()) { + Ok(v) => *lines = v, + Err(_) => { + return Err(format!("`{key}`: three of none|fileName|captureDate|dimensions|exposure|camera|lens|cameraAndLens")); + } + } + set = true; + } + if let Some(v) = p.get("briefly") { + match serde_json::from_value(v.clone()) { + Ok(v) => info.briefly = v, + Err(_) => return Err("`briefly`: off|basic|exposure (neither, Info 1 or Info 2)".into()), + } + set = true; + } + if set { + app.ui.settings.loupe_info = info; + app.ui.settings.loupe_messages = messages; + } else { + app.ui.dialog = Some(Dialog::ViewOptions); + } + Ok(json!({"loupeInfo": app.ui.settings.loupe_info, "loupeMessages": app.ui.settings.loupe_messages})) +} + +/// The `view.softProof` command. +fn view_soft_proof_command(app: &mut LightcraftApp, _id: &str, p: &Value) -> Result { + // {on?, space?, profile?: ICC path | null, intent?: perceptual|relative, paperInk?, + // destWarning?, displayWarning?}; no params toggles + let has = |k: &str| p.get(k).is_some(); + if let Some(s) = p.get("space").and_then(Value::as_str) { + match lightcraft_engine::pipeline::OutputSpace::parse(s) { + Some(sp) => { + app.ui.proof.space = sp; + // a standard space replaces a device profile (unless one is given too) + app.ui.proof_profile = None; + } + None => return Err(format!("view.softProof: unknown space {s:?} (srgb|displayP3|adobeRgb|proPhoto|rec2020)")), + } + } + if let Some(i) = p.get("intent") { + match i.as_str().and_then(lightcraft_engine::proof::ProofIntent::parse) { + Some(i) => app.ui.proof_intent = i, + None => return Err("view.softProof: intent must be perceptual or relative".into()), + } + } + if let Some(b) = p.get("paperInk").and_then(Value::as_bool) { + app.ui.proof_paper_ink = b; + } + let path = match p.get("profile") { + Some(Value::String(s)) => Some(s.clone()), + Some(Value::Null) => { + app.ui.proof_profile = None; + None + } + Some(_) => return Err("view.softProof: profile must be an ICC file path or null".into()), + None => app.ui.proof_profile.as_ref().map(|(f, _)| f.clone()), + }; + match path { + Some(path) => match lightcraft_engine::proof::load(&path, app.ui.proof_intent, app.ui.proof_paper_ink) { + Ok(pp) => { + app.ui.proof.profile = pp.id; + app.ui.proof_profile = Some((path, pp.name)); + } + Err(e) => return Err(format!("view.softProof: {e}")), + }, + None => app.ui.proof.profile = 0, + } + if let Some(b) = p.get("destWarning").and_then(Value::as_bool) { + app.ui.proof.dest_warning = b; + } + if let Some(b) = p.get("displayWarning").and_then(Value::as_bool) { + app.ui.proof.display_warning = b; + } + app.ui.soft_proof = match p.get("on").and_then(Value::as_bool) { + Some(b) => b, + None if ["space", "destWarning", "displayWarning", "profile", "intent", "paperInk"].iter().any(|k| has(k)) => app.ui.soft_proof, + None => !app.ui.soft_proof, + }; + if app.ui.soft_proof && !matches!(app.ui.view, ViewMode::Detail | ViewMode::Reference) { + app.ui.view = ViewMode::Detail; + } + let pr = app.ui.proof; + let profile = app.ui.proof_profile.as_ref().map(|(f, n)| json!({"path": f, "name": n})); + Ok(json!({"on": app.ui.soft_proof, "space": pr.space, "profile": profile, "intent": app.ui.proof_intent.name(), + "paperInk": app.ui.proof_paper_ink, "destWarning": pr.dest_warning, "displayWarning": pr.display_warning})) +} + +/// The `dialog.smartAlbum` command. +fn dialog_smart_album_command(app: &mut LightcraftApp, _id: &str, p: &Value) -> Result { + // {id?}: edit that smart album's rules; without: a new one starting at Rating ≥ 3 + let album = p + .get("id") + .and_then(Value::as_u64) + .and_then(|id| app.session.catalog.album(lightcraft_catalog::AlbumId(id)).filter(|a| a.is_smart()).cloned()); + app.ui.dialog = Some(match album { + Some(a) => Dialog::SmartRules { + id: Some(a.id.0), + name: a.name.clone(), + // older rules read as they always matched (RuleSet::upgrade) + rules: a + .smart + .as_ref() + .and_then(|f| f.rule_set.clone()) + .map(|mut r| { + r.upgrade(); + r + }) + .unwrap_or_default(), + parent: None, + }, + None => Dialog::SmartRules { + id: None, + name: p.get("name").and_then(Value::as_str).unwrap_or("").into(), + rules: lightcraft_catalog::RuleSet { rules: vec![crate::panels::rules_editor::new_rule()], ..Default::default() }, + parent: parent_param(p), + }, + }); + Ok(Value::Null) +} + +/// The `app.systemInfo` command. +fn app_system_info_command(app: &mut LightcraftApp, p: &Value) -> Result { + let info = app.session.execute("library.info", &json!({})).unwrap_or_default(); + let gpu = (lightcraft_engine::gpu::ready() && lightcraft_engine::gpu::available()).then(lightcraft_engine::gpu::adapter_name).flatten(); + let mb = |b: u64| format!("{:.0} MB", b as f64 / (1u64 << 20) as f64); + let mut rows = vec![ + ("Version".to_string(), env!("CARGO_PKG_VERSION").to_string()), + ("System".to_string(), format!("{} ({})", std::env::consts::OS, std::env::consts::ARCH)), + ("CPU threads".to_string(), std::thread::available_parallelism().map(|n| n.get().to_string()).unwrap_or_else(|_| "?".into())), + ( + "GPU".to_string(), + gpu.unwrap_or_else(|| match lightcraft_engine::gpu::unavailable_reason() { + Some(why) => crate::i18n::tr_format!("none (CPU rendering): {why}", why = why), + None => "none (CPU rendering)".into(), + }), + ), + ("GPU rendering".to_string(), if app.ui.settings.gpu { "on".into() } else { "off".into() }), + ("Memory budget".to_string(), mb(lightcraft_engine::memory::default_budget() as u64)), + ( + "Preview size".to_string(), + match app.ui.settings.preview_limit { + 0 => "automatic".to_string(), + n => format!("{n} px"), + }, + ), + ("Photos".to_string(), info["photos"].to_string()), + ("Albums".to_string(), info["albums"].to_string()), + ]; + if let Some(dir) = info["dir"].as_str().or(info["path"].as_str()) { + rows.push(("Library".into(), dir.to_string())); + } + rows.push(("Frame time".into(), format!("{:.1} ms ({:.0} fps)", app.perf.frame_ms, app.perf.fps))); + rows.push(( + "Frame update".into(), + format!("{:.1} ms (logic {:.1} ms; slowest {:.0} ms)", app.perf.update_ms, app.perf.logic_ms, app.perf.max_update_ms), + )); + rows.push(("Last loupe render".into(), format!("{:.0} ms", app.renderer.last_main_ms))); + if let Some(f) = lightcraft_engine::gpu::last_fallback() { + rows.push(("Last GPU fallback".into(), f)); + } + let r = json!(rows.iter().map(|(k, v)| json!({"label": k, "value": v})).collect::>()); + if p.get("open").and_then(Value::as_bool).unwrap_or(true) { + app.ui.dialog = Some(Dialog::SystemInfo { rows }); + } + Ok(r) +} + +/// `file.findMissing {within?}`: the folder the search is limited to, if any. +fn find_missing_within(p: &Value) -> Result, String> { + match p.get("within") { + None | Some(Value::Null) => Ok(None), + Some(Value::String(path)) if !path.is_empty() => Ok(Some(path.clone())), + Some(Value::String(_)) => Err("file.findMissing: `within` must not be empty".into()), + Some(value) => Err(format!("file.findMissing: `within` must be a folder path, not {value}")), + } +} + +/// `file.findMissing {timeout?}`: how long `wait` waits for the search (ten minutes when omitted). +fn find_missing_timeout(p: &Value) -> Result { + let n = match p.get("timeout") { + None | Some(Value::Null) => return Ok(std::time::Duration::from_secs(600)), + Some(Value::Number(n)) => n, + Some(other) => return Err(format!("file.findMissing: `timeout` must be a number of seconds, not {other}")), + }; + let s = n.as_f64().ok_or("file.findMissing: `timeout` must be a number of seconds")?; + if !s.is_finite() || s < 0.0 { + return Err("file.findMissing: `timeout` must be a non-negative number of seconds".into()); + } + std::time::Duration::try_from_secs_f64(s).map_err(|_| "file.findMissing: `timeout` is too large".to_string()) +} + +/// The toast for a finished search, and the result it leaves for a caller that waits. +fn find_missing_done(app: &mut LightcraftApp, ctx: &egui::Context, plan: Result) { + // relinked under the session as it is now: photos relinked meanwhile and files + // now in use are skipped + let r = plan.and_then(|plan| app.run("library.findMissing", plan.to_json())); + match r { + Ok(v) => { + let n = v["found"].as_array().map_or(0, Vec::len); + let left = v["missing"].as_u64().unwrap_or(0); + let unsure = v["ambiguous"].as_array().map_or(0, Vec::len); + let unsure = if unsure > 0 { + crate::i18n::tr_format!(" ({unsure} with several look-alike files: use Locate)", unsure = unsure) + } else { + String::new() + }; + app.toast( + ctx, + crate::i18n::tr_format!( + "Found {n} missing photo{}; {left} still missing{unsure}", + if n == 1 { "" } else { "s" }, + left = left, + n = n, + unsure = unsure + ), + ); + app.ui.last_find_missing = Some(v.clone()); + app.ui.last_find_missing_result = Some(Ok(v)); + } + Err(e) => { + app.toast(ctx, e.clone()); + app.ui.last_find_missing_result = Some(Err(e)); + } + } +} + +/// The `file.findMissing` command. +fn file_find_missing_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Result { + let within = find_missing_within(p)?; + let wait = p.get("wait").and_then(Value::as_bool).unwrap_or(false); + let timeout = find_missing_timeout(p)?; + let title = if within.is_some() { "Locate Missing Files…" } else { "Find Missing Photos…" }; + let folder = match p.get("folder").and_then(Value::as_str) { + Some(f) => Some(f.to_string()), + None => match crate::pick::ask(app, id, p, "folder", PickRequest::folder(crate::i18n::tr(title)), |s| { + s.pick_folder.as_mut().and_then(|f| f()).map(|x| vec![x]) + }) { + Picked::Now(v) => v.into_iter().next(), + Picked::Later | Picked::Unavailable => None, + }, + }; + let Some(folder) = folder else { return Ok(Value::Null) }; + // the search (checking every photo's file, walking the folder) runs on a worker thread; + // the relinking happens back here, as one undo step + const LABEL: &str = "Find Missing Photos"; + if app.tasks.is_running(LABEL) { + return Err("Find Missing Photos is already searching".into()); + } + let mut candidates = lightcraft_engine::cmd::missing::find_candidates(&app.session.catalog); + if let Some(within) = within { + candidates.retain(|candidate| lightcraft_catalog::query::folder_within(&candidate.path, &within)); + } + #[cfg(test)] + let test_delay = app.ui.find_missing_test_delay; + let work = move || { + #[cfg(test)] + if let Some(d) = test_delay { + std::thread::sleep(d); + } + lightcraft_engine::cmd::missing::plan_find_missing(&candidates, &folder) + }; + app.ui.last_find_missing = None; + app.ui.last_find_missing_result = None; + crate::tasks::spawn(app, LABEL, Some("findMissing"), work, find_missing_done)?; + if !wait { + return Ok(json!({"background": true})); + } + let ctx = app.tasks.repaint.clone().unwrap_or_default(); + if !crate::tasks::wait_for(app, &ctx, LABEL, timeout) { + return Err("Find Missing Photos: search timed out (search continues in the background)".into()); + } + app.ui.last_find_missing_result.take().unwrap_or_else(|| Err("Find Missing Photos: worker terminated unexpectedly".into())) +} + +/// The `photo.tagFromTracklog` command. +fn photo_tag_from_tracklog_command(app: &mut LightcraftApp, _ctx: &egui::Context, id: &str, p: &Value) -> Result { + // a GPX file → GPS for the selected photos by capture time (one undo step) + let path = match p.get("path").and_then(Value::as_str) { + Some(x) => Some(x.to_string()), + None => { + let req = PickRequest::file(crate::i18n::tr("Auto-Tag from Tracklog"), crate::i18n::tr("GPS Track Log"), &["gpx"]); + match crate::pick::ask(app, id, p, "path", req, |s| s.pick_tracklog.as_mut().map(|f| f())) { + Picked::Now(v) => v.into_iter().next(), + Picked::Later | Picked::Unavailable => None, + } + } + }; + let Some(path) = path else { return Ok(Value::Null) }; + let mut params = p.as_object().cloned().unwrap_or_default(); + params.insert("path".into(), json!(path)); + let ask_zone = !params.contains_key("offset"); + let params = Value::Object(params); + if ask_zone { + // GPX times are UTC, camera clocks are local: ask for the camera's zone, then come back here + crate::panels::dialogs::prompt( + app, + "Auto-Tag from Tracklog", + "Camera time zone, e.g. -07:00 (empty: UTC)", + "", + "photo.tagFromTracklog", + params, + "offset", + ); + return Ok(Value::Null); + } + let r = app.run("photo.autoTagTracklog", params); + if let Ok(v) = &r { + let n = v["tagged"].as_u64().unwrap_or(0); + let sk = &v["skipped"]; + let mut msg = crate::i18n::tr_format!("Tagged {n} photo{} from the tracklog", if n == 1 { "" } else { "s" }, n = n); + let outside = sk["outside"].as_u64().unwrap_or(0); + if outside > 0 { + msg += &crate::i18n::tr_format!("; {outside} outside its time range", outside = outside); + } + let kept = sk["hasGps"].as_u64().unwrap_or(0); + if kept > 0 { + msg += &crate::i18n::tr_format!("; {kept} already had a location", kept = kept); + } + let ctx = app.tasks.repaint.clone().unwrap_or_default(); + app.toast(&ctx, msg); + } + r +} + +/// The `file.importPresets` command. +fn file_import_presets_command(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Result { + let paths = match p.get("paths").and_then(Value::as_array) { + Some(a) => a.iter().filter_map(Value::as_str).map(str::to_string).collect(), + None => { + let req = PickRequest::files( + Some(crate::i18n::tr("Import Presets").into()), + crate::i18n::tr("Presets & Profiles"), + crate::pick::PRESET_EXTENSIONS, + ); + match crate::pick::ask(app, id, p, "paths", req, |s| s.pick_preset_files.as_mut().map(|f| f())) { + Picked::Now(paths) => paths, + Picked::Later => return Ok(Value::Null), + Picked::Unavailable => return Err("no file dialog on this platform".into()), + } + } + }; + if paths.is_empty() { + return Ok(Value::Null); + } + // .cube LUTs (and those inside zips / folders) become profiles + let lut_paths: Vec<&String> = paths + .iter() + .filter(|p| { + let l = p.to_ascii_lowercase(); + l.ends_with(".cube") || l.ends_with(".zip") || std::path::Path::new(p.as_str()).is_dir() + }) + .collect(); + // one toast for both halves (a second toast would replace the first) + let mut parts: Vec = Vec::new(); + // `name: reason` for each file that couldn't be imported + let mut problems: Vec = Vec::new(); + let mut profiles_result = Value::Null; + if !lut_paths.is_empty() { + match app.session.execute("profile.import", &json!({"paths": lut_paths})) { + Ok(v) => { + let profiles = v["imported"].as_array().map_or(0, Vec::len); + if profiles > 0 { + parts.push(crate::i18n::tr_format!( + "Imported {profiles} profile{} (Profile browser ▸ their groups)", + if profiles == 1 { "" } else { "s" }, + profiles = profiles + )); + } + problems.extend(v["failed"].as_array().into_iter().flatten().map(|f| { + let name = f.get(0).and_then(Value::as_str).unwrap_or_default(); + let reason = f.get(1).and_then(Value::as_str).unwrap_or_default(); + format!("{name}: {reason}") + })); + profiles_result = v; + } + Err(e) => { + problems.push(e.to_string()); + profiles_result = json!({"error": e.to_string()}); + } + } + } + let preset_paths: Vec<&String> = paths.iter().filter(|p| !p.to_ascii_lowercase().ends_with(".cube")).collect(); + let r = if preset_paths.is_empty() { + Ok(json!({"imported": [], "failed": [], "skipped": 0})) + } else { + app.session.execute("preset.import", &json!({"paths": preset_paths})).map_err(|e| e.to_string()) + }; + if let (false, Ok(v)) = (preset_paths.is_empty(), &r) { + let n = v["imported"].as_array().map_or(0, Vec::len); + let failed = v["failed"].as_array().map_or(0, Vec::len); + // Lightroom local adjustment presets land in the Masking panel's Effect menu: part of the same toast + let effects = v["effects"].as_array().map_or(0, Vec::len); + if effects > 0 { + parts.push(crate::panels::mask_effects::import_toast(v)); + } + let profile_news = !parts.is_empty() || !problems.is_empty(); + let msg = match (n, failed) { + // a zip of LUTs (or only local presets): the other half already says what happened + (0, 0) if profile_news => None, + (0, 0) => Some("No new presets".to_string()), + (n, 0) => Some(crate::i18n::tr_format!("Imported {n} preset{}", if n == 1 { "" } else { "s" }, n = n)), + (n, f) => Some(crate::i18n::tr_format!( + "Imported {n} preset{}, {f} file{} not readable", + if n == 1 { "" } else { "s" }, + if f == 1 { "" } else { "s" }, + f = f, + n = n + )), + }; + if let Some(mut msg) = msg { + // settings with no counterpart here (the other editor's profiles, masks…) + let mut skipped: Vec<&str> = v["imported"] + .as_array() + .into_iter() + .flatten() + .flat_map(|i| i["unmapped"].as_array().into_iter().flatten()) + .filter_map(Value::as_str) + .collect(); + skipped.sort_unstable(); + skipped.dedup(); + if !skipped.is_empty() { + let names: Vec<&str> = skipped.iter().take(3).copied().collect(); + msg += &crate::i18n::tr_format!(" — not carried over: {}{}", names.join(", "), if skipped.len() > 3 { "…" } else { "" }); + } + parts.push(msg); + } + if n > 0 { + app.ui.presets = true; + } + } + let mut msg = parts.join(" · "); + if !problems.is_empty() { + let detail = format!("{}{}", problems.iter().take(2).cloned().collect::>().join("; "), if problems.len() > 2 { "…" } else { "" }); + if msg.is_empty() { + msg = crate::i18n::tr_format!("Import failed: {e}", e = detail); + } else { + msg += &crate::i18n::tr_format!(" · {} failed: {}", problems.len(), detail); + } + app.toast_error(ctx, msg); + } else if !msg.is_empty() { + app.toast(ctx, msg); + } + + r.map(|mut v| { + if !lut_paths.is_empty() + && let Some(o) = v.as_object_mut() + { + o.insert("profiles".into(), profiles_result); + } + v + }) +} + +/// The `file.importKeywords` command. +fn file_import_keywords_command(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Result { + // a keyword list file: Lightroom Classic's, Capture One's, Photo Supreme's (.utf8) + let path = match p.get("path").and_then(Value::as_str) { + Some(x) => x.to_string(), + None => { + let req = PickRequest::file(crate::i18n::tr("Import Keywords"), crate::i18n::tr("Keyword Lists"), &["txt", "utf8"]); + match crate::pick::ask(app, id, p, "path", req, |s| s.pick_keyword_list.as_mut().map(|f| f())) { + Picked::Now(v) => match v.into_iter().next() { + Some(x) => x, + None => return Ok(Value::Null), + }, + Picked::Later => return Ok(Value::Null), + Picked::Unavailable => return Err("no file dialog on this platform".into()), + } + } + }; + let r = app.session.execute("keyword.import", &json!({"path": path})).map_err(|e| e.to_string()); + match &r { + Ok(v) => { + let (added, updated) = (v["added"].as_u64().unwrap_or(0), v["updated"].as_u64().unwrap_or(0)); + let mut msg = crate::i18n::tr_format!("Added {n} keyword{}", if added == 1 { "" } else { "s" }, n = added); + if updated > 0 { + msg.push_str(&crate::i18n::tr_format!("; {n} gained synonyms", n = updated)); + } + app.toast(ctx, msg); + } + Err(e) => app.toast(ctx, e.clone()), + } + r +} + +/// The `file.exportKeywords` command. +fn file_export_keywords_command(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Result { + let path = match p.get("path").and_then(Value::as_str) { + Some(x) => x.to_string(), + None => { + let name = "Keywords.txt"; + let req = PickRequest::save(crate::i18n::tr("Export Keywords"), crate::i18n::tr("Keyword Lists"), &["txt"], name); + match crate::pick::ask(app, id, p, "path", req, |s| s.save_keyword_list.as_mut().map(|f| f(name).into_iter().collect())) { + Picked::Now(v) => match v.into_iter().next() { + Some(x) => x, + None => return Ok(Value::Null), + }, + Picked::Later => return Ok(Value::Null), + Picked::Unavailable => return Err("no file dialog on this platform".into()), + } + } + }; + let r = app.session.execute("keyword.export", &json!({"path": path})).map_err(|e| e.to_string()); + if let Err(e) = &r { + app.toast(ctx, e.clone()); + } + if let Ok(v) = &r { + let n = v["keywords"].as_u64().unwrap_or(0); + let mut msg = crate::i18n::tr_format!("Exported {n} keyword{}", if n == 1 { "" } else { "s" }, n = n); + // Capture One's importer refuses ; , < > in a list: say which to rename first + let refuses: Vec<&str> = v["captureOneRefuses"].as_array().into_iter().flatten().filter_map(Value::as_str).collect(); + if !refuses.is_empty() { + msg.push_str(&crate::i18n::tr_format!( + " — Capture One won't import a list with ; , < or > in a keyword: {names}", + names = refuses.iter().take(5).copied().collect::>().join(" · ") + )); + } + // what the format can't hold (a name in brackets, a line break…) isn't in the file + let left: Vec<&str> = v["unwritable"].as_array().into_iter().flatten().filter_map(Value::as_str).collect(); + if !left.is_empty() { + msg.push_str(&crate::i18n::tr_format!( + " — left out, as a keyword list can't hold them: {names}", + // escaped: a line break in a name would break the toast + names = left.iter().take(5).map(|n| n.escape_debug().to_string()).collect::>().join(" · ") + )); + } + app.toast(ctx, msg); + } + r +} + +/// The `file.exportMaskEffects` command. +fn file_export_mask_effects_command(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Result { + let path = match p.get("path").and_then(Value::as_str) { + Some(x) => Some(x.to_string()), + None => { + let name = format!("{}.lceffect", p.get("group").and_then(Value::as_str).unwrap_or("Effect Presets")); + let req = PickRequest::save( + crate::i18n::tr("Export Effect Presets"), + crate::i18n::tr("LightCraft Effect Presets"), + &["lceffect"], + name.clone(), + ); + match crate::pick::ask(app, id, p, "path", req, |s| s.save_preset_file.as_mut().map(|f| f(&name).into_iter().collect())) { + Picked::Now(v) => v.into_iter().next(), + Picked::Later => return Ok(Value::Null), + Picked::Unavailable => return Err("no file dialog on this platform".into()), + } + } + }; + let Some(path) = path else { return Ok(Value::Null) }; + let mut params = json!({"path": path}); + for k in ["names", "group"] { + if let Some(v) = p.get(k) { + params[k] = v.clone(); + } + } + let r = app.session.execute("mask.exportEffects", ¶ms).map_err(|e| e.to_string()); + match &r { + Ok(v) => app.toast(ctx, crate::i18n::tr_format!("Exported {} effect preset{}", v["count"], if v["count"] == 1 { "" } else { "s" })), + Err(e) => app.toast_error(ctx, e.clone()), + } + r +} + +/// The `file.importCurvePresets` command. +fn file_import_curve_presets_command(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Result { + let paths: Vec = match p.get("paths").and_then(Value::as_array) { + Some(a) => a.iter().filter_map(Value::as_str).map(str::to_string).collect(), + None => { + let req = PickRequest::files( + Some(crate::i18n::tr("Import Point Curve Presets").into()), + crate::i18n::tr("Point Curve Presets"), + crate::pick::CURVE_PRESET_EXTENSIONS, + ); + match crate::pick::ask(app, id, p, "paths", req, |s| s.pick_curve_preset_files.as_mut().map(|f| f())) { + Picked::Now(paths) => paths, + Picked::Later => return Ok(Value::Null), + Picked::Unavailable => return Err("no file dialog on this platform".into()), + } + } + }; + if paths.is_empty() { + return Ok(Value::Null); + } + let r = app.session.execute("curve.importPresets", &json!({"paths": paths})).map_err(|e| e.to_string()); + if let Ok(v) = &r { + let n = v["imported"].as_array().map_or(0, Vec::len); + let failed = v["failed"].as_array().map_or(0, Vec::len); + let mut msg = crate::i18n::tr_format!("Imported {n} point curve preset{}", if n == 1 { "" } else { "s" }, n = n); + if failed > 0 { + msg += &crate::i18n::tr_format!(", {failed} file{} not readable", if failed == 1 { "" } else { "s" }, failed = failed); + } + app.toast(ctx, msg); + } + r +} + +/// The `file.exportCurvePresets` command. +fn file_export_curve_presets_command(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Result { + let path = match p.get("path").and_then(Value::as_str) { + Some(x) => Some(x.to_string()), + None => { + let req = PickRequest::save( + crate::i18n::tr("Export Point Curve Presets"), + crate::i18n::tr("Point Curve Presets"), + &["lccurve"], + "Point Curves.lccurve", + ); + match crate::pick::ask(app, id, p, "path", req, |s| { + s.save_curve_preset_file.as_mut().map(|f| f("Point Curves.lccurve").into_iter().collect()) + }) { + Picked::Now(v) => v.into_iter().next(), + Picked::Later => return Ok(Value::Null), + Picked::Unavailable => return Err("no file dialog on this platform".into()), + } + } + }; + let Some(path) = path else { return Ok(Value::Null) }; + let mut params = json!({"path": path}); + if let Some(n) = p.get("names") { + params["names"] = n.clone(); + } + let r = app.session.execute("curve.exportPresets", ¶ms).map_err(|e| e.to_string()); + if let Ok(v) = &r { + app.toast(ctx, crate::i18n::tr_format!("Exported {} point curve preset{}", v["count"], if v["count"] == 1 { "" } else { "s" })); + } + r +} From 2f3002bc5cc3873bec404919876ea9f34df29a6d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 20:18:02 +0000 Subject: [PATCH 65/93] refactor(ui-egui): split preset import and find-missing commands --- crates/ui-egui/src/menus/run.rs | 337 ++++++++++++++++++-------------- 1 file changed, 187 insertions(+), 150 deletions(-) diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index 52e6006ebd..ed45cbcb49 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -1324,24 +1324,7 @@ fn ui_commands_11(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Va } "file.findMissing" => file_find_missing_command(app, id, p), "photo.tagFromTracklog" => photo_tag_from_tracklog_command(app, ctx, id, p), - "photo.locate" => { - let Some(id) = app.session.active() else { return Some(Err("no photo selected".into())) }; - let path = match p.get("path").and_then(Value::as_str) { - Some(x) => Some(x.to_string()), - None => { - let req = - PickRequest::file(crate::i18n::tr("Locate Missing File…"), crate::i18n::tr("Photos"), lightcraft_engine::import::EXTENSIONS); - match crate::pick::ask(app, "photo.locate", p, "path", req, |s| s.pick_files.as_mut().map(|f| f())) { - Picked::Now(v) => v.into_iter().next(), - Picked::Later | Picked::Unavailable => None, - } - } - }; - match path { - Some(path) => app.run("photo.relink", json!({"id": id.0, "path": path})), - None => Ok(Value::Null), - } - } + "photo.locate" => photo_locate_command(app, p), "file.addFromDevice" => { // a camera / card: review its DCIM folder, copying into the library by default let path = match p.get("path").and_then(Value::as_str) { @@ -1729,6 +1712,25 @@ fn find_missing_done(app: &mut LightcraftApp, ctx: &egui::Context, plan: Result< } } +/// The `photo.locate` command. +fn photo_locate_command(app: &mut LightcraftApp, p: &Value) -> Result { + let Some(id) = app.session.active() else { return Err("no photo selected".into()) }; + let path = match p.get("path").and_then(Value::as_str) { + Some(x) => Some(x.to_string()), + None => { + let req = PickRequest::file(crate::i18n::tr("Locate Missing File…"), crate::i18n::tr("Photos"), lightcraft_engine::import::EXTENSIONS); + match crate::pick::ask(app, "photo.locate", p, "path", req, |s| s.pick_files.as_mut().map(|f| f())) { + Picked::Now(v) => v.into_iter().next(), + Picked::Later | Picked::Unavailable => None, + } + } + }; + match path { + Some(path) => app.run("photo.relink", json!({"id": id.0, "path": path})), + None => Ok(Value::Null), + } +} + /// The `file.findMissing` command. fn file_find_missing_command(app: &mut LightcraftApp, id: &str, p: &Value) -> Result { let within = find_missing_within(p)?; @@ -1827,27 +1829,152 @@ fn photo_tag_from_tracklog_command(app: &mut LightcraftApp, _ctx: &egui::Context r } -/// The `file.importPresets` command. -fn file_import_presets_command(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Result { - let paths = match p.get("paths").and_then(Value::as_array) { +/// The files a command names in `paths`, else the ones picked in a dialog. `Err` is the command's own answer when +/// there is nothing to import (the dialog is still open or was cancelled, or none is available). +fn paths_or_pick( + app: &mut LightcraftApp, + id: &str, + p: &Value, + request: PickRequest, + now: impl FnOnce(&mut crate::services::Services) -> Option>, +) -> Result, Result> { + let paths: Vec = match p.get("paths").and_then(Value::as_array) { Some(a) => a.iter().filter_map(Value::as_str).map(str::to_string).collect(), - None => { - let req = PickRequest::files( - Some(crate::i18n::tr("Import Presets").into()), - crate::i18n::tr("Presets & Profiles"), - crate::pick::PRESET_EXTENSIONS, - ); - match crate::pick::ask(app, id, p, "paths", req, |s| s.pick_preset_files.as_mut().map(|f| f())) { - Picked::Now(paths) => paths, - Picked::Later => return Ok(Value::Null), - Picked::Unavailable => return Err("no file dialog on this platform".into()), - } - } + None => match crate::pick::ask(app, id, p, "paths", request, now) { + Picked::Now(paths) => paths, + Picked::Later => return Err(Ok(Value::Null)), + Picked::Unavailable => return Err(Err("no file dialog on this platform".into())), + }, }; if paths.is_empty() { - return Ok(Value::Null); + return Err(Ok(Value::Null)); } - // .cube LUTs (and those inside zips / folders) become profiles + Ok(paths) +} + +/// What an import of presets and profiles has to say: one toast for both halves (a second toast would replace the first). +#[derive(Default)] +struct ImportNews { + parts: Vec, + /// `name: reason` for each file that couldn't be imported + problems: Vec, +} + +/// `name: reason` for each `[name, reason]` of a `failed` list. +fn failed_files(v: &Value) -> impl Iterator + '_ { + v["failed"].as_array().into_iter().flatten().map(|f| { + let name = f.get(0).and_then(Value::as_str).unwrap_or_default(); + let reason = f.get(1).and_then(Value::as_str).unwrap_or_default(); + format!("{name}: {reason}") + }) +} + +/// `s` for a count other than one. +fn plural(n: usize) -> &'static str { + if n == 1 { "" } else { "s" } +} + +/// Import the `.cube` LUTs (and those inside zips / folders) as profiles; the answer to report back. +fn import_luts(app: &mut LightcraftApp, lut_paths: &[&String], news: &mut ImportNews) -> Value { + match app.session.execute("profile.import", &json!({"paths": lut_paths})) { + Ok(v) => { + let profiles = v["imported"].as_array().map_or(0, Vec::len); + if profiles > 0 { + news.parts.push(crate::i18n::tr_format!( + "Imported {profiles} profile{} (Profile browser ▸ their groups)", + plural(profiles), + profiles = profiles + )); + } + news.problems.extend(failed_files(&v)); + v + } + Err(e) => { + news.problems.push(e.to_string()); + json!({"error": e.to_string()}) + } + } +} + +/// The settings of imported presets that have no counterpart here (the other editor's profiles, masks…), as a note. +fn not_carried_over(v: &Value) -> String { + let mut skipped: Vec<&str> = v["imported"] + .as_array() + .into_iter() + .flatten() + .flat_map(|i| i["unmapped"].as_array().into_iter().flatten()) + .filter_map(Value::as_str) + .collect(); + skipped.sort_unstable(); + skipped.dedup(); + if skipped.is_empty() { + return String::new(); + } + let names: Vec<&str> = skipped.iter().take(3).copied().collect(); + crate::i18n::tr_format!(" — not carried over: {}{}", names.join(", "), if skipped.len() > 3 { "…" } else { "" }) +} + +/// The sentence for the presets of an import (none when the other half already says what happened). +fn presets_sentence(v: &Value, profile_news: bool) -> Option { + let n = v["imported"].as_array().map_or(0, Vec::len); + let failed = v["failed"].as_array().map_or(0, Vec::len); + let msg = match (n, failed) { + // a zip of LUTs (or only local presets): the other half already says what happened + (0, 0) if profile_news => return None, + (0, 0) => "No new presets".to_string(), + (n, 0) => crate::i18n::tr_format!("Imported {n} preset{}", plural(n), n = n), + (n, f) => crate::i18n::tr_format!("Imported {n} preset{}, {f} file{} not readable", plural(n), plural(f), f = f, n = n), + }; + Some(msg + ¬_carried_over(v)) +} + +/// Import the preset files; adds to what `news` reports. +fn import_preset_files(app: &mut LightcraftApp, preset_paths: &[&String], news: &mut ImportNews) -> Result { + if preset_paths.is_empty() { + return Ok(json!({"imported": [], "failed": [], "skipped": 0})); + } + let r = app.session.execute("preset.import", &json!({"paths": preset_paths})).map_err(|e| e.to_string()); + if let Ok(v) = &r { + // Lightroom local adjustment presets land in the Masking panel's Effect menu: part of the same toast + if v["effects"].as_array().is_some_and(|e| !e.is_empty()) { + news.parts.push(crate::panels::mask_effects::import_toast(v)); + } + let profile_news = !news.parts.is_empty() || !news.problems.is_empty(); + news.parts.extend(presets_sentence(v, profile_news)); + if v["imported"].as_array().is_some_and(|i| !i.is_empty()) { + app.ui.presets = true; + } + } + r +} + +/// Show what an import did: errors if any file failed, else the parts. +fn toast_import_news(app: &mut LightcraftApp, ctx: &egui::Context, news: &ImportNews) { + let mut msg = news.parts.join(" · "); + if news.problems.is_empty() { + if !msg.is_empty() { + app.toast(ctx, msg); + } + return; + } + let more = if news.problems.len() > 2 { "…" } else { "" }; + let detail = format!("{}{more}", news.problems.iter().take(2).cloned().collect::>().join("; ")); + if msg.is_empty() { + msg = crate::i18n::tr_format!("Import failed: {e}", e = detail); + } else { + msg += &crate::i18n::tr_format!(" · {} failed: {}", news.problems.len(), detail); + } + app.toast_error(ctx, msg); +} + +/// The `file.importPresets` command. +fn file_import_presets_command(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Result { + let request = + PickRequest::files(Some(crate::i18n::tr("Import Presets").into()), crate::i18n::tr("Presets & Profiles"), crate::pick::PRESET_EXTENSIONS); + let paths = match paths_or_pick(app, id, p, request, |s| s.pick_preset_files.as_mut().map(|f| f())) { + Ok(paths) => paths, + Err(answer) => return answer, + }; let lut_paths: Vec<&String> = paths .iter() .filter(|p| { @@ -1855,102 +1982,16 @@ fn file_import_presets_command(app: &mut LightcraftApp, ctx: &egui::Context, id: l.ends_with(".cube") || l.ends_with(".zip") || std::path::Path::new(p.as_str()).is_dir() }) .collect(); - // one toast for both halves (a second toast would replace the first) - let mut parts: Vec = Vec::new(); - // `name: reason` for each file that couldn't be imported - let mut problems: Vec = Vec::new(); - let mut profiles_result = Value::Null; - if !lut_paths.is_empty() { - match app.session.execute("profile.import", &json!({"paths": lut_paths})) { - Ok(v) => { - let profiles = v["imported"].as_array().map_or(0, Vec::len); - if profiles > 0 { - parts.push(crate::i18n::tr_format!( - "Imported {profiles} profile{} (Profile browser ▸ their groups)", - if profiles == 1 { "" } else { "s" }, - profiles = profiles - )); - } - problems.extend(v["failed"].as_array().into_iter().flatten().map(|f| { - let name = f.get(0).and_then(Value::as_str).unwrap_or_default(); - let reason = f.get(1).and_then(Value::as_str).unwrap_or_default(); - format!("{name}: {reason}") - })); - profiles_result = v; - } - Err(e) => { - problems.push(e.to_string()); - profiles_result = json!({"error": e.to_string()}); - } - } - } + let mut news = ImportNews::default(); + let profiles = if lut_paths.is_empty() { Value::Null } else { import_luts(app, &lut_paths, &mut news) }; let preset_paths: Vec<&String> = paths.iter().filter(|p| !p.to_ascii_lowercase().ends_with(".cube")).collect(); - let r = if preset_paths.is_empty() { - Ok(json!({"imported": [], "failed": [], "skipped": 0})) - } else { - app.session.execute("preset.import", &json!({"paths": preset_paths})).map_err(|e| e.to_string()) - }; - if let (false, Ok(v)) = (preset_paths.is_empty(), &r) { - let n = v["imported"].as_array().map_or(0, Vec::len); - let failed = v["failed"].as_array().map_or(0, Vec::len); - // Lightroom local adjustment presets land in the Masking panel's Effect menu: part of the same toast - let effects = v["effects"].as_array().map_or(0, Vec::len); - if effects > 0 { - parts.push(crate::panels::mask_effects::import_toast(v)); - } - let profile_news = !parts.is_empty() || !problems.is_empty(); - let msg = match (n, failed) { - // a zip of LUTs (or only local presets): the other half already says what happened - (0, 0) if profile_news => None, - (0, 0) => Some("No new presets".to_string()), - (n, 0) => Some(crate::i18n::tr_format!("Imported {n} preset{}", if n == 1 { "" } else { "s" }, n = n)), - (n, f) => Some(crate::i18n::tr_format!( - "Imported {n} preset{}, {f} file{} not readable", - if n == 1 { "" } else { "s" }, - if f == 1 { "" } else { "s" }, - f = f, - n = n - )), - }; - if let Some(mut msg) = msg { - // settings with no counterpart here (the other editor's profiles, masks…) - let mut skipped: Vec<&str> = v["imported"] - .as_array() - .into_iter() - .flatten() - .flat_map(|i| i["unmapped"].as_array().into_iter().flatten()) - .filter_map(Value::as_str) - .collect(); - skipped.sort_unstable(); - skipped.dedup(); - if !skipped.is_empty() { - let names: Vec<&str> = skipped.iter().take(3).copied().collect(); - msg += &crate::i18n::tr_format!(" — not carried over: {}{}", names.join(", "), if skipped.len() > 3 { "…" } else { "" }); - } - parts.push(msg); - } - if n > 0 { - app.ui.presets = true; - } - } - let mut msg = parts.join(" · "); - if !problems.is_empty() { - let detail = format!("{}{}", problems.iter().take(2).cloned().collect::>().join("; "), if problems.len() > 2 { "…" } else { "" }); - if msg.is_empty() { - msg = crate::i18n::tr_format!("Import failed: {e}", e = detail); - } else { - msg += &crate::i18n::tr_format!(" · {} failed: {}", problems.len(), detail); - } - app.toast_error(ctx, msg); - } else if !msg.is_empty() { - app.toast(ctx, msg); - } - + let r = import_preset_files(app, &preset_paths, &mut news); + toast_import_news(app, ctx, &news); r.map(|mut v| { if !lut_paths.is_empty() && let Some(o) = v.as_object_mut() { - o.insert("profiles".into(), profiles_result); + o.insert("profiles".into(), profiles); } v }) @@ -2070,37 +2111,33 @@ fn file_export_mask_effects_command(app: &mut LightcraftApp, ctx: &egui::Context /// The `file.importCurvePresets` command. fn file_import_curve_presets_command(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Result { - let paths: Vec = match p.get("paths").and_then(Value::as_array) { - Some(a) => a.iter().filter_map(Value::as_str).map(str::to_string).collect(), - None => { - let req = PickRequest::files( - Some(crate::i18n::tr("Import Point Curve Presets").into()), - crate::i18n::tr("Point Curve Presets"), - crate::pick::CURVE_PRESET_EXTENSIONS, - ); - match crate::pick::ask(app, id, p, "paths", req, |s| s.pick_curve_preset_files.as_mut().map(|f| f())) { - Picked::Now(paths) => paths, - Picked::Later => return Ok(Value::Null), - Picked::Unavailable => return Err("no file dialog on this platform".into()), - } - } + let request = PickRequest::files( + Some(crate::i18n::tr("Import Point Curve Presets").into()), + crate::i18n::tr("Point Curve Presets"), + crate::pick::CURVE_PRESET_EXTENSIONS, + ); + let paths = match paths_or_pick(app, id, p, request, |s| s.pick_curve_preset_files.as_mut().map(|f| f())) { + Ok(paths) => paths, + Err(answer) => return answer, }; - if paths.is_empty() { - return Ok(Value::Null); - } let r = app.session.execute("curve.importPresets", &json!({"paths": paths})).map_err(|e| e.to_string()); if let Ok(v) = &r { - let n = v["imported"].as_array().map_or(0, Vec::len); - let failed = v["failed"].as_array().map_or(0, Vec::len); - let mut msg = crate::i18n::tr_format!("Imported {n} point curve preset{}", if n == 1 { "" } else { "s" }, n = n); - if failed > 0 { - msg += &crate::i18n::tr_format!(", {failed} file{} not readable", if failed == 1 { "" } else { "s" }, failed = failed); - } - app.toast(ctx, msg); + app.toast(ctx, curve_import_message(v)); } r } +/// What an import of point curve presets did. +fn curve_import_message(v: &Value) -> String { + let n = v["imported"].as_array().map_or(0, Vec::len); + let failed = v["failed"].as_array().map_or(0, Vec::len); + let imported = crate::i18n::tr_format!("Imported {n} point curve preset{}", plural(n), n = n); + if failed == 0 { + return imported; + } + imported + &crate::i18n::tr_format!(", {failed} file{} not readable", plural(failed), failed = failed) +} + /// The `file.exportCurvePresets` command. fn file_export_curve_presets_command(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, p: &Value) -> Result { let path = match p.get("path").and_then(Value::as_str) { From 63755f8a2e74c90b86011a514b4e8f5d23ad9b0e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 20:19:42 +0000 Subject: [PATCH 66/93] refactor(ui-egui): split the global shortcut dispatcher --- crates/ui-egui/src/shortcuts.rs | 607 ++++++++++++++++++-------------- 1 file changed, 340 insertions(+), 267 deletions(-) diff --git a/crates/ui-egui/src/shortcuts.rs b/crates/ui-egui/src/shortcuts.rs index c36bcec98e..2f0b07d458 100644 --- a/crates/ui-egui/src/shortcuts.rs +++ b/crates/ui-egui/src/shortcuts.rs @@ -386,10 +386,22 @@ pub fn handle(app: &mut LightcraftApp, ctx: &egui::Context) { if keyboard_owned(app, ctx) || app.recording_shortcut.is_some() || app.ui.name_edit.is_some() { return; } + let (fire, aliased) = pressed_commands(app, ctx); + for (id, params) in aliased { + fire_alias(app, ctx, id, params); + } + let rotate_fires = fire.iter().any(|f| f == "crop.rotateAspect"); + for f in fire { + fire_command(app, ctx, &f, rotate_fires); + } +} + +/// The keys pressed this frame: the commands to fire, and the aliases (command and params) to run. +fn pressed_commands(app: &LightcraftApp, ctx: &egui::Context) -> (Vec, Vec<(&'static str, serde_json::Value)>) { let mut fire: Vec = Vec::new(); // shortcuts the native menu bar handles (it consumes those key presses itself) let native = |sc: &str| app.native_shortcuts.contains(sc); - let mut aliased: Vec<(&str, serde_json::Value)> = Vec::new(); + let mut aliased: Vec<(&'static str, serde_json::Value)> = Vec::new(); let keymap = &app.ui.settings.keymap; let grid = library_grid(app); // The grid navigation keys act on the photos in view, so they wait while the full-screen preview @@ -433,281 +445,342 @@ pub fn handle(app: &mut LightcraftApp, ctx: &egui::Context) { aliased.push((id, serde_json::from_str(params).unwrap_or_default())); } } - // rating 0-5, colour labels 6-9 (with Shift: and advance) - for (n, key) in [Key::Num0, Key::Num1, Key::Num2, Key::Num3, Key::Num4, Key::Num5].iter().enumerate() { - if matches(i, Modifiers::NONE, *key) && !native(&n.to_string()) && !taken.contains(&(Modifiers::NONE, *key)) { - fire.push(format!("rate:{n}:0")); - } - if matches(i, Modifiers::SHIFT, *key) && !taken.contains(&(Modifiers::SHIFT, *key)) { - fire.push(format!("rate:{n}:1")); - } - } - for (label, key, sc) in [("red", Key::Num6, "6"), ("yellow", Key::Num7, "7"), ("green", Key::Num8, "8"), ("blue", Key::Num9, "9")] { - if matches(i, Modifiers::NONE, key) && !native(sc) && !taken.contains(&(Modifiers::NONE, key)) { - fire.push(format!("label:{label}")); - } - } - if grid_navigation { - // Home / End: the first / last photo of the view - for (key, id) in [(Key::Home, "grid:first"), (Key::End, "grid:last")] { - if matches(i, Modifiers::NONE, key) && !taken.contains(&(Modifiers::NONE, key)) { - fire.push(id.to_string()); - } - } - // Shift+← / Shift+→: the previous / next photo of the view joins the selection - for (key, step) in [(Key::ArrowLeft, -1i64), (Key::ArrowRight, 1)] { - if matches(i, Modifiers::SHIFT, key) && !taken.contains(&(Modifiers::SHIFT, key)) { - fire.push(format!("grid:extend:{step}")); - } - } - } + fixed_photo_keys(i, &native, &taken, grid_navigation, &mut fire); }); - use crate::panels::compare; - // rating/flag/label keys: in Compare/Survey they act on the active photo only; Shift+key or - // Auto Advance then moves on (next candidate in Compare, next photo elsewhere) - let cull = |app: &mut LightcraftApp, id: &str, mut params: serde_json::Value, advance: bool| { - compare::target_active(app, &mut params); - let was = app.session.active(); - let ok = app.run(id, params).is_ok(); - if ok && (advance || app.ui.auto_advance) { - compare::advance(app, was); + (fire, aliased) +} + +/// The fixed photo keys pressed: ratings 0-5, colour labels 6-9 (with Shift: and advance), and in a grid the +/// navigation keys. Keys the user gave to a command (`taken`) and the native menu's (`native`) are left alone. +fn fixed_photo_keys(i: &egui::InputState, native: &dyn Fn(&str) -> bool, taken: &[(Modifiers, Key)], grid_navigation: bool, fire: &mut Vec) { + // rating 0-5, colour labels 6-9 (with Shift: and advance) + for (n, key) in [Key::Num0, Key::Num1, Key::Num2, Key::Num3, Key::Num4, Key::Num5].iter().enumerate() { + if matches(i, Modifiers::NONE, *key) && !native(&n.to_string()) && !taken.contains(&(Modifiers::NONE, *key)) { + fire.push(format!("rate:{n}:0")); } - }; - for (id, params) in aliased { - // a slideshow: Space pauses / resumes - if id == "view.zoomToggle" && app.ui.slideshow.is_some() { - if let Ok(v) = app.run("slideshow.togglePause", json!({})) { - app.toast(ctx, crate::i18n::tr(if v["paused"] == true { "Slideshow paused" } else { "Slideshow resumed" })); - } - continue; - } - // flag/rate aliases (Shift+X…) go through the culling path: active photo in Compare/Survey, - // `advance` moves to the next candidate there - if matches!(id, "photo.flag" | "photo.rate" | "photo.label") { - let mut params = params; - let advance = params.get("advance").and_then(serde_json::Value::as_bool).unwrap_or(false); - if let Some(o) = params.as_object_mut() { - o.remove("advance"); - } - cull(app, id, params, advance); - } else if let Err(e) = app.run(id, params) - && matches!(id, "app.export" | "app.exportPrevious") - { - // an export that can't start (e.g. no folder) says why instead of doing nothing - app.toast(ctx, e); + if matches(i, Modifiers::SHIFT, *key) && !taken.contains(&(Modifiers::SHIFT, *key)) { + fire.push(format!("rate:{n}:1")); } } - let rotate_fires = fire.iter().any(|f| f == "crop.rotateAspect"); - for f in fire { - // a slideshow: ←/→ step (a cut) - if app.ui.slideshow.is_some() && matches!(f.as_str(), "library.next" | "library.previous") { - let _ = app.run(if f == "library.next" { "slideshow.next" } else { "slideshow.previous" }, json!({})); - continue; + for (label, key, sc) in [("red", Key::Num6, "6"), ("yellow", Key::Num7, "7"), ("green", Key::Num8, "8"), ("blue", Key::Num9, "9")] { + if matches(i, Modifiers::NONE, key) && !native(sc) && !taken.contains(&(Modifiers::NONE, key)) { + fire.push(format!("label:{label}")); } - if let Some(rest) = f.strip_prefix("rate:") { - let (n, adv) = rest.split_once(':').unwrap_or(("0", "0")); - cull(app, "photo.rate", json!({"rating": n.parse::().unwrap_or(0)}), adv == "1"); - let label = if n == "0" { - crate::i18n::tr("Rating cleared").to_string() - } else { - crate::i18n::tr_format!("Rated {}", "★".repeat(n.parse().unwrap_or(0))) - }; - app.toast(ctx, label); - } else if matches!(f.as_str(), "photo.decreaseRating" | "photo.increaseRating") { - cull(app, &f, json!({}), false); - } else if let Some(l) = f.strip_prefix("label:") { - cull(app, "photo.label", json!({"label": l}), false); - } else if f == "panel.presets" && library_grid(app) { - // Classic's Shift+P picks and advances in Library; keep the Presets binding elsewhere. - cull(app, "photo.flag", json!({"flag": "pick"}), true); - } else if f == "view.softProof" && matches!(app.ui.view, crate::state::ViewMode::PhotoGrid | crate::state::ViewMode::SquareGrid) { - // S in a grid: expand / collapse the stack (Lightroom's Library binding) - let _ = app.run("stack.toggle", json!({})); - } else if f == "grid:first" || f == "grid:last" { - // Home / End in a grid: make the first / last photo of the view the active, selected one - let vis = app.session.visible_cloned(); - let edge = if f == "grid:first" { vis.first() } else { vis.last() }; - if let Some(id) = edge { - let _ = app.run("library.select", json!({"ids": [id.0], "active": id.0})); - } - } else if let Some(step) = f.strip_prefix("grid:extend:") { - // Shift+← / Shift+→ in a grid: the neighbour of the active photo joins the selection and - // becomes the active one. At either end of the view the key does nothing. - let step = step.parse::().unwrap_or(0); - let vis = app.session.visible_cloned(); - let neighbour = app - .session - .active() - .and_then(|active| vis.iter().position(|p| *p == active)) - .and_then(|pos| i64::try_from(pos).ok()) - .and_then(|pos| pos.checked_add(step)) - .and_then(|pos| usize::try_from(pos).ok()) - .and_then(|pos| vis.get(pos)); - if let Some(id) = neighbour { - let _ = app.run("library.select", json!({"ids": [id.0], "mode": "add"})); - } - } else if compare::culling(app) && (f == "library.next" || f == "library.previous") { - let d = if f == "library.next" { 1 } else { -1 }; - let _ = if app.ui.view == crate::state::ViewMode::Compare { compare::compare_step(app, d) } else { compare::survey_step(app, d) }; - } else if matches!(f.as_str(), "photo.cycleFlag" | "photo.increaseFlag" | "photo.decreaseFlag") { - // `, ⌘↑, ⌘↓: step the flag; the toast names the active photo's new state (read before Auto Advance moves on) - let active = app.session.active(); - cull(app, &f, json!({}), false); - let flag = active.and_then(|id| app.session.catalog.photo(id)).map(|p| p.flag); - match flag { - Some(lightcraft_catalog::Flag::Pick) => app.toast(ctx, crate::i18n::tr("Flagged as Pick")), - Some(lightcraft_catalog::Flag::Reject) => app.toast(ctx, crate::i18n::tr("Flagged as Reject")), - Some(lightcraft_catalog::Flag::None) => app.toast(ctx, crate::i18n::tr("Unflagged")), - None => {} - } - } else if matches!(f.as_str(), "photo.pick" | "photo.reject" | "photo.unflag") && app.ui.right != crate::state::RightPanel::Crop { - cull(app, &f, json!({}), false); - match f.as_str() { - "photo.pick" => app.toast(ctx, crate::i18n::tr("Flagged as Pick")), - "photo.reject" => app.toast(ctx, crate::i18n::tr("Flagged as Reject")), - _ => app.toast(ctx, crate::i18n::tr("Unflagged")), - } + } + if !grid_navigation { + return; + } + // Home / End: the first / last photo of the view + for (key, id) in [(Key::Home, "grid:first"), (Key::End, "grid:last")] { + if matches(i, Modifiers::NONE, key) && !taken.contains(&(Modifiers::NONE, key)) { + fire.push(id.to_string()); + } + } + // Shift+← / Shift+→: the previous / next photo of the view joins the selection + for (key, step) in [(Key::ArrowLeft, -1i64), (Key::ArrowRight, 1)] { + if matches(i, Modifiers::SHIFT, key) && !taken.contains(&(Modifiers::SHIFT, key)) { + fire.push(format!("grid:extend:{step}")); + } + } +} + +/// Rating/flag/label keys: in Compare/Survey they act on the active photo only; `advance` (Shift+key) or +/// Auto Advance then moves on (next candidate in Compare, next photo elsewhere). +fn cull(app: &mut LightcraftApp, id: &str, mut params: serde_json::Value, advance: bool) { + use crate::panels::compare; + compare::target_active(app, &mut params); + let was = app.session.active(); + let ok = app.run(id, params).is_ok(); + if ok && (advance || app.ui.auto_advance) { + compare::advance(app, was); + } +} + +/// Run a fixed alias (a second key for a command). +fn fire_alias(app: &mut LightcraftApp, ctx: &egui::Context, id: &str, params: serde_json::Value) { + // a slideshow: Space pauses / resumes + if id == "view.zoomToggle" && app.ui.slideshow.is_some() { + if let Ok(v) = app.run("slideshow.togglePause", json!({})) { + app.toast(ctx, crate::i18n::tr(if v["paused"] == true { "Slideshow paused" } else { "Slideshow resumed" })); + } + return; + } + // flag/rate aliases (Shift+X…) go through the culling path: active photo in Compare/Survey, + // `advance` moves to the next candidate there + if matches!(id, "photo.flag" | "photo.rate" | "photo.label") { + let mut params = params; + let advance = params.get("advance").and_then(serde_json::Value::as_bool).unwrap_or(false); + if let Some(o) = params.as_object_mut() { + o.remove("advance"); + } + cull(app, id, params, advance); + } else if let Err(e) = app.run(id, params) + && matches!(id, "app.export" | "app.exportPrevious") + { + // an export that can't start (e.g. no folder) says why instead of doing nothing + app.toast(ctx, e); + } +} + +/// The toast naming a flag. +fn flag_toast(app: &mut LightcraftApp, ctx: &egui::Context, flag: lightcraft_catalog::Flag) { + use lightcraft_catalog::Flag; + app.toast( + ctx, + crate::i18n::tr(match flag { + Flag::Pick => "Flagged as Pick", + Flag::Reject => "Flagged as Reject", + Flag::None => "Unflagged", + }), + ); +} + +/// Run one fired command. +fn fire_command(app: &mut LightcraftApp, ctx: &egui::Context, f: &str, rotate_fires: bool) { + // a slideshow: ←/→ step (a cut) + if app.ui.slideshow.is_some() && matches!(f, "library.next" | "library.previous") { + let _ = app.run(if f == "library.next" { "slideshow.next" } else { "slideshow.previous" }, json!({})); + return; + } + if fire_rating_key(app, ctx, f) || fire_grid_key(app, f) || fire_flag_key(app, ctx, f) { + return; + } + // in the full-screen preview (no panels) I cycles the info overlay instead + if f == "panel.info" && app.ui.fullscreen { + let _ = app.run("view.infoOverlay", json!({})); + return; + } + if (f == "photo.delete" && delete_key(app, ctx)) || (f == "tool.brush" && brush_key(app, ctx)) || context_key_skipped(app, f, rotate_fires) { + return; + } + if matches!(f, "library.up" | "library.down") { + up_down_key(app, ctx, f); + return; + } + // an export that can't start (e.g. no folder) says why instead of doing nothing + if let Err(e) = app.run(f, json!({})) + && matches!(f, "app.export" | "app.exportPrevious") + { + app.toast(ctx, e); + } + match f { + "photo.pick" => flag_toast(app, ctx, lightcraft_catalog::Flag::Pick), + "photo.reject" => flag_toast(app, ctx, lightcraft_catalog::Flag::Reject), + "photo.unflag" => flag_toast(app, ctx, lightcraft_catalog::Flag::None), + "edit.undo" => app.toast(ctx, crate::i18n::tr("Undo")), + "edit.redo" => app.toast(ctx, crate::i18n::tr("Redo")), + _ => {} + } +} + +/// Rating and colour label keys; whether `f` was one. +fn fire_rating_key(app: &mut LightcraftApp, ctx: &egui::Context, f: &str) -> bool { + if let Some(rest) = f.strip_prefix("rate:") { + let (n, adv) = rest.split_once(':').unwrap_or(("0", "0")); + cull(app, "photo.rate", json!({"rating": n.parse::().unwrap_or(0)}), adv == "1"); + let label = if n == "0" { + crate::i18n::tr("Rating cleared").to_string() } else { - // in the full-screen preview (no panels) I cycles the info overlay instead - if f == "panel.info" && app.ui.fullscreen { - let _ = app.run("view.infoOverlay", json!({})); - continue; + crate::i18n::tr_format!("Rated {}", "★".repeat(n.parse().unwrap_or(0))) + }; + app.toast(ctx, label); + } else if matches!(f, "photo.decreaseRating" | "photo.increaseRating") { + cull(app, f, json!({}), false); + } else if let Some(l) = f.strip_prefix("label:") { + cull(app, "photo.label", json!({"label": l}), false); + } else { + return false; + } + true +} + +/// The keys of a grid or of Compare / Survey that move the active photo or the selection; whether `f` was one. +fn fire_grid_key(app: &mut LightcraftApp, f: &str) -> bool { + use crate::panels::compare; + if f == "panel.presets" && library_grid(app) { + // Classic's Shift+P picks and advances in Library; keep the Presets binding elsewhere. + cull(app, "photo.flag", json!({"flag": "pick"}), true); + } else if f == "view.softProof" && library_grid(app) { + // S in a grid: expand / collapse the stack (Lightroom's Library binding) + let _ = app.run("stack.toggle", json!({})); + } else if f == "grid:first" || f == "grid:last" { + // Home / End in a grid: make the first / last photo of the view the active, selected one + let vis = app.session.visible_cloned(); + let edge = if f == "grid:first" { vis.first() } else { vis.last() }; + if let Some(id) = edge { + let _ = app.run("library.select", json!({"ids": [id.0], "active": id.0})); + } + } else if let Some(step) = f.strip_prefix("grid:extend:") { + extend_selection(app, step.parse::().unwrap_or(0)); + } else if compare::culling(app) && (f == "library.next" || f == "library.previous") { + let d = if f == "library.next" { 1 } else { -1 }; + let _ = if app.ui.view == crate::state::ViewMode::Compare { compare::compare_step(app, d) } else { compare::survey_step(app, d) }; + } else { + return false; + } + true +} + +/// Shift+← / Shift+→ in a grid: the neighbour of the active photo joins the selection and +/// becomes the active one. At either end of the view the key does nothing. +fn extend_selection(app: &mut LightcraftApp, step: i64) { + let vis = app.session.visible_cloned(); + let neighbour = app + .session + .active() + .and_then(|active| vis.iter().position(|p| *p == active)) + .and_then(|pos| i64::try_from(pos).ok()) + .and_then(|pos| pos.checked_add(step)) + .and_then(|pos| usize::try_from(pos).ok()) + .and_then(|pos| vis.get(pos)); + if let Some(id) = neighbour { + let _ = app.run("library.select", json!({"ids": [id.0], "mode": "add"})); + } +} + +/// The flag keys; whether `f` was one. +fn fire_flag_key(app: &mut LightcraftApp, ctx: &egui::Context, f: &str) -> bool { + if matches!(f, "photo.cycleFlag" | "photo.increaseFlag" | "photo.decreaseFlag") { + // `, ⌘↑, ⌘↓: step the flag; the toast names the active photo's new state (read before Auto Advance moves on) + let active = app.session.active(); + cull(app, f, json!({}), false); + if let Some(flag) = active.and_then(|id| app.session.catalog.photo(id)).map(|p| p.flag) { + flag_toast(app, ctx, flag); + } + true + } else if matches!(f, "photo.pick" | "photo.reject" | "photo.unflag") && app.ui.right != crate::state::RightPanel::Crop { + cull(app, f, json!({}), false); + let flag = match f { + "photo.pick" => lightcraft_catalog::Flag::Pick, + "photo.reject" => lightcraft_catalog::Flag::Reject, + _ => lightcraft_catalog::Flag::None, + }; + flag_toast(app, ctx, flag); + true + } else { + false + } +} + +/// Delete acts on what's being edited: the active mask in the Masking panel; never the photo while retouching (spots +/// are removed from their own panel). Whether the key was used up. +fn delete_key(app: &mut LightcraftApp, ctx: &egui::Context) -> bool { + use crate::state::RightPanel as R; + match app.ui.right { + R::Masking => { + if app.session.active_mask.is_some() { + let _ = app.run("mask.delete", json!({})); } - // Delete acts on what's being edited: the active mask in the Masking panel; never the - // photo while retouching (spots are removed from their own panel). - if f == "photo.delete" { - use crate::state::RightPanel as R; - match app.ui.right { - R::Masking => { - if app.session.active_mask.is_some() { - let _ = app.run("mask.delete", json!({})); - } - continue; - } - R::Remove => { - if app.session.active_spot.is_some() { - let _ = app.run("spot.delete", json!({})); - } - continue; - } - R::Crop if app.ui.tool == "guidedUpright" => { - // Delete removes the selected guide alone; with none selected it removes - // nothing (the photo itself is never deleted while the tool is open) - if let (Some((photo, i)), Some(active)) = (app.ui.selected_guide, app.session.active()) { - if photo == active.0 - && let Some(d) = app.session.develop_of(active) - && i < d.geometry.guides.len() - { - let guides: Vec<[f64; 4]> = - d.geometry.guides.iter().enumerate().filter(|(k, _)| *k != i).map(|(_, (a, b))| [a.x, a.y, b.x, b.y]).collect(); - let _ = app.run("geometry.guides", json!({"guides": guides})); - } - app.ui.selected_guide = None; - } - continue; - } - R::RedEye => continue, - _ => {} - } - // in an album, Delete takes the photos out of the album only, as in Lightroom: they - // stay in the library and their folder (issue #1805) - if crate::menus::delete_in_album(app, ctx) { - continue; - } - if crate::menus::confirm_delete(app) { - continue; - } + return true; + } + R::Remove => { + if app.session.active_spot.is_some() { + let _ = app.run("spot.delete", json!({})); } - // B: the brush while editing; in the grids, add to the target album (Quick Collection) - if f == "tool.brush" && matches!(app.ui.view, crate::state::ViewMode::PhotoGrid | crate::state::ViewMode::SquareGrid) { - if let Ok(r) = app.run("album.toggleTarget", json!({})) { - let n = app.session.selected().len(); - let what = crate::i18n::tr_format!("{n} photo{}", if n == 1 { "" } else { "s" }, n = n); - let name = r["name"].as_str().unwrap_or("Quick Collection").to_string(); - app.toast( - ctx, - if r["added"] == true { - crate::i18n::tr_format!("Added {what} to {name}", name = name, what = what) - } else { - crate::i18n::tr_format!("Removed {what} from {name}", name = name, what = what) - }, - ); - } - continue; - } - // X is both reject (library) and swap crop aspect (crop tool). When both bindings fire, - // swap once: twice would put the crop straight back (issue #1866). - if f == "photo.reject" && app.ui.right == crate::state::RightPanel::Crop { - if !rotate_fires { - let _ = app.run("crop.rotateAspect", json!({})); - } - continue; - } - if f == "crop.rotateAspect" && app.ui.right != crate::state::RightPanel::Crop { - continue; - } - // A is both Visualize Spots and the crop aspect lock: each key only in its own context - if f == "view.visualizeSpots" && app.ui.right == crate::state::RightPanel::Crop { - continue; - } - if f == "crop.lockAspect" && app.ui.right != crate::state::RightPanel::Crop { - continue; - } - // / refreshes the selected spot's source in the Remove tool (the filmstrip elsewhere) - if f == "view.filmstrip" && app.ui.right == crate::state::RightPanel::Remove && app.session.active_spot.is_some() { - let _ = app.run("spot.refreshSource", json!({})); - continue; - } - // Shift+O cycles the mask overlay colour while masking (the crop overlay elsewhere) - if f == "view.cropOverlay" && app.ui.right == crate::state::RightPanel::Masking { - let _ = app.run("view.maskOverlayColor", json!({})); - continue; - } - // while cropping: O cycles the guides, Shift+O their orientation - if app.ui.right == crate::state::RightPanel::Crop { - let crop_key = match f.as_str() { - "view.maskOverlay" => Some(("view.cropOverlay", json!({}))), - "view.cropOverlay" => Some(("view.cropOverlayOrientation", json!({}))), - _ => None, - }; - if let Some((cmd, p)) = crop_key { - let _ = app.run(cmd, p); - continue; - } - } - // Up / Down in the grids go to the cell above / below (the filmstrip steps one photo) - if matches!(f.as_str(), "library.up" | "library.down") { - // over a slider the arrows nudge it (widgets::slider takes the key) - let over_slider = - ctx.pointer_hover_pos().is_some_and(|p| app.widgets.iter().any(|(id, r)| id.starts_with("slider:") && r.contains(p))); - if over_slider { - continue; - } - match crate::panels::grid::row_distance(app, f == "library.down") { - Some(0) => {} - Some(rows) => { - let _ = app.run(&f, json!({"rows": rows})); - } - None => { - let _ = app.run(&f, json!({})); - } - } - continue; - } - // an export that can't start (e.g. no folder) says why instead of doing nothing - if let Err(e) = app.run(&f, json!({})) - && matches!(f.as_str(), "app.export" | "app.exportPrevious") - { - app.toast(ctx, e); - } - match f.as_str() { - "photo.pick" => app.toast(ctx, crate::i18n::tr("Flagged as Pick")), - "photo.reject" => app.toast(ctx, crate::i18n::tr("Flagged as Reject")), - "photo.unflag" => app.toast(ctx, crate::i18n::tr("Unflagged")), - "edit.undo" => app.toast(ctx, crate::i18n::tr("Undo")), - "edit.redo" => app.toast(ctx, crate::i18n::tr("Redo")), - _ => {} + return true; + } + R::Crop if app.ui.tool == "guidedUpright" => { + delete_selected_guide(app); + return true; + } + R::RedEye => return true, + _ => {} + } + // in an album, Delete takes the photos out of the album only, as in Lightroom: they + // stay in the library and their folder (issue #1805) + crate::menus::delete_in_album(app, ctx) || crate::menus::confirm_delete(app) +} + +/// Delete removes the selected guide alone; with none selected it removes nothing (the photo itself is never deleted +/// while the tool is open). +fn delete_selected_guide(app: &mut LightcraftApp) { + let (Some((photo, i)), Some(active)) = (app.ui.selected_guide, app.session.active()) else { return }; + if photo == active.0 + && let Some(d) = app.session.develop_of(active) + && i < d.geometry.guides.len() + { + let guides: Vec<[f64; 4]> = d.geometry.guides.iter().enumerate().filter(|(k, _)| *k != i).map(|(_, (a, b))| [a.x, a.y, b.x, b.y]).collect(); + let _ = app.run("geometry.guides", json!({"guides": guides})); + } + app.ui.selected_guide = None; +} + +/// B: the brush while editing; in the grids, add to the target album (Quick Collection). Whether the key was used up. +fn brush_key(app: &mut LightcraftApp, ctx: &egui::Context) -> bool { + if !library_grid(app) { + return false; + } + if let Ok(r) = app.run("album.toggleTarget", json!({})) { + let n = app.session.selected().len(); + let what = crate::i18n::tr_format!("{n} photo{}", if n == 1 { "" } else { "s" }, n = n); + let name = r["name"].as_str().unwrap_or("Quick Collection").to_string(); + app.toast( + ctx, + if r["added"] == true { + crate::i18n::tr_format!("Added {what} to {name}", name = name, what = what) + } else { + crate::i18n::tr_format!("Removed {what} from {name}", name = name, what = what) + }, + ); + } + true +} + +/// Keys that two bindings share, and that mean something only in one panel: whether `f` was used up (or ignored) +/// here, so nothing else runs for it. +fn context_key_skipped(app: &mut LightcraftApp, f: &str, rotate_fires: bool) -> bool { + use crate::state::RightPanel as R; + let right = app.ui.right; + match f { + // X is both reject (library) and swap crop aspect (crop tool). When both bindings fire, + // swap once: twice would put the crop straight back (issue #1866). + "photo.reject" if right == R::Crop => { + if !rotate_fires { + let _ = app.run("crop.rotateAspect", json!({})); } + true + } + "crop.rotateAspect" => right != R::Crop, + // A is both Visualize Spots and the crop aspect lock: each key only in its own context + "view.visualizeSpots" => right == R::Crop, + "crop.lockAspect" => right != R::Crop, + // / refreshes the selected spot's source in the Remove tool (the filmstrip elsewhere) + "view.filmstrip" if right == R::Remove && app.session.active_spot.is_some() => { + let _ = app.run("spot.refreshSource", json!({})); + true + } + // Shift+O cycles the mask overlay colour while masking (the crop overlay elsewhere) + "view.cropOverlay" if right == R::Masking => { + let _ = app.run("view.maskOverlayColor", json!({})); + true + } + // while cropping: O cycles the guides, Shift+O their orientation + "view.maskOverlay" if right == R::Crop => { + let _ = app.run("view.cropOverlay", json!({})); + true + } + "view.cropOverlay" if right == R::Crop => { + let _ = app.run("view.cropOverlayOrientation", json!({})); + true + } + _ => false, + } +} + +/// Up / Down in the grids go to the cell above / below (the filmstrip steps one photo). +fn up_down_key(app: &mut LightcraftApp, ctx: &egui::Context, f: &str) { + // over a slider the arrows nudge it (widgets::slider takes the key) + let over_slider = ctx.pointer_hover_pos().is_some_and(|p| app.widgets.iter().any(|(id, r)| id.starts_with("slider:") && r.contains(p))); + if over_slider { + return; + } + match crate::panels::grid::row_distance(app, f == "library.down") { + Some(0) => {} + Some(rows) => { + let _ = app.run(f, json!({"rows": rows})); + } + None => { + let _ = app.run(f, json!({})); } } } From 627804c161ae0b001ac88f01194e6b6b7253d25c Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 20:20:44 +0000 Subject: [PATCH 67/93] refactor(ui-egui): split import finish and print settings --- crates/ui-egui/src/dialogs/import/task.rs | 74 +++++++++++++---------- crates/ui-egui/src/dialogs/print_view.rs | 46 +++++++++----- 2 files changed, 73 insertions(+), 47 deletions(-) diff --git a/crates/ui-egui/src/dialogs/import/task.rs b/crates/ui-egui/src/dialogs/import/task.rs index c41a941a31..da2c1574f6 100644 --- a/crates/ui-egui/src/dialogs/import/task.rs +++ b/crates/ui-egui/src/dialogs/import/task.rs @@ -422,33 +422,29 @@ fn xmp_warnings_text(warnings: &[ImportWarning]) -> String { ) } -/// The import is done (or cancelled): one undo step, show and select the first photo (unless the -/// user chose another meanwhile), say what happened. -fn finish(app: &mut LightcraftApp, ctx: &egui::Context, task: ImportTask) { - let steps = app.session.undo.len().saturating_sub(task.undo0); - let plural = |n: usize| if n == 1 { "" } else { "s" }; - let label = if task.imported == 0 && task.restored > 0 { +/// `s` for a count other than one. +fn plural(n: usize) -> &'static str { + if n == 1 { "" } else { "s" } +} + +/// The name of the import's one undo step. +fn undo_label(task: &ImportTask) -> String { + if task.imported == 0 && task.restored > 0 { crate::i18n::tr_format!("Restore {} Photo{}", task.restored, plural(task.restored)) } else if task.restored > 0 { crate::i18n::tr_format!("Add {} Photo{}, restore {}", task.imported, plural(task.imported), task.restored) } else { - crate::i18n::tr_format!("Add {} Photo{}", task.imported, if task.imported == 1 { "" } else { "s" }) - }; - app.session.merge_undo(steps, &label); - if task.auto { - if !task.warnings.is_empty() { - app.toast_for(ctx, xmp_warnings_text(&task.warnings), 8.0); - } else if task.imported > 0 { - app.toast(ctx, crate::i18n::tr_format!("Auto Import: added {} photo{}", task.imported, if task.imported == 1 { "" } else { "s" })); - } - return; + crate::i18n::tr_format!("Add {} Photo{}", task.imported, plural(task.imported)) } - if task.browse { - if !task.warnings.is_empty() { - app.toast_for(ctx, xmp_warnings_text(&task.warnings), 8.0); - } else if task.failed > 0 { - app.toast(ctx, crate::i18n::tr_format!("{} photo{} not readable", task.failed, if task.failed == 1 { "" } else { "s" })); - } +} + +/// The import is done (or cancelled): one undo step, show and select the first photo (unless the +/// user chose another meanwhile), say what happened. +fn finish(app: &mut LightcraftApp, ctx: &egui::Context, task: ImportTask) { + let steps = app.session.undo.len().saturating_sub(task.undo0); + app.session.merge_undo(steps, &undo_label(&task)); + if task.auto || task.browse { + quiet_finish(app, ctx, &task); return; } if let Some(f) = task.first.filter(|_| !task.moved_on) { @@ -459,7 +455,6 @@ fn finish(app: &mut LightcraftApp, ctx: &egui::Context, task: ImportTask) { } let _ = app.run("library.select", json!({"ids": [f]})); } - let plural = |n: usize| if n == 1 { "" } else { "s" }; // nothing new, only files the library already has: show where they are (Recently Deleted is // easy to miss, and the side panel that lists it starts collapsed) if task.imported == 0 @@ -471,6 +466,29 @@ fn finish(app: &mut LightcraftApp, ctx: &egui::Context, task: ImportTask) { { return; } + let mut msg = import_summary(app, &task); + if task.warnings.is_empty() { + app.toast(ctx, msg); + } else { + msg.push_str("\n\n"); + msg.push_str(&xmp_warnings_text(&task.warnings)); + app.toast_for(ctx, msg, 8.0); + } +} + +/// The end of an automatic import or of one that only browses: a toast only when there is something to warn about. +fn quiet_finish(app: &mut LightcraftApp, ctx: &egui::Context, task: &ImportTask) { + if !task.warnings.is_empty() { + app.toast_for(ctx, xmp_warnings_text(&task.warnings), 8.0); + } else if task.auto && task.imported > 0 { + app.toast(ctx, crate::i18n::tr_format!("Auto Import: added {} photo{}", task.imported, plural(task.imported))); + } else if !task.auto && task.failed > 0 { + app.toast(ctx, crate::i18n::tr_format!("{} photo{} not readable", task.failed, plural(task.failed))); + } +} + +/// What an import did, in a sentence. +fn import_summary(app: &LightcraftApp, task: &ImportTask) -> String { let mut msg = if task.cancelled { crate::i18n::tr_format!("Import cancelled · {} photo{} added", task.imported, plural(task.imported)) } else if task.imported == 0 && task.restored > 0 { @@ -488,7 +506,7 @@ fn finish(app: &mut LightcraftApp, ctx: &egui::Context, task: ImportTask) { } } if task.duplicates > 0 { - msg.push_str(&crate::i18n::tr_format!(" · {} duplicate{} skipped", task.duplicates, if task.duplicates == 1 { "" } else { "s" })); + msg.push_str(&crate::i18n::tr_format!(" · {} duplicate{} skipped", task.duplicates, plural(task.duplicates))); let deleted = deleted_of(app, &task.existing).len(); if deleted > 0 { msg.push_str(&crate::i18n::tr_format!(" ({} in Recently Deleted)", deleted)); @@ -497,13 +515,7 @@ fn finish(app: &mut LightcraftApp, ctx: &egui::Context, task: ImportTask) { if task.failed > 0 { msg.push_str(&crate::i18n::tr_format!(" · {} not readable", task.failed)); } - if task.warnings.is_empty() { - app.toast(ctx, msg); - } else { - msg.push_str("\n\n"); - msg.push_str(&xmp_warnings_text(&task.warnings)); - app.toast_for(ctx, msg, 8.0); - } + msg } /// The photos among `ids` that are in Recently Deleted (each once). diff --git a/crates/ui-egui/src/dialogs/print_view.rs b/crates/ui-egui/src/dialogs/print_view.rs index 82a2b564d8..c9af1d776d 100644 --- a/crates/ui-egui/src/dialogs/print_view.rs +++ b/crates/ui-egui/src/dialogs/print_view.rs @@ -196,13 +196,9 @@ pub fn body(app: &mut LightcraftApp, ui: &mut Ui, t: &Tokens) { app.ui.print = pu; } -fn settings(app: &mut LightcraftApp, ui: &mut Ui, t: &Tokens, pu: &mut PrintUi, st: &PrintSettings, photos: usize) { +/// The print templates: save the settings as one, import, and the saved ones to apply, export and delete. +fn templates_section(app: &mut LightcraftApp, ui: &mut Ui, t: &Tokens, pu: &mut PrintUi) { let ctx = ui.ctx().clone(); - let l = &st.layout; - let unit = st.guides.units; - ui.spacing_mut().item_spacing.y = 5.0; - ui.label(egui::RichText::new(crate::i18n::tr_format!("{n} photo{}", if photos == 1 { "" } else { "s" }, n = photos)).color(t.text_dim)); - heading(ui, t, "Templates"); ui.horizontal(|ui| { crate::text_field::TextField::singleline("field:printTemplateName", &mut pu.template_name) @@ -246,17 +242,13 @@ fn settings(app: &mut LightcraftApp, ui: &mut Ui, t: &Tokens, pu: &mut PrintUi, }); }); } +} - heading(ui, t, "Layout Style"); - let styles = - [(Style::SingleImage, "Single"), (Style::ContactSheet, "Contact"), (Style::PicturePackage, "Package"), (Style::CustomPackage, "Custom")]; - ui.horizontal_wrapped(|ui| { - if let Some(s) = choice(ui, "printStyle", &styles, l.style) { - patch(app, &ctx, json!({"layout": {"style": s}})); - pu.page = 0; - } - }); - +/// The image settings: zoom, rotation, border and stroke. +fn image_section(app: &mut LightcraftApp, ui: &mut Ui, t: &Tokens, st: &PrintSettings) { + let ctx = ui.ctx().clone(); + let l = &st.layout; + let unit = st.guides.units; heading(ui, t, "Image Settings"); let im = &st.image; if let Some(v) = check(ui, "printZoomFill", "Zoom to Fill Frame", im.zoom_to_fill) { @@ -292,6 +284,28 @@ fn settings(app: &mut LightcraftApp, ui: &mut Ui, t: &Tokens, pu: &mut PrintUi, patch(app, &ctx, json!({"image": {"strokeColor": c}})); } }); +} + +fn settings(app: &mut LightcraftApp, ui: &mut Ui, t: &Tokens, pu: &mut PrintUi, st: &PrintSettings, photos: usize) { + let ctx = ui.ctx().clone(); + let l = &st.layout; + let unit = st.guides.units; + ui.spacing_mut().item_spacing.y = 5.0; + ui.label(egui::RichText::new(crate::i18n::tr_format!("{n} photo{}", if photos == 1 { "" } else { "s" }, n = photos)).color(t.text_dim)); + + templates_section(app, ui, t, pu); + + heading(ui, t, "Layout Style"); + let styles = + [(Style::SingleImage, "Single"), (Style::ContactSheet, "Contact"), (Style::PicturePackage, "Package"), (Style::CustomPackage, "Custom")]; + ui.horizontal_wrapped(|ui| { + if let Some(s) = choice(ui, "printStyle", &styles, l.style) { + patch(app, &ctx, json!({"layout": {"style": s}})); + pu.page = 0; + } + }); + + image_section(app, ui, t, st); heading(ui, t, "Layout"); match l.style { From 335defee474b9563f3b19ac630e5b7104d2832ec Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 20:25:31 +0000 Subject: [PATCH 68/93] refactor(ui-egui): one function per dialog body --- crates/ui-egui/src/dialogs.rs | 2309 ++++++++++++++++++--------------- 1 file changed, 1266 insertions(+), 1043 deletions(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 772303ffbf..1e5ae5e2d2 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -220,1049 +220,7 @@ pub fn show(app: &mut LightcraftApp, ctx: &egui::Context, blocked: bool) { ui.disable(); } ui.spacing_mut().item_spacing.y = 8.0; - body_h = dialog_body(ui, (!import && !print).then_some(title.as_str()), body_max, |ui| match &mut dlg { - Dialog::AutoStack { gap } => { - ui.label(egui::RichText::new(crate::i18n::tr("Stack photos taken within this time of each other:")).color(t.text_label)); - let r = ui.add( - egui::Slider::new(gap, 0.0..=86400.0) - .logarithmic(true) - .smallest_positive(1.0) - .custom_formatter(|v, _| crate::panels::dialogs::fmt_gap(v)) - .custom_parser(crate::panels::dialogs::parse_gap), - ); - crate::widgets::named(r, crate::i18n::tr("Stack photos taken within this time of each other:")); - let preview = app.session.execute("stack.auto", &json!({"gap": *gap, "preview": true})).unwrap_or_default(); - let scope = if app.session.selection.ids.len() > 1 { "the selected photos" } else { "the photos in view" }; - ui.label( - egui::RichText::new(crate::i18n::tr_format!("Creates {} stacks from {} of {scope}", preview["stacks"], preview["photos"], scope = crate::i18n::tr(scope))).color(t.text_dim), - ); - } - Dialog::Cull { reject_below, pick_best, burst_gap, similarity } => { - let n = app.session.selection.ids.len(); - let scope = if n > 1 { crate::i18n::tr_format!("the {n} selected photos", n = n) } else { crate::i18n::tr_format!("the {} photos in view", app.session.visible_cloned().len()) }; - ui.label(egui::RichText::new(crate::i18n::tr_format!("Scores {scope} for focus and exposure and finds similar shots taken within seconds of each other (bursts).", scope = scope)).color(t.text_label)); - ui.add_space(6.0); - let r = ui.add(egui::Slider::new(reject_below, 0.0..=80.0).text(crate::i18n::tr("Reject below focus")).step_by(1.0)); - crate::widgets::register(ui, "field:cullReject", r.rect); - ui.label(egui::RichText::new(crate::i18n::tr(if *reject_below > 0.0 { "Blurry photos below the score are flagged as rejects." } else { "0: nothing is rejected." })).color(t.text_dim)); - let r = ui.checkbox(pick_best, crate::i18n::tr("Pick the sharpest photo of each burst")); - crate::widgets::register(ui, "check:cullPick", r.rect); - ui.add_space(6.0); - // the sliders drag over the usual range; their value fields take whatever - // `photo.analyze` accepts (a gap of 0 s to a day, a similarity of 0 to 1) - let r = ui.add( - egui::Slider::new(burst_gap, 1.0..=600.0) - .logarithmic(true) - .smallest_positive(1.0) - .clamping(egui::SliderClamping::Never) - .text(crate::i18n::tr("Burst: shots at most this far apart")) - .custom_formatter(|v, _| crate::panels::dialogs::fmt_gap(v)) - .custom_parser(crate::panels::dialogs::parse_gap), - ); - crate::widgets::register(ui, "field:cullGap", r.rect); - let r = ui.add( - egui::Slider::new(similarity, 0.70..=0.99) - .clamping(egui::SliderClamping::Never) - .text(crate::i18n::tr("Burst: how alike (loose … strict)")) - // a typed 0.995 is kept (whole hundredths would round it to 1.00) - .step_by(0.001) - .min_decimals(2) - .max_decimals(3), - ); - crate::widgets::register(ui, "field:cullSimilar", r.rect); - clamp_cull_burst(burst_gap, similarity); - ui.label(egui::RichText::new(crate::i18n::tr("Lower it when a panning or moving burst splits into several groups.")).color(t.text_dim)); - ui.label(egui::RichText::new(crate::i18n::tr("Scores stay on the photos: filter or make smart albums with Focus and Best of Similar Shots.")).color(t.text_dim)); - } - Dialog::WhatsNew => { - egui::ScrollArea::vertical().max_height(list_height(ui, 460.0)).auto_shrink([false, true]).show(ui, |ui| { - for line in WHATS_NEW.lines() { - let l = line.trim_end(); - if let Some(h) = l.strip_prefix("### ") { - ui.add_space(6.0); - ui.label(egui::RichText::new(crate::i18n::tr(h)).font(t.semibold(12.5)).color(t.text)); - } else if let Some(h) = l.strip_prefix("## ") { - ui.add_space(8.0); - ui.label(egui::RichText::new(crate::i18n::tr(h)).font(t.semibold(14.0)).color(t.text)); - } else if l.starts_with("# ") || l.is_empty() { - } else if let Some(b) = l.strip_prefix("- ") { - ui.label(egui::RichText::new(format!("• {}", crate::i18n::tr(b).replace('`', ""))).color(t.text_label)); - } else { - ui.label(egui::RichText::new(crate::i18n::tr(l.trim()).replace('`', "")).color(t.text_label)); - } - } - }); - } - Dialog::DenoiseModel { info, accepted } => crate::panels::denoise::model_dialog(app, ui, &t, info, accepted), - Dialog::FaceModel { info, accepted, .. } => crate::panels::faces::model_dialog(app, ui, &t, info, accepted), - Dialog::LightroomResult { summary, library, details, .. } => { - ui.label(summary.as_str()); - ui.add_space(8.0); - if let Some(library) = library { - ui.label(crate::i18n::tr("Destination library")); - ui.add(egui::Label::new(library.as_str()).wrap().selectable(true)); - ui.label(crate::i18n::tr("Lightroom catalogs import into the open library; no separate catalog folder is created.")); - } else { - ui.label(crate::i18n::tr("These photos are only in memory. Open a library on disk and import the catalog again to save them.")); - } - for detail in details.iter() { - ui.add(egui::Label::new(detail).wrap().selectable(true)); - } - } - Dialog::SystemInfo { rows } => { - egui::Grid::new("sysinfo").num_columns(2).spacing([16.0, 4.0]).striped(true).show(ui, |ui| { - for (k, v) in rows.iter() { - ui.label(egui::RichText::new(crate::i18n::tr(k)).color(t.text_dim)); - ui.add(egui::Label::new(egui::RichText::new(v).color(t.text_label)).wrap()); - ui.end_row(); - } - }); - if ui.button(crate::i18n::tr("Copy to Clipboard")).clicked() { - let text: String = rows.iter().map(|(k, v)| format!("{k}: {v}\n")).collect(); - ui.ctx().copy_text(text); - } - } - Dialog::AllMetadata { title, rows, search } => { - ui.label(egui::RichText::new(title.as_str()).color(t.text_label)); - let r = crate::widgets::named(ui.add(egui::TextEdit::singleline(search).hint_text(crate::i18n::tr("Filter fields")).desired_width(f32::INFINITY)), crate::i18n::tr("Filter fields")); - crate::widgets::register(ui, "field:metadataSearch", r.rect); - let q = search.trim().to_lowercase(); - let keep = |n: &str, v: &str| q.is_empty() || n.to_lowercase().contains(&q) || v.to_lowercase().contains(&q); - let mut groups: Vec<(String, Vec<(String, String)>)> = Vec::new(); - for row in rows["exif"].as_array().into_iter().flatten() { - let (g, n, v) = (row["group"].as_str().unwrap_or(""), row["name"].as_str().unwrap_or(""), row["value"].as_str().unwrap_or("")); - if !keep(n, v) { - continue; - } - match groups.iter_mut().find(|(x, _)| x == g) { - Some((_, list)) => list.push((n.into(), v.into())), - None => groups.push((g.into(), vec![(n.into(), v.into())])), - } - } - let xmp: Vec<(String, String)> = rows["xmp"] - .as_array() - .into_iter() - .flatten() - .map(|r| (r["name"].as_str().unwrap_or("").to_string(), r["value"].as_str().unwrap_or("").to_string())) - .filter(|(n, v)| keep(n, v)) - .collect(); - if !xmp.is_empty() { - groups.push(("XMP".into(), xmp)); - } - egui::ScrollArea::vertical().max_height(list_height(ui, 440.0)).auto_shrink([false, true]).show(ui, |ui| { - if groups.is_empty() { - ui.label(egui::RichText::new(crate::i18n::tr(rows["note"].as_str().unwrap_or("No metadata found"))).color(t.text_dim)); - } - for (g, list) in &groups { - ui.add_space(6.0); - ui.label(egui::RichText::new(g).font(t.semibold(12.5)).color(t.text)); - egui::Grid::new(format!("meta-{g}")).num_columns(2).spacing([16.0, 3.0]).striped(true).show(ui, |ui| { - for (n, v) in list { - ui.label(egui::RichText::new(n).color(t.text_dim)); - ui.add(egui::Label::new(egui::RichText::new(v).color(t.text_label)).wrap()); - ui.end_row(); - } - }); - } - }); - } - Dialog::SmartRules { id, name, rules, .. } => { - let r = crate::widgets::named(ui.add(egui::TextEdit::singleline(name).hint_text(crate::i18n::tr("Name")).desired_width(f32::INFINITY)), crate::i18n::tr("Name")); - crate::widgets::register(ui, "field:smartName", r.rect); - ui.add_space(6.0); - // the folder an album made from a folder view carries is not in the editor, but it counts - let folder = id.and_then(|id| app.session.catalog.album(lightcraft_catalog::AlbumId(id))).and_then(|a| a.smart.as_deref().and_then(|f| f.library_folder.clone())); - // problems, count and albums: cached until the catalog or the rules change (not per frame) - let now = (app.session.clock)(); - let view = app.caches.rules_view(&app.session.catalog, rules, *id, folder, &now); - let env = crate::panels::rules_editor::Env { problems: view.problems.clone(), today: now, albums: view.albums.clone() }; - egui::ScrollArea::vertical().max_height(list_height(ui, 360.0)).auto_shrink([false, true]).show(ui, |ui| { - crate::panels::rules_editor::edit(ui, rules, "rules", 0, &[], &env); - }); - let n = view.count; - ui.add_space(4.0); - if view.problems.is_empty() { - ui.label( - egui::RichText::new(crate::i18n::tr_format!("{n} photo{} match · updates automatically as photos change", if n == 1 { "" } else { "s" }, n = n)) - .color(t.text_dim), - ); - } else { - ui.label(egui::RichText::new(crate::i18n::tr("Fix the marked rules to save this album.")).color(t.caution)); - } - } - Dialog::NewSmartAlbum { name, .. } => { - if dialog_field(ui, "field:smartAlbumName", name, "Name") { - confirm = true; - } - let rules = app.session.view_rules(); - // counted when the library or the rules change (or, for "in the last…" rules, the minute), not every frame - let now = (app.session.clock)(); - let minute = if rules.depends_on_now() { now.get(..16).unwrap_or(&now) } else { "" }; - let n = app.caches.dialog_count(&app.session.catalog, ("smartAlbum", format!("{rules:?}"), minute), || { - lightcraft_catalog::rules::set_now(Some(now.clone())); - app.session.catalog.query(&rules, &Default::default()).len() - }); - ui.label(egui::RichText::new(crate::i18n::tr_format!("Matches: {}", crate::i18n::filter_label(&rules, &app.session.catalog))).color(t.text_label)); - ui.label( - egui::RichText::new(crate::i18n::tr_format!("{n} photo{} now · updates automatically as photos change", if n == 1 { "" } else { "s" }, n = n)) - .color(t.text_dim), - ); - } - Dialog::CaptureTime { mode, time, days, hours, minutes, zone } => { - let n = app.session.selected().len(); - field(ui, "Change", |ui| { - ui.spacing_mut().item_spacing.x = 4.0; - for (i, (label, m)) in [("Set date & time", "set"), ("Shift by", "shift"), ("Time zone", "zone")].iter().enumerate() { - if crate::widgets::text_button(ui, &format!("captureMode-{i}"), label, mode == m).clicked() { - *mode = m.to_string(); - } - } - }); - let params = match mode.as_str() { - "set" => { - field(ui, "New time", |ui| { - let r = ui.add(egui::TextEdit::singleline(time).hint_text("2026-09-30 14:05:00").desired_width(f32::INFINITY)); - crate::widgets::register(ui, "field:captureTime", r.rect); - }); - json!({"time": time}) - } - "shift" => { - field(ui, "Shift", |ui| { - ui.add(egui::DragValue::new(days).suffix(" d")); - ui.add(egui::DragValue::new(hours).suffix(" h")); - ui.add(egui::DragValue::new(minutes).suffix(" min")); - }); - json!({"shift": *days as i64 * 86_400 + *hours as i64 * 3600 + *minutes as i64 * 60}) - } - _ => { - field(ui, "Hours", |ui| ui.add(egui::DragValue::new(zone).range(-26.0..=26.0).speed(0.25).fixed_decimals(2))); - json!({"hours": zone}) - } - }; - // preview on the active photo (the others move by the same amount) - let active = app.session.active().and_then(|id| app.session.catalog.photo(id)).map(|p| (p.file_name.clone(), p.date().to_string())); - if let Some((name, cur)) = active { - let delta = match mode.as_str() { - "set" => lightcraft_catalog::dates::normalize_iso(time) - .and_then(|t| Some(lightcraft_catalog::dates::iso_seconds(&t)? - lightcraft_catalog::dates::iso_seconds(&cur)?)), - "shift" => params["shift"].as_i64(), - _ => Some((*zone as f64 * 3600.0).round() as i64), - }; - // the photo's own time is the problem (a Lightroom catalog's capture time - // is copied verbatim), not what was typed - let unreadable = lightcraft_catalog::dates::shift_iso(&cur, 0).is_none(); - let after = match (mode.as_str(), unreadable && n == 1) { - // alone, it simply gets the time typed (photo.setCaptureTime repairs it) - ("set", true) => lightcraft_catalog::dates::normalize_iso(time), - _ => delta.and_then(|d| lightcraft_catalog::dates::shift_iso(&cur, d)), - }; - ui.label( - egui::RichText::new(match after { - Some(a) => format!("{name}: {} → {}", cur.replace('T', " "), a.replace('T', " ")), - None if unreadable && !(mode == "set" && n == 1) => crate::i18n::tr("The active photo's capture time can't be read").to_string(), - None => "Enter a date as YYYY-MM-DD HH:MM:SS".into(), - }) - .color(t.text_label), - ); - } - if n > 1 { - ui.label(egui::RichText::new(crate::i18n::tr_format!("All {n} selected photos move by the same amount.", n = n)).color(t.text_dim)); - } - } - Dialog::LabelNames { names, save_as } => { - names.resize(5, String::new()); - // start from a set - let sets = lightcraft_engine::cmd::manage::label_sets_json(&app.session); - field(ui, "Set", |ui| { - ui.spacing_mut().item_spacing.x = 4.0; - for set in sets["sets"].as_array().into_iter().flatten() { - let name = set["name"].as_str().unwrap_or_default(); - if crate::widgets::text_button(ui, &format!("labelSet-{name}"), name, false).clicked() { - *names = set["names"].as_array().into_iter().flatten().map(|n| n.as_str().unwrap_or_default().to_string()).collect(); - } - } - }); - for (i, l) in lightcraft_catalog::ColorLabel::ALL.iter().enumerate() { - let colour = format!("{l:?}"); - field(ui, &colour, |ui| { - let (r, _) = ui.allocate_exact_size(egui::vec2(14.0, 14.0), egui::Sense::hover()); - ui.painter().circle_filled(r.center(), 6.0, crate::panels::grid::label_color(*l)); - let te = crate::widgets::named(ui.add(egui::TextEdit::singleline(&mut names[i]).hint_text(colour.as_str()).desired_width(f32::INFINITY)), crate::i18n::tr(&colour)); - crate::widgets::register(ui, format!("field:labelName-{}", colour.to_lowercase()), te.rect); - }); - } - field(ui, "Save as set", |ui| { - let te = crate::widgets::named(ui.add(egui::TextEdit::singleline(save_as).hint_text(crate::i18n::tr("Optional name")).desired_width(f32::INFINITY)), crate::i18n::tr("Save as set")); - crate::widgets::register(ui, "field:labelSetName", te.rect); - }); - ui.label( - egui::RichText::new(crate::i18n::tr("Names appear in the label menu, the filter bar and the Info panel, and are written to XMP. Empty = the colour's name.")) - .color(t.text_dim), - ); - } - Dialog::Rename { template, start } => { - let n = app.session.selected().len(); - ui.label(egui::RichText::new(crate::i18n::tr_format!("{n} photo{}", if n == 1 { "" } else { "s" }, n = n)).color(t.text_dim)); - let template_id = egui::Id::unique("rename-template"); - let tags_open = field(ui, "Template", |ui| { - ui.spacing_mut().item_spacing.x = 4.0; - let w = crate::import::tag_field_width(ui); - let r = crate::widgets::named(ui.add(egui::TextEdit::singleline(template).id(template_id).hint_text("{name}").desired_width(w)), crate::i18n::tr("Template")); - crate::widgets::register(ui, "field:renameTemplate", r.rect); - crate::import::tag_toggle(ui, "renameTemplate") - }); - if tags_open { - crate::import::tag_help(ui, "renameTemplate", template, template_id); - } - crate::import::unknown_tags_warning(ui, template); - field(ui, "Presets", |ui| { - ui.spacing_mut().item_spacing.x = 4.0; - for (i, (label, tpl)) in - [("Name", "{name}"), ("Date–Name", "{date}_{name}"), ("Title–Seq", "{title}-{seq:3}"), ("Custom–Seq", "Photo-{seq:3}")].iter().enumerate() - { - if crate::widgets::text_button(ui, &format!("renamePreset-{i}"), label, template == tpl).clicked() { - *template = tpl.to_string(); - } - } - }); - field(ui, "Start at", |ui| ui.add(egui::DragValue::new(start).range(0..=999_999))); - ui.label( - egui::RichText::new(crate::i18n::tr("Tags: see Tags beside the template. Files are renamed on disk (with their XMP sidecars); existing names get -1, -2…")) - .color(t.text_dim), - ); - let (preview, total) = rename_preview(app, ui.ctx(), template, *start as usize); - match &preview { - Some(rows) => { - egui::Grid::new("rename-preview").num_columns(3).spacing([8.0, 2.0]).show(ui, |ui| { - for pl in rows { - ui.label(egui::RichText::new(&pl.from).color(t.text_dim)); - let (arrow, _) = ui.allocate_exact_size(egui::vec2(16.0, 16.0), egui::Sense::hover()); - crate::icons::paint(ui.painter(), arrow, crate::icons::Icon::ChevronRight, t.text_dim); - ui.label(egui::RichText::new(&pl.to).color(t.text)); - ui.end_row(); - } - }); - } - None => { - ui.horizontal(|ui| { - crate::progress::spinner(ui, 12.0); - ui.label(egui::RichText::new(crate::i18n::tr("Checking names…")).color(t.text_dim)); - }); - } - } - let more = total.saturating_sub(RENAME_PREVIEW_ROWS); - if more > 0 { - ui.label(egui::RichText::new(crate::i18n::tr_format!("… and {more} more", more = more)).color(t.text_dim)); - } - } - Dialog::RenamePerson { from, to, merge } => { - let submitted = dialog_field(ui, "field:personName", to, "Name"); - let plan = person_rename_plan(&app.session.catalog, from, to); - if !plan.needs_merge { - *merge = false; - } - if submitted && plan.block.is_none() && (!plan.needs_merge || *merge) { - confirm = true; - } - if let Some(why) = plan.block { - ui.label(egui::RichText::new(crate::i18n::tr(why)).color(t.caution)); - } else { - ui.label( - egui::RichText::new(crate::i18n::tr_format!( - "Renames {n} face{} across the library. The files are not changed.", - if plan.faces == 1 { "" } else { "s" }, - n = plan.faces - )) - .color(t.text_dim), - ); - } - if plan.needs_merge { - ui.label( - egui::RichText::new(crate::i18n::tr_format!("“{to}” is already a person. Combining them makes one person; Undo separates them again.", to = to.trim())) - .color(t.caution), - ); - let r = ui.checkbox(merge, crate::i18n::tr("Combine with the existing person")); - crate::widgets::register(ui, "check:personMerge", r.rect); - } - } - Dialog::RenameKeyword { from, to } => { - let n = app.caches.dialog_count(&app.session.catalog, ("renameKeyword", from.as_str()), || { - app.session.catalog.photos().filter(|p| p.meta.keywords.iter().any(|k| lightcraft_catalog::keywords::is_under(k, from))).count() - }); - if dialog_field(ui, "field:keywordName", to, "New name") { - confirm = true; - } - ui.label( - egui::RichText::new(crate::i18n::tr_format!("Renames “{from}” on {n} photo{} (keywords below it too). Use | for levels, e.g. Travel|Italy. An existing name merges the two.", - if n == 1 { "" } else { "s" }, from = from, n = n)) - .color(t.text_dim), - ); - } - Dialog::MergeKeywords { from, into } => { - ui.label(egui::RichText::new(crate::i18n::tr_format!("Replace {} with:", from.iter().map(|f| format!("“{f}”")).collect::>().join(", "))).color(t.text_label)); - if dialog_field(ui, "field:keywordInto", into, "Keyword") { - confirm = true; - } - let options: Vec = app - .caches - .suggestions(&app.session.catalog, from, into, 12) - .iter() - .filter(|k| !from.iter().any(|f| lightcraft_catalog::keywords::is_under(k, f))) - .cloned() - .collect(); - ui.horizontal_wrapped(|ui| { - for k in options { - if ui.add(egui::Button::new(egui::RichText::new(&k).color(t.text_label)).corner_radius(10.0)).clicked() { - *into = k; - } - } - }); - } - Dialog::TextPrompt { value, hint, .. } => { - if dialog_field(ui, "field:prompt", value, hint) { - confirm = true; - } - } - Dialog::NewAlbum { name, folder, include_selected, .. } => { - if dialog_field(ui, "field:albumName", name, "Name") { - confirm = true; - } - // as in Lightroom, the option is only there when something is selected - if !*folder && !app.session.selected().is_empty() { - ui.add_space(6.0); - let r = ui.checkbox(include_selected, crate::i18n::tr("Include selected photos")); - crate::widgets::register(ui, "check:albumIncludeSelected", r.rect); - } - } - Dialog::RenameAlbum { name, .. } => { - if dialog_field(ui, "field:albumName", name, "Name") { - confirm = true; - } - } - Dialog::CreatePreset { name, group, groups } => { - crate::widgets::named(ui.add(egui::TextEdit::singleline(name).hint_text(crate::i18n::tr("Preset name")).desired_width(f32::INFINITY)), crate::i18n::tr("Preset name")); - crate::widgets::named(ui.add(egui::TextEdit::singleline(group).hint_text(crate::i18n::tr("Group")).desired_width(f32::INFINITY)), crate::i18n::tr("Group")); - ui.label(egui::RichText::new(crate::i18n::tr("Settings to include")).color(t.text_dim)); - group_checklist(ui, "presetInclude", groups); - } - Dialog::CopySettings { groups } => group_checklist(ui, "copyGroup", groups), - Dialog::PasteSettings { groups } => { - let n = app.session.selected().len(); - ui.label( - egui::RichText::new(crate::i18n::tr_format!("Paste into {n} photo{} — only settings that were copied are pasted", if n == 1 { "" } else { "s" }, n = n)) - .color(t.text_dim), - ); - group_checklist(ui, "pasteGroup", groups); - } - Dialog::SlideshowExport { settings } => slideshow_export_body(app, ui, settings), - Dialog::ContactSheet { options } => { - options.columns = options.columns.clamp(1, 8); - options.rows = options.rows.clamp(1, 10); - let n = app.session.selected().len(); - ui.label(crate::i18n::tr_format!("{n} selected photos · {pages} pages", n = n, pages = n.div_ceil(options.columns * options.rows))); - field(ui, "Paper", |ui| { - let c = crate::widgets::combo_box("contactSheetPaper").selected_text(&options.paper).show_ui(ui, |ui| { - ui.selectable_value(&mut options.paper, "a4".into(), "A4"); - ui.selectable_value(&mut options.paper, "letter".into(), crate::i18n::tr("Letter")); - }); - crate::widgets::name_combo(&c.response, crate::i18n::tr("Paper")); - }); - ui.checkbox(&mut options.landscape, crate::i18n::tr("Landscape")); - field(ui, "Columns", |ui| { ui.add(egui::DragValue::new(&mut options.columns).range(1..=8)); }); - field(ui, "Rows", |ui| { ui.add(egui::DragValue::new(&mut options.rows).range(1..=10)); }); - ui.checkbox(&mut options.captions, crate::i18n::tr("Filename captions")); - ui.label(crate::i18n::tr("150 dpi · sRGB · current edits · fit without cropping")); - ui.label(crate::i18n::tr("Choose a PDF destination after confirming. Print the PDF from your viewer.")); - } - Dialog::Export { opts, full_size, resize, preset_name, limit_kb, dir } => { - use lightcraft_engine::export::{ExportFormat as F, MetadataPolicy as M, SharpenAmount as A, SharpenFor as S}; - let n = app.session.selection.ids.len().max(1); - ui.label(egui::RichText::new(crate::i18n::tr_format!("{n} photo{}", if n == 1 { "" } else { "s" }, n = n)).color(t.text_dim)); - // Preset: load a built-in or saved set of options into the dialog - field(ui, "Preset", |ui| { - let mut chosen = None; - let c = crate::widgets::combo_box("exportPreset").width(220.0).selected_text(crate::i18n::tr("Choose…")).show_ui(ui, |ui| { - let mut builtin = true; - for (p, b) in app.session.all_export_presets() { - if builtin && !b { - ui.separator(); - } - builtin = b; - if ui.selectable_label(false, crate::i18n::builtin_label(&p.name, b)).clicked() { - chosen = Some(p.name); - } - } - }); - crate::widgets::name_combo(&c.response, crate::i18n::tr("Preset")); - crate::widgets::register(ui, "combo:exportPreset", c.response.rect); - if let Some(name) = chosen - && let Ok(params) = app.session.export_params(&json!({"preset": name})) - { - let o = lightcraft_engine::export::ExportOptions::from_json(¶ms); - *full_size = o.resize.is_none(); - *resize = o.resize.unwrap_or_default(); - *limit_kb = o.limit_kb.unwrap_or(0); - *opts = o; - } - }); - ui.add_space(4.0); - let before = opts.format; - // "Rendered DNG" is a DNG option (below), not a format of its own in this list - let mut shown = if opts.format == F::RenderedDng { F::Dng } else { opts.format }; - choices( - ui, - "Format", - "exportFormat", - &[(F::Jpeg, "JPEG"), (F::Png, "PNG"), (F::Tiff, "TIFF"), (F::Psd, "PSD"), (F::Webp, "WebP"), (F::Avif, "AVIF"), (F::Jxl, "JPEG XL"), (F::Dng, "DNG"), (F::Original, "Original files")], - &mut shown, - ); - if shown != opts.format && !(shown == F::Dng && opts.format == F::RenderedDng) { - opts.format = shown; - } - if matches!(opts.format, F::Dng | F::RenderedDng) { - choices(ui, "DNG of", "exportDngKind", &[(F::Dng, "Raw data"), (F::RenderedDng, "Rendered photo")], &mut opts.format); - } - if !opts.format.is_rendered() { - let note = if opts.format == F::Dng { - "Raw photos as DNG, with the edits embedded. Size, color and output options don't apply." - } else { - "The original files, unchanged, each with an XMP sidecar holding its edits." - }; - ui.label(egui::RichText::new(note).color(t.text_dim)); - } - if opts.format != before { - // each format starts at its own default depth (TIFF 16-bit, others 8-bit) - opts.bit_depth = None; - } - let rendered = opts.format.is_rendered(); - let depths = lightcraft_engine::export::ExportOptions::bit_depths(opts.format); - if rendered && depths.len() > 1 { - let mut bd = opts.bit_depth.filter(|b| depths.iter().any(|d| d.0 == *b)).unwrap_or(depths[0].0); - choices(ui, "Bit depth", "exportBitDepth", depths, &mut bd); - opts.bit_depth = Some(bd); - } - if matches!(opts.format, F::Jpeg | F::Tiff | F::Avif | F::Png | F::Jxl) { - let tip = crate::i18n::tr("Photos edited in HDR: JPEG with an HDR gain map (looks right everywhere, brighter highlights on HDR displays), AVIF as 10-bit, PNG and JPEG XL as 16-bit Rec. 2020 PQ; TIFF needs 32-bit float"); - ui.checkbox(&mut opts.hdr, crate::i18n::tr("HDR output")).on_hover_text(tip); - if opts.hdr && !opts.hdr_output() { - ui.label(egui::RichText::new(crate::i18n::tr("HDR TIFF needs 32-bit float.")).color(t.text_dim)); - } - if opts.hdr && opts.format == F::Avif { - use lightcraft_engine::export::HdrCurve as H; - choices(ui, "HDR curve", "exportHdrCurve", &[(H::Pq, "PQ"), (H::Hlg, "HLG")], &mut opts.hdr_transfer); - } - } - if !rendered { - } else if opts.format == F::Avif && opts.hdr { - let label = if opts.hdr_transfer == lightcraft_engine::export::HdrCurve::Hlg { - crate::i18n::tr("Color space: Rec. 2020 HLG (HDR AVIF)") - } else { - crate::i18n::tr("Color space: Rec. 2020 PQ (HDR AVIF)") - }; - ui.label(egui::RichText::new(label).color(t.text_dim)); - } else if opts.format == F::Png && opts.hdr { - ui.label(egui::RichText::new(crate::i18n::tr("Color space: Rec. 2020 PQ, 16-bit (HDR PNG)")).color(t.text_dim)) - .on_hover_text(crate::i18n::tr("Viewers that don't read the PNG cICP chunk show PQ values as sRGB: flat and washed out. For a picture that looks right everywhere, use JPEG (gain map).")); - } else if opts.format == F::Jxl && opts.hdr { - ui.label(egui::RichText::new(crate::i18n::tr("Color space: Rec. 2020 PQ (HDR JPEG XL)")).color(t.text_dim)); - } else if opts.format == F::Avif { - ui.label(egui::RichText::new(crate::i18n::tr("Color space: sRGB (AVIF)")).color(t.text_dim)); - } else { - use lightcraft_engine::export::OutputSpace as C; - choices( - ui, - "Color space", - "exportColorSpace", - &[ - (C::Srgb, "sRGB"), - (C::DisplayP3, "P3"), - (C::AdobeRgb, "Adobe RGB"), - (C::ProPhoto, "ProPhoto"), - (C::Rec2020, "Rec.2020"), - ], - &mut opts.color_space, - ); - if opts.effective_space() != opts.color_space { - let note = "Lossy JPEG XL writes Adobe RGB and ProPhoto as Rec. 2020; choose Lossless to keep them."; - ui.label(egui::RichText::new(crate::i18n::tr(note)).color(t.text_dim)); - } - } - if opts.format == F::Jxl { - let tip = "Mathematically lossless: every pixel is kept exactly (larger files)"; - ui.checkbox(&mut opts.jxl_lossless, crate::i18n::tr("Lossless")).on_hover_text(crate::i18n::tr(tip)); - } - if matches!(opts.format, F::Jpeg | F::Avif) || (opts.format == F::Jxl && !opts.jxl_lossless) { - let mut q = opts.quality as f64; - if num(ui, &QUALITY, &mut q) { - opts.quality = q as u8; - } - } - if opts.format == F::Jxl { - use lightcraft_engine::export::JxlEffort as E; - choices(ui, "Effort", "exportJxlEffort", &[(E::Fast, "Fast"), (E::Normal, "Normal")], &mut opts.jxl_effort); - let tip = "Shows a coarse version first and refines it as the file loads"; - ui.checkbox(&mut opts.jxl_progressive, crate::i18n::tr("Progressive")).on_hover_text(crate::i18n::tr(tip)); - } - if opts.format == F::Jpeg { - let mut k = *limit_kb as f64; - if num(ui, &LIMIT_KB, &mut k) { - *limit_kb = k as u32; - } - } - if rendered { - export_size(ui, full_size, resize, &mut opts.ppi); - } - if rendered { - choices( - ui, - "Sharpen", - "exportSharpen", - &[(S::None, "None"), (S::Screen, "Screen"), (S::Matte, "Matte"), (S::Glossy, "Glossy")], - &mut opts.sharpen, - ); - if opts.sharpen != S::None { - choices( - ui, - "Amount", - "exportSharpenAmount", - &[(A::Low, "Low"), (A::Standard, "Standard"), (A::High, "High")], - &mut opts.sharpen_amount, - ); - } - } - if rendered { - choices( - ui, - "Metadata", - "exportMetadata", - &[(M::All, "All"), (M::AllExceptCamera, "No camera"), (M::Copyright, "Copyright"), (M::None, "None")], - &mut opts.metadata, - ); - if !matches!(opts.metadata, M::None | M::Copyright) { - ui.checkbox(&mut opts.remove_location, crate::i18n::tr("Remove location info")); - } - let mut wm_on = opts.watermark.is_some(); - if ui.checkbox(&mut wm_on, crate::i18n::tr("Watermark")).changed() { - opts.watermark = wm_on.then(|| lightcraft_engine::export::Watermark { text: "© ".into(), ..Default::default() }); - } - let wm_shown = opts.watermark.clone(); - if let Some(wm) = &wm_shown { - watermark_preview(app, ui, wm, (!*full_size).then_some(*resize)); - } - if let Some(wm) = &mut opts.watermark { - // text, or a graphic (a logo with transparency) - let mut graphic = !wm.image.is_empty() || ui.data(|d| d.get_temp::(egui::Id::unique("wm-graphic"))).unwrap_or(false); - let before = graphic; - choices(ui, "Style", "exportWmStyle", &[(false, "Text"), (true, "Graphic")], &mut graphic); - if graphic != before { - ui.data_mut(|d| d.insert_temp(egui::Id::unique("wm-graphic"), graphic)); - if !graphic { - wm.image.clear(); - } - } - if graphic { - field(ui, "Graphic", |ui| { - trailing_button_row(ui, |ui| { - if app.services.pick_files.is_some() - && crate::widgets::text_button(ui, "exportWmChoose", crate::i18n::tr("Choose…"), false).clicked() - && let Some(f) = app.services.pick_files.as_mut().and_then(|pick| pick().into_iter().next()) - { - wm.image = f; - } - crate::widgets::named(ui.add(egui::TextEdit::singleline(&mut wm.image).hint_text("logo.png").desired_width(ui.available_width())), crate::i18n::tr("Image")); - }); - }); - let mut width = wm.image_width as f64 * 100.0; - if num(ui, &WM_IMAGE_WIDTH, &mut width) { - wm.image_width = (width / 100.0) as f32; - } - } else { - choices(ui, app.ui.language.tr("Text direction"), "exportWmOrientation", &[(false, app.ui.language.tr("Horizontal text")), (true, app.ui.language.tr("Vertical text"))], &mut wm.vertical); - field(ui, "Text", |ui| { - crate::widgets::named(ui.add(egui::TextEdit::multiline(&mut wm.text).desired_rows(2).hint_text(crate::i18n::tr("© Your Name")).desired_width(f32::INFINITY)), crate::i18n::tr("Text")) - }); - } - choices( - ui, - "Position", - "exportWmAnchor", - &WM_POSITIONS, - &mut wm.anchor, - ); - choices(ui, "Rotate", "exportWmRotation", &[(0u16, "0°"), (90, "90°"), (180, "180°"), (270, "270°")], &mut wm.rotation); - let mut size = wm.size as f64 * 100.0; - if !graphic && num(ui, &WM_SIZE, &mut size) { - wm.size = (size / 100.0) as f32; - } - let mut op = wm.opacity as f64 * 100.0; - if num(ui, &WM_OPACITY, &mut op) { - wm.opacity = (op / 100.0) as f32; - } - // like Lightroom Classic: a margin from the side edges and one from the top and bottom - // edges, each unused (greyed) when the position is centred along that axis - use lightcraft_engine::export::Anchor as P; - let across = !matches!(wm.anchor, P::Top | P::Center | P::Bottom); - if let Some(v) = crate::widgets::slider(ui, &WM_INSET_X, wm.inset_x as f64 * 100.0, across, None).value { - wm.inset_x = (v / 100.0) as f32; - } - let down = !matches!(wm.anchor, P::Left | P::Center | P::Right); - if let Some(v) = crate::widgets::slider(ui, &WM_INSET_Y, wm.inset_y as f64 * 100.0, down, None).value { - wm.inset_y = (v / 100.0) as f32; - } - if !graphic { - ui.checkbox(&mut wm.shadow, crate::i18n::tr("Shadow")); - } - } - if opts.watermark != wm_shown { - // the preview above was drawn with the old settings - ui.ctx().request_repaint(); - } - } - ui.add_space(4.0); - if opts.format == F::Tiff { - use lightcraft_engine::export::TiffCompression as Z; - choices(ui, "Compression", "exportTiffCompression", &[(Z::None, "None"), (Z::Lzw, "LZW"), (Z::Deflate, "ZIP")], &mut opts.tiff_compression); - } - if opts.format == F::Dng { - use lightcraft_engine::export::DngCompression as Z; - choices(ui, "Compression", "exportDngCompression", &[(Z::Lossless, "Lossless"), (Z::Deflate, "ZIP"), (Z::Uncompressed, "None"), (Z::Lossy, "Lossy")], &mut opts.dng_compression); - } - let naming_id = egui::Id::unique("export-naming"); - let tags_open = field(ui, "File name", |ui| { - ui.spacing_mut().item_spacing.x = 4.0; - let w = crate::import::tag_field_width(ui); - crate::widgets::named(ui.add(egui::TextEdit::singleline(&mut opts.naming).id(naming_id).hint_text("{name}-{seq} · {date} · {title} · {folder}").desired_width(w)), crate::i18n::tr("File name")); - crate::import::tag_toggle(ui, "exportNaming") - }); - if tags_open { - crate::import::tag_help(ui, "exportNaming", &mut opts.naming, naming_id); - } - crate::import::unknown_tags_warning(ui, &opts.naming); - if opts.naming.contains("{seq") { - let mut v = opts.start_number as f64; - if num(ui, &START_NUMBER, &mut v) { - opts.start_number = v as u32; - } - } - // like Lightroom Classic's Export To: one folder, or each photo's own folder (not on - // the web, where originals live in the browser's storage, not in folders) - use lightcraft_engine::export::DestinationMode as D; - if !cfg!(target_arch = "wasm32") || opts.destination_mode != D::SpecificFolder { - choices( - ui, - "Export to", - "exportDestinationMode", - &[(D::SpecificFolder, "Specific folder"), (D::SameAsOriginal, "Same folder as original photo")], - &mut opts.destination_mode, - ); - } - if opts.destination_mode == D::SpecificFolder { - field(ui, "Folder", |ui| { - trailing_button_row(ui, |ui| { - if app.services.pick_folder.is_some() - && crate::widgets::text_button(ui, "exportChooseFolder", crate::i18n::tr("Choose…"), false).clicked() - && let Some(pick) = app.services.pick_folder.as_mut() - && let Some(d) = pick() - { - *dir = d; - } - crate::widgets::named(ui.add(egui::TextEdit::singleline(dir).desired_width(ui.available_width())), crate::i18n::tr("Folder")); - }); - }); - } - field(ui, "Subfolder", |ui| { - crate::widgets::named(ui.add(egui::TextEdit::singleline(&mut opts.subfolder).hint_text(crate::i18n::tr("none")).desired_width(f32::INFINITY)), crate::i18n::tr("Subfolder")) - }); - use lightcraft_engine::export::Conflict as K; - choices( - ui, - "If file exists", - "exportConflict", - &[(K::Unique, "Add number"), (K::Overwrite, "Overwrite"), (K::Skip, "Skip")], - &mut opts.conflict, - ); - // After export: Apple Photos imports the files written (macOS only) - #[cfg(target_os = "macos")] - { - let r = ui.checkbox(&mut opts.add_to_photos, crate::i18n::tr("Add to Apple Photos")); - crate::widgets::register(ui, "exportAddToPhotos", r.rect); - if opts.add_to_photos { - field(ui, "Album", |ui| { - crate::widgets::named(ui.add(egui::TextEdit::singleline(&mut opts.photos_album).hint_text(crate::i18n::tr("none")).desired_width(f32::INFINITY)), crate::i18n::tr("Album")) - }); - ui.label( - egui::RichText::new(crate::i18n::tr("The first time, macOS asks whether LightCraft may control Photos.")) - .size(11.0) - .color(t.text_dim), - ); - } - } - // nowhere to add them: a setting carried over from a Mac is dropped, not refused - #[cfg(not(target_os = "macos"))] - { - opts.add_to_photos = false; - } - ui.add_space(4.0); - field(ui, "Save preset", |ui| { - trailing_button_row(ui, |ui| { - let named = !preset_name.trim().is_empty(); - if crate::widgets::text_button(ui, "exportSavePreset", crate::i18n::tr("Save"), false).clicked() && named { - let params = export_dialog_params(opts, *full_size, resize, *limit_kb); - match app.run("export.savePreset", json!({"name": preset_name.trim(), "params": params})) { - Ok(_) => { - app.toast(ui.ctx(), crate::i18n::tr_format!("Saved export preset “{}”", preset_name.trim())); - preset_name.clear(); - } - Err(e) => app.toast(ui.ctx(), e), - } - } - crate::widgets::named(ui.add(egui::TextEdit::singleline(preset_name).hint_text(crate::i18n::tr("Preset name")).desired_width(ui.available_width())), crate::i18n::tr("Preset name")); - }); - }); - } - Dialog::Merge { opts } => crate::merge::body(app, ui, opts), - Dialog::Import { opts } => crate::import::body(app, ui, opts), - // (Settings is never taller than `body_max`, so the scroll area round it never - // scrolls: its tab bar stays put and its pages scroll by themselves) - Dialog::Settings { tab } => crate::panels::settings::window(app, ui, tab, body_max), - Dialog::SamModel { error, .. } => sam_model_body(app, ui, error.as_deref()), - Dialog::KeywordTag { - editing, - name, - parent, - inside, - synonyms, - include_on_export, - export_containing, - export_synonyms, - person, - add_to_selected, - .. - } => { - ui.label(egui::RichText::new(crate::i18n::tr("Keyword Name")).color(t.text_dim)); - // several fields: the name takes the focus when the dialog opens, not after - let r = crate::text_field::TextField::singleline("field:keywordTagName", name) - .hint(crate::i18n::tr("Keyword Name")) - .width(f32::INFINITY) - .select_on_focus(true) - .show(ui); - if ui.is_enabled() && just_opened(ui, "keyword-tag") { - r.response.request_focus(); - } - if r.ending == Some(crate::text_field::Ending::Return) { - confirm = true; - } - ui.add_space(4.0); - ui.label(egui::RichText::new(crate::i18n::tr("Synonyms")).color(t.text_dim)); - // Return in either field creates (or saves) the keyword - let r = crate::text_field::TextField::singleline("field:keywordSynonyms", synonyms) - .hint(crate::i18n::tr("Separated by commas")) - .width(f32::INFINITY) - .show(ui); - if r.ending == Some(crate::text_field::Ending::Return) { - confirm = true; - } - ui.add_space(6.0); - if editing.is_none() { - if let Some(p) = parent { - let r = ui.checkbox(inside, crate::i18n::tr_format!("Put inside “{parent}”", parent = p.replace('|', " › "))); - crate::widgets::register(ui, "check:keywordInside", r.rect); - } - let n = app.session.selection.ids.len(); - let r = ui.add_enabled(n > 0, egui::Checkbox::new(add_to_selected, crate::i18n::tr("Add to Selected Photos"))); - crate::widgets::register(ui, "check:keywordAddToSelected", r.rect); - ui.add_space(4.0); - } - ui.label(egui::RichText::new(crate::i18n::tr("Keyword Tag Options")).color(t.text_dim)); - for (on, label, id) in [ - (include_on_export, "Include on Export", "check:keywordIncludeOnExport"), - (export_containing, "Export Containing Keywords", "check:keywordExportContaining"), - (export_synonyms, "Export Synonyms", "check:keywordExportSynonyms"), - (person, "Person", "check:keywordPerson"), - ] { - let r = ui.checkbox(on, crate::i18n::tr(label)); - crate::widgets::register(ui, id, r.rect); - } - } - Dialog::KeywordSet { replaces, name, slots, as_new } => { - ui.label(egui::RichText::new(crate::i18n::tr("Set name")).color(t.text_dim)); - let r = crate::text_field::TextField::singleline("field:keywordSetName", name) - .hint(crate::i18n::tr("Set name")) - .width(f32::INFINITY) - .select_on_focus(true) - .show(ui); - if ui.is_enabled() && just_opened(ui, "keyword-set") { - r.response.request_focus(); - } - let mut returned = r.ending == Some(crate::text_field::Ending::Return); - ui.add_space(6.0); - ui.label(egui::RichText::new(crate::i18n::tr("Keywords (⌥1–⌥9)")).color(t.text_dim)); - slots.resize(9, String::new()); - // equal columns of a set width (the window is still finding its own) - let w = 130.0; - egui::Grid::new("keyword-set-slots").num_columns(3).min_col_width(w).spacing([6.0, 4.0]).show(ui, |ui| { - for (i, slot) in slots.iter_mut().enumerate() { - let r = crate::text_field::TextField::singleline(&format!("field:keywordSetSlot:{}", i + 1), slot) - .hint(format!("⌥{}", i + 1)) - .width(w) - .show(ui); - returned |= r.ending == Some(crate::text_field::Ending::Return); - if i % 3 == 2 { - ui.end_row(); - } - } - }); - if replaces.is_some() { - ui.add_space(6.0); - let r = ui.checkbox(as_new, crate::i18n::tr("Save as a new set")); - crate::widgets::register(ui, "check:keywordSetAsNew", r.rect); - } - // Return in any field saves the set - if returned { - confirm = true; - } - } - Dialog::MoveKeyword { keyword, parent } => { - let name = keyword.rsplit('|').next().unwrap_or(keyword); - match parent { - Some(p) => ui.label(crate::i18n::tr_format!( - "“{parent}” has a “{name}” already. Merge the two?", - parent = p.replace('|', " › "), - name = name - )), - None => ui.label(crate::i18n::tr_format!("There is a “{name}” at the top level already. Merge the two?", name = name)), - }; - ui.label(egui::RichText::new(crate::i18n::tr("Their photos and the keywords below them come together under one keyword.")).color(t.text_dim)); - } - Dialog::DeleteKeyword { keyword, count } => { - let name = keyword.replace('|', " › "); - ui.label(crate::i18n::tr_format!("Delete the keyword “{name}”?", name = name)); - ui.label( - egui::RichText::new(if *count == 0 { - crate::i18n::tr("No photo has it; the keywords below it go too.").to_string() - } else { - crate::i18n::tr_format!( - "It is taken off {count} photo{}, with the keywords below it. Undo brings it back.", - if *count == 1 { "" } else { "s" }, - count = count - ) - }) - .color(t.text_dim), - ); - } - Dialog::SaveEffect { name, group, fields, amount, brush } => { - if crate::panels::mask_effects::save_body(app, ui, name, group, fields, amount, brush) { - confirm = true; - } - } - Dialog::ManageEffects { search, selected, rename, confirm_delete, new_group } => { - crate::panels::mask_effects::manage_body(app, ui, search, selected, rename, confirm_delete, new_group) - } - Dialog::DeleteEffects { names } => { - let what = match names.as_slice() { - [one] => crate::i18n::tr_format!("Delete the effect preset “{name}”?", name = one), - _ => crate::i18n::tr_format!("Delete these {n} effect presets?", n = names.len()), - }; - ui.label(what); - ui.label(egui::RichText::new(crate::i18n::tr("Masks keep their sliders. Export presets first to keep a copy.")).color(t.text_dim)); - } - Dialog::ConfirmDelete { count } => { - let what = if *count == 1 { crate::i18n::tr("this photo").to_string() } else { crate::i18n::tr_format!("these {count} photos", count = count) }; - ui.label(crate::i18n::tr_format!("Move {what} to Recently Deleted?", what = what)); - ui.label(egui::RichText::new(crate::i18n::tr("They can be restored from Recently Deleted until it is emptied.")).color(t.text_dim)); - } - Dialog::MovePhotos { ids, name, dont_ask, .. } => { - let n = ids.len(); - ui.label(crate::i18n::tr_format!("Move {n} photo{} to “{}”?", if n == 1 { "" } else { "s" }, name, n = n)); - ui.label(egui::RichText::new(crate::i18n::tr("Their files and XMP sidecars move on disk. Edit → Undo moves them back.")).color(t.text_dim)); - ui.add_space(4.0); - let c = ui.checkbox(dont_ask, crate::i18n::tr("Don't ask again")); - crate::widgets::register(ui, "check:moveDontAsk", c.rect); - c.on_hover_text(crate::i18n::tr("Settings → Confirm before moving photos to another folder on disk turns it back on")); - } - d @ Dialog::SynchronizeFolder { .. } => crate::sync::body(app, ui, d), - Dialog::LightroomCatalog { folder, catalog } => { - ui.label(crate::i18n::tr("This is a Lightroom catalog, not a LightCraft library. Import it into a LightCraft library instead?")); - ui.label(egui::RichText::new(catalog.as_deref().unwrap_or(folder.as_str())).color(t.text_dim)); - // (the import then asks where the catalog goes, unless Settings says to merge, #2672) - let asks = app.ui.settings.lightroom_import == crate::state::LightroomImport::Ask - && app.session.library.as_ref().is_some_and(|l| l.on_disk); - let what = if asks { - "The import reads the catalog without changing it. Next, choose whether its photos, edits, keywords and collections join the library open now or go into a new library." - } else { - "The import reads the catalog without changing it and adds its photos, edits, keywords and collections to the library open now." - }; - ui.label(egui::RichText::new(crate::i18n::tr(what)).color(t.text_dim)); - } - d @ Dialog::LightroomDestination { .. } => crate::lightroom_destination::body(app, ui, d), - Dialog::RemoveFolder { name, count, path, disk } => { - ui.label(crate::i18n::tr_format!( - "Remove “{name}” and its {count} photo{} from the library?", - if *count == 1 { "" } else { "s" }, - name = name, - count = count - )); - ui.label(egui::RichText::new(path.as_str()).color(t.text_dim)); - let scope = if *disk { "All the photos imported from this disk are included." } else { "That includes the photos in the folders inside it." }; - ui.label(egui::RichText::new(crate::i18n::tr(scope)).color(t.text_dim)); - ui.label( - egui::RichText::new(crate::i18n::tr("They move to Recently Deleted and can be restored; no file on disk is touched.")) - .color(t.text_dim), - ); - } - Dialog::About => { - ui.set_min_width(680.0); - let tab_id = egui::Id::unique("about_tab"); - let mut tab = ui.data_mut(|d| d.get_temp::(tab_id)).unwrap_or(0); - ui.horizontal(|ui| { - ui.spacing_mut().item_spacing.x = 4.0; - for (i, (id, label)) in ABOUT_TABS.iter().enumerate() { - if crate::widgets::text_button(ui, &format!("aboutTab-{id}"), label, usize::from(tab) == i).clicked() { - tab = u8::try_from(i).unwrap_or(0); - } - } - }); - ui.data_mut(|d| d.insert_temp(tab_id, tab)); - ui.separator(); - match tab { - 1 => crate::credits::contributors_ui(app, ui), - 2 => crate::credits::models_ui(ui), - _ => { - ui.label(egui::RichText::new("LightCraft").font(t.semibold(20.0)).color(t.text)); - ui.label(crate::i18n::tr_format!("Version {} — a clean-room, pure-Rust photo library and raw developer.", env!("CARGO_PKG_VERSION"))); - ui.label(crate::i18n::tr_format!( - "MIT OR Apache-2.0. Fonts: {} (OFL). Icons: original.", - crate::theme::font_credits(app.chinese_font.is_some()) - )); - ui.add_space(10.0); - let r = crate::button::Button::new("Join the ArtCraft Discord") - .primary() - .large() - .min_width(260.0) - .widget("button:aboutDiscord") - .tooltip(crate::links::DISCORD) - .show(ui); - if r.clicked() { - let _ = crate::links::open(app, crate::links::DISCORD); - } - ui.add_space(6.0); - for (label, url) in [ - ("LightCraft website", crate::links::APP_PAGE), - ("Source code on GitHub", crate::links::GITHUB), - ("ArtCraft — more creative apps", crate::links::WEBSITE), - ] { - let r = ui.link(crate::i18n::tr(label)).on_hover_text(url); - if r.clicked() { - let _ = crate::links::open(app, url); - } - } - } - } - } - Dialog::Shortcuts => crate::panels::keymap::body(app, ui, &t), - Dialog::ViewOptions => crate::panels::settings::view_options(app, ui, &t), - Dialog::Print => crate::print_view::body(app, ui, &t), - }); + body_h = dialog_body(ui, (!import && !print).then_some(title.as_str()), body_max, |ui| dialog_content(app, ui, &t, body_max, &mut confirm, &mut dlg)); ui.add_space(4.0); // the confirm on the right with Cancel to its left (macOS and GNOME's order), filled with // the accent when it is the dialog's primary action. The row spans the width the window @@ -1495,3 +453,1268 @@ const BACKDROP_SHOWN: &str = "dialog-backdrop-shown"; pub fn keeps_open(app: &LightcraftApp, dlg: &Dialog) -> bool { matches!(dlg, Dialog::SamModel { .. }) && !app.session.segmenter.installed() } + +/// The body of the AutoStack dialog. +fn auto_stack_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::AutoStack { gap } = dlg else { return }; + ui.label(egui::RichText::new(crate::i18n::tr("Stack photos taken within this time of each other:")).color(t.text_label)); + let r = ui.add( + egui::Slider::new(gap, 0.0..=86400.0) + .logarithmic(true) + .smallest_positive(1.0) + .custom_formatter(|v, _| crate::panels::dialogs::fmt_gap(v)) + .custom_parser(crate::panels::dialogs::parse_gap), + ); + crate::widgets::named(r, crate::i18n::tr("Stack photos taken within this time of each other:")); + let preview = app.session.execute("stack.auto", &json!({"gap": *gap, "preview": true})).unwrap_or_default(); + let scope = if app.session.selection.ids.len() > 1 { "the selected photos" } else { "the photos in view" }; + ui.label( + egui::RichText::new(crate::i18n::tr_format!( + "Creates {} stacks from {} of {scope}", + preview["stacks"], + preview["photos"], + scope = crate::i18n::tr(scope) + )) + .color(t.text_dim), + ); +} + +/// The body of the Cull dialog. +fn cull_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::Cull { reject_below, pick_best, burst_gap, similarity } = dlg else { return }; + let n = app.session.selection.ids.len(); + let scope = if n > 1 { + crate::i18n::tr_format!("the {n} selected photos", n = n) + } else { + crate::i18n::tr_format!("the {} photos in view", app.session.visible_cloned().len()) + }; + ui.label( + egui::RichText::new(crate::i18n::tr_format!( + "Scores {scope} for focus and exposure and finds similar shots taken within seconds of each other (bursts).", + scope = scope + )) + .color(t.text_label), + ); + ui.add_space(6.0); + let r = ui.add(egui::Slider::new(reject_below, 0.0..=80.0).text(crate::i18n::tr("Reject below focus")).step_by(1.0)); + crate::widgets::register(ui, "field:cullReject", r.rect); + ui.label( + egui::RichText::new(crate::i18n::tr(if *reject_below > 0.0 { + "Blurry photos below the score are flagged as rejects." + } else { + "0: nothing is rejected." + })) + .color(t.text_dim), + ); + let r = ui.checkbox(pick_best, crate::i18n::tr("Pick the sharpest photo of each burst")); + crate::widgets::register(ui, "check:cullPick", r.rect); + ui.add_space(6.0); + // the sliders drag over the usual range; their value fields take whatever + // `photo.analyze` accepts (a gap of 0 s to a day, a similarity of 0 to 1) + let r = ui.add( + egui::Slider::new(burst_gap, 1.0..=600.0) + .logarithmic(true) + .smallest_positive(1.0) + .clamping(egui::SliderClamping::Never) + .text(crate::i18n::tr("Burst: shots at most this far apart")) + .custom_formatter(|v, _| crate::panels::dialogs::fmt_gap(v)) + .custom_parser(crate::panels::dialogs::parse_gap), + ); + crate::widgets::register(ui, "field:cullGap", r.rect); + let r = ui.add( + egui::Slider::new(similarity, 0.70..=0.99) + .clamping(egui::SliderClamping::Never) + .text(crate::i18n::tr("Burst: how alike (loose … strict)")) + // a typed 0.995 is kept (whole hundredths would round it to 1.00) + .step_by(0.001) + .min_decimals(2) + .max_decimals(3), + ); + crate::widgets::register(ui, "field:cullSimilar", r.rect); + clamp_cull_burst(burst_gap, similarity); + ui.label(egui::RichText::new(crate::i18n::tr("Lower it when a panning or moving burst splits into several groups.")).color(t.text_dim)); + ui.label( + egui::RichText::new(crate::i18n::tr("Scores stay on the photos: filter or make smart albums with Focus and Best of Similar Shots.")) + .color(t.text_dim), + ); +} + +/// The body of the WhatsNew dialog. +fn whats_new_body(ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::WhatsNew = dlg else { return }; + egui::ScrollArea::vertical().max_height(list_height(ui, 460.0)).auto_shrink([false, true]).show(ui, |ui| { + for line in WHATS_NEW.lines() { + let l = line.trim_end(); + if let Some(h) = l.strip_prefix("### ") { + ui.add_space(6.0); + ui.label(egui::RichText::new(crate::i18n::tr(h)).font(t.semibold(12.5)).color(t.text)); + } else if let Some(h) = l.strip_prefix("## ") { + ui.add_space(8.0); + ui.label(egui::RichText::new(crate::i18n::tr(h)).font(t.semibold(14.0)).color(t.text)); + } else if l.starts_with("# ") || l.is_empty() { + } else if let Some(b) = l.strip_prefix("- ") { + ui.label(egui::RichText::new(format!("• {}", crate::i18n::tr(b).replace('`', ""))).color(t.text_label)); + } else { + ui.label(egui::RichText::new(crate::i18n::tr(l.trim()).replace('`', "")).color(t.text_label)); + } + } + }); +} + +/// The body of the LightroomResult dialog. +fn lightroom_result_body(ui: &mut egui::Ui, dlg: &mut Dialog) { + let Dialog::LightroomResult { summary, library, details, .. } = dlg else { return }; + ui.label(summary.as_str()); + ui.add_space(8.0); + if let Some(library) = library { + ui.label(crate::i18n::tr("Destination library")); + ui.add(egui::Label::new(library.as_str()).wrap().selectable(true)); + ui.label(crate::i18n::tr("Lightroom catalogs import into the open library; no separate catalog folder is created.")); + } else { + ui.label(crate::i18n::tr("These photos are only in memory. Open a library on disk and import the catalog again to save them.")); + } + for detail in details.iter() { + ui.add(egui::Label::new(detail).wrap().selectable(true)); + } +} + +/// The body of the SystemInfo dialog. +fn system_info_body(ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::SystemInfo { rows } = dlg else { return }; + egui::Grid::new("sysinfo").num_columns(2).spacing([16.0, 4.0]).striped(true).show(ui, |ui| { + for (k, v) in rows.iter() { + ui.label(egui::RichText::new(crate::i18n::tr(k)).color(t.text_dim)); + ui.add(egui::Label::new(egui::RichText::new(v).color(t.text_label)).wrap()); + ui.end_row(); + } + }); + if ui.button(crate::i18n::tr("Copy to Clipboard")).clicked() { + let text: String = rows.iter().map(|(k, v)| format!("{k}: {v}\n")).collect(); + ui.ctx().copy_text(text); + } +} + +/// The body of the AllMetadata dialog. +fn all_metadata_body(ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::AllMetadata { title, rows, search } = dlg else { return }; + ui.label(egui::RichText::new(title.as_str()).color(t.text_label)); + let r = crate::widgets::named( + ui.add(egui::TextEdit::singleline(search).hint_text(crate::i18n::tr("Filter fields")).desired_width(f32::INFINITY)), + crate::i18n::tr("Filter fields"), + ); + crate::widgets::register(ui, "field:metadataSearch", r.rect); + let q = search.trim().to_lowercase(); + let keep = |n: &str, v: &str| q.is_empty() || n.to_lowercase().contains(&q) || v.to_lowercase().contains(&q); + let mut groups: Vec<(String, Vec<(String, String)>)> = Vec::new(); + for row in rows["exif"].as_array().into_iter().flatten() { + let (g, n, v) = (row["group"].as_str().unwrap_or(""), row["name"].as_str().unwrap_or(""), row["value"].as_str().unwrap_or("")); + if !keep(n, v) { + continue; + } + match groups.iter_mut().find(|(x, _)| x == g) { + Some((_, list)) => list.push((n.into(), v.into())), + None => groups.push((g.into(), vec![(n.into(), v.into())])), + } + } + let xmp: Vec<(String, String)> = rows["xmp"] + .as_array() + .into_iter() + .flatten() + .map(|r| (r["name"].as_str().unwrap_or("").to_string(), r["value"].as_str().unwrap_or("").to_string())) + .filter(|(n, v)| keep(n, v)) + .collect(); + if !xmp.is_empty() { + groups.push(("XMP".into(), xmp)); + } + egui::ScrollArea::vertical().max_height(list_height(ui, 440.0)).auto_shrink([false, true]).show(ui, |ui| { + if groups.is_empty() { + ui.label(egui::RichText::new(crate::i18n::tr(rows["note"].as_str().unwrap_or("No metadata found"))).color(t.text_dim)); + } + for (g, list) in &groups { + ui.add_space(6.0); + ui.label(egui::RichText::new(g).font(t.semibold(12.5)).color(t.text)); + egui::Grid::new(format!("meta-{g}")).num_columns(2).spacing([16.0, 3.0]).striped(true).show(ui, |ui| { + for (n, v) in list { + ui.label(egui::RichText::new(n).color(t.text_dim)); + ui.add(egui::Label::new(egui::RichText::new(v).color(t.text_label)).wrap()); + ui.end_row(); + } + }); + } + }); +} + +/// The body of the SmartRules dialog. +fn smart_rules_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::SmartRules { id, name, rules, .. } = dlg else { return }; + let r = crate::widgets::named( + ui.add(egui::TextEdit::singleline(name).hint_text(crate::i18n::tr("Name")).desired_width(f32::INFINITY)), + crate::i18n::tr("Name"), + ); + crate::widgets::register(ui, "field:smartName", r.rect); + ui.add_space(6.0); + // the folder an album made from a folder view carries is not in the editor, but it counts + let folder = id + .and_then(|id| app.session.catalog.album(lightcraft_catalog::AlbumId(id))) + .and_then(|a| a.smart.as_deref().and_then(|f| f.library_folder.clone())); + // problems, count and albums: cached until the catalog or the rules change (not per frame) + let now = (app.session.clock)(); + let view = app.caches.rules_view(&app.session.catalog, rules, *id, folder, &now); + let env = crate::panels::rules_editor::Env { problems: view.problems.clone(), today: now, albums: view.albums.clone() }; + egui::ScrollArea::vertical().max_height(list_height(ui, 360.0)).auto_shrink([false, true]).show(ui, |ui| { + crate::panels::rules_editor::edit(ui, rules, "rules", 0, &[], &env); + }); + let n = view.count; + ui.add_space(4.0); + if view.problems.is_empty() { + ui.label( + egui::RichText::new(crate::i18n::tr_format!( + "{n} photo{} match · updates automatically as photos change", + if n == 1 { "" } else { "s" }, + n = n + )) + .color(t.text_dim), + ); + } else { + ui.label(egui::RichText::new(crate::i18n::tr("Fix the marked rules to save this album.")).color(t.caution)); + } +} + +/// The body of the NewSmartAlbum dialog. +fn new_smart_album_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, confirm: &mut bool, dlg: &mut Dialog) { + let Dialog::NewSmartAlbum { name, .. } = dlg else { return }; + if dialog_field(ui, "field:smartAlbumName", name, "Name") { + *confirm = true; + } + let rules = app.session.view_rules(); + // counted when the library or the rules change (or, for "in the last…" rules, the minute), not every frame + let now = (app.session.clock)(); + let minute = if rules.depends_on_now() { now.get(..16).unwrap_or(&now) } else { "" }; + let n = app.caches.dialog_count(&app.session.catalog, ("smartAlbum", format!("{rules:?}"), minute), || { + lightcraft_catalog::rules::set_now(Some(now.clone())); + app.session.catalog.query(&rules, &Default::default()).len() + }); + ui.label( + egui::RichText::new(crate::i18n::tr_format!("Matches: {}", crate::i18n::filter_label(&rules, &app.session.catalog))).color(t.text_label), + ); + ui.label( + egui::RichText::new(crate::i18n::tr_format!( + "{n} photo{} now · updates automatically as photos change", + if n == 1 { "" } else { "s" }, + n = n + )) + .color(t.text_dim), + ); +} + +/// The body of the CaptureTime dialog. +fn capture_time_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::CaptureTime { mode, time, days, hours, minutes, zone } = dlg else { return }; + let n = app.session.selected().len(); + field(ui, "Change", |ui| { + ui.spacing_mut().item_spacing.x = 4.0; + for (i, (label, m)) in [("Set date & time", "set"), ("Shift by", "shift"), ("Time zone", "zone")].iter().enumerate() { + if crate::widgets::text_button(ui, &format!("captureMode-{i}"), label, mode == m).clicked() { + *mode = m.to_string(); + } + } + }); + let params = match mode.as_str() { + "set" => { + field(ui, "New time", |ui| { + let r = ui.add(egui::TextEdit::singleline(time).hint_text("2026-09-30 14:05:00").desired_width(f32::INFINITY)); + crate::widgets::register(ui, "field:captureTime", r.rect); + }); + json!({"time": time}) + } + "shift" => { + field(ui, "Shift", |ui| { + ui.add(egui::DragValue::new(days).suffix(" d")); + ui.add(egui::DragValue::new(hours).suffix(" h")); + ui.add(egui::DragValue::new(minutes).suffix(" min")); + }); + json!({"shift": *days as i64 * 86_400 + *hours as i64 * 3600 + *minutes as i64 * 60}) + } + _ => { + field(ui, "Hours", |ui| ui.add(egui::DragValue::new(zone).range(-26.0..=26.0).speed(0.25).fixed_decimals(2))); + json!({"hours": zone}) + } + }; + // preview on the active photo (the others move by the same amount) + let active = app.session.active().and_then(|id| app.session.catalog.photo(id)).map(|p| (p.file_name.clone(), p.date().to_string())); + if let Some((name, cur)) = active { + let delta = match mode.as_str() { + "set" => lightcraft_catalog::dates::normalize_iso(time) + .and_then(|t| Some(lightcraft_catalog::dates::iso_seconds(&t)? - lightcraft_catalog::dates::iso_seconds(&cur)?)), + "shift" => params["shift"].as_i64(), + _ => Some((*zone as f64 * 3600.0).round() as i64), + }; + // the photo's own time is the problem (a Lightroom catalog's capture time + // is copied verbatim), not what was typed + let unreadable = lightcraft_catalog::dates::shift_iso(&cur, 0).is_none(); + let after = match (mode.as_str(), unreadable && n == 1) { + // alone, it simply gets the time typed (photo.setCaptureTime repairs it) + ("set", true) => lightcraft_catalog::dates::normalize_iso(time), + _ => delta.and_then(|d| lightcraft_catalog::dates::shift_iso(&cur, d)), + }; + ui.label( + egui::RichText::new(match after { + Some(a) => format!("{name}: {} → {}", cur.replace('T', " "), a.replace('T', " ")), + None if unreadable && !(mode == "set" && n == 1) => crate::i18n::tr("The active photo's capture time can't be read").to_string(), + None => "Enter a date as YYYY-MM-DD HH:MM:SS".into(), + }) + .color(t.text_label), + ); + } + if n > 1 { + ui.label(egui::RichText::new(crate::i18n::tr_format!("All {n} selected photos move by the same amount.", n = n)).color(t.text_dim)); + } +} + +/// The body of the LabelNames dialog. +fn label_names_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::LabelNames { names, save_as } = dlg else { return }; + names.resize(5, String::new()); + // start from a set + let sets = lightcraft_engine::cmd::manage::label_sets_json(&app.session); + field(ui, "Set", |ui| { + ui.spacing_mut().item_spacing.x = 4.0; + for set in sets["sets"].as_array().into_iter().flatten() { + let name = set["name"].as_str().unwrap_or_default(); + if crate::widgets::text_button(ui, &format!("labelSet-{name}"), name, false).clicked() { + *names = set["names"].as_array().into_iter().flatten().map(|n| n.as_str().unwrap_or_default().to_string()).collect(); + } + } + }); + for (i, l) in lightcraft_catalog::ColorLabel::ALL.iter().enumerate() { + let colour = format!("{l:?}"); + field(ui, &colour, |ui| { + let (r, _) = ui.allocate_exact_size(egui::vec2(14.0, 14.0), egui::Sense::hover()); + ui.painter().circle_filled(r.center(), 6.0, crate::panels::grid::label_color(*l)); + let te = crate::widgets::named( + ui.add(egui::TextEdit::singleline(&mut names[i]).hint_text(colour.as_str()).desired_width(f32::INFINITY)), + crate::i18n::tr(&colour), + ); + crate::widgets::register(ui, format!("field:labelName-{}", colour.to_lowercase()), te.rect); + }); + } + field(ui, "Save as set", |ui| { + let te = crate::widgets::named( + ui.add(egui::TextEdit::singleline(save_as).hint_text(crate::i18n::tr("Optional name")).desired_width(f32::INFINITY)), + crate::i18n::tr("Save as set"), + ); + crate::widgets::register(ui, "field:labelSetName", te.rect); + }); + ui.label( + egui::RichText::new(crate::i18n::tr( + "Names appear in the label menu, the filter bar and the Info panel, and are written to XMP. Empty = the colour's name.", + )) + .color(t.text_dim), + ); +} + +/// The body of the Rename dialog. +fn rename_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::Rename { template, start } = dlg else { return }; + let n = app.session.selected().len(); + ui.label(egui::RichText::new(crate::i18n::tr_format!("{n} photo{}", if n == 1 { "" } else { "s" }, n = n)).color(t.text_dim)); + let template_id = egui::Id::unique("rename-template"); + let tags_open = field(ui, "Template", |ui| { + ui.spacing_mut().item_spacing.x = 4.0; + let w = crate::import::tag_field_width(ui); + let r = crate::widgets::named( + ui.add(egui::TextEdit::singleline(template).id(template_id).hint_text("{name}").desired_width(w)), + crate::i18n::tr("Template"), + ); + crate::widgets::register(ui, "field:renameTemplate", r.rect); + crate::import::tag_toggle(ui, "renameTemplate") + }); + if tags_open { + crate::import::tag_help(ui, "renameTemplate", template, template_id); + } + crate::import::unknown_tags_warning(ui, template); + field(ui, "Presets", |ui| { + ui.spacing_mut().item_spacing.x = 4.0; + for (i, (label, tpl)) in + [("Name", "{name}"), ("Date–Name", "{date}_{name}"), ("Title–Seq", "{title}-{seq:3}"), ("Custom–Seq", "Photo-{seq:3}")].iter().enumerate() + { + if crate::widgets::text_button(ui, &format!("renamePreset-{i}"), label, template == tpl).clicked() { + *template = tpl.to_string(); + } + } + }); + field(ui, "Start at", |ui| ui.add(egui::DragValue::new(start).range(0..=999_999))); + ui.label( + egui::RichText::new(crate::i18n::tr( + "Tags: see Tags beside the template. Files are renamed on disk (with their XMP sidecars); existing names get -1, -2…", + )) + .color(t.text_dim), + ); + let (preview, total) = rename_preview(app, ui.ctx(), template, *start as usize); + match &preview { + Some(rows) => { + egui::Grid::new("rename-preview").num_columns(3).spacing([8.0, 2.0]).show(ui, |ui| { + for pl in rows { + ui.label(egui::RichText::new(&pl.from).color(t.text_dim)); + let (arrow, _) = ui.allocate_exact_size(egui::vec2(16.0, 16.0), egui::Sense::hover()); + crate::icons::paint(ui.painter(), arrow, crate::icons::Icon::ChevronRight, t.text_dim); + ui.label(egui::RichText::new(&pl.to).color(t.text)); + ui.end_row(); + } + }); + } + None => { + ui.horizontal(|ui| { + crate::progress::spinner(ui, 12.0); + ui.label(egui::RichText::new(crate::i18n::tr("Checking names…")).color(t.text_dim)); + }); + } + } + let more = total.saturating_sub(RENAME_PREVIEW_ROWS); + if more > 0 { + ui.label(egui::RichText::new(crate::i18n::tr_format!("… and {more} more", more = more)).color(t.text_dim)); + } +} + +/// The body of the RenamePerson dialog. +fn rename_person_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, confirm: &mut bool, dlg: &mut Dialog) { + let Dialog::RenamePerson { from, to, merge } = dlg else { return }; + let submitted = dialog_field(ui, "field:personName", to, "Name"); + let plan = person_rename_plan(&app.session.catalog, from, to); + if !plan.needs_merge { + *merge = false; + } + if submitted && plan.block.is_none() && (!plan.needs_merge || *merge) { + *confirm = true; + } + if let Some(why) = plan.block { + ui.label(egui::RichText::new(crate::i18n::tr(why)).color(t.caution)); + } else { + ui.label( + egui::RichText::new(crate::i18n::tr_format!( + "Renames {n} face{} across the library. The files are not changed.", + if plan.faces == 1 { "" } else { "s" }, + n = plan.faces + )) + .color(t.text_dim), + ); + } + if plan.needs_merge { + ui.label( + egui::RichText::new(crate::i18n::tr_format!( + "“{to}” is already a person. Combining them makes one person; Undo separates them again.", + to = to.trim() + )) + .color(t.caution), + ); + let r = ui.checkbox(merge, crate::i18n::tr("Combine with the existing person")); + crate::widgets::register(ui, "check:personMerge", r.rect); + } +} + +/// The body of the RenameKeyword dialog. +fn rename_keyword_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, confirm: &mut bool, dlg: &mut Dialog) { + let Dialog::RenameKeyword { from, to } = dlg else { return }; + let n = app.caches.dialog_count(&app.session.catalog, ("renameKeyword", from.as_str()), || { + app.session.catalog.photos().filter(|p| p.meta.keywords.iter().any(|k| lightcraft_catalog::keywords::is_under(k, from))).count() + }); + if dialog_field(ui, "field:keywordName", to, "New name") { + *confirm = true; + } + ui.label( + egui::RichText::new(crate::i18n::tr_format!( + "Renames “{from}” on {n} photo{} (keywords below it too). Use | for levels, e.g. Travel|Italy. An existing name merges the two.", + if n == 1 { "" } else { "s" }, + from = from, + n = n + )) + .color(t.text_dim), + ); +} + +/// The body of the MergeKeywords dialog. +fn merge_keywords_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, confirm: &mut bool, dlg: &mut Dialog) { + let Dialog::MergeKeywords { from, into } = dlg else { return }; + ui.label( + egui::RichText::new(crate::i18n::tr_format!("Replace {} with:", from.iter().map(|f| format!("“{f}”")).collect::>().join(", "))) + .color(t.text_label), + ); + if dialog_field(ui, "field:keywordInto", into, "Keyword") { + *confirm = true; + } + let options: Vec = app + .caches + .suggestions(&app.session.catalog, from, into, 12) + .iter() + .filter(|k| !from.iter().any(|f| lightcraft_catalog::keywords::is_under(k, f))) + .cloned() + .collect(); + ui.horizontal_wrapped(|ui| { + for k in options { + if ui.add(egui::Button::new(egui::RichText::new(&k).color(t.text_label)).corner_radius(10.0)).clicked() { + *into = k; + } + } + }); +} + +/// The body of the NewAlbum dialog. +fn new_album_body(app: &mut LightcraftApp, ui: &mut egui::Ui, confirm: &mut bool, dlg: &mut Dialog) { + let Dialog::NewAlbum { name, folder, include_selected, .. } = dlg else { return }; + if dialog_field(ui, "field:albumName", name, "Name") { + *confirm = true; + } + // as in Lightroom, the option is only there when something is selected + if !*folder && !app.session.selected().is_empty() { + ui.add_space(6.0); + let r = ui.checkbox(include_selected, crate::i18n::tr("Include selected photos")); + crate::widgets::register(ui, "check:albumIncludeSelected", r.rect); + } +} + +/// The body of the PasteSettings dialog. +fn paste_settings_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::PasteSettings { groups } = dlg else { return }; + let n = app.session.selected().len(); + ui.label( + egui::RichText::new(crate::i18n::tr_format!( + "Paste into {n} photo{} — only settings that were copied are pasted", + if n == 1 { "" } else { "s" }, + n = n + )) + .color(t.text_dim), + ); + group_checklist(ui, "pasteGroup", groups); +} + +/// The body of the ContactSheet dialog. +fn contact_sheet_body(app: &mut LightcraftApp, ui: &mut egui::Ui, dlg: &mut Dialog) { + let Dialog::ContactSheet { options } = dlg else { return }; + options.columns = options.columns.clamp(1, 8); + options.rows = options.rows.clamp(1, 10); + let n = app.session.selected().len(); + ui.label(crate::i18n::tr_format!("{n} selected photos · {pages} pages", n = n, pages = n.div_ceil(options.columns * options.rows))); + field(ui, "Paper", |ui| { + let c = crate::widgets::combo_box("contactSheetPaper").selected_text(&options.paper).show_ui(ui, |ui| { + ui.selectable_value(&mut options.paper, "a4".into(), "A4"); + ui.selectable_value(&mut options.paper, "letter".into(), crate::i18n::tr("Letter")); + }); + crate::widgets::name_combo(&c.response, crate::i18n::tr("Paper")); + }); + ui.checkbox(&mut options.landscape, crate::i18n::tr("Landscape")); + field(ui, "Columns", |ui| { + ui.add(egui::DragValue::new(&mut options.columns).range(1..=8)); + }); + field(ui, "Rows", |ui| { + ui.add(egui::DragValue::new(&mut options.rows).range(1..=10)); + }); + ui.checkbox(&mut options.captions, crate::i18n::tr("Filename captions")); + ui.label(crate::i18n::tr("150 dpi · sRGB · current edits · fit without cropping")); + ui.label(crate::i18n::tr("Choose a PDF destination after confirming. Print the PDF from your viewer.")); +} + +/// The body of the Export dialog. +fn export_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::Export { opts, full_size, resize, preset_name, limit_kb, dir } = dlg else { return }; + use lightcraft_engine::export::{ExportFormat as F, MetadataPolicy as M, SharpenAmount as A, SharpenFor as S}; + let n = app.session.selection.ids.len().max(1); + ui.label(egui::RichText::new(crate::i18n::tr_format!("{n} photo{}", if n == 1 { "" } else { "s" }, n = n)).color(t.text_dim)); + // Preset: load a built-in or saved set of options into the dialog + field(ui, "Preset", |ui| { + let mut chosen = None; + let c = crate::widgets::combo_box("exportPreset").width(220.0).selected_text(crate::i18n::tr("Choose…")).show_ui(ui, |ui| { + let mut builtin = true; + for (p, b) in app.session.all_export_presets() { + if builtin && !b { + ui.separator(); + } + builtin = b; + if ui.selectable_label(false, crate::i18n::builtin_label(&p.name, b)).clicked() { + chosen = Some(p.name); + } + } + }); + crate::widgets::name_combo(&c.response, crate::i18n::tr("Preset")); + crate::widgets::register(ui, "combo:exportPreset", c.response.rect); + if let Some(name) = chosen + && let Ok(params) = app.session.export_params(&json!({"preset": name})) + { + let o = lightcraft_engine::export::ExportOptions::from_json(¶ms); + *full_size = o.resize.is_none(); + *resize = o.resize.unwrap_or_default(); + *limit_kb = o.limit_kb.unwrap_or(0); + *opts = o; + } + }); + ui.add_space(4.0); + let before = opts.format; + // "Rendered DNG" is a DNG option (below), not a format of its own in this list + let mut shown = if opts.format == F::RenderedDng { F::Dng } else { opts.format }; + choices( + ui, + "Format", + "exportFormat", + &[ + (F::Jpeg, "JPEG"), + (F::Png, "PNG"), + (F::Tiff, "TIFF"), + (F::Psd, "PSD"), + (F::Webp, "WebP"), + (F::Avif, "AVIF"), + (F::Jxl, "JPEG XL"), + (F::Dng, "DNG"), + (F::Original, "Original files"), + ], + &mut shown, + ); + if shown != opts.format && !(shown == F::Dng && opts.format == F::RenderedDng) { + opts.format = shown; + } + if matches!(opts.format, F::Dng | F::RenderedDng) { + choices(ui, "DNG of", "exportDngKind", &[(F::Dng, "Raw data"), (F::RenderedDng, "Rendered photo")], &mut opts.format); + } + if !opts.format.is_rendered() { + let note = if opts.format == F::Dng { + "Raw photos as DNG, with the edits embedded. Size, color and output options don't apply." + } else { + "The original files, unchanged, each with an XMP sidecar holding its edits." + }; + ui.label(egui::RichText::new(note).color(t.text_dim)); + } + if opts.format != before { + // each format starts at its own default depth (TIFF 16-bit, others 8-bit) + opts.bit_depth = None; + } + let rendered = opts.format.is_rendered(); + let depths = lightcraft_engine::export::ExportOptions::bit_depths(opts.format); + if rendered && depths.len() > 1 { + let mut bd = opts.bit_depth.filter(|b| depths.iter().any(|d| d.0 == *b)).unwrap_or(depths[0].0); + choices(ui, "Bit depth", "exportBitDepth", depths, &mut bd); + opts.bit_depth = Some(bd); + } + if matches!(opts.format, F::Jpeg | F::Tiff | F::Avif | F::Png | F::Jxl) { + let tip = crate::i18n::tr( + "Photos edited in HDR: JPEG with an HDR gain map (looks right everywhere, brighter highlights on HDR displays), AVIF as 10-bit, PNG and JPEG XL as 16-bit Rec. 2020 PQ; TIFF needs 32-bit float", + ); + ui.checkbox(&mut opts.hdr, crate::i18n::tr("HDR output")).on_hover_text(tip); + if opts.hdr && !opts.hdr_output() { + ui.label(egui::RichText::new(crate::i18n::tr("HDR TIFF needs 32-bit float.")).color(t.text_dim)); + } + if opts.hdr && opts.format == F::Avif { + use lightcraft_engine::export::HdrCurve as H; + choices(ui, "HDR curve", "exportHdrCurve", &[(H::Pq, "PQ"), (H::Hlg, "HLG")], &mut opts.hdr_transfer); + } + } + if !rendered { + } else if opts.format == F::Avif && opts.hdr { + let label = if opts.hdr_transfer == lightcraft_engine::export::HdrCurve::Hlg { + crate::i18n::tr("Color space: Rec. 2020 HLG (HDR AVIF)") + } else { + crate::i18n::tr("Color space: Rec. 2020 PQ (HDR AVIF)") + }; + ui.label(egui::RichText::new(label).color(t.text_dim)); + } else if opts.format == F::Png && opts.hdr { + ui.label(egui::RichText::new(crate::i18n::tr("Color space: Rec. 2020 PQ, 16-bit (HDR PNG)")).color(t.text_dim)) + .on_hover_text(crate::i18n::tr("Viewers that don't read the PNG cICP chunk show PQ values as sRGB: flat and washed out. For a picture that looks right everywhere, use JPEG (gain map).")); + } else if opts.format == F::Jxl && opts.hdr { + ui.label(egui::RichText::new(crate::i18n::tr("Color space: Rec. 2020 PQ (HDR JPEG XL)")).color(t.text_dim)); + } else if opts.format == F::Avif { + ui.label(egui::RichText::new(crate::i18n::tr("Color space: sRGB (AVIF)")).color(t.text_dim)); + } else { + use lightcraft_engine::export::OutputSpace as C; + choices( + ui, + "Color space", + "exportColorSpace", + &[(C::Srgb, "sRGB"), (C::DisplayP3, "P3"), (C::AdobeRgb, "Adobe RGB"), (C::ProPhoto, "ProPhoto"), (C::Rec2020, "Rec.2020")], + &mut opts.color_space, + ); + if opts.effective_space() != opts.color_space { + let note = "Lossy JPEG XL writes Adobe RGB and ProPhoto as Rec. 2020; choose Lossless to keep them."; + ui.label(egui::RichText::new(crate::i18n::tr(note)).color(t.text_dim)); + } + } + if opts.format == F::Jxl { + let tip = "Mathematically lossless: every pixel is kept exactly (larger files)"; + ui.checkbox(&mut opts.jxl_lossless, crate::i18n::tr("Lossless")).on_hover_text(crate::i18n::tr(tip)); + } + if matches!(opts.format, F::Jpeg | F::Avif) || (opts.format == F::Jxl && !opts.jxl_lossless) { + let mut q = opts.quality as f64; + if num(ui, &QUALITY, &mut q) { + opts.quality = q as u8; + } + } + if opts.format == F::Jxl { + use lightcraft_engine::export::JxlEffort as E; + choices(ui, "Effort", "exportJxlEffort", &[(E::Fast, "Fast"), (E::Normal, "Normal")], &mut opts.jxl_effort); + let tip = "Shows a coarse version first and refines it as the file loads"; + ui.checkbox(&mut opts.jxl_progressive, crate::i18n::tr("Progressive")).on_hover_text(crate::i18n::tr(tip)); + } + if opts.format == F::Jpeg { + let mut k = *limit_kb as f64; + if num(ui, &LIMIT_KB, &mut k) { + *limit_kb = k as u32; + } + } + if rendered { + export_size(ui, full_size, resize, &mut opts.ppi); + } + if rendered { + choices( + ui, + "Sharpen", + "exportSharpen", + &[(S::None, "None"), (S::Screen, "Screen"), (S::Matte, "Matte"), (S::Glossy, "Glossy")], + &mut opts.sharpen, + ); + if opts.sharpen != S::None { + choices(ui, "Amount", "exportSharpenAmount", &[(A::Low, "Low"), (A::Standard, "Standard"), (A::High, "High")], &mut opts.sharpen_amount); + } + } + if rendered { + choices( + ui, + "Metadata", + "exportMetadata", + &[(M::All, "All"), (M::AllExceptCamera, "No camera"), (M::Copyright, "Copyright"), (M::None, "None")], + &mut opts.metadata, + ); + if !matches!(opts.metadata, M::None | M::Copyright) { + ui.checkbox(&mut opts.remove_location, crate::i18n::tr("Remove location info")); + } + let mut wm_on = opts.watermark.is_some(); + if ui.checkbox(&mut wm_on, crate::i18n::tr("Watermark")).changed() { + opts.watermark = wm_on.then(|| lightcraft_engine::export::Watermark { text: "© ".into(), ..Default::default() }); + } + let wm_shown = opts.watermark.clone(); + if let Some(wm) = &wm_shown { + watermark_preview(app, ui, wm, (!*full_size).then_some(*resize)); + } + if let Some(wm) = &mut opts.watermark { + // text, or a graphic (a logo with transparency) + let mut graphic = !wm.image.is_empty() || ui.data(|d| d.get_temp::(egui::Id::unique("wm-graphic"))).unwrap_or(false); + let before = graphic; + choices(ui, "Style", "exportWmStyle", &[(false, "Text"), (true, "Graphic")], &mut graphic); + if graphic != before { + ui.data_mut(|d| d.insert_temp(egui::Id::unique("wm-graphic"), graphic)); + if !graphic { + wm.image.clear(); + } + } + if graphic { + field(ui, "Graphic", |ui| { + trailing_button_row(ui, |ui| { + if app.services.pick_files.is_some() + && crate::widgets::text_button(ui, "exportWmChoose", crate::i18n::tr("Choose…"), false).clicked() + && let Some(f) = app.services.pick_files.as_mut().and_then(|pick| pick().into_iter().next()) + { + wm.image = f; + } + crate::widgets::named( + ui.add(egui::TextEdit::singleline(&mut wm.image).hint_text("logo.png").desired_width(ui.available_width())), + crate::i18n::tr("Image"), + ); + }); + }); + let mut width = wm.image_width as f64 * 100.0; + if num(ui, &WM_IMAGE_WIDTH, &mut width) { + wm.image_width = (width / 100.0) as f32; + } + } else { + choices( + ui, + app.ui.language.tr("Text direction"), + "exportWmOrientation", + &[(false, app.ui.language.tr("Horizontal text")), (true, app.ui.language.tr("Vertical text"))], + &mut wm.vertical, + ); + field(ui, "Text", |ui| { + crate::widgets::named( + ui.add( + egui::TextEdit::multiline(&mut wm.text) + .desired_rows(2) + .hint_text(crate::i18n::tr("© Your Name")) + .desired_width(f32::INFINITY), + ), + crate::i18n::tr("Text"), + ) + }); + } + choices(ui, "Position", "exportWmAnchor", &WM_POSITIONS, &mut wm.anchor); + choices(ui, "Rotate", "exportWmRotation", &[(0u16, "0°"), (90, "90°"), (180, "180°"), (270, "270°")], &mut wm.rotation); + let mut size = wm.size as f64 * 100.0; + if !graphic && num(ui, &WM_SIZE, &mut size) { + wm.size = (size / 100.0) as f32; + } + let mut op = wm.opacity as f64 * 100.0; + if num(ui, &WM_OPACITY, &mut op) { + wm.opacity = (op / 100.0) as f32; + } + // like Lightroom Classic: a margin from the side edges and one from the top and bottom + // edges, each unused (greyed) when the position is centred along that axis + use lightcraft_engine::export::Anchor as P; + let across = !matches!(wm.anchor, P::Top | P::Center | P::Bottom); + if let Some(v) = crate::widgets::slider(ui, &WM_INSET_X, wm.inset_x as f64 * 100.0, across, None).value { + wm.inset_x = (v / 100.0) as f32; + } + let down = !matches!(wm.anchor, P::Left | P::Center | P::Right); + if let Some(v) = crate::widgets::slider(ui, &WM_INSET_Y, wm.inset_y as f64 * 100.0, down, None).value { + wm.inset_y = (v / 100.0) as f32; + } + if !graphic { + ui.checkbox(&mut wm.shadow, crate::i18n::tr("Shadow")); + } + } + if opts.watermark != wm_shown { + // the preview above was drawn with the old settings + ui.ctx().request_repaint(); + } + } + ui.add_space(4.0); + if opts.format == F::Tiff { + use lightcraft_engine::export::TiffCompression as Z; + choices(ui, "Compression", "exportTiffCompression", &[(Z::None, "None"), (Z::Lzw, "LZW"), (Z::Deflate, "ZIP")], &mut opts.tiff_compression); + } + if opts.format == F::Dng { + use lightcraft_engine::export::DngCompression as Z; + choices( + ui, + "Compression", + "exportDngCompression", + &[(Z::Lossless, "Lossless"), (Z::Deflate, "ZIP"), (Z::Uncompressed, "None"), (Z::Lossy, "Lossy")], + &mut opts.dng_compression, + ); + } + let naming_id = egui::Id::unique("export-naming"); + let tags_open = field(ui, "File name", |ui| { + ui.spacing_mut().item_spacing.x = 4.0; + let w = crate::import::tag_field_width(ui); + crate::widgets::named( + ui.add( + egui::TextEdit::singleline(&mut opts.naming) + .id(naming_id) + .hint_text("{name}-{seq} · {date} · {title} · {folder}") + .desired_width(w), + ), + crate::i18n::tr("File name"), + ); + crate::import::tag_toggle(ui, "exportNaming") + }); + if tags_open { + crate::import::tag_help(ui, "exportNaming", &mut opts.naming, naming_id); + } + crate::import::unknown_tags_warning(ui, &opts.naming); + if opts.naming.contains("{seq") { + let mut v = opts.start_number as f64; + if num(ui, &START_NUMBER, &mut v) { + opts.start_number = v as u32; + } + } + // like Lightroom Classic's Export To: one folder, or each photo's own folder (not on + // the web, where originals live in the browser's storage, not in folders) + use lightcraft_engine::export::DestinationMode as D; + if !cfg!(target_arch = "wasm32") || opts.destination_mode != D::SpecificFolder { + choices( + ui, + "Export to", + "exportDestinationMode", + &[(D::SpecificFolder, "Specific folder"), (D::SameAsOriginal, "Same folder as original photo")], + &mut opts.destination_mode, + ); + } + if opts.destination_mode == D::SpecificFolder { + field(ui, "Folder", |ui| { + trailing_button_row(ui, |ui| { + if app.services.pick_folder.is_some() + && crate::widgets::text_button(ui, "exportChooseFolder", crate::i18n::tr("Choose…"), false).clicked() + && let Some(pick) = app.services.pick_folder.as_mut() + && let Some(d) = pick() + { + *dir = d; + } + crate::widgets::named(ui.add(egui::TextEdit::singleline(dir).desired_width(ui.available_width())), crate::i18n::tr("Folder")); + }); + }); + } + field(ui, "Subfolder", |ui| { + crate::widgets::named( + ui.add(egui::TextEdit::singleline(&mut opts.subfolder).hint_text(crate::i18n::tr("none")).desired_width(f32::INFINITY)), + crate::i18n::tr("Subfolder"), + ) + }); + use lightcraft_engine::export::Conflict as K; + choices(ui, "If file exists", "exportConflict", &[(K::Unique, "Add number"), (K::Overwrite, "Overwrite"), (K::Skip, "Skip")], &mut opts.conflict); + // After export: Apple Photos imports the files written (macOS only) + #[cfg(target_os = "macos")] + { + let r = ui.checkbox(&mut opts.add_to_photos, crate::i18n::tr("Add to Apple Photos")); + crate::widgets::register(ui, "exportAddToPhotos", r.rect); + if opts.add_to_photos { + field(ui, "Album", |ui| { + crate::widgets::named( + ui.add(egui::TextEdit::singleline(&mut opts.photos_album).hint_text(crate::i18n::tr("none")).desired_width(f32::INFINITY)), + crate::i18n::tr("Album"), + ) + }); + ui.label( + egui::RichText::new(crate::i18n::tr("The first time, macOS asks whether LightCraft may control Photos.")) + .size(11.0) + .color(t.text_dim), + ); + } + } + // nowhere to add them: a setting carried over from a Mac is dropped, not refused + #[cfg(not(target_os = "macos"))] + { + opts.add_to_photos = false; + } + ui.add_space(4.0); + field(ui, "Save preset", |ui| { + trailing_button_row(ui, |ui| { + let named = !preset_name.trim().is_empty(); + if crate::widgets::text_button(ui, "exportSavePreset", crate::i18n::tr("Save"), false).clicked() && named { + let params = export_dialog_params(opts, *full_size, resize, *limit_kb); + match app.run("export.savePreset", json!({"name": preset_name.trim(), "params": params})) { + Ok(_) => { + app.toast(ui.ctx(), crate::i18n::tr_format!("Saved export preset “{}”", preset_name.trim())); + preset_name.clear(); + } + Err(e) => app.toast(ui.ctx(), e), + } + } + crate::widgets::named( + ui.add(egui::TextEdit::singleline(preset_name).hint_text(crate::i18n::tr("Preset name")).desired_width(ui.available_width())), + crate::i18n::tr("Preset name"), + ); + }); + }); +} + +/// The body of the KeywordTag dialog. +fn keyword_tag_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, confirm: &mut bool, dlg: &mut Dialog) { + let Dialog::KeywordTag { + editing, + name, + parent, + inside, + synonyms, + include_on_export, + export_containing, + export_synonyms, + person, + add_to_selected, + .. + } = dlg + else { + return; + }; + ui.label(egui::RichText::new(crate::i18n::tr("Keyword Name")).color(t.text_dim)); + // several fields: the name takes the focus when the dialog opens, not after + let r = crate::text_field::TextField::singleline("field:keywordTagName", name) + .hint(crate::i18n::tr("Keyword Name")) + .width(f32::INFINITY) + .select_on_focus(true) + .show(ui); + if ui.is_enabled() && just_opened(ui, "keyword-tag") { + r.response.request_focus(); + } + if r.ending == Some(crate::text_field::Ending::Return) { + *confirm = true; + } + ui.add_space(4.0); + ui.label(egui::RichText::new(crate::i18n::tr("Synonyms")).color(t.text_dim)); + // Return in either field creates (or saves) the keyword + let r = crate::text_field::TextField::singleline("field:keywordSynonyms", synonyms) + .hint(crate::i18n::tr("Separated by commas")) + .width(f32::INFINITY) + .show(ui); + if r.ending == Some(crate::text_field::Ending::Return) { + *confirm = true; + } + ui.add_space(6.0); + if editing.is_none() { + if let Some(p) = parent { + let r = ui.checkbox(inside, crate::i18n::tr_format!("Put inside “{parent}”", parent = p.replace('|', " › "))); + crate::widgets::register(ui, "check:keywordInside", r.rect); + } + let n = app.session.selection.ids.len(); + let r = ui.add_enabled(n > 0, egui::Checkbox::new(add_to_selected, crate::i18n::tr("Add to Selected Photos"))); + crate::widgets::register(ui, "check:keywordAddToSelected", r.rect); + ui.add_space(4.0); + } + ui.label(egui::RichText::new(crate::i18n::tr("Keyword Tag Options")).color(t.text_dim)); + for (on, label, id) in [ + (include_on_export, "Include on Export", "check:keywordIncludeOnExport"), + (export_containing, "Export Containing Keywords", "check:keywordExportContaining"), + (export_synonyms, "Export Synonyms", "check:keywordExportSynonyms"), + (person, "Person", "check:keywordPerson"), + ] { + let r = ui.checkbox(on, crate::i18n::tr(label)); + crate::widgets::register(ui, id, r.rect); + } +} + +/// The body of the KeywordSet dialog. +fn keyword_set_body(ui: &mut egui::Ui, t: &Tokens, confirm: &mut bool, dlg: &mut Dialog) { + let Dialog::KeywordSet { replaces, name, slots, as_new } = dlg else { return }; + ui.label(egui::RichText::new(crate::i18n::tr("Set name")).color(t.text_dim)); + let r = crate::text_field::TextField::singleline("field:keywordSetName", name) + .hint(crate::i18n::tr("Set name")) + .width(f32::INFINITY) + .select_on_focus(true) + .show(ui); + if ui.is_enabled() && just_opened(ui, "keyword-set") { + r.response.request_focus(); + } + let mut returned = r.ending == Some(crate::text_field::Ending::Return); + ui.add_space(6.0); + ui.label(egui::RichText::new(crate::i18n::tr("Keywords (⌥1–⌥9)")).color(t.text_dim)); + slots.resize(9, String::new()); + // equal columns of a set width (the window is still finding its own) + let w = 130.0; + egui::Grid::new("keyword-set-slots").num_columns(3).min_col_width(w).spacing([6.0, 4.0]).show(ui, |ui| { + for (i, slot) in slots.iter_mut().enumerate() { + let r = crate::text_field::TextField::singleline(&format!("field:keywordSetSlot:{}", i + 1), slot) + .hint(format!("⌥{}", i + 1)) + .width(w) + .show(ui); + returned |= r.ending == Some(crate::text_field::Ending::Return); + if i % 3 == 2 { + ui.end_row(); + } + } + }); + if replaces.is_some() { + ui.add_space(6.0); + let r = ui.checkbox(as_new, crate::i18n::tr("Save as a new set")); + crate::widgets::register(ui, "check:keywordSetAsNew", r.rect); + } + // Return in any field saves the set + if returned { + *confirm = true; + } +} + +/// The body of the MoveKeyword dialog. +fn move_keyword_body(ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::MoveKeyword { keyword, parent } = dlg else { return }; + let name = keyword.rsplit('|').next().unwrap_or(keyword); + match parent { + Some(p) => { + ui.label(crate::i18n::tr_format!("“{parent}” has a “{name}” already. Merge the two?", parent = p.replace('|', " › "), name = name)) + } + None => ui.label(crate::i18n::tr_format!("There is a “{name}” at the top level already. Merge the two?", name = name)), + }; + ui.label(egui::RichText::new(crate::i18n::tr("Their photos and the keywords below them come together under one keyword.")).color(t.text_dim)); +} + +/// The body of the DeleteKeyword dialog. +fn delete_keyword_body(ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::DeleteKeyword { keyword, count } = dlg else { return }; + let name = keyword.replace('|', " › "); + ui.label(crate::i18n::tr_format!("Delete the keyword “{name}”?", name = name)); + ui.label( + egui::RichText::new(if *count == 0 { + crate::i18n::tr("No photo has it; the keywords below it go too.").to_string() + } else { + crate::i18n::tr_format!( + "It is taken off {count} photo{}, with the keywords below it. Undo brings it back.", + if *count == 1 { "" } else { "s" }, + count = count + ) + }) + .color(t.text_dim), + ); +} + +/// The body of the DeleteEffects dialog. +fn delete_effects_body(ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::DeleteEffects { names } = dlg else { return }; + let what = match names.as_slice() { + [one] => crate::i18n::tr_format!("Delete the effect preset “{name}”?", name = one), + _ => crate::i18n::tr_format!("Delete these {n} effect presets?", n = names.len()), + }; + ui.label(what); + ui.label(egui::RichText::new(crate::i18n::tr("Masks keep their sliders. Export presets first to keep a copy.")).color(t.text_dim)); +} + +/// The body of the MovePhotos dialog. +fn move_photos_body(ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::MovePhotos { ids, name, dont_ask, .. } = dlg else { return }; + let n = ids.len(); + ui.label(crate::i18n::tr_format!("Move {n} photo{} to “{}”?", if n == 1 { "" } else { "s" }, name, n = n)); + ui.label(egui::RichText::new(crate::i18n::tr("Their files and XMP sidecars move on disk. Edit → Undo moves them back.")).color(t.text_dim)); + ui.add_space(4.0); + let c = ui.checkbox(dont_ask, crate::i18n::tr("Don't ask again")); + crate::widgets::register(ui, "check:moveDontAsk", c.rect); + c.on_hover_text(crate::i18n::tr("Settings → Confirm before moving photos to another folder on disk turns it back on")); +} + +/// The body of the LightroomCatalog dialog. +fn lightroom_catalog_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::LightroomCatalog { folder, catalog } = dlg else { return }; + ui.label(crate::i18n::tr("This is a Lightroom catalog, not a LightCraft library. Import it into a LightCraft library instead?")); + ui.label(egui::RichText::new(catalog.as_deref().unwrap_or(folder.as_str())).color(t.text_dim)); + // (the import then asks where the catalog goes, unless Settings says to merge, #2672) + let asks = app.ui.settings.lightroom_import == crate::state::LightroomImport::Ask && app.session.library.as_ref().is_some_and(|l| l.on_disk); + let what = if asks { + "The import reads the catalog without changing it. Next, choose whether its photos, edits, keywords and collections join the library open now or go into a new library." + } else { + "The import reads the catalog without changing it and adds its photos, edits, keywords and collections to the library open now." + }; + ui.label(egui::RichText::new(crate::i18n::tr(what)).color(t.text_dim)); +} + +/// The body of the RemoveFolder dialog. +fn remove_folder_body(ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::RemoveFolder { name, count, path, disk } = dlg else { return }; + ui.label(crate::i18n::tr_format!( + "Remove “{name}” and its {count} photo{} from the library?", + if *count == 1 { "" } else { "s" }, + name = name, + count = count + )); + ui.label(egui::RichText::new(path.as_str()).color(t.text_dim)); + let scope = if *disk { "All the photos imported from this disk are included." } else { "That includes the photos in the folders inside it." }; + ui.label(egui::RichText::new(crate::i18n::tr(scope)).color(t.text_dim)); + ui.label( + egui::RichText::new(crate::i18n::tr("They move to Recently Deleted and can be restored; no file on disk is touched.")).color(t.text_dim), + ); +} + +/// The body of the About dialog. +fn about_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { + let Dialog::About = dlg else { return }; + ui.set_min_width(680.0); + let tab_id = egui::Id::unique("about_tab"); + let mut tab = ui.data_mut(|d| d.get_temp::(tab_id)).unwrap_or(0); + ui.horizontal(|ui| { + ui.spacing_mut().item_spacing.x = 4.0; + for (i, (id, label)) in ABOUT_TABS.iter().enumerate() { + if crate::widgets::text_button(ui, &format!("aboutTab-{id}"), label, usize::from(tab) == i).clicked() { + tab = u8::try_from(i).unwrap_or(0); + } + } + }); + ui.data_mut(|d| d.insert_temp(tab_id, tab)); + ui.separator(); + match tab { + 1 => crate::credits::contributors_ui(app, ui), + 2 => crate::credits::models_ui(ui), + _ => { + ui.label(egui::RichText::new("LightCraft").font(t.semibold(20.0)).color(t.text)); + ui.label(crate::i18n::tr_format!("Version {} — a clean-room, pure-Rust photo library and raw developer.", env!("CARGO_PKG_VERSION"))); + ui.label(crate::i18n::tr_format!( + "MIT OR Apache-2.0. Fonts: {} (OFL). Icons: original.", + crate::theme::font_credits(app.chinese_font.is_some()) + )); + ui.add_space(10.0); + let r = crate::button::Button::new("Join the ArtCraft Discord") + .primary() + .large() + .min_width(260.0) + .widget("button:aboutDiscord") + .tooltip(crate::links::DISCORD) + .show(ui); + if r.clicked() { + let _ = crate::links::open(app, crate::links::DISCORD); + } + ui.add_space(6.0); + for (label, url) in [ + ("LightCraft website", crate::links::APP_PAGE), + ("Source code on GitHub", crate::links::GITHUB), + ("ArtCraft — more creative apps", crate::links::WEBSITE), + ] { + let r = ui.link(crate::i18n::tr(label)).on_hover_text(url); + if r.clicked() { + let _ = crate::links::open(app, url); + } + } + } + } +} + +/// The body of the open dialog: what each kind of dialog shows between its title and its buttons. `confirm` is set +/// by a dialog that is confirmed from its body (a text field's Return). +fn dialog_content(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, body_max: f32, confirm: &mut bool, dlg: &mut Dialog) { + match dlg { + Dialog::AutoStack { .. } => auto_stack_body(app, ui, t, dlg), + Dialog::Cull { .. } => cull_body(app, ui, t, dlg), + Dialog::WhatsNew => whats_new_body(ui, t, dlg), + Dialog::DenoiseModel { info, accepted } => crate::panels::denoise::model_dialog(app, ui, t, info, accepted), + Dialog::FaceModel { info, accepted, .. } => crate::panels::faces::model_dialog(app, ui, t, info, accepted), + Dialog::LightroomResult { .. } => lightroom_result_body(ui, dlg), + Dialog::SystemInfo { .. } => system_info_body(ui, t, dlg), + Dialog::AllMetadata { .. } => all_metadata_body(ui, t, dlg), + Dialog::SmartRules { .. } => smart_rules_body(app, ui, t, dlg), + Dialog::NewSmartAlbum { .. } => new_smart_album_body(app, ui, t, confirm, dlg), + Dialog::CaptureTime { .. } => capture_time_body(app, ui, t, dlg), + Dialog::LabelNames { .. } => label_names_body(app, ui, t, dlg), + Dialog::Rename { .. } => rename_body(app, ui, t, dlg), + Dialog::RenamePerson { .. } => rename_person_body(app, ui, t, confirm, dlg), + Dialog::RenameKeyword { .. } => rename_keyword_body(app, ui, t, confirm, dlg), + Dialog::MergeKeywords { .. } => merge_keywords_body(app, ui, t, confirm, dlg), + Dialog::TextPrompt { value, hint, .. } => { + if dialog_field(ui, "field:prompt", value, hint) { + *confirm = true; + } + } + Dialog::NewAlbum { .. } => new_album_body(app, ui, confirm, dlg), + Dialog::RenameAlbum { name, .. } => { + if dialog_field(ui, "field:albumName", name, "Name") { + *confirm = true; + } + } + Dialog::CreatePreset { name, group, groups } => { + crate::widgets::named( + ui.add(egui::TextEdit::singleline(name).hint_text(crate::i18n::tr("Preset name")).desired_width(f32::INFINITY)), + crate::i18n::tr("Preset name"), + ); + crate::widgets::named( + ui.add(egui::TextEdit::singleline(group).hint_text(crate::i18n::tr("Group")).desired_width(f32::INFINITY)), + crate::i18n::tr("Group"), + ); + ui.label(egui::RichText::new(crate::i18n::tr("Settings to include")).color(t.text_dim)); + group_checklist(ui, "presetInclude", groups); + } + Dialog::CopySettings { groups } => group_checklist(ui, "copyGroup", groups), + Dialog::PasteSettings { .. } => paste_settings_body(app, ui, t, dlg), + Dialog::SlideshowExport { settings } => slideshow_export_body(app, ui, settings), + Dialog::ContactSheet { .. } => contact_sheet_body(app, ui, dlg), + Dialog::Export { .. } => export_body(app, ui, t, dlg), + Dialog::Merge { opts } => crate::merge::body(app, ui, opts), + Dialog::Import { opts } => crate::import::body(app, ui, opts), + // (Settings is never taller than `body_max`, so the scroll area round it never + // scrolls: its tab bar stays put and its pages scroll by themselves) + Dialog::Settings { tab } => crate::panels::settings::window(app, ui, tab, body_max), + Dialog::SamModel { error, .. } => sam_model_body(app, ui, error.as_deref()), + Dialog::KeywordTag { .. } => keyword_tag_body(app, ui, t, confirm, dlg), + Dialog::KeywordSet { .. } => keyword_set_body(ui, t, confirm, dlg), + Dialog::MoveKeyword { .. } => move_keyword_body(ui, t, dlg), + Dialog::DeleteKeyword { .. } => delete_keyword_body(ui, t, dlg), + Dialog::SaveEffect { name, group, fields, amount, brush } => { + if crate::panels::mask_effects::save_body(app, ui, name, group, fields, amount, brush) { + *confirm = true; + } + } + Dialog::ManageEffects { search, selected, rename, confirm_delete, new_group } => { + crate::panels::mask_effects::manage_body(app, ui, search, selected, rename, confirm_delete, new_group) + } + Dialog::DeleteEffects { .. } => delete_effects_body(ui, t, dlg), + Dialog::ConfirmDelete { count } => { + let what = + if *count == 1 { crate::i18n::tr("this photo").to_string() } else { crate::i18n::tr_format!("these {count} photos", count = count) }; + ui.label(crate::i18n::tr_format!("Move {what} to Recently Deleted?", what = what)); + ui.label(egui::RichText::new(crate::i18n::tr("They can be restored from Recently Deleted until it is emptied.")).color(t.text_dim)); + } + Dialog::MovePhotos { .. } => move_photos_body(ui, t, dlg), + d @ Dialog::SynchronizeFolder { .. } => crate::sync::body(app, ui, d), + Dialog::LightroomCatalog { .. } => lightroom_catalog_body(app, ui, t, dlg), + d @ Dialog::LightroomDestination { .. } => crate::lightroom_destination::body(app, ui, d), + Dialog::RemoveFolder { .. } => remove_folder_body(ui, t, dlg), + Dialog::About => about_body(app, ui, t, dlg), + Dialog::Shortcuts => crate::panels::keymap::body(app, ui, t), + Dialog::ViewOptions => crate::panels::settings::view_options(app, ui, t), + Dialog::Print => crate::print_view::body(app, ui, t), + } +} From 8c3dd7ebd2170e51366eaf2b816c6fb26c7b5f0a Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 20:28:52 +0000 Subject: [PATCH 69/93] refactor(ui-egui): split dialog frame into title, buttons and confirm --- crates/ui-egui/src/dialogs.rs | 605 +++++++++++++++++++--------------- 1 file changed, 334 insertions(+), 271 deletions(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 1e5ae5e2d2..4278404ffc 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -109,7 +109,127 @@ pub fn show(app: &mut LightcraftApp, ctx: &egui::Context, blocked: bool) { { confirm = true; } - let title: String = match &dlg { + let title = dialog_title(app, &dlg); + let frame = egui::Frame::window(&ctx.global_style()).inner_margin(egui::Margin::symmetric(16, 12)); + // The import review can be resized (its photo grid takes the room); it keeps a window id of its + // own so the size it is given doesn't carry over to the other dialogs. Its content scrolls + // rather than growing the window when the options below the grid get taller (e.g. Copy). + let import = matches!(dlg, Dialog::Import { .. }); + // The Print dialog sizes itself to the window and scrolls its settings column on its own. + let print = matches!(dlg, Dialog::Print); + let window_id = window_id(&dlg); + // Every other dialog fits the window (#781): its options scroll when they don't, and the title + // bar and the button row stay outside the scroll area. The room they take is measured on the + // previous frame (a guess on the first one). + let chrome_id = window_id.with("chrome"); + let chrome = ctx.data(|d| d.get_temp::(chrome_id)).unwrap_or(DIALOG_CHROME_GUESS); + // Settings keeps its top edge, and the widest it has been, while tabs of different sizes are shown, so its tab + // row stays where it is (centred like the others, the row jumped with each tab's height) + let settings = matches!(dlg, Dialog::Settings { .. }); + let top = (screen.height() * 0.08).clamp(DIALOG_SCREEN_MARGIN, 96.0); + let body_max = + if settings { screen.height() - top - DIALOG_SCREEN_MARGIN - chrome } else { screen.height() - 2.0 * DIALOG_SCREEN_MARGIN - chrome } + .max(DIALOG_MIN_BODY); + let widest_id = window_id.with("widest"); + let widest = if settings { ctx.data(|d| d.get_temp::(widest_id)).unwrap_or(0.0).min(screen.width() * 0.9) } else { 0.0 }; + let mut content_w = 0.0f32; + let mut body_h = None; + // before the window: drawing it closes a dropdown the click lands outside of + let popup_was_open = egui::Popup::is_any_open(ctx); + let shown = egui::Window::new(crate::i18n::tr(&title)) + .id(window_id) + .collapsible(false) + .resizable(import) + .vscroll(import) + .resize(|r| if import { r.default_height(crate::import::DIALOG_SIZE[1]) } else { r }) + .frame(frame) + .anchor(if settings { egui::Align2::CENTER_TOP } else { egui::Align2::CENTER_CENTER }, [0.0, if settings { top } else { 0.0 }]) + .min_width(widest) + .default_width(match dlg { + Dialog::Import { .. } => crate::import::DIALOG_SIZE[0], + Dialog::SmartRules { .. } => 680.0, + Dialog::AllMetadata { .. } => 620.0, + Dialog::Print => 1100.0, + Dialog::FaceModel { .. } => 460.0, + Dialog::LightroomCatalog { .. } => 440.0, + Dialog::LightroomDestination { .. } => 480.0, + Dialog::ManageEffects { .. } => 560.0, + _ => 380.0, + }) + .show(ctx, |ui| { + // Disabled, not skipped: the dialog keeps its layout and state, but a raw event in the + // first prompt frame cannot toggle a checkbox or press a button underneath it. The + // blocking library window gets the same treatment: it owns input while it is on screen, + // so the dialog behind it must not take focus or accept typed text either. + if raw_blocked { + ui.disable(); + } + ui.spacing_mut().item_spacing.y = 8.0; + body_h = dialog_body(ui, (!import && !print).then_some(title.as_str()), body_max, |ui| { + dialog_content(app, ui, &t, body_max, &mut confirm, &mut dlg) + }); + ui.add_space(4.0); + // the confirm on the right with Cancel to its left (macOS and GNOME's order), filled with + // the accent when it is the dialog's primary action. The row spans the width the window + // gives its content this frame (its default width, or its content's if wider), so it + // reaches the edge without widening the window. + let row_w = ui.available_width().max(ui.min_rect().width()).max(1.0); + let row_h = ui.spacing().interact_size.y; + ui.allocate_ui_with_layout(egui::vec2(row_w, row_h), egui::Layout::left_to_right(egui::Align::Center), |ui| { + button_row(app, ui, &dlg, &mut close, &mut confirm); + }); + if import { + crate::import::note_dialog_bottom(ui); + } + content_w = ui.min_rect().width(); + }); + if settings && content_w > widest + 0.5 { + ctx.data_mut(|d| d.insert_temp(widest_id, content_w)); + } + if let Some(w) = &shown { + // (the import review keeps its hand-picked photos however the click lands) + if !raw_blocked && app.ui.settings.close_dialogs_outside && !import && clicked_backdrop(ctx, w.response.rect, popup_was_open) { + close = true; + } else if raw_blocked { + // A press made under the prompt or library window must not be remembered as a + // backdrop press for a release that arrives after that covering window goes away. + ctx.data_mut(|d| d.remove_temp::(egui::Id::unique("dialog-backdrop-press"))); + } + } + if let Some(w) = shown { + ctx.memory_mut(|m| m.set_modal_layer(w.response.layer_id)); + if let Some(body_h) = body_h { + let measured = (w.response.rect.height() - body_h).max(0.0); + if (measured - chrome).abs() > 0.5 { + ctx.data_mut(|d| d.insert_temp(chrome_id, measured)); + ctx.request_repaint(); + } + } + ctx.move_to_top(w.response.layer_id); + crate::widgets::register_response("dialog:window", w.response.rect, &w.response); + } + // (while the shortcuts editor records a key, it takes Esc itself to cancel; an open popup in + // the dialog, such as a date picker's calendar, takes it to close itself) + if !raw_blocked && ctx.input(|i| i.key_pressed(egui::Key::Escape)) && !crate::widgets::escape_taken(ctx) { + close = true; + } + if !raw_blocked && confirm { + close |= confirmed(app, ctx, &mut dlg); + } + // a dialog opened from inside this one (a button in Settings that shows a licence) takes its place + if app.ui.dialog.as_ref().is_some_and(|now| *now != at_start) { + return; + } + if !close && !blocked { + let frame = ctx.cumulative_frame_nr(); + ctx.data_mut(|d| d.insert_temp(egui::Id::unique(BACKDROP_SHOWN), frame)); + } + app.ui.dialog = if close { None } else { Some(dlg) }; +} + +/// The title of a dialog. +fn dialog_title(app: &LightcraftApp, dlg: &Dialog) -> String { + match dlg { Dialog::TextPrompt { title, .. } => title.as_str(), Dialog::NewAlbum { folder: true, .. } => "Create Folder", Dialog::NewAlbum { .. } => "Create Album", @@ -165,284 +285,227 @@ pub fn show(app: &mut LightcraftApp, ctx: &egui::Context, blocked: bool) { Dialog::Shortcuts => "Keyboard Shortcuts", Dialog::ViewOptions => "View Options", } - .to_string(); - let frame = egui::Frame::window(&ctx.global_style()).inner_margin(egui::Margin::symmetric(16, 12)); - // The import review can be resized (its photo grid takes the room); it keeps a window id of its - // own so the size it is given doesn't carry over to the other dialogs. Its content scrolls - // rather than growing the window when the options below the grid get taller (e.g. Copy). - let import = matches!(dlg, Dialog::Import { .. }); - // The Print dialog sizes itself to the window and scrolls its settings column on its own. - let print = matches!(dlg, Dialog::Print); - let window_id = window_id(&dlg); - // Every other dialog fits the window (#781): its options scroll when they don't, and the title - // bar and the button row stay outside the scroll area. The room they take is measured on the - // previous frame (a guess on the first one). - let chrome_id = window_id.with("chrome"); - let chrome = ctx.data(|d| d.get_temp::(chrome_id)).unwrap_or(DIALOG_CHROME_GUESS); - // Settings keeps its top edge, and the widest it has been, while tabs of different sizes are shown, so its tab - // row stays where it is (centred like the others, the row jumped with each tab's height) - let settings = matches!(dlg, Dialog::Settings { .. }); - let top = (screen.height() * 0.08).clamp(DIALOG_SCREEN_MARGIN, 96.0); - let body_max = - if settings { screen.height() - top - DIALOG_SCREEN_MARGIN - chrome } else { screen.height() - 2.0 * DIALOG_SCREEN_MARGIN - chrome } - .max(DIALOG_MIN_BODY); - let widest_id = window_id.with("widest"); - let widest = if settings { ctx.data(|d| d.get_temp::(widest_id)).unwrap_or(0.0).min(screen.width() * 0.9) } else { 0.0 }; - let mut content_w = 0.0f32; - let mut body_h = None; - // before the window: drawing it closes a dropdown the click lands outside of - let popup_was_open = egui::Popup::is_any_open(ctx); - let shown = egui::Window::new(crate::i18n::tr(&title)).id(window_id) - .collapsible(false) - .resizable(import) - .vscroll(import) - .resize(|r| if import { r.default_height(crate::import::DIALOG_SIZE[1]) } else { r }) - .frame(frame) - .anchor(if settings { egui::Align2::CENTER_TOP } else { egui::Align2::CENTER_CENTER }, [0.0, if settings { top } else { 0.0 }]) - .min_width(widest) - .default_width(match dlg { - Dialog::Import { .. } => crate::import::DIALOG_SIZE[0], - Dialog::SmartRules { .. } => 680.0, - Dialog::AllMetadata { .. } => 620.0, - Dialog::Print => 1100.0, - Dialog::FaceModel { .. } => 460.0, - Dialog::LightroomCatalog { .. } => 440.0, - Dialog::LightroomDestination { .. } => 480.0, - Dialog::ManageEffects { .. } => 560.0, - _ => 380.0, - }) - .show(ctx, |ui| { - // Disabled, not skipped: the dialog keeps its layout and state, but a raw event in the - // first prompt frame cannot toggle a checkbox or press a button underneath it. The - // blocking library window gets the same treatment: it owns input while it is on screen, - // so the dialog behind it must not take focus or accept typed text either. - if raw_blocked { - ui.disable(); - } - ui.spacing_mut().item_spacing.y = 8.0; - body_h = dialog_body(ui, (!import && !print).then_some(title.as_str()), body_max, |ui| dialog_content(app, ui, &t, body_max, &mut confirm, &mut dlg)); - ui.add_space(4.0); - // the confirm on the right with Cancel to its left (macOS and GNOME's order), filled with - // the accent when it is the dialog's primary action. The row spans the width the window - // gives its content this frame (its default width, or its content's if wider), so it - // reaches the edge without widening the window. - let row_w = ui.available_width().max(ui.min_rect().width()).max(1.0); - let row_h = ui.spacing().interact_size.y; - ui.allocate_ui_with_layout(egui::vec2(row_w, row_h), egui::Layout::left_to_right(egui::Align::Center), |ui| { - // a model file LightCraft cannot use has nothing to confirm, nor has a dialog that - // only shows something (one Close, no Cancel / OK) - let unusable_model = matches!(&dlg, Dialog::DenoiseModel { info, .. } | Dialog::FaceModel { info, .. } if info["kind"] == "unsupported"); - let informational = unusable_model || matches!(dlg, Dialog::LightroomResult { first: None, .. }) || only_shows(&dlg); - let sam = &app.session.segmenter; - let (sam_installed, sam_running, sam_failed) = (sam.installed(), sam.download_status().running, sam.download_status().error.is_some()); - // no download location in this build: nothing to offer but the manual install - let sam_nowhere = sam_by_hand(sam); - let cancel = match &dlg { - Dialog::SamModel { .. } if sam_running || sam_installed || sam_nowhere => "Close", - Dialog::SamModel { .. } => "Not Now", - Dialog::LightroomResult { .. } => "Close", - _ => "Cancel", - }; - let add_label; - let ok = match &dlg { - Dialog::Import { opts } => { - let n = opts.selected_paths().len(); - let verb = if opts.copy && opts.move_files { "Move" } else { "Import" }; - add_label = crate::i18n::tr_format!("{verb} {n} Photo{}", if n == 1 { "" } else { "s" }, verb = crate::i18n::tr(verb), n = n); - add_label.as_str() - } - Dialog::LightroomResult { first: Some(_), .. } => "Show in Library", - Dialog::ContactSheet { .. } => "Choose PDF…", - Dialog::SlideshowExport { .. } => "Export…", - Dialog::Print => "Print to PDF…", - Dialog::Merge { .. } => "Merge", - Dialog::DenoiseModel { info, .. } if info["download"].is_string() => "Accept & Download", - Dialog::DenoiseModel { .. } => "Install", - Dialog::FaceModel { info, .. } if !informational && info["download"].is_string() => "Download", - Dialog::FaceModel { .. } if !informational => "Install", - Dialog::ConfirmDelete { .. } | Dialog::DeleteKeyword { .. } | Dialog::DeleteEffects { .. } => "Delete", - Dialog::SaveEffect { .. } => "Create", - Dialog::MovePhotos { .. } => "Move", - // (not "Merge": that is photo merging, HDR / panorama, in some languages) - Dialog::MoveKeyword { .. } => "Merge Keywords", - Dialog::KeywordSet { .. } => "Save", - Dialog::KeywordTag { editing: None, .. } => "Create", - Dialog::KeywordTag { .. } => "Save", - Dialog::RemoveFolder { .. } => "Remove", - Dialog::LightroomCatalog { .. } => "Import Lightroom Catalog…", - d @ Dialog::LightroomDestination { .. } => crate::lightroom_destination::ok_label(d), - Dialog::SynchronizeFolder { .. } if informational => "Close", - Dialog::SynchronizeFolder { .. } => "Synchronize", - Dialog::SamModel { then: Some(_), .. } if sam_installed => "Continue", - Dialog::SamModel { .. } if sam_installed || sam_running || sam_nowhere => "", - Dialog::SamModel { error, .. } if error.is_some() || sam_failed => "Try Again", - Dialog::SamModel { .. } => "Download", - Dialog::RenamePerson { from, to, .. } if person_rename_plan(&app.session.catalog, from, to).needs_merge => "Merge", - _ if informational => "Close", - _ => "OK", - }; - // installing waits for the licence to be accepted - // (and Synchronize waits for the scan) - let rename_blocked = match &dlg { - Dialog::RenamePerson { from, to, merge } => { - let plan = person_rename_plan(&app.session.catalog, from, to); - plan.block.is_some() || (plan.needs_merge && !*merge) - } - _ => false, - }; - let can_confirm = !rename_blocked - && (informational - || !matches!( - &dlg, - Dialog::DenoiseModel { accepted: false, .. } | Dialog::FaceModel { accepted: false, .. } | Dialog::SynchronizeFolder { counts: None, .. } - ) - // smart-album rules that can't mean anything wait to be fixed - && !matches!(&dlg, Dialog::SmartRules { id, rules, .. } if !rules.check_for(&app.session.catalog, id.map(lightcraft_catalog::AlbumId)).is_empty())); - let primary = !informational && can_confirm && confirm_style(&dlg) == ConfirmStyle::Primary; - use crate::button::{Button, Kind}; - // (each kind of dialog its own buttons: the keyboard's place doesn't carry from a - // dialog to the one it opens) - let kind = std::mem::discriminant(&dlg); - let cancel_button = Button::new(cancel).widget("button:dialogCancel").id_salt(kind).min_width(72.0); - let ok_button = Button::new(ok) - .kind(if primary { Kind::Primary } else { Kind::Secondary }) - .enabled(can_confirm) - .widget("button:dialogOk") - .id_salt(kind) - .min_width(72.0); - // (Cancel first, then the confirm: the keyboard goes through them as the eye does) - let gap = ui.spacing().item_spacing.x; - let mut buttons_w = 0.0; - if !informational { - buttons_w += cancel_button.desired_size(ui).x + gap; - } - if !ok.is_empty() { - buttons_w += ok_button.desired_size(ui).x; - } - ui.add_space((ui.available_width() - buttons_w).max(0.0)); - if !informational && cancel_button.show(ui).clicked() { - close = true; - } - let r = (!ok.is_empty()).then(|| ok_button.show(ui)); - if r.is_some_and(|r| r.clicked()) { - if informational { - close = true; - } else { - confirm = true; - } - } - }); - if import { - crate::import::note_dialog_bottom(ui); - } - content_w = ui.min_rect().width(); - }); - if settings && content_w > widest + 0.5 { - ctx.data_mut(|d| d.insert_temp(widest_id, content_w)); - } - if let Some(w) = &shown { - // (the import review keeps its hand-picked photos however the click lands) - if !raw_blocked && app.ui.settings.close_dialogs_outside && !import && clicked_backdrop(ctx, w.response.rect, popup_was_open) { - close = true; - } else if raw_blocked { - // A press made under the prompt or library window must not be remembered as a - // backdrop press for a release that arrives after that covering window goes away. - ctx.data_mut(|d| d.remove_temp::(egui::Id::unique("dialog-backdrop-press"))); + .to_string() +} + +/// Whether a dialog only shows something: a model file LightCraft cannot use has nothing to confirm, nor has a +/// dialog that only shows something (one Close, no Cancel / OK). +fn is_informational(dlg: &Dialog) -> bool { + let unusable_model = matches!(dlg, Dialog::DenoiseModel { info, .. } | Dialog::FaceModel { info, .. } if info["kind"] == "unsupported"); + unusable_model || matches!(dlg, Dialog::LightroomResult { first: None, .. }) || only_shows(dlg) +} + +/// What the SAM 3 download looks like: installed, running, failed, and whether there is nowhere to download from. +struct SamState { + installed: bool, + running: bool, + failed: bool, + /// no download location in this build: nothing to offer but the manual install + by_hand: bool, +} + +impl SamState { + fn of(app: &LightcraftApp) -> Self { + let sam = &app.session.segmenter; + SamState { + installed: sam.installed(), + running: sam.download_status().running, + failed: sam.download_status().error.is_some(), + by_hand: sam_by_hand(sam), } } - if let Some(w) = shown { - ctx.memory_mut(|m| m.set_modal_layer(w.response.layer_id)); - if let Some(body_h) = body_h { - let measured = (w.response.rect.height() - body_h).max(0.0); - if (measured - chrome).abs() > 0.5 { - ctx.data_mut(|d| d.insert_temp(chrome_id, measured)); - ctx.request_repaint(); - } +} + +/// The label of a dialog's cancel button. +fn cancel_label(dlg: &Dialog, sam: &SamState) -> &'static str { + match dlg { + Dialog::SamModel { .. } if sam.running || sam.installed || sam.by_hand => "Close", + Dialog::SamModel { .. } => "Not Now", + Dialog::LightroomResult { .. } => "Close", + _ => "Cancel", + } +} + +/// The label of a dialog's confirm button (empty: it has none). +fn ok_label(app: &LightcraftApp, dlg: &Dialog, informational: bool, sam: &SamState) -> String { + let label = match dlg { + Dialog::Import { opts } => { + let n = opts.selected_paths().len(); + let verb = if opts.copy && opts.move_files { "Move" } else { "Import" }; + return crate::i18n::tr_format!("{verb} {n} Photo{}", if n == 1 { "" } else { "s" }, verb = crate::i18n::tr(verb), n = n); } - ctx.move_to_top(w.response.layer_id); - crate::widgets::register_response("dialog:window", w.response.rect, &w.response); + Dialog::LightroomResult { first: Some(_), .. } => "Show in Library", + Dialog::ContactSheet { .. } => "Choose PDF…", + Dialog::SlideshowExport { .. } => "Export…", + Dialog::Print => "Print to PDF…", + Dialog::Merge { .. } => "Merge", + Dialog::DenoiseModel { info, .. } if info["download"].is_string() => "Accept & Download", + Dialog::DenoiseModel { .. } => "Install", + Dialog::FaceModel { info, .. } if !informational && info["download"].is_string() => "Download", + Dialog::FaceModel { .. } if !informational => "Install", + Dialog::ConfirmDelete { .. } | Dialog::DeleteKeyword { .. } | Dialog::DeleteEffects { .. } => "Delete", + Dialog::SaveEffect { .. } => "Create", + Dialog::MovePhotos { .. } => "Move", + // (not "Merge": that is photo merging, HDR / panorama, in some languages) + Dialog::MoveKeyword { .. } => "Merge Keywords", + Dialog::KeywordSet { .. } => "Save", + Dialog::KeywordTag { editing: None, .. } => "Create", + Dialog::KeywordTag { .. } => "Save", + Dialog::RemoveFolder { .. } => "Remove", + Dialog::LightroomCatalog { .. } => "Import Lightroom Catalog…", + d @ Dialog::LightroomDestination { .. } => crate::lightroom_destination::ok_label(d), + Dialog::SynchronizeFolder { .. } if informational => "Close", + Dialog::SynchronizeFolder { .. } => "Synchronize", + Dialog::SamModel { .. } => return sam_ok_label(dlg, sam).to_string(), + Dialog::RenamePerson { from, to, .. } if person_rename_plan(&app.session.catalog, from, to).needs_merge => "Merge", + _ if informational => "Close", + _ => "OK", + }; + label.to_string() +} + +/// The label of the SAM 3 dialog's confirm button. +fn sam_ok_label(dlg: &Dialog, sam: &SamState) -> &'static str { + match dlg { + Dialog::SamModel { then: Some(_), .. } if sam.installed => "Continue", + Dialog::SamModel { .. } if sam.installed || sam.running || sam.by_hand => "", + Dialog::SamModel { error, .. } if error.is_some() || sam.failed => "Try Again", + _ => "Download", } - // (while the shortcuts editor records a key, it takes Esc itself to cancel; an open popup in - // the dialog, such as a date picker's calendar, takes it to close itself) - if !raw_blocked && ctx.input(|i| i.key_pressed(egui::Key::Escape)) && !crate::widgets::escape_taken(ctx) { - close = true; +} + +/// Whether the confirm button works: installing waits for the licence to be accepted (and Synchronize waits for the +/// scan), a rename waits for its conflicts to be settled, smart-album rules that can't mean anything wait to be fixed. +fn can_confirm(app: &LightcraftApp, dlg: &Dialog, informational: bool) -> bool { + let rename_blocked = match dlg { + Dialog::RenamePerson { from, to, merge } => { + let plan = person_rename_plan(&app.session.catalog, from, to); + plan.block.is_some() || (plan.needs_merge && !*merge) + } + _ => false, + }; + let waiting = matches!( + dlg, + Dialog::DenoiseModel { accepted: false, .. } | Dialog::FaceModel { accepted: false, .. } | Dialog::SynchronizeFolder { counts: None, .. } + ); + let bad_rules = + matches!(dlg, Dialog::SmartRules { id, rules, .. } if !rules.check_for(&app.session.catalog, id.map(lightcraft_catalog::AlbumId)).is_empty()); + !rename_blocked && (informational || (!waiting && !bad_rules)) +} + +/// The row of buttons under a dialog: Cancel and the confirm; `close` and `confirm` are set when one is clicked. +fn button_row(app: &LightcraftApp, ui: &mut egui::Ui, dlg: &Dialog, close: &mut bool, confirm: &mut bool) { + let informational = is_informational(dlg); + let sam = SamState::of(app); + let cancel = cancel_label(dlg, &sam); + let ok = ok_label(app, dlg, informational, &sam); + let ok = ok.as_str(); + let can_confirm = can_confirm(app, dlg, informational); + let primary = !informational && can_confirm && confirm_style(dlg) == ConfirmStyle::Primary; + use crate::button::{Button, Kind}; + // (each kind of dialog its own buttons: the keyboard's place doesn't carry from a + // dialog to the one it opens) + let kind = std::mem::discriminant(dlg); + let cancel_button = Button::new(cancel).widget("button:dialogCancel").id_salt(kind).min_width(72.0); + let ok_button = Button::new(ok) + .kind(if primary { Kind::Primary } else { Kind::Secondary }) + .enabled(can_confirm) + .widget("button:dialogOk") + .id_salt(kind) + .min_width(72.0); + // (Cancel first, then the confirm: the keyboard goes through them as the eye does) + let gap = ui.spacing().item_spacing.x; + let mut buttons_w = 0.0; + if !informational { + buttons_w += cancel_button.desired_size(ui).x + gap; } - if !raw_blocked && confirm { - match confirm_dialog(app, &dlg) { - // the import review stays open on an error (e.g. an unusable folder template), and so - // does Export (e.g. no folder chosen) so the choices aren't lost, and Edit Capture Time - // (a time that isn't a date, or a shift it refuses) - Err(e) - if matches!( - dlg, - Dialog::Import { .. } - | Dialog::Export { .. } - | Dialog::ContactSheet { .. } - | Dialog::SlideshowExport { .. } - | Dialog::Print - | Dialog::NewAlbum { .. } - | Dialog::NewSmartAlbum { .. } - | Dialog::SmartRules { .. } - | Dialog::KeywordTag { .. } - | Dialog::KeywordSet { .. } - | Dialog::SynchronizeFolder { .. } - | Dialog::SaveEffect { .. } - | Dialog::CaptureTime { .. } - ) => - { - app.toast(ctx, e) - } - // the SAM 3 dialog stays open to show the download (or why it can't start) - Err(e) if matches!(dlg, Dialog::SamModel { .. }) => { - if let Dialog::SamModel { error, .. } = &mut dlg { - *error = Some(e); - } - } - Ok(r) if matches!(dlg, Dialog::NewAlbum { .. }) && r.get("skipped").and_then(serde_json::Value::as_u64).is_some_and(|n| n > 0) => { - // albums hold library photos (issue #684): say which part of the selection stayed out - crate::panels::grid::toast_skipped(app, ctx, &r); - close = true; - } - // a move says how it went, or why nothing moved - Ok(r) if matches!(dlg, Dialog::MovePhotos { .. }) => { - if let Dialog::MovePhotos { name, .. } = &dlg { - let text = crate::panels::left::moved_text(r["moved"].as_u64().unwrap_or(0), name); - app.toast(ctx, text); - } - close = true; - } - Err(e) if matches!(dlg, Dialog::MovePhotos { .. }) => { - app.toast(ctx, e); - close = true; - } - // photos whose capture time doesn't read are left as they were: say so - Ok(r) if matches!(dlg, Dialog::CaptureTime { .. }) && r["unreadable"].as_u64().is_some_and(|n| n > 0) => { - app.toast(ctx, crate::i18n::tr("Photos whose capture time can't be read were left as they were")); - close = true; - } - // where a Lightroom catalog goes: stays open to be corrected (a folder that isn't - // empty), unless the library it names has gone - Err(e) if matches!(dlg, Dialog::LightroomDestination { .. }) => { - close = !crate::lightroom_destination::keeps_open_on_error(app, &dlg); - app.toast(ctx, e); - } - Ok(_) if keeps_open(app, &dlg) => { - if let Dialog::SamModel { error, .. } = &mut dlg { - *error = None; - } - } - _ => close = true, + if !ok.is_empty() { + buttons_w += ok_button.desired_size(ui).x; + } + ui.add_space((ui.available_width() - buttons_w).max(0.0)); + if !informational && cancel_button.show(ui).clicked() { + *close = true; + } + let r = (!ok.is_empty()).then(|| ok_button.show(ui)); + if r.is_some_and(|r| r.clicked()) { + if informational { + *close = true; + } else { + *confirm = true; } } - // a dialog opened from inside this one (a button in Settings that shows a licence) takes its place - if app.ui.dialog.as_ref().is_some_and(|now| *now != at_start) { - return; +} + +/// The dialog's confirm was pressed: do it. Whether the dialog closes. +fn confirmed(app: &mut LightcraftApp, ctx: &egui::Context, dlg: &mut Dialog) -> bool { + let mut closed = false; + match confirm_dialog(app, dlg) { + // the import review stays open on an error (e.g. an unusable folder template), and so + // does Export (e.g. no folder chosen) so the choices aren't lost, and Edit Capture Time + // (a time that isn't a date, or a shift it refuses) + Err(e) + if matches!( + dlg, + Dialog::Import { .. } + | Dialog::Export { .. } + | Dialog::ContactSheet { .. } + | Dialog::SlideshowExport { .. } + | Dialog::Print + | Dialog::NewAlbum { .. } + | Dialog::NewSmartAlbum { .. } + | Dialog::SmartRules { .. } + | Dialog::KeywordTag { .. } + | Dialog::KeywordSet { .. } + | Dialog::SynchronizeFolder { .. } + | Dialog::SaveEffect { .. } + | Dialog::CaptureTime { .. } + ) => + { + app.toast(ctx, e) + } + // the SAM 3 dialog stays open to show the download (or why it can't start) + Err(e) if matches!(dlg, Dialog::SamModel { .. }) => { + if let Dialog::SamModel { error, .. } = dlg { + *error = Some(e); + } + } + Ok(r) if matches!(dlg, Dialog::NewAlbum { .. }) && r.get("skipped").and_then(serde_json::Value::as_u64).is_some_and(|n| n > 0) => { + // albums hold library photos (issue #684): say which part of the selection stayed out + crate::panels::grid::toast_skipped(app, ctx, &r); + closed = true; + } + // a move says how it went, or why nothing moved + Ok(r) if matches!(dlg, Dialog::MovePhotos { .. }) => { + if let Dialog::MovePhotos { name, .. } = dlg { + let text = crate::panels::left::moved_text(r["moved"].as_u64().unwrap_or(0), name); + app.toast(ctx, text); + } + closed = true; + } + Err(e) if matches!(dlg, Dialog::MovePhotos { .. }) => { + app.toast(ctx, e); + closed = true; + } + // photos whose capture time doesn't read are left as they were: say so + Ok(r) if matches!(dlg, Dialog::CaptureTime { .. }) && r["unreadable"].as_u64().is_some_and(|n| n > 0) => { + app.toast(ctx, crate::i18n::tr("Photos whose capture time can't be read were left as they were")); + closed = true; + } + // where a Lightroom catalog goes: stays open to be corrected (a folder that isn't + // empty), unless the library it names has gone + Err(e) if matches!(dlg, Dialog::LightroomDestination { .. }) => { + closed = !crate::lightroom_destination::keeps_open_on_error(app, dlg); + app.toast(ctx, e); + } + Ok(_) if keeps_open(app, dlg) => { + if let Dialog::SamModel { error, .. } = dlg { + *error = None; + } + } + _ => closed = true, } - if !close && !blocked { - let frame = ctx.cumulative_frame_nr(); - ctx.data_mut(|d| d.insert_temp(egui::Id::unique(BACKDROP_SHOWN), frame)); - } - app.ui.dialog = if close { None } else { Some(dlg) }; + + closed } /// The last frame a dialog was drawn and stayed open, for [`clicked_backdrop`]. From b74612513c36b640bcc8a15acd7feaabdacfaeb4 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 20:32:45 +0000 Subject: [PATCH 70/93] refactor(ui-egui): split the Export dialog body into sections --- crates/ui-egui/src/dialogs.rs | 332 ++++++++++++++++++++-------------- 1 file changed, 198 insertions(+), 134 deletions(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index 4278404ffc..bca04fe0cc 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -6,6 +6,7 @@ use serde_json::json; use crate::LightcraftApp; use crate::state::Dialog; use crate::theme::Tokens; +use lightcraft_engine::export::{ExportOptions, Resize}; mod confirm; mod cull; @@ -1079,9 +1080,33 @@ fn contact_sheet_body(app: &mut LightcraftApp, ui: &mut egui::Ui, dlg: &mut Dial /// The body of the Export dialog. fn export_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut Dialog) { let Dialog::Export { opts, full_size, resize, preset_name, limit_kb, dir } = dlg else { return }; - use lightcraft_engine::export::{ExportFormat as F, MetadataPolicy as M, SharpenAmount as A, SharpenFor as S}; let n = app.session.selection.ids.len().max(1); ui.label(egui::RichText::new(crate::i18n::tr_format!("{n} photo{}", if n == 1 { "" } else { "s" }, n = n)).color(t.text_dim)); + export_preset_row(app, ui, opts, full_size, resize, limit_kb); + ui.add_space(4.0); + export_format_rows(ui, t, opts); + export_color_rows(ui, t, opts); + export_quality_rows(ui, opts, limit_kb); + if opts.format.is_rendered() { + export_size(ui, full_size, resize, &mut opts.ppi); + export_output_rows(app, ui, opts, *full_size, *resize); + } + ui.add_space(4.0); + export_naming_rows(ui, opts); + export_destination_rows(app, ui, t, opts, dir); + ui.add_space(4.0); + export_save_preset_row(app, ui, opts, *full_size, resize, *limit_kb, preset_name); +} + +/// Export dialog: load a built-in or saved set of options. +fn export_preset_row( + app: &mut LightcraftApp, + ui: &mut egui::Ui, + opts: &mut ExportOptions, + full_size: &mut bool, + resize: &mut Resize, + limit_kb: &mut u32, +) { // Preset: load a built-in or saved set of options into the dialog field(ui, "Preset", |ui| { let mut chosen = None; @@ -1109,7 +1134,11 @@ fn export_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut *opts = o; } }); - ui.add_space(4.0); +} + +/// Export dialog: the format, its variants and the bit depth. +fn export_format_rows(ui: &mut egui::Ui, t: &Tokens, opts: &mut ExportOptions) { + use lightcraft_engine::export::ExportFormat as F; let before = opts.format; // "Rendered DNG" is a DNG option (below), not a format of its own in this list let mut shown = if opts.format == F::RenderedDng { F::Dng } else { opts.format }; @@ -1155,6 +1184,12 @@ fn export_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut choices(ui, "Bit depth", "exportBitDepth", depths, &mut bd); opts.bit_depth = Some(bd); } +} + +/// Export dialog: HDR output and the color space it implies (or the choice of one). +fn export_color_rows(ui: &mut egui::Ui, t: &Tokens, opts: &mut ExportOptions) { + use lightcraft_engine::export::ExportFormat as F; + let rendered = opts.format.is_rendered(); if matches!(opts.format, F::Jpeg | F::Tiff | F::Avif | F::Png | F::Jxl) { let tip = crate::i18n::tr( "Photos edited in HDR: JPEG with an HDR gain map (looks right everywhere, brighter highlights on HDR displays), AVIF as 10-bit, PNG and JPEG XL as 16-bit Rec. 2020 PQ; TIFF needs 32-bit float", @@ -1197,6 +1232,11 @@ fn export_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut ui.label(egui::RichText::new(crate::i18n::tr(note)).color(t.text_dim)); } } +} + +/// Export dialog: quality and the other options of a lossy or JPEG XL file. +fn export_quality_rows(ui: &mut egui::Ui, opts: &mut ExportOptions, limit_kb: &mut u32) { + use lightcraft_engine::export::ExportFormat as F; if opts.format == F::Jxl { let tip = "Mathematically lossless: every pixel is kept exactly (larger files)"; ui.checkbox(&mut opts.jxl_lossless, crate::i18n::tr("Lossless")).on_hover_text(crate::i18n::tr(tip)); @@ -1219,121 +1259,128 @@ fn export_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut *limit_kb = k as u32; } } - if rendered { - export_size(ui, full_size, resize, &mut opts.ppi); +} + +/// Export dialog: sharpening, metadata and the watermark of a rendered photo. +fn export_output_rows(app: &mut LightcraftApp, ui: &mut egui::Ui, opts: &mut ExportOptions, full_size: bool, resize: Resize) { + use lightcraft_engine::export::{MetadataPolicy as M, SharpenAmount as A, SharpenFor as S}; + choices( + ui, + "Sharpen", + "exportSharpen", + &[(S::None, "None"), (S::Screen, "Screen"), (S::Matte, "Matte"), (S::Glossy, "Glossy")], + &mut opts.sharpen, + ); + if opts.sharpen != S::None { + choices(ui, "Amount", "exportSharpenAmount", &[(A::Low, "Low"), (A::Standard, "Standard"), (A::High, "High")], &mut opts.sharpen_amount); } - if rendered { - choices( - ui, - "Sharpen", - "exportSharpen", - &[(S::None, "None"), (S::Screen, "Screen"), (S::Matte, "Matte"), (S::Glossy, "Glossy")], - &mut opts.sharpen, - ); - if opts.sharpen != S::None { - choices(ui, "Amount", "exportSharpenAmount", &[(A::Low, "Low"), (A::Standard, "Standard"), (A::High, "High")], &mut opts.sharpen_amount); - } + choices( + ui, + "Metadata", + "exportMetadata", + &[(M::All, "All"), (M::AllExceptCamera, "No camera"), (M::Copyright, "Copyright"), (M::None, "None")], + &mut opts.metadata, + ); + if !matches!(opts.metadata, M::None | M::Copyright) { + ui.checkbox(&mut opts.remove_location, crate::i18n::tr("Remove location info")); } - if rendered { - choices( - ui, - "Metadata", - "exportMetadata", - &[(M::All, "All"), (M::AllExceptCamera, "No camera"), (M::Copyright, "Copyright"), (M::None, "None")], - &mut opts.metadata, - ); - if !matches!(opts.metadata, M::None | M::Copyright) { - ui.checkbox(&mut opts.remove_location, crate::i18n::tr("Remove location info")); - } - let mut wm_on = opts.watermark.is_some(); - if ui.checkbox(&mut wm_on, crate::i18n::tr("Watermark")).changed() { - opts.watermark = wm_on.then(|| lightcraft_engine::export::Watermark { text: "© ".into(), ..Default::default() }); - } - let wm_shown = opts.watermark.clone(); - if let Some(wm) = &wm_shown { - watermark_preview(app, ui, wm, (!*full_size).then_some(*resize)); - } - if let Some(wm) = &mut opts.watermark { - // text, or a graphic (a logo with transparency) - let mut graphic = !wm.image.is_empty() || ui.data(|d| d.get_temp::(egui::Id::unique("wm-graphic"))).unwrap_or(false); - let before = graphic; - choices(ui, "Style", "exportWmStyle", &[(false, "Text"), (true, "Graphic")], &mut graphic); - if graphic != before { - ui.data_mut(|d| d.insert_temp(egui::Id::unique("wm-graphic"), graphic)); - if !graphic { - wm.image.clear(); - } - } - if graphic { - field(ui, "Graphic", |ui| { - trailing_button_row(ui, |ui| { - if app.services.pick_files.is_some() - && crate::widgets::text_button(ui, "exportWmChoose", crate::i18n::tr("Choose…"), false).clicked() - && let Some(f) = app.services.pick_files.as_mut().and_then(|pick| pick().into_iter().next()) - { - wm.image = f; - } - crate::widgets::named( - ui.add(egui::TextEdit::singleline(&mut wm.image).hint_text("logo.png").desired_width(ui.available_width())), - crate::i18n::tr("Image"), - ); - }); - }); - let mut width = wm.image_width as f64 * 100.0; - if num(ui, &WM_IMAGE_WIDTH, &mut width) { - wm.image_width = (width / 100.0) as f32; - } - } else { - choices( - ui, - app.ui.language.tr("Text direction"), - "exportWmOrientation", - &[(false, app.ui.language.tr("Horizontal text")), (true, app.ui.language.tr("Vertical text"))], - &mut wm.vertical, - ); - field(ui, "Text", |ui| { - crate::widgets::named( - ui.add( - egui::TextEdit::multiline(&mut wm.text) - .desired_rows(2) - .hint_text(crate::i18n::tr("© Your Name")) - .desired_width(f32::INFINITY), - ), - crate::i18n::tr("Text"), - ) - }); - } - choices(ui, "Position", "exportWmAnchor", &WM_POSITIONS, &mut wm.anchor); - choices(ui, "Rotate", "exportWmRotation", &[(0u16, "0°"), (90, "90°"), (180, "180°"), (270, "270°")], &mut wm.rotation); - let mut size = wm.size as f64 * 100.0; - if !graphic && num(ui, &WM_SIZE, &mut size) { - wm.size = (size / 100.0) as f32; - } - let mut op = wm.opacity as f64 * 100.0; - if num(ui, &WM_OPACITY, &mut op) { - wm.opacity = (op / 100.0) as f32; - } - // like Lightroom Classic: a margin from the side edges and one from the top and bottom - // edges, each unused (greyed) when the position is centred along that axis - use lightcraft_engine::export::Anchor as P; - let across = !matches!(wm.anchor, P::Top | P::Center | P::Bottom); - if let Some(v) = crate::widgets::slider(ui, &WM_INSET_X, wm.inset_x as f64 * 100.0, across, None).value { - wm.inset_x = (v / 100.0) as f32; - } - let down = !matches!(wm.anchor, P::Left | P::Center | P::Right); - if let Some(v) = crate::widgets::slider(ui, &WM_INSET_Y, wm.inset_y as f64 * 100.0, down, None).value { - wm.inset_y = (v / 100.0) as f32; - } + export_watermark(app, ui, opts, full_size, resize); +} + +/// Export dialog: the watermark switch, its preview and its settings. +fn export_watermark(app: &mut LightcraftApp, ui: &mut egui::Ui, opts: &mut ExportOptions, full_size: bool, resize: Resize) { + let mut wm_on = opts.watermark.is_some(); + if ui.checkbox(&mut wm_on, crate::i18n::tr("Watermark")).changed() { + opts.watermark = wm_on.then(|| lightcraft_engine::export::Watermark { text: "© ".into(), ..Default::default() }); + } + let wm_shown = opts.watermark.clone(); + if let Some(wm) = &wm_shown { + watermark_preview(app, ui, wm, (!full_size).then_some(resize)); + } + if let Some(wm) = &mut opts.watermark { + // text, or a graphic (a logo with transparency) + let mut graphic = !wm.image.is_empty() || ui.data(|d| d.get_temp::(egui::Id::unique("wm-graphic"))).unwrap_or(false); + let before = graphic; + choices(ui, "Style", "exportWmStyle", &[(false, "Text"), (true, "Graphic")], &mut graphic); + if graphic != before { + ui.data_mut(|d| d.insert_temp(egui::Id::unique("wm-graphic"), graphic)); if !graphic { - ui.checkbox(&mut wm.shadow, crate::i18n::tr("Shadow")); + wm.image.clear(); } } - if opts.watermark != wm_shown { - // the preview above was drawn with the old settings - ui.ctx().request_repaint(); + if graphic { + field(ui, "Graphic", |ui| { + trailing_button_row(ui, |ui| { + if app.services.pick_files.is_some() + && crate::widgets::text_button(ui, "exportWmChoose", crate::i18n::tr("Choose…"), false).clicked() + && let Some(f) = app.services.pick_files.as_mut().and_then(|pick| pick().into_iter().next()) + { + wm.image = f; + } + crate::widgets::named( + ui.add(egui::TextEdit::singleline(&mut wm.image).hint_text("logo.png").desired_width(ui.available_width())), + crate::i18n::tr("Image"), + ); + }); + }); + let mut width = wm.image_width as f64 * 100.0; + if num(ui, &WM_IMAGE_WIDTH, &mut width) { + wm.image_width = (width / 100.0) as f32; + } + } else { + choices( + ui, + app.ui.language.tr("Text direction"), + "exportWmOrientation", + &[(false, app.ui.language.tr("Horizontal text")), (true, app.ui.language.tr("Vertical text"))], + &mut wm.vertical, + ); + field(ui, "Text", |ui| { + crate::widgets::named( + ui.add( + egui::TextEdit::multiline(&mut wm.text) + .desired_rows(2) + .hint_text(crate::i18n::tr("© Your Name")) + .desired_width(f32::INFINITY), + ), + crate::i18n::tr("Text"), + ) + }); + } + choices(ui, "Position", "exportWmAnchor", &WM_POSITIONS, &mut wm.anchor); + choices(ui, "Rotate", "exportWmRotation", &[(0u16, "0°"), (90, "90°"), (180, "180°"), (270, "270°")], &mut wm.rotation); + let mut size = wm.size as f64 * 100.0; + if !graphic && num(ui, &WM_SIZE, &mut size) { + wm.size = (size / 100.0) as f32; + } + let mut op = wm.opacity as f64 * 100.0; + if num(ui, &WM_OPACITY, &mut op) { + wm.opacity = (op / 100.0) as f32; + } + // like Lightroom Classic: a margin from the side edges and one from the top and bottom + // edges, each unused (greyed) when the position is centred along that axis + use lightcraft_engine::export::Anchor as P; + let across = !matches!(wm.anchor, P::Top | P::Center | P::Bottom); + if let Some(v) = crate::widgets::slider(ui, &WM_INSET_X, wm.inset_x as f64 * 100.0, across, None).value { + wm.inset_x = (v / 100.0) as f32; + } + let down = !matches!(wm.anchor, P::Left | P::Center | P::Right); + if let Some(v) = crate::widgets::slider(ui, &WM_INSET_Y, wm.inset_y as f64 * 100.0, down, None).value { + wm.inset_y = (v / 100.0) as f32; + } + if !graphic { + ui.checkbox(&mut wm.shadow, crate::i18n::tr("Shadow")); } } - ui.add_space(4.0); + if opts.watermark != wm_shown { + // the preview above was drawn with the old settings + ui.ctx().request_repaint(); + } +} + +/// Export dialog: compression and the file name. +fn export_naming_rows(ui: &mut egui::Ui, opts: &mut ExportOptions) { + use lightcraft_engine::export::ExportFormat as F; if opts.format == F::Tiff { use lightcraft_engine::export::TiffCompression as Z; choices(ui, "Compression", "exportTiffCompression", &[(Z::None, "None"), (Z::Lzw, "LZW"), (Z::Deflate, "ZIP")], &mut opts.tiff_compression); @@ -1373,6 +1420,10 @@ fn export_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut opts.start_number = v as u32; } } +} + +/// Export dialog: where the files go and what happens when one exists. +fn export_destination_rows(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, opts: &mut ExportOptions, dir: &mut String) { // like Lightroom Classic's Export To: one folder, or each photo's own folder (not on // the web, where originals live in the browser's storage, not in folders) use lightcraft_engine::export::DestinationMode as D; @@ -1407,36 +1458,49 @@ fn export_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut }); use lightcraft_engine::export::Conflict as K; choices(ui, "If file exists", "exportConflict", &[(K::Unique, "Add number"), (K::Overwrite, "Overwrite"), (K::Skip, "Skip")], &mut opts.conflict); - // After export: Apple Photos imports the files written (macOS only) - #[cfg(target_os = "macos")] - { - let r = ui.checkbox(&mut opts.add_to_photos, crate::i18n::tr("Add to Apple Photos")); - crate::widgets::register(ui, "exportAddToPhotos", r.rect); - if opts.add_to_photos { - field(ui, "Album", |ui| { - crate::widgets::named( - ui.add(egui::TextEdit::singleline(&mut opts.photos_album).hint_text(crate::i18n::tr("none")).desired_width(f32::INFINITY)), - crate::i18n::tr("Album"), - ) - }); - ui.label( - egui::RichText::new(crate::i18n::tr("The first time, macOS asks whether LightCraft may control Photos.")) - .size(11.0) - .color(t.text_dim), - ); - } - } - // nowhere to add them: a setting carried over from a Mac is dropped, not refused - #[cfg(not(target_os = "macos"))] - { - opts.add_to_photos = false; + export_apple_photos_rows(ui, t, opts); +} + +/// Export dialog, after export: Apple Photos imports the files written (macOS only). +#[cfg(target_os = "macos")] +fn export_apple_photos_rows(ui: &mut egui::Ui, t: &Tokens, opts: &mut ExportOptions) { + let r = ui.checkbox(&mut opts.add_to_photos, crate::i18n::tr("Add to Apple Photos")); + crate::widgets::register(ui, "exportAddToPhotos", r.rect); + if opts.add_to_photos { + field(ui, "Album", |ui| { + crate::widgets::named( + ui.add(egui::TextEdit::singleline(&mut opts.photos_album).hint_text(crate::i18n::tr("none")).desired_width(f32::INFINITY)), + crate::i18n::tr("Album"), + ) + }); + ui.label( + egui::RichText::new(crate::i18n::tr("The first time, macOS asks whether LightCraft may control Photos.")).size(11.0).color(t.text_dim), + ); } +} + +/// Nowhere to add them: a setting carried over from a Mac is dropped, not refused. +#[cfg(not(target_os = "macos"))] +fn export_apple_photos_rows(_ui: &mut egui::Ui, _t: &Tokens, opts: &mut ExportOptions) { + opts.add_to_photos = false; +} + +/// Export dialog: save the options as a preset. +fn export_save_preset_row( + app: &mut LightcraftApp, + ui: &mut egui::Ui, + opts: &ExportOptions, + full_size: bool, + resize: &Resize, + limit_kb: u32, + preset_name: &mut String, +) { ui.add_space(4.0); field(ui, "Save preset", |ui| { trailing_button_row(ui, |ui| { let named = !preset_name.trim().is_empty(); if crate::widgets::text_button(ui, "exportSavePreset", crate::i18n::tr("Save"), false).clicked() && named { - let params = export_dialog_params(opts, *full_size, resize, *limit_kb); + let params = export_dialog_params(opts, full_size, resize, limit_kb); match app.run("export.savePreset", json!({"name": preset_name.trim(), "params": params})) { Ok(_) => { app.toast(ui.ctx(), crate::i18n::tr_format!("Saved export preset “{}”", preset_name.trim())); From 7b4236bc8b5e00ed081e15bfea9241c299e28723 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 20:40:33 +0000 Subject: [PATCH 71/93] refactor(ui-egui): pass related arguments as small structs --- .../src/dialogs/settings/appearance.rs | 31 ++++--- .../src/dialogs/settings/slide_overlays.rs | 67 ++++++++++---- crates/ui-egui/src/panels.rs | 25 +++-- crates/ui-egui/src/panels/detail.rs | 22 +++-- crates/ui-egui/src/panels/detail/masks.rs | 18 +++- crates/ui-egui/src/panels/left.rs | 17 +++- crates/ui-egui/src/panels/left/albums.rs | 12 ++- crates/ui-egui/src/panels/left/dates.rs | 4 +- crates/ui-egui/src/panels/left/folders.rs | 8 +- crates/ui-egui/src/panels/left/keywords.rs | 4 +- crates/ui-egui/src/panels/left/local.rs | 10 +- crates/ui-egui/src/panels/left/rows.rs | 92 +++++++++++-------- crates/ui-egui/src/panels/person.rs | 24 ++++- crates/ui-egui/src/tests/lifecycle_037.rs | 17 +++- 14 files changed, 233 insertions(+), 118 deletions(-) diff --git a/crates/ui-egui/src/dialogs/settings/appearance.rs b/crates/ui-egui/src/dialogs/settings/appearance.rs index 571db16fc9..f714a97e62 100644 --- a/crates/ui-egui/src/dialogs/settings/appearance.rs +++ b/crates/ui-egui/src/dialogs/settings/appearance.rs @@ -17,9 +17,15 @@ pub(super) fn appearance(ui: &mut egui::Ui, t: &Tokens, s: &mut crate::state::Ap let mut cards = |ui: &mut egui::Ui, width: f32| { ui.spacing_mut().item_spacing.x = 12.0; let light: Vec<_> = LightTheme::ALL.iter().map(|l| (*l, l.kind())).collect(); - theme_card(ui, t, "Light Theme", light_active, &light, &mut s.light_theme, &mut s.favorite_themes, width); + theme_card( + ui, + t, + ThemeCard { title: "Light Theme", active: light_active, options: &light, width }, + &mut s.light_theme, + &mut s.favorite_themes, + ); let dark: Vec<_> = DarkTheme::ALL.iter().map(|d| (*d, d.kind())).collect(); - theme_card(ui, t, "Dark Theme", !light_active, &dark, &mut s.dark_theme, &mut s.favorite_themes, width); + theme_card(ui, t, ThemeCard { title: "Dark Theme", active: !light_active, options: &dark, width }, &mut s.dark_theme, &mut s.favorite_themes); }; if available < 440.0 { ui.vertical(|ui| cards(ui, available)); @@ -29,18 +35,19 @@ pub(super) fn appearance(ui: &mut egui::Ui, t: &Tokens, s: &mut crate::state::Ap ui.add_space(2.0); } +/// What a theme family's card shows. +struct ThemeCard<'a, V> { + title: &'a str, + /// the family in use + active: bool, + options: &'a [(V, crate::theme::ThemeKind)], + width: f32, +} + /// One family's card: its title (and "Active" when it is the one shown), a preview of the /// selected theme and a radio button per theme. -fn theme_card( - ui: &mut egui::Ui, - t: &Tokens, - title: &str, - active: bool, - options: &[(V, crate::theme::ThemeKind)], - value: &mut V, - favorites: &mut Vec, - width: f32, -) { +fn theme_card(ui: &mut egui::Ui, t: &Tokens, card: ThemeCard, value: &mut V, favorites: &mut Vec) { + let ThemeCard { title, active, options, width } = card; egui::Frame::new() .fill(t.inset) .stroke(egui::Stroke::new(1.0, if active { t.accent } else { t.field_border })) diff --git a/crates/ui-egui/src/dialogs/settings/slide_overlays.rs b/crates/ui-egui/src/dialogs/settings/slide_overlays.rs index 3d7412b584..fe72ed6a6a 100644 --- a/crates/ui-egui/src/dialogs/settings/slide_overlays.rs +++ b/crates/ui-egui/src/dialogs/settings/slide_overlays.rs @@ -30,14 +30,21 @@ fn set(app: &mut LightcraftApp, p: Value) { let _ = app.run("slideshow.overlays", p); } -/// A slider (`slider:{id}`) over `lo..=hi`; `wrap(value)` makes the `slideshow.overlays` request. -fn slider(app: &mut LightcraftApp, ui: &mut egui::Ui, id: &str, value: f64, lo: f64, hi: f64, unit: Unit, wrap: &dyn Fn(f64) -> Value) { - let (k, suffix) = match unit { +/// The span of a slider and how its value is shown. +struct Range { + lo: f64, + hi: f64, + unit: Unit, +} + +/// A slider (`slider:{id}`) over `range`; `wrap(value)` makes the `slideshow.overlays` request. +fn slider(app: &mut LightcraftApp, ui: &mut egui::Ui, id: &str, value: f64, range: Range, wrap: &dyn Fn(f64) -> Value) { + let (k, suffix) = match range.unit { Unit::Percent => (100.0, " %"), Unit::Degrees => (1.0, "°"), }; let mut v = value * k; - let r = ui.add(egui::Slider::new(&mut v, lo * k..=hi * k).suffix(suffix).max_decimals(1)); + let r = ui.add(egui::Slider::new(&mut v, range.lo * k..=range.hi * k).suffix(suffix).max_decimals(1)); register(ui, format!("slider:{id}"), r.rect); let p = wrap(v / k); if r.changed() @@ -125,10 +132,14 @@ fn placement(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, id: &str, p }); } row(ui, t, "Offset X", |ui| { - slider(app, ui, &format!("{id}OffsetX"), p.offset_x, -OFFSET_MAX / 2.0, OFFSET_MAX / 2.0, Unit::Percent, &|v| wrap(json!({"offsetX": v}))) + slider(app, ui, &format!("{id}OffsetX"), p.offset_x, Range { lo: -OFFSET_MAX / 2.0, hi: OFFSET_MAX / 2.0, unit: Unit::Percent }, &|v| { + wrap(json!({"offsetX": v})) + }) }); row(ui, t, "Offset Y", |ui| { - slider(app, ui, &format!("{id}OffsetY"), p.offset_y, -OFFSET_MAX / 2.0, OFFSET_MAX / 2.0, Unit::Percent, &|v| wrap(json!({"offsetY": v}))) + slider(app, ui, &format!("{id}OffsetY"), p.offset_y, Range { lo: -OFFSET_MAX / 2.0, hi: OFFSET_MAX / 2.0, unit: Unit::Percent }, &|v| { + wrap(json!({"offsetY": v})) + }) }); } @@ -171,8 +182,12 @@ pub fn sections(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) { row(ui, t, "Text", |ui| text(app, ui, "slideshowPlateText", &p.text, "Your name or studio", &|v| plate(json!({"text": v})))); row(ui, t, "Colour", |ui| colour(app, ui, "slideshowPlateColor", p.color, &|c| plate(json!({"color": c})))); } - row(ui, t, "Size", |ui| slider(app, ui, "slideshowPlateSize", p.size, 0.01, PLATE_SIZE_MAX, Unit::Percent, &|v| plate(json!({"size": v})))); - row(ui, t, "Opacity", |ui| slider(app, ui, "slideshowPlateOpacity", p.opacity, 0.0, 1.0, Unit::Percent, &|v| plate(json!({"opacity": v})))); + row(ui, t, "Size", |ui| { + slider(app, ui, "slideshowPlateSize", p.size, Range { lo: 0.01, hi: PLATE_SIZE_MAX, unit: Unit::Percent }, &|v| plate(json!({"size": v}))) + }); + row(ui, t, "Opacity", |ui| { + slider(app, ui, "slideshowPlateOpacity", p.opacity, Range { lo: 0.0, hi: 1.0, unit: Unit::Percent }, &|v| plate(json!({"opacity": v}))) + }); placement(app, ui, t, "slideshowPlate", &p.place, true, &plate); toggle(app, ui, "slideshowPlateBehind", p.behind, "Render behind image", &|v| plate(json!({"behind": v}))); } @@ -183,7 +198,9 @@ pub fn sections(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) { let stars = |v: Value| json!({ "ratingStars": v }); if toggle(app, ui, "slideshowStars", r.enabled, "Rating stars", &|v| stars(json!({"enabled": v}))) { row(ui, t, "Colour", |ui| colour(app, ui, "slideshowStarsColor", r.color, &|c| stars(json!({"color": c})))); - row(ui, t, "Size", |ui| slider(app, ui, "slideshowStarsSize", r.size, 0.01, STAR_SIZE_MAX, Unit::Percent, &|v| stars(json!({"size": v})))); + row(ui, t, "Size", |ui| { + slider(app, ui, "slideshowStarsSize", r.size, Range { lo: 0.01, hi: STAR_SIZE_MAX, unit: Unit::Percent }, &|v| stars(json!({"size": v}))) + }); placement(app, ui, t, "slideshowStars", &r.place, true, &stars); } @@ -205,24 +222,36 @@ pub fn sections(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) { return; // removed: the indices moved; drawn again next frame } row(ui, t, "Size", |ui| { - slider(app, ui, &format!("{id}Size"), o.size, 0.01, TEXT_SIZE_MAX / 2.0, Unit::Percent, &|v| wrap(json!({"size": v}))) + slider(app, ui, &format!("{id}Size"), o.size, Range { lo: 0.01, hi: TEXT_SIZE_MAX / 2.0, unit: Unit::Percent }, &|v| { + wrap(json!({"size": v})) + }) }); row(ui, t, "Colour", |ui| colour(app, ui, &format!("{id}Color"), o.color, &|c| wrap(json!({"color": c})))); - row(ui, t, "Opacity", |ui| slider(app, ui, &format!("{id}Opacity"), o.opacity, 0.0, 1.0, Unit::Percent, &|v| wrap(json!({"opacity": v})))); + row(ui, t, "Opacity", |ui| { + slider(app, ui, &format!("{id}Opacity"), o.opacity, Range { lo: 0.0, hi: 1.0, unit: Unit::Percent }, &|v| wrap(json!({"opacity": v}))) + }); placement(app, ui, t, &id, &o.place, true, &wrap); let sh = o.shadow; if toggle(app, ui, &format!("{id}Shadow"), sh.on, "Shadow", &|v| wrap(json!({"shadow": v}))) { row(ui, t, "Opacity", |ui| { - slider(app, ui, &format!("{id}ShadowOpacity"), sh.opacity, 0.0, 1.0, Unit::Percent, &|v| wrap(json!({"shadowOpacity": v}))) + slider(app, ui, &format!("{id}ShadowOpacity"), sh.opacity, Range { lo: 0.0, hi: 1.0, unit: Unit::Percent }, &|v| { + wrap(json!({"shadowOpacity": v})) + }) }); row(ui, t, "Offset", |ui| { - slider(app, ui, &format!("{id}ShadowOffset"), sh.offset, 0.0, SHADOW_OFFSET_MAX, Unit::Percent, &|v| wrap(json!({"shadowOffset": v}))) + slider(app, ui, &format!("{id}ShadowOffset"), sh.offset, Range { lo: 0.0, hi: SHADOW_OFFSET_MAX, unit: Unit::Percent }, &|v| { + wrap(json!({"shadowOffset": v})) + }) }); row(ui, t, "Radius", |ui| { - slider(app, ui, &format!("{id}ShadowRadius"), sh.radius, 0.0, SHADOW_RADIUS_MAX, Unit::Percent, &|v| wrap(json!({"shadowRadius": v}))) + slider(app, ui, &format!("{id}ShadowRadius"), sh.radius, Range { lo: 0.0, hi: SHADOW_RADIUS_MAX, unit: Unit::Percent }, &|v| { + wrap(json!({"shadowRadius": v})) + }) }); row(ui, t, "Angle", |ui| { - slider(app, ui, &format!("{id}ShadowAngle"), sh.angle, -180.0, 180.0, Unit::Degrees, &|v| wrap(json!({"shadowAngle": v}))) + slider(app, ui, &format!("{id}ShadowAngle"), sh.angle, Range { lo: -180.0, hi: 180.0, unit: Unit::Degrees }, &|v| { + wrap(json!({"shadowAngle": v})) + }) }); } } @@ -241,9 +270,13 @@ pub fn sections(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) { let wm = |v: Value| json!({ "watermark": v }); if toggle(app, ui, "slideshowWatermark", s.show_watermark, "Watermark", &|v| json!({"showWatermark": v})) { row(ui, t, "Text", |ui| text(app, ui, "slideshowWatermarkText", &w.text, "© Your Name", &|v| wm(json!({"text": v})))); - row(ui, t, "Size", |ui| slider(app, ui, "slideshowWatermarkSize", w.size as f64, 0.01, 0.15, Unit::Percent, &|v| wm(json!({"size": v})))); + row(ui, t, "Size", |ui| { + slider(app, ui, "slideshowWatermarkSize", w.size as f64, Range { lo: 0.01, hi: 0.15, unit: Unit::Percent }, &|v| wm(json!({"size": v}))) + }); row(ui, t, "Opacity", |ui| { - slider(app, ui, "slideshowWatermarkOpacity", w.opacity as f64, 0.05, 1.0, Unit::Percent, &|v| wm(json!({"opacity": v}))) + slider(app, ui, "slideshowWatermarkOpacity", w.opacity as f64, Range { lo: 0.05, hi: 1.0, unit: Unit::Percent }, &|v| { + wm(json!({"opacity": v})) + }) }); row(ui, t, "Position", |ui| { let mut a = w.anchor; diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rs index 4c2bed9353..ed9c45fb5d 100644 --- a/crates/ui-egui/src/panels.rs +++ b/crates/ui-egui/src/panels.rs @@ -46,21 +46,26 @@ pub use crate::dialogs::settings::slide_templates; pub use crate::dialogs::settings::slide_titles; use crate::theme::Tokens; +/// A side panel the user resizes: which side, how it is drawn and how wide it may be. +pub struct SidePanel<'a> { + /// the left side (else the right) + pub left: bool, + pub id: &'a str, + pub frame: egui::Frame, + /// the width the user chose + pub width: f32, + pub limits: crate::state::PanelWidth, + /// room to leave for what is beside the photo + pub reserve: f32, +} + /// Show a side panel the user resizes by dragging its inner edge. `width` (in [`crate::UiState`], /// so it survives navigation and restarts) is the source of truth: egui's own remembered size is /// dropped every frame, and a drag of the edge returns the new width to store. The panel never /// takes more than `available − reserve − MIN_PHOTO_WIDTH` (its minimum permitting), so the photo /// stays usable; a narrower window shrinks it without forgetting the chosen width. -pub fn resizable_side( - ui: &mut egui::Ui, - left: bool, - id: &str, - frame: egui::Frame, - width: f32, - limits: crate::state::PanelWidth, - reserve: f32, - add: impl FnOnce(&mut egui::Ui), -) -> Option { +pub fn resizable_side(ui: &mut egui::Ui, side: SidePanel, add: impl FnOnce(&mut egui::Ui)) -> Option { + let SidePanel { left, id, frame, width, limits, reserve } = side; // `Panel::new` stores `IdSalt::new(id)`; the panel's persisted key is // `parent_ui.scope_id().with_salt(that_salt)`, which is exactly `scope_id().with(id)`. // (Passing an already-built `Id` through `Panel::left` would salt it a second time.) diff --git a/crates/ui-egui/src/panels/detail.rs b/crates/ui-egui/src/panels/detail.rs index eee9d7d0c2..3eb94779cd 100644 --- a/crates/ui-egui/src/panels/detail.rs +++ b/crates/ui-egui/src/panels/detail.rs @@ -46,7 +46,7 @@ use info::{ preview_only_pill, quick_name, }; pub(crate) use info::{draw_focus_point, failed_pill, loupe_pill, rendering_overdue}; -use masks::{RegionEdit, color_range_pick, mask_overlay, region_overlay}; +use masks::{RegionContext, RegionEdit, color_range_pick, mask_overlay, region_overlay}; use retouch::{eye_overlay, remove_overlay}; pub(crate) use window::overlay_supports_window; use window::{WindowCtx, WindowView, draw_window, request_window}; @@ -541,7 +541,8 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { let people = if app.ui.name_edit.is_some() { app.caches.person_names(&app.session.catalog) } else { Default::default() }; // while the name box is open and recognition is not set up, the box offers the next step let setup = if app.ui.name_edit.is_some() { super::faces::setup(app, ui.ctx()) } else { super::faces::Setup::Running }; - match region_overlay(ui, &p, &map, &photo, d.orientation, hints.as_deref(), &people, &mut app.ui.name_edit, setup) { + let regions = RegionContext { photo: &photo, orient: d.orientation, hints: hints.as_deref(), people: &people, setup }; + match region_overlay(ui, &p, &map, ®ions, &mut app.ui.name_edit) { Some(RegionEdit::SetUp) => { app.ui.name_edit = None; super::faces::take_step(app, ui.ctx(), setup); @@ -596,7 +597,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { (true, Some(before), Some(q)) if before.contains(q) => (CanvasMap::new(&frame, before_img), before_img, *before), _ => (map, img_rect, main_area), }; - general_interaction(app, ui, &resp, &map, img, pane, native, aspect) + general_interaction(app, ui, &resp, &map, &PhotoPlacement { img, canvas: pane, native, aspect }) } } } @@ -761,16 +762,19 @@ fn general_cursor(app: &LightcraftApp, ui: &egui::Ui, resp: &egui::Response, img ui.ctx().set_cursor_icon(cursor); } -fn general_interaction( - app: &mut LightcraftApp, - ui: &mut egui::Ui, - resp: &egui::Response, - map: &CanvasMap, +/// Where the photo is on the canvas. +struct PhotoPlacement { + /// the photo's rectangle img: Rect, + /// the canvas it is shown on canvas: Rect, + /// the photo's size in pixels native: [usize; 2], aspect: f32, -) { +} + +fn general_interaction(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Response, map: &CanvasMap, placement: &PhotoPlacement) { + let PhotoPlacement { img, canvas, native, aspect } = *placement; if app.ui.tool == "wbPicker" { if resp.clicked() && let Some(q) = resp.interact_pointer_pos() diff --git a/crates/ui-egui/src/panels/detail/masks.rs b/crates/ui-egui/src/panels/detail/masks.rs index 50424f6b32..c150eac532 100644 --- a/crates/ui-egui/src/panels/detail/masks.rs +++ b/crates/ui-egui/src/panels/detail/masks.rs @@ -33,17 +33,25 @@ const REGION_HANDLES: [(f32, f32, egui::CursorIcon); 8] = [ /// on release (one undo step); the × reports the region to remove. Both are catalog-only edits: /// LightCraft doesn't write regions to XMP. Regions are stored on the upright (EXIF-oriented) photo; /// `orient` is the user's Rotate / Flip on top of it, which the loupe's normalized frame includes. +/// What the face/pet/focus regions of a photo are drawn from. +pub(super) struct RegionContext<'a> { + pub photo: &'a lightcraft_catalog::Photo, + /// the user's Rotate / Flip on top of the upright photo + pub orient: lightcraft_geom::Orientation, + pub hints: Option<&'a crate::panels::faces::Hints>, + /// the names to offer when a region is named + pub people: &'a [String], + pub setup: crate::panels::faces::Setup, +} + pub(super) fn region_overlay( ui: &egui::Ui, p: &egui::Painter, map: &CanvasMap, - photo: &lightcraft_catalog::Photo, - orient: lightcraft_geom::Orientation, - hints: Option<&crate::panels::faces::Hints>, - people: &[String], + regions: &RegionContext, editing: &mut Option, - setup: crate::panels::faces::Setup, ) -> Option { + let RegionContext { photo, orient, hints, people, setup } = *regions; let t = Tokens::get(p.ctx()); let clip = p.clip_rect(); let pointer = ui.input(|i| i.pointer.hover_pos()); diff --git a/crates/ui-egui/src/panels/left.rs b/crates/ui-egui/src/panels/left.rs index 522afe0840..27b86aa0d5 100644 --- a/crates/ui-egui/src/panels/left.rs +++ b/crates/ui-egui/src/panels/left.rs @@ -30,7 +30,7 @@ pub(crate) use local::{fs_cached, fs_cached_running, same_folder}; use local::{local_now, local_rows}; #[cfg(test)] pub(crate) use rows::{INDENT_STEP, MIN_INDENT_STEP}; -use rows::{LIBFOLDER_REVEALED, SCROLL_TO_ROW, row, set_tree_open}; +use rows::{LIBFOLDER_REVEALED, Row, SCROLL_TO_ROW, set_tree_open}; pub(crate) use rows::{content_width, indent_step, step_for}; pub(crate) use sections::PlacedSection; pub use sections::section_drag_feedback; @@ -90,18 +90,27 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { ("recentlyAdded", Icon::Clock, "Recently Added", None, LibrarySource::RecentlyAdded), ("picks", Icon::FlagPick, "Picks", Some(picks), LibrarySource::Picks), ] { - if row(app, ui, id, icon, label, count, src == s, 0.0).clicked() { + if Row::new(id, icon, label).count(count).selected(src == s).show(app, ui).clicked() { let _ = app.run("library.source", json!({"kind": id})); } } // photos whose files can't be found (checked every few seconds, not every frame) let missing = missing_count(app, ui); if (missing > 0 || src == LibrarySource::Missing) - && row(app, ui, "missing", Icon::Folder, "Missing Photos", Some(missing), src == LibrarySource::Missing, 0.0).clicked() + && Row::new("missing", Icon::Folder, "Missing Photos") + .count(Some(missing)) + .selected(src == LibrarySource::Missing) + .show(app, ui) + .clicked() { let _ = app.run("library.source", json!({"kind": "missing"})); } - if row(app, ui, "recentlyDeleted", Icon::Trash, "Recently Deleted", Some(deleted), src == LibrarySource::RecentlyDeleted, 0.0).clicked() { + if Row::new("recentlyDeleted", Icon::Trash, "Recently Deleted") + .count(Some(deleted)) + .selected(src == LibrarySource::RecentlyDeleted) + .show(app, ui) + .clicked() + { let _ = app.run("library.source", json!({"kind": "recentlyDeleted"})); } // the album just made: the folders down to it open, once (also when the section is shut) diff --git a/crates/ui-egui/src/panels/left/albums.rs b/crates/ui-egui/src/panels/left/albums.rs index bfcc6a219d..5237f69b8f 100644 --- a/crates/ui-egui/src/panels/left/albums.rs +++ b/crates/ui-egui/src/panels/left/albums.rs @@ -1,5 +1,5 @@ use super::folders::{folder_menu, is_within}; -use super::rows::{INDENT_STEP, indent_x, row_sensed, set_tree_open, tree_open, tree_toggle}; +use super::rows::{INDENT_STEP, Row, indent_x, set_tree_open, tree_open, tree_toggle}; use super::{Album, AlbumId, Align2, Icon, LibrarySource, LightcraftApp, Rect, Sense, Tokens, json, pos2, register, vec2}; /// Albums: the tree of albums and the folders they are sorted into. `reveal`: an album just made, @@ -34,8 +34,7 @@ fn albums_tree(app: &mut LightcraftApp, ui: &mut egui::Ui, all: &AlbumKids, pare open = true; set_tree_open(ui, open_id, true); } - let resp = - row_sensed(app, ui, &format!("folder:{}", a.id.0), Icon::Folder, &a.name, None, None, false, indent, Sense::click_and_drag(), None); + let resp = Row::new(&format!("folder:{}", a.id.0), Icon::Folder, &a.name).indent(indent).sense(Sense::click_and_drag()).show(app, ui); // a folder is no source, so its row folds it too; the triangle is the same click, aimed let has_children = all.get(&Some(a.id)).is_some_and(|v| !v.is_empty()); if resp.drag_started() { @@ -74,7 +73,12 @@ fn albums_tree(app: &mut LightcraftApp, ui: &mut egui::Ui, all: &AlbumKids, pare // a smart album whose rules no longer check (an album they test was deleted) says so let problems = app.caches.smart_album_problems(&app.session.catalog).get(&a.id).cloned().unwrap_or_default(); let label = if problems.is_empty() { label } else { format!("⚠ {label}") }; - let mut resp = row_sensed(app, ui, &format!("album:{}", a.id.0), icon, &label, None, Some(n), sel, indent, Sense::click_and_drag(), None); + let mut resp = Row::new(&format!("album:{}", a.id.0), icon, &label) + .count(Some(n)) + .selected(sel) + .indent(indent) + .sense(Sense::click_and_drag()) + .show(app, ui); if !problems.is_empty() { crate::widgets::register(ui, format!("albumProblem:{}", a.id.0), resp.rect); } diff --git a/crates/ui-egui/src/panels/left/dates.rs b/crates/ui-egui/src/panels/left/dates.rs index 9b822c6e55..2971cb2f4f 100644 --- a/crates/ui-egui/src/panels/left/dates.rs +++ b/crates/ui-egui/src/panels/left/dates.rs @@ -1,4 +1,4 @@ -use super::rows::{INDENT_STEP, row, tree_open, tree_toggle}; +use super::rows::{INDENT_STEP, Row, tree_open, tree_toggle}; use super::{Icon, LibrarySource, LightcraftApp, json}; /// By Date: year → month → day; a click filters by that prefix, the triangle opens a level. @@ -24,7 +24,7 @@ fn date_row(app: &mut LightcraftApp, ui: &mut egui::Ui, key: &str, label: &str, let open_id = egui::Id::unique(("date-open", key.to_string())); let mut open = tree_open(ui, open_id, false); let sel = app.session.filter.date.as_deref() == Some(key); - let resp = row(app, ui, &format!("date:{key}"), Icon::Clock, label, Some(count), sel, indent); + let resp = Row::new(&format!("date:{key}"), Icon::Clock, label).count(Some(count)).selected(sel).indent(indent).show(app, ui); if key.len() < 10 { tree_toggle(ui, &resp, indent, open_id, &mut open, format!("dateToggle:{key}")); } diff --git a/crates/ui-egui/src/panels/left/folders.rs b/crates/ui-egui/src/panels/left/folders.rs index 1ded12f072..20c1bbce13 100644 --- a/crates/ui-egui/src/panels/left/folders.rs +++ b/crates/ui-egui/src/panels/left/folders.rs @@ -1,7 +1,7 @@ use super::albums::pointer_over_row; use super::local::{same_folder, subfolders}; -use super::rows::{INDENT_STEP, LIBFOLDER_REVEALED, out_of_sight, row, row_sensed, set_tree_open, tree_open, tree_toggle}; -use super::{Album, FolderNode, Icon, LibrarySource, LightcraftApp, Sense, Tokens, json, register, vec2}; +use super::rows::{INDENT_STEP, LIBFOLDER_REVEALED, Row, out_of_sight, set_tree_open, tree_open, tree_toggle}; +use super::{Album, FolderNode, Icon, LibrarySource, LightcraftApp, Tokens, json, register, vec2}; /// A folder on disk with a disclosure triangle: click browses it, the triangle lists its /// subfolders. In the tree that holds the folder being browsed (`reveal`), the folders on the @@ -39,7 +39,7 @@ pub(super) fn folder_tree( if !out_of_sight(app, ui, &format!("local:{path}"), name, None, indent, false) { // at the tree's own indent, as in Albums and Folders: the triangle sits in the gutter and the // icon lines up with the rows above - let resp = row(app, ui, &format!("local:{path}"), Icon::Folder, name, None, sel, indent).on_hover_text(path); + let resp = Row::new(&format!("local:{path}"), Icon::Folder, name).selected(sel).indent(indent).show(app, ui).on_hover_text(path); let tr = tree_toggle(ui, &resp, indent, open_id, &mut open, format!("folderToggle:{path}")); if !tr.clicked() && resp.clicked() @@ -341,7 +341,7 @@ fn folder_row(app: &mut LightcraftApp, ui: &mut egui::Ui, n: &FolderNode, id: &s None => name.to_string(), }; let mark = n.label.map(crate::theme::label_color); - let resp = row_sensed(app, ui, id, Icon::Folder, name, Some(&spoken), Some(n.count), sel, indent, Sense::click(), mark); + let resp = Row::new(id, Icon::Folder, name).spoken(&spoken).count(Some(n.count)).selected(sel).indent(indent).mark(mark).show(app, ui); folder_drop_target(app, ui, &resp, n, open_id, open); let mut toggled = false; if !n.children.is_empty() { diff --git a/crates/ui-egui/src/panels/left/keywords.rs b/crates/ui-egui/src/panels/left/keywords.rs index 4342efcc6b..d8e1720a97 100644 --- a/crates/ui-egui/src/panels/left/keywords.rs +++ b/crates/ui-egui/src/panels/left/keywords.rs @@ -1,5 +1,5 @@ use super::dates::browse_all_photos; -use super::rows::{INDENT_STEP, out_of_sight, row, tree_open, tree_toggle}; +use super::rows::{INDENT_STEP, Row, out_of_sight, tree_open, tree_toggle}; use super::{Icon, KeywordNode, LightcraftApp, json}; /// "Keywords": the library's keyword tree with photo counts (`a|b|c` keywords nest). A click @@ -23,7 +23,7 @@ pub(super) fn keyword_rows(app: &mut LightcraftApp, ui: &mut egui::Ui, nodes: &[ /// One drawn row of [`keyword_rows`]; `open_id` and `open` are its triangle's when it has rows inside it. fn keyword_row(app: &mut LightcraftApp, ui: &mut egui::Ui, n: &KeywordNode, id: &str, indent: f32, open_id: Option, open: &mut bool) { let sel = app.session.filter.keyword.as_deref().is_some_and(|k| k.eq_ignore_ascii_case(&n.path)); - let resp = row(app, ui, id, Icon::Tag, &n.name, Some(n.count), sel, indent); + let resp = Row::new(id, Icon::Tag, &n.name).count(Some(n.count)).selected(sel).indent(indent).show(app, ui); if let Some(k) = open_id { tree_toggle(ui, &resp, indent, k, open, format!("keywordToggle:{}", n.path)); } diff --git a/crates/ui-egui/src/panels/left/local.rs b/crates/ui-egui/src/panels/left/local.rs index 6d35495701..1308059c84 100644 --- a/crates/ui-egui/src/panels/left/local.rs +++ b/crates/ui-egui/src/panels/left/local.rs @@ -1,5 +1,5 @@ use super::folders::folder_tree; -use super::rows::row; +use super::rows::Row; use super::{Icon, LibrarySource, LightcraftApp, SidebarSection, json, register}; /// Local's folders as they stand this frame, and the folder being browsed among them. @@ -61,8 +61,7 @@ pub(super) fn local_rows(app: &mut LightcraftApp, ui: &mut egui::Ui, now: &Local let reveal = local.owner == Some(i); folder_tree(app, ui, path, name, path, 0.0, current, reveal, transient); } - if app.services.pick_folder.is_some() && row(app, ui, "local:browse", Icon::Plus, crate::i18n::tr("Browse Folder…"), None, false, 0.0).clicked() - { + if app.services.pick_folder.is_some() && Row::new("local:browse", Icon::Plus, crate::i18n::tr("Browse Folder…")).show(app, ui).clicked() { let picked = app.services.pick_folder.as_mut().and_then(|f| f()); if let Some(path) = picked { match app.run("library.browse", json!({"path": path})) { @@ -80,7 +79,8 @@ pub(super) fn local_rows(app: &mut LightcraftApp, ui: &mut egui::Ui, now: &Local let hidden = now.hidden.len(); if hidden > 0 { let label = crate::i18n::tr_format!("Show {hidden} hidden location{}", if hidden == 1 { "" } else { "s" }, hidden = hidden); - let resp = row(app, ui, "local:restoreHidden", Icon::Folder, &label, None, false, 0.0) + let resp = Row::new("local:restoreHidden", Icon::Folder, &label) + .show(app, ui) .on_hover_text(crate::i18n::tr("Put the locations you removed from Local back (no files change)")); if let [(_, only)] = now.hidden.as_slice() { if resp.clicked() { @@ -505,7 +505,7 @@ mod tests { for frame in 0..3 { let raw = HeadlessView::raw_input(egui::vec2(300.0, 200.0), 1.0, frame as f64 / 60.0, vec![]); view.run(raw, |ui| { - super::row(&mut app, ui, "all", super::Icon::Photos, "All Photos", None, false, 0.0); + super::Row::new("all", super::Icon::Photos, "All Photos").show(&mut app, ui); super::folder_tree(&mut app, ui, path, "Pictures", path, 0.0, None, false, false); }); widgets = crate::widgets::take_registry(&view.ctx); diff --git a/crates/ui-egui/src/panels/left/rows.rs b/crates/ui-egui/src/panels/left/rows.rs index edfdff167d..ac364aa365 100644 --- a/crates/ui-egui/src/panels/left/rows.rs +++ b/crates/ui-egui/src/panels/left/rows.rs @@ -77,50 +77,66 @@ pub(crate) fn step_for(panel_w: f32, deepest: f32) -> f32 { [16.0, 14.0, 12.0, 10.0].into_iter().find(|step| levels * step <= room).unwrap_or(MIN_INDENT_STEP) } -pub(super) fn row( - app: &mut LightcraftApp, - ui: &mut egui::Ui, - id: &str, +/// One row of the sidebar, as it is drawn: build it with [`Row::new`] and the setters, then [`Row::show`] it. +pub(super) struct Row<'a> { + id: &'a str, icon: Icon, - label: &str, - count: Option, - selected: bool, - indent: f32, -) -> egui::Response { - row_named(app, ui, id, icon, label, None, count, selected, indent) -} - -/// [`row`] whose spoken name is `spoken` when the painted `label` is a shortened form of it. -fn row_named( - app: &mut LightcraftApp, - ui: &mut egui::Ui, - id: &str, - icon: Icon, - label: &str, - spoken: Option<&str>, - count: Option, - selected: bool, - indent: f32, -) -> egui::Response { - row_sensed(app, ui, id, icon, label, spoken, count, selected, indent, Sense::click(), None) -} - -/// [`row_named`] with the given `sense` (rows that can be dragged add `drag`) and a colour -/// label's dot (`mark`) before the count. -#[allow(clippy::too_many_arguments)] -pub(super) fn row_sensed( - app: &mut LightcraftApp, - ui: &mut egui::Ui, - id: &str, - icon: Icon, - label: &str, - spoken: Option<&str>, + label: &'a str, + /// the spoken name when the painted `label` is a shortened form of it + spoken: Option<&'a str>, count: Option, selected: bool, indent: f32, + /// rows that can be dragged add `drag` sense: Sense, + /// a colour label's dot, before the count mark: Option, -) -> egui::Response { +} + +impl<'a> Row<'a> { + pub(super) fn new(id: &'a str, icon: Icon, label: &'a str) -> Self { + Row { id, icon, label, spoken: None, count: None, selected: false, indent: 0.0, sense: Sense::click(), mark: None } + } + + pub(super) fn spoken(mut self, spoken: &'a str) -> Self { + self.spoken = Some(spoken); + self + } + + pub(super) fn count(mut self, count: Option) -> Self { + self.count = count; + self + } + + pub(super) fn selected(mut self, selected: bool) -> Self { + self.selected = selected; + self + } + + pub(super) fn indent(mut self, indent: f32) -> Self { + self.indent = indent; + self + } + + pub(super) fn sense(mut self, sense: Sense) -> Self { + self.sense = sense; + self + } + + pub(super) fn mark(mut self, mark: Option) -> Self { + self.mark = mark; + self + } + + /// Draw the row; the response is the row's. + pub(super) fn show(self, app: &mut LightcraftApp, ui: &mut egui::Ui) -> egui::Response { + draw_row(app, ui, self) + } +} + +/// Draw a [`Row`]. +fn draw_row(app: &mut LightcraftApp, ui: &mut egui::Ui, row: Row) -> egui::Response { + let Row { id, icon, label, spoken, count, selected, indent, sense, mark } = row; let label = if matches!(id, "all" | "recentlyAdded" | "picks" | "missing" | "recentlyDeleted") { crate::i18n::tr(label) } else { label }; let t = Tokens::get(ui.ctx()); let indent = drawn_indent(ui, indent); diff --git a/crates/ui-egui/src/panels/person.rs b/crates/ui-egui/src/panels/person.rs index 98b738cf23..0b6b946aa1 100644 --- a/crates/ui-egui/src/panels/person.rs +++ b/crates/ui-egui/src/panels/person.rs @@ -221,7 +221,9 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, name: &str) { let Some(f) = page.confirmed.get(row * cols + col) else { break }; shown += 1; let min = area.min + vec2(PAD + col as f32 * (edge + super::people::TILE_GAP), PAD + row as f32 * row_h); - if let Hit::Open = tile(app, ui, Rect::from_min_size(min, vec2(edge, edge)), f, ppp, false, &shown_name, 0) { + if let Hit::Open = + tile(app, ui, &TileSpec { r: Rect::from_min_size(min, vec2(edge, edge)), f, ppp, more: false, name: &shown_name, above_count: 0 }) + { hit = Some((Hit::Open, f.clone())); } } @@ -254,7 +256,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, name: &str) { shown += 1; let min = area.min + vec2(PAD + col as f32 * (edge + super::people::TILE_GAP), grid_top + row as f32 * row_h); let above_count = more.iter().filter(|candidate| candidate.score >= f.score).count(); - match tile(app, ui, Rect::from_min_size(min, vec2(edge, edge)), f, ppp, true, &shown_name, above_count) { + match tile(app, ui, &TileSpec { r: Rect::from_min_size(min, vec2(edge, edge)), f, ppp, more: true, name: &shown_name, above_count }) { Hit::Confirm => hit = Some((Hit::Confirm, (*f).clone())), Hit::ConfirmAbove => hit = Some((Hit::ConfirmAbove, (*f).clone())), Hit::Dismiss => hit = Some((Hit::Dismiss, (*f).clone())), @@ -287,9 +289,25 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, name: &str) { } } +/// What one face tile shows. +struct TileSpec<'a> { + /// where it is drawn + r: Rect, + f: &'a Face, + /// pixels per point, for the size of the face picture + ppp: f32, + /// a "More" tile (a face that looks like the person) rather than a confirmed one + more: bool, + /// the person's name + name: &'a str, + /// how many shown faces look at least as much like the person (for a "More" tile) + above_count: usize, +} + /// One face tile. A confirmed one opens its photo when clicked; a "More" one is confirmed when clicked, and has a × that /// hides it. -fn tile(app: &mut LightcraftApp, ui: &mut egui::Ui, r: Rect, f: &Face, ppp: f32, more: bool, name: &str, above_count: usize) -> Hit { +fn tile(app: &mut LightcraftApp, ui: &mut egui::Ui, spec: &TileSpec) -> Hit { + let TileSpec { r, f, ppp, more, name, above_count } = *spec; let t = Tokens::get(ui.ctx()); let salt = if more { "more-face" } else { "person-face" }; let resp = ui.interact(r, egui::Id::unique((salt, f.photo, f.index)), Sense::click()); diff --git a/crates/ui-egui/src/tests/lifecycle_037.rs b/crates/ui-egui/src/tests/lifecycle_037.rs index 3c4e8009b3..bb6f9d8600 100644 --- a/crates/ui-egui/src/tests/lifecycle_037.rs +++ b/crates/ui-egui/src/tests/lifecycle_037.rs @@ -121,9 +121,20 @@ fn resizable_side_stores_panel_state_under_the_parent_salted_key() { let ctx = egui::Context::default(); let raw = raw(egui::vec2(1000.0, 700.0)); frame(&ctx, raw, |ui| { - crate::panels::resizable_side(ui, true, "side-test", egui::Frame::NONE, 260.0, crate::state::LEFT_WIDTH, 300.0, |ui| { - ui.label("side"); - }); + crate::panels::resizable_side( + ui, + crate::panels::SidePanel { + left: true, + id: "side-test", + frame: egui::Frame::NONE, + width: 260.0, + limits: crate::state::LEFT_WIDTH, + reserve: 300.0, + }, + |ui| { + ui.label("side"); + }, + ); }); let modern = ctx.viewport_id().root_ui_id().with("side-test"); assert!( From 620826cac0b7b789a137c010d13485b75b5b7135 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Tue, 27 Oct 2026 20:45:29 +0000 Subject: [PATCH 72/93] refactor(ui-egui): shorten functions that format localized messages --- crates/ui-egui/src/dialogs/import/task.rs | 25 +++++------ crates/ui-egui/src/export_task.rs | 55 ++++++++++++----------- crates/ui-egui/src/i18n.rs | 6 +++ crates/ui-egui/src/menus/run.rs | 21 ++++----- crates/ui-egui/src/panels/chips.rs | 47 ++++++++++--------- crates/ui-egui/src/panels/compare.rs | 19 +++++--- crates/ui-egui/src/panels/mask_effects.rs | 35 ++++++++++----- crates/ui-egui/src/panels/notices.rs | 30 ++++++++----- crates/ui-egui/src/widgets.rs | 44 ++++++++++-------- crates/ui-egui/src/widgets/text_field.rs | 25 +++++++---- 10 files changed, 182 insertions(+), 125 deletions(-) diff --git a/crates/ui-egui/src/dialogs/import/task.rs b/crates/ui-egui/src/dialogs/import/task.rs index da2c1574f6..e1f506d5b4 100644 --- a/crates/ui-egui/src/dialogs/import/task.rs +++ b/crates/ui-egui/src/dialogs/import/task.rs @@ -422,19 +422,14 @@ fn xmp_warnings_text(warnings: &[ImportWarning]) -> String { ) } -/// `s` for a count other than one. -fn plural(n: usize) -> &'static str { - if n == 1 { "" } else { "s" } -} - /// The name of the import's one undo step. fn undo_label(task: &ImportTask) -> String { if task.imported == 0 && task.restored > 0 { - crate::i18n::tr_format!("Restore {} Photo{}", task.restored, plural(task.restored)) + crate::i18n::tr_format!("Restore {} Photo{}", task.restored, crate::i18n::plural_s(task.restored)) } else if task.restored > 0 { - crate::i18n::tr_format!("Add {} Photo{}, restore {}", task.imported, plural(task.imported), task.restored) + crate::i18n::tr_format!("Add {} Photo{}, restore {}", task.imported, crate::i18n::plural_s(task.imported), task.restored) } else { - crate::i18n::tr_format!("Add {} Photo{}", task.imported, plural(task.imported)) + crate::i18n::tr_format!("Add {} Photo{}", task.imported, crate::i18n::plural_s(task.imported)) } } @@ -481,20 +476,20 @@ fn quiet_finish(app: &mut LightcraftApp, ctx: &egui::Context, task: &ImportTask) if !task.warnings.is_empty() { app.toast_for(ctx, xmp_warnings_text(&task.warnings), 8.0); } else if task.auto && task.imported > 0 { - app.toast(ctx, crate::i18n::tr_format!("Auto Import: added {} photo{}", task.imported, plural(task.imported))); + app.toast(ctx, crate::i18n::tr_format!("Auto Import: added {} photo{}", task.imported, crate::i18n::plural_s(task.imported))); } else if !task.auto && task.failed > 0 { - app.toast(ctx, crate::i18n::tr_format!("{} photo{} not readable", task.failed, plural(task.failed))); + app.toast(ctx, crate::i18n::tr_format!("{} photo{} not readable", task.failed, crate::i18n::plural_s(task.failed))); } } /// What an import did, in a sentence. fn import_summary(app: &LightcraftApp, task: &ImportTask) -> String { let mut msg = if task.cancelled { - crate::i18n::tr_format!("Import cancelled · {} photo{} added", task.imported, plural(task.imported)) + crate::i18n::tr_format!("Import cancelled · {} photo{} added", task.imported, crate::i18n::plural_s(task.imported)) } else if task.imported == 0 && task.restored > 0 { - crate::i18n::tr_format!("Restored {} photo{} from Recently Deleted", task.restored, plural(task.restored)) + crate::i18n::tr_format!("Restored {} photo{} from Recently Deleted", task.restored, crate::i18n::plural_s(task.restored)) } else { - crate::i18n::tr_format!("Imported {} photo{}", task.imported, plural(task.imported)) + crate::i18n::tr_format!("Imported {} photo{}", task.imported, crate::i18n::plural_s(task.imported)) }; if task.restored > 0 && (task.imported > 0 || task.cancelled) { msg.push_str(&crate::i18n::tr_format!(" · {} restored from Recently Deleted", task.restored)); @@ -502,11 +497,11 @@ fn import_summary(app: &LightcraftApp, task: &ImportTask) -> String { if task.params["mode"] == "move" { msg.push_str(&crate::i18n::tr_format!(" · {} moved", task.moved)); if task.kept > 0 { - msg.push_str(&crate::i18n::tr_format!(" · {} original{} left at the source", task.kept, plural(task.kept))); + msg.push_str(&crate::i18n::tr_format!(" · {} original{} left at the source", task.kept, crate::i18n::plural_s(task.kept))); } } if task.duplicates > 0 { - msg.push_str(&crate::i18n::tr_format!(" · {} duplicate{} skipped", task.duplicates, plural(task.duplicates))); + msg.push_str(&crate::i18n::tr_format!(" · {} duplicate{} skipped", task.duplicates, crate::i18n::plural_s(task.duplicates))); let deleted = deleted_of(app, &task.existing).len(); if deleted > 0 { msg.push_str(&crate::i18n::tr_format!(" ({} in Recently Deleted)", deleted)); diff --git a/crates/ui-egui/src/export_task.rs b/crates/ui-egui/src/export_task.rs index 1aec848209..2061611028 100644 --- a/crates/ui-egui/src/export_task.rs +++ b/crates/ui-egui/src/export_task.rs @@ -232,6 +232,35 @@ pub fn poll_photos(app: &mut LightcraftApp, ctx: &egui::Context) { #[cfg(target_arch = "wasm32")] pub fn poll_photos(_: &mut LightcraftApp, _: &egui::Context) {} +/// What a finished export says: how many files were written, skipped or failed, and the Apple Photos note. +fn export_summary(files: &[Value], photos: Option<&Value>, total: usize, cancelled: bool) -> String { + let sheet = files.first().filter(|f| f["contactSheet"] == true); + let ok = files.iter().filter(|f| f.get("path").is_some()).count(); + let failed: Vec<&Value> = files.iter().filter(|f| f.get("error").is_some()).collect(); + let skipped = files.iter().filter(|f| f.get("skipped").is_some()).count(); + let mut m = crate::i18n::tr_format!("Exported {ok} of {total} photo{}", if total == 1 { "" } else { "s" }, ok = ok, total = total); + if let Some(sheet) = sheet { + m = format!("Exported contact sheet: {} photos, {} pages", sheet["photos"], sheet["pages"]); + } + if let Some(pdf) = files.first().filter(|f| f["print"] == true) { + m = format!("Printed to PDF: {} photos, {} pages", pdf["photos"], pdf["pages"]); + } + if skipped > 0 { + m += &crate::i18n::tr_format!(" · {skipped} skipped (file exists)", skipped = skipped); + } + if let Some(first) = failed.first() { + m += &crate::i18n::tr_format!(" · {} failed: {}", failed.len(), first["error"].as_str().unwrap_or("error")); + } + if cancelled { + m += " · cancelled"; + } + if let Some(photos) = photos { + m += " · "; + m += &apple_photos_note(photos); + } + m +} + /// Per frame: keep the activity row up to date; when the batch finishes, report it. pub fn poll(app: &mut LightcraftApp, ctx: &egui::Context) { let Some(task) = &app.export else { return }; @@ -244,31 +273,7 @@ pub fn poll(app: &mut LightcraftApp, ctx: &egui::Context) { let photos_failed = matches!(&r, Ok((_, Some(p), _)) if p.get("error").is_some()); let msg = match r { Ok((files, photos, _)) => { - let sheet = files.first().filter(|f| f["contactSheet"] == true); - let ok = files.iter().filter(|f| f.get("path").is_some()).count(); - let failed: Vec<&Value> = files.iter().filter(|f| f.get("error").is_some()).collect(); - let skipped = files.iter().filter(|f| f.get("skipped").is_some()).count(); - let mut m = - crate::i18n::tr_format!("Exported {ok} of {total} photo{}", if total == 1 { "" } else { "s" }, ok = ok, total = total); - if let Some(sheet) = sheet { - m = format!("Exported contact sheet: {} photos, {} pages", sheet["photos"], sheet["pages"]); - } - if let Some(pdf) = files.first().filter(|f| f["print"] == true) { - m = format!("Printed to PDF: {} photos, {} pages", pdf["photos"], pdf["pages"]); - } - if skipped > 0 { - m += &crate::i18n::tr_format!(" · {skipped} skipped (file exists)", skipped = skipped); - } - if let Some(first) = failed.first() { - m += &crate::i18n::tr_format!(" · {} failed: {}", failed.len(), first["error"].as_str().unwrap_or("error")); - } - if cancelled { - m += " · cancelled"; - } - if let Some(photos) = &photos { - m += " · "; - m += &apple_photos_note(photos); - } + let m = export_summary(&files, photos.as_ref(), total, cancelled); app.last_export_result = Some(json!({"files": files, "cancelled": cancelled, "applePhotos": photos})); m } diff --git a/crates/ui-egui/src/i18n.rs b/crates/ui-egui/src/i18n.rs index 8be0b3e8e6..a7df011c28 100644 --- a/crates/ui-egui/src/i18n.rs +++ b/crates/ui-egui/src/i18n.rs @@ -262,6 +262,12 @@ fn catalog_verbatim(language: Locale) -> BTreeMap { language.catalog().iter().map(|(key, value)| (key.clone(), value.as_str())).collect() } +/// `"s"` for a count other than one: the plural ending of English messages. Computed before a [`tr_format!`] rather +/// than inside it, since the macro repeats its arguments once per language. +pub(crate) fn plural_s(n: usize) -> &'static str { + if n == 1 { "" } else { "s" } +} + // `tr_format!` (one arm per message, one `format!` per language) is generated by `build.rs` from // `locales/*-formats.json`. include!(concat!(env!("OUT_DIR"), "/tr-formats.rs")); diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index ed45cbcb49..c88a502078 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -1869,11 +1869,6 @@ fn failed_files(v: &Value) -> impl Iterator + '_ { }) } -/// `s` for a count other than one. -fn plural(n: usize) -> &'static str { - if n == 1 { "" } else { "s" } -} - /// Import the `.cube` LUTs (and those inside zips / folders) as profiles; the answer to report back. fn import_luts(app: &mut LightcraftApp, lut_paths: &[&String], news: &mut ImportNews) -> Value { match app.session.execute("profile.import", &json!({"paths": lut_paths})) { @@ -1882,7 +1877,7 @@ fn import_luts(app: &mut LightcraftApp, lut_paths: &[&String], news: &mut Import if profiles > 0 { news.parts.push(crate::i18n::tr_format!( "Imported {profiles} profile{} (Profile browser ▸ their groups)", - plural(profiles), + crate::i18n::plural_s(profiles), profiles = profiles )); } @@ -1922,8 +1917,14 @@ fn presets_sentence(v: &Value, profile_news: bool) -> Option { // a zip of LUTs (or only local presets): the other half already says what happened (0, 0) if profile_news => return None, (0, 0) => "No new presets".to_string(), - (n, 0) => crate::i18n::tr_format!("Imported {n} preset{}", plural(n), n = n), - (n, f) => crate::i18n::tr_format!("Imported {n} preset{}, {f} file{} not readable", plural(n), plural(f), f = f, n = n), + (n, 0) => crate::i18n::tr_format!("Imported {n} preset{}", crate::i18n::plural_s(n), n = n), + (n, f) => crate::i18n::tr_format!( + "Imported {n} preset{}, {f} file{} not readable", + crate::i18n::plural_s(n), + crate::i18n::plural_s(f), + f = f, + n = n + ), }; Some(msg + ¬_carried_over(v)) } @@ -2131,11 +2132,11 @@ fn file_import_curve_presets_command(app: &mut LightcraftApp, ctx: &egui::Contex fn curve_import_message(v: &Value) -> String { let n = v["imported"].as_array().map_or(0, Vec::len); let failed = v["failed"].as_array().map_or(0, Vec::len); - let imported = crate::i18n::tr_format!("Imported {n} point curve preset{}", plural(n), n = n); + let imported = crate::i18n::tr_format!("Imported {n} point curve preset{}", crate::i18n::plural_s(n), n = n); if failed == 0 { return imported; } - imported + &crate::i18n::tr_format!(", {failed} file{} not readable", plural(failed), failed = failed) + imported + &crate::i18n::tr_format!(", {failed} file{} not readable", crate::i18n::plural_s(failed), failed = failed) } /// The `file.exportCurvePresets` command. diff --git a/crates/ui-egui/src/panels/chips.rs b/crates/ui-egui/src/panels/chips.rs index c18b3ad721..42640503e3 100644 --- a/crates/ui-egui/src/panels/chips.rs +++ b/crates/ui-egui/src/panels/chips.rs @@ -29,6 +29,31 @@ fn chip_width(ui: &egui::Ui, label: &str, font: egui::FontId) -> f32 { ui.painter().layout_no_wrap(label.to_string(), font, egui::Color32::WHITE).size().x + 12.0 + 22.0 } +/// The colour labels a label chip names, in words ("Red or Blue"). +fn label_names(filter: &lightcraft_catalog::Filter, catalog: &lightcraft_catalog::Catalog) -> String { + use crate::i18n::tr; + let shown = filter.labels_shown().unwrap_or_default(); + let name = |label: &lightcraft_catalog::ColorLabel| crate::i18n::color_label(catalog, *label); + let or = |labels: &[lightcraft_catalog::ColorLabel]| labels.iter().map(name).collect::>().join(&format!(" {} ", tr("or"))); + if !shown.is_empty() { + return or(&shown); + } + let plural = if filter.labels.len() > 1 { format!("({})", or(&filter.labels)) } else { or(&filter.labels) }; + format!("{} {} {plural}", filter.label.as_ref().map(name).unwrap_or_default(), tr("and")) +} + +/// The value of a `prefix: value` chip, localised. +fn prefixed_value(prefix: &str, value: &str, filter: &lightcraft_catalog::Filter) -> String { + use crate::i18n::{date_group_label, tr}; + let date = match prefix { + "Flag" | "Type" => return tr(value).to_string(), + "Date" => &filter.date, + "Imported" => &filter.imported, + _ => return value.to_string(), + }; + date.as_ref().map_or_else(|| value.to_string(), |date| date_group_label(date, false)) +} + /// Localise generated chip labels without rewriting search text or metadata values. pub(crate) fn display_label(chip: &FilterChip, filter: &lightcraft_catalog::Filter, catalog: &lightcraft_catalog::Catalog) -> String { use crate::i18n::{date_group_label, rules_label, tr}; @@ -41,16 +66,7 @@ pub(crate) fn display_label(chip: &FilterChip, filter: &lightcraft_catalog::Filt return format!("{}: {}", tr("Rules"), rules_label(rules, catalog)); } if chip.clear.get("label").is_some() { - let shown = filter.labels_shown().unwrap_or_default(); - let name = |label: &lightcraft_catalog::ColorLabel| crate::i18n::color_label(catalog, *label); - let or = |labels: &[lightcraft_catalog::ColorLabel]| labels.iter().map(name).collect::>().join(&format!(" {} ", tr("or"))); - let names = if shown.is_empty() { - let plural = if filter.labels.len() > 1 { format!("({})", or(&filter.labels)) } else { or(&filter.labels) }; - format!("{} {} {plural}", filter.label.as_ref().map(name).unwrap_or_default(), tr("and")) - } else { - or(&shown) - }; - return format!("{}: {names}", tr("Label")); + return format!("{}: {}", tr("Label"), label_names(filter, catalog)); } if chip.clear.get("dateFrom").is_some() || chip.clear.get("dateTo").is_some() { return match (&filter.date_from, &filter.date_to) { @@ -64,16 +80,7 @@ pub(crate) fn display_label(chip: &FilterChip, filter: &lightcraft_catalog::Filt return format!("{} {}", tr("Only"), crate::i18n::tr_format!("{n} photos", n = if filter.only_none { 0 } else { filter.only.len() })); } if let Some((prefix, value)) = chip.label.split_once(": ") { - let value = if matches!(prefix, "Flag" | "Type") { - tr(value).to_string() - } else if prefix == "Date" { - filter.date.as_ref().map_or_else(|| value.to_string(), |date| date_group_label(date, false)) - } else if prefix == "Imported" { - filter.imported.as_ref().map_or_else(|| value.to_string(), |date| date_group_label(date, false)) - } else { - value.to_string() - }; - return format!("{}: {value}", tr(prefix)); + return format!("{}: {}", tr(prefix), prefixed_value(prefix, value, filter)); } if let Some(value) = chip.label.strip_prefix("Rating ") { return format!("{} {value}", tr("Rating")); diff --git a/crates/ui-egui/src/panels/compare.rs b/crates/ui-egui/src/panels/compare.rs index 829500da47..9b9a236734 100644 --- a/crates/ui-egui/src/panels/compare.rs +++ b/crates/ui-egui/src/panels/compare.rs @@ -197,6 +197,17 @@ fn area_and_filmstrip(app: &mut LightcraftApp, ui: &mut egui::Ui) -> Rect { canvas } +/// Ask for the render of a tile (about `want` pixels on its long edge) and for the thumbnail shown meanwhile. +fn request_tile_renders(app: &mut LightcraftApp, id: PhotoId, slot: Slot, want: usize, aspect: f32) { + let (rw, rh) = if aspect >= 1.0 { (want, (want as f32 / aspect) as usize) } else { ((want as f32 * aspect) as usize, want) }; + if let Some(job) = app.session.render_job(id, rw.max(8), rh.max(8), false, true) { + app.renderer.request(slot, job, 60); + } + if let Some(job) = app.session.thumb_job(id, 256) { + app.renderer.request(Slot::Thumb(id), job, 30); + } +} + /// Draw one photo fitted into `area` (rendered at its display size into `slot`), with its caption /// strip below. Returns the image rect and the click/drag response. fn photo_tile(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId, slot: Slot, area: Rect, label: &str, zoom: Zoom) -> (Rect, egui::Response) { @@ -230,13 +241,7 @@ fn photo_tile(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId, slot: Slo let texture_side = super::detail::texture_side(ui.ctx()); let want = (img.width().max(img.height()).min(img_area.width().max(img_area.height()) * 4.0) * ppp).min(2560.0_f32.min(texture_side as f32)) as usize; - let (rw, rh) = if aspect >= 1.0 { (want, (want as f32 / aspect) as usize) } else { ((want as f32 * aspect) as usize, want) }; - if let Some(job) = app.session.render_job(id, rw.max(8), rh.max(8), false, true) { - app.renderer.request(slot, job, 60); - } - if let Some(job) = app.session.thumb_job(id, 256) { - app.renderer.request(Slot::Thumb(id), job, 30); - } + request_tile_renders(app, id, slot, want, aspect); // zoomed past what that render holds (1:1 to check focus): the part on screen as a window, as // in the loupe. Compare and Reference only; Survey tiles are fit views. let pane = match slot { diff --git a/crates/ui-egui/src/panels/mask_effects.rs b/crates/ui-egui/src/panels/mask_effects.rs index 86f3796b9f..d1c4fe1f49 100644 --- a/crates/ui-egui/src/panels/mask_effects.rs +++ b/crates/ui-egui/src/panels/mask_effects.rs @@ -683,23 +683,38 @@ pub fn manage_body( } } +/// The distinct values, sorted. +fn distinct<'a>(values: impl Iterator) -> Vec<&'a str> { + let mut v: Vec<&str> = values.collect(); + v.sort_unstable(); + v.dedup(); + v +} + /// The toast after an import (`preset.import` / `mask.importEffects` result): how many effects, /// in how many groups, and the settings they carry that LightCraft can't apply. pub fn import_toast(v: &Value) -> String { let rows: Vec<&Value> = v["effects"].as_array().or_else(|| v["imported"].as_array()).into_iter().flatten().collect(); - let n = rows.len(); - let mut msg = crate::i18n::tr_format!("Imported {e} mask effect{} (Masking ▸ Effect)", if n == 1 { "" } else { "s" }, e = n); - let mut groups: Vec<&str> = rows.iter().filter_map(|r| r["group"].as_str()).filter(|g| !g.is_empty()).collect(); - groups.sort_unstable(); - groups.dedup(); + let mut msg = imported_effects_message(rows.len()); + let groups = distinct(rows.iter().filter_map(|r| r["group"].as_str()).filter(|g| !g.is_empty())); if !groups.is_empty() { - msg += &crate::i18n::tr_format!(" in {g} group{}", if groups.len() == 1 { "" } else { "s" }, g = groups.len()); + msg += &in_groups_message(groups.len()); } - let mut skipped: Vec<&str> = rows.iter().flat_map(|r| r["unmapped"].as_array().into_iter().flatten()).filter_map(Value::as_str).collect(); - skipped.sort_unstable(); - skipped.dedup(); + let skipped = distinct(rows.iter().flat_map(|r| r["unmapped"].as_array().into_iter().flatten()).filter_map(Value::as_str)); if !skipped.is_empty() { - msg += &crate::i18n::tr_format!(" — kept but not applied: {}", skipped.join(", ")); + msg += ¬_applied_message(&skipped); } msg } + +fn imported_effects_message(n: usize) -> String { + crate::i18n::tr_format!("Imported {e} mask effect{} (Masking ▸ Effect)", crate::i18n::plural_s(n), e = n) +} + +fn in_groups_message(groups: usize) -> String { + crate::i18n::tr_format!(" in {g} group{}", crate::i18n::plural_s(groups), g = groups) +} + +fn not_applied_message(settings: &[&str]) -> String { + crate::i18n::tr_format!(" — kept but not applied: {}", settings.join(", ")) +} diff --git a/crates/ui-egui/src/panels/notices.rs b/crates/ui-egui/src/panels/notices.rs index 4dbbc1fd9f..96e356bb44 100644 --- a/crates/ui-egui/src/panels/notices.rs +++ b/crates/ui-egui/src/panels/notices.rs @@ -40,6 +40,22 @@ pub fn gpu_notice(reason: Option<&str>, enabled: bool) -> Option { Some(text) } +/// The quit prompt's text while `count` cancellable tasks run (`names` lists them). +fn tasks_message(count: usize, names: &str) -> String { + if count == 1 { + crate::i18n::tr_format!("1 task is still running: {names}. Quitting stops it.", names = names) + } else { + crate::i18n::tr_format!("{n} tasks are still running: {names}. Quitting stops them.", n = count, names = names) + } +} + +/// The quit prompt's text when `n` changes couldn't be written to disk, for the reason `e`. +fn unsaved_message(n: usize, e: &str) -> String { + let s = crate::i18n::plural_s(n); + let lost = if n == 1 { "it is" } else { "they are" }; + crate::i18n::tr_format!("{n} change{} couldn't be written to disk: {e}\nIf you quit now, {} lost.", s, lost, n = n, e = e) +} + /// The window may close now (`true`), or the quit prompt is shown (`false`). Running tasks that /// can be cancelled (an import, an export…) are asked about first; then changes that couldn't be /// written are retried — the log, then a snapshot of everything in memory. @@ -51,11 +67,7 @@ pub fn may_close(app: &mut LightcraftApp) -> bool { let running = app.session.activity.running_cancellable(); if !running.is_empty() { let names = running.iter().map(|t| crate::i18n::tr(&t.label)).collect::>().join(", "); - app.quit_prompt = Some(QuitPrompt::Tasks(if running.len() == 1 { - crate::i18n::tr_format!("1 task is still running: {names}. Quitting stops it.", names = names) - } else { - crate::i18n::tr_format!("{n} tasks are still running: {names}. Quitting stops them.", n = running.len(), names = names) - })); + app.quit_prompt = Some(QuitPrompt::Tasks(tasks_message(running.len(), &names))); return false; } if app.session.unsaved().is_none() { @@ -70,13 +82,7 @@ pub fn may_close(app: &mut LightcraftApp) -> bool { match app.session.unsaved() { None => true, Some((n, e)) => { - app.quit_prompt = Some(QuitPrompt::Unsaved(crate::i18n::tr_format!( - "{n} change{} couldn't be written to disk: {e}\nIf you quit now, {} lost.", - if n == 1 { "" } else { "s" }, - if n == 1 { "it is" } else { "they are" }, - n = n, - e = e - ))); + app.quit_prompt = Some(QuitPrompt::Unsaved(unsaved_message(n, e))); false } } diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index 558edfe8d3..513208066c 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -337,24 +337,9 @@ pub(crate) fn shown_value(spec: &ControlSpec, v: f64) -> String { /// scrub rather than a click that types a value. const SCRUB_START: f32 = 3.0; -/// The radius of a slider's hollow ring thumb. -const THUMB_RING: f32 = 7.0; - -/// A Lightroom slider row (label + value above a track with a hollow ring thumb). -/// Double-click the label or thumb to reset (hovering either says so). Shift-drag = fine adjustment. -/// Scroll sideways over it to nudge it. Click the value to type one: Return or clicking away applies it, -/// Esc keeps the old one. Drag the value sideways to scrub it, as if dragging the thumb (Shift: a tenth -/// as far). -pub fn slider(ui: &mut Ui, spec: &ControlSpec, value: f64, enabled: bool, label_override: Option<&str>) -> SliderOut { - let t = Tokens::get(ui.ctx()); - let w = ui.available_width(); - let (row, _) = ui.allocate_exact_size(vec2(w, t.slider_row_h), Sense::hover()); - let pad_l = 24.0; - let pad_r = 22.0; - let label_rect = Rect::from_min_size(pos2(row.left() + pad_l, row.top() + 4.0), vec2(w - pad_l - pad_r, 18.0)); - let track_rect = Rect::from_min_max(pos2(row.left() + pad_l, row.top() + 22.0), pos2(row.right() - pad_r, row.top() + 40.0)); - let id = ui.scope_id().with(spec.id); - let resp = ui.interact(track_rect.expand2(vec2(8.0, 2.0)), id, if enabled { Sense::click_and_drag() } else { Sense::hover() }); +/// Which slider the vertical wheel edits: clicking or dragging a slider arms it (and disarms the others), leaving +/// its row or its focus disarms it. Returns whether this slider is armed, and whether the pointer is in its row. +fn update_wheel_arming(ui: &mut Ui, id: egui::Id, resp: &egui::Response, row: Rect, enabled: bool) -> (bool, bool) { // Keyboard focus survives leaving the row; vertical wheel edits need a fresh click or drag // in it (at most one slider is armed: `wheel_slider_key`). let wheel_id = id.with("wheel-rem"); @@ -394,6 +379,29 @@ pub fn slider(ui: &mut Ui, spec: &ControlSpec, value: f64, enabled: bool, label_ }); wheel_armed = false; } + (wheel_armed, pointer_in_row) +} + +/// The radius of a slider's hollow ring thumb. +const THUMB_RING: f32 = 7.0; + +/// A Lightroom slider row (label + value above a track with a hollow ring thumb). +/// Double-click the label or thumb to reset (hovering either says so). Shift-drag = fine adjustment. +/// Scroll sideways over it to nudge it. Click the value to type one: Return or clicking away applies it, +/// Esc keeps the old one. Drag the value sideways to scrub it, as if dragging the thumb (Shift: a tenth +/// as far). +pub fn slider(ui: &mut Ui, spec: &ControlSpec, value: f64, enabled: bool, label_override: Option<&str>) -> SliderOut { + let t = Tokens::get(ui.ctx()); + let w = ui.available_width(); + let (row, _) = ui.allocate_exact_size(vec2(w, t.slider_row_h), Sense::hover()); + let pad_l = 24.0; + let pad_r = 22.0; + let label_rect = Rect::from_min_size(pos2(row.left() + pad_l, row.top() + 4.0), vec2(w - pad_l - pad_r, 18.0)); + let track_rect = Rect::from_min_max(pos2(row.left() + pad_l, row.top() + 22.0), pos2(row.right() - pad_r, row.top() + 40.0)); + let id = ui.scope_id().with(spec.id); + let resp = ui.interact(track_rect.expand2(vec2(8.0, 2.0)), id, if enabled { Sense::click_and_drag() } else { Sense::hover() }); + let wheel_id = id.with("wheel-rem"); + let (wheel_armed, pointer_in_row) = update_wheel_arming(ui, id, &resp, row, enabled); // screen readers: a slider named after its control, with its value let label_text = crate::i18n::tr(label_override.unwrap_or(spec.label)).to_string(); resp.widget_info(|| egui::WidgetInfo::slider(enabled, value, label_text.clone())); diff --git a/crates/ui-egui/src/widgets/text_field.rs b/crates/ui-egui/src/widgets/text_field.rs index cb150080b5..6b5c60c550 100644 --- a/crates/ui-egui/src/widgets/text_field.rs +++ b/crates/ui-egui/src/widgets/text_field.rs @@ -162,14 +162,10 @@ impl<'a> TextField<'a> { self } - /// Draw the field and return its response, any ending this frame, and whether an edit is - /// under way. Per-frame state keeps the pre-edit text for Esc, the selection across the - /// context menu, and select-on-focus; single-line Enter ends the edit, and focus loss ends it - /// except when the focus went to the field's own menu (a choice from the menu resumes the - /// edit). The menu offers cut/copy/paste/select-all (paste is omitted on the web; egui also - /// handles their keyboard shortcuts), and a field not drawn on the previous pass starts clean. - pub fn show(self, ui: &mut Ui) -> TextFieldResponse { - let id = id(self.widget); + /// The field's remembered state at the start of a pass: a field not drawn on the previous pass starts afresh, + /// a begun edit or a choice made from the menu last frame is carried out, and a field focused by the previous + /// pass selects its text when it asks to. + fn prepare(&self, ui: &mut Ui, id: egui::Id) -> Memo { let mut memo: Memo = ui.data_mut(|d| d.get_temp(id.with("memo"))).unwrap_or_default(); // a field not drawn last frame (its dialog or panel closed) starts afresh: an edit, a menu // or a choice from it that was under way is gone with it @@ -207,6 +203,19 @@ impl<'a> TextField<'a> { memo.before = Some(self.text.clone()); select_all(ui.ctx(), id, self.text); } + memo + } + + /// Draw the field and return its response, any ending this frame, and whether an edit is + /// under way. Per-frame state keeps the pre-edit text for Esc, the selection across the + /// context menu, and select-on-focus; single-line Enter ends the edit, and focus loss ends it + /// except when the focus went to the field's own menu (a choice from the menu resumes the + /// edit). The menu offers cut/copy/paste/select-all (paste is omitted on the web; egui also + /// handles their keyboard shortcuts), and a field not drawn on the previous pass starts clean. + pub fn show(self, ui: &mut Ui) -> TextFieldResponse { + let id = id(self.widget); + let pass = ui.ctx().cumulative_pass_nr(); + let mut memo = self.prepare(ui, id); let name = self.label.clone().or_else(|| self.hint.clone()); let mut edit = if self.multiline { egui::TextEdit::multiline(self.text) } else { egui::TextEdit::singleline(self.text) }; edit = edit.id(id); From 4ed9a5c86936708dc27c594f0113a69085413c9c Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 28 Oct 2026 03:20:48 +0000 Subject: [PATCH 73/93] refactor(ui-egui): split the grid cell and context menu --- crates/ui-egui/src/panels/grid.rs | 170 ++++++++++++++++------- crates/ui-egui/src/panels/left/albums.rs | 46 +++--- 2 files changed, 149 insertions(+), 67 deletions(-) diff --git a/crates/ui-egui/src/panels/grid.rs b/crates/ui-egui/src/panels/grid.rs index 262979cc5f..5064b8d401 100644 --- a/crates/ui-egui/src/panels/grid.rs +++ b/crates/ui-egui/src/panels/grid.rs @@ -770,7 +770,34 @@ fn cell(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId, r: Rect, square register(ui, format!("thumb:{}", id.0), r); let state = app.session.selection.state_of(id); let selected = state != lightcraft_engine::SelectionState::NotSelected; - // screen readers: the file, then rating / flag / label + let spoken = cell_description(app, &photo); + resp.widget_info(|| egui::WidgetInfo::selected(egui::Role::Button, true, selected, &spoken)); + let active = state == lightcraft_engine::SelectionState::Active; + let p = ui.painter(); + let img_rect = if square { + let base = if selected { t.cell_selected } else { t.cell }; + p.rect_filled(r, 0.0, crate::theme::label_background(base, photo.label, selected)); + Rect::from_min_max(r.min + vec2(10.0, 24.0), r.max - vec2(10.0, 10.0)) + } else { + r + }; + paint_cell_thumbnail(app, p, &t, id, img_rect, ThumbFlags { square, selected, active, onscreen, ppp }); + // labels and badges + paint_cell_caption(app, p, &t, &photo, r, square); + paint_cell_badges(app, p, &t, &photo, img_rect, BadgeFlags { square, selected, hovered: resp.hovered() }); + if let Some(name) = &photo.copy_name { + paint_copy_tag(p, &t, name, img_rect, square); + } + if let Some(why) = &photo.preview_only { + paint_preview_pill(ui, p, &t, id, why, img_rect); + } + if photo.flag == Flag::Reject { + p.rect_filled(img_rect, 0.0, Color32::from_black_alpha(110)); + } + cell_interaction(app, ui, &resp, id, &photo); +} + +fn cell_description(app: &LightcraftApp, photo: &lightcraft_catalog::Photo) -> String { let mut spoken = photo.file_name.clone(); if photo.rating > 0 { spoken.push_str(&crate::i18n::tr_format!(", {} star{}", photo.rating, if photo.rating == 1 { "" } else { "s" })); @@ -783,17 +810,11 @@ fn cell(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId, r: Rect, square if let Some(l) = photo.label { spoken.push_str(&crate::i18n::tr_format!(", {} label", crate::i18n::color_label(&app.session.catalog, l))); } - resp.widget_info(|| egui::WidgetInfo::selected(egui::Role::Button, true, selected, &spoken)); - let active = state == lightcraft_engine::SelectionState::Active; - let p = ui.painter(); - let img_rect = if square { - let base = if selected { t.cell_selected } else { t.cell }; - p.rect_filled(r, 0.0, crate::theme::label_background(base, photo.label, selected)); - Rect::from_min_max(r.min + vec2(10.0, 24.0), r.max - vec2(10.0, 10.0)) - } else { - r - }; - // thumbnail + spoken +} + +fn paint_cell_thumbnail(app: &mut LightcraftApp, p: &egui::Painter, t: &Tokens, id: PhotoId, img_rect: Rect, flags: ThumbFlags) { + let ThumbFlags { square, selected, active, onscreen, ppp } = flags; let size = thumb_px(img_rect.width().max(img_rect.height()), ppp); request_thumb(app, id, size, if onscreen { 10 } else { 5 }); if let Some(tex) = app.renderer.thumb(id) { @@ -822,7 +843,9 @@ fn cell(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId, r: Rect, square p.text(ph.center(), Align2::CENTER_CENTER, "!", t.semibold(18.0), t.text); } } - // labels and badges +} + +fn paint_cell_caption(app: &LightcraftApp, p: &egui::Painter, t: &Tokens, photo: &lightcraft_catalog::Photo, r: Rect, square: bool) { if square && app.ui.show_filenames { let m = &photo.meta; let name = match app.ui.grid_info.as_str() { @@ -850,8 +873,12 @@ fn cell(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId, r: Rect, square p.rect_filled(br, 2.0, Color32::from_gray(26)); p.galley(br.min + vec2(4.0, 1.5), g, t.text_label); } +} + +fn paint_cell_badges(app: &LightcraftApp, p: &egui::Painter, t: &Tokens, photo: &lightcraft_catalog::Photo, img_rect: Rect, flags: BadgeFlags) { + let BadgeFlags { square, selected, hovered } = flags; let show_badges = match app.ui.settings.grid_badges { - crate::state::GridBadges::Auto => resp.hovered() || selected || photo.rating > 0 || photo.flag != Flag::None || photo.label.is_some(), + crate::state::GridBadges::Auto => hovered || selected || photo.rating > 0 || photo.flag != Flag::None || photo.label.is_some(), crate::state::GridBadges::Always => true, crate::state::GridBadges::Never => false, }; @@ -863,7 +890,7 @@ fn cell(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId, r: Rect, square } if show_badges { let bar = badge_bar; - if (resp.hovered() || selected) && (square || photo.label.is_none()) { + if (hovered || selected) && (square || photo.label.is_none()) { p.rect_filled(bar, 0.0, Color32::from_black_alpha(120)); } let mut x = bar.left() + 6.0; @@ -882,40 +909,41 @@ fn cell(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId, r: Rect, square p.circle(pos2(right - 12.0, bar.center().y), 5.0, label_color(l), Stroke::new(1.0, Color32::from_black_alpha(120))); } } - if let Some(name) = &photo.copy_name { - // virtual copy: a folded-corner tag at the top right - let g = p.layout_no_wrap(name.clone(), t.semibold(10.5), Color32::WHITE); - let tr = if square { img_rect.right_top() + vec2(-6.0, 6.0) } else { img_rect.right_top() + vec2(-5.0, 5.0) }; - let br = Rect::from_min_max(pos2(tr.x - g.size().x - 26.0, tr.y), pos2(tr.x, tr.y + 20.0)); - p.rect_filled(br, 10.0, Color32::from_black_alpha(165)); - let c = pos2(br.left() + 13.0, br.center().y); - let s = 5.0; - p.add(egui::Shape::convex_polygon( - vec![c + vec2(-s, -s), c + vec2(s * 0.3, -s), c + vec2(s, -s * 0.3), c + vec2(s, s), c + vec2(-s, s)], - Color32::TRANSPARENT, - Stroke::new(1.2, Color32::WHITE), - )); - p.line_segment([c + vec2(s * 0.3, -s), c + vec2(s * 0.3, -s * 0.3)], Stroke::new(1.2, Color32::WHITE)); - p.line_segment([c + vec2(s * 0.3, -s * 0.3), c + vec2(s, -s * 0.3)], Stroke::new(1.2, Color32::WHITE)); - p.galley(pos2(br.left() + 22.0, br.center().y - g.size().y / 2.0), g, Color32::WHITE); - } - if let Some(why) = &photo.preview_only { - // a raw shown from its embedded JPEG: a small amber "Preview" pill at the image's bottom - // left, above the badge bar (always shown: it changes what editing does) - let g = p.layout_no_wrap(crate::i18n::tr("Preview").into(), t.semibold(9.5), Color32::WHITE); - let at = pos2(img_rect.left() + 6.0, img_rect.bottom() - 30.0 - 16.0); - let br = Rect::from_min_size(at, vec2(g.size().x + 24.0, 16.0)); - p.rect_filled(br, 8.0, Color32::from_black_alpha(170)); - paint(p, Rect::from_center_size(pos2(br.left() + 9.0, br.center().y), vec2(12.0, 12.0)), Icon::Info, t.caution); - p.galley(pos2(br.left() + 17.0, br.center().y - g.size().y / 2.0), g, Color32::WHITE); - register(ui, format!("badge:previewOnly:{}", id.0), br); - ui.interact(br, egui::Id::unique(("preview-only-badge", id.0)), Sense::hover()) - .on_hover_text(crate::i18n::tr_format!("Preview only — {}", crate::widgets::preview_only_explanation(why))); - } - if photo.flag == Flag::Reject { - p.rect_filled(img_rect, 0.0, Color32::from_black_alpha(110)); - } - // interaction +} + +fn paint_copy_tag(p: &egui::Painter, t: &Tokens, name: &str, img_rect: Rect, square: bool) { + // virtual copy: a folded-corner tag at the top right + let g = p.layout_no_wrap(name.to_string(), t.semibold(10.5), Color32::WHITE); + let tr = if square { img_rect.right_top() + vec2(-6.0, 6.0) } else { img_rect.right_top() + vec2(-5.0, 5.0) }; + let br = Rect::from_min_max(pos2(tr.x - g.size().x - 26.0, tr.y), pos2(tr.x, tr.y + 20.0)); + p.rect_filled(br, 10.0, Color32::from_black_alpha(165)); + let c = pos2(br.left() + 13.0, br.center().y); + let s = 5.0; + p.add(egui::Shape::convex_polygon( + vec![c + vec2(-s, -s), c + vec2(s * 0.3, -s), c + vec2(s, -s * 0.3), c + vec2(s, s), c + vec2(-s, s)], + Color32::TRANSPARENT, + Stroke::new(1.2, Color32::WHITE), + )); + p.line_segment([c + vec2(s * 0.3, -s), c + vec2(s * 0.3, -s * 0.3)], Stroke::new(1.2, Color32::WHITE)); + p.line_segment([c + vec2(s * 0.3, -s * 0.3), c + vec2(s, -s * 0.3)], Stroke::new(1.2, Color32::WHITE)); + p.galley(pos2(br.left() + 22.0, br.center().y - g.size().y / 2.0), g, Color32::WHITE); +} + +fn paint_preview_pill(ui: &egui::Ui, p: &egui::Painter, t: &Tokens, id: PhotoId, why: &str, img_rect: Rect) { + // a raw shown from its embedded JPEG: a small amber "Preview" pill at the image's bottom + // left, above the badge bar (always shown: it changes what editing does) + let g = p.layout_no_wrap(crate::i18n::tr("Preview").into(), t.semibold(9.5), Color32::WHITE); + let at = pos2(img_rect.left() + 6.0, img_rect.bottom() - 30.0 - 16.0); + let br = Rect::from_min_size(at, vec2(g.size().x + 24.0, 16.0)); + p.rect_filled(br, 8.0, Color32::from_black_alpha(170)); + paint(p, Rect::from_center_size(pos2(br.left() + 9.0, br.center().y), vec2(12.0, 12.0)), Icon::Info, t.caution); + p.galley(pos2(br.left() + 17.0, br.center().y - g.size().y / 2.0), g, Color32::WHITE); + register(ui, format!("badge:previewOnly:{}", id.0), br); + ui.interact(br, egui::Id::unique(("preview-only-badge", id.0)), Sense::hover()) + .on_hover_text(crate::i18n::tr_format!("Preview only — {}", crate::widgets::preview_only_explanation(why))); +} + +fn cell_interaction(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Response, id: PhotoId, photo: &lightcraft_catalog::Photo) { if let Some(k) = app.ui.keyword_painter.clone() { // painting: a click toggles the keyword on this photo if resp.hovered() { @@ -950,7 +978,21 @@ fn cell(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId, r: Rect, square } app.ui.dragging_photos = Some(app.session.selection.ids.iter().map(|p| p.0).collect()); } - crate::widgets::context_menu(&resp, |ui| context_menu(app, ui, id)); + crate::widgets::context_menu(resp, |ui| context_menu(app, ui, id)); +} + +struct ThumbFlags { + square: bool, + selected: bool, + active: bool, + onscreen: bool, + ppp: f32, +} + +struct BadgeFlags { + square: bool, + selected: bool, + hovered: bool, } /// The header of a Local folder view: the path as a breadcrumb (each part opens that folder), @@ -1215,6 +1257,16 @@ pub fn toggle_stack(app: &mut LightcraftApp, ctx: &egui::Context, id: PhotoId) { } pub fn context_menu(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { + context_menu_open_and_edit(app, ui, id); + context_menu_rate(app, ui); + context_menu_albums(app, ui, id); + context_menu_file_actions(app, ui); + context_menu_stack_and_edits(app, ui, id); + context_menu_locate_and_export(app, ui, id); + context_menu_delete(app, ui); +} + +fn context_menu_open_and_edit(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { if !app.session.selection.contains(id) { let _ = app.run("library.select", json!({"ids": [id.0]})); } @@ -1266,6 +1318,9 @@ pub fn context_menu(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { app.toast(ui.ctx(), e); } ui.separator(); +} + +fn context_menu_rate(app: &mut LightcraftApp, ui: &mut egui::Ui) { crate::widgets::menu_button(ui, crate::i18n::tr("Set Rating"), |ui| { for r in 0..=5 { if ui.button(if r == 0 { crate::i18n::tr("No Stars").to_string() } else { "★".repeat(r) }).clicked() { @@ -1281,6 +1336,9 @@ pub fn context_menu(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { } }); crate::widgets::menu_button(ui, crate::i18n::tr("Set Color Label"), |ui| label_menu(app, ui)); +} + +fn context_menu_albums(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { if local_only(app, &app.session.selected()) { // albums hold library photos (issue #684): nothing here to add until they join My Photos let add = ui.add_enabled(false, egui::Button::new(crate::i18n::tr("Add to Album"))).on_disabled_hover_text(albums_hint()); @@ -1323,6 +1381,9 @@ pub fn context_menu(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { let _ = app.run("album.setCover", json!({"id": aid.0, "photo": id.0})); } } +} + +fn context_menu_file_actions(app: &mut LightcraftApp, ui: &mut egui::Ui) { if ui.button(crate::i18n::tr("Rename…")).clicked() { let _ = app.run("dialog.rename", json!({})); } @@ -1354,6 +1415,9 @@ pub fn context_menu(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { if ui.button(crate::i18n::tr("Create Version")).clicked() { let _ = app.run("version.create", json!({})); } +} + +fn context_menu_stack_and_edits(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { crate::widgets::menu_button(ui, crate::i18n::tr("Stack"), |ui| { let stacked = app.session.catalog.stack_of(id).is_some(); let several = app.session.selection.ids.len() > 1; @@ -1405,6 +1469,9 @@ pub fn context_menu(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { let _ = app.run("photo.rotateRight", json!({})); } ui.separator(); +} + +fn context_menu_locate_and_export(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { // the original moved or its drive is gone: point the photo at the file again // (a cached answer, checked off the UI thread) let missing = matches!(&app.session.catalog.photo(id).map(|p| p.source.clone()), Some(lightcraft_catalog::Source::File { path }) if app.session.media.availability.is_offline(path)); @@ -1437,6 +1504,9 @@ pub fn context_menu(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) { } }); ui.separator(); +} + +fn context_menu_delete(app: &mut LightcraftApp, ui: &mut egui::Ui) { if crate::menubar::selection_deleted(app) { if ui.button(crate::i18n::tr("Restore")).clicked() { let _ = app.run("photo.restore", json!({})); diff --git a/crates/ui-egui/src/panels/left/albums.rs b/crates/ui-egui/src/panels/left/albums.rs index 5237f69b8f..92498eb023 100644 --- a/crates/ui-egui/src/panels/left/albums.rs +++ b/crates/ui-egui/src/panels/left/albums.rs @@ -397,23 +397,35 @@ fn drop_target(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Response let t = Tokens::get(ui.ctx()); ui.painter().rect_stroke(resp.rect.shrink2(vec2(8.0, 1.0)), 4.0, egui::Stroke::new(1.5, t.accent), egui::StrokeKind::Inside); if released { - match app.run("album.addPhotos", json!({"id": a.id.0, "ids": ids})) { - Ok(r) => { - let n = r.get("added").and_then(serde_json::Value::as_u64).unwrap_or(0); - let skipped = r.get("skipped").and_then(serde_json::Value::as_u64).unwrap_or(0); - let mut msg = crate::i18n::tr_format!("Added {n} photo{} to “{}”", if n == 1 { "" } else { "s" }, a.name, n = n); - if skipped > 0 { - msg.push_str(" · "); - msg.push_str(&crate::i18n::tr_format!( - "{n} Local photo{} skipped: albums hold library photos (Add to My Photos first)", - if skipped == 1 { "" } else { "s" }, - n = skipped - )); - } - app.toast(ui.ctx(), msg); - } - Err(e) => app.toast(ui.ctx(), e), - } + drop_photos_on_album(app, ui, a, ids); app.ui.dragging_photos = None; } } + +/// Adds the dragged photos to the album and toasts how many went in (and how many Local ones were skipped). +fn drop_photos_on_album(app: &mut LightcraftApp, ui: &egui::Ui, a: &Album, ids: Vec) { + match app.run("album.addPhotos", json!({"id": a.id.0, "ids": ids})) { + Ok(r) => app.toast(ui.ctx(), added_message(a, &r)), + Err(e) => app.toast(ui.ctx(), e), + } +} + +/// "Added N photos to “album”", plus a note when Local photos were skipped. +fn added_message(a: &Album, r: &serde_json::Value) -> String { + let n = r.get("added").and_then(serde_json::Value::as_u64).unwrap_or(0); + let skipped = r.get("skipped").and_then(serde_json::Value::as_u64).unwrap_or(0); + let mut msg = crate::i18n::tr_format!("Added {n} photo{} to “{}”", if n == 1 { "" } else { "s" }, a.name, n = n); + if skipped > 0 { + msg.push_str(" · "); + msg.push_str(&skipped_note(skipped)); + } + msg +} + +fn skipped_note(skipped: u64) -> String { + crate::i18n::tr_format!( + "{n} Local photo{} skipped: albums hold library photos (Add to My Photos first)", + if skipped == 1 { "" } else { "s" }, + n = skipped + ) +} From f858578f8c014104cdf3a9f5b468fdccd20e020e Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 28 Oct 2026 03:20:48 +0000 Subject: [PATCH 74/93] refactor(ui-egui): split the detail view, mask overlay and denoise panel --- crates/ui-egui/src/panels/denoise.rs | 64 +- crates/ui-egui/src/panels/detail.rs | 921 ++++++++++++++-------- crates/ui-egui/src/panels/detail/masks.rs | 332 ++++---- 3 files changed, 802 insertions(+), 515 deletions(-) diff --git a/crates/ui-egui/src/panels/denoise.rs b/crates/ui-egui/src/panels/denoise.rs index fdb208b511..b72df10b2e 100644 --- a/crates/ui-egui/src/panels/denoise.rs +++ b/crates/ui-egui/src/panels/denoise.rs @@ -319,6 +319,13 @@ fn work_section(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, list: &V if status["enabled"] != true { return; } + speed_section(app, ui, t, list, &status); + photos_section(app, ui, t, list, &status); + cache_section(app, ui, t, list, &status); +} + +/// Where the work runs. +fn speed_section(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, list: &Value, status: &Value) { heading(ui, t, "Speed"); let current = list["runOn"].as_str().unwrap_or("auto").to_string(); let mut run_on = current.as_str(); @@ -342,6 +349,10 @@ fn work_section(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, list: &V app.caches.denoise.epoch += 1; } } +} + +/// Whether photos are made as they are looked at, and the progress of what is being made. +fn photos_section(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, list: &Value, status: &Value) { heading(ui, t, "Photos"); let mut auto = list["auto"].as_bool().unwrap_or(true); if check(ui, "settings.denoiseAuto", &mut auto, "Make the denoised picture of the photos I am looking at") { @@ -350,27 +361,7 @@ fn work_section(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, list: &V } hint(ui, t, "Only photos whose AI Denoise amount is above 0 are made. Exports always make theirs if it is missing."); let (running, queued) = (app.caches.denoise.running, app.caches.denoise.queued); - match running { - Some((done, total)) => { - let name = status["running"]["photo"] - .as_u64() - .and_then(|p| app.session.catalog.photo(PhotoId(p)).map(|p| p.file_name.clone())) - .unwrap_or_default(); - let text = tr_format!( - "Denoising {name}: {done} of {total} tiles{}", - if queued > 0 { tr_format!(" · {queued} waiting", queued = queued) } else { String::new() }, - name = name, - done = done, - total = total - ); - settings_bar(ui, done, total, text); - } - None if queued > 0 => hint(ui, t, &count(queued, "photo waiting", "photos waiting")), - None => { - let ready = status["ready"].as_u64().unwrap_or(0); - hint(ui, t, &count(ready, "photo has its denoised picture.", "photos have their denoised picture.")) - } - } + progress_line(app, ui, t, status, running, queued); ui.horizontal(|ui| { let r = ui.button(tr("Denoise all photos with an Amount")); register(ui, "denoise:queueAll", r.rect); @@ -385,6 +376,37 @@ fn work_section(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, list: &V } } }); +} + +/// "Denoising {photo}: {done} of {total} tiles", and how many photos wait. +fn running_text(app: &LightcraftApp, status: &Value, done: u64, total: u64, queued: u64) -> String { + let name = + status["running"]["photo"].as_u64().and_then(|p| app.session.catalog.photo(PhotoId(p)).map(|p| p.file_name.clone())).unwrap_or_default(); + tr_format!("Denoising {name}: {done} of {total} tiles{}", waiting_suffix(queued), name = name, done = done, total = total) +} + +/// " · N waiting" after the running photo, when any wait. +fn waiting_suffix(queued: u64) -> String { + if queued > 0 { tr_format!(" · {queued} waiting", queued = queued) } else { String::new() } +} + +/// What is being made now, or how many photos wait or are done. +fn progress_line(app: &LightcraftApp, ui: &mut egui::Ui, t: &Tokens, status: &Value, running: Option<(u64, u64)>, queued: u64) { + match running { + Some((done, total)) => { + let text = running_text(app, status, done, total, queued); + settings_bar(ui, done, total, text); + } + None if queued > 0 => hint(ui, t, &count(queued, "photo waiting", "photos waiting")), + None => { + let ready = status["ready"].as_u64().unwrap_or(0); + hint(ui, t, &count(ready, "photo has its denoised picture.", "photos have their denoised picture.")) + } + } +} + +/// The cache's contents and limit. +fn cache_section(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, list: &Value, status: &Value) { heading(ui, t, "Cache"); let (files, bytes) = (status["cache"]["files"].as_u64().unwrap_or(0), status["cache"]["bytes"].as_u64().unwrap_or(0)); hint( diff --git a/crates/ui-egui/src/panels/detail.rs b/crates/ui-egui/src/panels/detail.rs index 3eb94779cd..2b58595d2a 100644 --- a/crates/ui-egui/src/panels/detail.rs +++ b/crates/ui-egui/src/panels/detail.rs @@ -138,11 +138,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { filmstrip(app, ui, Rect::from_min_max(pos2(full.left(), canvas.bottom()), full.max)); } let Some(id) = app.session.active() else { - if super::empty_library::shown(&app.session) { - super::empty_library::show(app, ui, canvas); - } else { - super::empty_message(ui, canvas, "No photo selected", "Choose a photo in the grid or filmstrip"); - } + show_no_photo(app, ui, canvas); return; }; let Some(photo) = app.session.catalog.photo(id).cloned() else { return }; @@ -154,47 +150,15 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { let frame = Frame::with_lens(photo.width.max(1) as usize, photo.height.max(1) as usize, &d, !crop_tool, photo.embedded_lens.as_ref()); let aspect = frame.aspect() as f32; let ppp = ui.ctx().pixels_per_point(); - let area = canvas.shrink(if fullscreen { - 0.0 - } else if crop_tool { - 48.0 - } else { - 24.0 - }); + let area = canvas.shrink(loupe_margin(fullscreen, crop_tool)); let native = output_px(&frame); let texture_side = texture_side(ui.ctx()); // two views (before, after): side by side or stacked let split = matches!(app.ui.before_after, BeforeAfter::SideBySide | BeforeAfter::TopBottom); let split_view = matches!(app.ui.before_after, BeforeAfter::Split | BeforeAfter::SplitTopBottom); - let areas: Vec = match app.ui.before_after { - BeforeAfter::SideBySide => { - let half = area.width() / 2.0 - 6.0; - vec![ - Rect::from_min_size(area.min, vec2(half, area.height())), - Rect::from_min_size(pos2(area.center().x + 6.0, area.top()), vec2(half, area.height())), - ] - } - BeforeAfter::TopBottom => { - let half = area.height() / 2.0 - 14.0; - vec![ - Rect::from_min_size(area.min, vec2(area.width(), half)), - Rect::from_min_size(pos2(area.left(), area.center().y + 14.0), vec2(area.width(), half)), - ] - } - _ => vec![area], - }; + let areas = view_areas(app.ui.before_after, area); let main_area = *areas.last().unwrap_or(&area); - // A previous crop/rotation can stay visible while its replacement renders. Its pixels - // must not override the current frame geometry, even when it is the same photo. - let current_texture = |t: &&crate::render::Tex| t.photo == id && t.look == Some((crate::render::geometry_look(&d), !crop_tool)); - let visible_texture_aspect = app - .renderer - .textures - .get(&Slot::Main) - .filter(current_texture) - .or_else(|| app.renderer.textures.get(&Slot::Preview).filter(current_texture)) - .or_else(|| app.renderer.thumb(id).filter(current_texture)) - .map(|tex| tex.size[0].max(1) as f32 / tex.size[1].max(1) as f32); + let visible_texture_aspect = visible_texture_aspect(app, id, &d, crop_tool); // Follow the texture only where it really differs (an unsupported raw's embedded JPEG with // another crop): a texture's whole-pixel size is a little off the exact aspect, and the crop // tool's overlays need the frame's own geometry. @@ -204,15 +168,13 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { let mut target_rect = fit_rect(main_area, display_aspect, app.ui.zoom, native, ppp, app.ui.pan); let mut img_rect = animated_rect(ui.ctx(), &mut app.ui.zoom_anim, target_rect); let in_pane = |pane: Rect, image: Rect| image.translate(pane.center() - main_area.center()); - let mut navigating = false; - for &view_area in &areas { + let navigating = areas.iter().any(|&view_area| { let view_img = in_pane(view_area, img_rect); - if navigate_gesture(app, ui, &resp, view_area, view_img, native) || middle_pan(app, ui, &resp, view_area, view_img) { - navigating = true; - target_rect = fit_rect(main_area, display_aspect, app.ui.zoom, native, ppp, app.ui.pan); - img_rect = target_rect; - break; - } + navigate_gesture(app, ui, &resp, view_area, view_img, native) || middle_pan(app, ui, &resp, view_area, view_img) + }); + if navigating { + target_rect = fit_rect(main_area, display_aspect, app.ui.zoom, native, ppp, app.ui.pan); + img_rect = target_rect; } let before_img = in_pane(areas[0], img_rect); let before_target = in_pane(areas[0], target_rect); @@ -222,14 +184,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { let overlay = view_overlay(app, &d); // a drag drafts at full size where the GPU draws the view (by the GPU's own rule, `handles`; // `ready` first: `available` would wait for a device still being created) - let gpu = interacting - && lightcraft_engine::gpu::handles( - lightcraft_pipeline::OutputDepth::U8, - app.ui.soft_proof && lightcraft_pipeline::proof_profile(app.ui.proof.profile).is_some(), - overlay, - ) - && lightcraft_engine::gpu::ready() - && lightcraft_engine::gpu::available(); + let gpu = interacting && gpu_draws_view(app, overlay); let shown = app.renderer.textures.get(&Slot::Main).filter(|t| t.photo == id && t.quick.is_none()).map(|t| (t.key, t.ms)); let drag = app.session.interaction.as_ref().map(|i| (i.photo, i.label.as_str())); let now = ui.input(|i| i.time); @@ -250,10 +205,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { draft, windows: overlay_supports_window(overlay), }; - let mut plan = crate::region::plan(&app.ui.settings, sizes); - if plan.window_edge.is_some_and(|edge| app.window_refused == Some((id, look, edge))) { - plan = crate::region::plan(&app.ui.settings, crate::region::ViewSizes { windows: false, ..sizes }); - } + let plan = loupe_plan(app, id, look, sizes); // time the full-size drafts where they are what shows: under a window the whole-frame draft // is small anyway, and the frame's time is the window's upload if let Some((key, ms)) = shown.filter(|_| plan.window_edge.is_none()) { @@ -271,14 +223,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { // copied 1:1 (no resample in the pipeline, whose prefilter and bilinear pass soften detail near // the output's limit) and shrunk once, by the Lanczos display fit below. // (zoomed in under a window render, the whole frame is hidden: it stays canvas-sized) - let want = if interacting || plan.window_edge.is_some() { - plan.main_edge - } else { - // (a user's explicit Preview size below the preview level still caps it) - let limit = if app.ui.settings.preview_limit == 0 { usize::MAX } else { app.ui.settings.preview_limit as usize }; - let floor = lightcraft_engine::SourceLevel::Preview.max_edge().min(limit).min(native_long); - plan.main_edge.max(floor).min(texture_side.max(crate::state::MIN_TEXTURE_SIDE)) - }; + let want = whole_frame_edge(app, interacting, &plan, native_long, texture_side); // The short side is rounded, not truncated: a truncated box (2560 x 1706 for a 2560 x 1707 // source) made the render a slightly anisotropic resample of its source, a 2-tap blur along // one axis only. A box that matches the source to rounding is rendered at exactly its size. @@ -287,72 +232,19 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { // hover and before renders are stand-ins: the preview size is plenty and keeps them cheap let se = app.ui.settings.stand_in_edge(want, texture_side); let (sw, sh) = if aspect >= 1.0 { (se, short(se, aspect)) } else { (short(se, 1.0 / aspect), se) }; - if let Some(job) = app.session.loupe_job(id, rw.max(8), rh.max(8), !crop_tool) { - let job = if interacting { job.draft() } else { job }; - // at rest the render is shrunk to exactly the size it is drawn at with a Lanczos filter on - // the worker, so the window draws it texel for texel instead of shrinking it with 2-tap - // sampling (the render is up to a 64 px step larger, or the preview level) - let job = if interacting { job } else { job.with_display_fit(fit_px[0], fit_px[1]) }; - let job = job.with_overlay(overlay).with_proof(app.ui.soft_proof.then_some(app.ui.proof)); - let job = job.with_hidden_grading(app.ui.grading_hidden_for(id)); - app.renderer.request(Slot::Main, job, 100); - // a drag's draft that renders in a few ms (GPU) is drawn in this frame, not the next (zoomed - // in, what changes on screen is the window's draft) - #[cfg(not(target_arch = "wasm32"))] - if interacting && plan.window_edge.is_none() { - let frame = ui.input(|i| i.predicted_dt).clamp(1.0 / 240.0, 1.0 / 30.0); - // (a frame time that is not a number waits for nothing) - let budget = std::time::Duration::try_from_secs_f32(frame * 0.4).unwrap_or_default(); - app.renderer.wait_for_draft(ui.ctx(), &mut app.session, budget); - } - } + let ask = LoupeAsk { id, with_crop: !crop_tool, interacting, fit_px, overlay }; + request_main(app, ui, &ask, [rw, rh], plan.window_edge.is_none()); // hovering a preset or profile: the photo with that look, shown instead of the loupe render // once it is ready (nothing is committed) - let hover_key = match app.hover_preview.clone() { - Some(h) if !interacting => app.session.preview_job(id, sw.max(8), sh.max(8), !crop_tool, &h.settings).map(|job| { - // (the same display fit as the After view, drawn texel for texel like it) - let job = job.with_display_fit(fit_px[0], fit_px[1]); - let key = job.key; - app.renderer.request(Slot::Hover, job, 105); - (key, h.label) - }), - _ => None, - }; - // once this photo is on screen: prepare its neighbours in filmstrip order (source decoded and - // kept, view render cached) so stepping to them is instant - if !interacting && !app.renderer.is_pending(Slot::Main) && app.renderer.textures.get(&Slot::Main).is_some_and(|t| t.photo == id) { - let ids = app.session.visible_cloned(); - if let Some(i) = ids.iter().position(|p| *p == id) { - let next = ids.get(i + 1).copied(); - let prev = i.checked_sub(1).and_then(|j| ids.get(j)).copied(); - for (n, nid) in [next, prev].into_iter().enumerate() { - let Some(nid) = nid else { continue }; - let Some(np) = app.session.catalog.photo(nid).cloned() else { continue }; - let nf = Frame::with_lens(np.width.max(1) as usize, np.height.max(1) as usize, &np.develop, !crop_tool, np.embedded_lens.as_ref()); - let na = nf.aspect() as f32; - let nr = fit_rect(main_area, na, app.ui.zoom, output_px(&nf), ppp, app.ui.pan); - let nw = - app.ui.settings.prefetch_edge(nr.width().max(nr.height()) * ppp, output_px(&nf).into_iter().max().unwrap_or(1), texture_side); - let (w, h) = if na >= 1.0 { (nw, (nw as f32 / na) as usize) } else { ((nw as f32 * na) as usize, nw) }; - if let Some(job) = app.session.loupe_job(nid, w.max(8), h.max(8), !crop_tool) { - app.renderer.prefetch(Slot::Prefetch(n as u8), job, PREFETCH_PRIORITY); - } - } - } + let hover_key = request_hover(app, &ask, [sw, sh]); + if !interacting { + prefetch_neighbours(app, id, main_area, ppp, texture_side, !crop_tool); } // until the loupe has this photo: show its cached render / embedded preview / a thumbnail - if app.renderer.textures.get(&Slot::Main).is_none_or(|t| t.photo != id) - && let Some(q) = app.session.quick_view_job(id, want.max(8), !crop_tool) - { - app.renderer.request_quick(Slot::Preview, q, 110); - } + request_stand_in(app, id, want, !crop_tool); let show_before = app.ui.before_after == BeforeAfter::Original || ui.input(|i| i.key_down(egui::Key::Backslash)); - if (split || show_before || split_view) - && let Some(job) = app.session.render_job(id, sw.max(8), sh.max(8), true, !crop_tool) - { - // (the same display fit as the After view, so both panes are the same texture size) - let job = if interacting { job } else { job.with_display_fit(fit_px[0], fit_px[1]) }; - app.renderer.request(Slot::Before, job, 90); + if split || show_before || split_view { + request_before(app, &ask, [sw, sh]); } // zoomed past what the whole-frame render holds: also render the part on screen, at no more // than 100 % (the GPU magnifies beyond that), for each side that is shown. Mask overlays and @@ -371,63 +263,18 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { look, holding: navigating || app.size_hold.holding(now), }; - // (slot, before side?, rect to draw in, rect it is requested for, area whose pixels show) - let mut window_views: Vec = Vec::new(); - if window_ctx.frame_edge.is_some() { - let after = WindowView { slot: Slot::Region, before: false, img: img_rect, target: target_rect, visible: main_area }; - if split { - window_views.push(WindowView { slot: Slot::RegionBefore, before: true, img: before_img, target: before_target, visible: areas[0] }); - window_views.push(after); - } else if show_before { - window_views.push(WindowView { slot: Slot::RegionBefore, before: true, img: img_rect, target: target_rect, visible: canvas }); - } else if split_view { - window_views.push(WindowView { slot: Slot::RegionBefore, before: true, img: img_rect, target: target_rect, visible: canvas }); - window_views.push(WindowView { visible: canvas, ..after }); - } else { - window_views.push(WindowView { visible: canvas, ..after }); - } - } - let mut windows: Vec<(WindowView, crate::region::RegionView)> = Vec::new(); - for v in window_views { - if let Some(view) = request_window(app, &window_ctx, &v) { - windows.push((v, view)); - } - } - for (slot, before) in [(Slot::Region, false), (Slot::RegionBefore, true)] { - let shown = windows.iter().find(|(v, _)| v.before == before).map(|(_, view)| *view); - if before { - app.region_before_view = shown; - } else { - app.region_view = shown; - } - if shown.is_none() { - app.region_tiles.retain(|(b, _), _| *b != before); - app.renderer.release(slot); - } - } - let p = ui.painter_at(canvas); - // what a view slot shows: its own render of this photo, else the stand-ins (no blank frame - // between photos, and the full render replaces them in place) - let draw = |slot: Slot, r: Rect, clip: Rect| -> &'static str { - let mine = |s: Slot| app.renderer.textures.get(&s).filter(|t| t.photo == id); - let (tex, what) = if let Some(t) = mine(slot) { - (t, "render") - } else if let Some(t) = mine(Slot::Preview) { - (t, t.quick.map(quick_name).unwrap_or("preview")) - } else if let Some(t) = app.renderer.thumb(id) { - (t, "thumb") - } else { - return "none"; - }; - let image_rect = snap_fit_rect(fit_texture_rect(r, tex.size), tex.size, ppp); - p.with_clip_rect(clip).image(tex.tex.id(), image_rect, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE); - what + let window_views = if window_ctx.frame_edge.is_some() { + let mode = ViewMode { split, show_before, split_view }; + window_views(mode, &Views { img_rect, target_rect, before_img, before_target, areas: &areas, main_area, canvas }) + } else { + Vec::new() }; + let windows = request_windows(app, &window_ctx, window_views); + let p = ui.painter_at(canvas); + let draw = |slot: Slot, r: Rect, clip: Rect| draw_slot(app, &p, id, ppp, slot, r, clip); // soft proofing: a paper-white surround and the proof's name, as Lightroom shows it if app.ui.soft_proof && !fullscreen { - p.rect_filled(canvas, 0.0, Color32::from_gray(238)); - let label = crate::i18n::tr_format!("Proof Preview · {}", app.ui.proof.space.label()); - p.text(pos2(canvas.right() - 16.0, canvas.top() + 14.0), Align2::RIGHT_CENTER, label, t.font(12.5), Color32::from_gray(60)); + proof_surround(app, &p, &t, canvas); } let shown; // the Before label's pill, painted once the window renders are down (they would cover it) @@ -441,10 +288,7 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { let br = before_img; draw(Slot::Before, br, areas[0]); shown = draw(Slot::Main, img_rect, main_area); - // the labels under each photo, or under its pane when the photo reaches past it - let label_at = |r: Rect, pane: Rect| pos2(r.left().max(pane.left()), r.bottom().min(pane.bottom()) + 14.0); - p.text(label_at(br, areas[0]), Align2::LEFT_CENTER, crate::i18n::tr("Before"), t.font(12.0), t.text_dim); - p.text(label_at(img_rect, main_area), Align2::LEFT_CENTER, crate::i18n::tr("After"), t.font(12.0), t.text_dim); + split_labels(&p, &t, [(br, areas[0]), (img_rect, main_area)]); } else if show_before { shown = draw(Slot::Before, img_rect, canvas); // on the photo itself, so it gets the hover label's dark pill to stay readable over light @@ -454,37 +298,136 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { } else if let Some((_key, label)) = &hover_key && let Some(tex) = app.renderer.textures.get(&Slot::Hover).filter(|t| t.photo == id) { - let hover_rect = fit_texture_rect(img_rect, tex.size); - p.image(tex.tex.id(), hover_rect, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE); - let g = p.layout_no_wrap(label.clone(), t.font(12.0), Color32::WHITE); - let bg = label_badge_rect(hover_rect, canvas, g.size(), badge_top_inset); - p.rect_filled(bg, 4.0, Color32::from_black_alpha(160)); - p.galley(bg.min + vec2(8.0, 4.0), g, Color32::WHITE); + draw_hover(&p, &t, tex, label, [img_rect, canvas], badge_top_inset); shown = "hover"; } else { shown = draw(Slot::Main, img_rect, canvas); if shown == "none" { - match app.renderer.failure_of(Slot::Main, id) { - Some(e) => { - p.text( - canvas.center() - vec2(0.0, 10.0), - Align2::CENTER_CENTER, - crate::i18n::tr("This photo can't be opened"), - t.semibold(14.0), - t.text, - ); - p.text(canvas.center() + vec2(0.0, 12.0), Align2::CENTER_CENTER, e, t.font(12.0), t.text_dim); - } - None if app.ui.settings.loupe_messages => { - p.text(canvas.center(), Align2::CENTER_CENTER, crate::i18n::tr("Rendering…"), t.font(13.0), t.text_dim); - } - None => {} - } + none_message(app, &p, &t, canvas, id); } } app.loupe_shown = Some((id, shown)); - // a wipe shows the Before whole-frame render on its side of the line… let line = crate::region::wipe_line(img_rect, canvas); + draw_wipe_before(app, &p, id, img_rect, line); + // …and the window renders go over the whole-frame ones, all of them, where they belong in the + // frame (clipped to their pane, or their side of the line) + for (v, view) in &windows { + // (holding `\` in a wipe shows the Before everywhere: it is the Before view alone then) + let mode = if show_before { BeforeAfter::Original } else { app.ui.before_after }; + let clip = crate::region::window_clip(mode, v.before, v.visible, canvas, img_rect); + draw_window(&p.with_clip_rect(clip), app, &window_ctx, v, view); + } + if let Some((bg, g)) = before_badge { + paint_badge(&p, bg, g); + register(ui, "canvas:beforeLabel", bg); + } + // the line of a wipe over both + draw_wipe_line(app.ui.before_after, &p, img_rect, line); + let map = CanvasMap::new(&frame, img_rect); + let over = OverPhoto { photo: &photo, d: &d, map: &map, canvas, img_rect, fullscreen, crop_tool, clipping: !show_before }; + photo_overlays(app, ui, &p, &over); + // Cursor selection must also run on gesture frames, when tool input is suppressed. + if !matches!(right, RightPanel::Crop | RightPanel::Masking | RightPanel::Remove | RightPanel::RedEye) { + general_cursor(app, ui, &resp, img_rect, main_area); + } + if !navigating { + let tv = ToolView { right, map: &map, frame: &frame, d: &d, id, split, native, aspect }; + tool_interaction(app, ui, &resp, &tv, &Views { img_rect, target_rect, before_img, before_target, areas: &areas, main_area, canvas }); + } + // drawn and hit-tested above the loupe and its tools: clicks on it pan + let nav = navigator(app, ui, canvas, img_rect, id); + // what is on screen isn't the render on its way (a stand-in, the last render after an edit, + // a magnified frame under its window): say so once that has lasted a moment + let coming = render_coming(app, shown, &windows, ViewMode { split, show_before, split_view }); + let keys = + [Slot::Main, Slot::Before, Slot::Region, Slot::RegionBefore].map(|s| app.renderer.textures.get(&s).filter(|t| t.photo == id).map(|t| t.key)); + let rendering = ui.ctx().data_mut(|d| rendering_overdue(d.get_temp_mut_or(egui::Id::unique("loupe-rendering"), None), keys, coming, now)); + // the render failed while a stand-in is up: what is on screen is all there will be (also while + // a library change retries it) + let failed = failed_render(app, id, !rendering && (!show_before || split), shown); + if rendering || failed.is_some() { + let over = if crop_tool { canvas } else { img_rect.intersect(if split { main_area } else { canvas }) }; + let over = if over.is_positive() { over } else { canvas }; + status_pill(ui, app, &photo, [canvas, over], nav, failed); + } + if !fullscreen { + photo.preview_only.as_deref().inspect(|why| preview_only_pill(ui, canvas, why)); + } + loupe_context_menu(app, &resp, id); +} + +/// The loupe's right-click menu: zoom commands and the grid's photo menu. +fn loupe_context_menu(app: &mut LightcraftApp, resp: &egui::Response, id: PhotoId) { + crate::widgets::context_menu(resp, |ui| { + crate::widgets::menu_button(ui, crate::i18n::tr("Zoom"), |ui| { + for (label, cmd) in [("Fit", "view.zoomFit"), ("100%", "view.zoom100"), ("Zoom In", "view.zoomIn"), ("Zoom Out", "view.zoomOut")] { + if ui.button(crate::i18n::tr(label)).clicked() { + let _ = app.run(cmd, json!({})); + } + } + }); + ui.separator(); + super::grid::context_menu(app, ui, id); + }); +} + +/// A fine grid while a transform (geometry) slider is dragged, to judge verticals. +fn transform_grid(app: &LightcraftApp, p: &egui::Painter, img_rect: Rect) { + if app.ui.dragging_control.as_deref().is_some_and(|c| c.starts_with("geometry.")) { + let n = 12; + let stroke = Stroke::new(1.0, Color32::from_white_alpha(70)); + for i in 1..n { + let fx = img_rect.left() + img_rect.width() * i as f32 / n as f32; + p.line_segment([pos2(fx, img_rect.top()), pos2(fx, img_rect.bottom())], stroke); + } + let rows = ((n as f32) * img_rect.height() / img_rect.width()).round().max(2.0) as usize; + for i in 1..rows { + let fy = img_rect.top() + img_rect.height() * i as f32 / rows as f32; + p.line_segment([pos2(img_rect.left(), fy), pos2(img_rect.right(), fy)], stroke); + } + } +} + +/// The photo's face boxes and the name box on them. +fn face_boxes( + app: &mut LightcraftApp, + ui: &mut egui::Ui, + p: &egui::Painter, + map: &CanvasMap, + photo: &lightcraft_catalog::Photo, + d: &DevelopSettings, +) { + let id = photo.id; + // a name box left open on another photo is dropped + if app.ui.name_edit.as_ref().is_some_and(|e| e.photo != id.0) { + app.ui.name_edit = None; + } + let hints = super::faces::hints_for(app, id.0); + let people = if app.ui.name_edit.is_some() { app.caches.person_names(&app.session.catalog) } else { Default::default() }; + // while the name box is open and recognition is not set up, the box offers the next step + let setup = if app.ui.name_edit.is_some() { super::faces::setup(app, ui.ctx()) } else { super::faces::Setup::Running }; + let regions = RegionContext { photo, orient: d.orientation, hints: hints.as_deref(), people: &people, setup }; + match region_overlay(ui, p, map, ®ions, &mut app.ui.name_edit) { + Some(RegionEdit::SetUp) => { + app.ui.name_edit = None; + super::faces::take_step(app, ui.ctx(), setup); + } + Some(RegionEdit::Remove(index)) => { + let _ = app.run("photo.removeRegion", json!({"id": id.0, "index": index})); + } + Some(RegionEdit::Name(index, name)) => { + app.ui.name_edit = None; + let _ = app.run("faces.setName", json!({"id": id.0, "index": index, "name": name})); + } + Some(RegionEdit::Resize(index, r)) => { + let _ = app.run("photo.setRegion", json!({"id": id.0, "index": index, "rect": {"x0": r.x0, "y0": r.y0, "x1": r.x1, "y1": r.y1}})); + } + None => {} + } +} + +/// A wipe shows the Before whole-frame render on its side of the line. +fn draw_wipe_before(app: &LightcraftApp, p: &egui::Painter, id: PhotoId, img_rect: Rect, line: Pos2) { if app.ui.before_after == BeforeAfter::Split && let Some(tex) = app.renderer.textures.get(&Slot::Before).filter(|t| t.photo == id) { @@ -501,157 +444,437 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { let top = Rect::from_min_max(before_rect.min, pos2(before_rect.right(), before_rect.top() + v * before_rect.height())); p.image(tex.tex.id(), top, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, v)), Color32::WHITE); } - // …and the window renders go over the whole-frame ones, all of them, where they belong in the - // frame (clipped to their pane, or their side of the line) - for (v, view) in &windows { - // (holding `\` in a wipe shows the Before everywhere: it is the Before view alone then) - let mode = if show_before { BeforeAfter::Original } else { app.ui.before_after }; - let clip = crate::region::window_clip(mode, v.before, v.visible, canvas, img_rect); - draw_window(&p.with_clip_rect(clip), app, &window_ctx, v, view); +} + +/// Once a photo is on screen, prepare its neighbours in filmstrip order (source decoded and kept, +/// view render cached) so stepping to them is instant. +fn prefetch_neighbours(app: &mut LightcraftApp, id: PhotoId, main_area: Rect, ppp: f32, texture_side: usize, with_crop: bool) { + // only once this photo is on screen + if app.renderer.is_pending(Slot::Main) || !app.renderer.textures.get(&Slot::Main).is_some_and(|t| t.photo == id) { + return; } - if let Some((bg, g)) = before_badge { - p.rect_filled(bg, 4.0, Color32::from_black_alpha(160)); - p.galley(bg.min + vec2(8.0, 4.0), g, Color32::WHITE); - register(ui, "canvas:beforeLabel", bg); - } - // the line of a wipe over both - if app.ui.before_after == BeforeAfter::Split { - p.line_segment([pos2(line.x, img_rect.top()), pos2(line.x, img_rect.bottom())], Stroke::new(1.5, Color32::WHITE)); - } - if app.ui.before_after == BeforeAfter::SplitTopBottom { - p.line_segment([pos2(img_rect.left(), line.y), pos2(img_rect.right(), line.y)], Stroke::new(1.5, Color32::WHITE)); - } - if app.ui.show_clipping && !show_before && !fullscreen { - clipping_overlay(app, &p, img_rect); - } - // View ▸ Loupe Overlay ▸ Layout Image, over the photo (the After view in a before/after) - super::layout_overlay::draw(app, &p, img_rect); - register(ui, "canvas:image", img_rect); - let map = CanvasMap::new(&frame, img_rect); - info_overlay(app, &p, canvas, &photo); - if !fullscreen { - filter_pill(app, ui, canvas); - } - if app.ui.face_boxes { - // a name box left open on another photo is dropped - if app.ui.name_edit.as_ref().is_some_and(|e| e.photo != id.0) { - app.ui.name_edit = None; - } - let hints = super::faces::hints_for(app, id.0); - let people = if app.ui.name_edit.is_some() { app.caches.person_names(&app.session.catalog) } else { Default::default() }; - // while the name box is open and recognition is not set up, the box offers the next step - let setup = if app.ui.name_edit.is_some() { super::faces::setup(app, ui.ctx()) } else { super::faces::Setup::Running }; - let regions = RegionContext { photo: &photo, orient: d.orientation, hints: hints.as_deref(), people: &people, setup }; - match region_overlay(ui, &p, &map, ®ions, &mut app.ui.name_edit) { - Some(RegionEdit::SetUp) => { - app.ui.name_edit = None; - super::faces::take_step(app, ui.ctx(), setup); - } - Some(RegionEdit::Remove(index)) => { - let _ = app.run("photo.removeRegion", json!({"id": id.0, "index": index})); - } - Some(RegionEdit::Name(index, name)) => { - app.ui.name_edit = None; - let _ = app.run("faces.setName", json!({"id": id.0, "index": index, "name": name})); - } - Some(RegionEdit::Resize(index, r)) => { - let _ = app.run("photo.setRegion", json!({"id": id.0, "index": index, "rect": {"x0": r.x0, "y0": r.y0, "x1": r.x1, "y1": r.y1}})); - } - None => {} - } - } - if app.ui.settings.focus_point && !crop_tool { - draw_focus_point(&p.with_clip_rect(img_rect.intersect(canvas)), img_rect, &photo, "canvas:focusPoint"); - } - // a fine grid while a transform (geometry) slider is dragged, to judge verticals - if app.ui.dragging_control.as_deref().is_some_and(|c| c.starts_with("geometry.")) { - let n = 12; - let stroke = Stroke::new(1.0, Color32::from_white_alpha(70)); - for i in 1..n { - let fx = img_rect.left() + img_rect.width() * i as f32 / n as f32; - p.line_segment([pos2(fx, img_rect.top()), pos2(fx, img_rect.bottom())], stroke); - } - let rows = ((n as f32) * img_rect.height() / img_rect.width()).round().max(2.0) as usize; - for i in 1..rows { - let fy = img_rect.top() + img_rect.height() * i as f32 / rows as f32; - p.line_segment([pos2(img_rect.left(), fy), pos2(img_rect.right(), fy)], stroke); - } - } - // Cursor selection must also run on gesture frames, when tool input is suppressed. - if !matches!(right, RightPanel::Crop | RightPanel::Masking | RightPanel::Remove | RightPanel::RedEye) { - general_cursor(app, ui, &resp, img_rect, main_area); - } - if !navigating { - match right { - RightPanel::Crop => crop_overlay(app, ui, &resp, &map, &frame, &d, id), - RightPanel::Masking => mask_overlay(app, ui, &resp, &map, &d), - RightPanel::Remove => remove_overlay(app, ui, &resp, &map, &d), - RightPanel::RedEye => eye_overlay(app, ui, &resp, &map, &d), - _ => { - // side by side / stacked: Before shows the same frame, so a click in its view (white - // balance, colour samples, targeted adjustment) means the same point of the photo. - // Zoomed in, a view's image reaches past its pane: what counts is the pane clicked. - // A click-zoom there centres both views on the point clicked (#1742). - let pointer = resp.interact_pointer_pos().or(resp.hover_pos()); - let (map, img, pane) = match (split, areas.first(), pointer) { - (true, Some(before), Some(q)) if before.contains(q) => (CanvasMap::new(&frame, before_img), before_img, *before), - _ => (map, img_rect, main_area), - }; - general_interaction(app, ui, &resp, &map, &PhotoPlacement { img, canvas: pane, native, aspect }) + let ids = app.session.visible_cloned(); + if let Some(i) = ids.iter().position(|p| *p == id) { + let next = ids.get(i + 1).copied(); + let prev = i.checked_sub(1).and_then(|j| ids.get(j)).copied(); + for (n, nid) in [next, prev].into_iter().enumerate() { + let Some(nid) = nid else { continue }; + let Some(np) = app.session.catalog.photo(nid).cloned() else { continue }; + let nf = Frame::with_lens(np.width.max(1) as usize, np.height.max(1) as usize, &np.develop, with_crop, np.embedded_lens.as_ref()); + let na = nf.aspect() as f32; + let nr = fit_rect(main_area, na, app.ui.zoom, output_px(&nf), ppp, app.ui.pan); + let nw = app.ui.settings.prefetch_edge(nr.width().max(nr.height()) * ppp, output_px(&nf).into_iter().max().unwrap_or(1), texture_side); + let (w, h) = if na >= 1.0 { (nw, (nw as f32 / na) as usize) } else { ((nw as f32 * na) as usize, nw) }; + if let Some(job) = app.session.loupe_job(nid, w.max(8), h.max(8), with_crop) { + app.renderer.prefetch(Slot::Prefetch(n as u8), job, PREFETCH_PRIORITY); } } } - // drawn and hit-tested above the loupe and its tools: clicks on it pan - let nav = navigator(app, ui, canvas, img_rect, id); - // what is on screen isn't the render on its way (a stand-in, the last render after an edit, - // a magnified frame under its window): say so once that has lasted a moment - let whole: &[Slot] = if show_before && !split { +} + +/// The rects of the two views of a before/after (side by side or stacked), else the one area. +fn view_areas(mode: BeforeAfter, area: Rect) -> Vec { + match mode { + BeforeAfter::SideBySide => { + let half = area.width() / 2.0 - 6.0; + vec![ + Rect::from_min_size(area.min, vec2(half, area.height())), + Rect::from_min_size(pos2(area.center().x + 6.0, area.top()), vec2(half, area.height())), + ] + } + BeforeAfter::TopBottom => { + let half = area.height() / 2.0 - 14.0; + vec![ + Rect::from_min_size(area.min, vec2(area.width(), half)), + Rect::from_min_size(pos2(area.left(), area.center().y + 14.0), vec2(area.width(), half)), + ] + } + _ => vec![area], + } +} + +/// Which before/after layout is up. +#[derive(Clone, Copy)] +struct ViewMode { + split: bool, + show_before: bool, + split_view: bool, +} + +/// The rects the loupe's views are drawn in. +struct Views<'a> { + img_rect: Rect, + target_rect: Rect, + before_img: Rect, + before_target: Rect, + areas: &'a [Rect], + main_area: Rect, + canvas: Rect, +} + +/// The window renders wanted for the layout: (slot, before side?, rect to draw in, rect it is +/// requested for, area whose pixels show). +fn window_views(mode: ViewMode, v: &Views) -> Vec { + let mut out: Vec = Vec::new(); + let after = WindowView { slot: Slot::Region, before: false, img: v.img_rect, target: v.target_rect, visible: v.main_area }; + if mode.split { + out.push(WindowView { + slot: Slot::RegionBefore, + before: true, + img: v.before_img, + target: v.before_target, + visible: v.areas.first().copied().unwrap_or(v.canvas), + }); + out.push(after); + } else if mode.show_before { + out.push(WindowView { slot: Slot::RegionBefore, before: true, img: v.img_rect, target: v.target_rect, visible: v.canvas }); + } else if mode.split_view { + out.push(WindowView { slot: Slot::RegionBefore, before: true, img: v.img_rect, target: v.target_rect, visible: v.canvas }); + out.push(WindowView { visible: v.canvas, ..after }); + } else { + out.push(WindowView { visible: v.canvas, ..after }); + } + out +} + +/// What the canvas says when nothing could be drawn: why the photo failed, or that it is rendering. +fn none_message(app: &LightcraftApp, p: &egui::Painter, t: &Tokens, canvas: Rect, id: PhotoId) { + match app.renderer.failure_of(Slot::Main, id) { + Some(e) => { + p.text(canvas.center() - vec2(0.0, 10.0), Align2::CENTER_CENTER, crate::i18n::tr("This photo can't be opened"), t.semibold(14.0), t.text); + p.text(canvas.center() + vec2(0.0, 12.0), Align2::CENTER_CENTER, e, t.font(12.0), t.text_dim); + } + None if app.ui.settings.loupe_messages => { + p.text(canvas.center(), Align2::CENTER_CENTER, crate::i18n::tr("Rendering…"), t.font(13.0), t.text_dim); + } + None => {} + } +} + +/// The render failed while a stand-in is up: what is on screen is all there will be (also while a +/// library change retries it). +fn failed_render<'a>(app: &'a LightcraftApp, id: PhotoId, settled: bool, shown: &str) -> Option<&'a str> { + (settled && !matches!(shown, "render" | "none" | "hover") && (!app.renderer.is_pending(Slot::Main) || app.renderer.retrying(Slot::Main))) + .then(|| app.renderer.failure_of(Slot::Main, id)) + .flatten() +} + +/// The pill over the photo (the After in two views; in the crop tool's wide margin, under it): the +/// failure, or View Options' "Show message when loading or rendering photos". +fn status_pill( + ui: &egui::Ui, + app: &LightcraftApp, + photo: &lightcraft_catalog::Photo, + [canvas, over]: [Rect; 2], + nav: Option, + failed: Option<&str>, +) { + match failed { + Some(e) => failed_pill(ui, app, photo, canvas, over, nav, "loupe:renderFailed", e), + None if app.ui.settings.loupe_messages => { + loupe_pill(ui, canvas, over, nav, "loupe:rendering", crate::i18n::tr("Rendering…"), false); + } + None => {} + } +} + +/// Soft proofing: a paper-white surround and the proof's name, as Lightroom shows it. +fn proof_surround(app: &LightcraftApp, p: &egui::Painter, t: &Tokens, canvas: Rect) { + p.rect_filled(canvas, 0.0, Color32::from_gray(238)); + let label = crate::i18n::tr_format!("Proof Preview · {}", app.ui.proof.space.label()); + p.text(pos2(canvas.right() - 16.0, canvas.top() + 14.0), Align2::RIGHT_CENTER, label, t.font(12.5), Color32::from_gray(60)); +} + +/// Request the window renders, remember which sides have one, and release the slot of a side without. +fn request_windows(app: &mut LightcraftApp, ctx: &WindowCtx, views: Vec) -> Vec<(WindowView, crate::region::RegionView)> { + let mut windows: Vec<(WindowView, crate::region::RegionView)> = Vec::new(); + for v in views { + if let Some(view) = request_window(app, ctx, &v) { + windows.push((v, view)); + } + } + for (slot, before) in [(Slot::Region, false), (Slot::RegionBefore, true)] { + let shown = windows.iter().find(|(v, _)| v.before == before).map(|(_, view)| *view); + if before { + app.region_before_view = shown; + } else { + app.region_view = shown; + } + if shown.is_none() { + app.region_tiles.retain(|(b, _), _| *b != before); + app.renderer.release(slot); + } + } + windows +} + +/// The aspect of the texture on screen for this photo and geometry, if one is. +fn visible_texture_aspect(app: &LightcraftApp, id: PhotoId, d: &DevelopSettings, crop_tool: bool) -> Option { + // A previous crop/rotation can stay visible while its replacement renders. Its pixels + // must not override the current frame geometry, even when it is the same photo. + let current_texture = |t: &&crate::render::Tex| t.photo == id && t.look == Some((crate::render::geometry_look(d), !crop_tool)); + app.renderer + .textures + .get(&Slot::Main) + .filter(current_texture) + .or_else(|| app.renderer.textures.get(&Slot::Preview).filter(current_texture)) + .or_else(|| app.renderer.thumb(id).filter(current_texture)) + .map(|tex| tex.size[0].max(1) as f32 / tex.size[1].max(1) as f32) +} + +/// Whether the GPU draws the view (by the GPU's own rule, `handles`; `ready` first: `available` +/// would wait for a device still being created). +fn gpu_draws_view(app: &LightcraftApp, overlay: lightcraft_pipeline::Overlay) -> bool { + lightcraft_engine::gpu::handles( + lightcraft_pipeline::OutputDepth::U8, + app.ui.soft_proof && lightcraft_pipeline::proof_profile(app.ui.proof.profile).is_some(), + overlay, + ) && lightcraft_engine::gpu::ready() + && lightcraft_engine::gpu::available() +} + +/// The line of a wipe. +fn draw_wipe_line(mode: BeforeAfter, p: &egui::Painter, img_rect: Rect, line: Pos2) { + let stroke = Stroke::new(1.5, Color32::WHITE); + match mode { + BeforeAfter::Split => { + p.line_segment([pos2(line.x, img_rect.top()), pos2(line.x, img_rect.bottom())], stroke); + } + BeforeAfter::SplitTopBottom => { + p.line_segment([pos2(img_rect.left(), line.y), pos2(img_rect.right(), line.y)], stroke); + } + _ => {} + } +} + +/// Whether the render on its way is not what is on screen (a stand-in, the last render after an +/// edit, a magnified frame under its window). +fn render_coming(app: &LightcraftApp, shown: &str, windows: &[(WindowView, crate::region::RegionView)], mode: ViewMode) -> bool { + let whole: &[Slot] = if mode.show_before && !mode.split { &[Slot::Before] - } else if split || split_view { + } else if mode.split || mode.split_view { &[Slot::Main, Slot::Before] } else { &[Slot::Main] }; - let coming = !matches!(shown, "none" | "hover") - && whole.iter().chain(windows.iter().map(|(v, _)| &v.slot)).any(|s| app.renderer.is_pending(*s) && !app.renderer.retrying(*s)); - let keys = - [Slot::Main, Slot::Before, Slot::Region, Slot::RegionBefore].map(|s| app.renderer.textures.get(&s).filter(|t| t.photo == id).map(|t| t.key)); - let rendering = ui.ctx().data_mut(|d| rendering_overdue(d.get_temp_mut_or(egui::Id::unique("loupe-rendering"), None), keys, coming, now)); - // the render failed while a stand-in is up: what is on screen is all there will be (also while - // a library change retries it) - let failed = (!rendering - && (!show_before || split) - && !matches!(shown, "render" | "none" | "hover") - && (!app.renderer.is_pending(Slot::Main) || app.renderer.retrying(Slot::Main))) - .then(|| app.renderer.failure_of(Slot::Main, id)) - .flatten(); - if rendering || failed.is_some() { - // over the photo (the After in two views); in the crop tool's wide margin, under it - let over = if crop_tool { canvas } else { img_rect.intersect(if split { main_area } else { canvas }) }; - let over = if over.is_positive() { over } else { canvas }; - match failed { - Some(e) => failed_pill(ui, app, &photo, canvas, over, nav, "loupe:renderFailed", e), - // View Options' Show message when loading or rendering photos - None if app.ui.settings.loupe_messages => { - loupe_pill(ui, canvas, over, nav, "loupe:rendering", crate::i18n::tr("Rendering…"), false); - } - None => {} + !matches!(shown, "none" | "hover") + && whole.iter().chain(windows.iter().map(|(v, _)| &v.slot)).any(|s| app.renderer.is_pending(*s) && !app.renderer.retrying(*s)) +} + +/// What the active tool needs to know about the loupe. +struct ToolView<'a> { + right: RightPanel, + map: &'a CanvasMap, + frame: &'a Frame, + d: &'a DevelopSettings, + id: PhotoId, + split: bool, + native: [usize; 2], + aspect: f32, +} + +/// Route the pointer to the right panel's tool on the photo, or to the general interactions. +fn tool_interaction(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Response, tv: &ToolView, v: &Views) { + let (map, d) = (tv.map, tv.d); + match tv.right { + RightPanel::Crop => crop_overlay(app, ui, resp, map, tv.frame, d, tv.id), + RightPanel::Masking => mask_overlay(app, ui, resp, map, d), + RightPanel::Remove => remove_overlay(app, ui, resp, map, d), + RightPanel::RedEye => eye_overlay(app, ui, resp, map, d), + _ => { + // side by side / stacked: Before shows the same frame, so a click in its view (white + // balance, colour samples, targeted adjustment) means the same point of the photo. + // Zoomed in, a view's image reaches past its pane: what counts is the pane clicked. + // A click-zoom there centres both views on the point clicked (#1742). + let pointer = resp.interact_pointer_pos().or(resp.hover_pos()); + let (map, img, pane) = match (tv.split, v.areas.first(), pointer) { + (true, Some(before), Some(q)) if before.contains(q) => (CanvasMap::new(tv.frame, v.before_img), v.before_img, *before), + _ => (CanvasMap::new(tv.frame, v.img_rect), v.img_rect, v.main_area), + }; + general_interaction(app, ui, resp, &map, &PhotoPlacement { img, canvas: pane, native: tv.native, aspect: tv.aspect }) } } - if let Some(why) = photo.preview_only.as_deref().filter(|_| !fullscreen) { - preview_only_pill(ui, canvas, why); +} + +/// The loupe's render plan, without a window for a view the GPU already refused one for. +fn loupe_plan(app: &LightcraftApp, id: PhotoId, look: u64, sizes: crate::region::ViewSizes) -> crate::region::LoupePlan { + let plan = crate::region::plan(&app.ui.settings, sizes); + if plan.window_edge.is_some_and(|edge| app.window_refused == Some((id, look, edge))) { + return crate::region::plan(&app.ui.settings, crate::region::ViewSizes { windows: false, ..sizes }); + } + plan +} + +fn whole_frame_edge(app: &LightcraftApp, interacting: bool, plan: &crate::region::LoupePlan, native_long: usize, texture_side: usize) -> usize { + if interacting || plan.window_edge.is_some() { + plan.main_edge + } else { + // (a user's explicit Preview size below the preview level still caps it) + let limit = if app.ui.settings.preview_limit == 0 { usize::MAX } else { app.ui.settings.preview_limit as usize }; + let floor = lightcraft_engine::SourceLevel::Preview.max_edge().min(limit).min(native_long); + plan.main_edge.max(floor).min(texture_side.max(crate::state::MIN_TEXTURE_SIDE)) + } +} + +/// What a loupe render request is for. +struct LoupeAsk { + id: PhotoId, + with_crop: bool, + interacting: bool, + fit_px: [usize; 2], + overlay: lightcraft_pipeline::Overlay, +} + +/// Request the loupe's own render at `[rw, rh]` (drafts during drags). +fn request_main(app: &mut LightcraftApp, ui: &egui::Ui, a: &LoupeAsk, [rw, rh]: [usize; 2], whole_draft: bool) { + let (id, interacting, fit_px, overlay) = (a.id, a.interacting, a.fit_px, a.overlay); + if let Some(job) = app.session.loupe_job(id, rw.max(8), rh.max(8), a.with_crop) { + let job = if interacting { job.draft() } else { job }; + // at rest the render is shrunk to exactly the size it is drawn at with a Lanczos filter on + // the worker, so the window draws it texel for texel instead of shrinking it with 2-tap + // sampling (the render is up to a 64 px step larger, or the preview level) + let job = if interacting { job } else { job.with_display_fit(fit_px[0], fit_px[1]) }; + let job = job.with_overlay(overlay).with_proof(app.ui.soft_proof.then_some(app.ui.proof)); + let job = job.with_hidden_grading(app.ui.grading_hidden_for(id)); + app.renderer.request(Slot::Main, job, 100); + // a drag's draft that renders in a few ms (GPU) is drawn in this frame, not the next (zoomed + // in, what changes on screen is the window's draft) + #[cfg(not(target_arch = "wasm32"))] + if interacting && whole_draft { + let frame = ui.input(|i| i.predicted_dt).clamp(1.0 / 240.0, 1.0 / 30.0); + // (a frame time that is not a number waits for nothing) + let budget = std::time::Duration::try_from_secs_f32(frame * 0.4).unwrap_or_default(); + app.renderer.wait_for_draft(ui.ctx(), &mut app.session, budget); + } + } +} + +/// Hovering a preset or profile: the photo with that look, shown instead of the loupe render once +/// it is ready (nothing is committed). The key of its render and the label to show. +fn request_hover(app: &mut LightcraftApp, a: &LoupeAsk, [sw, sh]: [usize; 2]) -> Option<(u64, String)> { + match app.hover_preview.clone() { + Some(h) if !a.interacting => app.session.preview_job(a.id, sw.max(8), sh.max(8), a.with_crop, &h.settings).map(|job| { + // (the same display fit as the After view, drawn texel for texel like it) + let job = job.with_display_fit(a.fit_px[0], a.fit_px[1]); + let key = job.key; + app.renderer.request(Slot::Hover, job, 105); + (key, h.label) + }), + _ => None, + } +} + +/// The Before render, at the stand-in size. +fn request_before(app: &mut LightcraftApp, a: &LoupeAsk, [sw, sh]: [usize; 2]) { + if let Some(job) = app.session.render_job(a.id, sw.max(8), sh.max(8), true, a.with_crop) { + // (the same display fit as the After view, so both panes are the same texture size) + let job = if a.interacting { job } else { job.with_display_fit(a.fit_px[0], a.fit_px[1]) }; + app.renderer.request(Slot::Before, job, 90); + } +} + +/// What a view slot shows: its own render of this photo, else the stand-ins (no blank frame +/// between photos, and the full render replaces them in place). Returns what it drew. +fn draw_slot(app: &LightcraftApp, p: &egui::Painter, id: PhotoId, ppp: f32, slot: Slot, r: Rect, clip: Rect) -> &'static str { + let mine = |s: Slot| app.renderer.textures.get(&s).filter(|t| t.photo == id); + let (tex, what) = if let Some(t) = mine(slot) { + (t, "render") + } else if let Some(t) = mine(Slot::Preview) { + (t, t.quick.map(quick_name).unwrap_or("preview")) + } else if let Some(t) = app.renderer.thumb(id) { + (t, "thumb") + } else { + return "none"; + }; + let image_rect = snap_fit_rect(fit_texture_rect(r, tex.size), tex.size, ppp); + p.with_clip_rect(clip).image(tex.tex.id(), image_rect, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE); + what +} + +/// The hovered look's render over the photo, with its label. +fn draw_hover(p: &egui::Painter, t: &Tokens, tex: &crate::render::Tex, label: &str, [img_rect, canvas]: [Rect; 2], badge_top_inset: f32) { + let hover_rect = fit_texture_rect(img_rect, tex.size); + p.image(tex.tex.id(), hover_rect, Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0)), Color32::WHITE); + let g = p.layout_no_wrap(label.to_string(), t.font(12.0), Color32::WHITE); + let bg = label_badge_rect(hover_rect, canvas, g.size(), badge_top_inset); + paint_badge(p, bg, g); +} + +/// A label on a dark pill. +fn paint_badge(p: &egui::Painter, bg: Rect, g: std::sync::Arc) { + p.rect_filled(bg, 4.0, Color32::from_black_alpha(160)); + p.galley(bg.min + vec2(8.0, 4.0), g, Color32::WHITE); +} + +/// No photo is active: the empty-library message if the library is empty, else "No photo selected". +fn show_no_photo(app: &mut LightcraftApp, ui: &mut egui::Ui, canvas: Rect) { + if super::empty_library::shown(&app.session) { + super::empty_library::show(app, ui, canvas); + } else { + super::empty_message(ui, canvas, "No photo selected", "Choose a photo in the grid or filmstrip"); + } +} + +/// The margin round the photo: none full screen, wide in the crop tool. +fn loupe_margin(fullscreen: bool, crop_tool: bool) -> f32 { + if fullscreen { + 0.0 + } else if crop_tool { + 48.0 + } else { + 24.0 + } +} + +/// The labels under each photo, or under its pane when the photo reaches past it. +fn split_labels(p: &egui::Painter, t: &Tokens, [before, after]: [(Rect, Rect); 2]) { + let label_at = |r: Rect, pane: Rect| pos2(r.left().max(pane.left()), r.bottom().min(pane.bottom()) + 14.0); + p.text(label_at(before.0, before.1), Align2::LEFT_CENTER, crate::i18n::tr("Before"), t.font(12.0), t.text_dim); + p.text(label_at(after.0, after.1), Align2::LEFT_CENTER, crate::i18n::tr("After"), t.font(12.0), t.text_dim); +} + +/// What is drawn over the photo. +struct OverPhoto<'a> { + photo: &'a lightcraft_catalog::Photo, + d: &'a DevelopSettings, + map: &'a CanvasMap, + canvas: Rect, + img_rect: Rect, + fullscreen: bool, + crop_tool: bool, + /// the clipping overlay may show (not in the Before view) + clipping: bool, +} + +/// The overlays over the photo: clipping, layout image, info, filter pill, faces, focus point and +/// the transform grid. +fn photo_overlays(app: &mut LightcraftApp, ui: &mut egui::Ui, p: &egui::Painter, o: &OverPhoto) { + let (canvas, img_rect) = (o.canvas, o.img_rect); + if app.ui.show_clipping && o.clipping && !o.fullscreen { + clipping_overlay(app, p, img_rect); + } + // View ▸ Loupe Overlay ▸ Layout Image, over the photo (the After view in a before/after) + super::layout_overlay::draw(app, p, img_rect); + register(ui, "canvas:image", img_rect); + info_overlay(app, p, canvas, o.photo); + if !o.fullscreen { + filter_pill(app, ui, canvas); + } + if app.ui.face_boxes { + face_boxes(app, ui, p, o.map, o.photo, o.d); + } + if app.ui.settings.focus_point && !o.crop_tool { + draw_focus_point(&p.with_clip_rect(img_rect.intersect(canvas)), img_rect, o.photo, "canvas:focusPoint"); + } + transform_grid(app, p, img_rect); +} + +fn request_stand_in(app: &mut LightcraftApp, id: PhotoId, edge: usize, with_crop: bool) { + if app.renderer.textures.get(&Slot::Main).is_none_or(|t| t.photo != id) + && let Some(q) = app.session.quick_view_job(id, edge.max(8), with_crop) + { + app.renderer.request_quick(Slot::Preview, q, 110); } - crate::widgets::context_menu(&resp, |ui| { - crate::widgets::menu_button(ui, crate::i18n::tr("Zoom"), |ui| { - for (label, cmd) in [("Fit", "view.zoomFit"), ("100%", "view.zoom100"), ("Zoom In", "view.zoomIn"), ("Zoom Out", "view.zoomOut")] { - if ui.button(crate::i18n::tr(label)).clicked() { - let _ = app.run(cmd, json!({})); - } - } - }); - ui.separator(); - super::grid::context_menu(app, ui, id); - }); } /// Neighbour prefetch: below on-screen thumbnails, above background thumbnail refreshes. diff --git a/crates/ui-egui/src/panels/detail/masks.rs b/crates/ui-egui/src/panels/detail/masks.rs index c150eac532..365ae23112 100644 --- a/crates/ui-egui/src/panels/detail/masks.rs +++ b/crates/ui-egui/src/panels/detail/masks.rs @@ -291,7 +291,6 @@ pub(super) fn color_range_pick(app: &mut LightcraftApp, ui: &egui::Ui, resp: &eg /// component (click selects its mask, drag moves the component), and brush painting. The mask /// itself shows as a rendered overlay ([`view_overlay`]). pub(super) fn mask_overlay(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Response, map: &CanvasMap, d: &DevelopSettings) { - let long = (map.rect.width().max(map.rect.height())) as f64; let active = app.session.active_mask; let clip = app.canvas_rect.unwrap_or(map.rect); let p = &ui.painter_at(clip); @@ -310,60 +309,9 @@ pub(super) fn mask_overlay(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &eg // mask so nothing else becomes draggable. The component check keeps this in step with the // painted region (`view_overlay` at detail.rs:1354 only covers masks with components). let show_outline = sel || (app.ui.mask_overlay_all && m.visible && !m.components.is_empty()); - let stroke_a: u8 = if sel { 230 } else { 170 }; for (ci, c) in m.components.iter().enumerate() { - match &c.shape { - MaskShape::Radial { center, rx, ry, angle, .. } if show_outline => { - let pts: Vec = (0..64) - .map(|i| { - let a = i as f64 / 64.0 * std::f64::consts::TAU; - let (s, co) = angle.to_radians().sin_cos(); - let (x, y) = (rx * a.cos(), ry * a.sin()); - let l = frame_long_norm(map); - map.screen(Point::new(center.x + (x * co - y * s) * l.0, center.y + (x * s + y * co) * l.1)) - }) - .collect(); - p.add(egui::Shape::closed_line(pts, Stroke::new(1.5, Color32::from_white_alpha(stroke_a)))); - - if sel { - let l = frame_long_norm(map); - for (i, a_deg) in [0.0_f64, 90.0_f64, 180.0_f64, 270.0_f64].into_iter().enumerate() { - let a_local = a_deg.to_radians(); - let (s, co) = angle.to_radians().sin_cos(); - let (x, y) = (rx * a_local.cos(), ry * a_local.sin()); - let q = map.screen(Point::new(center.x + (x * co - y * s) * l.0, center.y + (x * s + y * co) * l.1)); - p.circle_stroke(q, 5.0, Stroke::new(1.5, Color32::WHITE)); - register(ui, format!("maskHandle:{}:{ci}:{}", m.id, i + 1), Rect::from_center_size(q, vec2(14.0, 14.0))); - grips.push((m.id, ci, i as u8 + 1, q)); - } - - let (s, co) = angle.to_radians().sin_cos(); - let rot_r = rx + 0.08; - let rot_q = map.screen(Point::new(center.x + (rot_r * co) * l.0, center.y + (rot_r * s) * l.1)); - let h1_q = map.screen(Point::new(center.x + (rx * co) * l.0, center.y + (rx * s) * l.1)); - p.line_segment([h1_q, rot_q], Stroke::new(1.0, Color32::from_white_alpha(200))); - p.circle_stroke(rot_q, 4.0, Stroke::new(1.5, Color32::WHITE)); - register(ui, format!("maskHandle:{}:{ci}:5", m.id), Rect::from_center_size(rot_q, vec2(14.0, 14.0))); - grips.push((m.id, ci, 5, rot_q)); - } - } - MaskShape::Linear { start, end } if show_outline => { - let (a, b) = (map.screen(*start), map.screen(*end)); - let dir = (b - a).normalized(); - let perp = vec2(-dir.y, dir.x) * 3000.0; - let (a1, a2): (u8, u8) = if sel { (230, 110) } else { (170, 80) }; - for (q, alpha) in [(a, a1), (b, a2)] { - p.line_segment([q - perp, q + perp], Stroke::new(1.0, Color32::from_white_alpha(alpha))); - } - if sel { - for (i, q) in [a, b].iter().enumerate() { - p.circle_stroke(*q, 5.0, Stroke::new(1.5, Color32::WHITE)); - register(ui, format!("maskHandle:{}:{ci}:{i}", m.id), Rect::from_center_size(*q, vec2(14.0, 14.0))); - grips.push((m.id, ci, i as u8 + 1, *q)); - } - } - } - _ => {} + if show_outline { + component_outline(ui, p, map, (m.id, ci), &c.shape, sel, &mut grips); } if app.ui.mask_pins && mode.shows(sel, live) @@ -377,8 +325,98 @@ pub(super) fn mask_overlay(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &eg } } mask_keys(app, ui, map, d, &grips); - // Object selections (SAM 3) of the selected mask: each click, green to include, red to exclude - // (clicks still on their way to the model included) + object_marks(app, p, map, d, active); + // Colour Range "Pick": the Masking panel owns the loupe's clicks (general_interaction + // never runs while it is open), so the eyedropper is handled here too. + if app.ui.tool == "colorRange" { + if resp.hovered() { + ui.ctx().set_cursor_icon(egui::CursorIcon::Crosshair); + } + color_range_pick(app, ui, resp, map); + return; + } + if app.ui.tool == "object" { + object_tool(app, ui, resp, map); + return; + } + if app.ui.tool == "brush" { + brush_tool(app, ui, resp, map, p, clip); + return; + } + grip_gestures(app, ui, resp, map, d, &grips); +} + +/// The outline of one mask component, and (on the selected mask) its grips, registered and +/// collected into `grips`. +fn component_outline( + ui: &egui::Ui, + p: &egui::Painter, + map: &CanvasMap, + at: (u32, usize), + shape: &MaskShape, + sel: bool, + grips: &mut Vec<(u32, usize, u8, Pos2)>, +) { + let (mask, ci) = at; + let stroke_a: u8 = if sel { 230 } else { 170 }; + match shape { + MaskShape::Radial { center, rx, ry, angle, .. } => { + let pts: Vec = (0..64) + .map(|i| { + let a = i as f64 / 64.0 * std::f64::consts::TAU; + let (s, co) = angle.to_radians().sin_cos(); + let (x, y) = (rx * a.cos(), ry * a.sin()); + let l = frame_long_norm(map); + map.screen(Point::new(center.x + (x * co - y * s) * l.0, center.y + (x * s + y * co) * l.1)) + }) + .collect(); + p.add(egui::Shape::closed_line(pts, Stroke::new(1.5, Color32::from_white_alpha(stroke_a)))); + + if sel { + let l = frame_long_norm(map); + for (i, a_deg) in [0.0_f64, 90.0_f64, 180.0_f64, 270.0_f64].into_iter().enumerate() { + let a_local = a_deg.to_radians(); + let (s, co) = angle.to_radians().sin_cos(); + let (x, y) = (rx * a_local.cos(), ry * a_local.sin()); + let q = map.screen(Point::new(center.x + (x * co - y * s) * l.0, center.y + (x * s + y * co) * l.1)); + p.circle_stroke(q, 5.0, Stroke::new(1.5, Color32::WHITE)); + register(ui, format!("maskHandle:{}:{ci}:{}", mask, i + 1), Rect::from_center_size(q, vec2(14.0, 14.0))); + grips.push((mask, ci, i as u8 + 1, q)); + } + + let (s, co) = angle.to_radians().sin_cos(); + let rot_r = rx + 0.08; + let rot_q = map.screen(Point::new(center.x + (rot_r * co) * l.0, center.y + (rot_r * s) * l.1)); + let h1_q = map.screen(Point::new(center.x + (rx * co) * l.0, center.y + (rx * s) * l.1)); + p.line_segment([h1_q, rot_q], Stroke::new(1.0, Color32::from_white_alpha(200))); + p.circle_stroke(rot_q, 4.0, Stroke::new(1.5, Color32::WHITE)); + register(ui, format!("maskHandle:{}:{ci}:5", mask), Rect::from_center_size(rot_q, vec2(14.0, 14.0))); + grips.push((mask, ci, 5, rot_q)); + } + } + MaskShape::Linear { start, end } => { + let (a, b) = (map.screen(*start), map.screen(*end)); + let dir = (b - a).normalized(); + let perp = vec2(-dir.y, dir.x) * 3000.0; + let (a1, a2): (u8, u8) = if sel { (230, 110) } else { (170, 80) }; + for (q, alpha) in [(a, a1), (b, a2)] { + p.line_segment([q - perp, q + perp], Stroke::new(1.0, Color32::from_white_alpha(alpha))); + } + if sel { + for (i, q) in [a, b].iter().enumerate() { + p.circle_stroke(*q, 5.0, Stroke::new(1.5, Color32::WHITE)); + register(ui, format!("maskHandle:{}:{ci}:{i}", mask), Rect::from_center_size(*q, vec2(14.0, 14.0))); + grips.push((mask, ci, i as u8 + 1, *q)); + } + } + } + _ => {} + } +} + +/// Object selections (SAM 3) of the selected mask: each click, green to include, red to exclude +/// (clicks still on their way to the model included). +fn object_marks(app: &LightcraftApp, p: &egui::Painter, map: &CanvasMap, d: &DevelopSettings, active: Option) { let pending = app.session.segmenter.pending_clicks().cloned(); for m in d.masks.iter().filter(|m| Some(m.id) == active) { for (k, c) in m.components.iter().enumerate() { @@ -397,100 +435,104 @@ pub(super) fn mask_overlay(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &eg } } } - // Colour Range "Pick": the Masking panel owns the loupe's clicks (general_interaction - // never runs while it is open), so the eyedropper is handled here too. - if app.ui.tool == "colorRange" { - if resp.hovered() { - ui.ctx().set_cursor_icon(egui::CursorIcon::Crosshair); - } - color_range_pick(app, ui, resp, map); - return; +} + +/// Object tool: a click includes what's under it, ⌥-click leaves it out. +fn object_tool(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Response, map: &CanvasMap) { + if resp.hovered() { + ui.ctx().set_cursor_icon(egui::CursorIcon::Crosshair); } - // Object tool: a click includes what's under it, ⌥-click leaves it out - if app.ui.tool == "object" { - if resp.hovered() { - ui.ctx().set_cursor_icon(egui::CursorIcon::Crosshair); - } - if resp.clicked() - && let Some(q) = resp.interact_pointer_pos() - { - let n = map.norm(q); - let exclude = ui.input(|i| i.modifiers.alt); - match app.run_typed("mask.objectPoint", json!({"x": n.x, "y": n.y, "exclude": exclude})) { - Ok(_) => { - if let Some(mid) = app.session.active_mask { - app.ui.detail_due = Some((app.tick_now() + 1.0, mid)); - } - } - Err(e) => app.ai_error(ui.ctx(), e, Some(("object", "new"))), - } - } - return; - } - // brush tool - if app.ui.tool == "brush" { - let r = (app.ui.brush_size as f64 * long) as f32; - if let Some(h) = resp.hover_pos() { - ui.ctx().set_cursor_icon(egui::CursorIcon::None); - p.circle_stroke(h, r, Stroke::new(1.0, Color32::WHITE)); - p.circle_stroke(h, r * (1.0 - app.ui.brush_feather / 100.0).max(0.05), Stroke::new(1.0, Color32::from_white_alpha(120))); - } - if let Some(q) = resp.interact_pointer_pos() - && (resp.drag_started() || resp.dragged() || resp.clicked()) - { - let n = map.norm(q); - let force = if app.ui.brush_pressure { ui.input(pen_force) } else { None }; - match &mut app.gesture { - // a held, unmoving pointer records nothing: coverage builds by passes, not time (#518) - Some(Gesture::Brush { points, .. }) if points.last() == Some(&n) => {} - Some(Gesture::Brush { points, pressure }) => { - record_pressure(pressure, points.len(), force); - points.push(n); - } - _ => { - let mut pressure = Vec::new(); - record_pressure(&mut pressure, 0, force); - app.gesture = Some(Gesture::Brush { points: vec![n], pressure }); + if resp.clicked() + && let Some(q) = resp.interact_pointer_pos() + { + let n = map.norm(q); + let exclude = ui.input(|i| i.modifiers.alt); + match app.run_typed("mask.objectPoint", json!({"x": n.x, "y": n.y, "exclude": exclude})) { + Ok(_) => { + if let Some(mid) = app.session.active_mask { + app.ui.detail_due = Some((app.tick_now() + 1.0, mid)); } } + Err(e) => app.ai_error(ui.ctx(), e, Some(("object", "new"))), } - // the stroke being painted (the render shows it once it's committed), with the committed - // stroke's dab spacing, feather and flow (issue #517) - if let Some(Gesture::Brush { points, pressure }) = &app.gesture { - let screen: Vec = points.iter().map(|q| map.screen(*q)).collect(); - let opacity = if app.ui.mask_overlay && app.ui.mask_overlay_opacity > 0.0 { app.ui.mask_overlay_opacity / 100.0 } else { 110.0 / 255.0 }; - let params = crate::brush_live::LiveParams { - clip, - scale: ui.ctx().pixels_per_point(), - r, - hard: r * (1.0 - (app.ui.brush_feather / 100.0).clamp(0.0, 1.0)), - flow: (app.ui.brush_flow / 100.0).clamp(0.0, 1.0), - density: 1.0, - color: app.ui.mask_overlay_color, - opacity: opacity.clamp(0.0, 1.0), - }; - crate::brush_live::paint(&mut app.brush_live, ui.ctx(), p, params, &screen, pressure); - } else { - app.brush_live = None; - } - if (resp.drag_stopped() || resp.clicked()) - && let Some(Gesture::Brush { points, pressure }) = app.gesture.take() - { - app.brush_live = None; - let pts: Vec<[f64; 2]> = points.iter().map(|q| [q.x, q.y]).collect(); - // holding ⌥ (Alt) paints with the other mode: Erase while adding, Add while erasing - let (alt, shift) = resp.ctx.input(|i| (i.modifiers.alt, i.modifiers.shift)); - let erase = app.ui.brush_erase != alt; - // a ⇧-click draws a straight line from where the last stroke ended, as in Lightroom - let connect = shift && resp.clicked() && pts.len() == 1; - let _ = app.run( - "mask.brushStroke", - json!({"points": pts, "size": app.ui.brush_size, "feather": app.ui.brush_feather, "flow": app.ui.brush_flow, - "erase": erase, "autoMask": app.ui.brush_auto_mask, "pressure": pressure, "connect": connect}), - ); - } - return; } +} + +/// Brush tool: the cursor, the stroke being painted and its commit. +fn brush_tool(app: &mut LightcraftApp, ui: &mut egui::Ui, resp: &egui::Response, map: &CanvasMap, p: &egui::Painter, clip: Rect) { + let long = (map.rect.width().max(map.rect.height())) as f64; + let r = (app.ui.brush_size as f64 * long) as f32; + if let Some(h) = resp.hover_pos() { + ui.ctx().set_cursor_icon(egui::CursorIcon::None); + p.circle_stroke(h, r, Stroke::new(1.0, Color32::WHITE)); + p.circle_stroke(h, r * (1.0 - app.ui.brush_feather / 100.0).max(0.05), Stroke::new(1.0, Color32::from_white_alpha(120))); + } + if let Some(q) = resp.interact_pointer_pos() + && (resp.drag_started() || resp.dragged() || resp.clicked()) + { + let n = map.norm(q); + let force = if app.ui.brush_pressure { ui.input(pen_force) } else { None }; + match &mut app.gesture { + // a held, unmoving pointer records nothing: coverage builds by passes, not time (#518) + Some(Gesture::Brush { points, .. }) if points.last() == Some(&n) => {} + Some(Gesture::Brush { points, pressure }) => { + record_pressure(pressure, points.len(), force); + points.push(n); + } + _ => { + let mut pressure = Vec::new(); + record_pressure(&mut pressure, 0, force); + app.gesture = Some(Gesture::Brush { points: vec![n], pressure }); + } + } + } + // the stroke being painted (the render shows it once it's committed), with the committed + // stroke's dab spacing, feather and flow (issue #517) + if let Some(Gesture::Brush { points, pressure }) = &app.gesture { + let screen: Vec = points.iter().map(|q| map.screen(*q)).collect(); + let opacity = if app.ui.mask_overlay && app.ui.mask_overlay_opacity > 0.0 { app.ui.mask_overlay_opacity / 100.0 } else { 110.0 / 255.0 }; + let params = crate::brush_live::LiveParams { + clip, + scale: ui.ctx().pixels_per_point(), + r, + hard: r * (1.0 - (app.ui.brush_feather / 100.0).clamp(0.0, 1.0)), + flow: (app.ui.brush_flow / 100.0).clamp(0.0, 1.0), + density: 1.0, + color: app.ui.mask_overlay_color, + opacity: opacity.clamp(0.0, 1.0), + }; + crate::brush_live::paint(&mut app.brush_live, ui.ctx(), p, params, &screen, pressure); + } else { + app.brush_live = None; + } + if (resp.drag_stopped() || resp.clicked()) + && let Some(Gesture::Brush { points, pressure }) = app.gesture.take() + { + app.brush_live = None; + let pts: Vec<[f64; 2]> = points.iter().map(|q| [q.x, q.y]).collect(); + // holding ⌥ (Alt) paints with the other mode: Erase while adding, Add while erasing + let (alt, shift) = resp.ctx.input(|i| (i.modifiers.alt, i.modifiers.shift)); + let erase = app.ui.brush_erase != alt; + // a ⇧-click draws a straight line from where the last stroke ended, as in Lightroom + let connect = shift && resp.clicked() && pts.len() == 1; + let _ = app.run( + "mask.brushStroke", + json!({"points": pts, "size": app.ui.brush_size, "feather": app.ui.brush_feather, "flow": app.ui.brush_flow, + "erase": erase, "autoMask": app.ui.brush_auto_mask, "pressure": pressure, "connect": connect}), + ); + } +} + +/// Grabbing mask grips and component bodies: select, drag, release. +fn grip_gestures( + app: &mut LightcraftApp, + ui: &egui::Ui, + resp: &egui::Response, + map: &CanvasMap, + d: &DevelopSettings, + grips: &[(u32, usize, u8, Pos2)], +) { + let active = app.session.active_mask; // the grip under the pointer: the selected mask's first, then the nearest let hit = |q: Pos2| { grips From ce3ce07771c0c46436a93acd02fe0f8be4beae71 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 28 Oct 2026 03:20:48 +0000 Subject: [PATCH 75/93] refactor(ui-egui): split the top bar and slider widget --- crates/ui-egui/src/panels/topbar.rs | 382 ++++++++++--------- crates/ui-egui/src/widgets.rs | 557 ++++++++++++++++------------ 2 files changed, 529 insertions(+), 410 deletions(-) diff --git a/crates/ui-egui/src/panels/topbar.rs b/crates/ui-egui/src/panels/topbar.rs index 2ba807dcc6..5e3fea8a11 100644 --- a/crates/ui-egui/src/panels/topbar.rs +++ b/crates/ui-egui/src/panels/topbar.rs @@ -51,185 +51,202 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui) { if app.integrated_titlebar { window_handle(ui, bar); } - ui.horizontal_centered(|ui| { - ui.spacing_mut().item_spacing.x = 4.0; - if icon_button(ui, "sidebar", Icon::Sidebar, vec2(30.0, 30.0), app.ui.left_panel, true, crate::i18n::tr("Show/hide My Photos panel")) - .clicked() - { - let _ = app.run("view.leftPanel", json!({})); - } - ui.add_space(8.0); - if icon_button(ui, "back", Icon::Back, vec2(30.0, 30.0), false, true, crate::i18n::tr("Back")).clicked() { - let _ = app.run("view.back", json!({})); - } - icon_button(ui, "forward", Icon::Forward, vec2(30.0, 30.0), false, false, crate::i18n::tr("Forward")); - if !app.native_menu { - // no native menu bar (web, Windows, Linux): menus in the top bar - ui.add_space(10.0); - let room = search_left - ui.cursor().left() - 16.0; - crate::menubar::show_in_window(app, ui, room); - } - }); - // search field (centred on the window) - let id = crate::text_field::id("field:search"); - if std::mem::take(&mut app.ui.focus_search) { - ui.memory_mut(|m| m.request_focus(id)); + nav_buttons(app, ui, search_left); + search_field(app, ui, &t, sr); + filter_button(app, ui, &t, sr); + let x = right_icons(app, ui, &t, full); + appearance_button(app, ui, &t, full, x); + }); +} + +/// Sidebar toggle, back/forward and, without a native menu bar, the in-window menus. +fn nav_buttons(app: &mut LightcraftApp, ui: &mut egui::Ui, search_left: f32) { + ui.horizontal_centered(|ui| { + ui.spacing_mut().item_spacing.x = 4.0; + if icon_button(ui, "sidebar", Icon::Sidebar, vec2(30.0, 30.0), app.ui.left_panel, true, crate::i18n::tr("Show/hide My Photos panel")) + .clicked() + { + let _ = app.run("view.leftPanel", json!({})); + } + ui.add_space(8.0); + if icon_button(ui, "back", Icon::Back, vec2(30.0, 30.0), false, true, crate::i18n::tr("Back")).clicked() { + let _ = app.run("view.back", json!({})); + } + icon_button(ui, "forward", Icon::Forward, vec2(30.0, 30.0), false, false, crate::i18n::tr("Forward")); + if !app.native_menu { + // no native menu bar (web, Windows, Linux): menus in the top bar + ui.add_space(10.0); + let room = search_left - ui.cursor().left() - 16.0; + crate::menubar::show_in_window(app, ui, room); + } + }); +} + +/// The centred search field with its placeholder and focus ring. +fn search_field(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, sr: Rect) { + // search field (centred on the window) + let id = crate::text_field::id("field:search"); + if std::mem::take(&mut app.ui.focus_search) { + ui.memory_mut(|m| m.request_focus(id)); + } + let focused = ui.memory(|m| m.has_focus(id)); + ui.painter().rect( + sr, + 4.0, + if focused { t.canvas } else { t.field }, + Stroke::new(1.0, if focused { t.accent } else { t.field_border }), + StrokeKind::Inside, + ); + let mut child = + ui.new_child(egui::UiBuilder::new().max_rect(sr.shrink2(vec2(10.0, 4.0))).layout(egui::Layout::left_to_right(egui::Align::Center))); + let empty = app.ui.search.is_empty(); + if empty && !focused { + let g = child.painter().layout_no_wrap(crate::i18n::tr("Search Photos").into(), t.font(13.5), t.text_dim); + let w = g.size().x + 24.0; + let x0 = sr.center().x - w / 2.0; + paint(child.painter(), Rect::from_min_size(pos2(x0, sr.center().y - 8.0), vec2(16.0, 16.0)), Icon::Search, t.text_dim); + child.painter().galley(pos2(x0 + 24.0, sr.center().y - g.size().y / 2.0), g, t.text_dim); + } + let resp = crate::text_field::TextField::singleline("field:search", &mut app.ui.search) + .label(crate::i18n::tr("Search Photos")) + .frame(false) + .width(sr.width() - 20.0) + .font(t.font(13.5)) + .text_color(t.text) + .show(&mut child) + .response; + if resp.changed() { + let q = app.ui.search.clone(); + let _ = app.run("library.filter", json!({"text": q})); + } +} + +/// The filter icon beside the search field, with the active-filter badge. +fn filter_button(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, sr: Rect) { + // filter icon right of the search field + let fr = Rect::from_center_size(pos2(sr.right() + 22.0, sr.center().y), vec2(28.0, 28.0)); + let fresp = ui.interact(fr, egui::Id::unique("filter-btn"), Sense::click()); + crate::widgets::announce(&fresp, crate::i18n::tr("Filters")); + register(ui, "icon:filter", fr); + let filtering = app.session.filter != Default::default() || app.ui.filter_bar; + paint( + ui.painter(), + fr.shrink(6.0), + Icon::Filter, + if filtering { + t.accent + } else if fresp.hovered() { + t.text + } else { + t.icon + }, + ); + // badge: how many filters are on, even with the filter bar closed + let active = lightcraft_engine::filter_chips(&app.session.filter, &app.session.catalog).len(); + if active > 0 { + let c = fr.right_top() + vec2(-3.0, 8.0); + ui.painter().circle_filled(c, 7.0, t.accent); + ui.painter().text(c, Align2::CENTER_CENTER, active.to_string(), t.semibold(9.5), t.canvas); + } + let fresp = fresp.on_hover_text(if active > 0 { + crate::i18n::tr_format!("Filter bar — {active} active filter{}", if active == 1 { "" } else { "s" }, active = active) + } else { + crate::i18n::tr("Filter bar").into() + }); + if fresp.clicked() { + let _ = app.run("view.filterBar", json!({})); + } +} + +/// The right-side action icons; returns the x where the next icon would go. +fn right_icons(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, full: Rect) -> f32 { + // right icons + let mut x = full.right() - 18.0; + // saving is failing: the cloud icon turns into a warning until a save succeeds + let unsaved = app.session.unsaved().map(|(n, e)| unsaved_tip(n, e)); + let cloud_tip = unsaved.as_deref().unwrap_or("Local library — no cloud account needed"); + // Import Photos… beside Export, always one click away, with the key it is bound to now + let mac = ui.ctx().os() == egui::os::OperatingSystem::Mac; + let import_tip = match crate::shortcuts::shortcut_of(&app.ui.settings.keymap, "file.addPhotos") { + Some(sc) => format!("{} ({})", crate::i18n::tr("Import Photos…"), crate::menubar::shortcut_text(sc, mac)), + None => crate::i18n::tr("Import Photos…").to_string(), + }; + for (id, icon, tip, cmd) in [ + ("discord", Icon::Chat, "Join the ArtCraft community on Discord", "app.discord"), + ("cloud", Icon::Cloud, cloud_tip, ""), + ("help", Icon::Help, "Keyboard shortcuts", "app.shortcuts"), + ("share", Icon::Share, "Export", "dialog.export"), + ("import", Icon::Plus, import_tip.as_str(), "file.addPhotos"), + ("bell", Icon::Bell, "Activity", "panel.activity"), + ] { + let r = Rect::from_center_size(pos2(x, full.center().y), vec2(28.0, 28.0)); + let resp = ui.interact(r, egui::Id::unique(("top", id)), Sense::click()).on_hover_text(crate::i18n::tr(tip)); + crate::widgets::announce(&resp, crate::i18n::tr(tip)); + register(ui, format!("icon:{id}"), r); + let warn = id == "cloud" && unsaved.is_some(); + let colour = if warn { + t.caution + } else if resp.hovered() { + t.text + } else { + t.icon + }; + paint(ui.painter(), r.shrink(5.0), icon, colour); + if warn { + let c = r.right_top() + vec2(-5.0, 6.0); + ui.painter().circle_filled(c, 6.0, t.reject); + ui.painter().text(c, Align2::CENTER_CENTER, "!", t.semibold(9.5), t.canvas); + register(ui, "indicator:unsaved", r); + } + // a refusal says why (Import while a Lightroom catalog is coming in) + if resp.clicked() + && !cmd.is_empty() + && let Err(e) = app.run(cmd, json!({})) + { + app.toast_error(ui.ctx(), e); + } + x -= 40.0; + } + x +} + +/// The appearance icon at `x`, with its theme-favourites menu. +fn appearance_button(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, full: Rect, x: f32) { + // Appearance Mode: a click steps Auto → Light → Dark → Auto; the icon shows the mode + let (icon, mode) = appearance_icon(app.ui.settings.appearance_mode); + let r = Rect::from_center_size(pos2(x, full.center().y), vec2(28.0, 28.0)); + let tip = format!("{}: {}", crate::i18n::tr("Appearance Mode"), crate::i18n::tr(mode)); + let resp = ui.interact(r, egui::Id::unique(("top", "appearance")), Sense::click()).on_hover_text(tip.clone()); + crate::widgets::announce(&resp, tip.clone()); + register(ui, "icon:appearance", r); + paint(ui.painter(), r.shrink(5.0), icon, if resp.hovered() { t.text } else { t.icon }); + if resp.clicked() { + let _ = app.run("view.appearance", json!({})); + } + crate::widgets::context_menu(&resp, |ui| { + let settings = ui.button(crate::i18n::tr("Appearance Settings…")); + register(ui, "menu:appearanceSettings", settings.rect); + if settings.clicked() { + let _ = app.run("app.settings", json!({"tab": "interface"})); + ui.close(); + } + let favorites = app.ui.settings.favorite_themes.clone(); + for dark in [false, true] { + let group: Vec<_> = + crate::theme::ThemeKind::ALL.iter().filter(|k| k.is_dark() == dark && favorites.iter().any(|id| id == k.id())).collect(); + if !group.is_empty() { + ui.separator(); } - let focused = ui.memory(|m| m.has_focus(id)); - ui.painter().rect( - sr, - 4.0, - if focused { t.canvas } else { t.field }, - Stroke::new(1.0, if focused { t.accent } else { t.field_border }), - StrokeKind::Inside, - ); - let mut child = - ui.new_child(egui::UiBuilder::new().max_rect(sr.shrink2(vec2(10.0, 4.0))).layout(egui::Layout::left_to_right(egui::Align::Center))); - let empty = app.ui.search.is_empty(); - if empty && !focused { - let g = child.painter().layout_no_wrap(crate::i18n::tr("Search Photos").into(), t.font(13.5), t.text_dim); - let w = g.size().x + 24.0; - let x0 = sr.center().x - w / 2.0; - paint(child.painter(), Rect::from_min_size(pos2(x0, sr.center().y - 8.0), vec2(16.0, 16.0)), Icon::Search, t.text_dim); - child.painter().galley(pos2(x0 + 24.0, sr.center().y - g.size().y / 2.0), g, t.text_dim); - } - let resp = crate::text_field::TextField::singleline("field:search", &mut app.ui.search) - .label(crate::i18n::tr("Search Photos")) - .frame(false) - .width(sr.width() - 20.0) - .font(t.font(13.5)) - .text_color(t.text) - .show(&mut child) - .response; - if resp.changed() { - let q = app.ui.search.clone(); - let _ = app.run("library.filter", json!({"text": q})); - } - // filter icon right of the search field - let fr = Rect::from_center_size(pos2(sr.right() + 22.0, sr.center().y), vec2(28.0, 28.0)); - let fresp = ui.interact(fr, egui::Id::unique("filter-btn"), Sense::click()); - crate::widgets::announce(&fresp, crate::i18n::tr("Filters")); - register(ui, "icon:filter", fr); - let filtering = app.session.filter != Default::default() || app.ui.filter_bar; - paint( - ui.painter(), - fr.shrink(6.0), - Icon::Filter, - if filtering { - t.accent - } else if fresp.hovered() { - t.text - } else { - t.icon - }, - ); - // badge: how many filters are on, even with the filter bar closed - let active = lightcraft_engine::filter_chips(&app.session.filter, &app.session.catalog).len(); - if active > 0 { - let c = fr.right_top() + vec2(-3.0, 8.0); - ui.painter().circle_filled(c, 7.0, t.accent); - ui.painter().text(c, Align2::CENTER_CENTER, active.to_string(), t.semibold(9.5), t.canvas); - } - let fresp = fresp.on_hover_text(if active > 0 { - crate::i18n::tr_format!("Filter bar — {active} active filter{}", if active == 1 { "" } else { "s" }, active = active) - } else { - crate::i18n::tr("Filter bar").into() - }); - if fresp.clicked() { - let _ = app.run("view.filterBar", json!({})); - } - // right icons - let mut x = full.right() - 18.0; - // saving is failing: the cloud icon turns into a warning until a save succeeds - let unsaved = app.session.unsaved().map(|(n, e)| { - crate::i18n::tr_format!( - "{n} change{} saved in memory but not written to disk: {e}\nLightCraft retries automatically; quitting now would lose {}.", - if n == 1 { "" } else { "s" }, - if n == 1 { "it" } else { "them" }, - e = e, - n = n - ) - }); - let cloud_tip = unsaved.as_deref().unwrap_or("Local library — no cloud account needed"); - // Import Photos… beside Export, always one click away, with the key it is bound to now - let mac = ui.ctx().os() == egui::os::OperatingSystem::Mac; - let import_tip = match crate::shortcuts::shortcut_of(&app.ui.settings.keymap, "file.addPhotos") { - Some(sc) => format!("{} ({})", crate::i18n::tr("Import Photos…"), crate::menubar::shortcut_text(sc, mac)), - None => crate::i18n::tr("Import Photos…").to_string(), - }; - for (id, icon, tip, cmd) in [ - ("discord", Icon::Chat, "Join the ArtCraft community on Discord", "app.discord"), - ("cloud", Icon::Cloud, cloud_tip, ""), - ("help", Icon::Help, "Keyboard shortcuts", "app.shortcuts"), - ("share", Icon::Share, "Export", "dialog.export"), - ("import", Icon::Plus, import_tip.as_str(), "file.addPhotos"), - ("bell", Icon::Bell, "Activity", "panel.activity"), - ] { - let r = Rect::from_center_size(pos2(x, full.center().y), vec2(28.0, 28.0)); - let resp = ui.interact(r, egui::Id::unique(("top", id)), Sense::click()).on_hover_text(crate::i18n::tr(tip)); - crate::widgets::announce(&resp, crate::i18n::tr(tip)); - register(ui, format!("icon:{id}"), r); - let warn = id == "cloud" && unsaved.is_some(); - let colour = if warn { - t.caution - } else if resp.hovered() { - t.text - } else { - t.icon - }; - paint(ui.painter(), r.shrink(5.0), icon, colour); - if warn { - let c = r.right_top() + vec2(-5.0, 6.0); - ui.painter().circle_filled(c, 6.0, t.reject); - ui.painter().text(c, Align2::CENTER_CENTER, "!", t.semibold(9.5), t.canvas); - register(ui, "indicator:unsaved", r); - } - // a refusal says why (Import while a Lightroom catalog is coming in) - if resp.clicked() - && !cmd.is_empty() - && let Err(e) = app.run(cmd, json!({})) - { - app.toast_error(ui.ctx(), e); - } - x -= 40.0; - } - // Appearance Mode: a click steps Auto → Light → Dark → Auto; the icon shows the mode - let (icon, mode) = appearance_icon(app.ui.settings.appearance_mode); - let r = Rect::from_center_size(pos2(x, full.center().y), vec2(28.0, 28.0)); - let tip = format!("{}: {}", crate::i18n::tr("Appearance Mode"), crate::i18n::tr(mode)); - let resp = ui.interact(r, egui::Id::unique(("top", "appearance")), Sense::click()).on_hover_text(tip.clone()); - crate::widgets::announce(&resp, tip.clone()); - register(ui, "icon:appearance", r); - paint(ui.painter(), r.shrink(5.0), icon, if resp.hovered() { t.text } else { t.icon }); - if resp.clicked() { - let _ = app.run("view.appearance", json!({})); - } - crate::widgets::context_menu(&resp, |ui| { - let settings = ui.button(crate::i18n::tr("Appearance Settings…")); - register(ui, "menu:appearanceSettings", settings.rect); - if settings.clicked() { - let _ = app.run("app.settings", json!({"tab": "interface"})); + for kind in group { + let r = ui.selectable_label(app.ui.settings.theme(app.system_theme(ui.ctx())) == *kind, crate::i18n::tr(kind.label())); + register(ui, format!("menu:themeFavorite-{}", kind.id()), r.rect); + if r.clicked() { + let _ = app.run("view.theme", json!({"theme": kind.id()})); ui.close(); } - let favorites = app.ui.settings.favorite_themes.clone(); - for dark in [false, true] { - let group: Vec<_> = - crate::theme::ThemeKind::ALL.iter().filter(|k| k.is_dark() == dark && favorites.iter().any(|id| id == k.id())).collect(); - if !group.is_empty() { - ui.separator(); - } - for kind in group { - let r = ui.selectable_label(app.ui.settings.theme(app.system_theme(ui.ctx())) == *kind, crate::i18n::tr(kind.label())); - register(ui, format!("menu:themeFavorite-{}", kind.id()), r.rect); - if r.clicked() { - let _ = app.run("view.theme", json!({"theme": kind.id()})); - ui.close(); - } - } - } - }); - let _ = Align2::CENTER_CENTER; - }); + } + } + }); } /// The appearance button's icon and the mode's name for its tooltip. @@ -241,3 +258,16 @@ pub fn appearance_icon(mode: crate::state::AppearanceMode) -> (Icon, &'static st AppearanceMode::Dark => (Icon::Moon, "Dark Mode"), } } + +/// Tooltip for the warning cloud icon: `n` changes held in memory because saving failed with `e`. +fn unsaved_tip(n: usize, e: &str) -> String { + let s = crate::i18n::plural_s(n); + let it = if n == 1 { "it" } else { "them" }; + crate::i18n::tr_format!( + "{n} change{} saved in memory but not written to disk: {e}\nLightCraft retries automatically; quitting now would lose {}.", + s, + it, + e = e, + n = n + ) +} diff --git a/crates/ui-egui/src/widgets.rs b/crates/ui-egui/src/widgets.rs index 513208066c..89185d9918 100644 --- a/crates/ui-egui/src/widgets.rs +++ b/crates/ui-egui/src/widgets.rs @@ -398,25 +398,15 @@ pub fn slider(ui: &mut Ui, spec: &ControlSpec, value: f64, enabled: bool, label_ let pad_r = 22.0; let label_rect = Rect::from_min_size(pos2(row.left() + pad_l, row.top() + 4.0), vec2(w - pad_l - pad_r, 18.0)); let track_rect = Rect::from_min_max(pos2(row.left() + pad_l, row.top() + 22.0), pos2(row.right() - pad_r, row.top() + 40.0)); + let value_rect = Rect::from_min_max(pos2(label_rect.right() - 64.0, label_rect.top()), label_rect.max); let id = ui.scope_id().with(spec.id); + let g = SliderLayout { spec, value, enabled, id, track_rect, value_rect }; let resp = ui.interact(track_rect.expand2(vec2(8.0, 2.0)), id, if enabled { Sense::click_and_drag() } else { Sense::hover() }); - let wheel_id = id.with("wheel-rem"); let (wheel_armed, pointer_in_row) = update_wheel_arming(ui, id, &resp, row, enabled); // screen readers: a slider named after its control, with its value let label_text = crate::i18n::tr(label_override.unwrap_or(spec.label)).to_string(); resp.widget_info(|| egui::WidgetInfo::slider(enabled, value, label_text.clone())); - // and its range, step and the value as shown ("+0.50", "5600") - let shown = shown_value(spec, value); - ui.ctx().accesskit_node_builder(resp.id, |node| { - node.set_min_numeric_value(spec.min); - node.set_max_numeric_value(spec.max); - node.set_numeric_value_step(spec.step); - node.set_value(shown); - if enabled { - node.add_action(egui::accesskit::Action::Increment); - node.add_action(egui::accesskit::Action::Decrement); - } - }); + describe_slider(ui, &g, &resp); // the name: double-click it to reset, as the thumb (a disabled slider's name is only text) let label_resp = ui.interact(label_rect, id.with("label"), if enabled { Sense::click() } else { Sense::hover() }); // say how to reset (issue #1436: the double-click was hard to discover), as the curve channels do @@ -427,246 +417,41 @@ pub fn slider(ui: &mut Ui, spec: &ControlSpec, value: f64, enabled: bool, label_ register(ui, format!("slider:{}", spec.id), track_rect); // the value: click it to type an exact one, drag it sideways to scrub (over the label, so it // takes the click) - let value_rect = Rect::from_min_max(pos2(label_rect.right() - 64.0, label_rect.top()), label_rect.max); let value_resp = ui.interact(value_rect, id.with("value"), if enabled { Sense::click_and_drag() } else { Sense::hover() }); crate::widgets::announce(&value_resp, format!("{label_text}: {}", crate::i18n::tr("Click to type a value, drag to change it"))); register(ui, format!("sliderValue:{}", spec.id), value_rect); // say that an exact value can be typed here (issue #534: an exact crop angle was hard to find) let value_resp = if enabled { value_resp.on_hover_text(crate::i18n::tr("Click to type a value, drag to change it")) } else { value_resp }; - let typing_id = id.with("typing"); // Keep the short focus-acquisition guard, but let an explicit Return/Escape end the edit. - let mut typing: Option<(String, u8, bool)> = ui.data(|m| m.get_temp(typing_id)); + let mut typing: Option = ui.data(|m| m.get_temp(g.typing_id())); // A scrub: the unrounded track position (0..1) it has reached, so a slow drag adds up instead // of rounding back to the same step every frame. - let scrub_id = id.with("scrub-pos"); - let mut scrub: Option = if value_resp.dragged() || value_resp.drag_stopped() { ui.data(|m| m.get_temp(scrub_id)) } else { None }; - let mut scrub_started = false; - if enabled - && scrub.is_none() - && value_resp.dragged() - && let (Some(origin), Some(p)) = ui.input(|i| (i.pointer.press_origin(), i.pointer.interact_pos())) - && (p.x - origin.x).abs() >= SCRUB_START - { - // a press on the value that moves sideways scrubs: the edit the press opened is dropped - typing = None; - ui.data_mut(|m| m.remove::<(String, u8, bool)>(typing_id)); - ui.memory_mut(|m| m.surrender_focus(crate::text_field::id(&format!("sliderField:{}", spec.id)))); - // the travel so far counts, so the value doesn't lag the pointer by the start distance - let fine = if ui.input(|i| i.modifiers.shift) { 0.1 } else { 1.0 }; - scrub = Some((spec.position(value) + f64::from((p.x - origin.x) / track_rect.width()) * fine).clamp(0.0, 1.0)); - scrub_started = true; - } + let mut scrub: Option = if value_resp.dragged() || value_resp.drag_stopped() { ui.data(|m| m.get_temp(g.scrub_id())) } else { None }; + let scrub_started = begin_scrub(ui, &g, &value_resp, &mut scrub, &mut typing); if scrub.is_none() { - ui.data_mut(|m| m.remove::(scrub_id)); - } - let value_pressed = value_resp.is_pointer_button_down_on() && ui.input(|i| i.pointer.button_pressed(egui::PointerButton::Primary)); - // Focus on the owned primary press before fast typing; retain the readout's click activation. - if enabled && typing.is_none() && (value_resp.clicked() || value_pressed) { - typing = Some((shown_value(spec, value).trim_start_matches('+').to_string(), 0, value_pressed)); - } - let value_released = ui.input(|i| i.pointer.button_released(egui::PointerButton::Primary)); - // A release over the value keeps the field the press opened, however long the button was held - // (a press held past egui's click time ends without a click). A release elsewhere cancels the - // gesture, and a press that scrubs already dropped the field above. - let released_over_value = ui.input(|i| i.pointer.interact_pos()).is_some_and(|p| value_rect.contains(p)); - if value_released && !released_over_value && typing.as_ref().is_some_and(|(_, _, pressed)| *pressed) && !value_resp.clicked() { - typing = None; - ui.data_mut(|m| m.remove::<(String, u8, bool)>(typing_id)); - ui.memory_mut(|m| m.surrender_focus(crate::text_field::id(&format!("sliderField:{}", spec.id)))); + ui.data_mut(|m| m.remove::(g.scrub_id())); } + update_typing_gesture(ui, &g, &value_resp, &mut typing); let mut out = SliderOut::default(); - // value ↔ track position: linear, except for the Kelvin temperature (`ControlSpec::position`) - let to_x = |v: f64| track_rect.left() + spec.position(v) as f32 * track_rect.width(); - let from_x = |x: f32| spec.value_at(f64::from((x - track_rect.left()) / track_rect.width())); // the thumb: a click there doesn't move the value, and resting on it says how to reset (the rest // of the track, which is clicked and dragged, gets no tooltip) - let on_thumb = |p: egui::Pos2| (p.x - to_x(value)).abs() <= THUMB_RING + 1.0; - if enabled && !resp.dragged() && resp.hover_pos().is_some_and(on_thumb) { + if enabled && !resp.dragged() && resp.hover_pos().is_some_and(|p| g.on_thumb(p)) { resp.clone().on_hover_text(reset_hint.as_str()); } - let mut v = value; - if let Some(mut pos) = scrub { - // scrubbing the value moves it as dragging the thumb would: the pointer's sideways travel - // over the track's width (a tenth with Shift), on the control's steps - if !scrub_started && value_resp.dragged() { - let fine = if ui.input(|i| i.modifiers.shift) { 0.1 } else { 1.0 }; - let dx = ui.input(|i| i.pointer.delta().x); - pos = (pos + f64::from(dx / track_rect.width()) * fine).clamp(0.0, 1.0); - } - let step = spec.step.max(1e-9); - let nv = ((spec.value_at(pos) / step).round() * step).clamp(spec.min, spec.max); - if (nv - value).abs() > 1e-12 { - out.value = Some(nv); - v = nv; - } - out.drag_started = scrub_started; - if value_resp.drag_stopped() { - out.drag_stopped = true; - ui.data_mut(|m| m.remove::(scrub_id)); - } else { - ui.data_mut(|m| m.insert_temp(scrub_id, pos)); - } - } else if let Some((mut text, frames, pressed)) = typing.take() { - // Keep the owned opening release focused without restarting its draft or selection. - // egui gives that release's click to the readout, so the field under it gives up the focus - // whatever frame it lands on (issue #1362): the field takes it back after drawing too. - let opening_release = pressed && value_released; - if opening_release { - ui.memory_mut(|m| m.request_focus(crate::text_field::id(&format!("sliderField:{}", spec.id)))); - } - let pressed = pressed && !value_released; - // a child over the value, so the field never moves the rows around it - let mut child = ui.new_child(egui::UiBuilder::new().max_rect(value_rect).layout(egui::Layout::right_to_left(egui::Align::Center))); - // the old value is selected when the field takes the focus, so typing replaces it - let field = crate::text_field::TextField::singleline(&format!("sliderField:{}", spec.id), &mut text) - .font(t.font(12.5)) - .horizontal_align(egui::Align::RIGHT) - .width(value_rect.width()) - .margin(egui::Margin::ZERO) - .select_on_focus(true) - .begin_edit(frames == 0) - .show(&mut child); - if (frames < 2 || opening_release) && !matches!(field.ending, Some(crate::text_field::Ending::Return | crate::text_field::Ending::Escape)) { - field.response.request_focus(); - let frames = frames.saturating_add(1); - typing = Some((text.clone(), frames, pressed)); - ui.data_mut(|m| m.insert_temp(typing_id, (text, frames, pressed))); - } else if field.ending.is_some() || !field.editing || !enabled { - // Esc (or the slider turning off) keeps the old value; Return or clicking away applies - let cancelled = !enabled || field.cancelled(); - if let Some(nv) = typed_value(spec, &text).filter(|nv| !cancelled && (nv - value).abs() > 1e-12) { - out.value = Some(nv); - out.drag_started = true; - out.drag_stopped = true; - v = nv; - } - ui.data_mut(|m| m.remove::<(String, u8, bool)>(typing_id)); - } else { - typing = Some((text.clone(), frames, pressed)); - ui.data_mut(|m| m.insert_temp(typing_id, (text, frames, pressed))); - } + if let Some(pos) = scrub { + scrub_value(ui, &g, &value_resp, pos, scrub_started, &mut out); + } else if let Some(draft) = typing.take() { + typing = edit_value(ui, &t, &g, draft, &mut out); } else if resp.double_clicked() || label_resp.double_clicked() { out.reset = true; out.value = Some(spec.default); - v = spec.default; } else { - if resp.drag_started() { - out.drag_started = true; - } - if (resp.dragged() || resp.drag_started()) - && let Some(p) = resp.interact_pointer_pos() - { - let fine = ui.input(|i| i.modifiers.shift); - let step = spec.step.max(1e-9); - let nv = if fine { - // a tenth of the pointer's movement along the track; the unrounded position is kept, so a - // slow drag adds up instead of rounding back to the same step every frame - let fine_id = id.with("fine-pos"); - let dx = ui.input(|i| i.pointer.delta().x); - let kept = ui.data(|m| m.get_temp::(fine_id)).filter(|&p| ((spec.value_at(p) / step).round() * step - value).abs() < step / 2.0); - let pos = (kept.unwrap_or_else(|| spec.position(value)) + f64::from(dx / track_rect.width()) * 0.1).clamp(0.0, 1.0); - ui.data_mut(|m| m.insert_temp(fine_id, pos)); - spec.value_at(pos) - } else { - from_x(p.x) - }; - let nv = ((nv / step).round() * step).clamp(spec.min, spec.max); - if (nv - value).abs() > 1e-12 { - out.value = Some(nv); - v = nv; - } - } else if resp.clicked() - && let Some(p) = resp.interact_pointer_pos() - // a click on the thumb leaves it there, so the first click of a double-click on it isn't a - // history step of its own before the reset - && !on_thumb(p) - { - let step = spec.step.max(1e-9); - let nv = ((from_x(p.x) / step).round() * step).clamp(spec.min, spec.max); - out.value = Some(nv); - v = nv; - out.drag_started = true; - out.drag_stopped = true; - } - if resp.drag_stopped() { - out.drag_stopped = true; - } - // a screen reader's increment / decrement (VoiceOver: Ctrl-Option-Up / Down) - let (inc, dec) = ui.input(|i| { - i.events.iter().fold((false, false), |(inc, dec), e| match e { - egui::Event::AccessKitActionRequest(r) if r.target_node == resp.id.accesskit_id() => { - (inc || r.action == egui::accesskit::Action::Increment, dec || r.action == egui::accesskit::Action::Decrement) - } - _ => (inc, dec), - }) - }); - // Arrow keys work with either a hovered or a focused slider. - if enabled && out.value.is_none() && typing.is_none() && (pointer_in_row || resp.has_focus() || inc || dec) { - let (up, down, shift) = ui.input_mut(|i| { - let shift = i.modifiers.shift; - let m = if shift { egui::Modifiers::SHIFT } else { egui::Modifiers::NONE }; - (i.consume_key(m, egui::Key::ArrowUp), i.consume_key(m, egui::Key::ArrowDown), shift) - }); - let (up, down) = (up || inc, down || dec); - if up || down { - let nv = nudged(spec, value, if up { 1.0 } else { -1.0 } * if shift { 5.0 } else { 1.0 }); - if (nv - value).abs() > 1e-12 { - out.value = Some(nv); - out.drag_started = true; - out.drag_stopped = true; - v = nv; - } - } - } - // Sideways scrolling (a trackpad swipe, a tilting wheel, Shift+wheel) adjusts the slider under - // the pointer, selected or not: the panel only scrolls vertically, so nothing else wants it. - // Only a mostly sideways movement counts, so a slightly diagonal swipe that scrolls the panel - // leaves the sliders it passes alone. Right raises the value, as dragging the thumb right does. - let side_id = id.with("side-rem"); - let (dx, dy) = ui.input(|i| (i.smooth_scroll_delta.x, i.smooth_scroll_delta.y)); - if !enabled || typing.is_some() || out.value.is_some() || !pointer_in_row || dx.abs() <= dy.abs() { - ui.data_mut(|m| m.remove::(side_id)); - } else { - // the vertical part would scroll the panel and move the slider out from under the pointer - ui.input_mut(|i| i.smooth_scroll_delta = egui::Vec2::ZERO); - let mut remainder = ui.data(|m| m.get_temp::(side_id)).unwrap_or(0.0); - let steps = wheel_nudges(&mut remainder, dx); - ui.data_mut(|m| m.insert_temp(side_id, remainder)); - let nv = nudged(spec, value, steps); - if steps != 0.0 && (nv - value).abs() > 1e-12 { - out.value = Some(nv); - out.drag_started = true; - out.drag_stopped = true; - v = nv; - } - } - // Wheel nudges require an explicitly selected slider, unlike regular panel scrolling. - // Consume only the vertical component so a trackpad's horizontal scroll still works. - // (`wheel_armed` is cleared above with its remainder whenever focus or the pointer leaves.) - if wheel_armed && enabled && typing.is_none() && out.value.is_none() && pointer_in_row { - let delta = ui.input_mut(|i| { - let dy = i.smooth_scroll_delta.y; - if dy != 0.0 { - i.smooth_scroll_delta.y = 0.0; - } - dy - }); - if delta != 0.0 { - let mut remainder = ui.data(|m| m.get_temp::(wheel_id)).unwrap_or(0.0); - let steps = wheel_nudges(&mut remainder, delta); - ui.data_mut(|m| m.insert_temp(wheel_id, remainder)); - if steps != 0.0 { - let nv = nudged(spec, value, steps); - if (nv - value).abs() > 1e-12 { - out.value = Some(nv); - out.drag_started = true; - out.drag_stopped = true; - v = nv; - } - } - } - } + pointer_edit(ui, &g, &resp, &mut out); + nudge_edit(ui, &g, &resp, pointer_in_row, &mut out); + side_scroll_edit(ui, &g, pointer_in_row, &mut out); + wheel_edit(ui, &g, wheel_armed, pointer_in_row, &mut out); } + let v = out.value.unwrap_or(value); // paint let hovered = resp.hovered() || resp.dragged(); let text_c = if enabled { t.text_label } else { t.text_disabled }; @@ -680,7 +465,7 @@ pub fn slider(ui: &mut Ui, spec: &ControlSpec, value: f64, enabled: bool, label_ } } let ring = THUMB_RING; - let tx = to_x(v); + let tx = g.to_x(v); paint_track(ui, track_rect, &spec.track, &t, tx, ring); let p = ui.painter(); let ring_c = if !enabled { @@ -698,6 +483,310 @@ pub fn slider(ui: &mut Ui, spec: &ControlSpec, value: f64, enabled: bool, label_ out } +/// A value being typed into a slider: the text, the frames it has been open, and whether the press that opened it is +/// still down. +type Draft = (String, u8, bool); + +/// What a slider is, as its interaction code needs it. +struct SliderLayout<'a> { + spec: &'a ControlSpec, + value: f64, + enabled: bool, + id: egui::Id, + /// where the thumb moves + track_rect: Rect, + /// the readout, where a value is typed or scrubbed + value_rect: Rect, +} + +impl SliderLayout<'_> { + fn typing_id(&self) -> egui::Id { + self.id.with("typing") + } + + fn scrub_id(&self) -> egui::Id { + self.id.with("scrub-pos") + } + + /// The text field a value is typed in. + fn field_id(&self) -> egui::Id { + crate::text_field::id(&format!("sliderField:{}", self.spec.id)) + } + + fn step(&self) -> f64 { + self.spec.step.max(1e-9) + } + + /// `v` on the control's steps and within its range. + fn snap(&self, v: f64) -> f64 { + ((v / self.step()).round() * self.step()).clamp(self.spec.min, self.spec.max) + } + + /// Whether `nv` is a different value from the one shown. + fn differs(&self, nv: f64) -> bool { + (nv - self.value).abs() > 1e-12 + } + + /// value ↔ track position: linear, except for the Kelvin temperature (`ControlSpec::position`) + fn to_x(&self, v: f64) -> f32 { + self.track_rect.left() + self.spec.position(v) as f32 * self.track_rect.width() + } + + fn value_at_x(&self, x: f32) -> f64 { + self.spec.value_at(f64::from((x - self.track_rect.left()) / self.track_rect.width())) + } + + /// Whether `p` is on the thumb. + fn on_thumb(&self, p: egui::Pos2) -> bool { + (p.x - self.to_x(self.value)).abs() <= THUMB_RING + 1.0 + } + + /// A change made in one go (a click, a key, a wheel step): it starts and stops the drag at once. + fn set_whole(&self, out: &mut SliderOut, nv: f64) { + out.value = Some(nv); + out.drag_started = true; + out.drag_stopped = true; + } + + /// Move to `nv` as a whole change, when it is a different value. + fn set_whole_if_changed(&self, out: &mut SliderOut, nv: f64) { + if self.differs(nv) { + self.set_whole(out, nv); + } + } +} + +/// Tell screen readers the slider's range, step and the value as shown ("+0.50", "5600"). +fn describe_slider(ui: &Ui, g: &SliderLayout, resp: &Response) { + let shown = shown_value(g.spec, g.value); + ui.ctx().accesskit_node_builder(resp.id, |node| { + node.set_min_numeric_value(g.spec.min); + node.set_max_numeric_value(g.spec.max); + node.set_numeric_value_step(g.spec.step); + node.set_value(shown); + if g.enabled { + node.add_action(egui::accesskit::Action::Increment); + node.add_action(egui::accesskit::Action::Decrement); + } + }); +} + +/// A press on the readout that moves sideways starts a scrub: the edit the press opened is dropped. Returns whether +/// a scrub started this frame (`scrub` then holds its first position). +fn begin_scrub(ui: &mut Ui, g: &SliderLayout, value_resp: &Response, scrub: &mut Option, typing: &mut Option) -> bool { + if !g.enabled || scrub.is_some() || !value_resp.dragged() { + return false; + } + let (Some(origin), Some(p)) = ui.input(|i| (i.pointer.press_origin(), i.pointer.interact_pos())) else { return false }; + if (p.x - origin.x).abs() < SCRUB_START { + return false; + } + *typing = None; + ui.data_mut(|m| m.remove::(g.typing_id())); + ui.memory_mut(|m| m.surrender_focus(g.field_id())); + // the travel so far counts, so the value doesn't lag the pointer by the start distance + let fine = if ui.input(|i| i.modifiers.shift) { 0.1 } else { 1.0 }; + *scrub = Some((g.spec.position(g.value) + f64::from((p.x - origin.x) / g.track_rect.width()) * fine).clamp(0.0, 1.0)); + true +} + +/// Open the typed edit on a press or click of the readout; drop it when the press ends elsewhere. +fn update_typing_gesture(ui: &mut Ui, g: &SliderLayout, value_resp: &Response, typing: &mut Option) { + let value_pressed = value_resp.is_pointer_button_down_on() && ui.input(|i| i.pointer.button_pressed(egui::PointerButton::Primary)); + // Focus on the owned primary press before fast typing; retain the readout's click activation. + if g.enabled && typing.is_none() && (value_resp.clicked() || value_pressed) { + *typing = Some((shown_value(g.spec, g.value).trim_start_matches('+').to_string(), 0, value_pressed)); + } + let value_released = ui.input(|i| i.pointer.button_released(egui::PointerButton::Primary)); + // A release over the value keeps the field the press opened, however long the button was held + // (a press held past egui's click time ends without a click). A release elsewhere cancels the + // gesture, and a press that scrubs already dropped the field above. + let released_over_value = ui.input(|i| i.pointer.interact_pos()).is_some_and(|p| g.value_rect.contains(p)); + if value_released && !released_over_value && typing.as_ref().is_some_and(|(_, _, pressed)| *pressed) && !value_resp.clicked() { + *typing = None; + ui.data_mut(|m| m.remove::(g.typing_id())); + ui.memory_mut(|m| m.surrender_focus(g.field_id())); + } +} + +/// Scrubbing the value moves it as dragging the thumb would: the pointer's sideways travel over the track's width (a +/// tenth with Shift), on the control's steps. `pos` is the unrounded track position reached so far. +fn scrub_value(ui: &mut Ui, g: &SliderLayout, value_resp: &Response, mut pos: f64, started: bool, out: &mut SliderOut) { + if !started && value_resp.dragged() { + let fine = if ui.input(|i| i.modifiers.shift) { 0.1 } else { 1.0 }; + let dx = ui.input(|i| i.pointer.delta().x); + pos = (pos + f64::from(dx / g.track_rect.width()) * fine).clamp(0.0, 1.0); + } + let nv = g.snap(g.spec.value_at(pos)); + if g.differs(nv) { + out.value = Some(nv); + } + out.drag_started = started; + if value_resp.drag_stopped() { + out.drag_stopped = true; + ui.data_mut(|m| m.remove::(g.scrub_id())); + } else { + ui.data_mut(|m| m.insert_temp(g.scrub_id(), pos)); + } +} + +/// The text field over the readout while a value is typed. Returns the draft to keep, if the edit goes on. +fn edit_value(ui: &mut Ui, t: &Tokens, g: &SliderLayout, draft: Draft, out: &mut SliderOut) -> Option { + let (mut text, frames, pressed) = draft; + // Keep the owned opening release focused without restarting its draft or selection. + // egui gives that release's click to the readout, so the field under it gives up the focus + // whatever frame it lands on (issue #1362): the field takes it back after drawing too. + let released = ui.input(|i| i.pointer.button_released(egui::PointerButton::Primary)); + let opening_release = pressed && released; + if opening_release { + ui.memory_mut(|m| m.request_focus(g.field_id())); + } + let pressed = pressed && !released; + // a child over the value, so the field never moves the rows around it + let mut child = ui.new_child(egui::UiBuilder::new().max_rect(g.value_rect).layout(egui::Layout::right_to_left(egui::Align::Center))); + // the old value is selected when the field takes the focus, so typing replaces it + let field = crate::text_field::TextField::singleline(&format!("sliderField:{}", g.spec.id), &mut text) + .font(t.font(12.5)) + .horizontal_align(egui::Align::RIGHT) + .width(g.value_rect.width()) + .margin(egui::Margin::ZERO) + .select_on_focus(true) + .begin_edit(frames == 0) + .show(&mut child); + if (frames < 2 || opening_release) && !matches!(field.ending, Some(crate::text_field::Ending::Return | crate::text_field::Ending::Escape)) { + field.response.request_focus(); + let draft = (text, frames.saturating_add(1), pressed); + ui.data_mut(|m| m.insert_temp(g.typing_id(), draft.clone())); + return Some(draft); + } + if field.ending.is_some() || !field.editing || !g.enabled { + // Esc (or the slider turning off) keeps the old value; Return or clicking away applies + let cancelled = !g.enabled || field.cancelled(); + if let Some(nv) = typed_value(g.spec, &text).filter(|nv| !cancelled && g.differs(*nv)) { + g.set_whole(out, nv); + } + ui.data_mut(|m| m.remove::(g.typing_id())); + return None; + } + let draft = (text, frames, pressed); + ui.data_mut(|m| m.insert_temp(g.typing_id(), draft.clone())); + Some(draft) +} + +/// Dragging the thumb or the track, or clicking the track. +fn pointer_edit(ui: &mut Ui, g: &SliderLayout, resp: &Response, out: &mut SliderOut) { + if resp.drag_started() { + out.drag_started = true; + } + if (resp.dragged() || resp.drag_started()) + && let Some(p) = resp.interact_pointer_pos() + { + let raw = if ui.input(|i| i.modifiers.shift) { fine_drag_value(ui, g) } else { g.value_at_x(p.x) }; + let nv = g.snap(raw); + if g.differs(nv) { + out.value = Some(nv); + } + } else if resp.clicked() + && let Some(p) = resp.interact_pointer_pos() + // a click on the thumb leaves it there, so the first click of a double-click on it isn't a + // history step of its own before the reset + && !g.on_thumb(p) + { + g.set_whole(out, g.snap(g.value_at_x(p.x))); + } + if resp.drag_stopped() { + out.drag_stopped = true; + } +} + +/// A tenth of the pointer's movement along the track; the unrounded position is kept, so a slow drag adds up instead +/// of rounding back to the same step every frame. +fn fine_drag_value(ui: &mut Ui, g: &SliderLayout) -> f64 { + let step = g.step(); + let fine_id = g.id.with("fine-pos"); + let dx = ui.input(|i| i.pointer.delta().x); + let kept = ui.data(|m| m.get_temp::(fine_id)).filter(|&p| ((g.spec.value_at(p) / step).round() * step - g.value).abs() < step / 2.0); + let pos = (kept.unwrap_or_else(|| g.spec.position(g.value)) + f64::from(dx / g.track_rect.width()) * 0.1).clamp(0.0, 1.0); + ui.data_mut(|m| m.insert_temp(fine_id, pos)); + g.spec.value_at(pos) +} + +/// A screen reader's increment / decrement (VoiceOver: Ctrl-Option-Up / Down) as `(increment, decrement)`. +fn accessibility_nudge(ui: &Ui, resp: &Response) -> (bool, bool) { + ui.input(|i| { + i.events.iter().fold((false, false), |(inc, dec), e| match e { + egui::Event::AccessKitActionRequest(r) if r.target_node == resp.id.accesskit_id() => { + (inc || r.action == egui::accesskit::Action::Increment, dec || r.action == egui::accesskit::Action::Decrement) + } + _ => (inc, dec), + }) + }) +} + +/// The arrow keys (with either a hovered or a focused slider; Shift: five steps) and a screen reader's actions. +fn nudge_edit(ui: &mut Ui, g: &SliderLayout, resp: &Response, pointer_in_row: bool, out: &mut SliderOut) { + let (inc, dec) = accessibility_nudge(ui, resp); + if !g.enabled || out.value.is_some() || !(pointer_in_row || resp.has_focus() || inc || dec) { + return; + } + let (up, down, shift) = ui.input_mut(|i| { + let shift = i.modifiers.shift; + let m = if shift { egui::Modifiers::SHIFT } else { egui::Modifiers::NONE }; + (i.consume_key(m, egui::Key::ArrowUp), i.consume_key(m, egui::Key::ArrowDown), shift) + }); + let (up, down) = (up || inc, down || dec); + if up || down { + let nv = nudged(g.spec, g.value, if up { 1.0 } else { -1.0 } * if shift { 5.0 } else { 1.0 }); + g.set_whole_if_changed(out, nv); + } +} + +/// Sideways scrolling (a trackpad swipe, a tilting wheel, Shift+wheel) adjusts the slider under +/// the pointer, selected or not: the panel only scrolls vertically, so nothing else wants it. +/// Only a mostly sideways movement counts, so a slightly diagonal swipe that scrolls the panel +/// leaves the sliders it passes alone. Right raises the value, as dragging the thumb right does. +fn side_scroll_edit(ui: &mut Ui, g: &SliderLayout, pointer_in_row: bool, out: &mut SliderOut) { + let side_id = g.id.with("side-rem"); + let (dx, dy) = ui.input(|i| (i.smooth_scroll_delta.x, i.smooth_scroll_delta.y)); + if !g.enabled || out.value.is_some() || !pointer_in_row || dx.abs() <= dy.abs() { + ui.data_mut(|m| m.remove::(side_id)); + return; + } + // the vertical part would scroll the panel and move the slider out from under the pointer + ui.input_mut(|i| i.smooth_scroll_delta = egui::Vec2::ZERO); + let mut remainder = ui.data(|m| m.get_temp::(side_id)).unwrap_or(0.0); + let steps = wheel_nudges(&mut remainder, dx); + ui.data_mut(|m| m.insert_temp(side_id, remainder)); + if steps != 0.0 { + g.set_whole_if_changed(out, nudged(g.spec, g.value, steps)); + } +} + +/// Wheel nudges require an explicitly selected (armed) slider, unlike regular panel scrolling. +/// Consume only the vertical component so a trackpad's horizontal scroll still works. +fn wheel_edit(ui: &mut Ui, g: &SliderLayout, armed: bool, pointer_in_row: bool, out: &mut SliderOut) { + if !armed || !g.enabled || out.value.is_some() || !pointer_in_row { + return; + } + let delta = ui.input_mut(|i| { + let dy = i.smooth_scroll_delta.y; + if dy != 0.0 { + i.smooth_scroll_delta.y = 0.0; + } + dy + }); + if delta == 0.0 { + return; + } + let wheel_id = g.id.with("wheel-rem"); + let mut remainder = ui.data(|m| m.get_temp::(wheel_id)).unwrap_or(0.0); + let steps = wheel_nudges(&mut remainder, delta); + ui.data_mut(|m| m.insert_temp(wheel_id, remainder)); + if steps != 0.0 { + g.set_whole_if_changed(out, nudged(g.spec, g.value, steps)); + } +} + /// Convert vertical wheel movement to bounded slider steps, keeping sub-notch /// trackpad movement between frames without amplifying a single large event. One mouse-wheel /// notch ([`crate::theme::WHEEL_LINE_POINTS`]) is one step. From f6489e60d8a4281793740488e303f1fa39b8209b Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 28 Oct 2026 03:20:48 +0000 Subject: [PATCH 76/93] refactor(lightcraft): import prefs and GPU crash names explicitly --- apps/lightcraft/src/gpu_crash.rs | 2 +- apps/lightcraft/src/prefs.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/lightcraft/src/gpu_crash.rs b/apps/lightcraft/src/gpu_crash.rs index 1656d88e35..3b74223151 100644 --- a/apps/lightcraft/src/gpu_crash.rs +++ b/apps/lightcraft/src/gpu_crash.rs @@ -1,5 +1,5 @@ use super::prefs::config_dir; -use super::*; +use super::window_gpu; /// The window's renderer (egui-wgpu): eframe's defaults, with LightCraft's backend choice — DX12 /// alone on Windows unless `LIGHTCRAFT_GPU_BACKEND` / `WGPU_BACKEND` say otherwise (issue #136: diff --git a/apps/lightcraft/src/prefs.rs b/apps/lightcraft/src/prefs.rs index 0800e6f3e5..5701bf1618 100644 --- a/apps/lightcraft/src/prefs.rs +++ b/apps/lightcraft/src/prefs.rs @@ -1,4 +1,4 @@ -use super::*; +use super::{LibraryProblem, LightcraftApp, UiState}; /// Where the system keeps monitor profiles, for the Choose Profile dialog to start in: the user's /// own profiles first (Linux: colord / DisplayCAL; macOS: ColorSync), then the system's. From 6e54232557c0ed97fcdb297b73ca4ab115af2034 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 28 Oct 2026 03:20:48 +0000 Subject: [PATCH 77/93] test: factor long UI and MCP scenarios into helpers --- crates/mcp/tests/it/e2e.rs | 99 ++++++---- crates/ui-egui/src/headless/tests.rs | 189 +++++++++++-------- crates/ui-egui/src/i18n/tests.rs | 112 ++++++----- crates/ui-egui/src/render/thumbnail_tests.rs | 77 +++++--- crates/ui-egui/src/tests/open_lightroom.rs | 31 ++- crates/ui-egui/src/tests/preview_limit.rs | 120 +++++++----- crates/ui-egui/src/tests/slideshow.rs | 80 +++++--- 7 files changed, 438 insertions(+), 270 deletions(-) diff --git a/crates/mcp/tests/it/e2e.rs b/crates/mcp/tests/it/e2e.rs index 03d77c7e26..2a8db44c7d 100644 --- a/crates/mcp/tests/it/e2e.rs +++ b/crates/mcp/tests/it/e2e.rs @@ -246,33 +246,13 @@ impl Backend for HoldAfterFirst { } } -/// Real stdio framing and real atomic exports: progress, ping during a batch, cancellation -/// between complete photos, unrelated output preservation, and a usable session afterwards. -/// Both exports wait after their first photo ([`HoldAfterFirst`]) until the ping is answered or -/// the cancel is read, so neither can finish first on a fast machine. -#[test] -fn export_progress_and_cancel() { - let dir = std::env::temp_dir().join(format!("lc-mcp-progress-{}", std::process::id())); - let _ = std::fs::remove_dir_all(&dir); - std::fs::create_dir_all(&dir).unwrap(); - let (input, mut send) = std::io::pipe().unwrap(); - let (output, write) = std::io::pipe().unwrap(); - let hold = Arc::new(AtomicBool::new(true)); - let backend = HoldAfterFirst { inner: file_backed_photos(&dir), hold: hold.clone() }; - let server = std::thread::spawn(move || Server::new(Box::new(backend)).serve(BufReader::new(input), write).unwrap()); - let (tx, rx) = std::sync::mpsc::channel(); - let reader = std::thread::spawn(move || { - for line in BufReader::new(output).lines() { - let value: Value = serde_json::from_str(&line.unwrap()).unwrap(); - if tx.send(value).is_err() { - break; - } - } - }); - let next = || rx.recv_timeout(Duration::from_secs(30)).expect("MCP reply/progress"); - writeln!(send, "{}", call(1, "query_photos", json!({"limit":8}))).unwrap(); - let query = next(); - let photos = query["result"]["structuredContent"]["photos"].as_array().unwrap(); +type Rx = std::sync::mpsc::Receiver; + +fn next_msg(rx: &Rx) -> Value { + rx.recv_timeout(Duration::from_secs(30)).expect("MCP reply/progress") +} + +fn assert_query_photos(photos: &[Value]) { assert_eq!(photos.len(), 8); // Real files, real metadata: eight distinct 1200×800 PNGs probed from disk, not synthesized. let names: std::collections::HashSet<&str> = photos.iter().map(|p| p["fileName"].as_str().unwrap()).collect(); @@ -281,13 +261,15 @@ fn export_progress_and_cancel() { assert_eq!((p["width"].as_u64(), p["height"].as_u64()), (Some(1200), Some(800)), "{p}"); assert_eq!(p["format"], "PNG", "{p}"); } - let ids: Vec<_> = photos.iter().map(|p| p["id"].clone()).collect(); +} + +fn run_complete_export(send: &mut impl Write, rx: &Rx, hold: &AtomicBool, ids: &[Value], dir: &std::path::Path) { let mut request = call(2, "export", json!({"ids":ids,"dir":dir.join("complete"),"longEdge":1200,"format":"png"})); request["params"]["_meta"] = json!({"progressToken":"photos","io.modelcontextprotocol/protocolVersion":"2026-07-28"}); writeln!(send, "{request}").unwrap(); let (mut last, mut notes, mut asked, mut answered) = (-1.0, 0, false, false); loop { - let value = next(); + let value = next_msg(rx); if value["method"] == "notifications/progress" { assert_eq!(value["params"]["progressToken"], "photos"); let progress = value["params"]["progress"].as_f64().unwrap(); @@ -312,17 +294,16 @@ fn export_progress_and_cancel() { } assert!(notes >= 2 && answered, "{notes} progress messages; ping answered {answered}"); assert_eq!(last, 8.0); - let out = dir.join("cancelled"); - std::fs::create_dir_all(&out).unwrap(); - let decoy = out.join("photo999.png"); - std::fs::write(&decoy, b"unrelated existing output").unwrap(); +} + +fn run_cancelled_export(send: &mut impl Write, rx: &Rx, hold: &AtomicBool, ids: &[Value], out: &std::path::Path) { // this export waits after its first photo until the cancel below is read hold.store(true, Ordering::SeqCst); let mut request = call(4, "command_run", json!({"id":"app.export","params":{"ids":ids,"dir":out,"longEdge":1200,"format":"png"}})); request["params"]["_meta"] = json!({"progressToken":44}); writeln!(send, "{request}").unwrap(); loop { - let value = next(); + let value = next_msg(rx); assert_ne!(value["id"], 4, "must be cancellable before completion: {value}"); assert_eq!(value["params"]["progressToken"], 44, "{value}"); if value["params"]["progress"].as_f64().unwrap() > 0.0 { @@ -332,7 +313,7 @@ fn export_progress_and_cancel() { writeln!(send, "{}", json!({"jsonrpc":"2.0","method":"notifications/cancelled","params":{"requestId":4}})).unwrap(); writeln!(send, "{}", call(5, "doc_inspect", json!({}))).unwrap(); loop { - let value = next(); + let value = next_msg(rx); if value["method"] == "notifications/progress" { continue; } @@ -340,13 +321,19 @@ fn export_progress_and_cancel() { assert_eq!(value["result"]["isError"], false); break; } - assert_eq!(std::fs::read(&decoy).unwrap(), b"unrelated existing output"); - let photos: Vec<_> = std::fs::read_dir(&out).unwrap().map(|e| e.unwrap().path()).filter(|p| *p != decoy).collect(); +} + +fn assert_cancelled_output(out: &std::path::Path, decoy: &std::path::Path) { + assert_eq!(std::fs::read(decoy).unwrap(), b"unrelated existing output"); + let photos: Vec<_> = std::fs::read_dir(out).unwrap().map(|e| e.unwrap().path()).filter(|p| p != decoy).collect(); assert_eq!(photos.len(), 1, "only the photo completed before the cancel remains: {photos:?}"); for path in &photos { let d = lightcraft_codecs::decode(&std::fs::read(path).unwrap(), Default::default()).expect("complete image, no partial/temp file"); assert_eq!((d.width, d.height), (1200, 800), "{}", path.display()); } +} + +fn assert_complete_output(dir: &std::path::Path) { // The finished export's eight outputs are real 1200×800 PNGs, one per distinct original. let complete: Vec<_> = std::fs::read_dir(dir.join("complete")).unwrap().map(|e| e.unwrap().path()).collect(); assert_eq!(complete.len(), 8, "earlier export retained: {complete:?}"); @@ -359,6 +346,44 @@ fn export_progress_and_cancel() { exported.insert(bytes); } assert_eq!(exported.len(), 8, "eight distinct outputs, not copies of one export"); +} + +/// Real stdio framing and real atomic exports: progress, ping during a batch, cancellation +/// between complete photos, unrelated output preservation, and a usable session afterwards. +/// Both exports wait after their first photo ([`HoldAfterFirst`]) until the ping is answered or +/// the cancel is read, so neither can finish first on a fast machine. +#[test] +fn export_progress_and_cancel() { + let dir = std::env::temp_dir().join(format!("lc-mcp-progress-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + std::fs::create_dir_all(&dir).unwrap(); + let (input, mut send) = std::io::pipe().unwrap(); + let (output, write) = std::io::pipe().unwrap(); + let hold = Arc::new(AtomicBool::new(true)); + let backend = HoldAfterFirst { inner: file_backed_photos(&dir), hold: hold.clone() }; + let server = std::thread::spawn(move || Server::new(Box::new(backend)).serve(BufReader::new(input), write).unwrap()); + let (tx, rx) = std::sync::mpsc::channel(); + let reader = std::thread::spawn(move || { + for line in BufReader::new(output).lines() { + let value: Value = serde_json::from_str(&line.unwrap()).unwrap(); + if tx.send(value).is_err() { + break; + } + } + }); + writeln!(send, "{}", call(1, "query_photos", json!({"limit":8}))).unwrap(); + let query = next_msg(&rx); + let photos = query["result"]["structuredContent"]["photos"].as_array().unwrap(); + assert_query_photos(photos); + let ids: Vec<_> = photos.iter().map(|p| p["id"].clone()).collect(); + run_complete_export(&mut send, &rx, &hold, &ids, &dir); + let out = dir.join("cancelled"); + std::fs::create_dir_all(&out).unwrap(); + let decoy = out.join("photo999.png"); + std::fs::write(&decoy, b"unrelated existing output").unwrap(); + run_cancelled_export(&mut send, &rx, &hold, &ids, &out); + assert_cancelled_output(&out, &decoy); + assert_complete_output(&dir); drop(send); // The fixture's files stay in place until the server (which owns the session) and the reader // have finished: the session reads the originals; the output is what the checks above read. diff --git a/crates/ui-egui/src/headless/tests.rs b/crates/ui-egui/src/headless/tests.rs index f38ed636ae..13bd7a2ae7 100644 --- a/crates/ui-egui/src/headless/tests.rs +++ b/crates/ui-egui/src/headless/tests.rs @@ -2775,6 +2775,109 @@ fn browse_a_local_folder() { let _ = std::fs::remove_dir_all(&dir); } +fn hide_rects(h: &mut Headless) -> Vec<(String, Vec)> { + let w = h.request("ui.widgets", json!({"filter": "source:local:"}), Duration::from_secs(10)); + w["result"] + .as_array() + .unwrap() + .iter() + .map(|x| (x["id"].as_str().unwrap().to_string(), x["rect"].as_array().unwrap().iter().filter_map(|v| v.as_f64()).collect())) + .collect() +} + +fn hide_ids(h: &mut Headless) -> Vec { + hide_rects(h).into_iter().map(|(id, _)| id).collect() +} + +fn hide_menu(h: &mut Headless) -> Vec { + let w = h.request("ui.widgets", json!({"filter": "local:restoreHidden:"}), Duration::from_secs(10)); + w["result"].as_array().unwrap().iter().map(|x| x["id"].as_str().unwrap().to_string()).collect() +} + +/// Hides `path` through the command and settles the frames. +fn hide_path(h: &mut Headless, path: &str) { + let r = h.request("engine.execute", json!({"command": "local.hide", "params": {"path": path}}), Duration::from_secs(10)); + assert_eq!(r["ok"], true, "{r}"); + h.settle(SETTLE); +} + +/// Keeps and browses `path` the way Browse Folder… does; returns whether anything was hidden before. +fn hide_browse_and_hide(h: &mut Headless, path: &str, size: [f32; 2]) -> bool { + let t = Duration::from_secs(10); + // Browse Folder… browses the picked folder and keeps it in Local within one frame; a + // request runs frames, so keep it first (no frame sees it browsed but not yet kept) + let r = h.request("engine.execute", json!({"command": "local.addRoot", "params": {"path": path}}), t); + assert_eq!(r["ok"], true, "{r}"); + let r = h.request("engine.execute", json!({"command": "library.browse", "params": {"path": path}}), t); + assert_eq!(r["ok"], true, "{r}"); + h.settle(SETTLE); + let row = format!("source:local:{path}"); + assert!(h.step_until(t, |h| h.app.widgets.iter().any(|(w, _)| *w == row)), "the browsed folder is listed: {:?}", hide_ids(h)); + // the "Show hidden locations" row appears only while something is hidden + let hidden_before = !h.app.ui.hidden_locations.is_empty(); + assert_eq!(hide_ids(h).iter().any(|i| i == "source:local:restoreHidden"), hidden_before); + // hide it while it is still being browsed + hide_path(h, path); + // give any listing a reveal would wait for time to arrive + for _ in 0..20 { + h.step(); + std::thread::sleep(Duration::from_millis(5)); + } + h.settle(SETTLE); + let after = hide_rects(h); + let after_ids: Vec<&str> = after.iter().map(|(id, _)| id.as_str()).collect(); + assert!(!after_ids.contains(&format!("source:local:{path}").as_str()), "{after_ids:?}"); + let restore = after.iter().find(|(id, _)| id == "source:local:restoreHidden").map(|(_, r)| r.clone()); + let restore = restore.unwrap_or_else(|| panic!("no restore row: {after_ids:?}")); + assert!(restore[1] >= 0.0 && restore[1] + restore[3] <= f64::from(size[1]), "the restore row is in view: {restore:?} {after_ids:?}"); + assert!(h.app.session.browse.is_some(), "hiding does not stop browsing"); + hidden_before +} + +/// A second hidden place: the row lists them, and each comes back on its own (issue #2114: +/// the row used to bring every hidden place back at once). +fn hide_second_place_restores_alone(h: &mut Headless, path: &str, path2: &str) { + let t = Duration::from_secs(10); + for (command, params) in [("local.addRoot", json!({"path": path2})), ("local.hide", json!({"path": path2}))] { + let r = h.request("engine.execute", json!({"command": command, "params": params}), t); + assert_eq!(r["ok"], true, "{r}"); + } + h.settle(SETTLE); + assert!(hide_menu(h).is_empty(), "the list opens from the row"); + assert_eq!(h.request("ui.clickWidget", json!({"id": "source:local:restoreHidden"}), t)["ok"], true); + h.settle(SETTLE); + let items = hide_menu(h); + assert!(items.contains(&format!("local:restoreHidden:{path}")) && items.contains(&"local:restoreHidden:all".to_string()), "{items:?}"); + assert_eq!(h.request("ui.clickWidget", json!({"id": format!("local:restoreHidden:{path}")}), t)["ok"], true); + h.settle(SETTLE); + assert!(!h.app.ui.hidden_locations.iter().any(|x| x == path), "{:?}", h.app.ui.hidden_locations); + assert!(h.app.ui.hidden_locations.iter().any(|x| x == path2), "the other place stays hidden"); + assert!(hide_ids(h).iter().any(|i| i == "source:local:restoreHidden"), "still something to restore"); +} + +fn hide_restore_all_then_single(h: &mut Headless, path: &str, path2: &str, hidden_before: bool) { + let t = Duration::from_secs(10); + // two hidden again: Restore All brings every one back + hide_path(h, path); + assert!(h.app.ui.hidden_locations.len() >= 2, "{:?}", h.app.ui.hidden_locations); + assert_eq!(h.request("ui.clickWidget", json!({"id": "source:local:restoreHidden"}), t)["ok"], true); + h.settle(SETTLE); + assert_eq!(h.request("ui.clickWidget", json!({"id": "local:restoreHidden:all"}), t)["ok"], true); + h.settle(SETTLE); + assert!(h.app.ui.hidden_locations.is_empty(), "{:?}", h.app.ui.hidden_locations); + assert!(!hide_ids(h).iter().any(|i| i == "source:local:restoreHidden"), "nothing left to restore"); + // one hidden: the row brings it back itself, no list + hide_path(h, path2); + assert_eq!(h.request("ui.clickWidget", json!({"id": "source:local:restoreHidden"}), t)["ok"], true); + h.settle(SETTLE); + assert!(hide_menu(h).is_empty(), "no list for a single hidden place"); + assert!(h.app.ui.hidden_locations.is_empty(), "{:?}", h.app.ui.hidden_locations); + if !hidden_before { + // (with Home hidden for this test, the folder is back inside Home's tree instead) + assert!(hide_ids(h).contains(&format!("source:local:{path}"))); + } +} + /// Local: Remove from Local hides a sidebar location (nothing on disk changes) and the /// "Show hidden locations" row puts it back. The folder is browsed and kept the way Browse /// Folder… does it, in the temporary folder — on Windows beneath Home, whose tree must not @@ -2788,96 +2891,16 @@ fn local_location_can_be_hidden_and_restored() { let _ = std::fs::remove_dir_all(&dir); std::fs::create_dir_all(&dir).unwrap(); let path = dir.to_string_lossy().to_string(); - let rects = |h: &mut Headless| -> Vec<(String, Vec)> { - let w = h.request("ui.widgets", json!({"filter": "source:local:"}), t); - w["result"] - .as_array() - .unwrap() - .iter() - .map(|x| (x["id"].as_str().unwrap().to_string(), x["rect"].as_array().unwrap().iter().filter_map(|v| v.as_f64()).collect())) - .collect() - }; - let ids = |h: &mut Headless| -> Vec { rects(h).into_iter().map(|(id, _)| id).collect() }; h.request("ui.set", json!({"leftPanel": true}), t); h.hide_home_above(&dir); - // Browse Folder… browses the picked folder and keeps it in Local within one frame; a - // request runs frames, so keep it first (no frame sees it browsed but not yet kept) - let r = h.request("engine.execute", json!({"command": "local.addRoot", "params": {"path": path}}), t); - assert_eq!(r["ok"], true, "{r}"); - let r = h.request("engine.execute", json!({"command": "library.browse", "params": {"path": path}}), t); - assert_eq!(r["ok"], true, "{r}"); - h.settle(SETTLE); - let row = format!("source:local:{path}"); - assert!(h.step_until(t, |h| h.app.widgets.iter().any(|(w, _)| *w == row)), "the browsed folder is listed: {:?}", ids(&mut h)); - // the "Show hidden locations" row appears only while something is hidden - let hidden_before = !h.app.ui.hidden_locations.is_empty(); - assert_eq!(ids(&mut h).iter().any(|i| i == "source:local:restoreHidden"), hidden_before); - // hide it while it is still being browsed - let r = h.request("engine.execute", json!({"command": "local.hide", "params": {"path": path}}), t); - assert_eq!(r["ok"], true, "{r}"); - h.settle(SETTLE); - // give any listing a reveal would wait for time to arrive - for _ in 0..20 { - h.step(); - std::thread::sleep(Duration::from_millis(5)); - } - h.settle(SETTLE); - let after = rects(&mut h); - let after_ids: Vec<&str> = after.iter().map(|(id, _)| id.as_str()).collect(); - assert!(!after_ids.contains(&format!("source:local:{path}").as_str()), "{after_ids:?}"); - let restore = after.iter().find(|(id, _)| id == "source:local:restoreHidden").map(|(_, r)| r.clone()); - let restore = restore.unwrap_or_else(|| panic!("no restore row: {after_ids:?}")); - assert!(restore[1] >= 0.0 && restore[1] + restore[3] <= f64::from(size[1]), "the restore row is in view: {restore:?} {after_ids:?}"); - assert!(h.app.session.browse.is_some(), "hiding does not stop browsing"); + let hidden_before = hide_browse_and_hide(&mut h, &path, size); assert!(dir.is_dir(), "the folder itself is untouched"); - // a second hidden place: the row lists them, and each comes back on its own (issue #2114: - // the row used to bring every hidden place back at once) let dir2 = std::env::temp_dir().join(format!("lc-ui-hide-{}-b", std::process::id())); let _ = std::fs::remove_dir_all(&dir2); std::fs::create_dir_all(&dir2).unwrap(); let path2 = dir2.to_string_lossy().to_string(); - for (command, params) in [("local.addRoot", json!({"path": path2})), ("local.hide", json!({"path": path2}))] { - let r = h.request("engine.execute", json!({"command": command, "params": params}), t); - assert_eq!(r["ok"], true, "{r}"); - } - h.settle(SETTLE); - let menu = |h: &mut Headless| -> Vec { - let w = h.request("ui.widgets", json!({"filter": "local:restoreHidden:"}), t); - w["result"].as_array().unwrap().iter().map(|x| x["id"].as_str().unwrap().to_string()).collect() - }; - assert!(menu(&mut h).is_empty(), "the list opens from the row"); - assert_eq!(h.request("ui.clickWidget", json!({"id": "source:local:restoreHidden"}), t)["ok"], true); - h.settle(SETTLE); - let items = menu(&mut h); - assert!(items.contains(&format!("local:restoreHidden:{path}")) && items.contains(&"local:restoreHidden:all".to_string()), "{items:?}"); - assert_eq!(h.request("ui.clickWidget", json!({"id": format!("local:restoreHidden:{path}")}), t)["ok"], true); - h.settle(SETTLE); - assert!(!h.app.ui.hidden_locations.iter().any(|x| x == &path), "{:?}", h.app.ui.hidden_locations); - assert!(h.app.ui.hidden_locations.iter().any(|x| x == &path2), "the other place stays hidden"); - assert!(ids(&mut h).iter().any(|i| i == "source:local:restoreHidden"), "still something to restore"); - // two hidden again: Restore All brings every one back - let r = h.request("engine.execute", json!({"command": "local.hide", "params": {"path": path}}), t); - assert_eq!(r["ok"], true, "{r}"); - h.settle(SETTLE); - assert!(h.app.ui.hidden_locations.len() >= 2, "{:?}", h.app.ui.hidden_locations); - assert_eq!(h.request("ui.clickWidget", json!({"id": "source:local:restoreHidden"}), t)["ok"], true); - h.settle(SETTLE); - assert_eq!(h.request("ui.clickWidget", json!({"id": "local:restoreHidden:all"}), t)["ok"], true); - h.settle(SETTLE); - assert!(h.app.ui.hidden_locations.is_empty(), "{:?}", h.app.ui.hidden_locations); - assert!(!ids(&mut h).iter().any(|i| i == "source:local:restoreHidden"), "nothing left to restore"); - // one hidden: the row brings it back itself, no list - let r = h.request("engine.execute", json!({"command": "local.hide", "params": {"path": path2}}), t); - assert_eq!(r["ok"], true, "{r}"); - h.settle(SETTLE); - assert_eq!(h.request("ui.clickWidget", json!({"id": "source:local:restoreHidden"}), t)["ok"], true); - h.settle(SETTLE); - assert!(menu(&mut h).is_empty(), "no list for a single hidden place"); - assert!(h.app.ui.hidden_locations.is_empty(), "{:?}", h.app.ui.hidden_locations); - if !hidden_before { - // (with Home hidden for this test, the folder is back inside Home's tree instead) - assert!(ids(&mut h).contains(&format!("source:local:{path}"))); - } + hide_second_place_restores_alone(&mut h, &path, &path2); + hide_restore_all_then_single(&mut h, &path, &path2, hidden_before); let _ = std::fs::remove_dir_all(&dir); let _ = std::fs::remove_dir_all(&dir2); } diff --git a/crates/ui-egui/src/i18n/tests.rs b/crates/ui-egui/src/i18n/tests.rs index 2a44072f07..77bbc14cbc 100644 --- a/crates/ui-egui/src/i18n/tests.rs +++ b/crates/ui-egui/src/i18n/tests.rs @@ -214,6 +214,32 @@ fn switching_language_translates_and_restores() { assert_eq!(tr("Exposure"), "Exposure"); } +fn assert_format_specs(language: &Locale) { + let text = tr_format!("{count} smart preview{} · {:.1} MB", "s", 12.345, count = 3); + assert!(text.contains("12.3") && !text.contains("12.34"), "{language:?}: {text}"); + let merging = tr_format!("Merging… {stage} {:.0}%", 42.4, stage = "Aligning"); + assert!(merging.contains("42%"), "{language:?}: {merging}"); + let delta = tr_format!("{label} {d:+} on every selected photo", label = "Exposure", d = 5); + assert!(delta.contains("+5"), "{language:?}: {delta}"); + let reading = tr_format!("Reading photos… {} of {}", 3, 10); + let (three, ten) = (reading.find('3'), reading.find("10")); + assert!(three.is_some() && ten.is_some(), "{language:?}: {reading}"); +} + +fn assert_format_values_kept(language: &Locale) { + let name = "Color 1234.56 {title} 日本語"; + let added = tr_format!("Added {n} photo{} to “{}”", "s", name, n = 22); + assert!(added.contains(name) && added.contains("22"), "{language:?}: {added}"); + for n in [0, 1, 2, 5, 22] { + let imported = tr_format!("Imported {} photo{}", n, if n == 1 { "" } else { "s" }); + assert!(imported.contains(&n.to_string()), "{language:?}: {imported}"); + } + // The trailing argument is queue progress, not an English plural suffix. + let queued = tr_format!(" · {queued} waiting", queued = 5); + let denoising = tr_format!("Denoising {name}: {done} of {total} tiles{}", queued, name = "IMG.CR3", done = 1, total = 4); + assert!(denoising.contains("IMG.CR3") && denoising.contains('5'), "{language:?}: {denoising}"); +} + /// Format strings carry their values in every language, and a language without a translation /// falls back to the English format rather than dropping the values. #[test] @@ -228,26 +254,8 @@ fn formats_render_in_every_language() { // text (an album name with braces and CJK) and counts are never dropped. for language in Locale::ALL { set_language(*language); - let text = tr_format!("{count} smart preview{} · {:.1} MB", "s", 12.345, count = 3); - assert!(text.contains("12.3") && !text.contains("12.34"), "{language:?}: {text}"); - let merging = tr_format!("Merging… {stage} {:.0}%", 42.4, stage = "Aligning"); - assert!(merging.contains("42%"), "{language:?}: {merging}"); - let delta = tr_format!("{label} {d:+} on every selected photo", label = "Exposure", d = 5); - assert!(delta.contains("+5"), "{language:?}: {delta}"); - let reading = tr_format!("Reading photos… {} of {}", 3, 10); - let (three, ten) = (reading.find('3'), reading.find("10")); - assert!(three.is_some() && ten.is_some(), "{language:?}: {reading}"); - let name = "Color 1234.56 {title} 日本語"; - let added = tr_format!("Added {n} photo{} to “{}”", "s", name, n = 22); - assert!(added.contains(name) && added.contains("22"), "{language:?}: {added}"); - for n in [0, 1, 2, 5, 22] { - let imported = tr_format!("Imported {} photo{}", n, if n == 1 { "" } else { "s" }); - assert!(imported.contains(&n.to_string()), "{language:?}: {imported}"); - } - // The trailing argument is queue progress, not an English plural suffix. - let queued = tr_format!(" · {queued} waiting", queued = 5); - let denoising = tr_format!("Denoising {name}: {done} of {total} tiles{}", queued, name = "IMG.CR3", done = 1, total = 4); - assert!(denoising.contains("IMG.CR3") && denoising.contains('5'), "{language:?}: {denoising}"); + assert_format_specs(language); + assert_format_values_kept(language); } set_language(Locale::En); assert_eq!(tr_format!("Reading photos… {} of {}", 3, 10), "Reading photos… 3 of 10"); @@ -1128,24 +1136,7 @@ fn a_dropped_photos_notice_names_every_outcome_of_the_import_and_is_silent_for_d let _ = std::fs::remove_dir_all(dir); } -/// Polish: the menu and control channel select it, dates read day.month.year, and every count -/// reads right for any number. Polish has three plural forms (1 zdjęcie, 2 zdjęcia, 5 zdjęć), so -/// counts follow their noun ("Zaimportowane zdjęcia: 22") instead of a form that fits only some. -#[test] -fn polish_switches_formats_dates_and_reads_every_count() { - use crate::control::{ControlRequest, Outcome}; - let mut app = crate::LightcraftApp::new(lightcraft_engine::Session::with_demo(), Default::default()); - app.run("app.language.polish", serde_json::json!({})).unwrap(); - assert_eq!(app.ui.language, Locale::Pl); - assert_eq!(Locale::Pl.name(), "Polski"); - assert_eq!(crate::menubar::checked(&app, "app.language.polish"), Some(true)); - assert_eq!(tr("File"), "Plik"); - assert_eq!(tr("Exposure"), "Ekspozycja"); - assert_eq!(date_group_label("2026-09-20", false), "Niedziela, 20.09.2026"); - assert_eq!(date_group_label("2026-09-20", true), "Niedziela, 20"); - assert_eq!(date_group_label("2026-09", false), "09.2026"); - assert_eq!(date_group_label("2026", false), "2026"); - assert_eq!(display_time("2026-09-20T16:04:05"), "Niedziela, 20.09.2026 16:04:05"); +fn assert_polish_counts() { for n in [0, 1, 2, 3, 4, 5, 12, 21, 22, 25, 111] { let s = if n == 1 { "" } else { "s" }; assert_eq!(tr_format!("Imported {} photo{}", n, s), format!("Zaimportowane zdjęcia: {n}")); @@ -1159,20 +1150,20 @@ fn polish_switches_formats_dates_and_reads_every_count() { assert_eq!(tr_format!("Delete {n} Photos", n = n), format!("Usuń zdjęcia ({n})")); assert_eq!(tr_format!("{n} preset{}", s, n = n), format!("Ustawienia: {n}")); } - let name = String::from("Color 1234.56 {title} 日本語"); - assert_eq!(tr_format!("Added {n} photo{} to “{}”", "s", name, n = 22), format!("Dodano do „{name}”: 22")); - let saved = serde_json::to_string(&app.ui).unwrap(); - assert_eq!(serde_json::from_str::(&saved).unwrap().language, Locale::Pl); - let ctx = egui::Context::default(); +} + +fn assert_polish_selected_by_tags(app: &mut crate::LightcraftApp, ctx: &egui::Context) { + use crate::control::{ControlRequest, Outcome}; for tag in ["pl", "pl-PL", "pl_PL.UTF-8", "PL-pl"] { assert_eq!(Locale::parse_tag(tag), Some(Locale::Pl), "{tag}"); let (request, _) = ControlRequest::new("ui.set", serde_json::json!({"language": tag})); - let Outcome::Done(reply) = crate::control::handle(&mut app, &ctx, &request) else { panic!("expected reply") }; + let Outcome::Done(reply) = crate::control::handle(app, ctx, &request) else { panic!("expected reply") }; assert_eq!(reply["ok"], true); assert_eq!(language(), Locale::Pl); } - let text = painted_text(&ctx, &mut app, Locale::Pl); - assert!(text.contains("Plik") && text.contains("Ekspozycja"), "{text}"); +} + +fn assert_polish_glyphs(ctx: &egui::Context) { ctx.fonts_mut(|fonts| { for family in [egui::FontFamily::Proportional, egui::FontFamily::Name(crate::theme::FONT_SEMIBOLD.into())] { let font = egui::FontId::new(13.0, family); @@ -1181,5 +1172,34 @@ fn polish_switches_formats_dates_and_reads_every_count() { } } }); +} + +/// Polish: the menu and control channel select it, dates read day.month.year, and every count +/// reads right for any number. Polish has three plural forms (1 zdjęcie, 2 zdjęcia, 5 zdjęć), so +/// counts follow their noun ("Zaimportowane zdjęcia: 22") instead of a form that fits only some. +#[test] +fn polish_switches_formats_dates_and_reads_every_count() { + let mut app = crate::LightcraftApp::new(lightcraft_engine::Session::with_demo(), Default::default()); + app.run("app.language.polish", serde_json::json!({})).unwrap(); + assert_eq!(app.ui.language, Locale::Pl); + assert_eq!(Locale::Pl.name(), "Polski"); + assert_eq!(crate::menubar::checked(&app, "app.language.polish"), Some(true)); + assert_eq!(tr("File"), "Plik"); + assert_eq!(tr("Exposure"), "Ekspozycja"); + assert_eq!(date_group_label("2026-09-20", false), "Niedziela, 20.09.2026"); + assert_eq!(date_group_label("2026-09-20", true), "Niedziela, 20"); + assert_eq!(date_group_label("2026-09", false), "09.2026"); + assert_eq!(date_group_label("2026", false), "2026"); + assert_eq!(display_time("2026-09-20T16:04:05"), "Niedziela, 20.09.2026 16:04:05"); + assert_polish_counts(); + let name = String::from("Color 1234.56 {title} 日本語"); + assert_eq!(tr_format!("Added {n} photo{} to “{}”", "s", name, n = 22), format!("Dodano do „{name}”: 22")); + let saved = serde_json::to_string(&app.ui).unwrap(); + assert_eq!(serde_json::from_str::(&saved).unwrap().language, Locale::Pl); + let ctx = egui::Context::default(); + assert_polish_selected_by_tags(&mut app, &ctx); + let text = painted_text(&ctx, &mut app, Locale::Pl); + assert!(text.contains("Plik") && text.contains("Ekspozycja"), "{text}"); + assert_polish_glyphs(&ctx); set_language(Locale::En); } diff --git a/crates/ui-egui/src/render/thumbnail_tests.rs b/crates/ui-egui/src/render/thumbnail_tests.rs index eaf4e8f2ff..2fcd6c5ab1 100644 --- a/crates/ui-egui/src/render/thumbnail_tests.rs +++ b/crates/ui-egui/src/render/thumbnail_tests.rs @@ -774,66 +774,81 @@ fn undo_to_existing_texture_supersedes_pending_edit() { assert_eq!(app.renderer.thumb(PhotoId(1)).unwrap().pixels.as_ref().unwrap().pixels, original.pixels); } -#[test] -fn cells_at_different_thumbnail_buckets_keep_one_pending_request() { - let (mut app, work, ctx) = fixture(); +/// First request: other buckets must not replace the pending job. Returns the pending key. +fn thumb_buckets_pending_request(app: &mut crate::LightcraftApp, work: &std::rc::Rc>, ctx: &egui::Context) -> u64 { let id = PhotoId(1); let slot = Slot::Thumb(id); // A print page's cells show the same photo at different sizes. Before any texture arrives, // each frame's other bucket used to replace (and restart) the pending job. - crate::panels::grid::request_thumb(&mut app, id, 256, 10); + crate::panels::grid::request_thumb(app, id, 256, 10); let built = app.renderer.thumb_jobs_built; assert_eq!(built, 1); - let (submitted, pending) = take_job(&work); + let (submitted, pending) = take_job(work); assert_eq!(submitted, slot); for _ in 0..12 { - crate::panels::grid::request_thumb(&mut app, id, 512, 10); - crate::panels::grid::request_thumb(&mut app, id, 384, 8); - crate::panels::grid::request_thumb(&mut app, id, 256, 10); + crate::panels::grid::request_thumb(app, id, 512, 10); + crate::panels::grid::request_thumb(app, id, 384, 8); + crate::panels::grid::request_thumb(app, id, 256, 10); } assert_eq!(app.renderer.thumb_jobs_built, built, "another bucket must not replace the pending thumbnail"); assert!(work.borrow().jobs.is_empty(), "the pending render is not restarted"); assert_eq!(app.renderer.pending[&slot].0, pending.key); let pending_key = pending.key; - finish(&mut app, &work, &ctx, slot, pending.run()); + finish(app, work, ctx, slot, pending.run()); assert_eq!(app.renderer.textures[&slot].key, pending_key); assert_eq!(app.renderer.thumb_inputs[&id].1, 256, "the completed request's bucket is remembered"); assert!(!app.renderer.is_pending(slot)); + pending_key +} +/// A larger bucket still upgrades; smaller cells wait behind it. Returns the larger key. +fn thumb_buckets_larger_upgrades( + app: &mut crate::LightcraftApp, + work: &std::rc::Rc>, + ctx: &egui::Context, + pending_key: u64, +) -> u64 { + let id = PhotoId(1); + let slot = Slot::Thumb(id); // With a completed 256 thumbnail, the larger cell asks for its bucket once; the smaller // cells then wait behind it instead of replacing it back every frame. let built = app.renderer.thumb_jobs_built; - crate::panels::grid::request_thumb(&mut app, id, 512, 10); + crate::panels::grid::request_thumb(app, id, 512, 10); assert_eq!(app.renderer.thumb_jobs_built, built + 1, "a larger bucket still upgrades"); - let (submitted, larger) = take_job(&work); + let (submitted, larger) = take_job(work); assert_eq!(submitted, slot); assert_ne!(larger.key, pending_key); let larger_key = app.renderer.pending[&slot].0; assert_eq!(larger_key, larger.key); for _ in 0..12 { - crate::panels::grid::request_thumb(&mut app, id, 512, 10); - crate::panels::grid::request_thumb(&mut app, id, 384, 10); - crate::panels::grid::request_thumb(&mut app, id, 256, 10); + crate::panels::grid::request_thumb(app, id, 512, 10); + crate::panels::grid::request_thumb(app, id, 384, 10); + crate::panels::grid::request_thumb(app, id, 256, 10); } assert_eq!(app.renderer.thumb_jobs_built, built + 1, "smaller cells keep the larger render in flight"); assert!(work.borrow().jobs.is_empty(), "the larger render is not restarted"); assert_eq!(app.renderer.pending[&slot].0, larger_key); assert_eq!(app.renderer.thumb_inputs[&id].1, 512, "the in-flight bucket is still the larger one"); - finish(&mut app, &work, &ctx, slot, larger.run()); + finish(app, work, ctx, slot, larger.run()); assert_eq!(app.renderer.textures[&slot].key, larger_key); assert_eq!(app.renderer.thumb_inputs[&id].1, 512); assert!(!app.renderer.is_pending(slot)); + larger_key +} +fn thumb_buckets_largest_serves_smaller(app: &mut crate::LightcraftApp, work: &std::rc::Rc>, larger_key: u64) { + let id = PhotoId(1); + let slot = Slot::Thumb(id); // Once the largest visible bucket is complete, every smaller cell reuses those pixels. // The 8x8 fixture texture cannot show its requested edge, so the remembered bucket, key // and photo identity are what prove no render was built. Repeated frames at all sizes // (the old bug alternated 256/512 forever) must settle with nothing further requested. let built = app.renderer.thumb_jobs_built; for _ in 0..24 { - crate::panels::grid::request_thumb(&mut app, id, 256, 10); - crate::panels::grid::request_thumb(&mut app, id, 384, 10); - crate::panels::grid::request_thumb(&mut app, id, 512, 10); - crate::panels::grid::request_thumb(&mut app, id, 384, 8); + crate::panels::grid::request_thumb(app, id, 256, 10); + crate::panels::grid::request_thumb(app, id, 384, 10); + crate::panels::grid::request_thumb(app, id, 512, 10); + crate::panels::grid::request_thumb(app, id, 384, 8); } assert_eq!(app.renderer.thumb_jobs_built, built, "completed larger thumbnails serve smaller cells"); assert!(work.borrow().jobs.is_empty()); @@ -841,7 +856,16 @@ fn cells_at_different_thumbnail_buckets_keep_one_pending_request() { assert_eq!(app.renderer.textures[&slot].key, larger_key); assert_eq!(app.renderer.thumb_inputs[&id].1, 512); assert_eq!(app.renderer.thumb_inputs[&id].2, larger_key); +} +fn thumb_buckets_edit_requests_again( + app: &mut crate::LightcraftApp, + work: &std::rc::Rc>, + ctx: &egui::Context, + larger_key: u64, +) { + let id = PhotoId(1); + let slot = Slot::Thumb(id); // The renderer remembers the photo through a `Weak` only. That is enough for // `Catalog`'s `Arc::make_mut` to copy the photo on edit (std: an existing weak pointer // forces a new allocation even with a single strong reference), so the identity below is @@ -861,18 +885,27 @@ fn cells_at_different_thumbnail_buckets_keep_one_pending_request() { assert_eq!(remembered.strong_count(), 0, "the renderer's Weak now points at the old, unowned allocation"); assert_eq!(Arc::strong_count(current), 1, "the edit left one strong owner; no extra Arc was needed"); let built = app.renderer.thumb_jobs_built; - crate::panels::grid::request_thumb(&mut app, id, 256, 10); + crate::panels::grid::request_thumb(app, id, 256, 10); assert_eq!(app.renderer.thumb_jobs_built, built + 1, "an edited photo is requested again"); - let (submitted, edited) = take_job(&work); + let (submitted, edited) = take_job(work); assert_eq!(submitted, slot); assert_ne!(edited.key, larger_key); let edited_key = edited.key; - finish(&mut app, &work, &ctx, slot, edited.run()); + finish(app, work, ctx, slot, edited.run()); assert_eq!(app.renderer.textures[&slot].key, edited_key); assert_eq!(app.renderer.thumb_inputs[&id].1, 256); assert!(!app.renderer.is_pending(slot)); } +#[test] +fn cells_at_different_thumbnail_buckets_keep_one_pending_request() { + let (mut app, work, ctx) = fixture(); + let pending_key = thumb_buckets_pending_request(&mut app, &work, &ctx); + let larger_key = thumb_buckets_larger_upgrades(&mut app, &work, &ctx, pending_key); + thumb_buckets_largest_serves_smaller(&mut app, &work, larger_key); + thumb_buckets_edit_requests_again(&mut app, &work, &ctx, larger_key); +} + /// The remembered larger bucket is not a picture by itself: once its texture is evicted, a /// smaller cell must render again rather than trust the stale record. #[test] diff --git a/crates/ui-egui/src/tests/open_lightroom.rs b/crates/ui-egui/src/tests/open_lightroom.rs index d97f9d0e81..684883aa0d 100644 --- a/crates/ui-egui/src/tests/open_lightroom.rs +++ b/crates/ui-egui/src/tests/open_lightroom.rs @@ -22,8 +22,16 @@ fn names(dir: &std::path::Path) -> Vec { v } -#[test] -fn open_library_on_a_lightroom_catalog_offers_its_import() { +struct Fx { + dir: std::path::PathBuf, + lib: std::path::PathBuf, + lr: std::path::PathBuf, + lrcat: std::path::PathBuf, + before: Vec, + photos: usize, +} + +fn setup() -> (Headless, Fx) { let dir = std::env::temp_dir().join(format!("lc-ui-openlrcat-{}", std::process::id())); let _ = std::fs::remove_dir_all(&dir); let lib = dir.join("LightCraft Library"); @@ -52,7 +60,12 @@ fn open_library_on_a_lightroom_catalog_offers_its_import() { }; let mut h = Headless::new(LightcraftApp::new(session, services), [1200.0, 800.0], 1.0); h.step(); + (h, Fx { dir, lib, lr, lrcat, before, photos }) +} +fn offer_and_cancel(h: &mut Headless, fx: &Fx) { + let Fx { lib, lr, lrcat, before, photos, .. } = fx; + let (photos, lib, lr, lrcat, before) = (*photos, lib.clone(), lr.clone(), lrcat.clone(), before.clone()); // File ▸ Open Library…, the Lightroom folder chosen in the folder dialog let r = h.app.run("app.openLibrary", json!({})).unwrap(); assert_eq!(r["opened"], false, "{r}"); @@ -64,7 +77,7 @@ fn open_library_on_a_lightroom_catalog_offers_its_import() { "{:?}", h.app.ui.dialog ); - assert!(has(&h, "button:dialogOk") && has(&h, "button:dialogCancel")); + assert!(has(h, "button:dialogOk") && has(h, "button:dialogCancel")); // the library open before is still open, and nothing was made in Lightroom's folder assert_eq!(h.app.session.library.as_ref().map(|l| l.dir.clone()), Some(lib.clone())); assert_eq!(h.app.session.catalog.len(), photos); @@ -79,7 +92,10 @@ fn open_library_on_a_lightroom_catalog_offers_its_import() { h.step(); assert!(h.app.ui.dialog.is_none()); assert!(h.app.lightroom.is_none() && h.app.lightroom_last.is_none()); +} +fn reoffer_import_and_merge(h: &mut Headless, fx: &Fx) { + let (lib, lr, lrcat, before) = (fx.lib.clone(), fx.lr.clone(), fx.lrcat.clone(), fx.before.clone()); // a previews folder given by path (control channel, agents): the same offer let r = h.app.run("app.openLibrary", json!({"path": lr.join("Lightroom Catalog Previews.lrdata").to_string_lossy()})).unwrap(); assert_eq!(r["lightroomCatalog"], json!(lrcat.to_string_lossy()), "{r}"); @@ -108,6 +124,13 @@ fn open_library_on_a_lightroom_catalog_offers_its_import() { assert_eq!(last["path"], json!(lrcat), "{last}"); assert_eq!(h.app.session.library.as_ref().map(|l| l.dir.clone()), Some(lib.clone())); assert_eq!(names(&lr), before, "the catalog is only read"); +} + +#[test] +fn open_library_on_a_lightroom_catalog_offers_its_import() { + let (mut h, fx) = setup(); + offer_and_cancel(&mut h, &fx); + reoffer_import_and_merge(&mut h, &fx); drop(h); - let _ = std::fs::remove_dir_all(&dir); + let _ = std::fs::remove_dir_all(&fx.dir); } diff --git a/crates/ui-egui/src/tests/preview_limit.rs b/crates/ui-egui/src/tests/preview_limit.rs index 07a30c8a58..3687199c93 100644 --- a/crates/ui-egui/src/tests/preview_limit.rs +++ b/crates/ui-egui/src/tests/preview_limit.rs @@ -840,6 +840,72 @@ mod in_the_loupe { } } + fn drag_first_window(h: &mut Headless, work: &Rc>, id: lightcraft_catalog::PhotoId) -> RenderJob { + let first = next_region_job(h, work); + let view = h.app.region_view.expect("Detail asked for a window"); + assert_eq!(view.photo, id); + assert_eq!(view.full, (WIDTH as usize, HEIGHT as usize), "at 400 % the window's frame is the photo's own pixels"); + assert!(view.window.w >= 1300 && view.window.h >= 700, "the window covers the canvas: {:?}", view.window); + assert!(view.window.x + view.window.w <= view.full.0 && view.window.y + view.window.h <= view.full.1, "inside the frame: {:?}", view.window); + assert_eq!(first.request.window, Some(view.window), "the job is the window on screen"); + assert_eq!((first.request.max_w, first.request.max_h), view.full, "the job renders the frame the view uses"); + assert_eq!(first.request.quality, lightcraft_pipeline::Quality::Draft, "a drag drafts the window"); + assert_eq!(first.level, SourceLevel::Full); + assert!(matches!(&first.source, SourceRef::File { .. }), "the first window decodes the real file"); + assert_ne!(first.request_id, 0, "the renderer gave the request its own identity"); + first + } + + /// An edit during the first decode waits; the first result is accepted with its original. + fn drag_accepts_first_original( + h: &mut Headless, + work: &Rc>, + id: lightcraft_catalog::PhotoId, + first: RenderJob, + ) -> (u64, u64) { + // An edit changes the desired window key while the first original is still held. + // Detail must defer a second decode until this first result has populated the cache. + let (first_key, first_request) = (first.key, first.request_id); + let reply = h.request("engine.execute", json!({"command": "develop.set", "params": {"control": "light.exposure", "value": 0.5}}), T); + assert_eq!(reply["ok"], true); + h.step(); + assert!(work.borrow().jobs.is_empty(), "a changed window waits for the first original"); + assert_eq!(h.app.renderer.wanted(Slot::Region), Some(first_key)); + assert_eq!(h.app.session.memory_report().full_source.bytes, 0); + + deliver(work, Slot::Region, first.run()); + h.step(); + assert!(h.app.region_view.is_some()); + assert_eq!(h.app.renderer.textures.get(&Slot::Region).map(|t| t.key), Some(first_key), "the first window arrived"); + assert!(h.app.session.memory_report().full_source.bytes >= WIDTH as usize * HEIGHT as usize * 3 * 4); + assert!(h.app.session.media.has_source(id, SourceLevel::Full), "the original was accepted before any supersession"); + (first_key, first_request) + } + + fn drag_later_windows_reuse_original(h: &mut Headless, work: &Rc>, first: (u64, u64), discarded: u64) { + let (first_key, first_request) = first; + let second = next_region_job(h, work); + let (second_key, second_request) = (second.key, second.request_id); + assert_ne!(second_key, first_key); + assert_ne!(second_request, first_request); + assert_eq!(h.app.renderer.wanted(Slot::Region), Some(second_key), "the newer window is pending"); + assert!(matches!(&second.source, SourceRef::Loaded(_)), "the newer window reuses the accepted original"); + + let reply = h.request("engine.execute", json!({"command": "develop.set", "params": {"control": "light.exposure", "value": 1.0}}), T); + assert_eq!(reply["ok"], true); + let third = next_region_job(h, work); + assert_ne!(third.key, second_key); + assert_eq!(h.app.renderer.wanted(Slot::Region), Some(third.key)); + + deliver(work, Slot::Region, second.run()); + h.step(); + assert_eq!(h.app.renderer.textures.get(&Slot::Region).map(|t| t.key), Some(second_key), "the superseded draft still reached the screen"); + assert_eq!(h.app.renderer.wanted(Slot::Region), Some(third.key), "the newest request is still pending"); + assert_eq!(h.app.renderer.discarded, discarded, "the superseded draft was accepted, not discarded"); + assert!(h.app.session.memory_report().full_source.bytes >= WIDTH as usize * HEIGHT as usize * 3 * 4); + assert!(matches!(&third.source, SourceRef::Loaded(_)), "the pending window still reuses the original"); + } + // Given a 400 % view of a real 24 MP photo, when the first window is decoded and accepted and // later drag ticks supersede each other, then the original stays in the cache and every later // window is cut from it. The first accepted result is the actual Detail wiring's job: the @@ -856,57 +922,9 @@ mod in_the_loupe { let discarded = h.app.renderer.discarded; h.app.ui.zoom = crate::state::Zoom::Percent(400.0); h.app.session.begin_interaction("Exposure").expect("a drag"); - - let first = next_region_job(&mut h, &work); - let (first_key, first_request) = (first.key, first.request_id); - let view = h.app.region_view.expect("Detail asked for a window"); - assert_eq!(view.photo, id); - assert_eq!(view.full, (WIDTH as usize, HEIGHT as usize), "at 400 % the window's frame is the photo's own pixels"); - assert!(view.window.w >= 1300 && view.window.h >= 700, "the window covers the canvas: {:?}", view.window); - assert!(view.window.x + view.window.w <= view.full.0 && view.window.y + view.window.h <= view.full.1, "inside the frame: {:?}", view.window); - assert_eq!(first.request.window, Some(view.window), "the job is the window on screen"); - assert_eq!((first.request.max_w, first.request.max_h), view.full, "the job renders the frame the view uses"); - assert_eq!(first.request.quality, lightcraft_pipeline::Quality::Draft, "a drag drafts the window"); - assert_eq!(first.level, SourceLevel::Full); - assert!(matches!(&first.source, SourceRef::File { .. }), "the first window decodes the real file"); - assert_ne!(first_request, 0, "the renderer gave the request its own identity"); - - // An edit changes the desired window key while the first original is still held. - // Detail must defer a second decode until this first result has populated the cache. - let reply = h.request("engine.execute", json!({"command": "develop.set", "params": {"control": "light.exposure", "value": 0.5}}), T); - assert_eq!(reply["ok"], true); - h.step(); - assert!(work.borrow().jobs.is_empty(), "a changed window waits for the first original"); - assert_eq!(h.app.renderer.wanted(Slot::Region), Some(first_key)); - assert_eq!(h.app.session.memory_report().full_source.bytes, 0); - - deliver(&work, Slot::Region, first.run()); - h.step(); - assert!(h.app.region_view.is_some()); - assert_eq!(h.app.renderer.textures.get(&Slot::Region).map(|t| t.key), Some(first_key), "the first window arrived"); - assert!(h.app.session.memory_report().full_source.bytes >= WIDTH as usize * HEIGHT as usize * 3 * 4); - assert!(h.app.session.media.has_source(id, SourceLevel::Full), "the original was accepted before any supersession"); - - let second = next_region_job(&mut h, &work); - let (second_key, second_request) = (second.key, second.request_id); - assert_ne!(second_key, first_key); - assert_ne!(second_request, first_request); - assert_eq!(h.app.renderer.wanted(Slot::Region), Some(second_key), "the newer window is pending"); - assert!(matches!(&second.source, SourceRef::Loaded(_)), "the newer window reuses the accepted original"); - - let reply = h.request("engine.execute", json!({"command": "develop.set", "params": {"control": "light.exposure", "value": 1.0}}), T); - assert_eq!(reply["ok"], true); - let third = next_region_job(&mut h, &work); - assert_ne!(third.key, second_key); - assert_eq!(h.app.renderer.wanted(Slot::Region), Some(third.key)); - - deliver(&work, Slot::Region, second.run()); - h.step(); - assert_eq!(h.app.renderer.textures.get(&Slot::Region).map(|t| t.key), Some(second_key), "the superseded draft still reached the screen"); - assert_eq!(h.app.renderer.wanted(Slot::Region), Some(third.key), "the newest request is still pending"); - assert_eq!(h.app.renderer.discarded, discarded, "the superseded draft was accepted, not discarded"); - assert!(h.app.session.memory_report().full_source.bytes >= WIDTH as usize * HEIGHT as usize * 3 * 4); - assert!(matches!(&third.source, SourceRef::Loaded(_)), "the pending window still reuses the original"); + let first = drag_first_window(&mut h, &work, id); + let keys = drag_accepts_first_original(&mut h, &work, id, first); + drag_later_windows_reuse_original(&mut h, &work, keys, discarded); } // The collector's accept branch on its own: a superseded window result still carries the diff --git a/crates/ui-egui/src/tests/slideshow.rs b/crates/ui-egui/src/tests/slideshow.rs index 01a468ed89..26c72c2cd6 100644 --- a/crates/ui-egui/src/tests/slideshow.rs +++ b/crates/ui-egui/src/tests/slideshow.rs @@ -871,20 +871,8 @@ fn settings_shows_the_titles_and_the_preview_shows_a_title_screen() { h.settle(SETTLE); } -/// Settings ▸ Slideshow ▸ Templates: built-ins listed, hover previews on the selected photo -/// without changing anything, a click applies, and the user's own templates are saved, updated, -/// renamed and deleted from the browser. -#[test] -fn template_browser_previews_on_hover_applies_and_manages_user_templates() { +fn tpl_hover_previews_without_changes(h: &mut Headless) -> lightcraft_engine::slide_template::SlideLook { use lightcraft_engine::slide_template::SlideLook; - let mut h = grid(); - let dir = std::env::temp_dir().join(format!("lc-ui-sstpl-{}", std::process::id())); - let _ = std::fs::remove_dir_all(&dir); - h.app.session.slide_templates_dir = Some(dir.clone()); - let first = h.app.session.visible_cloned()[0]; - run(&mut h, "library.select", json!({"ids": [first.0]})); - run(&mut h, "view.slideshowOptions", json!({})); - assert!(h.step_until(SETTLE, |h| h.app.renderer.textures.get(&Slot::SlidePreview).is_some_and(|t| t.photo == first))); let has = |h: &Headless, w: &str| h.app.widgets.iter().any(|(id, _)| id == w); let rect = |h: &Headless, w: &str| h.app.widgets.iter().find(|(id, _)| id == w).map(|(_, r)| *r).unwrap(); for w in [ @@ -896,7 +884,7 @@ fn template_browser_previews_on_hover_applies_and_manages_user_templates() { "field:slideshowTemplateName", "button:slideshowTemplateSave", ] { - assert!(has(&h, w), "{w}"); + assert!(has(h, w), "{w}"); } // hover: the preview shows Gallery Wall (its light grey wall in the margin), nothing changes let before = SlideLook::of(&h.app.session); @@ -915,42 +903,55 @@ fn template_browser_previews_on_hover_applies_and_manages_user_templates() { assert!(h.step_until(SETTLE, grey), "the hovered template on the selected photo"); assert_eq!(SlideLook::of(&h.app.session), before, "hovering changes nothing"); assert!(h.app.session.slide_templates_previous.is_none()); + before +} + +fn tpl_click_applies_and_saves_own(h: &mut Headless, dir: &std::path::Path) { + let has = |h: &Headless, w: &str| h.app.widgets.iter().any(|(id, _)| id == w); // a click applies it - reveal(&mut h, "template:builtin:gallery-wall"); + reveal(h, "template:builtin:gallery-wall"); let r = h.request("ui.clickWidget", json!({"id": "template:builtin:gallery-wall"}), T); assert_eq!(r["ok"], true, "{r}"); h.step(); assert!(h.app.session.slide_overlays.rating_stars.enabled && h.app.session.slide_layout.stroke_border); - assert!(has(&h, "template:previous"), "Previous settings appear"); + assert!(has(h, "template:previous"), "Previous settings appear"); // save as a template of our own - reveal(&mut h, "field:slideshowTemplateName"); + reveal(h, "field:slideshowTemplateName"); let r = h.request("ui.clickWidget", json!({"id": "field:slideshowTemplateName"}), T); assert_eq!(r["ok"], true, "{r}"); let r = h.request("ui.text", json!({"text": "Holiday / 2026"}), T); assert_eq!(r["ok"], true, "{r}"); - reveal(&mut h, "button:slideshowTemplateSave"); + reveal(h, "button:slideshowTemplateSave"); let r = h.request("ui.clickWidget", json!({"id": "button:slideshowTemplateSave"}), T); assert_eq!(r["ok"], true, "{r}"); h.step(); assert!(dir.join("Holiday _ 2026.json").exists(), "the separator never makes a folder"); h.step(); - assert!(has(&h, "template:user:Holiday _ 2026")); + assert!(has(h, "template:user:Holiday _ 2026")); +} + +fn tpl_update_from_menu(h: &mut Headless) { + let has = |h: &Headless, w: &str| h.app.widgets.iter().any(|(id, _)| id == w); // update it from its menu with changed settings - run(&mut h, "slideshow.layout", json!({"backdropColor": "#123456"})); - reveal(&mut h, "template:user:Holiday _ 2026"); + run(h, "slideshow.layout", json!({"backdropColor": "#123456"})); + reveal(h, "template:user:Holiday _ 2026"); let r = h.request("ui.clickWidget", json!({"id": "template:user:Holiday _ 2026", "button": "right"}), T); assert_eq!(r["ok"], true, "{r}"); h.step(); for w in ["button:slideshowTemplateUpdate", "button:slideshowTemplateRename", "button:slideshowTemplateExport", "button:slideshowTemplateDelete"] { - assert!(has(&h, w), "{w}"); + assert!(has(h, w), "{w}"); } let r = h.request("ui.clickWidget", json!({"id": "button:slideshowTemplateUpdate"}), T); assert_eq!(r["ok"], true, "{r}"); h.step(); assert_eq!(h.app.session.slide_template("user:Holiday _ 2026").unwrap().look.layout.backdrop_color, [0x12, 0x34, 0x56]); +} + +fn tpl_rename_in_place(h: &mut Headless) { + let has = |h: &Headless, w: &str| h.app.widgets.iter().any(|(id, _)| id == w); // rename it in place - reveal(&mut h, "template:user:Holiday _ 2026"); + reveal(h, "template:user:Holiday _ 2026"); let r = h.request("ui.clickWidget", json!({"id": "template:user:Holiday _ 2026", "button": "right"}), T); assert_eq!(r["ok"], true, "{r}"); h.step(); @@ -958,7 +959,7 @@ fn template_browser_previews_on_hover_applies_and_manages_user_templates() { assert_eq!(r["ok"], true, "{r}"); h.step(); h.step(); - assert!(has(&h, "field:slideshowTemplateRename")); + assert!(has(h, "field:slideshowTemplateRename")); let r = h.request("ui.key", json!({"key": "a", "cmd": true}), T); assert_eq!(r["ok"], true, "{r}"); let r = h.request("ui.text", json!({"text": "Summer"}), T); @@ -967,9 +968,13 @@ fn template_browser_previews_on_hover_applies_and_manages_user_templates() { assert_eq!(r["ok"], true, "{r}"); h.step(); h.step(); - assert!(has(&h, "template:user:Summer"), "{:?}", h.app.session.slide_templates().templates.iter().map(|t| t.id.clone()).collect::>()); + assert!(has(h, "template:user:Summer"), "{:?}", h.app.session.slide_templates().templates.iter().map(|t| t.id.clone()).collect::>()); +} + +fn tpl_delete_then_back_to_previous(h: &mut Headless, dir: &std::path::Path, before: &lightcraft_engine::slide_template::SlideLook) { + use lightcraft_engine::slide_template::SlideLook; // delete it (after confirming) - reveal(&mut h, "template:user:Summer"); + reveal(h, "template:user:Summer"); let r = h.request("ui.clickWidget", json!({"id": "template:user:Summer", "button": "right"}), T); assert_eq!(r["ok"], true, "{r}"); h.step(); @@ -983,12 +988,33 @@ fn template_browser_previews_on_hover_applies_and_manages_user_templates() { h.step(); assert!(!dir.join("Summer.json").exists()); // back to the settings before Gallery Wall - reveal(&mut h, "template:previous"); + reveal(h, "template:previous"); let r = h.request("ui.clickWidget", json!({"id": "template:previous"}), T); assert_eq!(r["ok"], true, "{r}"); h.step(); assert_eq!(SlideLook::of(&h.app.session).overlays, before.overlays); h.settle(SETTLE); +} + +/// Settings ▸ Slideshow ▸ Templates: built-ins listed, hover previews on the selected photo +/// without changing anything, a click applies, and the user's own templates are saved, updated, +/// renamed and deleted from the browser. +#[test] +fn template_browser_previews_on_hover_applies_and_manages_user_templates() { + let mut h = grid(); + let dir = std::env::temp_dir().join(format!("lc-ui-sstpl-{}", std::process::id())); + let _ = std::fs::remove_dir_all(&dir); + h.app.session.slide_templates_dir = Some(dir.clone()); + let first = h.app.session.visible_cloned()[0]; + run(&mut h, "library.select", json!({"ids": [first.0]})); + run(&mut h, "view.slideshowOptions", json!({})); + assert!(h.step_until(SETTLE, |h| h.app.renderer.textures.get(&Slot::SlidePreview).is_some_and(|t| t.photo == first))); + let before = tpl_hover_previews_without_changes(&mut h); + tpl_click_applies_and_saves_own(&mut h, &dir); + tpl_update_from_menu(&mut h); + tpl_rename_in_place(&mut h); + tpl_delete_then_back_to_previous(&mut h, &dir, &before); + h.settle(SETTLE); let _ = std::fs::remove_dir_all(dir); } From 307ecb981d05ee6a6412709fa0aeeb90589fc382 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 28 Oct 2026 04:06:29 +0000 Subject: [PATCH 78/93] fix(ui-egui): keep the Export dialog's original spacing before the preset row --- crates/ui-egui/src/dialogs.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/ui-egui/src/dialogs.rs b/crates/ui-egui/src/dialogs.rs index bca04fe0cc..6462882203 100644 --- a/crates/ui-egui/src/dialogs.rs +++ b/crates/ui-egui/src/dialogs.rs @@ -1094,7 +1094,6 @@ fn export_body(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens, dlg: &mut ui.add_space(4.0); export_naming_rows(ui, opts); export_destination_rows(app, ui, t, opts, dir); - ui.add_space(4.0); export_save_preset_row(app, ui, opts, *full_size, resize, *limit_kb, preset_name); } From aaf532c5252ebb235847107002998b462fce0de6 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Wed, 28 Oct 2026 12:09:18 -0400 Subject: [PATCH 79/93] macOS packaging: retry stapler when Apple's CloudKit drops the connection Co-Authored-By: Claude Opus 5.5 --- packaging/macos/package.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/packaging/macos/package.sh b/packaging/macos/package.sh index eab3cde225..110d9ee162 100755 --- a/packaging/macos/package.sh +++ b/packaging/macos/package.sh @@ -84,6 +84,21 @@ sign() { codesign --force --sign "$IDENTITY" ${kc[@]+"${kc[@]}"} "${ts[@]}" "$@" } +# `stapler staple` and `stapler validate` both fetch the ticket from Apple's CloudKit, and a dropped +# connection there (NSURLErrorDomain -1005, "Error 68") fails them although notarization worked. +# Both are idempotent, so retry with a pause; a missing or bad ticket still fails every try. +stapler_retry() { + local try + for try in 1 2 3 4; do + xcrun stapler "$1" "$2" && return 0 + [[ "$try" = 4 ]] && break + echo "stapler $1 failed (try $try of 4); retrying in $((try * 20)) s" >&2 + sleep $((try * 20)) + done + echo "error: stapler $1 $(basename "$2") failed 4 times" >&2 + exit 1 +} + notarize() { local file="$1" out id status echo "==> notarizing $(basename "$file") (this can take a few minutes)" @@ -129,8 +144,8 @@ codesign --verify --strict --deep --verbose=2 "$APP" if [[ "$NOTARIZE" = 1 ]]; then ditto -c -k --keepParent "$APP" "$WORK/LightCraft-notarize.zip" notarize "$WORK/LightCraft-notarize.zip" - xcrun stapler staple "$APP" - xcrun stapler validate "$APP" + stapler_retry staple "$APP" + stapler_retry validate "$APP" spctl --assess --type execute -vvv "$APP" fi @@ -203,8 +218,8 @@ verify_dmg_app() { verify_dmg_app if [[ "$NOTARIZE" = 1 ]]; then notarize "$DMG" - xcrun stapler staple "$DMG" - xcrun stapler validate "$DMG" + stapler_retry staple "$DMG" + stapler_retry validate "$DMG" spctl --assess --type open --context context:primary-signature -vvv "$DMG" fi From e381c1ae6b2006ce627b243fe41697ce0d9608e0 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Wed, 28 Oct 2026 12:09:24 -0400 Subject: [PATCH 80/93] Release 0.15.0 Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 66 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cff5ae6a9b..4611917545 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3535,7 +3535,7 @@ dependencies = [ [[package]] name = "lightcraft" -version = "0.14.0" +version = "0.15.0" dependencies = [ "chrono", "craft-update", @@ -3562,7 +3562,7 @@ dependencies = [ [[package]] name = "lightcraft-catalog" -version = "0.14.0" +version = "0.15.0" dependencies = [ "chrono", "crc32fast", @@ -3582,7 +3582,7 @@ dependencies = [ [[package]] name = "lightcraft-cli" -version = "0.14.0" +version = "0.15.0" dependencies = [ "dhat", "lightcraft-codecs", @@ -3598,7 +3598,7 @@ dependencies = [ [[package]] name = "lightcraft-codecs" -version = "0.14.0" +version = "0.15.0" dependencies = [ "avif-serialize", "bytemuck", @@ -3629,7 +3629,7 @@ dependencies = [ [[package]] name = "lightcraft-color" -version = "0.14.0" +version = "0.15.0" dependencies = [ "lightcraft-geom", "proptest", @@ -3638,7 +3638,7 @@ dependencies = [ [[package]] name = "lightcraft-denoise" -version = "0.14.0" +version = "0.15.0" dependencies = [ "faer-core", "lightcraft-denoise-core", @@ -3655,7 +3655,7 @@ dependencies = [ [[package]] name = "lightcraft-denoise-core" -version = "0.14.0" +version = "0.15.0" dependencies = [ "dhat", "lightcraft-raster", @@ -3671,7 +3671,7 @@ dependencies = [ [[package]] name = "lightcraft-develop" -version = "0.14.0" +version = "0.15.0" dependencies = [ "lightcraft-color", "lightcraft-geom", @@ -3683,7 +3683,7 @@ dependencies = [ [[package]] name = "lightcraft-engine" -version = "0.14.0" +version = "0.15.0" dependencies = [ "ab_glyph", "chrono", @@ -3727,7 +3727,7 @@ dependencies = [ [[package]] name = "lightcraft-faces" -version = "0.14.0" +version = "0.15.0" dependencies = [ "lightcraft-testkit", "matrixmultiply", @@ -3742,7 +3742,7 @@ dependencies = [ [[package]] name = "lightcraft-fetch" -version = "0.14.0" +version = "0.15.0" dependencies = [ "log", "rustls", @@ -3753,7 +3753,7 @@ dependencies = [ [[package]] name = "lightcraft-geocode" -version = "0.14.0" +version = "0.15.0" dependencies = [ "miniz_oxide 0.9.1", "serde", @@ -3761,7 +3761,7 @@ dependencies = [ [[package]] name = "lightcraft-geom" -version = "0.14.0" +version = "0.15.0" dependencies = [ "proptest", "serde", @@ -3769,7 +3769,7 @@ dependencies = [ [[package]] name = "lightcraft-gpu" -version = "0.14.0" +version = "0.15.0" dependencies = [ "bytemuck", "lightcraft-color", @@ -3789,7 +3789,7 @@ dependencies = [ [[package]] name = "lightcraft-heif" -version = "0.14.0" +version = "0.15.0" dependencies = [ "heic-rs", "rayon", @@ -3797,14 +3797,14 @@ dependencies = [ [[package]] name = "lightcraft-inpaint" -version = "0.14.0" +version = "0.15.0" dependencies = [ "rayon", ] [[package]] name = "lightcraft-lensdb" -version = "0.14.0" +version = "0.15.0" dependencies = [ "lightcraft-develop", "lightcraft-geom", @@ -3813,7 +3813,7 @@ dependencies = [ [[package]] name = "lightcraft-mcp" -version = "0.14.0" +version = "0.15.0" dependencies = [ "lightcraft-codecs", "lightcraft-engine", @@ -3824,7 +3824,7 @@ dependencies = [ [[package]] name = "lightcraft-merge" -version = "0.14.0" +version = "0.15.0" dependencies = [ "lightcraft-codecs", "lightcraft-color", @@ -3840,7 +3840,7 @@ dependencies = [ [[package]] name = "lightcraft-meta" -version = "0.14.0" +version = "0.15.0" dependencies = [ "chrono", "lightcraft-geom", @@ -3853,7 +3853,7 @@ dependencies = [ [[package]] name = "lightcraft-pipeline" -version = "0.14.0" +version = "0.15.0" dependencies = [ "dhat", "image", @@ -3872,7 +3872,7 @@ dependencies = [ [[package]] name = "lightcraft-preview" -version = "0.14.0" +version = "0.15.0" dependencies = [ "jpeg-encoder", "lightcraft-raster", @@ -3884,7 +3884,7 @@ dependencies = [ [[package]] name = "lightcraft-raster" -version = "0.14.0" +version = "0.15.0" dependencies = [ "libc", "lightcraft-color", @@ -3896,7 +3896,7 @@ dependencies = [ [[package]] name = "lightcraft-raw" -version = "0.14.0" +version = "0.15.0" dependencies = [ "dhat", "jpeg-encoder", @@ -3920,7 +3920,7 @@ dependencies = [ [[package]] name = "lightcraft-scenes" -version = "0.14.0" +version = "0.15.0" dependencies = [ "image", "lightcraft-color", @@ -3931,7 +3931,7 @@ dependencies = [ [[package]] name = "lightcraft-segment" -version = "0.14.0" +version = "0.15.0" dependencies = [ "candle-core", "candle-nn", @@ -3945,7 +3945,7 @@ dependencies = [ [[package]] name = "lightcraft-slideshow" -version = "0.14.0" +version = "0.15.0" dependencies = [ "lightcraft-raster", "serde", @@ -3954,15 +3954,15 @@ dependencies = [ [[package]] name = "lightcraft-sysmem" -version = "0.14.0" +version = "0.15.0" [[package]] name = "lightcraft-testkit" -version = "0.14.0" +version = "0.15.0" [[package]] name = "lightcraft-tiff" -version = "0.14.0" +version = "0.15.0" dependencies = [ "proptest", "serde", @@ -3971,7 +3971,7 @@ dependencies = [ [[package]] name = "lightcraft-ui-egui" -version = "0.14.0" +version = "0.15.0" dependencies = [ "craft-ui", "craft-update", @@ -4002,7 +4002,7 @@ dependencies = [ [[package]] name = "lightcraft-web" -version = "0.14.0" +version = "0.15.0" dependencies = [ "crc32fast", "eframe", @@ -7819,7 +7819,7 @@ checksum = "e450f9b2ed1dff33c94c12589a87338689467b9c4f5d8a5710bd09a847d2c8a7" [[package]] name = "xtask" -version = "0.14.0" +version = "0.15.0" dependencies = [ "brotli", "flate2", diff --git a/Cargo.toml b/Cargo.toml index cd85d80f34..2056f3e490 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["crates/*", "apps/*", "xtask"] [workspace.package] -version = "0.14.0" +version = "0.15.0" edition = "2024" license = "MIT OR Apache-2.0" rust-version = "1.95" From 7ab25755055f970e218e2c29920a952baef9f083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20Mittelst=C3=A4dt?= <62167861+TheGalitube@users.noreply.github.com> Date: Wed, 28 Oct 2026 16:41:59 +0000 Subject: [PATCH 81/93] Reject ZIP entries with inconsistent decoded sizes Found while testing crates/geocode/src/unzip.rs:64 Co-Authored-By: GPT-6-Luna --- crates/geocode/src/unzip.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/crates/geocode/src/unzip.rs b/crates/geocode/src/unzip.rs index f78648d834..d422297a7f 100644 --- a/crates/geocode/src/unzip.rs +++ b/crates/geocode/src/unzip.rs @@ -61,7 +61,13 @@ pub fn extract(zip: &[u8], name: &str, max: usize) -> Result, GeocodeErr return match method { 0 if data.len() <= max => Ok(data.to_vec()), 0 => Err(GeocodeError::Invalid(format!("{name} is larger than {max} bytes"))), - 8 => miniz_oxide::inflate::decompress_to_vec_with_limit(data, max).map_err(|e| bad(&format!("deflate: {e:?}"))), + 8 => { + let decoded = miniz_oxide::inflate::decompress_to_vec_with_limit(data, max).map_err(|e| bad(&format!("deflate: {e:?}")))?; + if decoded.len() != usize_ { + return Err(bad("uncompressed size")); + } + Ok(decoded) + } m => Err(bad(&format!("compression method {m}"))), }; } @@ -120,4 +126,15 @@ mod tests { let _ = extract(&bad, "cities15000.txt", 100); } } + + #[test] + fn rejects_deflated_entry_with_inconsistent_directory_size() { + let mut z = make("cities15000.txt", b"hello world"); + let eocd = z.len() - 22; + let cd = u32::from_le_bytes([z[eocd + 16], z[eocd + 17], z[eocd + 18], z[eocd + 19]]) as usize; + let declared_size = cd + 24; + z[declared_size..declared_size + 4].copy_from_slice(&2u32.to_le_bytes()); + + assert!(extract(&z, "cities15000.txt", 100).is_err()); + } } From e2d18b5fb9e6177167177c194461a0b427b0a196 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 28 Oct 2026 13:05:19 -0400 Subject: [PATCH 82/93] Grant network access so update checks can reach GitHub (#3269) --- .../linux/flatpak/ai.storyteller.lightcraft.bundle.yml | 8 ++++---- packaging/linux/flatpak/ai.storyteller.lightcraft.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packaging/linux/flatpak/ai.storyteller.lightcraft.bundle.yml b/packaging/linux/flatpak/ai.storyteller.lightcraft.bundle.yml index 752e1edecb..73a44f0223 100644 --- a/packaging/linux/flatpak/ai.storyteller.lightcraft.bundle.yml +++ b/packaging/linux/flatpak/ai.storyteller.lightcraft.bundle.yml @@ -29,10 +29,10 @@ finish-args: # drag-and-drop through the document portal, so picked folders elsewhere work without broad # filesystem access. - --filesystem=xdg-pictures - # Deliberately not granted: home/host filesystem access, and network. The network is only for - # the optional SAM 3 model download (AI Object/Describe masks, docs/ai-masks.md); without it - # that download fails with an error and everything else works. Users who want it run - # `flatpak override --user --share=network ai.storyteller.lightcraft`. + # Deliberately not granted: home/host filesystem access. Network is needed for update checks + # against GitHub and the optional SAM 3 model download (AI Object/Describe masks, + # docs/ai-masks.md). + - --share=network modules: - name: lightcraft buildsystem: simple diff --git a/packaging/linux/flatpak/ai.storyteller.lightcraft.yml b/packaging/linux/flatpak/ai.storyteller.lightcraft.yml index e125475c57..83721a81c7 100644 --- a/packaging/linux/flatpak/ai.storyteller.lightcraft.yml +++ b/packaging/linux/flatpak/ai.storyteller.lightcraft.yml @@ -35,10 +35,10 @@ finish-args: # drag-and-drop through the document portal, so picked folders elsewhere work without broad # filesystem access. - --filesystem=xdg-pictures - # Deliberately not granted: home/host filesystem access, and network. The network is only for - # the optional SAM 3 model download (AI Object/Describe masks, docs/ai-masks.md); without it - # that download fails with an error and everything else works. Users who want it run - # `flatpak override --user --share=network ai.storyteller.lightcraft`. + # Deliberately not granted: home/host filesystem access. Network is needed for update checks + # against GitHub and the optional SAM 3 model download (AI Object/Describe masks, + # docs/ai-masks.md). + - --share=network build-options: append-path: /usr/lib/sdk/rust-stable/bin modules: From 953c4ee5fc308881760014b49911eb754b2709a4 Mon Sep 17 00:00:00 2001 From: radialmonster Date: Sat, 24 Oct 2026 14:50:40 -0400 Subject: [PATCH 83/93] raw: decode lossy single-plane (grey) JPEG XL tiles in LinearRaw DNGs Lightroom Classic's HDR and panorama merges of monochrome raws store a one-plane LinearRaw image as lossy (XYB) JPEG XL tiles whose codestream declares a grey colour encoding (16-bit float with a linear curve, or 16-bit integer with the sRGB curve). Those were refused as "lossy JPEG XL tile with a single colour plane", so the files opened preview-only. A lossy grey tile is still coded as three XYB channels. It is now restored like the RGB case: jxl-oxide renders linear sRGB (never the declared encoding, which would clip), the single plane is the luminance (CIE Y, D65) of that, then the declared transfer curve is applied. One plane must be declared grey and three RGB; HDR curves, other white points and intensity targets above 255 stay unsupported. RENDER_CACHE_VERSION 70 -> 71: files that showed their embedded preview before render from raw data now, under the same content key. Refs #275 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014ti8KemZbjE2ZgHgV1q1BM --- crates/engine/src/media/source.rs | 2 +- crates/raw/src/jxl.rs | 52 ++++++++++++++++++++++++++----- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/crates/engine/src/media/source.rs b/crates/engine/src/media/source.rs index 8f6a9c28c5..8490d2ee2c 100644 --- a/crates/engine/src/media/source.rs +++ b/crates/engine/src/media/source.rs @@ -1,7 +1,7 @@ use super::{Arc, Deserialize, DevelopSettings, MediaKind, Photo, Rgb32f, Rgba8, Serialize, SourceInfo}; /// Bump when the pipeline's output changes, to invalidate cached thumbnails. -pub const RENDER_CACHE_VERSION: u64 = 70; +pub const RENDER_CACHE_VERSION: u64 = 71; /// Thumbnails render at one of these long edges (so window/cell size changes reuse the cache). pub const THUMB_SIZES: [usize; 4] = [128, 256, 384, 512]; diff --git a/crates/raw/src/jxl.rs b/crates/raw/src/jxl.rs index 209f8f4de3..77bd3245c9 100644 --- a/crates/raw/src/jxl.rs +++ b/crates/raw/src/jxl.rs @@ -12,7 +12,9 @@ //! Lossless (non-XYB) tiles are rendered in the codestream's own colour encoding, which is the identity, //! keeping the values in the raw IFD's sample space. Lossy (XYB) tiles are decoded by jxl-oxide to linear //! sRGB primaries; the codestream's declared encoding is then restored by hand: its primaries with a -//! plain 3×3 matrix, then its transfer curve. The samples of a lossy tile mean what they would in a +//! plain 3×3 matrix, then its transfer curve. A grey (single-plane) lossy tile is still coded as three +//! XYB channels; its declared grey encoding is restored as the luminance (CIE Y, D65 white) of the +//! linear sRGB output, then its transfer curve. The samples of a lossy tile mean what they would in a //! lossless one with the same header, so a declared transfer curve is part of the stored values, not a //! display hint. Lightroom Classic's lossy LinearRaw DNGs (Convert to DNG with lossy compression) store //! perceptually shaped samples, label them with the sRGB curve and linearise them with a cubic @@ -126,7 +128,7 @@ enum Output { /// Decide how to render a chunk from its header: whether it is XYB-coded, the declared colour /// encoding and the intensity target. Lossy data is only accepted when the declared encoding is an RGB -/// one with a D65 white point and an SDR transfer curve (linear, sRGB, BT.709 or a power: what raw DNG +/// one (three planes) or a grey one (one plane) with a D65 white point and an SDR transfer curve (linear, sRGB, BT.709 or a power: what raw DNG /// writers signal) and no HDR tone mapping would apply, otherwise the samples cannot be restored /// faithfully. fn output_for(xyb: bool, encoding: &ColourEncoding, intensity_target: f32, planes: usize) -> Result { @@ -134,13 +136,15 @@ fn output_for(xyb: bool, encoding: &ColourEncoding, intensity_target: f32, plane return Ok(Output::AsCoded); } let unsupported = |what: &str| RawError::Unsupported(format!("lossy JPEG XL tile with {what}")); - if planes != 3 { - return Err(unsupported("a single colour plane")); - } let ColourEncoding::Enum(e) = encoding else { return Err(unsupported("an ICC profile instead of a colour encoding")); }; - if e.colour_space != ColourSpace::Rgb { + // a single plane is declared grey, three are declared RGB (the header's grey flag is the colour space) + let grey = planes == 1; + if grey && e.colour_space != ColourSpace::Grey { + return Err(unsupported("a single colour plane that is not declared grey")); + } + if !grey && e.colour_space != ColourSpace::Rgb { return Err(unsupported("a declared encoding that is not RGB")); } let curve = match e.tf { @@ -167,6 +171,13 @@ fn output_for(xyb: bool, encoding: &ColourEncoding, intensity_target: f32, plane if intensity_target > 255.0 { return Err(unsupported("an intensity target above 255 nits")); } + if grey { + // a grey encoding has no primaries, only the white point: its single plane is the luminance (CIE Y) + // of the decoder's linear sRGB, which is the row of sRGB → XYZ that gives Y. The rows of the + // matrix are all that row; only the first is used for one plane. + let y = rgb_to_xyz(SRGB)[1].map(|v| v as f32); + return Ok(Output::FromXyb { matrix: Some([y; 3]), curve }); + } let primaries = match e.primaries { Primaries::Srgb => return Ok(Output::FromXyb { matrix: None, curve }), Primaries::Bt2100 => BT2100, @@ -337,6 +348,25 @@ mod tests { assert_eq!(output_for(true, &linear(Primaries::Srgb), 255.0, 3).unwrap(), Output::FromXyb { matrix: None, curve: Curve::Linear }); } + #[test] + fn lossy_grey_data_is_the_luminance_in_the_declared_curve() { + // Lightroom Classic's merged monochrome LinearRaw DNGs: one plane, declared grey with a linear + // (16-bit float) or an sRGB (16-bit integer) curve + let grey = |tf| { + let mut e = EnumColourEncoding::srgb_linear(RenderingIntent::Perceptual); + e.colour_space = ColourSpace::Grey; + e.tf = tf; + output_for(true, &ColourEncoding::Enum(e), 255.0, 1).unwrap() + }; + let Output::FromXyb { matrix: Some(m), curve: Curve::Linear } = grey(TransferFunction::Linear) else { panic!("grey, linear") }; + // the luminance of linear sRGB (IEC 61966-2-1: 0.2126, 0.7152, 0.0722); white stays white + for (v, e) in m[0].iter().zip([0.2126, 0.7152, 0.0722]) { + assert!((v - e).abs() < 1e-4, "{m:?}"); + } + assert!((m[0].iter().sum::() - 1.0).abs() < 1e-5, "{m:?}"); + assert!(matches!(grey(TransferFunction::Srgb), Output::FromXyb { curve: Curve::Srgb, .. })); + } + #[test] fn lossy_data_keeps_the_declared_transfer_curve() { // Lightroom Classic's lossy LinearRaw DNGs: Rec.2100 primaries, sRGB transfer curve @@ -466,7 +496,15 @@ mod tests { #[test] fn lossy_data_that_cannot_be_restored_is_unsupported() { let bad = |xyb_planes: usize, e: ColourEncoding, it: f32| matches!(output_for(true, &e, it, xyb_planes), Err(RawError::Unsupported(_))); - assert!(bad(1, linear(Primaries::Srgb), 255.0), "grey"); + assert!(bad(1, linear(Primaries::Srgb), 255.0), "one plane declared RGB"); + let mut g = EnumColourEncoding::srgb_linear(RenderingIntent::Relative); + g.colour_space = ColourSpace::Grey; + assert!(bad(1, ColourEncoding::Enum(g.clone()), 10_000.0), "grey with an HDR intensity target"); + g.tf = TransferFunction::Pq; + assert!(bad(1, ColourEncoding::Enum(g.clone()), 255.0), "grey with PQ"); + g.tf = TransferFunction::Linear; + g.white_point = WhitePoint::Dci; + assert!(bad(1, ColourEncoding::Enum(g), 255.0), "grey with a white point other than D65"); assert!(bad(3, linear(Primaries::Srgb), 10_000.0), "HDR intensity target would tone-map"); let mut e = EnumColourEncoding::srgb_linear(RenderingIntent::Relative); for tf in [TransferFunction::Pq, TransferFunction::Hlg, TransferFunction::Unknown, TransferFunction::Gamma { g: 0, inverted: true }] { From 20c1f3c0579a9748b270239c08d0527215a85a46 Mon Sep 17 00:00:00 2001 From: radialmonster Date: Sat, 24 Oct 2026 15:15:04 -0400 Subject: [PATCH 84/93] raw: test the grey JPEG XL restore through decode The existing synthetic lossy RGB fixture tiles are re-declared grey by a header edit (colour space RGB to Grey, dropping the 6-bit primaries field a grey encoding does not carry, per the ColourEncoding bundle). Their XYB frame data is unchanged, so they decode as one grey plane whose rendered channels differ. The test checks decode against the gradient's BT.2100 luminance in the linear and sRGB curves. Refs #275 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014ti8KemZbjE2ZgHgV1q1BM --- crates/raw/src/jxl.rs | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/crates/raw/src/jxl.rs b/crates/raw/src/jxl.rs index 77bd3245c9..128f4eeea9 100644 --- a/crates/raw/src/jxl.rs +++ b/crates/raw/src/jxl.rs @@ -493,6 +493,56 @@ mod tests { } } + /// A fixture tile re-declared grey: its colour encoding's colour space goes from RGB to Grey and, + /// as a grey encoding has no primaries, the 6-bit BT.2100 primaries field is dropped (ISO/IEC 18181-1 + /// ColourEncoding; the bits after it move up and the header's zero padding to the frame grows by 6). + /// The XYB frame data is untouched, so the codestream is one grey plane coded as three XYB channels + /// whose colour is the gradient's, like Lightroom Classic's merged monochrome DNGs. + fn as_grey(tile: &[u8]) -> Vec { + // bit offset of the colour space, read LSB first, and the frame's first byte in these fixture tiles + const AT: usize = 42; + const FRAME: usize = 8; + let mut bits: Vec = tile.iter().flat_map(|b| (0..8).map(move |i| (b >> i) & 1)).collect(); + // colour space Rgb (selector 0), white point D65 (selector 1), primaries Bt2100 (selector 2 + 4 bits of 7) + assert_eq!(bits[AT..AT + 10], [0, 0, 1, 0, 0, 1, 1, 1, 1, 0], "the fixture's colour encoding"); + bits[AT] = 1; // colour space Grey (selector 1) + bits.drain(AT + 4..AT + 10); + bits.splice(FRAME * 8 - 6..FRAME * 8 - 6, [0; 6]); + bits.as_chunks::<8>().0.iter().map(|b| b.iter().enumerate().fold(0, |a, (i, v)| a | v << i)).collect() + } + + #[test] + fn lossy_grey_tiles_decode_to_the_luminance_of_their_colour() { + let srgb_eotf = |v: f32| if v <= 0.040_45 { v / 12.92 } else { ((v + 0.055) / 1.055).powf(2.4) }; + let y = rgb_to_xyz(BT2100)[1].map(|v| v as f32); + for (name, tile, curve) in [("linear", LINEAR_TILE, Curve::Linear), ("sRGB", SRGB_TILE, Curve::Srgb)] { + let grey = as_grey(tile); + // the decoder still renders three unequal channels: the restore must reduce them, not pick one + let mut img = JxlImage::builder().read(std::io::Cursor::new(&grey)).unwrap(); + assert!(img.image_header().metadata.grayscale(), "{name}: declared grey"); + img.request_color_encoding(EnumColourEncoding::srgb_linear(RenderingIntent::Relative)); + let render = img.render_frame(0).unwrap(); + let fb = render.image_all_channels(); + assert_eq!(fb.channels(), 3, "{name}"); + assert!((fb.buf()[2] - fb.buf()[0]).abs() > 0.1, "{name}: the rendered channels differ"); + + let ChunkPx::U16(px) = decode(&grey, 16, 16, 16, 16, 1, 16, false).unwrap() else { panic!("{name}: integer samples") }; + assert_eq!(px.len(), 256, "{name}: one plane"); + let (mut sum, mut worst) = (0.0f32, 0.0f32); + for (i, got) in px.iter().enumerate() { + // the gradient's samples are coded in the tile's curve: back to linear for the luminance + let rgb = gradient(i % 16, i / 16).map(|v| if curve == Curve::Srgb { srgb_eotf(v / 65535.0) } else { v / 65535.0 }); + let want = curve.encode(y[0] * rgb[0] + y[1] * rgb[1] + y[2] * rgb[2]) * 65535.0; + let err = (f32::from(*got) - want).abs(); + sum += err; + worst = worst.max(err); + } + let mean = sum / px.len() as f32; + assert!(mean < 0.02 * 65535.0, "{name}: mean error {mean}"); + assert!(worst < 0.1 * 65535.0, "{name}: worst error {worst}"); + } + } + #[test] fn lossy_data_that_cannot_be_restored_is_unsupported() { let bad = |xyb_planes: usize, e: ColourEncoding, it: f32| matches!(output_for(true, &e, it, xyb_planes), Err(RawError::Unsupported(_))); From 6188590675363b8db2b3a78b10bca9fec4493951 Mon Sep 17 00:00:00 2001 From: radialmonster Date: Sat, 24 Oct 2026 13:45:11 -0400 Subject: [PATCH 85/93] Docs: link gap 8 and roadmap priority 7 to lens profile issue #329 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014ti8KemZbjE2ZgHgV1q1BM --- ROADMAP.md | 5 +++-- docs/gaps.md | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 6802f92342..daad94027d 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,7 +2,7 @@ **Stage: alpha** · next: beta, ~14 points and ~340–600 h away -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-22 · **Change:** minor (Print: Japanese photo and postcard paper sizes — L判, 2L判, KG判, はがき, 往復はがき, 六切, 四切, 名刺; Minolta MRW decoded, 6 bodies verified; RAW: 83% of Adobe's models decode, 38% verified after the camera-coverage sweep #1327; German catalog 91% → 97%: interface strings and What's New lines translated) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-24 · **Change:** minor (the lens profile database priority links its tracking issue #329; Print: Japanese photo and postcard paper sizes — L判, 2L判, KG判, はがき, 往復はがき, 六切, 四切, 名刺; Minolta MRW decoded, 6 bodies verified; RAW: 83% of Adobe's models decode, 38% verified after the camera-coverage sweep #1327; German catalog 91% → 97%: interface strings and What's New lines translated) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6 One-page summary of how close LightCraft is to Adobe Lightroom. Agents: read this, then pick work from [docs/gaps.md](docs/gaps.md). The full assessment, method and evidence are in @@ -108,7 +108,7 @@ Ranked toward beta; detail in [docs/roadmap.md](docs/roadmap.md), gaps in [docs/ 4. ~~Full-resolution zoom~~ (done 2026-10-12) 5. AI masks: Subject / Sky / People (40–70 h + model decision) 6. Compressed ORF and HE NEF (28–55 h) -7. Lens profile database of our own (40–80 h) +7. Lens profile database of our own (40–80 h, #329) 8. Tests in CI on macOS, Windows and Linux (6–12 h) 9. Per-model raw verification (20–35 h) @@ -191,6 +191,7 @@ Ranked toward beta; detail in [docs/roadmap.md](docs/roadmap.md), gaps in [docs/ | Date | Change | Summary | |---|---|---| +| 2026-10-24 | minor | Priority 7 (lens profile database) links its tracking issue #329; headline numbers unchanged | | 2026-10-22 | minor | Print: Japanese photo and postcard paper sizes (L判, 2L判, KG判, はがき, 往復はがき, 六切, 四切, 名刺) in the page setup, Print dialog and PDF output; headline numbers unchanged | | 2026-10-19 | minor | Indonesian interface (`id`): every plain and formats message, plus 69 command labels, locale, menu command and tests; What's New left in English; Localization ~55% → ~64% (mean of the 12 key languages), 8 of 12 present | | 2026-10-12 | minor | Italian interface (`it`, #1192): 2,201 of 2,398 messages, locale, menu command and tests; headline numbers unchanged | diff --git a/docs/gaps.md b/docs/gaps.md index 42d9d437b6..671f3089c0 100644 --- a/docs/gaps.md +++ b/docs/gaps.md @@ -1,6 +1,6 @@ # Gaps: where LightCraft falls short of Lightroom -> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-24 · **Change:** minor (gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 551 models verified; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF) +> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-24 · **Change:** minor (gap 8: lens profile work is tracked in #329; gap 30: the Info panel shows the selected photos' shared metadata and marks mixed fields; gap 28: ⌘⌥⇧C / ⌘⌥⇧V copy and paste metadata; gap 13: before a Lightroom catalog import the app asks merge or new library, #2672; gap 28: F8 shows / hides the right panel; import review album hierarchy, #2362; gap 20: Minolta MRW decodes; gap 10: 551 models verified; gap 15: Print Page Options — page numbers, page info, crop marks; gap 28: `\` shows / hides the Filter Bar in the grids; gap 21: Indonesian interface shipped, every message but What's New; gap 27: the Windows x64 installer verified on Windows 11; the Settings → Apps uninstall confirmation remains; gap 28: ⌘L Enable Filters switches the filter off and on; gap 15: Japanese photo and postcard paper sizes in the Print page setup and PDF) Every known shortfall, one entry each, ranked by user impact (how many Lightroom users hit it, and how hard it blocks them), then by effort. **Agents pick work from the top** (the first entry nobody is @@ -22,7 +22,7 @@ Hours are Opus 5.5 agent wall-clock hours (see [target-app-parity.md](target-app | 5 B | **AI masks: Subject, Sky, People, Background, Landscape** are heuristics; Object / Describe run SAM 3 but its download has no mirror configured | `crates/segment`; ai-masks.md; MASK rows 67% | masking is how most Lightroom users edit today | 40–70 + model decision | [target-app-parity](target-app-parity.md#ai) | | 6 B | **Compressed ORF** (every Olympus / OM body since ~2008) | measured: 66 of 78 Olympus / OM models preview-only; `orf.rs` refuses; OM bucket 3% of photographers, 3% of them fully work | +2.6 points; best gain per hour of any raw gap (~0.2) | 8–15 | [raw-parity](raw-parity.md#compressed-orf-a-clean-room-starting-point) (the two Olympus patents that describe the method) | | 7 | **Nikon High Efficiency NEF** (HE / HE★ on Z 8, Z 9, Z 6III, Z f, Z50II, Z5II when set to HE) | named and preview only (#193); needs a pure-Rust JPEG XS decoder | +1.1 points (only shots taken in HE; lossless works on the same bodies); low gain per hour (~0.04), so not a beta blocker | 20–40 | [raw-parity](raw-parity.md) | -| 8 B | **No lens profile database** (LR-EDIT-OPTICS-PROFILE): only DNG opcodes, RW2 in-file distortion, Sony ILCE-7RM4A, full-frame ILCE-7CR distortion (Auto only) and ILCE-7RM6 distortion (`docs/sony-ilce7rm6-lens-corrections.md`) and Nikon Z 6II / Z 8 / Z f distortion (`docs/nikon-lens-corrections.md`) | Adobe ships 3,635 lens profiles; we never use them | distortion / vignetting correction is a default step for many | 40–80 + calibration shots | [raw-parity](raw-parity.md#lens-profiles) | +| 8 B | **No lens profile database** (LR-EDIT-OPTICS-PROFILE): only DNG opcodes, RW2 in-file distortion, Sony ILCE-7RM4A, full-frame ILCE-7CR distortion (Auto only) and ILCE-7RM6 distortion (`docs/sony-ilce7rm6-lens-corrections.md`) and Nikon Z 6II / Z 8 / Z f distortion (`docs/nikon-lens-corrections.md`); tracked in #329 | Adobe ships 3,635 lens profiles; we never use them | distortion / vignetting correction is a default step for many | 40–80 + calibration shots | [raw-parity](raw-parity.md#lens-profiles) | | 9 B | **Tests don't run in CI on macOS or Windows**: Linux x64 runs `cargo xtask ci` on every PR and push to main (`.github/workflows/ci.yml`) and FreeBSD runs `cargo test`; the others build packages | `.github/workflows/` (ci, freebsd, packaging-lint, release, windows-arm64); the linux-riscv64 release job added in 0.6.0 (#844) runs only `lightcraft-cli --version` under QEMU; macOS / Windows jobs: #1148 | regressions in `cfg(target_os)` code reach macOS and Windows users | 6–12 | [target-app-parity](target-app-parity.md#by-dimension) | | 10 B | **Per-model verification thin, plus cheap per-body decode fixes**: 551 of 1,446 Adobe models verified (38%), ~85% of photographers on a verified body; Nikon 5 bodies verified, Canon 34, Leica 14 (the Q3 by a recorded check of 38 private DNGs). Cheap fixes: Z 6II packed 14-bit NEF (#769, PR #671), Sony A100 regression (#702); F828 SRF now discovered and imported as preview-only, sensor decoding still missing, DSLR-A200…A390 / A850 12-bit ARW (#535) | measured: [raw/coverage.tsv](raw/coverage.tsv) | per-body bugs (levels, crops, WB) surface only from users | 25–45 | [raw-parity](raw-parity.md#by-maker-measured) | | 11 | **Enhance: Raw Details, Super Resolution; AI denoise without shippable weights or X-Trans** | ENH rows 0%; denoise Bayer only, RawNIND weights GPL and opt-in | Fujifilm users get no AI denoise; nobody gets it out of the box | 30–60 + model decision | [raw-parity](raw-parity.md#demosaic-levels-crops-and-lens-metadata) | @@ -84,6 +84,7 @@ Beta-blocking gaps (B) total **~230–430 h**; with the stability and platform w | Date | Change | Summary | |---|---|---| +| 2026-10-24 | minor | Gap 8: lens profile work is tracked in #329; hours unchanged | | 2026-10-24 | minor | Gap 28: ⌘⌥⇧C / ⌘⌥⇧V (Ctrl+Alt+Shift+C / V on Windows and Linux) copy and paste metadata; no key leaves the entry; hours unchanged | | 2026-10-24 | minor | Gap 30 shrinks: the Info panel's Show Metadata For (Target Photo / Selected Photos, `view.infoSelectedPhotos`) shows the selected photos' shared values and marks fields that differ as Mixed; the All Metadata dialog remains; 1–3 h (was 4–8) | | 2026-10-23 | minor | Gap 13: before a Lightroom catalog import the app asks whether it merges into the open library or goes into a new one (opt-out in Settings, #2672); hours unchanged | From 77c0a6adfa7db6e4f79b80843c0c578e5f16dee1 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Wed, 28 Oct 2026 15:48:43 -0400 Subject: [PATCH 86/93] Honor CARGO_BUILD_TARGET in FreeBSD packaging for aarch64 release builds (#3275) * Honor CARGO_BUILD_TARGET in FreeBSD packaging for aarch64 release builds package.sh always built for the host and took the arch from uname -m, so a cross build (aarch64 in an x86_64 FreeBSD VM) would read the wrong target directory and name the archive after the VM. With CARGO_BUILD_TARGET set, pass it to cargo, read target//release, and take the arch from the target. Unset keeps the old behavior. * Reject unknown CARGO_BUILD_TARGET in FreeBSD packaging Only the two FreeBSD triples are packaged. Any other target now fails before the build instead of being labelled x86_64. * Skip the --version smoke run for cross-built FreeBSD packages A binary built for another target cannot run on the build host, so under set -e the run would fail the release after the archive is written. --- packaging/freebsd/package.sh | 39 +++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/packaging/freebsd/package.sh b/packaging/freebsd/package.sh index 1e4c5ed41d..bae91b7706 100755 --- a/packaging/freebsd/package.sh +++ b/packaging/freebsd/package.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash # Build and package LightCraft for FreeBSD: # -# $DIST/lightcraft--freebsd-x86_64.tar.gz a /usr/local-style tree: -# lightcraft--freebsd-x86_64/{bin, share/applications, share/icons, share/mime, +# $DIST/lightcraft--freebsd-.tar.gz (arch: x86_64 or aarch64) a /usr/local-style tree: +# lightcraft--freebsd-/{bin, share/applications, share/icons, share/mime, # share/metainfo, share/doc/lightcraft} # # Install by copying the tree's contents into /usr/local: -# tar -xzf lightcraft--freebsd-x86_64.tar.gz --strip-components 1 -C /usr/local +# tar -xzf lightcraft--freebsd-.tar.gz --strip-components 1 -C /usr/local # # Usage: packaging/freebsd/package.sh [--skip-build] [--dry-run] # --dry-run stage the tree from stub binaries and list it, without building (works on any OS) @@ -29,13 +29,22 @@ while [[ $# -gt 0 ]]; do esac done +# A cross build (CI runs aarch64 in an x86_64 VM) takes its arch from the target, not the VM's uname. # FreeBSD's uname says amd64; release file names use x86_64 like the Linux and Windows ones. -MACHINE="$(uname -m)" -case "$MACHINE" in - amd64 | x86_64) ARCH=x86_64 ;; - arm64 | aarch64) ARCH=aarch64 ;; - *) echo "unsupported architecture $MACHINE" >&2; exit 2 ;; -esac +if [[ -n "${CARGO_BUILD_TARGET:-}" ]]; then + case "$CARGO_BUILD_TARGET" in + aarch64-unknown-freebsd) ARCH=aarch64 ;; + x86_64-unknown-freebsd) ARCH=x86_64 ;; + *) echo "unsupported FreeBSD target $CARGO_BUILD_TARGET" >&2; exit 2 ;; + esac +else + MACHINE="$(uname -m)" + case "$MACHINE" in + amd64 | x86_64) ARCH=x86_64 ;; + arm64 | aarch64) ARCH=aarch64 ;; + *) echo "unsupported architecture $MACHINE" >&2; exit 2 ;; + esac +fi if [[ "$DRY_RUN" = 0 ]] && [[ "$(uname -s)" != FreeBSD ]]; then echo "error: build on FreeBSD (or pass --dry-run to check the tree layout)" >&2 exit 2 @@ -47,14 +56,15 @@ echo "==> LightCraft $VERSION for FreeBSD $ARCH" # The release VM has 12 GB; full parallelism on the biggest crates runs it out of memory. export CARGO_BUILD_JOBS="${CARGO_BUILD_JOBS:-4}" if [[ "$SKIP_BUILD" = 0 ]]; then - (cd "$ROOT" && cargo build --release --locked -p lightcraft -p lightcraft-cli --features lightcraft/heif,lightcraft-cli/heif) + (cd "$ROOT" && cargo build --release --locked -p lightcraft -p lightcraft-cli --features lightcraft/heif,lightcraft-cli/heif \ + ${CARGO_BUILD_TARGET:+--target "$CARGO_BUILD_TARGET"}) fi WORK="$CARGO_TARGET_DIR/freebsd-package" STAGE="$WORK/$BASENAME" rm -rf "$WORK" mkdir -p "$WORK" -BIN="$CARGO_TARGET_DIR/release" +BIN="$CARGO_TARGET_DIR/${CARGO_BUILD_TARGET:+$CARGO_BUILD_TARGET/}release" OUT_DIR="$DIST" if [[ "$DRY_RUN" = 1 ]]; then # Stub binaries, and the tarball stays in the work dir so dist/ only ever holds real builds. @@ -92,7 +102,12 @@ mkdir -p "$OUT_DIR" tar -C "$WORK" -czf "$OUT_DIR/$BASENAME.tar.gz" "$BASENAME" echo "wrote $OUT_DIR/$BASENAME.tar.gz" -"$STAGE/bin/lightcraft-cli" --version +# A cross-built binary (e.g. aarch64 on the x86_64 VM) cannot run on the build host. +if [[ -z "${CARGO_BUILD_TARGET:-}" ]]; then + "$STAGE/bin/lightcraft-cli" --version +else + echo "skipping --version: $CARGO_BUILD_TARGET binaries do not run on this host" +fi if [[ "$DRY_RUN" = 1 ]]; then echo "==> dry run: tarball contents" tar -tzvf "$OUT_DIR/$BASENAME.tar.gz" From 40c3a09decfed5ee66cc1ac83838ab4fbb1ba66c Mon Sep 17 00:00:00 2001 From: Chad Elliott Date: Thu, 29 Oct 2026 02:41:16 -0500 Subject: [PATCH 87/93] docs(readme): recover a Windows update that fails with 1612/1714/1603 The old version's cached installer is missing, so Windows cannot remove it. Re-caching it with msiexec /fv on the same-version MSI fixes both updating and uninstalling (reproduced and verified on Windows 11, #3254). Co-Authored-By: Claude Opus 5.5 --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 6c556e46f4..ba094749ce 100644 --- a/README.md +++ b/README.md @@ -570,6 +570,14 @@ option to start it. For unattended installs: `msiexec /i lightcraft--window A silent install is per-user by default. `INSTALLFOLDER` chooses the folder, not who it is installed for; add `ALLUSERS=1`, from an elevated terminal or deployment tool, for an all-users install. +**Update or uninstall asks for an old `.msi`, or stops with error 1612 or 1714?** Windows removes the installed version +with its own cached copy of that version's installer; if the copy is gone, it asks for the original file and stops +(an update then ends with error 1603). Download the release MSI of the version and build you have installed from +[all releases](https://github.com/storytold/lightcraft/releases) and run +`msiexec /fv "" /qb+ /norestart`, approving the permission prompt if Windows shows one. That restores +the cached copy; then retry the update or uninstall. Opening the MSI, or choosing Repair or Uninstall on it, may still +fail. Error 1603 has other causes too; if this doesn't help, open an issue with the error message. + ### macOS | Build | File | Notes | From 260d797acc11531388e3f4bfc3d9ae7a644d38c9 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 29 Oct 2026 22:21:27 -0400 Subject: [PATCH 88/93] deps: bump tar, zip, roxmltree, rustls-webpki and symphonia to their latest versions (#3358) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `rustls-webpki`: 0.102.8, 0.103.15 → 0.102.8, 0.103.16 - `zip`: 7.2.0, 9.1.0 → 7.4.0, 9.1.3 Lockfile only. --- Cargo.lock | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4611917545..fc59452fb6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -888,7 +888,7 @@ dependencies = [ "safetensors 0.7.0", "thiserror 2.0.21", "yoke 0.8.3", - "zip 7.2.0", + "zip 7.4.0", ] [[package]] @@ -1257,7 +1257,7 @@ dependencies = [ "verifysign", "winreg", "winsafe", - "zip 9.1.0", + "zip 9.1.3", ] [[package]] @@ -1870,7 +1870,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -4883,7 +4883,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5842,7 +5842,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.12.1", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5855,7 +5855,7 @@ dependencies = [ "once_cell", "ring", "rustls-pki-types", - "rustls-webpki 0.103.15", + "rustls-webpki 0.103.16", "subtle", "zeroize", ] @@ -5895,11 +5895,11 @@ dependencies = [ "rustls", "rustls-native-certs", "rustls-platform-verifier-android", - "rustls-webpki 0.103.15", + "rustls-webpki 0.103.16", "security-framework", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -5951,9 +5951,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.15" +version = "0.103.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" +checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" dependencies = [ "ring", "rustls-pki-types", @@ -6478,10 +6478,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.4.3", + "getrandom 0.3.4", "once_cell", "rustix 1.1.5", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -7404,7 +7404,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -8086,9 +8086,9 @@ dependencies = [ [[package]] name = "zip" -version = "7.2.0" +version = "7.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c42e33efc22a0650c311c2ef19115ce232583abbe80850bc8b66509ebef02de0" +checksum = "cc12baa6db2b15a140161ce53d72209dacea594230798c24774139b54ecaa980" dependencies = [ "crc32fast", "indexmap", @@ -8098,9 +8098,9 @@ dependencies = [ [[package]] name = "zip" -version = "9.1.0" +version = "9.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2886b00003a72c4ccee3f42cfc34908d33b2508a74d827dc2a4244706475c704" +checksum = "1156b39d142a34b999c2310a50455e0cb3760bf7efad0122f796d813bee26ccb" dependencies = [ "crc32fast", "flate2", From b2d89895adaf5705fd8616f6c6135c561510132d Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Thu, 29 Oct 2026 22:36:34 -0400 Subject: [PATCH 89/93] CI: workflows only call craft-common-actions at @main (#3356) AGENTS.md (and CLAUDE.md where present) gets a CI workflows section: workflows only call craft-common-actions at @main, with no other jobs; feature and fix PRs don't touch CI and link or open a craft-common-actions issue (a PR only for a small fix that is safe for every app and does not increase CI time); legacy jobs aren't added to and move only as their own task, staying until a shared workflow runs them. windows-arm64.yml moves from its SHA pin to @main. The pinned revision is on craft-common-actions main and the workflow (and the actions it calls) is identical there, so nothing changes in behaviour. --- .github/workflows/windows-arm64.yml | 4 ++-- AGENTS.md | 5 +++++ CLAUDE.md | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows-arm64.yml b/.github/workflows/windows-arm64.yml index 8477823bf5..03f57e5088 100644 --- a/.github/workflows/windows-arm64.yml +++ b/.github/workflows/windows-arm64.yml @@ -27,8 +27,8 @@ permissions: jobs: windows-arm64: - # Immutable supporting workflow revision until the new install contract lands upstream. - uses: storytold/craft-common-actions/.github/workflows/windows-arm64.yml@8bb4e5ab95443171104ad88113fe1ef9b0e5ce3f + # Intentionally tracked at @main (not SHA-pinned) so org-wide CI improvements, security fixes, and build optimizations propagate without PR churn across all craftapp repos. + uses: storytold/craft-common-actions/.github/workflows/windows-arm64.yml@main with: app-name: lightcraft app-dir: LightCraft diff --git a/AGENTS.md b/AGENTS.md index 31dfd70f03..4044a6563e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -156,3 +156,8 @@ evaluates it (`.github/workflows/nix.yml`), so the build may lag behind the work GitHub profiles). Never hand-edit `contributors.json`. - Maintainers refresh the stats with `python3 ../../craftrules/scripts/contributors.py .` (it also re-verifies who wrote each `people.toml` entry; `--check` only verifies). + +## CI workflows +- Workflows in `.github/workflows/` call the shared workflows in [`storytold/craft-common-actions`](https://github.com/storytold/craft-common-actions) at `@main`, with their inputs and secrets. No other jobs: if no shared workflow does what's needed, it doesn't go here. +- Don't add or change CI in a feature or fix PR. If the existing workflows can't build or test a change, link an existing craft-common-actions issue or PR, or open a new issue, or a PR only for a small fix that is safe for every app and does not increase CI time. +- Some workflow files here still run their own jobs. Don't add to them. Moving a job into craft-common-actions is its own task, never part of another PR, and the job stays here until a shared workflow runs it. diff --git a/CLAUDE.md b/CLAUDE.md index 7005cac3b2..9b384fc6c2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -152,3 +152,8 @@ photos. `xtask` = tooling (`ci`, `layers`, `assets`, `parity`, `wasm`, `corpus`, `nix/package.nix` = the Nix package (`nix build` builds both binaries with the craft-fonts input, installs the desktop file/icons/AppStream metadata and runs `cargo test --workspace`; `nix develop` = dev shell). Community-maintained; CI only evaluates it (`.github/workflows/nix.yml`), so the build may lag behind the workspace; see README → Quick start. + +## CI workflows +- Workflows in `.github/workflows/` call the shared workflows in [`storytold/craft-common-actions`](https://github.com/storytold/craft-common-actions) at `@main`, with their inputs and secrets. No other jobs: if no shared workflow does what's needed, it doesn't go here. +- Don't add or change CI in a feature or fix PR. If the existing workflows can't build or test a change, link an existing craft-common-actions issue or PR, or open a new issue, or a PR only for a small fix that is safe for every app and does not increase CI time. +- Some workflow files here still run their own jobs. Don't add to them. Moving a job into craft-common-actions is its own task, never part of another PR, and the job stays here until a shared workflow runs it. From 445dd3106ef0b9f399584505daa29cbfba636c96 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 30 Oct 2026 01:27:49 -0400 Subject: [PATCH 90/93] Update prompt shows the app icon and accent color instead of a letter (#3362) UPDATE_APP (native builds; craft-update is a native-only dependency) carries our 128 px icon and accent (#f2a516, its colour in ArtCraft Launcher). The updater, the self-update helper and craft-update's startup prompt all get them through crate::UPDATE_APP; the prompt draws the icon, the accent and "by ArtCraft" (craft-update's default developer). craft-update is pinned to storytold/craft-libs main at 1065653e7 (#434). Clippy fixes for Rust 1.99 in untouched code (same logic): - crates/engine/src/cmd/export.rs - crates/ui-egui/src/dialogs/rules_editor/rules_move.rs - crates/ui-egui/src/panels/detail.rs --- Cargo.lock | 3 ++- Cargo.toml | 3 ++- apps/lightcraft/src/main.rs | 2 +- crates/engine/src/cmd/export.rs | 2 +- crates/ui-egui/src/dialogs/rules_editor/rules_move.rs | 2 +- crates/ui-egui/src/dialogs/updates_ui.rs | 2 +- crates/ui-egui/src/lib.rs | 9 +++++++++ crates/ui-egui/src/panels/detail.rs | 2 +- 8 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fc59452fb6..4abbe1b89f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1238,13 +1238,14 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=92d392cff132eaf53e13afff77f38b5c11b73aa0#92d392cff132eaf53e13afff77f38b5c11b73aa0" +source = "git+https://github.com/storytold/craft-libs?rev=1065653e75854e9c17e1ff563acdd344c1b185f0#1065653e75854e9c17e1ff563acdd344c1b185f0" dependencies = [ "chrono", "dunce", "egui", "flate2", "getrandom 0.3.4", + "image", "log", "plist", "semver", diff --git a/Cargo.toml b/Cargo.toml index 2056f3e490..87f730e31c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,8 @@ repository = "https://github.com/storytold/lightcraft" [workspace.dependencies] craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["serde"] } craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0" } -craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["egui"] } +# craft-update with storytold/craft-libs#434: the update prompt shows the app's icon, accent and developer. +craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "1065653e75854e9c17e1ff563acdd344c1b185f0", features = ["egui"] } craft-window = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["egui"] } # internal lightcraft-denoise-core = { path = "crates/denoise-core" } diff --git a/apps/lightcraft/src/main.rs b/apps/lightcraft/src/main.rs index 7b572fa0ed..f87f0dc726 100644 --- a/apps/lightcraft/src/main.rs +++ b/apps/lightcraft/src/main.rs @@ -136,7 +136,7 @@ const EXIT_WAIT: std::time::Duration = std::time::Duration::from_secs(2); fn main() -> eframe::Result { // Windows: the update helper is a copy of this program started with `--finish-update`. #[cfg(windows)] - if let Some(result) = craft_update::self_update::finish(&craft_update::suite::LIGHTCRAFT, &std::env::args_os().skip(1).collect::>()) { + if let Some(result) = craft_update::self_update::finish(&lightcraft_ui_egui::UPDATE_APP, &std::env::args_os().skip(1).collect::>()) { std::process::exit(i32::from(result.is_err())); } // First, so every start-up record is kept for the log file (`logging`). diff --git a/crates/engine/src/cmd/export.rs b/crates/engine/src/cmd/export.rs index 949c08f1ba..9af0606d9d 100644 --- a/crates/engine/src/cmd/export.rs +++ b/crates/engine/src/cmd/export.rs @@ -38,7 +38,7 @@ impl Session { } // the preset's depth is judged against the format written, known only now (`path`); a // depth the call passes itself is the caller's, and validated as such - if !p.get("bitDepth").is_some_and(|d| !d.is_null()) { + if p.get("bitDepth").is_none_or(|d| d.is_null()) { crate::export::ExportOptions::drop_unfit_depth(&mut out, fallback); } Ok(out) diff --git a/crates/ui-egui/src/dialogs/rules_editor/rules_move.rs b/crates/ui-egui/src/dialogs/rules_editor/rules_move.rs index de5ccc2efd..8506a28267 100644 --- a/crates/ui-egui/src/dialogs/rules_editor/rules_move.rs +++ b/crates/ui-egui/src/dialogs/rules_editor/rules_move.rs @@ -154,7 +154,7 @@ pub fn move_node(rs: &mut RuleSet, from: &[usize], dest: &[usize]) -> Option chain.len() && dest.starts_with(&chain)) && list_at(&next, &chain).is_some_and(|l| l.rules.is_empty()) { + while !(chain.is_empty() || dest.len() > chain.len() && dest.starts_with(&chain)) && list_at(&next, &chain).is_some_and(|l| l.rules.is_empty()) { remove_at(&mut next, &chain)?; if !shift_after_removal(&mut dest, &chain) { return None; diff --git a/crates/ui-egui/src/dialogs/updates_ui.rs b/crates/ui-egui/src/dialogs/updates_ui.rs index 5e159a0f44..bdd2a81eb4 100644 --- a/crates/ui-egui/src/dialogs/updates_ui.rs +++ b/crates/ui-egui/src/dialogs/updates_ui.rs @@ -26,7 +26,7 @@ impl Default for Runtime { fn default() -> Self { Self { #[cfg(not(target_arch = "wasm32"))] - updater: Updater::new(&craft_update::suite::LIGHTCRAFT, env!("CARGO_PKG_VERSION")), + updater: Updater::new(&crate::UPDATE_APP, env!("CARGO_PKG_VERSION")), #[cfg(not(target_arch = "wasm32"))] startup_check: false, #[cfg(not(target_arch = "wasm32"))] diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 9db7035c1d..8bf57b341c 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -6,6 +6,15 @@ #![forbid(unsafe_code)] #![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)] +/// LightCraft as craft-update knows it, with its 128 px icon and accent colour: the update +/// prompt shows both, and an AppImage's menu entry gets the icon. +#[cfg(not(target_arch = "wasm32"))] +pub const UPDATE_APP: craft_update::app::App = craft_update::app::App { + icon_png: Some(include_bytes!("../../../assets/app-icon/hicolor/128x128/apps/ai.storyteller.lightcraft.png")), + accent: Some([0xf2, 0xa5, 0x16]), + ..craft_update::suite::LIGHTCRAFT +}; + pub mod brush_live; pub mod canvas_keys; mod command_error; diff --git a/crates/ui-egui/src/panels/detail.rs b/crates/ui-egui/src/panels/detail.rs index 2b58595d2a..6840afdf06 100644 --- a/crates/ui-egui/src/panels/detail.rs +++ b/crates/ui-egui/src/panels/detail.rs @@ -450,7 +450,7 @@ fn draw_wipe_before(app: &LightcraftApp, p: &egui::Painter, id: PhotoId, img_rec /// view render cached) so stepping to them is instant. fn prefetch_neighbours(app: &mut LightcraftApp, id: PhotoId, main_area: Rect, ppp: f32, texture_side: usize, with_crop: bool) { // only once this photo is on screen - if app.renderer.is_pending(Slot::Main) || !app.renderer.textures.get(&Slot::Main).is_some_and(|t| t.photo == id) { + if app.renderer.is_pending(Slot::Main) || app.renderer.textures.get(&Slot::Main).is_none_or(|t| t.photo != id) { return; } let ids = app.session.visible_cloned(); From b25808686dd2a1633ab3cc929c0afdb636850e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20Mittelst=C3=A4dt?= <62167861+TheGalitube@users.noreply.github.com> Date: Fri, 30 Oct 2026 06:10:13 +0000 Subject: [PATCH 91/93] Reject mismatched XML closing tags Found while testing crates/lensdb/src/xml.rs:77 Co-Authored-By: GPT-6-Luna --- crates/lensdb/src/tests.rs | 5 +++++ crates/lensdb/src/xml.rs | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/lensdb/src/tests.rs b/crates/lensdb/src/tests.rs index 435882381f..6411ffd660 100644 --- a/crates/lensdb/src/tests.rs +++ b/crates/lensdb/src/tests.rs @@ -84,6 +84,11 @@ fn parses_cameras_lenses_and_skips_invalid_entries() { assert!(!db.lenses[2].rectilinear); } +#[test] +fn rejects_mismatched_xml_closing_tags() { + assert!(LensDb::parse("XL").is_err()); +} + #[test] fn malformed_documents_are_errors_not_panics() { assert!(LensDb::parse("").is_err()); diff --git a/crates/lensdb/src/xml.rs b/crates/lensdb/src/xml.rs index dc611a647c..0ff0c742c3 100644 --- a/crates/lensdb/src/xml.rs +++ b/crates/lensdb/src/xml.rs @@ -74,7 +74,6 @@ fn unescape(s: &str) -> String { pub(crate) fn parse(s: &str) -> Result { let mut reader = quick_xml::Reader::from_str(s); - reader.config_mut().check_end_names = false; let mut stack = vec![Node { name: "#root".into(), ..Default::default() }]; let mut count = 0usize; loop { From 5194cc20dea06d725079ac162c6912fc1f0d3a78 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 30 Oct 2026 09:02:24 -0400 Subject: [PATCH 92/93] UPD.1: honor pretend versions and track the updater icon in CI (#3365) --- Cargo.lock | 2 +- Cargo.toml | 4 ++-- contributors/people.toml | 3 +++ xtask/src/ci_quick.rs | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4abbe1b89f..17f738ea5e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1238,7 +1238,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=1065653e75854e9c17e1ff563acdd344c1b185f0#1065653e75854e9c17e1ff563acdd344c1b185f0" +source = "git+https://github.com/storytold/craft-libs?rev=04aa1703b32d299e54f78fcde4182f2b393a9116#04aa1703b32d299e54f78fcde4182f2b393a9116" dependencies = [ "chrono", "dunce", diff --git a/Cargo.toml b/Cargo.toml index 87f730e31c..a59de44ec4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,8 +12,8 @@ repository = "https://github.com/storytold/lightcraft" [workspace.dependencies] craft-ui = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["serde"] } craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0" } -# craft-update with storytold/craft-libs#434: the update prompt shows the app's icon, accent and developer. -craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "1065653e75854e9c17e1ff563acdd344c1b185f0", features = ["egui"] } +# craft-update: app-specific pretend versions apply to startup and manual checks. +craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "04aa1703b32d299e54f78fcde4182f2b393a9116", features = ["egui"] } craft-window = { git = "https://github.com/storytold/craft-libs", rev = "92d392cff132eaf53e13afff77f38b5c11b73aa0", features = ["egui"] } # internal lightcraft-denoise-core = { path = "crates/denoise-core" } diff --git a/contributors/people.toml b/contributors/people.toml index 95e58421a0..7518acd388 100644 --- a/contributors/people.toml +++ b/contributors/people.toml @@ -74,3 +74,6 @@ sync_github_name = true [people.dotCooCoo] real_name = "Robert Lee" sync_github_name = true + +[people.dylanmtaylor] +sync_github_name = true diff --git a/xtask/src/ci_quick.rs b/xtask/src/ci_quick.rs index f187daf59e..be3e5777df 100644 --- a/xtask/src/ci_quick.rs +++ b/xtask/src/ci_quick.rs @@ -33,7 +33,7 @@ const HEIF_PACKAGES: &[&str] = &["lightcraft-codecs", "lightcraft-heif"]; /// a build script's `rerun-if-changed`): a change to one counts as a change to those packages. /// An entry ending in `/` covers the directory. `embedded_files_are_mapped` keeps this complete. const EMBEDDED: &[(&str, &[&str])] = &[ - ("assets/app-icon/", &["lightcraft"]), + ("assets/app-icon/", &["lightcraft", "lightcraft-ui-egui"]), ("assets/camera-profiles/", &["lightcraft-engine"]), ("assets/camera-tone/", &["lightcraft-engine"]), ("assets/fonts/", &["lightcraft-engine", "lightcraft-ui-egui"]), From 831d724b8744580c377748091888e3e140b5f512 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Fri, 30 Oct 2026 15:26:29 -0400 Subject: [PATCH 93/93] Reject .cube data lines that start with nan or inf A data line such as `nan 0 0` starts with a letter and was skipped as an unknown keyword, so a file with enough other entries still parsed. (CodeRabbit review on #2540.) Co-Authored-By: Claude Opus 5.5 --- crates/pipeline/src/lut.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/pipeline/src/lut.rs b/crates/pipeline/src/lut.rs index fccb34e8f6..00f6ea1852 100644 --- a/crates/pipeline/src/lut.rs +++ b/crates/pipeline/src/lut.rs @@ -45,6 +45,10 @@ impl Lut3d { } else if let Some(r) = l.strip_prefix("DOMAIN_MAX") { max = three(r).ok_or("bad DOMAIN_MAX")?; } else if l.starts_with(|c: char| c.is_ascii_alphabetic()) { + // a data line of `nan` / `inf` starts with a letter too: it is bad data, not a keyword + if l.split_whitespace().next().is_some_and(|w| w.parse::().is_ok()) { + return Err(format!("bad line `{l}`")); + } // other keywords (LUT_IN_VIDEO_RANGE…) are ignored } else { data.push(three(l).ok_or_else(|| format!("bad line `{l}`"))?); @@ -150,6 +154,8 @@ mod tests { bad_line(&format!("LUT_3D_SIZE 2\n{}", "-inf inf nan\n".repeat(8))); bad_line(&format!("LUT_3D_SIZE 2\n{}", "1e39 0 0\n".repeat(8))); bad_line(&format!("LUT_3D_SIZE 2\n-inf 0 0\n{}", "0 0 0\n".repeat(7))); + bad_line(&format!("LUT_3D_SIZE 2\nnan 0 0\n{}", "0 0 0\n".repeat(8))); + bad_line(&format!("LUT_3D_SIZE 2\ninf 0 0\n{}", "0 0 0\n".repeat(8))); let ok = cube(|c| c, 2); assert!(Lut3d::parse_cube(&ok).is_ok()); assert!(Lut3d::parse_cube(&format!("DOMAIN_MIN nan 0 0\n{ok}")).is_err());