- 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
This commit is contained in:
Ged Murphy
2007-11-07 13:49:31 +00:00
parent 8274bc6115
commit 760b14d3cd
3 changed files with 88 additions and 32 deletions
+28 -32
View File
@@ -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);
}
}
}
+58
View File
@@ -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)
+2
View File
@@ -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);