From d9a94dc5384aeaf162866fca124c8300152471c2 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 20 Sep 2020 16:34:43 +0100 Subject: [PATCH] Don't allow selection of PCB_NETINFO_T. Fixes https://gitlab.com/kicad/code/kicad/issues/5729 --- pcbnew/netinfo_item.cpp | 13 ++++--------- pcbnew/tools/selection_tool.cpp | 21 +++++++++++---------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/pcbnew/netinfo_item.cpp b/pcbnew/netinfo_item.cpp index 377006aa64..2c8518dc98 100644 --- a/pcbnew/netinfo_item.cpp +++ b/pcbnew/netinfo_item.cpp @@ -28,17 +28,11 @@ */ #include -#include #include -#include #include -#include -#include -#include #include #include #include -#include #include @@ -94,9 +88,10 @@ void NETINFO_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorModules() ) + + for( MODULE* mod : board->Modules() ) { - for( auto pad : mod->Pads() ) + for( D_PAD* pad : mod->Pads() ) { if( pad->GetNetCode() == GetNet() ) { @@ -111,7 +106,7 @@ void NETINFO_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vectorTracks() ) + for( TRACK* track : board->Tracks() ) { if( track->Type() == PCB_VIA_T ) { diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 2406889b72..64f1112aee 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -484,9 +484,9 @@ bool SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag, bool* aSelectionCancelledFlag, CLIENT_SELECTION_FILTER aClientFilter ) { - GENERAL_COLLECTORS_GUIDE guide = getCollectorsGuide(); - GENERAL_COLLECTOR collector; - auto& displayOpts = m_frame->GetDisplayOptions(); + GENERAL_COLLECTORS_GUIDE guide = getCollectorsGuide(); + GENERAL_COLLECTOR collector; + const PCB_DISPLAY_OPTIONS& displayOpts = m_frame->GetDisplayOptions(); guide.SetIgnoreZoneFills( displayOpts.m_ZoneDisplayMode != ZONE_DISPLAY_MODE::SHOW_FILLED ); @@ -496,9 +496,9 @@ bool SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag, ExitGroup(); } - collector.Collect( board(), - m_editModules ? GENERAL_COLLECTOR::ModuleItems : GENERAL_COLLECTOR::AllBoardItems, - wxPoint( aWhere.x, aWhere.y ), guide ); + collector.Collect( board(), m_editModules ? GENERAL_COLLECTOR::ModuleItems + : GENERAL_COLLECTOR::AllBoardItems, + (wxPoint) aWhere, guide ); // Remove unselectable items for( int i = collector.GetCount() - 1; i >= 0; --i ) @@ -725,7 +725,7 @@ SELECTION_LOCK_FLAGS SELECTION_TOOL::CheckLock() bool containsLocked = false; // Check if the selection contains locked items - for( const auto& item : m_selection ) + for( EDA_ITEM* item : m_selection ) { switch( item->Type() ) { @@ -786,7 +786,7 @@ int SELECTION_TOOL::SelectItems( const TOOL_EVENT& aEvent ) if( items ) { // Perform individual selection of each item before processing the event. - for( auto item : *items ) + for( BOARD_ITEM* item : *items ) select( item ); m_toolMgr->ProcessEvent( EVENTS::SelectedEvent ); @@ -816,7 +816,7 @@ int SELECTION_TOOL::SelectAll( const TOOL_EVENT& aEvent ) selectionBox.SetMaximum(); view->Query( selectionBox, selectedItems ); // Get the list of selected items - for( auto& item_pair : selectedItems ) + for( const KIGFX::VIEW::LAYER_ITEM_PAIR& item_pair : selectedItems ) { BOARD_ITEM* item = static_cast( item_pair.first ); @@ -1943,7 +1943,7 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn // Similar to logic for module, a group is selectable if any of its // members are. (This recurses) - for( auto item : group->GetItems() ) + for( BOARD_ITEM* item : group->GetItems() ) { if( Selectable( item, true ) ) return true; @@ -1956,6 +1956,7 @@ bool SELECTION_TOOL::Selectable( const BOARD_ITEM* aItem, bool checkVisibilityOn return true; // These are not selectable + case PCB_NETINFO_T: case NOT_USED: case TYPE_NOT_INIT: return false;