KiCad PCB EDA Suite
Loading...
Searching...
No Matches
menubar_symbol_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) 2007 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 2009 Wayne Stambaugh <[email protected]>
6 * Copyright The 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#include <bitmaps.h>
27#include <tool/action_menu.h>
28#include <tool/tool_manager.h>
29#include <tools/sch_actions.h>
32#include "symbol_edit_frame.h"
33#include <widgets/wx_menubar.h>
34
35
37{
39 // wxWidgets handles the Mac Application menu behind the scenes, but that means
40 // we always have to start from scratch with a new wxMenuBar.
41 wxMenuBar* oldMenuBar = GetMenuBar();
42 WX_MENUBAR* menuBar = new WX_MENUBAR();
43
44 //-- File menu -----------------------------------------------
45 //
46 ACTION_MENU* fileMenu = new ACTION_MENU( false, selTool );
47
48 fileMenu->Add( ACTIONS::newLibrary );
49 fileMenu->Add( ACTIONS::addLibrary );
51 fileMenu->Add( SCH_ACTIONS::newSymbol );
53
54 fileMenu->AppendSeparator();
55 fileMenu->Add( ACTIONS::save );
56 fileMenu->Add( SCH_ACTIONS::saveSymbolAs );
58
60 fileMenu->Add( ACTIONS::saveAll );
61
62 fileMenu->Add( ACTIONS::revert );
63
64 fileMenu->AppendSeparator();
65
66 ACTION_MENU* submenuImport = new ACTION_MENU( false, selTool );
67 submenuImport->SetTitle( _( "Import" ) );
68 submenuImport->SetIcon( BITMAPS::import );
69
70 submenuImport->Add( SCH_ACTIONS::importSymbol, ACTION_MENU::NORMAL, _( "Symbol..." ) );
71 submenuImport->Add( SCH_ACTIONS::importGraphics, ACTION_MENU::NORMAL, _( "Graphics..." ) );
72
73 fileMenu->Add( submenuImport );
74
75 // Export submenu
76 ACTION_MENU* submenuExport = new ACTION_MENU( false, selTool );
77 submenuExport->SetTitle( _( "Export" ) );
78 submenuExport->SetIcon( BITMAPS::export_file );
79 submenuExport->Add( SCH_ACTIONS::exportSymbol, ACTION_MENU::NORMAL, _( "Symbol..." ) );
80 submenuExport->Add( SCH_ACTIONS::exportSymbolView, ACTION_MENU::NORMAL, _( "View as PNG..." ) );
81 submenuExport->Add( SCH_ACTIONS::exportSymbolAsSVG, ACTION_MENU::NORMAL, _( "Symbol as SVG..." ) );
82 fileMenu->Add( submenuExport );
83
84 fileMenu->AppendSeparator();
86
87 fileMenu->AppendSeparator();
88 fileMenu->AddClose( _( "Library Editor" ) );
89
90
91 //-- Edit menu -----------------------------------------------
92 //
93 ACTION_MENU* editMenu = new ACTION_MENU( false, selTool );
94
95 editMenu->Add( ACTIONS::undo );
96 editMenu->Add( ACTIONS::redo );
97
98 editMenu->AppendSeparator();
99 editMenu->Add( ACTIONS::cut );
100 editMenu->Add( ACTIONS::copy );
101 editMenu->Add( ACTIONS::copyAsText );
102 editMenu->Add( ACTIONS::paste );
103 editMenu->Add( ACTIONS::doDelete );
104 editMenu->Add( ACTIONS::duplicate );
105
106 editMenu->AppendSeparator();
107 editMenu->Add( ACTIONS::selectAll );
108 editMenu->Add( ACTIONS::unselectAll );
109
110 editMenu->AppendSeparator();
111 editMenu->Add( ACTIONS::find );
112 editMenu->Add( ACTIONS::findAndReplace );
113
114 editMenu->AppendSeparator();
115 editMenu->Add( SCH_ACTIONS::pinTable );
118
119
120 //-- View menu -----------------------------------------------
121 //
122 ACTION_MENU* viewMenu = new ACTION_MENU( false, selTool );
123
124 ACTION_MENU* showHidePanels = new ACTION_MENU( false, selTool );
125 showHidePanels->SetTitle( _( "Panels" ) );
128 viewMenu->Add( showHidePanels );
129 viewMenu->AppendSeparator();
130
131 viewMenu->Add( ACTIONS::showSymbolBrowser );
132
133 viewMenu->AppendSeparator();
134 viewMenu->Add( ACTIONS::zoomInCenter );
135 viewMenu->Add( ACTIONS::zoomOutCenter );
136 viewMenu->Add( ACTIONS::zoomFitScreen );
137 viewMenu->Add( ACTIONS::zoomTool );
138 viewMenu->Add( ACTIONS::zoomRedraw );
139
140 viewMenu->AppendSeparator();
144
145
146 //-- Place menu -----------------------------------------------
147 //
148 ACTION_MENU* placeMenu = new ACTION_MENU( false, selTool );
149
150 placeMenu->Add( SCH_ACTIONS::placeSymbolPin );
151 placeMenu->Add( SCH_ACTIONS::placeSymbolText );
153 placeMenu->Add( SCH_ACTIONS::drawRectangle );
154 placeMenu->Add( SCH_ACTIONS::drawCircle );
155 placeMenu->Add( SCH_ACTIONS::drawArc );
156 placeMenu->Add( SCH_ACTIONS::drawBezier );
157 placeMenu->Add( SCH_ACTIONS::drawSymbolLines );
159
160
161 //-- Inspect menu -----------------------------------------------
162 //
163 ACTION_MENU* inspectMenu = new ACTION_MENU( false, selTool );
164
165 inspectMenu->Add( ACTIONS::showDatasheet );
166
167 inspectMenu->AppendSeparator();
168 inspectMenu->Add( SCH_ACTIONS::checkSymbol );
169
170
171 //-- Preferences menu -----------------------------------------------
172 //
173 ACTION_MENU* prefsMenu = new ACTION_MENU( false, selTool );
174
175 prefsMenu->Add( ACTIONS::configurePaths );
176 prefsMenu->Add( ACTIONS::showSymbolLibTable );
177 prefsMenu->Add( ACTIONS::openPreferences );
178
179 prefsMenu->AppendSeparator();
180 AddMenuLanguageList( prefsMenu, selTool );
181
182
183 //-- Menubar -------------------------------------------------------------
184 //
185 menuBar->Append( fileMenu, _( "&File" ) );
186 menuBar->Append( editMenu, _( "&Edit" ) );
187 menuBar->Append( viewMenu, _( "&View" ) );
188 menuBar->Append( placeMenu, _( "&Place" ) );
189 menuBar->Append( inspectMenu, _( "&Inspect" ) );
190 menuBar->Append( prefsMenu, _( "P&references" ) );
191 AddStandardHelpMenu( menuBar );
192
193 SetMenuBar( menuBar );
194 delete oldMenuBar;
195}
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 showLibraryTree
Definition: actions.h:161
static TOOL_ACTION zoomOutCenter
Definition: actions.h:135
static TOOL_ACTION addLibrary
Definition: actions.h:56
static TOOL_ACTION copy
Definition: actions.h:78
static TOOL_ACTION showSymbolLibTable
Definition: actions.h:279
static TOOL_ACTION showSymbolBrowser
Definition: actions.h:256
static TOOL_ACTION showDatasheet
Definition: actions.h:264
static TOOL_ACTION findAndReplace
Definition: actions.h:117
static TOOL_ACTION openPreferences
Definition: actions.h:277
static TOOL_ACTION saveAll
Definition: actions.h:61
static TOOL_ACTION undo
Definition: actions.h:75
static TOOL_ACTION duplicate
Definition: actions.h:84
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 showProperties
Definition: actions.h:263
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 configurePaths
Definition: actions.h:278
static TOOL_ACTION copyAsText
Definition: actions.h:79
static TOOL_ACTION selectAll
Definition: actions.h:82
static TOOL_ACTION find
Definition: actions.h:116
Define the structure of a menu based on ACTIONs.
Definition: action_menu.h:49
static constexpr bool CHECK
Definition: action_menu.h:201
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:92
static constexpr bool NORMAL
Definition: action_menu.h:200
void SetIcon(BITMAPS aIcon)
Assign an icon for the entry.
Definition: action_menu.cpp:78
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.
static TOOL_ACTION importSymbol
Definition: sch_actions.h:211
static TOOL_ACTION newSymbol
Definition: sch_actions.h:202
static TOOL_ACTION saveLibraryAs
Definition: sch_actions.h:199
static TOOL_ACTION checkSymbol
Definition: sch_actions.h:161
static TOOL_ACTION editLibSymbolWithLibEdit
Definition: sch_actions.h:173
static TOOL_ACTION drawArc
Definition: sch_actions.h:97
static TOOL_ACTION pinTable
Definition: sch_actions.h:152
static TOOL_ACTION drawSymbolLines
Definition: sch_actions.h:111
static TOOL_ACTION placeSymbolPin
Definition: sch_actions.h:108
static TOOL_ACTION drawSymbolTextBox
Definition: sch_actions.h:110
static TOOL_ACTION exportSymbolAsSVG
Definition: sch_actions.h:257
static TOOL_ACTION drawRectangle
Definition: sch_actions.h:95
static TOOL_ACTION drawCircle
Definition: sch_actions.h:96
static TOOL_ACTION importGraphics
Definition: sch_actions.h:255
static TOOL_ACTION drawBezier
Definition: sch_actions.h:98
static TOOL_ACTION saveSymbolCopyAs
Definition: sch_actions.h:201
static TOOL_ACTION drawSymbolPolygon
Definition: sch_actions.h:112
static TOOL_ACTION showHiddenFields
Definition: sch_actions.h:236
static TOOL_ACTION showHiddenPins
Definition: sch_actions.h:235
static TOOL_ACTION setUnitDisplayName
Definition: sch_actions.h:214
static TOOL_ACTION exportSymbolView
Definition: sch_actions.h:256
static TOOL_ACTION symbolProperties
Definition: sch_actions.h:151
static TOOL_ACTION placeSymbolText
Definition: sch_actions.h:109
static TOOL_ACTION togglePinAltIcons
Definition: sch_actions.h:244
static TOOL_ACTION updateSymbolFields
Definition: sch_actions.h:213
static TOOL_ACTION exportSymbol
Definition: sch_actions.h:212
static TOOL_ACTION saveSymbolAs
Definition: sch_actions.h:200
bool IsSymbolFromSchematic() const
void doReCreateMenuBar() override
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:171
Wrapper around a wxMenuBar object that prevents the accelerator table from being used.
Definition: wx_menubar.h:47
#define _(s)