]> source.dussan.org Git - tigervnc.git/commitdiff
Added the SessionInfoDialog dialog, wich is used to show the session
authorgeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>
Wed, 13 Apr 2005 12:46:25 +0000 (12:46 +0000)
committergeorge82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519>
Wed, 13 Apr 2005 12:46:25 +0000 (12:46 +0000)
information.

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

rfbplayer/RfbProto.h
rfbplayer/SessionInfoDialog.h [new file with mode: 0644]
rfbplayer/resource.h
rfbplayer/rfbplayer.cxx
rfbplayer/rfbplayer.dsp
rfbplayer/rfbplayer.h
rfbplayer/rfbplayer.rc

index 613d742fe733f1a0dcf49e0e4936434f0d5111e1..316ea2694138eeaec89c8d0b768dc460d3ad1146 100644 (file)
@@ -59,7 +59,7 @@ class RfbProto : public CMsgHandler {
     virtual void framebufferUpdateEnd() {};
 
     FbsInputStream* is;
-    CMsgReader* reader;
+    CMsgReaderV3* reader;
     stateEnum state_;
 
   private:
diff --git a/rfbplayer/SessionInfoDialog.h b/rfbplayer/SessionInfoDialog.h
new file mode 100644 (file)
index 0000000..2c036db
--- /dev/null
@@ -0,0 +1,100 @@
+/* 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.
+ */
+
+// -=- SessionInfoDialog.h
+
+#include <math.h>
+
+#include <rfb/ConnParams.h>
+
+#include <rfb_win32/Dialog.h>
+
+#define log2(n) log(n) / 0.693147180559945
+
+int max3(int v1, int v2, int v3) {
+  return max(v1, max(v2, v3));
+}
+
+class SessionInfoDialog : public rfb::win32::Dialog {
+public:
+  SessionInfoDialog(ConnParams *_cp, int _currentEncoding) 
+    : Dialog(GetModuleHandle(0)), cp(_cp), currentEncoding(_currentEncoding) {}
+  // - Show the dialog and return true if OK was clicked,
+  //   false in case of error or Cancel
+  virtual bool showDialog(HWND parent = 0) {
+    return Dialog::showDialog(MAKEINTRESOURCE(IDD_SESSION_INFO), parent);
+  }
+protected:
+  // Dialog methods (protected)
+  virtual void initDialog() {
+    char strValue[255] = "\0";
+    setItemString(IDC_DESKTOP_NAME, cp->name());
+    
+    sprintf(strValue, "%ix%i", cp->width, cp->height);
+    setItemString(IDC_DESKTOP_SIZE, strValue);
+    
+    int r = cp->pf().redShift, g = cp->pf().greenShift, b = cp->pf().blueShift;
+    int i = 3;
+    char buffer[10];
+    sprintf(strValue, "depth %i(%ibpp), ", cp->pf().depth, cp->pf().bpp);
+    while (i) {
+      if (r == max3(r, g, b)) {
+        strcat(strValue, "r");
+        _itoa(ceil(log2(cp->pf().redMax)), buffer, 10);
+        strcat(strValue, buffer);
+        r = -1; 
+        i--;
+        continue;
+      } else if (g == max3(r, g, b)) {
+        strcat(strValue, "g");
+        _itoa(ceil(log2(cp->pf().greenMax)), buffer, 10);
+        strcat(strValue, buffer);
+        g = -1; 
+        i--;
+        continue;
+      } else if (b == max3(r, g, b)) {
+        strcat(strValue, "b");
+        _itoa(ceil(log2(cp->pf().blueMax)), buffer, 10);
+        strcat(strValue, buffer);
+        b = -1; 
+        i--;
+        continue;
+      } else break;
+    }
+    if (cp->pf().bigEndian) strcat(strValue, ", big-endian");
+    else strcat(strValue, ", little-endian");
+    setItemString(IDC_PIXEL_FORMAT, strValue);
+
+    switch (currentEncoding) {
+    case encodingRaw:      strcpy(strValue, "Raw");      break;
+    case encodingCopyRect: strcpy(strValue, "CopyRect"); break;
+    case encodingRRE:      strcpy(strValue, "RRE");      break;
+    case encodingCoRRE:    strcpy(strValue, "CoRRE");    break;
+    case encodingHextile:  strcpy(strValue, "Hextile");  break;
+    case encodingTight:    strcpy(strValue, "Tight");    break;
+    case encodingZRLE:     strcpy(strValue, "ZRLE");     break;
+    default:               strcpy(strValue, "Unknown");
+    }
+    setItemString(IDC_CURRENT_ENCODING, strValue);
+
+    sprintf(strValue, "%i.%i", cp->majorVersion, cp->minorVersion);
+    setItemString(IDC_VERSION, strValue);
+  }
+  ConnParams *cp;
+  int currentEncoding;
+};
\ No newline at end of file
index 42978577c727b057f83bac1c0cf9e67c00827a16..90a057fe350c9952edd189f5437f68570b1482a1 100644 (file)
@@ -13,6 +13,7 @@
 #define IDD_USERPF_LIST                 139
 #define IDD_UPF_EDIT                    140
 #define IDD_INFO                        141
+#define IDD_SESSION_INFO                142
 #define IDC_GOTO_EDIT                   1003
 #define IDC_PIXELFORMAT                 1004
 #define IDC_ASK_PF                      1006
 #define IDC_GREENMAX_EDIT               1024
 #define IDC_BLUEMAX_EDIT                1025
 #define IDC_REDSHIFT_EDIT               1026
+#define IDC_DESKTOP_NAME                1026
 #define IDC_GREENSHIFT_EDIT             1027
+#define IDC_DESKTOP_SIZE                1027
 #define IDC_BLUESHIFT_EDIT              1028
+#define IDC_CURRENT_ENCODING            1029
+#define IDC_PIXEL_FORMAT                1030
 #define IDC_INFO_EDIT                   1076
 #define ID_OPENFILE                     40011
 #define ID_CLOSEFILE                    40012
 #define ID_ABOUT                        40027
 #define ID_OPTIONS                      40029
 #define ID_RETURN                       40044
+#define ID_SESSION_INFO                 40045
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        142
-#define _APS_NEXT_COMMAND_VALUE         40045
+#define _APS_NEXT_RESOURCE_VALUE        143
+#define _APS_NEXT_COMMAND_VALUE         40046
 #define _APS_NEXT_CONTROL_VALUE         1031
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
index b5e319c4fbe02c2d9d6e8c16375ab87fcfac2394..552da3de5e42e7672c251b2faf83fb139b7af92a 100644 (file)
@@ -237,7 +237,8 @@ RfbPlayer::RfbPlayer(char *_fileName, PlayerOptions *_options)
   window_size(0, 0, 32, 32), cutText(0), seekMode(false), lastPos(0), 
   timeStatic(0), speedEdit(0), posTrackBar(0), speedUpDown(0), 
   rfbReader(0), sessionTimeMs(0), sliderDraging(false), sliderStepMs(0), 
-  imageDataStartTime(0), rewindFlag(false), stopped(false) {
+  imageDataStartTime(0), rewindFlag(false), stopped(false), 
+  currentEncoding(-1) {
 
   // Save the player options
   memcpy(&options, _options, sizeof(options));
@@ -343,6 +344,12 @@ RfbPlayer::processMainMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
     case ID_CLOSEFILE:
       closeSessionFile();
       break;
+    case ID_SESSION_INFO:
+      {
+        SessionInfoDialog sessionInfo(&cp, currentEncoding);
+        sessionInfo.showDialog(getMainHandle());
+      }
+      break;
     case ID_PLAY:
       setPaused(false);
       break;
@@ -676,6 +683,7 @@ void RfbPlayer::createToolBar(HWND parentHwnd) {
 void RfbPlayer::disableTBandMenuItems() {
   // Disable the menu items
   EnableMenuItem(hMenu, ID_CLOSEFILE, MF_GRAYED | MF_BYCOMMAND);
+  EnableMenuItem(hMenu, ID_SESSION_INFO, MF_GRAYED | MF_BYCOMMAND);
   ///EnableMenuItem(hMenu, ID_FULLSCREEN, MF_GRAYED | MF_BYCOMMAND);
   ///EnableMenuItem(GetSubMenu(hMenu, 1), 1, MF_GRAYED | MF_BYPOSITION);
   EnableMenuItem(hMenu, ID_PLAYPAUSE, MF_GRAYED | MF_BYCOMMAND);
@@ -698,6 +706,7 @@ void RfbPlayer::disableTBandMenuItems() {
 void RfbPlayer::enableTBandMenuItems() {
   // Enable the menu items
   EnableMenuItem(hMenu, ID_CLOSEFILE, MF_ENABLED | MF_BYCOMMAND);
+  EnableMenuItem(hMenu, ID_SESSION_INFO, MF_ENABLED | MF_BYCOMMAND);
   ///EnableMenuItem(hMenu, ID_FULLSCREEN, MF_ENABLED | MF_BYCOMMAND);
   ///EnableMenuItem(GetSubMenu(hMenu, 1), 1, MF_ENABLED | MF_BYPOSITION);
   EnableMenuItem(hMenu, ID_PLAYPAUSE, MF_ENABLED | MF_BYCOMMAND);
@@ -1005,6 +1014,7 @@ void RfbPlayer::frameBufferUpdateEnd() {
 };
 
 void RfbPlayer::beginRect(const Rect& r, unsigned int encoding) {
+  currentEncoding = encoding;
 }
 
 void RfbPlayer::endRect(const Rect& r, unsigned int encoding) {
index ea43f262c5e7f56de74022f8cab249c7c5ea411c..f9debec4aa1f98089b30536d40a8ff4ea4839bb8 100644 (file)
@@ -180,6 +180,10 @@ SOURCE=.\rfbSessionReader.h
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=.\SessionInfoDialog.h\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=.\ToolBar.h\r
 # End Source File\r
 # Begin Source File\r
index e92a44e07b0386ec074de4b2769bb9e87a895a89..ec4eef04cec309472547e46deeffaac13551deee 100644 (file)
@@ -31,6 +31,7 @@
 #include <rfbplayer/ChoosePixelFormatDialog.h>
 #include <rfbplayer/OptionsDialog.h>
 #include <rfbplayer/InfoDialog.h>
+#include <rfbplayer/SessionInfoDialog.h>
 
 using namespace rfb;
 using namespace rfb::win32;
@@ -182,6 +183,7 @@ class RfbPlayer : public RfbProto {
     PixelFormatList supportedPF;
     long imageDataStartTime;
     long sessionTimeMs;
+    int currentEncoding;
 };
 
 // -=- sessionTerminateThread class
index ebeb5211c63595481c9373cb2f0636ff9ced3afb..10b660c482dce5560535851f8dfc05394f2e9aaf 100644 (file)
@@ -126,6 +126,8 @@ BEGIN
         MENUITEM "Open File...\tCtrl+O",        ID_OPENFILE
         MENUITEM "Close File...\tCtrl+Q",       ID_CLOSEFILE
         MENUITEM SEPARATOR
+        MENUITEM "Info...\tCtrl+I",             ID_SESSION_INFO
+        MENUITEM SEPARATOR
         MENUITEM "Exit\tAlt+X",                 ID_EXIT
     END
     POPUP "Play"
@@ -158,6 +160,7 @@ BEGIN
     "C",            ID_COPYTOCLIPBOARD,     VIRTKEY, CONTROL, NOINVERT
     "C",            ID_FRAMEEXTRACT,        VIRTKEY, ALT, NOINVERT
     "G",            ID_GOTO,                VIRTKEY, CONTROL, NOINVERT
+    "I",            ID_SESSION_INFO,        VIRTKEY, CONTROL, NOINVERT
     "L",            ID_LOOP,                VIRTKEY, CONTROL, NOINVERT
     "O",            ID_OPENFILE,            VIRTKEY, CONTROL, NOINVERT
     "P",            ID_OPTIONS,             VIRTKEY, CONTROL, NOINVERT
@@ -310,6 +313,24 @@ BEGIN
                     WS_VSCROLL | WS_HSCROLL
 END
 
+IDD_SESSION_INFO DIALOG DISCARDABLE  0, 0, 239, 106
+STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "RFB Session Info"
+FONT 8, "MS Sans Serif"
+BEGIN
+    DEFPUSHBUTTON   "OK",IDOK,182,85,50,14
+    LTEXT           "Desktop Name:",IDC_STATIC,7,10,73,15
+    LTEXT           "Desktop Size:",IDC_STATIC,7,25,73,15
+    LTEXT           "Pixel Format:",IDC_STATIC,7,40,73,15
+    LTEXT           "Current Encoding:",IDC_STATIC,7,55,73,15
+    LTEXT           "RFB Protocol Version:",IDC_STATIC,7,70,73,15
+    LTEXT           "",IDC_DESKTOP_NAME,80,10,152,15
+    LTEXT           "",IDC_DESKTOP_SIZE,80,25,152,15
+    LTEXT           "",IDC_CURRENT_ENCODING,80,55,152,15
+    LTEXT           "",IDC_VERSION,80,70,152,15
+    LTEXT           "",IDC_PIXEL_FORMAT,80,40,152,15
+END
+
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -409,6 +430,20 @@ BEGIN
         TOPMARGIN, 7
         BOTTOMMARGIN, 200
     END
+
+    IDD_SESSION_INFO, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 232
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 99
+        HORZGUIDE, 10
+        HORZGUIDE, 25
+        HORZGUIDE, 40
+        HORZGUIDE, 55
+        HORZGUIDE, 70
+        HORZGUIDE, 85
+    END
 END
 #endif    // APSTUDIO_INVOKED