Design: clicking the same face twice takes the body, and the status line moves onto the viewport

A click could point at a face, an edge or a vertex, but never at the body those
belong to: offer_selection_kind() can only return BodySolid when all three are
clear, which a viewport click never produces. The rubber band was the only door,
and the status line said "face 5 selected" while the user believed they had taken
the body. A second click on the SAME sub-element now escalates to it (snaporca-gem).

Not the pick cycle that was removed in bc2b741ce9 -- that one was silent and three
deep, so no click had a predictable meaning. Here the status line names the next
click before you make it, and a further click just takes the face under the cursor
again, which needs no teaching. Double-click is untouched: wx sends Down/Up/DClick/Up
and only the first Up carries a pending press, so a fast double-click still zooms to
fit and picks once.

The status line itself moved to the base of the viewport. In the side panel it was
clipped at ~73 characters with no warning and no wrap -- set_status()'s Wrap() never
took effect (snaporca-8cc) -- which silently length-limited every hint in the tab; the
first version of this change lost a clause to it. m_status is kept, hidden, as the
owner of the text and its colour, and the line is drawn in a bottom-left twin of the
readout HUD where there is a whole window's width.

Three defects found driving it on the rig, none of which the build could see:

  * the HUD as a wxFrame took the WM's keyboard focus every time it was raised, and
    the canvas then received NO key events -- every sketch shortcut silently dead.
    Caught with SNAPORCA_KEYTRACE: shift+S logged a line, the following R logged
    nothing. It is a wxPopupWindow now, which cannot be focused. SetFocus() on the
    canvas does not fix it: focus was on another toplevel.
  * zero vertical padding fits the popup tighter than the font's line box and clips
    the glyphs; 6 (what the readout uses) reads as a two-line box. 3 is right.
  * "has a caller chosen a colour?" compared the label's foreground against its
    PARENT's, which differ by default, so every line counted as chosen and the
    neutral text came out the panel's dark grey -- invisible on a dark chip. Compare
    against the colour the label was created with, captured before any caller writes.

Verified on both rigs against fresh binaries: sketch -> extrude -> click face ->
click again -> whole body tinted, offer opens with the body rows live and Create /
Add material correctly greyed. Keyboard drives the whole sequence.

Filed and NOT fixed here: snaporca-od0 -- a bare-plate click does not deselect the
solid, so "click away, click back" escalates. Pre-existing; clearing there would also
drop the face the Thicken/Shell/Draft cards hold, which needs its own pass.

Refs: snaporca-gem, snaporca-8cc, snaporca-od0
This commit is contained in:
Tommaso Bianchi
2026-08-02 12:12:50 +02:00
parent 7e5994b8cb
commit c32aa3f8ba
5 changed files with 137 additions and 13 deletions
+33 -7
View File
@@ -3056,6 +3056,8 @@ DesignPanel::DesignPanel(wxWindow* parent)
const int cm = FromDIP(SidebarProps::ContentMargin());
m_status = new wxStaticText(m_form, wxID_ANY, "");
m_status->Hide(); // storage only — the line is drawn over the viewport, see set_status()
m_status_default_fg = m_status->GetForegroundColour(); // capture BEFORE any caller writes
root->Add(m_status, 0, wxLEFT | wxRIGHT | wxBOTTOM, 12);
// DoF / constraint-state readout (P3). Dedicated line so it never clobbers the
@@ -3413,10 +3415,21 @@ DesignPanel::DesignPanel(wxWindow* parent)
m_status->SetForegroundColour(wxNullColour);
const int nb = int(m_doc.bodies.size());
const wxString bodytag = (nb > 1) ? wxString::Format(_L("Body %d "), body + 1) : wxString();
set_status(level == 4 ? bodytag + _L("vertex selected")
: level == 1 ? bodytag + _L("selected (whole body)")
: level == 2 ? bodytag + wxString::Format(_L("face %d selected — right-click to push/pull it"), face)
: level == 3 ? bodytag + wxString::Format(_L("edge %d selected — Fillet/Chamfer to dress it"), edge)
// Each sub-element line ends by naming the NEXT click (snaporca-gem). Escalation to the
// whole body is a gesture nothing on screen would otherwise reveal, and the status line
// is the only surface that can teach it at the moment it applies. It REPLACES the old
// per-level verb hints ("right-click to push/pull it", "Fillet/Chamfer to dress it")
// rather than joining them: the line is clipped at the panel edge past ~55 characters
// (set_status's Wrap() does not take effect — snaporca-8cc), and those verbs are shown
// with their icons in the offer anyway, while this gesture is shown nowhere else.
// Both clauses fit now that the line is drawn over the viewport instead of squeezed
// into the panel. Say "what applies to it", never "verbs" — that is this codebase's
// word for a tool-offer entry, not a word the drawing office uses, and the plane and
// bodies-list lines already say it the right way.
set_status(level == 4 ? bodytag + _L("vertex selected — click again for the whole body")
: level == 1 ? bodytag + _L("selected (whole body) — right-click for what applies to it")
: level == 2 ? bodytag + wxString::Format(_L("face %d selected — right-click to push/pull it, or click again for the whole body"), face)
: level == 3 ? bodytag + wxString::Format(_L("edge %d selected — Fillet/Chamfer to dress it, or click again for the whole body"), edge)
: _L("Nothing selected"));
m_status->Refresh();
});
@@ -5285,9 +5298,22 @@ void DesignPanel::set_status(const wxString& text)
{
if (m_status == nullptr) return;
m_status->SetLabel(text); // the ONE place that may call SetLabel directly
const int w = m_status->GetParent() ? m_status->GetParent()->GetClientSize().x - 24 : 420;
m_status->Wrap(w > 120 ? w : 420);
m_status->Refresh();
// m_status is HIDDEN and kept only as the owner of the text and its colour — every caller
// sets the colour on it just before calling here, so this stays the one place that knows
// both. What the user reads is drawn along the BASE OF THE VIEWPORT: in the panel the line
// was clipped at ~73 characters with no warning and no wrap (Wrap() never took effect —
// snaporca-8cc), which silently length-limited every hint in the tab. The viewport's bottom
// margin has the whole window width, so a sentence can be a sentence.
if (m_viewport != nullptr) {
// wxNullColour means "no opinion", and the dark default text colour is nearly invisible
// on the dark HUD; only a colour a caller actually chose (the error red, the plane-pick
// green) is carried over. Compared against the colour the label was CREATED with —
// comparing against the parent's foreground instead reported "chosen" for every line,
// and the neutral text came out the panel's grey.
const wxColour fg = m_status->GetForegroundColour();
m_viewport->set_status_text(text, fg != m_status_default_fg ? fg
: wxColour(0xDD, 0xE1, 0xE6));
}
}
wxMenuItem* DesignPanel::append_offer_item(wxMenu* menu, int id, const wxString& text,