Cleanup hole and netname layer processing for high-contrast mode.

Fixes https://gitlab.com/kicad/code/kicad/issues/6237
This commit is contained in:
Jeff Young 2020-11-04 02:05:02 +00:00
parent 43176a5b29
commit fb8ec84db0
2 changed files with 17 additions and 25 deletions

View File

@ -275,8 +275,7 @@ void PCB_DRAW_PANEL_GAL::SetHighContrastLayer( PCB_LAYER_ID aLayer )
LAYER_NUM layers[] = { LAYER_NUM layers[] = {
GetNetnameLayer( aLayer ), GetNetnameLayer( aLayer ),
ZONE_LAYER_FOR( aLayer ), ZONE_LAYER_FOR( aLayer ),
LAYER_VIA_THROUGH, LAYER_VIAS_HOLES, LAYER_VIAS_NETNAMES, LAYER_PADS_TH, LAYER_PADS_PLATEDHOLES, LAYER_NON_PLATEDHOLES,
LAYER_PADS_TH, LAYER_PADS_PLATEDHOLES, LAYER_PADS_NETNAMES, LAYER_NON_PLATEDHOLES,
LAYER_DRC_ERROR, LAYER_DRC_WARNING, LAYER_DRC_EXCLUSION, LAYER_MARKER_SHADOWS, LAYER_DRC_ERROR, LAYER_DRC_WARNING, LAYER_DRC_EXCLUSION, LAYER_MARKER_SHADOWS,
LAYER_SELECT_OVERLAY, LAYER_GP_OVERLAY, LAYER_SELECT_OVERLAY, LAYER_GP_OVERLAY,
LAYER_RATSNEST, LAYER_CURSOR, LAYER_ANCHOR LAYER_RATSNEST, LAYER_CURSOR, LAYER_ANCHOR
@ -290,13 +289,11 @@ void PCB_DRAW_PANEL_GAL::SetHighContrastLayer( PCB_LAYER_ID aLayer )
{ {
rSettings->SetLayerIsHighContrast( LAYER_PAD_BK ); rSettings->SetLayerIsHighContrast( LAYER_PAD_BK );
rSettings->SetLayerIsHighContrast( LAYER_MOD_BK ); rSettings->SetLayerIsHighContrast( LAYER_MOD_BK );
rSettings->SetLayerIsHighContrast( LAYER_PAD_BK_NETNAMES );
} }
else if( aLayer == F_Cu ) else if( aLayer == F_Cu )
{ {
rSettings->SetLayerIsHighContrast( LAYER_PAD_FR ); rSettings->SetLayerIsHighContrast( LAYER_PAD_FR );
rSettings->SetLayerIsHighContrast( LAYER_MOD_FR ); rSettings->SetLayerIsHighContrast( LAYER_MOD_FR );
rSettings->SetLayerIsHighContrast( LAYER_PAD_FR_NETNAMES );
} }
} }

View File

@ -232,10 +232,6 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons
if( item && item->Type() == PCB_ZONE_AREA_T && IsZoneLayer( aLayer ) ) if( item && item->Type() == PCB_ZONE_AREA_T && IsZoneLayer( aLayer ) )
aLayer = aLayer - LAYER_ZONE_START; aLayer = aLayer - LAYER_ZONE_START;
// Hide net names in "dimmed" contrast mode
if( m_hiContrastEnabled && IsNetnameLayer( aLayer ) && m_highContrastLayers.count( aLayer ) == 0 )
return COLOR4D::CLEAR;
// Marker shadows // Marker shadows
if( aLayer == LAYER_MARKER_SHADOWS ) if( aLayer == LAYER_MARKER_SHADOWS )
{ {
@ -328,10 +324,20 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons
for( int layer : m_highContrastLayers ) for( int layer : m_highContrastLayers )
isActiveLayer |= static_cast<const VIA*>( item )->IsOnLayer( ToLAYER_ID( layer ) ); isActiveLayer |= static_cast<const VIA*>( item )->IsOnLayer( ToLAYER_ID( layer ) );
} }
else if( item->Type() == PCB_PAD_T )
{
for( int layer : m_highContrastLayers )
isActiveLayer |= static_cast<const D_PAD*>( item )->IsOnLayer( ToLAYER_ID( layer ) );
}
else if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T )
{
for( int layer : m_highContrastLayers )
isActiveLayer |= static_cast<const TRACK*>( item )->IsOnLayer( ToLAYER_ID( layer ) );
}
if( m_hiContrastEnabled && !isActiveLayer && !highlighted && !selected ) if( m_hiContrastEnabled && !isActiveLayer && !highlighted && !selected )
{ {
if( m_contrastModeDisplay == HIGH_CONTRAST_MODE::HIDDEN ) if( m_contrastModeDisplay == HIGH_CONTRAST_MODE::HIDDEN || IsNetnameLayer( aLayer ) )
color = COLOR4D::CLEAR; color = COLOR4D::CLEAR;
else else
color = color.Mix( m_layerColors[LAYER_PCB_BACKGROUND], m_hiContrastFactor ); color = color.Mix( m_layerColors[LAYER_PCB_BACKGROUND], m_hiContrastFactor );
@ -501,7 +507,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
m_gal->SetIsStroke( true ); m_gal->SetIsStroke( true );
m_gal->SetIsFill( false ); m_gal->SetIsFill( false );
m_gal->SetStrokeColor( m_pcbSettings.GetColor( NULL, aLayer ) ); m_gal->SetStrokeColor( m_pcbSettings.GetColor( aTrack, aLayer ) );
m_gal->SetLineWidth( width / 10.0 ); m_gal->SetLineWidth( width / 10.0 );
m_gal->SetFontBold( false ); m_gal->SetFontBold( false );
m_gal->SetFontItalic( false ); m_gal->SetFontItalic( false );
@ -679,21 +685,10 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
switch( aVia->GetViaType() ) switch( aVia->GetViaType() )
{ {
case VIATYPE::THROUGH: case VIATYPE::THROUGH: sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_THROUGH]; break;
sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_THROUGH]; case VIATYPE::BLIND_BURIED: sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_BBLIND]; break;
break; case VIATYPE::MICROVIA: sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_MICROVIA]; break;
default: wxASSERT( false ); break;
case VIATYPE::BLIND_BURIED:
sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_BBLIND];
break;
case VIATYPE::MICROVIA:
sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_MICROVIA];
break;
default:
wxASSERT( false );
break;
} }
m_gal->SetIsFill( !sketchMode ); m_gal->SetIsFill( !sketchMode );