From 04a777102b0108d8d741b23479b13f525fef17d8 Mon Sep 17 00:00:00 2001 From: george82 Date: Mon, 29 May 2006 14:18:14 +0000 Subject: [PATCH] Implemented scaling interface of the local copy of remote desktop. Now it support only true color the pixel data. AutoScaling is not working yet. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@601 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- win/vncviewer/CConn.cxx | 1 + win/vncviewer/DesktopWindow.cxx | 6 ++++++ win/vncviewer/DesktopWindow.h | 1 + win/vncviewer/OptionsDialog.cxx | 20 +++++++++++++++++++- 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/win/vncviewer/CConn.cxx b/win/vncviewer/CConn.cxx index 73597f52..bfac4768 100644 --- a/win/vncviewer/CConn.cxx +++ b/win/vncviewer/CConn.cxx @@ -150,6 +150,7 @@ CConn::applyOptions(CConnOptions& opt) { window->setMenuKey(options.menuKey); window->setDisableWinKeys(options.disableWinKeys); window->setShowToolbar(options.showToolbar); + window->setDesktopScale(options.scale); if (!options.useLocalCursor) window->setCursor(0, 0, Point(), 0, 0); } diff --git a/win/vncviewer/DesktopWindow.cxx b/win/vncviewer/DesktopWindow.cxx index fce795ba..55000252 100644 --- a/win/vncviewer/DesktopWindow.cxx +++ b/win/vncviewer/DesktopWindow.cxx @@ -929,6 +929,12 @@ DesktopWindow::setSize(int w, int h) { calculateScrollBars(); } +void DesktopWindow::setDesktopScale(int scale) { + buffer->setScale(scale); + InvalidateRect(frameHandle, 0, FALSE); + calculateScrollBars(); +} + void DesktopWindow::setCursor(int w, int h, const Point& hotspot, void* data, void* mask) { hideLocalCursor(); diff --git a/win/vncviewer/DesktopWindow.h b/win/vncviewer/DesktopWindow.h index 8511eb44..f471fccb 100644 --- a/win/vncviewer/DesktopWindow.h +++ b/win/vncviewer/DesktopWindow.h @@ -82,6 +82,7 @@ namespace rfb { PixelFormat getPF() const { return buffer->getPF(); } void setSize(int w, int h); void setColour(int i, int r, int g, int b) {buffer->setColour(i, r, g, b);} + void setDesktopScale(int scale); // - Set the cursor to render when the pointer is within the desktop buffer void setCursor(int w, int h, const Point& hotspot, void* data, void* mask); diff --git a/win/vncviewer/OptionsDialog.cxx b/win/vncviewer/OptionsDialog.cxx index 5bb21fd9..af112ee7 100644 --- a/win/vncviewer/OptionsDialog.cxx +++ b/win/vncviewer/OptionsDialog.cxx @@ -171,7 +171,11 @@ public: SendMessage(hScaleCombo, CB_INSERTSTRING, (WPARAM)i, (LPARAM)(int FAR*)scale_values[i]); } - SetDlgItemText(handle, IDC_COMBO_SCALE, "100"); + if (dlg->options.autoScaling) { + SetDlgItemText(handle, IDC_COMBO_SCALE, "Auto"); + } else { + SetDlgItemInt(handle, IDC_COMBO_SCALE, dlg->options.scale, FALSE); + } } virtual bool onOk() { dlg->options.shared = isItemChecked(IDC_CONN_SHARED); @@ -182,6 +186,20 @@ public: dlg->options.acceptBell = isItemChecked(IDC_ACCEPT_BELL); dlg->options.autoReconnect = isItemChecked(IDC_AUTO_RECONNECT); dlg->options.showToolbar = isItemChecked(IDC_SHOW_TOOLBAR); + int s = GetDlgItemInt(handle, IDC_COMBO_SCALE, NULL, FALSE); + if (s > 0) { + dlg->options.scale = s; + dlg->options.autoScaling = false; + if (s == 100) dlg->options.scaling = false; + else dlg->options.scaling = true; + } else { + char scaleStr[20]; + GetDlgItemText(handle, IDC_COMBO_SCALE, scaleStr, 20); + if (strcmp(scaleStr, "Auto") == 0) { + dlg->options.autoScaling = true; + dlg->options.scaling = true; + } + } ((ViewerOptions*)propSheet)->setChanged(); return true; } -- 2.39.5