X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/00db133f300dd6aa08111d2b42c749a940ecede9..e6f8202f682fa90aa3c7b645e6d7e80bed5c176c:/windlg.c diff --git a/windlg.c b/windlg.c index c3f13b75..316115e5 100644 --- a/windlg.c +++ b/windlg.c @@ -12,6 +12,12 @@ #include "win_res.h" #include "storage.h" +#ifdef MSVC4 +#define TVINSERTSTRUCT TV_INSERTSTRUCT +#define TVITEM TV_ITEM +#define ICON_BIG 1 +#endif + static char **events = NULL; static int nevents = 0, negsize = 0; @@ -21,6 +27,8 @@ static int requested_help; static struct prefslist cipherlist; +#define PRINTER_DISABLED_STRING "None (printing disabled)" + void force_normal(HWND hwnd) { static int recurse = 0; @@ -290,8 +298,6 @@ enum { IDCX_ABOUT = IDC_KPNORMAL, IDC_KPAPPLIC, IDC_KPNH, - IDC_NOAPPLICK, - IDC_NOAPPLICC, IDC_CURSTATIC, IDC_CURNORMAL, IDC_CURAPPLIC, @@ -303,6 +309,7 @@ enum { IDCX_ABOUT = IDC_TITLE_TERMINAL, IDC_BOX_TERMINAL1, IDC_BOX_TERMINAL2, + IDC_BOX_TERMINAL3, IDC_WRAPMODE, IDC_DECOM, IDC_LFHASCR, @@ -318,8 +325,23 @@ enum { IDCX_ABOUT = IDC_EDITBACKEND, IDC_EDITYES, IDC_EDITNO, + IDC_PRINTERSTATIC, + IDC_PRINTER, terminalpanelend, + featurespanelstart, + IDC_TITLE_FEATURES, + IDC_BOX_FEATURES1, + IDC_NOAPPLICK, + IDC_NOAPPLICC, + IDC_NOMOUSEREP, + IDC_NORESIZE, + IDC_NOALTSCREEN, + IDC_NOWINTITLE, + IDC_NODBACKSPACE, + IDC_NOCHARSET, + featurespanelend, + bellpanelstart, IDC_TITLE_BELL, IDC_BOX_BELL1, @@ -437,6 +459,7 @@ enum { IDCX_ABOUT = IDC_TPASSIVE, IDC_TACTIVE, IDC_TELNETKEY, + IDC_TELNETRET, telnetpanelend, rloginpanelstart, @@ -545,6 +568,7 @@ enum { IDCX_ABOUT = IDC_X11_DISPSTATIC, IDC_X11_DISPLAY, IDC_LPORT_ALL, + IDC_RPORT_ALL, IDC_PFWDSTATIC, IDC_PFWDSTATIC2, IDC_PFWDREMOVE, @@ -654,9 +678,7 @@ char *help_context_cmd(int id) case IDC_KPSTATIC: case IDC_KPNORMAL: case IDC_KPAPPLIC: - case IDC_NOAPPLICK: return "JI(`',`keyboard.appkeypad')"; - case IDC_NOAPPLICC: case IDC_CURSTATIC: case IDC_CURNORMAL: case IDC_CURAPPLIC: @@ -668,6 +690,22 @@ char *help_context_cmd(int id) case IDC_CTRLALTKEYS: return "JI(`',`keyboard.ctrlalt')"; + case IDC_NOAPPLICK: + case IDC_NOAPPLICC: + return "JI(`',`features.application')"; + case IDC_NOMOUSEREP: + return "JI(`',`features.mouse')"; + case IDC_NORESIZE: + return "JI(`',`features.resize')"; + case IDC_NOALTSCREEN: + return "JI(`',`features.altscreen')"; + case IDC_NOWINTITLE: + return "JI(`',`features.retitle')"; + case IDC_NODBACKSPACE: + return "JI(`',`features.dbackspace')"; + case IDC_NOCHARSET: + return "JI(`',`features.charset')"; + case IDC_WRAPMODE: return "JI(`',`terminal.autowrap')"; case IDC_DECOM: @@ -691,6 +729,9 @@ char *help_context_cmd(int id) case IDC_EDITYES: case IDC_EDITNO: return "JI(`',`terminal.localedit')"; + case IDC_PRINTERSTATIC: + case IDC_PRINTER: + return "JI(`',`terminal.printing')"; case IDC_BELLSTATIC: case IDC_BELL_DISABLED: @@ -802,6 +843,8 @@ char *help_context_cmd(int id) return "JI(`',`telnet.passive')"; case IDC_TELNETKEY: return "JI(`',`telnet.specialkeys')"; + case IDC_TELNETRET: + return "JI(`',`telnet.newline')"; case IDC_R_TSSTATIC: case IDC_R_TSEDIT: @@ -896,7 +939,6 @@ char *help_context_cmd(int id) case IDC_X11_DISPSTATIC: case IDC_X11_DISPLAY: return "JI(`',`ssh.tunnels.x11')"; - case IDC_LPORT_ALL: case IDC_PFWDSTATIC: case IDC_PFWDSTATIC2: case IDC_PFWDREMOVE: @@ -909,6 +951,9 @@ char *help_context_cmd(int id) case IDC_PFWDLOCAL: case IDC_PFWDREMOTE: return "JI(`',`ssh.tunnels.portfwd')"; + case IDC_LPORT_ALL: + case IDC_RPORT_ALL: + return "JI(`',`ssh.tunnels.portfwd.localhost')"; default: return NULL; @@ -955,6 +1000,12 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess) cfg.funky_type == 5 ? IDC_FUNCSCO : IDC_FUNCTILDE); CheckDlgButton(hwnd, IDC_NOAPPLICC, cfg.no_applic_c); CheckDlgButton(hwnd, IDC_NOAPPLICK, cfg.no_applic_k); + CheckDlgButton(hwnd, IDC_NOMOUSEREP, cfg.no_mouse_rep); + CheckDlgButton(hwnd, IDC_NORESIZE, cfg.no_remote_resize); + CheckDlgButton(hwnd, IDC_NOALTSCREEN, cfg.no_alt_screen); + CheckDlgButton(hwnd, IDC_NOWINTITLE, cfg.no_remote_wintitle); + CheckDlgButton(hwnd, IDC_NODBACKSPACE, cfg.no_dbackspace); + CheckDlgButton(hwnd, IDC_NOCHARSET, cfg.no_remote_charset); CheckRadioButton(hwnd, IDC_CURNORMAL, IDC_CURAPPLIC, cfg.app_cursor ? IDC_CURAPPLIC : IDC_CURNORMAL); CheckRadioButton(hwnd, IDC_KPNORMAL, IDC_KPNH, @@ -966,6 +1017,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess) CheckDlgButton(hwnd, IDC_COMPOSEKEY, cfg.compose_key); CheckDlgButton(hwnd, IDC_CTRLALTKEYS, cfg.ctrlaltkeys); CheckDlgButton(hwnd, IDC_TELNETKEY, cfg.telnet_keyboard); + CheckDlgButton(hwnd, IDC_TELNETRET, cfg.telnet_newline); CheckRadioButton(hwnd, IDC_ECHOBACKEND, IDC_ECHONO, cfg.localecho == LD_BACKEND ? IDC_ECHOBACKEND : cfg.localecho == LD_YES ? IDC_ECHOYES : IDC_ECHONO); @@ -1159,7 +1211,25 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess) } SetDlgItemText(hwnd, IDC_CODEPAGE, cfg.line_codepage); } - + + { + int i, nprinters; + printer_enum *pe; + pe = printer_start_enum(&nprinters); + strcpy(cfg.line_codepage, cp_name(decode_codepage(cfg.line_codepage))); + SendDlgItemMessage(hwnd, IDC_PRINTER, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(hwnd, IDC_PRINTER, CB_ADDSTRING, + 0, (LPARAM) PRINTER_DISABLED_STRING); + for (i = 0; i < nprinters; i++) { + char *printer_name = printer_get_name(pe, i); + SendDlgItemMessage(hwnd, IDC_PRINTER, CB_ADDSTRING, + 0, (LPARAM) printer_name); + } + printer_finish_enum(pe); + SetDlgItemText(hwnd, IDC_PRINTER, + *cfg.printer ? cfg.printer : PRINTER_DISABLED_STRING); + } + CheckRadioButton(hwnd, IDC_VTXWINDOWS, IDC_VTUNICODE, cfg.vtmode == VT_XWINDOWS ? IDC_VTXWINDOWS : cfg.vtmode == VT_OEMANSI ? IDC_VTOEMANSI : @@ -1171,6 +1241,7 @@ static void init_dlg_ctrls(HWND hwnd, int keepsess) SetDlgItemText(hwnd, IDC_X11_DISPLAY, cfg.x11_display); CheckDlgButton(hwnd, IDC_LPORT_ALL, cfg.lport_acceptall); + CheckDlgButton(hwnd, IDC_RPORT_ALL, cfg.rport_acceptall); CheckRadioButton(hwnd, IDC_PFWDLOCAL, IDC_PFWDREMOTE, IDC_PFWDLOCAL); } @@ -1210,7 +1281,7 @@ static HTREEITEM treeview_insert(struct treeview_faff *faff, static void create_controls(HWND hwnd, int dlgtype, int panel) { if (panel == sessionpanelstart) { - /* The Session panel. Accelerators used: [acgo] nprtih elsd w */ + /* The Session panel. Accelerators used: [acgoh] nprtis elvd w */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Basic options for your PuTTY session", @@ -1234,9 +1305,9 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) "&Telnet", IDC_PROTTELNET, "Rlog&in", IDC_PROTRLOGIN, #ifdef FWHACK - "SS&H/hack", + "&SSH/hack", #else - "SS&H", + "&SSH", #endif IDC_PROTSSH, NULL); } @@ -1246,7 +1317,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) sesssaver(&cp, "Sav&ed Sessions", IDC_SESSSTATIC, IDC_SESSEDIT, IDC_SESSLIST, "&Load", IDC_SESSLOAD, - "&Save", IDC_SESSSAVE, "&Delete", IDC_SESSDEL, NULL); + "Sa&ve", IDC_SESSSAVE, "&Delete", IDC_SESSDEL, NULL); endbox(&cp); } beginbox(&cp, NULL, IDC_BOX_SESSION3); @@ -1258,7 +1329,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == loggingpanelstart) { - /* The Logging panel. Accelerators used: [acgo] tplsfwe */ + /* The Logging panel. Accelerators used: [acgoh] tplsfwe */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Options controlling session logging", @@ -1285,7 +1356,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == terminalpanelstart) { - /* The Terminal panel. Accelerators used: [acgo] wdlen hts */ + /* The Terminal panel. Accelerators used: [acgoh] wdren lts p */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Options controlling the terminal emulation", @@ -1293,7 +1364,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) beginbox(&cp, "Set various terminal options", IDC_BOX_TERMINAL1); checkbox(&cp, "Auto &wrap mode initially on", IDC_WRAPMODE); checkbox(&cp, "&DEC Origin Mode initially on", IDC_DECOM); - checkbox(&cp, "Implicit CR in every &LF", IDC_LFHASCR); + checkbox(&cp, "Implicit C&R in every LF", IDC_LFHASCR); checkbox(&cp, "Use background colour to &erase screen", IDC_BCE); checkbox(&cp, "Enable bli&nking text", IDC_BLINKTEXT); multiedit(&cp, @@ -1302,17 +1373,45 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) endbox(&cp); beginbox(&cp, "Line discipline options", IDC_BOX_TERMINAL2); - radioline(&cp, "Local ec&ho:", IDC_ECHOSTATIC, 3, + radioline(&cp, "&Local echo:", IDC_ECHOSTATIC, 3, "Auto", IDC_ECHOBACKEND, "Force on", IDC_ECHOYES, "Force off", IDC_ECHONO, NULL); radioline(&cp, "Local line edi&ting:", IDC_EDITSTATIC, 3, "Auto", IDC_EDITBACKEND, "Force on", IDC_EDITYES, "Force off", IDC_EDITNO, NULL); endbox(&cp); + + beginbox(&cp, "Remote-controlled printing", IDC_BOX_TERMINAL3); + combobox(&cp, "&Printer to send ANSI printer output to:", + IDC_PRINTERSTATIC, IDC_PRINTER); + endbox(&cp); + } + + if (panel == featurespanelstart) { + /* The Features panel. Accelerators used: [acgoh] ukswtbrx */ + struct ctlpos cp; + ctlposinit(&cp, hwnd, 80, 3, 13); + bartitle(&cp, "Enabling and disabling advanced terminal features ", + IDC_TITLE_FEATURES); + beginbox(&cp, NULL, IDC_BOX_FEATURES1); + checkbox(&cp, "Disable application c&ursor keys mode", IDC_NOAPPLICC); + checkbox(&cp, "Disable application &keypad mode", IDC_NOAPPLICK); + checkbox(&cp, "Disable &xterm-style mouse reporting", IDC_NOMOUSEREP); + checkbox(&cp, "Disable remote-controlled terminal re&sizing", + IDC_NORESIZE); + checkbox(&cp, "Disable s&witching to alternate terminal screen", + IDC_NOALTSCREEN); + checkbox(&cp, "Disable remote-controlled window &title changing", + IDC_NOWINTITLE); + checkbox(&cp, "Disable destructive &backspace on server sending ^?", + IDC_NODBACKSPACE); + checkbox(&cp, "Disable remote-controlled cha&racter set configuration", + IDC_NOCHARSET); + endbox(&cp); } if (panel == bellpanelstart) { - /* The Bell panel. Accelerators used: [acgo] bdsm wit */ + /* The Bell panel. Accelerators used: [acgoh] bdsm wit */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Options controlling the terminal bell", @@ -1349,7 +1448,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == keyboardpanelstart) { - /* The Keyboard panel. Accelerators used: [acgo] bhf ruyntd */ + /* The Keyboard panel. Accelerators used: [acgoh] bef rntd */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Options controlling the effects of keys", @@ -1358,7 +1457,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) radioline(&cp, "The &Backspace key", IDC_DELSTATIC, 2, "Control-H", IDC_DEL008, "Control-? (127)", IDC_DEL127, NULL); - radioline(&cp, "The &Home and End keys", IDC_HOMESTATIC, 2, + radioline(&cp, "The Home and &End keys", IDC_HOMESTATIC, 2, "Standard", IDC_HOMETILDE, "rxvt", IDC_HOMERXVT, NULL); radioline(&cp, "The &Function keys and keypad", IDC_FUNCSTATIC, 3, "ESC[n~", IDC_FUNCTILDE, @@ -1368,15 +1467,9 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) "VT100+", IDC_FUNCVT100P, "SCO", IDC_FUNCSCO, NULL); endbox(&cp); beginbox(&cp, "Application keypad settings:", IDC_BOX_KEYBOARD2); - checkbox(&cp, - "Application c&ursor keys totally disabled", - IDC_NOAPPLICC); radioline(&cp, "Initial state of cu&rsor keys:", IDC_CURSTATIC, 2, "Normal", IDC_CURNORMAL, "Application", IDC_CURAPPLIC, NULL); - checkbox(&cp, - "Application ke&ypad keys totally disabled", - IDC_NOAPPLICK); radioline(&cp, "Initial state of &numeric keypad:", IDC_KPSTATIC, 3, "Normal", IDC_KPNORMAL, "Application", IDC_KPAPPLIC, "NetHack", IDC_KPNH, NULL); @@ -1390,7 +1483,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == windowpanelstart) { - /* The Window panel. Accelerators used: [acgo] rmz sdikp */ + /* The Window panel. Accelerators used: [acgoh] rmz sdikp */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Options controlling PuTTY's window", @@ -1418,7 +1511,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == appearancepanelstart) { - /* The Appearance panel. Accelerators used: [acgo] luvb h ti p s */ + /* The Appearance panel. Accelerators used: [acgoh] luvb n ti p s */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Configure the appearance of PuTTY's window", @@ -1432,7 +1525,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) endbox(&cp); beginbox(&cp, "Set the font used in the terminal window", IDC_BOX_APPEARANCE2); - staticbtn(&cp, "", IDC_FONTSTATIC, "C&hange...", IDC_CHOOSEFONT); + staticbtn(&cp, "", IDC_FONTSTATIC, "Cha&nge...", IDC_CHOOSEFONT); endbox(&cp); beginbox(&cp, "Adjust the use of the window title", IDC_BOX_APPEARANCE3); @@ -1454,7 +1547,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == behaviourpanelstart) { - /* The Behaviour panel. Accelerators used: [acgo] w4yltf */ + /* The Behaviour panel. Accelerators used: [acgoh] w4yltf */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Configure the behaviour of PuTTY's window", @@ -1470,7 +1563,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == translationpanelstart) { - /* The Translation panel. Accelerators used: [acgo] rxbepus */ + /* The Translation panel. Accelerators used: [acgoh] rxbepus */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Options controlling character set translation", @@ -1498,7 +1591,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == selectionpanelstart) { - /* The Selection panel. Accelerators used: [acgo] df wxp hst nr */ + /* The Selection panel. Accelerators used: [acgoh] df wxp est nr */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Options controlling copy and paste", @@ -1529,14 +1622,14 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) endbox(&cp); beginbox(&cp, "Control the select-one-word-at-a-time mode", IDC_BOX_SELECTION3); - charclass(&cp, "C&haracter classes:", IDC_CCSTATIC, IDC_CCLIST, + charclass(&cp, "Charact&er classes:", IDC_CCSTATIC, IDC_CCLIST, "&Set", IDC_CCSET, IDC_CCEDIT, "&to class", IDC_CCSTATIC2); endbox(&cp); } if (panel == colourspanelstart) { - /* The Colours panel. Accelerators used: [acgo] blum */ + /* The Colours panel. Accelerators used: [acgoh] blum */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Options controlling use of colours", @@ -1559,7 +1652,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == connectionpanelstart) { - /* The Connection panel. Accelerators used: [acgo] tukn */ + /* The Connection panel. Accelerators used: [acgoh] tukn */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Options controlling the connection", @@ -1576,6 +1669,8 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) beginbox(&cp, "Adjust telnet session.", IDC_BOX_CONNECTION1); checkbox(&cp, "Keyboard sends telnet Backspace and Interrupt", IDC_TELNETKEY); + checkbox(&cp, "Return key sends telnet New Line instead of ^M", + IDC_TELNETRET); endbox(&cp); } beginbox(&cp, "Sending of null packets to keep session active", @@ -1593,7 +1688,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == telnetpanelstart) { - /* The Telnet panel. Accelerators used: [acgo] svldr bftk */ + /* The Telnet panel. Accelerators used: [acgoh] svldr bftk */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); if (dlgtype == 0) { @@ -1616,12 +1711,14 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) IDC_TACTIVE, NULL); checkbox(&cp, "&Keyboard sends telnet Backspace and Interrupt", IDC_TELNETKEY); + checkbox(&cp, "Return key sends telnet New Line instead of ^M", + IDC_TELNETRET); endbox(&cp); } } if (panel == rloginpanelstart) { - /* The Rlogin panel. Accelerators used: [acgo] sl */ + /* The Rlogin panel. Accelerators used: [acgoh] sl */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); if (dlgtype == 0) { @@ -1637,7 +1734,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == sshpanelstart) { - /* The SSH panel. Accelerators used: [acgo] r pe12i sd */ + /* The SSH panel. Accelerators used: [acgoh] r pe12i sd */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); if (dlgtype == 0) { @@ -1668,7 +1765,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == sshauthpanelstart) { - /* The SSH authentication panel. Accelerators used: [acgo] m fkiw */ + /* The SSH authentication panel. Accelerators used: [acgoh] m fkiuw */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); if (dlgtype == 0) { @@ -1694,7 +1791,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == tunnelspanelstart) { - /* The Tunnels panel. Accelerators used: [acgo] deilmrstx */ + /* The Tunnels panel. Accelerators used: [acgoh] deilmrstxp */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); if (dlgtype == 0) { @@ -1706,7 +1803,10 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) IDC_X11_DISPLAY, 50, NULL); endbox(&cp); beginbox(&cp, "Port forwarding", IDC_BOX_TUNNELS2); - checkbox(&cp, "Local ports accept connections from o&ther hosts", IDC_LPORT_ALL); + checkbox(&cp, "Local ports accept connections from o&ther hosts", + IDC_LPORT_ALL); + checkbox(&cp, "Remote &ports do the same (SSH v2 only)", + IDC_RPORT_ALL); staticbtn(&cp, "Forwarded ports:", IDC_PFWDSTATIC, "&Remove", IDC_PFWDREMOVE); fwdsetter(&cp, IDC_PFWDLIST, @@ -1715,7 +1815,8 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) "Dest&ination", IDC_DPORTSTATIC, IDC_DPORTEDIT, "A&dd", IDC_PFWDADD); bareradioline(&cp, 2, - "&Local", IDC_PFWDLOCAL, "Re&mote", IDC_PFWDREMOTE, NULL); + "&Local", IDC_PFWDLOCAL, + "Re&mote", IDC_PFWDREMOTE, NULL); endbox(&cp); } @@ -1847,6 +1948,7 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, treeview_insert(&tvfaff, 0, "Terminal"); treeview_insert(&tvfaff, 1, "Keyboard"); treeview_insert(&tvfaff, 1, "Bell"); + treeview_insert(&tvfaff, 1, "Features"); treeview_insert(&tvfaff, 0, "Window"); treeview_insert(&tvfaff, 1, "Appearance"); treeview_insert(&tvfaff, 1, "Behaviour"); @@ -1926,6 +2028,8 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, create_controls(hwnd, dlgtype, terminalpanelstart); if (!strcmp(buffer, "Bell")) create_controls(hwnd, dlgtype, bellpanelstart); + if (!strcmp(buffer, "Features")) + create_controls(hwnd, dlgtype, featurespanelstart); if (!strcmp(buffer, "Window")) create_controls(hwnd, dlgtype, windowpanelstart); if (!strcmp(buffer, "Appearance")) @@ -2016,10 +2120,22 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, cfg.protocol = i ? PROT_SSH : j ? PROT_TELNET : k ? PROT_RLOGIN : PROT_RAW; - if ((cfg.protocol == PROT_SSH && cfg.port != 22) - || (cfg.protocol == PROT_TELNET && cfg.port != 23) - || (cfg.protocol == PROT_RLOGIN - && cfg.port != 513)) { + /* + * When switching using the arrow keys, we + * appear to get two of these messages, both + * mentioning the target button in + * LOWORD(wParam), but one of them called while + * the previous button is still checked. This + * causes an unnecessary reset of the port + * number field, which we fix by ensuring here + * that the button selected is indeed the one + * checked. + */ + if (IsDlgButtonChecked(hwnd, LOWORD(wParam)) && + ((cfg.protocol == PROT_SSH && cfg.port != 22) + || (cfg.protocol == PROT_TELNET && cfg.port != 23) + || (cfg.protocol == PROT_RLOGIN + && cfg.port != 513))) { cfg.port = i ? 22 : j ? 23 : 513; SetDlgItemInt(hwnd, IDC_PORT, cfg.port, FALSE); } @@ -2235,6 +2351,42 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, cfg.no_applic_k = IsDlgButtonChecked(hwnd, IDC_NOAPPLICK); break; + case IDC_NOMOUSEREP: + if (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) + cfg.no_mouse_rep = + IsDlgButtonChecked(hwnd, IDC_NOMOUSEREP); + break; + case IDC_NORESIZE: + if (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) + cfg.no_remote_resize = + IsDlgButtonChecked(hwnd, IDC_NORESIZE); + break; + case IDC_NOALTSCREEN: + if (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) + cfg.no_alt_screen = + IsDlgButtonChecked(hwnd, IDC_NOALTSCREEN); + break; + case IDC_NOWINTITLE: + if (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) + cfg.no_remote_wintitle = + IsDlgButtonChecked(hwnd, IDC_NOWINTITLE); + break; + case IDC_NODBACKSPACE: + if (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) + cfg.no_dbackspace = + IsDlgButtonChecked(hwnd, IDC_NODBACKSPACE); + break; + case IDC_NOCHARSET: + if (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) + cfg.no_remote_charset = + IsDlgButtonChecked(hwnd, IDC_NOCHARSET); + break; case IDC_ALTF4: if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) @@ -2325,6 +2477,12 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, cfg.telnet_keyboard = IsDlgButtonChecked(hwnd, IDC_TELNETKEY); break; + case IDC_TELNETRET: + if (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) + cfg.telnet_newline = + IsDlgButtonChecked(hwnd, IDC_TELNETRET); + break; case IDC_WRAPMODE: if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) @@ -2982,6 +3140,19 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, SetDlgItemText(hwnd, IDC_CODEPAGE, cfg.line_codepage); } break; + case IDC_PRINTER: + if (HIWORD(wParam) == CBN_SELCHANGE) { + int index = SendDlgItemMessage(hwnd, IDC_PRINTER, + CB_GETCURSEL, 0, 0); + SendDlgItemMessage(hwnd, IDC_PRINTER, CB_GETLBTEXT, + index, (LPARAM)cfg.printer); + } else if (HIWORD(wParam) == CBN_EDITCHANGE) { + GetDlgItemText(hwnd, IDC_PRINTER, cfg.printer, + sizeof(cfg.printer) - 1); + } + if (!strcmp(cfg.printer, PRINTER_DISABLED_STRING)) + *cfg.printer = '\0'; + break; case IDC_CAPSLOCKCYR: if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) { @@ -3007,14 +3178,20 @@ static int GenericMainDlgProc(HWND hwnd, UINT msg, case IDC_X11_FORWARD: if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) - cfg.x11_forward = - IsDlgButtonChecked(hwnd, IDC_X11_FORWARD); + cfg.x11_forward = + IsDlgButtonChecked(hwnd, IDC_X11_FORWARD); break; case IDC_LPORT_ALL: if (HIWORD(wParam) == BN_CLICKED || HIWORD(wParam) == BN_DOUBLECLICKED) - cfg.lport_acceptall = - IsDlgButtonChecked(hwnd, IDC_LPORT_ALL); + cfg.lport_acceptall = + IsDlgButtonChecked(hwnd, IDC_LPORT_ALL); + break; + case IDC_RPORT_ALL: + if (HIWORD(wParam) == BN_CLICKED || + HIWORD(wParam) == BN_DOUBLECLICKED) + cfg.rport_acceptall = + IsDlgButtonChecked(hwnd, IDC_RPORT_ALL); break; case IDC_X11_DISPLAY: if (HIWORD(wParam) == EN_CHANGE) @@ -3319,7 +3496,7 @@ void verify_ssh_host_key(char *host, int port, char *keytype, if (mbret == IDYES) store_host_key(host, port, keytype, keystr); if (mbret == IDCANCEL) - exit(0); + cleanup_exit(0); } if (ret == 1) { /* key was absent */ int mbret; @@ -3329,7 +3506,7 @@ void verify_ssh_host_key(char *host, int port, char *keytype, if (mbret == IDYES) store_host_key(host, port, keytype, keystr); if (mbret == IDCANCEL) - exit(0); + cleanup_exit(0); } } @@ -3360,7 +3537,7 @@ void askcipher(char *ciphername, int cs) if (mbret == IDYES) return; else - exit(0); + cleanup_exit(0); } /*