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 <core/optional.h>
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 
68 {
69  // Via type
70  VIA_MASK = 0x03,
71  VIA = 0x00,
72  BLIND_VIA = 0x01,
73  MICROVIA = 0x02,
74 
75  // Select layer
77 };
78 
79 
80 TOOL_ACTION PCB_ACTIONS::routerActivateSingle( "pcbnew.InteractiveRouter.SingleTrack",
82  _( "Interactive Router (Single Tracks)" ),
83  _( "Run push & shove router (single tracks)" ), ps_router_xpm, AF_ACTIVATE );
84 
85 TOOL_ACTION PCB_ACTIONS::routerActivateDiffPair( "pcbnew.InteractiveRouter.DiffPair",
86  AS_GLOBAL, '6',
87  _( "Interactive Router (Differential Pairs)" ),
88  _( "Run push & shove router (differential pairs)" ), ps_diff_pair_xpm, AF_ACTIVATE );
89 
90 TOOL_ACTION PCB_ACTIONS::routerActivateSettingsDialog( "pcbnew.InteractiveRouter.SettingsDialog",
91  AS_GLOBAL, 0,
92  _( "Interactive Router Settings" ),
93  _( "Open Interactive Router settings" ), NULL, AF_ACTIVATE );
94 
95 TOOL_ACTION PCB_ACTIONS::routerActivateDpDimensionsDialog( "pcbnew.InteractiveRouter.DpDimensionsDialog",
96  AS_GLOBAL, 0,
97  _( "Differential Pair Dimension settings" ),
98  _( "Open Differential Pair Dimension settings" ), ps_diff_pair_gap_xpm, AF_ACTIVATE );
99 
100 TOOL_ACTION PCB_ACTIONS::routerActivateTuneSingleTrace( "pcbnew.LengthTuner.TuneSingleTrack",
101  AS_GLOBAL, '7',
102  _( "Tune length of a single track" ), "", ps_tune_length_xpm, AF_ACTIVATE );
103 
104 TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPair( "pcbnew.LengthTuner.TuneDiffPair",
105  AS_GLOBAL, '8',
106  _( "Tune length of a differential pair" ), "", NULL, AF_ACTIVATE );
107 
108 TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPairSkew( "pcbnew.LengthTuner.TuneDiffPairSkew",
109  AS_GLOBAL, '9',
110  _( "Tune skew of a differential pair" ), "", NULL, AF_ACTIVATE );
111 
112 TOOL_ACTION PCB_ACTIONS::routerInlineDrag( "pcbnew.InteractiveRouter.InlineDrag",
113  AS_CONTEXT, 0,
114  _( "Drag Track/Via" ), _( "Drags tracks and vias without breaking connections" ),
115  drag_xpm );
116 
117 TOOL_ACTION PCB_ACTIONS::breakTrack( "pcbnew.InteractiveRouter.BreakTrack",
118  AS_GLOBAL, 0,
119  _( "Break Track" ),
120  _( "Splits the track segment into two segments connected at the cursor position." ),
121  break_line_xpm );
122 
123 TOOL_ACTION PCB_ACTIONS::drag45Degree( "pcbnew.InteractiveRouter.Drag45Degree",
125  _( "Drag (45 degree mode)" ),
126  _( "todo" ),
127  drag_segment_withslope_xpm );
128 
129 TOOL_ACTION PCB_ACTIONS::dragFreeAngle( "pcbnew.InteractiveRouter.DragFreeAngle",
131  _( "Drag (free angle)" ),
132  _( "todo" ),
133  move_xpm );
134 
135 static const TOOL_ACTION ACT_NewTrack( "pcbnew.InteractiveRouter.NewTrack", AS_CONTEXT,
137  _( "New Track" ), _( "Starts laying a new track." ), add_tracks_xpm );
138 
139 static const TOOL_ACTION ACT_EndTrack( "pcbnew.InteractiveRouter.EndTrack", AS_CONTEXT, WXK_END,
140  _( "End Track" ), _( "Stops laying the current track." ), checked_ok_xpm );
141 
142 static const TOOL_ACTION ACT_AutoEndRoute( "pcbnew.InteractiveRouter.AutoEndRoute", AS_CONTEXT, 'F',
143  _( "Auto-end Track" ), _( "Automagically finishes currently routed track." ) );
144 
145 static const TOOL_ACTION ACT_PlaceThroughVia( "pcbnew.InteractiveRouter.PlaceVia",
147  _( "Place Through Via" ),
148  _( "Adds a through-hole via at the end of currently routed track." ),
149  via_xpm, AF_NONE,
150  (void*) VIA_ACTION_FLAGS::VIA );
151 
152 static const TOOL_ACTION ACT_PlaceBlindVia( "pcbnew.InteractiveRouter.PlaceBlindVia",
154  _( "Place Blind/Buried Via" ),
155  _( "Adds a blind or buried via at the end of currently routed track."),
156  via_buried_xpm, AF_NONE,
157  (void*) VIA_ACTION_FLAGS::BLIND_VIA );
158 
159 static const TOOL_ACTION ACT_PlaceMicroVia( "pcbnew.InteractiveRouter.PlaceMicroVia",
161  _( "Place Microvia" ), _( "Adds a microvia at the end of currently routed track." ),
162  via_microvia_xpm, AF_NONE,
163  (void*) VIA_ACTION_FLAGS::MICROVIA );
164 
166  "pcbnew.InteractiveRouter.SelLayerAndPlaceVia",
168  _( "Select Layer and Place Through Via" ),
169  _( "Select a layer, then add a through-hole via at the end of currently routed track." ),
170  select_w_layer_xpm, AF_NONE,
172 
174  "pcbnew.InteractiveRouter.SelLayerAndPlaceBlindVia",
176  _( "Select Layer and Place Blind/Buried Via" ),
177  _( "Select a layer, then add a blind or buried via at the end of currently routed track."),
178  select_w_layer_xpm, AF_NONE,
180 
181 static const TOOL_ACTION ACT_CustomTrackWidth( "pcbnew.InteractiveRouter.CustomTrackViaSize",
183  _( "Custom Track/Via Size" ),
184  _( "Shows a dialog for changing the track width and via size." ),
185  width_track_xpm );
186 
187 static const TOOL_ACTION ACT_SwitchPosture( "pcbnew.InteractiveRouter.SwitchPosture", AS_CONTEXT,
189  _( "Switch Track Posture" ),
190  _( "Switches posture of the currently routed track." ),
191  change_entry_orient_xpm );
192 
193 static const TOOL_ACTION ACT_SetDpDimensions( "pcbnew.InteractiveRouter.SetDpDimensions",
195  _( "Differential Pair Dimensions..." ),
196  _( "Sets the width and gap of the currently routed differential pair." ),
197  ps_diff_pair_tune_length_xpm );
198 
200  TOOL_BASE( "pcbnew.InteractiveRouter" )
201 {
202 }
203 
204 
206 {
207 public:
208  TRACK_WIDTH_MENU( const BOARD* aBoard )
209  : TRACK_VIA_SIZE_MENU( true, true )
210  {
211  SetTitle( _( "Select Track/Via Width" ) );
212  SetBoard( aBoard );
213  }
214 
215  void SetBoard( const BOARD* aBoard )
216  {
217  m_board = aBoard;
218 
219  Clear();
220 
221  Append( ID_POPUP_PCB_SELECT_CUSTOM_WIDTH, _( "Custom size" ),
222  wxEmptyString, wxITEM_CHECK );
223 
224  Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH, _( "Use the starting track width" ),
225  _( "Route using the width of the starting track." ), wxITEM_CHECK );
226 
227  Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES, _( "Use net class values" ),
228  _( "Use track and via sizes from the net class" ), wxITEM_CHECK );
229 
230  AppendSeparator();
231 
232  // Append the list of tracks & via sizes
233  AppendSizes( aBoard );
234  }
235 
236 protected:
237  CONTEXT_MENU* create() const override
238  {
239  return new TRACK_WIDTH_MENU( m_board );
240  }
241 
242  OPT_TOOL_EVENT eventHandler( const wxMenuEvent& aEvent ) override
243  {
245  int id = aEvent.GetId();
246 
247  // On Windows, this handler can be called with a non existing event ID not existing
248  // in any menuitem.
249  // So we keep trace of in-range/out-of-range event ID
250  bool in_range = true;
251 
252  // Initial settings, to be modified below, but only if the ID exists in this menu
253  bool useConnectedTrackWidth = false;
254  bool useCustomTrackViaSize = false;
255 
257  {
258  useCustomTrackViaSize = true;
259  }
260  else if( id == ID_POPUP_PCB_SELECT_AUTO_WIDTH )
261  {
262  useConnectedTrackWidth = true;
263  }
265  {
266  bds.SetViaSizeIndex( 0 );
267  bds.SetTrackWidthIndex( 0 );
268  }
269  else if( id >= ID_POPUP_PCB_SELECT_VIASIZE1 &&
271  {
272  // via size has changed
274  }
275  else if( id >= ID_POPUP_PCB_SELECT_WIDTH1 &&
277  {
278  // track width has changed
280  }
281  else
282  {
283  in_range = false; // This event ID does not exist in the menu
284  wxASSERT_MSG( false, "OPT_TOOL_EVENT EventHandler: unexpected id" );
285  // Fix me: How to return this error as OPT_TOOL_EVENT?
286  }
287 
288  if( in_range )
289  {
290  // Update this setup only id the event ID matches the options of this menu
291  bds.m_UseConnectedTrackWidth = useConnectedTrackWidth;
292  bds.UseCustomTrackViaSize( useCustomTrackViaSize );
293  }
294 
295  return OPT_TOOL_EVENT( PCB_ACTIONS::trackViaSizeChanged.MakeEvent() );
296  }
297 
298 private:
299  const BOARD* m_board;
300 };
301 
302 
304 {
305 public:
306  ROUTER_TOOL_MENU( const BOARD* aBoard, PCB_EDIT_FRAME& aFrame, PNS::ROUTER_MODE aMode ) :
307  m_board( aBoard ), m_frame( aFrame ), m_mode( aMode ),
308  m_widthMenu( aBoard ), m_zoomMenu( &aFrame ), m_gridMenu( &aFrame )
309  {
310  SetTitle( _( "Interactive Router" ) );
311 
313 
314  AppendSeparator();
315 
316  Add( ACT_NewTrack );
317  Add( ACT_EndTrack );
319 
322 
323 // Add( ACT_AutoEndRoute ); // fixme: not implemented yet. Sorry.
330 
331  AppendSeparator();
332 
333  m_widthMenu.SetBoard( aBoard );
334  Add( &m_widthMenu );
335 
337 
338  if( aMode == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
340 
341  AppendSeparator();
343 
344  AppendSeparator();
345  Add( &m_zoomMenu );
346  Add( &m_gridMenu );
347  }
348 
349 private:
350  CONTEXT_MENU* create() const override
351  {
352  return new ROUTER_TOOL_MENU( m_board, m_frame, m_mode );
353  }
354 
355  const BOARD* m_board;
361 };
362 
363 
365 {
367 }
368 
369 
371 {
373  return true;
374 }
375 
376 
378 {
379  TOOL_BASE::Reset( aReason );
380 }
381 
382 
383 int ROUTER_TOOL::getDefaultWidth( int aNetCode )
384 {
385  int w, d1, d2;
386 
387  getNetclassDimensions( aNetCode, w, d1, d2 );
388 
389  return w;
390 }
391 
392 
393 void ROUTER_TOOL::getNetclassDimensions( int aNetCode, int& aWidth,
394  int& aViaDiameter, int& aViaDrill )
395 {
397 
398  NETCLASSPTR netClass;
399  NETINFO_ITEM* ni = board()->FindNet( aNetCode );
400 
401  if( ni )
402  {
403  wxString netClassName = ni->GetClassName();
404  netClass = bds.m_NetClasses.Find( netClassName );
405  }
406 
407  if( !netClass )
408  netClass = bds.GetDefault();
409 
410  aWidth = netClass->GetTrackWidth();
411  aViaDiameter = netClass->GetViaDiameter();
412  aViaDrill = netClass->GetViaDrill();
413 }
414 
415 
417 {
418 #ifdef DEBUG
419  if( aEvent.IsKeyPressed() )
420  {
421  switch( aEvent.KeyCode() )
422  {
423  case '0':
424  wxLogTrace( "PNS", "saving drag/route log...\n" );
425  m_router->DumpLog();
426  break;
427  }
428  }
429 #endif
430 }
431 
432 
434 {
435  int tl = getView()->GetTopLayer();
436 
437  if( m_startItem )
438  {
439  const LAYER_RANGE& ls = m_startItem->Layers();
440 
441  if( ls.Overlaps( tl ) )
442  return tl;
443  else
444  return ls.Start();
445  }
446 
447  return tl;
448 }
449 
450 
452 {
453  int al = frame()->GetActiveLayer();
454  int cl = m_router->GetCurrentLayer();
455 
456  if( cl != al )
457  {
458  m_router->SwitchLayer( al );
459  }
460 
461  OPT<int> newLayer = m_router->Sizes().PairedLayer( cl );
462 
463  if( !newLayer )
464  newLayer = m_router->Sizes().GetLayerTop();
465 
466  m_router->SwitchLayer( *newLayer );
467  frame()->SetActiveLayer( ToLAYER_ID( *newLayer ) );
468 }
469 
470 
471 static VIATYPE_T getViaTypeFromFlags( int aFlags )
472 {
473  VIATYPE_T viaType = VIA_THROUGH;
474 
475  switch( aFlags & VIA_ACTION_FLAGS::VIA_MASK )
476  {
478  viaType = VIA_THROUGH;
479  break;
481  viaType = VIA_BLIND_BURIED;
482  break;
484  viaType = VIA_MICROVIA;
485  break;
486  default:
487  wxASSERT_MSG( false, "Unhandled via type" );
488  }
489 
490  wxLogDebug("via type %d", viaType );
491 
492  return viaType;
493 }
494 
495 
497 {
498  const int actViaFlags = aEvent.Parameter<intptr_t>();
499 
500  VIATYPE_T viaType = getViaTypeFromFlags( actViaFlags );
501  const bool selectLayer = actViaFlags & VIA_ACTION_FLAGS::SELECT_LAYER;
502 
504 
505  const int layerCount = bds.GetCopperLayerCount();
506  int currentLayer = m_router->GetCurrentLayer();
509 
511 
512  // ask the user for a target layer
513  PCB_LAYER_ID targetLayer = UNDEFINED_LAYER;
514 
515  if( selectLayer )
516  {
517  wxPoint dlgPosition = wxGetMousePosition();
518 
519  targetLayer = frame()->SelectLayer( static_cast<PCB_LAYER_ID>( currentLayer ),
520  LSET::AllNonCuMask(), dlgPosition );
521  }
522 
523  // fixme: P&S supports more than one fixed layer pair. Update the dialog?
524  sizes.ClearLayerPairs();
525 
526  if( !m_router->IsPlacingVia() )
527  {
528  // Cannot place microvias or blind vias if not allowed (obvious)
529  if( ( viaType == VIA_BLIND_BURIED ) && ( !bds.m_BlindBuriedViaAllowed ) )
530  {
531  DisplayError( frame(), _( "Blind/buried vias have to be enabled in the design settings." ) );
532  return false;
533  }
534 
535  if( ( viaType == VIA_MICROVIA ) && ( !bds.m_MicroViasAllowed ) )
536  {
537  DisplayError( frame(), _( "Microvias have to be enabled in the design settings." ) );
538  return false;
539  }
540 
541  // Can only place through vias on 2-layer boards
542  if( ( viaType != VIA_THROUGH ) && ( layerCount <= 2 ) )
543  {
544  DisplayError( frame(), _( "Only through vias are allowed on 2 layer boards." ) );
545  return false;
546  }
547 
548  // Can only place microvias if we're on an outer layer, or directly adjacent to one
549  if( ( viaType == VIA_MICROVIA ) && ( currentLayer > In1_Cu ) && ( currentLayer < layerCount - 2 ) )
550  {
551  DisplayError( frame(), _( "Microvias can be placed only between the outer layers " \
552  "(F.Cu/B.Cu) and the ones directly adjacent to them." ) );
553  return false;
554  }
555  }
556 
557  // Convert blind/buried via to a through hole one, if it goes through all layers
558  if( viaType == VIA_BLIND_BURIED && ( ( currentLayer == B_Cu ) || ( currentLayer == F_Cu ) )
559  && ( ( pairTop == B_Cu && pairBottom == F_Cu )
560  || ( pairTop == F_Cu && pairBottom == B_Cu ) ) )
561  {
562  viaType = VIA_THROUGH;
563  }
564 
565  switch( viaType )
566  {
567  case VIA_THROUGH:
568  sizes.SetViaDiameter( bds.GetCurrentViaSize() );
569  sizes.SetViaDrill( bds.GetCurrentViaDrill() );
570 
571  if( targetLayer != UNDEFINED_LAYER )
572  {
573  // go from the current layer to the chosen layer
574  sizes.AddLayerPair( currentLayer, targetLayer );
575  }
576  else
577  {
578  // use the default layer pair
579  sizes.AddLayerPair( pairTop, pairBottom );
580  }
581  break;
582 
583  case VIA_MICROVIA:
584  sizes.SetViaDiameter( bds.GetCurrentMicroViaSize() );
585  sizes.SetViaDrill( bds.GetCurrentMicroViaDrill() );
586 
587  wxASSERT_MSG( !selectLayer, "Unexpected select layer for microvia (microvia layers are implicit)" );
588 
589  if( currentLayer == F_Cu || currentLayer == In1_Cu )
590  {
591  // front-side microvia
592  sizes.AddLayerPair( F_Cu, In1_Cu );
593  }
594  else if( currentLayer == B_Cu || currentLayer == layerCount - 2 )
595  {
596  // back-side microvia
597  sizes.AddLayerPair( B_Cu, layerCount - 2 );
598  }
599  else
600  {
601  wxASSERT_MSG( false, "Invalid layer pair for microvia (must be on or adjacent to an outer layer)" );
602  }
603  break;
604 
605  case VIA_BLIND_BURIED:
606  sizes.SetViaDiameter( bds.GetCurrentViaSize() );
607  sizes.SetViaDrill( bds.GetCurrentViaDrill() );
608 
609  if( targetLayer != UNDEFINED_LAYER )
610  {
611  // go directly to the user specified layer
612  sizes.AddLayerPair( currentLayer, targetLayer );
613  }
614  else
615  {
616  if( currentLayer == pairTop || currentLayer == pairBottom )
617  {
618  // the current layer is on the defined layer pair,
619  // swap to the other side
620  sizes.AddLayerPair( pairTop, pairBottom );
621  }
622  else
623  {
624  // the current layer is not part of the current layer pair,
625  // so fallback and swap to the top layer of the pair by default
626  sizes.AddLayerPair( pairTop, currentLayer );
627  }
628  }
629  break;
630 
631  default:
632  wxASSERT( false );
633  break;
634  }
635 
636  sizes.SetViaType( viaType );
637 
638  m_router->UpdateSizes( sizes );
640 
641  updateEndItem( aEvent );
642 
643  m_router->Move( m_endSnapPoint, m_endItem ); // refresh
644 
645  return 0;
646 }
647 
648 
650 {
651  int routingLayer = getStartLayer( m_startItem );
652 
653  if( !IsCopperLayer( routingLayer ) )
654  {
655  DisplayError( frame(), _( "Tracks on Copper layers only" ) );
656  return false;
657  }
658 
659  frame()->SetActiveLayer( ToLAYER_ID( routingLayer ) );
660 
661  // fixme: switch on invisible layer
662 
663  // for some reason I don't understand, GetNetclass() may return null sometimes...
664  if( m_startItem && m_startItem->Net() >= 0 &&
666  {
667  highlightNet( true, m_startItem->Net() );
668  // Update track width and via size shown in main toolbar comboboxes
669  frame()->SetCurrentNetClass( m_startItem->Parent()->GetNetClass()->GetName() );
670  }
671  else
673 
674  controls()->ForceCursorPosition( false );
675  controls()->SetAutoPan( true );
676 
677  PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
678 
679  sizes.Init( board(), m_startItem );
680  sizes.AddLayerPair( frame()->GetScreen()->m_Route_Layer_TOP,
681  frame()->GetScreen()->m_Route_Layer_BOTTOM );
682  m_router->UpdateSizes( sizes );
683 
684  if( !m_router->StartRouting( m_startSnapPoint, m_startItem, routingLayer ) )
685  {
687  highlightNet( false );
688  return false;
689  }
690 
691  m_endItem = NULL;
693 
694  frame()->UndoRedoBlock( true );
695 
696  return true;
697 }
698 
699 
701 {
703 
704  controls()->SetAutoPan( false );
705  controls()->ForceCursorPosition( false );
706  frame()->UndoRedoBlock( false );
707  highlightNet( false );
708 
709  return true;
710 }
711 
712 
714 {
715  if( !prepareInteractive() )
716  return;
717 
718  while( OPT_TOOL_EVENT evt = Wait() )
719  {
720  // Don't crash if we missed an operation that cancelled routing.
721  wxCHECK2( m_router->RoutingInProgress(), break );
722 
723  if( evt->IsMotion() )
724  {
725  m_router->SetOrthoMode( evt->Modifier( MD_CTRL ) );
726  updateEndItem( *evt );
728  }
729  else if( evt->IsClick( BUT_LEFT ) )
730  {
731  updateEndItem( *evt );
732  bool needLayerSwitch = m_router->IsPlacingVia();
733 
735  break;
736 
737  if( needLayerSwitch )
739 
740  // Synchronize the indicated layer
742  updateEndItem( *evt );
744  m_startItem = NULL;
745  }
746  else if( evt->IsAction( &ACT_SwitchPosture ) )
747  {
749  updateEndItem( *evt );
750  m_router->Move( m_endSnapPoint, m_endItem ); // refresh
751  }
752  else if( evt->IsAction( &PCB_ACTIONS::layerChanged ) )
753  {
754  m_router->SwitchLayer( frame()->GetActiveLayer() );
755  updateEndItem( *evt );
756  m_router->Move( m_endSnapPoint, m_endItem ); // refresh
757  }
758  else if( evt->IsAction( &ACT_EndTrack ) )
759  {
760  bool still_routing = true;
761  while( still_routing )
762  still_routing = m_router->FixRoute( m_endSnapPoint, m_endItem );
763  break;
764  }
765  else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt )
766  || evt->IsUndoRedo()
767  || evt->IsAction( &PCB_ACTIONS::routerInlineDrag ) )
768  break;
769  }
770 
772 }
773 
774 
776 {
777  Activate();
778 
780  DIALOG_PNS_DIFF_PAIR_DIMENSIONS settingsDlg( frame(), sizes );
781 
782  if( settingsDlg.ShowModal() )
783  {
784  m_router->UpdateSizes( sizes );
785  m_savedSizes = sizes;
786  }
787 
788  return 0;
789 }
790 
791 
793 {
794  Activate();
795 
796  DIALOG_PNS_SETTINGS settingsDlg( frame(), m_router->Settings() );
797 
798  if( settingsDlg.ShowModal() )
799  {
801  }
802 
803  return 0;
804 }
805 
806 
808 {
814 
820 
821  // TODO is not this redundant? the same actions can be used for menus and hotkeys
824 
827 }
828 
829 
831 {
832  frame()->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Route Track" ) );
834 }
835 
836 
838 {
839  frame()->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Router Differential Pair" ) );
841 }
842 
844 {
846  {
848  }
849 }
850 
852 {
853  PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
854  BOARD* board = getModel<BOARD>();
855 
856  // Deselect all items
858 
859  Activate();
860 
861  m_router->SetMode( aMode );
862 
863  controls()->ShowCursor( true );
864 
866 
867  std::unique_ptr<ROUTER_TOOL_MENU> ctxMenu( new ROUTER_TOOL_MENU( board, *frame, aMode ) );
868  SetContextMenu( ctxMenu.get() );
869 
870  // Main loop: keep receiving events
871  while( OPT_TOOL_EVENT evt = Wait() )
872  {
874  {
875  break; // Finish
876  }
877  else if( evt->Action() == TA_UNDO_REDO_PRE )
878  {
879  m_router->ClearWorld();
880  }
881  else if( evt->Action() == TA_UNDO_REDO_POST || evt->Action() == TA_MODEL_CHANGE )
882  {
883  m_router->SyncWorld();
884  }
885  else if( evt->IsMotion() )
886  {
887  updateStartItem( *evt );
888  }
889  else if( evt->IsAction( &PCB_ACTIONS::dragFreeAngle ) )
890  {
891  updateStartItem( *evt );
893  }
894  else if( evt->IsAction( &PCB_ACTIONS::drag45Degree ) )
895  {
896  updateStartItem( *evt );
898  }
899  else if( evt->IsAction( &PCB_ACTIONS::breakTrack ) )
900  {
901  updateStartItem( *evt );
902  breakTrack( );
903  }
904  else if( evt->IsClick( BUT_LEFT ) || evt->IsAction( &ACT_NewTrack ) )
905  {
906  updateStartItem( *evt );
907 
908  if( evt->Modifier( MD_CTRL ) )
910  else
911  performRouting();
912  }
913  else if( evt->IsAction( &ACT_PlaceThroughVia ) )
914  {
916  }
917  }
918 
919  frame->SetNoToolSelected();
920  SetContextMenu( nullptr );
921 
922  // Store routing settings till the next invocation
925 
926  return 0;
927 }
928 
929 
931 {
932  VIEW_CONTROLS* ctls = getViewControls();
933 
934  if( m_startItem && m_startItem->IsLocked() )
935  {
936  if( !IsOK( frame(), _( "The item is locked. Do you want to continue?" ) ) )
937  return;
938  }
939 
940  bool dragStarted = m_router->StartDragging( m_startSnapPoint, m_startItem, aMode );
941 
942  if( !dragStarted )
943  return;
944 
945  if( m_startItem && m_startItem->Net() >= 0 )
946  highlightNet( true, m_startItem->Net() );
947 
948  ctls->SetAutoPan( true );
949 
950  frame()->UndoRedoBlock( true );
951 
952  while( OPT_TOOL_EVENT evt = Wait() )
953  {
954  ctls->ForceCursorPosition( false );
955 
956  if( evt->IsMotion() )
957  {
958  updateEndItem( *evt );
960  }
961  else if( evt->IsClick( BUT_LEFT ) )
962  {
964  break;
965  }
966  else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt )
967  || evt->IsUndoRedo() )
968  break;
969 
970  handleCommonEvents( *evt );
971  }
972 
973  if( m_router->RoutingInProgress() )
975 
976  m_startItem = nullptr;
977 
978  frame()->UndoRedoBlock( false );
979  ctls->SetAutoPan( false );
980  ctls->ForceCursorPosition( false );
981  highlightNet( false );
982 }
983 
984 
986 {
987  // Get the item under the cursor
989  const auto& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
990 
991  if( selection.Size() != 1 )
992  return 0;
993 
994  const BOARD_CONNECTED_ITEM* item = static_cast<const BOARD_CONNECTED_ITEM*>( selection.Front() );
995 
996  if( item->Type() != PCB_TRACE_T && item->Type() != PCB_VIA_T )
997  return 0;
998 
999  Activate();
1000 
1002  m_router->SyncWorld();
1004 
1005  if( m_startItem && m_startItem->IsLocked() )
1006  {
1007  if( !IsOK( frame(), _( "The item is locked. Do you want to continue?" ) ) )
1008  return false;
1009  }
1010 
1012 
1013  int dragMode = aEvent.Parameter<int64_t> ();
1014 
1015  bool dragStarted = m_router->StartDragging( p0, m_startItem, dragMode );
1016 
1017  if( !dragStarted )
1018  return 0;
1019 
1020  controls()->ShowCursor( true );
1021  controls()->ForceCursorPosition( false );
1022  controls()->SetAutoPan( true );
1023  frame()->UndoRedoBlock( true );
1024 
1025  while( OPT_TOOL_EVENT evt = Wait() )
1026  {
1027  if( evt->IsCancel() )
1028  {
1029  break;
1030  }
1031  else if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) )
1032  {
1033  updateEndItem( *evt );
1035  }
1036  else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
1037  {
1038  updateEndItem( *evt );
1040  break;
1041  }
1042  }
1043 
1044  if( m_router->RoutingInProgress() )
1045  m_router->StopRouting();
1046 
1047  controls()->SetAutoPan( false );
1048  controls()->ShowCursor( false );
1049  frame()->UndoRedoBlock( false );
1050 
1051  return 0;
1052 }
1053 
1054 
1056 {
1058  DIALOG_TRACK_VIA_SIZE sizeDlg( frame(), bds );
1059 
1060  if( sizeDlg.ShowModal() )
1061  {
1062  bds.UseCustomTrackViaSize( true );
1064  }
1065 
1066  return 0;
1067 }
1068 
1069 
1071 {
1072  PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
1073  sizes.ImportCurrent( board()->GetDesignSettings() );
1074  m_router->UpdateSizes( sizes );
1075 
1076  return 0;
1077 }
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:225
virtual int GetTopLayer() const
Definition: view.cpp:721
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:57
const LAYER_RANGE & Layers() const
Function Layers()
Definition: pns_item.h:207
TRACK_WIDTH_MENU m_widthMenu
Normal via
Definition: router_tool.cpp:72
bool finishInteractive()
blind/buried via
Definition: router_tool.cpp:73
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:214
Class CONTEXT_MENU.
Definition: context_menu.h:44
int GetCurrentMicroViaDrill()
Function GetCurrentMicroViaDrill.
VIEW_CONTROLS class definition.
VECTOR2I m_startSnapPoint
Definition: pns_tool_base.h:71
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.
void setTransitions() override
This method is meant to be overridden in order to specify handlers for events.
int RouteSingleTrace(const TOOL_EVENT &aEvent)
static TOOL_ACTION dragFreeAngle
Definition: pcb_actions.h:128
wxString GetClassName() const
Function GetClassName returns the class name.
EDA_ITEM * Front() const
Definition: selection.h:144
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
static LSET AllNonCuMask()
Function AllNonCuMask returns a mask holding all layer minus CU layers.
Definition: lset.cpp:669
static TOOL_ACTION cancelInteractive
Definition: actions.h:45
SIZES_SETTINGS m_savedSizes
Stores sizes settings between router invocations.
Definition: pns_tool_base.h:68
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:76
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 trackViaSizeChanged
Definition: pcb_actions.h:278
static TOOL_ACTION drag45Degree
Definition: pcb_actions.h:127
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:189
void UndoRedoBlock(bool aBlock=true)
Function UndoRedoBlock Enables/disable undo and redo operations.
const BOARD * m_board
void SetViaDrill(int aDrill)
bool IsPlacingVia() const
Definition: pns_router.cpp:468
SIZES_SETTINGS & Sizes()
Definition: pns_router.h:206
VIATYPE_T
Definition: class_track.h:51
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:1156
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
void SwitchLayer(int layer)
Definition: pns_router.cpp:405
void breakTrack()
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:195
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:477
NODE * GetWorld() const
Definition: pns_router.h:143
void ToggleViaPlacement()
Definition: pns_router.cpp:418
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
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
bool RoutingInProgress() const
Definition: pns_router.cpp:112
bool OfKind(int aKindMask) const
Function OfKind()
Definition: pns_item.h:130
void SetViaSizeIndex(unsigned aIndex)
Function SetViaSizeIndex sets the current via size list index to aIndex.
int onViaCommand(const TOOL_EVENT &aEvent)
KIGFX::VIEW_CONTROLS * controls() const
Definition: pcb_tool.h:133
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. ...
void BreakSegment(ITEM *aItem, const VECTOR2I &aP)
Definition: pns_router.cpp:498
static TOOL_ACTION routerActivateTuneDiffPairSkew
Activation of the Push and Shove router (skew tuning mode)
Definition: pcb_actions.h:201
std::shared_ptr< NETCLASS > GetNetClass() const
Function GetNetClass returns the NETCLASS for this item.
static const char Default[]
the name of the default NETCLASS
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:134
Class TOOL_EVENT.
Definition: tool_event.h:162
PNS::ROUTER_MODE m_mode
ITEM * m_startItem
Definition: pns_tool_base.h:69
OPT_TOOL_EVENT eventHandler(const wxMenuEvent &aEvent) override
Event handler stub.
bool FixRoute(const VECTOR2I &aP, ITEM *aItem)
Definition: pns_router.cpp:343
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:78
void SetContextMenu(CONTEXT_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
Function SetContextMenu()
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:532
void Load(const TOOL_SETTINGS &where)
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
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:198
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).
const SELECTION & selection() const
Definition: pcb_tool.cpp:218
ROUTING_SETTINGS m_savedSettings
Stores routing settings between router invocations.
Definition: pns_tool_base.h:67
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:204
TOOL_SETTINGS & GetSettings()
Definition: tool_base.cpp:77
int onTrackViaSizeChanged(const TOOL_EVENT &aEvent)
static TOOL_ACTION routerInlineDrag
Activation of the Push and Shove router (inline dragging mode)
Definition: pcb_actions.h:209
bool StartRouting(const VECTOR2I &aP, ITEM *aItem, int aLayer)
Definition: pns_router.cpp:156
bool Overlaps(const LAYER_RANGE &aOther) const
Definition: pns_layerset.h:68
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:41
TRACK_WIDTH_MENU(const BOARD *aBoard)
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
static TOOL_ACTION breakTrack
Definition: pcb_actions.h:126
void StopRouting()
Definition: pns_router.cpp:368
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:571
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:270
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:287
void SetMode(ROUTER_MODE aMode)
Definition: pns_router.cpp:486
int getDefaultWidth(int aNetCode)
static TOOL_ACTION routerActivateSettingsDialog
Activation of the Push and Shove settings dialogs.
Definition: pcb_actions.h:204
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
VECTOR2I m_endSnapPoint
Definition: pns_tool_base.h:74
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
bool StartDragging(const VECTOR2I &aP, ITEM *aItem, int aDragMode=DM_ANY)
Definition: pns_router.cpp:127
void performDragging(int aMode=PNS::DM_ANY)
static const TOOL_ACTION ACT_CustomTrackWidth("pcbnew.InteractiveRouter.CustomTrackViaSize", AS_CONTEXT, TOOL_ACTION::LegacyHotKey(HK_CUSTOM_TRACK_WIDTH), _("Custom Track/Via Size"), _("Shows a dialog for changing the track width and via size."), width_track_xpm)
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:1328
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:80
boost::optional< T > OPT
Definition: optional.h:7
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:437
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
void AddLayerPair(int aL1, int aL2)
int Size() const
Returns the number of selected parts.
Definition: selection.h:112
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:445
static VIATYPE_T getViaTypeFromFlags(int aFlags)
static const TOOL_ACTION ACT_SetDpDimensions("pcbnew.InteractiveRouter.SetDpDimensions", AS_CONTEXT, TOOL_ACTION::LegacyHotKey(HK_DP_DIMENSIONS), _("Differential Pair Dimensions..."), _("Sets the width and gap of the currently routed differential pair."), ps_diff_pair_tune_length_xpm)
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:396
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:192
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:73
OPT< int > PairedLayer(int aLayerId)
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:131
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:221
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:883
ROUTING_SETTINGS & Settings()
Definition: pns_router.h:187
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:774
VIA_ACTION_FLAGS
Flags used by via tool actions.
Definition: router_tool.cpp:67
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.
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:460
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
static TOOL_ACTION layerToggle
Definition: pcb_actions.h:268
BOARD * board() const
Definition: pcb_tool.h:135
static TOOL_ACTION routerActivateDpDimensionsDialog
Definition: pcb_actions.h:205
virtual void updateStartItem(TOOL_EVENT &aEvent)