Added new property autoDetectPF to PlayerOptions class.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@257 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfbplayer/PlayerOptions.cxx b/rfbplayer/PlayerOptions.cxx
index 04c5784..394b2b1 100644
--- a/rfbplayer/PlayerOptions.cxx
+++ b/rfbplayer/PlayerOptions.cxx
@@ -33,7 +33,8 @@
     RegKey regKey;
     regKey.createKey(HKEY_CURRENT_USER, _T("Software\\TightVnc\\RfbPlayer"));
     autoPlay = regKey.getBool(_T("AutoPlay"), DEFAULT_AUTOPLAY);
-    pixelFormatIndex = regKey.getInt(_T("PixelFormatIndex"), DEFAULT_PF);
+    autoDetectPF = regKey.getBool(_T("AutoDetectPixelFormat"), DEFAULT_AUTOPF);
+    pixelFormatIndex = regKey.getInt(_T("PixelFormatIndex"), DEFAULT_PF_INDEX);
     regKey.getBinary(_T("PixelFormat"), (void**)&pPF, &pfSize, 
       &PixelFormat(32,24,0,1,255,255,255,16,8,0), sizeof(PixelFormat));
     setPF(pPF);
@@ -54,6 +55,7 @@
     RegKey regKey;
     regKey.createKey(HKEY_CURRENT_USER, _T("Software\\TightVnc\\RfbPlayer"));
     regKey.setBool(_T("AutoPlay"), autoPlay);
+    regKey.setBool(_T("AutoDetectPixelFormat"), autoDetectPF);
     regKey.setInt(_T("PixelFormatIndex"), pixelFormatIndex);
     regKey.setBinary(_T("PixelFormat"), &pixelFormat, sizeof(PixelFormat));
     regKey.setBool(_T("AcceptBell"), acceptBell);
@@ -70,7 +72,8 @@
 void PlayerOptions::writeDefaults() {
   initTime = DEFAULT_INIT_TIME;
   playbackSpeed = DEFAULT_SPEED;
-  pixelFormatIndex = PF_AUTO;
+  autoDetectPF = DEFAULT_AUTOPF;
+  pixelFormatIndex = DEFAULT_PF_INDEX;
   pixelFormat = PixelFormat(32,24,0,1,255,255,255,16,8,0);
   frameScale = DEFAULT_FRAME_SCALE;
   autoPlay = DEFAULT_AUTOPLAY;
diff --git a/rfbplayer/PlayerOptions.h b/rfbplayer/PlayerOptions.h
index 1bca343..a64e3e7 100644
--- a/rfbplayer/PlayerOptions.h
+++ b/rfbplayer/PlayerOptions.h
@@ -27,11 +27,6 @@
 
 #include <rfb_win32/registry.h>
 
-// Supported pixel formats
-#define PF_AUTO 0
-#define PF_D8_RGB332 1
-#define PF_D16_RGB655 2
-#define PF_D24_RGB888 3
 #define PF_MODES 3
 
 // The R, G and B values order in the pixel
@@ -43,7 +38,9 @@
 #define BRG_ORDER 5
 
 // Default options values
-#define DEFAULT_PF PF_AUTO
+//#define DEFAULT_PF 0
+#define DEFAULT_PF_INDEX 0
+#define DEFAULT_AUTOPF TRUE
 #define DEFAULT_INIT_TIME -1
 #define DEFAULT_SPEED 1.0
 #define DEFAULT_FRAME_SCALE 100
@@ -69,6 +66,7 @@
   double playbackSpeed;
   bool autoPlay;
   bool fullScreen;
+  bool autoDetectPF;
   long pixelFormatIndex;
   PixelFormat pixelFormat;
   bool acceptBell;