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 <fctsys.h>
28 #include <sch_draw_panel.h>
29 #include <sch_edit_frame.h>
30 #include <kiface_i.h>
31 #include <bitmaps.h>
32 #include <eeschema_id.h>
33 #include <tool/tool_manager.h>
34 #include <tool/action_toolbar.h>
35 #include <tools/ee_actions.h>
36 
37 /* Create the main Horizontal Toolbar for the schematic editor
38  */
40 {
41  if( m_mainToolBar )
43  else
45  wxDefaultPosition, wxDefaultSize,
46  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
47 
48  // Set up toolbar
49  if( Kiface().IsSingle() ) // not when under a project mgr
50  {
53  }
54 
56 
59 
64 
67 
71 
75 
82 
86 
91 
98 
101 
102  // after adding the tools to the toolbar, must call Realize() to reflect the changes
103  m_mainToolBar->Realize();
104 }
105 
106 
107 /* Create Vertical Right Toolbar
108  */
110 {
111  if( m_drawToolBar )
113  else
114  m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
115  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
116 
117  // Set up toolbar
120 
134 
140 
141  m_drawToolBar->Realize();
142 }
143 
144 
145 /* Create Vertical Left Toolbar (Option Toolbar)
146  */
148 {
149  if( m_optionsToolBar )
151  else
153  wxDefaultPosition, wxDefaultSize,
154  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
155 
162 
163  m_optionsToolBar->Realize();
164 }
165 
166 
168 {
169 #define TOGGLE_TOOL( toolbar, tool ) toolbar->Toggle( tool, IsCurrentTool( tool ) )
170 
172 
173 
175  m_mainToolBar->Toggle( ACTIONS::undo, GetScreen() && GetScreen()->GetUndoCommandCount() > 0 );
176  m_mainToolBar->Toggle( ACTIONS::redo, GetScreen() && GetScreen()->GetRedoCommandCount() > 0 );
178  m_mainToolBar->Refresh();
179 
185  m_optionsToolBar->Toggle( EE_ACTIONS::toggleForceHV, eeconfig()->m_Drawing.hv_lines_only );
186  m_optionsToolBar->Refresh();
187 
206  m_drawToolBar->Refresh();
207 }
ACTION_TOOLBAR.
static TOOL_ACTION findAndReplace
Definition: actions.h:79
static TOOL_ACTION navigateHierarchy
Definition: ee_actions.h:178
static TOOL_ACTION assignFootprints
Definition: ee_actions.h:147
static TOOL_ACTION zoomInCenter
Definition: actions.h:90
KIGFX::GAL_DISPLAY_OPTIONS & GetGalDisplayOptions()
Return a reference to the gal rendering options used by GAL for rendering.
static TOOL_ACTION pageSettings
Definition: actions.h:59
static TOOL_ACTION runERC
Definition: ee_actions.h:140
ACTION_TOOLBAR * m_optionsToolBar
static const bool TOGGLE
static TOOL_ACTION zoomTool
Definition: actions.h:95
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:87
static TOOL_ACTION placeJunction
Definition: ee_actions.h:83
void Add(const TOOL_ACTION &aAction, bool aIsToggleEntry=false)
Function Add() Adds a TOOL_ACTION-based button to the toolbar.
static TOOL_ACTION zoomFitScreen
Definition: actions.h:93
static TOOL_ACTION placeBusWireEntry
Definition: ee_actions.h:84
ACTION_TOOLBAR * m_mainToolBar
static TOOL_ACTION print
Definition: actions.h:60
static TOOL_ACTION find
Definition: actions.h:78
static TOOL_ACTION imperialUnits
Definition: actions.h:140
static TOOL_ACTION zoomOutCenter
Definition: actions.h:91
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:177
EESCHEMA_SETTINGS * eeconfig() const
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
static TOOL_ACTION annotate
Definition: ee_actions.h:141
static TOOL_ACTION drawSheet
Definition: ee_actions.h:88
static TOOL_ACTION showPcbNew
Definition: ee_actions.h:158
static TOOL_ACTION highlightNetTool
Definition: ee_actions.h:209
static TOOL_ACTION editSymbolFields
Definition: ee_actions.h:142
void ReCreateHToolbar() override
static TOOL_ACTION placePower
Definition: ee_actions.h:78
static TOOL_ACTION drawWire
Definition: ee_actions.h:79
bool IsGridVisible() const
static TOOL_ACTION toggleGrid
Definition: actions.h:136
#define TOGGLE_TOOL(toolbar, tool)
static TOOL_ACTION open
Definition: actions.h:53
static TOOL_ACTION save
Definition: actions.h:54
static TOOL_ACTION placeSchematicText
Definition: ee_actions.h:91
static TOOL_ACTION doNew
Definition: actions.h:47
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
static TOOL_ACTION placeImage
Definition: ee_actions.h:93
static TOOL_ACTION plot
Definition: actions.h:61
static TOOL_ACTION importSheetPin
Definition: ee_actions.h:90
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:77
void ReCreateOptToolbar() override
static TOOL_ACTION drawBus
Definition: ee_actions.h:80
static TOOL_ACTION placeLabel
Definition: ee_actions.h:85
static TOOL_ACTION metricUnits
Definition: actions.h:141
static TOOL_ACTION redo
Definition: actions.h:68
static TOOL_ACTION showSymbolEditor
Definition: actions.h:154
static TOOL_ACTION toggleHiddenPins
Definition: ee_actions.h:185
static TOOL_ACTION zoomRedraw
Definition: actions.h:87
static TOOL_ACTION placeNoConnect
Definition: ee_actions.h:82
void Toggle(const TOOL_ACTION &aAction, bool aState)
Applies the default toggle action.
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars
static TOOL_ACTION deleteTool
Definition: actions.h:75
static TOOL_ACTION undo
Definition: actions.h:67
static TOOL_ACTION generateBOM
Definition: ee_actions.h:161
static TOOL_ACTION drawLines
Definition: ee_actions.h:92
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:98
static TOOL_ACTION schematicSetup
Definition: ee_actions.h:150
static TOOL_ACTION showSymbolBrowser
Definition: actions.h:153
bool IsContentModified() override
Get if the current schematic has been modified but not saved.
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:86
static TOOL_ACTION toggleForceHV
Definition: ee_actions.h:195
static TOOL_ACTION showFootprintEditor
Definition: actions.h:156
bool m_fullscreenCursor
Fullscreen crosshair or small cross
static TOOL_ACTION paste
Definition: actions.h:71
bool GetShowAllPins() const override
Allow edit frame to show/hide hidden pins.
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
static TOOL_ACTION selectionTool
Definition: actions.h:147
void ReCreateVToolbar() override
void SyncToolbars() override
Update the toolbars (mostly settings/check buttons/checkboxes) with the current controller state.
void ClearToolbar()
Clear the toolbar and remove all associated menus.
ACTION_TOOLBAR * m_drawToolBar