@@ -252,7 +252,6 @@ bool CBOINCListCtrl::OnRestoreState(wxConfigBase* pConfig) {
252
252
int shownCount = orderArray.size ();
253
253
int hiddenCount = hiddenArray.size ();
254
254
int totalCount = pView->m_aStdColNameOrder ->size ();
255
- int defaultCount = pView->m_iNumDefaultShownColumns ;
256
255
for (int i = 0 ; i < totalCount; ++i) { // cycles through updated array of columns.
257
256
wxString columnNameToFind = pView->m_aStdColNameOrder ->Item (i);
258
257
bool found = false ;
@@ -281,7 +280,7 @@ bool CBOINCListCtrl::OnRestoreState(wxConfigBase* pConfig) {
281
280
for (int k = 0 ; k < pView->m_iNumDefaultShownColumns ; ++k) {
282
281
defaultArray.Add (pView->m_aStdColNameOrder ->Item (pView->m_iDefaultShownColumns [k]));
283
282
}
284
- for (int k = 0 ; k < defaultCount ; ++k) {
283
+ for (int k = 0 ; k < defaultArray. GetCount () ; ++k) {
285
284
if (defaultArray[k].IsSameAs (columnNameToFind)) {
286
285
orderArray.Add (columnNameToFind);
287
286
foundNewDefaultColumns = true ;
@@ -305,7 +304,7 @@ bool CBOINCListCtrl::OnRestoreState(wxConfigBase* pConfig) {
305
304
// No "ColumnOrder" tag in pConfig
306
305
// Show all columns in default column order
307
306
wxASSERT (wxDynamicCast (pView, CBOINCBaseView));
308
-
307
+
309
308
SetDefaultColumnDisplay ();
310
309
}
311
310
@@ -319,7 +318,7 @@ bool CBOINCListCtrl::OnRestoreState(wxConfigBase* pConfig) {
319
318
320
319
void CBOINCListCtrl::TokenizedStringToArray (wxString tokenized, char * delimiters, wxArrayString* array) {
321
320
wxString name;
322
-
321
+
323
322
array->Clear ();
324
323
wxStringTokenizer tok (tokenized, delimiters);
325
324
while (tok.HasMoreTokens ())
@@ -346,22 +345,22 @@ void CBOINCListCtrl::SetListColumnOrder(wxArrayString& orderArray) {
346
345
int columnID = 0 ; // ID of column, e.g. COLUMN_PROJECT, COLUMN_STATUS, etc.
347
346
int sortColumnIndex = -1 ;
348
347
wxArrayInt aOrder (shownColCount);
349
-
348
+
350
349
CBOINCBaseView* pView = (CBOINCBaseView*)GetParent ();
351
350
wxASSERT (wxDynamicCast (pView, CBOINCBaseView));
352
-
351
+
353
352
pView->m_iColumnIndexToColumnID .Clear ();
354
353
for (i=colCount-1 ; i>=0 ; --i) {
355
354
DeleteColumn (i);
356
355
}
357
-
356
+
358
357
stdCount = pView->m_aStdColNameOrder ->GetCount ();
359
358
360
359
pView->m_iColumnIDToColumnIndex .Clear ();
361
360
for (columnID=0 ; columnID<stdCount; ++columnID) {
362
361
pView->m_iColumnIDToColumnIndex .Add (-1 );
363
362
}
364
-
363
+
365
364
for (columnID=0 ; columnID<stdCount; ++columnID) {
366
365
for (columnPosition=0 ; columnPosition<shownColCount; ++columnPosition) {
367
366
if (orderArray[columnPosition].IsSameAs (pView->m_aStdColNameOrder ->Item (columnID))) {
@@ -375,7 +374,7 @@ void CBOINCListCtrl::SetListColumnOrder(wxArrayString& orderArray) {
375
374
}
376
375
}
377
376
}
378
-
377
+
379
378
// Prevent a crash bug if we just changed to a new locale.
380
379
//
381
380
// If a column has the same name in both the old and new locale, we guard against
@@ -393,7 +392,7 @@ void CBOINCListCtrl::SetListColumnOrder(wxArrayString& orderArray) {
393
392
pView->m_iColumnIDToColumnIndex [columnID] = columnID;
394
393
}
395
394
}
396
-
395
+
397
396
// If sort column is now hidden, set the new first column as sort column
398
397
if (pView->m_iSortColumnID >= 0 ) {
399
398
sortColumnIndex = pView->m_iColumnIDToColumnIndex [pView->m_iSortColumnID ];
@@ -406,7 +405,7 @@ void CBOINCListCtrl::SetListColumnOrder(wxArrayString& orderArray) {
406
405
pView->SetSortColumn (sortColumnIndex);
407
406
}
408
407
}
409
-
408
+
410
409
#ifdef wxHAS_LISTCTRL_COLUMN_ORDER
411
410
colCount = GetColumnCount ();
412
411
if ((shownColCount > 0 ) && (shownColCount <= stdCount) && (colCount == shownColCount)) {
@@ -449,14 +448,14 @@ void CBOINCListCtrl::SetDefaultColumnDisplay() {
449
448
int i;
450
449
wxArrayString orderArray;
451
450
CBOINCBaseView* pView = (CBOINCBaseView*)GetParent ();
452
-
451
+
453
452
wxASSERT (wxDynamicCast (pView, CBOINCBaseView));
454
453
455
454
orderArray.Clear ();
456
455
for (i=0 ; i<pView->m_iNumDefaultShownColumns ; ++i) {
457
456
orderArray.Add (pView->m_aStdColNameOrder ->Item (pView->m_iDefaultShownColumns [i]));
458
457
}
459
-
458
+
460
459
SetListColumnOrder (orderArray);
461
460
SetStandardColumnOrder ();
462
461
}
@@ -503,11 +502,11 @@ void CBOINCListCtrl::DrawProgressBars()
503
502
wxRect r, rr;
504
503
int w = 0 , x = 0 , xx, yy, ww;
505
504
int progressColumn = -1 ;
506
-
505
+
507
506
if (m_pParentView->GetProgressColumn () >= 0 ) {
508
507
progressColumn = m_pParentView->m_iColumnIDToColumnIndex [m_pParentView->GetProgressColumn ()];
509
508
}
510
-
509
+
511
510
#if USE_NATIVE_LISTCONTROL
512
511
wxClientDC dc (this );
513
512
m_bProgressBarEventPending = false ;
@@ -522,10 +521,10 @@ void CBOINCListCtrl::DrawProgressBars()
522
521
523
522
int n = (int )m_iRowsNeedingProgressBars.GetCount ();
524
523
if (n <= 0 ) return ;
525
-
524
+
526
525
wxColour progressColor = wxTheColourDatabase->Find (wxT (" LIGHT BLUE" ));
527
526
wxBrush progressBrush (progressColor);
528
-
527
+
529
528
numItems = GetItemCount ();
530
529
if (numItems) {
531
530
topItem = GetTopItem (); // Doesn't work properly for Mac Native control in wxMac-2.8.7
@@ -541,20 +540,20 @@ void CBOINCListCtrl::DrawProgressBars()
541
540
x += GetColumnWidth (GetColumnIndexFromOrder (i));
542
541
}
543
542
w = GetColumnWidth (progressColumn);
544
-
543
+
545
544
#if USE_NATIVE_LISTCONTROL
546
545
x -= GetScrollPos (wxHORIZONTAL);
547
546
#else
548
547
CalcScrolledPosition (x, 0 , &x, &yy);
549
548
#endif
550
549
wxFont theFont = GetFont ();
551
550
dc.SetFont (theFont);
552
-
551
+
553
552
for (int i=0 ; i<n; ++i) {
554
553
row = m_iRowsNeedingProgressBars[i];
555
554
if (row < topItem) continue ;
556
555
if (row > (topItem + numVisibleItems -1 )) continue ;
557
-
556
+
558
557
559
558
GetItemRect (row, r);
560
559
#if ! USE_NATIVE_LISTCONTROL
@@ -567,9 +566,9 @@ void CBOINCListCtrl::DrawProgressBars()
567
566
568
567
wxString progressString = m_pParentView->GetProgressText (row);
569
568
dc.GetTextExtent (progressString, &xx, &yy);
570
-
569
+
571
570
r.y += (r.height - yy - 1 ) / 2 ;
572
-
571
+
573
572
// Adapted from ellipis code in wxRendererGeneric::DrawHeaderButtonContents()
574
573
if (xx > r.width ) {
575
574
int ellipsisWidth;
@@ -586,7 +585,7 @@ void CBOINCListCtrl::DrawProgressBars()
586
585
xx += ellipsisWidth;
587
586
}
588
587
}
589
-
588
+
590
589
dc.SetLogicalFunction (wxCOPY);
591
590
dc.SetBackgroundMode (wxSOLID);
592
591
dc.SetPen (progressColor);
@@ -634,7 +633,7 @@ void MyEvtHandler::OnPaint(wxPaintEvent & event)
634
633
635
634
void CBOINCListCtrl::PostDrawProgressBarEvent () {
636
635
if (m_bProgressBarEventPending) return ;
637
-
636
+
638
637
CDrawProgressBarEvent newEvent (wxEVT_DRAW_PROGRESSBAR, this );
639
638
AddPendingEvent (newEvent);
640
639
m_bProgressBarEventPending = true ;
@@ -700,7 +699,7 @@ void CBOINCListCtrl::OnMouseDown(wxMouseEvent& event) {
700
699
// on Mac, which is double-buffered to eliminate flicker.)
701
700
void CBOINCListCtrl::RefreshCell (int row, int col) {
702
701
wxRect r;
703
-
702
+
704
703
GetSubItemRect (row, col, r);
705
704
RefreshRect (r);
706
705
}
0 commit comments