From fb8ec84db0099adfa4cb8f22906849b36fee2186 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 4 Nov 2020 02:05:02 +0000 Subject: [PATCH] Cleanup hole and netname layer processing for high-contrast mode. Fixes https://gitlab.com/kicad/code/kicad/issues/6237 --- pcbnew/pcb_draw_panel_gal.cpp | 5 +---- pcbnew/pcb_painter.cpp | 37 +++++++++++++++-------------------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/pcbnew/pcb_draw_panel_gal.cpp b/pcbnew/pcb_draw_panel_gal.cpp index a6bf9212c1..a16b6ab0f6 100644 --- a/pcbnew/pcb_draw_panel_gal.cpp +++ b/pcbnew/pcb_draw_panel_gal.cpp @@ -275,8 +275,7 @@ void PCB_DRAW_PANEL_GAL::SetHighContrastLayer( PCB_LAYER_ID aLayer ) LAYER_NUM layers[] = { GetNetnameLayer( aLayer ), ZONE_LAYER_FOR( aLayer ), - LAYER_VIA_THROUGH, LAYER_VIAS_HOLES, LAYER_VIAS_NETNAMES, - LAYER_PADS_TH, LAYER_PADS_PLATEDHOLES, LAYER_PADS_NETNAMES, LAYER_NON_PLATEDHOLES, + LAYER_PADS_TH, LAYER_PADS_PLATEDHOLES, LAYER_NON_PLATEDHOLES, LAYER_DRC_ERROR, LAYER_DRC_WARNING, LAYER_DRC_EXCLUSION, LAYER_MARKER_SHADOWS, LAYER_SELECT_OVERLAY, LAYER_GP_OVERLAY, 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_MOD_BK ); - rSettings->SetLayerIsHighContrast( LAYER_PAD_BK_NETNAMES ); } else if( aLayer == F_Cu ) { rSettings->SetLayerIsHighContrast( LAYER_PAD_FR ); rSettings->SetLayerIsHighContrast( LAYER_MOD_FR ); - rSettings->SetLayerIsHighContrast( LAYER_PAD_FR_NETNAMES ); } } diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index 42c6c811ec..6af0612afe 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -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 ) ) 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 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 ) isActiveLayer |= static_cast( item )->IsOnLayer( ToLAYER_ID( layer ) ); } + else if( item->Type() == PCB_PAD_T ) + { + for( int layer : m_highContrastLayers ) + isActiveLayer |= static_cast( 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( item )->IsOnLayer( ToLAYER_ID( layer ) ); + } 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; else 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->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->SetFontBold( false ); m_gal->SetFontItalic( false ); @@ -679,21 +685,10 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer ) switch( aVia->GetViaType() ) { - case VIATYPE::THROUGH: - sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_THROUGH]; - 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; + case VIATYPE::THROUGH: sketchMode = m_pcbSettings.m_sketchMode[LAYER_VIA_THROUGH]; 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 );