diff --git a/kermit/k95/cknwin.c b/kermit/k95/cknwin.c index 2795c001..6fe72d69 100644 --- a/kermit/k95/cknwin.c +++ b/kermit/k95/cknwin.c @@ -1572,6 +1572,10 @@ gui_win_run_mode(int x) return(1); } +int gui_get_win_run_mode() { + return KuiGetTerminalRunMode(); +} + int gui_file_dialog(char * preface, char * prompt, int fc, char * def, char * result, int rlength) diff --git a/kermit/k95/ckoco3.c b/kermit/k95/ckoco3.c index d0f62816..92063a03 100644 --- a/kermit/k95/ckoco3.c +++ b/kermit/k95/ckoco3.c @@ -491,12 +491,14 @@ extern int send_c1_usr ; /* User default for send_c1 */ * 13 - Local editing 15 - Technical character set * 16 - Locator device port + ? 17 - Terminal state interrogation (is this an xterm extension??) * 18 - Windowing Capability * 19 - Dual sessions * 21 - Horizontal Scrolling 22 - Color 23 - Greek * 24 - Turkish + ? 28 - Rectangular editing (is this an xterm extension??) 42 - ISO Latin-2 44 - PC Term 45 - Soft-key mapping @@ -539,17 +541,31 @@ struct tt_info_rec tt_info[] = { /* Indexed by terminal type */ "WY370", {"WYSE-370","WYSE370","WY350",NULL},"[?63;1;2;6;8;9;15;44c", /* WYSE 370 (same as VT320) */ "97801", {"SNI-97801",NULL}, "[?62;1;2;6;8;9;15;44c", /* Sinix 97801 */ "AAA", { "ANNARBOR", "AMBASSADOR",NULL}, "11;00;00", /* Ann Arbor Ambassador */ -#ifdef COMMENT - "VT420", {"DEC-VT420","DEC-VT400","VT400",NULL}, "[?64;1;2;6;8;9;15;22;23;42;44;45;46c", /* DEC VT420 */ - "VT525", {"DEC-VT525","DEC-VT500","VT500",NULL}, "[?65;1;2;6;8;9;15;22;23;42;44;45;46c", /* DEC VT520 */ -#endif /* COMMENT */ + + "VT420", {"DEC-VT420","DEC-VT400","VT400",NULL}, "[?64;1;2;6;8;9;15;22;23;42;44;45;46c", /* DEC VT420 */ + "VT420PC", {"DEC-VT420","DEC-VT400","VT400",NULL}, "[?64;1;2;6;8;9;15;22;23;42;44;45;46c", /* DEC VT420 w/ PC keyboard*/ + "VT525", {"DEC-VT525","DEC-VT500","VT500",NULL}, "[?65;1;2;6;8;9;15;22;23;42;44;45;46c", /* DEC VT520 */ + "VT525PC", {"DEC-VT525","DEC-VT500","VT500",NULL}, "[?65;1;2;6;8;9;15;22;23;42;44;45;46c", /* DEC VT520 w/ PC keyboard*/ + "TVI910", {"TELEVIDEO-910","TVI910+""910",NULL}, "TVS 910 REV.I\r", /* TVI 910+ */ "TVI925", {"TELEVIDEO-925","925",NULL}, "TVS 925 REV.I\r", /* TVI 925 */ "TVI950", {"TELEVIDEO-950","950",NULL}, "1.0,0\r", /* TVI 950 */ "ADM3A", {NULL}, "", /* LSI ADM 3A */ "ADM5", {NULL}, "", /* LSI ADM 5 */ - "VTNT", {NULL}, "", /* Microsoft NT VT */ + "VTNT", {NULL}, "" /* Microsoft NT VT */ +#ifdef COMMENT "IBM3101",{"I3101",NULL}, "" /* IBM 31xx */ +#endif +#ifdef CK_XTERM_EMULATION + ,"XTERM", {NULL}, "[?64;1;2;6;8;9;15;22c", /* XTerm */ + /* TODO: Xterm also supports (as of 2023-05-08): + * 16; Locator port + * 17; Terminal state interrogation + * 18; User windows + * 21; Horizontal scrolling + * 28 Rectangular editing + * */ +#endif }; int max_tt = TT_MAX; /* Highest terminal type */ @@ -6279,7 +6295,7 @@ doreset(int x) { /* x = 0 (soft), nonzero (hard) */ vtnt_index = 0; vtnt_read = VTNT_MIN_READ; - /* Disable y active mouse reporting modes */ + /* Disable any active mouse reporting modes */ mouse_reporting_mode &= ~(MOUSEREPORTING_ACTIVE | MOUSEREPORTING_UNSUPPORTED); dokverb(VTERM,K_ENDSCN); @@ -13029,12 +13045,14 @@ vtcsi(void) } else /* ANSI.SYS save cursor position */ if ( ISANSI(tt_type_mode) || - IS97801(tt_type_mode)) + IS97801(tt_type_mode) || + ISXTERM(tt_type_mode)) savecurpos(VTERM,0); break; case 'u': /* ANSI.SYS restore cursor position */ if ( ISANSI(tt_type_mode) || - IS97801(tt_type_mode)) + IS97801(tt_type_mode) || + ISXTERM(tt_type_mode)) restorecurpos(VTERM,0); break; case 'U': /* SCO ANSI Reset Initial Screen */ @@ -13049,8 +13067,14 @@ vtcsi(void) break; } break; - case '$': - achar = (escnext<=esclast)?escbuffer[escnext++]:0; + case '$': {/* These things below should probably only appear in a DCS string */ + int acharTmp = (escnext <= esclast) ? escbuffer[escnext + 1] : 0; + if (acharTmp != '}' && acharTmp != '-' && acharTmp != '~') { + /* Next character isn't something we handle here - skip ahead */ + goto LB2003; + } + + achar = (escnext <= esclast) ? escbuffer[escnext++] : 0; switch (achar) { case '}': /* DECSASD - Select Active Status Display */ @@ -13063,6 +13087,7 @@ vtcsi(void) break; } break; + } case 'S': if ( private && ISAIXTERM(tt_type_mode) ) { /* Show Status Line */ @@ -13339,7 +13364,7 @@ vtcsi(void) } break; case 'r': /* DECCARA - Change Attr in Rect Area */ - if ( ISVT420(tt_type_mode) ) + if ( ISVT420(tt_type_mode) || ISXTERM(tt_type_mode)) { int w, h, x, y, z; /* @@ -13462,7 +13487,7 @@ vtcsi(void) } break; case 't': /* DECRARA - Reverse Attr in Rect Area */ - if ( ISVT420(tt_type_mode) ) + if ( ISVT420(tt_type_mode) || ISXTERM(tt_type_mode)) { int w, h, x, y, z; /* @@ -13572,7 +13597,7 @@ vtcsi(void) } break; case 'v': /* DECCRA - Copy Rect Area */ - if ( ISVT420( tt_type_mode) ) + if ( ISVT420( tt_type_mode) || ISXTERM(tt_type_mode)) { USHORT * data = NULL; int w, h, x, y; @@ -13634,7 +13659,7 @@ vtcsi(void) } break; case 'x': /* DECFRA - Fill Rect Area */ - if ( ISVT420(tt_type_mode) ) { + if ( ISVT420(tt_type_mode) || ISXTERM(tt_type_mode) ) { /* pn[1] - fill char */ /* pn[2] - top-line border default=1 */ /* pn[3] - left-col border default=1 */ @@ -13659,29 +13684,55 @@ vtcsi(void) } break; case 'z': /* DECERA - Erase Rect Area */ - if ( ISVT420(tt_type_mode) ) { + if ( ISVT420(tt_type_mode) || ISXTERM(tt_type_mode) ) { /* pn[1] - top-line border default=1 */ /* pn[2] - left-col border default=1 */ /* pn[3] - bot-line border default=Height */ /* pn[4] - Right border default=Width */ - if ( k < 4 || pn[4] > VscrnGetWidth(VTERM) || - pn[4] < 1 ) - pn[4] = VscrnGetWidth(VTERM); - if ( k < 3 || pn[3] > VscrnGetHeight(VTERM) - -(tt_status[VTERM]?1:0) || pn[3] < 1 ) - pn[3] = VscrnGetHeight(VTERM) - -(tt_status[VTERM]?1:0); - if ( k < 2 || pn[2] < 1 ) - pn[2] = 1 ; - if ( k < 1 || pn[1] < 1 ) - pn[1] = 1 ; - clrrect_escape( VTERM, pn[1], pn[2], - pn[3], pn[4], SP ) ; - VscrnIsDirty(VTERM); + + int maxHeight, maxWidth; + int top, left, bot, right; + + maxHeight = VscrnGetHeight(VTERM) + -(tt_status[VTERM]?1:0); + maxWidth = VscrnGetWidth(VTERM); + + top = pn[1]; + left = pn[2]; + bot = pn[3]; + right = pn[4]; + + /* Defaults: the entire screen */ + if (k < 4 || right < 1) right = maxWidth; + if (k < 3 || bot < 1) bot = maxHeight; + if (k < 2 || left < 1) left = 1; + if (k < 1 || top < 1) top = 1; + + /* Coordinates are all relative to DECOM setting */ + if (relcursor) { + top += margintop - 1; + bot += margintop - 1; + left += marginleft - 1; + right += marginleft - 1; + } + + if (right > maxWidth) right = maxWidth; + if (bot > maxHeight) bot = maxHeight; + + /* Do nothing if the rect is invalid (bottom > top + * or left > right) */ + if (top <= bot && left <= right + && top > 0 && left > 0) { + clrrect_escape(VTERM, top, left, + bot, right, SP); + VscrnIsDirty(VTERM); + } else { + debug(F111, "DECERA", "bad parameter(s) - ignore", 0); + } } break; case '{': /* DECSERA - Selective Erase Rect Area */ - if ( ISVT420(tt_type_mode) ) { + if ( ISVT420(tt_type_mode) || ISXTERM(tt_type_mode) ) { /* pn[1] - top-line border default=1 */ /* pn[2] - left-col border default=1 */ /* pn[3] - bot-line border default=Height */ @@ -13708,7 +13759,7 @@ vtcsi(void) achar = (escnext<=esclast)?escbuffer[escnext++]:0; switch (achar) { case 'x': /* DECSACE - Select Attribute Change Extent */ - if ( ISVT420(tt_type_mode) ) + if ( ISVT420(tt_type_mode) || ISXTERM(tt_type_mode) ) { /* * 0 - DECCARA or DECRARA affect the stream of character @@ -13859,7 +13910,7 @@ vtcsi(void) /* pn[1] contains new color */ if ( !sgrcolors ) break; - borderattribute = sgrcols[pn[1]%10]; + borderattribute = sgrcols[pn[1]%8]; setborder(); } else if ( ISBA80(tt_type_mode) ) { @@ -14249,7 +14300,8 @@ vtcsi(void) if ( ISHFT(tt_type_mode) || ISLINUX(tt_type_mode) || ISQANSI(tt_type_mode) || - ISANSI(tt_type_mode)) { + ISANSI(tt_type_mode) || + ISXTERM(tt_type_mode)) { if ( pn[1] < 1 || pn[1] > VscrnGetWidth(VTERM) ) break; lgotoxy(VTERM,pn[1],wherey[VTERM]); @@ -14463,7 +14515,8 @@ vtcsi(void) case 9: /* DECINLM - Interlace */ /* XTERM - Send Mouse X & Y on button press */ #ifdef OS2MOUSE - if (ISLINUX(tt_type_mode) || ISANSI(tt_type_mode)) { + if (ISLINUX(tt_type_mode) || ISANSI(tt_type_mode) || + ISXTERM(tt_type_mode)) { /* The linux console terminal, as well as many * other terminal emulators, implement XTERM * mouse tracking */ @@ -15075,7 +15128,8 @@ vtcsi(void) case 9: /* DECINLM - Interlace */ /* XTERM - Don't Send Mouse X&Y on button press */ #ifdef OS2MOUSE - if (ISLINUX(tt_type_mode) || ISANSI(tt_type_mode)) { + if (ISLINUX(tt_type_mode) || ISANSI(tt_type_mode) || + ISXTERM(tt_type_mode)) { /* The linux console terminal, as well as many * other terminal emulators, implement XTERM * mouse tracking */ @@ -16383,8 +16437,14 @@ vtcsi(void) /* 8 - 12 are ANSI X3.64 */ case 8: /* Turn on INVISIBLE */ - case 9: /* Turn on INVISIBLE (QANSI) */ attrib.invisible = TRUE; /* see wrtch */ + break; + case 9: + if (ISXTERM(tt_type_mode)) { /* ECMA-48 3rd edition */ + /* TODO: XTERM: crossed-out characters */ + } else { /* Turn on INVISIBLE (QANSI) */ + attrib.invisible = TRUE; /* see wrtch */ + } break; case 10: /* Select Primary font */ @@ -16502,11 +16562,15 @@ vtcsi(void) charset(cs94,'U',&G[i]); } - case 21: /* Set Normal Intensity */ - if (attrib.bold) - attrib.bold = FALSE; - if (attrib.dim) - attrib.dim = FALSE; + case 21: + if (ISXTERM(tt_type_mode)) { /* ECMA-48 3rd */ + /* TODO: XTERM: Doubly-underlined */ + } else { /* Set Normal Intensity */ + if (attrib.bold) + attrib.bold = FALSE; + if (attrib.dim) + attrib.dim = FALSE; + } break; case 22: /* Turn BOLD Off */ if (attrib.bold) @@ -16548,10 +16612,18 @@ vtcsi(void) attrib.reversed = FALSE; break; case 28:/* Turn INVISIBLE Off */ - case 29:/* QANSI */ if (!attrib.invisible) break; - attrib.invisible = FALSE; + attrib.invisible = FALSE; + break; + case 29: + if (ISXTERM(tt_type_mode)) { + /* TODO: XTERM: Not corssed-out (ECMA-48 3rd) */ + } else { /* QANSI - Turn INVISIBLE off */ + if (!attrib.invisible) + break; + attrib.invisible = FALSE; + } break; case 30: /* Colors */ @@ -16572,7 +16644,7 @@ vtcsi(void) if ( 0 && ISQANSI(tt_type_mode) ) l = pn[j] - 30; else */ - l = sgrcols[pn[j] - 30]; + l = sgrcols[(pn[j] - 30)%8]; if (decscnm) { i = (attribute & 0x8F); attribute = (i | ((l << 4))); @@ -16614,6 +16686,7 @@ vtcsi(void) case 38: /* enable underline option */ break; case 39: /* disable underline option */ + /* TODO: XTERM: Set foreground color to default, ECMA-48 */ /* Supported by SCO ANSI */ /* QANSI - restore fg color saved with */ /* CSI = Pn F */ @@ -16688,6 +16761,7 @@ vtcsi(void) } break; case 49: + /* TODO: XTERM: Set background color to default, ECMA-48 */ /* Supported by SCO ANSI */ /* QANSI - restore bg color saved with */ /* CSI = Pn G */ @@ -16737,7 +16811,7 @@ vtcsi(void) */ break; } - case 90: /* Colors */ + case 90: /* Bright Colors (aixterm?) */ case 91: case 92: case 93: @@ -16753,7 +16827,7 @@ vtcsi(void) * disabled -- DG if ( 0 && ISQANSI(tt_type_mode) ) l = pn[j] - 90; - else */ + else l = sgrcols[pn[j] - 90]; l += 8; /* 8th bit high */ if (decscnm @@ -16799,7 +16873,10 @@ vtcsi(void) } } break; - case 100: + case 100: /* TODO: For aixterm and perhaps others, these should set + * bright foreground/background colours ( + /* TODO: rxvt: set forground and background to default + * Aixterm (and probably others): set background to black */ case 101: case 102: case 103: @@ -16816,7 +16893,7 @@ vtcsi(void) * branch is disabled -- DG if ( 0 && ISQANSI(tt_type_mode) ) l = pn[j] - 100; - else */ + else l = sgrcols[pn[j] - 100]; l += 8; /* 8th bit high */ if (!decscnm @@ -18154,12 +18231,34 @@ vtcsi(void) break; } } - case 15: /* Report size of the screen in pixels */ + case 15: { /* Report size of the screen in pixels */ +#ifdef KUI + int w, h; + char buf[30]; + KuiGetTerminalMaximisedSize(FALSE, &w, &h); + + if (w < 50000 && h < 50000) { /* Limit response length */ + sprintf(buf, "%c5;%d;%dt", _CSI, h, w); + sendchars(buf, strlen(buf)); + } +#endif /* KUI */ break; + } case 16: /* Report xterm character cell size in pixels */ break; - case 19: /* Report the size of the screen in characters */ + case 19: { /* Report the size of the screen in characters */ +#ifdef KUI + int w, h; + char buf[30]; + KuiGetTerminalMaximisedSize(TRUE, &w, &h); + + if (w < 50000 && h < 50000) { /* Limit response length */ + sprintf(buf, "%c9;%d;%dt", _CSI, h, w); + sendchars(buf, strlen(buf)); + } +#endif break; + } case 20: /* Report Icon Label */ break; case 21: /* Report Window Label */ @@ -18215,8 +18314,18 @@ vtcsi(void) /* Report xterm window position */ } break; - case 11: /* Report state of Window (normal/iconified) */ + case 11: { /* Report state of Window (normal/iconified) */ +#ifdef KUI + char buf[20]; + if (gui_get_win_run_mode() == 2) { + sprintf(buf, "%c%dt", _CSI, 2); /* Iconified */ + } else { + sprintf(buf, "%c%dt", _CSI, 1); /* Not iconified */ + } + sendchars(buf, strlen(buf)); +#endif break; + } } } break; @@ -18509,7 +18618,7 @@ vtcsi(void) achar = (escnext<=esclast)?escbuffer[escnext++]:0; switch (achar) { case '~': - if ( ISVT420(tt_type_mode) ) { + if ( ISVT420(tt_type_mode) || ISXTERM(tt_type_mode) ) { /* DECDC - Delete Column */ viocell cell ; cell.c = SP ; @@ -18531,7 +18640,7 @@ vtcsi(void) } break; case '}': - if ( ISVT420(tt_type_mode) ) { + if ( ISVT420(tt_type_mode) || ISXTERM(tt_type_mode) ) { /* DECIC - Insert Column */ viocell cell ; cell.c = SP ; diff --git a/kermit/k95/ckocon.h b/kermit/k95/ckocon.h index 4f4fa3a9..4c0b1c19 100644 --- a/kermit/k95/ckocon.h +++ b/kermit/k95/ckocon.h @@ -263,7 +263,9 @@ typedef struct cell_struct { /* to be used with VioWrtNCell() */ #else /* CKOUNI_OUT */ unsigned char c ; /* character */ #endif /* CKOUNI_OUT */ - unsigned char a ; /* attribute */ + unsigned char a ; /* attribute (foreground & background + * color) - see comment further up by + * swapcolors and byteswapcolors */ } viocell ; typedef struct videoline_struct { diff --git a/kermit/k95/ckokey.c b/kermit/k95/ckokey.c index 1e4f752d..a1a5ab5e 100644 --- a/kermit/k95/ckokey.c +++ b/kermit/k95/ckokey.c @@ -7696,6 +7696,8 @@ defaultkeymap( int terminal ) { return defvt100km(terminal); case TT_BEOS: return defbetermkm( terminal ); + case TT_XTERM: /* TODO: What should the default xterm keymap be? */ + return defvtpckm( terminal ); case TT_LINUX: return deflinuxkm( terminal ); case TT_SCOANSI: @@ -7708,10 +7710,14 @@ defaultkeymap( int terminal ) { return defannarbor( terminal ); case TT_VT220: case TT_VT320: + case TT_VT420: + case TT_VT520: case TT_WY370: return defvt200km( terminal ); case TT_VT220PC: case TT_VT320PC: + case TT_VT420PC: + case TT_VT520PC: return defvtpckm( terminal ); case TT_97801: return defsnikm( terminal ); diff --git a/kermit/k95/ckuus3.c b/kermit/k95/ckuus3.c index b618d594..2bf634b4 100644 --- a/kermit/k95/ckuus3.c +++ b/kermit/k95/ckuus3.c @@ -2639,6 +2639,7 @@ _PROTOTYP(int gui_mtxt_dialog,(char *,int,struct txtbox [])); _PROTOTYP(int gui_position,(int, int)); _PROTOTYP(int gui_resize_mode,(int)); _PROTOTYP(int gui_win_run_mode,(int)); +_PROTOTYP(int gui_get_win_run_mode,()); _PROTOTYP(int gui_file_dialog,(char *,char *, int, char *, char *, int)); extern int gui_dialog; #endif /* KUI */ diff --git a/kermit/k95/ckuus5.c b/kermit/k95/ckuus5.c index e43c3762..5f7b7b79 100644 --- a/kermit/k95/ckuus5.c +++ b/kermit/k95/ckuus5.c @@ -5370,6 +5370,12 @@ struct keytab shokeymtab[] = { "vt220pc", TT_VT220PC, 0, "vt320", TT_VT320, 0, "vt320pc", TT_VT320PC, 0, +#ifdef CK_VT420_520_EMULATION + "vt420", TT_VT420, 0, + "vt420pc", TT_VT420PC, 0, + "vt520", TT_VT520, 0, + "vt520pc", TT_VT520PC, 0 , +#endif /* CK_VT420_520_EMULATION */ "vt52", TT_VT52, 0, "wp", TT_KBM_WP, 0, "wy160", TT_WY160, 0, @@ -5380,7 +5386,10 @@ struct keytab shokeymtab[] = { "wyse30", TT_WY30, CM_INV, "wyse370", TT_WY370, CM_INV, "wyse50", TT_WY50, CM_INV, - "wyse60", TT_WY60, CM_INV + "wyse60", TT_WY60, CM_INV, +#ifdef CK_XTERM_EMULATION + "xterm", TT_XTERM, 0 +#endif }; int nshokeym = (sizeof(shokeymtab) / sizeof(struct keytab)); #endif /* OS2 */ diff --git a/kermit/k95/ckuus7.c b/kermit/k95/ckuus7.c index 764085dd..73e28f0a 100644 --- a/kermit/k95/ckuus7.c +++ b/kermit/k95/ckuus7.c @@ -1602,6 +1602,12 @@ struct keytab ttyptab[] = { { "vt220pc", TT_VT220PC,0 }, { "vt320", TT_VT320, 0 }, { "vt320pc", TT_VT320PC,0 }, +#ifdef CK_VT420_520_EMULATION + { "vt420", TT_VT420, 0 }, + { "vt420pc", TT_VT420PC, 0 }, + { "vt520", TT_VT520, 0 }, + { "vt520pc", TT_VT520PC, 0 }, +#endif /* CK_VT420_520_EMULATION */ { "vt52", TT_VT52, 0 }, #ifdef NT { "vtnt", TT_VTNT, 0 }, @@ -1616,7 +1622,10 @@ struct keytab ttyptab[] = { { "wyse30", TT_WY30, CM_INV }, { "wyse370", TT_WY370, CM_INV }, { "wyse50", TT_WY50, CM_INV }, - { "wyse60", TT_WY60, CM_INV } + { "wyse60", TT_WY60, CM_INV }, +#ifdef CK_XTERM_EMULATION + { "xterm", TT_XTERM, 0 } +#endif }; int nttyp = (sizeof(ttyptab) / sizeof(struct keytab)); @@ -1673,6 +1682,12 @@ struct keytab ttkeytab[] = { { "vt220pc", TT_VT220PC, 0 }, { "vt320", TT_VT320, 0 }, { "vt320pc", TT_VT320PC, 0 }, +#ifdef CK_VT420_520_EMULATION + { "vt420", TT_VT420, 0 }, + { "vt420pc", TT_VT420PC, 0 }, + { "vt520", TT_VT520, 0 }, + { "vt520pc", TT_VT520PC, 0 }, +#endif /* CK_VT420_520_EMULATION */ { "vt52", TT_VT52, 0 }, { "vtnt", TT_VTNT, CM_INV }, { "wp", TT_KBM_WP, 0 }, /* Word Perfect mode */ @@ -1684,7 +1699,10 @@ struct keytab ttkeytab[] = { { "wyse30", TT_WY30, CM_INV }, { "wyse370", TT_WY370, CM_INV }, { "wyse50", TT_WY50, CM_INV }, - { "wyse60", TT_WY60, CM_INV } + { "wyse60", TT_WY60, CM_INV }, +#ifdef CK_XTERM_EMULATION + { "xterm", TT_XTERM, 0 } +#endif }; int nttkey = (sizeof(ttkeytab) / sizeof(struct keytab)); diff --git a/kermit/k95/ckuusr.h b/kermit/k95/ckuusr.h index ad9cfc22..e4233acf 100644 --- a/kermit/k95/ckuusr.h +++ b/kermit/k95/ckuusr.h @@ -1056,16 +1056,49 @@ struct stringint { /* String and (wide) integer */ #define TT_WY370 33 /* WYSE 370 ANSI Terminal */ #define TT_97801 34 /* Sinix 97801-5xx terminal */ #define TT_AAA 35 /* Ann Arbor Ambassador */ -#define TT_TVI910 36 /* TVI 910+ */ -#define TT_TVI925 37 /* TVI 925 */ -#define TT_TVI950 38 /* TVI950 */ -#define TT_ADM3A 39 /* LSI ADM 3A */ -#define TT_ADM5 40 /* LSI ADM 5 */ -#define TT_VTNT 41 /* Microsoft NT Virtual Terminal */ + +#define TT_VT420 36 /* DEC VT-420 */ +#define TT_VT420PC 37 /* DEC VT-420 with PC keyboard */ +#define TT_VT520 38 /* DEC VT-520/525 */ +#define TT_VT520PC 39 /* DEC VT-520/525 with PC keyboard */ + +#define TT_TVI910 40 /* TVI 910+ */ +#define TT_TVI925 41 /* TVI 925 */ +#define TT_TVI950 42 /* TVI950 */ +#define TT_ADM3A 43 /* LSI ADM 3A */ +#define TT_ADM5 44 /* LSI ADM 5 */ +#define TT_VTNT 45 /* Microsoft NT Virtual Terminal */ + +#ifdef CK_XTERM_EMULATION +#define TT_XTERM 46 /* xterm! */ +#else +#define TT_XTERM 97 /* xterm! */ +#endif + +/* TODO: Graphics! + * -> This would be Windows/KUI only - no way of supporting it in + * the console or OS/2 versions + * -> Need to figure out how to implement graphics at all + * -> How do we represent graphics in the screen buffer? + * -> How do we render and scroll text + graphics? + * -> Sixel is the priority and probably the easiest. The rest are rarely used. + * -> The following graphics terminals require: + * VT125: ReGIS + * VT241: All of the above plus Sixel (VT240: no colour) + * VT340: All of the above plus Tektronix 4010 graphics (VT330: no colour) + * TEK40: 4010, 4014 emulation. If 4010 gets implemented for VT340 emulation + * we may as well go all the way and provide Tektronix emulation directly too. + * VT55, VT105: waveform graphics + * XTerm: Sixel, ReGIS, Tektronix 4015 + */ + +#ifdef CK_XTERM_EMULATION +#define TT_MAX TT_XTERM +#else #define TT_MAX TT_VTNT -#define TT_VT420 96 /* DEC VT-420 */ -#define TT_VT520 97 /* DEC VT-520/525 */ -#define TT_XTERM 98 /* XTerm */ +#endif /* CK_XTERM_EMULATION */ + +#define TT_IBM3101 98 /* IBM 3101 - not implemented */ #define TT_TEK40 99 /* Tektronix 401x */ #define TT_KBM_EMACS TT_MAX+1 #define TT_KBM_HEBREW TT_MAX+2 @@ -1093,10 +1126,11 @@ struct stringint { /* String and (wide) integer */ #define ISTVI910(x) (x == TT_TVI910) #define ISTVI925(x) (x == TT_TVI925) #define ISTVI950(x) (x == TT_TVI950) +#define ISXTERM(x) (x == TT_XTERM) #define ISVT52(x) (x == TT_VT52 || x == TT_H19) -#ifdef COMMENT -#define ISVT520(x) (x == TT_VT520) -#define ISVT420(x) (x >= TT_VT420 && x <= TT_VT520) +#ifdef CK_VT420_520_EMULATION +#define ISVT520(x) (x == TT_VT520 || x == TT_VT520PC) +#define ISVT420(x) (x >= TT_VT420 && x <= TT_VT520PC) #else /* COMMENT */ /* Since we do not yet support 420/520 extend 320 */ #define ISVT520(x) (ISVT320(x)) @@ -1105,7 +1139,7 @@ struct stringint { /* String and (wide) integer */ #define ISVT320(x) (x >= TT_VT320 && x <= TT_AAA) #define ISVT220(x) (x >= TT_VT220 && x <= TT_AAA || \ ISBEOS(x) || ISQANSI(x) || \ - ISLINUX(x) || ISSUN(x)) + ISLINUX(x) || ISSUN(x) || ISXTERM(x)) #define ISVT102(x) (x >= TT_VIP7809 && x <= TT_BA80 || \ x == TT_VT102 || ISVT220(x)) #define ISVT100(x) (x == TT_VT100 || ISVT102(x)) @@ -1126,7 +1160,6 @@ struct stringint { /* String and (wide) integer */ #define ISVTNT(x) (x == TT_VTNT) #define ISADM3A(x) (x == TT_ADM3A) #define ISADM5(x) (x == TT_ADM5) -#define ISXTERM(x) (x == TT_XTERM) #endif /* OS2 */ #define XYTCS 2 /* Terminal Character Set */ diff --git a/kermit/k95/feature_flags.mak b/kermit/k95/feature_flags.mak index e6f41dcb..7d97b966 100644 --- a/kermit/k95/feature_flags.mak +++ b/kermit/k95/feature_flags.mak @@ -544,3 +544,15 @@ DISABLED_FEATURE_DEFS = $(DISABLED_FEATURE_DEFS) -DNOSCROLLWHEEL ENABLED_FEATURES = $(ENABLED_FEATURES) Windows-Unicode ENABLED_FEATURE_DEFS = $(ENABLED_FEATURE_DEFS) -DCK_NT_UNICODE -DUNICODE -D_UNICODE !endif + +# Enable xterm emulation option +!if "$(CKF_XTERM_EMULATION)" == "yes" +ENABLED_FEATURES = $(ENABLED_FEATURES) Xterm-emulation +ENABLED_FEATURE_DEFS = $(ENABLED_FEATURE_DEFS) -DCK_XTERM_EMULATION +!endif + +# Enable VT420 and VT520 emulation options +!if "$(CKF_VT420_520_EMULATION)" == "yes" +ENABLED_FEATURES = $(ENABLED_FEATURES) vt420-vt520-emulation +ENABLED_FEATURE_DEFS = $(ENABLED_FEATURE_DEFS) -DCK_VT420_520_EMULATION +!endif diff --git a/kermit/k95/kui/ikui.cxx b/kermit/k95/kui/ikui.cxx index 78cd1714..d325f2c9 100644 --- a/kermit/k95/kui/ikui.cxx +++ b/kermit/k95/kui/ikui.cxx @@ -235,6 +235,35 @@ KuiSetTerminalRunMode(int x) } } +int KuiGetTerminalRunMode() { + long ret = GetWindowLong(kui->getTerminal()->hwnd(), GWL_STYLE); + + if (ret & WS_MINIMIZE) return 2; + return 1; +} + +int widthToChars(int width) { + return width / kui->getTerminal()->getKFont()->getFontW(); +} + +int heightToChars(int height) { + return height / kui->getTerminal()->getKFont()->getFontSpacedH(); +} + +void KuiGetTerminalMaximisedSize(BOOL inChars, int* width, int* height) { + RECT rec; + BOOL r = SystemParametersInfo( + SPI_GETWORKAREA,0, &rec, 0); + + *width = rec.right - rec.left; + *height = rec.bottom - rec.top; + + if (inChars) { + *width = widthToChars(*width); + *height = heightToChars(*height); + } +} + int KuiFileDialog(char * title, char * def, char * result, int rlen, BOOL downloadButton, BOOL openFile) diff --git a/kermit/k95/kui/ikui.h b/kermit/k95/kui/ikui.h index 5c25a612..17e730a1 100644 --- a/kermit/k95/kui/ikui.h +++ b/kermit/k95/kui/ikui.h @@ -66,6 +66,8 @@ void KuiSetTerminalSize(int, int); void KuiSetTerminalResizeMode(int); int KuiGetTerminalResizeMode(void); void KuiSetTerminalRunMode(int); +int KuiGetTerminalRunMode(); +void KuiGetTerminalMaximisedSize(BOOL inChars, int* width, int* height); #define STATUS_CMD_TERM 0 #define STATUS_LOCUS 1 #define STATUS_PROTO 2