From d15b34988dc2064de4ce5a16d75e089a82d27a81 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Fri, 5 Oct 2018 19:58:25 -0700 Subject: [PATCH] pcbnew: Adjust selection behavior in highlight net Prefer non-zones in highlight net in the same way we do for the selection tool. Highlight net just has separate logic and was missed previously. --- pcbnew/collectors.cpp | 4 +--- pcbnew/collectors.h | 4 ++-- pcbnew/highlight.cpp | 6 +++++- pcbnew/tools/pcb_editor_control.cpp | 6 +++++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index 256343825a..e316ce4fc8 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -100,12 +100,10 @@ const KICAD_T GENERAL_COLLECTOR::PadsOrModules[] = { }; -const KICAD_T GENERAL_COLLECTOR::PadsTracksOrZones[] = { +const KICAD_T GENERAL_COLLECTOR::PadsOrTracks[] = { PCB_PAD_T, PCB_VIA_T, PCB_TRACE_T, - PCB_SEGZONE_T, - PCB_ZONE_AREA_T, EOT }; diff --git a/pcbnew/collectors.h b/pcbnew/collectors.h index f1cdd59a47..af1dc7af72 100644 --- a/pcbnew/collectors.h +++ b/pcbnew/collectors.h @@ -285,9 +285,9 @@ public: static const KICAD_T PadsOrModules[]; /** - * A scan list for PADs, TRACKs, VIAs, or ZONEs + * A scan list for PADs, TRACKs, or VIAs */ - static const KICAD_T PadsTracksOrZones[]; + static const KICAD_T PadsOrTracks[]; /** * A scan list for MODULEs and their items (for Modedit) diff --git a/pcbnew/highlight.cpp b/pcbnew/highlight.cpp index 0a1a4ec8a4..d6784223dc 100644 --- a/pcbnew/highlight.cpp +++ b/pcbnew/highlight.cpp @@ -56,9 +56,13 @@ int PCB_EDIT_FRAME::SelectHighLight( wxDC* DC ) // optionally, modify the "guide" here as needed using its member functions - m_Collector->Collect( GetBoard(), GENERAL_COLLECTOR::PadsTracksOrZones, + m_Collector->Collect( GetBoard(), GENERAL_COLLECTOR::PadsOrTracks, RefPos( true ), guide ); + if( m_Collector->GetCount() == 0 ) + m_Collector->Collect( GetBoard(), GENERAL_COLLECTOR::Zones, + RefPos( true ), guide ); + BOARD_ITEM* item = (*m_Collector)[0]; if( item ) diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 4a2081d9ad..0ecb699bf2 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -951,9 +951,13 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition, GENERAL_COLLECTOR collector; // Find a connected item for which we are going to highlight a net - collector.Collect( board, GENERAL_COLLECTOR::PadsTracksOrZones, + collector.Collect( board, GENERAL_COLLECTOR::PadsOrTracks, wxPoint( aPosition.x, aPosition.y ), guide ); + if( collector.GetCount() == 0 ) + collector.Collect( board, GENERAL_COLLECTOR::Zones, + wxPoint( aPosition.x, aPosition.y ), guide ); + for( int i = 0; i < collector.GetCount(); i++ ) { if( collector[i]->Type() == PCB_PAD_T )