LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Merge PR #2450: LRC-LIB-COMPARE: the Info panel labels the active photo while culling…
aionggdf319373cce3
diff --cc crates/ui-egui/src/tests_compare.rsindex f094f428f,7b87d2e47..c816b3c67--- a/crates/ui-egui/src/tests_compare.rs+++ b/crates/ui-egui/src/tests_compare.rs@@@ -210,77 -210,36 +210,111 @@@ fn a_compare_pane_says_when_its_render_assert!(!h.app.widgets.iter().any(|(w, _)| w.starts_with("compare:rendering:")));}+#[test]+fn reference_escape_leaves_overlays_then_the_view_without_changing_edits() {+ use crate::state::{LightsOut, ViewMode};+ let mut h = demo();+ let reference = h.app.session.visible_cloned()[0];+ h.app.run("library.select", json!({"ids": [reference.0]})).unwrap();+ h.app.run("view.reference", json!({})).unwrap();+ let active = h.app.session.active().unwrap();+ h.app.run("develop.set", json!({"control": "light.exposure", "value": 0.7})).unwrap();+ h.app.ui.lights_out = LightsOut::Dim;+ h.request("ui.key", json!({"key": "Escape"}), T);+ assert_eq!((h.app.ui.view, h.app.ui.lights_out), (ViewMode::Reference, LightsOut::On));+ h.request("ui.key", json!({"key": "Escape"}), T);+ assert_eq!(h.app.ui.view, ViewMode::Detail);+ assert_eq!(h.app.ui.reference, Some(reference.0), "leaving the view keeps the pinned photo");+ assert_eq!(h.app.session.active(), Some(active));+ assert_eq!(h.app.session.develop_of(active).unwrap().light.exposure, 0.7);+ h.request("ui.key", json!({"key": "Escape"}), T);+ assert_eq!(h.app.ui.view, ViewMode::PhotoGrid);+}++#[test]+fn invalid_or_deleted_reference_is_refused_without_replacing_the_pin() {+ let mut h = demo();+ let ids = h.app.session.visible_cloned();+ h.app.run("library.select", json!({"ids": [ids[0].0]})).unwrap();+ h.app.run("photo.setReference", json!({})).unwrap();+ h.app.run("photo.delete", json!({"ids": [ids[1].0]})).unwrap();+ for id in [u64::MAX, ids[1].0] {+ let r = h.app.run("photo.setReference", json!({"id": id}));+ assert!(r.is_err(), "unavailable photo {id} must not be pinned");+ assert_eq!(h.app.ui.reference, Some(ids[0].0));+ }+ let deleted = h.app.run("photo.setReference", json!({"id": ids[1].0})).unwrap_err();+ assert!(deleted.contains("Recently Deleted"), "the caller learns to restore it: {deleted}");+ // a malformed id is refused, not taken for "the active photo"+ h.app.run("library.select", json!({"ids": [ids[2].0]})).unwrap();+ for id in [json!(ids[2].0.to_string()), json!(-1), json!(1.5), json!([ids[2].0])] {+ assert!(h.app.run("photo.setReference", json!({"id": id})).is_err(), "{id}");+ assert_eq!(h.app.ui.reference, Some(ids[0].0));+ }+ h.app.run("photo.setReference", json!({"id": null})).unwrap();+ assert_eq!(h.app.ui.reference, Some(ids[2].0), "a null id means the active photo");+ h.app.run("photo.setReference", json!({"id": ids[0].0})).unwrap();+ h.app.run("library.select", json!({"ids": []})).unwrap();+ assert!(h.app.run("photo.setReference", json!({})).is_err());+ assert_eq!(h.app.ui.reference, Some(ids[0].0));+}++#[test]+fn deleting_the_pinned_reference_stops_drawing_it_and_reentry_uses_a_live_photo() {+ let mut h = demo();+ let reference = h.app.session.visible_cloned()[0];+ h.app.run("library.select", json!({"ids": [reference.0]})).unwrap();+ h.app.run("view.reference", json!({})).unwrap();+ h.settle(SETTLE);+ let texture = h.app.renderer.textures.get(&crate::render::Slot::Compare(0)).unwrap().tex.id();+ let drawn = |h: &Headless| h.view.painted_shapes().iter().any(|s| matches!(s, egui::epaint::Shape::Mesh(mesh) if mesh.texture_id == texture));+ assert!(drawn(&h), "the live reference is shown before deletion");+ let active = h.app.session.active().unwrap();+ h.app.run("photo.delete", json!({"ids": [reference.0]})).unwrap();+ h.settle(SETTLE);+ assert!(!drawn(&h), "Recently Deleted photos must not remain on the reference canvas");+ assert!(!h.app.renderer.textures.contains_key(&crate::render::Slot::Compare(0)), "the deleted reference's pane is released");+ assert!(!h.app.renderer.textures.contains_key(&crate::render::Slot::Compare(1)), "and the active photo's pane beside it");+ assert!(h.app.compare_windows[0].is_none());+ let r = h.app.run("view.reference", json!({})).unwrap();+ assert_eq!(r["reference"], active.0);+ assert_eq!(h.app.ui.reference, Some(active.0));+ h.app.run("photo.restore", json!({"ids": [reference.0]})).unwrap();+ h.app.run("photo.setReference", json!({"id": reference.0})).unwrap();+ h.settle(SETTLE);+ assert!(h.app.renderer.textures.get(&crate::render::Slot::Compare(0)).is_some_and(|t| t.photo == reference));+}+++ /// Clicking a colour label (or stars) in the Info panel while culling labels the active photo+ /// only, as the label keys and the bottom bar's stars and flags do, and the label shows under that+ /// photo in Compare (#2398: "Can't assign color to photo when culling").+ #[test]+ fn info_panel_label_in_compare_labels_the_active_photo_and_shows_it() {+ use lightcraft_catalog::{ColorLabel, PhotoId};+ let mut h = demo();+ let vis: Vec<u64> = h.app.session.visible_cloned().iter().map(|p| p.0).collect();+ for id in &vis[..2] {+ h.request("engine.execute", json!({"command": "photo.label", "params": {"label": "none", "ids": [id]}}), T);+ h.request("engine.execute", json!({"command": "photo.rate", "params": {"rating": 0, "ids": [id]}}), T);+ }+ h.request("engine.execute", json!({"command": "library.select", "params": {"ids": [vis[0], vis[1]], "active": vis[0]}}), T);+ let r = h.request("engine.execute", json!({"command": "view.compare"}), T);+ assert_eq!(r["ok"], true, "{r}");+ let (sel, cand) = (r["result"]["select"].as_u64().unwrap(), r["result"]["candidate"].as_u64().unwrap());+ h.app.ui.right = crate::state::RightPanel::Info;+ h.settle(SETTLE);+ let photo = |h: &Headless, id: u64| h.app.session.catalog.photo(PhotoId(id)).cloned().expect("photo");+ let widgets = |h: &mut Headless| h.request("ui.widgets", json!({}), T)["result"].to_string();+ assert!(!widgets(&mut h).contains(&format!("cull:{cand}:label")), "no label yet");+ let r = h.request("ui.clickWidget", json!({"id": "label:red"}), T);+ assert_eq!(r["ok"], true, "{r}");+ h.settle(SETTLE);+ assert_eq!(photo(&h, cand).label, Some(ColorLabel::Red), "the active photo (the candidate) is labelled");+ assert_eq!(photo(&h, sel).label, None, "the select is not labelled with it");+ assert!(widgets(&mut h).contains(&format!("cull:{cand}:label")), "the label shows under the candidate");+ let r = h.request("ui.clickWidget", json!({"id": "star:info:3"}), T);+ assert_eq!(r["ok"], true, "{r}");+ h.settle(SETTLE);+ assert_eq!(photo(&h, cand).rating, 3);+ assert_eq!(photo(&h, sel).rating, 0, "the select is not rated with it");+ }diff --cc docs/parity-checklist.mdindex 2ee2eb76a,9ff81cf58..c4a94f46e--- a/docs/parity-checklist.md+++ b/docs/parity-checklist.md@@@ -1,6 -1,6 +1,6 @@@# Lightroom parity checklist- > **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-21 · **Change:** minor (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; earlier: LRC-PRINT-PAGE: Print Page Options) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6-> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-20 · **Change:** patch (LRC-LIB-COMPARE: the Info panel labels the active photo while culling, #2398) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6++> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-10-21 · **Change:** minor (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; earlier: LRC-PRINT-PAGE: Print Page Options) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6The measured, row-by-row checklist: one row per Lightroom feature, menu item and shortcut, what wehave and what is missing. It answers *does the feature exist?* (feature breadth). Whether it is good@@@ -136,8 -136,8 +136,8 @@@ differences and missing bindings are i| LR-VIEW-NAVIGATOR | Navigator mini map | P1 | ✅ | `cmd:view.navigator`, `crates/ui-egui/src/panels/detail.rs` | shown while zoomed (bottom right); click/drag pans || LR-VIEW-BEFOREAFTER | Before / after | P0 | ✅ | `cmd:view.showOriginal`, `cmd:view.beforeAfter`, `cmd:view.beforeAfterSplit`, `cmd:view.beforeAfterTopBottom`, `cmd:view.beforeAfterSplitTopBottom`, `cmd:beforeAfter.setBefore`, `cmd:beforeAfter.copyAfterToBefore`, `cmd:beforeAfter.copyBeforeToAfter`, `cmd:beforeAfter.swap`, `cmd:beforeAfter.resetBefore` | all four layouts; before = the import state (defaults + import preset) or a chosen history step / version / the current settings; copy and swap (View → Before/After Settings, History row menu). The chosen before lasts for the session; in side by side and top / bottom, clicks with the white-balance selector, colour samplers and targeted adjustment work in the Before view too (`crates/ui-egui/src/tests_before_after.rs`). Zoomed in, the side by side and stacked views each stay in their pane, with their labels under it. Click zoom animates both panes together, including cached window tiles; input follows the displayed image and render requests use the final size (#1821) || LR-VIEW-COMPARE | Compare two photos | P1 | ✅ | `cmd:view.compare`, `cmd:compare.swap`, `cmd:compare.makeSelect`, `cmd:compare.set`, `crates/ui-egui/src/panels/compare.rs`, `crates/ui-egui/src/tests_compare.rs` | select / candidate, synced zoom + pan, arrows move the candidate; a filmstrip click puts the photo into the active side (a photo on the other side swaps), so the active photo is always one of the two shown; a ⌘/Ctrl- or Shift-click on the filmstrip changes the selection as in the grid while the two photos shown stay selected and the active photo is unchanged (#187); 1:1 to 8:1 sharp on both sides (zoom windows, see LR-VIEW-ZOOM); no zoom-link toggle; each pane says “Rendering…” (widget `compare:rendering:<pane>`) or “This photo can't be opened” (`compare:renderFailed:<pane>`) as the loupe does |- | LR-VIEW-SURVEY | Survey view [Classic] | P2 | ✅ | `cmd:view.survey`, `crates/ui-egui/src/panels/compare.rs` | selection tiled (≤ 48), keys act on the active photo, hover × removes |+ | LR-VIEW-SURVEY | Survey view [Classic] | P2 | ✅ | `cmd:view.survey`, `crates/ui-egui/src/panels/compare.rs` | selection tiled (≤ 48), keys, the bottom bar and the Info panel's stars and colour labels act on the active photo, each tile's caption shows its colour label, hover × removes |-| LR-VIEW-INFOOVERLAY | Info overlay on the photo | P1 | ✅ | `cmd:view.infoOverlay` | off / file + date + size / exposure + camera; ⌘I cycles (I in full screen; elsewhere I stays the Info panel) |+| LR-VIEW-INFOOVERLAY | Info overlay on the photo | P1 | ✅ | `cmd:view.infoOverlay`, `cmd:view.viewOptions` | off / Info 1 (by default file name, capture date, size) / Info 2 (file name, exposure, camera + lens), each three lines chosen in View Options; ⌘I cycles (I in full screen; elsewhere I stays the Info panel) || LR-VIEW-SLIDESHOW | Slideshow | P2 | ✅ | `cmd:view.slideshow` | View ▸ Slideshow (⌥⌘↩): the photos in view full screen from the selected one, played with the library's playback settings (see LRC-SS-PLAYBACK: fades, random order, repeat, previews prepared ahead; `interval` / any setting overrides one run); Space pauses, ←/→ step (a cut), Esc ends; playback controls on pointer movement || LR-VIEW-SECONDWINDOW | Second display window [Classic] | P2 | ✅ | `cmd:view.secondWindow`, `crates/ui-egui/src/panels/second.rs` | Window ▸ Second Window (⌘F11): the active photo fitted in its own native window with its own render (a floating panel where there are no native windows); loupe view only (no grid / compare / survey there) || LR-VIEW-CLIPPING | Clipping indicators | P0 | ✅ | `cmd:view.clipping` | |@@@ -694,9 -694,9 +694,9 @@@ From `08-lightroom-classic-extras.md` (| LRC-LIB-AUTOIMPORT | Watched-folder import | P2 | ✅ | `cmd:library.autoImport` | see LR-IMP-AUTO || LRC-LIB-TETHER | Tethered capture | P2 | ⬜ | | || LRC-LIB-VIEWS | Grid / loupe / compare / survey / people | P1 | 🟡 | `cmd:view.photoGrid`, `cmd:view.squareGrid`, `cmd:view.detail`, `cmd:view.compare`, `cmd:view.survey`, `cmd:view.gridInfo` | grid, square grid, loupe, compare, survey, second window; square-grid captions: file name, exposure or capture date (View ▸ Grid Info; no people view; picking one in Photo Grid switches to Square Grid) |- | LRC-LIB-COMPARE | Compare view | P1 | ✅ | `cmd:view.compare` | ⇧C (C is Crop here); swap, make select; a filmstrip click replaces the active side, a ⌘/Ctrl- or Shift-click changes the selection without touching the pair; zoom always linked; each pane says “Rendering…” or that the photo can't be opened, as the loupe does (see LR-VIEW-COMPARE) |+ | LRC-LIB-COMPARE | Compare view | P1 | ✅ | `cmd:view.compare` | ⇧C (C is Crop here); swap, make select; a filmstrip click replaces the active side, a ⌘/Ctrl- or Shift-click changes the selection without touching the pair; zoom always linked; each pane says “Rendering…” or that the photo can't be opened, as the loupe does (see LR-VIEW-COMPARE); the Info panel's stars and colour labels (and the Set Color Label menu) act on the active photo only, and each pane's caption shows its colour label (#2398) || LRC-LIB-SURVEY | Survey view | P2 | ✅ | `cmd:view.survey` | N |-| LRC-LIB-REFVIEW | Reference view | P2 | ✅ | `cmd:view.reference`, `cmd:photo.setReference`, `crates/ui-egui/src/panels/compare.rs` (`show_reference`) | View ▸ Reference View (⇧R): the reference photo beside the active one (edited with the Edit panel); photo menu ▸ Set as Reference Photo; each pane says “Rendering…” (widget `compare:rendering:<pane>`) or “This photo can't be opened” (`compare:renderFailed:<pane>`) as the loupe does |+| LRC-LIB-REFVIEW | Reference view | P2 | ✅ | `cmd:view.reference`, `cmd:photo.setReference`, `crates/ui-egui/src/panels/compare.rs` (`show_reference`) | View ▸ Reference View (⇧R): the reference photo beside the active one (edited with the Edit panel); photo menu ▸ Set as Reference Photo; each pane says “Rendering…” (widget `compare:rendering:<pane>`) or “This photo can't be opened” (`compare:renderFailed:<pane>`) as the loupe does. Escape → Detail without losing edits; pins are catalog-local; missing/deleted photos refused and deleted references no longer drawn (Windows regression/native smoke verified) || LRC-LIB-CATALOG-PANEL | Catalog sets | P1 | ✅ | `cmd:library.source` (`missing`) | all, recently added, picks, recently deleted, missing photos (when any) || LRC-LIB-CATALOG-IMPORT | Native Lightroom Classic catalog import | P1 | 🟡 | `cmd:library.inspectLightroom`, `cmd:library.importLightroom`, `crates/engine/src/lightroom_catalog.rs`, `docs/lightroom-catalog-import.md` | read-only `.lrcat` plus committed WAL pages (also WAL-only tables with main schema format 0), in-tree read-only Rust SQLite B-tree reader; on-demand main-file pages up to 16 GiB with existing table/record bounds (WAL still capped at 1 GiB, issue #798); background inspection/import with progress/cancellation, per-open library identity checks; persistent result with destination library, offline-original counts and Show in Library, dismissed when switching libraries; offline Local records are promoted without probing missing files; originals in place, ratings/flags/labels, XMP, hierarchical keywords, collection sets/regular collections, virtual copies, mapped develop settings; stable reimport identities, undo, missing-file placeholders, a root folder not found at its recorded path looked up relative to the catalog (Lightroom's `relativePathFromCatalog`, so a project folder copied from another computer stays linked; reported as a warning), existing edits preserved. Best-effort deduplicated recovery archives retain settings/history/snapshots/collection rules (32 MiB each, eight archives/128 MiB aggregate); archive limits/write failures and optional-table limits warn without blocking photo import; unrelated unsupported tables and opaque SQL BLOBs skipped. Custom white balance on relative-WB raws (`RAW` in Lightroom's terms) stays As Shot and is reported, since the catalog keeps no as-shot white to shift from (issue #510). An image whose file, folder or root folder record is missing from the catalog, or whose original path is empty, is skipped with its virtual copies instead of failing the whole import; the report lists them as data (`skipped`: image id and reason) and the result window counts them in the UI language (PR #2230). Adobe rendering, AI data and native history replay remain incomplete; no writes to Lightroom catalogs. Open Library given a Lightroom catalog folder, an `.lrdata` / `.lrcat-data` folder or the `.lrcat` makes no library there and offers this import with the catalog found (`cmd:app.openLibrary`, `crates/engine/src/lightroom_folder.rs`; issue #891) || LRC-LIB-CATALOG-LOCK | Catalog open in one program at a time | P1 | ✅ | `cmd:app.openLibrary`, `crates/catalog/src/lock.rs`, `crates/engine/src/library.rs` (`open_library`) | exclusive OS lock on `catalog.lock` for the session (app and `lightcraft-cli --library`); a second opener is refused with who has it (`catalog.lock.owner`: program, process, computer); released by the OS on a crash, so never stale; file systems without locks open unprotected with a warning (the app's notices, `library.info` → `settingsWarnings`, and the CLI's stderr; issue #171); no read-only mode; the browser build (OPFS) has no guard across tabs yet. A library that can't be opened at launch (locked, unreadable, newer format, drive missing) shows a window — Try Again, Choose Another Library…, Continue Without Saving (then a banner; nothing written), Quit — instead of a silent demo session (`crates/ui-egui/src/panels/library_problem.rs`); the lock is released explicitly when the library closes, not by letting its file handle close, so a program another thread is starting at that moment (which holds a copy of every file handle until it is launched) cannot keep the library "already open" for a moment (issue #680) |