KiCad PCB EDA Suite
menubar_pcbframe.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
5  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2012-2016 Wayne Stambaugh <stambaughw@verizon.net>
7  * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 2
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22  * or you may search the http://www.gnu.org website for the version 2 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
33 #include <menus_helpers.h>
34 #include <kiface_i.h>
35 #include <pgm_base.h>
36 #include <wxPcbStruct.h>
37 
38 #include "help_common_strings.h"
39 #include "hotkeys.h"
40 #include "pcbnew.h"
41 #include "pcbnew_id.h"
42 
43 
44 // Build the place submenu
45 static void preparePlaceMenu( wxMenu* aParentMenu );
46 
47 // Build the files menu. Because some commands are available only if
48 // Pcbnew is run outside a project (run alone), aIsOutsideProject is false
49 // when Pcbnew is run from Kicad manager, and true is run as stand alone app.
50 static void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject );
51 
52 // Build the export submenu (inside files menu)
53 static void prepareExportMenu( wxMenu* aParentMenu );
54 
55 // Build the tools menu
56 static void prepareToolsMenu( wxMenu* aParentMenu );
57 
58 // Build the help menu
59 static void prepareHelpMenu( wxMenu* aParentMenu );
60 
61 // Build the edit menu
62 static void prepareEditMenu( wxMenu* aParentMenu );
63 
64 // Build the route menu
65 static void prepareRouteMenu( wxMenu* aParentMenu );
66 
67 // Build the view menu
68 static void prepareViewMenu( wxMenu* aParentMenu );
69 
70 // Build the dimensions menu
71 static void prepareDimensionsMenu( wxMenu* aParentMenu );
72 
73 // Build the library management menu
74 static void prepareLibraryMenu( wxMenu* aParentMenu );
75 
76 // Build the design rules menu
77 static void prepareDesignRulesMenu( wxMenu* aParentMenu );
78 
79 // Build the preferences menu
80 static void preparePreferencesMenu( PCB_EDIT_FRAME* aFrame, wxMenu* aParentMenu );
81 
82 
84 {
85  wxString text;
86  wxMenuBar* menuBar = GetMenuBar();
87 
88  if( !menuBar )
89  menuBar = new wxMenuBar();
90 
91  // Delete all existing menus so they can be rebuilt.
92  // This allows language changes of the menu text on the fly.
93  menuBar->Freeze();
94 
95  while( menuBar->GetMenuCount() )
96  delete menuBar->Remove( 0 );
97 
98  // Recreate all menus:
99 
100  // Create File Menu
101  wxMenu* filesMenu = new wxMenu;
102  prepareFilesMenu( filesMenu, Kiface().IsSingle() );
103 
104  //----- Edit menu -----------------------------------------------------------
105  wxMenu* editMenu = new wxMenu;
106  prepareEditMenu( editMenu );
107 
108  //----- View menu -----------------------------------------------------------
109  wxMenu* viewMenu = new wxMenu;
110  prepareViewMenu( viewMenu );
111 
112  //----- Place Menu ----------------------------------------------------------
113  wxMenu* placeMenu = new wxMenu;
114  preparePlaceMenu( placeMenu );
115 
116  //----------- Route Menu ----------------------------------------------------
117  wxMenu* routeMenu = new wxMenu;
118  prepareRouteMenu( routeMenu );
119 
120  //----- Preferences and configuration menu------------------------------------
121  wxMenu* configmenu = new wxMenu;
122  prepareLibraryMenu( configmenu );
123  configmenu->AppendSeparator();
124 
125  preparePreferencesMenu( this, configmenu );
126 
127  // Update menu labels:
128  configmenu->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER,
130  _( "Hide La&yers Manager" ) : _("Show La&yers Manager" ) );
131  configmenu->SetLabel( ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR,
133  _( "Hide Microwa&ve Toolbar" ): _( "Show Microwa&ve Toolbar" ) );
134 
135 
136  //--- dimensions submenu ------------------------------------------------------
137  wxMenu* dimensionsMenu = new wxMenu;
138  prepareDimensionsMenu( dimensionsMenu );
139 
140  //----- Tools menu ----------------------------------------------------------
141  wxMenu* toolsMenu = new wxMenu;
142  prepareToolsMenu( toolsMenu );
143 
144  //----- Design Rules menu -----------------------------------------------------
145  wxMenu* designRulesMenu = new wxMenu;
146  prepareDesignRulesMenu( designRulesMenu );
147 
148  //------ Help menu ----------------------------------------------------------------
149  wxMenu* helpMenu = new wxMenu;
150  prepareHelpMenu( helpMenu );
151 
152  // Append all menus to the menuBar
153  menuBar->Append( filesMenu, _( "&File" ) );
154  menuBar->Append( editMenu, _( "&Edit" ) );
155  menuBar->Append( viewMenu, _( "&View" ) );
156  menuBar->Append( placeMenu, _( "&Place" ) );
157  menuBar->Append( routeMenu, _( "Ro&ute" ) );
158  menuBar->Append( configmenu, _( "P&references" ) );
159  menuBar->Append( dimensionsMenu, _( "D&imensions" ) );
160  menuBar->Append( toolsMenu, _( "&Tools" ) );
161  menuBar->Append( designRulesMenu, _( "&Design Rules" ) );
162  menuBar->Append( helpMenu, _( "&Help" ) );
163 
164  menuBar->Thaw();
165 
166  // Associate the menu bar with the frame, if no previous menubar
167  if( GetMenuBar() == NULL )
168  SetMenuBar( menuBar );
169  else
170  menuBar->Refresh();
171 
172 #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
173  // Populate the Action Plugin sub-menu
174  RebuildActionPluginMenus();
175 #endif
176 
177 }
178 
179 // Build the design rules menu
180 void prepareDesignRulesMenu( wxMenu* aParentMenu )
181 {
183  _( "&Design Rules" ),
184  _( "Open design rules editor" ), KiBitmap( config_xpm ) );
185 
186  AddMenuItem( aParentMenu, ID_PCB_LAYERS_SETUP,
187  _( "&Layers Setup" ), _( "Enable and set layer properties" ),
188  KiBitmap( copper_layers_setup_xpm ) );
189 }
190 
191 
192 // Build the preferences menu
193 void preparePreferencesMenu( PCB_EDIT_FRAME* aFrame, wxMenu* aParentMenu )
194 {
196  _( "Hide La&yers Manager" ),
198  KiBitmap( layers_manager_xpm ) );
199 
201  _( "Hide Microwa&ve Toolbar" ),
203  KiBitmap( mw_toolbar_xpm ) );
204 #ifdef __WXMAC__
205  aParentMenu->Append( wxID_PREFERENCES );
206 #else
207  AddMenuItem( aParentMenu, wxID_PREFERENCES,
208  _( "&General Settings" ), _( "Select general options for Pcbnew" ),
209  KiBitmap( preference_xpm ) );
210 #endif
211 
213  _( "&Display and Hide" ),
214  _( "Select how items (pads, tracks, texts) are displayed" ),
215  KiBitmap( display_options_xpm ) );
216 
218  _( "&Interactive Routing" ),
219  _( "Configure interactive router" ),
220  KiBitmap( add_tracks_xpm ) ); // fixme: icon
221 
222  // Language submenu
223  aParentMenu->AppendSeparator();
224  Pgm().AddMenuLanguageList( aParentMenu );
225 
226  // Icons options submenu
227  aFrame->AddMenuIconsOptions( aParentMenu );
228 
229  // Hotkey submenu
230  AddHotkeyConfigMenu( aParentMenu );
231 
232  aParentMenu->AppendSeparator();
233 
234  AddMenuItem( aParentMenu, ID_CONFIG_SAVE,
235  _( "&Save Preferences" ),
236  _( "Save application preferences" ),
237  KiBitmap( save_setup_xpm ) );
238 
239  AddMenuItem( aParentMenu, ID_CONFIG_READ,
240  _( "Load Prefe&rences" ),
241  _( "Load application preferences" ),
242  KiBitmap( read_setup_xpm ) );
243 }
244 
245 
246 // Build the route menu
247 void prepareRouteMenu( wxMenu* aParentMenu )
248 {
249  AddMenuItem( aParentMenu, ID_TRACK_BUTT,
250  _( "&Single Track" ),
251  _( "Interactively route single track" ),
252  KiBitmap( add_tracks_xpm ) );
253 
254  AddMenuItem( aParentMenu, ID_DIFF_PAIR_BUTT,
255  _( "&Differential Pair" ),
256  _( "Interactively route differential pair" ),
257  KiBitmap( ps_diff_pair_xpm ) );
258 
259  aParentMenu->AppendSeparator();
260 
262  _( "&Tune Track Length" ),
263  _( "Tune length of single track" ),
264  KiBitmap( ps_tune_length_xpm ) );
265 
267  _( "Tune Differential Pair &Length" ),
268  _( "Tune length of differential pair" ),
269  KiBitmap( ps_diff_pair_tune_length_xpm ) );
270 
272  _( "Tune Differential Pair &Skew/Phase" ),
273  _( "Tune skew/phase of a differential pair" ),
274  KiBitmap( ps_diff_pair_tune_phase_xpm ) );
275 }
276 
277 
278 // Build the library management menu
279 void prepareLibraryMenu( wxMenu* aParentMenu )
280 {
281  AddMenuItem( aParentMenu, ID_PCB_LIB_WIZARD,
282  _( "&Footprint Libraries Wizard" ), _( "Add footprint libraries using wizard" ),
283  KiBitmap( wizard_add_fplib_small_xpm ) );
284 
285  AddMenuItem( aParentMenu, ID_PCB_LIB_TABLE_EDIT,
286  _( "Footprint Li&braries Manager" ), _( "Configure footprint libraries" ),
287  KiBitmap( library_table_xpm ) );
288 
289  // Path configuration edit dialog.
290  AddMenuItem( aParentMenu,
292  _( "Configure Pa&ths" ),
293  _( "Edit path configuration environment variables" ),
294  KiBitmap( path_xpm ) );
295 
296 #ifdef BUILD_GITHUB_PLUGIN
298  _( "&3D Shape Downloader" ),
299  _( "Download from Github 3D shape libraries using wizard" ),
300  KiBitmap( import3d_xpm ) );
301 #endif
302 }
303 
304 
305 // Build the place submenu
306 void preparePlaceMenu( wxMenu* aParentMenu )
307 {
308  wxString text;
309 
310  text = AddHotkeyName( _( "&Footprint" ), g_Pcbnew_Editor_Hokeys_Descr,
311  HK_ADD_MODULE );
312  AddMenuItem( aParentMenu, ID_PCB_MODULE_BUTT, text,
313  _( "Add footprints" ), KiBitmap( module_xpm ) );
314 
315  text = AddHotkeyName( _( "&Track" ), g_Pcbnew_Editor_Hokeys_Descr,
317  AddMenuItem( aParentMenu, ID_TRACK_BUTT, text,
318  _( "Add tracks and vias" ), KiBitmap( add_tracks_xpm ) );
319 
320  AddMenuItem( aParentMenu, ID_PCB_ZONES_BUTT,
321  _( "&Zone" ), _( "Add filled zones" ), KiBitmap( add_zone_xpm ) );
322 
324  _( "&Keepout Area" ), _( "Add keepout areas" ), KiBitmap( add_keepout_area_xpm ) );
325 
326  AddMenuItem( aParentMenu, ID_PCB_ADD_TEXT_BUTT,
327  _( "Te&xt" ), _( "Add text on copper layers or graphic text" ),
328  KiBitmap( text_xpm ) );
329 
330  AddMenuItem( aParentMenu, ID_PCB_ARC_BUTT,
331  _( "&Arc" ), _( "Add graphic arc" ),KiBitmap( add_arc_xpm ) );
332 
333  AddMenuItem( aParentMenu, ID_PCB_CIRCLE_BUTT,
334  _( "&Circle" ), _( "Add graphic circle" ),
335  KiBitmap( add_circle_xpm ) );
336 
337  AddMenuItem( aParentMenu, ID_PCB_ADD_LINE_BUTT,
338  _( "&Line or Polygon" ),
339  _( "Add graphic line or polygon" ),
340  KiBitmap( add_dashed_line_xpm ) );
341 
342  aParentMenu->AppendSeparator();
343 
344  AddMenuItem( aParentMenu, ID_PCB_DIMENSION_BUTT,
345  _( "&Dimension" ), _( "Add dimension" ),
346  KiBitmap( add_dimension_xpm ) );
347 
348  AddMenuItem( aParentMenu, ID_PCB_MIRE_BUTT,
349  _( "La&yer Alignment Target" ), _( "Add layer alignment target" ),
350  KiBitmap( add_mires_xpm ) );
351 
352  aParentMenu->AppendSeparator();
353 
355  _( "Drill and &Place Offset" ),
356  _( "Place origin point for drill and place files" ),
357  KiBitmap( pcb_offset_xpm ) );
358 
360  _( "&Grid Origin" ),
361  _( "Set grid origin point" ),
362  KiBitmap( grid_select_axis_xpm ) );
363 }
364 
365 
366 // Build the tools menu
367 void prepareToolsMenu( wxMenu* aParentMenu )
368 {
369  AddMenuItem( aParentMenu,
371  _( "Update PCB from Schematic" ),
372  _( "Update PCB design with current schematic (forward annotation)" ),
373  KiBitmap( import_brd_file_xpm ) );
374 
375  aParentMenu->AppendSeparator( );
376 
377  AddMenuItem( aParentMenu, ID_GET_NETLIST,
378  _( "Load &Netlist" ),
379  _( "Read netlist and update board connectivity" ),
380  KiBitmap( netlist_xpm ) );
381 
383  _( "Set &Layer Pair" ), _( "Change active layer pair" ),
384  KiBitmap( select_layer_pair_xpm ) );
385 
386  AddMenuItem( aParentMenu, ID_DRC_CONTROL,
387  _( "&Design Rules Check" ),
388  _( "Perform design rules check" ), KiBitmap( erc_xpm ) );
389 
391  _( "&FreeRoute" ),
392  _( "Fast access to the FreeROUTE external advanced router" ),
393  KiBitmap( web_support_xpm ) );
394 
395 #if defined(KICAD_SCRIPTING_WXPYTHON)
397  _( "&Scripting Console" ),
398  _( "Show/Hide the Python scripting console" ),
399  KiBitmap( py_script_xpm ) );
400 #endif
401 
402 #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
403  aParentMenu->AppendSeparator( );
404 
405  wxMenu* submenuActionPluginsMenu = new wxMenu();
406 
407  AddMenuItem( aParentMenu, submenuActionPluginsMenu, ID_TOOLBARH_PCB_ACTION_PLUGIN,
408  _( "&External Plugins" ),
409  _( "Execute or reload python action plugins" ),
410  KiBitmap( hammer_xpm ) );
411 
412  AddMenuItem( submenuActionPluginsMenu, ID_TOOLBARH_PCB_ACTION_PLUGIN_REFRESH,
413  _( "&Refresh Plugins" ),
414  _( "Reload all python plugins and refresh plugin menus" ),
415  KiBitmap( reload_xpm ) );
416 
417  submenuActionPluginsMenu->AppendSeparator();
418 #endif
419 }
420 
421 
422 // Build the help menu
423 void prepareHelpMenu( wxMenu* aParentMenu )
424 {
425 
426  AddMenuItem( aParentMenu, wxID_HELP,
427  _( "Pcbnew &Manual" ),
428  _( "Open Pcbnew Manual" ),
429  KiBitmap( online_help_xpm ) );
430 
431  AddMenuItem( aParentMenu, wxID_INDEX,
432  _( "&Getting Started in KiCad" ),
433  _( "Open \"Getting Started in KiCad\" guide for beginners" ),
434  KiBitmap( help_xpm ) );
435 
437  _( "&List Hotkeys" ),
438  _( "Display current hotkeys list and corresponding commands" ),
439  KiBitmap( hotkeys_xpm ) );
440 
441  aParentMenu->AppendSeparator();
442 
443  AddMenuItem( aParentMenu, ID_HELP_GET_INVOLVED,
444  _( "Get &Involved" ),
445  _( "Contribute to KiCad - open web browser" ),
446  KiBitmap( info_xpm ) );
447 
448  aParentMenu->AppendSeparator();
449 
450  AddMenuItem( aParentMenu, wxID_ABOUT,
451  _( "&About KiCad" ),
452  _( "Display KiCad About dialog" ),
453  KiBitmap( about_xpm ) );
454 }
455 
456 
457 // Build the edit menu
458 void prepareEditMenu( wxMenu* aParentMenu )
459 {
460  wxString text;
461 
462  text = AddHotkeyName( _( "&Undo" ), g_Pcbnew_Editor_Hokeys_Descr, HK_UNDO );
463  AddMenuItem( aParentMenu, wxID_UNDO, text, HELP_UNDO, KiBitmap( undo_xpm ) );
464 
465  text = AddHotkeyName( _( "&Redo" ), g_Pcbnew_Editor_Hokeys_Descr, HK_REDO );
466  AddMenuItem( aParentMenu, wxID_REDO, text, HELP_REDO, KiBitmap( redo_xpm ) );
467 
468  AddMenuItem( aParentMenu, ID_PCB_DELETE_ITEM_BUTT,
469  _( "&Delete" ), _( "Delete items" ),
470  KiBitmap( delete_xpm ) );
471 
472  aParentMenu->AppendSeparator();
473 
475  AddMenuItem( aParentMenu, ID_FIND_ITEMS, text, HELP_FIND , KiBitmap( find_xpm ) );
476 
477  aParentMenu->AppendSeparator();
479  _( "Edit All Tracks and Vias" ), KiBitmap( width_track_via_xpm ) );
480 
482  _( "Set Footp&rint Field Sizes" ),
483  _( "Set text size and width of footprint fields" ),
484  KiBitmap( reset_text_xpm ) );
485 
486  AddMenuItem( aParentMenu, ID_MENU_PCB_SWAP_LAYERS,
487  _( "&Swap Layers" ),
488  _( "Swap tracks on copper layers or drawings on other layers" ),
489  KiBitmap( swap_layer_xpm ) );
490 
491  aParentMenu->AppendSeparator();
492  AddMenuItem( aParentMenu, ID_PCB_GLOBAL_DELETE,
493  _( "&Global Deletions" ),
494  _( "Delete tracks, footprints and texts on board" ),
495  KiBitmap( general_deletions_xpm ) );
496 
497  AddMenuItem( aParentMenu, ID_MENU_PCB_CLEAN,
498  _( "&Cleanup Tracks and Vias" ),
499  _( "Clean stubs, vias, delete break points or unconnected tracks" ),
500  KiBitmap( delete_xpm ) );
501 }
502 
503 
504 // Build the view menu
505 void prepareViewMenu( wxMenu* aParentMenu )
506 {
507  wxString text;
508  /* Important Note for ZOOM IN and ZOOM OUT commands from menubar:
509  * we cannot add hotkey info here, because the hotkey HK_ZOOM_IN and HK_ZOOM_OUT
510  * events(default = WXK_F1 and WXK_F2) are *NOT* equivalent to this menu command:
511  * zoom in and out from hotkeys are equivalent to the pop up menu zoom
512  * From here, zooming is made around the screen center
513  * From hotkeys, zooming is made around the mouse cursor position
514  * (obviously not possible from the toolbar or menubar command)
515  *
516  * in other words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators
517  * for Zoom in and Zoom out sub menus
518  */
519  text = AddHotkeyName( _( "Zoom &In" ), g_Pcbnew_Editor_Hokeys_Descr,
521  AddMenuItem( aParentMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) );
522 
523  text = AddHotkeyName( _( "Zoom &Out" ), g_Pcbnew_Editor_Hokeys_Descr,
525  AddMenuItem( aParentMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) );
526 
527  text = AddHotkeyName( _( "&Fit on Screen" ), g_Pcbnew_Editor_Hokeys_Descr,
528  HK_ZOOM_AUTO );
529  AddMenuItem( aParentMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT,
530  KiBitmap( zoom_fit_in_page_xpm ) );
531 
532  text = AddHotkeyName( _( "&Redraw" ), g_Pcbnew_Editor_Hokeys_Descr, HK_ZOOM_REDRAW );
533  AddMenuItem( aParentMenu, ID_ZOOM_REDRAW, text,
534  HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) );
535 
536  aParentMenu->AppendSeparator();
537 
538  text = AddHotkeyName( _( "&3D Viewer" ), g_Pcbnew_Editor_Hokeys_Descr, HK_3D_VIEWER );
539 
540  AddMenuItem( aParentMenu, ID_MENU_PCB_SHOW_3D_FRAME, text, _( "Show board in 3D viewer" ),
541  KiBitmap( three_d_xpm ) );
542 
543  AddMenuItem( aParentMenu, ID_MENU_LIST_NETS,
544  _( "&List Nets" ), _( "View list of nets with names and IDs" ),
545  KiBitmap( list_nets_xpm ) );
546 
547  aParentMenu->AppendSeparator();
548 
549  AddMenuItem( aParentMenu, ID_MENU_PCB_FLIP_VIEW,
550  _( "&Flip Board View" ),
551  _( "Flip (mirror) the board view" ),
552  KiBitmap( flip_board_xpm ), wxITEM_CHECK );
553 
554 
555  aParentMenu->AppendSeparator();
556 
557  text = AddHotkeyName( _( "Legacy Canva&s" ), g_Pcbnew_Editor_Hokeys_Descr,
559 
560  aParentMenu->Append(
561  new wxMenuItem( aParentMenu, ID_MENU_CANVAS_LEGACY,
562  text, _( "Switch canvas implementation to Legacy" ),
563  wxITEM_RADIO ) );
564 
565  text = AddHotkeyName( _( "Open&GL Canvas" ), g_Pcbnew_Editor_Hokeys_Descr,
567 
568  aParentMenu->Append(
569  new wxMenuItem( aParentMenu, ID_MENU_CANVAS_OPENGL,
570  text, _( "Switch canvas implementation to OpenGL" ),
571  wxITEM_RADIO ) );
572 
573  text = AddHotkeyName( _( "&Cairo Canvas" ), g_Pcbnew_Editor_Hokeys_Descr,
574  HK_CANVAS_CAIRO );
575 
576  aParentMenu->Append(
577  new wxMenuItem( aParentMenu, ID_MENU_CANVAS_CAIRO,
578  text, _( "Switch canvas implementation to Cairo" ),
579  wxITEM_RADIO ) );
580 }
581 
582 
583 // Build the dimensions menu
584 void prepareDimensionsMenu( wxMenu* aParentMenu )
585 {
586  AddMenuItem( aParentMenu, ID_PCB_USER_GRID_SETUP,
587  _( "User Defined G&rid" ),_( "Adjust custom user-defined grid dimensions" ),
588  KiBitmap( grid_xpm ) );
589 
591  _( "Te&xts and Drawings" ),
592  _( "Adjust dimensions for texts and drawings" ),
593  KiBitmap( text_xpm ) );
594 
595  AddMenuItem( aParentMenu, ID_PCB_PAD_SETUP,
596  _( "&Pads Size" ), _( "Adjust default pad characteristics" ),
597  KiBitmap( pad_dimensions_xpm ) );
598 
599  AddMenuItem( aParentMenu, ID_PCB_MASK_CLEARANCE,
600  _( "Pads to &Mask Clearance" ),
601  _( "Adjust global clearance between pads and solder resist mask" ),
602  KiBitmap( pads_mask_layers_xpm ) );
603 
605  _( "&Differential Pairs" ),
606  _( "Define global gap/width for differential pairs." ),
607  KiBitmap( ps_diff_pair_xpm ) );
608 
609  aParentMenu->AppendSeparator();
610  AddMenuItem( aParentMenu, ID_CONFIG_SAVE,
611  _( "&Save Preferences" ), _( "Save dimension preferences" ),
612  KiBitmap( save_xpm ) );
613 }
614 
615 
616 // Build the files menu.
617 void prepareFilesMenu( wxMenu* aParentMenu, bool aIsOutsideProject )
618 {
619  wxString text;
620 
621  // Some commands are available only if Pcbnew is run outside a project (run alone).
622  // aIsOutsideProject is false when Pcbnew is run from Kicad manager.
623  if( aIsOutsideProject )
624  {
625  AddMenuItem( aParentMenu, ID_NEW_BOARD,
626  _( "&New Board" ),
627  _( "Create new board" ),
628  KiBitmap( new_generic_xpm ) );
629 
630  text = AddHotkeyName( _( "&Open Board" ), g_Pcbnew_Editor_Hokeys_Descr, HK_LOAD_BOARD );
631  AddMenuItem( aParentMenu, ID_LOAD_FILE, text,
632  _( "Load existing board" ),
633  KiBitmap( open_brd_file_xpm ) );
634  }
635 
636  wxFileHistory& fhist = Kiface().GetFileHistory();
637 
638  // Load Recent submenu
639  static wxMenu* openRecentMenu;
640 
641  // Add this menu to list menu managed by m_fileHistory
642  // (the file history will be updated when adding/removing files in history
643  if( openRecentMenu )
644  fhist.RemoveMenu( openRecentMenu );
645 
646  openRecentMenu = new wxMenu();
647 
648  fhist.UseMenu( openRecentMenu );
649  fhist.AddFilesToMenu();
650 
651  if( aIsOutsideProject )
652  {
653  AddMenuItem( aParentMenu, openRecentMenu,
654  -1, _( "Open &Recent" ),
655  _( "Open recently opened board" ),
656  KiBitmap( open_project_xpm ) );
657 
658  AddMenuItem( aParentMenu, ID_APPEND_FILE,
659  _( "&Append Board" ),
660  _( "Append another board to currently loaded board" ),
661  KiBitmap( import_xpm ) );
662 
664  _( "Import Non-Kicad Board File" ),
665  _( "Import board file from other applications" ),
666  KiBitmap( import_brd_file_xpm ) );
667 
668  aParentMenu->AppendSeparator();
669  }
670 
672  AddMenuItem( aParentMenu, ID_SAVE_BOARD, text,
673  _( "Save current board" ),
674  KiBitmap( save_xpm ) );
675 
676  // Save as menu:
677  // under a project mgr we do not want to modify the board filename
678  // to keep consistency with the project mgr which expects files names same as prj name
679  // for main files
680  // when not under a project mgr, we are free to change filenames, cwd ...
681  if( Kiface().IsSingle() ) // not when under a project mgr (pcbnew is run as stand alone)
682  {
683  text = AddHotkeyName( _( "Sa&ve As" ), g_Pcbnew_Editor_Hokeys_Descr, HK_SAVE_BOARD_AS );
684  AddMenuItem( aParentMenu, ID_SAVE_BOARD_AS, text,
685  _( "Save current board with new name" ),
686  KiBitmap( save_as_xpm ) );
687  }
688  // under a project mgr, we can save a copy of the board,
689  // but do not change the current board file name
690  else
691  {
692  text = AddHotkeyName( _( "Sa&ve Copy As" ), g_Pcbnew_Editor_Hokeys_Descr, HK_SAVE_BOARD_AS );
693  AddMenuItem( aParentMenu, ID_COPY_BOARD_AS, text,
694  _( "Save copy of the current board" ),
695  KiBitmap( save_as_xpm ) );
696  }
697 
698  aParentMenu->AppendSeparator();
699 
701  _( "Revert to Las&t Backup" ),
702  _( "Clear board and get previous backup version of board" ),
703  KiBitmap( undo_xpm ) );
704 
706  _( "Resc&ue" ),
707  _( "Clear board and get last rescue file automatically saved by Pcbnew" ),
708  KiBitmap( rescue_xpm ) );
709  aParentMenu->AppendSeparator();
710 
711  //----- Fabrication Outputs submenu -----------------------------------------
712  wxMenu* fabricationOutputsMenu = new wxMenu;
713  AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_POS_MODULES_FILE,
714  _( "Footprint &Position (.pos) File" ),
715  _( "Generate footprint position file for pick and place" ),
716  KiBitmap( post_compo_xpm ) );
717 
718  AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_DRILL_FILE,
719  _( "&Drill (.drl) File" ),
720  _( "Generate excellon2 drill file" ),
721  KiBitmap( post_drill_xpm ) );
722 
723  AddMenuItem( fabricationOutputsMenu, ID_GEN_EXPORT_FILE_MODULE_REPORT,
724  _( "&Footprint (.rpt) Report.." ),
725  _( "Create report of all footprints from current board" ),
726  KiBitmap( tools_xpm ) );
727 
728  AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_D356_FILE,
729  _( "IPC-D-356 Netlist File" ),
730  _( "Generate IPC-D-356 netlist file" ),
731  KiBitmap( netlist_xpm ) );
732 
733  AddMenuItem( fabricationOutputsMenu, ID_PCB_GEN_BOM_FILE_FROM_BOARD,
734  _( "&BOM File" ),
735  _( "Create bill of materials from current schematic" ),
736  KiBitmap( bom_xpm ) );
737 
738  AddMenuItem( aParentMenu, fabricationOutputsMenu,
739  -1, _( "&Fabrication Outputs" ),
740  _( "Generate files for fabrication" ),
741  KiBitmap( fabrication_xpm ) );
742 
743  //----- Import submenu ------------------------------------------------------
744  wxMenu* submenuImport = new wxMenu();
745 
747  _( "&Specctra Session" ),
748  _( "Import routed \"Specctra Session\" (*.ses) file" ),
749  KiBitmap( import_xpm ) );
750 
751  AddMenuItem( submenuImport, ID_GEN_IMPORT_DXF_FILE,
752  _( "&DXF File" ),
753  _( "Import 2D Drawing DXF file to Pcbnew on Drawings layer" ),
754  KiBitmap( import_xpm ) );
755 
756  AddMenuItem( aParentMenu, submenuImport,
757  ID_GEN_IMPORT_FILE, _( "&Import" ),
758  _( "Import files" ), KiBitmap( import_xpm ) );
759 
760 
761  //----- Export submenu ------------------------------------------------------
762  wxMenu* submenuexport = new wxMenu();
763  prepareExportMenu( submenuexport );
764 
765  AddMenuItem( aParentMenu, submenuexport,
766  ID_GEN_EXPORT_FILE, _( "E&xport" ),
767  _( "Export board" ), KiBitmap( export_xpm ) );
768 
769  aParentMenu->AppendSeparator();
770 
771  AddMenuItem( aParentMenu, ID_SHEET_SET,
772  _( "Page S&ettings" ),
773  _( "Settings for sheet size and frame references" ),
774  KiBitmap( sheetset_xpm ) );
775 
776  AddMenuItem( aParentMenu, wxID_PRINT,
777  _( "&Print" ), _( "Print board" ),
778  KiBitmap( print_button_xpm ) );
779 
780  AddMenuItem( aParentMenu, ID_GEN_PLOT_SVG,
781  _( "Export SV&G" ),
782  _( "Export board file in Scalable Vector Graphics format" ),
783  KiBitmap( plot_svg_xpm ) );
784 
785  AddMenuItem( aParentMenu, ID_GEN_PLOT,
786  _( "P&lot" ),
787  _( "Plot board in HPGL, PostScript or Gerber RS-274X format)" ),
788  KiBitmap( plot_xpm ) );
789 
790  aParentMenu->AppendSeparator();
791 
792  //----- archive submenu -----------------------------------------------------
793  wxMenu* submenuarchive = new wxMenu();
794 
796  _( "&Archive Footprints in Project Library" ),
797  _( "Archive all footprints in existing library in footprint Lib table"
798  "(does not remove other footprints in this library)" ),
799  KiBitmap( library_archive_xpm ) );
800 
802  _( "&Create New Library and Archive Footprints" ),
803  _( "Archive all footprints in new library\n"
804  "(if the library already exists it will be deleted)" ),
805  KiBitmap( library_archive_as_xpm ) );
806 
807  AddMenuItem( aParentMenu, submenuarchive,
809  _( "Arc&hive Footprints" ),
810  _( "Archive or add all footprints in library file" ),
811  KiBitmap( library_archive_xpm ) );
812 
813  aParentMenu->AppendSeparator();
814  AddMenuItem( aParentMenu, wxID_EXIT, _( "&Close" ), _( "Close Pcbnew" ), KiBitmap( exit_xpm ) );
815 }
816 
817 
818 // Build the import/export submenu (inside files menu)
819 void prepareExportMenu( wxMenu* aParentMenu )
820 {
821  AddMenuItem( aParentMenu, ID_GEN_EXPORT_SPECCTRA,
822  _( "&Specctra DSN" ),
823  _( "Export current board to \"Specctra DSN\" file" ),
824  KiBitmap( export_dsn_xpm ) );
825 
827  _( "&GenCAD" ), _( "Export GenCAD format" ),
828  KiBitmap( export_xpm ) );
829 
830  AddMenuItem( aParentMenu, ID_GEN_EXPORT_FILE_VRML,
831  _( "&VRML" ),
832  _( "Export VRML board representation" ),
833  KiBitmap( three_d_xpm ) );
834 
835  AddMenuItem( aParentMenu, ID_GEN_EXPORT_FILE_IDF3,
836  _( "I&DFv3" ), _( "IDFv3 board and component export" ),
837  KiBitmap( export_idf_xpm ) );
838 
839  AddMenuItem( aParentMenu, ID_GEN_EXPORT_FILE_STEP,
840  _( "S&TEP" ), _( "STEP export" ),
841  KiBitmap( export_idf_xpm ) );
842 
843  AddMenuItem( aParentMenu, ID_PCB_GEN_CMP_FILE,
844  _( "&Component (.cmp) File" ),
845  _( "Export component file (*.cmp) for Eeschema footprint field back-annotation" ),
846  KiBitmap( create_cmp_file_xpm ) );
847 }
#define HELP_SHOW_HIDE_MICROWAVE_TOOLS
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:55
#define HELP_ZOOM_FIT
Definition: id.h:232
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: kicad.cpp:65
bool m_show_microwave_tools
Definition: wxPcbStruct.h:247
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
#define HELP_ZOOM_OUT
Pcbnew hotkeys.
bool m_show_layer_manager_tools
Definition: wxPcbStruct.h:248
#define HELP_ZOOM_REDRAW
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:36
struct EDA_HOTKEY_CONFIG g_Pcbnew_Editor_Hokeys_Descr[]
wxFileHistory & GetFileHistory()
Definition: kiface_i.h:123
void ReCreateMenuBar() override
Function ReCreateMenuBar Creates recreates the menu bar.
void AddHotkeyConfigMenu(wxMenu *aMenu)
void AddMenuIconsOptions(wxMenu *MasterMenu)
Function AddMenuIconsOptions creates a menu list for icons in menu and icon sizes choice...
Definition: basicframe.cpp:671
#define HELP_REDO
wxString AddHotkeyName(const wxString &aText, EDA_HOTKEY **aList, int aCommandId, HOTKEY_ACTION_TYPE aShortCutType)
Function AddHotkeyName Add the key name from the Command id value ( m_Idcommand member value) ...
see class PGM_BASE
#define HELP_ZOOM_IN
#define HELP_SHOW_HIDE_LAYERMANAGER
#define HELP_UNDO
These strings are used in menus and tools, that do the same command But they are internationalized, and therefore must be created at run time, on the fly.
Definition: id.h:96
VTBL_ENTRY void AddMenuLanguageList(wxMenu *MasterMenu)
Function AddMenuLanguageList creates a menu list for language choice, and add it as submenu to Master...
Definition: pgm_base.cpp:822
static const char * text_xpm[]
strings common to toolbars and menubar
#define HELP_FIND