X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/d74d141c2daed084c8a62c5dc5b88e801b81ee5a..6bb26b30935b575ae7e0e4e5b230ab21d151ea5e:/windlg.c?ds=sidebyside diff --git a/windlg.c b/windlg.c index 550e4794..99db197f 100644 --- a/windlg.c +++ b/windlg.c @@ -746,7 +746,20 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess) SetDlgItemInt(hwnd, IDC_GVALUE, cfg.colours[0][1], FALSE); SetDlgItemInt(hwnd, IDC_BVALUE, cfg.colours[0][2], FALSE); - SetDlgItemText(hwnd, IDC_CODEPAGE, cfg.line_codepage); + { + int i; + char *cp; + int index = 0; + SendDlgItemMessage(hwnd, IDC_CODEPAGE, CB_RESETCONTENT, 0, 0); + for (i = 0; (cp = cp_enumerate(i)) != NULL; i++) { + SendDlgItemMessage(hwnd, IDC_CODEPAGE, CB_ADDSTRING, + 0, (LPARAM) cp); + if (!strcmp(cp, cfg.line_codepage)) + index = i; + } + SendDlgItemMessage(hwnd, IDC_CODEPAGE, CB_SETCURSEL, index, 0); + } + CheckRadioButton(hwnd, IDC_VTXWINDOWS, IDC_VTUNICODE, cfg.vtmode == VT_XWINDOWS ? IDC_VTXWINDOWS : cfg.vtmode == VT_OEMANSI ? IDC_VTOEMANSI : @@ -803,10 +816,11 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) bartitle(&cp, "Basic options for your PuTTY session", IDC_TITLE_SESSION); if (dlgtype == 0) { - beginbox(&cp, "Specify your connection by host name", + beginbox(&cp, "Specify your connection by host name or IP address", IDC_BOX_SESSION1); multiedit(&cp, - "Host &Name", IDC_HOSTSTATIC, IDC_HOST, 75, + "Host &Name (or IP address)", + IDC_HOSTSTATIC, IDC_HOST, 75, "&Port", IDC_PORTSTATIC, IDC_PORT, 25, NULL); if (backends[3].backend == NULL) { /* this is PuTTYtel, so only three protocols available */ @@ -1053,10 +1067,11 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) "&Poor man's line drawing (" "+" ", " "-" " and " "|" ")", IDC_VTPOORMAN, "&Unicode mode", IDC_VTUNICODE, NULL); endbox(&cp); - beginbox(&cp, "Enable character set translation on received data", + beginbox(&cp, "Character set translation on received data", IDC_BOX_TRANSLATION2); - multiedit(&cp, "Line codepage:", IDC_CODEPAGESTATIC, - IDC_CODEPAGE, 100, NULL); + dropdownlist(&cp, + "Received data assumed to be in which character set:", + IDC_CODEPAGESTATIC, IDC_CODEPAGE); endbox(&cp); } @@ -2391,28 +2406,11 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, } break; case IDC_CODEPAGE: - if (HIWORD(wParam) == EN_CHANGE) - GetDlgItemText(hwnd, IDC_CODEPAGE, cfg.line_codepage, - sizeof(cfg.line_codepage) - 1); - if (HIWORD(wParam) == EN_KILLFOCUS) { - int cp = decode_codepage(cfg.line_codepage); - char buf[256]; - if (cp < -1) { - if (cp == -2) - sprintf(buf, - "Unable to identify character set '%s', " - "translation disabled.", - cfg.line_codepage); - if (cp == -3) - sprintf(buf, - "Character set '%s' is a DBCS, " - "translation is not available.", - cfg.line_codepage); - MessageBox(hwnd, buf, "PuTTY Error", - MB_ICONERROR | MB_OK); - } - strcpy(cfg.line_codepage, cp_name(cp)); - SetDlgItemText(hwnd, IDC_CODEPAGE, cfg.line_codepage); + if (HIWORD(wParam) == CBN_SELCHANGE) { + int index = SendDlgItemMessage(hwnd, IDC_CODEPAGE, + CB_GETCURSEL, 0, 0); + SendDlgItemMessage(hwnd, IDC_CODEPAGE, CB_GETLBTEXT, + index, (LPARAM)cfg.line_codepage); } break; case IDC_VTXWINDOWS: