|
|
@ -11,56 +11,56 @@ |
|
|
|
|
|
|
|
/* Menubar and toolbar event table */ |
|
|
|
BEGIN_EVENT_TABLE( WinEDA_MainFrame, EDA_BASE_FRAME ) |
|
|
|
/* Window events */ |
|
|
|
EVT_SIZE( WinEDA_MainFrame::OnSize ) |
|
|
|
EVT_CLOSE( WinEDA_MainFrame::OnCloseWindow ) |
|
|
|
|
|
|
|
/* Sash drag events */ |
|
|
|
EVT_SASH_DRAGGED( ID_LEFT_FRAME, WinEDA_MainFrame::OnSashDrag ) |
|
|
|
|
|
|
|
/* Toolbar events */ |
|
|
|
EVT_TOOL( ID_NEW_PROJECT, WinEDA_MainFrame::OnLoadProject ) |
|
|
|
EVT_TOOL( ID_LOAD_PROJECT, WinEDA_MainFrame::OnLoadProject ) |
|
|
|
EVT_TOOL( ID_SAVE_PROJECT, WinEDA_MainFrame::OnSaveProject ) |
|
|
|
EVT_TOOL( ID_SAVE_AND_ZIP_FILES, WinEDA_MainFrame::OnArchiveFiles ) |
|
|
|
|
|
|
|
/* Menu events */ |
|
|
|
EVT_MENU( ID_SAVE_PROJECT, WinEDA_MainFrame::OnSaveProject ) |
|
|
|
EVT_MENU( wxID_EXIT, WinEDA_MainFrame::OnExit ) |
|
|
|
EVT_MENU( ID_TO_EDITOR, WinEDA_MainFrame::OnOpenTextEditor ) |
|
|
|
EVT_MENU( ID_BROWSE_AN_SELECT_FILE, |
|
|
|
WinEDA_MainFrame::OnOpenFileInTextEditor ) |
|
|
|
EVT_MENU( ID_SELECT_PREFERED_EDITOR, |
|
|
|
WinEDA_MainFrame::OnSelectPreferredEditor ) |
|
|
|
EVT_MENU( ID_SELECT_DEFAULT_PDF_BROWSER, |
|
|
|
WinEDA_MainFrame::OnSelectDefaultPdfBrowser ) |
|
|
|
EVT_MENU( ID_SELECT_PREFERED_PDF_BROWSER, |
|
|
|
WinEDA_MainFrame::OnSelectPreferredPdfBrowser ) |
|
|
|
EVT_MENU( ID_SELECT_PREFERED_PDF_BROWSER_NAME, |
|
|
|
WinEDA_MainFrame::OnSelectPreferredPdfBrowser ) |
|
|
|
EVT_MENU( ID_SAVE_AND_ZIP_FILES, WinEDA_MainFrame::OnArchiveFiles ) |
|
|
|
EVT_MENU( ID_READ_ZIP_ARCHIVE, WinEDA_MainFrame::OnUnarchiveFiles ) |
|
|
|
EVT_MENU( ID_PROJECT_TREE_REFRESH, WinEDA_MainFrame::OnRefresh ) |
|
|
|
EVT_MENU( ID_GENERAL_HELP, WinEDA_MainFrame::GetKicadHelp ) |
|
|
|
EVT_MENU( ID_KICAD_ABOUT, WinEDA_MainFrame::GetKicadAbout ) |
|
|
|
|
|
|
|
/* Range menu events */ |
|
|
|
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, |
|
|
|
WinEDA_MainFrame::SetLanguage ) |
|
|
|
|
|
|
|
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_MainFrame::OnFileHistory ) |
|
|
|
|
|
|
|
/* Button events */ |
|
|
|
EVT_BUTTON( ID_TO_PCB, WinEDA_MainFrame::OnRunPcbNew ) |
|
|
|
EVT_BUTTON( ID_TO_CVPCB, WinEDA_MainFrame::OnRunCvpcb ) |
|
|
|
EVT_BUTTON( ID_TO_EESCHEMA, WinEDA_MainFrame::OnRunEeschema ) |
|
|
|
EVT_BUTTON( ID_TO_GERBVIEW, WinEDA_MainFrame::OnRunGerbview ) |
|
|
|
EVT_BUTTON( ID_TO_BITMAP_CONVERTER, WinEDA_MainFrame::OnRunBitmapConverter ) |
|
|
|
|
|
|
|
EVT_UPDATE_UI( ID_SELECT_DEFAULT_PDF_BROWSER, |
|
|
|
WinEDA_MainFrame::OnUpdateDefaultPdfBrowser ) |
|
|
|
EVT_UPDATE_UI( ID_SELECT_PREFERED_PDF_BROWSER, |
|
|
|
WinEDA_MainFrame::OnUpdatePreferredPdfBrowser ) |
|
|
|
/* Window events */ |
|
|
|
EVT_SIZE( WinEDA_MainFrame::OnSize ) |
|
|
|
EVT_CLOSE( WinEDA_MainFrame::OnCloseWindow ) |
|
|
|
|
|
|
|
/* Sash drag events */ |
|
|
|
EVT_SASH_DRAGGED( ID_LEFT_FRAME, WinEDA_MainFrame::OnSashDrag ) |
|
|
|
|
|
|
|
/* Toolbar events */ |
|
|
|
EVT_TOOL( ID_NEW_PROJECT, WinEDA_MainFrame::OnLoadProject ) |
|
|
|
EVT_TOOL( ID_LOAD_PROJECT, WinEDA_MainFrame::OnLoadProject ) |
|
|
|
EVT_TOOL( ID_SAVE_PROJECT, WinEDA_MainFrame::OnSaveProject ) |
|
|
|
EVT_TOOL( ID_SAVE_AND_ZIP_FILES, WinEDA_MainFrame::OnArchiveFiles ) |
|
|
|
|
|
|
|
/* Menu events */ |
|
|
|
EVT_MENU( ID_SAVE_PROJECT, WinEDA_MainFrame::OnSaveProject ) |
|
|
|
EVT_MENU( wxID_EXIT, WinEDA_MainFrame::OnExit ) |
|
|
|
EVT_MENU( ID_TO_EDITOR, WinEDA_MainFrame::OnOpenTextEditor ) |
|
|
|
EVT_MENU( ID_BROWSE_AN_SELECT_FILE, |
|
|
|
WinEDA_MainFrame::OnOpenFileInTextEditor ) |
|
|
|
EVT_MENU( ID_SELECT_PREFERED_EDITOR, |
|
|
|
EDA_BASE_FRAME::OnSelectPreferredEditor ) |
|
|
|
EVT_MENU( ID_SELECT_DEFAULT_PDF_BROWSER, |
|
|
|
WinEDA_MainFrame::OnSelectDefaultPdfBrowser ) |
|
|
|
EVT_MENU( ID_SELECT_PREFERED_PDF_BROWSER, |
|
|
|
WinEDA_MainFrame::OnSelectPreferredPdfBrowser ) |
|
|
|
EVT_MENU( ID_SELECT_PREFERED_PDF_BROWSER_NAME, |
|
|
|
WinEDA_MainFrame::OnSelectPreferredPdfBrowser ) |
|
|
|
EVT_MENU( ID_SAVE_AND_ZIP_FILES, WinEDA_MainFrame::OnArchiveFiles ) |
|
|
|
EVT_MENU( ID_READ_ZIP_ARCHIVE, WinEDA_MainFrame::OnUnarchiveFiles ) |
|
|
|
EVT_MENU( ID_PROJECT_TREE_REFRESH, WinEDA_MainFrame::OnRefresh ) |
|
|
|
EVT_MENU( ID_GENERAL_HELP, WinEDA_MainFrame::GetKicadHelp ) |
|
|
|
EVT_MENU( ID_KICAD_ABOUT, WinEDA_MainFrame::GetKicadAbout ) |
|
|
|
|
|
|
|
/* Range menu events */ |
|
|
|
EVT_MENU_RANGE( ID_LANGUAGE_CHOICE, ID_LANGUAGE_CHOICE_END, |
|
|
|
WinEDA_MainFrame::SetLanguage ) |
|
|
|
|
|
|
|
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, WinEDA_MainFrame::OnFileHistory ) |
|
|
|
|
|
|
|
/* Button events */ |
|
|
|
EVT_BUTTON( ID_TO_PCB, WinEDA_MainFrame::OnRunPcbNew ) |
|
|
|
EVT_BUTTON( ID_TO_CVPCB, WinEDA_MainFrame::OnRunCvpcb ) |
|
|
|
EVT_BUTTON( ID_TO_EESCHEMA, WinEDA_MainFrame::OnRunEeschema ) |
|
|
|
EVT_BUTTON( ID_TO_GERBVIEW, WinEDA_MainFrame::OnRunGerbview ) |
|
|
|
EVT_BUTTON( ID_TO_BITMAP_CONVERTER, WinEDA_MainFrame::OnRunBitmapConverter ) |
|
|
|
|
|
|
|
EVT_UPDATE_UI( ID_SELECT_DEFAULT_PDF_BROWSER, |
|
|
|
WinEDA_MainFrame::OnUpdateDefaultPdfBrowser ) |
|
|
|
EVT_UPDATE_UI( ID_SELECT_PREFERED_PDF_BROWSER, |
|
|
|
WinEDA_MainFrame::OnUpdatePreferredPdfBrowser ) |
|
|
|
|
|
|
|
END_EVENT_TABLE() |
|
|
|
|
|
|
@ -70,17 +70,17 @@ END_EVENT_TABLE() |
|
|
|
*/ |
|
|
|
void WinEDA_MainFrame::ReCreateMenuBar() |
|
|
|
{ |
|
|
|
wxMenuItem *item; |
|
|
|
wxMenuBar *menuBar = GetMenuBar(); |
|
|
|
wxMenuItem* item; |
|
|
|
wxMenuBar* menuBar = GetMenuBar(); |
|
|
|
|
|
|
|
if( ! menuBar ) |
|
|
|
if( !menuBar ) |
|
|
|
menuBar = new wxMenuBar(); |
|
|
|
|
|
|
|
// Delete all existing menus so they can be rebuilt.
|
|
|
|
// This allows language changes of the menu text on the fly.
|
|
|
|
menuBar->Freeze(); |
|
|
|
while( menuBar->GetMenuCount() ) |
|
|
|
delete menuBar->Remove(0); |
|
|
|
delete menuBar->Remove( 0 ); |
|
|
|
|
|
|
|
// Recreate all menus:
|
|
|
|
|
|
|
@ -88,113 +88,75 @@ void WinEDA_MainFrame::ReCreateMenuBar() |
|
|
|
wxMenu* filesMenu = new wxMenu; |
|
|
|
|
|
|
|
// Open
|
|
|
|
item = new wxMenuItem( filesMenu, ID_LOAD_PROJECT, _( "&Open\tCtrl+O" ), |
|
|
|
_( "Open an existing project" ) ); |
|
|
|
|
|
|
|
#if !defined( __WXMAC__ )
|
|
|
|
item->SetBitmap( open_project_xpm ); |
|
|
|
#endif /* !defined( __WXMAC__ ) */
|
|
|
|
|
|
|
|
filesMenu->Append( item ); |
|
|
|
ADD_MENUITEM_WITH_HELP( filesMenu, ID_LOAD_PROJECT, _( "&Open\tCtrl+O" ), |
|
|
|
_( "Open an existing project" ), |
|
|
|
open_project_xpm ); |
|
|
|
|
|
|
|
// Open Recent submenu
|
|
|
|
wxMenu* openRecentMenu = new wxMenu(); |
|
|
|
wxGetApp().m_fileHistory.AddFilesToMenu( openRecentMenu ); |
|
|
|
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, |
|
|
|
-1, _( "Open &Recent" ), |
|
|
|
_("Open a recent opened schematic project" ), |
|
|
|
wxID_ANY, _( "Open &Recent" ), |
|
|
|
_( "Open a recent opened schematic project" ), |
|
|
|
open_project_xpm ); |
|
|
|
|
|
|
|
// New
|
|
|
|
item = new wxMenuItem( filesMenu, ID_NEW_PROJECT, _( "&New\tCtrl+N" ), |
|
|
|
_( "Start a new project" ) ); |
|
|
|
|
|
|
|
#if !defined( __WXMAC__ )
|
|
|
|
item->SetBitmap( new_project_xpm ); |
|
|
|
#endif /* !defined( __WXMAC__ ) */
|
|
|
|
|
|
|
|
filesMenu->Append( item ); |
|
|
|
ADD_MENUITEM_WITH_HELP( filesMenu, ID_NEW_PROJECT, |
|
|
|
_( "&New\tCtrl+N" ), |
|
|
|
_( "Start a new project" ), |
|
|
|
new_project_xpm ); |
|
|
|
|
|
|
|
/* Save */ |
|
|
|
item = new wxMenuItem( filesMenu, ID_SAVE_PROJECT, _( "&Save\tCtrl+S" ), |
|
|
|
_( "Save current project" ) ); |
|
|
|
|
|
|
|
#if !defined( __WXMAC__ )
|
|
|
|
item->SetBitmap( save_project_xpm ); |
|
|
|
#endif /* !defined( __WXMAC__ ) */
|
|
|
|
|
|
|
|
filesMenu->Append( item ); |
|
|
|
ADD_MENUITEM_WITH_HELP( filesMenu, ID_SAVE_PROJECT, _( "&Save\tCtrl+S" ), |
|
|
|
_( "Save current project" ), |
|
|
|
save_project_xpm ); |
|
|
|
|
|
|
|
// Archive
|
|
|
|
filesMenu->AppendSeparator(); |
|
|
|
item = new wxMenuItem( filesMenu, ID_SAVE_AND_ZIP_FILES, _( "&Archive" ), |
|
|
|
_( "Archive project files in zip archive" ) ); |
|
|
|
|
|
|
|
#if !defined( __WXMAC__ )
|
|
|
|
item->SetBitmap( zip_xpm ); |
|
|
|
#endif /* !defined( __WXMAC__ ) */
|
|
|
|
|
|
|
|
filesMenu->Append( item ); |
|
|
|
ADD_MENUITEM_WITH_HELP( filesMenu, ID_SAVE_AND_ZIP_FILES, _( "&Archive" ), |
|
|
|
_( "Archive project files in zip archive" ), |
|
|
|
zip_xpm ); |
|
|
|
|
|
|
|
// Unarchive
|
|
|
|
item = new wxMenuItem( filesMenu, ID_READ_ZIP_ARCHIVE, _( "&Unarchive" ), |
|
|
|
_( "Unarchive project files from zip file" ) ); |
|
|
|
|
|
|
|
#if !defined( __WXMAC__ )
|
|
|
|
item->SetBitmap( unzip_xpm ); |
|
|
|
#endif /* !defined( __WXMAC__ ) */
|
|
|
|
|
|
|
|
filesMenu->Append( item ); |
|
|
|
ADD_MENUITEM_WITH_HELP( filesMenu, ID_READ_ZIP_ARCHIVE, _( "&Unarchive" ), |
|
|
|
_( "Unarchive project files from zip file" ), |
|
|
|
unzip_xpm ); |
|
|
|
|
|
|
|
/* Quit on all platforms except WXMAC */ |
|
|
|
#if !defined( __WXMAC__ )
|
|
|
|
|
|
|
|
filesMenu->AppendSeparator(); |
|
|
|
item = new wxMenuItem( filesMenu, wxID_EXIT, _( "&Quit" ), |
|
|
|
_( "Quit KiCad" ) ); |
|
|
|
item->SetBitmap( exit_xpm ); |
|
|
|
filesMenu->Append( item ); |
|
|
|
ADD_MENUITEM_WITH_HELP( filesMenu, wxID_EXIT, _( "&Quit" ), |
|
|
|
_( "Quit KiCad" ), |
|
|
|
exit_xpm ); |
|
|
|
|
|
|
|
#endif /* !defined( __WXMAC__ ) */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Browse menu
|
|
|
|
wxMenu* browseMenu = new wxMenu(); |
|
|
|
|
|
|
|
// Text editor
|
|
|
|
item = new wxMenuItem( browseMenu, ID_TO_EDITOR, _( "Text E&ditor" ), |
|
|
|
_( "Open preferred text editor" ) ); |
|
|
|
#if !defined( __WXMAC__ )
|
|
|
|
item->SetBitmap( editor_xpm ); |
|
|
|
#endif /* !defined( __WXMAC__ ) */
|
|
|
|
|
|
|
|
browseMenu->Append( item ); |
|
|
|
ADD_MENUITEM_WITH_HELP( browseMenu, ID_TO_EDITOR, |
|
|
|
_( "Text E&ditor" ), |
|
|
|
_( "Launch preferred text editor" ), |
|
|
|
editor_xpm ); |
|
|
|
|
|
|
|
/* Browse files */ |
|
|
|
item = new wxMenuItem( browseMenu, ID_BROWSE_AN_SELECT_FILE, |
|
|
|
_( "&View File" ), |
|
|
|
_( "View, read or edit file with a text editor" ) ); |
|
|
|
#if !defined( __WXMAC__ )
|
|
|
|
item->SetBitmap( browse_files_xpm ); |
|
|
|
#endif /* !defined( __WXMAC__ ) */
|
|
|
|
|
|
|
|
browseMenu->Append( item ); |
|
|
|
|
|
|
|
ADD_MENUITEM_WITH_HELP( browseMenu, ID_BROWSE_AN_SELECT_FILE, |
|
|
|
_( "&View File" ), |
|
|
|
_( "View, read or edit file with a text editor" ), |
|
|
|
browse_files_xpm ); |
|
|
|
|
|
|
|
|
|
|
|
// Preferences menu
|
|
|
|
wxMenu* PreferencesMenu = new wxMenu; |
|
|
|
|
|
|
|
// Text editor
|
|
|
|
item = new wxMenuItem( PreferencesMenu, ID_SELECT_PREFERED_EDITOR, |
|
|
|
_( "&Text Editor" ), |
|
|
|
_( "Select your preferred text editor" ) ); |
|
|
|
#if !defined( __WXMAC__ )
|
|
|
|
item->SetBitmap( editor_xpm ); |
|
|
|
#endif /* !defined( __WXMAC__ ) */
|
|
|
|
|
|
|
|
PreferencesMenu->Append( item ); |
|
|
|
ADD_MENUITEM_WITH_HELP( PreferencesMenu, ID_SELECT_PREFERED_EDITOR, |
|
|
|
_( "&Text Editor" ), |
|
|
|
_( "Select your preferred text editor" ), |
|
|
|
editor_xpm ); |
|
|
|
|
|
|
|
// PDF Viewer submenu:System browser or user defined checkbox
|
|
|
|
wxMenu* SubMenuPdfBrowserChoice = new wxMenu; |
|
|
@ -230,15 +192,11 @@ void WinEDA_MainFrame::ReCreateMenuBar() |
|
|
|
!wxGetApp().m_PdfBrowserIsDefault ); |
|
|
|
|
|
|
|
// Append PDF Viewer submenu to preferences
|
|
|
|
item = new wxMenuItem( SubMenuPdfBrowserChoice, |
|
|
|
ID_SELECT_PREFERED_PDF_BROWSER_NAME, |
|
|
|
_( "PDF Viewer" ), |
|
|
|
_( "Select your favourite PDF viewer used to browse datasheets" ) ); |
|
|
|
#if !defined( __WXMAC__ )
|
|
|
|
item->SetBitmap( datasheet_xpm ); |
|
|
|
#endif /* !defined( __WXMAC__ ) */
|
|
|
|
|
|
|
|
SubMenuPdfBrowserChoice->Append( item ); |
|
|
|
ADD_MENUITEM_WITH_HELP( SubMenuPdfBrowserChoice, |
|
|
|
ID_SELECT_PREFERED_PDF_BROWSER_NAME, |
|
|
|
_( "PDF Viewer" ), |
|
|
|
_( "Select your favourite PDF viewer used to browse datasheets" ), |
|
|
|
datasheet_xpm ); |
|
|
|
|
|
|
|
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( PreferencesMenu, |
|
|
|
SubMenuPdfBrowserChoice, |
|
|
@ -256,21 +214,15 @@ void WinEDA_MainFrame::ReCreateMenuBar() |
|
|
|
AddHelpVersionInfoMenuEntry( helpMenu ); |
|
|
|
|
|
|
|
/* Contents */ |
|
|
|
item = new wxMenuItem( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), |
|
|
|
_( "Open the kicad manual" ) ); |
|
|
|
|
|
|
|
#if !defined( __WXMAC__ )
|
|
|
|
item->SetBitmap( online_help_xpm ); |
|
|
|
#endif /* !defined( __WXMAC__ ) */
|
|
|
|
|
|
|
|
helpMenu->Append( item ); |
|
|
|
ADD_MENUITEM_WITH_HELP( helpMenu, ID_GENERAL_HELP, _( "&Contents" ), |
|
|
|
_( "Open the kicad manual" ), |
|
|
|
online_help_xpm ); |
|
|
|
|
|
|
|
// About
|
|
|
|
helpMenu->AppendSeparator(); |
|
|
|
item = new wxMenuItem( helpMenu, ID_KICAD_ABOUT, _( "&About" ), |
|
|
|
_( "About kicad project manager" ) ); |
|
|
|
item->SetBitmap( info_xpm ); |
|
|
|
helpMenu->Append( item ); |
|
|
|
ADD_MENUITEM_WITH_HELP( helpMenu, ID_KICAD_ABOUT, _( "&About" ), |
|
|
|
_( "About kicad project manager" ), |
|
|
|
info_xpm ); |
|
|
|
|
|
|
|
// Create the menubar and append all submenus
|
|
|
|
menuBar->Append( filesMenu, _( "&File" ) ); |
|
|
@ -302,34 +254,34 @@ void WinEDA_MainFrame::RecreateBaseHToolbar() |
|
|
|
|
|
|
|
/* New */ |
|
|
|
m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, |
|
|
|
wxBitmap( new_project_xpm ), |
|
|
|
_( "Start a new project" ) ); |
|
|
|
wxBitmap( new_project_xpm ), |
|
|
|
_( "Start a new project" ) ); |
|
|
|
|
|
|
|
/* Load */ |
|
|
|
m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, |
|
|
|
wxBitmap( open_project_xpm ), |
|
|
|
_( "Load existing project" ) ); |
|
|
|
wxBitmap( open_project_xpm ), |
|
|
|
_( "Load existing project" ) ); |
|
|
|
|
|
|
|
/* Save */ |
|
|
|
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, |
|
|
|
wxBitmap( save_project_xpm ), |
|
|
|
_( "Save current project" ) ); |
|
|
|
wxBitmap( save_project_xpm ), |
|
|
|
_( "Save current project" ) ); |
|
|
|
|
|
|
|
/* Separator */ |
|
|
|
m_HToolBar->AddSeparator(); |
|
|
|
|
|
|
|
/* Archive */ |
|
|
|
m_HToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString, |
|
|
|
wxBitmap( zip_xpm ), |
|
|
|
_( "Archive all project files" ) ); |
|
|
|
wxBitmap( zip_xpm ), |
|
|
|
_( "Archive all project files" ) ); |
|
|
|
|
|
|
|
/* Separator */ |
|
|
|
m_HToolBar->AddSeparator(); |
|
|
|
|
|
|
|
/* Refresh project tree */ |
|
|
|
m_HToolBar->AddTool( ID_PROJECT_TREE_REFRESH, wxEmptyString, |
|
|
|
wxBitmap( reload_xpm ), |
|
|
|
_( "Refresh project tree" ) ); |
|
|
|
wxBitmap( reload_xpm ), |
|
|
|
_( "Refresh project tree" ) ); |
|
|
|
|
|
|
|
/* Create m_HToolBar */ |
|
|
|
m_HToolBar->Realize(); |
|
|
|