Only update the layer icon bitmap when it has actually changed

This was causing unnecessary calls to refresh the toolbar, causing
flickering in the layer widget.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/5212
This commit is contained in:
Ian McInerney 2020-08-17 12:37:25 +01:00
parent 5b365053db
commit cff76e55d5
1 changed files with 7 additions and 6 deletions

View File

@ -200,12 +200,12 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator( bool aForceRebuild )
wxIMAGE_QUALITY_NEAREST );
LayerPairBitmap = std::make_unique<wxBitmap>( image );
}
if( m_mainToolBar )
{
m_mainToolBar->SetToolBitmap( PCB_ACTIONS::selectLayerPair, *LayerPairBitmap );
m_mainToolBar->Refresh();
if( m_mainToolBar )
{
m_mainToolBar->SetToolBitmap( PCB_ACTIONS::selectLayerPair, *LayerPairBitmap );
m_mainToolBar->Refresh();
}
}
}
@ -662,5 +662,6 @@ void PCB_EDIT_FRAME::OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent )
void PCB_EDIT_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
{
m_SelLayerBox->SetLayerSelection( GetActiveLayer() );
if( m_SelLayerBox->GetLayerSelection() != GetActiveLayer() )
m_SelLayerBox->SetLayerSelection( GetActiveLayer() );
}