diff --git a/clientgui/BOINCBaseView.cpp b/clientgui/BOINCBaseView.cpp index df2d60324d..2a0316bbf3 100644 --- a/clientgui/BOINCBaseView.cpp +++ b/clientgui/BOINCBaseView.cpp @@ -58,11 +58,6 @@ CBOINCBaseView::CBOINCBaseView(wxNotebook* pNotebook) : SetName(GetViewName()); SetAutoLayout(TRUE); - -#if BASEVIEW_STRIPES - m_pWhiteBackgroundAttr = NULL; - m_pGrayBackgroundAttr = NULL; -#endif } @@ -118,20 +113,6 @@ CBOINCBaseView::CBOINCBaseView(wxNotebook* pNotebook, wxWindowID iTaskWindowID, 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( - wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), - wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW), - wxNullFont - ); - m_pGrayBackgroundAttr = new wxListItemAttr( - wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT), - wxColour(240, 240, 240), - wxNullFont - ); -#endif - } @@ -149,18 +130,6 @@ 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 } @@ -262,23 +231,6 @@ int CBOINCBaseView::FireOnListGetItemImage(long item) const { } -#if BASEVIEW_STRIPES -wxListItemAttr* CBOINCBaseView::FireOnListGetItemAttr(long item) const { - return OnListGetItemAttr(item); -} - - -wxListItemAttr* CBOINCBaseView::OnListGetItemAttr(long item) const { - - // If we are using some theme where the default background color isn't - // white, then our whole system is boned. Use defaults instead. - if (wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) != wxColor(wxT("WHITE"))) return NULL; - - return item % 2 ? m_pGrayBackgroundAttr : m_pWhiteBackgroundAttr; -} -#endif - - void CBOINCBaseView::OnListRender(wxTimerEvent& event) { if (!m_bProcessingListRenderEvent) { m_bProcessingListRenderEvent = true; @@ -330,24 +282,6 @@ void CBOINCBaseView::OnListRender(wxTimerEvent& event) { m_pListPane->EnsureVisible(iDocCount - 1); } } - - if (m_pListPane->m_bIsSingleSelection) { - // If no item has been selected yet, select the first item. -#ifdef __WXMSW__ - if ((m_pListPane->GetSelectedItemCount() == 0) && - (m_pListPane->GetItemCount() >= 1)) { - - long desiredstate = wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED; - m_pListPane->SetItemState(0, desiredstate, desiredstate); - } -#else - if ((m_pListPane->GetFirstSelected() < 0) && - (m_pListPane->GetItemCount() >= 1)) { - m_pListPane->SetItemState(0, wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED, - wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED); - } -#endif - } } // Find the previously selected items by their key values and reselect them diff --git a/clientgui/BOINCBaseView.h b/clientgui/BOINCBaseView.h index 67c69aabfb..5ac6f52dcd 100644 --- a/clientgui/BOINCBaseView.h +++ b/clientgui/BOINCBaseView.h @@ -22,19 +22,8 @@ #pragma interface "BOINCBaseView.cpp" #endif -#define BASEVIEW_STRIPES 1 -#define BASEVIEW_RULES 1 - #define DEFAULT_TASK_FLAGS wxTAB_TRAVERSAL | wxADJUST_MINSIZE | wxFULL_REPAINT_ON_RESIZE - -#if BASEVIEW_RULES -#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 -#else -#define DEFAULT_LIST_SINGLE_SEL_FLAGS wxLC_REPORT | wxLC_VIRTUAL | wxLC_SINGLE_SEL -#define DEFAULT_LIST_MULTI_SEL_FLAGS wxLC_REPORT | wxLC_VIRTUAL -#endif - +#define DEFAULT_LIST_FLAGS wxLC_REPORT | wxLC_VIRTUAL | wxLC_HRULES class CBOINCTaskCtrl; class CBOINCListCtrl; @@ -121,9 +110,6 @@ 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); @@ -197,13 +183,6 @@ 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; diff --git a/clientgui/BOINCListCtrl.cpp b/clientgui/BOINCListCtrl.cpp index f03ef281a1..85369d93e4 100644 --- a/clientgui/BOINCListCtrl.cpp +++ b/clientgui/BOINCListCtrl.cpp @@ -59,8 +59,9 @@ CBOINCListCtrl::CBOINCListCtrl( ) { m_pParentView = pView; - m_bIsSingleSelection = (iListWindowFlags & wxLC_SINGLE_SEL) ? true : false ; - + // Enable Zebra Striping + EnableAlternateRowColours(true); + #if USE_NATIVE_LISTCONTROL m_bProgressBarEventPending = false; #else @@ -68,12 +69,6 @@ CBOINCListCtrl::CBOINCListCtrl( SetupMacAccessibilitySupport(); #endif #endif - - Connect( - iListWindowID, - wxEVT_COMMAND_LEFT_CLICK, - (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &CBOINCListCtrl::OnClick - ); } @@ -214,39 +209,6 @@ void CBOINCListCtrl::AddPendingProgressBar(int row) { } -void CBOINCListCtrl::OnClick(wxCommandEvent& event) { - wxLogTrace(wxT("Function Start/End"), wxT("CBOINCListCtrl::OnClick - Function Begin")); - - wxASSERT(m_pParentView); - wxASSERT(wxDynamicCast(m_pParentView, CBOINCBaseView)); - - wxListEvent leDeselectedEvent(wxEVT_COMMAND_LIST_ITEM_DESELECTED, m_windowId); - leDeselectedEvent.SetEventObject(this); - - if (m_bIsSingleSelection) { - if (GetFocusedItem() != GetFirstSelected()) { - wxLogTrace(wxT("Function Status"), wxT("CBOINCListCtrl::OnClick - GetFocusedItem() '%d' != GetFirstSelected() '%d'"), GetFocusedItem(), GetFirstSelected()); - - if (-1 == GetFirstSelected()) { - wxLogTrace(wxT("Function Status"), wxT("CBOINCListCtrl::OnClick - Force Selected State")); - - long desiredstate = wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED; - SetItemState(GetFocusedItem(), desiredstate, desiredstate); - } else { - m_pParentView->FireOnListDeselected(leDeselectedEvent); - } - } - } else { - if (-1 == GetFirstSelected()) { - m_pParentView->FireOnListDeselected(leDeselectedEvent); - } - } - - event.Skip(); - wxLogTrace(wxT("Function Start/End"), wxT("CBOINCListCtrl::OnClick - Function End")); -} - - wxString CBOINCListCtrl::OnGetItemText(long item, long column) const { wxASSERT(m_pParentView); wxASSERT(wxDynamicCast(m_pParentView, CBOINCBaseView)); @@ -263,16 +225,6 @@ 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, row; diff --git a/clientgui/BOINCListCtrl.h b/clientgui/BOINCListCtrl.h index b2f6c63474..f0cc34ef5e 100644 --- a/clientgui/BOINCListCtrl.h +++ b/clientgui/BOINCListCtrl.h @@ -67,11 +67,7 @@ public: void AddPendingProgressBar(int row); void RefreshCell(int row, int col); - bool m_bIsSingleSelection; - private: - virtual void OnClick(wxCommandEvent& event); - virtual wxString OnGetItemText(long item, long column) const; virtual int OnGetItemImage(long item) const; #if BASEVIEW_STRIPES diff --git a/clientgui/ViewProjects.cpp b/clientgui/ViewProjects.cpp index 91909fefe7..f39d1789e7 100644 --- a/clientgui/ViewProjects.cpp +++ b/clientgui/ViewProjects.cpp @@ -155,7 +155,7 @@ CViewProjects::CViewProjects() CViewProjects::CViewProjects(wxNotebook* pNotebook) : - CBOINCBaseView(pNotebook, ID_TASK_PROJECTSVIEW, DEFAULT_TASK_FLAGS, ID_LIST_PROJECTSVIEW, DEFAULT_LIST_MULTI_SEL_FLAGS) + CBOINCBaseView(pNotebook, ID_TASK_PROJECTSVIEW, DEFAULT_TASK_FLAGS, ID_LIST_PROJECTSVIEW, DEFAULT_LIST_FLAGS) { CTaskItemGroup* pGroup = NULL; CTaskItem* pItem = NULL; diff --git a/clientgui/ViewTransfers.cpp b/clientgui/ViewTransfers.cpp index a14431b7dd..16c4ac293c 100644 --- a/clientgui/ViewTransfers.cpp +++ b/clientgui/ViewTransfers.cpp @@ -145,7 +145,7 @@ CViewTransfers::CViewTransfers() CViewTransfers::CViewTransfers(wxNotebook* pNotebook) : - CBOINCBaseView(pNotebook, ID_TASK_TRANSFERSVIEW, DEFAULT_TASK_FLAGS, ID_LIST_TRANSFERSVIEW, DEFAULT_LIST_MULTI_SEL_FLAGS) + CBOINCBaseView(pNotebook, ID_TASK_TRANSFERSVIEW, DEFAULT_TASK_FLAGS, ID_LIST_TRANSFERSVIEW, DEFAULT_LIST_FLAGS) { CTaskItemGroup* pGroup = NULL; CTaskItem* pItem = NULL; diff --git a/clientgui/ViewWork.cpp b/clientgui/ViewWork.cpp index 487cd978d9..0bd32c4d6d 100644 --- a/clientgui/ViewWork.cpp +++ b/clientgui/ViewWork.cpp @@ -169,7 +169,7 @@ CViewWork::CViewWork() CViewWork::CViewWork(wxNotebook* pNotebook) : - CBOINCBaseView(pNotebook, ID_TASK_WORKVIEW, DEFAULT_TASK_FLAGS, ID_LIST_WORKVIEW, DEFAULT_LIST_MULTI_SEL_FLAGS) + CBOINCBaseView(pNotebook, ID_TASK_WORKVIEW, DEFAULT_TASK_FLAGS, ID_LIST_WORKVIEW, DEFAULT_LIST_FLAGS) { CTaskItemGroup* pGroup = NULL; CTaskItem* pItem = NULL;