📄 vncoptions.cpp
字号:
EnableWindow(hAllowJpeg, ((_this->m_PreferredEncoding == rfbEncodingTight) && !_this->m_Use8Bit));
HWND hCompressLevel = GetDlgItem(hwnd, IDC_COMPRESSLEVEL);
SendMessage(hCompressLevel, TBM_SETRANGE, TRUE, (LPARAM) MAKELONG(1, 9));
SendMessage(hCompressLevel, TBM_SETPOS, TRUE, _this->m_compressLevel);
SetDlgItemInt(hwnd, IDC_STATIC_LEVEL, _this->m_compressLevel, FALSE);
_this->EnableCompress(hwnd, (((_this->m_PreferredEncoding == rfbEncodingTight)||
(_this->m_PreferredEncoding == rfbEncodingZlib) ||
(_this->m_PreferredEncoding == rfbEncodingZlibHex)) && _this->m_useCompressLevel));
HWND hJpeg = GetDlgItem(hwnd, IDC_QUALITYLEVEL);
SendMessage(hJpeg, TBM_SETRANGE, TRUE, (LPARAM) MAKELONG(1, 9));
SendMessage(hJpeg, TBM_SETPOS, TRUE, _this->m_jpegQualityLevel);
SetDlgItemInt(hwnd, IDC_STATIC_QUALITY, _this->m_jpegQualityLevel, FALSE);
_this->EnableJpeg(hwnd, ((_this->m_PreferredEncoding == rfbEncodingTight) &&
_this->m_enableJpegCompression) && !_this->m_Use8Bit);
HWND hRemoteCursor;
if (_this->m_requestShapeUpdates && !_this->m_ignoreShapeUpdates) {
hRemoteCursor = GetDlgItem(hwnd, IDC_CSHAPE_ENABLE_RADIO);
} else if (_this->m_requestShapeUpdates) {
hRemoteCursor = GetDlgItem(hwnd, IDC_CSHAPE_IGNORE_RADIO);
} else {
hRemoteCursor = GetDlgItem(hwnd, IDC_CSHAPE_DISABLE_RADIO);
}
SendMessage(hRemoteCursor, BM_SETCHECK, true, 0);
return TRUE;
}
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_SCALE_EDIT:
switch (HIWORD(wParam)) {
case CBN_KILLFOCUS:
Lim(hwnd, IDC_SCALE_EDIT, 1, 150);
return 0;
}
return 0;
case IDC_ALLOW_COMPRESSLEVEL:
switch (HIWORD(wParam)) {
case BN_CLICKED:
HWND hAllowCompressLevel = GetDlgItem(hwnd, IDC_ALLOW_COMPRESSLEVEL);
if (SendMessage(hAllowCompressLevel, BM_GETCHECK, 0, 0) == 0) {
_this->EnableCompress(hwnd, TRUE);
SendMessage(hAllowCompressLevel, BM_SETCHECK, TRUE, 0);
} else {
_this->EnableCompress(hwnd, FALSE);
SendMessage(hAllowCompressLevel, BM_SETCHECK, FALSE, 0);
}
return 0;
}
return 0;
case IDC_ALLOW_JPEG:
switch (HIWORD(wParam)) {
case BN_CLICKED:
HWND hAllowJpeg = GetDlgItem(hwnd, IDC_ALLOW_JPEG);
if (SendMessage(hAllowJpeg, BM_GETCHECK, 0, 0) == 0) {
_this->EnableJpeg(hwnd, TRUE);
SendMessage(hAllowJpeg, BM_SETCHECK, TRUE, 0);
} else {
_this->EnableJpeg(hwnd, FALSE);
SendMessage(hAllowJpeg, BM_SETCHECK, FALSE, 0);
}
return 0;
}
return 0;
case IDC_8BITCHECK:
switch (HIWORD(wParam)) {
case BN_CLICKED:
HWND h8Bit = GetDlgItem(hwnd, IDC_8BITCHECK);
HWND hAllowJpeg = GetDlgItem(hwnd, IDC_ALLOW_JPEG);
HWND hListBox = GetDlgItem(hwnd, IDC_ENCODING);
int i = SendMessage(hListBox, CB_GETCURSEL, 0, 0);
if (SendMessage(h8Bit, BM_GETCHECK, 0, 0) != 0) {
if (i == 2) {
if (SendMessage(hAllowJpeg, BM_GETCHECK, 0, 0) != 0) {
_this->EnableJpeg(hwnd, TRUE);
}
EnableWindow(hAllowJpeg, TRUE);
}
SendMessage(h8Bit, BM_SETCHECK, FALSE, 0);
} else {
_this->EnableJpeg(hwnd, FALSE);
EnableWindow(hAllowJpeg, FALSE);
SendMessage(h8Bit, BM_SETCHECK, TRUE, 0);
}
return 0;
}
return 0;
case IDC_VIEWONLY:
switch (HIWORD(wParam)) {
case BN_CLICKED:
HWND hViewOnly = GetDlgItem(hwnd, IDC_VIEWONLY);
HWND hSwap = GetDlgItem(hwnd, ID_SESSION_SWAPMOUSE);
HWND hEmulate = GetDlgItem(hwnd, IDC_EMULATECHECK);
if (SendMessage(hViewOnly, BM_GETCHECK, 0, 0) == 0) {
EnableWindow( hSwap, FALSE);
EnableWindow( hEmulate, FALSE);
SendMessage(hViewOnly, BM_SETCHECK, TRUE, 0);
} else {
EnableWindow( hSwap, TRUE);
EnableWindow( hEmulate, TRUE);
SendMessage(hViewOnly, BM_SETCHECK, FALSE, 0);
}
return 0;
}
return 0;
case IDC_OK:
{
HWND hListBox = GetDlgItem(hwnd, IDC_ENCODING);
int i = SendMessage(hListBox, CB_GETCURSEL, 0, 0);
_this->m_PreferredEncoding = rfbcombo[i].rfbEncoding;
HWND hScalEdit = GetDlgItem(hwnd, IDC_SCALE_EDIT);
i = GetDlgItemInt(hwnd, IDC_SCALE_EDIT, NULL, FALSE);
if (i > 0) {
_this->m_scale_num = i;
_this->m_scale_den = 100;
_this->FixScaling();
_this->m_FitWindow = false;
_this->m_scaling = (_this->m_scale_num > 1) || (_this->m_scale_den > 1);
} else {
TCHAR buf[20];
GetDlgItemText(hwnd, IDC_SCALE_EDIT, buf, 20);
if (strcmp(buf, "Auto") == 0) {
_this->m_FitWindow = true;
_this->m_scaling = true;
} else {
_this->m_FitWindow = false;
}
}
HWND hCopyRect = GetDlgItem(hwnd, ID_SESSION_SET_CRECT);
_this->m_UseEnc[rfbEncodingCopyRect] =
(SendMessage(hCopyRect, BM_GETCHECK, 0, 0) == BST_CHECKED);
HWND hSwap = GetDlgItem(hwnd, ID_SESSION_SWAPMOUSE);
_this->m_SwapMouse =
(SendMessage(hSwap, BM_GETCHECK, 0, 0) == BST_CHECKED);
HWND hDeiconify = GetDlgItem(hwnd, IDC_BELLDEICONIFY);
_this->m_DeiconifyOnBell =
(SendMessage(hDeiconify, BM_GETCHECK, 0, 0) == BST_CHECKED);
#ifndef UNDER_CE
HWND hDisableClip = GetDlgItem(hwnd, IDC_DISABLECLIPBOARD);
_this->m_DisableClipboard =
(SendMessage(hDisableClip, BM_GETCHECK, 0, 0) == BST_CHECKED);
#endif
HWND h8bit = GetDlgItem(hwnd, IDC_8BITCHECK);
_this->m_Use8Bit =
(SendMessage(h8bit, BM_GETCHECK, 0, 0) == BST_CHECKED);
HWND hShared = GetDlgItem(hwnd, IDC_SHARED);
_this->m_Shared =
(SendMessage(hShared, BM_GETCHECK, 0, 0) == BST_CHECKED);
HWND hViewOnly = GetDlgItem(hwnd, IDC_VIEWONLY);
_this->m_ViewOnly =
(SendMessage(hViewOnly, BM_GETCHECK, 0, 0) == BST_CHECKED);
#ifndef UNDER_CE
HWND hFullScreen = GetDlgItem(hwnd, IDC_FULLSCREEN);
_this->m_FullScreen =
(SendMessage(hFullScreen, BM_GETCHECK, 0, 0) == BST_CHECKED);
HWND hEmulate = GetDlgItem(hwnd, IDC_EMULATECHECK);
_this->m_Emul3Buttons =
(SendMessage(hEmulate, BM_GETCHECK, 0, 0) == BST_CHECKED);
#endif
HWND hAllowCompressLevel = GetDlgItem(hwnd, IDC_ALLOW_COMPRESSLEVEL);
_this->m_useCompressLevel =
(SendMessage(hAllowCompressLevel, BM_GETCHECK, 0, 0) == BST_CHECKED);
HWND hCompressLevel = GetDlgItem(hwnd, IDC_COMPRESSLEVEL);
_this->m_compressLevel = SendMessage(hCompressLevel,TBM_GETPOS , 0, 0);
HWND hAllowJpeg = GetDlgItem(hwnd, IDC_ALLOW_JPEG);
_this->m_enableJpegCompression =
(SendMessage(hAllowJpeg, BM_GETCHECK, 0, 0) == BST_CHECKED);
HWND hJpeg = GetDlgItem(hwnd, IDC_QUALITYLEVEL);
_this->m_jpegQualityLevel = SendMessage(hJpeg,TBM_GETPOS , 0, 0);
_this->m_requestShapeUpdates = false;
_this->m_ignoreShapeUpdates = false;
HWND hRemoteCursor = GetDlgItem(hwnd, IDC_CSHAPE_ENABLE_RADIO);
if (SendMessage(hRemoteCursor, BM_GETCHECK, 0, 0) == BST_CHECKED) {
_this->m_requestShapeUpdates = true;
} else {
hRemoteCursor = GetDlgItem(hwnd, IDC_CSHAPE_IGNORE_RADIO);
if (SendMessage(hRemoteCursor, BM_GETCHECK, 0, 0) == BST_CHECKED) {
_this->m_requestShapeUpdates = true;
_this->m_ignoreShapeUpdates = true;
}
}
return 0;
}
case IDC_ENCODING:
switch (HIWORD(wParam)) {
case CBN_SELCHANGE:
{
HWND h8bit = GetDlgItem(hwnd, IDC_8BITCHECK);
HWND hAllowCompressLevel = GetDlgItem(hwnd, IDC_ALLOW_COMPRESSLEVEL);
HWND hAllowJpeg = GetDlgItem(hwnd, IDC_ALLOW_JPEG);
HWND hListBox = GetDlgItem(hwnd, IDC_ENCODING);
int i = SendMessage(hListBox ,CB_GETCURSEL, 0, 0);
switch (rfbcombo[i].rfbEncoding) {
case rfbEncodingTight:
if (SendMessage(h8bit, BM_GETCHECK, 0, 0) == 0) {
_this->EnableJpeg(hwnd, (SendMessage(hAllowJpeg,
BM_GETCHECK, 0, 0) == 1));
EnableWindow(hAllowJpeg, TRUE);
}
_this->EnableCompress(hwnd,(SendMessage(hAllowCompressLevel,
BM_GETCHECK,0,0) == 1));
EnableWindow(hAllowCompressLevel, TRUE);
break;
case rfbEncodingZlib:
case rfbEncodingZlibHex:
_this->EnableCompress(hwnd,
(SendMessage(hAllowCompressLevel, BM_GETCHECK, 0, 0) == 1));
EnableWindow(hAllowCompressLevel, TRUE);
_this->EnableJpeg(hwnd, FALSE);
EnableWindow(hAllowJpeg, FALSE);
break;
case rfbEncodingRRE:
case rfbEncodingCoRRE:
case rfbEncodingRaw:
case rfbEncodingHextile:
_this->EnableCompress(hwnd, FALSE);
EnableWindow(hAllowCompressLevel, FALSE);
_this->EnableJpeg(hwnd, FALSE);
EnableWindow(hAllowJpeg, FALSE);
break;
}
return 0;
}
}
return 0;
}
return 0;
case WM_HSCROLL:
{
DWORD dwPos ; // current position of slider
HWND hCompressLevel = GetDlgItem(hwnd, IDC_COMPRESSLEVEL);
HWND hJpeg = GetDlgItem(hwnd, IDC_QUALITYLEVEL);
if (HWND(lParam) == hCompressLevel) {
dwPos = SendMessage(hCompressLevel, TBM_GETPOS, 0, 0);
SetDlgItemInt(hwnd, IDC_STATIC_LEVEL, dwPos, FALSE);
}
if (HWND(lParam) == hJpeg) {
dwPos = SendMessage(hJpeg, TBM_GETPOS, 0, 0);
SetDlgItemInt(hwnd, IDC_STATIC_QUALITY, dwPos, FALSE);
}
return 0;
}
case WM_HELP:
help.Popup(lParam);
return 0;
}
return 0;
}
void VNCOptions::EnableCompress(HWND hwnd, bool enable)
{
HWND hfast = GetDlgItem(hwnd, IDC_STATIC_FAST);
HWND hlevel = GetDlgItem(hwnd, IDC_STATIC_LEVEL);
HWND htextlevel = GetDlgItem(hwnd, IDC_STATIC_TEXT_LEVEL);
HWND hbest = GetDlgItem(hwnd, IDC_STATIC_BEST);
HWND hCompressLevel = GetDlgItem(hwnd, IDC_COMPRESSLEVEL);
EnableWindow(hCompressLevel,enable);
EnableWindow(hfast, enable);
EnableWindow(hlevel,enable);
EnableWindow(htextlevel, enable);
EnableWindow(hbest, enable);
}
void VNCOptions::EnableJpeg(HWND hwnd, bool enable)
{
HWND hpoor = GetDlgItem(hwnd, IDC_STATIC_POOR);
HWND hqbest = GetDlgItem(hwnd, IDC_STATIC_QBEST);
HWND hqualitytext = GetDlgItem(hwnd, IDC_STATIC_TEXT_QUALITY);
HWND hquality = GetDlgItem(hwnd, IDC_STATIC_QUALITY);
HWND hJpeg = GetDlgItem(hwnd, IDC_QUALITYLEVEL);
EnableWindow( hJpeg, enable);
EnableWindow(hpoor, enable);
EnableWindow(hqbest, enable);
EnableWindow(hqualitytext, enable);
EnableWindow(hquality, enable);
}
BOOL CALLBACK VNCOptions::DlgProcGlobalOptions(HWND hwnd, UINT uMsg,
WPARAM wParam, LPARAM lParam)
{
VNCOptions *_this = (VNCOptions *) GetWindowLong(hwnd, GWL_USERDATA);
switch (uMsg) {
case WM_INITDIALOG:
{
SetWindowLong(hwnd, GWL_USERDATA, lParam);
VNCOptions *_this = (VNCOptions *) lParam;
// Initialise the controls
HWND hDotCursor = GetDlgItem(hwnd, IDC_DOTCURSOR_RADIO);
SendMessage(hDotCursor, BM_SETCHECK,
(pApp->m_options.m_localCursor == DOTCURSOR), 0);
HWND hSmallCursor = GetDlgItem(hwnd, IDC_SMALLDOTCURSOR_RADIO);
SendMessage(hSmallCursor, BM_SETCHECK,
(pApp->m_options.m_localCursor == SMALLCURSOR), 0);
HWND hNoCursor = GetDlgItem(hwnd, IDC_NOCURSOR_RADIO);
SendMessage(hNoCursor, BM_SETCHECK,
(pApp->m_options.m_localCursor == NOCURSOR), 0);
HWND hNormalCursor = GetDlgItem(hwnd, IDC_NORMALCURSOR_RADIO);
SendMessage(hNormalCursor, BM_SETCHECK,
(pApp->m_options.m_localCursor == NORMALCURSOR), 0);
HWND hMessage = GetDlgItem(hwnd, IDC_CHECK_MESSAGE);
SendMessage(hMessage, BM_SETCHECK, !pApp->m_options.m_skipprompt, 0);
HWND hToolbar = GetDlgItem(hwnd, IDC_CHECK_TOOLBAR);
SendMessage(hToolbar, BM_SETCHECK, pApp->m_options.m_toolbar, 0);
HWND hEditList = GetDlgItem(hwnd, IDC_EDIT_AMOUNT_LIST);
SetDlgItemInt( hwnd, IDC_EDIT_AMOUNT_LIST, pApp->m_options.m_historyLimit, FALSE);
HWND hSpin1 = GetDlgItem(hwnd, IDC_SPIN1);
SendMessage(hSpin1, UDM_SETBUDDY, (WPARAM) (HWND)hEditList, 0);
HWND hChec = GetDlgItem(hwnd, IDC_CHECK_LOG_FILE);
HWND hEditFile = GetDlgItem(hwnd, IDC_EDIT_LOG_FILE);
HWND hEditLevel = GetDlgItem(hwnd, IDC_EDIT_LOG_LEVEL);
HWND hSpin2 = GetDlgItem(hwnd, IDC_SPIN2);
SendMessage(hSpin2, UDM_SETBUDDY, (WPARAM) (HWND)hEditLevel, 0);
HWND hListenPort = GetDlgItem(hwnd, IDC_LISTEN_PORT);
SetDlgItemInt( hwnd, IDC_LISTEN_PORT, pApp->m_options.m_listenPort, FALSE);
HWND hSpin3 = GetDlgItem(hwnd, IDC_SPIN3);
SendMessage(hSpin3, UDM_SETBUDDY, (WPARAM) (HWND)hListenPort, 0);
SendMessage(hChec, BM_SETCHECK, pApp->m_options.m_logToFile, 0);
_this->EnableLog(hwnd, !(SendMessage(hChec, BM_GETCHECK, 0, 0) == 0));
SetDlgItemInt( hwnd, IDC_EDIT_LOG_LEVEL, pApp->m_options.m_logLevel, FALSE);
SetDlgItemText( hwnd, IDC_EDIT_LOG_FILE, pApp->m_options.m_logFilename);
return TRUE;
}
case WM_HELP:
help.Popup(lParam);
return 0;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_LISTEN_PORT:
switch (HIWORD(wParam)) {
case EN_KILLFOCUS:
Lim(hwnd, IDC_LISTEN_PORT, 1, 65536);
return 0;
}
return 0;
case IDC_EDIT_AMOUNT_LIST:
switch (HIWORD(wParam)) {
case EN_KILLFOCUS:
Lim(hwnd, IDC_EDIT_AMOUNT_LIST, 0, 64);
return 0;
}
return 0;
case IDC_EDIT_LOG_LEVEL:
switch (HIWORD(wParam)) {
case EN_KILLFOCUS:
Lim(hwnd, IDC_EDIT_LOG_LEVEL, 0, 12);
return 0;
}
return 0;
case IDC_LOG_BROWSE:
_this->BrowseLogFile();
SetDlgItemText(hwnd, IDC_EDIT_LOG_FILE,
_this->m_logFilename);
return 0;
case IDC_BUTTON_CLEAR_LIST:
{
HKEY hRegKey;
TCHAR value[80];
TCHAR data[80];
DWORD valuesize=80;
DWORD datasize=80;
DWORD index=0;
RegOpenKey(HKEY_CURRENT_USER,
KEY_VNCVIEWER_HISTORI, &hRegKey);
while (RegEnumValue(hRegKey, index, value, &valuesize,
NULL, NULL, (LPBYTE)data, &datasize) == ERROR_SUCCESS) {
pApp->m_options.delkey(data, KEY_VNCVIEWER_HISTORI);
RegDeleteValue(hRegKey, value);
valuesize = 80;
datasize = 80;
}
RegCloseKey(hRegKey);
return 0;
}
case IDC_OK:
{
HWND hDotCursor = GetDlgItem(hwnd, IDC_DOTCURSOR_RADIO);
HWND hNoCursor = GetDlgItem(hwnd, IDC_NOCURSOR_RADIO);
HWND hNormalCursor = GetDlgItem(hwnd, IDC_NORMALCURSOR_RADIO);
HWND hSmallCursor = GetDlgItem(hwnd, IDC_SMALLDOTCURSOR_RADIO);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -