mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=4412
This commit is contained in:
parent
22ce1d4af0
commit
8eaef9f394
|
@ -20,26 +20,6 @@
|
|||
//
|
||||
// Revision History:
|
||||
//
|
||||
// $Log$
|
||||
// Revision 1.12 2004/10/22 10:02:14 rwalton
|
||||
// *** empty log message ***
|
||||
//
|
||||
// Revision 1.11 2004/10/21 14:29:58 rwalton
|
||||
// *** empty log message ***
|
||||
//
|
||||
// Revision 1.10 2004/09/25 21:33:22 rwalton
|
||||
// *** empty log message ***
|
||||
//
|
||||
// Revision 1.9 2004/09/24 02:01:47 rwalton
|
||||
// *** empty log message ***
|
||||
//
|
||||
// Revision 1.8 2004/09/21 01:26:23 rwalton
|
||||
// *** empty log message ***
|
||||
//
|
||||
// Revision 1.7 2004/07/13 06:04:28 rwalton
|
||||
// Hooked up the Project and Work tab for the new GUI.
|
||||
//
|
||||
//
|
||||
|
||||
|
||||
#ifndef _EVENTS_H_
|
||||
|
@ -51,6 +31,12 @@
|
|||
#define ID_FRAMENOTEBOOK 6002
|
||||
#define ID_FRAMETASKRENDERTIMER 6003
|
||||
#define ID_FRAMELISTRENDERTIMER 6004
|
||||
#define ID_ACTIVITYRUNALWAYS 6005
|
||||
#define ID_ACTIVITYRUNBASEDONPREPERENCES 6006
|
||||
#define ID_ACTIVITYSUSPEND 6008
|
||||
#define ID_NETWORKRUNALWAYS 6009
|
||||
#define ID_NETWORKRUNBASEDONPREPERENCES 6010
|
||||
#define ID_NETWORKSUSPEND 6011
|
||||
#define ID_LIST_BASE 7000
|
||||
#define ID_LIST_PROJECTSVIEW 7000
|
||||
#define ID_LIST_WORKVIEW 7001
|
||||
|
|
|
@ -77,43 +77,6 @@ CMainDocument::~CMainDocument()
|
|||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::OnInit()
|
||||
{
|
||||
wxInt32 retval = 0;
|
||||
|
||||
if (!m_bIsConnected)
|
||||
{
|
||||
retval = rpc.init(NULL);
|
||||
if (retval)
|
||||
wxLogTrace("CMainDocument::OnInit - RPC Initialization Failed '%d'", retval);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::OnExit()
|
||||
{
|
||||
wxInt32 retval = 0;
|
||||
|
||||
if (m_bIsConnected)
|
||||
rpc.close();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::OnIdle()
|
||||
{
|
||||
if (m_bIsConnected)
|
||||
{
|
||||
CachedStateUpdate();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::CachedStateUpdate()
|
||||
{
|
||||
wxInt32 retval = 0;
|
||||
|
@ -151,6 +114,43 @@ wxInt32 CMainDocument::CachedStateUpdate()
|
|||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::OnInit()
|
||||
{
|
||||
wxInt32 retval = 0;
|
||||
|
||||
if (!m_bIsConnected)
|
||||
{
|
||||
retval = rpc.init(NULL);
|
||||
if (retval)
|
||||
wxLogTrace("CMainDocument::OnInit - RPC Initialization Failed '%d'", retval);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::OnExit()
|
||||
{
|
||||
wxInt32 retval = 0;
|
||||
|
||||
if (m_bIsConnected)
|
||||
rpc.close();
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::OnIdle()
|
||||
{
|
||||
if (m_bIsConnected)
|
||||
{
|
||||
CachedStateUpdate();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::CachedStateLock()
|
||||
{
|
||||
m_bCachedStateLocked = true;
|
||||
|
@ -166,6 +166,30 @@ wxInt32 CMainDocument::CachedStateUnlock()
|
|||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::GetActivityRunMode( wxInt32& iMode )
|
||||
{
|
||||
return rpc.get_run_mode( iMode );
|
||||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::SetActivityRunMode( wxInt32 iMode )
|
||||
{
|
||||
return rpc.set_run_mode( iMode );
|
||||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::GetNetworkRunMode( wxInt32& iMode )
|
||||
{
|
||||
return rpc.get_network_mode( iMode );
|
||||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::SetNetworkRunMode( wxInt32 iMode )
|
||||
{
|
||||
return rpc.set_network_mode( iMode );
|
||||
}
|
||||
|
||||
|
||||
wxInt32 CMainDocument::CachedProjectStatusUpdate()
|
||||
{
|
||||
wxInt32 retval = 0;
|
||||
|
|
|
@ -39,10 +39,6 @@ public:
|
|||
CMainDocument();
|
||||
~CMainDocument();
|
||||
|
||||
wxInt32 OnInit();
|
||||
wxInt32 OnExit();
|
||||
wxInt32 OnIdle();
|
||||
|
||||
enum RESULTTYPES
|
||||
{
|
||||
RESULT_NEW = 0,
|
||||
|
@ -53,19 +49,6 @@ public:
|
|||
RESULT_FILES_UPLOADED = 5
|
||||
};
|
||||
|
||||
enum PROCESSTYPES
|
||||
{
|
||||
PROCESS_EXECUTING = 1,
|
||||
PROCESS_SUSPENDED = 9,
|
||||
PROCESS_ABORT_PENDING = 5,
|
||||
PROCESS_EXITED = 2,
|
||||
PROCESS_WAS_SIGNALED = 3,
|
||||
PROCESS_EXIT_UNKNOWN = 4,
|
||||
PROCESS_ABORTED = 6,
|
||||
PROCESS_COULDNT_START = 7,
|
||||
PROCESS_IN_LIMBO = 8
|
||||
};
|
||||
|
||||
enum CPUSCHEDTYPES
|
||||
{
|
||||
CPU_SCHED_UNINITIALIZED = 0,
|
||||
|
@ -73,6 +56,13 @@ public:
|
|||
CPU_SCHED_SCHEDULED = 2
|
||||
};
|
||||
|
||||
enum RUNMODETYPES
|
||||
{
|
||||
MODE_ALWAYS = RUN_MODE_ALWAYS,
|
||||
MODE_NEVER = RUN_MODE_NEVER,
|
||||
MODE_AUTO = RUN_MODE_AUTO
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Global
|
||||
|
@ -92,9 +82,18 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
wxInt32 OnInit();
|
||||
wxInt32 OnExit();
|
||||
wxInt32 OnIdle();
|
||||
|
||||
wxInt32 CachedStateLock();
|
||||
wxInt32 CachedStateUnlock();
|
||||
|
||||
wxInt32 GetActivityRunMode( wxInt32& iMode );
|
||||
wxInt32 SetActivityRunMode( wxInt32 iMode );
|
||||
wxInt32 GetNetworkRunMode( wxInt32& iMode );
|
||||
wxInt32 SetNetworkRunMode( wxInt32 iMode );
|
||||
|
||||
|
||||
//
|
||||
// Project Tab
|
||||
|
|
|
@ -150,7 +150,7 @@ bool CMainFrame::CreateMenu()
|
|||
wxMenu *menuHelp = new wxMenu;
|
||||
menuHelp->Append(
|
||||
wxID_ABOUT,
|
||||
_("&About BOINC..."),
|
||||
_("&About BOINC Manager..."),
|
||||
_("Displays general information about BOINC and BOINC Manager")
|
||||
);
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include "stdwx.h"
|
||||
#include "BOINCGUIApp.h"
|
||||
#include "TaskBarIcon.h"
|
||||
#include "DlgAbout.h"
|
||||
#include "Events.h"
|
||||
|
||||
#include "res/boinc.xpm"
|
||||
|
||||
|
@ -36,6 +38,10 @@ IMPLEMENT_DYNAMIC_CLASS(CTaskBarIcon, wxTaskBarIcon)
|
|||
|
||||
BEGIN_EVENT_TABLE (CTaskBarIcon, wxTaskBarIcon)
|
||||
EVT_CLOSE(CTaskBarIcon::OnClose)
|
||||
EVT_MENU(wxID_OPEN, CTaskBarIcon::OnOpen)
|
||||
EVT_MENU_RANGE(ID_ACTIVITYRUNALWAYS, ID_ACTIVITYSUSPEND, CTaskBarIcon::OnActivitySelection)
|
||||
EVT_MENU_RANGE(ID_NETWORKRUNALWAYS, ID_NETWORKSUSPEND, CTaskBarIcon::OnNetworkSelection)
|
||||
EVT_MENU(wxID_ABOUT, CTaskBarIcon::OnAbout)
|
||||
EVT_MENU(wxID_EXIT, CTaskBarIcon::OnExit)
|
||||
END_EVENT_TABLE ()
|
||||
|
||||
|
@ -44,7 +50,7 @@ CTaskBarIcon::CTaskBarIcon() :
|
|||
wxTaskBarIcon()
|
||||
{
|
||||
iconTaskBarIcon = wxIcon( boinc_xpm );
|
||||
dtLastMouseCaptureTime = wxDateTime::Now();
|
||||
dtLastMouseCaptureTime = wxDateTime( (time_t)0 );
|
||||
|
||||
SetIcon( iconTaskBarIcon, wxEmptyString );
|
||||
}
|
||||
|
@ -56,10 +62,85 @@ CTaskBarIcon::~CTaskBarIcon()
|
|||
}
|
||||
|
||||
|
||||
void CTaskBarIcon::OnOpen( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
CMainFrame* pFrame = wxGetApp().GetFrame();
|
||||
wxASSERT(NULL != pFrame);
|
||||
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
||||
|
||||
if ( NULL != pFrame )
|
||||
pFrame->Show();
|
||||
}
|
||||
|
||||
|
||||
void CTaskBarIcon::OnActivitySelection( wxCommandEvent& event )
|
||||
{
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
|
||||
wxASSERT(NULL != pDoc);
|
||||
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||
|
||||
switch( event.GetId() )
|
||||
{
|
||||
case ID_ACTIVITYRUNALWAYS:
|
||||
pDoc->SetActivityRunMode( CMainDocument::MODE_ALWAYS );
|
||||
break;
|
||||
case ID_ACTIVITYSUSPEND:
|
||||
pDoc->SetActivityRunMode( CMainDocument::MODE_NEVER );
|
||||
break;
|
||||
case ID_ACTIVITYRUNBASEDONPREPERENCES:
|
||||
pDoc->SetActivityRunMode( CMainDocument::MODE_AUTO );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CTaskBarIcon::OnNetworkSelection( wxCommandEvent& event )
|
||||
{
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
|
||||
wxASSERT(NULL != pDoc);
|
||||
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||
|
||||
switch( event.GetId() )
|
||||
{
|
||||
case ID_NETWORKSUSPEND:
|
||||
if ( event.IsChecked() )
|
||||
{
|
||||
pDoc->SetNetworkRunMode( CMainDocument::MODE_ALWAYS );
|
||||
}
|
||||
else
|
||||
{
|
||||
pDoc->SetNetworkRunMode( CMainDocument::MODE_NEVER );
|
||||
}
|
||||
break;
|
||||
case ID_NETWORKRUNALWAYS:
|
||||
case ID_NETWORKRUNBASEDONPREPERENCES:
|
||||
default:
|
||||
pDoc->SetNetworkRunMode( CMainDocument::MODE_ALWAYS );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CTaskBarIcon::OnAbout( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
CDlgAbout* pDlg = new CDlgAbout(NULL);
|
||||
wxASSERT(NULL != pDlg);
|
||||
|
||||
pDlg->ShowModal();
|
||||
|
||||
if (pDlg)
|
||||
pDlg->Destroy();
|
||||
}
|
||||
|
||||
|
||||
void CTaskBarIcon::OnExit( wxCommandEvent& WXUNUSED(event) )
|
||||
{
|
||||
CMainFrame* pFrame = NULL;
|
||||
pFrame = wxGetApp().GetFrame();
|
||||
CMainFrame* pFrame = wxGetApp().GetFrame();
|
||||
wxASSERT(NULL != pFrame);
|
||||
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
||||
|
||||
if ( NULL != pFrame )
|
||||
pFrame->Close(true);
|
||||
}
|
||||
|
@ -67,8 +148,10 @@ void CTaskBarIcon::OnExit( wxCommandEvent& WXUNUSED(event) )
|
|||
|
||||
void CTaskBarIcon::OnClose( wxCloseEvent& event )
|
||||
{
|
||||
CMainFrame* pFrame = NULL;
|
||||
pFrame = wxGetApp().GetFrame();
|
||||
CMainFrame* pFrame = wxGetApp().GetFrame();
|
||||
wxASSERT(NULL != pFrame);
|
||||
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
||||
|
||||
if ( NULL != pFrame )
|
||||
pFrame->Close(true);
|
||||
}
|
||||
|
@ -76,7 +159,7 @@ void CTaskBarIcon::OnClose( wxCloseEvent& event )
|
|||
|
||||
void CTaskBarIcon::OnMouseMove( wxEvent& event )
|
||||
{
|
||||
wxTimeSpan ts(wxDateTime::Now() - dtLastMouseCaptureTime);
|
||||
wxTimeSpan ts(wxDateTime::Now() - dtLastMouseCaptureTime);
|
||||
|
||||
if ( ts.GetSeconds() > 5 )
|
||||
{
|
||||
|
@ -122,14 +205,51 @@ void CTaskBarIcon::OnMouseMove( wxEvent& event )
|
|||
|
||||
void CTaskBarIcon::OnRButtonDown( wxEvent& event )
|
||||
{
|
||||
wxMenu* menu = new wxMenu;
|
||||
wxASSERT( NULL != menu );
|
||||
CMainDocument* pDoc = wxGetApp().GetDocument();
|
||||
wxMenu* menu = new wxMenu;
|
||||
wxInt32 iActivityMode = -1;
|
||||
wxInt32 iNetworkMode = -1;
|
||||
|
||||
menu->Append(
|
||||
wxID_EXIT,
|
||||
_("E&xit"),
|
||||
wxEmptyString
|
||||
);
|
||||
wxASSERT(NULL != pDoc);
|
||||
wxASSERT(wxDynamicCast(pDoc, CMainDocument));
|
||||
wxASSERT(NULL != menu);
|
||||
|
||||
menu->Append( wxID_OPEN, _("&Open"), wxEmptyString );
|
||||
menu->AppendSeparator();
|
||||
menu->AppendRadioItem( ID_ACTIVITYRUNALWAYS, _("&Run always"), wxEmptyString );
|
||||
menu->AppendRadioItem( ID_ACTIVITYRUNBASEDONPREPERENCES, _("Run based on &preferences"), wxEmptyString );
|
||||
menu->AppendRadioItem( ID_ACTIVITYSUSPEND, _("&Suspend"), wxEmptyString );
|
||||
menu->AppendSeparator();
|
||||
menu->AppendCheckItem( ID_NETWORKSUSPEND, _("&Disable BOINC Network Access"), wxEmptyString );
|
||||
menu->AppendSeparator();
|
||||
menu->Append( wxID_ABOUT, _("&About BOINC Manager..."), wxEmptyString );
|
||||
menu->AppendSeparator();
|
||||
menu->Append( wxID_EXIT, _("E&xit"), wxEmptyString );
|
||||
|
||||
pDoc->GetActivityRunMode( iActivityMode );
|
||||
switch( iActivityMode )
|
||||
{
|
||||
case CMainDocument::MODE_ALWAYS:
|
||||
menu->Check( ID_ACTIVITYRUNALWAYS, true );
|
||||
break;
|
||||
case CMainDocument::MODE_NEVER:
|
||||
menu->Check( ID_ACTIVITYSUSPEND, true );
|
||||
break;
|
||||
case CMainDocument::MODE_AUTO:
|
||||
menu->Check( ID_ACTIVITYRUNBASEDONPREPERENCES, true );
|
||||
break;
|
||||
}
|
||||
|
||||
pDoc->GetNetworkRunMode( iNetworkMode );
|
||||
switch( iNetworkMode )
|
||||
{
|
||||
case CMainDocument::MODE_NEVER:
|
||||
menu->Check( ID_NETWORKSUSPEND, true );
|
||||
break;
|
||||
default:
|
||||
menu->Check( ID_NETWORKSUSPEND, false );
|
||||
break;
|
||||
}
|
||||
|
||||
PopupMenu( menu );
|
||||
|
||||
|
@ -139,8 +259,10 @@ void CTaskBarIcon::OnRButtonDown( wxEvent& event )
|
|||
|
||||
void CTaskBarIcon::OnLButtonDClick( wxEvent& event )
|
||||
{
|
||||
CMainFrame* pFrame = NULL;
|
||||
pFrame = wxGetApp().GetFrame();
|
||||
CMainFrame* pFrame = wxGetApp().GetFrame();
|
||||
wxASSERT(NULL != pFrame);
|
||||
wxASSERT(wxDynamicCast(pFrame, CMainFrame));
|
||||
|
||||
if ( NULL != pFrame )
|
||||
pFrame->Show();
|
||||
}
|
||||
|
|
|
@ -46,6 +46,10 @@ public:
|
|||
#endif
|
||||
};
|
||||
|
||||
void OnOpen( wxCommandEvent& event );
|
||||
void OnActivitySelection( wxCommandEvent& event );
|
||||
void OnNetworkSelection( wxCommandEvent& event );
|
||||
void OnAbout( wxCommandEvent& event );
|
||||
void OnExit( wxCommandEvent& event );
|
||||
void OnClose( wxCloseEvent& event );
|
||||
|
||||
|
|
Loading…
Reference in New Issue