KiCad PCB EDA Suite
sch_editor_control.cpp File Reference

Go to the source code of this file.

Functions

static bool highlightNet (TOOL_MANAGER *aToolMgr, const VECTOR2D &aPosition)
 

Variables

static wxFindReplaceData g_markersOnly
 
static VECTOR2D CLEAR
 

Function Documentation

◆ highlightNet()

static bool highlightNet ( TOOL_MANAGER aToolMgr,
const VECTOR2D aPosition 
)
static

Definition at line 817 of file sch_editor_control.cpp.

818 {
819  SCH_EDIT_FRAME* editFrame = static_cast<SCH_EDIT_FRAME*>( aToolMgr->GetToolHolder() );
820  EE_SELECTION_TOOL* selTool = aToolMgr->GetTool<EE_SELECTION_TOOL>();
821  SCH_EDITOR_CONTROL* editorControl = aToolMgr->GetTool<SCH_EDITOR_CONTROL>();
822  SCH_CONNECTION* conn = nullptr;
823  bool retVal = true;
824 
825  if( aPosition != CLEAR )
826  {
827  ERC_TESTER erc( &editFrame->Schematic() );
828 
829  if( erc.TestDuplicateSheetNames( false ) > 0 )
830  {
831  wxMessageBox( _( "Error: duplicate sub-sheet names found in current sheet." ) );
832  retVal = false;
833  }
834  else
835  {
836  SCH_ITEM* item = static_cast<SCH_ITEM*>( selTool->GetNode( aPosition ) );
837  SCH_COMPONENT* symbol = dynamic_cast<SCH_COMPONENT*>( item );
838 
839  if( item )
840  {
841  if( item->Type() == SCH_FIELD_T )
842  symbol = dynamic_cast<SCH_COMPONENT*>( item->GetParent() );
843 
844  if( symbol && symbol->GetPartRef() && symbol->GetPartRef()->IsPower() )
845  {
846  std::vector<SCH_PIN*> pins = symbol->GetPins();
847 
848  if( pins.size() == 1 )
849  conn = pins[0]->Connection();
850  }
851  else
852  {
853  conn = item->Connection();
854  }
855  }
856  }
857  }
858 
859  if( !conn )
860  {
861  editFrame->SetStatusText( wxT( "" ) );
862  editFrame->SendCrossProbeClearHighlight();
863  }
864  else
865  {
866  editFrame->SetCrossProbeConnection( conn );
867  }
868 
869  editFrame->SetHighlightedConnection( conn );
870  editFrame->UpdateNetHighlightStatus();
871 
873  editorControl->UpdateNetHighlighting( dummy );
874 
875  return retVal;
876 }
void UpdateNetHighlightStatus()
void SendCrossProbeClearHighlight()
Tell Pcbnew to clear the existing highlighted net, if one exists.
Definition: erc.h:47
static LIB_PART * dummy()
Used to draw a dummy shape when a LIB_PART is not found in library.
Definition: sch_symbol.cpp:69
Schematic editor (Eeschema) main window.
SCH_CONNECTION * Connection(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve the connection associated with this object in the given sheet.
Definition: sch_item.cpp:131
Handle actions specific to the schematic editor.
Generic, UI-independent tool event.
Definition: tool_event.h:173
SCHEMATIC & Schematic() const
EDA_ITEM * GetParent() const
Definition: eda_item.h:165
static VECTOR2D CLEAR
TOOLS_HOLDER * GetToolHolder() const
Definition: tool_manager.h:300
void SetHighlightedConnection(const SCH_CONNECTION *aConnection)
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
#define _(s)
Definition: 3d_actions.cpp:33
Schematic symbol object.
Definition: sch_symbol.h:78
void SetCrossProbeConnection(const SCH_CONNECTION *aConnection)
Send a connection (net or bus) to Pcbnew for highlighting.
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:197
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:163

References _, CLEAR, SCH_ITEM::Connection(), dummy(), erc, EDA_ITEM::GetParent(), TOOL_MANAGER::GetTool(), TOOL_MANAGER::GetToolHolder(), SCH_FIELD_T, SCH_EDIT_FRAME::Schematic(), SCH_EDIT_FRAME::SendCrossProbeClearHighlight(), SCH_EDIT_FRAME::SetCrossProbeConnection(), SCH_EDIT_FRAME::SetHighlightedConnection(), EDA_ITEM::Type(), and SCH_EDIT_FRAME::UpdateNetHighlightStatus().

Referenced by SCH_EDITOR_CONTROL::AssignNetclass(), SCH_EDITOR_CONTROL::ClearHighlight(), SCH_EDITOR_CONTROL::HighlightNet(), and SCH_EDITOR_CONTROL::HighlightNetCursor().

Variable Documentation

◆ CLEAR

◆ g_markersOnly

wxFindReplaceData g_markersOnly
static