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 (C) 1992-2022 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 );
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( _( "View as &PNG..." ),
78 _( "Create a PNG file from the current view" ),
80 BITMAPS::export_png );
81
82 fileMenu->Add( submenuExport );
83
84 fileMenu->AppendSeparator();
86
87 fileMenu->AppendSeparator();
88 fileMenu->Add( ACTIONS::print );
89
90 fileMenu->AppendSeparator();
91 fileMenu->AddClose( _( "Footprint Editor" ) );
92
93
94 //-- Edit menu -------------------------------------------------------
95 //
96 ACTION_MENU* editMenu = new ACTION_MENU( false, selTool );
97
98 editMenu->Add( ACTIONS::undo );
99 editMenu->Add( ACTIONS::redo );
100
101 editMenu->AppendSeparator();
102 editMenu->Add( ACTIONS::cut );
103 editMenu->Add( ACTIONS::copy );
104 editMenu->Add( ACTIONS::paste );
105 editMenu->Add( ACTIONS::doDelete );
106 editMenu->Add( ACTIONS::duplicate );
107
108 editMenu->AppendSeparator();
109 editMenu->Add( ACTIONS::selectAll );
110
111 editMenu->AppendSeparator();
114 editMenu->Add( PCB_ACTIONS::enumeratePads );
115
116
117 //-- View menu -------------------------------------------------------
118 //
119 ACTION_MENU* viewMenu = new ACTION_MENU( false, selTool );
120
122 viewMenu->Add( ACTIONS::show3DViewer );
123
124 viewMenu->AppendSeparator();
125 viewMenu->Add( ACTIONS::zoomInCenter );
126 viewMenu->Add( ACTIONS::zoomOutCenter );
127 viewMenu->Add( ACTIONS::zoomFitScreen );
128 viewMenu->Add( ACTIONS::zoomTool );
129 viewMenu->Add( ACTIONS::zoomRedraw );
130
131 viewMenu->AppendSeparator();
132 // Drawing Mode Submenu
133 ACTION_MENU* drawingModeSubMenu = new ACTION_MENU( false, selTool );
134 drawingModeSubMenu->SetTitle( _( "&Drawing Mode" ) );
135 drawingModeSubMenu->SetIcon( BITMAPS::add_zone );
136
137 drawingModeSubMenu->Add( PCB_ACTIONS::padDisplayMode, ACTION_MENU::CHECK );
139 drawingModeSubMenu->Add( PCB_ACTIONS::textOutlines, ACTION_MENU::CHECK );
140 viewMenu->Add( drawingModeSubMenu );
141
142 // Contrast Mode Submenu
143 ACTION_MENU* contrastModeSubMenu = new ACTION_MENU( false, selTool );
144 contrastModeSubMenu->SetTitle( _( "&Contrast Mode" ) );
145 contrastModeSubMenu->SetIcon( BITMAPS::contrast_mode );
146
147 contrastModeSubMenu->Add( ACTIONS::highContrastMode, ACTION_MENU::CHECK );
148 contrastModeSubMenu->Add( PCB_ACTIONS::layerAlphaDec );
149 contrastModeSubMenu->Add( PCB_ACTIONS::layerAlphaInc );
150 viewMenu->Add( contrastModeSubMenu );
151
153
154 viewMenu->AppendSeparator();
158
159
160 //-- Place menu -------------------------------------------------------
161 //
162 ACTION_MENU* placeMenu = new ACTION_MENU( false, selTool );
163
164 placeMenu->Add( PCB_ACTIONS::placePad );
165 placeMenu->Add( PCB_ACTIONS::drawRuleArea );
166
167 placeMenu->AppendSeparator();
168 placeMenu->Add( PCB_ACTIONS::drawLine );
169 placeMenu->Add( PCB_ACTIONS::drawArc );
170 placeMenu->Add( PCB_ACTIONS::drawRectangle );
171 placeMenu->Add( PCB_ACTIONS::drawCircle );
172 placeMenu->Add( PCB_ACTIONS::drawPolygon );
174 placeMenu->Add( PCB_ACTIONS::placeText );
175 placeMenu->Add( PCB_ACTIONS::drawTextBox );
176
177 placeMenu->AppendSeparator();
182 placeMenu->Add( PCB_ACTIONS::drawLeader );
183
184 placeMenu->AppendSeparator();
185 placeMenu->Add( PCB_ACTIONS::setAnchor );
186 placeMenu->Add( ACTIONS::gridSetOrigin );
187 placeMenu->AppendSeparator();
188 placeMenu->Add( ACTIONS::gridResetOrigin );
189
190
191 //-- Inspect menu ------------------------------------------------------
192 //
193 ACTION_MENU* inspectMenu = new ACTION_MENU( false, selTool );
194
195 inspectMenu->Add( ACTIONS::measureTool );
196
197 inspectMenu->AppendSeparator();
198 inspectMenu->Add( PCB_ACTIONS::checkFootprint );
199
200
201 //-- Tools menu --------------------------------------------------------
202 //
203 ACTION_MENU* toolsMenu = new ACTION_MENU( false, selTool );
204
205 toolsMenu->Add( _( "&Load Footprint from PCB..." ),
206 _( "Load a footprint from the current board into the editor" ),
208 BITMAPS::load_module_board );
209
210 toolsMenu->Add( _( "&Insert Footprint on PCB" ),
211 _( "Insert footprint onto current board" ),
213 BITMAPS::insert_module_board );
214
215 toolsMenu->AppendSeparator();
216 toolsMenu->Add( PCB_ACTIONS::cleanupGraphics );
217 toolsMenu->Add( PCB_ACTIONS::repairFootprint );
218
219
220 //-- Preferences menu -------------------------------------------------
221 //
222 ACTION_MENU* prefsMenu = new ACTION_MENU( false, selTool );
223
224 prefsMenu->Add( ACTIONS::configurePaths );
226 prefsMenu->Add( ACTIONS::openPreferences );
227
228 prefsMenu->AppendSeparator();
229 AddMenuLanguageList( prefsMenu, selTool );
230
231 //--MenuBar -----------------------------------------------------------
232 //
233 menuBar->Append( fileMenu, _( "&File" ) );
234 menuBar->Append( editMenu, _( "&Edit" ) );
235 menuBar->Append( viewMenu, _( "&View" ) );
236 menuBar->Append( placeMenu, _( "&Place" ) );
237 menuBar->Append( inspectMenu, _( "&Inspect" ) );
238 menuBar->Append( toolsMenu, _( "&Tools" ) );
239 menuBar->Append( prefsMenu, _( "P&references" ) );
240 AddStandardHelpMenu( menuBar );
241
242 SetMenuBar( menuBar );
243 delete oldMenuBar;
244}
static TOOL_ACTION paste
Definition: actions.h:69
static TOOL_ACTION zoomRedraw
Definition: actions.h:94
static TOOL_ACTION revert
Definition: actions.h:55
static TOOL_ACTION show3DViewer
Definition: actions.h:170
static TOOL_ACTION zoomOutCenter
Definition: actions.h:98
static TOOL_ACTION saveAs
Definition: actions.h:52
static TOOL_ACTION addLibrary
Definition: actions.h:49
static TOOL_ACTION copy
Definition: actions.h:68
static TOOL_ACTION gridResetOrigin
Definition: actions.h:146
static TOOL_ACTION openPreferences
Definition: actions.h:187
static TOOL_ACTION showFootprintLibTable
Definition: actions.h:190
static TOOL_ACTION undo
Definition: actions.h:65
static TOOL_ACTION duplicate
Definition: actions.h:73
static TOOL_ACTION highContrastMode
Definition: actions.h:109
static TOOL_ACTION measureTool
Definition: actions.h:164
static TOOL_ACTION doDelete
Definition: actions.h:74
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION zoomFitScreen
Definition: actions.h:100
static TOOL_ACTION redo
Definition: actions.h:66
static TOOL_ACTION zoomTool
Definition: actions.h:103
static TOOL_ACTION print
Definition: actions.h:57
static TOOL_ACTION showProperties
Definition: actions.h:177
static TOOL_ACTION zoomInCenter
Definition: actions.h:97
static TOOL_ACTION newLibrary
Definition: actions.h:48
static TOOL_ACTION cut
Definition: actions.h:67
static TOOL_ACTION gridSetOrigin
Definition: actions.h:145
static TOOL_ACTION configurePaths
Definition: actions.h:188
static TOOL_ACTION showFootprintBrowser
Definition: actions.h:173
static TOOL_ACTION selectAll
Definition: actions.h:71
Defines the structure of a menu based on ACTIONs.
Definition: action_menu.h:49
static constexpr bool CHECK
Definition: action_menu.h:198
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.
Definition: action_menu.cpp:91
static constexpr bool NORMAL
Definition: action_menu.h:197
void SetIcon(BITMAPS aIcon)
Assign an icon for the entry.
Definition: action_menu.cpp:77
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)
Function AddMenuLanguageList creates a menu list for language choice, and add it as submenu to Master...
void SetMenuBar(wxMenuBar *menu_bar) override
void AddStandardHelpMenu(wxMenuBar *aMenuBar)
Adds the standard KiCad help menu to the menubar.
void doReCreateMenuBar() override
(Re)Create the menubar for the Footprint Editor frame
static TOOL_ACTION drawRuleArea
Definition: pcb_actions.h:214
static TOOL_ACTION placeText
Definition: pcb_actions.h:201
static TOOL_ACTION drawOrthogonalDimension
Definition: pcb_actions.h:210
static TOOL_ACTION enumeratePads
Tool for quick pad enumeration.
Definition: pcb_actions.h:479
static TOOL_ACTION drawRectangle
Definition: pcb_actions.h:197
static TOOL_ACTION setAnchor
Definition: pcb_actions.h:221
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:323
static TOOL_ACTION placeReferenceImage
Definition: pcb_actions.h:200
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:437
static TOOL_ACTION drawCircle
Definition: pcb_actions.h:198
static TOOL_ACTION createFootprint
Definition: pcb_actions.h:450
static TOOL_ACTION exportFootprint
Definition: pcb_actions.h:465
static TOOL_ACTION showFootprintTree
Definition: pcb_actions.h:442
static TOOL_ACTION drawTextBox
Definition: pcb_actions.h:202
static TOOL_ACTION layerAlphaDec
Definition: pcb_actions.h:368
static TOOL_ACTION drawPolygon
Definition: pcb_actions.h:196
static TOOL_ACTION placePad
Activation of the drawing tool (placing a PAD)
Definition: pcb_actions.h:473
static TOOL_ACTION drawRadialDimension
Definition: pcb_actions.h:209
static TOOL_ACTION editTextAndGraphics
Definition: pcb_actions.h:406
static TOOL_ACTION drawLeader
Definition: pcb_actions.h:211
static TOOL_ACTION layerAlphaInc
Definition: pcb_actions.h:367
static TOOL_ACTION newFootprint
Definition: pcb_actions.h:447
static TOOL_ACTION defaultPadProperties
Definition: pcb_actions.h:468
static TOOL_ACTION importFootprint
Definition: pcb_actions.h:464
static TOOL_ACTION placeImportedGraphics
Definition: pcb_actions.h:220
static TOOL_ACTION drawArc
Definition: pcb_actions.h:199
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
Definition: pcb_actions.h:485
static TOOL_ACTION drawCenterDimension
Definition: pcb_actions.h:208
static TOOL_ACTION footprintProperties
Definition: pcb_actions.h:467
static TOOL_ACTION flipBoard
Definition: pcb_actions.h:376
static TOOL_ACTION textOutlines
Display texts as lines.
Definition: pcb_actions.h:488
static TOOL_ACTION checkFootprint
Definition: pcb_actions.h:470
static TOOL_ACTION repairFootprint
Definition: pcb_actions.h:539
static TOOL_ACTION drawLine
Definition: pcb_actions.h:195
static TOOL_ACTION cleanupGraphics
Definition: pcb_actions.h:410
static TOOL_ACTION drawAlignedDimension
Definition: pcb_actions.h:207
The selection tool: currently supports:
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:165
Wrapper around a wxMenuBar object that prevents the accelerator table from being used.
Definition: wx_menubar.h:46
#define _(s)
@ ID_FPEDIT_SAVE_PNG
Definition: pcbnew_id.h:98
@ ID_ADD_FOOTPRINT_TO_BOARD
Definition: pcbnew_id.h:116
@ ID_LOAD_FOOTPRINT_FROM_BOARD
Definition: pcbnew_id.h:117