mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 19:35:55 +08:00
Extract macOS application menu initialization to a dedicated function
This commit is contained in:
parent
e9592a9b30
commit
7b68c09bff
@ -1165,6 +1165,18 @@ static void append_about_menu_item(wxMenu* target_menu)
|
|||||||
[](wxCommandEvent&) { Slic3r::GUI::about(); });
|
[](wxCommandEvent&) { Slic3r::GUI::about(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
|
static void init_macos_application_menu(wxMenuBar* menu_bar, MainFrame* main_frame)
|
||||||
|
{
|
||||||
|
wxMenu* apple_menu = menu_bar->OSXGetAppleMenu();
|
||||||
|
if (apple_menu != nullptr) {
|
||||||
|
// This fixes a bug on macOS where the quit command doesn't emit window close events.
|
||||||
|
// wx bug: https://trac.wxwidgets.org/ticket/18328
|
||||||
|
apple_menu->Bind(wxEVT_MENU, [main_frame](wxCommandEvent&) { main_frame->Close(); }, wxID_EXIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // __APPLE__
|
||||||
|
|
||||||
static wxMenu* generate_help_menu()
|
static wxMenu* generate_help_menu()
|
||||||
{
|
{
|
||||||
wxMenu* helpMenu = new wxMenu();
|
wxMenu* helpMenu = new wxMenu();
|
||||||
@ -1599,14 +1611,7 @@ void MainFrame::init_menubar_as_editor()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// This fixes a bug on Mac OS where the quit command doesn't emit window close events
|
init_macos_application_menu(m_menubar, this);
|
||||||
// wx bug: https://trac.wxwidgets.org/ticket/18328
|
|
||||||
wxMenu* apple_menu = m_menubar->OSXGetAppleMenu();
|
|
||||||
if (apple_menu != nullptr) {
|
|
||||||
apple_menu->Bind(wxEVT_MENU, [this](wxCommandEvent &) {
|
|
||||||
Close();
|
|
||||||
}, wxID_EXIT);
|
|
||||||
}
|
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
|
|
||||||
if (plater()->printer_technology() == ptSLA)
|
if (plater()->printer_technology() == ptSLA)
|
||||||
@ -1698,14 +1703,7 @@ void MainFrame::init_menubar_as_gcodeviewer()
|
|||||||
SetMenuBar(m_menubar);
|
SetMenuBar(m_menubar);
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
// This fixes a bug on Mac OS where the quit command doesn't emit window close events
|
init_macos_application_menu(m_menubar, this);
|
||||||
// wx bug: https://trac.wxwidgets.org/ticket/18328
|
|
||||||
wxMenu* apple_menu = m_menubar->OSXGetAppleMenu();
|
|
||||||
if (apple_menu != nullptr) {
|
|
||||||
apple_menu->Bind(wxEVT_MENU, [this](wxCommandEvent&) {
|
|
||||||
Close();
|
|
||||||
}, wxID_EXIT);
|
|
||||||
}
|
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user