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",
115  AS_CONTEXT, 0,
116  _( "Drag Track/Via" ), _( "Drags tracks and vias without breaking connections" ),
117  drag_xpm );
118 
119 TOOL_ACTION PCB_ACTIONS::breakTrack( "pcbnew.InteractiveRouter.BreakTrack",
120  AS_GLOBAL, 0,
121  _( "Break Track" ),
122  _( "Splits the track segment into two segments connected at the cursor position." ),
123  break_line_xpm );
124 
125 TOOL_ACTION PCB_ACTIONS::drag45Degree( "pcbnew.InteractiveRouter.Drag45Degree",
127  _( "Drag (45 degree mode)" ),
128  _( "todo" ),
129  drag_segment_withslope_xpm );
130 
131 TOOL_ACTION PCB_ACTIONS::dragFreeAngle( "pcbnew.InteractiveRouter.DragFreeAngle",
133  _( "Drag (free angle)" ),
134  _( "todo" ),
135  move_xpm );
136 
137 static const TOOL_ACTION ACT_NewTrack( "pcbnew.InteractiveRouter.NewTrack", AS_CONTEXT,
139  _( "New Track" ), _( "Starts laying a new track." ), add_tracks_xpm );
140 
141 static const TOOL_ACTION ACT_EndTrack( "pcbnew.InteractiveRouter.EndTrack", AS_CONTEXT, WXK_END,
142  _( "End Track" ), _( "Stops laying the current track." ), checked_ok_xpm );
143 
144 static const TOOL_ACTION ACT_AutoEndRoute( "pcbnew.InteractiveRouter.AutoEndRoute", AS_CONTEXT, 'F',
145  _( "Auto-end Track" ), _( "Automagically finishes currently routed track." ) );
146 
147 static const TOOL_ACTION ACT_PlaceThroughVia( "pcbnew.InteractiveRouter.PlaceVia",
149  _( "Place Through Via" ),
150  _( "Adds a through-hole via at the end of currently routed track." ),
151  via_xpm, AF_NONE,
152  (void*) VIA_ACTION_FLAGS::VIA );
153 
154 static const TOOL_ACTION ACT_PlaceBlindVia( "pcbnew.InteractiveRouter.PlaceBlindVia",
156  _( "Place Blind/Buried Via" ),
157  _( "Adds a blind or buried via at the end of currently routed track."),
158  via_buried_xpm, AF_NONE,
159  (void*) VIA_ACTION_FLAGS::BLIND_VIA );
160 
161 static const TOOL_ACTION ACT_PlaceMicroVia( "pcbnew.InteractiveRouter.PlaceMicroVia",
163  _( "Place Microvia" ), _( "Adds a microvia at the end of currently routed track." ),
164  via_microvia_xpm, AF_NONE,
165  (void*) VIA_ACTION_FLAGS::MICROVIA );
166 
168  "pcbnew.InteractiveRouter.SelLayerAndPlaceVia",
170  _( "Select Layer and Place Through Via" ),
171  _( "Select a layer, then add a through-hole via at the end of currently routed track." ),
172  select_w_layer_xpm, AF_NONE,
174 
176  "pcbnew.InteractiveRouter.SelLayerAndPlaceBlindVia",
178  _( "Select Layer and Place Blind/Buried Via" ),
179  _( "Select a layer, then add a blind or buried via at the end of currently routed track."),
180  select_w_layer_xpm, AF_NONE,
182 
183 static const TOOL_ACTION ACT_CustomTrackWidth( "pcbnew.InteractiveRouter.CustomTrackViaSize",
185  _( "Custom Track/Via Size" ),
186  _( "Shows a dialog for changing the track width and via size." ),
187  width_track_xpm );
188 
189 static const TOOL_ACTION ACT_SwitchPosture( "pcbnew.InteractiveRouter.SwitchPosture", AS_CONTEXT,
191  _( "Switch Track Posture" ),
192  _( "Switches posture of the currently routed track." ),
193  change_entry_orient_xpm );
194 
195 static const TOOL_ACTION ACT_SetDpDimensions( "pcbnew.InteractiveRouter.SetDpDimensions",
197  _( "Differential Pair Dimensions..." ),
198  _( "Sets the width and gap of the currently routed differential pair." ),
199  ps_diff_pair_tune_length_xpm );
200 
202  TOOL_BASE( "pcbnew.InteractiveRouter" )
203 {
204 }
205 
206 
208 {
209 public:
210  TRACK_WIDTH_MENU( const BOARD* aBoard )
211  : TRACK_VIA_SIZE_MENU( true, true )
212  {
213  SetTitle( _( "Select Track/Via Width" ) );
214  SetBoard( aBoard );
215  }
216 
217  void SetBoard( const BOARD* aBoard )
218  {
219  m_board = aBoard;
220 
221  Clear();
222 
223  Append( ID_POPUP_PCB_SELECT_CUSTOM_WIDTH, _( "Custom size" ),
224  wxEmptyString, wxITEM_CHECK );
225 
226  Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH, _( "Use the starting track width" ),
227  _( "Route using the width of the starting track." ), wxITEM_CHECK );
228 
229  Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES, _( "Use net class values" ),
230  _( "Use track and via sizes from the net class" ), wxITEM_CHECK );
231 
232  AppendSeparator();
233 
234  // Append the list of tracks & via sizes
235  AppendSizes( aBoard );
236  }
237 
238 protected:
239  CONTEXT_MENU* create() const override
240  {
241  return new TRACK_WIDTH_MENU( m_board );
242  }
243 
244  OPT_TOOL_EVENT eventHandler( const wxMenuEvent& aEvent ) override
245  {
247  int id = aEvent.GetId();
248 
249  // On Windows, this handler can be called with a non existing event ID not existing
250  // in any menuitem.
251  // So we keep trace of in-range/out-of-range event ID
252  bool in_range = true;
253 
254  // Initial settings, to be modified below, but only if the ID exists in this menu
255  bool useConnectedTrackWidth = false;
256  bool useCustomTrackViaSize = false;
257 
259  {
260  useCustomTrackViaSize = true;
261  }
262  else if( id == ID_POPUP_PCB_SELECT_AUTO_WIDTH )
263  {
264  useConnectedTrackWidth = true;
265  }
267  {
268  bds.SetViaSizeIndex( 0 );
269  bds.SetTrackWidthIndex( 0 );
270  }
271  else if( id >= ID_POPUP_PCB_SELECT_VIASIZE1 &&
273  {
274  // via size has changed
276  }
277  else if( id >= ID_POPUP_PCB_SELECT_WIDTH1 &&
279  {
280  // track width has changed
282  }
283  else
284  {
285  in_range = false; // This event ID does not exist in the menu
286  wxASSERT_MSG( false, "OPT_TOOL_EVENT EventHandler: unexpected id" );
287  // Fix me: How to return this error as OPT_TOOL_EVENT?
288  }
289 
290  if( in_range )
291  {
292  // Update this setup only id the event ID matches the options of this menu
293  bds.m_UseConnectedTrackWidth = useConnectedTrackWidth;
294  bds.UseCustomTrackViaSize( useCustomTrackViaSize );
295  }
296 
297  return OPT_TOOL_EVENT( PCB_ACTIONS::trackViaSizeChanged.MakeEvent() );
298  }
299 
300 private:
301  const BOARD* m_board;
302 };
303 
304 
306 {
307 public:
308  ROUTER_TOOL_MENU( const BOARD* aBoard, PCB_EDIT_FRAME& aFrame, PNS::ROUTER_MODE aMode ) :
309  m_board( aBoard ), m_frame( aFrame ), m_mode( aMode ),
310  m_widthMenu( aBoard ), m_zoomMenu( &aFrame ), m_gridMenu( &aFrame )
311  {
312  SetTitle( _( "Interactive Router" ) );
313 
315 
316  AppendSeparator();
317 
318  Add( ACT_NewTrack );
319  Add( ACT_EndTrack );
321 
324 
325 // Add( ACT_AutoEndRoute ); // fixme: not implemented yet. Sorry.
332 
333  AppendSeparator();
334 
335  m_widthMenu.SetBoard( aBoard );
336  Add( &m_widthMenu );
337 
339 
340  if( aMode == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
342 
343  AppendSeparator();
345 
346  AppendSeparator();
347  Add( &m_zoomMenu );
348  Add( &m_gridMenu );
349  }
350 
351 private:
352  CONTEXT_MENU* create() const override
353  {
354  return new ROUTER_TOOL_MENU( m_board, m_frame, m_mode );
355  }
356 
357  const BOARD* m_board;
363 };
364 
365 
367 {
369 }
370 
371 
373 {
375  return true;
376 }
377 
378 
380 {
381  TOOL_BASE::Reset( aReason );
382 }
383 
384 
385 int ROUTER_TOOL::getDefaultWidth( int aNetCode )
386 {
387  int w, d1, d2;
388 
389  getNetclassDimensions( aNetCode, w, d1, d2 );
390 
391  return w;
392 }
393 
394 
395 void ROUTER_TOOL::getNetclassDimensions( int aNetCode, int& aWidth,
396  int& aViaDiameter, int& aViaDrill )
397 {
399 
400  NETCLASSPTR netClass;
401  NETINFO_ITEM* ni = board()->FindNet( aNetCode );
402 
403  if( ni )
404  {
405  wxString netClassName = ni->GetClassName();
406  netClass = bds.m_NetClasses.Find( netClassName );
407  }
408 
409  if( !netClass )
410  netClass = bds.GetDefault();
411 
412  aWidth = netClass->GetTrackWidth();
413  aViaDiameter = netClass->GetViaDiameter();
414  aViaDrill = netClass->GetViaDrill();
415 }
416 
417 
419 {
420 #ifdef DEBUG
421  if( aEvent.IsKeyPressed() )
422  {
423  switch( aEvent.KeyCode() )
424  {
425  case '0':
426  wxLogTrace( "PNS", "saving drag/route log...\n" );
427  m_router->DumpLog();
428  break;
429  }
430  }
431 #endif
432 }
433 
434 
436 {
437  int tl = getView()->GetTopLayer();
438 
439  if( m_startItem )
440  {
441  const LAYER_RANGE& ls = m_startItem->Layers();
442 
443  if( ls.Overlaps( tl ) )
444  return tl;
445  else
446  return ls.Start();
447  }
448 
449  return tl;
450 }
451 
452 
454 {
455  int al = frame()->GetActiveLayer();
456  int cl = m_router->GetCurrentLayer();
457 
458  if( cl != al )
459  {
460  m_router->SwitchLayer( al );
461  }
462 
463  optional<int> newLayer = m_router->Sizes().PairedLayer( cl );
464 
465  if( !newLayer )
466  newLayer = m_router->Sizes().GetLayerTop();
467 
468  m_router->SwitchLayer( *newLayer );
469  frame()->SetActiveLayer( ToLAYER_ID( *newLayer ) );
470 }
471 
472 
473 static VIATYPE_T getViaTypeFromFlags( int aFlags )
474 {
475  VIATYPE_T viaType = VIA_THROUGH;
476 
477  switch( aFlags & VIA_ACTION_FLAGS::VIA_MASK )
478  {
480  viaType = VIA_THROUGH;
481  break;
483  viaType = VIA_BLIND_BURIED;
484  break;
486  viaType = VIA_MICROVIA;
487  break;
488  default:
489  wxASSERT_MSG( false, "Unhandled via type" );
490  }
491 
492  wxLogDebug("via type %d", viaType );
493 
494  return viaType;
495 }
496 
497 
499 {
500  const int actViaFlags = aEvent.Parameter<intptr_t>();
501 
502  VIATYPE_T viaType = getViaTypeFromFlags( actViaFlags );
503  const bool selectLayer = actViaFlags & VIA_ACTION_FLAGS::SELECT_LAYER;
504 
506 
507  const int layerCount = bds.GetCopperLayerCount();
508  int currentLayer = m_router->GetCurrentLayer();
511 
513 
514  // ask the user for a target layer
515  PCB_LAYER_ID targetLayer = UNDEFINED_LAYER;
516 
517  if( selectLayer )
518  {
519  wxPoint dlgPosition = wxGetMousePosition();
520 
521  targetLayer = frame()->SelectLayer( static_cast<PCB_LAYER_ID>( currentLayer ),
522  LSET::AllNonCuMask(), dlgPosition );
523  }
524 
525  // fixme: P&S supports more than one fixed layer pair. Update the dialog?
526  sizes.ClearLayerPairs();
527 
528  if( !m_router->IsPlacingVia() )
529  {
530  // Cannot place microvias or blind vias if not allowed (obvious)
531  if( ( viaType == VIA_BLIND_BURIED ) && ( !bds.m_BlindBuriedViaAllowed ) )
532  {
533  DisplayError( frame(), _( "Blind/buried vias have to be enabled in the design settings." ) );
534  return false;
535  }
536 
537  if( ( viaType == VIA_MICROVIA ) && ( !bds.m_MicroViasAllowed ) )
538  {
539  DisplayError( frame(), _( "Microvias have to be enabled in the design settings." ) );
540  return false;
541  }
542 
543  // Can only place through vias on 2-layer boards
544  if( ( viaType != VIA_THROUGH ) && ( layerCount <= 2 ) )
545  {
546  DisplayError( frame(), _( "Only through vias are allowed on 2 layer boards." ) );
547  return false;
548  }
549 
550  // Can only place microvias if we're on an outer layer, or directly adjacent to one
551  if( ( viaType == VIA_MICROVIA ) && ( currentLayer > In1_Cu ) && ( currentLayer < layerCount - 2 ) )
552  {
553  DisplayError( frame(), _( "Microvias can be placed only between the outer layers " \
554  "(F.Cu/B.Cu) and the ones directly adjacent to them." ) );
555  return false;
556  }
557  }
558 
559  // Convert blind/buried via to a through hole one, if it goes through all layers
560  if( viaType == VIA_BLIND_BURIED && ( ( currentLayer == B_Cu ) || ( currentLayer == F_Cu ) )
561  && ( ( pairTop == B_Cu && pairBottom == F_Cu )
562  || ( pairTop == F_Cu && pairBottom == B_Cu ) ) )
563  {
564  viaType = VIA_THROUGH;
565  }
566 
567  switch( viaType )
568  {
569  case VIA_THROUGH:
570  sizes.SetViaDiameter( bds.GetCurrentViaSize() );
571  sizes.SetViaDrill( bds.GetCurrentViaDrill() );
572 
573  if( targetLayer != UNDEFINED_LAYER )
574  {
575  // go from the current layer to the chosen layer
576  sizes.AddLayerPair( currentLayer, targetLayer );
577  }
578  else
579  {
580  // use the default layer pair
581  sizes.AddLayerPair( pairTop, pairBottom );
582  }
583  break;
584 
585  case VIA_MICROVIA:
586  sizes.SetViaDiameter( bds.GetCurrentMicroViaSize() );
587  sizes.SetViaDrill( bds.GetCurrentMicroViaDrill() );
588 
589  wxASSERT_MSG( !selectLayer, "Unexpected select layer for microvia (microvia layers are implicit)" );
590 
591  if( currentLayer == F_Cu || currentLayer == In1_Cu )
592  {
593  // front-side microvia
594  sizes.AddLayerPair( F_Cu, In1_Cu );
595  }
596  else if( currentLayer == B_Cu || currentLayer == layerCount - 2 )
597  {
598  // back-side microvia
599  sizes.AddLayerPair( B_Cu, layerCount - 2 );
600  }
601  else
602  {
603  wxASSERT_MSG( false, "Invalid layer pair for microvia (must be on or adjacent to an outer layer)" );
604  }
605  break;
606 
607  case VIA_BLIND_BURIED:
608  sizes.SetViaDiameter( bds.GetCurrentViaSize() );
609  sizes.SetViaDrill( bds.GetCurrentViaDrill() );
610 
611  if( targetLayer != UNDEFINED_LAYER )
612  {
613  // go directly to the user specified layer
614  sizes.AddLayerPair( currentLayer, targetLayer );
615  }
616  else
617  {
618  if( currentLayer == pairTop || currentLayer == pairBottom )
619  {
620  // the current layer is on the defined layer pair,
621  // swap to the other side
622  sizes.AddLayerPair( pairTop, pairBottom );
623  }
624  else
625  {
626  // the current layer is not part of the current layer pair,
627  // so fallback and swap to the top layer of the pair by default
628  sizes.AddLayerPair( pairTop, currentLayer );
629  }
630  }
631  break;
632 
633  default:
634  wxASSERT( false );
635  break;
636  }
637 
638  sizes.SetViaType( viaType );
639 
640  m_router->UpdateSizes( sizes );
642 
643  updateEndItem( aEvent );
644 
645  m_router->Move( m_endSnapPoint, m_endItem ); // refresh
646 
647  return 0;
648 }
649 
650 
652 {
653  int routingLayer = getStartLayer( m_startItem );
654 
655  if( !IsCopperLayer( routingLayer ) )
656  {
657  DisplayError( frame(), _( "Tracks on Copper layers only" ) );
658  return false;
659  }
660 
661  frame()->SetActiveLayer( ToLAYER_ID( routingLayer ) );
662 
663  // fixme: switch on invisible layer
664 
665  // for some reason I don't understand, GetNetclass() may return null sometimes...
666  if( m_startItem && m_startItem->Net() >= 0 &&
668  {
669  highlightNet( true, m_startItem->Net() );
670  // Update track width and via size shown in main toolbar comboboxes
671  frame()->SetCurrentNetClass( m_startItem->Parent()->GetNetClass()->GetName() );
672  }
673  else
675 
676  controls()->ForceCursorPosition( false );
677  controls()->SetAutoPan( true );
678 
679  PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
680 
681  sizes.Init( board(), m_startItem );
682  sizes.AddLayerPair( frame()->GetScreen()->m_Route_Layer_TOP,
683  frame()->GetScreen()->m_Route_Layer_BOTTOM );
684  m_router->UpdateSizes( sizes );
685 
686  if( !m_router->StartRouting( m_startSnapPoint, m_startItem, routingLayer ) )
687  {
689  highlightNet( false );
690  return false;
691  }
692 
693  m_endItem = NULL;
695 
696  frame()->UndoRedoBlock( true );
697 
698  return true;
699 }
700 
701 
703 {
705 
706  controls()->SetAutoPan( false );
707  controls()->ForceCursorPosition( false );
708  frame()->UndoRedoBlock( false );
709  highlightNet( false );
710 
711  return true;
712 }
713 
714 
716 {
717  if( !prepareInteractive() )
718  return;
719 
720  while( OPT_TOOL_EVENT evt = Wait() )
721  {
722  // Don't crash if we missed an operation that cancelled routing.
723  wxCHECK2( m_router->RoutingInProgress(), break );
724 
725  if( evt->IsMotion() )
726  {
727  m_router->SetOrthoMode( evt->Modifier( MD_CTRL ) );
728  updateEndItem( *evt );
730  }
731  else if( evt->IsClick( BUT_LEFT ) )
732  {
733  updateEndItem( *evt );
734  bool needLayerSwitch = m_router->IsPlacingVia();
735 
737  break;
738 
739  if( needLayerSwitch )
741 
742  // Synchronize the indicated layer
744  updateEndItem( *evt );
746  m_startItem = NULL;
747  }
748  else if( evt->IsAction( &ACT_SwitchPosture ) )
749  {
751  updateEndItem( *evt );
752  m_router->Move( m_endSnapPoint, m_endItem ); // refresh
753  }
754  else if( evt->IsAction( &PCB_ACTIONS::layerChanged ) )
755  {
756  m_router->SwitchLayer( frame()->GetActiveLayer() );
757  updateEndItem( *evt );
758  m_router->Move( m_endSnapPoint, m_endItem ); // refresh
759  }
760  else if( evt->IsAction( &ACT_EndTrack ) )
761  {
762  bool still_routing = true;
763  while( still_routing )
764  still_routing = m_router->FixRoute( m_endSnapPoint, m_endItem );
765  break;
766  }
767  else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt )
768  || evt->IsUndoRedo()
769  || evt->IsAction( &PCB_ACTIONS::routerInlineDrag ) )
770  break;
771  }
772 
774 }
775 
776 
778 {
779  Activate();
780 
782  DIALOG_PNS_DIFF_PAIR_DIMENSIONS settingsDlg( frame(), sizes );
783 
784  if( settingsDlg.ShowModal() )
785  {
786  m_router->UpdateSizes( sizes );
787  m_savedSizes = sizes;
788  }
789 
790  return 0;
791 }
792 
793 
795 {
796  Activate();
797 
798  DIALOG_PNS_SETTINGS settingsDlg( frame(), m_router->Settings() );
799 
800  if( settingsDlg.ShowModal() )
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  {
892  }
893  else if( evt->IsAction( &PCB_ACTIONS::drag45Degree ) )
894  {
896  }
897  else if( evt->IsAction( &PCB_ACTIONS::breakTrack ) )
898  {
899  updateStartItem( *evt );
900  breakTrack( );
901  }
902  else if( evt->IsClick( BUT_LEFT ) || evt->IsAction( &ACT_NewTrack ) )
903  {
904  updateStartItem( *evt );
905 
906  if( evt->Modifier( MD_CTRL ) )
908  else
909  performRouting();
910  }
911  else if( evt->IsAction( &ACT_PlaceThroughVia ) )
912  {
914  }
915  else if( evt->IsAction( &PCB_ACTIONS::remove ) )
916  {
917  deleteTraces( m_startItem, false );
918  }
919  else if( evt->IsAction( &PCB_ACTIONS::removeAlt ) )
920  {
921  deleteTraces( m_startItem, true );
922  }
923  }
924 
925  frame->SetNoToolSelected();
926  SetContextMenu( nullptr );
927 
928  // Store routing settings till the next invocation
931 
932  return 0;
933 }
934 
935 
937 {
938  VIEW_CONTROLS* ctls = getViewControls();
939 
940  if( m_startItem && m_startItem->IsLocked() )
941  {
942  if( !IsOK( frame(), _( "The item is locked. Do you want to continue?" ) ) )
943  return;
944  }
945 
946  bool dragStarted = m_router->StartDragging( m_startSnapPoint, m_startItem, aMode );
947 
948  if( !dragStarted )
949  return;
950 
951  if( m_startItem && m_startItem->Net() >= 0 )
952  highlightNet( true, m_startItem->Net() );
953 
954  ctls->SetAutoPan( true );
955 
956  frame()->UndoRedoBlock( true );
957 
958  while( OPT_TOOL_EVENT evt = Wait() )
959  {
960  ctls->ForceCursorPosition( false );
961 
962  if( evt->IsMotion() )
963  {
964  updateEndItem( *evt );
966  }
967  else if( evt->IsClick( BUT_LEFT ) )
968  {
970  break;
971  }
972  else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt )
973  || evt->IsUndoRedo() )
974  break;
975 
976  handleCommonEvents( *evt );
977  }
978 
979  if( m_router->RoutingInProgress() )
981 
982  m_startItem = NULL;
983 
984  frame()->UndoRedoBlock( false );
985  ctls->SetAutoPan( false );
986  ctls->ForceCursorPosition( false );
987  highlightNet( false );
988 }
989 
990 
992 {
993  // Get the item under the cursor
995  const auto& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
996 
997  if( selection.Size() != 1 )
998  return 0;
999 
1000  const BOARD_CONNECTED_ITEM* item = static_cast<const BOARD_CONNECTED_ITEM*>( selection.Front() );
1001 
1002  if( item->Type() != PCB_TRACE_T && item->Type() != PCB_VIA_T )
1003  return 0;
1004 
1005  Activate();
1006 
1008  m_router->SyncWorld();
1010 
1011  if( m_startItem && m_startItem->IsLocked() )
1012  {
1013  if( !IsOK( frame(), _( "The item is locked. Do you want to continue?" ) ) )
1014  return false;
1015  }
1016 
1018 
1019  int dragMode = aEvent.Parameter<int64_t> ();
1020 
1021  bool dragStarted = m_router->StartDragging( p0, m_startItem, dragMode );
1022 
1023  if( !dragStarted )
1024  return 0;
1025 
1026  controls()->ShowCursor( true );
1027  controls()->ForceCursorPosition( false );
1028  controls()->SetAutoPan( true );
1029  frame()->UndoRedoBlock( true );
1030 
1031  while( OPT_TOOL_EVENT evt = Wait() )
1032  {
1033  if( evt->IsCancel() )
1034  {
1035  break;
1036  }
1037  else if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) )
1038  {
1039  updateEndItem( *evt );
1041  }
1042  else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
1043  {
1044  updateEndItem( *evt );
1046  break;
1047  }
1048  }
1049 
1050  if( m_router->RoutingInProgress() )
1051  m_router->StopRouting();
1052 
1053  controls()->SetAutoPan( false );
1054  controls()->ShowCursor( false );
1055  frame()->UndoRedoBlock( false );
1056 
1057  return 0;
1058 }
1059 
1060 
1062 {
1064  DIALOG_TRACK_VIA_SIZE sizeDlg( frame(), bds );
1065 
1066  if( sizeDlg.ShowModal() )
1067  {
1068  bds.UseCustomTrackViaSize( true );
1070  }
1071 
1072  return 0;
1073 }
1074 
1075 
1077 {
1078  PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
1079  sizes.ImportCurrent( board()->GetDesignSettings() );
1080  m_router->UpdateSizes( sizes );
1081 
1082  return 0;
1083 }
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: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.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:213
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: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: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:124
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:275
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:186
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:468
SIZES_SETTINGS & Sizes()
Definition: pns_router.h:206
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:1130
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:192
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: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
boost::optional< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:460
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:124
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:198
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:125
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 (...
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:195
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: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: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:206
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:36
TRACK_WIDTH_MENU(const BOARD *aBoard)
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:30
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: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:267
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:201
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
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
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:1330
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:80
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: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: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
static TOOL_ACTION remove
Deleting a BOARD_ITEM.
Definition: pcb_actions.h:123
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:189
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:71
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:129
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: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:265
BOARD * board() const
Definition: pcb_tool.h:126
static TOOL_ACTION routerActivateDpDimensionsDialog
Definition: pcb_actions.h:202
virtual void updateStartItem(TOOL_EVENT &aEvent)