ENH: display filament labels in "change filament" context menus
This commit is contained in:
parent
243805933e
commit
5c6b8812a5
|
@ -762,8 +762,20 @@ void MenuFactory::append_menu_item_change_extruder(wxMenu* menu)
|
||||||
bool is_active_extruder = i == initial_extruder;
|
bool is_active_extruder = i == initial_extruder;
|
||||||
int icon_idx = i == 0 ? 0 : i - 1;
|
int icon_idx = i == 0 ? 0 : i - 1;
|
||||||
|
|
||||||
const wxString& item_name = (i == 0 ? _L("Default") : wxString::Format(_L("Filament %d"), i)) +
|
wxString item_name = _L("Default");
|
||||||
(is_active_extruder ? " (" + _L("active") + ")" : "");
|
|
||||||
|
if (i > 0) {
|
||||||
|
auto preset = wxGetApp().preset_bundle->filaments.find_preset(wxGetApp().preset_bundle->filament_presets[i - 1]);
|
||||||
|
if (preset == nullptr) {
|
||||||
|
item_name = wxString::Format(_L("Filament %d"), i);
|
||||||
|
} else {
|
||||||
|
item_name = from_u8(preset->label(false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_active_extruder) {
|
||||||
|
item_name << " (" + _L("current") + ")";
|
||||||
|
}
|
||||||
|
|
||||||
if (icon_idx >= 0 && icon_idx < icons.size()) {
|
if (icon_idx >= 0 && icon_idx < icons.size()) {
|
||||||
append_menu_item(
|
append_menu_item(
|
||||||
|
@ -1638,8 +1650,20 @@ void MenuFactory::append_menu_item_change_filament(wxMenu* menu)
|
||||||
//bool is_active_extruder = i == initial_extruder;
|
//bool is_active_extruder = i == initial_extruder;
|
||||||
bool is_active_extruder = false;
|
bool is_active_extruder = false;
|
||||||
|
|
||||||
const wxString& item_name = (i == 0 ? _L("Default") : wxString::Format(_L("Filament %d"), i)) +
|
wxString item_name = _L("Default");
|
||||||
(is_active_extruder ? " (" + _L("current") + ")" : "");
|
|
||||||
|
if (i > 0) {
|
||||||
|
auto preset = wxGetApp().preset_bundle->filaments.find_preset(wxGetApp().preset_bundle->filament_presets[i - 1]);
|
||||||
|
if (preset == nullptr) {
|
||||||
|
item_name = wxString::Format(_L("Filament %d"), i);
|
||||||
|
} else {
|
||||||
|
item_name = from_u8(preset->label(false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_active_extruder) {
|
||||||
|
item_name << " (" + _L("current") + ")";
|
||||||
|
}
|
||||||
|
|
||||||
append_menu_item(extruder_selection_menu, wxID_ANY, item_name, "",
|
append_menu_item(extruder_selection_menu, wxID_ANY, item_name, "",
|
||||||
[i](wxCommandEvent&) { obj_list()->set_extruder_for_selected_items(i); }, i == 0 ? wxNullBitmap : *icons[i - 1], menu,
|
[i](wxCommandEvent&) { obj_list()->set_extruder_for_selected_items(i); }, i == 0 ? wxNullBitmap : *icons[i - 1], menu,
|
||||||
|
|
Loading…
Reference in New Issue