KiCad PCB EDA Suite
Loading...
Searching...
No Matches
toolbars_footprint_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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright (C) 2012 Wayne Stambaugh <[email protected]>
7 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software: you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation, either version 3 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#include <tool/actions.h>
25#include <pcbnew_id.h>
26#include <bitmaps.h>
27#include <lset.h>
28#include <tool/action_toolbar.h>
29#include <tool/tool_manager.h>
30#include <tools/pcb_actions.h>
33#include <wx/choice.h>
34#include <wx/wupdlock.h>
35#include <advanced_config.h>
36
38
39std::optional<TOOLBAR_CONFIGURATION> FOOTPRINT_EDIT_TOOLBAR_SETTINGS::DefaultToolbarConfig( TOOLBAR_LOC aToolbar )
40{
42
43 // clang-format off
44 switch( aToolbar )
45 {
46 // No Aux toolbar
48 return std::nullopt;
49
51 config.AppendAction( ACTIONS::toggleGrid )
52 .AppendAction( ACTIONS::toggleGridOverrides )
53 .AppendAction( PCB_ACTIONS::togglePolarCoords )
54 .AppendAction( ACTIONS::inchesUnits )
55 .AppendAction( ACTIONS::milsUnits )
56 .AppendAction( ACTIONS::millimetersUnits )
57 .AppendGroup( TOOLBAR_GROUP_CONFIG( _( "Crosshair modes" ) )
60 .AddAction( ACTIONS::cursor45Crosshairs ) );
61
62 config.AppendSeparator()
63 .AppendAction( PCB_ACTIONS::toggleHV45Mode );
64
65 config.AppendSeparator()
66 .AppendAction( PCB_ACTIONS::padDisplayMode )
67 .AppendAction( PCB_ACTIONS::graphicsOutlines )
68 .AppendAction( PCB_ACTIONS::textOutlines )
69 .AppendAction( ACTIONS::highContrastMode );
70
71 if( ADVANCED_CFG::GetCfg().m_DrawBoundingBoxes )
73
74 config.AppendSeparator()
75 .AppendAction( ACTIONS::showLibraryTree )
76 .AppendAction( PCB_ACTIONS::showLayersManager )
77 .AppendAction( ACTIONS::showProperties );
78
79 /* TODO (ISM): Implement context menus
80 PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
81 std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
82 gridMenu->Add( ACTIONS::gridProperties );
83 gridMenu->Add( ACTIONS::gridOrigin );
84 m_tbLeft->AddToolContextMenu( ACTIONS::toggleGrid, std::move( gridMenu ) );
85 */
86 break;
87
89 config.AppendGroup( TOOLBAR_GROUP_CONFIG( _( "Selection modes" ) )
90 .AddAction( ACTIONS::selectSetRect )
91 .AddAction( ACTIONS::selectSetLasso ) );
92
93 config.AppendSeparator()
94 .AppendAction( PCB_ACTIONS::placePad )
95 .AppendAction( PCB_ACTIONS::drawRuleArea );
96
97 config.AppendSeparator()
98 .AppendAction( PCB_ACTIONS::drawLine )
99 .AppendAction( PCB_ACTIONS::drawArc )
100 .AppendAction( PCB_ACTIONS::drawRectangle )
101 .AppendAction( PCB_ACTIONS::drawCircle )
102 .AppendAction( PCB_ACTIONS::drawPolygon )
103 .AppendAction( PCB_ACTIONS::drawBezier )
104 .AppendAction( PCB_ACTIONS::placeReferenceImage )
105 .AppendAction( PCB_ACTIONS::placeText )
106 .AppendAction( PCB_ACTIONS::drawTextBox )
107 .AppendAction( PCB_ACTIONS::drawTable )
108 .AppendGroup( TOOLBAR_GROUP_CONFIG( _( "Dimension objects" ) )
113 .AddAction( PCB_ACTIONS::drawLeader ) )
114 .AppendAction( ACTIONS::deleteTool );
115
116 config.AppendSeparator()
117 .AppendAction( PCB_ACTIONS::placePoint )
118 .AppendAction( PCB_ACTIONS::setAnchor )
119 .AppendAction( ACTIONS::gridSetOrigin )
120 .AppendAction( ACTIONS::measureTool );
121
122 /* TODO (ISM): Implement context menus
123 PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
124
125 auto makeArcMenu = [&]()
126 {
127 std::unique_ptr<ACTION_MENU> arcMenu = std::make_unique<ACTION_MENU>( false, selTool );
128
129 arcMenu->Add( ACTIONS::pointEditorArcKeepCenter, ACTION_MENU::CHECK );
130 arcMenu->Add( ACTIONS::pointEditorArcKeepEndpoint, ACTION_MENU::CHECK );
131 arcMenu->Add( ACTIONS::pointEditorArcKeepRadius, ACTION_MENU::CHECK );
132
133 return arcMenu;
134 };
135
136 m_tbRight->AddToolContextMenu( PCB_ACTIONS::drawArc, makeArcMenu() );
137 */
138 break;
139
141 config.AppendAction( PCB_ACTIONS::newFootprint )
142 .AppendAction( PCB_ACTIONS::createFootprint )
143 .AppendAction( ACTIONS::save );
144
145 config.AppendSeparator()
146 .AppendAction( ACTIONS::print );
147
148 config.AppendSeparator()
149 .AppendAction( ACTIONS::undo )
150 .AppendAction( ACTIONS::redo );
151
152 config.AppendSeparator()
153 .AppendAction( ACTIONS::zoomRedraw )
154 .AppendAction( ACTIONS::zoomInCenter )
155 .AppendAction( ACTIONS::zoomOutCenter )
156 .AppendAction( ACTIONS::zoomFitScreen )
157 .AppendAction( ACTIONS::zoomTool );
158
159 config.AppendSeparator()
160 .AppendAction( PCB_ACTIONS::rotateCcw )
161 .AppendAction( PCB_ACTIONS::rotateCw )
162 .AppendAction( PCB_ACTIONS::mirrorH )
163 .AppendAction( PCB_ACTIONS::mirrorV )
164 .AppendAction( ACTIONS::group )
165 .AppendAction( ACTIONS::ungroup );
166
167 config.AppendSeparator()
168 .AppendAction( PCB_ACTIONS::footprintProperties )
169 .AppendAction( PCB_ACTIONS::padTable )
170 .AppendAction( PCB_ACTIONS::defaultPadProperties )
171 .AppendAction( ACTIONS::showDatasheet )
172 .AppendAction( PCB_ACTIONS::checkFootprint );
173
174 config.AppendSeparator()
175 .AppendAction( PCB_ACTIONS::loadFpFromBoard )
176 .AppendAction( PCB_ACTIONS::saveFpToBoard );
177
178 config.AppendSeparator()
179 .AppendControl( ACTION_TOOLBAR_CONTROLS::gridSelect );
180
181 config.AppendSeparator()
182 .AppendControl( ACTION_TOOLBAR_CONTROLS::zoomSelect );
183
184 config.AppendSeparator()
186 break;
187 }
188
189 // clang-format on
190 return config;
191}
192
193
194void FOOTPRINT_EDIT_FRAME::ReCreateLayerBox( bool aForceResizeToolbar )
195{
196 if( !m_SelLayerBox )
197 return;
198
199 m_SelLayerBox->SetToolTip( _( "+/- to switch" ) );
200 m_SelLayerBox->Resync();
201
202 if( aForceResizeToolbar )
204}
static TOOL_ACTION toggleGrid
Definition actions.h:197
static TOOL_ACTION zoomRedraw
Definition actions.h:131
static TOOL_ACTION millimetersUnits
Definition actions.h:205
static TOOL_ACTION showLibraryTree
Definition actions.h:163
static TOOL_ACTION cursorSmallCrosshairs
Definition actions.h:151
static TOOL_ACTION zoomOutCenter
Definition actions.h:135
static TOOL_ACTION togglePolarCoords
Definition actions.h:208
static TOOL_ACTION selectSetLasso
Definition actions.h:220
static TOOL_ACTION selectSetRect
Set lasso selection mode.
Definition actions.h:219
static TOOL_ACTION group
Definition actions.h:238
static TOOL_ACTION showDatasheet
Definition actions.h:266
static TOOL_ACTION milsUnits
Definition actions.h:204
static TOOL_ACTION ungroup
Definition actions.h:239
static TOOL_ACTION toggleBoundingBoxes
Definition actions.h:156
static TOOL_ACTION undo
Definition actions.h:75
static TOOL_ACTION inchesUnits
Definition actions.h:203
static TOOL_ACTION highContrastMode
Definition actions.h:154
static TOOL_ACTION measureTool
Definition actions.h:251
static TOOL_ACTION save
Definition actions.h:58
static TOOL_ACTION zoomFitScreen
Definition actions.h:141
static TOOL_ACTION redo
Definition actions.h:76
static TOOL_ACTION deleteTool
Definition actions.h:86
static TOOL_ACTION zoomTool
Definition actions.h:145
static TOOL_ACTION cursor45Crosshairs
Definition actions.h:153
static TOOL_ACTION print
Definition actions.h:64
static TOOL_ACTION showProperties
Definition actions.h:265
static TOOL_ACTION zoomInCenter
Definition actions.h:134
static TOOL_ACTION gridSetOrigin
Definition actions.h:194
static TOOL_ACTION toggleGridOverrides
Definition actions.h:198
static TOOL_ACTION cursorFullCrosshairs
Definition actions.h:152
static ACTION_TOOLBAR_CONTROL gridSelect
static ACTION_TOOLBAR_CONTROL layerSelector
static ACTION_TOOLBAR_CONTROL zoomSelect
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
virtual void UpdateToolbarControlSizes()
Update the sizes of any controls in the toolbars of the frame.
void ReCreateLayerBox(bool aForceResizeToolbar=true)
Re create the layer Box by clearing the old list, and building a new one from the new layers names an...
std::optional< TOOLBAR_CONFIGURATION > DefaultToolbarConfig(TOOLBAR_LOC aToolbar) override
Get the default tools to show on the specified canvas toolbar.
static TOOL_ACTION toggleHV45Mode
static TOOL_ACTION drawRuleArea
static TOOL_ACTION drawBezier
static TOOL_ACTION placeText
static TOOL_ACTION drawOrthogonalDimension
static TOOL_ACTION drawRectangle
static TOOL_ACTION setAnchor
static TOOL_ACTION padDisplayMode
static TOOL_ACTION placeReferenceImage
static TOOL_ACTION showLayersManager
static TOOL_ACTION drawCircle
static TOOL_ACTION mirrorH
Mirroring of selected items.
static TOOL_ACTION createFootprint
static TOOL_ACTION drawTable
static TOOL_ACTION drawTextBox
static TOOL_ACTION drawPolygon
static TOOL_ACTION placePad
Activation of the drawing tool (placing a PAD)
static TOOL_ACTION drawRadialDimension
static TOOL_ACTION padTable
static TOOL_ACTION drawLeader
static TOOL_ACTION newFootprint
static TOOL_ACTION defaultPadProperties
static TOOL_ACTION drawArc
static TOOL_ACTION graphicsOutlines
Display footprint graphics as outlines.
static TOOL_ACTION loadFpFromBoard
static TOOL_ACTION drawCenterDimension
static TOOL_ACTION footprintProperties
static TOOL_ACTION textOutlines
Display texts as lines.
static TOOL_ACTION checkFootprint
static TOOL_ACTION placePoint
static TOOL_ACTION mirrorV
static TOOL_ACTION saveFpToBoard
static TOOL_ACTION drawLine
static TOOL_ACTION rotateCw
Rotation of selected objects.
static TOOL_ACTION rotateCcw
static TOOL_ACTION drawAlignedDimension
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
#define _(s)
@ RIGHT
Toolbar on the right side of the canvas.
@ LEFT
Toolbar on the left side of the canvas.
@ TOP_AUX
Toolbar on the top of the canvas.
@ TOP_MAIN
Toolbar on the top of the canvas.