Added UserPixelFormatsDialog.
It allows user to define the user pixel formats.
Now "Edit User PF" button on Options Dialog is working.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@267 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfbplayer/OptionsDialog.h b/rfbplayer/OptionsDialog.h
index a0ac388..5ca67af 100644
--- a/rfbplayer/OptionsDialog.h
+++ b/rfbplayer/OptionsDialog.h
@@ -18,9 +18,8 @@
 
 // -=- OptionsDialog.h
 
-#include <rfb_win32/Dialog.h>
-
 #include <rfbplayer/PlayerOptions.h>
+#include <rfbplayer/UserPixelFormatsDialog.h>
 
 class OptionsDialog : public rfb::win32::Dialog {
 public:
@@ -89,6 +88,10 @@
       setItemChecked(IDC_AUTOPLAY, DEFAULT_AUTOPLAY);
       setItemChecked(IDC_BIG_ENDIAN, DEFAULT_BIG_ENDIAN);
     }
+    if (item == IDC_EDIT_UPF) {
+      UserPixelFormatsDialog UpfListDialog(supportedPF);
+      UpfListDialog.showDialog(handle);
+    }
     return false;
   }
 
diff --git a/rfbplayer/UserPixelFormatsDialog.h b/rfbplayer/UserPixelFormatsDialog.h
new file mode 100644
index 0000000..e3d1aa3
--- /dev/null
+++ b/rfbplayer/UserPixelFormatsDialog.h
@@ -0,0 +1,59 @@
+/* Copyright (C) 2004 TightVNC Team.  All Rights Reserved.
+ *    
+ * This is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This software 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 General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this software; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
+ * USA.
+ */
+
+// -=- UserPixelFormatsDialog.h
+
+#include <rfb_win32/Dialog.h>
+
+class UserPixelFormatsDialog : public rfb::win32::Dialog {
+public:
+  UserPixelFormatsDialog(PixelFormatList *_supportedPF) 
+  : Dialog(GetModuleHandle(0)), supportedPF(_supportedPF), pfList(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_USERPF_LIST), parent);
+  }
+
+protected:
+  // Dialog methods (protected)
+  virtual void initDialog() {
+    pfList = GetDlgItem(handle, IDC_PF_LIST);
+    for (int i = supportedPF->getDefaultPFCount(); i < supportedPF->count(); i++) {
+      SendMessage(pfList, LB_ADDSTRING, 
+        0, (LPARAM)(LPCTSTR)(((*supportedPF)[i]).format_name));
+    }
+    SendMessage(pfList, LB_SETCURSEL, 0, 0);
+  }
+  virtual bool onCommand(int item, int cmd) { 
+    switch (item) {
+    case IDC_ADD_BUTTON:
+      break;
+    case IDC_REMOVE_BUTTON:
+      break;
+    case IDC_EDIT_BUTTON:
+      break;
+    default:
+      break;
+    }
+    return false;
+  }
+
+  HWND pfList;
+  PixelFormatList *supportedPF;
+};
\ No newline at end of file
diff --git a/rfbplayer/resource.h b/rfbplayer/resource.h
index db4d278..ca4901b 100644
--- a/rfbplayer/resource.h
+++ b/rfbplayer/resource.h
@@ -10,6 +10,7 @@
 #define IDD_PIXELFORMAT                 134
 #define IDD_OPTIONS                     137
 #define IDD_ABOUT                       138
+#define IDD_USERPF_LIST                 139
 #define IDC_GOTO_EDIT                   1003
 #define IDC_PIXELFORMAT                 1004
 #define IDC_ASK_PF                      1006
@@ -22,6 +23,10 @@
 #define IDC_AUTOPLAY                    1012
 #define IDC_BIG_ENDIAN                  1013
 #define IDC_EDIT_UPF                    1015
+#define IDC_PF_LIST                     1016
+#define IDC_ADD_BUTTON                  1017
+#define IDC_REMOVE_BUTTON               1018
+#define IDC_EDIT_BUTTON                 1019
 #define IDC_COPYRIGHT                   1021
 #define IDC_DESCRIPTION                 1022
 #define ID_OPENFILE                     40011
@@ -48,9 +53,9 @@
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        139
+#define _APS_NEXT_RESOURCE_VALUE        140
 #define _APS_NEXT_COMMAND_VALUE         40045
-#define _APS_NEXT_CONTROL_VALUE         1016
+#define _APS_NEXT_CONTROL_VALUE         1021
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
diff --git a/rfbplayer/rfbplayer.dsp b/rfbplayer/rfbplayer.dsp
index 469d171..e324905 100644
--- a/rfbplayer/rfbplayer.dsp
+++ b/rfbplayer/rfbplayer.dsp
@@ -174,6 +174,10 @@
 

 SOURCE=.\ToolBar.h

 # End Source File

+# Begin Source File

+

+SOURCE=.\UserPixelFormatsDialog.h

+# End Source File

 # End Group

 # Begin Group "Resource Files"

 

diff --git a/rfbplayer/rfbplayer.rc b/rfbplayer/rfbplayer.rc
index 8e615d4..55b4f3f 100644
--- a/rfbplayer/rfbplayer.rc
+++ b/rfbplayer/rfbplayer.rc
@@ -271,6 +271,19 @@
                     IDC_STATIC,40,55,202,15
 END
 
+IDD_USERPF_LIST DIALOG DISCARDABLE  0, 0, 207, 162
+STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Add / Remove the user pixel formats"
+FONT 8, "MS Sans Serif"
+BEGIN
+    LISTBOX         IDC_PF_LIST,7,7,136,148,LBS_NOINTEGRALHEIGHT | 
+                    WS_VSCROLL | WS_TABSTOP
+    PUSHBUTTON      "Add",IDC_ADD_BUTTON,150,7,50,14
+    PUSHBUTTON      "Remove",IDC_REMOVE_BUTTON,150,26,50,14
+    PUSHBUTTON      "Edit",IDC_EDIT_BUTTON,150,45,50,14
+    PUSHBUTTON      "Close",IDOK,150,64,50,14
+END
+
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -339,6 +352,20 @@
         HORZGUIDE, 169
         HORZGUIDE, 174
     END
+
+    IDD_USERPF_LIST, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 200
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 155
+        HORZGUIDE, 21
+        HORZGUIDE, 26
+        HORZGUIDE, 40
+        HORZGUIDE, 45
+        HORZGUIDE, 59
+        HORZGUIDE, 64
+    END
 END
 #endif    // APSTUDIO_INVOKED