LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Merge PR #1802
Brandon Thomas1e49095146ae
diff --cc crates/ui-egui/src/panels/dialogs.rsindex a7779fcd6,c91266a26..8e73e62f6--- a/crates/ui-egui/src/panels/dialogs.rs+++ b/crates/ui-egui/src/panels/dialogs.rs@@@ -1292,17 -1194,17 +1292,17 @@@ pub fn show(app: &mut LightcraftApp, ctDialog::Shortcuts => crate::panels::keymap::body(app, ui, &t),});ui.add_space(4.0);- ui.horizontal(|ui| {+ // 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 content_w = ui.available_width().max(ui.min_rect().width()).max(1.0);++ 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(content_w, row_h), egui::Layout::left_to_right(egui::Align::Center), |ui| {++ 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, .. })- || matches!(- dlg,- Dialog::About | Dialog::Shortcuts | Dialog::Settings { .. } | Dialog::SystemInfo { .. } | Dialog::AllMetadata { .. } | Dialog::WhatsNew- | Dialog::ManageEffects { .. }- );- let informational = unusable_model || only_shows(&dlg);++ 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@@@ -1310,16 -1212,8 +1310,9 @@@let cancel = match &dlg {Dialog::SamModel { .. } if sam_running || sam_installed || sam_nowhere => "Close",Dialog::SamModel { .. } => "Not Now",+ Dialog::LightroomResult { .. } => "Close",_ => "Cancel",};- if !informational {- let r = ui.button(crate::i18n::tr(cancel));- crate::widgets::register(ui.ctx(), "button:dialogCancel", r.rect);- if r.clicked() {- close = true;- }- }let add_label;let ok = match &dlg {Dialog::Import { opts } => {@@@ -1356,22 -1246,44 +1349,52 @@@};// installing waits for the licence to be accepted// (and Synchronize waits for the scan)- let can_confirm = 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 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 r = (!ok.is_empty()).then(|| ui.add_enabled(can_confirm, egui::Button::new(crate::i18n::tr(ok))));+ let primary = !informational && can_confirm && confirm_style(&dlg) == ConfirmStyle::Primary;+ // (Cancel first, then the confirm: the keyboard goes through them as the eye does)+ let width_of = |label: &str| {+ let text = egui::WidgetText::from(crate::i18n::tr(label))+ .into_galley(ui, Some(egui::TextWrapMode::Extend), f32::INFINITY, egui::TextStyle::Button)+ .size()+ .x;+ (text + 2.0 * ui.spacing().button_padding.x).max(ui.spacing().interact_size.x)+ };+ let gap = ui.spacing().item_spacing.x;+ let mut buttons_w = 0.0;+ if !informational {+ buttons_w += width_of(cancel) + gap;+ }+ if !ok.is_empty() {+ buttons_w += width_of(ok);+ }+ ui.add_space((ui.available_width() - buttons_w).max(0.0));+ if !informational {+ let r = ui.button(crate::i18n::tr(cancel));+ crate::widgets::register(ui.ctx(), "button:dialogCancel", r.rect);+ if r.clicked() {+ close = true;+ }+ }+ let button = if primary {+ egui::Button::new(egui::RichText::new(crate::i18n::tr(ok)).color(egui::Color32::WHITE)).fill(t.accent)+ } else {+ egui::Button::new(crate::i18n::tr(ok))+ };+ let r = (!ok.is_empty()).then(|| ui.add_enabled(can_confirm, button));if let Some(r) = &r {crate::widgets::register(ui.ctx(), "button:dialogOk", r.rect);}@@@ -2216,3 -2000,28 +2239,29 @@@ mod watermark_position_tests}}}++ /// How a dialog's confirm button looks: [`ConfirmStyle::Primary`] (the accent's fill) when it+ /// makes or brings in something, plain when it deletes or removes (never the eye-catching+ /// default) or when the dialog only shows something (its Close).+ #[derive(Clone, Copy, Debug, PartialEq, Eq)]+ pub enum ConfirmStyle {+ Primary,+ Plain,+ }++ pub fn confirm_style(dlg: &Dialog) -> ConfirmStyle {+ match dlg {- Dialog::ConfirmDelete { .. } | Dialog::DeleteKeyword { .. } | Dialog::RemoveFolder { .. } => ConfirmStyle::Plain,++ Dialog::ConfirmDelete { .. } | Dialog::DeleteKeyword { .. } | Dialog::DeleteEffects { .. } | Dialog::RemoveFolder { .. } => ConfirmStyle::Plain,+ _ if only_shows(dlg) => ConfirmStyle::Plain,+ _ => ConfirmStyle::Primary,+ }+ }++ /// A dialog that only shows something: one Close, nothing to confirm or cancel.+ fn only_shows(dlg: &Dialog) -> bool {+ matches!(+ dlg,+ Dialog::About | Dialog::Shortcuts | Dialog::Settings { .. } | Dialog::SystemInfo { .. } | Dialog::AllMetadata { .. } | Dialog::WhatsNew++ | Dialog::ManageEffects { .. }+ )+ }diff --cc docs/whats-new.mdindex 89a3b9672,d8611d7a6..54a805d12--- a/docs/whats-new.md+++ b/docs/whats-new.md@@@ -1,122 -1,12 +1,127 @@@# 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-15++### Local folders select a photo+- Showing a Local folder now makes its first photo the active one, as albums and the other sources do (issue+ #1447), or keeps the photo you had when the folder holds it. Before, the photo from the previous view stayed active:+ Photo Grid marked nothing, and Detail, the histogram and the photo info showed a photo that isn't in the folder.+## 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.++### Local folders+- Photos deleted (or moved) by another app no longer stay in a Local folder, failing to load and logging an error+ each time you look (issue #1392): the next time you browse the folder, in a later session, they're left out. A photo you had rated, flagged or+ edited stays, marked missing, so its changes aren't lost; photos in My Photos are unchanged.++### Full-resolution panoramas+- Panorama and HDR Panorama merges keep the resolution of their photos instead of stopping at 40 megapixels+ (issue #1455), up to 512 MP and 65,000 pixels on the long edge, as in Lightroom. When the full size needs more+ memory than the computer has, the panorama is made as large as fits (five 51 MP photos: up to 166 MP with+ 16 GB, 355 MP with 32 GB) and the message says so. The merge also frees each photo's pixels once they are+ projected, so it needs less memory than before at any size (an 81 MP stitch: 4.4 GB instead of 6.2 GB).++### Nikon D600, D610 and D5000+- Raws from the Nikon D600, D610 and D5000 no longer show a bright line down the right edge (issue #1627). Their+ sensor data runs a few columns of filler past the picture, which stayed in the image; these bodies now develop+ at the camera JPEG's size (6016 × 4016 for the D600 and D610, 4288 × 2848 for the D5000, as the D90 already+ did). On the D600 and D610 the white level is also measured inside the picture, so the filler can't pass for+ clipped highlights.++### More Canon EOS R6 Mark II C-RAW files decode+- Some EOS R6 Mark II C-RAW files (about 1 in 50 in one photographer's library) opened as their preview with+ "Canon CRX adaptive QP value 172" or "175". They now decode from the sensor data. Photos imported before this+ switch over with Photo ▸ Reload from Disk.++ ### A dialog's confirm button says it's the next step+ - In dialogs, the confirm button is on the right with Cancel to its left, and filled with the accent when it makes or+ brings in something (Import N Photos, Merge, Save, Create, Download…). Delete and Remove stay plain, so a destructive+ choice is never the eye-catching default.+### 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.