Commit 94372b81 authored by jean-pierre charras's avatar jean-pierre charras

Eeschema: fix bug 783535. Minor code cleaning.

Pcbnew: fix very minor issue.
parent a367dea4
......@@ -339,22 +339,11 @@ void EDA_BASE_FRAME::AddHelpVersionInfoMenuEntry( wxMenu* aMenu )
{
wxASSERT( aMenu != NULL );
wxMenuItem* item = NULL;
// Copy version string to clipboard for bug report purposes.
item = new wxMenuItem( aMenu, ID_HELP_COPY_VERSION_STRING,
ADD_MENUITEM_WITH_HELP( aMenu, ID_HELP_COPY_VERSION_STRING,
_( "Copy &Version Information" ),
_( "Copy the version string to clipboard to send with bug reports" ) );
// For some reason images are not always added to the OSX menu items. Anyone want
// to clarify as to why this is the case? Putting this information in some formal
// developer notes would be helpful. A good place to put this information would be
// ./documentation/guidelines/UIpolicies.txt.
#if !defined( __WXMAC__ )
item->SetBitmap( copy_button );
#endif
aMenu->Append( item );
_( "Copy the version string to clipboard to send with bug reports" ),
copy_button );
}
......
......@@ -632,41 +632,34 @@ void AddHotkeyConfigMenu( wxMenu* aMenu )
if( aMenu == NULL )
return;
wxMenuItem* item;
wxMenu* HotkeySubmenu = new wxMenu();
/* List existing hotkey menu*/
item = new wxMenuItem( HotkeySubmenu,
ADD_MENUITEM_WITH_HELP( HotkeySubmenu,
ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
_( "List Current Keys" ),
_( "Displays the current hotkeys list and corresponding commands" ) );
item->SetBitmap( info_xpm );
HotkeySubmenu->Append( item );
_( "Displays the current hotkeys list and corresponding commands" ),
info_xpm );
/* Call hotkeys editor*/
item = new wxMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_SHOW_EDITOR,
ADD_MENUITEM_WITH_HELP( HotkeySubmenu, ID_PREFERENCES_HOTKEY_SHOW_EDITOR,
_( "Edit Hotkeys" ),
_( "Call the hotkeys editor" ) );
item->SetBitmap( editor_xpm );
HotkeySubmenu->Append( item );
_( "Call the hotkeys editor" ),
editor_xpm );
HotkeySubmenu->AppendSeparator();
/* create hotkey file to export current hotkeys config */
item = new wxMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_EXPORT_CONFIG,
ADD_MENUITEM_WITH_HELP( HotkeySubmenu, ID_PREFERENCES_HOTKEY_EXPORT_CONFIG,
_( "Export Hotkeys Config" ),
_(
"Create a hotkey configuration file to export the current hotkey config" )
);
item->SetBitmap( save_setup_xpm );
HotkeySubmenu->Append( item );
_( "Create a hotkey configuration file to export the current hotkey config" ),
save_setup_xpm );
/* Reload hotkey file */
item = new wxMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_IMPORT_CONFIG,
ADD_MENUITEM_WITH_HELP( HotkeySubmenu, ID_PREFERENCES_HOTKEY_IMPORT_CONFIG,
_( "Import Hotkeys Config" ),
_( "Load an existing hotkey configuration file" ) );
item->SetBitmap( reload_xpm );
HotkeySubmenu->Append( item );
_( "Load an existing hotkey configuration file" ),
reload_xpm );
/* Append HotkeySubmenu to menu */
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( aMenu, HotkeySubmenu,
......
......@@ -60,7 +60,8 @@ static void abortMoveText( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
if( item->IsNew() )
{
SAFE_DELETE( item );
delete item;
item = NULL;
}
else // Move command on an existing text item, restore the copy of the original.
{
......@@ -77,7 +78,7 @@ static void abortMoveText( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
item->ClearFlags();
}
screen->SetCurItem( NULL );
screen->SetCurItem( item );
}
......
......@@ -115,6 +115,7 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_LIBEDIT_GEN_PNG_FILE, LIB_EDIT_FRAME::OnPlotCurrentComponent )
EVT_MENU( ID_LIBEDIT_GEN_SVG_FILE, LIB_EDIT_FRAME::OnPlotCurrentComponent )
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout )
EVT_MENU( ID_COLORS_SETUP, LIB_EDIT_FRAME::OnColorConfig )
EVT_MENU( ID_CONFIG_REQ, LIB_EDIT_FRAME::InstallConfigFrame )
......
......@@ -26,18 +26,17 @@
void SCH_EDIT_FRAME::ReCreateMenuBar()
{
// Create and try to get the current menubar
wxString text;
wxMenuItem* item;
wxMenuBar* menuBar = GetMenuBar();
wxString text;
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:
......@@ -45,23 +44,22 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
wxMenu* fileMenu = new wxMenu;
// New
item = new wxMenuItem( fileMenu,
ID_NEW_PROJECT,
_( "&New\tCtrl+N" ),
_( "New schematic project" ) );
SET_BITMAP( new_xpm );
fileMenu->Append( item );
ADD_MENUITEM_WITH_HELP( fileMenu,
ID_NEW_PROJECT,
_( "&New\tCtrl+N" ),
_( "New schematic project" ),
new_xpm );
// Open
item = new wxMenuItem( fileMenu,
ID_LOAD_PROJECT,
_( "&Open\tCtrl+O" ),
_( "Open an existing schematic project" ) );
SET_BITMAP( open_document_xpm );
fileMenu->Append( item );
ADD_MENUITEM_WITH_HELP( fileMenu,
ID_LOAD_PROJECT,
_( "&Open\tCtrl+O" ),
_( "Open an existing schematic project" ),
open_document_xpm );
// Open Recent submenu
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 )
......@@ -73,105 +71,97 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
wxID_ANY, _( "Open &Recent" ),
_( "Open a recent opened schematic project" ),
open_project_xpm );
// Separator
fileMenu->AppendSeparator();
// Save schematic project
item = new wxMenuItem( fileMenu,
ID_SAVE_PROJECT,
_( "&Save Whole Schematic Project\tCtrl+S" ),
_( "Save all sheets in the schematic project" ) );
SET_BITMAP( save_project_xpm );
fileMenu->Append( item );
ADD_MENUITEM_WITH_HELP( fileMenu,
ID_SAVE_PROJECT,
_( "&Save Whole Schematic Project\tCtrl+S" ),
_( "Save all sheets in the schematic project" ),
save_project_xpm );
// Save current sheet
item = new wxMenuItem( fileMenu,
ID_SAVE_ONE_SHEET,
_( "Save &Current Sheet Only" ),
_( "Save only current schematic sheet" ) );
SET_BITMAP( save_xpm );
fileMenu->Append( item );
ADD_MENUITEM_WITH_HELP( fileMenu,
ID_SAVE_ONE_SHEET,
_( "Save &Current Sheet Only" ),
_( "Save only current schematic sheet" ),
save_xpm );
// Save current sheet as
item = new wxMenuItem( fileMenu,
ID_SAVE_ONE_SHEET_AS,
_( "Save Current Sheet &as" ),
_( "Save current schematic sheet as..." ) );
SET_BITMAP( save_as_xpm );
fileMenu->Append( item );
ADD_MENUITEM_WITH_HELP( fileMenu,
ID_SAVE_ONE_SHEET_AS,
_( "Save Current Sheet &as" ),
_( "Save current schematic sheet as..." ),
save_as_xpm );
// Separator
fileMenu->AppendSeparator();
// Print
item = new wxMenuItem( fileMenu,
wxID_PRINT,
_( "P&rint" ),
_( "Print schematic" ) );
SET_BITMAP( print_button );
fileMenu->Append( item );
ADD_MENUITEM_WITH_HELP( fileMenu,
wxID_PRINT,
_( "P&rint" ),
_( "Print schematic" ),
print_button );
// Plot submenu
wxMenu* choice_plot_fmt = new wxMenu;
// Plot PostScript
item = new wxMenuItem( choice_plot_fmt, ID_GEN_PLOT_PS,
_( "Plot PostScript" ),
_( "Plot schematic sheet in PostScript format" ) );
SET_BITMAP( plot_PS_xpm );
choice_plot_fmt->Append( item );
ADD_MENUITEM_WITH_HELP( choice_plot_fmt, ID_GEN_PLOT_PS,
_( "Plot PostScript" ),
_( "Plot schematic sheet in PostScript format" ),
plot_PS_xpm );
// Plot HPGL
item = new wxMenuItem( choice_plot_fmt,
ID_GEN_PLOT_HPGL,
_( "Plot HPGL" ),
_( "Plot schematic sheet in HPGL format" ) );
SET_BITMAP( plot_HPG_xpm );
choice_plot_fmt->Append( item );
ADD_MENUITEM_WITH_HELP( choice_plot_fmt,
ID_GEN_PLOT_HPGL,
_( "Plot HPGL" ),
_( "Plot schematic sheet in HPGL format" ),
plot_HPG_xpm );
// Plot SVG
item = new wxMenuItem( choice_plot_fmt,
ID_GEN_PLOT_SVG,
_( "Plot SVG" ),
_( "Plot schematic sheet in SVG format" ) );
SET_BITMAP( plot_xpm );
choice_plot_fmt->Append( item );
ADD_MENUITEM_WITH_HELP( choice_plot_fmt,
ID_GEN_PLOT_SVG,
_( "Plot SVG" ),
_( "Plot schematic sheet in SVG format" ),
plot_xpm );
// Plot DXF
item = new wxMenuItem( choice_plot_fmt,
ID_GEN_PLOT_DXF,
_( "Plot DXF" ),
_( "Plot schematic sheet in DXF format" ) );
SET_BITMAP( plot_xpm );
choice_plot_fmt->Append( item );
ADD_MENUITEM_WITH_HELP( choice_plot_fmt,
ID_GEN_PLOT_DXF,
_( "Plot DXF" ),
_( "Plot schematic sheet in DXF format" ),
plot_xpm );
// Plot to Clipboard (Windows only)
#ifdef __WINDOWS__
item = new wxMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD,
_( "Plot to Clipboard" ),
_( "Export drawings to clipboard" ) );
SET_BITMAP( copy_button );
choice_plot_fmt->Append( item );
ADD_MENUITEM_WITH_HELP( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD,
_( "Plot to Clipboard" ),
_( "Export drawings to clipboard" ),
copy_button );
#endif // __WINDOWS__
// Plot submenu
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( fileMenu, choice_plot_fmt,
ID_GEN_PLOT, _( "&Plot" ),
_( "Plot schematic sheet in HPGL, PostScript or SVG format" ),
_(
"Plot schematic sheet in HPGL, PostScript or SVG format" ),
plot_xpm );
// Separator
fileMenu->AppendSeparator();
// Quit
item = new wxMenuItem( fileMenu,
wxID_EXIT,
_( "&Quit" ),
_( "Quit EESchema" ) );
SET_BITMAP( exit_xpm );
fileMenu->Append( item );
ADD_MENUITEM_WITH_HELP( fileMenu,
wxID_EXIT,
_( "&Quit" ),
_( "Quit EESchema" ),
exit_xpm );
// Menu Edit:
wxMenu* editMenu = new wxMenu;
......@@ -179,44 +169,39 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Undo
text = AddHotkeyName( _( "Undo" ), s_Schematic_Hokeys_Descr, HK_UNDO );
item = new wxMenuItem( editMenu, wxID_UNDO, text, HELP_UNDO, wxITEM_NORMAL );
SET_BITMAP( undo_xpm );
editMenu->Append( item );
ADD_MENUITEM_WITH_HELP( editMenu, wxID_UNDO, text, HELP_UNDO,
undo_xpm );
// Redo
text = AddHotkeyName( _( "Redo" ), s_Schematic_Hokeys_Descr, HK_REDO );
item = new wxMenuItem( editMenu, wxID_REDO, text, HELP_REDO, wxITEM_NORMAL );
SET_BITMAP( redo_xpm );
editMenu->Append( item );
ADD_MENUITEM_WITH_HELP( editMenu, wxID_REDO, text, HELP_REDO,
redo_xpm );
// Delete
editMenu->AppendSeparator();
item = new wxMenuItem( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT,
_( "Delete" ), HELP_DELETE_ITEMS, wxITEM_NORMAL );
SET_BITMAP( delete_body_xpm );
editMenu->Append( item );
ADD_MENUITEM_WITH_HELP( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT,
_( "Delete" ), HELP_DELETE_ITEMS,
delete_body_xpm );
// Separator
editMenu->AppendSeparator();
// Find
text = AddHotkeyName( _( "&Find" ), s_Schematic_Hokeys_Descr, HK_FIND_ITEM );
item = new wxMenuItem( editMenu, ID_FIND_ITEMS, text, HELP_FIND, wxITEM_NORMAL );
SET_BITMAP( find_xpm );
editMenu->Append( item );
ADD_MENUITEM_WITH_HELP( editMenu, ID_FIND_ITEMS, text, HELP_FIND,
find_xpm );
// Separator
editMenu->AppendSeparator();
// Backannotate
item = new wxMenuItem( editMenu,
ID_BACKANNO_ITEMS,
_( "Backannotate" ),
_( "Back annotated footprint fields" ),
wxITEM_NORMAL );
SET_BITMAP( backanno_xpm );
editMenu->Append( item );
ADD_MENUITEM_WITH_HELP( editMenu,
ID_BACKANNO_ITEMS,
_( "Backannotate" ),
_( "Back annotated footprint fields" ),
backanno_xpm );
// Menu View:
wxMenu* viewMenu = new wxMenu;
......@@ -239,32 +224,28 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Zoom in
text = AddHotkeyName( _( "Zoom In" ), s_Schematic_Hokeys_Descr,
ID_ZOOM_IN, false ); // add comment, not a shortcut
item = new wxMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, wxITEM_NORMAL );
SET_BITMAP( zoom_in_xpm );
viewMenu->Append( item );
ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN,
zoom_in_xpm );
// Zoom out
text = AddHotkeyName( _( "Zoom Out" ), s_Schematic_Hokeys_Descr,
ID_ZOOM_OUT, false ); // add comment, not a shortcut
item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, wxITEM_NORMAL );
SET_BITMAP( zoom_out_xpm );
viewMenu->Append( item );
ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT,
zoom_out_xpm );
// Fit on screen
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 );
SET_BITMAP( zoom_fit_in_page_xpm );
viewMenu->Append( item );
ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT,
zoom_fit_in_page_xpm );
// Separator
viewMenu->AppendSeparator();
// Redraw
text = AddHotkeyName( _( "Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW );
item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, wxITEM_NORMAL );
SET_BITMAP( zoom_redraw_xpm );
viewMenu->Append( item );
ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW,
zoom_redraw_xpm );
// Menu place:
// @todo unify IDs
......@@ -273,90 +254,80 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Component
text = AddHotkeyName( _( "Component" ), s_Schematic_Hokeys_Descr,
HK_ADD_NEW_COMPONENT, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text,
HELP_PLACE_COMPONENTS, wxITEM_NORMAL );
SET_BITMAP( add_component_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu, ID_SCH_PLACE_COMPONENT, text,
HELP_PLACE_COMPONENTS,
add_component_xpm );
// Power port
text = AddHotkeyName( _( "Power port" ), s_Schematic_Hokeys_Descr,
HK_ADD_NEW_POWER, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_PLACE_POWER_BUTT, text,
HELP_PLACE_POWERPORT, wxITEM_NORMAL );
SET_BITMAP( add_power_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu, ID_PLACE_POWER_BUTT, text,
HELP_PLACE_POWERPORT,
add_power_xpm );
// Wire
text = AddHotkeyName( _( "Wire" ), s_Schematic_Hokeys_Descr,
HK_BEGIN_WIRE, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_WIRE_BUTT, text,
HELP_PLACE_WIRE, wxITEM_NORMAL );
SET_BITMAP( add_line_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu, ID_WIRE_BUTT, text,
HELP_PLACE_WIRE,
add_line_xpm );
// Bus
text = AddHotkeyName( _( "Bus" ), s_Schematic_Hokeys_Descr,
HK_BEGIN_BUS, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_BUS_BUTT, text,
HELP_PLACE_BUS, wxITEM_NORMAL );
SET_BITMAP( add_bus_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu, ID_BUS_BUTT, text,
HELP_PLACE_BUS,
add_bus_xpm );
// Wire to Bus entry
text = AddHotkeyName( _( "Wire to bus entry" ), s_Schematic_Hokeys_Descr,
HK_ADD_WIRE_ENTRY, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text,
HELP_PLACE_WIRE2BUS_ENTRY, wxITEM_NORMAL );
SET_BITMAP( add_line2bus_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text,
HELP_PLACE_WIRE2BUS_ENTRY,
add_line2bus_xpm );
// Bus to Bus entry
text = AddHotkeyName( _( "Bus to bus entry" ), s_Schematic_Hokeys_Descr,
HK_ADD_BUS_ENTRY, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text,
HELP_PLACE_BUS2BUS_ENTRY, wxITEM_NORMAL );
SET_BITMAP( add_bus2bus_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text,
HELP_PLACE_BUS2BUS_ENTRY,
add_bus2bus_xpm );
// No connect flag
text = AddHotkeyName( _( "No connect flag" ), s_Schematic_Hokeys_Descr,
HK_ADD_NOCONN_FLAG, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG, wxITEM_NORMAL );
SET_BITMAP( noconn_button );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG,
noconn_button );
// Net name
text = AddHotkeyName( _( "Label" ), s_Schematic_Hokeys_Descr,
HK_ADD_LABEL, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_LABEL_BUTT, text,
HELP_PLACE_NETLABEL, wxITEM_NORMAL );
SET_BITMAP( add_line_label_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu, ID_LABEL_BUTT, text,
HELP_PLACE_NETLABEL,
add_line_label_xpm );
// Global label
text = AddHotkeyName( _( "Global label" ), s_Schematic_Hokeys_Descr,
HK_ADD_GLABEL, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_GLABEL_BUTT, text,
HELP_PLACE_GLOBALLABEL, wxITEM_NORMAL );
SET_BITMAP( add_glabel_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu, ID_GLABEL_BUTT, text,
HELP_PLACE_GLOBALLABEL,
add_glabel_xpm );
// Junction
text = AddHotkeyName( _( "Junction" ), s_Schematic_Hokeys_Descr,
HK_ADD_JUNCTION, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_JUNCTION_BUTT, text,
HELP_PLACE_JUNCTION, wxITEM_NORMAL );
SET_BITMAP( add_junction_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu, ID_JUNCTION_BUTT, text,
HELP_PLACE_JUNCTION,
add_junction_xpm );
// Separator
placeMenu->AppendSeparator();
// Hierarchical label
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
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
ADD_MENUITEM_WITH_HELP( placeMenu, ID_HIERLABEL_BUTT,
text, HELP_PLACE_HIER_LABEL,
add_hierarchical_label_xpm );
......@@ -365,26 +336,23 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Hierarchical sheet
text = AddHotkeyName( _( "Hierarchical sheet" ), s_Schematic_Hokeys_Descr,
HK_ADD_HIER_SHEET, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, text,
HELP_PLACE_SHEET, wxITEM_NORMAL );
SET_BITMAP( add_hierarchical_subsheet_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu, ID_SHEET_SYMBOL_BUTT, text,
HELP_PLACE_SHEET,
add_hierarchical_subsheet_xpm );
// Import hierarchical sheet
item = new wxMenuItem( placeMenu,
ID_IMPORT_HLABEL_BUTT,
_( "Import Hierarchical Label" ),
HELP_IMPORT_SHEETPIN, wxITEM_NORMAL );
SET_BITMAP( import_hierarchical_label_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu,
ID_IMPORT_HLABEL_BUTT,
_( "Import Hierarchical Label" ),
HELP_IMPORT_SHEETPIN,
import_hierarchical_label_xpm );
// Add hierarchical Pin to Sheet
item = new wxMenuItem( placeMenu,
ID_SHEET_PIN_BUTT,
_( "Add Hierarchical Pin to Sheet" ),
HELP_PLACE_SHEETPIN, wxITEM_NORMAL );
SET_BITMAP( add_hierar_pin_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu,
ID_SHEET_PIN_BUTT,
_( "Add Hierarchical Pin to Sheet" ),
HELP_PLACE_SHEETPIN,
add_hierar_pin_xpm );
// Separator
placeMenu->AppendSeparator();
......@@ -392,50 +360,45 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Graphic line or polygon
text = AddHotkeyName( _( "Graphic polyline" ), s_Schematic_Hokeys_Descr,
HK_ADD_GRAPHIC_POLYLINE, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, text,
HELP_PLACE_GRAPHICLINES, wxITEM_NORMAL );
SET_BITMAP( add_dashed_line_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu, ID_LINE_COMMENT_BUTT, text,
HELP_PLACE_GRAPHICLINES,
add_dashed_line_xpm );
// Graphic text
text = AddHotkeyName( _( "Graphic text" ), s_Schematic_Hokeys_Descr,
HK_ADD_GRAPHIC_TEXT, false ); // add comment, not a shortcut
item = new wxMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, text,
HELP_PLACE_GRAPHICTEXTS, wxITEM_NORMAL );
SET_BITMAP( add_text_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu, ID_TEXT_COMMENT_BUTT, text,
HELP_PLACE_GRAPHICTEXTS,
add_text_xpm );
// Menu Preferences:
wxMenu* preferencesMenu = new wxMenu;
// Library
item = new wxMenuItem( preferencesMenu,
ID_CONFIG_REQ,
_( "&Library" ),
_( "Library preferences" ) );
SET_BITMAP( library_xpm );
preferencesMenu->Append( item );
ADD_MENUITEM_WITH_HELP( preferencesMenu,
ID_CONFIG_REQ,
_( "&Library" ),
_( "Library preferences" ),
library_xpm );
// Colors
item = new wxMenuItem( preferencesMenu,
ID_COLORS_SETUP,
_( "&Colors" ),
_( "Color preferences" ) );
SET_BITMAP( palette_xpm );
preferencesMenu->Append( item );
ADD_MENUITEM_WITH_HELP( preferencesMenu,
ID_COLORS_SETUP,
_( "&Colors" ),
_( "Color preferences" ),
palette_xpm );
// Options (Preferences on WXMAC)
item = new wxMenuItem( preferencesMenu,
wxID_PREFERENCES,
ADD_MENUITEM_WITH_HELP( preferencesMenu,
wxID_PREFERENCES,
#ifdef __WXMAC__
_( "&Preferences..." ),
_( "&Preferences..." ),
#else
_( "&Options" ),
_( "&Options" ),
#endif // __WXMAC__
_( "EESchema preferences" ) );
SET_BITMAP( preference_xpm );
preferencesMenu->Append( item );
_( "EESchema preferences" ),
preference_xpm );
// Language submenu
wxGetApp().AddMenuLanguageList( preferencesMenu );
......@@ -447,20 +410,18 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
preferencesMenu->AppendSeparator();
// Save preferences
item = new wxMenuItem( preferencesMenu,
ID_CONFIG_SAVE,
_( "&Save preferences" ),
_( "Save application preferences" ) );
SET_BITMAP( save_setup_xpm );
preferencesMenu->Append( item );
ADD_MENUITEM_WITH_HELP( preferencesMenu,
ID_CONFIG_SAVE,
_( "&Save preferences" ),
_( "Save application preferences" ),
save_setup_xpm );
// Read preferences
item = new wxMenuItem( preferencesMenu,
ID_CONFIG_READ,
_( "&Read preferences" ),
_( "Read application preferences" ) );
SET_BITMAP( read_setup_xpm );
preferencesMenu->Append( item );
ADD_MENUITEM_WITH_HELP( preferencesMenu,
ID_CONFIG_READ,
_( "&Read preferences" ),
_( "Read application preferences" ),
read_setup_xpm );
// Help Menu:
wxMenu* helpMenu = new wxMenu;
......@@ -469,28 +430,26 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
AddHelpVersionInfoMenuEntry( helpMenu );
// Contents
item = new wxMenuItem( helpMenu,
wxID_HELP,
_( "&Contents" ),
_( "Open the Eeschema handbook" ) );
SET_BITMAP( online_help_xpm );
helpMenu->Append( item );
ADD_MENUITEM_WITH_HELP( helpMenu,
wxID_HELP,
_( "&Contents" ),
_( "Open the Eeschema handbook" ),
online_help_xpm );
// About EESchema
item = new wxMenuItem( helpMenu,
wxID_ABOUT,
_( "&About EESchema" ),
_( "About EESchema schematic designer" ) );
SET_BITMAP( info_xpm );
helpMenu->Append( item );
ADD_MENUITEM_WITH_HELP( helpMenu,
wxID_ABOUT,
_( "&About EESchema" ),
_( "About EESchema schematic designer" ),
info_xpm );
// Create the menubar and append all submenus
menuBar->Append( fileMenu, _( "&File" ) );
menuBar->Append( editMenu, _( "&Edit" ) );
menuBar->Append( viewMenu, _( "&View" ) );
menuBar->Append( placeMenu, _( "&Place" ) );
menuBar->Append( fileMenu, _( "&File" ) );
menuBar->Append( editMenu, _( "&Edit" ) );
menuBar->Append( viewMenu, _( "&View" ) );
menuBar->Append( placeMenu, _( "&Place" ) );
menuBar->Append( preferencesMenu, _( "&Preferences" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
menuBar->Append( helpMenu, _( "&Help" ) );
menuBar->Thaw();
......
......@@ -21,17 +21,16 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
{
// Create and try to get the current menubar
wxString text;
wxMenuItem *item;
wxMenuBar *menuBar = GetMenuBar();
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:
......@@ -39,87 +38,75 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
wxMenu* fileMenu = new wxMenu;
// Save current library
item = new wxMenuItem( fileMenu,
ID_LIBEDIT_SAVE_CURRENT_LIB,
_( "&Save Current Library\tCtrl+S" ),
_( "Save the current active library" ) );
SET_BITMAP( save_xpm );
fileMenu->Append( item );
ADD_MENUITEM_WITH_HELP( fileMenu,
ID_LIBEDIT_SAVE_CURRENT_LIB,
_( "&Save Current Library\tCtrl+S" ),
_( "Save the current active library" ),
save_xpm );
// Save current library as...
item = new wxMenuItem( fileMenu,
ID_LIBEDIT_SAVE_CURRENT_LIB_AS,
_( "Save Current Library &as" ),
_( "Save current active library as..." ) );
SET_BITMAP( save_as_xpm );
fileMenu->Append( item );
ADD_MENUITEM_WITH_HELP( fileMenu,
ID_LIBEDIT_SAVE_CURRENT_LIB_AS,
_( "Save Current Library &as" ),
_( "Save current active library as..." ),
save_as_xpm );
// Separator
fileMenu->AppendSeparator();
// Export as png file
item = new wxMenuItem( fileMenu,
ID_LIBEDIT_GEN_PNG_FILE,
_( "&Create PNG File from Screen" ),
_( "Create a PNG file from the component displayed on screen" ) );
SET_BITMAP( plot_xpm );
fileMenu->Append( item );
ADD_MENUITEM_WITH_HELP( fileMenu,
ID_LIBEDIT_GEN_PNG_FILE,
_( "&Create PNG File from Screen" ),
_( "Create a PNG file from the component displayed on screen" ),
plot_xpm );
// Export as SVG file
item = new wxMenuItem( fileMenu,
ID_LIBEDIT_GEN_SVG_FILE,
_( "&Create SVG File" ),
_( "Create a SVG file from the current loaded component" ) );
SET_BITMAP( plot_xpm );
fileMenu->Append( item );
ADD_MENUITEM_WITH_HELP( fileMenu,
ID_LIBEDIT_GEN_SVG_FILE,
_( "&Create SVG File" ),
_( "Create a SVG file from the current loaded component" ),
plot_xpm );
// Separator
fileMenu->AppendSeparator();
// Quit
item = new wxMenuItem( fileMenu,
wxID_EXIT,
_( "&Quit" ),
_( "Quit Library Editor" ) );
SET_BITMAP( exit_xpm );
fileMenu->Append( item );
ADD_MENUITEM_WITH_HELP( fileMenu,
wxID_EXIT,
_( "&Quit" ),
_( "Quit Library Editor" ),
exit_xpm );
// Edit menu
wxMenu* editMenu = new wxMenu;
// 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 );
SET_BITMAP( undo_xpm );
editMenu->Append( item );
ADD_MENUITEM_WITH_HELP( editMenu,
wxID_UNDO,
text,
_( "Undo last edition" ),
undo_xpm );
// Redo
text = AddHotkeyName( _( "Redo" ), s_Libedit_Hokeys_Descr, HK_REDO);
item = new wxMenuItem( editMenu,
wxID_REDO,
text,
_( "Redo the last undo command" ),
wxITEM_NORMAL );
SET_BITMAP( redo_xpm );
editMenu->Append( item );
text = AddHotkeyName( _( "Redo" ), s_Libedit_Hokeys_Descr, HK_REDO );
ADD_MENUITEM_WITH_HELP( editMenu,
wxID_REDO,
text,
_( "Redo the last undo command" ),
redo_xpm );
// Separator
editMenu->AppendSeparator();
// Delete
item = new wxMenuItem( editMenu,
ID_LIBEDIT_DELETE_ITEM_BUTT,
_( "Delete" ),
HELP_DELETE_ITEMS,
wxITEM_NORMAL );
SET_BITMAP( delete_body_xpm );
editMenu->Append( item );
ADD_MENUITEM_WITH_HELP( editMenu,
ID_LIBEDIT_DELETE_ITEM_BUTT,
_( "Delete" ),
HELP_DELETE_ITEMS,
delete_body_xpm );
// Menu View:
wxMenu* viewMenu = new wxMenu;
......@@ -138,109 +125,89 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
*/
// Zoom in
text =_( "Zoom In" );
item = new wxMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, wxITEM_NORMAL );
SET_BITMAP( zoom_in_xpm );
viewMenu->Append( item );
text = _( "Zoom In" );
ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN,
zoom_in_xpm );
// Zoom out
text = _( "Zoom Out" );
item = new wxMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, wxITEM_NORMAL );
SET_BITMAP( zoom_out_xpm );
viewMenu->Append( item );
ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT,
zoom_out_xpm );
// Fit on screen
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 );
SET_BITMAP( zoom_fit_in_page_xpm );
viewMenu->Append( item );
ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT,
zoom_fit_in_page_xpm );
// Separator
viewMenu->AppendSeparator();
// Redraw
text = AddHotkeyName( _( "Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW );
item = new wxMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, wxITEM_NORMAL );
SET_BITMAP( zoom_redraw_xpm );
viewMenu->Append( item );
ADD_MENUITEM_WITH_HELP( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW,
zoom_redraw_xpm );
// Menu Place:
wxMenu* placeMenu = new wxMenu;
// Pin
item = new wxMenuItem( placeMenu,
ID_LIBEDIT_PIN_BUTT,
_( "&Pin" ),
HELP_ADD_PIN,
wxITEM_NORMAL );
SET_BITMAP( pin_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu,
ID_LIBEDIT_PIN_BUTT,
_( "&Pin" ),
HELP_ADD_PIN,
pin_xpm );
// Graphic text
item = new wxMenuItem( placeMenu,
ID_LIBEDIT_BODY_TEXT_BUTT,
_( "Graphic text" ),
HELP_ADD_BODYTEXT,
wxITEM_NORMAL );
SET_BITMAP( add_text_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu,
ID_LIBEDIT_BODY_TEXT_BUTT,
_( "Graphic text" ),
HELP_ADD_BODYTEXT,
add_text_xpm );
// Graphic rectangle
item = new wxMenuItem( placeMenu,
ID_LIBEDIT_BODY_RECT_BUTT,
_( "Rectangle" ),
HELP_ADD_BODYRECT,
wxITEM_NORMAL );
SET_BITMAP( add_rectangle_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu,
ID_LIBEDIT_BODY_RECT_BUTT,
_( "Rectangle" ),
HELP_ADD_BODYRECT,
add_rectangle_xpm );
// Graphic Circle
item = new wxMenuItem( placeMenu,
ID_LIBEDIT_BODY_CIRCLE_BUTT,
_( "Circle" ),
HELP_ADD_BODYCIRCLE,
wxITEM_NORMAL );
SET_BITMAP( add_circle_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu,
ID_LIBEDIT_BODY_CIRCLE_BUTT,
_( "Circle" ),
HELP_ADD_BODYCIRCLE,
add_circle_xpm );
// Graphic Arc
item = new wxMenuItem( placeMenu,
ID_LIBEDIT_BODY_ARC_BUTT,
_( "Arc" ),
HELP_ADD_BODYARC,
wxITEM_NORMAL );
SET_BITMAP( add_arc_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu,
ID_LIBEDIT_BODY_ARC_BUTT,
_( "Arc" ),
HELP_ADD_BODYARC,
add_arc_xpm );
// Graphic Line or Polygon
item = new wxMenuItem( placeMenu,
ID_LIBEDIT_BODY_LINE_BUTT,
_( "Line or Polygon" ),
HELP_ADD_BODYPOLYGON,
wxITEM_NORMAL );
SET_BITMAP( add_polygon_xpm );
placeMenu->Append( item );
ADD_MENUITEM_WITH_HELP( placeMenu,
ID_LIBEDIT_BODY_LINE_BUTT,
_( "Line or Polygon" ),
HELP_ADD_BODYPOLYGON,
add_polygon_xpm );
// Menu Preferences:
wxMenu* preferencesMenu = new wxMenu;
// Library
item = new wxMenuItem( preferencesMenu,
ID_CONFIG_REQ,
_( "&Library" ),
_( "Library preferences" ) );
SET_BITMAP( library_xpm );
preferencesMenu->Append( item );
ADD_MENUITEM_WITH_HELP( preferencesMenu,
ID_CONFIG_REQ,
_( "&Library" ),
_( "Library preferences" ),
library_xpm );
// Colors
item = new wxMenuItem( preferencesMenu,
ID_COLORS_SETUP,
_( "&Colors" ),
_( "Color preferences" ) );
SET_BITMAP( palette_xpm );
preferencesMenu->Append( item );
ADD_MENUITEM_WITH_HELP( preferencesMenu,
ID_COLORS_SETUP,
_( "&Colors" ),
_( "Color preferences" ),
palette_xpm );
// Language submenu
wxGetApp().AddMenuLanguageList( preferencesMenu );
......@@ -252,20 +219,18 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
preferencesMenu->AppendSeparator();
// Save preferences
item = new wxMenuItem( preferencesMenu,
ID_CONFIG_SAVE,
_( "&Save preferences" ),
_( "Save application preferences" ) );
SET_BITMAP( save_setup_xpm );
preferencesMenu->Append( item );
ADD_MENUITEM_WITH_HELP( preferencesMenu,
ID_CONFIG_SAVE,
_( "&Save preferences" ),
_( "Save application preferences" ),
save_setup_xpm );
// Read preferences
item = new wxMenuItem( preferencesMenu,
ID_CONFIG_READ,
_( "&Read preferences" ),
_( "Read application preferences" ) );
SET_BITMAP( read_setup_xpm );
preferencesMenu->Append( item );
ADD_MENUITEM_WITH_HELP( preferencesMenu,
ID_CONFIG_READ,
_( "&Read preferences" ),
_( "Read application preferences" ),
read_setup_xpm );
// Menu Help:
wxMenu* helpMenu = new wxMenu;
......@@ -273,13 +238,19 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
// Version info
AddHelpVersionInfoMenuEntry( helpMenu );
// Contens
item = new wxMenuItem( helpMenu,
wxID_HELP,
_( "&Contents" ),
_( "Open the eeschema manual" ) );
SET_BITMAP( online_help_xpm );
helpMenu->Append( item );
// Contents
ADD_MENUITEM_WITH_HELP( helpMenu,
wxID_HELP,
_( "&Contents" ),
_( "Open the eeschema manual" ),
online_help_xpm );
// About EESchema
ADD_MENUITEM_WITH_HELP( helpMenu,
wxID_ABOUT,
_( "&About EESchema" ),
_( "About EESchema schematic designer" ),
info_xpm );
// Create the menubar and append all submenus
menuBar->Append( fileMenu, _( "&File" ) );
......
......@@ -144,6 +144,8 @@ void DeleteItemsInList( EDA_DRAW_PANEL* panel, PICKED_ITEMS_LIST& aItemsList )
void SCH_EDIT_FRAME::DeleteItem( SCH_ITEM* aItem )
{
wxCHECK_RET( aItem != NULL, wxT( "Cannot delete invalid item." ) );
if( aItem == NULL )
return;
SCH_SCREEN* screen = GetScreen();
......
......@@ -103,6 +103,7 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
}
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
item = screen->GetCurItem(); // Can be modified by previous calls.
switch( id )
{
......
......@@ -101,7 +101,7 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_POPUP_SCH_MOVE_ITEM, SCH_EDIT_FRAME::OnMoveItem )
EVT_MENU( wxID_HELP, EDA_DRAW_FRAME::GetKicadHelp )
EVT_MENU( wxID_ABOUT, EDA_DRAW_FRAME::GetKicadAbout )
EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout )
// Tools and buttons for vertical toolbar.
EVT_TOOL( ID_CANCEL_CURRENT_COMMAND, SCH_EDIT_FRAME::OnCancelCurrentCommand )
......
......@@ -328,7 +328,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& FileName )
GetScreen()->GetFileName(), PcbFileWildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
if( dlg.ShowModal() != wxID_OK )
return false;
GetScreen()->SetFileName( dlg.GetPath() );
......
......@@ -156,7 +156,8 @@ Changing extension to .brd." ), GetChars( fn.GetFullPath() ) );
frame->GetScreen()->SetFileName( fn.GetFullPath( wxPATH_UNIX ) );
frame->SetTitle( frame->GetScreen()->GetFileName() );
frame->UpdateFileHistory( frame->GetScreen()->GetFileName() );
frame->OnModify(); // Ready to save the new empty board
frame->OnModify(); // Ready to save the new empty board
g_SaveTime = time( NULL ); // Init the time out to save the board
wxString msg;
msg.Printf( _( "File <%s> does not exist.\nThis is normal for a new project" ),
......
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