DesignCraft: An open-source page and layout design editor written by scratch in pure Rust
Merge upstream main into keymap-adoption; pin craft-libs to main e3b9e239
aiongg073ac98694b8
diff --cc Cargo.lockindex e9001af76,e278722b7..0479123c2--- a/Cargo.lock+++ b/Cargo.lock@@@ -820,7 -950,7 +950,7 @@@ dependencies =[[package]]name = "craft-atomic"version = "0.1.0"- source = "git+https://github.com/storytold/craft-libs?rev=e9546e191dd62f2bc1d61eca45dbdc2f1b3c1d8e#e9546e191dd62f2bc1d61eca45dbdc2f1b3c1d8e"-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"dependencies = ["rustix 1.1.5",]@@@ -828,7 -958,7 +958,7 @@@[[package]]name = "craft-cms"version = "0.1.0"- source = "git+https://github.com/storytold/craft-libs?rev=e9546e191dd62f2bc1d61eca45dbdc2f1b3c1d8e#e9546e191dd62f2bc1d61eca45dbdc2f1b3c1d8e"-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"dependencies = ["rayon",]@@@ -836,22 -966,12 +966,22 @@@[[package]]name = "craft-docpath"version = "0.1.0"- source = "git+https://github.com/storytold/craft-libs?rev=82a24b006eefa036b43c09a67fb9a3fbd17ffe63#82a24b006eefa036b43c09a67fb9a3fbd17ffe63"-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"++[[package]]+name = "craft-keymap"+version = "0.1.0"- source = "git+https://github.com/aiongg/craft-libs?rev=9aaf9dfd3882c12b6aab5604cc2567fc3b64127b#9aaf9dfd3882c12b6aab5604cc2567fc3b64127b"++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"+dependencies = [+ "egui",+ "serde",+ "serde_json",+][[package]]name = "craft-pdf"version = "0.1.0"- source = "git+https://github.com/storytold/craft-libs?rev=89dcbb3060377a26c99a6d80caa16084366704c4#89dcbb3060377a26c99a6d80caa16084366704c4"-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"dependencies = ["bytemuck","hayro",@@@ -864,20 -984,48 +994,48 @@@[[package]]name = "craft-print"version = "0.1.0"- source = "git+https://github.com/storytold/craft-libs?rev=d991bf6792f8ade99c51358bf3c1d902c8cd96b5#d991bf6792f8ade99c51358bf3c1d902c8cd96b5"-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"dependencies = [+ "craft-winprint-gdi",+ "miniz_oxide 0.8.9",+ "roxmltree 0.20.0","tempfile",+ "winprint",+ "winsafe",][[package]]name = "craft-ui"version = "0.1.0"- source = "git+https://github.com/storytold/craft-libs?rev=5c874d51eeb3de70e735c8ce87a59a7dedd47675#5c874d51eeb3de70e735c8ce87a59a7dedd47675"-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"dependencies = ["egui",+ "log",+ "objc2 0.6.4",+ "objc2-app-kit 0.3.2",+ "objc2-foundation 0.3.2","serde",]+ [[package]]+ name = "craft-window"+ version = "0.1.0"-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"+ dependencies = [+ "egui",+ "objc2 0.6.4",+ "objc2-app-kit 0.3.2",+ "wayland-client",+ ]++ [[package]]+ name = "craft-winprint-gdi"+ version = "0.1.0"+ source = "git+https://github.com/storytold/winprint.rs?rev=417ac3c4d14d3da5485a99c7d5ce8f05664ec312#417ac3c4d14d3da5485a99c7d5ce8f05664ec312"+ dependencies = [+ "windows-sys 0.61.2",+ ]+[[package]]name = "crc32fast"version = "1.5.2"@@@ -1246,10 -1443,10 +1453,11 @@@ dependencies =[[package]]name = "designcraft-ui-egui"- version = "0.12.0"+ version = "0.13.0"dependencies = [+ "craft-keymap","craft-ui",+ "craft-window","designcraft-color","designcraft-compose","designcraft-doc",@@@ -2134,7 -2471,7 +2482,7 @@@ dependencies =[[package]]name = "hayro"version = "0.7.1"- source = "git+https://github.com/storytold/craft-libs?rev=89dcbb3060377a26c99a6d80caa16084366704c4#89dcbb3060377a26c99a6d80caa16084366704c4"-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"dependencies = ["bytemuck","hayro-interpret",@@@ -2154,8 -2491,7 +2502,7 @@@ checksum = "9f4d0e94ddd48749f06bbe4e538[[package]]name = "hayro-cmap"version = "0.1.0"- source = "registry+https://github.com/rust-lang/crates.io-index"- checksum = "24d285dc30731c8485de5fa732fbdf2b3affdf01e4da7c2135022ca6fa664bf6"-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"dependencies = ["brotli","hayro-postscript",@@@ -2164,7 -2500,7 +2511,7 @@@[[package]]name = "hayro-interpret"version = "0.7.0"- source = "git+https://github.com/storytold/craft-libs?rev=89dcbb3060377a26c99a6d80caa16084366704c4#89dcbb3060377a26c99a6d80caa16084366704c4"-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"dependencies = ["bitflags 2.13.2","hayro-cmap",@@@ -2182,7 -2518,7 +2529,7 @@@[[package]]name = "hayro-jbig2"version = "0.3.0"- source = "git+https://github.com/storytold/craft-libs?rev=89dcbb3060377a26c99a6d80caa16084366704c4#89dcbb3060377a26c99a6d80caa16084366704c4"-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"dependencies = ["fearless_simd","hayro-ccitt",@@@ -2200,13 -2536,12 +2547,12 @@@ dependencies =[[package]]name = "hayro-postscript"version = "0.1.0"- source = "registry+https://github.com/rust-lang/crates.io-index"- checksum = "885c5ef0654933139a9b9546fc2c69e18d37f38aa2520f079092b1be18f1fcaa"-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"[[package]]name = "hayro-syntax"version = "0.7.2"- source = "git+https://github.com/storytold/craft-libs?rev=89dcbb3060377a26c99a6d80caa16084366704c4#89dcbb3060377a26c99a6d80caa16084366704c4"-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"dependencies = ["flate2","hayro-ccitt",@@@ -2570,9 -3042,9 +3053,9 @@@ dependencies =[[package]]name = "krilla"version = "0.8.2"- source = "git+https://github.com/storytold/craft-libs?rev=89dcbb3060377a26c99a6d80caa16084366704c4#89dcbb3060377a26c99a6d80caa16084366704c4"-source = "git+https://github.com/storytold/craft-libs?rev=a0916808f7d78bed8c7b90cdf937176015454a7f#a0916808f7d78bed8c7b90cdf937176015454a7f"++source = "git+https://github.com/storytold/craft-libs?rev=e3b9e239c52c14677be462e94d8920ea243de4f3#e3b9e239c52c14677be462e94d8920ea243de4f3"dependencies = [- "base64",+ "base64 0.22.1","bumpalo","flate2","float-cmp",diff --cc Cargo.tomlindex c0e3d8f19,afa0d7be9..b1109a31d--- a/Cargo.toml+++ b/Cargo.toml@@@ -12,9 -12,7 +12,9 @@@ repository = "https://github.com/storyt[workspace.dependencies]# Shared reader and writer; publish the immutable revision before this consumer.- craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "89dcbb3060377a26c99a6d80caa16084366704c4", version = "=0.1.0", default-features = false }-craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.1.0", default-features = false }++craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.1.0", default-features = false }+# Shared keyboard bindings: chords, overrides, conflicts, egui dispatch.- craft-keymap = { git = "https://github.com/aiongg/craft-libs", rev = "9aaf9dfd3882c12b6aab5604cc2567fc3b64127b", version = "=0.1.0", features = ["egui"] }++craft-keymap = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.1.0", features = ["egui"] }# internaldesigncraft-geom = { path = "crates/geom" }designcraft-color = { path = "crates/color" }@@@ -77,22 -75,26 +77,26 @@@ zip = { version = "3", default-featureindd = { git = "https://github.com/storytold/indd-utils", branch = "main" }# Which paths stored in documents may be followed (craft-libs).- craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "82a24b006eefa036b43c09a67fb9a3fbd17ffe63" }-craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f" }++craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3" }# Atomic file replacement for saves and exports (craft-libs).- craft-atomic = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e9546e191dd62f2bc1d61eca45dbdc2f1b3c1d8e" }-craft-atomic = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f" }++craft-atomic = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3" }# File › Print through the system print spooler (craft-libs).- craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "d991bf6792f8ade99c51358bf3c1d902c8cd96b5" }-craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f" }++craft-print = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3" }# ICC colour management: working spaces, transforms, black point compensation (craft-libs).- craft-cms = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e9546e191dd62f2bc1d61eca45dbdc2f1b3c1d8e" }-craft-cms = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f" }++craft-cms = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3" }# ui# Shared frontend components; keep this dependency above the engine boundary.- craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "5c874d51eeb3de70e735c8ce87a59a7dedd47675", features = ["serde"] }- egui = "0.36"- egui_extras = { version = "0.36", default-features = false, features = ["svg"] }- eframe = { version = "0.36", default-features = false }- egui_kittest = "0.36"-craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", features = ["serde"] }++craft-ui = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", features = ["serde"] }+ # The application bar as the window's title bar (craft-libs).-craft-window = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", features = ["egui"] }++craft-window = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", features = ["egui"] }+ egui = "0.37"+ egui_extras = { version = "0.37", default-features = false, features = ["svg"] }+ eframe = { version = "0.37", default-features = false }+ egui_kittest = "0.37"+ # Monotonic clock on native and web (`Instant`); screenshot settlement must not use wall time.+ web-time = "1"rfd = "0.17"arboard = { version = "3.6", default-features = false }@@@ -124,9 -126,25 +128,25 @@@ debug =# Opt-in cancelable macOS termination on the pinned winit 0.30 line.[patch.crates-io]- krilla = { git = "https://github.com/storytold/craft-libs", rev = "89dcbb3060377a26c99a6d80caa16084366704c4", version = "=0.8.2" }- winit = { git = "https://github.com/storytold/winit.git", rev = "3d51077fd1a966f84df9ef287839dc84fd5b4ca7" }- hayro = { git = "https://github.com/storytold/craft-libs", rev = "89dcbb3060377a26c99a6d80caa16084366704c4", version = "=0.7.1" }- hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "89dcbb3060377a26c99a6d80caa16084366704c4", version = "=0.7.0" }- hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "89dcbb3060377a26c99a6d80caa16084366704c4", version = "=0.7.2" }- hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "89dcbb3060377a26c99a6d80caa16084366704c4", version = "=0.3.0" }-krilla = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.8.2" }++krilla = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.8.2" }+ winit = { git = "https://github.com/storytold/winit.git", rev = "a517b3846ee8457d84ee4975110bfda6797c44dc" }-hayro = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.7.1" }-hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.7.0" }-hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.7.2" }-hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.3.0" }-hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.1.0" }-hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "a0916808f7d78bed8c7b90cdf937176015454a7f", version = "=0.1.0" }++hayro = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.7.1" }++hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.7.0" }++hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.7.2" }++hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.3.0" }++hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.1.0" }++hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "e3b9e239c52c14677be462e94d8920ea243de4f3", version = "=0.1.0" }+ ecolor = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }+ emath = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }+ epaint = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }+ epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }+ egui = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }+ egui-winit = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }+ egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }+ egui_glow = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }+ egui_extras = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }+ egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }+ egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }+ eframe = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }+ egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }+ egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "6d518fc799681571963842f95b55a6b68431b15a" }diff --cc ROADMAP.mdindex e2ebee2bd,6a3696361..54be5345d--- a/ROADMAP.md+++ b/ROADMAP.md@@@ -348,12 -381,43 +381,46 @@@ list) · [roadmap.md](docs/roadmap.md)Newest first.+- **2026-10-19** · Import InDesign Set… runs on craft-keymap's importer: a set's Window menu panel items (Layers F7, Pages F12, Swatches F5) and Tools items set the panel and tool shortcuts, all of an item's Default keys apply, and the report adds numeric keypad keys read as main keys and likely commands for unmatched items (`window.importShortcuts`). On InDesign's Windows defaults it matches 366 of 1,629 items (was 233) and changes 23 commands. No readiness percentage change.+- **2026-10-19** · Keyboard shortcuts run on the shared craft-keymap crate. Panels take shortcuts, with InDesign's defaults where the key is free (Swatches F5, Color F6, Layers F7, Info F8, Stroke F10, Paragraph Styles F11, Character Styles Shift+F11, Pages F12, Align Shift+F7); tool keys are editable in Edit › Keyboard Shortcuts and `window.setShortcut`, and tools sharing a key take turns (B). Saved shortcuts load unchanged. No readiness percentage change.+- **2026-10-16** · Edit › Keyboard Shortcuts imports a set saved by InDesign's Show Set (.txt, Windows or Mac key names, UTF-8 or UTF-16): matched commands take its Default shortcuts or lose theirs, other commands give up keys it takes, and a report lists what it changed and the items it could not match (`window.importShortcuts`, #1180). Tool keys stay fixed. No readiness percentage change.+ - **2026-10-24** · Panels dock through the suite's shared docking (craft-libs), and on desktop a floating panel opens in its own window that can leave the main window: keys pressed there run the main window's shortcuts, clipboard and tool keys, and the canvas paints no tool cursor while another of the app's windows has the pointer. The web build keeps floating panels in the page. No readiness percentage change.+ - **2026-10-24** · Story Options rejects malformed or nonexistent explicit story/frame IDs without changing the selected story, including an invalid frame alongside a valid story. Null targets remain absent; omitted targets still use the selection. No readiness percentage change.+ - **2026-10-24** · Text Frame Options explains that a custom baseline-grid increment must be a measure greater than zero when zero, a negative value or a non-measure is entered. Validation is unchanged. No readiness percentage change.+ - **2026-10-24** · Renaming a paragraph or character style, or moving it into a style group, keeps its Export Tagging under the new name, and undo puts it back under the old one. Deleting a tagged style drops its tagging and leaves the replacement style's own tagging as it was. No readiness percentage change.+ - **2026-10-24** · Quick Apply and the application bar's search leave out the interface commands that failed or reset a setting when chosen there: those that need a workspace, a command and shortcut, a menu item, a panel, a window edge, an app page, a recent file or a swatch they can't give them, a Contextual Task Bar place, and Interface Color Theme, UI Scaling, Reset Shortcuts, the flattener preset, Screen Mode and Zoom To, which without a value switched to the dark theme, set 100%, cleared every custom shortcut or the preset, or went to Normal mode or 100% zoom. Each stays in the menu, panel or dialog that gives it the value. No readiness percentage change.+ - **2026-10-24** · EPUB Export Options › Split Document, a dialog before File › Export EPUB… saves (`document.epubSplit`, stored with the document): off, a single paragraph style, or based on paragraph style export tags, with Paragraph Style Options › Export Tagging's Split Document flag marking those styles. A reflowable EPUB is one content file unless Split Document is on; the split before each top-level h1 from #791 is gone. A split before a list item or preformatted line no longer leaves an unclosed list or block in a content file. IDML import and export keep the setting and the flag, and Load Styles the flag. No readiness percentage change.+ - **2026-10-18** · Repeated placed-PDF layer variants are prepared once per asset and hidden-name set, with recovery warnings retained. All-visible named layers keep their original source bytes, including PDFs whose cross-reference tables the reader repairs, in plain, PDF/X-4, booklet and book-merge output. Layer changes that require writing still reject an unusable cross-reference table with a file-named damage error; the first placement error is retained (#906). No readiness percentage change.+ - **2026-10-18** · Placed PDF optional-content defaults and per-frame overrides survive plain and PDF/X-4 vector export, including repeated placements, booklet output and book merging (#906). Source usage-application arrays are accepted; groups without a catalog configuration stay visible. Missing or unreadable default configurations and unsupported base states use all-ON defaults with a file-named export warning, retaining explicit frame overrides. Readable groups omitted from the catalog list are added with a distinct file-named warning, preserving their default ON/OFF states. Concurrent recovery warnings are combined. Malformed ON data is recoverable when a known ON base and empty OFF list prove it cannot hide artwork; missing display names are generated without changing known visibility when no override needs name matching. Contradictory states, unresolved references and ambiguous name overrides still fail export. Print-usage adjustments and IDML layer overrides remain follow-ups. No readiness percentage change.++ - **2026-10-24** · Optical Margin Alignment and hanging punctuation apply to lines with a tab or a right indent tab, as both composers already measured them: the edge glyphs hang, and tab stops stay where they are. Such a line was set without the hang: a justified line that fit only because its period or closing quote hangs had its word spaces squeezed to make up for it, and text after a right indent tab stopped at the measure instead of hanging. No readiness percentage change.+ - **2026-10-23** · `designcraft-cli mcp` takes `--automation-read-root` and `--automation-write-root` more than once, as the suite's other apps do (#1552): a path inside any root of its kind passes, and the roots' common parent, `..` or a link out of them and the other kind's roots stay refused. No readiness percentage change.+ - **2026-10-23** · Layout › Go Back and Go Forward (Cmd+Page Up / Cmd+Page Down, Ctrl on Windows and Linux) retrace the jumps between pages (Go to Page, the page and spread commands, the Pages panel) as InDesign's do, returning to where the view was on each page at the current zoom; a new jump after going back drops the pages ahead, scrolling adds no entry, and pages deleted since are skipped. No readiness percentage change.+ - **2026-10-24** · Split Note (`note.split {story, id, at}`, the Notes panel's Split Note button): as in InDesign, a note splits in two at the insertion point in its text. DesignCraft moves the text after it into a new note by the same author, anchored right after the first. No readiness percentage change.+ - **2026-10-24** · Type › Notes › Previous Note and Next Note (`note.previous`, `note.next`): as in InDesign, they move the insertion point from note to note in the story, putting the caret after the note's anchor. Each item is unavailable when no note lies in its direction in the story, or when the insertion point is in a table cell or a footnote. No readiness percentage change.+ - **2026-10-24** · Type › Notes › Convert to Note (`note.convertFromText {author?}`): as in InDesign, the selected text leaves the story and becomes the text of a new note, whose anchor takes its place; Convert Note to Text puts it back. DesignCraft refuses a selection in a table cell, or one that holds a note, footnote, endnote, anchored object, index marker, text anchor, cross-reference or table. No readiness percentage change.+ - **2026-10-23** · Effects dialog: with Use Global Light on, the Angle field (and the Bevel and Emboss one) stays editable and shows the document's global light angle; a change there sets the global light for every effect that uses it, applied with the effects in one undo step (`object.effects` takes `globalLight`). Before, the field was greyed out and the angle couldn't be changed in the dialog. No readiness percentage change.+ - **2026-10-24** · Story panel (Window › Type & Tables › Story): Optical Margin Alignment and its size for the stories of the text selection or the selected text frames, disabled without either; `type.selectionAttrs` reports them as `storyOptions`, null where the stories differ. The Paragraph panel menu has Ignore Optical Margin in place of the per-paragraph Optical Margin Alignment switch, which stays in `type.para`, and Paragraph Style Options › Indents and Spacing has Ignore Optical Margin (#947). No readiness percentage change.+ - **2026-10-24** · Optical Margin Alignment per story with a size (`story.options {opticalMargin, opticalMarginSize}`, off by default): when it is on, the story's paragraphs hang punctuation and letter edges by amounts set for that type size, except paragraphs with Ignore Optical Margin (`ignoreOpticalMargin` in `type.para` and paragraph styles). Table cells and footnotes don't take the story setting yet. When it is off, the per-paragraph switch still hangs at the text's own size. IDML imports and exports both (`StoryPreference/@OpticalMarginAlignment`, `@OpticalMarginSize`, `IgnoreEdgeAlignment`) (#947). No readiness percentage change.+ - **2026-10-24** · Text frames: a custom baseline grid's Relative To (Text Frame Options › Baseline Options, `object.textFrameOptions {baselineGrid: {relativeTo}}`, IDML `BaselineFrameGridRelativeOption`) measures the grid's start from the top of the page, the top margin, the top of the frame or its top inset. Text Frame Options had no custom baseline grid controls, imports dropped the setting and every frame grid started from the page top, so grid-aligned text in a frame measured from its own top sat on the wrong lines. No readiness percentage change.+ - **2026-10-24** · Paragraph Style Options › Indents and Spacing has an Align to Grid menu: None, All Lines or First Line Only. It shows the style's current setting. A First Line Only style could be set only in the CJK Grid Settings section, which shows only with CJK features on, or through commands. No readiness percentage change.+ - **2026-10-24** · Anchored text frames, such as marginal notes, compose where their host story places them: they align to the baseline grid at that position, and page-number markers and spine-relative alignment inside them read the host's page. They composed against a grid measured from their stored position and on no page, so a note set to Only Align First Line to Grid could sit a fraction of a line off the body text's grid line. No readiness percentage change.+ - **2026-10-24** · Tables: a gradient swatch in a cell fill draws as a gradient on the canvas and in PDF, in one gradient space for the whole table, so it runs across cells without restarting. Cells showed the gradient's first stop as a solid colour. No readiness percentage change.+ - **2026-10-24** · New documents start with Hyphenate Capitalized Words, Hyphenate Last Word and Hyphenate Across Column off in [Basic Paragraph], as in InDesign. Opened and imported files keep the values they carry. No readiness percentage change.+ - **2026-10-24** · The baseline grid's Relative To setting applies: with Top Margin, the grid starts at each page's own top margin in text composition, on the canvas and for snapping. It started at the page top, so grid-aligned text sat on the wrong lines and a page could fit one line fewer. No readiness percentage change.+ - **2026-10-24** · Custom-positioned anchored objects honour Relative to Spine (`anchored.options {spineRelative}`, IDML `SpineRelative`): the settings describe a left-hand page and mirror on a right-hand page, so marginal notes stay in the outside margin on both pages of a spread. On right-hand pages they took the left-hand placement and landed in the inside margin, across the spine or over the body text. No readiness percentage change.+ - **2026-10-24** · Text frames: a custom baseline grid (Text Frame Options › Baseline Options) from an IDML file sets lines from its start by its increment. The composer read the two values in the other order, so lines landed on the wrong grid. No readiness percentage change.+ - **2026-10-23** · File › File Info… edits the document's Document Title, Author, Description, Keywords, Copyright Notice and Copyright Info URL (`file.info`), and the document saves them. PDF export (PDF/X-4 and Print Booklet included) writes the title, author, description and keywords into the PDF's document information and XMP. EPUB export takes the title and author from File Info, and HTML export takes the title. A title or author given to the export replaces File Info's, and an empty Document Title leaves the document's name as the title. No readiness percentage change.+ - **2026-10-23** · Save and export dialogs (Save As, Save a Copy, Export PDF and the other exports, Package, libraries and books) start in the active document's folder once it has been saved, and for a document never saved in the folder of the last file saved or exported, remembered across sessions (#1653). A folder deleted since falls back to the system's choice. No readiness percentage change.+ - **2026-10-22** · Autoflow (Shift-click with the loaded text cursor, autoflow on Place, `text.thread {autoflow}`) fills the pages that follow before it adds any, as InDesign does: one frame per column on each following page, whatever else the page holds, then new pages at the end of the document. It inserted pages right after the story's last frame, in front of the document's own pages. Frames it set past the end of the text go again; a page the document had stays, and a page autoflow added only for such a frame goes with it. Smart Text Reflow of the primary text frame is unchanged. No readiness percentage change.- **2026-10-16** · Edit › Keyboard Shortcuts imports a set saved by InDesign's Show Set (.txt, Windows or Mac key names, UTF-8 or UTF-16): matched commands take its Default shortcuts or lose theirs, other commands give up keys it takes, and a report lists what it changed and the items it could not match (`window.importShortcuts`, #1180). Tool keys stay fixed. No readiness percentage change.+ - **2026-10-23** · Translations: a missing string shows in English and fails no test; `cargo xtask i18n-report`, run by `cargo xtask ci`, prints the missing strings per language. Tests keep duplicate-key and placeholder checks and the language mechanics (lookup, context captions, plural captions, right-to-left). No readiness percentage change.+ - **2026-10-22** · Hyphenation Settings, as in InDesign: the Paragraph panel menu's Hyphenation… (`app.hyphenationDialog`) sets the selected paragraphs' Hyphenate, Words with at Least, After First, Before Last, Hyphen Limit, Hyphenation Zone, the Better Spacing ↔ Fewer Hyphens slider (InDesign's 0–10 steps), Hyphenate Capitalized Words, Last Word and Across Column, with Preview, as one undo step; Paragraph Style Options › Hyphenation has the same form. The panel menu lists its items in InDesign's order. Replicated from a hyphenation tutorial: the same text in Minion Pro breaks into the same lines as InDesign's with hyphenation on, off, and at Fewer Hyphens. No readiness percentage change.+ - **2026-10-22** · Hyphenate Across Column (Hyphenation Settings; IDML HyphenateAcrossColumns) is applied: with it off, a paragraph whose line ending in an automatic hyphen would end a column or frame is re-composed without that hyphenation point, so the word moves on whole, as in InDesign. Opened and imported files keep their own setting, so their layouts don't change. No readiness percentage change.+ - **2026-10-22** · The Paragraph panel is laid out as InDesign's: the nine alignment buttons in groups; indent, spacing and drop cap fields by their icons in two columns, with Space Between Paragraphs Using Same Style (Ignore or a space); Shading and Border with the Paragraph Borders and Shading button and colour; Hyphenate with Do Not Align / Align to Baseline Grid. Its panel menu follows InDesign's order: Paragraph and Single-line Composer, Only Align First Line to Grid, Balance Ragged Lines, Optical Margin Alignment, Justification…, Keep Options…, Span Columns…, Hyphenation…, Drop Caps and Nested Styles…, GREP Styles… (these three now open for the selected paragraphs), Paragraph Rules…, Paragraph Borders and Shading…, Bullets and Numbering…, Restart/Continue Numbering, Define Lists… and the paragraph direction. Convert Bullets and Numbering to Text is listed but not available yet. No readiness percentage change.- **2026-10-22** · A ruler guide dragged with the Selection tools, out of a ruler, on its own or with other selected guides, snaps along its axis as objects do (#1221): to other ruler guides, margins, columns, bleed, page and object edges and centers (with the smart-guide mark) and the document grid, within the snap zone and following Snap to Guides and Smart Guides. Shift snaps to the ruler's ticks and Cmd suspends snapping. The preview line, the position readout and the drop use the same snapped position. No readiness percentage change.- **2026-10-22** · macOS: the app menu has a Language submenu after Settings… with each interface language in its own name and the current one checked, as in the suite's other apps; Preferences › General › Interface Language stays. No readiness percentage change.+ - **2026-10-23** · Type › Text Variables › Convert Variable to Text (`variables.convertToText`): the variable instances in the selected text, in a story, a table cell or a footnote, become plain text of the value each shows on its own page (a running header on page 3 becomes page 3's heading). `variables.convertAllToText {name}` does the same for every instance of one variable in the document, as the Text Variables dialog's Convert to Text button. The variable stays defined; one undo step. No readiness percentage change.- **2026-10-22** · macOS menu bar: the menus keep working after the interface language or Show CJK Features changes (a rebuilt menu bar lost every click, Quit included), and its key equivalents are the shortcuts in effect, so a shortcut moved in the Keyboard Shortcuts editor leaves its old menu item. No readiness percentage change.- **2026-10-22** · Paragraph rules: Rule Above's offset is measured from the first line's baseline to the rule's bottom edge, as in InDesign. Rules sat one ascent too high and crossed the previous paragraph's text (reported from an imported INDD document). No readiness percentage change.- **2026-10-21** · Ruler guides are selected like objects (#1282): a click with the Selection tools selects a guide (also where it crosses an object), Shift-click adds or removes one, a new guide from the rulers is selected, a marquee that touches no object selects the guides it crosses, and Edit › Select All Guides (⌥⌘G, `guide.selectAll`) selects every unlocked guide on the spread. Selected guides draw thicker in their layer's color, drag together (all of them shown moving), nudge with the arrow keys and go with Delete, each as one undo step (`guide.select`, `guide.deselect`, `guide.moveBy`, `guide.delete {}`). With one guide selected the Control bar's X (vertical guide) or Y (horizontal guide) field and Properties › Transform show where it is, as the rulers measure, and typing a value moves it there. No readiness percentage change.diff --cc apps/designcraft/src/main.rsindex af2f22b21,12f423d79..4a74d23f9--- a/apps/designcraft/src/main.rs+++ b/apps/designcraft/src/main.rs@@@ -149,10 -178,16 +178,17 @@@ fn load_prefs(app: &mut DesignApp)}if let Some(p) = prefs_path()&& let Ok(bytes) = std::fs::read(&p)- && let Ok(ui) = designcraft_ui_egui::UiState::from_preferences_json(&bytes){- app.ui = ui;+ match designcraft_ui_egui::UiState::read_preferences(&bytes) {+ Ok(read) => {+ app.ui = read.ui;+ if !read.intact {+ keep_unreadable_prefs(&p, &bytes);+ }+ }+ Err(_) => keep_unreadable_prefs(&p, &bytes),+ }+ app.sync_keymap();}// Engine preferences (Preferences dialog, favourites…) live beside the UI state.if let Some(p) = prefs_path().map(|p| p.with_file_name("prefs.json"))diff --cc crates/tools/src/lib.rsindex 262c6b4a8,8ec32fe8c..bb6b9b90c--- a/crates/tools/src/lib.rs+++ b/crates/tools/src/lib.rs@@@ -31,9 -31,11 +31,11 @@@ use designcraft_geom::{Affine, BezPathuse serde::{Deserialize, Serialize};use serde_json::Value;-pub use catalog::{SPLIT_IN_TWO_COLUMNS, TOOL_GROUPS, ToolInfo, tool_for_shortcut, tool_info};+pub use catalog::{SPLIT_IN_TWO_COLUMNS, TOOL_GROUPS, ToolInfo, tool_info};pub use layout::{CanvasLayout, SpreadSlot};pub use nav::ZoomTool;+ /// The exact text an IME commit types (see [`Tool::ime_commit`]).+ pub use text::ime_commit_text;#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]pub struct Mods {diff --cc crates/ui-egui/Cargo.tomlindex c780f3647,0a826b69e..fc4d37a21--- a/crates/ui-egui/Cargo.toml+++ b/crates/ui-egui/Cargo.toml@@@ -10,8 -10,8 +10,9 @@@ description = "DesignCraft egui frontenworkspace = true[dependencies]- craft-ui = { workspace = true }+ craft-ui = { workspace = true, features = ["native-windows"] }+ craft-window = { workspace = true }+craft-keymap = { workspace = true }designcraft-geom = { workspace = true }designcraft-color = { workspace = true }designcraft-doc = { workspace = true }diff --cc crates/ui-egui/src/lib.rsindex 389cf0c7d,95d53b798..f93948cd5--- a/crates/ui-egui/src/lib.rs+++ b/crates/ui-egui/src/lib.rs@@@ -251,23 -321,29 +322,31 @@@ pub struct UiStatepub rich_black: bool,/// View › Overprint Preview.pub overprint_preview: bool,- /// Edit › Keyboard Shortcuts: command id → shortcut ("" = none), over the defaults.- pub shortcuts: std::collections::BTreeMap<String, String>,+ /// Edit › Keyboard Shortcuts: the user's changes to the default shortcuts. Saved as+ /// `shortcuts` and `shortcutsMore` (see `prefs::saved_shortcuts`).+ #[serde(flatten, with = "prefs::saved_shortcuts")]+ pub shortcuts: craft_keymap::Overrides,pub control_bar: bool,pub tools_double_column: bool,- /// Expanded right-dock panel group tab.+ /// The front tab of the default layout's Properties · Pages · Layers group. `dock_tab`,+ /// `open_panel`, `floating`, `dock_expanded` and `icon_groups` describe a workspace's+ /// default layout (`panel_docking::default_layout`).pub dock_tab: String,- /// Panel opened from the collapsed icon column (flyout).+ /// The panel it opens below that group (Printing and Proofing: Swatches).pub open_panel: Option<String>,- /// Panels torn off the dock into their own floating windows: (panel id, top-left position).+ /// Its floating panels, and the float-only panels' windows (Type › Tabs): (panel id,+ /// top-left position). A customized layout holds its own floating panels.pub floating: Vec<(String, [f32; 2])>,- /// Shared panel layout after the user customizes the legacy dock.+ /// The panel layout once the user customizes it; `None` is the workspace's default layout+ /// (`panel_docking::default_layout`).#[serde(default, skip_serializing_if = "Option::is_none")]pub docking: Option<craft_ui::docking::Layout<String>>,- #[serde(default, skip_serializing_if = "std::collections::BTreeMap::is_empty")]- pub docking_hidden: std::collections::BTreeMap<String, craft_ui::docking::Location<String>>,+ #[serde(default, skip_serializing_if = "HiddenPanels::is_empty")]+ pub docking_hidden: HiddenPanels,+ /// The panel (or the canvas) last clicked or selected in the docking layout, while the panel+ /// stays where the user left it.+ #[serde(skip)]+ pub docking_focused: Option<String>,/// Invalidates in-flight gestures when a workspace is replaced.#[serde(skip)]pub docking_generation: u64,@@@ -610,13 -793,10 +796,13 @@@ pub struct DesignApppub native_menu: bool,/// Shortcuts the native menu handles (skip them in the egui shortcut handler).pub native_shortcuts: std::collections::HashSet<String>,+ /// Every command's shortcuts, with the user's changes (`ui.shortcuts`) applied.+ pub keymap: craft_keymap::Keymap,+ pub(crate) key_dispatcher: craft_keymap::egui::Dispatcher,last_time: f64,- /// When recovery data was last written (seconds, egui time).+ /// When recovery data was last written (seconds on the monotonic clock; see [`now_ms`]).pub last_recovery: f64,- /// The egui context (set by the first frame): copied text goes to the system clipboard through it.+ /// The egui context (set by the first UI pass): copied text goes to the system clipboard through it.egui_ctx: Option<egui::Context>,/// A control-channel request is being handled: commands it runs never read or write the/// user's system clipboard (a control client must not see or replace it).@@@ -699,10 -916,8 +922,10 @@@ impl DesignApppending_window_commands: vec![],native_menu: false,native_shortcuts: Default::default(),+ keymap: keys::new_keymap(craft_keymap::Overrides::new()),+ key_dispatcher: craft_keymap::egui::Dispatcher::new(),- last_time: 0.0,- last_recovery: 0.0,+ last_time: now,+ last_recovery: now,egui_ctx: None,in_control: false,object_clip_text: None,diff --cc crates/ui-egui/src/menus.rsindex b432ab9a6,fda15c6bb..089f93c1d--- a/crates/ui-egui/src/menus.rs+++ b/crates/ui-egui/src/menus.rs@@@ -3011,111 -3190,160 +3127,160 @@@ pub fn all_menu_items() -> Vec<(String#[cfg(not(target_arch = "wasm32"))]pub fn paste_chord_command(app: &DesignApp, modifiers: egui::Modifiers) -> Option<&'static str> {let id = "edit.pasteInPlace";- if app.native_menu && !app.ui.shortcuts.contains_key(id) {+ if app.native_menu && app.keymap.overrides().get(id).is_none() {return None;}- let (m, k) = shortcut_of(app, id).as_deref().and_then(parse_shortcut)?;- (k == egui::Key::V && key_matches(m, k, egui::Key::V, modifiers) == Some(true)).then_some(id)+ let platform = app.keymap.platform();+ let held = craft_keymap::Mods::from_egui(&modifiers, platform);+ let pressed = craft_keymap::Chord::new(held, craft_keymap::Key::V);- let bound = app.keymap.bindings(&craft_keymap::CommandRef::new(id)).iter().any(|b| !b.trigger.double && b.trigger.chord.effective(platform) == pressed);++ let bound =++ app.keymap.bindings(&craft_keymap::CommandRef::new(id)).iter().any(|b| !b.trigger.double && b.trigger.chord.effective(platform) == pressed);+ bound.then_some(id)}-/// Global keyboard shortcuts: menu commands and single-key tool shortcuts.+/// Global keyboard shortcuts: menu commands, panels and tools, through the keymap.pub fn shortcuts(app: &mut DesignApp, ctx: &egui::Context) {+ app.sync_keymap();// Only a focused text field takes the keys: the canvas (or a button) having focus after a click// must not swallow tool shortcuts until Esc clears it.- // While an IME composes at the text caret, the keyboard is its own. An open canvas context menu- // takes the keys (Escape closes it), as a native menu would.- if ctx.text_edit_focused()- || app.ui.dialog.is_some()- || app.ui.palette.is_some()- || app.session.tool_composing()- || crate::canvas::context_menu_open(ctx)- || crate::chrome::search_had_focus(ctx)- {+ if ctx.text_edit_focused() || keys_taken(app, ctx) {return;}let typing = app.session.wants_text();- if app.ui.screen_mode == ScreenMode::Presentation {- presentation_keys(app, ctx);- let events = ctx.input(|i| i.events.clone());- for e in events {- let egui::Event::Key { key, pressed: true, modifiers, repeat: false, .. } = e else { continue };- if !shortcut_key(app, key, modifiers, typing, &mut || {- ctx.input_mut(|i| i.consume_key(modifiers, key));- }) {- escape_to_selection(app, key, modifiers, typing);- }- }++ let keys = ctx.input_mut(|i| take_keys(app, i, typing));++ run_keys(app, keys, typing);+ }++ /// Keys that a floating panel in its own OS window left over (craft-ui's+ /// `DockOutput::forwarded_events`, with the modifiers held in that window): they run the main+ /// window's shortcuts, clipboard and tool keys in the frame they arrive, so the keyboard works+ /// while a floating window has focus. craft-ui forwards nothing while one of that window's+ /// widgets has keyboard focus.+ pub fn forwarded_shortcuts(app: &mut DesignApp, ctx: &egui::Context, events: Vec<egui::Event>, modifiers: egui::Modifiers) {+ if events.is_empty() || keys_taken(app, ctx) {+ return;}++ app.sync_keymap();+ let typing = app.session.wants_text();- let mut rest = Vec::with_capacity(events.len());- let mut escape = None;- for e in events {- if let egui::Event::Key { key, pressed: true, modifiers, repeat: false, .. } = e {- if shortcut_key(app, key, modifiers, typing, &mut || {}) {- continue;- }- if key == egui::Key::Escape {- escape = Some(modifiers);- }- }- rest.push(e);- }- crate::canvas::forwarded_keys(app, rest, modifiers);- if let Some(m) = escape {- escape_to_selection(app, egui::Key::Escape, m, typing);- }++ // The keymap dispatches from an input state: the main window's, with the floating window's++ // keys and modifiers in place of its own.++ let mut input = ctx.input(|i| i.clone());++ input.events = events;++ input.modifiers = modifiers;++ let keys = take_keys(app, &mut input, typing);++ run_keys(app, keys, typing);++ crate::canvas::forwarded_keys(app, input.events, modifiers);+ }++ /// Whether something other than the shortcuts has the keyboard: a dialog or Quick Apply, an input+ /// method composing at the text caret, an open canvas context menu (Escape closes it, as a+ /// native menu would) or the menu search.+ fn keys_taken(app: &DesignApp, ctx: &egui::Context) -> bool {+ app.ui.dialog.is_some()+ || app.ui.palette.is_some()+ || app.session.tool_composing()+ || crate::canvas::context_menu_open(ctx)+ || crate::chrome::search_had_focus(ctx)+ }+-/// Runs the presentation key, command shortcut or tool shortcut a key press stands for. `consume`-/// takes the press from the input where nothing else may see it. Returns whether the press was used.-fn shortcut_key(app: &mut DesignApp, key: egui::Key, modifiers: egui::Modifiers, typing: bool, consume: &mut dyn FnMut()) -> bool {- // Presentation hides every control, so Esc always leaves it, and only that: the canvas must- // not also see the press and switch tools or deselect.- if key == egui::Key::Escape && app.ui.screen_mode == ScreenMode::Presentation {- consume();- let _ = app.run("view.togglePresentation", json!({}));- return true;- }- // Presentation goes through the spreads with the arrow keys, Page Up/Down, Home and End.- if app.ui.screen_mode == ScreenMode::Presentation && !modifiers.command && !modifiers.alt {- let step = match key {- egui::Key::ArrowRight | egui::Key::ArrowDown | egui::Key::PageDown => Some(1),- egui::Key::ArrowLeft | egui::Key::ArrowUp | egui::Key::PageUp => Some(-1),- egui::Key::Home => Some(isize::MIN),- egui::Key::End => Some(isize::MAX),- _ => None,- };- if let Some(step) = step {- consume();- crate::canvas::step_spread(app, step);- return true;- }- }- // Command shortcuts.- let mut fired: Option<(String, bool)> = None;- let all = effective_shortcuts(app);- for (id, sc) in &all {- let id = id.as_str();- if let Some((m, k)) = parse_shortcut(sc)- && let Some(exact) = key_matches(m, k, key, modifiers)- && (m.command || m.alt || !typing)- && !(id == "edit.clear" && typing)- {- // Single-key shortcuts (W) only when not typing.- if !m.command && !m.alt && !m.shift && typing {- continue;- }- if id == "edit.clear" || (typing && matches!(id, "edit.copy" | "edit.cut" | "edit.paste" | "edit.pasteInPlace")) {- continue; // Handled by the active tool / text clipboard events.++/// The key presses [`take_keys`] took from an input, run by [`run_keys`] once the input is++/// released: commands may read the context.++struct Keys {++ /// Presentation keys in order: `None` leaves Presentation, `Some(step)` moves through the spreads.++ presentation: Vec<Option<isize>>,++ hits: Vec<craft_keymap::egui::Hit>,++ /// An Esc press that nothing took.++ escape: bool,++}++++/// Takes the presentation keys and the command, panel and tool shortcuts out of `input`'s key++/// presses.++fn take_keys(app: &mut DesignApp, input: &mut egui::InputState, typing: bool) -> Keys {++ let presentation = if app.ui.screen_mode == ScreenMode::Presentation { presentation_keys(input) } else { Vec::new() };+ let contexts: &[&str] = if typing { &[crate::keys::TEXT_CONTEXT] } else { &[] };+ let active = craft_keymap::Active { panel: None, contexts, typing };- let hits = ctx.input_mut(|i| {- let native = &app.native_shortcuts;- // Presses the dispatcher leaves alone: Clear (the active tool deletes) and the keys the- // native menu's accelerators already handled. The native menu bar carries the shortcuts in- // effect, the user's included, and an accelerator fires only for its shortcut exactly: the- // Plus key standing in for = never reaches it.- // Copy, Cut and Paste stay too (the dispatcher's default): the canvas and text tools- // handle them, and Paste carries the text.- let accept = |hit: &craft_keymap::egui::Hit| {- let c = &hit.command;- let leave = hit.exact- && hit.cycle.is_empty()- && (c.id == "edit.clear" || (c.params.is_null() && native.contains(&c.id)));- !leave- };- app.key_dispatcher.dispatch_filtered(i, &app.keymap, &active, accept)- });- for hit in hits {++ let native = &app.native_shortcuts;++ // Presses the dispatcher leaves alone: Clear (the active tool deletes) and the keys the++ // native menu's accelerators already handled. The native menu bar carries the shortcuts in++ // effect, the user's included, and an accelerator fires only for its shortcut exactly: the++ // Plus key standing in for = never reaches it.++ // Copy, Cut and Paste stay too (the dispatcher's default): the canvas and text tools++ // handle them, and Paste carries the text.++ let accept = |hit: &craft_keymap::egui::Hit| {++ let c = &hit.command;++ let leave = hit.exact && hit.cycle.is_empty() && (c.id == "edit.clear" || (c.params.is_null() && native.contains(&c.id)));++ !leave++ };++ let hits = app.key_dispatcher.dispatch_filtered(input, &app.keymap, &active, accept);++ let escape = input.events.iter().any(++ |e| matches!(e, egui::Event::Key { key: egui::Key::Escape, pressed: true, repeat: false, modifiers, .. } if !modifiers.command && !modifiers.alt),++ );++ Keys { presentation, hits, escape }++}++++/// Runs what [`take_keys`] took, then Esc's return to the Selection tool.++fn run_keys(app: &mut DesignApp, keys: Keys, typing: bool) {++ for step in keys.presentation {++ match step {++ None => {++ let _ = app.run("view.togglePresentation", json!({}));+ }- fired = Some((id.to_string(), exact));- break;- }- }- if let Some((id, exact)) = fired {- // The native menu bar carries the shortcuts in effect, the user's included, and its- // accelerator fires only for the shortcut's own key and modifiers; the Plus key standing- // in for = never reaches it.- if exact && app.native_shortcuts.contains(&id) {- return true; // The native menu handles it.- }- // The key press belongs to the shortcut: what it opens (Quick Apply's list, a dialog's- // default button) must not see the same press as Enter or Space this frame.- consume();- // Like choosing the menu item: "…" commands open their dialog.- activate(app, &id, &Value::Null);- return true;- }- // Tool shortcuts (single keys, Shift+key).- if !typing && !modifiers.command && !modifiers.alt {- let name = key.name();- let sc = if modifiers.shift { format!("Shift+{name}") } else { name.to_string() };- if let Some(tool) = designcraft_tools::tool_for_shortcut(&sc) {- log::debug!("tool shortcut {sc} -> {tool}");- if std::env::var_os("DESIGNCRAFT_DEBUG_KEYS").is_some() {- eprintln!("tool shortcut {sc} ({key:?}, {modifiers:?}) -> {tool}");++ Some(step) => crate::canvas::step_spread(app, step),++ }++ }++ for hit in keys.hits {+ if !hit.cycle.is_empty() {+ // Tools sharing a key: the press after the group's current tool selects the next one.+ let current = app.session.tool_id();+ let tools: Vec<&str> = hit.cycle.iter().filter_map(|c| c.params.get("tool").and_then(Value::as_str)).collect();+ let next = tools.iter().position(|t| *t == current).and_then(|i| tools.get((i + 1) % tools.len())).or(tools.first());+ if let Some(tool) = next.map(|t| t.to_string()) {+ log::debug!("tool shortcut -> {tool}");+ app.select_tool(&tool);}- app.select_tool(tool);- return true;+ } else if hit.command.id == crate::keys::TOOL_COMMAND+ && let Some(tool) = hit.command.params.get("tool").and_then(Value::as_str).map(str::to_string)+ {+ log::debug!("tool shortcut -> {tool}");+ app.select_tool(&tool);+ } else {+ // Like choosing the menu item: "…" commands open their dialog.+ activate(app, &hit.command.id, &hit.command.params);}}- false+ // Esc with no shortcut of its own goes back to the Selection tool.- let escape = ctx.input(|i| {- i.events.iter().any(- |e| matches!(e, egui::Event::Key { key: egui::Key::Escape, pressed: true, repeat: false, modifiers, .. } if !modifiers.command && !modifiers.alt),- )- });- if escape && !typing && app.session.tool_id() != "selection" && !app.session.tool_busy() && app.ui.flyout.is_none() {++ if keys.escape && !typing && app.session.tool_id() != "selection" && !app.session.tool_busy() && app.ui.flyout.is_none() {+ app.select_tool("selection");+ }}- /// Presentation's keys: Esc leaves it, and only that (the canvas must not also see the press and- /// switch tools or deselect); the arrow keys, Page Up/Down, Home and End go through the spreads.- fn presentation_keys(app: &mut DesignApp, ctx: &egui::Context) {- let events = ctx.input(|i| i.events.clone());- for e in events {-/// Esc with no shortcut of its own goes back to the Selection tool.-fn escape_to_selection(app: &mut DesignApp, key: egui::Key, modifiers: egui::Modifiers, typing: bool) {- if key == egui::Key::Escape- && !typing- && !modifiers.command- && !modifiers.alt- && app.session.tool_id() != "selection"- && !app.session.tool_busy()- && app.ui.flyout.is_none()- {- app.select_tool("selection");++/// Takes the Presentation keys out of `input`. Presentation hides every control, so Esc always++/// leaves it, and only that: the canvas must not also see the press and switch tools or deselect.++/// The arrow keys, Page Up/Down, Home and End go through the spreads.++fn presentation_keys(input: &mut egui::InputState) -> Vec<Option<isize>> {++ let mut steps = Vec::new();++ for e in input.events.clone() {+ let egui::Event::Key { key, pressed: true, modifiers, repeat: false, .. } = e else { continue };- if key == egui::Key::Escape && app.ui.screen_mode == ScreenMode::Presentation {- ctx.input_mut(|i| i.consume_key(modifiers, key));- let _ = app.run("view.togglePresentation", json!({}));++ if key == egui::Key::Escape {++ input.consume_key(modifiers, key);++ steps.push(None);+ continue;+ }- if app.ui.screen_mode == ScreenMode::Presentation && !modifiers.command && !modifiers.alt {++ if !modifiers.command && !modifiers.alt {+ let step = match key {+ egui::Key::ArrowRight | egui::Key::ArrowDown | egui::Key::PageDown => Some(1),+ egui::Key::ArrowLeft | egui::Key::ArrowUp | egui::Key::PageUp => Some(-1),+ egui::Key::Home => Some(isize::MIN),+ egui::Key::End => Some(isize::MAX),+ _ => None,+ };+ if let Some(step) = step {- ctx.input_mut(|i| i.consume_key(modifiers, key));- crate::canvas::step_spread(app, step);++ input.consume_key(modifiers, key);++ steps.push(Some(step));+ }+ }}++ steps}/// Quick Apply (⌘Return): the document's styles and every command, searched by name.@@@ -3520,70 -3792,6 +3739,70 @@@ mod tests}}+ /// One frame of key presses through the shortcut dispatcher.+ fn press_keys(app: &mut crate::DesignApp, ctx: &egui::Context, keys: &[(egui::Key, egui::Modifiers)]) {+ let events = keys+ .iter()+ .flat_map(|&(key, modifiers)| {+ [true, false].map(|pressed| egui::Event::Key { key, physical_key: None, pressed, repeat: false, modifiers })+ })+ .collect();+ ctx.run_ui(egui::RawInput { events, ..Default::default() }, |ui| shortcuts(app, &ui.ctx().clone())).textures_delta.clear();+ }++ #[test]+ fn shortcuts_saved_as_a_map_by_older_versions_load_unchanged() {+ let saved = br#"{"shortcuts": {"app.preferences": "Cmd+Alt+Shift+9", "app.palette": "", "file.close": [""]}}"#;+ let mut app = crate::DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.ui = crate::UiState::from_preferences_json(saved).unwrap();+ app.sync_keymap();+ assert_eq!(shortcut_of(&app, "app.preferences").as_deref(), Some("Cmd+Alt+Shift+9"));+ assert_eq!(shortcut_of(&app, "app.palette"), None, "a removed default stays removed");+ assert_eq!(shortcut_of(&app, "file.close"), None);+ assert_eq!(shortcut_of(&app, "app.save").as_deref(), Some("Cmd+S"));+ // Saved again it reads back the same, in the map form an older version reads.+ let resaved = serde_json::to_vec(&app.ui).unwrap();+ assert_eq!(crate::UiState::from_preferences_json(&resaved).unwrap().shortcuts, app.ui.shortcuts);+ let saved: Value = serde_json::from_slice(&resaved).unwrap();+ assert_eq!(saved["shortcuts"], json!({"app.preferences": "Cmd+Alt+Shift+9", "app.palette": "", "file.close": ""}));+ }++ #[test]+ fn panel_shortcuts_open_their_panels() {+ let mut app = crate::DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.session.execute("file.new", &json!({})).unwrap();+ let ctx = egui::Context::default();- let shown = |app: &crate::DesignApp, p: &str| app.ui.dock_tab == p || app.ui.open_panel.as_deref() == Some(p);++ let shown = |app: &crate::DesignApp, p: &str| crate::panel_docking::showing(app, p);+ assert!(!shown(&app, "layers"));+ press_keys(&mut app, &ctx, &[(egui::Key::F7, egui::Modifiers::NONE)]);+ assert!(shown(&app, "layers"), "F7 opens Layers");+ // A panel without a default key takes one.+ let r = run_ui(&mut app, "window.setShortcut", &json!({"id": "window.panel", "params": {"panel": "links"}, "shortcut": "Shift+F12"}))+ .unwrap()+ .unwrap();+ assert_eq!(r["shortcut"], "Shift+F12");+ press_keys(&mut app, &ctx, &[(egui::Key::F12, egui::Modifiers::SHIFT)]);+ assert!(shown(&app, "links"), "the new key opens Links");+ }++ #[test]+ fn a_reassigned_tool_key_selects_the_tool_and_the_old_key_does_not() {+ let mut app = crate::DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());+ app.session.execute("file.new", &json!({})).unwrap();+ let ctx = egui::Context::default();+ let none = egui::Modifiers::NONE;+ run_ui(&mut app, "window.setShortcut", &json!({"id": "pen", "shortcut": "Y"})).unwrap().unwrap();+ press_keys(&mut app, &ctx, &[(egui::Key::P, none)]);+ assert_eq!(app.session.tool_id(), "selection", "P no longer selects the Pen");+ press_keys(&mut app, &ctx, &[(egui::Key::Y, none)]);+ assert_eq!(app.session.tool_id(), "pen");+ // Tools sharing a key take turns.+ press_keys(&mut app, &ctx, &[(egui::Key::B, none)]);+ assert_eq!(app.session.tool_id(), "contentCollector");+ press_keys(&mut app, &ctx, &[(egui::Key::B, none)]);+ assert_eq!(app.session.tool_id(), "contentPlacer");+ }+#[test]fn split_window_panes_have_their_own_views() {let mut app = crate::DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());@@@ -4900,6 -5385,113 +5396,113 @@@assert!(quick_apply_items(&s, "preferences", false).iter().any(|i| i.id == "app.preferences"));}+ #[test]+ fn searched_ui_commands_run_without_parameters_and_keep_preferences() {+ // Without a value these reset a setting or need a place the test host always has.+ let searched: Vec<&str> = quick_commands().map(|c| c.0).collect();+ for id in ["app.flattener", "view.screenMode", "view.zoom", "window.taskBarPin"] {+ assert!(!searched.contains(&id), "{id} is searched");+ }+ // A placed PDF: a graphic with layers.+ let mut scratch = designcraft_engine::Session::new();+ scratch.execute("file.new", &json!({})).unwrap();+ let pdf = scratch.execute("file.exportPdf", &json!({})).unwrap()["base64"].clone();+ let contexts = ["nothing selected", "text insertion point", "text frame selected", "table cell", "placed PDF selected"];+ // A two-page document, a saved workspace and non-default preferences, a host with window+ // controls, and file dialogs that are dismissed.+ let setup = |context: usize| {+ let services = crate::Services {+ pick_open: Some(Box::new(|_| None)),+ pick_save: Some(Box::new(|_| None)),+ clipboard_text: Some(Box::new(|| None)),+ ..Default::default()+ };+ let mut app = DesignApp::new(designcraft_engine::Session::new(), services);+ app.custom_titlebar = true;+ app.canvas_rect = Some(egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(900.0, 700.0)));+ app.run("file.new", json!({"pages": 2})).unwrap();+ app.session.prefs.recent_files.push("/nowhere/recent.dcraft".into());- app.ui.shortcuts.insert("view.rulers".into(), "Ctrl+Alt+R".into());++ app.ui.shortcuts.insert("view.rulers", vec!["Ctrl+Alt+R".into()]);+ app.ui.hidden_menu_items.push("view.guides".into());+ app.ui.ui_scale = 1.25;+ app.ui.brightness = crate::theme::Brightness::Light;+ app.ui.task_bar_at = Some([200.0, 200.0]);+ run_ui(&mut app, "window.newWorkspace", &json!({"name": "Mine"})).unwrap().unwrap();+ match context {+ 1 => {+ app.run("frame.create", json!({"rect": [72, 72, 400, 400], "content": "text", "text": "One", "caret": true})).unwrap();+ }+ 2 => {+ let f = app.run("frame.create", json!({"rect": [72, 72, 400, 400], "content": "text", "text": "One"})).unwrap()["id"].clone();+ app.run("selection.set", json!({"ids": [f]})).unwrap();+ }+ 3 => {+ app.run("frame.create", json!({"rect": [72, 72, 400, 400], "content": "text", "caret": true})).unwrap();+ app.run("table.insert", json!({"rows": 2, "cols": 2})).unwrap();+ }+ 4 => {+ let f = app.run("frame.create", json!({"rect": [72, 72, 400, 400]})).unwrap()["id"].clone();+ app.run("file.place", json!({"base64": pdf, "name": "a.pdf", "frame": f})).unwrap();+ app.run("selection.set", json!({"ids": [f]})).unwrap();+ }+ _ => {}+ }+ app.ui.dialog = None;+ app+ };+ let prefs = |app: &DesignApp| {+ let u = &app.ui;+ json!({+ "shortcuts": u.shortcuts, "hiddenMenuItems": u.hidden_menu_items, "uiScale": u.ui_scale,+ "brightness": u.brightness, "workspace": u.workspace, "customWorkspaces": u.custom_workspaces,+ "docking": u.docking, "dockingHidden": u.docking_hidden, "floating": u.floating,+ })+ };+ let quick = quick_apply_items(&setup(0).session, "workspace", false);+ assert!(quick.iter().any(|i| i.id == "window.newWorkspace"));+ // Deleting needs a workspace name: the application bar's workspace menu lists them.+ assert!(!quick.iter().any(|i| i.id == "window.deleteWorkspace"));+ // Each command runs as Quick Apply runs an entry. One that needs a selection may fail+ // without it, but runs in one of the contexts; none changes a preference it wasn't asked to.+ // Opening a panel or collapsing the dock to icons changes where the panels are, as it should.+ let opens_a_panel = [+ "app.tabsPanel",+ "app.characterStylesPanel",+ "app.paragraphStylesPanel",+ "app.characterPanel",+ "app.paragraphPanel",+ "app.glyphsPanel",+ "app.tablePanel",+ "window.collapseToIcons",+ ];+ let arrangement = ["docking", "dockingHidden", "floating"];+ let mut failed = Vec::new();+ for (id, ..) in quick_commands().filter(|(id, ..)| UI_COMMANDS.iter().any(|c| c.0 == *id)) {+ let mut errors = Vec::new();+ for (i, context) in contexts.iter().enumerate() {+ let mut app = setup(i);+ let before = prefs(&app);+ match app.run(id, json!({})) {+ Err(e) => errors.push(format!("{context}: {e}")),+ Ok(_) => {+ let after = prefs(&app);+ let changed: Vec<&String> =+ before.as_object().unwrap().iter().filter(|(k, v)| after.get(k.as_str()) != Some(*v)).map(|(k, _)| k).collect();+ let changed: Vec<&String> =+ changed.into_iter().filter(|k| !(opens_a_panel.contains(&id) && arrangement.contains(&k.as_str()))).collect();+ if !changed.is_empty() {+ failed.push(format!("{id} ({context}): changed {changed:?}"));+ }+ }+ }+ }+ if errors.len() == contexts.len() {+ failed.push(format!("{id}: {errors:?}"));+ }+ }+ assert!(failed.is_empty(), "{failed:#?}");+ }+#[test]fn distribute_rows_menu_dispatches_an_undoable_edit() {let mut app = crate::DesignApp::new(designcraft_engine::Session::new(), crate::Services::default());diff --cc crates/ui-egui/src/prefs.rsindex 96fb1288d,756532fd5..a4573eb85--- a/crates/ui-egui/src/prefs.rs+++ b/crates/ui-egui/src/prefs.rs@@@ -20,72 -42,71 +42,125 @@@ impl UiState}}+/// `UiState::shortcuts` in ui.json. `shortcuts` maps each changed command to its first+/// shortcut (`""` for none): the map of one text per command that earlier DesignCraft versions+/// read, and fail on with anything else, which drops the whole file. A command's further+/// shortcuts go in `shortcutsMore` (command → texts), which those versions ignore. Loading+/// appends them to the command's entry in `shortcuts`; extra shortcuts for a command missing+/// there are ignored, because an earlier version that saved the file left that command at its+/// defaults. `shortcuts` also loads in the shared keymap's array form, which the first builds+/// on it wrote.+pub(crate) mod saved_shortcuts {+ use std::collections::BTreeMap;++ use craft_keymap::{MAX_BINDINGS, Overrides};+ use serde::ser::SerializeMap;+ use serde::{Deserialize, Deserializer, Serializer};++ pub fn serialize<S: Serializer>(overrides: &Overrides, serializer: S) -> Result<S::Ok, S::Error> {+ let mut first = BTreeMap::new();+ let mut more = BTreeMap::new();+ for (command, texts) in overrides.iter() {+ // A blank text is no shortcut, as `""` is in the map.+ let mut texts = texts.iter().map(String::as_str).filter(|t| !t.trim().is_empty());+ first.insert(command, texts.next().unwrap_or_default());+ let rest: Vec<&str> = texts.collect();+ if !rest.is_empty() {+ more.insert(command, rest);+ }+ }+ let mut map = serializer.serialize_map(None)?;+ map.serialize_entry("shortcuts", &first)?;+ if !more.is_empty() {+ map.serialize_entry("shortcutsMore", &more)?;+ }+ map.end()+ }++ // `Overrides` loads leniently (never fails), so neither field can make ui.json unreadable.+ #[derive(Default, Deserialize)]+ #[serde(default, rename_all = "camelCase")]+ struct Saved {+ shortcuts: Overrides,+ shortcuts_more: Overrides,+ }++ pub fn deserialize<'de, D: Deserializer<'de>>(deserializer: D) -> Result<Overrides, D::Error> {+ let Saved { mut shortcuts, shortcuts_more } = Saved::deserialize(deserializer)?;+ for (command, rest) in shortcuts_more.iter() {+ let Some(first) = shortcuts.get(command) else { continue };+ let texts: Vec<String> = first.iter().chain(rest).take(MAX_BINDINGS).cloned().collect();+ shortcuts.insert(command, texts);+ }+ Ok(shortcuts)+ }+}+- fn recover_docking(saved: &mut Value) {- let Some(fields) = saved.as_object_mut() else { return };+ /// Files from before the canvas joined the panel layout saved the flyout open at quit as+ /// `openPanel`, which is the panel a workspace opens below Properties · Pages · Layers. Only a+ /// workspace's own panel stays: a built-in workspace's (Printing and Proofing: Swatches), and in a+ /// saved workspace one a built-in workspace opens (saving copies it). The current workspace keeps+ /// a saved workspace's panel.+ fn clear_stale_open_panels(ui: &mut UiState) {+ let built_in = |panel: &str| crate::menus::WORKSPACE_OPEN_PANELS.iter().any(|(_, p)| *p == panel);+ for workspace in &mut ui.custom_workspaces {+ if workspace.open_panel.as_deref().is_some_and(|panel| !built_in(panel)) {+ workspace.open_panel = None;+ }+ }+ let own = match ui.custom_workspaces.iter().find(|w| w.name == ui.workspace) {+ Some(saved) => saved.open_panel.as_deref(),+ None => crate::menus::workspace_open_panel(&ui.workspace),+ };+ if ui.open_panel.as_deref() != own {+ ui.open_panel = None;+ }+ }++ /// Drop docking data this version cannot read. True when nothing was dropped.+ fn recover_docking(saved: &mut Value) -> bool {+ let Some(fields) = saved.as_object_mut() else { return true };+ let mut intact = true;if fields.get("docking").is_some_and(|value| serde_json::from_value::<Option<Layout<String>>>(value.clone()).is_err()) {fields.remove("docking");+ intact = false;}if let Some(hidden) = fields.get_mut("dockingHidden") {- if let Some(entries) = hidden.as_object_mut() {+ // `[[panel, location], …]`, or an object keyed by panel from older files.+ if let Some(entries) = hidden.as_array_mut() {+ let before = entries.len();+ entries.retain(|entry| serde_json::from_value::<(String, Location<String>)>(entry.clone()).is_ok());+ intact &= entries.len() == before;+ } else if let Some(entries) = hidden.as_object_mut() {+ let before = entries.len();entries.retain(|_, value| serde_json::from_value::<Location<String>>(value.clone()).is_ok());+ intact &= entries.len() == before;} else {fields.remove("dockingHidden");+ intact = false;}}+ intact+ }++ /// Convert a layout saved before the canvas joined the panel layout. One that cannot be+ /// converted gives way to the workspace's default layout, which the workspace fields+ /// (`dockTab`, `openPanel`, `floating`, `dockExpanded`, `iconGroups`) still describe. False when+ /// a layout was dropped that way.+ fn migrate(+ docking: &mut Option<Layout<String>>,+ floating: &mut Vec<(String, [f32; 2])>,+ hidden: &HiddenPanels,+ dock_expanded: bool,+ icon_groups: Option<&[Vec<String>]>,+ ) -> bool {+ let Some(old) = docking.as_ref().filter(|layout| panel_docking::dock_only(layout)) else { return true };+ *docking = panel_docking::from_dock_only(old, hidden.keys(), dock_expanded, icon_groups);+ if docking.is_some() {+ // The converted layout holds the floating dock panels.+ floating.retain(|(id, _)| crate::dock::float_only(id));+ }+ docking.is_some()}#[cfg(test)]diff --cc crates/ui-egui/src/shortcut_import.rsindex 015d2bc69,9ccbef1b9..27373fa4d--- a/crates/ui-egui/src/shortcut_import.rs+++ b/crates/ui-egui/src/shortcut_import.rs@@@ -138,60 -123,239 +138,60 @@@ fn entries(keys: &str) -> Vec<Entry>.collect()}-/// Whether the keys use Mac modifier names, where Ctrl is the Control key rather than the-/// command modifier.-fn is_mac_set(set: &ParsedSet) -> bool {- set.items.iter().flat_map(|i| &i.entries).any(|e| {- let k = e.keys.to_lowercase();- k.contains("cmd") || k.contains("command") || k.contains('⌘') || k.contains("opt") || k.contains('⌥')- })-}--#[derive(Clone, Copy, PartialEq, Eq)]-enum Mod {- Command,- Alt,- Shift,- Control,-}--/// Keys as InDesign writes them (`Shift+Ctrl+S`, `Ctrl+Num 5`, `Page Down`, `⇧⌘S`) as a-/// DesignCraft shortcut string (`Cmd+Shift+S`). Ctrl is the command modifier in a Windows set.-fn read_keys(keys: &str, mac: bool) -> Result<String, &'static str> {- const SYMBOLS: &[(&str, Mod)] = &[("⌘", Mod::Command), ("⌥", Mod::Alt), ("⇧", Mod::Shift), ("⌃", Mod::Control)];- const WORDS: &[(&str, Mod)] = &[- ("command", Mod::Command),- ("cmd", Mod::Command),- ("option", Mod::Alt),- ("opt", Mod::Alt),- ("alt", Mod::Alt),- ("shift", Mod::Shift),- ("control", Mod::Control),- ("ctrl", Mod::Control),- ];- let mut m = egui::Modifiers::NONE;- let mut set = |md: Mod| match md {- Mod::Command => m.command = true,- Mod::Alt => m.alt = true,- Mod::Shift => m.shift = true,- Mod::Control if mac => m.ctrl = true,- Mod::Control => m.command = true,- };- let mut rest = keys.trim();- 'strip: loop {- for (sym, md) in SYMBOLS {- if let Some(r) = rest.strip_prefix(sym) {- set(*md);- rest = r.strip_prefix('+').unwrap_or(r).trim_start();- continue 'strip;- }- }- for (word, md) in WORDS {- let Some(head) = rest.get(..word.len()) else { continue };- let Some(after) = rest.get(word.len()..) else { continue };- // The word must be followed by a separator and a key: "Alt" alone, or "Altx", is a key name.- let mut chars = after.chars();- if head.eq_ignore_ascii_case(word) && matches!(chars.next(), Some('+' | ' ' | '-')) && !chars.as_str().is_empty() {- set(*md);- rest = chars.as_str().trim_start();- continue 'strip;- }- }- break;- }- if m.ctrl {- return Err("Control-key shortcuts are not supported");- }- let key = key_named(rest.trim()).ok_or("unknown key")?;- let sc = menus::shortcut_string(m, key);- // Only a string the shortcut dispatcher reads back as these keys is imported.- match menus::parse_shortcut(&sc) {- Some((pm, pk)) if pk == key && same_mods(pm, m) => Ok(sc),- _ => Err("unknown key"),- }-}--fn same_mods(a: egui::Modifiers, b: egui::Modifiers) -> bool {- a.command == b.command && a.alt == b.alt && a.shift == b.shift && a.ctrl == b.ctrl-}--/// A key by the name InDesign gives it (Windows words, Mac symbols), case- and space-insensitive.-fn key_named(name: &str) -> Option<egui::Key> {- use egui::Key;- if name.is_empty() {- return None;- }- let squashed: String = name.chars().filter(|c| !c.is_whitespace()).collect::<String>().to_lowercase();- // The numeric keypad: egui doesn't tell its keys apart from the main ones.- let n = squashed.strip_prefix("numpad").or_else(|| squashed.strip_prefix("num").filter(|r| !r.is_empty() && *r != "lock")).unwrap_or(&squashed);- let key = match n {- "up" | "uparrow" | "arrowup" | "↑" => Key::ArrowUp,- "down" | "downarrow" | "arrowdown" | "↓" => Key::ArrowDown,- "left" | "leftarrow" | "arrowleft" | "←" => Key::ArrowLeft,- "right" | "rightarrow" | "arrowright" | "→" => Key::ArrowRight,- "pageup" | "pgup" | "⇞" => Key::PageUp,- "pagedown" | "pgdn" | "⇟" => Key::PageDown,- "home" | "↖" => Key::Home,- "end" | "↘" => Key::End,- "esc" | "escape" | "⎋" => Key::Escape,- "tab" | "⇥" => Key::Tab,- "space" | "spacebar" => Key::Space,- "enter" | "return" | "↩" | "⏎" | "⌤" => Key::Enter,- "backspace" | "⌫" => Key::Backspace,- "delete" | "del" | "forwarddelete" | "⌦" => Key::Delete,- "insert" | "ins" | "help" => Key::Insert,- _ => return Key::from_name(n).or_else(|| Key::from_name(&n.to_uppercase())).or_else(|| Key::from_name(name)),- };- Some(key)-}--/// Matching form of a label or menu name: no ellipsis, no `&`, single spaces, lower case, and-/// no Show/Hide in front (InDesign names a toggle by what choosing it does now).-fn norm(s: &str) -> String {- let s = s.replace('…', "").replace("...", "").replace('&', "");- let s = s.split_whitespace().collect::<Vec<_>>().join(" ").to_lowercase();- ["show/hide ", "show ", "hide "].iter().find_map(|p| s.strip_prefix(p).filter(|r| !r.is_empty())).map_or(s.clone(), str::to_string)-}--/// DesignCraft's commands by menu path and label.-#[derive(Default)]-struct Index {- /// `menu\nsubmenu\nlabel` → ids, in the menu bar.- path: HashMap<String, BTreeSet<String>>,- /// The same from the engine commands' own menu placement, which a UI command (the one with- /// the dialog) may stand in for in the menu bar.- engine_path: HashMap<String, BTreeSet<String>>,- /// (menu, label) → ids, at any depth of that menu.- in_menu: HashMap<(String, String), BTreeSet<String>>,- /// label → ids, anywhere.- label: HashMap<String, BTreeSet<String>>,+/// `s` without a trailing `suffix`, compared without ASCII case.+fn strip_suffix_ignore_case<'a>(s: &'a str, suffix: &str) -> Option<&'a str> {+ let at = s.len().checked_sub(suffix.len())?;+ s.get(at..).filter(|end| end.eq_ignore_ascii_case(suffix)).and_then(|_| s.get(..at))}-impl Index {- fn build() -> Self {- fn walk(ix: &mut Index, items: &[Item], path: &mut Vec<String>) {- for it in items {- match it {- Item::Sub(name, children) => {- path.push(norm(name));- walk(ix, children, path);- path.pop();- }- // A shortcut runs the command without parameters; a fixed-parameter variant can't hold one.- Item::Cmd { label, id, params, .. } if params.is_null() => {- let label = norm(label);- let top = path.first().cloned().unwrap_or_default();- add_path(&mut ix.path, path, &label, id);- ix.in_menu.entry((top, label.clone())).or_default().insert(id.clone());- ix.label.entry(label).or_default().insert(id.clone());- }- _ => {}- }- }- }- let mut ix = Index::default();- for (menu, entries) in menus::menu_tree() {- walk(&mut ix, &entries, &mut vec![norm(menu)]);- }- for c in designcraft_engine::command_specs() {- let label = norm(c.label);- if !c.menu.is_empty() {- let path: Vec<String> = c.menu.iter().map(|m| norm(m)).collect();- add_path(&mut ix.engine_path, &path, &label, c.id);- }- ix.label.entry(label).or_default().insert(c.id.to_string());- }- for (id, label, _, _) in menus::UI_COMMANDS {- ix.label.entry(norm(label)).or_default().insert((*id).to_string());- }- ix+/// The set as `craft_keymap::import` reads it. An area named `<menu> Menu` is that menu; the+/// Tools area is the Tools menu, where items named `… Tool` select tools. Items of the Panel Menus+/// area name their panel first (`Character: All Caps`) and match a command under that panel.+/// Items of other areas (text and tables, views) have no menu, so they match only by a one-segment+/// name. The keys are read with Mac modifier names when any key in the set uses one.+fn foreign(set: &ParsedSet) -> ForeignSet {+ #[derive(Clone, Copy, Default)]+ struct Area<'a> {+ menu: Option<&'a str>,+ tools: bool,+ panel_menu: bool,}-- /// The command an item names, trying the most specific match first. Matches by label alone- /// only count when exactly one command has that label.- fn find(&self, area: &str, name: &str) -> Option<String> {- let one = |s: Option<&BTreeSet<String>>| s.filter(|s| s.len() == 1).and_then(|s| s.first().cloned());- let segments: Vec<String> = name.split(": ").map(norm).collect();- let last = segments.last().cloned().unwrap_or_default();- let area = norm(area);- if let Some(menu) = area.strip_suffix(" menu").filter(|m| !m.contains(':')) {- let mut key = menu.to_string();- for s in &segments {- key.push('\n');- key.push_str(s);- }- if let Some(id) = one(self.path.get(&key)) {- return Some(id);- }- if segments.len() > 1- && let Some(id) = one(self.in_menu.get(&(menu.to_string(), segments.join(" "))))- {- return Some(id);- }- if let Some(id) = one(self.engine_path.get(&key)) {- return Some(id);+ let flavor = Flavor::detect(set.items.iter().flat_map(|i| &i.entries).map(|e| e.keys.as_str()));+ let areas: Vec<Area> = set+ .areas+ .iter()+ .map(|a| {+ let a = a.trim();+ if a.eq_ignore_ascii_case("tools") {+ Area { menu: Some(a), tools: true, panel_menu: false }+ } else if a.eq_ignore_ascii_case("panel menus") {+ Area { panel_menu: true, ..Area::default() }+ } else {+ let menu = strip_suffix_ignore_case(a, " menu").map(str::trim).filter(|m| !m.is_empty() && !m.contains(':'));+ Area { menu, ..Area::default() }}- if let Some(id) = one(self.in_menu.get(&(menu.to_string(), last.clone()))) {- return Some(id);+ })+ .collect();+ let entries = set+ .items+ .iter()+ .map(|item| {+ let area = item.area.and_then(|a| areas.get(a)).copied().unwrap_or_default();+ let mut entry = ForeignEntry::new(area.menu, item.name.split(": ").map(str::trim)).at_line(item.line);+ if area.panel_menu {+ entry = entry.in_panel_menu();}- // Menus are arranged differently: the item's own label, if no other command has it.- return one(self.label.get(&last));- }- if segments.len() == 1 { one(self.label.get(&last)) } else { None }- }-}--fn add_path(map: &mut HashMap<String, BTreeSet<String>>, path: &[String], label: &str, id: &str) {- let mut key = path.join("\n");- key.push('\n');- key.push_str(label);- map.entry(key).or_default().insert(id.to_string());-}--/// What the set says about one DesignCraft command, over every item matched to it.-struct Decision {- id: String,- item: String,- /// The first readable shortcut.- shortcut: Option<String>,- /// Every matched item said `[none defined]`.- all_none: bool,-}--fn command_label(id: &str) -> String {- menus::ui_label(id)- .map(|(l, _)| l.to_string())- .or_else(|| designcraft_engine::find_command(id).map(|c| c.label.to_string()))- .unwrap_or_else(|| id.to_string())-}--fn keys_of(sc: &str) -> Option<(bool, bool, bool, bool, egui::Key)> {- menus::parse_shortcut(sc).map(|(m, k)| (m.command, m.alt, m.shift, m.ctrl, k))+ entry.is_tool = area.tools && strip_suffix_ignore_case(&item.name, " tool").is_some();+ entry.keys = item.entries.iter().map(|e| ForeignKey::read(Some(&e.context), &e.keys, flavor)).collect();+ entry+ })+ .collect();- ForeignSet { name: Some(set.name.clone()), entries }++ ForeignSet::new(entries).with_name(set.name.clone())}-/// Imports a set: every matched command takes the set's shortcut (or none), another command-/// holding an imported shortcut loses it, and the rest keep theirs. Returns the report.+/// Imports a set: every matched command takes the set's shortcuts (or none, when every item+/// matched to it has none), other commands lose keys it takes (unless they share them as+/// defaults), and the rest keep theirs. Returns the report.pub fn import(app: &mut DesignApp, text: &str) -> Result<Value, String> {if text.len() > MAX_BYTES {return Err(format!("the set is larger than {} MB", MAX_BYTES >> 20));diff --cc docs/pdf-backend.mdindex 4cbc985d3,eb32303a9..c6e65754e--- a/docs/pdf-backend.md+++ b/docs/pdf-backend.md@@@ -1,8 -1,8 +1,8 @@@# Shared PDF backend- DesignCraft pins `craft-pdf`, patched Krilla 0.8.2 and the four Hayro reader crates to- craft-libs revision `89dcbb3060377a26c99a6d80caa16084366704c4`. Existing `craft-ui` and `craft-print` revisions- remain unchanged. The reader migration is reviewed on top of the separate writer change.+ DesignCraft pins `craft-pdf`, patched Krilla 0.8.2 and the six Hayro reader crates (with-`hayro-cmap` and `hayro-postscript`) to craft-libs revision `a0916808f7d78bed8c7b90cdf937176015454a7f`. `craft-ui`,++`hayro-cmap` and `hayro-postscript`) to craft-libs revision `e3b9e239c52c14677be462e94d8920ea243de4f3`. `craft-ui`,+ `craft-print` and the other craft-libs crates are pinned to the same revision. The reader migration is reviewed on top of the separate writer change.## Writingdiff --cc xtask/src/pdf_deps.rsindex bb2a4f01d,e7caa5d53..dc1211888--- a/xtask/src/pdf_deps.rs+++ b/xtask/src/pdf_deps.rs@@@ -4,7 -4,7 +4,7 @@@ use std::process::Commanduse serde_json::Value;- const REV: &str = "89dcbb3060377a26c99a6d80caa16084366704c4";-const REV: &str = "a0916808f7d78bed8c7b90cdf937176015454a7f";++const REV: &str = "e3b9e239c52c14677be462e94d8920ea243de4f3";const PACKAGES: &[(&str, &str)] = &[("craft-pdf", "0.1.0"),("krilla", "0.8.2"),