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.

658 lines
25 KiB

11 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2009 Wayne Stambaugh <stambaughw@gmail.com>
  6. * Copyright (C) 1992-2018 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 inspect menu
  45. static void prepareInspectMenu( wxMenu* aParentMenu );
  46. // Build the tools menu
  47. static void prepareToolsMenu( wxMenu* aParentMenu );
  48. // Build the help menu
  49. static void prepareHelpMenu( 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. // wxWidgets handles the Mac Application menu behind the scenes, but that means
  59. // we always have to start from scratch with a new wxMenuBar.
  60. wxMenuBar* oldMenuBar = GetMenuBar();
  61. wxMenuBar* menuBar = new wxMenuBar();
  62. wxString text;
  63. // Recreate all menus:
  64. // Menu File:
  65. wxMenu* fileMenu = new wxMenu;
  66. prepareFilesMenu( fileMenu, Kiface().IsSingle() );
  67. // Menu Edit:
  68. wxMenu* editMenu = new wxMenu;
  69. prepareEditMenu( editMenu );
  70. // Menu View:
  71. wxMenu* viewMenu = new wxMenu;
  72. prepareViewMenu( viewMenu );
  73. // Menu place:
  74. wxMenu* placeMenu = new wxMenu;
  75. preparePlaceMenu( placeMenu );
  76. // Menu Inspect:
  77. wxMenu* inspectMenu = new wxMenu;
  78. prepareInspectMenu( inspectMenu );
  79. // Menu Tools:
  80. wxMenu* toolsMenu = new wxMenu;
  81. prepareToolsMenu( toolsMenu );
  82. // Menu Preferences:
  83. wxMenu* preferencesMenu = new wxMenu;
  84. preparePreferencesMenu( this, preferencesMenu );
  85. // Help Menu:
  86. wxMenu* helpMenu = new wxMenu;
  87. prepareHelpMenu( helpMenu );
  88. // Create the menubar and append all submenus
  89. menuBar->Append( fileMenu, _( "&File" ) );
  90. menuBar->Append( editMenu, _( "&Edit" ) );
  91. menuBar->Append( viewMenu, _( "&View" ) );
  92. menuBar->Append( placeMenu, _( "&Place" ) );
  93. menuBar->Append( inspectMenu, _( "&Inspect" ) );
  94. menuBar->Append( toolsMenu, _( "&Tools" ) );
  95. menuBar->Append( preferencesMenu, _( "P&references" ) );
  96. menuBar->Append( helpMenu, _( "&Help" ) );
  97. SetMenuBar( menuBar );
  98. delete oldMenuBar;
  99. }
  100. void prepareViewMenu( wxMenu* aParentMenu )
  101. {
  102. wxString text;
  103. AddMenuItem( aParentMenu,
  104. ID_TO_LIBVIEW,
  105. _( "Library &Browser" ), HELP_RUN_LIB_VIEWER,
  106. KiBitmap( library_browse_xpm ) );
  107. AddMenuItem( aParentMenu,
  108. ID_HIERARCHY,
  109. _( "Show &Hierarchical Navigator" ),
  110. _( "Navigate schematic hierarchy" ),
  111. KiBitmap( hierarchy_nav_xpm ) );
  112. text = AddHotkeyName( _( "&Leave Sheet" ), g_Schematic_Hokeys_Descr, HK_LEAVE_SHEET );
  113. AddMenuItem( aParentMenu,
  114. ID_POPUP_SCH_LEAVE_SHEET, text,
  115. _( "Return to parent schematic sheet" ),
  116. KiBitmap( leave_sheet_xpm ) );
  117. aParentMenu->AppendSeparator();
  118. /**
  119. * Important Note for ZOOM IN and ZOOM OUT commands from menubar:
  120. * we cannot add hotkey shortcut here, because the hotkey HK_ZOOM_IN and HK_ZOOM_OUT
  121. * events(default = WXK_F1 and WXK_F2) are *NOT* equivalent to this menu command:
  122. * zoom in and out from hotkeys are equivalent to the pop up menu zoom
  123. * From here, zooming is made around the screen center
  124. * From hotkeys, zooming is made around the mouse cursor position
  125. * (obviously not possible from the toolbar or menubar command)
  126. *
  127. * in others words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators
  128. * for Zoom in and Zoom out sub menus
  129. * SO WE ADD THE NAME OF THE CORRESPONDING HOTKEY AS A COMMENT, NOT AS A SHORTCUT
  130. * using in AddHotkeyName call the option "false" (not a shortcut)
  131. */
  132. text = AddHotkeyName( _( "Zoom &In" ), g_Schematic_Hokeys_Descr,
  133. HK_ZOOM_IN, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  134. AddMenuItem( aParentMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) );
  135. text = AddHotkeyName( _( "Zoom &Out" ), g_Schematic_Hokeys_Descr,
  136. HK_ZOOM_OUT, IS_ACCELERATOR ); // add accelerator, not a shortcut
  137. AddMenuItem( aParentMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) );
  138. text = AddHotkeyName( _( "&Zoom to Fit" ), g_Schematic_Hokeys_Descr, HK_ZOOM_AUTO );
  139. AddMenuItem( aParentMenu, ID_ZOOM_PAGE, text,
  140. HELP_ZOOM_FIT, KiBitmap( zoom_fit_in_page_xpm ) );
  141. text = AddHotkeyName( _( "Zoom to Selection" ), g_Eeschema_Hokeys_Descr, HK_ZOOM_SELECTION );
  142. AddMenuItem( aParentMenu, ID_MENU_ZOOM_SELECTION, text, KiBitmap( zoom_area_xpm ) );
  143. text = AddHotkeyName( _( "&Redraw" ), g_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW );
  144. AddMenuItem( aParentMenu, ID_ZOOM_REDRAW, text,
  145. HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) );
  146. aParentMenu->AppendSeparator();
  147. AddMenuItem( aParentMenu, ID_TB_OPTIONS_SHOW_GRID,
  148. _( "Show &Grid" ), wxEmptyString,
  149. KiBitmap( grid_xpm ), wxITEM_CHECK );
  150. AddMenuItem( aParentMenu, ID_GRID_SETTINGS,
  151. _( "Grid Settings..." ), wxEmptyString,
  152. KiBitmap( grid_xpm ) );
  153. // Units submenu
  154. wxMenu* unitsSubMenu = new wxMenu;
  155. AddMenuItem( unitsSubMenu, ID_TB_OPTIONS_SELECT_UNIT_INCH,
  156. _( "&Imperial" ), _( "Use imperial units" ),
  157. KiBitmap( unit_inch_xpm ), wxITEM_RADIO );
  158. AddMenuItem( unitsSubMenu, ID_TB_OPTIONS_SELECT_UNIT_MM,
  159. _( "&Metric" ), _( "Use metric units" ),
  160. KiBitmap( unit_mm_xpm ), wxITEM_RADIO );
  161. AddMenuItem( aParentMenu, unitsSubMenu,
  162. -1, _( "&Units" ),
  163. _( "Select which units are displayed" ),
  164. KiBitmap( unit_mm_xpm ) );
  165. #ifndef __APPLE__
  166. AddMenuItem( aParentMenu, ID_TB_OPTIONS_SELECT_CURSOR,
  167. _( "Full &Window Crosshair" ),
  168. _( "Change cursor shape" ),
  169. KiBitmap( cursor_shape_xpm ), wxITEM_CHECK );
  170. #else
  171. AddMenuItem( aParentMenu, ID_TB_OPTIONS_SELECT_CURSOR,
  172. _( "Full &Window Crosshair" ),
  173. _( "Change cursor shape (not supported in Legacy graphics)" ),
  174. KiBitmap( cursor_shape_xpm ), wxITEM_CHECK );
  175. #endif
  176. aParentMenu->AppendSeparator();
  177. AddMenuItem( aParentMenu, ID_TB_OPTIONS_HIDDEN_PINS,
  178. _( "Show Hidden &Pins" ),
  179. wxEmptyString,
  180. KiBitmap( hidden_pin_xpm ), wxITEM_CHECK );
  181. #ifdef __APPLE__
  182. aParentMenu->AppendSeparator();
  183. #endif
  184. }
  185. void preparePlaceMenu( wxMenu* aParentMenu )
  186. {
  187. wxString text;
  188. text = AddHotkeyName( _( "&Symbol" ), g_Schematic_Hokeys_Descr,
  189. HK_ADD_NEW_COMPONENT, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  190. AddMenuItem( aParentMenu, ID_MENU_PLACE_COMPONENT, text,
  191. HELP_PLACE_COMPONENTS,
  192. KiBitmap( add_component_xpm ) );
  193. text = AddHotkeyName( _( "&Power Port" ), g_Schematic_Hokeys_Descr,
  194. HK_ADD_NEW_POWER, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  195. AddMenuItem( aParentMenu, ID_MENU_PLACE_POWER_BUTT, text,
  196. HELP_PLACE_POWERPORT,
  197. KiBitmap( add_power_xpm ) );
  198. text = AddHotkeyName( _( "&Wire" ), g_Schematic_Hokeys_Descr,
  199. HK_BEGIN_WIRE, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  200. AddMenuItem( aParentMenu, ID_MENU_WIRE_BUTT, text,
  201. HELP_PLACE_WIRE,
  202. KiBitmap( add_line_xpm ) );
  203. text = AddHotkeyName( _( "&Bus" ), g_Schematic_Hokeys_Descr,
  204. HK_BEGIN_BUS, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  205. AddMenuItem( aParentMenu, ID_MENU_BUS_BUTT, text,
  206. HELP_PLACE_BUS,
  207. KiBitmap( add_bus_xpm ) );
  208. text = AddHotkeyName( _( "Wire to Bus &Entry" ), g_Schematic_Hokeys_Descr,
  209. HK_ADD_WIRE_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  210. AddMenuItem( aParentMenu, ID_MENU_WIRETOBUS_ENTRY_BUTT, text,
  211. HELP_PLACE_WIRE2BUS_ENTRY,
  212. KiBitmap( add_line2bus_xpm ) );
  213. text = AddHotkeyName( _( "Bus &to Bus Entry" ), g_Schematic_Hokeys_Descr,
  214. HK_ADD_BUS_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  215. AddMenuItem( aParentMenu, ID_MENU_BUSTOBUS_ENTRY_BUTT, text,
  216. HELP_PLACE_BUS2BUS_ENTRY,
  217. KiBitmap( add_bus2bus_xpm ) );
  218. text = AddHotkeyName( _( "&No Connect Flag" ), g_Schematic_Hokeys_Descr,
  219. HK_ADD_NOCONN_FLAG, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  220. AddMenuItem( aParentMenu, ID_MENU_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG, KiBitmap( noconn_xpm ) );
  221. text = AddHotkeyName( _( "&Junction" ), g_Schematic_Hokeys_Descr,
  222. HK_ADD_JUNCTION, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  223. AddMenuItem( aParentMenu, ID_MENU_JUNCTION_BUTT, text,
  224. HELP_PLACE_JUNCTION,
  225. KiBitmap( add_junction_xpm ) );
  226. text = AddHotkeyName( _( "&Label" ), g_Schematic_Hokeys_Descr,
  227. HK_ADD_LABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  228. AddMenuItem( aParentMenu, ID_MENU_LABEL_BUTT, text,
  229. HELP_PLACE_NETLABEL,
  230. KiBitmap( add_line_label_xpm ) );
  231. text = AddHotkeyName( _( "Gl&obal Label" ), g_Schematic_Hokeys_Descr,
  232. HK_ADD_GLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  233. AddMenuItem( aParentMenu, ID_MENU_GLABEL_BUTT, text,
  234. HELP_PLACE_GLOBALLABEL,
  235. KiBitmap( add_glabel_xpm ) );
  236. aParentMenu->AppendSeparator();
  237. text = AddHotkeyName( _( "&Hierarchical Label" ), g_Schematic_Hokeys_Descr,
  238. HK_ADD_HLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  239. AddMenuItem( aParentMenu, ID_MENU_HIERLABEL_BUTT,
  240. text, HELP_PLACE_HIER_LABEL,
  241. KiBitmap( add_hierarchical_label_xpm ) );
  242. text = AddHotkeyName( _( "Hierar&chical Sheet" ), g_Schematic_Hokeys_Descr,
  243. HK_ADD_HIER_SHEET, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  244. AddMenuItem( aParentMenu, ID_MENU_SHEET_SYMBOL_BUTT, text,
  245. HELP_PLACE_SHEET,
  246. KiBitmap( add_hierarchical_subsheet_xpm ) );
  247. AddMenuItem( aParentMenu,
  248. ID_MENU_IMPORT_HLABEL_BUTT,
  249. _( "I&mport Hierarchical Label" ),
  250. HELP_IMPORT_SHEETPIN,
  251. KiBitmap( import_hierarchical_label_xpm ) );
  252. AddMenuItem( aParentMenu,
  253. ID_MENU_SHEET_PIN_BUTT,
  254. _( "Hierarchical Pi&n to Sheet" ),
  255. HELP_PLACE_SHEETPIN,
  256. KiBitmap( add_hierar_pin_xpm ) );
  257. aParentMenu->AppendSeparator();
  258. text = AddHotkeyName( _( "Graphic Pol&yline" ), g_Schematic_Hokeys_Descr,
  259. HK_ADD_GRAPHIC_POLYLINE, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  260. AddMenuItem( aParentMenu, ID_MENU_LINE_COMMENT_BUTT, text,
  261. HELP_PLACE_GRAPHICLINES,
  262. KiBitmap( add_dashed_line_xpm ) );
  263. text = AddHotkeyName( _( "&Graphic Text" ), g_Schematic_Hokeys_Descr,
  264. HK_ADD_GRAPHIC_TEXT, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  265. AddMenuItem( aParentMenu, ID_MENU_TEXT_COMMENT_BUTT, text,
  266. HELP_PLACE_GRAPHICTEXTS,
  267. KiBitmap( text_xpm ) );
  268. // Add graphic image
  269. AddMenuItem( aParentMenu, ID_MENU_ADD_IMAGE_BUTT, _( "&Image" ),
  270. HELP_PLACE_GRAPHICIMAGES,
  271. KiBitmap( image_xpm ) );
  272. }
  273. void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject )
  274. {
  275. wxString text;
  276. // @todo: static probably not OK in multiple open projects.
  277. // Open Recent submenu
  278. static wxMenu* openRecentMenu;
  279. // Add this menu to list menu managed by m_fileHistory
  280. // (the file history will be updated when adding/removing files in history
  281. if( openRecentMenu )
  282. Kiface().GetFileHistory().RemoveMenu( openRecentMenu );
  283. openRecentMenu = new wxMenu();
  284. Kiface().GetFileHistory().UseMenu( openRecentMenu );
  285. Kiface().GetFileHistory().AddFilesToMenu( openRecentMenu );
  286. if( aIsOutsideProject ) // not when under a project mgr
  287. {
  288. text = AddHotkeyName( _( "&New..." ), g_Schematic_Hokeys_Descr, HK_NEW );
  289. AddMenuItem( aParentMenu, ID_NEW_PROJECT, text,
  290. _( "Start new schematic root sheet" ),
  291. KiBitmap( new_document_xpm ) );
  292. text = AddHotkeyName( _( "&Open..." ), g_Schematic_Hokeys_Descr, HK_OPEN );
  293. AddMenuItem( aParentMenu, ID_LOAD_PROJECT, text,
  294. _( "Open existing schematic" ),
  295. KiBitmap( open_document_xpm ) );
  296. AddMenuItem( aParentMenu, openRecentMenu, -1, _( "Open &Recent" ),
  297. _( "Open recently opened schematic" ),
  298. KiBitmap( recent_xpm ) );
  299. aParentMenu->AppendSeparator();
  300. }
  301. text = AddHotkeyName( _( "&Save" ), g_Schematic_Hokeys_Descr, HK_SAVE );
  302. AddMenuItem( aParentMenu, ID_SAVE_PROJECT, text,
  303. _( "Save changes" ),
  304. KiBitmap( save_xpm ) );
  305. AddMenuItem( aParentMenu, ID_UPDATE_ONE_SHEET, _( "Save &Current Sheet" ),
  306. _( "Save only the current sheet" ),
  307. KiBitmap( save_xpm ) );
  308. text = AddHotkeyName( _( "Save C&urrent Sheet As..." ), g_Schematic_Hokeys_Descr, HK_SAVEAS );
  309. AddMenuItem( aParentMenu, ID_SAVE_ONE_SHEET_UNDER_NEW_NAME, text,
  310. _( "Save a copy of the current sheet" ),
  311. KiBitmap( save_as_xpm ) );
  312. aParentMenu->AppendSeparator();
  313. AddMenuItem( aParentMenu, ID_APPEND_PROJECT, _( "App&end Schematic Sheet Content..." ),
  314. _( "Append schematic sheet content from another project to the current sheet" ),
  315. KiBitmap( add_document_xpm ) );
  316. AddMenuItem( aParentMenu, ID_IMPORT_NON_KICAD_SCH, _( "&Import Non KiCad Schematic..." ),
  317. _( "Replace current schematic sheet with one imported from another application" ),
  318. KiBitmap( import_document_xpm ) ); // TODO needs a different icon
  319. aParentMenu->AppendSeparator();
  320. // Import submenu
  321. wxMenu* submenuImport = new wxMenu();
  322. AddMenuItem( submenuImport, ID_BACKANNO_ITEMS, _( "&Footprint Association File..." ),
  323. HELP_IMPORT_FOOTPRINTS,
  324. KiBitmap( import_footprint_names_xpm ) );
  325. AddMenuItem( aParentMenu, submenuImport, ID_GEN_IMPORT_FILE, _( "&Import" ),
  326. _( "Import files" ),
  327. KiBitmap( import_xpm ) );
  328. // Export submenu
  329. wxMenu* submenuExport = new wxMenu();
  330. AddMenuItem( submenuExport, ID_GEN_COPY_SHEET_TO_CLIPBOARD, _( "Drawing to C&lipboard" ),
  331. _( "Export drawings to clipboard" ),
  332. KiBitmap( copy_xpm ) );
  333. AddMenuItem( aParentMenu, submenuExport, ID_GEN_EXPORT_FILE, _( "E&xport" ),
  334. _( "Export files" ),
  335. KiBitmap( export_xpm ) );
  336. aParentMenu->AppendSeparator();
  337. // Edit page layout:
  338. AddMenuItem( aParentMenu, ID_SHEET_SET, _( "Page S&ettings..." ),
  339. _( "Settings for sheet size and frame references" ),
  340. KiBitmap( sheetset_xpm ) );
  341. text = AddHotkeyName( _( "&Print..." ), g_Schematic_Hokeys_Descr, HK_PRINT );
  342. AddMenuItem( aParentMenu, wxID_PRINT, text,
  343. _( "Print schematic sheet" ),
  344. KiBitmap( print_button_xpm ) );
  345. AddMenuItem( aParentMenu, ID_GEN_PLOT_SCHEMATIC, _( "P&lot..." ),
  346. _( "Plot schematic sheet in PostScript, PDF, SVG, DXF or HPGL format" ),
  347. KiBitmap( plot_xpm ) );
  348. aParentMenu->AppendSeparator();
  349. // Quit
  350. AddMenuItem( aParentMenu, wxID_EXIT, _( "&Exit" ),
  351. _( "Close Eeschema" ),
  352. KiBitmap( exit_xpm ) );
  353. }
  354. void prepareEditMenu( wxMenu* aParentMenu )
  355. {
  356. wxString text;
  357. // Undo
  358. text = AddHotkeyName( _( "&Undo" ), g_Schematic_Hokeys_Descr, HK_UNDO );
  359. AddMenuItem( aParentMenu, wxID_UNDO, text, HELP_UNDO, KiBitmap( undo_xpm ) );
  360. // Redo
  361. text = AddHotkeyName( _( "&Redo" ), g_Schematic_Hokeys_Descr, HK_REDO );
  362. AddMenuItem( aParentMenu, wxID_REDO, text, HELP_REDO, KiBitmap( redo_xpm ) );
  363. aParentMenu->AppendSeparator();
  364. text = AddHotkeyName( _( "&Cut" ), g_Schematic_Hokeys_Descr, HK_EDIT_CUT );
  365. AddMenuItem( aParentMenu, wxID_CUT, text,
  366. _( "Cuts the selected item(s) to the Clipboard" ),
  367. KiBitmap( cut_xpm ) );
  368. text = AddHotkeyName( _( "&Copy" ), g_Schematic_Hokeys_Descr, HK_EDIT_COPY );
  369. AddMenuItem( aParentMenu, wxID_COPY, text,
  370. _( "Copies the selected item(s) to the Clipboard" ),
  371. KiBitmap( copy_xpm ) );
  372. text = AddHotkeyName( _( "&Paste" ), g_Schematic_Hokeys_Descr, HK_EDIT_PASTE );
  373. AddMenuItem( aParentMenu, wxID_PASTE, text,
  374. _( "Pastes item(s) from the Clipboard" ),
  375. KiBitmap( paste_xpm ) );
  376. // Delete
  377. aParentMenu->AppendSeparator();
  378. AddMenuItem( aParentMenu, ID_MENU_DELETE_ITEM_BUTT,
  379. _( "&Delete" ), HELP_DELETE_ITEMS,
  380. KiBitmap( delete_xpm ) );
  381. // Find
  382. aParentMenu->AppendSeparator();
  383. text = AddHotkeyName( _( "&Find..." ), g_Schematic_Hokeys_Descr, HK_FIND_ITEM );
  384. AddMenuItem( aParentMenu, ID_FIND_ITEMS, text, HELP_FIND, KiBitmap( find_xpm ) );
  385. // Find/Replace
  386. text = AddHotkeyName( _( "Find and Re&place..." ), g_Schematic_Hokeys_Descr,
  387. HK_FIND_REPLACE );
  388. AddMenuItem( aParentMenu, wxID_REPLACE, text, HELP_REPLACE,
  389. KiBitmap( find_replace_xpm ) );
  390. aParentMenu->AppendSeparator();
  391. // Update field values
  392. AddMenuItem( aParentMenu, ID_UPDATE_FIELDS,
  393. _( "Update Fields from Library..." ),
  394. _( "Sets symbol fields to original library values" ),
  395. KiBitmap( update_fields_xpm ) );
  396. }
  397. void prepareInspectMenu( wxMenu* aParentMenu )
  398. {
  399. AddMenuItem( aParentMenu, ID_GET_ERC,
  400. _( "Electrical Rules &Checker" ),
  401. _( "Perform electrical rules check" ),
  402. KiBitmap( erc_xpm ) );
  403. }
  404. void prepareToolsMenu( wxMenu* aParentMenu )
  405. {
  406. wxString text;
  407. text = AddHotkeyName( _( "Update PCB from Schematic..." ), g_Schematic_Hokeys_Descr,
  408. HK_UPDATE_PCB_FROM_SCH );
  409. AddMenuItem( aParentMenu,
  410. ID_UPDATE_PCB_FROM_SCH,
  411. text, _( "Updates PCB design with current schematic (forward annotation)." ),
  412. KiBitmap( update_pcb_from_sch_xpm ) );
  413. // Run Pcbnew
  414. AddMenuItem( aParentMenu, ID_RUN_PCB, _( "&Open PCB Editor" ),
  415. _( "Run Pcbnew" ),
  416. KiBitmap( pcbnew_xpm ) );
  417. aParentMenu->AppendSeparator();
  418. AddMenuItem( aParentMenu, ID_RUN_LIBRARY, _( "Symbol Library &Editor" ),
  419. HELP_RUN_LIB_EDITOR,
  420. KiBitmap( libedit_xpm ) );
  421. AddMenuItem( aParentMenu, ID_RESCUE_CACHED, _( "&Rescue Symbols..." ),
  422. _( "Find old symbols in project and rename/rescue them" ),
  423. KiBitmap( rescue_xpm ) );
  424. AddMenuItem( aParentMenu, ID_REMAP_SYMBOLS, _( "Remap Symbols..." ),
  425. _( "Remap legacy library symbols to symbol library table" ),
  426. KiBitmap( rescue_xpm ) );
  427. aParentMenu->AppendSeparator();
  428. AddMenuItem( aParentMenu, ID_OPEN_CMP_TABLE, _( "Edit Symbol Field&s..." ),
  429. KiBitmap( spreadsheet_xpm ) );
  430. AddMenuItem( aParentMenu, ID_EDIT_COMPONENTS_TO_SYMBOLS_LIB_ID,
  431. _( "Edit Symbol Library References..." ),
  432. _( "Edit links between schematic symbols and library symbols" ),
  433. KiBitmap( edit_cmp_symb_links_xpm ) );
  434. aParentMenu->AppendSeparator();
  435. AddMenuItem( aParentMenu, ID_GET_ANNOTATE, _( "&Annotate Schematic..." ),
  436. HELP_ANNOTATE,
  437. KiBitmap( annotate_xpm ) );
  438. AddMenuItem( aParentMenu, ID_GET_NETLIST, _( "Generate &Netlist File..." ),
  439. _( "Generate netlist file" ),
  440. KiBitmap( netlist_xpm ) );
  441. AddMenuItem( aParentMenu, ID_GET_TOOLS, _( "Generate Bill of &Materials..." ),
  442. HELP_GENERATE_BOM,
  443. KiBitmap( bom_xpm ) );
  444. aParentMenu->AppendSeparator();
  445. // Run CvPcb
  446. AddMenuItem( aParentMenu, ID_RUN_CVPCB, _( "A&ssign Footprints..." ),
  447. _( "Assign PCB footprints to schematic symbols" ),
  448. KiBitmap( cvpcb_xpm ) );
  449. aParentMenu->AppendSeparator();
  450. #ifdef KICAD_SPICE
  451. // Simulator
  452. AddMenuItem( aParentMenu, ID_SIM_SHOW, _("Simula&tor"),
  453. _( "Simulate circuit" ),
  454. KiBitmap( simulator_xpm ) );
  455. #endif /* KICAD_SPICE */
  456. }
  457. void prepareHelpMenu( wxMenu* aParentMenu )
  458. {
  459. AddMenuItem( aParentMenu, wxID_HELP, _( "Eeschema &Manual" ),
  460. _( "Open Eeschema Manual" ),
  461. KiBitmap( online_help_xpm ) );
  462. AddMenuItem( aParentMenu, wxID_INDEX, _( "&Getting Started in KiCad" ),
  463. _( "Open \"Getting Started in KiCad\" guide for beginners" ),
  464. KiBitmap( help_xpm ) );
  465. wxString text = AddHotkeyName( _( "&List Hotkeys..." ), g_Eeschema_Hokeys_Descr, HK_HELP );
  466. AddMenuItem( aParentMenu, ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, text,
  467. _( "Displays current hotkeys table and corresponding commands" ),
  468. KiBitmap( hotkeys_xpm ) );
  469. aParentMenu->AppendSeparator();
  470. AddMenuItem( aParentMenu, ID_HELP_GET_INVOLVED, _( "Get &Involved" ),
  471. _( "Contribute to KiCad (opens a web browser)" ),
  472. KiBitmap( info_xpm ) );
  473. aParentMenu->AppendSeparator();
  474. AddMenuItem( aParentMenu, wxID_ABOUT, _( "&About KiCad" ), KiBitmap( about_xpm ) );
  475. }
  476. static void preparePreferencesMenu( SCH_EDIT_FRAME* aFrame, wxMenu* aParentMenu )
  477. {
  478. // Path configuration edit dialog.
  479. AddMenuItem( aParentMenu, ID_PREFERENCES_CONFIGURE_PATHS, _( "Configure Pa&ths..." ),
  480. _( "Edit path configuration environment variables" ),
  481. KiBitmap( path_xpm ) );
  482. // Library
  483. AddMenuItem( aParentMenu, ID_EDIT_SYM_LIB_TABLE, _( "Manage Symbol Libraries..." ),
  484. _( "Edit the global and project symbol library lists" ),
  485. KiBitmap( library_table_xpm ) );
  486. // Options (Preferences on WXMAC)
  487. AddMenuItem( aParentMenu, wxID_PREFERENCES, _( "Preferences..." ),
  488. _( "Show preferences for all open tools" ),
  489. KiBitmap( preference_xpm ) );
  490. aParentMenu->AppendSeparator();
  491. // Language submenu
  492. Pgm().AddMenuLanguageList( aParentMenu );
  493. aParentMenu->AppendSeparator();
  494. // Import/export
  495. AddMenuItem( aParentMenu, ID_CONFIG_SAVE, _( "&Save Project File..." ),
  496. _( "Save project preferences into a project file" ),
  497. KiBitmap( save_setup_xpm ) );
  498. AddMenuItem( aParentMenu, ID_CONFIG_READ, _( "Load P&roject File..." ),
  499. _( "Load project preferences from a project file" ),
  500. KiBitmap( import_setup_xpm ) );
  501. }