From 760b14d3cdbe8549463fee5a9ed58c09fa9cd092 Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Wed, 7 Nov 2007 13:49:31 +0000 Subject: [PATCH] - add code to set changes to the main configuration and use it for the resolution slider - fix a bug in showing the current resolution in the label svn path=/trunk/; revision=30241 --- .../base/applications/mstsc/connectdialog.c | 60 +++++++++---------- reactos/base/applications/mstsc/rdpfile.c | 58 ++++++++++++++++++ reactos/base/applications/mstsc/todo.h | 2 + 3 files changed, 88 insertions(+), 32 deletions(-) diff --git a/reactos/base/applications/mstsc/connectdialog.c b/reactos/base/applications/mstsc/connectdialog.c index a0d7c339875..bcb1b9368ef 100644 --- a/reactos/base/applications/mstsc/connectdialog.c +++ b/reactos/base/applications/mstsc/connectdialog.c @@ -557,6 +557,14 @@ OnResolutionChanged(PINFO pInfo, DWORD position) 0, (LPARAM)Buffer); + /* save new settings */ + SetIntegerToSettings(pInfo->pRdpSettings, + L"desktopwidth", + pInfo->DisplayDeviceList->Resolutions[position].dmPelsWidth); + SetIntegerToSettings(pInfo->pRdpSettings, + L"desktopheight", + pInfo->DisplayDeviceList->Resolutions[position].dmPelsHeight); + } @@ -568,7 +576,6 @@ FillResolutionsAndColors(PINFO pInfo) TCHAR Pixel[64]; DWORD index, i, num; DWORD MaxBpp = 0; - UINT HighBpp; DWORD width, height; UINT types[4]; @@ -588,20 +595,9 @@ FillResolutionsAndColors(PINFO pInfo) switch (MaxBpp) { case 32: - case 24: - HighBpp = IDS_HIGHCOLOR24; - num = 4; - break; - - case 16: - HighBpp = IDS_HIGHCOLOR16; - num = 3; - break; - - case 8: - HighBpp = IDS_256COLORS; - num = 1; - break; + case 24: num = 4; break; + case 16: num = 3; break; + case 8: num = 1; break; } types[0] = IDS_256COLORS; @@ -659,23 +655,6 @@ FillResolutionsAndColors(PINFO pInfo) TRUE, MAKELONG(0, pInfo->DisplayDeviceList->ResolutionsCount)); //extra 1 for full screen - if (LoadString(hInst, - IDS_PIXEL, - Pixel, - sizeof(Pixel) / sizeof(TCHAR))) - { - _stprintf(Buffer, - Pixel, - pInfo->CurrentDisplayDevice->CurrentSettings->dmPelsWidth, - pInfo->CurrentDisplayDevice->CurrentSettings->dmPelsHeight, - Pixel); - SendDlgItemMessage(pInfo->hDisplayPage, - IDC_SETTINGS_RESOLUTION_TEXT, - WM_SETTEXT, - 0, - (LPARAM)Buffer); - } - width = GetIntegerFromSettings(pInfo->pRdpSettings, L"desktopwidth"); height = GetIntegerFromSettings(pInfo->pRdpSettings, L"desktopheight"); @@ -694,6 +673,23 @@ FillResolutionsAndColors(PINFO pInfo) break; } } + + if (LoadString(hInst, + IDS_PIXEL, + Pixel, + sizeof(Pixel) / sizeof(TCHAR))) + { + _stprintf(Buffer, + Pixel, + width, + height, + Pixel); + SendDlgItemMessage(pInfo->hDisplayPage, + IDC_SETTINGS_RESOLUTION_TEXT, + WM_SETTEXT, + 0, + (LPARAM)Buffer); + } } } diff --git a/reactos/base/applications/mstsc/rdpfile.c b/reactos/base/applications/mstsc/rdpfile.c index cd74c2823e9..6dfea4f8984 100644 --- a/reactos/base/applications/mstsc/rdpfile.c +++ b/reactos/base/applications/mstsc/rdpfile.c @@ -18,6 +18,64 @@ LPWSTR lpSettings[NUM_SETTINGS] = +BOOL +SetIntegerToSettings(PRDPSETTINGS pRdpSettings, + LPWSTR lpKey, + INT Value) +{ + BOOL bRet = FALSE; + + if (pRdpSettings) + { + INT i; + + for (i = 0; i < pRdpSettings->NumSettings; i++) + { + if (wcscmp(pRdpSettings->pSettings[i].Key, lpKey) == 0) + { + if (pRdpSettings->pSettings[i].Type == L'i') + { + pRdpSettings->pSettings[i].Value.i = Value; + bRet = TRUE; + break; + } + } + } + } + + return bRet; +} + + +BOOL +SetStringToSettings(PRDPSETTINGS pRdpSettings, + LPWSTR lpKey, + LPWSTR lpValue) +{ + BOOL bRet = FALSE; + + if (pRdpSettings) + { + INT i; + + for (i = 0; i < pRdpSettings->NumSettings; i++) + { + if (wcscmp(pRdpSettings->pSettings[i].Key, lpKey) == 0) + { + if (pRdpSettings->pSettings[i].Type == L's') + { + wcscpy(pRdpSettings->pSettings[i].Value.i, lpValue); + bRet = TRUE; + break; + } + } + } + } + + return bRet; +} + + INT GetIntegerFromSettings(PRDPSETTINGS pRdpSettings, LPWSTR lpKey) diff --git a/reactos/base/applications/mstsc/todo.h b/reactos/base/applications/mstsc/todo.h index 555bb5f3601..5e83cf894c1 100644 --- a/reactos/base/applications/mstsc/todo.h +++ b/reactos/base/applications/mstsc/todo.h @@ -22,3 +22,5 @@ PRDPSETTINGS LoadRdpSettingsFromFile(LPWSTR lpFile); BOOL SaveRdpSettingsToFile(LPWSTR lpFile, PRDPSETTINGS pRdpSettings); INT GetIntegerFromSettings(PRDPSETTINGS pSettings, LPWSTR lpValue); LPWSTR GetStringFromSettings(PRDPSETTINGS pSettings, LPWSTR lpValue); +BOOL SetIntegerToSettings(PRDPSETTINGS pRdpSettings, LPWSTR lpKey, INT Value); +BOOL SetStringToSettings(PRDPSETTINGS pRdpSettings, LPWSTR lpKey, LPWSTR lpValue);