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 <stambaughw@gmail.com>
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 <sch_draw_panel.h>
28 #include <sch_edit_frame.h>
29 #include <kiface_i.h>
30 #include <bitmaps.h>
31 #include <eeschema_id.h>
32 #include <tool/tool_manager.h>
33 #include <tool/action_toolbar.h>
34 #include <tools/ee_actions.h>
36 
37 /* Create the main Horizontal Toolbar for the schematic editor
38  */
40 {
41  if( m_mainToolBar )
42  {
44  }
45  else
46  {
48  wxDefaultPosition, wxDefaultSize,
49  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_HORIZONTAL );
51  }
52 
53  // Set up toolbar
54  if( Kiface().IsSingle() ) // not when under a project mgr
55  {
58  }
59 
61 
64 
69 
72 
76 
80 
88 
92 
98 
103 
110 
113 
114  // after adding the tools to the toolbar, must call Realize() to reflect the changes
116 }
117 
118 
119 /* Create Vertical Right Toolbar
120  */
122 {
123  if( m_drawToolBar )
124  {
126  }
127  else
128  {
129  m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
130  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
132  }
133 
134  // Set up toolbar
137 
151 
157 
159 }
160 
161 
162 /* Create Vertical Left Toolbar (Option Toolbar)
163  */
165 {
166  if( m_optionsToolBar )
167  {
169  }
170  else
171  {
173  wxDefaultPosition, wxDefaultSize,
174  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
176  }
177 
185 
187  std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
188  gridMenu->Add( ACTIONS::gridProperties );
189  m_optionsToolBar->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );
190 
192 }
Define the structure of a toolbar with buttons that invoke ACTIONs.
static TOOL_ACTION findAndReplace
Definition: actions.h:80
static TOOL_ACTION navigateHierarchy
Definition: ee_actions.h:183
static TOOL_ACTION assignFootprints
Definition: ee_actions.h:148
static TOOL_ACTION zoomInCenter
Definition: actions.h:96
static TOOL_ACTION pageSettings
Definition: actions.h:59
static TOOL_ACTION runERC
Definition: ee_actions.h:138
void AddToolContextMenu(const TOOL_ACTION &aAction, std::unique_ptr< ACTION_MENU > aMenu)
Add a context menu to a specific tool item on the toolbar.
ACTION_TOOLBAR * m_optionsToolBar
static constexpr bool TOGGLE
static TOOL_ACTION zoomTool
Definition: actions.h:102
void AddScaledSeparator(wxWindow *aWindow)
Add a separator that introduces space on either side to not squash the tools when scaled.
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:85
static TOOL_ACTION placeJunction
Definition: ee_actions.h:81
void Add(const TOOL_ACTION &aAction, bool aIsToggleEntry=false, bool aIsCancellable=false)
Add a TOOL_ACTION-based button to the toolbar.
static TOOL_ACTION zoomFitScreen
Definition: actions.h:99
static TOOL_ACTION millimetersUnits
Definition: actions.h:149
void SetAuiManager(wxAuiManager *aManager)
Set the AUI manager that this toolbar belongs to.
static TOOL_ACTION placeBusWireEntry
Definition: ee_actions.h:82
wxAuiManager m_auimgr
static TOOL_ACTION zoomFitObjects
Definition: actions.h:100
ACTION_TOOLBAR * m_mainToolBar
static TOOL_ACTION print
Definition: actions.h:60
static TOOL_ACTION mirrorH
Definition: ee_actions.h:117
static TOOL_ACTION find
Definition: actions.h:79
bool KiRealize()
Use this over Realize() to avoid a rendering glitch with fixed orientation toolbars.
static TOOL_ACTION zoomOutCenter
Definition: actions.h:97
static TOOL_ACTION mirrorV
Definition: ee_actions.h:116
static TOOL_ACTION rotateCW
Definition: ee_actions.h:114
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:182
static TOOL_ACTION annotate
Definition: ee_actions.h:139
static TOOL_ACTION drawSheet
Definition: ee_actions.h:86
static TOOL_ACTION showPcbNew
Definition: ee_actions.h:160
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:115
static TOOL_ACTION highlightNetTool
Definition: ee_actions.h:216
static constexpr bool CANCEL
static TOOL_ACTION editSymbolFields
Definition: ee_actions.h:140
void ReCreateHToolbar() override
static TOOL_ACTION placePower
Definition: ee_actions.h:76
static TOOL_ACTION drawWire
Definition: ee_actions.h:77
static TOOL_ACTION toggleGrid
Definition: actions.h:143
static TOOL_ACTION open
Definition: actions.h:53
static TOOL_ACTION inchesUnits
Definition: actions.h:147
static TOOL_ACTION save
Definition: actions.h:54
static TOOL_ACTION placeSchematicText
Definition: ee_actions.h:88
static TOOL_ACTION doNew
Definition: actions.h:47
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
static TOOL_ACTION placeImage
Definition: ee_actions.h:90
static TOOL_ACTION plot
Definition: actions.h:61
static TOOL_ACTION importSheetPin
Definition: ee_actions.h:87
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:75
void ReCreateOptToolbar() override
static TOOL_ACTION milsUnits
Definition: actions.h:148
static TOOL_ACTION drawBus
Definition: ee_actions.h:78
static TOOL_ACTION placeLabel
Definition: ee_actions.h:83
static TOOL_ACTION redo
Definition: actions.h:68
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:157
static TOOL_ACTION showSymbolEditor
Definition: actions.h:163
static TOOL_ACTION toggleHiddenPins
Definition: ee_actions.h:192
static TOOL_ACTION zoomRedraw
Definition: actions.h:93
static TOOL_ACTION placeNoConnect
Definition: ee_actions.h:80
static constexpr int KICAD_AUI_TB_STYLE
< Default style flags used for wxAUI toolbars.
static TOOL_ACTION gridProperties
Definition: actions.h:144
static TOOL_ACTION deleteTool
Definition: actions.h:76
static TOOL_ACTION undo
Definition: actions.h:67
static TOOL_ACTION generateBOM
Definition: ee_actions.h:163
static TOOL_ACTION drawLines
Definition: ee_actions.h:89
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:105
static TOOL_ACTION schematicSetup
Definition: ee_actions.h:151
static TOOL_ACTION showSymbolBrowser
Definition: actions.h:162
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:84
static TOOL_ACTION toggleForceHV
Definition: ee_actions.h:202
static TOOL_ACTION showFootprintEditor
Definition: actions.h:165
static TOOL_ACTION paste
Definition: actions.h:71
static TOOL_ACTION selectionTool
Definition: actions.h:156
void ReCreateVToolbar() override
void ClearToolbar()
Clear the toolbar and remove all associated menus.
ACTION_TOOLBAR * m_drawToolBar