]> source.dussan.org Git - tigervnc.git/commitdiff
PlayerOptions::pixelFormat changed to pixelFormatIndex.
authorgeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>
Sat, 19 Mar 2005 11:19:00 +0000 (11:19 +0000)
committergeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>
Sat, 19 Mar 2005 11:19:00 +0000 (11:19 +0000)
Added new property pixelFormat to PlayerOptions class.
Added supportedPF to RfbPlayer class.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@252 3789f03b-4d11-0410-bbf8-ca57d06f2519

rfbplayer/OptionsDialog.h
rfbplayer/PlayerOptions.cxx
rfbplayer/PlayerOptions.h
rfbplayer/rfbplayer.cxx
rfbplayer/rfbplayer.h

index 7cc0a52f057c097e407e52d8e46fe13f7216bd7e..484791ad1c4a53b9987d74d9a1a72bc48ae89f2b 100644 (file)
@@ -40,7 +40,7 @@ protected:
     SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)("8 bit depth (RGB332)"));
     SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)("16 bit depth (RGB655)"));
     SendMessage(combo, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)("24 bit depth (RGB888)"));
-    SendMessage(combo, CB_SETCURSEL, options->pixelFormat, 0);
+    SendMessage(combo, CB_SETCURSEL, options->pixelFormatIndex, 0);
     if (options->askPixelFormat) {
       setItemChecked(IDC_ASK_PF, true);
       enableItem(IDC_PIXELFORMAT, false);
@@ -52,7 +52,7 @@ protected:
   }
   virtual bool onOk() {
     if (!isItemChecked(IDC_ASK_PF)) {
-      options->pixelFormat = SendMessage(combo, CB_GETCURSEL, 0, 0);
+      options->pixelFormatIndex = SendMessage(combo, CB_GETCURSEL, 0, 0);
     }
     options->askPixelFormat = isItemChecked(IDC_ASK_PF);
     options->acceptBell = isItemChecked(IDC_ACCEPT_BELL);
index aea0efea836fb03b513259d2152576704fae3057..8a8bf360a4fe4b65fa36366df4890f1c23fb0a68 100644 (file)
@@ -28,16 +28,21 @@ PlayerOptions::PlayerOptions() {
 
 void PlayerOptions::readFromRegistry() {
   try {
+    PixelFormat *pPF = 0;
+    int pfSize = sizeof(PixelFormat);
     RegKey regKey;
     regKey.createKey(HKEY_CURRENT_USER, _T("Software\\TightVnc\\RfbPlayer"));
     autoPlay = regKey.getBool(_T("AutoPlay"), DEFAULT_AUTOPLAY);
-    pixelFormat = regKey.getInt(_T("PixelFormat"), DEFAULT_PF);
+    pixelFormatIndex = regKey.getInt(_T("PixelFormatIndex"), DEFAULT_PF);
+    regKey.getBinary(_T("PixelFormat"), (void**)&pPF, &pfSize, 
+      &PixelFormat(32,24,0,1,255,255,255,16,8,0), sizeof(PixelFormat));
     acceptBell = regKey.getBool(_T("AcceptBell"), DEFAULT_ACCEPT_BELL);
     acceptCutText = regKey.getBool(_T("AcceptCutText"), DEFAULT_ACCEPT_CUT_TEXT);
     autoStoreSettings = regKey.getBool(_T("AutoStoreSettings"), DEFAULT_STORE_SETTINGS);
     autoPlay = regKey.getBool(_T("AutoPlay"), DEFAULT_AUTOPLAY);
     loopPlayback = regKey.getBool(_T("LoopPlayback"), DEFAULT_LOOP_PLAYBACK);
     askPixelFormat = regKey.getBool(_T("AskPixelFormat"), DEFAULT_ASK_PF);
+    if (pPF) delete pPF;
   } catch (rdr::Exception e) {
     MessageBox(0, e.str(), e.type(), MB_OK | MB_ICONERROR);
   }
@@ -48,7 +53,8 @@ void PlayerOptions::writeToRegistry() {
     RegKey regKey;
     regKey.createKey(HKEY_CURRENT_USER, _T("Software\\TightVnc\\RfbPlayer"));
     regKey.setBool(_T("AutoPlay"), autoPlay);
-    regKey.setInt(_T("PixelFormat"), pixelFormat);
+    regKey.setInt(_T("PixelFormatIndex"), pixelFormatIndex);
+    regKey.setBinary(_T("PixelFormat"), &pixelFormat, sizeof(PixelFormat));
     regKey.setBool(_T("AcceptBell"), acceptBell);
     regKey.setBool(_T("AcceptCutText"), acceptCutText);
     regKey.setBool(_T("AutoStoreSettings"), autoStoreSettings);
@@ -63,7 +69,8 @@ void PlayerOptions::writeToRegistry() {
 void PlayerOptions::writeDefaults() {
   initTime = DEFAULT_INIT_TIME;
   playbackSpeed = DEFAULT_SPEED;
-  pixelFormat = PF_AUTO;
+  pixelFormatIndex = PF_AUTO;
+  pixelFormat = PixelFormat(32,24,0,1,255,255,255,16,8,0);
   frameScale = DEFAULT_FRAME_SCALE;
   autoPlay = DEFAULT_AUTOPLAY;
   fullScreen = DEFAULT_FULL_SCREEN;
@@ -75,7 +82,7 @@ void PlayerOptions::writeDefaults() {
 }
 
 void PlayerOptions::setPF(PixelFormat *newPF) {
-  memcpy(&PF, newPF, sizeof(PixelFormat));
+  memcpy(&pixelFormat, newPF, sizeof(PixelFormat));
 }
 
 bool PlayerOptions::setPF(int rgb_order, int rm, int gm, int bm, bool big_endian) {
index 2a56b3feed478a858be4e9ea016f7433c8905e62..1bca34384cdbf47917a8c2dd6c4f03a6bab5ba97 100644 (file)
@@ -69,8 +69,8 @@ public:
   double playbackSpeed;
   bool autoPlay;
   bool fullScreen;
-  long pixelFormat;
-  PixelFormat PF;
+  long pixelFormatIndex;
+  PixelFormat pixelFormat;
   bool acceptBell;
   bool acceptCutText;
   bool loopPlayback;
index 6de2810306f807f7d3e366b69d8ca2e66c78dbf0..d2bd1d6c857a312df44a57affa9b7c0dd4240c8d 100644 (file)
@@ -25,6 +25,7 @@
 #include <rfb_win32/Win32Util.h>
 #include <rfb_win32/WMShatter.h> 
 
+#include <rfbplayer/PixelFormatList.h>
 #include <rfbplayer/rfbplayer.h>
 
 using namespace rfb;
@@ -60,6 +61,7 @@ char usage_msg[] =
 // -=- RfbPlayer's defines
 
 #define strcasecmp _stricmp
+#define UPF_REGISTRY_PATH "Software\\TightVnc\\RfbPlayer\\UserDefinedPF"
 #define MAX_SPEED 10.00
 #define CALCULATION_ERROR MAX_SPEED / 1000
 #define MAX_POS_TRACKBAR_RANGE 50
@@ -226,6 +228,9 @@ RfbPlayer::RfbPlayer(char *_fileName, PlayerOptions *_options)
   // Reset the full session time
   strcpy(fullSessionTime, "00m:00s");
 
+  // Load the user defined pixel formats from the registry
+  supportedPF.readUserDefinedPF(HKEY_CURRENT_USER, UPF_REGISTRY_PATH);
+
   // Create the main window
   const TCHAR* name = _T("RfbPlayer");
   int x = max(0, (GetSystemMetrics(SM_CXSCREEN) - DEFAULT_PLAYER_WIDTH) / 2);
@@ -894,7 +899,7 @@ void RfbPlayer::serverInit() {
       throw rdr::Exception("[TERMINATE]");
     }
   } else {
-    pixelFormat = options.pixelFormat;
+    pixelFormat = options.pixelFormatIndex;
   }
   switch (pixelFormat) {
   case PF_AUTO: 
@@ -1228,7 +1233,7 @@ bool processParams(int argc, char* argv[]) {
       if ((pf < 0) || (pf > PF_MODES)) {
         return false;
       }
-      playerOptions.pixelFormat = pf;
+      playerOptions.pixelFormatIndex = pf;
       continue;
     }
 
index 9357428c95726dea29626ef7c03055d98c9b7a6b..b5a967669eff61f7c8bc6490fffe0d7a51195dd4 100644 (file)
@@ -177,6 +177,7 @@ class RfbPlayer : public RfbProto {
 
     // The player's parameters
     PlayerOptions options;
+    PixelFormatList supportedPF;
     long imageDataStartTime;
     long sessionTimeMs;
 };