diff --git a/checkin_notes b/checkin_notes index 32d419a494..2a794f0196 100644 --- a/checkin_notes +++ b/checkin_notes @@ -8264,3 +8264,11 @@ Charlie 9 Oct 2008 clientgui/ 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 diff --git a/clientgui/BOINCBaseView.cpp b/clientgui/BOINCBaseView.cpp index 2422d145f5..2f086f73e4 100644 --- a/clientgui/BOINCBaseView.cpp +++ b/clientgui/BOINCBaseView.cpp @@ -466,13 +466,19 @@ int CBOINCBaseView::SynchronizeCache() { for (iColumnIndex = 0; iColumnIndex < iColumnTotal; iColumnIndex++) { if (SynchronizeCacheItem(iRowIndex, iColumnIndex)) { +#ifdef __WXMAC__ bNeedRefreshData = true; +#else + // To reduce flicker, refresh only changed columns + m_pListPane->RefreshCell(iRowIndex, iColumnIndex); +#endif if (iColumnIndex == m_iSortColumn) { bNeedSort = true; } } } + // Mac is double-buffered to avoid flicker, so this is more efficient if (bNeedRefreshData) { m_pListPane->RefreshItem(iRowIndex); } diff --git a/clientgui/BOINCListCtrl.cpp b/clientgui/BOINCListCtrl.cpp index 95fe961cb6..5655d0de63 100644 --- a/clientgui/BOINCListCtrl.cpp +++ b/clientgui/BOINCListCtrl.cpp @@ -412,4 +412,27 @@ void MyEvtHandler::OnPaint(wxPaintEvent & event) #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$"; diff --git a/clientgui/BOINCListCtrl.h b/clientgui/BOINCListCtrl.h index 9366809377..f396ba9970 100644 --- a/clientgui/BOINCListCtrl.h +++ b/clientgui/BOINCListCtrl.h @@ -62,6 +62,7 @@ public: long GetNextSelected(int i) { return GetNextItem(i, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); } void SelectRow(int row, bool setSelected); void AddPendingProgressBar(int row); + void RefreshCell(int row, int col); bool m_bIsSingleSelection;