X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/0d2086c5db1f23869109ba6776cb6d2e6037714c..e6f8202f682fa90aa3c7b645e6d7e80bed5c176c:/windlg.c?ds=sidebyside diff --git a/windlg.c b/windlg.c index a05ac077..316115e5 100644 --- a/windlg.c +++ b/windlg.c @@ -27,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; @@ -307,6 +309,7 @@ enum { IDCX_ABOUT = IDC_TITLE_TERMINAL, IDC_BOX_TERMINAL1, IDC_BOX_TERMINAL2, + IDC_BOX_TERMINAL3, IDC_WRAPMODE, IDC_DECOM, IDC_LFHASCR, @@ -322,6 +325,8 @@ enum { IDCX_ABOUT = IDC_EDITBACKEND, IDC_EDITYES, IDC_EDITNO, + IDC_PRINTERSTATIC, + IDC_PRINTER, terminalpanelend, featurespanelstart, @@ -329,6 +334,7 @@ enum { IDCX_ABOUT = IDC_BOX_FEATURES1, IDC_NOAPPLICK, IDC_NOAPPLICC, + IDC_NOMOUSEREP, IDC_NORESIZE, IDC_NOALTSCREEN, IDC_NOWINTITLE, @@ -687,6 +693,8 @@ char *help_context_cmd(int id) 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: @@ -721,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: @@ -989,6 +1000,7 @@ 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); @@ -1199,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 : @@ -1326,7 +1356,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == terminalpanelstart) { - /* The Terminal panel. Accelerators used: [acgoh] wdren lts */ + /* 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", @@ -1350,10 +1380,15 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) "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] uksvatbr */ + /* The Features panel. Accelerators used: [acgoh] ukswtbrx */ struct ctlpos cp; ctlposinit(&cp, hwnd, 80, 3, 13); bartitle(&cp, "Enabling and disabling advanced terminal features ", @@ -1361,9 +1396,10 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) 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 switching to &alternate terminal screen", + checkbox(&cp, "Disable s&witching to alternate terminal screen", IDC_NOALTSCREEN); checkbox(&cp, "Disable remote-controlled window &title changing", IDC_NOWINTITLE); @@ -1412,7 +1448,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) } if (panel == keyboardpanelstart) { - /* The Keyboard panel. Accelerators used: [acgoh] bef 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", @@ -2315,6 +2351,12 @@ 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) @@ -3098,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) {