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

Fixes https://gitlab.com/kicad/code/kicad/issues/14273
This commit is contained in:
Jeff Young 2023-03-19 19:57:35 +00:00
parent 129ccb891e
commit 897984aa22
1 changed files with 45 additions and 61 deletions

View File

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