diff options
author | george82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519> | 2005-04-13 12:46:25 +0000 |
---|---|---|
committer | george82 <george82@3789f03b-4d11-0410-bbf8-ca57d06f2519> | 2005-04-13 12:46:25 +0000 |
commit | 26af76586ace1dd4c85d0e2155cf3c8c7c124213 (patch) | |
tree | ff5f3d58dfc0f1244e6544651773bbf11328065b | |
parent | 5513d5c5d46973e59e6949dd100c9fed0c6f401e (diff) | |
download | tigervnc-26af76586ace1dd4c85d0e2155cf3c8c7c124213.tar.gz tigervnc-26af76586ace1dd4c85d0e2155cf3c8c7c124213.zip |
Added the SessionInfoDialog dialog, wich is used to show the session
information.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@286 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r-- | rfbplayer/RfbProto.h | 2 | ||||
-rw-r--r-- | rfbplayer/SessionInfoDialog.h | 100 | ||||
-rw-r--r-- | rfbplayer/resource.h | 10 | ||||
-rw-r--r-- | rfbplayer/rfbplayer.cxx | 12 | ||||
-rw-r--r-- | rfbplayer/rfbplayer.dsp | 4 | ||||
-rw-r--r-- | rfbplayer/rfbplayer.h | 2 | ||||
-rw-r--r-- | rfbplayer/rfbplayer.rc | 35 |
7 files changed, 161 insertions, 4 deletions
diff --git a/rfbplayer/RfbProto.h b/rfbplayer/RfbProto.h index 613d742f..316ea269 100644 --- a/rfbplayer/RfbProto.h +++ b/rfbplayer/RfbProto.h @@ -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 index 00000000..2c036db0 --- /dev/null +++ b/rfbplayer/SessionInfoDialog.h @@ -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 diff --git a/rfbplayer/resource.h b/rfbplayer/resource.h index 42978577..90a057fe 100644 --- a/rfbplayer/resource.h +++ b/rfbplayer/resource.h @@ -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 @@ -39,8 +40,12 @@ #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 @@ -62,13 +67,14 @@ #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 diff --git a/rfbplayer/rfbplayer.cxx b/rfbplayer/rfbplayer.cxx index b5e319c4..552da3de 100644 --- a/rfbplayer/rfbplayer.cxx +++ b/rfbplayer/rfbplayer.cxx @@ -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) { diff --git a/rfbplayer/rfbplayer.dsp b/rfbplayer/rfbplayer.dsp index ea43f262..f9debec4 100644 --- a/rfbplayer/rfbplayer.dsp +++ b/rfbplayer/rfbplayer.dsp @@ -180,6 +180,10 @@ SOURCE=.\rfbSessionReader.h # End Source File
# Begin Source File
+SOURCE=.\SessionInfoDialog.h
+# End Source File
+# Begin Source File
+
SOURCE=.\ToolBar.h
# End Source File
# Begin Source File
diff --git a/rfbplayer/rfbplayer.h b/rfbplayer/rfbplayer.h index e92a44e0..ec4eef04 100644 --- a/rfbplayer/rfbplayer.h +++ b/rfbplayer/rfbplayer.h @@ -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 diff --git a/rfbplayer/rfbplayer.rc b/rfbplayer/rfbplayer.rc index ebeb5211..10b660c4 100644 --- a/rfbplayer/rfbplayer.rc +++ b/rfbplayer/rfbplayer.rc @@ -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 |