From af0e9370fb80545f08aa171c71deb70f85899cbf Mon Sep 17 00:00:00 2001 From: bubnikv <bubnikv@gmail.com> Date: Mon, 4 Feb 2019 12:04:42 +0100 Subject: [PATCH 1/2] Handle Del, Ctrl+Del, Ctrl+A hot keys in the 3D scene only, do not bind it through the menu accelerators. This time the implementation is the same on all platforms. --- src/slic3r/GUI/MainFrame.cpp | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 78dffa1cb..3aa1e1851 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -319,29 +319,27 @@ void MainFrame::init_menubar() Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable((m_plater != nullptr) && can_slice()); }, m_menu_item_reslice_now->GetId()); } +#ifdef _MSC_VER + // \xA0 is a non-breaking space. It is entered here to spoil the automatic accelerators, + // as the simple numeric accelerators spoil all numeric data entry. + wxString sep = "\t\xA0"; + wxString sep_space = "\xA0"; +#else + wxString sep = " - "; + wxStrubg sep_space = ""; +#endif + // Edit menu wxMenu* editMenu = nullptr; if (m_plater != nullptr) { editMenu = new wxMenu(); - // \xA0 is a non-breaking space. It is entered here to spoil the automatic accelerators, - // as the simple numeric accelerators spoil all numeric data entry. - wxMenuItem* item_select_all = append_menu_item(editMenu, wxID_ANY, _(L("&Select all")) + -#ifdef _MSC_VER - "\t\xA0" + "Ctrl+\xA0" + "A" -#else -#ifdef __APPLE__ - "\tCtrl+A" -#else - " - Ctrl+A" -#endif -#endif - , _(L("Selects all objects")), + wxMenuItem* item_select_all = append_menu_item(editMenu, wxID_ANY, _(L("&Select all")) + sep + "Ctrl+" + 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")) + "\tDel", _(L("Deletes the current selection")), + wxMenuItem* item_delete_sel = append_menu_item(editMenu, wxID_ANY, _(L("&Delete selected")) + sep + "Del", _(L("Deletes the current selection")), [this](wxCommandEvent&) { m_plater->remove_selected(); }, ""); - wxMenuItem* item_delete_all = append_menu_item(editMenu, wxID_ANY, _(L("Delete &all")) + "\tCtrl+Del", _(L("Deletes all objects")), + wxMenuItem* item_delete_all = append_menu_item(editMenu, wxID_ANY, _(L("Delete &all")) + sep + "Ctrl+" + sep_space + "Del", _(L("Deletes all objects")), [this](wxCommandEvent&) { m_plater->reset(); }, ""); Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { evt.Enable(can_select()); }, item_select_all->GetId()); @@ -398,12 +396,6 @@ void MainFrame::init_menubar() // View menu wxMenu* viewMenu = nullptr; - wxString sep = -#ifdef _MSC_VER - "\t"; -#else - " - "; -#endif if (m_plater) { viewMenu = new wxMenu(); // The camera control accelerators are captured by GLCanvas3D::on_char(). From f626f69e90070ad9f7325c94848afdb3c4dd76dd Mon Sep 17 00:00:00 2001 From: bubnikv <bubnikv@gmail.com> Date: Mon, 4 Feb 2019 12:08:48 +0100 Subject: [PATCH 2/2] Fixed typo. --- src/slic3r/GUI/MainFrame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 3aa1e1851..a7b6fd396 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -326,7 +326,7 @@ void MainFrame::init_menubar() wxString sep_space = "\xA0"; #else wxString sep = " - "; - wxStrubg sep_space = ""; + wxString sep_space = ""; #endif // Edit menu