From 6b39096b03d3daab4bb175c04e6f7f5ff6bc99ab Mon Sep 17 00:00:00 2001 From: Jerry Jacobs Date: Wed, 6 Apr 2011 15:52:47 +0200 Subject: [PATCH] Cleanup of all menubar code, see CHANGELOG.txt --- CHANGELOG.txt | 7 + common/hotkeys_basic.cpp | 1 + cvpcb/cvframe.cpp | 4 +- cvpcb/cvpcb.cpp | 8 - cvpcb/menubar.cpp | 100 ++++++---- eeschema/menubar.cpp | 271 ++++++++++++++++----------- eeschema/menubar_libedit.cpp | 226 +++++++++++++--------- gerbview/events_called_functions.cpp | 14 +- gerbview/gerbview.cpp | 5 - gerbview/gerbview_frame.h | 10 + gerbview/menubar.cpp | 165 +++++++++++----- kicad/menubar.cpp | 113 ++++++----- pcbnew/menubar_modedit.cpp | 191 ++++++++++--------- 13 files changed, 664 insertions(+), 451 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 029e8b9402..f40ede4e34 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,13 @@ KiCad ChangeLog 2010 Please add newer entries at the top, list the date and your name with email address. +2011-Apr-6, UPDATE Jerry Jacobs +================================================================================ +Cleanup of all the menubar code to have the same style, remove the C comments. +Make the wxMenu behave native on OSX for KiCad, CvPCB and Gerbview and remove +unneeded ifdefs when using the wxIDs. Add a OnQuit for the gerber frame. +Change item->SetBitmap( item ) to use macro SET_BITMAP for menu items. + 2011-Apr-4, UPDATE Jerry Jacobs ================================================================================ More native OSX changes, this removes some WXMAC defines replaced by wxID diff --git a/common/hotkeys_basic.cpp b/common/hotkeys_basic.cpp index 4f3613b180..5d5c418522 100644 --- a/common/hotkeys_basic.cpp +++ b/common/hotkeys_basic.cpp @@ -673,3 +673,4 @@ void AddHotkeyConfigMenu( wxMenu* aMenu ) ID_PREFERENCES_HOTKEY_SUBMENU, _( "Hotkeys" ), _( "Hotkeys configuration and preferences" ), hotkeys_xpm ); } + diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp index b99f46b867..220dc756e4 100644 --- a/cvpcb/cvframe.cpp +++ b/cvpcb/cvframe.cpp @@ -43,9 +43,9 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME ) CVPCB_MAINFRAME::OnQuit ) EVT_MENU( ID_GENERAL_HELP, CVPCB_MAINFRAME::GetKicadHelp ) - EVT_MENU( ID_KICAD_ABOUT, + EVT_MENU( wxID_ABOUT, CVPCB_MAINFRAME::GetKicadAbout ) - EVT_MENU( ID_CONFIG_REQ, + EVT_MENU( wxID_PREFERENCES, CVPCB_MAINFRAME::ConfigCvpcb ) EVT_MENU( ID_CONFIG_SAVE, CVPCB_MAINFRAME::Update_Config ) diff --git a/cvpcb/cvpcb.cpp b/cvpcb/cvpcb.cpp index 25034f39a2..9239c2c841 100644 --- a/cvpcb/cvpcb.cpp +++ b/cvpcb/cvpcb.cpp @@ -83,14 +83,6 @@ IMPLEMENT_APP( WinEDA_App ) bool WinEDA_App::OnInit() { - /* WXMAC application specific */ -#ifdef __WXMAC__ -// wxApp::SetExitOnFrameDelete(false); - wxApp::s_macAboutMenuItemId = ID_KICAD_ABOUT; - wxApp::s_macPreferencesMenuItemId = ID_OPTIONS_SETUP; -#endif /* __WXMAC__ */ - - wxFileName filename; wxString message; CVPCB_MAINFRAME* frame = NULL; diff --git a/cvpcb/menubar.cpp b/cvpcb/menubar.cpp index 2c3c578101..d8b5774f1b 100644 --- a/cvpcb/menubar.cpp +++ b/cvpcb/menubar.cpp @@ -1,6 +1,6 @@ -/* - * menubar.cpp - * Build the CvPCB MenuBar +/** + * @file cvpcb/menubar.cpp + * @brief (Re)Create the menubar for cvpcb */ #include "fctsys.h" #include "appl_wxstruct.h" @@ -14,9 +14,12 @@ #include "bitmaps.h" - +/** + * @brief (Re)Create the menubar for the cvpcb mainframe + */ void CVPCB_MAINFRAME::ReCreateMenuBar() { + // Create and try to get the current menubar wxMenuItem* item; wxMenuBar* menuBar = GetMenuBar(); @@ -31,53 +34,72 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() // Recreate all menus: + // Menu File: wxMenu* filesMenu = new wxMenu; - ADD_MENUITEM_WITH_HELP( filesMenu, ID_LOAD_PROJECT, - _( "&Open" ), _( "Open a net list file" ), - open_document_xpm ); - /* Open Recent submenu */ + // Open + ADD_MENUITEM_WITH_HELP( filesMenu, + ID_LOAD_PROJECT, + _( "&Open" ), + _( "Open a net list file" ), + open_document_xpm ); + + // Open Recent submenu wxMenu* openRecentMenu = new wxMenu(); wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu ); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, -1, _( "Open &Recent" ), + ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, -1, + _( "Open &Recent" ), _("Open a recent opened netlist document" ), open_project_xpm ); - - + // Separator filesMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( filesMenu, ID_SAVE_PROJECT, - _( "&Save As..." ), - _( "Save new net list and footprint list files" ), + + // Save as + ADD_MENUITEM_WITH_HELP( filesMenu, + ID_SAVE_PROJECT, + _( "&Save As..." ), + _( "Save new net list and footprint list files" ), save_xpm ); - /* Quit on all platforms except WXMAC */ -#if !defined(__WXMAC__) - + // Separator filesMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( filesMenu, wxID_EXIT, - _( "&Quit" ), _( "Quit CvPCB" ), - exit_xpm ); -#endif /* !defined( __WXMAC__) */ + // Quit + ADD_MENUITEM_WITH_HELP( filesMenu, + wxID_EXIT, + _( "&Quit" ), + _( "Quit CvPCB" ), + exit_xpm ); - // Menu Configuration: - wxMenu* configmenu = new wxMenu; - ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_REQ, _( "&Configuration" ), - _( "Set libraries and library search paths" ), - config_xpm ); + // Menu Preferences: + wxMenu* preferencesMenu = new wxMenu; - wxGetApp().AddMenuLanguageList( configmenu ); + // Options (Preferences on WXMAC) + ADD_MENUITEM_WITH_HELP( preferencesMenu, + wxID_PREFERENCES, +#ifdef __WXMAC__ + _( "&Preferences..." ), +#else + _( "&Options" ), +#endif // __WXMAC__ + _( "Set libraries and library search paths" ), + config_xpm ); - item = new wxMenuItem( configmenu, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, + // Language submenu + wxGetApp().AddMenuLanguageList( preferencesMenu ); + + // Keep open on save + item = new wxMenuItem( preferencesMenu, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, _( "Keep Open On Save" ), _( "Prevent CVPcb from exiting after saving netlist file" ), wxITEM_CHECK ); - configmenu->Append( item ); + preferencesMenu->Append( item ); SETBITMAPS( window_close_xpm ); - configmenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE, + // Separator + preferencesMenu->AppendSeparator(); + ADD_MENUITEM_WITH_HELP( preferencesMenu, ID_CONFIG_SAVE, _( "&Save Project File" ), _( "Save changes to the project file" ), save_setup_xpm ); @@ -85,25 +107,23 @@ void CVPCB_MAINFRAME::ReCreateMenuBar() // Menu Help: wxMenu* helpMenu = new wxMenu; + // Version info AddHelpVersionInfoMenuEntry( helpMenu ); + // Contents ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), _( "Open the cvpcb manual" ), online_help_xpm ); - /* About on all platforms except WXMAC */ -#if !defined(__WXMAC__) - - ADD_MENUITEM_WITH_HELP( helpMenu, ID_KICAD_ABOUT, - _( "&About" ), - _( "About cvpcb schematic to pcb converter" ), + // About + ADD_MENUITEM_WITH_HELP( helpMenu, wxID_ABOUT, + _( "&About CvPCB" ), + _( "About CvPCB schematic to pcb converter" ), info_xpm ); -#endif /* !defined(__WXMAC__) */ - // Create the menubar and append all submenus menuBar->Append( filesMenu, _( "&File" ) ); - menuBar->Append( configmenu, _( "&Preferences" ) ); + menuBar->Append( preferencesMenu, _( "&Preferences" ) ); menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Thaw(); diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index b9eaf54d0c..d262919d73 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -1,7 +1,7 @@ /** * @file eeschema/menubar.cpp - * @brief Create the main menubar for the schematic frame - */ + * @brief (Re)Create the main menubar for the schematic frame + */ #ifdef __GNUG__ #pragma implementation #endif @@ -21,10 +21,11 @@ #include "help_common_strings.h" /** - * @brief Create or update the menubar for the schematic frame + * @brief (Re)Create the menubar for the schematic frame */ void SCH_EDIT_FRAME::ReCreateMenuBar() { + // Create and try to get the current menubar wxString text; wxMenuItem* item; wxMenuBar* menuBar = GetMenuBar(); @@ -40,85 +41,105 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() // Recreate all menus: - // File menu - wxMenu* filesMenu = new wxMenu; + // Menu File: + wxMenu* fileMenu = new wxMenu; // New - item = new wxMenuItem( filesMenu, ID_NEW_PROJECT, _( "&New\tCtrl+N" ), + item = new wxMenuItem( fileMenu, + ID_NEW_PROJECT, + _( "&New\tCtrl+N" ), _( "New schematic project" ) ); - SET_BITMAP( new_xpm ); - filesMenu->Append( item ); + fileMenu->Append( item ); // Open - item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT, _( "&Open\tCtrl+O" ), + item = new wxMenuItem( fileMenu, + ID_LOAD_PROJECT, + _( "&Open\tCtrl+O" ), _( "Open an existing schematic project" ) ); SET_BITMAP( open_document_xpm ); - filesMenu->Append( item ); + fileMenu->Append( item ); // Open Recent submenu wxMenu* openRecentMenu = new wxMenu(); wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu ); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, + ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openRecentMenu, -1, _( "Open &Recent" ), _( "Open a recent opened schematic project" ), open_project_xpm ); + // Separator + fileMenu->AppendSeparator(); - - // Save schematic - filesMenu->AppendSeparator(); - item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT, + // Save schematic project + item = new wxMenuItem( fileMenu, + ID_SAVE_PROJECT, _( "&Save Whole Schematic Project\tCtrl+S" ), _( "Save all sheets in the schematic project" ) ); SET_BITMAP( save_project_xpm ); - filesMenu->Append( item ); + fileMenu->Append( item ); - item = new wxMenuItem( filesMenu, ID_SAVE_ONE_SHEET, _( "Save &Current Sheet Only" ), + // Save current sheet + item = new wxMenuItem( fileMenu, + ID_SAVE_ONE_SHEET, + _( "Save &Current Sheet Only" ), _( "Save only current schematic sheet" ) ); SET_BITMAP( save_xpm ); - filesMenu->Append( item ); + fileMenu->Append( item ); - // Save as... - item = new wxMenuItem( filesMenu, ID_SAVE_ONE_SHEET_AS, + // Save current sheet as + item = new wxMenuItem( fileMenu, + ID_SAVE_ONE_SHEET_AS, _( "Save Current Sheet &as" ), _( "Save current schematic sheet as..." ) ); SET_BITMAP( save_as_xpm ); - filesMenu->Append( item ); + fileMenu->Append( item ); + // Separator + fileMenu->AppendSeparator(); // Print - filesMenu->AppendSeparator(); - item = new wxMenuItem( filesMenu, wxID_PRINT, _( "P&rint" ), _( "Print schematic" ) ); + item = new wxMenuItem( fileMenu, + wxID_PRINT, + _( "P&rint" ), + _( "Print schematic" ) ); SET_BITMAP( print_button ); - filesMenu->Append( item ); + fileMenu->Append( item ); // Plot submenu wxMenu* choice_plot_fmt = new wxMenu; + + // Plot PostScript item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS, _( "Plot PostScript" ), _( "Plot schematic sheet in PostScript format" ) ); SET_BITMAP( plot_PS_xpm ); choice_plot_fmt->Append( item ); - /* Plot HPGL */ - item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_HPGL, _( "Plot HPGL" ), + // Plot HPGL + item = new wxMenuItem( choice_plot_fmt, + ID_GEN_PLOT_HPGL, + _( "Plot HPGL" ), _( "Plot schematic sheet in HPGL format" ) ); SET_BITMAP( plot_HPG_xpm ); choice_plot_fmt->Append( item ); // Plot SVG - item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_SVG, _( "Plot SVG" ), + item = new wxMenuItem( choice_plot_fmt, + ID_GEN_PLOT_SVG, + _( "Plot SVG" ), _( "Plot schematic sheet in SVG format" ) ); SET_BITMAP( plot_xpm ); choice_plot_fmt->Append( item ); // Plot DXF - item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_DXF, _( "Plot DXF" ), + item = new wxMenuItem( choice_plot_fmt, + ID_GEN_PLOT_DXF, + _( "Plot DXF" ), _( "Plot schematic sheet in DXF format" ) ); SET_BITMAP( plot_xpm ); choice_plot_fmt->Append( item ); - // Under windows, one can draw to the clipboard + // Plot to Clipboard (Windows only) #ifdef __WINDOWS__ item = new wxMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD, @@ -126,21 +147,27 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() _( "Export drawings to clipboard" ) ); SET_BITMAP( copy_button ); choice_plot_fmt->Append( item ); -#endif - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, choice_plot_fmt, +#endif // __WINDOWS__ + + // Plot submenu + ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, choice_plot_fmt, ID_GEN_PLOT, _( "&Plot" ), _( "Plot schematic sheet in HPGL, PostScript or SVG format" ), plot_xpm ); - // Quit on all platforms except WXMAC - filesMenu->AppendSeparator(); + // Separator + fileMenu->AppendSeparator(); - item = new wxMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ), _( "Quit EESchema" ) ); + // Quit + item = new wxMenuItem( fileMenu, + wxID_EXIT, + _( "&Quit" ), + _( "Quit EESchema" ) ); SET_BITMAP( exit_xpm ); - filesMenu->Append( item ); + fileMenu->Append( item ); - // Edit menu + // Menu Edit: wxMenu* editMenu = new wxMenu; // Undo @@ -150,44 +177,46 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( undo_xpm ); editMenu->Append( item ); - /* Redo */ + // Redo text = AddHotkeyName( _( "Redo" ), s_Schematic_Hokeys_Descr, HK_REDO ); item = new wxMenuItem( editMenu, wxID_REDO, text, HELP_REDO, wxITEM_NORMAL ); SET_BITMAP( redo_xpm ); editMenu->Append( item ); - /* Delete */ + // Delete editMenu->AppendSeparator(); item = new wxMenuItem( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT, _( "Delete" ), HELP_DELETE_ITEMS, wxITEM_NORMAL ); SET_BITMAP( delete_body_xpm ); editMenu->Append( item ); - /* Separator */ + // Separator editMenu->AppendSeparator(); - /* Find */ + // Find text = AddHotkeyName( _( "&Find" ), s_Schematic_Hokeys_Descr, HK_FIND_ITEM ); item = new wxMenuItem( editMenu, ID_FIND_ITEMS, text, HELP_FIND, wxITEM_NORMAL ); SET_BITMAP( find_xpm ); editMenu->Append( item ); - /* Separator */ + // Separator editMenu->AppendSeparator(); - /* Backannotate */ - item = new wxMenuItem( editMenu, ID_BACKANNO_ITEMS, _( "Backannotate" ), + // Backannotate + item = new wxMenuItem( editMenu, + ID_BACKANNO_ITEMS, + _( "Backannotate" ), _( "Back annotated footprint fields" ), wxITEM_NORMAL ); SET_BITMAP( backanno_xpm ); editMenu->Append( item ); - - // View menu + // Menu View: wxMenu* viewMenu = new wxMenu; - /* Important Note for ZOOM IN and ZOOM OUT commands from menubar: + /** + * Important Note for ZOOM IN and ZOOM OUT commands from menubar: * we cannot add hotkey shortcut here, because the hotkey HK_ZOOM_IN and HK_ZOOM_OUT * events(default = WXK_F1 and WXK_F2) are *NOT* equivalent to this menu command: * zoom in and out from hotkeys are equivalent to the pop up menu zoom @@ -200,42 +229,42 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() * SO WE ADD THE NAME OF THE CORRESPONDING HOTKEY AS A COMMENT, NOT AS A SHORTCUT * using in AddHotkeyName call the option "false" (not a shortcut) */ - /* Zoom in */ + + // Zoom in text = AddHotkeyName( _( "Zoom In" ), s_Schematic_Hokeys_Descr, ID_ZOOM_IN, false ); // add comment, not a shortcut item = new wxMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, wxITEM_NORMAL ); SET_BITMAP( zoom_in_xpm ); viewMenu->Append( item ); - /* Zoom out */ + // Zoom out text = AddHotkeyName( _( "Zoom Out" ), s_Schematic_Hokeys_Descr, ID_ZOOM_OUT, false ); // add comment, not a shortcut item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, wxITEM_NORMAL ); SET_BITMAP( zoom_out_xpm ); viewMenu->Append( item ); - /* Fit on screen */ + // Fit on screen text = AddHotkeyName( _( "Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO ); + item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, wxITEM_NORMAL ); SET_BITMAP( zoom_fit_in_page_xpm ); viewMenu->Append( item ); + // Separator viewMenu->AppendSeparator(); - /* Redraw view */ + // Redraw text = AddHotkeyName( _( "Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW ); item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, wxITEM_NORMAL ); SET_BITMAP( zoom_redraw_xpm ); viewMenu->Append( item ); - - /** - * Place menu - * TODO: Unify the ID names! - */ + // Menu place: + // @todo unify IDs wxMenu* placeMenu = new wxMenu; - /* Component */ + // Component text = AddHotkeyName( _( "Component" ), s_Schematic_Hokeys_Descr, HK_ADD_NEW_COMPONENT, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text, @@ -243,7 +272,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( add_component_xpm ); placeMenu->Append( item ); - /* Power port */ + // Power port text = AddHotkeyName( _( "Power port" ), s_Schematic_Hokeys_Descr, HK_ADD_NEW_POWER, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_PLACE_POWER_BUTT, text, @@ -251,7 +280,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( add_power_xpm ); placeMenu->Append( item ); - /* Wire */ + // Wire text = AddHotkeyName( _( "Wire" ), s_Schematic_Hokeys_Descr, HK_BEGIN_WIRE, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_WIRE_BUTT, text, @@ -259,7 +288,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( add_line_xpm ); placeMenu->Append( item ); - /* Bus */ + // Bus text = AddHotkeyName( _( "Bus" ), s_Schematic_Hokeys_Descr, HK_BEGIN_BUS, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_BUS_BUTT, text, @@ -267,7 +296,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( add_bus_xpm ); placeMenu->Append( item ); - /* Wire to Bus entry */ + // Wire to Bus entry text = AddHotkeyName( _( "Wire to bus entry" ), s_Schematic_Hokeys_Descr, HK_ADD_WIRE_ENTRY, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text, @@ -275,7 +304,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( add_line2bus_xpm ); placeMenu->Append( item ); - /* Bus to Bus entry */ + // Bus to Bus entry text = AddHotkeyName( _( "Bus to bus entry" ), s_Schematic_Hokeys_Descr, HK_ADD_BUS_ENTRY, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text, @@ -283,14 +312,14 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( add_bus2bus_xpm ); placeMenu->Append( item ); - /* No connect flag */ + // No connect flag text = AddHotkeyName( _( "No connect flag" ), s_Schematic_Hokeys_Descr, HK_ADD_NOCONN_FLAG, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG, wxITEM_NORMAL ); SET_BITMAP( noconn_button ); placeMenu->Append( item ); - /* Net name */ + // Net name text = AddHotkeyName( _( "Label" ), s_Schematic_Hokeys_Descr, HK_ADD_LABEL, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_LABEL_BUTT, text, @@ -298,7 +327,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( add_line_label_xpm ); placeMenu->Append( item ); - /* Global label */ + // Global label text = AddHotkeyName( _( "Global label" ), s_Schematic_Hokeys_Descr, HK_ADD_GLABEL, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_GLABEL_BUTT, text, @@ -306,7 +335,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( add_glabel_xpm ); placeMenu->Append( item ); - /* Junction */ + // Junction text = AddHotkeyName( _( "Junction" ), s_Schematic_Hokeys_Descr, HK_ADD_JUNCTION, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_JUNCTION_BUTT, text, @@ -314,10 +343,10 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( add_junction_xpm ); placeMenu->Append( item ); - /* Separator */ + // Separator placeMenu->AppendSeparator(); - /* Hierarchical label */ + // Hierarchical label text = AddHotkeyName( _( "Hierarchical label" ), s_Schematic_Hokeys_Descr, HK_ADD_HLABEL, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_HIERLABEL_BUTT, text, @@ -325,7 +354,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( add_hierarchical_label_xpm ); placeMenu->Append( item ); - /* Hierarchical sheet */ + // Hierarchical sheet text = AddHotkeyName( _( "Hierarchical sheet" ), s_Schematic_Hokeys_Descr, HK_ADD_HIER_SHEET, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, text, @@ -333,22 +362,26 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( add_hierarchical_subsheet_xpm ); placeMenu->Append( item ); - /* Import hierarchical sheet */ - item = new wxMenuItem( placeMenu, ID_IMPORT_HLABEL_BUTT, _( "Import Hierarchical Label" ), + // Import hierarchical sheet + item = new wxMenuItem( placeMenu, + ID_IMPORT_HLABEL_BUTT, + _( "Import Hierarchical Label" ), HELP_IMPORT_SHEETPIN, wxITEM_NORMAL ); SET_BITMAP( import_hierarchical_label_xpm ); placeMenu->Append( item ); - /* Add hierarchical Pin to Sheet */ - item = new wxMenuItem( placeMenu, ID_SHEET_PIN_BUTT, _( "Add Hierarchical Pin to Sheet" ), + // Add hierarchical Pin to Sheet + item = new wxMenuItem( placeMenu, + ID_SHEET_PIN_BUTT, + _( "Add Hierarchical Pin to Sheet" ), HELP_PLACE_SHEETPIN, wxITEM_NORMAL ); SET_BITMAP( add_hierar_pin_xpm ); placeMenu->Append( item ); - /* Separator */ + // Separator placeMenu->AppendSeparator(); - /* Graphic line or polygon */ + // Graphic line or polygon text = AddHotkeyName( _( "Graphic polyline" ), s_Schematic_Hokeys_Descr, HK_ADD_GRAPHIC_POLYLINE, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, text, @@ -356,7 +389,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() SET_BITMAP( add_dashed_line_xpm ); placeMenu->Append( item ); - /* Graphic text */ + // Graphic text text = AddHotkeyName( _( "Graphic text" ), s_Schematic_Hokeys_Descr, HK_ADD_GRAPHIC_TEXT, false ); // add comment, not a shortcut item = new wxMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, text, @@ -365,79 +398,91 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() placeMenu->Append( item ); - // Preferences Menu - wxMenu* configmenu = new wxMenu; + // Menu Preferences: + wxMenu* preferencesMenu = new wxMenu; - /* Library */ - item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ), + // Library + item = new wxMenuItem( preferencesMenu, + ID_CONFIG_REQ, + _( "&Library" ), _( "Library preferences" ) ); SET_BITMAP( library_xpm ); - configmenu->Append( item ); + preferencesMenu->Append( item ); - /* Colors */ - item = new wxMenuItem( configmenu, ID_COLORS_SETUP, _( "&Colors" ), + // Colors + item = new wxMenuItem( preferencesMenu, + ID_COLORS_SETUP, + _( "&Colors" ), _( "Color preferences" ) ); SET_BITMAP( palette_xpm ); - configmenu->Append( item ); - - /* Options */ - item = new wxMenuItem( configmenu, wxID_PREFERENCES, + preferencesMenu->Append( item ); + // Options (Preferences on WXMAC) + item = new wxMenuItem( preferencesMenu, + wxID_PREFERENCES, #ifdef __WXMAC__ _( "&Preferences..." ), #else _( "&Options" ), -#endif - +#endif // __WXMAC__ _( "EESchema preferences" ) ); SET_BITMAP( preference_xpm ); - configmenu->Append( item ); + preferencesMenu->Append( item ); - /* Language submenu */ - wxGetApp().AddMenuLanguageList( configmenu ); + // Language submenu + wxGetApp().AddMenuLanguageList( preferencesMenu ); - /* Hotkey submenu */ - AddHotkeyConfigMenu( configmenu ); + // Hotkey submenu + AddHotkeyConfigMenu( preferencesMenu ); - /* Separator */ - configmenu->AppendSeparator(); + // Separator + preferencesMenu->AppendSeparator(); - /* Save preferences */ - item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save preferences" ), + // Save preferences + item = new wxMenuItem( preferencesMenu, + ID_CONFIG_SAVE, + _( "&Save preferences" ), _( "Save application preferences" ) ); SET_BITMAP( save_setup_xpm ); - configmenu->Append( item ); + preferencesMenu->Append( item ); - /* Read preferences */ - item = new wxMenuItem( configmenu, ID_CONFIG_READ, _( "&Read preferences" ), + // Read preferences + item = new wxMenuItem( preferencesMenu, + ID_CONFIG_READ, + _( "&Read preferences" ), _( "Read application preferences" ) ); SET_BITMAP( read_setup_xpm ); - configmenu->Append( item ); + preferencesMenu->Append( item ); - - // Help Menu + // Help Menu: wxMenu* helpMenu = new wxMenu; + // Version info AddHelpVersionInfoMenuEntry( helpMenu ); - item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), + // Contents + item = new wxMenuItem( helpMenu, + ID_GENERAL_HELP, + _( "&Contents" ), _( "Open the eeschema manual" ) ); SET_BITMAP( online_help_xpm ); helpMenu->Append( item ); - /* About on all platforms except WXMAC */ - item = new wxMenuItem( helpMenu, wxID_ABOUT, _( "&About" ), - _( "About eeschema schematic designer" ) ); + // About EESchema + item = new wxMenuItem( helpMenu, + wxID_ABOUT, + _( "&About EESchema" ), + _( "About EESchema schematic designer" ) ); SET_BITMAP( info_xpm ); helpMenu->Append( item ); // Create the menubar and append all submenus - menuBar->Append( filesMenu, _( "&File" ) ); - menuBar->Append( editMenu, _( "&Edit" ) ); - menuBar->Append( viewMenu, _( "&View" ) ); - menuBar->Append( placeMenu, _( "&Place" ) ); - menuBar->Append( configmenu, _( "&Preferences" ) ); - menuBar->Append( helpMenu, _( "&Help" ) ); + menuBar->Append( fileMenu, _( "&File" ) ); + menuBar->Append( editMenu, _( "&Edit" ) ); + menuBar->Append( viewMenu, _( "&View" ) ); + menuBar->Append( placeMenu, _( "&Place" ) ); + menuBar->Append( preferencesMenu, _( "&Preferences" ) ); + menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Thaw(); diff --git a/eeschema/menubar_libedit.cpp b/eeschema/menubar_libedit.cpp index 69f4fab0e4..e8337c62c4 100644 --- a/eeschema/menubar_libedit.cpp +++ b/eeschema/menubar_libedit.cpp @@ -1,6 +1,6 @@ /** - * @file menubar_libedit.cpp - * @brief Create the main menubar for the component editor frame (LibEdit) + * @file eeschema/menubar_libedit.cpp + * @brief (Re)Create the main menubar for the component editor frame (LibEdit) */ #include "fctsys.h" #include "common.h" @@ -15,10 +15,11 @@ #include "help_common_strings.h" /** - * @brief Create or update the menubar for the Component Editor frame + * @brief (Re)Create the menubar for the component editor frame */ void LIB_EDIT_FRAME::ReCreateMenuBar() { + // Create and try to get the current menubar wxString text; wxMenuItem *item; wxMenuBar *menuBar = GetMenuBar(); @@ -34,48 +35,54 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() // Recreate all menus: - // File menu - wxMenu* filesMenu = new wxMenu; + // Menu File: + wxMenu* fileMenu = new wxMenu; - // Save current lib - item = new wxMenuItem( filesMenu, ID_LIBEDIT_SAVE_CURRENT_LIB, + // Save current library + item = new wxMenuItem( fileMenu, + ID_LIBEDIT_SAVE_CURRENT_LIB, _( "&Save Current Library\tCtrl+S" ), _( "Save the current active library" ) ); - item->SetBitmap( save_xpm ); - filesMenu->Append( item ); + SET_BITMAP( save_xpm ); + fileMenu->Append( item ); - // Save as... - item = new wxMenuItem( filesMenu, ID_LIBEDIT_SAVE_CURRENT_LIB_AS, + // Save current library as... + item = new wxMenuItem( fileMenu, + ID_LIBEDIT_SAVE_CURRENT_LIB_AS, _( "Save Current Library &as" ), _( "Save current active library as..." ) ); - item->SetBitmap( save_as_xpm ); - filesMenu->Append( item ); + SET_BITMAP( save_as_xpm ); + fileMenu->Append( item ); // Separator - filesMenu->AppendSeparator(); + fileMenu->AppendSeparator(); // Export as png file - item = new wxMenuItem( filesMenu, ID_LIBEDIT_GEN_PNG_FILE, _( "&Create PNG File from Screen" ), + item = new wxMenuItem( fileMenu, + ID_LIBEDIT_GEN_PNG_FILE, + _( "&Create PNG File from Screen" ), _( "Create a PNG file from the component displayed on screen" ) ); - item->SetBitmap( plot_xpm ); - filesMenu->Append( item ); + SET_BITMAP( plot_xpm ); + fileMenu->Append( item ); // Export as SVG file - item = new wxMenuItem( filesMenu, ID_LIBEDIT_GEN_SVG_FILE, _( "&Create SVG File" ), + item = new wxMenuItem( fileMenu, + ID_LIBEDIT_GEN_SVG_FILE, + _( "&Create SVG File" ), _( "Create a SVG file from the current loaded component" ) ); - item->SetBitmap( plot_xpm ); - filesMenu->Append( item ); + SET_BITMAP( plot_xpm ); + fileMenu->Append( item ); - /* Quit on all platforms except WXMAC, because else this "breaks" the mac - UI compliance. The Quit item is in a different menu on a mac than - windows or unix machine. - */ -#if !defined(__WXMAC__) - filesMenu->AppendSeparator(); - item = new wxMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ), _( "Quit Library Editor" ) ); - item->SetBitmap( exit_xpm ); - filesMenu->Append( item ); -#endif + // Separator + fileMenu->AppendSeparator(); + + // Quit + item = new wxMenuItem( fileMenu, + wxID_EXIT, + _( "&Quit" ), + _( "Quit Library Editor" ) ); + SET_BITMAP( exit_xpm ); + fileMenu->Append( item ); // Edit menu wxMenu* editMenu = new wxMenu; @@ -83,29 +90,42 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() // Undo text = AddHotkeyName( _( "Undo" ), s_Libedit_Hokeys_Descr, HK_UNDO); - item = new wxMenuItem( editMenu, wxID_UNDO, text, _( "Undo last edition" ), wxITEM_NORMAL ); - item->SetBitmap( undo_xpm ); + item = new wxMenuItem( editMenu, + wxID_UNDO, + text, + _( "Undo last edition" ), + wxITEM_NORMAL ); + SET_BITMAP( undo_xpm ); editMenu->Append( item ); // Redo text = AddHotkeyName( _( "Redo" ), s_Libedit_Hokeys_Descr, HK_REDO); - item = new wxMenuItem( editMenu, wxID_REDO, text, - _( "Redo the last undo command" ), wxITEM_NORMAL ); - item->SetBitmap( redo_xpm ); + item = new wxMenuItem( editMenu, + wxID_REDO, + text, + _( "Redo the last undo command" ), + wxITEM_NORMAL ); + SET_BITMAP( redo_xpm ); editMenu->Append( item ); + // Separator + editMenu->AppendSeparator(); + // Delete - editMenu->AppendSeparator(); - item = new wxMenuItem( editMenu, ID_LIBEDIT_DELETE_ITEM_BUTT, - _( "Delete" ), HELP_DELETE_ITEMS, wxITEM_NORMAL ); - item->SetBitmap( delete_body_xpm ); + item = new wxMenuItem( editMenu, + ID_LIBEDIT_DELETE_ITEM_BUTT, + _( "Delete" ), + HELP_DELETE_ITEMS, + wxITEM_NORMAL ); + SET_BITMAP( delete_body_xpm ); editMenu->Append( item ); - // View menu + // Menu View: wxMenu* viewMenu = new wxMenu; - /* Important Note for ZOOM IN and ZOOM OUT commands from menubar: + /** + * Important Note for ZOOM IN and ZOOM OUT commands from menubar: * we cannot add hotkey info here, because the hotkey HK_ZOOM_IN and HK_ZOOM_OUT * events(default = WXK_F1 and WXK_F2) are *NOT* equivalent to this menu command: * zoom in and out from hotkeys are equivalent to the pop up menu zoom @@ -116,129 +136,157 @@ void LIB_EDIT_FRAME::ReCreateMenuBar() * in others words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators * for Zoom in and Zoom out sub menus */ - /* Zoom in */ + + // Zoom in text =_( "Zoom In" ); item = new wxMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, wxITEM_NORMAL ); - item->SetBitmap( zoom_in_xpm ); + SET_BITMAP( zoom_in_xpm ); viewMenu->Append( item ); // Zoom out text = _( "Zoom Out" ); item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, wxITEM_NORMAL ); - item->SetBitmap( zoom_out_xpm ); + SET_BITMAP( zoom_out_xpm ); viewMenu->Append( item ); // Fit on screen text = AddHotkeyName( _( "Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO ); item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, wxITEM_NORMAL ); - item->SetBitmap( zoom_fit_in_page_xpm ); + SET_BITMAP( zoom_fit_in_page_xpm ); viewMenu->Append( item ); + // Separator viewMenu->AppendSeparator(); - // Redraw view + // Redraw text = AddHotkeyName( _( "Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW ); item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, wxITEM_NORMAL ); - item->SetBitmap( zoom_redraw_xpm ); + SET_BITMAP( zoom_redraw_xpm ); viewMenu->Append( item ); - // Place menu + // Menu Place: wxMenu* placeMenu = new wxMenu; - // place Pin - item = new wxMenuItem( placeMenu, ID_LIBEDIT_PIN_BUTT, _( "&Pin" ), - HELP_ADD_PIN, wxITEM_NORMAL ); - item->SetBitmap( pin_xpm ); + // Pin + item = new wxMenuItem( placeMenu, + ID_LIBEDIT_PIN_BUTT, + _( "&Pin" ), + HELP_ADD_PIN, + wxITEM_NORMAL ); + SET_BITMAP( pin_xpm ); placeMenu->Append( item ); // Graphic text - item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_TEXT_BUTT, + item = new wxMenuItem( placeMenu, + ID_LIBEDIT_BODY_TEXT_BUTT, _( "Graphic text" ), - HELP_ADD_BODYTEXT, wxITEM_NORMAL ); - item->SetBitmap( add_text_xpm ); + HELP_ADD_BODYTEXT, + wxITEM_NORMAL ); + SET_BITMAP( add_text_xpm ); placeMenu->Append( item ); // Graphic rectangle - item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_RECT_BUTT, + item = new wxMenuItem( placeMenu, + ID_LIBEDIT_BODY_RECT_BUTT, _( "Rectangle" ), - HELP_ADD_BODYRECT, wxITEM_NORMAL ); - item->SetBitmap( add_rectangle_xpm ); + HELP_ADD_BODYRECT, + wxITEM_NORMAL ); + SET_BITMAP( add_rectangle_xpm ); placeMenu->Append( item ); // Graphic Circle - item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_CIRCLE_BUTT, + item = new wxMenuItem( placeMenu, + ID_LIBEDIT_BODY_CIRCLE_BUTT, _( "Circle" ), HELP_ADD_BODYCIRCLE, wxITEM_NORMAL ); - item->SetBitmap( add_circle_xpm ); + SET_BITMAP( add_circle_xpm ); placeMenu->Append( item ); // Graphic Arc - item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_ARC_BUTT, + item = new wxMenuItem( placeMenu, + ID_LIBEDIT_BODY_ARC_BUTT, _( "Arc" ), - HELP_ADD_BODYARC, wxITEM_NORMAL ); - item->SetBitmap( add_arc_xpm ); + HELP_ADD_BODYARC, + wxITEM_NORMAL ); + SET_BITMAP( add_arc_xpm ); placeMenu->Append( item ); - // Graphic line or polygon - item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_LINE_BUTT, + // Graphic Line or Polygon + item = new wxMenuItem( placeMenu, + ID_LIBEDIT_BODY_LINE_BUTT, _( "Line or Polygon" ), - HELP_ADD_BODYPOLYGON, wxITEM_NORMAL ); - item->SetBitmap( add_polygon_xpm ); + HELP_ADD_BODYPOLYGON, + wxITEM_NORMAL ); + SET_BITMAP( add_polygon_xpm ); placeMenu->Append( item ); - // Preferences Menu - wxMenu* configmenu = new wxMenu; + // Menu Preferences: + wxMenu* preferencesMenu = new wxMenu; // Library - item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ), + item = new wxMenuItem( preferencesMenu, + ID_CONFIG_REQ, + _( "&Library" ), _( "Library preferences" ) ); - item->SetBitmap( library_xpm ); - configmenu->Append( item ); + SET_BITMAP( library_xpm ); + preferencesMenu->Append( item ); // Colors - item = new wxMenuItem( configmenu, ID_COLORS_SETUP, _( "&Colors" ), + item = new wxMenuItem( preferencesMenu, + ID_COLORS_SETUP, + _( "&Colors" ), _( "Color preferences" ) ); - item->SetBitmap( palette_xpm ); - configmenu->Append( item ); + SET_BITMAP( palette_xpm ); + preferencesMenu->Append( item ); // Language submenu - wxGetApp().AddMenuLanguageList( configmenu ); + wxGetApp().AddMenuLanguageList( preferencesMenu ); // Hotkey submenu - AddHotkeyConfigMenu( configmenu ); + AddHotkeyConfigMenu( preferencesMenu ); + + // Separator + preferencesMenu->AppendSeparator(); // Save preferences - configmenu->AppendSeparator(); - item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save preferences" ), + item = new wxMenuItem( preferencesMenu, + ID_CONFIG_SAVE, + _( "&Save preferences" ), _( "Save application preferences" ) ); - item->SetBitmap( save_setup_xpm ); - configmenu->Append( item ); + SET_BITMAP( save_setup_xpm ); + preferencesMenu->Append( item ); // Read preferences - item = new wxMenuItem( configmenu, ID_CONFIG_READ, _( "&Read preferences" ), + item = new wxMenuItem( preferencesMenu, + ID_CONFIG_READ, + _( "&Read preferences" ), _( "Read application preferences" ) ); - item->SetBitmap( read_setup_xpm ); - configmenu->Append( item ); + SET_BITMAP( read_setup_xpm ); + preferencesMenu->Append( item ); - // Help Menu + // Menu Help: wxMenu* helpMenu = new wxMenu; + // Version info AddHelpVersionInfoMenuEntry( helpMenu ); - item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), + // Contens + item = new wxMenuItem( helpMenu, + ID_GENERAL_HELP, + _( "&Contents" ), _( "Open the eeschema manual" ) ); - item->SetBitmap( online_help_xpm ); + SET_BITMAP( online_help_xpm ); helpMenu->Append( item ); // Create the menubar and append all submenus - menuBar->Append( filesMenu, _( "&File" ) ); + menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( placeMenu, _( "&Place" ) ); - menuBar->Append( configmenu, _( "&Preferences" ) ); + menuBar->Append( preferencesMenu, _( "&Preferences" ) ); menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Thaw(); diff --git a/gerbview/events_called_functions.cpp b/gerbview/events_called_functions.cpp index 19fef84dc6..377f3cda6d 100644 --- a/gerbview/events_called_functions.cpp +++ b/gerbview/events_called_functions.cpp @@ -38,7 +38,7 @@ EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, GERBVIEW_FRAME::OnGbrFileHistory ) EVT_MENU_RANGE( ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_DRILL_FILE9, GERBVIEW_FRAME::OnDrlFileHistory ) -EVT_MENU( ID_EXIT, GERBVIEW_FRAME::Process_Special_Functions ) +EVT_MENU( wxID_EXIT, GERBVIEW_FRAME::OnQuit ) // menu Preferences EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, @@ -46,7 +46,7 @@ EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, GERBVIEW_FRAME::OnSelectOptionToolbar ) -EVT_MENU( ID_GERBVIEW_OPTIONS_SETUP, GERBVIEW_FRAME::InstallGerberOptionsDialog ) +EVT_MENU( wxID_PREFERENCES, GERBVIEW_FRAME::InstallGerberOptionsDialog ) EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, EDA_DRAW_FRAME::SetLanguage ) @@ -61,7 +61,7 @@ EVT_MENU( ID_GERBVIEW_GLOBAL_DELETE, GERBVIEW_FRAME::Process_Special_Functions ) // Menu Help EVT_MENU( ID_GENERAL_HELP, EDA_DRAW_FRAME::GetKicadHelp ) -EVT_MENU( ID_KICAD_ABOUT, EDA_DRAW_FRAME::GetKicadAbout ) +EVT_MENU( wxID_ABOUT, EDA_DRAW_FRAME::GetKicadAbout ) EVT_TOOL( wxID_CUT, GERBVIEW_FRAME::Process_Special_Functions ) EVT_TOOL( wxID_COPY, GERBVIEW_FRAME::Process_Special_Functions ) @@ -147,10 +147,6 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) switch( id ) { - case ID_EXIT: - Close( true ); - break; - case ID_GERBVIEW_GLOBAL_DELETE: Erase_Current_Layer( true ); ClearMsgPanel(); @@ -277,6 +273,10 @@ void GERBVIEW_FRAME::OnSelectDisplayMode( wxCommandEvent& event ) DrawPanel->Refresh(); } +void GERBVIEW_FRAME::OnQuit( wxCommandEvent& event ) +{ + Close( true ); +} /** * Function SetLanguage diff --git a/gerbview/gerbview.cpp b/gerbview/gerbview.cpp index fa9af82f6b..151a35ac96 100644 --- a/gerbview/gerbview.cpp +++ b/gerbview/gerbview.cpp @@ -64,11 +64,6 @@ bool WinEDA_App::OnInit() wxFileName fn; GERBVIEW_FRAME* frame = NULL; -#ifdef __WXMAC__ - wxApp::s_macAboutMenuItemId = ID_KICAD_ABOUT; - wxApp::s_macPreferencesMenuItemId = ID_GERBVIEW_OPTIONS_SETUP; -#endif /* __WXMAC__ */ - InitEDA_Appl( wxT( "GerbView" ), APP_TYPE_GERBVIEW ); if( m_Checker && m_Checker->IsAnotherRunning() ) diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h index 2bd3ad8ff5..4c3432e7d7 100644 --- a/gerbview/gerbview_frame.h +++ b/gerbview/gerbview_frame.h @@ -308,6 +308,16 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title, */ void OnSelectDisplayMode( wxCommandEvent& event ); + /** + * Function OnQuit + * called on request of application quit + */ + void OnQuit( wxCommandEvent& event ); + + /** + * Function OnHotKey + * called when on hotkey trigger + */ void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ); GERBER_DRAW_ITEM* GerberGeneralLocateAndDisplay(); diff --git a/gerbview/menubar.cpp b/gerbview/menubar.cpp index 9a07b23208..0cd37b0516 100644 --- a/gerbview/menubar.cpp +++ b/gerbview/menubar.cpp @@ -1,21 +1,23 @@ -/*************************************/ -/* menubar.cpp: Build the main menu */ -/*************************************/ - +/** + * @file gerbview/menubar.cpp + * @brief (Re)Create the main menubar for GerbView + */ #include "fctsys.h" #include "appl_wxstruct.h" #include "common.h" -//#include "macros.h" #include "gerbview.h" #include "bitmaps.h" #include "gerbview_id.h" #include "hotkeys.h" - +/** + * @brief (Re)Create the menubar for the gerbview frame + */ void GERBVIEW_FRAME::ReCreateMenuBar( void ) { + // Create and try to get the current menubar wxMenuBar* menuBar = GetMenuBar(); if( !menuBar ) @@ -28,115 +30,176 @@ void GERBVIEW_FRAME::ReCreateMenuBar( void ) delete menuBar->Remove( 0 ); // Recreate all menus: - wxMenu* filesMenu = new wxMenu; - ADD_MENUITEM_WITH_HELP( filesMenu, wxID_FILE, _( "Load &Gerber File" ), - _( - "Load a new Gerber file on the current layer. Previous data will be deleted" ), + + // Menu File: + wxMenu* fileMenu = new wxMenu; + + // Load + ADD_MENUITEM_WITH_HELP( fileMenu, + wxID_FILE, + _( "Load &Gerber File" ), + _( "Load a new Gerber file on the current layer. Previous data will be deleted" ), gerber_file_xpm ); - ADD_MENUITEM_WITH_HELP( filesMenu, ID_GERBVIEW_LOAD_DRILL_FILE, + // Excellon + ADD_MENUITEM_WITH_HELP( fileMenu, + ID_GERBVIEW_LOAD_DRILL_FILE, _( "Load &EXCELLON Drill File" ), _( "Load excellon drill file" ), gerbview_drill_file_xpm ); - ADD_MENUITEM_WITH_HELP( filesMenu, ID_GERBVIEW_LOAD_DCODE_FILE, + // Dcodes + ADD_MENUITEM_WITH_HELP( fileMenu, ID_GERBVIEW_LOAD_DCODE_FILE, _( "Load &DCodes" ), _( "Load D-Codes definition file" ), gerber_open_dcode_file_xpm ); - // Open Recent submenus + // Recent gerber files wxMenu* openRecentGbrMenu = new wxMenu(); wxGetApp().m_fileHistory.AddFilesToMenu( openRecentGbrMenu ); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentGbrMenu, - wxID_ANY, _( "Open &Recent Gerber File" ), + ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openRecentGbrMenu, + wxID_ANY, + _( "Open &Recent Gerber File" ), _( "Open a recent opened Gerber file" ), gerber_recent_files_xpm ); + // Recent drill files wxMenu* openRecentDrlMenu = new wxMenu(); m_drillFileHistory.AddFilesToMenu( openRecentDrlMenu ); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentDrlMenu, - wxID_ANY, _( "Open Recent &Drill File" ), + ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openRecentDrlMenu, + wxID_ANY, + _( "Open Recent &Drill File" ), _( "Open a recent opened drill file" ), open_project_xpm ); + // Separator + fileMenu->AppendSeparator(); - filesMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( filesMenu, ID_GERBVIEW_ERASE_ALL, + // Clear all + ADD_MENUITEM_WITH_HELP( fileMenu, + ID_GERBVIEW_ERASE_ALL, _( "&Clear All" ), _( "Clear all layers. All data will be deleted" ), gerbview_clear_layers_xpm ); - filesMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( filesMenu, ID_GERBVIEW_EXPORT_TO_PCBNEW, + // Separator + fileMenu->AppendSeparator(); + + // Export to pcbnew + ADD_MENUITEM_WITH_HELP( fileMenu, + ID_GERBVIEW_EXPORT_TO_PCBNEW, _( "Export to &Pcbnew" ), _( "Export data in pcbnew format" ), export_xpm ); + // Separator + fileMenu->AppendSeparator(); - filesMenu->AppendSeparator(); - - ADD_MENUITEM_WITH_HELP( filesMenu, wxID_PRINT, + // Print + ADD_MENUITEM_WITH_HELP( fileMenu, + wxID_PRINT, _( "P&rint" ), _( "Print gerber" ), print_button ); - filesMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( filesMenu, ID_EXIT, + // Separator + fileMenu->AppendSeparator(); + + // Exit + ADD_MENUITEM_WITH_HELP( fileMenu, + wxID_EXIT, _( "E&xit" ), _( "Quit Gerbview" ), exit_xpm ); - // Configuration and preferences: - wxMenu* configmenu = new wxMenu; - ADD_MENUITEM_WITH_HELP( configmenu, ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, + // Menu for configuration and preferences + wxMenu* configMenu = new wxMenu; + + // Hide layer manager + ADD_MENUITEM_WITH_HELP( configMenu, + ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG, _( "Hide &Layers Manager" ), _( "Show/hide the layers manager toolbar" ), layers_manager_xpm ); - ADD_MENUITEM_WITH_HELP( configmenu, ID_GERBVIEW_OPTIONS_SETUP, + // Options (Preferences on WXMAC) + ADD_MENUITEM_WITH_HELP( configMenu, + wxID_PREFERENCES, +#ifdef __WXMAC__ + _( "Preferences..." ), +#else _( "&Options" ), +#endif // __WXMAC__ _( "Set options to draw items" ), preference_xpm ); - wxGetApp().AddMenuLanguageList( configmenu ); + // Language submenu + wxGetApp().AddMenuLanguageList( configMenu ); - AddHotkeyConfigMenu( configmenu ); + // Hotkey submenu + AddHotkeyConfigMenu( configMenu ); + // Menu miscellaneous + wxMenu* miscellaneousMenu = new wxMenu; - wxMenu* miscellaneous_menu = new wxMenu; - ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_LIST_DCODES, + // List dcodes + ADD_MENUITEM_WITH_HELP( miscellaneousMenu, + ID_GERBVIEW_SHOW_LIST_DCODES, _( "&List DCodes" ), - _( "List and edit D-codes" ), show_dcodenumber_xpm ); - ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_SOURCE, + _( "List and edit D-codes" ), + show_dcodenumber_xpm ); + + // Show source + ADD_MENUITEM_WITH_HELP( miscellaneousMenu, + ID_GERBVIEW_SHOW_SOURCE, _( "&Show Source" ), _( "Show source file for the current layer" ), tools_xpm ); - miscellaneous_menu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_GLOBAL_DELETE, - _( "&Clear Layer" ), - _( "Clear current layer" ), general_deletions_xpm ); + // Separator + miscellaneousMenu->AppendSeparator(); - miscellaneous_menu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR, + // Clear layer + ADD_MENUITEM_WITH_HELP( miscellaneousMenu, + ID_GERBVIEW_GLOBAL_DELETE, + _( "&Clear Layer" ), + _( "Clear current layer" ), + general_deletions_xpm ); + + // Separator + miscellaneousMenu->AppendSeparator(); + + // Text editor + ADD_MENUITEM_WITH_HELP( miscellaneousMenu, + ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR, _( "&Text Editor" ), _( "Select your preferred text editor" ), editor_xpm ); - - // Menu Help: + // Menu Help wxMenu* helpMenu = new wxMenu; + + // Version info AddHelpVersionInfoMenuEntry( helpMenu ); - ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), - _( "Open the gerbview manual" ), help_xpm ); - ADD_MENUITEM_WITH_HELP( helpMenu, ID_KICAD_ABOUT, _( "&About Gerbview" ), + + // Contents + ADD_MENUITEM_WITH_HELP( helpMenu, + ID_GENERAL_HELP, + _( "&Contents" ), + _( "Open the gerbview manual" ), + help_xpm ); + + // About gerbview + ADD_MENUITEM_WITH_HELP( helpMenu, + wxID_ABOUT, + _( "&About GerbView" ), _( "About gerbview gerber and drill viewer" ), online_help_xpm ); - menuBar->Append( filesMenu, _( "&File" ) ); - menuBar->Append( configmenu, _( "&Preferences" ) ); - menuBar->Append( miscellaneous_menu, _( "&Miscellaneous" ) ); - + // Append menus to the menubar + menuBar->Append( fileMenu, _( "&File" ) ); + menuBar->Append( configMenu, _( "&Preferences" ) ); + menuBar->Append( miscellaneousMenu, _( "&Miscellaneous" ) ); menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Thaw(); diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp index 1cf6921926..15e2909329 100644 --- a/kicad/menubar.cpp +++ b/kicad/menubar.cpp @@ -1,6 +1,6 @@ /** * @file kicad/menubar.cpp - * @brief Project manager menubars and toolbars + * @brief (Re)Create the project manager menubar for KiCad */ #include "fctsys.h" #include "appl_wxstruct.h" @@ -70,6 +70,7 @@ END_EVENT_TABLE() */ void WinEDA_MainFrame::ReCreateMenuBar() { + // Create and try to get the current menubar wxMenuItem* item; wxMenuBar* menuBar = GetMenuBar(); @@ -84,72 +85,86 @@ void WinEDA_MainFrame::ReCreateMenuBar() // Recreate all menus: - // Files menu - wxMenu* filesMenu = new wxMenu; + // Menu File: + wxMenu* fileMenu = new wxMenu; // Open - ADD_MENUITEM_WITH_HELP( filesMenu, ID_LOAD_PROJECT, _( "&Open\tCtrl+O" ), + ADD_MENUITEM_WITH_HELP( fileMenu, + ID_LOAD_PROJECT, + _( "&Open\tCtrl+O" ), _( "Open an existing project" ), open_project_xpm ); // Open Recent submenu wxMenu* openRecentMenu = new wxMenu(); wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu ); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, - wxID_ANY, _( "Open &Recent" ), + ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openRecentMenu, + wxID_ANY, + _( "Open &Recent" ), _( "Open a recent opened schematic project" ), open_project_xpm ); // New - ADD_MENUITEM_WITH_HELP( filesMenu, ID_NEW_PROJECT, + ADD_MENUITEM_WITH_HELP( fileMenu, ID_NEW_PROJECT, _( "&New\tCtrl+N" ), _( "Start a new project" ), new_project_xpm ); - /* Save */ - ADD_MENUITEM_WITH_HELP( filesMenu, ID_SAVE_PROJECT, _( "&Save\tCtrl+S" ), + // Save + ADD_MENUITEM_WITH_HELP( fileMenu, + ID_SAVE_PROJECT, + _( "&Save\tCtrl+S" ), _( "Save current project" ), save_project_xpm ); // Archive - filesMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( filesMenu, ID_SAVE_AND_ZIP_FILES, _( "&Archive" ), + fileMenu->AppendSeparator(); + ADD_MENUITEM_WITH_HELP( fileMenu, + ID_SAVE_AND_ZIP_FILES, + _( "&Archive" ), _( "Archive project files in zip archive" ), zip_xpm ); // Unarchive - ADD_MENUITEM_WITH_HELP( filesMenu, ID_READ_ZIP_ARCHIVE, _( "&Unarchive" ), + ADD_MENUITEM_WITH_HELP( fileMenu, + ID_READ_ZIP_ARCHIVE, + _( "&Unarchive" ), _( "Unarchive project files from zip file" ), unzip_xpm ); - // Quit - filesMenu->AppendSeparator(); + // Separator + fileMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( filesMenu, wxID_EXIT, _( "&Quit" ), + // Quit + ADD_MENUITEM_WITH_HELP( fileMenu, + wxID_EXIT, + _( "&Quit" ), _( "Quit KiCad" ), exit_xpm ); - // Browse menu + // Menu Browse: wxMenu* browseMenu = new wxMenu(); // Text editor - ADD_MENUITEM_WITH_HELP( browseMenu, ID_TO_EDITOR, + ADD_MENUITEM_WITH_HELP( browseMenu, + ID_TO_EDITOR, _( "Text E&ditor" ), _( "Launch preferred text editor" ), editor_xpm ); // View file - ADD_MENUITEM_WITH_HELP( browseMenu, ID_BROWSE_AN_SELECT_FILE, + ADD_MENUITEM_WITH_HELP( browseMenu, + ID_BROWSE_AN_SELECT_FILE, _( "&View File" ), _( "View, read or edit file with a text editor" ), browse_files_xpm ); - - // Preferences menu - wxMenu* PreferencesMenu = new wxMenu; + // Menu Preferences: + wxMenu* preferencesMenu = new wxMenu; // Text editor - ADD_MENUITEM_WITH_HELP( PreferencesMenu, ID_SELECT_PREFERED_EDITOR, + ADD_MENUITEM_WITH_HELP( preferencesMenu, + ID_SELECT_PREFERED_EDITOR, _( "&Text Editor" ), _( "Select your preferred text editor" ), editor_xpm ); @@ -191,36 +206,44 @@ void WinEDA_MainFrame::ReCreateMenuBar() _( "Select your favourite PDF viewer used to browse datasheets" ), datasheet_xpm ); - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( PreferencesMenu, - SubMenuPdfBrowserChoice, - -1, _( "PDF Viewer" ), + // PDF viewer submenu + ADD_MENUITEM_WITH_HELP_AND_SUBMENU( preferencesMenu, + SubMenuPdfBrowserChoice, -1, + _( "PDF Viewer" ), _( "PDF viewer preferences" ), datasheet_xpm ); - // Add languages list: - PreferencesMenu->AppendSeparator(); - wxGetApp().AddMenuLanguageList( PreferencesMenu ); + // Language submenu + preferencesMenu->AppendSeparator(); + wxGetApp().AddMenuLanguageList( preferencesMenu ); - // Help menu + // Menu Help: wxMenu* helpMenu = new wxMenu; - + + // Version info AddHelpVersionInfoMenuEntry( helpMenu ); // Contents - ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), + ADD_MENUITEM_WITH_HELP( helpMenu, + ID_GENERAL_HELP, + _( "&Contents" ), _( "Open the kicad manual" ), online_help_xpm ); - // About + // Separator helpMenu->AppendSeparator(); - ADD_MENUITEM_WITH_HELP( helpMenu, wxID_ABOUT, _( "&About" ), + + // About + ADD_MENUITEM_WITH_HELP( helpMenu, + wxID_ABOUT, + _( "&About KiCad" ), _( "About kicad project manager" ), info_xpm ); // Create the menubar and append all submenus - menuBar->Append( filesMenu, _( "&File" ) ); + menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( browseMenu, _( "&Browse" ) ); - menuBar->Append( PreferencesMenu, _( "&Preferences" ) ); + menuBar->Append( preferencesMenu, _( "&Preferences" ) ); menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Thaw(); @@ -238,44 +261,44 @@ void WinEDA_MainFrame::ReCreateMenuBar() */ void WinEDA_MainFrame::RecreateBaseHToolbar() { - /* Check if toolbar is not already created */ + // Check if toolbar is not already created if( m_HToolBar != NULL ) return; - /* Allocate memory for m_HToolBar */ + // Allocate memory for m_HToolBar m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); - /* New */ + // New m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, wxBitmap( new_project_xpm ), _( "Start a new project" ) ); - /* Load */ + // Load m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, wxBitmap( open_project_xpm ), _( "Load existing project" ) ); - /* Save */ + // Save m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, wxBitmap( save_project_xpm ), _( "Save current project" ) ); - /* Separator */ + // Separator m_HToolBar->AddSeparator(); - /* Archive */ + // Archive m_HToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString, wxBitmap( zip_xpm ), _( "Archive all project files" ) ); - /* Separator */ + // Separator m_HToolBar->AddSeparator(); - /* Refresh project tree */ + // Refresh project tree m_HToolBar->AddTool( ID_PROJECT_TREE_REFRESH, wxEmptyString, wxBitmap( reload_xpm ), _( "Refresh project tree" ) ); - /* Create m_HToolBar */ + // Create m_HToolBar m_HToolBar->Realize(); } diff --git a/pcbnew/menubar_modedit.cpp b/pcbnew/menubar_modedit.cpp index 71dbad15cc..20fe3f6388 100644 --- a/pcbnew/menubar_modedit.cpp +++ b/pcbnew/menubar_modedit.cpp @@ -1,7 +1,7 @@ -/*** - * @file menubarmodedit.cpp - * Module editor menu bar. - ***/ +/** + * @file pcbnew/menubar_modedit.cpp + * @brief (Re)Create the main menubar for the module editor + */ #include "fctsys.h" #include "common.h" @@ -13,9 +13,12 @@ #include "protos.h" #include "pcbnew_id.h" -/* Create the menubar for the module editor */ +/** + * @brief (Re)Create the menubar for the module editor frame + */ void WinEDA_ModuleEditFrame::ReCreateMenuBar() { + // Create and try to get the current menubar wxMenuBar* menuBar = GetMenuBar(); wxMenuItem* item; @@ -30,291 +33,297 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar() // Recreate all menus: - /* File menu */ + // Menu File: wxMenu* fileMenu = new wxMenu; - /* New module */ + // New module item = new wxMenuItem( fileMenu, ID_MODEDIT_NEW_MODULE, _( "New Module" ), _( "Create new module" ) ); - item->SetBitmap( new_footprint_xpm ); + SET_BITMAP( new_footprint_xpm ); fileMenu->Append( item ); - /* Open submenu */ + // Open submenu wxMenu* openSubmenu = new wxMenu; - /* from File */ + // from File item = new wxMenuItem( openSubmenu, ID_MODEDIT_IMPORT_PART, - _( "from File (Import)" ), + _( "Load from File (Import)" ), _( "Import a footprint from an existing file" ) ); - item->SetBitmap( import_module_xpm ); + SET_BITMAP( import_module_xpm ); openSubmenu->Append( item ); - /* from Library */ + // from Library item = new wxMenuItem( openSubmenu, ID_MODEDIT_LOAD_MODULE, _( "Load from Library" ), _( "Open a footprint module from a Library" ) ); - item->SetBitmap( module_xpm ); + SET_BITMAP( module_xpm ); openSubmenu->Append( item ); - /* from current Board */ + // from current Board item = new wxMenuItem( openSubmenu, ID_MODEDIT_LOAD_MODULE_FROM_BOARD, _( "Load from current Board" ), _( "Load a footprint module from the current loaded board" ) ); - item->SetBitmap( load_module_board_xpm ); + SET_BITMAP( load_module_board_xpm ); openSubmenu->Append( item ); /* Append openSubmenu to fileMenu */ - ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openSubmenu, -1, _( "&Load Module" ), - _( "Load a footprint module" ), open_document_xpm ); + ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openSubmenu, -1, + _( "&Load Module" ), + _( "Load a footprint module" ), + open_document_xpm ); - /* Save module */ - item = new wxMenuItem( fileMenu, ID_MODEDIT_SAVE_LIBMODULE, + // Save module + item = new wxMenuItem( fileMenu, + ID_MODEDIT_SAVE_LIBMODULE, _( "&Save Module in Current Lib" ), _( "Save Module in working library" ) ); - item->SetBitmap( save_library_xpm ); + SET_BITMAP( save_library_xpm ); fileMenu->Append( item ); + // Save module in new lib item = new wxMenuItem( fileMenu, ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, _( "&Save Module in a New Lib" ), _( "Create new library and save current module" ) ); - item->SetBitmap( new_library_xpm ); + SET_BITMAP( new_library_xpm ); fileMenu->Append( item ); + // Export module item = new wxMenuItem( fileMenu, ID_MODEDIT_EXPORT_PART, _( "&Export module" ), _( "Save the current loaded module to a file" ) ); - item->SetBitmap( export_module_xpm ); + SET_BITMAP( export_module_xpm ); fileMenu->Append( item ); - /* Separator */ + // Separator fileMenu->AppendSeparator(); - /* Print */ - item = new wxMenuItem( fileMenu, wxID_PRINT, _( "&Print\tCtrl+P" ), + // Print + item = new wxMenuItem( fileMenu, + wxID_PRINT, + _( "&Print\tCtrl+P" ), _( "Print the current module" ) ); - item->SetBitmap( plot_xpm ); + SET_BITMAP( plot_xpm ); fileMenu->Append( item ); - /* Separator */ + // Separator fileMenu->AppendSeparator(); - /* Close editor */ - item = new wxMenuItem( fileMenu, wxID_EXIT, _( "Close" ), _( "Close the footprint editor" ) ); - item->SetBitmap( exit_xpm ); + // Close editor + item = new wxMenuItem( fileMenu, + wxID_EXIT, + _( "Close" ), + _( "Close the footprint editor" ) ); + SET_BITMAP( exit_xpm ); fileMenu->Append( item ); - - /* Edit menu */ + // Menu Edit: wxMenu* editMenu = new wxMenu; - /* Undo */ + // Undo item = new wxMenuItem( editMenu, wxID_UNDO, _( "Undo" ), _( "Undo last edit" ) ); - item->SetBitmap( undo_xpm ); + SET_BITMAP( undo_xpm ); editMenu->Append( item ); - /* Redo */ + // Redo item = new wxMenuItem( editMenu, wxID_REDO, _( "Redo" ), _( "Redo the last undo action" ) ); - item->SetBitmap( redo_xpm ); + SET_BITMAP( redo_xpm ); editMenu->Append( item ); - /* Delete items */ + // Delete items item = new wxMenuItem( editMenu, ID_MODEDIT_DELETE_TOOL, _( "Delete" ), _( "Delete objects with the eraser" ) ); - item->SetBitmap( delete_body_xpm ); + SET_BITMAP( delete_body_xpm ); editMenu->Append( item ); - /* Separator */ + // Separator editMenu->AppendSeparator(); - /* Properties */ + // Properties item = new wxMenuItem( editMenu, ID_MODEDIT_EDIT_MODULE_PROPERTIES, _( "Properties" ), _( "Edit module properties" ) ); - item->SetBitmap( module_options_xpm ); + SET_BITMAP( module_options_xpm ); editMenu->Append( item ); - /* Dimensions submenu */ + // Dimensions submenu wxMenu* dimensions_Submenu = new wxMenu; - /* Sizes and Widths */ + // Sizes and Widths item = new wxMenuItem( dimensions_Submenu, ID_PCB_DRAWINGS_WIDTHS_SETUP, _( "Sizes and Widths" ), _( "Adjust width for texts and drawings" ) ); - item->SetBitmap( options_text_xpm ); + SET_BITMAP( options_text_xpm ); dimensions_Submenu->Append( item ); - /* Pad settings */ + // Pad settings item = new wxMenuItem( dimensions_Submenu, ID_MODEDIT_PAD_SETTINGS, _( "Pad settings" ), _( "Edit the settings for new pads" ) ); - item->SetBitmap( options_pad_xpm ); + SET_BITMAP( options_pad_xpm ); dimensions_Submenu->Append( item ); - /* User Grid Size */ + // User grid size item = new wxMenuItem( dimensions_Submenu, ID_PCB_USER_GRID_SETUP, _( "User Grid Size" ), _( "Adjust user grid" ) ); - item->SetBitmap( grid_xpm ); + SET_BITMAP( grid_xpm ); dimensions_Submenu->Append( item ); - /* Append dimensions_Submenu to editMenu */ + // Append dimensions_Submenu to editMenu ADD_MENUITEM_WITH_HELP_AND_SUBMENU( editMenu, dimensions_Submenu, -1, _( "&Dimensions" ), _( "Edit dimensions preferences" ), add_dimension_xpm ); - - /* View menu */ + // View menu wxMenu* viewMenu = new wxMenu; - /* Zoom In */ + // Zoom In item = new wxMenuItem( viewMenu, ID_ZOOM_IN, _( "Zoom In" ), _( "Zoom in on the module" ) ); - item->SetBitmap( zoom_in_xpm ); + SET_BITMAP( zoom_in_xpm ); viewMenu->Append( item ); - /* Zoom Out */ + // Zoom Out item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, _( "Zoom Out" ), _( "Zoom out on the module" ) ); - item->SetBitmap( zoom_out_xpm ); + SET_BITMAP( zoom_out_xpm ); viewMenu->Append( item ); - /* Fit on Screen */ + // Fit on Screen item = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, _( "Fit on Screen" ), _( "Zoom and fit the module in the window" ) ); - item->SetBitmap( zoom_fit_in_page_xpm ); + SET_BITMAP( zoom_fit_in_page_xpm ); viewMenu->Append( item ); - /* Separator */ + // Separator viewMenu->AppendSeparator(); - /* Redraw */ + // Redraw item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, _( "Redraw" ), _( "Redraw the window's viewport" ) ); - item->SetBitmap( zoom_redraw_xpm ); + SET_BITMAP( zoom_redraw_xpm ); viewMenu->Append( item ); - /* 3D Viewer */ + // 3D view item = new wxMenuItem( viewMenu, ID_MENU_PCB_SHOW_3D_FRAME, _( "3D View" ), _( "Show board in 3D viewer" ) ); - item->SetBitmap( show_3d_xpm ); + SET_BITMAP( show_3d_xpm ); viewMenu->Append( item ); - - /* Place menu */ + // Menu Place: wxMenu* placeMenu = new wxMenu; - /* Pad */ + // Pad item = new wxMenuItem( placeMenu, ID_MODEDIT_PAD_TOOL, _( "Pad" ), _( "Add pad" ) ); - item->SetBitmap( pad_xpm ); + SET_BITMAP( pad_xpm ); placeMenu->Append( item ); - /* Separator */ + // Separator placeMenu->AppendSeparator(); - /* Circle */ + // Circle item = new wxMenuItem( placeMenu, ID_MODEDIT_CIRCLE_TOOL, _( "Circle" ), _( "Add graphic circle" ) ); - item->SetBitmap( add_circle_xpm ); + SET_BITMAP( add_circle_xpm ); placeMenu->Append( item ); - /* Line or Polygon */ + // Line or Polygon item = new wxMenuItem( placeMenu, ID_MODEDIT_LINE_TOOL, _( "Line or Polygon" ), _( "Add graphic line or polygon" ) ); - item->SetBitmap( add_polygon_xpm ); + SET_BITMAP( add_polygon_xpm ); placeMenu->Append( item ); - /* Arc */ + // Arc item = new wxMenuItem( placeMenu, ID_MODEDIT_ARC_TOOL, _( "Arc" ), _( "Add graphic arc" ) ); - item->SetBitmap( add_arc_xpm ); + SET_BITMAP( add_arc_xpm ); placeMenu->Append( item ); - /* Text */ + // Text item = new wxMenuItem( placeMenu, ID_MODEDIT_TEXT_TOOL, _( "Text" ), _( "Add graphic text" ) ); - item->SetBitmap( add_text_xpm ); + SET_BITMAP( add_text_xpm ); placeMenu->Append( item ); - /* Anchor */ + // Anchor placeMenu->AppendSeparator(); item = new wxMenuItem( placeMenu, ID_MODEDIT_ANCHOR_TOOL, _( "Anchor" ), _( "Place the footprint module reference anchor" ) ); - item->SetBitmap( anchor_xpm ); + SET_BITMAP( anchor_xpm ); placeMenu->Append( item ); - - /* Help menu */ + // Menu Help: wxMenu* helpMenu = new wxMenu; + // Version info AddHelpVersionInfoMenuEntry( helpMenu ); - /* Contents */ + // Contents item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), _( "Open the PCBNew manual" ) ); - item->SetBitmap( online_help_xpm ); + SET_BITMAP( online_help_xpm ); helpMenu->Append( item ); - /* About PCBNew */ + // About PCBNew item = new wxMenuItem( helpMenu, - ID_KICAD_ABOUT, + wxID_ABOUT, _( "&About PCBNew" ), _( "About PCBNew PCB designer" ) ); - item->SetBitmap( info_xpm ); + SET_BITMAP( info_xpm ); helpMenu->Append( item ); - - /* Append all the menu's to the menubar */ - menuBar->Append( fileMenu, _( "&File" ) ); - menuBar->Append( editMenu, _( "&Edit" ) ); - menuBar->Append( viewMenu, _( "&View" ) ); + // Append menus to the menubar + menuBar->Append( fileMenu, _( "&File" ) ); + menuBar->Append( editMenu, _( "&Edit" ) ); + menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( placeMenu, _( "&Place" ) ); - menuBar->Append( helpMenu, _( "&Help" ) ); + menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Thaw();