diff --git a/crates/engine/src/doc_state.rs b/crates/engine/src/doc_state.rs index 0ef7555e02..10d21266ba 100644 --- a/crates/engine/src/doc_state.rs +++ b/crates/engine/src/doc_state.rs @@ -55,6 +55,11 @@ pub struct DocState { pub recalled_selection: RecalledSelection, /// Process-unique id of this open document (tab indices shift when tabs close). pub uid: u64, + /// How many times File → Revert replaced the document's content in its tab + /// ([`Session::replace_document`]). Work started for the document (a file read for Place, a + /// pasted bitmap) is dropped when this has changed by the time it finishes; edits do not + /// change it, and a batch that fails puts it back with the document. + pub reverts: u64, /// Preferences › User Interface › Open Documents As Tabs when the document opened: cleared, /// the UI opens it in a floating window of its own. pub opened_as_tab: bool, @@ -313,6 +318,7 @@ impl DocState { last_selection_cmd: None, recalled_selection: RecalledSelection::default(), uid: NEXT_DOC_UID.fetch_add(1, std::sync::atomic::Ordering::Relaxed), + reverts: 0, opened_as_tab: true, mask_view: None, spelling_ignored: Default::default(), diff --git a/crates/engine/src/session/documents.rs b/crates/engine/src/session/documents.rs index 0d472ef81d..8c919434fc 100644 --- a/crates/engine/src/session/documents.rs +++ b/crates/engine/src/session/documents.rs @@ -370,6 +370,8 @@ impl Session { st.history.limit = old.history.limit; // Same open document (caches keyed by uid stay valid); a new revision redraws it. st.uid = old.uid; + // Work started for the content being thrown away is dropped when it finishes. + st.reverts = old.reverts + 1; st.opened_as_tab = old.opened_as_tab; st.revision = old.revision + 1; st.format = old.format; diff --git a/crates/ui-egui/src/i18n/bg.tsv b/crates/ui-egui/src/i18n/bg.tsv index 708ffe9db6..29b9a7e5b3 100644 --- a/crates/ui-egui/src/i18n/bg.tsv +++ b/crates/ui-egui/src/i18n/bg.tsv @@ -4128,6 +4128,9 @@ axis Both И двете @msg Couldn't open {name}: {e} Неуспешно отваряне на {name}: {e} @msg Couldn't place {name}: the document it was dropped on was closed Неуспешно поставяне на {name}: документът, върху който беше пуснат, е затворен @msg Couldn't place {name}: the document it was placed in was closed Неуспешно поставяне на {name}: документът, в който се поставяше, е затворен +@msg Couldn't place {name}: the document it was dropped on was reverted Неуспешно поставяне на {name}: документът, върху който беше пуснат, е върнат към запазеното +@msg Couldn't place {name}: the document it was placed in was reverted Неуспешно поставяне на {name}: документът, в който се поставяше, е върнат към запазеното +@msg Couldn't paste: the document it was pasted in was reverted Неуспешно поставяне: документът, в който се поставяше, е върнат към запазеното @msg Couldn't read {name}: {e} Неуспешно четене на {name}: {e} @msg Couldn't save recovery data: {e} Неуспешно запазване на данните за възстановяване: {e} @msg Create Outlines: select text objects Създаване на контури: изберете текстови обекти diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 8f5ea73487..a4b007a28b 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -4492,6 +4492,9 @@ imageTrace Outline Obris @msg Couldn't open {name}: {e} Nije moguće otvoriti {name}: {e} @msg Couldn't place {name}: the document it was dropped on was closed Nije moguće postaviti {name}: dokument na koji je ispušten je zatvoren @msg Couldn't place {name}: the document it was placed in was closed Nije moguće postaviti {name}: dokument u koji je postavljen je zatvoren +@msg Couldn't place {name}: the document it was dropped on was reverted Nije moguće postaviti {name}: dokument na koji je ispušten je vraćen na sačuvano +@msg Couldn't place {name}: the document it was placed in was reverted Nije moguće postaviti {name}: dokument u koji je postavljen je vraćen na sačuvano +@msg Couldn't paste: the document it was pasted in was reverted Nije moguće zalijepiti: dokument u koji se lijepilo je vraćen na sačuvano @msg Couldn't read {name}: {e} Nije moguće pročitati {name}: {e} @msg Couldn't save recovery data: {e} Nije moguće sačuvati podatke za oporavak: {e} @msg Create Outlines: select text objects Kreiraj obrise: odaberite tekstualne objekte diff --git a/crates/ui-egui/src/i18n/ca.tsv b/crates/ui-egui/src/i18n/ca.tsv index 5516c9662f..871e750b7f 100644 --- a/crates/ui-egui/src/i18n/ca.tsv +++ b/crates/ui-egui/src/i18n/ca.tsv @@ -5521,6 +5521,9 @@ digits Malayalam Malaiàlam @msg Couldn't paste: the document it was pasted in was closed No s’ha pogut enganxar: el document on s’enganxava s’ha tancat @msg Couldn't place {name}: the document it was dropped on was closed No s’ha pogut col·locar {name}: el document on es va deixar anar estava tancat @msg Couldn't place {name}: the document it was placed in was closed No s’ha pogut col·locar {name}: el document on es va col·locar estava tancat +@msg Couldn't place {name}: the document it was dropped on was reverted No s’ha pogut col·locar {name}: el document on es va deixar anar s’ha revertit +@msg Couldn't place {name}: the document it was placed in was reverted No s’ha pogut col·locar {name}: el document on es va col·locar s’ha revertit +@msg Couldn't paste: the document it was pasted in was reverted No s’ha pogut enganxar: el document on s’enganxava s’ha revertit @msg Couldn't place {name}: {e} No s’ha pogut col·locar {name}: {e} @msg Couldn't read {name}: {e} No s’ha pogut llegir {name}: {e} @msg Couldn't save recovery data: {e} No s’han pogut desar les dades de recuperació: {e} diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index d03d192a3a..992b85b89d 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -4649,6 +4649,9 @@ imageTrace Outline Obrys @msg Couldn't open {name}: {e} {name} nelze otevřít: {e} @msg Couldn't place {name}: the document it was dropped on was closed {name} nelze umístit: dokument, na který byl přetažen, byl zavřen @msg Couldn't place {name}: the document it was placed in was closed {name} nelze umístit: dokument, do kterého se umísťoval, byl zavřen +@msg Couldn't place {name}: the document it was dropped on was reverted {name} nelze umístit: dokument, na který byl přetažen, byl vrácen k uložené verzi +@msg Couldn't place {name}: the document it was placed in was reverted {name} nelze umístit: dokument, do kterého se umísťoval, byl vrácen k uložené verzi +@msg Couldn't paste: the document it was pasted in was reverted Nelze vložit: dokument, do kterého se vkládalo, byl vrácen k uložené verzi @msg Couldn't read {name}: {e} {name} nelze přečíst: {e} @msg Couldn't save recovery data: {e} Data pro obnovení nelze uložit: {e} @msg Create Outlines: select text objects Převést na křivky: vyberte textové objekty diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 00c85aaeb6..f33129dc75 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -4246,6 +4246,9 @@ imageTrace Outline Kontur @msg Couldn't open {name}: {e} Kunne ikke åbne {name}: {e} @msg Couldn't place {name}: the document it was dropped on was closed Kunne ikke placere {name}: dokumentet, den blev sluppet på, var lukket @msg Couldn't place {name}: the document it was placed in was closed Kunne ikke placere {name}: dokumentet, den blev placeret i, var lukket +@msg Couldn't place {name}: the document it was dropped on was reverted Kunne ikke placere {name}: dokumentet, den blev sluppet på, blev gendannet +@msg Couldn't place {name}: the document it was placed in was reverted Kunne ikke placere {name}: dokumentet, den blev placeret i, blev gendannet +@msg Couldn't paste: the document it was pasted in was reverted Kunne ikke indsætte: dokumentet, der blev indsat i, blev gendannet @msg Couldn't read {name}: {e} Kunne ikke læse {name}: {e} @msg Couldn't save recovery data: {e} Kunne ikke gemme gendannelsesdata: {e} @msg Create Outlines: select text objects Opret konturer: markér tekstobjekter diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 47337855aa..e08d9a5963 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -4262,6 +4262,9 @@ theme Appearance Erscheinungsbild @msg Couldn't open {name}: {e} {name} konnte nicht geöffnet werden: {e} @msg Couldn't place {name}: the document it was dropped on was closed {name} konnte nicht platziert werden: Das Dokument, auf das die Datei gezogen wurde, wurde geschlossen @msg Couldn't place {name}: the document it was placed in was closed {name} konnte nicht platziert werden: Das Dokument, in dem die Datei platziert wurde, wurde geschlossen +@msg Couldn't place {name}: the document it was dropped on was reverted {name} konnte nicht platziert werden: Das Dokument, auf das die Datei gezogen wurde, wurde auf die letzte Version zurückgesetzt +@msg Couldn't place {name}: the document it was placed in was reverted {name} konnte nicht platziert werden: Das Dokument, in dem die Datei platziert wurde, wurde auf die letzte Version zurückgesetzt +@msg Couldn't paste: the document it was pasted in was reverted Konnte nicht eingefügt werden: Das Dokument, in das eingefügt wurde, wurde auf die letzte Version zurückgesetzt @msg Couldn't read {name}: {e} {name} konnte nicht gelesen werden: {e} @msg Couldn't save recovery data: {e} Wiederherstellungsdaten konnten nicht gespeichert werden: {e} @msg Create Outlines: select text objects In Pfade umwandeln: Wählen Sie Textobjekte aus diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index c319729a71..01d878a0ec 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -2419,6 +2419,9 @@ axis Both Και τα δύο @msg Couldn't open {name}: {e} Δεν ήταν δυνατό το άνοιγμα του {name}: {e} @msg Couldn't place {name}: the document it was dropped on was closed Δεν ήταν δυνατή η τοποθέτηση του {name}: το έγγραφο στο οποίο αποθέσατε το αρχείο έκλεισε @msg Couldn't place {name}: the document it was placed in was closed Δεν ήταν δυνατή η τοποθέτηση του {name}: το έγγραφο στο οποίο τοποθετούνταν το αρχείο έκλεισε +@msg Couldn't place {name}: the document it was dropped on was reverted Δεν ήταν δυνατή η τοποθέτηση του {name}: το έγγραφο στο οποίο αποθέσατε το αρχείο επανήλθε στην αποθηκευμένη έκδοση +@msg Couldn't place {name}: the document it was placed in was reverted Δεν ήταν δυνατή η τοποθέτηση του {name}: το έγγραφο στο οποίο τοποθετούνταν το αρχείο επανήλθε στην αποθηκευμένη έκδοση +@msg Couldn't paste: the document it was pasted in was reverted Δεν ήταν δυνατή η επικόλληση: το έγγραφο στο οποίο γινόταν η επικόλληση επανήλθε στην αποθηκευμένη έκδοση @msg Couldn't read {name}: {e} Δεν ήταν δυνατή η ανάγνωση του {name}: {e} @msg Couldn't save recovery data: {e} Δεν ήταν δυνατή η αποθήκευση δεδομένων ανάκτησης: {e} @msg Create Outlines: select text objects Δημιουργία περιγραμμάτων: επιλέξτε αντικείμενα κειμένου diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 5b203292a4..be7cd76be0 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -4339,6 +4339,9 @@ axis Both Ambos @msg Couldn't open {name}: {e} No se pudo abrir {name}: {e} @msg Couldn't place {name}: the document it was dropped on was closed No se pudo colocar {name}: se cerró el documento en el que se soltó @msg Couldn't place {name}: the document it was placed in was closed No se pudo colocar {name}: se cerró el documento en el que se estaba colocando +@msg Couldn't place {name}: the document it was dropped on was reverted No se pudo colocar {name}: se revirtió el documento en el que se soltó +@msg Couldn't place {name}: the document it was placed in was reverted No se pudo colocar {name}: se revirtió el documento en el que se estaba colocando +@msg Couldn't paste: the document it was pasted in was reverted No se pudo pegar: se revirtió el documento en el que se estaba pegando @msg Couldn't read {name}: {e} No se pudo leer {name}: {e} @msg Couldn't save recovery data: {e} No se pudieron guardar los datos de recuperación: {e} @msg Create Outlines: select text objects Crear contornos: selecciona objetos de texto diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index b2c6f48d54..3a5a9aa1b8 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -4563,6 +4563,9 @@ imageTrace Outline Ääriviiva @msg Couldn't open {name}: {e} Tiedostoa {name} ei voitu avata: {e} @msg Couldn't place {name}: the document it was dropped on was closed Kohdetta {name} ei voitu sijoittaa: asiakirja, johon se pudotettiin, on suljettu @msg Couldn't place {name}: the document it was placed in was closed Kohdetta {name} ei voitu sijoittaa: asiakirja, johon sitä sijoitettiin, on suljettu +@msg Couldn't place {name}: the document it was dropped on was reverted Kohdetta {name} ei voitu sijoittaa: asiakirja, johon se pudotettiin, on palautettu tallennettuun versioon +@msg Couldn't place {name}: the document it was placed in was reverted Kohdetta {name} ei voitu sijoittaa: asiakirja, johon sitä sijoitettiin, on palautettu tallennettuun versioon +@msg Couldn't paste: the document it was pasted in was reverted Liittäminen ei onnistunut: asiakirja, johon liitettiin, on palautettu tallennettuun versioon @msg Couldn't read {name}: {e} Tiedostoa {name} ei voitu lukea: {e} @msg Couldn't save recovery data: {e} Palautustietoja ei voitu tallentaa: {e} @msg Create Outlines: select text objects Muunna ääriviivoiksi: valitse tekstiobjekteja diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index e84f344060..eeca595064 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -4328,6 +4328,9 @@ axis Both Les deux @msg Couldn't open {name}: {e} Impossible d’ouvrir {name} : {e} @msg Couldn't place {name}: the document it was dropped on was closed Impossible d’importer {name} : le document sur lequel il a été déposé a été fermé @msg Couldn't place {name}: the document it was placed in was closed Impossible d’importer {name} : le document dans lequel il était importé a été fermé +@msg Couldn't place {name}: the document it was dropped on was reverted Impossible d’importer {name} : le document sur lequel il a été déposé a été rétabli à la version précédente +@msg Couldn't place {name}: the document it was placed in was reverted Impossible d’importer {name} : le document dans lequel il était importé a été rétabli à la version précédente +@msg Couldn't paste: the document it was pasted in was reverted Impossible de coller, car le document de destination a été rétabli à la version précédente @msg Couldn't read {name}: {e} Impossible de lire {name} : {e} @msg Couldn't save recovery data: {e} Impossible d’enregistrer les données de récupération : {e} @msg Create Outlines: select text objects Vectoriser : sélectionnez des objets texte diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 017bc03750..f01ad9df8c 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -6638,6 +6638,9 @@ antiAlias Sharp शार्प @msg Couldn't place {name}: {e} नहीं रह सकता {name}: {e} @msg Couldn't place {name}: the document it was dropped on was closed नहीं था {name}: यह डॉक्यूमेंट बंद हो गया था @msg Couldn't place {name}: the document it was placed in was closed नहीं था {name}: यह डॉक्यूमेंट बंद किया गया था +@msg Couldn't place {name}: the document it was dropped on was reverted {name} प्लेस नहीं कर सका: जिस डॉक्यूमेंट पर इसे छोड़ा गया था, उसे मूल स्थिति में लाया गया +@msg Couldn't place {name}: the document it was placed in was reverted {name} प्लेस नहीं कर सका: जिस डॉक्यूमेंट में इसे प्लेस किया जा रहा था, उसे मूल स्थिति में लाया गया +@msg Couldn't paste: the document it was pasted in was reverted पेस्ट नहीं कर सका: जिस डॉक्यूमेंट में पेस्ट किया जा रहा था, उसे मूल स्थिति में लाया गया @msg Couldn't read {name}: {e} नहीं पढ़ सकता {name}: {e} @msg Couldn't save recovery data: {e} रिकवरी डेटा सेव नहीं किया जा सका: {e} @msg counterPer `{c}`: item or file counterPer `{c}`: item या file diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index effb31e5d8..e4d3d65f7a 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -5145,6 +5145,9 @@ imageTrace Outline Körvonal @msg Couldn't paste: the document it was pasted in was closed Nem sikerült beilleszteni: a dokumentumot, amelybe a beillesztés történt, bezárták @msg Couldn't place {name}: the document it was dropped on was closed Nem sikerült elhelyezni: {name}; a céldokumentumot bezárták @msg Couldn't place {name}: the document it was placed in was closed Nem sikerült elhelyezni: {name}; a dokumentumot, amelybe került volna, bezárták +@msg Couldn't place {name}: the document it was dropped on was reverted Nem sikerült elhelyezni: {name}; a céldokumentumot visszaállították a mentett változatra +@msg Couldn't place {name}: the document it was placed in was reverted Nem sikerült elhelyezni: {name}; a dokumentumot, amelybe került volna, visszaállították a mentett változatra +@msg Couldn't paste: the document it was pasted in was reverted Nem sikerült beilleszteni: a dokumentumot, amelybe a beillesztés történt, visszaállították a mentett változatra @msg Couldn't place {name}: {e} Nem sikerült elhelyezni: {name}: {e} @msg Couldn't read {name}: {e} Nem sikerült beolvasni: {name}: {e} @msg Couldn't save recovery data: {e} Nem sikerült menteni a helyreállítási adatokat: {e} diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 912c6954eb..10870b436e 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -4246,6 +4246,9 @@ imageTrace Outline Kontur @msg Couldn't open {name}: {e} Tidak dapat membuka {name}: {e} @msg Couldn't place {name}: the document it was dropped on was closed Tidak dapat menempatkan {name}: dokumen tempatnya dijatuhkan sudah ditutup @msg Couldn't place {name}: the document it was placed in was closed Tidak dapat menempatkan {name}: dokumen tempatnya ditempatkan sudah ditutup +@msg Couldn't place {name}: the document it was dropped on was reverted Tidak dapat menempatkan {name}: dokumen tempatnya dijatuhkan sudah dikembalikan +@msg Couldn't place {name}: the document it was placed in was reverted Tidak dapat menempatkan {name}: dokumen tempatnya ditempatkan sudah dikembalikan +@msg Couldn't paste: the document it was pasted in was reverted Tidak dapat menempel: dokumen tempatnya ditempel sudah dikembalikan @msg Couldn't read {name}: {e} Tidak dapat membaca {name}: {e} @msg Couldn't save recovery data: {e} Tidak dapat menyimpan data pemulihan: {e} @msg Create Outlines: select text objects Buat kontur: pilih objek teks diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 2d6c7e2186..a8f251c184 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -4391,6 +4391,9 @@ axis Both Entrambi @msg Couldn't open {name}: {e} Impossibile aprire {name}: {e} @msg Couldn't place {name}: the document it was dropped on was closed Impossibile inserire {name}: il documento su cui è stato rilasciato è stato chiuso @msg Couldn't place {name}: the document it was placed in was closed Impossibile inserire {name}: il documento in cui veniva inserito è stato chiuso +@msg Couldn't place {name}: the document it was dropped on was reverted Impossibile inserire {name}: il documento su cui è stato rilasciato è stato ripristinato +@msg Couldn't place {name}: the document it was placed in was reverted Impossibile inserire {name}: il documento in cui veniva inserito è stato ripristinato +@msg Couldn't paste: the document it was pasted in was reverted Impossibile incollare: il documento in cui si incollava è stato ripristinato @msg Couldn't read {name}: {e} Impossibile leggere {name}: {e} @msg Couldn't save recovery data: {e} Impossibile salvare i dati di recupero: {e} @msg Create Outlines: select text objects Crea contorni: seleziona oggetti di testo diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 17444d894e..2e8a5b175f 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -5179,6 +5179,9 @@ swatch Bright Violet ビビッドバイオレット @msg no user library folder here この環境にはユーザーライブラリフォルダーがありません @msg Couldn't place {name}: the document it was dropped on was closed {name} を配置できませんでした: ドロップ先のドキュメントは閉じられています @msg Couldn't place {name}: the document it was placed in was closed {name} を配置できませんでした: 配置先のドキュメントは閉じられています +@msg Couldn't place {name}: the document it was dropped on was reverted {name} を配置できませんでした: ドロップ先のドキュメントは保存済みの状態に戻されました +@msg Couldn't place {name}: the document it was placed in was reverted {name} を配置できませんでした: 配置先のドキュメントは保存済みの状態に戻されました +@msg Couldn't paste: the document it was pasted in was reverted 貼り付けられませんでした: 貼り付け先のドキュメントは保存済みの状態に戻されました @msg no files to place 配置するファイルがありません @msg `{file}` isn't a VectorCraft document, a PDF or a PDF-compatible .ai file `{file}` は VectorCraft ドキュメント、PDF、PDF 互換の .ai ファイルのいずれでもありません @msg paths: give at least one file paths: ファイルを 1 つ以上指定してください diff --git a/crates/ui-egui/src/i18n/ka.tsv b/crates/ui-egui/src/i18n/ka.tsv index be8a847cb2..811918b6b2 100644 --- a/crates/ui-egui/src/i18n/ka.tsv +++ b/crates/ui-egui/src/i18n/ka.tsv @@ -4045,6 +4045,9 @@ font-technology Variable ცვლადი @msg Couldn't open {name}: {e} {name} ვერ გაიხსნა: {e} @msg Couldn't place {name}: the document it was dropped on was closed {name} ვერ განთავსდა: დოკუმენტი, რომელზეც ის ჩამოაგდეს, დაიხურა @msg Couldn't place {name}: the document it was placed in was closed {name} ვერ განთავსდა: დოკუმენტი, რომელშიც ის თავსდებოდა, დაიხურა +@msg Couldn't place {name}: the document it was dropped on was reverted {name} ვერ განთავსდა: დოკუმენტი, რომელზეც ის ჩამოაგდეს, წინა ვერსიაზე დაბრუნდა +@msg Couldn't place {name}: the document it was placed in was reverted {name} ვერ განთავსდა: დოკუმენტი, რომელშიც ის თავსდებოდა, წინა ვერსიაზე დაბრუნდა +@msg Couldn't paste: the document it was pasted in was reverted ჩასმა ვერ მოხერხდა: დოკუმენტი, რომელშიც ის ჩაისმებოდა, წინა ვერსიაზე დაბრუნდა @msg Couldn't read {name}: {e} {name} ვერ წაიკითხა: {e} @msg Couldn't save recovery data: {e} აღდგენის მონაცემები ვერ შეინახა: {e} @msg Create Outlines: select text objects კონტურების შექმნა: მონიშნეთ ტექსტური ობიექტები diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 991daba6d0..68d2e4ba7d 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -5106,6 +5106,9 @@ theme Appearance 외관 @msg no user library folder here 여기에는 사용자 라이브러리 폴더가 없습니다 @msg Couldn't place {name}: the document it was dropped on was closed {name}을(를) 가져올 수 없습니다: 놓은 문서가 닫혔습니다 @msg Couldn't place {name}: the document it was placed in was closed {name}을(를) 가져올 수 없습니다: 가져오던 문서가 닫혔습니다 +@msg Couldn't place {name}: the document it was dropped on was reverted {name}을(를) 가져올 수 없습니다: 놓은 문서가 되돌려졌습니다 +@msg Couldn't place {name}: the document it was placed in was reverted {name}을(를) 가져올 수 없습니다: 가져오던 문서가 되돌려졌습니다 +@msg Couldn't paste: the document it was pasted in was reverted 붙여넣을 수 없습니다: 붙여넣던 문서가 되돌려졌습니다 @msg no files to place 가져올 파일이 없습니다 @msg `{file}` isn't a VectorCraft document, a PDF or a PDF-compatible .ai file `{file}`은(는) VectorCraft 문서, PDF 또는 PDF 호환 .ai 파일이 아닙니다 @msg paths: give at least one file paths: 파일을 하나 이상 지정하세요 diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index b8ca33858f..fede5d9289 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -4761,6 +4761,9 @@ imageTrace Outline Contour @msg Couldn't open {name}: {e} Kon {name} niet openen: {e} @msg Couldn't place {name}: the document it was dropped on was closed Kon {name} niet plaatsen: het document waarop het werd neergezet, is gesloten @msg Couldn't place {name}: the document it was placed in was closed Kon {name} niet plaatsen: het document waarin het werd geplaatst, is gesloten +@msg Couldn't place {name}: the document it was dropped on was reverted Kon {name} niet plaatsen: het document waarop het werd neergezet, is teruggezet +@msg Couldn't place {name}: the document it was placed in was reverted Kon {name} niet plaatsen: het document waarin het werd geplaatst, is teruggezet +@msg Couldn't paste: the document it was pasted in was reverted Kon niet plakken: het document waarin werd geplakt, is teruggezet @msg Couldn't read {name}: {e} Kon {name} niet lezen: {e} @msg Couldn't save recovery data: {e} Kon herstelgegevens niet opslaan: {e} @msg Create Outlines: select text objects Contouren maken: selecteer tekstobjecten diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index eb5afe87cc..861bedc750 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -4473,6 +4473,9 @@ imageTrace Outline Kontur @msg Couldn't open {name}: {e} Nie udało się otworzyć {name}: {e} @msg Couldn't place {name}: the document it was dropped on was closed Nie udało się umieścić {name}: dokument, na który go upuszczono, został zamknięty @msg Couldn't place {name}: the document it was placed in was closed Nie udało się umieścić {name}: dokument, w którym był umieszczany, został zamknięty +@msg Couldn't place {name}: the document it was dropped on was reverted Nie udało się umieścić {name}: dokument, na który go upuszczono, został przywrócony +@msg Couldn't place {name}: the document it was placed in was reverted Nie udało się umieścić {name}: dokument, w którym był umieszczany, został przywrócony +@msg Couldn't paste: the document it was pasted in was reverted Nie udało się wkleić: dokument, do którego wklejano, został przywrócony @msg Couldn't read {name}: {e} Nie udało się odczytać {name}: {e} @msg Couldn't save recovery data: {e} Nie udało się zapisać danych odzyskiwania: {e} @msg Create Outlines: select text objects Utwórz kontury: zaznacz obiekty tekstowe diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 80615d6370..0ffb916dc2 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -3808,6 +3808,9 @@ axis Both Ambos @msg Couldn't open {name}: {e} Não foi possível abrir {name}: {e} @msg Couldn't place {name}: the document it was dropped on was closed Não foi possível inserir {name}: o documento em que foi solto foi fechado @msg Couldn't place {name}: the document it was placed in was closed Não foi possível inserir {name}: o documento em que estava sendo inserido foi fechado +@msg Couldn't place {name}: the document it was dropped on was reverted Não foi possível inserir {name}: o documento em que foi solto foi revertido +@msg Couldn't place {name}: the document it was placed in was reverted Não foi possível inserir {name}: o documento em que estava sendo inserido foi revertido +@msg Couldn't paste: the document it was pasted in was reverted Não foi possível colar: o documento em que estava sendo colado foi revertido @msg Couldn't read {name}: {e} Não foi possível ler {name}: {e} @msg Couldn't save recovery data: {e} Não foi possível salvar os dados de recuperação: {e} @msg Create Outlines: select text objects Criar contornos: selecione objetos de texto diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index c830e69b37..fdba4f5160 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -4376,6 +4376,9 @@ axis Both Оба @msg Couldn't open {name}: {e} Не удалось открыть {name}: {e} @msg Couldn't place {name}: the document it was dropped on was closed Не удалось поместить {name}: документ, в который его перетащили, был закрыт @msg Couldn't place {name}: the document it was placed in was closed Не удалось поместить {name}: документ, в который его помещали, был закрыт +@msg Couldn't place {name}: the document it was dropped on was reverted Не удалось поместить {name}: документ, в который его перетащили, был возвращён к сохранённой версии +@msg Couldn't place {name}: the document it was placed in was reverted Не удалось поместить {name}: документ, в который его помещали, был возвращён к сохранённой версии +@msg Couldn't paste: the document it was pasted in was reverted Не удалось вставить: документ, в который выполнялась вставка, был возвращён к сохранённой версии @msg Couldn't read {name}: {e} Не удалось прочитать {name}: {e} @msg Couldn't save recovery data: {e} Не удалось сохранить данные восстановления: {e} @msg Create Outlines: select text objects Создание контуров: выделите текстовые объекты diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index d4304b97bd..5ed1992034 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -4249,6 +4249,9 @@ axis Both Båda @msg Couldn't open {name}: {e} Kunde inte öppna {name}: {e} @msg Couldn't place {name}: the document it was dropped on was closed Kunde inte placera {name}: dokumentet det släpptes på har stängts @msg Couldn't place {name}: the document it was placed in was closed Kunde inte placera {name}: dokumentet det placerades i har stängts +@msg Couldn't place {name}: the document it was dropped on was reverted Kunde inte placera {name}: dokumentet det släpptes på har återgått till sparad version +@msg Couldn't place {name}: the document it was placed in was reverted Kunde inte placera {name}: dokumentet det placerades i har återgått till sparad version +@msg Couldn't paste: the document it was pasted in was reverted Kunde inte klistra in: dokumentet det klistrades in i har återgått till sparad version @msg Couldn't read {name}: {e} Kunde inte läsa {name}: {e} @msg Couldn't save recovery data: {e} Kunde inte spara återställningsdata: {e} @msg Create Outlines: select text objects Skapa konturer: markera textobjekt diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index f5fc694ec2..385a462b95 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -4129,6 +4129,9 @@ axis Both Her İkisi @msg Couldn't open {name}: {e} {name} açılamadı: {e} @msg Couldn't place {name}: the document it was dropped on was closed {name} yerleştirilemedi: bırakıldığı belge kapatıldı @msg Couldn't place {name}: the document it was placed in was closed {name} yerleştirilemedi: yerleştirildiği belge kapatıldı +@msg Couldn't place {name}: the document it was dropped on was reverted {name} yerleştirilemedi: bırakıldığı belge geri döndürüldü +@msg Couldn't place {name}: the document it was placed in was reverted {name} yerleştirilemedi: yerleştirildiği belge geri döndürüldü +@msg Couldn't paste: the document it was pasted in was reverted Yapıştırılamadı: yapıştırıldığı belge geri döndürüldü @msg Couldn't read {name}: {e} {name} okunamadı: {e} @msg Couldn't save recovery data: {e} Kurtarma verileri kaydedilemedi: {e} @msg Create Outlines: select text objects Anahatlar Oluştur: metin nesnelerini seçin diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 5a36512db0..fe21de311d 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -4375,6 +4375,9 @@ axis Both Обидві @msg Couldn't open {name}: {e} Не вдалося відкрити {name}: {e} @msg Couldn't place {name}: the document it was dropped on was closed Не вдалося помістити {name}: документ, у який його перетягли, було закрито @msg Couldn't place {name}: the document it was placed in was closed Не вдалося помістити {name}: документ, у який його поміщали, було закрито +@msg Couldn't place {name}: the document it was dropped on was reverted Не вдалося помістити {name}: документ, у який його перетягли, було повернуто до збереженої версії +@msg Couldn't place {name}: the document it was placed in was reverted Не вдалося помістити {name}: документ, у який його поміщали, було повернуто до збереженої версії +@msg Couldn't paste: the document it was pasted in was reverted Не вдалося вставити: документ, у який виконувалося вставлення, було повернуто до збереженої версії @msg Couldn't read {name}: {e} Неможливо прочитати {name}: {e} @msg Couldn't save recovery data: {e} Не вдалося зберегти дані відновлення: {e} @msg Create Outlines: select text objects Створення контурів: виділіть текстові об’єкти diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 839f5c7405..cc40048fa0 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -4803,6 +4803,9 @@ theme Appearance Giao diện @msg Couldn't paste: the document it was pasted in was closed Không thể dán: tài liệu mà nó được dán vào đã đóng @msg Couldn't place {name}: the document it was dropped on was closed Không thể đặt {name}: tài liệu mà nó được thả vào đã đóng @msg Couldn't place {name}: the document it was placed in was closed Không thể đặt {name}: tài liệu mà nó được đặt vào đã đóng +@msg Couldn't place {name}: the document it was dropped on was reverted Không thể đặt {name}: tài liệu mà nó được thả vào đã được hoàn về +@msg Couldn't place {name}: the document it was placed in was reverted Không thể đặt {name}: tài liệu mà nó được đặt vào đã được hoàn về +@msg Couldn't paste: the document it was pasted in was reverted Không thể dán: tài liệu mà nó được dán vào đã được hoàn về @msg Couldn't place {name}: {e} Không thể đặt {name}: {e} @msg Couldn't read {name}: {e} Không thể đọc {name}: {e} @msg Couldn't save recovery data: {e} Không thể lưu dữ liệu phục hồi: {e} diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index b0d6001e32..40ebab407e 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -4862,6 +4862,9 @@ imageTrace Outline 轮廓 @msg no user library folder here 此处没有用户库文件夹 @msg Couldn't place {name}: the document it was dropped on was closed 无法置入 {name}:将它拖放到的文档已关闭 @msg Couldn't place {name}: the document it was placed in was closed 无法置入 {name}:要置入的文档已关闭 +@msg Couldn't place {name}: the document it was dropped on was reverted 无法置入 {name}:将它拖放到的文档已恢复 +@msg Couldn't place {name}: the document it was placed in was reverted 无法置入 {name}:要置入的文档已恢复 +@msg Couldn't paste: the document it was pasted in was reverted 无法粘贴:要粘贴到的文档已恢复 @msg no files to place 没有要置入的文件 @msg `{file}` isn't a VectorCraft document, a PDF or a PDF-compatible .ai file `{file}` 不是 VectorCraft 文档、PDF 或 PDF 兼容的 .ai 文件 @msg paths: give at least one file paths:请至少给出一个文件 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index c24ae37609..83bfd8d7b2 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -2611,6 +2611,9 @@ file-filter Templates 範本 @msg no user library folder here 此處沒有使用者資料庫資料夾 @msg Couldn't place {name}: the document it was dropped on was closed 無法置入 {name}:放置它的文件已關閉 @msg Couldn't place {name}: the document it was placed in was closed 無法置入 {name}:要置入的文件已關閉 +@msg Couldn't place {name}: the document it was dropped on was reverted 無法置入 {name}:放置它的文件已回復 +@msg Couldn't place {name}: the document it was placed in was reverted 無法置入 {name}:要置入的文件已回復 +@msg Couldn't paste: the document it was pasted in was reverted 無法貼上:要貼上的文件已回復 @msg no files to place 沒有要置入的檔案 @msg `{file}` isn't a VectorCraft document, a PDF or a PDF-compatible .ai file `{file}` 不是 VectorCraft 文件、PDF 或 PDF 相容的 .ai 檔案 @msg paths: give at least one file paths:請提供至少一個檔案 diff --git a/crates/ui-egui/src/place.rs b/crates/ui-egui/src/place.rs index 94ae695ca4..fff3587182 100644 --- a/crates/ui-egui/src/place.rs +++ b/crates/ui-egui/src/place.rs @@ -33,6 +33,9 @@ pub type PlaceInbox = Arc>>; #[derive(Clone, Copy, Debug, PartialEq)] pub struct DropAt { pub doc: u64, + /// The document's [`vectorcraft_engine::DocState::reverts`] at the drop: files that arrive + /// after File → Revert threw that content away are not placed. + pub reverts: u64, pub at: Point, pub embed: bool, } @@ -455,7 +458,7 @@ impl VectorcraftApp { None if is_document(name) => return DropTarget::Open, None => v.center, }; - DropTarget::Place(DropAt { doc: st.uid, at, embed: shift }) + DropTarget::Place(DropAt { doc: st.uid, reverts: st.reverts, at, embed: shift }) } } @@ -473,7 +476,7 @@ pub type DropFile = (String, Option, Vec); /// Files dropped on the window, each placed on a canvas or opened (and added to Open Recent /// Files) as its target says: the placed ones first, so the last document opened is the one /// shown. A file for a canvas goes to the document it was dropped on, which becomes active again; -/// it isn't placed when that document has closed since. +/// it isn't placed when that document has closed or been reverted since. pub fn drop_files(app: &mut VectorcraftApp, mut files: Vec<(DropTarget, DropFile)>) { files.sort_by_key(|(target, _)| *target == DropTarget::Open); for (target, (name, path, bytes)) in files { @@ -482,6 +485,10 @@ pub fn drop_files(app: &mut VectorcraftApp, mut files: Vec<(DropTarget, DropFile app.status(format!("Couldn't place {name}: the document it was dropped on was closed")); continue; }; + if app.session.documents().get(i).is_some_and(|st| st.reverts != d.reverts) { + app.status(format!("Couldn't place {name}: the document it was dropped on was reverted")); + continue; + } app.session.set_active(i); } let r = match target { diff --git a/crates/ui-egui/src/placing.rs b/crates/ui-egui/src/placing.rs index 3eacb28322..11ae770d5d 100644 --- a/crates/ui-egui/src/placing.rs +++ b/crates/ui-egui/src/placing.rs @@ -111,6 +111,9 @@ struct Chain { left: Option>, /// How many of its pastes wait. waiting: usize, + /// The document's [`vectorcraft_engine::DocState::reverts`] when the chain started: a paste + /// given after a File → Revert does not join it. + reverts: u64, } /// What a paste whose bitmap was decoded off the UI thread pastes. @@ -129,6 +132,9 @@ pub struct Pending { pub label: String, /// The document they are placed in ([`vectorcraft_engine::DocState::uid`]). doc: u64, + /// Its [`vectorcraft_engine::DocState::reverts`] when the read started: a read for content that + /// File → Revert has since thrown away is dropped. + reverts: u64, /// Whether the file was dropped on the canvas (its messages say so, as /// [`crate::place::drop_files`]'s do). dropped: bool, @@ -177,6 +183,8 @@ struct PendingSwatch { insertion: Insertion, selection: Vec, doc: u64, + /// The document's [`vectorcraft_engine::DocState::reverts`] when the dialog opened. + reverts: u64, chain: u64, } @@ -254,14 +262,19 @@ pub fn adopt_for_paste(app: &mut VectorcraftApp, id: &str, p: &Value) -> Result< return Ok(None); } let copied = app.clipboard_publishing.latest(); - let (doc, objects) = app.session.doc().map(|st| (st.uid, st.selection.objects.clone())).map_err(|e| e.to_string())?; + let (doc, reverts, objects) = app.session.doc().map(|st| (st.uid, st.reverts, st.selection.objects.clone())).map_err(|e| e.to_string())?; let insertion = Insertion::of(app).ok_or("no document")?; // A paste given while one of the document's latest chain waits, with the selection and the // insertion context that chain expects, joins it: it goes next to what the paste before it - // leaves selected, as at once. Otherwise it starts a chain. + // leaves selected, as at once. Otherwise (also when the document was reverted since the chain + // started) it starts a chain. let context = (objects, insertion.clone()); - let joins = - app.placing.latest_chain.get(&doc).copied().filter(|c| app.placing.chains.get(c).is_some_and(|ch| ch.waiting > 0 && ch.context == context)); + let joins = app + .placing + .latest_chain + .get(&doc) + .copied() + .filter(|c| app.placing.chains.get(c).is_some_and(|ch| ch.waiting > 0 && ch.reverts == reverts && ch.context == context)); let (chain, selection) = match joins { Some(chain) => (chain, None), None => (app.placing.next_chain, Some(context.0.clone())), @@ -285,7 +298,7 @@ pub fn adopt_for_paste(app: &mut VectorcraftApp, id: &str, p: &Value) -> Result< if started.is_some() { if joins.is_none() { app.placing.next_chain += 1; - app.placing.chains.insert(chain, Chain { context, left: None, waiting: 0 }); + app.placing.chains.insert(chain, Chain { context, left: None, waiting: 0, reverts }); app.placing.latest_chain.insert(doc, chain); } if let Some(ch) = app.placing.chains.get_mut(&chain) { @@ -321,7 +334,7 @@ fn spawn_labeled( chain: Option, read: impl FnOnce() -> Result + Send + 'static, ) -> Result, String> { - let doc = app.session.doc().map_err(|e| e.to_string())?.uid; + let (doc, reverts) = app.session.doc().map(|st| (st.uid, st.reverts)).map_err(|e| e.to_string())?; let (tx, done) = channel(); // The automation roots in force here are in force there. let scope = ScopeHandle::capture(); @@ -360,7 +373,7 @@ fn spawn_labeled( let _ = reader.send(job); app.placing.reader = Some(reader); } - app.placing.pending.push(Pending { name, label: label.clone(), doc, dropped, paste: chain.is_some(), chain, done, scope: completion }); + app.placing.pending.push(Pending { name, label: label.clone(), doc, reverts, dropped, paste: chain.is_some(), chain, done, scope: completion }); let status = format!("{label}…"); app.status(status.clone()); Ok(Some(json!({ "background": true, "status": status }))) @@ -416,6 +429,19 @@ fn finish(app: &mut VectorcraftApp, p: &Pending, r: Result) { } return; }; + // File → Revert threw away the content the read was started for: what was read is dropped, + // with the document, its selection, the clipboard and the tools as they are. + if app.session.documents().get(i).is_some_and(|st| st.reverts != p.reverts) { + let name = &p.name; + if p.paste { + app.status("Couldn't paste: the document it was pasted in was reverted"); + } else if p.dropped { + app.status(format!("Couldn't place {name}: the document it was dropped on was reverted")); + } else { + app.status(format!("Couldn't place {name}: the document it was placed in was reverted")); + } + return; + } if p.paste { let error = match &r { Ok(Read::Paste(paste)) => match &paste.pasted { @@ -508,6 +534,7 @@ fn finish_paste(app: &mut VectorcraftApp, paste: Paste) { insertion: paste.insertion.clone(), selection: requested_selection, doc: st.uid, + reverts: st.reverts, chain, }); deferred = true; @@ -579,6 +606,12 @@ pub(crate) fn confirm_swatch_paste(app: &mut VectorcraftApp, id: &str, params: V finish_chain(app, waiting.chain); return Err("Couldn't paste: the document it was pasted in was closed".into()); }; + // File → Revert threw away the content the paste was given in: nothing is pasted, and the + // clipboard, selection and insertion context stay as they are. + if app.session.documents().get(index).is_some_and(|st| st.reverts != waiting.reverts) { + finish_chain(app, waiting.chain); + return Err("Couldn't paste: the document it was pasted in was reverted".into()); + } app.session.set_active(index); app.sync_views(); let current = std::mem::replace(&mut app.session.clipboard, waiting.clipboard); diff --git a/crates/ui-egui/src/placing/tests.rs b/crates/ui-egui/src/placing/tests.rs index 9afe94b9ee..dbb37ff446 100644 --- a/crates/ui-egui/src/placing/tests.rs +++ b/crates/ui-egui/src/placing/tests.rs @@ -971,7 +971,7 @@ fn what_the_user_places_is_read_off_the_ui_thread_and_commands_read_at_once() { app.select_tool("selection"); // A drop and bytes placed without a path. let doc = app.session.doc().unwrap().uid; - let drop = DropTarget::Place(DropAt { doc, at: vectorcraft_geom::Point::new(100.0, 100.0), embed: false }); + let drop = DropTarget::Place(DropAt { doc, reverts: 0, at: vectorcraft_geom::Point::new(100.0, 100.0), embed: false }); crate::place::drop_files(&mut app, vec![(drop, ("b.bmp".into(), Some(b.clone()), vec![]))]); crate::io::place_bytes(&mut app, "c.png", &picture(Png, 10, 10)).unwrap(); assert_eq!(app.placing.pending.len(), 2); @@ -1044,7 +1044,7 @@ fn files_dropped_together_are_placed_in_the_order_dropped() { let small = [saved("order", "small1.png", &picture(Png, 8, 8)), saved("order", "small2.png", &picture(Png, 8, 8))]; let mut app = app(true); let doc = app.session.doc().unwrap().uid; - let drop = DropTarget::Place(DropAt { doc, at: vectorcraft_geom::Point::new(200.0, 150.0), embed: false }); + let drop = DropTarget::Place(DropAt { doc, reverts: 0, at: vectorcraft_geom::Point::new(200.0, 150.0), embed: false }); let files = [&large, &small[0], &small[1]].map(|p| (drop, (vectorcraft_engine::cmd::fileio::file_name(p), Some(p.clone()), vec![]))); crate::place::drop_files(&mut app, files.into()); assert_eq!(app.placing.pending.len(), 3); @@ -1059,7 +1059,7 @@ fn files_dropped_together_are_read_one_at_a_time() { let files: Vec = (0..4).map(|i| saved("one-at-a-time", &format!("large{i}.tif"), &picture(Tiff, 1500, 1500))).collect(); let mut app = app(true); let doc = app.session.doc().unwrap().uid; - let drop = DropTarget::Place(DropAt { doc, at: vectorcraft_geom::Point::new(200.0, 150.0), embed: false }); + let drop = DropTarget::Place(DropAt { doc, reverts: 0, at: vectorcraft_geom::Point::new(200.0, 150.0), embed: false }); let dropped = files.iter().map(|p| (drop, (vectorcraft_engine::cmd::fileio::file_name(p), Some(p.clone()), vec![]))).collect(); crate::place::drop_files(&mut app, dropped); placed(&mut app); @@ -1123,7 +1123,7 @@ fn a_file_that_cant_be_read_off_the_ui_thread_reports_as_at_once() { let name = vectorcraft_engine::cmd::fileio::file_name(&path); for app in [&mut at_once, &mut app] { let doc = app.session.doc().unwrap().uid; - let drop = DropTarget::Place(DropAt { doc, at: vectorcraft_geom::Point::new(100.0, 100.0), embed: false }); + let drop = DropTarget::Place(DropAt { doc, reverts: 0, at: vectorcraft_geom::Point::new(100.0, 100.0), embed: false }); crate::place::drop_files(app, vec![(drop, (name.clone(), Some(path.clone()), vec![]))]); placed(app); } @@ -1152,6 +1152,164 @@ fn a_file_whose_document_closed_meanwhile_is_not_placed() { } } +/// `app`, which also writes files, with its active document saved to a file in a folder of +/// `test`'s own and then changed (a rectangle drawn since the save) → the app and the file. +fn saved_and_changed(mut app: VectorcraftApp, test: &str) -> (VectorcraftApp, String) { + app.services.write = Some(Box::new(|p: &str, b: &[u8]| std::fs::write(p, b).map_err(|e| e.to_string()))); + let path = saved(test, "saved.vectorcraft", b""); + std::fs::remove_file(&path).unwrap(); + app.run("file.saveAs", json!({"path": path})).unwrap(); + app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap(); + (app, path) +} + +/// A file read for Place, for the place cursor or dropped on the canvas is not placed when File › +/// Revert threw away the content of its document before it was read: the reverted document, its +/// undo steps and the tool stay as they are, and the status bar says why. A file read after the +/// Revert is placed. +#[test] +fn a_file_whose_document_was_reverted_meanwhile_is_not_placed() { + let tif = saved("reverted", "photo.tif", &picture(Tiff, 60, 40)); + for kind in ["place", "drop", "queue"] { + let (mut app, _) = saved_and_changed(app(true), &format!("reverted-{kind}")); + let read = |app: &mut VectorcraftApp| match kind { + "queue" => start_queue(app, &json!({"paths": [tif]})), + _ => start(app, &json!({"path": tif}), kind == "drop"), + }; + read(&mut app).unwrap(); + app.run("file.revert", json!({"confirmed": true})).unwrap(); + let reverted = state(&app); + placed(&mut app); + let why = if kind == "drop" { "dropped on" } else { "placed in" }; + assert_eq!(app.ui.status, format!("Couldn't place photo.tif: the document it was {why} was reverted"), "{kind}"); + assert!(state(&app) == reverted, "{kind}: nothing is placed"); + assert_ne!(app.session.tool_id(), "place", "{kind}: the place cursor is not loaded"); + read(&mut app).unwrap(); + placed(&mut app); + if kind == "queue" { + assert_eq!((app.session.tool_id(), app.session.tool_options()["count"].as_u64()), ("place", Some(1))); + } else { + assert_eq!(names(&app), ["photo.tif"], "{kind}: a file read after the Revert is placed"); + } + } +} + +/// A Revert that fails, or that a batch rolls back, leaves a file being read for its document to +/// be placed, and a Revert of one document leaves the files read for another to be placed. +#[test] +fn a_file_is_placed_after_a_revert_that_failed_or_of_another_document() { + let tif = saved("revert-failed", "photo.tif", &picture(Tiff, 60, 40)); + let (mut first, path) = saved_and_changed(app(true), "revert-failed"); + start(&mut first, &json!({"path": tif}), false).unwrap(); + let revert = json!({"command": "file.revert", "params": {"confirmed": true}}); + let failing = json!({"command": "select.set", "params": {"ids": [999999]}}); + assert!(first.run("command.batch", json!({"commands": [revert, failing]})).is_err(), "the batch is rolled back"); + std::fs::remove_file(&path).unwrap(); + assert!(first.run("file.revert", json!({"confirmed": true})).is_err(), "the saved file is gone"); + placed(&mut first); + assert_eq!(names(&first), ["photo.tif"]); + let (mut second, _) = saved_and_changed(app(true), "revert-other"); + second.run("file.new", json!({"width": 100, "height": 100})).unwrap(); + start(&mut second, &json!({"path": tif}), false).unwrap(); + second.session.set_active(0); + second.sync_views(); + second.run("file.revert", json!({"confirmed": true})).unwrap(); + placed(&mut second); + assert_eq!(second.session.active_index(), Some(1)); + assert_eq!(names(&second), ["photo.tif"], "the other document's file is placed"); +} + +/// Files dropped on a canvas that arrive after File › Revert threw away the content of their +/// document (the web reads dropped files asynchronously) are not placed. +#[test] +fn files_dropped_on_a_document_reverted_before_they_arrive_are_not_placed() { + let tif = saved("revert-drop", "photo.tif", &picture(Tiff, 60, 40)); + let (mut app, _) = saved_and_changed(app(true), "revert-drop"); + let (doc, reverts) = app.session.doc().map(|st| (st.uid, st.reverts)).unwrap(); + let drop = DropTarget::Place(DropAt { doc, reverts, at: vectorcraft_geom::Point::new(100.0, 100.0), embed: false }); + app.run("file.revert", json!({"confirmed": true})).unwrap(); + let reverted = state(&app); + crate::place::drop_files(&mut app, vec![(drop, ("photo.tif".into(), Some(tif), vec![]))]); + placed(&mut app); + assert_eq!(app.ui.status, "Couldn't place photo.tif: the document it was dropped on was reverted"); + assert!(state(&app) == reverted, "nothing is placed"); +} + +/// Pastes whose bitmaps are read off the UI thread paste nothing when File › Revert threw away the +/// content of their document before they were read: the clipboard and the selection stay as they +/// are, and the status bar says why. A Paste in Front given after the Revert, while a paste given +/// before it waits, does not follow that paste: it goes in front of what was selected when it was +/// given. +#[test] +fn a_paste_whose_document_was_reverted_meanwhile_pastes_nothing() { + let bitmap = Some(Flavour { mime: PNG, data: picture(Png, 60, 40) }); + let (pasting, _) = pasting_app(true, bitmap, None, true); + let (mut app, _) = saved_and_changed(pasting, "revert-paste"); + app.run("select.set", json!({"ids": []})).unwrap(); + crate::menus::invoke(&mut app, "edit.paste", json!({})); + crate::menus::invoke(&mut app, "edit.paste", json!({})); + assert_eq!(app.placing.pending.len(), 2); + app.run("file.revert", json!({"confirmed": true})).unwrap(); + let (reverted, clipboard) = (state(&app), app.session.clipboard.clone()); + placed(&mut app); + assert_eq!(app.ui.status, "Couldn't paste: the document it was pasted in was reverted"); + assert!(state(&app) == reverted, "nothing is pasted"); + assert!(app.session.clipboard == clipboard, "the clipboard is unchanged"); + assert!(app.placing.chains.is_empty() && app.placing.latest_chain.is_empty(), "no paste waits"); + // A paste given before a Revert, and one given after it with the same (empty) selection. + app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap(); + app.run("select.set", json!({"ids": []})).unwrap(); + crate::menus::invoke(&mut app, "edit.pasteInFront", json!({})); + app.run("file.revert", json!({"confirmed": true})).unwrap(); + crate::menus::invoke(&mut app, "edit.pasteInFront", json!({})); + assert_eq!(app.placing.pending.len(), 2); + let below = app.run("shape.rectangle", json!({"x": 100, "y": 10, "width": 20, "height": 20})).unwrap()["id"].as_u64().unwrap(); + app.run("shape.rectangle", json!({"x": 200, "y": 10, "width": 20, "height": 20})).unwrap(); + app.run("select.set", json!({"ids": [below]})).unwrap(); + placed(&mut app); + let st = app.session.doc().unwrap(); + let order: Vec<_> = st.doc.layers[0].children().unwrap().iter().map(|n| n.id).collect(); + assert_eq!(order.len(), 3, "one picture is pasted"); + assert_eq!(st.selection.objects, [order[2]], "pasted on top, with nothing selected as when it was given"); + assert!(matches!(st.doc.node(order[2]).map(|n| &n.kind), Some(vectorcraft_doc::NodeKind::Image(_)))); +} + +/// A paste that waits for its own Swatch Conflict dialog pastes nothing once File › Revert (on its +/// own or in a batch) threw away the content of its document: confirming the dialog gives an +/// error, and the document and the clipboard stay as they are. +#[test] +fn a_deferred_swatch_paste_is_dropped_when_its_document_is_reverted() { + for batch in [false, true] { + let (mut app, _) = pasting_app(true, None, None, true); + app.run("swatch.new", json!({"name": "Brand", "color": "#ff0000", "global": true})).unwrap(); + let source = app.run("shape.rectangle", json!({"x": 10, "y": 10, "width": 20, "height": 20})).unwrap()["id"].clone(); + app.run("paint.setFill", json!({"ids": [source], "swatch": "Brand"})).unwrap(); + app.run("edit.copy", json!({})).unwrap(); + let clipboard = app.session.clipboard.clone(); + app.run("file.new", json!({"width": 400, "height": 300})).unwrap(); + app.run("swatch.new", json!({"name": "Brand", "color": "#0000ff", "global": true})).unwrap(); + let (mut app, _) = saved_and_changed(app, &format!("revert-swatch-{batch}")); + crate::menus::invoke(&mut app, "edit.pasteInPlace", json!({})); + placed(&mut app); + assert_eq!(app.ui.dialog.as_ref().unwrap().kind, crate::dialogs::swatch_conflict::KIND); + let revert = json!({"command": "file.revert", "params": {"confirmed": true}}); + if batch { + app.run("command.batch", json!({"commands": [revert]})).unwrap(); + } else { + app.run("file.revert", json!({"confirmed": true})).unwrap(); + } + let reverted = state(&app); + assert_eq!(app.ui.dialog.as_ref().unwrap().kind, crate::dialogs::swatch_conflict::KIND, "batch {batch}"); + app.ui.dialog.as_mut().unwrap().fields.insert("choice".into(), json!("add")); + let error = crate::dialogs::confirm(&mut app).unwrap_err(); + assert_eq!(error, "Couldn't paste: the document it was pasted in was reverted"); + assert!(app.ui.dialog.is_none() && app.placing.swatch_paste.is_none()); + assert!(app.placing.chains.is_empty() && app.placing.latest_chain.is_empty()); + assert!(app.session.clipboard == clipboard); + assert!(state(&app) == reverted, "batch {batch}: nothing is pasted"); + } +} + /// Replace swaps the object selected when Place started; when that object was deleted before the /// file was read, nothing is placed and the status bar says why. #[test] diff --git a/crates/ui-egui/src/tests/place.rs b/crates/ui-egui/src/tests/place.rs index 9c67861eeb..19c39879af 100644 --- a/crates/ui-egui/src/tests/place.rs +++ b/crates/ui-egui/src/tests/place.rs @@ -111,7 +111,7 @@ fn a_drop_with_a_position_places_on_the_canvas_and_opens_off_it() { let want = Xf::new(rect, app.view().unwrap()).to_doc(pos); let uid = app.session.active().unwrap().uid; for name in ["a.png", "a.svg", "a.ai", "a.vectorcraft"] { - assert_eq!(app.drop_target(name, Some(pos), true), DropTarget::Place(DropAt { doc: uid, at: want, embed: true }), "{name}"); + assert_eq!(app.drop_target(name, Some(pos), true), DropTarget::Place(DropAt { doc: uid, reverts: 0, at: want, embed: true }), "{name}"); assert_eq!(app.drop_target(name, Some(Pos2::new(300.0, rect.top() - 10.0)), false), DropTarget::Open, "{name} on the tab bar"); } } @@ -129,7 +129,7 @@ fn a_drop_without_a_position_opens_documents_and_places_pictures() { assert_eq!(app.drop_target(name, None, false), DropTarget::Open, "{name}"); } for name in ["a.png", "a.jpg", "a.tiff", "a.webp", "a.txt"] { - assert_eq!(app.drop_target(name, None, false), DropTarget::Place(DropAt { doc: uid, at: center, embed: false }), "{name}"); + assert_eq!(app.drop_target(name, None, false), DropTarget::Place(DropAt { doc: uid, reverts: 0, at: center, embed: false }), "{name}"); } } diff --git a/docs/target-app-parity.md b/docs/target-app-parity.md index 7044797d5e..c4c9997532 100644 --- a/docs/target-app-parity.md +++ b/docs/target-app-parity.md @@ -1668,6 +1668,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur - Placing a Word 97-2003 `.doc` document works out each style's formatting once and each property run's once, and refuses property pages that are out of order, listed twice or overlap, a style sheet that holds fewer styles than it counts, styles based on each other in a loop, and more than 100,000 runs of character or of paragraph properties, 16 MiB of properties or 100,000 paragraphs, hidden ones included (`file.place`, `crates/engine/src/tests/textimport.rs`). - On the desktop, File › Place reads and decodes files off the UI thread, one at a time, and places each once it is read, with "Placing" in the status bar and the busy spinner until then: the Place dialog's OK, a file dropped on the canvas, a click or drag of the place cursor, and the OK of the PDF, DXF and text import options. The files and thumbnails the place cursor is loaded with are read the same way, and the Place dialog's lines about its files are read on a thread of their own. Files are placed in the order they were started; a file is not placed while a dialog is open or a drag is under way, and a file whose document was closed meanwhile is not placed. `file.place` and `file.place.queue` over MCP and scripts reply as before. - On the desktop, Paste from a menu or shortcut captures another app's bitmap or reads a copied image file on the UI thread, then decodes the image on the file-reading worker. The status bar shows "Pasting" until the image is pasted. Windows device-independent bitmaps and Linux clipboard images are encoded as PNG on that worker. A Copy or Cut made while the image is read keeps its internal clipboard. `edit.paste*` over MCP and scripts reads the bitmap at once. + - File › Revert also drops what was started for the content it discards: a file being read for Place, for the place cursor or dropped on the canvas, a bitmap being read for Paste, and a paste waiting at its Swatch Conflict dialog are not placed or pasted in the reverted document, and the status bar says the document was reverted. Edits made while a file is read, a Revert that fails or that a batch rolls back, and a Revert of another document leave the read to finish as before (`crates/ui-egui/src/placing/tests.rs`). - The pixels of a PNG, JPEG, GIF or WebP file that Place decodes to check them are kept in the image store the renderers share, so the canvas's first frame with the placed image draws them without decoding the file again on the UI thread: File › Place, a file dropped on the canvas, a click or drag of the place cursor, `file.place`, and Paste of such an image. A CMYK JPEG is still decoded when it is first drawn (`crates/ui-egui/src/placing.rs`, `crates/render/src/tests.rs`). - A photo whose EXIF orientation turns or flips it (a camera held upright or upside down) is placed and opened upright, as it was taken; the image is stored as it is seen (#4284). A quarter turn swaps the resolution's axes, so the image keeps its physical size. TIFFs read without the image decoder (grayscale with extra channels, CCITT Group 3, CMYK with one plane per ink) follow their Orientation tag too, and a turned CMYK JPEG or TIFF keeps its inks, 8 bits each, as a CMYK TIFF. - SVG import shows a raster `` whose EXIF orientation or TIFF Orientation tag turns or flips it upright, linked or as a data URL, and inside an SVG shown as an image: the pixels are stored turned, the width and height swap, and the `` box fits the turned image under `preserveAspectRatio`, as CSS `image-orientation: from-image` describes (). A turned CMYK JPEG or TIFF keeps its inks as a CMYK TIFF, as does a CMYK TIFF that is not turned. TIFF data URLs (`image/tiff`, or untyped TIFF bytes) are read, and TIFFs with an alpha or other extra channel, CCITT Group 3 TIFFs and CMYK TIFFs stored one plane per ink are read as Open and Place read them. The pixels are decoded within the decode allowance, and a TIFF claiming more strips or tiles than the decoder can count is refused before it is decoded (`crates/svg/tests/it/image_orientation.rs`).