KiCad PCB EDA Suite
sch_editor_control.cpp File Reference
#include <symbol_library.h>
#include <confirm.h>
#include <connection_graph.h>
#include <dialogs/dialog_symbol_fields_table.h>
#include <dialogs/dialog_eeschema_page_settings.h>
#include <dialogs/dialog_paste_special.h>
#include <dialogs/dialog_plot_schematic.h>
#include <dialogs/dialog_symbol_remap.h>
#include <dialogs/dialog_assign_netclass.h>
#include <project_rescue.h>
#include <erc.h>
#include <fmt.h>
#include <invoke_sch_dialog.h>
#include <string_utils.h>
#include <kiway.h>
#include <kiway_player.h>
#include <netlist_exporters/netlist_exporter_spice.h>
#include <paths.h>
#include <project/project_file.h>
#include <project/net_settings.h>
#include <sch_edit_frame.h>
#include <sch_plugins/kicad/sch_sexpr_plugin.h>
#include <sch_line.h>
#include <sch_junction.h>
#include <sch_bus_entry.h>
#include <sch_shape.h>
#include <sch_painter.h>
#include <sch_sheet.h>
#include <sch_sheet_pin.h>
#include <sch_view.h>
#include <schematic.h>
#include <advanced_config.h>
#include <sim/simulator_frame.h>
#include <sim/spice_generator.h>
#include <sim/sim_lib_mgr.h>
#include "symbol_library_manager.h"
#include <symbol_viewer_frame.h>
#include <status_popup.h>
#include <tool/picker_tool.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/ee_selection.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_editor_control.h>
#include <drawing_sheet/ds_proxy_undo_item.h>
#include <dialog_update_from_pcb.h>
#include <eda_list_dialog.h>
#include <wildcards_and_files_ext.h>
#include <wx_filename.h>
#include <sch_sheet_path.h>
#include <wx/filedlg.h>

Go to the source code of this file.

Functions

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

Variables

static VECTOR2D CLEAR
 

Function Documentation

◆ highlightNet()

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

Definition at line 758 of file sch_editor_control.cpp.

759{
760 SCH_EDIT_FRAME* editFrame = static_cast<SCH_EDIT_FRAME*>( aToolMgr->GetToolHolder() );
761 EE_SELECTION_TOOL* selTool = aToolMgr->GetTool<EE_SELECTION_TOOL>();
762 SCH_EDITOR_CONTROL* editorControl = aToolMgr->GetTool<SCH_EDITOR_CONTROL>();
763 SCH_CONNECTION* conn = nullptr;
764 bool retVal = true;
765
766 if( aPosition != CLEAR )
767 {
768 ERC_TESTER erc( &editFrame->Schematic() );
769
770 if( erc.TestDuplicateSheetNames( false ) > 0 )
771 {
772 wxMessageBox( _( "Error: duplicate sub-sheet names found in current sheet." ) );
773 retVal = false;
774 }
775 else
776 {
777 SCH_ITEM* item = static_cast<SCH_ITEM*>( selTool->GetNode( aPosition ) );
778 SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( item );
779
780 if( item )
781 {
782 if( item->IsConnectivityDirty() )
783 {
785 }
786
787 if( item->Type() == SCH_FIELD_T )
788 symbol = dynamic_cast<SCH_SYMBOL*>( item->GetParent() );
789
790 if( symbol && symbol->GetLibSymbolRef() && symbol->GetLibSymbolRef()->IsPower() )
791 {
792 std::vector<SCH_PIN*> pins = symbol->GetPins();
793
794 if( pins.size() == 1 )
795 conn = pins[0]->Connection();
796 }
797 else
798 {
799 conn = item->Connection();
800 }
801 }
802 }
803 }
804
805 if( !conn || conn == editFrame->GetHighlightedConnection() )
806 {
807 editFrame->SetStatusText( wxT( "" ) );
808 editFrame->SendCrossProbeClearHighlight();
809 editFrame->SetHighlightedConnection( nullptr );
810 }
811 else
812 {
813 editFrame->SetCrossProbeConnection( conn );
814 editFrame->SetHighlightedConnection( conn );
815 }
816
817 editFrame->UpdateNetHighlightStatus();
818
820 editorControl->UpdateNetHighlighting( dummy );
821
822 return retVal;
823}
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:97
EDA_ITEM * GetParent() const
Definition: eda_item.h:99
EDA_ITEM * GetNode(VECTOR2I aPosition)
Finds a connected item at a point (usually the cursor position).
Definition: erc.h:48
Each graphical item can have a SCH_CONNECTION describing its logical connection (to a bus or net).
Handle actions specific to the schematic editor.
Schematic editor (Eeschema) main window.
const SCH_CONNECTION * GetHighlightedConnection() const
void SendCrossProbeClearHighlight()
Tell Pcbnew to clear the existing highlighted net, if one exists.
SCHEMATIC & Schematic() const
void RecalculateConnections(SCH_CLEANUP_FLAGS aCleanupFlags)
Generate the connection data for the entire schematic hierarchy.
void SetHighlightedConnection(const SCH_CONNECTION *aConnection)
void UpdateNetHighlightStatus()
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:147
bool IsConnectivityDirty() const
Definition: sch_item.h:413
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:146
Schematic symbol object.
Definition: sch_symbol.h:81
std::vector< SCH_PIN * > GetPins(const SCH_SHEET_PATH *aSheet=nullptr) const
Retrieve a list of the SCH_PINs for the given sheet path.
std::unique_ptr< LIB_SYMBOL > & GetLibSymbolRef()
Definition: sch_symbol.h:192
Generic, UI-independent tool event.
Definition: tool_event.h:156
TOOLS_HOLDER * GetToolHolder() const
Definition: tool_manager.h:296
#define _(s)
@ NO_CLEANUP
static VECTOR2D CLEAR
std::vector< FAB_LAYER_COLOR > dummy
@ SCH_FIELD_T
Definition: typeinfo.h:155

References _, CLEAR, SCH_ITEM::Connection(), dummy, erc, SCH_EDIT_FRAME::GetHighlightedConnection(), SCH_SYMBOL::GetLibSymbolRef(), EE_SELECTION_TOOL::GetNode(), EDA_ITEM::GetParent(), SCH_SYMBOL::GetPins(), TOOL_MANAGER::GetTool(), TOOL_MANAGER::GetToolHolder(), SCH_ITEM::IsConnectivityDirty(), NO_CLEANUP, SCH_EDIT_FRAME::RecalculateConnections(), 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