LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Merge PR #1601
Brandon Thomas3698f76c405c
diff --cc crates/ui-egui/src/headless.rsindex 81371c507,5a64d2036..a230bd55d--- a/crates/ui-egui/src/headless.rs+++ b/crates/ui-egui/src/headless.rs@@@ -3078,29 -2948,48 +3078,71 @@@ mod testslet _ = std::fs::remove_dir_all(&dir);}+ /// Switching Settings tabs keeps the window's top edge (and its tab row) where it is and never makes it+ /// narrower, though the tabs are of different heights and widths.+ #[test]+ fn settings_tabs_keep_the_window_in_place() {+ let mut h = demo([1300.0, 820.0]);+ let t = Duration::from_secs(10);+ let window = |h: &Headless| h.app.widgets.iter().find(|(w, _)| w == "dialog:window").map(|(_, r)| *r).expect("the dialog");+ let r = h.request("engine.execute", json!({"command": "app.settings", "params": {"tab": "general"}}), t);+ assert_eq!(r["ok"], true, "{r}");+ h.settle(SETTLE);+ let first = window(&h);+ let mut heights = Vec::new();+ for tab in ["display", "import", "performance", "general", "interface", "display"] {+ h.request("ui.clickWidget", json!({"id": format!("button:settingsTab-{tab}")}), t);+ h.settle(SETTLE);+ let now = window(&h);+ assert!((now.top() - first.top()).abs() < 1.0, "{tab}: top {} → {}", first.top(), now.top());+ assert!(now.width() >= first.width() - 1.0, "{tab}: width {} → {}", first.width(), now.width());+ heights.push(now.height());+ }+ assert!(heights.iter().any(|h| (h - first.height()).abs() > 20.0), "the tabs differ in height: {heights:?}");+ }++ /// Settings → Import → "Show the import review when a camera or card is connected": a card that+ /// was already in doesn't ask, a new one opens Import from Device (copying), and a busy window+ /// asks once it's free.+ #[test]+ fn a_connected_card_opens_the_import_review() {+ let mut h = demo([1200.0, 900.0]);+ let t = Duration::from_secs(10);+ let root = std::env::temp_dir().join(format!("lc-card-{}", std::process::id()));+ let dcim = root.join("DCIM/100NIKON");+ std::fs::create_dir_all(&dcim).unwrap();+ let img = lightcraft_raster::Rgba8::from_fn(8, 8, |x, y| [(x * 9) as u8, (y * 12) as u8, 80, 255]);+ let o = lightcraft_engine::export::ExportOptions { format: lightcraft_engine::export::ExportFormat::Png, ..Default::default() };+ std::fs::write(dcim.join("DSC_0001.png"), lightcraft_engine::export::encode_image(&img, &o).unwrap()).unwrap();+ let card = lightcraft_engine::devices::Device {+ name: "NIKON Z 8".into(),+ path: root.join("DCIM").to_string_lossy().to_string(),+ root: root.to_string_lossy().to_string(),+ };+ h.app.ui.dialog = None;+ // first look: the card was already in+ crate::import::cards_seen(&mut h.app, vec![card.clone()]);+ assert!(h.app.scan.is_none() && h.app.ui.dialog.is_none(), "a card that was already in doesn't ask");+ crate::import::cards_seen(&mut h.app, vec![card.clone()]);+ assert!(h.app.scan.is_none());+ // taken out, then put back while another dialog is open: it waits+ crate::import::cards_seen(&mut h.app, Vec::new());+ h.app.ui.dialog = Some(crate::state::Dialog::About);+ crate::import::cards_seen(&mut h.app, vec![card.clone()]);+ assert!(h.app.scan.is_none(), "a busy window isn't interrupted");+ h.app.ui.dialog = None;+ crate::import::cards_seen(&mut h.app, vec![card.clone()]);+ assert!(h.app.scan.is_some(), "the card is scanned once the window is free");+ assert!(h.step_until(t, |h| matches!(h.app.ui.dialog, Some(crate::state::Dialog::Import { .. }))));+ let Some(crate::state::Dialog::Import { opts }) = &h.app.ui.dialog else { panic!("no import review") };+ assert!(opts.copy, "a card is copied into the library");+ // with the option off nothing is remembered, so turning it on again starts with a first look+ assert!(!h.app.session.import_defaults.show_on_card);+ h.step();+ assert!(h.app.ui.known_cards.is_none());+ let _ = std::fs::remove_dir_all(&root);+ }+/// The folder scan runs in the background: the request returns at once and the review opens/// when the scan finishes (a folder on a network share must not freeze the window)./// Clicking the folder being read again keeps the running read (and its progress).diff --cc crates/ui-egui/src/lib.rsindex d14446e63,e07dd0466..ae720c3f5--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@@ -1111,33 -1095,16 +1111,43 @@@ impl LightcraftApp}ctx.request_repaint_after(std::time::Duration::from_secs(3));}+ // automatic XMP writes that failed (a network share offline): tried again every few seconds once their files+ // are reachable, and said once when they start waiting and once when they're written+ #[cfg(not(target_arch = "wasm32"))]+ {+ if self.session.unsaved_sidecars() > 0 {+ let now = ctx.input(|i| i.time);+ if now - self.ui.sidecar_retry_at >= 10.0 {+ self.ui.sidecar_retry_at = now;+ self.session.retry_unsaved_sidecars();+ }+ ctx.request_repaint_after(std::time::Duration::from_secs(10));+ }+ let waiting = self.session.unsaved_sidecars();+ if waiting > 0 && self.ui.sidecars_waiting == 0 {+ self.toast_for(+ ctx,+ crate::i18n::tr_format!(+ "The XMP sidecars of {n} photos couldn't be written (is their folder offline?). LightCraft keeps trying.",+ n = waiting+ ),+ 8.0,+ );+ } else if waiting == 0 && self.ui.sidecars_waiting > 0 {+ self.toast(ctx, crate::i18n::tr("Wrote the XMP sidecars that were waiting"));+ }+ self.ui.sidecars_waiting = waiting;+ }+ // Settings → Import: open the import review when a camera or card is connected+ #[cfg(not(target_arch = "wasm32"))]+ if self.session.import_defaults.show_on_card {+ if let Some(now) = lightcraft_engine::devices::devices_scanned() {+ import::cards_seen(self, now);+ }+ ctx.request_repaint_after(lightcraft_engine::devices::MAX_AGE);+ } else {+ self.ui.known_cards = None;+ }self.session.persist_if_dirty();panels::denoise::pump(self, ctx);model_setup::pump(self, ctx);diff --cc crates/ui-egui/src/state.rsindex 2a20b11a8,1e4c1313c..af6f30159--- a/crates/ui-egui/src/state.rs+++ b/crates/ui-egui/src/state.rs@@@ -729,11 -613,10 +729,15 @@@ pub struct UiState/// When the watched folder was last scanned (egui time).#[serde(skip)]pub auto_import_at: f64,+ /// When the automatic XMP writes that failed were last tried again (egui time), and how many were waiting then.+ #[serde(skip)]+ pub sidecar_retry_at: f64,+ #[serde(skip)]+ pub sidecars_waiting: usize,+ /// The cards and cameras already seen (volume roots) while Settings → Import → "Show the+ /// import review when a camera or card is connected" is on; `None` = not looked yet.+ #[serde(skip)]+ pub known_cards: Option<Vec<String>>,/// The develop control whose slider is being dragged (geometry sliders show a grid).#[serde(skip)]pub dragging_control: Option<String>,@@@ -1271,8 -1112,7 +1275,9 @@@ impl Default for UiStateexternal_edits: Vec::new(),was_focused: true,auto_import_at: 0.0,+ sidecar_retry_at: 0.0,+ sidecars_waiting: 0,+ known_cards: None,search: String::new(),focus_search: false,renaming_mask: None,diff --cc docs/parity-checklist.mdindex 1cf129ab8,5ca8c96fb..2b4190524--- a/docs/parity-checklist.md+++ b/docs/parity-checklist.md@@@ -807,13 -795,7 +807,14 @@@ Latin stays upright. Advanced Japanese| 2026-10-13 | patch | LRC-LIB-CATALOG-IMPORT: a catalog whose tables are all still in its `-wal` file (main file schema format 0) opens instead of failing as an unsupported schema format; status unchanged || 2026-10-14 | patch | LR-REM-HEAL, LR-REM-CLONE: zero-feather edges preserve exact-radius pixels; zero-opacity regression covers all spot modes and image corners. Statuses and feature counts unchanged. || 2026-10-13 | patch | LR-EXP-DIM: an enlarged export stops at 512 megapixels and is refused when it needs more memory than the computer has, instead of aborting the app; status unchanged |+| 2026-10-13 | minor | LR-PROF-CAMERACOLOR: bundled ILCA-99M2 profile with its held-out measurement |+| 2026-10-12 | minor | LR-MASK-EFFECTS (new, ✅): local adjustment (effect / brush) presets: Effect menu, New Effect Preset dialog, Manage window, groups and favorites; imports Lightroom Classic local `.lrtemplate`, Camera Raw local `.xmp`, `.lceffect` and `.zip`. LR-IMP-PROFILES and LR-MASK-SLIDERS notes updated |+| 2026-10-14 | minor | LR-IMP-CAMERA-COVERAGE: 21 Sony and Leica Adobe models verified on one CC0 file each; status unchanged (🟡) |+| 2026-10-13 | minor | KEY-HIDEPINS ⬜ → ✅: Tool Overlay (Auto / Always / Selected / Never, `view.toolOverlay`, ⇧H cycles; H stays Remove) for the Remove tool's spot pins and the mask pins (issue #224); LR-MASK-PINS loses its "no Auto mode" note, LR-REM-SPOT-EDIT notes the modes |+| 2026-10-13 | minor | LR-EDIT-DETAIL-NR, LR-EDIT-DETAIL-CNR: noise-reduction radii in the original's pixels, so previews at any size and smaller exports look like the full-size render scaled down (issue #960); status unchanged |+| 2026-10-13 | minor | KEYC-RATING: backtick cycles the flag (`photo.cycleFlag`), ⌘↑ / ⌘↓ raise / lower it (`photo.increaseFlag`, `photo.decreaseFlag`); status unchanged (🟡) |+| 2026-10-13 | patch | LR-MASK-LUMRANGE / LR-MASK-COLORRANGE: range drags keep the grabbed endpoint; colour samples use the render's enabled sections and HDR/SDR settings; regression coverage, status unchanged |+ | 2026-10-13 | minor | LR-IMP-DEVICE: Settings → Import → Cameras and Cards can open the import review when a camera or card is connected; status unchanged (✅) || 2026-10-11 | minor | LR-MERGE-HDR: HDR and panorama merges of raws without colour matrices (CR2, NEF, ARW…) write the colour they open with as DNG tags (issue #965); status unchanged || 2026-10-12 | minor | LR-META-XMP: Read Metadata from File no longer auto-writes the sidecar it has just read, which added `lc:settings` and hid another app's later `crs:` edits (#934); status unchanged (✅) || 2026-10-12 | patch | LR-IMP-CAMERA-COVERAGE: CR2 white level from the active area, not the saturated masked rows above it (issue #1272); status unchanged (🟡) |diff --cc docs/whats-new.mdindex 646f43434,e2fee05a0..828096be7--- a/docs/whats-new.md+++ b/docs/whats-new.md@@@ -1,86 -1,12 +1,91 @@@# What's new in LightCraft+## 2026-10-15++### Lightroom radial masks on the right side+- Radial masks brought over from Lightroom Classic (catalog import, XMP sidecars, edits inside DNGs and presets) now+ apply their effect inside the circle, as Lightroom does, instead of outside it (issue #1815). A mask inverted in+ Lightroom stays inverted, and older Radial Filters keep their Effect Outside / Invert Mask setting. Photos imported+ before this keep the masks they got: Photo ▸ Read Metadata from File reads a sidecar's again.++## 2026-10-15++### Delete in an album removes from the album only+- In an album, the Delete key now takes the selected photos out of the album, as in Lightroom. It used to move them+ to Recently Deleted, so they also left their folder's view (issue #1805). They stay in the library and in their+ folder; Edit ▸ Undo puts them back in the album. Photo ▸ Remove from Album does the same and now shows the key.+ To delete photos from the library from an album, use Photo ▸ Delete Photo or right-click ▸ Delete Photo. In a smart+ album, Delete changes nothing: its rules decide what it shows.+## 2026-10-14+### HDR merges of moving lights, and many brackets at once+- A star, the moon or a light that moves between the photos of a bracket (a night bracket on a tripod) no longer+ leaves a black hole where the middle photo had it clipped. With Deghost, the brightest photo's copy of it in a+ dark sky is now removed too.+- Photo ▸ Photo Merge ▸ HDR for Each Bracket Set merges every bracket among the selected photos with the last HDR+ settings, one after the other: each stack, and photos taken less than a second apart at different exposures.+ From the command line: `lightcraft-cli merge hdr-batch FOLDER`.+- Merging uses about a quarter less memory: three 67 MP raws need 3.8 GB instead of 4.8 GB.++### XMP sidecars catch up after a network share comes back+- With automatic XMP writing on, an edit to a photo whose folder can't be written (a network share that dropped+ out, a folder that went read-only) used to be written only to the library, with a line in the log, so the sidecar+ stayed behind the edit. LightCraft now says once that the sidecars are waiting, tries again every few seconds once+ the files are reachable, and says when they're written. `library.retrySidecars` does it on request.++### Reliability+- A damaged or crafted raw can no longer make LightCraft set aside gigabytes of memory before finding out the file is+ bad (issue #1512): a compressed PEF whose data is too short for the size it declares, an uncompressed TIFF-based+ raw whose tile claims far more samples than it holds, and an ARW6 with a broken tile are refused first. All 74+ files in the test corpus still decode.++### Reliability+- Thumbnails and previews are written to the cache on disk by one background writer instead of a new thread for+ each image (issue #1522). When renders come in faster than the disk takes them, at most 128 MB of images wait;+ past that a write is skipped (the image stays in memory and is written by a later render), so a slow disk can't+ pile up threads and memory.++### Reliability+- Saving the catalog and resuming a model download no longer write through a link left at the temporary file's+ name (`catalog.snap.tmp`, `model.onnx.part`): the link is removed and a new file made in its place, so the file it+ pointed to is never changed (issue #1502).++### Reliability+- A photo whose file was replaced (Reload Changed Files after an outside edit) no longer keeps the faces recognition+ made from the old pixels: they are made again from the new file, and a scan still busy with the old file when it+ changed doesn't put its faces on the new one (issue #1524).++### Settings stays put when you change tabs+- The Settings window keeps its top edge and width when you switch tabs, so the tab row no longer jumps around+ under the pointer. It used to be centred, so every tab of a different height moved it.++### Layout image over the loupe+- View ▸ Loupe Overlay ▸ Choose Layout Image… draws a PNG with transparency over the photo in the loupe, such as+ a magazine cover's masthead and cover lines, so you can frame a shot for the page it is made for. It fits inside+ the photo, follows zoom and pan, and ⌥⌘O shows or hides it. The same menu sets its opacity and a matte that+ darkens the photo outside it. The layout stays chosen across launches.++### Smaller JPEG exports+- JPEG exports are 12–14 % smaller at the same quality, with exactly the same pixels (issue #1373): each file now+ carries Huffman tables made for its own picture instead of the standard example tables. Every viewer opens them+ as before.++### Reliability+- A photo whose Defringe amount was stored far past the sliders' 20 (in a damaged catalog or sidecar) no longer+ crashes LightCraft each time it renders: the amount acts as 20.++### Lens names for Nikon DSLR raws+- Photos from Nikon DSLRs like the D700, D750, D80 or D5300 now show which lens they were taken with, for example+ "24.0-70.0 mm f/2.8". Those cameras don't write a lens name, so the lens field was empty and you couldn't filter or+ search by lens. LightCraft now reads the lens range Nikon keeps in its own maker note, the way Lightroom shows a+ lens it doesn't have a name for. Newly imported photos show it.++ ### Import when a card is connected+ - Settings → Import → Cameras and Cards has an option to open the import review as soon as a camera or memory card+ is connected, the same review File → Import from Device opens. It's off by default. A card that's already in when+ LightCraft starts doesn't ask, and if a dialog is open or an import is running it waits until that's done.+### Hard-edged Heal and Clone spots- A spot with Feather at 0 no longer draws black pixels exactly on its radius. This also fixes spots at 0% Opacitychanging pixels along their edge. The hard edge now leaves pixels on the radius unchanged.@@@ -183,21 -113,9 +188,23 @@@- An export enlarged far past the photo's size (20000 typed for 2000 with Don't Enlarge off) no longer endsLightCraft: an enlargement stops at 512 megapixels, as in Lightroom, and one that needs more memory than thecomputer has is refused with the size it would take, before it starts.+### Confirm matching faces together+- On a person's page, the ↑ control on a suggested face confirms it and all shown suggestions with equal or higher+ similarity as one undo step. Hover or focus that face and press A for the same action; hidden suggestions stay hidden.++### Noise reduction looks the same at every size+- Luminance and colour noise reduction no longer look much stronger in grid thumbnails and the filmstrip than in+ the loupe (issue #960). Their radii are now set in the original photo's pixels, so a thumbnail, the fitted loupe+ and a smaller export look like the full-size result scaled down; 1:1 views and full-size exports are unchanged.+ Like in Lightroom, judge noise reduction at 1:1: at small sizes the noise it removes is mostly averaged away.+ Cached thumbnails are redrawn.+- When the graphics driver resets the GPU while LightCraft is exporting or rendering (issue #1337, seen on Windows+ with NVIDIA), LightCraft still stops, because its window can't keep drawing on the lost device, but it now says+ "LightCraft stopped unexpectedly" and why, instead of "could not open its window", and the next start renders+ on the CPU and explains how to turn the GPU back on.+ ## 2026-10-13+### Slider drags on large raws- Dragging a slider no longer re-renders the edited photo's filmstrip thumbnail on every frame; it follows once youlet go. On a 64 MP raw the first of those renders decoded the whole file again, which held up the loupe's