From 8274bc6115b587438c74dda8fc6e82df65917329 Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Wed, 7 Nov 2007 13:13:05 +0000 Subject: [PATCH] - set the colors combo box according to the .rdp file - add a note for server browsing svn path=/trunk/; revision=30240 --- .../base/applications/mstsc/connectdialog.c | 91 +++++++++++++++++-- reactos/base/applications/mstsc/resource.h | 10 +- reactos/base/applications/mstsc/win32.c | 42 --------- 3 files changed, 90 insertions(+), 53 deletions(-) diff --git a/reactos/base/applications/mstsc/connectdialog.c b/reactos/base/applications/mstsc/connectdialog.c index d589f3f4ee9..a0d7c339875 100644 --- a/reactos/base/applications/mstsc/connectdialog.c +++ b/reactos/base/applications/mstsc/connectdialog.c @@ -262,6 +262,28 @@ GeneralDlgProc(HWND hDlg, { 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: SaveRdpSettingsToFile(NULL, pInfo->pRdpSettings); break; @@ -548,6 +570,7 @@ FillResolutionsAndColors(PINFO pInfo) DWORD MaxBpp = 0; UINT HighBpp; DWORD width, height; + UINT types[4]; pInfo->CurrentDisplayDevice = pInfo->DisplayDeviceList; /* Update global variable */ @@ -565,18 +588,33 @@ FillResolutionsAndColors(PINFO pInfo) switch (MaxBpp) { case 32: - case 24: HighBpp = IDS_HIGHCOLOR24; break; - case 16: HighBpp = IDS_HIGHCOLOR16; break; - case 8: HighBpp = IDS_256COLORS; break; + case 24: + HighBpp = IDS_HIGHCOLOR24; + 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 */ SendDlgItemMessage(pInfo->hDisplayPage, IDC_BPPCOMBO, CB_RESETCONTENT, 0, 0); - num = HighBpp - IDS_256COLORS; for (i = 0, Current = pInfo->DisplayDeviceList->Settings; i <= num && Current != NULL; @@ -584,7 +622,7 @@ FillResolutionsAndColors(PINFO pInfo) { TCHAR Buffer[64]; if (LoadString(hInst, - (IDS_256COLORS + i), + types[i], Buffer, sizeof(Buffer) / sizeof(TCHAR))) { @@ -604,7 +642,7 @@ FillResolutionsAndColors(PINFO pInfo) IDC_BPPCOMBO, CB_SETITEMDATA, index, - Current->dmBitsPerPel); + types[i]); } } } @@ -731,7 +769,48 @@ DisplayOnInit(PINFO pInfo) } if (GotDev) + { + INT bpp, num, i; + BOOL bSet = FALSE; + 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); + } + } } diff --git a/reactos/base/applications/mstsc/resource.h b/reactos/base/applications/mstsc/resource.h index 162ecc5d25e..c204d83ae72 100644 --- a/reactos/base/applications/mstsc/resource.h +++ b/reactos/base/applications/mstsc/resource.h @@ -1,5 +1,10 @@ #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_GENERAL 105 #define IDD_DISPLAY 107 @@ -32,8 +37,3 @@ #define IDS_PIXEL 3006 #define IDS_FULLSCREEN 3007 #define IDS_BROWSESERVER 3008 - -#define IDS_256COLORS 4000 -#define IDS_HIGHCOLOR15 4001 -#define IDS_HIGHCOLOR16 4002 -#define IDS_HIGHCOLOR24 4003 diff --git a/reactos/base/applications/mstsc/win32.c b/reactos/base/applications/mstsc/win32.c index 75ffe811847..89de484363f 100644 --- a/reactos/base/applications/mstsc/win32.c +++ b/reactos/base/applications/mstsc/win32.c @@ -1271,46 +1271,6 @@ mi_process_cl(LPTSTR lpCmdLine) 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 /*****************************************************************************/ int @@ -1346,8 +1306,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, ret = 0; } //} - else - mi_show_params(); WSACleanup();