mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
Add ISO-8859-2 / Win-1250 char set translation
[originally from svn r318]
This commit is contained in:
parent
e0baec8159
commit
1c73cba012
1
putty.h
1
putty.h
@ -145,6 +145,7 @@ typedef struct {
|
|||||||
short wordness[256];
|
short wordness[256];
|
||||||
/* russian language translation */
|
/* russian language translation */
|
||||||
int xlat_enablekoiwin;
|
int xlat_enablekoiwin;
|
||||||
|
int xlat_88592w1250;
|
||||||
int xlat_capslockcyr;
|
int xlat_capslockcyr;
|
||||||
} Config;
|
} Config;
|
||||||
|
|
||||||
|
@ -130,7 +130,10 @@
|
|||||||
#define IDC5_BVALUE 1010
|
#define IDC5_BVALUE 1010
|
||||||
#define IDC5_CHANGE 1011
|
#define IDC5_CHANGE 1011
|
||||||
|
|
||||||
#define IDC6_ENABLEKOIWINXLAT 1001
|
#define IDC6_XLATSTATIC 1001
|
||||||
#define IDC6_CAPSLOCKCYR 1002
|
#define IDC6_NOXLAT 1002
|
||||||
|
#define IDC6_KOI8WIN1251 1003
|
||||||
|
#define IDC6_88592WIN1250 1004
|
||||||
|
#define IDC6_CAPSLOCKCYR 1005
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
11
win_res.rc
11
win_res.rc
@ -220,10 +220,15 @@ IDD_PANEL6 DIALOG DISCARDABLE 6, 30, 168, 163
|
|||||||
STYLE WS_CHILD | WS_VISIBLE
|
STYLE WS_CHILD | WS_VISIBLE
|
||||||
FONT 8, "MS Sans Serif"
|
FONT 8, "MS Sans Serif"
|
||||||
BEGIN
|
BEGIN
|
||||||
AUTOCHECKBOX "Enable &KOI8-Win1251 translation",
|
LTEXT "Character set translation:", IDC6_XLATSTATIC, 3, 3, 162, 8
|
||||||
IDC6_ENABLEKOIWINXLAT, 13, 14, 135, 10
|
AUTORADIOBUTTON "&None",
|
||||||
|
IDC6_NOXLAT, 3, 12, 162, 10, WS_GROUP
|
||||||
|
AUTORADIOBUTTON "&KOI8 / Win-1251",
|
||||||
|
IDC6_KOI8WIN1251, 3, 22, 162, 10
|
||||||
|
AUTORADIOBUTTON "&ISO-8859-2 / Win-1250",
|
||||||
|
IDC6_88592WIN1250, 3, 32, 162, 10
|
||||||
AUTOCHECKBOX "&CAPS LOCK acts as cyrillic switch",
|
AUTOCHECKBOX "&CAPS LOCK acts as cyrillic switch",
|
||||||
IDC6_CAPSLOCKCYR, 13, 30, 136, 10
|
IDC6_CAPSLOCKCYR, 3, 46, 162, 10
|
||||||
END
|
END
|
||||||
|
|
||||||
IDD_LOGBOX DIALOG DISCARDABLE 100, 20, 160, 119
|
IDD_LOGBOX DIALOG DISCARDABLE 100, 20, 160, 119
|
||||||
|
20
windlg.c
20
windlg.c
@ -192,6 +192,7 @@ static void save_settings (char *section, int do_host) {
|
|||||||
wpps (sesskey, buf, buf2);
|
wpps (sesskey, buf, buf2);
|
||||||
}
|
}
|
||||||
wppi (sesskey, "KoiWinXlat", cfg.xlat_enablekoiwin);
|
wppi (sesskey, "KoiWinXlat", cfg.xlat_enablekoiwin);
|
||||||
|
wppi (sesskey, "88592Xlat", cfg.xlat_88592w1250);
|
||||||
wppi (sesskey, "CapsLockCyr", cfg.xlat_capslockcyr);
|
wppi (sesskey, "CapsLockCyr", cfg.xlat_capslockcyr);
|
||||||
|
|
||||||
RegCloseKey(sesskey);
|
RegCloseKey(sesskey);
|
||||||
@ -345,6 +346,7 @@ static void load_settings (char *section, int do_host) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
gppi (sesskey, "KoiWinXlat", 0, &cfg.xlat_enablekoiwin);
|
gppi (sesskey, "KoiWinXlat", 0, &cfg.xlat_enablekoiwin);
|
||||||
|
gppi (sesskey, "88592Xlat", 0, &cfg.xlat_88592w1250);
|
||||||
gppi (sesskey, "CapsLockCyr", 0, &cfg.xlat_capslockcyr);
|
gppi (sesskey, "CapsLockCyr", 0, &cfg.xlat_capslockcyr);
|
||||||
|
|
||||||
RegCloseKey(sesskey);
|
RegCloseKey(sesskey);
|
||||||
@ -1151,16 +1153,20 @@ static int CALLBACK LanguageProc (HWND hwnd, UINT msg,
|
|||||||
WPARAM wParam, LPARAM lParam) {
|
WPARAM wParam, LPARAM lParam) {
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
CheckDlgButton (hwnd, IDC6_ENABLEKOIWINXLAT, cfg.xlat_enablekoiwin);
|
CheckRadioButton (hwnd, IDC6_NOXLAT, IDC6_88592WIN1250,
|
||||||
|
cfg.xlat_88592w1250 ? IDC6_88592WIN1250 :
|
||||||
|
cfg.xlat_enablekoiwin ? IDC6_KOI8WIN1251 :
|
||||||
|
IDC6_NOXLAT);
|
||||||
CheckDlgButton (hwnd, IDC6_CAPSLOCKCYR, cfg.xlat_capslockcyr);
|
CheckDlgButton (hwnd, IDC6_CAPSLOCKCYR, cfg.xlat_capslockcyr);
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
switch (LOWORD(wParam)) {
|
switch (LOWORD(wParam)) {
|
||||||
case IDC6_ENABLEKOIWINXLAT:
|
case IDC6_NOXLAT:
|
||||||
if (HIWORD(wParam) == BN_CLICKED ||
|
case IDC6_KOI8WIN1251:
|
||||||
HIWORD(wParam) == BN_DOUBLECLICKED) {
|
case IDC6_88592WIN1250:
|
||||||
cfg.xlat_enablekoiwin =
|
cfg.xlat_enablekoiwin =
|
||||||
IsDlgButtonChecked (hwnd, IDC6_ENABLEKOIWINXLAT);
|
IsDlgButtonChecked (hwnd, IDC6_KOI8WIN1251);
|
||||||
}
|
cfg.xlat_88592w1250 =
|
||||||
|
IsDlgButtonChecked (hwnd, IDC6_88592WIN1250);
|
||||||
break;
|
break;
|
||||||
case IDC6_CAPSLOCKCYR:
|
case IDC6_CAPSLOCKCYR:
|
||||||
if (HIWORD(wParam) == BN_CLICKED ||
|
if (HIWORD(wParam) == BN_CLICKED ||
|
||||||
|
44
xlat.c
44
xlat.c
@ -42,10 +42,52 @@ static unsigned char koi2win[] =
|
|||||||
207,223,208,209,210,211,198,194,220,219,199,216,221,217,215,218
|
207,223,208,209,210,211,198,194,220,219,199,216,221,217,215,218
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static unsigned char xlatWIN1250toISO88592[] =
|
||||||
|
{
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||||
|
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||||
|
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
||||||
|
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
|
||||||
|
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
||||||
|
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
|
||||||
|
96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
|
||||||
|
112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
|
||||||
|
128,129, 39,131, 34, 46,124,124,136, 47,169, 60,166,171,174,172,
|
||||||
|
144, 96, 39, 34, 34, 42, 45, 45,152, 84,185, 62,182,187,190,188,
|
||||||
|
160,183,162,163,164,161,124,167,168, 99,170, 34, 39,173, 82,175,
|
||||||
|
176, 63,178,179,180,117,182,255,184,177,186, 34,165,189,181,191,
|
||||||
|
192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
|
||||||
|
208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
|
||||||
|
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
|
||||||
|
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
|
||||||
|
};
|
||||||
|
|
||||||
|
static unsigned char xlatISO88592toWIN1250[] =
|
||||||
|
{
|
||||||
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
|
||||||
|
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
|
||||||
|
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
|
||||||
|
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
|
||||||
|
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
|
||||||
|
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
|
||||||
|
96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,
|
||||||
|
112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,
|
||||||
|
128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
|
||||||
|
144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
|
||||||
|
160,165,162,163,164,188,140,167,168,138,170,141,143,173,142,175,
|
||||||
|
176,185,178,179,180,190,156,161,184,154,186,157,159,189,158,191,
|
||||||
|
192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
|
||||||
|
208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,
|
||||||
|
224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,
|
||||||
|
240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255
|
||||||
|
};
|
||||||
|
|
||||||
unsigned char xlat_kbd2tty(unsigned char c)
|
unsigned char xlat_kbd2tty(unsigned char c)
|
||||||
{
|
{
|
||||||
if(cfg.xlat_enablekoiwin)
|
if(cfg.xlat_enablekoiwin)
|
||||||
return win2koi[c];
|
return win2koi[c];
|
||||||
|
else if (cfg.xlat_88592w1250)
|
||||||
|
return xlatWIN1250toISO88592[c];
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,6 +95,8 @@ unsigned char xlat_tty2scr(unsigned char c)
|
|||||||
{
|
{
|
||||||
if(cfg.xlat_enablekoiwin)
|
if(cfg.xlat_enablekoiwin)
|
||||||
return koi2win[c];
|
return koi2win[c];
|
||||||
|
else if (cfg.xlat_88592w1250)
|
||||||
|
return xlatISO88592toWIN1250[c];
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user