Skip to content

Magic Wand: OCaml toolbar dblclick -> panel summon#2

Open
jyh wants to merge 1 commit into
mainfrom
magic-wand-ocaml-dblclick
Open

Magic Wand: OCaml toolbar dblclick -> panel summon#2
jyh wants to merge 1 commit into
mainfrom
magic-wand-ocaml-dblclick

Conversation

@jyh
Copy link
Copy Markdown
Owner

@jyh jyh commented May 11, 2026

Summary

  • tool_options_panel_id + panel_id_to_kind helpers added to toolbar.ml/.mli: reads the tool_options_panel field from workspace.json (parallel to existing tool_options_dialog_id), and maps "magic_wand"Workspace_layout.Magic_wand. Mirrors Rust commit 3292de1 (toolbar_grid.rs).
  • Toolbar.create refactored to accept ?workspace_layout:Workspace_layout.workspace_layout and ?refresh_dock:(unit -> unit), matching the pattern already used by Menubar.create (menubar.ml).
  • direct_btn TWO_BUTTON_PRESS wired: on double-click the arrow slot now checks tool_options_panel_id first → calls Workspace_layout.show_panel + refresh_dock; falls back to tool_options_dialog_id for tools that use a modal dialog. A tool yaml uses one or the other, never both — so this is mutually exclusive dispatch, matching the Rust reference.
  • canvas.ml/.mli: create_main_window return type extended from a 4-tuple to a 6-tuple adding workspace_layout and a (fun () -> !dock_refresh ()) closure, so main.ml can thread them into Toolbar.create without restructuring ownership.
  • Call sites updated: main.ml destructures the new tuple and passes ~workspace_layout ~refresh_dock; canvas_test.ml updated to match.

Test plan

  • dune build clean (no new warnings or errors)
  • dune runtest — pre-existing failures in align_fixture_test and canvas_test are unrelated; all other suites pass
  • Manual smoke: launch OCaml app, select Magic Wand tool, double-click wand icon in toolbar → Magic Wand panel opens (was previously only reachable via Window menu)
  • Double-click on Paintbrush (arrow slot alternate) → tool-options dialog opens as before (regression check for dialog fallback)
  • Long-press on arrow slot still shows the slot menu (Partial Selection / Interior Selection / Magic Wand)

Reference

  • Rust: commit 3292de1 toolbar_grid.rs panel_id_to_kind + dblclick
  • Swift: commit e7c0d9d ContentView onOpenToolOptions
  • Python: commit 55d92b0 jas_app._open_tool_options_dialog
  • Magic Wand merged in e60064b (2026-04-25) across 4 native apps

https://claude.ai/code/session_01VG3Rqk2he5zQReMFz7Rdfi


Generated by Claude Code

Wire the arrow-slot double-click path in toolbar.ml to open the Magic
Wand panel (and fall back to the tool-options dialog for tools that use
one), closing the parity gap left when Magic Wand was merged in e60064b.

- toolbar.ml/mli: add tool_options_panel_id (reads tool_options_panel
  from workspace.json) and panel_id_to_kind ("magic_wand" →
  Workspace_layout.Magic_wand), mirroring toolbar_grid.rs commit 3292de1
- toolbar class + create: accept optional ?workspace_layout and
  ?refresh_dock, matching the existing menubar.ml pattern
- direct_btn TWO_BUTTON_PRESS: prefer panel → dialog dispatch, calls
  Workspace_layout.show_panel + refresh_dock on a panel hit
- canvas.ml/mli: return workspace_layout and refresh_dock closure from
  create_main_window so main.ml can thread them into Toolbar.create
- main.ml: destructure new return tuple; pass ~workspace_layout and
  ~refresh_dock to Toolbar.create
- canvas_test.ml: update pattern match for the extended tuple

https://claude.ai/code/session_01VG3Rqk2he5zQReMFz7Rdfi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants