FIX: ComboBox set icon
Change-Id: If74ccca3649913d8cf6664347d082f75e4425b00 Jira: STUDIO-8640
This commit is contained in:
parent
dee9538ee4
commit
7ce090d2b5
|
@ -1045,7 +1045,7 @@ void PlaterPresetComboBox::update()
|
||||||
if (m_type == Preset::TYPE_FILAMENT)
|
if (m_type == Preset::TYPE_FILAMENT)
|
||||||
add_ams_filaments(into_u8(selected_user_preset.empty() ? selected_system_preset : selected_user_preset), true);
|
add_ams_filaments(into_u8(selected_user_preset.empty() ? selected_system_preset : selected_user_preset), true);
|
||||||
|
|
||||||
std::vector<std::string> filament_orders = {"Bambu PLA Basic", "Bambu PLA Mette", "Bambu PETG HF", "Bambu ABS", "Bambu PLA Sink", "Bambu PLA-CF",
|
std::vector<std::string> 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"};
|
"Bambu PLA Galaxy", "Bambu PLA Metal", "Bambu PLA Marble", "Bambu PETG-CF", "Bambu PETG Translucent", "Bambu ABS-GF"};
|
||||||
std::vector<std::string> first_vendors = {"Bambu Lab", "Generic"};
|
std::vector<std::string> first_vendors = {"Bambu Lab", "Generic"};
|
||||||
std::vector<std::string> first_types = {"PLA", "PETG", "ABS", "TPU"};
|
std::vector<std::string> first_types = {"PLA", "PETG", "ABS", "TPU"};
|
||||||
|
|
|
@ -84,10 +84,13 @@ void ComboBox::SetSelection(int n)
|
||||||
return;
|
return;
|
||||||
drop.SetSelection(n);
|
drop.SetSelection(n);
|
||||||
SetLabel(drop.GetValue());
|
SetLabel(drop.GetValue());
|
||||||
if (drop.selection >= 0 && drop.iconSize.y > 0)
|
if (drop.selection >= 0 && drop.iconSize.y > 0 && icons[drop.selection].IsOk())
|
||||||
SetIcon(icons[drop.selection]);
|
SetIcon(icons[drop.selection]);
|
||||||
|
else
|
||||||
|
SetIcon("drop_down");
|
||||||
}
|
}
|
||||||
void ComboBox::SelectAndNotify(int n) {
|
|
||||||
|
void ComboBox::SelectAndNotify(int n) {
|
||||||
SetSelection(n);
|
SetSelection(n);
|
||||||
sendComboBoxEvent();
|
sendComboBoxEvent();
|
||||||
}
|
}
|
||||||
|
@ -107,8 +110,10 @@ void ComboBox::SetValue(const wxString &value)
|
||||||
{
|
{
|
||||||
drop.SetValue(value);
|
drop.SetValue(value);
|
||||||
SetLabel(value);
|
SetLabel(value);
|
||||||
if (drop.selection >= 0 && drop.iconSize.y > 0)
|
if (drop.selection >= 0 && drop.iconSize.y > 0 && icons[drop.selection].IsOk())
|
||||||
SetIcon(icons[drop.selection]);
|
SetIcon(icons[drop.selection]);
|
||||||
|
else
|
||||||
|
SetIcon("drop_down");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComboBox::SetLabel(const wxString &value)
|
void ComboBox::SetLabel(const wxString &value)
|
||||||
|
|
|
@ -332,7 +332,8 @@ void DropDown::messureSize()
|
||||||
wxSize size1 = text_off ? wxSize() : dc.GetMultiLineTextExtent(texts[i]);
|
wxSize size1 = text_off ? wxSize() : dc.GetMultiLineTextExtent(texts[i]);
|
||||||
if (icons[i].IsOk()) {
|
if (icons[i].IsOk()) {
|
||||||
wxSize size2 = GetBmpSize(icons[i]);
|
wxSize size2 = GetBmpSize(icons[i]);
|
||||||
if (size2.x > iconSize.x) iconSize = size2;
|
if (size2.x > iconSize.x)
|
||||||
|
iconSize = size2;
|
||||||
if (!align_icon) {
|
if (!align_icon) {
|
||||||
size1.x += size2.x + (text_off ? 0 : 5);
|
size1.x += size2.x + (text_off ? 0 : 5);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue