photocraft/crates
Brennan Stehling b10b37c14b
macOS: use the native menu bar instead of the in-window menus (#887) (#894)
* macOS: use the native menu bar instead of the in-window menus (#887)

On macOS the menus move from the title bar to the menu bar at the top of the
screen, built with muda from the same rows as the in-window bar (menu_items).
Linux, Windows and the web keep the in-window menus, and so does macOS with
--in-window-menus or PHOTOCRAFT_IN_WINDOW_MENUS=1.

The Mac layout (native_menu.rs, platform-free and tested everywhere):
- a PhotoCraft app menu: About (from Help), Settings (Edit › Preferences),
  Services, Hide, Hide Others, Show All, and Quit, which is still file.exit so
  the unsaved-changes prompt runs;
- a Window menu AppKit knows (Minimize, Zoom, Bring All to Front, the window
  list) and a Help menu with the system search field;
- PhotoCraft keeps Photoshop's ⌘H (Extras), ⌘M (Curves), ⌘W (Close) and
  ⌘, (Hide Layers): Hide and Settings have no shortcut, Minimize is ⌃⌘M.

Key equivalents are handed back to egui as the key presses they were, so
shortcuts run through shortcuts::handle exactly as before: text fields keep
⌘C/⌘V/⌘Z, dialogs and Camera Raw stay modal. A click runs the command like an
in-window click. The menu is updated only when state changes, in place, and
rebuilt only when its structure does.

On every platform:
- menu rows show the shortcut that runs them: 12 live items (Undo, Redo, Cut,
  Copy, Paste, Hide Layers, …) showed none;
- Image › Mode, View › Proof Setup, Proof Colors, Gamut Warning and Isolate
  Layers stay check items with no document open, so opening one doesn't
  change the menu's structure.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Native menu: test it against AppKit; fix the Window/Help menus and ⌘R routing

tests/mac_menu_appkit.rs (harness = false, main thread, like the tablet
crate's monitor test) installs the real muda menu and reads AppKit's menu
bar back: the PhotoCraft app menu, Quit ⌘Q, no Exit in File, the Window and
Help menus registered with NSApp, and Layer › New › Layer… enabled in place
(same NSMenu) once a document opens. It then sends a real ⌘R key-down
through -[NSMenu performKeyEquivalent:], which must reach egui as ⌘R and run
View › Rulers once, and chooses Rulers by click and by ↩ in the open menu,
which must run as clicks.

It found two bugs, fixed here:
- Window and Help were never registered: muda looks the submenus up in the
  installed main menu, so set_as_*_menu_for_nsapp must come after
  init_for_nsapp. The Window menu didn't list windows.
- AppKit matched ⌘R to Filter › Lens Correction (⇧⌘R), and the menu handed
  egui the matched item's shortcut, so ⌘R ran Lens Correction. Key
  equivalents now go back with the modifiers actually held.

Also a kittest: the title bar draws no menu titles with the Mac menu bar.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Mac app menu: Language and Appearance, Hide on ⌃⌘H (aligned with VectorCraft)

App settings live in the app menu, as on a Mac and as VectorCraft does:

- Language ▸ after Settings: Auto, then each UI language in its own name,
  the interface.language preference checked; choosing one runs prefs.set
  (unknown codes are refused).
- Appearance ▸: the themes (now check items, in-window too) and Next Theme
  move from Window › Theme to the app menu.
- Hide PhotoCraft takes ⌃⌘H when ⌘H is View › Extras, as Photoshop does
  (Minimize already takes ⌃⌘M).

The other Craft apps use the same app menu, Window menu and
--in-window-menus / <APP>_IN_WINDOW_MENUS opt-out.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: bflatastic <bombayapirat@gmail.com>
2026-10-08 20:22:28 +07:00
..
algo Filter Gallery: Angled Strokes paints strokes instead of a smear; Rough Pastels' texture shows in the dark areas (#879) (#942) 2026-10-07 23:03:09 -04:00
automation Automation: an allowed command can't run a denied one on its behalf (#861) 2026-10-07 23:58:26 -07:00
cms fix(cms): check LUT declared sizes before arithmetic (#725) 2026-10-07 15:41:09 -04:00
codecs TIFF: BigTIFF, every IFD and SubIFD, banded parallel decode (FILE-215-8, part of #215) (#859) 2026-10-07 22:37:51 -04:00
color Photo Filter and gradient glows render like Photoshop (#442, #443) (#850) 2026-10-07 23:49:10 -04:00
compose Photo Filter and gradient glows render like Photoshop (#442, #443) (#850) 2026-10-07 23:49:10 -04:00
doc fix(layers): a locked group locks the layers inside it (#847) 2026-10-07 20:18:27 -04:00
engine Layer via Copy, Copy and Cut read only the selected area: 33x faster on 24 MP (#668) (#985) 2026-10-08 03:17:48 -04:00
format Bound layer-group nesting at import and Group Layers (stack-overflow guard) (#796) 2026-10-07 18:46:45 -04:00
geom fix(geom): Rect::width/height no longer overflow on i32-extreme edges (#675) (#808) 2026-10-07 18:00:59 -04:00
gpu Photo Filter and gradient glows render like Photoshop (#442, #443) (#850) 2026-10-07 23:49:10 -04:00
heif Open HEIC/HEIF photos (#355) (#372) 2026-10-07 10:20:40 -04:00
io Photo Filter and gradient glows render like Photoshop (#442, #443) (#850) 2026-10-07 23:49:10 -04:00
ops History: tool and preset names, Frame from Layers as one step, undo/redo restore the targeted layers (#513, #528, #446, #496, #495) (#551) 2026-10-07 13:54:10 +07:00
paint Bound paint stroke work (#678, #679) (#751) 2026-10-07 17:12:49 -04:00
plugins Sandboxed WebAssembly plug-ins: photocraft-plugins (wasmi), plugin.* commands, Filter › Plug-ins (#67) 2026-10-04 16:08:28 -04:00
psd Large PSBs open with their pixels: decode planes past 2 GiB, plus 4-5 GB PSB fixtures (#375) (#782) 2026-10-07 18:59:39 -04:00
raster Background jobs: engine job API, progress and cancel (part of #210) (#289) 2026-10-06 15:41:38 -04:00
raw fix(raw): validate DNG default crop bounds (#745) 2026-10-07 17:10:03 -04:00
tablet Stylus pressure, tilt, rotation and eraser on macOS and X11 (#255) (#255) 2026-10-05 17:47:59 -04:00
testkit Scorecard: cargo xtask perf + scorecard, budgets, checklists, nightly perf (#221) (#239) (#239) 2026-10-05 10:53:02 -04:00
text Web build: ICU complex-script dictionaries native-only; bump version to 0.4.1 2026-10-08 08:48:03 -04:00
ui-egui macOS: use the native menu bar instead of the in-window menus (#887) (#894) 2026-10-08 20:22:28 +07:00
vector Direct Selection tool: reshape pen and shape paths after they're drawn (#790) (#865) 2026-10-07 22:58:31 -04:00