Redraw via mask layers when switching Tented Vias on/off.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15164
This commit is contained in:
Jeff Young 2023-07-10 23:15:17 +01:00
parent cab0db76f8
commit 879e6c302d
3 changed files with 43 additions and 17 deletions

View File

@ -1245,21 +1245,31 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
GetCanvas()->GetView()->UpdateAllItemsConditionally(
[&]( KIGFX::VIEW_ITEM* aItem ) -> int
{
if( dynamic_cast<PCB_TRACK*>( aItem ) )
{
if( settings->m_Display.m_TrackClearance == SHOW_WITH_VIA_ALWAYS )
return KIGFX::REPAINT;
}
else if( dynamic_cast<PAD*>( aItem ) )
{
if( settings->m_Display.m_PadClearance )
return KIGFX::REPAINT;
BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( aItem );
int flags = 0;
if( !item )
return flags;
if( item->Type() == PCB_VIA_T || item->Type() == PCB_PAD_T )
{
// Note: KIGFX::REPAINT isn't enough for things that go from invisible
// to visible as they won't be found in the view layer's itemset for
// re-painting.
if( ( GetBoard()->GetVisibleLayers() & maskAndPasteLayers ).any() )
return KIGFX::ALL;
flags |= KIGFX::ALL;
}
if( item->Type() == PCB_TRACE_T || item->Type() == PCB_ARC_T || item->Type() == PCB_VIA_T )
{
if( settings->m_Display.m_TrackClearance == SHOW_WITH_VIA_ALWAYS )
flags |= KIGFX::REPAINT;
}
if( item->Type() == PCB_PAD_T )
{
if( settings->m_Display.m_PadClearance )
flags |= KIGFX::REPAINT;
}
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aItem );
@ -1268,10 +1278,10 @@ void PCB_EDIT_FRAME::ShowBoardSetupDialog( const wxString& aInitialPage )
{
text->ClearRenderCache();
text->ClearBoundingBoxCache();
return KIGFX::GEOMETRY | KIGFX::REPAINT;
flags |= KIGFX::GEOMETRY | KIGFX::REPAINT;
}
return 0;
return flags;
} );
GetCanvas()->Refresh();

View File

@ -187,8 +187,8 @@ void PCB_RENDER_SETTINGS::LoadDisplayOptions( const PCB_DISPLAY_OPTIONS& aOption
COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) const
{
const EDA_ITEM* item = dynamic_cast<const EDA_ITEM*>( aItem );
const BOARD_CONNECTED_ITEM* conItem = dynamic_cast<const BOARD_CONNECTED_ITEM*> ( aItem );
const BOARD_ITEM* item = dynamic_cast<const BOARD_ITEM*>( aItem );
const BOARD_CONNECTED_ITEM* conItem = dynamic_cast<const BOARD_CONNECTED_ITEM*>( aItem );
int netCode = -1;
int originalLayer = aLayer;
@ -234,6 +234,24 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons
else if( aLayer == LAYER_VIA_HOLEWALLS )
aLayer = LAYER_VIA_THROUGH;
// Show via mask layers if appropriate
if( aLayer == LAYER_VIA_THROUGH && !m_isPrinting )
{
if( item && item->GetBoard() )
{
LSET visibleLayers = item->GetBoard()->GetVisibleLayers()
& item->GetBoard()->GetEnabledLayers()
& item->GetLayerSet();
if( GetActiveLayer() == F_Mask && visibleLayers.test( F_Mask ) )
aLayer = F_Mask;
else if( GetActiveLayer() == B_Mask && visibleLayers.test( B_Mask ) )
aLayer = B_Mask;
else if( ( visibleLayers & LSET::AllCuMask() ).none() )
aLayer = visibleLayers.Seq().back();
}
}
// Normal path: get the layer base color
COLOR4D color = m_layerColors[aLayer];

View File

@ -635,10 +635,8 @@ bool PCB_VIA::FlashLayer( int aLayer ) const
if( !IsOnLayer( static_cast<PCB_LAYER_ID>( aLayer ) ) )
return false;
if( !m_removeUnconnectedLayer )
{
if( !m_removeUnconnectedLayer || !IsCopperLayer( aLayer ) )
return true;
}
if( m_keepStartEndLayer && ( aLayer == m_layer || aLayer == m_bottomLayer ) )
return true;