Design tab: one rule for mouse, Enter and Esc; honest status messages

Keyboard and mouse
- Esc drops what is pending (picks, a dimension's first point, an edit-op or transform) and
  never applies it; Enter applies a ready edit-op/transform, ends a polyline/spline chain,
  ends an armed tool, and confirms a feature card exactly when its ✓ is enabled.
- Right-click only abandons the gesture in progress; with nothing pending it opens the offer
  in every tool (Trim, edit-ops, transforms, Dimension, Constrain, TransformArt, move gizmo).
  Clicking empty space no longer commits. The offer needs no timing, only a still press.
- Delete removes only an explicit selection. Undo/redo inside a sketch go through the same
  route as the buttons (whole shapes, with redo); Edit > Undo follows the shown tab.
- The canvas no longer handles Delete/Esc/Ctrl+Z itself (Backspace in a value field deleted
  the geometry it measured); F is in the panel's key map.
- Value fields: a refused value keeps the field open with the reason; click outside and Tab
  commit; an untouched field commits the exact value; any decimal separator is accepted;
  lengths are always mm; validation is the same for every editor.
- Snapping: the marker shows only where the click will actually snap; pick tolerances are
  one set of pixel budgets (Constrain picks within reach; no mm floor on labels).

Messages and consistency
- set_status(kind, text) gives every status line its own colour and glyph; kernel errors are
  translated into sentences and formatted, not concatenated; sketch refusals go to the status
  line instead of the per-frame HUD that erased them.
- Hints describe the gestures that now work; Dimension shows its second step; Constrain uses
  the sketch palette (red means conflict only); the straight slot's value is its width.
- Hole/Thread/Project keep the user's pick or refuse up front; circular pattern opens with its
  own preview; thread fields use the nominal diameter and the ISO internal depth.

Integration
- MCP loads the project's recipe before touching the document, refuses to mutate it while the
  tab is busy, never runs a request that already timed out, only replaces a socket at its
  path, caps line length and removes the socket at exit; not started in the G-code viewer.
- Hiding a feature keeps later body references on their bodies; a design keeps its modeling
  origin across printer changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QK4VgguuCAk2hZLWgcjJb9
This commit is contained in:
Claude
2026-09-30 08:34:25 +00:00
parent a043979f44
commit 829124982d
15 changed files with 1166 additions and 978 deletions
+47 -8
View File
@@ -1320,6 +1320,14 @@ void MainFrame::show_option(bool show)
}
}
#ifdef SLIC3R_CAD
DesignPanel* MainFrame::shown_design_panel() const
{
DesignPanel* design = DesignPanel::if_built();
return (design != nullptr && m_design_page != nullptr && m_design_page->IsShownOnScreen()) ? design : nullptr;
}
#endif
void MainFrame::init_tabpanel() {
// wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on
// Windows 10 with multiple high resolution displays connected.
@@ -1411,8 +1419,9 @@ void MainFrame::init_tabpanel() {
#ifdef SLIC3R_CAD
// The experimental feature is off by default, and when it is off the page is never
// created, so the tab does not appear at all (the preference takes effect on the next
// start, like the other feature toggles).
if (wxGetApp().is_enable_cad_feature()) {
// start, like the other feature toggles). Nor in the G-code viewer, which has no Design tab to put
// it in — and no business opening a control socket onto one.
if (wxGetApp().is_enable_cad_feature() && wxGetApp().is_editor()) {
// Experimental and heavy enough that building it unasked would cost more than it saves.
m_design_page = new LazyPage<DesignPanel>(this, TAB_ID_DESIGN, -1);
m_lazy_pages.push_back(m_design_page);
@@ -3001,12 +3010,28 @@ void MainFrame::init_menubar_as_editor()
#ifndef __APPLE__
// BBS undo
append_shortcut_item(editMenu, Shortcut::Undo, true, _L("Undo"),
_L("Undo"), [this](wxCommandEvent&) { m_plater->undo(); },
"menu_undo", nullptr, [this](){return m_plater->can_undo(); }, this);
_L("Undo"), [this](wxCommandEvent&) {
#ifdef SLIC3R_CAD
if (DesignPanel* dp = shown_design_panel()) { dp->menu_undo_redo(false); return; }
#endif
m_plater->undo(); },
"menu_undo", nullptr, [this](){
#ifdef SLIC3R_CAD
if (DesignPanel* dp = shown_design_panel()) return dp->menu_can_undo_redo(false);
#endif
return m_plater->can_undo(); }, this);
// BBS redo
append_shortcut_item(editMenu, Shortcut::Redo, true, _L("Redo"),
_L("Redo"), [this](wxCommandEvent&) { m_plater->redo(); },
"menu_redo", nullptr, [this](){return m_plater->can_redo(); }, this);
_L("Redo"), [this](wxCommandEvent&) {
#ifdef SLIC3R_CAD
if (DesignPanel* dp = shown_design_panel()) { dp->menu_undo_redo(true); return; }
#endif
m_plater->redo(); },
"menu_redo", nullptr, [this](){
#ifdef SLIC3R_CAD
if (DesignPanel* dp = shown_design_panel()) return dp->menu_can_undo_redo(true);
#endif
return m_plater->can_redo(); }, this);
editMenu->AppendSeparator();
// BBS Cut TODO
append_shortcut_item(editMenu, Shortcut::Cut, true, _L("Cut"),
@@ -3053,8 +3078,15 @@ void MainFrame::init_menubar_as_editor()
if (handle_key_event(e)) {
return;
}
#ifdef SLIC3R_CAD
if (DesignPanel* dp = shown_design_panel()) { dp->menu_undo_redo(false); return; }
#endif
m_plater->undo(); },
"", nullptr, [this](){return m_plater->can_undo(); }, this);
"", nullptr, [this](){
#ifdef SLIC3R_CAD
if (DesignPanel* dp = shown_design_panel()) return dp->menu_can_undo_redo(false);
#endif
return m_plater->can_undo(); }, this);
// BBS redo
append_shortcut_item(editMenu, Shortcut::Redo, false, _L("Redo"),
_L("Redo"), [this, handle_key_event](wxCommandEvent&) {
@@ -3065,8 +3097,15 @@ void MainFrame::init_menubar_as_editor()
if (handle_key_event(e)) {
return;
}
#ifdef SLIC3R_CAD
if (DesignPanel* dp = shown_design_panel()) { dp->menu_undo_redo(true); return; }
#endif
m_plater->redo(); },
"", nullptr, [this](){return m_plater->can_redo(); }, this);
"", nullptr, [this](){
#ifdef SLIC3R_CAD
if (DesignPanel* dp = shown_design_panel()) return dp->menu_can_undo_redo(true);
#endif
return m_plater->can_redo(); }, this);
editMenu->AppendSeparator();
// BBS Cut TODO
append_shortcut_item(editMenu, Shortcut::Cut, false, _L("Cut"),