diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index 0e5d8f7f5..43bccdcb5 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -1109,6 +1109,7 @@ void PlaterPresetComboBox::update() //BBS: add project embedded presets logic std::map project_embedded_presets; std::map system_presets; + std::map uncompatible_presets; std::unordered_set system_printer_models; std::map preset_descriptions; std::map preset_filament_vendors; @@ -1132,7 +1133,7 @@ void PlaterPresetComboBox::update() m_type == Preset::TYPE_PRINTER && m_preset_bundle->physical_printers.has_selection() ? false : i == m_collection->get_selected_idx(); - if (!is_selected && (!preset.is_visible ||!preset.is_compatible)) + if (!is_selected && !preset.is_visible) { continue; } @@ -1155,8 +1156,16 @@ void PlaterPresetComboBox::update() bitmap_key += single_bar ? filament_rgb : filament_rgb + extruder_rgb; #endif - preset_filament_vendors[name] = preset.config.option("filament_vendor")->values.at(0); - preset_filament_types[name] = preset.config.option("filament_type")->values.at(0); + if (preset.is_system) { + if (!preset.is_compatible && preset_filament_vendors.count(name) > 0) + continue; + else if (preset.is_compatible && preset_filament_vendors.count(name) > 0) + uncompatible_presets.erase(name); + preset_filament_vendors[name] = preset.config.option("filament_vendor")->values.at(0); + if (preset_filament_vendors[name] == "Bambu Lab") + preset_filament_vendors[name] = "Bambu"; + preset_filament_types[name] = preset.config.option("filament_type")->values.at(0); + } } wxBitmap* bmp = get_bmp(preset); @@ -1164,7 +1173,12 @@ void PlaterPresetComboBox::update() preset_descriptions.emplace(name, _L(preset.description)); - if (preset.is_default || preset.is_system) { + if (!preset.is_compatible) { + if (boost::ends_with(name, " template")) + continue; + uncompatible_presets.emplace(name, bmp); + } + else if (preset.is_default || preset.is_system) { //BBS: move system to the end if (m_type == Preset::TYPE_PRINTER) { auto printer_model = preset.config.opt_string("printer_model"); @@ -1218,7 +1232,7 @@ void PlaterPresetComboBox::update() std::vector filament_orders = {"Bambu PLA Basic", "Bambu PLA Matte", "Bambu PETG HF", "Bambu ABS", "Bambu PLA Silk", "Bambu PLA-CF", "Bambu PLA Galaxy", "Bambu PLA Metal", "Bambu PLA Marble", "Bambu PETG-CF", "Bambu PETG Translucent", "Bambu ABS-GF"}; - std::vector first_vendors = {"Bambu Lab", "Generic"}; + std::vector first_vendors = {"Bambu", "Generic"}; 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) { @@ -1250,7 +1264,10 @@ void PlaterPresetComboBox::update() return l->first < r->first; }); for (auto it : list) { - SetItemTooltip(Append(it->first, *it->second), preset_descriptions[it->first]); + auto vendor = preset_filament_vendors[it->first]; + if (!vendor.empty() && group == "Unsupported presets") + vendor.push_back(' '); + SetItemTooltip(Append(it->first, *it->second, vendor), preset_descriptions[it->first]); bool is_selected = it->first == selected; validate_selection(is_selected); if (is_selected && selected_in_ams) { @@ -1273,6 +1290,7 @@ void PlaterPresetComboBox::update() add_presets(nonsys_presets, selected_user_preset, L("User presets")); // BBS: move system to the end add_presets(system_presets, selected_system_preset, L("System presets")); + add_presets(uncompatible_presets, {}, L("Unsupported presets")); //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 04954229c..e876c9651 100644 --- a/src/slic3r/GUI/Widgets/DropDown.cpp +++ b/src/slic3r/GUI/Widgets/DropDown.cpp @@ -59,6 +59,7 @@ void DropDown::Create(wxWindow *parent, long style) state_handler.update_binds(); if ((style & DD_NO_CHECK_ICON) == 0) check_bitmap = ScalableBitmap(this, "checked", 16); + arrow_bitmap = ScalableBitmap(this, "hms_arrow", 16); text_off = style & DD_NO_TEXT; // BBS set default font @@ -323,7 +324,7 @@ void DropDown::render(wxDC &dc) } auto text = group.IsEmpty() ? (item.group.IsEmpty() ? item.text : item.group) - : item.text.substr(group.size()).Trim(false); + : (item.text.StartsWith(group) ? item.text.substr(group.size()).Trim(false) : item.text); if (!text_off && !text.IsEmpty()) { wxSize tSize = dc.GetMultiLineTextExtent(text); if (pt.x + tSize.x > rcContent.GetRight()) { @@ -335,6 +336,12 @@ void DropDown::render(wxDC &dc) pt.y += (rcContent.height - textSize.y) / 2; dc.SetFont(GetFont()); dc.DrawText(text, pt); + if (group.IsEmpty() && !item.group.IsEmpty()) { + auto szBmp = arrow_bitmap.GetBmpSize(); + pt.x = rcContent.GetRight() - szBmp.x - 5; + pt.y = rcContent.y += (rcContent.height - szBmp.y) / 2; + dc.DrawBitmap(arrow_bitmap.bmp(), pt); + } } rcContent.y += rowSize.y; } @@ -407,6 +414,7 @@ void DropDown::messureSize() iconSize = wxSize(); count = 0; wxClientDC dc(GetParent() ? GetParent() : this); + dc.SetFont(GetFont()); std::set groups; for (size_t i = 0; i < items.size(); ++i) { auto &item = items[i]; @@ -427,7 +435,7 @@ void DropDown::messureSize() if (!text_off) { auto text = group.IsEmpty() ? (item.group.IsEmpty() ? item.text : item.group) - : item.text.substr(group.size()).Trim(false); + : (item.text.StartsWith(group) ? item.text.substr(group.size()).Trim(false) : item.text); size1 = dc.GetMultiLineTextExtent(text); } if (item.icon.IsOk()) { @@ -442,6 +450,8 @@ void DropDown::messureSize() } if (!align_icon) iconSize.x = 0; wxSize szContent = textSize; + if (szContent.x < FromDIP(120)) + szContent.x = FromDIP(120); szContent.x += 10; if (check_bitmap.bmp().IsOk()) { auto szBmp = check_bitmap.GetBmpSize(); diff --git a/src/slic3r/GUI/Widgets/DropDown.hpp b/src/slic3r/GUI/Widgets/DropDown.hpp index 6920c3c93..0622ca413 100644 --- a/src/slic3r/GUI/Widgets/DropDown.hpp +++ b/src/slic3r/GUI/Widgets/DropDown.hpp @@ -54,6 +54,7 @@ private: StateColor selector_border_color; StateColor selector_background_color; ScalableBitmap check_bitmap; + ScalableBitmap arrow_bitmap; bool pressedDown = false; boost::posix_time::ptime dismissTime;