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 891 of file sch_editor_control.cpp.

892 {
893  SCH_EDIT_FRAME* editFrame = static_cast<SCH_EDIT_FRAME*>( aToolMgr->GetToolHolder() );
894  EE_SELECTION_TOOL* selTool = aToolMgr->GetTool<EE_SELECTION_TOOL>();
895  SCH_EDITOR_CONTROL* editorControl = aToolMgr->GetTool<SCH_EDITOR_CONTROL>();
896  SCH_CONNECTION* conn = nullptr;
897  bool retVal = true;
898 
899  if( aPosition != CLEAR )
900  {
901  ERC_TESTER erc( &editFrame->Schematic() );
902 
903  if( erc.TestDuplicateSheetNames( false ) > 0 )
904  {
905  wxMessageBox( _( "Error: duplicate sub-sheet names found in current sheet." ) );
906  retVal = false;
907  }
908  else
909  {
910  SCH_ITEM* item = static_cast<SCH_ITEM*>( selTool->GetNode( aPosition ) );
911  SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item );
912 
913  if( item )
914  {
915  if( item->Type() == SCH_FIELD_T )
916  symbol = dynamic_cast<SCH_SYMBOL*>( item->GetParent() );
917 
918  if( symbol && symbol->GetLibSymbolRef() && symbol->GetLibSymbolRef()->IsPower() )
919  {
920  std::vector<SCH_PIN*> pins = symbol->GetPins();
921 
922  if( pins.size() == 1 )
923  conn = pins[0]->Connection();
924  }
925  else
926  {
927  conn = item->Connection();
928  }
929  }
930  }
931  }
932 
933  if( !conn )
934  {
935  editFrame->SetStatusText( wxT( "" ) );
936  editFrame->SendCrossProbeClearHighlight();
937  }
938  else
939  {
940  editFrame->SetCrossProbeConnection( conn );
941  }
942 
943  editFrame->SetHighlightedConnection( conn );
944  editFrame->UpdateNetHighlightStatus();
945 
947  editorControl->UpdateNetHighlighting( dummy );
948 
949  return retVal;
950 }
void UpdateNetHighlightStatus()
void SendCrossProbeClearHighlight()
Tell Pcbnew to clear the existing highlighted net, if one exists.
Definition: erc.h:47
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
static LIB_SYMBOL * dummy()
Used to draw a dummy shape when a LIB_SYMBOL is not found in library.
Definition: sch_symbol.cpp:72
Handle actions specific to the schematic editor.
Generic, UI-independent tool event.
Definition: tool_event.h:152
SCHEMATIC & Schematic() const
EDA_ITEM * GetParent() const
Definition: eda_item.h:115
#define _(s)
static VECTOR2D CLEAR
TOOLS_HOLDER * GetToolHolder() const
Definition: tool_manager.h:294
void SetHighlightedConnection(const SCH_CONNECTION *aConnection)
Schematic symbol object.
Definition: sch_symbol.h:78
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
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:182
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:113

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