Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

Merge PR #1965: LRC-DEV-VIEWOPTIONS: View Options (Cmd+J) chooses the lines of the loupe's Info 1 and Info 2

aiongga4335731aa9a
diff --cc crates/ui-egui/locales/it.json
index 14a31cef8,f74a4b7ba..455adb064
--- a/crates/ui-egui/locales/it.json
+++ b/crates/ui-egui/locales/it.json
@@@ -2262,77 -1991,14 +2262,87 @@@
"This build cannot run recognition models: they can be added and chosen, not used.": "Questa versione non può eseguire modelli di riconoscimento: si possono aggiungere e scegliere, non usare.",
"This build has nowhere to keep face models, so the model list is not available. (The desktop app has.)": "Questa versione non ha dove tenere i modelli dei volti, quindi l'elenco dei modelli non è disponibile. (L'app desktop ce l'ha.)",
"Unnamed Faces": "Volti senza nome",
+ "smart album value|No": "No",
+ "smart album value|Yes": "Sì",
+ "Add Print Cell": "Aggiungi cella di stampa",
+ "Apply Mask Effect": "Applica effetto maschera",
+ "Apply Print Template": "Applica modello di stampa",
+ "Apply Slideshow Template": "Applica modello di presentazione",
+ "Arrange Print Cell": "Disponi cella di stampa",
+ "Auto Layout": "Layout automatico",
+ "Choose Layout Image…": "Scegli immagine di layout…",
+ "Clear Print Layout": "Cancella layout di stampa",
+ "Cycle Flag": "Alterna bandiera",
+ "Cycle Tool Overlay": "Alterna sovrapposizione strumento",
+ "Decrease Flag Status": "Riduci stato bandiera",
+ "Decrease Grid Thumbnail Size": "Riduci dimensione miniature griglia",
+ "Delete Mask Effect": "Elimina effetto maschera",
+ "Delete Print Cell": "Elimina cella di stampa",
+ "Delete Print Template": "Elimina modello di stampa",
+ "Delete Slideshow Template": "Elimina modello di presentazione",
+ "Duplicate Mask Effect": "Duplica effetto maschera",
+ "End Slideshow": "Termina presentazione",
+ "Export Effect Presets…": "Esporta preset effetti…",
+ "Export Mask Effects": "Esporta effetti maschera",
+ "Face Models on the GPU": "Modelli dei volti sulla GPU",
+ "Favorite Mask Effect": "Effetto maschera preferito",
+ "Import Mask Effects": "Importa effetti maschera",
+ "Import Slideshow Template": "Importa modello di presentazione",
+ "Increase Flag Status": "Aumenta stato bandiera",
+ "Increase Grid Thumbnail Size": "Aumenta dimensione miniature griglia",
+ "Layout Image Matte": "Passe-partout immagine di layout",
+ "Layout Image Opacity": "Opacità immagine di layout",
+ "Manage Effect Presets…": "Gestisci preset effetti…",
+ "Mask Effect Presets": "Preset effetti maschera",
+ "Move Mask Effect to Group": "Sposta effetto maschera nel gruppo",
+ "Move Print Cell": "Sposta cella di stampa",
+ "Move Print Cell to Page": "Sposta cella di stampa nella pagina",
+ "New Print Page": "Nuova pagina di stampa",
+ "Next Slide": "Diapositiva successiva",
+ "Pause / Resume Slideshow": "Pausa / riprendi presentazione",
+ "Previous Slide": "Diapositiva precedente",
+ "Print Settings": "Impostazioni di stampa",
+ "Print Templates": "Modelli di stampa",
+ "Print to PDF": "Stampa su PDF",
+ "Read Focus Points in the Background": "Leggi punti di messa a fuoco in background",
+ "Recheck Preview-Only Raws": "Ricontrolla i raw con sola anteprima",
+ "Rename Mask Effect": "Rinomina effetto maschera",
+ "Rename Mask Effect Group": "Rinomina gruppo di effetti maschera",
+ "Rename Person": "Rinomina persona",
+ "Rename Slideshow Template": "Rinomina modello di presentazione",
+ "Reset Print Settings": "Ripristina impostazioni di stampa",
+ "Resize Print Cell": "Ridimensiona cella di stampa",
+ "Save Current Settings as New Effect Preset…": "Salva le impostazioni attuali come nuovo preset effetto…",
+ "Save Mask Effect": "Salva effetto maschera",
+ "Save Print Template": "Salva modello di stampa",
+ "Save Slideshow Template": "Salva modello di presentazione",
+ "Set Effect for New Masks": "Imposta effetto per le nuove maschere",
+ "Set Print Cell Photo": "Imposta foto della cella di stampa",
+ "Set Print Settings": "Imposta impostazioni di stampa",
+ "Show Layout Image": "Mostra immagine di layout",
+ "Slideshow Export Status": "Stato esportazione presentazione",
+ "Slideshow Layout Settings": "Impostazioni layout presentazione",
+ "Slideshow Options…": "Opzioni presentazione…",
+ "Slideshow Overlay Settings": "Impostazioni sovrapposizioni presentazione",
+ "Slideshow Playback Settings": "Impostazioni riproduzione presentazione",
+ "Slideshow Slide Preview": "Anteprima diapositiva della presentazione",
+ "Slideshow Title Settings": "Impostazioni titoli presentazione",
+ "Update Mask Effect": "Aggiorna effetto maschera",
+ "Update Slideshow Template": "Aggiorna modello di presentazione",
+ "Write Waiting XMP Sidecars": "Scrivi i file XMP in attesa",
+ "Color Overlay": "Sovrapposizione colore",
+ "Color Overlay on B&W": "Sovrapposizione colore su B/N",
+ "Image on Black": "Immagine su nero",
+ "Image on White": "Immagine su bianco",
- "White on Black": "Bianco su nero"
++ "White on Black": "Bianco su nero",
+ "View Options…": "Opzioni di visualizzazione…",
+ "View Options": "Opzioni di visualizzazione",
+ "Loupe View": "Vista lente",
+ "Show Info Overlay": "Mostra sovrapposizione informazioni",
+ "Loupe Info 1": "Info lente 1",
+ "Loupe Info 2": "Info lente 2",
+ "Use Defaults": "Usa predefiniti",
+ "Dimensions": "Dimensioni",
+ "Camera & Lens": "Fotocamera e obiettivo",
+ "View → View Options chooses the lines Info 1 and Info 2 show.": "Visualizza → Opzioni di visualizzazione sceglie le righe di Info 1 e Info 2."
}
diff --cc crates/ui-egui/src/panels/detail.rs
index dcda57484,32a6b74e5..8618cf2f6
--- a/crates/ui-egui/src/panels/detail.rs
+++ b/crates/ui-egui/src/panels/detail.rs
@@@ -969,28 -910,26 +969,28 @@@ pub fn show(app: &mut LightcraftApp, ui
});
}
+/// The dark pill behind a label drawn over the photo (`Before`, a hovered preset's name): at the
+/// photo's top left, inset 8 points, with the `text` size plus padding. Zoomed in, the photo
+/// reaches past its `pane` (the canvas): the pill then sits at the pane's top left, so the label
+/// stays in view (issue #2267: at 100 % it left the screen with the photo's corner), below the
+/// `top_inset` the filter pill takes in that corner, and never past the pane's right edge.
+fn label_badge_rect(photo: Rect, pane: Rect, text: egui::Vec2, top_inset: f32) -> Rect {
+ let size = text + vec2(16.0, 8.0);
+ let left = photo.left().max(pane.left()).min(pane.right() - size.x - 16.0).max(pane.left());
+ let corner = pos2(left, photo.top().max(pane.top() + top_inset));
+ Rect::from_min_size(corner + vec2(8.0, 8.0), size)
+}
+
- /// The info overlay at the canvas' top left (`view.infoOverlay`): file name with the capture date
- /// and size, or with the camera and exposure.
+ /// The info overlay at the canvas' top left (`view.infoOverlay`): the lines View Options chose for
+ /// Info 1 or Info 2 (`view.viewOptions`).
fn info_overlay(app: &LightcraftApp, p: &egui::Painter, canvas: Rect, photo: &lightcraft_catalog::Photo) {
- use crate::state::InfoOverlay;
- let fields = match app.ui.info_overlay {
- InfoOverlay::Off => return,
- InfoOverlay::Basic => &app.ui.settings.loupe_info.info1,
- InfoOverlay::Exposure => &app.ui.settings.loupe_info.info2,
- };
- let lines: Vec<String> = fields.iter().filter_map(|f| info_line(*f, photo)).collect();
- if lines.is_empty() {
- return;
- }
+ let Some(lines) = info_overlay_lines(app, photo) else { return };
let t = Tokens::get(p.ctx());
- let mut y = canvas.top() + 12.0;
+ let mut y = canvas.top() + INFO_OVERLAY_TOP;
for (i, l) in lines.iter().enumerate() {
- let font = if i == 0 { t.semibold(15.0) } else { t.font(12.5) };
// laid out uncoloured: `galley` only fills placeholder text with its colour, so a white
// layout made the shadow a second white copy (#1690)
- let g = p.layout_no_wrap(l.clone(), font, Color32::PLACEHOLDER);
+ let g = p.layout_no_wrap(l.clone(), info_overlay_font(&t, i), Color32::PLACEHOLDER);
let at = pos2(canvas.left() + 14.0, y);
// a soft shadow keeps the text readable on bright photos
p.galley(at + vec2(1.0, 1.0), g.clone(), Color32::from_black_alpha(200));
@@@ -1000,61 -939,6 +1000,40 @@@
register(p.ctx(), "canvas:infoOverlay", Rect::from_min_max(canvas.min, pos2(canvas.left() + 320.0, y)));
}
+/// Where the info overlay's text starts below the canvas' top, and the gap after each line.
+const INFO_OVERLAY_TOP: f32 = 12.0;
+const INFO_OVERLAY_GAP: f32 = 3.0;
+
+/// The info overlay's font for line `i` (the file name is the first, larger line).
+fn info_overlay_font(t: &Tokens, i: usize) -> egui::FontId {
+ if i == 0 { t.semibold(15.0) } else { t.font(12.5) }
+}
+
+/// How far below the canvas' top the info overlay's text reaches (0 when it is off), so a label
+/// drawn in that corner can sit below it.
+fn info_overlay_extent(app: &LightcraftApp, p: &egui::Painter, photo: &lightcraft_catalog::Photo) -> f32 {
+ let Some(lines) = info_overlay_lines(app, photo) else { return 0.0 };
+ let t = Tokens::get(p.ctx());
+ lines.iter().enumerate().fold(INFO_OVERLAY_TOP, |y, (i, l)| {
+ y + p.layout_no_wrap(l.clone(), info_overlay_font(&t, i), Color32::PLACEHOLDER).size().y + INFO_OVERLAY_GAP
+ })
+}
+
+/// The info overlay's lines for `photo`, or `None` when it is off.
+fn info_overlay_lines(app: &LightcraftApp, photo: &lightcraft_catalog::Photo) -> Option<Vec<String>> {
+ use crate::state::InfoOverlay;
- let lines: Vec<String> = match app.ui.info_overlay {
++ let fields = match app.ui.info_overlay {
+ InfoOverlay::Off => return None,
- InfoOverlay::Basic => {
- let date = photo.captured.as_deref().unwrap_or(&photo.imported);
- vec![photo.file_name.clone(), format!("{} · {} × {}", pretty_date(date), photo.width, photo.height)]
- }
- InfoOverlay::Exposure => {
- let m = &photo.meta;
- let mut exp = Vec::new();
- if !m.shutter.is_empty() {
- exp.push(format!("{} s", m.shutter));
- }
- if let Some(a) = m.aperture {
- exp.push(format!("f/{a:.1}"));
- }
- if let Some(i) = m.iso {
- exp.push(format!("ISO {i}"));
- }
- if let Some(f) = m.focal_mm {
- exp.push(format!("{f:.0} mm"));
- }
- let camera = [m.camera.as_str(), m.lens.as_str()].iter().filter(|s| !s.is_empty()).copied().collect::<Vec<_>>().join(" · ");
- let mut v = vec![photo.file_name.clone()];
- v.push(if exp.is_empty() { "No exposure information".into() } else { exp.join(" ") });
- if !camera.is_empty() {
- v.push(camera);
- }
- v
- }
++ InfoOverlay::Basic => &app.ui.settings.loupe_info.info1,
++ InfoOverlay::Exposure => &app.ui.settings.loupe_info.info2,
+ };
++ let lines: Vec<String> = fields.iter().filter_map(|f| info_line(*f, photo)).collect();
++ if lines.is_empty() {
++ return None;
++ }
+ Some(lines)
+}
+
/// What the user did to a face box this frame.
enum RegionEdit {
/// The × was clicked.
diff --cc crates/ui-egui/src/panels/dialogs.rs
index f56ec71f9,f31d4b1c5..bb15b5be2
--- a/crates/ui-egui/src/panels/dialogs.rs
+++ b/crates/ui-egui/src/panels/dialogs.rs
@@@ -2317,5 -2319,6 +2321,6 @@@ fn only_shows(dlg: &Dialog) -> bool
| Dialog::AllMetadata { .. }
| Dialog::WhatsNew
| Dialog::ManageEffects { .. }
+ | Dialog::ViewOptions
- )
+ ) || matches!(dlg, Dialog::SynchronizeFolder { counts: Some(c), .. } if c.up_to_date())
}