KiCad PCB EDA Suite
BOARD_INSPECTION_TOOL Class Reference

Tool for pcb inspection. More...

#include <board_inspection_tool.h>

Inheritance diagram for BOARD_INSPECTION_TOOL:
PCB_TOOL_BASE TOOL_INTERACTIVE TOOL_BASE

Public Types

enum  RESET_REASON { RUN, MODEL_RELOAD, GAL_SWITCH }
 Determine the reason of reset for a tool. More...
 

Public Member Functions

 BOARD_INSPECTION_TOOL ()
 
bool Init () override
 Init() is called once upon a registration of the tool. More...
 
void Reset (RESET_REASON aReason) override
 Bring the tool to a known, initial state. More...
 
int ShowStatisticsDialog (const TOOL_EVENT &aEvent)
 Show dialog with board statistics. More...
 
int CrossProbePcbToSch (const TOOL_EVENT &aEvent)
 Highlight net belonging to the item under the cursor. More...
 
int HighlightNet (const TOOL_EVENT &aEvent)
 Clear all board highlights. More...
 
int ClearHighlight (const TOOL_EVENT &aEvent)
 Launch a tool to pick the item whose net is going to be highlighted. More...
 
int HighlightNetTool (const TOOL_EVENT &aEvent)
 Perform the appropriate action in response to an Eeschema cross-probe. More...
 
int HighlightItem (const TOOL_EVENT &aEvent)
 Update ratsnest for selected items. More...
 
int UpdateSelectionRatsnest (const TOOL_EVENT &aEvent)
 Hide ratsnest for selected items. Called when there are no items selected. More...
 
int HideDynamicRatsnest (const TOOL_EVENT &aEvent)
 Show local ratsnest of a component. More...
 
int LocalRatsnestTool (const TOOL_EVENT &aEvent)
 
int FlipPcbView (const TOOL_EVENT &aEvent)
 
int ListNets (const TOOL_EVENT &aEvent)
 Hide the ratsnest for a given net. More...
 
int HideNet (const TOOL_EVENT &aEvent)
 Show the ratsnest for a given net. More...
 
int ShowNet (const TOOL_EVENT &aEvent)
 
void InspectDRCError (const std::shared_ptr< RC_ITEM > &aDRCItem)
 Show the clearance resolution for two selected items. More...
 
int InspectClearance (const TOOL_EVENT &aEvent)
 
int InspectConstraints (const TOOL_EVENT &aEvent)
 
bool IsNetHighlightSet () const
 
void SetIsFootprintEditor (bool aEnabled)
 Function SetIsFootprintEditor() More...
 
bool IsFootprintEditor () const
 
bool Is45Limited () const
 Should the tool use its 45° mode option? More...
 
void Activate ()
 Run the tool. More...
 
TOOL_MENUGetToolMenu ()
 
void SetContextMenu (ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger=CMENU_BUTTON)
 Assign a context menu and tells when it should be activated. More...
 
void RunMainStack (std::function< void()> aFunc)
 Call a function using the main stack. More...
 
template<class T >
void Go (int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
 Define which state (aStateFunc) to go when a certain event arrives (aConditions). More...
 
TOOL_EVENTWait (const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
 Suspend execution of the tool until an event specified in aEventList arrives. More...
 
TOOL_TYPE GetType () const
 Return the type of the tool. More...
 
TOOL_ID GetId () const
 Return the unique identifier of the tool. More...
 
const std::string & GetName () const
 Return the name of the tool. More...
 
TOOL_MANAGERGetManager () const
 Return 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
 
FOOTPRINTfootprint () const
 
const PCB_DISPLAY_OPTIONSdisplayOptions () const
 
PCB_DRAW_PANEL_GALcanvas () const
 
const PCB_SELECTIONselection () const
 
PCB_SELECTIONselection ()
 
void attachManager (TOOL_MANAGER *aManager)
 Set the TOOL_MANAGER the tool will belong to. More...
 
KIGFX::VIEWgetView () const
 Returns the instance of #VIEW object used in the application. More...
 
KIGFX::VIEW_CONTROLSgetViewControls () const
 Return the instance of VIEW_CONTROLS object used in the application. More...
 
template<typename T >
T * getEditFrame () const
 Return the application window object, casted to requested user type. More...
 
template<typename T >
T * getModel () const
 Return the model object if it matches the requested type. More...
 

Protected Attributes

bool m_isFootprintEditor
 
TOOL_MENU m_menu
 The functions below are not yet implemented - their interface may change. More...
 
TOOL_TYPE m_type
 Unique identifier for the tool, assigned by a TOOL_MANAGER instance. More...
 
TOOL_ID m_toolId
 Name of the tool. More...
 
std::string m_toolName
 
TOOL_MANAGERm_toolMgr
 

Private Member Functions

void calculateSelectionRatsnest (const VECTOR2I &aDelta)
 < Recalculate 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)
 Bind handlers to corresponding TOOL_ACTIONs. More...
 
void setTransitions () override
 This method is meant to be overridden in order to specify handlers for events. More...
 
void onListNetsDialogClosed (wxCommandEvent &aEvent)
 
void onInspectClearanceDialogClosed (wxCommandEvent &aEvent)
 
void onInspectConstraintsDialogClosed (wxCommandEvent &aEvent)
 
void reportZoneConnection (ZONE *aZone, PAD *aPad, REPORTER *r)
 
void reportClearance (DRC_CONSTRAINT_T aClearanceType, PCB_LAYER_ID aLayer, BOARD_ITEM *aA, BOARD_ITEM *aB, REPORTER *r)
 
wxString getItemDescription (BOARD_ITEM *aItem)
 

Private Attributes

PCB_EDIT_FRAMEm_frame
 
bool m_probingSchToPcb
 
std::set< int > m_currentlyHighlighted
 
std::set< int > m_lastHighlighted
 
CONNECTIVITY_DATAm_dynamicData
 
std::unique_ptr< DIALOG_NET_INSPECTORm_listNetsDialog
 
DIALOG_NET_INSPECTOR::SETTINGS m_listNetsDialogSettings
 
std::unique_ptr< DIALOG_CONSTRAINTS_REPORTERm_inspectClearanceDialog
 
std::unique_ptr< DIALOG_CONSTRAINTS_REPORTERm_inspectConstraintsDialog
 

Detailed Description

Tool for pcb inspection.

Definition at line 43 of file board_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

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

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

Constructor & Destructor Documentation

◆ BOARD_INSPECTION_TOOL()

BOARD_INSPECTION_TOOL::BOARD_INSPECTION_TOOL ( )

Definition at line 44 of file board_inspection_tool.cpp.

44  :
45  PCB_TOOL_BASE( "pcbnew.InspectionTool" ),
46  m_frame( nullptr )
47 {
48  m_probingSchToPcb = false;
49  m_dynamicData = nullptr;
50 }
PCB_TOOL_BASE(TOOL_ID aId, const std::string &aName)
Constructor.
Definition: pcb_tool_base.h:77
CONNECTIVITY_DATA * m_dynamicData

References m_dynamicData, and m_probingSchToPcb.

Member Function Documentation

◆ Activate()

void TOOL_INTERACTIVE::Activate ( )
inherited

Run 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:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
bool InvokeTool(TOOL_ID aToolId)
Call 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(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawArc(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), PAD_TOOL::EnumeratePads(), PCB_CONTROL::GridSetOrigin(), SCH_EDITOR_CONTROL::HighlightNetCursor(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), PL_EDIT_TOOL::Main(), EE_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), LIB_TREE::onContextMenu(), PCB_POINT_EDITOR::OnSelectionChange(), GROUP_TOOL::PickNewMember(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), EDIT_TOOL::Remove(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), DRAWING_TOOL::SetAnchor(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ attachManager()

void TOOL_BASE::attachManager ( TOOL_MANAGER aManager)
protectedinherited

Set 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:214

References TOOL_BASE::m_toolMgr.

Referenced by TOOL_MANAGER::RegisterTool().

◆ board()

BOARD* PCB_TOOL_BASE::board ( ) const
inlineprotectedinherited

Definition at line 165 of file pcb_tool_base.h.

165 { return getModel<BOARD>(); }

Referenced by PCB_CONTROL::AppendBoard(), AUTOPLACE_TOOL::autoplace(), calculateSelectionRatsnest(), EDIT_TOOL::ChangeTrackWidth(), ZONE_FILLER_TOOL::CheckAllZones(), ClearHighlight(), EDIT_TOOL::copyToClipboard(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), MICROWAVE_TOOL::createInductorBetween(), ROUTER_TOOL::CustomTrackWidthDialog(), PCB_CONTROL::DeleteItemCursor(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), DRAWING_TOOL::drawSegment(), PAD_TOOL::EnumeratePads(), PAD_TOOL::explodePad(), BOARD_EDITOR_CONTROL::ExportNetlist(), ZONE_FILLER_TOOL::FillAllZones(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::filterSelection(), PCB_TOOL_BASE::footprint(), PCB_SELECTION_TOOL::GetBoard(), PCB_SELECTION_TOOL::getCollectorsGuide(), GROUP_TOOL::Group(), ROUTER_TOOL::handleLayerSwitch(), highlightNet(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_CONTROL::LayerNext(), PCB_CONTROL::LayerPrev(), LocalRatsnestTool(), EDIT_TOOL::MoveExact(), FOOTPRINT_EDITOR_CONTROL::NewFootprint(), PCB_CONTROL::Paste(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PAD_TOOL::PlacePad(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_SELECTION_TOOL::RebuildSelection(), PAD_TOOL::recombinePad(), BOARD_EDITOR_CONTROL::RepairBoard(), FOOTPRINT_EDITOR_CONTROL::RepairFootprint(), PNS::TOOL_BASE::Reset(), PCB_CONTROL::Reset(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::selectAllItemsOnNet(), PCB_SELECTION_TOOL::selectAllItemsOnSheet(), PCB_SELECTION_TOOL::selectConnectedTracks(), PCB_SELECTION_TOOL::selectionContains(), PCB_SELECTION_TOOL::selectPoint(), PCB_CONTROL::TrackDisplayMode(), PCB_CONTROL::unfilledZoneCheck(), GROUP_TOOL::Ungroup(), ROUTER_TOOL::updateMessagePanel(), PCB_CONTROL::ViaDisplayMode(), PCB_CONTROL::ZoneDisplayMode(), ZONE_FILLER_TOOL::ZoneFill(), BOARD_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfillAll().

◆ calculateSelectionRatsnest()

void BOARD_INSPECTION_TOOL::calculateSelectionRatsnest ( const VECTOR2I aDelta)
private

< Recalculate dynamic ratsnest for the current selection.

Definition at line 1262 of file board_inspection_tool.cpp.

1263 {
1265  SELECTION& selection = selectionTool->GetSelection();
1266  std::shared_ptr<CONNECTIVITY_DATA> connectivity = board()->GetConnectivity();
1267  std::vector<BOARD_ITEM*> items;
1268  std::deque<EDA_ITEM*> queued_items( selection.begin(), selection.end() );
1269 
1270  for( std::size_t i = 0; i < queued_items.size(); ++i )
1271  {
1272  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( queued_items[i] );
1273 
1274  if( item->Type() == PCB_FOOTPRINT_T )
1275  {
1276  for( PAD* pad : static_cast<FOOTPRINT*>( item )->Pads() )
1277  {
1278  if( pad->GetLocalRatsnestVisible() || displayOptions().m_ShowModuleRatsnest )
1279  items.push_back( pad );
1280  }
1281  }
1282  else if( item->Type() == PCB_GROUP_T )
1283  {
1284  PCB_GROUP *group = static_cast<PCB_GROUP*>( item );
1285  group->RunOnDescendants( [ &queued_items ]( BOARD_ITEM *aItem )
1286  {
1287  queued_items.push_back( aItem );
1288  } );
1289  }
1290  else if( BOARD_CONNECTED_ITEM* boardItem = dyn_cast<BOARD_CONNECTED_ITEM*>( item ) )
1291  {
1292  if( boardItem->GetLocalRatsnestVisible() || displayOptions().m_ShowModuleRatsnest )
1293  items.push_back( boardItem );
1294  }
1295  }
1296 
1297  if( items.empty() || std::none_of( items.begin(), items.end(),
1298  []( const BOARD_ITEM* aItem )
1299  {
1300  return( aItem->Type() == PCB_TRACE_T
1301  || aItem->Type() == PCB_PAD_T
1302  || aItem->Type() == PCB_ARC_T
1303  || aItem->Type() == PCB_ZONE_T
1304  || aItem->Type() == PCB_FOOTPRINT_T
1305  || aItem->Type() == PCB_VIA_T );
1306  } ) )
1307  {
1308  return;
1309  }
1310 
1311  if( !m_dynamicData )
1312  {
1313  m_dynamicData = new CONNECTIVITY_DATA( items, true );
1314  connectivity->BlockRatsnestItems( items );
1315  }
1316  else
1317  {
1318  m_dynamicData->Move( aDelta );
1319  }
1320 
1321  connectivity->ComputeDynamicRatsnest( items, m_dynamicData );
1322 }
BOARD * board() const
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:108
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
ITER end()
Definition: selection.h:64
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
class PAD, a pad in a footprint
Definition: typeinfo.h:89
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
ITER begin()
Definition: selection.h:63
const PCB_SELECTION & selection() const
std::shared_ptr< CONNECTIVITY_DATA > GetConnectivity() const
Return a list of missing connections between components/tracks.
Definition: board.h:344
class ZONE, a copper pour area
Definition: typeinfo.h:105
const PCB_DISPLAY_OPTIONS & displayOptions() const
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
The selection tool: currently supports:
CONNECTIVITY_DATA * m_dynamicData
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
Definition: pad.h:57
void Move(const VECTOR2I &aDelta)
Moves the connectivity list anchors.
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References SELECTION::begin(), PCB_TOOL_BASE::board(), PCB_TOOL_BASE::displayOptions(), SELECTION::end(), BOARD::GetConnectivity(), PCB_SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), group, m_dynamicData, PCB_DISPLAY_OPTIONS::m_ShowModuleRatsnest, TOOL_BASE::m_toolMgr, CONNECTIVITY_DATA::Move(), pad, PCB_ARC_T, PCB_FOOTPRINT_T, PCB_GROUP_T, PCB_PAD_T, PCB_TRACE_T, PCB_VIA_T, PCB_ZONE_T, PCB_TOOL_BASE::selection(), and EDA_ITEM::Type().

Referenced by UpdateSelectionRatsnest().

◆ canvas()

◆ ClearHighlight()

int BOARD_INSPECTION_TOOL::ClearHighlight ( const TOOL_EVENT aEvent)

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

Definition at line 1084 of file board_inspection_tool.cpp.

1085 {
1086  BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
1088 
1089  m_currentlyHighlighted.clear();
1090  m_lastHighlighted.clear();
1091 
1093  settings->SetHighlight( false );
1097  return 0;
1098 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:283
void SendCrossProbeNetName(const wxString &aNetName)
Send a net name to Eeschema for highlighting.
BOARD * board() const
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
EDA_ITEM * GetModel() const
Definition: tool_manager.h:290
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
std::set< int > m_currentlyHighlighted
std::set< int > m_lastHighlighted
void ResetNetHighLight()
Reset all high light data to the init state.
Definition: board.cpp:2021
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
Return a pointer to current settings that are going to be used when drawing items.
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition: view.cpp:775

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

Referenced by setTransitions().

◆ controls()

◆ CrossProbePcbToSch()

int BOARD_INSPECTION_TOOL::CrossProbePcbToSch ( const TOOL_EVENT aEvent)

Highlight net belonging to the item under the cursor.

Definition at line 850 of file board_inspection_tool.cpp.

851 {
852  // Don't get in an infinite loop PCB -> SCH -> PCB -> SCH -> ...
853  if( m_probingSchToPcb )
854  return 0;
855 
857  const PCB_SELECTION& selection = selTool->GetSelection();
858 
859  if( selection.Size() == 1 )
860  m_frame->SendMessageToEESCHEMA( static_cast<BOARD_ITEM*>( selection.Front() ) );
861  else
862  m_frame->SendMessageToEESCHEMA( nullptr );
863 
864  // Update 3D viewer highlighting
865  m_frame->Update3DView( false, frame()->GetDisplayOptions().m_Live3DRefresh );
866 
867  return 0;
868 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
PCB_BASE_EDIT_FRAME * frame() const
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
const PCB_SELECTION & selection() const
void SendMessageToEESCHEMA(BOARD_ITEM *objectToSync)
Send a message to the schematic editor so that it may move its cursor to a symbol with the same refer...
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
int Size() const
Returns the number of selected parts.
Definition: selection.h:103
The selection tool: currently supports:
EDA_ITEM * Front() const
Definition: selection.h:144

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

Referenced by setTransitions().

◆ displayOptions()

const PCB_DISPLAY_OPTIONS & PCB_TOOL_BASE::displayOptions ( ) const
protectedinherited

Definition at line 302 of file pcb_tool_base.cpp.

303 {
304  return frame()->GetDisplayOptions();
305 }
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
PCB_BASE_EDIT_FRAME * frame() const

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

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

◆ doHideNet()

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

Bind handlers to corresponding TOOL_ACTIONs.

Definition at line 1398 of file board_inspection_tool.cpp.

1399 {
1400  KIGFX::PCB_RENDER_SETTINGS* rs = static_cast<KIGFX::PCB_RENDER_SETTINGS*>(
1402 
1404  SELECTION& selection = selectionTool->GetSelection();
1405 
1406  if( aNetCode <= 0 && !selection.Empty() )
1407  {
1408  for( EDA_ITEM* item : selection )
1409  {
1410  if( BOARD_CONNECTED_ITEM* bci = dynamic_cast<BOARD_CONNECTED_ITEM*>( item ) )
1411  {
1412  if( bci->GetNetCode() > 0 )
1413  doHideNet( bci->GetNetCode(), aHide );
1414  }
1415  }
1416 
1417  return;
1418  }
1419 
1420  if( aHide )
1421  rs->GetHiddenNets().insert( aNetCode );
1422  else
1423  rs->GetHiddenNets().erase( aNetCode );
1424 
1426  m_frame->GetCanvas()->Refresh();
1427 
1428  m_frame->GetAppearancePanel()->OnNetVisibilityChanged( aNetCode, !aHide );
1429 }
std::set< int > & GetHiddenNets()
Definition: pcb_painter.h:187
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:283
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:214
APPEARANCE_CONTROLS * GetAppearancePanel()
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
void RedrawRatsnest()
Return the bounding box of the view that should be used if model is not valid.
PCB specific render settings.
Definition: pcb_painter.h:64
const PCB_SELECTION & selection() const
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:97
void OnNetVisibilityChanged(int aNetCode, bool aVisibility)
Notifies the panel when a net has been hidden or shown via the external tool.
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
void doHideNet(int aNetCode, bool aHide)
Bind handlers to corresponding TOOL_ACTIONs.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
Update the board display after modifying it by a python script (note: it is automatically called by a...
The selection tool: currently supports:
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100

References SELECTION::Empty(), PCB_BASE_EDIT_FRAME::GetAppearancePanel(), 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, APPEARANCE_CONTROLS::OnNetVisibilityChanged(), 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 
46  BOARD_COMMIT commit( frame() );
47 
49 
50  Activate();
51  // Must be done after Activate() so that it gets set into the correct context
52  controls()->ShowCursor( true );
53  // do not capture or auto-pan until we start placing an item
54 
55  PCB_GRID_HELPER grid( m_toolMgr, frame()->GetMagneticItemsSettings() );
56 
57  // Add a VIEW_GROUP that serves as a preview for the new item
58  PCB_SELECTION preview;
59  view()->Add( &preview );
60 
61  aPlacer->m_board = board();
62  aPlacer->m_frame = frame();
63  aPlacer->m_modifiers = 0;
64 
65  auto makeNewItem =
66  [&]( VECTOR2I aPosition )
67  {
68  if( frame()->GetModel() )
69  newItem = aPlacer->CreateItem();
70 
71  if( newItem )
72  {
73  newItem->SetPosition( (wxPoint) aPosition );
74  preview.Add( newItem.get() );
75 
76  if( newItem->Type() == PCB_FOOTPRINT_T )
77  {
78  FOOTPRINT* fp = dyn_cast<FOOTPRINT*>( newItem.get() );
79 
80  // footprints have more drawable parts
81  fp->RunOnChildren( std::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );
82  }
83  }
84  };
85 
86  if( aOptions & IPO_SINGLE_CLICK )
87  makeNewItem( controls()->GetCursorPosition() );
88 
89  auto setCursor =
90  [&]()
91  {
92  if( !newItem )
94  else
96  };
97 
98  // Set initial cursor
99  setCursor();
100 
101  // Main loop: keep receiving events
102  while( TOOL_EVENT* evt = Wait() )
103  {
104  setCursor();
105 
106  grid.SetSnap( false ); // Interactive placement tools need to set their own item snaps
107  grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
108  VECTOR2I cursorPos = grid.BestSnapAnchor( controls()->GetMousePosition(), nullptr );
109 
110  aPlacer->m_modifiers = evt->Modifier();
111 
112  auto cleanup =
113  [&] ()
114  {
115  newItem = nullptr;
116  preview.Clear();
117  view()->Update( &preview );
118  controls()->SetAutoPan( false );
119  controls()->CaptureCursor( false );
120  controls()->ShowCursor( true );
121  };
122 
123  if( evt->IsCancelInteractive() )
124  {
125  if( aOptions & IPO_SINGLE_CLICK )
126  {
127  cleanup();
128  frame()->PopTool( aTool );
129  break;
130  }
131  else if( newItem )
132  {
133  cleanup();
134  }
135  else
136  {
137  frame()->PopTool( aTool );
138  break;
139  }
140  }
141  else if( evt->IsActivate() )
142  {
143  if( newItem )
144  cleanup();
145 
146  if( evt->IsPointEditor() )
147  {
148  // don't exit (the point editor runs in the background)
149  }
150  else if( evt->IsMoveTool() )
151  {
152  // leave ourselves on the stack so we come back after the move
153  break;
154  }
155  else
156  {
157  frame()->PopTool( aTool );
158  break;
159  }
160  }
161  else if( evt->IsClick( BUT_LEFT ) || evt->IsDblClick( BUT_LEFT ) )
162  {
163  if( !newItem )
164  {
165  // create the item if possible
166  makeNewItem( cursorPos );
167 
168  // no item created, so wait for another click
169  if( !newItem )
170  continue;
171 
172  controls()->CaptureCursor( true );
173  controls()->SetAutoPan( true );
174  }
175  else
176  {
177  auto oldFlags = newItem->GetFlags();
178  newItem->ClearFlags();
179 
180  if( !aPlacer->PlaceItem( newItem.get(), commit ) )
181  {
182  newItem->SetFlags( oldFlags );
183  continue;
184  }
185 
186  preview.Clear();
187  newItem.release();
188  commit.Push( aCommitMessage );
189 
190  controls()->CaptureCursor( false );
191  controls()->SetAutoPan( false );
192  controls()->ShowCursor( true );
193 
194  if( !( aOptions & IPO_REPEAT ) )
195  break;
196 
197  if( aOptions & IPO_SINGLE_CLICK )
198  makeNewItem( controls()->GetCursorPosition() );
199 
200  setCursor();
201  }
202  }
203  else if( evt->IsClick( BUT_RIGHT ) )
204  {
206  }
207  else if( evt->IsAction( &PCB_ACTIONS::trackViaSizeChanged ) )
208  {
210  }
211  else if( newItem && evt->Category() == TC_COMMAND )
212  {
213  /*
214  * Handle any events that can affect the item as we move it around
215  */
216  if( TOOL_EVT_UTILS::IsRotateToolEvt( *evt ) && ( aOptions & IPO_ROTATE ) )
217  {
218  const int rotationAngle = TOOL_EVT_UTILS::GetEventRotationAngle( *frame(), *evt );
219  newItem->Rotate( newItem->GetPosition(), rotationAngle );
220  view()->Update( &preview );
221  }
222  else if( evt->IsAction( &PCB_ACTIONS::flip ) && ( aOptions & IPO_FLIP ) )
223  {
224  newItem->Flip( newItem->GetPosition(), frame()->Settings().m_FlipLeftRight );
225  view()->Update( &preview );
226  }
227  else if( evt->IsAction( &PCB_ACTIONS::viaSizeInc )
228  || evt->IsAction( &PCB_ACTIONS::viaSizeDec ) )
229  {
230  // Refresh preview after event runs
232  }
233  else if( evt->IsAction( &PCB_ACTIONS::properties ) )
234  {
235  frame()->OnEditItemRequest( newItem.get() );
236 
237  // Notify other tools of the changes
239  }
240  else if( evt->IsAction( &ACTIONS::refreshPreview ) )
241  {
242  preview.Clear();
243  newItem.release();
244 
245  makeNewItem( (wxPoint) cursorPos );
246  aPlacer->SnapItem( newItem.get() );
247  view()->Update( &preview );
248  }
249  else
250  {
251  evt->SetPassEvent();
252  }
253  }
254  else if( newItem && evt->IsMotion() )
255  {
256  // track the cursor
257  newItem->SetPosition( (wxPoint) cursorPos );
258  aPlacer->SnapItem( newItem.get() );
259 
260  // Show a preview of the item
261  view()->Update( &preview );
262  }
263  else
264  {
265  evt->SetPassEvent();
266  }
267  }
268 
269  view()->Remove( &preview );
271  controls()->SetAutoPan( false );
272  controls()->CaptureCursor( false );
273 }
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:59
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
TOOL_MENU m_menu
The functions below are not yet implemented - their interface may change.
virtual void Clear() override
Remove all the stored items from the group.
Definition: selection.h:82
void SetCurrentCursor(KICURSOR aCursor)
Set the current cursor shape for this panel.
TOOL_EVENT * Wait(const TOOL_EVENT_LIST &aEventList=TOOL_EVENT(TC_ANY, TA_ANY))
Suspend execution of the tool until an event specified in aEventList arrives.
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 Add(EDA_ITEM *aItem)
Definition: selection.cpp:31
static TOOL_ACTION viaSizeInc
Definition: pcb_actions.h:296
virtual std::unique_ptr< BOARD_ITEM > CreateItem()=0
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:214
virtual void OnEditItemRequest(BOARD_ITEM *aItem)=0
Install the corresponding dialog editor for the given item.
virtual void PushTool(const std::string &actionName)
NB: the definition of "tool" is different at the user level.
static TOOL_ACTION properties
Activation of the edit tool.
Definition: pcb_actions.h:117
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
static TOOL_ACTION trackViaSizeChanged
Definition: pcb_actions.h:299
bool IsRotateToolEvt(const TOOL_EVENT &aEvt)
Function isRotateToolEvt()
virtual void Remove(VIEW_ITEM *aItem) override
Remove a VIEW_ITEM from the view.
Definition: pcb_view.cpp:75
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
Definition: actions.h:204
TOOL_MANAGER * GetManager() const
Return 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)
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: pcb_view.cpp:92
const PCB_SELECTION & selection() const
Allow repeat placement of the item.
bool ProcessEvent(const TOOL_EVENT &aEvent)
Propagate an event to tools that requested events of matching type(s).
virtual void PopTool(const std::string &actionName)
virtual void CaptureCursor(bool aEnabled)
Force the cursor to stay within the drawing panel area.
Generic, UI-independent tool event.
Definition: tool_event.h:152
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)
Add an item to the group.
Definition: view_group.cpp:56
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
virtual BOARD_ITEM_CONTAINER * GetModel() const =0
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
PCBNEW_SETTINGS & Settings()
void Activate()
Run the tool.
void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction) const
Invoke a function on all BOARD_ITEMs that belong to the footprint (pads, drawings,...
Definition: footprint.cpp:1236
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1) override
Add a VIEW_ITEM to the view.
Definition: pcb_view.cpp:58
PCB_BASE_EDIT_FRAME * m_frame
Definition: pcb_tool_base.h:64
int GetEventRotationAngle(const PCB_BASE_EDIT_FRAME &aFrame, const TOOL_EVENT &aEvt)
Function getEventRotationAngle()
void ShowContextMenu(SELECTION &aSelection)
Helper function to set and immediately show a CONDITIONAL_MENU in concert with the given SELECTION.
Definition: tool_menu.cpp:59
static TOOL_ACTION viaSizeDec
Definition: pcb_actions.h:297
static TOOL_ACTION refreshPreview
Definition: actions.h:106

References TOOL_INTERACTIVE::Activate(), KIGFX::PCB_VIEW::Add(), KIGFX::VIEW_GROUP::Add(), SELECTION::Add(), ARROW, 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(), TOOL_EVT_UTILS::GetEventRotationAngle(), TOOL_BASE::GetManager(), PCB_BASE_FRAME::GetModel(), TOOL_BASE::getView(), grid, 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_BASE_EDIT_FRAME::OnEditItemRequest(), PCB_FOOTPRINT_T, PENCIL, PLACE, INTERACTIVE_PLACER_BASE::PlaceItem(), TOOLS_HOLDER::PopTool(), TOOL_MANAGER::ProcessEvent(), PCB_ACTIONS::properties, BOARD_COMMIT::Push(), TOOLS_HOLDER::PushTool(), ACTIONS::refreshPreview, KIGFX::PCB_VIEW::Remove(), TOOL_MANAGER::RunAction(), FOOTPRINT::RunOnChildren(), EVENTS::SelectedItemsModified, 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().

◆ FlipPcbView()

int BOARD_INSPECTION_TOOL::FlipPcbView ( const TOOL_EVENT aEvent)

◆ footprint()

◆ frame()

PCB_BASE_EDIT_FRAME* PCB_TOOL_BASE::frame ( ) const
inlineprotectedinherited

Definition at line 160 of file pcb_tool_base.h.

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

Referenced by PCB_POINT_EDITOR::addCorner(), AUTOPLACE_TOOL::autoplace(), PCB_TOOL_BASE::canvas(), ZONE_FILLER_TOOL::CheckAllZones(), PNS::TOOL_BASE::checkSnap(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), CrossProbePcbToSch(), ROUTER_TOOL::CustomTrackWidthDialog(), FOOTPRINT_EDITOR_CONTROL::DeleteFootprint(), PCB_TOOL_BASE::displayOptions(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), ROUTER_TOOL::DpDimensionsDialog(), EDIT_TOOL::DragArcTrack(), 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(), BOARD_EDITOR_CONTROL::ExportSpecctraDSN(), ZONE_FILLER_TOOL::FillAllZones(), EDIT_TOOL::FilletTracks(), ROUTER_TOOL::finishInteractive(), EDIT_TOOL::Flip(), PCB_CONTROL::FlipPcbView(), GLOBAL_EDIT_TOOL::GlobalDeletions(), ROUTER_TOOL::handleLayerSwitch(), HighlightItem(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), BOARD_EDITOR_CONTROL::ImportSpecctraSession(), ROUTER_TOOL::Init(), SCRIPTING_TOOL::Init(), PCB_SELECTION_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_TOOL_BASE::Is45Limited(), PCB_PICKER_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::meanderSettingsDialog(), EDIT_TOOL::MoveExact(), PCB_POINT_EDITOR::OnSelectionChange(), PCB_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), ROUTER_TOOL::prepareInteractive(), PAD_TOOL::pushPadSettings(), PAD_TOOL::recombinePad(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), SCRIPTING_TOOL::reloadPlugins(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), PCB_SELECTION_TOOL::RequestSelection(), PNS::TOOL_BASE::Reset(), ROUTER_TOOL::SelectCopperLayerPair(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_POINT_EDITOR::setEditedPoint(), ROUTER_TOOL::SettingsDialog(), GLOBAL_EDIT_TOOL::swapBoardItem(), GLOBAL_EDIT_TOOL::SwapLayers(), ROUTER_TOOL::switchLayerOnViaPlacement(), PCB_CONTROL::unfilledZoneCheck(), ROUTER_TOOL::updateMessagePanel(), EDIT_TOOL::updateModificationPoint(), BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB(), ZONE_FILLER_TOOL::ZoneFill(), and ZONE_FILLER_TOOL::ZoneFillAll().

◆ getEditFrame()

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

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

Definition at line 184 of file tool_base.h.

185  {
186 #if !defined( QA_TEST ) // Dynamic casts give the linker a seizure in the test framework
187  wxASSERT( dynamic_cast<T*>( getToolHolderInt() ) );
188 #endif
189  return static_cast<T*>( getToolHolderInt() );
190  }
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

Return the unique identifier of the tool.

The identifier is set by an instance of TOOL_MANAGER.

Returns
Identifier of the tool.

Definition at line 120 of file tool_base.h.

121  {
122  return m_toolId;
123  }
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209

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

◆ getItemDescription()

wxString BOARD_INSPECTION_TOOL::getItemDescription ( BOARD_ITEM aItem)
private

Definition at line 110 of file board_inspection_tool.cpp.

111 {
112  // Null items have no description
113  if( !aItem )
114  return wxString();
115 
116  wxString s = aItem->GetSelectMenuText( m_frame->GetUserUnits() );
117 
118  if( aItem->IsConnected() )
119  {
120  BOARD_CONNECTED_ITEM* cItem = static_cast<BOARD_CONNECTED_ITEM*>( aItem );
121  s += wxS( " " ) + wxString::Format( _( "[netclass %s]" ),
122  cItem->GetNetClass()->GetName() );
123  }
124 
125  return s;
126 };
virtual NETCLASS * GetNetClass() const
Return the NETCLASS for this item.
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
#define _(s)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
const wxString GetName() const
Definition: netclass.h:65
virtual wxString GetSelectMenuText(EDA_UNITS aUnits) const
Return the text to display to be used in the selection clarification context menu when multiple items...
Definition: eda_item.cpp:109
virtual bool IsConnected() const
Returns information if the object is derived from BOARD_CONNECTED_ITEM.
Definition: board_item.h:134
EDA_UNITS GetUserUnits() const
Return the user units currently in use.

References _, Format(), NETCLASS::GetName(), BOARD_CONNECTED_ITEM::GetNetClass(), EDA_ITEM::GetSelectMenuText(), EDA_BASE_FRAME::GetUserUnits(), BOARD_ITEM::IsConnected(), and m_frame.

Referenced by InspectClearance(), InspectConstraints(), and InspectDRCError().

◆ GetManager()

TOOL_MANAGER* TOOL_BASE::GetManager ( ) const
inlineinherited

Return the instance of TOOL_MANAGER that takes care of the tool.

Returns
Instance of the TOOL_MANAGER or NULL if there is no associated tool manager.

Definition at line 143 of file tool_base.h.

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

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

Return the model object if it matches the requested type.

Store the type of the tool.

Definition at line 196 of file tool_base.h.

References TOOL_BASE::getModelInt().

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

◆ GetName()

const std::string& TOOL_BASE::GetName ( void  ) const
inlineinherited

Return the name of the tool.

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

Returns
The name of the tool.

Definition at line 133 of file tool_base.h.

134  {
135  return m_toolName;
136  }
std::string m_toolName
Definition: tool_base.h:213

References TOOL_BASE::m_toolName.

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

◆ GetToolMenu()

◆ GetType()

TOOL_TYPE TOOL_BASE::GetType ( ) const
inlineinherited

Return the type of the tool.

Returns
The type of the tool.

Definition at line 108 of file tool_base.h.

109  {
110  return m_type;
111  }
TOOL_TYPE m_type
Unique identifier for the tool, assigned by a TOOL_MANAGER instance.
Definition: tool_base.h:206

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

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:283
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214

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::CheckSymbol(), GERBVIEW_CONTROL::ClearAllLayers(), PL_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::ClearSelection(), EE_SELECTION_TOOL::CollectHits(), SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint(), COMMON_TOOLS::CursorControl(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), GERBVIEW_SELECTION_TOOL::disambiguationMenu(), PL_EDIT_TOOL::DoDelete(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), PCB_TOOL_BASE::doInteractiveItemPlacement(), EDIT_TOOL::doMoveSelection(), PL_SELECTION_TOOL::doSelectionMenu(), EE_SELECTION_TOOL::doSelectionMenu(), PCB_SELECTION_TOOL::doSelectionMenu(), COMMON_TOOLS::doZoomFit(), COMMON_TOOLS::doZoomInOut(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), PL_DRAWING_TOOLS::DrawShape(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), EE_SELECTION_TOOL::GetNode(), ROUTER_TOOL::getStartLayer(), PCB_CONTROL::GridResetOrigin(), PCB_CONTROL::GridSetOrigin(), ROUTER_TOOL::handleCommonEvents(), PL_SELECTION_TOOL::highlight(), EE_SELECTION_TOOL::highlight(), PCB_SELECTION_TOOL::highlight(), GERBVIEW_CONTROL::HighlightControl(), PNS::TOOL_BASE::highlightNet(), highlightNet(), PCB_SELECTION_TOOL::hitTestDistance(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), ROUTER_TOOL::InlineDrag(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::MoveExact(), SCH_MOVE_TOOL::moveItem(), PL_EDIT_TOOL::moveItem(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), COMMON_TOOLS::PanControl(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), PL_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), ROUTER_TOOL::performRouting(), PNS::TOOL_BASE::pickSingleItem(), BOARD_EDITOR_CONTROL::PlaceFootprint(), PL_DRAWING_TOOLS::PlaceItem(), BOARD_EDITOR_CONTROL::PlaceTarget(), ROUTER_TOOL::prepareInteractive(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), EDIT_TOOL::Remove(), BOARD_EDITOR_CONTROL::Reset(), PNS::TOOL_BASE::Reset(), PCB_CONTROL::Reset(), GERBVIEW_SELECTION_TOOL::Reset(), DRAWING_TOOL::Reset(), EE_SELECTION_TOOL::Reset(), PCB_SELECTION_TOOL::Reset(), EE_TOOL_BASE< SCH_BASE_FRAME >::Reset(), SCH_EDIT_TOOL::Rotate(), GERBVIEW_SELECTION_TOOL::select(), GERBVIEW_SELECTION_TOOL::selectable(), PCB_SELECTION_TOOL::Selectable(), PCB_SELECTION_TOOL::SelectAll(), EE_SELECTION_TOOL::SelectAll(), PL_SELECTION_TOOL::selectionContains(), EE_SELECTION_TOOL::selectionContains(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PL_SELECTION_TOOL::SelectPoint(), ZOOM_TOOL::selectRegion(), GERBVIEW_SELECTION_TOOL::selectVisually(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SCH_EDITOR_CONTROL::ToggleHiddenFields(), SCH_EDITOR_CONTROL::ToggleHiddenPins(), SCH_DRAWING_TOOLS::TwoClickPlace(), PL_SELECTION_TOOL::unhighlight(), EE_SELECTION_TOOL::unhighlight(), PCB_SELECTION_TOOL::unhighlight(), GERBVIEW_SELECTION_TOOL::unselect(), GERBVIEW_SELECTION_TOOL::unselectVisually(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), SCH_EDITOR_CONTROL::UpdateFind(), PL_POINT_EDITOR::updateItem(), PCB_POINT_EDITOR::updateItem(), EE_TOOL_BASE< SCH_BASE_FRAME >::updateItem(), SCH_EDITOR_CONTROL::UpdateNetHighlighting(), EE_POINT_EDITOR::updateParentItem(), EE_POINT_EDITOR::updatePoints(), PL_POINT_EDITOR::updatePoints(), PCB_POINT_EDITOR::updatePoints(), PCB_SELECTION_TOOL::updateSelection(), PNS::TOOL_BASE::updateStartItem(), PCB_VIEWER_TOOLS::view(), PCB_TOOL_BASE::view(), PCB_SELECTION_TOOL::zoomFitSelection(), EE_SELECTION_TOOL::~EE_SELECTION_TOOL(), GERBVIEW_SELECTION_TOOL::~GERBVIEW_SELECTION_TOOL(), and PCB_SELECTION_TOOL::~PCB_SELECTION_TOOL().

◆ getViewControls()

KIGFX::VIEW_CONTROLS * TOOL_BASE::getViewControls ( ) const
protectedinherited

Return 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:214
KIGFX::VIEW_CONTROLS * GetViewControls() const
Definition: tool_manager.h:285

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

Referenced by EE_POINT_EDITOR::addCorner(), PCB_POINT_EDITOR::addCorner(), EE_POINT_EDITOR::addCornerCondition(), SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDIT_TOOL::BreakWire(), PCB_TOOL_BASE::controls(), EDIT_TOOL::copyToClipboard(), SCH_DRAWING_TOOLS::createSheetPin(), COMMON_TOOLS::CursorControl(), SCH_LINE_WIRE_BUS_TOOL::doDrawSegments(), EDIT_TOOL::doMoveSelection(), SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus(), COMMON_TOOLS::doZoomToPreset(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::DrawCircle(), DRAWING_TOOL::DrawLine(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::DrawRectangle(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), PAD_TOOL::EnumeratePads(), SCH_LINE_WIRE_BUS_TOOL::finishSegments(), SCH_DRAWING_TOOLS::GetCanvasFreeAreaPixels(), HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), SCH_EDIT_TOOL::Init(), EDIT_TOOL::Init(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), PL_POINT_EDITOR::Main(), SCH_MOVE_TOOL::Main(), EE_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), ROUTER_TOOL::performDragging(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_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(), PCB_POINT_EDITOR::Reset(), DRAWING_TOOL::Reset(), COMMON_TOOLS::ResetLocalCoords(), GERBVIEW_SELECTION_TOOL::selectCursor(), PCB_SELECTION_TOOL::selectCursor(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::SelectNode(), ZOOM_TOOL::selectRegion(), ALIGN_DISTRIBUTE_TOOL::selectTarget(), PCB_PICKER_TOOL::setControls(), PICKER_TOOL::setControls(), EE_POINT_EDITOR::setEditedPoint(), PL_POINT_EDITOR::setEditedPoint(), PCB_POINT_EDITOR::setEditedPoint(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), EE_POINT_EDITOR::updateEditedPoint(), PL_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateEditedPoint(), PCB_POINT_EDITOR::updateItem(), PL_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

Define which state (aStateFunc) to go when a certain event arrives (aConditions).

No conditions means any event.

Definition at line 147 of file tool_interactive.h.

149 {
150  TOOL_STATE_FUNC sptr = std::bind( aStateFunc, static_cast<T*>( this ), std::placeholders::_1 );
151 
152  goInternal( sptr, aConditions );
153 }
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 AUTOPLACE_TOOL::setTransitions(), ZOOM_TOOL::setTransitions(), LENGTH_TUNER_TOOL::setTransitions(), BOARD_REANNOTATE_TOOL::setTransitions(), GERBVIEW_INSPECTION_TOOL::setTransitions(), ROUTER_TOOL::setTransitions(), PCB_PICKER_TOOL::setTransitions(), SCH_NAVIGATE_TOOL::setTransitions(), SYMBOL_EDITOR_PIN_TOOL::setTransitions(), SYMBOL_EDITOR_MOVE_TOOL::setTransitions(), PL_DRAWING_TOOLS::setTransitions(), EE_POINT_EDITOR::setTransitions(), PL_POINT_EDITOR::setTransitions(), SCRIPTING_TOOL::setTransitions(), KICAD_MANAGER_CONTROL::setTransitions(), COMMON_CONTROL::setTransitions(), CONVERT_TOOL::setTransitions(), SYMBOL_EDITOR_DRAWING_TOOLS::setTransitions(), ZONE_FILLER_TOOL::setTransitions(), PCB_VIEWER_TOOLS::setTransitions(), MICROWAVE_TOOL::setTransitions(), EE_INSPECTION_TOOL::setTransitions(), PAD_TOOL::setTransitions(), PCB_POINT_EDITOR::setTransitions(), GERBVIEW_CONTROL::setTransitions(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::setTransitions(), GLOBAL_EDIT_TOOL::setTransitions(), GROUP_TOOL::setTransitions(), PL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_CONTROL::setTransitions(), SYMBOL_EDITOR_EDIT_TOOL::setTransitions(), SCH_MOVE_TOOL::setTransitions(), PL_EDIT_TOOL::setTransitions(), POSITION_RELATIVE_TOOL::setTransitions(), GERBVIEW_SELECTION_TOOL::setTransitions(), SCH_DRAWING_TOOLS::setTransitions(), FOOTPRINT_EDITOR_CONTROL::setTransitions(), SCH_EDIT_TOOL::setTransitions(), ALIGN_DISTRIBUTE_TOOL::setTransitions(), COMMON_TOOLS::setTransitions(), EDA_3D_CONTROLLER::setTransitions(), PCB_CONTROL::setTransitions(), DRC_TOOL::setTransitions(), CVPCB_CONTROL::setTransitions(), SCH_LINE_WIRE_BUS_TOOL::setTransitions(), CVPCB_ASSOCIATION_TOOL::setTransitions(), setTransitions(), BOARD_EDITOR_CONTROL::setTransitions(), PICKER_TOOL::setTransitions(), EDIT_TOOL::setTransitions(), PCB_SELECTION_TOOL::setTransitions(), PL_SELECTION_TOOL::setTransitions(), SCH_EDITOR_CONTROL::setTransitions(), DRAWING_TOOL::setTransitions(), and EE_SELECTION_TOOL::setTransitions().

◆ HideDynamicRatsnest()

int BOARD_INSPECTION_TOOL::HideDynamicRatsnest ( const TOOL_EVENT aEvent)

Show local ratsnest of a component.

Definition at line 1252 of file board_inspection_tool.cpp.

1253 {
1254  getModel<BOARD>()->GetConnectivity()->ClearDynamicRatsnest();
1255  delete m_dynamicData;
1256  m_dynamicData = nullptr;
1257 
1258  return 0;
1259 }
CONNECTIVITY_DATA * m_dynamicData

References m_dynamicData.

Referenced by setTransitions().

◆ HideNet()

int BOARD_INSPECTION_TOOL::HideNet ( const TOOL_EVENT aEvent)

Show the ratsnest for a given net.

Definition at line 1384 of file board_inspection_tool.cpp.

1385 {
1386  doHideNet( aEvent.Parameter<intptr_t>(), true );
1387  return 0;
1388 }
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
void doHideNet(int aNetCode, bool aHide)
Bind handlers to corresponding TOOL_ACTIONs.

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

Referenced by setTransitions().

◆ HighlightItem()

int BOARD_INSPECTION_TOOL::HighlightItem ( const TOOL_EVENT aEvent)

Update ratsnest for selected items.

Definition at line 871 of file board_inspection_tool.cpp.

872 {
873  BOARD_ITEM* item = aEvent.Parameter<BOARD_ITEM*>();
874 
875  m_probingSchToPcb = true; // recursion guard
876  {
878 
879  if( item )
880  m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, (void*) item );
881  }
882  m_probingSchToPcb = false;
883 
884  bool request3DviewRedraw = frame()->GetDisplayOptions().m_Live3DRefresh;
885 
886  if( item && item->Type() != PCB_FOOTPRINT_T )
887  request3DviewRedraw = false;
888 
889  // Update 3D viewer highlighting
890  if( request3DviewRedraw )
891  m_frame->Update3DView( false, true );
892 
893  return 0;
894 }
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:59
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
PCB_BASE_EDIT_FRAME * frame() const
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
class FOOTPRINT, a footprint
Definition: typeinfo.h:88
bool m_Live3DRefresh
If true, 3D viewer will redraw on every modification operation.
virtual void Update3DView(bool aMarkDirty, bool aRefresh, const wxString *aTitle=nullptr)
Update the 3D view, if the viewer is opened by this frame.
static TOOL_ACTION selectItem
Select an item (specified as the event parameter).
Definition: pcb_actions.h:62
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References PCB_TOOL_BASE::frame(), PCB_BASE_FRAME::GetDisplayOptions(), m_frame, PCB_DISPLAY_OPTIONS::m_Live3DRefresh, m_probingSchToPcb, TOOL_BASE::m_toolMgr, TOOL_EVENT::Parameter(), PCB_FOOTPRINT_T, TOOL_MANAGER::RunAction(), PCB_ACTIONS::selectionClear, PCB_ACTIONS::selectItem, EDA_ITEM::Type(), and PCB_BASE_FRAME::Update3DView().

Referenced by setTransitions().

◆ HighlightNet()

int BOARD_INSPECTION_TOOL::HighlightNet ( const TOOL_EVENT aEvent)

Clear all board highlights.

Definition at line 1042 of file board_inspection_tool.cpp.

1043 {
1044  int netcode = aEvent.Parameter<intptr_t>();
1046  const std::set<int>& highlighted = settings->GetHighlightNetCodes();
1047 
1048  if( netcode > 0 )
1049  {
1050  m_lastHighlighted = highlighted;
1051  settings->SetHighlight( true, netcode );
1053  m_currentlyHighlighted.clear();
1054  m_currentlyHighlighted.insert( netcode );
1055  }
1056  else if( aEvent.IsAction( &PCB_ACTIONS::highlightNetSelection ) )
1057  {
1058  // Highlight selection (cursor position will be ignored)
1059  highlightNet( getViewControls()->GetMousePosition(), true );
1060  }
1061  else if( aEvent.IsAction( &PCB_ACTIONS::toggleLastNetHighlight ) )
1062  {
1063  std::set<int> temp = highlighted;
1064  settings->SetHighlight( m_lastHighlighted );
1067  m_lastHighlighted = temp;
1068  }
1069  else if( aEvent.IsAction( &PCB_ACTIONS::toggleNetHighlight ) )
1070  {
1071  bool turnOn = highlighted.empty() && !m_currentlyHighlighted.empty();
1072  settings->SetHighlight( m_currentlyHighlighted, turnOn );
1074  }
1075  else // Highlight the net belonging to the item under the cursor
1076  {
1077  highlightNet( getViewControls()->GetMousePosition(), false );
1078  }
1079 
1080  return 0;
1081 }
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:283
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
static TOOL_ACTION toggleLastNetHighlight
Definition: pcb_actions.h:450
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
static TOOL_ACTION toggleNetHighlight
Definition: pcb_actions.h:451
bool IsAction(const TOOL_ACTION *aAction) const
Test if the event contains an action issued upon activation of the given TOOL_ACTION.
Definition: tool_event.cpp:88
std::set< int > m_currentlyHighlighted
std::set< int > m_lastHighlighted
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
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...
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
static TOOL_ACTION highlightNetSelection
Definition: pcb_actions.h:452
const std::set< int > & GetHighlightNetCodes() const
Return the netcode of currently highlighted net.
KIGFX::VIEW_CONTROLS * getViewControls() const
Return the instance of VIEW_CONTROLS object used in the application.
Definition: tool_base.cpp:42
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition: view.cpp:775

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

Referenced by setTransitions().

◆ highlightNet()

bool BOARD_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 897 of file board_inspection_tool.cpp.

898 {
899  BOARD* board = static_cast<BOARD*>( m_toolMgr->GetModel() );
902 
903  int net = -1;
904  bool enableHighlight = false;
905 
906  if( aUseSelection )
907  {
908  const PCB_SELECTION& selection = selectionTool->GetSelection();
909  std::set<int> netcodes;
910 
911  for( auto item : selection )
912  {
913  if( auto ci = dyn_cast<BOARD_CONNECTED_ITEM*>( item ) )
914  netcodes.insert( ci->GetNetCode() );
915  }
916 
917  enableHighlight = !netcodes.empty();
918 
919  if( enableHighlight && netcodes.size() > 1 )
920  {
921  // If we are doing a multi-highlight, cross-probing back and other stuff is not
922  // yet supported
923  settings->SetHighlight( netcodes );
925 
926  for( int multiNet : netcodes )
927  board->SetHighLightNet( multiNet, true );
928 
929  board->HighLightON();
931  m_currentlyHighlighted = netcodes;
932  return true;
933  }
934  else if( enableHighlight )
935  {
936  net = *netcodes.begin();
937  }
938  }
939 
940  // If we didn't get a net to highlight from the selection, use the cursor
941  if( net < 0 )
942  {
944  GENERAL_COLLECTOR collector;
945 
946  PCB_LAYER_ID activeLayer = static_cast<PCB_LAYER_ID>( view()->GetTopLayer() );
947  guide.SetPreferredLayer( activeLayer );
948 
949  // Find a connected item for which we are going to highlight a net
950  collector.Collect( board, GENERAL_COLLECTOR::PadsOrTracks, (wxPoint) aPosition, guide );
951 
952  if( collector.GetCount() == 0 )
953  collector.Collect( board, GENERAL_COLLECTOR::Zones, (wxPoint) aPosition, guide );
954 
955  // Apply the active selection filter, except we want to allow picking locked items for
956  // highlighting even if the user has disabled them for selection
957  SELECTION_FILTER_OPTIONS& filter = selectionTool->GetFilter();
958 
959  bool saved = filter.lockedItems;
960  filter.lockedItems = true;
961 
962  selectionTool->FilterCollectedItems( collector );
963 
964  filter.lockedItems = saved;
965 
966  // Clear the previous highlight
967  m_frame->SendMessageToEESCHEMA( nullptr );
968 
969  bool highContrast = settings->GetHighContrast();
970  PCB_LAYER_ID contrastLayer = settings->GetPrimaryHighContrastLayer();
971 
972  for( int i = collector.GetCount() - 1; i >= 0; i-- )
973  {
974  LSET itemLayers = collector[i]->GetLayerSet();
975 
976  if( ( itemLayers & LSET::AllCuMask() ).none() ||
977  ( highContrast && !itemLayers.Contains( contrastLayer ) ) )
978  {
979  collector.Remove( i );
980  continue;
981  }
982  }
983 
984  enableHighlight = ( collector.GetCount() > 0 );
985 
986  // Obtain net code for the clicked item
987  if( enableHighlight )
988  {
989  BOARD_CONNECTED_ITEM* targetItem = static_cast<BOARD_CONNECTED_ITEM*>( collector[0] );
990 
991  if( targetItem->Type() == PCB_PAD_T )
992  m_frame->SendMessageToEESCHEMA( targetItem );
993 
994  net = targetItem->GetNetCode();
995  }
996  }
997 
998  auto& netcodes = settings->GetHighlightNetCodes();
999 
1000  // Toggle highlight when the same net was picked
1001  if( net > 0 && netcodes.count( net ) )
1002  enableHighlight = !settings->IsHighlightEnabled();
1003 
1004  if( enableHighlight != settings->IsHighlightEnabled() || !netcodes.count( net ) )
1005  {
1006  if( !netcodes.empty() )
1007  m_lastHighlighted = netcodes;
1008 
1009  settings->SetHighlight( enableHighlight, net );
1011  }
1012 
1013  // Store the highlighted netcode in the current board (for dialogs for instance)
1014  if( enableHighlight && net >= 0 )
1015  {
1016  m_currentlyHighlighted = netcodes;
1017  board->SetHighLightNet( net );
1018  board->HighLightON();
1019 
1020  NETINFO_ITEM* netinfo = board->FindNet( net );
1021 
1022  if( netinfo )
1023  {
1024  MSG_PANEL_ITEMS items;
1025  netinfo->GetMsgPanelInfo( m_frame, items );
1026  m_frame->SetMsgPanel( items );
1027  m_frame->SendCrossProbeNetName( netinfo->GetNetname() );
1028  }
1029  }
1030  else
1031  {
1032  m_currentlyHighlighted.clear();
1036  }
1037 
1038  return true;
1039 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
NETINFO_ITEM * FindNet(int aNetcode) const
Search for a net with the given netcode.
Definition: board.cpp:1344
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:283
void SendCrossProbeNetName(const wxString &aNetName)
Send a net name to Eeschema for highlighting.
BOARD * board() const
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
void HighLightON(bool aValue=true)
Enable or disable net highlighting.
Definition: board.cpp:2043
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:571
bool Contains(PCB_LAYER_ID aLayer)
See if the layer set contains a PCB layer.
Definition: layer_ids.h:573
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
class PAD, a pad in a footprint
Definition: typeinfo.h:89
static const KICAD_T PadsOrTracks[]
A scan list for PADs, TRACKs, or VIAs.
Definition: collectors.h:288
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
EDA_ITEM * GetModel() const
Definition: tool_manager.h:290
void Remove(int aIndex)
Remove the item at aIndex (first position is 0).
Definition: collector.h:115
PAINTER * GetPainter() const
Return the painter object used by the view for drawing #VIEW_ITEMS.
Definition: view.h:208
std::set< int > m_currentlyHighlighted
int GetCount() const
Return the number of objects in the list.
Definition: collector.h:87
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
std::set< int > m_lastHighlighted
void SetPreferredLayer(PCB_LAYER_ID aLayer)
Definition: collectors.h:471
GENERAL_COLLECTORS_GUIDE GetCollectorsGuide()
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:502
void ResetNetHighLight()
Reset all high light data to the init state.
Definition: board.cpp:2021
const PCB_SELECTION & selection() const
void SetMsgPanel(const std::vector< MSG_PANEL_ITEM > &aList)
Clear the message panel and populates it with the contents of aList.
KIGFX::PCB_VIEW * view() const
static const KICAD_T Zones[]
A scan list for zones outlines only.
Definition: collectors.h:272
const wxString & GetNetname() const
Definition: netinfo.h:119
This file contains data structures that are saved in the project file or project local settings file ...
void SetHighLightNet(int aNetCode, bool aMulti=false)
Select the netcode to be highlighted.
Definition: board.cpp:2030
KIGFX::VIEW * getView() const
Returns the instance of #VIEW object used in the application.
Definition: tool_base.cpp:36
void SendMessageToEESCHEMA(BOARD_ITEM *objectToSync)
Send a message to the schematic editor so that it may move its cursor to a symbol with the same refer...
virtual RENDER_SETTINGS * GetSettings()=0
Return a pointer to current settings that are going to be used when drawing items.
Handle the data for a net.
Definition: netinfo.h:64
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64
Used when the right click button is pressed, or when the select tool is in effect.
Definition: collectors.h:240
The selection tool: currently supports:
std::vector< MSG_PANEL_ITEM > MSG_PANEL_ITEMS
Definition: msgpanel.h:97
SELECTION_FILTER_OPTIONS & GetFilter()
Set up handlers for various events.
A general implementation of a COLLECTORS_GUIDE.
Definition: collectors.h:377
void GetMsgPanelInfo(EDA_DRAW_FRAME *aFrame, std::vector< MSG_PANEL_ITEM > &aList) override
Return the information about the NETINFO_ITEM in aList to display in the message panel.
void UpdateAllLayersColor()
Apply the new coloring scheme to all layers.
Definition: view.cpp:775
void FilterCollectedItems(GENERAL_COLLECTOR &aCollector)
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References LSET::AllCuMask(), PCB_TOOL_BASE::board(), GENERAL_COLLECTOR::Collect(), LSET::Contains(), filter, PCB_SELECTION_TOOL::FilterCollectedItems(), BOARD::FindNet(), PCB_BASE_FRAME::GetCollectorsGuide(), COLLECTOR::GetCount(), PCB_SELECTION_TOOL::GetFilter(), TOOL_MANAGER::GetModel(), NETINFO_ITEM::GetMsgPanelInfo(), BOARD_CONNECTED_ITEM::GetNetCode(), NETINFO_ITEM::GetNetname(), KIGFX::VIEW::GetPainter(), PCB_SELECTION_TOOL::GetSelection(), KIGFX::PAINTER::GetSettings(), TOOL_MANAGER::GetTool(), TOOL_BASE::getView(), TOOL_MANAGER::GetView(), BOARD::HighLightON(), m_currentlyHighlighted, m_frame, m_lastHighlighted, 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(), GENERAL_COLLECTORS_GUIDE::SetPreferredLayer(), EDA_ITEM::Type(), KIGFX::VIEW::UpdateAllLayersColor(), PCB_TOOL_BASE::view(), and GENERAL_COLLECTOR::Zones.

Referenced by HighlightNet().

◆ HighlightNetTool()

int BOARD_INSPECTION_TOOL::HighlightNetTool ( const TOOL_EVENT aEvent)

Perform the appropriate action in response to an Eeschema cross-probe.

◆ Init()

bool BOARD_INSPECTION_TOOL::Init ( void  )
overridevirtual

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 75 of file board_inspection_tool.cpp.

76 {
78 
79  auto netSubMenu = std::make_shared<NET_CONTEXT_MENU>();
80  netSubMenu->SetTool( this );
81 
82  static KICAD_T connectedTypes[] = { PCB_TRACE_T, PCB_VIA_T, PCB_ARC_T, PCB_PAD_T, PCB_ZONE_T,
83  EOT };
84 
85  CONDITIONAL_MENU& menu = selectionTool->GetToolMenu().GetMenu();
86 
87  selectionTool->GetToolMenu().AddSubMenu( netSubMenu );
88 
89  menu.AddMenu( netSubMenu.get(), SELECTION_CONDITIONS::OnlyTypes( connectedTypes ), 200 );
91 
92  return true;
93 }
void AddMenu(ACTION_MENU *aMenu, const SELECTION_CONDITION &aCondition=SELECTION_CONDITIONS::ShowAlways, int aOrder=ANY_ORDER)
Add a submenu to the menu.
static SELECTION_CONDITION OnlyTypes(const KICAD_T aTypes[])
Create a functor that tests if the selected items are only of given types.
CONDITIONAL_MENU & GetMenu()
Definition: tool_menu.cpp:46
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
TOOL_MENU & GetToolMenu()
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
class PAD, a pad in a footprint
Definition: typeinfo.h:89
static SELECTION_CONDITION Count(int aNumber)
Create 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:81
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition: typeinfo.h:77
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
class ZONE, a copper pour area
Definition: typeinfo.h:105
static TOOL_ACTION inspectClearance
Definition: pcb_actions.h:444
void AddSubMenu(std::shared_ptr< ACTION_MENU > aSubMenu)
Store a submenu of this menu model.
Definition: tool_menu.cpp:52
The selection tool: currently supports:
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
void AddItem(const TOOL_ACTION &aAction, const SELECTION_CONDITION &aCondition, int aOrder=ANY_ORDER)
Add 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_T.

◆ InspectClearance()

int BOARD_INSPECTION_TOOL::InspectClearance ( const TOOL_EVENT aEvent)

Definition at line 257 of file board_inspection_tool.cpp.

258 {
260  const PCB_SELECTION& selection = selTool->GetSelection();
261 
262  if( selection.Size() != 2 )
263  {
264  m_frame->ShowInfoBarError( _( "Select two items for a clearance resolution report." ) );
265  return 0;
266  }
267 
268  BOARD_ITEM* a = static_cast<BOARD_ITEM*>( selection.GetItem( 0 ) );
269  BOARD_ITEM* b = static_cast<BOARD_ITEM*>( selection.GetItem( 1 ) );
270 
271  wxCHECK( a && b, 0 );
272 
273  if( a->Type() == PCB_GROUP_T )
274  {
275  PCB_GROUP* ag = static_cast<PCB_GROUP*>( a );
276 
277  if( ag->GetItems().empty() )
278  {
279  m_frame->ShowInfoBarError( _( "Cannot generate clearance report on empty group." ) );
280  return 0;
281  }
282 
283  a = *ag->GetItems().begin();
284  }
285 
286  if( b->Type() == PCB_GROUP_T )
287  {
288  PCB_GROUP* bg = static_cast<PCB_GROUP*>( b );
289 
290  if( bg->GetItems().empty() )
291  {
292  m_frame->ShowInfoBarError( _( "Cannot generate clearance report on empty group." ) );
293  return 0;
294  }
295 
296  b = *bg->GetItems().begin();
297  }
298 
299  // a and b could be null after group tests above.
300  wxCHECK( a && b, 0 );
301 
302  if( m_inspectClearanceDialog == nullptr )
303  {
304  m_inspectClearanceDialog = std::make_unique<DIALOG_CONSTRAINTS_REPORTER>( m_frame );
305  m_inspectClearanceDialog->SetTitle( _( "Clearance Report" ) );
306 
307  m_inspectClearanceDialog->Connect( wxEVT_CLOSE_WINDOW,
309  nullptr, this );
310  }
311 
312  WX_HTML_REPORT_BOX* r = nullptr;
313  EDA_UNITS units = m_frame->GetUserUnits();
314 
315  m_inspectClearanceDialog->DeleteAllPages();
316 
317  if( a->Type() != PCB_ZONE_T && b->Type() == PCB_ZONE_T )
318  std::swap( a, b );
319  else if( !a->IsConnected() && b->IsConnected() )
320  std::swap( a, b );
321 
322  PCB_LAYER_ID active = m_frame->GetActiveLayer();
323  LSET layerIntersection = a->GetLayerSet() & b->GetLayerSet();
324  LSET copperIntersection = layerIntersection & LSET::AllCuMask();
325  BOARD_CONNECTED_ITEM* ac = dynamic_cast<BOARD_CONNECTED_ITEM*>( a );
326  BOARD_CONNECTED_ITEM* bc = dynamic_cast<BOARD_CONNECTED_ITEM*>( b );
327  ZONE* zone = dynamic_cast<ZONE*>( a );
328  PAD* pad = dynamic_cast<PAD*>( b );
329  FOOTPRINT* aFP = dynamic_cast<FOOTPRINT*>( a );
330  FOOTPRINT* bFP = dynamic_cast<FOOTPRINT*>( b );
331 
333  bool compileError = false;
334  DRC_CONSTRAINT constraint;
335  int clearance = 0;
336 
337  try
338  {
339  drcEngine.InitEngine( m_frame->GetDesignRulesPath() );
340  }
341  catch( PARSE_ERROR& )
342  {
343  compileError = true;
344  }
345 
346  for( ZONE* z : m_frame->GetBoard()->Zones() )
347  z->CacheBoundingBox();
348 
349  for( FOOTPRINT* f : m_frame->GetBoard()->Footprints() )
350  {
351  for( ZONE* z : f->Zones() )
352  z->CacheBoundingBox();
353 
354  f->BuildPolyCourtyards();
355  }
356 
357  auto hasHole =
358  []( BOARD_ITEM* aItem )
359  {
360  PAD* tmpPad = dynamic_cast<PAD*>( aItem );
361 
362  if( tmpPad && tmpPad->GetDrillSizeX() > 0 && tmpPad->GetDrillSizeY() > 0 )
363  return true;
364 
365  PCB_VIA* via = dynamic_cast<PCB_VIA*>( aItem );
366 
367  if( via )
368  return true;
369 
370  return false;
371  };
372 
373  if( copperIntersection.any() && zone && pad && zone->GetNetCode() == pad->GetNetCode() )
374  {
375  PCB_LAYER_ID layer = active;
376  wxString source;
377 
378  if( !zone->IsOnLayer( active ) )
379  layer = zone->GetLayerSet().Seq().front();
380 
381  r = m_inspectClearanceDialog->AddPage( _( "Zone" ) );
382 
383  r->Report( "<h7>" + _( "Zone connection resolution for:" ) + "</h7>" );
384  r->Report( wxString::Format( "<ul><li>%s %s</li><li>%s</li><li>%s</li></ul>",
385  _( "Layer" ),
386  EscapeHTML( m_frame->GetBoard()->GetLayerName( layer ) ),
388  EscapeHTML( getItemDescription( b ) ) ) );
389 
390  ZONE_CONNECTION zoneConnection = zone->GetPadConnection( pad );
391 
392  if( zoneConnection == ZONE_CONNECTION::THERMAL )
393  {
394  int gap = zone->GetThermalReliefGap();
395 
396  r->Report( "" );
397  r->Report( wxString::Format( _( "Zone thermal relief: %s." ),
398  StringFromValue( r->GetUnits(), gap, true ) ) );
399 
400  gap = zone->GetThermalReliefGap( pad, &source );
401 
402  if( source != _( "zone" ) )
403  {
404  r->Report( wxString::Format( _( "Overridden by %s; thermal relief: %s." ),
405  source,
406  StringFromValue( r->GetUnits(), gap, true ) ) );
407  }
408  }
409  else if( zoneConnection == ZONE_CONNECTION::NONE )
410  {
411  clearance = zone->GetLocalClearance();
412 
413  r->Report( "" );
414  r->Report( wxString::Format( _( "Zone clearance: %s." ),
415  StringFromValue( r->GetUnits(), clearance, true ) ) );
416 
417  if( zone->GetThermalReliefGap( pad ) > clearance )
418  {
419  clearance = zone->GetThermalReliefGap( pad, &source );
420 
421  if( source != _( "zone" ) )
422  {
423  r->Report( wxString::Format( _( "Overridden by larger thermal relief from %s;"
424  "clearance: %s." ),
425  source,
426  StringFromValue( r->GetUnits(), clearance, true ) ) );
427  }
428  }
429 
430  if( compileError )
431  reportCompileError( r );
432 
433  r->Report( "" );
434  r->Report( wxString::Format( _( "Clearance: %s." ),
435  StringFromValue( units, 0, true ) ) );
436  }
437  else
438  {
439  if( compileError )
440  reportCompileError( r );
441 
442  // Report a 0 clearance for solid connections
443  r->Report( "" );
444  r->Report( wxString::Format( _( "Clearance: %s." ),
445  StringFromValue( units, 0, true ) ) );
446  }
447 
448  r->Flush();
449  }
450  else if( copperIntersection.any() && !aFP && !bFP )
451  {
452  PCB_LAYER_ID layer = active;
453 
454  if( !copperIntersection.test( layer ) )
455  layer = copperIntersection.Seq().front();
456 
457  r = m_inspectClearanceDialog->AddPage( m_frame->GetBoard()->GetLayerName( layer ) );
458 
459  r->Report( "<h7>" + _( "Clearance resolution for:" ) + "</h7>" );
460  r->Report( wxString::Format( "<ul><li>%s %s</li><li>%s</li><li>%s</li></ul>",
461  _( "Layer" ),
462  EscapeHTML( m_frame->GetBoard()->GetLayerName( layer ) ),
464  EscapeHTML( getItemDescription( b ) ) ) );
465 
466  if( ac && bc && ac->GetNetCode() > 0 && ac->GetNetCode() == bc->GetNetCode() )
467  {
468  // Same nets....
469  r->Report( _( "Items belong to the same net. Clearance is 0." ) );
470  }
471  else
472  {
473  // Different nets (or one or both unconnected)....
474  constraint = drcEngine.EvalRules( CLEARANCE_CONSTRAINT, a, b, layer, r );
475  clearance = constraint.m_Value.Min();
476 
477  if( compileError )
478  reportCompileError( r );
479 
480  r->Report( "" );
481  r->Report( wxString::Format( _( "Resolved clearance: %s." ),
482  StringFromValue( units, clearance, true ) ) );
483  }
484 
485  r->Flush();
486  }
487 
488  for( PCB_LAYER_ID layer : { F_SilkS, B_SilkS } )
489  {
490  PCB_LAYER_ID correspondingMask = IsFrontLayer( layer ) ? F_Mask : B_Mask;
491 
492  if( ( a->IsOnLayer( layer ) && b->IsOnLayer( layer ) )
493  || ( a->IsOnLayer( layer ) && b->IsOnLayer( correspondingMask ) )
494  || ( b->IsOnLayer( layer ) && a->IsOnLayer( correspondingMask ) ) )
495  {
496  r = m_inspectClearanceDialog->AddPage( m_frame->GetBoard()->GetLayerName( layer ) );
497 
498  r->Report( "<h7>" + _( "Silkscreen clearance resolution for:" ) + "</h7>" );
499  r->Report( wxString::Format( "<ul><li>%s %s</li><li>%s</li><li>%s</li></ul>",
500  _( "Layer" ),
501  EscapeHTML( m_frame->GetBoard()->GetLayerName( layer ) ),
503  EscapeHTML( getItemDescription( b ) ) ) );
504 
505  constraint = drcEngine.EvalRules( SILK_CLEARANCE_CONSTRAINT, a, b, layer, r );
506  clearance = constraint.m_Value.Min();
507 
508  if( compileError )
509  reportCompileError( r );
510 
511  r->Report( "" );
512  r->Report( wxString::Format( _( "Resolved clearance: %s." ),
513  StringFromValue( units, clearance, true ) ) );
514 
515  r->Flush();
516  }
517  }
518 
519  for( PCB_LAYER_ID layer : { F_CrtYd, B_CrtYd } )
520  {
521  bool aCourtyard = aFP && !aFP->GetPolyCourtyard( layer ).IsEmpty();
522  bool bCourtyard = bFP && !bFP->GetPolyCourtyard( layer ).IsEmpty();
523 
524  if( aCourtyard && bCourtyard )
525  {
526  r = m_inspectClearanceDialog->AddPage( m_frame->GetBoard()->GetLayerName( layer ) );
527 
528  r->Report( "<h7>" + _( "Courtyard clearance resolution for:" ) + "</h7>" );
529  r->Report( wxString::Format( "<ul><li>%s %s</li><li>%s</li><li>%s</li></ul>",
530  _( "Layer" ),
531  EscapeHTML( m_frame->GetBoard()->GetLayerName( layer ) ),
533  EscapeHTML( getItemDescription( b ) ) ) );
534 
535  constraint = drcEngine.EvalRules( COURTYARD_CLEARANCE_CONSTRAINT, a, b, layer, r );
536  clearance = constraint.m_Value.Min();
537 
538  if( compileError )
539  reportCompileError( r );
540 
541  r->Report( "" );
542  r->Report( wxString::Format( _( "Resolved clearance: %s." ),
543  StringFromValue( units, clearance, true ) ) );
544 
545  r->Flush();
546  }
547  }
548 
549  if( hasHole( a ) || hasHole( b ) )
550  {
552 
553  if( hasHole( a ) && b->IsOnLayer( active ) && IsCopperLayer( active ) )
554  layer = active;
555  else if( hasHole( b ) && a->IsOnLayer( active ) && IsCopperLayer( active ) )
556  layer = active;
557  else if( hasHole( a ) && IsCopperLayer( b->GetLayer() ) )
558  layer = b->GetLayer();
559  else if( hasHole( b ) && IsCopperLayer( a->GetLayer() ) )
560  layer = a->GetLayer();
561 
562  if( layer >= 0 )
563  {
564  r = m_inspectClearanceDialog->AddPage( _( "Hole" ) );
565 
566  r->Report( "<h7>" + _( "Hole clearance resolution for:" ) + "</h7>" );
567  r->Report( wxString::Format( "<ul><li>%s %s</li><li>%s</li><li>%s</li></ul>",
568  _( "Layer" ),
569  EscapeHTML( m_frame->GetBoard()->GetLayerName( layer ) ),
571  EscapeHTML( getItemDescription( b ) ) ) );
572 
573  constraint = drcEngine.EvalRules( HOLE_CLEARANCE_CONSTRAINT, a, b, layer, r );
574  clearance = constraint.m_Value.Min();
575 
576  if( compileError )
577  reportCompileError( r );
578 
579  r->Report( "" );
580  r->Report( wxString::Format( _( "Resolved clearance: %s." ),
581  StringFromValue( units, clearance, true ) ) );
582 
583  r->Flush();
584  }
585  }
586 
587  for( PCB_LAYER_ID edgeLayer : { Edge_Cuts, Margin } )
588  {
590 
591  if( a->IsOnLayer( edgeLayer ) && b->IsOnLayer( active ) && IsCopperLayer( active ) )
592  layer = active;
593  else if( b->IsOnLayer( edgeLayer ) && a->IsOnLayer( active ) && IsCopperLayer( active ) )
594  layer = active;
595  else if( a->IsOnLayer( edgeLayer ) && IsCopperLayer( b->GetLayer() ) )
596  layer = b->GetLayer();
597  else if( b->IsOnLayer( edgeLayer ) && IsCopperLayer( a->GetLayer() ) )
598  layer = a->GetLayer();
599 
600  if( layer >= 0 )
601  {
602  wxString layerName = m_frame->GetBoard()->GetLayerName( edgeLayer );
603  r = m_inspectClearanceDialog->AddPage( layerName + wxS( " " ) + _( "Clearance" ) );
604 
605  r->Report( "<h7>" + _( "Edge clearance resolution for:" ) + "</h7>" );
606  r->Report( wxString::Format( "<ul><li>%s %s</li><li>%s</li><li>%s</li></ul>",
607  _( "Layer" ),
608  EscapeHTML( m_frame->GetBoard()->GetLayerName( layer ) ),
610  EscapeHTML( getItemDescription( b ) ) ) );
611 
612  constraint = drcEngine.EvalRules( EDGE_CLEARANCE_CONSTRAINT, a, b, layer, r );
613  clearance = constraint.m_Value.Min();
614 
615  if( compileError )
616  reportCompileError( r );
617 
618  r->Report( "" );
619  r->Report( wxString::Format( _( "Resolved clearance: %s." ),
620  StringFromValue( units, clearance, true ) ) );
621 
622  r->Flush();
623  }
624  }
625 
626  if( m_inspectClearanceDialog->GetPageCount() == 0 )
627  {
628  r = m_inspectClearanceDialog->AddPage( _( "Clearance" ) );
629  r->Report( "<h7>" + _( "Items share no relevant layers:" ) + "</h7>" );
630  r->Report( wxString::Format( "<ul><li>%s</li><li>%s</li></ul>",
632  EscapeHTML( getItemDescription( b ) ) ) );
633  r->Flush();
634  }
635 
636  m_inspectClearanceDialog->Raise();
637  m_inspectClearanceDialog->Show( true );
638  return 0;
639 }
static LSET AllCuMask(int aCuLayerCount=MAX_CU_LAYERS)
Return a mask holding the requested number of Cu PCB_LAYER_IDs.
Definition: lset.cpp:750
ZONE_CONNECTION
How pads are covered by copper in zone.
Definition: zones.h:41
Design Rule Checker object that performs all the DRC tests.
Definition: drc_engine.h:81
wxString getItemDescription(BOARD_ITEM *aItem)
const int GetDrillSizeX() const
Definition: pad.h:245
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:361
ZONES & Zones()
Definition: board.h:239
wxString GetDesignRulesPath()
Return the absolute path to the design rules file for the currently-loaded board.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
class PCB_GROUP, a set of BOARD_ITEMs
Definition: typeinfo.h:108
A slimmed down version of WX_HTML_REPORT_PANEL.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
A set of BOARD_ITEMs (i.e., without duplicates).
Definition: pcb_group.h:50
void Flush()
Build the HTML messages page.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool IsEmpty() const
virtual LSET GetLayerSet() const override
Return a std::bitset of all layers on which the item physically resides.
Definition: zone.cpp:291
virtual bool IsOnLayer(PCB_LAYER_ID) const override
Test to see if this object is on the given layer.
Definition: zone.cpp:316
T Min() const
Definition: minoptmax.h:33
LSEQ Seq(const PCB_LAYER_ID *aWishListSequence, unsigned aCount) const
Return an LSEQ from the union of this LSET and a desired sequence.
Definition: lset.cpp:411
std::unordered_set< BOARD_ITEM * > & GetItems()
Definition: pcb_group.h:68
A base class derived from BOARD_ITEM for items that can be connected and have a net,...
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:589
int GetThermalReliefGap() const
Definition: zone.h:191
virtual PCB_LAYER_ID GetActiveLayer() const
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
std::unique_ptr< DIALOG_CONSTRAINTS_REPORTER > m_inspectClearanceDialog
MINOPTMAX< int > m_Value
Definition: drc_rule.h:145
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
LSET is a set of PCB_LAYER_IDs.
Definition: layer_ids.h:502
const PCB_SELECTION & selection() const
virtual bool IsOnLayer(PCB_LAYER_ID aLayer) const
Test to see if this object is on the given layer.
Definition: board_item.h:229
void onInspectClearanceDialogClosed(wxCommandEvent &aEvent)
int GetLocalClearance(wxString *aSource) const override
Return any local clearances set in the "classic" (ie: pre-rule) system.
Definition: zone.cpp:494
FOOTPRINTS & Footprints()
Definition: board.h:233
#define _(s)
const SHAPE_POLY_SET & GetPolyCourtyard(PCB_LAYER_ID aLayer) const
Used in DRC to test the courtyard area (a complex polygon).
Definition: footprint.h:656
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
class ZONE, a copper pour area
Definition: typeinfo.h:105
void reportCompileError(REPORTER *r)
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a front layer.
Definition: layer_ids.h:863
bool IsCopperLayer(LAYER_NUM aLayerId)
Tests whether a layer is a copper layer.
Definition: layer_ids.h:787
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
EDA_UNITS
Definition: eda_units.h:38
Use thermal relief for pads.
EDA_UNITS GetUnits() const override
wxString EscapeHTML(const wxString &aString)
Return a new wxString escaped for embedding in HTML.
A filename or source description, a problem input line, a line number, a byte offset,...
Definition: ki_exception.h:118
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.cpp:52
const int GetDrillSizeY() const
Definition: pad.h:247
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64
int Size() const
Returns the number of selected parts.
Definition: selection.h:103
The selection tool: currently supports:
Pads are not covered.
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:204
virtual bool IsConnected() const
Returns information if the object is derived from BOARD_CONNECTED_ITEM.
Definition: board_item.h:134
BOARD * GetBoard() const
ZONE_CONNECTION GetPadConnection(PAD *aPad, wxString *aSource=nullptr) const
Definition: zone.cpp:774
Definition: pad.h:57
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:171
EDA_UNITS GetUserUnits() const
Return the user units currently in use.
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
Definition: board_item.h:176
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References _, LSET::AllCuMask(), B_CrtYd, B_Mask, B_SilkS, CLEARANCE_CONSTRAINT, COURTYARD_CLEARANCE_CONSTRAINT, EDGE_CLEARANCE_CONSTRAINT, Edge_Cuts, EscapeHTML(), F_CrtYd, F_Mask, F_SilkS, WX_HTML_REPORT_BOX::Flush(), BOARD::Footprints(), Format(), PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_EDIT_FRAME::GetDesignRulesPath(), BOARD::GetDesignSettings(), PAD::GetDrillSizeX(), PAD::GetDrillSizeY(), SELECTION::GetItem(), getItemDescription(), PCB_GROUP::GetItems(), BOARD_ITEM::GetLayer(), BOARD::GetLayerName(), ZONE::GetLayerSet(), BOARD_ITEM::GetLayerSet(), ZONE::GetLocalClearance(), BOARD_CONNECTED_ITEM::GetNetCode(), ZONE::GetPadConnection(), FOOTPRINT::GetPolyCourtyard(), PCB_SELECTION_TOOL::GetSelection(), ZONE::GetThermalReliefGap(), TOOL_MANAGER::GetTool(), WX_HTML_REPORT_BOX::GetUnits(), EDA_BASE_FRAME::GetUserUnits(), HOLE_CLEARANCE_CONSTRAINT, BOARD_ITEM::IsConnected(), IsCopperLayer(), SHAPE_POLY_SET::IsEmpty(), IsFrontLayer(), ZONE::IsOnLayer(), BOARD_ITEM::IsOnLayer(), m_frame, m_inspectClearanceDialog, TOOL_BASE::m_toolMgr, DRC_CONSTRAINT::m_Value, Margin, MINOPTMAX< T >::Min(), NONE, onInspectClearanceDialogClosed(), pad, PCB_GROUP_T, PCB_ZONE_T, WX_HTML_REPORT_BOX::Report(), reportCompileError(), PCB_TOOL_BASE::selection(), LSET::Seq(), EDA_BASE_FRAME::ShowInfoBarError(), SILK_CLEARANCE_CONSTRAINT, SELECTION::Size(), StringFromValue(), THERMAL, EDA_ITEM::Type(), UNDEFINED_LAYER, via, and BOARD::Zones().

Referenced by setTransitions().

◆ InspectConstraints()

int BOARD_INSPECTION_TOOL::InspectConstraints ( const TOOL_EVENT aEvent)

Definition at line 669 of file board_inspection_tool.cpp.

670 {
671 #define EVAL_RULES( constraint, a, b, layer, r ) drcEngine.EvalRules( constraint, a, b, layer, r )
672 
674  const PCB_SELECTION& selection = selTool->GetSelection();
675 
676  if( selection.Size() != 1 )
677  {
678  m_frame->ShowInfoBarError( _( "Select an item for a constraints resolution report." ) );
679  return 0;
680  }
681 
682  if( m_inspectConstraintsDialog == nullptr )
683  {
684  m_inspectConstraintsDialog = std::make_unique<DIALOG_CONSTRAINTS_REPORTER>( m_frame );
685  m_inspectConstraintsDialog->SetTitle( _( "Constraints Report" ) );
686 
687  m_inspectConstraintsDialog->Connect( wxEVT_CLOSE_WINDOW,
689  nullptr, this );
690  }
691 
692  m_inspectConstraintsDialog->DeleteAllPages();
693 
694  BOARD_ITEM* item = static_cast<BOARD_ITEM*>( selection.GetItem( 0 ) );
696  DRC_CONSTRAINT constraint;
697  bool courtyardError = false;
698  bool compileError = false;
699 
700  try
701  {
702  drcEngine.InitEngine( m_frame->GetDesignRulesPath() );
703  }
704  catch( PARSE_ERROR& )
705  {
706  compileError = true;
707  }
708 
709  for( ZONE* zone : m_frame->GetBoard()->Zones() )
710  zone->CacheBoundingBox();
711 
713  {
714  for( ZONE* zone : footprint->Zones() )
715  zone->CacheBoundingBox();
716 
718 
719  if( ( footprint->GetFlags() & MALFORMED_COURTYARDS ) != 0 )
720  courtyardError = true;
721  }
722 
723  WX_HTML_REPORT_BOX* r = nullptr;
724 
725  if( item->Type() == PCB_TRACE_T )
726  {
727  r = m_inspectConstraintsDialog->AddPage( _( "Track Width" ) );
728 
729  r->Report( "<h7>" + _( "Track width resolution for:" ) + "</h7>" );
730  r->Report( "<ul><li>" + EscapeHTML( getItemDescription( item ) ) + "</li></ul>" );
731  r->Report( "" );
732 
733  constraint = EVAL_RULES( TRACK_WIDTH_CONSTRAINT, item, nullptr, item->GetLayer(), r );
734 
735  if( compileError )
736  reportCompileError( r );
737 
738  r->Report( "" );
739  r->Report( wxString::Format( _( "Width constraints: min %s; opt %s; max %s." ),
740  reportMin( r->GetUnits(), constraint ),
741  reportOpt( r->GetUnits(), constraint ),
742  reportMax( r->GetUnits(), constraint ) ) );
743 
744  r->Flush();
745  }
746 
747  if( item->Type() == PCB_VIA_T )
748  {
749  r = m_inspectConstraintsDialog->AddPage( _( "Via Diameter" ) );
750 
751  r->Report( "<h7>" + _( "Via diameter resolution for:" ) + "</h7>" );
752  r->Report( "<ul><li>" + EscapeHTML( getItemDescription( item ) ) + "</li></ul>" );
753  r->Report( "" );
754 
755  // PADSTACKS TODO: once we have padstacks we'll need to run this per-layer....
756  constraint = EVAL_RULES( VIA_DIAMETER_CONSTRAINT, item, nullptr, UNDEFINED_LAYER, r );
757 
758  if( compileError )
759  reportCompileError( r );
760 
761  r->Report( "" );
762  r->Report( wxString::Format( _( "Diameter constraints: min %s; opt %s; max %s." ),
763  reportMin( r->GetUnits(), constraint ),
764  reportOpt( r->GetUnits(), constraint ),
765  reportMax( r->GetUnits(), constraint ) ) );
766 
767  r->Flush();
768 
769  r = m_inspectConstraintsDialog->AddPage( _( "Via Annular Width" ) );
770 
771  r->Report( "<h7>" + _( "Via annular width resolution for:" ) + "</h7>" );
772  r->Report( "<ul><li>" + EscapeHTML( getItemDescription( item ) ) + "</li></ul>" );
773  r->Report( "" );
774 
775  // PADSTACKS TODO: once we have padstacks we'll need to run this per-layer....
776  constraint = EVAL_RULES( ANNULAR_WIDTH_CONSTRAINT, item, nullptr, UNDEFINED_LAYER, r );
777 
778  if( compileError )
779  reportCompileError( r );
780 
781  r->Report( "" );
782  r->Report( wxString::Format( _( "Annular width constraints: min %s; opt %s; max %s." ),
783  reportMin( r->GetUnits(), constraint ),
784  reportOpt( r->GetUnits(), constraint ),
785  reportMax( r->GetUnits(), constraint ) ) );
786 
787  r->Flush();
788  }
789 
790  if( ( item->Type() == PCB_PAD_T && static_cast<PAD*>( item )->GetDrillSize().x > 0 )
791  || item->Type() == PCB_VIA_T )
792  {
793  r = m_inspectConstraintsDialog->AddPage( _( "Hole Size" ) );
794 
795  r->Report( "<h7>" + _( "Hole diameter resolution for:" ) + "</h7>" );
796  r->Report( "<ul><li>" + EscapeHTML( getItemDescription( item ) ) + "</li></ul>" );
797  r->Report( "" );
798 
799  // PADSTACKS TODO: once we have padstacks we'll need to run this per-layer....
800  constraint = EVAL_RULES( HOLE_SIZE_CONSTRAINT, item, nullptr, UNDEFINED_LAYER, r );
801 
802  if( compileError )
803  reportCompileError( r );
804 
805  wxString min = _( "undefined" );
806 
807  if( constraint.m_Value.HasMin() )
808  min = StringFromValue( r->GetUnits(), constraint.m_Value.Min(), true );
809 
810  r->Report( "" );
811  r->Report( wxString::Format( _( "Hole constraint: min %s." ), min ) );
812 
813  r->Flush();
814  }
815 
816  r = m_inspectConstraintsDialog->AddPage( _( "Keepouts" ) );
817 
818  r->Report( "<h7>" + _( "Keepout resolution for:" ) + "</h7>" );
819  r->Report( "<ul><li>" + EscapeHTML( getItemDescription( item ) ) + "</li></ul>" );
820  r->Report( "" );
821 
822  constraint = EVAL_RULES( DISALLOW_CONSTRAINT, item, nullptr, item->GetLayer(), r );
823 
824  if( compileError )
825  reportCompileError( r );
826 
827  if( courtyardError )
828  {
829  r->Report( "" );
830  r->Report( _( "Report may be incomplete: some footprint courtyards are malformed." )
831  + " <a href='drc'>" + _( "Run DRC for a full analysis." ) + "</a>" );
832  }
833 
834  r->Report( "" );
835 
836  if( constraint.m_DisallowFlags )
837  r->Report( _( "Item <b>disallowed</b> at current location." ) );
838  else
839  r->Report( _( "Item allowed at current location." ) );
840 
841  r->Flush();
842 
843  m_inspectConstraintsDialog->FinishInitialization();
845  m_inspectConstraintsDialog->Show( true );
846  return 0;
847 }
void BuildPolyCourtyards(OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Build complex polygons of the courtyard areas from graphic items on the courtyard layers.
Definition: footprint.cpp:1978
Design Rule Checker object that performs all the DRC tests.
Definition: drc_engine.h:81
wxString getItemDescription(BOARD_ITEM *aItem)
ZONES & Zones()
Definition: board.h:239
wxString GetDesignRulesPath()
Return the absolute path to the design rules file for the currently-loaded board.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
A slimmed down version of WX_HTML_REPORT_PANEL.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
void Flush()
Build the HTML messages page.
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
#define EVAL_RULES(constraint, a, b, layer, r)
class PAD, a pad in a footprint
Definition: typeinfo.h:89
wxString reportMin(EDA_UNITS aUnits, DRC_CONSTRAINT &aConstraint)
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:589
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
void ShowInfoBarError(const wxString &aErrorMsg, bool aShowCloseButton=false, WX_INFOBAR::MESSAGE_TYPE aType=WX_INFOBAR::MESSAGE_TYPE::GENERIC)
Show the WX_INFOBAR displayed on the top of the canvas with a message and an error icon on the left o...
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
FP_ZONES & Zones()
Definition: footprint.h:174
const PCB_SELECTION & selection() const
std::unique_ptr< DIALOG_CONSTRAINTS_REPORTER > m_inspectConstraintsDialog
FOOTPRINTS & Footprints()
Definition: board.h:233
FOOTPRINT * footprint() const
#define _(s)
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
void reportCompileError(REPORTER *r)
EDA_ITEM_FLAGS GetFlags() const
Definition: eda_item.h:155
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
EDA_UNITS GetUnits() const override
wxString EscapeHTML(const wxString &aString)
Return a new wxString escaped for embedding in HTML.
A filename or source description, a problem input line, a line number, a byte offset,...
Definition: ki_exception.h:118
virtual KIGFX::VIEW_ITEM * GetItem(unsigned int aIdx) const override
Definition: selection.cpp:52
int Size() const
Returns the number of selected parts.
Definition: selection.h:103
The selection tool: currently supports:
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:204
class PCB_VIA, a via (like a track segment on a copper layer)
Definition: typeinfo.h:96
BOARD * GetBoard() const
wxString reportOpt(EDA_UNITS aUnits, DRC_CONSTRAINT &aConstraint)
#define MALFORMED_COURTYARDS
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:171
wxString reportMax(EDA_UNITS aUnits, DRC_CONSTRAINT &aConstraint)
void onInspectConstraintsDialogClosed(wxCommandEvent &aEvent)
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References _, ANNULAR_WIDTH_CONSTRAINT, FOOTPRINT::BuildPolyCourtyards(), DISALLOW_CONSTRAINT, EscapeHTML(), EVAL_RULES, WX_HTML_REPORT_BOX::Flush(), PCB_TOOL_BASE::footprint(), BOARD::Footprints(), Format(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_EDIT_FRAME::GetDesignRulesPath(), BOARD::GetDesignSettings(), EDA_ITEM::GetFlags(), SELECTION::GetItem(), getItemDescription(), BOARD_ITEM::GetLayer(), PCB_SELECTION_TOOL::GetSelection(), TOOL_MANAGER::GetTool(), WX_HTML_REPORT_BOX::GetUnits(), HOLE_SIZE_CONSTRAINT, m_frame, m_inspectConstraintsDialog, TOOL_BASE::m_toolMgr, MALFORMED_COURTYARDS, onInspectConstraintsDialogClosed(), PCB_PAD_T, PCB_TRACE_T, PCB_VIA_T, WX_HTML_REPORT_BOX::Report(), reportCompileError(), reportMax(), reportMin(), reportOpt(), PCB_TOOL_BASE::selection(), EDA_BASE_FRAME::ShowInfoBarError(), SELECTION::Size(), StringFromValue(), TRACK_WIDTH_CONSTRAINT, EDA_ITEM::Type(), UNDEFINED_LAYER, VIA_DIAMETER_CONSTRAINT, FOOTPRINT::Zones(), and BOARD::Zones().

Referenced by setTransitions().

◆ InspectDRCError()

void BOARD_INSPECTION_TOOL::InspectDRCError ( const std::shared_ptr< RC_ITEM > &  aDRCItem)

Show the clearance resolution for two selected items.

Definition at line 174 of file board_inspection_tool.cpp.

175 {
176  BOARD_ITEM* a = m_frame->GetBoard()->GetItem( aDRCItem->GetMainItemID() );
177  BOARD_ITEM* b = m_frame->GetBoard()->GetItem( aDRCItem->GetAuxItemID() );
179 
180  if( !a || !b )
181  return;
182 
183  if( m_inspectClearanceDialog == nullptr )
184  {
185  m_inspectClearanceDialog = std::make_unique<DIALOG_CONSTRAINTS_REPORTER>( m_frame );
186  m_inspectClearanceDialog->SetTitle( _( "Clearance Report" ) );
187 
188  m_inspectClearanceDialog->Connect( wxEVT_CLOSE_WINDOW,
190  nullptr, this );
191  }
192 
193  WX_HTML_REPORT_BOX* r = m_inspectClearanceDialog->AddPage( _( "Clearance" ) );
194 
195  switch( aDRCItem->GetErrorCode() )
196  {
197  case DRCE_EDGE_CLEARANCE:
198  r->Report( "<h7>" + _( "Edge clearance resolution for:" ) + "</h7>" );
199 
200  r->Report( wxString::Format( "<ul><li>%s</li><li>%s</li></ul>",
202  EscapeHTML( getItemDescription( b ) ) ) );
203 
204  reportClearance( EDGE_CLEARANCE_CONSTRAINT, layer, a, b, r );
205  break;
206 
207  case DRCE_CLEARANCE:
208  if( a->Type() == PCB_TRACE_T || a->Type() == PCB_ARC_T )
209  {
210  layer = a->GetLayer();
211  }
212  else if( b->Type() == PCB_TRACE_T || b->Type() == PCB_ARC_T )
213  {
214  layer = b->GetLayer();
215  }
216  else if( a->Type() == PCB_PAD_T && static_cast<PAD*>( a )->GetAttribute() == PAD_ATTRIB::SMD )
217  {
218  PAD* pad = static_cast<PAD*>( a );
219 
220  if( pad->IsOnLayer( F_Cu ) )
221  layer = F_Cu;
222  else
223  layer = B_Cu;
224  }
225  else if( b->Type() == PCB_PAD_T && static_cast<PAD*>( a )->GetAttribute() == PAD_ATTRIB::SMD )
226  {
227  PAD* pad = static_cast<PAD*>( b );
228 
229  if( pad->IsOnLayer( F_Cu ) )
230  layer = F_Cu;
231  else
232  layer = B_Cu;
233  }
234 
235  r->Report( "<h7>" + _( "Clearance resolution for:" ) + "</h7>" );
236 
237  r->Report( wxString::Format( "<ul><li>%s %s</li><li>%s</li><li>%s</li></ul>",
238  _( "Layer" ),
239  EscapeHTML( m_frame->GetBoard()->GetLayerName( layer ) ),
241  EscapeHTML( getItemDescription( b ) ) ) );
242 
243  reportClearance( CLEARANCE_CONSTRAINT, layer, a, b, r );
244  break;
245 
246  default:
247  return;
248  }
249 
250  r->Flush();
251 
252  m_inspectClearanceDialog->Raise();
253  m_inspectClearanceDialog->Show( true );
254 }
BOARD_ITEM * GetItem(const KIID &aID) const
Definition: board.cpp:868
void reportClearance(DRC_CONSTRAINT_T aClearanceType, PCB_LAYER_ID aLayer, BOARD_ITEM *aA, BOARD_ITEM *aB, REPORTER *r)
wxString getItemDescription(BOARD_ITEM *aItem)
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
Definition: board.cpp:361
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition: board_item.h:80
A slimmed down version of WX_HTML_REPORT_PANEL.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
void Flush()
Build the HTML messages page.
Smd pad, appears on the solder paste layer (default)
class PCB_ARC, an arc track segment on a copper layer
Definition: typeinfo.h:97
class PAD, a pad in a footprint
Definition: typeinfo.h:89
class PCB_TRACK, a track segment (segment on a copper layer)
Definition: typeinfo.h:95
virtual PCB_LAYER_ID GetActiveLayer() const
std::unique_ptr< DIALOG_CONSTRAINTS_REPORTER > m_inspectClearanceDialog
void onInspectClearanceDialogClosed(wxCommandEvent &aEvent)
#define _(s)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
wxString EscapeHTML(const wxString &aString)
Return a new wxString escaped for embedding in HTML.
PCB_LAYER_ID
A quick note on layer IDs:
Definition: layer_ids.h:64
Definition: layer_ids.h:70
BOARD * GetBoard() const
Definition: pad.h:57
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
Definition: board_item.h:171
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

References _, B_Cu, CLEARANCE_CONSTRAINT, DRCE_CLEARANCE, DRCE_EDGE_CLEARANCE, EDGE_CLEARANCE_CONSTRAINT, EscapeHTML(), F_Cu, WX_HTML_REPORT_BOX::Flush(), Format(), PCB_BASE_FRAME::GetActiveLayer(), PCB_BASE_FRAME::GetBoard(), BOARD::GetItem(), getItemDescription(), BOARD_ITEM::GetLayer(), BOARD::GetLayerName(), m_frame, m_inspectClearanceDialog, onInspectClearanceDialogClosed(), pad, PCB_ARC_T, PCB_PAD_T, PCB_TRACE_T, WX_HTML_REPORT_BOX::Report(), reportClearance(), SMD, and EDA_ITEM::Type().

Referenced by DIALOG_DRC::OnDRCItemRClick().

◆ Is45Limited()

bool PCB_TOOL_BASE::Is45Limited ( ) const
inherited

◆ IsFootprintEditor()

◆ IsNetHighlightSet()

bool BOARD_INSPECTION_TOOL::IsNetHighlightSet ( ) const
inline
Returns
true if a net or nets to highlight have been set

Definition at line 103 of file board_inspection_tool.h.

104  {
105  return !m_currentlyHighlighted.empty();
106  }
std::set< int > m_currentlyHighlighted

References m_currentlyHighlighted.

Referenced by PCB_EDIT_FRAME::setupUIConditions().

◆ 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:214
TOOL_ID m_toolId
Name of the tool.
Definition: tool_base.h:209
bool IsToolActive(TOOL_ID aId) const
Return 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 ROUTER_TOOL::handleLayerSwitch(), EDIT_TOOL::isRouterActive(), PCB_SELECTION_TOOL::Main(), BOARD_EDITOR_CONTROL::TrackWidthDec(), and BOARD_EDITOR_CONTROL::TrackWidthInc().

◆ ListNets()

int BOARD_INSPECTION_TOOL::ListNets ( const TOOL_EVENT aEvent)

Hide the ratsnest for a given net.

Definition at line 1325 of file board_inspection_tool.cpp.

1326 {
1327  if( m_listNetsDialog == nullptr )
1328  {
1330  std::make_unique<DIALOG_NET_INSPECTOR>( m_frame, m_listNetsDialogSettings );
1331 
1332  m_listNetsDialog->Connect( wxEVT_CLOSE_WINDOW,
1333  wxCommandEventHandler( BOARD_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr,
1334  this );
1335 
1336  m_listNetsDialog->Connect( wxEVT_BUTTON,
1337  wxCommandEventHandler( BOARD_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr,
1338  this );
1339  }
1340 
1341  m_listNetsDialog->Raise();
1342  m_listNetsDialog->Show( true );
1343  return 0;
1344 }
std::unique_ptr< DIALOG_NET_INSPECTOR > m_listNetsDialog
DIALOG_NET_INSPECTOR::SETTINGS m_listNetsDialogSettings
void onListNetsDialogClosed(wxCommandEvent &aEvent)

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

Referenced by setTransitions().

◆ LocalRatsnestTool()

int BOARD_INSPECTION_TOOL::LocalRatsnestTool ( const TOOL_EVENT aEvent)

Definition at line 1134 of file board_inspection_tool.cpp.

1135 {
1136  std::string tool = aEvent.GetCommandStr().get();
1138  BOARD* board = getModel<BOARD>();
1139 
1140  // Deactivate other tools; particularly important if another PICKER is currently running
1141  Activate();
1142 
1143  picker->SetClickHandler(
1144  [this, board]( const VECTOR2D& pt ) -> bool
1145  {
1146  const PCB_DISPLAY_OPTIONS& opt = displayOptions();
1148 
1151  PCB_SELECTION& selection = selectionTool->GetSelection();
1152 
1153  if( selection.Empty() )
1154  {
1157  selection = selectionTool->GetSelection();
1158  }
1159 
1160  if( selection.Empty() )
1161  {
1162  // Clear the previous local ratsnest if we click off all items
1163  for( FOOTPRINT* fp : board->Footprints() )
1164  {
1165  for( PAD* pad : fp->Pads() )
1166  pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest );
1167  }
1168  }
1169  else
1170  {
1171  for( EDA_ITEM* item : selection )
1172  {
1173  if( PAD* pad = dyn_cast<PAD*>( item) )
1174  {
1175  pad->SetLocalRatsnestVisible( !pad->GetLocalRatsnestVisible() );
1176  }
1177  else if( FOOTPRINT* fp = dyn_cast<FOOTPRINT*>( item) )
1178  {
1179  if( !fp->Pads().empty() )
1180  {
1181  bool enable = !fp->Pads()[0]->GetLocalRatsnestVisible();
1182 
1183  for( PAD* childPad : fp->Pads() )
1184  childPad->SetLocalRatsnestVisible( enable );
1185  }
1186  }
1187  }
1188  }
1189 
1191 
1192  return true;
1193  } );
1194 
1195  picker->SetFinalizeHandler(
1196  [this, board]( int aCondition )
1197  {
1198  const PCB_DISPLAY_OPTIONS& opt = displayOptions();
1199 
1200  if( aCondition != PCB_PICKER_TOOL::END_ACTIVATE )
1201  {
1202  for( FOOTPRINT* fp : board->Footprints() )
1203  {
1204  for( PAD* pad : fp->Pads() )
1205  pad->SetLocalRatsnestVisible( opt.m_ShowGlobalRatsnest );
1206  }
1207  }
1208  } );
1209 
1210  m_toolMgr->RunAction( ACTIONS::pickerTool, true, &tool );
1211 
1212  return 0;
1213 }
static TOOL_ACTION selectionClear
Clear the current selection.
Definition: pcb_actions.h:59
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:283
BOARD * board() const
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
bool RunAction(const std::string &aActionName, bool aNow=false, T aParam=NULL)
Run the specified action.
Definition: tool_manager.h:143
void SetFinalizeHandler(FINALIZE_HANDLER aHandler)
Set a handler for the finalize event.
Definition: picker_tool.h:102
static TOOL_ACTION pickerTool
Definition: actions.h:155
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
Container for display options like enable/disable some optional drawings.
const PCB_SELECTION & selection() const
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
Definition: view.h:609
FOOTPRINTS & Footprints()
Definition: board.h:233
Items that may change while the view stays the same (noncached)
Definition: definitions.h:50
static void PadFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector, PCB_SELECTION_TOOL *sTool)
A selection filter which prunes the selection to contain only items of type PCB_PAD_T.
Definition: edit_tool.cpp:2289
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:97
const PCB_DISPLAY_OPTIONS & displayOptions() const
Generic tool for picking an item.
void SetClickHandler(CLICK_HANDLER aHandler)
Set a handler for mouse click event.
Definition: picker_tool.h:71
OPT< std::string > GetCommandStr() const
Definition: tool_event.h:460
Information pertinent to a Pcbnew printed circuit board.
Definition: board.h:190
The selection tool: currently supports:
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:100
void Activate()
Run the tool.
static void FootprintFilter(const VECTOR2I &, GENERAL_COLLECTOR &aCollector, PCB_SELECTION_TOOL *sTool)
A selection filter which prunes the selection to contain only items of type #PCB_MODULE_T.
Definition: edit_tool.cpp:2302
Definition: pad.h:57
static TOOL_ACTION selectionCursor
Select a single item under the cursor position.
Definition: pcb_actions.h:56

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

Referenced by setTransitions().

◆ onInspectClearanceDialogClosed()

void BOARD_INSPECTION_TOOL::onInspectClearanceDialogClosed ( wxCommandEvent &  aEvent)
private

Definition at line 1362 of file board_inspection_tool.cpp.

1363 {
1364  m_inspectClearanceDialog->Disconnect( wxEVT_CLOSE_WINDOW,
1366  nullptr, this );
1367 
1368  m_inspectClearanceDialog->Destroy();
1369  m_inspectClearanceDialog.release();
1370 }
std::unique_ptr< DIALOG_CONSTRAINTS_REPORTER > m_inspectClearanceDialog
void onInspectClearanceDialogClosed(wxCommandEvent &aEvent)

References m_inspectClearanceDialog.

Referenced by InspectClearance(), and InspectDRCError().

◆ onInspectConstraintsDialogClosed()

void BOARD_INSPECTION_TOOL::onInspectConstraintsDialogClosed ( wxCommandEvent &  aEvent)
private

Definition at line 1373 of file board_inspection_tool.cpp.

1374 {
1375  m_inspectConstraintsDialog->Disconnect( wxEVT_CLOSE_WINDOW,
1377  nullptr, this );
1378 
1379  m_inspectConstraintsDialog->Destroy();
1380  m_inspectConstraintsDialog.release();
1381 }
std::unique_ptr< DIALOG_CONSTRAINTS_REPORTER > m_inspectConstraintsDialog
void onInspectConstraintsDialogClosed(wxCommandEvent &aEvent)

References m_inspectConstraintsDialog.

Referenced by InspectConstraints().

◆ onListNetsDialogClosed()

void BOARD_INSPECTION_TOOL::onListNetsDialogClosed ( wxCommandEvent &  aEvent)
private

Definition at line 1347 of file board_inspection_tool.cpp.

1348 {
1350 
1351  m_listNetsDialog->Disconnect( wxEVT_CLOSE_WINDOW,
1352  wxCommandEventHandler( BOARD_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr, this );
1353 
1354  m_listNetsDialog->Disconnect( wxEVT_BUTTON,
1355  wxCommandEventHandler( BOARD_INSPECTION_TOOL::onListNetsDialogClosed ), nullptr, this );
1356 
1357  m_listNetsDialog->Destroy();
1358  m_listNetsDialog.release();
1359 }
std::unique_ptr< DIALOG_NET_INSPECTOR > m_listNetsDialog
DIALOG_NET_INSPECTOR::SETTINGS m_listNetsDialogSettings
void onListNetsDialogClosed(wxCommandEvent &aEvent)

References m_listNetsDialog, and m_listNetsDialogSettings.

Referenced by ListNets().

◆ reportClearance()

void BOARD_INSPECTION_TOOL::reportClearance ( DRC_CONSTRAINT_T  aClearanceType,
PCB_LAYER_ID  aLayer,
BOARD_ITEM aA,
BOARD_ITEM aB,
REPORTER r 
)
private

Definition at line 137 of file board_inspection_tool.cpp.

139 {
140  r->Report( "" );
141 
143 
144  try
145  {
146  drcEngine.InitEngine( m_frame->GetDesignRulesPath() );
147  }
148  catch( PARSE_ERROR& )
149  {
150  reportCompileError( r );
151  return;
152  }
153 
154  for( ZONE* zone : m_frame->GetBoard()->Zones() )
155  zone->CacheBoundingBox();
156 
158  {
159  for( ZONE* zone : footprint->Zones() )
160  zone->CacheBoundingBox();
161 
163  }
164 
165  DRC_CONSTRAINT constraint = drcEngine.EvalRules( aClearanceType, aA, aB, aLayer, r );
166  int clearance = constraint.m_Value.Min();
167  wxString clearanceStr = StringFromValue( r->GetUnits(), clearance, true );
168 
169  r->Report( "" );
170  r->Report( wxString::Format( _( "Resolved clearance: %s." ), clearanceStr ) );
171 }
void BuildPolyCourtyards(OUTLINE_ERROR_HANDLER *aErrorHandler=nullptr)
Build complex polygons of the courtyard areas from graphic items on the courtyard layers.
Definition: footprint.cpp:1978
Design Rule Checker object that performs all the DRC tests.
Definition: drc_engine.h:81
ZONES & Zones()
Definition: board.h:239
wxString GetDesignRulesPath()
Return the absolute path to the design rules file for the currently-loaded board.
virtual EDA_UNITS GetUnits() const
Definition: reporter.h:123
T Min() const
Definition: minoptmax.h:33
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Definition: board.cpp:589
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
MINOPTMAX< int > m_Value
Definition: drc_rule.h:145
FP_ZONES & Zones()
Definition: footprint.h:174
FOOTPRINTS & Footprints()
Definition: board.h:233
FOOTPRINT * footprint() const
#define _(s)
Handle a list of polygons defining a copper zone.
Definition: zone.h:56
void reportCompileError(REPORTER *r)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
A filename or source description, a problem input line, a line number, a byte offset,...
Definition: ki_exception.h:118
wxString StringFromValue(EDA_UNITS aUnits, double aValue, bool aAddUnitSymbol, EDA_DATA_TYPE aType)
Convert a value to a string using double notation.
Definition: base_units.cpp:204
BOARD * GetBoard() const
void InitEngine(const wxFileName &aRulePath)
Initialize the DRC engine.
Definition: drc_engine.cpp:626

References _, FOOTPRINT::BuildPolyCourtyards(), PCB_TOOL_BASE::footprint(), BOARD::Footprints(), Format(), PCB_BASE_FRAME::GetBoard(), PCB_BASE_EDIT_FRAME::GetDesignRulesPath(), BOARD::GetDesignSettings(), REPORTER::GetUnits(), DRC_ENGINE::InitEngine(), m_frame, DRC_CONSTRAINT::m_Value, MINOPTMAX< T >::Min(), REPORTER::Report(), reportCompileError(), StringFromValue(), FOOTPRINT::Zones(), and BOARD::Zones().

Referenced by InspectDRCError().

◆ reportZoneConnection()

void BOARD_INSPECTION_TOOL::reportZoneConnection ( ZONE aZone,
PAD aPad,
REPORTER r 
)
private

◆ Reset()

void BOARD_INSPECTION_TOOL::Reset ( RESET_REASON  aReason)
overridevirtual

Bring 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 96 of file board_inspection_tool.cpp.

97 {
98  m_frame = getEditFrame<PCB_EDIT_FRAME>();
99 }

References m_frame.

◆ RunMainStack()

void TOOL_INTERACTIVE::RunMainStack ( std::function< void()>  aFunc)
inherited

Call 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:214
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 PCB_SELECTION & PCB_TOOL_BASE::selection ( ) const
protectedinherited

Definition at line 313 of file pcb_tool_base.cpp.

314 {
316 
317  return selTool->GetSelection();
318 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
The selection tool: currently supports:

References PCB_SELECTION_TOOL::GetSelection(), 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(), EDIT_TOOL::Drag(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), DRAWING_TOOL::DrawZone(), EDIT_TOOL::Duplicate(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), PAD_TOOL::EditPad(), GROUP_TOOL::EnterGroup(), PAD_TOOL::EnumeratePads(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), EDIT_TOOL::FilletTracks(), PCB_SELECTION_TOOL::filterSelection(), EDIT_TOOL::Flip(), DRAWING_TOOL::getSourceZoneForAction(), GROUP_TOOL::Group(), highlightNet(), ROUTER_TOOL::InlineBreakTrack(), ROUTER_TOOL::InlineDrag(), InspectClearance(), InspectConstraints(), DRAWING_TOOL::InteractivePlaceWithPreview(), LocalRatsnestTool(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), PCB_POINT_EDITOR::OnSelectionChange(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), DRAWING_TOOL::PlaceImportedGraphics(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), POSITION_RELATIVE_TOOL::PositionRelative(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), BOARD_REANNOTATE_TOOL::ReannotateDuplicatesInSelection(), GROUP_TOOL::RemoveFromGroup(), GLOBAL_EDIT_TOOL::RemoveUnusedPads(), EDIT_TOOL::Rotate(), PCB_SELECTION_TOOL::selectNet(), DRAWING_TOOL::SetAnchor(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), GROUP_TOOL::Ungroup(), PCB_CONTROL::UpdateMessagePanel(), UpdateSelectionRatsnest(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), ZONE_FILLER_TOOL::ZoneFill(), BOARD_EDITOR_CONTROL::ZoneMerge(), and ZONE_FILLER_TOOL::ZoneUnfill().

◆ selection() [2/2]

PCB_SELECTION & PCB_TOOL_BASE::selection ( )
protectedinherited

Definition at line 321 of file pcb_tool_base.cpp.

322 {
324 
325  return selTool->GetSelection();
326 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
PCB_SELECTION & GetSelection()
Return the set of currently selected items.
The selection tool: currently supports:

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

◆ SetContextMenu()

void TOOL_INTERACTIVE::SetContextMenu ( ACTION_MENU aMenu,
CONTEXT_MENU_TRIGGER  aTrigger = CMENU_BUTTON 
)
inherited

Assign 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:214
void SetTool(TOOL_INTERACTIVE *aTool)
Set a tool that is the creator of the menu.
void ScheduleContextMenu(TOOL_BASE *aTool, ACTION_MENU *aMenu, CONTEXT_MENU_TRIGGER aTrigger)
Set behavior 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(), PCB_SELECTION_TOOL::doSelectionMenu(), TOOL_MENU::ShowContextMenu(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

◆ SetIsFootprintEditor()

void PCB_TOOL_BASE::SetIsFootprintEditor ( bool  aEnabled)
inlineinherited

Function SetIsFootprintEditor()

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

Parameters
aEnableddecides if the mode should be enabled.

Definition at line 103 of file pcb_tool_base.h.

103 { m_isFootprintEditor = aEnabled; }
bool m_isFootprintEditor

References PCB_TOOL_BASE::m_isFootprintEditor.

◆ setTransitions()

void BOARD_INSPECTION_TOOL::setTransitions ( )
overrideprivatevirtual

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

It is called every time tool is reset or finished.

Reimplemented from PCB_TOOL_BASE.

Definition at line 1432 of file board_inspection_tool.cpp.

1433 {
1437 
1439  PCB_ACTIONS::localRatsnestTool.MakeEvent() );
1441  PCB_ACTIONS::hideDynamicRatsnest.MakeEvent() );
1443  PCB_ACTIONS::updateLocalRatsnest.MakeEvent() );
1444 
1449 
1456 
1459 }
int HideDynamicRatsnest(const TOOL_EVENT &aEvent)
Show local ratsnest of a component.
static const TOOL_EVENT SelectedEvent
Definition: actions.h:199
static const TOOL_EVENT UnselectedEvent
Definition: actions.h:200
static TOOL_ACTION hideNet
Definition: pcb_actions.h:454
static TOOL_ACTION highlightItem
Definition: pcb_actions.h:453
int LocalRatsnestTool(const TOOL_EVENT &aEvent)
static TOOL_ACTION boardStatistics
Definition: pcb_actions.h:440
int InspectClearance(const TOOL_EVENT &aEvent)
int ClearHighlight(const TOOL_EVENT &aEvent)
Launch a tool to pick the item whose net is going to be highlighted.
int CrossProbePcbToSch(const TOOL_EVENT &aEvent)
Highlight net belonging to the item under the cursor.
static TOOL_ACTION localRatsnestTool
Definition: pcb_actions.h:458
static TOOL_ACTION toggleLastNetHighlight
Definition: pcb_actions.h:450
void Go(int(T::*aStateFunc)(const TOOL_EVENT &), const TOOL_EVENT_LIST &aConditions=TOOL_EVENT(TC_ANY, TA_ANY))
Define which state (aStateFunc) to go when a certain event arrives (aConditions).
static TOOL_ACTION toggleNetHighlight
Definition: pcb_actions.h:451
static TOOL_ACTION inspectConstraints
Definition: pcb_actions.h:445
int InspectConstraints(const TOOL_EVENT &aEvent)
int HighlightNet(const TOOL_EVENT &aEvent)
Clear all board highlights.
int HighlightItem(const TOOL_EVENT &aEvent)
Update ratsnest for selected items.
static const TOOL_EVENT ClearedEvent
Selected item had a property changed (except movement)
Definition: actions.h:201
int ShowNet(const TOOL_EVENT &aEvent)
static TOOL_ACTION hideDynamicRatsnest
Definition: pcb_actions.h:459
static TOOL_ACTION inspectClearance
Definition: pcb_actions.h:444
static TOOL_ACTION clearHighlight
Definition: pcb_actions.h:448
int ListNets(const TOOL_EVENT &aEvent)
Hide the ratsnest for a given net.
static TOOL_ACTION showNet
Definition: pcb_actions.h:455
static TOOL_ACTION highlightNet
Definition: pcb_actions.h:449
static TOOL_ACTION highlightNetSelection
Definition: pcb_actions.h:452
static TOOL_ACTION listNets
Definition: pcb_actions.h:341
int HideNet(const TOOL_EVENT &aEvent)
Show the ratsnest for a given net.
int UpdateSelectionRatsnest(const TOOL_EVENT &aEvent)
Hide ratsnest for selected items. Called when there are no items selected.
static TOOL_ACTION updateLocalRatsnest
Definition: pcb_actions.h:460
int ShowStatisticsDialog(const TOOL_EVENT &aEvent)
Show dialog with board statistics.

References PCB_ACTIONS::boardStatistics, 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, 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, PCB_ACTIONS::toggleNetHighlight, EVENTS::UnselectedEvent, PCB_ACTIONS::updateLocalRatsnest, and UpdateSelectionRatsnest().

◆ ShowNet()

int BOARD_INSPECTION_TOOL::ShowNet ( const TOOL_EVENT aEvent)

Definition at line 1391 of file board_inspection_tool.cpp.

1392 {
1393  doHideNet( aEvent.Parameter<intptr_t>(), false );
1394  return 0;
1395 }
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
void doHideNet(int aNetCode, bool aHide)
Bind handlers to corresponding TOOL_ACTIONs.

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

Referenced by setTransitions().

◆ ShowStatisticsDialog()

int BOARD_INSPECTION_TOOL::ShowStatisticsDialog ( const TOOL_EVENT aEvent)

Show dialog with board statistics.

Notify Eeschema about the selected item.

Definition at line 102 of file board_inspection_tool.cpp.

103 {
105  dialog.ShowModal();
106  return 0;
107 }
Dialog to show common board info.

References m_frame.

Referenced by setTransitions().

◆ UpdateSelectionRatsnest()

int BOARD_INSPECTION_TOOL::UpdateSelectionRatsnest ( const TOOL_EVENT aEvent)

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

Definition at line 1216 of file board_inspection_tool.cpp.

1217 {
1218  VECTOR2I delta;
1219 
1220  // If we have passed the simple move vector, we can update without recalculation
1221  if( aEvent.Parameter<VECTOR2I*>() )
1222  {
1223  delta = *aEvent.Parameter<VECTOR2I*>();
1224  delete aEvent.Parameter<VECTOR2I*>();
1225  }
1226  else
1227  {
1228  // We can delete the existing map to force a recalculation
1229  delete m_dynamicData;
1230  m_dynamicData = nullptr;
1231  }
1232 
1233  auto selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
1234  auto& selection = selectionTool->GetSelection();
1235  auto connectivity = getModel<BOARD>()->GetConnectivity();
1236 
1237  if( selection.Empty() )
1238  {
1239  connectivity->ClearDynamicRatsnest();
1240  delete m_dynamicData;
1241  m_dynamicData = nullptr;
1242  }
1243  else
1244  {
1246  }
1247 
1248  return 0;
1249 }
TOOL_MANAGER * m_toolMgr
Definition: tool_base.h:214
const PCB_SELECTION & selection() const
T Parameter() const
Return a non-standard parameter assigned to the event.
Definition: tool_event.h:432
bool Empty() const
Checks if there is anything selected.
Definition: selection.h:97
The selection tool: currently supports:
CONNECTIVITY_DATA * m_dynamicData
constexpr int delta
void calculateSelectionRatsnest(const VECTOR2I &aDelta)
< Recalculate dynamic ratsnest for the current selection.

References calculateSelectionRatsnest(), delta, 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

Suspend 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:214
TOOL_EVENT * ScheduleWait(TOOL_BASE *aTool, const TOOL_EVENT_LIST &aConditions)
Pause 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(), PCB_SELECTION_TOOL::doSelectionMenu(), EDIT_TOOL::DragArcTrack(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::DrawDimension(), MICROWAVE_TOOL::drawMicrowaveInductor(), DRAWING_TOOL::drawSegment(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), ROUTER_TOOL::InlineDrag(), DRAWING_TOOL::InteractivePlaceWithPreview(), ZOOM_TOOL::Main(), PCB_PICKER_TOOL::Main(), EE_POINT_EDITOR::Main(), PL_EDIT_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), CVPCB_CONTROL::Main(), PL_POINT_EDITOR::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), EDA_3D_CONTROLLER::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), PCB_POINT_EDITOR::OnSelectionChange(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), GERBVIEW_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), ZOOM_TOOL::selectRegion(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), and SCH_LINE_WIRE_BUS_TOOL::UnfoldBus().

Member Data Documentation

◆ m_currentlyHighlighted

std::set<int> BOARD_INSPECTION_TOOL::m_currentlyHighlighted
private

◆ m_dynamicData

CONNECTIVITY_DATA* BOARD_INSPECTION_TOOL::m_dynamicData
private

◆ m_frame

◆ m_inspectClearanceDialog

std::unique_ptr<DIALOG_CONSTRAINTS_REPORTER> BOARD_INSPECTION_TOOL::m_inspectClearanceDialog
private

◆ m_inspectConstraintsDialog

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

◆ m_isFootprintEditor

◆ m_lastHighlighted

std::set<int> BOARD_INSPECTION_TOOL::m_lastHighlighted
private

Definition at line 143 of file board_inspection_tool.h.

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

◆ m_listNetsDialog

std::unique_ptr<DIALOG_NET_INSPECTOR> BOARD_INSPECTION_TOOL::m_listNetsDialog
private

Definition at line 147 of file board_inspection_tool.h.

Referenced by ListNets(), and onListNetsDialogClosed().

◆ m_listNetsDialogSettings

DIALOG_NET_INSPECTOR::SETTINGS BOARD_INSPECTION_TOOL::m_listNetsDialogSettings
private

Definition at line 148 of file board_inspection_tool.h.

Referenced by ListNets(), and onListNetsDialogClosed().

◆ m_menu

TOOL_MENU TOOL_INTERACTIVE::m_menu
protectedinherited

The functions below are not yet implemented - their interface may change.

Definition at line 125 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(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), PAD_TOOL::EnumeratePads(), TOOL_INTERACTIVE::GetToolMenu(), ROUTER_TOOL::Init(), LENGTH_TUNER_TOOL::Init(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), PAD_TOOL::Init(), PL_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_DRAWING_TOOLS::Init(), SYMBOL_EDITOR_CONTROL::Init(), PCB_VIEWER_TOOLS::Init(), FOOTPRINT_EDITOR_CONTROL::Init(), PL_SELECTION_TOOL::Init(), SCH_DRAWING_TOOLS::Init(), BOARD_EDITOR_CONTROL::Init(), GERBVIEW_SELECTION_TOOL::Init(), EDA_3D_CONTROLLER::Init(), DRAWING_TOOL::Init(), EE_SELECTION_TOOL::Init(), EE_TOOL_BASE< SCH_BASE_FRAME >::Init(), PCB_SELECTION_TOOL::Init(), SCH_LINE_WIRE_BUS_TOOL::Init(), PCB_TOOL_BASE::Init(), PICKER_TOOL::Init(), DRAWING_TOOL::InteractivePlaceWithPreview(), PCB_PICKER_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), EDA_3D_CONTROLLER::Main(), PL_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), PICKER_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), ROUTER_TOOL::performDragging(), ROUTER_TOOL::performRouting(), LENGTH_TUNER_TOOL::performTuning(), SYMBOL_EDITOR_DRAWING_TOOLS::PlaceAnchor(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), DRAWING_TOOL::SetAnchor(), SCH_DRAWING_TOOLS::SingleClickPlace(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), and SCH_DRAWING_TOOLS::TwoClickPlace().

◆ m_probingSchToPcb

bool BOARD_INSPECTION_TOOL::m_probingSchToPcb
private

◆ m_toolId

TOOL_ID TOOL_BASE::m_toolId
protectedinherited

Name of the tool.

Names are expected to obey the format application.ToolName (eg. pcbnew.InteractiveSelection).

Definition at line 209 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 214 of file tool_base.h.

Referenced by TOOL_INTERACTIVE::Activate(), PL_SELECTION_TOOL::AddItemsToSel(), EE_SELECTION_TOOL::AddItemsToSel(), PL_SELECTION_TOOL::AddItemToSel(), PCB_SELECTION_TOOL::AddItemToSel(), EE_SELECTION_TOOL::AddItemToSel(), SCH_MOVE_TOOL::AlignElements(), SCH_EDITOR_CONTROL::AssignNetclass(), CVPCB_ASSOCIATION_TOOL::Associate(), TOOL_BASE::attachManager(), SCH_EDIT_TOOL::AutoplaceFields(), SCH_EDIT_TOOL::BreakWire(), calculateSelectionRatsnest(), ROUTER_TOOL::CanInlineDrag(), SCH_EDIT_TOOL::ChangeTextType(), EDIT_TOOL::ChangeTrackWidth(), SCH_EDIT_TOOL::CleanupSheetPins(), GERBVIEW_CONTROL::ClearAllLayers(), ClearHighlight(), SCH_EDITOR_CONTROL::ClearHighlight(), PL_SELECTION_TOOL::ClearSelection(), PCB_SELECTION_TOOL::ClearSelection(), GERBVIEW_SELECTION_TOOL::clearSelection(), EE_SELECTION_TOOL::ClearSelection(), SCH_EDIT_TOOL::ConvertDeMorgan(), PL_EDIT_TOOL::Copy(), SYMBOL_EDITOR_EDIT_TOOL::Copy(), PAD_TOOL::copyPadSettings(), EDIT_TOOL::copyToClipboard(), MICROWAVE_TOOL::createInductorBetween(), CrossProbePcbToSch(), COMMON_TOOLS::CursorControl(), SCH_EDITOR_CONTROL::Cut(), SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor(), PL_EDIT_TOOL::DeleteItemCursor(), SCH_EDIT_TOOL::DeleteItemCursor(), PCB_CONTROL::DeleteItemCursor(), PL_SELECTION_TOOL::disambiguateCursor(), EE_SELECTION_TOOL::disambiguateCursor(), PCB_SELECTION_TOOL::disambiguateCursor(), SCH_EDITOR_CONTROL::doCopy(), SCH_EDITOR_CONTROL::doCrossProbeSchToPcb(), SYMBOL_EDITOR_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(), SCH_LINE_WIRE_BUS_TOOL::DrawSegments(), SYMBOL_EDITOR_DRAWING_TOOLS::DrawShape(), PL_DRAWING_TOOLS::DrawShape(), SCH_DRAWING_TOOLS::DrawSheet(), DRAWING_TOOL::DrawZone(), BOARD_EDITOR_CONTROL::DrillOrigin(), SYMBOL_EDITOR_EDIT_TOOL::Duplicate(), EDIT_TOOL::Duplicate(), SCH_EDIT_TOOL::EditField(), SCH_EDIT_TOOL::editFieldText(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SYMBOL_EDITOR_EDIT_TOOL::editGraphicProperties(), PAD_TOOL::EditPad(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), GROUP_TOOL::EnterGroup(), SCH_NAVIGATE_TOOL::EnterSheet(), SCH_EDITOR_CONTROL::EnterSheet(), PAD_TOOL::EnumeratePads(), EE_INSPECTION_TOOL::ExcludeMarker(), PCB_SELECTION_TOOL::expandConnection(), PAD_TOOL::explodePad(), PCB_SELECTION_TOOL::filterSelection(), PCB_SELECTION_TOOL::FindItem(), SCH_EDITOR_CONTROL::FindSymbolAndItem(), 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(), PCB_CONTROL::GridSetOrigin(), GROUP_TOOL::Group(), GERBVIEW_CONTROL::HighlightControl(), HighlightItem(), HighlightNet(), SCH_EDITOR_CONTROL::HighlightNet(), highlightNet(), SCH_EDITOR_CONTROL::HighlightNetCursor(), PL_EDIT_TOOL::ImportDrawingSheetContent(), FOOTPRINT_EDITOR_CONTROL::ImportFootprint(), BOARD_REANNOTATE_TOOL::Init(), SYMBOL_EDITOR_EDIT_TOOL::Init(), PL_EDIT_TOOL::Init(), SCH_EDIT_TOOL::Init(), GROUP_TOOL::Init(), PAD_TOOL::Init(), CONVERT_TOOL::Init(), PL_DRAWING_TOOLS::Init(), GLOBAL_EDIT_TOOL::Init(), SYMBOL_EDITOR_CONTROL::Init(), PL_POINT_EDITOR::Init(), Init(), ALIGN_DISTRIBUTE_TOOL::Init(), PCB_POINT_EDITOR::Init(), BOARD_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(), DRAWING_TOOL::InteractivePlaceWithPreview(), EDIT_TOOL::invokeInlineRouter(), EDIT_TOOL::isInteractiveDragEnabled(), EDIT_TOOL::isRouterActive(), TOOL_BASE::IsToolActive(), GROUP_TOOL::LeaveGroup(), SCH_NAVIGATE_TOOL::LeaveSheet(), SCH_EDITOR_CONTROL::LeaveSheet(), COMMON_CONTROL::ListHotKeys(), LocalRatsnestTool(), PCB_PICKER_TOOL::Main(), CVPCB_FOOTPRINT_VIEWER_SELECTION_TOOL::Main(), PL_EDIT_TOOL::Main(), CVPCB_CONTROL::Main(), SYMBOL_EDITOR_MOVE_TOOL::Main(), SCH_MOVE_TOOL::Main(), PL_SELECTION_TOOL::Main(), GERBVIEW_SELECTION_TOOL::Main(), EE_SELECTION_TOOL::Main(), PCB_SELECTION_TOOL::Main(), ROUTER_TOOL::MainLoop(), LENGTH_TUNER_TOOL::MainLoop(), PCB_VIEWER_TOOLS::MeasureTool(), SYMBOL_EDITOR_EDIT_TOOL::Mirror(), SCH_EDIT_TOOL::Mirror(), EDIT_TOOL::Mirror(), BOARD_EDITOR_CONTROL::modifyLockSelected(), EDIT_TOOL::MoveExact(), SYMBOL_EDITOR_CONTROL::OnDeMorgan(), PL_SELECTION_TOOL::onDisambiguationExpire(), EE_SELECTION_TOOL::onDisambiguationExpire(), PCB_SELECTION_TOOL::onDisambiguationExpire(), COMMON_TOOLS::OnGridChanged(), PCB_POINT_EDITOR::OnSelectionChange(), PL_EDIT_TOOL::Paste(), SYMBOL_EDITOR_EDIT_TOOL::Paste(), SCH_EDITOR_CONTROL::Paste(), PAD_TOOL::pastePadProperties(), ROUTER_TOOL::performRouting(), GROUP_TOOL::PickNewMember(), EDIT_TOOL::pickReferencePoint(), SYMBOL_EDITOR_EDIT_TOOL::PinTable(), PCB_CONTROL::placeBoardItems(), BOARD_EDITOR_CONTROL::PlaceFootprint(), SCH_DRAWING_TOOLS::PlaceImage(), DRAWING_TOOL::PlaceImportedGraphics(), PL_DRAWING_TOOLS::PlaceItem(), SCH_DRAWING_TOOLS::PlaceSymbol(), BOARD_EDITOR_CONTROL::PlaceTarget(), DRAWING_TOOL::PlaceText(), PCB_CONTROL::Print(), GERBVIEW_CONTROL::Print(), SYMBOL_EDITOR_EDIT_TOOL::Properties(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), PAD_TOOL::pushPadSettings(), EE_SELECTION_TOOL::RebuildSelection(), SYMBOL_EDITOR_EDIT_TOOL::Redo(), SCH_EDITOR_CONTROL::Redo(), POSITION_RELATIVE_TOOL::RelativeItemSelectionMove(), EDIT_TOOL::Remove(), PCB_POINT_EDITOR::removeCorner(), GROUP_TOOL::RemoveFromGroup(), PL_SELECTION_TOOL::RemoveItemFromSel(), EE_SELECTION_TOOL::RemoveItemFromSel(), PCB_SELECTION_TOOL::RemoveItemFromSel(), PL_SELECTION_TOOL::RemoveItemsFromSel(), EE_SELECTION_TOOL::RemoveItemsFromSel(), SCH_EDIT_TOOL::RepeatDrawItem(), SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem(), EE_SELECTION_TOOL::RequestSelection(), PCB_SELECTION_TOOL::RequestSelection(), COMMON_TOOLS::Reset(), PNS::TOOL_BASE::Reset(), EDA_3D_CONTROLLER::Reset(), COMMON_TOOLS::ResetLocalCoords(), TOOL_INTERACTIVE::resetTransitions(), SYMBOL_EDITOR_EDIT_TOOL::Rotate(), SCH_EDIT_TOOL::Rotate(), EDIT_TOOL::Rotate(), TOOL_INTERACTIVE::RunMainStack(), DRC_TOOL::RunTests(), EE_SELECTION_TOOL::Selectable(), EE_SELECTION_TOOL::SelectConnection(), PCB_TOOL_BASE::selection(), COMMON_TOOLS::SelectionTool(), GERBVIEW_SELECTION_TOOL::SelectItem(), GERBVIEW_SELECTION_TOOL::SelectItems(), PCB_SELECTION_TOOL::SelectItems(), PL_SELECTION_TOOL::selectMultiple(), EE_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectMultiple(), PCB_SELECTION_TOOL::selectNet(), PL_SELECTION_TOOL::SelectPoint(), GERBVIEW_SELECTION_TOOL::selectPoint(), EE_SELECTION_TOOL::selectPoint(), PCB_SELECTION_TOOL::selectPoint(), POSITION_RELATIVE_TOOL::SelectPositionRelativeItem(), PCB_SELECTION_TOOL::selectSameSheet(), PCB_SELECTION_TOOL::selectSheetContents(), DRAWING_TOOL::SetAnchor(), TOOL_INTERACTIVE::SetContextMenu(), EDA_3D_CONTROLLER::SetMaterial(), DRC_TOOL::ShowDRCDialog(), SCH_DRAWING_TOOLS::SingleClickPlace(), EDA_3D_CONTROLLER::ToggleVisibility(), BOARD_EDITOR_CONTROL::TrackWidthDec(), BOARD_EDITOR_CONTROL::TrackWidthInc(), SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace(), SCH_DRAWING_TOOLS::TwoClickPlace(), SYMBOL_EDITOR_EDIT_TOOL::Undo(), SCH_EDITOR_CONTROL::Undo(), GROUP_TOOL::Ungroup(), GERBVIEW_SELECTION_TOOL::UnselectItem(), GERBVIEW_SELECTION_TOOL::UnselectItems(), PCB_SELECTION_TOOL::UnselectItems(), PNS::TOOL_BASE::updateEndItem(), EE_INSPECTION_TOOL::UpdateMessagePanel(), GERBVIEW_CONTROL::UpdateMessagePanel(), PL_EDITOR_CONTROL::UpdateMessagePanel(), PCB_CONTROL::UpdateMessagePanel(), EDIT_TOOL::updateModificationPoint(), UpdateSelectionRatsnest(), PNS::TOOL_BASE::updateStartItem(), BOARD_EDITOR_CONTROL::ViaSizeDec(), BOARD_EDITOR_CONTROL::ViaSizeInc(), TOOL_INTERACTIVE::Wait(), BOARD_EDITOR_CONTROL::ZoneDuplicate(), and BOARD_EDITOR_CONTROL::ZoneMerge().

◆ m_toolName

std::string TOOL_BASE::m_toolName
protectedinherited

Definition at line 213 of file tool_base.h.

Referenced by TOOL_BASE::GetName().

◆ m_type

TOOL_TYPE TOOL_BASE::m_type
protectedinherited

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

Definition at line 206 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: