LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust
Edit panel: the Reset tooltip shows the platform's shortcut, Ctrl+Shift+R on Windows and Linux (fixes #1751)
Marco Arnulfo8a218bddc143
diff --git a/crates/ui-egui/locales/de.json b/crates/ui-egui/locales/de.jsonindex 25c411ce0..7e2e7e4ba 100644--- a/crates/ui-egui/locales/de.json+++ b/crates/ui-egui/locales/de.json@@ -1241,7 +1241,7 @@"Reset Section": "Bereich zurücksetzen","Reset Tone Curve": "Gradationskurve zurücksetzen","Reset all curves: point curves (all channels) and parametric (double-click a channel to reset only that one)": "Alle Kurven zurücksetzen: Punktkurven (alle Kanäle) und parametrische Kurve (Doppelklick auf einen Kanal setzt nur diesen zurück)",- "Reset all edits (Cmd+Shift+R)": "Alle Bearbeitungen zurücksetzen (⌘⇧R)",+ "Reset all edits": "Alle Bearbeitungen zurücksetzen","Reshuffle": "Neu mischen","Resize Face Box": "Gesichtsrahmengröße ändern","Resize panel window": "Größe des Bereichsfensters ändern",diff --git a/crates/ui-egui/locales/es.json b/crates/ui-egui/locales/es.jsonindex ba3e1e331..6bb8663da 100644--- a/crates/ui-egui/locales/es.json+++ b/crates/ui-egui/locales/es.json@@ -1212,7 +1212,7 @@"Reset Section": "Restablecer sección","Reset Tone Curve": "Restablecer curva de tonos","Reset all curves: point curves (all channels) and parametric (double-click a channel to reset only that one)": "Restablecer todas las curvas: curvas de puntos (todos los canales) y paramétrica (doble clic en un canal para restablecer solo ese)",- "Reset all edits (Cmd+Shift+R)": "Restablecer todas las ediciones (Cmd+Mayús+R)",+ "Reset all edits": "Restablecer todas las ediciones","Reshuffle": "Volver a mezclar","Resize Face Box": "Cambiar tamaño del recuadro de cara","Resize panel window": "Cambiar tamaño de la ventana del panel",diff --git a/crates/ui-egui/locales/fr.json b/crates/ui-egui/locales/fr.jsonindex b0becb154..5aeaa2638 100644--- a/crates/ui-egui/locales/fr.json+++ b/crates/ui-egui/locales/fr.json@@ -1181,7 +1181,7 @@"Reset Section": "Réinitialiser la section","Reset Tone Curve": "Réinitialiser la courbe des tonalités","Reset all curves: point curves (all channels) and parametric (double-click a channel to reset only that one)": "Réinitialiser toutes les courbes : courbes de points (tous les canaux) et paramétrique (double-cliquez sur un canal pour réinitialiser uniquement celui-ci)",- "Reset all edits (Cmd+Shift+R)": "Réinitialiser toutes les retouches (Cmd+Maj+R)",+ "Reset all edits": "Réinitialiser toutes les retouches","Reshuffle": "Mélanger à nouveau","Resize Face Box": "Redimensionner le cadre de visage","Resize to": "Redimensionner à",diff --git a/crates/ui-egui/locales/ja.json b/crates/ui-egui/locales/ja.jsonindex 7a282e676..19abaf56c 100644--- a/crates/ui-egui/locales/ja.json+++ b/crates/ui-egui/locales/ja.json@@ -1132,7 +1132,7 @@"Reset Section": "項目をリセット","Reset Tone Curve": "トーンカーブをリセット","Reset all curves: point curves (all channels) and parametric (double-click a channel to reset only that one)": "すべてのポイントカーブとパラメトリックカーブをリセット(チャンネルのダブルクリックで個別にリセット)",- "Reset all edits (Cmd+Shift+R)": "すべての編集をリセット(⌘⇧R)",+ "Reset all edits": "すべての編集をリセット","Resize Face Box": "顔の枠のサイズを変更","Resize panel window": "パネルウィンドウのサイズを変更","Resize panels": "パネルのサイズを変更",diff --git a/crates/ui-egui/locales/pt-br.json b/crates/ui-egui/locales/pt-br.jsonindex f8e4753e5..4dc58a297 100644--- a/crates/ui-egui/locales/pt-br.json+++ b/crates/ui-egui/locales/pt-br.json@@ -1202,7 +1202,7 @@"Reset Section": "Redefinir seção","Reset Tone Curve": "Redefinir curva de tonalidade","Reset all curves: point curves (all channels) and parametric (double-click a channel to reset only that one)": "Redefine todas as curvas: curvas de pontos (todos os canais) e paramétrica (clique duas vezes em um canal para redefinir apenas ele)",- "Reset all edits (Cmd+Shift+R)": "Redefinir todas as edições (Cmd+Shift+R)",+ "Reset all edits": "Redefinir todas as edições","Reshuffle": "Embaralhar de novo","Resize Face Box": "Redimensionar caixa de rosto","Resize panel window": "Redimensionar janela do painel",diff --git a/crates/ui-egui/locales/ru.json b/crates/ui-egui/locales/ru.jsonindex c840218a0..8dd6a9d2f 100644--- a/crates/ui-egui/locales/ru.json+++ b/crates/ui-egui/locales/ru.json@@ -994,7 +994,7 @@"Reset Section": "Сбросить раздел","Reset Tone Curve": "Сбросить тоновую кривую","Reset all curves: point curves (all channels) and parametric (double-click a channel to reset only that one)": "Сбросить все кривые: точечные (все каналы) и параметрическую (двойной щелчок по каналу сбрасывает только его)",- "Reset all edits (Cmd+Shift+R)": "Сбросить все правки (Cmd+Shift+R)",+ "Reset all edits": "Сбросить все правки","Reshuffle": "Перемешать","Resize panel window": "Изменить размер окна панели","Resize panels": "Изменить размеры панелей",diff --git a/crates/ui-egui/locales/uk.json b/crates/ui-egui/locales/uk.jsonindex 85a838098..f1880f3fe 100644--- a/crates/ui-egui/locales/uk.json+++ b/crates/ui-egui/locales/uk.json@@ -1228,7 +1228,7 @@"Reset Parametric Curve": "Скинути параметричну криву","Reset Tone Curve": "Скинути тональну криву","Reset all curves: point curves (all channels) and parametric (double-click a channel to reset only that one)": "Скинути всі криві: точкові криві (усі канали) і параметричну (подвійне клацання каналу скидає лише його)",- "Reset all edits (Cmd+Shift+R)": "Скинути всі зміни (Cmd+Shift+R)",+ "Reset all edits": "Скинути всі зміни","Resize Face Box": "Змінити розмір рамки обличчя","Resize to": "Змінити розмір до","Resolution (ppi)": "Роздільність (ppi)",diff --git a/crates/ui-egui/locales/zh-hans.json b/crates/ui-egui/locales/zh-hans.jsonindex ad379f1ef..201fc678c 100644--- a/crates/ui-egui/locales/zh-hans.json+++ b/crates/ui-egui/locales/zh-hans.json@@ -1188,7 +1188,7 @@"Reset Section": "重置此区段","Reset Tone Curve": "重置色调曲线","Reset all curves: point curves (all channels) and parametric (double-click a channel to reset only that one)": "重置所有曲线:点曲线(所有通道)和参数曲线(双击某个通道可单独重置该通道)",- "Reset all edits (Cmd+Shift+R)": "重置所有编辑 (Cmd+Shift+R)",+ "Reset all edits": "重置所有编辑","Resize Face Box": "调整人脸框大小","Resize panel window": "调整面板窗口大小","Resize panels": "调整面板大小",diff --git a/crates/ui-egui/locales/zh-hant.json b/crates/ui-egui/locales/zh-hant.jsonindex 647d153d0..33b1a9428 100644--- a/crates/ui-egui/locales/zh-hant.json+++ b/crates/ui-egui/locales/zh-hant.json@@ -1188,7 +1188,7 @@"Reset Section": "重設區段","Reset Tone Curve": "重設色調曲線","Reset all curves: point curves (all channels) and parametric (double-click a channel to reset only that one)": "重設所有點曲線通道與參數曲線(按兩下通道可只重設該通道)",- "Reset all edits (Cmd+Shift+R)": "重設所有編輯(Cmd+Shift+R)",+ "Reset all edits": "重設所有編輯","Resize Face Box": "調整臉部框大小","Resize panel window": "調整面板視窗大小","Resize panels": "調整面板大小",diff --git a/crates/ui-egui/src/panels/edit.rs b/crates/ui-egui/src/panels/edit.rsindex 533354b6c..67fd96021 100644--- a/crates/ui-egui/src/panels/edit.rs+++ b/crates/ui-egui/src/panels/edit.rs@@ -125,7 +125,9 @@ pub fn show(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {let _ = app.run("develop.hdr", json!({"enabled": !d.hdr.enabled}));}ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {- if text_button(ui, "reset", crate::i18n::tr("Reset"), false).on_hover_text(crate::i18n::tr("Reset all edits (Cmd+Shift+R)")).clicked()+ if text_button(ui, "reset", crate::i18n::tr("Reset"), false)+ .on_hover_text(reset_tip(&app.ui.settings.keymap, ui.ctx().os() == egui::os::OperatingSystem::Mac))+ .clicked(){reset_clicked = true;}@@ -1681,6 +1683,15 @@ fn quick_develop(app: &mut LightcraftApp, ui: &mut egui::Ui, n: usize) {});}+/// The Reset button's tooltip with the reset shortcut as this platform writes it (issue #1751).+fn reset_tip(keymap: &crate::shortcuts::Keymap, mac: bool) -> String {+ let base = crate::i18n::tr("Reset all edits");+ match crate::shortcuts::shortcut_of(keymap, "develop.reset") {+ Some(sc) => format!("{base} ({})", crate::menubar::shortcut_text(sc, mac)),+ None => base.to_string(),+ }+}+#[cfg(test)]mod curve_histogram_tests {use super::*;@@ -1730,4 +1741,16 @@ mod tests {assert_eq!(steady_hdr_histogram(&ctx, id, false, Some(sdr.clone())), Some(sdr.clone()));assert_eq!(steady_hdr_histogram(&ctx, PhotoId(8), true, Some(sdr.clone())), Some(sdr));}++ /// Issue #1751: Windows and Linux read Ctrl where macOS reads Cmd, and a rebound shortcut shows.+ #[test]+ fn reset_tooltip_names_the_shortcut_of_this_platform() {+ let keymap = crate::shortcuts::Keymap::new();+ assert_eq!(reset_tip(&keymap, false), "Reset all edits (Ctrl+Shift+R)");+ assert_eq!(reset_tip(&keymap, true), "Reset all edits (⌘⇧R)");+ let rebound: crate::shortcuts::Keymap = [("develop.reset".to_string(), "Cmd+Alt+R".to_string())].into();+ assert_eq!(reset_tip(&rebound, false), "Reset all edits (Ctrl+Alt+R)");+ let unbound: crate::shortcuts::Keymap = [("develop.reset".to_string(), String::new())].into();+ assert_eq!(reset_tip(&unbound, false), "Reset all edits");+ }}