X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/098ecd174ccf3473f2345a7f1e205dd199cc0100..22dcdc3b1a1c7c820fabe3ebaae8be6b09b4408e:/windlg.c diff --git a/windlg.c b/windlg.c index f814cf4b..e6194699 100644 --- a/windlg.c +++ b/windlg.c @@ -50,7 +50,7 @@ static int CALLBACK LogProc (HWND hwnd, UINT msg, switch (msg) { case WM_INITDIALOG: { - static const int tabs[4] = {78, 108}; + static int tabs[4] = {78, 108}; SendDlgItemMessage (hwnd, IDN_LIST, LB_SETTABSTOPS, 2, (LPARAM) tabs); } @@ -168,6 +168,13 @@ static int CALLBACK AboutProc (HWND hwnd, UINT msg, EnableWindow(hwnd, 1); SetActiveWindow(hwnd); return 0; + + case IDA_WEB: + /* Load web browser */ + ShellExecute(hwnd, "open", + "http://www.chiark.greenend.org.uk/~sgtatham/putty/", + 0, 0, SW_SHOWDEFAULT); + return 0; } return 0; case WM_CLOSE: @@ -252,6 +259,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue, IDC_CURNORMAL, IDC_CURAPPLIC, IDC_COMPOSEKEY, + IDC_CTRLALTKEYS, keyboardpanelend, terminalpanelstart, @@ -264,6 +272,8 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue, IDC_BEEP, IDC_BCE, IDC_BLINKTEXT, + IDC_ANSWERBACK, + IDC_ANSWEREDIT, IDC_ECHOSTATIC, IDC_ECHOBACKEND, IDC_ECHOYES, @@ -366,6 +376,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue, IDC_CIPHER3DES, IDC_CIPHERBLOWF, IDC_CIPHERDES, + IDC_CIPHERAES, IDC_BUGGYMAC, IDC_AUTHTIS, IDC_PKSTATIC, @@ -384,6 +395,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue, IDC_TITLE_SELECTION, IDC_BOX_SELECTION1, IDC_BOX_SELECTION2, + IDC_BOX_SELECTION3, IDC_MBSTATIC, IDC_MBWINDOWS, IDC_MBXTERM, @@ -392,6 +404,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue, IDC_CCSET, IDC_CCSTATIC2, IDC_CCEDIT, + IDC_RAWCNP, selectionpanelend, colourspanelstart, @@ -466,9 +479,8 @@ static void fmtfont (char *buf) { if (cfg.fontheight == 0) strcat (buf, "default height"); else - sprintf (buf+strlen(buf), "%d-%s", - (cfg.fontheight < 0 ? -cfg.fontheight : cfg.fontheight), - (cfg.fontheight < 0 ? "pixel" : "point")); + sprintf (buf+strlen(buf), "%d-point", + (cfg.fontheight < 0 ? -cfg.fontheight : cfg.fontheight)); } static void init_dlg_ctrls(HWND hwnd) { @@ -515,12 +527,14 @@ static void init_dlg_ctrls(HWND hwnd) { CheckDlgButton (hwnd, IDC_ALTSPACE, cfg.alt_space); CheckDlgButton (hwnd, IDC_ALTONLY, cfg.alt_only); CheckDlgButton (hwnd, IDC_COMPOSEKEY, cfg.compose_key); + CheckDlgButton (hwnd, IDC_CTRLALTKEYS, cfg.ctrlaltkeys); CheckRadioButton (hwnd, IDC_ECHOBACKEND, IDC_ECHONO, cfg.localecho == LD_BACKEND ? IDC_ECHOBACKEND: cfg.localecho == LD_YES ? IDC_ECHOYES : IDC_ECHONO); CheckRadioButton (hwnd, IDC_EDITBACKEND, IDC_EDITNO, cfg.localedit == LD_BACKEND ? IDC_EDITBACKEND: cfg.localedit == LD_YES ? IDC_EDITYES : IDC_EDITNO); + SetDlgItemText (hwnd, IDC_ANSWEREDIT, cfg.answerback); CheckDlgButton (hwnd, IDC_ALWAYSONTOP, cfg.alwaysontop); CheckDlgButton (hwnd, IDC_SCROLLKEY, cfg.scroll_on_key); CheckDlgButton (hwnd, IDC_SCROLLDISP, cfg.scroll_on_disp); @@ -578,9 +592,10 @@ static void init_dlg_ctrls(HWND hwnd) { CheckDlgButton (hwnd, IDC_COMPRESS, cfg.compression); CheckDlgButton (hwnd, IDC_BUGGYMAC, cfg.buggymac); CheckDlgButton (hwnd, IDC_AGENTFWD, cfg.agentfwd); - CheckRadioButton (hwnd, IDC_CIPHER3DES, IDC_CIPHERDES, + CheckRadioButton (hwnd, IDC_CIPHER3DES, IDC_CIPHERAES, cfg.cipher == CIPHER_BLOWFISH ? IDC_CIPHERBLOWF : cfg.cipher == CIPHER_DES ? IDC_CIPHERDES : + cfg.cipher == CIPHER_AES ? IDC_CIPHERAES : IDC_CIPHER3DES); CheckRadioButton (hwnd, IDC_SSHPROT1, IDC_SSHPROT2, cfg.sshprot == 1 ? IDC_SSHPROT1 : IDC_SSHPROT2); @@ -590,6 +605,7 @@ static void init_dlg_ctrls(HWND hwnd) { CheckRadioButton (hwnd, IDC_MBWINDOWS, IDC_MBXTERM, cfg.mouse_is_xterm ? IDC_MBXTERM : IDC_MBWINDOWS); + CheckDlgButton (hwnd, IDC_RAWCNP, cfg.rawcnp); { static int tabs[4] = {25, 61, 96, 128}; SendDlgItemMessage (hwnd, IDC_CCLIST, LB_SETTABSTOPS, 4, @@ -736,7 +752,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) { } if (panel == terminalpanelstart) { - /* The Terminal panel. Accelerators used: [acgo] wdlben ht */ + /* The Terminal panel. Accelerators used: [acgo] wdlben hts */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Options controlling the terminal emulation", @@ -749,6 +765,9 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) { checkbox(&cp, "&Beep enabled", IDC_BEEP); checkbox(&cp, "Use background colour to &erase screen", IDC_BCE); checkbox(&cp, "Enable bli&nking text", IDC_BLINKTEXT); + multiedit(&cp, + "An&swerback to ^E:", IDC_ANSWERBACK, + IDC_ANSWEREDIT, 100, NULL); endbox(&cp); beginbox(&cp, "Line discipline options", @@ -765,7 +784,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) { } if (panel == keyboardpanelstart) { - /* The Keyboard panel. Accelerators used: [acgo] h?sr~lxv unpymie t */ + /* The Keyboard panel. Accelerators used: [acgo] h?sr~lxvunpymietd */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Options controlling the effects of keys", @@ -802,8 +821,10 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) { endbox(&cp); beginbox(&cp, "Enable extra keyboard features:", IDC_BOX_KEYBOARD3); - checkbox(&cp, "Application and AltGr ac&t as Compose key", + checkbox(&cp, "AltGr ac&ts as Compose key", IDC_COMPOSEKEY); + checkbox(&cp, "Control-Alt is &different from AltGr", + IDC_CTRLALTKEYS); endbox(&cp); } @@ -905,20 +926,25 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) { } if (panel == selectionpanelstart) { - /* The Selection panel. Accelerators used: [acgo] wx hst */ + /* The Selection panel. Accelerators used: [acgo] d wx hst */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Options controlling copy and paste", IDC_TITLE_SELECTION); - beginbox(&cp, "Control which mouse button does which thing", + beginbox(&cp, "Translation of pasted characters", IDC_BOX_SELECTION1); + checkbox(&cp, "&Don't translate line drawing chars into +, - and |", + IDC_RAWCNP); + endbox(&cp); + beginbox(&cp, "Control which mouse button does which thing", + IDC_BOX_SELECTION2); radiobig(&cp, "Action of mouse buttons:", IDC_MBSTATIC, "&Windows (Right pastes, Middle extends)", IDC_MBWINDOWS, "&xterm (Right extends, Middle pastes)", IDC_MBXTERM, NULL); endbox(&cp); beginbox(&cp, "Control the select-one-word-at-a-time mode", - IDC_BOX_SELECTION2); + IDC_BOX_SELECTION3); charclass(&cp, "C&haracter classes:", IDC_CCSTATIC, IDC_CCLIST, "&Set", IDC_CCSET, IDC_CCEDIT, "&to class", IDC_CCSTATIC2); @@ -1005,7 +1031,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) { } if (panel == sshpanelstart) { - /* The SSH panel. Accelerators used: [acgo] rmfkw pe123bd i */ + /* The SSH panel. Accelerators used: [acgo] rmfkw pe123bds i */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); if (dlgtype == 0) { @@ -1031,10 +1057,12 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) { radioline(&cp, "Preferred SSH protocol version:", IDC_SSHPROTSTATIC, 2, "&1", IDC_SSHPROT1, "&2", IDC_SSHPROT2, NULL); - radioline(&cp, "Preferred encryption algorithm:", IDC_CIPHERSTATIC, 3, + radioline(&cp, "Preferred encryption algorithm:", IDC_CIPHERSTATIC, 4, "&3DES", IDC_CIPHER3DES, "&Blowfish", IDC_CIPHERBLOWF, - "&DES", IDC_CIPHERDES, NULL); + "&DES", IDC_CIPHERDES, + "AE&S", IDC_CIPHERAES, + NULL); checkbox(&cp, "&Imitate SSH 2 MAC bug in commercial <= v2.3.x", IDC_BUGGYMAC); endbox(&cp); @@ -1474,6 +1502,11 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg, if (LOWORD(wParam)==IDC_EDITNO) cfg.localedit=LD_NO; } break; + case IDC_ANSWEREDIT: + if (HIWORD(wParam) == EN_CHANGE) + GetDlgItemText (hwnd, IDC_ANSWEREDIT, cfg.answerback, + sizeof(cfg.answerback)-1); + break; case IDC_ALWAYSONTOP: if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) @@ -1494,6 +1527,11 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg, HIWORD(wParam) == BN_DOUBLECLICKED) cfg.compose_key = IsDlgButtonChecked (hwnd, IDC_COMPOSEKEY); break; + case IDC_CTRLALTKEYS: + if (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) + cfg.ctrlaltkeys = IsDlgButtonChecked (hwnd, IDC_CTRLALTKEYS); + break; case IDC_WRAPMODE: if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) @@ -1545,7 +1583,7 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg, cfg.font[sizeof(cfg.font)-1] = '\0'; cfg.fontisbold = (lf.lfWeight == FW_BOLD); cfg.fontcharset = lf.lfCharSet; - cfg.fontheight = lf.lfHeight; + cfg.fontheight = cf.iPointSize / 10; fmtfont (fontstatic); SetDlgItemText (hwnd, IDC_FONTSTATIC, fontstatic); } @@ -1779,6 +1817,7 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg, case IDC_CIPHER3DES: case IDC_CIPHERBLOWF: case IDC_CIPHERDES: + case IDC_CIPHERAES: if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) { if (IsDlgButtonChecked (hwnd, IDC_CIPHER3DES)) @@ -1787,6 +1826,8 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg, cfg.cipher = CIPHER_BLOWFISH; else if (IsDlgButtonChecked (hwnd, IDC_CIPHERDES)) cfg.cipher = CIPHER_DES; + else if (IsDlgButtonChecked (hwnd, IDC_CIPHERAES)) + cfg.cipher = CIPHER_AES; } break; case IDC_SSHPROT1: @@ -1836,6 +1877,8 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg, SetDlgItemText (hwnd, IDC_PKEDIT, cfg.keyfile); } break; + case IDC_RAWCNP: + cfg.rawcnp = IsDlgButtonChecked (hwnd, IDC_RAWCNP); case IDC_MBWINDOWS: case IDC_MBXTERM: cfg.mouse_is_xterm = IsDlgButtonChecked (hwnd, IDC_MBXTERM); @@ -2058,14 +2101,14 @@ void logevent (char *string) { events[nevents] = smalloc(strlen(timebuf)+strlen(string)+1); strcpy(events[nevents], timebuf); strcat(events[nevents], string); - nevents++; if (logbox) { int count; SendDlgItemMessage (logbox, IDN_LIST, LB_ADDSTRING, - 0, (LPARAM)string); + 0, (LPARAM)events[nevents]); count = SendDlgItemMessage (logbox, IDN_LIST, LB_GETCOUNT, 0, 0); SendDlgItemMessage (logbox, IDN_LIST, LB_SETTOPINDEX, count-1, 0); } + nevents++; } void showeventlog (HWND hwnd) {