mirror of https://github.com/BOINC/boinc.git
MGR: Draw only those progress bars which are actually needed, further reducing flicker and improving efficiency
svn path=/trunk/boinc/; revision=15981
This commit is contained in:
parent
95ebdbda2d
commit
d2ecadb95a
|
@ -7284,7 +7284,7 @@ Charlie 8 Sep 2008
|
|||
progress bars in wrong rows in transfers tab.
|
||||
MGR: Use item attributes to create gray backgroound stripes in List
|
||||
Views instead of overlaying them in CBOINCListCtrl::DrawBarGraphs();
|
||||
this eliminates remaining flicker on Windows.
|
||||
this eliminates most remaining flicker on Windows.
|
||||
|
||||
clientgui/
|
||||
BOINCBaseView.cpp,.h
|
||||
|
@ -7305,3 +7305,14 @@ David 9 Sept 2008
|
|||
|
||||
html/user/
|
||||
show_user.php
|
||||
|
||||
Charlie 8 Sep 2008
|
||||
MGR: Draw only those progress bars which are actually needed, further
|
||||
reducing flicker and improving efficiency.
|
||||
|
||||
clientgui/
|
||||
BOINCBaseView.cpp
|
||||
BOINCListCtrl.cpp,.h
|
||||
ViewProjects.cpp
|
||||
ViewTransfers.cpp
|
||||
ViewWork.cpp
|
||||
|
|
|
@ -140,6 +140,7 @@ CBOINCBaseView::~CBOINCBaseView() {
|
|||
}
|
||||
m_arrSelectedKeys1.Empty();
|
||||
m_arrSelectedKeys2.Empty();
|
||||
m_iSortedIndexes.Empty();
|
||||
|
||||
if (m_pWhiteBackgroundAttr) {
|
||||
delete m_pWhiteBackgroundAttr;
|
||||
|
|
|
@ -67,6 +67,7 @@ CBOINCListCtrl::CBOINCListCtrl(
|
|||
|
||||
CBOINCListCtrl::~CBOINCListCtrl()
|
||||
{
|
||||
m_iRowsNeedingProgressBars.Empty();
|
||||
}
|
||||
|
||||
|
||||
|
@ -182,6 +183,20 @@ void CBOINCListCtrl::SelectRow(int row, bool setSelected) {
|
|||
}
|
||||
|
||||
|
||||
void CBOINCListCtrl::AddPendingBarGraph(int row) {
|
||||
bool duplicate = false;
|
||||
int n = (int)m_iRowsNeedingProgressBars.GetCount();
|
||||
for (int i=0; i<n; ++i) {
|
||||
if (m_iRowsNeedingProgressBars[i] == row) {
|
||||
duplicate = true;
|
||||
}
|
||||
}
|
||||
if (!duplicate) {
|
||||
m_iRowsNeedingProgressBars.Add(row);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CBOINCListCtrl::OnClick(wxCommandEvent& event) {
|
||||
wxLogTrace(wxT("Function Start/End"), wxT("CBOINCListCtrl::OnClick - Function Begin"));
|
||||
|
||||
|
@ -241,10 +256,11 @@ wxListItemAttr* CBOINCListCtrl::OnGetItemAttr(long item) const {
|
|||
|
||||
void CBOINCListCtrl::DrawBarGraphs()
|
||||
{
|
||||
long topItem, numItems, numVisibleItems, i, item;
|
||||
long topItem, numItems, numVisibleItems, i, row;
|
||||
wxRect r;
|
||||
int w = 0, x = 0;
|
||||
int progressColumn = m_pParentView->GetProgressColumn();
|
||||
|
||||
#if USE_NATIVE_LISTCONTROL
|
||||
wxClientDC dc(this);
|
||||
m_bBarGraphEventPending = false;
|
||||
|
@ -252,6 +268,14 @@ void CBOINCListCtrl::DrawBarGraphs()
|
|||
wxClientDC dc(GetMainWin()); // Available only in wxGenericListCtrl
|
||||
#endif
|
||||
|
||||
if (progressColumn < 0) {
|
||||
m_iRowsNeedingProgressBars.Empty();
|
||||
return;
|
||||
}
|
||||
|
||||
int n = (int)m_iRowsNeedingProgressBars.GetCount();
|
||||
if (n <= 0) return;
|
||||
|
||||
#ifdef __WXMAC__
|
||||
wxColour progressColor = wxColour( 40, 170, 170, 60);
|
||||
#else
|
||||
|
@ -261,7 +285,7 @@ void CBOINCListCtrl::DrawBarGraphs()
|
|||
|
||||
numItems = GetItemCount();
|
||||
if (numItems) {
|
||||
topItem = GetTopItem(); // Doesn't work properly for Mac Native control
|
||||
topItem = GetTopItem(); // Doesn't work properly for Mac Native control in wxMac-2.8.7
|
||||
|
||||
numVisibleItems = GetCountPerPage();
|
||||
++numVisibleItems;
|
||||
|
@ -269,36 +293,38 @@ void CBOINCListCtrl::DrawBarGraphs()
|
|||
if (numItems <= (topItem + numVisibleItems)) numVisibleItems = numItems - topItem;
|
||||
|
||||
x = 0;
|
||||
|
||||
if (progressColumn >= 0) {
|
||||
for (i=0; i< progressColumn; i++) {
|
||||
x += GetColumnWidth(i);
|
||||
}
|
||||
w = GetColumnWidth(progressColumn);
|
||||
for (i=0; i< progressColumn; i++) {
|
||||
x += GetColumnWidth(i);
|
||||
}
|
||||
w = GetColumnWidth(progressColumn);
|
||||
|
||||
for (i=0; i<numVisibleItems; i++) {
|
||||
item = topItem + i;
|
||||
GetItemRect(item, r);
|
||||
for (int i=0; i<n; ++i) {
|
||||
row = m_iRowsNeedingProgressBars[i];
|
||||
if (row < topItem) continue;
|
||||
if (row > (topItem + numVisibleItems -1)) continue;
|
||||
|
||||
|
||||
GetItemRect(row, r);
|
||||
#if ! USE_NATIVE_LISTCONTROL
|
||||
r.y = r.y - GetHeaderHeight() - 1;
|
||||
#endif
|
||||
if (progressColumn < 0) continue;
|
||||
r.x = x;
|
||||
r.width = w;
|
||||
r.Inflate(-1, -1);
|
||||
|
||||
dc.SetPen(progressColor);
|
||||
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||
dc.DrawRectangle( r );
|
||||
r.Inflate(-1, 0);
|
||||
dc.DrawRectangle( r );
|
||||
|
||||
r.width = r.width * m_pParentView->GetProgressValue(item);
|
||||
r.width = r.width * m_pParentView->GetProgressValue(row);
|
||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||
dc.SetBrush(progressColor);
|
||||
dc.DrawRectangle( r );
|
||||
}
|
||||
}
|
||||
m_iRowsNeedingProgressBars.Empty();
|
||||
}
|
||||
|
||||
#if USE_NATIVE_LISTCONTROL
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
long GetFirstSelected() { return GetNextItem(-1, 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 AddPendingBarGraph(int row);
|
||||
|
||||
bool m_bIsSingleSelection;
|
||||
|
||||
|
@ -66,6 +67,7 @@ private:
|
|||
virtual wxListItemAttr* OnGetItemAttr(long item) const;
|
||||
|
||||
CBOINCBaseView* m_pParentView;
|
||||
wxArrayInt m_iRowsNeedingProgressBars;
|
||||
|
||||
#if USE_NATIVE_LISTCONTROL
|
||||
public:
|
||||
|
|
|
@ -531,6 +531,8 @@ wxString CViewProjects::OnListGetItemText(long item, long column) const {
|
|||
CProject* project = NULL;
|
||||
wxString strBuffer = wxEmptyString;
|
||||
|
||||
m_pListPane->AddPendingBarGraph(item);
|
||||
|
||||
try {
|
||||
project = m_ProjectCache.at(m_iSortedIndexes[item]);
|
||||
} catch ( std::out_of_range ) {
|
||||
|
|
|
@ -325,6 +325,8 @@ wxString CViewTransfers::OnListGetItemText(long item, long column) const {
|
|||
CTransfer* transfer;
|
||||
wxString strBuffer = wxEmptyString;
|
||||
|
||||
m_pListPane->AddPendingBarGraph(item);
|
||||
|
||||
try {
|
||||
transfer = m_TransferCache.at(m_iSortedIndexes[item]);
|
||||
} catch ( std::out_of_range ) {
|
||||
|
|
|
@ -470,6 +470,8 @@ wxInt32 CViewWork::GetDocCount() {
|
|||
wxString CViewWork::OnListGetItemText(long item, long column) const {
|
||||
CWork* work = NULL;
|
||||
wxString strBuffer = wxEmptyString;
|
||||
|
||||
m_pListPane->AddPendingBarGraph(item);
|
||||
|
||||
try {
|
||||
work = m_WorkCache.at(m_iSortedIndexes[item]);
|
||||
|
@ -477,33 +479,35 @@ wxString CViewWork::OnListGetItemText(long item, long column) const {
|
|||
work = NULL;
|
||||
}
|
||||
|
||||
switch(column) {
|
||||
case COLUMN_PROJECT:
|
||||
strBuffer = work->m_strProjectName;
|
||||
break;
|
||||
case COLUMN_APPLICATION:
|
||||
strBuffer = work->m_strApplicationName;
|
||||
break;
|
||||
case COLUMN_NAME:
|
||||
strBuffer = work->m_strName;
|
||||
break;
|
||||
case COLUMN_CPUTIME:
|
||||
strBuffer = work->m_strCPUTime;
|
||||
break;
|
||||
case COLUMN_PROGRESS:
|
||||
strBuffer = work->m_strProgress;
|
||||
break;
|
||||
case COLUMN_TOCOMPLETION:
|
||||
strBuffer = work->m_strTimeToCompletion;
|
||||
break;
|
||||
case COLUMN_REPORTDEADLINE:
|
||||
strBuffer = work->m_strReportDeadline;
|
||||
break;
|
||||
case COLUMN_STATUS:
|
||||
strBuffer = work->m_strStatus;
|
||||
break;
|
||||
if (work) {
|
||||
switch(column) {
|
||||
case COLUMN_PROJECT:
|
||||
strBuffer = work->m_strProjectName;
|
||||
break;
|
||||
case COLUMN_APPLICATION:
|
||||
strBuffer = work->m_strApplicationName;
|
||||
break;
|
||||
case COLUMN_NAME:
|
||||
strBuffer = work->m_strName;
|
||||
break;
|
||||
case COLUMN_CPUTIME:
|
||||
strBuffer = work->m_strCPUTime;
|
||||
break;
|
||||
case COLUMN_PROGRESS:
|
||||
strBuffer = work->m_strProgress;
|
||||
break;
|
||||
case COLUMN_TOCOMPLETION:
|
||||
strBuffer = work->m_strTimeToCompletion;
|
||||
break;
|
||||
case COLUMN_REPORTDEADLINE:
|
||||
strBuffer = work->m_strReportDeadline;
|
||||
break;
|
||||
case COLUMN_STATUS:
|
||||
strBuffer = work->m_strStatus;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return strBuffer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue