Platform independent delete menus
This commit is contained in:
parent
f42ce8c84a
commit
ac007d4173
2 changed files with 17 additions and 7 deletions
|
@ -5112,8 +5112,10 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
|||
case WXK_CONTROL_A: post_event(SimpleEvent(EVT_GLCANVAS_SELECT_ALL)); break;
|
||||
#ifdef __APPLE__
|
||||
case WXK_BACK: // the low cost Apple solutions are not equipped with a Delete key, use Backspace instead.
|
||||
#else /* __APPLE__ */
|
||||
case WXK_DELETE:
|
||||
#endif /* __APPLE__ */
|
||||
case WXK_DELETE: post_event(SimpleEvent(EVT_GLTOOLBAR_DELETE_ALL)); break;
|
||||
post_event(SimpleEvent(EVT_GLTOOLBAR_DELETE_ALL)); break;
|
||||
default: evt.Skip();
|
||||
}
|
||||
} else if (evt.HasModifiers()) {
|
||||
|
@ -5125,8 +5127,10 @@ void GLCanvas3D::on_char(wxKeyEvent& evt)
|
|||
case WXK_ESCAPE: { m_gizmos.reset_all_states(); m_dirty = true; break; }
|
||||
#ifdef __APPLE__
|
||||
case WXK_BACK: // the low cost Apple solutions are not equipped with a Delete key, use Backspace instead.
|
||||
#else /* __APPLE__ */
|
||||
case WXK_DELETE:
|
||||
#endif /* __APPLE__ */
|
||||
case WXK_DELETE: post_event(SimpleEvent(EVT_GLTOOLBAR_DELETE)); break;
|
||||
post_event(SimpleEvent(EVT_GLTOOLBAR_DELETE)); break;
|
||||
case '0': { select_view("iso"); break; }
|
||||
case '1': { select_view("top"); break; }
|
||||
case '2': { select_view("bottom"); break; }
|
||||
|
|
|
@ -334,12 +334,18 @@ void MainFrame::init_menubar()
|
|||
if (m_plater != nullptr)
|
||||
{
|
||||
editMenu = new wxMenu();
|
||||
wxMenuItem* item_select_all = append_menu_item(editMenu, wxID_ANY, _(L("&Select all")) + sep + "Ctrl+" + sep_space + "A", _(L("Selects all objects")),
|
||||
#ifdef __APPLE__
|
||||
// Backspace sign
|
||||
wxString hotkey_delete = "\u232b";
|
||||
#else
|
||||
wxString hotkey_delete = "Del";
|
||||
#endif
|
||||
wxMenuItem* item_select_all = append_menu_item(editMenu, wxID_ANY, _(L("&Select all")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + "A", _(L("Selects all objects")),
|
||||
[this](wxCommandEvent&) { m_plater->select_all(); }, "");
|
||||
editMenu->AppendSeparator();
|
||||
wxMenuItem* item_delete_sel = append_menu_item(editMenu, wxID_ANY, _(L("&Delete selected")) + sep + "Del", _(L("Deletes the current selection")),
|
||||
wxMenuItem* item_delete_sel = append_menu_item(editMenu, wxID_ANY, _(L("&Delete selected")) + sep + hotkey_delete, _(L("Deletes the current selection")),
|
||||
[this](wxCommandEvent&) { m_plater->remove_selected(); }, "");
|
||||
wxMenuItem* item_delete_all = append_menu_item(editMenu, wxID_ANY, _(L("Delete &all")) + sep + "Ctrl+" + sep_space + "Del", _(L("Deletes all objects")),
|
||||
wxMenuItem* item_delete_all = append_menu_item(editMenu, wxID_ANY, _(L("Delete &all")) + sep + GUI::shortkey_ctrl_prefix() + sep_space + hotkey_delete, _(L("Deletes all objects")),
|
||||
[this](wxCommandEvent&) { m_plater->reset(); }, "");
|
||||
|
||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_select()); }, item_select_all->GetId());
|
||||
|
|
Loading…
Reference in a new issue