MGR: Improve performance when reducing number of rows in lists (as when selecting "Show active tasks")

svn path=/trunk/boinc/; revision=20832
This commit is contained in:
Charlie Fenton 2010-03-11 01:14:07 +00:00
parent 159915a177
commit 00d0a6ccc7
2 changed files with 12 additions and 4 deletions

View File

@ -1796,3 +1796,10 @@ David 10 Mar 2010
time_stats.cpp time_stats.cpp
app_control.cpp app_control.cpp
Charlie 10 Mar 2010
- MGR: Improve performance when reducing number of rows in lists (as
when selecting "Show active tasks") by calling ClearSelections()
and SetItemCount() instead of repeatedly calling DeleteItem().
clientgui/
BOINCBaseView.cpp

View File

@ -298,11 +298,12 @@ void CBOINCBaseView::OnListRender(wxTimerEvent& event) {
m_pListPane->SetItemCount(iDocCount); m_pListPane->SetItemCount(iDocCount);
m_bNeedSort = true; m_bNeedSort = true;
} else { } else {
// We can't just call SetItemCount() here because we need to // The virtual ListCtrl keeps a separate its list of selected rows;
// let the virtual ListCtrl adjust its list of selected rows // make sure it does not reference any rows beyond the new last row.
// to remove (deselect) any beyond the new last row // We can ClearSelections() because we called SaveSelections() above.
ClearSelections();
m_pListPane->SetItemCount(iDocCount);
for (iIndex = (iCacheCount - 1); iIndex >= iDocCount; --iIndex) { for (iIndex = (iCacheCount - 1); iIndex >= iDocCount; --iIndex) {
m_pListPane->DeleteItem(iIndex);
iReturnValue = RemoveCacheElement(); iReturnValue = RemoveCacheElement();
wxASSERT(!iReturnValue); wxASSERT(!iReturnValue);
} }