mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-18 11:02:08 +00:00
ENH: refine dual extruder related UI details
jira: new Change-Id: I63dd6278f3e7d22336482dba0f178150ebe55f1d (cherry picked from commit 73c05eee3bbcbed6fc5909db638fa4bac9a75bfc)
This commit is contained in:
@@ -1467,18 +1467,41 @@ void MenuFactory::create_bbl_assemble_part_menu()
|
||||
menu->AppendSeparator();
|
||||
}
|
||||
|
||||
void MenuFactory::create_filament_action_menu()
|
||||
void MenuFactory::create_filament_action_menu(bool init)
|
||||
{
|
||||
wxMenu *menu = &m_filament_action_menu;
|
||||
|
||||
append_menu_item(
|
||||
menu, wxID_ANY, _L("Edit"), "", [](wxCommandEvent &) {
|
||||
plater()->sidebar().edit_filament(); }, "", nullptr,
|
||||
[]() { return true; }, m_parent);
|
||||
append_menu_item(
|
||||
menu, wxID_ANY, _L("Delete"), _L("Delete this filament"), [](wxCommandEvent &) {
|
||||
plater()->sidebar().delete_filament(-2); }, "menu_delete", nullptr,
|
||||
[]() { return plater()->sidebar().combos_filament().size() > 1; }, m_parent);
|
||||
if (init) {
|
||||
append_menu_item(
|
||||
menu, wxID_ANY, _L("Edit"), "", [](wxCommandEvent&) {
|
||||
plater()->sidebar().edit_filament(); }, "", nullptr,
|
||||
[]() { return true; }, m_parent);
|
||||
}
|
||||
|
||||
const int item_id = menu->FindItem(_L("Change to"));
|
||||
if (item_id != wxNOT_FOUND)
|
||||
menu->Destroy(item_id);
|
||||
|
||||
wxMenu* sub_menu = new wxMenu();
|
||||
std::vector<wxBitmap*> icons = get_extruder_color_icons(true);
|
||||
int filaments_cnt = icons.size();
|
||||
for (int i = 0; i < filaments_cnt; i++) {
|
||||
auto preset = wxGetApp().preset_bundle->filaments.find_preset(wxGetApp().preset_bundle->filament_presets[i]);
|
||||
wxString item_name = preset ? from_u8(preset->label(false)) : wxString::Format(_L("Filament %d"), i + 1);
|
||||
|
||||
append_menu_item(sub_menu, wxID_ANY, item_name, "",
|
||||
[i](wxCommandEvent&) { plater()->sidebar().change_filament(-2, i); }, *icons[i], menu,
|
||||
[]() { return true; }, m_parent);
|
||||
}
|
||||
append_submenu(menu, sub_menu, wxID_ANY, _L("Change to"), "", "",
|
||||
[filaments_cnt]() { return filaments_cnt > 1; }, m_parent, 1);
|
||||
|
||||
if (init) {
|
||||
append_menu_item(
|
||||
menu, wxID_ANY, _L("Delete"), _L("Delete this filament"), [](wxCommandEvent&) {
|
||||
plater()->sidebar().delete_filament(-2); }, "menu_delete", nullptr,
|
||||
[]() { return plater()->sidebar().combos_filament().size() > 1; }, m_parent);
|
||||
}
|
||||
}
|
||||
|
||||
//BBS: add part plate related logic
|
||||
@@ -1600,7 +1623,7 @@ void MenuFactory::init(wxWindow* parent)
|
||||
//BBS: add part plate related logic
|
||||
create_plate_menu();
|
||||
|
||||
create_filament_action_menu();
|
||||
create_filament_action_menu(true);
|
||||
|
||||
// create "Instance to Object" menu item
|
||||
append_menu_item_instance_to_object(&m_instance_menu);
|
||||
@@ -1759,7 +1782,10 @@ wxMenu* MenuFactory::assemble_multi_selection_menu()
|
||||
return menu;
|
||||
}
|
||||
|
||||
wxMenu *MenuFactory::filament_action_menu() { return &m_filament_action_menu; }
|
||||
wxMenu *MenuFactory::filament_action_menu() {
|
||||
create_filament_action_menu(false);
|
||||
return &m_filament_action_menu;
|
||||
}
|
||||
|
||||
|
||||
//BBS: add partplate related logic
|
||||
|
||||
Reference in New Issue
Block a user