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>
75 lines
2.7 KiB
Diff
75 lines
2.7 KiB
Diff
diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp
|
|
index 4b89dcdc6f4..e895557f86d 100644
|
|
--- a/src/generic/filedlgg.cpp
|
|
+++ b/src/generic/filedlgg.cpp
|
|
@@ -337,6 +337,18 @@ void wxGenericFileDialog::OnOk( wxCommandEvent &WXUNUSED(event) )
|
|
|
|
const wxString& path = selectedFiles[0];
|
|
|
|
+ // If the user OKs a directory (via single-click + Enter/OK, or via a
|
|
+ // double-click that routed through here instead of wxGenericFileCtrl's
|
|
+ // OnActivated), navigate into the directory rather than closing the dialog
|
|
+ // and surfacing the folder path to the caller as if it were a file.
|
|
+ // Without this, KiCad's Open Drawing Sheet then tries to LoadDrawingSheetFile
|
|
+ // on the folder and surfaces "Unable to load /dev file" to the user.
|
|
+ if (selectedFiles.Count() == 1 && wxDirExists(path))
|
|
+ {
|
|
+ m_filectrl->SetDirectory(path);
|
|
+ return;
|
|
+ }
|
|
+
|
|
if (selectedFiles.Count() == 1)
|
|
{
|
|
SetPath(path);
|
|
diff --git a/src/wasm/mouse.cpp b/src/wasm/mouse.cpp
|
|
index e3a2d1cfdef..62fb7c92cba 100644
|
|
--- a/src/wasm/mouse.cpp
|
|
+++ b/src/wasm/mouse.cpp
|
|
@@ -12,7 +12,9 @@
|
|
#include "wx/log.h"
|
|
#include <emscripten/html5.h>
|
|
|
|
-//#define HAS_MOUSE_DETAIL
|
|
+// Double-click detection threshold (ms). Matches the default
|
|
+// wxSYS_DCLICK_MSEC on most platforms.
|
|
+#define WASM_DCLICK_MSEC 500.0
|
|
|
|
namespace
|
|
{
|
|
@@ -63,11 +65,32 @@ wxEventType GetMouseEventType(int emscriptenEventType,
|
|
wxEventType eventType;
|
|
std::string eventName;
|
|
|
|
-#ifdef HAS_MOUSE_DETAIL
|
|
- int clickCount = event.detail;
|
|
-#else
|
|
+ // EmscriptenMouseEvent no longer exposes a click-count field, so we
|
|
+ // detect double-clicks ourselves: two MOUSEDOWNs of the same button
|
|
+ // within WASM_DCLICK_MSEC count as a double-click. The browser also
|
|
+ // dispatches a real 'dblclick' event we could hook, but tracking it
|
|
+ // on MOUSEDOWN lets wxEVT_LEFT_DCLICK arrive at the same point in the
|
|
+ // sequence as on desktop (between LEFT_DOWN and LEFT_UP), which is
|
|
+ // what wxGenericListCtrl's activation logic expects.
|
|
+ static double lastMouseDownTime = 0.0;
|
|
+ static unsigned short lastMouseDownButton = 0xFFFF;
|
|
int clickCount = 1;
|
|
-#endif
|
|
+ if (emscriptenEventType == EMSCRIPTEN_EVENT_MOUSEDOWN)
|
|
+ {
|
|
+ if (event.button == lastMouseDownButton &&
|
|
+ (event.timestamp - lastMouseDownTime) < WASM_DCLICK_MSEC)
|
|
+ {
|
|
+ clickCount = 2;
|
|
+ // Reset so a quick third click isn't chained as another DCLICK.
|
|
+ lastMouseDownTime = 0.0;
|
|
+ lastMouseDownButton = 0xFFFF;
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ lastMouseDownTime = event.timestamp;
|
|
+ lastMouseDownButton = event.button;
|
|
+ }
|
|
+ }
|
|
|
|
switch (emscriptenEventType)
|
|
{
|