Do full high-contrast update of vias & pads if netnames are shown.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15657

(cherry picked from commit c7f69503c0)
This commit is contained in:
Jeff Young 2023-09-15 13:41:56 +01:00
parent a5f8955d78
commit 2e0cdebb0c
1 changed files with 11 additions and 2 deletions

View File

@ -1084,6 +1084,11 @@ void PCB_BASE_FRAME::SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions, boo
// Vias on a restricted layer set must be redrawn when high contrast mode is changed // Vias on a restricted layer set must be redrawn when high contrast mode is changed
if( hcChanged ) if( hcChanged )
{ {
bool showNetNames = false;
if( PCBNEW_SETTINGS* config = dynamic_cast<PCBNEW_SETTINGS*>( Kiface().KifaceSettings() ) )
showNetNames = config->m_Display.m_NetNames > 0;
// Note: KIGFX::REPAINT isn't enough for things that go from invisible to visible as // 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. // they won't be found in the view layer's itemset for re-painting.
GetCanvas()->GetView()->UpdateAllItemsConditionally( GetCanvas()->GetView()->UpdateAllItemsConditionally(
@ -1093,15 +1098,19 @@ void PCB_BASE_FRAME::SetDisplayOptions( const PCB_DISPLAY_OPTIONS& aOptions, boo
{ {
if( via->GetViaType() == VIATYPE::BLIND_BURIED if( via->GetViaType() == VIATYPE::BLIND_BURIED
|| via->GetViaType() == VIATYPE::MICROVIA || via->GetViaType() == VIATYPE::MICROVIA
|| via->GetRemoveUnconnected() ) || via->GetRemoveUnconnected()
|| showNetNames )
{ {
return hcVisChanged ? KIGFX::ALL : KIGFX::REPAINT; return hcVisChanged ? KIGFX::ALL : KIGFX::REPAINT;
} }
} }
else if( PAD* pad = dynamic_cast<PAD*>( aItem ) ) else if( PAD* pad = dynamic_cast<PAD*>( aItem ) )
{ {
if( pad->GetRemoveUnconnected() ) if( pad->GetRemoveUnconnected()
|| showNetNames )
{
return hcVisChanged ? KIGFX::ALL : KIGFX::REPAINT; return hcVisChanged ? KIGFX::ALL : KIGFX::REPAINT;
}
} }
return 0; return 0;