Filter Selected Items... is inclusive, not exclusive.

Fixes https://gitlab.com/kicad/code/kicad/issues/14273

(cherry picked from commit 897984aa22)
This commit is contained in:
Jeff Young 2023-03-19 19:57:35 +00:00
parent 9d457dc0ab
commit 121ea14fe4
1 changed files with 45 additions and 61 deletions

View File

@ -2068,12 +2068,6 @@ void PCB_SELECTION_TOOL::FindItem( BOARD_ITEM* aItem )
*/
static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard,
const DIALOG_FILTER_SELECTION::OPTIONS& aFilterOptions )
{
bool include = true;
const PCB_LAYER_ID layer = aItem.GetLayer();
// if the item needs to be checked against the options
if( include )
{
switch( aItem.Type() )
{
@ -2081,26 +2075,20 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard
{
const FOOTPRINT& footprint = static_cast<const FOOTPRINT&>( aItem );
include = aFilterOptions.includeModules;
if( include && !aFilterOptions.includeLockedModules )
include = !footprint.IsLocked();
break;
return aFilterOptions.includeModules
&& ( aFilterOptions.includeLockedModules || !footprint.IsLocked() );
}
case PCB_TRACE_T:
case PCB_ARC_T:
include = aFilterOptions.includeTracks;
break;
return aFilterOptions.includeTracks;
case PCB_VIA_T:
include = aFilterOptions.includeVias;
break;
return aFilterOptions.includeVias;
case PCB_FP_ZONE_T:
case PCB_ZONE_T:
include = aFilterOptions.includeZones;
break;
return aFilterOptions.includeZones;
case PCB_SHAPE_T:
case PCB_TARGET_T:
@ -2114,28 +2102,24 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem, const BOARD& aBoard
case PCB_FP_DIM_RADIAL_T:
case PCB_FP_DIM_ORTHOGONAL_T:
case PCB_FP_DIM_LEADER_T:
if( layer == Edge_Cuts )
include = aFilterOptions.includeBoardOutlineLayer;
if( aItem.GetLayer() == Edge_Cuts )
return aFilterOptions.includeBoardOutlineLayer;
else
include = aFilterOptions.includeItemsOnTechLayers;
break;
return aFilterOptions.includeItemsOnTechLayers;
case PCB_FP_TEXT_T:
case PCB_FP_TEXTBOX_T:
case PCB_TEXT_T:
case PCB_TEXTBOX_T:
include = aFilterOptions.includePcbTexts;
break;
return aFilterOptions.includePcbTexts;
default:
// no filtering, just select it
break;
// Filter dialog is inclusive, not exclusive. If it's not included, then it doesn't
// get selected.
return false;
}
}
return include;
}
int PCB_SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
{