2008-08-06 18:36:30 +00:00
// This file is part of BOINC.
2005-01-20 23:22:22 +00:00
// http://boinc.berkeley.edu
2008-08-06 18:36:30 +00:00
// Copyright (C) 2008 University of California
2004-05-17 22:15:10 +00:00
//
2008-08-06 18:36:30 +00:00
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
2004-04-10 09:11:03 +00:00
//
2008-08-06 18:36:30 +00:00
// BOINC is distributed in the hope that it will be useful,
2005-01-20 23:22:22 +00:00
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
2004-05-17 22:15:10 +00:00
//
2008-08-06 18:36:30 +00:00
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
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"
2006-10-20 15:00:14 +00:00
# include "BOINCBaseFrame.h"
2004-08-11 23:52:22 +00:00
# include "MainDocument.h"
2006-06-24 05:00:57 +00:00
# include "AdvancedFrame.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
2004-04-13 00:33:40 +00:00
# include "res/mess.xpm"
2004-09-24 22:19:02 +00:00
2004-08-11 23:52:22 +00:00
# define COLUMN_PROJECT 0
# define COLUMN_TIME 1
# define COLUMN_MESSAGE 2
2006-03-27 03:44:13 +00:00
// buttons in the "tasks" area
# define BTN_COPYALL 0
# define BTN_COPYSELECTED 1
2008-07-08 12:47:05 +00:00
# define BTN_FILTERMSGS 2
2006-03-27 03:44:13 +00:00
2004-08-11 23:52:22 +00:00
2005-04-07 07:04:50 +00:00
IMPLEMENT_DYNAMIC_CLASS ( CViewMessages , CBOINCBaseView )
2004-04-10 09:11:03 +00:00
2005-04-21 06:04:26 +00:00
BEGIN_EVENT_TABLE ( CViewMessages , CBOINCBaseView )
EVT_BUTTON ( ID_TASK_MESSAGES_COPYALL , CViewMessages : : OnMessagesCopyAll )
EVT_BUTTON ( ID_TASK_MESSAGES_COPYSELECTED , CViewMessages : : OnMessagesCopySelected )
2008-07-08 12:47:05 +00:00
EVT_BUTTON ( ID_TASK_MESSAGES_FILTERBYPROJECT , CViewMessages : : OnMessagesFilter )
2005-04-21 23:14:10 +00:00
EVT_LIST_ITEM_SELECTED ( ID_LIST_MESSAGESVIEW , CViewMessages : : OnListSelected )
EVT_LIST_ITEM_DESELECTED ( ID_LIST_MESSAGESVIEW , CViewMessages : : OnListDeselected )
2008-12-01 09:44:01 +00:00
EVT_LIST_CACHE_HINT ( ID_LIST_MESSAGESVIEW , CViewMessages : : OnCacheHint )
2005-04-21 06:04:26 +00:00
END_EVENT_TABLE ( )
2004-04-10 09:11:03 +00:00
2005-09-02 18:40:06 +00:00
CViewMessages : : CViewMessages ( )
{ }
2004-04-10 09:11:03 +00:00
2004-09-21 01:30:29 +00:00
CViewMessages : : CViewMessages ( wxNotebook * pNotebook ) :
2005-09-06 06:18:36 +00:00
CBOINCBaseView ( pNotebook , ID_TASK_MESSAGESVIEW , DEFAULT_TASK_FLAGS , ID_LIST_MESSAGESVIEW , DEFAULT_LIST_MULTI_SEL_FLAGS )
2005-04-21 06:04:26 +00:00
{
CTaskItemGroup * pGroup = NULL ;
CTaskItem * pItem = NULL ;
2005-04-08 16:58:55 +00:00
wxASSERT ( m_pTaskPane ) ;
wxASSERT ( m_pListPane ) ;
2004-09-21 01:30:29 +00:00
2005-04-21 06:04:26 +00:00
2005-02-02 22:20:25 +00:00
//
// Initialize variables used in later parts of the class
//
2008-07-08 12:47:05 +00:00
m_iPreviousRowCount = 0 ;
m_iTotalDocCount = 0 ;
m_iPreviousTotalDocCount = 0 ;
m_bIsFiltered = false ;
m_strFilteredProjectName . clear ( ) ;
m_iFilteredIndexes . Clear ( ) ;
2004-12-23 01:06:41 +00:00
//
2005-04-21 06:04:26 +00:00
// Setup View
2004-12-23 01:06:41 +00:00
//
2006-02-08 06:56:34 +00:00
pGroup = new CTaskItemGroup ( _ ( " Commands " ) ) ;
2005-04-21 06:04:26 +00:00
m_TaskGroups . push_back ( pGroup ) ;
2004-12-23 01:06:41 +00:00
2005-04-21 06:04:26 +00:00
pItem = new CTaskItem (
_ ( " Copy all messages " ) ,
_ ( " Copy all the messages to the clipboard. " ) ,
ID_TASK_MESSAGES_COPYALL
) ;
pGroup - > m_Tasks . push_back ( pItem ) ;
2004-12-23 01:06:41 +00:00
2005-04-21 06:04:26 +00:00
pItem = new CTaskItem (
_ ( " Copy selected messages " ) ,
2006-11-19 12:18:17 +00:00
# ifdef __WXMAC__
2008-07-08 20:05:07 +00:00
_ ( " Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or command key while clicking on messages. " ) ,
2006-11-17 10:55:17 +00:00
# else
2008-07-08 20:05:07 +00:00
_ ( " Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or control key while clicking on messages. " ) ,
2006-11-17 10:55:17 +00:00
# endif
2005-04-21 06:04:26 +00:00
ID_TASK_MESSAGES_COPYSELECTED
) ;
pGroup - > m_Tasks . push_back ( pItem ) ;
2004-09-24 22:19:02 +00:00
2008-07-08 12:47:05 +00:00
pItem = new CTaskItem (
_ ( " Show only this project " ) ,
_ ( " Show only the messages for the selected project. " ) ,
ID_TASK_MESSAGES_FILTERBYPROJECT
) ;
pGroup - > m_Tasks . push_back ( pItem ) ;
2004-09-24 22:19:02 +00:00
2005-04-21 06:04:26 +00:00
// Create Task Pane Items
2005-04-21 23:14:10 +00:00
m_pTaskPane - > UpdateControls ( ) ;
2004-09-24 22:19:02 +00:00
2005-04-21 06:04:26 +00:00
// Create List Pane Items
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
2005-04-07 07:04:50 +00:00
m_pMessageInfoAttr = new wxListItemAttr ( * wxBLACK , * wxWHITE , wxNullFont ) ;
m_pMessageErrorAttr = new wxListItemAttr ( * wxRED , * wxWHITE , wxNullFont ) ;
2008-09-08 12:39:41 +00:00
m_pMessageInfoGrayAttr = new wxListItemAttr ( * wxBLACK , wxColour ( 240 , 240 , 240 ) , wxNullFont ) ;
m_pMessageErrorGrayAttr = new wxListItemAttr ( * wxRED , wxColour ( 240 , 240 , 240 ) , wxNullFont ) ;
2005-04-22 01:46:32 +00:00
UpdateSelection ( ) ;
2004-04-10 09:11:03 +00:00
}
2005-04-07 07:04:50 +00:00
CViewMessages : : ~ CViewMessages ( ) {
if ( m_pMessageInfoAttr ) {
2004-09-29 22:21:45 +00:00
delete m_pMessageInfoAttr ;
m_pMessageInfoAttr = NULL ;
}
2005-04-07 07:04:50 +00:00
if ( m_pMessageErrorAttr ) {
2004-09-29 22:21:45 +00:00
delete m_pMessageErrorAttr ;
m_pMessageErrorAttr = NULL ;
}
2008-09-08 12:39:41 +00:00
if ( m_pMessageInfoGrayAttr ) {
delete m_pMessageInfoGrayAttr ;
m_pMessageInfoGrayAttr = NULL ;
}
if ( m_pMessageErrorGrayAttr ) {
delete m_pMessageErrorGrayAttr ;
m_pMessageErrorGrayAttr = NULL ;
}
2005-04-21 06:04:26 +00:00
EmptyTasks ( ) ;
2008-07-08 12:47:05 +00:00
m_strFilteredProjectName . clear ( ) ;
m_iFilteredIndexes . Clear ( ) ;
2004-04-10 09:11:03 +00:00
}
2005-09-02 21:03:36 +00:00
wxString & CViewMessages : : GetViewName ( ) {
2009-05-01 01:32:26 +00:00
static wxString strViewName ( wxT ( " Messages " ) ) ;
2005-09-02 20:56:08 +00:00
return strViewName ;
2004-04-10 09:11:03 +00:00
}
2004-04-11 05:09:18 +00:00
2004-04-13 00:33:40 +00:00
- fixes #207 - HTML entities in BOINC Manager have to be decoded
BOINC Manager can now properly decode HTML entites for the
following elements:
Projects Tab:
Project Name
User Name
Team Name
Work Tab:
Project Name
Application Name
Transfers Tab:
Project Name
Messages Tab:
Project Name
Disk Tab:
Project Name
- fixes #212 - Info in columns misaligned on switching views
- Properly restore which tab view the user left from when going
to the advanced view from the simple view
- Fix the problem that caused the manager to wait for 7 seconds
to display anything on initial startup.
- Store the various Grid/List persisted data seperately so that
the different header sizes don't cause problems.
clientgui/
AdvancedFrame.cpp
BOINCBaseView.cpp, .h
BOINCGridCtrl.cpp
ViewMessages.cpp, .h
ViewMessagesGrid.cpp, .h
ViewProjects.cpp, .h
ViewProjectsGrid.cpp, .h
ViewResources.cpp, .h
ViewStatistics.cpp, .h
ViewTransfers.cpp, .h
ViewTransfersGrid.cpp, .h
ViewWork.cpp, .h
ViewWorkGrid.cpp, .h
lib/
gui_rpc_client_ops.C
svn path=/trunk/boinc/; revision=12761
2007-05-29 05:07:35 +00:00
wxString & CViewMessages : : GetViewDisplayName ( ) {
static wxString strViewName ( _ ( " Messages " ) ) ;
return strViewName ;
}
2005-04-07 07:04:50 +00:00
const char * * CViewMessages : : GetViewIcon ( ) {
2004-04-13 00:33:40 +00:00
return mess_xpm ;
}
2004-05-21 06:27:15 +00:00
2005-07-07 22:26:49 +00:00
void CViewMessages : : OnMessagesCopyAll ( wxCommandEvent & WXUNUSED ( event ) ) {
2005-04-21 06:04:26 +00:00
wxLogTrace ( wxT ( " Function Start/End " ) , wxT ( " CViewMessages::OnMessagesCopyAll - Function Begin " ) ) ;
2006-06-24 05:00:57 +00:00
CAdvancedFrame * pFrame = wxDynamicCast ( GetParent ( ) - > GetParent ( ) - > GetParent ( ) , CAdvancedFrame ) ;
2005-04-21 06:04:26 +00:00
2005-04-27 06:55:28 +00:00
wxASSERT ( pFrame ) ;
2006-06-24 05:00:57 +00:00
wxASSERT ( wxDynamicCast ( pFrame , CAdvancedFrame ) ) ;
2008-09-13 00:27:13 +00:00
wxASSERT ( m_pListPane ) ;
2005-08-02 21:55:32 +00:00
# ifdef wxUSE_CLIPBOARD
2005-04-22 00:20:56 +00:00
wxInt32 iIndex = - 1 ;
wxInt32 iRowCount = 0 ;
2005-04-21 06:04:26 +00:00
pFrame - > UpdateStatusText ( _ ( " Copying all messages to the clipboard... " ) ) ;
iRowCount = m_pListPane - > GetItemCount ( ) ;
2009-02-05 19:25:08 +00:00
OpenClipboard ( iRowCount * 1024 ) ;
2005-04-21 06:04:26 +00:00
for ( iIndex = 0 ; iIndex < iRowCount ; iIndex + + ) {
CopyToClipboard ( iIndex ) ;
}
CloseClipboard ( ) ;
2009-02-05 19:25:08 +00:00
2005-04-21 06:04:26 +00:00
pFrame - > UpdateStatusText ( wxT ( " " ) ) ;
# endif
2005-04-21 23:14:10 +00:00
UpdateSelection ( ) ;
2005-04-21 06:04:26 +00:00
wxLogTrace ( wxT ( " Function Start/End " ) , wxT ( " CViewMessages::OnMessagesCopyAll - Function End " ) ) ;
}
2005-07-07 22:26:49 +00:00
void CViewMessages : : OnMessagesCopySelected ( wxCommandEvent & WXUNUSED ( event ) ) {
2005-04-21 06:04:26 +00:00
wxLogTrace ( wxT ( " Function Start/End " ) , wxT ( " CViewMessages::OnMessagesCopySelected - Function Begin " ) ) ;
2006-06-24 05:00:57 +00:00
CAdvancedFrame * pFrame = wxDynamicCast ( GetParent ( ) - > GetParent ( ) - > GetParent ( ) , CAdvancedFrame ) ;
2005-04-21 06:04:26 +00:00
2005-04-27 06:55:28 +00:00
wxASSERT ( pFrame ) ;
2006-06-24 05:00:57 +00:00
wxASSERT ( wxDynamicCast ( pFrame , CAdvancedFrame ) ) ;
2008-09-13 00:27:13 +00:00
wxASSERT ( m_pListPane ) ;
2005-08-02 21:55:32 +00:00
# ifdef wxUSE_CLIPBOARD
2005-04-22 00:20:56 +00:00
2009-02-05 19:25:08 +00:00
wxInt32 iIndex = - 1 ;
wxInt32 iRowCount = 0 ;
2005-04-22 00:20:56 +00:00
2008-09-14 12:39:19 +00:00
pFrame - > UpdateStatusText ( _ ( " Copying selected messages to the clipboard... " ) ) ;
2005-04-21 06:04:26 +00:00
2009-02-05 19:25:08 +00:00
// Count the number of items selected
for ( ; ; ) {
iIndex = m_pListPane - > GetNextItem (
iIndex , wxLIST_NEXT_ALL , wxLIST_STATE_SELECTED
) ;
if ( iIndex = = - 1 ) break ;
iRowCount + + ;
}
OpenClipboard ( iRowCount * 1024 ) ;
// Reset the position indicator
iIndex = - 1 ;
// Copy selected items to clipboard
2005-04-21 06:04:26 +00:00
for ( ; ; ) {
iIndex = m_pListPane - > GetNextItem (
iIndex , wxLIST_NEXT_ALL , wxLIST_STATE_SELECTED
) ;
if ( iIndex = = - 1 ) break ;
CopyToClipboard ( iIndex ) ;
}
CloseClipboard ( ) ;
2009-02-05 19:25:08 +00:00
2005-04-21 06:04:26 +00:00
pFrame - > UpdateStatusText ( wxT ( " " ) ) ;
# endif
2005-04-21 23:14:10 +00:00
UpdateSelection ( ) ;
2005-04-21 06:04:26 +00:00
wxLogTrace ( wxT ( " Function Start/End " ) , wxT ( " CViewMessages::OnMessagesCopySelected - Function End " ) ) ;
}
2008-07-08 12:47:05 +00:00
void CViewMessages : : OnMessagesFilter ( wxCommandEvent & WXUNUSED ( event ) ) {
wxLogTrace ( wxT ( " Function Start/End " ) , wxT ( " CViewMessages::OnMessagesFilter - Function Begin " ) ) ;
wxInt32 iIndex = - 1 ;
2009-12-19 04:26:01 +00:00
CAdvancedFrame * pFrame = wxDynamicCast ( GetParent ( ) - > GetParent ( ) - > GetParent ( ) , CAdvancedFrame ) ;
MESSAGE * message ;
2008-07-08 12:47:05 +00:00
wxASSERT ( pFrame ) ;
wxASSERT ( wxDynamicCast ( pFrame , CAdvancedFrame ) ) ;
2008-09-13 00:27:13 +00:00
wxASSERT ( m_pListPane ) ;
2008-07-08 12:47:05 +00:00
m_iFilteredIndexes . Clear ( ) ;
m_strFilteredProjectName . clear ( ) ;
if ( m_bIsFiltered ) {
m_bIsFiltered = false ;
m_iFilteredDocCount = m_iTotalDocCount ;
} else {
iIndex = m_pListPane - > GetNextItem ( - 1 , wxLIST_NEXT_ALL , wxLIST_STATE_SELECTED ) ;
if ( iIndex > = 0 ) {
message = wxGetApp ( ) . GetDocument ( ) - > message ( iIndex ) ;
if ( ( message - > project ) . size ( ) > 0 ) {
pFrame - > UpdateStatusText ( _ ( " Filtering messages... " ) ) ;
m_strFilteredProjectName = message - > project ;
m_bIsFiltered = true ;
for ( iIndex = 0 ; iIndex < m_iTotalDocCount ; iIndex + + ) {
message = wxGetApp ( ) . GetDocument ( ) - > message ( iIndex ) ;
2009-03-03 22:30:52 +00:00
if ( message - > project . empty ( ) | | ( message - > project = = m_strFilteredProjectName ) ) {
2008-07-08 12:47:05 +00:00
m_iFilteredIndexes . Add ( iIndex ) ;
}
}
2009-03-03 22:30:52 +00:00
m_iFilteredDocCount = ( int ) ( m_iFilteredIndexes . GetCount ( ) ) ;
2008-07-08 12:47:05 +00:00
}
}
}
// Force a complete update
m_iPreviousRowCount = 0 ;
m_pListPane - > DeleteAllItems ( ) ;
m_pListPane - > SetItemCount ( m_iFilteredDocCount ) ;
UpdateSelection ( ) ;
2008-09-14 13:55:39 +00:00
pFrame - > FireRefreshView ( ) ;
2008-07-08 12:47:05 +00:00
pFrame - > UpdateStatusText ( wxT ( " " ) ) ;
wxLogTrace ( wxT ( " Function Start/End " ) , wxT ( " CViewMessages::OnMessagesFilter - Function End " ) ) ;
}
wxInt32 CViewMessages : : GetFilteredMessageIndex ( wxInt32 iRow ) const {
if ( m_bIsFiltered ) return m_iFilteredIndexes [ iRow ] ;
return iRow ;
}
// Get the (possibly filtered) item count (i.e., the Row count)
2005-04-07 07:04:50 +00:00
wxInt32 CViewMessages : : GetDocCount ( ) {
2008-07-08 12:47:05 +00:00
int i ;
m_iTotalDocCount = wxGetApp ( ) . GetDocument ( ) - > GetMessageCount ( ) ;
2008-07-08 13:13:20 +00:00
if ( m_iTotalDocCount < m_iPreviousTotalDocCount ) {
// Usually due to a disconnect from client
m_bIsFiltered = false ;
2008-07-09 06:15:17 +00:00
m_strFilteredProjectName . clear ( ) ;
m_iFilteredIndexes . Clear ( ) ;
2008-07-08 13:13:20 +00:00
UpdateSelection ( ) ;
}
2008-07-08 12:47:05 +00:00
if ( m_bIsFiltered ) {
for ( i = m_iPreviousTotalDocCount ; i < m_iTotalDocCount ; i + + ) {
MESSAGE * message = wxGetApp ( ) . GetDocument ( ) - > message ( i ) ;
2009-03-03 21:58:03 +00:00
if ( message - > project . empty ( ) | | ( message - > project = = m_strFilteredProjectName ) ) {
2008-07-08 12:47:05 +00:00
m_iFilteredIndexes . Add ( i ) ;
}
}
m_iPreviousTotalDocCount = m_iTotalDocCount ;
m_iFilteredDocCount = ( int ) ( m_iFilteredIndexes . GetCount ( ) ) ;
return m_iFilteredDocCount ;
}
m_iPreviousTotalDocCount = m_iTotalDocCount ;
m_iFilteredDocCount = m_iTotalDocCount ;
return m_iTotalDocCount ;
2004-10-26 08:41:02 +00:00
}
2005-04-07 07:04:50 +00:00
void CViewMessages : : OnListRender ( wxTimerEvent & event ) {
2008-01-16 07:20:58 +00:00
bool isConnected ;
static bool was_connected = false ;
2008-02-28 10:07:00 +00:00
static wxString strLastMachineName = wxEmptyString ;
wxString strNewMachineName = wxEmptyString ;
CMainDocument * pDoc = wxGetApp ( ) . GetDocument ( ) ;
wxASSERT ( pDoc ) ;
wxASSERT ( wxDynamicCast ( pDoc , CMainDocument ) ) ;
2008-01-16 07:20:58 +00:00
2005-04-07 07:04:50 +00:00
if ( ! m_bProcessingListRenderEvent ) {
2005-02-02 22:20:25 +00:00
m_bProcessingListRenderEvent = true ;
2005-04-08 16:58:55 +00:00
wxASSERT ( m_pListPane ) ;
2005-02-02 22:20:25 +00:00
2008-02-28 10:07:00 +00:00
isConnected = pDoc - > IsConnected ( ) ;
2008-07-08 12:47:05 +00:00
wxInt32 iRowCount = GetDocCount ( ) ;
if ( 0 > = iRowCount ) {
2005-02-02 22:20:25 +00:00
m_pListPane - > DeleteAllItems ( ) ;
2005-04-07 07:04:50 +00:00
} else {
2008-01-16 07:20:58 +00:00
// If connection status changed, adjust color of messages display
if ( was_connected ! = isConnected ) {
was_connected = isConnected ;
if ( isConnected ) {
m_pMessageInfoAttr - > SetTextColour ( * wxBLACK ) ;
m_pMessageErrorAttr - > SetTextColour ( * wxRED ) ;
2008-09-08 12:39:41 +00:00
m_pMessageInfoGrayAttr - > SetTextColour ( * wxBLACK ) ;
m_pMessageErrorGrayAttr - > SetTextColour ( * wxRED ) ;
2008-01-16 07:20:58 +00:00
} else {
wxColourDatabase colorBase ;
m_pMessageInfoAttr - > SetTextColour ( wxColour ( 128 , 128 , 128 ) ) ;
m_pMessageErrorAttr - > SetTextColour ( wxColour ( 255 , 128 , 128 ) ) ;
2008-09-08 12:39:41 +00:00
m_pMessageInfoGrayAttr - > SetTextColour ( wxColour ( 128 , 128 , 128 ) ) ;
m_pMessageErrorGrayAttr - > SetTextColour ( wxColour ( 255 , 128 , 128 ) ) ;
2008-01-16 07:20:58 +00:00
}
2008-02-25 23:56:51 +00:00
// Force a complete update
m_pListPane - > DeleteAllItems ( ) ;
2008-07-08 12:47:05 +00:00
m_pListPane - > SetItemCount ( iRowCount ) ;
2008-12-17 12:41:57 +00:00
m_iPreviousRowCount = 0 ; // Force scrolling to bottom
} else {
// Connection status didn't change
if ( m_iPreviousRowCount ! = iRowCount ) {
m_pListPane - > SetItemCount ( iRowCount ) ;
}
}
2005-02-02 22:20:25 +00:00
}
2009-08-27 01:46:20 +00:00
if ( ( iRowCount > 1 ) & & ( _EnsureLastItemVisible ( ) ) & & ( m_iPreviousRowCount ! = iRowCount ) ) {
2008-07-08 12:47:05 +00:00
m_pListPane - > EnsureVisible ( iRowCount - 1 ) ;
2005-04-08 16:58:55 +00:00
}
2005-02-02 22:20:25 +00:00
2008-02-28 10:07:00 +00:00
if ( isConnected ) {
pDoc - > GetConnectedComputerName ( strNewMachineName ) ;
if ( strLastMachineName ! = strNewMachineName ) {
strLastMachineName = strNewMachineName ;
2008-09-14 12:39:19 +00:00
if ( iRowCount ) {
m_pListPane - > EnsureVisible ( iRowCount - 1 ) ;
}
2008-02-28 10:07:00 +00:00
}
}
2008-07-08 12:47:05 +00:00
if ( m_iPreviousRowCount ! = iRowCount ) {
m_iPreviousRowCount = iRowCount ;
2005-04-08 16:58:55 +00:00
}
2005-02-03 22:33:27 +00:00
2005-02-02 22:20:25 +00:00
m_bProcessingListRenderEvent = false ;
}
event . Skip ( ) ;
}
2005-04-07 07:04:50 +00:00
wxString CViewMessages : : OnListGetItemText ( long item , long column ) const {
2004-12-02 07:43:47 +00:00
wxString strBuffer = wxEmptyString ;
2008-07-08 12:47:05 +00:00
wxInt32 index = GetFilteredMessageIndex ( item ) ;
2005-04-07 07:04:50 +00:00
switch ( column ) {
2005-04-08 16:58:55 +00:00
case COLUMN_PROJECT :
2008-07-08 12:47:05 +00:00
FormatProjectName ( index , strBuffer ) ;
2005-04-08 16:58:55 +00:00
break ;
case COLUMN_TIME :
2008-07-08 12:47:05 +00:00
FormatTime ( index , strBuffer ) ;
2005-04-08 16:58:55 +00:00
break ;
case COLUMN_MESSAGE :
2008-07-08 12:47:05 +00:00
FormatMessage ( index , strBuffer ) ;
2005-04-08 16:58:55 +00:00
break ;
2004-12-02 07:43:47 +00:00
}
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
2005-04-07 07:04:50 +00:00
wxListItemAttr * CViewMessages : : OnListGetItemAttr ( long item ) const {
2004-12-02 07:43:47 +00:00
wxListItemAttr * pAttribute = NULL ;
2008-07-08 12:47:05 +00:00
wxInt32 index = GetFilteredMessageIndex ( item ) ;
MESSAGE * message = wxGetApp ( ) . GetDocument ( ) - > message ( index ) ;
2004-10-05 03:40:28 +00:00
2007-10-08 18:58:35 +00:00
if ( message ) {
switch ( message - > priority ) {
2009-12-23 18:02:40 +00:00
case MSG_USER_ALERT :
2008-09-08 12:39:41 +00:00
pAttribute = item % 2 ? m_pMessageErrorGrayAttr : m_pMessageErrorAttr ;
2007-10-08 18:58:35 +00:00
break ;
default :
2008-09-08 12:39:41 +00:00
pAttribute = item % 2 ? m_pMessageInfoGrayAttr : m_pMessageInfoAttr ;
2007-10-08 18:58:35 +00:00
break ;
}
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
2005-04-07 07:04:50 +00:00
bool CViewMessages : : EnsureLastItemVisible ( ) {
2008-01-10 11:28:11 +00:00
int numVisible = m_pListPane - > GetCountPerPage ( ) ;
// Auto-scroll only if already at bottom of list
2008-07-08 12:47:05 +00:00
if ( ( m_iPreviousRowCount > numVisible )
& & ( ( m_pListPane - > GetTopItem ( ) + numVisible ) < ( m_iPreviousRowCount - 1 ) )
2008-01-10 11:28:11 +00:00
) {
return false ;
}
2004-12-02 07:43:47 +00:00
return true ;
}
2005-04-07 07:04:50 +00:00
void CViewMessages : : UpdateSelection ( ) {
2006-03-27 03:44:13 +00:00
CTaskItemGroup * pGroup = NULL ;
2008-07-08 12:47:05 +00:00
MESSAGE * message ;
2006-03-27 03:44:13 +00:00
2006-01-09 14:03:13 +00:00
CBOINCBaseView : : PreUpdateSelection ( ) ;
2006-03-27 03:44:13 +00:00
pGroup = m_TaskGroups [ 0 ] ;
2008-07-08 12:47:05 +00:00
int n = m_pListPane - > GetSelectedItemCount ( ) ;
2008-09-18 20:32:03 +00:00
if ( m_iTotalDocCount < = 0 ) n = 0 ;
2008-07-08 12:47:05 +00:00
if ( n > 0 ) {
2006-03-27 03:44:13 +00:00
m_pTaskPane - > EnableTask ( pGroup - > m_Tasks [ BTN_COPYSELECTED ] ) ;
} else {
m_pTaskPane - > DisableTask ( pGroup - > m_Tasks [ BTN_COPYSELECTED ] ) ;
}
2008-07-08 12:47:05 +00:00
if ( m_bIsFiltered ) {
m_pTaskPane - > UpdateTask (
pGroup - > m_Tasks [ BTN_FILTERMSGS ] ,
_ ( " Show all messages " ) ,
2008-09-14 12:39:19 +00:00
_ ( " Show messages for all projects. " )
2008-07-08 12:47:05 +00:00
) ;
m_pTaskPane - > EnableTask ( pGroup - > m_Tasks [ BTN_FILTERMSGS ] ) ;
} else {
m_pTaskPane - > UpdateTask (
pGroup - > m_Tasks [ BTN_FILTERMSGS ] ,
_ ( " Show only this project " ) ,
_ ( " Show only the messages for the selected project. " )
) ;
m_pTaskPane - > DisableTask ( pGroup - > m_Tasks [ BTN_FILTERMSGS ] ) ;
if ( n = = 1 ) {
n = m_pListPane - > GetNextItem ( - 1 , wxLIST_NEXT_ALL , wxLIST_STATE_SELECTED ) ;
message = wxGetApp ( ) . GetDocument ( ) - > message ( n ) ;
if ( ( message - > project ) . size ( ) > 0 ) {
m_pTaskPane - > EnableTask ( pGroup - > m_Tasks [ BTN_FILTERMSGS ] ) ;
}
}
}
2006-01-09 14:03:13 +00:00
CBOINCBaseView : : PostUpdateSelection ( ) ;
2004-09-24 22:19:02 +00:00
}
2005-04-07 07:04:50 +00:00
wxInt32 CViewMessages : : FormatProjectName ( wxInt32 item , wxString & strBuffer ) const {
2005-06-13 08:47:51 +00:00
MESSAGE * message = wxGetApp ( ) . GetDocument ( ) - > message ( item ) ;
2004-10-11 04:38:00 +00:00
2005-06-13 08:47:51 +00:00
if ( message ) {
- fixes #207 - HTML entities in BOINC Manager have to be decoded
BOINC Manager can now properly decode HTML entites for the
following elements:
Projects Tab:
Project Name
User Name
Team Name
Work Tab:
Project Name
Application Name
Transfers Tab:
Project Name
Messages Tab:
Project Name
Disk Tab:
Project Name
- fixes #212 - Info in columns misaligned on switching views
- Properly restore which tab view the user left from when going
to the advanced view from the simple view
- Fix the problem that caused the manager to wait for 7 seconds
to display anything on initial startup.
- Store the various Grid/List persisted data seperately so that
the different header sizes don't cause problems.
clientgui/
AdvancedFrame.cpp
BOINCBaseView.cpp, .h
BOINCGridCtrl.cpp
ViewMessages.cpp, .h
ViewMessagesGrid.cpp, .h
ViewProjects.cpp, .h
ViewProjectsGrid.cpp, .h
ViewResources.cpp, .h
ViewStatistics.cpp, .h
ViewTransfers.cpp, .h
ViewTransfersGrid.cpp, .h
ViewWork.cpp, .h
ViewWorkGrid.cpp, .h
lib/
gui_rpc_client_ops.C
svn path=/trunk/boinc/; revision=12761
2007-05-29 05:07:35 +00:00
strBuffer = HtmlEntityDecode ( wxString ( message - > project . c_str ( ) , wxConvUTF8 ) ) ;
2005-06-13 08:47:51 +00:00
}
2004-10-11 04:38:00 +00:00
return 0 ;
}
2005-04-07 07:04:50 +00:00
wxInt32 CViewMessages : : FormatTime ( wxInt32 item , wxString & strBuffer ) const {
2005-06-13 08:47:51 +00:00
wxDateTime dtBuffer ;
MESSAGE * message = wxGetApp ( ) . GetDocument ( ) - > message ( item ) ;
2004-10-11 04:38:00 +00:00
2005-06-13 08:47:51 +00:00
if ( message ) {
dtBuffer . Set ( ( time_t ) message - > timestamp ) ;
strBuffer = dtBuffer . Format ( ) ;
}
2004-10-11 04:38:00 +00:00
return 0 ;
}
2005-04-07 07:04:50 +00:00
wxInt32 CViewMessages : : FormatMessage ( wxInt32 item , wxString & strBuffer ) const {
2005-06-13 08:47:51 +00:00
MESSAGE * message = wxGetApp ( ) . GetDocument ( ) - > message ( item ) ;
2004-10-11 04:38:00 +00:00
2005-06-13 08:47:51 +00:00
if ( message ) {
2008-05-05 00:51:20 +00:00
strBuffer = wxString ( message - > body . c_str ( ) , wxConvUTF8 ) ;
2005-06-13 08:47:51 +00:00
}
2004-10-11 04:38:00 +00:00
2005-04-07 07:04:50 +00:00
strBuffer . Replace ( wxT ( " \n " ) , wxT ( " " ) , true ) ;
2004-10-19 19:41:29 +00:00
2004-10-11 04:38:00 +00:00
return 0 ;
}
2004-10-27 21:10:22 +00:00
2005-08-02 21:55:32 +00:00
# ifdef wxUSE_CLIPBOARD
2009-02-05 19:25:08 +00:00
bool CViewMessages : : OpenClipboard ( wxInt32 size ) {
2004-10-27 21:10:22 +00:00
bool bRetVal = false ;
bRetVal = wxTheClipboard - > Open ( ) ;
2005-04-07 07:04:50 +00:00
if ( bRetVal ) {
2004-10-27 21:10:22 +00:00
m_bClipboardOpen = true ;
2009-02-05 19:25:08 +00:00
2004-10-27 21:10:22 +00:00
m_strClipboardData = wxEmptyString ;
2009-02-05 19:27:58 +00:00
m_strClipboardData . Alloc ( size ) ;
2009-02-05 19:25:08 +00:00
2004-10-27 21:10:22 +00:00
wxTheClipboard - > Clear ( ) ;
}
return bRetVal ;
}
2005-04-07 07:04:50 +00:00
wxInt32 CViewMessages : : CopyToClipboard ( wxInt32 item ) {
2009-02-05 19:25:08 +00:00
wxInt32 iRetVal = - 1 ;
wxInt32 index = GetFilteredMessageIndex ( item ) ;
2004-10-27 21:10:22 +00:00
2005-04-07 07:04:50 +00:00
if ( m_bClipboardOpen ) {
2004-10-27 21:10:22 +00:00
wxString strBuffer = wxEmptyString ;
wxString strTimeStamp = wxEmptyString ;
wxString strProject = wxEmptyString ;
wxString strMessage = wxEmptyString ;
2008-07-08 12:47:05 +00:00
FormatTime ( index , strTimeStamp ) ;
FormatProjectName ( index , strProject ) ;
FormatMessage ( index , strMessage ) ;
2004-10-27 21:10:22 +00:00
# ifdef __WXMSW__
2009-02-05 19:25:08 +00:00
strBuffer . Printf ( wxT ( " %s \t %s \t %s \r \n " ) , strTimeStamp . c_str ( ) , strProject . c_str ( ) , strMessage . c_str ( ) ) ;
2004-10-27 21:10:22 +00:00
# else
2009-02-05 19:25:08 +00:00
strBuffer . Printf ( wxT ( " %s \t %s \t %s \n " ) , strTimeStamp . c_str ( ) , strProject . c_str ( ) , strMessage . c_str ( ) ) ;
2004-10-27 21:10:22 +00:00
# endif
2009-02-05 19:25:08 +00:00
m_strClipboardData + = strBuffer ;
2004-10-27 21:10:22 +00:00
iRetVal = 0 ;
}
return iRetVal ;
}
2005-04-07 07:04:50 +00:00
bool CViewMessages : : CloseClipboard ( ) {
2004-10-27 21:10:22 +00:00
bool bRetVal = false ;
2005-04-07 07:04:50 +00:00
if ( m_bClipboardOpen ) {
wxTheClipboard - > SetData ( new wxTextDataObject ( m_strClipboardData ) ) ;
2004-10-27 21:10:22 +00:00
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-04-21 23:14:10 +00:00
2005-01-02 18:29:53 +00:00
const char * BOINC_RCSID_0be7149475 = " $Id$ " ;