From 4a911e0790b94532b74542f874d7aa7ce760e669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= Date: Thu, 2 Mar 2017 14:43:11 +0100 Subject: [PATCH] Highlight net tool in GAL now cross-probes to EEschema if clicked on a pad Fixes: lp:1663767 * https://bugs.launchpad.net/kicad/+bug/1663767 --- pcbnew/tools/pcb_editor_control.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 5816fa73f5..74299c29b0 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -991,9 +991,9 @@ int PCB_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent ) */ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition ) { - KIGFX::RENDER_SETTINGS* render = aToolMgr->GetView()->GetPainter()->GetSettings(); - GENERAL_COLLECTORS_GUIDE guide = - static_cast( aToolMgr->GetEditFrame() )->GetCollectorsGuide(); + auto render = aToolMgr->GetView()->GetPainter()->GetSettings(); + auto frame = static_cast( aToolMgr->GetEditFrame() ); + auto guide = frame->GetCollectorsGuide(); BOARD* board = static_cast( aToolMgr->GetModel() ); GENERAL_COLLECTOR collector; int net = -1; @@ -1001,6 +1001,16 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition ) // Find a connected item for which we are going to highlight a net collector.Collect( board, GENERAL_COLLECTOR::PadsTracksOrZones, wxPoint( aPosition.x, aPosition.y ), guide ); + + for( unsigned int i = 0; i < collector.GetCount(); i++ ) + { + if( collector[i]->Type() == PCB_PAD_T ) + { + frame->SendMessageToEESCHEMA( static_cast( collector[i] ) ); + break; + } + } + bool enableHighlight = ( collector.GetCount() > 0 ); // Obtain net code for the clicked item