mirror of https://github.com/BOINC/boinc.git
MGR: Allow compile-time choice of either rules or alternating gray and white background stripes in lists
svn path=/trunk/boinc/; revision=20799
This commit is contained in:
parent
3b1cc344f4
commit
5a08d16602
|
@ -1663,3 +1663,14 @@ David 4 Mar 2010
|
|||
|
||||
client/
|
||||
client_state.cpp
|
||||
|
||||
Charlie 4 Mar 2010
|
||||
- MGR: Allow compile-time choice of either rules or alternating gray and white
|
||||
background stripes in lists by defining EVENT_LOG_STRIPES (in DlgEventLog.h)
|
||||
and BASEVIEW_STRIPES (in BOINCBaseView.h) to 0 for rules or 1 for stripes.
|
||||
|
||||
clientgui/
|
||||
BOINCBaseView.cpp,.h
|
||||
BOINCListCtrl.cpp, .h
|
||||
DlgEventLog.cpp, .h
|
||||
DlgEventLogListCtrl.h
|
||||
|
|
|
@ -61,6 +61,11 @@ CBOINCBaseView::CBOINCBaseView(wxNotebook* pNotebook) :
|
|||
SetName(GetViewName());
|
||||
|
||||
SetAutoLayout(TRUE);
|
||||
|
||||
#if BASEVIEW_STRIPES
|
||||
m_pWhiteBackgroundAttr = NULL;
|
||||
m_pGrayBackgroundAttr = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -119,6 +124,11 @@ CBOINCBaseView::CBOINCBaseView(
|
|||
m_SortArrows->Add( wxIcon( sortascending_xpm ) );
|
||||
m_SortArrows->Add( wxIcon( sortdescending_xpm ) );
|
||||
m_pListPane->SetImageList(m_SortArrows, wxIMAGE_LIST_SMALL);
|
||||
|
||||
#if BASEVIEW_STRIPES
|
||||
m_pWhiteBackgroundAttr = new wxListItemAttr(*wxBLACK, *wxWHITE, wxNullFont);
|
||||
m_pGrayBackgroundAttr = new wxListItemAttr(*wxBLACK, wxColour(240, 240, 240), wxNullFont);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -136,6 +146,18 @@ CBOINCBaseView::~CBOINCBaseView() {
|
|||
m_arrSelectedKeys1.Clear();
|
||||
m_arrSelectedKeys2.Clear();
|
||||
m_iSortedIndexes.Clear();
|
||||
|
||||
#if BASEVIEW_STRIPES
|
||||
if (m_pWhiteBackgroundAttr) {
|
||||
delete m_pWhiteBackgroundAttr;
|
||||
m_pWhiteBackgroundAttr = NULL;
|
||||
}
|
||||
|
||||
if (m_pGrayBackgroundAttr) {
|
||||
delete m_pGrayBackgroundAttr;
|
||||
m_pGrayBackgroundAttr = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -237,6 +259,18 @@ int CBOINCBaseView::FireOnListGetItemImage(long item) const {
|
|||
}
|
||||
|
||||
|
||||
#if BASEVIEW_STRIPES
|
||||
wxListItemAttr* CBOINCBaseView::FireOnListGetItemAttr(long item) const {
|
||||
return OnListGetItemAttr(item);
|
||||
}
|
||||
|
||||
|
||||
wxListItemAttr* CBOINCBaseView::OnListGetItemAttr(long item) const {
|
||||
return item % 2 ? m_pGrayBackgroundAttr : m_pWhiteBackgroundAttr;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void CBOINCBaseView::OnListRender(wxTimerEvent& event) {
|
||||
if (!m_bProcessingListRenderEvent) {
|
||||
m_bProcessingListRenderEvent = true;
|
||||
|
|
|
@ -22,9 +22,17 @@
|
|||
#pragma interface "BOINCBaseView.cpp"
|
||||
#endif
|
||||
|
||||
#define BASEVIEW_STRIPES 0
|
||||
|
||||
#define DEFAULT_TASK_FLAGS wxTAB_TRAVERSAL | wxADJUST_MINSIZE | wxFULL_REPAINT_ON_RESIZE
|
||||
|
||||
#if BASEVIEW_STRIPES
|
||||
#define DEFAULT_LIST_SINGLE_SEL_FLAGS wxLC_REPORT | wxLC_VIRTUAL | wxLC_SINGLE_SEL
|
||||
#define DEFAULT_LIST_MULTI_SEL_FLAGS wxLC_REPORT | wxLC_VIRTUAL
|
||||
#else
|
||||
#define DEFAULT_LIST_SINGLE_SEL_FLAGS wxLC_REPORT | wxLC_VIRTUAL | wxLC_HRULES | wxLC_SINGLE_SEL
|
||||
#define DEFAULT_LIST_MULTI_SEL_FLAGS wxLC_REPORT | wxLC_VIRTUAL | wxLC_HRULES
|
||||
#endif
|
||||
|
||||
|
||||
class CBOINCTaskCtrl;
|
||||
|
@ -126,7 +134,10 @@ public:
|
|||
void FireOnListDeselected( wxListEvent& event );
|
||||
wxString FireOnListGetItemText( long item, long column ) const;
|
||||
int FireOnListGetItemImage( long item ) const;
|
||||
|
||||
#if BASEVIEW_STRIPES
|
||||
wxListItemAttr* FireOnListGetItemAttr( long item ) const;
|
||||
#endif
|
||||
|
||||
int GetProgressColumn() { return m_iProgressColumn; }
|
||||
virtual double GetProgressValue(long item);
|
||||
virtual wxString GetProgressText( long item);
|
||||
|
@ -198,6 +209,13 @@ protected:
|
|||
static wxString HtmlEntityEncode(wxString strRaw);
|
||||
static wxString HtmlEntityDecode(wxString strRaw);
|
||||
|
||||
#if BASEVIEW_STRIPES
|
||||
virtual wxListItemAttr* OnListGetItemAttr( long item ) const;
|
||||
|
||||
wxListItemAttr* m_pWhiteBackgroundAttr;
|
||||
wxListItemAttr* m_pGrayBackgroundAttr;
|
||||
#endif
|
||||
|
||||
bool m_bProcessingTaskRenderEvent;
|
||||
bool m_bProcessingListRenderEvent;
|
||||
|
||||
|
|
|
@ -253,6 +253,16 @@ int CBOINCListCtrl::OnGetItemImage(long item) const {
|
|||
}
|
||||
|
||||
|
||||
#if BASEVIEW_STRIPES
|
||||
wxListItemAttr* CBOINCListCtrl::OnGetItemAttr(long item) const {
|
||||
wxASSERT(m_pParentView);
|
||||
wxASSERT(wxDynamicCast(m_pParentView, CBOINCBaseView));
|
||||
|
||||
return m_pParentView->FireOnListGetItemAttr(item);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void CBOINCListCtrl::DrawProgressBars()
|
||||
{
|
||||
long topItem, numItems, numVisibleItems, i, row;
|
||||
|
|
|
@ -46,6 +46,9 @@
|
|||
#include "macAccessiblity.h"
|
||||
#endif
|
||||
|
||||
#include "BOINCBaseView.h"
|
||||
|
||||
|
||||
class CBOINCBaseView;
|
||||
class CDrawProgressBarEvent;
|
||||
|
||||
|
@ -75,6 +78,9 @@ private:
|
|||
|
||||
virtual wxString OnGetItemText(long item, long column) const;
|
||||
virtual int OnGetItemImage(long item) const;
|
||||
#if BASEVIEW_STRIPES
|
||||
virtual wxListItemAttr* OnGetItemAttr(long item) const;
|
||||
#endif
|
||||
|
||||
CBOINCBaseView* m_pParentView;
|
||||
wxArrayInt m_iRowsNeedingProgressBars;
|
||||
|
|
|
@ -103,6 +103,16 @@ 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();
|
||||
|
||||
|
@ -166,6 +176,14 @@ bool CDlgEventLog::Create( wxWindow* WXUNUSED(parent), wxWindowID id, const wxSt
|
|||
wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),
|
||||
wxNullFont
|
||||
);
|
||||
#if EVENT_LOG_STRIPES
|
||||
m_pMessageInfoGrayAttr = new wxListItemAttr(*wxBLACK, wxColour(240, 240, 240), wxNullFont);
|
||||
m_pMessageErrorGrayAttr = new wxListItemAttr(*wxRED, wxColour(240, 240, 240), wxNullFont);
|
||||
m_pMessageErrorGrayAttr = new wxListItemAttr(*wxRED, wxColour(0, 0, 0, 15), wxNullFont);
|
||||
#else
|
||||
m_pMessageInfoGrayAttr = new wxListItemAttr(*m_pMessageInfoAttr);
|
||||
m_pMessageErrorGrayAttr = new wxListItemAttr(*m_pMessageErrorAttr);
|
||||
#endif
|
||||
|
||||
GetSizer()->Fit(this);
|
||||
GetSizer()->SetSizeHints(this);
|
||||
|
@ -190,7 +208,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, EVENT_LOG_DEFAULT_LIST_MULTI_SEL_FLAGS);
|
||||
itemFlexGridSizer2->Add(m_pList, 0, wxGROW|wxALL, 5);
|
||||
|
||||
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
@ -437,10 +455,14 @@ 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
|
||||
|
@ -801,10 +823,10 @@ wxListItemAttr* CDlgEventLog::OnListGetItemAttr(long item) const {
|
|||
if (message) {
|
||||
switch(message->priority) {
|
||||
case MSG_USER_ALERT:
|
||||
pAttribute = m_pMessageErrorAttr;
|
||||
pAttribute = item % 2 ? m_pMessageErrorGrayAttr : m_pMessageErrorAttr;
|
||||
break;
|
||||
default:
|
||||
pAttribute = m_pMessageInfoAttr;
|
||||
pAttribute = item % 2 ? m_pMessageInfoGrayAttr : m_pMessageInfoAttr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,14 @@
|
|||
#pragma interface "DlgEventLog.cpp"
|
||||
#endif
|
||||
|
||||
#define EVENT_LOG_STRIPES 1
|
||||
|
||||
#if EVENT_LOG_STRIPES
|
||||
#define EVENT_LOG_DEFAULT_LIST_MULTI_SEL_FLAGS wxLC_REPORT | wxLC_VIRTUAL
|
||||
#else
|
||||
#define EVENT_LOG_DEFAULT_LIST_MULTI_SEL_FLAGS wxLC_REPORT | wxLC_VIRTUAL | wxLC_HRULES
|
||||
#endif
|
||||
|
||||
|
||||
/*!
|
||||
* Includes
|
||||
|
@ -144,6 +152,8 @@ private:
|
|||
|
||||
wxListItemAttr* m_pMessageInfoAttr;
|
||||
wxListItemAttr* m_pMessageErrorAttr;
|
||||
wxListItemAttr* m_pMessageInfoGrayAttr;
|
||||
wxListItemAttr* m_pMessageErrorGrayAttr;
|
||||
|
||||
bool m_bProcessingRefreshEvent;
|
||||
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
#include "macAccessiblity.h"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_LIST_MULTI_SEL_FLAGS wxLC_REPORT | wxLC_VIRTUAL
|
||||
|
||||
class CDlgEventLog;
|
||||
|
||||
class CDlgEventLogListCtrl : public wxListView
|
||||
|
|
Loading…
Reference in New Issue