From e855b244ae8b1fe6ad37a02b3c986676c532c943 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 12 Aug 2019 15:42:11 +0100 Subject: [PATCH] Highlight whole net for simulation voltage probe. --- eeschema/tools/sch_editor_control.cpp | 36 ++++++++++++++++++++++++--- eeschema/tools/sch_editor_control.h | 1 + 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index ef85da938f..d5ccc73cec 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -493,13 +494,24 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent ) selectionTool->GuessSelectionCandidates( collector, aPos ); EDA_ITEM* item = collector.GetCount() == 1 ? collector[ 0 ] : nullptr; + SCH_LINE* wire = dynamic_cast( item ); + wxString netName; + + if( wire ) + { + item = nullptr; + + if( wire->Connection( *g_CurrentSheet ) ) + netName = wire->Connection( *g_CurrentSheet )->Name(); + } + + if( item && item->Type() == SCH_PIN_T ) + picker->SetCursor( SIM_CURSORS::GetCursor( SIM_CURSORS::CURRENT_PROBE ) ); + else + picker->SetCursor( SIM_CURSORS::GetCursor( SIM_CURSORS::VOLTAGE_PROBE ) ); if( m_pickerItem != item ) { - if( item && item->Type() == SCH_PIN_T ) - picker->SetCursor( SIM_CURSORS::GetCursor( SIM_CURSORS::CURRENT_PROBE ) ); - else - picker->SetCursor( SIM_CURSORS::GetCursor( SIM_CURSORS::VOLTAGE_PROBE ) ); if( m_pickerItem ) selectionTool->UnbrightenItem( m_pickerItem ); @@ -509,6 +521,14 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent ) if( m_pickerItem ) selectionTool->BrightenItem( m_pickerItem ); } + + if( m_frame->GetSelectedNetName() != netName ) + { + m_frame->SetSelectedNetName( netName ); + + TOOL_EVENT dummyEvent; + UpdateNetHighlighting( dummyEvent ); + } } ); picker->SetFinalizeHandler( @@ -516,6 +536,14 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent ) { if( m_pickerItem ) m_toolMgr->GetTool()->UnbrightenItem( m_pickerItem ); + + if( !m_frame->GetSelectedNetName().IsEmpty() ) + { + m_frame->SetSelectedNetName( wxEmptyString ); + + TOOL_EVENT dummyEvent; + UpdateNetHighlighting( dummyEvent ); + } } ); std::string tool = aEvent.GetCommandStr().get(); diff --git a/eeschema/tools/sch_editor_control.h b/eeschema/tools/sch_editor_control.h index d972ae94fe..a443f3a1e3 100644 --- a/eeschema/tools/sch_editor_control.h +++ b/eeschema/tools/sch_editor_control.h @@ -179,6 +179,7 @@ private: private: bool m_probingPcbToSch; // Recursion guard when cross-probing to PCBNew EDA_ITEM* m_pickerItem; // Current item for picker highlighting. + wxString m_pickerNet; };