Minor improvements to layer highlighting.

This commit is contained in:
Jeff Young 2021-01-27 14:52:22 +00:00
parent df80f6484e
commit 06a0094597
2 changed files with 20 additions and 3 deletions

View File

@ -783,6 +783,22 @@ inline bool IsNonCopperLayer( LAYER_NUM aLayerId )
return aLayerId > B_Cu && aLayerId <= PCB_LAYER_ID_COUNT;
}
/**
* Tests whether a layer is a copper layer, optionally including synthetic copper layers such
* as LAYER_VIA_THROUGH, LAYER_PAD_FR, etc.
*
* @param aLayerId
* @param aIncludeSyntheticCopperLayers
* @return
*/
inline bool IsCopperLayer( LAYER_NUM aLayerId, bool aIncludeSyntheticCopperLayers )
{
if( aIncludeSyntheticCopperLayers )
return !IsNonCopperLayer( aLayerId );
else
return IsCopperLayer( aLayerId );
}
/**
* Test whether a layer is a non copper and a non tech layer.
*

View File

@ -346,7 +346,7 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons
// m_highContrastLayers, but it's not sufficiently fine-grained as it can't differentiate
// between (for instance) a via which is flashed on the primary layer and one that is not.
// So we need to refine isActive to be more discriminating for some items.
if( primary != UNDEFINED_LAYER && IsCopperLayer( primary ) )
if( IsCopperLayer( primary ) )
{
if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T )
{
@ -364,8 +364,9 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons
flashed = static_cast<const PAD*>( item )->FlashLayer( primary, true );
// For pads and vias, we only want to override the active state for copper layers
// (this includes synthetic layers)
if( !IsNonCopperLayer( aLayer ) )
// (both board copper layers such as F_Cu *and* synthetic copper layers such as
// LAYER_VIA_THROUGH).
if( IsCopperLayer( aLayer, true ) )
isActive = flashed;
}
}