Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 33 additions & 33 deletions ATTRIBUTION.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "1902f1c31698e6adfdaf65b35b1fe1628f5cd2bd0182dd3b99bcf5e21720f394"
sha256 = "21e5837f3d81181d5a9c4eb97bb9b110c12be9a72177dea9bdbd748c4444fada"

# 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`).
Expand All @@ -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 = "2e23c41fcd5b9118cfde03b3a45aa2f988f7eeba650677b6f1f6664e543c7a59"
sha256 = "f827a651f32735fae425d4f09f5d79d31690cb693d00a15787eae40ec4ad8c70"

[[asset]]
path = "crates/ui-egui/src/i18n/zh-hant.tsv"
Expand All @@ -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 = "105703f2fbc07c0663308ebd6852199de12a5851a37507d7e51e477eb5e57218"
sha256 = "288bcd840dfe2d669081a50914e65532933798c09bd617fbccf1387235ca3ddb"

[[asset]]
path = "crates/ui-egui/src/i18n/cs.tsv"
Expand All @@ -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 = "b08f8282923d2faaf1f658d2aff8f71fe5f2d3a33e792eeb50fb0e2b396ef24f"
sha256 = "783bbf5a92c43fbdc50aa13954e9b19619d10ac2f7b997ea67bb95ab6a5e5044"

[[asset]]
path = "crates/ui-egui/src/i18n/pt-br.tsv"
Expand All @@ -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 = "df17dada3df736e75bd9b03e5ecceec164cce63767e33a1efdb98c56a121c890"
sha256 = "aa81de9ff38d5cde0216ae67cc93904a2078b3d538efd212c9634912d502baad"

[[asset]]
path = "crates/ui-egui/src/i18n/es.tsv"
Expand All @@ -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 = "8e8c0cfda0886c584e5286370ec00814206c3af3699c76665e636fa6fdb6310b"
sha256 = "79c7e584e7e893930ca0d47c29122ecce54c4f07dd0712e06d99153e718f06a6"

[[asset]]
path = "crates/ui-egui/src/i18n/fr.tsv"
Expand All @@ -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 = "3f31e5c9abdb0208d48d8c68aa81437d9d1e10aeb615dedf811fefa539d93279"
sha256 = "1b44167d284c596f8bb2167006cbd9f1aa883b3bdaecb90c746d857294535741"

[[asset]]
path = "crates/ui-egui/src/i18n/de.tsv"
Expand All @@ -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 = "815a3a672421cc3590fb1f267755316659cdb2046e30bbb3ad8b31e96f08b20a"
sha256 = "c0b0c34d0892b25e01010f5278800741a695ac404c8aaa610d7bf815dcf6865b"

[[asset]]
path = "crates/ui-egui/src/i18n/lo.tsv"
Expand All @@ -107,7 +107,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Lao UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "6bd67286795ed487eedf2ce549249c8a83286cb4273490c1349996050b540fed"
sha256 = "fc37663f058a6c94a9d91b6ce2cd3cf96e8a912ab7a53bbc5a862dbfb56d9fee"

[[asset]]
path = "crates/ui-egui/src/i18n/te.tsv"
Expand All @@ -118,7 +118,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 = "9cd63425705fb9a3aa029ff3a5110d0877a34f9038f1d64a2102ccd6c3cb35a6"
sha256 = "876b9b7d7556a041dca6816ecc2dcf6403ae04da4dd0db322907cb2c14310990"

[[asset]]
path = "crates/ui-egui/src/i18n/it.tsv"
Expand All @@ -129,7 +129,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 = "76f138293fc12ea3584568a81f6f90a1cedfff6256e78b4f60cb21b1b66bbba4"
sha256 = "f7f2c21a5b5a28f575f9bada7ed2dfe6451446ae680a72dadf91dd44545af76c"

[[asset]]
path = "crates/ui-egui/src/i18n/pl.tsv"
Expand All @@ -140,7 +140,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 = "0bd75a93f8d18deb832223bd0642cc4f4abde04a322b684a143a9d4b4687a344"
sha256 = "1a360ee98c0a4ea82e93059b7ee0238131fd4d612f9dc0f459eb8580e7be98c6"

[[asset]]
path = "crates/ui-egui/src/i18n/ru.tsv"
Expand All @@ -151,7 +151,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 = "3d539a28afcf8c2e36b7087ac23334b50bac7971e03da20a62b6e7e400763a87"
sha256 = "f03eba8a13c2015b79a5bc5139ab761ee46295a75fbfc427b0c7203c34ad26bf"

[[asset]]
path = "crates/ui-egui/src/i18n/hu.tsv"
Expand All @@ -162,7 +162,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 = "71b7e8180fc759aebad4660953ab8b55383def0572c1ace2288cd8bfeb1b82dc"
sha256 = "b4174126d5bc71029dddf9e849c8b35c288e7a7ccb6b9bdae83473a3d51bd124"

[[asset]]
path = "crates/ui-egui/src/i18n/bg.tsv"
Expand All @@ -173,7 +173,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 = "e689fb24a8acfa7e85f0f60644f7e2da1225595e6cd6a94109fbe86082926244"
sha256 = "945328a414ae7df3dd33c27d608d95da0409cbdeae9c857a1e80513ab1912191"

[[asset]]
path = "crates/ui-egui/src/i18n/kk.tsv"
Expand All @@ -184,7 +184,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 = "c601ea117ec2a3cdba606fdc9a62220fcffbd0c20c1133bacb653a979cf046a5"
sha256 = "19dc80542c6bd0dea87991b09d04f42abe618094c0ca5ed30815b71378aa42fe"

[[asset]]
path = "crates/ui-egui/src/i18n/ja.tsv"
Expand All @@ -195,7 +195,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 = "006867b891ae2f995c7a711e55b6401db29d20ab493889c6284dc3671f9faa2d"
sha256 = "f21665a4d74cc8f84049ad863d01577e9aed61d814dc1be1ee3499effcab1b36"

[[asset]]
path = "crates/ui-egui/src/i18n/uk.tsv"
Expand All @@ -206,7 +206,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 = "9e5b18a09c209525cf08ef53a242ed457cfa346295eef7facde482a75cf72f52"
sha256 = "5bf2f2e61305bf3443b3f30bcffd38b829441862ba0f2fa478a32d4fcaf445ab"

[[asset]]
path = "crates/ui-egui/src/i18n/ar.tsv"
Expand All @@ -217,7 +217,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 = "2306dbbe6a73671fd20df116adb159a7f66c85fbbd1bae5ecef5f6e882d6b7f1"
sha256 = "3573ecaa9372a25852d91675230c087225f65ddf3992c712461e215cc9d63b6c"

[[asset]]
path = "crates/ui-egui/src/i18n/ckb.tsv"
Expand All @@ -228,7 +228,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Central Kurdish UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "864db8aa0a5e443c92e7e388f89349eb0f0e7beda35a0b81695d864dcec51b72"
sha256 = "32305181418aaa4827da2ce54eb65e4c69a28466d4a064a9e940cd4a7c56dd03"

[[asset]]
path = "crates/ui-egui/src/i18n/tr.tsv"
Expand All @@ -239,7 +239,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 = "463a2d28bd5c5ac8df31a5b5c68400d7a61ce51237a58d9337078c973e6f9e3d"
sha256 = "323396ff9769920eec762432dd8f7128d14b8bcbce2bb8d3ed4360030b0d8ac0"

[[asset]]
path = "crates/ui-egui/src/i18n/lt.tsv"
Expand All @@ -250,7 +250,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 = "bbef7f4e16f83e9e0116278e7a0a175bad79757f96a18dc639516572533f6d5b"
sha256 = "8e75435a8f14443221c3acd421a154d4ba72528e819373c62820970c960e09b7"

[[asset]]
path = "crates/ui-egui/src/i18n/hi.tsv"
Expand All @@ -261,7 +261,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Hindi UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "09d2840c02b40a6049b86c2cb68151d863913e8c91c22226f25d07496c6366aa"
sha256 = "83b3f19a97c5fca25db1dc10a68ca5a6183812c6fc74a856d1ab6b93110f2a11"
[[asset]]
path = "crates/ui-egui/src/i18n/id.tsv"
title = "Indonesian interface translation catalog"
Expand All @@ -271,7 +271,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Indonesian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "0dc1abdb262e4568f19ffb2233bfeb3686ae42df8a8d8bec2951351a50e6a886"
sha256 = "5153a4b742b9437dbf9fccec790657016115b6352dc8765b1b5b6a6dd4487f9f"
[[asset]]
path = "crates/ui-egui/src/i18n/ko.tsv"
title = "Korean interface translation catalog"
Expand All @@ -281,7 +281,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Korean UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "a3e67cee4f3fff776e816523f810b2bb6353235dbdf85181c3f12896604a3339"
sha256 = "1c86bad1125f3c95edcc1c29ec9e5a28b85c09a1866b039ad4e8e2a429de9ffd"

[[asset]]
path = "crates/ui-egui/src/i18n/ro.tsv"
Expand All @@ -292,7 +292,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Romanian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "00a2153c20a191fbe04f1ce61f140fd9628cfe2f8f75dad5bce8a7406e1bd091"
sha256 = "30dd2c831857a3d20c0305818c3947b4806b3865017be3f83ed3ab748344390f"


[[asset]]
Expand All @@ -304,7 +304,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Finnish UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "609efa92054aa76de4bb6062c0fcc0a8b450519f4b253b4c0f395b3cbb34d2ba"
sha256 = "8ebc871eabd72eac7f29912a5b7c53017507ac8816fe0ffa32b33983fc5dbac5"

[[asset]]
path = "assets/icons/accessibility.svg"
Expand Down Expand Up @@ -3426,7 +3426,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Vietnamese UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "57f0dd007ad16518fbc87d8aeac840ef6d86412bb460aff9fb17b176408fb7a8"
sha256 = "863e942f244510c78c0fe166859b8b013e8fb9aa2a0715b507bbf2d98b0ac293"

[[asset]]
path = "crates/ui-egui/src/i18n/sl.tsv"
Expand All @@ -3437,7 +3437,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 = "a3b8351f0da80c2d394221dbe5d62e794bb019c74c2adfc5d933d999f7d3236f"
sha256 = "a8ac2085613e82b021c76abf0ff17dc8fb7bf45fd2be84b71784aa2d6e7b9aae"

[[asset]]

Expand All @@ -3460,7 +3460,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Norwegian Bokmål UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "03477c4ab2d0d52543cb91b3aec6f27b2689e6b9bb7c95bbb8463664c75a9dc0"
sha256 = "2cea89a44bc52a319818a719dd55357947b3f9416e35f644f165bd39aff16046"

[[asset]]
path = "assets/icons/superscript.svg"
Expand Down Expand Up @@ -3515,7 +3515,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Albanian UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "ebd177262d8fe20f960f06df084f8a03c9504bcd9990dded3a006e35bd8ef7c9"
sha256 = "4779ba4d88d8e373dd2f0c326c7b085bd5d19ca5fd5def7485b7587f4eb09ce1"

[[asset]]
path = "crates/ui-egui/src/i18n/th.tsv"
Expand All @@ -3526,7 +3526,7 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Thai UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "1dbb66c05af0aec06d5a6fa154e89f1684203dde32c8e8aedd9aeec6c2d5ae02"
sha256 = "85c25970083aa13d48b2a92be46fdc642a016eddd365ae51dd688177e47ca621"

[[asset]]
path = "crates/ui-egui/src/i18n/ca.tsv"
Expand All @@ -3537,4 +3537,4 @@ licence = "MIT OR Apache-2.0"
licence_file = "LICENSE-MIT"
kind = "translation"
usage = "Catalan UI strings, compiled in by crates/ui-egui/src/i18n/mod.rs"
sha256 = "5879ee3540ffb630fc83d0f2cb293cc6cbf2e081ea4577161a770794e8cbd22c"
sha256 = "58f5717d0a10e8ab9f1a8de871a2679ea9eccc5d1efed82075b9d1eeb3c39bb6"
11 changes: 11 additions & 0 deletions crates/edit/src/images.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,17 @@ fn crop_image(

/// Plan all transforms before changing a stream; indexes refer to the original inventory.
/// Splice only the chosen Do operators and preserve all other bytes and stream dictionaries.
/// Delete images `indexes` (from [`page_images`]) on `page`, the last first so the indexes of
/// the others still hold.
pub(crate) fn delete_images(doc: &mut Document, page: usize, indexes: &[usize]) -> Result<(), EditError> {
let mut indexes = indexes.to_vec();
indexes.sort_unstable_by(|a, b| b.cmp(a));
for index in indexes {
change_image(doc, page, index, &ImageChange::Delete)?;
}
Ok(())
}

pub(crate) fn translate_images(doc: &mut Document, page: usize, indexes: &[usize], offset: [f64; 2]) -> Result<(), EditError> {
if indexes.is_empty() {
return Ok(());
Expand Down
2 changes: 1 addition & 1 deletion crates/edit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ pub fn marks_present(doc: &Document) -> Vec<MarkKind> {
mod background;
pub use background::page_background;
pub mod objects;
pub use objects::{EditableObject, MAX_MOVE_OBJECTS, ObjectKind, ObjectTarget, editable_objects, move_objects};
pub use objects::{EditableObject, MAX_MOVE_OBJECTS, ObjectKind, ObjectTarget, delete_objects, editable_objects, move_objects};

mod flatten;
pub use flatten::{flatten, flatten_fill_sign};
Expand Down
32 changes: 32 additions & 0 deletions crates/edit/src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,38 @@ pub fn move_objects(doc: &mut Document, page: usize, targets: &[ObjectTarget], o
Ok(())
}

/// Delete selected mixed objects as one atomic operation: paragraphs leave the page with their
/// text, images and added items go as their own Delete does. All targets refer to the original
/// inventories. A refusal leaves the document untouched.
pub fn delete_objects(doc: &mut Document, page: usize, targets: &[ObjectTarget]) -> Result<(), EditError> {
if targets.is_empty() || targets.len() > MAX_MOVE_OBJECTS {
return Err(EditError::Invalid("select between 1 and 1000 objects to delete".into()));
}
let inventory: BTreeSet<_> = editable_objects(doc, page)?.into_iter().map(|o| o.target).collect();
let mut unique = BTreeSet::new();
for target in targets {
if !unique.insert(*target) {
return Err(EditError::Invalid("an object was selected more than once".into()));
}
if !inventory.contains(target) {
return Err(EditError::Invalid("a selected object no longer exists; select the objects again".into()));
}
}
let indexes = |kind| targets.iter().filter(|t| t.kind == kind).map(|t| t.index).collect::<Vec<_>>();
let mut work = doc.clone();
// Paragraphs and images are found by their operations, which the added items' removal
// doesn't renumber; added items go last, the highest index first.
crate::text::delete_blocks(&mut work, page, &indexes(ObjectKind::Text))?;
crate::images::delete_images(&mut work, page, &indexes(ObjectKind::Image))?;
let mut added = indexes(ObjectKind::Added);
added.sort_unstable_by(|a, b| b.cmp(a));
for index in added {
crate::delete_content(&mut work, page, index)?;
}
*doc = work;
Ok(())
}

struct AddedGeometry {
rect: [f64; 4],
local_rect: [f64; 4],
Expand Down
Loading