KiCad PCB EDA Suite
Loading...
Searching...
No Matches
toolbars_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) 2004 Jean-Pierre Charras, [email protected]
5 * Copyright (C) 2008 Wayne Stambaugh <[email protected]>
6 * Copyright (C) 2004-2024 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 <advanced_config.h>
27#include <eeschema_id.h>
28#include <symbol_edit_frame.h>
29#include <sch_painter.h>
32#include <tool/action_toolbar.h>
33#include <tool/tool_manager.h>
34#include <tools/ee_actions.h>
39
40#ifdef __UNIX__
41#define LISTBOX_WIDTH 140
42#else
43#define LISTBOX_WIDTH 120
44#endif
45
46
48{
49 if( m_drawToolBar )
50 {
52 }
53 else
54 {
55 m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
56 KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
58 }
59
60 // Set up toolbar
61 // clang-format off
63
76 // clang-format on
77
78 m_drawToolBar->Realize();
79}
80
81
83{
84 if( m_mainToolBar )
85 {
87 }
88 else
89 {
90 m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
91 KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
93 }
94
95 // Set up toolbar
97
100 else
102
106
113
119
123
127
131
133
134 if( m_unitSelectBox == nullptr )
136 wxEmptyString, wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ), 0,
137 nullptr, wxCB_READONLY );
138 m_mainToolBar->AddControl( m_unitSelectBox );
139
142
145
146 // after adding the buttons to the toolbar, must call Realize() to reflect the changes
147 m_mainToolBar->Realize();
148}
149
150
152{
153 if( m_optionsToolBar )
154 {
156 }
157 else
158 {
160 wxDefaultPosition, wxDefaultSize,
161 KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
163 }
164
171
176 // m_optionsToolBar->Add( EE_ACTIONS::togglePinAltIcons, ACTION_TOOLBAR::TOGGLE );
177
178 if( ADVANCED_CFG::GetCfg().m_DrawBoundingBoxes )
180
184
186 std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
187 gridMenu->Add( ACTIONS::gridProperties );
189
190 m_optionsToolBar->Realize();
191}
192
193
195{
196 if( !m_propertiesPanel )
197 return;
198
199 bool show = !m_propertiesPanel->IsShownOnScreen();
200
201 wxAuiPaneInfo& propertiesPaneInfo = m_auimgr.GetPane( PropertiesPaneName() );
202 propertiesPaneInfo.Show( show );
204
205 if( show )
206 {
207 SetAuiPaneSize( m_auimgr, propertiesPaneInfo,
209 }
210 else
211 {
213 }
214
215 m_auimgr.Update();
216 Refresh();
217}
static TOOL_ACTION gridProperties
Definition: actions.h:189
static TOOL_ACTION toggleGrid
Definition: actions.h:187
static TOOL_ACTION zoomRedraw
Definition: actions.h:124
static TOOL_ACTION millimetersUnits
Definition: actions.h:195
static TOOL_ACTION showLibraryTree
Definition: actions.h:154
static TOOL_ACTION zoomOutCenter
Definition: actions.h:128
static TOOL_ACTION showDatasheet
Definition: actions.h:217
static TOOL_ACTION milsUnits
Definition: actions.h:194
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:147
static TOOL_ACTION saveAll
Definition: actions.h:54
static TOOL_ACTION undo
Definition: actions.h:68
static TOOL_ACTION inchesUnits
Definition: actions.h:193
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:144
static TOOL_ACTION selectionTool
Definition: actions.h:202
static TOOL_ACTION save
Definition: actions.h:51
static TOOL_ACTION zoomFitScreen
Definition: actions.h:134
static TOOL_ACTION redo
Definition: actions.h:69
static TOOL_ACTION deleteTool
Definition: actions.h:79
static TOOL_ACTION zoomTool
Definition: actions.h:138
static TOOL_ACTION showProperties
Definition: actions.h:216
static TOOL_ACTION zoomInCenter
Definition: actions.h:127
static TOOL_ACTION toggleGridOverrides
Definition: actions.h:188
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.
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
static const wxString PropertiesPaneName()
ACTION_TOOLBAR * m_mainToolBar
ACTION_TOOLBAR * m_drawToolBar
PROPERTIES_PANEL * m_propertiesPanel
static TOOL_ACTION mirrorV
Definition: ee_actions.h:132
static TOOL_ACTION pinTable
Definition: ee_actions.h:162
static TOOL_ACTION placeSymbolAnchor
Definition: ee_actions.h:123
static TOOL_ACTION showHiddenFields
Definition: ee_actions.h:250
static TOOL_ACTION drawSymbolPolygon
Definition: ee_actions.h:122
static TOOL_ACTION showDeMorganAlternate
Definition: ee_actions.h:142
static TOOL_ACTION newSymbol
Definition: ee_actions.h:216
static TOOL_ACTION drawCircle
Definition: ee_actions.h:106
static TOOL_ACTION showDeMorganStandard
Definition: ee_actions.h:141
static TOOL_ACTION rotateCCW
Definition: ee_actions.h:131
static TOOL_ACTION placeSymbolText
Definition: ee_actions.h:119
static TOOL_ACTION addSymbolToSchematic
Definition: ee_actions.h:187
static TOOL_ACTION mirrorH
Definition: ee_actions.h:133
static TOOL_ACTION rotateCW
Definition: ee_actions.h:130
static TOOL_ACTION symbolProperties
Definition: ee_actions.h:161
static TOOL_ACTION checkSymbol
Definition: ee_actions.h:171
static TOOL_ACTION drawRectangle
Definition: ee_actions.h:105
static TOOL_ACTION drawSymbolTextBox
Definition: ee_actions.h:120
static TOOL_ACTION drawSymbolLines
Definition: ee_actions.h:121
static TOOL_ACTION drawArc
Definition: ee_actions.h:107
static TOOL_ACTION toggleSyncedPinsMode
Definition: ee_actions.h:259
static TOOL_ACTION drawBezier
Definition: ee_actions.h:108
static TOOL_ACTION showHiddenPins
Definition: ee_actions.h:249
static TOOL_ACTION placeSymbolPin
Definition: ee_actions.h:118
static TOOL_ACTION showElectricalTypes
Definition: ee_actions.h:265
void updateSelectionFilterVisbility() override
Selection filter panel doesn't have a dedicated visibility control, so show it if any other AUI panel...
void ReCreateVToolbar() override
wxComboBox * m_unitSelectBox
void ToggleProperties() override
SYMBOL_EDITOR_SETTINGS * m_settings
bool IsSymbolFromSchematic() const
void ReCreateHToolbar() override
void ReCreateOptToolbar() override
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
@ ID_LIBEDIT_SELECT_UNIT_NUMBER
Definition: eeschema_id.h:60
@ ID_OPT_TOOLBAR
Definition: id.h:101
@ ID_V_TOOLBAR
Definition: id.h:100
@ ID_H_TOOLBAR
Definition: id.h:99
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
#define LISTBOX_WIDTH
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.