From b6d87aa651fa5b06c03eb42f291f398233ff8a15 Mon Sep 17 00:00:00 2001 From: george82 Date: Mon, 11 Sep 2006 07:00:59 +0000 Subject: [PATCH] Added implementation of the ZOOM IN and ZOOM OUT vncviewer toolbar buttons. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@660 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- win/vncviewer/CConn.cxx | 26 +++++++++++++++++++++++++- win/vncviewer/DesktopWindow.h | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/win/vncviewer/CConn.cxx b/win/vncviewer/CConn.cxx index ccf80f36..388014ff 100644 --- a/win/vncviewer/CConn.cxx +++ b/win/vncviewer/CConn.cxx @@ -62,6 +62,9 @@ const int IDM_AUTO_SIZE = ID_AUTO_SIZE; static IntParameter debugDelay("DebugDelay","Milliseconds to display inverted " "pixel data - a debugging feature", 0); +const int scaleValues[9] = {10, 25, 50, 75, 90, 100, 125, 150, 200}; +const int scaleCount = 9; + // // -=- CConn implementation @@ -187,8 +190,29 @@ CConn::sysCommand(WPARAM wParam, LPARAM lParam) { window->setFullscreen(options.fullScreen); return true; case IDM_ZOOM_IN: - return true; case IDM_ZOOM_OUT: + { + if (options.autoScaling) { + options.scale = window->getDesktopScale(); + options.autoScaling = false; + window->setAutoScaling(false); + } + if (wParam == IDM_ZOOM_IN) { + for (int i = 0; i < scaleCount; i++) + if (options.scale < scaleValues[i]) { + options.scale = scaleValues[i]; + break; + } + } else { + for (int i = scaleCount-1; i >= 0; i--) + if (options.scale > scaleValues[i]) { + options.scale = scaleValues[i]; + break; + } + } + if (options.scale != window->getDesktopScale()) + window->setDesktopScale(options.scale); + } return true; case IDM_ACTUAL_SIZE: if (options.autoScaling) { diff --git a/win/vncviewer/DesktopWindow.h b/win/vncviewer/DesktopWindow.h index c24b0ced..8e82083e 100644 --- a/win/vncviewer/DesktopWindow.h +++ b/win/vncviewer/DesktopWindow.h @@ -88,6 +88,7 @@ namespace rfb { } bool isAutoScaling() const { return autoScaling; } void setDesktopScale(int scale); + int getDesktopScale() const { return buffer->getScale(); } void fitBufferToWindow(bool repaint = true); // - Set the cursor to render when the pointer is within the desktop buffer -- 2.39.5