KiCad PCB EDA Suite
ROUTER_TOOL Class Reference

#include <router_tool.h>

Inheritance diagram for ROUTER_TOOL:
PNS::TOOL_BASE PCB_TOOL TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 ROUTER_TOOL ()
 
 ~ROUTER_TOOL ()
 
bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
int RouteSingleTrace (const TOOL_EVENT &aEvent)
 
int RouteDiffPair (const TOOL_EVENT &aEvent)
 
bool CanInlineDrag ()
 
int InlineDrag (const TOOL_EVENT &aEvent)
 
int DpDimensionsDialog (const TOOL_EVENT &aEvent)
 
int SettingsDialog (const TOOL_EVENT &aEvent)
 
int CustomTrackWidthDialog (const TOOL_EVENT &aEvent)
 
void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. More...
 
ROUTER * Router () const
 
void SetEditModules (bool aEnabled)
 Function SetEditModules() More...
 
bool EditingModules () const
 
void Activate ()
 Function Activate() Runs the tool. More...
 
void SetContextMenu (CONTEXT_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Function SetContextMenu() More...
 
void RunMainStack (std::function< void()> aFunc)
 Function RunMainStack() More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Go() More...
 
OPT_TOOL_EVENT Wait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Function Wait() More...
 
TOOL_TYPE GetType () const
 Function GetType() Returns the type of the tool. More...
 
TOOL_ID GetId () const
 Function GetId() Returns the unique identifier of the tool. More...
 
const std::string & GetName () const
 Function GetName() Returns the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool. More...
 
TOOL_SETTINGSGetSettings ()
 
bool IsToolActive () const
 

Static Public Member Functions

static void NeighboringSegmentFilter (const VECTOR2I &aPt, GENERAL_COLLECTOR &aCollector)
 

Protected Types

enum  INTERACTIVE_PLACEMENT_OPTIONS {
  IPO_ROTATE = 1, IPO_FLIP = 2, IPO_PROPERTIES = 4, IPO_SINGLE_CLICK = 8,
  IPO_REPEAT = 16
}
 

Protected Member Functions

bool checkSnap (ITEM *aItem)
 
const VECTOR2I snapToItem (bool aEnabled, ITEM *aItem, VECTOR2I aP)
 
virtual ITEM * pickSingleItem (const VECTOR2I &aWhere, int aNet=-1, int aLayer=-1, bool aIgnorePads=false)
 
virtual void highlightNet (bool aEnabled, int aNetcode=-1)
 
virtual void updateStartItem (TOOL_EVENT &aEvent, bool aIgnorePads=false)
 
virtual void updateEndItem (const TOOL_EVENT &aEvent)
 
void deleteTraces (ITEM *aStartItem, bool aWholeTrack)
 
void doInteractiveItemPlacement (INTERACTIVE_PLACER_BASE *aPlacer, const wxString &aCommitMessage, int aOptions=IPO_ROTATE|IPO_FLIP|IPO_REPEAT)
 Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc. More...
 
KIGFX::PCB_VIEWview () const
 
KIGFX::VIEW_CONTROLScontrols () const
 
PCB_EDIT_FRAMEframe () const
 
BOARDboard () const
 
MODULEmodule () const
 
PCB_DISPLAY_OPTIONSdisplayOptions () const
 
PCB_DRAW_PANEL_GALcanvas () const
 
const SELECTIONselection () const
 
SELECTIONselection ()
 
const TOOL_EVENT evActivate (std::string aToolName="")
 functions below are not yet implemented - their interface may change More...
 
const TOOL_EVENT evCommand (int aCommandId=-1)
 
const TOOL_EVENT evCommand (std::string aCommandStr="")
 
const TOOL_EVENT evMotion ()
 
const TOOL_EVENT evClick (int aButton=BUT_ANY)
 
const TOOL_EVENT evDrag (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonUp (int aButton=BUT_ANY)
 
const TOOL_EVENT evButtonDown (int aButton=BUT_ANY)
 
void attachManager (TOOL_MANAGER *aManager)
 Function attachManager() More...
 
KIGFX::VIEWgetView () const
 Function getView() More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Function getViewControls() More...
 
template<typename T >
T * getEditFrame () const
 Function getEditFrame() More...
 
template<typename T >
T * getModel () const
 Function getModel() More...
 

Protected Attributes

MSG_PANEL_ITEMS m_panelItems
 
ROUTING_SETTINGS m_savedSettings
 Stores routing settings between router invocations. More...
 
SIZES_SETTINGS m_savedSizes
 Stores sizes settings between router invocations. More...
 
ITEM * m_startItem
 
int m_startLayer
 
VECTOR2I m_startSnapPoint
 
ITEM * m_endItem
 
VECTOR2I m_endSnapPoint
 
GRID_HELPERm_gridHelper
 
PNS_KICAD_IFACEm_iface
 
ROUTER * m_router
 
bool m_editModules
 
TOOL_TYPE m_type
 

Stores the type of the tool.

More...
 
TOOL_ID m_toolId
 

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

More...
 
std::string m_toolName
 

Name of the tool.

More...
 
TOOL_MANAGERm_toolMgr
 
TOOL_SETTINGS m_toolSettings
 

Private Member Functions

int mainLoop (PNS::ROUTER_MODE aMode)
 
int getDefaultWidth (int aNetCode)
 
void performRouting ()
 
void performDragging (int aMode=PNS::DM_ANY)
 
void breakTrack ()
 
void getNetclassDimensions (int aNetCode, int &aWidth, int &aViaDiameter, int &aViaDrill)
 
void handleCommonEvents (const TOOL_EVENT &evt)
 
int getStartLayer (const PNS::ITEM *aItem)
 
void switchLayerOnViaPlacement ()
 
int onViaCommand (const TOOL_EVENT &aEvent)
 
int onTrackViaSizeChanged (const TOOL_EVENT &aEvent)
 
int onLayerChanged (const TOOL_EVENT &aEvent)
 
bool prepareInteractive ()
 
bool finishInteractive ()
 

Detailed Description

Definition at line 28 of file router_tool.h.

Member Enumeration Documentation

enum PCB_TOOL::INTERACTIVE_PLACEMENT_OPTIONS
protectedinherited
Enumerator
IPO_ROTATE 
IPO_FLIP 
IPO_PROPERTIES 
IPO_SINGLE_CLICK 
IPO_REPEAT 

Definition at line 106 of file pcb_tool.h.

enum TOOL_BASE::RESET_REASON
inherited

Determines the reason of reset for a tool

Enumerator
RUN 

Tool is invoked after being inactive.

MODEL_RELOAD 

Model changes (required full reload)

GAL_SWITCH 

Rendering engine changes.

Definition at line 80 of file tool_base.h.

81  {
82  RUN,
83  MODEL_RELOAD,
84  GAL_SWITCH
85  };
Model changes (required full reload)
Definition: tool_base.h:83
Tool is invoked after being inactive.
Definition: tool_base.h:82
Rendering engine changes.
Definition: tool_base.h:84

Constructor & Destructor Documentation

ROUTER_TOOL::ROUTER_TOOL ( )

Definition at line 196 of file router_tool.cpp.

196  :
197  TOOL_BASE( "pcbnew.InteractiveRouter" )
198 {
199 }
TOOL_BASE(const std::string &aToolName)
ROUTER_TOOL::~ROUTER_TOOL ( )

Definition at line 361 of file router_tool.cpp.

References TOOL_BASE::GetSettings(), PNS::TOOL_BASE::m_savedSettings, and PNS::ROUTING_SETTINGS::Save().

362 {
364 }
ROUTING_SETTINGS m_savedSettings
Stores routing settings between router invocations.
Definition: pns_tool_base.h:66
TOOL_SETTINGS & GetSettings()
Definition: tool_base.cpp:77
void Save(TOOL_SETTINGS &where) const

Member Function Documentation

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

After activation, the tool starts receiving events until it is finished.

Definition at line 49 of file tool_interactive.cpp.

References TOOL_MANAGER::InvokeTool(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

Referenced by EDIT_TOOL::copyToClipboard(), PCBNEW_CONTROL::DeleteItemCursor(), PCB_TOOL::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNetCursor(), InlineDrag(), EDIT_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), mainLoop(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), EDIT_TOOL::pickCopyReferencePoint(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), and PCB_EDITOR_CONTROL::ShowLocalRatsnest().

50 {
52 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:210
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID...
void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Function attachManager()

Sets the TOOL_MANAGER the tool will belong to. Called by TOOL_MANAGER::RegisterTool()

Definition at line 59 of file tool_base.cpp.

References TOOL_BASE::m_toolMgr, TOOL_BASE::m_toolSettings, and TOOL_BASE::TOOL_SETTINGS.

Referenced by TOOL_MANAGER::RegisterTool().

60 {
61  m_toolMgr = aManager;
62  m_toolSettings = TOOL_SETTINGS( this );
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:216
friend class TOOL_SETTINGS
Definition: tool_base.h:155
BOARD* PCB_TOOL::board ( ) const
inlineprotectedinherited

Definition at line 137 of file pcb_tool.h.

Referenced by PCBNEW_CONTROL::AppendBoard(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), EDIT_TOOL::changeTrackWidthOnClick(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), CustomTrackWidthDialog(), PCB_TOOL::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), MODULE_EDITOR_TOOLS::EnumeratePads(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), POINT_EDITOR::finishItem(), SELECTION_TOOL::getCollectorsGuide(), getNetclassDimensions(), PCBNEW_CONTROL::GraphicDisplayMode(), PAD_TOOL::haveFootprints(), highlightNet(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), mainLoop(), PCBNEW_CONTROL::ModuleEdgeOutlines(), PCBNEW_CONTROL::ModuleTextOutlines(), POINT_EDITOR::OnSelectionChange(), onTrackViaSizeChanged(), onViaCommand(), PCBNEW_CONTROL::PadDisplayMode(), PCBNEW_CONTROL::PasteItemsFromClipboard(), PCBNEW_CONTROL::placeBoardItems(), MODULE_EDITOR_TOOLS::PlacePad(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), prepareInteractive(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), SELECTION_TOOL::selectable(), SELECTION_TOOL::selectAllItemsConnectedToItem(), SELECTION_TOOL::selectAllItemsConnectedToTrack(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectAllItemsOnSheet(), SELECTION_TOOL::selectPoint(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), PCBNEW_CONTROL::TrackDisplayMode(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), PCBNEW_CONTROL::ViaDisplayMode(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), PCBNEW_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), ZONE_FILLER_TOOL::ZoneFillAll(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

137 { return getModel<BOARD>(); }
void ROUTER_TOOL::breakTrack ( )
private

Definition at line 834 of file router_tool.cpp.

References PNS::ROUTER::BreakSegment(), PNS::TOOL_BASE::m_router, PNS::TOOL_BASE::m_startItem, PNS::TOOL_BASE::m_startSnapPoint, PNS::ITEM::OfKind(), and PNS::ITEM::SEGMENT_T.

Referenced by mainLoop().

835 {
837  {
839  }
840 }
VECTOR2I m_startSnapPoint
Definition: pns_tool_base.h:70
bool OfKind(int aKindMask) const
Function OfKind()
Definition: pns_item.h:132
void BreakSegment(ITEM *aItem, const VECTOR2I &aP)
Definition: pns_router.cpp:519
ITEM * m_startItem
Definition: pns_tool_base.h:68
ROUTER * m_router
Definition: pns_tool_base.h:77
bool ROUTER_TOOL::CanInlineDrag ( )

Definition at line 1038 of file router_tool.cpp.

References SELECTION::Front(), TOOL_MANAGER::GetTool(), TOOL_BASE::m_toolMgr, NeighboringSegmentFilter(), PCB_TRACE_T, PCB_VIA_T, TOOL_MANAGER::RunAction(), PCB_TOOL::selection(), PCB_ACTIONS::selectionCursor, SELECTION::Size(), and EDA_ITEM::Type().

1039 {
1041  const auto& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
1042 
1043  if( selection.Size() == 1 )
1044  {
1045  const BOARD_CONNECTED_ITEM* item = static_cast<const BOARD_CONNECTED_ITEM*>( selection.Front() );
1046 
1047  if( item->Type() == PCB_TRACE_T || item->Type() == PCB_VIA_T )
1048  return true;
1049  }
1050 
1051  return false;
1052 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
Class SELECTION_TOOL.
EDA_ITEM * Front() const
Definition: selection.h:147
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
static void NeighboringSegmentFilter(const VECTOR2I &aPt, GENERAL_COLLECTOR &aCollector)
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
int Size() const
Returns the number of selected parts.
Definition: selection.h:115
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
Definition: pcb_actions.h:50
PCB_DRAW_PANEL_GAL * PCB_TOOL::canvas ( ) const
protectedinherited
bool TOOL_BASE::checkSnap ( ITEM aItem)
protectedinherited

Definition at line 223 of file pns_tool_base.cpp.

References CAPTURE_ALWAYS, CAPTURE_CURSOR_IN_TRACK_TOOL, PCB_TOOL::frame(), PNS::TOOL_BASE::m_router, PNS::ITEM::OfKind(), PNS::ITEM::SEGMENT_T, PNS::ROUTER::Settings(), PCB_BASE_FRAME::Settings(), PNS::ITEM::SOLID_T, and PNS::ITEM::VIA_T.

Referenced by PNS::TOOL_BASE::updateEndItem(), and PNS::TOOL_BASE::updateStartItem().

224 {
225  bool doSnap = false;
226 
227  // Sync PNS engine settings with the general PCB editor options. I know the code below is awful, but...
228  auto& pnss = m_router->Settings();
229  const auto& gens = frame()->Settings();
230 
231  pnss.SetSnapToTracks( false );
232  pnss.SetSnapToPads( false );
233 
234  if( gens.m_magneticPads == CAPTURE_CURSOR_IN_TRACK_TOOL || gens.m_magneticPads == CAPTURE_ALWAYS )
235  pnss.SetSnapToPads( true );
236 
237  if( gens.m_magneticTracks == CAPTURE_CURSOR_IN_TRACK_TOOL || gens.m_magneticTracks == CAPTURE_ALWAYS )
238  pnss.SetSnapToTracks( true );
239 
240  if( aItem )
241  {
242  if( ( aItem->OfKind( ITEM::VIA_T ) || aItem->OfKind( ITEM::SEGMENT_T ) ) && pnss.GetSnapToTracks() )
243  doSnap = true;
244  else if( aItem->OfKind( ITEM::SOLID_T ) && pnss.GetSnapToPads() )
245  doSnap = true;
246  }
247 
248  return doSnap;
249 }
PCB_GENERAL_SETTINGS & Settings()
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
ROUTER * m_router
Definition: pns_tool_base.h:77
ROUTING_SETTINGS & Settings()
Definition: pns_router.h:187
int ROUTER_TOOL::CustomTrackWidthDialog ( const TOOL_EVENT aEvent)

Definition at line 1126 of file router_tool.cpp.

References PCB_TOOL::board(), PCB_TOOL::frame(), BOARD::GetDesignSettings(), TOOL_BASE::m_toolMgr, TOOL_MANAGER::RunAction(), PCB_ACTIONS::trackViaSizeChanged, and BOARD_DESIGN_SETTINGS::UseCustomTrackViaSize().

Referenced by setTransitions().

1127 {
1129  DIALOG_TRACK_VIA_SIZE sizeDlg( frame(), bds );
1130 
1131  if( sizeDlg.ShowModal() )
1132  {
1133  bds.UseCustomTrackViaSize( true );
1135  }
1136 
1137  return 0;
1138 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:291
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:535
Implementing DIALOG_TRACK_VIA_SIZE_BASE.
void UseCustomTrackViaSize(bool aEnabled)
Function UseCustomTrackViaSize Enables/disables custom track/via size settings.
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
BOARD * board() const
Definition: pcb_tool.h:137
void TOOL_BASE::deleteTraces ( ITEM aStartItem,
bool  aWholeTrack 
)
protectedinherited

Definition at line 340 of file pns_tool_base.cpp.

References PNS::TOPOLOGY::AssembleTrivialPath(), PNS::NODE::Branch(), PNS::ROUTER::CommitRouting(), PNS::ROUTER::GetWorld(), PNS::ITEM_SET::Items(), PNS::TOOL_BASE::m_router, and PNS::NODE::Remove().

341 {
342  NODE *node = m_router->GetWorld()->Branch();
343 
344  if( !aStartItem )
345  return;
346 
347  if( !aWholeTrack )
348  {
349  node->Remove( aStartItem );
350  }
351  else
352  {
353  TOPOLOGY topo( node );
354  ITEM_SET path = topo.AssembleTrivialPath( aStartItem );
355 
356  for( auto ent : path.Items() )
357  node->Remove( ent.item );
358  }
359 
360  m_router->CommitRouting( node );
361 }
NODE * Branch()
Function Branch()
Definition: pns_node.cpp:107
NODE * GetWorld() const
Definition: pns_router.h:143
ROUTER * m_router
Definition: pns_tool_base.h:77
void Remove(SOLID *aSolid)
Function Remove()
Definition: pns_node.cpp:729
void CommitRouting(NODE *aNode)
Definition: pns_router.cpp:347
PCB_DISPLAY_OPTIONS * PCB_TOOL::displayOptions ( ) const
protectedinherited

Definition at line 211 of file pcb_tool.cpp.

References PCB_TOOL::frame(), and PCB_BASE_FRAME::GetDisplayOptions().

Referenced by PCBNEW_CONTROL::GraphicDisplayMode(), PCBNEW_CONTROL::HighContrastMode(), PCBNEW_CONTROL::ModuleEdgeOutlines(), PCBNEW_CONTROL::ModuleTextOutlines(), PCBNEW_CONTROL::PadDisplayMode(), PNS::TOOL_BASE::pickSingleItem(), PCBNEW_CONTROL::TrackDisplayMode(), PCBNEW_CONTROL::ViaDisplayMode(), and PCBNEW_CONTROL::ZoneDisplayMode().

212 {
213  return static_cast<PCB_DISPLAY_OPTIONS*>( frame()->GetDisplayOptions() );
214 }
void * GetDisplayOptions() override
Function GetDisplayOptions returns the display options current in use Display options are relative to...
Class PCB_DISPLAY_OPTIONS handles display options like enable/disable some optional drawings...
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
void PCB_TOOL::doInteractiveItemPlacement ( INTERACTIVE_PLACER_BASE aPlacer,
const wxString &  aCommitMessage,
int  aOptions = IPO_ROTATE | IPO_FLIP | IPO_REPEAT 
)
protectedinherited

Helper function for performing a common interactive idiom: wait for a left click, place an item there (perhaps with a dialog or other user interaction), then have it move with the mouse and respond to rotate/flip, etc.

More complex interactive processes are not supported here, you should implement a customised event loop for those.

Parameters
aItemCreatorthe callable that will attempt to create the item
aCommitMessagethe message used on a successful commit

Definition at line 39 of file pcb_tool.cpp.

References TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), KIGFX::VIEW_GROUP::Add(), SELECTION::Add(), PCB_TOOL::board(), BUT_LEFT, KIGFX::VIEW_CONTROLS::CaptureCursor(), SELECTION::Clear(), PCB_TOOL::controls(), INTERACTIVE_PLACER_BASE::CreateItem(), dyn_cast(), PCB_ACTIONS::flip, PCB_TOOL::frame(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_EVT_UTILS::GetEventRotationAngle(), TOOL_BASE::GetManager(), PCB_TOOL::IPO_FLIP, PCB_TOOL::IPO_REPEAT, PCB_TOOL::IPO_ROTATE, PCB_TOOL::IPO_SINGLE_CLICK, TOOL_EVT_UTILS::IsCancelInteractive(), TOOL_EVT_UTILS::IsRotateToolEvt(), INTERACTIVE_PLACER_BASE::m_board, INTERACTIVE_PLACER_BASE::m_frame, INTERACTIVE_PLACER_BASE::m_modifiers, PCB_TOOL::module(), PCB_MODULE_T, INTERACTIVE_PLACER_BASE::PlaceItem(), BOARD_COMMIT::Push(), KIGFX::PCB_VIEW::Remove(), KIGFX::VIEW_GROUP::Remove(), SELECTION::Remove(), TOOL_MANAGER::RunAction(), MODULE::RunOnChildren(), PCB_ACTIONS::selectionClear, KIGFX::VIEW_CONTROLS::SetAutoPan(), KIGFX::VIEW_CONTROLS::SetSnapping(), KIGFX::VIEW_CONTROLS::ShowCursor(), INTERACTIVE_PLACER_BASE::SnapItem(), TC_COMMAND, KIGFX::PCB_VIEW::Update(), PCB_TOOL::view(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by MICROWAVE_TOOL::addMicrowaveFootprint(), DRAWING_TOOL::DrawVia(), and MODULE_EDITOR_TOOLS::PlacePad().

42 {
43  using namespace std::placeholders;
44  std::unique_ptr<BOARD_ITEM> newItem;
45 
46  Activate();
47 
48  BOARD_COMMIT commit( frame() );
49 
51 
52  // do not capture or auto-pan until we start placing an item
53  controls()->ShowCursor( true );
54  controls()->SetSnapping( true );
55 
56  // Add a VIEW_GROUP that serves as a preview for the new item
57  SELECTION preview;
58  view()->Add( &preview );
59 
60  aPlacer->m_board = board();
61  aPlacer->m_frame = frame();
62  aPlacer->m_modifiers = 0;
63 
64  if( aOptions & IPO_SINGLE_CLICK )
65  {
66  VECTOR2I cursorPos = controls()->GetCursorPosition();
67 
68  newItem = aPlacer->CreateItem();
69  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
70 
71  preview.Add( newItem.get() );
72  }
73 
74  // Main loop: keep receiving events
75  while( OPT_TOOL_EVENT evt = Wait() )
76  {
77  VECTOR2I cursorPos = controls()->GetCursorPosition();
78  aPlacer->m_modifiers = evt->Modifier();
79 
81  {
82  if( newItem )
83  {
84  // Delete the old item and have another try
85  newItem = nullptr;
86 
87  preview.Clear();
88 
89  if( aOptions & IPO_SINGLE_CLICK )
90  break;
91 
92  controls()->SetAutoPan( false );
93  controls()->CaptureCursor( false );
94  controls()->ShowCursor( true );
95  }
96  else
97  {
98  break;
99  }
100 
101  if( evt->IsActivate() ) // now finish unconditionally
102  break;
103  }
104 
105  else if( evt->IsClick( BUT_LEFT ) )
106  {
107  if( !newItem )
108  {
109  // create the item if possible
110  newItem = aPlacer->CreateItem();
111 
112  // no item created, so wait for another click
113  if( !newItem )
114  continue;
115 
116  controls()->CaptureCursor( true );
117  controls()->SetAutoPan( true );
118 
119  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
120 
121  preview.Add( newItem.get() );
122 
123  if( newItem->Type() == PCB_MODULE_T )
124  {
125  auto module = dyn_cast<MODULE*>( newItem.get() );
126 
127  // modules have more drawable parts
128  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
129  }
130  }
131  else
132  {
133  newItem->ClearFlags();
134  preview.Remove( newItem.get() );
135 
136  aPlacer->PlaceItem( newItem.get(), commit );
137 
138  if( newItem->Type() == PCB_MODULE_T )
139  {
140  auto module = dyn_cast<MODULE*>( newItem.get() );
141  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Remove, &preview, _1 ) );
142  }
143 
144  newItem.release();
145  commit.Push( aCommitMessage );
146 
147  controls()->CaptureCursor( false );
148  controls()->SetAutoPan( false );
149  controls()->ShowCursor( true );
150 
151  if( !( aOptions & IPO_REPEAT ) )
152  break;
153 
154  if( aOptions & IPO_SINGLE_CLICK )
155  {
157 
158  newItem = aPlacer->CreateItem();
159  newItem->SetPosition( wxPoint( pos.x, pos.y ) );
160 
161  preview.Add( newItem.get() );
162  }
163  }
164  }
165 
166  else if( newItem && evt->Category() == TC_COMMAND )
167  {
168  /*
169  * Handle any events that can affect the item as we move
170  * it around, eg rotate and flip
171  */
172 
173  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
174  {
175  const auto rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle(
176  *frame(), *evt );
177  newItem->Rotate( newItem->GetPosition(), rotationAngle );
178  view()->Update( &preview );
179  }
180  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
181  {
182  newItem->Flip( newItem->GetPosition() );
183  view()->Update( &preview );
184  }
185  }
186 
187  else if( newItem && evt->IsMotion() )
188  {
189  // track the cursor
190  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
191  aPlacer->SnapItem( newItem.get() );
192 
193  // Show a preview of the item
194  view()->Update( &preview );
195  }
196  }
197 
198  view()->Remove( &preview );
199 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
virtual void PlaceItem(BOARD_ITEM *aItem, BOARD_COMMIT &aCommit)
Definition: pcb_tool.cpp:241
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:84
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction)
Function RunOnChildren.
virtual void Update(VIEW_ITEM *aItem, int aUpdateFlags) override
For dynamic VIEWs, informs the associated VIEW that the graphical representation of this item has cha...
Definition: pcb_view.cpp:81
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual void SetSnapping(bool aEnabled)
Function SetSnapping() Enables/disables snapping cursor to grid.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
PCB_EDIT_FRAME * m_frame
Definition: pcb_tool.h:58
bool IsRotateToolEvt(const TOOL_EVENT &aEvt)
Function isRotateToolEvt()
Casted dyn_cast(From aObject)
Function dyn_cast()
Definition: typeinfo.h:61
virtual void Remove(VIEW_ITEM *aItem) override
Function Remove() Removes a VIEW_ITEM from the view.
Definition: pcb_view.cpp:64
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:74
virtual void SnapItem(BOARD_ITEM *aItem)
Definition: pcb_tool.cpp:236
KIGFX::VIEW_CONTROLS * controls() const
Definition: pcb_tool.h:135
class MODULE, a footprint
Definition: typeinfo.h:89
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area. ...
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
MODULE * module() const
Definition: pcb_tool.h:138
virtual void Remove(VIEW_ITEM *aItem)
Function Remove() Removes an item from the group.
Definition: view_group.cpp:61
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
virtual void Add(VIEW_ITEM *aItem)
Function Add() Adds an item to the group.
Definition: view_group.cpp:55
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg...
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:102
KIGFX::PCB_VIEW * view() const
Definition: pcb_tool.h:134
TOOL_MANAGER * GetManager() const
Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool...
Definition: tool_base.h:144
void Activate()
Function Activate() Runs the tool.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Function Add() Adds a VIEW_ITEM to the view.
Definition: pcb_view.cpp:48
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:465
BOARD * board() const
Definition: pcb_tool.h:137
virtual void Remove(EDA_ITEM *aItem)
Definition: selection.h:79
int ROUTER_TOOL::DpDimensionsDialog ( const TOOL_EVENT aEvent)

Definition at line 775 of file router_tool.cpp.

References PCB_TOOL::frame(), PNS::TOOL_BASE::m_router, PNS::TOOL_BASE::m_savedSizes, PNS::ROUTER::Sizes(), and PNS::ROUTER::UpdateSizes().

Referenced by setTransitions().

776 {
778  DIALOG_PNS_DIFF_PAIR_DIMENSIONS settingsDlg( frame(), sizes );
779 
780  if( settingsDlg.ShowModal() == wxID_OK )
781  {
782  m_router->UpdateSizes( sizes );
783  m_savedSizes = sizes;
784  }
785 
786  return 0;
787 }
SIZES_SETTINGS m_savedSizes
Stores sizes settings between router invocations.
Definition: pns_tool_base.h:67
SIZES_SETTINGS & Sizes()
Definition: pns_router.h:206
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
ROUTER * m_router
Definition: pns_tool_base.h:77
void UpdateSizes(const SIZES_SETTINGS &aSizes)
Applies stored settings.
Definition: pns_router.cpp:308
bool PCB_TOOL::EditingModules ( ) const
inlineinherited

Definition at line 99 of file pcb_tool.h.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), PAD_TOOL::Init(), and EDIT_TOOL::MeasureTool().

100  {
101  return m_editModules;
102  }
bool m_editModules
Definition: pcb_tool.h:144
const TOOL_EVENT TOOL_INTERACTIVE::evActivate ( std::string  aToolName = "")
protectedinherited

functions below are not yet implemented - their interface may change

const TOOL_EVENT TOOL_INTERACTIVE::evButtonDown ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evButtonUp ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evClick ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( int  aCommandId = -1)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evCommand ( std::string  aCommandStr = "")
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evDrag ( int  aButton = BUT_ANY)
protectedinherited
const TOOL_EVENT TOOL_INTERACTIVE::evMotion ( )
protectedinherited
bool ROUTER_TOOL::finishInteractive ( )
private

Definition at line 698 of file router_tool.cpp.

References PCB_TOOL::controls(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PCB_TOOL::frame(), PNS::TOOL_BASE::highlightNet(), PNS::TOOL_BASE::m_router, KIGFX::VIEW_CONTROLS::SetAutoPan(), PNS::ROUTER::StopRouting(), and PCB_BASE_EDIT_FRAME::UndoRedoBlock().

Referenced by performRouting().

699 {
701 
702  controls()->SetAutoPan( false );
703  controls()->ForceCursorPosition( false );
704  frame()->UndoRedoBlock( false );
705  highlightNet( false );
706 
707  return true;
708 }
void UndoRedoBlock(bool aBlock=true)
Function UndoRedoBlock Enables/disable undo and redo operations.
KIGFX::VIEW_CONTROLS * controls() const
Definition: pcb_tool.h:135
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
ROUTER * m_router
Definition: pns_tool_base.h:77
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg...
void StopRouting()
Definition: pns_router.cpp:389
virtual void highlightNet(bool aEnabled, int aNetcode=-1)
PCB_EDIT_FRAME* PCB_TOOL::frame ( ) const
inlineprotectedinherited

Definition at line 136 of file pcb_tool.h.

Referenced by POINT_EDITOR::addCorner(), MICROWAVE_TOOL::addMicrowaveFootprint(), PAD_TOOL::applyPadSettings(), PCB_TOOL::canvas(), EDIT_TOOL::changeTrackWidthOnClick(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), CustomTrackWidthDialog(), PCB_TOOL::displayOptions(), PCB_TOOL::doInteractiveItemPlacement(), DpDimensionsDialog(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawVia(), MODULE_EDITOR_TOOLS::EnumeratePads(), EDIT_TOOL::ExchangeFootprints(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), finishInteractive(), getMicrowaveItemCreator(), highlightNet(), PICKER_TOOL::Init(), PAD_TOOL::Init(), EDIT_TOOL::Init(), SELECTION_TOOL::Init(), InlineDrag(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), mainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), onViaCommand(), PCBNEW_CONTROL::PasteItemsFromClipboard(), performDragging(), performRouting(), LENGTH_TUNER_TOOL::performTuning(), MODULE_EDITOR_TOOLS::PlacePad(), DRAWING_TOOL::PlaceText(), prepareInteractive(), PAD_TOOL::pushPadSettings(), POINT_EDITOR::removeCorner(), PNS::TOOL_BASE::Reset(), RouteDiffPair(), RouteSingleTrace(), SettingsDialog(), switchLayerOnViaPlacement(), LENGTH_TUNER_TOOL::TuneDiffPair(), LENGTH_TUNER_TOOL::TuneDiffPairSkew(), LENGTH_TUNER_TOOL::TuneSingleTrace(), POINT_EDITOR::updateItem(), ZONE_FILLER_TOOL::ZoneFill(), and ZONE_FILLER_TOOL::ZoneFillAll().

136 { return getEditFrame<PCB_EDIT_FRAME>(); }
int ROUTER_TOOL::getDefaultWidth ( int  aNetCode)
private

Definition at line 381 of file router_tool.cpp.

References getNetclassDimensions().

382 {
383  int w, d1, d2;
384 
385  getNetclassDimensions( aNetCode, w, d1, d2 );
386 
387  return w;
388 }
void getNetclassDimensions(int aNetCode, int &aWidth, int &aViaDiameter, int &aViaDrill)
template<typename T >
T* TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Function getEditFrame()

Returns the application window object, casted to requested user type.

Definition at line 188 of file tool_base.h.

Referenced by ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), and TOOL_SETTINGS::getConfigBase().

189  {
190  return static_cast<T*>( getEditFrameInt() );
191  }
wxWindow * getEditFrameInt() const
Definition: tool_base.cpp:47
TOOL_ID TOOL_BASE::GetId ( ) const
inlineinherited

Function GetId() Returns the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 122 of file tool_base.h.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::isActive(), TOOL_MANAGER::RegisterTool(), ACTION_MANAGER::RunHotKey(), TOOL_MANAGER::runTool(), and TOOL_MANAGER::saveViewControls().

123  {
124  return m_toolId;
125  }
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:210
TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER. If there is no TOOL_MANAGER associated, it returns NULL.

Definition at line 144 of file tool_base.h.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), PCB_TOOL::doInteractiveItemPlacement(), CONTEXT_MENU::getToolManager(), EDIT_TOOL::MeasureTool(), and CONTEXT_MENU::onMenuEvent().

145  {
146  return m_toolMgr;
147  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
template<typename T >
T* TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 199 of file tool_base.h.

Referenced by ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), ZONE_CREATE_HELPER::createZoneFromExisting(), and ZONE_CREATE_HELPER::performZoneCutout().

200  {
201  EDA_ITEM* m = getModelInt();
202 
203  return static_cast<T*>( m );
204  }
Class EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boa...
Definition: base_struct.h:162
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:53
const std::string& TOOL_BASE::GetName ( void  ) const
inlineinherited

Function GetName() Returns the name of the tool.

Tool names are expected to obey the format: application.ToolName (eg. pcbnew.InteractiveSelection).

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

Referenced by TOOL_SETTINGS::getKeyName(), TOOL_MANAGER::InitTools(), TOOL_MANAGER::invokeTool(), and TOOL_MANAGER::RegisterTool().

134  {
135  return m_toolName;
136  }
std::string m_toolName
Name of the tool.
Definition: tool_base.h:214
void ROUTER_TOOL::getNetclassDimensions ( int  aNetCode,
int &  aWidth,
int &  aViaDiameter,
int &  aViaDrill 
)
private

Definition at line 391 of file router_tool.cpp.

References PCB_TOOL::board(), NETCLASSES::Find(), BOARD::FindNet(), NETINFO_ITEM::GetClassName(), BOARD_DESIGN_SETTINGS::GetDefault(), BOARD::GetDesignSettings(), and BOARD_DESIGN_SETTINGS::m_NetClasses.

Referenced by getDefaultWidth().

393 {
395 
396  NETCLASSPTR netClass;
397  NETINFO_ITEM* ni = board()->FindNet( aNetCode );
398 
399  if( ni )
400  {
401  wxString netClassName = ni->GetClassName();
402  netClass = bds.m_NetClasses.Find( netClassName );
403  }
404 
405  if( !netClass )
406  netClass = bds.GetDefault();
407 
408  aWidth = netClass->GetTrackWidth();
409  aViaDiameter = netClass->GetViaDiameter();
410  aViaDrill = netClass->GetViaDrill();
411 }
NETCLASSPTR Find(const wxString &aName) const
Function Find searches this container for a NETCLASS given by aName.
Definition: netclass.cpp:144
NETCLASSPTR GetDefault() const
Function GetDefault.
wxString GetClassName() const
Function GetClassName returns the class name.
Definition: netinfo.h:131
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:535
Class NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:69
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
NETCLASSES m_NetClasses
List of current netclasses. There is always the default netclass.
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
BOARD * board() const
Definition: pcb_tool.h:137
TOOL_SETTINGS & TOOL_BASE::GetSettings ( )
inherited

Definition at line 77 of file tool_base.cpp.

Referenced by GERBVIEW_CONTROL::HighlightControl(), Init(), SELECTION_TOOL::selectable(), and ~ROUTER_TOOL().

78 {
79  return m_toolSettings;
80 }
TOOL_SETTINGS m_toolSettings
Definition: tool_base.h:216
int ROUTER_TOOL::getStartLayer ( const PNS::ITEM aItem)
private

Definition at line 431 of file router_tool.cpp.

References KIGFX::VIEW::GetTopLayer(), TOOL_BASE::getView(), PNS::ITEM::Layers(), PNS::TOOL_BASE::m_startItem, LAYER_RANGE::Overlaps(), and LAYER_RANGE::Start().

Referenced by prepareInteractive().

432 {
433  int tl = getView()->GetTopLayer();
434 
435  if( m_startItem )
436  {
437  const LAYER_RANGE& ls = m_startItem->Layers();
438 
439  if( ls.Overlaps( tl ) )
440  return tl;
441  else
442  return ls.Start();
443  }
444 
445  return tl;
446 }
virtual int GetTopLayer() const
Definition: view.cpp:794
const LAYER_RANGE & Layers() const
Function Layers()
Definition: pns_item.h:209
ITEM * m_startItem
Definition: pns_tool_base.h:68
int Start() const
Definition: pns_layerset.h:83
bool Overlaps(const LAYER_RANGE &aOther) const
Definition: pns_layerset.h:68
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
Class LAYER_RANGE.
Definition: pns_layerset.h:32
TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 111 of file tool_base.h.

Referenced by TOOL_MANAGER::finishTool(), TOOL_MANAGER::InvokeTool(), TOOL_MANAGER::ResetTools(), and TOOL_MANAGER::runTool().

112  {
113  return m_type;
114  }
TOOL_TYPE m_type
Stores the type of the tool.
Definition: tool_base.h:207
KIGFX::VIEW * TOOL_BASE::getView ( ) const
protectedinherited

Function getView()

Returns the instance of VIEW object used in the application. It allows tools to draw.

Returns
The instance of VIEW.

Definition at line 35 of file tool_base.cpp.

References TOOL_MANAGER::GetView(), and TOOL_BASE::m_toolMgr.

Referenced by ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), PCBNEW_CONTROL::CursorControl(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findCallback(), getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::guessSelectionCandidates(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), PCBNEW_CONTROL::PanControl(), PNS::TOOL_BASE::pickSingleItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), PCB_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), DRAWING_TOOL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), SELECTION_TOOL::Reset(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::selectable(), GERBVIEW_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), POINT_EDITOR::updateEditedPoint(), COMMON_TOOLS::updateGrid(), PCBNEW_CONTROL::updateGrid(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), COMMON_TOOLS::ZoomFitScreen(), GERBVIEW_SELECTION_TOOL::zoomFitSelection(), SELECTION_TOOL::zoomFitSelection(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

36 {
37  return m_toolMgr->GetView();
38 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:252
KIGFX::VIEW_CONTROLS * TOOL_BASE::getViewControls ( ) const
protectedinherited

Function getViewControls()

Returns the instance of VIEW_CONTROLS object used in the application. It allows tools to read & modify user input and its settings (eg. show cursor, enable snapping to grid, etc.)

Returns
The instance of VIEW_CONTROLS.

Definition at line 41 of file tool_base.cpp.

References TOOL_MANAGER::GetViewControls(), and TOOL_BASE::m_toolMgr.

Referenced by POINT_EDITOR::addCorner(), PCBNEW_CONTROL::CursorControl(), COMMON_TOOLS::doZoomToPreset(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawZone(), MODULE_EDITOR_TOOLS::EnumeratePads(), SELECTION_TOOL::findMove(), PCB_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNetCursor(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), mainLoop(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), performDragging(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), GERBVIEW_CONTROL::ResetCoords(), PCBNEW_CONTROL::ResetCoords(), DRAWING_TOOL::runPolygonEventLoop(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), ZOOM_TOOL::selectRegion(), PICKER_TOOL::setControls(), POINT_EDITOR::setEditedPoint(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

42 {
43  return m_toolMgr->GetViewControls();
44 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:257
template<class T >
void TOOL_INTERACTIVE::Go ( int(T::*)(const TOOL_EVENT &)  aStateFunc,
const TOOL_EVENT_LIST aConditions = TOOL_EVENTTC_ANYTA_ANY ) 
)
inherited

Function Go()

Defines which state (aStateFunc) to go when a certain event arrives (aConditions). No conditions means any event.

Definition at line 135 of file tool_interactive.h.

References TOOL_INTERACTIVE::goInternal().

Referenced by ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), setTransitions(), PAD_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), POINT_EDITOR::setTransitions(), COMMON_TOOLS::setTransitions(), GERBVIEW_CONTROL::setTransitions(), MODULE_EDITOR_TOOLS::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), PICKER_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), SELECTION_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), and DRAWING_TOOL::setTransitions().

137 {
138  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
139 
140  goInternal( sptr, aConditions );
141 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:59
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)
void ROUTER_TOOL::handleCommonEvents ( const TOOL_EVENT evt)
private

Definition at line 414 of file router_tool.cpp.

References PNS::ROUTER::DumpLog(), TOOL_EVENT::IsKeyPressed(), TOOL_EVENT::KeyCode(), and PNS::TOOL_BASE::m_router.

Referenced by performDragging().

415 {
416 #ifdef DEBUG
417  if( aEvent.IsKeyPressed() )
418  {
419  switch( aEvent.KeyCode() )
420  {
421  case '0':
422  wxLogTrace( "PNS", "saving drag/route log...\n" );
423  m_router->DumpLog();
424  break;
425  }
426  }
427 #endif
428 }
ROUTER * m_router
Definition: pns_tool_base.h:77
void DumpLog()
Definition: pns_router.cpp:466
void TOOL_BASE::highlightNet ( bool  aEnabled,
int  aNetcode = -1 
)
protectedvirtualinherited

Definition at line 211 of file pns_tool_base.cpp.

References KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), TOOL_BASE::getView(), KIGFX::RENDER_SETTINGS::SetHighlight(), and KIGFX::VIEW::UpdateAllLayersColor().

Referenced by finishInteractive(), performDragging(), LENGTH_TUNER_TOOL::performTuning(), and prepareInteractive().

212 {
214 
215  if( aNetcode >= 0 && aEnabled )
216  rs->SetHighlight( true, aNetcode );
217  else
218  rs->SetHighlight( false );
219 
221 }
Class RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output ...
Definition: painter.h:56
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
void UpdateAllLayersColor()
Function UpdateAllLayersColor() Applies the new coloring scheme to all layers.
Definition: view.cpp:743
void SetHighlight(bool aEnabled, int aNetcode=-1)
Function SetHighlight Turns on/off highlighting - it may be done for the active layer or the specifie...
Definition: painter.h:140
bool ROUTER_TOOL::Init ( )
overridevirtual

Function Init() Init() is called once upon a registration of the tool.

Returns
True if the initialization went fine, false - otherwise.

Reimplemented from TOOL_BASE.

Definition at line 367 of file router_tool.cpp.

References TOOL_BASE::GetSettings(), PNS::ROUTING_SETTINGS::Load(), and PNS::TOOL_BASE::m_savedSettings.

368 {
370  return true;
371 }
void Load(const TOOL_SETTINGS &where)
ROUTING_SETTINGS m_savedSettings
Stores routing settings between router invocations.
Definition: pns_tool_base.h:66
TOOL_SETTINGS & GetSettings()
Definition: tool_base.cpp:77
int ROUTER_TOOL::InlineDrag ( const TOOL_EVENT aEvent)

Definition at line 1055 of file router_tool.cpp.

References TOOL_INTERACTIVE::Activate(), BUT_LEFT, PCB_TOOL::controls(), SELECTION::Empty(), PNS::NODE::FindItemByParent(), PNS::ROUTER::FixRoute(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PCB_TOOL::frame(), SELECTION::Front(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_MANAGER::GetTool(), PNS::ROUTER::GetWorld(), PNS::ITEM::IsLocked(), IsOK(), PNS::TOOL_BASE::m_endItem, PNS::TOOL_BASE::m_endSnapPoint, PNS::TOOL_BASE::m_router, PNS::TOOL_BASE::m_startItem, TOOL_BASE::m_toolMgr, PNS::ROUTER::Move(), NeighboringSegmentFilter(), TOOL_EVENT::Parameter(), PCB_TRACE_T, PCB_VIA_T, PNS::ROUTER::RoutingInProgress(), TOOL_MANAGER::RunAction(), PCB_TOOL::selection(), PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectionCursor, KIGFX::VIEW_CONTROLS::SetAutoPan(), KIGFX::VIEW_CONTROLS::ShowCursor(), SELECTION::Size(), PNS::ROUTER::StartDragging(), PNS::ROUTER::StopRouting(), PNS::ROUTER::SyncWorld(), EDA_ITEM::Type(), PCB_BASE_EDIT_FRAME::UndoRedoBlock(), PNS::TOOL_BASE::updateEndItem(), and TOOL_INTERACTIVE::Wait().

Referenced by setTransitions().

1056 {
1057  const auto& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
1058 
1059  if( selection.Empty() )
1061 
1062  if( selection.Size() != 1 )
1063  return 0;
1064 
1065  const BOARD_CONNECTED_ITEM* item = static_cast<const BOARD_CONNECTED_ITEM*>( selection.Front() );
1066 
1067  if( item->Type() != PCB_TRACE_T && item->Type() != PCB_VIA_T )
1068  return 0;
1069 
1070  Activate();
1071 
1073  m_router->SyncWorld();
1075 
1076  if( m_startItem && m_startItem->IsLocked() )
1077  {
1078  if( !IsOK( frame(), _( "The item is locked. Do you want to continue?" ) ) )
1079  return false;
1080  }
1081 
1083 
1084  int dragMode = aEvent.Parameter<int64_t> ();
1085 
1086  bool dragStarted = m_router->StartDragging( p0, m_startItem, dragMode );
1087 
1088  if( !dragStarted )
1089  return 0;
1090 
1091  controls()->ShowCursor( true );
1092  controls()->ForceCursorPosition( false );
1093  controls()->SetAutoPan( true );
1094  frame()->UndoRedoBlock( true );
1095 
1096  while( OPT_TOOL_EVENT evt = Wait() )
1097  {
1098  if( evt->IsCancel() )
1099  {
1100  break;
1101  }
1102  else if( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) )
1103  {
1104  updateEndItem( *evt );
1106  }
1107  else if( evt->IsMouseUp( BUT_LEFT ) || evt->IsClick( BUT_LEFT ) )
1108  {
1109  updateEndItem( *evt );
1111  break;
1112  }
1113  }
1114 
1115  if( m_router->RoutingInProgress() )
1116  m_router->StopRouting();
1117 
1118  controls()->SetAutoPan( false );
1119  controls()->ForceCursorPosition( false );
1120  frame()->UndoRedoBlock( false );
1121 
1122  return 0;
1123 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:109
Class SELECTION_TOOL.
EDA_ITEM * Front() const
Definition: selection.h:147
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void SyncWorld()
Definition: pns_router.cpp:91
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
void UndoRedoBlock(bool aBlock=true)
Function UndoRedoBlock Enables/disable undo and redo operations.
Class BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected an...
NODE * GetWorld() const
Definition: pns_router.h:143
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
bool RoutingInProgress() const
Definition: pns_router.cpp:112
KIGFX::VIEW_CONTROLS * controls() const
Definition: pcb_tool.h:135
virtual void updateEndItem(const TOOL_EVENT &aEvent)
bool IsLocked() const
Definition: pns_item.h:338
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
ITEM * m_startItem
Definition: pns_tool_base.h:68
bool FixRoute(const VECTOR2I &aP, ITEM *aItem, bool aForceFinish=false)
Definition: pns_router.cpp:364
ROUTER * m_router
Definition: pns_tool_base.h:77
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
void Move(const VECTOR2I &aP, ITEM *aItem)
Definition: pns_router.cpp:225
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg...
void StopRouting()
Definition: pns_router.cpp:389
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:378
VECTOR2I m_endSnapPoint
Definition: pns_tool_base.h:73
bool StartDragging(const VECTOR2I &aP, ITEM *aItem, int aDragMode=DM_ANY)
Definition: pns_router.cpp:127
static void NeighboringSegmentFilter(const VECTOR2I &aPt, GENERAL_COLLECTOR &aCollector)
ITEM * FindItemByParent(const BOARD_CONNECTED_ITEM *aParent)
Definition: pns_node.cpp:1330
void Activate()
Function Activate() Runs the tool.
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
int Size() const
Returns the number of selected parts.
Definition: selection.h:115
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:233
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
Definition: pcb_actions.h:50
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:465
bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 30 of file tool_base.cpp.

References TOOL_MANAGER::IsToolActive(), TOOL_BASE::m_toolId, and TOOL_BASE::m_toolMgr.

31 {
32  return m_toolMgr->IsToolActive( m_toolId );
33 }
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing) ...
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:210
int ROUTER_TOOL::mainLoop ( PNS::ROUTER_MODE  aMode)
private

Definition at line 843 of file router_tool.cpp.

References ACT_NewTrack, ACT_PlaceThroughVia, TOOL_INTERACTIVE::Activate(), PCB_TOOL::board(), breakTrack(), PCB_ACTIONS::breakTrack, BUT_LEFT, PNS::ROUTER::ClearWorld(), PNS::DM_ANY, PNS::DM_FREE_ANGLE, PCB_ACTIONS::drag45Degree, PCB_ACTIONS::dragFreeAngle, KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PCB_TOOL::frame(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_BASE::getViewControls(), TOOL_EVT_UTILS::IsCancelInteractive(), PCB_ACTIONS::layerToggle, PNS::TOOL_BASE::m_router, PNS::TOOL_BASE::m_savedSettings, PNS::TOOL_BASE::m_savedSizes, PNS::TOOL_BASE::m_startSnapPoint, TOOL_BASE::m_toolMgr, MD_CTRL, performDragging(), performRouting(), TOOL_MANAGER::RunAction(), PCB_ACTIONS::selectionClear, TOOL_INTERACTIVE::SetContextMenu(), PNS::ROUTER::SetMode(), EDA_DRAW_FRAME::SetNoToolSelected(), PNS::ROUTER::Settings(), KIGFX::VIEW_CONTROLS::ShowCursor(), PNS::ROUTER::Sizes(), PNS::ROUTER::SyncWorld(), TA_MODEL_CHANGE, TA_UNDO_REDO_POST, TA_UNDO_REDO_PRE, PNS::TOOL_BASE::updateStartItem(), and TOOL_INTERACTIVE::Wait().

Referenced by RouteDiffPair(), and RouteSingleTrace().

844 {
845  PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
846  BOARD* board = getModel<BOARD>();
847 
848  // Deselect all items
850 
851  Activate();
852 
853  m_router->SetMode( aMode );
854 
855  VIEW_CONTROLS* ctls = getViewControls();
856  ctls->ShowCursor( true );
857  ctls->ForceCursorPosition( false );
859 
860  std::unique_ptr<ROUTER_TOOL_MENU> ctxMenu( new ROUTER_TOOL_MENU( board, *frame, aMode ) );
861  SetContextMenu( ctxMenu.get() );
862 
863  // Main loop: keep receiving events
864  while( OPT_TOOL_EVENT evt = Wait() )
865  {
867  {
868  break; // Finish
869  }
870  else if( evt->Action() == TA_UNDO_REDO_PRE )
871  {
872  m_router->ClearWorld();
873  }
874  else if( evt->Action() == TA_UNDO_REDO_POST || evt->Action() == TA_MODEL_CHANGE )
875  {
876  m_router->SyncWorld();
877  }
878  else if( evt->IsMotion() )
879  {
880  updateStartItem( *evt );
881  }
882  else if( evt->IsAction( &PCB_ACTIONS::dragFreeAngle ) )
883  {
884  updateStartItem( *evt, true );
886  }
887  else if( evt->IsAction( &PCB_ACTIONS::drag45Degree ) )
888  {
889  updateStartItem( *evt, true );
891  }
892  else if( evt->IsAction( &PCB_ACTIONS::breakTrack ) )
893  {
894  updateStartItem( *evt, true );
895  breakTrack( );
896  }
897  else if( evt->IsClick( BUT_LEFT ) || evt->IsAction( &ACT_NewTrack ) )
898  {
899  updateStartItem( *evt );
900 
901  if( evt->Modifier( MD_CTRL ) )
903  else
904  performRouting();
905  }
906  else if( evt->IsAction( &ACT_PlaceThroughVia ) )
907  {
909  }
910  }
911 
912  frame->SetNoToolSelected();
913  SetContextMenu( nullptr );
914 
915  // Store routing settings till the next invocation
918 
919  return 0;
920 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:53
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
VECTOR2I m_startSnapPoint
Definition: pns_tool_base.h:70
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 TOOL_ACTION dragFreeAngle
Definition: pcb_actions.h:134
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
SIZES_SETTINGS m_savedSizes
Stores sizes settings between router invocations.
Definition: pns_tool_base.h:67
void SyncWorld()
Definition: pns_router.cpp:91
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:125
static TOOL_ACTION drag45Degree
Definition: pcb_actions.h:133
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)
SIZES_SETTINGS & Sizes()
Definition: pns_router.h:206
void breakTrack()
void ClearWorld()
Definition: pns_router.cpp:100
void performRouting()
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
ROUTER * m_router
Definition: pns_tool_base.h:77
void SetContextMenu(CONTEXT_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
Function SetContextMenu()
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
ROUTING_SETTINGS m_savedSettings
Stores routing settings between router invocations.
Definition: pns_tool_base.h:66
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
static TOOL_ACTION breakTrack
Definition: pcb_actions.h:132
virtual void SetNoToolSelected()
Select the ID_NO_TOOL_SELECTED id tool (Idle tool)
Definition: draw_frame.cpp:615
void SetMode(ROUTER_MODE aMode)
Definition: pns_router.cpp:507
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:169
void performDragging(int aMode=PNS::DM_ANY)
virtual void updateStartItem(TOOL_EVENT &aEvent, bool aIgnorePads=false)
Class PCB_EDIT_FRAME is the main frame for Pcbnew.
void Activate()
Function Activate() Runs the tool.
ROUTING_SETTINGS & Settings()
Definition: pns_router.h:187
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:465
static TOOL_ACTION layerToggle
Definition: pcb_actions.h:281
BOARD * board() const
Definition: pcb_tool.h:137
void ROUTER_TOOL::NeighboringSegmentFilter ( const VECTOR2I aPt,
GENERAL_COLLECTOR aCollector 
)
static

Definition at line 978 of file router_tool.cpp.

References COLLECTOR::CountType(), ENDPOINT, COLLECTOR::GetCount(), TRACK::GetEnd(), BOARD_CONNECTED_ITEM::GetNetCode(), TRACK::GetStart(), i, TRACK::IsPointOnEnds(), PCB_MARKER_T, PCB_TRACE_T, PCB_VIA_T, COLLECTOR::Remove(), STARTPOINT, EDA_ITEM::Type(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by CanInlineDrag(), connectedTrackFilter(), and InlineDrag().

979 {
980  /* If the collection contains a trivial line corner (two connected segments)
981  * or a non-fanout-via (a via with no more than two connected segments), then
982  * trim the collection down to a single item (which one won't matter since
983  * they're all connected).
984  */
985 
986  // First make sure we've got something that *might* match.
987  int vias = aCollector.CountType( PCB_VIA_T );
988  int traces = aCollector.CountType( PCB_TRACE_T );
989 
990  if( vias > 1 || traces > 2 || vias + traces < 1 )
991  return;
992 
993  // Fetch first TRACK (via or trace) as our reference
994  TRACK* reference = nullptr;
995 
996  for( int i = 0; !reference && i < aCollector.GetCount(); i++ )
997  reference = dynamic_cast<TRACK*>( aCollector[i] );
998 
999  int refNet = reference->GetNetCode();
1000 
1001  wxPoint refPoint;
1002  STATUS_FLAGS flags = reference->IsPointOnEnds( wxPoint( aPt.x, aPt.y ), -1 );
1003 
1004  if( flags & STARTPOINT )
1005  refPoint = reference->GetStart();
1006  else if( flags & ENDPOINT )
1007  refPoint = reference->GetEnd();
1008  else
1009  return;
1010 
1011  // Check all items to ensure that they are TRACKs which are co-terminus
1012  // with the reference, and on the same net. Ignore markers.
1013  for( int i = 0; i < aCollector.GetCount(); i++ )
1014  {
1015  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( aCollector[i] );
1016 
1017  if( item->Type() == PCB_MARKER_T )
1018  continue;
1019 
1020  TRACK* neighbor = dynamic_cast<TRACK*>( item );
1021 
1022  if( !neighbor || neighbor->GetNetCode() != refNet )
1023  return;
1024 
1025  if( neighbor->GetStart() != refPoint && neighbor->GetEnd() != refPoint )
1026  return;
1027  }
1028 
1029  // Selection meets criteria; trim it to the reference item.
1030  for( int i = aCollector.GetCount() - 1; i >= 0; i-- )
1031  {
1032  if( dynamic_cast<TRACK*>( aCollector[i] ) != reference )
1033  aCollector.Remove( i );
1034  }
1035 }
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:106
KICAD_T Type() const
Function Type()
Definition: base_struct.h:209
Class BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class...
STATUS_FLAGS IsPointOnEnds(const wxPoint &point, int min_dist=0)
Function IsPointOnEnds returns STARTPOINT if point if near (dist = min_dist) start point...
int CountType(KICAD_T aType)
Function CountType counts the number of items matching aType.
Definition: collector.h:257
void Remove(int aIndex)
Function Remove removes the item at aIndex (first position is 0);.
Definition: collector.h:135
const wxPoint & GetEnd() const
Definition: class_track.h:119
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
const wxPoint & GetStart() const
Definition: class_track.h:122
unsigned STATUS_FLAGS
Definition: base_struct.h:142
int GetNetCode() const
Function GetNetCode.
class MARKER_PCB, a marker used to show something
Definition: typeinfo.h:99
size_t i
Definition: json11.cpp:597
#define ENDPOINT
Definition: base_struct.h:115
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
#define STARTPOINT
Definition: base_struct.h:114
int ROUTER_TOOL::onLayerChanged ( const TOOL_EVENT aEvent)
private
int ROUTER_TOOL::onTrackViaSizeChanged ( const TOOL_EVENT aEvent)
private

Definition at line 1141 of file router_tool.cpp.

References PCB_TOOL::board(), PNS::SIZES_SETTINGS::ImportCurrent(), PNS::TOOL_BASE::m_router, PNS::ROUTER::Sizes(), and PNS::ROUTER::UpdateSizes().

Referenced by setTransitions().

1142 {
1143  PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
1144  sizes.ImportCurrent( board()->GetDesignSettings() );
1145  m_router->UpdateSizes( sizes );
1146 
1147  return 0;
1148 }
SIZES_SETTINGS & Sizes()
Definition: pns_router.h:206
ROUTER * m_router
Definition: pns_tool_base.h:77
void ImportCurrent(BOARD_DESIGN_SETTINGS &aSettings)
void UpdateSizes(const SIZES_SETTINGS &aSizes)
Applies stored settings.
Definition: pns_router.cpp:308
BOARD * board() const
Definition: pcb_tool.h:137
int ROUTER_TOOL::onViaCommand ( const TOOL_EVENT aEvent)
private

Definition at line 492 of file router_tool.cpp.

References PNS::SIZES_SETTINGS::AddLayerPair(), LSET::AllNonCuMask(), B_Cu, PCB_TOOL::board(), PNS::SIZES_SETTINGS::ClearLayerPairs(), DisplayError(), F_Cu, PCB_TOOL::frame(), BOARD_DESIGN_SETTINGS::GetCopperLayerCount(), PNS::ROUTER::GetCurrentLayer(), BOARD_DESIGN_SETTINGS::GetCurrentMicroViaDrill(), BOARD_DESIGN_SETTINGS::GetCurrentMicroViaSize(), BOARD_DESIGN_SETTINGS::GetCurrentViaDrill(), BOARD_DESIGN_SETTINGS::GetCurrentViaSize(), BOARD::GetDesignSettings(), PCB_BASE_FRAME::GetScreen(), getViaTypeFromFlags(), In1_Cu, PNS::ROUTER::IsPlacingVia(), BOARD_DESIGN_SETTINGS::m_BlindBuriedViaAllowed, PNS::TOOL_BASE::m_endItem, PNS::TOOL_BASE::m_endSnapPoint, BOARD_DESIGN_SETTINGS::m_MicroViasAllowed, PCB_SCREEN::m_Route_Layer_BOTTOM, PCB_SCREEN::m_Route_Layer_TOP, PNS::TOOL_BASE::m_router, PNS::ROUTER::Move(), TOOL_EVENT::Parameter(), SELECT_LAYER, PCB_BASE_FRAME::SelectLayer(), PNS::SIZES_SETTINGS::SetViaDiameter(), PNS::SIZES_SETTINGS::SetViaDrill(), PNS::SIZES_SETTINGS::SetViaType(), PNS::ROUTER::Sizes(), PNS::ROUTER::ToggleViaPlacement(), UNDEFINED_LAYER, PNS::TOOL_BASE::updateEndItem(), PNS::ROUTER::UpdateSizes(), VIA_BLIND_BURIED, VIA_MICROVIA, and VIA_THROUGH.

Referenced by setTransitions().

493 {
494  const int actViaFlags = aEvent.Parameter<intptr_t>();
495 
496  VIATYPE_T viaType = getViaTypeFromFlags( actViaFlags );
497  const bool selectLayer = actViaFlags & VIA_ACTION_FLAGS::SELECT_LAYER;
498 
500 
501  const int layerCount = bds.GetCopperLayerCount();
502  int currentLayer = m_router->GetCurrentLayer();
505 
507 
508  // ask the user for a target layer
509  PCB_LAYER_ID targetLayer = UNDEFINED_LAYER;
510 
511  if( selectLayer )
512  {
513  wxPoint dlgPosition = wxGetMousePosition();
514 
515  targetLayer = frame()->SelectLayer( static_cast<PCB_LAYER_ID>( currentLayer ),
516  LSET::AllNonCuMask(), dlgPosition );
517  }
518 
519  // fixme: P&S supports more than one fixed layer pair. Update the dialog?
520  sizes.ClearLayerPairs();
521 
522  if( !m_router->IsPlacingVia() )
523  {
524  // Cannot place microvias or blind vias if not allowed (obvious)
525  if( ( viaType == VIA_BLIND_BURIED ) && ( !bds.m_BlindBuriedViaAllowed ) )
526  {
527  DisplayError( frame(), _( "Blind/buried vias have to be enabled in the design settings." ) );
528  return false;
529  }
530 
531  if( ( viaType == VIA_MICROVIA ) && ( !bds.m_MicroViasAllowed ) )
532  {
533  DisplayError( frame(), _( "Microvias have to be enabled in the design settings." ) );
534  return false;
535  }
536 
537  // Can only place through vias on 2-layer boards
538  if( ( viaType != VIA_THROUGH ) && ( layerCount <= 2 ) )
539  {
540  DisplayError( frame(), _( "Only through vias are allowed on 2 layer boards." ) );
541  return false;
542  }
543 
544  // Can only place microvias if we're on an outer layer, or directly adjacent to one
545  if( ( viaType == VIA_MICROVIA ) && ( currentLayer > In1_Cu ) && ( currentLayer < layerCount - 2 ) )
546  {
547  DisplayError( frame(), _( "Microvias can be placed only between the outer layers " \
548  "(F.Cu/B.Cu) and the ones directly adjacent to them." ) );
549  return false;
550  }
551  }
552 
553  // Convert blind/buried via to a through hole one, if it goes through all layers
554  if( viaType == VIA_BLIND_BURIED && ( ( currentLayer == B_Cu ) || ( currentLayer == F_Cu ) )
555  && ( ( pairTop == B_Cu && pairBottom == F_Cu )
556  || ( pairTop == F_Cu && pairBottom == B_Cu ) ) )
557  {
558  viaType = VIA_THROUGH;
559  }
560 
561  switch( viaType )
562  {
563  case VIA_THROUGH:
564  sizes.SetViaDiameter( bds.GetCurrentViaSize() );
565  sizes.SetViaDrill( bds.GetCurrentViaDrill() );
566 
567  if( targetLayer != UNDEFINED_LAYER )
568  {
569  // go from the current layer to the chosen layer
570  sizes.AddLayerPair( currentLayer, targetLayer );
571  }
572  else
573  {
574  // use the default layer pair
575  sizes.AddLayerPair( pairTop, pairBottom );
576  }
577  break;
578 
579  case VIA_MICROVIA:
580  sizes.SetViaDiameter( bds.GetCurrentMicroViaSize() );
581  sizes.SetViaDrill( bds.GetCurrentMicroViaDrill() );
582 
583  wxASSERT_MSG( !selectLayer, "Unexpected select layer for microvia (microvia layers are implicit)" );
584 
585  if( currentLayer == F_Cu || currentLayer == In1_Cu )
586  {
587  // front-side microvia
588  sizes.AddLayerPair( F_Cu, In1_Cu );
589  }
590  else if( currentLayer == B_Cu || currentLayer == layerCount - 2 )
591  {
592  // back-side microvia
593  sizes.AddLayerPair( B_Cu, layerCount - 2 );
594  }
595  else
596  {
597  wxASSERT_MSG( false, "Invalid layer pair for microvia (must be on or adjacent to an outer layer)" );
598  }
599  break;
600 
601  case VIA_BLIND_BURIED:
602  sizes.SetViaDiameter( bds.GetCurrentViaSize() );
603  sizes.SetViaDrill( bds.GetCurrentViaDrill() );
604 
605  if( targetLayer != UNDEFINED_LAYER )
606  {
607  // go directly to the user specified layer
608  sizes.AddLayerPair( currentLayer, targetLayer );
609  }
610  else
611  {
612  if( currentLayer == pairTop || currentLayer == pairBottom )
613  {
614  // the current layer is on the defined layer pair,
615  // swap to the other side
616  sizes.AddLayerPair( pairTop, pairBottom );
617  }
618  else
619  {
620  // the current layer is not part of the current layer pair,
621  // so fallback and swap to the top layer of the pair by default
622  sizes.AddLayerPair( pairTop, currentLayer );
623  }
624  }
625  break;
626 
627  default:
628  wxASSERT( false );
629  break;
630  }
631 
632  sizes.SetViaType( viaType );
633 
634  m_router->UpdateSizes( sizes );
636 
637  updateEndItem( aEvent );
638 
639  m_router->Move( m_endSnapPoint, m_endItem ); // refresh
640 
641  return 0;
642 }
int GetCurrentMicroViaSize()
Function GetCurrentMicroViaSize.
int GetCurrentViaDrill() const
Function GetCurrentViaDrill.
int GetCurrentMicroViaDrill()
Function GetCurrentMicroViaDrill.
static LSET AllNonCuMask()
Function AllNonCuMask returns a mask holding all layer minus CU layers.
Definition: lset.cpp:696
Microvia
Definition: router_tool.cpp:78
void SetViaDrill(int aDrill)
bool IsPlacingVia() const
Definition: pns_router.cpp:489
SIZES_SETTINGS & Sizes()
Definition: pns_router.h:206
VIATYPE_T
Definition: class_track.h:50
int GetCurrentViaSize() const
Function GetCurrentViaSize.
void ToggleViaPlacement()
Definition: pns_router.cpp:439
virtual void updateEndItem(const TOOL_EVENT &aEvent)
PCB_LAYER_ID
A quick note on layer IDs:
int GetCopperLayerCount() const
Function GetCopperLayerCount.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
ROUTER * m_router
Definition: pns_tool_base.h:77
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:535
PCB_LAYER_ID m_Route_Layer_BOTTOM
Definition: pcb_screen.h:46
bool m_BlindBuriedViaAllowed
true to allow blind/buried vias
void Move(const VECTOR2I &aP, ITEM *aItem)
Definition: pns_router.cpp:225
void SetViaType(VIATYPE_T aViaType)
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:378
void UpdateSizes(const SIZES_SETTINGS &aSizes)
Applies stored settings.
Definition: pns_router.cpp:308
VECTOR2I m_endSnapPoint
Definition: pns_tool_base.h:73
PCB_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
int GetCurrentLayer() const
Definition: pns_router.cpp:458
void AddLayerPair(int aL1, int aL2)
static VIATYPE_T getViaTypeFromFlags(int aFlags)
bool m_MicroViasAllowed
true to allow micro vias
void SetViaDiameter(int aDiameter)
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
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
PCB_LAYER_ID m_Route_Layer_TOP
Definition: pcb_screen.h:45
Class BOARD_DESIGN_SETTINGS contains design settings for a BOARD object.
BOARD * board() const
Definition: pcb_tool.h:137
void ROUTER_TOOL::performDragging ( int  aMode = PNS::DM_ANY)
private

Definition at line 923 of file router_tool.cpp.

References BUT_LEFT, PNS::ROUTER::FixRoute(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PCB_TOOL::frame(), TOOL_BASE::getViewControls(), handleCommonEvents(), PNS::TOOL_BASE::highlightNet(), TOOL_EVT_UTILS::IsCancelInteractive(), PNS::ITEM::IsLocked(), IsOK(), PNS::TOOL_BASE::m_endItem, PNS::TOOL_BASE::m_endSnapPoint, PNS::TOOL_BASE::m_router, PNS::TOOL_BASE::m_startItem, PNS::TOOL_BASE::m_startSnapPoint, PNS::ROUTER::Move(), PNS::ITEM::Net(), PNS::ROUTER::RoutingInProgress(), KIGFX::VIEW_CONTROLS::SetAutoPan(), PNS::ROUTER::StartDragging(), PNS::ROUTER::StopRouting(), PCB_BASE_EDIT_FRAME::UndoRedoBlock(), PNS::TOOL_BASE::updateEndItem(), and TOOL_INTERACTIVE::Wait().

Referenced by mainLoop().

924 {
925  VIEW_CONTROLS* ctls = getViewControls();
926 
927  if( m_startItem && m_startItem->IsLocked() )
928  {
929  if( !IsOK( frame(), _( "The item is locked. Do you want to continue?" ) ) )
930  return;
931  }
932 
933  bool dragStarted = m_router->StartDragging( m_startSnapPoint, m_startItem, aMode );
934 
935  if( !dragStarted )
936  return;
937 
938  if( m_startItem && m_startItem->Net() >= 0 )
939  highlightNet( true, m_startItem->Net() );
940 
941  ctls->SetAutoPan( true );
942 
943  frame()->UndoRedoBlock( true );
944 
945  while( OPT_TOOL_EVENT evt = Wait() )
946  {
947  ctls->ForceCursorPosition( false );
948 
949  if( evt->IsMotion() )
950  {
951  updateEndItem( *evt );
953  }
954  else if( evt->IsClick( BUT_LEFT ) )
955  {
957  break;
958  }
959  else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt )
960  || evt->IsUndoRedo() )
961  break;
962 
963  handleCommonEvents( *evt );
964  }
965 
966  if( m_router->RoutingInProgress() )
968 
969  m_startItem = nullptr;
970 
971  frame()->UndoRedoBlock( false );
972  ctls->SetAutoPan( false );
973  ctls->ForceCursorPosition( false );
974  highlightNet( false );
975 }
VECTOR2I m_startSnapPoint
Definition: pns_tool_base.h:70
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
void UndoRedoBlock(bool aBlock=true)
Function UndoRedoBlock Enables/disable undo and redo operations.
void handleCommonEvents(const TOOL_EVENT &evt)
bool RoutingInProgress() const
Definition: pns_router.cpp:112
virtual void updateEndItem(const TOOL_EVENT &aEvent)
bool IsLocked() const
Definition: pns_item.h:338
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
ITEM * m_startItem
Definition: pns_tool_base.h:68
bool FixRoute(const VECTOR2I &aP, ITEM *aItem, bool aForceFinish=false)
Definition: pns_router.cpp:364
ROUTER * m_router
Definition: pns_tool_base.h:77
Class VIEW_CONTROLS is an interface for classes handling user events controlling the view behaviour (...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
void Move(const VECTOR2I &aP, ITEM *aItem)
Definition: pns_router.cpp:225
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg...
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:41
void StopRouting()
Definition: pns_router.cpp:389
virtual void highlightNet(bool aEnabled, int aNetcode=-1)
VECTOR2I m_endSnapPoint
Definition: pns_tool_base.h:73
bool StartDragging(const VECTOR2I &aP, ITEM *aItem, int aDragMode=DM_ANY)
Definition: pns_router.cpp:127
int Net() const
Function Net()
Definition: pns_item.h:179
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Function IsOK displays a yes/no dialog with aMessage and returns the user response.
Definition: confirm.cpp:233
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:465
void ROUTER_TOOL::performRouting ( )
private

Definition at line 711 of file router_tool.cpp.

References ACT_EndTrack, ACT_SwitchPosture, BUT_LEFT, finishInteractive(), PNS::ROUTER::FixRoute(), PNS::ROUTER::FlipPosture(), PCB_TOOL::frame(), PNS::ROUTER::GetCurrentLayer(), TOOL_EVT_UTILS::IsCancelInteractive(), PNS::ROUTER::IsPlacingVia(), PCB_ACTIONS::layerChanged, PNS::TOOL_BASE::m_endItem, PNS::TOOL_BASE::m_endSnapPoint, PNS::TOOL_BASE::m_router, PNS::TOOL_BASE::m_startItem, MD_CTRL, MD_SHIFT, PNS::ROUTER::Move(), prepareInteractive(), PCB_ACTIONS::routerInlineDrag, PNS::ROUTER::RoutingInProgress(), PCB_EDIT_FRAME::SetActiveLayer(), PNS::ROUTER::SetOrthoMode(), PNS::ROUTER::SwitchLayer(), switchLayerOnViaPlacement(), ToLAYER_ID(), PNS::TOOL_BASE::updateEndItem(), and TOOL_INTERACTIVE::Wait().

Referenced by mainLoop().

712 {
713  if( !prepareInteractive() )
714  return;
715 
716  while( OPT_TOOL_EVENT evt = Wait() )
717  {
718  // Don't crash if we missed an operation that cancelled routing.
719  wxCHECK2( m_router->RoutingInProgress(), break );
720 
721  if( evt->IsMotion() )
722  {
723  m_router->SetOrthoMode( evt->Modifier( MD_CTRL ) );
724  updateEndItem( *evt );
726  }
727  else if( evt->IsClick( BUT_LEFT ) )
728  {
729  updateEndItem( *evt );
730  bool needLayerSwitch = m_router->IsPlacingVia();
731  bool forceFinish = evt->Modifier( MD_SHIFT );
732 
733 
734  if( m_router->FixRoute( m_endSnapPoint, m_endItem, forceFinish ) )
735  break;
736 
737  if( needLayerSwitch )
739 
740  // Synchronize the indicated layer
742  updateEndItem( *evt );
744  m_startItem = NULL;
745  }
746  else if( evt->IsAction( &ACT_SwitchPosture ) )
747  {
749  updateEndItem( *evt );
750  m_router->Move( m_endSnapPoint, m_endItem ); // refresh
751  }
752  else if( evt->IsAction( &PCB_ACTIONS::layerChanged ) )
753  {
754  m_router->SwitchLayer( frame()->GetActiveLayer() );
755  updateEndItem( *evt );
756  m_router->Move( m_endSnapPoint, m_endItem ); // refresh
757  }
758  else if( evt->IsAction( &ACT_EndTrack ) )
759  {
760  bool still_routing = true;
761  while( still_routing )
762  still_routing = m_router->FixRoute( m_endSnapPoint, m_endItem );
763  break;
764  }
765  else if( TOOL_EVT_UTILS::IsCancelInteractive( *evt )
766  || evt->IsUndoRedo()
767  || evt->IsAction( &PCB_ACTIONS::routerInlineDrag ) )
768  break;
769  }
770 
772 }
bool finishInteractive()
OPT_TOOL_EVENT Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
bool IsPlacingVia() const
Definition: pns_router.cpp:489
void SwitchLayer(int layer)
Definition: pns_router.cpp:426
void SetOrthoMode(bool aEnable)
Definition: pns_router.cpp:498
bool RoutingInProgress() const
Definition: pns_router.cpp:112
virtual void updateEndItem(const TOOL_EVENT &aEvent)
bool prepareInteractive()
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
ITEM * m_startItem
Definition: pns_tool_base.h:68
bool FixRoute(const VECTOR2I &aP, ITEM *aItem, bool aForceFinish=false)
Definition: pns_router.cpp:364
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)
ROUTER * m_router
Definition: pns_tool_base.h:77
void switchLayerOnViaPlacement()
bool IsCancelInteractive(const TOOL_EVENT &aEvt)
Function IsCancelInteractive()
void Move(const VECTOR2I &aP, ITEM *aItem)
Definition: pns_router.cpp:225
static TOOL_ACTION routerInlineDrag
Activation of the Push and Shove router (inline dragging mode)
Definition: pcb_actions.h:215
static TOOL_ACTION layerChanged
Definition: pcb_actions.h:283
VECTOR2I m_endSnapPoint
Definition: pns_tool_base.h:73
int GetCurrentLayer() const
Definition: pns_router.cpp:458
static const TOOL_ACTION ACT_EndTrack("pcbnew.InteractiveRouter.EndTrack", AS_CONTEXT, WXK_END, _("End Track"), _("Stops laying the current track."), checked_ok_xpm)
void FlipPosture()
Definition: pns_router.cpp:417
virtual void SetActiveLayer(PCB_LAYER_ID aLayer) override
Function SetActiveLayer will change the currently active layer to aLayer and also update the PCB_LAYE...
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:796
OPT< TOOL_EVENT > OPT_TOOL_EVENT
Definition: tool_event.h:465
ITEM * TOOL_BASE::pickSingleItem ( const VECTOR2I aWhere,
int  aNet = -1,
int  aLayer = -1,
bool  aIgnorePads = false 
)
protectedvirtualinherited

Definition at line 112 of file pns_tool_base.cpp.

References PCB_TOOL::displayOptions(), dist, KIGFX::VIEW::GetTopLayer(), TOOL_BASE::getView(), i, IsCopperLayer(), PNS::ITEM_SET::Items(), PNS::ITEM::KindStr(), PNS::ITEM::Layers(), PCB_DISPLAY_OPTIONS::m_ContrastModeDisplay, PNS::TOOL_BASE::m_router, max, PNS::ROUTING_SETTINGS::Mode(), LAYER_RANGE::Overlaps(), PNS::ROUTER::QueryHoverItems(), PNS::RM_MarkObstacles, PNS::ROUTER::Settings(), PNS::ITEM::SOLID_T, LAYER_RANGE::Start(), and PNS::ITEM::VIA_T.

Referenced by PNS::TOOL_BASE::updateEndItem(), and PNS::TOOL_BASE::updateStartItem().

113 {
114  int tl = getView()->GetTopLayer();
115 
116  if( aLayer > 0 )
117  tl = aLayer;
118 
119  static const int candidateCount = 5;
120  ITEM* prioritized[candidateCount];
121  int dist[candidateCount];
122 
123  for( int i = 0; i < candidateCount; i++ )
124  {
125  prioritized[i] = 0;
127  }
128 
129  ITEM_SET candidates = m_router->QueryHoverItems( aWhere );
130 
131  for( ITEM* item : candidates.Items() )
132  {
133  if( !item->IsRoutable() )
134  continue;
135 
136  if( !IsCopperLayer( item->Layers().Start() ) )
137  continue;
138 
139  // fixme: this causes flicker with live loop removal...
140  //if( item->Parent() && !item->Parent()->ViewIsVisible() )
141  // continue;
142 
143  if( aNet <= 0 || item->Net() == aNet )
144  {
145  if( item->OfKind( ITEM::VIA_T | ITEM::SOLID_T ) )
146  {
147  if( item->OfKind( ITEM::SOLID_T ) && aIgnorePads )
148  continue;
149 
150  int itemDist = ( item->Shape()->Centre() - aWhere ).SquaredEuclideanNorm();
151 
152  if( !prioritized[2] || itemDist < dist[2] )
153  {
154  prioritized[2] = item;
155  dist[2] = itemDist;
156  }
157  if( item->Layers().Overlaps( tl ) && itemDist < dist[0] )
158  {
159  prioritized[0] = item;
160  dist[0] = itemDist;
161  }
162  }
163  else
164  {
165  if( !prioritized[3] )
166  prioritized[3] = item;
167  if( item->Layers().Overlaps( tl ) )
168  prioritized[1] = item;
169  }
170  }
171  // Allow unconnected items as last resort in RM_MarkObstacles mode
172  else if ( item->Net() == 0 && m_router->Settings().Mode() == RM_MarkObstacles )
173  {
174  if( item->OfKind( ITEM::SOLID_T ) && aIgnorePads )
175  continue;
176 
177  if( item->Layers().Overlaps( tl ) )
178  prioritized[4] = item;
179  }
180  }
181 
182  ITEM* rv = NULL;
183 
184  for( int i = 0; i < candidateCount; i++ )
185  {
186  ITEM* item = prioritized[i];
187 
189  if( item && !item->Layers().Overlaps( tl ) )
190  item = NULL;
191 
192  if( item )
193  {
194  rv = item;
195  break;
196  }
197  }
198 
199  if( rv && aLayer >= 0 && !rv->Layers().Overlaps( aLayer ) )
200  rv = NULL;
201 
202  if( rv )
203  {
204  wxLogTrace( "PNS", "%s, layer : %d, tl: %d", rv->KindStr().c_str(), rv->Layers().Start(), tl );
205  }
206 
207  return rv;
208 }
PNS_MODE Mode() const
Returns the routing mode.
virtual int GetTopLayer() const
Definition: view.cpp:794
const ITEM_SET QueryHoverItems(const VECTOR2I &aP)
Definition: pns_router.cpp:118
static const int dist[10][10]
Definition: dist.cpp:57
PCB_DISPLAY_OPTIONS * displayOptions() const
Definition: pcb_tool.cpp:211
ROUTER * m_router
Definition: pns_tool_base.h:77
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
#define max(a, b)
Definition: auxiliary.h:86
size_t i
Definition: json11.cpp:597
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
ROUTING_SETTINGS & Settings()
Definition: pns_router.h:187
bool ROUTER_TOOL::prepareInteractive ( )
private

Definition at line 645 of file router_tool.cpp.

References PCB_TOOL::board(), PCB_TOOL::controls(), NETCLASS::Default, DisplayError(), PNS::ROUTER::FailureReason(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PCB_TOOL::frame(), PCB_EDIT_FRAME::GetLayerManager(), BOARD_CONNECTED_ITEM::GetNetClass(), getStartLayer(), PNS::TOOL_BASE::highlightNet(), PNS::SIZES_SETTINGS::Init(), IsCopperLayer(), PNS::TOOL_BASE::m_endItem, PNS::TOOL_BASE::m_endSnapPoint, PNS::TOOL_BASE::m_router, PNS::TOOL_BASE::m_startItem, PNS::TOOL_BASE::m_startSnapPoint, PNS::ITEM::Net(), PNS::ITEM::Parent(), PCB_EDIT_FRAME::SetActiveLayer(), KIGFX::VIEW_CONTROLS::SetAutoPan(), PCB_EDIT_FRAME::SetCurrentNetClass(), LAYER_WIDGET::SetLayerVisible(), PNS::ROUTER::Sizes(), PNS::ROUTER::StartRouting(), ToLAYER_ID(), PCB_BASE_EDIT_FRAME::UndoRedoBlock(), and PNS::ROUTER::UpdateSizes().

Referenced by performRouting().

646 {
647  int routingLayer = getStartLayer( m_startItem );
648 
649  if( !IsCopperLayer( routingLayer ) )
650  {
651  DisplayError( frame(), _( "Tracks on Copper layers only" ) );
652  return false;
653  }
654 
655  frame()->SetActiveLayer( ToLAYER_ID( routingLayer ) );
656 
657  // Force layer visible
658  frame()->GetLayerManager()->SetLayerVisible( routingLayer, true );
659 
660  // for some reason I don't understand, GetNetclass() may return null sometimes...
661  if( m_startItem && m_startItem->Net() >= 0 &&
663  {
664  highlightNet( true, m_startItem->Net() );
665  // Update track width and via size shown in main toolbar comboboxes
666  frame()->SetCurrentNetClass( m_startItem->Parent()->GetNetClass()->GetName() );
667  }
668  else
670 
671  controls()->ForceCursorPosition( false );
672  controls()->SetAutoPan( true );
673 
674  PNS::SIZES_SETTINGS sizes( m_router->Sizes() );
675 
676  sizes.Init( board(), m_startItem );
677  sizes.AddLayerPair( frame()->GetScreen()->m_Route_Layer_TOP,
678  frame()->GetScreen()->m_Route_Layer_BOTTOM );
679  m_router->UpdateSizes( sizes );
680 
681  if( !m_router->StartRouting( m_startSnapPoint, m_startItem, routingLayer ) )
682  {
684  highlightNet( false );
685  controls()->SetAutoPan( false );
686  return false;
687  }
688 
689  m_endItem = NULL;
691 
692  frame()->UndoRedoBlock( true );
693 
694  return true;
695 }
const wxString & FailureReason() const
Definition: pns_router.h:214
VECTOR2I m_startSnapPoint
Definition: pns_tool_base.h:70
void UndoRedoBlock(bool aBlock=true)
Function UndoRedoBlock Enables/disable undo and redo operations.
SIZES_SETTINGS & Sizes()
Definition: pns_router.h:206
bool SetCurrentNetClass(const wxString &aNetClassName)
Function SetCurrentNetClass Must be called after a netclass selection (or after a netclass parameter ...
KIGFX::VIEW_CONTROLS * controls() const
Definition: pcb_tool.h:135
std::shared_ptr< NETCLASS > GetNetClass() const
Function GetNetClass returns the NETCLASS for this item.
static const char Default[]
the name of the default NETCLASS
Definition: netclass.h:90
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
ITEM * m_startItem
Definition: pns_tool_base.h:68
void Init(BOARD *aBoard, ITEM *aStartItem=NULL, int aNet=-1)
ROUTER * m_router
Definition: pns_tool_base.h:77
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
PCB_LAYER_WIDGET * GetLayerManager()
bool StartRouting(const VECTOR2I &aP, ITEM *aItem, int aLayer)
Definition: pns_router.cpp:170
virtual void SetAutoPan(bool aEnabled)
Function SetAutoPan Turns on/off auto panning (this feature is used when there is a tool active (eg...
virtual void highlightNet(bool aEnabled, int aNetcode=-1)
void UpdateSizes(const SIZES_SETTINGS &aSizes)
Applies stored settings.
Definition: pns_router.cpp:308
VECTOR2I m_endSnapPoint
Definition: pns_tool_base.h:73
int Net() const
Function Net()
Definition: pns_item.h:179
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
void SetLayerVisible(LAYER_NUM aLayer, bool isVisible)
Function SetLayerVisible sets aLayer visible or not.
int getStartLayer(const PNS::ITEM *aItem)
void DisplayError(wxWindow *parent, const wxString &text, int displaytime)
Function DisplayError displays an error or warning message box with aMessage.
Definition: confirm.cpp:185
virtual void SetActiveLayer(PCB_LAYER_ID aLayer) override
Function SetActiveLayer will change the currently active layer to aLayer and also update the PCB_LAYE...
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:796
BOARD_CONNECTED_ITEM * Parent() const
Function Parent()
Definition: pns_item.h:159
BOARD * board() const
Definition: pcb_tool.h:137
void ROUTER_TOOL::Reset ( RESET_REASON  aReason)
overridevirtual

Function Reset() Brings the tool to a known, initial state.

If the tool claimed anything from the model or the view, it must release it when its reset.

Parameters
aReasoncontains information about the reason of tool reset.

Reimplemented from PNS::TOOL_BASE.

Definition at line 374 of file router_tool.cpp.

References TOOL_BASE::Reset(), and TOOL_BASE::RUN.

375 {
376  if( aReason == RUN )
377  TOOL_BASE::Reset( aReason );
378 }
Tool is invoked after being inactive.
Definition: tool_base.h:82
virtual void Reset(RESET_REASON aReason)=0
Function Reset() Brings the tool to a known, initial state.
int ROUTER_TOOL::RouteDiffPair ( const TOOL_EVENT aEvent)

Definition at line 827 of file router_tool.cpp.

References PCB_TOOL::frame(), ID_TRACK_BUTT, mainLoop(), PNS::PNS_MODE_ROUTE_DIFF_PAIR, and PCB_BASE_FRAME::SetToolID().

Referenced by setTransitions().

828 {
829  frame()->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Router Differential Pair" ) );
831 }
int mainLoop(PNS::ROUTER_MODE aMode)
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.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
ROUTER * TOOL_BASE::Router ( ) const
inherited

Definition at line 364 of file pns_tool_base.cpp.

References PNS::TOOL_BASE::m_router.

Referenced by EDIT_TOOL::Remove().

365 {
366  return m_router;
367 }
ROUTER * m_router
Definition: pns_tool_base.h:77
int ROUTER_TOOL::RouteSingleTrace ( const TOOL_EVENT aEvent)

Definition at line 820 of file router_tool.cpp.

References PCB_TOOL::frame(), ID_TRACK_BUTT, mainLoop(), PNS::PNS_MODE_ROUTE_SINGLE, and PCB_BASE_FRAME::SetToolID().

Referenced by setTransitions().

821 {
822  frame()->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Route Track" ) );
824 }
int mainLoop(PNS::ROUTER_MODE aMode)
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.
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
void TOOL_INTERACTIVE::RunMainStack ( std::function< void()>  aFunc)
inherited

Function RunMainStack()

Calls a function using the main stack.

Parameters
aFuncis the function to be calls.

Definition at line 85 of file tool_interactive.cpp.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::RunMainStack().

Referenced by DRAWING_TOOL::PlaceText().

86 {
87  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
88 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)
const SELECTION & PCB_TOOL::selection ( ) const
protectedinherited

Definition at line 221 of file pcb_tool.cpp.

References TOOL_MANAGER::GetTool(), and TOOL_BASE::m_toolMgr.

Referenced by PAD_TOOL::applyPadSettings(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), CanInlineDrag(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_EDITOR_CONTROL::CrossProbePcbToSch(), deleteItem(), EDIT_TOOL::Duplicate(), EDIT_TOOL::editFootprintInFpEditor(), EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandSelectedConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), highlightNet(), InlineDrag(), EDIT_TOOL::Main(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDITOR_CONTROL::PlaceModule(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EDIT_TOOL::Remove(), EDIT_TOOL::Rotate(), SELECTION_TOOL::selectCopper(), PCB_TOOL::selection(), SELECTION_TOOL::selectNet(), selectPRitem(), showLocalRatsnest(), PCB_EDITOR_CONTROL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

222 {
223  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
224  const auto& selection = selTool->GetSelection();
225  return selection;
226 }
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
SELECTION & PCB_TOOL::selection ( )
protectedinherited

Definition at line 228 of file pcb_tool.cpp.

References TOOL_MANAGER::GetTool(), TOOL_BASE::m_toolMgr, and PCB_TOOL::selection().

229 {
230  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
231  auto& selection = selTool->GetSelection();
232  return selection;
233 }
Class SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
const SELECTION & selection() const
Definition: pcb_tool.cpp:221
void TOOL_INTERACTIVE::SetContextMenu ( CONTEXT_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Function SetContextMenu()

Assigns a context menu and tells when it should be activated.

Parameters
aMenuis the menu to be assigned.
aTriggerdetermines conditions upon which the context menu is activated.

Definition at line 74 of file tool_interactive.cpp.

References CMENU_OFF, TOOL_BASE::m_toolMgr, TOOL_MANAGER::ScheduleContextMenu(), and CONTEXT_MENU::SetTool().

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), LENGTH_TUNER_TOOL::mainLoop(), mainLoop(), and TOOL_MENU::ShowContextMenu().

75 {
76  if( aMenu )
77  aMenu->SetTool( this );
78  else
79  aTrigger = CMENU_OFF;
80 
81  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
82 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
void ScheduleContextMenu(TOOL_BASE *aTool, CONTEXT_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour of the tool&#39;s context popup menu.
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
void PCB_TOOL::SetEditModules ( bool  aEnabled)
inlineinherited

Function SetEditModules()

Toggles edit module mode. When enabled, one may select parts of modules individually (graphics, pads, etc.), so they can be modified.

Parameters
aEnableddecides if the mode should be enabled.

Definition at line 94 of file pcb_tool.h.

95  {
96  m_editModules = aEnabled;
97  }
bool m_editModules
Definition: pcb_tool.h:144
int ROUTER_TOOL::SettingsDialog ( const TOOL_EVENT aEvent)

Definition at line 790 of file router_tool.cpp.

References PCB_TOOL::frame(), PNS::TOOL_BASE::m_router, PNS::TOOL_BASE::m_savedSettings, and PNS::ROUTER::Settings().

Referenced by setTransitions().

791 {
792  DIALOG_PNS_SETTINGS settingsDlg( frame(), m_router->Settings() );
793 
794  if( settingsDlg.ShowModal() == wxID_OK )
796 
797  return 0;
798 }
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
ROUTER * m_router
Definition: pns_tool_base.h:77
ROUTING_SETTINGS m_savedSettings
Stores routing settings between router invocations.
Definition: pns_tool_base.h:66
ROUTING_SETTINGS & Settings()
Definition: pns_router.h:187
void ROUTER_TOOL::setTransitions ( )
overridevirtual

This method is meant to be overridden in order to specify handlers for events.

It is called every time tool is reset or finished.

Reimplemented from PCB_TOOL.

Definition at line 801 of file router_tool.cpp.

References ACT_CustomTrackWidth, ACT_PlaceBlindVia, ACT_PlaceMicroVia, ACT_PlaceThroughVia, ACT_SelLayerAndPlaceBlindVia, ACT_SelLayerAndPlaceThroughVia, CustomTrackWidthDialog(), DpDimensionsDialog(), TOOL_INTERACTIVE::Go(), InlineDrag(), TOOL_ACTION::MakeEvent(), onTrackViaSizeChanged(), onViaCommand(), RouteDiffPair(), PCB_ACTIONS::routerActivateDiffPair, PCB_ACTIONS::routerActivateDpDimensionsDialog, PCB_ACTIONS::routerActivateSettingsDialog, PCB_ACTIONS::routerActivateSingle, PCB_ACTIONS::routerInlineDrag, RouteSingleTrace(), SettingsDialog(), and PCB_ACTIONS::trackViaSizeChanged.

802 {
808 
814 
817 }
int DpDimensionsDialog(const TOOL_EVENT &aEvent)
int InlineDrag(const TOOL_EVENT &aEvent)
int RouteSingleTrace(const TOOL_EVENT &aEvent)
static const TOOL_ACTION ACT_PlaceBlindVia("pcbnew.InteractiveRouter.PlaceBlindVia", AS_CONTEXT, TOOL_ACTION::LegacyHotKey(HK_ADD_BLIND_BURIED_VIA), _("Place Blind/Buried Via"), _("Adds a blind or buried via at the end of currently routed track."), via_buried_xpm, AF_NONE,(void *) VIA_ACTION_FLAGS::BLIND_VIA)
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:291
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:195
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
int onViaCommand(const TOOL_EVENT &aEvent)
int RouteDiffPair(const TOOL_EVENT &aEvent)
int SettingsDialog(const TOOL_EVENT &aEvent)
int CustomTrackWidthDialog(const TOOL_EVENT &aEvent)
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)
int onTrackViaSizeChanged(const TOOL_EVENT &aEvent)
static TOOL_ACTION routerInlineDrag
Activation of the Push and Shove router (inline dragging mode)
Definition: pcb_actions.h:215
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)
TOOL_EVENT MakeEvent() const
Function HasHotKey() Checks if the action has a hot key assigned.
Definition: tool_action.h:104
static TOOL_ACTION routerActivateSettingsDialog
Activation of the Push and Shove settings dialogs.
Definition: pcb_actions.h:210
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 TOOL_ACTION routerActivateDiffPair
Activation of the Push and Shove router (differential pair mode)
Definition: pcb_actions.h:198
static TOOL_ACTION routerActivateDpDimensionsDialog
Definition: pcb_actions.h:211
const VECTOR2I TOOL_BASE::snapToItem ( bool  aEnabled,
ITEM aItem,
VECTOR2I  aP 
)
protectedinherited

Definition at line 370 of file pns_tool_base.cpp.

References SEG::A, GRID_HELPER::Align(), GRID_HELPER::AlignToSegment(), SEG::B, PNS::ITEM::Kind(), PNS::TOOL_BASE::m_gridHelper, PNS::SEGMENT::Seg(), PNS::ITEM::SEGMENT_T, PNS::ITEM::SOLID_T, PNS::ITEM::VIA_T, and PNS::SEGMENT::Width().

Referenced by PNS::TOOL_BASE::updateEndItem(), and PNS::TOOL_BASE::updateStartItem().

371 {
372  VECTOR2I anchor;
373 
374  if( !aItem || !aEnabled )
375  {
376  return m_gridHelper->Align( aP );
377  }
378 
379  switch( aItem->Kind() )
380  {
381  case ITEM::SOLID_T:
382  anchor = static_cast<SOLID*>( aItem )->Pos();
383  break;
384 
385  case ITEM::VIA_T:
386  anchor = static_cast<VIA*>( aItem )->Pos();
387  break;
388 
389  case ITEM::SEGMENT_T:
390  {
391  SEGMENT* seg = static_cast<SEGMENT*>( aItem );
392  const SEG& s = seg->Seg();
393  int w = seg->Width();
394 
395 
396  if( ( aP - s.A ).EuclideanNorm() < w / 2 )
397  anchor = s.A;
398  else if( ( aP - s.B ).EuclideanNorm() < w / 2 )
399  anchor = s.B;
400  else
401  anchor = m_gridHelper->AlignToSegment( aP, s );
402 
403  break;
404  }
405 
406  default:
407  break;
408  }
409 
410  return anchor;
411 }
GRID_HELPER * m_gridHelper
Definition: pns_tool_base.h:75
VECTOR2I Align(const VECTOR2I &aPoint) const
VECTOR2I AlignToSegment(const VECTOR2I &aPoint, const SEG &aSeg)
Definition: seg.h:36
VECTOR2I A
Definition: seg.h:46
VECTOR2I B
Definition: seg.h:47
void ROUTER_TOOL::switchLayerOnViaPlacement ( )
private

Definition at line 449 of file router_tool.cpp.

References PCB_TOOL::frame(), PCB_BASE_FRAME::GetActiveLayer(), PNS::ROUTER::GetCurrentLayer(), PNS::SIZES_SETTINGS::GetLayerTop(), PNS::TOOL_BASE::m_router, PNS::SIZES_SETTINGS::PairedLayer(), PCB_EDIT_FRAME::SetActiveLayer(), PNS::ROUTER::Sizes(), PNS::ROUTER::SwitchLayer(), and ToLAYER_ID().

Referenced by performRouting().

450 {
451  int al = frame()->GetActiveLayer();
452  int cl = m_router->GetCurrentLayer();
453 
454  if( cl != al )
455  {
456  m_router->SwitchLayer( al );
457  }
458 
459  OPT<int> newLayer = m_router->Sizes().PairedLayer( cl );
460 
461  if( !newLayer )
462  newLayer = m_router->Sizes().GetLayerTop();
463 
464  m_router->SwitchLayer( *newLayer );
465  frame()->SetActiveLayer( ToLAYER_ID( *newLayer ) );
466 }
SIZES_SETTINGS & Sizes()
Definition: pns_router.h:206
void SwitchLayer(int layer)
Definition: pns_router.cpp:426
PCB_EDIT_FRAME * frame() const
Definition: pcb_tool.h:136
ROUTER * m_router
Definition: pns_tool_base.h:77
boost::optional< T > OPT
Definition: optional.h:7
int GetCurrentLayer() const
Definition: pns_router.cpp:458
OPT< int > PairedLayer(int aLayerId)
virtual void SetActiveLayer(PCB_LAYER_ID aLayer) override
Function SetActiveLayer will change the currently active layer to aLayer and also update the PCB_LAYE...
virtual PCB_LAYER_ID GetActiveLayer() const
Function GetActiveLayer returns the active layer.
PCB_LAYER_ID ToLAYER_ID(int aLayer)
Definition: lset.cpp:796
void TOOL_BASE::updateEndItem ( const TOOL_EVENT aEvent)
protectedvirtualinherited

Definition at line 285 of file pns_tool_base.cpp.

References PNS::TOOL_BASE::checkSnap(), PCB_TOOL::controls(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PNS::ROUTER::GetCurrentLayer(), PNS::ROUTER::GetCurrentNets(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), KIGFX::VIEW_CONTROLS::GetMousePosition(), PNS::ROUTER::IsPlacingVia(), PNS::ITEM::KindStr(), PNS::ITEM::Layers(), PNS::TOOL_BASE::m_endItem, PNS::TOOL_BASE::m_endSnapPoint, PNS::TOOL_BASE::m_router, MD_SHIFT, PNS::ROUTING_SETTINGS::Mode(), TOOL_EVENT::Modifier(), PNS::TOOL_BASE::pickSingleItem(), PNS::RM_MarkObstacles, PNS::ROUTER::Settings(), PNS::TOOL_BASE::snapToItem(), and LAYER_RANGE::Start().

Referenced by InlineDrag(), onViaCommand(), performDragging(), and performRouting().

286 {
287  controls()->ForceCursorPosition( false );
288 
289  VECTOR2I mousePos = controls()->GetMousePosition();
290  VECTOR2I cursorPos = controls()->GetCursorPosition();
291 
292  int layer;
293  bool snapEnabled = !aEvent.Modifier( MD_SHIFT );
294 
295  if( m_router->Settings().Mode() != RM_MarkObstacles &&
296  ( m_router->GetCurrentNets().empty() || m_router->GetCurrentNets().front() < 0 ) )
297  {
298  m_endSnapPoint = snapToItem( snapEnabled, nullptr, mousePos );
300  m_endItem = nullptr;
301 
302  return;
303  }
304 
305  if( m_router->IsPlacingVia() )
306  layer = -1;
307  else
308  layer = m_router->GetCurrentLayer();
309 
310  ITEM* endItem = nullptr;
311 
312  std::vector<int> nets = m_router->GetCurrentNets();
313 
314  for( int net : nets )
315  {
316  endItem = pickSingleItem( mousePos, net, layer );
317 
318  if( endItem )
319  break;
320  }
321 
322  if( checkSnap( endItem ) )
323  {
324  VECTOR2I p = snapToItem( snapEnabled, endItem, mousePos );
325  controls()->ForceCursorPosition( true, p );
326  m_endItem = endItem;
327  m_endSnapPoint = p;
328  } else {
329  m_endItem = nullptr;
330  m_endSnapPoint = cursorPos;
331  }
332 
333  if( m_endItem )
334  {
335  wxLogTrace( "PNS", "%s, layer : %d", m_endItem->KindStr().c_str(), m_endItem->Layers().Start() );
336  }
337 }
PNS_MODE Mode() const
Returns the routing mode.
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Function GetMousePosition() Returns the current mouse pointer position.
const LAYER_RANGE & Layers() const
Function Layers()
Definition: pns_item.h:209
int Modifier(int aMask=MD_MODIFIER_MASK) const
Returns information about key modifiers state (Ctrl, Alt, etc.)
Definition: tool_event.h:316
bool IsPlacingVia() const
Definition: pns_router.cpp:489
const std::vector< int > GetCurrentNets() const
Definition: pns_router.cpp:449
const VECTOR2I snapToItem(bool aEnabled, ITEM *aItem, VECTOR2I aP)
virtual ITEM * pickSingleItem(const VECTOR2I &aWhere, int aNet=-1, int aLayer=-1, bool aIgnorePads=false)
KIGFX::VIEW_CONTROLS * controls() const
Definition: pcb_tool.h:135
bool checkSnap(ITEM *aItem)
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
ROUTER * m_router
Definition: pns_tool_base.h:77
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
int Start() const
Definition: pns_layerset.h:83
VECTOR2I m_endSnapPoint
Definition: pns_tool_base.h:73
int GetCurrentLayer() const
Definition: pns_router.cpp:458
ROUTING_SETTINGS & Settings()
Definition: pns_router.h:187
const std::string KindStr() const
Function KindStr()
Definition: pns_item.cpp:63
void TOOL_BASE::updateStartItem ( TOOL_EVENT aEvent,
bool  aIgnorePads = false 
)
protectedvirtualinherited

Definition at line 251 of file pns_tool_base.cpp.

References PNS::TOOL_BASE::checkSnap(), PCB_TOOL::controls(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), KIGFX::VIEW::GetTopLayer(), TOOL_BASE::getView(), TOOL_EVENT::IsClick(), TOOL_EVENT::IsMotion(), PNS::ITEM::Layers(), PNS::TOOL_BASE::m_startItem, PNS::TOOL_BASE::m_startSnapPoint, MD_SHIFT, TOOL_EVENT::Modifier(), LAYER_RANGE::Overlaps(), PNS::TOOL_BASE::pickSingleItem(), TOOL_EVENT::Position(), and PNS::TOOL_BASE::snapToItem().

Referenced by LENGTH_TUNER_TOOL::mainLoop(), and mainLoop().

252 {
253  int tl = getView()->GetTopLayer();
255  VECTOR2I p;
256 
257  controls()->ForceCursorPosition( false );
258 
259  bool snapEnabled = true;
260 
261  if( aEvent.IsMotion() || aEvent.IsClick() )
262  {
263  snapEnabled = !aEvent.Modifier( MD_SHIFT );
264  p = aEvent.Position();
265  }
266  else
267  {
268  p = cp;
269  }
270 
271  m_startItem = pickSingleItem( p, -1, -1, aIgnorePads );
272 
273  if( !snapEnabled && m_startItem && !m_startItem->Layers().Overlaps( tl ) )
274  m_startItem = nullptr;
275 
276  m_startSnapPoint = snapToItem( snapEnabled, m_startItem, p );
277 
278  if( checkSnap ( m_startItem ))
279  {
281  }
282 }
virtual int GetTopLayer() const
Definition: view.cpp:794
const LAYER_RANGE & Layers() const
Function Layers()
Definition: pns_item.h:209
bool IsMotion() const
Definition: tool_event.h:290
VECTOR2I m_startSnapPoint
Definition: pns_tool_base.h:70
int Modifier(int aMask=MD_MODIFIER_MASK) const
Returns information about key modifiers state (Ctrl, Alt, etc.)
Definition: tool_event.h:316
const VECTOR2D & Position() const
Returns mouse cursor position in world coordinates.
Definition: tool_event.h:248
const VECTOR2I snapToItem(bool aEnabled, ITEM *aItem, VECTOR2I aP)
virtual ITEM * pickSingleItem(const VECTOR2I &aWhere, int aNet=-1, int aLayer=-1, bool aIgnorePads=false)
KIGFX::VIEW_CONTROLS * controls() const
Definition: pcb_tool.h:135
bool checkSnap(ITEM *aItem)
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.
ITEM * m_startItem
Definition: pns_tool_base.h:68
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
bool Overlaps(const LAYER_RANGE &aOther) const
Definition: pns_layerset.h:68
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:35
bool IsClick(int aButtonMask=BUT_ANY) const
Definition: tool_event.h:268
OPT_TOOL_EVENT TOOL_INTERACTIVE::Wait ( const TOOL_EVENT_LIST aEventList = TOOL_EVENTTC_ANYTA_ANY ))
inherited

Function Wait()

Suspends execution of the tool until an event specified in aEventList arrives. No parameters means waiting for any event.

Definition at line 55 of file tool_interactive.cpp.

References TOOL_BASE::m_toolMgr, and TOOL_MANAGER::ScheduleWait().

Referenced by PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SELECTION_TOOL::disambiguationMenu(), PCB_TOOL::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), PCB_EDITOR_CONTROL::DrillOrigin(), MODULE_EDITOR_TOOLS::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::HighlightNetCursor(), InlineDrag(), ZOOM_TOOL::Main(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), mainLoop(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::MeasureTool(), POINT_EDITOR::OnSelectionChange(), performDragging(), performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::runPolygonEventLoop(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), and PCB_EDITOR_CONTROL::ShowLocalRatsnest().

56 {
57  return m_toolMgr->ScheduleWait( this, aEventList );
58 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:215
OPT< TOOL_EVENT > ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pauses execution of a given tool until one or more events matching aConditions arrives.

Member Data Documentation

ITEM* PNS::TOOL_BASE::m_endItem
protectedinherited
VECTOR2I PNS::TOOL_BASE::m_endSnapPoint
protectedinherited
GRID_HELPER* PNS::TOOL_BASE::m_gridHelper
protectedinherited
PNS_KICAD_IFACE* PNS::TOOL_BASE::m_iface
protectedinherited
MSG_PANEL_ITEMS PNS::TOOL_BASE::m_panelItems
protectedinherited

Definition at line 64 of file pns_tool_base.h.

ROUTING_SETTINGS PNS::TOOL_BASE::m_savedSettings
protectedinherited

Stores routing settings between router invocations.

Definition at line 66 of file pns_tool_base.h.

Referenced by Init(), LENGTH_TUNER_TOOL::mainLoop(), mainLoop(), PNS::TOOL_BASE::Reset(), SettingsDialog(), and ~ROUTER_TOOL().

SIZES_SETTINGS PNS::TOOL_BASE::m_savedSizes
protectedinherited

Stores sizes settings between router invocations.

Definition at line 67 of file pns_tool_base.h.

Referenced by DpDimensionsDialog(), LENGTH_TUNER_TOOL::mainLoop(), mainLoop(), and PNS::TOOL_BASE::Reset().

int PNS::TOOL_BASE::m_startLayer
protectedinherited

Definition at line 69 of file pns_tool_base.h.

Referenced by PNS::TOOL_BASE::TOOL_BASE().

VECTOR2I PNS::TOOL_BASE::m_startSnapPoint
protectedinherited
TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Unique identifier for the tool, assigned by a TOOL_MANAGER instance.

Definition at line 210 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), and TOOL_BASE::IsToolActive().

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 215 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PAD_TOOL::applyPadSettings(), TOOL_BASE::attachManager(), PCB_EDITOR_CONTROL::calculateSelectionRatsnest(), CanInlineDrag(), GERBVIEW_SELECTION_TOOL::clearSelection(), SELECTION_TOOL::clearSelection(), PAD_TOOL::copyPadSettings(), MODULE_EDITOR_TOOLS::CreatePadFromShapes(), PCB_EDITOR_CONTROL::CrossProbePcbToSch(), PCB_EDITOR_CONTROL::CrossProbeSchToPcb(), PCBNEW_CONTROL::CursorControl(), CustomTrackWidthDialog(), PCBNEW_CONTROL::DeleteItemCursor(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::drawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), EDIT_TOOL::Duplicate(), EDIT_TOOL::editFootprintInFpEditor(), MODULE_EDITOR_TOOLS::EnumeratePads(), EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandSelectedConnection(), MODULE_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::findCallback(), SELECTION_TOOL::findMove(), EDIT_TOOL::Flip(), TOOL_BASE::getEditFrameInt(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), PCB_EDITOR_CONTROL::HighlightNet(), PCB_EDITOR_CONTROL::HighlightNetCursor(), PICKER_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PAD_TOOL::Init(), POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EDIT_TOOL::Init(), InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), ZOOM_TOOL::Main(), PICKER_TOOL::Main(), EDIT_TOOL::Main(), SELECTION_TOOL::Main(), LENGTH_TUNER_TOOL::mainLoop(), mainLoop(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), EDIT_TOOL::pickCopyReferencePoint(), PCBNEW_CONTROL::placeBoardItems(), DRAWING_TOOL::PlaceDXF(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), GERBVIEW_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), PCBNEW_CONTROL::ResetCoords(), TOOL_INTERACTIVE::resetTransitions(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), SELECTION_TOOL::SanitizeSelection(), SELECTION_TOOL::selectCopper(), PCB_TOOL::selection(), GERBVIEW_SELECTION_TOOL::SelectItem(), SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), GERBVIEW_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), SELECTION_TOOL::selectOnSheetFromEeschema(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), TOOL_INTERACTIVE::SetContextMenu(), PCB_EDITOR_CONTROL::ShowLocalRatsnest(), GERBVIEW_SELECTION_TOOL::toggleSelection(), SELECTION_TOOL::toggleSelection(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), GERBVIEW_SELECTION_TOOL::UnselectItem(), SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), PCB_EDITOR_CONTROL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

std::string TOOL_BASE::m_toolName
protectedinherited

Name of the tool.

Names are expected to obey the format application.ToolName

(eg. pcbnew.InteractiveSelection).

Definition at line 214 of file tool_base.h.

TOOL_SETTINGS TOOL_BASE::m_toolSettings
protectedinherited

Definition at line 216 of file tool_base.h.

Referenced by TOOL_BASE::attachManager().

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 207 of file tool_base.h.


The documentation for this class was generated from the following files: