2007-06-05 12:10:51 +00:00
|
|
|
/*************************************************************/
|
|
|
|
/* menubar.cpp - create the menubar for the schematic frame */
|
|
|
|
/*************************************************************/
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
#include "program.h"
|
|
|
|
#include "libcmp.h"
|
|
|
|
#include "general.h"
|
|
|
|
|
|
|
|
#include "bitmaps.h"
|
|
|
|
#include "protos.h"
|
|
|
|
#include "id.h"
|
2007-09-19 15:29:50 +00:00
|
|
|
#include "hotkeys.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
/************************************************/
|
2007-09-13 11:55:46 +00:00
|
|
|
void WinEDA_SchematicFrame::ReCreateMenuBar()
|
2007-06-05 12:10:51 +00:00
|
|
|
/************************************************/
|
|
|
|
/* create or update the menubar for the schematic frame
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
int ii;
|
|
|
|
wxMenuBar * menuBar = GetMenuBar();
|
2007-09-19 15:29:50 +00:00
|
|
|
wxString msg;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
if( menuBar == NULL )
|
|
|
|
{
|
2007-05-06 16:03:28 +00:00
|
|
|
menuBar = new wxMenuBar();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
m_FilesMenu = new wxMenu;
|
|
|
|
|
|
|
|
wxMenuItem *item = new wxMenuItem(m_FilesMenu, ID_LOAD_PROJECT,
|
|
|
|
_("&Load Schematic Project"),
|
|
|
|
_("Load a schematic project (Schematic, libraries...)") );
|
|
|
|
item->SetBitmap(open_xpm);
|
|
|
|
m_FilesMenu->Append(item);
|
|
|
|
|
|
|
|
item = new wxMenuItem(m_FilesMenu, ID_LOAD_ONE_SHEET,
|
|
|
|
_("&Reload the current sheet"),
|
|
|
|
_("Load or reload a schematic file from file into the current sheet") );
|
|
|
|
item->SetBitmap(import_xpm);
|
|
|
|
m_FilesMenu->Append(item);
|
|
|
|
|
|
|
|
m_FilesMenu->AppendSeparator();
|
|
|
|
item = new wxMenuItem(m_FilesMenu,ID_SAVE_PROJECT,
|
|
|
|
_("&Save Schematic Project"),
|
|
|
|
_("Save all") );
|
|
|
|
item->SetBitmap(save_project_xpm);
|
|
|
|
m_FilesMenu->Append(item);
|
|
|
|
|
|
|
|
m_FilesMenu->AppendSeparator();
|
|
|
|
item = new wxMenuItem(m_FilesMenu, ID_SAVE_ONE_SHEET,
|
|
|
|
_("Save &Current sheet"),
|
|
|
|
_("Save current sheet only") );
|
|
|
|
item->SetBitmap(save_xpm);
|
|
|
|
m_FilesMenu->Append(item);
|
|
|
|
|
|
|
|
item = new wxMenuItem(m_FilesMenu, ID_SAVE_ONE_SHEET_AS,
|
|
|
|
_("Save Current sheet &as.."),
|
|
|
|
_("Save current sheet as..") );
|
|
|
|
item->SetBitmap(save_as_xpm);
|
|
|
|
m_FilesMenu->Append(item);
|
|
|
|
|
|
|
|
/* Plot Menu */
|
|
|
|
item = new wxMenuItem(m_FilesMenu, ID_GEN_PRINT,
|
|
|
|
_("P&rint"), _("Print on current printer") );
|
|
|
|
item->SetBitmap(print_button);
|
|
|
|
m_FilesMenu->Append(item);
|
|
|
|
|
|
|
|
wxMenu *choice_plot_fmt = new wxMenu;
|
|
|
|
item = new wxMenuItem(choice_plot_fmt, ID_GEN_PLOT_PS,
|
2007-07-01 19:43:38 +00:00
|
|
|
_("Plot PostScript"), _("Plotting in PostScript format") );
|
2007-06-05 12:10:51 +00:00
|
|
|
item->SetBitmap(plot_PS_xpm);
|
|
|
|
choice_plot_fmt->Append(item);
|
|
|
|
|
|
|
|
item = new wxMenuItem(choice_plot_fmt, ID_GEN_PLOT_HPGL,
|
|
|
|
_("Plot HPGL"), _("Plotting in HPGL format") );
|
|
|
|
item->SetBitmap(plot_HPG_xpm);
|
|
|
|
choice_plot_fmt->Append(item);
|
|
|
|
|
|
|
|
item = new wxMenuItem(choice_plot_fmt, ID_GEN_PLOT_SVG,
|
|
|
|
_("Plot SVG"), _("Plotting in SVG format") );
|
|
|
|
item->SetBitmap(plot_xpm);
|
|
|
|
choice_plot_fmt->Append(item);
|
|
|
|
|
|
|
|
#ifdef __WINDOWS__
|
|
|
|
/* Under windows, one can draw to the clipboard */
|
|
|
|
item = new wxMenuItem(choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD,
|
|
|
|
_("Plot to Clipboard"), _("Export drawings to clipboard") );
|
|
|
|
item->SetBitmap(copy_button);
|
|
|
|
choice_plot_fmt->Append(item);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
m_FilesMenu->AppendSeparator();
|
|
|
|
ADD_MENUITEM_WITH_HELP_AND_SUBMENU(m_FilesMenu, choice_plot_fmt,
|
2007-07-01 19:43:38 +00:00
|
|
|
ID_GEN_PLOT, _("&Plot"), _("Plot HPGL, PostScript, SVG"), plot_xpm);
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
m_FilesMenu->AppendSeparator();
|
|
|
|
item = new wxMenuItem(m_FilesMenu, ID_EXIT, _("E&xit"), _("Quit Eeschema") );
|
|
|
|
item->SetBitmap(exit_xpm);
|
|
|
|
m_FilesMenu->Append(item);
|
|
|
|
|
|
|
|
// Create the list of last edited schematic files
|
|
|
|
m_FilesMenu->AppendSeparator();
|
|
|
|
int max_file = m_Parent->m_LastProjectMaxCount;
|
|
|
|
for ( ii = 0; ii < max_file; ii++ )
|
|
|
|
{
|
|
|
|
if ( GetLastProject(ii).IsEmpty() ) break;
|
|
|
|
item = new wxMenuItem(m_FilesMenu, ID_LOAD_FILE_1 + ii,
|
|
|
|
GetLastProject(ii));
|
|
|
|
m_FilesMenu->Append(item);
|
|
|
|
}
|
|
|
|
|
2007-09-09 19:11:15 +00:00
|
|
|
// Menu Edit:
|
|
|
|
wxMenu * editMenu = new wxMenu;
|
2007-09-19 15:29:50 +00:00
|
|
|
msg = AddHotkeyName( _( "&Undo\t" ), s_Schematic_Hokeys_Descr, HK_UNDO );
|
2007-09-09 19:11:15 +00:00
|
|
|
item = new wxMenuItem(editMenu, ID_SCHEMATIC_UNDO,
|
2007-09-19 15:29:50 +00:00
|
|
|
msg,
|
2007-09-09 19:11:15 +00:00
|
|
|
_("Undo last edition") );
|
|
|
|
item->SetBitmap(undo_xpm);
|
|
|
|
editMenu->Append(item);
|
2007-09-19 15:29:50 +00:00
|
|
|
|
|
|
|
msg = AddHotkeyName( _( "&Redo\t" ), s_Schematic_Hokeys_Descr, HK_REDO );
|
2007-09-09 19:11:15 +00:00
|
|
|
item = new wxMenuItem(editMenu, ID_SCHEMATIC_REDO,
|
2007-09-19 15:29:50 +00:00
|
|
|
msg,
|
2007-09-09 19:11:15 +00:00
|
|
|
_("Redo the last undo command") );
|
|
|
|
item->SetBitmap(redo_xpm);
|
|
|
|
editMenu->Append(item);
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
// Menu Configuration:
|
|
|
|
wxMenu * configmenu = new wxMenu;
|
|
|
|
item = new wxMenuItem(configmenu, ID_CONFIG_REQ,
|
|
|
|
_("&Libs and Dir"),
|
|
|
|
_("Setting Libraries, Directories and others...") );
|
|
|
|
item->SetBitmap(library_xpm);
|
|
|
|
configmenu->Append(item);
|
|
|
|
|
|
|
|
item = new wxMenuItem(configmenu, ID_COLORS_SETUP,
|
|
|
|
_("&Colors"),
|
2007-09-24 07:14:01 +00:00
|
|
|
_("Setting colors...") );
|
2007-06-05 12:10:51 +00:00
|
|
|
item->SetBitmap(palette_xpm);
|
|
|
|
configmenu->Append(item);
|
|
|
|
|
2007-09-24 07:14:01 +00:00
|
|
|
// ADD_MENUITEM(configmenu, ID_OPTIONS_SETUP, _("&Options"), preference_xpm);
|
|
|
|
item = new wxMenuItem(configmenu, ID_OPTIONS_SETUP,
|
|
|
|
_("&Options"),
|
|
|
|
_("Select general options...") );
|
|
|
|
item->SetBitmap(preference_xpm);
|
|
|
|
configmenu->Append(item);
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
// Font selection and setup
|
|
|
|
AddFontSelectionMenu(configmenu);
|
|
|
|
|
|
|
|
m_Parent->SetLanguageList(configmenu);
|
|
|
|
|
|
|
|
configmenu->AppendSeparator();
|
2007-09-14 10:07:38 +00:00
|
|
|
item = new wxMenuItem(configmenu, ID_CONFIG_SAVE, _("&Save preferences"),
|
|
|
|
_("Save application preferences") );
|
2007-06-05 12:10:51 +00:00
|
|
|
item->SetBitmap(save_setup_xpm);
|
|
|
|
configmenu->Append(item);
|
2007-09-14 10:07:38 +00:00
|
|
|
item = new wxMenuItem(configmenu, ID_CONFIG_READ, _("&Read preferences"),
|
|
|
|
_("Read application preferences"));
|
2007-06-05 12:10:51 +00:00
|
|
|
item->SetBitmap(read_setup_xpm);
|
|
|
|
configmenu->Append(item);
|
|
|
|
|
2007-08-21 19:37:31 +00:00
|
|
|
configmenu->AppendSeparator();
|
2007-09-20 09:13:40 +00:00
|
|
|
AddHotkeyConfigMenu( configmenu );
|
2007-08-21 19:37:31 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
// Menu Help:
|
|
|
|
wxMenu *helpMenu = new wxMenu;
|
|
|
|
item = new wxMenuItem(helpMenu , ID_GENERAL_HELP,
|
2007-06-14 17:11:54 +00:00
|
|
|
_("&Contents"), _("Open the eeschema manual"));
|
2007-06-05 12:10:51 +00:00
|
|
|
item->SetBitmap(help_xpm);
|
|
|
|
helpMenu->Append(item);
|
|
|
|
|
|
|
|
item = new wxMenuItem(helpMenu , ID_KICAD_ABOUT,
|
2007-06-14 17:11:54 +00:00
|
|
|
_("&About"), _("About this application"));
|
2007-06-05 12:10:51 +00:00
|
|
|
item->SetBitmap(info_xpm);
|
|
|
|
helpMenu->Append(item);
|
|
|
|
|
|
|
|
|
2007-06-18 13:57:15 +00:00
|
|
|
menuBar->Append(m_FilesMenu, _("&File") );
|
2007-09-09 19:11:15 +00:00
|
|
|
menuBar->Append(editMenu, _("&Edit") );
|
2007-06-05 12:10:51 +00:00
|
|
|
menuBar->Append(configmenu, _("&Preferences") );
|
|
|
|
menuBar->Append(helpMenu, _("&Help") );
|
|
|
|
|
|
|
|
// Associate the menu bar with the frame
|
|
|
|
SetMenuBar(menuBar);
|
|
|
|
}
|
|
|
|
|
|
|
|
else // Update the list of last edited schematic files
|
|
|
|
{
|
|
|
|
wxMenuItem * item;
|
|
|
|
int max_file = m_Parent->m_LastProjectMaxCount;
|
|
|
|
for ( ii = max_file-1; ii >=0 ; ii-- )
|
|
|
|
{
|
|
|
|
if( m_FilesMenu->FindItem(ID_LOAD_FILE_1 + ii) )
|
|
|
|
{
|
|
|
|
item = m_FilesMenu->Remove(ID_LOAD_FILE_1 + ii);
|
|
|
|
if ( item ) delete item;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for ( ii = 0; ii < max_file; ii++ )
|
|
|
|
{
|
|
|
|
if ( GetLastProject(ii).IsEmpty() ) break;
|
|
|
|
item = new wxMenuItem(m_FilesMenu, ID_LOAD_FILE_1 + ii,
|
|
|
|
GetLastProject(ii));
|
|
|
|
m_FilesMenu->Append(item);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|