*** empty log message ***

svn path=/trunk/boinc/; revision=11737
This commit is contained in:
Rom Walton 2006-12-29 16:35:33 +00:00
parent 7f0e9e0c4c
commit e9d2bdc3e8
13 changed files with 139 additions and 112 deletions

View File

@ -13777,3 +13777,16 @@ David 28 Dec 2006
inc/
cache.inc
util.inc
Rom 29 Dec 2006
- SCRSAV: Fix build break.
- MGR: Refactor the timer management code whithin the advanced frame.
client/win/
win_screensaver.cpp
clientgui/
AdvancedFrame.cpp, .h
BOINCBaseFrame.cpp, .h
BOINCBaseView.cpp, .h
BOINCDialupManager.cpp, .h
ViewStatistics.cpp, .h

View File

@ -1541,21 +1541,24 @@ LRESULT CScreensaver::SaverProc(
if (wParam == PBT_APMQUERYSUSPEND && gspfnMyVerifyPwdProc == NULL)
InterruptSaver();
break;
case WM_SETTIMER:
BOINCTRACE(_T("CScreensaver::SaverProc Received WM_SETTIMER\n"));
// All initialization messages have gone through. Allow
// 500ms of idle time, then proceed with initialization.
SetTimer(hWnd, 1, 500, NULL);
break;
case WM_INTERRUPTSAVER:
BOINCTRACE(_T("CScreensaver::SaverProc Received WM_INTERRUPTSAVER\n"));
if (hWnd == m_Monitors[0].hWnd) {
InterruptSaver();
}
break;
}
if (WM_SETTIMER == uMsg) {
BOINCTRACE(_T("CScreensaver::SaverProc Received WM_SETTIMER\n"));
// All initialization messages have gone through. Allow
// 500ms of idle time, then proceed with initialization.
SetTimer(hWnd, 1, 500, NULL);
} else if (WM_INTERRUPTSAVER == uMsg) {
BOINCTRACE(_T("CScreensaver::SaverProc Received WM_INTERRUPTSAVER\n"));
if (hWnd == m_Monitors[0].hWnd) {
InterruptSaver();
}
}
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}

View File

@ -1085,10 +1085,8 @@ void CAdvancedFrame::OnProjectsAttachToAccountManager(wxCommandEvent& WXUNUSED(e
return;
if (pDoc->IsConnected()) {
m_pRefreshStateTimer->Stop();
m_pFrameRenderTimer->Stop();
m_pFrameListPanelRenderTimer->Stop();
m_pDocumentPollTimer->Stop();
// Stop all timers so that the wizard is the only thing doing anything
StopTimers();
CWizardAccountManager* pWizard = new CWizardAccountManager(this);
@ -1101,10 +1099,8 @@ void CAdvancedFrame::OnProjectsAttachToAccountManager(wxCommandEvent& WXUNUSED(e
CreateMenu();
FireRefreshView();
m_pRefreshStateTimer->Start();
m_pFrameRenderTimer->Start();
m_pFrameListPanelRenderTimer->Start();
m_pDocumentPollTimer->Start();
// Restart timers to continue normal operations.
StartTimers();
} else {
ShowNotCurrentlyConnectedAlert();
}
@ -1125,10 +1121,8 @@ void CAdvancedFrame::OnAccountManagerUpdate(wxCommandEvent& WXUNUSED(event)) {
return;
if (pDoc->IsConnected()) {
m_pRefreshStateTimer->Stop();
m_pFrameRenderTimer->Stop();
m_pFrameListPanelRenderTimer->Stop();
m_pDocumentPollTimer->Stop();
// Stop all timers so that the wizard is the only thing doing anything
StopTimers();
CWizardAccountManager* pWizard = new CWizardAccountManager(this);
@ -1142,10 +1136,8 @@ void CAdvancedFrame::OnAccountManagerUpdate(wxCommandEvent& WXUNUSED(event)) {
FireRefreshView();
ResetReminderTimers();
m_pRefreshStateTimer->Start();
m_pFrameRenderTimer->Start();
m_pFrameListPanelRenderTimer->Start();
m_pDocumentPollTimer->Start();
// Restart timers to continue normal operations.
StartTimers();
} else {
ShowNotCurrentlyConnectedAlert();
}
@ -1230,10 +1222,8 @@ void CAdvancedFrame::OnProjectsAttachToProject( wxCommandEvent& WXUNUSED(event)
if (pDoc->IsConnected()) {
UpdateStatusText(_("Attaching to project..."));
m_pRefreshStateTimer->Stop();
m_pFrameRenderTimer->Stop();
m_pFrameListPanelRenderTimer->Stop();
m_pDocumentPollTimer->Stop();
// Stop all timers so that the wizard is the only thing doing anything
StopTimers();
CWizardAttachProject* pWizard = new CWizardAttachProject(this);
@ -1247,10 +1237,8 @@ void CAdvancedFrame::OnProjectsAttachToProject( wxCommandEvent& WXUNUSED(event)
DeleteMenu();
CreateMenu();
m_pRefreshStateTimer->Start();
m_pFrameRenderTimer->Start();
m_pFrameListPanelRenderTimer->Start();
m_pDocumentPollTimer->Start();
// Restart timers to continue normal operations.
StartTimers();
UpdateStatusText(wxT(""));
@ -1542,11 +1530,8 @@ void CAdvancedFrame::OnConnect(CFrameEvent& WXUNUSED(event)) {
DeleteMenu();
CreateMenu();
// Only present one of the wizards if no projects are currently
// detected.
m_pRefreshStateTimer->Stop();
m_pFrameRenderTimer->Stop();
m_pFrameListPanelRenderTimer->Stop();
// Stop all timers so that the wizard is the only thing doing anything
StopTimers();
// If we are connected to the localhost, run a really quick screensaver
@ -1617,9 +1602,9 @@ void CAdvancedFrame::OnConnect(CFrameEvent& WXUNUSED(event)) {
}
}
m_pRefreshStateTimer->Start();
m_pFrameRenderTimer->Start();
m_pFrameListPanelRenderTimer->Start();
// Restart timers to continue normal operations.
StartTimers();
if (pAMWizard)
pAMWizard->Destroy();
@ -1666,7 +1651,7 @@ void CAdvancedFrame::OnFrameRender(wxTimerEvent &event) {
CMainDocument* pDoc = wxGetApp().GetDocument();
if (!bAlreadyRunningLoop) {
if (!bAlreadyRunningLoop && m_pFrameRenderTimer->IsRunning()) {
bAlreadyRunningLoop = true;
if (IsShown()) {
@ -1741,9 +1726,8 @@ void CAdvancedFrame::OnFrameRender(wxTimerEvent &event) {
}
void CAdvancedFrame::OnListPanelRender(wxTimerEvent&) {
void CAdvancedFrame::OnListPanelRender(wxTimerEvent& WXUNUSED(event)) {
FireRefreshView();
SetFrameListPanelRenderTimerRate(); // Set to refresh every 5 or 60 seconds
}
@ -1753,7 +1737,8 @@ void CAdvancedFrame::OnNotebookSelectionChanged(wxNotebookEvent& event) {
if ((-1 != event.GetSelection()) && IsShown()) {
wxWindow* pwndNotebookPage = NULL;
CBOINCBaseView* pView = NULL;
wxTimerEvent timerEvent;
CMainDocument* pDoc = wxGetApp().GetDocument();
wxASSERT(m_pNotebook);
@ -1763,9 +1748,25 @@ void CAdvancedFrame::OnNotebookSelectionChanged(wxNotebookEvent& event) {
pView = wxDynamicCast(pwndNotebookPage, CBOINCBaseView);
wxASSERT(pView);
FireRefreshView();
if (m_pFrameListPanelRenderTimer->IsRunning()) {
m_pFrameListPanelRenderTimer->Stop();
SetFrameListPanelRenderTimerRate();
// View specific refresh rates only apply when a connection to the core
// client has been established, otherwise the refresh rate should be 1
// second.
if (pDoc) {
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
if (pDoc->IsConnected()) {
// Set new view specific refresh rate
m_pFrameListPanelRenderTimer->Start(pView->GetViewRefreshRate() * 1000);
} else {
// Set view refresh rate to 1 second
m_pFrameListPanelRenderTimer->Start(1000);
}
}
}
FireRefreshView();
}
event.Skip();
@ -1784,51 +1785,6 @@ void CAdvancedFrame::ResetReminderTimers() {
}
void CAdvancedFrame::SetFrameListPanelRenderTimerRate() {
static wxWindowID previousPane = -1;
static int connectedCount = 0;
wxWindowID currentPane;
CMainDocument* pDoc = wxGetApp().GetDocument();
wxASSERT(m_pNotebook);
wxASSERT(m_pFrameListPanelRenderTimer);
wxASSERT(pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
// Keep timer at faster rate until we have been connected > 10 seconds
if (!pDoc->IsConnected())
connectedCount = 0;
if (connectedCount < 3) {
connectedCount++;
previousPane = -1; // Ensure an update when connectedCount reaches 3
if (m_pFrameListPanelRenderTimer->IsRunning())
m_pFrameListPanelRenderTimer->Stop();
m_pFrameListPanelRenderTimer->Start(1000); // Refresh every 1 seconds
return;
}
currentPane = m_pNotebook->GetSelection() + ID_TASK_BASE;
if (currentPane == previousPane)
return;
previousPane = currentPane;
if (m_pFrameListPanelRenderTimer->IsRunning())
m_pFrameListPanelRenderTimer->Stop();
switch (currentPane) {
case ID_TASK_STATISTICSVIEW:
m_pFrameListPanelRenderTimer->Start(60000); // Refresh every 1 minute
break;
default:
m_pFrameListPanelRenderTimer->Start(1000); // Refresh every 1 seconds
break;
}
}
void CAdvancedFrame::UpdateActivityModeControls( CC_STATUS& status ) {
wxMenuBar* pMenuBar = GetMenuBar();
@ -1883,4 +1839,26 @@ void CAdvancedFrame::UpdateNetworkModeControls( CC_STATUS& status ) {
}
void CAdvancedFrame::StartTimers() {
wxASSERT(m_pRefreshStateTimer);
wxASSERT(m_pFrameRenderTimer);
wxASSERT(m_pFrameListPanelRenderTimer);
CBOINCBaseFrame::StartTimers();
m_pRefreshStateTimer->Start();
m_pFrameRenderTimer->Start();
m_pFrameListPanelRenderTimer->Start();
}
void CAdvancedFrame::StopTimers() {
wxASSERT(m_pRefreshStateTimer);
wxASSERT(m_pFrameRenderTimer);
wxASSERT(m_pFrameListPanelRenderTimer);
CBOINCBaseFrame::StopTimers();
m_pRefreshStateTimer->Stop();
m_pFrameRenderTimer->Stop();
m_pFrameListPanelRenderTimer->Stop();
}
const char *BOINC_RCSID_d881a56dc5 = "$Id$";

View File

@ -92,10 +92,6 @@ public:
void ResetReminderTimers();
void SetFrameListPanelRenderTimerRate(); // TODO: refactor out of the frame and put the
// relevent code in OnPageChanged function
// and the base/statistics view.
wxTimer* m_pRefreshStateTimer;
wxTimer* m_pFrameRenderTimer;
wxTimer* m_pFrameListPanelRenderTimer;
@ -128,6 +124,9 @@ private:
void UpdateActivityModeControls( CC_STATUS& status );
void UpdateNetworkModeControls( CC_STATUS& status );
void StartTimers();
void StopTimers();
#ifdef __WXMAC__
protected:

View File

@ -141,7 +141,7 @@ void CBOINCBaseFrame::OnDocumentPoll(wxTimerEvent& WXUNUSED(event)) {
wxASSERT(pDoc);
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
if (!bAlreadyRunOnce) {
if (!bAlreadyRunOnce && m_pDocumentPollTimer->IsRunning()) {
// Complete any remaining initialization that has to happen after we are up
// and running
FireInitialize();
@ -156,7 +156,7 @@ void CBOINCBaseFrame::OnAlertPoll(wxTimerEvent& WXUNUSED(event)) {
static bool bAlreadyRunningLoop = false;
CMainDocument* pDoc = wxGetApp().GetDocument();
if (!bAlreadyRunningLoop) {
if (!bAlreadyRunningLoop && m_pAlertPollTimer->IsRunning()) {
bAlreadyRunningLoop = true;
// Update idle detection if needed.
@ -166,7 +166,7 @@ void CBOINCBaseFrame::OnAlertPoll(wxTimerEvent& WXUNUSED(event)) {
// dial up user perspective.
if (pDoc && m_pDialupManager) {
if (pDoc->IsConnected()) {
m_pDialupManager->poll();
m_pDialupManager->OnPoll();
}
}
@ -442,6 +442,18 @@ void CBOINCBaseFrame::ShowNotCurrentlyConnectedAlert() {
}
void CBOINCBaseFrame::StartTimers() {
wxASSERT(m_pAlertPollTimer);
m_pAlertPollTimer->Start();
}
void CBOINCBaseFrame::StopTimers() {
wxASSERT(m_pAlertPollTimer);
m_pAlertPollTimer->Stop();
}
void CBOINCBaseFrame::UpdateStatusText(const wxChar* szStatus) {
CFrameEvent event(wxEVT_FRAME_UPDATESTATUS, this, szStatus);
ProcessEvent(event);

View File

@ -72,6 +72,10 @@ public:
void ShowConnectionBadPasswordAlert();
void ShowConnectionFailedAlert();
void ShowNotCurrentlyConnectedAlert();
virtual void StartTimers();
virtual void StopTimers();
void UpdateStatusText( const wxChar* szStatus );
void ShowAlert(

View File

@ -122,6 +122,14 @@ const char** CBOINCBaseView::GetViewIcon() {
}
// The rate at which the view is refreshed.
// If it has not been defined by the view 1 second is retrned.
//
const int CBOINCBaseView::GetViewRefreshRate() {
return 1;
}
bool CBOINCBaseView::FireOnSaveState(wxConfigBase* pConfig) {
return OnSaveState(pConfig);
}

View File

@ -92,6 +92,7 @@ public:
virtual wxString& GetViewName();
virtual const char** GetViewIcon();
virtual const int GetViewRefreshRate();
bool FireOnSaveState( wxConfigBase* pConfig );
bool FireOnRestoreState( wxConfigBase* pConfig );

View File

@ -92,7 +92,7 @@ size_t CBOINCDialUpManager::GetISPNames(wxArrayString& names) {
}
void CBOINCDialUpManager::poll() {
void CBOINCDialUpManager::OnPoll() {
CMainDocument* pDoc = wxGetApp().GetDocument();
CBOINCBaseFrame* pFrame = wxGetApp().GetFrame();
#if defined(__WXMSW__)

View File

@ -35,7 +35,7 @@ public:
bool IsOk();
size_t GetISPNames(wxArrayString& names);
void poll();
void OnPoll();
int NotifyUserNeedConnection(bool bNotificationOnly);

View File

@ -1635,20 +1635,28 @@ CViewStatistics::CViewStatistics(wxNotebook* pNotebook) :
UpdateSelection();
}
CViewStatistics::~CViewStatistics() {
EmptyTasks();
}
wxString& CViewStatistics::GetViewName() {
static wxString strViewName(_("Statistics"));
return strViewName;
}
const char** CViewStatistics::GetViewIcon() {
return stats_xpm;
}
const int CViewStatistics::GetViewRefreshRate() {
return 60;
}
void CViewStatistics::OnStatisticsUserTotal( wxCommandEvent& WXUNUSED(event) ) {
wxLogTrace(wxT("Function Start/End"), wxT("CViewStatistics::OnStatisticsUserTotal - Function Begin"));

View File

@ -198,6 +198,7 @@ public:
virtual wxString& GetViewName();
virtual const char** GetViewIcon();
virtual const int GetViewRefreshRate();
void OnStatisticsUserTotal( wxCommandEvent& event );
void OnStatisticsUserAverage( wxCommandEvent& event );

View File

@ -1217,6 +1217,12 @@
<File
RelativePath="..\clientgui\ViewWork.h">
</File>
<File
RelativePath="..\clientgui\ViewWorkGrid.cpp">
</File>
<File
RelativePath="..\clientgui\ViewWorkGrid.h">
</File>
</Filter>
<Filter
Name="Support"
@ -1263,12 +1269,6 @@
<File
RelativePath="..\clientgui\DlgSelectComputer.h">
</File>
<File
RelativePath="..\clientgui\ViewWorkGrid.cpp">
</File>
<File
RelativePath="..\clientgui\ViewWorkGrid.h">
</File>
</Filter>
</Filter>
<Filter