KiCad PCB EDA Suite
PCB_INSPECTION_TOOL Class Reference

PCB_INSPECTION_TOOL. More...

#include <pcb_inspection_tool.h>

Inheritance diagram for PCB_INSPECTION_TOOL:
PCB_TOOL_BASE TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 

Determines the reason of reset for a tool

More...
 

Public Member Functions

 PCB_INSPECTION_TOOL ()
 
bool Init () override
 Function Init() Init() is called once upon a registration of the tool. More...
 
void Reset (RESET_REASON aReason) override
 Function Reset() Brings the tool to a known, initial state. More...
 
int ShowStatisticsDialog (const TOOL_EVENT &aEvent)
 Function ShowStatisticDialog() More...
 
int CrossProbePcbToSch (const TOOL_EVENT &aEvent)
 

Notifies eeschema about the selected item.

More...
 
int HighlightNet (const TOOL_EVENT &aEvent)
 

Highlights net belonging to the item under the cursor.

More...
 
int ClearHighlight (const TOOL_EVENT &aEvent)
 

Clears all board highlights

More...
 
int HighlightNetTool (const TOOL_EVENT &aEvent)
 

Launches a tool to pick the item whose net is going to be highlighted.

More...
 
int HighlightItem (const TOOL_EVENT &aEvent)
 

Performs the appropriate action in response to an eeschema cross-probe.

More...
 
int UpdateSelectionRatsnest (const TOOL_EVENT &aEvent)
 

Updates ratsnest for selected items.

More...
 
int HideDynamicRatsnest (const TOOL_EVENT &aEvent)
 

Hides ratsnest for selected items. Called when there are no items selected.

More...
 
int LocalRatsnestTool (const TOOL_EVENT &aEvent)
 

Shows local ratsnest of a component

More...
 
int FlipPcbView (const TOOL_EVENT &aEvent)
 
int ListNets (const TOOL_EVENT &aEvent)
 
int HideNet (const TOOL_EVENT &aEvent)
 

Hide the ratsnest for a given net

More...
 
int ShowNet (const TOOL_EVENT &aEvent)
 

Show the ratsnest for a given net

More...
 
int InspectClearance (const TOOL_EVENT &aEvent)
 

Show the clearance resolution for two selected items

More...
 
int InspectConstraints (const TOOL_EVENT &aEvent)
 
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

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...
 
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

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
 

Private Member Functions

void ratsnestTimer (wxTimerEvent &aEvent)
 

Event handler to recalculate dynamic ratsnest

More...
 
void calculateSelectionRatsnest (const VECTOR2I &aDelta)
 

Recalculates dynamic ratsnest for the current selection

More...
 
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 net. More...
 
void doHideNet (int aNetCode, bool aHide)
 
void setTransitions () override
 

Bind handlers to corresponding TOOL_ACTIONs

More...
 
void onListNetsDialogClosed (wxCommandEvent &aEvent)
 
void onInspectClearanceDialogClosed (wxCommandEvent &aEvent)
 
void onInspectConstraintsDialogClosed (wxCommandEvent &aEvent)
 
void reportZoneConnection (ZONE_CONTAINER *aZone, D_PAD *aPad, REPORTER *r)
 
void reportCopperClearance (PCB_LAYER_ID aLayer, BOARD_CONNECTED_ITEM *aA, BOARD_ITEM *aB, REPORTER *r)
 

Private Attributes

PCB_EDIT_FRAMEm_frame
 
bool m_probingSchToPcb
 
int m_lastNetcode
 
CONNECTIVITY_DATAm_dynamicData
 
std::unique_ptr< DIALOG_SELECT_NET_FROM_LISTm_listNetsDialog
 
DIALOG_SELECT_NET_FROM_LIST::SETTINGS m_listNetsDialogSettings
 
std::unique_ptr< DIALOG_HTML_REPORTERm_inspectClearanceDialog
 
std::unique_ptr< DIALOG_CONSTRAINTS_REPORTERm_inspectConstraintsDialog
 

Detailed Description

PCB_INSPECTION_TOOL.

Tool for pcb inspection.

Definition at line 42 of file pcb_inspection_tool.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

◆ PCB_INSPECTION_TOOL()

PCB_INSPECTION_TOOL::PCB_INSPECTION_TOOL ( )

Definition at line 40 of file pcb_inspection_tool.cpp.

40  :
41  PCB_TOOL_BASE( "pcbnew.InspectionTool" ),
42  m_frame( nullptr )
43 {
44  m_probingSchToPcb = false;
45  m_lastNetcode = -1;
46  m_dynamicData = nullptr;
47 }
PCB_EDIT_FRAME * m_frame
CONNECTIVITY_DATA * m_dynamicData
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool_base.h:75

References m_dynamicData, m_lastNetcode, and m_probingSchToPcb.

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(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), 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(), HighlightNetTool(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), LocalRatsnestTool(), 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(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), 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_TOOL::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(), calculateSelectionRatsnest(), EDIT_TOOL::ChangeTrackWidth(), ZONE_FILLER_TOOL::CheckAllZones(), ClearHighlight(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), ROUTER_TOOL::CustomTrackWidthDialog(), PCBNEW_CONTROL::DeleteItemCursor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), ZONE_FILLER_TOOL::FillAllZones(), SELECTION_TOOL::FilterCollectorForGroups(), SELECTION_TOOL::filterSelection(), SELECTION_TOOL::GetBoard(), SELECTION_TOOL::getCollectorsGuide(), PCB_EDITOR_CONTROL::GroupFlattenSelected(), PCB_EDITOR_CONTROL::GroupMergeSelected(), PCB_EDITOR_CONTROL::GroupRemoveItemsSelected(), PCB_EDITOR_CONTROL::GroupSelected(), highlightNet(), PCBNEW_CONTROL::LayerNext(), PCBNEW_CONTROL::LayerPrev(), LocalRatsnestTool(), PCB_TOOL_BASE::module(), EDIT_TOOL::MoveExact(), ROUTER_TOOL::onTrackViaSizeChanged(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::Paste(), PCBNEW_CONTROL::placeBoardItems(), PCB_EDITOR_CONTROL::PlaceModule(), PAD_TOOL::PlacePad(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), SELECTION_TOOL::RebuildSelection(), PAD_TOOL::recombinePad(), EDIT_TOOL::Remove(), PCB_EDITOR_CONTROL::RepairBoard(), PNS::TOOL_BASE::Reset(), PCBNEW_CONTROL::Reset(), SELECTION_TOOL::Selectable(), SELECTION_TOOL::selectAllItemsOnNet(), SELECTION_TOOL::selectAllItemsOnSheet(), SELECTION_TOOL::selectConnectedTracks(), SELECTION_TOOL::selectPoint(), PCBNEW_CONTROL::TrackDisplayMode(), PCB_EDITOR_CONTROL::UngroupSelected(), PCBNEW_CONTROL::ViaDisplayMode(), PCBNEW_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), PCB_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ calculateSelectionRatsnest()

void PCB_INSPECTION_TOOL::calculateSelectionRatsnest ( const VECTOR2I aDelta)
private

Recalculates dynamic ratsnest for the current selection

Definition at line 809 of file pcb_inspection_tool.cpp.

810 {
811  SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
812  SELECTION& selection = selectionTool->GetSelection();
813  std::shared_ptr<CONNECTIVITY_DATA> connectivity = board()->GetConnectivity();
814  std::vector<BOARD_ITEM*> items;
815  std::deque<EDA_ITEM*> queued_items( selection.begin(), selection.end() );
816 
817  for( std::size_t i = 0; i < queued_items.size(); ++i )
818  {
819  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( queued_items[i] );
820 
821  if( item->Type() == PCB_MODULE_T )
822  {
823  for( auto pad : static_cast<MODULE*>( item )->Pads() )
824  {
825  if( pad->GetLocalRatsnestVisible() || displayOptions().m_ShowModuleRatsnest )
826  items.push_back( pad );
827  }
828  }
829  else if( item->Type() == PCB_GROUP_T )
830  {
831  PCB_GROUP *group = static_cast<PCB_GROUP*>( item );
832  group->RunOnDescendants( [ &queued_items ]( BOARD_ITEM *aItem )
833  { queued_items.push_back( aItem );} );
834  }
835  else if( BOARD_CONNECTED_ITEM* boardItem = dyn_cast<BOARD_CONNECTED_ITEM*>( item ) )
836  {
837  if( boardItem->GetLocalRatsnestVisible() || displayOptions().m_ShowModuleRatsnest )
838  items.push_back( boardItem );
839  }
840  }
841 
842  if( items.empty() || std::none_of( items.begin(), items.end(), []( const BOARD_ITEM* aItem )
843  { return( aItem->Type() == PCB_TRACE_T || aItem->Type() == PCB_PAD_T ||
844  aItem->Type() == PCB_ARC_T || aItem->Type() == PCB_ZONE_AREA_T ||
845  aItem->Type() == PCB_MODULE_T || aItem->Type() == PCB_VIA_T ); } ) )
846  {
847  return;
848  }
849 
850  if( !m_dynamicData )
851  {
852  m_dynamicData = new CONNECTIVITY_DATA( items, true );
853  connectivity->BlockRatsnestItems( items );
854  }
855  else
856  {
857  m_dynamicData->Move( aDelta );
858  }
859 
860  connectivity->ComputeDynamicRatsnest( items, m_dynamicData );
861 }
BOARD * board() const
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:109
PCB_GROUP is a set of BOARD_ITEMs (i.e., without duplicates)
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
ITER end()
Definition: selection.h:62
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:106
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
PCBNEW_SELECTION & GetSelection()
Function GetSelection()
ITER begin()
Definition: selection.h:61
class MODULE, a footprint
Definition: typeinfo.h:89
const PCBNEW_SELECTION & selection() const
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Function GetConnectivity() returns list of missing connections between components/tracks.
Definition: class_board.h:345
CONNECTIVITY_DATA * m_dynamicData
void RunOnDescendants(const std::function< void(BOARD_ITEM *)> &aFunction)
Invokes a function on all descendents of the group.
const PCB_DISPLAY_OPTIONS & displayOptions() const
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
void Move(const VECTOR2I &aDelta)
Moves the connectivity list anchors.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References SELECTION::begin(), PCB_TOOL_BASE::board(), PCB_TOOL_BASE::displayOptions(), SELECTION::end(), BOARD::GetConnectivity(), SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), m_dynamicData, PCB_DISPLAY_OPTIONS::m_ShowModuleRatsnest, TOOL_BASE::m_toolMgr, CONNECTIVITY_DATA::Move(), PCB_ARC_T, PCB_GROUP_T, PCB_MODULE_T, PCB_PAD_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_AREA_T, PCB_GROUP::RunOnDescendants(), PCB_TOOL_BASE::selection(), and EDA_ITEM::Type().

Referenced by UpdateSelectionRatsnest().

◆ canvas()

◆ ClearHighlight()

int PCB_INSPECTION_TOOL::ClearHighlight ( const TOOL_EVENT aEvent)

Clears all board highlights

Definition at line 637 of file pcb_inspection_tool.cpp.

638 {
639  BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
641 
643  settings->SetHighlight( false );
647  return 0;
648 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:289
void SendCrossProbeNetName(const wxString &aNetName)
Sends a net name to eeschema for highlighting.
BOARD * board() const
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
EDA_ITEM * GetModel() const
Definition: tool_manager.h:296
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
PCB_EDIT_FRAME * m_frame
void ResetNetHighLight()
Function ResetNetHighLight Reset all high light data to the init state.
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
virtual RENDER_SETTINGS * GetSettings()=0
Function GetAdapter Returns pointer to current settings that are going to be used when drawing items.
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:178
void UpdateAllLayersColor()
Function UpdateAllLayersColor() Applies the new coloring scheme to all layers.
Definition: view.cpp:794

References PCB_TOOL_BASE::board(), TOOL_MANAGER::GetModel(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), TOOL_MANAGER::GetView(), m_frame, TOOL_BASE::m_toolMgr, BOARD::ResetNetHighLight(), PCB_EDIT_FRAME::SendCrossProbeNetName(), EDA_DRAW_FRAME::SetMsgPanel(), and KIGFX::VIEW::UpdateAllLayersColor().

Referenced by setTransitions().

◆ controls()

◆ CrossProbePcbToSch()

int PCB_INSPECTION_TOOL::CrossProbePcbToSch ( const TOOL_EVENT aEvent)

Notifies eeschema about the selected item.

Definition at line 460 of file pcb_inspection_tool.cpp.

461 {
462  // Don't get in an infinite loop PCB -> SCH -> PCB -> SCH -> ...
463  if( m_probingSchToPcb )
464  return 0;
465 
467  const PCBNEW_SELECTION& selection = selTool->GetSelection();
468 
469  if( selection.Size() == 1 )
470  m_frame->SendMessageToEESCHEMA( static_cast<BOARD_ITEM*>( selection.Front() ) );
471  else
472  m_frame->SendMessageToEESCHEMA( nullptr );
473 
474  return 0;
475 }
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
PCBNEW_SELECTION & GetSelection()
Function GetSelection()
PCB_EDIT_FRAME * m_frame
const PCBNEW_SELECTION & selection() const
void SendMessageToEESCHEMA(BOARD_ITEM *objectToSync)
Function SendMessageToEESCHEMA sends a message to the schematic editor so that it may move its cursor...
int Size() const
Returns the number of selected parts.
Definition: selection.h:127
EDA_ITEM * Front() const
Definition: selection.h:184

References SELECTION::Front(), SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), m_frame, m_probingSchToPcb, TOOL_BASE::m_toolMgr, PCB_TOOL_BASE::selection(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), and SELECTION::Size().

Referenced by setTransitions().

◆ displayOptions()

const PCB_DISPLAY_OPTIONS & PCB_TOOL_BASE::displayOptions ( ) const
protectedinherited

Definition at line 268 of file pcb_tool_base.cpp.

269 {
270  return frame()->GetDisplayOptions();
271 }
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Function GetDisplayOptions Display options control the way tracks, vias, outlines and other things ar...
PCB_BASE_EDIT_FRAME * frame() const

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

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

◆ doHideNet()

void PCB_INSPECTION_TOOL::doHideNet ( int  aNetCode,
bool  aHide 
)
private

Definition at line 934 of file pcb_inspection_tool.cpp.

935 {
936  KIGFX::PCB_RENDER_SETTINGS* rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>(
938 
939  SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
940  SELECTION& selection = selectionTool->GetSelection();
941 
942  if( aNetCode <= 0 && !selection.Empty() )
943  {
944  for( EDA_ITEM* item : selection )
945  {
946  if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
947  {
948  if( bci->GetNetCode() > 0 )
949  doHideNet( bci->GetNetCode(), aHide );
950  }
951  }
952 
953  return;
954  }
955 
956  if( aHide )
957  rs->GetHiddenNets().insert( aNetCode );
958  else
959  rs->GetHiddenNets().erase( aNetCode );
960 
962  m_frame->GetCanvas()->Refresh();
963 }
std::set< int > & GetHiddenNets()
Definition: pcb_painter.h:184
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:289
SELECTION_TOOL.
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
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
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
void doHideNet(int aNetCode, bool aHide)
PCB_RENDER_SETTINGS Stores PCB specific render settings.
Definition: pcb_painter.h:64
PCB_EDIT_FRAME * m_frame
const PCBNEW_SELECTION & selection() const
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...
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:121
virtual RENDER_SETTINGS * GetSettings()=0
Function GetAdapter Returns pointer to current settings that are going to be used when drawing items.
EDA_ITEM is a base class for most all the KiCad significant classes, used in schematics and boards.
Definition: base_struct.h:159

References SELECTION::Empty(), PCB_BASE_FRAME::GetCanvas(), KIGFX::PCB_RENDER_SETTINGS::GetHiddenNets(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), TOOL_MANAGER::GetTool(), TOOL_MANAGER::GetView(), m_frame, TOOL_BASE::m_toolMgr, PCB_DRAW_PANEL_GAL::RedrawRatsnest(), EDA_DRAW_PANEL_GAL::Refresh(), and PCB_TOOL_BASE::selection().

Referenced by HideNet(), and ShowNet().

◆ 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 
54  // Add a VIEW_GROUP that serves as a preview for the new item
55  PCBNEW_SELECTION preview;
56  view()->Add( &preview );
57 
58  aPlacer->m_board = board();
59  aPlacer->m_frame = frame();
60  aPlacer->m_modifiers = 0;
61 
62  auto makeNewItem = [&] ( VECTOR2I aPosition )
63  {
64  if( frame()->GetModel() )
65  newItem = aPlacer->CreateItem();
66 
67  if( newItem )
68  {
69  newItem->SetPosition( (wxPoint) aPosition );
70  preview.Add( newItem.get() );
71 
72  if( newItem->Type() == PCB_MODULE_T )
73  {
74  auto module = dyn_cast<MODULE*>( newItem.get() );
75 
76  // modules have more drawable parts
77  module->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
78  }
79  }
80  };
81 
82  if( aOptions & IPO_SINGLE_CLICK )
83  makeNewItem( controls()->GetCursorPosition() );
84 
85  // Main loop: keep receiving events
86  while( TOOL_EVENT* evt = Wait() )
87  {
88  if( !newItem )
89  frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_PENCIL );
90  else
91  frame()->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
92 
93  VECTOR2I cursorPos = controls()->GetCursorPosition();
94  aPlacer->m_modifiers = evt->Modifier();
95 
96  auto cleanup = [&] ()
97  {
98  newItem = nullptr;
99  preview.Clear();
100  view()->Update( &preview );
101  controls()->SetAutoPan( false );
102  controls()->CaptureCursor( false );
103  controls()->ShowCursor( true );
104  };
105 
106  if( evt->IsCancelInteractive() )
107  {
108  if( aOptions & IPO_SINGLE_CLICK )
109  {
110  cleanup();
111  frame()->PopTool( aTool );
112  break;
113  }
114  else if( newItem )
115  cleanup();
116  else
117  {
118  frame()->PopTool( aTool );
119  break;
120  }
121  }
122  else if( evt->IsActivate() )
123  {
124  if( newItem )
125  cleanup();
126 
127  if( evt->IsPointEditor() )
128  {
129  // don't exit (the point editor runs in the background)
130  }
131  else if( evt->IsMoveTool() )
132  {
133  // leave ourselves on the stack so we come back after the move
134  break;
135  }
136  else
137  {
138  frame()->PopTool( aTool );
139  break;
140  }
141  }
142  else if( evt->IsClick( BUT_LEFT ) )
143  {
144  if( !newItem )
145  {
146  // create the item if possible
147  makeNewItem( cursorPos );
148 
149  // no item created, so wait for another click
150  if( !newItem )
151  continue;
152 
153  controls()->CaptureCursor( true );
154  controls()->SetAutoPan( true );
155  }
156  else
157  {
158  auto oldFlags = newItem->GetFlags();
159  newItem->ClearFlags();
160 
161  if( !aPlacer->PlaceItem( newItem.get(), commit ) )
162  {
163  newItem->SetFlags( oldFlags );
164  continue;
165  }
166 
167  preview.Clear();
168  newItem.release();
169  commit.Push( aCommitMessage );
170 
171  controls()->CaptureCursor( false );
172  controls()->SetAutoPan( false );
173  controls()->ShowCursor( true );
174 
175  if( !( aOptions & IPO_REPEAT ) )
176  break;
177 
178  if( aOptions & IPO_SINGLE_CLICK )
179  makeNewItem( controls()->GetCursorPosition() );
180  }
181  }
182  else if( evt->IsClick( BUT_RIGHT ) )
183  {
185  }
186  else if( evt->IsAction( &PCB_ACTIONS::trackViaSizeChanged ) )
187  {
189  }
190  else if( newItem && evt->Category() == TC_COMMAND )
191  {
192  /*
193  * Handle any events that can affect the item as we move it around
194  */
195  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
196  {
197  const int rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *frame(), *evt );
198  newItem->Rotate( newItem->GetPosition(), rotationAngle );
199  view()->Update( &preview );
200  }
201  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
202  {
203  newItem->Flip( newItem->GetPosition(), frame()->Settings().m_FlipLeftRight );
204  view()->Update( &preview );
205  }
206  else if( evt->IsAction( &PCB_ACTIONS::viaSizeInc )
207  || evt->IsAction( &PCB_ACTIONS::viaSizeDec ) )
208  {
209  // Refresh preview after event runs
211  }
212  else if( evt->IsAction( &ACTIONS::refreshPreview ) )
213  {
214  preview.Clear();
215  newItem.release();
216 
217  makeNewItem( (wxPoint) cursorPos );
218  aPlacer->SnapItem( newItem.get() );
219  view()->Update( &preview );
220  }
221  }
222 
223  else if( newItem && evt->IsMotion() )
224  {
225  // track the cursor
226  newItem->SetPosition( (wxPoint) cursorPos );
227  aPlacer->SnapItem( newItem.get() );
228 
229  // Show a preview of the item
230  view()->Update( &preview );
231  }
232 
233  else
234  evt->SetPassEvent();
235  }
236 
237  view()->Remove( &preview );
238 }
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:95
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:93
static TOOL_ACTION viaSizeInc
Definition: pcb_actions.h:284
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.
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:287
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:76
virtual void Add(EDA_ITEM *aItem)
Definition: selection.h:76
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:105
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:59
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:285
static TOOL_ACTION refreshPreview
Definition: actions.h:104
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(), PCB_BASE_FRAME::Settings(), TOOL_MENU::ShowContextMenu(), KIGFX::VIEW_CONTROLS::ShowCursor(), INTERACTIVE_PLACER_BASE::SnapItem(), TC_COMMAND, PCB_ACTIONS::trackViaSizeChanged, KIGFX::PCB_VIEW::Update(), PCB_ACTIONS::viaSizeDec, PCB_ACTIONS::viaSizeInc, PCB_TOOL_BASE::view(), and TOOL_INTERACTIVE::Wait().

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

◆ EditingModules()

bool PCB_TOOL_BASE::EditingModules ( ) const
inlineinherited

◆ FlipPcbView()

int PCB_INSPECTION_TOOL::FlipPcbView ( const TOOL_EVENT aEvent)

◆ 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(), PNS::TOOL_BASE::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::EditPad(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), 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(), PCBNEW_PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MoveExact(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::onViaCommand(), PCBNEW_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), PCB_EDITOR_CONTROL::PlaceModule(), PCB_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), PAD_TOOL::recombinePad(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), POINT_EDITOR::removeCorner(), PNS::TOOL_BASE::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(), 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:159

References TOOL_BASE::getModelInt().

Referenced by ZONE_CREATE_HELPER::commitZone(), 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:289
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(), SCH_EDIT_TOOL::ChangeTextType(), EE_INSPECTION_TOOL::checkPart(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), 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(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), MICROWAVE_TOOL::drawMicrowaveInductor(), PL_DRAWING_TOOLS::DrawShape(), PCB_EDITOR_CONTROL::DrillOrigin(), LIB_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindComponentAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCBNEW_CONTROL::GridResetOrigin(), PCBNEW_CONTROL::GridSetOrigin(), SELECTION_TOOL::GuessSelectionCandidates(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), 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(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PNS::TOOL_BASE::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(), PNS::TOOL_BASE::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(), SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectAll(), 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(), 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(), EE_POINT_EDITOR::updateItem(), PL_POINT_EDITOR::updateItem(), POINT_EDITOR::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), POINT_EDITOR::updatePoints(), SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateView(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), 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:291

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

Referenced by EE_POINT_EDITOR::addCorner(), POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), 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(), HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), 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(), PCB_VIEWER_TOOLS::MeasureTool(), GERBVIEW_SELECTION_TOOL::MeasureTool(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), 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(), POINT_EDITOR::updateItem(), 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(), PCB_REANNOTATE_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), LIB_PIN_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), COMMON_CONTROL::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), LIB_MOVE_TOOL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), CONVERT_TOOL::setTransitions(), DRC_TOOL::setTransitions(), POINT_EDITOR::setTransitions(), LIB_DRAWING_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), SCH_MOVE_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), LIB_CONTROL::setTransitions(), LIB_EDIT_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), PAD_TOOL::setTransitions(), FOOTPRINT_EDITOR_TOOLS::setTransitions(), SCH_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), PCBNEW_CONTROL::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), 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(), SCH_EDITOR_CONTROL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ HideDynamicRatsnest()

int PCB_INSPECTION_TOOL::HideDynamicRatsnest ( const TOOL_EVENT aEvent)

Hides ratsnest for selected items. Called when there are no items selected.

Definition at line 799 of file pcb_inspection_tool.cpp.

800 {
801  getModel<BOARD>()->GetConnectivity()->ClearDynamicRatsnest();
802  delete m_dynamicData;
803  m_dynamicData = nullptr;
804 
805  return 0;
806 }
CONNECTIVITY_DATA * m_dynamicData

References m_dynamicData.

Referenced by setTransitions().

◆ HideNet()

int PCB_INSPECTION_TOOL::HideNet ( const TOOL_EVENT aEvent)

Hide the ratsnest for a given net

Definition at line 920 of file pcb_inspection_tool.cpp.

921 {
922  doHideNet( aEvent.Parameter<intptr_t>(), true );
923  return 0;
924 }
void doHideNet(int aNetCode, bool aHide)
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435

References doHideNet(), and TOOL_EVENT::Parameter().

Referenced by setTransitions().

◆ HighlightItem()

int PCB_INSPECTION_TOOL::HighlightItem ( const TOOL_EVENT aEvent)

Performs the appropriate action in response to an eeschema cross-probe.

Definition at line 478 of file pcb_inspection_tool.cpp.

479 {
480  BOARD_ITEM* item = aEvent.Parameter<BOARD_ITEM*>();
481 
482  m_probingSchToPcb = true; // recursion guard
483  {
485 
486  if( item )
487  m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, (void*) item );
488  }
489  m_probingSchToPcb = false;
490 
491  return 0;
492 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:62
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
static TOOL_ACTION selectItem
Selects an item (specified as the event parameter).
Definition: pcb_actions.h:65

References m_probingSchToPcb, TOOL_BASE::m_toolMgr, TOOL_EVENT::Parameter(), TOOL_MANAGER::RunAction(), PCB_ACTIONS::selectionClear, and PCB_ACTIONS::selectItem.

Referenced by setTransitions().

◆ HighlightNet()

int PCB_INSPECTION_TOOL::HighlightNet ( const TOOL_EVENT aEvent)

Highlights net belonging to the item under the cursor.

Definition at line 609 of file pcb_inspection_tool.cpp.

610 {
611  int netcode = aEvent.Parameter<intptr_t>();
613  const std::set<int>& highlighted = settings->GetHighlightNetCodes();
614 
615  if( netcode > 0 )
616  {
617  m_lastNetcode = highlighted.empty() ? -1 : *highlighted.begin();
618  settings->SetHighlight( true, netcode );
620  }
621  else if( aEvent.IsAction( &PCB_ACTIONS::toggleLastNetHighlight ) )
622  {
623  int temp = highlighted.empty() ? -1 : *highlighted.begin();
624  settings->SetHighlight( true, m_lastNetcode );
626  m_lastNetcode = temp;
627  }
628  else // Highlight the net belonging to the item under the cursor
629  {
630  highlightNet( getViewControls()->GetMousePosition(), false );
631  }
632 
633  return 0;
634 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:289
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
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 toggleLastNetHighlight
Definition: pcb_actions.h:433
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
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
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
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.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
void UpdateAllLayersColor()
Function UpdateAllLayersColor() Applies the new coloring scheme to all layers.
Definition: view.cpp:794

References KIGFX::RENDER_SETTINGS::GetHighlightNetCodes(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), TOOL_MANAGER::GetView(), TOOL_BASE::getViewControls(), highlightNet(), TOOL_EVENT::IsAction(), m_lastNetcode, TOOL_BASE::m_toolMgr, TOOL_EVENT::Parameter(), PCB_ACTIONS::toggleLastNetHighlight, and KIGFX::VIEW::UpdateAllLayersColor().

Referenced by setTransitions().

◆ highlightNet()

bool PCB_INSPECTION_TOOL::highlightNet ( const VECTOR2D aPosition,
bool  aUseSelection 
)
private

Look for a BOARD_CONNECTED_ITEM in a given spot and if one is found - it enables highlight for its net.

Parameters
aPositionis the point where an item is expected (world coordinates).
aUseSelectionis true if we should use the current selection to pick the netcode

Definition at line 502 of file pcb_inspection_tool.cpp.

503 {
504  BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
506 
507  int net = -1;
508  bool enableHighlight = false;
509 
510  if( aUseSelection )
511  {
512  SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
513 
514  const PCBNEW_SELECTION& selection = selectionTool->GetSelection();
515 
516  for( auto item : selection )
517  {
518  if( auto ci = dyn_cast<BOARD_CONNECTED_ITEM*>( item ) )
519  {
520  int item_net = ci->GetNetCode();
521 
522  if( net < 0 )
523  net = item_net;
524  else if( net != item_net ) // more than one net selected: do nothing
525  return false;
526  }
527  }
528 
529  enableHighlight = ( net >= 0 && !settings->GetHighlightNetCodes().count( net ) );
530  }
531 
532  // If we didn't get a net to highlight from the selection, use the cursor
533  if( net < 0 )
534  {
535  auto guide = m_frame->GetCollectorsGuide();
536  GENERAL_COLLECTOR collector;
537 
538  // Find a connected item for which we are going to highlight a net
539  collector.Collect( board, GENERAL_COLLECTOR::PadsOrTracks, (wxPoint) aPosition, guide );
540 
541  if( collector.GetCount() == 0 )
542  collector.Collect( board, GENERAL_COLLECTOR::Zones, (wxPoint) aPosition, guide );
543 
544  // Clear the previous highlight
545  m_frame->SendMessageToEESCHEMA( nullptr );
546 
547  for( int i = 0; i < collector.GetCount(); i++ )
548  {
549  if( ( collector[i]->GetLayerSet() & LSET::AllCuMask() ).none() )
550  collector.Remove( i );
551 
552  if( collector[i]->Type() == PCB_PAD_T )
553  {
554  m_frame->SendMessageToEESCHEMA( static_cast<BOARD_CONNECTED_ITEM*>( collector[i] ) );
555  break;
556  }
557  }
558 
559  enableHighlight = ( collector.GetCount() > 0 );
560 
561  // Obtain net code for the clicked item
562  if( enableHighlight )
563  net = static_cast<BOARD_CONNECTED_ITEM*>( collector[0] )->GetNetCode();
564  }
565 
566  auto& netcodes = settings->GetHighlightNetCodes();
567 
568  // Toggle highlight when the same net was picked
569  if( net > 0 && netcodes.count( net ) )
570  enableHighlight = !settings->IsHighlightEnabled();
571 
572  if( enableHighlight != settings->IsHighlightEnabled()
573  || !netcodes.count( net ) )
574  {
575  if( !netcodes.empty() )
576  m_lastNetcode = *netcodes.begin();
577 
578  settings->SetHighlight( enableHighlight, net );
580  }
581 
582  // Store the highlighted netcode in the current board (for dialogs for instance)
583  if( enableHighlight && net >= 0 )
584  {
585  board->SetHighLightNet( net );
586  board->HighLightON();
587 
588  NETINFO_ITEM* netinfo = board->FindNet( net );
589 
590  if( netinfo )
591  {
592  MSG_PANEL_ITEMS items;
593  netinfo->GetMsgPanelInfo( m_frame, items );
594  m_frame->SetMsgPanel( items );
596  }
597  }
598  else
599  {
603  }
604 
605  return true;
606 }
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:719
NETINFO_ITEM * FindNet(int aNetcode) const
Function FindNet searches for a net with the given netcode.
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:289
void SendCrossProbeNetName(const wxString &aNetName)
Sends a net name to eeschema for highlighting.
BOARD * board() const
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
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:580
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
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
EDA_ITEM * GetModel() const
Definition: tool_manager.h:296
void Remove(int aIndex)
Function Remove removes the item at aIndex (first position is 0);.
Definition: collector.h:130
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:199
PCBNEW_SELECTION & GetSelection()
Function GetSelection()
int GetCount() const
Function GetCount returns the number of objects in the list.
Definition: collector.h:101
PCB_EDIT_FRAME * m_frame
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
Function GetCollectorsGuide.
void ResetNetHighLight()
Function ResetNetHighLight Reset all high light data to the init state.
const PCBNEW_SELECTION & selection() const
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
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
void SetHighLightNet(int aNetCode, bool aMulti=false)
Function SetHighLightNet Select the netcode to be highlighted.
KIGFX::VIEW * getView() const
Function getView()
Definition: tool_base.cpp:36
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.
NETINFO_ITEM handles the data for a net.
Definition: netinfo.h:65
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:178
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:240
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:102
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:794

References LSET::AllCuMask(), PCB_TOOL_BASE::board(), GENERAL_COLLECTOR::Collect(), BOARD::FindNet(), PCB_BASE_FRAME::GetCollectorsGuide(), COLLECTOR::GetCount(), TOOL_MANAGER::GetModel(), NETINFO_ITEM::GetMsgPanelInfo(), NETINFO_ITEM::GetNetname(), KIGFX::VIEW::GetPainter(), SELECTION_TOOL::GetSelection(), KIGFX::PAINTER::GetSettings(), TOOL_MANAGER::GetTool(), TOOL_BASE::getView(), TOOL_MANAGER::GetView(), BOARD::HighLightON(), m_frame, m_lastNetcode, TOOL_BASE::m_toolMgr, GENERAL_COLLECTOR::PadsOrTracks, PCB_PAD_T, COLLECTOR::Remove(), BOARD::ResetNetHighLight(), PCB_TOOL_BASE::selection(), PCB_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), BOARD::SetHighLightNet(), EDA_DRAW_FRAME::SetMsgPanel(), KIGFX::VIEW::UpdateAllLayersColor(), and GENERAL_COLLECTOR::Zones.

Referenced by HighlightNet(), and HighlightNetTool().

◆ HighlightNetTool()

int PCB_INSPECTION_TOOL::HighlightNetTool ( const TOOL_EVENT aEvent)

Launches a tool to pick the item whose net is going to be highlighted.

Definition at line 651 of file pcb_inspection_tool.cpp.

652 {
653  std::string tool = aEvent.GetCommandStr().get();
655 
656  // Deactivate other tools; particularly important if another PICKER is currently running
657  Activate();
658 
659  // If the keyboard hotkey was triggered and we are already in the highlight tool, behave
660  // the same as a left-click. Otherwise highlight the net of the selected item(s), or if
661  // there is no selection, then behave like a ctrl-left-click.
663  {
664  bool use_selection = m_frame->IsCurrentTool( PCB_ACTIONS::highlightNetTool );
665  highlightNet( getViewControls()->GetMousePosition(), use_selection );
666  }
667 
668  picker->SetClickHandler(
669  [this] ( const VECTOR2D& pt ) -> bool
670  {
671  highlightNet( pt, false );
672  return true;
673  } );
674 
675  picker->SetLayerSet( LSET::AllCuMask() );
676 
677  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
678 
679  return 0;
680 }
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:719
bool IsCurrentTool(const TOOL_ACTION &aAction) const
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
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...
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
static TOOL_ACTION pickerTool
Definition: actions.h:151
static TOOL_ACTION highlightNetTool
Definition: pcb_actions.h:434
PCB_EDIT_FRAME * m_frame
Generic tool for picking a point.
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
static TOOL_ACTION highlightNetSelection
Definition: pcb_actions.h:435
void SetLayerSet(LSET aLayerSet)
Function SetLayerSet() Sets the tool's snap layer set.
void Activate()
Function Activate() Runs the tool.
KIGFX::VIEW_CONTROLS * getViewControls() const
Function getViewControls()
Definition: tool_base.cpp:42
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.

References TOOL_INTERACTIVE::Activate(), LSET::AllCuMask(), TOOL_EVENT::GetCommandStr(), TOOL_MANAGER::GetTool(), TOOL_BASE::getViewControls(), highlightNet(), PCB_ACTIONS::highlightNetSelection, PCB_ACTIONS::highlightNetTool, TOOL_EVENT::IsAction(), TOOLS_HOLDER::IsCurrentTool(), m_frame, TOOL_BASE::m_toolMgr, ACTIONS::pickerTool, TOOL_MANAGER::RunAction(), PCBNEW_PICKER_TOOL::SetClickHandler(), and PCBNEW_PICKER_TOOL::SetLayerSet().

Referenced by setTransitions().

◆ Init()

bool PCB_INSPECTION_TOOL::Init ( void  )
overridevirtual

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

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

Reimplemented from PCB_TOOL_BASE.

Definition at line 71 of file pcb_inspection_tool.cpp.

72 {
73  SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
74 
75  auto netSubMenu = std::make_shared<NET_CONTEXT_MENU>();
76  netSubMenu->SetTool( this );
77 
78  static KICAD_T connectedTypes[] = { PCB_TRACE_T, PCB_VIA_T, PCB_ARC_T, PCB_PAD_T,
80 
81  CONDITIONAL_MENU& menu = selectionTool->GetToolMenu().GetMenu();
82 
83  selectionTool->GetToolMenu().AddSubMenu( netSubMenu );
84 
85  menu.AddMenu( netSubMenu.get(), SELECTION_CONDITIONS::OnlyTypes( connectedTypes ), 200 );
87 
88  return true;
89 }
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Adds a submenu to the menu.
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Creates a functor that tests if the selected items are only of given types.
SELECTION_TOOL.
CONDITIONAL_MENU & GetMenu()
Function GetMenu.
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:106
TOOL_MENU & GetToolMenu()
class ARC, an arc track segment on a copper layer
Definition: typeinfo.h:98
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
static SELECTION_CONDITION Count(int aNumber)
Creates a functor that tests if the number of selected items is equal to the value given as parameter...
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
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
static TOOL_ACTION inspectClearance
Definition: pcb_actions.h:426
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Function CreateSubMenu.
Definition: tool_menu.cpp:52
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Adds a menu entry to run a TOOL_ACTION on selected items.

References CONDITIONAL_MENU::AddItem(), CONDITIONAL_MENU::AddMenu(), TOOL_MENU::AddSubMenu(), SELECTION_CONDITIONS::Count(), EOT, TOOL_MENU::GetMenu(), TOOL_MANAGER::GetTool(), TOOL_INTERACTIVE::GetToolMenu(), PCB_ACTIONS::inspectClearance, TOOL_BASE::m_toolMgr, SELECTION_CONDITIONS::OnlyTypes(), PCB_ARC_T, PCB_PAD_T, PCB_TRACE_T, PCB_VIA_T, and PCB_ZONE_AREA_T.

◆ InspectClearance()

int PCB_INSPECTION_TOOL::InspectClearance ( const TOOL_EVENT aEvent)

Show the clearance resolution for two selected items

Definition at line 216 of file pcb_inspection_tool.cpp.

217 {
219  const PCBNEW_SELECTION& selection = selTool->GetSelection();
221 
222  if( selection.Size() != 2 )
223  {
224  m_frame->ShowInfoBarError( _( "Select two items for a clearance resolution report." ) );
225  return 0;
226  }
227 
228  if( m_inspectClearanceDialog == nullptr )
229  {
230  m_inspectClearanceDialog = std::make_unique<DIALOG_HTML_REPORTER>( m_frame );
231  m_inspectClearanceDialog->SetTitle( _( "Clearance Report" ) );
232 
233  m_inspectClearanceDialog->Connect( wxEVT_CLOSE_WINDOW,
235  nullptr, this );
236  }
237 
239  r->SetUnits( m_frame->GetUserUnits() );
240  r->Clear();
241 
242  BOARD_ITEM* a = static_cast<BOARD_ITEM*>( selection.GetItem( 0 ) );
243  BOARD_ITEM* b = static_cast<BOARD_ITEM*>( selection.GetItem( 1 ) );
244 
245  if( a->Type() != PCB_ZONE_AREA_T && b->Type() == PCB_ZONE_AREA_T )
246  std::swap( a, b );
247  else if( !a->IsConnected() && b->IsConnected() )
248  std::swap( a, b );
249 
250  if( !IsCopperLayer( layer ) )
251  {
252  r->Report( wxString::Format( _( "Active layer (%s) is not a copper layer. "
253  "No clearance defined." ),
254  m_frame->GetBoard()->GetLayerName( layer ) ) );
255  }
256  else if( !a->GetLayerSet().test( layer ) )
257  {
258  r->Report( wxString::Format( _( "%s not present on layer %s. No clearance defined." ),
259  a->GetSelectMenuText( r->GetUnits() ),
260  m_frame->GetBoard()->GetLayerName( layer ) ) );
261  }
262  else if( !b->GetLayerSet().test( layer ) )
263  {
264  r->Report( wxString::Format( _( "%s not present on layer %s. No clearance defined." ),
265  b->GetSelectMenuText( r->GetUnits() ),
266  m_frame->GetBoard()->GetLayerName( layer ) ) );
267  }
268  else if( !a->IsConnected() )
269  {
270  r->Report( _( "Items have no electrical connections. No clearance defined." ) );
271  }
272  else
273  {
274  r->Report( _( "<h7>Clearance resolution for:</h7>" ) );
275 
276  r->Report( wxString::Format( _( "<ul><li>Layer %s</li><li>%s</li><li>%s</li></ul>" ),
277  m_frame->GetBoard()->GetLayerName( layer ),
278  a->GetSelectMenuText( r->GetUnits() ),
279  b->GetSelectMenuText( r->GetUnits() ) ) );
280 
281  BOARD_CONNECTED_ITEM* ac = dynamic_cast<BOARD_CONNECTED_ITEM*>( a );
282  BOARD_CONNECTED_ITEM* bc = dynamic_cast<BOARD_CONNECTED_ITEM*>( b );
283 
284  if( ac && bc && ac->GetNetCode() > 0 && ac->GetNetCode() == bc->GetNetCode() )
285  {
286  // Same nets....
287 
288  if( ac->Type() == PCB_ZONE_AREA_T && bc->Type() == PCB_PAD_T )
289  {
290  reportZoneConnection( static_cast<ZONE_CONTAINER*>( ac ),
291  static_cast<D_PAD*>( bc ), r );
292  }
293  else
294  {
295  r->Report( _( "Items belong to the same net. Clearance is 0." ) );
296  }
297  }
298  else if( ac )
299  {
300  // Different nets (or second unconnected)....
301  reportCopperClearance( layer, ac, b, r );
302  }
303  }
304 
305  r->Flush();
306 
307  m_inspectClearanceDialog->Show( true );
308  return 0;
309 }
void SetUnits(EDA_UNITS aUnits)
int GetNetCode() const
Function GetNetCode.
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Function GetLayerName returns the name of a layer.
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
WX_HTML_REPORT_BOX.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Function Report is a pure virtual function to override in the derived object.
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
class ZONE_CONTAINER, a zone area
Definition: typeinfo.h:106
void reportCopperClearance(PCB_LAYER_ID aLayer, BOARD_CONNECTED_ITEM *aA, BOARD_ITEM *aB, REPORTER *r)
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
void reportZoneConnection(ZONE_CONTAINER *aZone, D_PAD *aPad, REPORTER *r)
BOARD_CONNECTED_ITEM is a base class derived from BOARD_ITEM for items that can be connected and have...
PCBNEW_SELECTION & GetSelection()
Function GetSelection()
virtual PCB_LAYER_ID GetActiveLayer() const
PCB_EDIT_FRAME * m_frame
PCB_LAYER_ID
A quick note on layer IDs:
const PCBNEW_SELECTION & selection() const
void ShowInfoBarError(const wxString &aErrorMsg)
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.h:105
std::unique_ptr< DIALOG_HTML_REPORTER > m_inspectClearanceDialog
EDA_UNITS GetUnits() const override
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201
#define _(s)
Definition: 3d_actions.cpp:33
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
int Size() const
Returns the number of selected parts.
Definition: selection.h:127
bool IsCopperLayer(LAYER_NUM aLayerId)
Function IsCopperLayer tests whether a layer is a copper layer.
virtual bool IsConnected() const
Function IsConnected() Returns information if the object is derived from BOARD_CONNECTED_ITEM.
void onInspectClearanceDialogClosed(wxCommandEvent &aEvent)
BOARD * GetBoard() const
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
virtual LSET GetLayerSet() const
Function GetLayerSet returns a std::bitset of all layers on which the item physically resides.
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References _, WX_HTML_REPORT_BOX::Clear(), WX_HTML_REPORT_BOX::Flush(), Format(), PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetBoard(), SELECTION::GetItem(), BOARD::GetLayerName(), BOARD_ITEM::GetLayerSet(), BOARD_CONNECTED_ITEM::GetNetCode(), SELECTION_TOOL::GetSelection(), EDA_ITEM::GetSelectMenuText(), TOOL_MANAGER::GetTool(), WX_HTML_REPORT_BOX::GetUnits(), EDA_BASE_FRAME::GetUserUnits(), BOARD_ITEM::IsConnected(), IsCopperLayer(), m_frame, m_inspectClearanceDialog, TOOL_BASE::m_toolMgr, onInspectClearanceDialogClosed(), PCB_PAD_T, PCB_ZONE_AREA_T, WX_HTML_REPORT_BOX::Report(), reportCopperClearance(), reportZoneConnection(), PCB_TOOL_BASE::selection(), WX_HTML_REPORT_BOX::SetUnits(), EDA_BASE_FRAME::ShowInfoBarError(), SELECTION::Size(), and EDA_ITEM::Type().

Referenced by setTransitions().

◆ InspectConstraints()

int PCB_INSPECTION_TOOL::InspectConstraints ( const TOOL_EVENT aEvent)

Definition at line 312 of file pcb_inspection_tool.cpp.

313 {
315  const PCBNEW_SELECTION& selection = selTool->GetSelection();
316 
317  if( selection.Size() != 1 )
318  {
319  m_frame->ShowInfoBarError( _( "Select an item for a constraints resolution report." ) );
320  return 0;
321  }
322 
323  if( m_inspectConstraintsDialog == nullptr )
324  {
325  m_inspectConstraintsDialog = std::make_unique<DIALOG_CONSTRAINTS_REPORTER>( m_frame );
326  m_inspectConstraintsDialog->SetTitle( _( "Constraints Report" ) );
327 
328  m_inspectConstraintsDialog->Connect( wxEVT_CLOSE_WINDOW,
330  nullptr, this );
331  }
332 
333  m_inspectConstraintsDialog->DeleteAllPages();
334 
335  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.GetItem( 0 ) );
337 
338  try
339  {
340  drcEngine.InitEngine( m_frame->Prj().AbsolutePath( "drc-rules" ) );
341  }
342  catch( PARSE_ERROR& pe )
343  {
344  m_frame->ShowBoardSetupDialog( _( "Rules" ), pe.What(), ID_RULES_EDITOR,
345  pe.lineNumber, pe.byteIndex );
346  return 1;
347  }
348 
349  if( item->Type() == PCB_TRACE_T )
350  {
351  WX_HTML_REPORT_BOX* r = m_inspectConstraintsDialog->AddPage( "Track Width" );
352 
353  r->Report( _( "<h7>Track width resolution for:</h7>" ) );
354  r->Report( wxString::Format( _( "<ul><li>%s</li></ul>" ),
355  item->GetSelectMenuText( r->GetUnits() ) ) );
356  r->Report( "" );
357 
358  auto constraint = drcEngine.EvalRulesForItems( DRC_CONSTRAINT_TYPE_TRACK_WIDTH, item,
359  nullptr, UNDEFINED_LAYER, r );
360 
361  wxString min = _( "undefined" );
362  wxString max = _( "undefined" );
363 
364  if( constraint.m_Value.HasMin() )
365  min = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true );
366 
367  if( constraint.m_Value.HasMax() )
368  max = StringFromValue( r->GetUnits(), constraint.m_Value.Max(), true );
369 
370  r->Report( "" );
371  r->Report( wxString::Format( _( "Width constraints: min %s max %s." ),
372  min,
373  max ) );
374  r->Flush();
375  }
376 
377  if( item->Type() == PCB_VIA_T )
378  {
379  WX_HTML_REPORT_BOX* r = m_inspectConstraintsDialog->AddPage( "Via Diameter" );
380 
381  r->Report( _( "<h7>Via diameter resolution for:</h7>" ) );
382  r->Report( wxString::Format( _( "<ul><li>%s</li></ul>" ),
383  item->GetSelectMenuText( r->GetUnits() ) ) );
384  r->Report( "" );
385 
386  auto constraint = drcEngine.EvalRulesForItems( DRC_CONSTRAINT_TYPE_VIA_DIAMETER, item,
387  nullptr, UNDEFINED_LAYER, r );
388 
389  wxString min = _( "undefined" );
390  wxString max = _( "undefined" );
391 
392  if( constraint.m_Value.HasMin() )
393  min = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true );
394 
395  if( constraint.m_Value.HasMax() )
396  max = StringFromValue( r->GetUnits(), constraint.m_Value.Max(), true );
397 
398  r->Report( "" );
399  r->Report( wxString::Format( _( "Diameter constraints: min %s max %s." ),
400  min,
401  max ) );
402  r->Flush();
403 
404 
405  r = m_inspectConstraintsDialog->AddPage( "Via Annular Width" );
406 
407  r->Report( _( "<h7>Via annular width resolution for:</h7>" ) );
408  r->Report( wxString::Format( _( "<ul><li>%s</li></ul>" ),
409  item->GetSelectMenuText( r->GetUnits() ) ) );
410  r->Report( "" );
411 
412  constraint = drcEngine.EvalRulesForItems( DRC_CONSTRAINT_TYPE_ANNULUS_WIDTH, item,
413  nullptr, UNDEFINED_LAYER, r );
414 
415  min = _( "undefined" );
416  max = _( "undefined" );
417 
418  if( constraint.m_Value.HasMin() )
419  min = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true );
420 
421  if( constraint.m_Value.HasMax() )
422  max = StringFromValue( r->GetUnits(), constraint.m_Value.Max(), true );
423 
424  r->Report( "" );
425  r->Report( wxString::Format( _( "Annular width constraints: min %s max %s." ),
426  min,
427  max ) );
428  r->Flush();
429  }
430 
431  if( ( item->Type() == PCB_PAD_T && static_cast<D_PAD*>( item )->GetDrillSize().x > 0 )
432  || item->Type() == PCB_VIA_T )
433  {
434  WX_HTML_REPORT_BOX* r = m_inspectConstraintsDialog->AddPage( "Hole Size" );
435 
436  r->Report( _( "<h7>Hole diameter resolution for:</h7>" ) );
437  r->Report( wxString::Format( _( "<ul><li>%s</li></ul>" ),
438  item->GetSelectMenuText( r->GetUnits() ) ) );
439  r->Report( "" );
440 
441  auto constraint = drcEngine.EvalRulesForItems( DRC_CONSTRAINT_TYPE_HOLE_SIZE, item,
442  nullptr, UNDEFINED_LAYER, r );
443 
444  wxString min = _( "undefined" );
445 
446  if( constraint.m_Value.HasMin() )
447  min = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true );
448 
449  r->Report( "" );
450  r->Report( wxString::Format( _( "Hole constraint: min %s." ), min ) );
451  r->Flush();
452  }
453 
454  m_inspectConstraintsDialog->FinishInitialization();
455  m_inspectConstraintsDialog->Show( true );
456  return 0;
457 }
Design Rule Checker object that performs all the DRC tests.
Definition: drc_engine.h:81
BOARD_ITEM is a base class for any item which can be embedded within the BOARD container class,...
WX_HTML_REPORT_BOX.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Function Report is a pure virtual function to override in the derived object.
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
void onInspectConstraintsDialogClosed(wxCommandEvent &aEvent)
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:537
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
class TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:96
VTBL_ENTRY const wxString AbsolutePath(const wxString &aFileName) const
Function AbsolutePath fixes up aFileName if it is relative to the project's directory to be an absolu...
Definition: project.cpp:272
PCBNEW_SELECTION & GetSelection()
Function GetSelection()
PCB_EDIT_FRAME * m_frame
const PCBNEW_SELECTION & selection() const
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
int lineNumber
at which line number, 1 based index.
Definition: ki_exception.h:125
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
void ShowInfoBarError(const wxString &aErrorMsg)
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.h:105
EDA_UNITS GetUnits() const override
Struct PARSE_ERROR contains a filename or source description, a problem input line,...
Definition: ki_exception.h:123
std::unique_ptr< DIALOG_CONSTRAINTS_REPORTER > m_inspectConstraintsDialog
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201
#define ID_RULES_EDITOR
#define _(s)
Definition: 3d_actions.cpp:33
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Function GetSelectMenuText returns the text to display to be used in the selection clarification cont...
int Size() const
Returns the number of selected parts.
Definition: selection.h:127
int byteIndex
at which byte offset within the line, 1 based index
Definition: ki_exception.h:126
class VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:97
BOARD * GetBoard() const
void ShowBoardSetupDialog(const wxString &aInitialPage=wxEmptyString, const wxString &aErrorMsg=wxEmptyString, int aErrorCtrlId=-1, int aErrorLine=-1, int aErrorCol=-1)
Function ShowBoardSetupDialog.
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils, EDA_DATA_TYPE aType)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:233
void InitEngine(const wxFileName &aRulePath)
Initializes the DRC engine.
Definition: drc_engine.cpp:367
KICAD_T Type() const
Function Type()
Definition: base_struct.h:193

References _, PROJECT::AbsolutePath(), PARSE_ERROR::byteIndex, DRC_CONSTRAINT_TYPE_ANNULUS_WIDTH, DRC_CONSTRAINT_TYPE_HOLE_SIZE, DRC_CONSTRAINT_TYPE_TRACK_WIDTH, DRC_CONSTRAINT_TYPE_VIA_DIAMETER, WX_HTML_REPORT_BOX::Flush(), Format(), PCB_BASE_FRAME::GetBoard(), BOARD::GetDesignSettings(), SELECTION::GetItem(), SELECTION_TOOL::GetSelection(), EDA_ITEM::GetSelectMenuText(), TOOL_MANAGER::GetTool(), WX_HTML_REPORT_BOX::GetUnits(), ID_RULES_EDITOR, DRC_ENGINE::InitEngine(), PARSE_ERROR::lineNumber, m_frame, m_inspectConstraintsDialog, TOOL_BASE::m_toolMgr, onInspectConstraintsDialogClosed(), PCB_PAD_T, PCB_TRACE_T, PCB_VIA_T, KIWAY_HOLDER::Prj(), WX_HTML_REPORT_BOX::Report(), PCB_TOOL_BASE::selection(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), EDA_BASE_FRAME::ShowInfoBarError(), SELECTION::Size(), StringFromValue(), EDA_ITEM::Type(), UNDEFINED_LAYER, and IO_ERROR::What().

Referenced by setTransitions().

◆ 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.

Referenced by EDIT_TOOL::isRouterActive(), and ROUTER_TOOL::onViaCommand().

◆ ListNets()

int PCB_INSPECTION_TOOL::ListNets ( const TOOL_EVENT aEvent)

Definition at line 864 of file pcb_inspection_tool.cpp.

865 {
866  if( m_listNetsDialog == nullptr )
867  {
869  std::make_unique<DIALOG_SELECT_NET_FROM_LIST>( m_frame, m_listNetsDialogSettings );
870 
871  m_listNetsDialog->Connect( wxEVT_CLOSE_WINDOW,
872  wxCommandEventHandler( PCB_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr,
873  this );
874 
875  m_listNetsDialog->Connect( wxEVT_BUTTON,
876  wxCommandEventHandler( PCB_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr,
877  this );
878  }
879 
880  m_listNetsDialog->Show( true );
881  return 0;
882 }
DIALOG_SELECT_NET_FROM_LIST::SETTINGS m_listNetsDialogSettings
std::unique_ptr< DIALOG_SELECT_NET_FROM_LIST > m_listNetsDialog
void onListNetsDialogClosed(wxCommandEvent &aEvent)
PCB_EDIT_FRAME * m_frame

References m_frame, m_listNetsDialog, m_listNetsDialogSettings, and onListNetsDialogClosed().

Referenced by setTransitions().

◆ LocalRatsnestTool()

int PCB_INSPECTION_TOOL::LocalRatsnestTool ( const TOOL_EVENT aEvent)

Shows local ratsnest of a component

Definition at line 683 of file pcb_inspection_tool.cpp.

684 {
685  std::string tool = aEvent.GetCommandStr().get();
687  BOARD* board = getModel<BOARD>();
688  auto& opt = displayOptions();
689 
690  // Deactivate other tools; particularly important if another PICKER is currently running
691  Activate();
692 
693  picker->SetClickHandler(
694  [this, board, opt]( const VECTOR2D& pt ) -> bool
695  {
696  SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
697 
700  PCBNEW_SELECTION& selection = selectionTool->GetSelection();
701 
702  if( selection.Empty() )
703  {
706  selection = selectionTool->GetSelection();
707  }
708 
709  if( selection.Empty() )
710  {
711  // Clear the previous local ratsnest if we click off all items
712  for( MODULE* mod : board->Modules() )
713  {
714  for( D_PAD* pad : mod->Pads() )
715  pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest );
716  }
717  }
718  else
719  {
720  for( auto item : selection )
721  {
722  if( D_PAD* pad = dyn_cast<D_PAD*>(item) )
723  {
724  pad->SetLocalRatsnestVisible( !pad->GetLocalRatsnestVisible() );
725  }
726  else if( MODULE* mod = dyn_cast<MODULE*>(item) )
727  {
728  if( !mod->Pads().empty() )
729  {
730  bool enable = !( *( mod->Pads().begin() ) )->GetLocalRatsnestVisible();
731 
732  for( auto modpad : mod->Pads() )
733  modpad->SetLocalRatsnestVisible( enable );
734  }
735  }
736  }
737  }
738 
740 
741  return true;
742  } );
743 
744  picker->SetFinalizeHandler(
745  [board, opt] ( int aCondition )
746  {
747  if( aCondition != PCBNEW_PICKER_TOOL::END_ACTIVATE )
748  {
749  for( MODULE* mod : board->Modules() )
750  {
751  for( D_PAD* pad : mod->Pads() )
752  pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest );
753  }
754  }
755  } );
756 
757  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
758 
759  return 0;
760 }
static TOOL_ACTION selectionClear
Clears the current selection.
Definition: pcb_actions.h:62
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:289
BOARD * board() const
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Function RunAction() Runs the specified action.
Definition: tool_manager.h:140
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Function SetFinalizeHandler() Sets a handler for the finalize event.
PCBNEW_SELECTION & GetSelection()
Function GetSelection()
static TOOL_ACTION pickerTool
Definition: actions.h:151
Generic tool for picking a point.
const PCBNEW_SELECTION & selection() const
MODULES & Modules()
Definition: class_board.h:249
void MarkTargetDirty(int aTarget)
Function MarkTargetDirty() Sets or clears target 'dirty' flag.
Definition: view.h:574
static void FootprintFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector, SELECTION_TOOL *sTool)
Function FootprintFilter() A selection filter which prunes the selection to contain only items of typ...
Definition: edit_tool.cpp:1526
Items that may change while the view stays the same (noncached)
Definition: definitions.h:50
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:121
const PCB_DISPLAY_OPTIONS & displayOptions() const
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:463
BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:178
static void PadFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector, SELECTION_TOOL *sTool)
Function PadFilter() A selection filter which prunes the selection to contain only items of type PCB_...
Definition: edit_tool.cpp:1514
void Activate()
Function Activate() Runs the tool.
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
Definition: pcb_actions.h:59
void SetClickHandler(CLICK_HANDLER aHandler)
Function SetClickHandler() Sets a handler for mouse click event.

References TOOL_INTERACTIVE::Activate(), PCB_TOOL_BASE::board(), PCB_TOOL_BASE::displayOptions(), SELECTION::Empty(), PCBNEW_PICKER_TOOL::END_ACTIVATE, EDIT_TOOL::FootprintFilter(), TOOL_EVENT::GetCommandStr(), SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), TOOL_MANAGER::GetView(), TOOL_BASE::m_toolMgr, KIGFX::VIEW::MarkTargetDirty(), BOARD::Modules(), EDIT_TOOL::PadFilter(), ACTIONS::pickerTool, TOOL_MANAGER::RunAction(), PCB_TOOL_BASE::selection(), PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectionCursor, PCBNEW_PICKER_TOOL::SetClickHandler(), PCBNEW_PICKER_TOOL::SetFinalizeHandler(), and KIGFX::TARGET_OVERLAY.

Referenced by setTransitions().

◆ module()

◆ onInspectClearanceDialogClosed()

void PCB_INSPECTION_TOOL::onInspectClearanceDialogClosed ( wxCommandEvent &  aEvent)
private

Definition at line 900 of file pcb_inspection_tool.cpp.

901 {
902  m_inspectClearanceDialog->Disconnect( wxEVT_CLOSE_WINDOW,
903  wxCommandEventHandler( PCB_INSPECTION_TOOL::onInspectClearanceDialogClosed ), nullptr, this );
904 
905  m_inspectClearanceDialog->Destroy();
906  m_inspectClearanceDialog.release();
907 }
std::unique_ptr< DIALOG_HTML_REPORTER > m_inspectClearanceDialog
void onInspectClearanceDialogClosed(wxCommandEvent &aEvent)

References m_inspectClearanceDialog.

Referenced by InspectClearance().

◆ onInspectConstraintsDialogClosed()

void PCB_INSPECTION_TOOL::onInspectConstraintsDialogClosed ( wxCommandEvent &  aEvent)
private

Definition at line 910 of file pcb_inspection_tool.cpp.

911 {
912  m_inspectConstraintsDialog->Disconnect( wxEVT_CLOSE_WINDOW,
913  wxCommandEventHandler( PCB_INSPECTION_TOOL::onInspectConstraintsDialogClosed ), nullptr, this );
914 
915  m_inspectConstraintsDialog->Destroy();
916  m_inspectConstraintsDialog.release();
917 }
void onInspectConstraintsDialogClosed(wxCommandEvent &aEvent)
std::unique_ptr< DIALOG_CONSTRAINTS_REPORTER > m_inspectConstraintsDialog

References m_inspectConstraintsDialog.

Referenced by InspectConstraints().

◆ onListNetsDialogClosed()

void PCB_INSPECTION_TOOL::onListNetsDialogClosed ( wxCommandEvent &  aEvent)
private

Definition at line 885 of file pcb_inspection_tool.cpp.

886 {
888 
889  m_listNetsDialog->Disconnect( wxEVT_CLOSE_WINDOW,
890  wxCommandEventHandler( PCB_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr, this );
891 
892  m_listNetsDialog->Disconnect( wxEVT_BUTTON,
893  wxCommandEventHandler( PCB_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr, this );
894 
895  m_listNetsDialog->Destroy();
896  m_listNetsDialog.release();
897 }
DIALOG_SELECT_NET_FROM_LIST::SETTINGS m_listNetsDialogSettings
std::unique_ptr< DIALOG_SELECT_NET_FROM_LIST > m_listNetsDialog
void onListNetsDialogClosed(wxCommandEvent &aEvent)

References m_listNetsDialog, and m_listNetsDialogSettings.

Referenced by ListNets().

◆ ratsnestTimer()

void PCB_INSPECTION_TOOL::ratsnestTimer ( wxTimerEvent &  aEvent)
private

Event handler to recalculate dynamic ratsnest

◆ reportCopperClearance()

void PCB_INSPECTION_TOOL::reportCopperClearance ( PCB_LAYER_ID  aLayer,
BOARD_CONNECTED_ITEM aA,
BOARD_ITEM aB,
REPORTER r 
)
private

Definition at line 185 of file pcb_inspection_tool.cpp.

187 {
188  r->Report( "" );
189 
191 
192  try
193  {
194  drcEngine.InitEngine( m_frame->Prj().AbsolutePath( "drc-rules" ) );
195  }
196  catch( PARSE_ERROR& pe )
197  {
198  m_frame->ShowBoardSetupDialog( _( "Rules" ), pe.What(), ID_RULES_EDITOR,
199  pe.lineNumber, pe.byteIndex );
200  return;
201  }
202 
203  auto constraint = drcEngine.EvalRulesForItems( DRC_CONSTRAINT_TYPE_CLEARANCE, aA, aB,
204  aLayer, r );
205 
206  if( r )
207  {
208  wxString clearance = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true );
209 
210  r->Report( "" );
211  r->Report( wxString::Format( _( "Clearance: %s." ), clearance ) );
212  }
213 }
Design Rule Checker object that performs all the DRC tests.
Definition: drc_engine.h:81
virtual EDA_UNITS GetUnits() const
Definition: reporter.h:121
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:537
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
VTBL_ENTRY const wxString AbsolutePath(const wxString &aFileName) const
Function AbsolutePath fixes up aFileName if it is relative to the project's directory to be an absolu...
Definition: project.cpp:272
PCB_EDIT_FRAME * m_frame
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
int lineNumber
at which line number, 1 based index.
Definition: ki_exception.h:125
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
Struct PARSE_ERROR contains a filename or source description, a problem input line,...
Definition: ki_exception.h:123
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201
#define ID_RULES_EDITOR
#define _(s)
Definition: 3d_actions.cpp:33
int byteIndex
at which byte offset within the line, 1 based index
Definition: ki_exception.h:126
BOARD * GetBoard() const
void ShowBoardSetupDialog(const wxString &aInitialPage=wxEmptyString, const wxString &aErrorMsg=wxEmptyString, int aErrorCtrlId=-1, int aErrorLine=-1, int aErrorCol=-1)
Function ShowBoardSetupDialog.
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils, EDA_DATA_TYPE aType)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:233
void InitEngine(const wxFileName &aRulePath)
Initializes the DRC engine.
Definition: drc_engine.cpp:367

References _, PROJECT::AbsolutePath(), PARSE_ERROR::byteIndex, DRC_CONSTRAINT_TYPE_CLEARANCE, Format(), PCB_BASE_FRAME::GetBoard(), BOARD::GetDesignSettings(), REPORTER::GetUnits(), ID_RULES_EDITOR, DRC_ENGINE::InitEngine(), PARSE_ERROR::lineNumber, m_frame, KIWAY_HOLDER::Prj(), REPORTER::Report(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), StringFromValue(), and IO_ERROR::What().

Referenced by InspectClearance().

◆ reportZoneConnection()

void PCB_INSPECTION_TOOL::reportZoneConnection ( ZONE_CONTAINER aZone,
D_PAD aPad,
REPORTER r 
)
private

Definition at line 106 of file pcb_inspection_tool.cpp.

107 {
109  wxString source;
110  ZONE_CONNECTION connection = aZone->GetPadConnection( aPad, &source );
111 
112  r->Report( "" );
113 
114  r->Report( wxString::Format( _( "Zone connection type: %s." ),
115  connectionEnum.ToString( aZone->GetPadConnection() ) ) );
116 
117  if( source != _( "zone" ) )
118  {
119  r->Report( wxString::Format( _( "Overridden by %s; connection type: %s." ),
120  source,
121  connectionEnum.ToString( connection ) ) );
122  }
123 
124  // Resolve complex connection types into simple types
125  if( connection == ZONE_CONNECTION::THT_THERMAL )
126  {
127  if( aPad->GetAttribute() == PAD_ATTRIB_STANDARD )
128  {
129  connection = ZONE_CONNECTION::THERMAL;
130  }
131  else
132  {
133  connection = ZONE_CONNECTION::FULL;
134  r->Report( wxString::Format( _( "Pad is not a PTH pad; connection will be: %s." ),
135  connectionEnum.ToString( ZONE_CONNECTION::FULL ) ) );
136  }
137  }
138 
139  r->Report( "" );
140 
141  // Process simple connection types
142  if( connection == ZONE_CONNECTION::THERMAL )
143  {
144  int gap = aZone->GetThermalReliefGap();
145 
146  r->Report( wxString::Format( _( "Zone thermal relief: %s." ),
147  StringFromValue( r->GetUnits(), gap, true ) ) );
148 
149  gap = aZone->GetThermalReliefGap( aPad, &source );
150 
151  if( source != _( "zone" ) )
152  {
153  r->Report( wxString::Format( _( "Overridden by %s; thermal relief: %s." ),
154  source,
155  StringFromValue( r->GetUnits(), gap, true ) ) );
156  }
157  }
158  else if( connection == ZONE_CONNECTION::NONE )
159  {
160  int clearance = aZone->GetLocalClearance();
161 
162  r->Report( wxString::Format( _( "Zone clearance: %s." ),
163  StringFromValue( r->GetUnits(), clearance, true ) ) );
164 
165  if( aZone->GetThermalReliefGap( aPad ) > clearance )
166  {
167  clearance = aZone->GetThermalReliefGap( aPad, &source );
168 
169  if( source != _( "zone" ) )
170  {
171  r->Report( wxString::Format( _( "Overridden by larger thermal relief from %s;"
172  "clearance: %s." ),
173  source,
174  StringFromValue( r->GetUnits(), clearance, true ) ) );
175  }
176  }
177  }
178  else
179  {
180  r->Report( _( "Clearance is 0." ) );
181  }
182 }
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition: zones.h:41
virtual EDA_UNITS GetUnits() const
Definition: reporter.h:121
static ENUM_MAP< T > & Instance()
Definition: property.h:517
int GetLocalClearance(wxString *aSource) const override
Function GetLocalClearance returns any local clearances set in the "classic" (ie: pre-rule) system.
Definition: class_zone.cpp:469
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
PAD_ATTR_T GetAttribute() const
Definition: class_pad.h:335
pads are covered by copper
Thermal relief only for THT pads.
int GetThermalReliefGap() const
Definition: class_zone.h:172
Use thermal relief for pads.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:201
#define _(s)
Definition: 3d_actions.cpp:33
Pads are not covered.
ZONE_CONNECTION GetPadConnection(D_PAD *aPad, wxString *aSource=nullptr) const
Definition: class_zone.cpp:765
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, bool aUseMils, EDA_DATA_TYPE aType)
Function StringFromValue returns the string from aValue according to units (inch, mm ....
Definition: base_units.cpp:233
const wxString & ToString(T value) const
Definition: property.h:537

References _, Format(), FULL, D_PAD::GetAttribute(), ZONE_CONTAINER::GetLocalClearance(), ZONE_CONTAINER::GetPadConnection(), ZONE_CONTAINER::GetThermalReliefGap(), REPORTER::GetUnits(), ENUM_MAP< T >::Instance(), NONE, PAD_ATTRIB_STANDARD, REPORTER::Report(), StringFromValue(), THERMAL, THT_THERMAL, and ENUM_MAP< T >::ToString().

Referenced by InspectClearance().

◆ Reset()

void PCB_INSPECTION_TOOL::Reset ( RESET_REASON  aReason)
overridevirtual

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

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

Parameters
aReasoncontains information about the reason of tool reset.

Reimplemented from PCB_TOOL_BASE.

Definition at line 92 of file pcb_inspection_tool.cpp.

93 {
94  m_frame = getEditFrame<PCB_EDIT_FRAME>();
95 }
PCB_EDIT_FRAME * m_frame

References m_frame.

◆ 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 279 of file pcb_tool_base.cpp.

280 {
281  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
282  const auto& selection = selTool->GetSelection();
283  return selection;
284 }
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(), calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), EDIT_TOOL::ChangeTrackWidth(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), EDIT_TOOL::CreateArray(), CrossProbePcbToSch(), doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawZone(), EDIT_TOOL::Duplicate(), PCB_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::filterSelection(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), PCB_EDITOR_CONTROL::GroupEnterSelected(), PCB_EDITOR_CONTROL::GroupFlattenSelected(), PCB_EDITOR_CONTROL::GroupMergeSelected(), PCB_EDITOR_CONTROL::GroupRemoveItemsSelected(), PCB_EDITOR_CONTROL::GroupSelected(), highlightNet(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), InspectClearance(), InspectConstraints(), LocalRatsnestTool(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), 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(), GLOBAL_EDIT_TOOL::RemoveUnusedPads(), EDIT_TOOL::Rotate(), PCB_TOOL_BASE::selection(), SELECTION_TOOL::selectNet(), DRAWING_TOOL::SetAnchor(), PCB_EDITOR_CONTROL::TrackWidthDec(), PCB_EDITOR_CONTROL::TrackWidthInc(), PCB_EDITOR_CONTROL::UngroupSelected(), PCBNEW_CONTROL::UpdateMessagePanel(), 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 287 of file pcb_tool_base.cpp.

288 {
289  auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
290  auto& selection = selTool->GetSelection();
291  return selection;
292 }
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)
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_INSPECTION_TOOL::setTransitions ( )
overrideprivatevirtual

Bind handlers to corresponding TOOL_ACTIONs

Reimplemented from PCB_TOOL_BASE.

Definition at line 966 of file pcb_inspection_tool.cpp.

967 {
971 
975 
980 
988 
991 }
int UpdateSelectionRatsnest(const TOOL_EVENT &aEvent)
Updates ratsnest for selected items.
static const TOOL_EVENT SelectedEvent
Definition: actions.h:206
int HighlightNet(const TOOL_EVENT &aEvent)
Highlights net belonging to the item under the cursor.
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:207
static TOOL_ACTION hideNet
Definition: pcb_actions.h:437
int InspectClearance(const TOOL_EVENT &aEvent)
Show the clearance resolution for two selected items
static TOOL_ACTION highlightItem
Definition: pcb_actions.h:436
static TOOL_ACTION boardStatistics
Definition: pcb_actions.h:423
int InspectConstraints(const TOOL_EVENT &aEvent)
static TOOL_ACTION cancelInteractive
Definition: actions.h:65
int HighlightNetTool(const TOOL_EVENT &aEvent)
Launches a tool to pick the item whose net is going to be highlighted.
int CrossProbePcbToSch(const TOOL_EVENT &aEvent)
Notifies eeschema about the selected item.
static TOOL_ACTION localRatsnestTool
Definition: pcb_actions.h:441
static TOOL_ACTION toggleLastNetHighlight
Definition: pcb_actions.h:433
int HideNet(const TOOL_EVENT &aEvent)
Hide the ratsnest for a given net
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Function Go()
int ShowStatisticsDialog(const TOOL_EVENT &aEvent)
Function ShowStatisticDialog()
static TOOL_ACTION inspectConstraints
Definition: pcb_actions.h:427
static TOOL_ACTION highlightNetTool
Definition: pcb_actions.h:434
int HighlightItem(const TOOL_EVENT &aEvent)
Performs the appropriate action in response to an eeschema cross-probe.
static const TOOL_EVENT ClearedEvent
Definition: actions.h:208
static TOOL_ACTION hideDynamicRatsnest
Definition: pcb_actions.h:442
static TOOL_ACTION inspectClearance
Definition: pcb_actions.h:426
static TOOL_ACTION clearHighlight
Definition: pcb_actions.h:431
int HideDynamicRatsnest(const TOOL_EVENT &aEvent)
Hides ratsnest for selected items. Called when there are no items selected.
static TOOL_ACTION showNet
Definition: pcb_actions.h:438
static TOOL_ACTION highlightNet
Definition: pcb_actions.h:432
static TOOL_ACTION highlightNetSelection
Definition: pcb_actions.h:435
int LocalRatsnestTool(const TOOL_EVENT &aEvent)
Shows local ratsnest of a component
static TOOL_ACTION listNets
Definition: pcb_actions.h:325
int ListNets(const TOOL_EVENT &aEvent)
static TOOL_ACTION updateLocalRatsnest
Definition: pcb_actions.h:443
int ClearHighlight(const TOOL_EVENT &aEvent)
Clears all board highlights
int ShowNet(const TOOL_EVENT &aEvent)
Show the ratsnest for a given net

References PCB_ACTIONS::boardStatistics, ACTIONS::cancelInteractive, EVENTS::ClearedEvent, ClearHighlight(), PCB_ACTIONS::clearHighlight, CrossProbePcbToSch(), TOOL_INTERACTIVE::Go(), HideDynamicRatsnest(), PCB_ACTIONS::hideDynamicRatsnest, HideNet(), PCB_ACTIONS::hideNet, HighlightItem(), PCB_ACTIONS::highlightItem, HighlightNet(), PCB_ACTIONS::highlightNet, PCB_ACTIONS::highlightNetSelection, HighlightNetTool(), PCB_ACTIONS::highlightNetTool, InspectClearance(), PCB_ACTIONS::inspectClearance, InspectConstraints(), PCB_ACTIONS::inspectConstraints, ListNets(), PCB_ACTIONS::listNets, LocalRatsnestTool(), PCB_ACTIONS::localRatsnestTool, EVENTS::SelectedEvent, ShowNet(), PCB_ACTIONS::showNet, ShowStatisticsDialog(), PCB_ACTIONS::toggleLastNetHighlight, EVENTS::UnselectedEvent, PCB_ACTIONS::updateLocalRatsnest, and UpdateSelectionRatsnest().

◆ ShowNet()

int PCB_INSPECTION_TOOL::ShowNet ( const TOOL_EVENT aEvent)

Show the ratsnest for a given net

Definition at line 927 of file pcb_inspection_tool.cpp.

928 {
929  doHideNet( aEvent.Parameter<intptr_t>(), false );
930  return 0;
931 }
void doHideNet(int aNetCode, bool aHide)
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435

References doHideNet(), and TOOL_EVENT::Parameter().

Referenced by setTransitions().

◆ ShowStatisticsDialog()

int PCB_INSPECTION_TOOL::ShowStatisticsDialog ( const TOOL_EVENT aEvent)

Function ShowStatisticDialog()

Shows dialog with board statistics

Definition at line 98 of file pcb_inspection_tool.cpp.

99 {
101  dialog.ShowModal();
102  return 0;
103 }
PCB_EDIT_FRAME * m_frame
DIALOG_BOARD_STATISTIC.

References m_frame.

Referenced by setTransitions().

◆ UpdateSelectionRatsnest()

int PCB_INSPECTION_TOOL::UpdateSelectionRatsnest ( const TOOL_EVENT aEvent)

Updates ratsnest for selected items.

Definition at line 763 of file pcb_inspection_tool.cpp.

764 {
765  VECTOR2I delta;
766 
767  // If we have passed the simple move vector, we can update without recalculation
768  if( aEvent.Parameter<VECTOR2I*>() )
769  {
770  delta = *aEvent.Parameter<VECTOR2I*>();
771  delete aEvent.Parameter<VECTOR2I*>();
772  }
773  else
774  {
775  // We can delete the existing map to force a recalculation
776  delete m_dynamicData;
777  m_dynamicData = nullptr;
778  }
779 
780  auto selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
781  auto& selection = selectionTool->GetSelection();
782  auto connectivity = getModel<BOARD>()->GetConnectivity();
783 
784  if( selection.Empty() )
785  {
786  connectivity->ClearDynamicRatsnest();
787  delete m_dynamicData;
788  m_dynamicData = nullptr;
789  }
790  else
791  {
793  }
794 
795  return 0;
796 }
SELECTION_TOOL.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:219
const PCBNEW_SELECTION & selection() const
T Parameter() const
Function Parameter() Returns a non-standard parameter assigned to the event.
Definition: tool_event.h:435
CONNECTIVITY_DATA * m_dynamicData
void calculateSelectionRatsnest(const VECTOR2I &aDelta)
Recalculates dynamic ratsnest for the current selection
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:121

References calculateSelectionRatsnest(), SELECTION::Empty(), TOOL_MANAGER::GetTool(), m_dynamicData, TOOL_BASE::m_toolMgr, TOOL_EVENT::Parameter(), and PCB_TOOL_BASE::selection().

Referenced by setTransitions().

◆ 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(), EDIT_TOOL::doMoveSelection(), 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(), POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), EDIT_TOOL::pickReferencePoint(), 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_dynamicData

CONNECTIVITY_DATA* PCB_INSPECTION_TOOL::m_dynamicData
private

◆ m_editModules

◆ m_frame

◆ m_inspectClearanceDialog

std::unique_ptr<DIALOG_HTML_REPORTER> PCB_INSPECTION_TOOL::m_inspectClearanceDialog
private

Definition at line 133 of file pcb_inspection_tool.h.

Referenced by InspectClearance(), and onInspectClearanceDialogClosed().

◆ m_inspectConstraintsDialog

std::unique_ptr<DIALOG_CONSTRAINTS_REPORTER> PCB_INSPECTION_TOOL::m_inspectConstraintsDialog
private

Definition at line 134 of file pcb_inspection_tool.h.

Referenced by InspectConstraints(), and onInspectConstraintsDialogClosed().

◆ m_lastNetcode

int PCB_INSPECTION_TOOL::m_lastNetcode
private

Definition at line 126 of file pcb_inspection_tool.h.

Referenced by HighlightNet(), highlightNet(), and PCB_INSPECTION_TOOL().

◆ m_listNetsDialog

std::unique_ptr<DIALOG_SELECT_NET_FROM_LIST> PCB_INSPECTION_TOOL::m_listNetsDialog
private

Definition at line 130 of file pcb_inspection_tool.h.

Referenced by ListNets(), and onListNetsDialogClosed().

◆ m_listNetsDialogSettings

DIALOG_SELECT_NET_FROM_LIST::SETTINGS PCB_INSPECTION_TOOL::m_listNetsDialogSettings
private

Definition at line 131 of file pcb_inspection_tool.h.

Referenced by ListNets(), and onListNetsDialogClosed().

◆ 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(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), LIB_CONTROL::Init(), LIB_DRAWING_TOOLS::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_TOOLS::Init(), PL_DRAWING_TOOLS::Init(), PCB_EDITOR_CONTROL::Init(), SCH_DRAWING_TOOLS::Init(), EDA_3D_CONTROLLER::Init(), GERBVIEW_SELECTION_TOOL::Init(), PL_SELECTION_TOOL::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PL_EDIT_TOOL::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(), 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_probingSchToPcb

bool PCB_INSPECTION_TOOL::m_probingSchToPcb
private

Definition at line 125 of file pcb_inspection_tool.h.

Referenced by CrossProbePcbToSch(), HighlightItem(), and PCB_INSPECTION_TOOL().

◆ 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(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), 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(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), 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(), doHideNet(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawRectangle(), 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(), PCB_EDITOR_CONTROL::EditFpInFpEditor(), LIB_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), LIB_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithLibEdit(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), 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(), COMMON_TOOLS::GridNext(), COMMON_TOOLS::GridPreset(), COMMON_TOOLS::GridPrev(), PCBNEW_CONTROL::GridSetOrigin(), PCB_EDITOR_CONTROL::GroupEnterSelected(), PCB_EDITOR_CONTROL::GroupFlattenSelected(), PCB_EDITOR_CONTROL::GroupLeave(), PCB_EDITOR_CONTROL::GroupMergeSelected(), PCB_EDITOR_CONTROL::GroupRemoveItemsSelected(), PCB_EDITOR_CONTROL::GroupSelected(), GERBVIEW_CONTROL::HighlightControl(), HighlightItem(), HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), HighlightNetTool(), FOOTPRINT_EDITOR_TOOLS::ImportFootprint(), PL_EDIT_TOOL::ImportWorksheetContent(), LIB_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), CONVERT_TOOL::Init(), GLOBAL_EDIT_TOOL::Init(), LIB_CONTROL::Init(), PAD_TOOL::Init(), ALIGN_DISTRIBUTE_TOOL::Init(), 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(), InspectClearance(), InspectConstraints(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), LocalRatsnestTool(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), LIB_MOVE_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), SCH_MOVE_TOOL::Main(), PCBNEW_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(), LIB_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), PCB_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), LIB_CONTROL::OnDeMorgan(), COMMON_TOOLS::OnGridChanged(), POINT_EDITOR::OnSelectionChange(), LIB_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), EDIT_TOOL::pickReferencePoint(), 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(), SCH_EDIT_TOOL::RefreshSymbolFromLibrary(), 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(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), 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_TOOL::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(), EDA_3D_CONTROLLER::SetMaterial(), DRC_TOOL::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(), PCB_EDITOR_CONTROL::UngroupSelected(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCBNEW_CONTROL::UpdateMessagePanel(), UpdateSelectionRatsnest(), PNS::TOOL_BASE::updateStartItem(), 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: