feat: pl_editor WASM port + browser file dialog fixes

Brings up KiCad's pagelayout_editor (drawing-sheet editor) in the
browser, to roughly the same "boots, canvas visible, partially usable
in-session" level as the existing pcbnew/eeschema/calculator ports.

Build:
- docker/build.sh: add pl_editor to the unified app dispatch (case,
  subdir map, all-loop).
- scripts/kicad/build-kicad-target.sh: add pl_editor to the case;
  upstream target name pl_editor under source subdir pagelayout_editor.
- scripts/kicad/build-pl_editor.sh: 7-line thin wrapper matching the
  pcbnew/eeschema/calculator pattern.
- tests/scripts/setup-kicad-wasm.sh: copy_app pl_editor.

App glue:
- wasm/stubs/nl_pl_editor_plugin_stub.cpp: no-op SpaceMouse plugin so
  pl_editor_frame.cpp's NL_PL_EDITOR_PLUGIN symbols resolve. Mirrors
  nl_pcbnew_plugin_stub.cpp.
- tests/apps/kicad/pl_editor.html: browser shell. preRun creates
  /home/kicad and FS.chdir there so file dialogs land somewhere
  friendly instead of MEMFS root (/dev/, /proc/, etc.).

E2E coverage:
- tests/kicad/pl_editor.spec.ts: 5 tests — smoke (canvas, no abort),
  wizard, File menu has Open/Save As, file-dialog folder-navigation
  regression, canvas + toolbar metrics.
- tests/e2e/filedialog-folder-nav.spec.ts: wxWidgets-level twin of
  the regression test (exercises the underlying widget directly via
  the standalone filedialog_test app).

Submodule bumps:
- kicad → feature/pl-editor (WASM gating in pagelayout_editor's
  CMakeLists + navlib stub).
- wxwidgets → feature/pl-editor (wxGenericFileDialog::OnOk navigates
  into selected directories; wasm/mouse.cpp emits wxEVT_LEFT_DCLICK
  via timestamp-based double-click detection — the latter benefits
  every wxWidgets-WASM app).

See features/pl-editor/ for the design doc + per-repo diff patches.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Balint Ipkovich 2026-06-01 10:30:56 +02:00
commit d735779e23
14 changed files with 1436 additions and 11 deletions

View file

@ -1,11 +1,11 @@
#!/bin/bash
# Build a KiCad app (pcbnew, eeschema, calculator) for WebAssembly.
# Build a KiCad app (pcbnew, eeschema, calculator, pl_editor) for WebAssembly.
#
# Usage:
# ./scripts/kicad/build-kicad-target.sh <app> [options]
#
# Args:
# <app> pcbnew | eeschema | calculator (required)
# <app> pcbnew | eeschema | calculator | pl_editor (required)
#
# Options:
# --full Full clean rebuild (dependencies + KiCad)
@ -26,25 +26,26 @@
# the source subdirectory. Calculator is the exception: app=calculator but the
# upstream target and source subdir are both pcb_calculator (the OUTPUT_NAME
# property in pcb_calculator/CMakeLists.txt emits calculator.{js,wasm}).
# pl_editor is the standard case but its source subdir is pagelayout_editor.
set -e
if [ -z "$1" ]; then
echo "Error: missing <app> argument (pcbnew | eeschema | calculator)" >&2
echo "Error: missing <app> argument (pcbnew | eeschema | calculator | pl_editor)" >&2
exit 1
fi
APP_NAME="$1"
shift
case "$APP_NAME" in
pcbnew|eeschema)
pcbnew|eeschema|pl_editor)
KICAD_TARGET="$APP_NAME"
;;
calculator)
KICAD_TARGET="pcb_calculator"
;;
*)
echo "Error: unknown app '$APP_NAME' (expected: pcbnew | eeschema | calculator)" >&2
echo "Error: unknown app '$APP_NAME' (expected: pcbnew | eeschema | calculator | pl_editor)" >&2
exit 1
;;
esac

View file

@ -0,0 +1,7 @@
#!/bin/bash
# Build KiCad pl_editor (drawing-sheet editor) for WebAssembly.
# Thin wrapper around build-kicad-target.sh — see that script for options.
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
exec "${SCRIPT_DIR}/build-kicad-target.sh" pl_editor "$@"