Don't rebuild the whole nets grid on show/hide

Besides being slow, this causes the scroll position
of the grid to be lost.
This commit is contained in:
Jon Evans 2021-02-16 22:31:09 -05:00
parent 13a91dd49d
commit 34c2bbfe51
3 changed files with 16 additions and 1 deletions

View File

@ -1242,7 +1242,7 @@ void BOARD_INSPECTION_TOOL::doHideNet( int aNetCode, bool aHide )
m_frame->GetCanvas()->RedrawRatsnest();
m_frame->GetCanvas()->Refresh();
m_frame->GetAppearancePanel()->OnBoardNetSettingsChanged( *m_frame->GetBoard() );
m_frame->GetAppearancePanel()->OnNetVisibilityChanged( aNetCode, !aHide );
}

View File

@ -948,6 +948,18 @@ void APPEARANCE_CONTROLS::OnBoardNetSettingsChanged( BOARD& aBoard )
}
void APPEARANCE_CONTROLS::OnNetVisibilityChanged( int aNetCode, bool aVisibility )
{
int row = m_netsTable->GetRowByNetcode( aNetCode );
if( row >= 0 )
{
m_netsTable->SetValueAsBool( row, NET_GRID_TABLE::COL_VISIBILITY, aVisibility );
m_netsGrid->ForceRefresh();
}
}
bool APPEARANCE_CONTROLS::doesBoardItemNeedRebuild( BOARD_ITEM* aBoardItem )
{
return aBoardItem->Type() == PCB_NETINFO_T;

View File

@ -224,6 +224,9 @@ public:
///< Update the widget when the active board layer is changed.
void OnLayerChanged();
/// Notifies the panel when a net has been hidden or shown via the external tool.
void OnNetVisibilityChanged( int aNetCode, bool aVisibility );
///< Manually update visibility for a given layer
void SetLayerVisible( LAYER_NUM aLayer, bool isVisible );