diff --git a/clientgui/BOINCBaseView.cpp b/clientgui/BOINCBaseView.cpp index 69e90fd839..79e04cab59 100644 --- a/clientgui/BOINCBaseView.cpp +++ b/clientgui/BOINCBaseView.cpp @@ -46,8 +46,8 @@ CBOINCBaseView::CBOINCBaseView() } -CBOINCBaseView::CBOINCBaseView(wxNotebook* pNotebook, wxWindowID iHtmlWindowID, wxWindowID iListWindowID) : - wxPanel(pNotebook, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL) +CBOINCBaseView::CBOINCBaseView( wxNotebook* pNotebook, wxWindowID iHtmlWindowID, wxInt32 iHtmlWindowFlags, wxWindowID iListWindowID, wxInt32 iListWindowFlags ) : + wxPanel( pNotebook, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ) { wxASSERT(NULL != pNotebook); @@ -76,10 +76,10 @@ CBOINCBaseView::CBOINCBaseView(wxNotebook* pNotebook, wxWindowID iHtmlWindowID, SetSizer(itemFlexGridSizer); SetAutoLayout(TRUE); - m_pTaskPane = new CBOINCTaskCtrl(this, iHtmlWindowID); + m_pTaskPane = new CBOINCTaskCtrl( this, iHtmlWindowID, iHtmlWindowFlags ); wxASSERT(NULL != m_pTaskPane); - m_pListPane = new CBOINCListCtrl(this, iListWindowID); + m_pListPane = new CBOINCListCtrl( this, iListWindowID, iListWindowFlags ); wxASSERT(NULL != m_pListPane); itemFlexGridSizer->Add(m_pTaskPane, 0, wxGROW|wxGROW|wxALL, 1); diff --git a/clientgui/BOINCBaseView.h b/clientgui/BOINCBaseView.h index 62353a96cb..542f4d7823 100644 --- a/clientgui/BOINCBaseView.h +++ b/clientgui/BOINCBaseView.h @@ -34,6 +34,10 @@ class CBOINCListCtrl; extern const wxString LINK_DEFAULT; +#define DEFAULT_HTML_FLAGS wxHW_SCROLLBAR_AUTO | wxHSCROLL | wxVSCROLL +#define DEFAULT_LIST_SINGLE_SEL_FLAGS wxLC_REPORT | wxLC_VIRTUAL | wxLC_SINGLE_SEL +#define DEFAULT_LIST_MULTI_SEL_FLAGS wxLC_REPORT | wxLC_VIRTUAL + class CBOINCBaseView : public wxPanel { @@ -41,31 +45,26 @@ class CBOINCBaseView : public wxPanel public: CBOINCBaseView(); - CBOINCBaseView(wxNotebook* pNotebook, wxWindowID iHtmlWindowID, wxWindowID iListWindowID); + CBOINCBaseView( + wxNotebook* pNotebook, + wxWindowID iHtmlWindowID, + wxInt32 iHtmlWindowFlags, + wxWindowID iListWindowID, + wxInt32 iListWindowFlags + ); ~CBOINCBaseView(); virtual wxString GetViewName(); virtual char** GetViewIcon(); - wxInt32 _GetListRowCount(); virtual wxInt32 GetListRowCount(); - void FireOnTaskRender( wxTimerEvent& event ); - void FireOnListRender( wxTimerEvent& event ); virtual void OnTaskRender( wxTimerEvent& event ); virtual void OnListRender( wxTimerEvent& event ); - bool FireOnSaveState( wxConfigBase* pConfig ); - bool FireOnRestoreState( wxConfigBase* pConfig ); virtual bool OnSaveState( wxConfigBase* pConfig ); virtual bool OnRestoreState( wxConfigBase* pConfig ); - void FireOnListCacheHint( wxListEvent& event ); - void FireOnListSelected( wxListEvent& event ); - void FireOnListDeselected( wxListEvent& event ); - wxString FireOnListGetItemText( long item, long column ) const; - int FireOnListGetItemImage( long item ) const; - wxListItemAttr* FireOnListGetItemAttr( long item ) const; virtual void OnListCacheHint( wxListEvent& event ); virtual void OnListSelected( wxListEvent& event ); virtual void OnListDeselected( wxListEvent& event ); @@ -73,11 +72,22 @@ public: virtual int OnListGetItemImage( long item ) const; virtual wxListItemAttr* OnListGetItemAttr( long item ) const; - void FireOnTaskLinkClicked( const wxHtmlLinkInfo& link ); - void FireOnTaskCellMouseHover( wxHtmlCell* cell, wxCoord x, wxCoord y ); virtual void OnTaskLinkClicked( const wxHtmlLinkInfo& link ); virtual void OnTaskCellMouseHover( wxHtmlCell* cell, wxCoord x, wxCoord y ); + void FireOnTaskRender( wxTimerEvent& event ); + void FireOnListRender( wxTimerEvent& event ); + bool FireOnSaveState( wxConfigBase* pConfig ); + bool FireOnRestoreState( wxConfigBase* pConfig ); + void FireOnListCacheHint( wxListEvent& event ); + void FireOnListSelected( wxListEvent& event ); + void FireOnListDeselected( wxListEvent& event ); + wxString FireOnListGetItemText( long item, long column ) const; + int FireOnListGetItemImage( long item ) const; + wxListItemAttr* FireOnListGetItemAttr( long item ) const; + void FireOnTaskLinkClicked( const wxHtmlLinkInfo& link ); + void FireOnTaskCellMouseHover( wxHtmlCell* cell, wxCoord x, wxCoord y ); + wxString GetCurrentQuickTip(); wxString GetCurrentQuickTipText(); void SetCurrentQuickTip( const wxString& strQuickTip, const wxString& strQuickTipText ); @@ -86,6 +96,10 @@ public: virtual void UpdateSelection(); virtual void UpdateTaskPane(); +protected: + + wxInt32 _GetListRowCount(); + bool m_bProcessingTaskRenderEvent; bool m_bProcessingListRenderEvent; diff --git a/clientgui/BOINCListCtrl.cpp b/clientgui/BOINCListCtrl.cpp index 403d7e0d8f..27eeeb3bff 100644 --- a/clientgui/BOINCListCtrl.cpp +++ b/clientgui/BOINCListCtrl.cpp @@ -39,8 +39,8 @@ CBOINCListCtrl::CBOINCListCtrl() } -CBOINCListCtrl::CBOINCListCtrl( CBOINCBaseView* pView, wxWindowID iListWindowID ) : - wxListView( pView, iListWindowID, wxDefaultPosition, wxSize(-1, -1), wxLC_REPORT | wxLC_VIRTUAL | wxLC_SINGLE_SEL, wxDefaultValidator ) +CBOINCListCtrl::CBOINCListCtrl( CBOINCBaseView* pView, wxWindowID iListWindowID, wxInt32 iListWindowFlags ) : + wxListView( pView, iListWindowID, wxDefaultPosition, wxSize(-1, -1), iListWindowFlags ) { m_pParentView = pView; } diff --git a/clientgui/BOINCListCtrl.h b/clientgui/BOINCListCtrl.h index fd82e50dfc..e869084f3a 100644 --- a/clientgui/BOINCListCtrl.h +++ b/clientgui/BOINCListCtrl.h @@ -37,7 +37,7 @@ class CBOINCListCtrl : public wxListView public: CBOINCListCtrl(); - CBOINCListCtrl( CBOINCBaseView* pView, wxWindowID iListWindowID ); + CBOINCListCtrl( CBOINCBaseView* pView, wxWindowID iListWindowID, wxInt32 iListWindowFlags ); ~CBOINCListCtrl(); diff --git a/clientgui/BOINCTaskCtrl.cpp b/clientgui/BOINCTaskCtrl.cpp index 14cdaf58eb..99513009de 100644 --- a/clientgui/BOINCTaskCtrl.cpp +++ b/clientgui/BOINCTaskCtrl.cpp @@ -46,8 +46,8 @@ CBOINCTaskCtrl::CBOINCTaskCtrl() } -CBOINCTaskCtrl::CBOINCTaskCtrl(CBOINCBaseView* pView, wxWindowID iHtmlWindowID) : - wxHtmlWindow( pView, iHtmlWindowID, wxDefaultPosition, wxSize(225, -1), wxHW_SCROLLBAR_AUTO|wxHSCROLL|wxVSCROLL ) +CBOINCTaskCtrl::CBOINCTaskCtrl( CBOINCBaseView* pView, wxWindowID iHtmlWindowID, wxInt32 iHtmlWindowFlags ) : + wxHtmlWindow( pView, iHtmlWindowID, wxDefaultPosition, wxSize(225, -1), iHtmlWindowFlags ) { m_pParentView = pView; } diff --git a/clientgui/BOINCTaskCtrl.h b/clientgui/BOINCTaskCtrl.h index ad8c2b27be..f05a59a489 100644 --- a/clientgui/BOINCTaskCtrl.h +++ b/clientgui/BOINCTaskCtrl.h @@ -37,7 +37,7 @@ class CBOINCTaskCtrl : public wxHtmlWindow public: CBOINCTaskCtrl(); - CBOINCTaskCtrl( CBOINCBaseView* pView, wxWindowID iHtmlWindowID ); + CBOINCTaskCtrl( CBOINCBaseView* pView, wxWindowID iHtmlWindowID, wxInt32 iHtmlWindowFlags ); ~CBOINCTaskCtrl(); diff --git a/clientgui/ViewMessages.cpp b/clientgui/ViewMessages.cpp index 390d8270f2..8b6ea63ea0 100644 --- a/clientgui/ViewMessages.cpp +++ b/clientgui/ViewMessages.cpp @@ -65,8 +65,8 @@ const wxString LINKDESC_TASKCOPYALL = const wxString LINK_TASKCOPYMESSAGE = wxT(SECTION_TASK "copymessage"); const wxString LINKDESC_TASKCOPYMESSAGE = - _("Copy Message
" - "Clicking copy message, copies the single message to the system clipboard."); + _("Copy Selection
" + "Clicking copy selection, copies the selected message(s) to the system clipboard.

You can select multiple items by holding down either the shift key or control key before clicking on the next desired message."); IMPLEMENT_DYNAMIC_CLASS(CViewMessages, CBOINCBaseView) @@ -78,7 +78,7 @@ CViewMessages::CViewMessages() CViewMessages::CViewMessages(wxNotebook* pNotebook) : - CBOINCBaseView(pNotebook, ID_HTML_MESSAGESVIEW, ID_LIST_MESSAGESVIEW) + CBOINCBaseView( pNotebook, ID_HTML_MESSAGESVIEW, DEFAULT_HTML_FLAGS, ID_LIST_MESSAGESVIEW, DEFAULT_LIST_MULTI_SEL_FLAGS ) { wxASSERT(NULL != m_pTaskPane); wxASSERT(NULL != m_pListPane); @@ -259,15 +259,45 @@ wxListItemAttr* CViewMessages::OnListGetItemAttr( long item ) const void CViewMessages::OnTaskLinkClicked( const wxHtmlLinkInfo& link ) { + wxInt32 iIndex = -1; + wxASSERT(NULL != m_pTaskPane); wxASSERT(NULL != m_pListPane); - wxString strMessage; - - if ( link.GetHref() == SECTION_TASK ) + if ( link.GetHref() == SECTION_TASK ) m_bTaskHeaderHidden ? m_bTaskHeaderHidden = false : m_bTaskHeaderHidden = true; + else if ( link.GetHref() == LINK_TASKCOPYALL ) + { + wxInt32 iRowCount = 0; - if ( link.GetHref() == SECTION_TIPS ) + OpenClipboard(); + + iRowCount = m_pListPane->GetItemCount(); + for ( iIndex = 0; iIndex < iRowCount; iIndex++ ) + { + CopyToClipboard( iIndex ); + } + + CloseClipboard(); + } + else if ( link.GetHref() == LINK_TASKCOPYMESSAGE ) + { + OpenClipboard(); + + for ( ;; ) + { + iIndex = m_pListPane->GetNextItem(iIndex, + wxLIST_NEXT_ALL, + wxLIST_STATE_SELECTED); + if ( iIndex == -1 ) + break; + + CopyToClipboard( iIndex ); + } + + CloseClipboard(); + } + else if ( link.GetHref() == SECTION_TIPS ) m_bTipsHeaderHidden ? m_bTipsHeaderHidden = false : m_bTipsHeaderHidden = true; @@ -354,7 +384,7 @@ void CViewMessages::UpdateTaskPane() if (!m_bTaskHeaderHidden) { m_pTaskPane->CreateTask( LINK_TASKCOPYALL, BITMAP_MESSAGE, _("Copy All"), m_bTaskCopyAllHidden ); - m_pTaskPane->CreateTask( LINK_TASKCOPYMESSAGE, BITMAP_MESSAGE, _("Copy Message"), m_bTaskCopyMessageHidden ); + m_pTaskPane->CreateTask( LINK_TASKCOPYMESSAGE, BITMAP_MESSAGE, _("Copy Selection"), m_bTaskCopyMessageHidden ); } m_pTaskPane->EndTaskSection( m_bTaskHeaderHidden ); @@ -412,3 +442,66 @@ wxInt32 CViewMessages::FormatMessage( wxInt32 item, wxString& strBuffer ) const return 0; } + +bool CViewMessages::OpenClipboard() +{ + bool bRetVal = false; + + bRetVal = wxTheClipboard->Open(); + if ( bRetVal ) + { + m_bClipboardOpen = true; + m_strClipboardData = wxEmptyString; + wxTheClipboard->Clear(); + } + + return bRetVal; +} + + +wxInt32 CViewMessages::CopyToClipboard( wxInt32 item ) +{ + wxInt32 iRetVal = -1; + + if ( m_bClipboardOpen ) + { + wxString strBuffer = wxEmptyString; + wxString strTimeStamp = wxEmptyString; + wxString strProject = wxEmptyString; + wxString strMessage = wxEmptyString; + + FormatTime( item, strTimeStamp ); + FormatProjectName( item, strProject ); + FormatMessage( item, strMessage ); + +#ifdef __WXMSW__ + strBuffer.Printf( wxT("%s|%s|%s\r\n"), strTimeStamp.c_str(), strProject.c_str(), strMessage.c_str() ); +#else + strBuffer.Printf( wxT("%s|%s|%s\n"), strTimeStamp.c_str(), strProject.c_str(), strMessage.c_str() ); +#endif + + m_strClipboardData += strBuffer; + + iRetVal = 0; + } + + return iRetVal; +} + + +bool CViewMessages::CloseClipboard() +{ + bool bRetVal = false; + + if ( m_bClipboardOpen ) + { + wxTheClipboard->SetData( new wxTextDataObject( m_strClipboardData ) ); + wxTheClipboard->Close(); + + m_bClipboardOpen = false; + m_strClipboardData = wxEmptyString; + } + + return bRetVal; +} + diff --git a/clientgui/ViewMessages.h b/clientgui/ViewMessages.h index 315870c06b..ec53fba59f 100644 --- a/clientgui/ViewMessages.h +++ b/clientgui/ViewMessages.h @@ -64,6 +64,9 @@ private: wxListItemAttr* m_pMessageInfoAttr; wxListItemAttr* m_pMessageErrorAttr; + bool m_bClipboardOpen; + wxString m_strClipboardData; + virtual void UpdateSelection(); virtual void UpdateTaskPane(); @@ -71,6 +74,10 @@ private: wxInt32 FormatTime( wxInt32 item, wxString& strBuffer ) const; wxInt32 FormatMessage( wxInt32 item, wxString& strBuffer ) const; + bool OpenClipboard(); + wxInt32 CopyToClipboard( wxInt32 item ); + bool CloseClipboard(); + }; diff --git a/clientgui/ViewProjects.cpp b/clientgui/ViewProjects.cpp index c66712ed89..53f3929456 100644 --- a/clientgui/ViewProjects.cpp +++ b/clientgui/ViewProjects.cpp @@ -126,7 +126,7 @@ CViewProjects::CViewProjects() CViewProjects::CViewProjects(wxNotebook* pNotebook) : - CBOINCBaseView(pNotebook, ID_HTML_PROJECTSVIEW, ID_LIST_PROJECTSVIEW) + CBOINCBaseView( pNotebook, ID_HTML_PROJECTSVIEW, DEFAULT_HTML_FLAGS, ID_LIST_PROJECTSVIEW, DEFAULT_LIST_SINGLE_SEL_FLAGS ) { wxASSERT(NULL != m_pTaskPane); wxASSERT(NULL != m_pListPane); diff --git a/clientgui/ViewResources.cpp b/clientgui/ViewResources.cpp index 23a1677492..a1ecb3a088 100644 --- a/clientgui/ViewResources.cpp +++ b/clientgui/ViewResources.cpp @@ -64,7 +64,7 @@ CViewResources::CViewResources() CViewResources::CViewResources(wxNotebook* pNotebook) : - CBOINCBaseView(pNotebook, ID_HTML_RESOURCEUTILIZATIONVIEW, ID_LIST_RESOURCEUTILIZATIONVIEW) + CBOINCBaseView( pNotebook, ID_HTML_RESOURCEUTILIZATIONVIEW, DEFAULT_HTML_FLAGS, ID_LIST_RESOURCEUTILIZATIONVIEW, DEFAULT_LIST_SINGLE_SEL_FLAGS ) { wxASSERT(NULL != m_pTaskPane); wxASSERT(NULL != m_pListPane); diff --git a/clientgui/ViewTransfers.cpp b/clientgui/ViewTransfers.cpp index 8629d52e79..635022f8c9 100644 --- a/clientgui/ViewTransfers.cpp +++ b/clientgui/ViewTransfers.cpp @@ -81,7 +81,7 @@ CViewTransfers::CViewTransfers() CViewTransfers::CViewTransfers(wxNotebook* pNotebook) : - CBOINCBaseView(pNotebook, ID_HTML_TRANSFERSVIEW, ID_LIST_TRANSFERSVIEW) + CBOINCBaseView( pNotebook, ID_HTML_TRANSFERSVIEW, DEFAULT_HTML_FLAGS, ID_LIST_TRANSFERSVIEW, DEFAULT_LIST_SINGLE_SEL_FLAGS ) { wxASSERT(NULL != m_pTaskPane); wxASSERT(NULL != m_pListPane); diff --git a/clientgui/ViewWork.cpp b/clientgui/ViewWork.cpp index 9eef2cc1d7..5ea59bfc45 100644 --- a/clientgui/ViewWork.cpp +++ b/clientgui/ViewWork.cpp @@ -92,7 +92,7 @@ CViewWork::CViewWork() CViewWork::CViewWork(wxNotebook* pNotebook) : - CBOINCBaseView(pNotebook, ID_HTML_WORKVIEW, ID_LIST_WORKVIEW) + CBOINCBaseView( pNotebook, ID_HTML_WORKVIEW, DEFAULT_HTML_FLAGS, ID_LIST_WORKVIEW, DEFAULT_LIST_SINGLE_SEL_FLAGS ) { wxASSERT(NULL != m_pTaskPane); wxASSERT(NULL != m_pListPane); diff --git a/clientgui/stdwx.h b/clientgui/stdwx.h index 5061aa18a8..9da8f24d25 100644 --- a/clientgui/stdwx.h +++ b/clientgui/stdwx.h @@ -72,16 +72,13 @@ #include // notebook support #include // html window support #include // static line support -#include // socket support -#include // socket streams support -#include // text streams support +#include // taskbar support +#include // clipboard support #include // date/time support -#include // dynamic array support #include #include #include #include -#include // Standard Libraries //