KiCad PCB EDA Suite
toolbars_sch_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) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2008 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
7 * Copyright (C) 2019 CERN
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
27#include <advanced_config.h>
28#include <sch_draw_panel.h>
29#include <sch_edit_frame.h>
30#include <kiface_base.h>
31#include <bitmaps.h>
32#include <eeschema_id.h>
33#include <python_scripting.h>
34#include <tool/tool_manager.h>
35#include <tool/action_toolbar.h>
36#include <tools/ee_actions.h>
40
41/* Create the main Horizontal Toolbar for the schematic editor
42 */
44{
45 if( m_mainToolBar )
46 {
48 }
49 else
50 {
52 wxDefaultPosition, wxDefaultSize,
53 KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_HORIZONTAL );
55 }
56
57 // Set up toolbar
58 if( Kiface().IsSingle() ) // not when under a project mgr
59 {
62 }
63
65
68
73
76
80
84
92
97
103
108
116
119
120 // Access to the scripting console
121 if( SCRIPTING::IsWxAvailable() )
122 {
125 }
126
127 // after adding the tools to the toolbar, must call Realize() to reflect the changes
129}
130
131
132/* Create Vertical Right Toolbar
133 */
135{
136 if( m_drawToolBar )
137 {
139 }
140 else
141 {
142 m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
143 KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
145 }
146
147 // Set up toolbar
150
165
175
177}
178
179
180/* Create Vertical Left Toolbar (Option Toolbar)
181 */
183{
184 if( m_optionsToolBar )
185 {
187 }
188 else
189 {
191 wxDefaultPosition, wxDefaultSize,
192 KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
194 }
195
201
204
209
212
215
216 if( ADVANCED_CFG::GetCfg().m_DrawBoundingBoxes )
218
220 std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
221 gridMenu->Add( ACTIONS::gridProperties );
223
225}
226
227
229{
231 wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
232
233 hierarchy_pane.Show( !hierarchy_pane.IsShown() );
234
235 if( hierarchy_pane.IsShown() )
236 {
237 if( hierarchy_pane.IsFloating() )
238 {
239 hierarchy_pane.FloatingSize( cfg->m_AuiPanels.hierarchy_panel_float_width,
241 m_auimgr.Update();
242 }
243 else if( cfg->m_AuiPanels.hierarchy_panel_docked_width > 0 )
244 {
245 // SetAuiPaneSize also updates m_auimgr
246 SetAuiPaneSize( m_auimgr, hierarchy_pane,
248 }
249 }
250 else
251 {
252 if( hierarchy_pane.IsFloating() )
253 {
254 cfg->m_AuiPanels.hierarchy_panel_float_width = hierarchy_pane.floating_size.x;
255 cfg->m_AuiPanels.hierarchy_panel_float_height = hierarchy_pane.floating_size.y;
256 }
257 else
258 {
260 }
261
262 m_auimgr.Update();
263 }
264}
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
static TOOL_ACTION gridProperties
Definition: actions.h:144
static TOOL_ACTION toggleGrid
Definition: actions.h:143
static TOOL_ACTION paste
Definition: actions.h:69
static TOOL_ACTION zoomRedraw
Definition: actions.h:92
static TOOL_ACTION millimetersUnits
Definition: actions.h:149
static TOOL_ACTION zoomOutCenter
Definition: actions.h:96
static TOOL_ACTION showSymbolEditor
Definition: actions.h:164
static TOOL_ACTION showSymbolBrowser
Definition: actions.h:163
static TOOL_ACTION findAndReplace
Definition: actions.h:79
static TOOL_ACTION milsUnits
Definition: actions.h:148
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:107
static TOOL_ACTION plot
Definition: actions.h:58
static TOOL_ACTION open
Definition: actions.h:50
static TOOL_ACTION pageSettings
Definition: actions.h:56
static TOOL_ACTION undo
Definition: actions.h:65
static TOOL_ACTION inchesUnits
Definition: actions.h:147
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:104
static TOOL_ACTION selectionTool
Definition: actions.h:156
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION zoomFitScreen
Definition: actions.h:98
static TOOL_ACTION redo
Definition: actions.h:66
static TOOL_ACTION deleteTool
Definition: actions.h:74
static TOOL_ACTION zoomTool
Definition: actions.h:101
static TOOL_ACTION showFootprintEditor
Definition: actions.h:166
static TOOL_ACTION print
Definition: actions.h:57
static TOOL_ACTION doNew
Definition: actions.h:47
static TOOL_ACTION zoomFitObjects
Definition: actions.h:99
static TOOL_ACTION zoomInCenter
Definition: actions.h:95
static TOOL_ACTION find
Definition: actions.h:78
Define the structure of a toolbar with buttons that invoke ACTIONs.
static constexpr bool TOGGLE
static constexpr bool CANCEL
void SetAuiManager(wxAuiManager *aManager)
Set the AUI manager that this toolbar belongs to.
void AddToolContextMenu(const TOOL_ACTION &aAction, std::unique_ptr< ACTION_MENU > aMenu)
Add a context menu to a specific tool item on the toolbar.
void AddScaledSeparator(wxWindow *aWindow)
Add a separator that introduces space on either side to not squash the tools when scaled.
bool KiRealize()
Use this over Realize() to avoid a rendering glitch with fixed orientation toolbars.
void ClearToolbar()
Clear the toolbar and remove all associated menus.
void Add(const TOOL_ACTION &aAction, bool aIsToggleEntry=false, bool aIsCancellable=false)
Add a TOOL_ACTION-based button to the toolbar.
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
static constexpr int KICAD_AUI_TB_STYLE
< Default style flags used for wxAUI toolbars.
wxAuiManager m_auimgr
ACTION_TOOLBAR * m_optionsToolBar
ACTION_TOOLBAR * m_mainToolBar
ACTION_TOOLBAR * m_drawToolBar
static TOOL_ACTION mirrorV
Definition: ee_actions.h:125
static TOOL_ACTION runERC
Definition: ee_actions.h:150
static TOOL_ACTION toggleAnnotateAuto
Definition: ee_actions.h:241
static TOOL_ACTION lineMode90
Definition: ee_actions.h:236
static TOOL_ACTION toggleHiddenPins
Definition: ee_actions.h:213
static TOOL_ACTION navigateForward
Definition: ee_actions.h:201
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:79
static TOOL_ACTION navigateBack
Definition: ee_actions.h:202
static TOOL_ACTION showPythonConsole
Definition: ee_actions.h:231
static TOOL_ACTION placeClassLabel
Definition: ee_actions.h:88
static TOOL_ACTION drawWire
Definition: ee_actions.h:81
static TOOL_ACTION drawCircle
Definition: ee_actions.h:96
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:124
static TOOL_ACTION lineModeFree
Definition: ee_actions.h:235
static TOOL_ACTION drawBus
Definition: ee_actions.h:82
static TOOL_ACTION placePower
Definition: ee_actions.h:80
static TOOL_ACTION drawLines
Definition: ee_actions.h:98
static TOOL_ACTION mirrorH
Definition: ee_actions.h:126
static TOOL_ACTION highlightNetTool
Definition: ee_actions.h:252
static TOOL_ACTION rotateCW
Definition: ee_actions.h:123
static TOOL_ACTION importSheetPin
Definition: ee_actions.h:92
static TOOL_ACTION assignFootprints
Definition: ee_actions.h:160
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:89
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:90
static TOOL_ACTION editSymbolFields
Definition: ee_actions.h:152
static TOOL_ACTION drawTextBox
Definition: ee_actions.h:94
static TOOL_ACTION drawRectangle
Definition: ee_actions.h:95
static TOOL_ACTION annotate
Definition: ee_actions.h:151
static TOOL_ACTION placeImage
Definition: ee_actions.h:99
static TOOL_ACTION showHierarchy
Definition: ee_actions.h:205
static TOOL_ACTION placeSchematicText
Definition: ee_actions.h:93
static TOOL_ACTION drawArc
Definition: ee_actions.h:97
static TOOL_ACTION lineMode45
Definition: ee_actions.h:237
static TOOL_ACTION drawSheet
Definition: ee_actions.h:91
static TOOL_ACTION runSimulation
Definition: ee_actions.h:244
static TOOL_ACTION navigateUp
Definition: ee_actions.h:200
static TOOL_ACTION placeLabel
Definition: ee_actions.h:87
static TOOL_ACTION showPcbNew
Definition: ee_actions.h:172
static TOOL_ACTION placeBusWireEntry
Definition: ee_actions.h:86
static TOOL_ACTION placeJunction
Definition: ee_actions.h:85
static TOOL_ACTION generateBOM
Definition: ee_actions.h:175
static TOOL_ACTION placeNoConnect
Definition: ee_actions.h:84
static TOOL_ACTION schematicSetup
Definition: ee_actions.h:162
EESCHEMA_SETTINGS * eeconfig() const
void ReCreateVToolbar() override
void ToggleSchematicHierarchy()
Toggle the show/hide state of the left side schematic navigation panel.
static const wxString SchematicHierarchyPaneName()
void ReCreateOptToolbar() override
HIERARCHY_PANE * m_hierarchy
void ReCreateHToolbar() override
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:170
@ ID_OPT_TOOLBAR
Definition: id.h:102
@ ID_V_TOOLBAR
Definition: id.h:101
@ ID_H_TOOLBAR
Definition: id.h:100
void SetAuiPaneSize(wxAuiManager &aManager, wxAuiPaneInfo &aPane, int aWidth, int aHeight)
Sets the size of an AUI pane, working around http://trac.wxwidgets.org/ticket/13180.