KiCad PCB EDA Suite
PNS::TOOL_BASE Class Reference

#include <pns_tool_base.h>

Inheritance diagram for PNS::TOOL_BASE:
PCB_TOOL_BASE TOOL_INTERACTIVE TOOL_BASE LENGTH_TUNER_TOOL ROUTER_TOOL

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 TOOL_BASE (const std::string &aToolName)
 
virtual ~TOOL_BASE ()
 
virtual void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
ROUTERRouter () const
 
virtual bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
void SetEditModules (bool aEnabled)
 Function SetEditModules() More...
 
bool EditingModules () const
 
void Activate ()
 Function Activate() Runs the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_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...
 
TOOL_EVENTWait (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...
 
bool IsToolActive () const
 

Protected Types

enum  INTERACTIVE_PLACEMENT_OPTIONS { IPO_ROTATE = 0x01, IPO_FLIP = 0x02, IPO_SINGLE_CLICK = 0x04, IPO_REPEAT = 0x08 }
 Options for placing items interactively. More...
 

Protected Member Functions

bool checkSnap (ITEM *aItem)
 
const VECTOR2I snapToItem (bool aEnabled, ITEM *aItem, VECTOR2I aP)
 
virtual ITEMpickSingleItem (const VECTOR2I &aWhere, int aNet=-1, int aLayer=-1, bool aIgnorePads=false, const std::vector< ITEM * > aAvoidItems={})
 
virtual void highlightNet (bool aEnabled, int aNetcode=-1)
 
virtual void updateStartItem (const TOOL_EVENT &aEvent, bool aIgnorePads=false)
 
virtual void updateEndItem (const TOOL_EVENT &aEvent)
 
void deleteTraces (ITEM *aStartItem, bool aWholeTrack)
 
void doInteractiveItemPlacement (const std::string &aTool, 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...
 
virtual void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. More...
 
KIGFX::PCB_VIEWview () const
 
KIGFX::VIEW_CONTROLScontrols () const
 
PCB_BASE_EDIT_FRAMEframe () const
 
BOARDboard () const
 
MODULEmodule () const
 
const PCB_DISPLAY_OPTIONSdisplayOptions () const
 
PCB_DRAW_PANEL_GALcanvas () const
 
const PCBNEW_SELECTIONselection () const
 
PCBNEW_SELECTIONselection ()
 
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
 
SIZES_SETTINGS m_savedSizes
 Stores sizes settings between router invocations. More...
 
ITEMm_startItem
 
int m_startLayer
 
VECTOR2I m_startSnapPoint
 
bool m_startHighlight
 Keeps track of whether the net was highlighted before routing. More...
 
ITEMm_endItem
 
VECTOR2I m_endSnapPoint
 
GRID_HELPERm_gridHelper
 
PNS_KICAD_IFACEm_iface
 
ROUTERm_router
 
bool m_cancelled
 
bool m_editModules
 
TOOL_MENU m_menu
 functions below are not yet implemented - their interface may change More...
 
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
 

Detailed Description

Definition at line 44 of file pns_tool_base.h.

Member Enumeration Documentation

◆ INTERACTIVE_PLACEMENT_OPTIONS

Options for placing items interactively.

Enumerator
IPO_ROTATE 

Handle the rotate action in the loop by calling the item's rotate method.

IPO_FLIP 

Handle flip action in the loop by calling the item's flip method.

IPO_SINGLE_CLICK 

Create an item immediately on placement starting, otherwise show the pencil cursor until the item is created.

IPO_REPEAT 

Allow repeat placement of the item.

Definition at line 116 of file pcb_tool_base.h.

116  {
118  IPO_ROTATE = 0x01,
119 
121  IPO_FLIP = 0x02,
122 
125  IPO_SINGLE_CLICK = 0x04,
126 
128  IPO_REPEAT = 0x08
129  };
Handle flip action in the loop by calling the item's flip method.
Allow repeat placement of the item.
Create an item immediately on placement starting, otherwise show the pencil cursor until the item is ...
Handle the rotate action in the loop by calling the item's rotate method.

◆ RESET_REASON

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 79 of file tool_base.h.

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

Constructor & Destructor Documentation

◆ TOOL_BASE()

TOOL_BASE::TOOL_BASE ( const std::string &  aToolName)

Definition at line 65 of file pns_tool_base.cpp.

65  :
66  PCB_TOOL_BASE( aToolName )
67 {
68  m_gridHelper = nullptr;
69  m_iface = nullptr;
70  m_router = nullptr;
71  m_cancelled = false;
72 
73  m_startItem = nullptr;
74  m_startLayer = 0;
75  m_startHighlight = false;
76 
77  m_endItem = nullptr;
78  m_gridHelper = nullptr;
79 
80  m_cancelled = false;
81 }
GRID_HELPER * m_gridHelper
Definition: pns_tool_base.h:75
bool m_startHighlight
Keeps track of whether the net was highlighted before routing.
Definition: pns_tool_base.h:70
ITEM * m_startItem
Definition: pns_tool_base.h:67
ROUTER * m_router
Definition: pns_tool_base.h:77
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool_base.h:75
PNS_KICAD_IFACE * m_iface
Definition: pns_tool_base.h:76

References m_cancelled, m_endItem, m_gridHelper, m_iface, m_router, m_startHighlight, m_startItem, and m_startLayer.

◆ ~TOOL_BASE()

TOOL_BASE::~TOOL_BASE ( )
virtual

Reimplemented from TOOL_BASE.

Definition at line 84 of file pns_tool_base.cpp.

85 {
86  delete m_gridHelper;
87  delete m_iface;
88  delete m_router;
89 }
GRID_HELPER * m_gridHelper
Definition: pns_tool_base.h:75
ROUTER * m_router
Definition: pns_tool_base.h:77
PNS_KICAD_IFACE * m_iface
Definition: pns_tool_base.h:76

References m_gridHelper, m_iface, and m_router.

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Function Activate() Runs the tool.

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

Definition at line 51 of file tool_interactive.cpp.

52 {
54 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool InvokeTool(TOOL_ID aToolId)
Function InvokeTool() Calls a tool by sending a tool activation event to tool of given ID.

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

Referenced by AUTOPLACE_TOOL::autoplace(), EDIT_TOOL::copyToClipboard(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCBNEW_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::Move(), LIB_TREE::onContextMenu(), POINT_EDITOR::OnSelectionChange(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ attachManager()

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 60 of file tool_base.cpp.

61 {
62  m_toolMgr = aManager;
63 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD* PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 166 of file pcb_tool_base.h.

166 { return getModel<BOARD>(); }

Referenced by PCBNEW_CONTROL::AppendBoard(), AUTOPLACE_TOOL::autoplace(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), EDIT_TOOL::ChangeTrackWidth(), ZONE_FILLER_TOOL::CheckAllZones(), DRC::checkClearancePadToPad(), DRC::checkClearanceSegmToPad(), PCB_INSPECTION_TOOL::ClearHighlight(), DRAWING_TOOL::constrainDimension(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), FOOTPRINT_EDITOR_TOOLS::CreatePadFromShapes(), ROUTER_TOOL::CustomTrackWidthDialog(), PCBNEW_CONTROL::DeleteItemCursor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), PAD_TOOL::EnumeratePads(), FOOTPRINT_EDITOR_TOOLS::ExplodePadToShapes(), ZONE_FILLER_TOOL::FillAllZones(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::getCollectorsGuide(), PCB_INSPECTION_TOOL::highlightNet(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PCB_TOOL_BASE::module(), ROUTER_TOOL::onTrackViaSizeChanged(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::Paste(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), SELECTION_TOOL::RebuildSelection(), EDIT_TOOL::Remove(), Reset(), PCBNEW_CONTROL::Reset(), SELECTION_TOOL::Selectable(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectAllItemsOnSheet(), SELECTION_TOOL::selectConnectedTracks(), SELECTION_TOOL::selectPoint(), DRC::testDisabledLayers(), DRC::testZoneToZoneOutlines(), PCBNEW_CONTROL::TrackDisplayMode(), POINT_EDITOR::updateItem(), PCBNEW_CONTROL::ViaDisplayMode(), PCBNEW_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ canvas()

◆ checkSnap()

bool TOOL_BASE::checkSnap ( ITEM aItem)
protected

Definition at line 249 of file pns_tool_base.cpp.

250 {
251  // Sync PNS engine settings with the general PCB editor options.
252  auto& pnss = m_router->Settings();
253 
254  pnss.SetSnapToPads(
255  frame()->GetMagneticItemsSettings()->pads == MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL ||
256  frame()->GetMagneticItemsSettings()->pads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS );
257 
258  pnss.SetSnapToTracks(
259  frame()->GetMagneticItemsSettings()->tracks == MAGNETIC_OPTIONS::CAPTURE_CURSOR_IN_TRACK_TOOL
260  || frame()->GetMagneticItemsSettings()->tracks == MAGNETIC_OPTIONS::CAPTURE_ALWAYS );
261 
262  if( aItem )
263  {
264  if( aItem->OfKind( ITEM::VIA_T | ITEM::SEGMENT_T | ITEM::ARC_T ) )
265  return pnss.GetSnapToTracks();
266  else if( aItem->OfKind( ITEM::SOLID_T ) )
267  return pnss.GetSnapToPads();
268  }
269 
270  return false;
271 }
PCB_BASE_EDIT_FRAME * frame() const
ROUTER * m_router
Definition: pns_tool_base.h:77
void SetSnapToPads(bool aSnap)
ROUTING_SETTINGS & Settings()
Definition: pns_router.h:199

References PNS::ITEM::ARC_T, CAPTURE_ALWAYS, CAPTURE_CURSOR_IN_TRACK_TOOL, PCB_TOOL_BASE::frame(), m_router, PNS::ITEM::OfKind(), PNS::ITEM::SEGMENT_T, PNS::ROUTING_SETTINGS::SetSnapToPads(), PNS::ROUTER::Settings(), PNS::ITEM::SOLID_T, and PNS::ITEM::VIA_T.

Referenced by updateEndItem(), and updateStartItem().

◆ controls()

◆ deleteTraces()

void TOOL_BASE::deleteTraces ( ITEM aStartItem,
bool  aWholeTrack 
)
protected

Definition at line 364 of file pns_tool_base.cpp.

365 {
366  NODE *node = m_router->GetWorld()->Branch();
367 
368  if( !aStartItem )
369  return;
370 
371  if( !aWholeTrack )
372  {
373  node->Remove( aStartItem );
374  }
375  else
376  {
377  TOPOLOGY topo( node );
378  ITEM_SET path = topo.AssembleTrivialPath( aStartItem );
379 
380  for( const auto& ent : path.Items() )
381  node->Remove( ent.item );
382  }
383 
384  m_router->CommitRouting( node );
385 }
void CommitRouting()
Definition: pns_router.cpp:422
NODE * Branch()
Function Branch()
Definition: pns_node.cpp:106
void Remove(ARC *aArc)
Function Remove()
Definition: pns_node.cpp:796
ROUTER * m_router
Definition: pns_tool_base.h:77
std::unordered_set< SCH_ITEM * > ITEM_SET
Definition: sch_item.h:142
NODE * GetWorld() const
Definition: pns_router.h:152

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

◆ displayOptions()

const PCB_DISPLAY_OPTIONS & PCB_TOOL_BASE::displayOptions ( ) const
protectedinherited

Definition at line 264 of file pcb_tool_base.cpp.

265 {
266  return frame()->GetDisplayOptions();
267 }
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions returns the display options current in use Display options are relative to...
PCB_BASE_EDIT_FRAME * frame() const

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

Referenced by PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), PCBNEW_CONTROL::HighContrastMode(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), pickSingleItem(), PCBNEW_CONTROL::ToggleRatsnest(), PCBNEW_CONTROL::TrackDisplayMode(), PCBNEW_CONTROL::ViaDisplayMode(), and PCBNEW_CONTROL::ZoneDisplayMode().

◆ doInteractiveItemPlacement()

void PCB_TOOL_BASE::doInteractiveItemPlacement ( const std::string &  aTool,
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 37 of file pcb_tool_base.cpp.

40 {
41  using namespace std::placeholders;
42  std::unique_ptr<BOARD_ITEM> newItem;
43 
44  frame()->PushTool( aTool );
45  Activate();
46 
47  BOARD_COMMIT commit( frame() );
48 
50 
51  // do not capture or auto-pan until we start placing an item
52  controls()->ShowCursor( true );
53  controls()->SetSnapping( true );
54 
55  // Add a VIEW_GROUP that serves as a preview for the new item
56  PCBNEW_SELECTION preview;
57  view()->Add( &preview );
58 
59  aPlacer->m_board = board();
60  aPlacer->m_frame = frame();
61  aPlacer->m_modifiers = 0;
62 
63  auto makeNewItem = [&] ( VECTOR2I aPosition )
64  {
65  if( frame()->GetModel() )
66  newItem = aPlacer->CreateItem();
67 
68  if( newItem )
69  {
70  newItem->SetPosition( (wxPoint) aPosition );
71  preview.Add( newItem.get() );
72 
73  if( newItem->Type() == PCB_MODULE_T )
74  {
75  auto module = dyn_cast<MODULE*>( newItem.get() );
76 
77  // modules have more drawable parts
78  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
79  }
80  }
81  };
82 
83  if( aOptions & IPO_SINGLE_CLICK )
84  makeNewItem( controls()->GetCursorPosition() );
85 
86  // Main loop: keep receiving events
87  while( TOOL_EVENT* evt = Wait() )
88  {
89  if( !newItem )
90  frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
91  else
92  frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
93 
94  VECTOR2I cursorPos = controls()->GetCursorPosition();
95  aPlacer->m_modifiers = evt->Modifier();
96 
97  auto cleanup = [&] ()
98  {
99  newItem = nullptr;
100  preview.Clear();
101  view()->Update( &preview );
102  controls()->SetAutoPan( false );
103  controls()->CaptureCursor( false );
104  controls()->ShowCursor( true );
105  };
106 
107  if( evt->IsCancelInteractive() )
108  {
109  if( aOptions & IPO_SINGLE_CLICK )
110  {
111  cleanup();
112  frame()->PopTool( aTool );
113  break;
114  }
115  else if( newItem )
116  cleanup();
117  else
118  {
119  frame()->PopTool( aTool );
120  break;
121  }
122  }
123  else if( evt->IsActivate() )
124  {
125  if( newItem )
126  cleanup();
127 
128  if( evt->IsPointEditor() )
129  {
130  // don't exit (the point editor runs in the background)
131  }
132  else if( evt->IsMoveTool() )
133  {
134  // leave ourselves on the stack so we come back after the move
135  break;
136  }
137  else
138  {
139  frame()->PopTool( aTool );
140  break;
141  }
142  }
143  else if( evt->IsClick( BUT_LEFT ) )
144  {
145  if( !newItem )
146  {
147  // create the item if possible
148  makeNewItem( cursorPos );
149 
150  // no item created, so wait for another click
151  if( !newItem )
152  continue;
153 
154  controls()->CaptureCursor( true );
155  controls()->SetAutoPan( true );
156  }
157  else
158  {
159  auto oldFlags = newItem->GetFlags();
160  newItem->ClearFlags();
161 
162  if( !aPlacer->PlaceItem( newItem.get(), commit ) )
163  {
164  newItem->SetFlags( oldFlags );
165  continue;
166  }
167 
168  preview.Clear();
169  newItem.release();
170  commit.Push( aCommitMessage );
171 
172  controls()->CaptureCursor( false );
173  controls()->SetAutoPan( false );
174  controls()->ShowCursor( true );
175 
176  if( !( aOptions & IPO_REPEAT ) )
177  break;
178 
179  if( aOptions & IPO_SINGLE_CLICK )
180  makeNewItem( controls()->GetCursorPosition() );
181  }
182  }
183  else if( evt->IsClick( BUT_RIGHT ) )
184  {
186  }
187  else if( newItem && evt->Category() == TC_COMMAND )
188  {
189  /*
190  * Handle any events that can affect the item as we move it around
191  */
192  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
193  {
194  const int rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *frame(), *evt );
195  newItem->Rotate( newItem->GetPosition(), rotationAngle );
196  view()->Update( &preview );
197  }
198  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
199  {
200  newItem->Flip( newItem->GetPosition(), frame()->Settings().m_FlipLeftRight );
201  view()->Update( &preview );
202  }
203  else if( evt->IsAction( &PCB_ACTIONS::viaSizeInc )
204  || evt->IsAction( &PCB_ACTIONS::viaSizeDec ) )
205  {
206  // Refresh preview after event runs
208  }
209  else if( evt->IsAction( &ACTIONS::refreshPreview ) )
210  {
211  preview.Clear();
212  newItem.release();
213 
214  makeNewItem( controls()->GetCursorPosition() );
215  view()->Update( &preview );
216  }
217  }
218 
219  else if( newItem && evt->IsMotion() )
220  {
221  // track the cursor
222  newItem->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
223  aPlacer->SnapItem( newItem.get() );
224 
225  // Show a preview of the item
226  view()->Update( &preview );
227  }
228 
229  else
230  evt->SetPassEvent();
231  }
232 
233  view()->Remove( &preview );
234 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:62
virtual void ShowCursor(bool aEnabled)
Function ShowCursor() Enables or disables display of cursor.
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
virtual void Clear() override
Function Clear() Removes all the stored items from the group.
Definition: selection.h:94
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction)
Function RunOnChildren.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Function Wait()
virtual bool PlaceItem(BOARD_ITEM *aItem, BOARD_COMMIT &aCommit)
Handle flip action in the loop by calling the item's flip method.
BOARD * board() const
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:91
static TOOL_ACTION viaSizeInc
Definition: pcb_actions.h:278
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
void SetCurrentCursor(wxStockCursor aStockCursorID)
Function SetCurrentCursor Set the current cursor shape for this panel.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
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:139
bool IsRotateToolEvt(const TOOL_EVENT &aEvt)
Function isRotateToolEvt()
virtual void Remove(VIEW_ITEM *aItem) override
Function Remove() Removes a VIEW_ITEM from the view.
Definition: pcb_view.cpp:74
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:75
TOOL_MANAGER * GetManager() const
Function GetManager() Returns the instance of TOOL_MANAGER that takes care of the tool.
Definition: tool_base.h:143
PCB_BASE_EDIT_FRAME * frame() const
virtual void SnapItem(BOARD_ITEM *aItem)
class MODULE, a footprint
Definition: typeinfo.h:89
const PCBNEW_SELECTION & selection() const
Allow repeat placement of the item.
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Function CaptureCursor() Forces the cursor to stay within the drawing panel area.
TOOL_EVENT.
Definition: tool_event.h:171
KIGFX::PCB_VIEW * view() const
Create an item immediately on placement starting, otherwise show the pencil cursor until the item is ...
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.
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
Function GetModel()
static TOOL_ACTION flip
Flipping of selected objects.
Definition: pcb_actions.h:100
Handle the rotate action in the loop by calling the item's rotate method.
KIGFX::VIEW_CONTROLS * controls() const
MODULE * module() const
PCBNEW_SETTINGS & Settings()
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:58
PCB_BASE_EDIT_FRAME * m_frame
Definition: pcb_tool_base.h:62
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
void ShowContextMenu(SELECTION &aSelection)
Function ShowContextMenu.
Definition: tool_menu.cpp:59
static TOOL_ACTION viaSizeDec
Definition: pcb_actions.h:279
static TOOL_ACTION refreshPreview
Definition: actions.h:101
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

References TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), KIGFX::VIEW_GROUP::Add(), SELECTION::Add(), PCB_TOOL_BASE::board(), BUT_LEFT, BUT_RIGHT, KIGFX::VIEW_CONTROLS::CaptureCursor(), SELECTION::Clear(), PCB_TOOL_BASE::controls(), INTERACTIVE_PLACER_BASE::CreateItem(), PCB_ACTIONS::flip, PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetCanvas(), KIGFX::VIEW_CONTROLS::GetCursorPosition(), TOOL_EVT_UTILS::GetEventRotationAngle(), TOOL_BASE::GetManager(), PCB_BASE_FRAME::GetModel(), PCB_TOOL_BASE::IPO_FLIP, PCB_TOOL_BASE::IPO_REPEAT, PCB_TOOL_BASE::IPO_ROTATE, PCB_TOOL_BASE::IPO_SINGLE_CLICK, TOOL_EVT_UTILS::IsRotateToolEvt(), INTERACTIVE_PLACER_BASE::m_board, PCBNEW_SETTINGS::m_FlipLeftRight, INTERACTIVE_PLACER_BASE::m_frame, TOOL_INTERACTIVE::m_menu, INTERACTIVE_PLACER_BASE::m_modifiers, TOOL_BASE::m_toolMgr, PCB_TOOL_BASE::module(), PCB_MODULE_T, INTERACTIVE_PLACER_BASE::PlaceItem(), TOOLS_HOLDER::PopTool(), BOARD_COMMIT::Push(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, KIGFX::PCB_VIEW::Remove(), TOOL_MANAGER::RunAction(), MODULE::RunOnChildren(), PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, KIGFX::VIEW_CONTROLS::SetAutoPan(), EDA_DRAW_PANEL_GAL::SetCurrentCursor(), KIGFX::VIEW_CONTROLS::SetSnapping(), PCB_BASE_FRAME::Settings(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), INTERACTIVE_PLACER_BASE::SnapItem(), TC_COMMAND, KIGFX::PCB_VIEW::Update(), PCB_ACTIONS::viaSizeDec, PCB_ACTIONS::viaSizeInc, PCB_TOOL_BASE::view(), TOOL_INTERACTIVE::Wait(), VECTOR2< T >::x, and VECTOR2< T >::y.

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

◆ EditingModules()

bool PCB_TOOL_BASE::EditingModules ( ) const
inlineinherited

◆ frame()

PCB_BASE_EDIT_FRAME* PCB_TOOL_BASE::frame ( ) const
inlineprotectedinherited

Definition at line 161 of file pcb_tool_base.h.

162  {
163  return getEditFrame<PCB_BASE_EDIT_FRAME>();
164  }

Referenced by POINT_EDITOR::addCorner(), AUTOPLACE_TOOL::autoplace(), PCB_TOOL_BASE::canvas(), ZONE_FILLER_TOOL::CheckAllZones(), checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), ROUTER_TOOL::CustomTrackWidthDialog(), FOOTPRINT_EDITOR_TOOLS::DeleteFootprint(), PCB_TOOL_BASE::displayOptions(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ROUTER_TOOL::DpDimensionsDialog(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawVia(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), PCB_EDITOR_CONTROL::ExportSpecctraDSN(), ROUTER_TOOL::finishInteractive(), EDIT_TOOL::Flip(), PCB_EDITOR_CONTROL::FlipPcbView(), GLOBAL_EDIT_TOOL::GlobalDeletions(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PCB_EDITOR_CONTROL::ImportSpecctraSession(), SELECTION_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::Move(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), Reset(), ROUTER_TOOL::SelectCopperLayerPair(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), POINT_EDITOR::setEditedPoint(), ROUTER_TOOL::SettingsDialog(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), ROUTER_TOOL::switchLayerOnViaPlacement(), POINT_EDITOR::updateItem(), PCB_EDITOR_CONTROL::UpdateSchematicFromPCB(), ZONE_FILLER_TOOL::ZoneFill(), and ZONE_FILLER_TOOL::ZoneFillAll().

◆ getEditFrame()

template<typename T >
T* TOOL_BASE::getEditFrame ( ) const
inlineprotectedinherited

Function getEditFrame()

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

Definition at line 187 of file tool_base.h.

188  {
189 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
190  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
191 #endif
192  return static_cast<T*>( getToolHolderInt() );
193  }
TOOLS_HOLDER * getToolHolderInt() const
Definition: tool_base.cpp:48

References TOOL_BASE::getToolHolderInt().

Referenced by ZONE_CREATE_HELPER::createNewZone().

◆ GetId()

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 121 of file tool_base.h.

122  {
123  return m_toolId;
124  }
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214

References TOOL_BASE::m_toolId.

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

◆ GetManager()

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 143 of file tool_base.h.

144  {
145  return m_toolMgr;
146  }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219

References TOOL_BASE::m_toolMgr.

Referenced by BOARD_COMMIT::BOARD_COMMIT(), ZONE_CREATE_HELPER::commitZone(), ZONE_CREATE_HELPER::createNewZone(), PCB_TOOL_BASE::doInteractiveItemPlacement(), ACTION_MENU::getToolManager(), LIB_TREE::onContextMenu(), ZONE_CREATE_HELPER::OnFirstPoint(), ACTION_MENU::OnMenuEvent(), and ZONE_CREATE_HELPER::performZoneCutout().

◆ getModel()

template<typename T >
T* TOOL_BASE::getModel ( ) const
inlineprotectedinherited

Function getModel()

Returns the model object if it matches the requested type.

Definition at line 201 of file tool_base.h.

202  {
203  EDA_ITEM* m = getModelInt();
204 #if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
205  wxASSERT( dynamic_cast<T*>( m ) );
206 #endif
207  return static_cast<T*>( m );
208  }
EDA_ITEM * getModelInt() const
Definition: tool_base.cpp:54
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:163

References TOOL_BASE::getModelInt().

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

◆ GetName()

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 132 of file tool_base.h.

133  {
134  return m_toolName;
135  }
std::string m_toolName
Name of the tool.
Definition: tool_base.h:218

References TOOL_BASE::m_toolName.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Function GetType() Returns the type of the tool.

Returns
The type of the tool.

Definition at line 110 of file tool_base.h.

111  {
112  return m_type;
113  }
TOOL_TYPE m_type
Stores the type of the tool.
Definition: tool_base.h:211

References TOOL_BASE::m_type.

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

◆ getView()

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 36 of file tool_base.cpp.

37 {
38  return m_toolMgr->GetView();
39 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:280
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219

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

Referenced by EE_POINT_EDITOR::addCornerCondition(), ALIGN_DISTRIBUTE_TOOL::AlignLeft(), ALIGN_DISTRIBUTE_TOOL::AlignRight(), COMMON_TOOLS::CenterContents(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), COMMON_TOOLS::CursorControl(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), MICROWAVE_TOOL::drawMicrowaveInductor(), PL_DRAWING_TOOLS::DrawShape(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), COMMON_TOOLS::GridPreset(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::GuessSelectionCandidates(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), highlightNet(), PCB_INSPECTION_TOOL::highlightNet(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), pickSingleItem(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), PCB_EDITOR_CONTROL::Reset(), Reset(), PCBNEW_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), SELECTION_TOOL::Selectable(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), EE_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), PL_EDITOR_CONTROL::ToggleBackgroundColor(), COMMON_TOOLS::ToggleGrid(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), PCBNEW_CONTROL::updateGrid(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), COMMON_TOOLS::ZoomFitScreen(), SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and SELECTION_TOOL::~SELECTION_TOOL().

◆ getViewControls()

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 42 of file tool_base.cpp.

43 {
44  return m_toolMgr->GetViewControls();
45 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:285

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

Referenced by EE_POINT_EDITOR::addCorner(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), COMMON_TOOLS::GridPreset(), PCB_INSPECTION_TOOL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::Move(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LIB_DRAWING_TOOLS::PlaceAnchor(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), SCH_EDIT_TOOL::RepeatDrawItem(), PL_SELECTION_TOOL::RequestSelection(), EE_SELECTION_TOOL::RequestSelection(), POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PICKER_TOOL::setControls(), PCBNEW_PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), POINT_EDITOR::updateEditedPoint(), LIB_MOVE_TOOL::updateModificationPoint(), PL_EDIT_TOOL::updateModificationPoint(), EDIT_TOOL::updateModificationPoint(), and COMMON_TOOLS::ZoomCenter().

◆ Go()

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 129 of file tool_interactive.h.

131 {
132  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
133 
134  goInternal( sptr, aConditions );
135 }
std::function< int(const TOOL_EVENT &)> TOOL_STATE_FUNC
Definition: tool_base.h:58
void goInternal(TOOL_STATE_FUNC &aState, const TOOL_EVENT_LIST &aConditions)

References TOOL_INTERACTIVE::goInternal().

Referenced by LENGTH_TUNER_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), AUTOPLACE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), LIB_PIN_TOOL::setTransitions(), PAD_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), EE_POINT_EDITOR::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), PL_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), POINT_EDITOR::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), SCH_MOVE_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), SCH_EDIT_TOOL::setTransitions(), LIB_CONTROL::setTransitions(), PL_EDIT_TOOL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), PCBNEW_CONTROL::setTransitions(), PCB_INSPECTION_TOOL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), FOOTPRINT_EDITOR_TOOLS::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), PCBNEW_PICKER_TOOL::setTransitions(), PICKER_TOOL::setTransitions(), PCB_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), DRC::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ highlightNet()

void TOOL_BASE::highlightNet ( bool  aEnabled,
int  aNetcode = -1 
)
protectedvirtual

Definition at line 225 of file pns_tool_base.cpp.

226 {
228 
229  if( aNetcode >= 0 && aEnabled )
230  {
231  // If the user has previously set the current net to be highlighted,
232  // we assume they want to keep it highlighted after routing
234  ( rs->IsHighlightEnabled() && rs->GetHighlightNetCodes().count( aNetcode ) );
235 
236  rs->SetHighlight( true, aNetcode );
237  }
238  else
239  {
240  if( !m_startHighlight )
241  rs->SetHighlight( false );
242 
243  m_startHighlight = false;
244  }
245 
247 }
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
void SetHighlight(bool aEnabled, int aNetcode=-1, bool aHighlightItems=false, bool aMulti=false)
Function SetHighlight Turns on/off highlighting - it may be done for the active layer,...
bool m_startHighlight
Keeps track of whether the net was highlighted before routing.
Definition: pns_tool_base.h:70
bool IsHighlightEnabled() const
Function IsHighlightEnabled Returns current highlight setting.
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual RENDER_SETTINGS * GetSettings()=0
Function GetAdapter Returns pointer to current settings that are going to be used when drawing items.
const std::set< int > & GetHighlightNetCodes() const
Function GetHighlightNetCode Returns netcode of currently highlighted net.
void UpdateAllLayersColor()
Function UpdateAllLayersColor() Applies the new coloring scheme to all layers.
Definition: view.cpp:798

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

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

◆ Init()

bool PCB_TOOL_BASE::Init ( )
overridevirtualinherited

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.

Reimplemented in EDIT_TOOL, SELECTION_TOOL, DRAWING_TOOL, POSITION_RELATIVE_TOOL, PCB_EDITOR_CONTROL, POINT_EDITOR, FOOTPRINT_EDITOR_TOOLS, GLOBAL_EDIT_TOOL, PAD_TOOL, PCB_INSPECTION_TOOL, and ROUTER_TOOL.

Definition at line 237 of file pcb_tool_base.cpp.

238 {
239  // A basic context manu. Many (but not all) tools will choose to override this.
240 
241  auto& ctxMenu = m_menu.GetMenu();
242 
243  // cancel current tool goes in main context menu at the top if present
245  ctxMenu.AddSeparator( 1 );
246 
247  // Finally, add the standard zoom/grid items
248  getEditFrame<PCB_BASE_FRAME>()->AddStandardSubMenus( m_menu );
249 
250  return true;
251 }
static bool ShowAlways(const SELECTION &aSelection)
Function ShowAlways The default condition function (always returns true).
TOOL_MENU m_menu
functions below are not yet implemented - their interface may change
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Function AddItem()

References CONDITIONAL_MENU::AddItem(), ACTIONS::cancelInteractive, TOOL_MENU::GetMenu(), TOOL_INTERACTIVE::m_menu, and SELECTION_CONDITIONS::ShowAlways().

◆ IsToolActive()

bool TOOL_BASE::IsToolActive ( ) const
inherited

Definition at line 31 of file tool_base.cpp.

32 {
33  return m_toolMgr->IsToolActive( m_toolId );
34 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
TOOL_ID m_toolId
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:214
bool IsToolActive(TOOL_ID aId) const
Function IsToolActive() Returns true if a tool with given id is active (executing)

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

◆ module()

◆ pickSingleItem()

ITEM * TOOL_BASE::pickSingleItem ( const VECTOR2I aWhere,
int  aNet = -1,
int  aLayer = -1,
bool  aIgnorePads = false,
const std::vector< ITEM * >  aAvoidItems = {} 
)
protectedvirtual

Definition at line 122 of file pns_tool_base.cpp.

124 {
125  int tl = getView()->GetTopLayer();
126 
127  if( aLayer > 0 )
128  tl = aLayer;
129 
130  static const int candidateCount = 5;
131  ITEM* prioritized[candidateCount];
132  int dist[candidateCount];
133 
134  for( int i = 0; i < candidateCount; i++ )
135  {
136  prioritized[i] = 0;
137  dist[i] = std::numeric_limits<int>::max();
138  }
139 
140  ITEM_SET candidates = m_router->QueryHoverItems( aWhere );
141 
142  for( ITEM* item : candidates.Items() )
143  {
144  if( !item->IsRoutable() )
145  continue;
146 
147  if( !IsCopperLayer( item->Layers().Start() ) )
148  continue;
149 
150  if( !m_iface->IsAnyLayerVisible( item->Layers() ) )
151  continue;
152 
153  if( std::find( aAvoidItems.begin(), aAvoidItems.end(), item ) != aAvoidItems.end() )
154  continue;
155 
156  // fixme: this causes flicker with live loop removal...
157  //if( item->Parent() && !item->Parent()->ViewIsVisible() )
158  // continue;
159 
160  if( aNet <= 0 || item->Net() == aNet )
161  {
162  if( item->OfKind( ITEM::VIA_T | ITEM::SOLID_T ) )
163  {
164  if( item->OfKind( ITEM::SOLID_T ) && aIgnorePads )
165  continue;
166 
167  int itemDist = ( item->Shape()->Centre() - aWhere ).SquaredEuclideanNorm();
168 
169  if( !prioritized[2] || itemDist < dist[2] )
170  {
171  prioritized[2] = item;
172  dist[2] = itemDist;
173  }
174  if( item->Layers().Overlaps( tl ) && itemDist < dist[0] )
175  {
176  prioritized[0] = item;
177  dist[0] = itemDist;
178  }
179  }
180  else
181  {
182  if( !prioritized[3] )
183  prioritized[3] = item;
184  if( item->Layers().Overlaps( tl ) )
185  prioritized[1] = item;
186  }
187  }
188  // Allow unconnected items as last resort in RM_MarkObstacles mode
189  else if ( item->Net() == 0 && m_router->Settings().Mode() == RM_MarkObstacles )
190  {
191  if( item->OfKind( ITEM::SOLID_T ) && aIgnorePads )
192  continue;
193 
194  if( item->Layers().Overlaps( tl ) )
195  prioritized[4] = item;
196  }
197  }
198 
199  ITEM* rv = NULL;
200 
201  for( int i = 0; i < candidateCount; i++ )
202  {
203  ITEM* item = prioritized[i];
204 
206  if( item && !item->Layers().Overlaps( tl ) )
207  item = NULL;
208 
209  if( item && ( aLayer < 0 || item->Layers().Overlaps( aLayer ) ) )
210  {
211  rv = item;
212  break;
213  }
214  }
215 
216  if( rv )
217  {
218  wxLogTrace( "PNS", "%s, layer : %d, tl: %d", rv->KindStr().c_str(), rv->Layers().Start(), tl );
219  }
220 
221  return rv;
222 }
static const int dist[10][10]
Definition: ar_matrix.cpp:326
const ITEM_SET QueryHoverItems(const VECTOR2I &aP)
Definition: pns_router.cpp:123
bool IsAnyLayerVisible(const LAYER_RANGE &aLayer) override
#define NULL
virtual int GetTopLayer() const
Definition: view.cpp:851
ROUTER * m_router
Definition: pns_tool_base.h:77
PNS_MODE Mode() const
Returns the routing mode.
std::unordered_set< SCH_ITEM * > ITEM_SET
Definition: sch_item.h:142
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
const PCB_DISPLAY_OPTIONS & displayOptions() const
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
PNS_KICAD_IFACE * m_iface
Definition: pns_tool_base.h:76
ROUTING_SETTINGS & Settings()
Definition: pns_router.h:199

References PCB_TOOL_BASE::displayOptions(), dist, KIGFX::VIEW::GetTopLayer(), TOOL_BASE::getView(), PNS_KICAD_IFACE::IsAnyLayerVisible(), IsCopperLayer(), PNS::ITEM_SET::Items(), PNS::ITEM::KindStr(), PNS::ITEM::Layers(), PCB_DISPLAY_OPTIONS::m_ContrastModeDisplay, m_iface, m_router, PNS::ROUTING_SETTINGS::Mode(), NULL, 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 updateEndItem(), and updateStartItem().

◆ Reset()

void TOOL_BASE::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 PCB_TOOL_BASE.

Reimplemented in LENGTH_TUNER_TOOL, and ROUTER_TOOL.

Definition at line 92 of file pns_tool_base.cpp.

93 {
94  delete m_gridHelper;
95  delete m_iface;
96  delete m_router;
97 
99  m_iface->SetBoard( board() );
100  m_iface->SetView( getView() );
101  m_iface->SetHostTool( this );
102  m_iface->SetDisplayOptions( &( frame()->GetDisplayOptions() ) );
103 
104  m_router = new ROUTER;
106  m_router->ClearWorld();
107  m_router->SyncWorld();
108 
110 
111  PCBNEW_SETTINGS* settings = frame()->GetPcbNewSettings();
112 
113  if( !settings->m_PnsSettings )
114  settings->m_PnsSettings = std::make_unique<ROUTING_SETTINGS>( settings, "tools.pns" );
115 
116  m_router->LoadSettings( settings->m_PnsSettings.get() );
117 
118  m_gridHelper = new GRID_HELPER( frame() );
119 }
void SetHostTool(PCB_TOOL_BASE *aTool)
void SetView(KIGFX::VIEW *aView)
GRID_HELPER * m_gridHelper
Definition: pns_tool_base.h:75
BOARD * board() const
SIZES_SETTINGS m_savedSizes
Stores sizes settings between router invocations.
Definition: pns_tool_base.h:66
void SyncWorld()
Definition: pns_router.cpp:96
PCBNEW_SETTINGS * GetPcbNewSettings()
void ClearWorld()
Definition: pns_router.cpp:105
PCB_BASE_EDIT_FRAME * frame() const
ROUTER * m_router
Definition: pns_tool_base.h:77
std::unique_ptr< PNS::ROUTING_SETTINGS > m_PnsSettings
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
void SetInterface(ROUTER_IFACE *aIface)
Definition: pns_router.cpp:561
void SetBoard(BOARD *aBoard)
void UpdateSizes(const SIZES_SETTINGS &aSizes)
Applies stored settings.
Definition: pns_router.cpp:332
void LoadSettings(ROUTING_SETTINGS *aSettings)
Changes routing settings to ones passed in the parameter.
Definition: pns_router.h:213
void SetDisplayOptions(const PCB_DISPLAY_OPTIONS *aDispOptions)
PNS_KICAD_IFACE * m_iface
Definition: pns_tool_base.h:76

References PCB_TOOL_BASE::board(), PNS::ROUTER::ClearWorld(), PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetPcbNewSettings(), TOOL_BASE::getView(), PNS::ROUTER::LoadSettings(), m_gridHelper, m_iface, PCBNEW_SETTINGS::m_PnsSettings, m_router, m_savedSizes, PNS_KICAD_IFACE_BASE::SetBoard(), PNS_KICAD_IFACE::SetDisplayOptions(), PNS_KICAD_IFACE::SetHostTool(), PNS::ROUTER::SetInterface(), PNS_KICAD_IFACE::SetView(), PNS::ROUTER::SyncWorld(), and PNS::ROUTER::UpdateSizes().

◆ Router()

ROUTER * TOOL_BASE::Router ( ) const

Definition at line 388 of file pns_tool_base.cpp.

389 {
390  return m_router;
391 }
ROUTER * m_router
Definition: pns_tool_base.h:77

References m_router.

Referenced by EDIT_TOOL::Remove().

◆ RunMainStack()

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 87 of file tool_interactive.cpp.

88 {
89  m_toolMgr->RunMainStack( this, std::move( aFunc ) );
90 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void RunMainStack(TOOL_BASE *aTool, std::function< void()> aFunc)

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

Referenced by DRAWING_TOOL::PlaceText().

◆ selection() [1/2]

const PCBNEW_SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 275 of file pcb_tool_base.cpp.

276 {
277  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
278  const auto& selection = selTool->GetSelection();
279  return selection;
280 }
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
const PCBNEW_SELECTION & selection() const

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

Referenced by AUTOPLACE_TOOL::autoplaceSelected(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), FOOTPRINT_EDITOR_TOOLS::CreatePadFromShapes(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawZone(), EDIT_TOOL::Duplicate(), EDIT_TOOL::EditFpInFpEditor(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), FOOTPRINT_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), PCB_INSPECTION_TOOL::highlightNet(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), PAD_TOOL::pastePadProperties(), PCBNEW_CONTROL::placeBoardItems(), DRAWING_TOOL::PlaceImportedGraphics(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EDIT_TOOL::Rotate(), PCB_TOOL_BASE::selection(), SELECTION_TOOL::selectNet(), DRAWING_TOOL::SetAnchor(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), PCB_EDITOR_CONTROL::ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

◆ selection() [2/2]

PCBNEW_SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 283 of file pcb_tool_base.cpp.

284 {
285  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
286  auto& selection = selTool->GetSelection();
287  return selection;
288 }
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
const PCBNEW_SELECTION & selection() const

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

◆ SetContextMenu()

void TOOL_INTERACTIVE::SetContextMenu ( ACTION_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 76 of file tool_interactive.cpp.

77 {
78  if( aMenu )
79  aMenu->SetTool( this );
80  else
81  aTrigger = CMENU_OFF;
82 
83  m_toolMgr->ScheduleContextMenu( this, aMenu, aTrigger );
84 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void SetTool(TOOL_INTERACTIVE *aTool)
Function SetTool() Sets a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Sets behaviour of the tool's context popup menu.

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ SetEditModules()

void PCB_TOOL_BASE::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 101 of file pcb_tool_base.h.

102  {
103  m_editModules = aEnabled;
104  }

References PCB_TOOL_BASE::m_editModules.

◆ setTransitions()

void PCB_TOOL_BASE::setTransitions ( )
overrideprotectedvirtualinherited

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

It is called every time tool is reset or finished.

Implements TOOL_INTERACTIVE.

Reimplemented in DRC, SELECTION_TOOL, EDIT_TOOL, DRAWING_TOOL, PCB_EDITOR_CONTROL, PCBNEW_PICKER_TOOL, FOOTPRINT_EDITOR_TOOLS, PCB_INSPECTION_TOOL, PCBNEW_CONTROL, POSITION_RELATIVE_TOOL, MICROWAVE_TOOL, GLOBAL_EDIT_TOOL, POINT_EDITOR, ZONE_FILLER_TOOL, PAD_TOOL, ROUTER_TOOL, AUTOPLACE_TOOL, and LENGTH_TUNER_TOOL.

Definition at line 259 of file pcb_tool_base.cpp.

260 {
261 }

◆ snapToItem()

const VECTOR2I TOOL_BASE::snapToItem ( bool  aEnabled,
ITEM aItem,
VECTOR2I  aP 
)
protected

Definition at line 394 of file pns_tool_base.cpp.

395 {
396  VECTOR2I anchor;
397 
398  if( !aItem || !aEnabled || !m_iface->IsItemVisible( aItem ) )
399  {
400  return m_gridHelper->Align( aP );
401  }
402 
403  switch( aItem->Kind() )
404  {
405  case ITEM::SOLID_T:
406  anchor = static_cast<SOLID*>( aItem )->Pos();
407  break;
408 
409  case ITEM::VIA_T:
410  anchor = static_cast<VIA*>( aItem )->Pos();
411  break;
412 
413  case ITEM::SEGMENT_T:
414  case ITEM::ARC_T:
415  {
416  LINKED_ITEM* li = static_cast<LINKED_ITEM*>( aItem );
417  int w = li->Width();
418  auto A = li->Anchor( 0 );
419  auto B = li->Anchor( 1 );
420 
421  if( ( aP - A ).EuclideanNorm() < w / 2 )
422  anchor = A;
423  else if( ( aP - B ).EuclideanNorm() < w / 2 )
424  anchor = B;
425  else // TODO(snh): Clean this up
426  if( aItem->Kind() == ITEM::SEGMENT_T )
427  anchor = m_gridHelper->AlignToSegment( aP, static_cast<SEGMENT*>( li )->Seg() );
428  else if( aItem->Kind() == ITEM::ARC_T )
429  anchor = m_gridHelper->AlignToArc( aP,
430  *static_cast<const SHAPE_ARC*>( static_cast<ARC*>( li )->Shape() ) );
431 
432  break;
433  }
434 
435  default:
436  break;
437  }
438 
439  return anchor;
440 }
double EuclideanNorm(const wxPoint &vector)
Euclidean norm of a 2D vector.
Definition: trigo.h:128
GRID_HELPER * m_gridHelper
Definition: pns_tool_base.h:75
VECTOR2I AlignToSegment(const VECTOR2I &aPoint, const SEG &aSeg)
VECTOR2I AlignToArc(const VECTOR2I &aPoint, const SHAPE_ARC &aSeg)
bool IsItemVisible(const PNS::ITEM *aItem) override
VECTOR2I Align(const VECTOR2I &aPoint) const
PNS_KICAD_IFACE * m_iface
Definition: pns_tool_base.h:76

References GRID_HELPER::Align(), GRID_HELPER::AlignToArc(), GRID_HELPER::AlignToSegment(), PNS::ITEM::Anchor(), PNS::ITEM::ARC_T, EuclideanNorm(), PNS_KICAD_IFACE::IsItemVisible(), PNS::ITEM::Kind(), m_gridHelper, m_iface, PNS::ITEM::SEGMENT_T, PNS::ITEM::SOLID_T, PNS::ITEM::VIA_T, and PNS::LINKED_ITEM::Width().

Referenced by ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), updateEndItem(), and updateStartItem().

◆ updateEndItem()

void TOOL_BASE::updateEndItem ( const TOOL_EVENT aEvent)
protectedvirtual

Definition at line 309 of file pns_tool_base.cpp.

310 {
311  int layer;
312  bool snapEnabled = !aEvent.Modifier( MD_SHIFT );
313  m_gridHelper->SetUseGrid( !aEvent.Modifier( MD_ALT ) );
314  m_gridHelper->SetSnap( snapEnabled );
315 
316  controls()->ForceCursorPosition( false );
317  VECTOR2I mousePos = controls()->GetMousePosition();
318 
319  if( m_router->Settings().Mode() != RM_MarkObstacles &&
320  ( m_router->GetCurrentNets().empty() || m_router->GetCurrentNets().front() < 0 ) )
321  {
322  m_endSnapPoint = snapToItem( snapEnabled, nullptr, mousePos );
324  m_endItem = nullptr;
325 
326  return;
327  }
328 
329  if( m_router->IsPlacingVia() )
330  layer = -1;
331  else
332  layer = m_router->GetCurrentLayer();
333 
334  ITEM* endItem = nullptr;
335 
336  std::vector<int> nets = m_router->GetCurrentNets();
337 
338  for( int net : nets )
339  {
340  endItem = pickSingleItem( mousePos, net, layer, false, { m_startItem } );
341 
342  if( endItem )
343  break;
344  }
345 
346  if( checkSnap( endItem ) )
347  {
348  m_endItem = endItem;
349  m_endSnapPoint = snapToItem( snapEnabled, endItem, mousePos );
350  } else {
351  m_endItem = nullptr;
352  m_endSnapPoint = m_gridHelper->Align( mousePos );
353  }
354 
356 
357  if( m_endItem )
358  {
359  wxLogTrace( "PNS", "%s, layer : %d", m_endItem->KindStr().c_str(), m_endItem->Layers().Start() );
360  }
361 }
GRID_HELPER * m_gridHelper
Definition: pns_tool_base.h:75
virtual VECTOR2D GetMousePosition(bool aWorldCoordinates=true) const =0
Function GetMousePosition() Returns the current mouse pointer position.
bool IsPlacingVia() const
Definition: pns_router.cpp:531
const std::vector< int > GetCurrentNets() const
Definition: pns_router.cpp:491
const VECTOR2I snapToItem(bool aEnabled, ITEM *aItem, VECTOR2I aP)
int Start() const
Definition: pns_layerset.h:83
std::string KindStr() const
Function KindStr()
Definition: pns_item.cpp:71
bool checkSnap(ITEM *aItem)
ITEM * m_startItem
Definition: pns_tool_base.h:67
ROUTER * m_router
Definition: pns_tool_base.h:77
PNS_MODE Mode() const
Returns the routing mode.
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
void SetSnap(bool aSnap)
Definition: grid_helper.h:84
int Modifier(int aMask=MD_MODIFIER_MASK) const
Returns information about key modifiers state (Ctrl, Alt, etc.)
Definition: tool_event.h:342
VECTOR2I Align(const VECTOR2I &aPoint) const
KIGFX::VIEW_CONTROLS * controls() const
VECTOR2I m_endSnapPoint
Definition: pns_tool_base.h:73
virtual ITEM * pickSingleItem(const VECTOR2I &aWhere, int aNet=-1, int aLayer=-1, bool aIgnorePads=false, const std::vector< ITEM * > aAvoidItems={})
void SetUseGrid(bool aGrid=true)
Definition: grid_helper.h:94
ROUTING_SETTINGS & Settings()
Definition: pns_router.h:199
const LAYER_RANGE & Layers() const
Definition: pns_item.h:151
int GetCurrentLayer() const
Definition: pns_router.cpp:500

References GRID_HELPER::Align(), checkSnap(), PCB_TOOL_BASE::controls(), KIGFX::VIEW_CONTROLS::ForceCursorPosition(), PNS::ROUTER::GetCurrentLayer(), PNS::ROUTER::GetCurrentNets(), KIGFX::VIEW_CONTROLS::GetMousePosition(), PNS::ROUTER::IsPlacingVia(), PNS::ITEM::KindStr(), PNS::ITEM::Layers(), m_endItem, m_endSnapPoint, m_gridHelper, m_router, m_startItem, MD_ALT, MD_SHIFT, PNS::ROUTING_SETTINGS::Mode(), TOOL_EVENT::Modifier(), pickSingleItem(), PNS::RM_MarkObstacles, GRID_HELPER::SetSnap(), PNS::ROUTER::Settings(), GRID_HELPER::SetUseGrid(), snapToItem(), and LAYER_RANGE::Start().

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

◆ updateStartItem()

void TOOL_BASE::updateStartItem ( const TOOL_EVENT aEvent,
bool  aIgnorePads = false 
)
protectedvirtual

Definition at line 273 of file pns_tool_base.cpp.

274 {
275  int tl = getView()->GetTopLayer();
276  VECTOR2I cp = controls()->GetCursorPosition( !aEvent.Modifier( MD_SHIFT ) );
277  VECTOR2I p;
278 
279  controls()->ForceCursorPosition( false );
280  m_gridHelper->SetUseGrid( !aEvent.Modifier( MD_ALT ) );
281  m_gridHelper->SetSnap( !aEvent.Modifier( MD_SHIFT ) );
282 
283  bool snapEnabled = true;
284 
285  if( aEvent.IsMotion() || aEvent.IsClick() )
286  {
287  snapEnabled = !aEvent.Modifier( MD_SHIFT );
288  p = aEvent.Position();
289  }
290  else
291  {
292  p = cp;
293  }
294 
295  m_startItem = pickSingleItem( p, -1, -1, aIgnorePads );
296 
297  if( !snapEnabled && m_startItem && !m_startItem->Layers().Overlaps( tl ) )
298  m_startItem = nullptr;
299 
300  m_startSnapPoint = snapToItem( snapEnabled, m_startItem, p );
301 
302  if( checkSnap( m_startItem ) )
303  {
305  }
306 }
GRID_HELPER * m_gridHelper
Definition: pns_tool_base.h:75
VECTOR2I m_startSnapPoint
Definition: pns_tool_base.h:69
bool IsClick(int aButtonMask=BUT_ANY) const
Definition: tool_event.cpp:178
bool IsMotion() const
Definition: tool_event.h:306
bool Overlaps(const LAYER_RANGE &aOther) const
Definition: pns_layerset.h:68
const VECTOR2I snapToItem(bool aEnabled, ITEM *aItem, VECTOR2I aP)
bool checkSnap(ITEM *aItem)
virtual int GetTopLayer() const
Definition: view.cpp:851
ITEM * m_startItem
Definition: pns_tool_base.h:67
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Function ForceCursorPosition() Places the cursor immediately at a given point.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
void SetSnap(bool aSnap)
Definition: grid_helper.h:84
int Modifier(int aMask=MD_MODIFIER_MASK) const
Returns information about key modifiers state (Ctrl, Alt, etc.)
Definition: tool_event.h:342
KIGFX::VIEW_CONTROLS * controls() const
virtual ITEM * pickSingleItem(const VECTOR2I &aWhere, int aNet=-1, int aLayer=-1, bool aIgnorePads=false, const std::vector< ITEM * > aAvoidItems={})
void SetUseGrid(bool aGrid=true)
Definition: grid_helper.h:94
const VECTOR2D Position() const
Returns mouse cursor position in world coordinates.
Definition: tool_event.h:274
const LAYER_RANGE & Layers() const
Definition: pns_item.h:151
VECTOR2D GetCursorPosition() const
Returns the current cursor position in world coordinates.

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

Referenced by ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), and ROUTER_TOOL::onViaCommand().

◆ view()

◆ Wait()

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 57 of file tool_interactive.cpp.

58 {
59  return m_toolMgr->ScheduleWait( this, aEventList );
60 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
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.

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

Referenced by GERBVIEW_SELECTION_TOOL::disambiguationMenu(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), SELECTION_TOOL::doSelectionMenu(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), ZOOM_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_PICKER_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), EDIT_TOOL::Move(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickCopyReferencePoint(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_cancelled

bool PNS::TOOL_BASE::m_cancelled
protected

◆ m_editModules

◆ m_endItem

◆ m_endSnapPoint

◆ m_gridHelper

GRID_HELPER* PNS::TOOL_BASE::m_gridHelper
protected

◆ m_iface

PNS_KICAD_IFACE* PNS::TOOL_BASE::m_iface
protected

Definition at line 76 of file pns_tool_base.h.

Referenced by pickSingleItem(), Reset(), snapToItem(), TOOL_BASE(), and ~TOOL_BASE().

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

functions below are not yet implemented - their interface may change

Definition at line 108 of file tool_interactive.h.

Referenced by SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), PICKER_TOOL::Init(), SCH_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), LIB_DRAWING_TOOLS::Init(), FOOTPRINT_EDITOR_TOOLS::Init(), PCB_VIEWER_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), LIB_CONTROL::Init(), PCB_EDITOR_CONTROL::Init(), EDA_3D_CONTROLLER::Init(), SCH_DRAWING_TOOLS::Init(), GERBVIEW_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), PL_SELECTION_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), EDIT_TOOL::Init(), PCB_TOOL_BASE::Init(), PL_EDIT_TOOL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PCBNEW_PICKER_TOOL::Main(), PICKER_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), LIB_DRAWING_TOOLS::PlaceAnchor(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), LIB_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_panelItems

MSG_PANEL_ITEMS PNS::TOOL_BASE::m_panelItems
protected

Definition at line 64 of file pns_tool_base.h.

◆ m_router

◆ m_savedSizes

SIZES_SETTINGS PNS::TOOL_BASE::m_savedSizes
protected

Stores sizes settings between router invocations.

Definition at line 66 of file pns_tool_base.h.

Referenced by ROUTER_TOOL::DpDimensionsDialog(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), and Reset().

◆ m_startHighlight

bool PNS::TOOL_BASE::m_startHighlight
protected

Keeps track of whether the net was highlighted before routing.

Definition at line 70 of file pns_tool_base.h.

Referenced by highlightNet(), and TOOL_BASE().

◆ m_startItem

◆ m_startLayer

int PNS::TOOL_BASE::m_startLayer
protected

Definition at line 68 of file pns_tool_base.h.

Referenced by TOOL_BASE().

◆ m_startSnapPoint

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

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

Definition at line 214 of file tool_base.h.

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

◆ m_toolMgr

TOOL_MANAGER* TOOL_BASE::m_toolMgr
protectedinherited

Definition at line 219 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SELECTION_TOOL::AddItemToSel(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), PCB_INSPECTION_TOOL::calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeShape(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), PCB_INSPECTION_TOOL::ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), SELECTION_TOOL::ClearSelection(), PL_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), LIB_EDIT_TOOL::Copy(), PL_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), MICROWAVE_TOOL::createInductorBetween(), FOOTPRINT_EDITOR_TOOLS::CreatePadFromShapes(), PCB_INSPECTION_TOOL::CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), ROUTER_TOOL::CustomTrackWidthDialog(), SCH_EDITOR_CONTROL::Cut(), LIB_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCBNEW_CONTROL::DeleteItemCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), LIB_EDIT_TOOL::DoDelete(), SCH_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), LIB_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), EDIT_TOOL::EditFpInFpEditor(), LIB_EDIT_TOOL::editGraphicProperties(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), FOOTPRINT_EDITOR_TOOLS::ExplodePadToShapes(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::findCallback(), SCH_EDITOR_CONTROL::FindComponentAndItem(), POINT_EDITOR::finishItem(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), EDIT_TOOL::Flip(), EDIT_TOOL::GetAndPlace(), TOOL_BASE::GetManager(), TOOL_BASE::getModelInt(), DRAWING_TOOL::getSourceZoneForAction(), TOOL_BASE::getToolHolderInt(), TOOL_BASE::getView(), TOOL_BASE::getViewControls(), TOOL_INTERACTIVE::goInternal(), PCBNEW_CONTROL::GridSetOrigin(), GERBVIEW_CONTROL::HighlightControl(), PCB_INSPECTION_TOOL::HighlightItem(), PCB_INSPECTION_TOOL::HighlightNet(), PCB_INSPECTION_TOOL::highlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PCB_INSPECTION_TOOL::HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), LIB_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), PAD_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), LIB_CONTROL::Init(), PL_DRAWING_TOOLS::Init(), PL_POINT_EDITOR::Init(), POINT_EDITOR::Init(), PCB_EDITOR_CONTROL::Init(), POSITION_RELATIVE_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), TOOL_BASE::IsToolActive(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), PCB_INSPECTION_TOOL::LocalRatsnestTool(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), LIB_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::Move(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickCopyReferencePoint(), LIB_EDIT_TOOL::PinTable(), PCBNEW_CONTROL::placeBoardItems(), SCH_DRAWING_TOOLS::PlaceComponent(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCBNEW_CONTROL::Print(), GERBVIEW_CONTROL::Print(), LIB_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), LIB_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), LIB_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), SELECTION_TOOL::RequestSelection(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), LIB_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC::RunTests(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectMultiple(), SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::SelectPoint(), SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), SELECTION_TOOL::selectSameSheet(), SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), DRC::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), EDA_3D_CONTROLLER::ToggleVisibility(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), LIB_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), LIB_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), PCB_INSPECTION_TOOL::UpdateSelectionRatsnest(), PCB_EDITOR_CONTROL::ViaSizeDec(), PCB_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), PCB_EDITOR_CONTROL::ZoneDuplicate(), and PCB_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

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 218 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

Stores the type of the tool.

Definition at line 211 of file tool_base.h.

Referenced by TOOL_BASE::GetType(), and BOARD_COMMIT::Push().


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