From ef13b97ff781f86540b4225a5aebd7955c8dd79f Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Thu, 18 Jan 2018 09:55:06 +0100 Subject: [PATCH] Complementary patch to 3114fa4a (filter invisible vias when selecting) This patch handles items selected with selection box. Fixes: lp:1743894 * https://bugs.launchpad.net/kicad/+bug/1743894 --- pcbnew/tools/selection_tool.cpp | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/pcbnew/tools/selection_tool.cpp b/pcbnew/tools/selection_tool.cpp index 02f96cb43c..d450bfd11b 100644 --- a/pcbnew/tools/selection_tool.cpp +++ b/pcbnew/tools/selection_tool.cpp @@ -550,7 +550,6 @@ bool SELECTION_TOOL::selectMultiple() if( evt->IsDrag( BUT_LEFT ) ) { - // Start drawing a selection box area.SetOrigin( evt->DragOrigin() ); area.SetEnd( evt->Position() ); @@ -1524,12 +1523,37 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem ) const } } break; + case PCB_VIA_T: { - // For vias it is enough if only one of layers is visible - PCB_LAYER_ID top, bottom; + const VIA* via = static_cast( aItem ); - static_cast( aItem )->LayerPair( &top, &bottom ); + // Check if appropriate element layer is visible + switch( via->GetViaType() ) + { + case VIA_THROUGH: + if( !board()->IsElementVisible( LAYER_VIA_THROUGH ) ) + return false; + break; + + case VIA_BLIND_BURIED: + if( !board()->IsElementVisible( LAYER_VIA_BBLIND ) ) + return false; + break; + + case VIA_MICROVIA: + if( !board()->IsElementVisible( LAYER_VIA_MICROVIA ) ) + return false; + break; + + default: + wxFAIL; + return false; + } + + // For vias it is enough if only one of its layers is visible + PCB_LAYER_ID top, bottom; + via->LayerPair( &top, &bottom ); return board()->IsLayerVisible( top ) || board()->IsLayerVisible( bottom ); }