KiCad PCB EDA Suite
pcb_inspection_tool.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #include <bitmaps.h>
25 #include <tool/tool_manager.h>
26 #include <tools/selection_tool.h>
28 #include <tools/edit_tool.h>
29 #include <pcb_painter.h>
31 #include <profile.h>
32 #include "pcb_inspection_tool.h"
33 
34 
36  PCB_TOOL_BASE( "pcbnew.InspectionTool" ),
37  m_frame( nullptr )
38 {
39  m_probingSchToPcb = false;
40  m_lastNetcode = -1;
41 
42  m_slowRatsnest = false;
43 }
44 
45 
47 {
48 public:
50  {
52  SetTitle( _( "Net Tools" ) );
53 
56  // Add( PCB_ACTIONS::highlightNet );
57  }
58 
59 private:
60 
61  void update() override
62  {
63  const auto& selection = getToolManager()->GetTool<SELECTION_TOOL>()->GetSelection();
64 
65  bool haveNetCode = false;
66 
67  for( EDA_ITEM* item : selection )
68  {
69  if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
70  {
71  if( bci->GetNetCode() > 0 )
72  {
73  haveNetCode = true;
74  break;
75  }
76  }
77  }
78 
79  Enable( getMenuId( PCB_ACTIONS::showNet ), haveNetCode );
80  Enable( getMenuId( PCB_ACTIONS::hideNet ), haveNetCode );
81  // Enable( getMenuId( PCB_ACTIONS::highlightNet ), haveNetCode );
82  }
83 
84  ACTION_MENU* create() const override
85  {
86  return new NET_CONTEXT_MENU();
87  }
88 };
89 
90 
92 {
93  SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
94 
95  auto netSubMenu = std::make_shared<NET_CONTEXT_MENU>();
96  netSubMenu->SetTool( this );
97 
98  static KICAD_T connectedTypes[] = { PCB_TRACE_T, PCB_VIA_T, PCB_ARC_T, PCB_PAD_T,
100 
101  CONDITIONAL_MENU& menu = selectionTool->GetToolMenu().GetMenu();
102 
103  selectionTool->GetToolMenu().AddSubMenu( netSubMenu );
104  menu.AddMenu( netSubMenu.get(), SELECTION_CONDITIONS::OnlyTypes( connectedTypes ) );
105 
106  m_ratsnestTimer.SetOwner( this );
107  Connect( m_ratsnestTimer.GetId(), wxEVT_TIMER,
108  wxTimerEventHandler( PCB_INSPECTION_TOOL::ratsnestTimer ), NULL, this );
109 
110  return true;
111 }
112 
113 
115 {
116  m_frame = getEditFrame<PCB_EDIT_FRAME>();
117 }
118 
119 
121 {
123  dialog.ShowModal();
124  return 0;
125 }
126 
127 
129 {
130  // Don't get in an infinite loop PCB -> SCH -> PCB -> SCH -> ...
131  if( m_probingSchToPcb )
132  return 0;
133 
135  const PCBNEW_SELECTION& selection = selTool->GetSelection();
136 
137  if( selection.Size() == 1 )
138  m_frame->SendMessageToEESCHEMA( static_cast<BOARD_ITEM*>( selection.Front() ) );
139  else
140  m_frame->SendMessageToEESCHEMA( nullptr );
141 
142  return 0;
143 }
144 
145 
147 {
148  BOARD_ITEM* item = aEvent.Parameter<BOARD_ITEM*>();
149 
150  m_probingSchToPcb = true; // recursion guard
151  {
153 
154  if( item )
155  m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, (void*) item );
156  }
157  m_probingSchToPcb = false;
158 
159  return 0;
160 }
161 
162 
170  bool PCB_INSPECTION_TOOL::highlightNet( const VECTOR2D& aPosition, bool aUseSelection )
171 {
172  BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
174 
175  int net = -1;
176  bool enableHighlight = false;
177 
178  if( aUseSelection )
179  {
180  SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
181 
182  const PCBNEW_SELECTION& selection = selectionTool->GetSelection();
183 
184  for( auto item : selection )
185  {
186  if( BOARD_CONNECTED_ITEM::ClassOf( item ) )
187  {
188  auto ci = static_cast<BOARD_CONNECTED_ITEM*>( item );
189 
190  int item_net = ci->GetNetCode();
191 
192  if( net < 0 )
193  net = item_net;
194  else if( net != item_net ) // more than one net selected: do nothing
195  return false;
196  }
197  }
198 
199  enableHighlight = ( net >= 0 && !settings->GetHighlightNetCodes().count( net ) );
200  }
201 
202  // If we didn't get a net to highlight from the selection, use the cursor
203  if( net < 0 )
204  {
205  auto guide = m_frame->GetCollectorsGuide();
206  GENERAL_COLLECTOR collector;
207 
208  // Find a connected item for which we are going to highlight a net
209  collector.Collect( board, GENERAL_COLLECTOR::PadsOrTracks, (wxPoint) aPosition, guide );
210 
211  if( collector.GetCount() == 0 )
212  collector.Collect( board, GENERAL_COLLECTOR::Zones, (wxPoint) aPosition, guide );
213 
214  // Clear the previous highlight
215  m_frame->SendMessageToEESCHEMA( nullptr );
216 
217  for( int i = 0; i < collector.GetCount(); i++ )
218  {
219  if( ( collector[i]->GetLayerSet() & LSET::AllCuMask() ).none() )
220  collector.Remove( i );
221 
222  if( collector[i]->Type() == PCB_PAD_T )
223  {
224  m_frame->SendMessageToEESCHEMA( static_cast<BOARD_CONNECTED_ITEM*>( collector[i] ) );
225  break;
226  }
227  }
228 
229  enableHighlight = ( collector.GetCount() > 0 );
230 
231  // Obtain net code for the clicked item
232  if( enableHighlight )
233  net = static_cast<BOARD_CONNECTED_ITEM*>( collector[0] )->GetNetCode();
234  }
235 
236  auto& netcodes = settings->GetHighlightNetCodes();
237 
238  // Toggle highlight when the same net was picked
239  if( net > 0 && netcodes.count( net ) )
240  enableHighlight = !settings->IsHighlightEnabled();
241 
242  if( enableHighlight != settings->IsHighlightEnabled()
243  || !netcodes.count( net ) )
244  {
245  if( !netcodes.empty() )
246  m_lastNetcode = *netcodes.begin();
247 
248  settings->SetHighlight( enableHighlight, net );
250  }
251 
252  // Store the highlighted netcode in the current board (for dialogs for instance)
253  if( enableHighlight && net >= 0 )
254  {
255  board->SetHighLightNet( net );
256  board->HighLightON();
257 
258  NETINFO_ITEM* netinfo = board->FindNet( net );
259 
260  if( netinfo )
261  {
262  MSG_PANEL_ITEMS items;
263  netinfo->GetMsgPanelInfo( m_frame, items );
264  m_frame->SetMsgPanel( items );
266  }
267  }
268  else
269  {
273  }
274 
275  return true;
276 }
277 
278 
280 {
281  int netcode = aEvent.Parameter<intptr_t>();
283 
284  if( netcode > 0 )
285  {
286  m_lastNetcode = *settings->GetHighlightNetCodes().begin();
287  settings->SetHighlight( true, netcode );
289  }
290  else if( aEvent.IsAction( &PCB_ACTIONS::toggleLastNetHighlight ) )
291  {
292  int temp = *settings->GetHighlightNetCodes().begin();
293  settings->SetHighlight( true, m_lastNetcode );
295  m_lastNetcode = temp;
296  }
297  else // Highlight the net belonging to the item under the cursor
298  {
299  highlightNet( getViewControls()->GetMousePosition(), false );
300  }
301 
302  return 0;
303 }
304 
305 
307 {
308  BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
310 
312  settings->SetHighlight( false );
316  return 0;
317 }
318 
319 
321 {
322  std::string tool = aEvent.GetCommandStr().get();
324 
325  // Deactivate other tools; particularly important if another PICKER is currently running
326  Activate();
327 
328  // If the keyboard hotkey was triggered and we are already in the highlight tool, behave
329  // the same as a left-click. Otherwise highlight the net of the selected item(s), or if
330  // there is no selection, then behave like a ctrl-left-click.
332  {
333  bool use_selection = m_frame->IsCurrentTool( PCB_ACTIONS::highlightNetTool );
334  highlightNet( getViewControls()->GetMousePosition(), use_selection );
335  }
336 
337  picker->SetClickHandler(
338  [this] ( const VECTOR2D& pt ) -> bool
339  {
340  highlightNet( pt, false );
341  return true;
342  } );
343 
344  picker->SetLayerSet( LSET::AllCuMask() );
345 
346  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
347 
348  return 0;
349 }
350 
351 
353 {
354  std::string tool = aEvent.GetCommandStr().get();
356  BOARD* board = getModel<BOARD>();
357  auto& opt = displayOptions();
358 
359  // Deactivate other tools; particularly important if another PICKER is currently running
360  Activate();
361 
362  picker->SetClickHandler(
363  [this, board, opt]( const VECTOR2D& pt ) -> bool
364  {
365  SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
366 
369  PCBNEW_SELECTION& selection = selectionTool->GetSelection();
370 
371  if( selection.Empty() )
372  {
375  selection = selectionTool->GetSelection();
376  }
377 
378  if( selection.Empty() )
379  {
380  // Clear the previous local ratsnest if we click off all items
381  for( MODULE* mod : board->Modules() )
382  {
383  for( D_PAD* pad : mod->Pads() )
384  pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest );
385  }
386  }
387  else
388  {
389  for( auto item : selection )
390  {
391  if( D_PAD* pad = dyn_cast<D_PAD*>(item) )
392  {
393  pad->SetLocalRatsnestVisible( !pad->GetLocalRatsnestVisible() );
394  }
395  else if( MODULE* mod = dyn_cast<MODULE*>(item) )
396  {
397  if( !mod->Pads().empty() )
398  {
399  bool enable = !( *( mod->Pads().begin() ) )->GetLocalRatsnestVisible();
400 
401  for( auto modpad : mod->Pads() )
402  modpad->SetLocalRatsnestVisible( enable );
403  }
404  }
405  }
406  }
407 
409 
410  return true;
411  } );
412 
413  picker->SetFinalizeHandler(
414  [board, opt] ( int aCondition )
415  {
416  if( aCondition != PCBNEW_PICKER_TOOL::END_ACTIVATE )
417  {
418  for( auto mod : board->Modules() )
419  {
420  for( auto pad : mod->Pads() )
421  pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest );
422  }
423  }
424  } );
425 
426  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
427 
428  return 0;
429 }
430 
431 
433 {
434  auto selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
435  auto& selection = selectionTool->GetSelection();
436  auto connectivity = getModel<BOARD>()->GetConnectivity();
437 
438  if( selection.Empty() )
439  {
440  connectivity->ClearDynamicRatsnest();
441  }
442  else if( m_slowRatsnest )
443  {
444  // Compute ratsnest only when user stops dragging for a moment
445  connectivity->HideDynamicRatsnest();
446  m_ratsnestTimer.Start( 20 );
447  }
448  else
449  {
450  // Check how much time doest it take to calculate ratsnest
451  PROF_COUNTER counter;
453  counter.Stop();
454 
455  // If it is too slow, then switch to 'slow ratsnest' mode when
456  // ratsnest is calculated when user stops dragging items for a moment
457  if( counter.msecs() > 25 )
458  {
459  m_slowRatsnest = true;
460  connectivity->HideDynamicRatsnest();
461  }
462  }
463 
464  return 0;
465 }
466 
467 
469 {
470  getModel<BOARD>()->GetConnectivity()->HideDynamicRatsnest();
471  m_slowRatsnest = false;
472  return 0;
473 }
474 
475 
476 void PCB_INSPECTION_TOOL::ratsnestTimer( wxTimerEvent& aEvent )
477 {
478  auto connectivity = getModel<BOARD>()->GetConnectivity();
479 
480  m_ratsnestTimer.Stop();
481 
483  PROF_COUNTER counter;
485  counter.Stop();
486 
488  if( counter.msecs() <= 25 )
489  m_slowRatsnest = false;
490 
492  m_frame->GetCanvas()->Refresh();
493 }
494 
495 
497 {
498  SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
499  SELECTION& selection = selectionTool->GetSelection();
500  std::shared_ptr<CONNECTIVITY_DATA> connectivity = board()->GetConnectivity();
501  std::vector<BOARD_ITEM*> items;
502 
503  for( EDA_ITEM* item : selection )
504  {
505  BOARD_CONNECTED_ITEM* boardItem = static_cast<BOARD_CONNECTED_ITEM*>( item );
506 
507  if( boardItem->Type() == PCB_MODULE_T )
508  {
509  for( auto pad : static_cast<MODULE*>( item )->Pads() )
510  {
511  if( pad->GetLocalRatsnestVisible() || displayOptions().m_ShowModuleRatsnest )
512  items.push_back( pad );
513  }
514  }
515  else if( boardItem->GetLocalRatsnestVisible() || displayOptions().m_ShowModuleRatsnest )
516  {
517  items.push_back( boardItem );
518  }
519  }
520 
521  connectivity->ComputeDynamicRatsnest( items );
522 }
523 
524 
526 {
527  if( m_listNetsDialog == nullptr )
528  {
530  std::make_unique<DIALOG_SELECT_NET_FROM_LIST>( m_frame, m_listNetsDialogSettings );
531 
532  m_listNetsDialog->Connect( wxEVT_CLOSE_WINDOW,
533  wxCommandEventHandler( PCB_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr,
534  this );
535 
536  m_listNetsDialog->Connect( wxEVT_BUTTON,
537  wxCommandEventHandler( PCB_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr,
538  this );
539  }
540 
541  m_listNetsDialog->Show( true );
542  return 0;
543 }
544 
545 
546 void PCB_INSPECTION_TOOL::onListNetsDialogClosed( wxCommandEvent& event )
547 {
549 
550  m_listNetsDialog->Disconnect( wxEVT_CLOSE_WINDOW,
551  wxCommandEventHandler( PCB_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr, this );
552 
553  m_listNetsDialog->Disconnect( wxEVT_BUTTON,
554  wxCommandEventHandler( PCB_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr, this );
555 
556  m_listNetsDialog->Destroy();
557  m_listNetsDialog.release();
558 }
559 
560 
562 {
563  doHideNet( aEvent.Parameter<intptr_t>(), true );
564  return 0;
565 }
566 
567 
569 {
570  doHideNet( aEvent.Parameter<intptr_t>(), false );
571  return 0;
572 }
573 
574 
575 void PCB_INSPECTION_TOOL::doHideNet( int aNetCode, bool aHide )
576 {
577  KIGFX::PCB_RENDER_SETTINGS* rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>(
579 
580  SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
581  SELECTION& selection = selectionTool->GetSelection();
582 
583  if( aNetCode <= 0 && !selection.Empty() )
584  {
585  for( EDA_ITEM* item : selection )
586  {
587  if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
588  {
589  if( bci->GetNetCode() > 0 )
590  doHideNet( bci->GetNetCode(), aHide );
591  }
592  }
593 
594  return;
595  }
596 
597  if( aHide )
598  rs->GetHiddenNets().insert( aNetCode );
599  else
600  rs->GetHiddenNets().erase( aNetCode );
601 
603  m_frame->GetCanvas()->Refresh();
604 }
605 
606 
608 {
612 
616 
619 
627 
630 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:62
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Function AllCuMask returns a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:712
void Stop()
save the time when this function was called, and set the counter stane to stop
Definition: profile.h:82
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Function AddMenu()
std::set< int > & GetHiddenNets()
Definition: pcb_painter.h:196
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
int UpdateSelectionRatsnest(const TOOL_EVENT &aEvent)
Updates ratsnest for selected items.
wxMenuItem * Add(const wxString &aLabel, int aId, const BITMAP_OPAQUE *aIcon)
Function Add() Adds a wxWidgets-style entry to the menu.
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:284
bool IsCurrentTool(const TOOL_ACTION &aAction) const
static const TOOL_EVENT SelectedEvent
Definition: actions.h:203
void SendCrossProbeNetName(const wxString &aNetName)
Sends a net name to eeschema for highlighting.
BOARD * board() const
int HighlightNet(const TOOL_EVENT &aEvent)
Highlights net belonging to the item under the cursor.
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
static int getMenuId(const TOOL_ACTION &aAction)
Returns the corresponding wxMenuItem identifier for a TOOL_ACTION object.
Definition: action_menu.h:162
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:204
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
ACTION_MENU.
Definition: action_menu.h:44
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
DIALOG_SELECT_NET_FROM_LIST::SETTINGS m_listNetsDialogSettings
static TOOL_ACTION hideNet
Definition: pcb_actions.h:420
double msecs(bool aSinceLast=false)
Definition: profile.h:143
static TOOL_ACTION highlightItem
Definition: pcb_actions.h:419
void Collect(BOARD_ITEM *aItem, const KICAD_T aScanList[], const wxPoint &aRefPos, const COLLECTORS_GUIDE &aGuide)
Scan a BOARD_ITEM using this class's Inspector method, which does the collection.
Definition: collectors.cpp:539
static TOOL_ACTION boardStatistics
Definition: pcb_actions.h:411
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Function OnlyTypes Creates a functor that tests if the selected items are only of given types.
SELECTION_TOOL.
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:102
int HighlightNetTool(const TOOL_EVENT &aEvent)
Launches a tool to pick the item whose net is going to be highlighted.
TOOL_MENU & GetToolMenu()
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
bool GetLocalRatsnestVisible() const
int CrossProbePcbToSch(const TOOL_EVENT &aEvent)
Notifies eeschema about the selected item.
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
static const KICAD_T PadsOrTracks[]
A scan list for PADs, TRACKs, or VIAs.
Definition: collectors.h:298
bool highlightNet(const VECTOR2D &aPosition, bool aUseSelection)
Look for a BOARD_CONNECTED_ITEM in a given spot and if one is found - it enables highlight for its ne...
static TOOL_ACTION localRatsnestTool
Definition: pcb_actions.h:424
std::unique_ptr< DIALOG_SELECT_NET_FROM_LIST > m_listNetsDialog
static TOOL_ACTION toggleLastNetHighlight
Definition: pcb_actions.h:416
bool Init() override
Function Init() Init() is called once upon a registration of the tool.
The class PROF_COUNTER is a small class to help profiling.
Definition: profile.h:44
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
int HideNet(const TOOL_EVENT &aEvent)
Hide the ratsnest for a given net
EDA_ITEM * GetModel() const
Definition: tool_manager.h:291
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Function SetFinalizeHandler() Sets a handler for the finalize event.
void Remove(int aIndex)
Function Remove removes the item at aIndex (first position is 0);.
Definition: collector.h:130
search types array terminator (End Of Types)
Definition: typeinfo.h:82
KICAD_T
Enum KICAD_T is the set of class identification values, stored in EDA_ITEM::m_StructType.
Definition: typeinfo.h:78
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
void RedrawRatsnest()
Forces refresh of the ratsnest visual representation
int ShowStatisticsDialog(const TOOL_EVENT &aEvent)
Function ShowStatisticDialog()
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
bool IsAction(const TOOL_ACTION *aAction) const
Function IsAction() Tests if the event contains an action issued upon activation of the given TOOL_AC...
Definition: tool_event.cpp:67
PCBNEW_SELECTION & GetSelection()
Function GetSelection()
void doHideNet(int aNetCode, bool aHide)
static TOOL_ACTION pickerTool
Definition: actions.h:149
void update() override
Update menu state stub.
static TOOL_ACTION highlightNetTool
Definition: pcb_actions.h:417
PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:63
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:101
class MODULE, a footprint
Definition: typeinfo.h:89
PCB_EDIT_FRAME * m_frame
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
Function GetCollectorsGuide.
Generic tool for picking a point.
void ResetNetHighLight()
Function ResetNetHighLight Reset all high light data to the init state.
const PCBNEW_SELECTION & selection() const
#define NULL
MODULES & Modules()
Definition: class_board.h:266
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:585
int HighlightItem(const TOOL_EVENT &aEvent)
Performs the appropriate action in response to an eeschema cross-probe.
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
void SetIcon(const BITMAP_OPAQUE *aIcon)
Function SetIcon() Assigns an icon for the entry.
Definition: action_menu.cpp:70
TOOL_EVENT.
Definition: tool_event.h:171
void onListNetsDialogClosed(wxCommandEvent &event)
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:355
static const KICAD_T Zones[]
A scan list for zones outlines only.
Definition: collectors.h:277
const wxString & GetNetname() const
Function GetNetname.
Definition: netinfo.h:231
Items that may change while the view stays the same (noncached)
Definition: definitions.h:50
static const TOOL_EVENT ClearedEvent
Definition: actions.h:205
void SetHighLightNet(int aNetCode, bool aMulti=false)
Function SetHighLightNet Select the netcode to be highlighted.
static TOOL_ACTION hideDynamicRatsnest
Definition: pcb_actions.h:425
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=NULL) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
static bool ClassOf(const EDA_ITEM *aItem)
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:121
const PCB_DISPLAY_OPTIONS & displayOptions() const
static TOOL_ACTION clearHighlight
Definition: pcb_actions.h:414
int HideDynamicRatsnest(const TOOL_EVENT &aEvent)
Hides ratsnest for selected items. Called when there are no items selected.
static void PadFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector)
Function PadFilter() A selection filter which prunes the selection to contain only items of type PCB_...
Definition: edit_tool.cpp:1333
void Reset(RESET_REASON aReason) override
Function Reset() Brings the tool to a known, initial state.
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
void SendMessageToEESCHEMA(BOARD_ITEM *objectToSync)
Function SendMessageToEESCHEMA sends a message to the schematic editor so that it may move its cursor...
virtual RENDER_SETTINGS * GetSettings()=0
Function GetAdapter Returns pointer to current settings that are going to be used when drawing items.
void calculateSelectionRatsnest()
Recalculates dynamic ratsnest for the current selection
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
static TOOL_ACTION showNet
Definition: pcb_actions.h:421
void SetTitle(const wxString &aTitle) override
Function SetTitle() Sets title for the menu.
Definition: action_menu.cpp:88
static TOOL_ACTION highlightNet
Definition: pcb_actions.h:415
static TOOL_ACTION highlightNetSelection
Definition: pcb_actions.h:418
void setTransitions() override
Bind handlers to corresponding TOOL_ACTIONs
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:180
void SetLayerSet(LSET aLayerSet)
Function SetLayerSet() Sets the tool's snap layer set.
int LocalRatsnestTool(const TOOL_EVENT &aEvent)
Shows local ratsnest of a component
#define _(s)
Definition: 3d_actions.cpp:33
TOOL_MANAGER * getToolManager() const
Returns an instance of TOOL_MANAGER class.
static TOOL_ACTION listNets
Definition: pcb_actions.h:322
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:240
DIALOG_BOARD_STATISTIC.
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Function CreateSubMenu.
Definition: tool_menu.cpp:52
static TOOL_ACTION selectItem
Selects an item (specified as the event parameter).
Definition: pcb_actions.h:65
int Size() const
Returns the number of selected parts.
Definition: selection.h:127
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
RESET_REASON
Determines the reason of reset for a tool
Definition: tool_base.h:79
int ListNets(const TOOL_EVENT &aEvent)
void Activate()
Function Activate() Runs the tool.
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
static TOOL_ACTION updateLocalRatsnest
Definition: pcb_actions.h:426
static void FootprintFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector)
Function FootprintFilter() A selection filter which prunes the selection to contain only items of typ...
Definition: edit_tool.cpp:1345
int ClearHighlight(const TOOL_EVENT &aEvent)
Clears all board highlights
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Function GetMsgPanelInfo returns the information about the NETINFO_ITEM in aList to display in the me...
void UpdateAllLayersColor()
Function UpdateAllLayersColor() Applies the new coloring scheme to all layers.
Definition: view.cpp:798
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
Definition: pcb_actions.h:59
int ShowNet(const TOOL_EVENT &aEvent)
Show the ratsnest for a given net
EDA_ITEM * Front() const
Definition: selection.h:184
ACTION_MENU * create() const override
Returns an instance of this class. It has to be overridden in inheriting classes.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193
const BITMAP_OPAQUE ratsnest_xpm[1]
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.
void ratsnestTimer(wxTimerEvent &aEvent)
Event handler to recalculate dynamic ratsnest