Make sure to fully repaint pads when loading a board

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


(cherry picked from commit 547a063981f0e3f3aa1607f6a3793d82e60fdd0a)

Co-authored-by: Jon Evans <jon@craftyjon.com>
This commit is contained in:
Jon Evans 2025-03-01 21:54:55 +00:00
parent e56894ccc2
commit d9a779d8ce
2 changed files with 17 additions and 5 deletions

View File

@ -1500,11 +1500,11 @@ void PCB_EDIT_FRAME::SetGridColor( const COLOR4D& aColor )
}
void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer, bool aForceRedraw )
{
const PCB_LAYER_ID oldLayer = GetActiveLayer();
if( oldLayer == aLayer )
if( oldLayer == aLayer && !aForceRedraw )
return;
PCB_BASE_FRAME::SetActiveLayer( aLayer );
@ -1523,7 +1523,7 @@ void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
*
* For pads/vias, this is to avoid clutter when there are pad/via layers
* that vary in flash (i.e. clearance from the hole or pad edge), padstack
* shape on eahc layer or clearances on each layer.
* shape on each layer or clearances on each layer.
*
* For tracks, this follows the same logic as pads/vias, but in theory could
* have their own set of independent clearance layers to allow track clearance
@ -1645,7 +1645,9 @@ void PCB_EDIT_FRAME::onBoardLoaded()
m_appearancePanel->ApplyLayerPreset( localSettings.m_ActiveLayerPreset );
if( GetBoard()->GetDesignSettings().IsLayerEnabled( localSettings.m_ActiveLayer ) )
SetActiveLayer( localSettings.m_ActiveLayer );
SetActiveLayer( localSettings.m_ActiveLayer, true );
else
SetActiveLayer( GetActiveLayer(), true ); // Make sure to repaint even if not switching
PROJECT_FILE& projectFile = Prj().GetProjectFile();

View File

@ -279,7 +279,17 @@ public:
/**
* Change the currently active layer to \a aLayer and also update the #APPEARANCE_CONTROLS.
*/
void SetActiveLayer( PCB_LAYER_ID aLayer ) override;
void SetActiveLayer( PCB_LAYER_ID aLayer ) override
{
SetActiveLayer( aLayer, false );
}
/**
* @param aLayer is the layer to set active
* @param aForceRedraw will repaint things that depend on layer switch even if the new active
* layer is the same as the previous one
*/
void SetActiveLayer( PCB_LAYER_ID aLayer, bool aForceRedraw );
void OnDisplayOptionsChanged() override;