Implemented issue #1990

This commit is contained in:
YuSanka 2019-03-21 09:04:11 +01:00
parent 8b73608e9f
commit 0198e71789
2 changed files with 28 additions and 15 deletions

View file

@ -96,7 +96,7 @@ ObjectList::ObjectList(wxWindow* parent) :
#endif //__WXMSW__
});
// Bind(wxEVT_CHAR, [this](wxKeyEvent& event) { key_event(event); }); // doesn't work on OSX
Bind(wxEVT_CHAR, [this](wxKeyEvent& event) { key_event(event); }); // doesn't work on OSX
#ifdef __WXMSW__
GetMainWindow()->Bind(wxEVT_MOTION, [this](wxMouseEvent& event) {
@ -443,8 +443,6 @@ void ObjectList::OnContextMenu(wxDataViewEvent&)
if (is_windows10())
fix_through_netfabb();
}
else if (title == _("Extruder"))
show_extruder_selection_menu();
#ifndef __WXMSW__
GetMainWindow()->SetToolTip(""); // hide tooltip
@ -458,7 +456,7 @@ void ObjectList::show_context_menu()
if (selected_instances_of_same_object())
wxGetApp().plater()->PopupMenu(&m_menu_instance);
else
show_extruder_selection_menu();
show_multi_selection_menu();
return;
}
@ -990,10 +988,14 @@ wxMenuItem* ObjectList::append_menu_item_instance_to_object(wxMenu* menu)
[this](wxCommandEvent&) { split_instances(); }, "", menu);
}
void ObjectList::append_menu_item_rename(wxMenu* menu)
void ObjectList::append_menu_items_osx(wxMenu* menu)
{
append_menu_item(menu, wxID_ANY, _(L("Delete item")), "",
[this](wxCommandEvent&) { remove(); }, "", menu);
append_menu_item(menu, wxID_ANY, _(L("Rename")), "",
[this](wxCommandEvent&) { rename_item(); }, "", menu);
menu->AppendSeparator();
}
@ -1016,7 +1018,7 @@ void ObjectList::append_menu_item_export_stl(wxMenu* menu) const
void ObjectList::create_object_popupmenu(wxMenu *menu)
{
#ifdef __WXOSX__
append_menu_item_rename(menu);
append_menu_items_osx(menu);
#endif // __WXOSX__
append_menu_item_export_stl(menu);
@ -1037,7 +1039,7 @@ void ObjectList::create_object_popupmenu(wxMenu *menu)
void ObjectList::create_sla_object_popupmenu(wxMenu *menu)
{
#ifdef __WXOSX__
append_menu_item_rename(menu);
append_menu_items_osx(menu);
#endif // __WXOSX__
append_menu_item_export_stl(menu);
@ -1049,7 +1051,7 @@ void ObjectList::create_sla_object_popupmenu(wxMenu *menu)
void ObjectList::create_part_popupmenu(wxMenu *menu)
{
#ifdef __WXOSX__
append_menu_item_rename(menu);
append_menu_items_osx(menu);
#endif // __WXOSX__
append_menu_item_fix_through_netfabb(menu);
@ -1857,10 +1859,13 @@ void ObjectList::remove()
{
if (m_objects_model->GetParent(item) == wxDataViewItem(0))
delete_from_model_and_list(itObject, m_objects_model->GetIdByItem(item), -1);
else
else {
if (sels.size() == 1)
select_item(m_objects_model->GetParent(item));
del_subobject_item(item);
}
}
}
void ObjectList::init_objects()
{
@ -2358,7 +2363,7 @@ void ObjectList::OnEditingDone(wxDataViewEvent &event)
_(L("the following characters are not allowed:")) + " <>:/\\|?*\"");
}
void ObjectList::show_extruder_selection_menu()
void ObjectList::show_multi_selection_menu()
{
wxDataViewItemArray sels;
GetSelections(sels);
@ -2369,9 +2374,17 @@ void ObjectList::show_extruder_selection_menu()
return;
wxMenu* menu = new wxMenu();
#ifdef __WXOSX__
append_menu_item(menu, wxID_ANY, _(L("Delete items")), "",
[this](wxCommandEvent&) { remove(); }, "", menu);
#endif //__WXOSX__
if (extruders_count() > 1)
append_menu_item(menu, wxID_ANY, _(L("Set extruder for selected items")),
_(L("Select extruder number for selected objects and/or parts")),
[this](wxCommandEvent&) { extruder_selection(); }, "", menu);
PopupMenu(menu);
}

View file

@ -184,7 +184,7 @@ public:
wxMenuItem* append_menu_item_settings(wxMenu* menu);
wxMenuItem* append_menu_item_change_type(wxMenu* menu);
wxMenuItem* append_menu_item_instance_to_object(wxMenu* menu);
void append_menu_item_rename(wxMenu* menu);
void append_menu_items_osx(wxMenu* menu);
void append_menu_item_fix_through_netfabb(wxMenu* menu);
void append_menu_item_export_stl(wxMenu* menu) const ;
void create_object_popupmenu(wxMenu *menu);
@ -283,7 +283,7 @@ private:
void ItemValueChanged(wxDataViewEvent &event);
void OnEditingDone(wxDataViewEvent &event);
void show_extruder_selection_menu();
void show_multi_selection_menu();
void extruder_selection();
void set_extruder_for_selected_items(const int extruder) const ;