LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Merge origin/main into slideshow-playback (icons: Play/Pause beside grading and appearance icons; settings: Slideshow tab beside appearance cards; render: Slide and CompareRegion slots; tracker summary and whats-new)
Jason Baldwin7b0fc19ebb46
diff --cc crates/ui-egui/src/icons.rsindex e24341d72,b82194bbb..8f71a3ea8--- a/crates/ui-egui/src/icons.rs+++ b/crates/ui-egui/src/icons.rs@@@ -83,10 -83,20 +83,24 @@@ pub enum IconChat,/// Face boxes on/off: four corner brackets round a small face.FaceBox,+ /// Play (a triangle pointing right).+ Play,+ /// Pause (two bars).+ Pause,+ /// Colour grading, all three wheels: three small circles.+ GradeAll,+ /// Colour grading, shadows wheel: a filled circle.+ GradeShadows,+ /// Colour grading, midtones wheel: a half-filled circle.+ GradeMidtones,+ /// Colour grading, highlights wheel: an open circle with rays.+ GradeHighlights,+ /// Appearance Mode ▸ Auto (follow the system): a monitor on its stand.+ Monitor,+ /// Appearance Mode ▸ Light: a sun (a disc with eight rays).+ Sun,+ /// Appearance Mode ▸ Dark: a crescent moon.+ Moon,}struct Pen<'a> {diff --cc crates/ui-egui/src/lib.rsindex d2ad03491,8f837a825..dfd1285f1--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@@ -491,10 -565,69 +567,50 @@@ impl LightcraftAppr}+ /// The remembered ratio belongs to the tool until the user starts editing the crop.+ pub(crate) fn crop_tool_aspect(&self) -> Option<(u32, u32)> {+ let photo = self.session.active()?;+ let d = self.session.develop_of(photo)?;+ if d.crop != lightcraft_develop::Crop::default() {+ return d.crop.aspect;+ }+ match self.ui.crop_default_aspect.as_ref()? {+ Value::String(s) if s == "original" => {+ let p = self.session.catalog.photo(photo)?;+ let (w, h) = (p.width.max(1).saturating_mul(100), p.height.max(1).saturating_mul(100));+ Some(if d.orientation.swaps_axes() { (h, w) } else { (w, h) })+ }+ Value::Array(a) => {+ let number = |i: usize| {+ let v = a.get(i)?.as_f64()? * 100.0;+ (v.is_finite() && v >= 1.0 && v <= f64::from(u32::MAX)).then_some(v.round() as u32)+ };+ Some((number(0)?, number(1)?))+ }+ _ => None,+ }+ }++ /// Called only after a crop gesture begins, inside its undo transaction.+ pub(crate) fn begin_crop(&mut self) -> Result<(), String> {+ if self.session.interaction.is_some()+ && self.session.active().and_then(|id| self.session.develop_of(id)).is_some_and(|d| d.crop == lightcraft_develop::Crop::default())+ && let Some(aspect) = self.ui.crop_default_aspect.clone()+ && aspect != serde_json::json!("free")+ && let Err(e) = self.session.execute("crop.aspect", &serde_json::json!({"aspect": aspect}))+ {+ // A remembered value the command refuses (a hand-edited settings file) would refuse+ // every crop drag on an untouched photo: forget it and let this drag go ahead.+ self.ui.crop_default_aspect = None;+ self.ui.status = e.to_string();+ }+ Ok(())+ }+/// Show a transient toast at the bottom of the canvas (like the reference app's HUD).- /// Advance a running slideshow (wrapping around at the end).+ /// Advance a running slideshow.fn slideshow_tick(&mut self, ctx: &egui::Context) {- let Some((interval, due, paused)) = self.ui.slideshow else { return };- if !self.ui.fullscreen {- self.ui.slideshow = None;- return;- }- if paused {- return;- }- let now = ctx.input(|i| i.time);- if now >= due {- let vis = self.session.visible_cloned();- if let Some(cur) = self.session.active()- && !vis.is_empty()- {- let i = vis.iter().position(|x| *x == cur).map_or(0, |i| (i + 1) % vis.len());- let _ = self.run("library.select", serde_json::json!({"ids": [vis[i].0]}));- }- self.ui.slideshow = Some((interval, now + interval, false));- }- ctx.request_repaint_after(std::time::Duration::from_secs_f64((due - now).clamp(0.05, interval)));+ panels::slideshow::tick(self, ctx);}/// Announce the end of a Build Previews run.@@@ -1041,11 -1286,10 +1269,12 @@@// panels set it again this frame while the pointer rests on a preset or profileself.hover_preview = None;self.ai_mask_detail(&ctx);+ self.place_names_outcome(&ctx);if self.ui.fullscreen {// full-screen preview: the photo alone on black- egui::CentralPanel::default().frame(egui::Frame::NONE.fill(egui::Color32::BLACK)).show(ui, |ui| panels::detail::show(self, ui));+ egui::CentralPanel::default()+ .frame(egui::Frame::NONE.fill(egui::Color32::BLACK))+ .show(ui, |ui| if self.ui.slideshow.is_some() { panels::slideshow::show(self, ui) } else { panels::detail::show(self, ui) });panels::second::show(self, &ctx);panels::notices::show(self, &ctx);panels::dialogs::show(self, &ctx);diff --cc crates/ui-egui/src/menus.rsindex d373674c2,d5e0ee2f1..6c3e9a3e1--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@@ -140,13 -141,10 +141,16 @@@ pub const UI_COMMANDS: &[UiCommand] = &("dialog.newFolder", "New Folder…", Some("Cmd+Shift+N"), "File"),("dialog.smartAlbum", "New Smart Album…", None, "File"),("view.photoCounts", "Show Photo Counts", None, "View"),+ ("view.sidebarSection", "Show Sidebar Section", None, ""),+ ("view.sidebarMoveSection", "Move Sidebar Section", None, ""),+ ("view.sidebarReset", "Reset Sidebar Sections", None, ""),("view.slideshow", "Slideshow", Some("Cmd+Alt+Enter"), "View"),+ ("view.slideshowOptions", "Slideshow Options…", None, "View"),+ // the slideshow's playback controls (Space, ←/→ and Esc while it plays)+ ("slideshow.togglePause", "Pause / Resume Slideshow", None, ""),+ ("slideshow.next", "Next Slide", None, ""),+ ("slideshow.previous", "Previous Slide", None, ""),+ ("slideshow.end", "End Slideshow", None, ""),("view.secondWindow", "Second Window", Some("Cmd+F11"), "Window"),("tool.keywordPainter", "Keyword Painter", None, ""),("view.gridInfo", "Grid Info", None, ""),@@@ -1633,8 -1823,8 +1825,9 @@@ pub fn ui_enabled(app: &LightcraftApp,"file.backupLibrary" => app.services.backup_library.is_some(),"app.openLogFolder" => app.services.reveal.is_some() && app.services.log_file.is_some(),"file.restoreLibrary" => app.services.restore_library.is_some(),+ "app.clearRecentLibraries" => !app.ui.settings.recent_libraries.is_empty(),"compare.swap" | "compare.makeSelect" | "compare.set" => app.ui.view == ViewMode::Compare,+ "slideshow.togglePause" | "slideshow.next" | "slideshow.previous" | "slideshow.end" => app.ui.slideshow.is_some(),s if s.starts_with("dialog.merge") || (s.starts_with("merge.") && s.ends_with("Last")) => {app.session.targets(&serde_json::json!({})).len() >= 2 && app.merge.final_task.is_none()}diff --cc crates/ui-egui/src/panels/settings.rsindex 7569f4a3c,3c7261e20..5e91cbdf2--- a/crates/ui-egui/src/panels/settings.rs+++ b/crates/ui-egui/src/panels/settings.rs@@@ -624,95 -662,229 +666,318 @@@ fn interface_tab(app: &mut LightcraftAp});}+// ----------------------------------------------------------------------------------- Slideshow++/// A playback duration slider (`slider:{id}`). While it is dragged the value changes in memory+/// (the slideshow reads it); letting go saves it through `slideshow.playback`.+fn duration_slider(app: &mut LightcraftApp, ui: &mut egui::Ui, id: &str, key: &str, value: f64, range: std::ops::RangeInclusive<f64>) {+ let mut v = value;+ let r = ui.add(egui::Slider::new(&mut v, range).logarithmic(key == "slideDuration").suffix(" s").max_decimals(1));+ register(ui.ctx(), format!("slider:{id}"), r.rect);+ if r.changed()+ && let Ok(next) = app.session.slideshow.merged(&json!({ key: v }))+ {+ app.session.slideshow = next;+ }+ if r.drag_stopped() || (r.changed() && !r.dragged()) {+ let _ = app.run("slideshow.playback", json!({ key: v }));+ }+}++fn slideshow_tab(app: &mut LightcraftApp, ui: &mut egui::Ui, t: &Tokens) {+ use lightcraft_engine::slideshow::{FADE_MAX, SLIDE_MAX, SLIDE_MIN};+ heading(ui, t, crate::i18n::tr("Playback"));+ let s = app.session.slideshow.clone();+ row(ui, t, crate::i18n::tr("Slide duration"), |ui| {+ duration_slider(app, ui, "slideshowSlide", "slideDuration", s.slide_duration, SLIDE_MIN..=SLIDE_MAX)+ });+ row(ui, t, crate::i18n::tr("Fade duration"), |ui| {+ duration_slider(app, ui, "slideshowFade", "fadeDuration", s.fade_duration, 0.0..=FADE_MAX.min(s.slide_duration))+ });+ hint(ui, t, crate::i18n::tr("A slide stays up for its duration, its fade in included. A fade of 0 cuts."));+ row(ui, t, crate::i18n::tr("Fade"), |ui| {+ #[derive(Clone, Copy, PartialEq)]+ enum Fade {+ Cross,+ Black,+ White,+ Color,+ }+ let mut f = match s.fade_color {+ None => Fade::Cross,+ Some([0, 0, 0]) => Fade::Black,+ Some([255, 255, 255]) => Fade::White,+ Some(_) => Fade::Color,+ };+ let opts = [(Fade::Cross, "Crossfade"), (Fade::Black, "Through black"), (Fade::White, "Through white"), (Fade::Color, "Through a colour")];+ if choices(ui, "settingsSlideshowFade", &opts, &mut f) {+ let c = match f {+ Fade::Cross => Value::Null,+ Fade::Black => json!("#000000"),+ Fade::White => json!("#ffffff"),+ Fade::Color => json!([64, 64, 64]),+ };+ let _ = app.run("slideshow.playback", json!({"fadeColor": c}));+ }+ if f == Fade::Color+ && let Some(mut c) = s.fade_color+ {+ let r = egui::color_picker::color_edit_button_srgb(ui, &mut c);+ register(ui.ctx(), "button:slideshowFadeColor", r.rect);+ if r.changed() {+ let _ = app.run("slideshow.playback", json!({"fadeColor": c}));+ }+ }+ });+ let mut v = s.random_order;+ if check(ui, "settings.slideshowRandom", &mut v, "Random order") {+ let _ = app.run("slideshow.playback", json!({"randomOrder": v}));+ }+ let mut v = s.repeat;+ if check(ui, "settings.slideshowRepeat", &mut v, "Repeat (off: the slideshow ends after the last photo)") {+ let _ = app.run("slideshow.playback", json!({"repeat": v}));+ }+ let mut v = s.prepare_previews;+ if check(ui, "settings.slideshowPrepare", &mut v, "Prepare previews in advance") {+ let _ = app.run("slideshow.playback", json!({"preparePreviews": v}));+ }+ hint(+ ui,+ t,+ crate::i18n::tr(+ "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).",+ ),+ );+ hint(+ ui,+ t,+ crate::i18n::tr("Slideshow in the View menu plays the photos in view from the selected one. These settings are saved with the library."),+ );+}++ /// 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+ /// use is outlined. Applied on the next frame ([`LightcraftApp::sync_theme`]).+ fn appearance(ui: &mut egui::Ui, t: &Tokens, s: &mut crate::state::AppSettings, system: Option<egui::Theme>) {+ use crate::state::{AppearanceMode as M, DarkTheme, LightTheme};+ heading(ui, t, crate::i18n::tr("Appearance"));+ ui.label(RichText::new(crate::i18n::tr("Appearance Mode")).color(t.text_label));+ ui.horizontal_wrapped(|ui| {+ choices(ui, "settingsAppearance", &[(M::Auto, "Sync with System"), (M::Dark, "Dark Mode"), (M::Light, "Light Mode")], &mut s.appearance_mode);+ });+ ui.add_space(4.0);+ let light_active = s.theme(system) == s.light_theme.kind();+ let available = ui.available_width();+ 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);+ 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);+ };+ if available < 440.0 {+ ui.vertical(|ui| cards(ui, available));+ } else {+ ui.horizontal_top(|ui| cards(ui, ((available - 12.0) / 2.0).floor()));+ }+ ui.add_space(2.0);+ }++ /// 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<V: PartialEq + Copy>(+ ui: &mut egui::Ui,+ t: &Tokens,+ title: &str,+ active: bool,+ options: &[(V, crate::theme::ThemeKind)],+ value: &mut V,+ favorites: &mut Vec<String>,+ width: f32,+ ) {+ egui::Frame::new()+ .fill(t.inset)+ .stroke(egui::Stroke::new(1.0, if active { t.accent } else { t.field_border }))+ .corner_radius(6)+ .inner_margin(8)+ .show(ui, |ui| {+ ui.vertical(|ui| {+ let inner = (width - 18.0).clamp(120.0, 240.0);+ ui.set_width(inner);+ ui.horizontal(|ui| {+ ui.label(RichText::new(crate::i18n::tr(title)).font(t.semibold(12.0)).color(t.text));+ if active {+ ui.label(RichText::new(crate::i18n::tr("In Use")).size(11.0).color(t.accent));+ }+ });+ let shown = options.iter().find(|(v, _)| v == value).or(options.first()).map(|(_, k)| *k).unwrap_or_default();+ theme_preview(ui, shown, inner);+ for (v, kind) in options {+ let row = egui::Rect::from_min_size(ui.cursor().min, egui::vec2(ui.available_width(), 24.0));+ let hovered = ui.ctx().pointer_hover_pos().is_some_and(|p| row.contains(p));+ ui.horizontal(|ui| {+ let r = ui.radio_value(value, *v, crate::i18n::tr(kind.label()));+ register(ui.ctx(), format!("radio:theme-{}", kind.id()), r.rect);+ ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {+ let favorite = favorites.iter().any(|id| id == kind.id());+ let r = ui+ .add_visible(favorite || hovered, egui::Button::new("").min_size(egui::vec2(24.0, 24.0)).frame(false))+ .on_hover_text(crate::i18n::tr(if favorite { "Remove from favorites" } else { "Add to favorites" }));+ r.widget_info(|| {+ egui::WidgetInfo::labeled(+ egui::WidgetType::Button,+ true,+ format!(+ "{}: {}",+ crate::i18n::tr(if favorite { "Remove from favorites" } else { "Add to favorites" }),+ crate::i18n::tr(kind.label())+ ),+ )+ });+ register(ui.ctx(), format!("button:themeFavorite-{}", kind.id()), r.rect);+ if favorite || hovered {+ crate::icons::paint(+ ui.painter(),+ r.rect.shrink(4.0),+ if favorite { crate::icons::Icon::StarFilled } else { crate::icons::Icon::Star },+ if favorite { t.accent } else { t.text_dim },+ );+ }+ if r.clicked() {+ if favorite {+ favorites.retain(|id| id != kind.id());+ } else {+ favorites.push(kind.id().into());+ }+ }+ });+ });+ }+ });+ });+ }++ /// A small LightCraft window painted with `kind`'s tokens: the top bar with its search field, the+ /// photo with the filmstrip under it, the Edit panel (histogram and sliders), the tool strip and+ /// the bottom bar.+ fn theme_preview(ui: &mut egui::Ui, kind: crate::theme::ThemeKind, width: f32) {+ use egui::{Color32, Rect, Stroke, StrokeKind, pos2, vec2};+ let p = Tokens::for_kind(kind);+ let (rect, _) = ui.allocate_exact_size(vec2(width, (width * 0.56).round().min(130.0)), egui::Sense::hover());+ let painter = ui.painter_at(rect);+ let bar = |y: f32, x: f32, w: f32, c: Color32| painter.rect_filled(Rect::from_min_size(pos2(x, y), vec2(w, 2.0)), 1.0, c);+ painter.rect_filled(rect, 3.0, p.canvas);+ // top bar: sidebar and back icons, the centred search field, icons on the right+ let top = Rect::from_min_size(rect.min, vec2(rect.width(), 13.0));+ painter.rect_filled(top, 0.0, p.chrome);+ for x in [6.0, 14.0, 20.0] {+ painter.rect_filled(Rect::from_min_size(top.min + vec2(x, 4.5), vec2(4.0, 4.0)), 1.0, p.icon);+ }+ let search = Rect::from_center_size(top.center(), vec2(rect.width() * 0.34, 8.0));+ painter.rect(search, 2.0, p.field, Stroke::new(1.0, p.field_border), StrokeKind::Inside);+ bar(search.center().y - 1.0, search.center().x - 9.0, 18.0, p.text_dim);+ for i in 0..4 {+ painter.rect_filled(Rect::from_min_size(pos2(top.right() - 10.0 - i as f32 * 9.0, top.top() + 4.5), vec2(4.0, 4.0)), 2.0, p.icon);+ }+ // bottom bar: view buttons, rating stars, a button+ let bottom = Rect::from_min_max(pos2(rect.left(), rect.bottom() - 12.0), rect.max);+ painter.rect_filled(bottom, 0.0, p.chrome);+ for x in [6.0, 13.0, 20.0] {+ painter.rect_filled(Rect::from_min_size(bottom.min + vec2(x, 4.0), vec2(4.0, 4.0)), 1.0, p.icon);+ }+ let stars_x = bottom.center().x - 30.0;+ for i in 0..5 {+ painter.circle_filled(pos2(stars_x + i as f32 * 5.0, bottom.center().y), 1.4, p.star);+ }+ let copy = Rect::from_min_size(pos2(stars_x + 28.0, bottom.top() + 2.5), vec2(30.0, 7.0));+ painter.rect(copy, 3.0, p.button, Stroke::new(1.0, p.button_border), StrokeKind::Inside);+ // tool strip on the right edge, the first tool (Edit) active+ let strip = Rect::from_min_max(pos2(rect.right() - 12.0, top.bottom()), pos2(rect.right(), bottom.top()));+ painter.rect_filled(strip, 0.0, p.chrome);+ painter.line_segment([strip.left_top(), strip.left_bottom()], Stroke::new(1.0, p.divider));+ for i in 0..5 {+ let r = Rect::from_min_size(pos2(strip.left() + 3.0, strip.top() + 4.0 + i as f32 * 9.0), vec2(6.0, 6.0));+ if i == 0 {+ painter.rect_filled(r.expand(1.5), 1.5, p.tool_active);+ }+ painter.rect_stroke(r, 1.0, Stroke::new(1.0, if i == 0 { p.text } else { p.icon }), StrokeKind::Inside);+ }+ // Edit panel: histogram, then labelled sliders+ let panel = Rect::from_min_max(pos2(strip.left() - (rect.width() * 0.27).round(), top.bottom()), pos2(strip.left(), bottom.top()));+ painter.rect_filled(panel, 0.0, p.chrome);+ painter.line_segment([panel.left_top(), panel.left_bottom()], Stroke::new(1.0, p.divider));+ let hist = Rect::from_min_size(panel.min + vec2(4.0, 4.0), vec2(panel.width() - 8.0, 14.0));+ painter.rect_filled(hist, 1.0, p.inset);+ let curve = [0.2, 0.55, 0.9, 0.7, 0.5, 0.62, 0.4, 0.3, 0.18, 0.1];+ let mut pts = vec![hist.left_bottom()];+ for (i, h) in curve.iter().enumerate() {+ pts.push(pos2(hist.left() + hist.width() * i as f32 / (curve.len() - 1) as f32, hist.bottom() - hist.height() * h));+ }+ pts.push(hist.right_bottom());+ // the area under the curve, a column per stretch between two points+ for pair in pts.windows(2) {+ if let [a, b] = pair {+ let r = Rect::from_min_max(pos2(a.x, a.y.max(b.y)), pos2(b.x, hist.bottom()));+ painter.rect_filled(r, 0.0, p.track.gamma_multiply(0.5));+ }+ }+ painter.add(egui::Shape::line(pts, Stroke::new(1.0, p.text_dim)));+ let sliders = [0.55, 0.62, 0.35, 0.7, 0.6, 0.45];+ let mut y = hist.bottom() + 7.0;+ bar(y, panel.left() + 5.0, 14.0, p.text);+ y += 6.0;+ for v in sliders {+ if y + 7.0 > panel.bottom() {+ break;+ }+ bar(y, panel.left() + 5.0, 12.0, p.text_label);+ bar(y, panel.right() - 10.0, 5.0, p.text_dim);+ let track_y = y + 5.0;+ painter.line_segment([pos2(panel.left() + 5.0, track_y), pos2(panel.right() - 5.0, track_y)], Stroke::new(1.0, p.track));+ painter.circle_filled(pos2(panel.left() + 5.0 + (panel.width() - 10.0) * v, track_y), 1.8, p.thumb);+ y += 10.0;+ }+ // the photo (its own colours: a photo looks the same in every theme) above the filmstrip+ let film = Rect::from_min_max(pos2(rect.left(), bottom.top() - 18.0), pos2(panel.left(), bottom.top()));+ let stage = Rect::from_min_max(pos2(rect.left(), top.bottom()), pos2(panel.left(), film.top()));+ let photo = Rect::from_center_size(stage.center(), vec2(stage.width() * 0.62, stage.height() - 8.0));+ painter.rect_filled(photo, 0.0, Color32::from_rgb(0x6f, 0x8f, 0xb4));+ let horizon = photo.top() + photo.height() * 0.62;+ painter.add(egui::Shape::convex_polygon(+ vec![+ pos2(photo.left(), horizon),+ pos2(photo.left() + photo.width() * 0.3, photo.top() + photo.height() * 0.3),+ pos2(photo.left() + photo.width() * 0.55, horizon),+ ],+ Color32::from_rgb(0x4a, 0x55, 0x66),+ Stroke::NONE,+ ));+ painter.add(egui::Shape::convex_polygon(+ vec![+ pos2(photo.left() + photo.width() * 0.35, horizon),+ pos2(photo.left() + photo.width() * 0.68, photo.top() + photo.height() * 0.2),+ pos2(photo.right(), horizon),+ ],+ Color32::from_rgb(0x5a, 0x63, 0x72),+ Stroke::NONE,+ ));+ painter.rect_filled(Rect::from_min_max(pos2(photo.left(), horizon), photo.max), 0.0, Color32::from_rgb(0x3d, 0x5a, 0x3a));+ painter.line_segment([film.left_top(), film.right_top()], Stroke::new(1.0, p.divider));+ for i in 0..5 {+ let cell = Rect::from_min_size(pos2(film.left() + 4.0 + i as f32 * 17.0, film.top() + 3.0), vec2(15.0, 12.0));+ if cell.right() > film.right() - 2.0 {+ break;+ }+ let selected = i == 1;+ painter.rect_filled(cell, 0.0, if selected { p.cell_selected } else { p.cell });+ let thumb = cell.shrink(2.5);+ painter.rect_filled(thumb, 0.0, Color32::from_rgb(0x6f + 8 * i as u8, 0x80, 0x8f));+ if selected {+ painter.rect_stroke(thumb, 0.0, Stroke::new(1.0, p.pick), StrokeKind::Outside);+ }+ }+ }+// ------------------------------------------------------------------------------- Open Library…/// `app.openLibrary {path?}`: close the current library and open (or create) the one at `path`,diff --cc crates/ui-egui/src/render.rsindex 8346650c7,1dbdccddb..faf9a22c9--- a/crates/ui-egui/src/render.rs+++ b/crates/ui-egui/src/render.rs@@@ -316,7 -313,10 +319,18 @@@ impl Renderer/// Views that render straight into the display profile's primaries (wide gamut); everything/// else is rendered for sRGB and converted ([`lightcraft_engine::display::present`]).fn renders_for_display(slot: Slot) -> bool {- matches!(slot, Slot::Main | Slot::Region | Slot::Before | Slot::RegionBefore | Slot::Hover | Slot::Compare(_) | Slot::Second | Slot::Slide(_))+ matches!(+ slot,- Slot::Main | Slot::Region | Slot::Before | Slot::RegionBefore | Slot::Hover | Slot::Compare(_) | Slot::CompareRegion(_) | Slot::Second++ Slot::Main++ | Slot::Region++ | Slot::Before++ | Slot::RegionBefore++ | Slot::Hover++ | Slot::Compare(_)++ | Slot::CompareRegion(_)++ | Slot::Second++ | Slot::Slide(_)+ )}/// `job` as [`Self::request`] would run it for `slot` (its key included): views render fordiff --cc docs/parity-checklist.mdindex b4998e69b,cb0c48a8e..7c5004084--- a/docs/parity-checklist.md+++ b/docs/parity-checklist.md@@@ -49,13 -49,13 +49,13 @@@ cited here still exists. Formerly docs/| U. Map & location (MAP) | 0 | 1 | 1 | 0 | — | 0/1 (0%) || V. Preferences (PREF) | 6 | 2 | 2 | 2 | 1/1 (100%) | 4/5 (80%) || W. Cloud & AI infrastructure (CLOUD / AI) | 1 | 0 | 1 | 2 | — | — |- | X. Cross-cutting behaviours (BEHAV) | 18 | 6 | 1 | 1 | 8/8 (100%) | 6/9 (67%) |- | Y. Menus | 82 | 0 | 4 | 8 | 47/47 (100%) | 23/23 (100%) |- | Z. Keyboard shortcuts (desktop) | 75 | 3 | 3 | 1 | 49/52 (94%) | 23/24 (96%) |- | Lightroom Classic extras | 33 | 16 | 34 | 9 | — | 23/25 (92%) |- | **Total** | 397 | 50 | 72 | 36 | 192/200 (96%) | 143/155 (92%) |+ | X. Cross-cutting behaviours (BEHAV) | 23 | 6 | 1 | 1 | 8/8 (100%) | 7/10 (70%) |+ | Y. Menus | 84 | 0 | 4 | 8 | 47/47 (100%) | 23/23 (100%) |+ | Z. Keyboard shortcuts (desktop) | 76 | 3 | 3 | 1 | 49/52 (94%) | 23/24 (96%) |-| Lightroom Classic extras | 34 | 16 | 35 | 8 | — | 24/26 (92%) |-| **Total** | 407 | 50 | 73 | 35 | 192/200 (96%) | 145/157 (92%) |++| Lightroom Classic extras | 34 | 17 | 34 | 8 | — | 24/26 (92%) |++| **Total** | 407 | 51 | 72 | 35 | 192/200 (96%) | 145/157 (92%) |- Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **81.3%** of 519 in-scope rows — P0 98.0% of 200 · P1 95.2% of 155 · P2 47.5% of 163.-Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **81.5%** of 530 in-scope rows — P0 98.0% of 200 · P1 95.2% of 157 · P2 49.7% of 172.++Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **81.6%** of 530 in-scope rows — P0 98.0% of 200 · P1 95.2% of 157 · P2 50.0% of 172.<!-- /parity:summary -->## Top gaps and shortcut notes@@@ -128,13 -128,13 +128,13 @@@ differences and missing bindings are i| LR-VIEW-EDIT | Edit view | P0 | ✅ | `cmd:panel.edit` | || LR-VIEW-FULLSCREEN | Full-screen preview | P1 | ✅ | `cmd:view.fullScreenPreview`, `cmd:view.enterFullScreen` | photo on black, arrows step, Esc exits; ⇧⌘F window full screen || LR-VIEW-FILMSTRIP | Filmstrip | P0 | ✅ | `cmd:view.filmstrip`, `crates/ui-egui/src/panels/detail.rs` | the photo context menu on right-click; the mouse wheel scrolls it sideways; it follows the active photo only when that changes (centred if off screen), so a scrolled strip stays put; every selected photo is highlighted, the active one framed in white, as in the grid |- | LR-VIEW-ZOOM | Zoom & pan | P0 | 🟡 | `cmd:view.zoomFit`, `cmd:view.zoom100`, `cmd:view.zoomIn`, `cmd:view.zoomOut`, `cmd:view.zoomToggle`, `cmd:view.clickZoom`, `cmd:view.navigate`, `crates/ui-egui/src/panels/detail.rs`, `crates/ui-egui/src/headless.rs` | continuous native pinch / modifier-wheel zoom (Fit–800%, anchored under the pointer), two-finger scroll / touch pan with edge limits; Detail (including tools, Before/After and full-screen preview), Compare and Reference; fractional percentages preserve small gestures; image, picker and targeted-adjustment cursors stay steady between gesture events; keyboard steps 25–800 % (not 6–1600 %); Fill in the bottom bar; click / Z / Space eases to the chosen ratio (1:1 default, 2:1, 3:1, 4:1, 8:1). The loupe's cost follows the canvas, not the zoom (issue #323): the whole frame is rendered at about canvas size (at most the 2560 px preview source level unless a larger Preview size is chosen, and never above the GPU's texture side), and once the view is zoomed well past that (more than 25 %) the window on screen is rendered too, cut from a frame of at most the photo's own pixels, so beyond 100 % the GPU magnifies it (`region::plan`, `RenderRequest::window`, `Session::region_job`, `crates/ui-egui/src/region.rs`); 1:1 and 2:1–8:1 are sharp at any photo size. A slider tick takes 7–12 ms on a 1400 × 900 canvas and 11–25 ms on a 2800 × 1700 one at 100 % and 400 % of a 24 MP photo (M1 Max, GPU, `profile_slider_drag`); about 20–25 ms at 100 % on the big canvas is over a 16 ms frame. A continuous pinch holds the render sizes (and the windows there are) until it is quiet. A fit view on a canvas up to about 3200 px (a Retina Mac) never decodes the original; larger displays get a window at fit, which does. Modes that draw another picture over the loupe (mask overlays, soft proofing) and photos whose spots or Auto Mask strokes read too far for one window (only photos longer than 8192 px) render the whole frame at the size it is drawn, as before windows; while a preset or profile is hovered, or over a picture that is not the frame (an unsupported raw's embedded JPEG), the whole frame stays canvas-sized. Before/After (side by side, stacked, `\\` and both wipes) gets the same windows on both sides, clipped to their pane or side of the line. Windows render on the GPU like whole frames (equivalence-tested against the CPU), in the browser build too (windows no wider than its GPU's texture side, at most 3072 px), and are not made while hovering a look, soft-proofing or showing an overlay, nor over a picture that is not the frame (an unsupported raw's embedded JPEG with another crop). No texture is larger than the GPU allows. Spots and Auto Mask brushes work while what a window reads fits one render (8192 px along an axis, 4096 in the browser): the window grows to hold the spot and its source patch, or the dabs near it, and if that would take more (a clone from far away at 8:1) the loupe keeps the whole-frame render instead, and spots with an automatic source pick it from a fixed-size render of the whole frame (so a window's choice can differ from a whole-frame render's, which picks at its own resolution). The wide stages (dehaze, clarity, highlights/shadows base) and Refine Edges on masks read a window margin capped at 768 px; measured on hard-edged blocks that costs at most a few levels at 8:1. the histogram and Navigator come from the whole-frame render |+ | LR-VIEW-ZOOM | Zoom & pan | P0 | 🟡 | `cmd:view.zoomFit`, `cmd:view.zoom100`, `cmd:view.zoomIn`, `cmd:view.zoomOut`, `cmd:view.zoomToggle`, `cmd:view.clickZoom`, `cmd:view.navigate`, `crates/ui-egui/src/panels/detail.rs`, `crates/ui-egui/src/headless.rs` | continuous native pinch / modifier-wheel zoom (Fit–800%, anchored under the pointer), two-finger scroll / touch pan with edge limits; Detail (including tools, Before/After and full-screen preview), Compare and Reference; fractional percentages preserve small gestures; image, picker and targeted-adjustment cursors stay steady between gesture events; keyboard steps 25–800 % (not 6–1600 %); Fill in the bottom bar; click / Z / Space eases to the chosen ratio (1:1 default, 2:1, 3:1, 4:1, 8:1). The loupe's cost follows the canvas, not the zoom (issue #323): the whole frame is rendered at about canvas size (at most the 2560 px preview source level unless a larger Preview size is chosen, and never above the GPU's texture side), and once the view is zoomed well past that (more than 25 %) the window on screen is rendered too, cut from a frame of at most the photo's own pixels, so beyond 100 % the GPU magnifies it (`region::plan`, `RenderRequest::window`, `Session::region_job`, `crates/ui-egui/src/region.rs`); 1:1 and 2:1–8:1 are sharp at any photo size. A slider tick takes 7–12 ms on a 1400 × 900 canvas and 11–25 ms on a 2800 × 1700 one at 100 % and 400 % of a 24 MP photo (M1 Max, GPU, `profile_slider_drag`); about 20–25 ms at 100 % on the big canvas is over a 16 ms frame. A continuous pinch holds the render sizes (and the windows there are) until it is quiet. A fit view on a canvas up to about 3200 px (a Retina Mac) never decodes the original; larger displays get a window at fit, which does. Modes that draw another picture over the loupe (mask overlays, soft proofing) and photos whose spots or Auto Mask strokes read too far for one window (only photos longer than 8192 px) render the whole frame at the size it is drawn, as before windows; while a preset or profile is hovered, or over a picture that is not the frame (an unsupported raw's embedded JPEG), the whole frame stays canvas-sized. Before/After (side by side, stacked, `\\` and both wipes) gets the same windows on both sides, clipped to their pane or side of the line. Windows render on the GPU like whole frames (equivalence-tested against the CPU), in the browser build too (windows no wider than its GPU's texture side, at most 3072 px), and are not made while hovering a look, soft-proofing or showing an overlay, nor over a picture that is not the frame (an unsupported raw's embedded JPEG with another crop). No texture is larger than the GPU allows. Spots and Auto Mask brushes work while what a window reads fits one render (8192 px along an axis, 4096 in the browser): the window grows to hold the spot and its source patch, or the dabs near it, and if that would take more (a clone from far away at 8:1) the loupe keeps the whole-frame render instead, and spots with an automatic source pick it from a fixed-size render of the whole frame (so a window's choice can differ from a whole-frame render's, which picks at its own resolution). The wide stages (dehaze, clarity, highlights/shadows base) and Refine Edges on masks read a window margin capped at 768 px; measured on hard-edged blocks that costs at most a few levels at 8:1. the histogram and Navigator come from the whole-frame render. Compare and Reference get the same windows, one per pane (`Slot::CompareRegion`, `panels/compare.rs`), over each pane's whole-frame render (at most 2560 px); while either view is open two originals stay decoded (`MediaCache::set_full_capacity`), so one pane's window does not evict the other's source; a pinch, or a slider drag on the active photo in Reference, keeps the windows there are until it ends. Still 🟡: mask overlays and soft proofing have no window (a full-size whole-frame render at 1:1) || 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 |- | 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; no zoom-link toggle |+ | 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; 1:1 to 8:1 sharp on both sides (zoom windows, see LR-VIEW-ZOOM); no zoom-link toggle || 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-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-SLIDESHOW | Slideshow | P2 | ✅ | `cmd:view.slideshow` | View ▸ Slideshow (⌥⌘↩): the photos in view full screen, every 4 s (`interval`), wrapping; Space pauses, ←/→ step, Esc ends |+| 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` | || LR-VIEW-HISTOGRAM | Histogram | P0 | ✅ | `cmd:view.histogram`, `crates/ui-egui/src/panels/edit.rs` | no drag-to-adjust on the histogram |diff --cc docs/whats-new.mdindex 452b7ef7c,f96328396..3a3ee74ce--- a/docs/whats-new.md+++ b/docs/whats-new.md@@@ -1,17 -1,92 +1,102 @@@# What's new in LightCraft- ## 2026-10-10+ ## 2026-10-11++ ### Open Library knows a Lightroom catalog+ - Choosing a Lightroom Classic catalog folder in File → Open Library… (or one of its `Previews.lrdata` /+ `.lrcat-data` folders, or the `.lrcat`) no longer makes an empty LightCraft library inside it (issue #891). The+ library open now stays, and LightCraft says "This is a Lightroom catalog, not a LightCraft library" and offers+ **Import Lightroom Catalog…** with that catalog, or Cancel. `lightcraft-cli --library` refuses those folders too.++ ### Canon EOS R5 Mark II+ - Canon EOS R5 Mark II C-RAW files that opened as "preview only" (more than half of them, depending on the+ scene) now develop from their sensor data with every editing tool, like the camera's other raws. Photos+ imported earlier switch over with Photo ▸ Reload from Disk.++ ### Switching libraries+ - File ▸ New Library… asks for a name, then where to put it, and opens the new library (issue #902).+ - File ▸ Open Recent Library lists the last 8 libraries; ones that are gone (moved, drive disconnected) are greyed+ out. Clear Recent Libraries empties the list.+ - The open library's name shows under My Photos at the top of the left panel and in the window title.+ - `lightcraft-cli --library` given a library's own file (`catalog.snap`) opens its folder instead of failing with+ "File exists".+ - Agents use `app.newLibrary {path, name}`, `app.recentLibraries` and `app.clearRecentLibraries`.++ ### Edit in PhotoCraft+ - Right-click a photo ▸ Edit In ▸ Edit in PhotoCraft (or Photo ▸ Edit In, ⇧⌘E) renders a copy with your edits, stacks it+ with the original and opens it in PhotoCraft. LightCraft finds PhotoCraft where its installer put it (Windows,+ macOS, Linux packages, AppImage, Flatpak), and says so if it isn't installed, before making a copy.+ - The copy is a 16-bit PSD by default, which PhotoCraft saves straight back to with File ▸ Save; when you come back to+ LightCraft the copy shows what you saved.+ - Settings ▸ General ▸ External Editing: the format (PSD or TIFF), colour space and bit depth for PhotoCraft and for+ the other editor (Edit in Other Editor, now ⌥⌘E), and where PhotoCraft is if you use a portable copy.+ - Export can write PSD too (flat, 8- or 16-bit).+### Slideshow playback+- View ▸ Slideshow (⌥⌘↩) now plays with Lightroom Classic's Playback settings: how long each slide stays up, a fade+ between slides (a crossfade, or through black, white or any colour; 0 cuts), random order (every photo once per+ pass, a new order each time round), repeat (off: the slideshow ends after the last photo) and preparing previews in+ advance (the next two slides render while the current one is up, so a fade never waits or flashes).+- Change them in Settings ▸ Slideshow (View ▸ Slideshow Options…); they are saved with the library. Agents use+ `slideshow.playback`; `view.slideshow` takes any of them for one run (`interval` still sets the slide duration).+- While it plays, moving the pointer shows a small control bar: previous, play / pause, next, the slide number and+ end. Space pauses, ← / → step (a cut), Esc ends. A slide's time starts once it is shown sharp.++ ## 2026-10-10++ ### Dialogs fit the window+ - A dialog taller than the window no longer runs off it (issue #781): on a 1366×768 screen the Export dialog's title+ and its Cancel / OK buttons were off screen, so it couldn't be confirmed. Now its options scroll and the title and+ buttons stay visible. Long lists in dialogs (What's New, All Metadata, Keyboard Shortcuts) get shorter to fit.+ Dialogs that fit look as before.++ ### Previews match exports on Mac screens+ - On macOS, photos are shown through the profile of the screen the window is on while no monitor profile is chosen in+ Settings ▸ Display (issue #787). On P3 screens previews used to look more saturated than the exported files in+ Preview or Photos. Moving the window to another screen is followed; **Use Screen Profile** goes back to it after+ choosing a profile file.++ ### Sidebar sections+ - Arrange the left sidebar your way: drag Albums, Local, By Date, Folders or Keywords by its header to move it (a line+ shows where it will go), or right-click a header for Move Up / Move Down.+ - Hide the sections you don't use: View ▸ Sidebar Sections, or right-click a header ▸ Hide This Section. Right-click+ the My Photos title to bring one back, or choose Reset Sidebar Sections. The arrangement is remembered.+ - In a long section, the header stays at the top of the sidebar while you scroll through its rows, so you always see+ which section you are in and can fold it from there.+ - Sections are easier to tell apart: a hairline between them, the fold chevron in the same column as the rows'+ triangles, a highlight under the pointer. A folded section shows how many rows it holds, counts of 0 are fainter,+ and a section with nothing in it says so instead of disappearing.+ - Recently Deleted is listed with All Photos, Recently Added and Picks under My Photos.+ - Keywords has a + in its header, like Albums: Create Keyword Tag without opening the Keyword List.+ - Agents: `view.sidebarSection`, `view.sidebarMoveSection`, `view.sidebarReset`; `ui.set` takes `sidebar`.++ ### Kelvin white balance for raws whose camera has colour matrices+ - Raws from the 52 camera models whose colour matrices LightCraft has measured (Sony ILCE-7M3, ILCE-7M4, ILCE-7RM3,+ Nikon D850, Canon EOS 5D Mark III and others) now show white balance in Kelvin, as a DNG does and as Lightroom+ does: As Shot reads the file's white (an ILCE-7M3 sample: 4268 K / +7), the Temp slider runs 2000–50000 K and the+ Daylight, Cloudy, Shade, Tungsten, Fluorescent and Flash presets set real temperatures (issue #730). The matrices+ only convert between the camera's multipliers and Kelvin; the colour look is what it was.+ - Nothing already edited changes: a Custom white balance set on the old relative scale renders pixel for pixel as+ before, and becomes the Kelvin value with the same look the next time it is edited. A photo imported earlier shows+ its real As Shot temperature once the file is opened (or Reload reads it).+ - Lightroom's `crs:Temperature` for these raws is read as the Kelvin it is (sidecars, Lightroom catalogs, presets);+ raws of other cameras keep the as-shot shift of issue #510. The two Kelvin scales come from different matrices and+ differ by about 7–10 % on the ILCE-7M3; which one is off is still open.++ ### Fujifilm lens corrections+ - Fujifilm RAFs from 59 camera models now get the lens correction the camera stores in the file: distortion (with the+ camera's own zoom to fill the frame) and vignetting, as with Panasonic and Sony files. The Optics profile controls+ adjust or switch them off, and DNG export keeps them. Lateral chromatic aberration data is not applied: our+ demosaic already lines the colour planes up. Details and measurements: `docs/fuji-lens-corrections.md`.++ ### Appearance+ - Settings ▸ Interface ▸ Appearance Mode: Sync with System, Dark Mode or Light Mode, above a light+ and a dark theme card, each previewing its theme (dark: Charcoal, the look so far, or Midnight;+ light: Silver or Paper). New and existing installs stay dark; following the system is opt-in.+ - The top bar's appearance button cycles Auto, Light, Dark (a monitor, sun or moon), and View ▸+ Appearance lists the modes and themes. On Linux, Auto follows the desktop portal's colour scheme+ as it changes, without polling.+### Activity stack- Long-running tasks show in one place, top left under the top bar, as in Lightroom Classic (issue #345): imports andfolder scans, exports (and the contact sheet PDF), Synchronize Folder, Build / Smart Previews, Lightroom catalog import, Photo Merge, model downloads, the face scan,