diff --git a/client/win/boinc_log.h b/client/win/boinc_log.h
index 9970487e90..71f85b38a4 100644
--- a/client/win/boinc_log.h
+++ b/client/win/boinc_log.h
@@ -1,16 +1,16 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by boinc_cmd.rc
-//
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_3D_CONTROLS 1
-#define _APS_NEXT_RESOURCE_VALUE 109
-#define _APS_NEXT_COMMAND_VALUE 40000
-#define _APS_NEXT_CONTROL_VALUE 1007
-#define _APS_NEXT_SYMED_VALUE 102
-#endif
-#endif
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by boinc_cmd.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_3D_CONTROLS 1
+#define _APS_NEXT_RESOURCE_VALUE 109
+#define _APS_NEXT_COMMAND_VALUE 40000
+#define _APS_NEXT_CONTROL_VALUE 1007
+#define _APS_NEXT_SYMED_VALUE 102
+#endif
+#endif
diff --git a/client/win/boinc_log.rc b/client/win/boinc_log.rc
index f39335193a..7023645186 100644
--- a/client/win/boinc_log.rc
+++ b/client/win/boinc_log.rc
@@ -1,250 +1,250 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "boinc_cmd.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "winresrc.h"
-#include "version.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-#if defined(_GRIDREPUBLIC)
-
-#elif defined(_PROGRESSTHRUPROCESSORS)
-
-#elif defined(_WCG)
-IDI_MAIN_ICON ICON "res\\wcg.ico"
-#else
-IDI_MAIN_ICON ICON "res\\icon.ico"
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-
-#endif // Neutral resources
-
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "boinc_log.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""winresrc.h""\r\n"
- "#include ""version.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Visual Studio 2005 Compatibility
-//
-#ifndef IDC_STATIC
-#define IDC_STATIC (-1) // all static controls
-#endif
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-#if defined(_GRIDREPUBLIC)
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "GridRepublic"
- VALUE "FileDescription", "BOINC Log Conversion Client"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boinclog"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boinclog.exe"
- VALUE "ProductName", "BOINC client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#elif defined(_PROGRESSTHRUPROCESSORS)
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "Progress Thru Processors"
- VALUE "FileDescription", "BOINC Log Conversion Client"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boinclog"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boinclog.exe"
- VALUE "ProductName", "BOINC client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#elif defined(_WCG)
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "World Community Grid"
- VALUE "FileDescription", "BOINC Log Conversion Client"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boinclog"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boinclog.exe"
- VALUE "ProductName", "BOINC client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#else
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "Space Sciences Laboratory"
- VALUE "FileDescription", "BOINC Log Conversion Client"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boinclog"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boinclog.exe"
- VALUE "ProductName", "BOINC client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
+// Microsoft Visual C++ generated resource script.
+//
+#include "boinc_cmd.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winresrc.h"
+#include "version.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Neutral resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
+#ifdef _WIN32
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+#if defined(_GRIDREPUBLIC)
+
+#elif defined(_PROGRESSTHRUPROCESSORS)
+
+#elif defined(_WCG)
+IDI_MAIN_ICON ICON "res\\wcg.ico"
+#else
+IDI_MAIN_ICON ICON "res\\icon.ico"
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // Neutral resources
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "boinc_log.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""winresrc.h""\r\n"
+ "#include ""version.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Visual Studio 2005 Compatibility
+//
+#ifndef IDC_STATIC
+#define IDC_STATIC (-1) // all static controls
+#endif
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+#if defined(_GRIDREPUBLIC)
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "GridRepublic"
+ VALUE "FileDescription", "BOINC Log Conversion Client"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boinclog"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boinclog.exe"
+ VALUE "ProductName", "BOINC client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#elif defined(_PROGRESSTHRUPROCESSORS)
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Progress Thru Processors"
+ VALUE "FileDescription", "BOINC Log Conversion Client"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boinclog"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boinclog.exe"
+ VALUE "ProductName", "BOINC client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#elif defined(_WCG)
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "World Community Grid"
+ VALUE "FileDescription", "BOINC Log Conversion Client"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boinclog"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boinclog.exe"
+ VALUE "ProductName", "BOINC client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#else
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Space Sciences Laboratory"
+ VALUE "FileDescription", "BOINC Log Conversion Client"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boinclog"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boinclog.exe"
+ VALUE "ProductName", "BOINC client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/clientctrl/boincsvcctrl.cpp b/clientctrl/boincsvcctrl.cpp
index 8fa9e0e620..72151bfbf6 100644
--- a/clientctrl/boincsvcctrl.cpp
+++ b/clientctrl/boincsvcctrl.cpp
@@ -1,67 +1,67 @@
-// This file is part of BOINC.
-// http://boinc.berkeley.edu
-// Copyright (C) 2008 University of California
-//
-// BOINC is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation,
-// either version 3 of the License, or (at your option) any later version.
-//
-// BOINC is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with BOINC. If not, see .
-
-#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_)
-#include "boinc_win.h"
-#endif
-
-#include "version.h"
-#include "daemonmgt.h"
-
-void version(){
- printf("boincsvcctrl, built from %s \n", PACKAGE_STRING );
- exit(0);
-}
-
-void usage() {
- fprintf(stderr, "\n\
-usage: boincsvcctrl command\n\n\
-Commands:\n\
- --start start the BOINC service\n\
- --stop stop the BOINC service\n\
- --version, -V show core client version\n\
-"
-);
- exit(1);
-}
-
-int main(int argc, char** argv) {
- int i = 1;
- int retval = 0;
-
- if (argc < 1) {
- usage();
- }
-
- if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
- usage();
- }
- if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "-V")) {
- version();
- }
-
- if (!strcmp(argv[i], "--start")) {
- retval = !start_daemon();
- }
-
- if (!strcmp(argv[i], "--stop")) {
- retval = !stop_daemon();
- }
-
- exit(retval);
-}
-
+// This file is part of BOINC.
+// http://boinc.berkeley.edu
+// Copyright (C) 2008 University of California
+//
+// BOINC is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation,
+// either version 3 of the License, or (at your option) any later version.
+//
+// BOINC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with BOINC. If not, see .
+
+#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_)
+#include "boinc_win.h"
+#endif
+
+#include "version.h"
+#include "daemonmgt.h"
+
+void version(){
+ printf("boincsvcctrl, built from %s \n", PACKAGE_STRING );
+ exit(0);
+}
+
+void usage() {
+ fprintf(stderr, "\n\
+usage: boincsvcctrl command\n\n\
+Commands:\n\
+ --start start the BOINC service\n\
+ --stop stop the BOINC service\n\
+ --version, -V show core client version\n\
+"
+);
+ exit(1);
+}
+
+int main(int argc, char** argv) {
+ int i = 1;
+ int retval = 0;
+
+ if (argc < 1) {
+ usage();
+ }
+
+ if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
+ usage();
+ }
+ if (!strcmp(argv[i], "--version") || !strcmp(argv[i], "-V")) {
+ version();
+ }
+
+ if (!strcmp(argv[i], "--start")) {
+ retval = !start_daemon();
+ }
+
+ if (!strcmp(argv[i], "--stop")) {
+ retval = !stop_daemon();
+ }
+
+ exit(retval);
+}
+
diff --git a/clientctrl/boincsvcctrl.h b/clientctrl/boincsvcctrl.h
index d4aafdb3b8..72668211c8 100644
--- a/clientctrl/boincsvcctrl.h
+++ b/clientctrl/boincsvcctrl.h
@@ -1,16 +1,16 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by boincsvcctrl.rc
-//
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_3D_CONTROLS 1
-#define _APS_NEXT_RESOURCE_VALUE 109
-#define _APS_NEXT_COMMAND_VALUE 40000
-#define _APS_NEXT_CONTROL_VALUE 1007
-#define _APS_NEXT_SYMED_VALUE 102
-#endif
-#endif
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by boincsvcctrl.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_3D_CONTROLS 1
+#define _APS_NEXT_RESOURCE_VALUE 109
+#define _APS_NEXT_COMMAND_VALUE 40000
+#define _APS_NEXT_CONTROL_VALUE 1007
+#define _APS_NEXT_SYMED_VALUE 102
+#endif
+#endif
diff --git a/clientctrl/boincsvcctrl.rc b/clientctrl/boincsvcctrl.rc
index 8d41c79620..ea712c64d1 100644
--- a/clientctrl/boincsvcctrl.rc
+++ b/clientctrl/boincsvcctrl.rc
@@ -1,269 +1,269 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "boincsvcctrl.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "winresrc.h"
-#include "version.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-
-#endif // Neutral resources
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "boincsvcctrl.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""winresrc.h""\r\n"
- "#include ""version.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Visual Studio 2005 Compatibility
-//
-#ifndef IDC_STATIC
-#define IDC_STATIC (-1) // all static controls
-#endif
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-#if defined (_GRIDREPUBLIC)
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "GridRepublic"
- VALUE "FileDescription", "BOINC service controller"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boincsvcctrl"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boincsvcctrl.exe"
- VALUE "ProductName", "BOINC core client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#elif defined(_PROGRESSTHRUPROCESSORS)
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "Progress Thru Processors"
- VALUE "FileDescription", "BOINC service controller"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boincsvcctrl"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boincsvcctrl.exe"
- VALUE "ProductName", "BOINC core client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#elif defined(_CHARITYENGINE)
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "Charity Engine"
- VALUE "FileDescription", "BOINC service controller"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boincsvcctrl"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boincsvcctrl.exe"
- VALUE "ProductName", "BOINC core client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#elif defined(_WCG)
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "World Community Grid"
- VALUE "FileDescription", "BOINC service controller"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boincsvcctrl"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boincsvcctrl.exe"
- VALUE "ProductName", "BOINC core client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#else
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "Space Sciences Laboratory"
- VALUE "FileDescription", "BOINC service controller"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boincsvcctrl"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boincsvcctrl.exe"
- VALUE "ProductName", "BOINC core client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
+// Microsoft Visual C++ generated resource script.
+//
+#include "boincsvcctrl.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winresrc.h"
+#include "version.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Neutral resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
+#ifdef _WIN32
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // Neutral resources
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "boincsvcctrl.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""winresrc.h""\r\n"
+ "#include ""version.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Visual Studio 2005 Compatibility
+//
+#ifndef IDC_STATIC
+#define IDC_STATIC (-1) // all static controls
+#endif
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+#if defined (_GRIDREPUBLIC)
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "GridRepublic"
+ VALUE "FileDescription", "BOINC service controller"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boincsvcctrl"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boincsvcctrl.exe"
+ VALUE "ProductName", "BOINC core client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#elif defined(_PROGRESSTHRUPROCESSORS)
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Progress Thru Processors"
+ VALUE "FileDescription", "BOINC service controller"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boincsvcctrl"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boincsvcctrl.exe"
+ VALUE "ProductName", "BOINC core client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#elif defined(_CHARITYENGINE)
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Charity Engine"
+ VALUE "FileDescription", "BOINC service controller"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boincsvcctrl"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boincsvcctrl.exe"
+ VALUE "ProductName", "BOINC core client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#elif defined(_WCG)
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "World Community Grid"
+ VALUE "FileDescription", "BOINC service controller"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boincsvcctrl"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boincsvcctrl.exe"
+ VALUE "ProductName", "BOINC core client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#else
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Space Sciences Laboratory"
+ VALUE "FileDescription", "BOINC service controller"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boincsvcctrl"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boincsvcctrl.exe"
+ VALUE "ProductName", "BOINC core client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/clientgui/DlgEventLog.cpp b/clientgui/DlgEventLog.cpp
index d51362ab3f..34eb3397cd 100644
--- a/clientgui/DlgEventLog.cpp
+++ b/clientgui/DlgEventLog.cpp
@@ -1,971 +1,971 @@
-// This file is part of BOINC.
-// http://boinc.berkeley.edu
-// Copyright (C) 2008 University of California
-//
-// BOINC is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation,
-// either version 3 of the License, or (at your option) any later version.
-//
-// BOINC is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with BOINC. If not, see .
-
-#if defined(__GNUG__) && !defined(__APPLE__)
-#pragma implementation "DlgEventLog.h"
-#endif
-
-#include "stdwx.h"
-#include "common_defs.h"
-#include "diagnostics.h"
-#include "str_util.h"
-#include "mfile.h"
-#include "miofile.h"
-#include "parse.h"
-#include "error_numbers.h"
-#include "Events.h"
-#include "BOINCGUIApp.h"
-#include "SkinManager.h"
-#include "MainDocument.h"
-#include "BOINCBaseFrame.h"
-#include "version.h"
-#include "DlgEventLogListCtrl.h"
-#include "DlgEventLog.h"
-#include "AdvancedFrame.h"
-
-
-
-////@begin includes
-////@end includes
-
-////@begin XPM images
-////@end XPM images
-
-
-#define COLUMN_PROJECT 0
-#define COLUMN_TIME 1
-#define COLUMN_MESSAGE 2
-
-
-static bool s_bIsFiltered = false;
-static std::string s_strFilteredProjectName;
-
-/*!
- * CDlgEventLog type definition
- */
-
-IMPLEMENT_DYNAMIC_CLASS( CDlgEventLog, wxDialog )
-
-/*!
- * CDlgEventLog event table definition
- */
-
-BEGIN_EVENT_TABLE( CDlgEventLog, wxDialog )
-////@begin CDlgEventLog event table entries
- EVT_HELP(wxID_ANY, CDlgEventLog::OnHelp)
- EVT_BUTTON(wxID_OK, CDlgEventLog::OnOK)
- EVT_BUTTON(ID_COPYAll, CDlgEventLog::OnMessagesCopyAll)
- EVT_BUTTON(ID_COPYSELECTED, CDlgEventLog::OnMessagesCopySelected)
- EVT_BUTTON(ID_TASK_MESSAGES_FILTERBYPROJECT, CDlgEventLog::OnMessagesFilter)
- EVT_BUTTON(ID_SIMPLE_HELP, CDlgEventLog::OnButtonHelp)
- EVT_SIZE(CDlgEventLog::OnSize)
- EVT_MOVE(CDlgEventLog::OnMove)
- EVT_CLOSE(CDlgEventLog::OnClose)
-////@end CDlgEventLog event table entries
-END_EVENT_TABLE()
-
-/*!
- * CDlgEventLog constructors
- */
-
-CDlgEventLog::CDlgEventLog( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
-{
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::CDlgEventLog - Constructor Function Begin"));
-
- Create(parent, id, caption, pos, size, style);
-
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::CDlgEventLog - Constructor Function End"));
-}
-
-
-CDlgEventLog::~CDlgEventLog() {
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::CDlgEventLog - Destructor Function Begin"));
-
- SaveState();
- SetWindowDimensions();
-
- if (m_pMessageInfoAttr) {
- delete m_pMessageInfoAttr;
- m_pMessageInfoAttr = NULL;
- }
-
- if (m_pMessageErrorAttr) {
- delete m_pMessageErrorAttr;
- m_pMessageErrorAttr = NULL;
- }
-
- if (m_pMessageInfoGrayAttr) {
- delete m_pMessageInfoGrayAttr;
- m_pMessageInfoGrayAttr = NULL;
- }
-
- if (m_pMessageErrorGrayAttr) {
- delete m_pMessageErrorGrayAttr;
- m_pMessageErrorGrayAttr = NULL;
- }
-
- m_iFilteredIndexes.Clear();
-
- wxGetApp().OnEventLogClose();
-
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::CDlgEventLog - Destructor Function End"));
-}
-
-
-/*!
- * CDlgEventLog creator
- */
-
-bool CDlgEventLog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
-{
-////@begin CDlgEventLog member initialisation
- m_iPreviousRowCount = 0;
- m_iTotalDocCount = 0;
- m_iPreviousTotalDocCount = 0;
- if (!s_bIsFiltered) {
- s_strFilteredProjectName.clear();
- }
- m_iFilteredIndexes.Clear();
- m_bProcessingRefreshEvent = false;
- m_bEventLogIsOpen = true;
-////@end CDlgEventLog member initialisation
-
- CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
- wxPoint oTempPoint;
- wxSize oTempSize;
-
- wxASSERT(pSkinAdvanced);
- wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
-
- if ((pos == wxDefaultPosition) && (size == wxDefaultSize)) {
- // Get size and position from the previous configuration
- GetWindowDimensions( oTempPoint, oTempSize );
-
-#ifdef __WXMSW__
- // Windows does some crazy things if the initial position is a negative
- // value.
- oTempPoint.x = wxDefaultCoord;
- oTempPoint.y = wxDefaultCoord;
-#endif
-
-#ifdef __WXMAC__
- // If the user has changed the arrangement of multiple
- // displays, make sure the window title bar is still on-screen.
- if (!IsWindowOnScreen(oTempPoint.x, oTempPoint.y, oTempSize.GetWidth(), oTempSize.GetHeight())) {
- oTempPoint.y = oTempPoint.x = 30;
- }
-#endif // ! __WXMAC__
- } else {
- oTempPoint = pos;
- oTempSize = size;
- }
-
- wxDialog::Create( parent, id, caption, oTempPoint, oTempSize, style );
-
- SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
-
- // Initialize Application Title
- wxString strCaption = caption;
- if (strCaption.IsEmpty()) {
- strCaption.Printf(_("%s - Event Log"), pSkinAdvanced->GetApplicationName().c_str());
- }
- SetTitle(strCaption);
-
- // Initialize Application Icon
- wxIconBundle icons;
- icons.AddIcon(*pSkinAdvanced->GetApplicationIcon());
- icons.AddIcon(*pSkinAdvanced->GetApplicationIcon32());
- SetIcons(icons);
-
- CreateControls();
-
- // Create List Pane Items
- m_pList->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 109);
- m_pList->InsertColumn(COLUMN_TIME, _("Time"), wxLIST_FORMAT_LEFT, 130);
- m_pList->InsertColumn(COLUMN_MESSAGE, _("Message"), wxLIST_FORMAT_LEFT, 378);
-
- m_pMessageInfoAttr = new wxListItemAttr(
- wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
- wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),
- wxNullFont
- );
- m_pMessageErrorAttr = new wxListItemAttr(
- *wxRED,
- wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),
- wxNullFont
- );
-#if EVENT_LOG_STRIPES
- m_pMessageInfoGrayAttr = new wxListItemAttr(
- wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
- wxColour(240, 240, 240),
- wxNullFont
- );
- m_pMessageErrorGrayAttr = new wxListItemAttr(*wxRED, wxColour(240, 240, 240), wxNullFont);
-#else
- m_pMessageInfoGrayAttr = new wxListItemAttr(*m_pMessageInfoAttr);
- m_pMessageErrorGrayAttr = new wxListItemAttr(*m_pMessageErrorAttr);
-#endif
-
- SetTextColor();
- RestoreState();
-
- return true;
-}
-
-
-/*!
- * Control creation for CDlgEventLog
- */
-
-void CDlgEventLog::CreateControls()
-{
- CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
-
- wxASSERT(pSkinAdvanced);
- wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
-
- wxFlexGridSizer* itemFlexGridSizer2 = new wxFlexGridSizer(2, 1, 0, 0);
- itemFlexGridSizer2->AddGrowableRow(0);
- itemFlexGridSizer2->AddGrowableCol(0);
- SetSizer(itemFlexGridSizer2);
-
- m_pList = new CDlgEventLogListCtrl(this, ID_SIMPLE_MESSAGESVIEW, EVENT_LOG_DEFAULT_LIST_MULTI_SEL_FLAGS);
- itemFlexGridSizer2->Add(m_pList, 0, wxGROW|wxALL, 5);
-
- wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
-
- itemFlexGridSizer2->Add(itemBoxSizer4, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 12);
-
- m_pFilterButton = new wxButton(this, ID_TASK_MESSAGES_FILTERBYPROJECT, _("&Show only this project"), wxDefaultPosition, wxDefaultSize);
- itemBoxSizer4->Add(m_pFilterButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
-
-#ifdef wxUSE_CLIPBOARD
- wxButton* itemButton1 = new wxButton(this, ID_COPYAll, _("Copy &All"), wxDefaultPosition, wxDefaultSize );
- itemButton1->SetHelpText(
- _("Copy all the messages to the clipboard.")
- );
-#if wxUSE_TOOLTIPS
- itemButton1->SetToolTip(
- _("Copy all the messages to the clipboard.")
- );
-#endif
- itemBoxSizer4->Add(itemButton1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
-
- m_pCopySelectedButton = new wxButton(this, ID_COPYSELECTED, _("Copy &Selected"), wxDefaultPosition, wxDefaultSize );
- m_pCopySelectedButton->SetHelpText(
-#ifdef __WXMAC__
- _("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or command key while clicking on messages.")
-#else
- _("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or control key while clicking on messages.")
-#endif
- );
-#if wxUSE_TOOLTIPS
- m_pCopySelectedButton->SetToolTip(
-#ifdef __WXMAC__
- _("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or command key while clicking on messages.")
-#else
- _("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or control key while clicking on messages.")
-#endif
- );
-#endif
- itemBoxSizer4->Add(m_pCopySelectedButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
-#endif
-
- wxButton* itemButton44 = new wxButton(this, wxID_OK, _("&Close"), wxDefaultPosition, wxDefaultSize);
- itemBoxSizer4->Add(itemButton44, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
-
-#ifndef __WXMAC__
- wxContextHelpButton* itemButton45 = new wxContextHelpButton(this);
- itemBoxSizer4->Add(itemButton45, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
-#else
- wxButton* itemButton45 = new wxButton(this, ID_SIMPLE_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize);
- wxString helpTip;
- helpTip.Printf(_("Get help with %s"), pSkinAdvanced->GetApplicationShortName().c_str());
- itemButton45->SetHelpText(helpTip);
-#ifdef wxUSE_TOOLTIPS
- itemButton45->SetToolTip(helpTip);
-#endif
- itemBoxSizer4->Add(itemButton45, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
-#endif
-
- SetFilterButtonText();
-}
-
-
-void CDlgEventLog::SetFilterButtonText() {
- if (s_bIsFiltered) {
- m_pFilterButton->SetLabel( _("Show all &messages") );
- m_pFilterButton->SetHelpText( _("Show messages for all projects") );
-#ifdef wxUSE_TOOLTIPS
- m_pFilterButton->SetToolTip(_("Show messages for all projects"));
-#endif
- } else {
- m_pFilterButton->SetLabel( _("&Show only this project") );
- m_pFilterButton->SetHelpText( _("Show only the messages for the selected project") );
-#ifdef wxUSE_TOOLTIPS
- m_pFilterButton->SetToolTip(_("Show only the messages for the selected project"));
-#endif
- }
- // Adjust button size for new text
- Layout();
-}
-
-
-/*!
- * Text color selection for CDlgEventLog
- */
-
-void CDlgEventLog::SetTextColor() {
- bool isConnected = wxGetApp().GetDocument()->IsConnected();
-
- if (isConnected) {
- m_pMessageInfoAttr->SetTextColour(*wxBLACK);
- m_pMessageErrorAttr->SetTextColour(*wxRED);
- m_pMessageInfoGrayAttr->SetTextColour(*wxBLACK);
- m_pMessageErrorGrayAttr->SetTextColour(*wxRED);
- } else {
- wxColourDatabase colorBase;
- m_pMessageInfoAttr->SetTextColour(wxColour(128, 128, 128));
- m_pMessageErrorAttr->SetTextColour(wxColour(255, 128, 128));
- m_pMessageInfoGrayAttr->SetTextColour(wxColour(128, 128, 128));
- m_pMessageErrorGrayAttr->SetTextColour(wxColour(255, 128, 128));
- }
-}
-
-
-/*!
- * wxEVT_HELP event handler for ID_DLGMESSAGES
- */
-
-void CDlgEventLog::OnHelp(wxHelpEvent& event) {
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnHelp - Function Begin"));
-
- if (IsShown()) {
- wxString strURL = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl();
-
- wxString wxurl;
- wxurl.Printf(
- wxT("%s?target=simple_messages&version=%s&controlid=%d"),
- strURL.c_str(),
- wxString(BOINC_VERSION_STRING, wxConvUTF8).c_str(),
- event.GetId()
- );
- wxLaunchDefaultBrowser(wxurl);
- }
-
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnHelp - Function End"));
-}
-
-
-/*!
- * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
- */
-
-void CDlgEventLog::OnOK( wxCommandEvent& WXUNUSED(event) ) {
- Close();
-}
-
-
-/*!
- * wxEVT_CLOSE event handler for CDlgEventLog (window close control clicked)
- */
-
-void CDlgEventLog::OnClose(wxCloseEvent& WXUNUSED(event)) {
- m_bEventLogIsOpen = false; // User specifically closed window
- Destroy();
-}
-
-
-void CDlgEventLog::OnMessagesFilter( wxCommandEvent& WXUNUSED(event) ) {
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnMessagesFilter - Function Begin"));
-
- wxInt32 iIndex = -1;
- MESSAGE* message;
-
- wxASSERT(m_pList);
-
- m_iFilteredIndexes.Clear();
- s_strFilteredProjectName.clear();
-
- if (s_bIsFiltered) {
- s_bIsFiltered = false;
- m_iFilteredDocCount = m_iTotalDocCount;
- } else {
- iIndex = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
- if (iIndex >= 0) {
- message = wxGetApp().GetDocument()->message(iIndex);
- if ((message->project).size() > 0) {
- s_strFilteredProjectName = message->project;
- s_bIsFiltered = true;
- for (iIndex = 0; iIndex < m_iTotalDocCount; iIndex++) {
- message = wxGetApp().GetDocument()->message(iIndex);
- if (message->project.empty() || (message->project == s_strFilteredProjectName)) {
- m_iFilteredIndexes.Add(iIndex);
- }
-
- }
- m_iFilteredDocCount = (int)(m_iFilteredIndexes.GetCount());
- }
- }
- }
-
- SetFilterButtonText();
-
- // Force a complete update
- m_iPreviousRowCount = 0;
- m_pList->DeleteAllItems();
- m_pList->SetItemCount(m_iFilteredDocCount);
- OnRefresh();
-
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnMessagesFilter - Function End"));
-}
-
-
-wxInt32 CDlgEventLog::GetFilteredMessageIndex( wxInt32 iRow) const {
- if (s_bIsFiltered) return m_iFilteredIndexes[iRow];
- return iRow;
-}
-
-
-// Get the (possibly filtered) item count (i.e., the Row count)
-wxInt32 CDlgEventLog::GetDocCount() {
- int i;
-
- m_iTotalDocCount = wxGetApp().GetDocument()->GetMessageCount();
- if (m_iTotalDocCount < m_iPreviousTotalDocCount) {
- // Usually due to a disconnect from client
- ResetMessageFiltering();
- }
-
- if (s_bIsFiltered) {
- for (i = m_iPreviousTotalDocCount; i < m_iTotalDocCount; i++) {
- MESSAGE* message = wxGetApp().GetDocument()->message(i);
- if (message->project.empty() || (message->project == s_strFilteredProjectName)) {
- m_iFilteredIndexes.Add(i);
- }
- }
- m_iPreviousTotalDocCount = m_iTotalDocCount;
- m_iFilteredDocCount = (int)(m_iFilteredIndexes.GetCount());
- return m_iFilteredDocCount;
- }
-
- m_iPreviousTotalDocCount = m_iTotalDocCount;
- m_iFilteredDocCount = m_iTotalDocCount;
- return m_iTotalDocCount;
-}
-
-
-/*!
- * called from CMainDocument::HandleCompletedRPC() after wxEVT_RPC_FINISHED event
- */
-void CDlgEventLog::OnRefresh() {
- 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 (!IsShown()) return;
-
- if (!m_bProcessingRefreshEvent) {
- m_bProcessingRefreshEvent = true;
-
- wxASSERT(m_pList);
-
- wxInt32 iRowCount = GetDocCount();
- if (0 >= iRowCount) {
- m_pList->DeleteAllItems();
- ResetMessageFiltering();
- } else {
- // If connected computer changed, reset message filtering
- isConnected = wxGetApp().GetDocument()->IsConnected();
- if (isConnected) {
- pDoc->GetConnectedComputerName(strNewMachineName);
- if (strLastMachineName != strNewMachineName) {
- strLastMachineName = strNewMachineName;
- was_connected = false;
- ResetMessageFiltering();
- }
- }
-
- // If connection status changed, adjust color of messages display
- if (was_connected != isConnected) {
- was_connected = isConnected;
- SetTextColor();
-
- // Force a complete update
- m_pList->DeleteAllItems();
- m_pList->SetItemCount(iRowCount);
- m_iPreviousRowCount = 0; // Force scrolling to bottom
-
- } else {
- // Connection status didn't change
- if (m_iPreviousRowCount != iRowCount) {
- m_pList->SetItemCount(iRowCount);
- }
- }
- }
-
- if ((iRowCount > 1) && (EnsureLastItemVisible()) && (m_iPreviousRowCount != iRowCount)) {
- m_pList->EnsureVisible(iRowCount - 1);
- }
-
- if (m_iPreviousRowCount != iRowCount) {
- m_iPreviousRowCount = iRowCount;
- }
-
- UpdateButtons();
-
- m_bProcessingRefreshEvent = false;
- }
-}
-
-
-bool CDlgEventLog::SaveState() {
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::SaveState - Function Begin"));
-
- wxString strBaseConfigLocation = wxEmptyString;
- wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
- wxListItem liColumnInfo;
- wxInt32 iIndex = 0;
- wxInt32 iColumnCount = 0;
-
- wxASSERT(pConfig);
-
- // An odd case happens every once and awhile where wxWidgets looses
- // the pointer to the config object, or it is cleaned up before
- // the window has finished it's cleanup duty. If we detect a NULL
- // pointer, return false.
- if (!pConfig) return false;
-
- strBaseConfigLocation = wxString(wxT("/"));
- pConfig->SetPath(strBaseConfigLocation);
- pConfig->Write(wxT("EventLogOpen"), m_bEventLogIsOpen);
-
- //
- // Save Frame State
- //
- strBaseConfigLocation = wxString(wxT("/EventLog/"));
- pConfig->SetPath(strBaseConfigLocation);
-
- // Convert to a zero based index
- iColumnCount = m_pList->GetColumnCount() - 1;
-
- // Which fields are we interested in?
- liColumnInfo.SetMask(
- wxLIST_MASK_TEXT |
- wxLIST_MASK_WIDTH |
- wxLIST_MASK_FORMAT
- );
-
- // Cycle through the columns recording anything interesting
- for (iIndex = 0; iIndex <= iColumnCount; iIndex++) {
- m_pList->GetColumn(iIndex, liColumnInfo);
-
- pConfig->SetPath(strBaseConfigLocation + liColumnInfo.GetText());
- pConfig->Write(wxT("Width"), m_pList->GetColumnWidth(iIndex)); // Work around bug in wxMac-2.8.0 wxListCtrl::SetColumn()
- }
-
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::SaveState - Function End"));
- return true;
-}
-
-
-bool CDlgEventLog::RestoreState() {
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::RestoreState - Function Begin"));
-
- wxString strBaseConfigLocation = wxString(wxT("/EventLog/"));
- wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
- wxListItem liColumnInfo;
- wxInt32 iIndex = 0;
- wxInt32 iColumnCount = 0;
- wxInt32 iTempValue = 0;
-
- wxASSERT(pConfig);
-
- // An odd case happens every once and awhile where wxWidgets looses
- // the pointer to the config object, or it is cleaned up before
- // the window has finished it's cleanup duty. If we detect a NULL
- // pointer, return false.
- if (!pConfig) return false;
-
- //
- // Restore Frame State
- //
- pConfig->SetPath(strBaseConfigLocation);
-
- // Convert to a zero based index
- iColumnCount = m_pList->GetColumnCount() - 1;
-
- // Which fields are we interested in?
- liColumnInfo.SetMask(
- wxLIST_MASK_TEXT |
- wxLIST_MASK_WIDTH |
- wxLIST_MASK_FORMAT
- );
-
- // Cycle through the columns recording anything interesting
- for (iIndex = 0; iIndex <= iColumnCount; iIndex++) {
- m_pList->GetColumn(iIndex, liColumnInfo);
-
- pConfig->SetPath(strBaseConfigLocation + liColumnInfo.GetText());
- pConfig->Read(wxT("Width"), &iTempValue, -1);
- if (-1 != iTempValue) {
- liColumnInfo.SetWidth(iTempValue);
-#if (defined(__WXMAC__) && wxCHECK_VERSION(2,8,0))
- m_pList->SetColumnWidth(iIndex,iTempValue); // Work around bug in wxMac-2.8.0 wxListCtrl::SetColumn()
-#endif
- }
-
- m_pList->SetColumn(iIndex, liColumnInfo);
- }
-
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::RestoreState - Function End"));
- return true;
-}
-
-
-void CDlgEventLog::GetWindowDimensions( wxPoint& position, wxSize& size ) {
- wxString strBaseConfigLocation = wxString(wxT("/EventLog/"));
- wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
- int iHeight = 0, iWidth = 0, iTop = 0, iLeft = 0;
-
- wxASSERT(pConfig);
-
- pConfig->SetPath(strBaseConfigLocation);
-
- pConfig->Read(wxT("YPos"), &iTop, 30);
- pConfig->Read(wxT("XPos"), &iLeft, 30);
- pConfig->Read(wxT("Width"), &iWidth, 640);
- pConfig->Read(wxT("Height"), &iHeight, 480);
-
- position.y = iTop;
- position.x = iLeft;
- size.x = iWidth;
- size.y = iHeight;
-}
-
-
-void CDlgEventLog::SetWindowDimensions() {
- wxString strBaseConfigLocation = wxString(wxT("/EventLog/"));
- wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
-
- wxASSERT(pConfig);
-
- if (!IsIconized()) {
- pConfig->SetPath(strBaseConfigLocation);
- pConfig->Write(wxT("XPos"), GetPosition().x);
- pConfig->Write(wxT("YPos"), GetPosition().y);
- pConfig->Write(wxT("Width"), GetSize().x);
- pConfig->Write(wxT("Height"), GetSize().y);
- }
-}
-
-
-void CDlgEventLog::OnSize(wxSizeEvent& event) {
- SetWindowDimensions();
- event.Skip();
-}
-
-
-void CDlgEventLog::OnMove(wxMoveEvent& event) {
- SetWindowDimensions();
- event.Skip();
-}
-
-
-/*!
- * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COPYAll
- */
-
-void CDlgEventLog::OnMessagesCopyAll( wxCommandEvent& WXUNUSED(event) ) {
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnMessagesCopyAll - Function Begin"));
-
-#ifdef wxUSE_CLIPBOARD
- wxInt32 iIndex = -1;
- wxInt32 iRowCount = 0;
-
- iRowCount = m_pList->GetItemCount();
-
- OpenClipboard( iRowCount * 1024 );
-
- for (iIndex = 0; iIndex < iRowCount; iIndex++) {
- CopyToClipboard(iIndex);
- }
-
- CloseClipboard();
-#endif
-
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnMessagesCopyAll - Function End"));
-}
-
-
-/*!
- * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COPYSELECTED
- */
-
-void CDlgEventLog::OnMessagesCopySelected( wxCommandEvent& WXUNUSED(event) ) {
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnMessagesCopySelected - Function Begin"));
-
-#ifdef wxUSE_CLIPBOARD
- wxInt32 iIndex = -1;
- wxInt32 iRowCount = 0;
-
- // Count the number of items selected
- for (;;) {
- iIndex = m_pList->GetNextItem(
- iIndex, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED
- );
- if (iIndex == -1) break;
-
- iRowCount++;
- }
-
- OpenClipboard( iRowCount * 1024 );
-
- // Reset the position indicator
- iIndex = -1;
-
- for (;;) {
- iIndex = m_pList->GetNextItem(
- iIndex, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED
- );
- if (iIndex == -1) break;
-
- CopyToClipboard(iIndex);
- }
-
- CloseClipboard();
-#endif
-
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnMessagesCopySelected - Function End"));
-}
-
-
-/*!
- * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SIMPLE_HELP
- */
-
-void CDlgEventLog::OnButtonHelp( wxCommandEvent& event ) {
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnHelp - Function Begin"));
-
- if (IsShown()) {
- wxString strURL = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl();
-
- wxString wxurl;
- wxurl.Printf(
- wxT("%s?target=simple_messages&version=%s&controlid=%d"),
- strURL.c_str(),
- wxString(BOINC_VERSION_STRING, wxConvUTF8).c_str(),
- event.GetId()
- );
- wxLaunchDefaultBrowser(wxurl);
- }
-
- wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnHelp - Function End"));
-}
-
-
-void CDlgEventLog::ResetMessageFiltering() {
- s_bIsFiltered = false;
- s_strFilteredProjectName.clear();
- m_iFilteredIndexes.Clear();
- SetFilterButtonText();
-}
-
-
-void CDlgEventLog::UpdateButtons() {
- bool enableFilterButton = s_bIsFiltered;
- bool enableCopySelectedButon = false;
- if (m_iTotalDocCount > 0) {
- int n = m_pList->GetSelectedItemCount();
- if (n > 0) {
- enableCopySelectedButon = true;
- }
-
- if ((n == 1) && (! s_bIsFiltered)) {
- n = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
- MESSAGE* message = wxGetApp().GetDocument()->message(n);
- if ((message->project).size() > 0) {
- enableFilterButton = true;
- }
- }
- }
- m_pFilterButton->Enable(enableFilterButton);
- m_pCopySelectedButton->Enable(enableCopySelectedButon);
-}
-
-
-wxString CDlgEventLog::OnListGetItemText(long item, long column) const {
- wxString strBuffer = wxEmptyString;
- wxInt32 index = GetFilteredMessageIndex(item);
-
- switch(column) {
- case COLUMN_PROJECT:
- FormatProjectName(index, strBuffer);
- break;
- case COLUMN_TIME:
- FormatTime(index, strBuffer);
- break;
- case COLUMN_MESSAGE:
- FormatMessage(index, strBuffer);
- break;
- }
-
- return strBuffer;
-}
-
-
-wxListItemAttr* CDlgEventLog::OnListGetItemAttr(long item) const {
- wxListItemAttr* pAttribute = NULL;
- wxInt32 index = GetFilteredMessageIndex(item);
- MESSAGE* message = wxGetApp().GetDocument()->message(index);
-
- // If we are using some theme where the default background color isn't
- // white, then our whole system is boned. Use defaults instead.
- if (wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) != wxColor(wxT("WHITE"))) return NULL;
-
- if (message) {
- switch(message->priority) {
- case MSG_USER_ALERT:
- pAttribute = item % 2 ? m_pMessageErrorGrayAttr : m_pMessageErrorAttr;
- break;
- default:
- pAttribute = item % 2 ? m_pMessageInfoGrayAttr : m_pMessageInfoAttr;
- break;
- }
- }
-
- return pAttribute;
-}
-
-
-bool CDlgEventLog::EnsureLastItemVisible() {
- int numVisible = m_pList->GetCountPerPage();
-
- // Auto-scroll only if already at bottom of list
- if ((m_iPreviousRowCount > numVisible)
- && ((m_pList->GetTopItem() + numVisible) < (m_iPreviousRowCount-1))
- ) {
- return false;
- }
-
- return true;
-}
-
-
-wxInt32 CDlgEventLog::FormatProjectName(wxInt32 item, wxString& strBuffer) const {
- MESSAGE* message = wxGetApp().GetDocument()->message(item);
-
- if (message) {
- strBuffer = wxString(message->project.c_str(), wxConvUTF8);
- }
-
- return 0;
-}
-
-
-wxInt32 CDlgEventLog::FormatTime(wxInt32 item, wxString& strBuffer) const {
- wxDateTime dtBuffer;
- MESSAGE* message = wxGetApp().GetDocument()->message(item);
-
- if (message) {
- dtBuffer.Set((time_t)message->timestamp);
- strBuffer = dtBuffer.Format();
- }
-
- return 0;
-}
-
-
-wxInt32 CDlgEventLog::FormatMessage(wxInt32 item, wxString& strBuffer) const {
- MESSAGE* message = wxGetApp().GetDocument()->message(item);
-
- if (message) {
- strBuffer = wxString(message->body.c_str(), wxConvUTF8);
- wxGetApp().GetDocument()->LocalizeNoticeText(strBuffer, false, true);
- }
-
- return 0;
-}
-
-
-#ifdef wxUSE_CLIPBOARD
-bool CDlgEventLog::OpenClipboard( wxInt32 size ) {
- bool bRetVal = false;
-
- bRetVal = wxTheClipboard->Open();
- if (bRetVal) {
- m_bClipboardOpen = true;
-
- m_strClipboardData = wxEmptyString;
- m_strClipboardData.Alloc( size );
-
- wxTheClipboard->Clear();
- }
-
- return bRetVal;
-}
-
-
-wxInt32 CDlgEventLog::CopyToClipboard(wxInt32 item) {
- wxInt32 iRetVal = -1;
- wxInt32 index = GetFilteredMessageIndex(item);
-
- if (m_bClipboardOpen) {
- wxString strBuffer = wxEmptyString;
- wxString strTimeStamp = wxEmptyString;
- wxString strProject = wxEmptyString;
- wxString strMessage = wxEmptyString;
-
- FormatTime(index, strTimeStamp);
- FormatProjectName(index, strProject);
- FormatMessage(index, strMessage);
-
-#ifdef __WXMSW__
- strBuffer.Printf(wxT("%s | %s | %s\r\n"), strTimeStamp.c_str(), strProject.c_str(), strMessage.c_str());
-#else
- strBuffer.Printf(wxT("%s | %s | %s\n"), strTimeStamp.c_str(), strProject.c_str(), strMessage.c_str());
-#endif
-
- m_strClipboardData += strBuffer;
-
- iRetVal = 0;
- }
-
- return iRetVal;
-}
-
-
-bool CDlgEventLog::CloseClipboard() {
- bool bRetVal = false;
-
- if (m_bClipboardOpen) {
- wxTheClipboard->SetData(new wxTextDataObject(m_strClipboardData));
- wxTheClipboard->Close();
-
- m_bClipboardOpen = false;
- m_strClipboardData = wxEmptyString;
- }
-
- return bRetVal;
-}
-
-#endif
-
+// This file is part of BOINC.
+// http://boinc.berkeley.edu
+// Copyright (C) 2008 University of California
+//
+// BOINC is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation,
+// either version 3 of the License, or (at your option) any later version.
+//
+// BOINC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with BOINC. If not, see .
+
+#if defined(__GNUG__) && !defined(__APPLE__)
+#pragma implementation "DlgEventLog.h"
+#endif
+
+#include "stdwx.h"
+#include "common_defs.h"
+#include "diagnostics.h"
+#include "str_util.h"
+#include "mfile.h"
+#include "miofile.h"
+#include "parse.h"
+#include "error_numbers.h"
+#include "Events.h"
+#include "BOINCGUIApp.h"
+#include "SkinManager.h"
+#include "MainDocument.h"
+#include "BOINCBaseFrame.h"
+#include "version.h"
+#include "DlgEventLogListCtrl.h"
+#include "DlgEventLog.h"
+#include "AdvancedFrame.h"
+
+
+
+////@begin includes
+////@end includes
+
+////@begin XPM images
+////@end XPM images
+
+
+#define COLUMN_PROJECT 0
+#define COLUMN_TIME 1
+#define COLUMN_MESSAGE 2
+
+
+static bool s_bIsFiltered = false;
+static std::string s_strFilteredProjectName;
+
+/*!
+ * CDlgEventLog type definition
+ */
+
+IMPLEMENT_DYNAMIC_CLASS( CDlgEventLog, wxDialog )
+
+/*!
+ * CDlgEventLog event table definition
+ */
+
+BEGIN_EVENT_TABLE( CDlgEventLog, wxDialog )
+////@begin CDlgEventLog event table entries
+ EVT_HELP(wxID_ANY, CDlgEventLog::OnHelp)
+ EVT_BUTTON(wxID_OK, CDlgEventLog::OnOK)
+ EVT_BUTTON(ID_COPYAll, CDlgEventLog::OnMessagesCopyAll)
+ EVT_BUTTON(ID_COPYSELECTED, CDlgEventLog::OnMessagesCopySelected)
+ EVT_BUTTON(ID_TASK_MESSAGES_FILTERBYPROJECT, CDlgEventLog::OnMessagesFilter)
+ EVT_BUTTON(ID_SIMPLE_HELP, CDlgEventLog::OnButtonHelp)
+ EVT_SIZE(CDlgEventLog::OnSize)
+ EVT_MOVE(CDlgEventLog::OnMove)
+ EVT_CLOSE(CDlgEventLog::OnClose)
+////@end CDlgEventLog event table entries
+END_EVENT_TABLE()
+
+/*!
+ * CDlgEventLog constructors
+ */
+
+CDlgEventLog::CDlgEventLog( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
+{
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::CDlgEventLog - Constructor Function Begin"));
+
+ Create(parent, id, caption, pos, size, style);
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::CDlgEventLog - Constructor Function End"));
+}
+
+
+CDlgEventLog::~CDlgEventLog() {
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::CDlgEventLog - Destructor Function Begin"));
+
+ SaveState();
+ SetWindowDimensions();
+
+ if (m_pMessageInfoAttr) {
+ delete m_pMessageInfoAttr;
+ m_pMessageInfoAttr = NULL;
+ }
+
+ if (m_pMessageErrorAttr) {
+ delete m_pMessageErrorAttr;
+ m_pMessageErrorAttr = NULL;
+ }
+
+ if (m_pMessageInfoGrayAttr) {
+ delete m_pMessageInfoGrayAttr;
+ m_pMessageInfoGrayAttr = NULL;
+ }
+
+ if (m_pMessageErrorGrayAttr) {
+ delete m_pMessageErrorGrayAttr;
+ m_pMessageErrorGrayAttr = NULL;
+ }
+
+ m_iFilteredIndexes.Clear();
+
+ wxGetApp().OnEventLogClose();
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::CDlgEventLog - Destructor Function End"));
+}
+
+
+/*!
+ * CDlgEventLog creator
+ */
+
+bool CDlgEventLog::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
+{
+////@begin CDlgEventLog member initialisation
+ m_iPreviousRowCount = 0;
+ m_iTotalDocCount = 0;
+ m_iPreviousTotalDocCount = 0;
+ if (!s_bIsFiltered) {
+ s_strFilteredProjectName.clear();
+ }
+ m_iFilteredIndexes.Clear();
+ m_bProcessingRefreshEvent = false;
+ m_bEventLogIsOpen = true;
+////@end CDlgEventLog member initialisation
+
+ CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
+ wxPoint oTempPoint;
+ wxSize oTempSize;
+
+ wxASSERT(pSkinAdvanced);
+ wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
+
+ if ((pos == wxDefaultPosition) && (size == wxDefaultSize)) {
+ // Get size and position from the previous configuration
+ GetWindowDimensions( oTempPoint, oTempSize );
+
+#ifdef __WXMSW__
+ // Windows does some crazy things if the initial position is a negative
+ // value.
+ oTempPoint.x = wxDefaultCoord;
+ oTempPoint.y = wxDefaultCoord;
+#endif
+
+#ifdef __WXMAC__
+ // If the user has changed the arrangement of multiple
+ // displays, make sure the window title bar is still on-screen.
+ if (!IsWindowOnScreen(oTempPoint.x, oTempPoint.y, oTempSize.GetWidth(), oTempSize.GetHeight())) {
+ oTempPoint.y = oTempPoint.x = 30;
+ }
+#endif // ! __WXMAC__
+ } else {
+ oTempPoint = pos;
+ oTempSize = size;
+ }
+
+ wxDialog::Create( parent, id, caption, oTempPoint, oTempSize, style );
+
+ SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
+
+ // Initialize Application Title
+ wxString strCaption = caption;
+ if (strCaption.IsEmpty()) {
+ strCaption.Printf(_("%s - Event Log"), pSkinAdvanced->GetApplicationName().c_str());
+ }
+ SetTitle(strCaption);
+
+ // Initialize Application Icon
+ wxIconBundle icons;
+ icons.AddIcon(*pSkinAdvanced->GetApplicationIcon());
+ icons.AddIcon(*pSkinAdvanced->GetApplicationIcon32());
+ SetIcons(icons);
+
+ CreateControls();
+
+ // Create List Pane Items
+ m_pList->InsertColumn(COLUMN_PROJECT, _("Project"), wxLIST_FORMAT_LEFT, 109);
+ m_pList->InsertColumn(COLUMN_TIME, _("Time"), wxLIST_FORMAT_LEFT, 130);
+ m_pList->InsertColumn(COLUMN_MESSAGE, _("Message"), wxLIST_FORMAT_LEFT, 378);
+
+ m_pMessageInfoAttr = new wxListItemAttr(
+ wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
+ wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),
+ wxNullFont
+ );
+ m_pMessageErrorAttr = new wxListItemAttr(
+ *wxRED,
+ wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW),
+ wxNullFont
+ );
+#if EVENT_LOG_STRIPES
+ m_pMessageInfoGrayAttr = new wxListItemAttr(
+ wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT),
+ wxColour(240, 240, 240),
+ wxNullFont
+ );
+ m_pMessageErrorGrayAttr = new wxListItemAttr(*wxRED, wxColour(240, 240, 240), wxNullFont);
+#else
+ m_pMessageInfoGrayAttr = new wxListItemAttr(*m_pMessageInfoAttr);
+ m_pMessageErrorGrayAttr = new wxListItemAttr(*m_pMessageErrorAttr);
+#endif
+
+ SetTextColor();
+ RestoreState();
+
+ return true;
+}
+
+
+/*!
+ * Control creation for CDlgEventLog
+ */
+
+void CDlgEventLog::CreateControls()
+{
+ CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
+
+ wxASSERT(pSkinAdvanced);
+ wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
+
+ wxFlexGridSizer* itemFlexGridSizer2 = new wxFlexGridSizer(2, 1, 0, 0);
+ itemFlexGridSizer2->AddGrowableRow(0);
+ itemFlexGridSizer2->AddGrowableCol(0);
+ SetSizer(itemFlexGridSizer2);
+
+ m_pList = new CDlgEventLogListCtrl(this, ID_SIMPLE_MESSAGESVIEW, EVENT_LOG_DEFAULT_LIST_MULTI_SEL_FLAGS);
+ itemFlexGridSizer2->Add(m_pList, 0, wxGROW|wxALL, 5);
+
+ wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxHORIZONTAL);
+
+ itemFlexGridSizer2->Add(itemBoxSizer4, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 12);
+
+ m_pFilterButton = new wxButton(this, ID_TASK_MESSAGES_FILTERBYPROJECT, _("&Show only this project"), wxDefaultPosition, wxDefaultSize);
+ itemBoxSizer4->Add(m_pFilterButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+#ifdef wxUSE_CLIPBOARD
+ wxButton* itemButton1 = new wxButton(this, ID_COPYAll, _("Copy &All"), wxDefaultPosition, wxDefaultSize );
+ itemButton1->SetHelpText(
+ _("Copy all the messages to the clipboard.")
+ );
+#if wxUSE_TOOLTIPS
+ itemButton1->SetToolTip(
+ _("Copy all the messages to the clipboard.")
+ );
+#endif
+ itemBoxSizer4->Add(itemButton1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+ m_pCopySelectedButton = new wxButton(this, ID_COPYSELECTED, _("Copy &Selected"), wxDefaultPosition, wxDefaultSize );
+ m_pCopySelectedButton->SetHelpText(
+#ifdef __WXMAC__
+ _("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or command key while clicking on messages.")
+#else
+ _("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or control key while clicking on messages.")
+#endif
+ );
+#if wxUSE_TOOLTIPS
+ m_pCopySelectedButton->SetToolTip(
+#ifdef __WXMAC__
+ _("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or command key while clicking on messages.")
+#else
+ _("Copy the selected messages to the clipboard. You can select multiple messages by holding down the shift or control key while clicking on messages.")
+#endif
+ );
+#endif
+ itemBoxSizer4->Add(m_pCopySelectedButton, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+#endif
+
+ wxButton* itemButton44 = new wxButton(this, wxID_OK, _("&Close"), wxDefaultPosition, wxDefaultSize);
+ itemBoxSizer4->Add(itemButton44, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+
+#ifndef __WXMAC__
+ wxContextHelpButton* itemButton45 = new wxContextHelpButton(this);
+ itemBoxSizer4->Add(itemButton45, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+#else
+ wxButton* itemButton45 = new wxButton(this, ID_SIMPLE_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize);
+ wxString helpTip;
+ helpTip.Printf(_("Get help with %s"), pSkinAdvanced->GetApplicationShortName().c_str());
+ itemButton45->SetHelpText(helpTip);
+#ifdef wxUSE_TOOLTIPS
+ itemButton45->SetToolTip(helpTip);
+#endif
+ itemBoxSizer4->Add(itemButton45, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
+#endif
+
+ SetFilterButtonText();
+}
+
+
+void CDlgEventLog::SetFilterButtonText() {
+ if (s_bIsFiltered) {
+ m_pFilterButton->SetLabel( _("Show all &messages") );
+ m_pFilterButton->SetHelpText( _("Show messages for all projects") );
+#ifdef wxUSE_TOOLTIPS
+ m_pFilterButton->SetToolTip(_("Show messages for all projects"));
+#endif
+ } else {
+ m_pFilterButton->SetLabel( _("&Show only this project") );
+ m_pFilterButton->SetHelpText( _("Show only the messages for the selected project") );
+#ifdef wxUSE_TOOLTIPS
+ m_pFilterButton->SetToolTip(_("Show only the messages for the selected project"));
+#endif
+ }
+ // Adjust button size for new text
+ Layout();
+}
+
+
+/*!
+ * Text color selection for CDlgEventLog
+ */
+
+void CDlgEventLog::SetTextColor() {
+ bool isConnected = wxGetApp().GetDocument()->IsConnected();
+
+ if (isConnected) {
+ m_pMessageInfoAttr->SetTextColour(*wxBLACK);
+ m_pMessageErrorAttr->SetTextColour(*wxRED);
+ m_pMessageInfoGrayAttr->SetTextColour(*wxBLACK);
+ m_pMessageErrorGrayAttr->SetTextColour(*wxRED);
+ } else {
+ wxColourDatabase colorBase;
+ m_pMessageInfoAttr->SetTextColour(wxColour(128, 128, 128));
+ m_pMessageErrorAttr->SetTextColour(wxColour(255, 128, 128));
+ m_pMessageInfoGrayAttr->SetTextColour(wxColour(128, 128, 128));
+ m_pMessageErrorGrayAttr->SetTextColour(wxColour(255, 128, 128));
+ }
+}
+
+
+/*!
+ * wxEVT_HELP event handler for ID_DLGMESSAGES
+ */
+
+void CDlgEventLog::OnHelp(wxHelpEvent& event) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnHelp - Function Begin"));
+
+ if (IsShown()) {
+ wxString strURL = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl();
+
+ wxString wxurl;
+ wxurl.Printf(
+ wxT("%s?target=simple_messages&version=%s&controlid=%d"),
+ strURL.c_str(),
+ wxString(BOINC_VERSION_STRING, wxConvUTF8).c_str(),
+ event.GetId()
+ );
+ wxLaunchDefaultBrowser(wxurl);
+ }
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnHelp - Function End"));
+}
+
+
+/*!
+ * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
+ */
+
+void CDlgEventLog::OnOK( wxCommandEvent& WXUNUSED(event) ) {
+ Close();
+}
+
+
+/*!
+ * wxEVT_CLOSE event handler for CDlgEventLog (window close control clicked)
+ */
+
+void CDlgEventLog::OnClose(wxCloseEvent& WXUNUSED(event)) {
+ m_bEventLogIsOpen = false; // User specifically closed window
+ Destroy();
+}
+
+
+void CDlgEventLog::OnMessagesFilter( wxCommandEvent& WXUNUSED(event) ) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnMessagesFilter - Function Begin"));
+
+ wxInt32 iIndex = -1;
+ MESSAGE* message;
+
+ wxASSERT(m_pList);
+
+ m_iFilteredIndexes.Clear();
+ s_strFilteredProjectName.clear();
+
+ if (s_bIsFiltered) {
+ s_bIsFiltered = false;
+ m_iFilteredDocCount = m_iTotalDocCount;
+ } else {
+ iIndex = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ if (iIndex >= 0) {
+ message = wxGetApp().GetDocument()->message(iIndex);
+ if ((message->project).size() > 0) {
+ s_strFilteredProjectName = message->project;
+ s_bIsFiltered = true;
+ for (iIndex = 0; iIndex < m_iTotalDocCount; iIndex++) {
+ message = wxGetApp().GetDocument()->message(iIndex);
+ if (message->project.empty() || (message->project == s_strFilteredProjectName)) {
+ m_iFilteredIndexes.Add(iIndex);
+ }
+
+ }
+ m_iFilteredDocCount = (int)(m_iFilteredIndexes.GetCount());
+ }
+ }
+ }
+
+ SetFilterButtonText();
+
+ // Force a complete update
+ m_iPreviousRowCount = 0;
+ m_pList->DeleteAllItems();
+ m_pList->SetItemCount(m_iFilteredDocCount);
+ OnRefresh();
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnMessagesFilter - Function End"));
+}
+
+
+wxInt32 CDlgEventLog::GetFilteredMessageIndex( wxInt32 iRow) const {
+ if (s_bIsFiltered) return m_iFilteredIndexes[iRow];
+ return iRow;
+}
+
+
+// Get the (possibly filtered) item count (i.e., the Row count)
+wxInt32 CDlgEventLog::GetDocCount() {
+ int i;
+
+ m_iTotalDocCount = wxGetApp().GetDocument()->GetMessageCount();
+ if (m_iTotalDocCount < m_iPreviousTotalDocCount) {
+ // Usually due to a disconnect from client
+ ResetMessageFiltering();
+ }
+
+ if (s_bIsFiltered) {
+ for (i = m_iPreviousTotalDocCount; i < m_iTotalDocCount; i++) {
+ MESSAGE* message = wxGetApp().GetDocument()->message(i);
+ if (message->project.empty() || (message->project == s_strFilteredProjectName)) {
+ m_iFilteredIndexes.Add(i);
+ }
+ }
+ m_iPreviousTotalDocCount = m_iTotalDocCount;
+ m_iFilteredDocCount = (int)(m_iFilteredIndexes.GetCount());
+ return m_iFilteredDocCount;
+ }
+
+ m_iPreviousTotalDocCount = m_iTotalDocCount;
+ m_iFilteredDocCount = m_iTotalDocCount;
+ return m_iTotalDocCount;
+}
+
+
+/*!
+ * called from CMainDocument::HandleCompletedRPC() after wxEVT_RPC_FINISHED event
+ */
+void CDlgEventLog::OnRefresh() {
+ 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 (!IsShown()) return;
+
+ if (!m_bProcessingRefreshEvent) {
+ m_bProcessingRefreshEvent = true;
+
+ wxASSERT(m_pList);
+
+ wxInt32 iRowCount = GetDocCount();
+ if (0 >= iRowCount) {
+ m_pList->DeleteAllItems();
+ ResetMessageFiltering();
+ } else {
+ // If connected computer changed, reset message filtering
+ isConnected = wxGetApp().GetDocument()->IsConnected();
+ if (isConnected) {
+ pDoc->GetConnectedComputerName(strNewMachineName);
+ if (strLastMachineName != strNewMachineName) {
+ strLastMachineName = strNewMachineName;
+ was_connected = false;
+ ResetMessageFiltering();
+ }
+ }
+
+ // If connection status changed, adjust color of messages display
+ if (was_connected != isConnected) {
+ was_connected = isConnected;
+ SetTextColor();
+
+ // Force a complete update
+ m_pList->DeleteAllItems();
+ m_pList->SetItemCount(iRowCount);
+ m_iPreviousRowCount = 0; // Force scrolling to bottom
+
+ } else {
+ // Connection status didn't change
+ if (m_iPreviousRowCount != iRowCount) {
+ m_pList->SetItemCount(iRowCount);
+ }
+ }
+ }
+
+ if ((iRowCount > 1) && (EnsureLastItemVisible()) && (m_iPreviousRowCount != iRowCount)) {
+ m_pList->EnsureVisible(iRowCount - 1);
+ }
+
+ if (m_iPreviousRowCount != iRowCount) {
+ m_iPreviousRowCount = iRowCount;
+ }
+
+ UpdateButtons();
+
+ m_bProcessingRefreshEvent = false;
+ }
+}
+
+
+bool CDlgEventLog::SaveState() {
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::SaveState - Function Begin"));
+
+ wxString strBaseConfigLocation = wxEmptyString;
+ wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
+ wxListItem liColumnInfo;
+ wxInt32 iIndex = 0;
+ wxInt32 iColumnCount = 0;
+
+ wxASSERT(pConfig);
+
+ // An odd case happens every once and awhile where wxWidgets looses
+ // the pointer to the config object, or it is cleaned up before
+ // the window has finished it's cleanup duty. If we detect a NULL
+ // pointer, return false.
+ if (!pConfig) return false;
+
+ strBaseConfigLocation = wxString(wxT("/"));
+ pConfig->SetPath(strBaseConfigLocation);
+ pConfig->Write(wxT("EventLogOpen"), m_bEventLogIsOpen);
+
+ //
+ // Save Frame State
+ //
+ strBaseConfigLocation = wxString(wxT("/EventLog/"));
+ pConfig->SetPath(strBaseConfigLocation);
+
+ // Convert to a zero based index
+ iColumnCount = m_pList->GetColumnCount() - 1;
+
+ // Which fields are we interested in?
+ liColumnInfo.SetMask(
+ wxLIST_MASK_TEXT |
+ wxLIST_MASK_WIDTH |
+ wxLIST_MASK_FORMAT
+ );
+
+ // Cycle through the columns recording anything interesting
+ for (iIndex = 0; iIndex <= iColumnCount; iIndex++) {
+ m_pList->GetColumn(iIndex, liColumnInfo);
+
+ pConfig->SetPath(strBaseConfigLocation + liColumnInfo.GetText());
+ pConfig->Write(wxT("Width"), m_pList->GetColumnWidth(iIndex)); // Work around bug in wxMac-2.8.0 wxListCtrl::SetColumn()
+ }
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::SaveState - Function End"));
+ return true;
+}
+
+
+bool CDlgEventLog::RestoreState() {
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::RestoreState - Function Begin"));
+
+ wxString strBaseConfigLocation = wxString(wxT("/EventLog/"));
+ wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
+ wxListItem liColumnInfo;
+ wxInt32 iIndex = 0;
+ wxInt32 iColumnCount = 0;
+ wxInt32 iTempValue = 0;
+
+ wxASSERT(pConfig);
+
+ // An odd case happens every once and awhile where wxWidgets looses
+ // the pointer to the config object, or it is cleaned up before
+ // the window has finished it's cleanup duty. If we detect a NULL
+ // pointer, return false.
+ if (!pConfig) return false;
+
+ //
+ // Restore Frame State
+ //
+ pConfig->SetPath(strBaseConfigLocation);
+
+ // Convert to a zero based index
+ iColumnCount = m_pList->GetColumnCount() - 1;
+
+ // Which fields are we interested in?
+ liColumnInfo.SetMask(
+ wxLIST_MASK_TEXT |
+ wxLIST_MASK_WIDTH |
+ wxLIST_MASK_FORMAT
+ );
+
+ // Cycle through the columns recording anything interesting
+ for (iIndex = 0; iIndex <= iColumnCount; iIndex++) {
+ m_pList->GetColumn(iIndex, liColumnInfo);
+
+ pConfig->SetPath(strBaseConfigLocation + liColumnInfo.GetText());
+ pConfig->Read(wxT("Width"), &iTempValue, -1);
+ if (-1 != iTempValue) {
+ liColumnInfo.SetWidth(iTempValue);
+#if (defined(__WXMAC__) && wxCHECK_VERSION(2,8,0))
+ m_pList->SetColumnWidth(iIndex,iTempValue); // Work around bug in wxMac-2.8.0 wxListCtrl::SetColumn()
+#endif
+ }
+
+ m_pList->SetColumn(iIndex, liColumnInfo);
+ }
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::RestoreState - Function End"));
+ return true;
+}
+
+
+void CDlgEventLog::GetWindowDimensions( wxPoint& position, wxSize& size ) {
+ wxString strBaseConfigLocation = wxString(wxT("/EventLog/"));
+ wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
+ int iHeight = 0, iWidth = 0, iTop = 0, iLeft = 0;
+
+ wxASSERT(pConfig);
+
+ pConfig->SetPath(strBaseConfigLocation);
+
+ pConfig->Read(wxT("YPos"), &iTop, 30);
+ pConfig->Read(wxT("XPos"), &iLeft, 30);
+ pConfig->Read(wxT("Width"), &iWidth, 640);
+ pConfig->Read(wxT("Height"), &iHeight, 480);
+
+ position.y = iTop;
+ position.x = iLeft;
+ size.x = iWidth;
+ size.y = iHeight;
+}
+
+
+void CDlgEventLog::SetWindowDimensions() {
+ wxString strBaseConfigLocation = wxString(wxT("/EventLog/"));
+ wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
+
+ wxASSERT(pConfig);
+
+ if (!IsIconized()) {
+ pConfig->SetPath(strBaseConfigLocation);
+ pConfig->Write(wxT("XPos"), GetPosition().x);
+ pConfig->Write(wxT("YPos"), GetPosition().y);
+ pConfig->Write(wxT("Width"), GetSize().x);
+ pConfig->Write(wxT("Height"), GetSize().y);
+ }
+}
+
+
+void CDlgEventLog::OnSize(wxSizeEvent& event) {
+ SetWindowDimensions();
+ event.Skip();
+}
+
+
+void CDlgEventLog::OnMove(wxMoveEvent& event) {
+ SetWindowDimensions();
+ event.Skip();
+}
+
+
+/*!
+ * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COPYAll
+ */
+
+void CDlgEventLog::OnMessagesCopyAll( wxCommandEvent& WXUNUSED(event) ) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnMessagesCopyAll - Function Begin"));
+
+#ifdef wxUSE_CLIPBOARD
+ wxInt32 iIndex = -1;
+ wxInt32 iRowCount = 0;
+
+ iRowCount = m_pList->GetItemCount();
+
+ OpenClipboard( iRowCount * 1024 );
+
+ for (iIndex = 0; iIndex < iRowCount; iIndex++) {
+ CopyToClipboard(iIndex);
+ }
+
+ CloseClipboard();
+#endif
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnMessagesCopyAll - Function End"));
+}
+
+
+/*!
+ * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COPYSELECTED
+ */
+
+void CDlgEventLog::OnMessagesCopySelected( wxCommandEvent& WXUNUSED(event) ) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnMessagesCopySelected - Function Begin"));
+
+#ifdef wxUSE_CLIPBOARD
+ wxInt32 iIndex = -1;
+ wxInt32 iRowCount = 0;
+
+ // Count the number of items selected
+ for (;;) {
+ iIndex = m_pList->GetNextItem(
+ iIndex, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED
+ );
+ if (iIndex == -1) break;
+
+ iRowCount++;
+ }
+
+ OpenClipboard( iRowCount * 1024 );
+
+ // Reset the position indicator
+ iIndex = -1;
+
+ for (;;) {
+ iIndex = m_pList->GetNextItem(
+ iIndex, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED
+ );
+ if (iIndex == -1) break;
+
+ CopyToClipboard(iIndex);
+ }
+
+ CloseClipboard();
+#endif
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnMessagesCopySelected - Function End"));
+}
+
+
+/*!
+ * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SIMPLE_HELP
+ */
+
+void CDlgEventLog::OnButtonHelp( wxCommandEvent& event ) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnHelp - Function Begin"));
+
+ if (IsShown()) {
+ wxString strURL = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl();
+
+ wxString wxurl;
+ wxurl.Printf(
+ wxT("%s?target=simple_messages&version=%s&controlid=%d"),
+ strURL.c_str(),
+ wxString(BOINC_VERSION_STRING, wxConvUTF8).c_str(),
+ event.GetId()
+ );
+ wxLaunchDefaultBrowser(wxurl);
+ }
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CDlgEventLog::OnHelp - Function End"));
+}
+
+
+void CDlgEventLog::ResetMessageFiltering() {
+ s_bIsFiltered = false;
+ s_strFilteredProjectName.clear();
+ m_iFilteredIndexes.Clear();
+ SetFilterButtonText();
+}
+
+
+void CDlgEventLog::UpdateButtons() {
+ bool enableFilterButton = s_bIsFiltered;
+ bool enableCopySelectedButon = false;
+ if (m_iTotalDocCount > 0) {
+ int n = m_pList->GetSelectedItemCount();
+ if (n > 0) {
+ enableCopySelectedButon = true;
+ }
+
+ if ((n == 1) && (! s_bIsFiltered)) {
+ n = m_pList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
+ MESSAGE* message = wxGetApp().GetDocument()->message(n);
+ if ((message->project).size() > 0) {
+ enableFilterButton = true;
+ }
+ }
+ }
+ m_pFilterButton->Enable(enableFilterButton);
+ m_pCopySelectedButton->Enable(enableCopySelectedButon);
+}
+
+
+wxString CDlgEventLog::OnListGetItemText(long item, long column) const {
+ wxString strBuffer = wxEmptyString;
+ wxInt32 index = GetFilteredMessageIndex(item);
+
+ switch(column) {
+ case COLUMN_PROJECT:
+ FormatProjectName(index, strBuffer);
+ break;
+ case COLUMN_TIME:
+ FormatTime(index, strBuffer);
+ break;
+ case COLUMN_MESSAGE:
+ FormatMessage(index, strBuffer);
+ break;
+ }
+
+ return strBuffer;
+}
+
+
+wxListItemAttr* CDlgEventLog::OnListGetItemAttr(long item) const {
+ wxListItemAttr* pAttribute = NULL;
+ wxInt32 index = GetFilteredMessageIndex(item);
+ MESSAGE* message = wxGetApp().GetDocument()->message(index);
+
+ // If we are using some theme where the default background color isn't
+ // white, then our whole system is boned. Use defaults instead.
+ if (wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW) != wxColor(wxT("WHITE"))) return NULL;
+
+ if (message) {
+ switch(message->priority) {
+ case MSG_USER_ALERT:
+ pAttribute = item % 2 ? m_pMessageErrorGrayAttr : m_pMessageErrorAttr;
+ break;
+ default:
+ pAttribute = item % 2 ? m_pMessageInfoGrayAttr : m_pMessageInfoAttr;
+ break;
+ }
+ }
+
+ return pAttribute;
+}
+
+
+bool CDlgEventLog::EnsureLastItemVisible() {
+ int numVisible = m_pList->GetCountPerPage();
+
+ // Auto-scroll only if already at bottom of list
+ if ((m_iPreviousRowCount > numVisible)
+ && ((m_pList->GetTopItem() + numVisible) < (m_iPreviousRowCount-1))
+ ) {
+ return false;
+ }
+
+ return true;
+}
+
+
+wxInt32 CDlgEventLog::FormatProjectName(wxInt32 item, wxString& strBuffer) const {
+ MESSAGE* message = wxGetApp().GetDocument()->message(item);
+
+ if (message) {
+ strBuffer = wxString(message->project.c_str(), wxConvUTF8);
+ }
+
+ return 0;
+}
+
+
+wxInt32 CDlgEventLog::FormatTime(wxInt32 item, wxString& strBuffer) const {
+ wxDateTime dtBuffer;
+ MESSAGE* message = wxGetApp().GetDocument()->message(item);
+
+ if (message) {
+ dtBuffer.Set((time_t)message->timestamp);
+ strBuffer = dtBuffer.Format();
+ }
+
+ return 0;
+}
+
+
+wxInt32 CDlgEventLog::FormatMessage(wxInt32 item, wxString& strBuffer) const {
+ MESSAGE* message = wxGetApp().GetDocument()->message(item);
+
+ if (message) {
+ strBuffer = wxString(message->body.c_str(), wxConvUTF8);
+ wxGetApp().GetDocument()->LocalizeNoticeText(strBuffer, false, true);
+ }
+
+ return 0;
+}
+
+
+#ifdef wxUSE_CLIPBOARD
+bool CDlgEventLog::OpenClipboard( wxInt32 size ) {
+ bool bRetVal = false;
+
+ bRetVal = wxTheClipboard->Open();
+ if (bRetVal) {
+ m_bClipboardOpen = true;
+
+ m_strClipboardData = wxEmptyString;
+ m_strClipboardData.Alloc( size );
+
+ wxTheClipboard->Clear();
+ }
+
+ return bRetVal;
+}
+
+
+wxInt32 CDlgEventLog::CopyToClipboard(wxInt32 item) {
+ wxInt32 iRetVal = -1;
+ wxInt32 index = GetFilteredMessageIndex(item);
+
+ if (m_bClipboardOpen) {
+ wxString strBuffer = wxEmptyString;
+ wxString strTimeStamp = wxEmptyString;
+ wxString strProject = wxEmptyString;
+ wxString strMessage = wxEmptyString;
+
+ FormatTime(index, strTimeStamp);
+ FormatProjectName(index, strProject);
+ FormatMessage(index, strMessage);
+
+#ifdef __WXMSW__
+ strBuffer.Printf(wxT("%s | %s | %s\r\n"), strTimeStamp.c_str(), strProject.c_str(), strMessage.c_str());
+#else
+ strBuffer.Printf(wxT("%s | %s | %s\n"), strTimeStamp.c_str(), strProject.c_str(), strMessage.c_str());
+#endif
+
+ m_strClipboardData += strBuffer;
+
+ iRetVal = 0;
+ }
+
+ return iRetVal;
+}
+
+
+bool CDlgEventLog::CloseClipboard() {
+ bool bRetVal = false;
+
+ if (m_bClipboardOpen) {
+ wxTheClipboard->SetData(new wxTextDataObject(m_strClipboardData));
+ wxTheClipboard->Close();
+
+ m_bClipboardOpen = false;
+ m_strClipboardData = wxEmptyString;
+ }
+
+ return bRetVal;
+}
+
+#endif
+
diff --git a/clientgui/DlgEventLog.h b/clientgui/DlgEventLog.h
index f823c1b44b..4d11b39187 100644
--- a/clientgui/DlgEventLog.h
+++ b/clientgui/DlgEventLog.h
@@ -1,191 +1,191 @@
-// This file is part of BOINC.
-// http://boinc.berkeley.edu
-// Copyright (C) 2008 University of California
-//
-// BOINC is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation,
-// either version 3 of the License, or (at your option) any later version.
-//
-// BOINC is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with BOINC. If not, see .
-
-
-#ifndef _DLGEVENTLOG_H_
-#define _DLGEVENTLOG_H_
-
-#if defined(__GNUG__) && !defined(__APPLE__)
-#pragma interface "DlgEventLog.cpp"
-#endif
-
-#define EVENT_LOG_STRIPES 1
-#define EVENT_LOG_RULES 1
-
-#if EVENT_LOG_RULES
-#define EVENT_LOG_DEFAULT_LIST_MULTI_SEL_FLAGS wxLC_REPORT | wxLC_VIRTUAL | wxLC_HRULES
-#else
-#define EVENT_LOG_DEFAULT_LIST_MULTI_SEL_FLAGS wxLC_REPORT | wxLC_VIRTUAL
-#endif
-
-
-/*!
- * Includes
- */
-
-////@begin includes
-////@end includes
-
-/*!
- * Forward declarations
- */
-
-////@begin forward declarations
-class CDlgEventLogListCtrl;
-////@end forward declarations
-
-/*!
- * Control identifiers
- */
-
-////@begin control identifiers
-#define ID_DLGEVENTLOG 30000
-#define SYMBOL_CDLGEVENTLOG_STYLE wxDEFAULT_DIALOG_STYLE|wxDIALOG_NO_PARENT|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER
-#define SYMBOL_CDLGEVENTLOG_TITLE wxT("")
-#define SYMBOL_CDLGEVENTLOG_IDNAME ID_DLGEVENTLOG
-#define SYMBOL_CDLGEVENTLOG_SIZE wxDefaultSize
-#define SYMBOL_CDLGEVENTLOG_POSITION wxDefaultPosition
-#define ID_COPYSELECTED 10001
-#define ID_COPYAll 10002
-////@end control identifiers
-
-/*!
- * Compatibility
- */
-
-#ifndef wxCLOSE_BOX
-#define wxCLOSE_BOX 0x1000
-#endif
-#ifndef wxFIXED_MINSIZE
-#define wxFIXED_MINSIZE 0
-#endif
-
-class CDlgEventLog : public wxDialog
-{
- DECLARE_DYNAMIC_CLASS( CDlgEventLog )
- DECLARE_EVENT_TABLE()
-
-public:
- /// Constructors
- CDlgEventLog( wxWindow* parent = NULL, wxWindowID id = SYMBOL_CDLGEVENTLOG_IDNAME, const wxString& caption = SYMBOL_CDLGEVENTLOG_TITLE, const wxPoint& pos = SYMBOL_CDLGEVENTLOG_POSITION, const wxSize& size = SYMBOL_CDLGEVENTLOG_SIZE, long style = SYMBOL_CDLGEVENTLOG_STYLE );
- ~CDlgEventLog();
-
- /// Creation
- bool Create( wxWindow* parent = NULL, wxWindowID id = SYMBOL_CDLGEVENTLOG_IDNAME, const wxString& caption = SYMBOL_CDLGEVENTLOG_TITLE, const wxPoint& pos = SYMBOL_CDLGEVENTLOG_POSITION, const wxSize& size = SYMBOL_CDLGEVENTLOG_SIZE, long style = SYMBOL_CDLGEVENTLOG_STYLE );
-
- /// Creates the controls and sizers
- void CreateControls();
-
- /// Sets text for m_pFilterButton
- void SetFilterButtonText();
-
- /// Text color selection
- void SetTextColor();
-
-////@begin CDlgEventLog event handler declarations
- /// wxEVT_HELP event handler for ID_DLGEVENTLOG
- void OnHelp( wxHelpEvent& event );
-
- /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
- void OnOK( wxCommandEvent& event );
-
- /// wxEVT_CLOSE event handler for CDlgEventLog (window close control clicked)
- void OnClose(wxCloseEvent& event);
-
- /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COPYAll
- void OnMessagesCopyAll( wxCommandEvent& event );
-
- /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COPYSELECTED
- void OnMessagesCopySelected( wxCommandEvent& event );
-
- /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_TASK_MESSAGES_FILTERBYPROJECT
- void OnMessagesFilter( wxCommandEvent& event );
-
- /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SIMPLE_HELP
- void OnButtonHelp( wxCommandEvent& event );
-
- /// called from CMainDocument::HandleCompletedRPC() after wxEVT_RPC_FINISHED event
- void OnRefresh();
-////@end CDlgEventLog event handler declarations
-
-////@begin CDlgEventLog member function declarations
-////@end CDlgEventLog member function declarations
-
- virtual wxInt32 GetFilteredMessageIndex( wxInt32 iRow) const;
- virtual wxInt32 GetDocCount();
-
- virtual wxString OnListGetItemText( long item, long column ) const;
- virtual wxListItemAttr* OnListGetItemAttr( long item ) const;
-
- bool OnSaveState(wxConfigBase* pConfig);
- bool OnRestoreState(wxConfigBase* pConfig);
-
- void UpdateButtons();
-
-private:
-////@begin CDlgEventLog member variables
-////@end CDlgEventLog member variables
- wxTimer* m_pRefreshTimer;
-
- wxInt32 m_iPreviousDocCount;
-
- CDlgEventLogListCtrl* m_pList;
- wxArrayInt m_iFilteredIndexes;
- wxInt32 m_iTotalDocCount;
- wxInt32 m_iFilteredDocCount;
- wxInt32 m_iPreviousTotalDocCount;
- wxInt32 m_iPreviousRowCount;
- wxButton* m_pFilterButton;
- wxButton* m_pCopySelectedButton;
-
- wxListItemAttr* m_pMessageInfoAttr;
- wxListItemAttr* m_pMessageErrorAttr;
- wxListItemAttr* m_pMessageInfoGrayAttr;
- wxListItemAttr* m_pMessageErrorGrayAttr;
-
- bool m_bProcessingRefreshEvent;
-
- bool m_bEventLogIsOpen;
-
- bool SaveState();
- bool RestoreState();
-
- void GetWindowDimensions( wxPoint& position, wxSize& size );
- void SetWindowDimensions();
- void OnSize(wxSizeEvent& event);
- void OnMove(wxMoveEvent& event);
-
- void OnMouseUp(wxMouseEvent& event);
-
- void ResetMessageFiltering();
-
- bool EnsureLastItemVisible();
- wxInt32 FormatProjectName( wxInt32 item, wxString& strBuffer ) const;
- wxInt32 FormatTime( wxInt32 item, wxString& strBuffer ) const;
- wxInt32 FormatMessage( wxInt32 item, wxString& strBuffer ) const;
-
-#ifdef wxUSE_CLIPBOARD
- bool m_bClipboardOpen;
- wxString m_strClipboardData;
- bool OpenClipboard( wxInt32 size );
- wxInt32 CopyToClipboard( wxInt32 item );
- bool CloseClipboard();
-#endif
-};
-
-
-#endif // end CDlgMessages
+// This file is part of BOINC.
+// http://boinc.berkeley.edu
+// Copyright (C) 2008 University of California
+//
+// BOINC is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation,
+// either version 3 of the License, or (at your option) any later version.
+//
+// BOINC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with BOINC. If not, see .
+
+
+#ifndef _DLGEVENTLOG_H_
+#define _DLGEVENTLOG_H_
+
+#if defined(__GNUG__) && !defined(__APPLE__)
+#pragma interface "DlgEventLog.cpp"
+#endif
+
+#define EVENT_LOG_STRIPES 1
+#define EVENT_LOG_RULES 1
+
+#if EVENT_LOG_RULES
+#define EVENT_LOG_DEFAULT_LIST_MULTI_SEL_FLAGS wxLC_REPORT | wxLC_VIRTUAL | wxLC_HRULES
+#else
+#define EVENT_LOG_DEFAULT_LIST_MULTI_SEL_FLAGS wxLC_REPORT | wxLC_VIRTUAL
+#endif
+
+
+/*!
+ * Includes
+ */
+
+////@begin includes
+////@end includes
+
+/*!
+ * Forward declarations
+ */
+
+////@begin forward declarations
+class CDlgEventLogListCtrl;
+////@end forward declarations
+
+/*!
+ * Control identifiers
+ */
+
+////@begin control identifiers
+#define ID_DLGEVENTLOG 30000
+#define SYMBOL_CDLGEVENTLOG_STYLE wxDEFAULT_DIALOG_STYLE|wxDIALOG_NO_PARENT|wxMINIMIZE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER
+#define SYMBOL_CDLGEVENTLOG_TITLE wxT("")
+#define SYMBOL_CDLGEVENTLOG_IDNAME ID_DLGEVENTLOG
+#define SYMBOL_CDLGEVENTLOG_SIZE wxDefaultSize
+#define SYMBOL_CDLGEVENTLOG_POSITION wxDefaultPosition
+#define ID_COPYSELECTED 10001
+#define ID_COPYAll 10002
+////@end control identifiers
+
+/*!
+ * Compatibility
+ */
+
+#ifndef wxCLOSE_BOX
+#define wxCLOSE_BOX 0x1000
+#endif
+#ifndef wxFIXED_MINSIZE
+#define wxFIXED_MINSIZE 0
+#endif
+
+class CDlgEventLog : public wxDialog
+{
+ DECLARE_DYNAMIC_CLASS( CDlgEventLog )
+ DECLARE_EVENT_TABLE()
+
+public:
+ /// Constructors
+ CDlgEventLog( wxWindow* parent = NULL, wxWindowID id = SYMBOL_CDLGEVENTLOG_IDNAME, const wxString& caption = SYMBOL_CDLGEVENTLOG_TITLE, const wxPoint& pos = SYMBOL_CDLGEVENTLOG_POSITION, const wxSize& size = SYMBOL_CDLGEVENTLOG_SIZE, long style = SYMBOL_CDLGEVENTLOG_STYLE );
+ ~CDlgEventLog();
+
+ /// Creation
+ bool Create( wxWindow* parent = NULL, wxWindowID id = SYMBOL_CDLGEVENTLOG_IDNAME, const wxString& caption = SYMBOL_CDLGEVENTLOG_TITLE, const wxPoint& pos = SYMBOL_CDLGEVENTLOG_POSITION, const wxSize& size = SYMBOL_CDLGEVENTLOG_SIZE, long style = SYMBOL_CDLGEVENTLOG_STYLE );
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+ /// Sets text for m_pFilterButton
+ void SetFilterButtonText();
+
+ /// Text color selection
+ void SetTextColor();
+
+////@begin CDlgEventLog event handler declarations
+ /// wxEVT_HELP event handler for ID_DLGEVENTLOG
+ void OnHelp( wxHelpEvent& event );
+
+ /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
+ void OnOK( wxCommandEvent& event );
+
+ /// wxEVT_CLOSE event handler for CDlgEventLog (window close control clicked)
+ void OnClose(wxCloseEvent& event);
+
+ /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COPYAll
+ void OnMessagesCopyAll( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_COPYSELECTED
+ void OnMessagesCopySelected( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_TASK_MESSAGES_FILTERBYPROJECT
+ void OnMessagesFilter( wxCommandEvent& event );
+
+ /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_SIMPLE_HELP
+ void OnButtonHelp( wxCommandEvent& event );
+
+ /// called from CMainDocument::HandleCompletedRPC() after wxEVT_RPC_FINISHED event
+ void OnRefresh();
+////@end CDlgEventLog event handler declarations
+
+////@begin CDlgEventLog member function declarations
+////@end CDlgEventLog member function declarations
+
+ virtual wxInt32 GetFilteredMessageIndex( wxInt32 iRow) const;
+ virtual wxInt32 GetDocCount();
+
+ virtual wxString OnListGetItemText( long item, long column ) const;
+ virtual wxListItemAttr* OnListGetItemAttr( long item ) const;
+
+ bool OnSaveState(wxConfigBase* pConfig);
+ bool OnRestoreState(wxConfigBase* pConfig);
+
+ void UpdateButtons();
+
+private:
+////@begin CDlgEventLog member variables
+////@end CDlgEventLog member variables
+ wxTimer* m_pRefreshTimer;
+
+ wxInt32 m_iPreviousDocCount;
+
+ CDlgEventLogListCtrl* m_pList;
+ wxArrayInt m_iFilteredIndexes;
+ wxInt32 m_iTotalDocCount;
+ wxInt32 m_iFilteredDocCount;
+ wxInt32 m_iPreviousTotalDocCount;
+ wxInt32 m_iPreviousRowCount;
+ wxButton* m_pFilterButton;
+ wxButton* m_pCopySelectedButton;
+
+ wxListItemAttr* m_pMessageInfoAttr;
+ wxListItemAttr* m_pMessageErrorAttr;
+ wxListItemAttr* m_pMessageInfoGrayAttr;
+ wxListItemAttr* m_pMessageErrorGrayAttr;
+
+ bool m_bProcessingRefreshEvent;
+
+ bool m_bEventLogIsOpen;
+
+ bool SaveState();
+ bool RestoreState();
+
+ void GetWindowDimensions( wxPoint& position, wxSize& size );
+ void SetWindowDimensions();
+ void OnSize(wxSizeEvent& event);
+ void OnMove(wxMoveEvent& event);
+
+ void OnMouseUp(wxMouseEvent& event);
+
+ void ResetMessageFiltering();
+
+ bool EnsureLastItemVisible();
+ wxInt32 FormatProjectName( wxInt32 item, wxString& strBuffer ) const;
+ wxInt32 FormatTime( wxInt32 item, wxString& strBuffer ) const;
+ wxInt32 FormatMessage( wxInt32 item, wxString& strBuffer ) const;
+
+#ifdef wxUSE_CLIPBOARD
+ bool m_bClipboardOpen;
+ wxString m_strClipboardData;
+ bool OpenClipboard( wxInt32 size );
+ wxInt32 CopyToClipboard( wxInt32 item );
+ bool CloseClipboard();
+#endif
+};
+
+
+#endif // end CDlgMessages
diff --git a/clientgui/DlgEventLogListCtrl.cpp b/clientgui/DlgEventLogListCtrl.cpp
index 4501ab8f08..b4de66bbaf 100644
--- a/clientgui/DlgEventLogListCtrl.cpp
+++ b/clientgui/DlgEventLogListCtrl.cpp
@@ -1,95 +1,95 @@
-// This file is part of BOINC.
-// http://boinc.berkeley.edu
-// Copyright (C) 2008 University of California
-//
-// BOINC is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation,
-// either version 3 of the License, or (at your option) any later version.
-//
-// BOINC is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with BOINC. If not, see .
-
-#if defined(__GNUG__) && !defined(__APPLE__)
-#pragma implementation "DlgEventLogListCtrl.h"
-#endif
-
-#include "stdwx.h"
-#include "diagnostics.h"
-#include "util.h"
-#include "mfile.h"
-#include "miofile.h"
-#include "parse.h"
-#include "error_numbers.h"
-#include "BOINCGUIApp.h"
-#include "SkinManager.h"
-#include "MainDocument.h"
-#include "DlgEventLogListCtrl.h"
-#include "DlgEventLog.h"
-
-
-IMPLEMENT_DYNAMIC_CLASS(CDlgEventLogListCtrl, DLG_LISTCTRL_BASE)
-
-BEGIN_EVENT_TABLE(CDlgEventLogListCtrl, DLG_LISTCTRL_BASE)
- EVT_LEFT_UP(CDlgEventLogListCtrl::OnMouseUp)
-END_EVENT_TABLE()
-
-
-CDlgEventLogListCtrl::CDlgEventLogListCtrl() {}
-
-CDlgEventLogListCtrl::CDlgEventLogListCtrl(CDlgEventLog* pView, wxWindowID iListWindowID, wxInt32 iListWindowFlags)
- : DLG_LISTCTRL_BASE(pView, iListWindowID, wxDefaultPosition, wxDefaultSize, iListWindowFlags)
-{
- m_pParentView = pView;
-
- m_bIsSingleSelection = (iListWindowFlags & wxLC_SINGLE_SEL) ? true : false ;
-
-#ifdef __WXMAC__
- SetupMacAccessibilitySupport();
-#endif
-}
-
-
-#ifdef __WXMAC__
-CDlgEventLogListCtrl::~CDlgEventLogListCtrl()
-{
- RemoveMacAccessibilitySupport();
-}
-#endif
-
-
-wxString CDlgEventLogListCtrl::OnGetItemText(long item, long column) const {
- wxASSERT(m_pParentView);
- wxASSERT(wxDynamicCast(m_pParentView, CDlgEventLog));
-
- return m_pParentView->OnListGetItemText(item, column);
-}
-
-
-int CDlgEventLogListCtrl::OnGetItemImage(long /* item */) const {
- return 1;
-}
-
-
-wxListItemAttr* CDlgEventLogListCtrl::OnGetItemAttr(long item) const {
- wxASSERT(m_pParentView);
- wxASSERT(wxDynamicCast(m_pParentView, CDlgEventLog));
-
- return m_pParentView->OnListGetItemAttr(item);
-}
-
-
-wxColour CDlgEventLogListCtrl::GetBackgroundColour() {
- return *wxWHITE;
-}
-
-
-void CDlgEventLogListCtrl::OnMouseUp(wxMouseEvent& event) {
- m_pParentView->UpdateButtons();
- event.Skip();
-}
+// This file is part of BOINC.
+// http://boinc.berkeley.edu
+// Copyright (C) 2008 University of California
+//
+// BOINC is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation,
+// either version 3 of the License, or (at your option) any later version.
+//
+// BOINC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with BOINC. If not, see .
+
+#if defined(__GNUG__) && !defined(__APPLE__)
+#pragma implementation "DlgEventLogListCtrl.h"
+#endif
+
+#include "stdwx.h"
+#include "diagnostics.h"
+#include "util.h"
+#include "mfile.h"
+#include "miofile.h"
+#include "parse.h"
+#include "error_numbers.h"
+#include "BOINCGUIApp.h"
+#include "SkinManager.h"
+#include "MainDocument.h"
+#include "DlgEventLogListCtrl.h"
+#include "DlgEventLog.h"
+
+
+IMPLEMENT_DYNAMIC_CLASS(CDlgEventLogListCtrl, DLG_LISTCTRL_BASE)
+
+BEGIN_EVENT_TABLE(CDlgEventLogListCtrl, DLG_LISTCTRL_BASE)
+ EVT_LEFT_UP(CDlgEventLogListCtrl::OnMouseUp)
+END_EVENT_TABLE()
+
+
+CDlgEventLogListCtrl::CDlgEventLogListCtrl() {}
+
+CDlgEventLogListCtrl::CDlgEventLogListCtrl(CDlgEventLog* pView, wxWindowID iListWindowID, wxInt32 iListWindowFlags)
+ : DLG_LISTCTRL_BASE(pView, iListWindowID, wxDefaultPosition, wxDefaultSize, iListWindowFlags)
+{
+ m_pParentView = pView;
+
+ m_bIsSingleSelection = (iListWindowFlags & wxLC_SINGLE_SEL) ? true : false ;
+
+#ifdef __WXMAC__
+ SetupMacAccessibilitySupport();
+#endif
+}
+
+
+#ifdef __WXMAC__
+CDlgEventLogListCtrl::~CDlgEventLogListCtrl()
+{
+ RemoveMacAccessibilitySupport();
+}
+#endif
+
+
+wxString CDlgEventLogListCtrl::OnGetItemText(long item, long column) const {
+ wxASSERT(m_pParentView);
+ wxASSERT(wxDynamicCast(m_pParentView, CDlgEventLog));
+
+ return m_pParentView->OnListGetItemText(item, column);
+}
+
+
+int CDlgEventLogListCtrl::OnGetItemImage(long /* item */) const {
+ return 1;
+}
+
+
+wxListItemAttr* CDlgEventLogListCtrl::OnGetItemAttr(long item) const {
+ wxASSERT(m_pParentView);
+ wxASSERT(wxDynamicCast(m_pParentView, CDlgEventLog));
+
+ return m_pParentView->OnListGetItemAttr(item);
+}
+
+
+wxColour CDlgEventLogListCtrl::GetBackgroundColour() {
+ return *wxWHITE;
+}
+
+
+void CDlgEventLogListCtrl::OnMouseUp(wxMouseEvent& event) {
+ m_pParentView->UpdateButtons();
+ event.Skip();
+}
diff --git a/clientgui/DlgEventLogListCtrl.h b/clientgui/DlgEventLogListCtrl.h
index 25fa4d40d1..f2590bb7d6 100644
--- a/clientgui/DlgEventLogListCtrl.h
+++ b/clientgui/DlgEventLogListCtrl.h
@@ -1,71 +1,71 @@
-// This file is part of BOINC.
-// http://boinc.berkeley.edu
-// Copyright (C) 2008 University of California
-//
-// BOINC is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation,
-// either version 3 of the License, or (at your option) any later version.
-//
-// BOINC is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with BOINC. If not, see .
-
-#ifndef _DLGEVENTLOGLISTCTRL_H_
-#define _DLGEVENTLOGLISTCTRL_H_
-
-#if defined(__GNUG__) && !defined(__APPLE__)
-#pragma interface "DlgEventLogListCtrl.cpp"
-#endif
-
-#ifdef __WXMAC__
-#include "macAccessiblity.h"
-#define DLG_LISTCTRL_BASE wxGenericListCtrl
-#else
-#define DLG_LISTCTRL_BASE wxListView
-
-#endif
-
-class CDlgEventLog;
-
-class CDlgEventLogListCtrl : public DLG_LISTCTRL_BASE
-{
- DECLARE_DYNAMIC_CLASS(CDlgEventLogListCtrl)
- DECLARE_EVENT_TABLE()
-
-public:
- CDlgEventLogListCtrl();
- CDlgEventLogListCtrl(CDlgEventLog* pView, wxWindowID iListWindowID, int iListWindowFlags);
-
-#ifdef __WXMAC__
- ~CDlgEventLogListCtrl();
-#endif
-
-private:
-
- virtual wxString OnGetItemText(long item, long column) const;
- virtual int OnGetItemImage(long item) const;
- virtual wxListItemAttr* OnGetItemAttr(long item) const;
- virtual wxColour GetBackgroundColour();
- void OnMouseUp(wxMouseEvent& event);
-
- bool m_bIsSingleSelection;
-
- CDlgEventLog* m_pParentView;
-
-#ifdef __WXMAC__
- void SetupMacAccessibilitySupport();
- void RemoveMacAccessibilitySupport();
-
- ListAccessData accessibilityHandlerData;
-
- EventHandlerRef m_pHeaderAccessibilityEventHandlerRef;
- EventHandlerRef m_pBodyAccessibilityEventHandlerRef;
-#endif
-};
-
-#endif
+// This file is part of BOINC.
+// http://boinc.berkeley.edu
+// Copyright (C) 2008 University of California
+//
+// BOINC is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation,
+// either version 3 of the License, or (at your option) any later version.
+//
+// BOINC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with BOINC. If not, see .
+
+#ifndef _DLGEVENTLOGLISTCTRL_H_
+#define _DLGEVENTLOGLISTCTRL_H_
+
+#if defined(__GNUG__) && !defined(__APPLE__)
+#pragma interface "DlgEventLogListCtrl.cpp"
+#endif
+
+#ifdef __WXMAC__
+#include "macAccessiblity.h"
+#define DLG_LISTCTRL_BASE wxGenericListCtrl
+#else
+#define DLG_LISTCTRL_BASE wxListView
+
+#endif
+
+class CDlgEventLog;
+
+class CDlgEventLogListCtrl : public DLG_LISTCTRL_BASE
+{
+ DECLARE_DYNAMIC_CLASS(CDlgEventLogListCtrl)
+ DECLARE_EVENT_TABLE()
+
+public:
+ CDlgEventLogListCtrl();
+ CDlgEventLogListCtrl(CDlgEventLog* pView, wxWindowID iListWindowID, int iListWindowFlags);
+
+#ifdef __WXMAC__
+ ~CDlgEventLogListCtrl();
+#endif
+
+private:
+
+ virtual wxString OnGetItemText(long item, long column) const;
+ virtual int OnGetItemImage(long item) const;
+ virtual wxListItemAttr* OnGetItemAttr(long item) const;
+ virtual wxColour GetBackgroundColour();
+ void OnMouseUp(wxMouseEvent& event);
+
+ bool m_bIsSingleSelection;
+
+ CDlgEventLog* m_pParentView;
+
+#ifdef __WXMAC__
+ void SetupMacAccessibilitySupport();
+ void RemoveMacAccessibilitySupport();
+
+ ListAccessData accessibilityHandlerData;
+
+ EventHandlerRef m_pHeaderAccessibilityEventHandlerRef;
+ EventHandlerRef m_pBodyAccessibilityEventHandlerRef;
+#endif
+};
+
+#endif
diff --git a/clientgui/DlgExitMessage.h b/clientgui/DlgExitMessage.h
index a129e64d5d..b8e054247d 100644
--- a/clientgui/DlgExitMessage.h
+++ b/clientgui/DlgExitMessage.h
@@ -1,114 +1,114 @@
-// This file is part of BOINC.
-// http://boinc.berkeley.edu
-// Copyright (C) 2008 University of California
-//
-// BOINC is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation,
-// either version 3 of the License, or (at your option) any later version.
-//
-// BOINC is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with BOINC. If not, see .
-//
-
-#ifndef _DLGEXITMESSAGE_H_
-#define _DLGEXITMESSAGE_H_
-
-#if defined(__GNUG__) && !defined(__APPLE__)
-#pragma interface "DlgExitMessage.cpp"
-#endif
-
-/*!
- * Includes
- */
-
-////@begin includes
-////@end includes
-
-/*!
- * Forward declarations
- */
-
-////@begin forward declarations
-////@end forward declarations
-
-/*!
- * Control identifiers
- */
-
-////@begin control identifiers
-#define ID_DIALOG 10000
-#ifdef __WXMAC__
-#define SYMBOL_CDLGEXITMESSAGE_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX
-#else
-#define SYMBOL_CDLGEXITMESSAGE_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
-#endif
-#define SYMBOL_CDLGEXITMESSAGE_TITLE _T("")
-#define SYMBOL_CDLGEXITMESSAGE_IDNAME ID_DIALOG
-#define SYMBOL_CDLGEXITMESSAGE_SIZE wxSize(400, 300)
-#define SYMBOL_CDLGEXITMESSAGE_POSITION wxDefaultPosition
-#define ID_CDLGEXITMESSAGE_SHUTDOWNCORECLIENT 10017
-#define ID_CDLGEXITMESSAGE_DISPLAY 10018
-////@end control identifiers
-
-/*!
- * Compatibility
- */
-
-#ifndef wxCLOSE_BOX
-#define wxCLOSE_BOX 0x1000
-#endif
-#ifndef wxFIXED_MINSIZE
-#define wxFIXED_MINSIZE 0
-#endif
-
-/*!
- * CDlgExitMessage class declaration
- */
-
-class CDlgExitMessage: public wxDialog
-{
- DECLARE_DYNAMIC_CLASS( CDlgExitMessage )
- DECLARE_EVENT_TABLE()
-
-public:
- /// Constructors
- CDlgExitMessage( );
- CDlgExitMessage( wxWindow* parent, wxWindowID id = SYMBOL_CDLGEXITMESSAGE_IDNAME, const wxString& caption = SYMBOL_CDLGEXITMESSAGE_TITLE, const wxPoint& pos = SYMBOL_CDLGEXITMESSAGE_POSITION, const wxSize& size = SYMBOL_CDLGEXITMESSAGE_SIZE, long style = SYMBOL_CDLGEXITMESSAGE_STYLE );
-
- /// Creation
- bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CDLGEXITMESSAGE_IDNAME, const wxString& caption = SYMBOL_CDLGEXITMESSAGE_TITLE, const wxPoint& pos = SYMBOL_CDLGEXITMESSAGE_POSITION, const wxSize& size = SYMBOL_CDLGEXITMESSAGE_SIZE, long style = SYMBOL_CDLGEXITMESSAGE_STYLE );
-
- /// Creates the controls and sizers
- void CreateControls();
-
-////@begin CDlgExitMessage event handler declarations
-
-////@end CDlgExitMessage event handler declarations
-
-////@begin CDlgExitMessage member function declarations
-
- /// Retrieves bitmap resources
- wxBitmap GetBitmapResource( const wxString& name );
-
- /// Retrieves icon resources
- wxIcon GetIconResource( const wxString& name );
-////@end CDlgExitMessage member function declarations
-
- /// Should we show tooltips?
- static bool ShowToolTips();
-
-////@begin CDlgExitMessage member variables
- wxStaticText* m_DialogExitMessage;
- wxCheckBox* m_DialogShutdownCoreClient;
- wxCheckBox* m_DialogDisplay;
-////@end CDlgExitMessage member variables
-};
-
-#endif
- // _DLGEXITMESSAGE_H_
+// This file is part of BOINC.
+// http://boinc.berkeley.edu
+// Copyright (C) 2008 University of California
+//
+// BOINC is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation,
+// either version 3 of the License, or (at your option) any later version.
+//
+// BOINC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with BOINC. If not, see .
+//
+
+#ifndef _DLGEXITMESSAGE_H_
+#define _DLGEXITMESSAGE_H_
+
+#if defined(__GNUG__) && !defined(__APPLE__)
+#pragma interface "DlgExitMessage.cpp"
+#endif
+
+/*!
+ * Includes
+ */
+
+////@begin includes
+////@end includes
+
+/*!
+ * Forward declarations
+ */
+
+////@begin forward declarations
+////@end forward declarations
+
+/*!
+ * Control identifiers
+ */
+
+////@begin control identifiers
+#define ID_DIALOG 10000
+#ifdef __WXMAC__
+#define SYMBOL_CDLGEXITMESSAGE_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX
+#else
+#define SYMBOL_CDLGEXITMESSAGE_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX
+#endif
+#define SYMBOL_CDLGEXITMESSAGE_TITLE _T("")
+#define SYMBOL_CDLGEXITMESSAGE_IDNAME ID_DIALOG
+#define SYMBOL_CDLGEXITMESSAGE_SIZE wxSize(400, 300)
+#define SYMBOL_CDLGEXITMESSAGE_POSITION wxDefaultPosition
+#define ID_CDLGEXITMESSAGE_SHUTDOWNCORECLIENT 10017
+#define ID_CDLGEXITMESSAGE_DISPLAY 10018
+////@end control identifiers
+
+/*!
+ * Compatibility
+ */
+
+#ifndef wxCLOSE_BOX
+#define wxCLOSE_BOX 0x1000
+#endif
+#ifndef wxFIXED_MINSIZE
+#define wxFIXED_MINSIZE 0
+#endif
+
+/*!
+ * CDlgExitMessage class declaration
+ */
+
+class CDlgExitMessage: public wxDialog
+{
+ DECLARE_DYNAMIC_CLASS( CDlgExitMessage )
+ DECLARE_EVENT_TABLE()
+
+public:
+ /// Constructors
+ CDlgExitMessage( );
+ CDlgExitMessage( wxWindow* parent, wxWindowID id = SYMBOL_CDLGEXITMESSAGE_IDNAME, const wxString& caption = SYMBOL_CDLGEXITMESSAGE_TITLE, const wxPoint& pos = SYMBOL_CDLGEXITMESSAGE_POSITION, const wxSize& size = SYMBOL_CDLGEXITMESSAGE_SIZE, long style = SYMBOL_CDLGEXITMESSAGE_STYLE );
+
+ /// Creation
+ bool Create( wxWindow* parent, wxWindowID id = SYMBOL_CDLGEXITMESSAGE_IDNAME, const wxString& caption = SYMBOL_CDLGEXITMESSAGE_TITLE, const wxPoint& pos = SYMBOL_CDLGEXITMESSAGE_POSITION, const wxSize& size = SYMBOL_CDLGEXITMESSAGE_SIZE, long style = SYMBOL_CDLGEXITMESSAGE_STYLE );
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+////@begin CDlgExitMessage event handler declarations
+
+////@end CDlgExitMessage event handler declarations
+
+////@begin CDlgExitMessage member function declarations
+
+ /// Retrieves bitmap resources
+ wxBitmap GetBitmapResource( const wxString& name );
+
+ /// Retrieves icon resources
+ wxIcon GetIconResource( const wxString& name );
+////@end CDlgExitMessage member function declarations
+
+ /// Should we show tooltips?
+ static bool ShowToolTips();
+
+////@begin CDlgExitMessage member variables
+ wxStaticText* m_DialogExitMessage;
+ wxCheckBox* m_DialogShutdownCoreClient;
+ wxCheckBox* m_DialogDisplay;
+////@end CDlgExitMessage member variables
+};
+
+#endif
+ // _DLGEXITMESSAGE_H_
diff --git a/clientgui/DlgItemProperties.h b/clientgui/DlgItemProperties.h
index 983458dc18..cd4152ea51 100644
--- a/clientgui/DlgItemProperties.h
+++ b/clientgui/DlgItemProperties.h
@@ -1,70 +1,70 @@
-// This file is part of BOINC.
-// http://boinc.berkeley.edu
-// Copyright (C) 2008 University of California
-//
-// BOINC is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation,
-// either version 3 of the License, or (at your option) any later version.
-//
-// BOINC is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with BOINC. If not, see .
-//
-#ifndef _DLGITEMPROPERTIES_H_
-#define _DLGITEMPROPERTIES_H_
-
-#if defined(__GNUG__) && !defined(__APPLE__)
-#pragma interface "DlgItemProperties.cpp"
-#endif
-
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "MainDocument.h"
-
-class CDlgItemProperties : public wxDialog {
- DECLARE_DYNAMIC_CLASS( CDlgItemProperties )
- DECLARE_EVENT_TABLE()
-public:
- CDlgItemProperties(wxWindow* parent=NULL);//to act as standard constructor set a default value
- virtual ~CDlgItemProperties();
- //
- void renderInfos(PROJECT* project);
- void renderInfos(RESULT* result);
- void show_rsc(wxString rsc_name, RSC_DESC rsc_desc);
-private:
- int m_current_row;
- //formatting methods
- wxString FormatDiskSpace(double bytes);
- wxString FormatApplicationName(RESULT* result );
- wxString FormatTime(float fBuffer);
- //generic layout methods
- bool SaveState();
- bool RestoreState();
- void addSection(const wxString& title);
- void addProperty(const wxString& name, const wxString& value);
-protected:
- wxBoxSizer* m_bSizer1;
- wxScrolledWindow* m_scrolledWindow;
- wxGridBagSizer* m_gbSizer;
- wxButton* m_btnClose;
- wxString m_strBaseConfigLocation;
-};
-
-#endif // _DLGITEMPROPERTIES_H_
-
+// This file is part of BOINC.
+// http://boinc.berkeley.edu
+// Copyright (C) 2008 University of California
+//
+// BOINC is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation,
+// either version 3 of the License, or (at your option) any later version.
+//
+// BOINC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with BOINC. If not, see .
+//
+#ifndef _DLGITEMPROPERTIES_H_
+#define _DLGITEMPROPERTIES_H_
+
+#if defined(__GNUG__) && !defined(__APPLE__)
+#pragma interface "DlgItemProperties.cpp"
+#endif
+
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "MainDocument.h"
+
+class CDlgItemProperties : public wxDialog {
+ DECLARE_DYNAMIC_CLASS( CDlgItemProperties )
+ DECLARE_EVENT_TABLE()
+public:
+ CDlgItemProperties(wxWindow* parent=NULL);//to act as standard constructor set a default value
+ virtual ~CDlgItemProperties();
+ //
+ void renderInfos(PROJECT* project);
+ void renderInfos(RESULT* result);
+ void show_rsc(wxString rsc_name, RSC_DESC rsc_desc);
+private:
+ int m_current_row;
+ //formatting methods
+ wxString FormatDiskSpace(double bytes);
+ wxString FormatApplicationName(RESULT* result );
+ wxString FormatTime(float fBuffer);
+ //generic layout methods
+ bool SaveState();
+ bool RestoreState();
+ void addSection(const wxString& title);
+ void addProperty(const wxString& name, const wxString& value);
+protected:
+ wxBoxSizer* m_bSizer1;
+ wxScrolledWindow* m_scrolledWindow;
+ wxGridBagSizer* m_gbSizer;
+ wxButton* m_btnClose;
+ wxString m_strBaseConfigLocation;
+};
+
+#endif // _DLGITEMPROPERTIES_H_
+
diff --git a/clientgui/TermsOfUsePage.cpp b/clientgui/TermsOfUsePage.cpp
index 0a1a134531..962d596023 100644
--- a/clientgui/TermsOfUsePage.cpp
+++ b/clientgui/TermsOfUsePage.cpp
@@ -1,306 +1,306 @@
-// This file is part of BOINC.
-// http://boinc.berkeley.edu
-// Copyright (C) 2008 University of California
-//
-// BOINC is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation,
-// either version 3 of the License, or (at your option) any later version.
-//
-// BOINC is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with BOINC. If not, see .
-//
-#if defined(__GNUG__) && !defined(__APPLE__)
-#pragma implementation "TermsOfUsePage.h"
-#endif
-
-#include "stdwx.h"
-#include "diagnostics.h"
-#include "util.h"
-#include "mfile.h"
-#include "miofile.h"
-#include "parse.h"
-#include "error_numbers.h"
-#include "wizardex.h"
-#include "error_numbers.h"
-#include "BOINCGUIApp.h"
-#include "SkinManager.h"
-#include "MainDocument.h"
-#include "BOINCBaseWizard.h"
-#include "WizardAttach.h"
-#include "TermsOfUsePage.h"
-
-
-/*!
- * CTermsOfUsePage type definition
- */
-
-IMPLEMENT_DYNAMIC_CLASS( CTermsOfUsePage, wxWizardPageEx )
-
-/*!
- * CTermsOfUsePage event table definition
- */
-
-BEGIN_EVENT_TABLE( CTermsOfUsePage, wxWizardPageEx )
-
-////@begin CTermsOfUsePage event table entries
- EVT_WIZARDEX_PAGE_CHANGED( -1, CTermsOfUsePage::OnPageChanged )
- EVT_WIZARDEX_PAGE_CHANGING( -1, CTermsOfUsePage::OnPageChanging )
- EVT_WIZARDEX_CANCEL( -1, CTermsOfUsePage::OnCancel )
- EVT_RADIOBUTTON( ID_TERMSOFUSEAGREECTRL, CTermsOfUsePage::OnTermsOfUseStatusChange )
- EVT_RADIOBUTTON( ID_TERMSOFUSEDISAGREECTRL, CTermsOfUsePage::OnTermsOfUseStatusChange )
-////@end CTermsOfUsePage event table entries
-
-END_EVENT_TABLE()
-
-/*!
- * CTermsOfUsePage constructors
- */
-
-CTermsOfUsePage::CTermsOfUsePage( )
-{
-}
-
-CTermsOfUsePage::CTermsOfUsePage( CBOINCBaseWizard* parent )
-{
- Create( parent );
-}
-
-/*!
- * CTermsOfUsePage creator
- */
-
-bool CTermsOfUsePage::Create( CBOINCBaseWizard* parent )
-{
-////@begin CTermsOfUsePage member initialisation
- m_pTitleStaticCtrl = NULL;
- m_pDirectionsStaticCtrl = NULL;
- m_pTermsOfUseCtrl = NULL;
- m_pAgreeCtrl = NULL;
- m_pDisagreeCtrl = NULL;
-////@end CTermsOfUsePage member initialisation
- m_bUserAgrees = false;
- m_bCredentialsAlreadyAvailable = false;
-
-////@begin CTermsOfUsePage creation
- wxWizardPageEx::Create( parent, ID_TERMSOFUSEPAGE );
-
- CreateControls();
- GetSizer()->Fit(this);
-////@end CTermsOfUsePage creation
-
- return TRUE;
-}
-
-/*!
- * Control creation for CTermsOfUsePage
- */
-
-void CTermsOfUsePage::CreateControls()
-{
-////@begin CTermsOfUsePage content construction
- CTermsOfUsePage* itemWizardPage96 = this;
-
- wxBoxSizer* itemBoxSizer97 = new wxBoxSizer(wxVERTICAL);
- itemWizardPage96->SetSizer(itemBoxSizer97);
-
- m_pTitleStaticCtrl = new wxStaticText;
- m_pTitleStaticCtrl->Create( itemWizardPage96, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
- m_pTitleStaticCtrl->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE, _T("Verdana")));
- itemBoxSizer97->Add(m_pTitleStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
-
- itemBoxSizer97->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
-
- m_pDirectionsStaticCtrl = new wxStaticText;
- m_pDirectionsStaticCtrl->Create( itemWizardPage96, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
- itemBoxSizer97->Add(m_pDirectionsStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
-
- m_pTermsOfUseCtrl = new wxTextCtrl;
- m_pTermsOfUseCtrl->Create( itemWizardPage96, ID_TERMSOFUSECTRL, wxEmptyString, wxDefaultPosition, wxSize(300, 125), wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH );
- itemBoxSizer97->Add(m_pTermsOfUseCtrl, 0, wxGROW|wxALL, 5);
-
- m_pAgreeCtrl = new wxRadioButton;
- m_pAgreeCtrl->Create( itemWizardPage96, ID_TERMSOFUSEAGREECTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
- m_pAgreeCtrl->SetValue(false);
- itemBoxSizer97->Add(m_pAgreeCtrl, 0, wxALIGN_LEFT|wxALL, 5);
-
- m_pDisagreeCtrl = new wxRadioButton;
- m_pDisagreeCtrl->Create( itemWizardPage96, ID_TERMSOFUSEDISAGREECTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
- m_pDisagreeCtrl->SetValue(true);
- itemBoxSizer97->Add(m_pDisagreeCtrl, 0, wxALIGN_LEFT|wxALL, 5);
-
-////@end CTermsOfUsePage content construction
-}
-
-/*!
- * Gets the previous page.
- */
-
-wxWizardPageEx* CTermsOfUsePage::GetPrev() const
-{
- return PAGE_TRANSITION_BACK;
-}
-
-/*!
- * Gets the next page.
- */
-
-wxWizardPageEx* CTermsOfUsePage::GetNext() const
-{
- if (CHECK_CLOSINGINPROGRESS()) {
- // Cancel Event Detected
- return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE);
- } else if (IS_ATTACHTOPROJECTWIZARD() && GetUserAgrees() && GetCredentialsAlreadyAvailable()) {
- return PAGE_TRANSITION_NEXT(ID_PROJECTPROCESSINGPAGE);
- } else if (IS_ACCOUNTMANAGERWIZARD() && GetUserAgrees() && GetCredentialsAlreadyAvailable()) {
- return PAGE_TRANSITION_NEXT(ID_ACCOUNTMANAGERPROCESSINGPAGE);
- } else if (GetUserAgrees()) {
- return PAGE_TRANSITION_NEXT(ID_ACCOUNTINFOPAGE);
- } else {
- return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE);
- }
- return NULL;
-}
-
-/*!
- * Should we show tooltips?
- */
-
-bool CTermsOfUsePage::ShowToolTips()
-{
- return TRUE;
-}
-
-/*!
- * Get bitmap resources
- */
-
-wxBitmap CTermsOfUsePage::GetBitmapResource( const wxString& WXUNUSED(name) )
-{
- // Bitmap retrieval
-
-////@begin CTermsOfUsePage bitmap retrieval
- return wxNullBitmap;
-////@end CTermsOfUsePage bitmap retrieval
-}
-
-/*!
- * Get icon resources
- */
-
-wxIcon CTermsOfUsePage::GetIconResource( const wxString& WXUNUSED(name) )
-{
- // Icon retrieval
-
-////@begin CTermsOfUsePage icon retrieval
- return wxNullIcon;
-////@end CTermsOfUsePage icon retrieval
-}
-
-/*!
- * wxEVT_WIZARD_PAGE_CHANGED event handler for ID_TERMSOFUSEPAGE
- */
-
-void CTermsOfUsePage::OnPageChanged( wxWizardExEvent& event ) {
- if (event.GetDirection() == false) return;
-
- PROJECT_CONFIG& pc = ((CWizardAttach*)GetParent())->project_config;
-
- wxASSERT(m_pTitleStaticCtrl);
- wxASSERT(m_pDirectionsStaticCtrl);
-
- m_pTitleStaticCtrl->SetLabel(
- _("Terms of Use")
- );
-
- m_pDirectionsStaticCtrl->SetLabel(
- _("Please read the following terms of use:")
- );
-
- m_pTermsOfUseCtrl->SetValue(
- wxString(pc.terms_of_use.c_str(), wxConvUTF8)
- );
- m_pTermsOfUseCtrl->SetSelection(0,0);
-
- m_pAgreeCtrl->SetLabel(
- _("I agree to the terms of use.")
- );
- m_pAgreeCtrl->SetValue(false);
-
-
- m_pDisagreeCtrl->SetLabel(
- _("I do not agree with the terms of use.")
- );
- m_pDisagreeCtrl->SetValue(true);
-
- SetUserAgrees(false);
- ((CWizardAttach*)GetParent())->DisableNextButton();
-
-
- Fit();
-}
-
-/*!
- * wxEVT_WIZARD_PAGE_CHANGING event handler for ID_TERMSOFUSEPAGE
- */
-
-void CTermsOfUsePage::OnPageChanging( wxWizardExEvent& event ) {
- CWizardAttach* pWA = ((CWizardAttach*)GetParent());
-
- wxASSERT(pWA);
- wxASSERT(wxDynamicCast(pWA, CWizardAttach));
-
- // If the user has left the terms of use disagree radio button
- // selected, then the next button is disabled and needs to be
- // re-enabled if the back button is pressed.
- pWA->EnableNextButton();
-
- if (event.GetDirection() == false) return;
-
- if (!CHECK_CLOSINGINPROGRESS()) {
- // We are leaving this page.
-
- // Determine if the account settings are already pre-populated.
- // If so, advance to the Account Manager Processing page or the
- // Project Processing page.
- if ( pWA->m_bCredentialsCached || pWA->m_bCredentialsDetected) {
- SetCredentialsAlreadyAvailable(true);
- } else {
- SetCredentialsAlreadyAvailable(false);
- }
- }
-}
-
-/*!
- * wxEVT_WIZARD_CANCEL event handler for ID_TERMSOFUSEPAGE
- */
-
-void CTermsOfUsePage::OnCancel( wxWizardExEvent& event ) {
- PROCESS_CANCELEVENT(event);
-}
-
-/*!
- * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_TERMSOFUSEAGREECTRL
- * or ID_TERMSOFUSEDISAGREECTRL
- */
-
-void CTermsOfUsePage::OnTermsOfUseStatusChange( wxCommandEvent& event ) {
- wxLogTrace(wxT("Function Start/End"), wxT("CTermsOfUsePage::OnTermsOfUseStatusChange - Function Begin"));
-
- if ((ID_TERMSOFUSEAGREECTRL == event.GetId()) && event.IsChecked()){
- wxLogTrace(wxT("Function Status"), wxT("CTermsOfUsePage::OnTermsOfUseStatusChange - SetUserAgrees(true)"));
- SetUserAgrees(true);
- ((CWizardAttach*)GetParent())->EnableNextButton();
- } else {
- wxLogTrace(wxT("Function Status"), wxT("CTermsOfUsePage::OnTermsOfUseStatusChange - SetUserAgrees(false)"));
- SetUserAgrees(false);
- ((CWizardAttach*)GetParent())->DisableNextButton();
- }
-
- wxLogTrace(wxT("Function Start/End"), wxT("CTermsOfUsePage::OnTermsOfUseStatusChange - Function End"));
-}
+// This file is part of BOINC.
+// http://boinc.berkeley.edu
+// Copyright (C) 2008 University of California
+//
+// BOINC is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation,
+// either version 3 of the License, or (at your option) any later version.
+//
+// BOINC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with BOINC. If not, see .
+//
+#if defined(__GNUG__) && !defined(__APPLE__)
+#pragma implementation "TermsOfUsePage.h"
+#endif
+
+#include "stdwx.h"
+#include "diagnostics.h"
+#include "util.h"
+#include "mfile.h"
+#include "miofile.h"
+#include "parse.h"
+#include "error_numbers.h"
+#include "wizardex.h"
+#include "error_numbers.h"
+#include "BOINCGUIApp.h"
+#include "SkinManager.h"
+#include "MainDocument.h"
+#include "BOINCBaseWizard.h"
+#include "WizardAttach.h"
+#include "TermsOfUsePage.h"
+
+
+/*!
+ * CTermsOfUsePage type definition
+ */
+
+IMPLEMENT_DYNAMIC_CLASS( CTermsOfUsePage, wxWizardPageEx )
+
+/*!
+ * CTermsOfUsePage event table definition
+ */
+
+BEGIN_EVENT_TABLE( CTermsOfUsePage, wxWizardPageEx )
+
+////@begin CTermsOfUsePage event table entries
+ EVT_WIZARDEX_PAGE_CHANGED( -1, CTermsOfUsePage::OnPageChanged )
+ EVT_WIZARDEX_PAGE_CHANGING( -1, CTermsOfUsePage::OnPageChanging )
+ EVT_WIZARDEX_CANCEL( -1, CTermsOfUsePage::OnCancel )
+ EVT_RADIOBUTTON( ID_TERMSOFUSEAGREECTRL, CTermsOfUsePage::OnTermsOfUseStatusChange )
+ EVT_RADIOBUTTON( ID_TERMSOFUSEDISAGREECTRL, CTermsOfUsePage::OnTermsOfUseStatusChange )
+////@end CTermsOfUsePage event table entries
+
+END_EVENT_TABLE()
+
+/*!
+ * CTermsOfUsePage constructors
+ */
+
+CTermsOfUsePage::CTermsOfUsePage( )
+{
+}
+
+CTermsOfUsePage::CTermsOfUsePage( CBOINCBaseWizard* parent )
+{
+ Create( parent );
+}
+
+/*!
+ * CTermsOfUsePage creator
+ */
+
+bool CTermsOfUsePage::Create( CBOINCBaseWizard* parent )
+{
+////@begin CTermsOfUsePage member initialisation
+ m_pTitleStaticCtrl = NULL;
+ m_pDirectionsStaticCtrl = NULL;
+ m_pTermsOfUseCtrl = NULL;
+ m_pAgreeCtrl = NULL;
+ m_pDisagreeCtrl = NULL;
+////@end CTermsOfUsePage member initialisation
+ m_bUserAgrees = false;
+ m_bCredentialsAlreadyAvailable = false;
+
+////@begin CTermsOfUsePage creation
+ wxWizardPageEx::Create( parent, ID_TERMSOFUSEPAGE );
+
+ CreateControls();
+ GetSizer()->Fit(this);
+////@end CTermsOfUsePage creation
+
+ return TRUE;
+}
+
+/*!
+ * Control creation for CTermsOfUsePage
+ */
+
+void CTermsOfUsePage::CreateControls()
+{
+////@begin CTermsOfUsePage content construction
+ CTermsOfUsePage* itemWizardPage96 = this;
+
+ wxBoxSizer* itemBoxSizer97 = new wxBoxSizer(wxVERTICAL);
+ itemWizardPage96->SetSizer(itemBoxSizer97);
+
+ m_pTitleStaticCtrl = new wxStaticText;
+ m_pTitleStaticCtrl->Create( itemWizardPage96, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ m_pTitleStaticCtrl->SetFont(wxFont(10, wxSWISS, wxNORMAL, wxBOLD, FALSE, _T("Verdana")));
+ itemBoxSizer97->Add(m_pTitleStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
+
+ itemBoxSizer97->Add(5, 5, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_pDirectionsStaticCtrl = new wxStaticText;
+ m_pDirectionsStaticCtrl->Create( itemWizardPage96, wxID_STATIC, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ itemBoxSizer97->Add(m_pDirectionsStaticCtrl, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_pTermsOfUseCtrl = new wxTextCtrl;
+ m_pTermsOfUseCtrl->Create( itemWizardPage96, ID_TERMSOFUSECTRL, wxEmptyString, wxDefaultPosition, wxSize(300, 125), wxTE_MULTILINE|wxTE_READONLY|wxTE_RICH );
+ itemBoxSizer97->Add(m_pTermsOfUseCtrl, 0, wxGROW|wxALL, 5);
+
+ m_pAgreeCtrl = new wxRadioButton;
+ m_pAgreeCtrl->Create( itemWizardPage96, ID_TERMSOFUSEAGREECTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ m_pAgreeCtrl->SetValue(false);
+ itemBoxSizer97->Add(m_pAgreeCtrl, 0, wxALIGN_LEFT|wxALL, 5);
+
+ m_pDisagreeCtrl = new wxRadioButton;
+ m_pDisagreeCtrl->Create( itemWizardPage96, ID_TERMSOFUSEDISAGREECTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ m_pDisagreeCtrl->SetValue(true);
+ itemBoxSizer97->Add(m_pDisagreeCtrl, 0, wxALIGN_LEFT|wxALL, 5);
+
+////@end CTermsOfUsePage content construction
+}
+
+/*!
+ * Gets the previous page.
+ */
+
+wxWizardPageEx* CTermsOfUsePage::GetPrev() const
+{
+ return PAGE_TRANSITION_BACK;
+}
+
+/*!
+ * Gets the next page.
+ */
+
+wxWizardPageEx* CTermsOfUsePage::GetNext() const
+{
+ if (CHECK_CLOSINGINPROGRESS()) {
+ // Cancel Event Detected
+ return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE);
+ } else if (IS_ATTACHTOPROJECTWIZARD() && GetUserAgrees() && GetCredentialsAlreadyAvailable()) {
+ return PAGE_TRANSITION_NEXT(ID_PROJECTPROCESSINGPAGE);
+ } else if (IS_ACCOUNTMANAGERWIZARD() && GetUserAgrees() && GetCredentialsAlreadyAvailable()) {
+ return PAGE_TRANSITION_NEXT(ID_ACCOUNTMANAGERPROCESSINGPAGE);
+ } else if (GetUserAgrees()) {
+ return PAGE_TRANSITION_NEXT(ID_ACCOUNTINFOPAGE);
+ } else {
+ return PAGE_TRANSITION_NEXT(ID_COMPLETIONERRORPAGE);
+ }
+ return NULL;
+}
+
+/*!
+ * Should we show tooltips?
+ */
+
+bool CTermsOfUsePage::ShowToolTips()
+{
+ return TRUE;
+}
+
+/*!
+ * Get bitmap resources
+ */
+
+wxBitmap CTermsOfUsePage::GetBitmapResource( const wxString& WXUNUSED(name) )
+{
+ // Bitmap retrieval
+
+////@begin CTermsOfUsePage bitmap retrieval
+ return wxNullBitmap;
+////@end CTermsOfUsePage bitmap retrieval
+}
+
+/*!
+ * Get icon resources
+ */
+
+wxIcon CTermsOfUsePage::GetIconResource( const wxString& WXUNUSED(name) )
+{
+ // Icon retrieval
+
+////@begin CTermsOfUsePage icon retrieval
+ return wxNullIcon;
+////@end CTermsOfUsePage icon retrieval
+}
+
+/*!
+ * wxEVT_WIZARD_PAGE_CHANGED event handler for ID_TERMSOFUSEPAGE
+ */
+
+void CTermsOfUsePage::OnPageChanged( wxWizardExEvent& event ) {
+ if (event.GetDirection() == false) return;
+
+ PROJECT_CONFIG& pc = ((CWizardAttach*)GetParent())->project_config;
+
+ wxASSERT(m_pTitleStaticCtrl);
+ wxASSERT(m_pDirectionsStaticCtrl);
+
+ m_pTitleStaticCtrl->SetLabel(
+ _("Terms of Use")
+ );
+
+ m_pDirectionsStaticCtrl->SetLabel(
+ _("Please read the following terms of use:")
+ );
+
+ m_pTermsOfUseCtrl->SetValue(
+ wxString(pc.terms_of_use.c_str(), wxConvUTF8)
+ );
+ m_pTermsOfUseCtrl->SetSelection(0,0);
+
+ m_pAgreeCtrl->SetLabel(
+ _("I agree to the terms of use.")
+ );
+ m_pAgreeCtrl->SetValue(false);
+
+
+ m_pDisagreeCtrl->SetLabel(
+ _("I do not agree with the terms of use.")
+ );
+ m_pDisagreeCtrl->SetValue(true);
+
+ SetUserAgrees(false);
+ ((CWizardAttach*)GetParent())->DisableNextButton();
+
+
+ Fit();
+}
+
+/*!
+ * wxEVT_WIZARD_PAGE_CHANGING event handler for ID_TERMSOFUSEPAGE
+ */
+
+void CTermsOfUsePage::OnPageChanging( wxWizardExEvent& event ) {
+ CWizardAttach* pWA = ((CWizardAttach*)GetParent());
+
+ wxASSERT(pWA);
+ wxASSERT(wxDynamicCast(pWA, CWizardAttach));
+
+ // If the user has left the terms of use disagree radio button
+ // selected, then the next button is disabled and needs to be
+ // re-enabled if the back button is pressed.
+ pWA->EnableNextButton();
+
+ if (event.GetDirection() == false) return;
+
+ if (!CHECK_CLOSINGINPROGRESS()) {
+ // We are leaving this page.
+
+ // Determine if the account settings are already pre-populated.
+ // If so, advance to the Account Manager Processing page or the
+ // Project Processing page.
+ if ( pWA->m_bCredentialsCached || pWA->m_bCredentialsDetected) {
+ SetCredentialsAlreadyAvailable(true);
+ } else {
+ SetCredentialsAlreadyAvailable(false);
+ }
+ }
+}
+
+/*!
+ * wxEVT_WIZARD_CANCEL event handler for ID_TERMSOFUSEPAGE
+ */
+
+void CTermsOfUsePage::OnCancel( wxWizardExEvent& event ) {
+ PROCESS_CANCELEVENT(event);
+}
+
+/*!
+ * wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_TERMSOFUSEAGREECTRL
+ * or ID_TERMSOFUSEDISAGREECTRL
+ */
+
+void CTermsOfUsePage::OnTermsOfUseStatusChange( wxCommandEvent& event ) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CTermsOfUsePage::OnTermsOfUseStatusChange - Function Begin"));
+
+ if ((ID_TERMSOFUSEAGREECTRL == event.GetId()) && event.IsChecked()){
+ wxLogTrace(wxT("Function Status"), wxT("CTermsOfUsePage::OnTermsOfUseStatusChange - SetUserAgrees(true)"));
+ SetUserAgrees(true);
+ ((CWizardAttach*)GetParent())->EnableNextButton();
+ } else {
+ wxLogTrace(wxT("Function Status"), wxT("CTermsOfUsePage::OnTermsOfUseStatusChange - SetUserAgrees(false)"));
+ SetUserAgrees(false);
+ ((CWizardAttach*)GetParent())->DisableNextButton();
+ }
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CTermsOfUsePage::OnTermsOfUseStatusChange - Function End"));
+}
diff --git a/clientgui/TermsOfUsePage.h b/clientgui/TermsOfUsePage.h
index a93d41dd4b..1fea9f177e 100644
--- a/clientgui/TermsOfUsePage.h
+++ b/clientgui/TermsOfUsePage.h
@@ -1,98 +1,98 @@
-// This file is part of BOINC.
-// http://boinc.berkeley.edu
-// Copyright (C) 2008 University of California
-//
-// BOINC is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation,
-// either version 3 of the License, or (at your option) any later version.
-//
-// BOINC is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with BOINC. If not, see .
-//
-#ifndef _WIZ_TERMSOFUSEPAGE_H_
-#define _WIZ_TERMSOFUSEPAGE_H_
-
-#if defined(__GNUG__) && !defined(__APPLE__)
-#pragma interface "TermsOfUsePage.cpp"
-#endif
-
-/*!
- * CTermsOfUsePage class declaration
- */
-
-class CTermsOfUsePage: public wxWizardPageEx
-{
- DECLARE_DYNAMIC_CLASS( CTermsOfUsePage )
- DECLARE_EVENT_TABLE()
-
-public:
- /// Constructors
- CTermsOfUsePage( );
-
- CTermsOfUsePage( CBOINCBaseWizard* parent );
-
- /// Creation
- bool Create( CBOINCBaseWizard* parent );
-
- /// Creates the controls and sizers
- void CreateControls();
-
-////@begin CTermsOfUsePage event handler declarations
-
- /// wxEVT_WIZARD_PAGE_CHANGED event handler for ID_TERMSOFUSEPAGE
- void OnPageChanged( wxWizardExEvent& event );
-
- /// wxEVT_WIZARD_PAGE_CHANGING event handler for ID_TERMSOFUSEPAGE
- void OnPageChanging( wxWizardExEvent& event );
-
- /// wxEVT_WIZARD_CANCEL event handler for ID_TERMSOFUSEPAGE
- void OnCancel( wxWizardExEvent& event );
-
- /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_TERMSOFUSEAGREECTRL
- /// or ID_TERMSOFUSEDISAGREECTRL
- void OnTermsOfUseStatusChange( wxCommandEvent& event );
-
-////@end CTermsOfUsePage event handler declarations
-
-////@begin CTermsOfUsePage member function declarations
-
- /// Gets the previous page.
- virtual wxWizardPageEx* GetPrev() const;
-
- /// Gets the next page.
- virtual wxWizardPageEx* GetNext() const;
-
- /// Retrieves bitmap resources
- wxBitmap GetBitmapResource( const wxString& name );
-
- /// Retrieves icon resources
- wxIcon GetIconResource( const wxString& name );
-////@end CTermsOfUsePage member function declarations
-
- bool GetUserAgrees() const { return m_bUserAgrees ; }
- void SetUserAgrees(bool value) { m_bUserAgrees = value ; }
-
- bool GetCredentialsAlreadyAvailable() const { return m_bCredentialsAlreadyAvailable ; }
- void SetCredentialsAlreadyAvailable(bool value) { m_bCredentialsAlreadyAvailable = value ; }
-
- /// Should we show tooltips?
- static bool ShowToolTips();
-
-////@begin CTermsOfUsePage member variables
- wxStaticText* m_pTitleStaticCtrl;
- wxStaticText* m_pDirectionsStaticCtrl;
- wxTextCtrl* m_pTermsOfUseCtrl;
- wxRadioButton* m_pAgreeCtrl;
- wxRadioButton* m_pDisagreeCtrl;
-////@end CTermsOfUsePage member variables
- bool m_bUserAgrees;
- bool m_bCredentialsAlreadyAvailable;
-};
-
-#endif
+// This file is part of BOINC.
+// http://boinc.berkeley.edu
+// Copyright (C) 2008 University of California
+//
+// BOINC is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation,
+// either version 3 of the License, or (at your option) any later version.
+//
+// BOINC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with BOINC. If not, see .
+//
+#ifndef _WIZ_TERMSOFUSEPAGE_H_
+#define _WIZ_TERMSOFUSEPAGE_H_
+
+#if defined(__GNUG__) && !defined(__APPLE__)
+#pragma interface "TermsOfUsePage.cpp"
+#endif
+
+/*!
+ * CTermsOfUsePage class declaration
+ */
+
+class CTermsOfUsePage: public wxWizardPageEx
+{
+ DECLARE_DYNAMIC_CLASS( CTermsOfUsePage )
+ DECLARE_EVENT_TABLE()
+
+public:
+ /// Constructors
+ CTermsOfUsePage( );
+
+ CTermsOfUsePage( CBOINCBaseWizard* parent );
+
+ /// Creation
+ bool Create( CBOINCBaseWizard* parent );
+
+ /// Creates the controls and sizers
+ void CreateControls();
+
+////@begin CTermsOfUsePage event handler declarations
+
+ /// wxEVT_WIZARD_PAGE_CHANGED event handler for ID_TERMSOFUSEPAGE
+ void OnPageChanged( wxWizardExEvent& event );
+
+ /// wxEVT_WIZARD_PAGE_CHANGING event handler for ID_TERMSOFUSEPAGE
+ void OnPageChanging( wxWizardExEvent& event );
+
+ /// wxEVT_WIZARD_CANCEL event handler for ID_TERMSOFUSEPAGE
+ void OnCancel( wxWizardExEvent& event );
+
+ /// wxEVT_COMMAND_RADIOBUTTON_SELECTED event handler for ID_TERMSOFUSEAGREECTRL
+ /// or ID_TERMSOFUSEDISAGREECTRL
+ void OnTermsOfUseStatusChange( wxCommandEvent& event );
+
+////@end CTermsOfUsePage event handler declarations
+
+////@begin CTermsOfUsePage member function declarations
+
+ /// Gets the previous page.
+ virtual wxWizardPageEx* GetPrev() const;
+
+ /// Gets the next page.
+ virtual wxWizardPageEx* GetNext() const;
+
+ /// Retrieves bitmap resources
+ wxBitmap GetBitmapResource( const wxString& name );
+
+ /// Retrieves icon resources
+ wxIcon GetIconResource( const wxString& name );
+////@end CTermsOfUsePage member function declarations
+
+ bool GetUserAgrees() const { return m_bUserAgrees ; }
+ void SetUserAgrees(bool value) { m_bUserAgrees = value ; }
+
+ bool GetCredentialsAlreadyAvailable() const { return m_bCredentialsAlreadyAvailable ; }
+ void SetCredentialsAlreadyAvailable(bool value) { m_bCredentialsAlreadyAvailable = value ; }
+
+ /// Should we show tooltips?
+ static bool ShowToolTips();
+
+////@begin CTermsOfUsePage member variables
+ wxStaticText* m_pTitleStaticCtrl;
+ wxStaticText* m_pDirectionsStaticCtrl;
+ wxTextCtrl* m_pTermsOfUseCtrl;
+ wxRadioButton* m_pAgreeCtrl;
+ wxRadioButton* m_pDisagreeCtrl;
+////@end CTermsOfUsePage member variables
+ bool m_bUserAgrees;
+ bool m_bCredentialsAlreadyAvailable;
+};
+
+#endif
diff --git a/clientgui/sg_BoincSimpleFrame.cpp b/clientgui/sg_BoincSimpleFrame.cpp
index 8af24e3e75..43b7a48a0b 100644
--- a/clientgui/sg_BoincSimpleFrame.cpp
+++ b/clientgui/sg_BoincSimpleFrame.cpp
@@ -1,1077 +1,1077 @@
-// This file is part of BOINC.
-// http://boinc.berkeley.edu
-// Copyright (C) 2008 University of California
-//
-// BOINC is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation,
-// either version 3 of the License, or (at your option) any later version.
-//
-// BOINC is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with BOINC. If not, see .
-
-
-#if defined(__GNUG__) && !defined(__APPLE__)
-#pragma implementation "sg_BoincSimpleFrame.h"
-#endif
-
-#include "stdwx.h"
-#ifdef __WXMAC__
-#include "MacAccessiblity.h"
-#endif
-#include "diagnostics.h"
-#include "str_util.h"
-#include "mfile.h"
-#include "miofile.h"
-#include "parse.h"
-#include "error_numbers.h"
-#include "BOINCGUIApp.h"
-#include "SkinManager.h"
-#include "MainDocument.h"
-#include "Events.h"
-#include "BOINCBaseFrame.h"
-#include "wizardex.h"
-#include "BOINCBaseWizard.h"
-#include "WizardAttach.h"
-#include "error_numbers.h"
-#include "version.h"
-
-#include "sg_BoincSimpleFrame.h"
-#include "sg_TaskPanel.h"
-#include "sg_ProjectPanel.h"
-#include "sg_DlgMessages.h"
-#include "sg_DlgPreferences.h"
-#include "DlgEventLog.h"
-#include "DlgAbout.h"
-#include "DlgOptions.h"
-
-// Workaround for Linux refresh problem
-#if (defined(__WXMSW__) || defined(__WXMAC__))
-#define REFRESH_WAIT 0
-#else
-#define REFRESH_WAIT 1
-#endif
-
-IMPLEMENT_DYNAMIC_CLASS(CSimpleFrame, CBOINCBaseFrame)
-
-BEGIN_EVENT_TABLE(CSimpleFrame, CBOINCBaseFrame)
- EVT_SIZE(CSimpleFrame::OnSize)
- EVT_MENU(ID_CHANGEGUI, CSimpleFrame::OnChangeGUI)
- EVT_MENU(ID_SGDEFAULTSKINSELECTOR, CSimpleFrame::OnSelectDefaultSkin)
- EVT_MENU_RANGE(ID_SGFIRSTSKINSELECTOR, ID_LASTSGSKINSELECTOR, CSimpleFrame::OnSelectSkin)
- EVT_HELP(wxID_ANY, CSimpleFrame::OnHelp)
- EVT_FRAME_CONNECT(CSimpleFrame::OnConnect)
- EVT_FRAME_RELOADSKIN(CSimpleFrame::OnReloadSkin)
- EVT_FRAME_NOTIFICATION(CSimpleFrame::OnNotification)
- EVT_MENU(ID_PREFERENCES, CSimpleFrame::OnPreferences)
- EVT_MENU(ID_SGOPTIONS, CSimpleFrame::OnOptions)
- EVT_MENU(ID_HELPBOINC, CSimpleFrame::OnHelpBOINC)
- EVT_MENU(ID_HELPBOINCMANAGER, CSimpleFrame::OnHelpBOINC)
- EVT_MENU(ID_HELPBOINCWEBSITE, CSimpleFrame::OnHelpBOINC)
- EVT_MENU(wxID_ABOUT, CSimpleFrame::OnHelpAbout)
- EVT_MENU(ID_EVENTLOG, CSimpleFrame::OnEventLog)
-END_EVENT_TABLE()
-
-
-CSimpleFrame::CSimpleFrame() {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Default Constructor Function Begin"));
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Default Constructor Function End"));
-}
-
-
-CSimpleFrame::CSimpleFrame(wxString title, wxIcon* icon, wxIcon* icon32, wxPoint position, wxSize size) :
- CBOINCBaseFrame((wxFrame *)NULL, ID_SIMPLEFRAME, title, position, size,
- wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
-{
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame:: - Overloaded Constructor Function Begin"));
-
- // Initialize Application
- wxIconBundle icons;
- icons.AddIcon(*icon);
- icons.AddIcon(*icon32);
- SetIcons(icons);
-
- CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
- wxString strMenuName;
- wxString strMenuDescription;
-
- wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
-
- // File menu
- wxMenu *menuFile = new wxMenu;
-
- // %s is the application name
- // i.e. 'BOINC Manager', 'GridRepublic Manager'
- strMenuDescription.Printf(
- _("Close the %s window"),
- pSkinAdvanced->GetApplicationName().c_str()
- );
- strMenuName = _("&Close Window");
- strMenuName += wxT("\tCtrl+W");
- menuFile->Append(
- ID_CLOSEWINDOW,
- strMenuName,
- strMenuDescription
- );
-
- // Skins submenu
- m_pSubmenuSkins = new wxMenu;
-
- BuildSkinSubmenu(m_pSubmenuSkins);
-
- // All other skin names will be appended as radio
- // menu items with ID_SGFIRSTSKINSELECTOR + index
-
- // View menu
- wxMenu *menuView = new wxMenu;
-
- menuView->Append(
- ID_CHANGEGUI,
- _("Advanced View...\tCtrl+Shift+A"),
- _("Display the advanced graphical interface.")
- );
-
- menuView->AppendSeparator();
-
- menuView->Append(
- ID_SGSKINSELECTOR,
- _("Skin"),
- m_pSubmenuSkins,
- _("Select the appearance of the user interface.")
- );
-
- // Skins sumenu always contains the Default entry
- if (m_pSubmenuSkins->GetMenuItemCount() <= 1) {
- menuView->Enable(ID_SGSKINSELECTOR, false);
- }
-
- // Tools menu
- wxMenu *menuTools = new wxMenu;
-
- menuTools->Append(
- ID_PREFERENCES,
- _("Computing &preferences..."),
- _("Configure computing preferences")
- );
-
- menuTools->Append(
- ID_SGOPTIONS,
- _("&Options..."),
- _("Configure display options and proxy settings")
- );
-
- // Help menu
- wxMenu *menuHelp = new wxMenu;
-
- // %s is the project name
- // i.e. 'BOINC Manager', 'GridRepublic'
- strMenuName.Printf(
- _("%s &help"),
- pSkinAdvanced->GetApplicationShortName().c_str()
- );
- // %s is the project name
- // i.e. 'BOINC', 'GridRepublic'
- strMenuDescription.Printf(
- _("Show information about %s"),
- pSkinAdvanced->GetApplicationShortName().c_str()
- );
- menuHelp->Append(
- ID_HELPBOINC,
- strMenuName,
- strMenuDescription
- );
-
- // %s is the application name
- // i.e. 'BOINC Manager', 'GridRepublic Manager'
- strMenuName.Printf(
- _("&%s"),
- pSkinAdvanced->GetApplicationName().c_str()
- );
- // %s is the application name
- // i.e. 'BOINC Manager', 'GridRepublic Manager'
- strMenuDescription.Printf(
- _("Show information about the %s"),
- pSkinAdvanced->GetApplicationName().c_str()
- );
- menuHelp->Append(
- ID_HELPBOINCMANAGER,
- strMenuName,
- strMenuDescription
- );
-
- // %s is the project name
- // i.e. 'BOINC', 'GridRepublic'
- strMenuName.Printf(
- _("%s &website"),
- pSkinAdvanced->GetApplicationShortName().c_str()
- );
- // %s is the application name
- // i.e. 'BOINC Manager', 'GridRepublic Manager'
- strMenuDescription.Printf(
- _("Show information about BOINC and %s"),
- pSkinAdvanced->GetApplicationName().c_str()
- );
- menuHelp->Append(
- ID_HELPBOINCWEBSITE,
- strMenuName,
- strMenuDescription
- );
-
- // %s is the project name
- // i.e. 'BOINC Manager', 'GridRepublic Manager'
- strMenuName.Printf(
- _("&About %s..."),
- pSkinAdvanced->GetApplicationName().c_str()
- );
- menuHelp->Append(
- wxID_ABOUT,
- strMenuName,
- _("Licensing and copyright information.")
- );
-
- // construct menu
- m_pMenubar = new wxMenuBar;
- m_pMenubar->Append(
- menuFile,
- _("&File")
- );
- m_pMenubar->Append(
- menuView,
- _("&View")
- );
- m_pMenubar->Append(
- menuTools,
- _("&Tools")
- );
- m_pMenubar->Append(
- menuHelp,
- _("&Help")
- );
-
- wxMenuBar* m_pOldMenubar = GetMenuBar();
- SetMenuBar(m_pMenubar);
- if (m_pOldMenubar) {
- delete m_pOldMenubar;
- }
-
-#ifdef __WXGTK__
- // Force a redraw of the menu under Ubuntu's new interface
- SendSizeEvent();
-#endif
-#ifdef __WXMAC__
- m_pMenubar->MacInstallMenuBar();
- MacLocalizeBOINCMenu();
-
- // Enable Mac OS X's standard Preferences menu item (handled in MacSysMenu.cpp)
- EnableMenuCommand(NULL, kHICommandPreferences);
-#endif
-
- m_Shortcuts[0].Set(wxACCEL_NORMAL, WXK_HELP, ID_HELPBOINCMANAGER);
-#ifdef __WXMAC__
- m_Shortcuts[1].Set(wxACCEL_CMD|wxACCEL_SHIFT, (int)'E', ID_EVENTLOG);
-#else
- m_Shortcuts[1].Set(wxACCEL_CTRL|wxACCEL_SHIFT, (int)'E', ID_EVENTLOG);
-#endif
- m_pAccelTable = new wxAcceleratorTable(2, m_Shortcuts);
-
- SetAcceleratorTable(*m_pAccelTable);
-
- dlgMsgsPtr = NULL;
- m_pBackgroundPanel = new CSimpleGUIPanel(this);
-
- RestoreState();
-}
-
-
-CSimpleFrame::~CSimpleFrame() {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Destructor Function Begin"));
-
- SaveState();
-
- if (m_pAccelTable)
- delete m_pAccelTable;
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Destructor Function End"));
-}
-
-
-bool CSimpleFrame::SaveState() {
- CBOINCBaseFrame::SaveState();
- wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
- wxString strBaseConfigLocation = wxString(wxT("/Simple"));
-
- wxASSERT(pConfig);
-
- // An odd case happens every once and awhile where wxWidgets looses
- // the pointer to the config object, or it is cleaned up before
- // the window has finished it's cleanup duty. If we detect a NULL
- // pointer, return false.
- if (!pConfig) return false;
-
- //
- // Save Frame State
- //
- pConfig->SetPath(strBaseConfigLocation);
-
- pConfig->Write(wxT("XPos"), GetPosition().x);
- pConfig->Write(wxT("YPos"), GetPosition().y);
-
- return true;
-}
-
-
-bool CSimpleFrame::RestoreState() {
- CBOINCBaseFrame::RestoreState();
- return true;
-}
-
-
-int CSimpleFrame::_GetCurrentViewPage() {
- if (isMessagesDlgOpen()) {
- return VW_SGUI | VW_SMSG;
- } else {
- return VW_SGUI;
- }
- return 0; // Should never happen.
-}
-
-
-void CSimpleFrame::OnChangeGUI(wxCommandEvent& WXUNUSED(event)) {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnChangeGUI - Function Begin"));
-
- wxGetApp().SetActiveGUI(BOINC_ADVANCEDGUI, true);
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnChangeGUI - Function End"));
-}
-
-
-void CSimpleFrame::BuildSkinSubmenu( wxMenu *submenu) {
- unsigned int i;
- wxMenuItem *skinItem;
- wxArrayString astrSkins;
- wxString strSelectedSkin;
- CSkinManager* pSkinManager = wxGetApp().GetSkinManager();
-
- wxASSERT(pSkinManager);
- wxASSERT(wxDynamicCast(pSkinManager, CSkinManager));
-
-
- // The "Default" skin menu item is localized, but
- // the name of the default skin is not localized
- skinItem = submenu->AppendRadioItem(
- ID_SGDEFAULTSKINSELECTOR,
- _("Default")
- );
-
- astrSkins = pSkinManager->GetCurrentSkins();
- strSelectedSkin = pSkinManager->GetSelectedSkin();
-
- if (strSelectedSkin == pSkinManager->GetDefaultSkinName()) {
- skinItem->Check(true);
- }
-
- // Skins list always contains the Default entry
- if (astrSkins.GetCount() <= 1) {
- skinItem->Check(true);
- skinItem->Enable(false);
- return; // No non-default skins
- }
-
-// I'd like to put a separator here, but we can't separate radio items
-
- for (i = 0; i < astrSkins.GetCount(); i++) {
- if (astrSkins[i] == pSkinManager->GetDefaultSkinName()) {
- continue;
- }
-
- skinItem = submenu->AppendRadioItem(
- ID_SGFIRSTSKINSELECTOR + i,
- astrSkins[i]
- );
- if (astrSkins[i] == strSelectedSkin) {
- skinItem->Check(true);
- }
- }
-}
-
-
-
-void CSimpleFrame::OnSelectDefaultSkin( wxCommandEvent& WXUNUSED(event) ) {
- CSkinManager* pSkinManager = wxGetApp().GetSkinManager();
-
- wxASSERT(pSkinManager);
- wxASSERT(wxDynamicCast(pSkinManager, CSkinManager));
-
- // The "Default" skin menu item is localized, but
- // the name of the default skin is not localized
- pSkinManager->ReloadSkin(pSkinManager->GetDefaultSkinName());
-}
-
-
-void CSimpleFrame::OnSelectSkin( wxCommandEvent& event ){
- CSkinManager *pSkinManager = wxGetApp().GetSkinManager();
- wxMenuItem *oldItem, *selectedItem;
- wxMenuBar *pMenuBar = GetMenuBar();
- int newSkinId = event.GetId();
- int oldSkinID;
-
- wxASSERT(pSkinManager);
- wxASSERT(wxDynamicCast(pSkinManager, CSkinManager));
-
-
- selectedItem = pMenuBar->FindItem(newSkinId);
- if (!selectedItem) return;
-
- wxString oldSkinName = pSkinManager->GetSelectedSkin();
- wxString newSkinName = selectedItem->GetItemLabelText();
- if (newSkinName == oldSkinName) return;
-
- if (oldSkinName == pSkinManager->GetDefaultSkinName()) {
- // The "Default" skin menu item is localized, but
- // the name of the default skin is not localized
- oldSkinID = ID_SGDEFAULTSKINSELECTOR;
- } else {
- oldSkinID = m_pSubmenuSkins->FindItem(oldSkinName);
- }
- oldItem = m_pSubmenuSkins->FindItem(oldSkinID);
- if (oldItem) {
- oldItem->Check(false);
- }
-
- selectedItem->Check(true);
- pSkinManager->ReloadSkin(newSkinName);
-}
-
-
-void CSimpleFrame::OnPreferences(wxCommandEvent& WXUNUSED(event)) {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnPreferences - Function Begin"));
-
- m_pBackgroundPanel->SetDlgOpen(true);
-
- CDlgPreferences dlg(GetParent());
- dlg.ShowModal();
-
- m_pBackgroundPanel->SetDlgOpen(false);
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnPreferences - Function End"));
-}
-
-
-void CSimpleFrame::OnOptions(wxCommandEvent& WXUNUSED(event)) {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnOptions - Function Begin"));
-
- m_pBackgroundPanel->SetDlgOpen(true);
-
-// TODO: Create simple language selection dialog
- CDlgOptions dlg(this);
- dlg.ShowModal();
-
- m_pBackgroundPanel->SetDlgOpen(false);
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnOptions - Function End"));
-}
-
-
-// TODO: Create ID_HELPBOINCMANAGER web page for each organization for new BOINC version
-void CSimpleFrame::OnHelpBOINC(wxCommandEvent& event) {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelpBOINC - Function Begin"));
-
- if (IsShown()) {
- wxString strURL = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl();
-
- wxString wxurl;
- wxurl.Printf(
- wxT("%s?target=simple&version=%s&controlid=%d"),
- strURL.c_str(),
- wxString(BOINC_VERSION_STRING, wxConvUTF8).c_str(),
- event.GetId()
- );
- wxLaunchDefaultBrowser(wxurl);
- }
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelpBOINC - Function End"));
-}
-
-
-void CSimpleFrame::OnHelpAbout(wxCommandEvent& /*event*/) {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelpAbout - Function Begin"));
-
- m_pBackgroundPanel->SetDlgOpen(true);
-
- CDlgAbout dlg(this);
- dlg.ShowModal();
-
- m_pBackgroundPanel->SetDlgOpen(false);
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelpAbout - Function End"));
-}
-
-
-void CSimpleFrame::OnHelp(wxHelpEvent& event) {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelp - Function Begin"));
-
- if (IsShown()) {
- wxString strURL = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl();
-
- wxString wxurl;
- wxurl.Printf(
- wxT("%s?target=simple&version=%s&controlid=%d"),
- strURL.c_str(),
- wxString(BOINC_VERSION_STRING, wxConvUTF8).c_str(),
- event.GetId()
- );
- wxLaunchDefaultBrowser(wxurl);
- }
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelp - Function End"));
-}
-
-
-void CSimpleFrame::OnReloadSkin(CFrameEvent& WXUNUSED(event)) {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnReloadSkin - Function Start"));
-
- m_pBackgroundPanel->ReskinInterface();
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnReloadSkin - Function End"));
-}
-
-
-void CSimpleFrame::OnNotification(CFrameEvent& WXUNUSED(event)) {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnNotification - Function Begin"));
-
- CDlgMessages dlg(GetParent());
-
- m_pBackgroundPanel->SetDlgOpen(true);
- SetMsgsDlgOpen(&dlg);
-
- m_pBackgroundPanel->NoticesViewed();
- dlg.ShowModal();
-
- m_pBackgroundPanel->SetDlgOpen(false);
- SetMsgsDlgOpen(NULL);
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnNotification - Function End"));
-}
-
-
-void CSimpleFrame::OnRefreshView(CFrameEvent& WXUNUSED(event)) {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnRefreshView - Function Start"));
-
- m_pBackgroundPanel->OnFrameRender();
-
- if (dlgMsgsPtr) {
- dlgMsgsPtr->OnRefresh();
- }
-
-#ifdef __WXMAC__
- // We disabled tooltips on Mac while menus were popped up because they cover menus
- wxToolTip::Enable(true);
-#endif
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnRefreshView - Function End"));
-}
-
-
-void CSimpleFrame::OnProjectsAttachToProject() {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnProjectsAttachToProject - Function Begin"));
-
- CMainDocument* pDoc = wxGetApp().GetDocument();
-
- wxASSERT(pDoc);
- wxASSERT(wxDynamicCast(pDoc, CMainDocument));
-
- if (!pDoc->IsUserAuthorized())
- return;
-
- if (pDoc->IsConnected()) {
-
- CWizardAttach* pWizard = new CWizardAttach(this);
-
- wxString strName = wxEmptyString;
- wxString strURL = wxEmptyString;
- wxString strTeamName = wxEmptyString;
- pWizard->Run( strName, strURL, strTeamName, false );
-
- if (pWizard)
- pWizard->Destroy();
-
- } else {
- ShowNotCurrentlyConnectedAlert();
- }
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnProjectsAttachToProject - Function End"));
-}
-
-
-void CSimpleFrame::OnConnect(CFrameEvent& WXUNUSED(event)) {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnConnect - Function Begin"));
-
- CMainDocument* pDoc = wxGetApp().GetDocument();
- CWizardAttach* pWizard = NULL;
- wxString strComputer = wxEmptyString;
- wxString strName = wxEmptyString;
- wxString strURL = wxEmptyString;
- wxString strTeamName = wxEmptyString;
- bool bCachedCredentials = false;
- ACCT_MGR_INFO ami;
- PROJECT_INIT_STATUS pis;
- CC_STATUS status;
-
- wxASSERT(pDoc);
- wxASSERT(wxDynamicCast(pDoc, CMainDocument));
-
- pDoc->ForceCacheUpdate();
- pDoc->GetCoreClientStatus(status, true);
-
-#ifdef __WXMAC__
- wxGetApp().GetMacSystemMenu()->BuildMenu();
-#endif
-
- // If we are connected to the localhost, run a really quick screensaver
- // test to trigger a firewall popup.
- pDoc->GetConnectedComputerName(strComputer);
- if (pDoc->IsComputerNameLocal(strComputer)) {
- wxGetApp().StartBOINCScreensaverTest();
- wxGetApp().StartBOINCDefaultScreensaverTest();
- }
-
-
- pDoc->rpc.get_project_init_status(pis);
- pDoc->rpc.acct_mgr_info(ami);
- if (ami.acct_mgr_url.size() && !ami.have_credentials) {
- if (!IsShown()) {
- Show();
- }
-
- pWizard = new CWizardAttach(this);
- if (pWizard->SyncToAccountManager()) {
- // If successful, hide the main window
- Hide();
- }
- } else if ((pis.url.size() || (0 >= pDoc->GetSimpleProjectCount())) && !status.disallow_attach) {
- if (!IsShown()) {
- Show();
- }
-
- strName = wxString(pis.name.c_str(), wxConvUTF8);
- strURL = wxString(pis.url.c_str(), wxConvUTF8);
- strTeamName = wxString(pis.team_name.c_str(), wxConvUTF8);
- bCachedCredentials = pis.url.length() && pis.has_account_key;
-
- pWizard = new CWizardAttach(this);
- pWizard->Run(strName, strURL, strTeamName, bCachedCredentials);
- }
-
- if (pWizard) {
- pWizard->Destroy();
- m_pBackgroundPanel->UpdateProjectView();
- }
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnConnect - Function End"));
-}
-
-
-void CSimpleFrame::OnEventLog(wxCommandEvent& WXUNUSED(event)) {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnEventLog - Function Begin"));
-
- wxGetApp().DisplayEventLog();
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnEventLog - Function End"));
-}
-
-
-IMPLEMENT_DYNAMIC_CLASS(CSimpleGUIPanel, wxPanel)
-
-BEGIN_EVENT_TABLE(CSimpleGUIPanel, wxPanel)
- EVT_SIZE(CSimpleGUIPanel::OnSize)
- EVT_ERASE_BACKGROUND(CSimpleGUIPanel::OnEraseBackground)
- EVT_BUTTON(ID_SGNOTICESBUTTON,CSimpleGUIPanel::OnShowNotices)
- EVT_BUTTON(ID_SGSUSPENDRESUMEBUTTON,CSimpleGUIPanel::OnSuspendResume)
- EVT_BUTTON(ID_SIMPLE_HELP,CSimpleGUIPanel::OnHelp)
- EVT_TIMER(ID_SIMPLEMESSAGECHECKTIMER, CSimpleGUIPanel::OnCheckForNewNotices)
- EVT_PAINT(CSimpleGUIPanel::OnPaint)
-END_EVENT_TABLE()
-
-
-CSimpleGUIPanel::CSimpleGUIPanel() {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::CSimpleGUIPanel - Default Constructor Function Begin"));
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::CSimpleGUIPanel - Default Constructor Function End"));
-}
-
-
-CSimpleGUIPanel::CSimpleGUIPanel(wxWindow* parent) :
- wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN | wxBORDER_NONE)
-{
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::CSimpleGUIPanel - Overloaded Constructor Function Begin"));
-
- CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
-
- wxASSERT(pSkinAdvanced);
- wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
-
- m_taskPanel = NULL;
- m_projPanel = NULL;
- m_oldWorkCount = 0;
- m_bNewNoticeAlert = false;
- m_bNoticesButtonIsRed = false;
- m_irefreshCount = 0;
-
- checkForNewNoticesTimer = new wxTimer(this, ID_SIMPLEMESSAGECHECKTIMER);
- checkForNewNoticesTimer->Start(5000);
-
- dlgOpen = false;
- m_sSuspendString = _("Suspend");
- m_sResumeString = _("Resume");
- m_sSuspendButtonToolTip = _("Suspend Computing");
- m_sResumeButtonToolTip = _("Resume Computing");
-
- m_taskPanel = new CSimpleTaskPanel(this);
- m_projPanel = new CSimpleProjectPanel(this);
-
- // Box Sizer
- mainSizer = new wxBoxSizer(wxVERTICAL);
- mainSizer->AddSpacer(68);
- mainSizer->Add(m_taskPanel, 1, wxLEFT | wxRIGHT | wxEXPAND | wxALIGN_CENTER, SIDEMARGINS);
- mainSizer->AddSpacer(8);
- mainSizer->Add(m_projPanel, 0, wxLEFT | wxRIGHT | wxEXPAND | wxALIGN_CENTER, SIDEMARGINS);
- mainSizer->AddSpacer(8);
-
- wxBoxSizer* buttonsSizer;
- buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
-
- m_NoticesButton = new wxButton( this, ID_SGNOTICESBUTTON, _("Notices"), wxDefaultPosition, wxDefaultSize, 0 );
- m_NoticesButton->SetToolTip( _("Open a window to view notices from projects or BOINC"));
- buttonsSizer->Add( m_NoticesButton, 0, wxEXPAND | wxALIGN_LEFT, 0 );
- buttonsSizer->AddStretchSpacer();
-
- int suspendWidth, resumeWidth, y;
- GetTextExtent(m_sSuspendString, &suspendWidth, &y);
- GetTextExtent(m_sResumeString, &resumeWidth, &y);
-
- m_bIsSuspended = suspendWidth > resumeWidth;
- m_SuspendResumeButton = new wxButton( this, ID_SGSUSPENDRESUMEBUTTON,
- m_bIsSuspended ? m_sSuspendString : m_sResumeString,
- wxDefaultPosition, wxDefaultSize, 0 );
- m_SuspendResumeButton->SetToolTip(wxEmptyString);
-
- buttonsSizer->Add( m_SuspendResumeButton, 0, wxEXPAND | wxALIGN_RIGHT, 0 );
- buttonsSizer->AddStretchSpacer();
-
- m_HelpButton = new wxButton( this, ID_SIMPLE_HELP, _("Help"), wxDefaultPosition, wxDefaultSize, 0 );
- buttonsSizer->Add( m_HelpButton, 0, wxEXPAND | wxALIGN_RIGHT, 0 );
-
- wxString helpTip;
- helpTip.Printf(_("Get help with %s"), pSkinAdvanced->GetApplicationShortName().c_str());
- m_HelpButton->SetToolTip(helpTip);
-
- mainSizer->Add( buttonsSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, 2 * SIDEMARGINS );
- mainSizer->AddSpacer(10);
-
- SetSizer(mainSizer);
- Layout();
-
- mainSizer->Fit(GetParent());
-
- SetBackgroundBitmap();
-
-#ifdef __WXMAC__
- // Tell accessibility aids to ignore this panel (but not its contents)
- HIObjectSetAccessibilityIgnored((HIObjectRef)GetHandle(), true);
-
- SInt32 response;
- OSStatus err = Gestalt(gestaltSystemVersion, &response);
- if ((err == noErr) && (response >= 0x1070)) {
- m_iRedRingRadius = 4;
- } else {
- m_iRedRingRadius = 12;
- }
-#endif
-
- m_SuspendResumeButton->Disable();
- OnFrameRender();
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::CSimpleGUIPanel - Overloaded Constructor Function End"));
-}
-
-
-CSimpleGUIPanel::~CSimpleGUIPanel()
-{
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::CSimpleGUIPanel - Destructor Function Begin"));
-
- checkForNewNoticesTimer->Stop();
- delete checkForNewNoticesTimer;
- m_bmpBg = wxNullBitmap; // Deletes old bitmap via reference counting
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::CSimpleGUIPanel - Destructor Function End"));
-}
-
-
-void CSimpleGUIPanel::SetBackgroundBitmap() {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::SetBackgroundBitmap - Function Start"));
-
- CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
-
- wxASSERT(pSkinSimple);
- wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
-
- wxColour bgColor(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
- SetBackgroundColour(bgColor);
-
- wxRect panelRect = GetRect();
- m_bmpBg = wxBitmap(panelRect.width, panelRect.height);
- wxMemoryDC dc(m_bmpBg);
- wxBrush bgBrush(bgColor);
- dc.SetBackground(bgBrush);
- dc.Clear();
- dc.DrawBitmap(*pSkinSimple->GetBackgroundImage()->GetBitmap(), 0, 0, false);
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::SetBackgroundBitmap - Function End"));
-}
-
-void CSimpleGUIPanel::ReskinInterface() {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::ReskinInterface - Function Start"));
-
- Freeze();
- //bg color
- m_bmpBg = wxNullBitmap; // Deletes old bitmap via reference counting
- SetBackgroundBitmap();
-
- m_taskPanel->ReskinInterface();
- m_projPanel->ReskinInterface();
-
- Thaw();
- Refresh();
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::ReskinInterface - Function End"));
-}
-
-
-void CSimpleGUIPanel::OnProjectsAttachToProject() {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::OnProjectsAttachToProject - Function Begin"));
-
- CSimpleFrame* pFrame = wxDynamicCast(GetParent(), CSimpleFrame);
- wxASSERT(pFrame);
-
- pFrame->OnProjectsAttachToProject();
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnProjectsAttachToProject - Function End"));
-}
-
-
-// called from CSimpleFrame::OnRefreshView()
-void CSimpleGUIPanel::OnFrameRender() {
- CMainDocument* pDoc = wxGetApp().GetDocument();
- wxASSERT(pDoc);
- int workCount = pDoc->GetSimpleGUIWorkCount();
- CC_STATUS status;
- bool isSuspended;
-
- // OnFrameRender() may be called while SimpleGUI initialization is
- // in progress due to completion of a periodic get_messages RPC,
- // causing unintended recursion in CMainDocument::RequestRPC().
- // Check for that situation here.
- if (pDoc->WaitingForRPC()) return;
-
- // Workaround for Linux refresh problem
- if (m_irefreshCount < REFRESH_WAIT) {
- ++m_irefreshCount;
- m_taskPanel->UpdatePanel(true);
- return;
- }
-
- if (workCount != m_oldWorkCount) {
- if (workCount < 0) {
- m_projPanel->Hide();
- } else if (m_oldWorkCount == 0) {
- m_projPanel->Show();
- }
- this->Layout();
- ReskinInterface();
- }
-
- if (IsShown()) {
- if ( pDoc->IsConnected() ) {
-
- // Show Resume or Suspend as appropriate
- pDoc->GetCoreClientStatus(status);
-
- isSuspended = (RUN_MODE_NEVER == status.task_mode);
- if ((isSuspended != m_bIsSuspended) || (!m_SuspendResumeButton->IsEnabled())) {
- m_bIsSuspended = isSuspended;
- m_SuspendResumeButton->SetLabel(m_bIsSuspended ? m_sResumeString : m_sSuspendString);
- m_SuspendResumeButton->SetToolTip(m_bIsSuspended ? m_sResumeButtonToolTip : m_sSuspendButtonToolTip);
- }
- m_SuspendResumeButton->Enable();
- } else {
- m_SuspendResumeButton->SetToolTip(wxEmptyString);
- m_SuspendResumeButton->Disable();
- }
-
- UpdateProjectView();
-
- if (m_bNewNoticeAlert) {
- wxRect r = m_NoticesButton->GetRect();
- r.Inflate(4, 4);
- RefreshRect(r, m_bNoticesButtonIsRed);
- m_bNoticesButtonIsRed = !m_bNoticesButtonIsRed;
- }
-
-
- // State changes can cause the BSG to crash if a dialogue is open.
- // Defer state change until after the dialogue is closed
- if ( dlgOpen ) {
- return;
- }
-
- m_oldWorkCount = workCount;
-
- m_taskPanel->UpdatePanel(false);
- }
-}
-
-
-void CSimpleGUIPanel::UpdateProjectView()
-{
- //update Project Panel
- m_projPanel->UpdateInterface();
-}
-
-
-void CSimpleGUIPanel::OnCheckForNewNotices(wxTimerEvent& WXUNUSED(event)) {
- CMainDocument* pDoc = wxGetApp().GetDocument();
- if ( pDoc->GetUnreadNoticeCount() ) {
- m_bNewNoticeAlert = true;
- checkForNewNoticesTimer->Stop();
- }
-}
-
-
-void CSimpleGUIPanel::NoticesViewed() {
- CMainDocument* pDoc = wxGetApp().GetDocument();
-
- wxASSERT(pDoc);
-
- m_bNewNoticeAlert = false;
- m_bNoticesButtonIsRed = false;
- wxRect r = m_NoticesButton->GetRect();
- r.Inflate(4, 4);
- RefreshRect(r, true);
- m_bNoticesButtonIsRed = !m_bNoticesButtonIsRed;
- pDoc->UpdateUnreadNoticeState();
- checkForNewNoticesTimer->Start();
-}
-
-
-void CSimpleGUIPanel::OnShowNotices(wxCommandEvent& /*event*/) {
- NoticesViewed();
-
- CDlgMessages dlg(GetParent());
- SetDlgOpen(true);
-
- ((CSimpleFrame*)GetParent())->SetMsgsDlgOpen(&dlg);
-
- dlg.ShowModal();
-
- SetDlgOpen(false);
- ((CSimpleFrame*)GetParent())->SetMsgsDlgOpen(NULL);
-}
-
-
-void CSimpleGUIPanel::OnSuspendResume(wxCommandEvent& /*event*/) {
- CMainDocument* pDoc = wxGetApp().GetDocument();
- CC_STATUS ccs;
-
- wxASSERT(pDoc);
- wxASSERT(wxDynamicCast(pDoc, CMainDocument));
-
- if (m_bIsSuspended) {
- pDoc->GetCoreClientStatus(ccs);
-
- if ((RUN_MODE_NEVER == ccs.task_mode) && (0 >= ccs.task_mode_delay)) {
- pDoc->SetActivityRunMode(RUN_MODE_AUTO, 0);
- } else {
- pDoc->SetActivityRunMode(RUN_MODE_RESTORE, 0);
- }
- } else {
- pDoc->SetActivityRunMode(RUN_MODE_NEVER, 3600);
- }
-
- m_SuspendResumeButton->SetLabel(m_bIsSuspended ? m_sResumeString : m_sSuspendString);
- m_SuspendResumeButton->SetToolTip(m_bIsSuspended ? m_sResumeButtonToolTip : m_sSuspendButtonToolTip);
-}
-
-
-// TODO: Create ID_SIMPLE_HELP web page for each organization for new BOINC version
-void CSimpleGUIPanel::OnHelp(wxCommandEvent& WXUNUSED(event)) {
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::OnHelp - Function Begin"));
-
- wxString strURL = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl();
-
- wxString wxurl;
- wxurl.Printf(
- wxT("%s?target=simple&version=%s&controlid=%d"),
- strURL.c_str(),
- wxString(BOINC_VERSION_STRING, wxConvUTF8).c_str(),
- ID_SIMPLE_HELP
-
- );
-
- wxLaunchDefaultBrowser(wxurl);
-
- wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::OnHelp - Function End"));
-}
-
-
-void CSimpleGUIPanel::OnPaint(wxPaintEvent& WXUNUSED(event)) {
- wxPaintDC myDC(this);
-
- if (m_bNewNoticeAlert) {
- wxRect r = m_NoticesButton->GetRect();
- if (m_bNoticesButtonIsRed) {
- wxPen oldPen = myDC.GetPen();
- wxBrush oldBrush = myDC.GetBrush();
- int oldMode = myDC.GetBackgroundMode();
- wxPen bgPen(*wxRED, 3);
- myDC.SetBackgroundMode(wxSOLID);
- myDC.SetPen(bgPen);
- myDC.SetBrush(*wxTRANSPARENT_BRUSH);
-#ifdef __WXMAC__
- r.Inflate(2, 2);
- myDC.DrawRoundedRectangle(r.x, r.y, r.width, r.height+1, m_iRedRingRadius);
-#elif defined(__WXMSW__)
- r.Inflate(3, 3);
- myDC.DrawRectangle(r.x, r.y, r.width, r.height);
-#else
- r.Inflate(3, 3);
- myDC.DrawRoundedRectangle(r.x, r.y, r.width, r.height, 6);
-#endif
- // Restore Mode, Pen and Brush
- myDC.SetBackgroundMode(oldMode);
- myDC.SetPen(oldPen);
- myDC.SetBrush(oldBrush);
- }
- }
-}
-
-
-// We don't reliably get EraseBackground events under Linux,
-// so there is a workaround at CSimplePanelBase::MakeBGBitMap()
-void CSimpleGUIPanel::OnEraseBackground(wxEraseEvent& event) {
- wxDC *dc = event.GetDC();
-
-#ifdef __WXMAC__
- // Avoid unnecessary drawing due to Mac progress indicator's animation
- wxRect clipRect;
- wxRect taskRect = m_taskPanel->GetRect();
- dc->GetClippingBox(&clipRect.x, &clipRect.y, &clipRect.width, &clipRect.height);
- if (clipRect.IsEmpty() || taskRect.Contains(clipRect)) {
- return;
- }
-#endif
- dc->DrawBitmap(m_bmpBg, 0, 0);
-}
+// This file is part of BOINC.
+// http://boinc.berkeley.edu
+// Copyright (C) 2008 University of California
+//
+// BOINC is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation,
+// either version 3 of the License, or (at your option) any later version.
+//
+// BOINC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with BOINC. If not, see .
+
+
+#if defined(__GNUG__) && !defined(__APPLE__)
+#pragma implementation "sg_BoincSimpleFrame.h"
+#endif
+
+#include "stdwx.h"
+#ifdef __WXMAC__
+#include "MacAccessiblity.h"
+#endif
+#include "diagnostics.h"
+#include "str_util.h"
+#include "mfile.h"
+#include "miofile.h"
+#include "parse.h"
+#include "error_numbers.h"
+#include "BOINCGUIApp.h"
+#include "SkinManager.h"
+#include "MainDocument.h"
+#include "Events.h"
+#include "BOINCBaseFrame.h"
+#include "wizardex.h"
+#include "BOINCBaseWizard.h"
+#include "WizardAttach.h"
+#include "error_numbers.h"
+#include "version.h"
+
+#include "sg_BoincSimpleFrame.h"
+#include "sg_TaskPanel.h"
+#include "sg_ProjectPanel.h"
+#include "sg_DlgMessages.h"
+#include "sg_DlgPreferences.h"
+#include "DlgEventLog.h"
+#include "DlgAbout.h"
+#include "DlgOptions.h"
+
+// Workaround for Linux refresh problem
+#if (defined(__WXMSW__) || defined(__WXMAC__))
+#define REFRESH_WAIT 0
+#else
+#define REFRESH_WAIT 1
+#endif
+
+IMPLEMENT_DYNAMIC_CLASS(CSimpleFrame, CBOINCBaseFrame)
+
+BEGIN_EVENT_TABLE(CSimpleFrame, CBOINCBaseFrame)
+ EVT_SIZE(CSimpleFrame::OnSize)
+ EVT_MENU(ID_CHANGEGUI, CSimpleFrame::OnChangeGUI)
+ EVT_MENU(ID_SGDEFAULTSKINSELECTOR, CSimpleFrame::OnSelectDefaultSkin)
+ EVT_MENU_RANGE(ID_SGFIRSTSKINSELECTOR, ID_LASTSGSKINSELECTOR, CSimpleFrame::OnSelectSkin)
+ EVT_HELP(wxID_ANY, CSimpleFrame::OnHelp)
+ EVT_FRAME_CONNECT(CSimpleFrame::OnConnect)
+ EVT_FRAME_RELOADSKIN(CSimpleFrame::OnReloadSkin)
+ EVT_FRAME_NOTIFICATION(CSimpleFrame::OnNotification)
+ EVT_MENU(ID_PREFERENCES, CSimpleFrame::OnPreferences)
+ EVT_MENU(ID_SGOPTIONS, CSimpleFrame::OnOptions)
+ EVT_MENU(ID_HELPBOINC, CSimpleFrame::OnHelpBOINC)
+ EVT_MENU(ID_HELPBOINCMANAGER, CSimpleFrame::OnHelpBOINC)
+ EVT_MENU(ID_HELPBOINCWEBSITE, CSimpleFrame::OnHelpBOINC)
+ EVT_MENU(wxID_ABOUT, CSimpleFrame::OnHelpAbout)
+ EVT_MENU(ID_EVENTLOG, CSimpleFrame::OnEventLog)
+END_EVENT_TABLE()
+
+
+CSimpleFrame::CSimpleFrame() {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Default Constructor Function Begin"));
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Default Constructor Function End"));
+}
+
+
+CSimpleFrame::CSimpleFrame(wxString title, wxIcon* icon, wxIcon* icon32, wxPoint position, wxSize size) :
+ CBOINCBaseFrame((wxFrame *)NULL, ID_SIMPLEFRAME, title, position, size,
+ wxMINIMIZE_BOX | wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN)
+{
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame:: - Overloaded Constructor Function Begin"));
+
+ // Initialize Application
+ wxIconBundle icons;
+ icons.AddIcon(*icon);
+ icons.AddIcon(*icon32);
+ SetIcons(icons);
+
+ CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
+ wxString strMenuName;
+ wxString strMenuDescription;
+
+ wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
+
+ // File menu
+ wxMenu *menuFile = new wxMenu;
+
+ // %s is the application name
+ // i.e. 'BOINC Manager', 'GridRepublic Manager'
+ strMenuDescription.Printf(
+ _("Close the %s window"),
+ pSkinAdvanced->GetApplicationName().c_str()
+ );
+ strMenuName = _("&Close Window");
+ strMenuName += wxT("\tCtrl+W");
+ menuFile->Append(
+ ID_CLOSEWINDOW,
+ strMenuName,
+ strMenuDescription
+ );
+
+ // Skins submenu
+ m_pSubmenuSkins = new wxMenu;
+
+ BuildSkinSubmenu(m_pSubmenuSkins);
+
+ // All other skin names will be appended as radio
+ // menu items with ID_SGFIRSTSKINSELECTOR + index
+
+ // View menu
+ wxMenu *menuView = new wxMenu;
+
+ menuView->Append(
+ ID_CHANGEGUI,
+ _("Advanced View...\tCtrl+Shift+A"),
+ _("Display the advanced graphical interface.")
+ );
+
+ menuView->AppendSeparator();
+
+ menuView->Append(
+ ID_SGSKINSELECTOR,
+ _("Skin"),
+ m_pSubmenuSkins,
+ _("Select the appearance of the user interface.")
+ );
+
+ // Skins sumenu always contains the Default entry
+ if (m_pSubmenuSkins->GetMenuItemCount() <= 1) {
+ menuView->Enable(ID_SGSKINSELECTOR, false);
+ }
+
+ // Tools menu
+ wxMenu *menuTools = new wxMenu;
+
+ menuTools->Append(
+ ID_PREFERENCES,
+ _("Computing &preferences..."),
+ _("Configure computing preferences")
+ );
+
+ menuTools->Append(
+ ID_SGOPTIONS,
+ _("&Options..."),
+ _("Configure display options and proxy settings")
+ );
+
+ // Help menu
+ wxMenu *menuHelp = new wxMenu;
+
+ // %s is the project name
+ // i.e. 'BOINC Manager', 'GridRepublic'
+ strMenuName.Printf(
+ _("%s &help"),
+ pSkinAdvanced->GetApplicationShortName().c_str()
+ );
+ // %s is the project name
+ // i.e. 'BOINC', 'GridRepublic'
+ strMenuDescription.Printf(
+ _("Show information about %s"),
+ pSkinAdvanced->GetApplicationShortName().c_str()
+ );
+ menuHelp->Append(
+ ID_HELPBOINC,
+ strMenuName,
+ strMenuDescription
+ );
+
+ // %s is the application name
+ // i.e. 'BOINC Manager', 'GridRepublic Manager'
+ strMenuName.Printf(
+ _("&%s"),
+ pSkinAdvanced->GetApplicationName().c_str()
+ );
+ // %s is the application name
+ // i.e. 'BOINC Manager', 'GridRepublic Manager'
+ strMenuDescription.Printf(
+ _("Show information about the %s"),
+ pSkinAdvanced->GetApplicationName().c_str()
+ );
+ menuHelp->Append(
+ ID_HELPBOINCMANAGER,
+ strMenuName,
+ strMenuDescription
+ );
+
+ // %s is the project name
+ // i.e. 'BOINC', 'GridRepublic'
+ strMenuName.Printf(
+ _("%s &website"),
+ pSkinAdvanced->GetApplicationShortName().c_str()
+ );
+ // %s is the application name
+ // i.e. 'BOINC Manager', 'GridRepublic Manager'
+ strMenuDescription.Printf(
+ _("Show information about BOINC and %s"),
+ pSkinAdvanced->GetApplicationName().c_str()
+ );
+ menuHelp->Append(
+ ID_HELPBOINCWEBSITE,
+ strMenuName,
+ strMenuDescription
+ );
+
+ // %s is the project name
+ // i.e. 'BOINC Manager', 'GridRepublic Manager'
+ strMenuName.Printf(
+ _("&About %s..."),
+ pSkinAdvanced->GetApplicationName().c_str()
+ );
+ menuHelp->Append(
+ wxID_ABOUT,
+ strMenuName,
+ _("Licensing and copyright information.")
+ );
+
+ // construct menu
+ m_pMenubar = new wxMenuBar;
+ m_pMenubar->Append(
+ menuFile,
+ _("&File")
+ );
+ m_pMenubar->Append(
+ menuView,
+ _("&View")
+ );
+ m_pMenubar->Append(
+ menuTools,
+ _("&Tools")
+ );
+ m_pMenubar->Append(
+ menuHelp,
+ _("&Help")
+ );
+
+ wxMenuBar* m_pOldMenubar = GetMenuBar();
+ SetMenuBar(m_pMenubar);
+ if (m_pOldMenubar) {
+ delete m_pOldMenubar;
+ }
+
+#ifdef __WXGTK__
+ // Force a redraw of the menu under Ubuntu's new interface
+ SendSizeEvent();
+#endif
+#ifdef __WXMAC__
+ m_pMenubar->MacInstallMenuBar();
+ MacLocalizeBOINCMenu();
+
+ // Enable Mac OS X's standard Preferences menu item (handled in MacSysMenu.cpp)
+ EnableMenuCommand(NULL, kHICommandPreferences);
+#endif
+
+ m_Shortcuts[0].Set(wxACCEL_NORMAL, WXK_HELP, ID_HELPBOINCMANAGER);
+#ifdef __WXMAC__
+ m_Shortcuts[1].Set(wxACCEL_CMD|wxACCEL_SHIFT, (int)'E', ID_EVENTLOG);
+#else
+ m_Shortcuts[1].Set(wxACCEL_CTRL|wxACCEL_SHIFT, (int)'E', ID_EVENTLOG);
+#endif
+ m_pAccelTable = new wxAcceleratorTable(2, m_Shortcuts);
+
+ SetAcceleratorTable(*m_pAccelTable);
+
+ dlgMsgsPtr = NULL;
+ m_pBackgroundPanel = new CSimpleGUIPanel(this);
+
+ RestoreState();
+}
+
+
+CSimpleFrame::~CSimpleFrame() {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Destructor Function Begin"));
+
+ SaveState();
+
+ if (m_pAccelTable)
+ delete m_pAccelTable;
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::CSimpleFrame - Destructor Function End"));
+}
+
+
+bool CSimpleFrame::SaveState() {
+ CBOINCBaseFrame::SaveState();
+ wxConfigBase* pConfig = wxConfigBase::Get(FALSE);
+ wxString strBaseConfigLocation = wxString(wxT("/Simple"));
+
+ wxASSERT(pConfig);
+
+ // An odd case happens every once and awhile where wxWidgets looses
+ // the pointer to the config object, or it is cleaned up before
+ // the window has finished it's cleanup duty. If we detect a NULL
+ // pointer, return false.
+ if (!pConfig) return false;
+
+ //
+ // Save Frame State
+ //
+ pConfig->SetPath(strBaseConfigLocation);
+
+ pConfig->Write(wxT("XPos"), GetPosition().x);
+ pConfig->Write(wxT("YPos"), GetPosition().y);
+
+ return true;
+}
+
+
+bool CSimpleFrame::RestoreState() {
+ CBOINCBaseFrame::RestoreState();
+ return true;
+}
+
+
+int CSimpleFrame::_GetCurrentViewPage() {
+ if (isMessagesDlgOpen()) {
+ return VW_SGUI | VW_SMSG;
+ } else {
+ return VW_SGUI;
+ }
+ return 0; // Should never happen.
+}
+
+
+void CSimpleFrame::OnChangeGUI(wxCommandEvent& WXUNUSED(event)) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnChangeGUI - Function Begin"));
+
+ wxGetApp().SetActiveGUI(BOINC_ADVANCEDGUI, true);
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnChangeGUI - Function End"));
+}
+
+
+void CSimpleFrame::BuildSkinSubmenu( wxMenu *submenu) {
+ unsigned int i;
+ wxMenuItem *skinItem;
+ wxArrayString astrSkins;
+ wxString strSelectedSkin;
+ CSkinManager* pSkinManager = wxGetApp().GetSkinManager();
+
+ wxASSERT(pSkinManager);
+ wxASSERT(wxDynamicCast(pSkinManager, CSkinManager));
+
+
+ // The "Default" skin menu item is localized, but
+ // the name of the default skin is not localized
+ skinItem = submenu->AppendRadioItem(
+ ID_SGDEFAULTSKINSELECTOR,
+ _("Default")
+ );
+
+ astrSkins = pSkinManager->GetCurrentSkins();
+ strSelectedSkin = pSkinManager->GetSelectedSkin();
+
+ if (strSelectedSkin == pSkinManager->GetDefaultSkinName()) {
+ skinItem->Check(true);
+ }
+
+ // Skins list always contains the Default entry
+ if (astrSkins.GetCount() <= 1) {
+ skinItem->Check(true);
+ skinItem->Enable(false);
+ return; // No non-default skins
+ }
+
+// I'd like to put a separator here, but we can't separate radio items
+
+ for (i = 0; i < astrSkins.GetCount(); i++) {
+ if (astrSkins[i] == pSkinManager->GetDefaultSkinName()) {
+ continue;
+ }
+
+ skinItem = submenu->AppendRadioItem(
+ ID_SGFIRSTSKINSELECTOR + i,
+ astrSkins[i]
+ );
+ if (astrSkins[i] == strSelectedSkin) {
+ skinItem->Check(true);
+ }
+ }
+}
+
+
+
+void CSimpleFrame::OnSelectDefaultSkin( wxCommandEvent& WXUNUSED(event) ) {
+ CSkinManager* pSkinManager = wxGetApp().GetSkinManager();
+
+ wxASSERT(pSkinManager);
+ wxASSERT(wxDynamicCast(pSkinManager, CSkinManager));
+
+ // The "Default" skin menu item is localized, but
+ // the name of the default skin is not localized
+ pSkinManager->ReloadSkin(pSkinManager->GetDefaultSkinName());
+}
+
+
+void CSimpleFrame::OnSelectSkin( wxCommandEvent& event ){
+ CSkinManager *pSkinManager = wxGetApp().GetSkinManager();
+ wxMenuItem *oldItem, *selectedItem;
+ wxMenuBar *pMenuBar = GetMenuBar();
+ int newSkinId = event.GetId();
+ int oldSkinID;
+
+ wxASSERT(pSkinManager);
+ wxASSERT(wxDynamicCast(pSkinManager, CSkinManager));
+
+
+ selectedItem = pMenuBar->FindItem(newSkinId);
+ if (!selectedItem) return;
+
+ wxString oldSkinName = pSkinManager->GetSelectedSkin();
+ wxString newSkinName = selectedItem->GetItemLabelText();
+ if (newSkinName == oldSkinName) return;
+
+ if (oldSkinName == pSkinManager->GetDefaultSkinName()) {
+ // The "Default" skin menu item is localized, but
+ // the name of the default skin is not localized
+ oldSkinID = ID_SGDEFAULTSKINSELECTOR;
+ } else {
+ oldSkinID = m_pSubmenuSkins->FindItem(oldSkinName);
+ }
+ oldItem = m_pSubmenuSkins->FindItem(oldSkinID);
+ if (oldItem) {
+ oldItem->Check(false);
+ }
+
+ selectedItem->Check(true);
+ pSkinManager->ReloadSkin(newSkinName);
+}
+
+
+void CSimpleFrame::OnPreferences(wxCommandEvent& WXUNUSED(event)) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnPreferences - Function Begin"));
+
+ m_pBackgroundPanel->SetDlgOpen(true);
+
+ CDlgPreferences dlg(GetParent());
+ dlg.ShowModal();
+
+ m_pBackgroundPanel->SetDlgOpen(false);
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnPreferences - Function End"));
+}
+
+
+void CSimpleFrame::OnOptions(wxCommandEvent& WXUNUSED(event)) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnOptions - Function Begin"));
+
+ m_pBackgroundPanel->SetDlgOpen(true);
+
+// TODO: Create simple language selection dialog
+ CDlgOptions dlg(this);
+ dlg.ShowModal();
+
+ m_pBackgroundPanel->SetDlgOpen(false);
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnOptions - Function End"));
+}
+
+
+// TODO: Create ID_HELPBOINCMANAGER web page for each organization for new BOINC version
+void CSimpleFrame::OnHelpBOINC(wxCommandEvent& event) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelpBOINC - Function Begin"));
+
+ if (IsShown()) {
+ wxString strURL = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl();
+
+ wxString wxurl;
+ wxurl.Printf(
+ wxT("%s?target=simple&version=%s&controlid=%d"),
+ strURL.c_str(),
+ wxString(BOINC_VERSION_STRING, wxConvUTF8).c_str(),
+ event.GetId()
+ );
+ wxLaunchDefaultBrowser(wxurl);
+ }
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelpBOINC - Function End"));
+}
+
+
+void CSimpleFrame::OnHelpAbout(wxCommandEvent& /*event*/) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelpAbout - Function Begin"));
+
+ m_pBackgroundPanel->SetDlgOpen(true);
+
+ CDlgAbout dlg(this);
+ dlg.ShowModal();
+
+ m_pBackgroundPanel->SetDlgOpen(false);
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelpAbout - Function End"));
+}
+
+
+void CSimpleFrame::OnHelp(wxHelpEvent& event) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelp - Function Begin"));
+
+ if (IsShown()) {
+ wxString strURL = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl();
+
+ wxString wxurl;
+ wxurl.Printf(
+ wxT("%s?target=simple&version=%s&controlid=%d"),
+ strURL.c_str(),
+ wxString(BOINC_VERSION_STRING, wxConvUTF8).c_str(),
+ event.GetId()
+ );
+ wxLaunchDefaultBrowser(wxurl);
+ }
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnHelp - Function End"));
+}
+
+
+void CSimpleFrame::OnReloadSkin(CFrameEvent& WXUNUSED(event)) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnReloadSkin - Function Start"));
+
+ m_pBackgroundPanel->ReskinInterface();
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnReloadSkin - Function End"));
+}
+
+
+void CSimpleFrame::OnNotification(CFrameEvent& WXUNUSED(event)) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnNotification - Function Begin"));
+
+ CDlgMessages dlg(GetParent());
+
+ m_pBackgroundPanel->SetDlgOpen(true);
+ SetMsgsDlgOpen(&dlg);
+
+ m_pBackgroundPanel->NoticesViewed();
+ dlg.ShowModal();
+
+ m_pBackgroundPanel->SetDlgOpen(false);
+ SetMsgsDlgOpen(NULL);
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnNotification - Function End"));
+}
+
+
+void CSimpleFrame::OnRefreshView(CFrameEvent& WXUNUSED(event)) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnRefreshView - Function Start"));
+
+ m_pBackgroundPanel->OnFrameRender();
+
+ if (dlgMsgsPtr) {
+ dlgMsgsPtr->OnRefresh();
+ }
+
+#ifdef __WXMAC__
+ // We disabled tooltips on Mac while menus were popped up because they cover menus
+ wxToolTip::Enable(true);
+#endif
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnRefreshView - Function End"));
+}
+
+
+void CSimpleFrame::OnProjectsAttachToProject() {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnProjectsAttachToProject - Function Begin"));
+
+ CMainDocument* pDoc = wxGetApp().GetDocument();
+
+ wxASSERT(pDoc);
+ wxASSERT(wxDynamicCast(pDoc, CMainDocument));
+
+ if (!pDoc->IsUserAuthorized())
+ return;
+
+ if (pDoc->IsConnected()) {
+
+ CWizardAttach* pWizard = new CWizardAttach(this);
+
+ wxString strName = wxEmptyString;
+ wxString strURL = wxEmptyString;
+ wxString strTeamName = wxEmptyString;
+ pWizard->Run( strName, strURL, strTeamName, false );
+
+ if (pWizard)
+ pWizard->Destroy();
+
+ } else {
+ ShowNotCurrentlyConnectedAlert();
+ }
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnProjectsAttachToProject - Function End"));
+}
+
+
+void CSimpleFrame::OnConnect(CFrameEvent& WXUNUSED(event)) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnConnect - Function Begin"));
+
+ CMainDocument* pDoc = wxGetApp().GetDocument();
+ CWizardAttach* pWizard = NULL;
+ wxString strComputer = wxEmptyString;
+ wxString strName = wxEmptyString;
+ wxString strURL = wxEmptyString;
+ wxString strTeamName = wxEmptyString;
+ bool bCachedCredentials = false;
+ ACCT_MGR_INFO ami;
+ PROJECT_INIT_STATUS pis;
+ CC_STATUS status;
+
+ wxASSERT(pDoc);
+ wxASSERT(wxDynamicCast(pDoc, CMainDocument));
+
+ pDoc->ForceCacheUpdate();
+ pDoc->GetCoreClientStatus(status, true);
+
+#ifdef __WXMAC__
+ wxGetApp().GetMacSystemMenu()->BuildMenu();
+#endif
+
+ // If we are connected to the localhost, run a really quick screensaver
+ // test to trigger a firewall popup.
+ pDoc->GetConnectedComputerName(strComputer);
+ if (pDoc->IsComputerNameLocal(strComputer)) {
+ wxGetApp().StartBOINCScreensaverTest();
+ wxGetApp().StartBOINCDefaultScreensaverTest();
+ }
+
+
+ pDoc->rpc.get_project_init_status(pis);
+ pDoc->rpc.acct_mgr_info(ami);
+ if (ami.acct_mgr_url.size() && !ami.have_credentials) {
+ if (!IsShown()) {
+ Show();
+ }
+
+ pWizard = new CWizardAttach(this);
+ if (pWizard->SyncToAccountManager()) {
+ // If successful, hide the main window
+ Hide();
+ }
+ } else if ((pis.url.size() || (0 >= pDoc->GetSimpleProjectCount())) && !status.disallow_attach) {
+ if (!IsShown()) {
+ Show();
+ }
+
+ strName = wxString(pis.name.c_str(), wxConvUTF8);
+ strURL = wxString(pis.url.c_str(), wxConvUTF8);
+ strTeamName = wxString(pis.team_name.c_str(), wxConvUTF8);
+ bCachedCredentials = pis.url.length() && pis.has_account_key;
+
+ pWizard = new CWizardAttach(this);
+ pWizard->Run(strName, strURL, strTeamName, bCachedCredentials);
+ }
+
+ if (pWizard) {
+ pWizard->Destroy();
+ m_pBackgroundPanel->UpdateProjectView();
+ }
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnConnect - Function End"));
+}
+
+
+void CSimpleFrame::OnEventLog(wxCommandEvent& WXUNUSED(event)) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnEventLog - Function Begin"));
+
+ wxGetApp().DisplayEventLog();
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnEventLog - Function End"));
+}
+
+
+IMPLEMENT_DYNAMIC_CLASS(CSimpleGUIPanel, wxPanel)
+
+BEGIN_EVENT_TABLE(CSimpleGUIPanel, wxPanel)
+ EVT_SIZE(CSimpleGUIPanel::OnSize)
+ EVT_ERASE_BACKGROUND(CSimpleGUIPanel::OnEraseBackground)
+ EVT_BUTTON(ID_SGNOTICESBUTTON,CSimpleGUIPanel::OnShowNotices)
+ EVT_BUTTON(ID_SGSUSPENDRESUMEBUTTON,CSimpleGUIPanel::OnSuspendResume)
+ EVT_BUTTON(ID_SIMPLE_HELP,CSimpleGUIPanel::OnHelp)
+ EVT_TIMER(ID_SIMPLEMESSAGECHECKTIMER, CSimpleGUIPanel::OnCheckForNewNotices)
+ EVT_PAINT(CSimpleGUIPanel::OnPaint)
+END_EVENT_TABLE()
+
+
+CSimpleGUIPanel::CSimpleGUIPanel() {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::CSimpleGUIPanel - Default Constructor Function Begin"));
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::CSimpleGUIPanel - Default Constructor Function End"));
+}
+
+
+CSimpleGUIPanel::CSimpleGUIPanel(wxWindow* parent) :
+ wxPanel(parent, -1, wxDefaultPosition, wxDefaultSize, wxCLIP_CHILDREN | wxBORDER_NONE)
+{
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::CSimpleGUIPanel - Overloaded Constructor Function Begin"));
+
+ CSkinAdvanced* pSkinAdvanced = wxGetApp().GetSkinManager()->GetAdvanced();
+
+ wxASSERT(pSkinAdvanced);
+ wxASSERT(wxDynamicCast(pSkinAdvanced, CSkinAdvanced));
+
+ m_taskPanel = NULL;
+ m_projPanel = NULL;
+ m_oldWorkCount = 0;
+ m_bNewNoticeAlert = false;
+ m_bNoticesButtonIsRed = false;
+ m_irefreshCount = 0;
+
+ checkForNewNoticesTimer = new wxTimer(this, ID_SIMPLEMESSAGECHECKTIMER);
+ checkForNewNoticesTimer->Start(5000);
+
+ dlgOpen = false;
+ m_sSuspendString = _("Suspend");
+ m_sResumeString = _("Resume");
+ m_sSuspendButtonToolTip = _("Suspend Computing");
+ m_sResumeButtonToolTip = _("Resume Computing");
+
+ m_taskPanel = new CSimpleTaskPanel(this);
+ m_projPanel = new CSimpleProjectPanel(this);
+
+ // Box Sizer
+ mainSizer = new wxBoxSizer(wxVERTICAL);
+ mainSizer->AddSpacer(68);
+ mainSizer->Add(m_taskPanel, 1, wxLEFT | wxRIGHT | wxEXPAND | wxALIGN_CENTER, SIDEMARGINS);
+ mainSizer->AddSpacer(8);
+ mainSizer->Add(m_projPanel, 0, wxLEFT | wxRIGHT | wxEXPAND | wxALIGN_CENTER, SIDEMARGINS);
+ mainSizer->AddSpacer(8);
+
+ wxBoxSizer* buttonsSizer;
+ buttonsSizer = new wxBoxSizer( wxHORIZONTAL );
+
+ m_NoticesButton = new wxButton( this, ID_SGNOTICESBUTTON, _("Notices"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_NoticesButton->SetToolTip( _("Open a window to view notices from projects or BOINC"));
+ buttonsSizer->Add( m_NoticesButton, 0, wxEXPAND | wxALIGN_LEFT, 0 );
+ buttonsSizer->AddStretchSpacer();
+
+ int suspendWidth, resumeWidth, y;
+ GetTextExtent(m_sSuspendString, &suspendWidth, &y);
+ GetTextExtent(m_sResumeString, &resumeWidth, &y);
+
+ m_bIsSuspended = suspendWidth > resumeWidth;
+ m_SuspendResumeButton = new wxButton( this, ID_SGSUSPENDRESUMEBUTTON,
+ m_bIsSuspended ? m_sSuspendString : m_sResumeString,
+ wxDefaultPosition, wxDefaultSize, 0 );
+ m_SuspendResumeButton->SetToolTip(wxEmptyString);
+
+ buttonsSizer->Add( m_SuspendResumeButton, 0, wxEXPAND | wxALIGN_RIGHT, 0 );
+ buttonsSizer->AddStretchSpacer();
+
+ m_HelpButton = new wxButton( this, ID_SIMPLE_HELP, _("Help"), wxDefaultPosition, wxDefaultSize, 0 );
+ buttonsSizer->Add( m_HelpButton, 0, wxEXPAND | wxALIGN_RIGHT, 0 );
+
+ wxString helpTip;
+ helpTip.Printf(_("Get help with %s"), pSkinAdvanced->GetApplicationShortName().c_str());
+ m_HelpButton->SetToolTip(helpTip);
+
+ mainSizer->Add( buttonsSizer, 0, wxLEFT | wxRIGHT | wxEXPAND, 2 * SIDEMARGINS );
+ mainSizer->AddSpacer(10);
+
+ SetSizer(mainSizer);
+ Layout();
+
+ mainSizer->Fit(GetParent());
+
+ SetBackgroundBitmap();
+
+#ifdef __WXMAC__
+ // Tell accessibility aids to ignore this panel (but not its contents)
+ HIObjectSetAccessibilityIgnored((HIObjectRef)GetHandle(), true);
+
+ SInt32 response;
+ OSStatus err = Gestalt(gestaltSystemVersion, &response);
+ if ((err == noErr) && (response >= 0x1070)) {
+ m_iRedRingRadius = 4;
+ } else {
+ m_iRedRingRadius = 12;
+ }
+#endif
+
+ m_SuspendResumeButton->Disable();
+ OnFrameRender();
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::CSimpleGUIPanel - Overloaded Constructor Function End"));
+}
+
+
+CSimpleGUIPanel::~CSimpleGUIPanel()
+{
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::CSimpleGUIPanel - Destructor Function Begin"));
+
+ checkForNewNoticesTimer->Stop();
+ delete checkForNewNoticesTimer;
+ m_bmpBg = wxNullBitmap; // Deletes old bitmap via reference counting
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::CSimpleGUIPanel - Destructor Function End"));
+}
+
+
+void CSimpleGUIPanel::SetBackgroundBitmap() {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::SetBackgroundBitmap - Function Start"));
+
+ CSkinSimple* pSkinSimple = wxGetApp().GetSkinManager()->GetSimple();
+
+ wxASSERT(pSkinSimple);
+ wxASSERT(wxDynamicCast(pSkinSimple, CSkinSimple));
+
+ wxColour bgColor(*pSkinSimple->GetBackgroundImage()->GetBackgroundColor());
+ SetBackgroundColour(bgColor);
+
+ wxRect panelRect = GetRect();
+ m_bmpBg = wxBitmap(panelRect.width, panelRect.height);
+ wxMemoryDC dc(m_bmpBg);
+ wxBrush bgBrush(bgColor);
+ dc.SetBackground(bgBrush);
+ dc.Clear();
+ dc.DrawBitmap(*pSkinSimple->GetBackgroundImage()->GetBitmap(), 0, 0, false);
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::SetBackgroundBitmap - Function End"));
+}
+
+void CSimpleGUIPanel::ReskinInterface() {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::ReskinInterface - Function Start"));
+
+ Freeze();
+ //bg color
+ m_bmpBg = wxNullBitmap; // Deletes old bitmap via reference counting
+ SetBackgroundBitmap();
+
+ m_taskPanel->ReskinInterface();
+ m_projPanel->ReskinInterface();
+
+ Thaw();
+ Refresh();
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::ReskinInterface - Function End"));
+}
+
+
+void CSimpleGUIPanel::OnProjectsAttachToProject() {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::OnProjectsAttachToProject - Function Begin"));
+
+ CSimpleFrame* pFrame = wxDynamicCast(GetParent(), CSimpleFrame);
+ wxASSERT(pFrame);
+
+ pFrame->OnProjectsAttachToProject();
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleFrame::OnProjectsAttachToProject - Function End"));
+}
+
+
+// called from CSimpleFrame::OnRefreshView()
+void CSimpleGUIPanel::OnFrameRender() {
+ CMainDocument* pDoc = wxGetApp().GetDocument();
+ wxASSERT(pDoc);
+ int workCount = pDoc->GetSimpleGUIWorkCount();
+ CC_STATUS status;
+ bool isSuspended;
+
+ // OnFrameRender() may be called while SimpleGUI initialization is
+ // in progress due to completion of a periodic get_messages RPC,
+ // causing unintended recursion in CMainDocument::RequestRPC().
+ // Check for that situation here.
+ if (pDoc->WaitingForRPC()) return;
+
+ // Workaround for Linux refresh problem
+ if (m_irefreshCount < REFRESH_WAIT) {
+ ++m_irefreshCount;
+ m_taskPanel->UpdatePanel(true);
+ return;
+ }
+
+ if (workCount != m_oldWorkCount) {
+ if (workCount < 0) {
+ m_projPanel->Hide();
+ } else if (m_oldWorkCount == 0) {
+ m_projPanel->Show();
+ }
+ this->Layout();
+ ReskinInterface();
+ }
+
+ if (IsShown()) {
+ if ( pDoc->IsConnected() ) {
+
+ // Show Resume or Suspend as appropriate
+ pDoc->GetCoreClientStatus(status);
+
+ isSuspended = (RUN_MODE_NEVER == status.task_mode);
+ if ((isSuspended != m_bIsSuspended) || (!m_SuspendResumeButton->IsEnabled())) {
+ m_bIsSuspended = isSuspended;
+ m_SuspendResumeButton->SetLabel(m_bIsSuspended ? m_sResumeString : m_sSuspendString);
+ m_SuspendResumeButton->SetToolTip(m_bIsSuspended ? m_sResumeButtonToolTip : m_sSuspendButtonToolTip);
+ }
+ m_SuspendResumeButton->Enable();
+ } else {
+ m_SuspendResumeButton->SetToolTip(wxEmptyString);
+ m_SuspendResumeButton->Disable();
+ }
+
+ UpdateProjectView();
+
+ if (m_bNewNoticeAlert) {
+ wxRect r = m_NoticesButton->GetRect();
+ r.Inflate(4, 4);
+ RefreshRect(r, m_bNoticesButtonIsRed);
+ m_bNoticesButtonIsRed = !m_bNoticesButtonIsRed;
+ }
+
+
+ // State changes can cause the BSG to crash if a dialogue is open.
+ // Defer state change until after the dialogue is closed
+ if ( dlgOpen ) {
+ return;
+ }
+
+ m_oldWorkCount = workCount;
+
+ m_taskPanel->UpdatePanel(false);
+ }
+}
+
+
+void CSimpleGUIPanel::UpdateProjectView()
+{
+ //update Project Panel
+ m_projPanel->UpdateInterface();
+}
+
+
+void CSimpleGUIPanel::OnCheckForNewNotices(wxTimerEvent& WXUNUSED(event)) {
+ CMainDocument* pDoc = wxGetApp().GetDocument();
+ if ( pDoc->GetUnreadNoticeCount() ) {
+ m_bNewNoticeAlert = true;
+ checkForNewNoticesTimer->Stop();
+ }
+}
+
+
+void CSimpleGUIPanel::NoticesViewed() {
+ CMainDocument* pDoc = wxGetApp().GetDocument();
+
+ wxASSERT(pDoc);
+
+ m_bNewNoticeAlert = false;
+ m_bNoticesButtonIsRed = false;
+ wxRect r = m_NoticesButton->GetRect();
+ r.Inflate(4, 4);
+ RefreshRect(r, true);
+ m_bNoticesButtonIsRed = !m_bNoticesButtonIsRed;
+ pDoc->UpdateUnreadNoticeState();
+ checkForNewNoticesTimer->Start();
+}
+
+
+void CSimpleGUIPanel::OnShowNotices(wxCommandEvent& /*event*/) {
+ NoticesViewed();
+
+ CDlgMessages dlg(GetParent());
+ SetDlgOpen(true);
+
+ ((CSimpleFrame*)GetParent())->SetMsgsDlgOpen(&dlg);
+
+ dlg.ShowModal();
+
+ SetDlgOpen(false);
+ ((CSimpleFrame*)GetParent())->SetMsgsDlgOpen(NULL);
+}
+
+
+void CSimpleGUIPanel::OnSuspendResume(wxCommandEvent& /*event*/) {
+ CMainDocument* pDoc = wxGetApp().GetDocument();
+ CC_STATUS ccs;
+
+ wxASSERT(pDoc);
+ wxASSERT(wxDynamicCast(pDoc, CMainDocument));
+
+ if (m_bIsSuspended) {
+ pDoc->GetCoreClientStatus(ccs);
+
+ if ((RUN_MODE_NEVER == ccs.task_mode) && (0 >= ccs.task_mode_delay)) {
+ pDoc->SetActivityRunMode(RUN_MODE_AUTO, 0);
+ } else {
+ pDoc->SetActivityRunMode(RUN_MODE_RESTORE, 0);
+ }
+ } else {
+ pDoc->SetActivityRunMode(RUN_MODE_NEVER, 3600);
+ }
+
+ m_SuspendResumeButton->SetLabel(m_bIsSuspended ? m_sResumeString : m_sSuspendString);
+ m_SuspendResumeButton->SetToolTip(m_bIsSuspended ? m_sResumeButtonToolTip : m_sSuspendButtonToolTip);
+}
+
+
+// TODO: Create ID_SIMPLE_HELP web page for each organization for new BOINC version
+void CSimpleGUIPanel::OnHelp(wxCommandEvent& WXUNUSED(event)) {
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::OnHelp - Function Begin"));
+
+ wxString strURL = wxGetApp().GetSkinManager()->GetAdvanced()->GetOrganizationHelpUrl();
+
+ wxString wxurl;
+ wxurl.Printf(
+ wxT("%s?target=simple&version=%s&controlid=%d"),
+ strURL.c_str(),
+ wxString(BOINC_VERSION_STRING, wxConvUTF8).c_str(),
+ ID_SIMPLE_HELP
+
+ );
+
+ wxLaunchDefaultBrowser(wxurl);
+
+ wxLogTrace(wxT("Function Start/End"), wxT("CSimpleGUIPanel::OnHelp - Function End"));
+}
+
+
+void CSimpleGUIPanel::OnPaint(wxPaintEvent& WXUNUSED(event)) {
+ wxPaintDC myDC(this);
+
+ if (m_bNewNoticeAlert) {
+ wxRect r = m_NoticesButton->GetRect();
+ if (m_bNoticesButtonIsRed) {
+ wxPen oldPen = myDC.GetPen();
+ wxBrush oldBrush = myDC.GetBrush();
+ int oldMode = myDC.GetBackgroundMode();
+ wxPen bgPen(*wxRED, 3);
+ myDC.SetBackgroundMode(wxSOLID);
+ myDC.SetPen(bgPen);
+ myDC.SetBrush(*wxTRANSPARENT_BRUSH);
+#ifdef __WXMAC__
+ r.Inflate(2, 2);
+ myDC.DrawRoundedRectangle(r.x, r.y, r.width, r.height+1, m_iRedRingRadius);
+#elif defined(__WXMSW__)
+ r.Inflate(3, 3);
+ myDC.DrawRectangle(r.x, r.y, r.width, r.height);
+#else
+ r.Inflate(3, 3);
+ myDC.DrawRoundedRectangle(r.x, r.y, r.width, r.height, 6);
+#endif
+ // Restore Mode, Pen and Brush
+ myDC.SetBackgroundMode(oldMode);
+ myDC.SetPen(oldPen);
+ myDC.SetBrush(oldBrush);
+ }
+ }
+}
+
+
+// We don't reliably get EraseBackground events under Linux,
+// so there is a workaround at CSimplePanelBase::MakeBGBitMap()
+void CSimpleGUIPanel::OnEraseBackground(wxEraseEvent& event) {
+ wxDC *dc = event.GetDC();
+
+#ifdef __WXMAC__
+ // Avoid unnecessary drawing due to Mac progress indicator's animation
+ wxRect clipRect;
+ wxRect taskRect = m_taskPanel->GetRect();
+ dc->GetClippingBox(&clipRect.x, &clipRect.y, &clipRect.width, &clipRect.height);
+ if (clipRect.IsEmpty() || taskRect.Contains(clipRect)) {
+ return;
+ }
+#endif
+ dc->DrawBitmap(m_bmpBg, 0, 0);
+}
diff --git a/clientscr/boinc_ss_opengl.h b/clientscr/boinc_ss_opengl.h
index 0da0c34c10..50ec622857 100644
--- a/clientscr/boinc_ss_opengl.h
+++ b/clientscr/boinc_ss_opengl.h
@@ -1,17 +1,17 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by boinc_ss.rc
-//
-#define IDI_MAIN_ICON 1
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_3D_CONTROLS 1
-#define _APS_NEXT_RESOURCE_VALUE 109
-#define _APS_NEXT_COMMAND_VALUE 40000
-#define _APS_NEXT_CONTROL_VALUE 1007
-#define _APS_NEXT_SYMED_VALUE 102
-#endif
-#endif
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by boinc_ss.rc
+//
+#define IDI_MAIN_ICON 1
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_3D_CONTROLS 1
+#define _APS_NEXT_RESOURCE_VALUE 109
+#define _APS_NEXT_COMMAND_VALUE 40000
+#define _APS_NEXT_CONTROL_VALUE 1007
+#define _APS_NEXT_SYMED_VALUE 102
+#endif
+#endif
diff --git a/clientscr/boinc_ss_opengl.rc b/clientscr/boinc_ss_opengl.rc
index 40fddc7006..0dba83f32b 100644
--- a/clientscr/boinc_ss_opengl.rc
+++ b/clientscr/boinc_ss_opengl.rc
@@ -1,251 +1,251 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "boinc_ss_opengl.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "winresrc.h"
-#include "version.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Icon
-//
-
-// Icon with lowest ID value placed first to ensure application icon
-// remains consistent on all systems.
-#if defined(_GRIDREPUBLIC)
-IDI_MAIN_ICON ICON "res\\gridrepublic.ico"
-#elif defined(_CHARITYENGINE)
-IDI_MAIN_ICON ICON "res\\ce.ico"
-#elif defined(_WCG)
-IDI_MAIN_ICON ICON "res\\wcg.ico"
-#else
-IDI_MAIN_ICON ICON "res\\icon.ico"
-#endif
-
-/////////////////////////////////////////////////////////////////////////////
-
-#endif // Neutral resources
-
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "boinc_ss_opengl.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""winresrc.h""\r\n"
- "#include ""version.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Visual Studio 2005 Compatibility
-//
-#ifndef IDC_STATIC
-#define IDC_STATIC (-1) // all static controls
-#endif
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-#if defined(_GRIDREPUBLIC)
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "GridRepublic"
- VALUE "FileDescription", "BOINC Screensaver"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boinc_ss"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boinc.scr"
- VALUE "ProductName", "BOINC client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#elif defined(_CHARITYENGINE)
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "Charity Engine"
- VALUE "FileDescription", "Charity Engine Screensaver"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boinc_ss"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boinc.scr"
- VALUE "ProductName", "BOINC client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#elif defined(_WCG)
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "World Community Grid"
- VALUE "FileDescription", "BOINC Screensaver"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boinc_ss"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boinc.scr"
- VALUE "ProductName", "BOINC client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#else
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "Space Sciences Laboratory"
- VALUE "FileDescription", "BOINC Screensaver"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boinc_ss"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boinc.scr"
- VALUE "ProductName", "BOINC client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
+// Microsoft Visual C++ generated resource script.
+//
+#include "boinc_ss_opengl.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winresrc.h"
+#include "version.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Neutral resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
+#ifdef _WIN32
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+#if defined(_GRIDREPUBLIC)
+IDI_MAIN_ICON ICON "res\\gridrepublic.ico"
+#elif defined(_CHARITYENGINE)
+IDI_MAIN_ICON ICON "res\\ce.ico"
+#elif defined(_WCG)
+IDI_MAIN_ICON ICON "res\\wcg.ico"
+#else
+IDI_MAIN_ICON ICON "res\\icon.ico"
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+
+#endif // Neutral resources
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "boinc_ss_opengl.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""winresrc.h""\r\n"
+ "#include ""version.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Visual Studio 2005 Compatibility
+//
+#ifndef IDC_STATIC
+#define IDC_STATIC (-1) // all static controls
+#endif
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+#if defined(_GRIDREPUBLIC)
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "GridRepublic"
+ VALUE "FileDescription", "BOINC Screensaver"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boinc_ss"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boinc.scr"
+ VALUE "ProductName", "BOINC client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#elif defined(_CHARITYENGINE)
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Charity Engine"
+ VALUE "FileDescription", "Charity Engine Screensaver"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boinc_ss"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boinc.scr"
+ VALUE "ProductName", "BOINC client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#elif defined(_WCG)
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "World Community Grid"
+ VALUE "FileDescription", "BOINC Screensaver"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boinc_ss"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boinc.scr"
+ VALUE "ProductName", "BOINC client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#else
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Space Sciences Laboratory"
+ VALUE "FileDescription", "BOINC Screensaver"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boinc_ss"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boinc.scr"
+ VALUE "ProductName", "BOINC client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/clientscr/screensaver.cpp b/clientscr/screensaver.cpp
index 8d692710fe..0cefd2013b 100644
--- a/clientscr/screensaver.cpp
+++ b/clientscr/screensaver.cpp
@@ -1,866 +1,866 @@
-// This file is part of BOINC.
-// http://boinc.berkeley.edu
-// Copyright (C) 2008 University of California
-//
-// BOINC is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation,
-// either version 3 of the License, or (at your option) any later version.
-//
-// BOINC is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with BOINC. If not, see .
-
-// Screensaver coordinator.
-// Alternates between a "default screensaver"
-// and application graphics for running jobs.
-// Periods are configurable via config file "ss_config.xml".
-// See http://boinc.berkeley.edu/trac/wiki/ScreensaverEnhancements
-
-#ifdef _WIN32
-#include "boinc_win.h"
-#endif
-
-#ifdef __APPLE__
-#include
-#include
-#endif
-
-// Common application includes
-//
-#include "diagnostics.h"
-#include "common_defs.h"
-#include "util.h"
-#include "common_defs.h"
-#include "filesys.h"
-#include "error_numbers.h"
-#include "gui_rpc_client.h"
-#include "str_util.h"
-#include "str_replace.h"
-#include "screensaver.h"
-
-// Platform specific application includes
-//
-#if defined(_WIN32)
-#include "screensaver_win.h"
-typedef HANDLE GFXAPP_ID;
-#define DataMgmtProcType DWORD WINAPI
-#elif defined(__APPLE__)
-#include "Mac_Saver_Module.h"
-typedef int GFXAPP_ID;
-#define DataMgmtProcType void*
-#endif
-
-
-#ifdef _WIN32
-// Allow for Unicode wide characters
-#define PATH_SEPARATOR (_T("\\"))
-#define THE_DEFAULT_SS_EXECUTABLE (_T(DEFAULT_SS_EXECUTABLE))
-#define THE_SS_CONFIG_FILE (_T(SS_CONFIG_FILE))
-#define DEFAULT_GFX_CANT_CONNECT ERR_CONNECT
-#else
-// Using (_T()) here causes compiler errors on Mac
-#define PATH_SEPARATOR "/"
-#define THE_DEFAULT_SS_EXECUTABLE DEFAULT_SS_EXECUTABLE
-#define THE_SS_CONFIG_FILE SS_CONFIG_FILE
-#define DEFAULT_GFX_CANT_CONNECT (ERR_CONNECT & 0xff)
-#endif
-
-
-// Flags for testing & debugging
-#define SIMULATE_NO_GRAPHICS 0
-
-
-bool CScreensaver::is_same_task(RESULT* taska, RESULT* taskb) {
- if ((taska == NULL) || (taskb == NULL)) return false;
- if (strcmp(taska->name, taskb->name)) return false;
- if (strcmp(taska->project_url, taskb->project_url)) return false;
- return true;
-}
-
-int CScreensaver::count_active_graphic_apps(RESULTS& results, RESULT* exclude) {
- unsigned int i = 0;
- unsigned int graphics_app_count = 0;
-
- // Count the number of active graphics-capable apps excluding the specified result.
- // If exclude is NULL, don't exclude any results.
- //
- for (i = 0; i < results.results.size(); i++) {
- BOINCTRACE(_T("get_random_graphics_app -- active task detected\n"));
- BOINCTRACE(
- _T("get_random_graphics_app -- name = '%s', path = '%s'\n"),
- results.results[i]->name, results.results[i]->graphics_exec_path
- );
-
- if (!strlen(results.results[i]->graphics_exec_path)) continue;
- if (is_same_task(results.results[i], exclude)) continue;
- BOINCTRACE(_T("get_random_graphics_app -- active task detected w/graphics\n"));
-
- graphics_app_count++;
- }
- return graphics_app_count;
-}
-
-
-// Choose a random graphics application out of the vector.
-// Exclude the specified result unless it is the only candidate.
-// If exclude is NULL or an empty string, don't exclude any results.
-//
-RESULT* CScreensaver::get_random_graphics_app(
- RESULTS& results, RESULT* exclude
-) {
- RESULT* rp = NULL;
- unsigned int i = 0;
- unsigned int graphics_app_count = 0;
- unsigned int random_selection = 0;
- unsigned int current_counter = 0;
- RESULT *avoid = exclude;
-
- BOINCTRACE(_T("get_random_graphics_app -- Function Start\n"));
-
- graphics_app_count = count_active_graphic_apps(results, avoid);
- BOINCTRACE(_T("get_random_graphics_app -- graphics_app_count = '%d'\n"), graphics_app_count);
-
- // If no graphics app found other than the one excluded, count again without excluding any
- if ((0 == graphics_app_count) && (avoid != NULL)) {
- avoid = NULL;
- graphics_app_count = count_active_graphic_apps(results, avoid);
- }
-
- // If no graphics app was found, return NULL
- if (0 == graphics_app_count) {
- goto CLEANUP;
- }
-
- // Choose which application to display.
- //
- random_selection = (rand() % graphics_app_count) + 1;
- BOINCTRACE(_T("get_random_graphics_app -- random_selection = '%d'\n"), random_selection);
-
- // find the chosen graphics application.
- //
- for (i = 0; i < results.results.size(); i++) {
- if (!strlen(results.results[i]->graphics_exec_path)) continue;
- if (is_same_task(results.results[i], avoid)) continue;
-
- current_counter++;
- if (current_counter == random_selection) {
- rp = results.results[i];
- break;
- }
- }
-
-CLEANUP:
- BOINCTRACE(_T("get_random_graphics_app -- Function End\n"));
-
- return rp;
-}
-
-
-// Launch a project (science) graphics application
-//
-int CScreensaver::launch_screensaver(RESULT* rp, GFXAPP_ID& graphics_application) {
- int retval = 0;
- if (strlen(rp->graphics_exec_path)) {
- // V6 Graphics
-#ifdef __APPLE__
- // For sandbox security, use gfx_switcher to launch gfx app
- // as user boinc_project and group boinc_project.
- //
- // For unknown reasons, the graphics application exits with
- // "RegisterProcess failed (error = -50)" unless we pass its
- // full path twice in the argument list to execv.
- char* argv[5];
- argv[0] = "gfx_Switcher";
- argv[1] = "-launch_gfx";
- argv[2] = strrchr(rp->slot_path, '/');
- if (*argv[2]) argv[2]++; // Point to the slot number in ascii
-
- argv[3] = "--fullscreen";
- argv[4] = 0;
-
- retval = run_program(
- rp->slot_path,
- m_gfx_Switcher_Path,
- 4,
- argv,
- 0,
- graphics_application
- );
-#else
- char* argv[3];
- argv[0] = "app_graphics"; // not used
- argv[1] = "--fullscreen";
- argv[2] = 0;
- retval = run_program(
- rp->slot_path,
- rp->graphics_exec_path,
- 2,
- argv,
- 0,
- graphics_application
- );
-#endif
- }
- return retval;
-}
-
-
-// Terminate any screensaver graphics application
-//
-int CScreensaver::terminate_v6_screensaver(GFXAPP_ID& graphics_application) {
- int retval = 0;
-
-#ifdef __APPLE__
- // Under sandbox security, use gfx_switcher to kill default gfx app
- // as user boinc_master and group boinc_master. The man page for
- // kill() says the user ID of the process sending the signal must
- // match that of the target process, though in practice that seems
- // not to be true on the Mac.
-
- char current_dir[PATH_MAX];
- char gfx_pid[16];
- pid_t thePID;
- int i;
-
- sprintf(gfx_pid, "%d", graphics_application);
- getcwd( current_dir, sizeof(current_dir));
-
- char* argv[4];
- argv[0] = "gfx_switcher";
- argv[1] = "-kill_gfx";
- argv[2] = gfx_pid;
- argv[3] = 0;
-
- retval = run_program(
- current_dir,
- m_gfx_Switcher_Path,
- 3,
- argv,
- 0,
- thePID
- );
-
- for (i=0; i<200; i++) {
- boinc_sleep(0.01); // Wait 2 seconds max
- // Prevent gfx_switcher from becoming a zombie
- if (waitpid(thePID, 0, WNOHANG) == thePID) {
- break;
- }
- }
-#endif
-
-#ifdef _WIN32
- HWND hBOINCGraphicsWindow = FindWindow(BOINC_WINDOW_CLASS_NAME, NULL);
- if (hBOINCGraphicsWindow) {
- CloseWindow(hBOINCGraphicsWindow);
- Sleep(1000);
- hBOINCGraphicsWindow = FindWindow(BOINC_WINDOW_CLASS_NAME, NULL);
- if (hBOINCGraphicsWindow) {
- kill_program(graphics_application);
- }
- }
-#endif
-
- // For safety, call kill_program even under Apple sandbox security
- kill_program(graphics_application);
- return retval;
-}
-
-
-// Terminate the project (science) graphics application
-//
-int CScreensaver::terminate_screensaver(GFXAPP_ID& graphics_application, RESULT *worker_app) {
- int retval = 0;
-
- if (graphics_application) {
- // V6 Graphics
- if (m_bScience_gfx_running) {
- terminate_v6_screensaver(graphics_application);
- }
- }
- return retval;
-}
-
-
-// Launch the default graphics application
-//
-int CScreensaver::launch_default_screensaver(char *dir_path, GFXAPP_ID& graphics_application) {
- int retval = 0;
- int num_args;
-
-#ifdef __APPLE__
- // For sandbox security, use gfx_switcher to launch default
- // gfx app as user boinc_master and group boinc_master.
- char* argv[6];
-
- argv[0] = "gfx_switcher";
- argv[1] = "-default_gfx";
- argv[2] = THE_DEFAULT_SS_EXECUTABLE; // Will be changed by gfx_switcher
- argv[3] = "--fullscreen";
- argv[4] = 0;
- argv[5] = 0;
- if (!m_bConnected) {
- BOINCTRACE(_T("launch_default_screensaver using --retry_connect argument\n"));
- argv[4] = "--retry_connect";
- num_args = 5;
- } else {
- num_args = 4;
- }
-
- retval = run_program(
- dir_path,
- m_gfx_Switcher_Path,
- num_args,
- argv,
- 0,
- graphics_application
- );
-
- BOINCTRACE(_T("launch_default_screensaver returned %d\n"), retval);
-
-#else
- // For unknown reasons, the graphics application exits with
- // "RegisterProcess failed (error = -50)" unless we pass its
- // full path twice in the argument list to execv on Macs.
-
- char* argv[4];
- char full_path[1024];
-
- strlcpy(full_path, dir_path, sizeof(full_path));
- strlcat(full_path, PATH_SEPARATOR, sizeof(full_path));
- strlcat(full_path, THE_DEFAULT_SS_EXECUTABLE, sizeof(full_path));
-
- argv[0] = full_path; // not used
- argv[1] = "--fullscreen";
- argv[2] = 0;
- argv[3] = 0;
- if (!m_bConnected) {
- BOINCTRACE(_T("launch_default_screensaver using --retry_connect argument\n"));
- argv[2] = "--retry_connect";
- num_args = 3;
- } else {
- num_args = 2;
- }
-
- retval = run_program(
- dir_path,
- full_path,
- num_args,
- argv,
- 0,
- graphics_application
- );
-
- BOINCTRACE(_T("launch_default_screensaver %s returned %d\n"), full_path, retval);
-
-#endif
- return retval;
-}
-
-
-// Terminate the default graphics application
-//
-int CScreensaver::terminate_default_screensaver(GFXAPP_ID& graphics_application) {
- int retval = 0;
-
- if (! graphics_application) return 0;
- retval = terminate_v6_screensaver(graphics_application);
- return retval;
-}
-
-
-// If we cannot connect to the core client:
-// - we retry connecting every 10 seconds
-// - we launch the default graphics application with the argument --retry_connect, so
-// it will continue running and will also retry connecting every 10 seconds.
-//
-// If we successfully connected to the core client, launch the default graphics application
-// without the argument --retry_connect. If it can't connect, it will return immediately
-// with the exit code ERR_CONNECT. In that case, we assume it was blocked by a firewall
-// and so we run only project (science) graphics.
-
-DataMgmtProcType CScreensaver::DataManagementProc() {
- int retval = 0;
- int suspend_reason = 0;
- RESULT* theResult = NULL;
- RESULT* graphics_app_result_ptr = NULL;
- RESULT previous_result;
- // previous_result_ptr = &previous_result when previous_result is valid, else NULL
- RESULT* previous_result_ptr = NULL;
- int iResultCount = 0;
- int iIndex = 0;
- double default_phase_start_time = 0.0;
- double science_phase_start_time = 0.0;
- double last_change_time = 0.0;
- // If we run default screensaver during science phase because no science graphics
- // are available, then shorten next default graphics phase by that much time.
- double default_saver_start_time_in_science_phase = 0.0;
- double default_saver_duration_in_science_phase = 0.0;
-
- SS_PHASE ss_phase = DEFAULT_SS_PHASE;
- bool switch_to_default_gfx = false;
- bool killing_default_gfx = false;
- int exit_status = 0;
-
- char* default_ss_dir_path = NULL;
- char full_path[1024];
-
- BOINCTRACE(_T("CScreensaver::DataManagementProc - Display screen saver loading message\n"));
- SetError(TRUE, SCRAPPERR_BOINCSCREENSAVERLOADING); // No GFX App is running: show moving BOINC logo
-#ifdef _WIN32
- m_tThreadCreateTime = time(0);
-
- // Set the starting point for iterating through the results
- m_iLastResultShown = 0;
- m_tLastResultChangeTime = 0;
-#endif
-
- m_bDefault_ss_exists = false;
- m_bScience_gfx_running = false;
- m_bDefault_gfx_running = false;
- m_bShow_default_ss_first = false;
-
-#ifdef __APPLE__
- default_ss_dir_path = "/Library/Application Support/BOINC Data";
-#else
- default_ss_dir_path = (char*)m_strBOINCInstallDirectory.c_str();
-#endif
-
- strlcpy(full_path, default_ss_dir_path, sizeof(full_path));
- strlcat(full_path, PATH_SEPARATOR, sizeof(full_path));
- strlcat(full_path, THE_DEFAULT_SS_EXECUTABLE, sizeof(full_path));
-
- if (boinc_file_exists(full_path)) {
- m_bDefault_ss_exists = true;
- } else {
- SetError(TRUE, SCRAPPERR_CANTLAUNCHDEFAULTGFXAPP); // No GFX App is running: show moving BOINC logo
- }
-
- if (m_bDefault_ss_exists && m_bShow_default_ss_first) {
- ss_phase = DEFAULT_SS_PHASE;
- default_phase_start_time = dtime();
- science_phase_start_time = 0;
- switch_to_default_gfx = true;
- } else {
- ss_phase = SCIENCE_SS_PHASE;
- default_phase_start_time = 0;
- science_phase_start_time = dtime();
- }
-
- while (true) {
- for (int i = 0; i < 4; i++) {
- // ***
- // *** Things that should be run frequently.
- // *** 4 times per second.
- // ***
-
- // Are we supposed to exit the screensaver?
- if (m_bQuitDataManagementProc) { // If main thread has requested we exit
- BOINCTRACE(_T("CScreensaver::DataManagementProc - Thread told to stop\n"));
- if (m_hGraphicsApplication || graphics_app_result_ptr) {
- if (m_bDefault_gfx_running) {
- BOINCTRACE(_T("CScreensaver::DataManagementProc - Terminating default screensaver\n"));
- terminate_default_screensaver(m_hGraphicsApplication);
- } else {
- BOINCTRACE(_T("CScreensaver::DataManagementProc - Terminating screensaver\n"));
- terminate_screensaver(m_hGraphicsApplication, graphics_app_result_ptr);
- }
- graphics_app_result_ptr = NULL;
- previous_result_ptr = NULL;
- m_hGraphicsApplication = 0;
- }
- BOINCTRACE(_T("CScreensaver::DataManagementProc - Stopping...\n"));
- m_bDataManagementProcStopped = true; // Tell main thread that we exited
- return 0; // Exit the thread
- }
- boinc_sleep(0.25);
- }
-
- // ***
- // *** Things that should be run less frequently.
- // *** 1 time per second.
- // ***
-
- // Blank screen saver?
- if ((m_dwBlankScreen) && (time(0) > m_dwBlankTime) && (m_dwBlankTime > 0)) {
- BOINCTRACE(_T("CScreensaver::DataManagementProc - Time to blank\n"));
- SetError(FALSE, SCRAPPERR_SCREENSAVERBLANKED); // Blanked - hide moving BOINC logo
- m_bQuitDataManagementProc = true;
- continue; // Code above will exit the thread
- }
-
- BOINCTRACE(_T("CScreensaver::DataManagementProc - ErrorMode = '%d', ErrorCode = '%x'\n"), m_bErrorMode, m_hrError);
-
- if (!m_bConnected) {
- HandleRPCError();
- }
-
- if (m_bConnected) {
- // Do we need to get the core client state?
- if (m_bResetCoreState) {
- // Try and get the current state of the CC
- retval = rpc->get_state(state);
- if (retval) {
- // CC may not yet be running
- HandleRPCError();
- continue;
- } else {
- m_bResetCoreState = false;
- }
- }
-
- // Update our task list
- retval = rpc->get_screensaver_tasks(suspend_reason, results);
- if (retval) {
- // rpc call returned error
- HandleRPCError();
- m_bResetCoreState = true;
- continue;
- }
- } else {
- results.clear();
- }
-
- // Time to switch to default graphics phase?
- if (m_bDefault_ss_exists && (ss_phase == SCIENCE_SS_PHASE) && (m_fGFXDefaultPeriod > 0)) {
- if (science_phase_start_time && ((dtime() - science_phase_start_time) > m_fGFXSciencePeriod)) {
- if (!m_bDefault_gfx_running) {
- switch_to_default_gfx = true;
- }
- ss_phase = DEFAULT_SS_PHASE;
- default_phase_start_time = dtime();
- science_phase_start_time = 0;
- if (m_bDefault_gfx_running && default_saver_start_time_in_science_phase) {
- // Remember how long default graphics ran during science phase
- default_saver_duration_in_science_phase += (dtime() - default_saver_start_time_in_science_phase);
- }
- default_saver_start_time_in_science_phase = 0;
- }
- }
-
- // Time to switch to science graphics phase?
- if ((ss_phase == DEFAULT_SS_PHASE) && m_bConnected && (m_fGFXSciencePeriod > 0)) {
- if (default_phase_start_time &&
- ((dtime() - default_phase_start_time + default_saver_duration_in_science_phase)
- > m_fGFXDefaultPeriod)) {
- // BOINCTRACE(_T("CScreensaver::Ending Default phase: now=%f, default_phase_start_time=%f, default_saver_duration_in_science_phase=%f\n"),
- // dtime(), default_phase_start_time, default_saver_duration_in_science_phase);
- ss_phase = SCIENCE_SS_PHASE;
- default_phase_start_time = 0;
- default_saver_duration_in_science_phase = 0;
- science_phase_start_time = dtime();
- if (m_bDefault_gfx_running) {
- default_saver_start_time_in_science_phase = science_phase_start_time;
- }
- switch_to_default_gfx = false;
- }
- }
-
- // Core client suspended?
- if (suspend_reason && !(suspend_reason & (SUSPEND_REASON_CPU_THROTTLE | SUSPEND_REASON_CPU_USAGE))) {
- if (!m_bDefault_gfx_running) {
- SetError(TRUE, m_hrError); // No GFX App is running: show moving BOINC logo
- if (m_bDefault_ss_exists) {
- switch_to_default_gfx = true;
- }
- }
- }
-
- if (switch_to_default_gfx) {
- if (m_bScience_gfx_running) {
- if (m_hGraphicsApplication || previous_result_ptr) {
- // use previous_result_ptr because graphics_app_result_ptr may no longer be valid
- terminate_screensaver(m_hGraphicsApplication, previous_result_ptr);
- if (m_hGraphicsApplication == 0) {
- graphics_app_result_ptr = NULL;
- m_bScience_gfx_running = false;
- } else {
- // HasProcessExited() test will clear m_hGraphicsApplication and graphics_app_result_ptr
- }
- previous_result_ptr = NULL;
- }
- } else {
- if (!m_bDefault_gfx_running) {
- switch_to_default_gfx = false;
- retval = launch_default_screensaver(default_ss_dir_path, m_hGraphicsApplication);
- if (retval) {
- m_hGraphicsApplication = 0;
- previous_result_ptr = NULL;
- graphics_app_result_ptr = NULL;
- m_bDefault_gfx_running = false;
- SetError(TRUE, SCRAPPERR_CANTLAUNCHDEFAULTGFXAPP); // No GFX App is running: show moving BOINC logo
- } else {
- m_bDefault_gfx_running = true;
- if (ss_phase == SCIENCE_SS_PHASE) {
- default_saver_start_time_in_science_phase = dtime();
- }
- SetError(FALSE, SCRAPPERR_BOINCSCREENSAVERLOADING); // A GFX App is running: hide moving BOINC logo
- }
- }
- }
- }
-
- if ((ss_phase == SCIENCE_SS_PHASE) && !switch_to_default_gfx) {
-
-#if SIMULATE_NO_GRAPHICS /* FOR TESTING */
-
- if (!m_bDefault_gfx_running) {
- SetError(TRUE, m_hrError); // No GFX App is running: show moving BOINC logo
- if (m_bDefault_ss_exists) {
- switch_to_default_gfx = true;
- }
- }
-
-#else /* NORMAL OPERATION */
-
- if (m_bScience_gfx_running) {
- // Is the current graphics app's associated task still running?
-
- if ((m_hGraphicsApplication) || (graphics_app_result_ptr)) {
- iResultCount = (int)results.results.size();
- graphics_app_result_ptr = NULL;
-
- // Find the current task in the new results vector (if it still exists)
- for (iIndex = 0; iIndex < iResultCount; iIndex++) {
- theResult = results.results.at(iIndex);
-
- if (is_same_task(theResult, previous_result_ptr)) {
- graphics_app_result_ptr = theResult;
- previous_result = *theResult;
- previous_result_ptr = &previous_result;
- break;
- }
- }
-
- // V6 graphics only: if worker application has stopped running, terminate_screensaver
- if ((graphics_app_result_ptr == NULL) && (m_hGraphicsApplication != 0)) {
- if (previous_result_ptr) {
- BOINCTRACE(_T("CScreensaver::DataManagementProc - %s finished\n"),
- previous_result.graphics_exec_path
- );
- }
- terminate_screensaver(m_hGraphicsApplication, previous_result_ptr);
- previous_result_ptr = NULL;
- if (m_hGraphicsApplication == 0) {
- graphics_app_result_ptr = NULL;
- m_bScience_gfx_running = false;
- // Save previous_result and previous_result_ptr for get_random_graphics_app() call
- } else {
- // HasProcessExited() test will clear m_hGraphicsApplication and graphics_app_result_ptr
- }
- }
-
- if (last_change_time && (m_fGFXChangePeriod > 0) && ((dtime() - last_change_time) > m_fGFXChangePeriod) ) {
- if (count_active_graphic_apps(results, previous_result_ptr) > 0) {
- if (previous_result_ptr) {
- BOINCTRACE(_T("CScreensaver::DataManagementProc - time to change: %s / %s\n"),
- previous_result.name, previous_result.graphics_exec_path
- );
- }
- terminate_screensaver(m_hGraphicsApplication, graphics_app_result_ptr);
- if (m_hGraphicsApplication == 0) {
- graphics_app_result_ptr = NULL;
- m_bScience_gfx_running = false;
- // Save previous_result and previous_result_ptr for get_random_graphics_app() call
- } else {
- // HasProcessExited() test will clear m_hGraphicsApplication and graphics_app_result_ptr
- }
- }
- last_change_time = dtime();
- }
- }
- } // End if (m_bScience_gfx_running)
-
- // If no current graphics app, pick an active task at random
- // and launch its graphics app
- //
- if ((m_bDefault_gfx_running || (m_hGraphicsApplication == 0)) && (graphics_app_result_ptr == NULL)) {
- graphics_app_result_ptr = get_random_graphics_app(results, previous_result_ptr);
- previous_result_ptr = NULL;
-
- if (graphics_app_result_ptr) {
- if (m_bDefault_gfx_running) {
- terminate_default_screensaver(m_hGraphicsApplication);
- killing_default_gfx = true;
- // Remember how long default graphics ran during science phase
- if (default_saver_start_time_in_science_phase) {
- default_saver_duration_in_science_phase += (dtime() - default_saver_start_time_in_science_phase);
- //BOINCTRACE(_T("CScreensaver::During Science phase: now=%f, default_saver_start_time=%f, default_saver_duration=%f\n"),
- // dtime(), default_saver_start_time_in_science_phase, default_saver_duration_in_science_phase);
- }
- default_saver_start_time_in_science_phase = 0;
- // HasProcessExited() test will clear
- // m_hGraphicsApplication and graphics_app_result_ptr
- } else {
- retval = launch_screensaver(graphics_app_result_ptr, m_hGraphicsApplication);
- if (retval) {
- m_hGraphicsApplication = 0;
- previous_result_ptr = NULL;
- graphics_app_result_ptr = NULL;
- m_bScience_gfx_running = false;
- } else {
- // A GFX App is running: hide moving BOINC logo
- //
- SetError(FALSE, SCRAPPERR_BOINCSCREENSAVERLOADING);
- last_change_time = dtime();
- m_bScience_gfx_running = true;
- // Make a local copy of current result, since original pointer
- // may have been freed by the time we perform later tests
- previous_result = *graphics_app_result_ptr;
- previous_result_ptr = &previous_result;
- if (previous_result_ptr) {
- BOINCTRACE(_T("CScreensaver::DataManagementProc - launching %s\n"),
- previous_result.graphics_exec_path
- );
- }
- }
- }
- } else {
- if (!m_bDefault_gfx_running) {
- // We can't run a science graphics app, so run the default graphics if available
- SetError(TRUE, m_hrError);
- if (m_bDefault_ss_exists) {
- switch_to_default_gfx = true;
- }
- }
-
- } // End if no science graphics available
- } // End if no current science graphics app is running
-
-#endif // ! SIMULATE_NO_GRAPHICS
-
- if (switch_to_default_gfx) {
- switch_to_default_gfx = false;
- if (!m_bDefault_gfx_running) {
- retval = launch_default_screensaver(default_ss_dir_path, m_hGraphicsApplication);
- if (retval) {
- m_hGraphicsApplication = 0;
- previous_result_ptr = NULL;
- graphics_app_result_ptr = NULL;
- m_bDefault_gfx_running = false;
- SetError(TRUE, SCRAPPERR_CANTLAUNCHDEFAULTGFXAPP);
- // No GFX App is running: show BOINC logo
- } else {
- m_bDefault_gfx_running = true;
- default_saver_start_time_in_science_phase = dtime();
- SetError(FALSE, SCRAPPERR_BOINCSCREENSAVERLOADING);
- // Default GFX App is running: hide moving BOINC logo
- }
- }
- }
- } // End if ((ss_phase == SCIENCE_SS_PHASE) && !switch_to_default_gfx)
-
-
-
- // Is the graphics app still running?
- if (m_hGraphicsApplication) {
- if (HasProcessExited(m_hGraphicsApplication, exit_status)) {
- // Something has happened to the previously selected screensaver
- // application. Start a different one.
- BOINCTRACE(_T("CScreensaver::DataManagementProc - Graphics application isn't running, start a new one.\n"));
- if (m_bDefault_gfx_running) {
- // If we were able to connect to core client
- // but gfx app can't, don't use it.
- //
- BOINCTRACE(_T("CScreensaver::DataManagementProc - Default graphics application exited with code %d.\n"), exit_status);
- if (!killing_default_gfx) { // If this is an unexpected exit
- if (exit_status == DEFAULT_GFX_CANT_CONNECT) {
- SetError(TRUE, SCRAPPERR_DEFAULTGFXAPPCANTCONNECT);
- // No GFX App is running: show moving BOINC logo
- } else {
- SetError(TRUE, SCRAPPERR_DEFAULTGFXAPPCRASHED);
- // No GFX App is running: show moving BOINC logo
- }
- m_bDefault_ss_exists = false;
- ss_phase = SCIENCE_SS_PHASE;
- }
- killing_default_gfx = false;
- }
- SetError(TRUE, SCRAPPERR_BOINCNOGRAPHICSAPPSEXECUTING);
- // No GFX App is running: show moving BOINC logo
- m_hGraphicsApplication = 0;
- graphics_app_result_ptr = NULL;
- m_bDefault_gfx_running = false;
- m_bScience_gfx_running = false;
- continue;
- }
- }
- } // end while(true)
-}
-
-
-#ifdef _WIN32
-BOOL CScreensaver::HasProcessExited(HANDLE pid_handle, int &exitCode) {
- unsigned long status = 1;
- if (GetExitCodeProcess(pid_handle, &status)) {
- if (status == STILL_ACTIVE) {
- exitCode = 0;
- return false;
- }
- }
- exitCode = (int)status;
- return true;
-}
-#else
-bool CScreensaver::HasProcessExited(pid_t pid, int &exitCode) {
- int status;
- pid_t p;
-
- p = waitpid(pid, &status, WNOHANG);
- exitCode = WEXITSTATUS(status);
- if (p == pid) return true; // process has exited
- if (p == -1) return true; // PID doesn't exist
- exitCode = 0;
- return false;
-}
-#endif
-
-
-void CScreensaver::GetDefaultDisplayPeriods(struct ss_periods &periods) {
- char* default_data_dir_path = NULL;
- char buf[1024];
- FILE* f;
- MIOFILE mf;
-
- periods.GFXDefaultPeriod = GFX_DEFAULT_PERIOD;
- periods.GFXSciencePeriod = GFX_SCIENCE_PERIOD;
- periods.GFXChangePeriod = GFX_CHANGE_PERIOD;
- periods.Show_default_ss_first = false;
-
-#ifdef __APPLE__
- default_data_dir_path = "/Library/Application Support/BOINC Data";
-#else
- default_data_dir_path = (char*)m_strBOINCDataDirectory.c_str();
-#endif
-
- strlcpy(buf, default_data_dir_path, sizeof(buf));
- strlcat(buf, PATH_SEPARATOR, sizeof(buf));
- strlcat(buf, THE_SS_CONFIG_FILE, sizeof(buf));
-
- f = boinc_fopen(buf, "r");
- if (!f) return;
-
- mf.init_file(f);
- XML_PARSER xp(&mf);
-
- while (!xp.get_tag()) {
- if (xp.parse_bool("default_ss_first", periods.Show_default_ss_first)) continue;
- if (xp.parse_double("default_gfx_duration", periods.GFXDefaultPeriod)) continue;
- if (xp.parse_double("science_gfx_duration", periods.GFXSciencePeriod)) continue;
- if (xp.parse_double("science_gfx_change_interval", periods.GFXChangePeriod)) continue;
- }
- fclose(f);
-
- BOINCTRACE(
- _T("CScreensaver::GetDefaultDisplayPeriods: m_bShow_default_ss_first=%d, m_fGFXDefaultPeriod=%f, m_fGFXSciencePeriod=%f, m_fGFXChangePeriod=%f\n"),
- (int)periods.Show_default_ss_first,
- periods.GFXDefaultPeriod,
- periods.GFXSciencePeriod,
- periods.GFXChangePeriod
- );
-}
+// This file is part of BOINC.
+// http://boinc.berkeley.edu
+// Copyright (C) 2008 University of California
+//
+// BOINC is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation,
+// either version 3 of the License, or (at your option) any later version.
+//
+// BOINC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with BOINC. If not, see .
+
+// Screensaver coordinator.
+// Alternates between a "default screensaver"
+// and application graphics for running jobs.
+// Periods are configurable via config file "ss_config.xml".
+// See http://boinc.berkeley.edu/trac/wiki/ScreensaverEnhancements
+
+#ifdef _WIN32
+#include "boinc_win.h"
+#endif
+
+#ifdef __APPLE__
+#include
+#include
+#endif
+
+// Common application includes
+//
+#include "diagnostics.h"
+#include "common_defs.h"
+#include "util.h"
+#include "common_defs.h"
+#include "filesys.h"
+#include "error_numbers.h"
+#include "gui_rpc_client.h"
+#include "str_util.h"
+#include "str_replace.h"
+#include "screensaver.h"
+
+// Platform specific application includes
+//
+#if defined(_WIN32)
+#include "screensaver_win.h"
+typedef HANDLE GFXAPP_ID;
+#define DataMgmtProcType DWORD WINAPI
+#elif defined(__APPLE__)
+#include "Mac_Saver_Module.h"
+typedef int GFXAPP_ID;
+#define DataMgmtProcType void*
+#endif
+
+
+#ifdef _WIN32
+// Allow for Unicode wide characters
+#define PATH_SEPARATOR (_T("\\"))
+#define THE_DEFAULT_SS_EXECUTABLE (_T(DEFAULT_SS_EXECUTABLE))
+#define THE_SS_CONFIG_FILE (_T(SS_CONFIG_FILE))
+#define DEFAULT_GFX_CANT_CONNECT ERR_CONNECT
+#else
+// Using (_T()) here causes compiler errors on Mac
+#define PATH_SEPARATOR "/"
+#define THE_DEFAULT_SS_EXECUTABLE DEFAULT_SS_EXECUTABLE
+#define THE_SS_CONFIG_FILE SS_CONFIG_FILE
+#define DEFAULT_GFX_CANT_CONNECT (ERR_CONNECT & 0xff)
+#endif
+
+
+// Flags for testing & debugging
+#define SIMULATE_NO_GRAPHICS 0
+
+
+bool CScreensaver::is_same_task(RESULT* taska, RESULT* taskb) {
+ if ((taska == NULL) || (taskb == NULL)) return false;
+ if (strcmp(taska->name, taskb->name)) return false;
+ if (strcmp(taska->project_url, taskb->project_url)) return false;
+ return true;
+}
+
+int CScreensaver::count_active_graphic_apps(RESULTS& results, RESULT* exclude) {
+ unsigned int i = 0;
+ unsigned int graphics_app_count = 0;
+
+ // Count the number of active graphics-capable apps excluding the specified result.
+ // If exclude is NULL, don't exclude any results.
+ //
+ for (i = 0; i < results.results.size(); i++) {
+ BOINCTRACE(_T("get_random_graphics_app -- active task detected\n"));
+ BOINCTRACE(
+ _T("get_random_graphics_app -- name = '%s', path = '%s'\n"),
+ results.results[i]->name, results.results[i]->graphics_exec_path
+ );
+
+ if (!strlen(results.results[i]->graphics_exec_path)) continue;
+ if (is_same_task(results.results[i], exclude)) continue;
+ BOINCTRACE(_T("get_random_graphics_app -- active task detected w/graphics\n"));
+
+ graphics_app_count++;
+ }
+ return graphics_app_count;
+}
+
+
+// Choose a random graphics application out of the vector.
+// Exclude the specified result unless it is the only candidate.
+// If exclude is NULL or an empty string, don't exclude any results.
+//
+RESULT* CScreensaver::get_random_graphics_app(
+ RESULTS& results, RESULT* exclude
+) {
+ RESULT* rp = NULL;
+ unsigned int i = 0;
+ unsigned int graphics_app_count = 0;
+ unsigned int random_selection = 0;
+ unsigned int current_counter = 0;
+ RESULT *avoid = exclude;
+
+ BOINCTRACE(_T("get_random_graphics_app -- Function Start\n"));
+
+ graphics_app_count = count_active_graphic_apps(results, avoid);
+ BOINCTRACE(_T("get_random_graphics_app -- graphics_app_count = '%d'\n"), graphics_app_count);
+
+ // If no graphics app found other than the one excluded, count again without excluding any
+ if ((0 == graphics_app_count) && (avoid != NULL)) {
+ avoid = NULL;
+ graphics_app_count = count_active_graphic_apps(results, avoid);
+ }
+
+ // If no graphics app was found, return NULL
+ if (0 == graphics_app_count) {
+ goto CLEANUP;
+ }
+
+ // Choose which application to display.
+ //
+ random_selection = (rand() % graphics_app_count) + 1;
+ BOINCTRACE(_T("get_random_graphics_app -- random_selection = '%d'\n"), random_selection);
+
+ // find the chosen graphics application.
+ //
+ for (i = 0; i < results.results.size(); i++) {
+ if (!strlen(results.results[i]->graphics_exec_path)) continue;
+ if (is_same_task(results.results[i], avoid)) continue;
+
+ current_counter++;
+ if (current_counter == random_selection) {
+ rp = results.results[i];
+ break;
+ }
+ }
+
+CLEANUP:
+ BOINCTRACE(_T("get_random_graphics_app -- Function End\n"));
+
+ return rp;
+}
+
+
+// Launch a project (science) graphics application
+//
+int CScreensaver::launch_screensaver(RESULT* rp, GFXAPP_ID& graphics_application) {
+ int retval = 0;
+ if (strlen(rp->graphics_exec_path)) {
+ // V6 Graphics
+#ifdef __APPLE__
+ // For sandbox security, use gfx_switcher to launch gfx app
+ // as user boinc_project and group boinc_project.
+ //
+ // For unknown reasons, the graphics application exits with
+ // "RegisterProcess failed (error = -50)" unless we pass its
+ // full path twice in the argument list to execv.
+ char* argv[5];
+ argv[0] = "gfx_Switcher";
+ argv[1] = "-launch_gfx";
+ argv[2] = strrchr(rp->slot_path, '/');
+ if (*argv[2]) argv[2]++; // Point to the slot number in ascii
+
+ argv[3] = "--fullscreen";
+ argv[4] = 0;
+
+ retval = run_program(
+ rp->slot_path,
+ m_gfx_Switcher_Path,
+ 4,
+ argv,
+ 0,
+ graphics_application
+ );
+#else
+ char* argv[3];
+ argv[0] = "app_graphics"; // not used
+ argv[1] = "--fullscreen";
+ argv[2] = 0;
+ retval = run_program(
+ rp->slot_path,
+ rp->graphics_exec_path,
+ 2,
+ argv,
+ 0,
+ graphics_application
+ );
+#endif
+ }
+ return retval;
+}
+
+
+// Terminate any screensaver graphics application
+//
+int CScreensaver::terminate_v6_screensaver(GFXAPP_ID& graphics_application) {
+ int retval = 0;
+
+#ifdef __APPLE__
+ // Under sandbox security, use gfx_switcher to kill default gfx app
+ // as user boinc_master and group boinc_master. The man page for
+ // kill() says the user ID of the process sending the signal must
+ // match that of the target process, though in practice that seems
+ // not to be true on the Mac.
+
+ char current_dir[PATH_MAX];
+ char gfx_pid[16];
+ pid_t thePID;
+ int i;
+
+ sprintf(gfx_pid, "%d", graphics_application);
+ getcwd( current_dir, sizeof(current_dir));
+
+ char* argv[4];
+ argv[0] = "gfx_switcher";
+ argv[1] = "-kill_gfx";
+ argv[2] = gfx_pid;
+ argv[3] = 0;
+
+ retval = run_program(
+ current_dir,
+ m_gfx_Switcher_Path,
+ 3,
+ argv,
+ 0,
+ thePID
+ );
+
+ for (i=0; i<200; i++) {
+ boinc_sleep(0.01); // Wait 2 seconds max
+ // Prevent gfx_switcher from becoming a zombie
+ if (waitpid(thePID, 0, WNOHANG) == thePID) {
+ break;
+ }
+ }
+#endif
+
+#ifdef _WIN32
+ HWND hBOINCGraphicsWindow = FindWindow(BOINC_WINDOW_CLASS_NAME, NULL);
+ if (hBOINCGraphicsWindow) {
+ CloseWindow(hBOINCGraphicsWindow);
+ Sleep(1000);
+ hBOINCGraphicsWindow = FindWindow(BOINC_WINDOW_CLASS_NAME, NULL);
+ if (hBOINCGraphicsWindow) {
+ kill_program(graphics_application);
+ }
+ }
+#endif
+
+ // For safety, call kill_program even under Apple sandbox security
+ kill_program(graphics_application);
+ return retval;
+}
+
+
+// Terminate the project (science) graphics application
+//
+int CScreensaver::terminate_screensaver(GFXAPP_ID& graphics_application, RESULT *worker_app) {
+ int retval = 0;
+
+ if (graphics_application) {
+ // V6 Graphics
+ if (m_bScience_gfx_running) {
+ terminate_v6_screensaver(graphics_application);
+ }
+ }
+ return retval;
+}
+
+
+// Launch the default graphics application
+//
+int CScreensaver::launch_default_screensaver(char *dir_path, GFXAPP_ID& graphics_application) {
+ int retval = 0;
+ int num_args;
+
+#ifdef __APPLE__
+ // For sandbox security, use gfx_switcher to launch default
+ // gfx app as user boinc_master and group boinc_master.
+ char* argv[6];
+
+ argv[0] = "gfx_switcher";
+ argv[1] = "-default_gfx";
+ argv[2] = THE_DEFAULT_SS_EXECUTABLE; // Will be changed by gfx_switcher
+ argv[3] = "--fullscreen";
+ argv[4] = 0;
+ argv[5] = 0;
+ if (!m_bConnected) {
+ BOINCTRACE(_T("launch_default_screensaver using --retry_connect argument\n"));
+ argv[4] = "--retry_connect";
+ num_args = 5;
+ } else {
+ num_args = 4;
+ }
+
+ retval = run_program(
+ dir_path,
+ m_gfx_Switcher_Path,
+ num_args,
+ argv,
+ 0,
+ graphics_application
+ );
+
+ BOINCTRACE(_T("launch_default_screensaver returned %d\n"), retval);
+
+#else
+ // For unknown reasons, the graphics application exits with
+ // "RegisterProcess failed (error = -50)" unless we pass its
+ // full path twice in the argument list to execv on Macs.
+
+ char* argv[4];
+ char full_path[1024];
+
+ strlcpy(full_path, dir_path, sizeof(full_path));
+ strlcat(full_path, PATH_SEPARATOR, sizeof(full_path));
+ strlcat(full_path, THE_DEFAULT_SS_EXECUTABLE, sizeof(full_path));
+
+ argv[0] = full_path; // not used
+ argv[1] = "--fullscreen";
+ argv[2] = 0;
+ argv[3] = 0;
+ if (!m_bConnected) {
+ BOINCTRACE(_T("launch_default_screensaver using --retry_connect argument\n"));
+ argv[2] = "--retry_connect";
+ num_args = 3;
+ } else {
+ num_args = 2;
+ }
+
+ retval = run_program(
+ dir_path,
+ full_path,
+ num_args,
+ argv,
+ 0,
+ graphics_application
+ );
+
+ BOINCTRACE(_T("launch_default_screensaver %s returned %d\n"), full_path, retval);
+
+#endif
+ return retval;
+}
+
+
+// Terminate the default graphics application
+//
+int CScreensaver::terminate_default_screensaver(GFXAPP_ID& graphics_application) {
+ int retval = 0;
+
+ if (! graphics_application) return 0;
+ retval = terminate_v6_screensaver(graphics_application);
+ return retval;
+}
+
+
+// If we cannot connect to the core client:
+// - we retry connecting every 10 seconds
+// - we launch the default graphics application with the argument --retry_connect, so
+// it will continue running and will also retry connecting every 10 seconds.
+//
+// If we successfully connected to the core client, launch the default graphics application
+// without the argument --retry_connect. If it can't connect, it will return immediately
+// with the exit code ERR_CONNECT. In that case, we assume it was blocked by a firewall
+// and so we run only project (science) graphics.
+
+DataMgmtProcType CScreensaver::DataManagementProc() {
+ int retval = 0;
+ int suspend_reason = 0;
+ RESULT* theResult = NULL;
+ RESULT* graphics_app_result_ptr = NULL;
+ RESULT previous_result;
+ // previous_result_ptr = &previous_result when previous_result is valid, else NULL
+ RESULT* previous_result_ptr = NULL;
+ int iResultCount = 0;
+ int iIndex = 0;
+ double default_phase_start_time = 0.0;
+ double science_phase_start_time = 0.0;
+ double last_change_time = 0.0;
+ // If we run default screensaver during science phase because no science graphics
+ // are available, then shorten next default graphics phase by that much time.
+ double default_saver_start_time_in_science_phase = 0.0;
+ double default_saver_duration_in_science_phase = 0.0;
+
+ SS_PHASE ss_phase = DEFAULT_SS_PHASE;
+ bool switch_to_default_gfx = false;
+ bool killing_default_gfx = false;
+ int exit_status = 0;
+
+ char* default_ss_dir_path = NULL;
+ char full_path[1024];
+
+ BOINCTRACE(_T("CScreensaver::DataManagementProc - Display screen saver loading message\n"));
+ SetError(TRUE, SCRAPPERR_BOINCSCREENSAVERLOADING); // No GFX App is running: show moving BOINC logo
+#ifdef _WIN32
+ m_tThreadCreateTime = time(0);
+
+ // Set the starting point for iterating through the results
+ m_iLastResultShown = 0;
+ m_tLastResultChangeTime = 0;
+#endif
+
+ m_bDefault_ss_exists = false;
+ m_bScience_gfx_running = false;
+ m_bDefault_gfx_running = false;
+ m_bShow_default_ss_first = false;
+
+#ifdef __APPLE__
+ default_ss_dir_path = "/Library/Application Support/BOINC Data";
+#else
+ default_ss_dir_path = (char*)m_strBOINCInstallDirectory.c_str();
+#endif
+
+ strlcpy(full_path, default_ss_dir_path, sizeof(full_path));
+ strlcat(full_path, PATH_SEPARATOR, sizeof(full_path));
+ strlcat(full_path, THE_DEFAULT_SS_EXECUTABLE, sizeof(full_path));
+
+ if (boinc_file_exists(full_path)) {
+ m_bDefault_ss_exists = true;
+ } else {
+ SetError(TRUE, SCRAPPERR_CANTLAUNCHDEFAULTGFXAPP); // No GFX App is running: show moving BOINC logo
+ }
+
+ if (m_bDefault_ss_exists && m_bShow_default_ss_first) {
+ ss_phase = DEFAULT_SS_PHASE;
+ default_phase_start_time = dtime();
+ science_phase_start_time = 0;
+ switch_to_default_gfx = true;
+ } else {
+ ss_phase = SCIENCE_SS_PHASE;
+ default_phase_start_time = 0;
+ science_phase_start_time = dtime();
+ }
+
+ while (true) {
+ for (int i = 0; i < 4; i++) {
+ // ***
+ // *** Things that should be run frequently.
+ // *** 4 times per second.
+ // ***
+
+ // Are we supposed to exit the screensaver?
+ if (m_bQuitDataManagementProc) { // If main thread has requested we exit
+ BOINCTRACE(_T("CScreensaver::DataManagementProc - Thread told to stop\n"));
+ if (m_hGraphicsApplication || graphics_app_result_ptr) {
+ if (m_bDefault_gfx_running) {
+ BOINCTRACE(_T("CScreensaver::DataManagementProc - Terminating default screensaver\n"));
+ terminate_default_screensaver(m_hGraphicsApplication);
+ } else {
+ BOINCTRACE(_T("CScreensaver::DataManagementProc - Terminating screensaver\n"));
+ terminate_screensaver(m_hGraphicsApplication, graphics_app_result_ptr);
+ }
+ graphics_app_result_ptr = NULL;
+ previous_result_ptr = NULL;
+ m_hGraphicsApplication = 0;
+ }
+ BOINCTRACE(_T("CScreensaver::DataManagementProc - Stopping...\n"));
+ m_bDataManagementProcStopped = true; // Tell main thread that we exited
+ return 0; // Exit the thread
+ }
+ boinc_sleep(0.25);
+ }
+
+ // ***
+ // *** Things that should be run less frequently.
+ // *** 1 time per second.
+ // ***
+
+ // Blank screen saver?
+ if ((m_dwBlankScreen) && (time(0) > m_dwBlankTime) && (m_dwBlankTime > 0)) {
+ BOINCTRACE(_T("CScreensaver::DataManagementProc - Time to blank\n"));
+ SetError(FALSE, SCRAPPERR_SCREENSAVERBLANKED); // Blanked - hide moving BOINC logo
+ m_bQuitDataManagementProc = true;
+ continue; // Code above will exit the thread
+ }
+
+ BOINCTRACE(_T("CScreensaver::DataManagementProc - ErrorMode = '%d', ErrorCode = '%x'\n"), m_bErrorMode, m_hrError);
+
+ if (!m_bConnected) {
+ HandleRPCError();
+ }
+
+ if (m_bConnected) {
+ // Do we need to get the core client state?
+ if (m_bResetCoreState) {
+ // Try and get the current state of the CC
+ retval = rpc->get_state(state);
+ if (retval) {
+ // CC may not yet be running
+ HandleRPCError();
+ continue;
+ } else {
+ m_bResetCoreState = false;
+ }
+ }
+
+ // Update our task list
+ retval = rpc->get_screensaver_tasks(suspend_reason, results);
+ if (retval) {
+ // rpc call returned error
+ HandleRPCError();
+ m_bResetCoreState = true;
+ continue;
+ }
+ } else {
+ results.clear();
+ }
+
+ // Time to switch to default graphics phase?
+ if (m_bDefault_ss_exists && (ss_phase == SCIENCE_SS_PHASE) && (m_fGFXDefaultPeriod > 0)) {
+ if (science_phase_start_time && ((dtime() - science_phase_start_time) > m_fGFXSciencePeriod)) {
+ if (!m_bDefault_gfx_running) {
+ switch_to_default_gfx = true;
+ }
+ ss_phase = DEFAULT_SS_PHASE;
+ default_phase_start_time = dtime();
+ science_phase_start_time = 0;
+ if (m_bDefault_gfx_running && default_saver_start_time_in_science_phase) {
+ // Remember how long default graphics ran during science phase
+ default_saver_duration_in_science_phase += (dtime() - default_saver_start_time_in_science_phase);
+ }
+ default_saver_start_time_in_science_phase = 0;
+ }
+ }
+
+ // Time to switch to science graphics phase?
+ if ((ss_phase == DEFAULT_SS_PHASE) && m_bConnected && (m_fGFXSciencePeriod > 0)) {
+ if (default_phase_start_time &&
+ ((dtime() - default_phase_start_time + default_saver_duration_in_science_phase)
+ > m_fGFXDefaultPeriod)) {
+ // BOINCTRACE(_T("CScreensaver::Ending Default phase: now=%f, default_phase_start_time=%f, default_saver_duration_in_science_phase=%f\n"),
+ // dtime(), default_phase_start_time, default_saver_duration_in_science_phase);
+ ss_phase = SCIENCE_SS_PHASE;
+ default_phase_start_time = 0;
+ default_saver_duration_in_science_phase = 0;
+ science_phase_start_time = dtime();
+ if (m_bDefault_gfx_running) {
+ default_saver_start_time_in_science_phase = science_phase_start_time;
+ }
+ switch_to_default_gfx = false;
+ }
+ }
+
+ // Core client suspended?
+ if (suspend_reason && !(suspend_reason & (SUSPEND_REASON_CPU_THROTTLE | SUSPEND_REASON_CPU_USAGE))) {
+ if (!m_bDefault_gfx_running) {
+ SetError(TRUE, m_hrError); // No GFX App is running: show moving BOINC logo
+ if (m_bDefault_ss_exists) {
+ switch_to_default_gfx = true;
+ }
+ }
+ }
+
+ if (switch_to_default_gfx) {
+ if (m_bScience_gfx_running) {
+ if (m_hGraphicsApplication || previous_result_ptr) {
+ // use previous_result_ptr because graphics_app_result_ptr may no longer be valid
+ terminate_screensaver(m_hGraphicsApplication, previous_result_ptr);
+ if (m_hGraphicsApplication == 0) {
+ graphics_app_result_ptr = NULL;
+ m_bScience_gfx_running = false;
+ } else {
+ // HasProcessExited() test will clear m_hGraphicsApplication and graphics_app_result_ptr
+ }
+ previous_result_ptr = NULL;
+ }
+ } else {
+ if (!m_bDefault_gfx_running) {
+ switch_to_default_gfx = false;
+ retval = launch_default_screensaver(default_ss_dir_path, m_hGraphicsApplication);
+ if (retval) {
+ m_hGraphicsApplication = 0;
+ previous_result_ptr = NULL;
+ graphics_app_result_ptr = NULL;
+ m_bDefault_gfx_running = false;
+ SetError(TRUE, SCRAPPERR_CANTLAUNCHDEFAULTGFXAPP); // No GFX App is running: show moving BOINC logo
+ } else {
+ m_bDefault_gfx_running = true;
+ if (ss_phase == SCIENCE_SS_PHASE) {
+ default_saver_start_time_in_science_phase = dtime();
+ }
+ SetError(FALSE, SCRAPPERR_BOINCSCREENSAVERLOADING); // A GFX App is running: hide moving BOINC logo
+ }
+ }
+ }
+ }
+
+ if ((ss_phase == SCIENCE_SS_PHASE) && !switch_to_default_gfx) {
+
+#if SIMULATE_NO_GRAPHICS /* FOR TESTING */
+
+ if (!m_bDefault_gfx_running) {
+ SetError(TRUE, m_hrError); // No GFX App is running: show moving BOINC logo
+ if (m_bDefault_ss_exists) {
+ switch_to_default_gfx = true;
+ }
+ }
+
+#else /* NORMAL OPERATION */
+
+ if (m_bScience_gfx_running) {
+ // Is the current graphics app's associated task still running?
+
+ if ((m_hGraphicsApplication) || (graphics_app_result_ptr)) {
+ iResultCount = (int)results.results.size();
+ graphics_app_result_ptr = NULL;
+
+ // Find the current task in the new results vector (if it still exists)
+ for (iIndex = 0; iIndex < iResultCount; iIndex++) {
+ theResult = results.results.at(iIndex);
+
+ if (is_same_task(theResult, previous_result_ptr)) {
+ graphics_app_result_ptr = theResult;
+ previous_result = *theResult;
+ previous_result_ptr = &previous_result;
+ break;
+ }
+ }
+
+ // V6 graphics only: if worker application has stopped running, terminate_screensaver
+ if ((graphics_app_result_ptr == NULL) && (m_hGraphicsApplication != 0)) {
+ if (previous_result_ptr) {
+ BOINCTRACE(_T("CScreensaver::DataManagementProc - %s finished\n"),
+ previous_result.graphics_exec_path
+ );
+ }
+ terminate_screensaver(m_hGraphicsApplication, previous_result_ptr);
+ previous_result_ptr = NULL;
+ if (m_hGraphicsApplication == 0) {
+ graphics_app_result_ptr = NULL;
+ m_bScience_gfx_running = false;
+ // Save previous_result and previous_result_ptr for get_random_graphics_app() call
+ } else {
+ // HasProcessExited() test will clear m_hGraphicsApplication and graphics_app_result_ptr
+ }
+ }
+
+ if (last_change_time && (m_fGFXChangePeriod > 0) && ((dtime() - last_change_time) > m_fGFXChangePeriod) ) {
+ if (count_active_graphic_apps(results, previous_result_ptr) > 0) {
+ if (previous_result_ptr) {
+ BOINCTRACE(_T("CScreensaver::DataManagementProc - time to change: %s / %s\n"),
+ previous_result.name, previous_result.graphics_exec_path
+ );
+ }
+ terminate_screensaver(m_hGraphicsApplication, graphics_app_result_ptr);
+ if (m_hGraphicsApplication == 0) {
+ graphics_app_result_ptr = NULL;
+ m_bScience_gfx_running = false;
+ // Save previous_result and previous_result_ptr for get_random_graphics_app() call
+ } else {
+ // HasProcessExited() test will clear m_hGraphicsApplication and graphics_app_result_ptr
+ }
+ }
+ last_change_time = dtime();
+ }
+ }
+ } // End if (m_bScience_gfx_running)
+
+ // If no current graphics app, pick an active task at random
+ // and launch its graphics app
+ //
+ if ((m_bDefault_gfx_running || (m_hGraphicsApplication == 0)) && (graphics_app_result_ptr == NULL)) {
+ graphics_app_result_ptr = get_random_graphics_app(results, previous_result_ptr);
+ previous_result_ptr = NULL;
+
+ if (graphics_app_result_ptr) {
+ if (m_bDefault_gfx_running) {
+ terminate_default_screensaver(m_hGraphicsApplication);
+ killing_default_gfx = true;
+ // Remember how long default graphics ran during science phase
+ if (default_saver_start_time_in_science_phase) {
+ default_saver_duration_in_science_phase += (dtime() - default_saver_start_time_in_science_phase);
+ //BOINCTRACE(_T("CScreensaver::During Science phase: now=%f, default_saver_start_time=%f, default_saver_duration=%f\n"),
+ // dtime(), default_saver_start_time_in_science_phase, default_saver_duration_in_science_phase);
+ }
+ default_saver_start_time_in_science_phase = 0;
+ // HasProcessExited() test will clear
+ // m_hGraphicsApplication and graphics_app_result_ptr
+ } else {
+ retval = launch_screensaver(graphics_app_result_ptr, m_hGraphicsApplication);
+ if (retval) {
+ m_hGraphicsApplication = 0;
+ previous_result_ptr = NULL;
+ graphics_app_result_ptr = NULL;
+ m_bScience_gfx_running = false;
+ } else {
+ // A GFX App is running: hide moving BOINC logo
+ //
+ SetError(FALSE, SCRAPPERR_BOINCSCREENSAVERLOADING);
+ last_change_time = dtime();
+ m_bScience_gfx_running = true;
+ // Make a local copy of current result, since original pointer
+ // may have been freed by the time we perform later tests
+ previous_result = *graphics_app_result_ptr;
+ previous_result_ptr = &previous_result;
+ if (previous_result_ptr) {
+ BOINCTRACE(_T("CScreensaver::DataManagementProc - launching %s\n"),
+ previous_result.graphics_exec_path
+ );
+ }
+ }
+ }
+ } else {
+ if (!m_bDefault_gfx_running) {
+ // We can't run a science graphics app, so run the default graphics if available
+ SetError(TRUE, m_hrError);
+ if (m_bDefault_ss_exists) {
+ switch_to_default_gfx = true;
+ }
+ }
+
+ } // End if no science graphics available
+ } // End if no current science graphics app is running
+
+#endif // ! SIMULATE_NO_GRAPHICS
+
+ if (switch_to_default_gfx) {
+ switch_to_default_gfx = false;
+ if (!m_bDefault_gfx_running) {
+ retval = launch_default_screensaver(default_ss_dir_path, m_hGraphicsApplication);
+ if (retval) {
+ m_hGraphicsApplication = 0;
+ previous_result_ptr = NULL;
+ graphics_app_result_ptr = NULL;
+ m_bDefault_gfx_running = false;
+ SetError(TRUE, SCRAPPERR_CANTLAUNCHDEFAULTGFXAPP);
+ // No GFX App is running: show BOINC logo
+ } else {
+ m_bDefault_gfx_running = true;
+ default_saver_start_time_in_science_phase = dtime();
+ SetError(FALSE, SCRAPPERR_BOINCSCREENSAVERLOADING);
+ // Default GFX App is running: hide moving BOINC logo
+ }
+ }
+ }
+ } // End if ((ss_phase == SCIENCE_SS_PHASE) && !switch_to_default_gfx)
+
+
+
+ // Is the graphics app still running?
+ if (m_hGraphicsApplication) {
+ if (HasProcessExited(m_hGraphicsApplication, exit_status)) {
+ // Something has happened to the previously selected screensaver
+ // application. Start a different one.
+ BOINCTRACE(_T("CScreensaver::DataManagementProc - Graphics application isn't running, start a new one.\n"));
+ if (m_bDefault_gfx_running) {
+ // If we were able to connect to core client
+ // but gfx app can't, don't use it.
+ //
+ BOINCTRACE(_T("CScreensaver::DataManagementProc - Default graphics application exited with code %d.\n"), exit_status);
+ if (!killing_default_gfx) { // If this is an unexpected exit
+ if (exit_status == DEFAULT_GFX_CANT_CONNECT) {
+ SetError(TRUE, SCRAPPERR_DEFAULTGFXAPPCANTCONNECT);
+ // No GFX App is running: show moving BOINC logo
+ } else {
+ SetError(TRUE, SCRAPPERR_DEFAULTGFXAPPCRASHED);
+ // No GFX App is running: show moving BOINC logo
+ }
+ m_bDefault_ss_exists = false;
+ ss_phase = SCIENCE_SS_PHASE;
+ }
+ killing_default_gfx = false;
+ }
+ SetError(TRUE, SCRAPPERR_BOINCNOGRAPHICSAPPSEXECUTING);
+ // No GFX App is running: show moving BOINC logo
+ m_hGraphicsApplication = 0;
+ graphics_app_result_ptr = NULL;
+ m_bDefault_gfx_running = false;
+ m_bScience_gfx_running = false;
+ continue;
+ }
+ }
+ } // end while(true)
+}
+
+
+#ifdef _WIN32
+BOOL CScreensaver::HasProcessExited(HANDLE pid_handle, int &exitCode) {
+ unsigned long status = 1;
+ if (GetExitCodeProcess(pid_handle, &status)) {
+ if (status == STILL_ACTIVE) {
+ exitCode = 0;
+ return false;
+ }
+ }
+ exitCode = (int)status;
+ return true;
+}
+#else
+bool CScreensaver::HasProcessExited(pid_t pid, int &exitCode) {
+ int status;
+ pid_t p;
+
+ p = waitpid(pid, &status, WNOHANG);
+ exitCode = WEXITSTATUS(status);
+ if (p == pid) return true; // process has exited
+ if (p == -1) return true; // PID doesn't exist
+ exitCode = 0;
+ return false;
+}
+#endif
+
+
+void CScreensaver::GetDefaultDisplayPeriods(struct ss_periods &periods) {
+ char* default_data_dir_path = NULL;
+ char buf[1024];
+ FILE* f;
+ MIOFILE mf;
+
+ periods.GFXDefaultPeriod = GFX_DEFAULT_PERIOD;
+ periods.GFXSciencePeriod = GFX_SCIENCE_PERIOD;
+ periods.GFXChangePeriod = GFX_CHANGE_PERIOD;
+ periods.Show_default_ss_first = false;
+
+#ifdef __APPLE__
+ default_data_dir_path = "/Library/Application Support/BOINC Data";
+#else
+ default_data_dir_path = (char*)m_strBOINCDataDirectory.c_str();
+#endif
+
+ strlcpy(buf, default_data_dir_path, sizeof(buf));
+ strlcat(buf, PATH_SEPARATOR, sizeof(buf));
+ strlcat(buf, THE_SS_CONFIG_FILE, sizeof(buf));
+
+ f = boinc_fopen(buf, "r");
+ if (!f) return;
+
+ mf.init_file(f);
+ XML_PARSER xp(&mf);
+
+ while (!xp.get_tag()) {
+ if (xp.parse_bool("default_ss_first", periods.Show_default_ss_first)) continue;
+ if (xp.parse_double("default_gfx_duration", periods.GFXDefaultPeriod)) continue;
+ if (xp.parse_double("science_gfx_duration", periods.GFXSciencePeriod)) continue;
+ if (xp.parse_double("science_gfx_change_interval", periods.GFXChangePeriod)) continue;
+ }
+ fclose(f);
+
+ BOINCTRACE(
+ _T("CScreensaver::GetDefaultDisplayPeriods: m_bShow_default_ss_first=%d, m_fGFXDefaultPeriod=%f, m_fGFXSciencePeriod=%f, m_fGFXChangePeriod=%f\n"),
+ (int)periods.Show_default_ss_first,
+ periods.GFXDefaultPeriod,
+ periods.GFXSciencePeriod,
+ periods.GFXChangePeriod
+ );
+}
diff --git a/clienttray/boinc_tray.h b/clienttray/boinc_tray.h
index b53c9079a1..8e81c1772b 100644
--- a/clienttray/boinc_tray.h
+++ b/clienttray/boinc_tray.h
@@ -1,17 +1,17 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by boinc_tray.rc
-//
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NO_MFC 1
-#define _APS_3D_CONTROLS 1
-#define _APS_NEXT_RESOURCE_VALUE 110
-#define _APS_NEXT_COMMAND_VALUE 40000
-#define _APS_NEXT_CONTROL_VALUE 1020
-#define _APS_NEXT_SYMED_VALUE 102
-#endif
-#endif
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by boinc_tray.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NO_MFC 1
+#define _APS_3D_CONTROLS 1
+#define _APS_NEXT_RESOURCE_VALUE 110
+#define _APS_NEXT_COMMAND_VALUE 40000
+#define _APS_NEXT_CONTROL_VALUE 1020
+#define _APS_NEXT_SYMED_VALUE 102
+#endif
+#endif
diff --git a/clienttray/boinc_tray.rc b/clienttray/boinc_tray.rc
index 318ab10d42..45ba9f7f87 100644
--- a/clienttray/boinc_tray.rc
+++ b/clienttray/boinc_tray.rc
@@ -1,264 +1,264 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "boinc_tray.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include "winresrc.h"
-#include "version.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// Neutral resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
-#ifdef _WIN32
-LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1252)
-#endif //_WIN32
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-#if defined(_GRIDREPUBLIC)
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "GridRepublic"
- VALUE "FileDescription", "GridRepublic System Tray for Windows"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boinctray"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boinctray.exe"
- VALUE "ProductName", "BOINC client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#elif defined(_PROGRESSTHRUPROCESSORS)
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "Progress Thru Processors"
- VALUE "FileDescription", "Progress Thru Processors System Tray for Windows"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boinctray"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boinctray.exe"
- VALUE "ProductName", "BOINC client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#elif defined(_CHARITYENGINE)
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "Charity Engine"
- VALUE "FileDescription", "Charity Engine System Tray for Windows"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boinctray"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boinctray.exe"
- VALUE "ProductName", "BOINC client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#elif defined(_WCG)
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "World Community Grid"
- VALUE "FileDescription", "World Community Grid System Tray for Windows"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boinctray"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boinctray.exe"
- VALUE "ProductName", "BOINC client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#else
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
- FILEFLAGSMASK 0x3fL
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x40004L
- FILETYPE 0x1L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- VALUE "CompanyName", "Space Sciences Laboratory"
- VALUE "FileDescription", "BOINC System Tray for Windows"
- VALUE "FileVersion", BOINC_VERSION_STRING "\0"
- VALUE "InternalName", "boinctray"
- VALUE "LegalCopyright", "© 2003-2012 University of California"
- VALUE "OriginalFilename", "boinctray.exe"
- VALUE "ProductName", "BOINC client"
- VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif
-
-#endif // Neutral resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "boinc_tray.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""winresrc.h""\r\n"
- "#include ""version.h""\r\n"
- "\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
+// Microsoft Visual C++ generated resource script.
+//
+#include "boinc_tray.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winresrc.h"
+#include "version.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Neutral resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
+#ifdef _WIN32
+LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
+#pragma code_page(1252)
+#endif //_WIN32
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+#if defined(_GRIDREPUBLIC)
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "GridRepublic"
+ VALUE "FileDescription", "GridRepublic System Tray for Windows"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boinctray"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boinctray.exe"
+ VALUE "ProductName", "BOINC client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#elif defined(_PROGRESSTHRUPROCESSORS)
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Progress Thru Processors"
+ VALUE "FileDescription", "Progress Thru Processors System Tray for Windows"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boinctray"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boinctray.exe"
+ VALUE "ProductName", "BOINC client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#elif defined(_CHARITYENGINE)
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Charity Engine"
+ VALUE "FileDescription", "Charity Engine System Tray for Windows"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boinctray"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boinctray.exe"
+ VALUE "ProductName", "BOINC client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#elif defined(_WCG)
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "World Community Grid"
+ VALUE "FileDescription", "World Community Grid System Tray for Windows"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boinctray"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boinctray.exe"
+ VALUE "ProductName", "BOINC client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#else
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ PRODUCTVERSION BOINC_MAJOR_VERSION,BOINC_MINOR_VERSION,BOINC_RELEASE,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Space Sciences Laboratory"
+ VALUE "FileDescription", "BOINC System Tray for Windows"
+ VALUE "FileVersion", BOINC_VERSION_STRING "\0"
+ VALUE "InternalName", "boinctray"
+ VALUE "LegalCopyright", "© 2003-2012 University of California"
+ VALUE "OriginalFilename", "boinctray.exe"
+ VALUE "ProductName", "BOINC client"
+ VALUE "ProductVersion", BOINC_VERSION_STRING "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif
+
+#endif // Neutral resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "boinc_tray.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""winresrc.h""\r\n"
+ "#include ""version.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/clienttray/tray_win.cpp b/clienttray/tray_win.cpp
index 954d905e17..170cf371a2 100644
--- a/clienttray/tray_win.cpp
+++ b/clienttray/tray_win.cpp
@@ -1,202 +1,202 @@
-// This file is part of BOINC.
-// http://boinc.berkeley.edu
-// Copyright (C) 2008 University of California
-//
-// BOINC is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation,
-// either version 3 of the License, or (at your option) any later version.
-//
-// BOINC is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with BOINC. If not, see .
-//
-
-#include "boinc_win.h"
-
-#include "diagnostics.h"
-#include "win_util.h"
-#include "boinc_tray.h"
-#include "tray_win.h"
-#include "idlemon.h"
-
-
- HMODULE g_hModule = NULL;
-static CBOINCTray* gspBOINCTray = NULL;
-
-
-INT WINAPI WinMain(
- HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow
-) {
- CBOINCTray BOINCTray;
- return BOINCTray.Run( hInstance, hPrevInstance, lpCmdLine, nCmdShow );
-}
-
-
-CBOINCTray::CBOINCTray() {
- gspBOINCTray = this;
- m_hDataManagementThread = NULL;
- m_bIdleTrackerInitialized = FALSE;
-}
-
-
-// Starts main execution of BOINC Tray.
-//
-INT CBOINCTray::Run( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR /* lpCmdLine */ , int /* nCmdShow */ ) {
-
- // Initialize the BOINC Diagnostics Framework
- int flags =
-#ifdef _DEBUG
- BOINC_DIAG_MEMORYLEAKCHECKENABLED |
-#endif
- BOINC_DIAG_DUMPCALLSTACKENABLED |
- BOINC_DIAG_HEAPCHECKENABLED |
- BOINC_DIAG_TRACETOSTDOUT |
- BOINC_DIAG_REDIRECTSTDERR |
- BOINC_DIAG_REDIRECTSTDOUT;
-
- chdir_to_data_dir();
- diagnostics_init(flags, "stdouttray", "stderrtray");
-
- // Create application window class
- if (!hPrevInstance) {
- // Register an appropriate window class for the primary window
- WNDCLASS cls;
- cls.hCursor = NULL;
- cls.hIcon = NULL;
- cls.lpszMenuName = NULL;
- cls.lpszClassName = _T("BOINCTrayWndClass");
- cls.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
- cls.hInstance = hInstance;
- cls.style = CS_OWNDC|CS_VREDRAW|CS_HREDRAW;
- cls.lpfnWndProc = TrayProcStub;
- cls.cbWndExtra = 0;
- cls.cbClsExtra = 0;
- RegisterClass(&cls);
- }
-
- // Create the window
- MSG msg;
- HWND hWnd;
-
- hWnd = CreateWindow(
- _T("BOINCTrayWndClass"),
- _T("BOINC System Tray Applet"),
- WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL,
- 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL
- );
-
-
- // Process the message pump
- while( GetMessage( &msg, NULL, 0, 0 ) ) {
- TranslateMessage( &msg );
- DispatchMessage( &msg );
- }
-
-
- // Cleanup and shutdown the BOINC idle tracking system.
- detach_idle_monitor();
-
- return msg.wParam;
-}
-
-
-
-
-// Create the thread that is used to talk to the daemon.
-//
-BOOL CBOINCTray::CreateDataManagementThread() {
- DWORD dwThreadID = 0;
- m_hDataManagementThread = CreateThread(
- NULL, // default security attributes
- 0, // use default stack size
- DataManagementProcStub, // thread function
- NULL, // argument to thread function
- 0, // use default creation flags
- &dwThreadID ); // returns the thread identifier
-
- if (m_hDataManagementThread == NULL) {
- return FALSE;
- }
- return TRUE;
-}
-
-
-
-
-// Terminate the thread that is used to talk to the daemon.
-//
-BOOL CBOINCTray::DestroyDataManagementThread() {
- if (!TerminateThread(m_hDataManagementThread, 0)) {
- return FALSE;
- }
- return TRUE;
-}
-
-
-
-
-// Update the time since last input activity every 5 seconds or so.
-//
-DWORD WINAPI CBOINCTray::DataManagementProc() {
- while (true) {
- // On Vista systems, only elevated processes can create shared memory
- // area's across various user sessions. In this case we need to wait
- // for BOINC to create the shared memory area and then boinctray can
- // successfully attach to it. What a PITA.
- if (!m_bIdleTrackerInitialized) {
- m_bIdleTrackerInitialized = attach_idle_monitor();
- }
-
- get_idle_tick_count();
- Sleep(5000);
- }
-}
-
-
-
-
-// This function forwards to DataManagementProc, which has access to the
-// "this" pointer.
-//
-DWORD WINAPI CBOINCTray::DataManagementProcStub(LPVOID) {
- return gspBOINCTray->DataManagementProc();
-}
-
-
-
-
-// Handle window messages for main screensaver windows.
-//
-LRESULT CBOINCTray::TrayProc(
- HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
-) {
- switch (uMsg) {
- case WM_CREATE:
- CreateDataManagementThread();
- return 0;
- break;
-
- case WM_CLOSE:
- DestroyDataManagementThread();
- return 0;
- break;
- }
- return DefWindowProc(hWnd, uMsg, wParam, lParam);
-}
-
-
-
-
-// This function forwards all window messages to SaverProc, which has
-// access to the "this" pointer.
-//
-LRESULT CALLBACK CBOINCTray::TrayProcStub(
- HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
-) {
- return gspBOINCTray->TrayProc(hWnd, uMsg, wParam, lParam);
-}
+// This file is part of BOINC.
+// http://boinc.berkeley.edu
+// Copyright (C) 2008 University of California
+//
+// BOINC is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation,
+// either version 3 of the License, or (at your option) any later version.
+//
+// BOINC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with BOINC. If not, see .
+//
+
+#include "boinc_win.h"
+
+#include "diagnostics.h"
+#include "win_util.h"
+#include "boinc_tray.h"
+#include "tray_win.h"
+#include "idlemon.h"
+
+
+ HMODULE g_hModule = NULL;
+static CBOINCTray* gspBOINCTray = NULL;
+
+
+INT WINAPI WinMain(
+ HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow
+) {
+ CBOINCTray BOINCTray;
+ return BOINCTray.Run( hInstance, hPrevInstance, lpCmdLine, nCmdShow );
+}
+
+
+CBOINCTray::CBOINCTray() {
+ gspBOINCTray = this;
+ m_hDataManagementThread = NULL;
+ m_bIdleTrackerInitialized = FALSE;
+}
+
+
+// Starts main execution of BOINC Tray.
+//
+INT CBOINCTray::Run( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR /* lpCmdLine */ , int /* nCmdShow */ ) {
+
+ // Initialize the BOINC Diagnostics Framework
+ int flags =
+#ifdef _DEBUG
+ BOINC_DIAG_MEMORYLEAKCHECKENABLED |
+#endif
+ BOINC_DIAG_DUMPCALLSTACKENABLED |
+ BOINC_DIAG_HEAPCHECKENABLED |
+ BOINC_DIAG_TRACETOSTDOUT |
+ BOINC_DIAG_REDIRECTSTDERR |
+ BOINC_DIAG_REDIRECTSTDOUT;
+
+ chdir_to_data_dir();
+ diagnostics_init(flags, "stdouttray", "stderrtray");
+
+ // Create application window class
+ if (!hPrevInstance) {
+ // Register an appropriate window class for the primary window
+ WNDCLASS cls;
+ cls.hCursor = NULL;
+ cls.hIcon = NULL;
+ cls.lpszMenuName = NULL;
+ cls.lpszClassName = _T("BOINCTrayWndClass");
+ cls.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
+ cls.hInstance = hInstance;
+ cls.style = CS_OWNDC|CS_VREDRAW|CS_HREDRAW;
+ cls.lpfnWndProc = TrayProcStub;
+ cls.cbWndExtra = 0;
+ cls.cbClsExtra = 0;
+ RegisterClass(&cls);
+ }
+
+ // Create the window
+ MSG msg;
+ HWND hWnd;
+
+ hWnd = CreateWindow(
+ _T("BOINCTrayWndClass"),
+ _T("BOINC System Tray Applet"),
+ WS_OVERLAPPEDWINDOW|WS_HSCROLL|WS_VSCROLL,
+ 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL
+ );
+
+
+ // Process the message pump
+ while( GetMessage( &msg, NULL, 0, 0 ) ) {
+ TranslateMessage( &msg );
+ DispatchMessage( &msg );
+ }
+
+
+ // Cleanup and shutdown the BOINC idle tracking system.
+ detach_idle_monitor();
+
+ return msg.wParam;
+}
+
+
+
+
+// Create the thread that is used to talk to the daemon.
+//
+BOOL CBOINCTray::CreateDataManagementThread() {
+ DWORD dwThreadID = 0;
+ m_hDataManagementThread = CreateThread(
+ NULL, // default security attributes
+ 0, // use default stack size
+ DataManagementProcStub, // thread function
+ NULL, // argument to thread function
+ 0, // use default creation flags
+ &dwThreadID ); // returns the thread identifier
+
+ if (m_hDataManagementThread == NULL) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+
+
+// Terminate the thread that is used to talk to the daemon.
+//
+BOOL CBOINCTray::DestroyDataManagementThread() {
+ if (!TerminateThread(m_hDataManagementThread, 0)) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+
+
+
+// Update the time since last input activity every 5 seconds or so.
+//
+DWORD WINAPI CBOINCTray::DataManagementProc() {
+ while (true) {
+ // On Vista systems, only elevated processes can create shared memory
+ // area's across various user sessions. In this case we need to wait
+ // for BOINC to create the shared memory area and then boinctray can
+ // successfully attach to it. What a PITA.
+ if (!m_bIdleTrackerInitialized) {
+ m_bIdleTrackerInitialized = attach_idle_monitor();
+ }
+
+ get_idle_tick_count();
+ Sleep(5000);
+ }
+}
+
+
+
+
+// This function forwards to DataManagementProc, which has access to the
+// "this" pointer.
+//
+DWORD WINAPI CBOINCTray::DataManagementProcStub(LPVOID) {
+ return gspBOINCTray->DataManagementProc();
+}
+
+
+
+
+// Handle window messages for main screensaver windows.
+//
+LRESULT CBOINCTray::TrayProc(
+ HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
+) {
+ switch (uMsg) {
+ case WM_CREATE:
+ CreateDataManagementThread();
+ return 0;
+ break;
+
+ case WM_CLOSE:
+ DestroyDataManagementThread();
+ return 0;
+ break;
+ }
+ return DefWindowProc(hWnd, uMsg, wParam, lParam);
+}
+
+
+
+
+// This function forwards all window messages to SaverProc, which has
+// access to the "this" pointer.
+//
+LRESULT CALLBACK CBOINCTray::TrayProcStub(
+ HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam
+) {
+ return gspBOINCTray->TrayProc(hWnd, uMsg, wParam, lParam);
+}
diff --git a/clienttray/tray_win.h b/clienttray/tray_win.h
index 9dd08e875e..2f06edfacd 100644
--- a/clienttray/tray_win.h
+++ b/clienttray/tray_win.h
@@ -1,47 +1,47 @@
-// This file is part of BOINC.
-// http://boinc.berkeley.edu
-// Copyright (C) 2008 University of California
-//
-// BOINC is free software; you can redistribute it and/or modify it
-// under the terms of the GNU Lesser General Public License
-// as published by the Free Software Foundation,
-// either version 3 of the License, or (at your option) any later version.
-//
-// BOINC is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-// See the GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public License
-// along with BOINC. If not, see .
-//
-
-#ifndef _BOINCTRAY_WIN_H
-#define _BOINCTRAY_WIN_H
-
-
-//-----------------------------------------------------------------------------
-// Name: class CBOINCTray
-// Desc: BOINC Tray class
-//-----------------------------------------------------------------------------
-class CBOINCTray
-{
-public:
- CBOINCTray();
-
- virtual INT Run( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow );
-
-protected:
- BOOL CreateDataManagementThread();
- BOOL DestroyDataManagementThread();
-
- DWORD WINAPI DataManagementProc();
- static DWORD WINAPI DataManagementProcStub( LPVOID lpParam );
- LRESULT TrayProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
- static LRESULT CALLBACK TrayProcStub( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
-
- HANDLE m_hDataManagementThread;
- BOOL m_bIdleTrackerInitialized;
-};
-
-#endif
+// This file is part of BOINC.
+// http://boinc.berkeley.edu
+// Copyright (C) 2008 University of California
+//
+// BOINC is free software; you can redistribute it and/or modify it
+// under the terms of the GNU Lesser General Public License
+// as published by the Free Software Foundation,
+// either version 3 of the License, or (at your option) any later version.
+//
+// BOINC is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+// See the GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with BOINC. If not, see .
+//
+
+#ifndef _BOINCTRAY_WIN_H
+#define _BOINCTRAY_WIN_H
+
+
+//-----------------------------------------------------------------------------
+// Name: class CBOINCTray
+// Desc: BOINC Tray class
+//-----------------------------------------------------------------------------
+class CBOINCTray
+{
+public:
+ CBOINCTray();
+
+ virtual INT Run( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow );
+
+protected:
+ BOOL CreateDataManagementThread();
+ BOOL DestroyDataManagementThread();
+
+ DWORD WINAPI DataManagementProc();
+ static DWORD WINAPI DataManagementProcStub( LPVOID lpParam );
+ LRESULT TrayProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
+ static LRESULT CALLBACK TrayProcStub( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
+
+ HANDLE m_hDataManagementThread;
+ BOOL m_bIdleTrackerInitialized;
+};
+
+#endif
diff --git a/coprocs/NVIDIA/include/nvapi.h b/coprocs/NVIDIA/include/nvapi.h
index f771221911..c83f7bef0f 100644
--- a/coprocs/NVIDIA/include/nvapi.h
+++ b/coprocs/NVIDIA/include/nvapi.h
@@ -1,1915 +1,1915 @@
- /***************************************************************************\
-|* *|
-|* Copyright 2005-2008 NVIDIA Corporation. All rights reserved. *|
-|* *|
-|* NOTICE TO USER: *|
-|* *|
-|* This source code is subject to NVIDIA ownership rights under U.S. *|
-|* and international Copyright laws. Users and possessors of this *|
-|* source code are hereby granted a nonexclusive, royalty-free *|
-|* license to use this code in individual and commercial software. *|
-|* *|
-|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE *|
-|* CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR *|
-|* IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH *|
-|* REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF *|
-|* MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR *|
-|* PURPOSE. IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, *|
-|* INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES *|
-|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN *|
-|* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *|
-|* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE *|
-|* CODE. *|
-|* *|
-|* U.S. Government End Users. This source code is a "commercial item" *|
-|* as that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting *|
-|* of "commercial computer software" and "commercial computer software *|
-|* documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) *|
-|* and is provided to the U.S. Government only as a commercial end item. *|
-|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through *|
-|* 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the *|
-|* source code with only those rights set forth herein. *|
-|* *|
-|* Any use of this source code in individual and commercial software must *|
-|* include, in the user documentation and internal comments to the code, *|
-|* the above Disclaimer and U.S. Government End Users Notice. *|
-|* *|
-|* *|
- \***************************************************************************/
-///////////////////////////////////////////////////////////////////////////////
-//
-// Date: Aug 24, 2008
-// File: nvapi.h
-//
-// NvAPI provides an interface to NVIDIA devices. This file contains the
-// interface constants, structure definitions and function prototypes.
-//
-// Target Profile: developer
-// Target OS-Arch: windows
-//
-///////////////////////////////////////////////////////////////////////////////
-#ifndef _NVAPI_H
-#define _NVAPI_H
-
-#pragma pack(push,8) // Make sure we have consistent structure packings
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// ====================================================
-// Universal NvAPI Definitions
-// ====================================================
-#ifndef _WIN32
-#define __cdecl
-#endif
-
-#define NVAPI_INTERFACE extern NvAPI_Status __cdecl
-
-/* 64-bit types for compilers that support them, plus some obsolete variants */
-#if defined(__GNUC__) || defined(__arm) || defined(__IAR_SYSTEMS_ICC__) || defined(__ghs__) || defined(_WIN64)
-typedef unsigned long long NvU64; /* 0 to 18446744073709551615 */
-#else
-typedef unsigned __int64 NvU64; /* 0 to 18446744073709551615 */
-#endif
-
-// mac os 32-bit still needs this
-#if (defined(macintosh) || defined(__APPLE__)) && !defined(__LP64__)
-typedef signed long NvS32; /* -2147483648 to 2147483647 */
-#else
-typedef signed int NvS32; /* -2147483648 to 2147483647 */
-#endif
-
-typedef unsigned long NvU32;
-typedef unsigned short NvU16;
-typedef unsigned char NvU8;
-
-#define NV_DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
-
-// NVAPI Handles - These handles are retrieved from various calls and passed in to others in NvAPI
-// These are meant to be opaque types. Do not assume they correspond to indices, HDCs,
-// display indexes or anything else.
-//
-// Most handles remain valid until a display re-configuration (display mode set) or GPU
-// reconfiguration (going into or out of SLI modes) occurs. If NVAPI_HANDLE_INVALIDATED
-// is received by an app, it should discard all handles, and re-enumerate them.
-//
-NV_DECLARE_HANDLE(NvDisplayHandle); // Display Device driven by NVIDIA GPU(s) (an attached display)
-NV_DECLARE_HANDLE(NvUnAttachedDisplayHandle); // Unattached Display Device driven by NVIDIA GPU(s)
-NV_DECLARE_HANDLE(NvLogicalGpuHandle); // One or more physical GPUs acting in concert (SLI)
-NV_DECLARE_HANDLE(NvPhysicalGpuHandle); // A single physical GPU
-NV_DECLARE_HANDLE(NvEventHandle); // A handle to an event registration instance
-
-#define NVAPI_DEFAULT_HANDLE 0
-
-#define NVAPI_GENERIC_STRING_MAX 4096
-#define NVAPI_LONG_STRING_MAX 256
-#define NVAPI_SHORT_STRING_MAX 64
-
-typedef struct
-{
- NvS32 sX;
- NvS32 sY;
- NvS32 sWidth;
- NvS32 sHeight;
-} NvSBox;
-
-#define NVAPI_MAX_PHYSICAL_GPUS 64
-#define NVAPI_MAX_LOGICAL_GPUS 64
-#define NVAPI_MAX_AVAILABLE_GPU_TOPOLOGIES 256
-#define NVAPI_MAX_GPU_TOPOLOGIES NVAPI_MAX_PHYSICAL_GPUS
-#define NVAPI_MAX_GPU_PER_TOPOLOGY 8
-#define NVAPI_MAX_DISPLAY_HEADS 2
-#define NVAPI_MAX_DISPLAYS NVAPI_MAX_PHYSICAL_GPUS * NVAPI_MAX_DISPLAY_HEADS
-
-#define NV_MAX_HEADS 4 // Maximum heads, each with NVAPI_DESKTOP_RES resolution
-#define NV_MAX_VID_STREAMS 4 // Maximum input video streams, each with a NVAPI_VIDEO_SRC_INFO
-#define NV_MAX_VID_PROFILES 4 // Maximum output video profiles supported
-
-typedef char NvAPI_String[NVAPI_GENERIC_STRING_MAX];
-typedef char NvAPI_LongString[NVAPI_LONG_STRING_MAX];
-typedef char NvAPI_ShortString[NVAPI_SHORT_STRING_MAX];
-
-// =========================================================================================
-// NvAPI Version Definition
-// Maintain per structure specific version define using the MAKE_NVAPI_VERSION macro.
-// Usage: #define NV_GENLOCK_STATUS_VER MAKE_NVAPI_VERSION(NV_GENLOCK_STATUS, 1)
-// =========================================================================================
-#define MAKE_NVAPI_VERSION(typeName,ver) (NvU32)(sizeof(typeName) | ((ver)<<16))
-#define GET_NVAPI_VERSION(ver) (NvU32)((ver)>>16)
-#define GET_NVAPI_SIZE(ver) (NvU32)((ver) & 0xffff)
-
-// ====================================================
-// NvAPI Status Values
-// All NvAPI functions return one of these codes.
-// ====================================================
-
-
-typedef enum
-{
- NVAPI_OK = 0, // Success
- NVAPI_ERROR = -1, // Generic error
- NVAPI_LIBRARY_NOT_FOUND = -2, // nvapi.dll can not be loaded
- NVAPI_NO_IMPLEMENTATION = -3, // not implemented in current driver installation
- NVAPI_API_NOT_INTIALIZED = -4, // NvAPI_Initialize has not been called (successfully)
- NVAPI_INVALID_ARGUMENT = -5, // invalid argument
- NVAPI_NVIDIA_DEVICE_NOT_FOUND = -6, // no NVIDIA display driver was found
- NVAPI_END_ENUMERATION = -7, // no more to enum
- NVAPI_INVALID_HANDLE = -8, // invalid handle
- NVAPI_INCOMPATIBLE_STRUCT_VERSION = -9, // an argument's structure version is not supported
- NVAPI_HANDLE_INVALIDATED = -10, // handle is no longer valid (likely due to GPU or display re-configuration)
- NVAPI_OPENGL_CONTEXT_NOT_CURRENT = -11, // no NVIDIA OpenGL context is current (but needs to be)
- NVAPI_NO_GL_EXPERT = -12, // OpenGL Expert is not supported by the current drivers
- NVAPI_INSTRUMENTATION_DISABLED = -13, // OpenGL Expert is supported, but driver instrumentation is currently disabled
- NVAPI_EXPECTED_LOGICAL_GPU_HANDLE = -100, // expected a logical GPU handle for one or more parameters
- NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE = -101, // expected a physical GPU handle for one or more parameters
- NVAPI_EXPECTED_DISPLAY_HANDLE = -102, // expected an NV display handle for one or more parameters
- NVAPI_INVALID_COMBINATION = -103, // used in some commands to indicate that the combination of parameters is not valid
- NVAPI_NOT_SUPPORTED = -104, // Requested feature not supported in the selected GPU
- NVAPI_PORTID_NOT_FOUND = -105, // NO port ID found for I2C transaction
- NVAPI_EXPECTED_UNATTACHED_DISPLAY_HANDLE = -106, // expected an unattached display handle as one of the input param
- NVAPI_INVALID_PERF_LEVEL = -107, // invalid perf level
- NVAPI_DEVICE_BUSY = -108, // device is busy, request not fulfilled
- NVAPI_NV_PERSIST_FILE_NOT_FOUND = -109, // NV persist file is not found
- NVAPI_PERSIST_DATA_NOT_FOUND = -110, // NV persist data is not found
- NVAPI_EXPECTED_TV_DISPLAY = -111, // expected TV output display
- NVAPI_EXPECTED_TV_DISPLAY_ON_DCONNECTOR = -112, // expected TV output on D Connector - HDTV_EIAJ4120.
- NVAPI_NO_ACTIVE_SLI_TOPOLOGY = -113, // SLI is not active on this device
- NVAPI_SLI_RENDERING_MODE_NOTALLOWED = -114, // setup of SLI rendering mode is not possible right now
- NVAPI_EXPECTED_DIGITAL_FLAT_PANEL = -115, // expected digital flat panel
- NVAPI_ARGUMENT_EXCEED_MAX_SIZE = -116, // argument exceeds expected size
- NVAPI_DEVICE_SWITCHING_NOT_ALLOWED = -117, // inhibit ON due to one of the flags in NV_GPU_DISPLAY_CHANGE_INHIBIT or SLI Active
- NVAPI_TESTING_CLOCKS_NOT_SUPPORTED = -118, // testing clocks not supported
- NVAPI_UNKNOWN_UNDERSCAN_CONFIG = -119, // the specified underscan config is from an unknown source (e.g. INF)
- NVAPI_TIMEOUT_RECONFIGURING_GPU_TOPO = -120, // timeout while reconfiguring GPUs
- NVAPI_DATA_NOT_FOUND = -121, // Requested data was not found
- NVAPI_EXPECTED_ANALOG_DISPLAY = -122, // expected analog display
- NVAPI_NO_VIDLINK = -123, // No SLI video bridge present
- NVAPI_REQUIRES_REBOOT = -124, // NVAPI requires reboot for its settings to take effect
- NVAPI_INVALID_HYBRID_MODE = -125, // the function is not supported with the current hybrid mode.
- NVAPI_MIXED_TARGET_TYPES = -126, // The target types are not all the same
- NVAPI_SYSWOW64_NOT_SUPPORTED = -127, // the function is not supported from 32-bit on a 64-bit system
- NVAPI_IMPLICIT_SET_GPU_TOPOLOGY_CHANGE_NOT_ALLOWED = -128, //there is any implicit GPU topo active. Use NVAPI_SetHybridMode to change topology.
- NVAPI_REQUEST_USER_TO_CLOSE_NON_MIGRATABLE_APPS = -129, //Prompt the user to close all non-migratable apps.
- NVAPI_OUT_OF_MEMORY = -130, // Could not allocate sufficient memory to complete the call
- NVAPI_WAS_STILL_DRAWING = -131, // The previous operation that is transferring information to or from this surface is incomplete
- NVAPI_FILE_NOT_FOUND = -132, // The file was not found
- NVAPI_TOO_MANY_UNIQUE_STATE_OBJECTS = -133, // There are too many unique instances of a particular type of state object
- NVAPI_INVALID_CALL = -134, // The method call is invalid. For example, a method's parameter may not be a valid pointer
- NVAPI_D3D10_1_LIBRARY_NOT_FOUND = -135, // d3d10_1.dll can not be loaded
- NVAPI_FUNCTION_NOT_FOUND = -136, // Couldn't find the function in loaded dll library
-} NvAPI_Status;
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_Initialize
-//
-// DESCRIPTION: Initializes NVAPI library. This must be called before any
-// other NvAPI_ function.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_ERROR Something is wrong during the initialization process (generic error)
-// NVAPI_LIBRARYNOTFOUND Can not load nvapi.dll
-// NVAPI_OK Initialized
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_Initialize();
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GetErrorMessage
-//
-// DESCRIPTION: converts an NvAPI error code into a null terminated string
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: null terminated string (always, never NULL)
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GetErrorMessage(NvAPI_Status nr,NvAPI_ShortString szDesc);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GetInterfaceVersionString
-//
-// DESCRIPTION: Returns a string describing the version of the NvAPI library.
-// Contents of the string are human readable. Do not assume a fixed
-// format.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: User readable string giving info on NvAPI's version
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GetInterfaceVersionString(NvAPI_ShortString szDesc);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GetDisplayDriverVersion
-//
-// DESCRIPTION: Returns a struct that describes aspects of the display driver
-// build.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_ERROR or NVAPI_OK
-//
-///////////////////////////////////////////////////////////////////////////////
-typedef struct
-{
- NvU32 version; // Structure version
- NvU32 drvVersion;
- NvU32 bldChangeListNum;
- NvAPI_ShortString szBuildBranchString;
- NvAPI_ShortString szAdapterString;
-} NV_DISPLAY_DRIVER_VERSION;
-#define NV_DISPLAY_DRIVER_VERSION_VER MAKE_NVAPI_VERSION(NV_DISPLAY_DRIVER_VERSION,1)
-NVAPI_INTERFACE NvAPI_GetDisplayDriverVersion(NvDisplayHandle hNvDisplay, NV_DISPLAY_DRIVER_VERSION *pVersion);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_EnumNvidiaDisplayHandle
-//
-// DESCRIPTION: Returns the handle of the NVIDIA display specified by the enum
-// index (thisEnum). The client should keep enumerating until it
-// returns NVAPI_END_ENUMERATION.
-//
-// Note: Display handles can get invalidated on a modeset, so the calling applications need to
-// renum the handles after every modeset.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: either the handle pointer is NULL or enum index too big
-// NVAPI_OK: return a valid NvDisplayHandle based on the enum index
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA device found in the system
-// NVAPI_END_ENUMERATION: no more display device to enumerate.
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_EnumNvidiaDisplayHandle(NvU32 thisEnum, NvDisplayHandle *pNvDispHandle);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_EnumNvidiaUnAttachedDisplayHandle
-//
-// DESCRIPTION: Returns the handle of the NVIDIA UnAttached display specified by the enum
-// index (thisEnum). The client should keep enumerating till it
-// return error.
-//
-// Note: Display handles can get invalidated on a modeset, so the calling applications need to
-// renum the handles after every modeset.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: either the handle pointer is NULL or enum index too big
-// NVAPI_OK: return a valid NvDisplayHandle based on the enum index
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA device found in the system
-// NVAPI_END_ENUMERATION: no more display device to enumerate.
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_EnumNvidiaUnAttachedDisplayHandle(NvU32 thisEnum, NvUnAttachedDisplayHandle *pNvUnAttachedDispHandle);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_EnumPhysicalGPUs
-//
-// DESCRIPTION: Returns an array of physical GPU handles.
-//
-// Each handle represents a physical GPU present in the system.
-// That GPU may be part of a SLI configuration, or not be visible to the OS directly.
-//
-// At least 1 GPU must be present in the system and running an NV display driver.
-//
-// The array nvGPUHandle will be filled with physical GPU handle values. The returned
-// gpuCount determines how many entries in the array are valid.
-//
-// Note: In drivers older than 105.00, all physical GPU handles get invalidated on a modeset. So the calling applications
-// need to renum the handles after every modeset.
-// With drivers 105.00 and up all physical GPU handles are constant.
-// Physical GPU handles are constant as long as the GPUs are not physically moved and the SBIOS VGA order is unchanged.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: nvGPUHandle or pGpuCount is NULL
-// NVAPI_OK: one or more handles were returned
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_EnumPhysicalGPUs(NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_EnumLogicalGPUs
-//
-// DESCRIPTION: Returns an array of logical GPU handles.
-//
-// Each handle represents one or more GPUs acting in concert as a single graphics device.
-//
-// At least 1 GPU must be present in the system and running an NV display driver.
-//
-// The array nvGPUHandle will be filled with logical GPU handle values. The returned
-// gpuCount determines how many entries in the array are valid.
-//
-// Note: All logical GPUs handles get invalidated on a GPU topology change, so the calling application is required to
-// renum the logical GPU handles to get latest physical handle mapping after every GPU topology change activated
-// by a call to NvAPI_SetGpuTopologies.
-//
-// To detect if SLI rendering is enabled please use NvAPI_D3D_GetCurrentSLIState
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: nvGPUHandle or pGpuCount is NULL
-// NVAPI_OK: one or more handles were returned
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_EnumLogicalGPUs(NvLogicalGpuHandle nvGPUHandle[NVAPI_MAX_LOGICAL_GPUS], NvU32 *pGpuCount);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GetPhysicalGPUsFromDisplay
-//
-// DESCRIPTION: Returns an array of physical GPU handles associated with the specified display.
-//
-// At least 1 GPU must be present in the system and running an NV display driver.
-//
-// The array nvGPUHandle will be filled with physical GPU handle values. The returned
-// gpuCount determines how many entries in the array are valid.
-//
-// If the display corresponds to more than one physical GPU, the first GPU returned
-// is the one with the attached active output.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hNvDisp is not valid; nvGPUHandle or pGpuCount is NULL
-// NVAPI_OK: one or more handles were returned
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GetPhysicalGPUsFromDisplay(NvDisplayHandle hNvDisp, NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GetPhysicalGPUFromUnAttachedDisplay
-//
-// DESCRIPTION: Returns a physical GPU handle associated with the specified unattached display.
-//
-// At least 1 GPU must be present in the system and running an NV display driver.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hNvUnAttachedDisp is not valid or pPhysicalGpu is NULL.
-// NVAPI_OK: one or more handles were returned
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GetPhysicalGPUFromUnAttachedDisplay(NvUnAttachedDisplayHandle hNvUnAttachedDisp, NvPhysicalGpuHandle *pPhysicalGpu);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_CreateDisplayFromUnAttachedDisplay
-//
-// DESCRIPTION: The unattached display handle is converted to a active attached display handle.
-//
-// At least 1 GPU must be present in the system and running an NV display driver.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hNvUnAttachedDisp is not valid or pNvDisplay is NULL.
-// NVAPI_OK: one or more handles were returned
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_CreateDisplayFromUnAttachedDisplay(NvUnAttachedDisplayHandle hNvUnAttachedDisp, NvDisplayHandle *pNvDisplay);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GetLogicalGPUFromDisplay
-//
-// DESCRIPTION: Returns the logical GPU handle associated with the specified display.
-//
-// At least 1 GPU must be present in the system and running an NV display driver.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hNvDisp is not valid; pLogicalGPU is NULL
-// NVAPI_OK: one or more handles were returned
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GetLogicalGPUFromDisplay(NvDisplayHandle hNvDisp, NvLogicalGpuHandle *pLogicalGPU);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GetLogicalGPUFromPhysicalGPU
-//
-// DESCRIPTION: Returns the logical GPU handle associated with specified physical GPU handle.
-//
-// At least 1 GPU must be present in the system and running an NV display driver.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGPU is not valid; pLogicalGPU is NULL
-// NVAPI_OK: one or more handles were returned
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GetLogicalGPUFromPhysicalGPU(NvPhysicalGpuHandle hPhysicalGPU, NvLogicalGpuHandle *pLogicalGPU);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GetPhysicalGPUsFromLogicalGPU
-//
-// DESCRIPTION: Returns the physical GPU handles associated with the specified logical GPU handle.
-//
-// At least 1 GPU must be present in the system and running an NV display driver.
-//
-// The array hPhysicalGPU will be filled with physical GPU handle values. The returned
-// gpuCount determines how many entries in the array are valid.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hLogicalGPU is not valid; hPhysicalGPU is NULL
-// NVAPI_OK: one or more handles were returned
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_LOGICAL_GPU_HANDLE: hLogicalGPU was not a logical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GetPhysicalGPUsFromLogicalGPU(NvLogicalGpuHandle hLogicalGPU,NvPhysicalGpuHandle hPhysicalGPU[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GetAssociatedNvidiaDisplayHandle
-//
-// DESCRIPTION: Returns the handle of the NVIDIA display that is associated
-// with the display name given. Eg: "\\DISPLAY1"
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: either argument is NULL
-// NVAPI_OK: *pNvDispHandle is now valid
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA device maps to that display name
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GetAssociatedNvidiaDisplayHandle(const char *szDisplayName, NvDisplayHandle *pNvDispHandle);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GetAssociatedNvidiaDisplayName
-//
-// DESCRIPTION: Returns the display name given. Eg: "\\DISPLAY1" using the NVIDIA display handle
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: either argument is NULL
-// NVAPI_OK: *pNvDispHandle is now valid
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA device maps to that display name
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GetAssociatedNvidiaDisplayName(NvDisplayHandle NvDispHandle, NvAPI_ShortString szDisplayName);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GetUnAttachedAssociatedDisplayName
-//
-// DESCRIPTION: Returns the display name given. Eg: "\\DISPLAY1" using the NVIDIA unattached display handle
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: either argument is NULL
-// NVAPI_OK: *pNvDispHandle is now valid
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA device maps to that display name
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GetUnAttachedAssociatedDisplayName(NvUnAttachedDisplayHandle hNvUnAttachedDisp, NvAPI_ShortString szDisplayName);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_EnableHWCursor
-//
-// DESCRIPTION: Enable hardware cursor support
-//
-// SUPPORTED OS: Windows XP
-//
-// RETURN STATUS: NVAPI_ERROR or NVAPI_OK
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_EnableHWCursor(NvDisplayHandle hNvDisplay);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_DisableHWCursor
-//
-// DESCRIPTION: Disable hardware cursor support
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_ERROR or NVAPI_OK
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_DisableHWCursor(NvDisplayHandle hNvDisplay);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GetVBlankCounter
-//
-// DESCRIPTION: get vblank counter
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_ERROR or NVAPI_OK
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GetVBlankCounter(NvDisplayHandle hNvDisplay, NvU32 *pCounter);
-
-///////////////////////////////////////////////////////////////////////////////
-// FUNCTION NAME: NvAPI_SetRefreshRateOverride
-// DESCRIPTION: Override the refresh rate on the given display/outputsMask.
-// The new refresh rate can be applied right away in this API call or deferred to happen with the
-// next OS modeset. The override is only good for one modeset (doesn't matter it's deferred or immediate).
-//
-// SUPPORTED OS: Windows XP
-//
-//
-// INPUT: hNvDisplay - the NVIDIA display handle. It can be NVAPI_DEFAULT_HANDLE or a handle
-// enumerated from NvAPI_EnumNVidiaDisplayHandle().
-//
-// outputsMask - a set of bits that identify all target outputs which are associated with the NVIDIA
-// display handle to apply the refresh rate override. Note when SLI is enabled, the
-// outputsMask only applies to the GPU that is driving the display output.
-//
-// refreshRate - the override value. "0.0" means cancel the override.
-//
-//
-// bSetDeferred - "0": apply the refresh rate override immediately in this API call.
-// "1": apply refresh rate at the next OS modeset.
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hNvDisplay or outputsMask is invalid
-// NVAPI_OK: the refresh rate override is correct set
-// NVAPI_ERROR: the operation failed
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_SetRefreshRateOverride(NvDisplayHandle hNvDisplay, NvU32 outputsMask, float refreshRate, NvU32 bSetDeferred);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GetAssociatedDisplayOutputId
-//
-// DESCRIPTION: Gets the active outputId associated with the display handle.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. It can be NVAPI_DEFAULT_HANDLE or a handle enumerated from NvAPI_EnumNVidiaDisplayHandle().
-// outputId(OUT) - The active display output id associated with the selected display handle hNvDisplay.
-// The outputid will have only one bit set. In case of clone or span this will indicate the display
-// outputId of the primary display that the GPU is driving.
-// RETURN STATUS: NVAPI_OK: call successful.
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found.
-// NVAPI_EXPECTED_DISPLAY_HANDLE: hNvDisplay is not a valid display handle.
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GetAssociatedDisplayOutputId(NvDisplayHandle hNvDisplay, NvU32 *pOutputId);
-
-///////////////////////////////////////////////////////////////////////////////
-// FUNCTION NAME: NvAPI_GetDisplayPortInfo
-//
-// DESCRIPTION: This API returns the current DP related into on the specified device(monitor)
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. It can be NVAPI_DEFAULT_HANDLE or a handle enumerated from NvAPI_EnumNVidiaDisplayHandle().
-// outputId(IN) - The display output id. If it's "0" then the default outputId from NvAPI_GetAssociatedDisplayOutputId() will be used.
-// pInfo(OUT) - The display port info
-//
-// RETURN STATUS:
-// NVAPI_OK - completed request
-// NVAPI_ERROR - miscellaneous error occurred
-// NVAPI_INVALID_ARGUMENT: Invalid input parameter.
-//
-///////////////////////////////////////////////////////////////////////////////
-typedef enum
-{
- NV_DP_1_62GBPS = 6,
- NV_DP_2_70GBPS = 0xA,
-} NV_DP_LINK_RATE;
-
-typedef enum
-{
- NV_DP_1_LANE = 1,
- NV_DP_2_LANE = 2,
- NV_DP_4_LANE = 4,
-} NV_DP_LANE_COUNT;
-
-typedef enum
-{
- NV_DP_COLOR_FORMAT_RGB = 0,
- NV_DP_COLOR_FORMAT_YCbCr422,
- NV_DP_COLOR_FORMAT_YCbCr444,
-} NV_DP_COLOR_FORMAT;
-
-typedef enum
-{
- NV_DP_COLORIMETRY_RGB = 0,
- NV_DP_COLORIMETRY_YCbCr_ITU601,
- NV_DP_COLORIMETRY_YCbCr_ITU709,
-} NV_DP_COLORIMETRY;
-
-typedef enum
-{
- NV_DP_DYNAMIC_RANGE_VESA = 0,
- NV_DP_DYNAMIC_RANGE_CEA,
-} NV_DP_DYNAMIC_RANGE;
-
-typedef enum
-{
- NV_DP_BPC_DEFAULT = 0,
- NV_DP_BPC_6,
- NV_DP_BPC_8,
- NV_DP_BPC_10,
- NV_DP_BPC_12,
- NV_DP_BPC_16,
-} NV_DP_BPC;
-
-typedef struct
-{
- NvU32 version; // structure version
- NvU32 dpcd_ver; // the DPCD version of the monitor
- NV_DP_LINK_RATE maxLinkRate; // the max supported link rate
- NV_DP_LANE_COUNT maxLaneCount; // the max supported lane count
- NV_DP_LINK_RATE curLinkRate; // the current link rate
- NV_DP_LANE_COUNT curLaneCount; // the current lane count
- NV_DP_COLOR_FORMAT colorFormat; // the current color format
- NV_DP_DYNAMIC_RANGE dynamicRange; // the dynamic range
- NV_DP_COLORIMETRY colorimetry; // ignored in RGB space
- NV_DP_BPC bpc; // the current bit-per-component;
- NvU32 isDp : 1; // if the monitor is driven by display port
- NvU32 isInternalDp : 1; // if the monitor is driven by NV Dp transmitter
- NvU32 isColorCtrlSupported : 1; // if the color format change is supported
- NvU32 is6BPCSupported : 1; // if 6 bpc is supported
- NvU32 is8BPCSupported : 1; // if 8 bpc is supported
- NvU32 is10BPCSupported : 1; // if 10 bpc is supported
- NvU32 is12BPCSupported : 1; // if 12 bpc is supported
- NvU32 is16BPCSupported : 1; // if 16 bpc is supported
- } NV_DISPLAY_PORT_INFO;
-
-#define NV_DISPLAY_PORT_INFO_VER MAKE_NVAPI_VERSION(NV_DISPLAY_PORT_INFO,1)
-
-NVAPI_INTERFACE NvAPI_GetDisplayPortInfo(NvDisplayHandle hNvDisplay, NvU32 outputId, NV_DISPLAY_PORT_INFO *pInfo);
-
-///////////////////////////////////////////////////////////////////////////////
-// FUNCTION NAME: NvAPI_SetDisplayPort
-//
-// DESCRIPTION: This API is used to setup DP related configurations.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// PARAMETERS: hNvDisplay(IN) - NVIDIA display handle. It can be NVAPI_DEFAULT_HANDLE or a handle enumerated from NvAPI_EnumNVidiaDisplayHandle().
-// outputId(IN) - This display output ID, when it's "0" it means the default outputId generated from the return of NvAPI_GetAssociatedDisplayOutputId().
-// pCfg(IN) - The display port config structure. If pCfg is NULL, it means to use the driver's default value to setup.
-//
-// RETURN STATUS:
-// NVAPI_OK - completed request
-// NVAPI_ERROR - miscellaneous error occurred
-// NVAPI_INVALID_ARGUMENT: Invalid input parameter.
-///////////////////////////////////////////////////////////////////////////////
-typedef struct
-{
- NvU32 version; // structure version - 2 is latest
- NV_DP_LINK_RATE linkRate; // the link rate
- NV_DP_LANE_COUNT laneCount; // the lane count
- NV_DP_COLOR_FORMAT colorFormat; // the color format to set
- NV_DP_DYNAMIC_RANGE dynamicRange; // the dynamic range
- NV_DP_COLORIMETRY colorimetry; // ignored in RGB space
- NV_DP_BPC bpc; // the current bit-per-component;
- NvU32 isHPD : 1; // if CPL is making this call due to HPD
- NvU32 isSetDeferred : 1; // requires an OS modeset to finalize the setup if set
- NvU32 isChromaLpfOff : 1; // force the chroma low_pass_filter to be off
- NvU32 isDitherOff : 1; // force to turn off dither
-} NV_DISPLAY_PORT_CONFIG;
-
-#define NV_DISPLAY_PORT_CONFIG_VER MAKE_NVAPI_VERSION(NV_DISPLAY_PORT_CONFIG,2)
-#define NV_DISPLAY_PORT_CONFIG_VER_1 MAKE_NVAPI_VERSION(NV_DISPLAY_PORT_CONFIG,1)
-#define NV_DISPLAY_PORT_CONFIG_VER_2 MAKE_NVAPI_VERSION(NV_DISPLAY_PORT_CONFIG,2)
-
-NVAPI_INTERFACE NvAPI_SetDisplayPort(NvDisplayHandle hNvDisplay, NvU32 outputId, NV_DISPLAY_PORT_CONFIG *pCfg);
-
-///////////////////////////////////////////////////////////////////////////////
-// FUNCTION NAME: NvAPI_GetHDMISupportInfo
-//
-// DESCRIPTION: This API returns the current infoframe data on the specified device(monitor)
-//
-// SUPPORTED OS: Windows Vista and higher
-//
-// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. It can be NVAPI_DEFAULT_HANDLE or a handle enumerated from NvAPI_EnumNVidiaDisplayHandle().
-// outputId(IN) - The display output id. If it's "0" then the default outputId from NvAPI_GetAssociatedDisplayOutputId() will be used.
-// pInfo(OUT) - The monitor and GPU's HDMI support info
-//
-// RETURN STATUS:
-// NVAPI_OK - completed request
-// NVAPI_ERROR - miscellaneous error occurred
-// NVAPI_INVALID_ARGUMENT: Invalid input parameter.
-//
-///////////////////////////////////////////////////////////////////////////////
-typedef struct
-{
- NvU32 version; // structure version
- NvU32 isGpuHDMICapable : 1; // if the GPU can handle HDMI
- NvU32 isMonUnderscanCapable : 1; // if the monitor supports underscan
- NvU32 isMonBasicAudioCapable : 1; // if the monitor supports basic audio
- NvU32 isMonYCbCr444Capable : 1; // if YCbCr 4:4:4 is supported
- NvU32 isMonYCbCr422Capable : 1; // if YCbCr 4:2:2 is supported
- NvU32 isMonxvYCC601Capable : 1; // if xvYCC 601 is supported
- NvU32 isMonxvYCC709Capable : 1; // if xvYCC 709 is supported
- NvU32 isMonHDMI : 1; // if the monitor is HDMI (with IEEE's HDMI registry ID)
- NvU32 EDID861ExtRev; // the revision number of the EDID 861 extension
- } NV_HDMI_SUPPORT_INFO;
-
-#define NV_HDMI_SUPPORT_INFO_VER MAKE_NVAPI_VERSION(NV_HDMI_SUPPORT_INFO,1)
-
-NVAPI_INTERFACE NvAPI_GetHDMISupportInfo(NvDisplayHandle hNvDisplay, NvU32 outputId, NV_HDMI_SUPPORT_INFO *pInfo);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetAllOutputs
-//
-// DESCRIPTION: Returns set of all GPU-output identifiers as a bitmask.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pOutputsMask is NULL
-// NVAPI_OK: *pOutputsMask contains a set of GPU-output identifiers
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetAllOutputs(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pOutputsMask);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetConnectedOutputs
-//
-// DESCRIPTION: Same as NvAPI_GPU_GetAllOutputs but returns only the set of GPU-output
-// identifiers that are connected to display devices.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pOutputsMask is NULL
-// NVAPI_OK: *pOutputsMask contains a set of GPU-output identifiers
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetConnectedOutputs(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pOutputsMask);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetConnectedSLIOutputs
-//
-// DESCRIPTION: Same as NvAPI_GPU_GetConnectedOutputs but returns only the set of GPU-output
-// identifiers that can be selected in an SLI configuration. With SLI disabled
-// this function matches NvAPI_GPU_GetConnectedOutputs
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pOutputsMask is NULL
-// NVAPI_OK: *pOutputsMask contains a set of GPU-output identifiers
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetConnectedSLIOutputs(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pOutputsMask);
-
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetConnectedOutputsWithLidState
-//
-// DESCRIPTION: Similar to NvAPI_GPU_GetConnectedOutputs this API returns the connected display identifiers that are connected
-// as a output mask but unlike NvAPI_GPU_GetConnectedOutputs this API "always" reflects the Lid State in the output mask.
-// Thus if you expect the LID close state to be available in the connection mask use this API.
-// If LID is closed then this API will remove the LID panel from the connected display identifiers.
-// If LID is open then this API will reflect the LID panel in the connected display identifiers.
-// Note:This API should be used on laptop systems and on systems where LID state is required in the connection output mask.
-// On desktop systems the returned identifiers will match NvAPI_GPU_GetConnectedOutputs.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pOutputsMask is NULL
-// NVAPI_OK: *pOutputsMask contains a set of GPU-output identifiers
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetConnectedOutputsWithLidState(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pOutputsMask);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetConnectedSLIOutputsWithLidState
-//
-// DESCRIPTION: Same as NvAPI_GPU_GetConnectedOutputsWithLidState but returns only the set of GPU-output
-// identifiers that can be selected in an SLI configuration. With SLI disabled
-// this function matches NvAPI_GPU_GetConnectedOutputsWithLidState
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pOutputsMask is NULL
-// NVAPI_OK: *pOutputsMask contains a set of GPU-output identifiers
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetConnectedSLIOutputsWithLidState(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pOutputsMask);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetSystemType
-//
-// DESCRIPTION: Returns information to identify if the GPU type is for a laptop system or a desktop system.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pOutputsMask is NULL
-// NVAPI_OK: *pSystemType contains the GPU system type
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-typedef enum
-{
- NV_SYSTEM_TYPE_UNKNOWN = 0,
- NV_SYSTEM_TYPE_LAPTOP = 1,
- NV_SYSTEM_TYPE_DESKTOP = 2,
-
-} NV_SYSTEM_TYPE;
-
-NVAPI_INTERFACE NvAPI_GPU_GetSystemType(NvPhysicalGpuHandle hPhysicalGpu, NV_SYSTEM_TYPE *pSystemType);
-
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetActiveOutputs
-//
-// DESCRIPTION: Same as NvAPI_GPU_GetAllOutputs but returns only the set of GPU-output
-// identifiers that are actively driving display devices.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pOutputsMask is NULL
-// NVAPI_OK: *pOutputsMask contains a set of GPU-output identifiers
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetActiveOutputs(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pOutputsMask);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetEDID
-//
-// DESCRIPTION: Returns the EDID data for the specified GPU handle and connection bit mask.
-// displayOutputId should have exactly 1 bit set to indicate a single display.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: pEDID is NULL; displayOutputId has 0 or > 1 bits set.
-// NVAPI_OK: *pEDID contains valid data.
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found.
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle.
-// NVAPI_DATA_NOT_FOUND: requested display does not contain an EDID
-//
-///////////////////////////////////////////////////////////////////////////////
-#define NV_EDID_V1_DATA_SIZE 256
-#define NV_EDID_DATA_SIZE NV_EDID_V1_DATA_SIZE
-
-typedef struct
-{
- NvU32 version; //structure version
- NvU8 EDID_Data[NV_EDID_DATA_SIZE];
- NvU32 sizeofEDID;
-} NV_EDID;
-
-#define NV_EDID_VER MAKE_NVAPI_VERSION(NV_EDID,2)
-
-NVAPI_INTERFACE NvAPI_GPU_GetEDID(NvPhysicalGpuHandle hPhysicalGpu, NvU32 displayOutputId, NV_EDID *pEDID);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetOutputType
-//
-// DESCRIPTION: Give a physical GPU handle and a single outputId (exactly 1 bit set), this API
-// returns the output type.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu, outputId or pOutputsMask is NULL; or outputId has > 1 bit set
-// NVAPI_OK: *pOutputType contains a NvGpuOutputType value
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-typedef enum _NV_GPU_OUTPUT_TYPE
-{
- NVAPI_GPU_OUTPUT_UNKNOWN = 0,
- NVAPI_GPU_OUTPUT_CRT = 1, // CRT display device
- NVAPI_GPU_OUTPUT_DFP = 2, // Digital Flat Panel display device
- NVAPI_GPU_OUTPUT_TV = 3, // TV display device
-} NV_GPU_OUTPUT_TYPE;
-
-NVAPI_INTERFACE NvAPI_GPU_GetOutputType(NvPhysicalGpuHandle hPhysicalGpu, NvU32 outputId, NV_GPU_OUTPUT_TYPE *pOutputType);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_ValidateOutputCombination
-//
-// DESCRIPTION: This call is used to determine if a set of GPU outputs can be active
-// simultaneously. While a GPU may have outputs, they can not typically
-// all be active at the same time due to internal resource sharing.
-//
-// Given a physical GPU handle and a mask of candidate outputs, this call
-// will return NVAPI_OK if all of the specified outputs can be driven
-// simultaneously. It will return NVAPI_INVALID_COMBINATION if they cannot.
-//
-// Use NvAPI_GPU_GetAllOutputs() to determine which outputs are candidates.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// RETURN STATUS: NVAPI_OK: combination of outputs in outputsMask are valid (can be active simultaneously)
-// NVAPI_INVALID_COMBINATION: combination of outputs in outputsMask are NOT valid
-// NVAPI_INVALID_ARGUMENT: hPhysicalGpu or outputsMask does not have at least 2 bits set
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_ValidateOutputCombination(NvPhysicalGpuHandle hPhysicalGpu, NvU32 outputsMask);
-
-typedef enum _NV_GPU_CONNECTOR_TYPE
-{
- NVAPI_GPU_CONNECTOR_VGA_15_PIN = 0x00000000,
- NVAPI_GPU_CONNECTOR_TV_COMPOSITE = 0x00000010,
- NVAPI_GPU_CONNECTOR_TV_SVIDEO = 0x00000011,
- NVAPI_GPU_CONNECTOR_TV_HDTV_COMPONENT = 0x00000013,
- NVAPI_GPU_CONNECTOR_TV_SCART = 0x00000014,
- NVAPI_GPU_CONNECTOR_TV_COMPOSITE_SCART_ON_EIAJ4120 = 0x00000016,
- NVAPI_GPU_CONNECTOR_TV_HDTV_EIAJ4120 = 0x00000017,
- NVAPI_GPU_CONNECTOR_PC_POD_HDTV_YPRPB = 0x00000018,
- NVAPI_GPU_CONNECTOR_PC_POD_SVIDEO = 0x00000019,
- NVAPI_GPU_CONNECTOR_PC_POD_COMPOSITE = 0x0000001A,
- NVAPI_GPU_CONNECTOR_DVI_I_TV_SVIDEO = 0x00000020,
- NVAPI_GPU_CONNECTOR_DVI_I_TV_COMPOSITE = 0x00000021,
- NVAPI_GPU_CONNECTOR_DVI_I = 0x00000030,
- NVAPI_GPU_CONNECTOR_DVI_D = 0x00000031,
- NVAPI_GPU_CONNECTOR_ADC = 0x00000032,
- NVAPI_GPU_CONNECTOR_LFH_DVI_I_1 = 0x00000038,
- NVAPI_GPU_CONNECTOR_LFH_DVI_I_2 = 0x00000039,
- NVAPI_GPU_CONNECTOR_SPWG = 0x00000040,
- NVAPI_GPU_CONNECTOR_OEM = 0x00000041,
- NVAPI_GPU_CONNECTOR_DISPLAYPORT_EXTERNAL = 0x00000046,
- NVAPI_GPU_CONNECTOR_DISPLAYPORT_INTERNAL = 0x00000047,
- NVAPI_GPU_CONNECTOR_HDMI_A = 0x00000061,
- NVAPI_GPU_CONNECTOR_UNKNOWN = 0xFFFFFFFF,
-} NV_GPU_CONNECTOR_TYPE;
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetFullName
-//
-// DESCRIPTION: Retrieves the full GPU name as an ascii string. Eg: "Quadro FX 1400"
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_ERROR or NVAPI_OK
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetFullName(NvPhysicalGpuHandle hPhysicalGpu, NvAPI_ShortString szName);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetPCIIdentifiers
-//
-// DESCRIPTION: Returns the PCI identifiers associated with this GPU.
-// DeviceId - the internal PCI device identifier for the GPU.
-// SubSystemId - the internal PCI subsystem identifier for the GPU.
-// RevisionId - the internal PCI device-specific revision identifier for the GPU.
-// ExtDeviceId - the external PCI device identifier for the GPU.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or an argument is NULL
-// NVAPI_OK: arguments are populated with PCI identifiers
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetPCIIdentifiers(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pDeviceId,NvU32 *pSubSystemId,NvU32 *pRevisionId,NvU32 *pExtDeviceId);
-
-typedef enum _NV_GPU_TYPE
-{
- NV_SYSTEM_TYPE_GPU_UNKNOWN = 0,
- NV_SYSTEM_TYPE_IGPU = 1, //integrated
- NV_SYSTEM_TYPE_DGPU = 2, //discrete
-} NV_GPU_TYPE;
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetGPUType
-//
-// DESCRIPTION: Returns information to identify the GPU type
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu
-// NVAPI_OK: *pGpuType contains the GPU type
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetGPUType(NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_TYPE *pGpuType);
-
-typedef enum _NV_GPU_BUS_TYPE
-{
- NVAPI_GPU_BUS_TYPE_UNDEFINED = 0,
- NVAPI_GPU_BUS_TYPE_PCI = 1,
- NVAPI_GPU_BUS_TYPE_AGP = 2,
- NVAPI_GPU_BUS_TYPE_PCI_EXPRESS = 3,
- NVAPI_GPU_BUS_TYPE_FPCI = 4,
-} NV_GPU_BUS_TYPE;
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetBusType
-//
-// DESCRIPTION: Returns the type of bus associated with this GPU.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pBusType is NULL
-// NVAPI_OK: *pBusType contains bus identifier
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetBusType(NvPhysicalGpuHandle hPhysicalGpu,NV_GPU_BUS_TYPE *pBusType);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetBusId
-//
-// DESCRIPTION: Returns the ID of bus associated with this GPU.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pBusId is NULL
-// NVAPI_OK: *pBusId contains bus id
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetBusId(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pBusId);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetBusSlotId
-//
-// DESCRIPTION: Returns the ID of bus-slot associated with this GPU.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pBusSlotId is NULL
-// NVAPI_OK: *pBusSlotId contains bus-slot id
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetBusSlotId(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pBusSlotId);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetIRQ
-//
-// DESCRIPTION: Returns the interrupt number associated with this GPU.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pIRQ is NULL
-// NVAPI_OK: *pIRQ contains interrupt number
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetIRQ(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pIRQ);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetVbiosRevision
-//
-// DESCRIPTION: Returns the revision of the video bios associated with this GPU.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pBiosRevision is NULL
-// NVAPI_OK: *pBiosRevision contains revision number
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetVbiosRevision(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pBiosRevision);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetVbiosOEMRevision
-//
-// DESCRIPTION: Returns the OEM revision of the video bios associated with this GPU.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pBiosRevision is NULL
-// NVAPI_OK: *pBiosRevision contains revision number
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetVbiosOEMRevision(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pBiosRevision);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetVbiosVersionString
-//
-// DESCRIPTION: Returns the full bios version string in the form of xx.xx.xx.xx.yy where
-// the xx numbers come from NvAPI_GPU_GetVbiosRevision and yy comes from
-// NvAPI_GPU_GetVbiosOEMRevision.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu is NULL
-// NVAPI_OK: szBiosRevision contains version string
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetVbiosVersionString(NvPhysicalGpuHandle hPhysicalGpu,NvAPI_ShortString szBiosRevision);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetAGPAperture
-//
-// DESCRIPTION: Returns AGP aperture in megabytes
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: pSize is NULL
-// NVAPI_OK: call successful
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetAGPAperture(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pSize);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetCurrentAGPRate
-//
-// DESCRIPTION: Returns the current AGP Rate (1 = 1x, 2=2x etc, 0 = AGP not present)
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: pRate is NULL
-// NVAPI_OK: call successful
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetCurrentAGPRate(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pRate);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetCurrentPCIEDownstreamWidth
-//
-// DESCRIPTION: Returns the number of PCIE lanes being used for the PCIE interface
-// downstream from the GPU.
-//
-// On systems that do not support PCIE, the maxspeed for the root link
-// will be zero.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: pWidth is NULL
-// NVAPI_OK: call successful
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetCurrentPCIEDownstreamWidth(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pWidth);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetPhysicalFrameBufferSize
-//
-// DESCRIPTION: Returns the physical size of framebuffer in Kb. This does NOT include any
-// system RAM that may be dedicated for use by the GPU.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: pSize is NULL
-// NVAPI_OK: call successful
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetPhysicalFrameBufferSize(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pSize);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetVirtualFrameBufferSize
-//
-// DESCRIPTION: Returns the virtual size of framebuffer in Kb. This includes the physical RAM plus any
-// system RAM that has been dedicated for use by the GPU.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: pSize is NULL
-// NVAPI_OK: call successful
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetVirtualFrameBufferSize(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pSize);
-
-///////////////////////////////////////////////////////////////////////////////////
-// Thermal API
-// Provides ability to get temperature levels from the various thermal sensors associated with the GPU
-
-#define NVAPI_MAX_THERMAL_SENSORS_PER_GPU 3
-
-typedef enum
-{
- NVAPI_THERMAL_TARGET_NONE = 0,
- NVAPI_THERMAL_TARGET_GPU = 1,
- NVAPI_THERMAL_TARGET_MEMORY = 2,
- NVAPI_THERMAL_TARGET_POWER_SUPPLY = 4,
- NVAPI_THERMAL_TARGET_BOARD = 8,
- NVAPI_THERMAL_TARGET_ALL = 15,
- NVAPI_THERMAL_TARGET_UNKNOWN = -1,
-} NV_THERMAL_TARGET;
-
-typedef enum
-{
- NVAPI_THERMAL_CONTROLLER_NONE = 0,
- NVAPI_THERMAL_CONTROLLER_GPU_INTERNAL,
- NVAPI_THERMAL_CONTROLLER_ADM1032,
- NVAPI_THERMAL_CONTROLLER_MAX6649,
- NVAPI_THERMAL_CONTROLLER_MAX1617,
- NVAPI_THERMAL_CONTROLLER_LM99,
- NVAPI_THERMAL_CONTROLLER_LM89,
- NVAPI_THERMAL_CONTROLLER_LM64,
- NVAPI_THERMAL_CONTROLLER_ADT7473,
- NVAPI_THERMAL_CONTROLLER_SBMAX6649,
- NVAPI_THERMAL_CONTROLLER_VBIOSEVT,
- NVAPI_THERMAL_CONTROLLER_OS,
- NVAPI_THERMAL_CONTROLLER_UNKNOWN = -1,
-} NV_THERMAL_CONTROLLER;
-
-typedef struct
-{
- NvU32 version; //structure version
- NvU32 count; //number of associated thermal sensors with the selected GPU
- struct
- {
- NV_THERMAL_CONTROLLER controller; //internal, ADM1032, MAX6649...
- NvU32 defaultMinTemp; //the min default temperature value of the thermal sensor in degrees centigrade
- NvU32 defaultMaxTemp; //the max default temperature value of the thermal sensor in degrees centigrade
- NvU32 currentTemp; //the current temperature value of the thermal sensor in degrees centigrade
- NV_THERMAL_TARGET target; //thermal senor targeted @ GPU, memory, chipset, powersupply, canoas...
- } sensor[NVAPI_MAX_THERMAL_SENSORS_PER_GPU];
-
-} NV_GPU_THERMAL_SETTINGS;
-
-#define NV_GPU_THERMAL_SETTINGS_VER MAKE_NVAPI_VERSION(NV_GPU_THERMAL_SETTINGS,1)
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GPU_GetThermalSettings
-//
-// DESCRIPTION: Retrieves the thermal information of all thermal sensors or specific thermal sensor associated with the selected GPU.
-// Thermal sensors are indexed 0 to NVAPI_MAX_THERMAL_SENSORS_PER_GPU-1.
-// To retrieve specific thermal sensor info set the sensorIndex to the required thermal sensor index.
-// To retrieve info for all sensors set sensorIndex to NVAPI_THERMAL_TARGET_ALL.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// PARAMETERS : hPhysicalGPU(IN) - GPU selection.
-// sensorIndex(IN) - Explicit thermal sensor index selection.
-// pThermalSettings(OUT) - Array of thermal settings.
-//
-// RETURN STATUS:
-// NVAPI_OK - completed request
-// NVAPI_ERROR - miscellaneous error occurred
-// NVAPI_INVALID_ARGUMENT - pThermalInfo is NULL
-// NVAPI_HANDLE_INVALIDATED - handle passed has been invalidated (see user guide)
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE - handle passed is not a physical GPU handle
-// NVAPI_INCOMPATIBLE_STRUCT_VERSION - the version of the INFO struct is not supported
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GPU_GetThermalSettings(NvPhysicalGpuHandle hPhysicalGpu, NvU32 sensorIndex, NV_GPU_THERMAL_SETTINGS *pThermalSettings);
-
-////////////////////////////////////////////////////////////////////////////////
-//NvAPI_TVOutput Information
-
-typedef enum _NV_DISPLAY_TV_FORMAT
-{
- NV_DISPLAY_TV_FORMAT_NONE = 0,
- NV_DISPLAY_TV_FORMAT_SD_NTSCM = 0x00000001,
- NV_DISPLAY_TV_FORMAT_SD_NTSCJ = 0x00000002,
- NV_DISPLAY_TV_FORMAT_SD_PALM = 0x00000004,
- NV_DISPLAY_TV_FORMAT_SD_PALBDGH = 0x00000008,
- NV_DISPLAY_TV_FORMAT_SD_PALN = 0x00000010,
- NV_DISPLAY_TV_FORMAT_SD_PALNC = 0x00000020,
- NV_DISPLAY_TV_FORMAT_SD_576i = 0x00000100,
- NV_DISPLAY_TV_FORMAT_SD_480i = 0x00000200,
- NV_DISPLAY_TV_FORMAT_ED_480p = 0x00000400,
- NV_DISPLAY_TV_FORMAT_ED_576p = 0x00000800,
- NV_DISPLAY_TV_FORMAT_HD_720p = 0x00001000,
- NV_DISPLAY_TV_FORMAT_HD_1080i = 0x00002000,
- NV_DISPLAY_TV_FORMAT_HD_1080p = 0x00004000,
- NV_DISPLAY_TV_FORMAT_HD_720p50 = 0x00008000,
- NV_DISPLAY_TV_FORMAT_HD_1080p24 = 0x00010000,
- NV_DISPLAY_TV_FORMAT_HD_1080i50 = 0x00020000,
- NV_DISPLAY_TV_FORMAT_HD_1080p50 = 0x00040000,
-
-} NV_DISPLAY_TV_FORMAT;
-
-///////////////////////////////////////////////////////////////////////////////////
-// I2C API
-// Provides ability to read or write data using I2C protocol.
-// These APIs allow I2C access only to DDC monitors
-
-#define NVAPI_MAX_SIZEOF_I2C_DATA_BUFFER 256
-#define NVAPI_NO_PORTID_FOUND 5
-#define NVAPI_DISPLAY_DEVICE_MASK_MAX 24
-
-typedef struct
-{
- NvU32 version; //structure version
- NvU32 displayMask; //the Display Mask of the concerned display
- NvU8 bIsDDCPort; //Flag indicating DDC port or a communication port
- NvU8 i2cDevAddress; //the I2C target device address
- NvU8* pbI2cRegAddress;//the I2C target register address
- NvU32 regAddrSize; //the size in bytes of target register address
- NvU8* pbData; //The buffer of data which is to be read/written
- NvU32 cbSize; //The size of Data buffer to be read.
- NvU32 i2cSpeed; //The speed at which the transaction is be made(between 28kbps to 40kbps)
-} NV_I2C_INFO;
-
-#define NV_I2C_INFO_VER MAKE_NVAPI_VERSION(NV_I2C_INFO,1)
-/***********************************************************************************/
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_I2CRead
-//
-// DESCRIPTION: Read data buffer from I2C port
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// PARAMETERS: hPhysicalGPU(IN) - GPU selection.
-// NV_I2C_INFO *pI2cInfo -The I2c data input structure
-//
-// RETURN STATUS:
-// NVAPI_OK - completed request
-// NVAPI_ERROR - miscellaneous error occurred
-// NVAPI_HANDLE_INVALIDATED - handle passed has been invalidated (see user guide)
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE - handle passed is not a physical GPU handle
-// NVAPI_INCOMPATIBLE_STRUCT_VERSION - structure version is not supported
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_I2CRead(NvPhysicalGpuHandle hPhysicalGpu, NV_I2C_INFO *pI2cInfo);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_I2CWrite
-//
-// DESCRIPTION: Writes data buffer to I2C port
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// PARAMETERS: hPhysicalGPU(IN) - GPU selection.
-// NV_I2C_INFO *pI2cInfo -The I2c data input structure
-//
-// RETURN STATUS:
-// NVAPI_OK - completed request
-// NVAPI_ERROR - miscellaneous error occurred
-// NVAPI_HANDLE_INVALIDATED - handle passed has been invalidated (see user guide)
-// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE - handle passed is not a physical GPU handle
-// NVAPI_INCOMPATIBLE_STRUCT_VERSION - structure version is not supported
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_I2CWrite(NvPhysicalGpuHandle hPhysicalGpu, NV_I2C_INFO *pI2cInfo);
-
-
-typedef struct
-{
- NvU32 version; //structure version
- NvU32 vendorId; //vendorId
- NvU32 deviceId; //deviceId
- NvAPI_ShortString szVendorName; //vendor Name
- NvAPI_ShortString szChipsetName; //device Name
- NvU32 flags; //Chipset info flags - obsolete
- NvU32 subSysVendorId; //subsystem vendorId
- NvU32 subSysDeviceId; //subsystem deviceId
- NvAPI_ShortString szSubSysVendorName; //subsystem vendor Name
-} NV_CHIPSET_INFO;
-
-#define NV_CHIPSET_INFO_VER MAKE_NVAPI_VERSION(NV_CHIPSET_INFO,3)
-
-typedef enum
-{
- NV_CHIPSET_INFO_HYBRID = 0x00000001,
-} NV_CHIPSET_INFO_FLAGS;
-
-typedef struct
-{
- NvU32 version; //structure version
- NvU32 vendorId; //vendorId
- NvU32 deviceId; //deviceId
- NvAPI_ShortString szVendorName; //vendor Name
- NvAPI_ShortString szChipsetName; //device Name
- NvU32 flags; //Chipset info flags
-} NV_CHIPSET_INFO_v2;
-
-#define NV_CHIPSET_INFO_VER_2 MAKE_NVAPI_VERSION(NV_CHIPSET_INFO_v2,2)
-
-typedef struct
-{
- NvU32 version; //structure version
- NvU32 vendorId; //vendorId
- NvU32 deviceId; //deviceId
- NvAPI_ShortString szVendorName; //vendor Name
- NvAPI_ShortString szChipsetName; //device Name
-} NV_CHIPSET_INFO_v1;
-
-#define NV_CHIPSET_INFO_VER_1 MAKE_NVAPI_VERSION(NV_CHIPSET_INFO_v1,1)
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_SYS_GetChipSetInfo
-//
-// DESCRIPTION: Returns information about the System's ChipSet
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_INVALID_ARGUMENT: pChipSetInfo is NULL
-// NVAPI_OK: *pChipSetInfo is now set
-// NVAPI_INCOMPATIBLE_STRUCT_VERSION - NV_CHIPSET_INFO version not compatible with driver
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_SYS_GetChipSetInfo(NV_CHIPSET_INFO *pChipSetInfo);
-
-typedef struct
-{
- NvU32 version; // Structure version, constructed from macro below
- NvU32 currentLidState;
- NvU32 currentDockState;
- NvU32 currentLidPolicy;
- NvU32 currentDockPolicy;
- NvU32 forcedLidMechanismPresent;
- NvU32 forcedDockMechanismPresent;
-}NV_LID_DOCK_PARAMS;
-
-#define NV_LID_DOCK_PARAMS_VER MAKE_NVAPI_VERSION(NV_LID_DOCK_PARAMS,1)
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_GetLidDockInfo
-//
-// DESCRIPTION: Returns current lid and dock information.
-//
-// SUPPORTED OS: Mac OS X, Windows XP and higher
-//
-// RETURN STATUS: NVAPI_OK: now *pLidAndDock contains the returned lid and dock information.
-// NVAPI_ERROR:If any way call is not success.
-// NVAPI_NOT_SUPPORTED:If any way call is not success.
-// NVAPI_HANDLE_INVALIDATED:If nvapi escape result handle is invalid.
-// NVAPI_API_NOT_INTIALIZED:If NVAPI is not initialized.
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_SYS_GetLidAndDockInfo(NV_LID_DOCK_PARAMS *pLidAndDock);
-
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_OGL_ExpertModeSet[Get]
-//
-// DESCRIPTION: Configure OpenGL Expert Mode, an API usage feedback and
-// advice reporting mechanism. The effects of this call are
-// applied only to the current context, and are reset to the
-// defaults when the context is destroyed.
-//
-// Note: This feature is valid at runtime only when GLExpert
-// functionality has been built into the OpenGL driver
-// installed on the system. All Windows Vista OpenGL
-// drivers provided by NVIDIA have this instrumentation
-// included by default. Windows XP, however, requires a
-// special display driver available with the NVIDIA
-// PerfSDK found at developer.nvidia.com.
-//
-// Note: These functions are valid only for the current OpenGL
-// context. Calling these functions prior to creating a
-// context and calling MakeCurrent with it will result
-// in errors and undefined behavior.
-//
-// PARAMETERS: expertDetailMask Mask made up of NVAPI_OGLEXPERT_DETAIL bits,
-// this parameter specifies the detail level in
-// the feedback stream.
-//
-// expertReportMask Mask made up of NVAPI_OGLEXPERT_REPORT bits,
-// this parameter specifies the areas of
-// functional interest.
-//
-// expertOutputMask Mask made up of NVAPI_OGLEXPERT_OUTPUT bits,
-// this parameter specifies the feedback output
-// location.
-//
-// expertCallback Used in conjunction with OUTPUT_TO_CALLBACK,
-// this is a simple callback function the user
-// may use to obtain the feedback stream. The
-// function will be called once per fully
-// qualified feedback stream entry.
-//
-// RETURN STATUS: NVAPI_API_NOT_INTIALIZED : NVAPI not initialized
-// NVAPI_NVIDIA_DEVICE_NOT_FOUND : no NVIDIA GPU found
-// NVAPI_OPENGL_CONTEXT_NOT_CURRENT : no NVIDIA OpenGL context
-// which supports GLExpert
-// has been made current
-// NVAPI_ERROR : OpenGL driver failed to load properly
-// NVAPI_OK : success
-//
-///////////////////////////////////////////////////////////////////////////////
-#define NVAPI_OGLEXPERT_DETAIL_NONE 0x00000000
-#define NVAPI_OGLEXPERT_DETAIL_ERROR 0x00000001
-#define NVAPI_OGLEXPERT_DETAIL_SWFALLBACK 0x00000002
-#define NVAPI_OGLEXPERT_DETAIL_BASIC_INFO 0x00000004
-#define NVAPI_OGLEXPERT_DETAIL_DETAILED_INFO 0x00000008
-#define NVAPI_OGLEXPERT_DETAIL_PERFORMANCE_WARNING 0x00000010
-#define NVAPI_OGLEXPERT_DETAIL_QUALITY_WARNING 0x00000020
-#define NVAPI_OGLEXPERT_DETAIL_USAGE_WARNING 0x00000040
-#define NVAPI_OGLEXPERT_DETAIL_ALL 0xFFFFFFFF
-
-#define NVAPI_OGLEXPERT_REPORT_NONE 0x00000000
-#define NVAPI_OGLEXPERT_REPORT_ERROR 0x00000001
-#define NVAPI_OGLEXPERT_REPORT_SWFALLBACK 0x00000002
-#define NVAPI_OGLEXPERT_REPORT_PIPELINE_VERTEX 0x00000004
-#define NVAPI_OGLEXPERT_REPORT_PIPELINE_GEOMETRY 0x00000008
-#define NVAPI_OGLEXPERT_REPORT_PIPELINE_XFB 0x00000010
-#define NVAPI_OGLEXPERT_REPORT_PIPELINE_RASTER 0x00000020
-#define NVAPI_OGLEXPERT_REPORT_PIPELINE_FRAGMENT 0x00000040
-#define NVAPI_OGLEXPERT_REPORT_PIPELINE_ROP 0x00000080
-#define NVAPI_OGLEXPERT_REPORT_PIPELINE_FRAMEBUFFER 0x00000100
-#define NVAPI_OGLEXPERT_REPORT_PIPELINE_PIXEL 0x00000200
-#define NVAPI_OGLEXPERT_REPORT_PIPELINE_TEXTURE 0x00000400
-#define NVAPI_OGLEXPERT_REPORT_OBJECT_BUFFEROBJECT 0x00000800
-#define NVAPI_OGLEXPERT_REPORT_OBJECT_TEXTURE 0x00001000
-#define NVAPI_OGLEXPERT_REPORT_OBJECT_PROGRAM 0x00002000
-#define NVAPI_OGLEXPERT_REPORT_OBJECT_FBO 0x00004000
-#define NVAPI_OGLEXPERT_REPORT_FEATURE_SLI 0x00008000
-#define NVAPI_OGLEXPERT_REPORT_ALL 0xFFFFFFFF
-
-#define NVAPI_OGLEXPERT_OUTPUT_TO_NONE 0x00000000
-#define NVAPI_OGLEXPERT_OUTPUT_TO_CONSOLE 0x00000001
-#define NVAPI_OGLEXPERT_OUTPUT_TO_DEBUGGER 0x00000004
-#define NVAPI_OGLEXPERT_OUTPUT_TO_CALLBACK 0x00000008
-#define NVAPI_OGLEXPERT_OUTPUT_TO_ALL 0xFFFFFFFF
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION TYPE: NVAPI_OGLEXPERT_CALLBACK
-//
-// DESCRIPTION: Used in conjunction with OUTPUT_TO_CALLBACK, this is a simple
-// callback function the user may use to obtain the feedback
-// stream. The function will be called once per fully qualified
-// feedback stream entry.
-//
-// PARAMETERS: categoryId Contains the bit from the NVAPI_OGLEXPERT_REPORT
-// mask that corresponds to the current message
-// messageId Unique Id for the current message
-// detailLevel Contains the bit from the NVAPI_OGLEXPERT_DETAIL
-// mask that corresponds to the current message
-// objectId Unique Id of the object that corresponds to the
-// current message
-// messageStr Text string from the current message
-//
-///////////////////////////////////////////////////////////////////////////////
-typedef void (* NVAPI_OGLEXPERT_CALLBACK) (unsigned int categoryId, unsigned int messageId, unsigned int detailLevel, int objectId, const char *messageStr);
-
-// SUPPORTED OS: Windows XP and higher
-NVAPI_INTERFACE NvAPI_OGL_ExpertModeSet(NvU32 expertDetailLevel,
- NvU32 expertReportMask,
- NvU32 expertOutputMask,
- NVAPI_OGLEXPERT_CALLBACK expertCallback);
-
-
-// SUPPORTED OS: Windows XP and higher
-NVAPI_INTERFACE NvAPI_OGL_ExpertModeGet(NvU32 *pExpertDetailLevel,
- NvU32 *pExpertReportMask,
- NvU32 *pExpertOutputMask,
- NVAPI_OGLEXPERT_CALLBACK *pExpertCallback);
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// FUNCTION NAME: NvAPI_OGL_ExpertModeDefaultsSet[Get]
-//
-// DESCRIPTION: Configure OpenGL Expert Mode global defaults. These settings
-// apply to any OpenGL application which starts up after these
-// values are applied (i.e. these settings *do not* apply to
-// currently running applications).
-//
-// PARAMETERS: expertDetailLevel Value which specifies the detail level in
-// the feedback stream. This is a mask made up
-// of NVAPI_OGLEXPERT_LEVEL bits.
-//
-// expertReportMask Mask made up of NVAPI_OGLEXPERT_REPORT bits,
-// this parameter specifies the areas of
-// functional interest.
-//
-// expertOutputMask Mask made up of NVAPI_OGLEXPERT_OUTPUT bits,
-// this parameter specifies the feedback output
-// location. Note that using OUTPUT_TO_CALLBACK
-// here is meaningless and has no effect, but
-// using it will not cause an error.
-//
-// RETURN STATUS: NVAPI_ERROR or NVAPI_OK
-//
-///////////////////////////////////////////////////////////////////////////////
-
-// SUPPORTED OS: Windows XP and higher
-NVAPI_INTERFACE NvAPI_OGL_ExpertModeDefaultsSet(NvU32 expertDetailLevel,
- NvU32 expertReportMask,
- NvU32 expertOutputMask);
-
-// SUPPORTED OS: Windows XP and higher
-NVAPI_INTERFACE NvAPI_OGL_ExpertModeDefaultsGet(NvU32 *pExpertDetailLevel,
- NvU32 *pExpertReportMask,
- NvU32 *pExpertOutputMask);
-
-#define NVAPI_MAX_VIEW_TARGET 2
-
-typedef enum _NV_TARGET_VIEW_MODE
-{
- NV_VIEW_MODE_STANDARD = 0,
- NV_VIEW_MODE_CLONE = 1,
- NV_VIEW_MODE_HSPAN = 2,
- NV_VIEW_MODE_VSPAN = 3,
- NV_VIEW_MODE_DUALVIEW = 4,
- NV_VIEW_MODE_MULTIVIEW = 5,
-} NV_TARGET_VIEW_MODE;
-
-
-// Following definitions are used in NvAPI_SetViewEx.
-// Scaling modes
-typedef enum _NV_SCALING
-{
- NV_SCALING_DEFAULT = 0, // No change
- NV_SCALING_MONITOR_SCALING = 1,
- NV_SCALING_ADAPTER_SCALING = 2,
- NV_SCALING_CENTERED = 3,
- NV_SCALING_ASPECT_SCALING = 5,
- NV_SCALING_CUSTOMIZED = 255 // For future use
-} NV_SCALING;
-
-// Rotate modes
-typedef enum _NV_ROTATE
-{
- NV_ROTATE_0 = 0,
- NV_ROTATE_90 = 1,
- NV_ROTATE_180 = 2,
- NV_ROTATE_270 = 3
-} NV_ROTATE;
-
-// Color formats
-typedef enum _NV_FORMAT
-{
- NV_FORMAT_UNKNOWN = 0, // unknown. Driver will choose one as following value.
- NV_FORMAT_P8 = 41, // for 8bpp mode
- NV_FORMAT_R5G6B5 = 23, // for 16bpp mode
- NV_FORMAT_A8R8G8B8 = 21, // for 32bpp mode
- NV_FORMAT_A16B16G16R16F = 113 // for 64bpp(floating point) mode.
-} NV_FORMAT;
-
-// TV standard
-
-
-///////////////////////////////////////////////////////////////////////////////
-// FUNCTION NAME: NvAPI_SetView
-//
-// DESCRIPTION: This API lets caller to modify target display arrangement for selected source display handle in any of the nview modes.
-// It also allows to modify or extend the source display in dualview mode.
-//
-// SUPPORTED OS: Windows Vista and higher
-//
-// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. NVAPI_DEFAULT_HANDLE not allowed, it has to be a handle enumerated with NvAPI_EnumNVidiaDisplayHandle().
-// pTargetInfo(IN) - Pointer to array of NV_VIEW_TARGET_INFO, specifying device properties in this view.
-// The first device entry in the array is the physical primary.
-// The device entry with the lowest source id is the desktop primary.
-// targetCount(IN) - Count of target devices specified in pTargetInfo.
-// targetView(IN) - Target view selected from NV_TARGET_VIEW_MODE.
-//
-// RETURN STATUS:
-// NVAPI_OK - completed request
-// NVAPI_ERROR - miscellaneous error occurred
-// NVAPI_INVALID_ARGUMENT: Invalid input parameter.
-//
-///////////////////////////////////////////////////////////////////////////////
-
-typedef struct
-{
- NvU32 version; // (IN) structure version
- NvU32 count; // (IN) target count
- struct
- {
- NvU32 deviceMask; // (IN/OUT) device mask
- NvU32 sourceId; // (IN/OUT) source id
- NvU32 bPrimary:1; // (OUT) Indicates if this is the GPU's primary view target. This is not the desktop GDI primary.
- // NvAPI_SetView automatically selects the first target in NV_VIEW_TARGET_INFO index 0 as the GPU's primary view.
- NvU32 bInterlaced:1;// (IN/OUT) Indicates if the timing being used on this monitor is interlaced
- NvU32 bGDIPrimary:1;// (IN/OUT) Indicates if this is the desktop GDI primary.
- } target[NVAPI_MAX_VIEW_TARGET];
-} NV_VIEW_TARGET_INFO;
-
-#define NV_VIEW_TARGET_INFO_VER MAKE_NVAPI_VERSION(NV_VIEW_TARGET_INFO,2)
-
-NVAPI_INTERFACE NvAPI_SetView(NvDisplayHandle hNvDisplay, NV_VIEW_TARGET_INFO *pTargetInfo, NV_TARGET_VIEW_MODE targetView);
-
-///////////////////////////////////////////////////////////////////////////////
-// FUNCTION NAME: NvAPI_GetView
-//
-// DESCRIPTION: This API lets caller retrieve the target display arrangement for selected source display handle.
-//
-// SUPPORTED OS: Windows Vista and higher
-//
-// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. NVAPI_DEFAULT_HANDLE not allowed, it has to be a handle enumerated with NvAPI_EnumNVidiaDisplayHandle().
-// pTargetInfo(OUT) - User allocated storage to retrieve an array of NV_VIEW_TARGET_INFO. Can be NULL to retrieve the targetCount.
-// targetMaskCount(IN/OUT) - Count of target device mask specified in pTargetMask.
-// targetView(OUT) - Target view selected from NV_TARGET_VIEW_MODE.
-//
-// RETURN STATUS:
-// NVAPI_OK - completed request
-// NVAPI_ERROR - miscellaneous error occurred
-// NVAPI_INVALID_ARGUMENT: Invalid input parameter.
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GetView(NvDisplayHandle hNvDisplay, NV_VIEW_TARGET_INFO *pTargets, NvU32 *pTargetMaskCount, NV_TARGET_VIEW_MODE *pTargetView);
-
-///////////////////////////////////////////////////////////////////////////////
-// FUNCTION NAME: NvAPI_SetViewEx
-//
-// DESCRIPTION: This API lets caller to modify the display arrangement for selected source display handle in any of the nview modes.
-// It also allows to modify or extend the source display in dualview mode.
-//
-// SUPPORTED OS: Windows Vista and higher
-//
-// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. NVAPI_DEFAULT_HANDLE not allowed, it has to be a handle enumerated with NvAPI_EnumNVidiaDisplayHandle().
-// pPathInfo(IN) - Pointer to array of NV_VIEW_PATH_INFO, specifying device properties in this view.
-// The first device entry in the array is the physical primary.
-// The device entry with the lowest source id is the desktop primary.
-// pathCount(IN) - Count of paths specified in pPathInfo.
-// displayView(IN)- Display view selected from NV_TARGET_VIEW_MODE.
-//
-// RETURN STATUS:
-// NVAPI_OK - completed request
-// NVAPI_ERROR - miscellaneous error occurred
-// NVAPI_INVALID_ARGUMENT: Invalid input parameter.
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#define NVAPI_MAX_DISPLAY_PATH NVAPI_MAX_VIEW_TARGET
-
-typedef struct
-{
- NvU32 version; // (IN) structure version
- NvU32 count; // (IN) path count
- struct
- {
- NvU32 deviceMask; // (IN) device mask
- NvU32 sourceId; // (IN) source id
- NvU32 bPrimary:1; // (IN/OUT) Indicates if this is the GPU's primary view target. This is not the desktop GDI primary.
- // NvAPI_SetViewEx automatically selects the first target in NV_DISPLAY_PATH_INFO index 0 as the GPU's primary view.
- NV_GPU_CONNECTOR_TYPE connector; // (IN) Specify connector type. For TV only.
-
- // source mode information
- NvU32 width; // (IN) width of the mode
- NvU32 height; // (IN) height of the mode
- NvU32 depth; // (IN) depth of the mode
- NV_FORMAT colorFormat; // color format if needs to specify. Not used now.
-
- //rotation setting of the mode
- NV_ROTATE rotation; // (IN) rotation setting.
-
- // the scaling mode
- NV_SCALING scaling; // (IN) scaling setting
-
- // Timing info
- NvU32 refreshRate; // (IN) refresh rate of the mode
- NvU32 interlaced:1; // (IN) interlaced mode flag
-
- NV_DISPLAY_TV_FORMAT tvFormat; // (IN) to choose the last TV format set this value to NV_DISPLAY_TV_FORMAT_NONE
-
- // Windows desktop position
- NvU32 posx; // (IN/OUT) x offset of this display on the Windows desktop
- NvU32 posy; // (IN/OUT) y offset of this display on the Windows desktop
- NvU32 bGDIPrimary:1; // (IN/OUT) Indicates if this is the desktop GDI primary.
-
- } path[NVAPI_MAX_DISPLAY_PATH];
-} NV_DISPLAY_PATH_INFO;
-
-#define NV_DISPLAY_PATH_INFO_VER MAKE_NVAPI_VERSION(NV_DISPLAY_PATH_INFO,2)
-
-NVAPI_INTERFACE NvAPI_SetViewEx(NvDisplayHandle hNvDisplay, NV_DISPLAY_PATH_INFO *pPathInfo, NV_TARGET_VIEW_MODE displayView);
-
-///////////////////////////////////////////////////////////////////////////////
-// FUNCTION NAME: NvAPI_GetViewEx
-//
-// DESCRIPTION: This API lets caller retrieve the target display arrangement for selected source display handle.
-//
-// SUPPORTED OS: Windows Vista and higher
-//
-// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. NVAPI_DEFAULT_HANDLE not allowed, it has to be a handle enumerated with NvAPI_EnumNVidiaDisplayHandle().
-// pPathInfo(IN/OUT) - count field should be set to NVAPI_MAX_DISPLAY_PATH. Can be NULL to retrieve just the pathCount.
-// pPathCount(IN/OUT) - Number of elements in array pPathInfo->path.
-// pTargetViewMode(OUT)- Display view selected from NV_TARGET_VIEW_MODE.
-//
-// RETURN STATUS:
-// NVAPI_OK - completed request
-// NVAPI_API_NOT_INTIALIZED - NVAPI not initialized
-// NVAPI_ERROR - miscellaneous error occurred
-// NVAPI_INVALID_ARGUMENT - Invalid input parameter.
-// NVAPI_EXPECTED_DISPLAY_HANDLE - hNvDisplay is not a valid display handle.
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GetViewEx(NvDisplayHandle hNvDisplay, NV_DISPLAY_PATH_INFO *pPathInfo, NvU32 *pPathCount, NV_TARGET_VIEW_MODE *pTargetViewMode);
-
-///////////////////////////////////////////////////////////////////////////////
-// FUNCTION NAME: NvAPI_GetSupportedViews
-//
-// DESCRIPTION: This API lets caller enumerate all the supported NVIDIA display views - nview and dualview modes.
-//
-// SUPPORTED OS: Windows XP and higher
-//
-// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. It can be NVAPI_DEFAULT_HANDLE or a handle enumerated from NvAPI_EnumNVidiaDisplayHandle().
-// pTargetViews(OUT) - Array of supported views. Can be NULL to retrieve the pViewCount first.
-// pViewCount(IN/OUT) - Count of supported views.
-//
-// RETURN STATUS:
-// NVAPI_OK - completed request
-// NVAPI_ERROR - miscellaneous error occurred
-// NVAPI_INVALID_ARGUMENT: Invalid input parameter.
-//
-///////////////////////////////////////////////////////////////////////////////
-NVAPI_INTERFACE NvAPI_GetSupportedViews(NvDisplayHandle hNvDisplay, NV_TARGET_VIEW_MODE *pTargetViews, NvU32 *pViewCount);
-
-
-#ifdef __cplusplus
-}; //extern "C" {
-#endif
-
-#pragma pack(pop)
-
-#endif // _NVAPI_H
-
+ /***************************************************************************\
+|* *|
+|* Copyright 2005-2008 NVIDIA Corporation. All rights reserved. *|
+|* *|
+|* NOTICE TO USER: *|
+|* *|
+|* This source code is subject to NVIDIA ownership rights under U.S. *|
+|* and international Copyright laws. Users and possessors of this *|
+|* source code are hereby granted a nonexclusive, royalty-free *|
+|* license to use this code in individual and commercial software. *|
+|* *|
+|* NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE *|
+|* CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR *|
+|* IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH *|
+|* REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF *|
+|* MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR *|
+|* PURPOSE. IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, *|
+|* INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES *|
+|* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN *|
+|* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING *|
+|* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE *|
+|* CODE. *|
+|* *|
+|* U.S. Government End Users. This source code is a "commercial item" *|
+|* as that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting *|
+|* of "commercial computer software" and "commercial computer software *|
+|* documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) *|
+|* and is provided to the U.S. Government only as a commercial end item. *|
+|* Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through *|
+|* 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the *|
+|* source code with only those rights set forth herein. *|
+|* *|
+|* Any use of this source code in individual and commercial software must *|
+|* include, in the user documentation and internal comments to the code, *|
+|* the above Disclaimer and U.S. Government End Users Notice. *|
+|* *|
+|* *|
+ \***************************************************************************/
+///////////////////////////////////////////////////////////////////////////////
+//
+// Date: Aug 24, 2008
+// File: nvapi.h
+//
+// NvAPI provides an interface to NVIDIA devices. This file contains the
+// interface constants, structure definitions and function prototypes.
+//
+// Target Profile: developer
+// Target OS-Arch: windows
+//
+///////////////////////////////////////////////////////////////////////////////
+#ifndef _NVAPI_H
+#define _NVAPI_H
+
+#pragma pack(push,8) // Make sure we have consistent structure packings
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// ====================================================
+// Universal NvAPI Definitions
+// ====================================================
+#ifndef _WIN32
+#define __cdecl
+#endif
+
+#define NVAPI_INTERFACE extern NvAPI_Status __cdecl
+
+/* 64-bit types for compilers that support them, plus some obsolete variants */
+#if defined(__GNUC__) || defined(__arm) || defined(__IAR_SYSTEMS_ICC__) || defined(__ghs__) || defined(_WIN64)
+typedef unsigned long long NvU64; /* 0 to 18446744073709551615 */
+#else
+typedef unsigned __int64 NvU64; /* 0 to 18446744073709551615 */
+#endif
+
+// mac os 32-bit still needs this
+#if (defined(macintosh) || defined(__APPLE__)) && !defined(__LP64__)
+typedef signed long NvS32; /* -2147483648 to 2147483647 */
+#else
+typedef signed int NvS32; /* -2147483648 to 2147483647 */
+#endif
+
+typedef unsigned long NvU32;
+typedef unsigned short NvU16;
+typedef unsigned char NvU8;
+
+#define NV_DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name
+
+// NVAPI Handles - These handles are retrieved from various calls and passed in to others in NvAPI
+// These are meant to be opaque types. Do not assume they correspond to indices, HDCs,
+// display indexes or anything else.
+//
+// Most handles remain valid until a display re-configuration (display mode set) or GPU
+// reconfiguration (going into or out of SLI modes) occurs. If NVAPI_HANDLE_INVALIDATED
+// is received by an app, it should discard all handles, and re-enumerate them.
+//
+NV_DECLARE_HANDLE(NvDisplayHandle); // Display Device driven by NVIDIA GPU(s) (an attached display)
+NV_DECLARE_HANDLE(NvUnAttachedDisplayHandle); // Unattached Display Device driven by NVIDIA GPU(s)
+NV_DECLARE_HANDLE(NvLogicalGpuHandle); // One or more physical GPUs acting in concert (SLI)
+NV_DECLARE_HANDLE(NvPhysicalGpuHandle); // A single physical GPU
+NV_DECLARE_HANDLE(NvEventHandle); // A handle to an event registration instance
+
+#define NVAPI_DEFAULT_HANDLE 0
+
+#define NVAPI_GENERIC_STRING_MAX 4096
+#define NVAPI_LONG_STRING_MAX 256
+#define NVAPI_SHORT_STRING_MAX 64
+
+typedef struct
+{
+ NvS32 sX;
+ NvS32 sY;
+ NvS32 sWidth;
+ NvS32 sHeight;
+} NvSBox;
+
+#define NVAPI_MAX_PHYSICAL_GPUS 64
+#define NVAPI_MAX_LOGICAL_GPUS 64
+#define NVAPI_MAX_AVAILABLE_GPU_TOPOLOGIES 256
+#define NVAPI_MAX_GPU_TOPOLOGIES NVAPI_MAX_PHYSICAL_GPUS
+#define NVAPI_MAX_GPU_PER_TOPOLOGY 8
+#define NVAPI_MAX_DISPLAY_HEADS 2
+#define NVAPI_MAX_DISPLAYS NVAPI_MAX_PHYSICAL_GPUS * NVAPI_MAX_DISPLAY_HEADS
+
+#define NV_MAX_HEADS 4 // Maximum heads, each with NVAPI_DESKTOP_RES resolution
+#define NV_MAX_VID_STREAMS 4 // Maximum input video streams, each with a NVAPI_VIDEO_SRC_INFO
+#define NV_MAX_VID_PROFILES 4 // Maximum output video profiles supported
+
+typedef char NvAPI_String[NVAPI_GENERIC_STRING_MAX];
+typedef char NvAPI_LongString[NVAPI_LONG_STRING_MAX];
+typedef char NvAPI_ShortString[NVAPI_SHORT_STRING_MAX];
+
+// =========================================================================================
+// NvAPI Version Definition
+// Maintain per structure specific version define using the MAKE_NVAPI_VERSION macro.
+// Usage: #define NV_GENLOCK_STATUS_VER MAKE_NVAPI_VERSION(NV_GENLOCK_STATUS, 1)
+// =========================================================================================
+#define MAKE_NVAPI_VERSION(typeName,ver) (NvU32)(sizeof(typeName) | ((ver)<<16))
+#define GET_NVAPI_VERSION(ver) (NvU32)((ver)>>16)
+#define GET_NVAPI_SIZE(ver) (NvU32)((ver) & 0xffff)
+
+// ====================================================
+// NvAPI Status Values
+// All NvAPI functions return one of these codes.
+// ====================================================
+
+
+typedef enum
+{
+ NVAPI_OK = 0, // Success
+ NVAPI_ERROR = -1, // Generic error
+ NVAPI_LIBRARY_NOT_FOUND = -2, // nvapi.dll can not be loaded
+ NVAPI_NO_IMPLEMENTATION = -3, // not implemented in current driver installation
+ NVAPI_API_NOT_INTIALIZED = -4, // NvAPI_Initialize has not been called (successfully)
+ NVAPI_INVALID_ARGUMENT = -5, // invalid argument
+ NVAPI_NVIDIA_DEVICE_NOT_FOUND = -6, // no NVIDIA display driver was found
+ NVAPI_END_ENUMERATION = -7, // no more to enum
+ NVAPI_INVALID_HANDLE = -8, // invalid handle
+ NVAPI_INCOMPATIBLE_STRUCT_VERSION = -9, // an argument's structure version is not supported
+ NVAPI_HANDLE_INVALIDATED = -10, // handle is no longer valid (likely due to GPU or display re-configuration)
+ NVAPI_OPENGL_CONTEXT_NOT_CURRENT = -11, // no NVIDIA OpenGL context is current (but needs to be)
+ NVAPI_NO_GL_EXPERT = -12, // OpenGL Expert is not supported by the current drivers
+ NVAPI_INSTRUMENTATION_DISABLED = -13, // OpenGL Expert is supported, but driver instrumentation is currently disabled
+ NVAPI_EXPECTED_LOGICAL_GPU_HANDLE = -100, // expected a logical GPU handle for one or more parameters
+ NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE = -101, // expected a physical GPU handle for one or more parameters
+ NVAPI_EXPECTED_DISPLAY_HANDLE = -102, // expected an NV display handle for one or more parameters
+ NVAPI_INVALID_COMBINATION = -103, // used in some commands to indicate that the combination of parameters is not valid
+ NVAPI_NOT_SUPPORTED = -104, // Requested feature not supported in the selected GPU
+ NVAPI_PORTID_NOT_FOUND = -105, // NO port ID found for I2C transaction
+ NVAPI_EXPECTED_UNATTACHED_DISPLAY_HANDLE = -106, // expected an unattached display handle as one of the input param
+ NVAPI_INVALID_PERF_LEVEL = -107, // invalid perf level
+ NVAPI_DEVICE_BUSY = -108, // device is busy, request not fulfilled
+ NVAPI_NV_PERSIST_FILE_NOT_FOUND = -109, // NV persist file is not found
+ NVAPI_PERSIST_DATA_NOT_FOUND = -110, // NV persist data is not found
+ NVAPI_EXPECTED_TV_DISPLAY = -111, // expected TV output display
+ NVAPI_EXPECTED_TV_DISPLAY_ON_DCONNECTOR = -112, // expected TV output on D Connector - HDTV_EIAJ4120.
+ NVAPI_NO_ACTIVE_SLI_TOPOLOGY = -113, // SLI is not active on this device
+ NVAPI_SLI_RENDERING_MODE_NOTALLOWED = -114, // setup of SLI rendering mode is not possible right now
+ NVAPI_EXPECTED_DIGITAL_FLAT_PANEL = -115, // expected digital flat panel
+ NVAPI_ARGUMENT_EXCEED_MAX_SIZE = -116, // argument exceeds expected size
+ NVAPI_DEVICE_SWITCHING_NOT_ALLOWED = -117, // inhibit ON due to one of the flags in NV_GPU_DISPLAY_CHANGE_INHIBIT or SLI Active
+ NVAPI_TESTING_CLOCKS_NOT_SUPPORTED = -118, // testing clocks not supported
+ NVAPI_UNKNOWN_UNDERSCAN_CONFIG = -119, // the specified underscan config is from an unknown source (e.g. INF)
+ NVAPI_TIMEOUT_RECONFIGURING_GPU_TOPO = -120, // timeout while reconfiguring GPUs
+ NVAPI_DATA_NOT_FOUND = -121, // Requested data was not found
+ NVAPI_EXPECTED_ANALOG_DISPLAY = -122, // expected analog display
+ NVAPI_NO_VIDLINK = -123, // No SLI video bridge present
+ NVAPI_REQUIRES_REBOOT = -124, // NVAPI requires reboot for its settings to take effect
+ NVAPI_INVALID_HYBRID_MODE = -125, // the function is not supported with the current hybrid mode.
+ NVAPI_MIXED_TARGET_TYPES = -126, // The target types are not all the same
+ NVAPI_SYSWOW64_NOT_SUPPORTED = -127, // the function is not supported from 32-bit on a 64-bit system
+ NVAPI_IMPLICIT_SET_GPU_TOPOLOGY_CHANGE_NOT_ALLOWED = -128, //there is any implicit GPU topo active. Use NVAPI_SetHybridMode to change topology.
+ NVAPI_REQUEST_USER_TO_CLOSE_NON_MIGRATABLE_APPS = -129, //Prompt the user to close all non-migratable apps.
+ NVAPI_OUT_OF_MEMORY = -130, // Could not allocate sufficient memory to complete the call
+ NVAPI_WAS_STILL_DRAWING = -131, // The previous operation that is transferring information to or from this surface is incomplete
+ NVAPI_FILE_NOT_FOUND = -132, // The file was not found
+ NVAPI_TOO_MANY_UNIQUE_STATE_OBJECTS = -133, // There are too many unique instances of a particular type of state object
+ NVAPI_INVALID_CALL = -134, // The method call is invalid. For example, a method's parameter may not be a valid pointer
+ NVAPI_D3D10_1_LIBRARY_NOT_FOUND = -135, // d3d10_1.dll can not be loaded
+ NVAPI_FUNCTION_NOT_FOUND = -136, // Couldn't find the function in loaded dll library
+} NvAPI_Status;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_Initialize
+//
+// DESCRIPTION: Initializes NVAPI library. This must be called before any
+// other NvAPI_ function.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_ERROR Something is wrong during the initialization process (generic error)
+// NVAPI_LIBRARYNOTFOUND Can not load nvapi.dll
+// NVAPI_OK Initialized
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_Initialize();
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GetErrorMessage
+//
+// DESCRIPTION: converts an NvAPI error code into a null terminated string
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: null terminated string (always, never NULL)
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GetErrorMessage(NvAPI_Status nr,NvAPI_ShortString szDesc);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GetInterfaceVersionString
+//
+// DESCRIPTION: Returns a string describing the version of the NvAPI library.
+// Contents of the string are human readable. Do not assume a fixed
+// format.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: User readable string giving info on NvAPI's version
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GetInterfaceVersionString(NvAPI_ShortString szDesc);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GetDisplayDriverVersion
+//
+// DESCRIPTION: Returns a struct that describes aspects of the display driver
+// build.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_ERROR or NVAPI_OK
+//
+///////////////////////////////////////////////////////////////////////////////
+typedef struct
+{
+ NvU32 version; // Structure version
+ NvU32 drvVersion;
+ NvU32 bldChangeListNum;
+ NvAPI_ShortString szBuildBranchString;
+ NvAPI_ShortString szAdapterString;
+} NV_DISPLAY_DRIVER_VERSION;
+#define NV_DISPLAY_DRIVER_VERSION_VER MAKE_NVAPI_VERSION(NV_DISPLAY_DRIVER_VERSION,1)
+NVAPI_INTERFACE NvAPI_GetDisplayDriverVersion(NvDisplayHandle hNvDisplay, NV_DISPLAY_DRIVER_VERSION *pVersion);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_EnumNvidiaDisplayHandle
+//
+// DESCRIPTION: Returns the handle of the NVIDIA display specified by the enum
+// index (thisEnum). The client should keep enumerating until it
+// returns NVAPI_END_ENUMERATION.
+//
+// Note: Display handles can get invalidated on a modeset, so the calling applications need to
+// renum the handles after every modeset.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: either the handle pointer is NULL or enum index too big
+// NVAPI_OK: return a valid NvDisplayHandle based on the enum index
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA device found in the system
+// NVAPI_END_ENUMERATION: no more display device to enumerate.
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_EnumNvidiaDisplayHandle(NvU32 thisEnum, NvDisplayHandle *pNvDispHandle);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_EnumNvidiaUnAttachedDisplayHandle
+//
+// DESCRIPTION: Returns the handle of the NVIDIA UnAttached display specified by the enum
+// index (thisEnum). The client should keep enumerating till it
+// return error.
+//
+// Note: Display handles can get invalidated on a modeset, so the calling applications need to
+// renum the handles after every modeset.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: either the handle pointer is NULL or enum index too big
+// NVAPI_OK: return a valid NvDisplayHandle based on the enum index
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA device found in the system
+// NVAPI_END_ENUMERATION: no more display device to enumerate.
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_EnumNvidiaUnAttachedDisplayHandle(NvU32 thisEnum, NvUnAttachedDisplayHandle *pNvUnAttachedDispHandle);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_EnumPhysicalGPUs
+//
+// DESCRIPTION: Returns an array of physical GPU handles.
+//
+// Each handle represents a physical GPU present in the system.
+// That GPU may be part of a SLI configuration, or not be visible to the OS directly.
+//
+// At least 1 GPU must be present in the system and running an NV display driver.
+//
+// The array nvGPUHandle will be filled with physical GPU handle values. The returned
+// gpuCount determines how many entries in the array are valid.
+//
+// Note: In drivers older than 105.00, all physical GPU handles get invalidated on a modeset. So the calling applications
+// need to renum the handles after every modeset.
+// With drivers 105.00 and up all physical GPU handles are constant.
+// Physical GPU handles are constant as long as the GPUs are not physically moved and the SBIOS VGA order is unchanged.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: nvGPUHandle or pGpuCount is NULL
+// NVAPI_OK: one or more handles were returned
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_EnumPhysicalGPUs(NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_EnumLogicalGPUs
+//
+// DESCRIPTION: Returns an array of logical GPU handles.
+//
+// Each handle represents one or more GPUs acting in concert as a single graphics device.
+//
+// At least 1 GPU must be present in the system and running an NV display driver.
+//
+// The array nvGPUHandle will be filled with logical GPU handle values. The returned
+// gpuCount determines how many entries in the array are valid.
+//
+// Note: All logical GPUs handles get invalidated on a GPU topology change, so the calling application is required to
+// renum the logical GPU handles to get latest physical handle mapping after every GPU topology change activated
+// by a call to NvAPI_SetGpuTopologies.
+//
+// To detect if SLI rendering is enabled please use NvAPI_D3D_GetCurrentSLIState
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: nvGPUHandle or pGpuCount is NULL
+// NVAPI_OK: one or more handles were returned
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_EnumLogicalGPUs(NvLogicalGpuHandle nvGPUHandle[NVAPI_MAX_LOGICAL_GPUS], NvU32 *pGpuCount);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GetPhysicalGPUsFromDisplay
+//
+// DESCRIPTION: Returns an array of physical GPU handles associated with the specified display.
+//
+// At least 1 GPU must be present in the system and running an NV display driver.
+//
+// The array nvGPUHandle will be filled with physical GPU handle values. The returned
+// gpuCount determines how many entries in the array are valid.
+//
+// If the display corresponds to more than one physical GPU, the first GPU returned
+// is the one with the attached active output.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hNvDisp is not valid; nvGPUHandle or pGpuCount is NULL
+// NVAPI_OK: one or more handles were returned
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GetPhysicalGPUsFromDisplay(NvDisplayHandle hNvDisp, NvPhysicalGpuHandle nvGPUHandle[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GetPhysicalGPUFromUnAttachedDisplay
+//
+// DESCRIPTION: Returns a physical GPU handle associated with the specified unattached display.
+//
+// At least 1 GPU must be present in the system and running an NV display driver.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hNvUnAttachedDisp is not valid or pPhysicalGpu is NULL.
+// NVAPI_OK: one or more handles were returned
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GetPhysicalGPUFromUnAttachedDisplay(NvUnAttachedDisplayHandle hNvUnAttachedDisp, NvPhysicalGpuHandle *pPhysicalGpu);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_CreateDisplayFromUnAttachedDisplay
+//
+// DESCRIPTION: The unattached display handle is converted to a active attached display handle.
+//
+// At least 1 GPU must be present in the system and running an NV display driver.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hNvUnAttachedDisp is not valid or pNvDisplay is NULL.
+// NVAPI_OK: one or more handles were returned
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_CreateDisplayFromUnAttachedDisplay(NvUnAttachedDisplayHandle hNvUnAttachedDisp, NvDisplayHandle *pNvDisplay);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GetLogicalGPUFromDisplay
+//
+// DESCRIPTION: Returns the logical GPU handle associated with the specified display.
+//
+// At least 1 GPU must be present in the system and running an NV display driver.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hNvDisp is not valid; pLogicalGPU is NULL
+// NVAPI_OK: one or more handles were returned
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GetLogicalGPUFromDisplay(NvDisplayHandle hNvDisp, NvLogicalGpuHandle *pLogicalGPU);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GetLogicalGPUFromPhysicalGPU
+//
+// DESCRIPTION: Returns the logical GPU handle associated with specified physical GPU handle.
+//
+// At least 1 GPU must be present in the system and running an NV display driver.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGPU is not valid; pLogicalGPU is NULL
+// NVAPI_OK: one or more handles were returned
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GetLogicalGPUFromPhysicalGPU(NvPhysicalGpuHandle hPhysicalGPU, NvLogicalGpuHandle *pLogicalGPU);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GetPhysicalGPUsFromLogicalGPU
+//
+// DESCRIPTION: Returns the physical GPU handles associated with the specified logical GPU handle.
+//
+// At least 1 GPU must be present in the system and running an NV display driver.
+//
+// The array hPhysicalGPU will be filled with physical GPU handle values. The returned
+// gpuCount determines how many entries in the array are valid.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hLogicalGPU is not valid; hPhysicalGPU is NULL
+// NVAPI_OK: one or more handles were returned
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_LOGICAL_GPU_HANDLE: hLogicalGPU was not a logical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GetPhysicalGPUsFromLogicalGPU(NvLogicalGpuHandle hLogicalGPU,NvPhysicalGpuHandle hPhysicalGPU[NVAPI_MAX_PHYSICAL_GPUS], NvU32 *pGpuCount);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GetAssociatedNvidiaDisplayHandle
+//
+// DESCRIPTION: Returns the handle of the NVIDIA display that is associated
+// with the display name given. Eg: "\\DISPLAY1"
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: either argument is NULL
+// NVAPI_OK: *pNvDispHandle is now valid
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA device maps to that display name
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GetAssociatedNvidiaDisplayHandle(const char *szDisplayName, NvDisplayHandle *pNvDispHandle);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GetAssociatedNvidiaDisplayName
+//
+// DESCRIPTION: Returns the display name given. Eg: "\\DISPLAY1" using the NVIDIA display handle
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: either argument is NULL
+// NVAPI_OK: *pNvDispHandle is now valid
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA device maps to that display name
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GetAssociatedNvidiaDisplayName(NvDisplayHandle NvDispHandle, NvAPI_ShortString szDisplayName);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GetUnAttachedAssociatedDisplayName
+//
+// DESCRIPTION: Returns the display name given. Eg: "\\DISPLAY1" using the NVIDIA unattached display handle
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: either argument is NULL
+// NVAPI_OK: *pNvDispHandle is now valid
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA device maps to that display name
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GetUnAttachedAssociatedDisplayName(NvUnAttachedDisplayHandle hNvUnAttachedDisp, NvAPI_ShortString szDisplayName);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_EnableHWCursor
+//
+// DESCRIPTION: Enable hardware cursor support
+//
+// SUPPORTED OS: Windows XP
+//
+// RETURN STATUS: NVAPI_ERROR or NVAPI_OK
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_EnableHWCursor(NvDisplayHandle hNvDisplay);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_DisableHWCursor
+//
+// DESCRIPTION: Disable hardware cursor support
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_ERROR or NVAPI_OK
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_DisableHWCursor(NvDisplayHandle hNvDisplay);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GetVBlankCounter
+//
+// DESCRIPTION: get vblank counter
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_ERROR or NVAPI_OK
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GetVBlankCounter(NvDisplayHandle hNvDisplay, NvU32 *pCounter);
+
+///////////////////////////////////////////////////////////////////////////////
+// FUNCTION NAME: NvAPI_SetRefreshRateOverride
+// DESCRIPTION: Override the refresh rate on the given display/outputsMask.
+// The new refresh rate can be applied right away in this API call or deferred to happen with the
+// next OS modeset. The override is only good for one modeset (doesn't matter it's deferred or immediate).
+//
+// SUPPORTED OS: Windows XP
+//
+//
+// INPUT: hNvDisplay - the NVIDIA display handle. It can be NVAPI_DEFAULT_HANDLE or a handle
+// enumerated from NvAPI_EnumNVidiaDisplayHandle().
+//
+// outputsMask - a set of bits that identify all target outputs which are associated with the NVIDIA
+// display handle to apply the refresh rate override. Note when SLI is enabled, the
+// outputsMask only applies to the GPU that is driving the display output.
+//
+// refreshRate - the override value. "0.0" means cancel the override.
+//
+//
+// bSetDeferred - "0": apply the refresh rate override immediately in this API call.
+// "1": apply refresh rate at the next OS modeset.
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hNvDisplay or outputsMask is invalid
+// NVAPI_OK: the refresh rate override is correct set
+// NVAPI_ERROR: the operation failed
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_SetRefreshRateOverride(NvDisplayHandle hNvDisplay, NvU32 outputsMask, float refreshRate, NvU32 bSetDeferred);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GetAssociatedDisplayOutputId
+//
+// DESCRIPTION: Gets the active outputId associated with the display handle.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. It can be NVAPI_DEFAULT_HANDLE or a handle enumerated from NvAPI_EnumNVidiaDisplayHandle().
+// outputId(OUT) - The active display output id associated with the selected display handle hNvDisplay.
+// The outputid will have only one bit set. In case of clone or span this will indicate the display
+// outputId of the primary display that the GPU is driving.
+// RETURN STATUS: NVAPI_OK: call successful.
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found.
+// NVAPI_EXPECTED_DISPLAY_HANDLE: hNvDisplay is not a valid display handle.
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GetAssociatedDisplayOutputId(NvDisplayHandle hNvDisplay, NvU32 *pOutputId);
+
+///////////////////////////////////////////////////////////////////////////////
+// FUNCTION NAME: NvAPI_GetDisplayPortInfo
+//
+// DESCRIPTION: This API returns the current DP related into on the specified device(monitor)
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. It can be NVAPI_DEFAULT_HANDLE or a handle enumerated from NvAPI_EnumNVidiaDisplayHandle().
+// outputId(IN) - The display output id. If it's "0" then the default outputId from NvAPI_GetAssociatedDisplayOutputId() will be used.
+// pInfo(OUT) - The display port info
+//
+// RETURN STATUS:
+// NVAPI_OK - completed request
+// NVAPI_ERROR - miscellaneous error occurred
+// NVAPI_INVALID_ARGUMENT: Invalid input parameter.
+//
+///////////////////////////////////////////////////////////////////////////////
+typedef enum
+{
+ NV_DP_1_62GBPS = 6,
+ NV_DP_2_70GBPS = 0xA,
+} NV_DP_LINK_RATE;
+
+typedef enum
+{
+ NV_DP_1_LANE = 1,
+ NV_DP_2_LANE = 2,
+ NV_DP_4_LANE = 4,
+} NV_DP_LANE_COUNT;
+
+typedef enum
+{
+ NV_DP_COLOR_FORMAT_RGB = 0,
+ NV_DP_COLOR_FORMAT_YCbCr422,
+ NV_DP_COLOR_FORMAT_YCbCr444,
+} NV_DP_COLOR_FORMAT;
+
+typedef enum
+{
+ NV_DP_COLORIMETRY_RGB = 0,
+ NV_DP_COLORIMETRY_YCbCr_ITU601,
+ NV_DP_COLORIMETRY_YCbCr_ITU709,
+} NV_DP_COLORIMETRY;
+
+typedef enum
+{
+ NV_DP_DYNAMIC_RANGE_VESA = 0,
+ NV_DP_DYNAMIC_RANGE_CEA,
+} NV_DP_DYNAMIC_RANGE;
+
+typedef enum
+{
+ NV_DP_BPC_DEFAULT = 0,
+ NV_DP_BPC_6,
+ NV_DP_BPC_8,
+ NV_DP_BPC_10,
+ NV_DP_BPC_12,
+ NV_DP_BPC_16,
+} NV_DP_BPC;
+
+typedef struct
+{
+ NvU32 version; // structure version
+ NvU32 dpcd_ver; // the DPCD version of the monitor
+ NV_DP_LINK_RATE maxLinkRate; // the max supported link rate
+ NV_DP_LANE_COUNT maxLaneCount; // the max supported lane count
+ NV_DP_LINK_RATE curLinkRate; // the current link rate
+ NV_DP_LANE_COUNT curLaneCount; // the current lane count
+ NV_DP_COLOR_FORMAT colorFormat; // the current color format
+ NV_DP_DYNAMIC_RANGE dynamicRange; // the dynamic range
+ NV_DP_COLORIMETRY colorimetry; // ignored in RGB space
+ NV_DP_BPC bpc; // the current bit-per-component;
+ NvU32 isDp : 1; // if the monitor is driven by display port
+ NvU32 isInternalDp : 1; // if the monitor is driven by NV Dp transmitter
+ NvU32 isColorCtrlSupported : 1; // if the color format change is supported
+ NvU32 is6BPCSupported : 1; // if 6 bpc is supported
+ NvU32 is8BPCSupported : 1; // if 8 bpc is supported
+ NvU32 is10BPCSupported : 1; // if 10 bpc is supported
+ NvU32 is12BPCSupported : 1; // if 12 bpc is supported
+ NvU32 is16BPCSupported : 1; // if 16 bpc is supported
+ } NV_DISPLAY_PORT_INFO;
+
+#define NV_DISPLAY_PORT_INFO_VER MAKE_NVAPI_VERSION(NV_DISPLAY_PORT_INFO,1)
+
+NVAPI_INTERFACE NvAPI_GetDisplayPortInfo(NvDisplayHandle hNvDisplay, NvU32 outputId, NV_DISPLAY_PORT_INFO *pInfo);
+
+///////////////////////////////////////////////////////////////////////////////
+// FUNCTION NAME: NvAPI_SetDisplayPort
+//
+// DESCRIPTION: This API is used to setup DP related configurations.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// PARAMETERS: hNvDisplay(IN) - NVIDIA display handle. It can be NVAPI_DEFAULT_HANDLE or a handle enumerated from NvAPI_EnumNVidiaDisplayHandle().
+// outputId(IN) - This display output ID, when it's "0" it means the default outputId generated from the return of NvAPI_GetAssociatedDisplayOutputId().
+// pCfg(IN) - The display port config structure. If pCfg is NULL, it means to use the driver's default value to setup.
+//
+// RETURN STATUS:
+// NVAPI_OK - completed request
+// NVAPI_ERROR - miscellaneous error occurred
+// NVAPI_INVALID_ARGUMENT: Invalid input parameter.
+///////////////////////////////////////////////////////////////////////////////
+typedef struct
+{
+ NvU32 version; // structure version - 2 is latest
+ NV_DP_LINK_RATE linkRate; // the link rate
+ NV_DP_LANE_COUNT laneCount; // the lane count
+ NV_DP_COLOR_FORMAT colorFormat; // the color format to set
+ NV_DP_DYNAMIC_RANGE dynamicRange; // the dynamic range
+ NV_DP_COLORIMETRY colorimetry; // ignored in RGB space
+ NV_DP_BPC bpc; // the current bit-per-component;
+ NvU32 isHPD : 1; // if CPL is making this call due to HPD
+ NvU32 isSetDeferred : 1; // requires an OS modeset to finalize the setup if set
+ NvU32 isChromaLpfOff : 1; // force the chroma low_pass_filter to be off
+ NvU32 isDitherOff : 1; // force to turn off dither
+} NV_DISPLAY_PORT_CONFIG;
+
+#define NV_DISPLAY_PORT_CONFIG_VER MAKE_NVAPI_VERSION(NV_DISPLAY_PORT_CONFIG,2)
+#define NV_DISPLAY_PORT_CONFIG_VER_1 MAKE_NVAPI_VERSION(NV_DISPLAY_PORT_CONFIG,1)
+#define NV_DISPLAY_PORT_CONFIG_VER_2 MAKE_NVAPI_VERSION(NV_DISPLAY_PORT_CONFIG,2)
+
+NVAPI_INTERFACE NvAPI_SetDisplayPort(NvDisplayHandle hNvDisplay, NvU32 outputId, NV_DISPLAY_PORT_CONFIG *pCfg);
+
+///////////////////////////////////////////////////////////////////////////////
+// FUNCTION NAME: NvAPI_GetHDMISupportInfo
+//
+// DESCRIPTION: This API returns the current infoframe data on the specified device(monitor)
+//
+// SUPPORTED OS: Windows Vista and higher
+//
+// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. It can be NVAPI_DEFAULT_HANDLE or a handle enumerated from NvAPI_EnumNVidiaDisplayHandle().
+// outputId(IN) - The display output id. If it's "0" then the default outputId from NvAPI_GetAssociatedDisplayOutputId() will be used.
+// pInfo(OUT) - The monitor and GPU's HDMI support info
+//
+// RETURN STATUS:
+// NVAPI_OK - completed request
+// NVAPI_ERROR - miscellaneous error occurred
+// NVAPI_INVALID_ARGUMENT: Invalid input parameter.
+//
+///////////////////////////////////////////////////////////////////////////////
+typedef struct
+{
+ NvU32 version; // structure version
+ NvU32 isGpuHDMICapable : 1; // if the GPU can handle HDMI
+ NvU32 isMonUnderscanCapable : 1; // if the monitor supports underscan
+ NvU32 isMonBasicAudioCapable : 1; // if the monitor supports basic audio
+ NvU32 isMonYCbCr444Capable : 1; // if YCbCr 4:4:4 is supported
+ NvU32 isMonYCbCr422Capable : 1; // if YCbCr 4:2:2 is supported
+ NvU32 isMonxvYCC601Capable : 1; // if xvYCC 601 is supported
+ NvU32 isMonxvYCC709Capable : 1; // if xvYCC 709 is supported
+ NvU32 isMonHDMI : 1; // if the monitor is HDMI (with IEEE's HDMI registry ID)
+ NvU32 EDID861ExtRev; // the revision number of the EDID 861 extension
+ } NV_HDMI_SUPPORT_INFO;
+
+#define NV_HDMI_SUPPORT_INFO_VER MAKE_NVAPI_VERSION(NV_HDMI_SUPPORT_INFO,1)
+
+NVAPI_INTERFACE NvAPI_GetHDMISupportInfo(NvDisplayHandle hNvDisplay, NvU32 outputId, NV_HDMI_SUPPORT_INFO *pInfo);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetAllOutputs
+//
+// DESCRIPTION: Returns set of all GPU-output identifiers as a bitmask.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pOutputsMask is NULL
+// NVAPI_OK: *pOutputsMask contains a set of GPU-output identifiers
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetAllOutputs(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pOutputsMask);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetConnectedOutputs
+//
+// DESCRIPTION: Same as NvAPI_GPU_GetAllOutputs but returns only the set of GPU-output
+// identifiers that are connected to display devices.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pOutputsMask is NULL
+// NVAPI_OK: *pOutputsMask contains a set of GPU-output identifiers
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetConnectedOutputs(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pOutputsMask);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetConnectedSLIOutputs
+//
+// DESCRIPTION: Same as NvAPI_GPU_GetConnectedOutputs but returns only the set of GPU-output
+// identifiers that can be selected in an SLI configuration. With SLI disabled
+// this function matches NvAPI_GPU_GetConnectedOutputs
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pOutputsMask is NULL
+// NVAPI_OK: *pOutputsMask contains a set of GPU-output identifiers
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetConnectedSLIOutputs(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pOutputsMask);
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetConnectedOutputsWithLidState
+//
+// DESCRIPTION: Similar to NvAPI_GPU_GetConnectedOutputs this API returns the connected display identifiers that are connected
+// as a output mask but unlike NvAPI_GPU_GetConnectedOutputs this API "always" reflects the Lid State in the output mask.
+// Thus if you expect the LID close state to be available in the connection mask use this API.
+// If LID is closed then this API will remove the LID panel from the connected display identifiers.
+// If LID is open then this API will reflect the LID panel in the connected display identifiers.
+// Note:This API should be used on laptop systems and on systems where LID state is required in the connection output mask.
+// On desktop systems the returned identifiers will match NvAPI_GPU_GetConnectedOutputs.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pOutputsMask is NULL
+// NVAPI_OK: *pOutputsMask contains a set of GPU-output identifiers
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetConnectedOutputsWithLidState(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pOutputsMask);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetConnectedSLIOutputsWithLidState
+//
+// DESCRIPTION: Same as NvAPI_GPU_GetConnectedOutputsWithLidState but returns only the set of GPU-output
+// identifiers that can be selected in an SLI configuration. With SLI disabled
+// this function matches NvAPI_GPU_GetConnectedOutputsWithLidState
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pOutputsMask is NULL
+// NVAPI_OK: *pOutputsMask contains a set of GPU-output identifiers
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetConnectedSLIOutputsWithLidState(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pOutputsMask);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetSystemType
+//
+// DESCRIPTION: Returns information to identify if the GPU type is for a laptop system or a desktop system.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pOutputsMask is NULL
+// NVAPI_OK: *pSystemType contains the GPU system type
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+typedef enum
+{
+ NV_SYSTEM_TYPE_UNKNOWN = 0,
+ NV_SYSTEM_TYPE_LAPTOP = 1,
+ NV_SYSTEM_TYPE_DESKTOP = 2,
+
+} NV_SYSTEM_TYPE;
+
+NVAPI_INTERFACE NvAPI_GPU_GetSystemType(NvPhysicalGpuHandle hPhysicalGpu, NV_SYSTEM_TYPE *pSystemType);
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetActiveOutputs
+//
+// DESCRIPTION: Same as NvAPI_GPU_GetAllOutputs but returns only the set of GPU-output
+// identifiers that are actively driving display devices.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pOutputsMask is NULL
+// NVAPI_OK: *pOutputsMask contains a set of GPU-output identifiers
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetActiveOutputs(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pOutputsMask);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetEDID
+//
+// DESCRIPTION: Returns the EDID data for the specified GPU handle and connection bit mask.
+// displayOutputId should have exactly 1 bit set to indicate a single display.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: pEDID is NULL; displayOutputId has 0 or > 1 bits set.
+// NVAPI_OK: *pEDID contains valid data.
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found.
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle.
+// NVAPI_DATA_NOT_FOUND: requested display does not contain an EDID
+//
+///////////////////////////////////////////////////////////////////////////////
+#define NV_EDID_V1_DATA_SIZE 256
+#define NV_EDID_DATA_SIZE NV_EDID_V1_DATA_SIZE
+
+typedef struct
+{
+ NvU32 version; //structure version
+ NvU8 EDID_Data[NV_EDID_DATA_SIZE];
+ NvU32 sizeofEDID;
+} NV_EDID;
+
+#define NV_EDID_VER MAKE_NVAPI_VERSION(NV_EDID,2)
+
+NVAPI_INTERFACE NvAPI_GPU_GetEDID(NvPhysicalGpuHandle hPhysicalGpu, NvU32 displayOutputId, NV_EDID *pEDID);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetOutputType
+//
+// DESCRIPTION: Give a physical GPU handle and a single outputId (exactly 1 bit set), this API
+// returns the output type.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu, outputId or pOutputsMask is NULL; or outputId has > 1 bit set
+// NVAPI_OK: *pOutputType contains a NvGpuOutputType value
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+typedef enum _NV_GPU_OUTPUT_TYPE
+{
+ NVAPI_GPU_OUTPUT_UNKNOWN = 0,
+ NVAPI_GPU_OUTPUT_CRT = 1, // CRT display device
+ NVAPI_GPU_OUTPUT_DFP = 2, // Digital Flat Panel display device
+ NVAPI_GPU_OUTPUT_TV = 3, // TV display device
+} NV_GPU_OUTPUT_TYPE;
+
+NVAPI_INTERFACE NvAPI_GPU_GetOutputType(NvPhysicalGpuHandle hPhysicalGpu, NvU32 outputId, NV_GPU_OUTPUT_TYPE *pOutputType);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_ValidateOutputCombination
+//
+// DESCRIPTION: This call is used to determine if a set of GPU outputs can be active
+// simultaneously. While a GPU may have outputs, they can not typically
+// all be active at the same time due to internal resource sharing.
+//
+// Given a physical GPU handle and a mask of candidate outputs, this call
+// will return NVAPI_OK if all of the specified outputs can be driven
+// simultaneously. It will return NVAPI_INVALID_COMBINATION if they cannot.
+//
+// Use NvAPI_GPU_GetAllOutputs() to determine which outputs are candidates.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// RETURN STATUS: NVAPI_OK: combination of outputs in outputsMask are valid (can be active simultaneously)
+// NVAPI_INVALID_COMBINATION: combination of outputs in outputsMask are NOT valid
+// NVAPI_INVALID_ARGUMENT: hPhysicalGpu or outputsMask does not have at least 2 bits set
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_ValidateOutputCombination(NvPhysicalGpuHandle hPhysicalGpu, NvU32 outputsMask);
+
+typedef enum _NV_GPU_CONNECTOR_TYPE
+{
+ NVAPI_GPU_CONNECTOR_VGA_15_PIN = 0x00000000,
+ NVAPI_GPU_CONNECTOR_TV_COMPOSITE = 0x00000010,
+ NVAPI_GPU_CONNECTOR_TV_SVIDEO = 0x00000011,
+ NVAPI_GPU_CONNECTOR_TV_HDTV_COMPONENT = 0x00000013,
+ NVAPI_GPU_CONNECTOR_TV_SCART = 0x00000014,
+ NVAPI_GPU_CONNECTOR_TV_COMPOSITE_SCART_ON_EIAJ4120 = 0x00000016,
+ NVAPI_GPU_CONNECTOR_TV_HDTV_EIAJ4120 = 0x00000017,
+ NVAPI_GPU_CONNECTOR_PC_POD_HDTV_YPRPB = 0x00000018,
+ NVAPI_GPU_CONNECTOR_PC_POD_SVIDEO = 0x00000019,
+ NVAPI_GPU_CONNECTOR_PC_POD_COMPOSITE = 0x0000001A,
+ NVAPI_GPU_CONNECTOR_DVI_I_TV_SVIDEO = 0x00000020,
+ NVAPI_GPU_CONNECTOR_DVI_I_TV_COMPOSITE = 0x00000021,
+ NVAPI_GPU_CONNECTOR_DVI_I = 0x00000030,
+ NVAPI_GPU_CONNECTOR_DVI_D = 0x00000031,
+ NVAPI_GPU_CONNECTOR_ADC = 0x00000032,
+ NVAPI_GPU_CONNECTOR_LFH_DVI_I_1 = 0x00000038,
+ NVAPI_GPU_CONNECTOR_LFH_DVI_I_2 = 0x00000039,
+ NVAPI_GPU_CONNECTOR_SPWG = 0x00000040,
+ NVAPI_GPU_CONNECTOR_OEM = 0x00000041,
+ NVAPI_GPU_CONNECTOR_DISPLAYPORT_EXTERNAL = 0x00000046,
+ NVAPI_GPU_CONNECTOR_DISPLAYPORT_INTERNAL = 0x00000047,
+ NVAPI_GPU_CONNECTOR_HDMI_A = 0x00000061,
+ NVAPI_GPU_CONNECTOR_UNKNOWN = 0xFFFFFFFF,
+} NV_GPU_CONNECTOR_TYPE;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetFullName
+//
+// DESCRIPTION: Retrieves the full GPU name as an ascii string. Eg: "Quadro FX 1400"
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_ERROR or NVAPI_OK
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetFullName(NvPhysicalGpuHandle hPhysicalGpu, NvAPI_ShortString szName);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetPCIIdentifiers
+//
+// DESCRIPTION: Returns the PCI identifiers associated with this GPU.
+// DeviceId - the internal PCI device identifier for the GPU.
+// SubSystemId - the internal PCI subsystem identifier for the GPU.
+// RevisionId - the internal PCI device-specific revision identifier for the GPU.
+// ExtDeviceId - the external PCI device identifier for the GPU.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or an argument is NULL
+// NVAPI_OK: arguments are populated with PCI identifiers
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetPCIIdentifiers(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pDeviceId,NvU32 *pSubSystemId,NvU32 *pRevisionId,NvU32 *pExtDeviceId);
+
+typedef enum _NV_GPU_TYPE
+{
+ NV_SYSTEM_TYPE_GPU_UNKNOWN = 0,
+ NV_SYSTEM_TYPE_IGPU = 1, //integrated
+ NV_SYSTEM_TYPE_DGPU = 2, //discrete
+} NV_GPU_TYPE;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetGPUType
+//
+// DESCRIPTION: Returns information to identify the GPU type
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu
+// NVAPI_OK: *pGpuType contains the GPU type
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetGPUType(NvPhysicalGpuHandle hPhysicalGpu, NV_GPU_TYPE *pGpuType);
+
+typedef enum _NV_GPU_BUS_TYPE
+{
+ NVAPI_GPU_BUS_TYPE_UNDEFINED = 0,
+ NVAPI_GPU_BUS_TYPE_PCI = 1,
+ NVAPI_GPU_BUS_TYPE_AGP = 2,
+ NVAPI_GPU_BUS_TYPE_PCI_EXPRESS = 3,
+ NVAPI_GPU_BUS_TYPE_FPCI = 4,
+} NV_GPU_BUS_TYPE;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetBusType
+//
+// DESCRIPTION: Returns the type of bus associated with this GPU.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pBusType is NULL
+// NVAPI_OK: *pBusType contains bus identifier
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetBusType(NvPhysicalGpuHandle hPhysicalGpu,NV_GPU_BUS_TYPE *pBusType);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetBusId
+//
+// DESCRIPTION: Returns the ID of bus associated with this GPU.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pBusId is NULL
+// NVAPI_OK: *pBusId contains bus id
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetBusId(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pBusId);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetBusSlotId
+//
+// DESCRIPTION: Returns the ID of bus-slot associated with this GPU.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pBusSlotId is NULL
+// NVAPI_OK: *pBusSlotId contains bus-slot id
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetBusSlotId(NvPhysicalGpuHandle hPhysicalGpu, NvU32 *pBusSlotId);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetIRQ
+//
+// DESCRIPTION: Returns the interrupt number associated with this GPU.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pIRQ is NULL
+// NVAPI_OK: *pIRQ contains interrupt number
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetIRQ(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pIRQ);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetVbiosRevision
+//
+// DESCRIPTION: Returns the revision of the video bios associated with this GPU.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pBiosRevision is NULL
+// NVAPI_OK: *pBiosRevision contains revision number
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetVbiosRevision(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pBiosRevision);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetVbiosOEMRevision
+//
+// DESCRIPTION: Returns the OEM revision of the video bios associated with this GPU.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu or pBiosRevision is NULL
+// NVAPI_OK: *pBiosRevision contains revision number
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetVbiosOEMRevision(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pBiosRevision);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetVbiosVersionString
+//
+// DESCRIPTION: Returns the full bios version string in the form of xx.xx.xx.xx.yy where
+// the xx numbers come from NvAPI_GPU_GetVbiosRevision and yy comes from
+// NvAPI_GPU_GetVbiosOEMRevision.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: hPhysicalGpu is NULL
+// NVAPI_OK: szBiosRevision contains version string
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetVbiosVersionString(NvPhysicalGpuHandle hPhysicalGpu,NvAPI_ShortString szBiosRevision);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetAGPAperture
+//
+// DESCRIPTION: Returns AGP aperture in megabytes
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: pSize is NULL
+// NVAPI_OK: call successful
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetAGPAperture(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pSize);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetCurrentAGPRate
+//
+// DESCRIPTION: Returns the current AGP Rate (1 = 1x, 2=2x etc, 0 = AGP not present)
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: pRate is NULL
+// NVAPI_OK: call successful
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetCurrentAGPRate(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pRate);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetCurrentPCIEDownstreamWidth
+//
+// DESCRIPTION: Returns the number of PCIE lanes being used for the PCIE interface
+// downstream from the GPU.
+//
+// On systems that do not support PCIE, the maxspeed for the root link
+// will be zero.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: pWidth is NULL
+// NVAPI_OK: call successful
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetCurrentPCIEDownstreamWidth(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pWidth);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetPhysicalFrameBufferSize
+//
+// DESCRIPTION: Returns the physical size of framebuffer in Kb. This does NOT include any
+// system RAM that may be dedicated for use by the GPU.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: pSize is NULL
+// NVAPI_OK: call successful
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetPhysicalFrameBufferSize(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pSize);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetVirtualFrameBufferSize
+//
+// DESCRIPTION: Returns the virtual size of framebuffer in Kb. This includes the physical RAM plus any
+// system RAM that has been dedicated for use by the GPU.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: pSize is NULL
+// NVAPI_OK: call successful
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND: no NVIDIA GPU driving a display was found
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE: hPhysicalGpu was not a physical GPU handle
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetVirtualFrameBufferSize(NvPhysicalGpuHandle hPhysicalGpu,NvU32 *pSize);
+
+///////////////////////////////////////////////////////////////////////////////////
+// Thermal API
+// Provides ability to get temperature levels from the various thermal sensors associated with the GPU
+
+#define NVAPI_MAX_THERMAL_SENSORS_PER_GPU 3
+
+typedef enum
+{
+ NVAPI_THERMAL_TARGET_NONE = 0,
+ NVAPI_THERMAL_TARGET_GPU = 1,
+ NVAPI_THERMAL_TARGET_MEMORY = 2,
+ NVAPI_THERMAL_TARGET_POWER_SUPPLY = 4,
+ NVAPI_THERMAL_TARGET_BOARD = 8,
+ NVAPI_THERMAL_TARGET_ALL = 15,
+ NVAPI_THERMAL_TARGET_UNKNOWN = -1,
+} NV_THERMAL_TARGET;
+
+typedef enum
+{
+ NVAPI_THERMAL_CONTROLLER_NONE = 0,
+ NVAPI_THERMAL_CONTROLLER_GPU_INTERNAL,
+ NVAPI_THERMAL_CONTROLLER_ADM1032,
+ NVAPI_THERMAL_CONTROLLER_MAX6649,
+ NVAPI_THERMAL_CONTROLLER_MAX1617,
+ NVAPI_THERMAL_CONTROLLER_LM99,
+ NVAPI_THERMAL_CONTROLLER_LM89,
+ NVAPI_THERMAL_CONTROLLER_LM64,
+ NVAPI_THERMAL_CONTROLLER_ADT7473,
+ NVAPI_THERMAL_CONTROLLER_SBMAX6649,
+ NVAPI_THERMAL_CONTROLLER_VBIOSEVT,
+ NVAPI_THERMAL_CONTROLLER_OS,
+ NVAPI_THERMAL_CONTROLLER_UNKNOWN = -1,
+} NV_THERMAL_CONTROLLER;
+
+typedef struct
+{
+ NvU32 version; //structure version
+ NvU32 count; //number of associated thermal sensors with the selected GPU
+ struct
+ {
+ NV_THERMAL_CONTROLLER controller; //internal, ADM1032, MAX6649...
+ NvU32 defaultMinTemp; //the min default temperature value of the thermal sensor in degrees centigrade
+ NvU32 defaultMaxTemp; //the max default temperature value of the thermal sensor in degrees centigrade
+ NvU32 currentTemp; //the current temperature value of the thermal sensor in degrees centigrade
+ NV_THERMAL_TARGET target; //thermal senor targeted @ GPU, memory, chipset, powersupply, canoas...
+ } sensor[NVAPI_MAX_THERMAL_SENSORS_PER_GPU];
+
+} NV_GPU_THERMAL_SETTINGS;
+
+#define NV_GPU_THERMAL_SETTINGS_VER MAKE_NVAPI_VERSION(NV_GPU_THERMAL_SETTINGS,1)
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GPU_GetThermalSettings
+//
+// DESCRIPTION: Retrieves the thermal information of all thermal sensors or specific thermal sensor associated with the selected GPU.
+// Thermal sensors are indexed 0 to NVAPI_MAX_THERMAL_SENSORS_PER_GPU-1.
+// To retrieve specific thermal sensor info set the sensorIndex to the required thermal sensor index.
+// To retrieve info for all sensors set sensorIndex to NVAPI_THERMAL_TARGET_ALL.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// PARAMETERS : hPhysicalGPU(IN) - GPU selection.
+// sensorIndex(IN) - Explicit thermal sensor index selection.
+// pThermalSettings(OUT) - Array of thermal settings.
+//
+// RETURN STATUS:
+// NVAPI_OK - completed request
+// NVAPI_ERROR - miscellaneous error occurred
+// NVAPI_INVALID_ARGUMENT - pThermalInfo is NULL
+// NVAPI_HANDLE_INVALIDATED - handle passed has been invalidated (see user guide)
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE - handle passed is not a physical GPU handle
+// NVAPI_INCOMPATIBLE_STRUCT_VERSION - the version of the INFO struct is not supported
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GPU_GetThermalSettings(NvPhysicalGpuHandle hPhysicalGpu, NvU32 sensorIndex, NV_GPU_THERMAL_SETTINGS *pThermalSettings);
+
+////////////////////////////////////////////////////////////////////////////////
+//NvAPI_TVOutput Information
+
+typedef enum _NV_DISPLAY_TV_FORMAT
+{
+ NV_DISPLAY_TV_FORMAT_NONE = 0,
+ NV_DISPLAY_TV_FORMAT_SD_NTSCM = 0x00000001,
+ NV_DISPLAY_TV_FORMAT_SD_NTSCJ = 0x00000002,
+ NV_DISPLAY_TV_FORMAT_SD_PALM = 0x00000004,
+ NV_DISPLAY_TV_FORMAT_SD_PALBDGH = 0x00000008,
+ NV_DISPLAY_TV_FORMAT_SD_PALN = 0x00000010,
+ NV_DISPLAY_TV_FORMAT_SD_PALNC = 0x00000020,
+ NV_DISPLAY_TV_FORMAT_SD_576i = 0x00000100,
+ NV_DISPLAY_TV_FORMAT_SD_480i = 0x00000200,
+ NV_DISPLAY_TV_FORMAT_ED_480p = 0x00000400,
+ NV_DISPLAY_TV_FORMAT_ED_576p = 0x00000800,
+ NV_DISPLAY_TV_FORMAT_HD_720p = 0x00001000,
+ NV_DISPLAY_TV_FORMAT_HD_1080i = 0x00002000,
+ NV_DISPLAY_TV_FORMAT_HD_1080p = 0x00004000,
+ NV_DISPLAY_TV_FORMAT_HD_720p50 = 0x00008000,
+ NV_DISPLAY_TV_FORMAT_HD_1080p24 = 0x00010000,
+ NV_DISPLAY_TV_FORMAT_HD_1080i50 = 0x00020000,
+ NV_DISPLAY_TV_FORMAT_HD_1080p50 = 0x00040000,
+
+} NV_DISPLAY_TV_FORMAT;
+
+///////////////////////////////////////////////////////////////////////////////////
+// I2C API
+// Provides ability to read or write data using I2C protocol.
+// These APIs allow I2C access only to DDC monitors
+
+#define NVAPI_MAX_SIZEOF_I2C_DATA_BUFFER 256
+#define NVAPI_NO_PORTID_FOUND 5
+#define NVAPI_DISPLAY_DEVICE_MASK_MAX 24
+
+typedef struct
+{
+ NvU32 version; //structure version
+ NvU32 displayMask; //the Display Mask of the concerned display
+ NvU8 bIsDDCPort; //Flag indicating DDC port or a communication port
+ NvU8 i2cDevAddress; //the I2C target device address
+ NvU8* pbI2cRegAddress;//the I2C target register address
+ NvU32 regAddrSize; //the size in bytes of target register address
+ NvU8* pbData; //The buffer of data which is to be read/written
+ NvU32 cbSize; //The size of Data buffer to be read.
+ NvU32 i2cSpeed; //The speed at which the transaction is be made(between 28kbps to 40kbps)
+} NV_I2C_INFO;
+
+#define NV_I2C_INFO_VER MAKE_NVAPI_VERSION(NV_I2C_INFO,1)
+/***********************************************************************************/
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_I2CRead
+//
+// DESCRIPTION: Read data buffer from I2C port
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// PARAMETERS: hPhysicalGPU(IN) - GPU selection.
+// NV_I2C_INFO *pI2cInfo -The I2c data input structure
+//
+// RETURN STATUS:
+// NVAPI_OK - completed request
+// NVAPI_ERROR - miscellaneous error occurred
+// NVAPI_HANDLE_INVALIDATED - handle passed has been invalidated (see user guide)
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE - handle passed is not a physical GPU handle
+// NVAPI_INCOMPATIBLE_STRUCT_VERSION - structure version is not supported
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_I2CRead(NvPhysicalGpuHandle hPhysicalGpu, NV_I2C_INFO *pI2cInfo);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_I2CWrite
+//
+// DESCRIPTION: Writes data buffer to I2C port
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// PARAMETERS: hPhysicalGPU(IN) - GPU selection.
+// NV_I2C_INFO *pI2cInfo -The I2c data input structure
+//
+// RETURN STATUS:
+// NVAPI_OK - completed request
+// NVAPI_ERROR - miscellaneous error occurred
+// NVAPI_HANDLE_INVALIDATED - handle passed has been invalidated (see user guide)
+// NVAPI_EXPECTED_PHYSICAL_GPU_HANDLE - handle passed is not a physical GPU handle
+// NVAPI_INCOMPATIBLE_STRUCT_VERSION - structure version is not supported
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_I2CWrite(NvPhysicalGpuHandle hPhysicalGpu, NV_I2C_INFO *pI2cInfo);
+
+
+typedef struct
+{
+ NvU32 version; //structure version
+ NvU32 vendorId; //vendorId
+ NvU32 deviceId; //deviceId
+ NvAPI_ShortString szVendorName; //vendor Name
+ NvAPI_ShortString szChipsetName; //device Name
+ NvU32 flags; //Chipset info flags - obsolete
+ NvU32 subSysVendorId; //subsystem vendorId
+ NvU32 subSysDeviceId; //subsystem deviceId
+ NvAPI_ShortString szSubSysVendorName; //subsystem vendor Name
+} NV_CHIPSET_INFO;
+
+#define NV_CHIPSET_INFO_VER MAKE_NVAPI_VERSION(NV_CHIPSET_INFO,3)
+
+typedef enum
+{
+ NV_CHIPSET_INFO_HYBRID = 0x00000001,
+} NV_CHIPSET_INFO_FLAGS;
+
+typedef struct
+{
+ NvU32 version; //structure version
+ NvU32 vendorId; //vendorId
+ NvU32 deviceId; //deviceId
+ NvAPI_ShortString szVendorName; //vendor Name
+ NvAPI_ShortString szChipsetName; //device Name
+ NvU32 flags; //Chipset info flags
+} NV_CHIPSET_INFO_v2;
+
+#define NV_CHIPSET_INFO_VER_2 MAKE_NVAPI_VERSION(NV_CHIPSET_INFO_v2,2)
+
+typedef struct
+{
+ NvU32 version; //structure version
+ NvU32 vendorId; //vendorId
+ NvU32 deviceId; //deviceId
+ NvAPI_ShortString szVendorName; //vendor Name
+ NvAPI_ShortString szChipsetName; //device Name
+} NV_CHIPSET_INFO_v1;
+
+#define NV_CHIPSET_INFO_VER_1 MAKE_NVAPI_VERSION(NV_CHIPSET_INFO_v1,1)
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_SYS_GetChipSetInfo
+//
+// DESCRIPTION: Returns information about the System's ChipSet
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_INVALID_ARGUMENT: pChipSetInfo is NULL
+// NVAPI_OK: *pChipSetInfo is now set
+// NVAPI_INCOMPATIBLE_STRUCT_VERSION - NV_CHIPSET_INFO version not compatible with driver
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_SYS_GetChipSetInfo(NV_CHIPSET_INFO *pChipSetInfo);
+
+typedef struct
+{
+ NvU32 version; // Structure version, constructed from macro below
+ NvU32 currentLidState;
+ NvU32 currentDockState;
+ NvU32 currentLidPolicy;
+ NvU32 currentDockPolicy;
+ NvU32 forcedLidMechanismPresent;
+ NvU32 forcedDockMechanismPresent;
+}NV_LID_DOCK_PARAMS;
+
+#define NV_LID_DOCK_PARAMS_VER MAKE_NVAPI_VERSION(NV_LID_DOCK_PARAMS,1)
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_GetLidDockInfo
+//
+// DESCRIPTION: Returns current lid and dock information.
+//
+// SUPPORTED OS: Mac OS X, Windows XP and higher
+//
+// RETURN STATUS: NVAPI_OK: now *pLidAndDock contains the returned lid and dock information.
+// NVAPI_ERROR:If any way call is not success.
+// NVAPI_NOT_SUPPORTED:If any way call is not success.
+// NVAPI_HANDLE_INVALIDATED:If nvapi escape result handle is invalid.
+// NVAPI_API_NOT_INTIALIZED:If NVAPI is not initialized.
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_SYS_GetLidAndDockInfo(NV_LID_DOCK_PARAMS *pLidAndDock);
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_OGL_ExpertModeSet[Get]
+//
+// DESCRIPTION: Configure OpenGL Expert Mode, an API usage feedback and
+// advice reporting mechanism. The effects of this call are
+// applied only to the current context, and are reset to the
+// defaults when the context is destroyed.
+//
+// Note: This feature is valid at runtime only when GLExpert
+// functionality has been built into the OpenGL driver
+// installed on the system. All Windows Vista OpenGL
+// drivers provided by NVIDIA have this instrumentation
+// included by default. Windows XP, however, requires a
+// special display driver available with the NVIDIA
+// PerfSDK found at developer.nvidia.com.
+//
+// Note: These functions are valid only for the current OpenGL
+// context. Calling these functions prior to creating a
+// context and calling MakeCurrent with it will result
+// in errors and undefined behavior.
+//
+// PARAMETERS: expertDetailMask Mask made up of NVAPI_OGLEXPERT_DETAIL bits,
+// this parameter specifies the detail level in
+// the feedback stream.
+//
+// expertReportMask Mask made up of NVAPI_OGLEXPERT_REPORT bits,
+// this parameter specifies the areas of
+// functional interest.
+//
+// expertOutputMask Mask made up of NVAPI_OGLEXPERT_OUTPUT bits,
+// this parameter specifies the feedback output
+// location.
+//
+// expertCallback Used in conjunction with OUTPUT_TO_CALLBACK,
+// this is a simple callback function the user
+// may use to obtain the feedback stream. The
+// function will be called once per fully
+// qualified feedback stream entry.
+//
+// RETURN STATUS: NVAPI_API_NOT_INTIALIZED : NVAPI not initialized
+// NVAPI_NVIDIA_DEVICE_NOT_FOUND : no NVIDIA GPU found
+// NVAPI_OPENGL_CONTEXT_NOT_CURRENT : no NVIDIA OpenGL context
+// which supports GLExpert
+// has been made current
+// NVAPI_ERROR : OpenGL driver failed to load properly
+// NVAPI_OK : success
+//
+///////////////////////////////////////////////////////////////////////////////
+#define NVAPI_OGLEXPERT_DETAIL_NONE 0x00000000
+#define NVAPI_OGLEXPERT_DETAIL_ERROR 0x00000001
+#define NVAPI_OGLEXPERT_DETAIL_SWFALLBACK 0x00000002
+#define NVAPI_OGLEXPERT_DETAIL_BASIC_INFO 0x00000004
+#define NVAPI_OGLEXPERT_DETAIL_DETAILED_INFO 0x00000008
+#define NVAPI_OGLEXPERT_DETAIL_PERFORMANCE_WARNING 0x00000010
+#define NVAPI_OGLEXPERT_DETAIL_QUALITY_WARNING 0x00000020
+#define NVAPI_OGLEXPERT_DETAIL_USAGE_WARNING 0x00000040
+#define NVAPI_OGLEXPERT_DETAIL_ALL 0xFFFFFFFF
+
+#define NVAPI_OGLEXPERT_REPORT_NONE 0x00000000
+#define NVAPI_OGLEXPERT_REPORT_ERROR 0x00000001
+#define NVAPI_OGLEXPERT_REPORT_SWFALLBACK 0x00000002
+#define NVAPI_OGLEXPERT_REPORT_PIPELINE_VERTEX 0x00000004
+#define NVAPI_OGLEXPERT_REPORT_PIPELINE_GEOMETRY 0x00000008
+#define NVAPI_OGLEXPERT_REPORT_PIPELINE_XFB 0x00000010
+#define NVAPI_OGLEXPERT_REPORT_PIPELINE_RASTER 0x00000020
+#define NVAPI_OGLEXPERT_REPORT_PIPELINE_FRAGMENT 0x00000040
+#define NVAPI_OGLEXPERT_REPORT_PIPELINE_ROP 0x00000080
+#define NVAPI_OGLEXPERT_REPORT_PIPELINE_FRAMEBUFFER 0x00000100
+#define NVAPI_OGLEXPERT_REPORT_PIPELINE_PIXEL 0x00000200
+#define NVAPI_OGLEXPERT_REPORT_PIPELINE_TEXTURE 0x00000400
+#define NVAPI_OGLEXPERT_REPORT_OBJECT_BUFFEROBJECT 0x00000800
+#define NVAPI_OGLEXPERT_REPORT_OBJECT_TEXTURE 0x00001000
+#define NVAPI_OGLEXPERT_REPORT_OBJECT_PROGRAM 0x00002000
+#define NVAPI_OGLEXPERT_REPORT_OBJECT_FBO 0x00004000
+#define NVAPI_OGLEXPERT_REPORT_FEATURE_SLI 0x00008000
+#define NVAPI_OGLEXPERT_REPORT_ALL 0xFFFFFFFF
+
+#define NVAPI_OGLEXPERT_OUTPUT_TO_NONE 0x00000000
+#define NVAPI_OGLEXPERT_OUTPUT_TO_CONSOLE 0x00000001
+#define NVAPI_OGLEXPERT_OUTPUT_TO_DEBUGGER 0x00000004
+#define NVAPI_OGLEXPERT_OUTPUT_TO_CALLBACK 0x00000008
+#define NVAPI_OGLEXPERT_OUTPUT_TO_ALL 0xFFFFFFFF
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION TYPE: NVAPI_OGLEXPERT_CALLBACK
+//
+// DESCRIPTION: Used in conjunction with OUTPUT_TO_CALLBACK, this is a simple
+// callback function the user may use to obtain the feedback
+// stream. The function will be called once per fully qualified
+// feedback stream entry.
+//
+// PARAMETERS: categoryId Contains the bit from the NVAPI_OGLEXPERT_REPORT
+// mask that corresponds to the current message
+// messageId Unique Id for the current message
+// detailLevel Contains the bit from the NVAPI_OGLEXPERT_DETAIL
+// mask that corresponds to the current message
+// objectId Unique Id of the object that corresponds to the
+// current message
+// messageStr Text string from the current message
+//
+///////////////////////////////////////////////////////////////////////////////
+typedef void (* NVAPI_OGLEXPERT_CALLBACK) (unsigned int categoryId, unsigned int messageId, unsigned int detailLevel, int objectId, const char *messageStr);
+
+// SUPPORTED OS: Windows XP and higher
+NVAPI_INTERFACE NvAPI_OGL_ExpertModeSet(NvU32 expertDetailLevel,
+ NvU32 expertReportMask,
+ NvU32 expertOutputMask,
+ NVAPI_OGLEXPERT_CALLBACK expertCallback);
+
+
+// SUPPORTED OS: Windows XP and higher
+NVAPI_INTERFACE NvAPI_OGL_ExpertModeGet(NvU32 *pExpertDetailLevel,
+ NvU32 *pExpertReportMask,
+ NvU32 *pExpertOutputMask,
+ NVAPI_OGLEXPERT_CALLBACK *pExpertCallback);
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// FUNCTION NAME: NvAPI_OGL_ExpertModeDefaultsSet[Get]
+//
+// DESCRIPTION: Configure OpenGL Expert Mode global defaults. These settings
+// apply to any OpenGL application which starts up after these
+// values are applied (i.e. these settings *do not* apply to
+// currently running applications).
+//
+// PARAMETERS: expertDetailLevel Value which specifies the detail level in
+// the feedback stream. This is a mask made up
+// of NVAPI_OGLEXPERT_LEVEL bits.
+//
+// expertReportMask Mask made up of NVAPI_OGLEXPERT_REPORT bits,
+// this parameter specifies the areas of
+// functional interest.
+//
+// expertOutputMask Mask made up of NVAPI_OGLEXPERT_OUTPUT bits,
+// this parameter specifies the feedback output
+// location. Note that using OUTPUT_TO_CALLBACK
+// here is meaningless and has no effect, but
+// using it will not cause an error.
+//
+// RETURN STATUS: NVAPI_ERROR or NVAPI_OK
+//
+///////////////////////////////////////////////////////////////////////////////
+
+// SUPPORTED OS: Windows XP and higher
+NVAPI_INTERFACE NvAPI_OGL_ExpertModeDefaultsSet(NvU32 expertDetailLevel,
+ NvU32 expertReportMask,
+ NvU32 expertOutputMask);
+
+// SUPPORTED OS: Windows XP and higher
+NVAPI_INTERFACE NvAPI_OGL_ExpertModeDefaultsGet(NvU32 *pExpertDetailLevel,
+ NvU32 *pExpertReportMask,
+ NvU32 *pExpertOutputMask);
+
+#define NVAPI_MAX_VIEW_TARGET 2
+
+typedef enum _NV_TARGET_VIEW_MODE
+{
+ NV_VIEW_MODE_STANDARD = 0,
+ NV_VIEW_MODE_CLONE = 1,
+ NV_VIEW_MODE_HSPAN = 2,
+ NV_VIEW_MODE_VSPAN = 3,
+ NV_VIEW_MODE_DUALVIEW = 4,
+ NV_VIEW_MODE_MULTIVIEW = 5,
+} NV_TARGET_VIEW_MODE;
+
+
+// Following definitions are used in NvAPI_SetViewEx.
+// Scaling modes
+typedef enum _NV_SCALING
+{
+ NV_SCALING_DEFAULT = 0, // No change
+ NV_SCALING_MONITOR_SCALING = 1,
+ NV_SCALING_ADAPTER_SCALING = 2,
+ NV_SCALING_CENTERED = 3,
+ NV_SCALING_ASPECT_SCALING = 5,
+ NV_SCALING_CUSTOMIZED = 255 // For future use
+} NV_SCALING;
+
+// Rotate modes
+typedef enum _NV_ROTATE
+{
+ NV_ROTATE_0 = 0,
+ NV_ROTATE_90 = 1,
+ NV_ROTATE_180 = 2,
+ NV_ROTATE_270 = 3
+} NV_ROTATE;
+
+// Color formats
+typedef enum _NV_FORMAT
+{
+ NV_FORMAT_UNKNOWN = 0, // unknown. Driver will choose one as following value.
+ NV_FORMAT_P8 = 41, // for 8bpp mode
+ NV_FORMAT_R5G6B5 = 23, // for 16bpp mode
+ NV_FORMAT_A8R8G8B8 = 21, // for 32bpp mode
+ NV_FORMAT_A16B16G16R16F = 113 // for 64bpp(floating point) mode.
+} NV_FORMAT;
+
+// TV standard
+
+
+///////////////////////////////////////////////////////////////////////////////
+// FUNCTION NAME: NvAPI_SetView
+//
+// DESCRIPTION: This API lets caller to modify target display arrangement for selected source display handle in any of the nview modes.
+// It also allows to modify or extend the source display in dualview mode.
+//
+// SUPPORTED OS: Windows Vista and higher
+//
+// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. NVAPI_DEFAULT_HANDLE not allowed, it has to be a handle enumerated with NvAPI_EnumNVidiaDisplayHandle().
+// pTargetInfo(IN) - Pointer to array of NV_VIEW_TARGET_INFO, specifying device properties in this view.
+// The first device entry in the array is the physical primary.
+// The device entry with the lowest source id is the desktop primary.
+// targetCount(IN) - Count of target devices specified in pTargetInfo.
+// targetView(IN) - Target view selected from NV_TARGET_VIEW_MODE.
+//
+// RETURN STATUS:
+// NVAPI_OK - completed request
+// NVAPI_ERROR - miscellaneous error occurred
+// NVAPI_INVALID_ARGUMENT: Invalid input parameter.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+typedef struct
+{
+ NvU32 version; // (IN) structure version
+ NvU32 count; // (IN) target count
+ struct
+ {
+ NvU32 deviceMask; // (IN/OUT) device mask
+ NvU32 sourceId; // (IN/OUT) source id
+ NvU32 bPrimary:1; // (OUT) Indicates if this is the GPU's primary view target. This is not the desktop GDI primary.
+ // NvAPI_SetView automatically selects the first target in NV_VIEW_TARGET_INFO index 0 as the GPU's primary view.
+ NvU32 bInterlaced:1;// (IN/OUT) Indicates if the timing being used on this monitor is interlaced
+ NvU32 bGDIPrimary:1;// (IN/OUT) Indicates if this is the desktop GDI primary.
+ } target[NVAPI_MAX_VIEW_TARGET];
+} NV_VIEW_TARGET_INFO;
+
+#define NV_VIEW_TARGET_INFO_VER MAKE_NVAPI_VERSION(NV_VIEW_TARGET_INFO,2)
+
+NVAPI_INTERFACE NvAPI_SetView(NvDisplayHandle hNvDisplay, NV_VIEW_TARGET_INFO *pTargetInfo, NV_TARGET_VIEW_MODE targetView);
+
+///////////////////////////////////////////////////////////////////////////////
+// FUNCTION NAME: NvAPI_GetView
+//
+// DESCRIPTION: This API lets caller retrieve the target display arrangement for selected source display handle.
+//
+// SUPPORTED OS: Windows Vista and higher
+//
+// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. NVAPI_DEFAULT_HANDLE not allowed, it has to be a handle enumerated with NvAPI_EnumNVidiaDisplayHandle().
+// pTargetInfo(OUT) - User allocated storage to retrieve an array of NV_VIEW_TARGET_INFO. Can be NULL to retrieve the targetCount.
+// targetMaskCount(IN/OUT) - Count of target device mask specified in pTargetMask.
+// targetView(OUT) - Target view selected from NV_TARGET_VIEW_MODE.
+//
+// RETURN STATUS:
+// NVAPI_OK - completed request
+// NVAPI_ERROR - miscellaneous error occurred
+// NVAPI_INVALID_ARGUMENT: Invalid input parameter.
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GetView(NvDisplayHandle hNvDisplay, NV_VIEW_TARGET_INFO *pTargets, NvU32 *pTargetMaskCount, NV_TARGET_VIEW_MODE *pTargetView);
+
+///////////////////////////////////////////////////////////////////////////////
+// FUNCTION NAME: NvAPI_SetViewEx
+//
+// DESCRIPTION: This API lets caller to modify the display arrangement for selected source display handle in any of the nview modes.
+// It also allows to modify or extend the source display in dualview mode.
+//
+// SUPPORTED OS: Windows Vista and higher
+//
+// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. NVAPI_DEFAULT_HANDLE not allowed, it has to be a handle enumerated with NvAPI_EnumNVidiaDisplayHandle().
+// pPathInfo(IN) - Pointer to array of NV_VIEW_PATH_INFO, specifying device properties in this view.
+// The first device entry in the array is the physical primary.
+// The device entry with the lowest source id is the desktop primary.
+// pathCount(IN) - Count of paths specified in pPathInfo.
+// displayView(IN)- Display view selected from NV_TARGET_VIEW_MODE.
+//
+// RETURN STATUS:
+// NVAPI_OK - completed request
+// NVAPI_ERROR - miscellaneous error occurred
+// NVAPI_INVALID_ARGUMENT: Invalid input parameter.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#define NVAPI_MAX_DISPLAY_PATH NVAPI_MAX_VIEW_TARGET
+
+typedef struct
+{
+ NvU32 version; // (IN) structure version
+ NvU32 count; // (IN) path count
+ struct
+ {
+ NvU32 deviceMask; // (IN) device mask
+ NvU32 sourceId; // (IN) source id
+ NvU32 bPrimary:1; // (IN/OUT) Indicates if this is the GPU's primary view target. This is not the desktop GDI primary.
+ // NvAPI_SetViewEx automatically selects the first target in NV_DISPLAY_PATH_INFO index 0 as the GPU's primary view.
+ NV_GPU_CONNECTOR_TYPE connector; // (IN) Specify connector type. For TV only.
+
+ // source mode information
+ NvU32 width; // (IN) width of the mode
+ NvU32 height; // (IN) height of the mode
+ NvU32 depth; // (IN) depth of the mode
+ NV_FORMAT colorFormat; // color format if needs to specify. Not used now.
+
+ //rotation setting of the mode
+ NV_ROTATE rotation; // (IN) rotation setting.
+
+ // the scaling mode
+ NV_SCALING scaling; // (IN) scaling setting
+
+ // Timing info
+ NvU32 refreshRate; // (IN) refresh rate of the mode
+ NvU32 interlaced:1; // (IN) interlaced mode flag
+
+ NV_DISPLAY_TV_FORMAT tvFormat; // (IN) to choose the last TV format set this value to NV_DISPLAY_TV_FORMAT_NONE
+
+ // Windows desktop position
+ NvU32 posx; // (IN/OUT) x offset of this display on the Windows desktop
+ NvU32 posy; // (IN/OUT) y offset of this display on the Windows desktop
+ NvU32 bGDIPrimary:1; // (IN/OUT) Indicates if this is the desktop GDI primary.
+
+ } path[NVAPI_MAX_DISPLAY_PATH];
+} NV_DISPLAY_PATH_INFO;
+
+#define NV_DISPLAY_PATH_INFO_VER MAKE_NVAPI_VERSION(NV_DISPLAY_PATH_INFO,2)
+
+NVAPI_INTERFACE NvAPI_SetViewEx(NvDisplayHandle hNvDisplay, NV_DISPLAY_PATH_INFO *pPathInfo, NV_TARGET_VIEW_MODE displayView);
+
+///////////////////////////////////////////////////////////////////////////////
+// FUNCTION NAME: NvAPI_GetViewEx
+//
+// DESCRIPTION: This API lets caller retrieve the target display arrangement for selected source display handle.
+//
+// SUPPORTED OS: Windows Vista and higher
+//
+// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. NVAPI_DEFAULT_HANDLE not allowed, it has to be a handle enumerated with NvAPI_EnumNVidiaDisplayHandle().
+// pPathInfo(IN/OUT) - count field should be set to NVAPI_MAX_DISPLAY_PATH. Can be NULL to retrieve just the pathCount.
+// pPathCount(IN/OUT) - Number of elements in array pPathInfo->path.
+// pTargetViewMode(OUT)- Display view selected from NV_TARGET_VIEW_MODE.
+//
+// RETURN STATUS:
+// NVAPI_OK - completed request
+// NVAPI_API_NOT_INTIALIZED - NVAPI not initialized
+// NVAPI_ERROR - miscellaneous error occurred
+// NVAPI_INVALID_ARGUMENT - Invalid input parameter.
+// NVAPI_EXPECTED_DISPLAY_HANDLE - hNvDisplay is not a valid display handle.
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GetViewEx(NvDisplayHandle hNvDisplay, NV_DISPLAY_PATH_INFO *pPathInfo, NvU32 *pPathCount, NV_TARGET_VIEW_MODE *pTargetViewMode);
+
+///////////////////////////////////////////////////////////////////////////////
+// FUNCTION NAME: NvAPI_GetSupportedViews
+//
+// DESCRIPTION: This API lets caller enumerate all the supported NVIDIA display views - nview and dualview modes.
+//
+// SUPPORTED OS: Windows XP and higher
+//
+// PARAMETERS: hNvDisplay(IN) - NVIDIA Display selection. It can be NVAPI_DEFAULT_HANDLE or a handle enumerated from NvAPI_EnumNVidiaDisplayHandle().
+// pTargetViews(OUT) - Array of supported views. Can be NULL to retrieve the pViewCount first.
+// pViewCount(IN/OUT) - Count of supported views.
+//
+// RETURN STATUS:
+// NVAPI_OK - completed request
+// NVAPI_ERROR - miscellaneous error occurred
+// NVAPI_INVALID_ARGUMENT: Invalid input parameter.
+//
+///////////////////////////////////////////////////////////////////////////////
+NVAPI_INTERFACE NvAPI_GetSupportedViews(NvDisplayHandle hNvDisplay, NV_TARGET_VIEW_MODE *pTargetViews, NvU32 *pViewCount);
+
+
+#ifdef __cplusplus
+}; //extern "C" {
+#endif
+
+#pragma pack(pop)
+
+#endif // _NVAPI_H
+