| 295 |
MainBottom = NumOfColumns-1; |
MainBottom = NumOfColumns-1; |
| 296 |
} |
} |
| 297 |
|
|
| 298 |
|
void SendCSIstr(char *str, int len) { |
| 299 |
|
if (str == NULL || len <= 0) |
| 300 |
|
return; |
| 301 |
|
|
| 302 |
|
if (Send8BitMode) |
| 303 |
|
CommBinaryOut(&cv,"\233", 1); |
| 304 |
|
else |
| 305 |
|
CommBinaryOut(&cv,"\033[", 2); |
| 306 |
|
|
| 307 |
|
CommBinaryOut(&cv, str, len); |
| 308 |
|
} |
| 309 |
|
|
| 310 |
|
void SendOSCstr(char *str, int len) { |
| 311 |
|
if (str == NULL || len <= 0) |
| 312 |
|
return; |
| 313 |
|
|
| 314 |
|
if (Send8BitMode) |
| 315 |
|
CommBinaryOut(&cv,"\235", 1); |
| 316 |
|
else |
| 317 |
|
CommBinaryOut(&cv,"\033]", 2); |
| 318 |
|
|
| 319 |
|
CommBinaryOut(&cv, str, len); |
| 320 |
|
} |
| 321 |
|
|
| 322 |
void BackSpace() |
void BackSpace() |
| 323 |
{ |
{ |
| 324 |
if (CursorX == 0) |
if (CursorX == 0) |
| 1567 |
void CS_n_Mode() |
void CS_n_Mode() |
| 1568 |
{ |
{ |
| 1569 |
char Report[16]; |
char Report[16]; |
| 1570 |
int Y; |
int Y, len; |
| 1571 |
|
|
| 1572 |
switch (Param[1]) { |
switch (Param[1]) { |
| 1573 |
case 5: |
case 5: |
| 1574 |
/* Device Status Report -> Ready */ |
/* Device Status Report -> Ready */ |
| 1575 |
if (Send8BitMode) |
SendCSIstr("0n", 2); |
|
CommBinaryOut(&cv,"\2330n",3); |
|
|
else |
|
|
CommBinaryOut(&cv,"\033[0n",4); |
|
| 1576 |
break; |
break; |
| 1577 |
case 6: |
case 6: |
| 1578 |
/* Cursor Position Report */ |
/* Cursor Position Report */ |
| 1580 |
if ((StatusLine>0) && |
if ((StatusLine>0) && |
| 1581 |
(Y==NumOfLines)) |
(Y==NumOfLines)) |
| 1582 |
Y = 1; |
Y = 1; |
| 1583 |
if (Send8BitMode) |
len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "%u;%uR", CLocale, Y, CursorX+1); |
| 1584 |
_snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "\233%u;%uR", CLocale, Y, CursorX+1); |
SendCSIstr(Report, len); |
|
else |
|
|
_snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "\033[%u;%uR", CLocale, Y, CursorX+1); |
|
|
CommBinaryOut(&cv,Report,strlen(Report)); |
|
| 1585 |
break; |
break; |
| 1586 |
} |
} |
| 1587 |
} |
} |
| 1778 |
|
|
| 1779 |
void CSSunSequence() /* Sun terminal private sequences */ |
void CSSunSequence() /* Sun terminal private sequences */ |
| 1780 |
{ |
{ |
| 1781 |
int x, y; |
int x, y, len; |
| 1782 |
char Report[16]; |
char Report[16]; |
| 1783 |
|
|
| 1784 |
switch (Param[1]) { |
switch (Param[1]) { |
| 1821 |
} |
} |
| 1822 |
break; |
break; |
| 1823 |
case 11: // Report window state |
case 11: // Report window state |
| 1824 |
if (Send8BitMode) |
len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "%dt", CLocale, DispWindowIconified()?2:1); |
| 1825 |
_snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "\233%dt", CLocale, DispWindowIconified()?2:1); |
SendCSIstr(Report, len); |
|
else |
|
|
_snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "\033[%dt", CLocale, DispWindowIconified()?2:1); |
|
|
CommBinaryOut(&cv,Report,strlen(Report)); |
|
| 1826 |
break; |
break; |
| 1827 |
case 13: // Report window position |
case 13: // Report window position |
| 1828 |
DispGetWindowPos(&x, &y); |
DispGetWindowPos(&x, &y); |
| 1829 |
if (Send8BitMode) |
len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "3;%d;%dt", CLocale, x, y); |
| 1830 |
_snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "\2333;%d;%dt", CLocale, x, y); |
SendCSIstr(Report, len); |
|
else |
|
|
_snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "\033[3;%d;%dt", CLocale, x, y); |
|
|
CommBinaryOut(&cv,Report,strlen(Report)); |
|
| 1831 |
break; |
break; |
| 1832 |
case 14: /* get window size??? */ |
case 14: /* get window size??? */ |
| 1833 |
/* this is not actual window size */ |
/* this is not actual window size */ |
| 1834 |
if (Send8BitMode) |
SendCSIstr("4;640;480t", 10); |
|
CommBinaryOut(&cv,"\2334;640;480t",11); |
|
|
else |
|
|
CommBinaryOut(&cv,"\033[4;640;480t",12); |
|
| 1835 |
break; |
break; |
| 1836 |
case 18: /* get terminal size */ |
case 18: /* get terminal size */ |
| 1837 |
if (Send8BitMode) |
len = _snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "8;%u;%u;t", CLocale, NumOfLines-StatusLine, NumOfColumns); |
| 1838 |
_snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "\2338;%u;%u;t", CLocale, NumOfLines-StatusLine, NumOfColumns); |
SendCSIstr(Report, len); |
|
else |
|
|
_snprintf_s_l(Report, sizeof(Report), _TRUNCATE, "\033[8;%u;%u;t", CLocale, NumOfLines-StatusLine, NumOfColumns); |
|
|
CommBinaryOut(&cv,Report,strlen(Report)); |
|
| 1839 |
break; |
break; |
| 1840 |
} |
} |
| 1841 |
} |
} |
| 1844 |
{ |
{ |
| 1845 |
switch (b) { |
switch (b) { |
| 1846 |
case 'c': /* second terminal report (Secondary DA) */ |
case 'c': /* second terminal report (Secondary DA) */ |
| 1847 |
if (Send8BitMode) |
SendCSIstr(">32;10;2c", 9); /* VT382 */ |
|
CommBinaryOut(&cv,"\233>32;10;2c",10); /* VT382 */ |
|
|
else |
|
|
CommBinaryOut(&cv,"\033[>32;10;2c",11); /* VT382 */ |
|
| 1848 |
break; |
break; |
| 1849 |
case 'J': |
case 'J': |
| 1850 |
if (Param[1]==3) // IO-8256 terminal |
if (Param[1]==3) // IO-8256 terminal |
| 2603 |
static BYTE XsParseMode = ModeXsFirst, PrevMode; |
static BYTE XsParseMode = ModeXsFirst, PrevMode; |
| 2604 |
static char StrBuff[sizeof(ts.Title)]; |
static char StrBuff[sizeof(ts.Title)]; |
| 2605 |
static unsigned int ColorNumber, StrLen; |
static unsigned int ColorNumber, StrLen; |
| 2606 |
|
int len; |
| 2607 |
COLORREF color; |
COLORREF color; |
| 2608 |
|
|
| 2609 |
switch (XsParseMode) { |
switch (XsParseMode) { |
| 2680 |
if ((ts.ColorFlag & CF_XTERM256) && ColorNumber <= 255) { |
if ((ts.ColorFlag & CF_XTERM256) && ColorNumber <= 255) { |
| 2681 |
if (strcmp(StrBuff, "?") == 0) { |
if (strcmp(StrBuff, "?") == 0) { |
| 2682 |
color = DispGetANSIColor(ColorNumber); |
color = DispGetANSIColor(ColorNumber); |
| 2683 |
if (Send8BitMode) { |
len =_snprintf_s_l(StrBuff, sizeof(StrBuff), _TRUNCATE, |
| 2684 |
_snprintf_s_l(StrBuff, sizeof(StrBuff), _TRUNCATE, |
"4;%d;rgb:%02x/%02x/%02x\234", CLocale, ColorNumber, |
| 2685 |
"\2354;%d;rgb:%02x/%02x/%02x\234", CLocale, ColorNumber, |
GetRValue(color), GetGValue(color), GetBValue(color)); |
|
GetRValue(color), GetGValue(color), GetBValue(color)); |
|
|
} |
|
|
else { |
|
|
_snprintf_s_l(StrBuff, sizeof(StrBuff), _TRUNCATE, |
|
|
"\033]4;%d;rgb:%02x/%02x/%02x\033\\", CLocale, ColorNumber, |
|
|
GetRValue(color), GetGValue(color), GetBValue(color)); |
|
|
} |
|
| 2686 |
ParseMode = ModeFirst; |
ParseMode = ModeFirst; |
| 2687 |
XsParseMode = ModeXsFirst; |
XsParseMode = ModeXsFirst; |
| 2688 |
CommBinaryOut(&cv, StrBuff, strlen(StrBuff)); |
SendOSCstr(StrBuff, len); |
| 2689 |
break; |
break; |
| 2690 |
} |
} |
| 2691 |
else if (XsParseColor(StrBuff, &color)) { |
else if (XsParseColor(StrBuff, &color)) { |
| 2707 |
if ((ts.ColorFlag & CF_XTERM256) && ColorNumber <= 255) { |
if ((ts.ColorFlag & CF_XTERM256) && ColorNumber <= 255) { |
| 2708 |
if (strcmp(StrBuff, "?") == 0) { |
if (strcmp(StrBuff, "?") == 0) { |
| 2709 |
color = DispGetANSIColor(ColorNumber); |
color = DispGetANSIColor(ColorNumber); |
| 2710 |
if (Send8BitMode) { |
len =_snprintf_s_l(StrBuff, sizeof(StrBuff), _TRUNCATE, |
| 2711 |
_snprintf_s_l(StrBuff, sizeof(StrBuff), _TRUNCATE, |
"4;%d;rgb:%02x/%02x/%02x\234", CLocale, ColorNumber, |
| 2712 |
"\2354;%d;rgb:%02x/%02x/%02x\234", CLocale, ColorNumber, |
GetRValue(color), GetGValue(color), GetBValue(color)); |
|
GetRValue(color), GetGValue(color), GetBValue(color)); |
|
|
} |
|
|
else { |
|
|
_snprintf_s_l(StrBuff, sizeof(StrBuff), _TRUNCATE, |
|
|
"\033]4;%d;rgb:%02x/%02x/%02x\033\\", CLocale, ColorNumber, |
|
|
GetRValue(color), GetGValue(color), GetBValue(color)); |
|
|
} |
|
| 2713 |
XsParseMode = ModeXsColorNum; |
XsParseMode = ModeXsColorNum; |
| 2714 |
CommBinaryOut(&cv, StrBuff, strlen(StrBuff)); |
SendOSCstr(StrBuff, len); |
| 2715 |
} |
} |
| 2716 |
else if (XsParseColor(StrBuff, &color)) { |
else if (XsParseColor(StrBuff, &color)) { |
| 2717 |
DispSetANSIColor(ColorNumber, color); |
DispSetANSIColor(ColorNumber, color); |
| 3416 |
} |
} |
| 3417 |
|
|
| 3418 |
int MakeMouseReportStr(char *buff, size_t buffsize, int mb, int x, int y) { |
int MakeMouseReportStr(char *buff, size_t buffsize, int mb, int x, int y) { |
| 3419 |
if (Send8BitMode) |
return _snprintf_s_l(buff, buffsize, _TRUNCATE, "M%c%c%c", CLocale, mb+32, x+32, y+32); |
|
return _snprintf_s_l(buff, buffsize, _TRUNCATE, "\233M%c%c%c", CLocale, mb+32, x+32, y+32); |
|
|
else |
|
|
return _snprintf_s_l(buff, buffsize, _TRUNCATE, "\033[M%c%c%c", CLocale, mb+32, x+32, y+32); |
|
| 3420 |
} |
} |
| 3421 |
|
|
| 3422 |
BOOL MouseReport(int Event, int Button, int Xpos, int Ypos) { |
BOOL MouseReport(int Event, int Button, int Xpos, int Ypos) { |
| 3530 |
if (len == 0) |
if (len == 0) |
| 3531 |
return FALSE; |
return FALSE; |
| 3532 |
|
|
| 3533 |
CommBinaryOut(&cv, Report, len); |
SendCSIstr(Report, len); |
| 3534 |
return TRUE; |
return TRUE; |
| 3535 |
} |
} |
| 3536 |
|
|
| 3540 |
|
|
| 3541 |
if (focus) { |
if (focus) { |
| 3542 |
// Focus In |
// Focus In |
| 3543 |
if (Send8BitMode) { |
SendCSIstr("I", 1); |
|
CommBinaryOut(&cv,"\233I",2); |
|
|
} else { |
|
|
CommBinaryOut(&cv,"\033[I",3); |
|
|
} |
|
| 3544 |
} else { |
} else { |
| 3545 |
// Focus Out |
// Focus Out |
| 3546 |
if (Send8BitMode) { |
SendCSIstr("O", 1); |
|
CommBinaryOut(&cv,"\233O",2); |
|
|
} else { |
|
|
CommBinaryOut(&cv,"\033[O",3); |
|
|
} |
|
| 3547 |
} |
} |
| 3548 |
} |
} |
| 3549 |
|
|