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 <ratsnest_data.h>
59 
60 #include "router_tool.h"
61 #include "pns_segment.h"
62 #include "pns_router.h"
63 
64 using namespace KIGFX;
65 using boost::optional;
66 
67 
72 {
73  // Via type
74  VIA_MASK = 0x03,
75  VIA = 0x00,
76  BLIND_VIA = 0x01,
77  MICROVIA = 0x02,
78 
79  // Select layer
81 };
82 
83 
84 TOOL_ACTION PCB_ACTIONS::routerActivateSingle( "pcbnew.InteractiveRouter.SingleTrack",
86  _( "Interactive Router (Single Tracks)" ),
87  _( "Run push & shove router (single tracks)" ), ps_router_xpm, AF_ACTIVATE );
88 
89 TOOL_ACTION PCB_ACTIONS::routerActivateDiffPair( "pcbnew.InteractiveRouter.DiffPair",
90  AS_GLOBAL, '6',
91  _( "Interactive Router (Differential Pairs)" ),
92  _( "Run push & shove router (differential pairs)" ), ps_diff_pair_xpm, AF_ACTIVATE );
93 
94 TOOL_ACTION PCB_ACTIONS::routerActivateSettingsDialog( "pcbnew.InteractiveRouter.SettingsDialog",
95  AS_GLOBAL, 0,
96  _( "Interactive Router Settings" ),
97  _( "Open Interactive Router settings" ), NULL, AF_ACTIVATE );
98 
99 TOOL_ACTION PCB_ACTIONS::routerActivateDpDimensionsDialog( "pcbnew.InteractiveRouter.DpDimensionsDialog",
100  AS_GLOBAL, 0,
101  _( "Differential Pair Dimension settings" ),
102  _( "Open Differential Pair Dimension settings" ), ps_diff_pair_gap_xpm, AF_ACTIVATE );
103 
104 TOOL_ACTION PCB_ACTIONS::routerActivateTuneSingleTrace( "pcbnew.LengthTuner.TuneSingleTrack",
105  AS_GLOBAL, '7',
106  _( "Tune length of a single track" ), "", ps_tune_length_xpm, AF_ACTIVATE );
107 
108 TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPair( "pcbnew.LengthTuner.TuneDiffPair",
109  AS_GLOBAL, '8',
110  _( "Tune length of a differential pair" ), "", NULL, AF_ACTIVATE );
111 
112 TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPairSkew( "pcbnew.LengthTuner.TuneDiffPairSkew",
113  AS_GLOBAL, '9',
114  _( "Tune skew of a differential pair" ), "", NULL, AF_ACTIVATE );
115 
116 TOOL_ACTION PCB_ACTIONS::routerInlineDrag( "pcbnew.InteractiveRouter.InlineDrag",
118  _( "Drag Track/Via" ), _( "Drags tracks and vias without breaking connections" ),
119  drag_track_segment_xpm );
120 
121 static const TOOL_ACTION ACT_NewTrack( "pcbnew.InteractiveRouter.NewTrack", AS_CONTEXT,
123  _( "New Track" ), _( "Starts laying a new track." ), add_tracks_xpm );
124 
125 static const TOOL_ACTION ACT_EndTrack( "pcbnew.InteractiveRouter.EndTrack", AS_CONTEXT, WXK_END,
126  _( "End Track" ), _( "Stops laying the current track." ), checked_ok_xpm );
127 
128 static const TOOL_ACTION ACT_AutoEndRoute( "pcbnew.InteractiveRouter.AutoEndRoute", AS_CONTEXT, 'F',
129  _( "Auto-end Track" ), _( "Automagically finishes currently routed track." ) );
130 
131 static const TOOL_ACTION ACT_PlaceThroughVia( "pcbnew.InteractiveRouter.PlaceVia",
133  _( "Place Through Via" ),
134  _( "Adds a through-hole via at the end of currently routed track." ),
135  via_xpm, AF_NONE,
136  (void*) VIA_ACTION_FLAGS::VIA );
137 
138 static const TOOL_ACTION ACT_PlaceBlindVia( "pcbnew.InteractiveRouter.PlaceBlindVia",
140  _( "Place Blind/Buried Via" ),
141  _( "Adds a blind or buried via at the end of currently routed track."),
142  via_buried_xpm, AF_NONE,
143  (void*) VIA_ACTION_FLAGS::BLIND_VIA );
144 
145 static const TOOL_ACTION ACT_PlaceMicroVia( "pcbnew.InteractiveRouter.PlaceMicroVia",
147  _( "Place Microvia" ), _( "Adds a microvia at the end of currently routed track." ),
148  via_microvia_xpm, AF_NONE,
149  (void*) VIA_ACTION_FLAGS::MICROVIA );
150 
152  "pcbnew.InteractiveRouter.SelLayerAndPlaceVia",
154  _( "Select Layer and Place Through Via" ),
155  _( "Select a layer, then add a through-hole via at the end of currently routed track." ),
156  select_w_layer_xpm, AF_NONE,
158 
160  "pcbnew.InteractiveRouter.SelLayerAndPlaceBlindVia",
162  _( "Select Layer and Place Blind/Buried Via" ),
163  _( "Select a layer, then add a blind or buried via at the end of currently routed track."),
164  select_w_layer_xpm, AF_NONE,
166 
167 static const TOOL_ACTION ACT_CustomTrackWidth( "pcbnew.InteractiveRouter.CustomTrackViaSize",
168  AS_CONTEXT, 'Q',
169  _( "Custom Track/Via Size" ),
170  _( "Shows a dialog for changing the track width and via size." ),
171  width_track_xpm );
172 
173 static const TOOL_ACTION ACT_SwitchPosture( "pcbnew.InteractiveRouter.SwitchPosture", AS_CONTEXT,
175  _( "Switch Track Posture" ),
176  _( "Switches posture of the currently routed track." ),
177  change_entry_orient_xpm );
178 
179 static const TOOL_ACTION ACT_SetDpDimensions( "pcbnew.InteractiveRouter.SetDpDimensions",
180  AS_CONTEXT, 'P',
181  _( "Differential Pair Dimensions..." ),
182  _( "Sets the width and gap of the currently routed differential pair." ),
183  ps_diff_pair_tune_length_xpm );
184 
185 
187  TOOL_BASE( "pcbnew.InteractiveRouter" )
188 {
189 }
190 
191 
193 {
194 public:
195  TRACK_WIDTH_MENU( const BOARD* aBoard )
196  : TRACK_VIA_SIZE_MENU( true, true )
197  {
198  SetTitle( _( "Select Track/Via Width" ) );
199  SetBoard( aBoard );
200  }
201 
202  void SetBoard( const BOARD* aBoard )
203  {
204  m_board = aBoard;
205 
206  Clear();
207 
208  Append( ID_POPUP_PCB_SELECT_CUSTOM_WIDTH, _( "Custom size" ),
209  wxEmptyString, wxITEM_CHECK );
210 
211  Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH, _( "Use the starting track width" ),
212  _( "Route using the width of the starting track." ), wxITEM_CHECK );
213 
214  Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES, _( "Use net class values" ),
215  _( "Use track and via sizes from the net class" ), wxITEM_CHECK );
216 
217  AppendSeparator();
218 
219  // Append the list of tracks & via sizes
220  AppendSizes( aBoard );
221  }
222 
223 protected:
224  CONTEXT_MENU* create() const override
225  {
226  return new TRACK_WIDTH_MENU( m_board );
227  }
228 
229  OPT_TOOL_EVENT eventHandler( const wxMenuEvent& aEvent ) override
230  {
232  int id = aEvent.GetId();
233 
234  // On Windows, this handler can be called with a non existing event ID not existing
235  // in any menuitem.
236  // So we keep trace of in-range/out-of-range event ID
237  bool in_range = true;
238 
239  // Initial settings, to be modified below, but only if the ID exists in this menu
240  bool useConnectedTrackWidth = false;
241  bool useCustomTrackViaSize = false;
242 
244  {
245  useCustomTrackViaSize = true;
246  }
247  else if( id == ID_POPUP_PCB_SELECT_AUTO_WIDTH )
248  {
249  useConnectedTrackWidth = true;
250  }
252  {
253  bds.SetViaSizeIndex( 0 );
254  bds.SetTrackWidthIndex( 0 );
255  }
256  else if( id >= ID_POPUP_PCB_SELECT_VIASIZE1 &&
258  {
259  // via size has changed
261  }
262  else if( id >= ID_POPUP_PCB_SELECT_WIDTH1 &&
264  {
265  // track width has changed
267  }
268  else
269  {
270  in_range = false; // This event ID does not exist in the menu
271  wxASSERT_MSG( false, "OPT_TOOL_EVENT EventHandler: unexpected id" );
272  // Fix me: How to return this error as OPT_TOOL_EVENT?
273  }
274 
275  if( in_range )
276  {
277  // Update this setup only id the event ID matches the options of this menu
278  bds.m_UseConnectedTrackWidth = useConnectedTrackWidth;
279  bds.UseCustomTrackViaSize( useCustomTrackViaSize );
280  }
281 
282  return OPT_TOOL_EVENT( PCB_ACTIONS::trackViaSizeChanged.MakeEvent() );
283  }
284 
285 private:
286  const BOARD* m_board;
287 };
288 
289 
291 {
292 public:
293  ROUTER_TOOL_MENU( const BOARD* aBoard, PCB_EDIT_FRAME& aFrame, PNS::ROUTER_MODE aMode ) :
294  m_board( aBoard ), m_frame( aFrame ), m_mode( aMode ),
295  m_widthMenu( aBoard ), m_zoomMenu( &aFrame ), m_gridMenu( &aFrame )
296  {
297  SetTitle( _( "Interactive Router" ) );
298 
300 
301  AppendSeparator();
302 
303  Add( ACT_NewTrack );
304  Add( ACT_EndTrack );
305 // Add( ACT_AutoEndRoute ); // fixme: not implemented yet. Sorry.
312 
313  AppendSeparator();
314 
315  m_widthMenu.SetBoard( aBoard );
316  Add( &m_widthMenu );
317 
319 
320  if( aMode == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
322 
323  AppendSeparator();
325 
326  AppendSeparator();
327  Add( &m_zoomMenu );
328  Add( &m_gridMenu );
329  }
330 
331 private:
332  CONTEXT_MENU* create() const override
333  {
334  return new ROUTER_TOOL_MENU( m_board, m_frame, m_mode );
335  }
336 
337  const BOARD* m_board;
343 };
344 
345 
347 {
349 }
350 
351 
353 {
354  // Track & via dragging menu entry
355  auto selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
356  CONDITIONAL_MENU& menu = selectionTool->GetToolMenu().GetMenu();
359 
361  return true;
362 }
363 
364 
366 {
367  TOOL_BASE::Reset( aReason );
368 }
369 
370 
371 int ROUTER_TOOL::getDefaultWidth( int aNetCode )
372 {
373  int w, d1, d2;
374 
375  getNetclassDimensions( aNetCode, w, d1, d2 );
376 
377  return w;
378 }
379 
380 
381 void ROUTER_TOOL::getNetclassDimensions( int aNetCode, int& aWidth,
382  int& aViaDiameter, int& aViaDrill )
383 {
385 
386  NETCLASSPTR netClass;
387  NETINFO_ITEM* ni = m_board->FindNet( aNetCode );
388 
389  if( ni )
390  {
391  wxString netClassName = ni->GetClassName();
392  netClass = bds.m_NetClasses.Find( netClassName );
393  }
394 
395  if( !netClass )
396  netClass = bds.GetDefault();
397 
398  aWidth = netClass->GetTrackWidth();
399  aViaDiameter = netClass->GetViaDiameter();
400  aViaDrill = netClass->GetViaDrill();
401 }
402 
403 
405 {
406 #ifdef DEBUG
407  if( aEvent.IsKeyPressed() )
408  {
409  switch( aEvent.KeyCode() )
410  {
411  case '0':
412  wxLogTrace( "PNS", "saving drag/route log...\n" );
413  m_router->DumpLog();
414  break;
415  }
416  }
417 #endif
418 }
419 
420 
422 {
423  int tl = getView()->GetTopLayer();
424 
425  if( m_startItem )
426  {
427  const LAYER_RANGE& ls = m_startItem->Layers();
428 
429  if( ls.Overlaps( tl ) )
430  return tl;
431  else
432  return ls.Start();
433  }
434 
435  return tl;
436 }
437 
438 
440 {
441  int al = m_frame->GetActiveLayer();
442  int cl = m_router->GetCurrentLayer();
443 
444  if( cl != al )
445  {
446  m_router->SwitchLayer( al );
447  }
448 
449  optional<int> newLayer = m_router->Sizes().PairedLayer( cl );
450 
451  if( !newLayer )
452  newLayer = m_router->Sizes().GetLayerTop();
453 
454  m_router->SwitchLayer( *newLayer );
455  m_frame->SetActiveLayer( ToLAYER_ID( *newLayer ) );
456 }
457 
458 
459 static VIATYPE_T getViaTypeFromFlags( int aFlags )
460 {
461  VIATYPE_T viaType = VIA_THROUGH;
462 
463  switch( aFlags & VIA_ACTION_FLAGS::VIA_MASK )
464  {
466  viaType = VIA_THROUGH;
467  break;
469  viaType = VIA_BLIND_BURIED;
470  break;
472  viaType = VIA_MICROVIA;
473  break;
474  default:
475  wxASSERT_MSG( false, "Unhandled via type" );
476  }
477 
478  wxLogDebug("via type %d", viaType );
479 
480  return viaType;
481 }
482 
483 
485 {
486  const int actViaFlags = aEvent.Parameter<intptr_t>();
487 
488  VIATYPE_T viaType = getViaTypeFromFlags( actViaFlags );
489  const bool selectLayer = actViaFlags & VIA_ACTION_FLAGS::SELECT_LAYER;
490 
492 
493  const int layerCount = bds.GetCopperLayerCount();
494  int currentLayer = m_router->GetCurrentLayer();
497 
499 
500  // ask the user for a target layer
501  PCB_LAYER_ID targetLayer = UNDEFINED_LAYER;
502 
503  if( selectLayer )
504  {
505  wxPoint dlgPosition = wxGetMousePosition();
506 
507  targetLayer = m_frame->SelectLayer( static_cast<PCB_LAYER_ID>( currentLayer ),
508  LSET::AllNonCuMask(), dlgPosition );
509  }
510 
511  // fixme: P&S supports more than one fixed layer pair. Update the dialog?
512  sizes.ClearLayerPairs();
513 
514  if( !m_router->IsPlacingVia() )
515  {
516  // Cannot place microvias or blind vias if not allowed (obvious)
517  if( ( viaType == VIA_BLIND_BURIED ) && ( !bds.m_BlindBuriedViaAllowed ) )
518  {
519  DisplayError( m_frame, _( "Blind/buried vias have to be enabled in the design settings." ) );
520  return false;
521  }
522 
523  if( ( viaType == VIA_MICROVIA ) && ( !bds.m_MicroViasAllowed ) )
524  {
525  DisplayError( m_frame, _( "Microvias have to be enabled in the design settings." ) );
526  return false;
527  }
528 
529  // Can only place through vias on 2-layer boards
530  if( ( viaType != VIA_THROUGH ) && ( layerCount <= 2 ) )
531  {
532  DisplayError( m_frame, _( "Only through vias are allowed on 2 layer boards." ) );
533  return false;
534  }
535 
536  // Can only place microvias if we're on an outer layer, or directly adjacent to one
537  if( ( viaType == VIA_MICROVIA ) && ( currentLayer > In1_Cu ) && ( currentLayer < layerCount - 2 ) )
538  {
539  DisplayError( m_frame, _( "Microvias can be placed only between the outer layers " \
540  "(F.Cu/B.Cu) and the ones directly adjacent to them." ) );
541  return false;
542  }
543  }
544 
545  // Convert blind/buried via to a through hole one, if it goes through all layers
546  if( viaType == VIA_BLIND_BURIED && ( ( currentLayer == B_Cu ) || ( currentLayer == F_Cu ) )
547  && ( ( pairTop == B_Cu && pairBottom == F_Cu )
548  || ( pairTop == F_Cu && pairBottom == B_Cu ) ) )
549  {
550  viaType = VIA_THROUGH;
551  }
552 
553  switch( viaType )
554  {
555  case VIA_THROUGH:
556  sizes.SetViaDiameter( bds.GetCurrentViaSize() );
557  sizes.SetViaDrill( bds.GetCurrentViaDrill() );
558 
559  if( targetLayer != UNDEFINED_LAYER )
560  {
561  // go from the current layer to the chosen layer
562  sizes.AddLayerPair( currentLayer, targetLayer );
563  }
564  else
565  {
566  // use the default layer pair
567  sizes.AddLayerPair( pairTop, pairBottom );
568  }
569  break;
570 
571  case VIA_MICROVIA:
572  sizes.SetViaDiameter( bds.GetCurrentMicroViaSize() );
573  sizes.SetViaDrill( bds.GetCurrentMicroViaDrill() );
574 
575  wxASSERT_MSG( !selectLayer, "Unexpected select layer for microvia (microvia layers are implicit)" );
576 
577  if( currentLayer == F_Cu || currentLayer == In1_Cu )
578  {
579  // front-side microvia
580  sizes.AddLayerPair( F_Cu, In1_Cu );
581  }
582  else if( currentLayer == B_Cu || currentLayer == layerCount - 2 )
583  {
584  // back-side microvia
585  sizes.AddLayerPair( B_Cu, layerCount - 2 );
586  }
587  else
588  {
589  wxASSERT_MSG( false, "Invalid layer pair for microvia (must be on or adjacent to an outer layer)" );
590  }
591  break;
592 
593  case VIA_BLIND_BURIED:
594  sizes.SetViaDiameter( bds.GetCurrentViaSize() );
595  sizes.SetViaDrill( bds.GetCurrentViaDrill() );
596 
597  if( targetLayer != UNDEFINED_LAYER )
598  {
599  // go directly to the user specified layer
600  sizes.AddLayerPair( currentLayer, targetLayer );
601  }
602  else
603  {
604  if( currentLayer == pairTop || currentLayer == pairBottom )
605  {
606  // the current layer is on the defined layer pair,
607  // swap to the other side
608  sizes.AddLayerPair( pairTop, pairBottom );
609  }
610  else
611  {
612  // the current layer is not part of the current layer pair,
613  // so fallback and swap to the top layer of the pair by default
614  sizes.AddLayerPair( pairTop, currentLayer );
615  }
616  }
617  break;
618 
619  default:
620  wxASSERT( false );
621  break;
622  }
623 
624  sizes.SetViaType( viaType );
625 
626  m_router->UpdateSizes( sizes );
628 
629  updateEndItem( aEvent );
630 
631  m_router->Move( m_endSnapPoint, m_endItem ); // refresh
632 
633  return 0;
634 }
635 
636 
638 {
639  int routingLayer = getStartLayer( m_startItem );
640 
641  if( !IsCopperLayer( routingLayer ) )
642  {
643  DisplayError( m_frame, _( "Tracks on Copper layers only" ) );
644  return false;
645  }
646 
647  m_frame->SetActiveLayer( ToLAYER_ID( routingLayer ) );
648 
649  // fixme: switch on invisible layer
650 
651  // for some reason I don't understand, GetNetclass() may return null sometimes...
652  if( m_startItem && m_startItem->Net() >= 0 &&
654  {
655  highlightNet( true, m_startItem->Net() );
656  // Update track width and via size shown in main toolbar comboboxes
658  }
659  else
661 
662  m_ctls->ForceCursorPosition( false );
663  m_ctls->SetAutoPan( true );
664 
665  PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
666 
667  sizes.Init( m_board, m_startItem );
668  sizes.AddLayerPair( m_frame->GetScreen()->m_Route_Layer_TOP,
670  m_router->UpdateSizes( sizes );
671 
672  if( !m_router->StartRouting( m_startSnapPoint, m_startItem, routingLayer ) )
673  {
675  highlightNet( false );
676  return false;
677  }
678 
679  m_endItem = NULL;
681 
682  m_frame->UndoRedoBlock( true );
683 
684  return true;
685 }
686 
687 
689 {
691 
692  m_ctls->SetAutoPan( false );
693  m_ctls->ForceCursorPosition( false );
694  m_frame->UndoRedoBlock( false );
695  highlightNet( false );
696 
697  return true;
698 }
699 
700 
702 {
703  if( !prepareInteractive() )
704  return;
705 
706  while( OPT_TOOL_EVENT evt = Wait() )
707  {
708  // Don't crash if we missed an operation that cancelled routing.
709  wxCHECK2( m_router->RoutingInProgress(), break );
710 
711  if( evt->IsMotion() )
712  {
713  m_router->SetOrthoMode( evt->Modifier( MD_CTRL ) );
714  updateEndItem( *evt );
716  }
717  else if( evt->IsClick( BUT_LEFT ) )
718  {
719  updateEndItem( *evt );
720  bool needLayerSwitch = m_router->IsPlacingVia();
721 
723  break;
724 
725  if( needLayerSwitch )
727 
728  // Synchronize the indicated layer
730  updateEndItem( *evt );
732  m_startItem = NULL;
733  }
734  else if( evt->IsAction( &ACT_SwitchPosture ) )
735  {
737  updateEndItem( *evt );
738  m_router->Move( m_endSnapPoint, m_endItem ); // refresh
739  }
740  else if( evt->IsAction( &PCB_ACTIONS::layerChanged ) )
741  {
743  updateEndItem( *evt );
744  m_router->Move( m_endSnapPoint, m_endItem ); // refresh
745  }
746  else if( evt->IsAction( &ACT_EndTrack ) )
747  {
748  bool still_routing = true;
749  while( still_routing )
750  still_routing = m_router->FixRoute( m_endSnapPoint, m_endItem );
751  break;
752  }
753  else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt )
754  || evt->IsUndoRedo()
755  || evt->IsAction( &PCB_ACTIONS::routerInlineDrag ) )
756  break;
757  }
758 
760 }
761 
762 
764 {
765  Activate();
766 
768  DIALOG_PNS_DIFF_PAIR_DIMENSIONS settingsDlg( m_frame, sizes );
769 
770  if( settingsDlg.ShowModal() )
771  {
772  m_router->UpdateSizes( sizes );
773  m_savedSizes = sizes;
774  }
775 
776  return 0;
777 }
778 
779 
781 {
782  Activate();
783 
784  DIALOG_PNS_SETTINGS settingsDlg( m_frame, m_router->Settings() );
785 
786  if( settingsDlg.ShowModal() )
788 
789  return 0;
790 }
791 
792 
794 {
800 
806 
807  // TODO is not this redundant? the same actions can be used for menus and hotkeys
810 
813 }
814 
815 
817 {
818  m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Route Track" ) );
820 }
821 
822 
824 {
825  m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Router Differential Pair" ) );
827 }
828 
829 
831 {
832  PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
833  BOARD* board = getModel<BOARD>();
834 
835  // Deselect all items
837 
838  Activate();
839 
840  m_router->SetMode( aMode );
841 
842  m_ctls->ShowCursor( true );
843 
845 
846  std::unique_ptr<ROUTER_TOOL_MENU> ctxMenu( new ROUTER_TOOL_MENU( board, *frame, aMode ) );
847  SetContextMenu( ctxMenu.get() );
848 
849  // Main loop: keep receiving events
850  while( OPT_TOOL_EVENT evt = Wait() )
851  {
853  {
854  break; // Finish
855  }
856  else if( evt->Action() == TA_UNDO_REDO_PRE )
857  {
858  m_router->ClearWorld();
859  }
860  else if( evt->Action() == TA_UNDO_REDO_POST || evt->Action() == TA_MODEL_CHANGE )
861  {
862  m_router->SyncWorld();
863  }
864  else if( evt->IsMotion() )
865  {
866  updateStartItem( *evt );
867  }
868  else if( evt->IsClick( BUT_LEFT ) || evt->IsAction( &ACT_NewTrack ) )
869  {
870  updateStartItem( *evt );
871 
872  if( evt->Modifier( MD_CTRL ) )
873  performDragging();
874  else
875  performRouting();
876  }
877  else if( evt->IsAction( &ACT_PlaceThroughVia ) )
878  {
880  }
881  else if( evt->IsAction( &PCB_ACTIONS::remove ) )
882  {
883  deleteTraces( m_startItem, true );
884  }
885  else if( evt->IsAction( &PCB_ACTIONS::removeAlt ) )
886  {
887  deleteTraces( m_startItem, false );
888  }
889  }
890 
891  frame->SetToolID( ID_NO_TOOL_SELECTED, wxCURSOR_DEFAULT, wxEmptyString );
892  SetContextMenu( nullptr );
893 
894  // Store routing settings till the next invocation
897 
898  return 0;
899 }
900 
901 
903 {
904  VIEW_CONTROLS* ctls = getViewControls();
905 
906  if( m_startItem && m_startItem->IsLocked() )
907  {
908  if( !IsOK( m_frame, _( "The item is locked. Do you want to continue?" ) ) )
909  return;
910  }
911 
912  bool dragStarted = m_router->StartDragging( m_startSnapPoint, m_startItem );
913 
914  if( !dragStarted )
915  return;
916 
917  if( m_startItem && m_startItem->Net() >= 0 )
918  highlightNet( true, m_startItem->Net() );
919 
920  ctls->SetAutoPan( true );
921 
922  m_frame->UndoRedoBlock( true );
923 
924  while( OPT_TOOL_EVENT evt = Wait() )
925  {
926  ctls->ForceCursorPosition( false );
927 
928  if( evt->IsMotion() )
929  {
930  updateEndItem( *evt );
932  }
933  else if( evt->IsClick( BUT_LEFT ) )
934  {
936  break;
937  }
938  else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt )
939  || evt->IsUndoRedo() )
940  break;
941 
942  handleCommonEvents( *evt );
943  }
944 
945  if( m_router->RoutingInProgress() )
947 
948  m_startItem = NULL;
949 
950  m_frame->UndoRedoBlock( false );
951  ctls->SetAutoPan( false );
952  ctls->ForceCursorPosition( false );
953  highlightNet( false );
954 }
955 
956 
958 {
959  // Get the item under the cursor
961  const auto& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
962 
963  if( selection.Size() != 1 )
964  return 0;
965 
966  const BOARD_CONNECTED_ITEM* item = static_cast<const BOARD_CONNECTED_ITEM*>( selection.Front() );
967 
968  if( item->Type() != PCB_TRACE_T && item->Type() != PCB_VIA_T )
969  return 0;
970 
971  Activate();
972 
974  m_router->SyncWorld();
976 
977  if( m_startItem && m_startItem->IsLocked() )
978  {
979  if( !IsOK( m_frame, _( "The item is locked. Do you want to continue?" ) ) )
980  return false;
981  }
982 
984 
985  bool dragStarted = m_router->StartDragging( p0, m_startItem );
986 
987  if( !dragStarted )
988  return 0;
989 
990  m_ctls->ShowCursor( true );
991  m_ctls->ForceCursorPosition( false );
992  m_ctls->SetAutoPan( true );
993  m_frame->UndoRedoBlock( true );
994 
995  while( OPT_TOOL_EVENT evt = Wait() )
996  {
997  if( evt->IsCancel() )
998  {
999  break;
1000  }
1001  else if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) )
1002  {
1003  updateEndItem( *evt );
1005  }
1006  else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
1007  {
1008  updateEndItem( *evt );
1010  break;
1011  }
1012  }
1013 
1014  if( m_router->RoutingInProgress() )
1015  m_router->StopRouting();
1016 
1017  m_ctls->SetAutoPan( false );
1018  m_ctls->ShowCursor( false );
1019  m_frame->UndoRedoBlock( false );
1020 
1021  return 0;
1022 }
1023 
1024 
1026 {
1028  DIALOG_TRACK_VIA_SIZE sizeDlg( m_frame, bds );
1029 
1030  if( sizeDlg.ShowModal() )
1031  {
1032  bds.UseCustomTrackViaSize( true );
1034  }
1035 
1036  return 0;
1037 }
1038 
1039 
1041 {
1042  PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
1044  m_router->UpdateSizes( sizes );
1045 
1046  return 0;
1047 }
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:56
const LAYER_RANGE & Layers() const
Function Layers()
Definition: pns_item.h:207
TRACK_WIDTH_MENU m_widthMenu
Normal via
Definition: router_tool.cpp:76
bool finishInteractive()
blind/buried via
Definition: router_tool.cpp:77
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:134
Class that computes missing connections on a PCB.
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:98
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
Microvia
Definition: router_tool.cpp:80
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:115
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:253
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:169
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:466
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:1115
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
void SwitchLayer(int layer)
Definition: pns_router.cpp:403
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:175
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:475
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:416
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:107
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:119
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:181
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:341
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:530
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:178
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:202
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:189
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
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:366
virtual void highlightNet(bool aEnabled, int aNetcode=-1)
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
ROUTER_MODE
Definition: pns_router.h:64
Class NETINFO_ITEM handles the data for a net.
void SetViaType(VIATYPE_T aViaType)
static TOOL_ACTION layerChanged
Definition: pcb_actions.h:245
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:285
const wxString & GetClassName() const
Function GetClassName returns the class name.
void SetMode(ROUTER_MODE aMode)
Definition: pns_router.cpp:484
int getDefaultWidth(int aNetCode)
static TOOL_ACTION routerActivateSettingsDialog
Activation of the Push and Shove settings dialogs.
Definition: pcb_actions.h:184
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:166
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:435
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:443
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:394
static TOOL_ACTION remove
Deleting a BOARD_ITEM.
Definition: pcb_actions.h:114
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:172
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:885
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:71
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:243
static TOOL_ACTION routerActivateDpDimensionsDialog
Definition: pcb_actions.h:185
virtual void updateStartItem(TOOL_EVENT &aEvent)