Don't allow selection of PCB_NETINFO_T.

Fixes https://gitlab.com/kicad/code/kicad/issues/5729
This commit is contained in:
Jeff Young 2020-09-20 16:34:43 +01:00
parent e64806cd20
commit d9a94dc538
2 changed files with 15 additions and 19 deletions

View File

@ -28,17 +28,11 @@
*/
#include <fctsys.h>
#include <gr_basic.h>
#include <pcb_base_frame.h>
#include <common.h>
#include <kicad_string.h>
#include <pcbnew.h>
#include <richio.h>
#include <macros.h>
#include <msgpanel.h>
#include <base_units.h>
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
@ -94,9 +88,10 @@ void NETINFO_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANE
return;
int count = 0;
for( auto mod : board->Modules() )
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::vector<MSG_PANE
count = 0;
for( auto track : board->Tracks() )
for( TRACK* track : board->Tracks() )
{
if( track->Type() == PCB_VIA_T )
{

View File

@ -486,7 +486,7 @@ bool SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag,
{
GENERAL_COLLECTORS_GUIDE guide = getCollectorsGuide();
GENERAL_COLLECTOR collector;
auto& displayOpts = m_frame->GetDisplayOptions();
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<BOARD_ITEM*>( 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;