Stop duplicate mode names from trapping a plate's mode cycle

The editor only replaced an empty name, so a row could be given a name another
row already had. A plate stores its mode by name and find_imex_mode() takes the
first row with it, so the second row was unreachable, and the plate's mode
list repeated the name: left-click stuck on it, or looped without getting back
to Primary.

An edited name that another row already carries, or the reserved Primary name
in any case, is now replaced when the edit is committed: "copy" becomes
"copy 2". The edited row yields, so plates keep resolving to the row they
meant, and tabbing through a field without changing it checks nothing.
Resetting a row to a saved name that another row has since taken does the
same. The plate's mode list comes from imex_plate_mode_choices(), which lists
each name once, so a profile that already has duplicates still cycles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Clifford Garwood
2026-10-02 23:17:21 -04:00
co-authored by Claude Opus 5.5
parent 8af5fa45e7
commit 9c5f4ebe47
6 changed files with 82 additions and 19 deletions
+3 -6
View File
@@ -22909,12 +22909,9 @@ int Plater::select_plate_by_hover_id(int hover_id, bool right_click, bool isModi
ret = select_plate(plate_index);
if (!ret) {
PartPlate* curr_plate = p->partplate_list.get_curr_plate();
// Build ordered mode list: kImexPrimaryMode first, then all named modes.
std::vector<std::string> modes;
modes.push_back(kImexPrimaryMode);
const DynamicPrintConfig& printer_cfg = wxGetApp().preset_bundle->printers.get_edited_preset().config;
for (const ImexMode& m : imex_mode_table(printer_cfg))
if (!m.name.empty() && m.name != kImexPrimaryMode) modes.push_back(m.name);
// Ordered mode list: kImexPrimaryMode first, then each named mode once.
const std::vector<std::string> modes =
imex_plate_mode_choices(wxGetApp().preset_bundle->printers.get_edited_preset().config);
if (right_click) {
// Show a popup menu with all modes.