diff --git a/3d-viewer/3d_viewer/3d_menubar.cpp b/3d-viewer/3d_viewer/3d_menubar.cpp index 740622a8cc..fec916b6ec 100644 --- a/3d-viewer/3d_viewer/3d_menubar.cpp +++ b/3d-viewer/3d_viewer/3d_menubar.cpp @@ -45,7 +45,6 @@ void EDA_3D_VIEWER::CreateMenuBar() wxMenu* editMenu = new wxMenu; wxMenu* viewMenu = new wxMenu; wxMenu* prefsMenu = new wxMenu; - wxMenu* helpMenu = new wxMenu; menuBar->Append( fileMenu, _( "&File" ) ); @@ -292,39 +291,7 @@ void EDA_3D_VIEWER::CreateMenuBar() _( "Reset to Default Settings" ), KiBitmap( tools_xpm ) ); - // Help menu - // ///////////////////////////////////////////////////////////////////////// - menuBar->Append( helpMenu, _( "&Help" ) ); - - AddMenuItem( helpMenu, wxID_HELP, - _( "Pcbnew &Manual" ), - _( "Open Pcbnew Manual" ), - KiBitmap( online_help_xpm ) ); - - AddMenuItem( helpMenu, wxID_INDEX, - _( "&Getting Started in KiCad" ), - _( "Open \"Getting Started in KiCad\" guide for beginners" ), - KiBitmap( help_xpm ) ); - - wxString text = AddHotkeyName( _( "&List Hotkeys..." ), GetHotkeyConfig(), HK_HELP ); - AddMenuItem( helpMenu, ID_MENU3D_HELP_HOTKEY_SHOW_CURRENT_LIST, - text, - _( "Displays the current hotkeys list and corresponding commands" ), - KiBitmap( hotkeys_xpm ) ); - - helpMenu->AppendSeparator(); - - AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED, - _( "Get &Involved" ), - _( "Contribute to KiCad (opens a web browser)" ), - KiBitmap( info_xpm ) ); - - helpMenu->AppendSeparator(); - - AddMenuItem( helpMenu, wxID_ABOUT, - _( "&About KiCad" ), - _( "Display KiCad About dialog" ), - KiBitmap( about_xpm ) ); + AddStandardHelpMenu( menuBar ); SetMenuBar( menuBar ); } diff --git a/3d-viewer/3d_viewer/eda_3d_viewer.cpp b/3d-viewer/3d_viewer/eda_3d_viewer.cpp index ff946ea510..23db2b231f 100644 --- a/3d-viewer/3d_viewer/eda_3d_viewer.cpp +++ b/3d-viewer/3d_viewer/eda_3d_viewer.cpp @@ -135,7 +135,6 @@ BEGIN_EVENT_TABLE( EDA_3D_VIEWER, EDA_BASE_FRAME ) EVT_MENU( ID_DISABLE_RAY_TRACING, EDA_3D_VIEWER::OnDisableRayTracing ) EVT_MENU_RANGE( ID_MENU3D_GRID, ID_MENU3D_GRID_END, EDA_3D_VIEWER::On3DGridSelection ) - EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout ) EVT_CLOSE( EDA_3D_VIEWER::OnCloseWindow ) diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index f0a549a04a..816904c1c9 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -42,6 +42,9 @@ #include #include #include +#include +#include +#include /// The default auto save interval is 10 minutes. @@ -68,6 +71,14 @@ static const wxString entrySizeX = "Size_x"; ///< Width of frame, in pixels (suf static const wxString entryMaximized = "Maximized"; ///< Nonzero iff frame is maximized (suffix) ///@} + +BEGIN_EVENT_TABLE( EDA_BASE_FRAME, wxFrame ) + EVT_MENU( wxID_HELP, EDA_BASE_FRAME::GetKicadHelp ) + EVT_MENU( wxID_INDEX, EDA_BASE_FRAME::GetKicadHelp ) + EVT_MENU( ID_HELP_GET_INVOLVED, EDA_BASE_FRAME::GetKicadContribute ) + EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout ) +END_EVENT_TABLE() + EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize, long aStyle, const wxString& aFrameName ) : @@ -230,6 +241,36 @@ void EDA_BASE_FRAME::ReCreateMenuBar() } +void EDA_BASE_FRAME::AddStandardHelpMenu( wxMenuBar* aMenuBar ) +{ + wxMenu* helpMenu = new wxMenu; + + AddMenuItem( helpMenu, wxID_HELP, + _( "&Help" ), + _( "Open product documentation in a web browser" ), + KiBitmap( online_help_xpm ) ); + + AddMenuItem( helpMenu, wxID_INDEX, + _( "&Getting Started with KiCad" ), + _( "Open \"Getting Started in KiCad\" guide for beginners" ), + KiBitmap( help_xpm ) ); + + AddMenuItem( helpMenu, ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, _( "&List Hotkeys..." ), + _( "Displays current hotkeys table and corresponding commands" ), + KiBitmap( hotkeys_xpm ) ); + + helpMenu->AppendSeparator(); + AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED, _( "Get &Involved" ), + _( "Open \"Contribute to KiCad\" in a web browser" ), + KiBitmap( info_xpm ) ); + + helpMenu->AppendSeparator(); + AddMenuItem( helpMenu, wxID_ABOUT, _( "&About KiCad" ), KiBitmap( about_xpm ) ); + + aMenuBar->Append( helpMenu, _( "&Help" ) ); +} + + void EDA_BASE_FRAME::ShowChangedLanguage() { if( GetMenuBar() ) diff --git a/common/tool/action_menu.cpp b/common/tool/action_menu.cpp index 1528fb1141..27e819e33e 100644 --- a/common/tool/action_menu.cpp +++ b/common/tool/action_menu.cpp @@ -143,11 +143,7 @@ void ACTION_MENU::DisplayTitle( bool aDisplay ) wxMenuItem* ACTION_MENU::Add( const wxString& aLabel, int aId, const BITMAP_OPAQUE* aIcon ) { -#ifdef DEBUG - if( FindItem( aId ) != NULL ) - wxLogWarning( wxT( "Adding more than one menu entry with the same ID may result in" - "undefined behaviour" ) ); -#endif + wxASSERT_MSG( FindItem( aId ) == nullptr, "Duplicate menu IDs!" ); wxMenuItem* item = new wxMenuItem( this, aId, aLabel, wxEmptyString, wxITEM_NORMAL ); set_wxMenuIcon( item, aIcon ); @@ -156,6 +152,18 @@ wxMenuItem* ACTION_MENU::Add( const wxString& aLabel, int aId, const BITMAP_OPAQ } +wxMenuItem* ACTION_MENU::Add( const wxString& aLabel, const wxString& aTooltip, int aId, + const BITMAP_OPAQUE* aIcon ) +{ + wxASSERT_MSG( FindItem( aId ) == nullptr, "Duplicate menu IDs!" ); + + wxMenuItem* item = new wxMenuItem( this, aId, aLabel, aTooltip, wxITEM_NORMAL ); + set_wxMenuIcon( item, aIcon ); + + return Append( item ); +} + + wxMenuItem* ACTION_MENU::Add( const TOOL_ACTION& aAction, bool aIsCheckmarkEntry ) { /// ID numbers for tool actions need to have a value higher than ACTION_ID diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp index 126c3e0fec..cf63e7de28 100644 --- a/cvpcb/cvpcb_mainframe.cpp +++ b/cvpcb/cvpcb_mainframe.cpp @@ -65,8 +65,6 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER ) // Menu events EVT_MENU( ID_SAVE_PROJECT, CVPCB_MAINFRAME::OnSaveAndContinue ) EVT_MENU( wxID_EXIT, CVPCB_MAINFRAME::OnQuit ) - EVT_MENU( wxID_HELP, CVPCB_MAINFRAME::GetKicadHelp ) - EVT_MENU( wxID_ABOUT, CVPCB_MAINFRAME::GetKicadAbout ) EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, CVPCB_MAINFRAME::OnConfigurePaths ) EVT_MENU( ID_CVPCB_EQUFILES_LIST_EDIT, CVPCB_MAINFRAME::OnEditEquFilesList ) diff --git a/cvpcb/menubar.cpp b/cvpcb/menubar.cpp index 8f55ab7b47..8c3cb3aa01 100644 --- a/cvpcb/menubar.cpp +++ b/cvpcb/menubar.cpp @@ -84,27 +84,10 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() // Language submenu Pgm().AddMenuLanguageList( preferencesMenu ); - // Menu Help: - wxMenu* helpMenu = new wxMenu; - - // Manual Contents - AddMenuItem( helpMenu, wxID_HELP, _( "CvPcb &Manual" ), - _( "Open CvPcb Manual" ), - KiBitmap( online_help_xpm ) ); - - AddMenuItem( helpMenu, - wxID_INDEX, - _( "&Getting Started in KiCad" ), - _( "Open \"Getting Started in KiCad\" guide for beginners" ), - KiBitmap( help_xpm ) ); - - // About CvPcb - AddMenuItem( helpMenu, wxID_ABOUT, _( "&About KiCad" ), KiBitmap( about_xpm ) ); - // Create the menubar and append all submenus menuBar->Append( filesMenu, _( "&File" ) ); menuBar->Append( preferencesMenu, _( "&Preferences" ) ); - menuBar->Append( helpMenu, _( "&Help" ) ); + AddStandardHelpMenu( menuBar ); SetMenuBar( menuBar ); delete oldMenuBar; diff --git a/eeschema/libedit/lib_edit_frame.cpp b/eeschema/libedit/lib_edit_frame.cpp index 0a3c0bb551..f9c0cd8bf6 100644 --- a/eeschema/libedit/lib_edit_frame.cpp +++ b/eeschema/libedit/lib_edit_frame.cpp @@ -123,10 +123,6 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_MENU( wxID_EXIT, LIB_EDIT_FRAME::CloseWindow ) EVT_MENU( ID_LIBEDIT_GEN_PNG_FILE, LIB_EDIT_FRAME::OnPlotCurrentComponent ) EVT_MENU( ID_LIBEDIT_GEN_SVG_FILE, LIB_EDIT_FRAME::OnPlotCurrentComponent ) - EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp ) - EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp ) - EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute ) - EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout ) EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings ) EVT_MENU( ID_MENU_CANVAS_CAIRO, LIB_EDIT_FRAME::OnSwitchCanvas ) EVT_MENU( ID_MENU_CANVAS_OPENGL, LIB_EDIT_FRAME::OnSwitchCanvas ) diff --git a/eeschema/libedit/menubar_libedit.cpp b/eeschema/libedit/menubar_libedit.cpp index f1f6cadd0b..2e66787f83 100644 --- a/eeschema/libedit/menubar_libedit.cpp +++ b/eeschema/libedit/menubar_libedit.cpp @@ -281,50 +281,16 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() _( "Use Modern Toolset with software graphics (fall-back)" ), KiBitmap( tools_xpm ), wxITEM_RADIO ); - - - // Menu Help: - wxMenu* helpMenu = new wxMenu; - - // Contents - AddMenuItem( helpMenu, - wxID_HELP, - _( "Eeschema &Manual" ), - _( "Open the Eeschema Manual" ), - KiBitmap( online_help_xpm ) ); - - AddMenuItem( helpMenu, - wxID_INDEX, - _( "&Getting Started in KiCad" ), - _( "Open the \"Getting Started in KiCad\" guide for beginners" ), - KiBitmap( help_xpm ) ); - - text = AddHotkeyName( _( "&List Hotkeys..." ), g_Libedit_Hotkeys_Descr, HK_HELP ); - AddMenuItem( helpMenu, - ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, - text, - _( "Displays the current hotkeys list and corresponding commands" ), - KiBitmap( hotkeys_xpm ) ); - - helpMenu->AppendSeparator(); - AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED, - _( "Get &Involved" ), - _( "Contribute to KiCad (opens a web browser)" ), - KiBitmap( info_xpm ) ); - - // About Eeschema - helpMenu->AppendSeparator(); - - AddMenuItem( helpMenu, wxID_ABOUT, _( "&About KiCad" ), KiBitmap( about_xpm ) ); - + // // Create the menubar and append all submenus + // menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( placeMenu, _( "&Place" ) ); menuBar->Append( inspectMenu, _( "&Inspect" ) ); menuBar->Append( preferencesMenu, _( "P&references" ) ); - menuBar->Append( helpMenu, _( "&Help" ) ); + AddStandardHelpMenu( menuBar ); SetMenuBar( menuBar ); delete oldMenuBar; diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index 6637e74d92..a184c42f2a 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -53,9 +53,6 @@ static void prepareInspectMenu( wxMenu* aParentMenu ); // Build the tools menu static void prepareToolsMenu( wxMenu* aParentMenu ); -// Build the help menu -static void prepareHelpMenu( wxMenu* aParentMenu ); - // Build the preferences menu static void preparePreferencesMenu( SCH_EDIT_FRAME* aFrame, wxMenu* aParentMenu ); @@ -213,12 +210,6 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() wxMenu* preferencesMenu = new wxMenu; preparePreferencesMenu( this, preferencesMenu ); - // - // Help Menu: - // - wxMenu* helpMenu = new wxMenu; - prepareHelpMenu( helpMenu ); - // Create the menubar and append all submenus menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( editMenu, _( "&Edit" ) ); @@ -227,7 +218,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() menuBar->Append( inspectMenu, _( "&Inspect" ) ); menuBar->Append( toolsMenu, _( "&Tools" ) ); menuBar->Append( preferencesMenu, _( "P&references" ) ); - menuBar->Append( helpMenu, _( "&Help" ) ); + AddStandardHelpMenu( menuBar ); SetMenuBar( menuBar ); delete oldMenuBar; @@ -432,31 +423,6 @@ void prepareToolsMenu( wxMenu* aParentMenu ) } -void prepareHelpMenu( wxMenu* aParentMenu ) -{ - AddMenuItem( aParentMenu, wxID_HELP, _( "Eeschema &Manual" ), - _( "Open Eeschema Manual" ), - KiBitmap( online_help_xpm ) ); - - AddMenuItem( aParentMenu, wxID_INDEX, _( "&Getting Started in KiCad" ), - _( "Open \"Getting Started in KiCad\" guide for beginners" ), - KiBitmap( help_xpm ) ); - - wxString text = AddHotkeyName( _( "&List Hotkeys..." ), g_Eeschema_Hotkeys_Descr, HK_HELP ); - AddMenuItem( aParentMenu, ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, text, - _( "Displays current hotkeys table and corresponding commands" ), - KiBitmap( hotkeys_xpm ) ); - - aParentMenu->AppendSeparator(); - AddMenuItem( aParentMenu, ID_HELP_GET_INVOLVED, _( "Get &Involved" ), - _( "Contribute to KiCad (opens a web browser)" ), - KiBitmap( info_xpm ) ); - - aParentMenu->AppendSeparator(); - AddMenuItem( aParentMenu, wxID_ABOUT, _( "&About KiCad" ), KiBitmap( about_xpm ) ); -} - - static void preparePreferencesMenu( SCH_EDIT_FRAME* aFrame, wxMenu* aParentMenu ) { // Path configuration edit dialog. diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 2033951a98..74ba405175 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -262,10 +262,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_TOOL( ID_BUS_MANAGER, SCH_EDIT_FRAME::OnLaunchBusManager ) EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile ) EVT_TOOL( ID_UPDATE_FIELDS, SCH_EDIT_FRAME::OnUpdateFields ) - EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp ) - EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp ) - EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute ) - EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout ) EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings ) #ifdef KICAD_SPICE diff --git a/eeschema/toolbars_viewlib.cpp b/eeschema/toolbars_viewlib.cpp index 46ec2e0ca4..5e3afde95d 100644 --- a/eeschema/toolbars_viewlib.cpp +++ b/eeschema/toolbars_viewlib.cpp @@ -146,36 +146,11 @@ void LIB_VIEW_FRAME::ReCreateMenuBar() viewMenu->AddSeparator(); viewMenu->AddItem( EE_ACTIONS::showElectricalTypes, EE_CONDITIONS::ShowAlways ); - // Menu Help: - wxMenu* helpMenu = new wxMenu; - - // Contents - AddMenuItem( helpMenu, wxID_HELP, - _( "Eeschema &Manual" ), - _( "Open Eeschema manual" ), - KiBitmap( online_help_xpm ) ); - - AddMenuItem( helpMenu, wxID_INDEX, - _( "&Getting Started in KiCad" ), - _( "Open the \"Getting Started in KiCad\" guide for beginners" ), - KiBitmap( help_xpm ) ); - - helpMenu->AppendSeparator(); - AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED, - _( "Get &Involved" ), - _( "Contribute to KiCad (opens a web browser)" ), - KiBitmap( info_xpm ) ); - - helpMenu->AppendSeparator(); - AddMenuItem( helpMenu, wxID_ABOUT, - _( "&About Eeschema" ), - _( "About Eeschema schematic designer" ), - KiBitmap( info_xpm ) ); // Append menus to the menubar menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( viewMenu, _( "&View" ) ); - menuBar->Append( helpMenu, _( "&Help" ) ); + AddStandardHelpMenu( menuBar ); SetMenuBar( menuBar ); delete oldMenuBar; diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index e082078df5..c0e4d77b1a 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -80,9 +80,7 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME ) EVT_LISTBOX_DCLICK( ID_LIBVIEW_CMP_LIST, LIB_VIEW_FRAME::DClickOnCmpList ) // Menu (and/or hotkey) events - EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp ) EVT_MENU( wxID_EXIT, LIB_VIEW_FRAME::CloseLibraryViewer ) - EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute ) EVT_MENU( ID_SET_RELATIVE_OFFSET, LIB_VIEW_FRAME::OnSetRelativeOffset ) EVT_UPDATE_UI( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, LIB_VIEW_FRAME::onUpdateNormalBodyStyleButton ) diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp index c882f3c2d9..8dcc1598eb 100644 --- a/gerbview/events_called_functions.cpp +++ b/gerbview/events_called_functions.cpp @@ -99,12 +99,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME ) // menu Miscellaneous EVT_MENU( ID_GERBVIEW_ERASE_CURR_LAYER, GERBVIEW_FRAME::Process_Special_Functions ) - // Menu Help - EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp ) - EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp ) - EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute ) - EVT_MENU( wxID_ABOUT, EDA_DRAW_FRAME::GetKicadAbout ) - EVT_TOOL( wxID_PRINT, GERBVIEW_FRAME::ToPrinter ) EVT_COMBOBOX( ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, GERBVIEW_FRAME::OnSelectActiveLayer ) diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index 82c6905820..8f51f985d1 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -321,37 +321,14 @@ void GERBVIEW_FRAME::ReCreateMenuBar() _( "Clear the graphic layer currently selected" ), KiBitmap( delete_sheet_xpm ) ); - // Help menu - wxMenu* helpMenu = new wxMenu; - - AddMenuItem( helpMenu, wxID_HELP, _( "Gerbview &Manual" ), - _( "Open the GerbView Manual" ), - KiBitmap( online_help_xpm ) ); - - text = AddHotkeyName( _( "&List Hotkeys..." ), GerbviewHotkeysDescr, HK_HELP ); - AddMenuItem( helpMenu, ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, text, - _( "Displays the current hotkeys list and corresponding commands" ), - KiBitmap( hotkeys_xpm ) ); - - // Separator - helpMenu->AppendSeparator(); - - // Get involved with KiCad - AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED, _( "Get &Involved" ), - _( "Contribute to KiCad (opens a web browser)" ), - KiBitmap( info_xpm ) ); - - helpMenu->AppendSeparator(); - - // About Kicad - AddMenuItem( helpMenu, wxID_ABOUT, _( "&About KiCad" ), KiBitmap( about_xpm ) ); - + // // Append menus to the menubar + // menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( miscellaneousMenu, _( "&Tools" ) ); menuBar->Append( configMenu, _( "&Preferences" ) ); - menuBar->Append( helpMenu, _( "&Help" ) ); + AddStandardHelpMenu( menuBar ); // Associate the menu bar with the frame, if no previous menubar SetMenuBar( menuBar ); diff --git a/include/eda_base_frame.h b/include/eda_base_frame.h index cada104350..b31331f624 100644 --- a/include/eda_base_frame.h +++ b/include/eda_base_frame.h @@ -190,6 +190,8 @@ protected: virtual wxString help_name(); + DECLARE_EVENT_TABLE() + public: EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize, @@ -350,6 +352,11 @@ public: */ virtual void ReCreateMenuBar(); + /** + * Adds the standard KiCad help menu to the menubar. + */ + void AddStandardHelpMenu( wxMenuBar* aMenuBar ); + /** * Checks if \a aFileName can be written. *

diff --git a/include/tool/action_menu.h b/include/tool/action_menu.h index 3d4cdc3f3c..623e60dd21 100644 --- a/include/tool/action_menu.h +++ b/include/tool/action_menu.h @@ -74,13 +74,12 @@ public: /** * Function Add() - * Adds an entry to the menu. After highlighting/selecting the entry, a TOOL_EVENT command is - * sent that contains ID of the entry. - * @param aLabel is the text label show in the menu. - * @param aId is the ID that is sent in the TOOL_EVENT. It should be unique for every entry. - * @param aIcon is an optional icon. + * Adds a wxWidgets-style entry to the menu. After highlighting/selecting the entry, + * a wxWidgets event is generated. */ - wxMenuItem* Add( const wxString& aLabel, int aId, const BITMAP_OPAQUE* aIcon = NULL ); + wxMenuItem* Add( const wxString& aLabel, int aId, const BITMAP_OPAQUE* aIcon ); + wxMenuItem* Add( const wxString& aLabel, const wxString& aToolTip, int aId, + const BITMAP_OPAQUE* aIcon ); /** * Function Add() diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp index 6904c487f7..23ec3d8995 100644 --- a/kicad/menubar.cpp +++ b/kicad/menubar.cpp @@ -61,10 +61,6 @@ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME ) EVT_MENU( ID_SAVE_AND_ZIP_FILES, KICAD_MANAGER_FRAME::OnArchiveFiles ) EVT_MENU( ID_READ_ZIP_ARCHIVE, KICAD_MANAGER_FRAME::OnUnarchiveFiles ) EVT_MENU( ID_PROJECT_TREE_REFRESH, KICAD_MANAGER_FRAME::OnRefresh ) - EVT_MENU( wxID_HELP, KICAD_MANAGER_FRAME::GetKicadHelp ) - EVT_MENU( wxID_INDEX, KICAD_MANAGER_FRAME::GetKicadHelp ) - EVT_MENU( ID_HELP_GET_INVOLVED, KICAD_MANAGER_FRAME::GetKicadContribute ) - EVT_MENU( wxID_ABOUT, KICAD_MANAGER_FRAME::GetKicadAbout ) EVT_MENU( ID_IMPORT_EAGLE_PROJECT, KICAD_MANAGER_FRAME::OnImportEagleFiles ) // Range menu events @@ -400,47 +396,13 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() _( "Edit worksheet graphics and text" ), KiBitmap( pagelayout_load_xpm ) ); - // Menu Help: - wxMenu* helpMenu = new wxMenu; - - // Contents - AddMenuItem( helpMenu, wxID_HELP, - _( "KiCad &Manual" ), - _( "Open KiCad user manual" ), - KiBitmap( online_help_xpm ) ); - - AddMenuItem( helpMenu, wxID_INDEX, - _( "&Getting Started in KiCad" ), - _( "Open \"Getting Started in KiCad\" guide for beginners" ), - KiBitmap( help_xpm ) ); - - AddMenuItem( helpMenu, - ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, - _( "&List Hotkeys" ), - _( "Displays the current hotkeys list and corresponding commands" ), - KiBitmap( hotkeys_xpm ) ); - - // Separator - helpMenu->AppendSeparator(); - - // Get involved with KiCad - AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED, - _( "Get &Involved" ), - _( "Contribute to KiCad (opens a web browser)" ), - KiBitmap( info_xpm ) ); - - helpMenu->AppendSeparator(); - - // About - AddMenuItem( helpMenu, wxID_ABOUT, _( "&About KiCad" ), KiBitmap( about_xpm ) ); - // Create the menubar and append all submenus menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( toolsMenu, _( "&Tools" ) ); menuBar->Append( browseMenu, _( "&Browse" ) ); menuBar->Append( preferencesMenu, _( "&Preferences" ) ); - menuBar->Append( helpMenu, _( "&Help" ) ); + AddStandardHelpMenu( menuBar ); SetMenuBar( menuBar ); delete oldMenuBar; diff --git a/pagelayout_editor/events_functions.cpp b/pagelayout_editor/events_functions.cpp index 92d94fca67..ece1298b19 100644 --- a/pagelayout_editor/events_functions.cpp +++ b/pagelayout_editor/events_functions.cpp @@ -76,12 +76,6 @@ BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME ) EVT_MENU( ID_MENU_SWITCH_BGCOLOR, PL_EDITOR_FRAME::Process_Config ) EVT_MENU( ID_MENU_GRID_ONOFF, PL_EDITOR_FRAME::Process_Config ) - // Menu Help - EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp ) - EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp ) - EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute ) - EVT_MENU( wxID_ABOUT, EDA_DRAW_FRAME::GetKicadAbout ) - EVT_TOOL( wxID_DELETE, PL_EDITOR_FRAME::Process_Special_Functions ) EVT_TOOL( wxID_UNDO, PL_EDITOR_FRAME::GetLayoutFromUndoList ) EVT_TOOL( wxID_REDO, PL_EDITOR_FRAME::GetLayoutFromRedoList ) diff --git a/pagelayout_editor/menubar.cpp b/pagelayout_editor/menubar.cpp index 7e5eb87301..b6186bcbca 100644 --- a/pagelayout_editor/menubar.cpp +++ b/pagelayout_editor/menubar.cpp @@ -181,41 +181,13 @@ void PL_EDITOR_FRAME::ReCreateMenuBar() // Language submenu Pgm().AddMenuLanguageList( preferencesMenu ); - // Menu Help - wxMenu* helpMenu = new wxMenu; - - // Contents - AddMenuItem( helpMenu, wxID_HELP, _( "Page Layout Editor &Manual" ), - _( "Open the Page Layout Editor Manual" ), - KiBitmap( online_help_xpm ) ); - - AddMenuItem( helpMenu, wxID_INDEX, _( "&Getting Started in KiCad" ), - _( "Open \"Getting Started in KiCad\" guide for beginners" ), - KiBitmap( help_xpm ) ); - - msg = AddHotkeyName( _( "&List Hotkeys" ), PlEditorHotkeysDescr, HK_HELP ); - AddMenuItem( helpMenu, ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, msg, - _( "Displays the current hotkeys list and corresponding commands" ), - KiBitmap( hotkeys_xpm ) ); - - helpMenu->AppendSeparator(); - AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED, _( "Get &Involved" ), - _( "Contribute to KiCad (opens a web browser)" ), - KiBitmap( info_xpm ) ); - - // Separator - helpMenu->AppendSeparator(); - - // About Kicad - AddMenuItem( helpMenu, wxID_ABOUT, _( "&About KiCad" ), wxEmptyString, KiBitmap( about_xpm ) ); - // Append menus to the menubar menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( placeMenu, _( "&Place" ) ); menuBar->Append( preferencesMenu, _( "P&references" ) ); - menuBar->Append( helpMenu, _( "&Help" ) ); + AddStandardHelpMenu( menuBar ); SetMenuBar( menuBar ); delete oldMenuBar; diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index 1943974201..4df45283db 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -154,12 +154,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) EVT_MENU( ID_PCB_USER_GRID_SETUP, FOOTPRINT_EDIT_FRAME::OnGridSettings ) - // Menu Help - EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp ) - EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp ) - EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute ) - EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout ) - // Menu 3D Frame EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, FOOTPRINT_EDIT_FRAME::Show3D_Frame ) diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index 8faed0e4f0..5a98a65bf7 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -78,12 +78,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_VIEWER_FRAME, EDA_DRAW_FRAME ) EVT_MENU( wxID_EXIT, FOOTPRINT_VIEWER_FRAME::CloseFootprintViewer ) EVT_MENU( ID_SET_RELATIVE_OFFSET, FOOTPRINT_VIEWER_FRAME::OnSetRelativeOffset ) - // Menu Help - EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp ) - EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp ) - EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute ) - EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout ) - // Toolbar events EVT_TOOL( ID_MODVIEW_SELECT_PART, FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint ) EVT_TOOL( ID_MODVIEW_OPTIONS, FOOTPRINT_VIEWER_FRAME::InstallDisplayOptions ) diff --git a/pcbnew/menubar_footprint_editor.cpp b/pcbnew/menubar_footprint_editor.cpp index 933bb4f8df..b51a4f254b 100644 --- a/pcbnew/menubar_footprint_editor.cpp +++ b/pcbnew/menubar_footprint_editor.cpp @@ -357,37 +357,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() // Language submenu Pgm().AddMenuLanguageList( prefs_menu ); - //----- Help menu -------------------- - wxMenu* helpMenu = new wxMenu; - - // Contents - AddMenuItem( helpMenu, wxID_HELP, - _( "Pcbnew &Manual" ), - _( "Open the Pcbnew Manual" ), - KiBitmap( online_help_xpm ) ); - - AddMenuItem( helpMenu, wxID_INDEX, - _( "&Getting Started in KiCad" ), - _( "Open the \"Getting Started in KiCad\" guide for beginners" ), - KiBitmap( help_xpm ) ); - - text = AddHotkeyName( _( "&List Hotkeys..." ), m_hotkeysDescrList, HK_HELP ); - AddMenuItem( helpMenu, ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, - text, - _( "Displays current hotkeys table and corresponding commands" ), - KiBitmap( hotkeys_xpm ) ); - - helpMenu->AppendSeparator(); - - AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED, - _( "Get &Involved" ), - _( "Contribute to KiCad (opens a web browser)" ), - KiBitmap( info_xpm ) ); - - // About Pcbnew - helpMenu->AppendSeparator(); - AddMenuItem( helpMenu, wxID_ABOUT, _( "&About KiCad" ), KiBitmap( about_xpm ) ); - + //------------------------------------ // Append menus to the menubar menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( editMenu, _( "&Edit" ) ); @@ -396,7 +366,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() menuBar->Append( inspectMenu, _( "&Inspect" ) ); menuBar->Append( toolsMenu, _( "&Tools" ) ); menuBar->Append( prefs_menu, _( "P&references" ) ); - menuBar->Append( helpMenu, _( "&Help" ) ); + AddStandardHelpMenu( menuBar ); SetMenuBar( menuBar ); delete oldMenuBar; diff --git a/pcbnew/menubar_pcb_editor.cpp b/pcbnew/menubar_pcb_editor.cpp index 0c09080158..5241b56d09 100644 --- a/pcbnew/menubar_pcb_editor.cpp +++ b/pcbnew/menubar_pcb_editor.cpp @@ -323,11 +323,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() preparePreferencesMenu( this, configmenu ); - //------ Help menu ---------------------------------------------------------- - wxMenu* helpMenu = new wxMenu; - prepareHelpMenu( helpMenu ); - - // Append all menus to the menuBar + //------ Append all menus to the menuBar ------------------------------------ menuBar->Append( filesMenu, _( "&File" ) ); menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( viewMenu, _( "&View" ) ); @@ -336,7 +332,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() menuBar->Append( inspectMenu, _( "&Inspect" ) ); menuBar->Append( toolsMenu, _( "&Tools" ) ); menuBar->Append( configmenu, _( "P&references" ) ); - menuBar->Append( helpMenu, _( "&Help" ) ); + AddStandardHelpMenu( menuBar ); SetMenuBar( menuBar ); delete oldMenuBar; @@ -539,39 +535,6 @@ void prepareToolsMenu( wxMenu* aParentMenu ) } -// Build the help menu -void prepareHelpMenu( wxMenu* aParentMenu ) -{ - - AddMenuItem( aParentMenu, wxID_HELP, - _( "Pcbnew &Manual" ), - _( "Open Pcbnew Manual" ), - KiBitmap( online_help_xpm ) ); - - AddMenuItem( aParentMenu, wxID_INDEX, - _( "&Getting Started in KiCad" ), - _( "Open \"Getting Started in KiCad\" guide for beginners" ), - KiBitmap( help_xpm ) ); - - wxString text = AddHotkeyName( _( "&List Hotkeys..." ), g_Board_Editor_Hotkeys_Descr, HK_HELP ); - AddMenuItem( aParentMenu, ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, - text, - _( "Display current hotkeys list and corresponding commands" ), - KiBitmap( hotkeys_xpm ) ); - - aParentMenu->AppendSeparator(); - - AddMenuItem( aParentMenu, ID_HELP_GET_INVOLVED, - _( "Get &Involved" ), - _( "Contribute to KiCad (opens a web browser)" ), - KiBitmap( info_xpm ) ); - - aParentMenu->AppendSeparator(); - - AddMenuItem( aParentMenu, wxID_ABOUT, _( "&About KiCad" ), KiBitmap( about_xpm ) ); -} - - // Build the files menu. void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject ) { diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index 469738245b..2516d648d5 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -184,12 +184,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_MENU( ID_MENU_PCB_SWAP_LAYERS, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_MENU_PCB_EDIT_TEXT_AND_GRAPHICS, PCB_EDIT_FRAME::OnEditTextAndGraphics ) - // Menu Help - EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp ) - EVT_MENU( wxID_INDEX, EDA_DRAW_FRAME::GetKicadHelp ) - EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute ) - EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout ) - // Menu 3D Frame EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, PCB_EDIT_FRAME::Show3D_Frame ) diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index d05b5585bb..15cef04a9c 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -362,8 +362,6 @@ public: void UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, const bool aEdit = true ); void UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, const bool aEdit = true ); - void GetKicadAbout( wxCommandEvent& event ); - /** * Function IsGridVisible() , virtual * @return true if the grid must be shown diff --git a/pcbnew/toolbars_footprint_viewer.cpp b/pcbnew/toolbars_footprint_viewer.cpp index 7a8d65e067..8ec40d1bb6 100644 --- a/pcbnew/toolbars_footprint_viewer.cpp +++ b/pcbnew/toolbars_footprint_viewer.cpp @@ -24,6 +24,9 @@ #include #include #include +#include +#include +#include #include "help_common_strings.h" #include "hotkeys.h" #include "footprint_viewer_frame.h" @@ -115,6 +118,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateVToolbar() // Virtual function void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar() { + SELECTION_TOOL* selTool = m_toolManager->GetTool(); // wxWidgets handles the Mac Application menu behind the scenes, but that means // we always have to start from scratch with a new wxMenuBar. wxMenuBar* oldMenuBar = GetMenuBar(); @@ -133,23 +137,13 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar() KiBitmap( exit_xpm ) ); // View menu - wxMenu* viewMenu = new wxMenu; + CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool ); - text = AddHotkeyName( _( "Zoom &In" ), g_Module_Viewer_Hotkeys_Descr, - HK_ZOOM_IN, IS_ACCELERATOR ); - AddMenuItem( viewMenu, ID_VIEWER_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) ); - - text = AddHotkeyName( _( "Zoom &Out" ), g_Module_Viewer_Hotkeys_Descr, - HK_ZOOM_OUT, IS_ACCELERATOR ); - AddMenuItem( viewMenu, ID_VIEWER_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) ); - - text = AddHotkeyName( _( "&Fit on Screen" ), g_Module_Viewer_Hotkeys_Descr, HK_ZOOM_AUTO ); - AddMenuItem( viewMenu, ID_VIEWER_ZOOM_PAGE, text, _( "Zoom to fit footprint" ), - KiBitmap( zoom_fit_in_page_xpm ) ); - - text = AddHotkeyName( _( "&Redraw" ), g_Module_Viewer_Hotkeys_Descr, HK_ZOOM_REDRAW ); - AddMenuItem( viewMenu, ID_VIEWER_ZOOM_REDRAW, text, - HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) ); + viewMenu->AddSeparator(); + viewMenu->AddItem( ACTIONS::zoomInCenter, SELECTION_CONDITIONS::ShowAlways ); + viewMenu->AddItem( ACTIONS::zoomOutCenter, SELECTION_CONDITIONS::ShowAlways ); + viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways ); + viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways ); viewMenu->AppendSeparator(); @@ -158,32 +152,10 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar() AddMenuItem( viewMenu, ID_MODVIEW_SHOW_3D_VIEW, text, _( "Show footprint in 3D viewer" ), KiBitmap( three_d_xpm ) ); - // Menu Help: - wxMenu* helpMenu = new wxMenu; - - // Contents - AddMenuItem( helpMenu, wxID_HELP, - _( "Pcbnew &Manual" ), - _( "Open the Pcbnew manual" ), - KiBitmap( online_help_xpm ) ); - - AddMenuItem( helpMenu, wxID_INDEX, - _( "&Getting Started in KiCad" ), - _( "Open the \"Getting Started in KiCad\" guide for beginners" ), - KiBitmap( help_xpm ) ); - - // About Pcbnew - helpMenu->AppendSeparator(); - AddMenuItem( helpMenu, wxID_ABOUT, - _( "&About Pcbnew" ), - _( "About Pcbnew PCB designer" ), - KiBitmap( info_xpm ) ); - // Append menus to the menubar menuBar->Append( fileMenu, _( "&File" ) ); - menuBar->Append( viewMenu, _( "&View" ) ); - menuBar->Append( helpMenu, _( "&Help" ) ); + AddStandardHelpMenu( menuBar ); SetMenuBar( menuBar ); delete oldMenuBar;