mirror of
https://git.mirrors.martin98.com/https://github.com/bambulab/BambuStudio.git
synced 2025-09-28 17:03:12 +08:00
FIX: Dropdown click non grouped item
Change-Id: Ic2d073be946ed68ec249296e84d5bf97d6d9c587 Jira: STUDIO-12213 STUDIO-12208 STUDIO-12191 STUDIO-12192
This commit is contained in:
parent
1a90c581c4
commit
00dfff142a
@ -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();
|
||||
else
|
||||
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)
|
||||
{
|
||||
|
@ -897,14 +897,14 @@ void PlaterPresetComboBox::OnSelect(wxCommandEvent &evt)
|
||||
auto selected_item = evt.GetSelection();
|
||||
|
||||
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);
|
||||
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<std::string> first_vendors = {"", "Bambu", "Generic"}; // Empty vendor for non-system presets
|
||||
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]
|
||||
(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()) {
|
||||
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)
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user