- MGR: Prevent timer events from causing recursive ui issues.

clientgui/
        ViewNotifications.cpp

svn path=/trunk/boinc/; revision=20103
This commit is contained in:
Rom Walton 2010-01-08 00:04:19 +00:00
parent d800ae43eb
commit 4efa403795
2 changed files with 39 additions and 27 deletions

View File

@ -188,7 +188,7 @@ Charlie 7 Jan 2010
PTP-ReadMe.rtf
ReadMe.rtf
David 7 Jan 2009
David 7 Jan 2010
- manager: tweak notice appearance
client/
@ -196,9 +196,15 @@ David 7 Jan 2009
clientgui/
ViewNotifications.cpp
David 7 Jan 2009
David 7 Jan 2010
- client: work fetch fix: avoid sending null request in certain cases.
- client: fix crash in notices code
client/
cs_notice.cpp
work_fetch.cpp
Rom 7 Jan 2010
- MGR: Prevent timer events from causing recursive ui issues.
clientgui/
ViewNotifications.cpp

View File

@ -138,44 +138,50 @@ void CViewNotifications::OnListRender( wxTimerEvent& WXUNUSED(event) ) {
wxDateTime dtBuffer;
int n = 0;
unsigned int i = 0;
static bool s_bInProgress = false;
wxASSERT(pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
wxASSERT(m_pHtmlPane);
n = pDoc->GetNoticeCount();
if (!s_bInProgress) {
s_bInProgress = true;
if (n == -1) {
strItems += _("Retrieving notices...");
} else {
n = pDoc->GetNoticeCount();
// Pre-allocate buffer size so string concat is much faster
strItems.Alloc(4096*n);
if (n == -1) {
strItems += _("Retrieving notices...");
} else {
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, "<b>%s</b><br>", np->title);
strItems += wxString(tbuf, wxConvUTF8);
// Pre-allocate buffer size so string concat is much faster
strItems.Alloc(4096*n);
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, "<b>%s</b><br>", np->title);
strItems += wxString(tbuf, wxConvUTF8);
}
strItems += wxString(np->description.c_str(), wxConvUTF8);
strItems += wxT("<br><font size=-2 color=#8f8f8f>");
dtBuffer.Set((time_t)np->arrival_time);
strItems += dtBuffer.Format();
strItems += wxT("</font><hr>\n");
}
strItems += wxString(np->description.c_str(), wxConvUTF8);
strItems += wxT("<br><font size=-2 color=#8f8f8f>");
dtBuffer.Set((time_t)np->arrival_time);
strItems += dtBuffer.Format();
strItems += wxT("</font><hr>\n");
}
}
strHTML = wxT("<html>\n<body>\n");
strHTML += strItems;
//strHTML += wxT("<h2>foobar</h2>blah <i>blah</i>\n");
strHTML += wxT("</body>\n</html>\n");
m_pHtmlPane->SetFonts(wxT("Sans Serif"), wxT("Courier"), 0);
m_pHtmlPane->SetPage( strHTML );
strHTML = wxT("<html>\n<body>\n");
strHTML += strItems;
strHTML += wxT("</body>\n</html>\n");
m_pHtmlPane->SetFonts(wxT("Sans Serif"), wxT("Courier"), 0);
m_pHtmlPane->SetPage( strHTML );
s_bInProgress = false;
}
wxLogTrace(wxT("Function Start/End"), wxT("CViewNotifications::OnListRender - Function End"));
}