]> source.dussan.org Git - tigervnc.git/commitdiff
Added big-endian-flag option to the ChoosePixelFormatDialog dialog.
authorgeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>
Sun, 20 Mar 2005 12:52:46 +0000 (12:52 +0000)
committergeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>
Sun, 20 Mar 2005 12:52:46 +0000 (12:52 +0000)
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

rfbplayer/ChoosePixelFormatDialog.h
rfbplayer/resource.h
rfbplayer/rfbplayer.cxx
rfbplayer/rfbplayer.rc

index 6e063bde3071406b29c04107b4f7bdb2638f435a..8a3de45766e084d9711322450a5eac45b2a37cb3 100644 (file)
 
 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 @@ protected:
         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
index 8dd870781c0dd2bbca62cd393bf14cc2e44c460c..52e171acdd0ae520e69aa562bbd245fe63258ab8 100644 (file)
@@ -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
index a98ed41717b191b1ef63a43d6a2b154e7387924b..9a181a54d9c0baec39f37923712e74418220984c 100644 (file)
@@ -877,6 +877,9 @@ void RfbPlayer::processMsg() {
   }
 }
 
+long ChoosePixelFormatDialog::pfIndex = DEFAULT_PF_INDEX;
+bool ChoosePixelFormatDialog::bigEndian = false;
+
 void RfbPlayer::serverInit() {
   RfbProto::serverInit();
 
@@ -891,17 +894,17 @@ void RfbPlayer::serverInit() {
     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 @@ void RfbPlayer::serverInit() {
       options.setPF((PixelFormat *)&cp.pf());
     } else {
       options.setPF(&supportedPF[options.pixelFormatIndex].PF);
+      options.pixelFormat.bigEndian = options.bigEndianFlag;
     }
   }
   cp.setPF(options.pixelFormat);
index 01d7a3233e70577ee8b924670d7356ebf3acd443..474fb1d4bb51298a63af1cac8cb85283581e22ce 100644 (file)
@@ -211,16 +211,18 @@ BEGIN
     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 @@ BEGIN
         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