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:
parent
8cdb82df42
commit
ea3f8743fd
|
@ -36,6 +36,8 @@ DIALOG_BLOCK_OPTIONS::DIALOG_BLOCK_OPTIONS( PCB_BASE_FRAME* aParent,
|
||||||
if( !aShowLegacyOptions )
|
if( !aShowLegacyOptions )
|
||||||
{
|
{
|
||||||
m_DrawBlockItems->Hide();
|
m_DrawBlockItems->Hide();
|
||||||
|
m_checkBoxIncludeInvisible->Hide();
|
||||||
|
m_staticline1->Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Include_Modules->SetValue( m_options.includeModules );
|
m_Include_Modules->SetValue( m_options.includeModules );
|
||||||
|
|
|
@ -1235,20 +1235,20 @@ int SELECTION_TOOL::findMove( const TOOL_EVENT& aEvent )
|
||||||
*/
|
*/
|
||||||
static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem,
|
static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem,
|
||||||
const BOARD& aBoard,
|
const BOARD& aBoard,
|
||||||
const LSET& aTechnlLayerMask,
|
|
||||||
const DIALOG_BLOCK_OPTIONS::OPTIONS& aBlockOpts )
|
const DIALOG_BLOCK_OPTIONS::OPTIONS& aBlockOpts )
|
||||||
{
|
{
|
||||||
bool include = true;
|
bool include = true;
|
||||||
const PCB_LAYER_ID layer = aItem.GetLayer();
|
const PCB_LAYER_ID layer = aItem.GetLayer();
|
||||||
|
|
||||||
// can skip without even checking item type
|
// can skip without even checking item type
|
||||||
|
// fixme: selecting items on invisible layers does not work in GAL
|
||||||
if( !aBlockOpts.includeItemsOnInvisibleLayers
|
if( !aBlockOpts.includeItemsOnInvisibleLayers
|
||||||
&& !aBoard.IsLayerVisible( layer ) )
|
&& !aBoard.IsLayerVisible( layer ) )
|
||||||
{
|
{
|
||||||
include = false;
|
include = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the item needsto be checked agains the options
|
// if the item needs to be checked against the options
|
||||||
if( include )
|
if( include )
|
||||||
{
|
{
|
||||||
switch( aItem.Type() )
|
switch( aItem.Type() )
|
||||||
|
@ -1267,6 +1267,7 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PCB_TRACE_T:
|
case PCB_TRACE_T:
|
||||||
|
case PCB_VIA_T:
|
||||||
{
|
{
|
||||||
include = aBlockOpts.includeTracks;
|
include = aBlockOpts.includeTracks;
|
||||||
break;
|
break;
|
||||||
|
@ -1280,18 +1281,20 @@ static bool itemIsIncludedByFilter( const BOARD_ITEM& aItem,
|
||||||
case PCB_TARGET_T:
|
case PCB_TARGET_T:
|
||||||
case PCB_DIMENSION_T:
|
case PCB_DIMENSION_T:
|
||||||
{
|
{
|
||||||
include = aTechnlLayerMask[layer];
|
if( layer == Edge_Cuts )
|
||||||
|
include = aBlockOpts.includeBoardOutlineLayer;
|
||||||
|
else
|
||||||
|
include = aBlockOpts.includeItemsOnTechLayers;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PCB_TEXT_T:
|
case PCB_TEXT_T:
|
||||||
{
|
{
|
||||||
include = aBlockOpts.includePcbTexts
|
include = aBlockOpts.includePcbTexts;
|
||||||
&& aTechnlLayerMask[layer];
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
// no filterering, just select it
|
// no filtering, just select it
|
||||||
break;
|
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 )
|
int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
auto& opts = m_priv->m_filterOpts;
|
auto& opts = m_priv->m_filterOpts;
|
||||||
|
@ -1330,7 +1315,6 @@ int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const auto& board = *getModel<BOARD>();
|
const auto& board = *getModel<BOARD>();
|
||||||
const auto layerMask = getFilteredLayerSet( opts );
|
|
||||||
|
|
||||||
// copy current selection
|
// copy current selection
|
||||||
auto selection = m_selection.GetItems();
|
auto selection = m_selection.GetItems();
|
||||||
|
@ -1343,7 +1327,7 @@ int SELECTION_TOOL::filterSelection( const TOOL_EVENT& aEvent )
|
||||||
for( auto i : selection )
|
for( auto i : selection )
|
||||||
{
|
{
|
||||||
auto item = static_cast<BOARD_ITEM*>( i );
|
auto item = static_cast<BOARD_ITEM*>( i );
|
||||||
bool include = itemIsIncludedByFilter( *item, board, layerMask, opts );
|
bool include = itemIsIncludedByFilter( *item, board, opts );
|
||||||
|
|
||||||
if( include )
|
if( include )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue