From fd1f602ad53681fd02e4c4aa826e87fabba5d0c8 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Thu, 28 Feb 2008 10:07:00 +0000 Subject: [PATCH] MGR: When connected host has changed, clear all cached messages and resume auto-scrolling messages svn path=/trunk/boinc/; revision=14814 --- checkin_notes | 8 ++++++++ clientgui/MainDocument.cpp | 9 +++++++++ clientgui/ViewMessages.cpp | 17 ++++++++++++++++- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/checkin_notes b/checkin_notes index 33e2abccf9..f369a12515 100644 --- a/checkin_notes +++ b/checkin_notes @@ -1721,3 +1721,11 @@ Rom Feb 27 2008 lib/ util.C + +Charlie Feb 28 2008 + - MGR: When connected host has changed, clear all cached messages and + resume auto-scrolling messages. + + clientgui/ + MainDocument.cpp + ViewMessages.cpp diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index ec06a5bbb2..a28a46f97d 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -1299,11 +1299,20 @@ int CMainDocument::CachedMessageUpdate() { int retval; static bool in_this_func = false; static bool was_connected = false; + static wxString strLastMachineName = wxEmptyString; + wxString strNewMachineName = wxEmptyString; if (in_this_func) return 0; in_this_func = true; if (IsConnected()) { + // If user changed the connected host while the messages tab was + // not selected, we may not have registered the disconnect. + GetConnectedComputerName(strNewMachineName); + if (strLastMachineName != strNewMachineName) { + strLastMachineName = strNewMachineName; + was_connected = false; + } if (! was_connected) { ResetMessageState(); was_connected = true; diff --git a/clientgui/ViewMessages.cpp b/clientgui/ViewMessages.cpp index a38f55f33e..f2701ad311 100644 --- a/clientgui/ViewMessages.cpp +++ b/clientgui/ViewMessages.cpp @@ -225,18 +225,23 @@ wxInt32 CViewMessages::GetDocCount() { void CViewMessages::OnListRender (wxTimerEvent& event) { bool isConnected; static bool was_connected = false; + static wxString strLastMachineName = wxEmptyString; + wxString strNewMachineName = wxEmptyString; + CMainDocument* pDoc = wxGetApp().GetDocument(); + wxASSERT(pDoc); + wxASSERT(wxDynamicCast(pDoc, CMainDocument)); if (!m_bProcessingListRenderEvent) { m_bProcessingListRenderEvent = true; wxASSERT(m_pListPane); + isConnected = pDoc->IsConnected(); wxInt32 iDocCount = GetDocCount(); if (0 >= iDocCount) { m_pListPane->DeleteAllItems(); } else { // If connection status changed, adjust color of messages display - isConnected = wxGetApp().GetDocument()->IsConnected(); if (was_connected != isConnected) { was_connected = isConnected; if (isConnected) { @@ -260,6 +265,16 @@ void CViewMessages::OnListRender (wxTimerEvent& event) { m_pListPane->EnsureVisible(iDocCount - 1); } + if (isConnected) { + pDoc->GetConnectedComputerName(strNewMachineName); + if (strLastMachineName != strNewMachineName) { + strLastMachineName = strNewMachineName; + if (iDocCount) { + m_pListPane->EnsureVisible(iDocCount - 1); + } + } + } + if (m_iPreviousDocCount != iDocCount) { m_iPreviousDocCount = iDocCount; }