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.

522 lines
19 KiB

* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
18 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
16 years ago
15 years ago
* KIWAY Milestone A): Make major modules into DLL/DSOs. ! The initial testing of this commit should be done using a Debug build so that all the wxASSERT()s are enabled. Also, be sure and keep enabled the USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it off is senseless anyways. If you want stable code, go back to a prior version, the one tagged with "stable". * Relocate all functionality out of the wxApp derivative into more finely targeted purposes: a) DLL/DSO specific b) PROJECT specific c) EXE or process specific d) configuration file specific data e) configuration file manipulations functions. All of this functionality was blended into an extremely large wxApp derivative and that was incompatible with the desire to support multiple concurrently loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects. An amazing amount of organization come from simply sorting each bit of functionality into the proper box. * Switch to wxConfigBase from wxConfig everywhere except instantiation. * Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD, PGM_SINGLE_TOP, * Remove "Return" prefix on many function names. * Remove obvious comments from CMakeLists.txt files, and from else() and endif()s. * Fix building boost for use in a DSO on linux. * Remove some of the assumptions in the CMakeLists.txt files that windows had to be the host platform when building windows binaries. * Reduce the number of wxStrings being constructed at program load time via static construction. * Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that these functions are useful even when the wxConfigBase comes from another source, as is the case in the KICAD_MANAGER_FRAME. * Move the setting of the KIPRJMOD environment variable into class PROJECT, so that it can be moved into a project variable soon, and out of FP_LIB_TABLE. * Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all its child wxFrames and wxDialogs now have a Kiway() member function which returns a KIWAY& that that window tree branch is in support of. This is like wxWindows DNA in that child windows get this member with proper value at time of construction. * Anticipate some of the needs for milestones B) and C) and make code adjustments now in an effort to reduce work in those milestones. * No testing has been done for python scripting, since milestone C) has that being largely reworked and re-thought-out.
12 years ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
  5. * Copyright (C) 2009-2014 Wayne Stambaugh <stambaughw@verizon.net>
  6. * Copyright (C) 1992-2014 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 <fctsys.h>
  30. #include <kiface_i.h>
  31. #include <pgm_base.h>
  32. #include <wxEeschemaStruct.h>
  33. #include <general.h>
  34. #include <eeschema_id.h>
  35. #include <hotkeys.h>
  36. #include <menus_helpers.h>
  37. #include <help_common_strings.h>
  38. /**
  39. * @brief (Re)Create the menubar for the schematic frame
  40. */
  41. void SCH_EDIT_FRAME::ReCreateMenuBar()
  42. {
  43. // Create and try to get the current menubar
  44. wxString text;
  45. wxMenuBar* menuBar = GetMenuBar();
  46. if( !menuBar )
  47. menuBar = new wxMenuBar();
  48. // Delete all existing menus so they can be rebuilt.
  49. // This allows language changes of the menu text on the fly.
  50. menuBar->Freeze();
  51. while( menuBar->GetMenuCount() )
  52. delete menuBar->Remove( 0 );
  53. // Recreate all menus:
  54. // Menu File:
  55. wxMenu* fileMenu = new wxMenu;
  56. if( Kiface().IsSingle() ) // not when under a project mgr
  57. {
  58. AddMenuItem( fileMenu,
  59. ID_NEW_PROJECT,
  60. _( "&New Schematic Project" ),
  61. _( "Clear current schematic hierarchy and start a new schematic root sheet" ),
  62. KiBitmap( new_xpm ) );
  63. text = AddHotkeyName( _( "&Open Schematic Project" ), s_Schematic_Hokeys_Descr, HK_LOAD_SCH );
  64. AddMenuItem( fileMenu,
  65. ID_LOAD_PROJECT, text,
  66. _( "Open an existing schematic hierarchy" ),
  67. KiBitmap( open_document_xpm ) );
  68. }
  69. // @todo: static probably not OK in multiple open projects.
  70. // Open Recent submenu
  71. static wxMenu* openRecentMenu;
  72. // Add this menu to list menu managed by m_fileHistory
  73. // (the file history will be updated when adding/removing files in history
  74. if( openRecentMenu )
  75. Kiface().GetFileHistory().RemoveMenu( openRecentMenu );
  76. openRecentMenu = new wxMenu();
  77. Kiface().GetFileHistory().UseMenu( openRecentMenu );
  78. Kiface().GetFileHistory().AddFilesToMenu( openRecentMenu );
  79. if( Kiface().IsSingle() ) // not when under a project mgr
  80. {
  81. AddMenuItem( fileMenu, openRecentMenu,
  82. wxID_ANY, _( "Open &Recent" ),
  83. _( "Open a recent opened schematic project" ),
  84. KiBitmap( open_project_xpm ) );
  85. }
  86. AddMenuItem( fileMenu,
  87. ID_APPEND_PROJECT, _( "&Append Schematic Sheet" ),
  88. _( "Append schematic sheet to current project" ),
  89. KiBitmap( open_document_xpm ) );
  90. fileMenu->AppendSeparator();
  91. text = AddHotkeyName( _( "&Save Schematic Project" ),
  92. s_Schematic_Hokeys_Descr, HK_SAVE_SCH );
  93. AddMenuItem( fileMenu,
  94. ID_SAVE_PROJECT, text,
  95. _( "Save all sheets in schematic project" ),
  96. KiBitmap( save_project_xpm ) );
  97. AddMenuItem( fileMenu,
  98. ID_UPDATE_ONE_SHEET,
  99. _( "Save &Current Sheet Only" ),
  100. _( "Save only current schematic sheet" ),
  101. KiBitmap( save_xpm ) );
  102. if( Kiface().IsSingle() ) // not when under a project mgr
  103. {
  104. AddMenuItem( fileMenu,
  105. ID_SAVE_ONE_SHEET_UNDER_NEW_NAME,
  106. _( "Save Current Sheet &As" ),
  107. _( "Save current schematic sheet as..." ),
  108. KiBitmap( save_as_xpm ) );
  109. }
  110. fileMenu->AppendSeparator();
  111. AddMenuItem( fileMenu,
  112. ID_SHEET_SET,
  113. _( "Pa&ge Settings" ),
  114. _( "Setting for sheet size and frame references" ),
  115. KiBitmap( sheetset_xpm ) );
  116. AddMenuItem( fileMenu,
  117. wxID_PRINT,
  118. _( "Pri&nt" ),
  119. _( "Print schematic sheet" ),
  120. KiBitmap( print_button_xpm ) );
  121. #ifdef __WINDOWS__ // __WINDOWS__
  122. // Plot submenu
  123. wxMenu* choice_plot_fmt = new wxMenu;
  124. AddMenuItem( choice_plot_fmt, ID_GEN_PLOT_SCHEMATIC,
  125. _( "&Plot" ),
  126. _( "Plot schematic sheet in PostScript, PDF, SVG, DXF or HPGL format" ),
  127. KiBitmap( plot_xpm ) );
  128. // Plot to Clipboard (Windows only)
  129. AddMenuItem( choice_plot_fmt, ID_GEN_COPY_SHEET_TO_CLIPBOARD,
  130. _( "Plot to &Clipboard" ),
  131. _( "Export drawings to clipboard" ),
  132. KiBitmap( copy_button_xpm ) );
  133. // Plot
  134. AddMenuItem( fileMenu, choice_plot_fmt,
  135. ID_GEN_PLOT, _( "&Plot" ),
  136. _( "Plot schematic sheet in HPGL, PostScript or SVG format" ),
  137. KiBitmap( plot_xpm ) );
  138. #else // Other
  139. // Plot
  140. AddMenuItem( fileMenu,
  141. ID_GEN_PLOT_SCHEMATIC,
  142. _( "&Plot" ),
  143. _( "Plot schematic sheet in HPGL, PostScript or SVG format" ),
  144. KiBitmap( plot_xpm ) );
  145. #endif
  146. // Separator
  147. fileMenu->AppendSeparator();
  148. // Quit
  149. AddMenuItem( fileMenu,
  150. wxID_EXIT,
  151. _( "&Quit" ),
  152. _( "Quit Eeschema" ),
  153. KiBitmap( exit_xpm ) );
  154. // Menu Edit:
  155. wxMenu* editMenu = new wxMenu;
  156. // Undo
  157. text = AddHotkeyName( _( "&Undo" ), s_Schematic_Hokeys_Descr, HK_UNDO );
  158. AddMenuItem( editMenu, wxID_UNDO, text, HELP_UNDO, KiBitmap( undo_xpm ) );
  159. // Redo
  160. text = AddHotkeyName( _( "&Redo" ), s_Schematic_Hokeys_Descr, HK_REDO );
  161. AddMenuItem( editMenu, wxID_REDO, text, HELP_REDO, KiBitmap( redo_xpm ) );
  162. // Delete
  163. editMenu->AppendSeparator();
  164. AddMenuItem( editMenu, ID_SCHEMATIC_DELETE_ITEM_BUTT,
  165. _( "&Delete" ), HELP_DELETE_ITEMS,
  166. KiBitmap( delete_xpm ) );
  167. // Find
  168. editMenu->AppendSeparator();
  169. text = AddHotkeyName( _( "&Find" ), s_Schematic_Hokeys_Descr, HK_FIND_ITEM );
  170. AddMenuItem( editMenu, ID_FIND_ITEMS, text, HELP_FIND, KiBitmap( find_xpm ) );
  171. // Find/Replace
  172. text = AddHotkeyName( _( "Find and Re&place" ), s_Schematic_Hokeys_Descr,
  173. HK_FIND_REPLACE );
  174. AddMenuItem( editMenu, wxID_REPLACE, text, HELP_REPLACE,
  175. KiBitmap( find_replace_xpm ) );
  176. // Import footprint association from the CvPcb cmp file:
  177. editMenu->AppendSeparator();
  178. AddMenuItem( editMenu, ID_BACKANNO_ITEMS,
  179. _( "Import Footprint Selection" ),
  180. HELP_IMPORT_FOOTPRINTS,
  181. KiBitmap( import_footprint_names_xpm ) );
  182. // Menu View:
  183. wxMenu* viewMenu = new wxMenu;
  184. /**
  185. * Important Note for ZOOM IN and ZOOM OUT commands from menubar:
  186. * we cannot add hotkey shortcut here, because the hotkey HK_ZOOM_IN and HK_ZOOM_OUT
  187. * events(default = WXK_F1 and WXK_F2) are *NOT* equivalent to this menu command:
  188. * zoom in and out from hotkeys are equivalent to the pop up menu zoom
  189. * From here, zooming is made around the screen center
  190. * From hotkeys, zooming is made around the mouse cursor position
  191. * (obviously not possible from the toolbar or menubar command)
  192. *
  193. * in others words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators
  194. * for Zoom in and Zoom out sub menus
  195. * SO WE ADD THE NAME OF THE CORRESPONDING HOTKEY AS A COMMENT, NOT AS A SHORTCUT
  196. * using in AddHotkeyName call the option "false" (not a shortcut)
  197. */
  198. text = AddHotkeyName( _( "Zoom &In" ), s_Schematic_Hokeys_Descr,
  199. HK_ZOOM_IN, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  200. AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) );
  201. text = AddHotkeyName( _( "Zoom &Out" ), s_Schematic_Hokeys_Descr,
  202. HK_ZOOM_OUT, IS_ACCELERATOR ); // add accelerator, not a shortcut
  203. AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) );
  204. text = AddHotkeyName( _( "&Fit on Screen" ), s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO );
  205. AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT, KiBitmap( zoom_fit_in_page_xpm ) );
  206. viewMenu->AppendSeparator();
  207. AddMenuItem( viewMenu,
  208. ID_HIERARCHY,
  209. _( "Show &Hierarchical Navigator" ),
  210. _( "Navigate hierarchical sheets" ),
  211. KiBitmap( hierarchy_nav_xpm ) );
  212. text = AddHotkeyName( _( "&Redraw" ), s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW );
  213. AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text, HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) );
  214. // Menu place:
  215. wxMenu* placeMenu = new wxMenu;
  216. text = AddHotkeyName( _( "&Component" ), s_Schematic_Hokeys_Descr,
  217. HK_ADD_NEW_COMPONENT, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  218. AddMenuItem( placeMenu, ID_SCH_PLACE_COMPONENT, text,
  219. HELP_PLACE_COMPONENTS,
  220. KiBitmap( add_component_xpm ) );
  221. text = AddHotkeyName( _( "&Power Port" ), s_Schematic_Hokeys_Descr,
  222. HK_ADD_NEW_POWER, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  223. AddMenuItem( placeMenu, ID_PLACE_POWER_BUTT, text,
  224. HELP_PLACE_POWERPORT,
  225. KiBitmap( add_power_xpm ) );
  226. text = AddHotkeyName( _( "&Wire" ), s_Schematic_Hokeys_Descr,
  227. HK_BEGIN_WIRE, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  228. AddMenuItem( placeMenu, ID_WIRE_BUTT, text,
  229. HELP_PLACE_WIRE,
  230. KiBitmap( add_line_xpm ) );
  231. text = AddHotkeyName( _( "&Bus" ), s_Schematic_Hokeys_Descr,
  232. HK_BEGIN_BUS, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  233. AddMenuItem( placeMenu, ID_BUS_BUTT, text,
  234. HELP_PLACE_BUS,
  235. KiBitmap( add_bus_xpm ) );
  236. text = AddHotkeyName( _( "Wire to Bus &Entry" ), s_Schematic_Hokeys_Descr,
  237. HK_ADD_WIRE_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  238. AddMenuItem( placeMenu, ID_WIRETOBUS_ENTRY_BUTT, text,
  239. HELP_PLACE_WIRE2BUS_ENTRY,
  240. KiBitmap( add_line2bus_xpm ) );
  241. text = AddHotkeyName( _( "Bus &to Bus Entry" ), s_Schematic_Hokeys_Descr,
  242. HK_ADD_BUS_ENTRY, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  243. AddMenuItem( placeMenu, ID_BUSTOBUS_ENTRY_BUTT, text,
  244. HELP_PLACE_BUS2BUS_ENTRY,
  245. KiBitmap( add_bus2bus_xpm ) );
  246. text = AddHotkeyName( _( "&No Connect Flag" ), s_Schematic_Hokeys_Descr,
  247. HK_ADD_NOCONN_FLAG, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  248. AddMenuItem( placeMenu, ID_NOCONN_BUTT, text, HELP_PLACE_NC_FLAG, KiBitmap( noconn_xpm ) );
  249. text = AddHotkeyName( _( "&Label" ), s_Schematic_Hokeys_Descr,
  250. HK_ADD_LABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  251. AddMenuItem( placeMenu, ID_LABEL_BUTT, text,
  252. HELP_PLACE_NETLABEL,
  253. KiBitmap( add_line_label_xpm ) );
  254. text = AddHotkeyName( _( "Gl&obal Label" ), s_Schematic_Hokeys_Descr,
  255. HK_ADD_GLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  256. AddMenuItem( placeMenu, ID_GLABEL_BUTT, text,
  257. HELP_PLACE_GLOBALLABEL,
  258. KiBitmap( add_glabel_xpm ) );
  259. text = AddHotkeyName( _( "&Junction" ), s_Schematic_Hokeys_Descr,
  260. HK_ADD_JUNCTION, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  261. AddMenuItem( placeMenu, ID_JUNCTION_BUTT, text,
  262. HELP_PLACE_JUNCTION,
  263. KiBitmap( add_junction_xpm ) );
  264. placeMenu->AppendSeparator();
  265. text = AddHotkeyName( _( "&Hierarchical Label" ), s_Schematic_Hokeys_Descr,
  266. HK_ADD_HLABEL, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  267. AddMenuItem( placeMenu, ID_HIERLABEL_BUTT,
  268. text, HELP_PLACE_HIER_LABEL,
  269. KiBitmap( add_hierarchical_label_xpm ) );
  270. text = AddHotkeyName( _( "H&ierarchical &Sheet" ), s_Schematic_Hokeys_Descr,
  271. HK_ADD_HIER_SHEET, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  272. AddMenuItem( placeMenu, ID_SHEET_SYMBOL_BUTT, text,
  273. HELP_PLACE_SHEET,
  274. KiBitmap( add_hierarchical_subsheet_xpm ) );
  275. AddMenuItem( placeMenu,
  276. ID_IMPORT_HLABEL_BUTT,
  277. _( "I&mport Hierarchical Label" ),
  278. HELP_IMPORT_SHEETPIN,
  279. KiBitmap( import_hierarchical_label_xpm ) );
  280. AddMenuItem( placeMenu,
  281. ID_SHEET_PIN_BUTT,
  282. _( "Hierarchical Pi&n to Sheet" ),
  283. HELP_PLACE_SHEETPIN,
  284. KiBitmap( add_hierar_pin_xpm ) );
  285. placeMenu->AppendSeparator();
  286. text = AddHotkeyName( _( "Graphic Polyline" ), s_Schematic_Hokeys_Descr,
  287. HK_ADD_GRAPHIC_POLYLINE, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  288. AddMenuItem( placeMenu, ID_LINE_COMMENT_BUTT, text,
  289. HELP_PLACE_GRAPHICLINES,
  290. KiBitmap( add_dashed_line_xpm ) );
  291. text = AddHotkeyName( _( "Graphic Text" ), s_Schematic_Hokeys_Descr,
  292. HK_ADD_GRAPHIC_TEXT, IS_ACCELERATOR ); // add an accelerator, not a shortcut
  293. AddMenuItem( placeMenu, ID_TEXT_COMMENT_BUTT, text,
  294. HELP_PLACE_GRAPHICTEXTS,
  295. KiBitmap( add_text_xpm ) );
  296. // Graphic image
  297. AddMenuItem( placeMenu, ID_ADD_IMAGE_BUTT, _( "Image" ),
  298. HELP_PLACE_GRAPHICIMAGES,
  299. KiBitmap( image_xpm ) );
  300. // Menu Preferences:
  301. wxMenu* preferencesMenu = new wxMenu;
  302. // Library
  303. AddMenuItem( preferencesMenu,
  304. ID_CONFIG_REQ,
  305. _( "Set Active &Libraries" ),
  306. _( "Set active library list and library paths" ),
  307. KiBitmap( library_xpm ) );
  308. // Colors
  309. AddMenuItem( preferencesMenu,
  310. ID_COLORS_SETUP,
  311. _( "Set &Colors Scheme" ),
  312. _( "Set color preferences" ),
  313. KiBitmap( palette_xpm ) );
  314. // Options (Preferences on WXMAC)
  315. #ifdef __WXMAC__
  316. preferencesMenu->Append( wxID_PREFERENCES );
  317. #else
  318. AddMenuItem( preferencesMenu,
  319. wxID_PREFERENCES,
  320. _( "Schematic Editor &Options" ),
  321. _( "Set Eeschema preferences" ),
  322. KiBitmap( preference_xpm ) );
  323. #endif // __WXMAC__
  324. // Language submenu
  325. Pgm().AddMenuLanguageList( preferencesMenu );
  326. // Hotkey submenu
  327. AddHotkeyConfigMenu( preferencesMenu );
  328. // Separator
  329. preferencesMenu->AppendSeparator();
  330. AddMenuItem( preferencesMenu,
  331. ID_CONFIG_SAVE,
  332. _( "&Save Preferences" ),
  333. _( "Save application preferences" ),
  334. KiBitmap( save_setup_xpm ) );
  335. AddMenuItem( preferencesMenu,
  336. ID_CONFIG_READ,
  337. _( "&Read Preferences" ),
  338. _( "Read application preferences" ),
  339. KiBitmap( read_setup_xpm ) );
  340. // Menu Tools:
  341. wxMenu* toolsMenu = new wxMenu;
  342. AddMenuItem( toolsMenu,
  343. ID_RUN_LIBRARY,
  344. _( "Library &Editor" ), HELP_RUN_LIB_EDITOR,
  345. KiBitmap( libedit_xpm ) );
  346. AddMenuItem( toolsMenu,
  347. ID_TO_LIBVIEW,
  348. _( "Library &Browser" ), HELP_RUN_LIB_VIEWER,
  349. KiBitmap( library_browse_xpm ) );
  350. toolsMenu->AppendSeparator();
  351. AddMenuItem( toolsMenu,
  352. ID_GET_ANNOTATE,
  353. _( "&Annotate Schematic" ), HELP_ANNOTATE,
  354. KiBitmap( annotate_xpm ) );
  355. // ERC
  356. AddMenuItem( toolsMenu,
  357. ID_GET_ERC,
  358. _( "Electric Rules &Checker" ),
  359. _( "Perform electrical rule check" ),
  360. KiBitmap( erc_xpm ) );
  361. AddMenuItem( toolsMenu,
  362. ID_GET_NETLIST,
  363. _( "Generate &Netlist File" ),
  364. _( "Generate the component netlist file" ),
  365. KiBitmap( netlist_xpm ) );
  366. AddMenuItem( toolsMenu,
  367. ID_GET_TOOLS,
  368. _( "Generate Bill of &Materials" ),
  369. HELP_GENERATE_BOM,
  370. KiBitmap( bom_xpm ) );
  371. toolsMenu->AppendSeparator();
  372. // Run CvPcb
  373. AddMenuItem( toolsMenu,
  374. ID_RUN_CVPCB,
  375. _( "A&ssign Component Footprint" ),
  376. _( "Run CvPcb" ),
  377. KiBitmap( cvpcb_xpm ) );
  378. // Run Pcbnew
  379. AddMenuItem( toolsMenu,
  380. ID_RUN_PCB,
  381. _( "&Layout Printed Circuit Board" ),
  382. _( "Run Pcbnew" ),
  383. KiBitmap( pcbnew_xpm ) );
  384. // Help Menu:
  385. wxMenu* helpMenu = new wxMenu;
  386. // Version info
  387. AddHelpVersionInfoMenuEntry( helpMenu );
  388. AddMenuItem( helpMenu,
  389. wxID_HELP,
  390. _( "Eesc&hema Manual" ),
  391. _( "Open Eeschema manual" ),
  392. KiBitmap( online_help_xpm ) );
  393. AddMenuItem( helpMenu,
  394. wxID_INDEX,
  395. _( "&Getting Started in KiCad" ),
  396. _( "Open \"Getting Started in KiCad\" guide for beginners" ),
  397. KiBitmap( help_xpm ) );
  398. helpMenu->AppendSeparator();
  399. AddMenuItem( helpMenu,
  400. wxID_ABOUT,
  401. _( "&About Eeschema" ),
  402. _( "About Eeschema schematic designer" ),
  403. KiBitmap( info_xpm ) );
  404. // Create the menubar and append all submenus
  405. menuBar->Append( fileMenu, _( "&File" ) );
  406. menuBar->Append( editMenu, _( "&Edit" ) );
  407. menuBar->Append( viewMenu, _( "&View" ) );
  408. menuBar->Append( placeMenu, _( "&Place" ) );
  409. menuBar->Append( preferencesMenu, _( "P&references" ) );
  410. menuBar->Append( toolsMenu, _( "&Tools" ) );
  411. menuBar->Append( helpMenu, _( "&Help" ) );
  412. menuBar->Thaw();
  413. // Associate the menu bar with the frame, if no previous menubar
  414. if( GetMenuBar() == NULL )
  415. SetMenuBar( menuBar );
  416. else
  417. menuBar->Refresh();
  418. }