diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 1aba14406..73d6a03b0 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -539,6 +539,8 @@ void GUI_App::update_mode() mode == ConfigMenuModeExpert ? comExpert : comAdvanced; for (auto tab : tabs_list) tab->update_visibility(opt_mode); + + plater()->update_object_menu(); } void GUI_App::add_config_menu(wxMenuBar *menu) diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 588b95faa..7f6ec04dd 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -327,6 +327,8 @@ void ObjectList::show_context_menu() wxMenu* menu = m_objects_model->GetParent(item) != wxDataViewItem(0) ? &m_menu_part : wxGetApp().plater()->printer_technology() == ptFFF ? &m_menu_object : &m_menu_sla_object; + append_menu_item_settings(menu); + wxGetApp().plater()->PopupMenu(menu); wxGetApp().plater()->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { @@ -334,10 +336,6 @@ void ObjectList::show_context_menu() wxGetApp().plater()->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(is_splittable()); }, m_menu_item_split_part->GetId()); - - wxGetApp().plater()->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { - evt.Enable(get_selected_model_volume()->type() <= ModelVolume::PARAMETER_MODIFIER); - }, m_menu_item_settings->GetId()); } } @@ -517,12 +515,13 @@ void get_options_menu(settings_menu_hierarchy& settings_menu, const bool is_part get_options_menu(settings_menu, is_part, wxGetApp().plater()->printer_technology() == ptSLA); } -void ObjectList::get_settings_choice(const wxString& category_name, const bool is_part) +void ObjectList::get_settings_choice(const wxString& category_name) { wxArrayString names; wxArrayInt selections; settings_menu_hierarchy settings_menu; + const bool is_part = m_objects_model->GetParent(GetSelection()) != wxDataViewItem(0); get_options_menu(settings_menu, is_part); std::vector< std::pair > *settings_list = nullptr; @@ -584,7 +583,7 @@ void ObjectList::get_settings_choice(const wxString& category_name, const bool i } } -void ObjectList::menu_item_add_generic(wxMenuItem* &menu, const int type) { +void ObjectList::append_menu_item_add_generic(wxMenuItem* menu, const int type) { auto sub_menu = new wxMenu; append_menu_item(sub_menu, wxID_ANY, _(L("Load")) + " " + dots, "", @@ -600,78 +599,121 @@ void ObjectList::menu_item_add_generic(wxMenuItem* &menu, const int type) { menu->SetSubMenu(sub_menu); } -wxMenuItem* ObjectList::menu_item_split(wxMenu* menu) { - return append_menu_item(menu, wxID_ANY, _(L("Split to parts")), "", - [this](wxCommandEvent&) { split(); }, m_bmp_split, menu); -} - -wxMenuItem* ObjectList::menu_item_settings(wxMenu* menu, const bool is_part, const bool is_sla_menu) { - auto menu_item = new wxMenuItem(menu, wxID_ANY, _(L("Add settings"))); - menu_item->SetBitmap(m_bmp_cog); - - menu_item->SetSubMenu(create_settings_popupmenu(menu, is_part, is_sla_menu)); - - return menu_item; -} - -void ObjectList::create_object_popupmenu(wxMenu *menu) +void ObjectList::append_menu_items_add_volume(wxMenu* menu) { // Note: id accords to type of the sub-object, so sequence of the menu items is important std::vector menu_object_types_items = {L("Add part"), // ~ModelVolume::MODEL_PART L("Add modifier"), // ~ModelVolume::PARAMETER_MODIFIER L("Add support enforcer"), // ~ModelVolume::SUPPORT_ENFORCER L("Add support blocker") }; // ~ModelVolume::SUPPORT_BLOCKER - - // Add first 4 menu items - for (int type = 0; type < menu_object_types_items.size(); type++) { + + // Update "add" items(delete old & create new) settings popupmenu + for (auto& item : menu_object_types_items){ + const auto settings_id = menu->FindItem(_(item)); + if (settings_id != wxNOT_FOUND) + menu->Destroy(settings_id); + } + + if (wxGetApp().get_view_mode() == ConfigMenuModeSimple) + { + append_menu_item(menu, wxID_ANY, _(L("Add part")), "", + [this](wxCommandEvent&) { load_subobject(ModelVolume::MODEL_PART); }, *m_bmp_vector[ModelVolume::MODEL_PART]); + append_menu_item(menu, wxID_ANY, _(L("Add support enforcer")), "", + [this](wxCommandEvent&) { load_generic_subobject(_(L("Box")).ToStdString(), ModelVolume::SUPPORT_ENFORCER); }, + *m_bmp_vector[ModelVolume::SUPPORT_ENFORCER]); + append_menu_item(menu, wxID_ANY, _(L("Add support blocker")), "", + [this](wxCommandEvent&) { load_generic_subobject(_(L("Box")).ToStdString(), ModelVolume::SUPPORT_BLOCKER); }, + *m_bmp_vector[ModelVolume::SUPPORT_BLOCKER]); + + return; + } + + for (int type = 0; type < menu_object_types_items.size(); type++) + { auto& item = menu_object_types_items[type]; + auto menu_item = new wxMenuItem(menu, wxID_ANY, _(item)); menu_item->SetBitmap(*m_bmp_vector[type]); - menu_item_add_generic(menu_item, type); + append_menu_item_add_generic(menu_item, type); + menu->Append(menu_item); } +} + +wxMenuItem* ObjectList::append_menu_item_split(wxMenu* menu) +{ + return append_menu_item(menu, wxID_ANY, _(L("Split to parts")), "", + [this](wxCommandEvent&) { split(); }, m_bmp_split, menu); +} + +wxMenuItem* ObjectList::append_menu_item_settings(wxMenu* menu) +{ + // Update (delete old & create new) settings popupmenu + const auto settings_id = menu->FindItem(_("Add settings")); + if (settings_id != wxNOT_FOUND) + menu->Destroy(settings_id); + + if (wxGetApp().get_view_mode() == ConfigMenuModeSimple) + return nullptr; + + auto menu_item = new wxMenuItem(menu, wxID_ANY, _(L("Add settings"))); + menu_item->SetBitmap(m_bmp_cog); + + const auto sel_vol = get_selected_model_volume(); + if (sel_vol && sel_vol->type() >= ModelVolume::SUPPORT_ENFORCER) + menu_item->Enable(false); + else + menu_item->SetSubMenu(create_settings_popupmenu(menu)); + + return menu->Append(menu_item); +} + +wxMenuItem* ObjectList::append_menu_item_change_type(wxMenu* menu) +{ + return append_menu_item(menu, wxID_ANY, _(L("Change type")), "", + [this](wxCommandEvent&) { change_part_type(); }, "", menu); + +} + +void ObjectList::create_object_popupmenu(wxMenu *menu) +{ + append_menu_items_add_volume(menu); // Split object to parts menu->AppendSeparator(); - m_menu_item_split = menu_item_split(menu); + m_menu_item_split = append_menu_item_split(menu); // Settings menu->AppendSeparator(); - // Append settings popupmenu - menu->Append(menu_item_settings(menu, false, false)); } void ObjectList::create_sla_object_popupmenu(wxMenu *menu) { - // Append settings popupmenu - menu->Append(menu_item_settings(menu, false, true)); } void ObjectList::create_part_popupmenu(wxMenu *menu) { - m_menu_item_split_part = menu_item_split(menu); + m_menu_item_split_part = append_menu_item_split(menu); // Append change part type menu->AppendSeparator(); - append_menu_item(menu, wxID_ANY, _(L("Change type")), "", - [this](wxCommandEvent&) { change_part_type(); }, "", menu); + append_menu_item_change_type(menu); // Append settings popupmenu menu->AppendSeparator(); - m_menu_item_settings = menu_item_settings(menu, true, false); - menu->Append(m_menu_item_settings); } -wxMenu* ObjectList::create_settings_popupmenu(wxMenu *parent_menu, bool is_part, const bool is_sla_menu) +wxMenu* ObjectList::create_settings_popupmenu(wxMenu *parent_menu) { wxMenu *menu = new wxMenu; settings_menu_hierarchy settings_menu; - get_options_menu(settings_menu, is_part, is_sla_menu); + const bool is_part = m_objects_model->GetParent(GetSelection()) != wxDataViewItem(0); + get_options_menu(settings_menu, is_part); for (auto cat : settings_menu) { append_menu_item(menu, wxID_ANY, _(cat.first), "", - [menu, this, is_part](wxCommandEvent& event) { get_settings_choice(menu->GetLabel(event.GetId()), is_part); }, + [menu, this](wxCommandEvent& event) { get_settings_choice(menu->GetLabel(event.GetId())); }, CATEGORY_ICON.find(cat.first) == CATEGORY_ICON.end() ? wxNullBitmap : CATEGORY_ICON.at(cat.first), parent_menu); } diff --git a/src/slic3r/GUI/GUI_ObjectList.hpp b/src/slic3r/GUI/GUI_ObjectList.hpp index c38ecb45c..fd707e2eb 100644 --- a/src/slic3r/GUI/GUI_ObjectList.hpp +++ b/src/slic3r/GUI/GUI_ObjectList.hpp @@ -121,14 +121,16 @@ public: void on_drop_possible(wxDataViewEvent &event); void on_drop(wxDataViewEvent &event); - void get_settings_choice(const wxString& cat_name, const bool is_part); - void menu_item_add_generic(wxMenuItem* &menu, const int type); - wxMenuItem* menu_item_split(wxMenu* menu); - wxMenuItem* menu_item_settings(wxMenu* menu, const bool is_part, const bool is_sla_menu); + void get_settings_choice(const wxString& category_name); + void append_menu_item_add_generic(wxMenuItem* menu, const int type); + void append_menu_items_add_volume(wxMenu* menu); + wxMenuItem* append_menu_item_split(wxMenu* menu); + wxMenuItem* append_menu_item_settings(wxMenu* menu); + wxMenuItem* append_menu_item_change_type(wxMenu* menu); void create_object_popupmenu(wxMenu *menu); - void create_sla_object_popupmenu(wxMenu *menu); - void create_part_popupmenu(wxMenu *menu); - wxMenu* create_settings_popupmenu(wxMenu *parent_menu, bool is_part, const bool is_sla_menu); + void create_sla_object_popupmenu(wxMenu*menu); + void create_part_popupmenu(wxMenu*menu); + wxMenu* create_settings_popupmenu(wxMenu *parent_menu); void update_opt_keys(t_config_option_keys& t_optopt_keys); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 6d2af3b8d..3cf42b6ba 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -908,7 +908,10 @@ struct Plater::priv // Object popup menu wxMenu object_menu; - wxMenuItem* item_sla_autorot = nullptr; + // Part popup menu + wxMenu part_menu; + // SLA-Object popup menu + wxMenu sla_object_menu; // Data Slic3r::DynamicPrintConfig *config; @@ -1033,8 +1036,14 @@ struct Plater::priv void on_update_geometry(Vec3dsEvent<2>&); void on_3dcanvas_mouse_dragging_finished(SimpleEvent&); + void update_object_menu(); + private: bool init_object_menu(); + bool init_common_menu(wxMenu* menu, const bool is_part = false); + bool complit_init_object_menu(); + bool complit_init_sla_object_menu(); + bool complit_init_part_menu(); #if ENABLE_REMOVE_TABS_FROM_PLATER void init_view_toolbar(); #endif // ENABLE_REMOVE_TABS_FROM_PLATER @@ -2413,8 +2422,13 @@ void Plater::priv::on_right_click(Vec2dEvent& evt) if (obj_idx == -1) return; + wxMenu* menu = printer_technology == ptSLA ? &sla_object_menu : + get_selection().is_single_full_object() ? &object_menu : &part_menu; + + sidebar->obj_list()->append_menu_item_settings(menu); + if (q != nullptr) - q->PopupMenu(&object_menu, (int)evt.data.x(), (int)evt.data.y()); + q->PopupMenu(menu, (int)evt.data.x(), (int)evt.data.y()); } void Plater::priv::on_wipetower_moved(Vec3dEvent &evt) @@ -2442,30 +2456,63 @@ void Plater::priv::on_3dcanvas_mouse_dragging_finished(SimpleEvent&) bool Plater::priv::init_object_menu() { - wxMenuItem* item_delete = append_menu_item(&object_menu, wxID_ANY, _(L("Delete\tDel")), _(L("Remove the selected object")), - [this](wxCommandEvent&) { q->remove_selected(); }, "brick_delete.png"); - wxMenuItem* item_increase = append_menu_item(&object_menu, wxID_ANY, _(L("Increase copies\t+")), _(L("Place one more copy of the selected object")), - [this](wxCommandEvent&) { q->increase_instances(); }, "add.png"); - wxMenuItem* item_decrease = append_menu_item(&object_menu, wxID_ANY, _(L("Decrease copies\t-")), _(L("Remove one copy of the selected object")), - [this](wxCommandEvent&) { q->decrease_instances(); }, "delete.png"); - wxMenuItem* item_set_number_of_copies = append_menu_item(&object_menu, wxID_ANY, _(L("Set number of copies…")), _(L("Change the number of copies of the selected object")), - [this](wxCommandEvent&) { q->set_number_of_copies(); }, "textfield.png"); + init_common_menu(&object_menu); + complit_init_object_menu(); + + init_common_menu(&sla_object_menu); + complit_init_sla_object_menu(); + + init_common_menu(&part_menu, true); + complit_init_part_menu(); + + return true; +} + +bool Plater::priv::init_common_menu(wxMenu* menu, const bool is_part/* = false*/) +{ + wxMenuItem* item_delete = append_menu_item(menu, wxID_ANY, _(L("Delete\tDel")), _(L("Remove the selected object")), + [this](wxCommandEvent&) { q->remove_selected(); }, "brick_delete.png"); + if (!is_part){ + wxMenuItem* item_increase = append_menu_item(menu, wxID_ANY, _(L("Increase copies\t+")), _(L("Place one more copy of the selected object")), + [this](wxCommandEvent&) { q->increase_instances(); }, "add.png"); + wxMenuItem* item_decrease = append_menu_item(menu, wxID_ANY, _(L("Decrease copies\t-")), _(L("Remove one copy of the selected object")), + [this](wxCommandEvent&) { q->decrease_instances(); }, "delete.png"); + wxMenuItem* item_set_number_of_copies = append_menu_item(menu, wxID_ANY, _(L("Set number of copies…")), _(L("Change the number of copies of the selected object")), + [this](wxCommandEvent&) { q->set_number_of_copies(); }, "textfield.png"); + if (q != nullptr) + { + q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_increase_instances()); }, item_increase->GetId()); + q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_decrease_instances()); }, item_decrease->GetId()); + q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_increase_instances()); }, item_set_number_of_copies->GetId()); + } + } + menu->AppendSeparator(); - object_menu.AppendSeparator(); - wxMenu* mirror_menu = new wxMenu(); if (mirror_menu == nullptr) return false; append_menu_item(mirror_menu, wxID_ANY, _(L("Along X axis")), _(L("Mirror the selected object along the X axis")), - [this](wxCommandEvent&) { mirror(X); }, "bullet_red.png", &object_menu); + [this](wxCommandEvent&) { mirror(X); }, "bullet_red.png", menu); append_menu_item(mirror_menu, wxID_ANY, _(L("Along Y axis")), _(L("Mirror the selected object along the Y axis")), - [this](wxCommandEvent&) { mirror(Y); }, "bullet_green.png", &object_menu); + [this](wxCommandEvent&) { mirror(Y); }, "bullet_green.png", menu); append_menu_item(mirror_menu, wxID_ANY, _(L("Along Z axis")), _(L("Mirror the selected object along the Z axis")), - [this](wxCommandEvent&) { mirror(Z); }, "bullet_blue.png", &object_menu); + [this](wxCommandEvent&) { mirror(Z); }, "bullet_blue.png", menu); - wxMenuItem* item_mirror = append_submenu(&object_menu, mirror_menu, wxID_ANY, _(L("Mirror")), _(L("Mirror the selected object"))); + wxMenuItem* item_mirror = append_submenu(menu, mirror_menu, wxID_ANY, _(L("Mirror")), _(L("Mirror the selected object"))); + // ui updates needs to be binded to the parent panel + if (q != nullptr) + { + q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_mirror()); }, item_mirror->GetId()); + q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_delete_object()); }, item_delete->GetId()); + } + + return true; +} + +bool Plater::priv::complit_init_object_menu() +{ wxMenu* split_menu = new wxMenu(); if (split_menu == nullptr) return false; @@ -2477,25 +2524,57 @@ bool Plater::priv::init_object_menu() wxMenuItem* item_split = append_submenu(&object_menu, split_menu, wxID_ANY, _(L("Split")), _(L("Split the selected object")), "shape_ungroup.png"); - // Add the automatic rotation sub-menu - item_sla_autorot = append_menu_item(&object_menu, wxID_ANY, _(L("Optimize orientation")), _(L("Optimize the rotation of the object for better print results.")), - [this](wxCommandEvent&) { sla_optimize_rotation(); }); + // Append "Add..." popupmenu + object_menu.AppendSeparator(); + sidebar->obj_list()->append_menu_items_add_volume(&object_menu); - if (printer_technology == ptFFF) - item_sla_autorot = object_menu.Remove(item_sla_autorot); +// object_menu.AppendSeparator(); // ui updates needs to be binded to the parent panel if (q != nullptr) { - q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_mirror()); }, item_mirror->GetId()); - q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_delete_object()); }, item_delete->GetId()); - q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_increase_instances()); }, item_increase->GetId()); - q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_decrease_instances()); }, item_decrease->GetId()); - q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_increase_instances()); }, item_set_number_of_copies->GetId()); q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_objects() || can_split_to_volumes()); }, item_split->GetId()); q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_objects()); }, item_split_objects->GetId()); q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_volumes()); }, item_split_volumes->GetId()); } + return true; +} + +bool Plater::priv::complit_init_sla_object_menu() +{ + wxMenuItem* item_split = append_menu_item(&sla_object_menu, wxID_ANY, _(L("Split")), _(L("Split the selected object into individual objects")), + [this](wxCommandEvent&) { split_object(); }, "shape_ungroup_o.png"); + + // Add the automatic rotation sub-menu + append_menu_item(&sla_object_menu, wxID_ANY, _(L("Optimize orientation")), _(L("Optimize the rotation of the object for better print results.")), + [this](wxCommandEvent&) { sla_optimize_rotation(); }); + +// sla_object_menu.AppendSeparator(); + + // ui updates needs to be binded to the parent panel + if (q != nullptr) + { + q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_objects()); }, item_split->GetId()); + } + + return true; +} + +bool Plater::priv::complit_init_part_menu() +{ + wxMenuItem* item_split = append_menu_item(&part_menu, wxID_ANY, _(L("Split")), _(L("Split the selected object into individual sub-parts")), + [this](wxCommandEvent&) { split_volume(); }, "shape_ungroup_p.png"); + + auto obj_list = sidebar->obj_list(); + obj_list->append_menu_item_change_type(&part_menu); + +// part_menu.AppendSeparator(); + + // ui updates needs to be binded to the parent panel + if (q != nullptr) + { + q->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_split_to_volumes()); }, item_split->GetId()); + } return true; } @@ -2555,8 +2634,11 @@ bool Plater::priv::can_split_to_objects() const bool Plater::priv::can_split_to_volumes() const { - int obj_idx = get_selected_object_idx(); - return (0 <= obj_idx) && (obj_idx < (int)model.objects.size()) && !model.objects[obj_idx]->is_multiparts(); + if (printer_technology == ptSLA) + return false; +// int obj_idx = get_selected_object_idx(); +// return (0 <= obj_idx) && (obj_idx < (int)model.objects.size()) && !model.objects[obj_idx]->is_multiparts(); + return sidebar->obj_list()->is_splittable(); } bool Plater::priv::layers_height_allowed() const @@ -2584,6 +2666,11 @@ bool Plater::priv::can_mirror() const return get_selection().is_from_single_instance(); } +void Plater::priv::update_object_menu() +{ + sidebar->obj_list()->append_menu_items_add_volume(&object_menu); +} + // Plater / Public Plater::Plater(wxWindow *parent, MainFrame *main_frame) @@ -3029,22 +3116,6 @@ void Plater::on_config_change(const DynamicPrintConfig &config) } } - bool attached = false; - for(const wxMenuItem * m : p->object_menu.GetMenuItems()) - if(m == p->item_sla_autorot) { attached = true; break; } - - switch(printer_technology()) { - case ptFFF: { - // hide sla auto rotation menuitem - if(attached) p->item_sla_autorot = p->object_menu.Remove(p->item_sla_autorot); - std::cout << "sla autorot menu should be removed" << std::endl; - } - case ptSLA: { - // show sla auto rotation menuitem - if(!attached) p->object_menu.Append(p->item_sla_autorot); - } - } - if (update_scheduled) update(); @@ -3135,4 +3206,6 @@ void Plater::changed_object(int obj_idx) void Plater::fix_through_netfabb(const int obj_idx) { p->fix_through_netfabb(obj_idx); } +void Plater::update_object_menu() { p->update_object_menu(); } + }} // namespace Slic3r::GUI diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 74dd790d2..07fb104cf 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -157,6 +157,8 @@ public: void on_extruders_change(int extruders_count); void on_config_change(const DynamicPrintConfig &config); + void update_object_menu(); + const wxString& get_project_filename() const; bool is_export_gcode_scheduled() const; diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 696702cba..c20ca11dc 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -24,13 +24,11 @@ wxMenuItem* append_menu_item(wxMenu* menu, int id, const wxString& string, const wxMenuItem* item = menu->Append(id, string, description); item->SetBitmap(icon); - if (event_handler != nullptr && event_handler != menu) #ifdef __WXMSW__ + if (event_handler != nullptr && event_handler != menu) event_handler->Bind(wxEVT_MENU, cb, id); -#else - menu->Bind(wxEVT_MENU, cb, id); -#endif else +#endif // __WXMSW__ menu->Bind(wxEVT_MENU, cb, id); return item;