PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Merge upstream/main into fix/5703-pen-make-selection
Higgs32584870c776d735d
diff --cc crates/ui-egui/src/canvas_tool_menu.rsindex 92861a521,43418d5ff..23ad82826--- a/crates/ui-egui/src/canvas_tool_menu.rs+++ b/crates/ui-egui/src/canvas_tool_menu.rs@@@ -1504,34 -1666,34 +1680,60 @@@ mod testscrate::dialogs::confirm(&mut app, dialog).unwrap();assert!(app.session.active().unwrap().doc.work_path.is_some());assert!(app.session.active().unwrap().doc.selection.is_some());+ }++ /// #5703: the Pen options bar's Make Selection (Path mode) opens the same dialog for the path+ /// being drawn (finished into the Work Path first), and OK selects inside it; with no path at+ /// all it reports that instead.+ #[test]+ fn pen_options_bar_makes_a_selection_from_the_path() {+ let mut app = app();+ app.ui.tool = Tool::Pen;+ assert!(make_selection(&mut app).is_err(), "no path yet");+ assert!(app.ui.dialogs.is_empty());+ for (x, y) in [(2.0, 2.0), (20.0, 2.0), (20.0, 20.0)] {+ crate::vector_ui::pen_down(&mut app, x, y, false);+ crate::vector_ui::pen_up(&mut app);+ }+ make_selection(&mut app).unwrap();+ let dialog = app.ui.dialogs.last().map(|d| d.id).unwrap();+ crate::dialogs::confirm(&mut app, dialog).unwrap();+ let st = app.session.active().unwrap();+ assert!(st.doc.work_path.is_some() && st.doc.selection.is_some());+ // The active (Work) path again, with no pen path in progress.+ app.run("select.deselect", json!({})).unwrap();+ make_selection(&mut app).unwrap();+ let dialog = app.ui.dialogs.last().map(|d| d.id).unwrap();+ crate::dialogs::confirm(&mut app, dialog).unwrap();+ assert!(app.session.active().unwrap().doc.selection.is_some());}+ /// #1056: the Path Selection and Direct Selection tools' right-click opens the path menu for+ /// the selected path, as the Pen's does, instead of nothing.+ #[test]+ fn path_selection_tools_open_the_path_menu() {+ for tool in [Tool::PathSelection, Tool::DirectSelection] {+ let mut app = app();+ app.ui.tool = Tool::Pen;+ for (x, y) in [(2.0, 2.0), (20.0, 2.0), (20.0, 20.0)] {+ crate::vector_ui::pen_down(&mut app, x, y, false);+ crate::vector_ui::pen_up(&mut app);+ }+ crate::vector_ui::pen_commit(&mut app, false);+ assert!(app.session.active().unwrap().doc.work_path.is_some());+ app.ui.tool = tool;+ assert!(applies(tool));+ assert!(open(&mut app, &Context::default(), tool, [10.0, 10.0]), "{tool:?}");+ let menu = app.ui.canvas_tool_menu.clone().unwrap();+ assert_eq!(rows(&menu), PEN_MENU, "{tool:?}");+ assert!(menu.has_path && entry_enabled(&app, &menu, "path.toSelection"), "{tool:?}");+ choose(&mut app, &Context::default(), "path.toSelection");+ let dialog = app.ui.dialogs.last().map(|d| d.id).unwrap();+ crate::dialogs::confirm(&mut app, dialog).unwrap();+ assert!(app.session.active().unwrap().doc.selection.is_some(), "{tool:?}: Make Selection made one");+ }+ }+#[test]fn pen_menu_has_all_reference_rows_in_order_and_guards_unavailable_actions() {let labels: Vec<_> = PEN_MENU.iter().map(|row| row.map(|(label, _)| label)).collect();diff --cc crates/ui-egui/src/i18n/ko.tsvindex 60273c499,b99fde823..53ae61b53--- a/crates/ui-egui/src/i18n/ko.tsv+++ b/crates/ui-egui/src/i18n/ko.tsv@@@ -3368,7 -3370,10 +3370,11 @@@ curves Smooth 매끄럽�# View › Guides › right-click a guideEdit Selected Guides 선택한 안내선 편집Clear Selected Guides 선택한 안내선 지우기+ Make Selection 선택 영역 만들기+ Pasting from other apps is unavailable 다른 앱에서 붙여넣기를 사용할 수 없습니다+ PhotoCraft can't reach the system clipboard in this session. On Wayland, a Flatpak sandbox hides the protocol that images from other apps are read through. 이 세션에서는 PhotoCraft가 시스템 클립보드에 접근할 수 없습니다. Wayland에서는 Flatpak 샌드박스가 다른 앱의 이미지를 읽는 데 쓰이는 프로토콜을 숨깁니다.+ To paste from other apps, start PhotoCraft under XWayland: `{command}` 다른 앱에서 붙여넣으려면 XWayland에서 PhotoCraft를 실행하세요: `{command}`+ Nothing to paste: PhotoCraft can't read the system clipboard here 붙여넣을 내용 없음: 여기서는 PhotoCraft가 시스템 클립보드를 읽을 수 없습니다Delete this set 이 세트 삭제New Set… 새 세트…PhotoCraft Defaults PhotoCraft 기본값diff --cc crates/ui-egui/src/i18n/zh-hans.tsvindex 3d9427b7e,5efbe2899..de3b43428--- a/crates/ui-egui/src/i18n/zh-hans.tsv+++ b/crates/ui-egui/src/i18n/zh-hans.tsv@@@ -2809,7 -2811,10 +2811,11 @@@ curves Smooth 平�# View › Guides › right-click a guideEdit Selected Guides 编辑所选参考线Clear Selected Guides 清除所选参考线+ Make Selection 建立选区+ Pasting from other apps is unavailable 无法从其他应用粘贴+ PhotoCraft can't reach the system clipboard in this session. On Wayland, a Flatpak sandbox hides the protocol that images from other apps are read through. PhotoCraft 在此会话中无法访问系统剪贴板。在 Wayland 上,Flatpak 沙盒会隐藏读取其他应用图像所用的协议。+ To paste from other apps, start PhotoCraft under XWayland: `{command}` 要从其他应用粘贴,请在 XWayland 下启动 PhotoCraft:`{command}`+ Nothing to paste: PhotoCraft can't read the system clipboard here 没有可粘贴的内容:PhotoCraft 在此无法读取系统剪贴板Delete this set 删除此组New Set… 新建组…PhotoCraft Defaults PhotoCraft 默认值diff --cc crates/ui-egui/src/i18n/zh-hant.tsvindex 24f701274,ea0af7945..2cd4758d4--- a/crates/ui-egui/src/i18n/zh-hant.tsv+++ b/crates/ui-egui/src/i18n/zh-hant.tsv@@@ -2794,7 -2796,10 +2796,11 @@@ curves Smooth 平�# View › Guides › right-click a guideEdit Selected Guides 編輯所選參考線Clear Selected Guides 清除所選參考線+ Make Selection 建立選取範圍+ Pasting from other apps is unavailable 無法從其他應用程式貼上+ PhotoCraft can't reach the system clipboard in this session. On Wayland, a Flatpak sandbox hides the protocol that images from other apps are read through. PhotoCraft 在此工作階段中無法存取系統剪貼簿。在 Wayland 上,Flatpak 沙盒會隱藏讀取其他應用程式影像所用的協定。+ To paste from other apps, start PhotoCraft under XWayland: `{command}` 若要從其他應用程式貼上,請在 XWayland 下啟動 PhotoCraft:`{command}`+ Nothing to paste: PhotoCraft can't read the system clipboard here 沒有可貼上的內容:PhotoCraft 在此無法讀取系統剪貼簿Delete this set 刪除此組合New Set… 新增組合…PhotoCraft Defaults PhotoCraft 預設值