Only re-build the members grid when we have to.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15320
This commit is contained in:
Jeff Young 2023-08-04 23:39:11 +01:00
parent 248404a0d1
commit d3329a0781
1 changed files with 6 additions and 6 deletions

View File

@ -53,9 +53,6 @@ PANEL_SETUP_BUSES::PANEL_SETUP_BUSES( wxWindow* aWindow, SCH_EDIT_FRAME* aFrame
m_membersGrid->PushEventHandler( new GRID_TRICKS( m_membersGrid, m_membersGrid->PushEventHandler( new GRID_TRICKS( m_membersGrid,
[this]( wxCommandEvent& aEvent ) [this]( wxCommandEvent& aEvent )
{ {
wxIdleEvent dummy;
reloadMembersGridOnIdle( dummy );
OnAddMember( aEvent ); OnAddMember( aEvent );
} ) ); } ) );
@ -306,6 +303,12 @@ void PANEL_SETUP_BUSES::OnMemberGridCellChanging( wxGridEvent& event )
// Parse a space-separated list and add each one // Parse a space-separated list and add each one
wxStringTokenizer tok( name, " " ); wxStringTokenizer tok( name, " " );
if( tok.CountTokens() > 1 )
{
m_membersGridDirty = true;
Bind( wxEVT_IDLE, &PANEL_SETUP_BUSES::reloadMembersGridOnIdle, this );
}
while( tok.HasMoreTokens() ) while( tok.HasMoreTokens() )
alias->Members().push_back( tok.GetNextToken() ); alias->Members().push_back( tok.GetNextToken() );
} }
@ -314,9 +317,6 @@ void PANEL_SETUP_BUSES::OnMemberGridCellChanging( wxGridEvent& event )
alias->Members().push_back( m_membersGrid->GetCellValue( ii, 0 ) ); alias->Members().push_back( m_membersGrid->GetCellValue( ii, 0 ) );
} }
} }
m_membersGridDirty = true;
Bind( wxEVT_IDLE, &PANEL_SETUP_BUSES::reloadMembersGridOnIdle, this );
} }
} }