MGR:Don't alternate gray and white backgrounds in lists; use wxLC_HRULES flag instead.

svn path=/trunk/boinc/; revision=20787
This commit is contained in:
Charlie Fenton 2010-03-04 10:35:02 +00:00
parent 5b7f8b8348
commit 46e2905e95
7 changed files with 18 additions and 79 deletions

View File

@ -1619,3 +1619,17 @@ David 3 Mar 2010
html/inc/
prefs.inc
Charlie 4 Mar 2010
- MGR: Instead of alternating gray and white backgrounds in lists,
create CBOINCListCtrl and CDlgEventLogListCtrl with wxLC_HRULES
flag. This avoids theme color conflicts with our backgrounds.
It also eliminates the need to set item attributes in the views,
since the default attribute setting already uses theme colors.
(We still use item attributes in the Event Log to list
error messages in red text.)
clientgui/
BOINCBaseView.cpp,.h
BOINCListCtrl.cpp, .h
DlgEventLog.cpp

View File

@ -61,9 +61,6 @@ CBOINCBaseView::CBOINCBaseView(wxNotebook* pNotebook) :
SetName(GetViewName());
SetAutoLayout(TRUE);
m_pWhiteBackgroundAttr = NULL;
m_pGrayBackgroundAttr = NULL;
}
@ -98,7 +95,7 @@ CBOINCBaseView::CBOINCBaseView(
m_pTaskPane = new CBOINCTaskCtrl(this, iTaskWindowID, iTaskWindowFlags);
wxASSERT(m_pTaskPane);
m_pListPane = new CBOINCListCtrl(this, iListWindowID, iListWindowFlags);
m_pListPane = new CBOINCListCtrl(this, iListWindowID, iListWindowFlags | wxLC_HRULES);
wxASSERT(m_pListPane);
itemFlexGridSizer->Add(m_pTaskPane, 1, wxGROW|wxALL, 1);
@ -122,17 +119,6 @@ CBOINCBaseView::CBOINCBaseView(
m_SortArrows->Add( wxIcon( sortascending_xpm ) );
m_SortArrows->Add( wxIcon( sortdescending_xpm ) );
m_pListPane->SetImageList(m_SortArrows, wxIMAGE_LIST_SMALL);
m_pWhiteBackgroundAttr = new wxListItemAttr(
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),
wxNullFont
);
m_pGrayBackgroundAttr = new wxListItemAttr(
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT),
wxNullFont
);
}
@ -150,16 +136,6 @@ CBOINCBaseView::~CBOINCBaseView() {
m_arrSelectedKeys1.Clear();
m_arrSelectedKeys2.Clear();
m_iSortedIndexes.Clear();
if (m_pWhiteBackgroundAttr) {
delete m_pWhiteBackgroundAttr;
m_pWhiteBackgroundAttr = NULL;
}
if (m_pGrayBackgroundAttr) {
delete m_pGrayBackgroundAttr;
m_pGrayBackgroundAttr = NULL;
}
}
@ -261,11 +237,6 @@ int CBOINCBaseView::FireOnListGetItemImage(long item) const {
}
wxListItemAttr* CBOINCBaseView::FireOnListGetItemAttr(long item) const {
return OnListGetItemAttr(item);
}
void CBOINCBaseView::OnListRender(wxTimerEvent& event) {
if (!m_bProcessingListRenderEvent) {
m_bProcessingListRenderEvent = true;
@ -434,11 +405,6 @@ int CBOINCBaseView::OnListGetItemImage(long WXUNUSED(item)) const {
}
wxListItemAttr* CBOINCBaseView::OnListGetItemAttr(long item) const {
return item % 2 ? m_pGrayBackgroundAttr : m_pWhiteBackgroundAttr;
}
int CBOINCBaseView::GetDocCount() {
return 0;
}

View File

@ -126,7 +126,6 @@ public:
void FireOnListDeselected( wxListEvent& event );
wxString FireOnListGetItemText( long item, long column ) const;
int FireOnListGetItemImage( long item ) const;
wxListItemAttr* FireOnListGetItemAttr( long item ) const;
int GetProgressColumn() { return m_iProgressColumn; }
virtual double GetProgressValue(long item);
@ -165,7 +164,6 @@ protected:
virtual void OnCacheHint(wxListEvent& event);
virtual wxString OnListGetItemText( long item, long column ) const;
virtual int OnListGetItemImage( long item ) const;
virtual wxListItemAttr* OnListGetItemAttr( long item ) const;
void OnColClick(wxListEvent& event);
@ -215,10 +213,6 @@ protected:
CBOINCTaskCtrl* m_pTaskPane;
CBOINCListCtrl* m_pListPane;
wxListItemAttr* m_pWhiteBackgroundAttr;
wxListItemAttr* m_pGrayBackgroundAttr;
};

View File

@ -253,14 +253,6 @@ int CBOINCListCtrl::OnGetItemImage(long item) const {
}
wxListItemAttr* CBOINCListCtrl::OnGetItemAttr(long item) const {
wxASSERT(m_pParentView);
wxASSERT(wxDynamicCast(m_pParentView, CBOINCBaseView));
return m_pParentView->FireOnListGetItemAttr(item);
}
void CBOINCListCtrl::DrawProgressBars()
{
long topItem, numItems, numVisibleItems, i, row;

View File

@ -75,7 +75,6 @@ private:
virtual wxString OnGetItemText(long item, long column) const;
virtual int OnGetItemImage(long item) const;
virtual wxListItemAttr* OnGetItemAttr(long item) const;
CBOINCBaseView* m_pParentView;
wxArrayInt m_iRowsNeedingProgressBars;

View File

@ -105,16 +105,6 @@ CDlgEventLog::~CDlgEventLog() {
m_pMessageErrorAttr = NULL;
}
if (m_pMessageInfoGrayAttr) {
delete m_pMessageInfoGrayAttr;
m_pMessageInfoGrayAttr = NULL;
}
if (m_pMessageErrorGrayAttr) {
delete m_pMessageErrorGrayAttr;
m_pMessageErrorGrayAttr = NULL;
}
m_strFilteredProjectName.clear();
m_iFilteredIndexes.Clear();
@ -178,16 +168,6 @@ bool CDlgEventLog::Create( wxWindow* WXUNUSED(parent), wxWindowID id, const wxSt
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),
wxNullFont
);
m_pMessageInfoGrayAttr = new wxListItemAttr(
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT),
wxNullFont
);
m_pMessageErrorGrayAttr = new wxListItemAttr(
*wxRED,
wxSystemSettings::GetColour(wxSYS_COLOUR_3DLIGHT),
wxNullFont
);
GetSizer()->Fit(this);
GetSizer()->SetSizeHints(this);
@ -212,7 +192,7 @@ void CDlgEventLog::CreateControls()
itemFlexGridSizer2->AddGrowableCol(0);
SetSizer(itemFlexGridSizer2);
m_pList = new CDlgEventLogListCtrl(this, ID_SIMPLE_MESSAGESVIEW, DEFAULT_LIST_MULTI_SEL_FLAGS);
m_pList = new CDlgEventLogListCtrl(this, ID_SIMPLE_MESSAGESVIEW, DEFAULT_LIST_MULTI_SEL_FLAGS | wxLC_HRULES);
itemFlexGridSizer2->Add(m_pList, 0, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
@ -459,14 +439,10 @@ void CDlgEventLog::OnRefresh() {
if (isConnected) {
m_pMessageInfoAttr->SetTextColour(*wxBLACK);
m_pMessageErrorAttr->SetTextColour(*wxRED);
m_pMessageInfoGrayAttr->SetTextColour(*wxBLACK);
m_pMessageErrorGrayAttr->SetTextColour(*wxRED);
} else {
wxColourDatabase colorBase;
m_pMessageInfoAttr->SetTextColour(wxColour(128, 128, 128));
m_pMessageErrorAttr->SetTextColour(wxColour(255, 128, 128));
m_pMessageInfoGrayAttr->SetTextColour(wxColour(128, 128, 128));
m_pMessageErrorGrayAttr->SetTextColour(wxColour(255, 128, 128));
}
// Force a complete update
@ -837,10 +813,10 @@ wxListItemAttr* CDlgEventLog::OnListGetItemAttr(long item) const {
if (message) {
switch(message->priority) {
case MSG_USER_ALERT:
pAttribute = item % 2 ? m_pMessageErrorGrayAttr : m_pMessageErrorAttr;
pAttribute = m_pMessageErrorAttr;
break;
default:
pAttribute = item % 2 ? m_pMessageInfoGrayAttr : m_pMessageInfoAttr;
pAttribute = m_pMessageInfoAttr;
break;
}
}

View File

@ -142,8 +142,6 @@ private:
wxListItemAttr* m_pMessageInfoAttr;
wxListItemAttr* m_pMessageErrorAttr;
wxListItemAttr* m_pMessageInfoGrayAttr;
wxListItemAttr* m_pMessageErrorGrayAttr;
bool m_bProcessingRefreshEvent;