From 76e778a44d338bbd85720cede071a99e3bb3a72a Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 7 Jan 2010 17:12:56 +0000 Subject: [PATCH] - manager: tweak notice appearance svn path=/trunk/boinc/; revision=20100 --- checkin_notes | 8 ++++ client/cs_notice.cpp | 1 + clientgui/ViewNotifications.cpp | 72 ++++++++++----------------------- 3 files changed, 31 insertions(+), 50 deletions(-) diff --git a/checkin_notes b/checkin_notes index 4af8e18f0e..7d796949a4 100644 --- a/checkin_notes +++ b/checkin_notes @@ -187,3 +187,11 @@ Charlie 7 Jan 2010 GR-ReadMe.rtf PTP-ReadMe.rtf ReadMe.rtf + +David 7 Jan 2009 + - manager: tweak notice appearance + + client/ + cs_notice.cpp + clientgui/ + ViewNotifications.cpp diff --git a/client/cs_notice.cpp b/client/cs_notice.cpp index 867dd8e864..01c582fe11 100644 --- a/client/cs_notice.cpp +++ b/client/cs_notice.cpp @@ -355,6 +355,7 @@ void NOTICES::write_archive(char* url) { if (!f) return; for (unsigned int i=0; i\n"); diff --git a/clientgui/ViewNotifications.cpp b/clientgui/ViewNotifications.cpp index ff434a272a..eea902af4b 100644 --- a/clientgui/ViewNotifications.cpp +++ b/clientgui/ViewNotifications.cpp @@ -136,73 +136,45 @@ void CViewNotifications::OnListRender( wxTimerEvent& WXUNUSED(event) ) { wxString strItems; wxString strTemp; wxDateTime dtBuffer; - NOTICE* pNotice = NULL; - int iNoticeCount = 0; - unsigned int iNoticeIndex = 0; + int n = 0; + unsigned int i = 0; wxASSERT(pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); wxASSERT(m_pHtmlPane); - iNoticeCount = pDoc->GetNoticeCount(); - - if (iNoticeCount == -1) { - - strItems += _("Retrieving notices now..."); + n = pDoc->GetNoticeCount(); + if (n == -1) { + strItems += _("Retrieving notices..."); } else { // Pre-allocate buffer size so string concat is much faster - strItems.Alloc(4096*iNoticeCount); + strItems.Alloc(4096*n); - for (iNoticeIndex = 0; iNoticeIndex < (unsigned int)iNoticeCount; iNoticeIndex++) { - pNotice = pDoc->notice(iNoticeIndex); - - if (pNotice) { - - strItems += wxT("

"); - strItems += wxT(""); - strItems += wxT(" "); - strItems += wxT(" "); - strItems += wxT(" "); - strItems += wxT(" "); - strItems += wxT(" "); - strItems += wxT(" "); - strItems += wxT("
"); - - strItems += _("Diag: "); - strTemp.Printf(wxT("index(%d)/seqno(%d)"), iNoticeIndex, pNotice->seqno); - strItems += strTemp; - - strItems += wxT("
"); - strItems += _("Title: "); - - strItems += wxString(pNotice->title, wxConvUTF8); - - strItems += wxT("
"); - strItems += _("Date: "); - - dtBuffer.Set((time_t)pNotice->arrival_time); - strItems += dtBuffer.Format(); - - strItems += wxT("
"); - strItems += wxString(pNotice->description.c_str(), wxConvUTF8); - strItems += wxT("
"); - strItems += wxT("

"); + for (i = 0; i < (unsigned int)n; i++) { + NOTICE* np = pDoc->notice(i); + if (!np) continue; + char tbuf[512]; + if (strlen(np->title)) { + sprintf(tbuf, "%s
", np->title); + strItems += wxString(tbuf, wxConvUTF8); } + strItems += wxString(np->description.c_str(), wxConvUTF8); + strItems += wxT("
"); + dtBuffer.Set((time_t)np->arrival_time); + strItems += dtBuffer.Format(); + strItems += wxT("
\n"); } } - strHTML = wxT(""); - strHTML += wxT(""); - strHTML += wxT(""); - strHTML += wxT(""); + strHTML = wxT("\n\n"); strHTML += strItems; - strHTML += wxT(""); - strHTML += wxT(""); - + //strHTML += wxT("

foobar

blah blah\n"); + strHTML += wxT("\n\n"); + m_pHtmlPane->SetFonts(wxT("Sans Serif"), wxT("Courier"), 0); m_pHtmlPane->SetPage( strHTML ); wxLogTrace(wxT("Function Start/End"), wxT("CViewNotifications::OnListRender - Function End"));