1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

Add two more ghastly function key options. WE HAVE TOO MANY!

[originally from svn r1050]
This commit is contained in:
Simon Tatham 2001-04-16 16:16:52 +00:00
parent 639ab4c068
commit 19d76c9306
3 changed files with 62 additions and 31 deletions

View File

@ -174,6 +174,10 @@ void radioline(struct ctlpos *cp,
int bid;
if (!btext)
break;
if (i==nacross) {
cp->ypos += r.bottom + GAPBETWEEN;
i=0;
}
bid = va_arg(ap, int);
nextbtext = va_arg(ap, char *);
r.left = GAPBETWEEN + i * (cp->width+GAPBETWEEN)/nacross;

View File

@ -254,6 +254,8 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
IDC_FUNCLINUX,
IDC_FUNCXTERM,
IDC_FUNCVT400,
IDC_FUNCVT100P,
IDC_FUNCSCO,
IDC_KPSTATIC,
IDC_KPNORMAL,
IDC_KPAPPLIC,
@ -536,11 +538,13 @@ static void init_dlg_ctrls(HWND hwnd) {
cfg.bksp_is_delete ? IDC_DEL127 : IDC_DEL008);
CheckRadioButton (hwnd, IDC_HOMETILDE, IDC_HOMERXVT,
cfg.rxvt_homeend ? IDC_HOMERXVT : IDC_HOMETILDE);
CheckRadioButton (hwnd, IDC_FUNCTILDE, IDC_FUNCVT400,
CheckRadioButton (hwnd, IDC_FUNCTILDE, IDC_FUNCSCO,
cfg.funky_type == 0 ? IDC_FUNCTILDE :
cfg.funky_type == 1 ? IDC_FUNCLINUX :
cfg.funky_type == 2 ? IDC_FUNCXTERM :
cfg.funky_type == 3 ? IDC_FUNCVT400 :
cfg.funky_type == 4 ? IDC_FUNCVT100P :
cfg.funky_type == 5 ? IDC_FUNCSCO :
IDC_FUNCTILDE );
CheckDlgButton (hwnd, IDC_NOAPPLICC, cfg.no_applic_c);
CheckDlgButton (hwnd, IDC_NOAPPLICK, cfg.no_applic_k);
@ -861,40 +865,44 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
}
if (panel == keyboardpanelstart) {
/* The Keyboard panel. Accelerators used: [acgo] h?sr~lxvunpymietd */
/* The Keyboard panel. Accelerators used: [acgo] bhf ruyntd */
struct ctlpos cp;
ctlposinit(&cp, hwnd, 80, 3, 13);
/*
bartitle(&cp, "Options controlling the effects of keys",
IDC_TITLE_KEYBOARD);
*/
beginbox(&cp, "Change the sequences sent by:",
IDC_BOX_KEYBOARD1);
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,
"&Standard", IDC_HOMETILDE,
"&rxvt", IDC_HOMERXVT, NULL);
radioline(&cp, "The Function keys and keypad", IDC_FUNCSTATIC, 4,
"ESC[n&~", IDC_FUNCTILDE,
"&Linux", IDC_FUNCLINUX,
"&Xterm R6", IDC_FUNCXTERM,
"&VT400", IDC_FUNCVT400, NULL);
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,
"Standard", IDC_HOMETILDE,
"rxvt", IDC_HOMERXVT, NULL);
radioline(&cp, "The &Function keys and keypad", IDC_FUNCSTATIC, 3,
"ESC[n~", IDC_FUNCTILDE,
"Linux", IDC_FUNCLINUX,
"Xterm R6", IDC_FUNCXTERM,
"VT400", IDC_FUNCVT400,
"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 cursor keys:", IDC_CURSTATIC, 2,
"&Normal", IDC_CURNORMAL,
"A&pplication", IDC_CURAPPLIC, NULL);
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,
"Nor&mal", IDC_KPNORMAL,
"Appl&ication", IDC_KPAPPLIC,
"N&etHack", IDC_KPNH, NULL);
radioline(&cp, "Initial state of &numeric keypad:", IDC_KPSTATIC, 3,
"Normal", IDC_KPNORMAL,
"Application", IDC_KPAPPLIC,
"NetHack", IDC_KPNH, NULL);
endbox(&cp);
beginbox(&cp, "Enable extra keyboard features:",
IDC_BOX_KEYBOARD3);
@ -1500,21 +1508,22 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.rxvt_homeend = IsDlgButtonChecked (hwnd, IDC_HOMERXVT);
break;
case IDC_FUNCXTERM:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.funky_type = 2;
break;
case IDC_FUNCVT400:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.funky_type = 3;
break;
case IDC_FUNCTILDE:
case IDC_FUNCLINUX:
case IDC_FUNCXTERM:
case IDC_FUNCVT400:
case IDC_FUNCVT100P:
case IDC_FUNCSCO:
if (HIWORD(wParam) == BN_CLICKED ||
HIWORD(wParam) == BN_DOUBLECLICKED)
cfg.funky_type = IsDlgButtonChecked (hwnd, IDC_FUNCLINUX);
switch (LOWORD(wParam)) {
case IDC_FUNCTILDE: cfg.funky_type = 0; break;
case IDC_FUNCLINUX: cfg.funky_type = 1; break;
case IDC_FUNCXTERM: cfg.funky_type = 2; break;
case IDC_FUNCVT400: cfg.funky_type = 3; break;
case IDC_FUNCVT100P: cfg.funky_type = 4; break;
case IDC_FUNCSCO: cfg.funky_type = 5; break;
}
break;
case IDC_KPNORMAL:
case IDC_KPAPPLIC:

View File

@ -2321,6 +2321,24 @@ static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
/* Reorder edit keys to physical order */
if (cfg.funky_type == 3 && code <= 6 ) code = "\0\2\1\4\5\3\6"[code];
if (vt52_mode && code > 0 && code <= 6) {
p += sprintf((char *)p, "\x1B%c", " HLMEIG"[code]);
return p - output;
}
if (cfg.funky_type == 5 && code >= 11 && code <= 24) {
p += sprintf((char *)p, "\x1B[%c", code + 'M' - 11);
return p - output;
}
if ((vt52_mode || cfg.funky_type == 4) && code >= 11 && code <= 24) {
int offt = 0;
if (code>15) offt++; if (code>21) offt++;
if (vt52_mode)
p += sprintf((char *)p, "\x1B%c", code + 'P' - 11 - offt);
else
p += sprintf((char *)p, "\x1BO%c", code + 'P' - 11 - offt);
return p - output;
}
if (cfg.funky_type == 1 && code >= 11 && code <= 15) {
p += sprintf((char *)p, "\x1B[[%c", code + 'A' - 11);
return p - output;