Commit 6b39096b authored by Jerry Jacobs's avatar Jerry Jacobs

Cleanup of all menubar code, see CHANGELOG.txt

parent e764474f
...@@ -4,6 +4,13 @@ KiCad ChangeLog 2010 ...@@ -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
......
...@@ -673,3 +673,4 @@ void AddHotkeyConfigMenu( wxMenu* aMenu ) ...@@ -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 );
} }
...@@ -43,9 +43,9 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME ) ...@@ -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 )
......
...@@ -83,14 +83,6 @@ IMPLEMENT_APP( WinEDA_App ) ...@@ -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;
......
/* /**
* 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 @@ ...@@ -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() ...@@ -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
ADD_MENUITEM_WITH_HELP( filesMenu,
ID_LOAD_PROJECT,
_( "&Open" ),
_( "Open a net list file" ),
open_document_xpm ); open_document_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, -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
ADD_MENUITEM_WITH_HELP( filesMenu,
ID_SAVE_PROJECT,
_( "&Save As..." ), _( "&Save As..." ),
_( "Save new net list and footprint list files" ), _( "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" ),
// Options (Preferences on WXMAC)
ADD_MENUITEM_WITH_HELP( preferencesMenu,
wxID_PREFERENCES,
#ifdef __WXMAC__
_( "&Preferences..." ),
#else
_( "&Options" ),
#endif // __WXMAC__
_( "Set libraries and library search paths" ), _( "Set libraries and library search paths" ),
config_xpm ); config_xpm );
wxGetApp().AddMenuLanguageList( configmenu ); // Language submenu
wxGetApp().AddMenuLanguageList( preferencesMenu );
item = new wxMenuItem( configmenu, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, // 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() ...@@ -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();
......
This diff is collapsed.
This diff is collapsed.
...@@ -38,7 +38,7 @@ EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, GERBVIEW_FRAME::OnGbrFileHistory ) ...@@ -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, ...@@ -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 ) ...@@ -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 ) ...@@ -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 ) ...@@ -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
......
...@@ -64,11 +64,6 @@ bool WinEDA_App::OnInit() ...@@ -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() )
......
...@@ -308,6 +308,16 @@ public: GERBVIEW_FRAME( wxWindow* father, const wxString& title, ...@@ -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();
......
/*************************************/ /**
/* 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 ) ...@@ -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
ADD_MENUITEM_WITH_HELP( miscellaneousMenu,
ID_GERBVIEW_GLOBAL_DELETE,
_( "&Clear Layer" ), _( "&Clear Layer" ),
_( "Clear current layer" ), general_deletions_xpm ); _( "Clear current layer" ),
general_deletions_xpm );
miscellaneous_menu->AppendSeparator(); // Separator
ADD_MENUITEM_WITH_HELP( miscellaneous_menu, ID_MENU_GERBVIEW_SELECT_PREFERED_EDITOR, 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();
......
/** /**
* @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() ...@@ -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() ...@@ -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() ...@@ -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() ...@@ -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();
} }
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment