From 227f8c9ab6291cf7304eff19f9a1a4fbc532efd5 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Sun, 31 Oct 2004 21:03:29 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=4462 --- clientgui/MainFrame.cpp | 51 ++++++++++++++++++++++++--------------- clientgui/TaskBarIcon.cpp | 17 +++---------- 2 files changed, 35 insertions(+), 33 deletions(-) diff --git a/clientgui/MainFrame.cpp b/clientgui/MainFrame.cpp index 528d130b9f..c80b476f83 100644 --- a/clientgui/MainFrame.cpp +++ b/clientgui/MainFrame.cpp @@ -551,13 +551,9 @@ void CMainFrame::OnNetworkSelection( wxCommandEvent& event ) { case ID_NETWORKSUSPEND: if ( event.IsChecked() ) - { - pDoc->SetNetworkRunMode( CMainDocument::MODE_ALWAYS ); - } - else - { pDoc->SetNetworkRunMode( CMainDocument::MODE_NEVER ); - } + else + pDoc->SetNetworkRunMode( CMainDocument::MODE_ALWAYS ); break; case ID_NETWORKRUNALWAYS: case ID_NETWORKRUNBASEDONPREPERENCES: @@ -705,52 +701,67 @@ void CMainFrame::OnAbout( wxCommandEvent& WXUNUSED(event) ) } -void CMainFrame::OnUpdateActivitySelection( wxUpdateUIEvent& WXUNUSED(event) ) +void CMainFrame::OnUpdateActivitySelection( wxUpdateUIEvent& event ) { CMainDocument* pDoc = wxGetApp().GetDocument(); wxMenuBar* pMenuBar = GetMenuBar(); wxInt32 iActivityMode = -1; + wxInt32 iEventId = event.GetId(); wxASSERT(NULL != pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); wxASSERT(NULL != pMenuBar); wxASSERT(wxDynamicCast(pMenuBar, wxMenuBar)); + pMenuBar->Check( event.GetId(), false ); pDoc->GetActivityRunMode( iActivityMode ); - switch( iActivityMode ) + + switch( iEventId ) { - case CMainDocument::MODE_ALWAYS: - pMenuBar->Check( ID_ACTIVITYRUNALWAYS, true ); + case ID_ACTIVITYRUNALWAYS: + if ( CMainDocument::MODE_ALWAYS == iActivityMode ) + pMenuBar->Check( ID_ACTIVITYRUNALWAYS, true ); break; - case CMainDocument::MODE_NEVER: - pMenuBar->Check( ID_ACTIVITYSUSPEND, true ); + case ID_ACTIVITYSUSPEND: + if ( CMainDocument::MODE_NEVER == iActivityMode ) + pMenuBar->Check( ID_ACTIVITYSUSPEND, true ); break; - case CMainDocument::MODE_AUTO: - pMenuBar->Check( ID_ACTIVITYRUNBASEDONPREPERENCES, true ); + case ID_ACTIVITYRUNBASEDONPREPERENCES: + if ( CMainDocument::MODE_AUTO == iActivityMode ) + pMenuBar->Check( ID_ACTIVITYRUNBASEDONPREPERENCES, true ); break; } } -void CMainFrame::OnUpdateNetworkSelection( wxUpdateUIEvent& WXUNUSED(event) ) +void CMainFrame::OnUpdateNetworkSelection( wxUpdateUIEvent& event ) { CMainDocument* pDoc = wxGetApp().GetDocument(); wxMenuBar* pMenuBar = GetMenuBar(); wxInt32 iNetworkMode = -1; + wxInt32 iEventId = event.GetId(); wxASSERT(NULL != pDoc); wxASSERT(wxDynamicCast(pDoc, CMainDocument)); wxASSERT(NULL != pMenuBar); wxASSERT(wxDynamicCast(pMenuBar, wxMenuBar)); + pMenuBar->Check( event.GetId(), false ); pDoc->GetNetworkRunMode( iNetworkMode ); - switch( iNetworkMode ) + + switch( iEventId ) { - case CMainDocument::MODE_NEVER: - pMenuBar->Check( ID_NETWORKSUSPEND, true ); + case ID_NETWORKRUNALWAYS: + if ( CMainDocument::MODE_ALWAYS == iNetworkMode ) + pMenuBar->Check( ID_NETWORKRUNALWAYS, true ); break; - default: - pMenuBar->Check( ID_NETWORKSUSPEND, false ); + case ID_NETWORKSUSPEND: + if ( CMainDocument::MODE_NEVER == iNetworkMode ) + pMenuBar->Check( ID_NETWORKSUSPEND, true ); + break; + case ID_NETWORKRUNBASEDONPREPERENCES: + if ( CMainDocument::MODE_AUTO == iNetworkMode ) + pMenuBar->Check( ID_NETWORKRUNBASEDONPREPERENCES, true ); break; } } diff --git a/clientgui/TaskBarIcon.cpp b/clientgui/TaskBarIcon.cpp index 500d828e72..e405bdb0c8 100644 --- a/clientgui/TaskBarIcon.cpp +++ b/clientgui/TaskBarIcon.cpp @@ -115,13 +115,9 @@ void CTaskBarIcon::OnNetworkSelection( wxCommandEvent& event ) { case ID_TB_NETWORKSUSPEND: if ( event.IsChecked() ) - { pDoc->SetNetworkRunMode( CMainDocument::MODE_ALWAYS ); - } else - { pDoc->SetNetworkRunMode( CMainDocument::MODE_NEVER ); - } break; case ID_TB_NETWORKRUNALWAYS: case ID_TB_NETWORKRUNBASEDONPREPERENCES: @@ -271,15 +267,10 @@ void CTaskBarIcon::OnRButtonDown( wxTaskBarIconEvent& event ) } pDoc->GetNetworkRunMode( iNetworkMode ); - switch( iNetworkMode ) - { - case CMainDocument::MODE_NEVER: - menu->Check( ID_TB_NETWORKSUSPEND, true ); - break; - default: - menu->Check( ID_TB_NETWORKSUSPEND, false ); - break; - } + if ( CMainDocument::MODE_NEVER == iNetworkMode ) + menu->Check( ID_TB_NETWORKSUSPEND, true ); + else + menu->Check( ID_TB_NETWORKSUSPEND, false ); PopupMenu( menu );