MGR: When connected host has changed, clear all cached messages and resume auto-scrolling messages

svn path=/trunk/boinc/; revision=14814
This commit is contained in:
Charlie Fenton 2008-02-28 10:07:00 +00:00
parent 756293008b
commit fd1f602ad5
3 changed files with 33 additions and 1 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;
}