From 00dfff142a6a24872b3c102d57814bb8c3bf0e2a Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Thu, 15 May 2025 15:05:39 +0800 Subject: [PATCH] FIX: Dropdown click non grouped item Change-Id: Ic2d073be946ed68ec249296e84d5bf97d6d9c587 Jira: STUDIO-12213 STUDIO-12208 STUDIO-12191 STUDIO-12192 --- src/slic3r/GUI/GUI_ObjectList.cpp | 1 + src/slic3r/GUI/PresetComboBoxes.cpp | 18 +++++++++--------- src/slic3r/GUI/Widgets/DropDown.cpp | 10 +++++++--- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 3a68f7bf3..37bb60e7e 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1486,6 +1486,7 @@ void ObjectList::list_manipulation(const wxPoint& mouse_pos, bool evt_context_me dynamic_cast(wxGetApp().get_layer_tab())->reset_model_config(); else dynamic_cast(wxGetApp().get_model_tab(vol_idx >= 0))->reset_model_config(); + wxGetApp().params_panel()->notify_object_config_changed(); } else if (col_num == colName) { diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index d71cf9247..2045570a7 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -897,14 +897,14 @@ void PlaterPresetComboBox::OnSelect(wxCommandEvent &evt) auto selected_item = evt.GetSelection(); auto marker = reinterpret_cast(this->GetClientData(selected_item)); - if (marker >= LABEL_ITEM_MARKER && marker < LABEL_ITEM_MAX) { + if (marker >= LABEL_ITEM_DISABLED && marker < LABEL_ITEM_MAX) { this->SetSelection(m_last_selected); if (LABEL_ITEM_WIZARD_ADD_PRINTERS == marker) { evt.Skip(); return; } evt.StopPropagation(); - if (marker == LABEL_ITEM_MARKER) + if (marker == LABEL_ITEM_MARKER || marker == LABEL_ITEM_DISABLED) return; //if (marker == LABEL_ITEM_WIZARD_PRINTERS) // show_add_menu(); @@ -1235,7 +1235,7 @@ void PlaterPresetComboBox::update() std::vector first_vendors = {"", "Bambu", "Generic"}; // Empty vendor for non-system presets std::vector first_types = {"PLA", "PETG", "ABS", "TPU"}; auto add_presets = [this, &preset_descriptions, &filament_orders, &preset_filament_vendors, &first_vendors, &preset_filament_types, &first_types, &selected_in_ams] - (std::map const &presets, wxString const &selected, std::string const &group) { + (std::map const &presets, wxString const &selected, std::string const &group, wxString const &groupName) { if (!presets.empty()) { set_label_marker(Append(group, wxNullBitmap, DD_ITEM_STYLE_SPLIT_ITEM)); if (m_type == Preset::TYPE_FILAMENT) { @@ -1270,8 +1270,8 @@ void PlaterPresetComboBox::update() }); bool unsupported = group == "Unsupported presets"; for (auto it : list) { - auto groupName = groupByGroup ? group : preset_filament_vendors[it->first]; - int index = Append(it->first, *it->second, groupName, nullptr, unsupported ? DD_ITEM_STYLE_DISABLED : 0); + auto groupName2 = groupByGroup ? groupName : preset_filament_vendors[it->first]; + int index = Append(it->first, *it->second, groupName2, nullptr, unsupported ? DD_ITEM_STYLE_DISABLED : 0); if (unsupported) set_label_marker(index, LABEL_ITEM_DISABLED); SetItemTooltip(index, preset_descriptions[it->first]); @@ -1293,11 +1293,11 @@ void PlaterPresetComboBox::update() }; //BBS: add project embedded preset logic - add_presets(project_embedded_presets, selected_user_preset, L("Project-inside presets")); - add_presets(nonsys_presets, selected_user_preset, L("User presets")); + add_presets(project_embedded_presets, selected_user_preset, L("Project-inside presets"), _L("Project")); + add_presets(nonsys_presets, selected_user_preset, L("User presets"), _L("User")); // BBS: move system to the end - add_presets(system_presets, selected_system_preset, L("System presets")); - add_presets(uncompatible_presets, {}, L("Unsupported presets")); + add_presets(system_presets, selected_system_preset, L("System presets"), _L("System")); + add_presets(uncompatible_presets, {}, L("Unsupported presets"), _L("Unsupported")); //BBS: remove unused pysical printer logic /*if (m_type == Preset::TYPE_PRINTER) diff --git a/src/slic3r/GUI/Widgets/DropDown.cpp b/src/slic3r/GUI/Widgets/DropDown.cpp index 482c2733f..57eefc5b4 100644 --- a/src/slic3r/GUI/Widgets/DropDown.cpp +++ b/src/slic3r/GUI/Widgets/DropDown.cpp @@ -633,7 +633,9 @@ void DropDown::mouseReleased(wxMouseEvent& event) pressedDown = false; if (HasCapture()) ReleaseMouse(); - if (hover_item >= 0 && subDropDown == nullptr) { // not moved + if (hover_item < 0) + return; + if (hover_item >= 0 && (subDropDown == nullptr || subDropDown->group.empty())) { // not moved sendDropDownEvent(); if (mainDropDown) mainDropDown->hover_item = -1; // To Dismiss mainDropDown @@ -696,6 +698,7 @@ void DropDown::mouseMove(wxMouseEvent &event) drop.Popup(&drop); } else if (index >= 0) { if (subDropDown) { + subDropDown->group.clear(); if (subDropDown->IsShown()) subDropDown->Dismiss(); } @@ -723,7 +726,8 @@ void DropDown::mouseWheelMoved(wxMouseEvent &event) if (hover >= (int) count) hover = -1; if (hover != hover_item) { hover_item = hover; - if (hover >= 0) SetToolTip(items[hover].tip); + if (auto index = hoverIndex(); index >= 0) + SetToolTip(items[index].tip); } paintNow(); } @@ -732,7 +736,7 @@ void DropDown::mouseWheelMoved(wxMouseEvent &event) void DropDown::sendDropDownEvent() { int index = hoverIndex(); - if (index < 0) + if (index < 0 || (items[index].style & DD_ITEM_STYLE_DISABLED)) return; wxCommandEvent event(wxEVT_COMBOBOX, GetId()); event.SetEventObject(this);