From 7519142b1f45f92a51785a9cd6b7dde4cdd50049 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 24 Jun 2024 13:50:12 +0200 Subject: [PATCH] Fix for #12874 - Ctrl-P does not open preferences in 2.8.0-alpha5 --- src/slic3r/GUI/GUI_App.cpp | 9 ++++----- src/slic3r/GUI/GUI_App.hpp | 2 +- src/slic3r/GUI/MainFrame.cpp | 6 +++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index a70a7e79978..67628ddb19d 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -2598,7 +2598,7 @@ void GUI_App::update_mode() plater()->canvas3D()->update_gizmos_on_off_state(); } -wxMenu* GUI_App::get_config_menu() +wxMenu* GUI_App::get_config_menu(MainFrame* main_frame) { auto local_menu = new wxMenu(); wxWindowID config_id_base = wxWindow::NewControlId(int(ConfigMenuCnt)); @@ -2618,13 +2618,12 @@ wxMenu* GUI_App::get_config_menu() #endif //(__linux__) && defined(SLIC3R_DESKTOP_INTEGRATION) local_menu->AppendSeparator(); } - local_menu->Append(config_id_base + ConfigMenuPreferences, _L("&Preferences") + dots + #ifdef __APPLE__ - "\tCtrl+,", + local_menu->Append(config_id_base + ConfigMenuPreferences, _L("&Preferences") + dots + "\tCtrl+,", _L("Application preferences")); #else - "\tCtrl+P", + append_menu_item(local_menu, config_id_base + ConfigMenuPreferences, _L("&Preferences") + "\tCtrl+P", _L("Application preferences"), + [](wxCommandEvent&) { wxGetApp().open_preferences(); }, "", nullptr, []() {return true; }, main_frame); #endif - _L("Application preferences")); local_menu->AppendSeparator(); local_menu->Append(config_id_base + ConfigMenuLanguage, _L("&Language")); diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 291b335e297..6d7008f0dd8 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -293,7 +293,7 @@ class GUI_App : public wxApp bool save_mode(const /*ConfigOptionMode*/int mode) ; void update_mode(); - wxMenu* get_config_menu(); + wxMenu* get_config_menu(MainFrame* main_frame); bool has_unsaved_preset_changes() const; bool has_current_preset_changes() const; void update_saved_preset_from_current_preset(); diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 8db5dba640b..63ff77dbad9 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -1636,7 +1636,7 @@ void MainFrame::init_menubar_as_editor() if (viewMenu) m_bar_menus.AppendMenuItem(viewMenu, _L("&View")); - m_bar_menus.AppendMenuItem(wxGetApp().get_config_menu(), _L("&Configuration")); + m_bar_menus.AppendMenuItem(wxGetApp().get_config_menu(this), _L("&Configuration")); m_bar_menus.AppendMenuSeparaorItem(); @@ -1654,7 +1654,7 @@ void MainFrame::init_menubar_as_editor() m_menubar->Append(windowMenu, _L("&Window")); if (viewMenu) m_menubar->Append(viewMenu, _L("&View")); // Add additional menus from C++ - m_menubar->Append(wxGetApp().get_config_menu(), _L("&Configuration")); + m_menubar->Append(wxGetApp().get_config_menu(this), _L("&Configuration")); m_menubar->Append(helpMenu, _L("&Help")); SetMenuBar(m_menubar); @@ -1747,7 +1747,7 @@ void MainFrame::init_menubar_as_gcodeviewer() m_menubar->Append(fileMenu, _L("&File")); if (viewMenu != nullptr) m_menubar->Append(viewMenu, _L("&View")); // Add additional menus from C++ - m_menubar->Append(wxGetApp().get_config_menu(), _L("&Configuration")); + m_menubar->Append(wxGetApp().get_config_menu(this), _L("&Configuration")); m_menubar->Append(helpMenu, _L("&Help")); SetMenuBar(m_menubar);