From ffe7d2ea49852f0c559d30b39cb145564a75a047 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 23 Dec 2020 21:42:55 +0000 Subject: [PATCH] Only draw group boxes when selected. Also ignore footprint groups when in board editor. Fixes https://gitlab.com/kicad/code/kicad/issues/6826 --- pcbnew/pcb_group.cpp | 19 ++----------------- pcbnew/pcb_painter.cpp | 4 ++++ pcbnew/tools/pcb_selection_tool.cpp | 11 ++++++++++- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/pcbnew/pcb_group.cpp b/pcbnew/pcb_group.cpp index a26db3d86d..69566df88e 100644 --- a/pcbnew/pcb_group.cpp +++ b/pcbnew/pcb_group.cpp @@ -232,23 +232,8 @@ bool PCB_GROUP::IsOnLayer( PCB_LAYER_ID aLayer ) const void PCB_GROUP::ViewGetLayers( int aLayers[], int& aCount ) const { - // What layer to put bounding box on? change in class_pcb_group.cpp - std::unordered_set layers = { LAYER_ANCHOR }; // for bounding box - - for( BOARD_ITEM* item : m_items ) - { - int member_layers[KIGFX::VIEW::VIEW_MAX_LAYERS], member_layers_count; - item->ViewGetLayers( member_layers, member_layers_count ); - - for( int i = 0; i < member_layers_count; i++ ) - layers.insert( member_layers[i] ); - } - - aCount = layers.size(); - int i = 0; - - for( int layer : layers ) - aLayers[i++] = layer; + aCount = 1; + aLayers[0] = LAYER_ANCHOR; } diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index f47a705263..ac0312a4e2 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -1436,6 +1436,10 @@ void PCB_PAINTER::draw( const PCB_GROUP* aGroup, int aLayer ) { if( aLayer == LAYER_ANCHOR ) { + // Draw only when we're selected on our own + if( !aGroup->IsSelected() || ( aGroup->GetParent() && aGroup->GetParent()->IsSelected() ) ) + return; + const COLOR4D color = m_pcbSettings.GetColor( aGroup, LAYER_ANCHOR ); EDA_RECT bbox = aGroup->GetBoundingBox(); diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index f1e00b9d0e..5624f8c770 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -2457,9 +2457,18 @@ void PCB_SELECTION_TOOL::FilterCollectorForGroups( GENERAL_COLLECTOR& aCollector for( int j = 0; j < aCollector.GetCount(); ) { BOARD_ITEM* item = aCollector[j]; + BOARD_ITEM* parent = item->GetParent(); + + // Ignore footprint groups in board editor + if( !m_isFootprintEditor && parent && parent->Type() == PCB_FOOTPRINT_T ) + { + ++j; + continue; + } + PCB_GROUP* aTop = PCB_GROUP::TopLevelGroup( item, m_enteredGroup ); - if( aTop != NULL ) + if( aTop ) { if( aTop != item ) {