Port the sketch usability fixes: Enter/Esc, rename, stale picks

Carries snaporca 95e59289f9, faec177d42 and 20df726ecb. Parity re-verified: 17 files identical,
8 diverging by their expected counts — DesignCanvas.cpp back to 16 and DesignPanel.cpp back to
32, which is the proof each hunk landed on the right side of the FeatFlyout and TAB_ID_PREPARE
divergences rather than on top of them.

All three answer exussum12's review on OrcaSlicer PR #15238.

ENTER/ESC IN THE VALUE FIELD. The field is a borderless always-on-top frame, and whether it may
hold keyboard focus is the platform's decision — a borderless NSWindow can never be key, and
mutter refuses a re-mapped window. When focus is denied the keys reach the panel instead and the
queued-dimension chain (a line queues Length then Angle) cannot be walked. The CHAR_HOOK now
forwards Enter/Numpad-Enter/Tab/Esc to the field when it is open and unfocused, and stays out of
the way when it is focused.

ESC FROM ANYWHERE. Separately and more simply: `dismissable` is false throughout sketch mode
because m_active is the FEATURE tool, so Esc fell through to whatever widget had focus. Click
any toolbar button or the Construction checkbox first and Esc did nothing at all — the likelier
reading of "Esc hardly ever works", and platform-independent. DesignCanvas exposes
request_sketch_exit() and the hook calls it whenever a sketch is live, after the inline-field
forwarding so an open field still takes Esc first.

RENAME. wxTR_EDIT_LABELS plus the two label-edit events write through to CadFeature::name and the
recipe, with a Rename verb in the offer and F2. The rebuild is deferred with CallAfter because
refresh_tree() destroys the very wxTreeItemId wx is holding during END_LABEL_EDIT — inline, it
killed the process.

STALE PICKS. set_tool now drops the Dimension tool's first pick, the Constrain picks and
m_point_sel, and delete_selected clears the pending dimension reference that could otherwise
dereference a renumbered entity.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tommaso Bianchi
2026-08-22 12:11:53 +02:00
co-authored by Claude Opus 5
parent fbf858ba47
commit 510e63dff2
6 changed files with 133 additions and 4 deletions
+21
View File
@@ -1211,6 +1211,27 @@ bool DesignCanvas::inline_busy() const
return m_sketch_tool.inline_busy();
}
bool DesignCanvas::inline_has_focus() const
{
return m_inline_editor && m_inline_editor->has_focus();
}
void DesignCanvas::inline_commit()
{
if (m_inline_editor) m_inline_editor->commit();
}
void DesignCanvas::inline_cancel()
{
if (m_inline_editor) m_inline_editor->cancel();
}
void DesignCanvas::request_sketch_exit()
{
m_sketch_tool.request_exit();
request_repaint();
}
bool DesignCanvas::live_sketch_has_work() const
{
return m_sketch_tool.live_sketch_has_work();