2004-05-17 22:15:10 +00:00
|
|
|
// $Id$
|
|
|
|
//
|
2004-04-10 09:11:03 +00:00
|
|
|
// The contents of this file are subject to the BOINC Public License
|
|
|
|
// Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
// compliance with the License. You may obtain a copy of the License at
|
|
|
|
// http://boinc.berkeley.edu/license_1.0.txt
|
|
|
|
//
|
|
|
|
// Software distributed under the License is distributed on an "AS IS"
|
|
|
|
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
// License for the specific language governing rights and limitations
|
|
|
|
// under the License.
|
|
|
|
//
|
|
|
|
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
|
|
|
|
//
|
|
|
|
// The Initial Developer of the Original Code is the SETI@home project.
|
|
|
|
// Portions created by the SETI@home project are Copyright (C) 2002
|
|
|
|
// University of California at Berkeley. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Contributor(s):
|
|
|
|
//
|
2004-05-17 22:15:10 +00:00
|
|
|
// Revision History:
|
|
|
|
//
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-04-11 04:37:10 +00:00
|
|
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
2004-09-21 01:30:29 +00:00
|
|
|
#pragma implementation "ViewMessages.h"
|
2004-04-11 04:37:10 +00:00
|
|
|
#endif
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
#include "stdwx.h"
|
2004-08-11 23:52:22 +00:00
|
|
|
#include "BOINCGUIApp.h"
|
|
|
|
#include "MainDocument.h"
|
2004-09-24 22:19:02 +00:00
|
|
|
#include "BOINCTaskCtrl.h"
|
|
|
|
#include "BOINCListCtrl.h"
|
2004-09-21 01:30:29 +00:00
|
|
|
#include "ViewMessages.h"
|
2004-07-13 05:56:03 +00:00
|
|
|
#include "Events.h"
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
#include "wx/arrimpl.cpp"
|
|
|
|
|
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
#include "res/mess.xpm"
|
2004-09-24 22:19:02 +00:00
|
|
|
#include "res/task.xpm"
|
|
|
|
#include "res/tips.xpm"
|
|
|
|
|
|
|
|
|
2004-08-11 23:52:22 +00:00
|
|
|
#define COLUMN_PROJECT 0
|
|
|
|
#define COLUMN_TIME 1
|
|
|
|
#define COLUMN_MESSAGE 2
|
|
|
|
|
2004-09-29 22:21:45 +00:00
|
|
|
#define PRIORITY_INFO 1
|
|
|
|
#define PRIORITY_ERROR 2
|
|
|
|
|
2004-08-11 23:52:22 +00:00
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
WX_DEFINE_OBJARRAY( CMessageCache );
|
|
|
|
|
|
|
|
|
|
|
|
CMessage::CMessage()
|
|
|
|
{
|
|
|
|
m_strPriority = wxEmptyString;
|
|
|
|
m_strProjectName = wxEmptyString;
|
|
|
|
m_strTime = wxEmptyString;
|
|
|
|
m_strMessage = wxEmptyString;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CMessage::~CMessage()
|
|
|
|
{
|
|
|
|
m_strPriority.Clear();
|
|
|
|
m_strProjectName.Clear();
|
|
|
|
m_strTime.Clear();
|
|
|
|
m_strMessage.Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMessage::GetProjectName( wxString& strProjectName )
|
|
|
|
{
|
|
|
|
strProjectName = m_strProjectName;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMessage::GetPriority( wxString& strPriority )
|
|
|
|
{
|
|
|
|
strPriority = m_strPriority;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMessage::GetTime( wxString& strTime )
|
|
|
|
{
|
|
|
|
strTime = m_strTime;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMessage::GetMessage( wxString& strMessage )
|
|
|
|
{
|
|
|
|
strMessage = m_strMessage;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMessage::SetProjectName( wxString& strProjectName )
|
|
|
|
{
|
|
|
|
m_strProjectName = strProjectName;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMessage::SetPriority( wxString& strPriority )
|
|
|
|
{
|
|
|
|
m_strPriority = strPriority;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMessage::SetTime( wxString& strTime )
|
|
|
|
{
|
|
|
|
m_strTime = strTime;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CMessage::SetMessage( wxString& strMessage )
|
|
|
|
{
|
|
|
|
m_strMessage = strMessage;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IMPLEMENT_DYNAMIC_CLASS( CViewMessages, CBOINCBaseView )
|
2004-04-10 09:11:03 +00:00
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
CViewMessages::CViewMessages()
|
2004-04-10 09:11:03 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
CViewMessages::CViewMessages(wxNotebook* pNotebook) :
|
2004-10-27 21:10:22 +00:00
|
|
|
CBOINCBaseView( pNotebook, ID_HTML_MESSAGESVIEW, DEFAULT_HTML_FLAGS, ID_LIST_MESSAGESVIEW, DEFAULT_LIST_MULTI_SEL_FLAGS )
|
2004-04-10 09:11:03 +00:00
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
2004-12-23 01:06:41 +00:00
|
|
|
//
|
|
|
|
// Globalization/Localization
|
|
|
|
//
|
|
|
|
VIEW_HEADER = wxT("mess");
|
|
|
|
|
|
|
|
SECTION_TASK = VIEW_HEADER + wxT("task");
|
|
|
|
SECTION_TIPS = VIEW_HEADER + wxT("tips");
|
|
|
|
|
|
|
|
BITMAP_MESSAGE = VIEW_HEADER + wxT(".xpm");
|
|
|
|
BITMAP_TASKHEADER = SECTION_TASK + wxT(".xpm");
|
|
|
|
BITMAP_TIPSHEADER = SECTION_TIPS + wxT(".xpm");
|
|
|
|
|
|
|
|
LINKDESC_DEFAULT =
|
|
|
|
_("Click a message to see additional options.");
|
|
|
|
|
|
|
|
LINK_TASKCOPYALL = SECTION_TASK + wxT("copyall");
|
|
|
|
LINKDESC_TASKCOPYALL =
|
|
|
|
_("<b>Copy all</b><br>"
|
|
|
|
"Copy all the messages to the clipboard.");
|
|
|
|
|
|
|
|
LINK_TASKCOPYMESSAGE = SECTION_TASK + wxT("copymessage");
|
|
|
|
LINKDESC_TASKCOPYMESSAGE =
|
|
|
|
_("<b>Copy selected messages</b><br>"
|
|
|
|
"Copy the selected messages to the clipboard. "
|
|
|
|
"You can select multiple messages by holding down the shift "
|
|
|
|
"or control key while clicking on messages.");
|
|
|
|
|
|
|
|
//
|
|
|
|
// Setup View
|
|
|
|
//
|
2004-09-24 22:19:02 +00:00
|
|
|
wxBitmap bmpMessage(mess_xpm);
|
|
|
|
wxBitmap bmpTask(task_xpm);
|
|
|
|
wxBitmap bmpTips(tips_xpm);
|
|
|
|
|
|
|
|
bmpMessage.SetMask(new wxMask(bmpMessage, wxColour(255, 0, 255)));
|
|
|
|
bmpTask.SetMask(new wxMask(bmpTask, wxColour(255, 0, 255)));
|
|
|
|
bmpTips.SetMask(new wxMask(bmpTips, wxColour(255, 0, 255)));
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
m_pTaskPane->AddVirtualFile(BITMAP_MESSAGE, bmpMessage, wxBITMAP_TYPE_XPM);
|
2004-09-24 22:19:02 +00:00
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
m_pTaskPane->CreateTaskHeader(BITMAP_TASKHEADER, bmpTask, _("Tasks"));
|
2004-12-19 20:35:37 +00:00
|
|
|
m_pTaskPane->CreateTaskHeader(BITMAP_TIPSHEADER, bmpTips, _("Tips"));
|
2004-09-24 22:19:02 +00:00
|
|
|
|
2004-10-19 19:41:29 +00:00
|
|
|
m_pListPane->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 115);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_TIME, _("Time"), wxLIST_FORMAT_LEFT, 145);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_MESSAGE, _("Message"), wxLIST_FORMAT_LEFT, 550);
|
2004-09-24 22:19:02 +00:00
|
|
|
|
2004-09-29 22:21:45 +00:00
|
|
|
m_pMessageInfoAttr = new wxListItemAttr( *wxBLACK, *wxWHITE, wxNullFont );
|
|
|
|
m_pMessageErrorAttr = new wxListItemAttr( *wxRED, *wxWHITE, wxNullFont );
|
|
|
|
|
2004-09-24 22:19:02 +00:00
|
|
|
m_bTipsHeaderHidden = false;
|
2004-10-26 17:12:58 +00:00
|
|
|
m_bItemSelected = false;
|
2004-09-24 22:19:02 +00:00
|
|
|
|
|
|
|
SetCurrentQuickTip(
|
2004-10-19 19:41:29 +00:00
|
|
|
LINK_DEFAULT,
|
|
|
|
LINKDESC_DEFAULT
|
2004-09-24 22:19:02 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
UpdateSelection();
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
CViewMessages::~CViewMessages()
|
2004-04-10 09:11:03 +00:00
|
|
|
{
|
2004-09-29 22:21:45 +00:00
|
|
|
if ( m_pMessageInfoAttr )
|
|
|
|
{
|
|
|
|
delete m_pMessageInfoAttr;
|
|
|
|
m_pMessageInfoAttr = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_pMessageErrorAttr )
|
|
|
|
{
|
|
|
|
delete m_pMessageErrorAttr;
|
|
|
|
m_pMessageErrorAttr = NULL;
|
|
|
|
}
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
wxString CViewMessages::GetViewName()
|
2004-04-10 09:11:03 +00:00
|
|
|
{
|
|
|
|
return wxString(_("Messages"));
|
|
|
|
}
|
2004-04-11 05:09:18 +00:00
|
|
|
|
2004-04-13 00:33:40 +00:00
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
char** CViewMessages::GetViewIcon()
|
2004-04-13 00:33:40 +00:00
|
|
|
{
|
|
|
|
return mess_xpm;
|
|
|
|
}
|
|
|
|
|
2004-05-21 06:27:15 +00:00
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
wxInt32 CViewMessages::GetDocCount()
|
2004-10-26 08:41:02 +00:00
|
|
|
{
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
return pDoc->GetMessageCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
wxString CViewMessages::OnListGetItemText( long item, long column ) const
|
2004-09-25 21:33:24 +00:00
|
|
|
{
|
2004-12-02 07:43:47 +00:00
|
|
|
CMessage& message = m_MessageCache.Item( item );
|
|
|
|
wxString strBuffer = wxEmptyString;
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
switch(column)
|
|
|
|
{
|
|
|
|
case COLUMN_PROJECT:
|
|
|
|
message.GetProjectName( strBuffer );
|
|
|
|
break;
|
|
|
|
case COLUMN_TIME:
|
|
|
|
message.GetTime( strBuffer );
|
|
|
|
break;
|
|
|
|
case COLUMN_MESSAGE:
|
|
|
|
message.GetMessage( strBuffer );
|
|
|
|
break;
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
return strBuffer;
|
|
|
|
}
|
2004-10-05 02:55:26 +00:00
|
|
|
|
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
wxListItemAttr* CViewMessages::OnListGetItemAttr( long item ) const
|
|
|
|
{
|
|
|
|
wxListItemAttr* pAttribute = NULL;
|
|
|
|
CMessage& message = m_MessageCache.Item( item );
|
|
|
|
wxString strBuffer = wxEmptyString;
|
2004-10-05 03:40:28 +00:00
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
message.GetPriority( strBuffer );
|
2004-09-25 21:33:24 +00:00
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
if ( wxT("E") == strBuffer )
|
|
|
|
{
|
|
|
|
pAttribute = m_pMessageErrorAttr;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pAttribute = m_pMessageInfoAttr;
|
2004-09-21 01:30:29 +00:00
|
|
|
}
|
2004-10-19 21:23:15 +00:00
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
return pAttribute;
|
2004-05-21 06:27:15 +00:00
|
|
|
}
|
|
|
|
|
2004-08-11 23:52:22 +00:00
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
wxString CViewMessages::OnDocGetItemText( long item, long column ) const
|
2004-09-21 01:30:29 +00:00
|
|
|
{
|
2004-10-21 21:19:49 +00:00
|
|
|
wxString strBuffer = wxEmptyString;
|
2004-09-29 22:21:45 +00:00
|
|
|
|
|
|
|
switch(column)
|
|
|
|
{
|
2004-08-11 23:52:22 +00:00
|
|
|
case COLUMN_PROJECT:
|
2004-10-11 04:38:00 +00:00
|
|
|
FormatProjectName( item, strBuffer );
|
2004-08-11 23:52:22 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_TIME:
|
2004-10-11 04:38:00 +00:00
|
|
|
FormatTime( item, strBuffer );
|
2004-08-11 23:52:22 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_MESSAGE:
|
2004-10-11 04:38:00 +00:00
|
|
|
FormatMessage( item, strBuffer );
|
2004-08-11 23:52:22 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-09-29 22:21:45 +00:00
|
|
|
|
2004-08-11 23:52:22 +00:00
|
|
|
return strBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-24 22:19:02 +00:00
|
|
|
void CViewMessages::OnTaskLinkClicked( const wxHtmlLinkInfo& link )
|
2004-09-21 01:30:29 +00:00
|
|
|
{
|
2004-10-27 21:10:22 +00:00
|
|
|
wxInt32 iIndex = -1;
|
|
|
|
|
2004-09-24 22:19:02 +00:00
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
2004-12-23 03:36:51 +00:00
|
|
|
m_bTaskHeaderHidden = false;
|
|
|
|
m_bTipsHeaderHidden = false;
|
2004-11-05 19:38:11 +00:00
|
|
|
|
|
|
|
#ifndef NOCLIPBOARD
|
2004-12-23 03:36:51 +00:00
|
|
|
if ( link.GetHref() == LINK_TASKCOPYALL )
|
2004-10-27 21:10:22 +00:00
|
|
|
{
|
|
|
|
wxInt32 iRowCount = 0;
|
|
|
|
|
|
|
|
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 );
|
|
|
|
}
|
2004-09-24 22:19:02 +00:00
|
|
|
|
2004-10-27 21:10:22 +00:00
|
|
|
CloseClipboard();
|
|
|
|
}
|
2004-11-05 19:38:11 +00:00
|
|
|
#endif
|
|
|
|
|
2004-09-24 22:19:02 +00:00
|
|
|
UpdateSelection();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-11-19 08:11:49 +00:00
|
|
|
void CViewMessages::OnTaskCellMouseHover( wxHtmlCell* cell, wxCoord WXUNUSED(x), wxCoord WXUNUSED(y) )
|
2004-09-24 22:19:02 +00:00
|
|
|
{
|
|
|
|
if ( NULL != cell->GetLink() )
|
|
|
|
{
|
|
|
|
bool bUpdateSelection = false;
|
|
|
|
wxString strLink;
|
|
|
|
|
|
|
|
strLink = cell->GetLink()->GetHref();
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
if ( UpdateQuickTip( strLink, LINK_TASKCOPYALL, LINKDESC_TASKCOPYALL ) )
|
|
|
|
bUpdateSelection = true;
|
|
|
|
else if ( UpdateQuickTip( strLink, LINK_TASKCOPYMESSAGE, LINKDESC_TASKCOPYMESSAGE ) )
|
|
|
|
bUpdateSelection = true;
|
2004-09-24 22:19:02 +00:00
|
|
|
else
|
|
|
|
{
|
2004-10-05 02:55:26 +00:00
|
|
|
if ( 0 == m_pListPane->GetSelectedItemCount() )
|
2004-09-24 22:19:02 +00:00
|
|
|
{
|
2004-10-05 03:40:28 +00:00
|
|
|
if ( LINK_DEFAULT != GetCurrentQuickTip() )
|
2004-09-24 22:19:02 +00:00
|
|
|
{
|
|
|
|
SetCurrentQuickTip(
|
2004-10-05 03:40:28 +00:00
|
|
|
LINK_DEFAULT,
|
2004-10-19 19:41:29 +00:00
|
|
|
LINKDESC_DEFAULT
|
2004-09-24 22:19:02 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
bUpdateSelection = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bUpdateSelection )
|
|
|
|
{
|
|
|
|
UpdateSelection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
wxInt32 CViewMessages::AddCacheElement()
|
|
|
|
{
|
|
|
|
CMessage* pItem = new CMessage();
|
|
|
|
wxASSERT( NULL != pItem );
|
|
|
|
if ( NULL != pItem )
|
|
|
|
{
|
|
|
|
m_MessageCache.Add( pItem );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewMessages::EmptyCache()
|
|
|
|
{
|
2004-12-02 21:43:44 +00:00
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
m_MessageCache.Empty();
|
2004-12-02 21:43:44 +00:00
|
|
|
pDoc->ResetMessageState();
|
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewMessages::GetCacheCount()
|
|
|
|
{
|
|
|
|
return m_MessageCache.GetCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewMessages::RemoveCacheElement()
|
|
|
|
{
|
|
|
|
m_MessageCache.RemoveAt( GetCacheCount() - 1 );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewMessages::UpdateCache( long item, long column, wxString& strNewData )
|
|
|
|
{
|
|
|
|
CMessage& message = m_MessageCache.Item( item );
|
|
|
|
wxString strPriority = wxEmptyString;
|
|
|
|
|
|
|
|
switch(column)
|
|
|
|
{
|
|
|
|
case COLUMN_PROJECT:
|
|
|
|
message.SetProjectName( strNewData );
|
|
|
|
break;
|
|
|
|
case COLUMN_TIME:
|
|
|
|
message.SetTime( strNewData );
|
|
|
|
break;
|
|
|
|
case COLUMN_MESSAGE:
|
|
|
|
message.SetMessage( strNewData );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
FormatPriority( item, strPriority );
|
|
|
|
message.SetPriority( strPriority );
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool CViewMessages::EnsureLastItemVisible()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-24 22:19:02 +00:00
|
|
|
void CViewMessages::UpdateSelection()
|
|
|
|
{
|
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
2004-10-05 02:55:26 +00:00
|
|
|
if ( 0 == m_pListPane->GetSelectedItemCount() )
|
2004-09-24 22:19:02 +00:00
|
|
|
{
|
|
|
|
m_bTaskHeaderHidden = false;
|
|
|
|
m_bTaskCopyAllHidden = false;
|
|
|
|
m_bTaskCopyMessageHidden = true;
|
|
|
|
|
2004-10-09 03:05:01 +00:00
|
|
|
if ( m_bItemSelected )
|
|
|
|
{
|
|
|
|
SetCurrentQuickTip(
|
|
|
|
LINK_DEFAULT,
|
|
|
|
wxT("")
|
|
|
|
);
|
|
|
|
}
|
2004-09-24 22:19:02 +00:00
|
|
|
m_bItemSelected = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_bTaskHeaderHidden = false;
|
|
|
|
m_bTaskCopyAllHidden = false;
|
|
|
|
m_bTaskCopyMessageHidden = false;
|
|
|
|
|
|
|
|
m_bItemSelected = true;
|
|
|
|
}
|
|
|
|
UpdateTaskPane();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CViewMessages::UpdateTaskPane()
|
|
|
|
{
|
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
|
|
|
|
m_pTaskPane->BeginTaskPage();
|
|
|
|
|
2004-12-23 03:36:51 +00:00
|
|
|
m_pTaskPane->BeginTaskSection( BITMAP_TASKHEADER, m_bTaskHeaderHidden );
|
2004-09-24 22:19:02 +00:00
|
|
|
if (!m_bTaskHeaderHidden)
|
|
|
|
{
|
2004-12-23 03:36:51 +00:00
|
|
|
m_pTaskPane->CreateTask( LINK_TASKCOPYALL, _("Copy all messages"), m_bTaskCopyAllHidden );
|
|
|
|
m_pTaskPane->CreateTask( LINK_TASKCOPYMESSAGE, _("Copy selected messages"), m_bTaskCopyMessageHidden );
|
2004-09-24 22:19:02 +00:00
|
|
|
}
|
|
|
|
m_pTaskPane->EndTaskSection( m_bTaskHeaderHidden );
|
|
|
|
|
2004-12-23 03:36:51 +00:00
|
|
|
m_pTaskPane->UpdateQuickTip( BITMAP_TIPSHEADER, GetCurrentQuickTipText(), m_bTipsHeaderHidden );
|
2004-09-24 22:19:02 +00:00
|
|
|
|
|
|
|
m_pTaskPane->EndTaskPage();
|
2004-08-11 23:52:22 +00:00
|
|
|
}
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
|
|
|
|
wxInt32 CViewMessages::FormatProjectName( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
|
|
|
pDoc->GetMessageProjectName(item, strBuffer);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-12-02 07:43:47 +00:00
|
|
|
wxInt32 CViewMessages::FormatPriority( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
wxInt32 iBuffer = 0;
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
|
|
|
pDoc->GetMessagePriority(item, iBuffer);
|
|
|
|
|
|
|
|
switch(iBuffer)
|
|
|
|
{
|
|
|
|
case PRIORITY_INFO:
|
|
|
|
strBuffer = wxT("I");
|
|
|
|
break;
|
|
|
|
case PRIORITY_ERROR:
|
|
|
|
strBuffer = wxT("E");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
wxInt32 CViewMessages::FormatTime( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
|
|
|
wxDateTime dtBuffer(wxDateTime::Now());
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
|
|
|
pDoc->GetMessageTime(item, dtBuffer);
|
|
|
|
strBuffer = dtBuffer.Format();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wxInt32 CViewMessages::FormatMessage( wxInt32 item, wxString& strBuffer ) const
|
|
|
|
{
|
|
|
|
CMainDocument* pDoc = wxGetApp().GetDocument();
|
|
|
|
|
|
|
|
wxASSERT(NULL != pDoc);
|
|
|
|
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
|
|
|
|
|
|
|
strBuffer.Clear();
|
|
|
|
|
|
|
|
pDoc->GetMessageMessage(item, strBuffer);
|
|
|
|
|
2004-10-19 19:41:29 +00:00
|
|
|
strBuffer.Replace( wxT("\n"), wxT(""), true );
|
|
|
|
|
2004-10-11 04:38:00 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-10-27 21:10:22 +00:00
|
|
|
|
2004-11-05 19:38:11 +00:00
|
|
|
#ifndef NOCLIPBOARD
|
2004-10-27 21:10:22 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2004-11-05 19:38:11 +00:00
|
|
|
#endif
|
2004-12-08 00:40:19 +00:00
|
|
|
|
2005-01-02 18:29:53 +00:00
|
|
|
const char *BOINC_RCSID_0be7149475 = "$Id$";
|