From e9592a9b302ce97443e91d032164a842016677c8 Mon Sep 17 00:00:00 2001 From: Matt Coleman Date: Tue, 16 May 2023 18:35:15 -0400 Subject: [PATCH] Extract "About" menu item creation to a dedicated function --- src/slic3r/GUI/MainFrame.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index 22a1461812..b7cca76092 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -1155,6 +1155,16 @@ static const wxString sep = " - "; static const wxString sep_space = ""; #endif +static void append_about_menu_item(wxMenu* target_menu) +{ + if (wxGetApp().is_editor()) + append_menu_item(target_menu, wxID_ANY, wxString::Format(_L("&About %s"), SLIC3R_APP_NAME), _L("Show about dialog"), + [](wxCommandEvent&) { Slic3r::GUI::about(); }); + else + append_menu_item(target_menu, wxID_ANY, wxString::Format(_L("&About %s"), GCODEVIEWER_APP_NAME), _L("Show about dialog"), + [](wxCommandEvent&) { Slic3r::GUI::about(); }); +} + static wxMenu* generate_help_menu() { wxMenu* helpMenu = new wxMenu(); @@ -1189,13 +1199,8 @@ static wxMenu* generate_help_menu() [](wxCommandEvent&) { Slic3r::GUI::desktop_open_datadir_folder(); }); append_menu_item(helpMenu, wxID_ANY, _L("Report an I&ssue"), wxString::Format(_L("Report an issue on %s"), SLIC3R_APP_NAME), [](wxCommandEvent&) { wxGetApp().open_browser_with_warning_dialog("https://github.com/prusa3d/slic3r/issues/new", nullptr, false); }); - if (wxGetApp().is_editor()) - append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("&About %s"), SLIC3R_APP_NAME), _L("Show about dialog"), - [](wxCommandEvent&) { Slic3r::GUI::about(); }); - else - append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("&About %s"), GCODEVIEWER_APP_NAME), _L("Show about dialog"), - [](wxCommandEvent&) { Slic3r::GUI::about(); }); - append_menu_item(helpMenu, wxID_ANY, _L("Show Tip of the Day") + append_about_menu_item(helpMenu); + append_menu_item(helpMenu, wxID_ANY, _L("Show Tip of the Day") #if 0//debug + "\tCtrl+Shift+T" #endif