MGR: To reduce flicker, redraw only changed cells in List Control on non-Mac systems

svn path=/trunk/boinc/; revision=16185
This commit is contained in:
Charlie Fenton 2008-10-10 08:47:02 +00:00
parent d2332b193f
commit 2277846114
4 changed files with 38 additions and 0 deletions

View File

@ -8264,3 +8264,11 @@ Charlie 9 Oct 2008
clientgui/ clientgui/
sg_SGUIListControl.cpp,.h sg_SGUIListControl.cpp,.h
Charlie 10 Oct 2008
- MGR: To reduce flicker, redraw only changed cells in List Control
(not entire row) on non-Mac systems.
clientgui/
BOINCBaseView.cpp
BOINCListCtrl.cpp,.h

View File

@ -466,13 +466,19 @@ int CBOINCBaseView::SynchronizeCache() {
for (iColumnIndex = 0; iColumnIndex < iColumnTotal; iColumnIndex++) { for (iColumnIndex = 0; iColumnIndex < iColumnTotal; iColumnIndex++) {
if (SynchronizeCacheItem(iRowIndex, iColumnIndex)) { if (SynchronizeCacheItem(iRowIndex, iColumnIndex)) {
#ifdef __WXMAC__
bNeedRefreshData = true; bNeedRefreshData = true;
#else
// To reduce flicker, refresh only changed columns
m_pListPane->RefreshCell(iRowIndex, iColumnIndex);
#endif
if (iColumnIndex == m_iSortColumn) { if (iColumnIndex == m_iSortColumn) {
bNeedSort = true; bNeedSort = true;
} }
} }
} }
// Mac is double-buffered to avoid flicker, so this is more efficient
if (bNeedRefreshData) { if (bNeedRefreshData) {
m_pListPane->RefreshItem(iRowIndex); m_pListPane->RefreshItem(iRowIndex);
} }

View File

@ -412,4 +412,27 @@ void MyEvtHandler::OnPaint(wxPaintEvent & event)
#endif #endif
// To reduce flicker, refresh only changed columns (except
// on Mac, which is double-buffered to eliminate flicker.)
void CBOINCListCtrl::RefreshCell(int row, int col) {
wxRect r;
#if (defined (__WXMSW__) && wxCHECK_VERSION(2,8,0))
GetSubItemRect(row, col, r);
#else
int i;
GetItemRect(row, r);
#if ! USE_NATIVE_LISTCONTROL
r.y = r.y - GetHeaderHeight() - 1;
#endif
for (i=0; i< col; i++) {
r.x += GetColumnWidth(i);
}
r.width = GetColumnWidth(col);;
#endif
RefreshRect(r);
}
const char *BOINC_RCSID_5cf411daa0 = "$Id$"; const char *BOINC_RCSID_5cf411daa0 = "$Id$";

View File

@ -62,6 +62,7 @@ public:
long GetNextSelected(int i) { return GetNextItem(i, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); } long GetNextSelected(int i) { return GetNextItem(i, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); }
void SelectRow(int row, bool setSelected); void SelectRow(int row, bool setSelected);
void AddPendingProgressBar(int row); void AddPendingProgressBar(int row);
void RefreshCell(int row, int col);
bool m_bIsSingleSelection; bool m_bIsSingleSelection;