- set the colors combo box according to the .rdp file

- add a note for server browsing

svn path=/trunk/; revision=30240
This commit is contained in:
Ged Murphy 2007-11-07 13:13:05 +00:00
parent 08a400e41b
commit 8274bc6115
3 changed files with 90 additions and 53 deletions

View file

@ -262,6 +262,28 @@ GeneralDlgProc(HWND hDlg,
{ {
switch(LOWORD(wParam)) switch(LOWORD(wParam))
{ {
case IDC_SERVERCOMBO:
if (HIWORD(wParam) == CBN_SELCHANGE)
{
INT last, cur;
cur = SendDlgItemMessage(hDlg,
IDC_SERVERCOMBO,
CB_GETCURSEL,
0,
0);
cur++;
last = SendDlgItemMessage(hDlg,
IDC_SERVERCOMBO,
CB_GETCOUNT,
0,
0);
if (cur == last)
MessageBox(hDlg, _T("SMB is not yet supported"), _T("RDP error"), MB_ICONERROR);
}
break;
case IDC_SAVE: case IDC_SAVE:
SaveRdpSettingsToFile(NULL, pInfo->pRdpSettings); SaveRdpSettingsToFile(NULL, pInfo->pRdpSettings);
break; break;
@ -548,6 +570,7 @@ FillResolutionsAndColors(PINFO pInfo)
DWORD MaxBpp = 0; DWORD MaxBpp = 0;
UINT HighBpp; UINT HighBpp;
DWORD width, height; DWORD width, height;
UINT types[4];
pInfo->CurrentDisplayDevice = pInfo->DisplayDeviceList; /* Update global variable */ pInfo->CurrentDisplayDevice = pInfo->DisplayDeviceList; /* Update global variable */
@ -565,18 +588,33 @@ FillResolutionsAndColors(PINFO pInfo)
switch (MaxBpp) switch (MaxBpp)
{ {
case 32: case 32:
case 24: HighBpp = IDS_HIGHCOLOR24; break; case 24:
case 16: HighBpp = IDS_HIGHCOLOR16; break; HighBpp = IDS_HIGHCOLOR24;
case 8: HighBpp = IDS_256COLORS; break; num = 4;
break;
case 16:
HighBpp = IDS_HIGHCOLOR16;
num = 3;
break;
case 8:
HighBpp = IDS_256COLORS;
num = 1;
break;
} }
types[0] = IDS_256COLORS;
types[1] = IDS_HIGHCOLOR15;
types[2] = IDS_HIGHCOLOR16;
types[3] = IDS_HIGHCOLOR24;
/* Fill color depths combo box */ /* Fill color depths combo box */
SendDlgItemMessage(pInfo->hDisplayPage, SendDlgItemMessage(pInfo->hDisplayPage,
IDC_BPPCOMBO, IDC_BPPCOMBO,
CB_RESETCONTENT, CB_RESETCONTENT,
0, 0,
0); 0);
num = HighBpp - IDS_256COLORS;
for (i = 0, Current = pInfo->DisplayDeviceList->Settings; for (i = 0, Current = pInfo->DisplayDeviceList->Settings;
i <= num && Current != NULL; i <= num && Current != NULL;
@ -584,7 +622,7 @@ FillResolutionsAndColors(PINFO pInfo)
{ {
TCHAR Buffer[64]; TCHAR Buffer[64];
if (LoadString(hInst, if (LoadString(hInst,
(IDS_256COLORS + i), types[i],
Buffer, Buffer,
sizeof(Buffer) / sizeof(TCHAR))) sizeof(Buffer) / sizeof(TCHAR)))
{ {
@ -604,7 +642,7 @@ FillResolutionsAndColors(PINFO pInfo)
IDC_BPPCOMBO, IDC_BPPCOMBO,
CB_SETITEMDATA, CB_SETITEMDATA,
index, index,
Current->dmBitsPerPel); types[i]);
} }
} }
} }
@ -731,7 +769,48 @@ DisplayOnInit(PINFO pInfo)
} }
if (GotDev) if (GotDev)
{
INT bpp, num, i;
BOOL bSet = FALSE;
FillResolutionsAndColors(pInfo); FillResolutionsAndColors(pInfo);
/* set color combo */
bpp = GetIntegerFromSettings(pInfo->pRdpSettings, L"session bpp");
num = SendDlgItemMessage(pInfo->hDisplayPage,
IDC_BPPCOMBO,
CB_GETCOUNT,
0,
0);
for (i = 0; i < num; i++)
{
INT data = SendDlgItemMessage(pInfo->hDisplayPage,
IDC_BPPCOMBO,
CB_GETITEMDATA,
i,
0);
if (data == bpp)
{
SendDlgItemMessage(pInfo->hDisplayPage,
IDC_BPPCOMBO,
CB_SETCURSEL,
i,
0);
bSet = TRUE;
break;
}
}
if (!bSet)
{
SendDlgItemMessage(pInfo->hDisplayPage,
IDC_BPPCOMBO,
CB_SETCURSEL,
num - 1,
0);
}
}
} }

View file

@ -1,5 +1,10 @@
#define IDC_STATIC -1 #define IDC_STATIC -1
#define IDS_256COLORS 8
#define IDS_HIGHCOLOR15 15
#define IDS_HIGHCOLOR16 16
#define IDS_HIGHCOLOR24 24
#define IDD_CONNECTDIALOG 101 #define IDD_CONNECTDIALOG 101
#define IDD_GENERAL 105 #define IDD_GENERAL 105
#define IDD_DISPLAY 107 #define IDD_DISPLAY 107
@ -32,8 +37,3 @@
#define IDS_PIXEL 3006 #define IDS_PIXEL 3006
#define IDS_FULLSCREEN 3007 #define IDS_FULLSCREEN 3007
#define IDS_BROWSESERVER 3008 #define IDS_BROWSESERVER 3008
#define IDS_256COLORS 4000
#define IDS_HIGHCOLOR15 4001
#define IDS_HIGHCOLOR16 4002
#define IDS_HIGHCOLOR24 4003

View file

@ -1271,46 +1271,6 @@ mi_process_cl(LPTSTR lpCmdLine)
return (state == 0); return (state == 0);
} }
/*****************************************************************************/
/* display the command line options available */
static void
mi_show_params(void)
{
char text1[512 * 4];
TCHAR textx[512 * 4];
TCHAR lcaption[64];
strcpy(text1, "");
strcat(text1, "WinRDesktop - an RDP client based on rdesktop\r\n");
strcat(text1, "You can't run this application without " );
strcat(text1, "correct parameters\r\n");
strcat(text1, "\r\n");
strcat(text1, "command line options\r\n");
strcat(text1, "\r\n");
strcat(text1, "WinRDesktop [-g widthxheight] [-t port] [-a bpp]\r\n");
strcat(text1, " [-f] [-u username] [-p password] [-d domain]\r\n");
strcat(text1, " [-s shell] [-c working directory] [-n host name]\r\n");
strcat(text1, " server-name-or-ip\r\n");
strcat(text1, "\r\n");
strcat(text1, "You can use a config file in the current directory\r\n");
strcat(text1, "called WinRDesktop.ini\r\n");
strcat(text1, "The file should look like this...\r\n");
strcat(text1, "[main]\r\n");
strcat(text1, "server=192.168.1.1\r\n");
strcat(text1, "port=3389\r\n");
strcat(text1, "username=user1\r\n");
strcat(text1, "password=password1\r\n");
strcat(text1, "bpp=16\r\n");
strcat(text1, "geometry=800x600\r\n");
#ifdef WITH_DEBUG
printf(text1);
#else /* WITH_DEBUG */
str_to_uni(lcaption, "WinRDesktop");
str_to_uni(textx, text1);
MessageBox(g_Wnd, textx, lcaption, MB_OK);
#endif /* WITH_DEBUG */
}
#ifdef WITH_DEBUG #ifdef WITH_DEBUG
/*****************************************************************************/ /*****************************************************************************/
int int
@ -1346,8 +1306,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
ret = 0; ret = 0;
} }
//} //}
else
mi_show_params();
WSACleanup(); WSACleanup();