Fixes in GAL selection filter:

- vias were always left selected, include vias in tracks filter - as in legacy
- make text filtering work
- cleanup drawings filtering code
- hide checkbox "Include items on invisible layers" because it does not work in GAL
This commit is contained in:
Andrzej Wolski 2018-03-17 12:07:50 +01:00 committed by Jon Evans
parent 8cdb82df42
commit ea3f8743fd
2 changed files with 12 additions and 26 deletions

View File

@ -36,6 +36,8 @@ DIALOG_BLOCK_OPTIONS::DIALOG_BLOCK_OPTIONS( PCB_BASE_FRAME* aParent,
if( !aShowLegacyOptions )
{
m_DrawBlockItems->Hide();
m_checkBoxIncludeInvisible->Hide();
m_staticline1->Hide();
}
m_Include_Modules->SetValue( m_options.includeModules );

View File

@ -1235,20 +1235,20 @@ int SELECTION_TOOL::findMove( const TOOL_EVENT& aEvent )
*/
static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem,
const BOARD& aBoard,
const LSET& aTechnlLayerMask,
const DIALOG_BLOCK_OPTIONS::OPTIONS& aBlockOpts )
{
bool include = true;
const PCB_LAYER_ID layer = aItem.GetLayer();
// can skip without even checking item type
// fixme: selecting items on invisible layers does not work in GAL
if( !aBlockOpts.includeItemsOnInvisibleLayers
&& !aBoard.IsLayerVisible( layer ) )
{
include = false;
}
// if the item needsto be checked agains the options
// if the item needs to be checked against the options
if( include )
{
switch( aItem.Type() )
@ -1267,6 +1267,7 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem,
break;
}
case PCB_TRACE_T:
case PCB_VIA_T:
{
include = aBlockOpts.includeTracks;
break;
@ -1280,18 +1281,20 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem,
case PCB_TARGET_T:
case PCB_DIMENSION_T:
{
include = aTechnlLayerMask[layer];
if( layer == Edge_Cuts )
include = aBlockOpts.includeBoardOutlineLayer;
else
include = aBlockOpts.includeItemsOnTechLayers;
break;
}
case PCB_TEXT_T:
{
include = aBlockOpts.includePcbTexts
&& aTechnlLayerMask[layer];
include = aBlockOpts.includePcbTexts;
break;
}
default:
{
// no filterering, just select it
// no filtering, just select it
break;
}
}
@ -1301,24 +1304,6 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem,
}
/**
* Gets the technical layers that are part of the given selection opts
*/
static LSET getFilteredLayerSet(
const DIALOG_BLOCK_OPTIONS::OPTIONS& blockOpts )
{
LSET layerMask( Edge_Cuts );
if( blockOpts.includeItemsOnTechLayers )
layerMask.set();
if( !blockOpts.includeBoardOutlineLayer )
layerMask.set( Edge_Cuts, false );
return layerMask;
}
int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
{
auto& opts = m_priv->m_filterOpts;
@ -1330,7 +1315,6 @@ int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
return 0;
const auto& board = *getModel<BOARD>();
const auto layerMask = getFilteredLayerSet( opts );
// copy current selection
auto selection = m_selection.GetItems();
@ -1343,7 +1327,7 @@ int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
for( auto i : selection )
{
auto item = static_cast<BOARD_ITEM*>( i );
bool include = itemIsIncludedByFilter( *item, board, layerMask, opts );
bool include = itemIsIncludedByFilter( *item, board, opts );
if( include )
{