mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-27 11:59:27 +00:00
rebuild menus from scratch to remove duplicate item check and match "delete" item order
This commit is contained in:
@@ -1656,16 +1656,16 @@ void MenuFactory::create_filament_action_menu(bool init, int active_filament_men
|
||||
{
|
||||
wxMenu *menu = &m_filament_action_menu;
|
||||
|
||||
if (init) {
|
||||
// ORCA rebuild menu everytime instead checking existing of every item then deleting
|
||||
while (menu->GetMenuItemCount() > 0)
|
||||
menu->Destroy(menu->FindItemByPosition(0));
|
||||
|
||||
//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("Merge with"));
|
||||
if (item_id != wxNOT_FOUND)
|
||||
menu->Destroy(item_id);
|
||||
//}
|
||||
|
||||
wxMenu* sub_menu = new wxMenu();
|
||||
std::vector<wxBitmap*> icons = get_extruder_color_icons(true);
|
||||
@@ -1685,19 +1685,14 @@ void MenuFactory::create_filament_action_menu(bool init, int active_filament_men
|
||||
[filaments_cnt]() { return filaments_cnt > 1; }, m_parent);
|
||||
|
||||
// Decompose a target colour into a printable mix of the loaded filaments. Placed before the
|
||||
const int decompose_id = menu->FindItem(_L("Decompose Color"));
|
||||
if (decompose_id != wxNOT_FOUND)
|
||||
menu->Destroy(decompose_id);
|
||||
append_menu_item(
|
||||
menu, wxID_ANY, _L("Decompose Color"), "", [](wxCommandEvent&) {
|
||||
plater()->sidebar().decompose_filament_color(kSidebarContextMenuFilamentId); }, "", nullptr,
|
||||
[]() { return plater()->sidebar().combos_filament().size() >= 2; }, m_parent);
|
||||
|
||||
// ORCA use delete item on end of menu to prevent accidental clicks. clicking to submenus(merge) already not allowed by OS
|
||||
const int delete_id = menu->FindItem(_L("Delete"));
|
||||
if (delete_id != wxNOT_FOUND)
|
||||
menu->Destroy(delete_id);
|
||||
menu->AppendSeparator(); // ORCA use seperator for reducing accidental clicks to delete
|
||||
|
||||
// ORCA use delete item on end of menu to prevent accidental clicks. clicking to submenus(merge) already not allowed by OS
|
||||
append_menu_item(
|
||||
menu, wxID_ANY, _L("Delete"), _L("Delete this filament"), [](wxCommandEvent&) {
|
||||
plater()->sidebar().delete_filament(-2); }, "", nullptr,
|
||||
|
||||
@@ -4308,11 +4308,6 @@ void Sidebar::update_mixed_filament_list()
|
||||
edit_mixed_filament(panel_idx);
|
||||
}, edit_item->GetId());
|
||||
|
||||
auto* del_item = menu.Append(wxID_ANY, _L("Delete"));
|
||||
menu.Bind(wxEVT_MENU, [this, panel_idx](wxCommandEvent&) {
|
||||
delete_mixed_filament_at(panel_idx);
|
||||
}, del_item->GetId());
|
||||
|
||||
wxMenu* sub_menu = new wxMenu();
|
||||
std::vector<wxBitmap*> icons = get_extruder_color_icons(true);
|
||||
int filaments_cnt = icons.size();
|
||||
@@ -4345,6 +4340,14 @@ void Sidebar::update_mixed_filament_list()
|
||||
else
|
||||
delete sub_menu;
|
||||
|
||||
menu.AppendSeparator(); // ORCA use seperator for reducing accidental clicks to delete
|
||||
|
||||
// ORCA use delete item on end of menu to prevent accidental clicks. clicking to submenus(merge) already not allowed by OS
|
||||
auto* del_item = menu.Append(wxID_ANY, _L("Delete"));
|
||||
menu.Bind(wxEVT_MENU, [this, panel_idx](wxCommandEvent&) {
|
||||
delete_mixed_filament_at(panel_idx);
|
||||
}, del_item->GetId());
|
||||
|
||||
PopupMenu(&menu);
|
||||
});
|
||||
combo_and_btn_sizer->Add(menu_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(4));
|
||||
|
||||
Reference in New Issue
Block a user