KiCad PCB EDA Suite
router_tool.cpp File Reference
#include <wx/numdlg.h>
#include <boost/optional.hpp>
#include <functional>
#include "class_draw_panel_gal.h"
#include "class_board.h"
#include <wxPcbStruct.h>
#include <id.h>
#include <macros.h>
#include <pcbnew_id.h>
#include <view/view.h>
#include <view/view_controls.h>
#include <pcb_painter.h>
#include <dialogs/dialog_pns_settings.h>
#include <dialogs/dialog_pns_diff_pair_dimensions.h>
#include <dialogs/dialog_track_via_size.h>
#include <base_units.h>
#include <hotkeys.h>
#include <confirm.h>
#include <bitmaps.h>
#include <tool/context_menu.h>
#include <tool/tool_manager.h>
#include <tool/tool_settings.h>
#include <tool/grid_menu.h>
#include <tool/zoom_menu.h>
#include <tools/pcb_actions.h>
#include <tools/size_menu.h>
#include <tools/selection_tool.h>
#include <tools/edit_tool.h>
#include <tools/tool_event_utils.h>
#include "router_tool.h"
#include "pns_segment.h"
#include "pns_router.h"

Go to the source code of this file.

Classes

class  TRACK_WIDTH_MENU
 
class  ROUTER_TOOL_MENU
 

Enumerations

enum  VIA_ACTION_FLAGS {
  VIA_MASK = 0x03, VIA = 0x00, BLIND_VIA = 0x01, MICROVIA = 0x02,
  SELECT_LAYER = VIA_MASK + 1
}
 Flags used by via tool actions. More...
 

Functions

static VIATYPE_T getViaTypeFromFlags (int aFlags)
 

Variables

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)
 
static const TOOL_ACTION ACT_EndTrack ("pcbnew.InteractiveRouter.EndTrack", AS_CONTEXT, WXK_END, _("End Track"), _("Stops laying the current track."), checked_ok_xpm)
 
static const TOOL_ACTION ACT_AutoEndRoute ("pcbnew.InteractiveRouter.AutoEndRoute", AS_CONTEXT, 'F', _("Auto-end Track"), _("Automagically finishes currently routed track."))
 
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 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 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)
 
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))
 
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))
 
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)
 
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)
 
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)
 

Enumeration Type Documentation

Flags used by via tool actions.

Enumerator
VIA_MASK 
VIA 
BLIND_VIA 

Normal via

MICROVIA 

blind/buried via

SELECT_LAYER 

Microvia

Definition at line 69 of file router_tool.cpp.

70 {
71  // Via type
72  VIA_MASK = 0x03,
73  VIA = 0x00,
74  BLIND_VIA = 0x01,
75  MICROVIA = 0x02,
76 
77  // Select layer
78  SELECT_LAYER = VIA_MASK + 1,
79 };
Normal via
Definition: router_tool.cpp:74
blind/buried via
Definition: router_tool.cpp:75
Microvia
Definition: router_tool.cpp:78

Function Documentation

static VIATYPE_T getViaTypeFromFlags ( int  aFlags)
static

Definition at line 457 of file router_tool.cpp.

References BLIND_VIA, MICROVIA, VIA, VIA_BLIND_BURIED, VIA_MASK, VIA_MICROVIA, and VIA_THROUGH.

Referenced by ROUTER_TOOL::onViaCommand().

458 {
459  VIATYPE_T viaType = VIA_THROUGH;
460 
461  switch( aFlags & VIA_ACTION_FLAGS::VIA_MASK )
462  {
464  viaType = VIA_THROUGH;
465  break;
467  viaType = VIA_BLIND_BURIED;
468  break;
470  viaType = VIA_MICROVIA;
471  break;
472  default:
473  wxASSERT_MSG( false, "Unhandled via type" );
474  }
475 
476  wxLogDebug("via type %d", viaType );
477 
478  return viaType;
479 }
Normal via
Definition: router_tool.cpp:74
blind/buried via
Definition: router_tool.cpp:75
VIATYPE_T
Definition: class_track.h:49

Variable Documentation

const TOOL_ACTION ACT_AutoEndRoute("pcbnew.InteractiveRouter.AutoEndRoute", AS_CONTEXT, 'F', _("Auto-end Track"), _("Automagically finishes currently routed track."))
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)
static
const TOOL_ACTION ACT_EndTrack("pcbnew.InteractiveRouter.EndTrack", AS_CONTEXT, WXK_END, _("End Track"), _("Stops laying the current track."), checked_ok_xpm)
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)
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
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)
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
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))
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))
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)
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)
static