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, 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
28#include "pcbnew_id.h"
29#include <bitmaps.h>
30#include <tool/actions.h>
31#include <tool/action_menu.h>
32#include <tool/tool_manager.h>
33#include <tools/pcb_actions.h>
35#include <widgets/wx_menubar.h>
36
37
39{
41 // wxWidgets handles the Mac Application menu behind the scenes, but that means
42 // we always have to start from scratch with a new wxMenuBar.
43 wxMenuBar* oldMenuBar = GetMenuBar();
44 WX_MENUBAR* menuBar = new WX_MENUBAR();
45
46 //-- File menu ----------------------------------------------------------
47 //
48 ACTION_MENU* fileMenu = new ACTION_MENU( false, selTool );
49
50 fileMenu->Add( ACTIONS::newLibrary );
51 fileMenu->Add( ACTIONS::addLibrary );
52 fileMenu->Add( PCB_ACTIONS::newFootprint );
55
56 fileMenu->AppendSeparator();
57
58 fileMenu->Add( ACTIONS::save );
59 fileMenu->Add( ACTIONS::saveAs );
60 fileMenu->Add( ACTIONS::revert );
61
62 fileMenu->AppendSeparator();
63
64 ACTION_MENU* submenuImport = new ACTION_MENU( false, selTool );
65 submenuImport->SetTitle( _( "Import" ) );
66 submenuImport->SetIcon( BITMAPS::import );
67
68 submenuImport->Add( PCB_ACTIONS::importFootprint, ACTION_MENU::NORMAL, _( "Footprint..." ) );
69 submenuImport->Add( PCB_ACTIONS::placeImportedGraphics, ACTION_MENU::NORMAL, _( "Graphics..." ) );
70
71 fileMenu->Add( submenuImport );
72
73 ACTION_MENU* submenuExport = new ACTION_MENU( false, selTool );
74 submenuExport->SetTitle( _( "Export" ) );
75 submenuExport->SetIcon( BITMAPS::export_file );
76
77 submenuExport->Add( PCB_ACTIONS::exportFootprint, ACTION_MENU::NORMAL, _( "Footprint..." ) );
78 submenuExport->Add( _( "View as &PNG..." ),
79 _( "Create a PNG file from the current view" ),
82
83 fileMenu->Add( submenuExport );
84
85 fileMenu->AppendSeparator();
87
88 fileMenu->AppendSeparator();
89 fileMenu->Add( ACTIONS::print );
90
91 fileMenu->AppendSeparator();
92 fileMenu->AddClose( _( "Footprint Editor" ) );
93
94
95 //-- Edit menu -------------------------------------------------------
96 //
97 ACTION_MENU* editMenu = new ACTION_MENU( false, selTool );
98
99 editMenu->Add( ACTIONS::undo );
100 editMenu->Add( ACTIONS::redo );
101
102 editMenu->AppendSeparator();
103 editMenu->Add( ACTIONS::cut );
104 editMenu->Add( ACTIONS::copy );
105 editMenu->Add( ACTIONS::paste );
106 editMenu->Add( ACTIONS::doDelete );
107 editMenu->Add( ACTIONS::duplicate );
108
109
110 editMenu->AppendSeparator();
111
112 // Select Submenu
113 ACTION_MENU* selectSubMenu = new ACTION_MENU( false, selTool );
114 selectSubMenu->SetTitle( _( "&Select" ) );
115 selectSubMenu->Add( ACTIONS::selectAll );
116 selectSubMenu->Add( ACTIONS::unselectAll );
117
118 editMenu->Add( selectSubMenu );
119
120 editMenu->AppendSeparator();
122 editMenu->Add( PCB_ACTIONS::padTable );
124 editMenu->Add( PCB_ACTIONS::enumeratePads );
125 editMenu->Add( ACTIONS::gridOrigin );
126
127
128 //-- View menu -------------------------------------------------------
129 //
130 ACTION_MENU* viewMenu = new ACTION_MENU( false, selTool );
131
132 ACTION_MENU* showHidePanels = new ACTION_MENU( false, selTool );
133 showHidePanels->SetTitle( _( "Panels" ) );
137 viewMenu->Add( showHidePanels );
138 viewMenu->AppendSeparator();
139
141 viewMenu->Add( ACTIONS::show3DViewer );
142
143 viewMenu->AppendSeparator();
144 viewMenu->Add( ACTIONS::zoomInCenter );
145 viewMenu->Add( ACTIONS::zoomOutCenter );
146 viewMenu->Add( ACTIONS::zoomFitScreen );
147 viewMenu->Add( ACTIONS::zoomTool );
148 viewMenu->Add( ACTIONS::zoomRedraw );
149
150 viewMenu->AppendSeparator();
151 // Drawing Mode Submenu
152 ACTION_MENU* drawingModeSubMenu = new ACTION_MENU( false, selTool );
153 drawingModeSubMenu->SetTitle( _( "&Drawing Mode" ) );
154 drawingModeSubMenu->SetIcon( BITMAPS::add_zone );
155
156 drawingModeSubMenu->Add( PCB_ACTIONS::padDisplayMode, ACTION_MENU::CHECK );
158 drawingModeSubMenu->Add( PCB_ACTIONS::textOutlines, ACTION_MENU::CHECK );
159 viewMenu->Add( drawingModeSubMenu );
160
161 // Contrast Mode Submenu
162 ACTION_MENU* contrastModeSubMenu = new ACTION_MENU( false, selTool );
163 contrastModeSubMenu->SetTitle( _( "&Contrast Mode" ) );
164 contrastModeSubMenu->SetIcon( BITMAPS::contrast_mode );
165
166 contrastModeSubMenu->Add( ACTIONS::highContrastMode, ACTION_MENU::CHECK );
167 contrastModeSubMenu->Add( PCB_ACTIONS::layerAlphaDec );
168 contrastModeSubMenu->Add( PCB_ACTIONS::layerAlphaInc );
169 viewMenu->Add( contrastModeSubMenu );
170
172
173
174 //-- Place menu -------------------------------------------------------
175 //
176 ACTION_MENU* placeMenu = new ACTION_MENU( false, selTool );
177
178 placeMenu->Add( PCB_ACTIONS::placePad );
179 placeMenu->Add( PCB_ACTIONS::drawRuleArea );
180
181 placeMenu->AppendSeparator();
182 placeMenu->Add( PCB_ACTIONS::drawLine );
183 placeMenu->Add( PCB_ACTIONS::drawArc );
184 placeMenu->Add( PCB_ACTIONS::drawRectangle );
185 placeMenu->Add( PCB_ACTIONS::drawCircle );
186 placeMenu->Add( PCB_ACTIONS::drawPolygon );
187 placeMenu->Add( PCB_ACTIONS::drawBezier );
189 placeMenu->Add( PCB_ACTIONS::placeText );
190 placeMenu->Add( PCB_ACTIONS::drawTextBox );
191 placeMenu->Add( PCB_ACTIONS::drawTable );
192 placeMenu->Add( PCB_ACTIONS::placePoint );
193
194 placeMenu->AppendSeparator();
199 placeMenu->Add( PCB_ACTIONS::drawLeader );
200
201 placeMenu->AppendSeparator();
202 placeMenu->Add( PCB_ACTIONS::setAnchor );
203 placeMenu->Add( ACTIONS::gridSetOrigin );
204 placeMenu->AppendSeparator();
205 placeMenu->Add( ACTIONS::gridResetOrigin );
206
207
208 //-- Inspect menu ------------------------------------------------------
209 //
210 ACTION_MENU* inspectMenu = new ACTION_MENU( false, selTool );
211
212 inspectMenu->Add( ACTIONS::measureTool );
213
214 inspectMenu->AppendSeparator();
215 inspectMenu->Add( PCB_ACTIONS::checkFootprint );
216
217 inspectMenu->AppendSeparator();
218 inspectMenu->Add( PCB_ACTIONS::showDatasheet );
219
220
221 //-- Tools menu --------------------------------------------------------
222 //
223 ACTION_MENU* toolsMenu = new ACTION_MENU( false, selTool );
224
225 toolsMenu->Add( PCB_ACTIONS::loadFpFromBoard );
226 toolsMenu->Add( PCB_ACTIONS::saveFpToBoard );
227
228 toolsMenu->AppendSeparator();
229 toolsMenu->Add( PCB_ACTIONS::cleanupGraphics );
230 toolsMenu->Add( PCB_ACTIONS::repairFootprint );
231
232
233 //-- Preferences menu -------------------------------------------------
234 //
235 ACTION_MENU* prefsMenu = new ACTION_MENU( false, selTool );
236
237 prefsMenu->Add( ACTIONS::configurePaths );
239 prefsMenu->Add( ACTIONS::openPreferences );
240
241 prefsMenu->AppendSeparator();
242 AddMenuLanguageList( prefsMenu, selTool );
243
244 //--MenuBar -----------------------------------------------------------
245 //
246 menuBar->Append( fileMenu, _( "&File" ) );
247 menuBar->Append( editMenu, _( "&Edit" ) );
248 menuBar->Append( viewMenu, _( "&View" ) );
249 menuBar->Append( placeMenu, _( "&Place" ) );
250 menuBar->Append( inspectMenu, _( "&Inspect" ) );
251 menuBar->Append( toolsMenu, _( "&Tools" ) );
252 menuBar->Append( prefsMenu, _( "P&references" ) );
253 AddStandardHelpMenu( menuBar );
254
255 SetMenuBar( menuBar );
256 delete oldMenuBar;
257}
static TOOL_ACTION paste
Definition actions.h:80
static TOOL_ACTION zoomRedraw
Definition actions.h:131
static TOOL_ACTION unselectAll
Definition actions.h:83
static TOOL_ACTION revert
Definition actions.h:62
static TOOL_ACTION show3DViewer
Definition actions.h:257
static TOOL_ACTION showLibraryTree
Definition actions.h:163
static TOOL_ACTION zoomOutCenter
Definition actions.h:135
static TOOL_ACTION saveAs
Definition actions.h:59
static TOOL_ACTION addLibrary
Definition actions.h:56
static TOOL_ACTION copy
Definition actions.h:78
static TOOL_ACTION gridResetOrigin
Definition actions.h:195
static TOOL_ACTION showDatasheet
Definition actions.h:266
static TOOL_ACTION openPreferences
Definition actions.h:281
static TOOL_ACTION showFootprintLibTable
Definition actions.h:284
static TOOL_ACTION undo
Definition actions.h:75
static TOOL_ACTION duplicate
Definition actions.h:84
static TOOL_ACTION highContrastMode
Definition actions.h:154
static TOOL_ACTION gridOrigin
Definition actions.h:200
static TOOL_ACTION measureTool
Definition actions.h:251
static TOOL_ACTION doDelete
Definition actions.h:85
static TOOL_ACTION save
Definition actions.h:58
static TOOL_ACTION zoomFitScreen
Definition actions.h:141
static TOOL_ACTION redo
Definition actions.h:76
static TOOL_ACTION zoomTool
Definition actions.h:145
static TOOL_ACTION print
Definition actions.h:64
static TOOL_ACTION showProperties
Definition actions.h:265
static TOOL_ACTION zoomInCenter
Definition actions.h:134
static TOOL_ACTION newLibrary
Definition actions.h:55
static TOOL_ACTION cut
Definition actions.h:77
static TOOL_ACTION gridSetOrigin
Definition actions.h:194
static TOOL_ACTION configurePaths
Definition actions.h:282
static TOOL_ACTION showFootprintBrowser
Definition actions.h:260
static TOOL_ACTION selectAll
Definition actions.h:82
Define the structure of a menu based on ACTIONs.
Definition action_menu.h:47
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.
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 showLayersManager
static TOOL_ACTION drawCircle
static TOOL_ACTION createFootprint
static TOOL_ACTION exportFootprint
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 defaultPadProperties
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 footprintProperties
static TOOL_ACTION flipBoard
static TOOL_ACTION textOutlines
Display texts as lines.
static TOOL_ACTION checkFootprint
static TOOL_ACTION placePoint
static TOOL_ACTION editLibFpInFpEditor
static TOOL_ACTION repairFootprint
static TOOL_ACTION saveFpToBoard
static TOOL_ACTION drawLine
static TOOL_ACTION cleanupGraphics
static TOOL_ACTION drawAlignedDimension
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:47
#define _(s)
@ ID_FPEDIT_SAVE_PNG
Definition pcbnew_id.h:77