FIX: Dropdown click non grouped item

Change-Id: Ic2d073be946ed68ec249296e84d5bf97d6d9c587
Jira: STUDIO-12213 STUDIO-12208 STUDIO-12191 STUDIO-12192
This commit is contained in:
chunmao.guo 2025-05-15 15:05:39 +08:00 committed by lane.wei
parent 1a90c581c4
commit 00dfff142a
3 changed files with 17 additions and 12 deletions

View File

@ -1486,6 +1486,7 @@ void ObjectList::list_manipulation(const wxPoint& mouse_pos, bool evt_context_me
dynamic_cast<TabPrintLayer*>(wxGetApp().get_layer_tab())->reset_model_config(); dynamic_cast<TabPrintLayer*>(wxGetApp().get_layer_tab())->reset_model_config();
else else
dynamic_cast<TabPrintModel*>(wxGetApp().get_model_tab(vol_idx >= 0))->reset_model_config(); dynamic_cast<TabPrintModel*>(wxGetApp().get_model_tab(vol_idx >= 0))->reset_model_config();
wxGetApp().params_panel()->notify_object_config_changed();
} }
else if (col_num == colName) else if (col_num == colName)
{ {

View File

@ -897,14 +897,14 @@ void PlaterPresetComboBox::OnSelect(wxCommandEvent &evt)
auto selected_item = evt.GetSelection(); auto selected_item = evt.GetSelection();
auto marker = reinterpret_cast<Marker>(this->GetClientData(selected_item)); auto marker = reinterpret_cast<Marker>(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); this->SetSelection(m_last_selected);
if (LABEL_ITEM_WIZARD_ADD_PRINTERS == marker) { if (LABEL_ITEM_WIZARD_ADD_PRINTERS == marker) {
evt.Skip(); evt.Skip();
return; return;
} }
evt.StopPropagation(); evt.StopPropagation();
if (marker == LABEL_ITEM_MARKER) if (marker == LABEL_ITEM_MARKER || marker == LABEL_ITEM_DISABLED)
return; return;
//if (marker == LABEL_ITEM_WIZARD_PRINTERS) //if (marker == LABEL_ITEM_WIZARD_PRINTERS)
// show_add_menu(); // show_add_menu();
@ -1235,7 +1235,7 @@ void PlaterPresetComboBox::update()
std::vector<std::string> first_vendors = {"", "Bambu", "Generic"}; // Empty vendor for non-system presets std::vector<std::string> first_vendors = {"", "Bambu", "Generic"}; // Empty vendor for non-system presets
std::vector<std::string> first_types = {"PLA", "PETG", "ABS", "TPU"}; std::vector<std::string> 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] auto add_presets = [this, &preset_descriptions, &filament_orders, &preset_filament_vendors, &first_vendors, &preset_filament_types, &first_types, &selected_in_ams]
(std::map<wxString, wxBitmap *> const &presets, wxString const &selected, std::string const &group) { (std::map<wxString, wxBitmap *> const &presets, wxString const &selected, std::string const &group, wxString const &groupName) {
if (!presets.empty()) { if (!presets.empty()) {
set_label_marker(Append(group, wxNullBitmap, DD_ITEM_STYLE_SPLIT_ITEM)); set_label_marker(Append(group, wxNullBitmap, DD_ITEM_STYLE_SPLIT_ITEM));
if (m_type == Preset::TYPE_FILAMENT) { if (m_type == Preset::TYPE_FILAMENT) {
@ -1270,8 +1270,8 @@ void PlaterPresetComboBox::update()
}); });
bool unsupported = group == "Unsupported presets"; bool unsupported = group == "Unsupported presets";
for (auto it : list) { for (auto it : list) {
auto groupName = groupByGroup ? group : preset_filament_vendors[it->first]; auto groupName2 = groupByGroup ? groupName : preset_filament_vendors[it->first];
int index = Append(it->first, *it->second, groupName, nullptr, unsupported ? DD_ITEM_STYLE_DISABLED : 0); int index = Append(it->first, *it->second, groupName2, nullptr, unsupported ? DD_ITEM_STYLE_DISABLED : 0);
if (unsupported) if (unsupported)
set_label_marker(index, LABEL_ITEM_DISABLED); set_label_marker(index, LABEL_ITEM_DISABLED);
SetItemTooltip(index, preset_descriptions[it->first]); SetItemTooltip(index, preset_descriptions[it->first]);
@ -1293,11 +1293,11 @@ void PlaterPresetComboBox::update()
}; };
//BBS: add project embedded preset logic //BBS: add project embedded preset logic
add_presets(project_embedded_presets, selected_user_preset, L("Project-inside 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")); add_presets(nonsys_presets, selected_user_preset, L("User presets"), _L("User"));
// BBS: move system to the end // BBS: move system to the end
add_presets(system_presets, selected_system_preset, L("System presets")); add_presets(system_presets, selected_system_preset, L("System presets"), _L("System"));
add_presets(uncompatible_presets, {}, L("Unsupported presets")); add_presets(uncompatible_presets, {}, L("Unsupported presets"), _L("Unsupported"));
//BBS: remove unused pysical printer logic //BBS: remove unused pysical printer logic
/*if (m_type == Preset::TYPE_PRINTER) /*if (m_type == Preset::TYPE_PRINTER)

View File

@ -633,7 +633,9 @@ void DropDown::mouseReleased(wxMouseEvent& event)
pressedDown = false; pressedDown = false;
if (HasCapture()) if (HasCapture())
ReleaseMouse(); 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(); sendDropDownEvent();
if (mainDropDown) if (mainDropDown)
mainDropDown->hover_item = -1; // To Dismiss mainDropDown mainDropDown->hover_item = -1; // To Dismiss mainDropDown
@ -696,6 +698,7 @@ void DropDown::mouseMove(wxMouseEvent &event)
drop.Popup(&drop); drop.Popup(&drop);
} else if (index >= 0) { } else if (index >= 0) {
if (subDropDown) { if (subDropDown) {
subDropDown->group.clear();
if (subDropDown->IsShown()) if (subDropDown->IsShown())
subDropDown->Dismiss(); subDropDown->Dismiss();
} }
@ -723,7 +726,8 @@ void DropDown::mouseWheelMoved(wxMouseEvent &event)
if (hover >= (int) count) hover = -1; if (hover >= (int) count) hover = -1;
if (hover != hover_item) { if (hover != hover_item) {
hover_item = hover; hover_item = hover;
if (hover >= 0) SetToolTip(items[hover].tip); if (auto index = hoverIndex(); index >= 0)
SetToolTip(items[index].tip);
} }
paintNow(); paintNow();
} }
@ -732,7 +736,7 @@ void DropDown::mouseWheelMoved(wxMouseEvent &event)
void DropDown::sendDropDownEvent() void DropDown::sendDropDownEvent()
{ {
int index = hoverIndex(); int index = hoverIndex();
if (index < 0) if (index < 0 || (items[index].style & DD_ITEM_STYLE_DISABLED))
return; return;
wxCommandEvent event(wxEVT_COMBOBOX, GetId()); wxCommandEvent event(wxEVT_COMBOBOX, GetId());
event.SetEventObject(this); event.SetEventObject(this);