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:
|
|
|
|
//
|
|
|
|
// $Log$
|
2004-09-21 01:30:29 +00:00
|
|
|
// Revision 1.1 2004/09/21 01:26:25 rwalton
|
2004-05-17 22:15:10 +00:00
|
|
|
// *** empty log message ***
|
|
|
|
//
|
|
|
|
//
|
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-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-04-13 00:33:40 +00:00
|
|
|
#include "res/mess.xpm"
|
|
|
|
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-08-11 23:52:22 +00:00
|
|
|
#define COLUMN_PROJECT 0
|
|
|
|
#define COLUMN_TIME 1
|
|
|
|
#define COLUMN_MESSAGE 2
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
IMPLEMENT_DYNAMIC_CLASS(CViewMessages, CBOINCBaseView)
|
2004-04-10 09:11:03 +00:00
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
BEGIN_EVENT_TABLE(CViewMessages, CBOINCBaseView)
|
|
|
|
EVT_LIST_CACHE_HINT(ID_LIST_MESSAGESVIEW, CViewMessages::OnCacheHint)
|
2004-07-13 05:56:03 +00:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
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
|
|
|
wxLogTrace("CViewMessages::CViewMessages - Function Begining");
|
|
|
|
wxLogTrace("CViewMessages::CViewMessages - Function Ending");
|
2004-04-10 09:11:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
CViewMessages::CViewMessages(wxNotebook* pNotebook) :
|
|
|
|
CBOINCBaseView(pNotebook, ID_LIST_MESSAGESVIEW, ID_HTML_MESSAGESVIEW)
|
2004-04-10 09:11:03 +00:00
|
|
|
{
|
2004-09-21 01:30:29 +00:00
|
|
|
m_bProcessingRenderEvent = false;
|
|
|
|
|
|
|
|
wxASSERT(NULL != m_pTaskPane);
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
|
|
|
|
m_pListPane->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, -1);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_TIME, _("Time"), wxLIST_FORMAT_LEFT, -1);
|
|
|
|
m_pListPane->InsertColumn(COLUMN_MESSAGE, _("Message"), wxLIST_FORMAT_LEFT, -1);
|
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
|
|
|
wxLogTrace("CViewMessages::~CViewMessages - Function Begining");
|
|
|
|
wxLogTrace("CViewMessages::~CViewMessages - Function Ending");
|
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-09-21 01:30:29 +00:00
|
|
|
void CViewMessages::OnRender(wxTimerEvent &event)
|
|
|
|
{
|
|
|
|
wxLogTrace("CViewMessages::OnRender - Processing Render Event...");
|
|
|
|
if (!m_bProcessingRenderEvent)
|
|
|
|
{
|
|
|
|
m_bProcessingRenderEvent = true;
|
2004-07-13 05:56:03 +00:00
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
wxInt32 iProjectCount = wxGetApp().GetDocument()->GetMessageCount();
|
|
|
|
wxASSERT(NULL != m_pListPane);
|
|
|
|
m_pListPane->SetItemCount(iProjectCount);
|
2004-07-13 05:56:03 +00:00
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
m_bProcessingRenderEvent = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
event.Skip();
|
|
|
|
}
|
2004-05-21 06:27:15 +00:00
|
|
|
}
|
|
|
|
|
2004-08-11 23:52:22 +00:00
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
wxString CViewMessages::OnGetItemText(long item, long column) const
|
|
|
|
{
|
2004-08-11 23:52:22 +00:00
|
|
|
wxString strBuffer;
|
|
|
|
switch(column) {
|
|
|
|
case COLUMN_PROJECT:
|
|
|
|
if (item == m_iCacheFrom) wxGetApp().GetDocument()->CachedStateLock();
|
2004-09-01 04:59:32 +00:00
|
|
|
strBuffer = wxGetApp().GetDocument()->GetMessageProjectName(item);
|
2004-08-11 23:52:22 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_TIME:
|
2004-09-01 04:59:32 +00:00
|
|
|
strBuffer = wxGetApp().GetDocument()->GetMessageTime(item);
|
2004-08-11 23:52:22 +00:00
|
|
|
break;
|
|
|
|
case COLUMN_MESSAGE:
|
2004-09-01 04:59:32 +00:00
|
|
|
strBuffer = wxGetApp().GetDocument()->GetMessageMessage(item);
|
2004-08-11 23:52:22 +00:00
|
|
|
if (item == m_iCacheTo) wxGetApp().GetDocument()->CachedStateUnlock();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return strBuffer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
int CViewMessages::OnGetItemImage(long item) const
|
|
|
|
{
|
2004-08-11 23:52:22 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-09-21 01:30:29 +00:00
|
|
|
wxListItemAttr* CViewMessages::OnGetItemAttr(long item) const
|
|
|
|
{
|
2004-08-11 23:52:22 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|