Added big-endian-flag option to the ChoosePixelFormatDialog dialog.
Finished big-endian-flag support in the player.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@262 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfbplayer/ChoosePixelFormatDialog.h b/rfbplayer/ChoosePixelFormatDialog.h
index 6e063bd..8a3de45 100644
--- a/rfbplayer/ChoosePixelFormatDialog.h
+++ b/rfbplayer/ChoosePixelFormatDialog.h
@@ -22,15 +22,15 @@
 
 class ChoosePixelFormatDialog : public rfb::win32::Dialog {
 public:
-  ChoosePixelFormatDialog(long _pfIndex, PixelFormatList *_supportedPF) 
-  : Dialog(GetModuleHandle(0)), supportedPF(_supportedPF), pfIndex(_pfIndex), 
-    combo(0) {}
+  ChoosePixelFormatDialog(PixelFormatList *_supportedPF) 
+  : Dialog(GetModuleHandle(0)), supportedPF(_supportedPF), combo(0) {}
   // - Show the dialog and return true if OK was clicked,
   //   false in case of error or Cancel
   virtual bool showDialog(HWND parent) {
     return Dialog::showDialog(MAKEINTRESOURCE(IDD_PIXELFORMAT), parent);
   }
-  const long getPF() const {return pfIndex;}
+  const long getPFIndex() const {return pfIndex;}
+  bool isBigEndian() {return isItemChecked(IDC_BIG_ENDIAN);}
 protected:
 
   // Dialog methods (protected)
@@ -42,15 +42,18 @@
         0, (LPARAM)(LPCTSTR)(((*supportedPF)[i]).format_name));
     }
     SendMessage(combo, CB_SETCURSEL, pfIndex + 1, 0);
+    setItemChecked(IDC_BIG_ENDIAN, bigEndian);
   }
   virtual bool onOk() {
     pfIndex = SendMessage(combo, CB_GETCURSEL, 0, 0) - 1;
+    bigEndian = isItemChecked(IDC_BIG_ENDIAN);
     return true;
   }
   virtual bool onCancel() {
     return false;
   }
-  long pfIndex;
+  static long pfIndex;
+  static bool bigEndian;
   PixelFormatList *supportedPF;
   HWND combo;
 };
\ No newline at end of file
diff --git a/rfbplayer/resource.h b/rfbplayer/resource.h
index 8dd8707..52e171a 100644
--- a/rfbplayer/resource.h
+++ b/rfbplayer/resource.h
@@ -43,7 +43,7 @@
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        138
 #define _APS_NEXT_COMMAND_VALUE         40045
-#define _APS_NEXT_CONTROL_VALUE         1014
+#define _APS_NEXT_CONTROL_VALUE         1015
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
diff --git a/rfbplayer/rfbplayer.cxx b/rfbplayer/rfbplayer.cxx
index a98ed41..9a181a5 100644
--- a/rfbplayer/rfbplayer.cxx
+++ b/rfbplayer/rfbplayer.cxx
@@ -877,6 +877,9 @@
   }
 }
 
+long ChoosePixelFormatDialog::pfIndex = DEFAULT_PF_INDEX;
+bool ChoosePixelFormatDialog::bigEndian = false;
+
 void RfbPlayer::serverInit() {
   RfbProto::serverInit();
 
@@ -891,17 +894,17 @@
     throw rdr::Exception("This version plays only true color session!");
 
   // Set the session pixel format
-  static long pixelFormatIndex = DEFAULT_PF_INDEX;
   if (options.askPixelFormat) {
-    ChoosePixelFormatDialog choosePixelFormatDialog(pixelFormatIndex, &supportedPF);
+    ChoosePixelFormatDialog choosePixelFormatDialog(&supportedPF);
     if (choosePixelFormatDialog.showDialog(getMainHandle())) {
-      pixelFormatIndex = choosePixelFormatDialog.getPF();
+      long pixelFormatIndex = choosePixelFormatDialog.getPFIndex();
       if (pixelFormatIndex < 0) {
         options.autoDetectPF = true;
         options.setPF((PixelFormat *)&cp.pf());
       } else {
         options.autoDetectPF = false;
         options.setPF(&supportedPF[pixelFormatIndex].PF);
+        options.pixelFormat.bigEndian = choosePixelFormatDialog.isBigEndian();
       }
     } else {
       is->pausePlayback();
@@ -912,6 +915,7 @@
       options.setPF((PixelFormat *)&cp.pf());
     } else {
       options.setPF(&supportedPF[options.pixelFormatIndex].PF);
+      options.pixelFormat.bigEndian = options.bigEndianFlag;
     }
   }
   cp.setPF(options.pixelFormat);
diff --git a/rfbplayer/rfbplayer.rc b/rfbplayer/rfbplayer.rc
index 01d7a32..474fb1d 100644
--- a/rfbplayer/rfbplayer.rc
+++ b/rfbplayer/rfbplayer.rc
@@ -211,16 +211,18 @@
     LTEXT           "Pos (ms):",IDC_STATIC,7,9,33,15,SS_CENTERIMAGE
 END
 
-IDD_PIXELFORMAT DIALOG DISCARDABLE  0, 0, 144, 62
+IDD_PIXELFORMAT DIALOG DISCARDABLE  0, 0, 144, 78
 STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "RfbPlayer : Pixel Format"
 FONT 8, "MS Sans Serif"
 BEGIN
     COMBOBOX        IDC_PIXELFORMAT,7,20,130,98,CBS_DROPDOWNLIST | 
                     WS_VSCROLL | WS_TABSTOP
-    DEFPUSHBUTTON   "OK",IDOK,20,40,50,14
-    PUSHBUTTON      "Cancel",IDCANCEL,75,40,50,14
+    DEFPUSHBUTTON   "OK",IDOK,20,57,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,75,57,50,14
     LTEXT           "Choose the pixel format:",IDC_STATIC,7,7,130,13
+    CONTROL         "Big endian flag",IDC_BIG_ENDIAN,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,7,40,63,12
 END
 
 IDD_OPTIONS DIALOG DISCARDABLE  0, 0, 187, 194
@@ -285,11 +287,13 @@
         VERTGUIDE, 75
         VERTGUIDE, 125
         TOPMARGIN, 7
-        BOTTOMMARGIN, 55
+        BOTTOMMARGIN, 71
         HORZGUIDE, 7
         HORZGUIDE, 20
         HORZGUIDE, 35
         HORZGUIDE, 40
+        HORZGUIDE, 49
+        HORZGUIDE, 57
     END
 
     IDD_OPTIONS, DIALOG