mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-31 05:28:09 -06:00
* feat(ui): menus from craft-menu, native on macOS One menu definition (crates/ui-egui/src/menus.rs) built from the command registry drives the native macOS menu bar (craft-menu's muda backend) and an in-window egui bar on Windows, Linux and the web, which takes the place of the "Menu" button at the start of the top bar. - File, Edit, View, Sign, Window and Help, with separators and submenus. Edit gains Cut, Paste, Delete and Select All (they act as their keys do) and a Pages submenu; View gains a Tools submenu built from the All tools groups; Sign holds Fill & Sign and the certificate commands; Window lists the open documents. - Toggles are check items and the page layouts, side panels and themes radio items, with their state from the app. - File > Open Recent lists the recent files (file.open_recent with an index). - A menu click and its shortcut run the same dispatch, including the form-field deferral (#166) and macOS Cmd+W closing the window (#869). Dialogs and the palette grey the menus through craft-menu's gate. - Quit goes through craft-quit, so the unsaved-changes prompt runs. - craft-ui, craft-quit, craft-menu and craft-keymap pinned to storytold/craft-libs 70ade1fb. Menu state and dispatch follow #2610 by @hajdukste; the menu tree and the view and panel items follow #3870 by @RivanJarjes. * test(ui): the menu model, native dispatch and the in-window bar - Unit tests for the menu definition: every registry menu command is listed once with its registry shortcut; check and radio items follow the app; a dialog greys document commands and drops their clicks; the recent files and open documents are listed once each; a native menu click (through a fake craft-menu backend) runs its command once. - The kittests that opened the old "Menu" button use the menu bar, and the ones that look up a label the bar's titles share (Edit, File, Sign) skip the bar. - The in-window bar takes its titles' width, so the mode tabs, search and buttons keep their place in the top bar. - Edit menu clicks that stand for keys (Copy, Cut, Delete, Select All) reach this frame's input from `logic`, where test hosts see them too. * test(ui): the language switch test opens File in the menu bar Translated titles and rows carry their mnemonic ("ファイル(F)", "開く(O)…"). * feat(ui): the menu bars run Quit themselves, the bar shrinks to its titles, and AppKit's window list stays off craft-libs main edc41f6 (craft-libs#354): MenuBarUi runs Quit and Minimize, shrink_to_fit sizes the in-window bar, Key::parse reads the registry's arrow and minus glyphs, and mac::install_with(.., window_list(false)) keeps the Window menu to PdfCraft's own document list. * fix(ui): the menu command filter is an if, for clippy * test(ui): drop a needless borrow in the edit-tab helper * test(ui): two tests follow the menu bar The tests were wrong, not the app. The Preferences language test clicked the old Menu button; it opens Edit in the menu bar and its Preferences row. The prepare Actions test counted the Edit labels: the narrower menu bar leaves room for the Edit tab, so the rows' Edit buttons come third and fourth.
107 lines
5.0 KiB
TOML
107 lines
5.0 KiB
TOML
[package]
|
||
name = "pdfcraft-ui-egui"
|
||
description = "The egui shell of PdfCraft"
|
||
version.workspace = true
|
||
edition.workspace = true
|
||
license.workspace = true
|
||
rust-version = "1.95"
|
||
|
||
[lints]
|
||
workspace = true
|
||
|
||
[dependencies]
|
||
craft-ui = { workspace = true }
|
||
# The menus: native on macOS, an egui bar elsewhere, from one definition (menus.rs).
|
||
craft-menu = { workspace = true }
|
||
craft-keymap = { workspace = true }
|
||
# Quit from the menus asks the window to close, so the unsaved-changes check runs; on macOS a window
|
||
# close also quits through `terminate:` (the Touch Bar crash, #1136).
|
||
craft-quit = { workspace = true, features = ["egui"] }
|
||
pdfcraft-fonts = { workspace = true }
|
||
pdfcraft-engine = { workspace = true }
|
||
pdfcraft-cos = { workspace = true }
|
||
pdfcraft-render = { workspace = true }
|
||
pdfcraft-model = { workspace = true }
|
||
pdfcraft-platform = { workspace = true }
|
||
egui = { workspace = true, features = ["bytemuck", "default_fonts", "monochrome_emoji_fonts"] }
|
||
egui_extras = { workspace = true }
|
||
eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit", "persistence", "links", "clipboard"] }
|
||
serde = { workspace = true }
|
||
serde_json = { workspace = true }
|
||
log = { workspace = true }
|
||
# UTC/calendar display (combine modified-time stamp, the form date picker) goes through chrono
|
||
# (no hand-rolled calendar code); std-only, so it stays wasm-safe.
|
||
chrono = { workspace = true }
|
||
# Monotonic deadlines for work that runs in `logic` with no UI pass (native and web).
|
||
web-time = { workspace = true }
|
||
# Hands rendered rasters to egui as its pixels, without copying; already in the tree through egui and wgpu.
|
||
bytemuck = { version = "1", features = ["extern_crate_alloc"] }
|
||
|
||
rfd = { workspace = true }
|
||
png = "0.18"
|
||
base64 = "0.23"
|
||
# Unicode bidi paragraph segmentation for right-to-left comment wrapping; egui 0.37's epaint owns
|
||
# display reordering. Already in the tree through egui’s epaint.
|
||
unicode-bidi = "0.3"
|
||
# Checks that an installed fallback font parses and has the glyphs, and reads the vertical metrics
|
||
# that put fallback faces on the interface's baseline (#1676); the same skrifa egui uses.
|
||
skrifa = "0.44"
|
||
|
||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||
craft-update = { workspace = true }
|
||
# Control-channel tokens.
|
||
getrandom = "0.4"
|
||
# Create ▸ Clipboard (images; already in the tree through egui-winit).
|
||
arboard = { version = "3.6", default-features = false, features = ["image-data"] }
|
||
# Waits for native file pickers off the UI thread (already in the tree through wgpu).
|
||
pollster = "1.0"
|
||
|
||
[target.'cfg(all(unix, not(target_os = "macos"), not(target_arch = "wasm32")))'.dependencies]
|
||
# Discover configured font directories without linking libfontconfig or running a subprocess.
|
||
fontconfig-parser = "0.5.8"
|
||
|
||
[target.'cfg(target_os = "macos")'.dependencies]
|
||
# Safe AppKit calls for drag coordinates and repairing an existing per-file PDFCraft binding.
|
||
# The Objective-C wrappers and block support are already in the tree through arboard and rfd.
|
||
objc2 = "0.6"
|
||
objc2-app-kit = { version = "0.3", default-features = false, features = ["std", "NSEvent", "NSScreen", "NSWorkspace", "block2"] }
|
||
objc2-foundation = { version = "0.3", default-features = false, features = ["std", "NSArray", "NSGeometry", "NSBundle", "NSURL", "NSString", "NSError"] }
|
||
block2 = "0.6"
|
||
plist = "1.10"
|
||
# A plain fsync where a volume refuses the full flush `sync_all` asks for (SMB, FUSE); already in
|
||
# the tree through pdfcraft-cli.
|
||
rustix = { version = "1", features = ["fs"] }
|
||
|
||
[target.'cfg(windows)'.dependencies]
|
||
# Auto interface language: the Windows display language, without starting a process.
|
||
sys-locale = "0.3"
|
||
# Region ▸ Measurement system for the default Units, read from the registry without starting reg.exe;
|
||
# where the pointer is while files are dragged over the window (winit doesn't say).
|
||
winsafe = { version = "0.0.29", default-features = false, features = ["advapi", "user"] }
|
||
|
||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||
rfd = { workspace = true, features = ["file-handle-inner"] }
|
||
wasm-bindgen-futures = "0.4"
|
||
wasm-bindgen = "0.2"
|
||
js-sys = "0.3"
|
||
web-sys = { version = "0.3", features = ["Window", "Document", "Element", "HtmlElement", "HtmlAnchorElement", "Blob", "BlobPropertyBag", "Url", "HtmlIFrameElement", "HtmlImageElement", "HtmlCollection", "Node", "EventTarget", "Navigator"] }
|
||
|
||
[dev-dependencies]
|
||
craft-update = { workspace = true }
|
||
pdfcraft-xfa = { workspace = true }
|
||
egui_kittest = { workspace = true, features = ["eframe", "wgpu"] }
|
||
# Tests draw PdfCraft text without a system provider: the bundled and monochrome emoji faces must
|
||
# be enabled on the test graph itself (a dependency's dev-features do not propagate).
|
||
egui = { workspace = true, features = ["default_fonts", "monochrome_emoji_fonts"] }
|
||
image = { version = "0.25", default-features = false, features = ["png"] }
|
||
# Glyph-coverage test of the interface fonts; the same skrifa pdfcraft-fonts already uses.
|
||
skrifa = "0.44"
|
||
|
||
[build-dependencies]
|
||
serde_json = { workspace = true }
|
||
toml = "1"
|
||
|
||
[target.'cfg(target_os = "macos")'.dev-dependencies]
|
||
# Only synthetic attribute fixtures use xattr; product reads/writes use rustix.
|
||
xattr = "1.6"
|