KiCad PCB EDA Suite
Loading...
Searching...
No Matches
menubar_footprint_editor.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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright (C) 2015 Wayne Stambaugh <[email protected]>
7 * Copyright The 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, see <https://www.gnu.org/licenses/>.
21 */
22
24#include "pcbnew_id.h"
25
26#include <bitmaps.h>
27#include <pgm_base.h>
29#include <tool/actions.h>
30#include <tool/action_menu.h>
31#include <tool/tool_manager.h>
32#include <tools/pcb_actions.h>
34#include <widgets/wx_menubar.h>
35
36
38{
40 // wxWidgets handles the Mac Application menu behind the scenes, but that means
41 // we always have to start from scratch with a new wxMenuBar.
42 wxMenuBar* oldMenuBar = GetMenuBar();
43 WX_MENUBAR* menuBar = new WX_MENUBAR();
44
45 //-- File menu ----------------------------------------------------------
46 //
47 ACTION_MENU* fileMenu = new ACTION_MENU( false, selTool );
48
49 fileMenu->Add( ACTIONS::newLibrary );
50 fileMenu->Add( ACTIONS::addLibrary );
51 fileMenu->Add( PCB_ACTIONS::newFootprint );
54
55 fileMenu->AppendSeparator();
56
57 fileMenu->Add( ACTIONS::save );
58 fileMenu->Add( ACTIONS::saveAs );
59 fileMenu->Add( ACTIONS::revert );
60
61 fileMenu->AppendSeparator();
62
63 ACTION_MENU* submenuImport = new ACTION_MENU( false, selTool );
64 submenuImport->SetTitle( _( "Import" ) );
65 submenuImport->SetIcon( BITMAPS::import );
66
67 submenuImport->Add( PCB_ACTIONS::importFootprint, ACTION_MENU::NORMAL, _( "Footprint..." ) );
68 submenuImport->Add( PCB_ACTIONS::placeImportedGraphics, ACTION_MENU::NORMAL, _( "Graphics..." ) );
69
70 fileMenu->Add( submenuImport );
71
72 ACTION_MENU* submenuExport = new ACTION_MENU( false, selTool );
73 submenuExport->SetTitle( _( "Export" ) );
74 submenuExport->SetIcon( BITMAPS::export_file );
75
76 submenuExport->Add( PCB_ACTIONS::exportFootprint, ACTION_MENU::NORMAL, _( "Footprint..." ) );
77 submenuExport->Add( PCB_ACTIONS::exportFootprintAsSVG, ACTION_MENU::NORMAL, _( "Footprint as &SVG..." ) );
78 submenuExport->Add( ACTIONS::exportForOlderVersion, ACTION_MENU::NORMAL, _( "For Older KiCad Version..." ) );
79 submenuExport->Add( _( "View as &PNG..." ),
80 _( "Create a PNG file from the current view" ),
83
84 fileMenu->Add( submenuExport );
85
86 fileMenu->AppendSeparator();
88
89 fileMenu->AppendSeparator();
91
92 fileMenu->AppendSeparator();
93 fileMenu->Add( ACTIONS::print );
94
95 fileMenu->AppendSeparator();
96 fileMenu->AddClose( _( "Footprint Editor" ) );
97
98
99 //-- Edit menu -------------------------------------------------------
100 //
101 ACTION_MENU* editMenu = new ACTION_MENU( false, selTool );
102
103 editMenu->Add( ACTIONS::undo );
104 editMenu->Add( ACTIONS::redo );
105
106 editMenu->AppendSeparator();
107 editMenu->Add( ACTIONS::cut );
108 editMenu->Add( ACTIONS::copy );
109 editMenu->Add( ACTIONS::paste );
110 editMenu->Add( ACTIONS::doDelete );
111 editMenu->Add( ACTIONS::duplicate );
112
113
114 editMenu->AppendSeparator();
115
116 // Select Submenu
117 ACTION_MENU* selectSubMenu = new ACTION_MENU( false, selTool );
118 selectSubMenu->SetTitle( _( "&Select" ) );
119 selectSubMenu->Add( ACTIONS::selectAll );
120 selectSubMenu->Add( ACTIONS::unselectAll );
121
122 editMenu->Add( selectSubMenu );
123
124 editMenu->AppendSeparator();
128 editMenu->Add( PCB_ACTIONS::padTable );
129 editMenu->Add( PCB_ACTIONS::extendGraphic );
130 editMenu->Add( PCB_ACTIONS::trimGraphic );
131 editMenu->Add( PCB_ACTIONS::enumeratePads );
132 editMenu->Add( ACTIONS::gridOrigin );
133
134
135 //-- View menu -------------------------------------------------------
136 //
137 ACTION_MENU* viewMenu = new ACTION_MENU( false, selTool );
138
139 ACTION_MENU* showHidePanels = new ACTION_MENU( false, selTool );
140 showHidePanels->SetTitle( _( "Panels" ) );
144 viewMenu->Add( showHidePanels );
145 viewMenu->AppendSeparator();
146
150 viewMenu->AppendSeparator();
151
153 viewMenu->Add( ACTIONS::show3DViewer );
154
155 viewMenu->AppendSeparator();
156 viewMenu->Add( ACTIONS::zoomInCenter );
157 viewMenu->Add( ACTIONS::zoomOutCenter );
158 viewMenu->Add( ACTIONS::zoomFitScreen );
159 viewMenu->Add( ACTIONS::zoomTool );
160 viewMenu->Add( ACTIONS::zoomRedraw );
161
162 viewMenu->AppendSeparator();
163 // Drawing Mode Submenu
164 ACTION_MENU* drawingModeSubMenu = new ACTION_MENU( false, selTool );
165 drawingModeSubMenu->SetTitle( _( "&Drawing Mode" ) );
166 drawingModeSubMenu->SetIcon( BITMAPS::add_zone );
167
168 drawingModeSubMenu->Add( PCB_ACTIONS::padDisplayMode, ACTION_MENU::CHECK );
170 drawingModeSubMenu->Add( PCB_ACTIONS::textOutlines, ACTION_MENU::CHECK );
171 viewMenu->Add( drawingModeSubMenu );
172
173 // Contrast Mode Submenu
174 ACTION_MENU* contrastModeSubMenu = new ACTION_MENU( false, selTool );
175 contrastModeSubMenu->SetTitle( _( "&Contrast Mode" ) );
176 contrastModeSubMenu->SetIcon( BITMAPS::contrast_mode );
177
178 contrastModeSubMenu->Add( ACTIONS::highContrastMode, ACTION_MENU::CHECK );
179 contrastModeSubMenu->Add( PCB_ACTIONS::layerAlphaDec );
180 contrastModeSubMenu->Add( PCB_ACTIONS::layerAlphaInc );
181 viewMenu->Add( contrastModeSubMenu );
182
184
185
186 //-- Place menu -------------------------------------------------------
187 //
188 ACTION_MENU* placeMenu = new ACTION_MENU( false, selTool );
189
190 placeMenu->Add( PCB_ACTIONS::placePad );
191 placeMenu->Add( PCB_ACTIONS::drawRuleArea );
192
193 placeMenu->AppendSeparator();
194 placeMenu->Add( PCB_ACTIONS::drawLine );
195 placeMenu->Add( PCB_ACTIONS::drawArc );
196 placeMenu->Add( PCB_ACTIONS::drawRectangle );
197 placeMenu->Add( PCB_ACTIONS::drawCircle );
198 placeMenu->Add( PCB_ACTIONS::drawEllipse );
199 placeMenu->Add( PCB_ACTIONS::drawEllipseArc );
200 placeMenu->Add( PCB_ACTIONS::drawPolygon );
201 placeMenu->Add( PCB_ACTIONS::drawBezier );
203 placeMenu->Add( PCB_ACTIONS::placeText );
204 placeMenu->Add( PCB_ACTIONS::drawTextBox );
205 placeMenu->Add( PCB_ACTIONS::drawTable );
206 placeMenu->Add( PCB_ACTIONS::placePoint );
207 placeMenu->Add( PCB_ACTIONS::placeBarcode );
208
209 placeMenu->AppendSeparator();
214 placeMenu->Add( PCB_ACTIONS::drawLeader );
215
216 placeMenu->AppendSeparator();
217 placeMenu->Add( PCB_ACTIONS::setAnchor );
218 placeMenu->Add( ACTIONS::gridSetOrigin );
219 placeMenu->AppendSeparator();
220 placeMenu->Add( ACTIONS::gridResetOrigin );
221
222
223 //-- Inspect menu ------------------------------------------------------
224 //
225 ACTION_MENU* inspectMenu = new ACTION_MENU( false, selTool );
226
227 inspectMenu->Add( ACTIONS::measureTool );
228
229 inspectMenu->AppendSeparator();
230 inspectMenu->Add( PCB_ACTIONS::checkFootprint );
231 inspectMenu->Add( PCB_ACTIONS::showFootprintUsers );
232
233 inspectMenu->AppendSeparator();
234 inspectMenu->Add( PCB_ACTIONS::showDatasheet );
235
236
237 //-- Tools menu --------------------------------------------------------
238 //
239 ACTION_MENU* toolsMenu = new ACTION_MENU( false, selTool );
240
241 toolsMenu->Add( PCB_ACTIONS::loadFpFromBoard );
242 toolsMenu->Add( PCB_ACTIONS::saveFpToBoard );
243
244 toolsMenu->AppendSeparator();
245 toolsMenu->Add( PCB_ACTIONS::cleanupGraphics );
246 toolsMenu->Add( PCB_ACTIONS::repairFootprint );
247
248 ACTION_MENU* submenuActionPlugins = new ACTION_MENU( false, selTool );
249 submenuActionPlugins->SetTitle( _( "External Plugins" ) );
250 submenuActionPlugins->SetIcon( BITMAPS::puzzle_piece );
251
252 if( Pgm().GetCommonSettings()->m_Api.enable_server && AddApiPluginMenuItems( submenuActionPlugins ) > 0 )
253 submenuActionPlugins->AppendSeparator();
254
255 submenuActionPlugins->Add( ACTIONS::pluginsReload );
256 submenuActionPlugins->Add( ACTIONS::pluginsShowFolder );
257
258 toolsMenu->AppendSeparator();
259 toolsMenu->Add( submenuActionPlugins );
260
261 //-- Preferences menu -------------------------------------------------
262 //
263 ACTION_MENU* prefsMenu = new ACTION_MENU( false, selTool );
264
265 prefsMenu->Add( ACTIONS::configurePaths );
267 prefsMenu->Add( ACTIONS::openPreferences );
268
269 prefsMenu->AppendSeparator();
270 AddMenuLanguageList( prefsMenu, selTool );
271
272 //--MenuBar -----------------------------------------------------------
273 //
274 menuBar->Append( fileMenu, _( "&File" ) );
275 menuBar->Append( editMenu, _( "&Edit" ) );
276 menuBar->Append( viewMenu, _( "&View" ) );
277 menuBar->Append( placeMenu, _( "&Place" ) );
278 menuBar->Append( inspectMenu, _( "&Inspect" ) );
279 menuBar->Append( toolsMenu, _( "&Tools" ) );
280 menuBar->Append( prefsMenu, _( "P&references" ) );
281 AddStandardHelpMenu( menuBar );
282
283 SetMenuBar( menuBar );
284 delete oldMenuBar;
285}
static TOOL_ACTION paste
Definition actions.h:77
static TOOL_ACTION zoomRedraw
Definition actions.h:129
static TOOL_ACTION unselectAll
Definition actions.h:80
static TOOL_ACTION revert
Definition actions.h:58
static TOOL_ACTION show3DViewer
Definition actions.h:255
static TOOL_ACTION showLibraryTree
Definition actions.h:161
static TOOL_ACTION zoomOutCenter
Definition actions.h:133
static TOOL_ACTION saveAs
Definition actions.h:55
static TOOL_ACTION exportForOlderVersion
Definition actions.h:60
static TOOL_ACTION addLibrary
Definition actions.h:52
static TOOL_ACTION copy
Definition actions.h:75
static TOOL_ACTION pluginsReload
Definition actions.h:295
static TOOL_ACTION gridResetOrigin
Definition actions.h:193
static TOOL_ACTION showDatasheet
Definition actions.h:265
static TOOL_ACTION pluginsShowFolder
Definition actions.h:296
static TOOL_ACTION openPreferences
Definition actions.h:281
static TOOL_ACTION showFootprintLibTable
Definition actions.h:284
static TOOL_ACTION undo
Definition actions.h:72
static TOOL_ACTION duplicate
Definition actions.h:81
static TOOL_ACTION highContrastMode
Definition actions.h:152
static TOOL_ACTION gridOrigin
Definition actions.h:198
static TOOL_ACTION measureTool
Definition actions.h:249
static TOOL_ACTION doDelete
Definition actions.h:82
static TOOL_ACTION save
Definition actions.h:54
static TOOL_ACTION zoomFitScreen
Definition actions.h:139
static TOOL_ACTION redo
Definition actions.h:73
static TOOL_ACTION zoomTool
Definition actions.h:143
static TOOL_ACTION print
Definition actions.h:61
static TOOL_ACTION showProperties
Definition actions.h:263
static TOOL_ACTION zoomInCenter
Definition actions.h:132
static TOOL_ACTION newLibrary
Definition actions.h:51
static TOOL_ACTION cut
Definition actions.h:74
static TOOL_ACTION gridSetOrigin
Definition actions.h:192
static TOOL_ACTION configurePaths
Definition actions.h:282
static TOOL_ACTION showFootprintBrowser
Definition actions.h:258
static TOOL_ACTION selectAll
Definition actions.h:79
Define the structure of a menu based on ACTIONs.
Definition action_menu.h:43
static constexpr bool CHECK
void AddClose(const wxString &aAppname="")
Add a standard close item to the menu with the accelerator key CTRL-W.
void SetTitle(const wxString &aTitle) override
Set title for the menu.
static constexpr bool NORMAL
void SetIcon(BITMAPS aIcon)
Assign an icon for the entry.
wxMenuItem * Add(const wxString &aLabel, int aId, BITMAPS aIcon)
Add a wxWidgets-style entry to the menu.
void AddMenuLanguageList(ACTION_MENU *aMasterMenu, TOOL_INTERACTIVE *aControlTool)
Create a menu list for language choice, and add it as submenu to MasterMenu.
void AddStandardHelpMenu(wxMenuBar *aMenuBar)
Add the standard KiCad help menu to the menubar.
size_t AddApiPluginMenuItems(ACTION_MENU *aMenu)
Append actions from API plugins to the given menu.
void doReCreateMenuBar() override
(Re)Create the menubar for the Footprint Editor frame
static TOOL_ACTION drawRuleArea
static TOOL_ACTION drawBezier
static TOOL_ACTION placeText
static TOOL_ACTION drawOrthogonalDimension
static TOOL_ACTION enumeratePads
Tool for quick pad enumeration.
static TOOL_ACTION drawRectangle
static TOOL_ACTION setAnchor
static TOOL_ACTION padDisplayMode
static TOOL_ACTION placeReferenceImage
static TOOL_ACTION showFootprintUsers
static TOOL_ACTION showLayersManager
static TOOL_ACTION drawCircle
static TOOL_ACTION createFootprint
static TOOL_ACTION exportFootprint
static TOOL_ACTION drawEllipseArc
static TOOL_ACTION drawTable
static TOOL_ACTION drawTextBox
static TOOL_ACTION layerAlphaDec
static TOOL_ACTION drawPolygon
static TOOL_ACTION placePad
Activation of the drawing tool (placing a PAD)
static TOOL_ACTION drawRadialDimension
static TOOL_ACTION padTable
static TOOL_ACTION editTextAndGraphics
static TOOL_ACTION drawLeader
static TOOL_ACTION layerAlphaInc
static TOOL_ACTION newFootprint
static TOOL_ACTION prevFootprintTab
static TOOL_ACTION extendGraphic
Extend one graphical line or arc to the nearest boundary.
static TOOL_ACTION drawEllipse
static TOOL_ACTION importFootprint
static TOOL_ACTION placeImportedGraphics
static TOOL_ACTION drawArc
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
static TOOL_ACTION loadFpFromBoard
static TOOL_ACTION drawCenterDimension
static TOOL_ACTION mirrorInteractive
static TOOL_ACTION footprintProperties
static TOOL_ACTION flipBoard
static TOOL_ACTION closeFootprintTab
static TOOL_ACTION nextFootprintTab
static TOOL_ACTION textOutlines
Display texts as lines.
static TOOL_ACTION showLibFootprintFieldsTable
static TOOL_ACTION checkFootprint
static TOOL_ACTION placeBarcode
static TOOL_ACTION placePoint
static TOOL_ACTION editLibFpInFpEditor
static TOOL_ACTION repairFootprint
static TOOL_ACTION exportFootprintAsSVG
static TOOL_ACTION saveFpToBoard
static TOOL_ACTION compareFpLibraryWithFile
static TOOL_ACTION drawLine
static TOOL_ACTION cleanupGraphics
static TOOL_ACTION drawAlignedDimension
static TOOL_ACTION trimGraphic
Trim a section from one graphical line or arc.
The selection tool: currently supports:
TOOL_MANAGER * m_toolManager
Wrapper around a wxMenuBar object that prevents the accelerator table from being used.
Definition wx_menubar.h:43
#define _(s)
@ ID_FPEDIT_SAVE_PNG
Definition pcbnew_id.h:82
PGM_BASE & Pgm()
The global program "get" accessor.
see class PGM_BASE