diff --git a/Cargo.lock b/Cargo.lock index 4282660662..36ccb47fc3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1365,7 +1365,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-automation", "craft-behavior", @@ -1405,7 +1405,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "crc32fast", "flate2", @@ -1426,7 +1426,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "rustix 1.1.5", ] @@ -1434,7 +1434,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "base64 0.22.1", "craft-behavior", @@ -1459,7 +1459,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1477,7 +1477,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-docpath", @@ -1495,7 +1495,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "egui", ] @@ -1503,7 +1503,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "md-5", "rayon", @@ -1512,12 +1512,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-cms", @@ -1537,7 +1537,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-ai-agents", "craft-atomic", @@ -1552,7 +1552,7 @@ dependencies = [ [[package]] name = "craft-crs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-metadata", "craft-xml", @@ -1562,7 +1562,7 @@ dependencies = [ [[package]] name = "craft-crw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "thiserror 2.0.21", ] @@ -1570,7 +1570,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "rayon", ] @@ -1578,7 +1578,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "block2 0.6.2", "craft-atomic", @@ -1603,7 +1603,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "serde", ] @@ -1611,7 +1611,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1630,12 +1630,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" [[package]] name = "craft-file-formats" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-eps", "craft-idml", @@ -1653,7 +1653,7 @@ dependencies = [ [[package]] name = "craft-flags" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-atomic", "dirs", @@ -1663,7 +1663,7 @@ dependencies = [ [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1678,7 +1678,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1697,7 +1697,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "cap-primitives", "craft-atomic", @@ -1718,12 +1718,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" [[package]] name = "craft-heif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "heic-rs", "rayon", @@ -1732,7 +1732,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1745,7 +1745,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "chrono", "fixed_decimal", @@ -1773,7 +1773,7 @@ dependencies = [ [[package]] name = "craft-idml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-xml", "craft-zip", @@ -1783,7 +1783,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-dds", "craft-heif", @@ -1811,7 +1811,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1829,12 +1829,12 @@ dependencies = [ [[package]] name = "craft-ipp" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "thiserror 2.0.21", ] @@ -1842,10 +1842,12 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-host", "craft-i18n", + "craft-tracked", + "craft-ui-macros", "craft-xml", "egui", "serde", @@ -1855,7 +1857,7 @@ dependencies = [ [[package]] name = "craft-kra" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-xml", "craft-zip", @@ -1865,7 +1867,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-i18n", @@ -1879,7 +1881,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-host", @@ -1897,7 +1899,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -1909,7 +1911,7 @@ dependencies = [ [[package]] name = "craft-ora" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-xml", "craft-zip", @@ -1919,7 +1921,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-keymap", @@ -1934,7 +1936,7 @@ dependencies = [ [[package]] name = "craft-pcraft-bundle" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "blake3", "craft-atomic", @@ -1947,7 +1949,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "flate2", "serde", @@ -1958,7 +1960,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "bytemuck", "flate2", @@ -1973,7 +1975,7 @@ dependencies = [ [[package]] name = "craft-pdn" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "flate2", "thiserror 2.0.21", @@ -1982,7 +1984,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "async-channel", "async-io", @@ -2012,7 +2014,7 @@ dependencies = [ [[package]] name = "craft-plist" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "thiserror 2.0.21", ] @@ -2020,7 +2022,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-host", @@ -2043,7 +2045,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "encoding_rs", "flate2", @@ -2054,7 +2056,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "dispatch2", "egui", @@ -2065,7 +2067,7 @@ dependencies = [ [[package]] name = "craft-raw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "chrono", "craft-crw", @@ -2083,7 +2085,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-host", @@ -2101,7 +2103,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-atomic", "craft-host", @@ -2118,7 +2120,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2139,7 +2141,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-keymap", @@ -2151,7 +2153,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2174,9 +2176,11 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "bitflags 2.13.2", + "craft-tracked", + "craft-ui-macros", "ecolor", "log", "serde", @@ -2187,7 +2191,7 @@ dependencies = [ [[package]] name = "craft-theme-editor" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-theme", @@ -2198,7 +2202,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-atomic", "craft-behavior", @@ -2213,7 +2217,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "serde", "thiserror 2.0.21", @@ -2222,7 +2226,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "serde", "thiserror 2.0.21", @@ -2231,7 +2235,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-keymap", @@ -2246,12 +2250,12 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2265,7 +2269,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-i18n", @@ -2281,7 +2285,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "accesskit", "craft-behavior", @@ -2321,7 +2325,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2332,7 +2336,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-host", @@ -2350,7 +2354,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-host", @@ -2371,7 +2375,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-host", @@ -2390,7 +2394,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-behavior", "craft-host", @@ -2407,7 +2411,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "chrono", "craft-host", @@ -2436,7 +2440,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "winsafe", ] @@ -2444,7 +2448,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "craft-atomic", "craft-behavior", @@ -2474,7 +2478,7 @@ dependencies = [ [[package]] name = "craft-xcf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "flate2", "thiserror 2.0.21", @@ -2483,7 +2487,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "quick-xml 0.41.0", "serde", @@ -2493,7 +2497,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "flate2", "thiserror 2.0.21", @@ -3956,7 +3960,7 @@ dependencies = [ [[package]] name = "hayro" version = "0.7.1" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "bytemuck", "hayro-interpret", @@ -3986,7 +3990,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -4004,7 +4008,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -4028,7 +4032,7 @@ checksum = "bc2d80da85f31c3fdc0366431f44cfd645a9da1e242ed1f4a61f213d9765660f" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "flate2", "hayro-ccitt", @@ -5112,7 +5116,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "arrayvec", "kurbo 0.13.1", @@ -6475,6 +6479,8 @@ dependencies = [ name = "photocraft-doc" version = "0.23.1" dependencies = [ + "craft-tracked", + "craft-ui-macros", "photocraft-color", "photocraft-geom", "photocraft-raster", @@ -9499,7 +9505,7 @@ dependencies = [ [[package]] name = "vello_common" version = "0.0.8" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "bytemuck", "fearless_simd", @@ -9547,7 +9553,7 @@ dependencies = [ [[package]] name = "vello_cpu" version = "0.0.8" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" dependencies = [ "bytemuck", "glifo 0.1.1", @@ -11183,14 +11189,14 @@ source = "git+https://github.com/storytold/egui.git?rev=6525c87923ca47465aac2444 [[patch.unused]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" [[patch.unused]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" [[patch.unused]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=50e00dd493ee4cf010c10375320e7415dcebd182#50e00dd493ee4cf010c10375320e7415dcebd182" +source = "git+https://github.com/storytold/craft-libs?rev=683fe06031224725b913c8ad3697d8e8bfec6c90#683fe06031224725b913c8ad3697d8e8bfec6c90" diff --git a/Cargo.toml b/Cargo.toml index 7d908a8c54..41f05e7fb2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,19 +12,21 @@ rust-version = "1.95" [workspace.dependencies] # The craft framework through its facade (`craft::ui::…`). The egui `[patch]` below must match # `craft::egui_fork::REV` (checked by `cargo xtask ci`). -craft = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182", default-features = false } +craft = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90", default-features = false } +craft-tracked = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +craft-ui-macros = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } # internal photocraft-geom = { path = "crates/geom" } photocraft-color = { path = "crates/color" } photocraft-raster = { path = "crates/raster" } photocraft-doc = { path = "crates/doc" } photocraft-ops = { path = "crates/ops" } -craft-plist = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -photocraft-codecs = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -photocraft-formats = { package = "craft-file-formats", git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182", features = ["raster-codecs", "pdf", "svg", "ora", "kra", "xcf", "pdn", "raw", "psd", "affinity", "pcraft"] } +craft-plist = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +photocraft-codecs = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +photocraft-formats = { package = "craft-file-formats", git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90", features = ["raster-codecs", "pdf", "svg", "ora", "kra", "xcf", "pdn", "raw", "psd", "affinity", "pcraft"] } photocraft-raw = { path = "crates/raw" } -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } photocraft-compose = { path = "crates/compose" } photocraft-gpu = { path = "crates/gpu" } photocraft-paint = { path = "crates/paint" } @@ -43,34 +45,34 @@ photocraft-ipp = { path = "crates/ipp" } # external # ICC colour management: the shared crate (replaces crates/cms; craft-libs#779). -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -craft-print = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +craft-print = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } # HEIC/HEIF: the shared decoder (replaces crates/heif; craft-libs#784). -craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182", features = ["raster", "write-raster"] } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -craft-pcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -craft-pcraft-bundle = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -craft-ora = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -craft-kra = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -craft-xcf = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -craft-pdn = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } +craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90", features = ["raster", "write-raster"] } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +craft-pcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +craft-pcraft-bundle = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +craft-ora = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +craft-kra = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +craft-xcf = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +craft-pdn = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } # Keep the shared embedded-image validation API until the framework revision includes it. -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182", features = ["tree-render", "tree-render-system-fonts"] } -craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90", features = ["tree-render", "tree-render-system-fonts"] } +craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } # Camera-field EXIF reader/writer, shared prerequisite craft-libs#1563. -craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -craft-crs = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } +craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +craft-crs = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } # Interface translations: lookup, fallback, CLDR plurals and language names over the craft-i18n # catalogs that `crates/ui-egui/build.rs` embeds from `CRAFT_I18N_DIR` (storytold/craft-i18n, at # the commit in `craft-i18n.rev`). Already in the tree through craft. -craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } +craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } # craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "50e00dd493ee4cf010c10375320e7415dcebd182", features = ["ui"] } +craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90", features = ["ui"] } thiserror = "2" serde = { version = "1", features = ["derive", "rc"] } serde_json = "1" @@ -335,16 +337,16 @@ opt-level = 3 # Keep the complete egui family and native event bridge on reviewed fork commits. [patch.crates-io] -krilla = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -hayro = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -vello_common = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } -vello_cpu = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +hayro = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +vello_common = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } +vello_cpu = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "6525c87923ca47465aac244460fe4b1139349060" } emath = { git = "https://github.com/storytold/egui.git", rev = "6525c87923ca47465aac244460fe4b1139349060" } epaint = { git = "https://github.com/storytold/egui.git", rev = "6525c87923ca47465aac244460fe4b1139349060" } diff --git a/crates/doc/Cargo.toml b/crates/doc/Cargo.toml index 299880cb80..296cbe090d 100644 --- a/crates/doc/Cargo.toml +++ b/crates/doc/Cargo.toml @@ -13,3 +13,6 @@ photocraft-color = { workspace = true } photocraft-raster = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } +# LayerId is plain data (the Layers panel keys its rows by it): the marker and its derive, without the UI. +craft-tracked = { workspace = true } +craft-ui-macros = { workspace = true } diff --git a/crates/doc/src/lib.rs b/crates/doc/src/lib.rs index 04cc848371..f6ec94b44b 100644 --- a/crates/doc/src/lib.rs +++ b/crates/doc/src/lib.rs @@ -59,7 +59,7 @@ fn next_id() -> u64 { NEXT_ID.fetch_add(1, Ordering::Relaxed) } -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize, craft_ui_macros::PlainData)] pub struct LayerId(pub u64); impl LayerId { diff --git a/crates/engine/Cargo.toml b/crates/engine/Cargo.toml index 5938a6f9af..1040fe1531 100644 --- a/crates/engine/Cargo.toml +++ b/crates/engine/Cargo.toml @@ -16,7 +16,7 @@ photocraft-geom = { workspace = true } photocraft-color = { workspace = true } craft-cms = { workspace = true } # PCTIP codec from craft-libs#1564; isolated pin until the shared revision is adopted workspace-wide. -craft-pcraft-tip = { package = "craft-pcraft-format", git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } +craft-pcraft-tip = { package = "craft-pcraft-format", git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } photocraft-raster = { workspace = true } photocraft-doc = { workspace = true } photocraft-ops = { workspace = true } diff --git a/crates/engine/src/cmd/layer_menu_cmds.rs b/crates/engine/src/cmd/layer_menu_cmds.rs index e46c44d5fb..6fcc6abd4b 100644 --- a/crates/engine/src/cmd/layer_menu_cmds.rs +++ b/crates/engine/src/cmd/layer_menu_cmds.rs @@ -1027,6 +1027,16 @@ macro_rules! spec { }; } +/// `layer.exportAs`' params: its `resample` offers the methods of [`crate::export_preset_cmds::RESAMPLE`], in its order. +fn export_as_params() -> &'static str { + let methods: Vec<&str> = crate::export_preset_cmds::RESAMPLE.iter().map(|(key, _)| *key).collect(); + crate::vector_cmds::leak(format!( + r##"{{"layer":id?,"path":text,"scale":1..1000=100,"resample":"{}"="{}"}} (format from the path's extension; the document is not resampled)"##, + methods.join("|"), + crate::export_preset_cmds::DEFAULT_RESAMPLE + )) +} + pub fn specs() -> Vec { vec![ spec!("layer.layerMask.apply", "Apply", ["Layer", "Layer Mask"], r##"{"layer":id?}"##, has_raster_with_mask, apply_mask), @@ -1113,14 +1123,16 @@ pub fn specs() -> Vec { "layer.quickExportAsPng", true )), - spec!( - "layer.exportAs", - "Export As…", - ["Layer"], - r##"{"layer":id?,"path":text,"scale":1..1000=100,"resample":"bicubicAutomatic|bicubic|bicubicSmoother|bicubicSharper|bilinear|nearest"="bicubicAutomatic"} (format from the path's extension; the document is not resampled)"##, - has_layer, - |s, p| export_layer(s, p, "layer.exportAs", false) - ), + CommandSpec { + id: "layer.exportAs", + label: "Export As…", + menu: &["Layer"], + shortcut: None, + params: export_as_params(), + enabled: has_layer, + run: |s, p| export_layer(s, p, "layer.exportAs", false), + journal: true, + }, ] } diff --git a/crates/engine/src/cmd/layer_menu_cmds/tests.rs b/crates/engine/src/cmd/layer_menu_cmds/tests.rs index 8efe428398..f9c7a1f5d8 100644 --- a/crates/engine/src/cmd/layer_menu_cmds/tests.rs +++ b/crates/engine/src/cmd/layer_menu_cmds/tests.rs @@ -960,3 +960,10 @@ fn decontamination_alpha_keeps_missing_source_alpha_only_inside_bounds() { assert_eq!(alpha.sample_channel(x, y, 0), 0.0); } } + +#[test] +fn layer_export_as_names_every_resample_method_in_the_presets_order() { + let spec = crate::install::command_specs().iter().find(|c| c.id == "layer.exportAs").unwrap(); + let keys: Vec<&str> = crate::export_preset_cmds::RESAMPLE.iter().map(|(key, _)| *key).collect(); + assert!(spec.params.contains(&format!("\"resample\":\"{}\"", keys.join("|"))), "{}", spec.params); +} diff --git a/crates/ipp/Cargo.toml b/crates/ipp/Cargo.toml index d7ac3a9f8d..d3ad82be59 100644 --- a/crates/ipp/Cargo.toml +++ b/crates/ipp/Cargo.toml @@ -7,7 +7,7 @@ license.workspace = true rust-version.workspace = true [dependencies] -craft-ipp = { git = "https://github.com/storytold/craft-libs", rev = "50e00dd493ee4cf010c10375320e7415dcebd182" } +craft-ipp = { git = "https://github.com/storytold/craft-libs", rev = "683fe06031224725b913c8ad3697d8e8bfec6c90" } [lints] workspace = true diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 28430bda86..d252a1860e 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -70,6 +70,8 @@ impl PhotocraftApp { remove_trail: None, menu_model: None, toolbar_slots: Default::default(), + layers_tree: None, + dock_model: Default::default(), move_preview: None, move_hover: None, move_distance: None, diff --git a/crates/ui-egui/src/app/framework.rs b/crates/ui-egui/src/app/framework.rs index a5148afb1e..5615ba2950 100644 --- a/crates/ui-egui/src/app/framework.rs +++ b/crates/ui-egui/src/app/framework.rs @@ -17,7 +17,7 @@ use craft::host::target::{Backend, ShellInfo}; use craft::host::{AppInfo, Files, Host, SectionStore}; use craft::i18n::Direction; use craft::keymap::Overrides; -use craft::theme::{AppDefaults, AppSizes, ModeChoice, Size, SuiteChoice, ThemeId, ThemePair, resolve_sized}; +use craft::theme::{AppDefaults, AppSizes, ComponentSet, ModeChoice, Size, SuiteChoice, ThemeId, ThemePair, resolve_sized}; use craft::theme_store::{SelectionChange, SuiteClient}; use craft::ui::contract::Tracked; use craft::ui::dialog::DialogHost; @@ -212,13 +212,14 @@ const DEFAULT_DARK: &str = "craft.artcraft"; const DEFAULT_LIGHT: &str = "craft.pro"; /// What PhotoCraft shows for each suite field nobody has chosen: Pro (Medium Gray) in the dark -/// mode, Pro in the light, and the dark mode. +/// mode, Pro in the light, and the dark mode, with the Creative component set. fn defaults() -> AppDefaults { let theme = |id: &str| ThemeId::parse(id).unwrap_or_else(|_| ThemeId::suite_default()); AppDefaults { theme: ThemePair { light: theme(DEFAULT_LIGHT), dark: theme(DEFAULT_DARK) }, mode: ModeChoice::Dark, size: Size::default(), + set: ComponentSet::Creative, sizes: (**app_sizes()).clone(), } } diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index e896f5f497..daf454eb5f 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -995,7 +995,7 @@ fn a_floating_document_follows_navigator_and_status_bar_zoom() { // A Navigator in a column of icons shows in a flyout, which the click into the status bar closes: expand its column // so the panel stays while both fields are typed into. let navigator = "navigator".to_owned(); - if h.state().ui.docking.layout.opens_in_flyout(&navigator) { + if h.state().ui.docking.layout().opens_in_flyout(&navigator) { crate::panel_docking::apply(h.state_mut(), vec![craft::behavior::dock::Action::set_iconic(navigator.clone(), false)]).unwrap(); h.state_mut().ui.flyout = None; crate::panel_docking::show_panel(h.state_mut(), "navigator", Some(true)).unwrap(); diff --git a/crates/ui-egui/src/dialogs/export_dialog.rs b/crates/ui-egui/src/dialogs/export_dialog.rs index e9a6dbf967..8b695b3525 100644 --- a/crates/ui-egui/src/dialogs/export_dialog.rs +++ b/crates/ui-egui/src/dialogs/export_dialog.rs @@ -227,13 +227,13 @@ fn dialog_formats() -> Vec { formats } -/// The resample methods the engine's Image Size implements, Preserve Details included (#13737). The framework lists -/// them in its own order. +/// The resample methods the engine's Image Size implements, Preserve Details included (#13737), in the order of the +/// engine's `RESAMPLE`. const RESAMPLE_CHOICES: [Resample; 7] = [ - Resample::Automatic, Resample::Bicubic, - Resample::BicubicSmoother, + Resample::Automatic, Resample::BicubicSharper, + Resample::BicubicSmoother, Resample::Bilinear, Resample::NearestNeighbor, Resample::PreserveDetails, diff --git a/crates/ui-egui/src/dialogs/export_dialog/preserve_details_tests.rs b/crates/ui-egui/src/dialogs/export_dialog/preserve_details_tests.rs index 55aaff45e9..ae5abcaf1a 100644 --- a/crates/ui-egui/src/dialogs/export_dialog/preserve_details_tests.rs +++ b/crates/ui-egui/src/dialogs/export_dialog/preserve_details_tests.rs @@ -40,6 +40,16 @@ fn seven_methods_in_the_reference_order_with_bicubic_automatic_the_default() { assert_eq!(labels, ["Bicubic", "Bicubic Automatic", "Bicubic Sharper", "Bicubic Smoother", "Bilinear", "Nearest Neighbor", "Preserve Details"]); assert_eq!(DEFAULT_RESAMPLE, "bicubicAutomatic"); assert_eq!(resample_method(&Map::new(), None).unwrap(), "bicubicAutomatic"); + // The dialog lists the methods in the engine's order, Automatic included. + let offered: Vec = RESAMPLE_CHOICES + .iter() + .map(|resample| { + let mut options = ExportOptions::default(); + options.resample = *resample; + settings_from(&options, PixelSize::new(12, 8))["resample"].as_str().unwrap().to_owned() + }) + .collect(); + assert_eq!(offered, keys); } #[test] diff --git a/crates/ui-egui/src/doc_revision_trials.rs b/crates/ui-egui/src/doc_revision_trials.rs index 6a01302f0a..8dd27fd436 100644 --- a/crates/ui-egui/src/doc_revision_trials.rs +++ b/crates/ui-egui/src/doc_revision_trials.rs @@ -3,7 +3,6 @@ //! walks no document and rebuilds nothing derived from it. use craft::layers::ui::thumbs::{LayerThumb, ThumbContents}; -use craft::layers::ui::tree::LayerTree; use craft::ui::primitives::textures::{ThumbRequest, ThumbSource}; use egui_kittest::Harness; use photocraft_doc::{Fill, Layer, LayerContent, LayerId, PixelFormat}; @@ -11,7 +10,7 @@ use photocraft_engine::Session; use serde_json::json; use crate::PhotocraftApp; -use crate::panels::layers_tree::{PhotoLayers, PhotoThumbs}; +use crate::panels::layers_tree::PhotoThumbs; use crate::state::Tool; type H = Harness<'static, Box>; @@ -113,10 +112,9 @@ fn layers_rows_follow_renames_and_both_toggles() { }) .unwrap(); let mut h = harness(s); - let revision = |h: &H| { - let app = h.state(); - PhotoLayers::new(app, app.session.active().unwrap(), &Default::default(), false, None).revision() - }; + // The panel's model, which the app holds across passes and replaces only when what the rows show changed. + let revision = |h: &H| h.state().layers_tree.as_ref().map(|model| model.revision()); + h.run_steps(2); let start = revision(&h); assert!(start.is_some()); h.run_steps(10); diff --git a/crates/ui-egui/src/dock/tests.rs b/crates/ui-egui/src/dock/tests.rs index 46764133c7..5b092580a1 100644 --- a/crates/ui-egui/src/dock/tests.rs +++ b/crates/ui-egui/src/dock/tests.rs @@ -39,18 +39,18 @@ fn the_layout_and_color_panel_options_restore_only_with_remember_workspace_chang crate::panel_docking::apply(&mut app, vec![Action::resize_group("layers".to_owned(), Some(333.0))]).unwrap(); persist(&mut app); let default = registry::default_workspace(); - assert_ne!(app.ui.docking.layout, default.layout, "the resize changed the layout"); + assert_ne!(app.ui.docking.layout(), default.layout(), "the resize changed the layout"); let prefs = app.session.prefs_to_json(); let mut remembered = app_from_prefs(&prefs, true); restore(&mut remembered); crate::color_panel_ui::restore(&mut remembered); - assert_eq!(remembered.ui.docking.layout, app.ui.docking.layout); + assert_eq!(remembered.ui.docking.layout(), app.ui.docking.layout()); assert_eq!(remembered.ui.color_panel.panel.mode, ColorPanelMode::HsbSliders, "the Color panel's mode too"); let mut forgotten = app_from_prefs(&prefs, false); restore(&mut forgotten); - assert_eq!(forgotten.ui.docking.layout, default.layout, "the default shows when changes are not remembered"); + assert_eq!(forgotten.ui.docking.layout(), default.layout(), "the default shows when changes are not remembered"); } /// Reset Workspace brings back the current workspace's own arrangement, and a named workspace keeps @@ -59,26 +59,26 @@ fn the_layout_and_color_panel_options_restore_only_with_remember_workspace_chang fn reset_workspace_restores_the_default_layout_and_new_workspaces_keep_theirs() { let (mut app, _, _) = app_with_layers(); let ctx = egui::Context::default(); - let default = registry::default_workspace().layout; + let default = registry::default_workspace().layout().clone(); crate::panel_docking::apply(&mut app, vec![Action::resize_group("properties".to_owned(), Some(120.0)), Action::set_minimized("color".to_owned(), true)]) .unwrap(); - let mine = app.ui.docking.layout.clone(); + let mine = app.ui.docking.layout().clone(); assert_ne!(mine, default); crate::menus::invoke(&mut app, &ctx, "workspace.new", json!({"name": "Tall Layers"})).unwrap(); let named = app.workspaces.set.saved.iter().find(|w| w.name == "Tall Layers").expect("the saved workspace").id.clone(); crate::menus::invoke(&mut app, &ctx, "window.workspace.essentials", json!({})).unwrap(); - assert_eq!(app.ui.docking.layout, default, "the preset replaces the arrangement"); + assert_eq!(*app.ui.docking.layout(), default, "the preset replaces the arrangement"); let essentials = app.workspaces.set.current.clone(); crate::panel_docking::apply(&mut app, vec![Action::resize_group("layers".to_owned(), Some(300.0))]).unwrap(); - assert_ne!(app.ui.docking.layout, default); + assert_ne!(*app.ui.docking.layout(), default); crate::menus::invoke(&mut app, &ctx, "workspace.reset", json!({})).unwrap(); - assert_eq!(app.ui.docking.layout, default, "Reset Workspace restores the preset's arrangement"); + assert_eq!(*app.ui.docking.layout(), default, "Reset Workspace restores the preset's arrangement"); assert_eq!(app.workspaces.set.current, essentials, "and stays in that workspace"); crate::menus::invoke(&mut app, &ctx, &format!("window.workspace.{named}"), json!({})).unwrap(); - assert_eq!(app.ui.docking.layout, mine, "the named workspace kept its own arrangement"); + assert_eq!(*app.ui.docking.layout(), mine, "the named workspace kept its own arrangement"); assert_eq!(app.workspaces.set.current, named); } @@ -92,18 +92,18 @@ fn an_unreadable_docking_layout_is_dropped_and_the_rest_applies() { saved["panels"]["status_bar"] = json!(false); app.run("window.panel.close", json!({"panel": "layers"})).unwrap(); let default = registry::default_workspace(); - assert_ne!(app.ui.docking.layout, default.layout, "the app starts from a changed layout"); + assert_ne!(app.ui.docking.layout(), default.layout(), "the app starts from a changed layout"); assert!(app.ui.panels.status_bar); apply(&mut app, &saved); - assert_eq!(app.ui.docking.layout, default.layout, "the unreadable docking value is dropped for the default"); - assert_eq!(app.ui.docking.hidden, default.hidden); + assert_eq!(app.ui.docking.layout(), default.layout(), "the unreadable docking value is dropped for the default"); + assert_eq!(app.ui.docking.hidden(), default.hidden()); assert!(!app.ui.panels.status_bar, "the rest of the save still applies"); } /// Whether the toolbar's column is in the end dock. fn toolbar_at_end(app: &PhotocraftApp) -> bool { - let layout = &app.ui.docking.layout; + let layout = app.ui.docking.layout(); match layout.place(®istry::TOOLBAR.to_owned()) { Some(craft::behavior::dock::PanelPlace::Dock { path, .. }) => layout.dock_path(craft::behavior::dock::DockEdge::End) == Some(path), _ => false, @@ -138,7 +138,7 @@ fn an_old_saves_toolbar_side_places_the_toolbar_once() { #[test] fn an_old_saves_toolbar_flags_set_its_width_and_visibility() { let steps = |app: &PhotocraftApp| { - let layout = &app.ui.docking.layout; + let layout = app.ui.docking.layout(); layout.place(®istry::TOOLBAR.to_owned()).and_then(|place| layout.column(&place)).and_then(|column| column.steps) }; let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default()); @@ -146,7 +146,7 @@ fn an_old_saves_toolbar_flags_set_its_width_and_visibility() { assert_eq!(steps(&app), Some(2)); apply(&mut app, &json!({"panels": {"toolbar": false, "options_bar": true, "status_bar": true}})); assert!(!crate::panel_docking::is_shown(&app, registry::TOOLBAR), "the toolbar is closed"); - assert!(app.ui.docking.hidden.iter().any(|(panel, _)| panel == registry::TOOLBAR), "and keeps its place to reopen at"); + assert!(app.ui.docking.hidden().iter().any(|(panel, _)| panel == registry::TOOLBAR), "and keeps its place to reopen at"); } /// A workspace from a newer version shows the default, and its file stays as saved until the user @@ -159,7 +159,7 @@ fn a_workspace_from_a_newer_version_shows_the_default_and_stays_saved() { saved["docking"] = json!({"version": 99, "layout": {"root": null, "floating": []}, "future": true}); app.session.prefs.edit(|p| p.panel_layout = saved.clone()); restore(&mut app); - assert_eq!(app.ui.docking.layout, registry::default_workspace().layout, "the default layout shows"); + assert_eq!(app.ui.docking.layout(), registry::default_workspace().layout(), "the default layout shows"); persist(&mut app); assert_eq!(app.session.prefs().panel_layout, saved, "a persist with no change leaves the newer file saved"); diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index f09e0498e6..3402cb14d1 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -354,6 +354,10 @@ pub struct PhotocraftApp { pub(crate) menu_model: Option, /// The toolbar's slots for the stored layout (`tool_commands::ToolbarSlots`). pub(crate) toolbar_slots: panels::tool_commands::ToolbarSlots, + /// The Layers panel's model, held across passes (`layers_tree::PhotoLayers::held`). + pub(crate) layers_tree: Option>, + /// The dock's spec model and kept panels (`panel_docking::DockModel`). + pub(crate) dock_model: panels::panel_docking::DockModel, /// Move tool drag shown live (`move_ui`). pub(crate) move_preview: Option, /// Move tool › Show Highlight on Rollover: the last hover answer (`move_hover`). diff --git a/crates/ui-egui/src/menus/items.rs b/crates/ui-egui/src/menus/items.rs index 5a9eb1902b..b30b092c08 100644 --- a/crates/ui-egui/src/menus/items.rs +++ b/crates/ui-egui/src/menus/items.rs @@ -6,6 +6,7 @@ use craft::menu::{ Alternate, Customization, ItemKind, ItemRole, LanguageChoice, LanguageLabels, LanguageMenu, LayoutOptions, MenuBar, MenuRole, Node, Platforms, Row, Target, ThemeLabels, from_items, layout, }; +use craft::ui::contract::Tracked; use serde_json::json; use super::invoke::{panel_alias, proof_preset, workspace_id}; @@ -57,8 +58,9 @@ pub struct MenuModel { english_titles: HashMap, /// The rows with labels as shown, after the user's Edit › Menus customization. pub rows: Vec, - /// The menus laid out for this platform, titles as shown. - pub bar: MenuBar, + /// The menus laid out for this platform, titles as shown, each translated title and label with its English name. + /// A rebuild that lays out the same menus keeps the held value, so the bar's key stays. + pub bar: Tracked, } impl MenuModel { @@ -104,16 +106,25 @@ fn collect_english(node: &Node, english: &mut HashMap<(String, String), String>) /// list. A second pass of that frame sees no input, so it hashes differently and rebuilds once, /// after the first pass's commands ran. pub fn model<'a>(app: &'a mut PhotocraftApp, ctx: &egui::Context) -> &'a MenuModel { - let state = crate::native_menu::state_hash(app, craft::menu::had_input(ctx).then_some(app.frame)); + let state = crate::native_menu::state_hash(app, had_input(ctx).then_some(app.frame)); match app.menu_model.take() { Some(held) if held.state == state => app.menu_model.insert(held), - _ => { - let built = build(app, state); + held => { + let mut built = build(app, state); + if let Some(held) = held.filter(|held| held.bar == built.bar) { + built.bar = held.bar; + } app.menu_model.insert(built) } } } +/// Whether this frame had a key press or a button release, which may change state [`crate::native_menu::state_hash`] +/// does not list. +pub(crate) fn had_input(ctx: &egui::Context) -> bool { + craft::ui::runtime::keys::keyed(ctx) || ctx.input(|i| i.events.iter().any(|e| matches!(e, egui::Event::PointerButton { pressed: false, .. }))) +} + /// The row that runs `id`. pub fn row<'a>(rows: &'a [Row], id: &str) -> Option<&'a Row> { rows.iter().find(|r| r.command.id == id) @@ -424,5 +435,5 @@ fn build(app: &PhotocraftApp, state: u64) -> MenuModel { let mut bar = layout(&bar, Target::current(), &options).bar; let mut english_titles = HashMap::new(); translate_titles(&mut bar, lang, &mut english_titles); - MenuModel { state, english, english_titles, rows, bar } + MenuModel { state, english, english_titles, rows, bar: Tracked::new(bar) } } diff --git a/crates/ui-egui/src/menus/native_menu.rs b/crates/ui-egui/src/menus/native_menu.rs index 42a60ed18d..88316fb50f 100644 --- a/crates/ui-egui/src/menus/native_menu.rs +++ b/crates/ui-egui/src/menus/native_menu.rs @@ -67,8 +67,8 @@ pub fn sync(app: &mut PhotocraftApp, ctx: &egui::Context) { let (gate, rules) = crate::menus::menu_gate(app); native.set_gate(gate.text_editing(WindowHost::of(ctx).typing())); native.set_modal_rules(rules); - let state = state_hash(app, craft::menu::had_input(ctx).then_some(app.frame)); - for c in native.sync_with(state, || laid_out(app, ctx)) { + let state = state_hash(app, crate::menus::items::had_input(ctx).then_some(app.frame)); + for c in native.sync_with(&state, || laid_out(app, ctx)) { log::info!("menu: {} is {} on macOS and {} in PhotoCraft; {}", c.shortcut.portable(), c.system, c.command.id, c.resolution); } app.services.native_menu = Some(native); @@ -112,9 +112,9 @@ pub(crate) fn state_hash(app: &PhotocraftApp, input: Option) -> u64 { // the keys of the hidden and floating ones; the checked flags cover panels opened or closed and the flyout of a // panel in a column of icons. let docking = &app.ui.docking; - docking.layout.panels().hash(&mut h); - docking.hidden.iter().map(|(panel, _)| panel).collect::>().hash(&mut h); - docking.floated.iter().map(|(panel, _)| panel).collect::>().hash(&mut h); + docking.layout().panels().hash(&mut h); + docking.hidden().iter().map(|(panel, _)| panel).collect::>().hash(&mut h); + docking.floated().iter().map(|(panel, _)| panel).collect::>().hash(&mut h); for panel in crate::panels::registry::PANELS { crate::panel_docking::is_checked(app, panel.id).hash(&mut h); } diff --git a/crates/ui-egui/src/menus/workspace_ui.rs b/crates/ui-egui/src/menus/workspace_ui.rs index 36a9e7974d..17e9eb4cd5 100644 --- a/crates/ui-egui/src/menus/workspace_ui.rs +++ b/crates/ui-egui/src/menus/workspace_ui.rs @@ -139,7 +139,7 @@ fn migrate(app: &mut PhotocraftApp, prefs: &Preferences, set: &mut WorkspaceSet< let layout = std::mem::replace(&mut app.ui.docking, live); let has = |key: &str| entry.get(key).is_some(); let keeps = WorkspaceKeeps::new(has("shortcuts"), has("menus"), has("toolbar")); - let Ok(id) = set.save(name, layout, WorkspaceChrome::default(), keeps) else { continue }; + let Ok(id) = set.save(name, std::sync::Arc::unwrap_or_clone(layout), WorkspaceChrome::default(), keeps) else { continue }; let captured: Map = EXTRAS.iter().filter_map(|key| entry.get(*key).map(|value| ((*key).to_owned(), value.clone()))).collect(); if !captured.is_empty() { extras.insert(id, Value::Object(captured)); @@ -202,7 +202,7 @@ fn restore_extras(app: &mut PhotocraftApp, id: &str) { /// Makes workspace `id` current: its layout replaces the live one, its captured extras are restored, the dock's /// layout is remembered. The host's chrome flags (menu bar, rail) stay as the host has them. pub fn select(app: &mut PhotocraftApp, id: &str) -> Result<(), String> { - app.workspaces.set.select(id, &mut app.ui.docking).map_err(refused)?; + app.workspaces.set.select(id, std::sync::Arc::make_mut(&mut app.ui.docking)).map_err(refused)?; restore_extras(app, id); crate::dock::persist(app); store(app); @@ -215,7 +215,7 @@ pub fn save(app: &mut PhotocraftApp, name: &str) -> Result { } fn save_keeping(app: &mut PhotocraftApp, name: &str, keeps: WorkspaceKeeps) -> Result { - let live = app.ui.docking.clone(); + let live = craft::behavior::dock::Workspace::clone(&app.ui.docking); let id = app.workspaces.set.save(name, live, WorkspaceChrome::default(), keeps).map_err(refused)?; let extras = captured(app.session.prefs(), keeps); app.session.prefs.edit(|p| { @@ -254,7 +254,7 @@ fn delete_id(app: &mut PhotocraftApp, id: &str) -> Result<(), String> { /// Runs a workspace command. New and Delete without a name open their hosted dialog and return its id. pub fn run(app: &mut PhotocraftApp, _ctx: &egui::Context, command: WorkspaceCommands) -> Result { - let ask = run_workspace(&mut app.workspaces.set, &mut app.ui.docking, command); + let ask = run_workspace(&mut app.workspaces.set, std::sync::Arc::make_mut(&mut app.ui.docking), command); match ask { Some(WorkspaceAsk::Name) => { let dialog = HostedNewWorkspace::new(&app.workspaces.set).offered(WorkspaceKeeps::new(true, true, true)); diff --git a/crates/ui-egui/src/panels/layer_menu_ui/tests.rs b/crates/ui-egui/src/panels/layer_menu_ui/tests.rs index 37b29a0fc9..c2a5352018 100644 --- a/crates/ui-egui/src/panels/layer_menu_ui/tests.rs +++ b/crates/ui-egui/src/panels/layer_menu_ui/tests.rs @@ -160,7 +160,7 @@ fn row_menu_entries_follow_the_target() { let st = app.session.active().unwrap(); let tree = crate::panels::layers_tree::PhotoLayers::new(&app, st, &Default::default(), false, None); let target = MenuTarget::::new(None); - let menu = crate::panels::layers_tree::row_menu(&tree, &target); + let menu = crate::panels::layers_tree::row_menu(&app, &tree, &target); let size = |size: ThumbSize, label: &str| { let value = format!("{}{}", crate::panels::layers_tree::THUMB_SIZE, crate::layers_panel_ui::size_key(size)); Entry::new(value, label.to_string()).checked(size == ThumbSize::Medium) diff --git a/crates/ui-egui/src/panels/layers.rs b/crates/ui-egui/src/panels/layers.rs index 266c02e8f9..b75b5acc25 100644 --- a/crates/ui-egui/src/panels/layers.rs +++ b/crates/ui-egui/src/panels/layers.rs @@ -26,6 +26,8 @@ pub(super) fn layers(app: &mut PhotocraftApp, ui: &mut egui::Ui) { let ctx = ui.ctx().clone(); // Thumbnail Contents is the clip preference alone, so the panel reads it each pass. app.ui.layers_settings.options.thumbnail_contents = crate::layers_panel_ui::thumbnail_contents(app); + // Taken out of the app for the pass; a move keeps its revision. + let held = app.layers_tree.take(); let Some(st) = app.session.active() else { let _ = Notice::new(Tone::Neutral, tl!("No document")).layout(NoticeLayout::Centred).show(ui); return; @@ -37,14 +39,14 @@ pub(super) fn layers(app: &mut PhotocraftApp, ui: &mut egui::Ui) { let mut filter = app.ui.layer_filter.clone(); let before = filter.clone(); let picked = crate::smart_ui::selected(&app.smart_filter_picks, &st.doc, st.active_layer); - let tree = PhotoLayers::new(app, st, &filter, foreign, picked); + let tree = PhotoLayers::new(app, st, &filter, foreign, picked).held(held); let thumbs = Thumbnails::>::in_context(&ctx, "photocraft-layer-thumbs", ThumbnailOptions::new()); let source = PhotoThumbs::new(app, &st.doc); let mut panel = LayersPanel::new(&tree) .settings(settings) .thumbnails(&thumbs, &source) .filter(Bind::bound(&mut filter)) - .row_menu(|target| layers_tree::row_menu(&tree, target)) + .row_menu(|target| layers_tree::row_menu(app, &tree, target)) .document(st.doc.id); if let Some((id, groups)) = reveal { panel = panel.reveal(id, groups); @@ -59,7 +61,7 @@ pub(super) fn layers(app: &mut PhotocraftApp, ui: &mut egui::Ui) { panel = panel.start_rename(id); } let out = panel.show(ui); - drop(tree); + app.layers_tree = Some(tree); app.find_layers_focus = false; app.layers_rename = None; if filter != before { diff --git a/crates/ui-egui/src/panels/layers_tree.rs b/crates/ui-egui/src/panels/layers_tree.rs index 51484f43c3..7753d129a1 100644 --- a/crates/ui-egui/src/panels/layers_tree.rs +++ b/crates/ui-egui/src/panels/layers_tree.rs @@ -13,7 +13,7 @@ use craft::layers::ui::tree::{ SubRows, ThumbBadge, }; use craft::theme::LabelColor as UiLabel; -use craft::ui::contract::{Entry, ReorderMove}; +use craft::ui::contract::{Entry, PlainData, ReorderMove, Tracked}; use craft::ui::list::ThumbSize; use craft::ui::patterns::blend_keys::{BlendKeyEntry, blend_entries}; use craft::ui::primitives::textures::{Revision, ThumbRender, ThumbRequest, ThumbSource, thumb_image}; @@ -79,10 +79,25 @@ pub(crate) fn listed_filter(app: &PhotocraftApp) -> Option { - app: &'a PhotocraftApp, - st: &'a DocState, +/// The Layers panel's model of the active document: the document, the parts of its state the rows show and what the +/// app decides for them (the edit target, the hovered layer, the filter's answers). Plain data: the panel holds it in a +/// `Tracked`, and the host writes a new one only when what it holds changed ([`PhotoLayers::held`]). +#[derive(Clone, PlainData)] +pub(crate) struct PhotoLayers { + #[plain_data(assume = "the document is replaced, never changed in place, while an Arc to it is shared")] + doc: Arc, + active_layer: Option, + selected: Vec, + isolated_layers: Vec, + fx_collapsed: Vec, + #[plain_data(assume = "craft-layers filter: plain values and strings")] + filter: LayerFilter, + /// The part edits go to ([`LayerTree::selection`]). + target: LayerPart, + mask_target: bool, + vector_mask_target: bool, + link_enabled: bool, + hovered: Option, /// A Type Mask session's working text, which the panel never lists. working_text: Option, /// The empty layers, while the filter is Attribute Empty or Not Empty. @@ -95,30 +110,81 @@ pub(crate) struct PhotoLayers<'a> { picked: Option, } -impl<'a> PhotoLayers<'a> { - pub(crate) fn new(app: &'a PhotocraftApp, st: &'a DocState, filter: &LayerFilter, foreign_drag: bool, picked: Option) -> Self { +/// Equal when they show the same: the same document value (one `Arc`) and the same state. +impl PartialEq for PhotoLayers { + fn eq(&self, other: &Self) -> bool { + Arc::ptr_eq(&self.doc, &other.doc) + && (&self.active_layer, &self.selected, &self.isolated_layers, &self.fx_collapsed, &self.filter, self.target) + == (&other.active_layer, &other.selected, &other.isolated_layers, &other.fx_collapsed, &other.filter, other.target) + && (self.mask_target, self.vector_mask_target, self.link_enabled, self.hovered, self.working_text, self.foreign_drag, self.picked) + == (other.mask_target, other.vector_mask_target, other.link_enabled, other.hovered, other.working_text, other.foreign_drag, other.picked) + && self.empty == other.empty + && self.missing == other.missing + } +} + +impl PhotoLayers { + pub(crate) fn new(app: &PhotocraftApp, st: &DocState, filter: &LayerFilter, foreign_drag: bool, picked: Option) -> Self { let working_text = app.ui.text_edit.as_ref().filter(|ed| ed.mask).map(|ed| ed.layer); let empty = match (filter.by, filter.attribute) { (FilterBy::Attribute, LayerAttribute::Empty | LayerAttribute::NotEmpty) => crate::layer_filter_ui::attribute::empty_layers(app), _ => None, }; let missing = if filter.by == FilterBy::SmartObject { app.session.missing_links() } else { HashSet::new() }; - Self { app, st, working_text, empty, missing, foreign_drag, picked } + let ui = &app.ui; + let target = match st.active_layer.and_then(|id| st.doc.layer(id)) { + Some(l) if l.frame.is_some() => match crate::frame_tool::target(app, l) { + crate::frame_tool::Target::Frame => LayerPart::FrameShape, + crate::frame_tool::Target::Content => LayerPart::FrameContent, + crate::frame_tool::Target::Both => LayerPart::Pixels, + }, + Some(l) if ui.filter_mask_target == Some(l.id.0) && app.filter_mask_targeted() => LayerPart::FilterMask, + Some(l) if ui.vector_mask_target && l.vector_mask.is_some() => LayerPart::VectorMask, + Some(l) if ui.mask_target && l.mask.is_some() => LayerPart::LayerMask, + _ => LayerPart::Pixels, + }; + Self { + doc: Arc::clone(&st.doc), + active_layer: st.active_layer, + selected: st.selected_layers().to_vec(), + isolated_layers: st.isolated_layers.clone(), + fx_collapsed: st.fx_collapsed.clone(), + filter: ui.layer_filter.clone(), + target, + mask_target: ui.mask_target, + vector_mask_target: ui.vector_mask_target, + link_enabled: app.session.is_enabled("layer.linkLayers"), + hovered: app.canvas_hover_layer, + working_text, + empty, + missing, + foreign_drag, + picked, + } + } + + /// `self` in `held`: the held value while it is equal, else a new `Tracked`, so the panel's key moves only when + /// what it shows changed. + pub(crate) fn held(self, held: Option>) -> Tracked { + match held { + Some(held) if *held == self => held, + _ => Tracked::new(self), + } } fn doc(&self) -> &Document { - &self.st.doc + &self.doc } fn layer(&self, id: &LayerId) -> Option<&Layer> { - self.st.doc.layer(*id) + self.doc.layer(*id) } /// The layers a property edit changes: every selected layer with the active one among them, /// the Background left out of a several-layer change (#5856), else the active one. pub(crate) fn targets(&self) -> Vec { - let Some(active) = self.st.active_layer else { return Vec::new() }; - let selection = self.st.selected_layers(); + let Some(active) = self.active_layer else { return Vec::new() }; + let selection = self.selected.clone(); if selection.len() > 1 && selection.contains(&active) { selection.iter().copied().filter(|id| *id == active || !self.doc().is_background(*id)).collect() } else { @@ -133,7 +199,7 @@ impl<'a> PhotoLayers<'a> { let layer = LayerId(picked.0); let mut at = Some(layer); while let Some(id) = at { - if !photocraft_engine::select_extra_cmds::isolation_shows(self.doc(), &self.st.isolated_layers, id) { + if !photocraft_engine::select_extra_cmds::isolation_shows(self.doc(), &self.isolated_layers, id) { return None; } at = self.parent(&id); @@ -141,7 +207,7 @@ impl<'a> PhotoLayers<'a> { return None; } } - let filter = &self.app.ui.layer_filter; + let filter = &self.filter; (self.effects_open(&layer) && (!filter.active() || self.listed(&layer, filter))).then_some(picked) } @@ -163,7 +229,7 @@ pub(crate) fn filter_index(doc: &Document, id: &LayerId, row: usize) -> Option { +impl LayerTree for PhotoLayers { type Id = LayerId; fn children(&self, parent: Option<&LayerId>) -> Vec { @@ -174,7 +240,7 @@ impl LayerTree for PhotoLayers<'_> { list.iter() .rev() .filter(|l| Some(l.id.0) != self.working_text) - .filter(|l| photocraft_engine::select_extra_cmds::isolation_shows(self.doc(), &self.st.isolated_layers, l.id)) + .filter(|l| photocraft_engine::select_extra_cmds::isolation_shows(self.doc(), &self.isolated_layers, l.id)) .map(|l| l.id) .collect() } @@ -188,7 +254,7 @@ impl LayerTree for PhotoLayers<'_> { } fn effects_open(&self, id: &LayerId) -> bool { - !self.st.fx_collapsed.contains(id) + !self.fx_collapsed.contains(id) } fn info(&self, id: &LayerId) -> LayerInfo { @@ -281,21 +347,7 @@ impl LayerTree for PhotoLayers<'_> { } fn selection(&self) -> LayerSelection { - let ui = &self.app.ui; - let active = self.st.active_layer; - let layer = active.and_then(|id| self.layer(&id)); - let target = match layer { - Some(l) if l.frame.is_some() => match crate::frame_tool::target(self.app, l) { - crate::frame_tool::Target::Frame => LayerPart::FrameShape, - crate::frame_tool::Target::Content => LayerPart::FrameContent, - crate::frame_tool::Target::Both => LayerPart::Pixels, - }, - Some(l) if ui.filter_mask_target == Some(l.id.0) && self.app.filter_mask_targeted() => LayerPart::FilterMask, - Some(l) if ui.vector_mask_target && l.vector_mask.is_some() => LayerPart::VectorMask, - Some(l) if ui.mask_target && l.mask.is_some() => LayerPart::LayerMask, - _ => LayerPart::Pixels, - }; - let mut selection = LayerSelection::new(self.st.selected_layers().to_vec(), active, target); + let mut selection = LayerSelection::new(self.selected.clone(), self.active_layer, self.target); selection.sub_row = self.selected_filter().and_then(|(layer, index)| { let id = LayerId(layer); let row = match index { @@ -354,7 +406,7 @@ impl LayerTree for PhotoLayers<'_> { } fn properties(&self) -> Option { - let l = self.st.active_layer.and_then(|id| self.layer(&id))?; + let l = self.active_layer.and_then(|id| self.layer(&id))?; let mut p = LayerProperties::new(l.blend.key().to_string()); // Pass Through is a group's mode: offered only when every target is a group. p.group = self.targets().iter().all(|id| self.layer(id).is_some_and(Layer::is_group)); @@ -383,18 +435,17 @@ impl LayerTree for PhotoLayers<'_> { } fn footer(&self) -> LayersFooterState { - let ui = &self.app.ui; - let active = self.st.active_layer.and_then(|id| self.layer(&id)); - let delete = if ui.vector_mask_target && active.is_some_and(|l| l.vector_mask.is_some()) { + let active = self.active_layer.and_then(|id| self.layer(&id)); + let delete = if self.vector_mask_target && active.is_some_and(|l| l.vector_mask.is_some()) { "Delete Vector Mask" - } else if ui.mask_target && active.is_some_and(|l| l.mask.is_some()) { + } else if self.mask_target && active.is_some_and(|l| l.mask.is_some()) { "Delete Layer Mask" } else { "Delete layer" }; let mut footer = LayersFooterState::new(tl!(delete).to_string()); footer.delete_enabled = active.is_some(); - footer.link_enabled = self.app.session.is_enabled("layer.linkLayers"); + footer.link_enabled = self.link_enabled; footer.mask_label = crate::layer_menu_ui::mask_button_command(active, self.doc().selection.is_some(), false).map(|_| { if active.is_some_and(|l| l.mask.is_some()) { tl!("Add vector mask").to_string() @@ -457,18 +508,7 @@ impl LayerTree for PhotoLayers<'_> { } fn hovered(&self) -> Option { - self.app.canvas_hover_layer - } - - /// Rows move, open, close or appear only through the layer stack, whose index every write drops, the document - /// revision (isolation, the selection) and the Layers view revision (effects lists and groups opened or closed). - /// A Type Mask session's working text comes and goes outside all three, so the rows are walked each pass while it - /// runs. - fn revision(&self) -> Option { - if self.working_text.is_some() { - return None; - } - Some(Revision::of(&(self.doc().id.0, self.st.revision, self.st.layers_view_revision(), self.doc().layers.index().serial())).get()) + self.hovered } } @@ -488,7 +528,7 @@ enum MenuKind { None, } -fn menu_kind(tree: &PhotoLayers<'_>, target: &MenuTarget) -> MenuKind { +fn menu_kind(tree: &PhotoLayers, target: &MenuTarget) -> MenuKind { match &target.row { None => MenuKind::Empty, Some(LayerRowKey::Effects(..)) => MenuKind::Effects, @@ -529,8 +569,7 @@ pub(crate) const MASK_OPTIONS: &str = "layersPanel:maskOptions"; /// The row menu at `target` as entries: the layer menu (Photoshop's order, trimmed to the kind), /// a mask thumbnail's menu, a pixel thumbnail's, an effects row's, or the empty space's. -pub(crate) fn row_menu(tree: &PhotoLayers<'_>, target: &MenuTarget) -> Vec> { - let app = tree.app; +pub(crate) fn row_menu(app: &PhotocraftApp, tree: &PhotoLayers, target: &MenuTarget) -> Vec> { let has_selection = tree.doc().selection.is_some(); let commands = |entries: Vec, on_set: bool| -> Vec> { let mut out: Vec> = Vec::new(); diff --git a/crates/ui-egui/src/panels/mask_thumbs_ui/tests.rs b/crates/ui-egui/src/panels/mask_thumbs_ui/tests.rs index e13111e010..6f5bf74d8d 100644 --- a/crates/ui-egui/src/panels/mask_thumbs_ui/tests.rs +++ b/crates/ui-egui/src/panels/mask_thumbs_ui/tests.rs @@ -368,7 +368,7 @@ fn a_new_adjustment_or_fill_layer_shows_its_settings_until_the_mask_thumbnail_is /// The group (by its place in the docking layout) that holds panel `id` is minimized. fn group_minimized(app: &PhotocraftApp, id: &str) -> bool { - let layout = &app.ui.docking.layout; + let layout = &app.ui.docking.layout(); let place = layout.place(&id.into()).expect("the panel is docked"); layout.group(&place).expect("its group").minimized } diff --git a/crates/ui-egui/src/panels/panel_docking.rs b/crates/ui-egui/src/panels/panel_docking.rs index 0f48309434..38304229f5 100644 --- a/crates/ui-egui/src/panels/panel_docking.rs +++ b/crates/ui-egui/src/panels/panel_docking.rs @@ -7,15 +7,17 @@ use craft::behavior::dock::{Action, DockEdge, DockPlacement, Layout, Node, PanelPlace, PanelState, Permissions, SplitSize, Target}; use craft::behavior::{DockSide, EditEvent, EditEvents, IconId}; -use craft::ui::contract::{Bind, BodyCx, SizeLimits}; +use std::collections::BTreeSet; +use std::sync::Arc; + +use craft::ui::contract::{Bind, BodyCx, PlainData, SizeLimits, Tracked}; use craft::ui::docking::{ - DockCommands, DockConfig, DockEvent, DockPanels, DockScene, DockSizes, DockTo, DragUnit, FloatSpace, GroupAt, HidePanels, PanelSpec, actions, move_actions, - request_actions, + DockCommands, DockConfig, DockEvent, DockGrid, DockPanels, DockScene, DockSizes, DockTo, DragUnit, FloatSpace, GroupAt, HidePanels, PanelKey, PanelSpec, + PanelSpecs, actions, move_actions, request_actions, }; use craft::ui::menu::PanelRow; use craft::ui::patterns::dock::{DockArea, DockAreaOutput}; use craft::ui::primitives::IconSpec; -use craft::ui::rails::ToolRail; use serde_json::{Map, Value, json}; use super::registry::{self, CANVAS, CANVAS_MIN, LEGACY_GROUPS, TOOLBAR}; @@ -37,21 +39,21 @@ fn permissions(panel: &str) -> Permissions { /// Whether `panel` is in the workspace, docked or floating. pub(crate) fn is_shown(app: &PhotocraftApp, id: &str) -> bool { - app.ui.docking.layout.contains(&id.to_owned()) + app.ui.docking.layout().contains(&id.to_owned()) } /// Whether `panel`'s Window menu row is checked: it is in the layout, or, in a column collapsed to icons, its flyout is /// open. pub(crate) fn is_checked(app: &PhotocraftApp, id: &str) -> bool { let panel = id.to_owned(); - if app.ui.docking.layout.opens_in_flyout(&panel) { app.ui.flyout.as_ref() == Some(&panel) } else { is_shown(app, id) } + if app.ui.docking.layout().opens_in_flyout(&panel) { app.ui.flyout.as_ref() == Some(&panel) } else { is_shown(app, id) } } /// Whether `panel` shows: the active tab of its group in an expanded column, neither the group minimized nor its column /// collapsed, or the panel open in a collapsed column's flyout. pub(crate) fn is_front(app: &PhotocraftApp, id: &str) -> bool { let panel = id.to_owned(); - let layout = &app.ui.docking.layout; + let layout = app.ui.docking.layout(); layout.panel_state(&panel) == PanelState::Front || (layout.opens_in_flyout(&panel) && app.ui.flyout.as_ref() == Some(&panel)) } @@ -63,7 +65,7 @@ pub(crate) fn show_panel(app: &mut PhotocraftApp, id: &str, show: Option) let panel = registry::normalize(id).ok_or_else(|| format!("`{id}` is not a registered panel"))?; let owned = panel.to_owned(); let show = show.unwrap_or_else(|| !is_front(app, panel)); - if app.ui.docking.layout.opens_in_flyout(&owned) { + if app.ui.docking.layout().opens_in_flyout(&owned) { app.ui.flyout = show.then_some(owned); return Ok(show); } @@ -73,7 +75,7 @@ pub(crate) fn show_panel(app: &mut PhotocraftApp, id: &str, show: Option) let action = if show { Action::open(owned.clone(), None) } else { Action::close(owned.clone()) }; apply(app, vec![action])?; // A panel that opened into a column of icons shows in its flyout. - if show && app.ui.docking.layout.opens_in_flyout(&owned) { + if show && app.ui.docking.layout().opens_in_flyout(&owned) { app.ui.flyout = Some(owned); } Ok(show) @@ -96,7 +98,7 @@ fn apply_during(app: &mut PhotocraftApp, actions: Vec>, dragging: if request_actions(app.ctx(), actions).is_ok() { return Ok(closed); } - app.ui.docking = next; + app.ui.docking = Arc::new(next); stop_closed_timeline(app, &closed); if !dragging { crate::dock::persist(app); @@ -106,7 +108,7 @@ fn apply_during(app: &mut PhotocraftApp, actions: Vec>, dragging: /// Whether a workspace gesture of the pass (a divider drag, a window move) is still running after it: its last /// event is its begin or a step, not its commit or cancel. The area's own one-step edits belong to no gesture. -fn dragging(edit: &EditEvents) -> bool { +fn dragging(edit: &EditEvents>) -> bool { edit.iter().rfind(|event| event.id().is_some()).is_some_and(|event| matches!(event, EditEvent::Begin { .. } | EditEvent::Update { .. })) } @@ -117,10 +119,10 @@ pub(crate) fn check(app: &PhotocraftApp, actions: &[Action]) -> Result<( /// The workspace `actions` make of the live one, and the panels they close; the refusals of [`apply`] and [`check`]. fn planned(app: &PhotocraftApp, actions: &[Action]) -> Result<(Workspace, Vec), String> { - let mut next = app.ui.docking.clone(); + let mut next = Workspace::clone(&app.ui.docking); let closed = next.apply_all(actions.iter().cloned(), app.workspaces.set.locked, |panel: &String| permissions(panel)).map_err(|error| error.to_string())?; // The model leaves the panel registry to the application: an action may not bring in an unknown panel. - if let Some(unknown) = next.layout.panels().into_iter().find(|panel| !registry::registered(panel)) { + if let Some(unknown) = next.layout().panels().into_iter().find(|panel| !registry::registered(panel)) { return Err(format!("`{unknown}` is not a registered panel")); } Ok((next, closed)) @@ -133,16 +135,72 @@ fn stop_closed_timeline(app: &mut PhotocraftApp, closed: &[String]) { } } +/// What of the panels' specs changes while the app runs: the labels, in the interface language, and the toolbar's cell +/// count. The rest of a spec comes from the registry. The dock holds it in a `Tracked` and reads specs only when its +/// revision moves. +#[derive(Clone, Debug, Default, PartialEq, PlainData)] +pub(crate) struct DockSpecs { + /// The interface language the labels are in. + lang: String, + /// Each registered panel's label, by panel id. + labels: Vec<(String, String)>, + /// The canvas group's label. + documents: String, + /// The toolbar's cells ([`super::toolbar::cells`]). + toolbar_cells: usize, +} + +impl DockSpecs { + /// The specs' model for the interface language and the toolbar now. + fn of(app: &PhotocraftApp) -> Self { + let labels = registry::PANELS.iter().map(|entry| (entry.id.to_owned(), (entry.label)())).collect(); + DockSpecs { lang: crate::i18n::current().code().to_owned(), labels, documents: tl!("Documents").to_string(), toolbar_cells: super::toolbar::cells(app) } + } +} + +impl PanelSpecs for DockSpecs { + fn spec(&self, panel: &String) -> PanelSpec { + spec(self, panel) + } + + fn permissions(&self, panel: &String) -> Permissions { + permissions(panel) + } +} + +/// What the dock keeps of the app's panels: the specs, and the panels that stay while Shift+Tab hides the rest. +pub(crate) struct DockModel { + specs: Arc>, + keeps_toolbar: Arc>>, +} + +impl Default for DockModel { + fn default() -> Self { + DockModel { specs: Arc::default(), keeps_toolbar: Arc::new(Tracked::new(BTreeSet::from([PanelKey::of(TOOLBAR)]))) } + } +} + +/// The spec model for the interface language and the toolbar now: the held one while both are unchanged. +fn dock_specs(app: &mut PhotocraftApp) -> Arc> { + let lang = crate::i18n::current().code(); + let toolbar_cells = super::toolbar::cells(app); + let held = &app.dock_model.specs; + if held.lang != lang || held.toolbar_cells != toolbar_cells || held.labels.is_empty() { + app.dock_model.specs = Arc::new(Tracked::new(DockSpecs::of(app))); + } + Arc::clone(&app.dock_model.specs) +} + /// What the dock reads of `panel`: its name, icon, least size, group heights, float size and, for the toolbar, the grid /// its column is whole steps of and its float in the main window. -fn spec(app: &PhotocraftApp, panel: &str) -> PanelSpec { +fn spec(specs: &DockSpecs, panel: &str) -> PanelSpec { if panel == CANVAS { let least = SizeLimits::at_least(egui::vec2(CANVAS_MIN[0], CANVAS_MIN[1])); - return PanelSpec::new(tl!("Documents").to_string()).canvas().limits(least).allow_native(false); + return PanelSpec::new(specs.documents.clone()).canvas().limits(least).allow_native(false); } let Some(entry) = registry::entry(panel) else { return PanelSpec::new(panel.to_owned()) }; - let mut spec = - PanelSpec::new((entry.label)()).icon(IconSpec::svg(IconId::new(entry.icon))).limits(SizeLimits::at_least(egui::vec2(entry.min[0], entry.min[1]))); + let label = specs.labels.iter().find(|(id, _)| id == panel).map_or_else(|| (entry.label)(), |(_, label)| label.clone()); + let mut spec = PanelSpec::new(label).icon(IconSpec::svg(IconId::new(entry.icon))).limits(SizeLimits::at_least(egui::vec2(entry.min[0], entry.min[1]))); if let Some(heights) = entry.heights { spec = spec.heights(heights); } @@ -152,7 +210,7 @@ fn spec(app: &PhotocraftApp, panel: &str) -> PanelSpec { if panel == TOOLBAR { // The toolbar floats in the main window, as production's: its tooltips, tool flyouts and Edit Toolbar drawer // open beside the one-button-wide rail, which its own OS window would clip. - spec = spec.grid(ToolRail::::dock_grid(app.ctx(), super::toolbar::cells(app))).allow_native(false); + spec = spec.grid(DockGrid::rail(specs.toolbar_cells)).allow_native(false); } spec } @@ -163,14 +221,6 @@ struct Panels<'a> { } impl DockPanels for Panels<'_> { - fn spec(&self, panel: &String) -> PanelSpec { - spec(self.app, panel) - } - - fn permissions(&self, panel: &String) -> Permissions { - permissions(panel) - } - fn body(&mut self, panel: &String, ui: &mut egui::Ui, _: &mut BodyCx<'_>) { body(self.app, ui, panel); } @@ -227,15 +277,16 @@ pub(crate) fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui, panels_hidden: bo let locked = app.workspaces.set.locked; let auto_collapse = app.session.prefs().workspace.auto_collapse_icon_panels; // A flyout stays open only while its panel is in a column collapsed to icons. - if app.ui.flyout.as_ref().is_some_and(|panel| !app.ui.docking.layout.opens_in_flyout(panel)) { + if app.ui.flyout.as_ref().is_some_and(|panel| !app.ui.docking.layout().opens_in_flyout(panel)) { app.ui.flyout = None; } let flyout = app.ui.flyout.clone(); - let keeps_toolbar = |panel: &String| panel == TOOLBAR; + let specs = dock_specs(app); + let keeps_toolbar = Arc::clone(&app.dock_model.keeps_toolbar); let config = DockConfig::default().group_order_items(true).native_windows(cfg!(not(target_arch = "wasm32"))); let output: DockAreaOutput = { let mut panels = Panels { app: &mut *app }; - let mut area = DockArea::new(tl!("Panels").to_string(), Bind::given(workspace), &mut panels, config); + let mut area = DockArea::new(tl!("Panels").to_string(), Bind::given(workspace), &*specs, &mut panels, config); if locked { area = area.locked(); } @@ -248,7 +299,7 @@ pub(crate) fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui, panels_hidden: bo area.flyout(Bind::given(flyout)).show(ui) }; #[cfg(test)] - probe::record_windows(&ctx, &app.ui.docking.layout, &output.windows); + probe::record_windows(&ctx, app.ui.docking.layout(), &output.windows); let DockAreaOutput { actions, requested, events, error, edit, window_files, .. } = output; if let Some(error) = error { app.ui.status = format!("{}: {}", tl!("Invalid panel layout"), error.error); @@ -288,7 +339,8 @@ pub(crate) fn width_actions(app: &PhotocraftApp, ctx: &egui::Context, total: f32 if !total.is_finite() || total <= 0.0 { return Vec::new(); } - DockSizes::of(ctx).resize_side(&app.ui.docking.layout, DockEdge::End, &|panel: &String| spec(app, panel), total) + let specs = DockSpecs::of(app); + DockSizes::of(ctx).resize_side(app.ui.docking.layout(), DockEdge::End, &|panel: &String| spec(&specs, panel), total) } // --------------------------------------------------------------------------------------------------------------- @@ -354,13 +406,13 @@ fn show_param(params: &Value) -> Result, String> { /// [`show_panel`] with the protocol's answer. fn toggled(app: &mut PhotocraftApp, panel: &str, show: Option) -> Result { let shown = show_panel(app, panel, show)?; - Ok(json!({"panel": panel, "shown": shown, "layout": app.ui.docking.layout})) + Ok(json!({"panel": panel, "shown": shown, "layout": app.ui.docking.layout()})) } /// Runs `actions` through [`apply`] with the protocol's answer. fn run(app: &mut PhotocraftApp, actions: Vec>) -> Result { let closed = apply(app, actions)?; - Ok(json!({"layout": app.ui.docking.layout, "closed": closed})) + Ok(json!({"layout": app.ui.docking.layout(), "closed": closed})) } /// The params as an object, panels named by id or label and `onto` standing for `anchor`. The canvas may be an @@ -442,7 +494,7 @@ fn with_scene(app: &PhotocraftApp, f: impl FnOnce(&DockScene<'_, String>) -> let space = FloatSpace::new(egui::Rect::NOTHING, &sizes); let policy = |panel: &String| permissions(panel); let workspace = &app.ui.docking; - let scene = DockScene::new(&workspace.layout, &space, app.workspaces.set.locked, &policy).floated(&workspace.floated); + let scene = DockScene::new(workspace.layout(), &space, app.workspaces.set.locked, &policy).floated(workspace.floated()); f(&scene) } @@ -546,7 +598,7 @@ fn minimize_command(app: &mut PhotocraftApp, params: &Value) -> Result !minimized(&app.ui.docking.layout, &panel), + None | Some(Value::Null) => !minimized(app.ui.docking.layout(), &panel), Some(value) => value.as_bool().ok_or("minimized must be a boolean")?, }; run(app, vec![Action::set_minimized(panel, on)]) @@ -557,7 +609,7 @@ fn minimize_command(app: &mut PhotocraftApp, params: &Value) -> Result Result { let fields = fields(params)?; let panel = required_panel(&fields)?; - let layout = &app.ui.docking.layout; + let layout = app.ui.docking.layout(); let current = layout.place(&panel).and_then(|place| layout.column(&place)).map(|column| column.iconic).ok_or("panel is hidden")?; let on = match fields.get("iconic") { None | Some(Value::Null) => !current, @@ -575,7 +627,7 @@ fn window_command(app: &mut PhotocraftApp, params: &Value) -> Result Vec::new(), (true, false) => vec![Action::move_group(panel.clone(), Target::float(float_rect(&fields, &panel)?))], @@ -650,7 +702,7 @@ fn group_command(app: &mut PhotocraftApp, params: &Value) -> Result Result return Err("operation must be close, collapse, expand, move, up or down".into()), }; apply(app, actions)?; - Ok(json!({"layout": app.ui.docking.layout})) + Ok(json!({"layout": app.ui.docking.layout()})) } // --------------------------------------------------------------------------------------------------------------- @@ -699,7 +751,7 @@ fn newer(docking: &Value) -> bool { /// shows the default; [`snapshot`] writes a newer one back unchanged until the arrangement changes. A save from /// before the workspace (`panels`, `dockTabs`, `dock`, `timelineOpen`) migrates once onto the default. pub(crate) fn load(app: &mut PhotocraftApp, saved: &Value) { - app.ui.docking.replace(loaded(saved)); + Arc::make_mut(&mut app.ui.docking).replace(loaded(saved)); } /// [`load`] at launch: Brush Settings is a transient window, so a remembered workspace that holds it loads with it @@ -707,12 +759,12 @@ pub(crate) fn load(app: &mut PhotocraftApp, saved: &Value) { pub(crate) fn load_at_launch(app: &mut PhotocraftApp, saved: &Value) { let mut workspace = loaded(saved); let transient = "brushSettings".to_owned(); - if workspace.layout.contains(&transient) + if workspace.layout().contains(&transient) && let Err(error) = workspace.apply(Action::close(transient), false, |panel: &String| permissions(panel)) { app.ui.status = error.to_string(); } - app.ui.docking.replace(workspace); + Arc::make_mut(&mut app.ui.docking).replace(workspace); } /// The workspace of a saved layout, fitted to the registry. A save that predates the toolbar panel brings the toolbar's @@ -724,7 +776,7 @@ fn loaded(saved: &Value) -> Workspace { let mut workspace = match saved.get("docking") { Some(docking) if docking.is_object() => match serde_json::from_value::(docking.clone()) { Ok(workspace) if workspace.validate().is_ok() => { - predates_toolbar = !workspace.layout.contains(&toolbar) && !workspace.hidden.iter().any(|(panel, _)| *panel == toolbar); + predates_toolbar = !workspace.layout().contains(&toolbar) && !workspace.hidden().iter().any(|(panel, _)| *panel == toolbar); workspace } _ => default.clone(), @@ -764,7 +816,7 @@ fn migrate_toolbar(workspace: &mut Workspace, panels: Option<&Value>) { if panels.get("toolbar").and_then(Value::as_bool) == Some(false) { actions.push(Action::close(toolbar.clone())); } else { - if !workspace.layout.contains(&toolbar) { + if !workspace.layout().contains(&toolbar) { actions.push(Action::open(toolbar.clone(), None)); } if panels.get("toolbar_double").and_then(Value::as_bool) == Some(true) { @@ -778,7 +830,7 @@ fn migrate_toolbar(workspace: &mut Workspace, panels: Option<&Value>) { _ => false, }; if right { - let to = match end_edge_anchor(&workspace.layout, &toolbar) { + let to = match end_edge_anchor(workspace.layout(), &toolbar) { Some(anchor) => Target::at(anchor, DockPlacement::column(false)), None => Target::new_dock(DockEdge::End), }; @@ -807,7 +859,7 @@ fn migrated(saved: &Value, default: &Workspace) -> Workspace { if let Some(picks) = tabs.as_mut().and_then(Value::as_object_mut) { picks.retain(|key, _| panels.and_then(|panels| panels.get(key)).and_then(Value::as_bool) != Some(false)); } - let Ok(mut actions) = legacy_on(&default.layout, panels, tabs.as_ref(), dock.as_ref()) else { return default.clone() }; + let Ok(mut actions) = legacy_on(default.layout(), panels, tabs.as_ref(), dock.as_ref()) else { return default.clone() }; if saved.get("timelineOpen").and_then(Value::as_bool) == Some(true) { actions.push(Action::open("timeline".to_owned(), None)); } @@ -823,7 +875,7 @@ fn migrated(saved: &Value, default: &Workspace) -> Workspace { pub(crate) fn snapshot(app: &PhotocraftApp) -> Value { let kept = app.session.prefs().panel_layout.get("docking").filter(|docking| newer(docking)).cloned(); let docking = match kept { - Some(kept) if app.ui.docking == registry::default_workspace() => kept, + Some(kept) if *app.ui.docking == registry::default_workspace() => kept, _ => json!(app.ui.docking), }; json!({"panels": app.ui.panels, "docking": docking}) @@ -872,7 +924,7 @@ pub(crate) fn legacy_actions( if dock.is_some_and(|dock| dock.get("order").is_some() || dock.get("heights").is_some()) { return Err("dock order/heights cannot replace a customized layout; use window.panel.layout".into()); } - legacy_on(&app.ui.docking.layout, panels, dock_tabs, dock) + legacy_on(app.ui.docking.layout(), panels, dock_tabs, dock) } /// [`legacy_actions`] on `layout`, without the order and heights refusal. @@ -942,7 +994,7 @@ fn legacy_on(layout: &Layout, panels: Option<&Value>, dock_tabs: Option< /// of the group's panels shows, `dockTabs.` the index of its selected panel in the group's tab order, for the /// groups that show. pub(crate) fn legacy_view(app: &PhotocraftApp) -> Value { - let layout = &app.ui.docking.layout; + let layout = app.ui.docking.layout(); let mut panels = Map::new(); let mut tabs = Map::new(); for (key, members) in LEGACY_GROUPS { @@ -968,7 +1020,7 @@ pub(crate) mod probe { /// The panels of the tab group holding `panel`, in tab order. pub(crate) fn group_of(app: &PhotocraftApp, panel: &str) -> Vec { - group_members(&app.ui.docking.layout, &panel.to_owned()) + group_members(app.ui.docking.layout(), &panel.to_owned()) } /// The tab group holding `panel` as the last pass drew it, header and body: the group's node, a tab panel named diff --git a/crates/ui-egui/src/panels/panel_docking/native_tests.rs b/crates/ui-egui/src/panels/panel_docking/native_tests.rs index 5d6ca6b9ee..ba5abe2605 100644 --- a/crates/ui-egui/src/panels/panel_docking/native_tests.rs +++ b/crates/ui-egui/src/panels/panel_docking/native_tests.rs @@ -283,7 +283,7 @@ fn a_floated_toolbar_stays_in_the_main_window_while_other_panels_get_os_windows( desktop.h.state_mut().run("window.panel.window", json!({"panel": panel})).unwrap(); } desktop.steps(3); - let floating = |panel: &str| matches!(desktop.h.state().ui.docking.layout.place(&panel.to_owned()), Some(PanelPlace::Floating { .. })); + let floating = |panel: &str| matches!(desktop.h.state().ui.docking.layout().place(&panel.to_owned()), Some(PanelPlace::Floating { .. })); assert!(floating(TOOLBAR) && floating("layers"), "both panels float"); assert!(desktop.window(TOOLBAR).is_none(), "the toolbar floats in the main window"); assert!(desktop.window("layers").is_some(), "the Layers panel floats in its own OS window"); diff --git a/crates/ui-egui/src/panels/panel_docking/tests.rs b/crates/ui-egui/src/panels/panel_docking/tests.rs index 9a574bc51a..9f7113a25b 100644 --- a/crates/ui-egui/src/panels/panel_docking/tests.rs +++ b/crates/ui-egui/src/panels/panel_docking/tests.rs @@ -26,24 +26,24 @@ fn saved(app: &PhotocraftApp) -> Value { } fn floating(app: &PhotocraftApp, panel: &str) -> bool { - app.ui.docking.layout.floating.iter().any(|window| window.contains(panel)) + app.ui.docking.layout().floating.iter().any(|window| window.contains(panel)) } /// The panel's group is minimized. fn minimized(app: &PhotocraftApp, panel: &str) -> bool { - let layout = &app.ui.docking.layout; + let layout = app.ui.docking.layout(); layout.place(&panel.to_owned()).is_some_and(|place| layout.group(&place).is_some_and(|group| group.minimized)) } /// The panel's column is collapsed to icons. fn iconic(app: &PhotocraftApp, panel: &str) -> bool { - let layout = &app.ui.docking.layout; + let layout = app.ui.docking.layout(); layout.place(&panel.to_owned()).and_then(|place| layout.column(&place)).is_some_and(|column| column.iconic) } /// The selected tab of the group holding `panel`. fn active_tab(app: &PhotocraftApp, panel: &str) -> Option { - let layout = &app.ui.docking.layout; + let layout = app.ui.docking.layout(); let place = layout.place(&panel.to_owned())?; layout.group(&place)?.active_panel().cloned() } @@ -147,18 +147,18 @@ fn window_panel_ids_drive_the_workspace() { // A floated panel docks back to where it floated from; a floating group docks all of its panels. let mut app = self::app(); - let before = app.ui.docking.layout.clone(); + let before = app.ui.docking.layout().clone(); invoke(&mut app, "window.panel.float", json!({"panel": "properties", "x": 50, "y": 70, "width": 330, "height": 410})).unwrap(); assert!(floating(&app, "properties")); - assert!(app.ui.docking.floated.iter().any(|(panel, _)| panel == "properties"), "the workspace records where it floated from"); + assert!(app.ui.docking.floated().iter().any(|(panel, _)| panel == "properties"), "the workspace records where it floated from"); invoke(&mut app, "window.panel.dock", json!({"panel": "properties"})).unwrap(); - assert_eq!(app.ui.docking.layout, before, "the panel is back where it was"); + assert_eq!(*app.ui.docking.layout(), before, "the panel is back where it was"); invoke(&mut app, "window.panel.float", json!({"panel": "paths"})).unwrap(); invoke(&mut app, "window.panel.move", json!({"panel": "history", "anchor": "paths"})).unwrap(); - assert!(app.ui.docking.layout.floating.iter().any(|w| w.contains("paths") && w.contains("history"))); + assert!(app.ui.docking.layout().floating.iter().any(|w| w.contains("paths") && w.contains("history"))); invoke(&mut app, "window.panel.dock", json!({"panel": "paths", "group": true})).unwrap(); - assert!(!floating(&app, "paths") && !floating(&app, "history"), "{:?}", app.ui.docking.layout.floating); + assert!(!floating(&app, "paths") && !floating(&app, "history"), "{:?}", app.ui.docking.layout().floating); assert!(is_shown(&app, "paths") && is_shown(&app, "history")); // A panel no workspace has placed opens in its own group, and the panels of that group meet there. @@ -203,13 +203,13 @@ fn saved_workspace_restores_the_custom_tree_and_hidden_panel_placement() { invoke(&mut app, "window.panel.move", json!({"panel": "swatches", "anchor": "layers", "zone": "top"})).unwrap(); invoke(&mut app, "window.panel.float", json!({"panel": "properties", "x": 50, "y": 80})).unwrap(); invoke(&mut app, "window.panel.close", json!({"panel": "swatches"})).unwrap(); - assert!(app.ui.docking.hidden.iter().any(|(panel, _)| panel == "swatches")); + assert!(app.ui.docking.hidden().iter().any(|(panel, _)| panel == "swatches")); let written = crate::dock::snapshot(&app); let mut reloaded = self::app(); crate::dock::apply(&mut reloaded, &written); - assert_eq!(reloaded.ui.docking.layout, app.ui.docking.layout); - assert_eq!(reloaded.ui.docking.hidden, app.ui.docking.hidden); + assert_eq!(reloaded.ui.docking.layout(), app.ui.docking.layout()); + assert_eq!(reloaded.ui.docking.hidden(), app.ui.docking.hidden()); invoke(&mut reloaded, "window.panel.swatches", json!({"show": true})).unwrap(); assert!(is_front(&reloaded, "swatches"), "the closed panel reopens"); assert!(!probe::group_of(&reloaded, "layers").contains(&"swatches".to_owned()), "at its own place, in a group above Layers"); @@ -258,7 +258,7 @@ fn a_pre_docking_save_migrates_once() { assert!(written.get("dockTabs").is_none() && written.get("dock").is_none(), "the old keys are not written back"); let mut again = self::app(); crate::dock::apply(&mut again, &written); - assert_eq!((&again.ui.docking.layout, &again.ui.docking.hidden), (&app.ui.docking.layout, &app.ui.docking.hidden), "a second load changes nothing"); + assert_eq!((again.ui.docking.layout(), again.ui.docking.hidden()), (app.ui.docking.layout(), app.ui.docking.hidden()), "a second load changes nothing"); } /// `ui.set` maps the old panel and dock words onto workspace changes, all fields or none. @@ -284,8 +284,11 @@ fn ui_set_dock_fields_map_onto_the_workspace_atomically() { // The end dock's total after a `dockWidth` request. assert!(ok(&mut app, json!({"dockWidth": 400.0}))); let sizes = DockSizes::of(&ctx); - let total: f32 = - end_columns(&app.ui.docking.layout).expect("the end dock").iter().map(|column| sizes.width(column, &|panel: &String| spec(&app, panel))).sum(); + let total: f32 = end_columns(app.ui.docking.layout()) + .expect("the end dock") + .iter() + .map(|column| sizes.width(column, &|panel: &String| spec(&DockSpecs::of(&app), panel))) + .sum(); assert!((total - 400.0).abs() < 1.0, "{total}"); // One bad field applies nothing, whatever the good fields say. @@ -332,11 +335,11 @@ fn main_workspace_file_loads_as_the_default_and_saves_as_a_workspace() { crate::dock::apply(&mut app, &saved); app.ui.docking.validate().expect("the loaded workspace is valid"); for entry in registry::PANELS { - assert!(is_shown(&app, entry.id) || app.ui.docking.hidden.iter().any(|(panel, _)| panel == entry.id), "{} is shown or can be reopened", entry.id); + assert!(is_shown(&app, entry.id) || app.ui.docking.hidden().iter().any(|(panel, _)| panel == entry.id), "{} is shown or can be reopened", entry.id); } assert!(is_shown(&app, "layers")); // The save predates the toolbar panel and has no start dock: the toolbar comes back docked at the start. - assert_eq!(toolbar_edge(&app), Some(DockEdge::Start), "the toolbar is docked at the start: {:?}", app.ui.docking.layout); + assert_eq!(toolbar_edge(&app), Some(DockEdge::Start), "the toolbar is docked at the start: {:?}", app.ui.docking.layout()); invoke(&mut app, "window.panel.float", json!({"panel": "properties"})).unwrap(); let written = crate::dock::snapshot(&app); @@ -344,12 +347,12 @@ fn main_workspace_file_loads_as_the_default_and_saves_as_a_workspace() { assert_eq!(written["docking"]["version"], json!(craft::behavior::dock::Workspace::::VERSION)); let mut reloaded = self::app(); crate::dock::apply(&mut reloaded, &written); - assert_eq!((&reloaded.ui.docking.layout, &reloaded.ui.docking.hidden), (&app.ui.docking.layout, &app.ui.docking.hidden)); + assert_eq!((reloaded.ui.docking.layout(), reloaded.ui.docking.hidden()), (app.ui.docking.layout(), app.ui.docking.hidden())); } /// The dock edge the toolbar's column is docked on. fn toolbar_edge(app: &PhotocraftApp) -> Option { - let layout = &app.ui.docking.layout; + let layout = app.ui.docking.layout(); let Some(PanelPlace::Dock { path, .. }) = layout.place(®istry::TOOLBAR.to_owned()) else { return None }; [DockEdge::Start, DockEdge::End].into_iter().find(|edge| layout.dock_path(*edge).as_ref() == Some(&path)) } @@ -364,7 +367,7 @@ fn essentials_keeps_navigator_history_and_brushes_as_icons() { } for panel in ["navigator", "history", "brushes"] { assert!(iconic(&app, panel), "{panel} is an icon"); - assert_eq!(app.ui.docking.layout.panel_state(&panel.to_owned()), PanelState::Open, "{panel} is open but not showing"); + assert_eq!(app.ui.docking.layout().panel_state(&panel.to_owned()), PanelState::Open, "{panel} is open but not showing"); } assert_eq!(toolbar_edge(&app), Some(DockEdge::Start), "the toolbar has the start dock to itself"); } @@ -416,7 +419,7 @@ fn ui_set_toolbar_columns_sets_the_toolbar_columns_steps() { let mut app = app(); let ctx = app.ctx().clone(); let steps = |app: &PhotocraftApp| { - let layout = &app.ui.docking.layout; + let layout = app.ui.docking.layout(); layout.place(®istry::TOOLBAR.to_owned()).and_then(|place| layout.column(&place)).and_then(|column| column.steps) }; assert!(control_set(&mut app, &ctx, json!({"toolbarColumns": 3}))["ok"] == true); diff --git a/crates/ui-egui/src/panels/registry.rs b/crates/ui-egui/src/panels/registry.rs index 7b838778dd..fff40da505 100644 --- a/crates/ui-egui/src/panels/registry.rs +++ b/crates/ui-egui/src/panels/registry.rs @@ -352,7 +352,7 @@ fn full_layout() -> Layout { .iter() .filter_map(|panel| panel.float_size.map(|size| (panel.id, size))) .zip(1_u64..) - .map(|((id, size), window)| Floating::single(vec![id.to_owned()], 0, float_rect(id, size)).with_id(window)) + .map(|((id, size), window)| Floating::single(window, vec![id.to_owned()], 0, float_rect(id, size))) .collect(); Layout::new(Some(root), floating) } diff --git a/crates/ui-egui/src/panels/tool_commands.rs b/crates/ui-egui/src/panels/tool_commands.rs index 2abdd835b2..c974a05be8 100644 --- a/crates/ui-egui/src/panels/tool_commands.rs +++ b/crates/ui-egui/src/panels/tool_commands.rs @@ -2,7 +2,8 @@ //! `tools.select.` (saved shortcuts, `.kys` files, protocol calls), and the rail's slots built from them. use craft::ui::contract::CommandSet; -use craft::ui::rails::{RailTool, SlotId, ToolSlot}; +use craft::ui::contract::Tracked; +use craft::ui::rails::{LastUsed, RailTool, SlotId, ToolSlot}; use photocraft_engine::prefs::ToolbarCustomization; use super::toolbar::layout_sections; @@ -342,11 +343,16 @@ pub(crate) fn slots(toolbar: &ToolbarCustomization) -> Vec> { /// with the toolbar layout): the toolbar, its measure and the dock's grid read them several times a frame. /// /// [`PrefsStore::catalog_rev`]: photocraft_engine::prefs::PrefsStore::catalog_rev +/// +/// It also holds the rail's remembered tools, written only when they change, so the rail's key stays while they do. #[derive(Default)] -pub(crate) struct ToolbarSlots(std::cell::RefCell>); +pub(crate) struct ToolbarSlots(std::cell::RefCell>, std::cell::RefCell>); /// The rail's slots, shared by the readers of one catalog revision. -type RailSlots = std::sync::Arc<[ToolSlot]>; +pub(crate) type RailSlots = std::sync::Arc>>>; + +/// The tool each slot showed last, as the rail reads it. +pub(crate) type Remembered = std::sync::Arc>>; impl ToolbarSlots { /// The slots of `prefs`' toolbar layout. @@ -355,12 +361,21 @@ impl ToolbarSlots { match &*held { Some((rev, slots)) if *rev == prefs.catalog_rev() => slots.clone(), _ => { - let built: RailSlots = slots(&prefs.get().toolbar).into(); + let built: RailSlots = std::sync::Arc::new(Tracked::new(slots(&prefs.get().toolbar))); *held = Some((prefs.catalog_rev(), built.clone())); built } } } + + /// `now` as the rail reads it: the held value while it is equal, a new one when it changed. + pub(crate) fn remembered(&self, now: LastUsed) -> Remembered { + let mut held = self.1.borrow_mut(); + match &*held { + Some(kept) if ***kept == now => kept.clone(), + _ => held.insert(std::sync::Arc::new(Tracked::new(now))).clone(), + } + } } /// `slots` as the group layout `edit.toolbar {"toolbar": ..}` stores: one list of `Tool` names per slot. diff --git a/crates/ui-egui/src/panels/toolbar.rs b/crates/ui-egui/src/panels/toolbar.rs index f80b73bf9a..b158652132 100644 --- a/crates/ui-egui/src/panels/toolbar.rs +++ b/crates/ui-egui/src/panels/toolbar.rs @@ -1,7 +1,7 @@ use super::{PhotocraftApp, Tool, json, vec2}; use craft::behavior::overlay::Side; use craft::color_ui::ui::{PairWell, SwatchPair, Well}; -use craft::ui::contract::{Bind, Gap, Props as _, Show as _, ShowContainer as _, clicked}; +use craft::ui::contract::{Bind, Gap, Props as _, Show as _, ShowContainer as _, Tracked, clicked}; use craft::ui::layout::RowAlign; use craft::ui::layout_components::{Row, Stack}; use craft::ui::rails::{ @@ -168,7 +168,13 @@ fn quick_mask_button(app: &PhotocraftApp, ui: &mut egui::Ui) { const FLYOUTS_OPEN: Side = Side::End; /// The rail over `slots`, its flyouts and drawer opening on `opens`. -fn rail<'a>(slots: &'a [ToolSlot], current: &'a Tool, remembered: &'a LastUsed, opens: Side, editing: bool) -> ToolRail<'a, Tool> { +fn rail<'a>( + slots: &'a Tracked>>, + current: &'a Tool, + remembered: &'a Tracked>, + opens: Side, + editing: bool, +) -> ToolRail<'a, Tool> { let rail = ToolRail::new(Label::Empty, slots, current, remembered).opens(opens).edit_toolbar(tl!("Edit Toolbar…").to_string()); // The drawer's open flag is the one source of "editing". if editing { rail.editing() } else { rail } @@ -200,7 +206,7 @@ fn footer(app: &mut PhotocraftApp, ui: &mut egui::Ui, rail: RailFooter) { struct MeasureKey { width: u32, room: [u32; 2], - slots: std::sync::Arc<[ToolSlot]>, + slots: super::tool_commands::RailSlots, opens: Side, editing: bool, pixels_per_point: u32, @@ -251,7 +257,7 @@ pub(crate) fn measure(app: &mut PhotocraftApp, ui: &egui::Ui, width: f32) -> f32 /// [`measure`] without the kept height: a measuring run of the rail. fn measure_now(app: &mut PhotocraftApp, ui: &egui::Ui, width: f32) -> f32 { let slots = app.toolbar_slots.get(&app.session.prefs); - let remembered = last_used(&slots, &app.ui.group_tools); + let remembered = app.toolbar_slots.remembered(last_used(&slots, &app.ui.group_tools)); let current = app.ui.tool; let (opens, editing) = (FLYOUTS_OPEN, app.ui.toolbar_drawer); rail(&slots, ¤t, &remembered, opens, editing).measure_rail(ui, width, |ui, at| footer(app, ui, at)).y @@ -266,7 +272,7 @@ fn measure_now(app: &mut PhotocraftApp, ui: &egui::Ui, width: f32) -> f32 { pub fn toolbar(app: &mut PhotocraftApp, ui: &mut egui::Ui) { let ctx = ui.ctx().clone(); let slots = app.toolbar_slots.get(&app.session.prefs); - let remembered = last_used(&slots, &app.ui.group_tools); + let remembered = app.toolbar_slots.remembered(last_used(&slots, &app.ui.group_tools)); let current = app.ui.tool; let (opens, editing) = (FLYOUTS_OPEN, app.ui.toolbar_drawer); let out = rail(&slots, ¤t, &remembered, opens, editing).show_rail(ui, |ui, at| footer(app, ui, at)); diff --git a/crates/ui-egui/src/state.rs b/crates/ui-egui/src/state.rs index e291530029..f18a3d4cc6 100644 --- a/crates/ui-egui/src/state.rs +++ b/crates/ui-egui/src/state.rs @@ -370,8 +370,9 @@ pub struct UiState { pub palette: crate::palette::PaletteState, /// The panel layout: every panel's place, the docks, the floating panels and where each one /// docks back to. - #[serde(default = "crate::panels::registry::default_workspace")] - pub docking: craft::behavior::dock::Workspace, + /// One `Arc` across frames: the dock keys what it derives on the workspace's revision. + #[serde(default = "default_docking")] + pub docking: std::sync::Arc>, /// The panel open in the flyout of a column collapsed to icons (`Layout::opens_in_flyout`); the dock area shows it. /// Not saved: a flyout is closed at launch. #[serde(skip)] @@ -446,6 +447,11 @@ pub struct UiState { pub chrome: crate::chrome_ui::ChromeState, } +/// The panel layout at start and for a saved state without one. +fn default_docking() -> std::sync::Arc> { + std::sync::Arc::new(crate::panels::registry::default_workspace()) +} + /// The Brushes panel's state at start and for a saved state without one: the list view. fn brushes_list() -> PresetState { let mut state = PresetState::new(); @@ -521,7 +527,7 @@ impl Default for UiState { window_views: HashMap::new(), theme: crate::theme::AppTheme::default(), palette: Default::default(), - docking: crate::panels::registry::default_workspace(), + docking: default_docking(), flyout: None, color_panel: Default::default(), color_panel_synced: None, diff --git a/crates/ui-egui/src/state/tool.rs b/crates/ui-egui/src/state/tool.rs index 69621daab7..4fee37d9ae 100644 --- a/crates/ui-egui/src/state/tool.rs +++ b/crates/ui-egui/src/state/tool.rs @@ -1,6 +1,6 @@ use super::{Deserialize, Serialize}; -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize, craft::ui::contract::MemoProps)] +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize, craft::ui::contract::MemoProps, craft::ui::contract::PlainData)] pub enum Tool { Move, Artboard, diff --git a/crates/ui-egui/tests/it/workspace_presets.rs b/crates/ui-egui/tests/it/workspace_presets.rs index 1c4a40142a..9c5cb8cac7 100644 --- a/crates/ui-egui/tests/it/workspace_presets.rs +++ b/crates/ui-egui/tests/it/workspace_presets.rs @@ -32,7 +32,7 @@ fn select(app: &mut PhotocraftApp, suffix: &str) { /// Whether the workspace holds `panel`, in a column of icons or not. fn is_open(app: &PhotocraftApp, panel: &str) -> bool { - app.ui.docking.layout.contains(&panel.to_owned()) + app.ui.docking.layout().contains(&panel.to_owned()) } fn shown(app: &PhotocraftApp) -> Vec<&'static str> { @@ -157,7 +157,7 @@ fn custom_workspaces_restore_timeline_visibility_and_dock_after_presets() { fn legacy_workspace_without_timeline_visibility_still_loads() { let mut app = app(); select(&mut app, "painting"); - let painting = app.ui.docking.clone(); + let painting = craft::behavior::dock::Workspace::clone(&app.ui.docking); // PLAN: assumed the integration crate reaches `craft` (the facade) as the app crate does. app.workspaces.set.saved.push(craft::behavior::dock::NamedWorkspace::new("legacy", "Legacy", painting)); select(&mut app, "motion");