KiCad PCB EDA Suite
router_tool.cpp
Go to the documentation of this file.
1 /*
2  * KiRouter - a push-and-(sometimes-)shove PCB router
3  *
4  * Copyright (C) 2013-2017 CERN
5  * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors.
6  * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
7  *
8  * This program is free software: you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation, either version 3 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include <wx/numdlg.h>
23 
24 #include <boost/optional.hpp>
25 #include <functional>
26 using namespace std::placeholders;
27 
28 #include "class_draw_panel_gal.h"
29 #include "class_board.h"
30 
31 #include <wxPcbStruct.h>
32 #include <id.h>
33 #include <macros.h>
34 #include <pcbnew_id.h>
35 #include <view/view.h>
36 #include <view/view_controls.h>
37 #include <pcb_painter.h>
41 #include <base_units.h>
42 #include <hotkeys.h>
43 #include <confirm.h>
44 #include <bitmaps.h>
45 
46 #include <tool/context_menu.h>
47 #include <tool/tool_manager.h>
48 #include <tool/tool_settings.h>
49 #include <tool/grid_menu.h>
50 
51 #include <tool/zoom_menu.h>
52 #include <tools/pcb_actions.h>
53 #include <tools/size_menu.h>
54 #include <tools/selection_tool.h>
55 #include <tools/edit_tool.h>
56 #include <tools/tool_event_utils.h>
57 
58 #include "router_tool.h"
59 #include "pns_segment.h"
60 #include "pns_router.h"
61 
62 using namespace KIGFX;
63 using boost::optional;
64 
65 
70 {
71  // Via type
72  VIA_MASK = 0x03,
73  VIA = 0x00,
74  BLIND_VIA = 0x01,
75  MICROVIA = 0x02,
76 
77  // Select layer
79 };
80 
81 
82 TOOL_ACTION PCB_ACTIONS::routerActivateSingle( "pcbnew.InteractiveRouter.SingleTrack",
84  _( "Interactive Router (Single Tracks)" ),
85  _( "Run push & shove router (single tracks)" ), ps_router_xpm, AF_ACTIVATE );
86 
87 TOOL_ACTION PCB_ACTIONS::routerActivateDiffPair( "pcbnew.InteractiveRouter.DiffPair",
88  AS_GLOBAL, '6',
89  _( "Interactive Router (Differential Pairs)" ),
90  _( "Run push & shove router (differential pairs)" ), ps_diff_pair_xpm, AF_ACTIVATE );
91 
92 TOOL_ACTION PCB_ACTIONS::routerActivateSettingsDialog( "pcbnew.InteractiveRouter.SettingsDialog",
93  AS_GLOBAL, 0,
94  _( "Interactive Router Settings" ),
95  _( "Open Interactive Router settings" ), NULL, AF_ACTIVATE );
96 
97 TOOL_ACTION PCB_ACTIONS::routerActivateDpDimensionsDialog( "pcbnew.InteractiveRouter.DpDimensionsDialog",
98  AS_GLOBAL, 0,
99  _( "Differential Pair Dimension settings" ),
100  _( "Open Differential Pair Dimension settings" ), ps_diff_pair_gap_xpm, AF_ACTIVATE );
101 
102 TOOL_ACTION PCB_ACTIONS::routerActivateTuneSingleTrace( "pcbnew.LengthTuner.TuneSingleTrack",
103  AS_GLOBAL, '7',
104  _( "Tune length of a single track" ), "", ps_tune_length_xpm, AF_ACTIVATE );
105 
106 TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPair( "pcbnew.LengthTuner.TuneDiffPair",
107  AS_GLOBAL, '8',
108  _( "Tune length of a differential pair" ), "", NULL, AF_ACTIVATE );
109 
110 TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPairSkew( "pcbnew.LengthTuner.TuneDiffPairSkew",
111  AS_GLOBAL, '9',
112  _( "Tune skew of a differential pair" ), "", NULL, AF_ACTIVATE );
113 
114 TOOL_ACTION PCB_ACTIONS::routerInlineDrag( "pcbnew.InteractiveRouter.InlineDrag",
116  _( "Drag Track/Via" ), _( "Drags tracks and vias without breaking connections" ),
117  drag_track_segment_xpm );
118 
119 static const TOOL_ACTION ACT_NewTrack( "pcbnew.InteractiveRouter.NewTrack", AS_CONTEXT,
121  _( "New Track" ), _( "Starts laying a new track." ), add_tracks_xpm );
122 
123 static const TOOL_ACTION ACT_EndTrack( "pcbnew.InteractiveRouter.EndTrack", AS_CONTEXT, WXK_END,
124  _( "End Track" ), _( "Stops laying the current track." ), checked_ok_xpm );
125 
126 static const TOOL_ACTION ACT_AutoEndRoute( "pcbnew.InteractiveRouter.AutoEndRoute", AS_CONTEXT, 'F',
127  _( "Auto-end Track" ), _( "Automagically finishes currently routed track." ) );
128 
129 static const TOOL_ACTION ACT_PlaceThroughVia( "pcbnew.InteractiveRouter.PlaceVia",
131  _( "Place Through Via" ),
132  _( "Adds a through-hole via at the end of currently routed track." ),
133  via_xpm, AF_NONE,
134  (void*) VIA_ACTION_FLAGS::VIA );
135 
136 static const TOOL_ACTION ACT_PlaceBlindVia( "pcbnew.InteractiveRouter.PlaceBlindVia",
138  _( "Place Blind/Buried Via" ),
139  _( "Adds a blind or buried via at the end of currently routed track."),
140  via_buried_xpm, AF_NONE,
141  (void*) VIA_ACTION_FLAGS::BLIND_VIA );
142 
143 static const TOOL_ACTION ACT_PlaceMicroVia( "pcbnew.InteractiveRouter.PlaceMicroVia",
145  _( "Place Microvia" ), _( "Adds a microvia at the end of currently routed track." ),
146  via_microvia_xpm, AF_NONE,
147  (void*) VIA_ACTION_FLAGS::MICROVIA );
148 
150  "pcbnew.InteractiveRouter.SelLayerAndPlaceVia",
152  _( "Select Layer and Place Through Via" ),
153  _( "Select a layer, then add a through-hole via at the end of currently routed track." ),
154  select_w_layer_xpm, AF_NONE,
156 
158  "pcbnew.InteractiveRouter.SelLayerAndPlaceBlindVia",
160  _( "Select Layer and Place Blind/Buried Via" ),
161  _( "Select a layer, then add a blind or buried via at the end of currently routed track."),
162  select_w_layer_xpm, AF_NONE,
164 
165 static const TOOL_ACTION ACT_CustomTrackWidth( "pcbnew.InteractiveRouter.CustomTrackViaSize",
166  AS_CONTEXT, 'Q',
167  _( "Custom Track/Via Size" ),
168  _( "Shows a dialog for changing the track width and via size." ),
169  width_track_xpm );
170 
171 static const TOOL_ACTION ACT_SwitchPosture( "pcbnew.InteractiveRouter.SwitchPosture", AS_CONTEXT,
173  _( "Switch Track Posture" ),
174  _( "Switches posture of the currently routed track." ),
175  change_entry_orient_xpm );
176 
177 static const TOOL_ACTION ACT_SetDpDimensions( "pcbnew.InteractiveRouter.SetDpDimensions",
178  AS_CONTEXT, 'P',
179  _( "Differential Pair Dimensions..." ),
180  _( "Sets the width and gap of the currently routed differential pair." ),
181  ps_diff_pair_tune_length_xpm );
182 
183 
185  TOOL_BASE( "pcbnew.InteractiveRouter" )
186 {
187 }
188 
189 
191 {
192 public:
193  TRACK_WIDTH_MENU( const BOARD* aBoard )
194  : TRACK_VIA_SIZE_MENU( true, true )
195  {
196  SetTitle( _( "Select Track/Via Width" ) );
197  SetBoard( aBoard );
198  }
199 
200  void SetBoard( const BOARD* aBoard )
201  {
202  m_board = aBoard;
203 
204  Clear();
205 
206  Append( ID_POPUP_PCB_SELECT_CUSTOM_WIDTH, _( "Custom size" ),
207  wxEmptyString, wxITEM_CHECK );
208 
209  Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH, _( "Use the starting track width" ),
210  _( "Route using the width of the starting track." ), wxITEM_CHECK );
211 
212  Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES, _( "Use net class values" ),
213  _( "Use track and via sizes from the net class" ), wxITEM_CHECK );
214 
215  AppendSeparator();
216 
217  // Append the list of tracks & via sizes
218  AppendSizes( aBoard );
219  }
220 
221 protected:
222  CONTEXT_MENU* create() const override
223  {
224  return new TRACK_WIDTH_MENU( m_board );
225  }
226 
227  OPT_TOOL_EVENT eventHandler( const wxMenuEvent& aEvent ) override
228  {
230  int id = aEvent.GetId();
231 
232  // On Windows, this handler can be called with a non existing event ID not existing
233  // in any menuitem.
234  // So we keep trace of in-range/out-of-range event ID
235  bool in_range = true;
236 
237  // Initial settings, to be modified below, but only if the ID exists in this menu
238  bool useConnectedTrackWidth = false;
239  bool useCustomTrackViaSize = false;
240 
242  {
243  useCustomTrackViaSize = true;
244  }
245  else if( id == ID_POPUP_PCB_SELECT_AUTO_WIDTH )
246  {
247  useConnectedTrackWidth = true;
248  }
250  {
251  bds.SetViaSizeIndex( 0 );
252  bds.SetTrackWidthIndex( 0 );
253  }
254  else if( id >= ID_POPUP_PCB_SELECT_VIASIZE1 &&
256  {
257  // via size has changed
259  }
260  else if( id >= ID_POPUP_PCB_SELECT_WIDTH1 &&
262  {
263  // track width has changed
265  }
266  else
267  {
268  in_range = false; // This event ID does not exist in the menu
269  wxASSERT_MSG( false, "OPT_TOOL_EVENT EventHandler: unexpected id" );
270  // Fix me: How to return this error as OPT_TOOL_EVENT?
271  }
272 
273  if( in_range )
274  {
275  // Update this setup only id the event ID matches the options of this menu
276  bds.m_UseConnectedTrackWidth = useConnectedTrackWidth;
277  bds.UseCustomTrackViaSize( useCustomTrackViaSize );
278  }
279 
280  return OPT_TOOL_EVENT( PCB_ACTIONS::trackViaSizeChanged.MakeEvent() );
281  }
282 
283 private:
284  const BOARD* m_board;
285 };
286 
287 
289 {
290 public:
291  ROUTER_TOOL_MENU( const BOARD* aBoard, PCB_EDIT_FRAME& aFrame, PNS::ROUTER_MODE aMode ) :
292  m_board( aBoard ), m_frame( aFrame ), m_mode( aMode ),
293  m_widthMenu( aBoard ), m_zoomMenu( &aFrame ), m_gridMenu( &aFrame )
294  {
295  SetTitle( _( "Interactive Router" ) );
296 
298 
299  AppendSeparator();
300 
301  Add( ACT_NewTrack );
302  Add( ACT_EndTrack );
303 // Add( ACT_AutoEndRoute ); // fixme: not implemented yet. Sorry.
310 
311  AppendSeparator();
312 
313  m_widthMenu.SetBoard( aBoard );
314  Add( &m_widthMenu );
315 
317 
318  if( aMode == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
320 
321  AppendSeparator();
323 
324  AppendSeparator();
325  Add( &m_zoomMenu );
326  Add( &m_gridMenu );
327  }
328 
329 private:
330  CONTEXT_MENU* create() const override
331  {
332  return new ROUTER_TOOL_MENU( m_board, m_frame, m_mode );
333  }
334 
335  const BOARD* m_board;
341 };
342 
343 
345 {
347 }
348 
349 
351 {
352  // Track & via dragging menu entry
353  auto selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
354  CONDITIONAL_MENU& menu = selectionTool->GetToolMenu().GetMenu();
357 
359  return true;
360 }
361 
362 
364 {
365  TOOL_BASE::Reset( aReason );
366 }
367 
368 
369 int ROUTER_TOOL::getDefaultWidth( int aNetCode )
370 {
371  int w, d1, d2;
372 
373  getNetclassDimensions( aNetCode, w, d1, d2 );
374 
375  return w;
376 }
377 
378 
379 void ROUTER_TOOL::getNetclassDimensions( int aNetCode, int& aWidth,
380  int& aViaDiameter, int& aViaDrill )
381 {
383 
384  NETCLASSPTR netClass;
385  NETINFO_ITEM* ni = m_board->FindNet( aNetCode );
386 
387  if( ni )
388  {
389  wxString netClassName = ni->GetClassName();
390  netClass = bds.m_NetClasses.Find( netClassName );
391  }
392 
393  if( !netClass )
394  netClass = bds.GetDefault();
395 
396  aWidth = netClass->GetTrackWidth();
397  aViaDiameter = netClass->GetViaDiameter();
398  aViaDrill = netClass->GetViaDrill();
399 }
400 
401 
403 {
404 #ifdef DEBUG
405  if( aEvent.IsKeyPressed() )
406  {
407  switch( aEvent.KeyCode() )
408  {
409  case '0':
410  wxLogTrace( "PNS", "saving drag/route log...\n" );
411  m_router->DumpLog();
412  break;
413  }
414  }
415 #endif
416 }
417 
418 
420 {
421  int tl = getView()->GetTopLayer();
422 
423  if( m_startItem )
424  {
425  const LAYER_RANGE& ls = m_startItem->Layers();
426 
427  if( ls.Overlaps( tl ) )
428  return tl;
429  else
430  return ls.Start();
431  }
432 
433  return tl;
434 }
435 
436 
438 {
439  int al = m_frame->GetActiveLayer();
440  int cl = m_router->GetCurrentLayer();
441 
442  if( cl != al )
443  {
444  m_router->SwitchLayer( al );
445  }
446 
447  optional<int> newLayer = m_router->Sizes().PairedLayer( cl );
448 
449  if( !newLayer )
450  newLayer = m_router->Sizes().GetLayerTop();
451 
452  m_router->SwitchLayer( *newLayer );
453  m_frame->SetActiveLayer( ToLAYER_ID( *newLayer ) );
454 }
455 
456 
457 static VIATYPE_T getViaTypeFromFlags( int aFlags )
458 {
459  VIATYPE_T viaType = VIA_THROUGH;
460 
461  switch( aFlags & VIA_ACTION_FLAGS::VIA_MASK )
462  {
464  viaType = VIA_THROUGH;
465  break;
467  viaType = VIA_BLIND_BURIED;
468  break;
470  viaType = VIA_MICROVIA;
471  break;
472  default:
473  wxASSERT_MSG( false, "Unhandled via type" );
474  }
475 
476  wxLogDebug("via type %d", viaType );
477 
478  return viaType;
479 }
480 
481 
483 {
484  const int actViaFlags = aEvent.Parameter<intptr_t>();
485 
486  VIATYPE_T viaType = getViaTypeFromFlags( actViaFlags );
487  const bool selectLayer = actViaFlags & VIA_ACTION_FLAGS::SELECT_LAYER;
488 
490 
491  const int layerCount = bds.GetCopperLayerCount();
492  int currentLayer = m_router->GetCurrentLayer();
495 
497 
498  // ask the user for a target layer
499  PCB_LAYER_ID targetLayer = UNDEFINED_LAYER;
500 
501  if( selectLayer )
502  {
503  wxPoint dlgPosition = wxGetMousePosition();
504 
505  targetLayer = m_frame->SelectLayer( static_cast<PCB_LAYER_ID>( currentLayer ),
506  LSET::AllNonCuMask(), dlgPosition );
507  }
508 
509  // fixme: P&S supports more than one fixed layer pair. Update the dialog?
510  sizes.ClearLayerPairs();
511 
512  if( !m_router->IsPlacingVia() )
513  {
514  // Cannot place microvias or blind vias if not allowed (obvious)
515  if( ( viaType == VIA_BLIND_BURIED ) && ( !bds.m_BlindBuriedViaAllowed ) )
516  {
517  DisplayError( m_frame, _( "Blind/buried vias have to be enabled in the design settings." ) );
518  return false;
519  }
520 
521  if( ( viaType == VIA_MICROVIA ) && ( !bds.m_MicroViasAllowed ) )
522  {
523  DisplayError( m_frame, _( "Microvias have to be enabled in the design settings." ) );
524  return false;
525  }
526 
527  // Can only place through vias on 2-layer boards
528  if( ( viaType != VIA_THROUGH ) && ( layerCount <= 2 ) )
529  {
530  DisplayError( m_frame, _( "Only through vias are allowed on 2 layer boards." ) );
531  return false;
532  }
533 
534  // Can only place microvias if we're on an outer layer, or directly adjacent to one
535  if( ( viaType == VIA_MICROVIA ) && ( currentLayer > In1_Cu ) && ( currentLayer < layerCount - 2 ) )
536  {
537  DisplayError( m_frame, _( "Microvias can be placed only between the outer layers " \
538  "(F.Cu/B.Cu) and the ones directly adjacent to them." ) );
539  return false;
540  }
541  }
542 
543  // Convert blind/buried via to a through hole one, if it goes through all layers
544  if( viaType == VIA_BLIND_BURIED && ( ( currentLayer == B_Cu ) || ( currentLayer == F_Cu ) )
545  && ( ( pairTop == B_Cu && pairBottom == F_Cu )
546  || ( pairTop == F_Cu && pairBottom == B_Cu ) ) )
547  {
548  viaType = VIA_THROUGH;
549  }
550 
551  switch( viaType )
552  {
553  case VIA_THROUGH:
554  sizes.SetViaDiameter( bds.GetCurrentViaSize() );
555  sizes.SetViaDrill( bds.GetCurrentViaDrill() );
556 
557  if( targetLayer != UNDEFINED_LAYER )
558  {
559  // go from the current layer to the chosen layer
560  sizes.AddLayerPair( currentLayer, targetLayer );
561  }
562  else
563  {
564  // use the default layer pair
565  sizes.AddLayerPair( pairTop, pairBottom );
566  }
567  break;
568 
569  case VIA_MICROVIA:
570  sizes.SetViaDiameter( bds.GetCurrentMicroViaSize() );
571  sizes.SetViaDrill( bds.GetCurrentMicroViaDrill() );
572 
573  wxASSERT_MSG( !selectLayer, "Unexpected select layer for microvia (microvia layers are implicit)" );
574 
575  if( currentLayer == F_Cu || currentLayer == In1_Cu )
576  {
577  // front-side microvia
578  sizes.AddLayerPair( F_Cu, In1_Cu );
579  }
580  else if( currentLayer == B_Cu || currentLayer == layerCount - 2 )
581  {
582  // back-side microvia
583  sizes.AddLayerPair( B_Cu, layerCount - 2 );
584  }
585  else
586  {
587  wxASSERT_MSG( false, "Invalid layer pair for microvia (must be on or adjacent to an outer layer)" );
588  }
589  break;
590 
591  case VIA_BLIND_BURIED:
592  sizes.SetViaDiameter( bds.GetCurrentViaSize() );
593  sizes.SetViaDrill( bds.GetCurrentViaDrill() );
594 
595  if( targetLayer != UNDEFINED_LAYER )
596  {
597  // go directly to the user specified layer
598  sizes.AddLayerPair( currentLayer, targetLayer );
599  }
600  else
601  {
602  if( currentLayer == pairTop || currentLayer == pairBottom )
603  {
604  // the current layer is on the defined layer pair,
605  // swap to the other side
606  sizes.AddLayerPair( pairTop, pairBottom );
607  }
608  else
609  {
610  // the current layer is not part of the current layer pair,
611  // so fallback and swap to the top layer of the pair by default
612  sizes.AddLayerPair( pairTop, currentLayer );
613  }
614  }
615  break;
616 
617  default:
618  wxASSERT( false );
619  break;
620  }
621 
622  sizes.SetViaType( viaType );
623 
624  m_router->UpdateSizes( sizes );
626 
627  updateEndItem( aEvent );
628 
629  m_router->Move( m_endSnapPoint, m_endItem ); // refresh
630 
631  return 0;
632 }
633 
634 
636 {
637  int routingLayer = getStartLayer( m_startItem );
638 
639  if( !IsCopperLayer( routingLayer ) )
640  {
641  DisplayError( m_frame, _( "Tracks on Copper layers only" ) );
642  return false;
643  }
644 
645  m_frame->SetActiveLayer( ToLAYER_ID( routingLayer ) );
646 
647  // fixme: switch on invisible layer
648 
649  // for some reason I don't understand, GetNetclass() may return null sometimes...
650  if( m_startItem && m_startItem->Net() >= 0 &&
652  {
653  highlightNet( true, m_startItem->Net() );
654  // Update track width and via size shown in main toolbar comboboxes
656  }
657  else
659 
660  m_ctls->ForceCursorPosition( false );
661  m_ctls->SetAutoPan( true );
662 
663  PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
664 
665  sizes.Init( m_board, m_startItem );
666  sizes.AddLayerPair( m_frame->GetScreen()->m_Route_Layer_TOP,
668  m_router->UpdateSizes( sizes );
669 
670  if( !m_router->StartRouting( m_startSnapPoint, m_startItem, routingLayer ) )
671  {
673  highlightNet( false );
674  return false;
675  }
676 
677  m_endItem = NULL;
679 
680  m_frame->UndoRedoBlock( true );
681 
682  return true;
683 }
684 
685 
687 {
689 
690  m_ctls->SetAutoPan( false );
691  m_ctls->ForceCursorPosition( false );
692  m_frame->UndoRedoBlock( false );
693  highlightNet( false );
694 
695  return true;
696 }
697 
698 
700 {
701  if( !prepareInteractive() )
702  return;
703 
704  while( OPT_TOOL_EVENT evt = Wait() )
705  {
706  // Don't crash if we missed an operation that cancelled routing.
707  wxCHECK2( m_router->RoutingInProgress(), break );
708 
709  if( evt->IsMotion() )
710  {
711  m_router->SetOrthoMode( evt->Modifier( MD_CTRL ) );
712  updateEndItem( *evt );
714  }
715  else if( evt->IsClick( BUT_LEFT ) )
716  {
717  updateEndItem( *evt );
718  bool needLayerSwitch = m_router->IsPlacingVia();
719 
721  break;
722 
723  if( needLayerSwitch )
725 
726  // Synchronize the indicated layer
728  updateEndItem( *evt );
730  m_startItem = NULL;
731  }
732  else if( evt->IsAction( &ACT_SwitchPosture ) )
733  {
735  updateEndItem( *evt );
736  m_router->Move( m_endSnapPoint, m_endItem ); // refresh
737  }
738  else if( evt->IsAction( &PCB_ACTIONS::layerChanged ) )
739  {
741  updateEndItem( *evt );
742  m_router->Move( m_endSnapPoint, m_endItem ); // refresh
743  }
744  else if( evt->IsAction( &ACT_EndTrack ) )
745  {
746  bool still_routing = true;
747  while( still_routing )
748  still_routing = m_router->FixRoute( m_endSnapPoint, m_endItem );
749  break;
750  }
751  else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt )
752  || evt->IsUndoRedo()
753  || evt->IsAction( &PCB_ACTIONS::routerInlineDrag ) )
754  break;
755  }
756 
758 }
759 
760 
762 {
763  Activate();
764 
766  DIALOG_PNS_DIFF_PAIR_DIMENSIONS settingsDlg( m_frame, sizes );
767 
768  if( settingsDlg.ShowModal() )
769  {
770  m_router->UpdateSizes( sizes );
771  m_savedSizes = sizes;
772  }
773 
774  return 0;
775 }
776 
777 
779 {
780  Activate();
781 
782  DIALOG_PNS_SETTINGS settingsDlg( m_frame, m_router->Settings() );
783 
784  if( settingsDlg.ShowModal() )
786 
787  return 0;
788 }
789 
790 
792 {
798 
804 
805  // TODO is not this redundant? the same actions can be used for menus and hotkeys
808 
811 }
812 
813 
815 {
816  m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Route Track" ) );
818 }
819 
820 
822 {
823  m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Router Differential Pair" ) );
825 }
826 
827 
829 {
830  PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
831  BOARD* board = getModel<BOARD>();
832 
833  // Deselect all items
835 
836  Activate();
837 
838  m_router->SetMode( aMode );
839 
840  m_ctls->ShowCursor( true );
841 
843 
844  std::unique_ptr<ROUTER_TOOL_MENU> ctxMenu( new ROUTER_TOOL_MENU( board, *frame, aMode ) );
845  SetContextMenu( ctxMenu.get() );
846 
847  // Main loop: keep receiving events
848  while( OPT_TOOL_EVENT evt = Wait() )
849  {
851  {
852  break; // Finish
853  }
854  else if( evt->Action() == TA_UNDO_REDO_PRE )
855  {
856  m_router->ClearWorld();
857  }
858  else if( evt->Action() == TA_UNDO_REDO_POST || evt->Action() == TA_MODEL_CHANGE )
859  {
860  m_router->SyncWorld();
861  }
862  else if( evt->IsMotion() )
863  {
864  updateStartItem( *evt );
865  }
866  else if( evt->IsClick( BUT_LEFT ) || evt->IsAction( &ACT_NewTrack ) )
867  {
868  updateStartItem( *evt );
869 
870  if( evt->Modifier( MD_CTRL ) )
871  performDragging();
872  else
873  performRouting();
874  }
875  else if( evt->IsAction( &ACT_PlaceThroughVia ) )
876  {
878  }
879  else if( evt->IsAction( &PCB_ACTIONS::remove ) )
880  {
881  deleteTraces( m_startItem, true );
882  }
883  else if( evt->IsAction( &PCB_ACTIONS::removeAlt ) )
884  {
885  deleteTraces( m_startItem, false );
886  }
887  }
888 
889  frame->SetNoToolSelected();
890  SetContextMenu( nullptr );
891 
892  // Store routing settings till the next invocation
895 
896  return 0;
897 }
898 
899 
901 {
902  VIEW_CONTROLS* ctls = getViewControls();
903 
904  if( m_startItem && m_startItem->IsLocked() )
905  {
906  if( !IsOK( m_frame, _( "The item is locked. Do you want to continue?" ) ) )
907  return;
908  }
909 
910  bool dragStarted = m_router->StartDragging( m_startSnapPoint, m_startItem );
911 
912  if( !dragStarted )
913  return;
914 
915  if( m_startItem && m_startItem->Net() >= 0 )
916  highlightNet( true, m_startItem->Net() );
917 
918  ctls->SetAutoPan( true );
919 
920  m_frame->UndoRedoBlock( true );
921 
922  while( OPT_TOOL_EVENT evt = Wait() )
923  {
924  ctls->ForceCursorPosition( false );
925 
926  if( evt->IsMotion() )
927  {
928  updateEndItem( *evt );
930  }
931  else if( evt->IsClick( BUT_LEFT ) )
932  {
934  break;
935  }
936  else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt )
937  || evt->IsUndoRedo() )
938  break;
939 
940  handleCommonEvents( *evt );
941  }
942 
943  if( m_router->RoutingInProgress() )
945 
946  m_startItem = NULL;
947 
948  m_frame->UndoRedoBlock( false );
949  ctls->SetAutoPan( false );
950  ctls->ForceCursorPosition( false );
951  highlightNet( false );
952 }
953 
954 
956 {
957  // Get the item under the cursor
959  const auto& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
960 
961  if( selection.Size() != 1 )
962  return 0;
963 
964  const BOARD_CONNECTED_ITEM* item = static_cast<const BOARD_CONNECTED_ITEM*>( selection.Front() );
965 
966  if( item->Type() != PCB_TRACE_T && item->Type() != PCB_VIA_T )
967  return 0;
968 
969  Activate();
970 
972  m_router->SyncWorld();
974 
975  if( m_startItem && m_startItem->IsLocked() )
976  {
977  if( !IsOK( m_frame, _( "The item is locked. Do you want to continue?" ) ) )
978  return false;
979  }
980 
982 
983  bool dragStarted = m_router->StartDragging( p0, m_startItem );
984 
985  if( !dragStarted )
986  return 0;
987 
988  m_ctls->ShowCursor( true );
989  m_ctls->ForceCursorPosition( false );
990  m_ctls->SetAutoPan( true );
991  m_frame->UndoRedoBlock( true );
992 
993  while( OPT_TOOL_EVENT evt = Wait() )
994  {
995  if( evt->IsCancel() )
996  {
997  break;
998  }
999  else if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) )
1000  {
1001  updateEndItem( *evt );
1003  }
1004  else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
1005  {
1006  updateEndItem( *evt );
1008  break;
1009  }
1010  }
1011 
1012  if( m_router->RoutingInProgress() )
1013  m_router->StopRouting();
1014 
1015  m_ctls->SetAutoPan( false );
1016  m_ctls->ShowCursor( false );
1017  m_frame->UndoRedoBlock( false );
1018 
1019  return 0;
1020 }
1021 
1022 
1024 {
1026  DIALOG_TRACK_VIA_SIZE sizeDlg( m_frame, bds );
1027 
1028  if( sizeDlg.ShowModal() )
1029  {
1030  bds.UseCustomTrackViaSize( true );
1032  }
1033 
1034  return 0;
1035 }
1036 
1037 
1039 {
1040  PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
1042  m_router->UpdateSizes( sizes );
1043 
1044  return 0;
1045 }
CONTEXT_MENU * create() const override
Returns an instance of this class. It has to be overridden in inheriting classes. ...
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
int mainLoop(PNS::ROUTER_MODE aMode)
int GetCurrentMicroViaSize()
Function GetCurrentMicroViaSize.
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
ROUTER_TOOL_MENU(const BOARD *aBoard, PCB_EDIT_FRAME &aFrame, PNS::ROUTER_MODE aMode)
Class ITEM.
Definition: pns_item.h:53
static TOOL_ACTION ACT_RouterOptions
Definition: pns_tool_base.h:47
KICAD_T Type() const
Function Type()
Definition: base_struct.h:198
int GetTopLayer() const
Definition: view.cpp:739
void SetTrackWidthIndex(unsigned aIndex)
Function SetTrackWidthIndex sets the current track width list index to aIndex.
int GetCurrentViaDrill() const
Function GetCurrentViaDrill.
virtual void SetToolID(int aId, int aCursor, const wxString &aToolMsg) override
Function SetToolID sets the tool command ID to aId and sets the cursor to aCursor.
Context menu that displays track and/or via sizes basing on the board design settings of a BOARD obje...
Definition: size_menu.h:30
NETCLASSPTR Find(const wxString &aName) const
Function Find searches this container for a NETCLASS given by aName.
NETCLASSPTR GetDefault() const
Function GetDefault.
void SetBoard(const BOARD *aBoard)
static const TOOL_ACTION ACT_SelLayerAndPlaceBlindVia("pcbnew.InteractiveRouter.SelLayerAndPlaceBlindVia", AS_CONTEXT, TOOL_ACTION::LegacyHotKey(HK_SEL_LAYER_AND_ADD_BLIND_BURIED_VIA), _("Select Layer and Place Blind/Buried Via"), _("Select a layer, then add a blind or buried via at the end of currently routed track."), select_w_layer_xpm, AF_NONE,(void *)(VIA_ACTION_FLAGS::BLIND_VIA|VIA_ACTION_FLAGS::SELECT_LAYER))
int DpDimensionsDialog(const TOOL_EVENT &aEvent)
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:58
const LAYER_RANGE & Layers() const
Function Layers()
Definition: pns_item.h:207
TRACK_WIDTH_MENU m_widthMenu
Normal via
Definition: router_tool.cpp:74
bool finishInteractive()
blind/buried via
Definition: router_tool.cpp:75
Implementation of conversion functions that require both schematic and board internal units...
This file is part of the common library.
const wxString & FailureReason() const
Definition: pns_router.h:205
Class CONTEXT_MENU.
Definition: context_menu.h:44
int GetCurrentMicroViaDrill()
Function GetCurrentMicroViaDrill.
VIEW_CONTROLS class definition.
VECTOR2I m_startSnapPoint
Definition: pns_tool_base.h:75
int InlineDrag(const TOOL_EVENT &aEvent)
Class SELECTION_TOOL.
static const TOOL_ACTION ACT_NewTrack("pcbnew.InteractiveRouter.NewTrack", AS_CONTEXT, TOOL_ACTION::LegacyHotKey(HK_ADD_NEW_TRACK), _("New Track"), _("Starts laying a new track."), add_tracks_xpm)
Class BOARD to handle a board.
bool StartDragging(const VECTOR2I &aP, ITEM *aItem)
Definition: pns_router.cpp:127
int RouteSingleTrace(const TOOL_EVENT &aEvent)
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:220
static LSET AllNonCuMask()
Function AllNonCuMask returns a mask holding all layer minus CU layers.
Definition: lset.cpp:662
static TOOL_ACTION cancelInteractive
Definition: actions.h:45
SIZES_SETTINGS m_savedSizes
Stores sizes settings between router invocations.
Definition: pns_tool_base.h:72
void SyncWorld()
Definition: pns_router.cpp:91
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
Microvia
Definition: router_tool.cpp:78
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static int LegacyHotKey(int aHotKey)
Creates a hot key code that refers to a legacy hot key setting, instead of a particular key...
Definition: tool_action.h:174
static const TOOL_ACTION ACT_PlaceBlindVia("pcbnew.InteractiveRouter.PlaceBlindVia", AS_CONTEXT, TOOL_ACTION::LegacyHotKey(HK_ADD_BLIND_BURIED_VIA), _("Place Blind/Buried Via"), _("Adds a blind or buried via at the end of currently routed track."), via_buried_xpm, AF_NONE,(void *) VIA_ACTION_FLAGS::BLIND_VIA)
static TOOL_ACTION removeAlt
Definition: pcb_actions.h:121
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:267
static const TOOL_ACTION ACT_PlaceThroughVia("pcbnew.InteractiveRouter.PlaceVia", AS_CONTEXT, TOOL_ACTION::LegacyHotKey(HK_ADD_THROUGH_VIA), _("Place Through Via"), _("Adds a through-hole via at the end of currently routed track."), via_xpm, AF_NONE,(void *) VIA_ACTION_FLAGS::VIA)
static TOOL_ACTION routerActivateSingle
Activation of the Push and Shove router.
Definition: pcb_actions.h:178
void UndoRedoBlock(bool aBlock=true)
Function UndoRedoBlock Enables/disable undo and redo operations.
const BOARD * m_board
void SetViaDrill(int aDrill)
boost::optional< int > PairedLayer(int aLayerId)
bool IsPlacingVia() const
Definition: pns_router.cpp:459
static SELECTION_CONDITION Count(int aNumber)
Function Count Creates a functor that tests if the number of selected items is equal to the value giv...
SIZES_SETTINGS & Sizes()
Definition: pns_router.h:197
VIATYPE_T
Definition: class_track.h:49
bool IsKeyPressed() const
Definition: tool_event.h:321
int KeyCode() const
Definition: tool_event.h:316
bool SetCurrentNetClass(const wxString &aNetClassName)
Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter ...
Definition: pcbframe.cpp:1112
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
void SwitchLayer(int layer)
Definition: pns_router.cpp:396
int GetCurrentViaSize() const
Function GetCurrentViaSize.
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
static TOOL_ACTION routerActivateTuneSingleTrace
Activation of the Push and Shove router (tune single line mode)
Definition: pcb_actions.h:184
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
bool m_UseConnectedTrackWidth
if true, when creating a new track starting on an existing track, use this track width ...
void SetOrthoMode(bool aEnable)
Definition: pns_router.cpp:468
search types array terminator (End Of Types)
Definition: typeinfo.h:94
NODE * GetWorld() const
Definition: pns_router.h:134
void ToggleViaPlacement()
Definition: pns_router.cpp:409
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:107
void handleCommonEvents(const TOOL_EVENT &evt)
Pcbnew hotkeys.
GRID_MENU m_gridMenu
wxMenuItem * Add(const wxString &aLabel, int aId, const BITMAP_OPAQUE *aIcon=NULL)
Function Add() Adds an entry to the menu.
This file contains miscellaneous commonly used macros and functions.
void ClearWorld()
Definition: pns_router.cpp:100
KIGFX::VIEW_CONTROLS * m_ctls
Definition: pns_tool_base.h:81
boost::optional< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:460
bool RoutingInProgress() const
Definition: pns_router.cpp:112
void SetViaSizeIndex(unsigned aIndex)
Function SetViaSizeIndex sets the current via size list index to aIndex.
int onViaCommand(const TOOL_EVENT &aEvent)
virtual void Reset(RESET_REASON aReason)=0
Function Reset() Brings the tool to a known, initial state.
virtual void AppendSizes(const BOARD *aBoard)
Function AppendSizes() Appends the list of tracks/vias (depending on the parameters passed to the con...
Definition: size_menu.cpp:36
int RouteDiffPair(const TOOL_EVENT &aEvent)
virtual void updateEndItem(const TOOL_EVENT &aEvent)
bool prepareInteractive()
PCB_LAYER_ID
A quick note on layer IDs:
bool IsLocked() const
Definition: pns_item.h:336
int GetCopperLayerCount() const
Function GetCopperLayerCount.
void performRouting()
CONTEXT_MENU * create() const override
Returns an instance of this class. It has to be overridden in inheriting classes. ...
static TOOL_ACTION routerActivateTuneDiffPairSkew
Activation of the Push and Shove router (skew tuning mode)
Definition: pcb_actions.h:190
std::shared_ptr< NETCLASS > GetNetClass() const
Function GetNetClass returns the NETCLASS for this item.
virtual VECTOR2D GetCursorPosition() const =0
Function GetCursorPosition() Returns the current cursor position in world coordinates.
static const char Default[]
the name of the default NETCLASS
static SELECTION_CONDITION OnlyTypes(const std::vector< KICAD_T > &aTypes)
Function OnlyTypes Creates a functor that tests if the selected items are only of given types...
Class TOOL_EVENT.
Definition: tool_event.h:162
PNS::ROUTER_MODE m_mode
ITEM * m_startItem
Definition: pns_tool_base.h:73
OPT_TOOL_EVENT eventHandler(const wxMenuEvent &aEvent) override
Event handler stub.
bool FixRoute(const VECTOR2I &aP, ITEM *aItem)
Definition: pns_router.cpp:334
static const TOOL_ACTION ACT_SwitchPosture("pcbnew.InteractiveRouter.SwitchPosture", AS_CONTEXT, TOOL_ACTION::LegacyHotKey(HK_SWITCH_TRACK_POSTURE), _("Switch Track Posture"), _("Switches posture of the currently routed track."), change_entry_orient_xpm)
ZOOM_MENU m_zoomMenu
void Init(BOARD *aBoard, ITEM *aStartItem=NULL, int aNet=-1)
ROUTER * m_router
Definition: pns_tool_base.h:85
void SetContextMenu(CONTEXT_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
Function SetContextMenu()
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:533
void Load(const TOOL_SETTINGS &where)
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
Definition: view_controls.h:94
PCB_LAYER_ID m_Route_Layer_BOTTOM
void switchLayerOnViaPlacement()
PCB_EDIT_FRAME & m_frame
void getNetclassDimensions(int aNetCode, int &aWidth, int &aViaDiameter, int &aViaDrill)
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
static TOOL_ACTION routerActivateTuneDiffPair
Activation of the Push and Shove router (diff pair tuning mode)
Definition: pcb_actions.h:187
bool m_BlindBuriedViaAllowed
true to allow blind/buried vias
const BOARD * m_board
void Clear()
Function Clear() Removes all the entries from the menu (as well as its title).
ROUTING_SETTINGS m_savedSettings
Stores routing settings between router invocations.
Definition: pns_tool_base.h:71
int SettingsDialog(const TOOL_EVENT &aEvent)
int CustomTrackWidthDialog(const TOOL_EVENT &aEvent)
void ImportCurrent(BOARD_DESIGN_SETTINGS &aSettings)
int Start() const
Definition: pns_layerset.h:83
static const TOOL_ACTION ACT_PlaceMicroVia("pcbnew.InteractiveRouter.PlaceMicroVia", AS_CONTEXT, TOOL_ACTION::LegacyHotKey(HK_ADD_MICROVIA), _("Place Microvia"), _("Adds a microvia at the end of currently routed track."), via_microvia_xpm, AF_NONE,(void *) VIA_ACTION_FLAGS::MICROVIA)
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
All active tools
Definition: tool_event.h:138
void Move(const VECTOR2I &aP, ITEM *aItem)
Definition: pns_router.cpp:195
void performDragging()
TOOL_SETTINGS & GetSettings()
Definition: tool_base.cpp:72
int onTrackViaSizeChanged(const TOOL_EVENT &aEvent)
static TOOL_ACTION routerInlineDrag
Activation of the Push and Shove router (inline dragging mode)
Definition: pcb_actions.h:198
bool StartRouting(const VECTOR2I &aP, ITEM *aItem, int aLayer)
Definition: pns_router.cpp:149
bool Overlaps(const LAYER_RANGE &aOther) const
Definition: pns_layerset.h:68
void SetTransitions() override
Function SetTransitions() This method is meant to be overridden in order to specify handlers for even...
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg...
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:36
TRACK_WIDTH_MENU(const BOARD *aBoard)
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:30
void StopRouting()
Definition: pns_router.cpp:359
virtual void highlightNet(bool aEnabled, int aNetcode=-1)
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
Definition: draw_frame.cpp:560
ROUTER_MODE
Definition: pns_router.h:64
Class NETINFO_ITEM handles the data for a net.
Definition: class_netinfo.h:69
void SetViaType(VIATYPE_T aViaType)
static TOOL_ACTION layerChanged
Definition: pcb_actions.h:259
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:373
TOOL_EVENT MakeEvent() const
Function HasHotKey() Checks if the action has a hot key assigned.
Definition: tool_action.h:104
void UpdateSizes(const SIZES_SETTINGS &aSizes)
Applies stored settings.
Definition: pns_router.cpp:278
const wxString & GetClassName() const
Function GetClassName returns the class name.
void SetMode(ROUTER_MODE aMode)
Definition: pns_router.cpp:477
int getDefaultWidth(int aNetCode)
static TOOL_ACTION routerActivateSettingsDialog
Activation of the Push and Shove settings dialogs.
Definition: pcb_actions.h:193
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Function AddItem()
VECTOR2I m_endSnapPoint
Definition: pns_tool_base.h:78
void deleteTraces(ITEM *aStartItem, bool aWholeTrack)
Class TOOL_BASE.
Definition: tool_base.h:68
void SetTitle(const wxString &aTitle) override
Function SetTitle() Sets title for the context menu.
Class TOOL_ACTION.
Definition: tool_action.h:46
static const TOOL_ACTION ACT_SetDpDimensions("pcbnew.InteractiveRouter.SetDpDimensions", AS_CONTEXT, 'P', _("Differential Pair Dimensions..."), _("Sets the width and gap of the currently routed differential pair."), ps_diff_pair_tune_length_xpm)
PCB_EDIT_FRAME * m_frame
Definition: pns_tool_base.h:80
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
int Net() const
Function Net()
Definition: pns_item.h:177
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
ITEM * FindItemByParent(const BOARD_CONNECTED_ITEM *aParent)
Definition: pns_node.cpp:1330
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:80
static const TOOL_ACTION ACT_CustomTrackWidth("pcbnew.InteractiveRouter.CustomTrackViaSize", AS_CONTEXT, 'Q', _("Custom Track/Via Size"), _("Shows a dialog for changing the track width and via size."), width_track_xpm)
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
void Activate()
Function Activate() Runs the tool.
Implementing DIALOG_TRACK_VIA_SIZE_BASE.
int GetCurrentLayer() const
Definition: pns_router.cpp:428
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:108
void AddLayerPair(int aL1, int aL2)
static const TOOL_ACTION ACT_EndTrack("pcbnew.InteractiveRouter.EndTrack", AS_CONTEXT, WXK_END, _("End Track"), _("Stops laying the current track."), checked_ok_xpm)
void DumpLog()
Definition: pns_router.cpp:436
static VIATYPE_T getViaTypeFromFlags(int aFlags)
void Save(TOOL_SETTINGS &where) const
bool m_MicroViasAllowed
true to allow micro vias
static const TOOL_ACTION ACT_AutoEndRoute("pcbnew.InteractiveRouter.AutoEndRoute", AS_CONTEXT, 'F', _("Auto-end Track"), _("Automagically finishes currently routed track."))
void FlipPosture()
Definition: pns_router.cpp:387
static TOOL_ACTION remove
Deleting a BOARD_ITEM.
Definition: pcb_actions.h:120
void SetViaDiameter(int aDiameter)
int getStartLayer(const PNS::ITEM *aItem)
static TOOL_ACTION routerActivateDiffPair
Activation of the Push and Shove router (differential pair mode)
Definition: pcb_actions.h:181
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:69
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:111
PCB_LAYER_ID SelectLayer(PCB_LAYER_ID aDefaultLayer, LSET aNotAllowedLayersMask=LSET(), wxPoint aDlgPosition=wxDefaultPosition)
Install the dialog box for layer selection.
Definition: sel_layer.cpp:220
virtual void SetActiveLayer(PCB_LAYER_ID aLayer) override
Function SetActiveLayer will change the currently active layer to aLayer and also update the PCB_LAYE...
Definition: pcbframe.cpp:882
ROUTING_SETTINGS & Settings()
Definition: pns_router.h:178
static const TOOL_ACTION ACT_SelLayerAndPlaceThroughVia("pcbnew.InteractiveRouter.SelLayerAndPlaceVia", AS_CONTEXT, TOOL_ACTION::LegacyHotKey(HK_SEL_LAYER_AND_ADD_THROUGH_VIA), _("Select Layer and Place Through Via"), _("Select a layer, then add a through-hole via at the end of currently routed track."), select_w_layer_xpm, AF_NONE,(void *)(VIA_ACTION_FLAGS::VIA|VIA_ACTION_FLAGS::SELECT_LAYER))
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:767
VIA_ACTION_FLAGS
Flags used by via tool actions.
Definition: router_tool.cpp:69
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
Definition: pcb_actions.h:50
BOARD_CONNECTED_ITEM * Parent() const
Function Parent()
Definition: pns_item.h:157
Class LAYER_RANGE.
Definition: pns_layerset.h:32
PCB_LAYER_ID m_Route_Layer_TOP
void UseCustomTrackViaSize(bool aEnabled)
Function UseCustomTrackViaSize Enables/disables custom track/via size settings.
NETCLASSES m_NetClasses
List of current netclasses. There is always the default netclass.
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
static TOOL_ACTION layerToggle
Definition: pcb_actions.h:257
static TOOL_ACTION routerActivateDpDimensionsDialog
Definition: pcb_actions.h:194
virtual void updateStartItem(TOOL_EVENT &aEvent)