PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Merge upstream/main (523f1f06) into Layers Panel options
abc2cb7505ebdae352
diff --cc crates/ui-egui/src/canvas.rsindex ff88dad2f,0ed696064..6bc3062aa--- a/crates/ui-egui/src/canvas.rs+++ b/crates/ui-egui/src/canvas.rs@@@ -1019,10 -1078,10 +1078,14 @@@ pub(crate) fn display_doc(app: &mut Phoif let Some(shown) = crate::patch_preview::display_doc(app, idx) {return shown;}+ // Live Layers-panel reorder previews the actual composite before mouse release.+ if let Some(shown) = crate::layers_panel_ui::display_reorder(app, idx) {+ return shown;+ }+ // Content-Aware Move drag or box: the result, once computed in the background.+ if let Some(shown) = crate::cam_preview::display_doc(app, idx) {+ return shown;+ }// A blend mode hovered in the Layers panel.if let Some(shown) = crate::blend_preview::display_doc(app, idx) {return shown;diff --cc crates/ui-egui/src/i18n/hu.tsvindex b40161744,4e9a4fbe3..417422a29--- a/crates/ui-egui/src/i18n/hu.tsv+++ b/crates/ui-egui/src/i18n/hu.tsv@@@ -3965,27 -3999,54 +3999,71 @@@ cameraRaw Yellow SárgProtect: Védelem:Remove after each stroke Eltávolítás minden ecsetvonás utánSaving {percent} Mentés: {percent}- Scale or rotate the moved area, then press {key} Méretezze vagy forgassa el az áthelyezett területet, majd nyomja meg: {key}+ Scale or rotate the moved area, then press {key} Méretezd vagy forgasd el az áthelyezett területet, majd nyomd meg: {key}Smooth the curve values A görbeértékek simításaStrokes to remove: {n} (Enter applies, Esc cancels) Eltávolítandó ecsetvonások: {n} (Enter: alkalmazás, Esc: mégse)- The layer or its mask changed. Drag the mask onto the Trash again. A réteg vagy a maszkja megváltozott. Húzza újra a maszkot a Kukába.+ The layer or its mask changed. Drag the mask onto the Trash again. A réteg vagy a maszkja megváltozott. Húzd újra a maszkot a Kukába.Transform On Drop Átalakítás elengedéskorVanishing Point is not active Az Enyészpont nem aktív- Vanishing Point: click four corners to create a plane Enyészpont: sík létrehozásához kattintson a négy sarokra+ Vanishing Point: click four corners to create a plane Enyészpont: sík létrehozásához kattints a négy sarokra+ Clear Brush Controls Ecsetvezérlők törlése+ Reset All Locked Settings Összes zárolt beállítás visszaállítása+ Copy Texture to Other Tools Textúra másolása más eszközökre++ # Actions panel: Load/Save Actions (.atn) and kept Photoshop steps+ Load Actions… Műveletek betöltése…+ Save Actions… Műveletek mentése…+ {name} (Photoshop) {name} (Photoshop)+ {message} ({note}) {message} ({note})+ @plural Loaded {n} action from {file}|Loaded {n} actions from {file} {n} művelet betöltve. Forrás: {file}+ @plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} lépésnek még nincs megfelelője a PhotoCraftban+ @plural Saved {n} action to {file}|Saved {n} actions to {file} {n} művelet mentve. Cél: {file}+ @plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out {n} Photoshop-megfelelő nélküli lépés kihagyva++ # Actions panel: set folders, dialog toggle, Insert Stop+ Insert Stop… Leállítás beszúrása…+ Save Set… Készlet mentése…+ Message: Üzenet:+ Allow Continue Folytatás engedélyezése+ Show dialog during playback Párbeszédablak megjelenítése lejátszáskor+ Select an action first Először válassz ki egy műveletet+ Action playback stopped A művelet lejátszása leállt+ Step {step} is waiting for its dialog A(z) {step}. lépés a párbeszédablakára vár+ @plural {n} action|{n} actions {n} művelet+ Object Finder Objektumkereső+ No object found there — drag a rectangle around it Ott nem található objektum – húzz köré egy téglalapot+ Drag to pan · Scroll to zoom · Double-click to fit Húzás: mozgatás · Görgetés: nagyítás · Dupla kattintás: igazítás+ Gradient Preset Options Színátmenet-előbeállítás beállításai+ Import .GRD .GRD importálása+ Choose a gradient file (.grd). Válasszon színátmenetfájlt (.grd).+ Save Settings… Beállítások mentése…+ Load Settings… Beállítások betöltése…+ Save these settings as a Camera Raw .xmp file A beállítások mentése Camera Raw .xmp-fájlként+ Load settings from a Camera Raw .xmp file Beállítások betöltése Camera Raw .xmp-fájlból+ Loaded Camera Raw settings from {file} Camera Raw-beállítások betöltve innen: {file}+ Loaded Camera Raw settings from {file} ({n} not supported) Camera Raw-beállítások betöltve innen: {file} ({n} nem támogatott)+ Auto Add/Delete Automatikus hozzáadás/törlés+ ICO is limited to 256 × 256 pixels Az ICO legfeljebb 256 × 256 képpont lehet++ # Channel Options and New Spot Channel (#3761)+ Channel Color Csatorna színe+ Color Indicates: A szín jelzése:+ Ink Characteristics Festék jellemzői+ Solidity: Fedőképesség:++# Layers panel options and Smart Filter editors+ Add “copy” to Copied Layers and Groups „másolat” hozzáadása a másolt rétegekhez és csoportokhoz+ Animation Options Animációs beállítások+ Entire Document Teljes dokumentum+ Expand New Effects Új effektusok kibontása+ Filter Options Szűrési beállítások+ Layer Bounds Réteghatárok+ Layers Panel Options Rétegek panel beállításai+ New Artboard… Új rajztábla…+ New Group… Új csoport…+ Prevent Auto-Nesting Automatikus beágyazás tiltása+ Preview on canvas when reordering layers Előnézet a vásznon a rétegek átrendezésekor+ Show Layers Rétegek megjelenítése+ Show layer mask badges Rétegmaszk-jelvények megjelenítése+ Thumbnail Contents Bélyegkép tartalma+ Thumbnail Size Bélyegképméretdiff --cc crates/ui-egui/src/i18n/tr.tsvindex 48e2b25c0,e499fa162..d40980219--- a/crates/ui-egui/src/i18n/tr.tsv+++ b/crates/ui-egui/src/i18n/tr.tsv@@@ -3784,20 -3817,47 +3817,64 @@@ cameraData Lens Len@plural {n} step|{n} steps {n} adım@plural {warning} (+{n} more brush preset warning)|{warning} (+{n} more brush preset warnings) {warning} (+{n} fırça ön ayarı uyarısı daha)@plural {what} with {n} warning|{what} with {n} warnings {what}, {n} uyarı ile+ Clear Brush Controls Fırça Denetimlerini Temizle+ Reset All Locked Settings Tüm Kilitli Ayarları Sıfırla+ Copy Texture to Other Tools Dokuyu Diğer Araçlara Kopyala++ # Actions panel: Load/Save Actions (.atn) and kept Photoshop steps+ Load Actions… Eylemleri Yükle…+ Save Actions… Eylemleri Kaydet…+ {name} (Photoshop) {name} (Photoshop)+ {message} ({note}) {message} ({note})+ @plural Loaded {n} action from {file}|Loaded {n} actions from {file} {file} dosyasından {n} eylem yüklendi+ @plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} adımın PhotoCraft’ta henüz karşılığı yok+ @plural Saved {n} action to {file}|Saved {n} actions to {file} {n} eylem {file} dosyasına kaydedildi+ @plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out Photoshop karşılığı olmayan {n} adım atlandı++ # Actions panel: set folders, dialog toggle, Insert Stop+ Insert Stop… Durdurma Ekle…+ Save Set… Seti Kaydet…+ Message: İleti:+ Allow Continue Devam Etmeye İzin Ver+ Show dialog during playback Oynatma sırasında iletişim kutusunu göster+ Select an action first Önce bir eylem seçin+ Action playback stopped Eylem oynatma durduruldu+ Step {step} is waiting for its dialog {step}. adım iletişim kutusunu bekliyor+ @plural {n} action|{n} actions {n} eylem+ Object Finder Nesne Bulucu+ No object found there — drag a rectangle around it Orada nesne bulunamadı — çevresine bir dikdörtgen sürükleyin+ Drag to pan · Scroll to zoom · Double-click to fit Kaydırmak için sürükleyin · Yakınlaştırmak için kaydırın · Sığdırmak için çift tıklayın+ Gradient Preset Options Gradyan Ön Ayarı Seçenekleri+ Import .GRD .GRD İçe Aktar+ Choose a gradient file (.grd). Bir gradyan dosyası (.grd) seçin.+ Save Settings… Ayarları Kaydet…+ Load Settings… Ayarları Yükle…+ Save these settings as a Camera Raw .xmp file Bu ayarları Camera Raw .xmp dosyası olarak kaydet+ Load settings from a Camera Raw .xmp file Ayarları bir Camera Raw .xmp dosyasından yükle+ Loaded Camera Raw settings from {file} Camera Raw ayarları {file} dosyasından yüklendi+ Loaded Camera Raw settings from {file} ({n} not supported) Camera Raw ayarları {file} dosyasından yüklendi ({n} desteklenmiyor)+ Auto Add/Delete Otomatik Ekle/Sil+ ICO is limited to 256 × 256 pixels ICO 256 × 256 piksel ile sınırlıdır++ # Channel Options and New Spot Channel (#3761)+ Channel Color Kanal Rengi+ Color Indicates: Rengin Gösterdiği:+ Ink Characteristics Mürekkep Özellikleri+ Solidity: Doluluk:++# Layers panel options and Smart Filter editors+ Add “copy” to Copied Layers and Groups Kopyalanan Katman ve Gruplara “kopya” Ekle+ Animation Options Animasyon Seçenekleri+ Entire Document Tüm Belge+ Expand New Effects Yeni Efektleri Genişlet+ Filter Options Filtre Seçenekleri+ Layer Bounds Katman Sınırları+ Layers Panel Options Katmanlar Paneli Seçenekleri+ New Artboard… Yeni Çalışma Yüzeyi…+ New Group… Yeni Grup…+ Prevent Auto-Nesting Otomatik Yerleştirmeyi Önle+ Preview on canvas when reordering layers Katmanları yeniden sıralarken kanvasta önizle+ Show Layers Katmanları Göster+ Show layer mask badges Katman maskesi rozetlerini göster+ Thumbnail Contents Küçük Resim İçeriği+ Thumbnail Size Küçük Resim Boyutudiff --cc crates/ui-egui/src/i18n/vi.tsvindex 66810fe32,72ce77b63..b489518aa--- a/crates/ui-egui/src/i18n/vi.tsv+++ b/crates/ui-egui/src/i18n/vi.tsv@@@ -3536,21 -3584,33 +3584,51 @@@ curves Smooth Làm mượRemove after each stroke Xóa sau mỗi nét vẽApply the removal ({key}) Áp dụng việc xóa ({key})Strokes to remove: {n} (Enter applies, Esc cancels) Nét vẽ cần xóa: {n} (Enter áp dụng, Esc hủy)+ Clear Brush Controls Xóa điều khiển cọ+ Reset All Locked Settings Đặt lại tất cả cài đặt đã khóa+ Copy Texture to Other Tools Sao chép họa tiết sang các công cụ khác++ # Actions panel: Load/Save Actions (.atn) and kept Photoshop steps+ Load Actions… Nạp hành động…+ Save Actions… Lưu hành động…+ {name} (Photoshop) {name} (Photoshop)+ {message} ({note}) {message} ({note})+ @plural Loaded {n} action from {file}|Loaded {n} actions from {file} Đã nạp {n} hành động từ {file}+ @plural {n} step has no PhotoCraft equivalent yet|{n} steps have no PhotoCraft equivalent yet {n} bước chưa có chức năng tương ứng trong PhotoCraft+ @plural Saved {n} action to {file}|Saved {n} actions to {file} Đã lưu {n} hành động vào {file}+ @plural {n} step with no Photoshop equivalent left out|{n} steps with no Photoshop equivalent left out Đã bỏ qua {n} bước không có chức năng tương ứng trong Photoshop++ # Actions panel: set folders, dialog toggle, Insert Stop+ Insert Stop… Chèn điểm dừng…+ Save Set… Lưu bộ…+ Message: Thông báo:+ Allow Continue Cho phép tiếp tục+ Show dialog during playback Hiện hộp thoại khi phát+ Select an action first Hãy chọn một hành động trước+ Action playback stopped Đã dừng phát hành động+ Step {step} is waiting for its dialog Bước {step} đang chờ hộp thoại của nó+ @plural {n} action|{n} actions {n} hành động+ Presentation Trình bày+ Gradient Preset Options Tùy chọn thiết lập sẵn chuyển sắc+ Import .GRD Nhập .GRD+ Choose a gradient file (.grd). Chọn tệp chuyển sắc (.grd).+ Auto Add/Delete Tự động thêm/xóa+ ICO is limited to 256 × 256 pixels ICO giới hạn ở 256 × 256 pixel++# Layers panel options and Smart Filter editors+ Add “copy” to Copied Layers and Groups Thêm “bản sao” vào lớp và nhóm được sao chép+ Animation Options Tùy chọn hoạt ảnh+ Entire Document Toàn bộ tài liệu+ Expand New Effects Mở rộng hiệu ứng mới+ Filter Options Tùy chọn bộ lọc+ Layer Bounds Đường biên lớp+ Layers Panel Options Tùy chọn bảng Lớp+ New Artboard… Bảng vẽ mới…+ New Group… Nhóm mới…+ Panel Options… Tùy chọn bảng…+ Prevent Auto-Nesting Chặn tự lồng+ Preview on canvas when reordering layers Xem trước trên Canvas khi sắp xếp lại lớp+ Show Layers Hiện các lớp+ Show layer mask badges Hiện huy hiệu mặt nạ lớp+ Thumbnail Contents Nội dung hình thu nhỏ+ Thumbnail Size Kích thước hình thu nhỏdiff --cc crates/ui-egui/src/layer_row_ui/tests.rsindex 70553348b,6ec1241b4..0bd2c7b09--- a/crates/ui-egui/src/layer_row_ui/tests.rs+++ b/crates/ui-egui/src/layer_row_ui/tests.rs@@@ -537,31 -537,73 +537,102 @@@ fn press_drag_release_on_the_fx_button_assert!(effects.iter().any(|e| e["kind"] == json!("dropShadow")), "on Drop Shadow: {effects:?}");}+/// Integration regression: a display preference must resize the *actual painted*+/// thumbnails and row hitboxes, not only its Preview dialog.+#[test]+fn panel_thumbnail_sizes_change_real_row_geometry() {+ use crate::state::LayerThumbnailSize;+ let mut session = photocraft_engine::Session::new();+ session.execute("file.new", json!({"width": 64, "height": 48})).unwrap();+ session.execute("layer.new.layer", json!({"name": "Photo"})).unwrap();+ session.execute("edit.fill", json!({"color": "#9acb32"})).unwrap();+ let layer = session.active().unwrap().active_layer.unwrap();+ let mut h = harness(session, 1.0, "promedium", 290.0);+ for (size, expected_thumb, expected_row) in [+ (LayerThumbnailSize::None, 0.0, 23.0),+ (LayerThumbnailSize::Small, 18.0, 32.0),+ (LayerThumbnailSize::Medium, 24.0, 32.0),+ (LayerThumbnailSize::Large, 48.0, 56.0),+ ] {+ h.state_mut().ui.layers_panel_options.thumbnail_size = size;+ h.run_steps(5);+ let found = recorded(&h.ctx).into_iter().find(|r| r.layer == layer.0).expect("visible layer row");+ assert!((found.row.height() - expected_row).abs() < 0.1, "{size:?}: row {}", found.row.height());+ match found.thumbnail {+ Some(rect) => assert!((rect.width() - expected_thumb).abs() < 0.1, "{size:?}: thumbnail {}", rect.width()),+ None => assert_eq!(expected_thumb, 0.0, "{size:?} should display a thumbnail"),+ }+ assert!(found.name.is_some(), "{size:?}: layer name still visible");+ }+}+++ /// One layer per lock, each with only that lock set (#4158).+ fn one_lock_each() -> (photocraft_engine::Session, Vec<(&'static str, u64)>) {+ let mut s = photocraft_engine::Session::new();+ s.execute("file.new", json!({"width": 64, "height": 48})).unwrap();+ let mut ids = Vec::new();+ for key in ["transparency", "pixels", "position", "artboard", "all"] {+ let id = s.execute("layer.new.layer", json!({"name": key})).unwrap()["layer"].as_u64().unwrap();+ s.execute("layer.setProps", json!({"layer": id, "locks": {key: true}})).unwrap();+ ids.push((key, id));+ }+ (s, ids)+ }++ #[test]+ fn every_lock_shows_the_lock_icon_on_the_row() {+ // #4158: "Lock image pixels" and the artboard lock left the row without its lock icon.+ // Photoshop shows it whenever any lock is set.+ let (s, ids) = one_lock_each();+ let doc = &s.active().unwrap().doc;+ for &(key, id) in &ids {+ let l = doc.layers.iter().find(|l| l.id.0 == id).unwrap();+ assert_eq!(super::reserved_width(l), super::RIGHT_PAD + super::ICON_W + super::GAP, "{key}: room for the lock icon");+ }+ let h = harness(s, 1.0, "promedium", 290.0);+ let rows = recorded(&h.ctx);+ for &(key, id) in &ids {+ let r = rows.iter().find(|r| r.layer == id).unwrap_or_else(|| panic!("{key}: row drawn"));+ assert!(r.indicators.iter().any(|(k, _)| *k == Indicator::Lock), "{key}: lock icon drawn ({:?})", r.indicators);+ }+ }++ #[test]+ fn the_studio_lock_button_shows_every_lock() {+ // #4158: the simple themes' lock button drew "unlocked" for a pixels or artboard lock, though+ // clicking it then unlocked the layer.+ for key in ["transparency", "pixels", "position", "artboard", "all"] {+ let mut s = photocraft_engine::Session::new();+ s.execute("file.new", json!({"width": 64, "height": 48})).unwrap();+ s.execute("layer.new.layer", json!({"name": key})).unwrap();+ s.execute("layer.setProps", json!({"locks": {key: true}})).unwrap();+ let h = harness(s, 1.0, "studio", 290.0);+ assert_eq!(h.get_by_label("Lock layer").accesskit_node().toggled(), Some(egui::accesskit::Toggled::True), "{key}");+ }+ }++ #[test]+ fn clicking_the_lock_icon_on_a_row_unlocks_the_layer() {+ // #4723: the row's lock icon was only painted. In Photoshop a click on it clears every lock,+ // and on the Background makes it a normal layer.+ let (s, ids) = one_lock_each();+ let bg = s.active().unwrap().doc.background().unwrap().id;+ let mut h = harness(s, 1.0, "promedium", 290.0);+ let active = h.state().session.active().unwrap().active_layer;+ let lock_icon = |h: &Harness<'_, PhotocraftApp>, id: u64| {+ let row = recorded(&h.ctx).into_iter().find(|r| r.layer == id).unwrap();+ row.indicators.into_iter().find(|(k, _)| *k == Indicator::Lock).unwrap_or_else(|| panic!("lock icon on {id}")).1.center()+ };+ for &(key, id) in &ids {+ let p = lock_icon(&h, id);+ click(&mut h, p);+ let d = h.state().session.active().unwrap();+ assert!(!d.doc.layer(photocraft_doc::LayerId(id)).unwrap().locks.any(), "{key}: unlocked");+ assert_eq!(d.active_layer, active, "{key}: the lock icon doesn't select");+ }+ let p = lock_icon(&h, bg.0);+ click(&mut h, p);+ let doc = &h.state().session.active().unwrap().doc;+ assert!(doc.background().is_none(), "the Background became a normal layer");+ assert!(!doc.layer(bg).unwrap().locks.any());+ }diff --cc crates/ui-egui/src/lib.rsindex 005e42ce7,d3f1a1440..7447f3e27--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@@ -498,14 -535,14 +536,18 @@@ pub struct PhotocraftApppub(crate) move_preview: Option<move_ui::MovePreview>,/// Move tool › Show Highlight on Rollover: the last hover answer (`move_hover`).pub(crate) move_hover: Option<move_hover::Hover>,+ /// Object Selection › Object Finder: the hover preview (`object_finder`).+ pub(crate) object_finder: Option<object_finder::Finder>,/// A blend mode hovered in the Layers panel, shown live (`blend_preview`).pub(crate) blend_preview: Option<blend_preview::BlendPreview>,+ /// Layers panel drag: temporary reordered document displayed until mouse release.+ pub(crate) reorder_preview: Option<layers_panel_ui::ReorderPreview>,+ /// Whether the currently dragged layer is over a valid destination this frame.+ pub(crate) reorder_preview_hit: bool,/// Patch Tool drag: the healed document at the pointer (`patch_preview`).pub(crate) patch_preview: Option<patch_preview::PatchPreview>,+ /// Content-Aware Move drag or box shown with its result (`cam_preview`).+ pub(crate) cam_preview: Option<cam_preview::CamPreview>,/// The pixels a Magnetic Lasso border follows (`magnetic_lasso_ui`).pub(crate) magnetic: magnetic_lasso_ui::Runtime,/// The next tool `Down` is a right-button drag that erases (see `paint_mouse`).@@@ -727,10 -776,10 +781,12 @@@ impl PhotocraftAppmenu_cache: None,move_preview: None,move_hover: None,+ object_finder: None,blend_preview: None,+ reorder_preview: None,+ reorder_preview_hit: false,patch_preview: None,+ cam_preview: None,magnetic: Default::default(),secondary_erase: false,held_erase: false,@@@ -1726,7 -1837,7 +1845,8 @@@ impl eframe::App for PhotocraftAppworkspace_ui::windows(self, &ctx);palette::show(self, &ctx);dialogs::show(self, &ctx);+ layers_panel_ui::show_dialog(self, &ctx);+ rasterize_prompt::run_pending(self, &ctx);jobs_ui::dialog(self, &ctx);discard_ui::show(self, &ctx);tiff_options_ui::show(self, &ctx);