From b5dee1ac90b997f8c529d4da54b048680ffdbcd2 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Thu, 17 Aug 2006 20:10:43 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=10938 --- checkin_notes | 9 +++++++- clientgui/MainDocument.cpp | 11 ++++++++++ clientgui/MainDocument.h | 6 ++++-- clientgui/sg_BoincSimpleGUI.cpp | 37 +++++++++++++-------------------- 4 files changed, 38 insertions(+), 25 deletions(-) diff --git a/checkin_notes b/checkin_notes index 500f19919b..46553c14ae 100755 --- a/checkin_notes +++ b/checkin_notes @@ -8927,4 +8927,11 @@ Milos 17 Aug 2006 sg_BoincSimpleGUI.cpp,h sg_DlgPreferences.cpp,h sg_ProjectsComponent.cpp - \ No newline at end of file + +Rom 17 Aug 2006 + - Bug Fix: Keep both the global state and the updated tasks records in sync within + the simple GUI. + + clientgui/ + MainDocument.cpp, .h + sg_BoincSimpleGUI.cpp diff --git a/clientgui/MainDocument.cpp b/clientgui/MainDocument.cpp index 542c835f7b..983fcc1d77 100644 --- a/clientgui/MainDocument.cpp +++ b/clientgui/MainDocument.cpp @@ -1238,6 +1238,17 @@ int CMainDocument::CachedSimpleGUIUpdate() { } +int CMainDocument::GetSimpleGUIWorkCount() { + int iCount = -1; + + CachedSimpleGUIUpdate(); + CachedStateUpdate(); + + if (!results.results.empty()) + iCount = (int)results.results.size(); + + return iCount; +} const char *BOINC_RCSID_aa03a835ba = "$Id$"; diff --git a/clientgui/MainDocument.h b/clientgui/MainDocument.h index 3340914ee2..f14bac45cf 100644 --- a/clientgui/MainDocument.h +++ b/clientgui/MainDocument.h @@ -274,10 +274,12 @@ public: // // Simple GUI Updates // -public: - int CachedSimpleGUIUpdate(); private: wxDateTime m_dtCachedSimpleGUITimestamp; + int CachedSimpleGUIUpdate(); + +public: + int GetSimpleGUIWorkCount(); }; diff --git a/clientgui/sg_BoincSimpleGUI.cpp b/clientgui/sg_BoincSimpleGUI.cpp index ff3964cedd..c8f802d2ea 100644 --- a/clientgui/sg_BoincSimpleGUI.cpp +++ b/clientgui/sg_BoincSimpleGUI.cpp @@ -227,25 +227,20 @@ void CSimpleFrame::OnProjectsAttachToProject() { } void CSimpleFrame::OnFrameRender(wxTimerEvent& WXUNUSED(event)) { - - CMainDocument* pDoc = wxGetApp().GetDocument(); int retValue; - //Update data - if(pDoc->IsConnected()){ - retValue = pDoc->CachedSimpleGUIUpdate(); - if(retValue==0){ - if(!clientGUIInitialized){ - //Freeze(); - InitSimpleClient(); - initAfter(); - // Thaw(); - //Update(); - clientGUIInitialized = true; - //Show(true); - }else{ //check for changes in the interface - UpdateClientGUI(); - } - } + CMainDocument* pDoc = wxGetApp().GetDocument(); + + //Update data + if(pDoc->IsConnected()){ + // Update the document state, any subsequent calls will just used the + // cached data. + pDoc->GetSimpleGUIWorkCount(); + if(!clientGUIInitialized){ + InitSimpleClient(); + initAfter(); + clientGUIInitialized = true; + } + UpdateClientGUI(); } } @@ -271,8 +266,7 @@ void CSimpleFrame::InitSimpleClient() // Do not update screen at this point Freeze(); //create work unit tabs - //int resultCnt = pDoc->GetWorkCount(); - int resultCnt = (int)pDoc->results.results.size(); + int resultCnt = (int)pDoc->GetSimpleGUIWorkCount(); if(resultCnt > 0){ //init nootebok InitNotebook(); @@ -314,8 +308,7 @@ void CSimpleFrame::UpdateClientGUI(){ CMainDocument* pDoc = wxGetApp().GetDocument(); //update GUI - //int resultCnt = pDoc->GetWorkCount(); - int resultCnt = (int)pDoc->results.results.size(); + int resultCnt = (int)pDoc->GetSimpleGUIWorkCount(); wxString strBuffer = wxEmptyString; //assume they are all inactive for(int x = 0; x < (int)m_windows.size(); x ++)