KiCad PCB EDA Suite
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, jean-pierre.charras@ujf-grenoble.fr
5  * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
6  * Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
7  * Copyright (C) 1992-2019 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 <bitmaps.h>
28 #include <class_board.h>
29 #include <confirm.h>
30 #include <dialog_helpers.h>
31 #include <fctsys.h>
32 #include <kiface_i.h>
33 #include <memory>
34 #include <pcb_edit_frame.h>
35 #include <pcb_layer_box_selector.h>
36 #include <pcbnew.h>
37 #include <pcbnew_id.h>
38 #include <pcbnew_settings.h>
39 #include <pgm_base.h>
41 #include <router/router_tool.h>
44 #include <tool/action_toolbar.h>
45 #include <tool/actions.h>
46 #include <tool/tool_manager.h>
47 #include <tools/pcb_actions.h>
48 #include <tools/selection_tool.h>
49 #include <view/view.h>
50 #include <wx/wupdlock.h>
51 
52 extern bool IsWxPythonLoaded();
53 
54 #define SEL_LAYER_HELP _( \
55  "Show active layer selections\nand select layer pair for route and place via" )
56 
57 
58 /* Data to build the layer pair indicator button */
59 static std::unique_ptr<wxBitmap> LayerPairBitmap;
60 
61 #define BM_LAYERICON_SIZE 24
63 {
64  // 0 = draw pixel with active layer color
65  // 1 = draw pixel with top layer color (top/bottom layer used inautoroute and place via)
66  // 2 = draw pixel with bottom layer color
67  // 3 = draw pixel with via color
68  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0 },
69  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0 },
70  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
71  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0 },
72  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 },
73  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 },
74  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
75  { 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 0, 1, 1, 1, 1, 3, 0, 0, 0, 0, 0, 0, 0 },
76  { 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 0, 1, 1, 1, 1, 3, 3, 2, 2, 2, 2, 2, 2, 2 },
77  { 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 1, 1, 1, 1, 0, 3, 3, 2, 2, 2, 2, 2, 2, 2 },
78  { 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 1, 1, 1, 1, 0, 3, 3, 2, 2, 2, 2, 2, 2, 2 },
79  { 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 1, 1, 1, 0, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0 },
80  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
81  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
82  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
83  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
84  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
85  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
86  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
87  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
88  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
89  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
90 };
91 
92 
93 void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
94 {
95  int ii, jj;
96  COLOR4D active_layer_color, top_color, bottom_color, via_color, background_color;
97  bool change = aForceRebuild;
98 
99  int requested_scale = Pgm().GetCommonSettings()->m_Appearance.icon_scale;
100 
101  if( m_prevIconVal.previous_requested_scale != requested_scale )
102  {
103  m_prevIconVal.previous_requested_scale = requested_scale;
104  change = true;
105  }
106 
107  active_layer_color = GetColorSettings()->GetColor( GetActiveLayer() );
108 
109  if( m_prevIconVal.previous_active_layer_color != active_layer_color )
110  {
111  m_prevIconVal.previous_active_layer_color = active_layer_color;
112  change = true;
113  }
114 
115  top_color = GetColorSettings()->GetColor( GetScreen()->m_Route_Layer_TOP );
116 
118  {
120  change = true;
121  }
122 
123  bottom_color = GetColorSettings()->GetColor( GetScreen()->m_Route_Layer_BOTTOM );
124 
126  {
128  change = true;
129  }
130 
131  int via_type = static_cast<int>( GetDesignSettings().m_CurrentViaType );
132  via_color = GetColorSettings()->GetColor( LAYER_VIAS + via_type );
133 
134  if( m_prevIconVal.previous_via_color != via_color )
135  {
136  m_prevIconVal.previous_via_color = via_color;
137  change = true;
138  }
139 
140  background_color = GetColorSettings()->GetColor( LAYER_PCB_BACKGROUND );
141 
142  if( m_prevIconVal.previous_background_color != background_color )
143  {
144  m_prevIconVal.previous_background_color = background_color;
145  change = true;
146  }
147 
148  if( change || !LayerPairBitmap )
149  {
150  LayerPairBitmap = std::make_unique<wxBitmap>( 24, 24 );
151 
152  // Draw the icon, with colors according to the active layer and layer pairs for via
153  // command (change layer)
154  wxMemoryDC iconDC;
155  iconDC.SelectObject( *LayerPairBitmap );
156  wxBrush brush;
157  wxPen pen;
158  int buttonColor = -1;
159 
160  brush.SetStyle( wxBRUSHSTYLE_SOLID );
161  brush.SetColour( background_color.WithAlpha(1.0).ToColour() );
162  iconDC.SetBrush( brush );
163  iconDC.DrawRectangle( 0, 0, BM_LAYERICON_SIZE, BM_LAYERICON_SIZE );
164 
165  for( ii = 0; ii < BM_LAYERICON_SIZE; ii++ )
166  {
167  for( jj = 0; jj < BM_LAYERICON_SIZE; jj++ )
168  {
169  if( s_BitmapLayerIcon[ii][jj] != buttonColor )
170  {
171  switch( s_BitmapLayerIcon[ii][jj] )
172  {
173  default:
174  case 0: pen.SetColour( active_layer_color.ToColour() ); break;
175  case 1: pen.SetColour( top_color.ToColour() ); break;
176  case 2: pen.SetColour( bottom_color.ToColour() ); break;
177  case 3: pen.SetColour( via_color.ToColour() ); break;
178  }
179 
180  buttonColor = s_BitmapLayerIcon[ii][jj];
181  iconDC.SetPen( pen );
182  }
183 
184  iconDC.DrawPoint( jj, ii );
185  }
186  }
187 
188  // Deselect the bitmap from the DC in order to delete the MemoryDC safely without
189  // deleting the bitmap
190  iconDC.SelectObject( wxNullBitmap );
191 
192  // Scale the bitmap
193  const int scale = ( requested_scale <= 0 ) ? KiIconScale( this ) : requested_scale;
194  wxImage image = LayerPairBitmap->ConvertToImage();
195 
196  // "NEAREST" causes less mixing of colors
197  image.Rescale( scale * image.GetWidth() / 4, scale * image.GetHeight() / 4,
198  wxIMAGE_QUALITY_NEAREST );
199 
200  LayerPairBitmap = std::make_unique<wxBitmap>( image );
201  }
202 
203  if( m_mainToolBar )
204  {
206  m_mainToolBar->Refresh();
207  }
208 }
209 
210 
212 {
213  // Note:
214  // To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() )
215  // all wxAuiToolBarItems.
216  // However the wxAuiToolBarItems are not the owners of controls managed by
217  // them and therefore do not delete them
218  // So we do not recreate them after clearing the tools.
219 
220  wxWindowUpdateLocker dummy( this );
221 
222  if( m_mainToolBar )
224  else
225  m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
226  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
227 
228  // Set up toolbar
229  if( Kiface().IsSingle() )
230  {
233  }
234 
236 
239 
244 
248 
251 
258 
262 
266 
268 
269  if( m_SelLayerBox == nullptr )
270  {
272  m_SelLayerBox->SetBoardFrame( this );
273  }
274 
275  ReCreateLayerBox( false );
276  m_mainToolBar->AddControl( m_SelLayerBox );
277 
279  PrepareLayerIndicator( true ); // Force rebuild of the bitmap with the active layer colors
280 
283 
284  // Access to the scripting console
285 #if defined(KICAD_SCRIPTING_WXPYTHON)
286  if( IsWxPythonLoaded() )
287  {
290 
291 #if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
292  AddActionPluginTools();
293 #endif
294  }
295 #endif
296 
297  // after adding the buttons to the toolbar, must call Realize() to reflect the changes
298  m_mainToolBar->Realize();
299 }
300 
301 
303 {
304  // Note:
305  // To rebuild the aui toolbar, the more easy way is to clear ( calling m_mainToolBar.Clear() )
306  // all wxAuiToolBarItems.
307  // However the wxAuiToolBarItems are not the owners of controls managed by
308  // them and therefore do not delete them
309  // So we do not recreate them after clearing the tools.
310 
311  wxWindowUpdateLocker dummy( this );
312 
313  if( m_optionsToolBar )
315  else
317  wxDefaultPosition, wxDefaultSize,
318  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
319 
321 
326 
330 
335 
341 
342  // Tools to show/hide toolbars:
346 
347  m_optionsToolBar->Realize();
348 }
349 
350 
352 {
353  wxWindowUpdateLocker dummy( this );
354 
355  if( m_drawToolBar )
357  else
358  m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
359  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
360 
364 
371 
382 
384  // TODO: re-insert when we have a multi-select tool button
385  // m_drawToolBar->Add( PCB_ACTIONS::drillOrigin, ACTION_TOOLBAR::TOGGLE );
388 
389  auto isHighlightMode =
390  [this]( const SELECTION& aSel )
391  {
393  return tool->GetRouterMode() == PNS::RM_MarkObstacles;
394  };
395 
396  auto isShoveMode =
397  [this]( const SELECTION& aSel )
398  {
400  return tool->GetRouterMode() == PNS::RM_Shove;
401  };
402 
403  auto isWalkaroundMode =
404  [this]( const SELECTION& aSel )
405  {
407  return tool->GetRouterMode() == PNS::RM_Walkaround;
408  };
409 
411  CONDITIONAL_MENU* routeMenu = new CONDITIONAL_MENU( false, selTool );
412  routeMenu->AddCheckItem( PCB_ACTIONS::routerHighlightMode, isHighlightMode );
413  routeMenu->AddCheckItem( PCB_ACTIONS::routerShoveMode, isShoveMode );
414  routeMenu->AddCheckItem( PCB_ACTIONS::routerWalkaroundMode, isWalkaroundMode );
415  routeMenu->AddSeparator();
418 
419  CONDITIONAL_MENU* zoneMenu = new CONDITIONAL_MENU( false, selTool );
423 
424  m_drawToolBar->Realize();
425 }
426 
427 
428 /* Create the auxiliary vertical right toolbar, showing tools for microwave applications
429  */
431 {
432  wxWindowUpdateLocker dummy(this);
433 
434  if( m_microWaveToolBar )
436  else
437  m_microWaveToolBar = new ACTION_TOOLBAR( this, ID_MICROWAVE_V_TOOLBAR, wxDefaultPosition,
438  wxDefaultSize,
439  KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
440 
441  // Set up toolbar
444 
449 
450  m_microWaveToolBar->Realize();
451 }
452 
453 
455 {
456  wxWindowUpdateLocker dummy( this );
457 
458  if( m_auxiliaryToolBar )
459  {
463 
464  // combobox sizes can have changed: apply new best sizes
465  wxAuiToolBarItem* item = m_auxiliaryToolBar->FindTool( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH );
466  item->SetMinSize( m_SelTrackWidthBox->GetBestSize() );
468  item->SetMinSize( m_SelViaSizeBox->GetBestSize() );
469 
470  m_auxiliaryToolBar->Realize();
471  m_auimgr.Update();
472  return;
473  }
474 
476  wxDefaultPosition, wxDefaultSize,
477  KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
478 
479  /* Set up toolbar items */
480 
481  // Creates box to display and choose tracks widths:
482  if( m_SelTrackWidthBox == nullptr )
484  wxDefaultPosition, wxDefaultSize, 0, NULL );
485 
487  m_auxiliaryToolBar->AddControl( m_SelTrackWidthBox );
488 
489  // Creates box to display and choose vias diameters:
490 
491  if( m_SelViaSizeBox == nullptr )
493  wxDefaultPosition, wxDefaultSize, 0, NULL );
494 
496  m_auxiliaryToolBar->AddControl( m_SelViaSizeBox );
498 
499  // Creates box to display and choose strategy to handle tracks an vias sizes:
502  _( "Auto track width: when starting on an existing track "
503  "use its width\notherwise, use current width setting" ),
504  wxITEM_CHECK );
505 
506  // Add the box to display and select the current grid size:
508 
509  if( m_gridSelectBox == nullptr )
511  wxDefaultPosition, wxDefaultSize, 0, NULL );
512 
514 
515  m_auxiliaryToolBar->AddControl( m_gridSelectBox );
516 
517  // Add the box to display and select the current Zoom
519 
520  if( m_zoomSelectBox == nullptr )
522  wxDefaultPosition, wxDefaultSize, 0, NULL );
523 
525  m_auxiliaryToolBar->AddControl( m_zoomSelectBox );
526 
527  // after adding the buttons to the toolbar, must call Realize()
528  m_auxiliaryToolBar->Realize();
529 }
530 
531 
532 void PCB_EDIT_FRAME::UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, bool aEdit )
533 {
534  if( aTrackWidthSelectBox == NULL )
535  return;
536 
537  wxString msg;
538  bool mmFirst = GetUserUnits() != EDA_UNITS::INCHES;
539 
540  aTrackWidthSelectBox->Clear();
541 
542  for( unsigned ii = 0; ii < GetDesignSettings().m_TrackWidthList.size(); ii++ )
543  {
544  int size = GetDesignSettings().m_TrackWidthList[ii];
545 
546  double valueMils = To_User_Unit( EDA_UNITS::INCHES, size ) * 1000;
547  double value_mm = To_User_Unit( EDA_UNITS::MILLIMETRES, size );
548 
549  if( mmFirst )
550  msg.Printf( _( "Track: %.3f mm (%.2f mils)" ), value_mm, valueMils );
551  else
552  msg.Printf( _( "Track: %.2f mils (%.3f mm)" ), valueMils, value_mm );
553 
554  // Mark the netclass track width value (the first in list)
555  if( ii == 0 )
556  msg << wxT( " *" );
557 
558  aTrackWidthSelectBox->Append( msg );
559  }
560 
561  if( aEdit )
562  {
563  aTrackWidthSelectBox->Append( wxT( "---" ) );
564  aTrackWidthSelectBox->Append( _( "Edit Pre-defined Sizes..." ) );
565  }
566 
567  if( GetDesignSettings().GetTrackWidthIndex() >= GetDesignSettings().m_TrackWidthList.size() )
569 
570  aTrackWidthSelectBox->SetSelection( GetDesignSettings().GetTrackWidthIndex() );
571 }
572 
573 
574 void PCB_EDIT_FRAME::UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, bool aEdit )
575 {
576  if( aViaSizeSelectBox == NULL )
577  return;
578 
579  aViaSizeSelectBox->Clear();
580 
581  bool mmFirst = GetUserUnits() != EDA_UNITS::INCHES;
582 
583  for( unsigned ii = 0; ii < GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
584  {
586  wxString msg, mmStr, milsStr;
587 
588  double diam = To_User_Unit( EDA_UNITS::MILLIMETRES, viaDimension.m_Diameter );
589  double hole = To_User_Unit( EDA_UNITS::MILLIMETRES, viaDimension.m_Drill );
590 
591  if( hole > 0 )
592  mmStr.Printf( _( "%.2f / %.2f mm" ), diam, hole );
593  else
594  mmStr.Printf( _( "%.2f mm" ), diam );
595 
596  diam = To_User_Unit( EDA_UNITS::INCHES, viaDimension.m_Diameter ) * 1000;
597  hole = To_User_Unit( EDA_UNITS::INCHES, viaDimension.m_Drill ) * 1000;
598 
599  if( hole > 0 )
600  milsStr.Printf( _( "%.1f / %.1f mils" ), diam, hole );
601  else
602  milsStr.Printf( _( "%.1f mils" ), diam );
603 
604  msg.Printf( _( "Via: %s (%s)" ), mmFirst ? mmStr : milsStr, mmFirst ? milsStr : mmStr );
605 
606  // Mark the netclass via size value (the first in list)
607  if( ii == 0 )
608  msg << wxT( " *" );
609 
610  aViaSizeSelectBox->Append( msg );
611  }
612 
613  if( aEdit )
614  {
615  aViaSizeSelectBox->Append( wxT( "---" ) );
616  aViaSizeSelectBox->Append( _( "Edit Pre-defined Sizes..." ) );
617  }
618 
619  if( GetDesignSettings().GetViaSizeIndex() >= GetDesignSettings().m_ViasDimensionsList.size() )
621 
622  aViaSizeSelectBox->SetSelection( GetDesignSettings().GetViaSizeIndex() );
623 }
624 
625 
626 void PCB_EDIT_FRAME::ReCreateLayerBox( bool aForceResizeToolbar )
627 {
628  if( m_SelLayerBox == NULL || m_mainToolBar == NULL )
629  return;
630 
631  m_SelLayerBox->SetToolTip( _( "+/- to switch" ) );
633 
634  if( aForceResizeToolbar )
635  {
636  // the layer box can have its size changed
637  // Update the aui manager, to take in account the new size
638  m_auimgr.Update();
639  }
640 }
641 
642 
644 {
645  // show auxiliary Vertical layers and visibility manager toolbar
647  m_auimgr.GetPane( "LayersManager" ).Show( m_show_layer_manager_tools );
648  m_auimgr.GetPane( "SelectionFilter" ).Show( m_show_layer_manager_tools );
649  m_auimgr.Update();
650 }
651 
652 
654 {
656  m_auimgr.GetPane( "MicrowaveToolbar" ).Show( m_show_microwave_tools );
657  m_auimgr.Update();
658 }
659 
660 
661 void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent )
662 {
663  if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_TRACK_WIDTH )
664  {
665  if( m_SelTrackWidthBox->GetSelection() != (int) GetDesignSettings().GetTrackWidthIndex() )
666  m_SelTrackWidthBox->SetSelection( GetDesignSettings().GetTrackWidthIndex() );
667  }
668 }
669 
670 
671 void PCB_EDIT_FRAME::OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent )
672 {
673  if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_VIA_SIZE )
674  {
675  if( m_SelViaSizeBox->GetSelection() != (int) GetDesignSettings().GetViaSizeIndex() )
676  m_SelViaSizeBox->SetSelection( GetDesignSettings().GetViaSizeIndex() );
677  }
678 }
679 
680 
681 void PCB_EDIT_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
682 {
684 }
685 
686 
688 {
689  return m_auimgr.GetPane( "LayersManager" ).IsShown();
690 }
691 
693 {
694  return m_auimgr.GetPane( "MicrowaveToolbar" ).IsShown();
695 }
696 
697 
699 {
700 #define TOGGLE_TOOL( toolbar, tool ) toolbar->Toggle( tool, IsCurrentTool( tool ) )
701 
703  return;
704 
705  auto& opts = GetDisplayOptions();
707  int zoneMode = opts.m_DisplayZonesMode;
708 
710  m_mainToolBar->Toggle( ACTIONS::undo, GetScreen() && GetScreen()->GetUndoCommandCount() > 0 );
711  m_mainToolBar->Toggle( ACTIONS::redo, GetScreen() && GetScreen()->GetRedoCommandCount() > 0 );
713 #if defined(KICAD_SCRIPTING_WXPYTHON)
714  if( IsWxPythonLoaded() )
715  {
716  wxMiniFrame* console = (wxMiniFrame *) PCB_EDIT_FRAME::findPythonConsole();
717  m_mainToolBar->Toggle( PCB_ACTIONS::showPythonConsole, console && console->IsShown() );
718  }
719 #endif
720  m_mainToolBar->Refresh();
721 
723 
729  m_optionsToolBar->Toggle( PCB_ACTIONS::showRatsnest, opts.m_ShowGlobalRatsnest );
730  m_optionsToolBar->Toggle( PCB_ACTIONS::ratsnestLineMode, opts.m_DisplayRatsnestLinesCurved );
733 
737  m_optionsToolBar->Toggle( PCB_ACTIONS::trackDisplayMode, !opts.m_DisplayPcbTrackFill );
738  m_optionsToolBar->Toggle( PCB_ACTIONS::viaDisplayMode, !opts.m_DisplayViaFill );
739  m_optionsToolBar->Toggle( PCB_ACTIONS::padDisplayMode, !opts.m_DisplayPadFill );
740  m_optionsToolBar->Toggle( ACTIONS::highContrastMode, opts.m_ContrastModeDisplay );
741  m_optionsToolBar->Refresh();
742 
763  m_drawToolBar->Refresh();
764 
770  m_microWaveToolBar->Refresh();
771 }
double To_User_Unit(EDA_UNITS aUnit, double aValue, bool aUseMils)
Function To_User_Unit convert aValue in internal units to the appropriate user units defined by aUnit...
Definition: base_units.cpp:92
static bool ShowAlways(const SELECTION &aSelection)
Function ShowAlways The default condition function (always returns true).
static TOOL_ACTION drawLine
Definition: pcb_actions.h:137
Struct VIA_DIMENSION is a small helper container to handle a stock of specific vias each with unique ...
static TOOL_ACTION placeModule
Definition: pcb_actions.h:150
ACTION_TOOLBAR.
void SetTrackWidthIndex(unsigned aIndex)
Function SetTrackWidthIndex sets the current track width list index to aIndex.
virtual BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Returns the BOARD_DESIGN_SETTINGS for the open project Overloaded in FOOTPRINT_EDIT_FRAME.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:104
PNS::PNS_MODE GetRouterMode()
static TOOL_ACTION selectLayerPair
Definition: pcb_actions.h:124
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 const char s_BitmapLayerIcon[BM_LAYERICON_SIZE][BM_LAYERICON_SIZE]
static TOOL_ACTION drillOrigin
Definition: pcb_actions.h:410
ACTION_TOOLBAR * m_auxiliaryToolBar
This file is part of the common library.
static TOOL_ACTION zoneFillAll
Definition: pcb_actions.h:286
static TOOL_ACTION drawArc
Definition: pcb_actions.h:141
std::vector< int > m_TrackWidthList
ACTION_TOOLBAR * m_optionsToolBar
static TOOL_ACTION microwaveCreateStubArc
Definition: pcb_actions.h:388
static TOOL_ACTION ratsnestLineMode
Definition: pcb_actions.h:222
static const bool TOGGLE
static TOOL_ACTION zoomTool
Definition: actions.h:95
static TOOL_ACTION zoneDisplayOutlines
Definition: pcb_actions.h:228
SELECTION_TOOL.
void AddScaledSeparator(wxWindow *aWindow)
Add a separator that introduces space on either side to not squash the tools when scaled.
void OnUpdateLayerSelectBox(wxUpdateUIEvent &aEvent)
Ignore collisions, mark obstacles
wxChoice * m_SelViaSizeBox
static TOOL_ACTION drawZoneKeepout
Definition: pcb_actions.h:146
int KiIconScale(wxWindow *aWindow)
Return the automatic scale factor that would be used for a given window by KiScaledBitmap and KiScale...
Definition: bitmap.cpp:90
static TOOL_ACTION zoneDisplayDisable
Definition: pcb_actions.h:227
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 drawPolygon
Definition: pcb_actions.h:138
void ReCreateLayerBox(bool aForceResizeToolbar=true)
Re create the layer Box by clearing the old list, and building le new one, from the new layers names ...
static TOOL_ACTION routerHighlightMode
Actions to enable switching modes via hotkey assignments.
Definition: pcb_actions.h:189
COLOR4D WithAlpha(double aAlpha) const
Function WithAlpha Returns a colour with the same colour, but the given alpha.
Definition: color4d.h:307
static TOOL_ACTION microwaveCreateLine
Definition: pcb_actions.h:392
#define TOGGLE_TOOL(toolbar, tool)
static TOOL_ACTION showPythonConsole
Definition: pcb_actions.h:325
void UpdateZoomSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
static TOOL_ACTION showLayersManager
Definition: pcb_actions.h:323
static TOOL_ACTION updatePcbFromSchematic
Definition: actions.h:156
Class to display a pcb layer list in a wxBitmapComboBox.
wxAuiManager m_auimgr
bool m_show_microwave_tools
void SetBoardFrame(PCB_BASE_FRAME *aFrame)
ACTION_TOOLBAR * m_mainToolBar
void ReCreateHToolbar() override
static TOOL_ACTION print
Definition: actions.h:60
static TOOL_ACTION localRatsnestTool
Definition: pcb_actions.h:417
static TOOL_ACTION find
Definition: actions.h:78
#define BM_LAYERICON_SIZE
wxChoice * m_SelTrackWidthBox
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions Display options control the way tracks, vias, outlines and other things ar...
wxBitmap KiScaledBitmap(BITMAP_DEF aBitmap, wxWindow *aWindow)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
Definition: bitmap.cpp:116
static wxWindow * findPythonConsole()
static TOOL_ACTION imperialUnits
Definition: actions.h:139
wxChoice * m_gridSelectBox
static TOOL_ACTION placeText
Definition: pcb_actions.h:142
static TOOL_ACTION zoomOutCenter
Definition: actions.h:91
bool m_show_layer_manager_tools
virtual PCB_LAYER_ID GetActiveLayer() const
void UpdateGridSelectBox()
Rebuild the grid combobox to respond to any changes in the GUI (units, user grid changes,...
void UpdateTrackWidthSelectBox(wxChoice *aTrackWidthSelectBox, bool aEdit=true)
void SetViaSizeIndex(unsigned aIndex)
Function SetViaSizeIndex sets the current via size list index to aIndex.
static TOOL_ACTION highlightNetTool
Definition: pcb_actions.h:407
static TOOL_ACTION measureTool
Definition: actions.h:147
static TOOL_ACTION routerSettingsDialog
Activation of the Push and Shove settings dialogs.
Definition: pcb_actions.h:185
static TOOL_ACTION drawDimension
Definition: pcb_actions.h:143
#define NULL
bool IsContentModified() override
Get if the current board has been modified but not saved.
COLOR_SETTINGS * GetColorSettings() override
Helper to retrieve the current color settings.
bool IsGridVisible() const
void AddToolContextMenu(const TOOL_ACTION &aAction, CONDITIONAL_MENU *aMenu)
Add a context menu to a specific tool item on the toolbar.
static TOOL_ACTION toggleGrid
Definition: actions.h:135
unsigned GetViaSizeIndex() const
Function GetViaSizeIndex.
static TOOL_ACTION open
Definition: actions.h:53
static TOOL_ACTION showFootprintBrowser
Definition: actions.h:154
static TOOL_ACTION save
Definition: actions.h:54
wxChoice * m_zoomSelectBox
static TOOL_ACTION doNew
Definition: actions.h:47
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
void ReCreateVToolbar() override
unsigned GetTrackWidthIndex() const
Function GetTrackWidthIndex.
static TOOL_ACTION togglePolarCoords
Definition: actions.h:142
Helper dialog and control classes.
static TOOL_ACTION showRatsnest
Definition: pcb_actions.h:221
static TOOL_ACTION drawRectangle
Definition: pcb_actions.h:139
ACTION_TOOLBAR * m_microWaveToolBar
The auxiliary right vertical tool bar used to access the microwave tools.
int SetLayerSelection(LAYER_NUM layer)
static TOOL_ACTION microwaveCreateGap
Definition: pcb_actions.h:384
static TOOL_ACTION plot
Definition: actions.h:61
static TOOL_ACTION drawVia
Definition: pcb_actions.h:145
static TOOL_ACTION showEeschema
Definition: pcb_actions.h:413
const BITMAP_OPAQUE auto_track_width_xpm[1]
static TOOL_ACTION routerWalkaroundMode
Definition: pcb_actions.h:191
static TOOL_ACTION placeTarget
Definition: pcb_actions.h:149
static TOOL_ACTION zoneUnfillAll
Definition: pcb_actions.h:288
void SyncToolbars() override
Update the toolbars (mostly settings/check buttons/checkboxes) with the current controller state.
static TOOL_ACTION boardSetup
Definition: pcb_actions.h:295
static TOOL_ACTION microwaveCreateStub
Definition: pcb_actions.h:386
void PrepareLayerIndicator(bool aForceRebuild=false)
bool IsWxPythonLoaded()
static TOOL_ACTION padDisplayMode
Definition: pcb_actions.h:224
static TOOL_ACTION drawCircle
Definition: pcb_actions.h:140
static TOOL_ACTION viaDisplayMode
Definition: pcb_actions.h:225
static TOOL_ACTION metricUnits
Definition: actions.h:140
static TOOL_ACTION redo
Definition: actions.h:68
COLOR4D GetColor(int aLayer) const
static TOOL_ACTION microwaveCreateFunctionShape
Definition: pcb_actions.h:390
static TOOL_ACTION showMicrowaveToolbar
Definition: pcb_actions.h:324
const int scale
TOOL_MANAGER * m_toolManager
Definition: tools_holder.h:48
see class PGM_BASE
bool GetShowPolarCoords() const
For those frames that support polar coordinates.
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
static TOOL_ACTION routeSingleTrack
Activation of the Push and Shove router.
Definition: pcb_actions.h:168
LAYER_TOOLBAR_ICON_VALUES m_prevIconVal
#define _(s)
Definition: 3d_actions.cpp:33
static TOOL_ACTION zoomRedraw
Definition: actions.h:87
void OnUpdateSelectViaSize(wxUpdateUIEvent &aEvent)
void ReCreateOptToolbar() override
void SetToolBitmap(const TOOL_ACTION &aAction, const wxBitmap &aBitmap)
Function SetToolBitmap() Updates the bitmap of a particular tool.
void Toggle(const TOOL_ACTION &aAction, bool aState)
Applies the default toggle action.
static TOOL_ACTION runDRC
Definition: pcb_actions.h:320
PCB_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
std::vector< VIA_DIMENSION > m_ViasDimensionsList
static constexpr int KICAD_AUI_TB_STYLE
Default style flags used for wxAUI toolbars
static TOOL_ACTION deleteTool
Definition: actions.h:75
void OnUpdateSelectTrackWidth(wxUpdateUIEvent &aEvent)
static TOOL_ACTION undo
Definition: actions.h:67
void UpdateViaSizeSelectBox(wxChoice *aViaSizeSelectBox, bool aEdit=true)
static TOOL_ACTION toggleCursorStyle
Definition: actions.h:98
PCB_LAYER_BOX_SELECTOR * m_SelLayerBox
static TOOL_ACTION gridSetOrigin
Definition: actions.h:132
static std::unique_ptr< wxBitmap > LayerPairBitmap
static TOOL_ACTION routerShoveMode
Definition: pcb_actions.h:190
static TOOL_ACTION highContrastMode
Definition: actions.h:99
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()
static TOOL_ACTION showFootprintEditor
Definition: actions.h:155
bool m_fullscreenCursor
Fullscreen crosshair or small cross
static TOOL_ACTION drawZone
Definition: pcb_actions.h:144
void ReCreateAuxiliaryToolbar() override
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
static TOOL_ACTION trackDisplayMode
Definition: pcb_actions.h:223
static TOOL_ACTION selectionTool
Definition: actions.h:146
void ClearToolbar()
Clear the toolbar and remove all associated menus.
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:99
static TOOL_ACTION zoneDisplayEnable
Definition: pcb_actions.h:226
ACTION_TOOLBAR * m_drawToolBar