PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
M4: lay out Organize pages as Acrobat's panel (#2248)
abc2cbb850cbb5c928
diff --git a/ATTRIBUTION.toml b/ATTRIBUTION.tomlindex ff4e1b6c8..22809761e 100644--- a/ATTRIBUTION.toml+++ b/ATTRIBUTION.toml@@ -7,7 +7,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Greek UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "110f2a5262514645144a7312e724f6bf2ff9cd12bf49d93668d99f0fe868ee92"+sha256 = "a97939665a6e4ac58111a27982f6b1bfdcb85db9cbd6ce023dbd8659a73e6118"# ATTRIBUTION.toml: one entry per asset (AGENTS.md §1). The source of truth for provenance and licences.# ATTRIBUTION.md is generated from this file: `cargo xtask assets --write`. Checked by `cargo xtask assets` (part of `xtask ci`).@@ -30,7 +30,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Simplified Chinese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "1ca0dba0272a5b5d928ec9dd58a14e1fd8d1f56b4fc23d8d8315a03302fec4d2"+sha256 = "a5fe624ab5684a330ddad485a1ae4a2ff7439cb2ada85afd10ffc4fb0791522c"[[asset]]path = "crates/ui-egui/src/i18n/zh-hant.tsv"@@ -41,7 +41,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Traditional Chinese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "41ab3391e815144ff1a4e29034c8edfc566ca0b3d669cc521ef38d33f8d0603a"+sha256 = "5da04b4ef08f9ba2bf4433a51b1cff596d700e55170c28cc12ef34ad19c9b1fd"[[asset]]path = "crates/ui-egui/src/i18n/cs.tsv"@@ -52,7 +52,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Czech UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "90360967683e870a6c12c3fb91ed4f03b1204f2b031f88845d7b2ec4480067ff"+sha256 = "d714effcab6ae014ad5b0e964b93d313758db1ce9523b1340a60a5397bf123d8"[[asset]]path = "crates/ui-egui/src/i18n/pt-br.tsv"@@ -63,7 +63,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Brazilian Portuguese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "4d1bf401a120ce51d9a584362feb1db1cc6a7694157cb7bd9d6acf7a8a8309cb"+sha256 = "244fecf2976aec60450528de322f1048a8d2aafe977f1f1a919fcf876d36e593"[[asset]]path = "crates/ui-egui/src/i18n/es.tsv"@@ -74,7 +74,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Spanish UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "3e24afe4cce398fde6b15047d118f37f5cbbaf38fae23f22dd4b244746fe1e6b"+sha256 = "f6fba535ad253a7661bcec3c274fd1d1116430c65628da8ffb74532172e9dd04"[[asset]]path = "crates/ui-egui/src/i18n/fr.tsv"@@ -85,7 +85,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "French UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "2855204f355fc4720e3621021005fe042bd3272faddf41010883debe4b3ac848"+sha256 = "204e00346d16c9f32697381f990bf3d138361a9e4237fcd961a2ce1d69355be9"[[asset]]path = "crates/ui-egui/src/i18n/de.tsv"@@ -96,7 +96,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "German UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "2fb8ff03f3aa8463ced6cfc9f4683581520beb42d08867e26414d926ba4317e7"+sha256 = "dcf84dbffb1b1b37f3826ce88f9ea6dd4bc52aee800914f4bc21b8009aebe550"[[asset]]path = "crates/ui-egui/src/i18n/te.tsv"@@ -107,7 +107,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Telugu UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "dbec277ec7965222c608fdc40ff63827022efe75abbe9d38e22bb49933145059"+sha256 = "8ba90267efc380425d88bab543d88345cb9de3ce983f9a1a1f2879d6f3e6206b"[[asset]]path = "crates/ui-egui/src/i18n/it.tsv"@@ -118,7 +118,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Italian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "4b9a018a8d3876d48d898e1684f6253c13936794e5ed93c28bc9224ffb4d3b4e"+sha256 = "8480ff4eb35c39d799036e7c4adfb3a8b3da71d8b9cf6540c22d0f62972149c2"[[asset]]path = "crates/ui-egui/src/i18n/pl.tsv"@@ -129,7 +129,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Polish UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "a0530e10fb03abf9da1a2ab6a8f29f4566f65d658b0ce5d5320b7d37001edd0c"+sha256 = "31062d686391ba9d6dbfe0ab1a34a58924333bb6d1bfaa2f68433ff3352c2455"[[asset]]path = "crates/ui-egui/src/i18n/ru.tsv"@@ -140,7 +140,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Russian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "e4677cfb72372d76ff585ca9276977d43a7c4b2b930cb7be8bb0d4f66d8bbe15"+sha256 = "0164c540c1d3363329cb5125dc30a5c6dc1321d5ed68ec705a51bef12850a7a5"[[asset]]path = "crates/ui-egui/src/i18n/hu.tsv"@@ -151,7 +151,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Hungarian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "3a7960c31871361ec84c531d6d7c694c6d185374577f563aeca444cef8a00ee7"+sha256 = "49ebab7b33137af1754bf28abb7b52ee86d9a0ab837281dcb9741a7310dd69fa"[[asset]]path = "crates/ui-egui/src/i18n/bg.tsv"@@ -162,7 +162,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Bulgarian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "3f1f5e1cdd05aefb613421b896525448ed4fbbcc3e6d63fba961b0add49bd404"+sha256 = "268f5707b1b905067d597a7b9e75fecc9f8d6c9d227813450391c5cae7505f99"[[asset]]path = "crates/ui-egui/src/i18n/kk.tsv"@@ -173,7 +173,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Kazakh UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "8421ad841f41182d640fa5cf675184ba8d0c0119ff992b185398d7cd51171d28"+sha256 = "087167049187f00cceb87af9744cb4017bd903c80adbf1e5e49c0b1e0b6352bc"[[asset]]path = "crates/ui-egui/src/i18n/ja.tsv"@@ -184,7 +184,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Japanese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "55aa36c5607de5be34526665366f072fe7786d2545b78f8408c81a3c42ece201"+sha256 = "5e74d56a13284204077b0c39acb7fe22039fcba886a7eb75eeab0f211d18184f"[[asset]]path = "crates/ui-egui/src/i18n/uk.tsv"@@ -195,7 +195,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Ukrainian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "8d893071405f05673a80164e9910288a7931c02a80d070339b35163c95c66466"+sha256 = "748f6f45a6e72c164b6b215b2d3617495f420ab1d175d6cfa3b8a73e6631a01d"[[asset]]path = "crates/ui-egui/src/i18n/ar.tsv"@@ -206,7 +206,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Arabic UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "0ff60d3ca5ca3f675815d6bdc1eb69474438c5f130fd12a70e483ce150687b8d"+sha256 = "1367bc29cf3288b0fa9246f3af41cf5a176cb795882795a94f386a5d3a753f23"[[asset]]path = "crates/ui-egui/src/i18n/tr.tsv"@@ -217,7 +217,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Turkish UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "4dc2b84acde904350edfa4bbe0886cb86145a093ecc7b874e0f17c6e7d6464ff"+sha256 = "b52d09fd8a30cb2adacfaa8dab55d39e555e6812546ac3bc2d7886dd21e9bf2d"[[asset]]path = "crates/ui-egui/src/i18n/lt.tsv"@@ -228,7 +228,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Lithuanian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "a66e580aa58bcda4e598d63c7b50b27532be6d5fe3b2fedff1faf070250010a4"+sha256 = "9b9e1516828841f1685b4a02cf9b79f917182395af46907831ba60c301b66644"[[asset]]@@ -3363,7 +3363,7 @@ licence = "MIT OR Apache-2.0"licence_file = "LICENSE-MIT"kind = "translation"usage = "Slovene UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"-sha256 = "773913ba39e959b007a7615cd2cccecd0f03bf5c6cad997afec9cdf65c8de922"+sha256 = "06d2b8e6b9b719c9f3a82bc4e6b5c3dacd00c6f44fd3092e1b834d43464ab5a9"[[asset]]path = "vendor/vello_common/assets/probe.png"diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rsindex cc48a8d26..6bb8a106f 100644--- a/crates/ui-egui/src/canvas.rs+++ b/crates/ui-egui/src/canvas.rs@@ -401,7 +401,7 @@ pub struct DocView {pub(crate) auto_scroll: crate::autoscroll::AutoScroll,/// Pages selected in the organize grid or the Pages panel (0-based). Empty means "the current page".pub selected: BTreeSet<usize>,- organize_range: crate::page_selection_ui::PageSelectionInput,+ pub(crate) organize_range: crate::page_selection_ui::PageSelectionInput,/// Anchor for ⇧-click range selection in the organize grid.select_anchor: Option<usize>,/// An edit requested by the view (organize toolbar, keys), applied by the app this frame.@@ -4353,12 +4353,6 @@ pub(crate) fn grid_page_rect(cell: Rect, page: Vec2) -> Rect {/// The organize toolbar: page operations on the selection (Acrobat's Organize Pages bar).fn organize_toolbar(view: &mut DocView, info: &DocInfo, editable: bool, dirty: bool, unobstructed: bool, ui: &mut egui::Ui, t: &Tokens) {- egui::Frame::NONE.fill(t.chrome).inner_margin(egui::Margin::symmetric(16, 4)).show(ui, |ui| {- let pages = ui.add_enabled_ui(unobstructed, |ui| view.organize_range.show(ui, &view.selected, info.pages.len())).inner;- if let Some(pages) = pages {- view.select_pages(&pages);- }- });let targets = view.target_pages();let n = info.pages.len();let (first, last) = (targets.first().copied().unwrap_or(0), targets.last().copied().unwrap_or(0));@@ -4373,56 +4367,6 @@ fn organize_toolbar(view: &mut DocView, info: &DocInfo, editable: bool, dirty: b// Fixed width so the buttons never shift as the selection text changes.ui.add_sized([150.0, 30.0], egui::Label::new(egui::RichText::new(label).font(theme::medium(13.0)).color(t.text_muted)).truncate());ui.add_enabled_ui(editable, |ui| {- if icons::button(ui, "rotate-ccw", 30.0, false, tl!("Rotate counterclockwise")).clicked() {- view.pending_edit = Some(Edit::RotatePages { pages: targets.clone(), degrees: -90 });- }- if icons::button(ui, "rotate-cw", 30.0, false, tl!("Rotate clockwise")).clicked() {- view.pending_edit = Some(Edit::RotatePages { pages: targets.clone(), degrees: 90 });- }- let can_delete = targets.len() < n;- if ui.add_enabled_ui(can_delete, |ui| icons::button(ui, "trash-2", 30.0, false, tl!("Delete pages (Delete)"))).inner.clicked() {- view.pending_edit = Some(Edit::DeletePages { pages: targets.clone() });- }- if icons::button(ui, "file-plus", 30.0, false, tl!("Insert a blank page after the selection")).clicked() {- let c = info.pages[last].crop;- let (w, h) = ((c[2] - c[0]).abs().max(1.0) as f64, (c[3] - c[1]).abs().max(1.0) as f64);- view.pending_edit = Some(Edit::InsertBlankPage { at: last + 1, width: w, height: h });- }- if icons::button(ui, "file-input", 30.0, false, tl!("Insert pages from a file…")).clicked() {- view.pending_action = Some(ViewAction::InsertFromFile);- }- if icons::button(ui, "replace", 30.0, false, tl!("Replace pages…")).clicked() {- view.pending_action = Some(ViewAction::ReplacePages);- }- if icons::button(ui, "file-output", 30.0, false, tl!("Extract pages to a new document")).clicked() {- view.pending_action = Some(ViewAction::Extract);- }- if icons::button(ui, "scissors", 30.0, false, tl!("Split into files…")).clicked() {- view.pending_action = Some(ViewAction::Split);- }- // Select ▸ all, odd, even, landscape, portrait pages (Acrobat's page range- // selection in Organize Pages).- let sel = icons::button(ui, "list", 30.0, false, tl!("Select pages"));- egui::Popup::menu(&sel).show(|ui| {- use pdfcraft_engine::{PageOrientation as O, PageParity as P, filter_pages};- let all: Vec<usize> = (0..n).collect();- for (label, parity, orient) in [- ("All pages", P::Both, O::Both),- ("Odd pages", P::Odd, O::Both),- ("Even pages", P::Even, O::Both),- ("Landscape pages", P::Both, O::Landscape),- ("Portrait pages", P::Both, O::Portrait),- ] {- if ui.button(tl!(label)).clicked() {- view.select_pages(&filter_pages(info, &all, parity, orient));- ui.close();- }- }- if ui.button(tl!("None")).clicked() {- view.select_pages(&[]);- ui.close();- }- });ui.add_space(8.0);if ui.add_enabled_ui(first > 0, |ui| icons::button(ui, "chevron-left", 30.0, false, tl!("Move earlier"))).inner.clicked() {view.pending_edit = Some(Edit::MovePages { pages: targets.clone(), to: first - 1 });diff --git a/crates/ui-egui/src/i18n/ar.tsv b/crates/ui-egui/src/i18n/ar.tsvindex bb827f179..84948ebaf 100644--- a/crates/ui-egui/src/i18n/ar.tsv+++ b/crates/ui-egui/src/i18n/ar.tsv@@ -2430,3 +2430,5 @@ animation effects Off معطّلةShown while the pointer is over a mark. يظهر أثناء وجود المؤشر فوق علامة.Opacity: العتامة:Make properties default جعل الخصائص افتراضية+ Pages selected الصفحات المحددة+ Page properties خصائص الصفحةdiff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsvindex 5ca1b844c..092a6a4f6 100644--- a/crates/ui-egui/src/i18n/bg.tsv+++ b/crates/ui-egui/src/i18n/bg.tsv@@ -2372,3 +2372,5 @@ animation effects Off ИзключениShown while the pointer is over a mark. Показва се, докато показалецът е над маркировка.Opacity: Непрозрачност:Make properties default Задаване като свойства по подразбиране+ Pages selected Избрани страници+ Page properties Свойства на страницатаdiff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsvindex 4fa7d1caa..5cb7adf8c 100644--- a/crates/ui-egui/src/i18n/cs.tsv+++ b/crates/ui-egui/src/i18n/cs.tsv@@ -2483,3 +2483,5 @@ animation effects Off VypnutoShown while the pointer is over a mark. Zobrazí se, když je ukazatel nad značkou.Opacity: Neprůhlednost:Make properties default Nastavit vlastnosti jako výchozí+ Pages selected Vybrané stránky+ Page properties Vlastnosti stránkydiff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsvindex 4544f1d26..134447ef6 100644--- a/crates/ui-egui/src/i18n/de.tsv+++ b/crates/ui-egui/src/i18n/de.tsv@@ -2410,3 +2410,5 @@ animation effects Off AusShown while the pointer is over a mark. Wird angezeigt, solange der Zeiger über einer Markierung ist.Opacity: Deckkraft:Make properties default Eigenschaften als Standard festlegen+ Pages selected Ausgewählte Seiten+ Page properties Seiteneigenschaftendiff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsvindex 53ab65748..23579181e 100644--- a/crates/ui-egui/src/i18n/el.tsv+++ b/crates/ui-egui/src/i18n/el.tsv@@ -2419,3 +2419,5 @@ animation effects Off ΑνενεργάShown while the pointer is over a mark. Εμφανίζεται όσο ο δείκτης είναι πάνω από μια σήμανση.Opacity: Αδιαφάνεια:Make properties default Ορισμός ιδιοτήτων ως προεπιλογή+ Pages selected Επιλεγμένες σελίδες+ Page properties Ιδιότητες σελίδαςdiff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsvindex ad0c9ccd4..dd92d23ad 100644--- a/crates/ui-egui/src/i18n/es.tsv+++ b/crates/ui-egui/src/i18n/es.tsv@@ -2549,3 +2549,5 @@ animation effects Off DesactivadosShown while the pointer is over a mark. Se muestra mientras el puntero está sobre una marca.Opacity: Opacidad:Make properties default Usar como propiedades predeterminadas+ Pages selected Páginas seleccionadas+ Page properties Propiedades de páginadiff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsvindex a4dedcc4a..8b72f117c 100644--- a/crates/ui-egui/src/i18n/fr.tsv+++ b/crates/ui-egui/src/i18n/fr.tsv@@ -2409,3 +2409,5 @@ animation effects Off DésactivésShown while the pointer is over a mark. Affichée tant que le pointeur survole une marque.Opacity: Opacité :Make properties default Définir comme propriétés par défaut+ Pages selected Pages sélectionnées+ Page properties Propriétés de la pagediff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsvindex 0b4257ecf..23916ebc7 100644--- a/crates/ui-egui/src/i18n/hu.tsv+++ b/crates/ui-egui/src/i18n/hu.tsv@@ -2408,3 +2408,5 @@ animation effects Off KiShown while the pointer is over a mark. Akkor látszik, amikor a mutató egy jelölés fölött van.Opacity: Átlátszatlanság:Make properties default Tulajdonságok beállítása alapértelmezettként+ Pages selected Kijelölt oldalak+ Page properties Oldaltulajdonságokdiff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsvindex 0e00e5e24..ff9da6446 100644--- a/crates/ui-egui/src/i18n/it.tsv+++ b/crates/ui-egui/src/i18n/it.tsv@@ -2418,3 +2418,5 @@ animation effects Off DisattivatiShown while the pointer is over a mark. Visibile mentre il puntatore è su un segno.Opacity: Opacità:Make properties default Imposta proprietà come predefinite+ Pages selected Pagine selezionate+ Page properties Proprietà paginadiff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsvindex 96888a6b5..c7c57af4f 100644--- a/crates/ui-egui/src/i18n/ja.tsv+++ b/crates/ui-egui/src/i18n/ja.tsv@@ -2409,3 +2409,5 @@ animation effects Off オフShown while the pointer is over a mark. ポインターがマーク上にあるときに表示されます。Opacity: 不透明度:Make properties default プロパティをデフォルトに設定+ Pages selected 選択したページ+ Page properties ページのプロパティdiff --git a/crates/ui-egui/src/i18n/kk.tsv b/crates/ui-egui/src/i18n/kk.tsvindex 4a8de1e93..659a40ab0 100644--- a/crates/ui-egui/src/i18n/kk.tsv+++ b/crates/ui-egui/src/i18n/kk.tsv@@ -2407,3 +2407,5 @@ animation effects Off ӨшіруліShown while the pointer is over a mark. Меңзер белгінің үстінде тұрғанда көрсетіледі.Opacity: Мөлдірсіздік:Make properties default Қасиеттерді әдепкі ету+ Pages selected Таңдалған беттер+ Page properties Бет қасиеттеріdiff --git a/crates/ui-egui/src/i18n/lt.tsv b/crates/ui-egui/src/i18n/lt.tsvindex 9bbf48cf5..24e6313e6 100644--- a/crates/ui-egui/src/i18n/lt.tsv+++ b/crates/ui-egui/src/i18n/lt.tsv@@ -2653,3 +2653,5 @@ key Space TarpasShown while the pointer is over a mark. Rodoma, kol žymeklis yra virš žymės.Opacity: Nepermatomumas:Make properties default Nustatyti ypatybes kaip numatytąsias+ Pages selected Pasirinkti puslapiai+ Page properties Puslapio ypatybėsdiff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsvindex 5214913f4..8371e3311 100644--- a/crates/ui-egui/src/i18n/pl.tsv+++ b/crates/ui-egui/src/i18n/pl.tsv@@ -2389,3 +2389,5 @@ animation effects Off WyłączoneShown while the pointer is over a mark. Widoczny, gdy wskaźnik jest nad znacznikiem.Opacity: Krycie:Make properties default Ustaw właściwości jako domyślne+ Pages selected Zaznaczone strony+ Page properties Właściwości stronydiff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsvindex be83ec262..3fba9b5ee 100644--- a/crates/ui-egui/src/i18n/pt-br.tsv+++ b/crates/ui-egui/src/i18n/pt-br.tsv@@ -2423,3 +2423,5 @@ animation effects Off DesativadosShown while the pointer is over a mark. Mostrada enquanto o ponteiro está sobre uma marca.Opacity: Opacidade:Make properties default Tornar propriedades padrão+ Pages selected Páginas selecionadas+ Page properties Propriedades da páginadiff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsvindex 56cc36121..4ebe6ab0a 100644--- a/crates/ui-egui/src/i18n/ru.tsv+++ b/crates/ui-egui/src/i18n/ru.tsv@@ -2322,3 +2322,5 @@ animation effects Off ВыклShown while the pointer is over a mark. Показывается, пока указатель над меткой.Opacity: Непрозрачность:Make properties default Сделать свойства стандартными+ Pages selected Выделенные страницы+ Page properties Свойства страницыdiff --git a/crates/ui-egui/src/i18n/sl.tsv b/crates/ui-egui/src/i18n/sl.tsvindex dc500c1dc..45445d431 100644--- a/crates/ui-egui/src/i18n/sl.tsv+++ b/crates/ui-egui/src/i18n/sl.tsv@@ -2414,3 +2414,5 @@ animation effects Off IzklopljeniShown while the pointer is over a mark. Prikazano, ko je kazalec nad oznako.Opacity: Prekrivnost:Make properties default Nastavi lastnosti kot privzete+ Pages selected Izbrane strani+ Page properties Lastnosti stranidiff --git a/crates/ui-egui/src/i18n/te.tsv b/crates/ui-egui/src/i18n/te.tsvindex 0067c1f9f..8a85d2158 100644--- a/crates/ui-egui/src/i18n/te.tsv+++ b/crates/ui-egui/src/i18n/te.tsv@@ -2322,3 +2322,5 @@ animation effects Off ఆఫ్Shown while the pointer is over a mark. పాయింటర్ గుర్తుపై ఉన్నప్పుడు కనిపిస్తుంది.Opacity: అపారదర్శకత:Make properties default లక్షణాలను డిఫాల్ట్గా చేయి+ Pages selected ఎంచుకున్న పేజీలు+ Page properties పేజీ లక్షణాలుdiff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsvindex 46e8e497b..b5ecfbac3 100644--- a/crates/ui-egui/src/i18n/tr.tsv+++ b/crates/ui-egui/src/i18n/tr.tsv@@ -2405,3 +2405,5 @@ animation effects Off KapalıShown while the pointer is over a mark. İşaretçi bir işaretin üzerindeyken gösterilir.Opacity: Opaklık:Make properties default Özellikleri varsayılan yap+ Pages selected Seçilen sayfalar+ Page properties Sayfa özellikleridiff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsvindex ae40a648d..c4972dbe9 100644--- a/crates/ui-egui/src/i18n/uk.tsv+++ b/crates/ui-egui/src/i18n/uk.tsv@@ -2431,3 +2431,5 @@ animation effects Off ВимкненоShown while the pointer is over a mark. Показується, поки вказівник над позначкою.Opacity: Непрозорість:Make properties default Зробити властивості типовими+ Pages selected Вибрані сторінки+ Page properties Властивості сторінкиdiff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsvindex 8b89fb92b..9a4866536 100644--- a/crates/ui-egui/src/i18n/zh-hans.tsv+++ b/crates/ui-egui/src/i18n/zh-hans.tsv@@ -2373,3 +2373,5 @@ animation effects Off 关Shown while the pointer is over a mark. 指针位于标记上方时显示。Opacity: 不透明度:Make properties default 将属性设为默认+ Pages selected 选定的页面+ Page properties 页面属性diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsvindex 7d65dbdb8..74d2b6cc0 100644--- a/crates/ui-egui/src/i18n/zh-hant.tsv+++ b/crates/ui-egui/src/i18n/zh-hant.tsv@@ -2365,3 +2365,5 @@ animation effects Off 關Shown while the pointer is over a mark. 指標位於標記上方時顯示。Opacity: 不透明度:Make properties default 將內容設為預設+ Pages selected 選取的頁面+ Page properties 頁面屬性diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rsindex a40e3e4b1..de3f22599 100644--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@ -128,6 +128,7 @@ pub(crate) const MAX_AUTHOR_CHARS: usize = 200;#[cfg(not(target_arch = "wasm32"))]mod open_worker;+mod organize_panel;pub mod portable;mod protect;mod recovery;diff --git a/crates/ui-egui/src/organize_panel.rs b/crates/ui-egui/src/organize_panel.rsnew file mode 100644index 000000000..a4c2e8cf7--- /dev/null+++ b/crates/ui-egui/src/organize_panel.rs@@ -0,0 +1,221 @@+//! Organize pages, laid out as Acrobat's panel: the pages selected (typed, or picked by kind from+//! its menu); page options as a row of icon buttons (rotate both ways, delete, extract) and Insert,+//! Replace, Split and Bates numbering; page setup (boxes, crop, transitions, templates, printing);+//! and page labels and properties. It shows whenever the page grid does, so every way into+//! Organize (the tool, the Edit panel, the command, `--organize`) gets the same controls, and the+//! grid's own toolbar keeps only moving pages, their size, Save pages and Close.+//!+//! The page actions queue on the view (`pending_edit`, `pending_action`) exactly as the grid's+//! toolbar did, so they run, refuse and undo the same way.++use egui::{Align2, CornerRadius, Rect, Sense, Stroke, vec2};+use pdfcraft_engine::Edit;++use crate::canvas::ViewAction;+use crate::theme::{self, Tokens};+use crate::{LeftPanel, PdfCraftApp, icons, widgets};++/// Whether the left panel is Organize pages: the tool is chosen, or the active view shows the grid.+pub(crate) fn showing(app: &PdfCraftApp) -> bool {+ app.left == LeftPanel::Tool("organize") || app.active.and_then(|i| app.views.get(i)).is_some_and(|v| v.organize)+}++/// The panel of the workspace Organize was opened from, shown again once Organize closes (by+/// its Close, the grid's Close, or opening a page from the grid): Edit's panel under the Edit+/// tab, as Acrobat goes back to the tool you came from, and All tools otherwise.+pub(crate) fn workspace_panel(mode: crate::Mode) -> LeftPanel {+ match mode {+ crate::Mode::Edit => LeftPanel::Tool("edit"),+ crate::Mode::Convert => LeftPanel::Tool("export"),+ crate::Mode::Sign => LeftPanel::Tool("fill_sign"),+ _ => LeftPanel::AllTools,+ }+}++/// What a row does once clicked.+enum Act {+ Edit(Box<Edit>),+ View(ViewAction),+ Command(&'static str),+}++pub(crate) fn panel(app: &mut PdfCraftApp, ui: &mut egui::Ui, t: &Tokens) {+ let Some((index, id)) = app.active_ids() else { return };+ let Some(doc) = app.session.get(id) else { return };+ let info = &doc.info;+ let editable = doc.allows_assembly();+ let n = info.pages.len();+ let mut act: Option<Act> = None;+ let mut back = false;+ let mut close = false;+ let Some(view) = app.views.get_mut(index) else { return };++ ui.horizontal(|ui| {+ if icons::button(ui, "chevron-left", 26.0, false, tl!("Back to all tools")).clicked() {+ back = true;+ }+ let title = tl!("Organize pages");+ let title_width = (ui.available_width() - 26.0 - ui.spacing().item_spacing.x).max(1.0);+ ui.add_sized([title_width, 26.0], egui::Label::new(egui::RichText::new(title).font(theme::semibold(15.5)).color(t.text)).truncate())+ .on_hover_text(title);+ if icons::button(ui, "x", 26.0, false, tl!("Close panel")).clicked() {+ close = true;+ }+ });+ ui.add_space(2.0);+ ui.separator();++ egui::ScrollArea::vertical().auto_shrink([false, false]).show(ui, |ui| {+ widgets::section_title(ui, tl!("Pages selected"));+ let current = view.current;+ let picked = view.organize_range.show(ui, &view.selected, n, current, |ui| {+ use pdfcraft_engine::{PageOrientation as O, PageParity as P, filter_pages};+ let all: Vec<usize> = (0..n).collect();+ let mut chosen = None;+ for (label, parity, orient) in [+ ("All pages", P::Both, O::Both),+ ("Even pages", P::Even, O::Both),+ ("Odd pages", P::Odd, O::Both),+ ("Landscape pages", P::Both, O::Landscape),+ ("Portrait pages", P::Both, O::Portrait),+ ] {+ if ui.button(tl!(label)).clicked() {+ chosen = Some(filter_pages(info, &all, parity, orient));+ }+ }+ if ui.button(tl!("None")).clicked() {+ chosen = Some(Vec::new());+ }+ chosen+ });+ if let Some(pages) = picked {+ view.select_pages(&pages);+ }++ let targets = view.target_pages();+ let last = targets.last().copied().unwrap_or(0);+ widgets::section_title(ui, tl!("Page options"));+ ui.add_enabled_ui(editable, |ui| {+ ui.horizontal(|ui| {+ ui.spacing_mut().item_spacing.x = 6.0;+ if icons::button(ui, "rotate-ccw", 34.0, false, tl!("Rotate counterclockwise")).clicked() {+ act = Some(Act::Edit(Box::new(Edit::RotatePages { pages: targets.clone(), degrees: -90 })));+ }+ if icons::button(ui, "rotate-cw", 34.0, false, tl!("Rotate clockwise")).clicked() {+ act = Some(Act::Edit(Box::new(Edit::RotatePages { pages: targets.clone(), degrees: 90 })));+ }+ // A document keeps at least one page.+ let can_delete = targets.len() < n;+ if ui.add_enabled_ui(can_delete, |ui| icons::button(ui, "trash-2", 34.0, false, tl!("Delete pages (Delete)"))).inner.clicked() {+ act = Some(Act::Edit(Box::new(Edit::DeletePages { pages: targets.clone() })));+ }+ if icons::button(ui, "file-output", 34.0, false, tl!("Extract pages to a new document")).clicked() {+ act = Some(Act::View(ViewAction::Extract));+ }+ });+ ui.add_space(2.0);+ // Insert ▸: a blank page, pages from a file, or copies of the selected pages.+ let insert = row(ui, t, "file-plus-2", tl!("Insert"), Availability::Ready, true);+ egui::Popup::menu(&insert).align(egui::RectAlign::RIGHT_START).gap(6.0).show(|ui| {+ if ui.button(tl!("Insert a blank page after the selection")).clicked() {+ let crop = info.pages.get(last).map_or([0.0, 0.0, 612.0, 792.0], |p| p.crop);+ let (w, h) = ((crop[2] - crop[0]).abs().max(1.0) as f64, (crop[3] - crop[1]).abs().max(1.0) as f64);+ act = Some(Act::Edit(Box::new(Edit::InsertBlankPage { at: last.saturating_add(1), width: w, height: h })));+ }+ if ui.button(tl!("Insert pages from a file…")).clicked() {+ act = Some(Act::View(ViewAction::InsertFromFile));+ }+ if ui.button(tl!("Duplicate pages")).clicked() {+ act = Some(Act::Command("page.duplicate"));+ }+ });+ if row(ui, t, "replace", tl!("Replace"), Availability::Ready, false).clicked() {+ act = Some(Act::View(ViewAction::ReplacePages));+ }+ if row(ui, t, "scissors", tl!("Split"), Availability::Ready, false).clicked() {+ act = Some(Act::View(ViewAction::Split));+ }+ });+ if row(ui, t, "hash", tl!("Bates numbering"), Availability::Ready, false).clicked() {+ act = Some(Act::Command("edit.bates"));+ }+ divider(ui, t);+ for (icon, label, availability, command) in [+ ("square-dashed-mouse-pointer", "Set page boxes", Availability::Ready, Some("page.boxes")),+ ("crop", "Crop pages", Availability::Ready, Some("page.crop")),+ ("presentation", "Page transitions", Availability::Later, Some("page.transitions")),+ ("file-text", "Page templates", Availability::Later, None),+ ("printer", "Print pages", Availability::Ready, Some("print.dialog")),+ ] {+ if row(ui, t, icon, tl!(label), availability, false).clicked()+ && let Some(command) = command+ {+ act = Some(Act::Command(command));+ }+ }+ divider(ui, t);+ if row(ui, t, "tag", tl!("Page labels"), Availability::Ready, false).clicked() {+ act = Some(Act::Command("page.number"));+ }+ row(ui, t, "info", tl!("Page properties"), Availability::Later, false);+ });++ if close {+ view.organize = false;+ app.left = workspace_panel(app.mode);+ } else if back {+ view.organize = false;+ app.left = LeftPanel::AllTools;+ app.mode = crate::Mode::AllTools;+ }+ match act {+ Some(Act::Edit(edit)) => view.pending_edit = Some(*edit),+ Some(Act::View(action)) => view.pending_action = Some(action),+ Some(Act::Command(command)) => app.run_command(command),+ None => {}+ }+}++/// Whether a row works in this build.+#[derive(Clone, Copy, PartialEq, Eq)]+enum Availability {+ Ready,+ /// Not in PdfCraft yet: shown muted, as Acrobat lists it, and says it is planned when hovered.+ Later,+}++/// One row of the panel: a monochrome icon and the label, as Acrobat draws them, with a corner+/// mark when it opens a menu.+fn row(ui: &mut egui::Ui, t: &Tokens, icon: &str, label: &str, availability: Availability, menu: bool) -> egui::Response {+ let ready = availability == Availability::Ready && ui.is_enabled();+ let (rect, resp) = ui.allocate_exact_size(vec2(ui.available_width(), 34.0), if ready { Sense::click() } else { Sense::hover() });+ resp.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::Button, ready, label));+ let press = theme::Press::track(ui, &resp);+ if ready {+ press.wash(ui, rect, 6, false);+ }+ let body = rect.translate(press.offset());+ let fg = if ready { t.text } else { t.text_faint };+ let icon_rect = Rect::from_min_size(body.min + vec2(6.0, 8.0), vec2(18.0, 18.0));+ icons::paint(ui, icon_rect, icon, 17.0, fg);+ let font = theme::regular(13.5);+ let width = crate::widgets::text_width(ui, label, &font);+ ui.painter().text(body.left_center() + vec2(34.0, 0.0), Align2::LEFT_CENTER, label, font, fg);+ if menu {+ // The small corner triangle Acrobat puts after a label that opens a menu.+ let tip = body.left_center() + vec2(34.0 + width + 6.0, 6.0);+ let tri = vec![tip, tip + vec2(-5.0, 0.0), tip + vec2(0.0, -5.0)];+ ui.painter().add(egui::Shape::convex_polygon(tri, fg, Stroke::NONE));+ }+ match availability {+ Availability::Ready => theme::hand(resp),+ Availability::Later => resp.on_hover_text(tl!("Planned")),+ }+}++fn divider(ui: &mut egui::Ui, t: &Tokens) {+ ui.add_space(6.0);+ let (r, _) = ui.allocate_exact_size(vec2(ui.available_width(), 1.0), Sense::hover());+ ui.painter().rect_filled(r, CornerRadius::ZERO, t.divider);+ ui.add_space(6.0);+}diff --git a/crates/ui-egui/src/page_selection_ui.rs b/crates/ui-egui/src/page_selection_ui.rsindex 87340f6f7..0907232f7 100644--- a/crates/ui-egui/src/page_selection_ui.rs+++ b/crates/ui-egui/src/page_selection_ui.rs@@ -58,7 +58,17 @@ fn formatted(pages: &BTreeSet<usize>) -> String {}impl PageSelectionInput {- pub(crate) fn show(&mut self, ui: &mut egui::Ui, selected: &BTreeSet<usize>, count: usize) -> Option<Vec<usize>> {+ /// The field, as Acrobat's Pages selected: typed pages apply on Enter or when the field loses+ /// focus, and the chevron opens `menu` (pages by kind), whose choice is returned the same way.+ /// With nothing selected it shows the current page (0-based `current`), which actions apply to.+ pub(crate) fn show(+ &mut self,+ ui: &mut egui::Ui,+ selected: &BTreeSet<usize>,+ count: usize,+ current: usize,+ menu: impl FnOnce(&mut egui::Ui) -> Option<Vec<usize>>,+ ) -> Option<Vec<usize>> {if self.selection != *selected {self.selection.clone_from(selected);self.text = formatted(selected);@@ -75,14 +85,28 @@ impl PageSelectionInput {self.error = None;ui.memory_mut(|m| m.surrender_focus(id));}+ let mut chosen = None;ui.horizontal(|ui| {let label = tl!("Selected pages");- ui.label(label);- let field = ui.add(egui::TextEdit::singleline(&mut self.text).id(id).desired_width(300.0).char_limit(16_384).hint_text("1, 12, 16-18"));+ let width = (ui.available_width() - 32.0).max(40.0);+ let field = ui.add(+ egui::TextEdit::singleline(&mut self.text)+ .id(id)+ .desired_width(width)+ .char_limit(16_384)+ .hint_text(current.saturating_add(1).to_string()),+ );field.widget_info(|| egui::WidgetInfo::labeled(egui::WidgetType::TextEdit, ui.is_enabled(), label));- let apply = ui.button(tl!("Apply")).clicked();- commit = ui.is_enabled() && !cancel && (field.lost_focus() || apply);+ commit = ui.is_enabled() && !cancel && field.lost_focus();+ let pick = crate::icons::button(ui, "chevron-down", 26.0, false, tl!("Select pages"));+ chosen = egui::Popup::menu(&pick).show(menu).and_then(|r| r.inner);});+ if let Some(pages) = chosen {+ self.selection = pages.iter().copied().collect();+ self.text = formatted(&self.selection);+ self.error = None;+ return Some(pages);+ }if cancel {self.text = formatted(selected);self.error = None;diff --git a/crates/ui-egui/src/panels.rs b/crates/ui-egui/src/panels.rsindex 536a47575..411403039 100644--- a/crates/ui-egui/src/panels.rs+++ b/crates/ui-egui/src/panels.rs@@ -16,9 +16,16 @@ fn hue(g: &ToolGroup) -> Color32 {pub fn left_panel(app: &mut PdfCraftApp, ui: &mut egui::Ui) {let t = Tokens::get(ui.ctx());+ // Organize closed another way (the grid's Close, or a page opened from it) closes the tool too,+ // as its panel's Close does, back to the workspace's own panel.+ if app.left == LeftPanel::Tool("organize") && app.active.and_then(|i| app.views.get(i)).is_some_and(|v| !v.organize) {+ app.left = crate::organize_panel::workspace_panel(app.mode);+ }egui::Frame::NONE.fill(t.panel).inner_margin(egui::Margin { left: 14, right: 10, top: 12, bottom: 10 }).stroke(Stroke::new(1.0, t.divider)).show(ui,|ui| match app.left {+ // Organize pages has its own panel whenever the grid shows (with a document open).+ _ if app.active.is_some() && crate::organize_panel::showing(app) => crate::organize_panel::panel(app, ui, &t),LeftPanel::AllTools => all_tools(app, ui, &t),LeftPanel::Tool(id) => match catalog::group(id) {Some(g) => tool_detail(app, ui, &t, g),diff --git a/crates/ui-egui/tests/editing.rs b/crates/ui-egui/tests/editing.rsindex 386738aeb..fee644d62 100644--- a/crates/ui-egui/tests/editing.rs+++ b/crates/ui-egui/tests/editing.rs@@ -56,6 +56,13 @@ fn organize(pages: usize) -> Harness<'static, PdfCraftApp> {harness(pages, |app| app.set_option("organize", "on").unwrap())}+/// Organize pages ▸ Insert ▸ `item`.+fn insert_menu(h: &mut Harness<'static, PdfCraftApp>, item: &str) {+ h.get_by_label("Insert").click();+ h.run_steps(2);+ h.get_by_label(item).click();+}+fn type_selection(h: &mut Harness<'static, PdfCraftApp>, text: &str) {use egui::accesskit::Role;h.get_by_role_and_label(Role::TextInput, "Selected pages").click();@@ -114,7 +121,7 @@ fn organize_page_range_rejects_invalid_input_and_escape_cancels_without_clearingassert_eq!(h.state().views[0].target_pages(), [1, 2]);assert_eq!(h.get_by_role_and_label(Role::TextInput, "Selected pages").value().as_deref(), Some("2-3"));type_selection(&mut h, "5, 4, 4");- h.get_by_label("Apply").click();+ h.key_press(Key::Enter);h.run_steps(2);assert_eq!(h.state().views[0].target_pages(), [3, 4]);type_selection(&mut h, " ");@@ -481,7 +488,7 @@ fn insert_blank_page_after_selection() {let mut h = organize(2);h.get_by_label("Page 1").click();h.run_steps(1);- h.get_by_label("Insert a blank page after the selection").click();+ insert_menu(&mut h, "Insert a blank page after the selection");h.run_steps(3);assert_eq!(page_texts(h.state()), ["Page 1", "", "Page 2"]);let app = h.state();@@ -1538,7 +1545,7 @@ fn replace_button_replaces_selected_pages_in_organize() {h.get_by_label("Page 3").click_modifiers(Modifiers::COMMAND);h.run_steps(2);h.state_mut().pick_override = Some(vec![other.to_string_lossy().into_owned()]);- h.get_by_label("Replace pages…").click();+ h.get_by_label("Replace").click();h.run_steps(3);egui_kittest::kittest::Queryable::get_by_label(&h, "Replace Pages");assert_eq!(h.state().replace_draft.as_ref().unwrap().from, 2);@@ -1648,7 +1655,7 @@ fn plus_between_pages_inserts_picked_files_there_in_order() {// The toolbar button still inserts after the selection, not at the last "+" used.h.get_by_label("Page 2").click();h.run_steps(2);- h.get_by_label("Insert pages from a file…").click();+ insert_menu(&mut h, "Insert pages from a file…");h.run_steps(4);assert_eq!(texts_of(h.state(), 0), ["a note", "Page 1", "a note", "Page 2", "Page 3", "a note"]);// A file that can't be converted changes nothing.@@ -1914,10 +1921,10 @@ fn split_dialog_writes_one_file_per_part() {let d = dir.to_string_lossy().into_owned();let mut h = organize(3);h.state_mut().export_dir_override = Some(d);- h.get_by_label("Split into files…").click();+ h.get_all_by_label("Split").last().unwrap().click();h.run_steps(3);h.get_by_label_contains("Creates 3 files from 3 pages");- h.get_by_label("Split").click();+ h.get_all_by_label("Split").last().unwrap().click();h.run_steps(3);let mut names: Vec<String> = std::fs::read_dir(&dir).unwrap().map(|e| e.unwrap().file_name().to_string_lossy().into_owned()).collect();names.sort();@@ -1943,7 +1950,7 @@ fn split_at_bookmarks_with_equal_titles_keeps_every_part() {h.state_mut().run_command("page.split");h.run_steps(3);h.get_by_label_contains("Creates 3 files from 3 pages");- h.get_by_label("Split").click();+ h.get_all_by_label("Split").last().unwrap().click();h.run_steps(3);let mut names: Vec<String> = std::fs::read_dir(&dir).unwrap().map(|e| e.unwrap().file_name().to_string_lossy().into_owned()).collect();names.sort();@@ -1963,7 +1970,7 @@ fn split_before_selected_pages() {h.state_mut().run_command("page.split");h.run_steps(3);h.get_by_label_contains("Creates 2 files from 4 pages");- h.get_by_label("Split").click();+ h.get_all_by_label("Split").last().unwrap().click();h.run_steps(3);let mut names: Vec<String> = std::fs::read_dir(&dir).unwrap().map(|e| e.unwrap().file_name().to_string_lossy().into_owned()).collect();names.sort();@@ -4424,3 +4431,45 @@ fn cropping_a_picture_with_its_handles() {assert_eq!(doc.page_images(0)[0].visible_rect.unwrap(), v);assert!(h.state().views[0].image_selection.as_ref().is_none_or(|s| s.crop.is_none()));}++/// Organize pages has Acrobat's panel whenever the grid shows, however it was opened, and the+/// panel's Close ends Organize: the grid closes and All tools comes back.+#[test]+fn organize_panel_comes_with_the_grid_and_closes_it() {+ let mut h = organize(3);+ h.get_by_label("Insert");+ h.get_by_label("Bates numbering");+ h.get_by_label("Page properties");+ h.get_by_label("Close panel").click();+ h.run_steps(3);+ assert!(!h.state().views[0].organize, "Close ends Organize");+ assert_eq!(h.state().left, pdfcraft_ui_egui::LeftPanel::AllTools);+ assert!(h.query_by_label("Page properties").is_none(), "the panel is gone");+}++/// Leaving Organize (a page opened from the grid, or the grid's Close) goes back to the+/// workspace's panel: under the Edit tab, the Edit panel, not All tools.+#[test]+fn leaving_organize_goes_back_to_the_workspace_panel() {+ use pdfcraft_ui_egui::{LeftPanel, Mode};+ let mut h = harness(3, |_| {});+ h.state_mut().mode = Mode::Edit;+ h.state_mut().left = LeftPanel::Tool("edit");+ h.run_steps(2);+ h.state_mut().left = LeftPanel::Tool("organize");+ h.state_mut().views[0].organize = true;+ h.run_steps(3);+ h.get_by_label("Pages selected".to_uppercase().as_str());+ // What opening a page from the grid does.+ h.state_mut().views[0].organize = false;+ h.run_steps(3);+ assert_eq!(h.state().left, LeftPanel::Tool("edit"), "back to the Edit panel");+ // The same from All tools goes back to All tools.+ h.state_mut().mode = Mode::AllTools;+ h.state_mut().left = LeftPanel::Tool("organize");+ h.state_mut().views[0].organize = true;+ h.run_steps(3);+ h.state_mut().views[0].organize = false;+ h.run_steps(3);+ assert_eq!(h.state().left, LeftPanel::AllTools);+}diff --git a/parity/acrobat-features.toml b/parity/acrobat-features.tomlindex d0d0564c3..e1113195e 100644--- a/parity/acrobat-features.toml+++ b/parity/acrobat-features.toml@@ -2622,6 +2622,8 @@ commands = ["page.organize"]tools = []evidence = ["crates/ui-egui/tests/editing.rs::shift_click_selects_a_range_and_moves_it", "crates/ui-egui/tests/editing.rs::organize_tool_opens_the_overview_directly_and_can_be_reentered", "crates/ui-egui/tests/editing.rs::organize_opens_on_the_current_page", "crates/ui-egui/tests/control.rs::organize_overview_is_reachable_through_the_control_channel"]notes = "Opening the Organize pages tool enters the overview directly, on the current page: selected and scrolled into view (#1910). Hovered, focused and selected pages expose individual rotate/delete actions; the toolbar acts on the selection."+evidence = ["crates/ui-egui/tests/editing.rs::shift_click_selects_a_range_and_moves_it", "crates/ui-egui/tests/editing.rs::organize_tool_opens_the_overview_directly_and_can_be_reentered", "crates/ui-egui/tests/control.rs::organize_overview_is_reachable_through_the_control_channel", "crates/ui-egui/tests/editing.rs::organize_panel_comes_with_the_grid_and_closes_it", "crates/ui-egui/tests/editing.rs::leaving_organize_goes_back_to_the_workspace_panel"]+notes = "Opening the Organize pages tool enters the overview directly. Hovered, focused and selected pages expose individual rotate/delete actions; the toolbar acts on the selection. The left panel is laid out as Acrobat's Organize pages panel: Pages selected (typed ranges, or All, Even, Odd, Landscape or Portrait pages; empty, it shows the current page), rotate, delete, extract, Insert (a blank page, pages from a file, duplicates), Replace, Split, Bates numbering, Set page boxes, Crop pages, Print pages and Page labels. Closing it, by its Close, the grid's Close or opening a page, returns to the workspace's own panel (Edit, Convert, E-Sign or All tools). Page transitions, Page templates and Page properties are listed but planned."[[feature]]id = "organize.multi-select-pages"