From 3d3324d663b101c09261354dea155abd2967e5b4 Mon Sep 17 00:00:00 2001 From: Tommaso Bianchi Date: Sun, 23 Aug 2026 16:21:23 +0200 Subject: [PATCH] A feature-tree row can be renamed by someone who does not already know F2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User report 2026-08-23: "on feature tree, i cannot rename sketch name". The rename was not broken. Verified on the rig before changing anything: select the row, press F2, type, Enter — Sketch1 becomes Base, the name reaches m_doc.features[idx].name and sync_recipe_to_model() persists it. The offer's btn:rename verb does the same. What was missing was any way to find that out. Everything a person would try did something else: - the pencil in the section header is EDIT (on_edit_feature) - a double-click fires wxEVT_TREE_ITEM_ACTIVATED, which is also Edit - none of the seven header icons renames - right-clicking a row did nothing at all and the comment above the label-edit handlers claimed a "slow double-click" renames, which does not survive wxGTK: the activation wins and the sketch opens for editing instead. So the only route was an undocumented function key, and the report is exactly right from where the user stands. The row now answers the gesture people actually use on a named row: right-click gives Rename (F2) / Edit / Delete, with Rename opening the in-place editor on that row. Right-click SELECTS what it points at first, so the menu can never act on a different row than the one under the cursor. And selecting a row now says what the row can do: "Sketch1 selected — F2 or right-click renames it, double-click edits it". Cheaper than a tooltip nobody hovers, and it uses the status line that already exists for exactly this. A note on the surface, since it is a design call: the CANVAS right-click is the offer, this fork's single adaptive menu, and this is not that. A tree row is a different surface, and its menu is three items about the row. Routing tree rows through the offer would mean teaching the offer a selection kind that is not geometry, which is a larger change and not what this report needed. Verified on the rig by the gesture it names: right-click the row, choose Rename, type, Enter -> ['Sketch1'] becomes ['Base profile'] in describe_scene. Gate green: ALL LADDERS HELD — offer table OK, kernel 188 cases / 2532 assertions, engine rungs 1-8, 977-sheet corpus + the heaviest sheets, gesture ladder 98/98, offer ladder 108/108. --- src/slic3r/GUI/CAD/DesignPanel.cpp | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/slic3r/GUI/CAD/DesignPanel.cpp b/src/slic3r/GUI/CAD/DesignPanel.cpp index acc0245d4f..c29e145f94 100644 --- a/src/slic3r/GUI/CAD/DesignPanel.cpp +++ b/src/slic3r/GUI/CAD/DesignPanel.cpp @@ -3079,6 +3079,13 @@ DesignPanel::DesignPanel(wxWindow* parent) m_status->SetForegroundColour(wxColour(235, 110, 110)); set_status(wxString::FromUTF8(*why) + _L(" — the eye suppresses this mate")); m_status->Refresh(); + } else if (sel >= 0 && sel < int(m_doc.features.size())) { + // Name the two gestures the row supports, because neither is visible on it. + m_status->SetForegroundColour(wxNullColour); + set_status(wxString::Format( + _L("%s selected — F2 or right-click renames it, double-click edits it"), + wxString::FromUTF8(m_doc.features[sel].name))); + m_status->Refresh(); } }); @@ -3087,6 +3094,34 @@ DesignPanel::DesignPanel(wxWindow* parent) // Edit button in the section header. m_tree->Bind(wxEVT_TREE_ITEM_ACTIVATED, [this](wxTreeEvent&) { on_edit_feature(); }); + // Right-click a row: the three things a row can do. Renaming had no discoverable route at + // all — the header pencil is Edit, a double-click ACTIVATES the row and is also Edit (the + // "slow double-click renames" the old comment promised does not survive wxGTK, which fires + // ITEM_ACTIVATED first), none of the seven header icons renames, and F2 is a function key + // nothing announces. A user who wants to name a sketch tries the row, and now the row + // answers. snaporca-rename. + m_tree->Bind(wxEVT_TREE_ITEM_RIGHT_CLICK, [this](wxTreeEvent& e) { + m_tree->SelectItem(e.GetItem()); // right-click targets what it points at + const int sel = tree_selection(); + if (sel == wxNOT_FOUND) return; + wxMenu menu; + const int id_rename = wxWindow::NewControlId(); + const int id_edit = wxWindow::NewControlId(); + const int id_del = wxWindow::NewControlId(); + menu.Append(id_rename, _L("Rename\tF2")); + menu.Append(id_edit, _L("Edit")); + menu.AppendSeparator(); + menu.Append(id_del, _L("Delete")); + menu.Bind(wxEVT_MENU, [this](wxCommandEvent&) { + const int row = tree_selection(); + if (row != wxNOT_FOUND && row < int(m_tree_items.size())) + m_tree->EditLabel(m_tree_items[row]); + }, id_rename); + menu.Bind(wxEVT_MENU, [this](wxCommandEvent&) { on_edit_feature(); }, id_edit); + menu.Bind(wxEVT_MENU, [this](wxCommandEvent&) { on_delete_feature(); }, id_del); + m_tree->PopupMenu(&menu); + }); + // In-place rename of a feature row (slow double-click, the offer's Rename verb, or F2). // The name is what makes a tree of eight sketches readable, and the tree row IS the object — // so renaming belongs on the row, not in a side-panel field. Bodies are computed results,