You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

673 lines
24 KiB

11 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
  6. * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, you may find one here:
  20. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  21. * or you may search the http://www.gnu.org website for the version 2 license,
  22. * or you may write to the Free Software Foundation, Inc.,
  23. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  24. */
  25. /**
  26. * @file eeschema/menubar.cpp
  27. * @brief (Re)Create the main menubar for the schematic frame
  28. */
  29. #include <kiface_i.h>
  30. #include <menus_helpers.h>
  31. #include <pgm_base.h>
  32. #include "eeschema_id.h"
  33. #include "general.h"
  34. #include "help_common_strings.h"
  35. #include "hotkeys.h"
  36. #include "sch_edit_frame.h"
  37. // helper functions that build specific submenus:
  38. // Build the place submenu
  39. static void preparePlaceMenu( wxMenu* aParentMenu );
  40. // Build the files menu. Because some commands are available only if
  41. // Eeschemat is run outside a project (run alone), aIsOutsideProject is false
  42. // when Eeschema is run from Kicad manager, and true is run as stand alone app.
  43. static void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject );
  44. // Build the tools menu
  45. static void prepareToolsMenu( wxMenu* aParentMenu );
  46. // Build the help menu
  47. static void prepareHelpMenu( wxMenu* aParentMenu );
  48. // Build the import/export submenu
  49. static void prepareImportExportMenu( wxMenu* aParentMenu );
  50. // Build the edit menu
  51. static void prepareEditMenu( wxMenu* aParentMenu );
  52. // Build the view menu
  53. static void prepareViewMenu( wxMenu* aParentMenu );
  54. // Build the preferences menu
  55. static void preparePreferencesMenu( SCH_EDIT_FRAME* aFrame, wxMenu* aParentMenu );
  56. void SCH_EDIT_FRAME::ReCreateMenuBar()
  57. {
  58. // Create and try to get the current menubar
  59. wxString text;
  60. wxMenuBar* menuBar = GetMenuBar();
  61. if( !menuBar )
  62. menuBar = new wxMenuBar();
  63. // Delete all existing menus so they can be rebuilt.
  64. // This allows language changes of the menu text on the fly.
  65. menuBar->Freeze();
  66. while( menuBar->GetMenuCount() )
  67. delete menuBar->Remove( 0 );
  68. // Recreate all menus:
  69. // Menu File:
  70. wxMenu* fileMenu = new wxMenu;
  71. prepareFilesMenu( fileMenu, Kiface().IsSingle() );
  72. // Menu Edit:
  73. wxMenu* editMenu = new wxMenu;
  74. prepareEditMenu( editMenu );
  75. // Menu View:
  76. wxMenu* viewMenu = new wxMenu;
  77. prepareViewMenu( viewMenu );
  78. // Menu place:
  79. wxMenu* placeMenu = new wxMenu;
  80. preparePlaceMenu( placeMenu );
  81. // Menu Preferences:
  82. wxMenu* preferencesMenu = new wxMenu;
  83. preparePreferencesMenu( this, preferencesMenu );
  84. // Menu Tools:
  85. wxMenu* toolsMenu = new wxMenu;
  86. prepareToolsMenu( toolsMenu );
  87. // Help Menu:
  88. wxMenu* helpMenu = new wxMenu;
  89. prepareHelpMenu( helpMenu );
  90. // Create the menubar and append all submenus
  91. menuBar->Append( fileMenu, _( "&File" ) );
  92. menuBar->Append( editMenu, _( "&Edit" ) );
  93. menuBar->Append( viewMenu, _( "&View" ) );
  94. menuBar->Append( placeMenu, _( "&Place" ) );
  95. menuBar->Append( preferencesMenu, _( "P&references" ) );
  96. menuBar->Append( toolsMenu, _( "&Tools" ) );
  97. menuBar->Append( helpMenu, _( "&Help" ) );
  98. menuBar->Thaw();
  99. // Associate the menu bar with the frame, if no previous menubar
  100. if( GetMenuBar() == NULL )
  101. SetMenuBar( menuBar );
  102. else
  103. menuBar->Refresh();
  104. }
  105. void prepareViewMenu( wxMenu* aParentMenu )
  106. {
  107. wxString text;
  108. /**
  109. * Important Note for ZOOM IN and ZOOM OUT commands from menubar:
  110. * we cannot add hotkey shortcut here, because the hotkey HK_ZOOM_IN and HK_ZOOM_OUT
  111. * events(default = WXK_F1 and WXK_F2) are *NOT* equivalent to this menu command:
  112. * zoom in and out from hotkeys are equivalent to the pop up menu zoom
  113. * From here, zooming is made around the screen center
  114. * From hotkeys, zooming is made around the mouse cursor position
  115. * (obviously not possible from the toolbar or menubar command)
  116. *
  117. * in others words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators
  118. * for Zoom in and Zoom out sub menus
  119. * SO WE ADD THE NAME OF THE CORRESPONDING HOTKEY AS A COMMENT, NOT AS A SHORTCUT
  120. * using in AddHotkeyName call the option "false" (not a shortcut)
  121. */
  122. text = AddHotkeyName( _( "Zoom &In" ), g_Schematic_Hokeys_Descr,
  123. HK_ZOOM_IN, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  124. AddMenuItem( aParentMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) );
  125. text = AddHotkeyName( _( "Zoom &Out" ), g_Schematic_Hokeys_Descr,
  126. HK_ZOOM_OUT, IS_ACCELERATOR ); // add accelerator, not a shortcut
  127. AddMenuItem( aParentMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) );
  128. text = AddHotkeyName( _( "&Fit on Screen" ), g_Schematic_Hokeys_Descr, HK_ZOOM_AUTO );
  129. AddMenuItem( aParentMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, KiBitmap( zoom_fit_in_page_xpm ) );
  130. text = AddHotkeyName( _( "&Redraw" ), g_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW );
  131. AddMenuItem( aParentMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) );
  132. aParentMenu->AppendSeparator();
  133. AddMenuItem( aParentMenu,
  134. ID_HIERARCHY,
  135. _( "Show &Hierarchical Navigator" ),
  136. _( "Navigate hierarchical sheets" ),
  137. KiBitmap( hierarchy_nav_xpm ) );
  138. text = AddHotkeyName( _( "&Leave Sheet" ), g_Schematic_Hokeys_Descr, HK_LEAVE_SHEET );
  139. AddMenuItem( aParentMenu,
  140. ID_POPUP_SCH_LEAVE_SHEET,
  141. text,
  142. _( "Leave Sheet" ),
  143. KiBitmap( leave_sheet_xpm ) );
  144. }
  145. void preparePlaceMenu( wxMenu* aParentMenu )
  146. {
  147. wxString text;
  148. text = AddHotkeyName( _( "&Symbol" ), g_Schematic_Hokeys_Descr,
  149. HK_ADD_NEW_COMPONENT, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  150. AddMenuItem( aParentMenu, ID_SCH_PLACE_COMPONENT, text,
  151. HELP_PLACE_COMPONENTS,
  152. KiBitmap( add_component_xpm ) );
  153. text = AddHotkeyName( _( "&Power Port" ), g_Schematic_Hokeys_Descr,
  154. HK_ADD_NEW_POWER, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  155. AddMenuItem( aParentMenu, ID_PLACE_POWER_BUTT, text,
  156. HELP_PLACE_POWERPORT,
  157. KiBitmap( add_power_xpm ) );
  158. text = AddHotkeyName( _( "&Wire" ), g_Schematic_Hokeys_Descr,
  159. HK_BEGIN_WIRE, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  160. AddMenuItem( aParentMenu, ID_WIRE_BUTT, text,
  161. HELP_PLACE_WIRE,
  162. KiBitmap( add_line_xpm ) );
  163. text = AddHotkeyName( _( "&Bus" ), g_Schematic_Hokeys_Descr,
  164. HK_BEGIN_BUS, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  165. AddMenuItem( aParentMenu, ID_BUS_BUTT, text,
  166. HELP_PLACE_BUS,
  167. KiBitmap( add_bus_xpm ) );
  168. text = AddHotkeyName( _( "Wire to Bus &Entry" ), g_Schematic_Hokeys_Descr,
  169. HK_ADD_WIRE_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  170. AddMenuItem( aParentMenu, ID_WIRETOBUS_ENTRY_BUTT, text,
  171. HELP_PLACE_WIRE2BUS_ENTRY,
  172. KiBitmap( add_line2bus_xpm ) );
  173. text = AddHotkeyName( _( "Bus &to Bus Entry" ), g_Schematic_Hokeys_Descr,
  174. HK_ADD_BUS_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  175. AddMenuItem( aParentMenu, ID_BUSTOBUS_ENTRY_BUTT, text,
  176. HELP_PLACE_BUS2BUS_ENTRY,
  177. KiBitmap( add_bus2bus_xpm ) );
  178. text = AddHotkeyName( _( "&No Connect Flag" ), g_Schematic_Hokeys_Descr,
  179. HK_ADD_NOCONN_FLAG, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  180. AddMenuItem( aParentMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG, KiBitmap( noconn_xpm ) );
  181. text = AddHotkeyName( _( "&Junction" ), g_Schematic_Hokeys_Descr,
  182. HK_ADD_JUNCTION, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  183. AddMenuItem( aParentMenu, ID_JUNCTION_BUTT, text,
  184. HELP_PLACE_JUNCTION,
  185. KiBitmap( add_junction_xpm ) );
  186. text = AddHotkeyName( _( "&Label" ), g_Schematic_Hokeys_Descr,
  187. HK_ADD_LABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  188. AddMenuItem( aParentMenu, ID_LABEL_BUTT, text,
  189. HELP_PLACE_NETLABEL,
  190. KiBitmap( add_line_label_xpm ) );
  191. text = AddHotkeyName( _( "Gl&obal Label" ), g_Schematic_Hokeys_Descr,
  192. HK_ADD_GLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  193. AddMenuItem( aParentMenu, ID_GLABEL_BUTT, text,
  194. HELP_PLACE_GLOBALLABEL,
  195. KiBitmap( add_glabel_xpm ) );
  196. aParentMenu->AppendSeparator();
  197. text = AddHotkeyName( _( "&Hierarchical Label" ), g_Schematic_Hokeys_Descr,
  198. HK_ADD_HLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  199. AddMenuItem( aParentMenu, ID_HIERLABEL_BUTT,
  200. text, HELP_PLACE_HIER_LABEL,
  201. KiBitmap( add_hierarchical_label_xpm ) );
  202. text = AddHotkeyName( _( "Hierar&chical Sheet" ), g_Schematic_Hokeys_Descr,
  203. HK_ADD_HIER_SHEET, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  204. AddMenuItem( aParentMenu, ID_SHEET_SYMBOL_BUTT, text,
  205. HELP_PLACE_SHEET,
  206. KiBitmap( add_hierarchical_subsheet_xpm ) );
  207. AddMenuItem( aParentMenu,
  208. ID_IMPORT_HLABEL_BUTT,
  209. _( "I&mport Hierarchical Label" ),
  210. HELP_IMPORT_SHEETPIN,
  211. KiBitmap( import_hierarchical_label_xpm ) );
  212. AddMenuItem( aParentMenu,
  213. ID_SHEET_PIN_BUTT,
  214. _( "Hierarchical Pi&n to Sheet" ),
  215. HELP_PLACE_SHEETPIN,
  216. KiBitmap( add_hierar_pin_xpm ) );
  217. aParentMenu->AppendSeparator();
  218. text = AddHotkeyName( _( "Graphic Pol&yline" ), g_Schematic_Hokeys_Descr,
  219. HK_ADD_GRAPHIC_POLYLINE, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  220. AddMenuItem( aParentMenu, ID_LINE_COMMENT_BUTT, text,
  221. HELP_PLACE_GRAPHICLINES,
  222. KiBitmap( add_dashed_line_xpm ) );
  223. text = AddHotkeyName( _( "&Graphic Text" ), g_Schematic_Hokeys_Descr,
  224. HK_ADD_GRAPHIC_TEXT, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  225. AddMenuItem( aParentMenu, ID_TEXT_COMMENT_BUTT, text,
  226. HELP_PLACE_GRAPHICTEXTS,
  227. KiBitmap( text_xpm ) );
  228. // Add graphic image
  229. AddMenuItem( aParentMenu, ID_ADD_IMAGE_BUTT, _( "&Image" ),
  230. HELP_PLACE_GRAPHICIMAGES,
  231. KiBitmap( image_xpm ) );
  232. }
  233. void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject )
  234. {
  235. wxString text;
  236. if( aIsOutsideProject ) // not when under a project mgr
  237. {
  238. AddMenuItem( aParentMenu,
  239. ID_NEW_PROJECT,
  240. _( "&New" ),
  241. _( "Clear current schematic hierarchy and start new schematic root sheet" ),
  242. KiBitmap( new_document_xpm ) );
  243. text = AddHotkeyName( _( "&Open" ), g_Schematic_Hokeys_Descr, HK_LOAD_SCH );
  244. AddMenuItem( aParentMenu,
  245. ID_LOAD_PROJECT, text,
  246. _( "Open existing schematic" ),
  247. KiBitmap( open_document_xpm ) );
  248. }
  249. // @todo: static probably not OK in multiple open projects.
  250. // Open Recent submenu
  251. static wxMenu* openRecentMenu;
  252. // Add this menu to list menu managed by m_fileHistory
  253. // (the file history will be updated when adding/removing files in history
  254. if( openRecentMenu )
  255. Kiface().GetFileHistory().RemoveMenu( openRecentMenu );
  256. openRecentMenu = new wxMenu();
  257. Kiface().GetFileHistory().UseMenu( openRecentMenu );
  258. Kiface().GetFileHistory().AddFilesToMenu( openRecentMenu );
  259. if( Kiface().IsSingle() ) // not when under a project mgr
  260. {
  261. AddMenuItem( aParentMenu, openRecentMenu,
  262. wxID_ANY, _( "Open &Recent" ),
  263. _( "Open recently opened schematic" ),
  264. KiBitmap( recent_xpm ) );
  265. }
  266. AddMenuItem( aParentMenu,
  267. ID_APPEND_PROJECT, _( "App&end Schematic Sheet" ),
  268. _( "Import schematic sheet content from another project to current sheet" ),
  269. KiBitmap( add_document_xpm ) );
  270. AddMenuItem( aParentMenu,
  271. ID_IMPORT_NON_KICAD_SCH, _( "&Import Non-Kicad Schematic File" ),
  272. _( "Import schematic file from other applications" ),
  273. KiBitmap( import_document_xpm ) ); // TODO needs a different icon
  274. aParentMenu->AppendSeparator();
  275. text = AddHotkeyName( _( "&Save" ),
  276. g_Schematic_Hokeys_Descr, HK_SAVE_SCH );
  277. AddMenuItem( aParentMenu,
  278. ID_SAVE_PROJECT, text,
  279. _( "Save all sheets in schematic" ),
  280. KiBitmap( save_xpm ) );
  281. AddMenuItem( aParentMenu,
  282. ID_UPDATE_ONE_SHEET,
  283. _( "Save &Current Sheet" ),
  284. _( "Save only current schematic sheet" ),
  285. KiBitmap( save_xpm ) );
  286. if( aIsOutsideProject ) // not when under a project mgr
  287. {
  288. AddMenuItem( aParentMenu,
  289. ID_SAVE_ONE_SHEET_UNDER_NEW_NAME,
  290. _( "Save C&urrent Sheet As" ),
  291. _( "Save current schematic sheet with new name" ),
  292. KiBitmap( save_as_xpm ) );
  293. }
  294. aParentMenu->AppendSeparator();
  295. // Edit page layout:
  296. AddMenuItem( aParentMenu, ID_SHEET_SET,
  297. _( "Pa&ge Settings" ),
  298. _( "Settings for sheet size and frame references" ),
  299. KiBitmap( sheetset_xpm ) );
  300. AddMenuItem( aParentMenu,
  301. wxID_PRINT,
  302. _( "Pri&nt" ),
  303. _( "Print schematic sheet" ),
  304. KiBitmap( print_button_xpm ) );
  305. // Plot submenu
  306. wxMenu* choice_plot_fmt = new wxMenu;
  307. AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_SCHEMATIC, _( "&Plot" ),
  308. _( "Plot schematic sheet in PostScript, PDF, SVG, DXF or HPGL format" ),
  309. KiBitmap( plot_xpm ) );
  310. // Plot to Clipboard
  311. AddMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD,
  312. _( "Plot to C&lipboard" ),
  313. _( "Export drawings to clipboard" ),
  314. KiBitmap( copy_xpm ) );
  315. // Add plot submenu
  316. AddMenuItem( aParentMenu, choice_plot_fmt,
  317. ID_GEN_PLOT, _( "&Plot" ),
  318. _( "Plot schematic sheet in HPGL, PostScript or SVG format" ),
  319. KiBitmap( plot_xpm ) );
  320. // Quit
  321. aParentMenu->AppendSeparator();
  322. AddMenuItem( aParentMenu, wxID_EXIT, _( "&Close" ), _( "Close Eeschema" ),
  323. KiBitmap( exit_xpm ) );
  324. }
  325. void prepareEditMenu( wxMenu* aParentMenu )
  326. {
  327. wxString text;
  328. // Undo
  329. text = AddHotkeyName( _( "&Undo" ), g_Schematic_Hokeys_Descr, HK_UNDO );
  330. AddMenuItem( aParentMenu, wxID_UNDO, text, HELP_UNDO, KiBitmap( undo_xpm ) );
  331. // Redo
  332. text = AddHotkeyName( _( "&Redo" ), g_Schematic_Hokeys_Descr, HK_REDO );
  333. AddMenuItem( aParentMenu, wxID_REDO, text, HELP_REDO, KiBitmap( redo_xpm ) );
  334. // Delete
  335. aParentMenu->AppendSeparator();
  336. AddMenuItem( aParentMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT,
  337. _( "&Delete" ), HELP_DELETE_ITEMS,
  338. KiBitmap( delete_xpm ) );
  339. // Find
  340. aParentMenu->AppendSeparator();
  341. text = AddHotkeyName( _( "&Find" ), g_Schematic_Hokeys_Descr, HK_FIND_ITEM );
  342. AddMenuItem( aParentMenu, ID_FIND_ITEMS, text, HELP_FIND, KiBitmap( find_xpm ) );
  343. // Find/Replace
  344. text = AddHotkeyName( _( "Find and Re&place" ), g_Schematic_Hokeys_Descr,
  345. HK_FIND_REPLACE );
  346. AddMenuItem( aParentMenu, wxID_REPLACE, text, HELP_REPLACE,
  347. KiBitmap( find_replace_xpm ) );
  348. // Import footprint association .cmp file which can be created by Pcbnew:
  349. aParentMenu->AppendSeparator();
  350. AddMenuItem( aParentMenu, ID_BACKANNO_ITEMS,
  351. _( "Import Footprint Association File" ),
  352. HELP_IMPORT_FOOTPRINTS,
  353. KiBitmap( import_footprint_names_xpm ) );
  354. // Update field values
  355. AddMenuItem( aParentMenu, ID_UPDATE_FIELDS,
  356. _( "Update Field Values" ),
  357. _( "Sets symbol fields to original library values" ),
  358. KiBitmap( update_fields_xpm ) );
  359. // Edit components to symbols library links (change LIB_ID values)
  360. aParentMenu->AppendSeparator();
  361. AddMenuItem( aParentMenu, ID_EDIT_COMPONENTS_TO_SYMBOLS_LIB_ID,
  362. _( "Edit Symbol Library Links" ),
  363. _( "Edit schematic symbol's symbol library links" ),
  364. KiBitmap( edit_cmp_symb_links_xpm ) );
  365. }
  366. void prepareToolsMenu( wxMenu* aParentMenu )
  367. {
  368. wxString text;
  369. text = AddHotkeyName( _( "Update PCB from Schematic" ), g_Schematic_Hokeys_Descr,
  370. HK_UPDATE_PCB_FROM_SCH );
  371. AddMenuItem( aParentMenu,
  372. ID_UPDATE_PCB_FROM_SCH,
  373. text, _( "Updates PCB design with current schematic (forward annotation)." ),
  374. KiBitmap( import_brd_file_xpm ) );
  375. // Run Pcbnew
  376. AddMenuItem( aParentMenu,
  377. ID_RUN_PCB,
  378. _( "&Open PCB Editor" ),
  379. _( "Run Pcbnew" ),
  380. KiBitmap( pcbnew_xpm ) );
  381. aParentMenu->AppendSeparator();
  382. AddMenuItem( aParentMenu,
  383. ID_RUN_LIBRARY,
  384. _( "Library &Editor" ), HELP_RUN_LIB_EDITOR,
  385. KiBitmap( libedit_xpm ) );
  386. AddMenuItem( aParentMenu,
  387. ID_TO_LIBVIEW,
  388. _( "Library &Browser" ), HELP_RUN_LIB_VIEWER,
  389. KiBitmap( library_browse_xpm ) );
  390. AddMenuItem( aParentMenu,
  391. ID_RESCUE_CACHED,
  392. _( "&Rescue Symbols" ),
  393. _( "Find old symbols in project and rename/rescue them" ),
  394. KiBitmap( rescue_xpm ) );
  395. AddMenuItem( aParentMenu,
  396. ID_REMAP_SYMBOLS,
  397. _( "Remap Symbols" ),
  398. _( "Remap legacy library symbols to symbol library table" ),
  399. KiBitmap( rescue_xpm ) );
  400. aParentMenu->AppendSeparator();
  401. AddMenuItem( aParentMenu,
  402. ID_GET_ANNOTATE,
  403. _( "&Annotate Schematic" ), HELP_ANNOTATE,
  404. KiBitmap( annotate_xpm ) );
  405. // ERC
  406. AddMenuItem( aParentMenu,
  407. ID_GET_ERC,
  408. _( "Electrical Rules &Checker" ),
  409. _( "Perform electrical rules check" ),
  410. KiBitmap( erc_xpm ) );
  411. AddMenuItem( aParentMenu,
  412. ID_GET_NETLIST,
  413. _( "Generate &Netlist File" ),
  414. _( "Generate netlist file" ),
  415. KiBitmap( netlist_xpm ) );
  416. AddMenuItem( aParentMenu,
  417. ID_OPEN_CMP_TABLE,
  418. _( "Symbol Table &View" ),
  419. KiBitmap( spreadsheet_xpm ) );
  420. AddMenuItem( aParentMenu,
  421. ID_GET_TOOLS,
  422. _( "Generate Bill of &Materials" ),
  423. HELP_GENERATE_BOM,
  424. KiBitmap( bom_xpm ) );
  425. aParentMenu->AppendSeparator();
  426. // Run CvPcb
  427. AddMenuItem( aParentMenu,
  428. ID_RUN_CVPCB,
  429. _( "A&ssign Footprint" ),
  430. _( "Run CvPcb" ),
  431. KiBitmap( cvpcb_xpm ) );
  432. aParentMenu->AppendSeparator();
  433. #ifdef KICAD_SPICE
  434. // Simulator
  435. AddMenuItem( aParentMenu,
  436. ID_SIM_SHOW,
  437. _("Simula&tor"), _( "Simulate circuit" ),
  438. KiBitmap( simulator_xpm ) );
  439. #endif /* KICAD_SPICE */
  440. }
  441. void prepareHelpMenu( wxMenu* aParentMenu )
  442. {
  443. AddMenuItem( aParentMenu,
  444. wxID_HELP,
  445. _( "Eeschema &Manual" ),
  446. _( "Open Eeschema Manual" ),
  447. KiBitmap( online_help_xpm ) );
  448. AddMenuItem( aParentMenu,
  449. wxID_INDEX,
  450. _( "&Getting Started in KiCad" ),
  451. _( "Open \"Getting Started in KiCad\" guide for beginners" ),
  452. KiBitmap( help_xpm ) );
  453. AddMenuItem( aParentMenu,
  454. ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
  455. _( "&List Hotkeys" ),
  456. _( "Displays current hotkeys list and corresponding commands" ),
  457. KiBitmap( hotkeys_xpm ) );
  458. aParentMenu->AppendSeparator();
  459. AddMenuItem( aParentMenu, ID_HELP_GET_INVOLVED,
  460. _( "Get &Involved" ),
  461. _( "Contribute to KiCad (open web browser)" ),
  462. KiBitmap( info_xpm ) );
  463. aParentMenu->AppendSeparator();
  464. AddMenuItem( aParentMenu,
  465. wxID_ABOUT,
  466. _( "&About KiCad" ),
  467. _( "About KiCad" ),
  468. KiBitmap( about_xpm ) );
  469. }
  470. void prepareImportExportMenu( wxMenu* aParentMenu )
  471. {
  472. AddMenuItem( aParentMenu,
  473. ID_CONFIG_SAVE,
  474. _( "&Save Preferences" ),
  475. _( "Save application preferences" ),
  476. KiBitmap( save_setup_xpm ) );
  477. AddMenuItem( aParentMenu,
  478. ID_CONFIG_READ,
  479. _( "Load Prefe&rences" ),
  480. _( "Load application preferences" ),
  481. KiBitmap( import_setup_xpm ) );
  482. aParentMenu->AppendSeparator();
  483. AddMenuItem( aParentMenu,
  484. ID_PREFERENCES_HOTKEY_EXPORT_CONFIG,
  485. _( "E&xport Hotkeys" ),
  486. _( "Create hotkey configuration file with current hotkeys" ),
  487. KiBitmap( hotkeys_export_xpm ) );
  488. AddMenuItem( aParentMenu,
  489. ID_PREFERENCES_HOTKEY_IMPORT_CONFIG,
  490. _( "&Import Hotkeys" ),
  491. _( "Load existing hotkey configuration file" ),
  492. KiBitmap( hotkeys_import_xpm ) );
  493. }
  494. static void preparePreferencesMenu( SCH_EDIT_FRAME* aFrame, wxMenu* aParentMenu )
  495. {
  496. // Library
  497. AddMenuItem( aParentMenu,
  498. ID_EDIT_SYM_LIB_TABLE,
  499. _( "Manage Symbol Library Tables" ),
  500. _( "Edit the global and project symbol library tables (list of active libraries)." ),
  501. KiBitmap( library_table_xpm ) );
  502. // Path configuration edit dialog.
  503. AddMenuItem( aParentMenu,
  504. ID_PREFERENCES_CONFIGURE_PATHS,
  505. _( "Configure &Paths" ),
  506. _( "Edit path configuration environment variables" ),
  507. KiBitmap( path_xpm ) );
  508. // Options (Preferences on WXMAC)
  509. #ifdef __WXMAC__
  510. aParentMenu->Append( wxID_PREFERENCES );
  511. #else
  512. AddMenuItem( aParentMenu,
  513. wxID_PREFERENCES,
  514. _( "General &Options" ),
  515. _( "Edit Eeschema preferences" ),
  516. KiBitmap( preference_xpm ) );
  517. #endif // __WXMAC__
  518. // Language submenu
  519. aParentMenu->AppendSeparator();
  520. Pgm().AddMenuLanguageList( aParentMenu );
  521. // Icons options submenu
  522. aFrame->AddMenuIconsOptions( aParentMenu );
  523. // Import/export (submenu in preferences menu)
  524. aParentMenu->AppendSeparator();
  525. wxMenu* importExportSubmenu = new wxMenu();
  526. prepareImportExportMenu( importExportSubmenu );
  527. AddMenuItem( aParentMenu, importExportSubmenu,
  528. wxID_ANY,
  529. _( "&Import and Export" ),
  530. _( "Import and export settings" ),
  531. KiBitmap( save_setup_xpm ) );
  532. }