Added Go to Pos dialog implementation.
Implemented "Go To... Ctrl+G" menu point.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@158 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfbplayer/GotoPosDialog.h b/rfbplayer/GotoPosDialog.h
new file mode 100644
index 0000000..6758be2
--- /dev/null
+++ b/rfbplayer/GotoPosDialog.h
@@ -0,0 +1,44 @@
+/* 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.
+ */
+
+// -=- GotoPosDialog.h
+
+#include <rfb_win32/Dialog.h>
+
+class GotoPosDialog : public rfb::win32::Dialog {
+public:
+  GotoPosDialog() : Dialog(GetModuleHandle(0)) {}
+  // - Show the dialog and return true if OK was clicked,
+  //   false in case of error or Cancel
+  virtual bool showDialog() {
+    return Dialog::showDialog(MAKEINTRESOURCE(IDD_GOTO));
+  }
+  const long getPos() const {return pos;}
+protected:
+
+  // Dialog methods (protected)
+  virtual void initDialog() {
+    setItemString(IDC_GOTO_EDIT, rfb::TStr("0"));
+  }
+  virtual bool onOk() {
+    pos = atol(rfb::CStr(getItemString(IDC_GOTO_EDIT)));
+    return true;
+  }
+
+  long pos;
+};
\ No newline at end of file
diff --git a/rfbplayer/rfbplayer.cxx b/rfbplayer/rfbplayer.cxx
index 1531b2b..5cddf85 100644
--- a/rfbplayer/rfbplayer.cxx
+++ b/rfbplayer/rfbplayer.cxx
@@ -28,6 +28,7 @@
 #include <rfbplayer/rfbplayer.h>
 #include <rfbplayer/utils.h>
 #include <rfbplayer/resource.h>
+#include <rfbplayer/GotoPosDialog.h>
 
 using namespace rfb;
 using namespace rfb::win32;
@@ -324,6 +325,15 @@
         setPaused(true);
       }
       break;
+    case ID_GOTO:
+      {
+        GotoPosDialog gotoPosDlg;
+        if (gotoPosDlg.showDialog()) {
+          setPos(gotoPosDlg.getPos());
+          updatePos(getTimeOffset());
+        }
+      }
+      break;
     case ID_FULLSCREEN:
       MessageBox(getMainHandle(), "It is not working yet!", "RfbPlayer", MB_OK);
       break;
diff --git a/rfbplayer/rfbplayer.dsp b/rfbplayer/rfbplayer.dsp
index 57d165e..571fce2 100644
--- a/rfbplayer/rfbplayer.dsp
+++ b/rfbplayer/rfbplayer.dsp
@@ -128,6 +128,10 @@
 # End Source File

 # Begin Source File

 

+SOURCE=.\GotoPosDialog.h

+# End Source File

+# Begin Source File

+

 SOURCE=.\rfbplayer.h

 # End Source File

 # Begin Source File

diff --git a/rfbplayer/rfbplayer.h b/rfbplayer/rfbplayer.h
index cda3cc9..da482b5 100644
--- a/rfbplayer/rfbplayer.h
+++ b/rfbplayer/rfbplayer.h
@@ -23,7 +23,6 @@
 
 #include <rfb_win32/DIBSectionBuffer.h>
 
-//#include <rfbplayer/RfbProto.h>
 #include <rfbplayer/ToolBar.h>
 #include <rfbplayer/rfbSessionReader.h>
 
diff --git a/rfbplayer/rfbplayer.rc b/rfbplayer/rfbplayer.rc
index f6bf4db..0e33f33 100644
--- a/rfbplayer/rfbplayer.rc
+++ b/rfbplayer/rfbplayer.rc
@@ -201,13 +201,13 @@
 //
 
 IDD_GOTO DIALOG DISCARDABLE  0, 0, 153, 54
-STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "RfbPlayer : Go to position"
 FONT 8, "MS Sans Serif"
 BEGIN
+    EDITTEXT        IDC_GOTO_EDIT,40,9,106,14,ES_AUTOHSCROLL
     DEFPUSHBUTTON   "OK",IDOK,40,33,50,14
     PUSHBUTTON      "Cancel",IDCANCEL,95,33,51,14
-    EDITTEXT        IDC_GOTO_EDIT,40,9,106,14,ES_AUTOHSCROLL
     LTEXT           "Pos (ms):",IDC_STATIC,7,9,33,15,SS_CENTERIMAGE
 END