2011-04-06 13:52:47 +00:00
|
|
|
/**
|
|
|
|
* @file cvpcb/menubar.cpp
|
|
|
|
* @brief (Re)Create the menubar for cvpcb
|
2010-01-18 19:33:45 +00:00
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "fctsys.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "appl_wxstruct.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "confirm.h"
|
|
|
|
#include "gestfich.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "cvpcb.h"
|
2011-02-05 16:15:48 +00:00
|
|
|
#include "cvpcb_mainframe.h"
|
2010-11-07 20:06:07 +00:00
|
|
|
#include "cvpcb_id.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-04-21 17:56:27 +00:00
|
|
|
#include "bitmaps.h"
|
2008-12-08 15:27:13 +00:00
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
/**
|
|
|
|
* @brief (Re)Create the menubar for the cvpcb mainframe
|
|
|
|
*/
|
2011-02-05 16:15:48 +00:00
|
|
|
void CVPCB_MAINFRAME::ReCreateMenuBar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2011-04-06 13:52:47 +00:00
|
|
|
// Create and try to get the current menubar
|
2009-04-21 17:56:27 +00:00
|
|
|
wxMenuItem* item;
|
2010-12-17 20:34:29 +00:00
|
|
|
wxMenuBar* menuBar = GetMenuBar();
|
2009-05-21 17:42:42 +00:00
|
|
|
|
2011-04-17 16:04:09 +00:00
|
|
|
if( ! menuBar ) // Delete all menus
|
2010-12-17 20:34:29 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
// Recreate all menus:
|
2009-04-21 17:56:27 +00:00
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Menu File:
|
2009-04-21 17:56:27 +00:00
|
|
|
wxMenu* filesMenu = new wxMenu;
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Open
|
|
|
|
ADD_MENUITEM_WITH_HELP( filesMenu,
|
|
|
|
ID_LOAD_PROJECT,
|
|
|
|
_( "&Open" ),
|
|
|
|
_( "Open a net list file" ),
|
|
|
|
open_document_xpm );
|
|
|
|
|
|
|
|
// Open Recent submenu
|
2011-04-17 13:54:17 +00:00
|
|
|
static wxMenu* openRecentMenu;
|
|
|
|
// Add this menu to list menu managed by m_fileHistory
|
|
|
|
// (the file history will be updated when adding/removing files in history
|
|
|
|
if( openRecentMenu )
|
|
|
|
wxGetApp().m_fileHistory.RemoveMenu( openRecentMenu );
|
|
|
|
openRecentMenu = new wxMenu();
|
|
|
|
wxGetApp().m_fileHistory.UseMenu( openRecentMenu );
|
|
|
|
wxGetApp().m_fileHistory.AddFilesToMenu( );
|
2011-04-06 13:52:47 +00:00
|
|
|
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( filesMenu, openRecentMenu, -1,
|
|
|
|
_( "Open &Recent" ),
|
2010-08-24 17:26:51 +00:00
|
|
|
_("Open a recent opened netlist document" ),
|
|
|
|
open_project_xpm );
|
2010-01-18 19:33:45 +00:00
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Separator
|
2009-04-21 17:56:27 +00:00
|
|
|
filesMenu->AppendSeparator();
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Save as
|
|
|
|
ADD_MENUITEM_WITH_HELP( filesMenu,
|
|
|
|
ID_SAVE_PROJECT,
|
|
|
|
_( "&Save As..." ),
|
|
|
|
_( "Save new net list and footprint list files" ),
|
|
|
|
save_xpm );
|
2010-01-18 19:33:45 +00:00
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Separator
|
2009-04-21 17:56:27 +00:00
|
|
|
filesMenu->AppendSeparator();
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Quit
|
|
|
|
ADD_MENUITEM_WITH_HELP( filesMenu,
|
|
|
|
wxID_EXIT,
|
|
|
|
_( "&Quit" ),
|
|
|
|
_( "Quit CvPCB" ),
|
|
|
|
exit_xpm );
|
|
|
|
|
|
|
|
// Menu Preferences:
|
|
|
|
wxMenu* preferencesMenu = new wxMenu;
|
|
|
|
|
|
|
|
// 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 );
|
|
|
|
|
|
|
|
// Language submenu
|
|
|
|
wxGetApp().AddMenuLanguageList( preferencesMenu );
|
|
|
|
|
|
|
|
// Keep open on save
|
|
|
|
item = new wxMenuItem( preferencesMenu, ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE,
|
2009-04-23 15:02:18 +00:00
|
|
|
_( "Keep Open On Save" ),
|
2009-05-21 17:42:42 +00:00
|
|
|
_( "Prevent CVPcb from exiting after saving netlist file" ),
|
2009-04-23 15:02:18 +00:00
|
|
|
wxITEM_CHECK );
|
2011-04-06 13:52:47 +00:00
|
|
|
preferencesMenu->Append( item );
|
2011-04-05 17:49:14 +00:00
|
|
|
SETBITMAPS( window_close_xpm );
|
2011-03-29 10:43:08 +00:00
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Separator
|
|
|
|
preferencesMenu->AppendSeparator();
|
|
|
|
ADD_MENUITEM_WITH_HELP( preferencesMenu, ID_CONFIG_SAVE,
|
2011-03-29 10:43:08 +00:00
|
|
|
_( "&Save Project File" ),
|
|
|
|
_( "Save changes to the project file" ),
|
|
|
|
save_setup_xpm );
|
2009-04-21 17:56:27 +00:00
|
|
|
|
|
|
|
// Menu Help:
|
|
|
|
wxMenu* helpMenu = new wxMenu;
|
2010-08-24 17:26:51 +00:00
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Version info
|
2010-08-24 17:26:51 +00:00
|
|
|
AddHelpVersionInfoMenuEntry( helpMenu );
|
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// Contents
|
2011-04-17 13:54:17 +00:00
|
|
|
ADD_MENUITEM_WITH_HELP( helpMenu, wxID_HELP, _( "&Contents" ),
|
|
|
|
_( "Open the Cvpcb handbook" ),
|
2011-03-29 10:43:08 +00:00
|
|
|
online_help_xpm );
|
2010-01-18 19:33:45 +00:00
|
|
|
|
2011-04-06 13:52:47 +00:00
|
|
|
// About
|
|
|
|
ADD_MENUITEM_WITH_HELP( helpMenu, wxID_ABOUT,
|
|
|
|
_( "&About CvPCB" ),
|
|
|
|
_( "About CvPCB schematic to pcb converter" ),
|
2011-03-29 10:43:08 +00:00
|
|
|
info_xpm );
|
2009-04-21 17:56:27 +00:00
|
|
|
|
2010-12-17 20:34:29 +00:00
|
|
|
// Create the menubar and append all submenus
|
2009-04-21 17:56:27 +00:00
|
|
|
menuBar->Append( filesMenu, _( "&File" ) );
|
2011-04-06 13:52:47 +00:00
|
|
|
menuBar->Append( preferencesMenu, _( "&Preferences" ) );
|
2009-04-21 17:56:27 +00:00
|
|
|
menuBar->Append( helpMenu, _( "&Help" ) );
|
|
|
|
|
2010-12-17 20:34:29 +00:00
|
|
|
menuBar->Thaw();
|
|
|
|
|
|
|
|
// Associate the menu bar with the frame, if no previous menubar
|
|
|
|
if( GetMenuBar() == NULL )
|
|
|
|
SetMenuBar( menuBar );
|
|
|
|
else
|
|
|
|
menuBar->Refresh();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|