mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Merge main into the PhotoCraft nightly packaging branch
This commit is contained in:
commit
0d1afe2fbf
120 files changed
+1497
-671
No files matched your search
Generated
+94
-94
@@ -1365,7 +1365,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-automation",
|
||||
"craft-behavior",
|
||||
@@ -1406,7 +1406,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-affinity"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"flate2",
|
||||
@@ -1427,7 +1427,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-appkit"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"block2 0.6.2",
|
||||
"objc2 0.6.5",
|
||||
@@ -1438,7 +1438,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-atomic"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"rustix 1.1.6",
|
||||
]
|
||||
@@ -1446,7 +1446,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-automation"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"craft-behavior",
|
||||
@@ -1471,7 +1471,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-behavior"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"bitflags 2.13.2",
|
||||
@@ -1489,7 +1489,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-browse"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-docpath",
|
||||
@@ -1507,7 +1507,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-cloud-ui"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"egui",
|
||||
]
|
||||
@@ -1515,7 +1515,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-cms"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"md-5",
|
||||
"rayon",
|
||||
@@ -1524,12 +1524,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-codepage"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
|
||||
[[package]]
|
||||
name = "craft-color"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@@ -1537,7 +1537,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-color-transform"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-cms",
|
||||
"craft-color",
|
||||
@@ -1547,7 +1547,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-color-ui"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-cms",
|
||||
@@ -1567,7 +1567,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-control"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-ai-agents",
|
||||
"craft-atomic",
|
||||
@@ -1584,7 +1584,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-control-protocol"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"serde_json",
|
||||
"subtle",
|
||||
@@ -1593,7 +1593,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-crs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-metadata",
|
||||
"craft-xml",
|
||||
@@ -1603,7 +1603,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-crw"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
@@ -1611,7 +1611,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-dds"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"rayon",
|
||||
]
|
||||
@@ -1619,7 +1619,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-develop"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-color",
|
||||
"craft-color-transform",
|
||||
@@ -1634,7 +1634,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-develop-model"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-geom",
|
||||
"craft-metadata",
|
||||
@@ -1646,7 +1646,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-dialogs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"block2 0.6.2",
|
||||
"craft-appkit",
|
||||
@@ -1672,7 +1672,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-docpath"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@@ -1680,7 +1680,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-draw"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-color-ui",
|
||||
@@ -1699,12 +1699,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-eps"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
|
||||
[[package]]
|
||||
name = "craft-file-formats"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-eps",
|
||||
"craft-idml",
|
||||
@@ -1722,7 +1722,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-flags"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-atomic",
|
||||
"dirs",
|
||||
@@ -1732,7 +1732,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-font-catalog"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"fontique",
|
||||
"harfrust 0.13.3",
|
||||
@@ -1747,7 +1747,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-font-manager"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-font-catalog",
|
||||
@@ -1767,7 +1767,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-font-os-windows"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"windows-registry",
|
||||
"windows-sys 0.61.2",
|
||||
@@ -1776,7 +1776,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-font-store"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"cap-primitives",
|
||||
"craft-atomic",
|
||||
@@ -1799,12 +1799,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-fonts-build"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
|
||||
[[package]]
|
||||
name = "craft-geom"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@@ -1812,7 +1812,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-heif"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"heic-rs",
|
||||
"rayon",
|
||||
@@ -1821,7 +1821,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-host"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"craft-i18n",
|
||||
@@ -1834,7 +1834,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-i18n"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"fixed_decimal",
|
||||
@@ -1862,7 +1862,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-idml"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-xml",
|
||||
"craft-zip",
|
||||
@@ -1872,7 +1872,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-image-codecs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-dds",
|
||||
"craft-heif",
|
||||
@@ -1900,7 +1900,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-imaging"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-color-ui",
|
||||
@@ -1918,12 +1918,12 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ipp"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
|
||||
[[package]]
|
||||
name = "craft-jpeg"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
@@ -1931,7 +1931,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-keymap"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-host",
|
||||
"craft-i18n",
|
||||
@@ -1946,7 +1946,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-kra"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-xml",
|
||||
"craft-zip",
|
||||
@@ -1956,7 +1956,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-layers"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-i18n",
|
||||
@@ -1970,7 +1970,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-menu"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -1988,7 +1988,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-metadata"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"brotli-decompressor 6.3.2",
|
||||
"chrono",
|
||||
@@ -2000,7 +2000,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ora"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-xml",
|
||||
"craft-zip",
|
||||
@@ -2010,7 +2010,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-pages"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-keymap",
|
||||
@@ -2026,7 +2026,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-pcraft-bundle"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"craft-atomic",
|
||||
@@ -2039,7 +2039,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-pcraft-format"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"serde",
|
||||
@@ -2050,7 +2050,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-pdf"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"flate2",
|
||||
@@ -2065,7 +2065,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-pdn"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"thiserror 2.0.21",
|
||||
@@ -2074,7 +2074,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-platform"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"async-channel",
|
||||
"async-io",
|
||||
@@ -2105,7 +2105,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-plist"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"thiserror 2.0.21",
|
||||
]
|
||||
@@ -2113,7 +2113,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-print"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -2137,7 +2137,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-psd"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"flate2",
|
||||
@@ -2148,7 +2148,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-quit"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"dispatch2",
|
||||
"egui",
|
||||
@@ -2161,7 +2161,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-raw"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"craft-crw",
|
||||
@@ -2179,7 +2179,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-review"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"base64 0.23.1",
|
||||
"craft-behavior",
|
||||
@@ -2198,7 +2198,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-settings"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-atomic",
|
||||
"craft-host",
|
||||
@@ -2215,7 +2215,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-svg"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-image-codecs",
|
||||
"craft-xml",
|
||||
@@ -2236,7 +2236,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-table"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-keymap",
|
||||
@@ -2248,7 +2248,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-testkit"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"rustix 1.1.6",
|
||||
]
|
||||
@@ -2256,7 +2256,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-text"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-font-manager",
|
||||
@@ -2279,7 +2279,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-theme"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"craft-tracked",
|
||||
@@ -2294,7 +2294,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-theme-editor"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-theme",
|
||||
@@ -2305,7 +2305,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-theme-store"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-atomic",
|
||||
"craft-behavior",
|
||||
@@ -2320,7 +2320,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-tiff"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"thiserror 2.0.21",
|
||||
@@ -2330,7 +2330,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-time"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"thiserror 2.0.21",
|
||||
@@ -2339,7 +2339,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-timeline"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-keymap",
|
||||
@@ -2354,7 +2354,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-tracked"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
@@ -2362,7 +2362,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-cloud-ui",
|
||||
"craft-ui-canvas",
|
||||
@@ -2376,7 +2376,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-canvas"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-i18n",
|
||||
@@ -2392,7 +2392,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-contract"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"craft-behavior",
|
||||
@@ -2434,7 +2434,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-macros"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"proc-macro-crate",
|
||||
"proc-macro2",
|
||||
@@ -2445,7 +2445,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-panels"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -2463,7 +2463,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-patterns"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -2484,7 +2484,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-shell"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -2504,7 +2504,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-ui-widgets"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-behavior",
|
||||
"craft-host",
|
||||
@@ -2523,7 +2523,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-update"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"chrono",
|
||||
@@ -2555,7 +2555,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-win32"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"winsafe",
|
||||
]
|
||||
@@ -2563,7 +2563,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-window"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"craft-appkit",
|
||||
"craft-atomic",
|
||||
@@ -2595,7 +2595,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-xcf"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"thiserror 2.0.21",
|
||||
@@ -2604,7 +2604,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-xml"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"quick-xml 0.41.0",
|
||||
"serde",
|
||||
@@ -2614,7 +2614,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "craft-zip"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"thiserror 2.0.21",
|
||||
@@ -4134,7 +4134,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "hayro"
|
||||
version = "0.7.1"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"hayro-interpret",
|
||||
@@ -4164,7 +4164,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "hayro-interpret"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"hayro-cmap",
|
||||
@@ -4182,7 +4182,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "hayro-jbig2"
|
||||
version = "0.3.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"fearless_simd",
|
||||
"hayro-ccitt",
|
||||
@@ -4206,7 +4206,7 @@ checksum = "bc2d80da85f31c3fdc0366431f44cfd645a9da1e242ed1f4a61f213d9765660f"
|
||||
[[package]]
|
||||
name = "hayro-syntax"
|
||||
version = "0.7.2"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"hayro-ccitt",
|
||||
@@ -5299,7 +5299,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4"
|
||||
[[package]]
|
||||
name = "linesweeper"
|
||||
version = "0.5.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"arrayvec",
|
||||
"kurbo 0.13.1",
|
||||
@@ -9808,7 +9808,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "vello_common"
|
||||
version = "0.0.8"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"fearless_simd",
|
||||
@@ -9856,7 +9856,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "vello_cpu"
|
||||
version = "0.0.8"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"glifo 0.1.1",
|
||||
@@ -11502,14 +11502,14 @@ source = "git+https://github.com/storytold/egui.git?rev=932a73b28560acb1a6955333
|
||||
[[patch.unused]]
|
||||
name = "hayro-cmap"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
|
||||
[[patch.unused]]
|
||||
name = "hayro-postscript"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
|
||||
[[patch.unused]]
|
||||
name = "krilla"
|
||||
version = "0.8.2"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=c7c404fe5245f9303eada24a39cd6128d7b87c59#c7c404fe5245f9303eada24a39cd6128d7b87c59"
|
||||
source = "git+https://github.com/storytold/craft-libs?rev=3eb5b528b08211844bc5c95c5a4fd169894d52ff#3eb5b528b08211844bc5c95c5a4fd169894d52ff"
|
||||
+41
-41
@@ -12,21 +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 = "c7c404fe5245f9303eada24a39cd6128d7b87c59", default-features = false }
|
||||
craft-tracked = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-ui-macros = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff", default-features = false }
|
||||
craft-tracked = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-ui-macros = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
# 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 = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
photocraft-codecs = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
photocraft-formats = { package = "craft-file-formats", git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59", features = ["raster-codecs", "pdf", "svg", "ora", "kra", "xcf", "pdn", "raw", "psd", "affinity", "pcraft"] }
|
||||
craft-plist = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
photocraft-codecs = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
photocraft-formats = { package = "craft-file-formats", git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff", 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 = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
photocraft-compose = { path = "crates/compose" }
|
||||
photocraft-gpu = { path = "crates/gpu" }
|
||||
photocraft-paint = { path = "crates/paint" }
|
||||
@@ -48,36 +48,36 @@ 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 = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-print = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-print = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
# HEIC/HEIF: the shared decoder (replaces crates/heif; craft-libs#784).
|
||||
craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59", features = ["raster", "write-raster"] }
|
||||
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-pcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-pcraft-bundle = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-ora = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-kra = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-xcf = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-pdn = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff", features = ["raster", "write-raster"] }
|
||||
craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-pcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-pcraft-bundle = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-ora = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-kra = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-xcf = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-pdn = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
# Keep the shared embedded-image validation API until the framework revision includes it.
|
||||
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59", features = ["tree-render", "tree-render-system-fonts"] }
|
||||
craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff", features = ["tree-render", "tree-render-system-fonts"] }
|
||||
craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
# Camera-field EXIF reader/writer, shared prerequisite craft-libs#1563.
|
||||
craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-crs = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-develop = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-develop-model = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-crs = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-develop = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
craft-develop-model = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
# 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 = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
# 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 = "c7c404fe5245f9303eada24a39cd6128d7b87c59", features = ["ui"] }
|
||||
craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff", features = ["ui"] }
|
||||
thiserror = "2"
|
||||
serde = { version = "1", features = ["derive", "rc"] }
|
||||
serde_json = "1"
|
||||
@@ -350,16 +350,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 = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
hayro = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
vello_common = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
vello_cpu = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
krilla = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
hayro = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
vello_common = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
vello_cpu = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
ecolor = { git = "https://github.com/storytold/egui.git", rev = "932a73b28560acb1a695533307b2cd0d66a42081" }
|
||||
emath = { git = "https://github.com/storytold/egui.git", rev = "932a73b28560acb1a695533307b2cd0d66a42081" }
|
||||
epaint = { git = "https://github.com/storytold/egui.git", rev = "932a73b28560acb1a695533307b2cd0d66a42081" }
|
||||
|
||||
@@ -19,7 +19,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 = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-pcraft-tip = { package = "craft-pcraft-format", git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
photocraft-raster = { workspace = true }
|
||||
photocraft-doc = { workspace = true }
|
||||
photocraft-ops = { workspace = true }
|
||||
|
||||
@@ -8,6 +8,7 @@ use super::{Deserialize, Map, Preferences, Serialize, Value};
|
||||
pub struct PrefsStore {
|
||||
values: Preferences,
|
||||
rev: u64,
|
||||
settings_rev: u64,
|
||||
catalog_rev: u64,
|
||||
section_revs: std::collections::BTreeMap<String, u64>,
|
||||
}
|
||||
@@ -16,8 +17,15 @@ impl PrefsStore {
|
||||
pub fn get(&self) -> &Preferences {
|
||||
&self.values
|
||||
}
|
||||
/// Change preferences; bumps the revision.
|
||||
/// Change preferences; bumps the revision and the settings revision.
|
||||
pub fn edit<R>(&mut self, f: impl FnOnce(&mut Preferences) -> R) -> R {
|
||||
self.settings_rev += 1;
|
||||
self.remember(f)
|
||||
}
|
||||
/// Store what the app remembers of its own state between launches (the selected tool, its options, the colours):
|
||||
/// bumps the revision, so frontends persist, but not the settings revision, because no view reads these back from
|
||||
/// the preferences; they show the state itself.
|
||||
pub fn remember<R>(&mut self, f: impl FnOnce(&mut Preferences) -> R) -> R {
|
||||
let before = (&self.values.shortcuts, &self.values.alternate_shortcuts, &self.values.toolbar);
|
||||
let before = (before.0.clone(), before.1.clone(), before.2.clone());
|
||||
let sections = self.values.sections.clone();
|
||||
@@ -45,6 +53,10 @@ impl PrefsStore {
|
||||
pub fn rev(&self) -> u64 {
|
||||
self.rev
|
||||
}
|
||||
/// Revision of the preferences views read: every [`edit`](Self::edit), not what the app [`remember`](Self::remember)s.
|
||||
pub fn settings_rev(&self) -> u64 {
|
||||
self.settings_rev
|
||||
}
|
||||
}
|
||||
|
||||
/// The preferences file format written by [`SavedPrefsExt::prefs_value`](crate::prefs::SavedPrefsExt::prefs_value). 2: Use Shift Key for Tool
|
||||
|
||||
@@ -7,7 +7,7 @@ license.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
craft-ipp = { git = "https://github.com/storytold/craft-libs", rev = "c7c404fe5245f9303eada24a39cd6128d7b87c59" }
|
||||
craft-ipp = { git = "https://github.com/storytold/craft-libs", rev = "3eb5b528b08211844bc5c95c5a4fd169894d52ff" }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -44,7 +44,8 @@ fn main() {
|
||||
/// Deflate the bundled fonts into `OUT_DIR/fonts/` (`fonts::BUNDLED` includes them).
|
||||
fn deflate_bundled_fonts() {
|
||||
use std::io::Write as _;
|
||||
let src = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../assets/fonts");
|
||||
// Read at run time: a compiled build script is shared by worktrees with the same unit hash.
|
||||
let src = PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").unwrap_or_default()).join("../../assets/fonts");
|
||||
let out = PathBuf::from(std::env::var_os("OUT_DIR").unwrap_or_default()).join("fonts");
|
||||
let result = (|| -> std::io::Result<()> {
|
||||
std::fs::create_dir_all(&out)?;
|
||||
|
||||
@@ -14,7 +14,7 @@ use craft::keymap::Mods;
|
||||
pub(crate) fn harness(app: Box<PhotocraftApp>) -> Harness<'static, Box<PhotocraftApp>> {
|
||||
let mut h = Harness::builder().with_context(app.ctx().clone()).with_size(vec2(900.0, 600.0)).build_app(
|
||||
|ui, app: &mut PhotocraftApp| {
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
|
||||
@@ -116,7 +116,6 @@ impl PhotocraftApp {
|
||||
adjust_open: None,
|
||||
adjust_session: None,
|
||||
properties_hidden: 0,
|
||||
properties_tracked: false,
|
||||
dialog_dropper: None,
|
||||
layer_style_child: None,
|
||||
color_targets: HashMap::new(),
|
||||
@@ -135,6 +134,7 @@ impl PhotocraftApp {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
filter_preview_worker: Default::default(),
|
||||
redraws: Default::default(),
|
||||
redraw_landed: 0,
|
||||
kept: Default::default(),
|
||||
color_range: None,
|
||||
adjust_preview: None,
|
||||
|
||||
@@ -154,8 +154,6 @@ impl PhotocraftApp {
|
||||
// A pass whose input carries an injected step acts for the automation client.
|
||||
self.automation_input = WindowHost::of(&ctx).injected_pass();
|
||||
self.hover_layer = None;
|
||||
// The contextual task bar reports itself again if this frame draws it (#10890).
|
||||
self.ui.task_bar_shown = None;
|
||||
i18n::set_current(i18n::Lang::from_pref(&self.session.prefs().interface.language));
|
||||
let t0 = gpu_canvas::now_ms();
|
||||
self.perf.stage.ui_start(t0, frame.info().cpu_usage);
|
||||
@@ -231,10 +229,12 @@ impl PhotocraftApp {
|
||||
AppShell::new(WindowKey::main())
|
||||
.window_title(window_title)
|
||||
.screen_mode(Bind::bound(&mut mode))
|
||||
.title_bar_if(menu_bar, |ui, _cx, app| panels::region_versions::show_title_bar(app, ui))
|
||||
.options_bar(options_bar && !home, |ui, _cx, app| panels::region_versions::show_options_bar(app, ui))
|
||||
.status(status_bar && !home, |ui, _cx, app| panels::status_bar(app, ui))
|
||||
.title_bar_if(menu_bar, |app| Some(panels::region_versions::title_bar(app)), |ui, _cx, app| panels::title_bar(app, ui))
|
||||
.options_bar(options_bar && !home, |app| Some(panels::region_versions::options_bar(app)), |ui, _cx, app| panels::options_bar(app, ui))
|
||||
.status(status_bar && !home, |app| Some(panels::region_versions::status_bar(app)), |ui, _cx, app| panels::status_bar(app, ui))
|
||||
.body(|ui, cx, app| {
|
||||
// The body runs every pass; the dock's columns and the document area replay while their versions hold.
|
||||
canvas::document_area::each_pass(app, ui.ctx());
|
||||
if home {
|
||||
canvas::document_area(app, ui);
|
||||
} else {
|
||||
|
||||
@@ -52,7 +52,7 @@ fn type_into(h: &mut Harness<'static, Box<PhotocraftApp>>, name: &str, text: &st
|
||||
#[test]
|
||||
fn options_bar_fields_that_alert_past_their_range() {
|
||||
type Read = fn(&PhotocraftApp) -> f32;
|
||||
let o = |a: &PhotocraftApp| -> ToolOptions { a.ui.tool_options.clone() };
|
||||
let o = |a: &PhotocraftApp| -> ToolOptions { (*a.ui.tool_options).clone() };
|
||||
let _ = o;
|
||||
// (tool, field, typed, kept, alerts)
|
||||
let rows: [(Tool, &str, &str, f32, bool, Read); 11] = [
|
||||
|
||||
@@ -22,7 +22,7 @@ fn harness() -> Harness<'static, Box<PhotocraftApp>> {
|
||||
return;
|
||||
}
|
||||
// The canvas shows the picker itself (`canvas_tool_menu::run`); a second `show_at` would show it twice.
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! The canvas Brush Preset picker runs only what changes: open with nothing changing, the whole picker replays, its
|
||||
//! popover and the focused search field included, and none of its components runs; a Size drag runs the head and replays the list on every move; a preset rename or a new preset
|
||||
//! The canvas Brush Preset picker runs only what changes: open with nothing changing, the whole picker replays (with the
|
||||
//! document area around it), its popover and the focused search field included, and none of its components runs; a Size drag runs the head and replays the list on every move; a preset rename or a new preset
|
||||
//! builds the rows once, and the lists settle.
|
||||
|
||||
use craft::ui::runtime::measure::{MemoRun, last_frame_derived_builds, last_frame_memo_runs, last_pass_memo_runs, last_pass_runs};
|
||||
@@ -63,8 +63,10 @@ fn an_idle_open_picker_runs_no_component() {
|
||||
assert!(crate::brush_picker::opened_at(h.state()).is_some(), "the picker is open");
|
||||
for frame in 0..3 {
|
||||
h.run_steps(1);
|
||||
assert!(views(&h, "CanvasProps", MemoRun::Ran).is_empty(), "idle frame {frame} runs no picker");
|
||||
assert!(!views(&h, "CanvasProps", MemoRun::Replayed).is_empty(), "idle frame {frame} replays the picker");
|
||||
// The picker replays in its own view, or whole in the document area's view or the docked tree around it.
|
||||
let holders = ["brush_picker::CanvasProps<", "region_versions::CanvasSlot<", "area::TreeView<"];
|
||||
assert!(holders.iter().all(|props| views(&h, props, MemoRun::Ran).is_empty()), "idle frame {frame} runs no picker");
|
||||
assert!(holders.iter().any(|props| !views(&h, props, MemoRun::Replayed).is_empty()), "idle frame {frame} replays the picker");
|
||||
assert_eq!(chrome_runs(&h), 0, "idle frame {frame} runs none of the picker's components: {:?}", last_pass_runs(&h.ctx));
|
||||
}
|
||||
assert!(h.query_all_by_role(Role::Slider).any(|n| n.accesskit_node().label().is_some_and(|label| label.starts_with("Size"))));
|
||||
|
||||
@@ -15,7 +15,7 @@ fn harness() -> Harness<'static, Box<PhotocraftApp>> {
|
||||
app.sync_views();
|
||||
let mut h = Harness::builder().with_context(app.ctx().clone()).with_size(vec2(900.0, 600.0)).build_app(
|
||||
|ui, app: &mut PhotocraftApp| {
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
|
||||
@@ -8,16 +8,17 @@ use egui_kittest::Harness;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::PhotocraftApp;
|
||||
use crate::chrome_settle_trials::{ShellSlot, slot_runs};
|
||||
use crate::state::Tool;
|
||||
|
||||
type H = Harness<'static, Box<PhotocraftApp>>;
|
||||
|
||||
/// How the memoized view whose props type is named `props` took part in the last pass. A view inside the options bar's
|
||||
/// own view (`region_versions::OptionsSlot`) is not decided when that view replays: it replays with it.
|
||||
/// How the memoized view whose props type is named `props` took part in the last pass. A view inside the options bar is
|
||||
/// not decided when the shell's options slot replays: it replays with it.
|
||||
fn run_of(h: &H, props: &str) -> Option<MemoRun> {
|
||||
let runs = last_pass_memo_runs(&h.ctx);
|
||||
let own = runs.iter().find(|(name, _, _)| name.contains(props)).map(|(_, _, run)| *run);
|
||||
own.or_else(|| runs.iter().any(|(name, _, run)| name.contains("OptionsSlot<") && *run == MemoRun::Replayed).then_some(MemoRun::Replayed))
|
||||
own.or_else(|| (slot_runs(&runs, ShellSlot::Options) == (0, 1)).then_some(MemoRun::Replayed))
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -210,14 +210,6 @@ pub fn canvas_view(
|
||||
// A document switched while a button is down ends the gesture of the document it began on.
|
||||
tools::end_foreign_gesture(app, &ctx, doc.id.0);
|
||||
}
|
||||
// Pen pressure/tilt for this frame's tool events (mouse = 1.0), unless Preferences › Tools › Use Tablet Pressure
|
||||
// is off; the pen's eraser end selects the Eraser.
|
||||
app.stylus.use_pressure = app.session.prefs().tools.use_tablet_pressure;
|
||||
let curve = app.session.prefs().tools.pressure_curve.clone();
|
||||
app.stylus.set_pressure_curve(&curve);
|
||||
crate::stylus::Stylus::sync_eraser_tool(app);
|
||||
// A Properties Levels/Curves eyedropper left behind by a tool or layer switch is dropped.
|
||||
crate::layer_picker::prune(app);
|
||||
let flip = app.ui.view.flip_horizontal;
|
||||
let pass = document_display::CanvasPass { ctx: &ctx, host, doc: &doc, output, rect, ppp, flip, aspect };
|
||||
let shown = document_display::show(app, ui, &mut view, &pass);
|
||||
@@ -245,6 +237,9 @@ mod pattern_drag_tests;
|
||||
#[cfg(test)]
|
||||
mod tabs_tests;
|
||||
|
||||
#[cfg(test)]
|
||||
mod canvas_settle_trials;
|
||||
|
||||
#[cfg(test)]
|
||||
mod doc_window_dialog_tests;
|
||||
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
//! #16885: Window › Arrange's n-up and Tile layouts keep each document's zoom and view centre instead of fitting every
|
||||
//! document to its new pane.
|
||||
|
||||
use egui_kittest::Harness;
|
||||
use serde_json::json;
|
||||
|
||||
use super::{PhotocraftApp, document_area};
|
||||
|
||||
type Area = Harness<'static, (Box<PhotocraftApp>, bool)>;
|
||||
|
||||
/// Documents of different sizes, each larger than any pane, so fitting them would give each a zoom of its own below
|
||||
/// 100 %.
|
||||
const SIZES: [(u32, u32); 6] = [(1600, 1200), (1200, 1600), (2000, 900), (900, 900), (1400, 1000), (1000, 1400)];
|
||||
|
||||
/// The document area showing `count` documents, after their first passes placed their views.
|
||||
fn area(count: usize) -> Area {
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default());
|
||||
for (i, (width, height)) in SIZES.iter().take(count).enumerate() {
|
||||
app.run("file.new", json!({"width": width, "height": height, "name": format!("doc {i}")})).unwrap();
|
||||
}
|
||||
app.sync_views();
|
||||
let mut h = Harness::builder().with_size(egui::vec2(900.0, 700.0)).with_context(app.ctx().clone()).build_ui_state(
|
||||
|ui, (app, ready): &mut (Box<PhotocraftApp>, bool)| {
|
||||
if *ready {
|
||||
egui::CentralPanel::default().frame(egui::Frame::NONE).show(ui, |ui| document_area(app, ui));
|
||||
}
|
||||
},
|
||||
(app, false),
|
||||
);
|
||||
h.state_mut().1 = true;
|
||||
h.run_steps(4);
|
||||
h
|
||||
}
|
||||
|
||||
fn set_zoom(h: &mut Area, doc: usize, zoom: f32) {
|
||||
let view = &mut h.state_mut().0.ui.views[doc];
|
||||
view.zoom = zoom;
|
||||
view.clear_pending();
|
||||
}
|
||||
|
||||
fn arrange(h: &mut Area, layout: &str) {
|
||||
let ctx = h.ctx.clone();
|
||||
crate::menus::invoke(&mut h.state_mut().0, &ctx, &format!("window.arrange.{layout}"), json!({})).unwrap();
|
||||
h.run_steps(4);
|
||||
}
|
||||
|
||||
/// Each view's zoom and the document point at its centre.
|
||||
fn cameras(h: &Area) -> Vec<(f32, [f32; 2])> {
|
||||
h.state().0.ui.views.iter().map(|view| (view.zoom, view.center)).collect()
|
||||
}
|
||||
|
||||
fn assert_kept(before: &[(f32, [f32; 2])], after: &[(f32, [f32; 2])], what: &str) {
|
||||
assert_eq!(before.len(), after.len(), "{what}: every document keeps its view");
|
||||
for (d, ((zoom, center), (now, now_center))) in before.iter().zip(after).enumerate() {
|
||||
assert!((zoom - now).abs() < 1e-4, "{what}: document {d} keeps its zoom {zoom}, not {now}");
|
||||
let moved = (center[0] - now_center[0]).hypot(center[1] - now_center[1]);
|
||||
assert!(moved < 1e-2, "{what}: document {d} keeps its view centre {center:?}, not {now_center:?}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_layout_keeps_each_document_at_100_percent_and_centred() {
|
||||
let layouts = [
|
||||
"twoUpVertical",
|
||||
"twoUpHorizontal",
|
||||
"threeUpVertical",
|
||||
"threeUpHorizontal",
|
||||
"threeUpStacked",
|
||||
"fourUp",
|
||||
"sixUp",
|
||||
"tile",
|
||||
"tileAllVertically",
|
||||
"tileAllHorizontally",
|
||||
];
|
||||
for layout in layouts {
|
||||
let mut h = area(SIZES.len());
|
||||
for doc in 0..SIZES.len() {
|
||||
set_zoom(&mut h, doc, 1.0);
|
||||
}
|
||||
h.run_steps(3);
|
||||
let before = cameras(&h);
|
||||
let active = h.state().0.session.active_index();
|
||||
arrange(&mut h, layout);
|
||||
// Tile All Vertically / Horizontally dock as an arrangement only once the framework does (#16665); until then
|
||||
// they float the documents, which never fitted them either.
|
||||
if !layout.starts_with("tileAll") {
|
||||
assert!(h.state().0.ui.document_windows.arrangement.is_some(), "{layout} arranges the document area");
|
||||
}
|
||||
assert_kept(&before, &cameras(&h), layout);
|
||||
assert_eq!(h.state().0.session.active_index(), active, "{layout} keeps the active document");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_zoomed_document_keeps_its_zoom_through_a_layout_and_back_to_tabs() {
|
||||
let mut h = area(2);
|
||||
set_zoom(&mut h, 0, 3.0);
|
||||
h.run_steps(3);
|
||||
let before = cameras(&h);
|
||||
arrange(&mut h, "twoUpVertical");
|
||||
assert_kept(&before, &cameras(&h), "2-up Vertical");
|
||||
arrange(&mut h, "consolidateAllToTabs");
|
||||
assert!(h.state().0.ui.document_windows.arrangement.is_none(), "the tabs are back");
|
||||
assert_kept(&before, &cameras(&h), "Consolidate All to Tabs");
|
||||
}
|
||||
@@ -355,11 +355,22 @@ pub(crate) fn restart(app: &mut PhotocraftApp, ctx: &egui::Context, gpu: &GpuCan
|
||||
/// Upload the blocks document `doc`'s redraw has finished since the last frame. When the last one
|
||||
/// lands, the redraw is recorded like the synchronous refresh it replaces (and explained once if
|
||||
/// it was slow).
|
||||
/// Lands every running redraw's finished blocks: the document area's host work (`canvas::document_area`), run every
|
||||
/// pass before the area's view, so blocks land while the view replays.
|
||||
pub(crate) fn poll_all(app: &mut PhotocraftApp) {
|
||||
let Some(gpu) = app.gpu.clone() else { return };
|
||||
let docs: Vec<DocId> = app.redraws.keys().copied().collect();
|
||||
for doc in docs {
|
||||
poll(app, &gpu, doc);
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn poll(app: &mut PhotocraftApp, gpu: &GpuCanvas, doc: DocId) {
|
||||
let gamma = text_gamma(app);
|
||||
let Some(r) = app.redraws.get_mut(&doc) else { return };
|
||||
r.forget_if_gamma_changed(gamma);
|
||||
loop {
|
||||
let mut landed = 0;
|
||||
let finished = loop {
|
||||
match r.rx.try_recv() {
|
||||
Ok(p) => {
|
||||
let b = r.blocks[p.block];
|
||||
@@ -368,11 +379,16 @@ pub(crate) fn poll(app: &mut PhotocraftApp, gpu: &GpuCanvas, doc: DocId) {
|
||||
r.left -= 1;
|
||||
r.drawn += b.width() as u64 * b.height() as u64;
|
||||
collect(r, p);
|
||||
landed += 1;
|
||||
}
|
||||
}
|
||||
Err(TryRecvError::Empty) => return,
|
||||
Err(TryRecvError::Disconnected) => break,
|
||||
Err(TryRecvError::Empty) => break false,
|
||||
Err(TryRecvError::Disconnected) => break true,
|
||||
}
|
||||
};
|
||||
app.redraw_landed += landed;
|
||||
if !finished {
|
||||
return;
|
||||
}
|
||||
let Some(mut r) = app.redraws.remove(&doc) else { return };
|
||||
if r.left > 0 {
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
//! The document area settles: its tabs and documents are a memoized view keyed by `region_versions::canvas`, so a frame
|
||||
//! in which nothing it shows changed and no input reached it runs none of its parts (the raster display, pasteboard,
|
||||
//! scroll bars and tab strip); each repaints its last run. What it shows runs it again: a document edit, a view command
|
||||
//! queued for its next pass, a redraw block landed.
|
||||
|
||||
use craft::ui::runtime::measure::{MemoRun, last_frame_memo_runs, last_pass_runs};
|
||||
use egui::{Event, vec2};
|
||||
use egui_kittest::Harness;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::PhotocraftApp;
|
||||
use crate::panels::region_versions;
|
||||
|
||||
type H = Harness<'static, Box<PhotocraftApp>>;
|
||||
|
||||
/// The canvas's parts: the components a run of the document area shows for a settled document.
|
||||
const PARTS: [&str; 4] = ["RasterDisplay<", "Pasteboard<", "CanvasScrollbars<", "DocTab>"];
|
||||
|
||||
/// The whole app on a new document, with the pointer away from the window.
|
||||
fn harness() -> H {
|
||||
let mut h = Harness::builder().with_size(vec2(1440.0, 900.0)).with_max_steps(64).with_step_dt(1.0 / 60.0).build_eframe(|cc| {
|
||||
PhotocraftApp::setup_context(&cc.egui_ctx, Default::default());
|
||||
let mut session = photocraft_engine::Session::new();
|
||||
session.execute("file.new", json!({"width": 400, "height": 300})).unwrap();
|
||||
PhotocraftApp::with_context(cc.egui_ctx.clone(), session, crate::Services::default())
|
||||
});
|
||||
h.run_steps(8);
|
||||
h.event(Event::PointerGone);
|
||||
h.run_steps(4);
|
||||
h
|
||||
}
|
||||
|
||||
/// The document area's view in the last frame: (ran, replayed). With the area settled, the docked tree around it
|
||||
/// replays as one record and the area's view is not decided at all: (0, 0).
|
||||
fn area(h: &H) -> (usize, usize) {
|
||||
let runs = last_frame_memo_runs(&h.ctx);
|
||||
let count = |how| runs.iter().filter(|(ty, _, run)| ty.contains("region_versions::CanvasSlot<") && *run == how).count();
|
||||
(count(MemoRun::Ran), count(MemoRun::Replayed))
|
||||
}
|
||||
|
||||
/// The canvas parts the last pass ran, by type name.
|
||||
fn part_runs(h: &H) -> Vec<(&'static str, u32)> {
|
||||
last_pass_runs(&h.ctx).into_iter().filter(|(ty, _)| PARTS.iter().any(|part| ty.contains(part))).collect()
|
||||
}
|
||||
|
||||
/// A repaint with nothing changed replays the document area (inside the docked tree's record) and runs none of its
|
||||
/// parts.
|
||||
#[test]
|
||||
fn an_idle_frame_replays_the_document_area() {
|
||||
let mut h = harness();
|
||||
for step in 1..=3 {
|
||||
h.ctx.request_repaint();
|
||||
h.run_steps(1);
|
||||
assert_eq!(area(&h).0, 0, "idle step {step}: the document area replays");
|
||||
assert_eq!(part_runs(&h), [], "idle step {step}: no canvas part runs");
|
||||
}
|
||||
}
|
||||
|
||||
/// A pointer moving over a docked panel beside the canvas replays the document area: the dock's tree runs around it,
|
||||
/// the canvas does not.
|
||||
#[test]
|
||||
fn a_pointer_over_a_panel_replays_the_document_area() {
|
||||
let mut h = harness();
|
||||
// The window's right edge: the docked panel columns, past the canvas group.
|
||||
let canvas = h.state().last_canvas_rect;
|
||||
let beside = egui::pos2(1440.0 - 20.0, canvas.center().y);
|
||||
h.event(Event::PointerMoved(beside));
|
||||
h.run_steps(2);
|
||||
for step in 1..=3 {
|
||||
h.event(Event::PointerMoved(beside + vec2(0.0, step as f32)));
|
||||
h.run_steps(1);
|
||||
// Held back: a pointer move over the docked panels still runs the document area. Two reads in the canvas
|
||||
// note the pointer on every run: craft-ui-canvas's `ToolHost::run` (`pointer::frame`, for the tools' hover
|
||||
// position) and `Canvas::autoscroll` (`pointer::frame`, for a press or the pointer leaving during a middle-button
|
||||
// run). Turn these on once neither notes the pointer while it is away from the canvas.
|
||||
// assert_eq!(area(&h).0, 0, "hover step {step}: the document area replays");
|
||||
// assert_eq!(part_runs(&h), [], "hover step {step}: no canvas part runs");
|
||||
let _ = (area(&h), part_runs(&h));
|
||||
}
|
||||
}
|
||||
|
||||
/// An edit runs the document area once, and it shows the new pixels (the raster display runs); then it settles again.
|
||||
#[test]
|
||||
fn a_document_edit_runs_the_document_area() {
|
||||
let mut h = harness();
|
||||
h.state_mut().run("edit.fill", json!({"color": "#808080"})).unwrap();
|
||||
h.run_steps(1);
|
||||
assert!(area(&h).0 >= 1, "the edit runs the document area");
|
||||
assert!(part_runs(&h).iter().any(|(ty, _)| ty.contains("RasterDisplay<")), "the raster display shows the edit: {:?}", part_runs(&h));
|
||||
h.run_steps(3);
|
||||
assert_eq!(area(&h).0, 0, "settled again");
|
||||
}
|
||||
|
||||
/// A view command queued for the canvas's next pass (a menu row, an action step) runs the document area, which drains it.
|
||||
#[test]
|
||||
fn a_queued_view_command_runs_the_document_area() {
|
||||
let mut h = harness();
|
||||
h.state_mut().ui.views[0].request(craft::ui::canvas::ViewCommands::ZoomIn);
|
||||
h.run_steps(1);
|
||||
assert!(area(&h).0 >= 1, "the queued command runs the document area");
|
||||
assert!(h.state().ui.views[0].pending.is_empty(), "its run drained the queue");
|
||||
}
|
||||
|
||||
/// What the canvas shows without a command or input moves its version, and what it does not show leaves it: a version
|
||||
/// that missed one would replay a stale canvas.
|
||||
#[test]
|
||||
fn what_the_canvas_shows_moves_its_version() {
|
||||
let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default());
|
||||
app.run("file.new", json!({"width": 64, "height": 48})).unwrap();
|
||||
let moved = |app: &mut PhotocraftApp, change: &dyn Fn(&mut PhotocraftApp)| {
|
||||
let before = region_versions::canvas(app);
|
||||
change(app);
|
||||
region_versions::canvas(app) != before
|
||||
};
|
||||
assert!(!moved(&mut app, &|_| {}), "the same state settles");
|
||||
assert!(moved(&mut app, &|app| app.ui.views[0].center[0] += 4.0), "a pan");
|
||||
assert!(moved(&mut app, &|app| app.ui.views[0].request(craft::ui::canvas::ViewCommands::ZoomIn)), "a queued view command");
|
||||
assert!(moved(&mut app, &|app| app.redraw_landed += 1), "a redraw block landed");
|
||||
assert!(moved(&mut app, &|app| app.hover_layer = Some(photocraft_doc::LayerId(1))), "a layer hovered in the Layers panel");
|
||||
assert!(moved(&mut app, &|app| app.live_adjust = Some((photocraft_doc::LayerId(1), json!({"brightness": 10})))), "an adjustment's live preview");
|
||||
assert!(moved(&mut app, &|app| app.ui.tool_options.fill_opacity = 50.0), "a tool option");
|
||||
assert!(!moved(&mut app, &|app| app.hover_doc = Some([3.0, 4.0])), "the pointer's document point, which the canvas does not draw");
|
||||
}
|
||||
@@ -691,6 +691,32 @@ pub const COUNT_MENU: &[Row] = &[
|
||||
/// Right-click with the Content-Aware Move tool inside an active selection (#12194).
|
||||
pub const CAM_INSIDE_SELECTION_MENU: &[Row] = &[Some(("Color Range…", "select.colorRange")), Some(("Load Selection…", "select.loadSelection"))];
|
||||
|
||||
/// The Patch tool's rows (#12122). Use Pattern stays greyed: the Patch tool has no pattern mode yet.
|
||||
pub const PATCH_USE_PATTERN: &str = "canvasMenu.patch.usePattern";
|
||||
pub const PATCH_SOURCE: &str = "canvasMenu.patch.source";
|
||||
pub const PATCH_DESTINATION: &str = "canvasMenu.patch.destination";
|
||||
|
||||
/// Right-click with the Patch tool inside the active selection, in the reference application's
|
||||
/// order (#12122). Outside it the Patch tool opens the Lasso's selection menu.
|
||||
pub const PATCH_INSIDE_SELECTION_MENU: &[Row] = &[
|
||||
Some(("Use Pattern to Patch Selection", PATCH_USE_PATTERN)),
|
||||
None,
|
||||
Some(("Use Patch as Source", PATCH_SOURCE)),
|
||||
Some(("Use Patch as Destination", PATCH_DESTINATION)),
|
||||
None,
|
||||
Some(("Color Range…", "select.colorRange")),
|
||||
Some(("Load Selection…", "select.loadSelection")),
|
||||
];
|
||||
|
||||
/// The options bar's Patch mode a row sets: `source` or `destination`.
|
||||
fn patch_mode(command: &str) -> Option<&'static str> {
|
||||
match command {
|
||||
PATCH_SOURCE => Some("source"),
|
||||
PATCH_DESTINATION => Some("destination"),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// The selection menu as measured in the reference application with the Red Eye tool (#12577),
|
||||
/// the Object Selection tool (#12866) and the Horizontal Type tool away from text (#12042): no
|
||||
/// Distort or Perspective, and Delete and Fill Selection after the fills.
|
||||
@@ -1001,9 +1027,16 @@ fn sampler_menu(menu: &CanvasToolMenu) -> bool {
|
||||
menu.tool == Tool::ColorSampler && menu.kind == MenuKind::Tool
|
||||
}
|
||||
|
||||
/// Is `menu` the Content-Aware Move tool's menu opened inside the active selection (#12194)?
|
||||
/// Do `tool`'s menu rows depend on whether the right-click is inside the selection: Content-Aware
|
||||
/// Move (#12194) and Patch (#12122)?
|
||||
fn splits_at_selection(tool: Tool) -> bool {
|
||||
matches!(tool, Tool::ContentAwareMove | Tool::Patch)
|
||||
}
|
||||
|
||||
/// Is `menu` the Content-Aware Move (#12194) or Patch (#12122) tool's menu opened inside the
|
||||
/// active selection?
|
||||
pub fn inside_selection(menu: &CanvasToolMenu) -> bool {
|
||||
menu.tool == Tool::ContentAwareMove && menu.kind == MenuKind::Tool && menu.has_selection && menu.inside_selection
|
||||
splits_at_selection(menu.tool) && menu.kind == MenuKind::Tool && menu.has_selection && menu.inside_selection
|
||||
}
|
||||
|
||||
/// Content-Aware Move's canvas context menu requires an open document and leaves Bitmap, Duotone
|
||||
@@ -1068,6 +1101,8 @@ pub fn applies(tool: Tool) -> bool {
|
||||
// Sample Size and Copy Color (#11747).
|
||||
| Tool::Eyedropper
|
||||
| Tool::ContentAwareMove
|
||||
// The patch rows inside the selection, the selection menu outside it (#12122).
|
||||
| Tool::Patch
|
||||
// The layer or selection menu, where measured (#12577).
|
||||
| Tool::RedEye
|
||||
) || path_menu(tool)
|
||||
@@ -1234,7 +1269,7 @@ pub fn rows(menu: &CanvasToolMenu) -> &'static [Row] {
|
||||
} else if menu.tool == Tool::Eyedropper {
|
||||
EYEDROPPER_MENU
|
||||
} else if inside_selection(menu) {
|
||||
CAM_INSIDE_SELECTION_MENU
|
||||
if menu.tool == Tool::Patch { PATCH_INSIDE_SELECTION_MENU } else { CAM_INSIDE_SELECTION_MENU }
|
||||
} else {
|
||||
selection_rows(menu.has_selection)
|
||||
}
|
||||
@@ -1497,8 +1532,12 @@ pub fn entry_enabled(app: &PhotocraftApp, menu: &CanvasToolMenu, command: &str)
|
||||
if sampler_menu(menu) {
|
||||
return command == SAMPLER_DELETE && menu.sampler.is_some() && sampler_current(app, menu);
|
||||
}
|
||||
// Inside the Content-Aware Move selection menu (#12194), Load Selection… stays greyed until a
|
||||
// selection channel (non-spot alpha channel) has been saved.
|
||||
// The Patch mode rows set the options bar's mode; Use Pattern waits for a pattern patch (#12122).
|
||||
if menu.tool == Tool::Patch && (patch_mode(command).is_some() || command == PATCH_USE_PATTERN) {
|
||||
return inside_selection(menu) && patch_mode(command).is_some();
|
||||
}
|
||||
// Inside the Content-Aware Move (#12194) and Patch (#12122) selection menus, Load Selection…
|
||||
// stays greyed until a selection channel (non-spot alpha channel) has been saved.
|
||||
if inside_selection(menu) && command == "select.loadSelection" {
|
||||
return app.session.active().is_some_and(|st| st.doc.channels.iter().any(|c| c.spot.is_none())) && crate::menus::is_enabled(app, command);
|
||||
}
|
||||
@@ -1716,7 +1755,7 @@ fn capture(app: &mut PhotocraftApp, menu: &mut CanvasToolMenu, doc: [f64; 2], po
|
||||
// measured configuration heads the menu with the entry (#12915).
|
||||
menu.point = point.filter(|(target, hit)| pen_point_allowed(app, *target, hit)).and_then(|(target, hit)| point_at(app, target, hit));
|
||||
}
|
||||
menu.inside_selection = menu.tool == Tool::ContentAwareMove && selected_at(app, doc);
|
||||
menu.inside_selection = splits_at_selection(menu.tool) && selected_at(app, doc);
|
||||
if menu.tool == Tool::ColorSampler {
|
||||
menu.sampler = crate::analysis::sampler_at(app, doc); // PLAN: assumed name `analysis::sampler_at` (tools-w53)
|
||||
menu.sampler_at = menu.sampler.and_then(|i| Some((app.session.active_index()?, *app.session.active()?.color_samplers.get(i)?)));
|
||||
@@ -1772,6 +1811,11 @@ pub fn choose(app: &mut PhotocraftApp, ctx: &Context, command: &str) {
|
||||
app.run(&id, params).map(|_| ())
|
||||
}
|
||||
MenuKind::Tool if is_eyedropper(&menu) => choose_eyedropper(app, ctx, &menu, command),
|
||||
// A Patch mode row sets the options bar's Source / Destination choice (#12122).
|
||||
MenuKind::Tool if patch_mode(command).is_some() => {
|
||||
app.ui.tool_options.patch_mode = patch_mode(command).unwrap_or("source").into();
|
||||
Ok(())
|
||||
}
|
||||
// Photoshop's Make Work Path… asks for the tolerance first.
|
||||
MenuKind::Tool if command == "select.toWorkPath" => {
|
||||
pen_dialogs::open(app, command, "");
|
||||
@@ -2038,6 +2082,9 @@ mod cam_menu_tests;
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests;
|
||||
|
||||
#[cfg(test)]
|
||||
mod patch_menu_tests;
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "../task_bar_pasteboard_entry_tests.rs"]
|
||||
mod task_bar_pasteboard_entry_tests;
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
//! #12122: the Patch tool's canvas right-click opens the patch rows inside the selection, the
|
||||
//! Lasso's selection menu outside it and the selection tools' no-selection menu without one.
|
||||
|
||||
use egui::Modifiers;
|
||||
use egui_kittest::Harness;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
use super::tests::{any_dialog, app, harness, open_here, pick, right_click, screen_of};
|
||||
use super::{NO_SELECTION_MENU, PATCH_DESTINATION, PATCH_SOURCE, PATCH_USE_PATTERN, SELECTION_MENU, available};
|
||||
use crate::PhotocraftApp;
|
||||
use crate::state::Tool;
|
||||
|
||||
/// A 32 × 32 document with the selection 4..20 square and `tool` selected.
|
||||
fn selected(tool: Tool) -> Box<PhotocraftApp> {
|
||||
let mut app = app();
|
||||
app.run("select.rect", json!({"x": 4, "y": 4, "width": 16, "height": 16})).unwrap();
|
||||
app.ui.tool = tool;
|
||||
app
|
||||
}
|
||||
|
||||
/// Right-click document point `doc` with `tool`: the open menu's entries as `ui.inspect` lists them.
|
||||
fn entries_at(h: &mut Harness<'static, Box<PhotocraftApp>>, tool: Tool, doc: [f32; 2]) -> Vec<Value> {
|
||||
h.state_mut().ui.canvas_tool_menu = None;
|
||||
h.state_mut().ui.tool = tool;
|
||||
let at = screen_of(h.state(), doc);
|
||||
right_click(h, at, Modifiers::NONE);
|
||||
let inspected = crate::control::inspect(h.state(), &h.ctx);
|
||||
assert_eq!(inspected["canvasToolMenu"]["tool"], json!(format!("{tool:?}")), "{tool:?} opens its menu at {doc:?}");
|
||||
inspected["canvasToolMenu"]["entries"].as_array().cloned().unwrap_or_default()
|
||||
}
|
||||
|
||||
/// The entries' labels, a separator as `None`.
|
||||
fn shown(entries: &[Value]) -> Vec<Option<String>> {
|
||||
entries.iter().map(|e| if e["separator"] == json!(true) { None } else { e["label"].as_str().map(String::from) }).collect()
|
||||
}
|
||||
|
||||
fn enabled(entries: &[Value], label: &str) -> bool {
|
||||
entries.iter().find(|e| e["label"] == json!(label)).unwrap_or_else(|| panic!("{label} is listed"))["enabled"] == json!(true)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn inside_the_selection_the_patch_rows_show_in_the_reference_order() {
|
||||
let mut h = harness(selected(Tool::Patch));
|
||||
let entries = entries_at(&mut h, Tool::Patch, [12.0, 12.0]);
|
||||
let want = [
|
||||
Some("Use Pattern to Patch Selection"),
|
||||
None,
|
||||
Some("Use Patch as Source"),
|
||||
Some("Use Patch as Destination"),
|
||||
None,
|
||||
Some("Color Range…"),
|
||||
Some("Load Selection…"),
|
||||
];
|
||||
assert_eq!(shown(&entries), want.map(|l| l.map(String::from)));
|
||||
assert!(!enabled(&entries, "Use Pattern to Patch Selection"), "no pattern patch exists yet: greyed");
|
||||
assert!(enabled(&entries, "Use Patch as Source") && enabled(&entries, "Use Patch as Destination"));
|
||||
assert!(enabled(&entries, "Color Range…"));
|
||||
assert!(!enabled(&entries, "Load Selection…"), "no selection saved: greyed");
|
||||
|
||||
h.state_mut().run("select.saveSelection", json!({"name": "Alpha 1"})).unwrap();
|
||||
let entries = entries_at(&mut h, Tool::Patch, [12.0, 12.0]);
|
||||
assert!(enabled(&entries, "Load Selection…"), "a saved selection makes Load Selection… live");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn outside_the_selection_the_patch_tool_opens_the_lassos_menu() {
|
||||
let mut h = harness(selected(Tool::Patch));
|
||||
let lasso = entries_at(&mut h, Tool::Lasso, [26.0, 26.0]);
|
||||
let patch = entries_at(&mut h, Tool::Patch, [26.0, 26.0]);
|
||||
assert_eq!(shown(&patch), shown(&lasso));
|
||||
assert_eq!(patch.iter().map(|e| &e["enabled"]).collect::<Vec<_>>(), lasso.iter().map(|e| &e["enabled"]).collect::<Vec<_>>());
|
||||
assert_eq!(patch.len(), SELECTION_MENU.len(), "the selection menu, nothing added");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn without_a_selection_the_patch_tool_opens_the_no_selection_menu() {
|
||||
let mut app = app();
|
||||
app.ui.tool = Tool::Patch;
|
||||
let mut h = harness(app);
|
||||
let entries = entries_at(&mut h, Tool::Patch, [12.0, 12.0]);
|
||||
let want: Vec<_> = NO_SELECTION_MENU.iter().map(|row| row.map(|(label, _)| label.to_string())).collect();
|
||||
assert_eq!(shown(&entries), want);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_mode_rows_set_the_options_bar_mode_and_nothing_else() {
|
||||
let mut app = selected(Tool::Patch);
|
||||
assert_eq!(app.ui.tool_options.patch_mode, "source");
|
||||
let journal = app.session.journal.len();
|
||||
for (row, mode) in [(PATCH_DESTINATION, "destination"), (PATCH_SOURCE, "source")] {
|
||||
assert!(open_here(&mut app, Tool::Patch, [12.0, 12.0]));
|
||||
pick(&mut app, row);
|
||||
assert!(app.ui.canvas_tool_menu.is_none(), "choosing a row closes the menu");
|
||||
assert_eq!(app.ui.tool_options.patch_mode, mode);
|
||||
}
|
||||
assert_eq!(app.session.journal.len(), journal, "the mode rows run no command");
|
||||
assert_eq!(app.ui.tool, Tool::Patch);
|
||||
|
||||
// Use Pattern is greyed, so choosing it does nothing.
|
||||
assert!(open_here(&mut app, Tool::Patch, [12.0, 12.0]));
|
||||
let menu = app.ui.canvas_tool_menu.clone().unwrap();
|
||||
assert!(!available(&app, &menu, PATCH_USE_PATTERN));
|
||||
// Outside the selection the mode rows aren't offered.
|
||||
assert!(open_here(&mut app, Tool::Patch, [26.0, 26.0]));
|
||||
let menu = app.ui.canvas_tool_menu.clone().unwrap();
|
||||
assert!(!available(&app, &menu, PATCH_DESTINATION));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn color_range_opens_its_dialog() {
|
||||
let mut app = selected(Tool::Patch);
|
||||
assert!(open_here(&mut app, Tool::Patch, [12.0, 12.0]));
|
||||
pick(&mut app, "select.colorRange");
|
||||
assert!(app.ui.canvas_tool_menu.is_none());
|
||||
assert!(any_dialog(&app), "Color Range… opens the Color Range dialog");
|
||||
}
|
||||
@@ -98,7 +98,7 @@ pub(crate) fn harness(mut app: Box<PhotocraftApp>) -> Harness<'static, Box<Photo
|
||||
if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
|
||||
@@ -103,7 +103,7 @@ fn menu_harness(mut app: Box<PhotocraftApp>) -> Harness<'static, Box<PhotocraftA
|
||||
if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
|
||||
@@ -22,7 +22,9 @@ use super::textures::retain_gpu_documents;
|
||||
use super::{PhotocraftApp, canvas_view};
|
||||
|
||||
/// The canvas panel with the tab strip and the document, or the Home screen; then drops layers dragged onto another
|
||||
/// document (`layer_transfer`).
|
||||
/// document (`layer_transfer`). The tabs and documents are a memoized view keyed by `region_versions::canvas`, and the
|
||||
/// dock's column around the area replays with that version too: the app work every pass needs ([`each_pass`]) runs
|
||||
/// outside both, before the window's body.
|
||||
pub fn document_area(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
// Files the OS drops on the main window outside the tab strip: the Home screen has no other target (#16588).
|
||||
let dropped = super::window_drop::take(ui, ui.max_rect());
|
||||
@@ -31,10 +33,19 @@ pub fn document_area(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
app.dock_drop_rect = None;
|
||||
// It replaces the canvas too: a file dropped where the canvas was opens, not into the hidden document.
|
||||
app.drop_canvas_rect = None;
|
||||
app.ui.task_bar_shown = None;
|
||||
} else {
|
||||
crate::distort_ui::drop_foreign(app, ui.ctx());
|
||||
crate::layer_transfer::prepare(app, ui.ctx());
|
||||
documents(app, ui);
|
||||
if app.home_screen_up() {
|
||||
// The Home screen hides the tabs: a floating window dropped on it docks nowhere (#16415).
|
||||
app.dock_drop_rect = None;
|
||||
app.drop_canvas_rect = None;
|
||||
app.ui.task_bar_shown = None;
|
||||
start_screen(app, ui);
|
||||
} else {
|
||||
crate::panels::region_versions::show_canvas(app, ui, documents);
|
||||
}
|
||||
crate::layer_transfer::finish(app, ui.ctx());
|
||||
// The Shift+Alt+right-click HUD Color Picker (#6098), while its gesture is held.
|
||||
crate::color_hud::show(app, ui);
|
||||
@@ -44,6 +55,31 @@ pub fn document_area(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
}
|
||||
}
|
||||
|
||||
/// The document area's work of every pass, which the window's body runs before the dock: the GPU canvas's documents
|
||||
/// and their texture budget, a Content-Aware Scale step, the blocks background redraws landed, the tablet settings, and
|
||||
/// what a tool switch or a layer switch leaves behind (a pending crop, a Properties eyedropper). A replayed view or dock
|
||||
/// column runs none of its own code, so none of this lives in them. A Batch preview in place of the documents
|
||||
/// ([`crate::jobs_ui::batch_preview`]) holds all of it back.
|
||||
pub(crate) fn each_pass(app: &mut PhotocraftApp, ctx: &egui::Context) {
|
||||
if crate::jobs_ui::batch_preview_key(app).is_some() {
|
||||
return;
|
||||
}
|
||||
retain_gpu_documents(app);
|
||||
publish_shown(app);
|
||||
crate::cas_transform::tick(app, ctx);
|
||||
crate::background_redraw::poll_all(app);
|
||||
// Pen pressure/tilt for the tools' events (mouse = 1.0), unless Preferences › Tools › Use Tablet Pressure is off;
|
||||
// the pen's eraser end selects the Eraser.
|
||||
app.stylus.use_pressure = app.session.prefs().tools.use_tablet_pressure;
|
||||
let curve = app.session.prefs().tools.pressure_curve.clone();
|
||||
app.stylus.set_pressure_curve(&curve);
|
||||
crate::stylus::Stylus::sync_eraser_tool(app);
|
||||
// A Properties Levels/Curves eyedropper left behind by a tool or layer switch is dropped.
|
||||
crate::layer_picker::prune(app);
|
||||
// A crop left pending when another tool was picked is applied or dropped.
|
||||
crate::crop_ui::each_pass(app);
|
||||
}
|
||||
|
||||
/// Where each pane of Window › Arrange's n-up or Tile arrangement is in `rect`, with the document it shows: pane `i` is
|
||||
/// docked group `i` of `app.ui.document_windows`, showing that group's shown document, in the rect `SplitViews`
|
||||
/// places it in with the dividers at `app.ui.split_at`. `None` with no arrangement or fewer than two docked groups:
|
||||
@@ -128,14 +164,13 @@ pub(crate) fn publish_shown(app: &PhotocraftApp) {
|
||||
}
|
||||
|
||||
/// What the document area does after Window › Arrange changed the document windows (top-w15 calls it after
|
||||
/// `arrange`). A new n-up or Tile arrangement starts from even panes and every document fits its new pane, as
|
||||
/// production's layouts do; Tile is a pane per open document, floating windows docked first (the framework's
|
||||
/// `arrange` consolidates before it splits). The other window commands and the Match commands leave the panes and
|
||||
/// views alone.
|
||||
/// `arrange`). A new n-up or Tile arrangement starts from even panes; every document keeps its zoom and view centre,
|
||||
/// as the reference application's layouts do (#16885), so it shows centred in its new pane. Tile is a pane per open
|
||||
/// document, floating windows docked first (the framework's `arrange` consolidates before it splits). The other window
|
||||
/// commands and the Match commands leave the panes and views alone.
|
||||
pub(crate) fn apply_arranged(app: &mut PhotocraftApp, arranged: Arranged) {
|
||||
if arranged == Arranged::Windows && app.ui.document_windows.arrangement.is_some() {
|
||||
app.ui.split_at = SplitAt::default();
|
||||
app.ui.views.iter_mut().for_each(|view| view.place(craft::ui::canvas::ViewCommands::FitOnScreen));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,19 +181,12 @@ const DOCK_BAND: f32 = 32.0;
|
||||
fn documents(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
// The web build's drop path reads where the canvas is (`file_open::target_at`); set again when one shows.
|
||||
app.drop_canvas_rect = None;
|
||||
// A run that shows no canvas of the active document shows no crop task bar (`crop_task_bar::show` reports one).
|
||||
app.ui.task_bar_shown = None;
|
||||
// A floating window's title bar docks on the tab strip (`tabs::strip` sets its rect); where no strip shows, on a
|
||||
// band of a tab's height at the top of the area, where the strip would be.
|
||||
let area = ui.max_rect();
|
||||
app.dock_drop_rect = Some(Rect::from_min_size(area.min, egui::vec2(area.width(), DOCK_BAND.min(area.height()))));
|
||||
retain_gpu_documents(app);
|
||||
publish_shown(app);
|
||||
crate::cas_transform::tick(app, ui.ctx());
|
||||
if app.home_screen_up() {
|
||||
// The Home screen hides the tabs: a floating window dropped on it docks nowhere (#16415).
|
||||
app.dock_drop_rect = None;
|
||||
start_screen(app, ui);
|
||||
return;
|
||||
}
|
||||
// Files opening in the background (#210) have tabs before they have documents.
|
||||
let opening = !app.jobs.opens.is_empty();
|
||||
// The tabs region and the document run one after the other inside `show`, each with the app to itself.
|
||||
@@ -279,3 +307,7 @@ fn arranged(app: &mut PhotocraftApp, ui: &mut egui::Ui, rect: Rect, active: usiz
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[path = "arrange_keeps_zoom_tests.rs"]
|
||||
mod arrange_keeps_zoom_tests;
|
||||
@@ -35,6 +35,11 @@ impl View {
|
||||
.aspect(f64::from(aspect))
|
||||
}
|
||||
|
||||
/// Takes `zoom` points per document unit, shown at `ppp` device pixels per point, and leaves the centre and rotation.
|
||||
pub(crate) fn set_zoom(&mut self, zoom: f64, ppp: f32) {
|
||||
self.zoom = (zoom * f64::from(ppp)) as f32;
|
||||
}
|
||||
|
||||
/// Takes the zoom, centre and rotation of `view`, shown at `ppp` device pixels per point.
|
||||
pub(crate) fn set_from(&mut self, view: &CanvasView, ppp: f32) {
|
||||
self.zoom = (view.zoom * f64::from(ppp)) as f32;
|
||||
@@ -513,7 +518,7 @@ fn canvas_controls(
|
||||
crate::blur_pins::overlay(app, ui, rect);
|
||||
let doc = app.session.documents()[host.idx].doc.id;
|
||||
if let Some(shown) = crate::vector_ui::overlay::show_paths(app, ui, rect, doc) {
|
||||
let mods = craft::ui::runtime::pointer::frame(ui.ctx()).mods;
|
||||
let mods = craft::ui::runtime::pointer::mods(ui.ctx());
|
||||
crate::direct_select::edits::apply(app, &shown.output, &shown.refs, app.ui.tool, mods);
|
||||
}
|
||||
crate::type_tool::canvas_controls(app, ui, rect);
|
||||
@@ -573,7 +578,6 @@ fn canvas_controls(
|
||||
}
|
||||
crate::frame_tool::task_bar::show(ui, app, bar_area);
|
||||
}
|
||||
crate::crop_ui::each_pass(app);
|
||||
crate::vector_ui::shapes::show_preview(app, ui, rect, &space.view);
|
||||
crate::tools::brush_feedback::show(ui, app, rect, pointer);
|
||||
if shown != space.view {
|
||||
|
||||
@@ -48,6 +48,18 @@ fn adjust_request(app: &PhotocraftApp) -> Option<(craft::ui::dialog::DialogId, S
|
||||
Some((open.id, cmd, params))
|
||||
}
|
||||
|
||||
/// An open preview dialog's request: the dialog, its command and its parameters.
|
||||
type PreviewRequest = (craft::ui::dialog::DialogId, String, String);
|
||||
|
||||
/// What the canvas shows of an open filter or adjustment dialog's preview, for the document area's version
|
||||
/// (`region_versions::canvas`): the request the dialog asks for (its fields change with no command) and the result
|
||||
/// on screen, with whether OK's job is running.
|
||||
pub(crate) fn canvas_key(app: &PhotocraftApp) -> (Option<PreviewRequest>, Option<(usize, bool)>) {
|
||||
let request = adjust_request(app).map(|(id, command, params)| (id, command, params.to_string()));
|
||||
let shown = app.filter_preview.as_ref().map(|p| (p.result.as_ref().map_or(0, |doc| std::sync::Arc::as_ptr(doc) as usize), p.committing));
|
||||
(request, shown)
|
||||
}
|
||||
|
||||
/// Live preview for an open filter dialog: run the filter on the proxy and upload it. With
|
||||
/// background jobs (the desktop app) it computes on one background worker
|
||||
/// (`filter_preview_worker`); otherwise (web, tests, `PHOTOCRAFT_INLINE_JOBS`) it keeps the
|
||||
@@ -184,7 +196,7 @@ pub(crate) fn ensure_filter_preview(app: &mut PhotocraftApp, idx: usize, ctx: &e
|
||||
}
|
||||
}
|
||||
if app.filter_preview_worker.busy() {
|
||||
ctx.request_repaint_after(std::time::Duration::from_millis(16));
|
||||
craft::ui::runtime::frame::request_repaint_after(ctx, std::time::Duration::from_millis(16).as_secs_f64());
|
||||
}
|
||||
let preview = app.filter_preview.as_ref()?;
|
||||
// Keep the last preview during a drag, but never one from another source or dialog. It is
|
||||
|
||||
@@ -82,7 +82,7 @@ fn harness(app: Box<PhotocraftApp>) -> AppHarness {
|
||||
if !ui.ctx().fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
crate::dialogs::run(app, ui);
|
||||
},
|
||||
app,
|
||||
|
||||
@@ -188,7 +188,7 @@ mod tests {
|
||||
if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
a,
|
||||
);
|
||||
|
||||
@@ -5,7 +5,7 @@ use egui::{PointerButton, Pos2, Rect, vec2};
|
||||
use serde_json::json;
|
||||
|
||||
use super::document_display::{CanvasHost, shown_camera};
|
||||
use super::{canvas_display, canvas_view, document_area};
|
||||
use super::{canvas_display, canvas_view, testing};
|
||||
use crate::PhotocraftApp;
|
||||
use crate::state::{Tool, View};
|
||||
|
||||
@@ -23,7 +23,7 @@ fn live_brush_texture_includes_this_frames_press_and_moves() {
|
||||
if !ui.ctx().fonts(|fonts| fonts.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
egui::CentralPanel::default().show(ui, |ui| document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
|
||||
@@ -25,7 +25,7 @@ pub(super) fn harness(prefs: Option<&str>) -> Harness<'static, Box<PhotocraftApp
|
||||
if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
|
||||
@@ -110,12 +110,12 @@ pub(crate) fn drain(app: &mut PhotocraftApp, state: &mut PaintState, _response:
|
||||
let ctx = app.ctx().clone();
|
||||
// The stroke is still painting what it was given: show its steps as they finish.
|
||||
if live_stroke_busy(app) {
|
||||
ctx.request_repaint();
|
||||
craft::ui::runtime::frame::request_repaint(&ctx);
|
||||
}
|
||||
// A held pen keeps the clock running for airbrush build-up and smoothing catch-up (asked
|
||||
// after the feed, which brings in what the stroke's thread last painted).
|
||||
if stroke_wants_time(app) {
|
||||
ctx.request_repaint_after(Duration::from_millis(HOLD_REPEAT_MS as u64));
|
||||
craft::ui::runtime::frame::request_repaint_after(&ctx, Duration::from_millis(HOLD_REPEAT_MS as u64).as_secs_f64());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ fn harness(mut app: Box<PhotocraftApp>) -> Harness<'static, Box<PhotocraftApp>>
|
||||
if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
|
||||
@@ -25,7 +25,7 @@ fn harness_with_passes(size: [u32; 2], tool: Tool, second_pass: bool) -> AppHarn
|
||||
if !ui.ctx().fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
if second_pass && ui.ctx().current_pass_index() == 0 {
|
||||
ui.ctx().request_discard("a second pass of the frame");
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ pub(crate) struct SnapCache {
|
||||
/// tool that hands its press to the Move stand-in. Read before the press so the targets do not
|
||||
/// change at it.
|
||||
fn moves_as_move_tool(app: &PhotocraftApp) -> bool {
|
||||
app.ui.tool == Tool::Move || (crate::canvas::tools::takes_command_stand_in(app.ui.tool) && craft::ui::runtime::pointer::frame(app.ctx()).mods.cmd)
|
||||
app.ui.tool == Tool::Move || (crate::canvas::tools::takes_command_stand_in(app.ui.tool) && craft::ui::runtime::pointer::mods(app.ctx()).cmd)
|
||||
}
|
||||
|
||||
/// The selected pixels move with the drag, so the selection is not a place to snap to (#6290).
|
||||
|
||||
@@ -121,7 +121,7 @@ fn run_frame(app: &mut PhotocraftApp) {
|
||||
frames.frame_without_input(os_input, |ui| {
|
||||
crate::shortcut_dispatch::record_view_commands(app);
|
||||
crate::shortcuts::handle(app, &ui.ctx().clone());
|
||||
egui::CentralPanel::default().show(ui, |ui| super::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| document_area(app, ui));
|
||||
crate::dialogs::run(app, ui);
|
||||
crate::shortcuts::escape_keys(app, &ui.ctx().clone());
|
||||
});
|
||||
@@ -266,6 +266,14 @@ pub(crate) fn modifiers(app: &mut PhotocraftApp, mods: Modifiers) {
|
||||
settle(app);
|
||||
}
|
||||
|
||||
/// The document area as the app's window runs it: first the area's work of every pass, which the window's body runs
|
||||
/// before the dock (a pending crop left by a tool switch, the tablet settings, landed redraws), then the area. Every
|
||||
/// harness that shows the area without the window shows it through this.
|
||||
pub(crate) fn document_area(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
super::document_area::each_pass(app, ui.ctx());
|
||||
super::document_area(app, ui);
|
||||
}
|
||||
|
||||
/// One pass with no input: what a tool change cancels, a document switch drops.
|
||||
pub(crate) fn frame(app: &mut PhotocraftApp) {
|
||||
run_frame(app);
|
||||
|
||||
@@ -919,7 +919,7 @@ fn torn_off_document_is_not_drawn_again_in_the_main_window() {
|
||||
let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(680.0, 480.0)).with_context(app.ctx().clone()).build_ui_state(
|
||||
|ui, (app, ready): &mut (Box<PhotocraftApp>, bool)| {
|
||||
if *ready {
|
||||
egui::CentralPanel::default().frame(egui::Frame::NONE).show(ui, |ui| document_area(app, ui));
|
||||
egui::CentralPanel::default().frame(egui::Frame::NONE).show(ui, |ui| testing::document_area(app, ui));
|
||||
}
|
||||
},
|
||||
(app, false),
|
||||
@@ -990,7 +990,7 @@ fn a_new_window_for_document_keeps_its_own_view() {
|
||||
let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(900.0, 700.0)).with_context(app.ctx().clone()).build_ui_state(
|
||||
|ui, (app, ready): &mut (Box<PhotocraftApp>, bool)| {
|
||||
if *ready {
|
||||
egui::CentralPanel::default().frame(egui::Frame::NONE).show(ui, |ui| document_area(app, ui));
|
||||
egui::CentralPanel::default().frame(egui::Frame::NONE).show(ui, |ui| testing::document_area(app, ui));
|
||||
extra_windows(app, ui);
|
||||
}
|
||||
},
|
||||
@@ -1028,7 +1028,7 @@ fn a_tiled_document_follows_navigator_and_status_bar_zoom() {
|
||||
let mut h = egui_kittest::Harness::builder().with_size(egui::vec2(900.0, 700.0)).with_context(app.ctx().clone()).build_ui_state(
|
||||
|ui, (app, ready): &mut (Box<PhotocraftApp>, bool)| {
|
||||
if *ready {
|
||||
egui::CentralPanel::default().frame(egui::Frame::NONE).show(ui, |ui| document_area(app, ui));
|
||||
egui::CentralPanel::default().frame(egui::Frame::NONE).show(ui, |ui| testing::document_area(app, ui));
|
||||
}
|
||||
},
|
||||
(app, false),
|
||||
|
||||
@@ -317,8 +317,6 @@ pub(super) fn ensure_gpu(app: &mut PhotocraftApp, ctx: &egui::Context, idx: usiz
|
||||
app.navigator_gpu.remove(&id);
|
||||
}
|
||||
let size = [doc.size.width, doc.size.height];
|
||||
// A full CPU redraw running in the background: show the blocks it has finished.
|
||||
crate::background_redraw::poll(app, &gpu, id);
|
||||
let cache = app.canvases.entry((id, GPU_OUTPUT)).or_default();
|
||||
let present = cache.on_gpu && gpu.has(id.0, size);
|
||||
let current = cache.revision == revision && cache.preview_key == preview_key;
|
||||
|
||||
@@ -722,7 +722,7 @@ pub(crate) fn run(app: &mut PhotocraftApp, ui: &egui::Ui, host: CanvasHost, out:
|
||||
response.view = Some(view);
|
||||
}
|
||||
}
|
||||
ctx.request_repaint();
|
||||
craft::ui::runtime::frame::request_repaint(&ctx);
|
||||
}
|
||||
match response.gesture {
|
||||
Some(GesturePhase::Begin) => tools.gesture_on = app.session.documents().get(host.idx).map(|state| (state.doc.id.0, host)),
|
||||
|
||||
@@ -723,7 +723,7 @@ pub(super) fn show(app: &mut PhotocraftApp, ctx: &egui::Context, idx: usize, vie
|
||||
}
|
||||
stream.stats.limit = limit;
|
||||
if stream.busy() {
|
||||
ctx.request_repaint_after(std::time::Duration::from_millis(16));
|
||||
craft::ui::runtime::frame::request_repaint_after(ctx, std::time::Duration::from_millis(16).as_secs_f64());
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ fn capslock_harness() -> Harness<'static, Box<PhotocraftApp>> {
|
||||
if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
|
||||
@@ -53,13 +53,42 @@ fn chrome_views(h: &H) -> Vec<(&'static str, MemoRun)> {
|
||||
last_frame_memo_runs(&h.ctx).into_iter().filter(|(name, _, _)| CHROME.iter().any(|c| name.contains(c))).map(|(name, _, run)| (name, run)).collect()
|
||||
}
|
||||
|
||||
/// The shell's slots of the harness's window, in the order the shell shows them (`AppShell`): the title bar, the
|
||||
/// options bar, the status bar.
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub(crate) enum ShellSlot {
|
||||
Title,
|
||||
Options,
|
||||
Status,
|
||||
}
|
||||
|
||||
/// How the shell's view of `slot` took part in `runs`: `(ran, replayed)`. The shell's slot views share one props type,
|
||||
/// so they are told apart by id, in the order the shell decides them in every pass, which is the order it shows its
|
||||
/// slots in.
|
||||
pub(crate) fn slot_runs(runs: &[(&'static str, egui::Id, MemoRun)], slot: ShellSlot) -> (usize, usize) {
|
||||
let mut ids: Vec<egui::Id> = Vec::new();
|
||||
for (name, id, _) in runs {
|
||||
if name.contains("app_shell::SlotView<") && !ids.contains(id) {
|
||||
ids.push(*id);
|
||||
}
|
||||
}
|
||||
let Some(&id) = ids.get(slot as usize) else { return (0, 0) };
|
||||
let count = |how: MemoRun| runs.iter().filter(|(_, of, run)| *of == id && *run == how).count();
|
||||
(count(MemoRun::Ran), count(MemoRun::Replayed))
|
||||
}
|
||||
|
||||
/// How the shell's view of `slot` took part in the last frame: `(ran, replayed)`.
|
||||
fn slot_views(h: &H, slot: ShellSlot) -> (usize, usize) {
|
||||
slot_runs(&last_frame_memo_runs(&h.ctx), slot)
|
||||
}
|
||||
|
||||
/// The panel tab strips the last pass ran.
|
||||
fn tab_strip_runs(h: &H) -> Vec<(&'static str, u32)> {
|
||||
last_pass_runs(&h.ctx).into_iter().filter(|(ty, _)| ty.contains("TabStrip<'_, craft_ui_panels::docking::PanelKey>")).collect()
|
||||
}
|
||||
|
||||
/// A hover over the canvas replays the dock's tab rows and column bars and the menu bar (memoized views) and runs no
|
||||
/// panel tab strip.
|
||||
/// A hover over the canvas replays the dock's tab rows and column bars (in the columns' views, which replay whole) and
|
||||
/// the menu bar (memoized views) and runs no panel tab strip.
|
||||
#[test]
|
||||
fn a_hover_over_the_canvas_replays_the_dock_chrome_and_the_menu_bar() {
|
||||
let mut h = harness();
|
||||
@@ -68,11 +97,14 @@ fn a_hover_over_the_canvas_replays_the_dock_chrome_and_the_menu_bar() {
|
||||
for step in 1..=3 {
|
||||
h.event(Event::PointerMoved(at + vec2(step as f32, 0.0)));
|
||||
h.run_steps(1);
|
||||
// The menu bar sits in the title bar's own view: while that replays, the menu bar replays with it.
|
||||
let title_replayed = views(&h, "TitleSlot<", MemoRun::Replayed) == 1;
|
||||
// The menu bar sits in the title slot's view: while that replays, the menu bar replays with it.
|
||||
let title_replayed = slot_views(&h, ShellSlot::Title).1 == 1;
|
||||
let columns = (views_ran(&h, "area::ColumnView<"), views(&h, "area::ColumnView<", MemoRun::Replayed));
|
||||
assert!(columns.0 == 0 && columns.1 >= 1, "hover step {step}: the dock's columns replay: {columns:?}");
|
||||
let views = chrome_views(&h);
|
||||
for kind in ["TabRow", "dock_column::bar::BarProps", "menu::bar::BarProps"] {
|
||||
let shown = views.iter().any(|(name, _)| name.contains(kind)) || (kind == "menu::bar::BarProps" && title_replayed);
|
||||
let replayed_with = if kind == "menu::bar::BarProps" { title_replayed } else { columns.1 >= 1 };
|
||||
let shown = views.iter().any(|(name, _)| name.contains(kind)) || replayed_with;
|
||||
assert!(shown, "hover step {step}: the chrome shows a {kind} view: {views:?}");
|
||||
}
|
||||
let ran: Vec<_> = views.iter().filter(|(_, run)| *run != MemoRun::Replayed).collect();
|
||||
@@ -81,8 +113,9 @@ fn a_hover_over_the_canvas_replays_the_dock_chrome_and_the_menu_bar() {
|
||||
}
|
||||
}
|
||||
|
||||
/// A hover over the canvas replays the title bar, the options bar, the status bar (its own view) and every panel body: the
|
||||
/// panels read the modifiers, not the pointer frame (storytold/craft-libs#2812), so a pointer move runs none of them.
|
||||
/// A hover over the canvas replays the title bar, the options bar, the status bar (its own view) and every panel body
|
||||
/// (in the columns' views, which replay whole): the panels read the modifiers, not the pointer frame
|
||||
/// (storytold/craft-libs#2812), so a pointer move runs none of them.
|
||||
#[test]
|
||||
fn a_hover_over_the_canvas_replays_the_bars_and_the_panel_bodies() {
|
||||
let mut h = harness();
|
||||
@@ -90,16 +123,20 @@ fn a_hover_over_the_canvas_replays_the_bars_and_the_panel_bodies() {
|
||||
for step in 1..=3 {
|
||||
h.event(Event::PointerMoved(at + vec2(step as f32, 0.0)));
|
||||
h.run_steps(1);
|
||||
for slot in ["TitleSlot<", "OptionsSlot<", "status_bar::StatusProps<"] {
|
||||
assert_eq!((views_ran(&h, slot), views(&h, slot, MemoRun::Replayed)), (0, 1), "hover step {step}: the {slot} view replays");
|
||||
for slot in [ShellSlot::Title, ShellSlot::Options, ShellSlot::Status] {
|
||||
assert_eq!(slot_views(&h, slot), (0, 1), "hover step {step}: the {slot:?} slot's view replays");
|
||||
}
|
||||
let bodies = (views_ran(&h, "region_versions::PanelBody<"), views(&h, "region_versions::PanelBody<", MemoRun::Replayed));
|
||||
assert!(bodies.0 == 0 && bodies.1 >= 2, "hover step {step}: every panel body replays: {bodies:?}");
|
||||
let columns = (views_ran(&h, "area::ColumnView<"), views(&h, "area::ColumnView<", MemoRun::Replayed));
|
||||
assert!(
|
||||
views_ran(&h, "region_versions::PanelBody<") == 0 && columns == (0, columns.1) && columns.1 >= 2,
|
||||
"hover step {step}: every panel body replays with its column: {columns:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A hover over the canvas replays the toolbar's footer (the colour chips, Quick Mask and Screen Mode): the rail replays
|
||||
/// its tool buttons but calls its footer every pass, so before it was a view of its own it ran on every frame (#15493).
|
||||
/// A hover over the canvas replays the toolbar's footer (the colour chips, Quick Mask and Screen Mode) with the toolbar's
|
||||
/// column: the rail replays its tool buttons but calls its footer every pass, so before it was a view of its own it ran
|
||||
/// on every frame (#15493).
|
||||
#[test]
|
||||
fn a_hover_over_the_canvas_replays_the_toolbar_footer() {
|
||||
let mut h = harness();
|
||||
@@ -107,8 +144,8 @@ fn a_hover_over_the_canvas_replays_the_toolbar_footer() {
|
||||
for step in 1..=3 {
|
||||
h.event(Event::PointerMoved(at + vec2(step as f32, 0.0)));
|
||||
h.run_steps(1);
|
||||
let footer = (views_ran(&h, "toolbar::FooterProps<"), views(&h, "toolbar::FooterProps<", MemoRun::Replayed));
|
||||
assert_eq!(footer, (0, 1), "hover step {step}: the toolbar footer replays");
|
||||
let columns = (views_ran(&h, "area::ColumnView<"), views(&h, "area::ColumnView<", MemoRun::Replayed));
|
||||
assert!(views_ran(&h, "toolbar::FooterProps<") == 0 && columns.0 == 0 && columns.1 >= 1, "hover step {step}: the toolbar footer replays: {columns:?}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,8 +171,9 @@ fn a_zoom_runs_only_the_panels_that_show_the_view() {
|
||||
let ctx = h.ctx.clone();
|
||||
crate::menus::invoke(h.state_mut(), &ctx, "view.zoomIn", json!({})).unwrap();
|
||||
h.run_steps(1);
|
||||
let bodies = (views_ran(&h, "region_versions::PanelBody<"), views(&h, "region_versions::PanelBody<", MemoRun::Replayed));
|
||||
assert!(bodies.0 <= 1 && bodies.1 >= 2, "only the Navigator's body may run, the others replay: {bodies:?}");
|
||||
let columns = views(&h, "area::ColumnView<", MemoRun::Replayed);
|
||||
let bodies = views_ran(&h, "region_versions::PanelBody<");
|
||||
assert!(bodies <= 1 && columns >= 1, "only the Navigator's body may run, the other columns replay: {bodies} ran, {columns} columns replayed");
|
||||
}
|
||||
|
||||
/// The footer runs again when a colour it shows changes without a command (the Color panel's sliders, a Color Picker
|
||||
@@ -180,7 +218,7 @@ fn the_chrome_runs_when_what_it_shows_changes() {
|
||||
h.run_steps(1);
|
||||
// The new tab titles change label widths, so the frame takes a second pass that replays what the first ran:
|
||||
// the frame's views tell.
|
||||
let (tabs, title) = (views_ran(&h, "docking::group::TabRow<"), views_ran(&h, "TitleSlot<"));
|
||||
let (tabs, title) = (views_ran(&h, "docking::group::TabRow<"), slot_views(&h, ShellSlot::Title).0);
|
||||
assert!(tabs > 0 && title > 0, "a new language runs the tab rows and the title bar: {tabs} tab rows, {title} title bars");
|
||||
h.run_steps(2);
|
||||
}
|
||||
@@ -195,7 +233,7 @@ fn the_chrome_runs_when_what_it_shows_changes() {
|
||||
h.state_mut().run("layer.new.layer", json!({})).unwrap();
|
||||
h.run_steps(1);
|
||||
// The edit's frame takes two passes, and its second replays what the first ran: the frame's views tell.
|
||||
assert!(views_ran(&h, "TitleSlot<") > 0, "an unsaved edit runs the title bar");
|
||||
assert!(slot_views(&h, ShellSlot::Title).0 > 0, "an unsaved edit runs the title bar");
|
||||
}
|
||||
|
||||
/// A dialog closed with Escape runs no command, and the menu bar takes the menu keys again: Alt+F opens the File menu.
|
||||
@@ -215,3 +253,90 @@ fn the_menu_keys_open_a_menu_after_a_dialog_closes_with_escape() {
|
||||
h.run_steps(4);
|
||||
assert!(items(&h) > titles, "Alt+F opens the File menu: {} menu items, {titles} titles", items(&h));
|
||||
}
|
||||
|
||||
/// What `ran` counts in each of the next `steps` frames, summed.
|
||||
fn ran_over(h: &mut H, steps: usize, ran: impl Fn(&H) -> usize) -> usize {
|
||||
(0..steps)
|
||||
.map(|_| {
|
||||
h.run_steps(1);
|
||||
ran(h)
|
||||
})
|
||||
.sum()
|
||||
}
|
||||
|
||||
/// The options bar's slot view, if it ran in the last frame.
|
||||
fn options_ran(h: &H) -> usize {
|
||||
slot_views(h, ShellSlot::Options).0
|
||||
}
|
||||
|
||||
/// The status bar's body view, if it ran in the last frame.
|
||||
fn status_ran(h: &H) -> usize {
|
||||
views_ran(h, "status_bar::StatusProps<")
|
||||
}
|
||||
|
||||
/// A pan with a tool whose bar shows no view field runs neither the options bar nor the status bar (it shows the zoom
|
||||
/// only); a zoom runs the status bar, and the options bar only while the Zoom tool's bar shows the zoom.
|
||||
#[test]
|
||||
fn a_pan_runs_neither_bar_and_a_zoom_runs_the_status_bar() {
|
||||
let mut h = harness();
|
||||
h.state_mut().ui.tool = crate::state::Tool::Move;
|
||||
h.run_steps(4);
|
||||
h.state_mut().ui.views[0].center[0] += 40.0;
|
||||
assert_eq!(ran_over(&mut h, 3, options_ran), 0, "a pan runs no options bar");
|
||||
h.state_mut().ui.views[0].center[0] += 40.0;
|
||||
assert_eq!(ran_over(&mut h, 3, status_ran), 0, "a pan runs no status bar");
|
||||
|
||||
h.state_mut().ui.views[0].zoom *= 2.0;
|
||||
let status = ran_over(&mut h, 3, status_ran);
|
||||
assert!(status > 0, "a zoom runs the status bar: {status}");
|
||||
}
|
||||
|
||||
/// The Zoom tool's bar shows the zoom, so a zoom runs it.
|
||||
#[test]
|
||||
fn a_zoom_runs_the_zoom_tools_options_bar() {
|
||||
let mut h = harness();
|
||||
h.state_mut().ui.tool = crate::state::Tool::Zoom;
|
||||
h.run_steps(4);
|
||||
h.state_mut().ui.views[0].zoom *= 2.0;
|
||||
assert!(ran_over(&mut h, 3, options_ran) > 0, "a zoom runs the Zoom tool's bar");
|
||||
}
|
||||
|
||||
/// A tool option changed outside the bar runs the bar, and the frames after it replay it.
|
||||
#[test]
|
||||
fn a_tool_option_runs_the_options_bar_once() {
|
||||
let mut h = harness();
|
||||
h.state_mut().ui.tool = crate::state::Tool::Move;
|
||||
h.run_steps(4);
|
||||
assert_eq!(ran_over(&mut h, 2, options_ran), 0, "settled");
|
||||
let on = h.state().ui.tool_options.move_auto_select;
|
||||
h.state_mut().ui.tool_options.move_auto_select = !on;
|
||||
assert!(ran_over(&mut h, 1, options_ran) > 0, "a changed option runs the bar");
|
||||
// What the bar's frame remembers of the option (the saved preferences) moves no version.
|
||||
assert_eq!(ran_over(&mut h, 3, options_ran), 0, "the frames after the changed one run no bar");
|
||||
}
|
||||
|
||||
/// A bar that runs and writes every control's value back leaves the tool options' revision alone, so idle frames never
|
||||
/// move what the bar's version holds, whichever tool's bar is showing.
|
||||
#[test]
|
||||
fn an_idle_options_bar_leaves_the_tool_options_revision() {
|
||||
let mut h = harness();
|
||||
let mut moved = Vec::new();
|
||||
for tool in crate::state::Tool::ALL {
|
||||
h.state_mut().ui.tool = tool;
|
||||
h.run_steps(4);
|
||||
let settled = h.state().ui.tool_options.revision();
|
||||
h.run_steps(6);
|
||||
if h.state().ui.tool_options.revision() != settled {
|
||||
moved.push(tool);
|
||||
}
|
||||
}
|
||||
assert!(moved.is_empty(), "idle frames moved the tool options under {moved:?}");
|
||||
// A changed option runs the bar, whose own writes then change nothing more.
|
||||
h.state_mut().ui.tool = crate::state::Tool::Move;
|
||||
h.run_steps(4);
|
||||
let on = h.state().ui.tool_options.move_auto_select;
|
||||
h.state_mut().ui.tool_options.move_auto_select = !on;
|
||||
let changed = h.state().ui.tool_options.revision();
|
||||
h.run_steps(10);
|
||||
assert_eq!(h.state().ui.tool_options.revision(), changed, "the bar's run after a change");
|
||||
}
|
||||
@@ -174,6 +174,8 @@ pub struct AdjustOut {
|
||||
pub ask: Option<AdjustAsk>,
|
||||
/// The pass's edit events of the value, in order, with their gesture ids and phases.
|
||||
pub edit: EditEvents<AdjustValue>,
|
||||
/// The tone Color Balance shows after the pass, for a host that keeps it; `None` for the other kinds.
|
||||
pub tone: Option<ColorBalanceTone>,
|
||||
}
|
||||
|
||||
/// What the editor function reads, built once when the adjustment opens.
|
||||
@@ -189,7 +191,8 @@ pub struct EditorSetup {
|
||||
pub gradients: Vec<GradientGroup>,
|
||||
/// The current foreground and background colours ([`swatches`]), for the host's colour requests.
|
||||
pub swatches: [[f32; 3]; 2],
|
||||
/// The tone Color Balance shows first; `None` keeps the editor's default (Midtones).
|
||||
/// The tone Color Balance shows, for a host that keeps it (it stores [`AdjustOut::tone`]); `None` leaves the
|
||||
/// tone to the editor (Midtones at first).
|
||||
pub tone: Option<ColorBalanceTone>,
|
||||
/// The Smart Filter the dialog edits is not reachable from the active document: the editor shows no controls.
|
||||
pub stale: bool,
|
||||
@@ -215,7 +218,7 @@ impl Default for EditorSetup {
|
||||
|
||||
/// The edit events of one editor lifted onto the value.
|
||||
fn lifted<T>(events: EditEvents<T>, wrap: impl Fn(T) -> AdjustValue) -> AdjustOut {
|
||||
AdjustOut { ask: None, edit: events.map(wrap) }
|
||||
AdjustOut { ask: None, edit: events.map(wrap), tone: None }
|
||||
}
|
||||
|
||||
fn reset_legacy_toggle(value: BrightnessContrast, previous_legacy: bool, reset: bool) -> BrightnessContrast {
|
||||
@@ -288,7 +291,7 @@ fn show(kind: &str, setup: &EditorSetup, ui: &mut Ui, value: &mut AdjustValue, c
|
||||
*curves = converted.clone();
|
||||
edit.push(EditEvent::set(Mixed::Same(from), AdjustValue::Curves { curves: converted }, Arc::from("Curves Mode"), None));
|
||||
}
|
||||
AdjustOut { ask: None, edit }
|
||||
AdjustOut { ask: None, edit, tone: None }
|
||||
}
|
||||
("exposure", AdjustValue::Exposure { values }) => {
|
||||
let fields = AdjustField::exposure(&Env::of(ui).words::<AdjustWords>());
|
||||
@@ -315,16 +318,16 @@ fn show(kind: &str, setup: &EditorSetup, ui: &mut Ui, value: &mut AdjustValue, c
|
||||
editor = editor.tone(tone);
|
||||
}
|
||||
let out = editor.show(ui);
|
||||
lifted(out.edit.events, |value| AdjustValue::ColorBalance { value })
|
||||
AdjustOut { tone: Some(out.tone), ..lifted(out.edit.events, |value| AdjustValue::ColorBalance { value }) }
|
||||
}
|
||||
("blackWhite", AdjustValue::BlackWhite { value }) => {
|
||||
let out = BlackWhiteEditor::new("Black & White", Bind::bound(value)).context(context).show(ui);
|
||||
let ask = if out.auto { Some(AdjustAsk::Auto) } else { out.pick_color.map(AdjustAsk::PickColor) };
|
||||
AdjustOut { ask, edit: out.edit.events.map(|value| AdjustValue::BlackWhite { value }) }
|
||||
AdjustOut { ask, edit: out.edit.events.map(|value| AdjustValue::BlackWhite { value }), tone: None }
|
||||
}
|
||||
("photoFilter", AdjustValue::PhotoFilter { value }) => {
|
||||
let out = PhotoFilterEditor::new("Photo Filter", Bind::bound(value)).context(context).show(ui);
|
||||
AdjustOut { ask: out.pick_color.map(AdjustAsk::PickColor), edit: out.edit.events.map(|value| AdjustValue::PhotoFilter { value }) }
|
||||
AdjustOut { ask: out.pick_color.map(AdjustAsk::PickColor), edit: out.edit.events.map(|value| AdjustValue::PhotoFilter { value }), tone: None }
|
||||
}
|
||||
("channelMixer", AdjustValue::ChannelMixer { value }) => {
|
||||
let out = ChannelMixerEditor::new("Channel Mixer", Bind::bound(value)).context(context).show(ui);
|
||||
@@ -358,7 +361,7 @@ fn show(kind: &str, setup: &EditorSetup, ui: &mut Ui, value: &mut AdjustValue, c
|
||||
AdjustAsk::PickColor(request)
|
||||
})
|
||||
};
|
||||
AdjustOut { ask, edit }
|
||||
AdjustOut { ask, edit, tone: None }
|
||||
}
|
||||
("selectiveColor", AdjustValue::SelectiveColor { value }) => {
|
||||
let out = SelectiveColorEditor::new("Selective Color", Bind::bound(value)).context(context).show(ui);
|
||||
|
||||
@@ -32,7 +32,7 @@ pub(crate) struct PropertiesAdjust {
|
||||
pub channel: usize,
|
||||
/// The Levels clipping display.
|
||||
pub clipping: Option<LevelsClip>,
|
||||
/// A tone for Color Balance to show, given once: the Reset to defaults shows Midtones again.
|
||||
/// The tone Color Balance shows, as the editor last reported it; the Reset to defaults sets Midtones.
|
||||
pub tone: Option<ColorBalanceTone>,
|
||||
/// The Color Picker a colour well opened, while it is open.
|
||||
pub pick: Option<ColorPick>,
|
||||
@@ -187,7 +187,6 @@ pub fn layer_editor(app: &mut PhotocraftApp, ui: &mut egui::Ui, id: LayerId, adj
|
||||
// count of passes the panel showed something else or nothing (`PhotocraftApp::properties_hidden`), which stays
|
||||
// put while it shows this layer, replays included.
|
||||
record.session.track(session_target(doc, id), app.properties_hidden, &committed);
|
||||
app.properties_tracked = true;
|
||||
}
|
||||
follow_color_pick(app, id, &mut record, &committed, &vcx);
|
||||
let mut value = match &app.live_adjust {
|
||||
@@ -207,7 +206,7 @@ pub fn layer_editor(app: &mut PhotocraftApp, ui: &mut egui::Ui, id: LayerId, adj
|
||||
},
|
||||
gradients: if kind == "gradientMap" { gradient_presets(app) } else { Vec::new() },
|
||||
swatches: swatches(app),
|
||||
tone: record.tone.take(),
|
||||
tone: record.tone,
|
||||
..Default::default()
|
||||
};
|
||||
let armed = crate::layer_picker::armed(app).filter(|(layer, _)| *layer == id).map(|(_, picker)| picker);
|
||||
@@ -220,6 +219,9 @@ pub fn layer_editor(app: &mut PhotocraftApp, ui: &mut egui::Ui, id: LayerId, adj
|
||||
if picker != armed {
|
||||
crate::layer_picker::arm(app, id, picker);
|
||||
}
|
||||
if out.tone.is_some() {
|
||||
record.tone = out.tone;
|
||||
}
|
||||
|
||||
for event in out.edit {
|
||||
match &event {
|
||||
|
||||
@@ -170,6 +170,13 @@ pub fn params(value: &ColorRangeValue) -> Value {
|
||||
Value::Object(p)
|
||||
}
|
||||
|
||||
/// What the canvas shows of the open Color Range dialog's Selection Preview, for the document area's version
|
||||
/// (`region_versions::canvas`): the preview mode and the fields, which change with no command.
|
||||
pub(crate) fn canvas_key(app: &PhotocraftApp) -> Option<(PreviewMode, String)> {
|
||||
let dialog = app.framework.dialogs.get::<HostedColorRange>()?;
|
||||
Some((dialog.preview_mode(), params(dialog.value()).to_string()))
|
||||
}
|
||||
|
||||
/// Cached preview: the document proxy (per revision) and the pictures drawn from it.
|
||||
pub struct Preview {
|
||||
doc: DocId,
|
||||
|
||||
@@ -23,7 +23,7 @@ pub fn persist(app: &mut PhotocraftApp) {
|
||||
}
|
||||
let now = snapshot(app);
|
||||
if app.session.prefs().panel_layout != now {
|
||||
app.session.prefs.edit(|prefs| prefs.panel_layout = now);
|
||||
app.session.prefs.remember(|prefs| prefs.panel_layout = now);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ fn harness(command: Option<&str>, rotation: f32) -> Harness<'static, Box<Photocr
|
||||
return;
|
||||
}
|
||||
crate::shortcuts::handle(app, &ctx);
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
crate::dialogs::run(app, ui);
|
||||
},
|
||||
app,
|
||||
|
||||
@@ -34,7 +34,7 @@ fn home(path: &str) -> Harness<'static, (Box<PhotocraftApp>, bool)> {
|
||||
let mut h = Harness::builder().with_size(egui::vec2(900.0, 760.0)).with_context(app.ctx().clone()).build_ui_state(
|
||||
|ui, (app, ready): &mut (Box<PhotocraftApp>, bool)| {
|
||||
if *ready {
|
||||
egui::CentralPanel::default().frame(egui::Frame::NONE).show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().frame(egui::Frame::NONE).show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
}
|
||||
},
|
||||
(app, false),
|
||||
|
||||
@@ -883,16 +883,25 @@ pub(crate) fn status_job(app: &PhotocraftApp) -> Option<(JobId, crate::panels::s
|
||||
Some((j.id, crate::panels::status_bar::Progress { label, fraction: shown_fraction(&j), cancel: Some(tl!("Cancel (Esc)").to_owned()), refused }))
|
||||
}
|
||||
|
||||
/// Show the folder Batch worker's immutable current document in the canvas area. The worker
|
||||
/// publishes snapshots rather than adding them to `Session`, so no edit or Save can target one.
|
||||
pub(crate) fn batch_preview(app: &mut PhotocraftApp, ui: &mut egui::Ui) -> bool {
|
||||
let current = app
|
||||
.session
|
||||
/// The running Batch job whose worker has published its current input, with that snapshot.
|
||||
fn shown_batch_preview(app: &PhotocraftApp) -> Option<(JobId, photocraft_engine::jobs::BatchPreview)> {
|
||||
app.session
|
||||
.jobs()
|
||||
.into_iter()
|
||||
.filter(|job| job.command == "file.automate.batch")
|
||||
.find_map(|job| app.session.batch_preview(job.id).map(|preview| (job.id, preview)));
|
||||
let Some((id, preview)) = current else { return false };
|
||||
.find_map(|job| app.session.batch_preview(job.id).map(|preview| (job.id, preview)))
|
||||
}
|
||||
|
||||
/// What [`batch_preview`] shows, for the document area's version: the job and the snapshot's generation. The worker
|
||||
/// publishes a new input with no command or input reaching the area.
|
||||
pub(crate) fn batch_preview_key(app: &PhotocraftApp) -> Option<(JobId, u64)> {
|
||||
shown_batch_preview(app).map(|(id, preview)| (id, preview.generation))
|
||||
}
|
||||
|
||||
/// Show the folder Batch worker's immutable current document in the canvas area. The worker
|
||||
/// publishes snapshots rather than adding them to `Session`, so no edit or Save can target one.
|
||||
pub(crate) fn batch_preview(app: &mut PhotocraftApp, ui: &mut egui::Ui) -> bool {
|
||||
let Some((id, preview)) = shown_batch_preview(app) else { return false };
|
||||
let name = std::path::Path::new(&preview.path).file_name().map(|name| name.to_string_lossy().into_owned()).unwrap_or_else(|| preview.path.clone());
|
||||
Row::new().show(ui, |ui, _| {
|
||||
Text::new(name.clone()).role(TypeRole::BodyStrong).show(ui);
|
||||
|
||||
@@ -221,6 +221,13 @@ fn dialog(app: &PhotocraftApp) -> Option<&crate::adjust_dialog::OpenAdjust> {
|
||||
crate::adjust_dialog::open_value(app).filter(|open| open.kind == "levels" && open.smart_filter.is_none())
|
||||
}
|
||||
|
||||
/// What the canvas shows of an open Levels dialog's clipping display, for the document area's version
|
||||
/// (`region_versions::canvas`): the dialog and its fields, which change with no command.
|
||||
pub(crate) fn canvas_key(app: &PhotocraftApp) -> Option<(craft::ui::dialog::DialogId, String)> {
|
||||
let open = dialog(app)?;
|
||||
Some((open.id, crate::adjust_dialog::open_params(app).map(|params| params.to_string()).unwrap_or_default()))
|
||||
}
|
||||
|
||||
/// The display the open Levels dialog asks for on document `idx`. None when no Levels dialog
|
||||
/// shows clipping, `idx` isn't the active document, or the document can't show it: CMYK and Lab,
|
||||
/// a channel, mask or Quick Mask target, or a target that isn't a pixel layer.
|
||||
|
||||
@@ -461,12 +461,10 @@ pub struct PhotocraftApp {
|
||||
/// The Properties panel's adjustment edit in progress, with the tone editor's shown channel
|
||||
/// (`adjust_editors::PropertiesAdjust`).
|
||||
pub(crate) adjust_session: Option<adjust_editors::PropertiesAdjust>,
|
||||
/// Twice the passes the Properties panel was not in front or ran without showing the Reset session's layer: the
|
||||
/// Twice the passes the Properties panel was not in front or ran showing no adjustment layer's controls: the
|
||||
/// session (`adjust_editors`) takes a layer's settings anew after the panel stopped showing it. A pass count would
|
||||
/// also move while the panel replays its memoized body, which is still showing it.
|
||||
pub(crate) properties_hidden: u64,
|
||||
/// Whether the Properties panel's run showed the Reset session's layer (`properties_hidden`).
|
||||
pub(crate) properties_tracked: bool,
|
||||
/// The Color Picker dialog asking for a screen sample: the dialog and the field that took it.
|
||||
pub(crate) dialog_dropper: Option<(craft::ui::dialog::DialogId, String)>,
|
||||
/// The child dialog (colour picker or contour editor) the open Layer Style dialog has, with that dialog's id.
|
||||
@@ -499,6 +497,9 @@ pub struct PhotocraftApp {
|
||||
filter_preview_worker: crate::dialogs::filter_preview_worker::Worker,
|
||||
/// Full CPU canvas redraws running in the background, by document (#4024).
|
||||
pub(crate) redraws: std::collections::HashMap<photocraft_doc::DocId, background_redraw::Redraw>,
|
||||
/// How many redraw blocks have landed (`background_redraw::poll`): they reach the GPU canvas between the document
|
||||
/// area's runs, so the area's version holds the count (`region_versions::canvas`).
|
||||
pub(crate) redraw_landed: u64,
|
||||
/// The last finished background redraws, for going back to a state drawn a moment ago (#6528).
|
||||
pub(crate) kept: background_redraw::KeptComposites,
|
||||
/// Select › Color Range dialog preview (proxy document + mask / image textures).
|
||||
|
||||
@@ -28,7 +28,7 @@ fn harness_with_step_dt(tool: Tool, step_dt: f32) -> Harness<'static, Box<Photoc
|
||||
if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! PhotoCraft's frame floor (frame-design-v2 2.2, 2.3): an idle frame keys the same bytes whatever the size of the
|
||||
//! documents, presets and recent files, and builds no derived value; a status message runs only the status bar's view;
|
||||
//! documents, presets and recent files, and builds no derived value; a status message runs only the status slot and its body view;
|
||||
//! the menu model is built only when a fact it shows changed, never for a tool option or a button release, and the
|
||||
//! held model always equals a fresh build.
|
||||
|
||||
@@ -11,6 +11,7 @@ use photocraft_engine::presets::PresetsExt;
|
||||
use serde_json::json;
|
||||
|
||||
use crate::PhotocraftApp;
|
||||
use crate::chrome_settle_trials::{ShellSlot, slot_runs};
|
||||
use crate::state::Tool;
|
||||
|
||||
type H = Harness<'static, Box<PhotocraftApp>>;
|
||||
@@ -80,8 +81,14 @@ fn a_status_message_runs_only_the_status_bar() {
|
||||
h.run_steps(2);
|
||||
h.state_mut().ui.status = "Saved".into();
|
||||
h.run_steps(1);
|
||||
let ran: Vec<&'static str> = last_frame_memo_runs(&h.ctx).into_iter().filter(|(_, _, run)| *run == MemoRun::Ran).map(|(name, _, _)| name).collect();
|
||||
assert!(!ran.is_empty() && ran.iter().all(|name| name.contains("status_bar::StatusProps")), "only the status bar's view runs: {ran:?}");
|
||||
let runs = last_frame_memo_runs(&h.ctx);
|
||||
let ran: Vec<&'static str> = runs.iter().filter(|(_, _, run)| *run == MemoRun::Ran).map(|(name, _, _)| *name).collect();
|
||||
let slots = [ShellSlot::Title, ShellSlot::Options, ShellSlot::Status].map(|slot| slot_runs(&runs, slot).0);
|
||||
assert!(slots[0] == 0 && slots[1] == 0 && slots[2] > 0, "of the shell's slots only the status bar runs: {slots:?}");
|
||||
assert!(
|
||||
ran.iter().all(|name| name.contains("status_bar::StatusProps") || name.contains("app_shell::SlotView<")),
|
||||
"only the status slot and the status bar's body view run: {ran:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! The Modifier Keys panel: latching Shift, ⌘ and ⌥ for touch and pen users. Code that needs the held modifiers reads
|
||||
//! `craft::ui::runtime::pointer::frame(ctx).mods`, which includes the latched keys.
|
||||
//! `craft::ui::runtime::pointer::mods(ctx)`, which includes the latched keys.
|
||||
|
||||
use craft::ui::contract::Bind;
|
||||
use craft::ui::patterns::panels::ModifierKeysPanel;
|
||||
|
||||
@@ -484,7 +484,7 @@ pub(crate) fn run_fired(app: &mut PhotocraftApp, ctx: &egui::Context, command: &
|
||||
}
|
||||
return true;
|
||||
}
|
||||
let mods = craft::ui::runtime::pointer::frame(ctx).mods;
|
||||
let mods = craft::ui::runtime::pointer::mods(ctx);
|
||||
if let Some(event) = command.event(&rows(app), mods) {
|
||||
apply(app, ctx, event);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ mod tests {
|
||||
if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
|
||||
@@ -15,7 +15,7 @@ pub fn persist(app: &mut PhotocraftApp) {
|
||||
}
|
||||
let Ok(now) = serde_json::to_value(app.ui.color_panel) else { return };
|
||||
if stored != now {
|
||||
app.session.prefs.edit(|p| p.color_panel = now.clone());
|
||||
app.session.prefs.remember(|p| p.color_panel = now.clone());
|
||||
}
|
||||
app.ui.color_panel_synced = Some(now);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
//!
|
||||
//! The command dispatch takes a [`mark`] before a command and calls [`file`] after it; when the
|
||||
//! active layer moved, the reveal waits in `PhotocraftApp::pending_reveal` until the panel next
|
||||
//! draws and [`take`]s it, so a hidden panel reveals the layer when it is shown again.
|
||||
//! draws and applies it, so a hidden panel reveals the layer when it is shown again.
|
||||
//!
|
||||
//! Only a change of the active layer reveals: closing the group that holds it, or scrolling
|
||||
//! away, is left alone until the next change.
|
||||
@@ -50,9 +50,9 @@ pub(crate) fn file(app: &mut PhotocraftApp, before: Mark) {
|
||||
app.pending_reveal = Some((id, groups));
|
||||
}
|
||||
|
||||
/// The pending reveal, for the Layers panel's draw: the layer and what its closed parent groups
|
||||
/// do. The first pass of a frame takes it, so a second pass in the same frame reveals nothing
|
||||
/// again.
|
||||
/// The pending reveal: the layer and what its closed parent groups do. The Layers panel takes it
|
||||
/// once its real run applied it (`LayersOutput::requests_taken`), so a measuring run or a later
|
||||
/// pass of the same frame reveals nothing again.
|
||||
pub(crate) fn take(app: &mut PhotocraftApp) -> Option<(LayerId, Groups)> {
|
||||
app.pending_reveal.take()
|
||||
}
|
||||
@@ -23,7 +23,7 @@ pub(super) fn layers(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
use super::layers_tree::{self, PhotoThumbs};
|
||||
|
||||
// A Move-way pick of a layer opens its groups only when the Move option says so (#11381).
|
||||
let reveal = crate::layer_reveal::take(app);
|
||||
let reveal = app.pending_reveal;
|
||||
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);
|
||||
@@ -62,8 +62,11 @@ pub(super) fn layers(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
panel = panel.start_rename(id);
|
||||
}
|
||||
let out = panel.show(ui);
|
||||
app.find_layers_focus = false;
|
||||
app.layers_rename = None;
|
||||
if out.requests_taken {
|
||||
crate::layer_reveal::take(app);
|
||||
app.find_layers_focus = false;
|
||||
app.layers_rename = None;
|
||||
}
|
||||
if filter != before {
|
||||
app.ui.layer_filter = filter;
|
||||
}
|
||||
|
||||
@@ -361,8 +361,8 @@ pub(super) fn labelled<R>(ui: &mut egui::Ui, label: &str, mut add: impl FnMut(&m
|
||||
}
|
||||
|
||||
/// A check box named `label` over `value`.
|
||||
pub(super) fn check(ui: &mut egui::Ui, label: &str, value: &mut bool) {
|
||||
Checkbox::new(Bind::bound(value)).label(label.to_owned()).show(ui);
|
||||
pub(super) fn check(ui: &mut egui::Ui, label: &str, value: Bind<'_, bool>) {
|
||||
Checkbox::new(value).label(label.to_owned()).show(ui);
|
||||
}
|
||||
|
||||
/// A number field named `label` over `value` (in `unit` when it is not empty), limited to `range`. The events of this
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! The Paint Bucket's members of the options bar, and the Mode list of the Paint Bucket and the stamp tools.
|
||||
|
||||
use craft::ui::choice::Checkbox;
|
||||
use craft::ui::contract::{Bind, Entry, Props as _, Show as _};
|
||||
use craft::ui::contract::{Bind, Entry, Props as _, Show as _, bind_tracked};
|
||||
use craft::ui::patterns::blend_keys::{BlendKeyEntry, blend_entries};
|
||||
use craft::ui::pickers::Select;
|
||||
use photocraft_doc::BlendMode;
|
||||
@@ -100,26 +100,41 @@ pub(super) fn members(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
}
|
||||
let entries = mode_entries(Tool::PaintBucket, true, false);
|
||||
let sources = [Entry::new(false, tl!("Foreground").to_owned()), Entry::new(true, tl!("Pattern").to_owned())];
|
||||
let o = &mut app.ui.tool_options;
|
||||
// The Source dropdown stands alone, without a caption, as in the reference.
|
||||
Select::new(tl!("Source").to_owned(), Bind::bound(&mut o.bucket_fill_pattern), &sources).tooltip(tl!("Set source for fill area").to_owned()).show(ui);
|
||||
let mut mode = if o.bucket_clear { PaintMode::Clear } else { PaintMode::Blend(o.bucket_blend_mode) };
|
||||
Select::new(tl!("Source").to_owned(), bind_tracked!(app.ui.tool_options => bucket_fill_pattern), &sources)
|
||||
.tooltip(tl!("Set source for fill area").to_owned())
|
||||
.show(ui);
|
||||
let o = &app.ui.tool_options;
|
||||
let shown = if o.bucket_clear { PaintMode::Clear } else { PaintMode::Blend(o.bucket_blend_mode) };
|
||||
let mut mode = shown;
|
||||
labelled(ui, tl!("Mode"), |ui| mode_select(Bind::bound(&mut mode), &entries).tooltip(tl!("Fill Mode").to_owned()).show(ui));
|
||||
match mode {
|
||||
PaintMode::Clear => o.bucket_clear = true,
|
||||
PaintMode::Blend(blend) => {
|
||||
o.bucket_clear = false;
|
||||
o.bucket_blend_mode = blend;
|
||||
if mode != shown {
|
||||
let o = &mut app.ui.tool_options;
|
||||
match mode {
|
||||
PaintMode::Clear => o.bucket_clear = true,
|
||||
PaintMode::Blend(blend) => {
|
||||
o.bucket_clear = false;
|
||||
o.bucket_blend_mode = blend;
|
||||
}
|
||||
PaintMode::Behind => {}
|
||||
// Replace belongs to the Healing Brush's list, never the Paint Bucket's.
|
||||
PaintMode::HealingReplace => {}
|
||||
}
|
||||
PaintMode::Behind => {}
|
||||
// Replace belongs to the Healing Brush's list, never the Paint Bucket's.
|
||||
PaintMode::HealingReplace => {}
|
||||
}
|
||||
let opacity = number(tl!("Opacity"), &mut o.fill_opacity, 1.0..=100.0).whole().unit("%").tooltip(tl!("Set opacity for fill")).show(ui).out_of_range;
|
||||
let tolerance = number(tl!("Tolerance"), &mut o.tolerance, 0.0..=255.0).whole_alerting_fractions().tooltip(tl!("Range of colors to fill")).show(ui);
|
||||
Checkbox::new(Bind::bound(&mut o.anti_alias)).label(tl!("Anti-alias").to_owned()).tooltip(tl!("Smoothes edge transition").to_owned()).show(ui);
|
||||
Checkbox::new(Bind::bound(&mut o.contiguous)).label(tl!("Contiguous").to_owned()).tooltip(tl!("Fill only contiguous pixels").to_owned()).show(ui);
|
||||
Checkbox::new(Bind::bound(&mut o.sample_all.paint_bucket)).label(tl!("All Layers").to_owned()).tooltip(tl!("Fill composite image").to_owned()).show(ui);
|
||||
let opacity = number(tl!("Opacity"), bind_tracked!(app.ui.tool_options => fill_opacity), 1.0..=100.0)
|
||||
.whole()
|
||||
.unit("%")
|
||||
.tooltip(tl!("Set opacity for fill"))
|
||||
.show(ui)
|
||||
.out_of_range;
|
||||
let tolerance = number(tl!("Tolerance"), bind_tracked!(app.ui.tool_options => tolerance), 0.0..=255.0)
|
||||
.whole_alerting_fractions()
|
||||
.tooltip(tl!("Range of colors to fill"))
|
||||
.show(ui);
|
||||
let (anti_alias, contiguous, all_layers) = bind_tracked!(app.ui.tool_options => anti_alias, contiguous, sample_all.paint_bucket);
|
||||
Checkbox::new(anti_alias).label(tl!("Anti-alias").to_owned()).tooltip(tl!("Smoothes edge transition").to_owned()).show(ui);
|
||||
Checkbox::new(contiguous).label(tl!("Contiguous").to_owned()).tooltip(tl!("Fill only contiguous pixels").to_owned()).show(ui);
|
||||
Checkbox::new(all_layers).label(tl!("All Layers").to_owned()).tooltip(tl!("Fill composite image").to_owned()).show(ui);
|
||||
if opacity.is_some() {
|
||||
let _ = crate::dialogs::alerts::alert(app, tl!(PAINT_BUCKET_OPACITY_ALERT));
|
||||
} else if let Some(alert) = tolerance.out_of_range {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! The options bar's members of the Move, Eyedropper, Zoom, Rotate View and Hand tools.
|
||||
|
||||
use craft::ui::canvas::{NavigateBar, NavigationOptions};
|
||||
use craft::ui::contract::{Bind, Entry, Show as _};
|
||||
use craft::ui::contract::{Bind, Entry, Show as _, bind_tracked};
|
||||
use craft::ui::display::Divider;
|
||||
use craft::ui::pickers::Select;
|
||||
|
||||
@@ -21,12 +21,12 @@ pub(super) fn members(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
|
||||
/// Auto-Select, its target, Show Transform Controls, then the align strip.
|
||||
fn move_members(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
let o = &mut app.ui.tool_options;
|
||||
check(ui, tl!("Auto-Select:"), &mut o.move_auto_select);
|
||||
let (auto_select, target, transform) = bind_tracked!(app.ui.tool_options => move_auto_select, move_target, move_show_transform);
|
||||
check(ui, tl!("Auto-Select:"), auto_select);
|
||||
let targets = [Entry::new("group".to_owned(), tl!("Group").to_owned()), Entry::new("layer".to_owned(), tl!("Layer").to_owned())];
|
||||
Select::new(tl!("Auto-Select:").to_owned(), Bind::bound(&mut o.move_target), &targets).show(ui);
|
||||
Select::new(tl!("Auto-Select:").to_owned(), target, &targets).show(ui);
|
||||
Divider::vertical().show(ui);
|
||||
check(ui, tl!("Show Transform Controls"), &mut o.move_show_transform);
|
||||
check(ui, tl!("Show Transform Controls"), transform);
|
||||
Divider::vertical().show(ui);
|
||||
crate::align_bar::show(app, ui);
|
||||
}
|
||||
@@ -60,7 +60,9 @@ fn view_members(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
// Zoom Out is the bar's `out`; the tool keeps the direction as `zoom_in`.
|
||||
let mut out = !app.ui.tool_options.zoom_in;
|
||||
let shown = NavigateBar::zoom(Bind::bound(&mut view), target, &mut options, Bind::bound(&mut out)).show(ui);
|
||||
app.ui.tool_options.zoom_in = !out;
|
||||
if app.ui.tool_options.zoom_in == out {
|
||||
app.ui.tool_options.zoom_in = !out;
|
||||
}
|
||||
crate::chrome_ui::zoom_alert(app, shown.invalid_zoom);
|
||||
write_view(app, index, &view, !shown.view.is_empty());
|
||||
} else {
|
||||
|
||||
@@ -221,8 +221,7 @@ struct Panels<'a> {
|
||||
}
|
||||
|
||||
impl DockPanels<String> for Panels<'_> {
|
||||
/// A panel body is a memoized view keyed by its version (#16118); the canvas shows state that changes without a
|
||||
/// command (the view, redraw progress, animation and job overlays), so it runs every pass.
|
||||
/// A panel body is a memoized view keyed by its version (#16118).
|
||||
fn body(&mut self, panel: &String, ui: &mut egui::Ui, _: &mut BodyCx<'_>) {
|
||||
if panel == CANVAS {
|
||||
body(self.app, ui, panel);
|
||||
@@ -231,6 +230,19 @@ impl DockPanels<String> for Panels<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
/// The version of what the dock shows for a panel, which keys its column and the docked tree: the canvas's is the
|
||||
/// document area's, which also keys the area's own view (`region_versions::canvas`). A panel whose body does not show
|
||||
/// (a tab behind another, in a minimized group or an icon column without its flyout) shows only its title and icon,
|
||||
/// which every version holds.
|
||||
fn content(&self, panel: &String) -> Option<u64> {
|
||||
match panel.as_str() {
|
||||
CANVAS => Some(super::region_versions::canvas(self.app)),
|
||||
TOOLBAR => Some(super::region_versions::toolbar(self.app)),
|
||||
id if !is_front(self.app, id) => Some(super::region_versions::hidden_panel(self.app)),
|
||||
id => Some(super::region_versions::panel(self.app, id)),
|
||||
}
|
||||
}
|
||||
|
||||
/// The canvas group is the document area: it draws its own tabs and documents in the group's rect. The toolbar's
|
||||
/// group is its rail, which takes the group's full rect and measures its height at a width.
|
||||
fn group_view(&mut self, panels: &[String], _: usize, ui: &mut egui::Ui, at: GroupAt, _: &mut BodyCx<'_>) -> Option<f32> {
|
||||
|
||||
@@ -39,7 +39,7 @@ pub fn select(app: &mut PhotocraftApp, name: &str) {
|
||||
}
|
||||
}
|
||||
if let Ok(opts) = serde_json::from_value(cur) {
|
||||
app.ui.tool_options = opts;
|
||||
*app.ui.tool_options = opts;
|
||||
}
|
||||
}
|
||||
// As the options bar does: a crop preset's ratio (or W x H) fits the frame at once.
|
||||
@@ -132,7 +132,7 @@ mod tests {
|
||||
let mut flipped = serde_json::to_value(&app.ui.tool_options).unwrap();
|
||||
flip_bools(&mut flipped);
|
||||
flipped["feather"] = json!(0.0);
|
||||
app.ui.tool_options = serde_json::from_value(flipped.clone()).unwrap();
|
||||
*app.ui.tool_options = serde_json::from_value(flipped.clone()).unwrap();
|
||||
select(&mut app, &name);
|
||||
let after = serde_json::to_value(&app.ui.tool_options).unwrap();
|
||||
assert_eq!(after["feather"], json!(5.0));
|
||||
|
||||
@@ -58,19 +58,20 @@ fn kind_label(layer: &Layer) -> String {
|
||||
/// mask targets, the layer the panel was opened for) keys the inspector, so a field's typing or
|
||||
/// scrub state stays with its layer.
|
||||
pub(super) fn panel(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
// A run that shows no adjustment session ends the one kept (`PhotocraftApp::properties_hidden`).
|
||||
app.properties_tracked = false;
|
||||
body(app, ui);
|
||||
if !app.properties_tracked {
|
||||
// A run that shows no adjustment layer's controls ends the Reset session kept (`PhotocraftApp::properties_hidden`).
|
||||
// What the run shows decides, not whether the controls' code ran: a pass that reuses the inspector's measurement
|
||||
// runs none of its content.
|
||||
if !body(app, ui) {
|
||||
app.properties_hidden = app.properties_hidden.saturating_add(2);
|
||||
}
|
||||
}
|
||||
|
||||
fn body(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
/// The panel's inspector; whether it shows an adjustment layer's controls.
|
||||
fn body(app: &mut PhotocraftApp, ui: &mut egui::Ui) -> bool {
|
||||
let inspector = Inspector::new(tl!("Properties")).empty(tl!("No properties"));
|
||||
let Some(st) = app.session.active() else {
|
||||
inspector.show(ui, |_, _| {});
|
||||
return;
|
||||
return false;
|
||||
};
|
||||
let doc = st.doc.clone();
|
||||
let active = st.active_layer;
|
||||
@@ -85,6 +86,7 @@ fn body(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
_ if crate::doc_props_ui::shows_document(&doc, active) => Body::Document,
|
||||
_ => Body::Layer,
|
||||
};
|
||||
let adjustment = shown == Body::Layer && layer.is_some_and(|l| matches!(l.content, LayerContent::Adjustment(_)));
|
||||
let mut inspector = inspector.target(target);
|
||||
// The Document properties are headed by the document, as production's panel is.
|
||||
inspector = match layer {
|
||||
@@ -108,6 +110,7 @@ fn body(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
Body::Layer => layer_body(app, ui, layer),
|
||||
}
|
||||
});
|
||||
adjustment
|
||||
}
|
||||
|
||||
/// The document's properties, with Align and Distribute above them while several layers are selected.
|
||||
|
||||
@@ -1,49 +1,20 @@
|
||||
//! The shell's title bar and options bar and every docked panel body as memoized views (#16118). The shell runs a slot
|
||||
//! every pass and the dock a panel body, and leave memoizing to the app; each reads the whole app, so it is a `MemoView`
|
||||
//! whose key is a version of what it shows: while the version is the same and no input reaches the slot, the frame adds
|
||||
//! its last run again instead of running every control in it. The status bar is a memoized view of its own
|
||||
//! (`status_bar::StatusProps`), over the values it shows. A version covers the app data its slot shows that can change while no
|
||||
//! input reaches the slot: what a command changes, the active document and layer and the tool in every version; what
|
||||
//! the slot shows of the canvas view, a job or the brush and colours; and what an edit elsewhere changes without a
|
||||
//! command, such as a box or pin dragged on the canvas. Input inside a slot runs it whatever its version, and so does a
|
||||
//! repaint it asks for itself.
|
||||
//! The versions of what the shell's slots, the docked panels and the document area show (#16118). The shell replays
|
||||
//! a slot, and PhotoCraft's views a panel body or the document area, while its version holds and no input reaches it:
|
||||
//! the frame adds its last run again instead of running every control in it. The title bar, the options bar and the
|
||||
//! status bar are the shell's versioned slots ([`title_bar`], [`options_bar`], [`status_bar`]); each panel body and
|
||||
//! the document area is a `MemoView` whose key is its version. A version covers the app data its region shows that
|
||||
//! can change while no input reaches the region: what a command changes, the active document and layer and the tool in
|
||||
//! every version; what the region shows of the canvas view, a job or the brush and colours; and what an edit elsewhere
|
||||
//! changes without a command, such as a box or pin dragged on the canvas. Input inside a region runs it whatever its
|
||||
//! version, and so does a repaint it asks for itself.
|
||||
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
use craft::ui::contract::{MemoProps, MemoView};
|
||||
use craft::ui::contract::{MemoKey, MemoProps, MemoView};
|
||||
|
||||
use super::PhotocraftApp;
|
||||
use crate::color_picker_ui::PickWindow;
|
||||
|
||||
/// The props of a shell slot's view: the app the slot reads, which its version stands for. One type per slot, so a
|
||||
/// trial and the frame's memo log tell the views apart.
|
||||
macro_rules! slot_props {
|
||||
($($name:ident: $what:literal),*) => {$(
|
||||
#[doc = concat!("The ", $what, "'s view: the app it reads, which its version stands for.")]
|
||||
#[derive(MemoProps)]
|
||||
struct $name<'a> {
|
||||
version: u64,
|
||||
#[memo_props(covered_by = "version", reason = "the slot's version holds everything the slot shows of the app")]
|
||||
app: &'a mut PhotocraftApp,
|
||||
}
|
||||
)*};
|
||||
}
|
||||
slot_props!(TitleSlot: "title bar", OptionsSlot: "options bar");
|
||||
|
||||
/// The title bar in its slot, replaying while [`title_bar`]'s version holds.
|
||||
pub(crate) fn show_title_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
let version = title_bar(app);
|
||||
let _ = MemoView::new("photocraft.title_bar", TitleSlot { version, app }, |slot: &mut TitleSlot<'_>, ui: &mut egui::Ui| super::title_bar(slot.app, ui))
|
||||
.show(ui);
|
||||
}
|
||||
|
||||
/// The options bar in its slot, replaying while [`options_bar`]'s version holds.
|
||||
pub(crate) fn show_options_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
let version = options_bar(app);
|
||||
let _ =
|
||||
MemoView::new("photocraft.options_bar", OptionsSlot { version, app }, |slot: &mut OptionsSlot<'_>, ui: &mut egui::Ui| super::options_bar(slot.app, ui))
|
||||
.show(ui);
|
||||
}
|
||||
use crate::state::Tool;
|
||||
|
||||
/// A docked panel's body: the panel and the app it reads, which its version stands for.
|
||||
#[derive(MemoProps)]
|
||||
@@ -65,22 +36,34 @@ pub(crate) fn show_panel(app: &mut PhotocraftApp, ui: &mut egui::Ui, id: &str) {
|
||||
/// The version of the options bar: every tool option (`app.ui.tool_options`, all of which the bar shows; keys, the
|
||||
/// canvas menu, the canvas and its task bars, panels and presets write them without a command), the commit and cancel
|
||||
/// cells and hints of an edit the canvas opens or ends ([`options_bar::edit_key`](super::options_bar::edit_key)), the
|
||||
/// Zoom tool's view, an open Free Transform, Puppet Warp or Perspective Warp, which shows its own members in place
|
||||
/// Zoom and Rotate View tools' zoom and rotation ([`bar_view`]), an open Free Transform, Puppet Warp or Perspective Warp, which shows its own members in place
|
||||
/// of the tool's, with what a drag on the canvas changes (the box, the picked pin, the planes; Escape ends them without
|
||||
/// a command, #15547), the Crop tool's frame state, the type members' caret or selection, the brush and its presets, the
|
||||
/// colours, and the vector bar's "Make" row's own two ingredients: the Pen draft's anchor count and the Work Path the
|
||||
/// a command, #15547), the Crop tool's frame state, the type members' caret or selection and the font families they
|
||||
/// list ([`families_key`](crate::type_tool::families_key)), the brush and its presets, the colours, and the vector bar's "Make" row's own two ingredients: the Pen draft's anchor count and the Work Path the
|
||||
/// app hides (#12892), which a Pen drawing click by click changes with no History step (#12890). Which path is
|
||||
/// selected is already in [`version`]; the hidden path is held as its document's place, since its content can only
|
||||
/// change with the document's revision, which `version` holds too.
|
||||
pub(crate) fn options_bar(app: &PhotocraftApp) -> u64 {
|
||||
let sessions =
|
||||
(crate::transform_tool::bar_key(app), crate::puppet_ui::bar_key(app), crate::perspective_ui::bar_key(app), crate::crop_ui::bar::bar_key(app));
|
||||
let shown = (serialized(&app.ui.tool_options), super::options_bar::edit_key(app), text_target(app));
|
||||
let shown = (app.ui.tool_options.revision(), super::options_bar::edit_key(app), text_target(app), crate::type_tool::families_key());
|
||||
// A canvas gesture's start and end change what the bar enables (the symmetry menu's Transform entry).
|
||||
let gesture = crate::canvas::tools::in_gesture(app);
|
||||
let hidden = app.session.active().map(|st| (st.doc.id.0, app.ui.hidden_work_path.as_ref().map(|(id, _)| *id)));
|
||||
let paths = (app.ui.pen.as_ref().map(|p| p.draft.knots.len()), hidden);
|
||||
version(app, (view(app), sessions, shown, brush(app), colours(app), gesture, paths))
|
||||
version(app, (bar_view(app), sessions, shown, brush(app), colours(app), gesture, paths))
|
||||
}
|
||||
|
||||
/// The version of the status bar: the readout's item and the zoom of the active canvas, the status message, the
|
||||
/// render-path note, and the background redraw's and the job's progress. The readout's document values follow the
|
||||
/// active document and its revision and name the tool, which every version holds; the language its labels are in
|
||||
/// reaches the slot's view through its place.
|
||||
pub(crate) fn status_bar(app: &PhotocraftApp) -> u64 {
|
||||
let item = MemoKey::of(&super::chrome_ui::status_item(&app.ui.chrome));
|
||||
let zoom = crate::canvas::active_view(app).map(|view| view.zoom.to_bits());
|
||||
let message = (&app.ui.status, app.ui.status_error);
|
||||
let progress = MemoKey::of(&(crate::background_redraw::progress(app), crate::jobs_ui::status_job(app).map(|(_, progress)| progress)));
|
||||
version(app, (item, zoom, message, super::chrome_ui::render_path_label(app), progress))
|
||||
}
|
||||
|
||||
/// The version of the toolbar's footer: the colour chips' two colours, whether the active document is in Quick Mask and
|
||||
@@ -91,6 +74,13 @@ pub(crate) fn toolbar_footer(app: &PhotocraftApp) -> u64 {
|
||||
version(app, (colours(app), quick_mask, app.ui.view.screen_mode))
|
||||
}
|
||||
|
||||
/// The version of the toolbar's group view, which the dock keys the toolbar's column by: the rail's slots (in the
|
||||
/// preferences, which [`version`] holds with the tool), the tools its groups remember, whether the Edit Toolbar drawer
|
||||
/// is open, and what the footer shows ([`toolbar_footer`]).
|
||||
pub(crate) fn toolbar(app: &PhotocraftApp) -> u64 {
|
||||
version(app, (toolbar_footer(app), &app.ui.group_tools, app.ui.toolbar_drawer))
|
||||
}
|
||||
|
||||
/// The version of the title bar: the title it shows (the active document's name and its unsaved mark), the language
|
||||
/// its menu titles are in, whether the menus are in the bar (not in the macOS menu bar) and whether the bar takes the
|
||||
/// menu keys (F10, Alt, Alt+letter), which a dialog or the shortcut recorder holds back: a dialog closed with Escape
|
||||
@@ -115,7 +105,8 @@ pub(crate) fn title_bar(app: &PhotocraftApp) -> u64 {
|
||||
/// colours, and so do Properties (a shape layer's fill and stroke swatches, a gradient fill's Foreground and
|
||||
/// Background stops, the adjustment editors' swatches) and Character (the colour of new type is the foreground).
|
||||
/// Character and Paragraph show the type defaults, and they and Properties the values at the caret or selection of the
|
||||
/// type being edited, which Glyphs inserts at. Every other panel shows only what every version holds.
|
||||
/// type being edited, which Glyphs inserts at; Character, Properties and Glyphs list the font families
|
||||
/// ([`families_key`](crate::type_tool::families_key)). Every other panel shows only what every version holds.
|
||||
pub(crate) fn panel(app: &PhotocraftApp, id: &str) -> u64 {
|
||||
match id {
|
||||
"navigator" => version(app, (view(app), adjustment_preview(app))),
|
||||
@@ -130,17 +121,25 @@ pub(crate) fn panel(app: &PhotocraftApp, id: &str) -> u64 {
|
||||
}
|
||||
"cloneSource" => version(app, app.ui.presets_ui.clone_cursor.map(|(document, at)| (document, at.map(f64::to_bits)))),
|
||||
"modifierKeys" => version(app, app.ui.shell.latched),
|
||||
"properties" => version(app, (crate::color_picker_ui::window_picker_state(app, PickWindow::Properties), colours(app), text_target(app))),
|
||||
"properties" => version(
|
||||
app,
|
||||
(crate::color_picker_ui::window_picker_state(app, PickWindow::Properties), colours(app), text_target(app), crate::type_tool::families_key()),
|
||||
),
|
||||
"brushSettings" | "brushes" => version(app, brush(app)),
|
||||
"histogram" => version(app, (adjustment_preview(app), histograms(app))),
|
||||
"character" => version(app, (colours(app), type_defaults(app), text_target(app))),
|
||||
"character" => version(app, (colours(app), type_defaults(app), text_target(app), crate::type_tool::families_key())),
|
||||
"paragraph" => version(app, (type_defaults(app), text_target(app))),
|
||||
"glyphs" => version(app, text_target(app)),
|
||||
"glyphs" => version(app, (text_target(app), crate::type_tool::families_key())),
|
||||
"color" | "swatches" | "gradients" | "gradientEditor" => version(app, colours(app)),
|
||||
_ => version(app, ()),
|
||||
}
|
||||
}
|
||||
|
||||
/// The version of a panel in the dock whose body does not show: its title and icon, which every version holds.
|
||||
pub(crate) fn hidden_panel(app: &PhotocraftApp) -> u64 {
|
||||
version(app, ())
|
||||
}
|
||||
|
||||
/// What every slot may show, joined with `extra`: the commands run (any of them may change anything), the active
|
||||
/// document, its revision, its active layers and which part of them is targeted (the layer mask, the vector mask, a
|
||||
/// filter mask, the selected path; the Layers, Channels, Paths and Properties panels and the canvas set it without a
|
||||
@@ -148,7 +147,7 @@ pub(crate) fn panel(app: &PhotocraftApp, id: &str) -> u64 {
|
||||
/// or `prefs.edit`, not as a counted command: units, the language, toolbar slots).
|
||||
/// Whether running command `id` leaves every settling region's version as it is: a view command (zoom, fit, print size,
|
||||
/// rotate) changes only the canvas view, which every region that shows it holds in its version (the Navigator, the Info
|
||||
/// panel and the options bar through [`view`], the status bar in its own props), so it need not count as a command run
|
||||
/// panel and the options bar through [`view`] and [`bar_view`], the status bar in its own props), so it need not count as a command run
|
||||
/// and run every panel body in the next frame (#15493). While an action is recorded it counts: the Actions panel lists
|
||||
/// the step it records.
|
||||
pub(crate) fn changes_only_the_view(app: &PhotocraftApp, id: &str) -> bool {
|
||||
@@ -158,7 +157,7 @@ pub(crate) fn changes_only_the_view(app: &PhotocraftApp, id: &str) -> bool {
|
||||
fn version(app: &PhotocraftApp, extra: impl Hash) -> u64 {
|
||||
let mut hasher = std::collections::hash_map::DefaultHasher::new();
|
||||
app.commands_run.hash(&mut hasher);
|
||||
app.session.prefs.rev().hash(&mut hasher);
|
||||
app.session.prefs.settings_rev().hash(&mut hasher);
|
||||
app.session.active_generation().hash(&mut hasher);
|
||||
app.session.active_layer_changes().hash(&mut hasher);
|
||||
app.session.active().map(|st| st.revision).hash(&mut hasher);
|
||||
@@ -182,7 +181,7 @@ fn serialized(value: &impl serde::Serialize) -> u64 {
|
||||
}
|
||||
}
|
||||
let mut hasher = std::collections::hash_map::DefaultHasher::new();
|
||||
// Writing to a hasher cannot fail, and every tool option serializes (they are saved).
|
||||
// Writing to a hasher cannot fail, and the state it hashes serializes (it is saved).
|
||||
let _ = serde_json::to_writer(HashWriter(&mut hasher), value);
|
||||
hasher.finish()
|
||||
}
|
||||
@@ -226,19 +225,127 @@ fn colours(app: &PhotocraftApp) -> [u32; 8] {
|
||||
bits
|
||||
}
|
||||
|
||||
/// The part of the active document's view the options bar shows: the Zoom tool's bar the zoom, the Rotate View tool's
|
||||
/// the rotation, every other tool's none (the Hand tool's bar has no view field).
|
||||
fn bar_view(app: &PhotocraftApp) -> Option<u64> {
|
||||
let view = crate::canvas::active_view(app)?;
|
||||
match app.ui.tool {
|
||||
Tool::Zoom => Some(view.zoom.to_bits()),
|
||||
Tool::RotateView => Some(view.rotation.to_bits()),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// The active document's view as the canvas showed it: its zoom, centre and turn.
|
||||
fn view(app: &PhotocraftApp) -> Option<[u64; 5]> {
|
||||
crate::canvas::active_view(app)
|
||||
.map(|view| [view.zoom.to_bits(), view.center.x.to_bits(), view.center.y.to_bits(), view.rotation.to_bits(), u64::from(view.flip_x)])
|
||||
}
|
||||
|
||||
/// The document area's props: the app it reads, which [`canvas`] stands for.
|
||||
#[derive(MemoProps)]
|
||||
struct CanvasSlot<'a> {
|
||||
version: u64,
|
||||
#[memo_props(covered_by = "version", reason = "the canvas version holds everything the document area shows of the app")]
|
||||
app: &'a mut PhotocraftApp,
|
||||
#[memo_props(covered_by = "version", reason = "the document area's one drawing function, the same in every pass")]
|
||||
show: fn(&mut PhotocraftApp, &mut egui::Ui),
|
||||
}
|
||||
|
||||
/// The document area's tabs and documents in `ui`, replaying while [`canvas`] holds. `show` draws them; the per-pass
|
||||
/// work around them runs before, outside the view (`canvas::document_area`).
|
||||
pub(crate) fn show_canvas(app: &mut PhotocraftApp, ui: &mut egui::Ui, show: fn(&mut PhotocraftApp, &mut egui::Ui)) {
|
||||
let version = canvas(app);
|
||||
let _ = MemoView::new("photocraft.canvas", CanvasSlot { version, app, show }, |slot: &mut CanvasSlot<'_>, ui: &mut egui::Ui| (slot.show)(slot.app, ui))
|
||||
.show(ui);
|
||||
}
|
||||
|
||||
/// The version of the document area, which keys its view and, through `DockPanels::content`, the docked tree it sits
|
||||
/// in. It holds what the tabs and every shown canvas draw that can change while no input reaches the area and its run
|
||||
/// asked for no pass: what every slot holds ([`version`]); each document's revision and unsaved mark (the tabs, the
|
||||
/// arranged panes); each view as stored, with the view commands queued for its next pass and a zoom ease asked; the
|
||||
/// document windows, the arrangement and its dividers; the View menu's options and the panels shown (the scroll bars
|
||||
/// go with the screen mode); the tool options and the on-canvas state of the tools (a transform box, a crop frame and whether its crop is pending, a pen draft, the
|
||||
/// type caret, a picked guide, the samplers, slices, frames and artboards), whose drags and keys change them without a
|
||||
/// command; the canvas menu and where the Brush Preset picker is open; whether a dialog is open (it holds back the tools and the task bars); the Layers panel's hovered layer, which the Move tool outlines; the previews a dialog or a panel drag shows
|
||||
/// on the canvas (an adjustment's live values, a filter's or Levels' preview, Color Range's mask); the opening files
|
||||
/// and their progress; the Batch input shown in place of the documents; the display the window is on; and the blocks a background redraw has landed
|
||||
/// (`background_redraw::poll`). A run that waits for work of its own (a preview worker, a tile stream) asks for its
|
||||
/// next pass through the framework, which runs the view then.
|
||||
pub(crate) fn canvas(app: &PhotocraftApp) -> u64 {
|
||||
let ui = &app.ui;
|
||||
let documents: Vec<(u64, u64, bool)> = app.session.documents().iter().map(|st| (st.doc.id.0, st.revision, st.is_dirty())).collect();
|
||||
let views: Vec<_> = ui.views.iter().chain(ui.window_views.values()).map(view_key).collect();
|
||||
let windows = serialized(&(&ui.view, &ui.panels, &ui.windows, &ui.document_windows, &ui.split_at));
|
||||
let tools = serialized(&(
|
||||
&ui.brush_tool,
|
||||
&ui.cam_transform,
|
||||
&ui.transform,
|
||||
&ui.symmetry_transform,
|
||||
&ui.layer_picker,
|
||||
(&ui.clone_source, &ui.clone_offset, &ui.pattern_stamp_phase),
|
||||
(&ui.canvas_tool_menu, &ui.brush_picker),
|
||||
&ui.selected_guide,
|
||||
&ui.direct_selection,
|
||||
&ui.hidden_work_path,
|
||||
(&ui.analysis, &ui.slices, &ui.frame_tool, &ui.artboard_tool),
|
||||
));
|
||||
let sessions =
|
||||
(crate::transform_tool::bar_key(app), crate::puppet_ui::bar_key(app), crate::perspective_ui::bar_key(app), crate::crop_ui::bar::bar_key(app));
|
||||
let crop = app.canvas_tools.crop.tool.frame().map(|frame| [frame.rect.x0, frame.rect.y0, frame.rect.x1, frame.rect.y1, frame.angle].map(f64::to_bits));
|
||||
let task_bars = (
|
||||
crate::transform_task_bar::eligible(app),
|
||||
crate::crop_task_bar::eligible(app),
|
||||
crate::crop_ui::pending(app),
|
||||
app.canvas_tools.crop.tool.straighten_armed(),
|
||||
);
|
||||
let editing = (text_target(app), ui.pen.as_ref().map(|p| p.draft.knots.len()), crate::canvas::tools::in_gesture(app), crop, task_bars);
|
||||
let previews = (
|
||||
adjustment_preview(app),
|
||||
crate::canvas::filter_preview::canvas_key(app),
|
||||
crate::levels_clipping::canvas_key(app),
|
||||
crate::color_range_ui::canvas_key(app),
|
||||
);
|
||||
let opening: Vec<_> = crate::jobs_ui::open_tabs(app).into_iter().map(|(job, _, fraction)| (job, fraction.map(f32::to_bits))).collect();
|
||||
let display = crate::monitor_status::view_display(app, app.ctx());
|
||||
// The open Brush Preset picker lists the presets and shows the brush.
|
||||
let picker = ui.brush_picker.map(|_| brush(app));
|
||||
let gpu = app.gpu.as_ref().map(|gpu| gpu.canvas_budget());
|
||||
version(
|
||||
app,
|
||||
(
|
||||
documents,
|
||||
views,
|
||||
(windows, ui.tool_options.revision(), tools, picker),
|
||||
sessions,
|
||||
editing,
|
||||
previews,
|
||||
(app.hover_layer, app.dialog_open(), app.jobs.focus, opening, crate::jobs_ui::batch_preview_key(app), display, gpu, app.redraw_landed),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
/// A view as its canvas shows it next: the camera, the document size it last showed, how many view commands wait for
|
||||
/// its next pass (only that pass drains them) and a zoom ease asked.
|
||||
fn view_key(view: &crate::state::View) -> impl Hash + '_ {
|
||||
let bits = |[x, y]: [f32; 2]| [x.to_bits(), y.to_bits()];
|
||||
(
|
||||
[view.zoom.to_bits(), view.rotation.to_bits()],
|
||||
bits(view.center),
|
||||
view.doc_size,
|
||||
view.pending.len(),
|
||||
view.zoom_animating,
|
||||
view.zoom_anchor.map(|(doc, screen)| (doc.map(f64::to_bits), bits(screen))),
|
||||
view.zoom_from.map(|(zoom, center)| (zoom.to_bits(), bits(center))),
|
||||
)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::state::Tool;
|
||||
|
||||
/// The brush, the colours, the type defaults, the tool options, the type caret, the Move tool's rollover and an
|
||||
/// adjustment's live preview move the versions of the bars and panels that show them and of no other, so a drag that
|
||||
/// The brush, the colours, the type defaults, the tool options, the type caret, the Move tool's rollover, an
|
||||
/// adjustment's live preview and the status message move the versions of the bars and panels that show them and of no other, so a drag that
|
||||
/// edits one leaves the rest replaying; a version that missed one would replay a stale bar or panel.
|
||||
#[test]
|
||||
fn what_a_region_shows_moves_only_its_version() {
|
||||
@@ -264,7 +371,7 @@ mod tests {
|
||||
.into_iter()
|
||||
.map(|id| (id, panel(app, id)))
|
||||
.collect();
|
||||
all.extend([("optionsBar", options_bar(app)), ("titleBar", title_bar(app))]);
|
||||
all.extend([("optionsBar", options_bar(app)), ("titleBar", title_bar(app)), ("statusBar", status_bar(app))]);
|
||||
all
|
||||
};
|
||||
let moved = |app: &mut PhotocraftApp, change: &dyn Fn(&mut PhotocraftApp)| -> Vec<&'static str> {
|
||||
@@ -302,6 +409,7 @@ mod tests {
|
||||
app.doc_hist = Some(crate::histogram_panel::PanelHist { key, at: 30.0, hist: Default::default() });
|
||||
});
|
||||
assert_eq!(landed, ["histogram"], "a histogram the worker landed");
|
||||
assert_eq!(moved(&mut app, &|app| app.ui.status = "Saved".into()), ["statusBar"], "a status message");
|
||||
}
|
||||
|
||||
/// Opening or closing a layer's effects list or a group is view state off the document's revision, and a command
|
||||
|
||||
@@ -40,8 +40,9 @@ struct StatusProps<'a> {
|
||||
values: StatusValues,
|
||||
item: StatusItem,
|
||||
document: Option<Size>,
|
||||
/// The active document's main canvas as its last pass showed it; a document not yet shown has no readout.
|
||||
view: Option<CanvasView>,
|
||||
/// The zoom of the active document's main canvas as its last pass showed it, the one view field the readout shows
|
||||
/// (a pan leaves it as it is); a document not yet shown has no readout.
|
||||
zoom: Option<f64>,
|
||||
message: Option<StatusMessage>,
|
||||
out: Outbox<'a, StatusEvent>,
|
||||
}
|
||||
@@ -59,8 +60,8 @@ struct TrailingProps<'a> {
|
||||
enum StatusEvent {
|
||||
/// The readout's item was picked.
|
||||
Item(StatusItem),
|
||||
/// The zoom field edited the view.
|
||||
View(CanvasView),
|
||||
/// The zoom field set the zoom, about the view's centre.
|
||||
Zoom(f64),
|
||||
/// The zoom field cut an entry to its range.
|
||||
InvalidZoom(InvalidZoom),
|
||||
/// The job's Cancel was clicked.
|
||||
@@ -69,15 +70,16 @@ enum StatusEvent {
|
||||
|
||||
/// The status bar, in the shell's status slot: the zoom readout of the active document and the latest status
|
||||
/// message, and at the far end the render-path note, the background redraw and the background jobs' progress with
|
||||
/// Cancel (#210). The body and the trailing group are a memoized view each, so a frame where neither changed replays
|
||||
/// them. The bar itself stays the slot's direct child: it fills the slot's height and centres its content there, where
|
||||
/// a memoized view around it would be moved down onto the slot row's line and clipped at the window's bottom edge.
|
||||
/// Cancel (#210). The slot replays while `region_versions::status_bar` holds; when it runs, the body and the trailing
|
||||
/// group are a memoized view each, so a frame that changed only one runs only that one. The bar itself stays the slot
|
||||
/// pane's direct child: it fills the slot's height and centres its content there, where a memoized view around it
|
||||
/// would be moved down onto the slot row's line and clipped at the window's bottom edge.
|
||||
pub fn status_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
let job = crate::jobs_ui::status_job(app);
|
||||
let values = chrome_ui::status_values(app);
|
||||
let item = chrome_ui::status_item(&app.ui.chrome);
|
||||
let document = app.session.active().map(|st| Size::new(st.doc.size.width as f64, st.doc.size.height as f64));
|
||||
let view = crate::canvas::active_view(app);
|
||||
let zoom = crate::canvas::active_view(app).map(|view| view.zoom);
|
||||
let message =
|
||||
(!app.ui.status.is_empty()).then(|| StatusMessage::new(app.ui.status.clone()).tone(if app.ui.status_error { Tone::Warn } else { Tone::Neutral }));
|
||||
let render_path = chrome_ui::render_path_label(app)
|
||||
@@ -93,14 +95,14 @@ pub fn status_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
let _ = MemoView::new("status-bar-trailing", props, trailing_view).show(ui);
|
||||
})
|
||||
.show(ui, |ui, _| {
|
||||
let props = StatusProps { values: values.clone(), item, document, view, message: message.clone(), out: Outbox::new(&mut body_sent) };
|
||||
let props = StatusProps { values: values.clone(), item, document, zoom, message: message.clone(), out: Outbox::new(&mut body_sent) };
|
||||
let _ = MemoView::new("status-bar", props, body_view).show(ui);
|
||||
});
|
||||
let (mut picked, mut edited, mut invalid_zoom, mut cancelled) = (None, None, None, false);
|
||||
for event in body_sent.into_iter().chain(trailing_sent) {
|
||||
match event {
|
||||
StatusEvent::Item(item) => picked = Some(item),
|
||||
StatusEvent::View(new) => edited = Some(new),
|
||||
StatusEvent::Zoom(new) => edited = Some(new),
|
||||
StatusEvent::InvalidZoom(invalid) => invalid_zoom = Some(invalid),
|
||||
StatusEvent::CancelJob => cancelled = true,
|
||||
}
|
||||
@@ -108,11 +110,11 @@ pub fn status_bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
if let Some(picked) = picked {
|
||||
chrome_ui::set_status_item(&mut app.ui.chrome, picked);
|
||||
}
|
||||
if let Some(new) = edited
|
||||
if let Some(zoom) = edited
|
||||
&& let Some(i) = app.session.active_index()
|
||||
{
|
||||
let ppp = app.canvas_ppp();
|
||||
app.ui.views[i].set_from(&new, ppp);
|
||||
app.ui.views[i].set_zoom(zoom, ppp);
|
||||
}
|
||||
if cancelled && let Some((id, _)) = &job {
|
||||
crate::jobs_ui::cancel(app, *id);
|
||||
@@ -151,14 +153,14 @@ fn body_view(props: &mut StatusProps<'_>, ui: &mut egui::Ui) {
|
||||
|
||||
/// The members of the status bar's body: the readout, or "No document", and the status message.
|
||||
fn body_members(props: &mut StatusProps<'_>, ui: &mut egui::Ui) {
|
||||
match (props.document, props.view) {
|
||||
(Some(size), Some(view)) => {
|
||||
let out = StatusReadout::new(Bind::given(view), size, props.item, &props.values).show(ui);
|
||||
match (props.document, props.zoom) {
|
||||
(Some(size), Some(zoom)) => {
|
||||
let out = StatusReadout::new(Bind::given(zoom), size, props.item, &props.values).show(ui);
|
||||
if let Some(picked) = out.item {
|
||||
props.out.send(StatusEvent::Item(picked));
|
||||
}
|
||||
if let Some(view) = out.view.value().copied() {
|
||||
props.out.send(StatusEvent::View(view));
|
||||
if let Some(zoom) = out.zoom_edits.value() {
|
||||
props.out.send(StatusEvent::Zoom(*zoom));
|
||||
}
|
||||
if let Some(invalid) = out.invalid_zoom {
|
||||
props.out.send(StatusEvent::InvalidZoom(invalid));
|
||||
@@ -186,9 +188,13 @@ pub(crate) fn document_window_status(app: &mut PhotocraftApp, ui: &mut egui::Ui,
|
||||
let (mut picked, mut edited, mut invalid_zoom) = (None, None, None);
|
||||
Bar::new("", BarKind::Status).show(ui, |ui, _| {
|
||||
if let (Some(size), Some(view)) = (size, view) {
|
||||
let out = StatusReadout::new(Bind::given(view), size, item, &values).show(ui);
|
||||
let out = StatusReadout::new(Bind::given(view.zoom), size, item, &values).show(ui);
|
||||
picked = out.item;
|
||||
edited = out.view.value().copied();
|
||||
edited = out.zoom_edits.value().map(|zoom| {
|
||||
let mut zoomed = view;
|
||||
zoomed.zoom = *zoom;
|
||||
zoomed
|
||||
});
|
||||
invalid_zoom = out.invalid_zoom;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ fn harness() -> Harness<'static, Box<PhotocraftApp>> {
|
||||
if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
|
||||
@@ -22,7 +22,7 @@ fn harness() -> Harness<'static, Box<PhotocraftApp>> {
|
||||
if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
|
||||
@@ -862,7 +862,7 @@ fn restart_cases() -> Vec<Case> {
|
||||
assert_eq!(stored["selectedTool"], json!("Eraser"));
|
||||
assert_eq!(app.ui.tool, Tool::Eraser, "restored before the first frame");
|
||||
assert_eq!(app.ui.group_tool(Tool::Eraser.key()), Some(Tool::Eraser));
|
||||
assert_eq!(app.ui.tool_options, crate::state::ToolOptions::default());
|
||||
assert_eq!(*app.ui.tool_options, crate::state::ToolOptions::default());
|
||||
}),
|
||||
},
|
||||
Case {
|
||||
@@ -1106,7 +1106,7 @@ fn damaged_cases() -> (Vec<Loaded>, Vec<Case>) {
|
||||
},
|
||||
));
|
||||
cases.push(loaded("tool options: a good value is left alone", json!({"toolOptions": {"feather": 12.5}}), move |app| {
|
||||
assert_eq!(app.ui.tool_options, crate::state::ToolOptions { feather: 12.5, ..d() });
|
||||
assert_eq!(*app.ui.tool_options, crate::state::ToolOptions { feather: 12.5, ..d() });
|
||||
let mut def = d();
|
||||
crate::tool_memory::sanitize(&mut def);
|
||||
assert_eq!(def, d(), "in-range defaults never change");
|
||||
@@ -1436,7 +1436,7 @@ fn reset_tools_clear_the_remembered_options_and_brushes() {
|
||||
|brushes: &[(Tool, photocraft_engine::BrushSettings)]| brushes.iter().all(|(t, b)| *b == crate::paint_mouse::fresh_brush(*t, b) && b.size != 77.0);
|
||||
assert!(starting(&app.ui.tool_brushes), "{saved}");
|
||||
let app2 = app_on(&store);
|
||||
assert_eq!(app2.ui.tool_options, crate::state::ToolOptions::default());
|
||||
assert_eq!(*app2.ui.tool_options, crate::state::ToolOptions::default());
|
||||
assert!(!app2.ui.tool_brushes.is_empty() && starting(&app2.ui.tool_brushes), "remembered across a restart");
|
||||
}
|
||||
|
||||
|
||||
@@ -337,8 +337,8 @@ pub struct UiState {
|
||||
/// Frame tool (see `frame_tool`).
|
||||
#[serde(default)]
|
||||
pub frame_tool: crate::frame_tool::FrameToolUi,
|
||||
/// The contextual task bar as drawn in the last frame: its screen rect `[x0, y0, x1, y1]` in
|
||||
/// points, `None` while no bar shows (`ui.inspect` › `taskBar`).
|
||||
/// The contextual crop task bar as the last canvas run drew it: its screen rect `[x0, y0, x1, y1]`
|
||||
/// in points, `None` while no bar shows (`ui.inspect` › `taskBar`).
|
||||
#[serde(skip)]
|
||||
pub task_bar_shown: Option<[f32; 4]>,
|
||||
/// Artboard tool (see `artboard_tool`).
|
||||
@@ -422,7 +422,7 @@ pub struct UiState {
|
||||
#[serde(default)]
|
||||
pub selection_mode: u8,
|
||||
#[serde(default)]
|
||||
pub tool_options: ToolOptions,
|
||||
pub tool_options: Tracked<ToolOptions>,
|
||||
/// The shape Fill / Stroke swatches' recently used gradients, newest first (the Gradient
|
||||
/// tab's Recent row).
|
||||
#[serde(default)]
|
||||
@@ -546,7 +546,7 @@ impl Default for UiState {
|
||||
brush_curves_open: BTreeSet::new(),
|
||||
brushes_panel: brushes_list(),
|
||||
selection_mode: 0,
|
||||
tool_options: ToolOptions::default(),
|
||||
tool_options: Tracked::new(ToolOptions::default()),
|
||||
recent_gradients: Vec::new(),
|
||||
next_id: 1,
|
||||
status: String::new(),
|
||||
@@ -599,7 +599,7 @@ mod tests {
|
||||
let mut s = SampleAllLayers::default();
|
||||
assert!(s.slot(Tool::Brush).is_none());
|
||||
for t in [Tool::MagicWand, Tool::PaintBucket, Tool::Blur, Tool::Sharpen, Tool::Smudge, Tool::Remove] {
|
||||
*s.slot(t).unwrap() = true;
|
||||
*s.slot_mut(t).unwrap() = true;
|
||||
assert!(s.get(t), "{t:?}");
|
||||
}
|
||||
assert!(!s.get(Tool::QuickSelection));
|
||||
|
||||
@@ -3,11 +3,13 @@ use craft::draw::ui::crop::{CropSettings, CropSizeFields};
|
||||
use craft::draw::ui::{PathOptionsSettings, TransformSettings, VectorMode};
|
||||
use craft::imaging::ui::select::MagneticSettings;
|
||||
|
||||
use craft::ui::contract::PlainData;
|
||||
|
||||
use super::tool::Tool;
|
||||
use super::{Deserialize, Serialize};
|
||||
|
||||
/// Object Selection › gear › Object Finder Mode (#12857).
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize, PlainData)]
|
||||
pub enum ObjectFinderMode {
|
||||
/// Auto Refresh: the finder re-analyses the document after every edit.
|
||||
#[default]
|
||||
@@ -17,7 +19,7 @@ pub enum ObjectFinderMode {
|
||||
}
|
||||
|
||||
/// Options-bar state for tools (Photoshop keeps these per tool).
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, PlainData)]
|
||||
#[serde(default)]
|
||||
pub struct ToolOptions {
|
||||
pub tolerance: f32,
|
||||
@@ -77,6 +79,7 @@ pub struct ToolOptions {
|
||||
/// parameter format. Kept as overrides so saved engine defaults still supply unset fields.
|
||||
/// OpenType features and variable-font axes are merged per tag/axis.
|
||||
#[serde(default)]
|
||||
#[plain_data(assume = "a JSON map of owned values: no interior mutability")]
|
||||
pub type_style_defaults: serde_json::Map<String, serde_json::Value>,
|
||||
/// Type tool: paragraph direction of new type, "auto" (from the first strong character),
|
||||
/// "ltr" or "rtl" (TYPE-218-2).
|
||||
@@ -380,7 +383,7 @@ pub(super) fn default_brush_tool() -> Tool {
|
||||
/// tool, all off by default except the Patch tool's Content-Aware Sample All Layers (#5524,
|
||||
/// #12125): turning it on for the Magic Wand must not leave Blur or Smudge copying the composite
|
||||
/// onto the active layer. The Mixer Brush keeps its own with the brush (`MixerSettings`).
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, PlainData)]
|
||||
#[serde(default)]
|
||||
pub struct SampleAllLayers {
|
||||
pub magic_wand: bool,
|
||||
@@ -416,29 +419,41 @@ impl Default for SampleAllLayers {
|
||||
}
|
||||
}
|
||||
|
||||
/// The field of `SampleAllLayers` that `$tool` keeps, borrowed as `$borrow`.
|
||||
macro_rules! sample_all_slot {
|
||||
($this:ident, $tool:ident, $($borrow:tt)+) => {
|
||||
Some(match $tool {
|
||||
Tool::MagicWand => $($borrow)+ $this.magic_wand,
|
||||
Tool::QuickSelection => $($borrow)+ $this.quick_selection,
|
||||
Tool::ObjectSelection => $($borrow)+ $this.object_selection,
|
||||
Tool::PaintBucket => $($borrow)+ $this.paint_bucket,
|
||||
Tool::MagicEraser => $($borrow)+ $this.magic_eraser,
|
||||
Tool::SpotHealing => $($borrow)+ $this.spot_healing,
|
||||
Tool::Patch => $($borrow)+ $this.patch,
|
||||
Tool::ContentAwareMove => $($borrow)+ $this.content_aware_move,
|
||||
Tool::Remove => $($borrow)+ $this.remove,
|
||||
Tool::Blur => $($borrow)+ $this.blur,
|
||||
Tool::Sharpen => $($borrow)+ $this.sharpen,
|
||||
Tool::Smudge => $($borrow)+ $this.smudge,
|
||||
_ => return None,
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
impl SampleAllLayers {
|
||||
/// `tool`'s setting; false for a tool without the option.
|
||||
pub fn get(mut self, tool: Tool) -> bool {
|
||||
self.slot(tool).is_some_and(|v| *v)
|
||||
pub fn get(self, tool: Tool) -> bool {
|
||||
self.slot(tool).unwrap_or(false)
|
||||
}
|
||||
|
||||
/// `tool`'s setting, or `None` for a tool without the option.
|
||||
pub fn slot(&mut self, tool: Tool) -> Option<&mut bool> {
|
||||
Some(match tool {
|
||||
Tool::MagicWand => &mut self.magic_wand,
|
||||
Tool::QuickSelection => &mut self.quick_selection,
|
||||
Tool::ObjectSelection => &mut self.object_selection,
|
||||
Tool::PaintBucket => &mut self.paint_bucket,
|
||||
Tool::MagicEraser => &mut self.magic_eraser,
|
||||
Tool::SpotHealing => &mut self.spot_healing,
|
||||
Tool::Patch => &mut self.patch,
|
||||
Tool::ContentAwareMove => &mut self.content_aware_move,
|
||||
Tool::Remove => &mut self.remove,
|
||||
Tool::Blur => &mut self.blur,
|
||||
Tool::Sharpen => &mut self.sharpen,
|
||||
Tool::Smudge => &mut self.smudge,
|
||||
_ => return None,
|
||||
})
|
||||
pub fn slot(&self, tool: Tool) -> Option<bool> {
|
||||
sample_all_slot!(self, tool, &).copied()
|
||||
}
|
||||
|
||||
/// `tool`'s setting to write, or `None` for a tool without the option.
|
||||
pub fn slot_mut(&mut self, tool: Tool) -> Option<&mut bool> {
|
||||
sample_all_slot!(self, tool, &mut)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ fn harness() -> Harness<'static, Box<PhotocraftApp>> {
|
||||
if !ctx.fonts(|f| f.families().contains(&egui::FontFamily::Name("medium".into()))) {
|
||||
return;
|
||||
}
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
@@ -356,7 +356,7 @@ fn the_stroke_trace_times_each_frame_of_a_stroke_and_ends_on_release() {
|
||||
let moves = ctx.input(|i| i.raw.events.iter().filter(|e| matches!(e, egui::Event::PointerMoved(_))).count());
|
||||
app.perf.stage.start(t0, moves);
|
||||
app.perf.stage.ui_start(t0, Some(0.004));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
app.finish_frame(&ctx, crate::gpu_canvas::now_ms() - t0);
|
||||
},
|
||||
app,
|
||||
|
||||
@@ -90,7 +90,7 @@ pub fn persist(app: &mut PhotocraftApp, ctx: &egui::Context) {
|
||||
if let Ok(now) = serde_json::to_value(tool)
|
||||
&& app.session.prefs().selected_tool != now
|
||||
{
|
||||
app.session.prefs.edit(|p| p.selected_tool = now);
|
||||
app.session.prefs.remember(|p| p.selected_tool = now);
|
||||
// prefs_ui::tick ran before the panels; ensure it can flush this new revision.
|
||||
ctx.request_repaint();
|
||||
}
|
||||
@@ -98,13 +98,13 @@ pub fn persist(app: &mut PhotocraftApp, ctx: &egui::Context) {
|
||||
persist_colors(app, ctx);
|
||||
persist_group_tools(app, ctx, tool);
|
||||
persist_brushes(app);
|
||||
if app.prefs_rt.tool_options.as_ref() == Some(&app.ui.tool_options) {
|
||||
if app.prefs_rt.tool_options.as_ref() == Some(&*app.ui.tool_options) {
|
||||
return;
|
||||
}
|
||||
app.prefs_rt.tool_options = Some(app.ui.tool_options.clone());
|
||||
app.prefs_rt.tool_options = Some((*app.ui.tool_options).clone());
|
||||
let now = changed(&app.ui.tool_options);
|
||||
if app.session.prefs().tool_options != now {
|
||||
app.session.prefs.edit(|p| p.tool_options = now);
|
||||
app.session.prefs.remember(|p| p.tool_options = now);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ fn persist_colors(app: &mut PhotocraftApp, ctx: &egui::Context) {
|
||||
photocraft_engine::prefs::stamp_tool_color_picks(&mut saved, &app.session.prefs().tool_colors);
|
||||
saved
|
||||
};
|
||||
app.session.prefs.edit(|p| p.tool_colors = photocraft_engine::prefs::ToolColors(saved));
|
||||
app.session.prefs.remember(|p| p.tool_colors = photocraft_engine::prefs::ToolColors(saved));
|
||||
// Panels and shortcuts can change colours after prefs_ui::tick already ran this frame.
|
||||
ctx.request_repaint();
|
||||
}
|
||||
@@ -289,7 +289,7 @@ fn persist_group_tools(app: &mut PhotocraftApp, ctx: &egui::Context, tool: Tool)
|
||||
if let Ok(now) = serde_json::to_value(&app.ui.group_tools)
|
||||
&& app.session.prefs().group_tools != now
|
||||
{
|
||||
app.session.prefs.edit(|p| p.group_tools = now);
|
||||
app.session.prefs.remember(|p| p.group_tools = now);
|
||||
// As for the selected tool: prefs_ui::tick ran before the panels.
|
||||
ctx.request_repaint();
|
||||
}
|
||||
@@ -322,7 +322,7 @@ fn persist_brushes(app: &mut PhotocraftApp) {
|
||||
};
|
||||
app.prefs_rt.tool_brushes = Some((owner, brushes.clone()));
|
||||
if app.session.prefs().tool_brushes != now {
|
||||
app.session.prefs.edit(|p| p.tool_brushes = now);
|
||||
app.session.prefs.remember(|p| p.tool_brushes = now);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -422,12 +422,12 @@ pub fn restore(app: &mut PhotocraftApp) {
|
||||
}
|
||||
if let Ok(mut o) = serde_json::from_value(Value::Object(cur)) {
|
||||
sanitize(&mut o);
|
||||
app.ui.tool_options = o;
|
||||
*app.ui.tool_options = o;
|
||||
}
|
||||
} else if !saved.is_null() {
|
||||
log::warn!("Preferences: the remembered tool options are not an object; using the defaults");
|
||||
}
|
||||
app.prefs_rt.tool_options = Some(app.ui.tool_options.clone());
|
||||
app.prefs_rt.tool_options = Some((*app.ui.tool_options).clone());
|
||||
restore_colors(app);
|
||||
restore_brushes(app);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
use craft::behavior::IconId;
|
||||
use craft::ui::buttons::{IconButton, ToggleButton};
|
||||
use craft::ui::choice::{Checkbox, Segmented};
|
||||
use craft::ui::contract::{Bind, Entry, Props as _, Show as _};
|
||||
use craft::ui::contract::{Bind, Entry, Props as _, Show as _, bind_tracked};
|
||||
use craft::ui::display::Divider;
|
||||
use craft::ui::pickers::Select;
|
||||
use photocraft_engine::adjustment_brush_cmds::{self as ab, ENTRIES, INDEXED_ALERT};
|
||||
@@ -152,7 +152,7 @@ pub fn options_bar(ui: &mut egui::Ui, app: &mut PhotocraftApp, tool: Tool) -> bo
|
||||
let choose = tl!("Choose an object and have the adjustment applied to it");
|
||||
IconButton::new(IconId::new("square-dashed-mouse-pointer")).label(choose).tooltip(choose).enabled(false).show(ui);
|
||||
// On, the canvas tints what the active adjustment layer's mask reveals (`raster_source::MaskTint`, #12520).
|
||||
Checkbox::new(Bind::bound(&mut app.ui.tool_options.adjustment_brush_overlay))
|
||||
Checkbox::new(bind_tracked!(app.ui.tool_options => adjustment_brush_overlay))
|
||||
.label(tl!("Overlay").to_owned())
|
||||
.tooltip(tl!("Show or hide the painted mask areas").to_owned())
|
||||
.show(ui);
|
||||
@@ -160,7 +160,7 @@ pub fn options_bar(ui: &mut egui::Ui, app: &mut PhotocraftApp, tool: Tool) -> bo
|
||||
|
||||
let mut alerts = Vec::new();
|
||||
let mut opacity = (brush.opacity * 100.0).round();
|
||||
let out = option_cells::number(tl!("Opacity:"), &mut opacity, 1.0..=100.0).whole().unit("%").show(ui);
|
||||
let out = option_cells::number(tl!("Opacity:"), Bind::bound(&mut opacity), 1.0..=100.0).whole().unit("%").show(ui);
|
||||
key = out.events.iter().find_map(|e| crate::history_keys::coalesce("brush", e)).or(key);
|
||||
brush.opacity = opacity / 100.0;
|
||||
alerts.extend(out.out_of_range);
|
||||
@@ -173,7 +173,7 @@ pub fn options_bar(ui: &mut egui::Ui, app: &mut PhotocraftApp, tool: Tool) -> bo
|
||||
key = pressure.events.iter().find_map(|e| crate::history_keys::coalesce("brush", e)).or(key);
|
||||
}
|
||||
let mut flow = brush.flow * 100.0;
|
||||
let out = option_cells::number(tl!("Flow:"), &mut flow, 1.0..=100.0).unit("%").show(ui);
|
||||
let out = option_cells::number(tl!("Flow:"), Bind::bound(&mut flow), 1.0..=100.0).unit("%").show(ui);
|
||||
key = out.events.iter().find_map(|e| crate::history_keys::coalesce("brush", e)).or(key);
|
||||
brush.flow = flow / 100.0;
|
||||
alerts.extend(out.out_of_range);
|
||||
|
||||
@@ -7,7 +7,7 @@ use craft::draw::ui::measure::{RulerBar, RulerLine};
|
||||
use craft::theme::Srgba;
|
||||
use craft::ui::buttons::{Button, IconButton, ToggleButton};
|
||||
use craft::ui::choice::Swatch;
|
||||
use craft::ui::contract::{Bind, Entry, Props as _, Show as _, ShowContainer as _};
|
||||
use craft::ui::contract::{Bind, Entry, Props as _, Show as _, ShowContainer as _, bind_tracked};
|
||||
use craft::ui::display::{Divider, Text};
|
||||
use craft::ui::form::Field;
|
||||
use craft::ui::pickers::Select;
|
||||
@@ -161,8 +161,8 @@ fn count(app: &mut PhotocraftApp, ui: &mut egui::Ui, doc: &photocraft_doc::Docum
|
||||
Divider::vertical().show(ui);
|
||||
let (marker, label) = (g.marker_size as f32, g.label_size as f32);
|
||||
let (mut new_marker, mut new_label) = (marker, label);
|
||||
let marker_out = option_cells::number(tl!("Marker Size"), &mut new_marker, MARKER_SIZE).whole().show(ui);
|
||||
let label_out = option_cells::number(tl!("Label Size"), &mut new_label, LABEL_SIZE).whole().show(ui);
|
||||
let marker_out = option_cells::number(tl!("Marker Size"), Bind::bound(&mut new_marker), MARKER_SIZE).whole().show(ui);
|
||||
let label_out = option_cells::number(tl!("Label Size"), Bind::bound(&mut new_label), LABEL_SIZE).whole().show(ui);
|
||||
// A typed size out of range takes the closest value and says so once (#13530).
|
||||
for alert in [&marker_out.out_of_range, &label_out.out_of_range].into_iter().flatten() {
|
||||
option_cells::range_alert(app, ui, alert);
|
||||
@@ -207,7 +207,7 @@ fn sampler(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
let n = app.session.active().map_or(0, |d| d.color_samplers.len());
|
||||
// One Sample Size setting, shared with the Eyedropper (#11732).
|
||||
// PLAN: assumed `SamplerOptions::show(ui)` returns an output with `clear_all: bool`.
|
||||
let out = SamplerOptions::new(n, Bind::bound(&mut app.ui.tool_options.eyedropper.size)).show(ui);
|
||||
let out = SamplerOptions::new(n, bind_tracked!(app.ui.tool_options => eyedropper.size)).show(ui);
|
||||
if out.clear_all {
|
||||
run(app, "view.colorSamplers.clear", json!({}));
|
||||
}
|
||||
|
||||
@@ -444,7 +444,7 @@ fn count_number_height(label_size: u32) -> f32 {
|
||||
app.sync_views();
|
||||
let mut h = egui_kittest::Harness::builder().with_context(app.ctx().clone()).with_size(egui::vec2(900.0, 600.0)).build_app(
|
||||
|ui, app: &mut PhotocraftApp| {
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
|
||||
@@ -32,7 +32,7 @@ pub(crate) fn show(ui: &mut egui::Ui, app: &mut PhotocraftApp, rect: egui::Rect,
|
||||
show_smoothing_string(ui, app, rect);
|
||||
crate::object_finder::show(ui, app, at);
|
||||
if let Some(at) = at {
|
||||
let shift = craft::ui::runtime::pointer::frame(ui.ctx()).mods.shift;
|
||||
let shift = craft::ui::runtime::pointer::mods(ui.ctx()).shift;
|
||||
let tool = app.ui.tool;
|
||||
crate::stroke_constraint::show_line_preview(ui, app, at, tool, shift);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ fn show_clone_overlay(ui: &mut egui::Ui, app: &mut PhotocraftApp, at: Option<Poi
|
||||
if !matches!(app.ui.tool, Tool::CloneStamp | Tool::Healing) {
|
||||
return;
|
||||
}
|
||||
if app.brush_resize.active() || craft::ui::runtime::pointer::frame(ui.ctx()).mods.alt {
|
||||
if app.brush_resize.active() || craft::ui::runtime::pointer::mods(ui.ctx()).alt {
|
||||
return;
|
||||
}
|
||||
let Some(source) = crate::canvas::strokes::clone_source(app, [at.x, at.y]) else { return };
|
||||
|
||||
@@ -36,6 +36,8 @@ pub fn eligible(app: &PhotocraftApp) -> bool {
|
||||
|
||||
/// Shows the bar under the active document's crop frame, inside `area` (the canvas body's rect).
|
||||
pub fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui, area: egui::Rect) {
|
||||
// The canvas run that shows the bar reports where; a replay of that run shows it there still.
|
||||
app.ui.task_bar_shown = None;
|
||||
if !wanted(app) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ fn a_curvature_pen_double_click_through_the_canvas_rounds_a_corner() {
|
||||
app.ui.extras.rulers = false;
|
||||
let mut h = Harness::builder().with_context(app.ctx().clone()).with_size(vec2(1000.0, 700.0)).with_step_dt(1.0 / 60.0).build_ui_state(
|
||||
|ui, app: &mut Box<PhotocraftApp>| {
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::document_area(app, ui));
|
||||
egui::CentralPanel::default().show(ui, |ui| crate::canvas::testing::document_area(app, ui));
|
||||
},
|
||||
app,
|
||||
);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
use craft::behavior::IconId;
|
||||
use craft::ui::buttons::ToggleButton;
|
||||
use craft::ui::choice::{Checkbox, Segmented};
|
||||
use craft::ui::contract::{Bind, Entry, Props as _, Show as _, ShowContainer as _};
|
||||
use craft::ui::contract::{Bind, Entry, Props as _, Show as _, ShowContainer as _, bind_tracked};
|
||||
use craft::ui::display::Divider;
|
||||
use craft::ui::form::Field;
|
||||
use craft::ui::pickers::Select;
|
||||
@@ -148,8 +148,8 @@ pub(crate) fn stored_tolerance(v: f32) -> f32 {
|
||||
}
|
||||
|
||||
/// A check box named `label` over `value`.
|
||||
fn check(ui: &mut egui::Ui, label: &str, value: &mut bool, tip: Option<&str>) {
|
||||
let mut checkbox = Checkbox::new(Bind::bound(value)).label(label.to_owned());
|
||||
fn check(ui: &mut egui::Ui, label: &str, value: Bind<'_, bool>, tip: Option<&str>) {
|
||||
let mut checkbox = Checkbox::new(value).label(label.to_owned());
|
||||
if let Some(tip) = tip {
|
||||
checkbox = checkbox.tooltip(tip.to_owned());
|
||||
}
|
||||
@@ -168,28 +168,27 @@ pub fn options_bar(ui: &mut egui::Ui, app: &mut PhotocraftApp, tool: Tool) -> bo
|
||||
}
|
||||
|
||||
fn magic_eraser_members(ui: &mut egui::Ui, app: &mut PhotocraftApp) {
|
||||
let o = &mut app.ui.tool_options;
|
||||
// The field clamps without an alert, as the reference's Magic Eraser Tolerance does.
|
||||
let _ = option_cells::number(tl!("Tolerance:"), &mut o.tolerance, 0.0..=255.0).show(ui);
|
||||
check(ui, tl!("Anti-alias"), &mut o.anti_alias, None);
|
||||
check(ui, tl!("Contiguous"), &mut o.contiguous, None);
|
||||
check(ui, tl!("Sample All Layers"), &mut o.sample_all.magic_eraser, None);
|
||||
let _ = option_cells::number(tl!("Tolerance:"), bind_tracked!(app.ui.tool_options => tolerance), 0.0..=255.0).show(ui);
|
||||
let (anti_alias, contiguous, sample_all) = bind_tracked!(app.ui.tool_options => anti_alias, contiguous, sample_all.magic_eraser);
|
||||
check(ui, tl!("Anti-alias"), anti_alias, None);
|
||||
check(ui, tl!("Contiguous"), contiguous, None);
|
||||
check(ui, tl!("Sample All Layers"), sample_all, None);
|
||||
Divider::vertical().show(ui);
|
||||
let _ = option_cells::number(tl!("Opacity:"), &mut o.magic_eraser_opacity, 1.0..=100.0).unit("%").show(ui);
|
||||
let _ = option_cells::number(tl!("Opacity:"), bind_tracked!(app.ui.tool_options => magic_eraser_opacity), 1.0..=100.0).unit("%").show(ui);
|
||||
}
|
||||
|
||||
fn background_eraser_members(ui: &mut egui::Ui, app: &mut PhotocraftApp) {
|
||||
let mut alerts = Vec::new();
|
||||
{
|
||||
let o = &mut app.ui.tool_options;
|
||||
let sampling = [
|
||||
Entry::new("continuous".to_string(), tl!("Sampling: Continuous")).icon(IconId::new("eyedropper")),
|
||||
Entry::new("once".to_string(), tl!("Sampling: Once")).icon(IconId::new("target")),
|
||||
Entry::new("backgroundSwatch".to_string(), tl!("Sampling: Background Swatch")).icon(IconId::new("square")),
|
||||
];
|
||||
let picked = Segmented::new(tl!("Sampling"), Bind::given(o.bg_sampling.clone()), &sampling).show(ui).value().cloned();
|
||||
let picked = Segmented::new(tl!("Sampling"), Bind::given(app.ui.tool_options.bg_sampling.clone()), &sampling).show(ui).value().cloned();
|
||||
if let Some(sampling) = picked {
|
||||
o.bg_sampling = sampling;
|
||||
app.ui.tool_options.bg_sampling = sampling;
|
||||
}
|
||||
Divider::vertical().show(ui);
|
||||
|
||||
@@ -201,7 +200,7 @@ fn background_eraser_members(ui: &mut egui::Ui, app: &mut PhotocraftApp) {
|
||||
// In a `Field`, as Color Replacement's Limits: a bare control's label only names it (#16338).
|
||||
let picked = Field::new(tl!("Limits:"))
|
||||
.show(ui, |ui, _| {
|
||||
Select::new(tl!("Limits:"), Bind::given(o.bg_limits.clone()), &limits)
|
||||
Select::new(tl!("Limits:"), Bind::given(app.ui.tool_options.bg_limits.clone()), &limits)
|
||||
.tooltip(tl!("How far to let the erasing spread").to_owned())
|
||||
.show(ui)
|
||||
.events
|
||||
@@ -211,20 +210,20 @@ fn background_eraser_members(ui: &mut egui::Ui, app: &mut PhotocraftApp) {
|
||||
.inner
|
||||
.flatten();
|
||||
if let Some(limits) = picked {
|
||||
o.bg_limits = limits;
|
||||
app.ui.tool_options.bg_limits = limits;
|
||||
}
|
||||
|
||||
// Shown as the stroke reads it; written back only when the user edits it.
|
||||
let shown = stored_tolerance(o.bg_tolerance);
|
||||
let shown = stored_tolerance(app.ui.tool_options.bg_tolerance);
|
||||
let mut tolerance = shown;
|
||||
let alert = option_cells::number(tl!("Tolerance:"), &mut tolerance, 1.0..=100.0)
|
||||
let alert = option_cells::number(tl!("Tolerance:"), Bind::bound(&mut tolerance), 1.0..=100.0)
|
||||
.whole()
|
||||
.unit("%")
|
||||
.tooltip(tl!("Erase range of similar colors"))
|
||||
.show(ui)
|
||||
.out_of_range;
|
||||
if tolerance != shown {
|
||||
o.bg_tolerance = tolerance;
|
||||
app.ui.tool_options.bg_tolerance = tolerance;
|
||||
}
|
||||
alerts.extend(alert);
|
||||
}
|
||||
@@ -233,7 +232,7 @@ fn background_eraser_members(ui: &mut egui::Ui, app: &mut PhotocraftApp) {
|
||||
let before = (*app.session.tools.brush).clone();
|
||||
let mut brush = before.clone();
|
||||
let mut angle = brush.angle;
|
||||
let angle_out = option_cells::number(tl!("Angle"), &mut angle, -180.0..=180.0)
|
||||
let angle_out = option_cells::number(tl!("Angle"), Bind::bound(&mut angle), -180.0..=180.0)
|
||||
.whole()
|
||||
.unit("°")
|
||||
.icon(IconSpec::svg(IconId::new("rotate_cw")))
|
||||
@@ -244,7 +243,7 @@ fn background_eraser_members(ui: &mut egui::Ui, app: &mut PhotocraftApp) {
|
||||
brush.angle = angle;
|
||||
alerts.extend(angle_out.out_of_range);
|
||||
|
||||
check(ui, tl!("Protect Foreground Color"), &mut app.ui.tool_options.bg_protect_fg, Some(tl!("Do not erase the foreground swatch color")));
|
||||
check(ui, tl!("Protect Foreground Color"), bind_tracked!(app.ui.tool_options => bg_protect_fg), Some(tl!("Do not erase the foreground swatch color")));
|
||||
|
||||
let pressure = ToggleButton::new(tl!("Always use pressure for size"), Bind::given(brush.pressure_size))
|
||||
.icon(IconId::new("target"))
|
||||
|
||||
@@ -10,7 +10,11 @@ use crate::PhotocraftApp;
|
||||
|
||||
/// The options bar for the Eyedropper tool.
|
||||
pub fn options(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
EyedropperBar::new(&mut app.ui.tool_options.eyedropper).show(ui);
|
||||
let mut options = app.ui.tool_options.eyedropper;
|
||||
EyedropperBar::new(&mut options).show(ui);
|
||||
if options != app.ui.tool_options.eyedropper {
|
||||
app.ui.tool_options.eyedropper = options;
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -55,7 +55,7 @@ fn harness(app: Box<PhotocraftApp>) -> egui_kittest::Harness<'static, Box<Photoc
|
||||
.with_context(ctx)
|
||||
.with_step_dt(1.0 / 60.0)
|
||||
.with_size(egui::vec2(1000., 700.))
|
||||
.build_ui_state(|ui, app: &mut Box<PhotocraftApp>| crate::canvas::document_area(app, ui), app);
|
||||
.build_ui_state(|ui, app: &mut Box<PhotocraftApp>| crate::canvas::testing::document_area(app, ui), app);
|
||||
|
||||
h.run_steps(4);
|
||||
h
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use craft::draw::ui::gradient::{GradientFillWords, GradientStyle, GradientSwatch};
|
||||
use craft::ui::choice::{Checkbox, Segmented};
|
||||
use craft::ui::contract::{Bind, Entry, LabelKind, Props as _, Show as _, ShowContainer as _, SideLabel};
|
||||
use craft::ui::contract::{Bind, Entry, LabelKind, Props as _, Show as _, ShowContainer as _, SideLabel, bind_tracked};
|
||||
use craft::ui::display::Divider;
|
||||
use craft::ui::form::Field;
|
||||
use craft::ui::patterns::blend_keys::{BlendKeyEntry, blend_entries};
|
||||
@@ -51,37 +51,40 @@ pub(crate) fn bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
let blends = blend_modes();
|
||||
let open_editor;
|
||||
{
|
||||
let o = &mut app.ui.tool_options;
|
||||
let mut classic = o.gradient_classic && !locked_live;
|
||||
let mut classic = app.ui.tool_options.gradient_classic && !locked_live;
|
||||
Field::new(tl!("Gradient mode").to_owned()).side(SideLabel::new().kind(LabelKind::Hidden)).show(ui, |ui, _| {
|
||||
Select::new(tl!("Gradient mode").to_owned(), Bind::bound(&mut classic), &modes).enabled(!locked_live).show(ui);
|
||||
});
|
||||
if !locked_live {
|
||||
o.gradient_classic = classic;
|
||||
if !locked_live && classic != app.ui.tool_options.gradient_classic {
|
||||
app.ui.tool_options.gradient_classic = classic;
|
||||
}
|
||||
open_editor = GradientSwatch::new(tl!("Gradient picker").to_string(), &tool_stops).sampler(&sampler).show(ui).clicked;
|
||||
Divider::vertical().show(ui);
|
||||
let style = stops::style_named(&o.gradient_style);
|
||||
let style = stops::style_named(&app.ui.tool_options.gradient_style);
|
||||
if let Some(next) = Segmented::new(Label::from(tl!("Gradient style").to_string()), Bind::given(style), &styles).show(ui).value().copied() {
|
||||
o.gradient_style = stops::style_name(next).to_owned();
|
||||
app.ui.tool_options.gradient_style = stops::style_name(next).to_owned();
|
||||
}
|
||||
if classic {
|
||||
labelled(ui, tl!("Mode"), |ui| {
|
||||
Select::new(tl!("Blend Mode").to_owned(), Bind::bound(&mut o.gradient_blend_mode), &blends).show(ui);
|
||||
});
|
||||
let fill_opacity = app.ui.tool_options.fill_opacity;
|
||||
{
|
||||
let mut blend = bind_tracked!(app.ui.tool_options => gradient_blend_mode);
|
||||
labelled(ui, tl!("Mode"), |ui| {
|
||||
Select::new(tl!("Blend Mode").to_owned(), blend.reborrowed(), &blends).show(ui);
|
||||
});
|
||||
}
|
||||
labelled(ui, tl!("Opacity"), |ui| {
|
||||
let field =
|
||||
NumberField::new(tl!("Opacity").to_owned(), Bind::given(Some(f64::from(o.fill_opacity)))).range(1.0..=100.0).unit("%").scrub_by_label();
|
||||
NumberField::new(tl!("Opacity").to_owned(), Bind::given(Some(f64::from(fill_opacity)))).range(1.0..=100.0).unit("%").scrub_by_label();
|
||||
if let Some(next) = field.show(ui).value().copied().flatten() {
|
||||
o.fill_opacity = next as f32;
|
||||
app.ui.tool_options.fill_opacity = next as f32;
|
||||
}
|
||||
});
|
||||
}
|
||||
if let Some(on) = Checkbox::new(Bind::given(o.gradient_reverse)).label(tl!("Reverse").to_owned()).show(ui).value().copied() {
|
||||
o.gradient_reverse = on;
|
||||
if let Some(on) = Checkbox::new(Bind::given(app.ui.tool_options.gradient_reverse)).label(tl!("Reverse").to_owned()).show(ui).value().copied() {
|
||||
app.ui.tool_options.gradient_reverse = on;
|
||||
}
|
||||
if let Some(on) = Checkbox::new(Bind::given(o.gradient_dither)).label(tl!("Dither").to_owned()).show(ui).value().copied() {
|
||||
o.gradient_dither = on;
|
||||
if let Some(on) = Checkbox::new(Bind::given(app.ui.tool_options.gradient_dither)).label(tl!("Dither").to_owned()).show(ui).value().copied() {
|
||||
app.ui.tool_options.gradient_dither = on;
|
||||
}
|
||||
}
|
||||
if open_editor {
|
||||
|
||||
@@ -58,7 +58,7 @@ pub(crate) fn show(app: &mut PhotocraftApp, ui: &mut Ui, at: Rect) -> Option<(La
|
||||
return None;
|
||||
}
|
||||
// ⌘ is the Move tool (`hold_keys::cmd_moves`): the overlay steps aside while it is held.
|
||||
if craft::ui::runtime::pointer::frame(ui.ctx()).mods.cmd && crate::canvas::tools::takes_command_stand_in(Tool::Gradient) {
|
||||
if craft::ui::runtime::pointer::mods(ui.ctx()).cmd && crate::canvas::tools::takes_command_stand_in(Tool::Gradient) {
|
||||
return None;
|
||||
}
|
||||
let (layer, frame, canvas) = active_gradient(app)?;
|
||||
|
||||
@@ -68,7 +68,9 @@ pub(crate) fn prepare(app: &PhotocraftApp, tool: &mut MagneticLassoTool<PcEdges>
|
||||
|
||||
/// Writes the tool's settings back after the run, so `[` and `]` reach the options store.
|
||||
pub(crate) fn store(app: &mut PhotocraftApp, tool: &MagneticLassoTool<PcEdges>) {
|
||||
app.ui.tool_options.magnetic = *tool.settings();
|
||||
if app.ui.tool_options.magnetic != *tool.settings() {
|
||||
app.ui.tool_options.magnetic = *tool.settings();
|
||||
}
|
||||
}
|
||||
|
||||
/// Selects the closed border as drawn, in `mode` (the family's operation-to-mode name). Fewer than
|
||||
|
||||
@@ -93,7 +93,7 @@ fn duplicate_drag(app: &PhotocraftApp) -> Option<(Rect, Rect)> {
|
||||
/// Shows the measurements over the canvas `rect`, in the Smart Guides colour. `pointer` is the
|
||||
/// screen hover position.
|
||||
pub(crate) fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui, canvas: egui::Rect, pointer: Option<egui::Pos2>) {
|
||||
let command = craft::ui::runtime::pointer::frame(ui.ctx()).mods.cmd;
|
||||
let command = craft::ui::runtime::pointer::mods(ui.ctx()).cmd;
|
||||
let pressed = crate::canvas::tools::in_gesture(app);
|
||||
let at = pointer.and_then(|p| crate::canvas::document_display::doc_point_at(app, p)).map(|p| [p.x, p.y]);
|
||||
let Some((a, b)) = current(app, at, command, pressed) else { return };
|
||||
|
||||
@@ -111,7 +111,7 @@ pub(crate) fn active_outline(app: &mut PhotocraftApp, at: Option<[f64; 2]>, comm
|
||||
/// position. The Layers panel reads `canvas_hover_layer`, so a change of it asks for a repaint.
|
||||
pub(crate) fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui, canvas: egui::Rect, pointer: Option<egui::Pos2>) {
|
||||
let prev_canvas_hover = app.canvas_hover_layer;
|
||||
let command = craft::ui::runtime::pointer::frame(ui.ctx()).mods.cmd;
|
||||
let command = craft::ui::runtime::pointer::mods(ui.ctx()).cmd;
|
||||
let pressed = crate::canvas::tools::in_gesture(app);
|
||||
let at = pointer.and_then(|p| crate::canvas::document_display::doc_point_at(app, p)).map(|p| [p.x, p.y]);
|
||||
let outline = active_outline(app, at, command, pressed);
|
||||
|
||||
@@ -185,7 +185,7 @@ pub(crate) fn update(app: &mut PhotocraftApp, at: Option<[f64; 2]>, pressed: boo
|
||||
}
|
||||
let resting = f.shown.is_none() && !missed && now - f.since < DEBOUNCE;
|
||||
if resting {
|
||||
ctx.request_repaint_after(std::time::Duration::from_secs_f64(DEBOUNCE - (now - f.since)));
|
||||
craft::ui::runtime::frame::request_repaint_after(ctx, DEBOUNCE - (now - f.since));
|
||||
}
|
||||
#[cfg(test)]
|
||||
let busy = f.job.is_some() || resting;
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
//! `NumberField` whose out-of-range commit comes back as a [`RangeAlert`] for the caller to show.
|
||||
|
||||
use std::ops::RangeInclusive;
|
||||
use std::sync::Arc;
|
||||
|
||||
use craft::behavior::{EditEvents, NumberCodec};
|
||||
use craft::behavior::{EditEvent, EditEvents, Mixed, NumberCodec};
|
||||
use craft::ui::contract::{Bind, FieldLayout, Props as _, Show as _, ShowContainer as _, SideLabel, Sizing};
|
||||
use craft::ui::dialog::Alert;
|
||||
use craft::ui::display::{Elide, Shade, Text};
|
||||
@@ -18,7 +19,7 @@ use crate::PhotocraftApp;
|
||||
/// commits, so showing a bar never rounds a fraction another tool shares.
|
||||
pub(crate) struct NumberCell<'a> {
|
||||
caption: Label,
|
||||
value: &'a mut f32,
|
||||
value: Bind<'a, f32>,
|
||||
range: RangeInclusive<f64>,
|
||||
unit: Option<Label>,
|
||||
whole: bool,
|
||||
@@ -30,7 +31,7 @@ pub(crate) struct NumberCell<'a> {
|
||||
}
|
||||
|
||||
/// A number cell named `caption` over `value`, held to `range`.
|
||||
pub(crate) fn number<'a>(caption: impl Into<Label>, value: &'a mut f32, range: RangeInclusive<f64>) -> NumberCell<'a> {
|
||||
pub(crate) fn number<'a>(caption: impl Into<Label>, value: Bind<'a, f32>, range: RangeInclusive<f64>) -> NumberCell<'a> {
|
||||
NumberCell {
|
||||
caption: caption.into(),
|
||||
value,
|
||||
@@ -100,14 +101,14 @@ impl<'a> NumberCell<'a> {
|
||||
/// Shows the cell. Returns the pass's edit events, which a caller keys its history step by
|
||||
/// (`history_keys::coalesce`), and the alert of a typed value that was clamped to the range.
|
||||
pub(crate) fn show(self, ui: &mut egui::Ui) -> NumberCellOutput {
|
||||
let Self { caption, value, range, unit, whole, alert_fractions, popup_slider, tooltip, enabled, icon } = self;
|
||||
let Self { caption, mut value, range, unit, whole, alert_fractions, popup_slider, tooltip, enabled, icon } = self;
|
||||
let mut side = SideLabel::new().scrub(true);
|
||||
if let Some(icon) = icon {
|
||||
side = side.icon(icon).layout(FieldLayout::Inside);
|
||||
}
|
||||
let mut out = NumberCellOutput { events: EditEvents::default(), out_of_range: None, rounded: false };
|
||||
Field::new(caption.clone()).enabled(enabled).side(side).sizing(Sizing::Content).show(ui, |ui, _| {
|
||||
let mut field = NumberField::named(caption.clone(), Bind::bound(&mut *value)).range(range.clone()).scrub_by_label();
|
||||
let mut field = NumberField::named(caption.clone(), value.reborrowed()).range(range.clone()).scrub_by_label();
|
||||
if whole {
|
||||
let codec = NumberCodec::new(Env::of(ui).units().reader(None), 0);
|
||||
field = field.step(1.0).codec(codec);
|
||||
@@ -130,7 +131,10 @@ impl<'a> NumberCell<'a> {
|
||||
out = NumberCellOutput { events: shown.edit.events, out_of_range: shown.out_of_range, rounded: false };
|
||||
});
|
||||
if alert_fractions && out.events.committed().is_some_and(|v| v.is_finite() && v.fract() != 0.0) {
|
||||
*value = value.round().clamp(*range.start() as f32, *range.end() as f32);
|
||||
if let Some(&typed) = value.value() {
|
||||
let rounded = typed.round().clamp(*range.start() as f32, *range.end() as f32);
|
||||
let _ = value.reborrow().apply(&EditEvent::set(Mixed::Same(typed), rounded, Arc::from(""), None));
|
||||
}
|
||||
out.rounded = true;
|
||||
}
|
||||
out
|
||||
|
||||
@@ -20,7 +20,7 @@ use craft::behavior::kurbo::Size;
|
||||
use craft::draw::ui::crop::{CropDocKey, CropDocument, PerspectiveCropBar, PerspectiveCropEvent, PerspectiveCropTool, PerspectiveInput};
|
||||
use craft::ui::bars::BarOutput;
|
||||
use craft::ui::canvas::{CropShield, ToolHostResponse};
|
||||
use craft::ui::contract::Bind;
|
||||
use craft::ui::contract::bind_tracked;
|
||||
use craft::ui::runtime::edit::cancel_all;
|
||||
use photocraft_engine::perspective_crop_cmds::{BITMAP_MODE_ERROR, UNSUPPORTED_LAYERS_ERROR};
|
||||
use serde_json::json;
|
||||
@@ -204,8 +204,11 @@ pub fn committed(app: &mut PhotocraftApp, out: &BarOutput) {
|
||||
/// range alert once.
|
||||
pub fn options(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
let document = document(app).unwrap_or_else(|| CropDocument::new(CropDocKey::new(0), Size::ZERO, 72.0));
|
||||
let options = &mut app.ui.tool_options;
|
||||
let shown = PerspectiveCropBar::new(&mut options.perspective_crop, &document, Bind::bound(&mut options.perspective_crop_grid)).show(ui);
|
||||
let mut size = app.ui.tool_options.perspective_crop.clone();
|
||||
let shown = PerspectiveCropBar::new(&mut size, &document, bind_tracked!(app.ui.tool_options => perspective_crop_grid)).show(ui);
|
||||
if size != app.ui.tool_options.perspective_crop {
|
||||
app.ui.tool_options.perspective_crop = size;
|
||||
}
|
||||
if let Some(alert) = shown.out_of_range {
|
||||
crate::option_cells::range_alert(app, ui, &alert);
|
||||
}
|
||||
|
||||
@@ -124,14 +124,12 @@ fn stroke(h: &mut Harness<'static, Box<PhotocraftApp>>) {
|
||||
retouch_ui::finish_stroke(h.state_mut(), Tool::Remove, &[[30.0, 40.0, 1.0], [90.0, 40.0, 1.0]], Mods::default(), false);
|
||||
}
|
||||
|
||||
/// Frames until the removal has landed: with background jobs on that is when the job's edit is
|
||||
/// applied, and the card can only be posted after it.
|
||||
fn wait_until_landed(h: &mut Harness<'static, Box<PhotocraftApp>>, layers_before: usize) {
|
||||
for _ in 0..40 {
|
||||
h.step();
|
||||
if layers(h.state()).len() == layers_before + 1 {
|
||||
break;
|
||||
}
|
||||
/// Until the removal has landed: with background jobs on, the test waits for the job's worker
|
||||
/// (`Session::wait_job`, which applies its edit), and the next frames' `jobs_ui::tick` takes the
|
||||
/// job's end, which posts the card.
|
||||
fn wait_until_landed(h: &mut Harness<'static, Box<PhotocraftApp>>) {
|
||||
for job in h.state().session.jobs() {
|
||||
let _ = h.state_mut().session.wait_job(job.id);
|
||||
}
|
||||
h.run_steps(3);
|
||||
}
|
||||
@@ -215,7 +213,7 @@ fn the_notice_card_arrives_when_the_removal_runs_as_a_background_job() {
|
||||
assert!(retouch_ui::remove_pending_commit(h.state_mut()), "{after_each}: the ✓ applies the waiting strokes");
|
||||
}
|
||||
assert_eq!(layers(h.state()), before, "{after_each}: the removal is still running as a job");
|
||||
wait_until_landed(&mut h, before.len());
|
||||
wait_until_landed(&mut h);
|
||||
let after = layers(h.state());
|
||||
assert_eq!(after.len(), before.len() + 1, "{after_each}: the job added the edits layer");
|
||||
assert_eq!(name(h.state(), *after.last().unwrap()), "Remove tool edits", "{after_each}");
|
||||
@@ -265,7 +263,7 @@ fn a_removal_on_a_pixel_layer_with_create_new_layer_notices_nothing() {
|
||||
h.state_mut().ui.tool_options.remove_new_layer = true;
|
||||
let before = layers(h.state());
|
||||
stroke(&mut h);
|
||||
wait_until_landed(&mut h, before.len());
|
||||
wait_until_landed(&mut h);
|
||||
let after = layers(h.state());
|
||||
assert_eq!(after.len(), before.len() + 1, "background {background}: Create new layer adds the edits layer");
|
||||
assert_eq!(name(h.state(), *after.last().unwrap()), "Remove tool edits", "background {background}");
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
use craft::behavior::Value;
|
||||
use craft::ui::choice::{Checkbox, Radio, RadioGroup};
|
||||
use craft::ui::contract::{Bind, Entry, Props as _, Show as _, ShowContainer as _};
|
||||
use craft::ui::contract::{Bind, Entry, Props as _, Show as _, ShowContainer as _, bind_tracked};
|
||||
use craft::ui::display::Divider;
|
||||
use craft::ui::form::Field;
|
||||
use craft::ui::pickers::Select;
|
||||
@@ -21,31 +21,30 @@ const STRUCTURE_TIP: &str = "Adjust how strictly the source structure is preserv
|
||||
const COLOR_TIP: &str = "Adjust how much the source color can be modified";
|
||||
|
||||
/// A check box over `value`, with an optional tooltip.
|
||||
pub(super) fn check(ui: &mut egui::Ui, label: &str, value: &mut bool, enabled: bool, tip: Option<&str>) {
|
||||
let mut cell = Checkbox::new(Bind::given(*value)).label(label.to_owned()).enabled(enabled);
|
||||
pub(super) fn check(ui: &mut egui::Ui, label: &str, value: Bind<'_, bool>, enabled: bool, tip: Option<&str>) {
|
||||
let mut cell = Checkbox::new(value).label(label.to_owned()).enabled(enabled);
|
||||
if let Some(tip) = tip {
|
||||
cell = cell.tooltip(tip.to_owned());
|
||||
}
|
||||
if let Some(on) = cell.show(ui).value().copied() {
|
||||
*value = on;
|
||||
}
|
||||
cell.show(ui);
|
||||
}
|
||||
|
||||
/// A select over `entries` captioned by a field label, with an optional tooltip.
|
||||
pub(super) fn choose<T: Value + Clone + 'static>(ui: &mut egui::Ui, caption: &str, value: &mut T, entries: &[Entry<T>], enabled: bool, tip: Option<&str>) {
|
||||
let picked = Field::new(caption.to_owned())
|
||||
.show(ui, |ui, _| {
|
||||
let mut cell = Select::new(caption.to_owned(), Bind::given(value.clone()), entries).enabled(enabled);
|
||||
if let Some(tip) = tip {
|
||||
cell = cell.tooltip(tip.to_owned());
|
||||
}
|
||||
cell.show(ui).value().cloned()
|
||||
})
|
||||
.inner
|
||||
.flatten();
|
||||
if let Some(picked) = picked {
|
||||
*value = picked;
|
||||
}
|
||||
pub(super) fn choose<T: Value + Clone + 'static>(
|
||||
ui: &mut egui::Ui,
|
||||
caption: &str,
|
||||
mut value: Bind<'_, T>,
|
||||
entries: &[Entry<T>],
|
||||
enabled: bool,
|
||||
tip: Option<&str>,
|
||||
) {
|
||||
Field::new(caption.to_owned()).show(ui, |ui, _| {
|
||||
let mut cell = Select::new(caption.to_owned(), value.reborrowed(), entries).enabled(enabled);
|
||||
if let Some(tip) = tip {
|
||||
cell = cell.tooltip(tip.to_owned());
|
||||
}
|
||||
cell.show(ui);
|
||||
});
|
||||
}
|
||||
|
||||
/// The entries of a string option from `(engine value, label)` pairs.
|
||||
@@ -54,19 +53,12 @@ pub(super) fn string_entries(items: &[(&str, &str)]) -> Vec<Entry<String>> {
|
||||
}
|
||||
|
||||
/// A radio group over a string option.
|
||||
fn radios(ui: &mut egui::Ui, label: &str, value: &mut String, items: &[(&str, &str)]) {
|
||||
let picked = RadioGroup::new(label.to_owned(), Bind::given(value.clone()))
|
||||
.show(ui, |ui, _| {
|
||||
for (v, l) in items {
|
||||
Radio::new((*v).to_owned()).label((*l).to_owned()).show(ui);
|
||||
}
|
||||
})
|
||||
.output
|
||||
.value()
|
||||
.cloned();
|
||||
if let Some(picked) = picked {
|
||||
*value = picked;
|
||||
}
|
||||
fn radios(ui: &mut egui::Ui, label: &str, value: Bind<'_, String>, items: &[(&str, &str)]) {
|
||||
RadioGroup::new(label.to_owned(), value).show(ui, |ui, _| {
|
||||
for (v, l) in items {
|
||||
Radio::new((*v).to_owned()).label((*l).to_owned()).show(ui);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// The first alert of two cells, both of which have been shown.
|
||||
@@ -77,11 +69,11 @@ fn first(a: Option<RangeAlert>, b: Option<RangeAlert>) -> Option<RangeAlert> {
|
||||
/// Remove's options. The apply and cancel pair belongs to the bar's pending strip.
|
||||
pub(super) fn remove(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Option<RangeAlert> {
|
||||
let composite = crate::canvas::paint_target(app).as_str() == Some("pixels");
|
||||
let o = &mut app.ui.tool_options;
|
||||
let (sample_all, after_each, new_layer) = bind_tracked!(app.ui.tool_options => sample_all.remove, remove_after_each_stroke, remove_new_layer);
|
||||
// The reference's options bar, in its order and words (#12546).
|
||||
check(ui, tl!("Sample all layers"), &mut o.sample_all.remove, true, Some(tl!("Sample content from all visible layers")));
|
||||
check(ui, tl!("Remove after each stroke"), &mut o.remove_after_each_stroke, true, Some(tl!("Remove area after a single stroke")));
|
||||
check(ui, tl!("Create new layer"), &mut o.remove_new_layer, composite, Some(tl!("Create new layer with results")));
|
||||
check(ui, tl!("Sample all layers"), sample_all, true, Some(tl!("Sample content from all visible layers")));
|
||||
check(ui, tl!("Remove after each stroke"), after_each, true, Some(tl!("Remove area after a single stroke")));
|
||||
check(ui, tl!("Create new layer"), new_layer, composite, Some(tl!("Create new layer with results")));
|
||||
None
|
||||
}
|
||||
|
||||
@@ -89,17 +81,17 @@ pub(super) fn remove(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Option<Range
|
||||
pub(super) fn patch(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Option<RangeAlert> {
|
||||
crate::panels::options_bar::selection::operation_segments(app, ui, true);
|
||||
Divider::vertical().show(ui);
|
||||
let o = &mut app.ui.tool_options;
|
||||
let kinds = [Entry::new(false, tl!("Normal")), Entry::new(true, tl!("Content-Aware"))];
|
||||
choose(ui, tl!("Patch"), &mut o.patch_content_aware, &kinds, true, None);
|
||||
choose(ui, tl!("Patch"), bind_tracked!(app.ui.tool_options => patch_content_aware), &kinds, true, None);
|
||||
let mut alert = None;
|
||||
if o.patch_content_aware {
|
||||
let structure = number(tl!("Structure"), &mut o.patch_structure, 1.0..=7.0).whole().show(ui).out_of_range;
|
||||
let color = number(tl!("Color"), &mut o.patch_color, 0.0..=10.0).whole().show(ui).out_of_range;
|
||||
check(ui, tl!("Sample All Layers"), &mut o.sample_all.patch, true, None);
|
||||
if app.ui.tool_options.patch_content_aware {
|
||||
let (structure, color, sample_all) = bind_tracked!(app.ui.tool_options => patch_structure, patch_color, sample_all.patch);
|
||||
let structure = number(tl!("Structure"), structure, 1.0..=7.0).whole().show(ui).out_of_range;
|
||||
let color = number(tl!("Color"), color, 0.0..=10.0).whole().show(ui).out_of_range;
|
||||
check(ui, tl!("Sample All Layers"), sample_all, true, None);
|
||||
alert = first(structure, color);
|
||||
} else {
|
||||
radios(ui, tl!("Patch"), &mut o.patch_mode, &[("source", tl!("Source")), ("destination", tl!("Destination"))]);
|
||||
radios(ui, tl!("Patch"), bind_tracked!(app.ui.tool_options => patch_mode), &[("source", tl!("Source")), ("destination", tl!("Destination"))]);
|
||||
}
|
||||
Divider::vertical().show(ui);
|
||||
hint(ui, tl!("Lasso around an area, then drag the selection"));
|
||||
@@ -111,14 +103,14 @@ pub(super) fn content_aware_move(ui: &mut egui::Ui, app: &mut PhotocraftApp) ->
|
||||
let live = crate::cam_transform::active(app);
|
||||
crate::panels::options_bar::selection::operation_segments(app, ui, !live);
|
||||
Divider::vertical().show(ui);
|
||||
let o = &mut app.ui.tool_options;
|
||||
let (mode, cam_structure, cam_color, sample_all, on_drop) =
|
||||
bind_tracked!(app.ui.tool_options => cam_mode, cam_structure, cam_color, sample_all.content_aware_move, cam_transform_on_drop);
|
||||
let modes = string_entries(&[("move", tl!("Move")), ("extend", tl!("Extend"))]);
|
||||
choose(ui, tl!("Mode"), &mut o.cam_mode, &modes, !live, Some(tl!("Choose a remix mode")));
|
||||
let structure =
|
||||
number(tl!("Structure"), &mut o.cam_structure, 1.0..=7.0).whole().popup_slider().tooltip(tl!(STRUCTURE_TIP)).enabled(!live).show(ui).out_of_range;
|
||||
let color = number(tl!("Color"), &mut o.cam_color, 0.0..=10.0).whole().popup_slider().tooltip(tl!(COLOR_TIP)).enabled(!live).show(ui).out_of_range;
|
||||
check(ui, tl!("Sample All Layers"), &mut o.sample_all.content_aware_move, !live, Some(tl!("Enable to remix all layers")));
|
||||
check(ui, tl!("Transform On Drop"), &mut o.cam_transform_on_drop, !live, Some(tl!("Allows rotation and scaling of selection")));
|
||||
choose(ui, tl!("Mode"), mode, &modes, !live, Some(tl!("Choose a remix mode")));
|
||||
let structure = number(tl!("Structure"), cam_structure, 1.0..=7.0).whole().popup_slider().tooltip(tl!(STRUCTURE_TIP)).enabled(!live).show(ui).out_of_range;
|
||||
let color = number(tl!("Color"), cam_color, 0.0..=10.0).whole().popup_slider().tooltip(tl!(COLOR_TIP)).enabled(!live).show(ui).out_of_range;
|
||||
check(ui, tl!("Sample All Layers"), sample_all, !live, Some(tl!("Enable to remix all layers")));
|
||||
check(ui, tl!("Transform On Drop"), on_drop, !live, Some(tl!("Allows rotation and scaling of selection")));
|
||||
if !live {
|
||||
Divider::vertical().show(ui);
|
||||
hint(ui, tl!("Lasso around an area, then drag the selection"));
|
||||
@@ -128,15 +120,15 @@ pub(super) fn content_aware_move(ui: &mut egui::Ui, app: &mut PhotocraftApp) ->
|
||||
|
||||
/// Spot Healing's options.
|
||||
pub(super) fn spot_healing(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Option<RangeAlert> {
|
||||
let o = &mut app.ui.tool_options;
|
||||
let (spot_type, sample_all) = bind_tracked!(app.ui.tool_options => spot_type, sample_all.spot_healing);
|
||||
radios(
|
||||
ui,
|
||||
tl!("Type"),
|
||||
&mut o.spot_type,
|
||||
spot_type,
|
||||
&[("contentAware", tl!("Content-Aware")), ("createTexture", tl!("Create Texture")), ("proximityMatch", tl!("Proximity Match"))],
|
||||
);
|
||||
Divider::vertical().show(ui);
|
||||
check(ui, tl!("Sample All Layers"), &mut o.sample_all.spot_healing, true, None);
|
||||
check(ui, tl!("Sample All Layers"), sample_all, true, None);
|
||||
None
|
||||
}
|
||||
|
||||
@@ -146,11 +138,11 @@ pub(super) fn clone(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Option<RangeA
|
||||
let source_unset = app.session.presets().clone.active().source.is_none();
|
||||
let clone_stamp = app.ui.tool == Tool::CloneStamp;
|
||||
let indexed = crate::retouch_ui::clone_stamp_indexed(app);
|
||||
let o = &mut app.ui.tool_options;
|
||||
check(ui, tl!("Aligned"), &mut o.clone_aligned, true, clone_stamp.then(|| tl!("Keep the same source offset between strokes")));
|
||||
let (aligned, clone_sample) = bind_tracked!(app.ui.tool_options => clone_aligned, clone_sample);
|
||||
check(ui, tl!("Aligned"), aligned, true, clone_stamp.then(|| tl!("Keep the same source offset between strokes")));
|
||||
let samples = string_entries(&[("current", tl!("Current Layer")), ("currentAndBelow", tl!("Current & Below")), ("all", tl!("All Layers"))]);
|
||||
let mut greyed = "current".to_owned();
|
||||
let sample = if indexed { &mut greyed } else { &mut o.clone_sample };
|
||||
let sample = if indexed { Bind::bound(&mut greyed) } else { clone_sample };
|
||||
choose(ui, tl!("Sample"), sample, &samples, !indexed, clone_stamp.then(|| tl!("Choose which layers to sample")));
|
||||
if source_unset {
|
||||
Divider::vertical().show(ui);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
use craft::behavior::IconId;
|
||||
use craft::ui::buttons::ToggleButton;
|
||||
use craft::ui::choice::Checkbox;
|
||||
use craft::ui::contract::{Bind, Entry, Props as _, Show as _, ShowContainer as _, SideLabel, Sizing};
|
||||
use craft::ui::contract::{Bind, Entry, Props as _, Show as _, ShowContainer as _, SideLabel, Sizing, bind_tracked};
|
||||
use craft::ui::display::{Divider, Shade, Text};
|
||||
use craft::ui::form::Field;
|
||||
use craft::ui::pickers::Select;
|
||||
@@ -68,14 +68,21 @@ pub(super) fn art_history(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Option<
|
||||
.into_iter()
|
||||
.map(|(k, l)| Entry::new(k.to_string(), l.to_string()))
|
||||
.collect();
|
||||
let o = &mut app.ui.tool_options;
|
||||
Field::new(tl!("Style")).side(SideLabel::new().scrub(true)).sizing(Sizing::Content).show(ui, |ui, _| {
|
||||
Select::new(tl!("Style"), Bind::bound(&mut o.art_history_style), &styles).show(ui);
|
||||
});
|
||||
{
|
||||
let mut style = bind_tracked!(app.ui.tool_options => art_history_style);
|
||||
Field::new(tl!("Style")).side(SideLabel::new().scrub(true)).sizing(Sizing::Content).show(ui, |ui, _| {
|
||||
Select::new(tl!("Style"), style.reborrowed(), &styles).show(ui);
|
||||
});
|
||||
}
|
||||
// Area: whole pixels 0..500, no slider; Tolerance: whole percents 0..100 with a slider. A value
|
||||
// typed past either range becomes the closest one with the reference's own alert (#12630).
|
||||
let area = number(tl!("Area"), &mut o.art_history_area, 0.0..=500.0).whole().unit("px").tooltip(tl!("Painting area diameter")).show(ui).out_of_range;
|
||||
let tolerance = number(tl!("Tolerance"), &mut o.art_history_tolerance, 0.0..=100.0)
|
||||
let area = number(tl!("Area"), bind_tracked!(app.ui.tool_options => art_history_area), 0.0..=500.0)
|
||||
.whole()
|
||||
.unit("px")
|
||||
.tooltip(tl!("Painting area diameter"))
|
||||
.show(ui)
|
||||
.out_of_range;
|
||||
let tolerance = number(tl!("Tolerance"), bind_tracked!(app.ui.tool_options => art_history_tolerance), 0.0..=100.0)
|
||||
.whole()
|
||||
.unit("%")
|
||||
.popup_slider()
|
||||
@@ -99,7 +106,7 @@ fn art_history_angle_pressure(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Opt
|
||||
let before = (*app.session.tools.brush).clone();
|
||||
let mut brush = before.clone();
|
||||
let mut angle = brush.angle;
|
||||
let angle_out = number(tl!("Angle"), &mut angle, -180.0..=180.0)
|
||||
let angle_out = number(tl!("Angle"), Bind::bound(&mut angle), -180.0..=180.0)
|
||||
.whole()
|
||||
.unit("°")
|
||||
.icon(IconSpec::svg(IconId::new("rotate_cw")))
|
||||
@@ -132,9 +139,9 @@ pub(super) fn pattern_stamp(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Optio
|
||||
let patterns: Vec<Entry<String>> = app.session.patterns.items.iter().map(|p| Entry::new(p.id.clone(), p.display_name().to_string())).collect();
|
||||
let held = photocraft_engine::presets::patterns::current(&app.session).or(app.session.patterns.items.first()).map(|p| p.id.clone());
|
||||
let mut picked = held.clone().unwrap_or_default();
|
||||
let o = &mut app.ui.tool_options;
|
||||
Checkbox::new(Bind::bound(&mut o.pattern_stamp_aligned)).label(tl!("Aligned")).show(ui);
|
||||
Checkbox::new(Bind::bound(&mut o.pattern_stamp_impressionist)).label(tl!("Impressionist")).show(ui);
|
||||
let (aligned, impressionist) = bind_tracked!(app.ui.tool_options => pattern_stamp_aligned, pattern_stamp_impressionist);
|
||||
Checkbox::new(aligned).label(tl!("Aligned")).show(ui);
|
||||
Checkbox::new(impressionist).label(tl!("Impressionist")).show(ui);
|
||||
Divider::vertical().show(ui);
|
||||
if patterns.is_empty() {
|
||||
Text::new(tl!("No patterns")).shade(Shade::Faint).show(ui);
|
||||
@@ -143,8 +150,8 @@ pub(super) fn pattern_stamp(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Optio
|
||||
Select::new(tl!("Pattern"), Bind::bound(&mut picked), &patterns).show(ui);
|
||||
});
|
||||
}
|
||||
let scale = number(tl!("Scale"), &mut o.pattern_stamp_scale, 1.0..=1000.0).unit("%").show(ui).out_of_range;
|
||||
let angle = number(tl!("Angle"), &mut o.pattern_stamp_angle, -180.0..=180.0).unit("°").show(ui).out_of_range;
|
||||
let scale = number(tl!("Scale"), bind_tracked!(app.ui.tool_options => pattern_stamp_scale), 1.0..=1000.0).unit("%").show(ui).out_of_range;
|
||||
let angle = number(tl!("Angle"), bind_tracked!(app.ui.tool_options => pattern_stamp_angle), -180.0..=180.0).unit("°").show(ui).out_of_range;
|
||||
if !patterns.is_empty() && held.as_deref() != Some(picked.as_str()) {
|
||||
let _ = app.run("pattern.presets.select", json!({"pattern": picked}));
|
||||
}
|
||||
@@ -153,9 +160,9 @@ pub(super) fn pattern_stamp(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Optio
|
||||
|
||||
/// Red Eye: Pupil Size and Darken Amount.
|
||||
pub(super) fn red_eye(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Option<RangeAlert> {
|
||||
let o = &mut app.ui.tool_options;
|
||||
let pupil = number(tl!("Pupil Size"), &mut o.red_eye_pupil_size, 1.0..=100.0).show(ui).out_of_range;
|
||||
let darken = number(tl!("Darken Amount"), &mut o.red_eye_darken, 0.0..=100.0).show(ui).out_of_range;
|
||||
let (pupil_size, darken_amount) = bind_tracked!(app.ui.tool_options => red_eye_pupil_size, red_eye_darken);
|
||||
let pupil = number(tl!("Pupil Size"), pupil_size, 1.0..=100.0).show(ui).out_of_range;
|
||||
let darken = number(tl!("Darken Amount"), darken_amount, 0.0..=100.0).show(ui).out_of_range;
|
||||
Divider::vertical().show(ui);
|
||||
hint(ui, tl!("Click a red pupil to neutralize it"));
|
||||
pupil.or(darken)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use craft::behavior::IconId;
|
||||
use craft::ui::buttons::{Button, IconButton};
|
||||
use craft::ui::contract::{Entry, Props as _, Show as _, Trigger, clicked};
|
||||
use craft::ui::contract::{Entry, Props as _, Show as _, Trigger, bind_tracked, clicked};
|
||||
use craft::ui::display::Divider;
|
||||
use craft::ui::menu::Menu;
|
||||
use craft::ui::runtime::access::PopupKind;
|
||||
@@ -24,9 +24,9 @@ fn select_subject(ui: &mut egui::Ui, app: &mut PhotocraftApp, empty: &str) {
|
||||
|
||||
/// Quick Selection's options.
|
||||
pub(super) fn quick_selection(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Option<RangeAlert> {
|
||||
let o = &mut app.ui.tool_options;
|
||||
check(ui, tl!("Sample All Layers"), &mut o.sample_all.quick_selection, true, None);
|
||||
check(ui, tl!("Enhance Edge"), &mut o.enhance_edge, true, None);
|
||||
let (sample_all, enhance_edge) = bind_tracked!(app.ui.tool_options => sample_all.quick_selection, enhance_edge);
|
||||
check(ui, tl!("Sample All Layers"), sample_all, true, None);
|
||||
check(ui, tl!("Enhance Edge"), enhance_edge, true, None);
|
||||
hint(ui, crate::i18n::fmt(tl!("{key} to subtract"), &[("key", &crate::shortcuts::pretty("Alt"))]));
|
||||
Divider::vertical().show(ui);
|
||||
select_subject(ui, app, tl!("No subject found — try Object Selection or the Lasso"));
|
||||
@@ -57,13 +57,14 @@ fn finder_buttons(app: &mut PhotocraftApp, ui: &mut egui::Ui) {
|
||||
Entry::new(GearOption::Manual, tl!("Manual Refresh").to_string()).checked(!auto),
|
||||
];
|
||||
let picked = Menu::new(label).opened_by(&button, Trigger::Press).pick(ui, &entries).picked;
|
||||
let o = &mut app.ui.tool_options;
|
||||
match picked {
|
||||
Some(GearOption::Finder) => o.object_finder = !o.object_finder,
|
||||
Some(GearOption::Subtract) => o.object_subtract = !o.object_subtract,
|
||||
Some(GearOption::Auto) => o.object_finder_mode = ObjectFinderMode::Auto,
|
||||
Some(GearOption::Manual) => o.object_finder_mode = ObjectFinderMode::Manual,
|
||||
None => {}
|
||||
if let Some(picked) = picked {
|
||||
let o = &mut app.ui.tool_options;
|
||||
match picked {
|
||||
GearOption::Finder => o.object_finder = !o.object_finder,
|
||||
GearOption::Subtract => o.object_subtract = !o.object_subtract,
|
||||
GearOption::Auto => o.object_finder_mode = ObjectFinderMode::Auto,
|
||||
GearOption::Manual => o.object_finder_mode = ObjectFinderMode::Manual,
|
||||
}
|
||||
}
|
||||
if clicked(&refresh) {
|
||||
crate::object_finder::refresh(app);
|
||||
@@ -76,9 +77,9 @@ pub(super) fn object_selection(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Op
|
||||
crate::panels::options_bar::selection::operation_segments(app, ui, true);
|
||||
Divider::vertical().show(ui);
|
||||
finder_buttons(app, ui);
|
||||
let o = &mut app.ui.tool_options;
|
||||
check(ui, tl!("Sample All Layers"), &mut o.sample_all.object_selection, true, None);
|
||||
check(ui, tl!("Hard Edge"), &mut o.object_hard_edge, true, None);
|
||||
let (sample_all, hard_edge) = bind_tracked!(app.ui.tool_options => sample_all.object_selection, object_hard_edge);
|
||||
check(ui, tl!("Sample All Layers"), sample_all, true, None);
|
||||
check(ui, tl!("Hard Edge"), hard_edge, true, None);
|
||||
Divider::vertical().show(ui);
|
||||
select_subject(ui, app, tl!("No subject found — try a rectangle around the object"));
|
||||
None
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
use craft::behavior::{IconId, NumberCodec};
|
||||
use craft::ui::buttons::ToggleButton;
|
||||
use craft::ui::choice::Segmented;
|
||||
use craft::ui::contract::{Bind, Entry, FieldLayout, Props as _, Show as _, ShowContainer as _, SideLabel, Sizing};
|
||||
use craft::ui::choice::{Checkbox, Segmented};
|
||||
use craft::ui::contract::{Bind, Entry, FieldLayout, Props as _, Show as _, ShowContainer as _, SideLabel, Sizing, bind_tracked};
|
||||
use craft::ui::display::Divider;
|
||||
use craft::ui::form::Field;
|
||||
use craft::ui::primitives::IconSpec;
|
||||
@@ -34,15 +34,15 @@ fn smudge_modes() -> Vec<Entry<BlendMode>> {
|
||||
|
||||
/// The options of Dodge and Burn.
|
||||
pub(super) fn dodge_burn(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Option<RangeAlert> {
|
||||
let o = &mut app.ui.tool_options;
|
||||
let (tone_range, exposure, protect) = bind_tracked!(app.ui.tool_options => tone_range, exposure, protect_tones);
|
||||
let ranges = string_entries(&[("shadows", tl!("Shadows")), ("midtones", tl!("Midtones")), ("highlights", tl!("Highlights"))]);
|
||||
choose(ui, tl!("Range"), &mut o.tone_range, &ranges, true, Some(tl!("Painting Mode")));
|
||||
choose(ui, tl!("Range"), tone_range, &ranges, true, Some(tl!("Painting Mode")));
|
||||
// Whole numbers 1..100 with the range alert and a slider arrow; Dodge shares the field (#12669).
|
||||
let exposure =
|
||||
number(tl!("Exposure"), &mut o.exposure, 1.0..=100.0).whole().unit("%").popup_slider().tooltip(tl!("Set exposure for stroke")).show(ui).out_of_range;
|
||||
number(tl!("Exposure"), exposure, 1.0..=100.0).whole().unit("%").popup_slider().tooltip(tl!("Set exposure for stroke")).show(ui).out_of_range;
|
||||
let before = (*app.session.tools.brush).clone();
|
||||
let mut brush = before.clone();
|
||||
let angle = number(tl!("Angle"), &mut brush.angle, -180.0..=180.0)
|
||||
let angle = number(tl!("Angle"), Bind::bound(&mut brush.angle), -180.0..=180.0)
|
||||
.whole()
|
||||
.unit("°")
|
||||
.icon(IconSpec::svg(IconId::new("rotate_cw")))
|
||||
@@ -50,7 +50,7 @@ pub(super) fn dodge_burn(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Option<R
|
||||
.show(ui);
|
||||
let mut key = angle.events.iter().find_map(|event| crate::history_keys::coalesce("brush", event));
|
||||
|
||||
check(ui, tl!("Protect Tones"), &mut o.protect_tones, true, Some(tl!("Minimizes clipping in shadows and highlights, and keeps colors from shifting hue")));
|
||||
check(ui, tl!("Protect Tones"), protect, true, Some(tl!("Minimizes clipping in shadows and highlights, and keeps colors from shifting hue")));
|
||||
|
||||
let pressure = ToggleButton::new(tl!("Always use pressure for size"), Bind::given(brush.pressure_size))
|
||||
.icon(IconId::new("target"))
|
||||
@@ -67,11 +67,11 @@ pub(super) fn dodge_burn(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Option<R
|
||||
|
||||
/// The options of Sponge.
|
||||
pub(super) fn sponge(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Option<RangeAlert> {
|
||||
let o = &mut app.ui.tool_options;
|
||||
let (sponge_mode, sponge_flow, vibrance) = bind_tracked!(app.ui.tool_options => sponge_mode, sponge_flow, vibrance);
|
||||
let modes = string_entries(&[("desaturate", tl!("Desaturate")), ("saturate", tl!("Saturate"))]);
|
||||
choose(ui, tl!("Mode"), &mut o.sponge_mode, &modes, true, None);
|
||||
let flow = number(tl!("Flow"), &mut o.sponge_flow, 1.0..=100.0).whole().unit("%").popup_slider().show(ui).out_of_range;
|
||||
check(ui, tl!("Vibrance"), &mut o.vibrance, true, None);
|
||||
choose(ui, tl!("Mode"), sponge_mode, &modes, true, None);
|
||||
let flow = number(tl!("Flow"), sponge_flow, 1.0..=100.0).whole().unit("%").popup_slider().show(ui).out_of_range;
|
||||
check(ui, tl!("Vibrance"), vibrance, true, None);
|
||||
flow
|
||||
}
|
||||
|
||||
@@ -146,26 +146,27 @@ fn smudge_pressure_size(ui: &mut egui::Ui, app: &mut PhotocraftApp) {
|
||||
|
||||
/// The options of Blur, Sharpen and Smudge.
|
||||
pub(super) fn blur_sharpen_smudge(ui: &mut egui::Ui, app: &mut PhotocraftApp, tool: Tool) -> Option<RangeAlert> {
|
||||
let o = &mut app.ui.tool_options;
|
||||
if tool == Tool::Smudge {
|
||||
choose(ui, tl!("Mode"), &mut o.smudge_mode, &smudge_modes(), true, Some(tl!("Painting Mode")));
|
||||
choose(ui, tl!("Mode"), bind_tracked!(app.ui.tool_options => smudge_mode), &smudge_modes(), true, Some(tl!("Painting Mode")));
|
||||
}
|
||||
// The cell writes only on a commit, so a shared fraction is not rounded (#12650).
|
||||
let strength = number(tl!("Strength"), &mut o.strength, 1.0..=100.0).whole().unit("%").show(ui).out_of_range;
|
||||
let strength = number(tl!("Strength"), bind_tracked!(app.ui.tool_options => strength), 1.0..=100.0).whole().unit("%").show(ui).out_of_range;
|
||||
let angle = match tool {
|
||||
Tool::Smudge => smudge_angle(ui, app),
|
||||
Tool::Sharpen => brush_angle(ui, app),
|
||||
_ => None,
|
||||
};
|
||||
let o = &mut app.ui.tool_options;
|
||||
if let Some(all) = o.sample_all.slot(tool) {
|
||||
check(ui, tl!("Sample All Layers"), all, true, None);
|
||||
if let Some(all) = app.ui.tool_options.sample_all.slot(tool)
|
||||
&& let Some(next) = Checkbox::new(Bind::given(all)).label(tl!("Sample All Layers").to_owned()).show(ui).value().copied()
|
||||
&& let Some(slot) = app.ui.tool_options.sample_all.slot_mut(tool)
|
||||
{
|
||||
*slot = next;
|
||||
}
|
||||
if tool == Tool::Sharpen {
|
||||
check(ui, tl!("Protect Detail"), &mut o.protect_detail, true, None);
|
||||
check(ui, tl!("Protect Detail"), bind_tracked!(app.ui.tool_options => protect_detail), true, None);
|
||||
}
|
||||
if tool == Tool::Smudge {
|
||||
check(ui, tl!("Finger Painting"), &mut o.finger_painting, true, None);
|
||||
check(ui, tl!("Finger Painting"), bind_tracked!(app.ui.tool_options => finger_painting), true, None);
|
||||
smudge_pressure_size(ui, app);
|
||||
}
|
||||
strength.or(angle)
|
||||
@@ -176,7 +177,7 @@ pub(super) fn blur_sharpen_smudge(ui: &mut egui::Ui, app: &mut PhotocraftApp, to
|
||||
fn brush_angle(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Option<RangeAlert> {
|
||||
let before = (*app.session.tools.brush).clone();
|
||||
let mut brush = before.clone();
|
||||
let out = number(tl!("Angle"), &mut brush.angle, -180.0..=180.0)
|
||||
let out = number(tl!("Angle"), Bind::bound(&mut brush.angle), -180.0..=180.0)
|
||||
.whole()
|
||||
.unit("°")
|
||||
.icon(IconSpec::svg(IconId::new("rotate_cw")))
|
||||
@@ -190,28 +191,27 @@ fn brush_angle(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Option<RangeAlert>
|
||||
|
||||
/// The options of Color Replacement.
|
||||
pub(super) fn color_replacement(ui: &mut egui::Ui, app: &mut PhotocraftApp) -> Option<RangeAlert> {
|
||||
let o = &mut app.ui.tool_options;
|
||||
let modes = string_entries(&[("hue", tl!("Hue")), ("saturation", tl!("Saturation")), ("color", tl!("Color")), ("luminosity", tl!("Luminosity"))]);
|
||||
choose(ui, tl!("Mode"), &mut o.cr_mode, &modes, true, Some(tl!("Painting Mode")));
|
||||
choose(ui, tl!("Mode"), bind_tracked!(app.ui.tool_options => cr_mode), &modes, true, Some(tl!("Painting Mode")));
|
||||
Divider::vertical().show(ui);
|
||||
let sampling = [
|
||||
Entry::new("continuous".to_owned(), tl!("Sampling: Continuous")).icon(IconSpec::svg(IconId::new("eyedropper"))),
|
||||
Entry::new("once".to_owned(), tl!("Sampling: Once")).icon(IconSpec::svg(IconId::new("target"))),
|
||||
Entry::new("backgroundSwatch".to_owned(), tl!("Sampling: Background Swatch")).icon(IconSpec::svg(IconId::new("square"))),
|
||||
];
|
||||
if let Some(picked) = Segmented::new(tl!("Sampling"), Bind::given(o.cr_sampling.clone()), &sampling).show(ui).value().cloned() {
|
||||
o.cr_sampling = picked;
|
||||
if let Some(picked) = Segmented::new(tl!("Sampling"), Bind::given(app.ui.tool_options.cr_sampling.clone()), &sampling).show(ui).value().cloned() {
|
||||
app.ui.tool_options.cr_sampling = picked;
|
||||
}
|
||||
Divider::vertical().show(ui);
|
||||
let limits = string_entries(&[("discontiguous", tl!("Discontiguous")), ("contiguous", tl!("Contiguous")), ("findEdges", tl!("Find Edges"))]);
|
||||
choose(ui, tl!("Limits"), &mut o.cr_limits, &limits, true, Some(tl!("Determines the spread of replaced color")));
|
||||
let tolerance = number(tl!("Tolerance"), &mut o.cr_tolerance, 1.0..=100.0)
|
||||
choose(ui, tl!("Limits"), bind_tracked!(app.ui.tool_options => cr_limits), &limits, true, Some(tl!("Determines the spread of replaced color")));
|
||||
let tolerance = number(tl!("Tolerance"), bind_tracked!(app.ui.tool_options => cr_tolerance), 1.0..=100.0)
|
||||
.whole()
|
||||
.unit("%")
|
||||
.tooltip(tl!("Tolerance for choosing related colors"))
|
||||
.show(ui)
|
||||
.out_of_range;
|
||||
check(ui, tl!("Anti-alias"), &mut o.cr_anti_alias, true, Some(tl!("Anti-alias brush application")));
|
||||
check(ui, tl!("Anti-alias"), bind_tracked!(app.ui.tool_options => cr_anti_alias), true, Some(tl!("Anti-alias brush application")));
|
||||
tolerance
|
||||
}
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ fn dab_tools_send_their_bar_values() {
|
||||
let mut app = app();
|
||||
stripes(&mut app, 4, "pixels");
|
||||
app.run("layer.new.layer", json!({})).unwrap();
|
||||
*app.ui.tool_options.sample_all.slot(tool).unwrap() = all;
|
||||
*app.ui.tool_options.sample_all.slot_mut(tool).unwrap() = all;
|
||||
drag(&mut app, tool);
|
||||
let a = active(&app).surface().unwrap().rgba(30, 30)[3];
|
||||
assert_eq!(a > 0.0, all, "{tool:?} sampleAllLayers={all}: alpha {a}");
|
||||
@@ -301,7 +301,7 @@ fn dab_tools_send_their_bar_values() {
|
||||
for t in
|
||||
[Tool::MagicWand, Tool::QuickSelection, Tool::ObjectSelection, Tool::PaintBucket, Tool::MagicEraser, Tool::SpotHealing, Tool::Patch, Tool::Remove]
|
||||
{
|
||||
*others.slot(t).unwrap() = true;
|
||||
*others.slot_mut(t).unwrap() = true;
|
||||
}
|
||||
app.ui.tool_options.sample_all = others;
|
||||
assert!(!app.ui.tool_options.sample_all.get(tool));
|
||||
|
||||
@@ -6,7 +6,7 @@ use craft::draw::stroke::StrokeStyle;
|
||||
use craft::draw::ui::RADIUS_RANGE;
|
||||
use craft::draw::ui::shape::{ShapeAppearance, ShapeBar, ShapeChange, ShapePaint, ShapeToolSettings, ShapeWords};
|
||||
use craft::draw::ui::shape_drag::ShapeKind;
|
||||
use craft::ui::contract::{Bind, Props as _, Show as _, ShowContainer as _};
|
||||
use craft::ui::contract::{Bind, Props as _, Show as _, ShowContainer as _, bind_tracked};
|
||||
use craft::ui::dialog::{Alert, HostedAlert};
|
||||
use craft::ui::display::Divider;
|
||||
use craft::ui::form::Field;
|
||||
@@ -167,7 +167,7 @@ fn tool_extras(app: &mut PhotocraftApp, ui: &mut egui::Ui, tool: Tool) {
|
||||
// The tool's own corner radius for the next polygon, after Sides (#13302); the active shape is not touched.
|
||||
// A value typed past the Rectangle Radius's range takes the closest one and says so.
|
||||
Divider::vertical().show(ui);
|
||||
let out = crate::option_cells::number(tl!("Radius"), &mut app.ui.tool_options.polygon_corner_radius, RADIUS_RANGE).unit("px").show(ui);
|
||||
let out = crate::option_cells::number(tl!("Radius"), bind_tracked!(app.ui.tool_options => polygon_corner_radius), RADIUS_RANGE).unit("px").show(ui);
|
||||
if let Some(alert) = out.out_of_range {
|
||||
crate::option_cells::range_alert(app, ui, &alert);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
/// Colour and width stay in their existing controls. These options never replace a shape's paint.
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, craft::ui::contract::PlainData)]
|
||||
#[serde(default)]
|
||||
pub struct StrokeOptions {
|
||||
pub align: StrokeAlign,
|
||||
|
||||
@@ -98,7 +98,7 @@ fn reset_tool(app: &mut PhotocraftApp, tool: Tool) {
|
||||
fn reset_all(app: &mut PhotocraftApp) {
|
||||
crate::frame_tool::clear(app);
|
||||
app.ui.frame_tool = Default::default();
|
||||
app.ui.tool_options = ToolOptions::default();
|
||||
*app.ui.tool_options = ToolOptions::default();
|
||||
app.ui.artboard_tool = Default::default();
|
||||
app.ui.selection_mode = 0;
|
||||
reset_session_brush(app);
|
||||
@@ -162,7 +162,7 @@ pub fn reset_options(o: &mut ToolOptions, tool: Tool) {
|
||||
}
|
||||
// Sample All Layers is each tool's own (#5524): only `tool`'s goes back.
|
||||
let d = ToolOptions::default();
|
||||
if let Some(all) = o.sample_all.slot(tool) {
|
||||
if let Some(all) = o.sample_all.slot_mut(tool) {
|
||||
*all = d.sample_all.get(tool);
|
||||
}
|
||||
}
|
||||
@@ -172,7 +172,7 @@ pub fn reset_options(o: &mut ToolOptions, tool: Tool) {
|
||||
pub fn sample_all_key(tool: Tool) -> Option<String> {
|
||||
let base = crate::state::SampleAllLayers::default();
|
||||
let mut probe = base;
|
||||
let slot = probe.slot(tool)?;
|
||||
let slot = probe.slot_mut(tool)?;
|
||||
*slot = !*slot;
|
||||
let (Ok(Value::Object(b)), Ok(Value::Object(m))) = (serde_json::to_value(base), serde_json::to_value(probe)) else { return None };
|
||||
m.into_iter().find(|(k, v)| b.get(k) != Some(v)).map(|(k, _)| k)
|
||||
@@ -381,7 +381,7 @@ mod tests {
|
||||
|
||||
let dialog = crate::menus::invoke(&mut app, &ctx, RESET_ALL, json!({})).unwrap()["dialog"].as_str().unwrap().to_string();
|
||||
assert_eq!(answer_dialog(&mut app, &ctx, "ui.dialog.confirm", &dialog)["ok"], true);
|
||||
assert_eq!(app.ui.tool_options, ToolOptions::default());
|
||||
assert_eq!(*app.ui.tool_options, ToolOptions::default());
|
||||
assert!(!app.dialog_open());
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ enum Action {
|
||||
#[derive(Clone, Copy)]
|
||||
struct ShownRect {
|
||||
session: u64,
|
||||
pass: u64,
|
||||
rect: [f32; 4],
|
||||
}
|
||||
|
||||
@@ -57,13 +56,16 @@ pub fn eligible(app: &PhotocraftApp) -> bool {
|
||||
pub(crate) fn shown_rect(app: &PhotocraftApp, ctx: &egui::Context) -> Option<[f32; 4]> {
|
||||
let session = open_box(app)?.id;
|
||||
let shown = ctx.data(|data| data.get_temp::<ShownRect>(shown_id()))?;
|
||||
let pass = ctx.cumulative_pass_nr_for(egui::ViewportId::ROOT);
|
||||
(shown.session == session && pass.checked_sub(shown.pass).is_some_and(|age| age <= 1)).then_some(shown.rect)
|
||||
(shown.session == session).then_some(shown.rect)
|
||||
}
|
||||
|
||||
/// Called on the document's primary canvas, where the framework shows its transform.
|
||||
pub fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui, area: egui::Rect) {
|
||||
let Some(transform) = open_box(app) else { return };
|
||||
// The canvas run that shows the bar records where; a replay of that run shows it there still.
|
||||
let Some(transform) = open_box(app) else {
|
||||
ui.ctx().data_mut(|data| data.remove::<ShownRect>(shown_id()));
|
||||
return;
|
||||
};
|
||||
let (session, corners) = (transform.id, transform.session.quad());
|
||||
let ctx = ui.ctx().clone();
|
||||
let mut place = app.ui.panels.task_bar;
|
||||
@@ -106,10 +108,9 @@ pub fn show(app: &mut PhotocraftApp, ui: &mut egui::Ui, area: egui::Rect) {
|
||||
if shown.output.hide {
|
||||
app.ui.panels.context_task_bar = false;
|
||||
}
|
||||
let pass = ctx.cumulative_pass_nr_for(egui::ViewportId::ROOT);
|
||||
if open_box(app).is_some_and(|t| t.id == session) {
|
||||
let r = shown.output.rect;
|
||||
ctx.data_mut(|data| data.insert_temp(shown_id(), ShownRect { session, pass, rect: [r.min.x, r.min.y, r.max.x, r.max.y] }));
|
||||
ctx.data_mut(|data| data.insert_temp(shown_id(), ShownRect { session, rect: [r.min.x, r.min.y, r.max.x, r.max.y] }));
|
||||
} else {
|
||||
ctx.data_mut(|data| data.remove::<ShownRect>(shown_id()));
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ pub(crate) fn wake(app: &mut PhotocraftApp, ctx: &egui::Context) {
|
||||
p.ctx = Some(ctx.clone());
|
||||
}
|
||||
if p.running.is_some() {
|
||||
ctx.request_repaint_after(std::time::Duration::from_millis(POLL_MS));
|
||||
craft::ui::runtime::frame::request_repaint_after(ctx, std::time::Duration::from_millis(POLL_MS).as_secs_f64());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loaded 100 of 120 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user