KiCad PCB EDA Suite
Loading...
Searching...
No Matches
toolbars_pcb_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) 2012 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 (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
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 <memory>
28
29#include <advanced_config.h>
31#include <bitmaps.h>
32#include <board.h>
34#include <kiface_base.h>
35#include <kiplatform/ui.h>
36#include <macros.h>
37#include <pcb_edit_frame.h>
39#include <pcbnew_id.h>
40#include <pcbnew_settings.h>
41#include <pgm_base.h>
43#include <router/router_tool.h>
45#include <tool/action_toolbar.h>
46#include <tool/actions.h>
47#include <tool/common_tools.h>
48#include <tool/tool_manager.h>
49#include <tools/pcb_actions.h>
58#include <wx/wupdlock.h>
59#include <wx/combobox.h>
60
61#include "../scripting/python_scripting.h"
62
63
64/* Data to build the layer pair indicator button */
65static std::unique_ptr<wxBitmap> LayerPairBitmap;
66
67
68void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
69{
70 COLOR4D top_color, bottom_color, background_color;
71 bool change = aForceRebuild;
72
73 int requested_scale = KiIconScale( this );
74
75 if( m_prevIconVal.previous_requested_scale != requested_scale )
76 {
78 change = true;
79 }
80
81 top_color = GetColorSettings()->GetColor( GetScreen()->m_Route_Layer_TOP );
82
84 {
86 change = true;
87 }
88
89 bottom_color = GetColorSettings()->GetColor( GetScreen()->m_Route_Layer_BOTTOM );
90
92 {
94 change = true;
95 }
96
97 background_color = GetColorSettings()->GetColor( LAYER_PCB_BACKGROUND );
98
99 if( m_prevIconVal.previous_background_color != background_color )
100 {
101 m_prevIconVal.previous_background_color = background_color;
102 change = true;
103 }
104
105 if( change || !LayerPairBitmap )
106 {
107 const int scale = ( requested_scale <= 0 ) ? KiIconScale( this ) : requested_scale;
108 LayerPairBitmap = LAYER_PRESENTATION::CreateLayerPairIcon( background_color, top_color,
109 bottom_color, scale );
110
112 {
114 m_auxiliaryToolBar->Refresh();
115 }
116 }
117}
118
119
121{
122 // Note:
123 // To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() )
124 // all wxAuiToolBarItems.
125 // However the wxAuiToolBarItems are not the owners of controls managed by
126 // them and therefore do not delete them
127 // So we do not recreate them after clearing the tools.
128
129 wxWindowUpdateLocker dummy( this );
130
131 if( m_mainToolBar )
132 {
134 }
135 else
136 {
137 m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
138 KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT |
139 wxAUI_TB_HORIZONTAL );
141 }
142
143 // Set up toolbar
144 if( Kiface().IsSingle() )
145 {
148 }
149
151
154
159
163
166
174
184
189
191
192 if( !Kiface().IsSingle() )
194 else
196
198
201
202 // Add SWIG and API plugins
203 bool scriptingAvailable = SCRIPTING::IsWxAvailable();
204#ifdef KICAD_IPC_API
205 bool haveApiPlugins = Pgm().GetCommonSettings()->m_Api.enable_server &&
206 !Pgm().GetPluginManager().GetActionsForScope( PLUGIN_ACTION_SCOPE::PCB ).empty();
207#else
208 bool haveApiPlugins = false;
209#endif
210
211 if( scriptingAvailable || haveApiPlugins )
212 {
214
215 if( scriptingAvailable )
216 {
219 }
220
221 if( haveApiPlugins )
223 }
224
225 // after adding the buttons to the toolbar, must call Realize() to reflect the changes
227}
228
229
231{
232 // Note:
233 // To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() )
234 // all wxAuiToolBarItems.
235 // However the wxAuiToolBarItems are not the owners of controls managed by
236 // them and therefore do not delete them
237 // So we do not recreate them after clearing the tools.
238
239 wxWindowUpdateLocker dummy( this );
240
241 if( m_optionsToolBar )
242 {
244 }
245 else
246 {
248 wxDefaultPosition, wxDefaultSize,
249 KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
251 }
252
255
261
264
268
272
276
277 if( ADVANCED_CFG::GetCfg().m_ExtraZoneDisplayModes )
278 {
281 }
282
287
288 if( ADVANCED_CFG::GetCfg().m_DrawBoundingBoxes )
290
291 // Tools to show/hide toolbars:
295
297 std::unique_ptr<ACTION_MENU> gridMenu = std::make_unique<ACTION_MENU>( false, selTool );
298 gridMenu->Add( ACTIONS::gridProperties );
299 gridMenu->Add( ACTIONS::gridOrigin );
301
303}
304
305
307{
308 wxWindowUpdateLocker dummy( this );
309
310 if( m_drawToolBar )
311 {
313 }
314 else
315 {
316 m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
317 KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
319 }
320
321 // Groups contained on this toolbar
322 static ACTION_GROUP* dimensionGroup = nullptr;
323 static ACTION_GROUP* originGroup = nullptr;
324 static ACTION_GROUP* routingGroup = nullptr;
325 static ACTION_GROUP* tuneGroup = nullptr;
326
327 if( !dimensionGroup )
328 {
329 dimensionGroup = new ACTION_GROUP( "group.pcbDimensions",
335 }
336
337 if( !originGroup )
338 {
339 originGroup = new ACTION_GROUP( "group.pcbOrigins",
342 }
343
344 if( !routingGroup )
345 {
346 routingGroup = new ACTION_GROUP( "group.pcbRouting",
349 }
350
351 if( !tuneGroup )
352 {
353 tuneGroup = new ACTION_GROUP( "group.pcbTune",
357 }
358
359 // clang-format off
362
370
384
388 // clang-format on
389
391
392 auto makeArcMenu = [&]()
393 {
394 std::unique_ptr<ACTION_MENU> arcMenu = std::make_unique<ACTION_MENU>( false, selTool );
395
398
399 return arcMenu;
400 };
401
403
404 auto makeRouteMenu = [&]()
405 {
406 std::unique_ptr<ACTION_MENU> routeMenu = std::make_unique<ACTION_MENU>( false, selTool );
407
411
412 routeMenu->AppendSeparator();
413 routeMenu->Add( PCB_ACTIONS::routerSettingsDialog );
414
415 return routeMenu;
416 };
417
420
421 std::unique_ptr<ACTION_MENU> zoneMenu = std::make_unique<ACTION_MENU>( false, selTool );
422 zoneMenu->Add( PCB_ACTIONS::zoneFillAll );
423 zoneMenu->Add( PCB_ACTIONS::zoneUnfillAll );
424 m_drawToolBar->AddToolContextMenu( PCB_ACTIONS::drawZone, std::move( zoneMenu ) );
425
426 std::unique_ptr<ACTION_MENU> lineMenu = std::make_unique<ACTION_MENU>( false, selTool );
427 m_drawToolBar->AddToolContextMenu( PCB_ACTIONS::drawLine, std::move( lineMenu ) );
428
430}
431
432
434{
435 wxWindowUpdateLocker dummy( this );
436
438 {
440 }
441 else
442 {
443 m_auxiliaryToolBar = new ACTION_TOOLBAR( this, ID_AUX_TOOLBAR, wxDefaultPosition,
444 wxDefaultSize,
445 KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
447 }
448
449 /* Set up toolbar items */
450
451 // Creates box to display and choose tracks widths:
452 if( m_SelTrackWidthBox == nullptr )
454 wxDefaultPosition, wxDefaultSize, 0, nullptr );
455
458 m_SelTrackWidthBox->SetToolTip( _( "Select the default width for new tracks. Note that this "
459 "width can be overridden by the board minimum width, or by "
460 "the width of an existing track if the 'Use Existing Track "
461 "Width' feature is enabled." ) );
462
464 KiBitmapBundle( BITMAPS::auto_track_width ),
465 _( "When routing from an existing track use its width instead "
466 "of the current width setting" ),
467 wxITEM_CHECK );
468
470
471 // Creates box to display and choose vias diameters:
472
473 if( m_SelViaSizeBox == nullptr )
475 wxDefaultPosition, wxDefaultSize, 0, nullptr );
476
478 m_auxiliaryToolBar->AddControl( m_SelViaSizeBox );
479
481
482 if( m_SelLayerBox == nullptr )
483 {
486 }
487
488 ReCreateLayerBox( false );
489 m_auxiliaryToolBar->AddControl( m_SelLayerBox );
490
492 PrepareLayerIndicator( true ); // Force rebuild of the bitmap with the active layer colors
493
494 // Add the box to display and select the current grid size:
496
497 if( m_gridSelectBox == nullptr )
499 wxDefaultPosition, wxDefaultSize, 0, nullptr );
500
502
503 m_auxiliaryToolBar->AddControl( m_gridSelectBox );
504
505 // Add the box to display and select the current Zoom
507
508 if( m_zoomSelectBox == nullptr )
510 wxDefaultPosition, wxDefaultSize, 0, nullptr );
511
513 m_auxiliaryToolBar->AddControl( m_zoomSelectBox );
514
515 // Go through and ensure the comboboxes are the correct size, since the strings in the
516 // box could have changed widths.
522
523 // after adding the buttons to the toolbar, must call Realize()
525}
526
527
529{
530 if( m_mainToolBar )
531 {
532 // Update the item widths
533 }
534
536 {
537 // Update the item widths
543 }
544}
545
546
547static wxString ComboBoxUnits( EDA_UNITS aUnits, double aValue, bool aIncludeLabel = true )
548{
549 wxString text;
550 const wxChar* format;
551
552 switch( aUnits )
553 {
554 default:
555 wxASSERT_MSG( false, wxT( "Invalid unit" ) );
557 case EDA_UNITS::UNSCALED: format = wxT( "%.0f" ); break;
558 case EDA_UNITS::MILLIMETRES: format = wxT( "%.3f" ); break;
559 case EDA_UNITS::MILS: format = wxT( "%.2f" ); break;
560 case EDA_UNITS::INCHES: format = wxT( "%.5f" ); break;
561 }
562
563 text.Printf( format, EDA_UNIT_UTILS::UI::ToUserUnit( pcbIUScale, aUnits, aValue ) );
564
565 if( aIncludeLabel )
567
568 return text;
569}
570
571
572void PCB_EDIT_FRAME::UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, bool aShowNetclass,
573 bool aShowEdit )
574{
575 if( aTrackWidthSelectBox == nullptr )
576 return;
577
578 EDA_UNITS primaryUnit;
579 EDA_UNITS secondaryUnit;
580
581 GetUnitPair( primaryUnit, secondaryUnit );
582
583 wxString msg;
584
585 aTrackWidthSelectBox->Clear();
586
587 if( aShowNetclass )
588 aTrackWidthSelectBox->Append( _( "Track: use netclass width" ) );
589
590 for( unsigned ii = 1; ii < GetDesignSettings().m_TrackWidthList.size(); ii++ )
591 {
592 int size = GetDesignSettings().m_TrackWidthList[ii];
593
594 msg.Printf( _( "Track: %s (%s)" ), ComboBoxUnits( primaryUnit, size ),
595 ComboBoxUnits( secondaryUnit, size ) );
596
597 aTrackWidthSelectBox->Append( msg );
598 }
599
600 if( aShowEdit )
601 {
602 aTrackWidthSelectBox->Append( wxT( "---" ) );
603 aTrackWidthSelectBox->Append( _( "Edit Pre-defined Sizes..." ) );
604 }
605
606 if( GetDesignSettings().GetTrackWidthIndex() >= GetDesignSettings().m_TrackWidthList.size() )
608
609 aTrackWidthSelectBox->SetSelection( GetDesignSettings().GetTrackWidthIndex() );
610}
611
612
613void PCB_EDIT_FRAME::UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, bool aShowNetclass,
614 bool aShowEdit )
615{
616 if( aViaSizeSelectBox == nullptr )
617 return;
618
619 aViaSizeSelectBox->Clear();
620
622
623 EDA_UNITS primaryUnit = GetUserUnits();
624 EDA_UNITS secondaryUnit = EDA_UNITS::MILS;
625
626 if( EDA_UNIT_UTILS::IsImperialUnit( primaryUnit ) )
627 {
628 if( cmnTool )
629 secondaryUnit = cmnTool->GetLastMetricUnits();
630 else
631 secondaryUnit = EDA_UNITS::MILLIMETRES;
632 }
633 else
634 {
635 if( cmnTool )
636 secondaryUnit = cmnTool->GetLastImperialUnits();
637 else
638 secondaryUnit = EDA_UNITS::MILS;
639 }
640
641 if( aShowNetclass )
642 aViaSizeSelectBox->Append( _( "Via: use netclass sizes" ) );
643
644 for( unsigned ii = 1; ii < GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
645 {
647 wxString msg, priStr, secStr;
648
649 double diam = viaDimension.m_Diameter;
650 double hole = viaDimension.m_Drill;
651
652 if( hole > 0 )
653 {
654 priStr = ComboBoxUnits( primaryUnit, diam, false ) + wxT( " / " )
655 + ComboBoxUnits( primaryUnit, hole, true );
656 secStr = ComboBoxUnits( secondaryUnit, diam, false ) + wxT( " / " )
657 + ComboBoxUnits( secondaryUnit, hole, true );
658 }
659 else
660 {
661 priStr = ComboBoxUnits( primaryUnit, diam, true );
662 secStr = ComboBoxUnits( secondaryUnit, diam, true );
663 }
664
665 msg.Printf( _( "Via: %s (%s)" ), priStr, secStr );
666
667 aViaSizeSelectBox->Append( msg );
668 }
669
670 if( aShowEdit )
671 {
672 aViaSizeSelectBox->Append( wxT( "---" ) );
673 aViaSizeSelectBox->Append( _( "Edit Pre-defined Sizes..." ) );
674 }
675
676 if( GetDesignSettings().GetViaSizeIndex() >= GetDesignSettings().m_ViasDimensionsList.size() )
678
679 aViaSizeSelectBox->SetSelection( GetDesignSettings().GetViaSizeIndex() );
680}
681
682
683void PCB_EDIT_FRAME::ReCreateLayerBox( bool aForceResizeToolbar )
684{
685 if( m_SelLayerBox == nullptr || m_auxiliaryToolBar == nullptr )
686 return;
687
688 m_SelLayerBox->SetToolTip( _( "+/- to switch" ) );
690
691 if( aForceResizeToolbar )
693}
694
695
697{
699 wxAuiPaneInfo& layersManager = m_auimgr.GetPane( "LayersManager" );
700 wxAuiPaneInfo& selectionFilter = m_auimgr.GetPane( "SelectionFilter" );
701
702 // show auxiliary Vertical layers and visibility manager toolbar
704
705 layersManager.Show( m_show_layer_manager_tools );
706 selectionFilter.Show( m_show_layer_manager_tools );
707
709 {
710 SetAuiPaneSize( m_auimgr, layersManager, settings->m_AuiPanels.right_panel_width, -1 );
711 }
712 else
713 {
714 settings->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
715 m_auimgr.Update();
716 }
717}
718
719
721{
723 wxAuiPaneInfo& netInspectorPanel = m_auimgr.GetPane( NetInspectorPanelName() );
724
726
727 netInspectorPanel.Show( m_show_net_inspector );
728
730 {
731 SetAuiPaneSize( m_auimgr, netInspectorPanel, settings->m_AuiPanels.net_inspector_width,
732 -1 );
734 }
735 else
736 {
738 settings->m_AuiPanels.net_inspector_width = m_netInspectorPanel->GetSize().x;
739 m_auimgr.Update();
740 }
741}
742
743
745{
747
748 // Ensure m_show_search is up to date (the pane can be closed outside the menu)
749 m_show_search = m_auimgr.GetPane( SearchPaneName() ).IsShown();
750
752
753 wxAuiPaneInfo& searchPaneInfo = m_auimgr.GetPane( SearchPaneName() );
754 searchPaneInfo.Show( m_show_search );
755
756 if( m_show_search )
757 {
758 searchPaneInfo.Direction( settings->m_AuiPanels.search_panel_dock_direction );
759
760 if( settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_TOP
761 || settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_BOTTOM )
762 {
763 SetAuiPaneSize( m_auimgr, searchPaneInfo,
764 -1, settings->m_AuiPanels.search_panel_height );
765 }
766 else if( settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_LEFT
767 || settings->m_AuiPanels.search_panel_dock_direction == wxAUI_DOCK_RIGHT )
768 {
769 SetAuiPaneSize( m_auimgr, searchPaneInfo,
770 settings->m_AuiPanels.search_panel_width, -1 );
771 }
773 }
774 else
775 {
776 settings->m_AuiPanels.search_panel_height = m_searchPane->GetSize().y;
777 settings->m_AuiPanels.search_panel_width = m_searchPane->GetSize().x;
778 settings->m_AuiPanels.search_panel_dock_direction = searchPaneInfo.dock_direction;
779 m_auimgr.Update();
780 GetCanvas()->SetFocus();
781 }
782}
783
784
785void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent )
786{
787 if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_TRACK_WIDTH )
788 {
790 int sel;
791
792 if( bds.UseCustomTrackViaSize() )
793 sel = wxNOT_FOUND;
794 else
795 sel = bds.GetTrackWidthIndex();
796
797 if( m_SelTrackWidthBox->GetSelection() != sel )
798 m_SelTrackWidthBox->SetSelection( sel );
799 }
800}
801
802
803void PCB_EDIT_FRAME::OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent )
804{
805 if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_VIA_SIZE )
806 {
808 int sel = 0;
809
810 if( bds.UseCustomTrackViaSize() )
811 sel = wxNOT_FOUND;
812 else
813 sel = bds.GetViaSizeIndex();
814
815 if( m_SelViaSizeBox->GetSelection() != sel )
816 m_SelViaSizeBox->SetSelection( sel );
817 }
818}
819
820
821void PCB_EDIT_FRAME::OnUpdateSelectAutoWidth( wxUpdateUIEvent& aEvent )
822{
824
825 aEvent.Check( bds.m_UseConnectedTrackWidth );
826}
827
828
829void PCB_EDIT_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
830{
833}
constexpr EDA_IU_SCALE pcbIUScale
Definition: base_units.h:108
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
Definition: bitmap.cpp:110
int KiIconScale(wxWindow *aWindow)
Return the automatic scale factor that would be used for a given window by KiScaledBitmap and KiScale...
Definition: bitmap.cpp:122
static TOOL_ACTION gridProperties
Definition: actions.h:189
static TOOL_ACTION updatePcbFromSchematic
Definition: actions.h:214
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 show3DViewer
Definition: actions.h:209
static TOOL_ACTION zoomOutCenter
Definition: actions.h:128
static TOOL_ACTION togglePolarCoords
Definition: actions.h:198
static TOOL_ACTION milsUnits
Definition: actions.h:194
static TOOL_ACTION toggleBoundingBoxes
Definition: actions.h:147
static TOOL_ACTION plot
Definition: actions.h:58
static TOOL_ACTION open
Definition: actions.h:50
static TOOL_ACTION pageSettings
Definition: actions.h:56
static TOOL_ACTION undo
Definition: actions.h:68
static TOOL_ACTION inchesUnits
Definition: actions.h:193
static TOOL_ACTION highContrastMode
Definition: actions.h:145
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:144
static TOOL_ACTION gridOrigin
Definition: actions.h:190
static TOOL_ACTION measureTool
Definition: actions.h:203
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 showFootprintEditor
Definition: actions.h:213
static TOOL_ACTION print
Definition: actions.h:57
static TOOL_ACTION showProperties
Definition: actions.h:216
static TOOL_ACTION doNew
Definition: actions.h:47
static TOOL_ACTION zoomFitObjects
Definition: actions.h:135
static TOOL_ACTION zoomInCenter
Definition: actions.h:127
static TOOL_ACTION gridSetOrigin
Definition: actions.h:184
static TOOL_ACTION showFootprintBrowser
Definition: actions.h:212
static TOOL_ACTION toggleGridOverrides
Definition: actions.h:188
static TOOL_ACTION find
Definition: actions.h:109
A group of actions that will be displayed together on a toolbar palette.
static constexpr bool CHECK
Definition: action_menu.h:201
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 UpdateControlWidth(int aID)
Update the toolbar item width of a control using its best size.
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.
bool KiRealize()
Use this over Realize() to avoid a rendering glitch with fixed orientation toolbars.
void ClearToolbar()
Clear the toolbar and remove all associated menus.
void SetToolBitmap(const TOOL_ACTION &aAction, const wxBitmap &aBitmap)
Updates the bitmap of a particular tool.
void AddGroup(ACTION_GROUP *aGroup, bool aIsToggleEntry=false)
Add a set of actions to a toolbar as a group.
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.
Container for design settings for a BOARD object.
void UseCustomTrackViaSize(bool aEnabled)
Enables/disables custom track/via size settings.
void SetTrackWidthIndex(unsigned aIndex)
Set the current track width list index to aIndex.
void SetViaSizeIndex(unsigned aIndex)
Set the current via size list index to aIndex.
unsigned GetTrackWidthIndex() const
unsigned GetViaSizeIndex() const
std::vector< int > m_TrackWidthList
std::vector< VIA_DIMENSION > m_ViasDimensionsList
COLOR4D GetColor(int aLayer) const
Handles action that are shared between different applications.
Definition: common_tools.h:38
EDA_UNITS GetLastImperialUnits()
Definition: common_tools.h:79
EDA_UNITS GetLastMetricUnits()
Definition: common_tools.h:78
static constexpr int KICAD_AUI_TB_STYLE
< Default style flags used for wxAUI toolbars.
wxAuiManager m_auimgr
wxChoice * m_gridSelectBox
ACTION_TOOLBAR * m_optionsToolBar
void UpdateGridSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
void UpdateZoomSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
ACTION_TOOLBAR * m_mainToolBar
NET_INSPECTOR_PANEL * m_netInspectorPanel
static const wxString NetInspectorPanelName()
void GetUnitPair(EDA_UNITS &aPrimaryUnit, EDA_UNITS &aSecondaryUnits) override
Get the pair or units in current use.
ACTION_TOOLBAR * m_drawToolBar
SEARCH_PANE * m_searchPane
wxChoice * m_zoomSelectBox
virtual void addApiPluginTools()
Append actions from API plugins to the main toolbar.
ACTION_TOOLBAR * m_auxiliaryToolBar
void SetFocus() override
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
int SetLayerSelection(int layer)
static std::unique_ptr< wxBitmap > CreateLayerPairIcon(const KIGFX::COLOR4D &aBgColor, const KIGFX::COLOR4D &aTopColor, const KIGFX::COLOR4D &aBottomColor, int aScale)
Create a layer pair "side-by-side swatch" icon.
virtual void SaveSettings()
Save the net inspector settings - called from EDA_EDIT_FRAME when hiding the panel.
virtual void OnShowPanel()
Prepare the panel when (re-)shown in the editor.
AUI_PANELS m_AuiPanels
static TOOL_ACTION toggleHV45Mode
Definition: pcb_actions.h:524
static TOOL_ACTION drawRuleArea
Definition: pcb_actions.h:223
static TOOL_ACTION drawBezier
Definition: pcb_actions.h:206
static TOOL_ACTION placeText
Definition: pcb_actions.h:208
static TOOL_ACTION pointEditorArcKeepCenter
Definition: pcb_actions.h:302
static TOOL_ACTION drawOrthogonalDimension
Definition: pcb_actions.h:219
static TOOL_ACTION drawRectangle
Definition: pcb_actions.h:203
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:340
static TOOL_ACTION placeReferenceImage
Definition: pcb_actions.h:207
static TOOL_ACTION routerSettingsDialog
Activation of the Push and Shove settings dialogs.
Definition: pcb_actions.h:272
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:335
static TOOL_ACTION zoneFillAll
Definition: pcb_actions.h:408
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:454
static TOOL_ACTION toggleNetHighlight
Definition: pcb_actions.h:560
static TOOL_ACTION drawCircle
Definition: pcb_actions.h:204
static TOOL_ACTION mirrorH
Mirroring of selected items.
Definition: pcb_actions.h:139
static TOOL_ACTION routeDiffPair
Activation of the Push and Shove router (differential pair mode)
Definition: pcb_actions.h:257
static TOOL_ACTION tuneDiffPair
Definition: pcb_actions.h:260
static TOOL_ACTION drawTable
Definition: pcb_actions.h:210
static TOOL_ACTION drawTextBox
Definition: pcb_actions.h:209
static TOOL_ACTION routerHighlightMode
Actions to enable switching modes via hotkey assignments.
Definition: pcb_actions.h:276
static TOOL_ACTION routerWalkaroundMode
Definition: pcb_actions.h:278
static TOOL_ACTION routerShoveMode
Definition: pcb_actions.h:277
static TOOL_ACTION drawPolygon
Definition: pcb_actions.h:202
static TOOL_ACTION group
Definition: pcb_actions.h:532
static TOOL_ACTION zoneDisplayFilled
Definition: pcb_actions.h:342
static TOOL_ACTION drawRadialDimension
Definition: pcb_actions.h:218
static TOOL_ACTION tuneSingleTrack
Definition: pcb_actions.h:259
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:341
static TOOL_ACTION drawLeader
Definition: pcb_actions.h:220
static TOOL_ACTION drillOrigin
Definition: pcb_actions.h:542
static TOOL_ACTION tuneSkew
Definition: pcb_actions.h:261
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:339
static TOOL_ACTION selectLayerPair
Definition: pcb_actions.h:192
static TOOL_ACTION zoneDisplayTriangulated
Definition: pcb_actions.h:345
static TOOL_ACTION ungroup
Definition: pcb_actions.h:533
static TOOL_ACTION zoneDisplayFractured
Definition: pcb_actions.h:344
static TOOL_ACTION drawVia
Definition: pcb_actions.h:222
static TOOL_ACTION drawArc
Definition: pcb_actions.h:205
static TOOL_ACTION runDRC
Definition: pcb_actions.h:449
static TOOL_ACTION importNetlist
Definition: pcb_actions.h:435
static TOOL_ACTION pointEditorArcKeepEndpoint
Definition: pcb_actions.h:303
static TOOL_ACTION boardSetup
Definition: pcb_actions.h:421
static TOOL_ACTION showEeschema
Definition: pcb_actions.h:546
static TOOL_ACTION drawCenterDimension
Definition: pcb_actions.h:217
static TOOL_ACTION zoneUnfillAll
Definition: pcb_actions.h:411
static TOOL_ACTION zoneDisplayOutline
Definition: pcb_actions.h:343
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:336
static TOOL_ACTION mirrorV
Definition: pcb_actions.h:140
static TOOL_ACTION unlock
Definition: pcb_actions.h:529
static TOOL_ACTION placeFootprint
Definition: pcb_actions.h:228
static TOOL_ACTION routeSingleTrack
Activation of the Push and Shove router.
Definition: pcb_actions.h:254
static TOOL_ACTION showPythonConsole
Definition: pcb_actions.h:456
static TOOL_ACTION drawLine
Definition: pcb_actions.h:201
static TOOL_ACTION localRatsnestTool
Definition: pcb_actions.h:567
static TOOL_ACTION rotateCw
Rotation of selected objects.
Definition: pcb_actions.h:132
static TOOL_ACTION rotateCcw
Definition: pcb_actions.h:133
static TOOL_ACTION drawAlignedDimension
Definition: pcb_actions.h:216
static TOOL_ACTION drawZone
Definition: pcb_actions.h:221
static TOOL_ACTION lock
Definition: pcb_actions.h:528
COLOR_SETTINGS * GetColorSettings(bool aForceRefresh=false) const override
Helper to retrieve the current color settings.
APPEARANCE_CONTROLS * m_appearancePanel
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual PCB_LAYER_ID GetActiveLayer() const
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project.
void OnUpdateSelectTrackWidth(wxUpdateUIEvent &aEvent)
void ReCreateHToolbar() override
void UpdateTrackWidthSelectBox(wxChoice *aTrackWidthSelectBox, bool aShowNetclass, bool aShowEdit)
void ReCreateVToolbar() override
void UpdateViaSizeSelectBox(wxChoice *aViaSizeSelectBox, bool aShowNetclass, bool aShowEdit)
LAYER_TOOLBAR_ICON_VALUES m_prevIconVal
void ReCreateLayerBox(bool aForceResizeToolbar=true)
Recreate the layer box by clearing the old list and building a new one from the new layer names and c...
bool m_show_layer_manager_tools
void OnUpdateLayerSelectBox(wxUpdateUIEvent &aEvent)
void PrepareLayerIndicator(bool aForceRebuild=false)
void ReCreateOptToolbar() override
void ReCreateAuxiliaryToolbar() override
void OnUpdateSelectAutoWidth(wxUpdateUIEvent &aEvent)
void UpdateToolbarControlSizes() override
Update the sizes of any controls in the toolbars of the frame.
void OnUpdateSelectViaSize(wxUpdateUIEvent &aEvent)
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
wxChoice * m_SelViaSizeBox
static const wxString SearchPaneName()
wxChoice * m_SelTrackWidthBox
void AddActionPluginTools()
Append action plugin buttons to main toolbar.
Class to display a pcb layer list in a wxBitmapComboBox.
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
The selection tool: currently supports:
virtual COMMON_SETTINGS * GetCommonSettings() const
Definition: pgm_base.cpp:679
void FocusSearch()
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:167
#define _(s)
EDA_UNITS
Definition: eda_units.h:46
@ ID_ON_GRID_SELECT
Definition: id.h:145
@ ID_OPT_TOOLBAR
Definition: id.h:101
@ ID_V_TOOLBAR
Definition: id.h:100
@ ID_ON_ZOOM_SELECT
Definition: id.h:143
@ ID_AUX_TOOLBAR
Definition: id.h:102
@ ID_H_TOOLBAR
Definition: id.h:99
@ LAYER_PCB_BACKGROUND
PCB background color.
Definition: layer_ids.h:221
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
KICOMMON_API double ToUserUnit(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnit, double aValue)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
Definition: eda_units.cpp:259
KICOMMON_API wxString GetText(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
Definition: eda_units.cpp:126
KICOMMON_API bool IsImperialUnit(EDA_UNITS aUnit)
Definition: eda_units.cpp:47
@ ID_AUX_TOOLBAR_PCB_VIA_SIZE
Definition: pcbnew_id.h:22
@ ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH
Definition: pcbnew_id.h:24
@ ID_TOOLBARH_PCB_SELECT_LAYER
Definition: pcbnew_id.h:96
@ ID_AUX_TOOLBAR_PCB_TRACK_WIDTH
Definition: pcbnew_id.h:23
int GetUserUnits()
Return the currently selected user unit value for the interface.
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition: pgm_base.cpp:1060
see class PGM_BASE
const int scale
std::vector< FAB_LAYER_COLOR > dummy
Container to handle a stock of specific vias each with unique diameter and drill sizes in the BOARD c...
static wxString ComboBoxUnits(EDA_UNITS aUnits, double aValue, bool aIncludeLabel=true)
static std::unique_ptr< wxBitmap > LayerPairBitmap
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.