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 )
42  m_mainToolBar->Clear();
43  else
45  wxDefaultPosition, wxDefaultSize,
46  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
47  wxString msg;
48 
49  // Set up toolbar
50  if( Kiface().IsSingle() ) // not when under a project mgr
51  {
54  }
55 
57 
62 
63  m_mainToolBar->AddSeparator();
65 
66  m_mainToolBar->AddSeparator();
69 
73 
74  m_mainToolBar->AddSeparator();
80 
81  m_mainToolBar->AddSeparator();
84 
85  m_mainToolBar->AddSeparator();
89 
96 
100 
101  // after adding the tools to the toolbar, must call Realize() to reflect the changes
102  m_mainToolBar->Realize();
103 }
104 
105 
106 /* Create Vertical Right Toolbar
107  */
109 {
110  if( m_drawToolBar )
111  m_drawToolBar->Clear();
112  else
113  m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
114  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
115 
116  // Set up toolbar
119 
135 
141 
142  m_drawToolBar->Realize();
143 }
144 
145 
146 /* Create Vertical Left Toolbar (Option Toolbar)
147  */
149 {
150  if( m_optionsToolBar )
151  m_optionsToolBar->Clear();
152  else
154  wxDefaultPosition, wxDefaultSize,
155  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
156 
163 
164  m_optionsToolBar->Realize();
165 }
166 
167 
169 {
170 #define TOGGLE_TOOL( toolbar, tool ) toolbar->Toggle( tool, IsCurrentTool( tool ) )
171 
173  SCH_SHEET_LIST sheetList( g_RootSheet );
174 
176  m_mainToolBar->Toggle( ACTIONS::undo, GetScreen() && GetScreen()->GetUndoCommandCount() > 0 );
177  m_mainToolBar->Toggle( ACTIONS::redo, GetScreen() && GetScreen()->GetRedoCommandCount() > 0 );
179  m_mainToolBar->Refresh();
180 
187  m_optionsToolBar->Refresh();
188 
209  m_drawToolBar->Refresh();
210 }
Class SCH_SHEET_LIST.
bool IsModified()
Function IsModified checks the entire hierarchy for any modifications.
Class ACTION_TOOLBAR.
static TOOL_ACTION findAndReplace
Definition: actions.h:78
static TOOL_ACTION navigateHierarchy
Definition: ee_actions.h:178
static TOOL_ACTION assignFootprints
Definition: ee_actions.h:152
static TOOL_ACTION zoomInCenter
Definition: actions.h:89
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:144
ACTION_TOOLBAR * m_optionsToolBar
static const bool TOGGLE
static TOOL_ACTION zoomTool
Definition: actions.h:94
virtual bool IsGridVisible() const
static TOOL_ACTION placeHierLabel
Definition: ee_actions.h:90
static TOOL_ACTION placeJunction
Definition: ee_actions.h:85
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:92
static TOOL_ACTION placeBusBusEntry
Definition: ee_actions.h:87
static TOOL_ACTION placeBusWireEntry
Definition: ee_actions.h:86
ACTION_TOOLBAR * m_mainToolBar
static TOOL_ACTION print
Definition: actions.h:60
static TOOL_ACTION find
Definition: actions.h:77
static TOOL_ACTION imperialUnits
Definition: actions.h:135
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:51
static TOOL_ACTION zoomOutCenter
Definition: actions.h:90
static TOOL_ACTION leaveSheet
Definition: ee_actions.h:177
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:146
static TOOL_ACTION drawSheet
Definition: ee_actions.h:91
static TOOL_ACTION showPcbNew
Definition: ee_actions.h:157
static TOOL_ACTION highlightNetTool
Definition: ee_actions.h:205
static TOOL_ACTION editSymbolFields
Definition: ee_actions.h:147
void ReCreateHToolbar() override
static TOOL_ACTION placePower
Definition: ee_actions.h:80
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:47
static TOOL_ACTION drawWire
Definition: ee_actions.h:81
static TOOL_ACTION placeSheetPin
Definition: ee_actions.h:92
static TOOL_ACTION toggleGrid
Definition: actions.h:131
bool GetForceHVLines() const
#define TOGGLE_TOOL(toolbar, tool)
static TOOL_ACTION open
Definition: actions.h:53
Definition: common.h:155
static TOOL_ACTION placeSchematicText
Definition: ee_actions.h:94
static TOOL_ACTION doNew
Definition: actions.h:47
static TOOL_ACTION placeImage
Definition: ee_actions.h:96
static TOOL_ACTION plot
Definition: actions.h:61
static TOOL_ACTION importSheetPin
Definition: ee_actions.h:93
static TOOL_ACTION placeSymbol
Definition: ee_actions.h:79
void ReCreateOptToolbar() override
static TOOL_ACTION drawBus
Definition: ee_actions.h:82
static TOOL_ACTION placeLabel
Definition: ee_actions.h:88
static TOOL_ACTION metricUnits
Definition: actions.h:136
static TOOL_ACTION redo
Definition: actions.h:68
static TOOL_ACTION showSymbolEditor
Definition: actions.h:149
EDA_UNITS_T GetUserUnits() const
Return the user units currently in use.
static TOOL_ACTION toggleHiddenPins
Definition: ee_actions.h:183
static TOOL_ACTION zoomRedraw
Definition: actions.h:86
static TOOL_ACTION importFPAssignments
Definition: ee_actions.h:158
static TOOL_ACTION placeNoConnect
Definition: ee_actions.h:84
void Toggle(const TOOL_ACTION &aAction, bool aState)
Applies the default toggle action.
void KiScaledSeparator(wxAuiToolBar *aToolbar, EDA_BASE_FRAME *aWindow)
Add a separator to the given toolbar scaled the same way as KiScaledBitmap.
Definition: bitmap.cpp:167
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars
static TOOL_ACTION deleteTool
Definition: actions.h:74
static TOOL_ACTION undo
Definition: actions.h:67
static TOOL_ACTION generateBOM
Definition: ee_actions.h:160
static TOOL_ACTION drawLines
Definition: ee_actions.h:95
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:97
static TOOL_ACTION saveAll
Definition: actions.h:57
static TOOL_ACTION showSymbolBrowser
Definition: actions.h:148
static TOOL_ACTION placeGlobalLabel
Definition: ee_actions.h:89
static TOOL_ACTION toggleForceHV
Definition: ee_actions.h:192
static TOOL_ACTION showFootprintEditor
Definition: actions.h:151
bool m_fullscreenCursor
Fullscreen crosshair or small cross
static TOOL_ACTION paste
Definition: actions.h:71
bool GetShowAllPins() const override
Allow some frames to show/hide hidden pins.
static TOOL_ACTION selectionTool
Definition: actions.h:142
void ReCreateVToolbar() override
void SyncToolbars() override
Update the toolbars (mostly settings/check buttons/checkboxes) with the current controller state.
ACTION_TOOLBAR * m_drawToolBar