Cleanup of all menubar code, see CHANGELOG.txt

This commit is contained in:
Jerry Jacobs 2011-04-06 15:52:47 +02:00
parent e764474f9d
commit 6b39096b03
13 changed files with 664 additions and 451 deletions

View File

@ -4,6 +4,13 @@ KiCad ChangeLog 2010
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2011-Apr-6, UPDATE Jerry Jacobs <xor.gate.engineering@gmail.com>
================================================================================
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 <xor.gate.engineering@gmail.com> 2011-Apr-4, UPDATE Jerry Jacobs <xor.gate.engineering@gmail.com>
================================================================================ ================================================================================
More native OSX changes, this removes some WXMAC defines replaced by wxID More native OSX changes, this removes some WXMAC defines replaced by wxID

View File

@ -673,3 +673,4 @@ void AddHotkeyConfigMenu( wxMenu* aMenu )
ID_PREFERENCES_HOTKEY_SUBMENU, _( "Hotkeys" ), ID_PREFERENCES_HOTKEY_SUBMENU, _( "Hotkeys" ),
_( "Hotkeys configuration and preferences" ), hotkeys_xpm ); _( "Hotkeys configuration and preferences" ), hotkeys_xpm );
} }

View File

@ -43,9 +43,9 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME )
CVPCB_MAINFRAME::OnQuit ) CVPCB_MAINFRAME::OnQuit )
EVT_MENU( ID_GENERAL_HELP, EVT_MENU( ID_GENERAL_HELP,
CVPCB_MAINFRAME::GetKicadHelp ) CVPCB_MAINFRAME::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, EVT_MENU( wxID_ABOUT,
CVPCB_MAINFRAME::GetKicadAbout ) CVPCB_MAINFRAME::GetKicadAbout )
EVT_MENU( ID_CONFIG_REQ, EVT_MENU( wxID_PREFERENCES,
CVPCB_MAINFRAME::ConfigCvpcb ) CVPCB_MAINFRAME::ConfigCvpcb )
EVT_MENU( ID_CONFIG_SAVE, EVT_MENU( ID_CONFIG_SAVE,
CVPCB_MAINFRAME::Update_Config ) CVPCB_MAINFRAME::Update_Config )

View File

@ -83,14 +83,6 @@ IMPLEMENT_APP( WinEDA_App )
bool WinEDA_App::OnInit() 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; wxFileName filename;
wxString message; wxString message;
CVPCB_MAINFRAME* frame = NULL; CVPCB_MAINFRAME* frame = NULL;

View File

@ -1,6 +1,6 @@
/* /**
* menubar.cpp * @file cvpcb/menubar.cpp
* Build the CvPCB MenuBar * @brief (Re)Create the menubar for cvpcb
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
@ -14,9 +14,12 @@
#include "bitmaps.h" #include "bitmaps.h"
/**
* @brief (Re)Create the menubar for the cvpcb mainframe
*/
void CVPCB_MAINFRAME::ReCreateMenuBar() void CVPCB_MAINFRAME::ReCreateMenuBar()
{ {
// Create and try to get the current menubar
wxMenuItem* item; wxMenuItem* item;
wxMenuBar* menuBar = GetMenuBar(); wxMenuBar* menuBar = GetMenuBar();
@ -31,53 +34,72 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
// Recreate all menus: // Recreate all menus:
// Menu File:
wxMenu* filesMenu = new wxMenu; 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(); wxMenu* openRecentMenu = new wxMenu();
wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu ); 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 a recent opened netlist document" ),
open_project_xpm ); open_project_xpm );
// Separator
filesMenu->AppendSeparator(); filesMenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( filesMenu, ID_SAVE_PROJECT,
_( "&Save As..." ), // Save as
_( "Save new net list and footprint list files" ), ADD_MENUITEM_WITH_HELP( filesMenu,
ID_SAVE_PROJECT,
_( "&Save As..." ),
_( "Save new net list and footprint list files" ),
save_xpm ); save_xpm );
/* Quit on all platforms except WXMAC */ // Separator
#if !defined(__WXMAC__)
filesMenu->AppendSeparator(); 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: // Menu Preferences:
wxMenu* configmenu = new wxMenu; wxMenu* preferencesMenu = new wxMenu;
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_REQ, _( "&Configuration" ),
_( "Set libraries and library search paths" ),
config_xpm );
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" ), _( "Keep Open On Save" ),
_( "Prevent CVPcb from exiting after saving netlist file" ), _( "Prevent CVPcb from exiting after saving netlist file" ),
wxITEM_CHECK ); wxITEM_CHECK );
configmenu->Append( item ); preferencesMenu->Append( item );
SETBITMAPS( window_close_xpm ); SETBITMAPS( window_close_xpm );
configmenu->AppendSeparator(); // Separator
ADD_MENUITEM_WITH_HELP( configmenu, ID_CONFIG_SAVE, preferencesMenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( preferencesMenu, ID_CONFIG_SAVE,
_( "&Save Project File" ), _( "&Save Project File" ),
_( "Save changes to the project file" ), _( "Save changes to the project file" ),
save_setup_xpm ); save_setup_xpm );
@ -85,25 +107,23 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
// Menu Help: // Menu Help:
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
// Version info
AddHelpVersionInfoMenuEntry( helpMenu ); AddHelpVersionInfoMenuEntry( helpMenu );
// Contents
ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the cvpcb manual" ), _( "Open the cvpcb manual" ),
online_help_xpm ); online_help_xpm );
/* About on all platforms except WXMAC */ // About
#if !defined(__WXMAC__) ADD_MENUITEM_WITH_HELP( helpMenu, wxID_ABOUT,
_( "&About CvPCB" ),
ADD_MENUITEM_WITH_HELP( helpMenu, ID_KICAD_ABOUT, _( "About CvPCB schematic to pcb converter" ),
_( "&About" ),
_( "About cvpcb schematic to pcb converter" ),
info_xpm ); info_xpm );
#endif /* !defined(__WXMAC__) */
// Create the menubar and append all submenus // Create the menubar and append all submenus
menuBar->Append( filesMenu, _( "&File" ) ); menuBar->Append( filesMenu, _( "&File" ) );
menuBar->Append( configmenu, _( "&Preferences" ) ); menuBar->Append( preferencesMenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
menuBar->Thaw(); menuBar->Thaw();

View File

@ -1,7 +1,7 @@
/** /**
* @file eeschema/menubar.cpp * @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__ #ifdef __GNUG__
#pragma implementation #pragma implementation
#endif #endif
@ -21,10 +21,11 @@
#include "help_common_strings.h" #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() void SCH_EDIT_FRAME::ReCreateMenuBar()
{ {
// Create and try to get the current menubar
wxString text; wxString text;
wxMenuItem* item; wxMenuItem* item;
wxMenuBar* menuBar = GetMenuBar(); wxMenuBar* menuBar = GetMenuBar();
@ -40,85 +41,105 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Recreate all menus: // Recreate all menus:
// File menu // Menu File:
wxMenu* filesMenu = new wxMenu; wxMenu* fileMenu = new wxMenu;
// New // New
item = new wxMenuItem( filesMenu, ID_NEW_PROJECT, _( "&New\tCtrl+N" ), item = new wxMenuItem( fileMenu,
ID_NEW_PROJECT,
_( "&New\tCtrl+N" ),
_( "New schematic project" ) ); _( "New schematic project" ) );
SET_BITMAP( new_xpm ); SET_BITMAP( new_xpm );
filesMenu->Append( item ); fileMenu->Append( item );
// Open // 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" ) ); _( "Open an existing schematic project" ) );
SET_BITMAP( open_document_xpm ); SET_BITMAP( open_document_xpm );
filesMenu->Append( item ); fileMenu->Append( item );
// Open Recent submenu // Open Recent submenu
wxMenu* openRecentMenu = new wxMenu(); wxMenu* openRecentMenu = new wxMenu();
wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu ); wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openRecentMenu,
-1, _( "Open &Recent" ), -1, _( "Open &Recent" ),
_( "Open a recent opened schematic project" ), _( "Open a recent opened schematic project" ),
open_project_xpm ); open_project_xpm );
// Separator
fileMenu->AppendSeparator();
// Save schematic project
// Save schematic item = new wxMenuItem( fileMenu,
filesMenu->AppendSeparator(); ID_SAVE_PROJECT,
item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT,
_( "&Save Whole Schematic Project\tCtrl+S" ), _( "&Save Whole Schematic Project\tCtrl+S" ),
_( "Save all sheets in the schematic project" ) ); _( "Save all sheets in the schematic project" ) );
SET_BITMAP( save_project_xpm ); 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" ) ); _( "Save only current schematic sheet" ) );
SET_BITMAP( save_xpm ); SET_BITMAP( save_xpm );
filesMenu->Append( item ); fileMenu->Append( item );
// Save as... // Save current sheet as
item = new wxMenuItem( filesMenu, ID_SAVE_ONE_SHEET_AS, item = new wxMenuItem( fileMenu,
ID_SAVE_ONE_SHEET_AS,
_( "Save Current Sheet &as" ), _( "Save Current Sheet &as" ),
_( "Save current schematic sheet as..." ) ); _( "Save current schematic sheet as..." ) );
SET_BITMAP( save_as_xpm ); SET_BITMAP( save_as_xpm );
filesMenu->Append( item ); fileMenu->Append( item );
// Separator
fileMenu->AppendSeparator();
// Print // Print
filesMenu->AppendSeparator(); item = new wxMenuItem( fileMenu,
item = new wxMenuItem( filesMenu, wxID_PRINT, _( "P&rint" ), _( "Print schematic" ) ); wxID_PRINT,
_( "P&rint" ),
_( "Print schematic" ) );
SET_BITMAP( print_button ); SET_BITMAP( print_button );
filesMenu->Append( item ); fileMenu->Append( item );
// Plot submenu // Plot submenu
wxMenu* choice_plot_fmt = new wxMenu; wxMenu* choice_plot_fmt = new wxMenu;
// Plot PostScript
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS, item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS,
_( "Plot PostScript" ), _( "Plot PostScript" ),
_( "Plot schematic sheet in PostScript format" ) ); _( "Plot schematic sheet in PostScript format" ) );
SET_BITMAP( plot_PS_xpm ); SET_BITMAP( plot_PS_xpm );
choice_plot_fmt->Append( item ); choice_plot_fmt->Append( item );
/* Plot HPGL */ // Plot HPGL
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_HPGL, _( "Plot HPGL" ), item = new wxMenuItem( choice_plot_fmt,
ID_GEN_PLOT_HPGL,
_( "Plot HPGL" ),
_( "Plot schematic sheet in HPGL format" ) ); _( "Plot schematic sheet in HPGL format" ) );
SET_BITMAP( plot_HPG_xpm ); SET_BITMAP( plot_HPG_xpm );
choice_plot_fmt->Append( item ); choice_plot_fmt->Append( item );
// Plot SVG // 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" ) ); _( "Plot schematic sheet in SVG format" ) );
SET_BITMAP( plot_xpm ); SET_BITMAP( plot_xpm );
choice_plot_fmt->Append( item ); choice_plot_fmt->Append( item );
// Plot DXF // 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" ) ); _( "Plot schematic sheet in DXF format" ) );
SET_BITMAP( plot_xpm ); SET_BITMAP( plot_xpm );
choice_plot_fmt->Append( item ); choice_plot_fmt->Append( item );
// Under windows, one can draw to the clipboard // Plot to Clipboard (Windows only)
#ifdef __WINDOWS__ #ifdef __WINDOWS__
item = new wxMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD, 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" ) ); _( "Export drawings to clipboard" ) );
SET_BITMAP( copy_button ); SET_BITMAP( copy_button );
choice_plot_fmt->Append( item ); 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" ), ID_GEN_PLOT, _( "&Plot" ),
_( "Plot schematic sheet in HPGL, PostScript or SVG format" ), _( "Plot schematic sheet in HPGL, PostScript or SVG format" ),
plot_xpm ); plot_xpm );
// Quit on all platforms except WXMAC // Separator
filesMenu->AppendSeparator(); 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 ); SET_BITMAP( exit_xpm );
filesMenu->Append( item ); fileMenu->Append( item );
// Edit menu // Menu Edit:
wxMenu* editMenu = new wxMenu; wxMenu* editMenu = new wxMenu;
// Undo // Undo
@ -150,44 +177,46 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( undo_xpm ); SET_BITMAP( undo_xpm );
editMenu->Append( item ); editMenu->Append( item );
/* Redo */ // Redo
text = AddHotkeyName( _( "Redo" ), s_Schematic_Hokeys_Descr, HK_REDO ); text = AddHotkeyName( _( "Redo" ), s_Schematic_Hokeys_Descr, HK_REDO );
item = new wxMenuItem( editMenu, wxID_REDO, text, HELP_REDO, wxITEM_NORMAL ); item = new wxMenuItem( editMenu, wxID_REDO, text, HELP_REDO, wxITEM_NORMAL );
SET_BITMAP( redo_xpm ); SET_BITMAP( redo_xpm );
editMenu->Append( item ); editMenu->Append( item );
/* Delete */ // Delete
editMenu->AppendSeparator(); editMenu->AppendSeparator();
item = new wxMenuItem( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT, item = new wxMenuItem( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT,
_( "Delete" ), HELP_DELETE_ITEMS, wxITEM_NORMAL ); _( "Delete" ), HELP_DELETE_ITEMS, wxITEM_NORMAL );
SET_BITMAP( delete_body_xpm ); SET_BITMAP( delete_body_xpm );
editMenu->Append( item ); editMenu->Append( item );
/* Separator */ // Separator
editMenu->AppendSeparator(); editMenu->AppendSeparator();
/* Find */ // Find
text = AddHotkeyName( _( "&Find" ), s_Schematic_Hokeys_Descr, HK_FIND_ITEM ); text = AddHotkeyName( _( "&Find" ), s_Schematic_Hokeys_Descr, HK_FIND_ITEM );
item = new wxMenuItem( editMenu, ID_FIND_ITEMS, text, HELP_FIND, wxITEM_NORMAL ); item = new wxMenuItem( editMenu, ID_FIND_ITEMS, text, HELP_FIND, wxITEM_NORMAL );
SET_BITMAP( find_xpm ); SET_BITMAP( find_xpm );
editMenu->Append( item ); editMenu->Append( item );
/* Separator */ // Separator
editMenu->AppendSeparator(); editMenu->AppendSeparator();
/* Backannotate */ // Backannotate
item = new wxMenuItem( editMenu, ID_BACKANNO_ITEMS, _( "Backannotate" ), item = new wxMenuItem( editMenu,
ID_BACKANNO_ITEMS,
_( "Backannotate" ),
_( "Back annotated footprint fields" ), _( "Back annotated footprint fields" ),
wxITEM_NORMAL ); wxITEM_NORMAL );
SET_BITMAP( backanno_xpm ); SET_BITMAP( backanno_xpm );
editMenu->Append( item ); editMenu->Append( item );
// Menu View:
// View menu
wxMenu* viewMenu = new wxMenu; 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 * 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: * 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 * 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 * 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) * using in AddHotkeyName call the option "false" (not a shortcut)
*/ */
/* Zoom in */
// Zoom in
text = AddHotkeyName( _( "Zoom In" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Zoom In" ), s_Schematic_Hokeys_Descr,
ID_ZOOM_IN, false ); // add comment, not a shortcut ID_ZOOM_IN, false ); // add comment, not a shortcut
item = new wxMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, wxITEM_NORMAL ); item = new wxMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, wxITEM_NORMAL );
SET_BITMAP( zoom_in_xpm ); SET_BITMAP( zoom_in_xpm );
viewMenu->Append( item ); viewMenu->Append( item );
/* Zoom out */ // Zoom out
text = AddHotkeyName( _( "Zoom Out" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Zoom Out" ), s_Schematic_Hokeys_Descr,
ID_ZOOM_OUT, false ); // add comment, not a shortcut ID_ZOOM_OUT, false ); // add comment, not a shortcut
item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, wxITEM_NORMAL ); item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, wxITEM_NORMAL );
SET_BITMAP( zoom_out_xpm ); SET_BITMAP( zoom_out_xpm );
viewMenu->Append( item ); viewMenu->Append( item );
/* Fit on screen */ // Fit on screen
text = AddHotkeyName( _( "Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO ); 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 = new wxMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, wxITEM_NORMAL );
SET_BITMAP( zoom_fit_in_page_xpm ); SET_BITMAP( zoom_fit_in_page_xpm );
viewMenu->Append( item ); viewMenu->Append( item );
// Separator
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
/* Redraw view */ // Redraw
text = AddHotkeyName( _( "Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_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 = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, wxITEM_NORMAL );
SET_BITMAP( zoom_redraw_xpm ); SET_BITMAP( zoom_redraw_xpm );
viewMenu->Append( item ); viewMenu->Append( item );
// Menu place:
/** // @todo unify IDs
* Place menu
* TODO: Unify the ID names!
*/
wxMenu* placeMenu = new wxMenu; wxMenu* placeMenu = new wxMenu;
/* Component */ // Component
text = AddHotkeyName( _( "Component" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Component" ), s_Schematic_Hokeys_Descr,
HK_ADD_NEW_COMPONENT, false ); // add comment, not a shortcut HK_ADD_NEW_COMPONENT, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text, item = new wxMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text,
@ -243,7 +272,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( add_component_xpm ); SET_BITMAP( add_component_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Power port */ // Power port
text = AddHotkeyName( _( "Power port" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Power port" ), s_Schematic_Hokeys_Descr,
HK_ADD_NEW_POWER, false ); // add comment, not a shortcut HK_ADD_NEW_POWER, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_PLACE_POWER_BUTT, text, item = new wxMenuItem( placeMenu, ID_PLACE_POWER_BUTT, text,
@ -251,7 +280,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( add_power_xpm ); SET_BITMAP( add_power_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Wire */ // Wire
text = AddHotkeyName( _( "Wire" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Wire" ), s_Schematic_Hokeys_Descr,
HK_BEGIN_WIRE, false ); // add comment, not a shortcut HK_BEGIN_WIRE, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_WIRE_BUTT, text, item = new wxMenuItem( placeMenu, ID_WIRE_BUTT, text,
@ -259,7 +288,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( add_line_xpm ); SET_BITMAP( add_line_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Bus */ // Bus
text = AddHotkeyName( _( "Bus" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Bus" ), s_Schematic_Hokeys_Descr,
HK_BEGIN_BUS, false ); // add comment, not a shortcut HK_BEGIN_BUS, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_BUS_BUTT, text, item = new wxMenuItem( placeMenu, ID_BUS_BUTT, text,
@ -267,7 +296,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( add_bus_xpm ); SET_BITMAP( add_bus_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Wire to Bus entry */ // Wire to Bus entry
text = AddHotkeyName( _( "Wire to bus entry" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Wire to bus entry" ), s_Schematic_Hokeys_Descr,
HK_ADD_WIRE_ENTRY, false ); // add comment, not a shortcut HK_ADD_WIRE_ENTRY, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text, item = new wxMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text,
@ -275,7 +304,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( add_line2bus_xpm ); SET_BITMAP( add_line2bus_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Bus to Bus entry */ // Bus to Bus entry
text = AddHotkeyName( _( "Bus to bus entry" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Bus to bus entry" ), s_Schematic_Hokeys_Descr,
HK_ADD_BUS_ENTRY, false ); // add comment, not a shortcut HK_ADD_BUS_ENTRY, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text, item = new wxMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text,
@ -283,14 +312,14 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( add_bus2bus_xpm ); SET_BITMAP( add_bus2bus_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* No connect flag */ // No connect flag
text = AddHotkeyName( _( "No connect flag" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "No connect flag" ), s_Schematic_Hokeys_Descr,
HK_ADD_NOCONN_FLAG, false ); // add comment, not a shortcut HK_ADD_NOCONN_FLAG, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG, wxITEM_NORMAL ); item = new wxMenuItem( placeMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG, wxITEM_NORMAL );
SET_BITMAP( noconn_button ); SET_BITMAP( noconn_button );
placeMenu->Append( item ); placeMenu->Append( item );
/* Net name */ // Net name
text = AddHotkeyName( _( "Label" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Label" ), s_Schematic_Hokeys_Descr,
HK_ADD_LABEL, false ); // add comment, not a shortcut HK_ADD_LABEL, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_LABEL_BUTT, text, item = new wxMenuItem( placeMenu, ID_LABEL_BUTT, text,
@ -298,7 +327,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( add_line_label_xpm ); SET_BITMAP( add_line_label_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Global label */ // Global label
text = AddHotkeyName( _( "Global label" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Global label" ), s_Schematic_Hokeys_Descr,
HK_ADD_GLABEL, false ); // add comment, not a shortcut HK_ADD_GLABEL, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_GLABEL_BUTT, text, item = new wxMenuItem( placeMenu, ID_GLABEL_BUTT, text,
@ -306,7 +335,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( add_glabel_xpm ); SET_BITMAP( add_glabel_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Junction */ // Junction
text = AddHotkeyName( _( "Junction" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Junction" ), s_Schematic_Hokeys_Descr,
HK_ADD_JUNCTION, false ); // add comment, not a shortcut HK_ADD_JUNCTION, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_JUNCTION_BUTT, text, item = new wxMenuItem( placeMenu, ID_JUNCTION_BUTT, text,
@ -314,10 +343,10 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( add_junction_xpm ); SET_BITMAP( add_junction_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Separator */ // Separator
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
/* Hierarchical label */ // Hierarchical label
text = AddHotkeyName( _( "Hierarchical label" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Hierarchical label" ), s_Schematic_Hokeys_Descr,
HK_ADD_HLABEL, false ); // add comment, not a shortcut HK_ADD_HLABEL, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_HIERLABEL_BUTT, text, item = new wxMenuItem( placeMenu, ID_HIERLABEL_BUTT, text,
@ -325,7 +354,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( add_hierarchical_label_xpm ); SET_BITMAP( add_hierarchical_label_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Hierarchical sheet */ // Hierarchical sheet
text = AddHotkeyName( _( "Hierarchical sheet" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Hierarchical sheet" ), s_Schematic_Hokeys_Descr,
HK_ADD_HIER_SHEET, false ); // add comment, not a shortcut HK_ADD_HIER_SHEET, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, text, item = new wxMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, text,
@ -333,22 +362,26 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( add_hierarchical_subsheet_xpm ); SET_BITMAP( add_hierarchical_subsheet_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Import hierarchical sheet */ // Import hierarchical sheet
item = new wxMenuItem( placeMenu, ID_IMPORT_HLABEL_BUTT, _( "Import Hierarchical Label" ), item = new wxMenuItem( placeMenu,
ID_IMPORT_HLABEL_BUTT,
_( "Import Hierarchical Label" ),
HELP_IMPORT_SHEETPIN, wxITEM_NORMAL ); HELP_IMPORT_SHEETPIN, wxITEM_NORMAL );
SET_BITMAP( import_hierarchical_label_xpm ); SET_BITMAP( import_hierarchical_label_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Add hierarchical Pin to Sheet */ // Add hierarchical Pin to Sheet
item = new wxMenuItem( placeMenu, ID_SHEET_PIN_BUTT, _( "Add Hierarchical Pin to Sheet" ), item = new wxMenuItem( placeMenu,
ID_SHEET_PIN_BUTT,
_( "Add Hierarchical Pin to Sheet" ),
HELP_PLACE_SHEETPIN, wxITEM_NORMAL ); HELP_PLACE_SHEETPIN, wxITEM_NORMAL );
SET_BITMAP( add_hierar_pin_xpm ); SET_BITMAP( add_hierar_pin_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Separator */ // Separator
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
/* Graphic line or polygon */ // Graphic line or polygon
text = AddHotkeyName( _( "Graphic polyline" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Graphic polyline" ), s_Schematic_Hokeys_Descr,
HK_ADD_GRAPHIC_POLYLINE, false ); // add comment, not a shortcut HK_ADD_GRAPHIC_POLYLINE, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, text, item = new wxMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, text,
@ -356,7 +389,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
SET_BITMAP( add_dashed_line_xpm ); SET_BITMAP( add_dashed_line_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Graphic text */ // Graphic text
text = AddHotkeyName( _( "Graphic text" ), s_Schematic_Hokeys_Descr, text = AddHotkeyName( _( "Graphic text" ), s_Schematic_Hokeys_Descr,
HK_ADD_GRAPHIC_TEXT, false ); // add comment, not a shortcut HK_ADD_GRAPHIC_TEXT, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, text, item = new wxMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, text,
@ -365,79 +398,91 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
placeMenu->Append( item ); placeMenu->Append( item );
// Preferences Menu // Menu Preferences:
wxMenu* configmenu = new wxMenu; wxMenu* preferencesMenu = new wxMenu;
/* Library */ // Library
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ), item = new wxMenuItem( preferencesMenu,
ID_CONFIG_REQ,
_( "&Library" ),
_( "Library preferences" ) ); _( "Library preferences" ) );
SET_BITMAP( library_xpm ); SET_BITMAP( library_xpm );
configmenu->Append( item ); preferencesMenu->Append( item );
/* Colors */ // Colors
item = new wxMenuItem( configmenu, ID_COLORS_SETUP, _( "&Colors" ), item = new wxMenuItem( preferencesMenu,
ID_COLORS_SETUP,
_( "&Colors" ),
_( "Color preferences" ) ); _( "Color preferences" ) );
SET_BITMAP( palette_xpm ); SET_BITMAP( palette_xpm );
configmenu->Append( item ); preferencesMenu->Append( item );
/* Options */
item = new wxMenuItem( configmenu, wxID_PREFERENCES,
// Options (Preferences on WXMAC)
item = new wxMenuItem( preferencesMenu,
wxID_PREFERENCES,
#ifdef __WXMAC__ #ifdef __WXMAC__
_( "&Preferences..." ), _( "&Preferences..." ),
#else #else
_( "&Options" ), _( "&Options" ),
#endif #endif // __WXMAC__
_( "EESchema preferences" ) ); _( "EESchema preferences" ) );
SET_BITMAP( preference_xpm ); SET_BITMAP( preference_xpm );
configmenu->Append( item ); preferencesMenu->Append( item );
/* Language submenu */ // Language submenu
wxGetApp().AddMenuLanguageList( configmenu ); wxGetApp().AddMenuLanguageList( preferencesMenu );
/* Hotkey submenu */ // Hotkey submenu
AddHotkeyConfigMenu( configmenu ); AddHotkeyConfigMenu( preferencesMenu );
/* Separator */ // Separator
configmenu->AppendSeparator(); preferencesMenu->AppendSeparator();
/* Save preferences */ // Save preferences
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save preferences" ), item = new wxMenuItem( preferencesMenu,
ID_CONFIG_SAVE,
_( "&Save preferences" ),
_( "Save application preferences" ) ); _( "Save application preferences" ) );
SET_BITMAP( save_setup_xpm ); SET_BITMAP( save_setup_xpm );
configmenu->Append( item ); preferencesMenu->Append( item );
/* Read preferences */ // Read preferences
item = new wxMenuItem( configmenu, ID_CONFIG_READ, _( "&Read preferences" ), item = new wxMenuItem( preferencesMenu,
ID_CONFIG_READ,
_( "&Read preferences" ),
_( "Read application preferences" ) ); _( "Read application preferences" ) );
SET_BITMAP( read_setup_xpm ); SET_BITMAP( read_setup_xpm );
configmenu->Append( item ); preferencesMenu->Append( item );
// Help Menu:
// Help Menu
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
// Version info
AddHelpVersionInfoMenuEntry( helpMenu ); AddHelpVersionInfoMenuEntry( helpMenu );
item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), // Contents
item = new wxMenuItem( helpMenu,
ID_GENERAL_HELP,
_( "&Contents" ),
_( "Open the eeschema manual" ) ); _( "Open the eeschema manual" ) );
SET_BITMAP( online_help_xpm ); SET_BITMAP( online_help_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
/* About on all platforms except WXMAC */ // About EESchema
item = new wxMenuItem( helpMenu, wxID_ABOUT, _( "&About" ), item = new wxMenuItem( helpMenu,
_( "About eeschema schematic designer" ) ); wxID_ABOUT,
_( "&About EESchema" ),
_( "About EESchema schematic designer" ) );
SET_BITMAP( info_xpm ); SET_BITMAP( info_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
// Create the menubar and append all submenus // Create the menubar and append all submenus
menuBar->Append( filesMenu, _( "&File" ) ); menuBar->Append( fileMenu, _( "&File" ) );
menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( editMenu, _( "&Edit" ) );
menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( viewMenu, _( "&View" ) );
menuBar->Append( placeMenu, _( "&Place" ) ); menuBar->Append( placeMenu, _( "&Place" ) );
menuBar->Append( configmenu, _( "&Preferences" ) ); menuBar->Append( preferencesMenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
menuBar->Thaw(); menuBar->Thaw();

View File

@ -1,6 +1,6 @@
/** /**
* @file menubar_libedit.cpp * @file eeschema/menubar_libedit.cpp
* @brief Create the main menubar for the component editor frame (LibEdit) * @brief (Re)Create the main menubar for the component editor frame (LibEdit)
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -15,10 +15,11 @@
#include "help_common_strings.h" #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() void LIB_EDIT_FRAME::ReCreateMenuBar()
{ {
// Create and try to get the current menubar
wxString text; wxString text;
wxMenuItem *item; wxMenuItem *item;
wxMenuBar *menuBar = GetMenuBar(); wxMenuBar *menuBar = GetMenuBar();
@ -34,48 +35,54 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
// Recreate all menus: // Recreate all menus:
// File menu // Menu File:
wxMenu* filesMenu = new wxMenu; wxMenu* fileMenu = new wxMenu;
// Save current lib // Save current library
item = new wxMenuItem( filesMenu, ID_LIBEDIT_SAVE_CURRENT_LIB, item = new wxMenuItem( fileMenu,
ID_LIBEDIT_SAVE_CURRENT_LIB,
_( "&Save Current Library\tCtrl+S" ), _( "&Save Current Library\tCtrl+S" ),
_( "Save the current active library" ) ); _( "Save the current active library" ) );
item->SetBitmap( save_xpm ); SET_BITMAP( save_xpm );
filesMenu->Append( item ); fileMenu->Append( item );
// Save as... // Save current library as...
item = new wxMenuItem( filesMenu, ID_LIBEDIT_SAVE_CURRENT_LIB_AS, item = new wxMenuItem( fileMenu,
ID_LIBEDIT_SAVE_CURRENT_LIB_AS,
_( "Save Current Library &as" ), _( "Save Current Library &as" ),
_( "Save current active library as..." ) ); _( "Save current active library as..." ) );
item->SetBitmap( save_as_xpm ); SET_BITMAP( save_as_xpm );
filesMenu->Append( item ); fileMenu->Append( item );
// Separator // Separator
filesMenu->AppendSeparator(); fileMenu->AppendSeparator();
// Export as png file // 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" ) ); _( "Create a PNG file from the component displayed on screen" ) );
item->SetBitmap( plot_xpm ); SET_BITMAP( plot_xpm );
filesMenu->Append( item ); fileMenu->Append( item );
// Export as SVG file // 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" ) ); _( "Create a SVG file from the current loaded component" ) );
item->SetBitmap( plot_xpm ); SET_BITMAP( plot_xpm );
filesMenu->Append( item ); fileMenu->Append( item );
/* Quit on all platforms except WXMAC, because else this "breaks" the mac // Separator
UI compliance. The Quit item is in a different menu on a mac than fileMenu->AppendSeparator();
windows or unix machine.
*/ // Quit
#if !defined(__WXMAC__) item = new wxMenuItem( fileMenu,
filesMenu->AppendSeparator(); wxID_EXIT,
item = new wxMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ), _( "Quit Library Editor" ) ); _( "&Quit" ),
item->SetBitmap( exit_xpm ); _( "Quit Library Editor" ) );
filesMenu->Append( item ); SET_BITMAP( exit_xpm );
#endif fileMenu->Append( item );
// Edit menu // Edit menu
wxMenu* editMenu = new wxMenu; wxMenu* editMenu = new wxMenu;
@ -83,29 +90,42 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
// Undo // Undo
text = AddHotkeyName( _( "Undo" ), s_Libedit_Hokeys_Descr, HK_UNDO); text = AddHotkeyName( _( "Undo" ), s_Libedit_Hokeys_Descr, HK_UNDO);
item = new wxMenuItem( editMenu, wxID_UNDO, text, _( "Undo last edition" ), wxITEM_NORMAL ); item = new wxMenuItem( editMenu,
item->SetBitmap( undo_xpm ); wxID_UNDO,
text,
_( "Undo last edition" ),
wxITEM_NORMAL );
SET_BITMAP( undo_xpm );
editMenu->Append( item ); editMenu->Append( item );
// Redo // Redo
text = AddHotkeyName( _( "Redo" ), s_Libedit_Hokeys_Descr, HK_REDO); text = AddHotkeyName( _( "Redo" ), s_Libedit_Hokeys_Descr, HK_REDO);
item = new wxMenuItem( editMenu, wxID_REDO, text, item = new wxMenuItem( editMenu,
_( "Redo the last undo command" ), wxITEM_NORMAL ); wxID_REDO,
item->SetBitmap( redo_xpm ); text,
_( "Redo the last undo command" ),
wxITEM_NORMAL );
SET_BITMAP( redo_xpm );
editMenu->Append( item ); editMenu->Append( item );
// Separator
editMenu->AppendSeparator();
// Delete // Delete
editMenu->AppendSeparator(); item = new wxMenuItem( editMenu,
item = new wxMenuItem( editMenu, ID_LIBEDIT_DELETE_ITEM_BUTT, ID_LIBEDIT_DELETE_ITEM_BUTT,
_( "Delete" ), HELP_DELETE_ITEMS, wxITEM_NORMAL ); _( "Delete" ),
item->SetBitmap( delete_body_xpm ); HELP_DELETE_ITEMS,
wxITEM_NORMAL );
SET_BITMAP( delete_body_xpm );
editMenu->Append( item ); editMenu->Append( item );
// View menu // Menu View:
wxMenu* viewMenu = new wxMenu; 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 * 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: * 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 * 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 * in others words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators
* for Zoom in and Zoom out sub menus * for Zoom in and Zoom out sub menus
*/ */
/* Zoom in */
// Zoom in
text =_( "Zoom In" ); text =_( "Zoom In" );
item = new wxMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, wxITEM_NORMAL ); 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 ); viewMenu->Append( item );
// Zoom out // Zoom out
text = _( "Zoom Out" ); text = _( "Zoom Out" );
item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, wxITEM_NORMAL ); 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 ); viewMenu->Append( item );
// Fit on screen // Fit on screen
text = AddHotkeyName( _( "Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO ); 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 = 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 ); viewMenu->Append( item );
// Separator
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
// Redraw view // Redraw
text = AddHotkeyName( _( "Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_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 = 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 ); viewMenu->Append( item );
// Place menu // Menu Place:
wxMenu* placeMenu = new wxMenu; wxMenu* placeMenu = new wxMenu;
// place Pin // Pin
item = new wxMenuItem( placeMenu, ID_LIBEDIT_PIN_BUTT, _( "&Pin" ), item = new wxMenuItem( placeMenu,
HELP_ADD_PIN, wxITEM_NORMAL ); ID_LIBEDIT_PIN_BUTT,
item->SetBitmap( pin_xpm ); _( "&Pin" ),
HELP_ADD_PIN,
wxITEM_NORMAL );
SET_BITMAP( pin_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
// Graphic text // Graphic text
item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_TEXT_BUTT, item = new wxMenuItem( placeMenu,
ID_LIBEDIT_BODY_TEXT_BUTT,
_( "Graphic text" ), _( "Graphic text" ),
HELP_ADD_BODYTEXT, wxITEM_NORMAL ); HELP_ADD_BODYTEXT,
item->SetBitmap( add_text_xpm ); wxITEM_NORMAL );
SET_BITMAP( add_text_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
// Graphic rectangle // Graphic rectangle
item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_RECT_BUTT, item = new wxMenuItem( placeMenu,
ID_LIBEDIT_BODY_RECT_BUTT,
_( "Rectangle" ), _( "Rectangle" ),
HELP_ADD_BODYRECT, wxITEM_NORMAL ); HELP_ADD_BODYRECT,
item->SetBitmap( add_rectangle_xpm ); wxITEM_NORMAL );
SET_BITMAP( add_rectangle_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
// Graphic Circle // Graphic Circle
item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_CIRCLE_BUTT, item = new wxMenuItem( placeMenu,
ID_LIBEDIT_BODY_CIRCLE_BUTT,
_( "Circle" ), _( "Circle" ),
HELP_ADD_BODYCIRCLE, HELP_ADD_BODYCIRCLE,
wxITEM_NORMAL ); wxITEM_NORMAL );
item->SetBitmap( add_circle_xpm ); SET_BITMAP( add_circle_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
// Graphic Arc // Graphic Arc
item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_ARC_BUTT, item = new wxMenuItem( placeMenu,
ID_LIBEDIT_BODY_ARC_BUTT,
_( "Arc" ), _( "Arc" ),
HELP_ADD_BODYARC, wxITEM_NORMAL ); HELP_ADD_BODYARC,
item->SetBitmap( add_arc_xpm ); wxITEM_NORMAL );
SET_BITMAP( add_arc_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
// Graphic line or polygon // Graphic Line or Polygon
item = new wxMenuItem( placeMenu, ID_LIBEDIT_BODY_LINE_BUTT, item = new wxMenuItem( placeMenu,
ID_LIBEDIT_BODY_LINE_BUTT,
_( "Line or Polygon" ), _( "Line or Polygon" ),
HELP_ADD_BODYPOLYGON, wxITEM_NORMAL ); HELP_ADD_BODYPOLYGON,
item->SetBitmap( add_polygon_xpm ); wxITEM_NORMAL );
SET_BITMAP( add_polygon_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
// Preferences Menu // Menu Preferences:
wxMenu* configmenu = new wxMenu; wxMenu* preferencesMenu = new wxMenu;
// Library // Library
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ), item = new wxMenuItem( preferencesMenu,
ID_CONFIG_REQ,
_( "&Library" ),
_( "Library preferences" ) ); _( "Library preferences" ) );
item->SetBitmap( library_xpm ); SET_BITMAP( library_xpm );
configmenu->Append( item ); preferencesMenu->Append( item );
// Colors // Colors
item = new wxMenuItem( configmenu, ID_COLORS_SETUP, _( "&Colors" ), item = new wxMenuItem( preferencesMenu,
ID_COLORS_SETUP,
_( "&Colors" ),
_( "Color preferences" ) ); _( "Color preferences" ) );
item->SetBitmap( palette_xpm ); SET_BITMAP( palette_xpm );
configmenu->Append( item ); preferencesMenu->Append( item );
// Language submenu // Language submenu
wxGetApp().AddMenuLanguageList( configmenu ); wxGetApp().AddMenuLanguageList( preferencesMenu );
// Hotkey submenu // Hotkey submenu
AddHotkeyConfigMenu( configmenu ); AddHotkeyConfigMenu( preferencesMenu );
// Separator
preferencesMenu->AppendSeparator();
// Save preferences // Save preferences
configmenu->AppendSeparator(); item = new wxMenuItem( preferencesMenu,
item = new wxMenuItem( configmenu, ID_CONFIG_SAVE, _( "&Save preferences" ), ID_CONFIG_SAVE,
_( "&Save preferences" ),
_( "Save application preferences" ) ); _( "Save application preferences" ) );
item->SetBitmap( save_setup_xpm ); SET_BITMAP( save_setup_xpm );
configmenu->Append( item ); preferencesMenu->Append( item );
// Read preferences // Read preferences
item = new wxMenuItem( configmenu, ID_CONFIG_READ, _( "&Read preferences" ), item = new wxMenuItem( preferencesMenu,
ID_CONFIG_READ,
_( "&Read preferences" ),
_( "Read application preferences" ) ); _( "Read application preferences" ) );
item->SetBitmap( read_setup_xpm ); SET_BITMAP( read_setup_xpm );
configmenu->Append( item ); preferencesMenu->Append( item );
// Help Menu // Menu Help:
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
// Version info
AddHelpVersionInfoMenuEntry( helpMenu ); AddHelpVersionInfoMenuEntry( helpMenu );
item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), // Contens
item = new wxMenuItem( helpMenu,
ID_GENERAL_HELP,
_( "&Contents" ),
_( "Open the eeschema manual" ) ); _( "Open the eeschema manual" ) );
item->SetBitmap( online_help_xpm ); SET_BITMAP( online_help_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
// Create the menubar and append all submenus // Create the menubar and append all submenus
menuBar->Append( filesMenu, _( "&File" ) ); menuBar->Append( fileMenu, _( "&File" ) );
menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( editMenu, _( "&Edit" ) );
menuBar->Append( viewMenu, _( "&View" ) ); menuBar->Append( viewMenu, _( "&View" ) );
menuBar->Append( placeMenu, _( "&Place" ) ); menuBar->Append( placeMenu, _( "&Place" ) );
menuBar->Append( configmenu, _( "&Preferences" ) ); menuBar->Append( preferencesMenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
menuBar->Thaw(); menuBar->Thaw();

View File

@ -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, EVT_MENU_RANGE( ID_GERBVIEW_DRILL_FILE1, ID_GERBVIEW_DRILL_FILE9,
GERBVIEW_FRAME::OnDrlFileHistory ) GERBVIEW_FRAME::OnDrlFileHistory )
EVT_MENU( ID_EXIT, GERBVIEW_FRAME::Process_Special_Functions ) EVT_MENU( wxID_EXIT, GERBVIEW_FRAME::OnQuit )
// menu Preferences // menu Preferences
EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, 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, EVT_MENU( ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
GERBVIEW_FRAME::OnSelectOptionToolbar ) 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 ) 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 // Menu Help
EVT_MENU( ID_GENERAL_HELP, EDA_DRAW_FRAME::GetKicadHelp ) 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_CUT, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( wxID_COPY, 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 ) switch( id )
{ {
case ID_EXIT:
Close( true );
break;
case ID_GERBVIEW_GLOBAL_DELETE: case ID_GERBVIEW_GLOBAL_DELETE:
Erase_Current_Layer( true ); Erase_Current_Layer( true );
ClearMsgPanel(); ClearMsgPanel();
@ -277,6 +273,10 @@ void GERBVIEW_FRAME::OnSelectDisplayMode( wxCommandEvent& event )
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
void GERBVIEW_FRAME::OnQuit( wxCommandEvent& event )
{
Close( true );
}
/** /**
* Function SetLanguage * Function SetLanguage

View File

@ -64,11 +64,6 @@ bool WinEDA_App::OnInit()
wxFileName fn; wxFileName fn;
GERBVIEW_FRAME* frame = NULL; 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 ); InitEDA_Appl( wxT( "GerbView" ), APP_TYPE_GERBVIEW );
if( m_Checker && m_Checker->IsAnotherRunning() ) if( m_Checker && m_Checker->IsAnotherRunning() )

View File

@ -308,6 +308,16 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title,
*/ */
void OnSelectDisplayMode( wxCommandEvent& event ); 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 ); void OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct );
GERBER_DRAW_ITEM* GerberGeneralLocateAndDisplay(); GERBER_DRAW_ITEM* GerberGeneralLocateAndDisplay();

View File

@ -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 "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
//#include "macros.h"
#include "gerbview.h" #include "gerbview.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "gerbview_id.h" #include "gerbview_id.h"
#include "hotkeys.h" #include "hotkeys.h"
/**
* @brief (Re)Create the menubar for the gerbview frame
*/
void GERBVIEW_FRAME::ReCreateMenuBar( void ) void GERBVIEW_FRAME::ReCreateMenuBar( void )
{ {
// Create and try to get the current menubar
wxMenuBar* menuBar = GetMenuBar(); wxMenuBar* menuBar = GetMenuBar();
if( !menuBar ) if( !menuBar )
@ -28,115 +30,176 @@ void GERBVIEW_FRAME::ReCreateMenuBar( void )
delete menuBar->Remove( 0 ); delete menuBar->Remove( 0 );
// Recreate all menus: // Recreate all menus:
wxMenu* filesMenu = new wxMenu;
ADD_MENUITEM_WITH_HELP( filesMenu, wxID_FILE, _( "Load &Gerber File" ), // Menu File:
_( wxMenu* fileMenu = new wxMenu;
"Load a new Gerber file on the current layer. Previous data will be deleted" ),
// 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 ); 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" ),
_( "Load excellon drill file" ), _( "Load excellon drill file" ),
gerbview_drill_file_xpm ); 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 &DCodes" ),
_( "Load D-Codes definition file" ), _( "Load D-Codes definition file" ),
gerber_open_dcode_file_xpm ); gerber_open_dcode_file_xpm );
// Open Recent submenus // Recent gerber files
wxMenu* openRecentGbrMenu = new wxMenu(); wxMenu* openRecentGbrMenu = new wxMenu();
wxGetApp().m_fileHistory.AddFilesToMenu( openRecentGbrMenu ); wxGetApp().m_fileHistory.AddFilesToMenu( openRecentGbrMenu );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentGbrMenu, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openRecentGbrMenu,
wxID_ANY, _( "Open &Recent Gerber File" ), wxID_ANY,
_( "Open &Recent Gerber File" ),
_( "Open a recent opened Gerber file" ), _( "Open a recent opened Gerber file" ),
gerber_recent_files_xpm ); gerber_recent_files_xpm );
// Recent drill files
wxMenu* openRecentDrlMenu = new wxMenu(); wxMenu* openRecentDrlMenu = new wxMenu();
m_drillFileHistory.AddFilesToMenu( openRecentDrlMenu ); m_drillFileHistory.AddFilesToMenu( openRecentDrlMenu );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentDrlMenu, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openRecentDrlMenu,
wxID_ANY, _( "Open Recent &Drill File" ), wxID_ANY,
_( "Open Recent &Drill File" ),
_( "Open a recent opened drill file" ), _( "Open a recent opened drill file" ),
open_project_xpm ); open_project_xpm );
// Separator
fileMenu->AppendSeparator();
filesMenu->AppendSeparator(); // Clear all
ADD_MENUITEM_WITH_HELP( filesMenu, ID_GERBVIEW_ERASE_ALL, ADD_MENUITEM_WITH_HELP( fileMenu,
ID_GERBVIEW_ERASE_ALL,
_( "&Clear All" ), _( "&Clear All" ),
_( "Clear all layers. All data will be deleted" ), _( "Clear all layers. All data will be deleted" ),
gerbview_clear_layers_xpm ); gerbview_clear_layers_xpm );
filesMenu->AppendSeparator(); // Separator
ADD_MENUITEM_WITH_HELP( filesMenu, ID_GERBVIEW_EXPORT_TO_PCBNEW, fileMenu->AppendSeparator();
// Export to pcbnew
ADD_MENUITEM_WITH_HELP( fileMenu,
ID_GERBVIEW_EXPORT_TO_PCBNEW,
_( "Export to &Pcbnew" ), _( "Export to &Pcbnew" ),
_( "Export data in pcbnew format" ), _( "Export data in pcbnew format" ),
export_xpm ); export_xpm );
// Separator
fileMenu->AppendSeparator();
filesMenu->AppendSeparator(); // Print
ADD_MENUITEM_WITH_HELP( fileMenu,
ADD_MENUITEM_WITH_HELP( filesMenu, wxID_PRINT, wxID_PRINT,
_( "P&rint" ), _( "P&rint" ),
_( "Print gerber" ), _( "Print gerber" ),
print_button ); print_button );
filesMenu->AppendSeparator(); // Separator
ADD_MENUITEM_WITH_HELP( filesMenu, ID_EXIT, fileMenu->AppendSeparator();
// Exit
ADD_MENUITEM_WITH_HELP( fileMenu,
wxID_EXIT,
_( "E&xit" ), _( "E&xit" ),
_( "Quit Gerbview" ), _( "Quit Gerbview" ),
exit_xpm ); exit_xpm );
// Configuration and preferences: // Menu for configuration and preferences
wxMenu* configmenu = new wxMenu; wxMenu* configMenu = new wxMenu;
ADD_MENUITEM_WITH_HELP( configmenu, ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
// Hide layer manager
ADD_MENUITEM_WITH_HELP( configMenu,
ID_MENU_GERBVIEW_SHOW_HIDE_LAYERS_MANAGER_DIALOG,
_( "Hide &Layers Manager" ), _( "Hide &Layers Manager" ),
_( "Show/hide the layers manager toolbar" ), _( "Show/hide the layers manager toolbar" ),
layers_manager_xpm ); 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" ), _( "&Options" ),
#endif // __WXMAC__
_( "Set options to draw items" ), _( "Set options to draw items" ),
preference_xpm ); 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; // List dcodes
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_LIST_DCODES, ADD_MENUITEM_WITH_HELP( miscellaneousMenu,
ID_GERBVIEW_SHOW_LIST_DCODES,
_( "&List DCodes" ), _( "&List DCodes" ),
_( "List and edit D-codes" ), show_dcodenumber_xpm ); _( "List and edit D-codes" ),
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_SHOW_SOURCE, show_dcodenumber_xpm );
// Show source
ADD_MENUITEM_WITH_HELP( miscellaneousMenu,
ID_GERBVIEW_SHOW_SOURCE,
_( "&Show Source" ), _( "&Show Source" ),
_( "Show source file for the current layer" ), _( "Show source file for the current layer" ),
tools_xpm ); tools_xpm );
miscellaneous_menu->AppendSeparator(); // Separator
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_GERBVIEW_GLOBAL_DELETE, miscellaneousMenu->AppendSeparator();
_( "&Clear Layer" ),
_( "Clear current layer" ), general_deletions_xpm );
miscellaneous_menu->AppendSeparator(); // Clear layer
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR, 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" ), _( "&Text Editor" ),
_( "Select your preferred text editor" ), _( "Select your preferred text editor" ),
editor_xpm ); editor_xpm );
// Menu Help
// Menu Help:
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
// Version info
AddHelpVersionInfoMenuEntry( helpMenu ); AddHelpVersionInfoMenuEntry( helpMenu );
ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ),
_( "Open the gerbview manual" ), help_xpm ); // Contents
ADD_MENUITEM_WITH_HELP( helpMenu, ID_KICAD_ABOUT, _( "&About Gerbview" ), 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" ), _( "About gerbview gerber and drill viewer" ),
online_help_xpm ); online_help_xpm );
menuBar->Append( filesMenu, _( "&File" ) ); // Append menus to the menubar
menuBar->Append( configmenu, _( "&Preferences" ) ); menuBar->Append( fileMenu, _( "&File" ) );
menuBar->Append( miscellaneous_menu, _( "&Miscellaneous" ) ); menuBar->Append( configMenu, _( "&Preferences" ) );
menuBar->Append( miscellaneousMenu, _( "&Miscellaneous" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
menuBar->Thaw(); menuBar->Thaw();

View File

@ -1,6 +1,6 @@
/** /**
* @file kicad/menubar.cpp * @file kicad/menubar.cpp
* @brief Project manager menubars and toolbars * @brief (Re)Create the project manager menubar for KiCad
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
@ -70,6 +70,7 @@ END_EVENT_TABLE()
*/ */
void WinEDA_MainFrame::ReCreateMenuBar() void WinEDA_MainFrame::ReCreateMenuBar()
{ {
// Create and try to get the current menubar
wxMenuItem* item; wxMenuItem* item;
wxMenuBar* menuBar = GetMenuBar(); wxMenuBar* menuBar = GetMenuBar();
@ -84,72 +85,86 @@ void WinEDA_MainFrame::ReCreateMenuBar()
// Recreate all menus: // Recreate all menus:
// Files menu // Menu File:
wxMenu* filesMenu = new wxMenu; wxMenu* fileMenu = new wxMenu;
// Open // 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 an existing project" ),
open_project_xpm ); open_project_xpm );
// Open Recent submenu // Open Recent submenu
wxMenu* openRecentMenu = new wxMenu(); wxMenu* openRecentMenu = new wxMenu();
wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu ); wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openRecentMenu,
wxID_ANY, _( "Open &Recent" ), wxID_ANY,
_( "Open &Recent" ),
_( "Open a recent opened schematic project" ), _( "Open a recent opened schematic project" ),
open_project_xpm ); open_project_xpm );
// New // New
ADD_MENUITEM_WITH_HELP( filesMenu, ID_NEW_PROJECT, ADD_MENUITEM_WITH_HELP( fileMenu, ID_NEW_PROJECT,
_( "&New\tCtrl+N" ), _( "&New\tCtrl+N" ),
_( "Start a new project" ), _( "Start a new project" ),
new_project_xpm ); new_project_xpm );
/* Save */ // Save
ADD_MENUITEM_WITH_HELP( filesMenu, ID_SAVE_PROJECT, _( "&Save\tCtrl+S" ), ADD_MENUITEM_WITH_HELP( fileMenu,
ID_SAVE_PROJECT,
_( "&Save\tCtrl+S" ),
_( "Save current project" ), _( "Save current project" ),
save_project_xpm ); save_project_xpm );
// Archive // Archive
filesMenu->AppendSeparator(); fileMenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( filesMenu, ID_SAVE_AND_ZIP_FILES, _( "&Archive" ), ADD_MENUITEM_WITH_HELP( fileMenu,
ID_SAVE_AND_ZIP_FILES,
_( "&Archive" ),
_( "Archive project files in zip archive" ), _( "Archive project files in zip archive" ),
zip_xpm ); zip_xpm );
// Unarchive // 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" ), _( "Unarchive project files from zip file" ),
unzip_xpm ); unzip_xpm );
// Quit // Separator
filesMenu->AppendSeparator(); fileMenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( filesMenu, wxID_EXIT, _( "&Quit" ), // Quit
ADD_MENUITEM_WITH_HELP( fileMenu,
wxID_EXIT,
_( "&Quit" ),
_( "Quit KiCad" ), _( "Quit KiCad" ),
exit_xpm ); exit_xpm );
// Browse menu // Menu Browse:
wxMenu* browseMenu = new wxMenu(); wxMenu* browseMenu = new wxMenu();
// Text editor // Text editor
ADD_MENUITEM_WITH_HELP( browseMenu, ID_TO_EDITOR, ADD_MENUITEM_WITH_HELP( browseMenu,
ID_TO_EDITOR,
_( "Text E&ditor" ), _( "Text E&ditor" ),
_( "Launch preferred text editor" ), _( "Launch preferred text editor" ),
editor_xpm ); editor_xpm );
// View file // 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 File" ),
_( "View, read or edit file with a text editor" ), _( "View, read or edit file with a text editor" ),
browse_files_xpm ); browse_files_xpm );
// Menu Preferences:
// Preferences menu wxMenu* preferencesMenu = new wxMenu;
wxMenu* PreferencesMenu = new wxMenu;
// Text editor // Text editor
ADD_MENUITEM_WITH_HELP( PreferencesMenu, ID_SELECT_PREFERED_EDITOR, ADD_MENUITEM_WITH_HELP( preferencesMenu,
ID_SELECT_PREFERED_EDITOR,
_( "&Text Editor" ), _( "&Text Editor" ),
_( "Select your preferred text editor" ), _( "Select your preferred text editor" ),
editor_xpm ); editor_xpm );
@ -191,36 +206,44 @@ void WinEDA_MainFrame::ReCreateMenuBar()
_( "Select your favourite PDF viewer used to browse datasheets" ), _( "Select your favourite PDF viewer used to browse datasheets" ),
datasheet_xpm ); datasheet_xpm );
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( PreferencesMenu, // PDF viewer submenu
SubMenuPdfBrowserChoice, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( preferencesMenu,
-1, _( "PDF Viewer" ), SubMenuPdfBrowserChoice, -1,
_( "PDF Viewer" ),
_( "PDF viewer preferences" ), _( "PDF viewer preferences" ),
datasheet_xpm ); datasheet_xpm );
// Add languages list: // Language submenu
PreferencesMenu->AppendSeparator(); preferencesMenu->AppendSeparator();
wxGetApp().AddMenuLanguageList( PreferencesMenu ); wxGetApp().AddMenuLanguageList( preferencesMenu );
// Help menu // Menu Help:
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
// Version info
AddHelpVersionInfoMenuEntry( helpMenu ); AddHelpVersionInfoMenuEntry( helpMenu );
// Contents // Contents
ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), ADD_MENUITEM_WITH_HELP( helpMenu,
ID_GENERAL_HELP,
_( "&Contents" ),
_( "Open the kicad manual" ), _( "Open the kicad manual" ),
online_help_xpm ); online_help_xpm );
// About // Separator
helpMenu->AppendSeparator(); helpMenu->AppendSeparator();
ADD_MENUITEM_WITH_HELP( helpMenu, wxID_ABOUT, _( "&About" ),
// About
ADD_MENUITEM_WITH_HELP( helpMenu,
wxID_ABOUT,
_( "&About KiCad" ),
_( "About kicad project manager" ), _( "About kicad project manager" ),
info_xpm ); info_xpm );
// Create the menubar and append all submenus // Create the menubar and append all submenus
menuBar->Append( filesMenu, _( "&File" ) ); menuBar->Append( fileMenu, _( "&File" ) );
menuBar->Append( browseMenu, _( "&Browse" ) ); menuBar->Append( browseMenu, _( "&Browse" ) );
menuBar->Append( PreferencesMenu, _( "&Preferences" ) ); menuBar->Append( preferencesMenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
menuBar->Thaw(); menuBar->Thaw();
@ -238,44 +261,44 @@ void WinEDA_MainFrame::ReCreateMenuBar()
*/ */
void WinEDA_MainFrame::RecreateBaseHToolbar() void WinEDA_MainFrame::RecreateBaseHToolbar()
{ {
/* Check if toolbar is not already created */ // Check if toolbar is not already created
if( m_HToolBar != NULL ) if( m_HToolBar != NULL )
return; return;
/* Allocate memory for m_HToolBar */ // Allocate memory for m_HToolBar
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE );
/* New */ // New
m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString,
wxBitmap( new_project_xpm ), wxBitmap( new_project_xpm ),
_( "Start a new project" ) ); _( "Start a new project" ) );
/* Load */ // Load
m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString,
wxBitmap( open_project_xpm ), wxBitmap( open_project_xpm ),
_( "Load existing project" ) ); _( "Load existing project" ) );
/* Save */ // Save
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString,
wxBitmap( save_project_xpm ), wxBitmap( save_project_xpm ),
_( "Save current project" ) ); _( "Save current project" ) );
/* Separator */ // Separator
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
/* Archive */ // Archive
m_HToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString, m_HToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString,
wxBitmap( zip_xpm ), wxBitmap( zip_xpm ),
_( "Archive all project files" ) ); _( "Archive all project files" ) );
/* Separator */ // Separator
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
/* Refresh project tree */ // Refresh project tree
m_HToolBar->AddTool( ID_PROJECT_TREE_REFRESH, wxEmptyString, m_HToolBar->AddTool( ID_PROJECT_TREE_REFRESH, wxEmptyString,
wxBitmap( reload_xpm ), wxBitmap( reload_xpm ),
_( "Refresh project tree" ) ); _( "Refresh project tree" ) );
/* Create m_HToolBar */ // Create m_HToolBar
m_HToolBar->Realize(); m_HToolBar->Realize();
} }

View File

@ -1,7 +1,7 @@
/*** /**
* @file menubarmodedit.cpp * @file pcbnew/menubar_modedit.cpp
* Module editor menu bar. * @brief (Re)Create the main menubar for the module editor
***/ */
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
@ -13,9 +13,12 @@
#include "protos.h" #include "protos.h"
#include "pcbnew_id.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() void WinEDA_ModuleEditFrame::ReCreateMenuBar()
{ {
// Create and try to get the current menubar
wxMenuBar* menuBar = GetMenuBar(); wxMenuBar* menuBar = GetMenuBar();
wxMenuItem* item; wxMenuItem* item;
@ -30,291 +33,297 @@ void WinEDA_ModuleEditFrame::ReCreateMenuBar()
// Recreate all menus: // Recreate all menus:
/* File menu */ // Menu File:
wxMenu* fileMenu = new wxMenu; wxMenu* fileMenu = new wxMenu;
/* New module */ // New module
item = new wxMenuItem( fileMenu, item = new wxMenuItem( fileMenu,
ID_MODEDIT_NEW_MODULE, ID_MODEDIT_NEW_MODULE,
_( "New Module" ), _( "New Module" ),
_( "Create new module" ) ); _( "Create new module" ) );
item->SetBitmap( new_footprint_xpm ); SET_BITMAP( new_footprint_xpm );
fileMenu->Append( item ); fileMenu->Append( item );
/* Open submenu */ // Open submenu
wxMenu* openSubmenu = new wxMenu; wxMenu* openSubmenu = new wxMenu;
/* from File */ // from File
item = new wxMenuItem( openSubmenu, item = new wxMenuItem( openSubmenu,
ID_MODEDIT_IMPORT_PART, ID_MODEDIT_IMPORT_PART,
_( "from File (Import)" ), _( "Load from File (Import)" ),
_( "Import a footprint from an existing file" ) ); _( "Import a footprint from an existing file" ) );
item->SetBitmap( import_module_xpm ); SET_BITMAP( import_module_xpm );
openSubmenu->Append( item ); openSubmenu->Append( item );
/* from Library */ // from Library
item = new wxMenuItem( openSubmenu, item = new wxMenuItem( openSubmenu,
ID_MODEDIT_LOAD_MODULE, ID_MODEDIT_LOAD_MODULE,
_( "Load from Library" ), _( "Load from Library" ),
_( "Open a footprint module from a Library" ) ); _( "Open a footprint module from a Library" ) );
item->SetBitmap( module_xpm ); SET_BITMAP( module_xpm );
openSubmenu->Append( item ); openSubmenu->Append( item );
/* from current Board */ // from current Board
item = new wxMenuItem( openSubmenu, item = new wxMenuItem( openSubmenu,
ID_MODEDIT_LOAD_MODULE_FROM_BOARD, ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
_( "Load from current Board" ), _( "Load from current Board" ),
_( "Load a footprint module from the current loaded 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 ); openSubmenu->Append( item );
/* Append openSubmenu to fileMenu */ /* Append openSubmenu to fileMenu */
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openSubmenu, -1, _( "&Load Module" ), ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, openSubmenu, -1,
_( "Load a footprint module" ), open_document_xpm ); _( "&Load Module" ),
_( "Load a footprint module" ),
open_document_xpm );
/* Save module */ // Save module
item = new wxMenuItem( fileMenu, ID_MODEDIT_SAVE_LIBMODULE, item = new wxMenuItem( fileMenu,
ID_MODEDIT_SAVE_LIBMODULE,
_( "&Save Module in Current Lib" ), _( "&Save Module in Current Lib" ),
_( "Save Module in working library" ) ); _( "Save Module in working library" ) );
item->SetBitmap( save_library_xpm ); SET_BITMAP( save_library_xpm );
fileMenu->Append( item ); fileMenu->Append( item );
// Save module in new lib
item = new wxMenuItem( fileMenu, item = new wxMenuItem( fileMenu,
ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART,
_( "&Save Module in a New Lib" ), _( "&Save Module in a New Lib" ),
_( "Create new library and save current module" ) ); _( "Create new library and save current module" ) );
item->SetBitmap( new_library_xpm ); SET_BITMAP( new_library_xpm );
fileMenu->Append( item ); fileMenu->Append( item );
// Export module
item = new wxMenuItem( fileMenu, item = new wxMenuItem( fileMenu,
ID_MODEDIT_EXPORT_PART, ID_MODEDIT_EXPORT_PART,
_( "&Export module" ), _( "&Export module" ),
_( "Save the current loaded module to a file" ) ); _( "Save the current loaded module to a file" ) );
item->SetBitmap( export_module_xpm ); SET_BITMAP( export_module_xpm );
fileMenu->Append( item ); fileMenu->Append( item );
/* Separator */ // Separator
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
/* Print */ // Print
item = new wxMenuItem( fileMenu, wxID_PRINT, _( "&Print\tCtrl+P" ), item = new wxMenuItem( fileMenu,
wxID_PRINT,
_( "&Print\tCtrl+P" ),
_( "Print the current module" ) ); _( "Print the current module" ) );
item->SetBitmap( plot_xpm ); SET_BITMAP( plot_xpm );
fileMenu->Append( item ); fileMenu->Append( item );
/* Separator */ // Separator
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
/* Close editor */ // Close editor
item = new wxMenuItem( fileMenu, wxID_EXIT, _( "Close" ), _( "Close the footprint editor" ) ); item = new wxMenuItem( fileMenu,
item->SetBitmap( exit_xpm ); wxID_EXIT,
_( "Close" ),
_( "Close the footprint editor" ) );
SET_BITMAP( exit_xpm );
fileMenu->Append( item ); fileMenu->Append( item );
// Menu Edit:
/* Edit menu */
wxMenu* editMenu = new wxMenu; wxMenu* editMenu = new wxMenu;
/* Undo */ // Undo
item = new wxMenuItem( editMenu, item = new wxMenuItem( editMenu,
wxID_UNDO, wxID_UNDO,
_( "Undo" ), _( "Undo" ),
_( "Undo last edit" ) ); _( "Undo last edit" ) );
item->SetBitmap( undo_xpm ); SET_BITMAP( undo_xpm );
editMenu->Append( item ); editMenu->Append( item );
/* Redo */ // Redo
item = new wxMenuItem( editMenu, item = new wxMenuItem( editMenu,
wxID_REDO, wxID_REDO,
_( "Redo" ), _( "Redo" ),
_( "Redo the last undo action" ) ); _( "Redo the last undo action" ) );
item->SetBitmap( redo_xpm ); SET_BITMAP( redo_xpm );
editMenu->Append( item ); editMenu->Append( item );
/* Delete items */ // Delete items
item = new wxMenuItem( editMenu, item = new wxMenuItem( editMenu,
ID_MODEDIT_DELETE_TOOL, ID_MODEDIT_DELETE_TOOL,
_( "Delete" ), _( "Delete" ),
_( "Delete objects with the eraser" ) ); _( "Delete objects with the eraser" ) );
item->SetBitmap( delete_body_xpm ); SET_BITMAP( delete_body_xpm );
editMenu->Append( item ); editMenu->Append( item );
/* Separator */ // Separator
editMenu->AppendSeparator(); editMenu->AppendSeparator();
/* Properties */ // Properties
item = new wxMenuItem( editMenu, item = new wxMenuItem( editMenu,
ID_MODEDIT_EDIT_MODULE_PROPERTIES, ID_MODEDIT_EDIT_MODULE_PROPERTIES,
_( "Properties" ), _( "Properties" ),
_( "Edit module properties" ) ); _( "Edit module properties" ) );
item->SetBitmap( module_options_xpm ); SET_BITMAP( module_options_xpm );
editMenu->Append( item ); editMenu->Append( item );
/* Dimensions submenu */ // Dimensions submenu
wxMenu* dimensions_Submenu = new wxMenu; wxMenu* dimensions_Submenu = new wxMenu;
/* Sizes and Widths */ // Sizes and Widths
item = new wxMenuItem( dimensions_Submenu, item = new wxMenuItem( dimensions_Submenu,
ID_PCB_DRAWINGS_WIDTHS_SETUP, ID_PCB_DRAWINGS_WIDTHS_SETUP,
_( "Sizes and Widths" ), _( "Sizes and Widths" ),
_( "Adjust width for texts and drawings" ) ); _( "Adjust width for texts and drawings" ) );
item->SetBitmap( options_text_xpm ); SET_BITMAP( options_text_xpm );
dimensions_Submenu->Append( item ); dimensions_Submenu->Append( item );
/* Pad settings */ // Pad settings
item = new wxMenuItem( dimensions_Submenu, item = new wxMenuItem( dimensions_Submenu,
ID_MODEDIT_PAD_SETTINGS, ID_MODEDIT_PAD_SETTINGS,
_( "Pad settings" ), _( "Pad settings" ),
_( "Edit the settings for new pads" ) ); _( "Edit the settings for new pads" ) );
item->SetBitmap( options_pad_xpm ); SET_BITMAP( options_pad_xpm );
dimensions_Submenu->Append( item ); dimensions_Submenu->Append( item );
/* User Grid Size */ // User grid size
item = new wxMenuItem( dimensions_Submenu, item = new wxMenuItem( dimensions_Submenu,
ID_PCB_USER_GRID_SETUP, ID_PCB_USER_GRID_SETUP,
_( "User Grid Size" ), _( "User Grid Size" ),
_( "Adjust user grid" ) ); _( "Adjust user grid" ) );
item->SetBitmap( grid_xpm ); SET_BITMAP( grid_xpm );
dimensions_Submenu->Append( item ); dimensions_Submenu->Append( item );
/* Append dimensions_Submenu to editMenu */ // Append dimensions_Submenu to editMenu
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( editMenu, ADD_MENUITEM_WITH_HELP_AND_SUBMENU( editMenu,
dimensions_Submenu, -1, dimensions_Submenu, -1,
_( "&Dimensions" ), _( "&Dimensions" ),
_( "Edit dimensions preferences" ), _( "Edit dimensions preferences" ),
add_dimension_xpm ); add_dimension_xpm );
// View menu
/* View menu */
wxMenu* viewMenu = new wxMenu; wxMenu* viewMenu = new wxMenu;
/* Zoom In */ // Zoom In
item = new wxMenuItem( viewMenu, item = new wxMenuItem( viewMenu,
ID_ZOOM_IN, ID_ZOOM_IN,
_( "Zoom In" ), _( "Zoom In" ),
_( "Zoom in on the module" ) ); _( "Zoom in on the module" ) );
item->SetBitmap( zoom_in_xpm ); SET_BITMAP( zoom_in_xpm );
viewMenu->Append( item ); viewMenu->Append( item );
/* Zoom Out */ // Zoom Out
item = new wxMenuItem( viewMenu, item = new wxMenuItem( viewMenu,
ID_ZOOM_OUT, ID_ZOOM_OUT,
_( "Zoom Out" ), _( "Zoom Out" ),
_( "Zoom out on the module" ) ); _( "Zoom out on the module" ) );
item->SetBitmap( zoom_out_xpm ); SET_BITMAP( zoom_out_xpm );
viewMenu->Append( item ); viewMenu->Append( item );
/* Fit on Screen */ // Fit on Screen
item = new wxMenuItem( viewMenu, item = new wxMenuItem( viewMenu,
ID_ZOOM_PAGE, ID_ZOOM_PAGE,
_( "Fit on Screen" ), _( "Fit on Screen" ),
_( "Zoom and fit the module in the window" ) ); _( "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 ); viewMenu->Append( item );
/* Separator */ // Separator
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
/* Redraw */ // Redraw
item = new wxMenuItem( viewMenu, item = new wxMenuItem( viewMenu,
ID_ZOOM_REDRAW, ID_ZOOM_REDRAW,
_( "Redraw" ), _( "Redraw" ),
_( "Redraw the window's viewport" ) ); _( "Redraw the window's viewport" ) );
item->SetBitmap( zoom_redraw_xpm ); SET_BITMAP( zoom_redraw_xpm );
viewMenu->Append( item ); viewMenu->Append( item );
/* 3D Viewer */ // 3D view
item = new wxMenuItem( viewMenu, item = new wxMenuItem( viewMenu,
ID_MENU_PCB_SHOW_3D_FRAME, ID_MENU_PCB_SHOW_3D_FRAME,
_( "3D View" ), _( "3D View" ),
_( "Show board in 3D viewer" ) ); _( "Show board in 3D viewer" ) );
item->SetBitmap( show_3d_xpm ); SET_BITMAP( show_3d_xpm );
viewMenu->Append( item ); viewMenu->Append( item );
// Menu Place:
/* Place menu */
wxMenu* placeMenu = new wxMenu; wxMenu* placeMenu = new wxMenu;
/* Pad */ // Pad
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_MODEDIT_PAD_TOOL, ID_MODEDIT_PAD_TOOL,
_( "Pad" ), _( "Pad" ),
_( "Add pad" ) ); _( "Add pad" ) );
item->SetBitmap( pad_xpm ); SET_BITMAP( pad_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Separator */ // Separator
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
/* Circle */ // Circle
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_MODEDIT_CIRCLE_TOOL, ID_MODEDIT_CIRCLE_TOOL,
_( "Circle" ), _( "Circle" ),
_( "Add graphic circle" ) ); _( "Add graphic circle" ) );
item->SetBitmap( add_circle_xpm ); SET_BITMAP( add_circle_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Line or Polygon */ // Line or Polygon
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_MODEDIT_LINE_TOOL, ID_MODEDIT_LINE_TOOL,
_( "Line or Polygon" ), _( "Line or Polygon" ),
_( "Add graphic line or polygon" ) ); _( "Add graphic line or polygon" ) );
item->SetBitmap( add_polygon_xpm ); SET_BITMAP( add_polygon_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Arc */ // Arc
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_MODEDIT_ARC_TOOL, ID_MODEDIT_ARC_TOOL,
_( "Arc" ), _( "Arc" ),
_( "Add graphic arc" ) ); _( "Add graphic arc" ) );
item->SetBitmap( add_arc_xpm ); SET_BITMAP( add_arc_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Text */ // Text
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_MODEDIT_TEXT_TOOL, ID_MODEDIT_TEXT_TOOL,
_( "Text" ), _( "Text" ),
_( "Add graphic text" ) ); _( "Add graphic text" ) );
item->SetBitmap( add_text_xpm ); SET_BITMAP( add_text_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
/* Anchor */ // Anchor
placeMenu->AppendSeparator(); placeMenu->AppendSeparator();
item = new wxMenuItem( placeMenu, item = new wxMenuItem( placeMenu,
ID_MODEDIT_ANCHOR_TOOL, ID_MODEDIT_ANCHOR_TOOL,
_( "Anchor" ), _( "Anchor" ),
_( "Place the footprint module reference anchor" ) ); _( "Place the footprint module reference anchor" ) );
item->SetBitmap( anchor_xpm ); SET_BITMAP( anchor_xpm );
placeMenu->Append( item ); placeMenu->Append( item );
// Menu Help:
/* Help menu */
wxMenu* helpMenu = new wxMenu; wxMenu* helpMenu = new wxMenu;
// Version info
AddHelpVersionInfoMenuEntry( helpMenu ); AddHelpVersionInfoMenuEntry( helpMenu );
/* Contents */ // Contents
item = new wxMenuItem( helpMenu, item = new wxMenuItem( helpMenu,
ID_GENERAL_HELP, ID_GENERAL_HELP,
_( "&Contents" ), _( "&Contents" ),
_( "Open the PCBNew manual" ) ); _( "Open the PCBNew manual" ) );
item->SetBitmap( online_help_xpm ); SET_BITMAP( online_help_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
/* About PCBNew */ // About PCBNew
item = new wxMenuItem( helpMenu, item = new wxMenuItem( helpMenu,
ID_KICAD_ABOUT, wxID_ABOUT,
_( "&About PCBNew" ), _( "&About PCBNew" ),
_( "About PCBNew PCB designer" ) ); _( "About PCBNew PCB designer" ) );
item->SetBitmap( info_xpm ); SET_BITMAP( info_xpm );
helpMenu->Append( item ); helpMenu->Append( item );
// Append menus to the menubar
/* Append all the menu's to the menubar */ menuBar->Append( fileMenu, _( "&File" ) );
menuBar->Append( fileMenu, _( "&File" ) ); menuBar->Append( editMenu, _( "&Edit" ) );
menuBar->Append( editMenu, _( "&Edit" ) ); menuBar->Append( viewMenu, _( "&View" ) );
menuBar->Append( viewMenu, _( "&View" ) );
menuBar->Append( placeMenu, _( "&Place" ) ); menuBar->Append( placeMenu, _( "&Place" ) );
menuBar->Append( helpMenu, _( "&Help" ) ); menuBar->Append( helpMenu, _( "&Help" ) );
menuBar->Thaw(); menuBar->Thaw();