mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=4447
This commit is contained in:
parent
314ba22cc2
commit
774313effb
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class CBOINCListCtrl : public wxListView
|
|||
|
||||
public:
|
||||
CBOINCListCtrl();
|
||||
CBOINCListCtrl( CBOINCBaseView* pView, wxWindowID iListWindowID );
|
||||
CBOINCListCtrl( CBOINCBaseView* pView, wxWindowID iListWindowID, wxInt32 iListWindowFlags );
|
||||
|
||||
~CBOINCListCtrl();
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class CBOINCTaskCtrl : public wxHtmlWindow
|
|||
|
||||
public:
|
||||
CBOINCTaskCtrl();
|
||||
CBOINCTaskCtrl( CBOINCBaseView* pView, wxWindowID iHtmlWindowID );
|
||||
CBOINCTaskCtrl( CBOINCBaseView* pView, wxWindowID iHtmlWindowID, wxInt32 iHtmlWindowFlags );
|
||||
|
||||
~CBOINCTaskCtrl();
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ const wxString LINKDESC_TASKCOPYALL =
|
|||
|
||||
const wxString LINK_TASKCOPYMESSAGE = wxT(SECTION_TASK "copymessage");
|
||||
const wxString LINKDESC_TASKCOPYMESSAGE =
|
||||
_("<b>Copy Message</b><br>"
|
||||
"Clicking copy message, copies the single message to the system clipboard.");
|
||||
_("<b>Copy Selection</b><br>"
|
||||
"Clicking copy selection, copies the selected message(s) to the system clipboard.<br><br>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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -72,16 +72,13 @@
|
|||
#include <wx/notebook.h> // notebook support
|
||||
#include <wx/html/htmlwin.h> // html window support
|
||||
#include <wx/statline.h> // static line support
|
||||
#include <wx/socket.h> // socket support
|
||||
#include <wx/sckstrm.h> // socket streams support
|
||||
#include <wx/txtstrm.h> // text streams support
|
||||
#include <wx/taskbar.h> // taskbar support
|
||||
#include <wx/clipbrd.h> // clipboard support
|
||||
#include <wx/datetime.h> // date/time support
|
||||
#include <wx/dynarray.h> // dynamic array support
|
||||
#include <wx/mimetype.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/utils.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/taskbar.h>
|
||||
|
||||
// Standard Libraries
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue