v04i012: kterm -- Kanji (japanese) xterm, Part03/04
Dan Heller
argv at island.uu.net
Wed May 31 16:01:48 AEST 1989
Submitted-by: Hiroto Kagotani <kagotani at cs.titech.ac.jp>
Posting-number: Volume 4, Issue 12
Archive-name: kterm/part03
diff -rc ../xterm/charproc.c ./charproc.c
*** ../xterm/charproc.c Thu May 4 20:19:22 1989
--- ./charproc.c Tue May 30 14:53:35 1989
***************
*** 1,5 ****
--- 1,6 ----
/*
* $XConsortium: charproc.c,v 1.64 89/01/04 13:37:50 jim Exp $
+ * $Header: charproc.c,v 1.1 89/05/30 14:53:32 kagotani Rel $
*/
***************
*** 96,106 ****
--- 97,118 ----
#define XtNscrollKey "scrollKey"
#define XtNscrollPos "scrollPos"
#define XtNsignalInhibit "signalInhibit"
+ #ifdef STATUSLINE /* michael */
+ #define XtNstatusLine "statusLine"
+ #define XtNstatusNormal "statusNormal"
+ #endif STATUSLINE
#define XtNtekInhibit "tekInhibit"
#define XtNtekStartup "tekStartup"
#define XtNtiteInhibit "titeInhibit"
#define XtNvisualBell "visualBell"
#define XtNallowSendEvents "allowSendEvents"
+ #ifdef KANJI /* sano */
+ #define XtNkanaFont "kanaFont"
+ #define XtNkanaBoldFont "kanaBoldFont"
+ #define XtNkanjiFont "kanjiFont"
+ #define XtNkanjiBoldFont "kanjiBoldFont"
+ #define XtNkanjiMode "kanjiMode"
+ #endif KANJI
#define XtCAlwaysHighlight "AlwaysHighlight"
#define XtCC132 "C132"
***************
*** 125,140 ****
--- 137,171 ----
#define XtCScrollPos "ScrollPos"
#define XtCScrollCond "ScrollCond"
#define XtCSignalInhibit "SignalInhibit"
+ #ifdef STATUSLINE /* michael */
+ #define XtCStatusLine "StatusLine"
+ #define XtCStatusNormal "StatusNormal"
+ #endif STATUSLINE
#define XtCTekInhibit "TekInhibit"
#define XtCTekStartup "TekStartup"
#define XtCTiteInhibit "TiteInhibit"
#define XtCVisualBell "VisualBell"
#define XtCAllowSendEvents "AllowSendEvents"
+ #ifdef KANJI /* sano */
+ #define XtCKanaFont "KanaFont"
+ #define XtCKanaBoldFont "KanaBoldFont"
+ #define XtCKanjiFont "KanjiFont"
+ #define XtCKanjiBoldFont "KanjiBoldFont"
+ #define XtCKanjiMode "KanjiMode"
+ #endif KANJI
+ #ifdef KANJI /* sano */
+ /*
+ * To avoid the sign-extension problem, masks lower 8 bites.
+ */
+ #define doinput() (0xff & (bcnt-- > 0 ? *bptr++ : in_put()))
+ #else KANJI
#define doinput() (bcnt-- > 0 ? *bptr++ : in_put())
+ #endif KANJI
#ifndef lint
static char rcs_id[] = "$XConsortium: charproc.c,v 1.64 89/01/04 13:37:50 jim Exp $";
+ static char kterm_id[] = "$Header: charproc.c,v 1.1 89/05/30 14:53:32 kagotani Rel $";
#endif /* lint */
static long arg;
***************
*** 155,160 ****
--- 186,196 ----
extern int igntable[];
extern int scrtable[];
extern int scstable[];
+ #ifdef KANJI /* sano */
+ extern int mbcstable[];
+ static char pending_char;
+ static int pending_bad;
+ #endif KANJI
/* event handlers */
***************
*** 316,321 ****
--- 352,365 ----
{XtNsignalInhibit,XtCSignalInhibit,XtRBoolean, sizeof(Boolean),
XtOffset(XtermWidget, misc.signalInhibit),
XtRBoolean, (caddr_t) &defaultFALSE},
+ #ifdef STATUSLINE /* michael */
+ {XtNstatusLine, XtCStatusLine, XtRBoolean, sizeof(Boolean),
+ XtOffset(XtermWidget, screen.statusline),
+ XtRBoolean, (caddr_t) &defaultFALSE},
+ {XtNstatusNormal, XtCStatusNormal, XtRBoolean, sizeof(Boolean),
+ XtOffset(XtermWidget, misc.statusnormal),
+ XtRBoolean, (caddr_t) &defaultFALSE},
+ #endif STATUSLINE
{XtNtekInhibit, XtCTekInhibit, XtRBoolean, sizeof(Boolean),
XtOffset(XtermWidget, misc.tekInhibit),
XtRBoolean, (caddr_t) &defaultFALSE},
***************
*** 331,336 ****
--- 375,398 ----
{XtNallowSendEvents, XtCAllowSendEvents, XtRBoolean, sizeof(Boolean),
XtOffset(XtermWidget, screen.allowSendEvents),
XtRBoolean, (caddr_t) &defaultFALSE}
+ #ifdef KANJI /* sano */
+ ,
+ {XtNkanaFont, XtCKanaFont, XtRString, sizeof(char *),
+ XtOffset(XtermWidget, misc.f_rn),
+ XtRString, DEFKANAFONT},
+ {XtNkanaBoldFont, XtCKanaFont, XtRString, sizeof(char *),
+ XtOffset(XtermWidget, misc.f_rb),
+ XtRString, DEFKANABOLDFONT},
+ {XtNkanjiFont, XtCKanjiFont, XtRString, sizeof(char *),
+ XtOffset(XtermWidget, misc.f_kn),
+ XtRString, DEFKANJIFONT},
+ {XtNkanjiBoldFont, XtCKanjiFont, XtRString, sizeof(char *),
+ XtOffset(XtermWidget, misc.f_kb),
+ XtRString, DEFKANJIBOLDFONT},
+ {XtNkanjiMode, XtCKanjiMode, XtRString, sizeof(char *),
+ XtOffset(XtermWidget, misc.k_m),
+ XtRString, (caddr_t) NULL}
+ #endif KANJI
};
***************
*** 384,400 ****
--- 446,626 ----
register int c;
register char *cp;
register int row, col, top, bot, scstype;
+ #ifdef KANJI
+ int mbcs;
+ register short gset;
+ register unsigned char *ucp;
+ #endif KANJI
extern int bitset(), bitclr(), finput(), TrackMouse();
if(setjmp(vtjmpbuf))
parsestate = groundtable;
+ #ifdef KANJI /* sano */
+ pending_char = pending_bad = 0;
+ for( ; ; ) {
+ if ((c = doinput()) & 0x80) { /* if MSB is on */
+ if (term->flags & EUC_KANJI) {
+ /*
+ * Do processing for EUC code
+ */
+ #define EKANJI(c) (0xa1 <= c && c <= 0xfe)/* true if EUC KANJI */
+ #define EKANA1(c) (0x8e == c) /* true if SS2 */
+ #define EKANA2(c) (0xa1 <= c && c <= 0xdf)/* true if KANA */
+ if (EKANJI(c)) {
+ *--bptr = c;
+ bcnt++;
+ top = bcnt > TEXT_BUF_SIZE ?
+ TEXT_BUF_SIZE : bcnt;
+ ucp = (unsigned char *)bptr;
+ while (top > 1 && EKANJI(*ucp)
+ && EKANJI(*(ucp + 1))) {
+ top -= 2, bcnt -= 2;
+ /*
+ * Strip off of the both MSB
+ * to convert JIS code
+ */
+ *ucp &= 0x7f; ucp++;
+ *ucp &= 0x7f; ucp++;
+ }
+ dotext(screen, term->flags, MBCS|'B',
+ bptr, ucp);
+ bptr = (char *)ucp;
+ if (top > 1 && EKANJI(*ucp) &&
+ !EKANJI(*(ucp + 1))) {
+ doinput();
+ } else if (1 == top && EKANJI(*ucp) &&
+ 1 == bcnt) {
+ pending_char = doinput();
+ }
+ continue;
+ } else if (EKANA1(c)) {
+ if (0 != bcnt) {
+ if (EKANA2((unsigned char)*bptr)) {
+ dotext(screen, term->flags, 'I', bptr, (bptr + 1));
+ doinput();
+ }
+ } else {
+ pending_char = c;
+ }
+ continue;
+ }
+ } else if (term->flags & SJIS_KANJI) {
+ /*
+ * Do processing for Shift-JIS Kanji code
+ */
+ #define SJIS1(c) (0x81 <= c && c <= 0x9f) || (0xe0 <= c && c <= 0xef)
+ /* SJIS1 is according to the range of 1st byte in Shift JIS */
+ #define SJIS2(c) (0x40 <= c && c <= 0xfc && c != 0x7f)
+ /* SJIS2 is according to the range of 2nd byte in Shift JIS */
+ #define SJISK(c) (0xa1 <= c && c <= 0xdf)
+ /* SJISK is according to the range of KANA (only one byte,
+ the width is the same of ascii char (half of Kanji)) */
+ if (SJIS1(c)) {
+ *--bptr = c;
+ bcnt++;
+ top = bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt;
+ ucp = (unsigned char *)bptr;
+ while (top > 1 && SJIS1(*ucp) && SJIS2(*(ucp + 1))) {
+ top -= 2, bcnt -= 2;
+ /*
+ * Do code conversion.
+ * It is quite complicated....
+ */
+ *ucp = (*ucp - ((*ucp <= 0x9f) ? 0x81 : 0xc1)) * 2 + 0x21;
+ ucp++;
+ if (*ucp <= 0x7e) {
+ *ucp -= 0x1f;
+ } else if (*ucp <= 0x9e) {
+ *ucp -= 0x20;
+ } else {
+ *ucp -= 0x7e;
+ *(ucp - 1) += 1;
+ }
+ ucp++;
+ }
+ dotext(screen, term->flags, MBCS|'B',
+ bptr, ucp);
+ bptr = (char *)ucp;
+ if (top > 1 && SJIS1(*ucp)
+ && !SJIS2(*(ucp + 1))) {
+ doinput();
+ } else if (1 == top && SJIS1(*ucp)
+ && 1 == bcnt) {
+ pending_char = doinput();
+ }
+ continue;
+ } else if (SJISK(c)) {
+ top = bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt;
+ cp = bptr;
+ *--bptr = c;
+ while (top > 0 &&
+ SJISK((unsigned char)*cp)) {
+ top--, bcnt--, cp++;
+ }
+ dotext(screen, term->flags, 'I', bptr, cp);
+ bptr = cp;
+ continue;
+ }
+ }
+ /*
+ * If kanji code is JIS, then no processing is required
+ * here. The preceeding escape sequence will turn on/off
+ * the MBCS flags when dotext() is called.
+ */
+ }
+ switch(parsestate[c &= CHAR]) {
+ #else KANJI
for( ; ; )
switch(parsestate[c = doinput()]) {
+ #endif
case CASE_PRINT:
/* printable characters */
top = bcnt > TEXT_BUF_SIZE ? TEXT_BUF_SIZE : bcnt;
cp = bptr;
*--bptr = c;
+ #ifdef KANJI /* sano */
+ if(screen->curss) {
+ dotext(screen, term->flags,
+ screen->gsets[screen->curss], bptr, bptr + 1) ;
+ screen->curss = 0;
+ bptr++;
+ c = *bptr & 0xff;
+ }
+ if ((gset = screen->gsets[screen->curgl]) & MBCS) {
+ if (' ' == c) {
+ gset &= ~MBCS;
+ while (top > 0 &&
+ ' ' == (unsigned char)*cp) {
+ top--; bcnt--; cp++;
+ }
+ } else {
+ while (top > 0 && 0x20 < *cp &&
+ *cp < 0x7f) {
+ top--; bcnt--; cp++;
+ }
+ if ((cp - bptr) & 1) {
+ --cp;
+ if (top == 0) {
+ if (bcnt == 0)
+ pending_char = *cp;
+ else
+ bcnt++;
+ } else
+ pending_bad = 1;
+ }
+ }
+ } else
+ while (top > 0 && isprint((unsigned char)*cp)) {
+ top--; bcnt--; cp++;
+ }
+ if (bptr < cp)
+ dotext(screen, term->flags, gset, bptr, cp);
+ bptr = cp;
+ if (pending_bad) {
+ pending_bad = 0;
+ bptr++;
+ }
+ #else KANJI
while(top > 0 && isprint(*cp)) {
top--;
bcnt--;
***************
*** 410,415 ****
--- 636,642 ----
dotext(screen, term->flags,
screen->gsets[screen->curgl], bptr, cp);
bptr = cp;
+ #endif KANJI
break;
case CASE_GROUND_STATE:
***************
*** 455,460 ****
--- 682,690 ----
/*
* form feed, line feed, vertical tab
*/
+ #ifdef STATUSLINE /* michael */
+ if (!screen->instatus)
+ #endif STATUSLINE
Index(screen, 1);
if (term->flags & LINEFEED)
CarriageReturn(screen);
***************
*** 507,512 ****
--- 737,751 ----
parsestate = scstable;
break;
+ #ifdef KANJI /* kagotani */
+ case CASE_MBCS:
+ /* enter smbcs mbcsesc */
+ mbcs = 1;
+ scstype = 0;
+ parsestate = mbcstable;
+ break;
+ #endif KANJI
+
case CASE_ESC_IGNORE:
/* unknown escape sequence */
parsestate = eigtable;
***************
*** 539,555 ****
--- 778,808 ----
case CASE_CUU:
/* CUU */
+ #ifdef STATUSLINE /* michael */
+ /* only if not in status line */
+ if (!screen->instatus) {
+ #endif STATUSLINE
if((c = param[0]) < 1)
c = 1;
CursorUp(screen, c);
+ #ifdef STATUSLINE /* michael */
+ }
+ #endif STATUSLINE
parsestate = groundtable;
break;
case CASE_CUD:
/* CUD */
+ #ifdef STATUSLINE /* michael */
+ /* only if not in status line */
+ if (!screen->instatus) {
+ #endif STATUSLINE
if((c = param[0]) < 1)
c = 1;
CursorDown(screen, c);
+ #ifdef STATUSLINE /* michael */
+ }
+ #endif STATUSLINE
parsestate = groundtable;
break;
***************
*** 571,581 ****
--- 824,841 ----
case CASE_CUP:
/* CUP | HVP */
+ #ifdef STATUSLINE /* michael */
+ /* only if not in status line */
+ if (!screen->instatus) {
+ #endif STATUSLINE
if((row = param[0]) < 1)
row = 1;
if(nparam < 2 || (col = param[1]) < 1)
col = 1;
CursorSet(screen, row-1, col-1, term->flags);
+ #ifdef STATUSLINE /* michael */
+ }
+ #endif STATUSLINE
parsestate = groundtable;
break;
***************
*** 584,597 ****
--- 844,872 ----
switch (param[0]) {
case DEFAULT:
case 0:
+ #ifdef STATUSLINE /* michael */
+ if (screen->instatus)
+ ClearRight(screen);
+ else
+ #endif STATUSLINE
ClearBelow(screen);
break;
case 1:
+ #ifdef STATUSLINE /* michael */
+ if (screen->instatus)
+ ClearLeft(screen);
+ else
+ #endif STATUSLINE
ClearAbove(screen);
break;
case 2:
+ #ifdef STATUSLINE /* michael */
+ if (screen->instatus)
+ ClearLine(screen);
+ else
+ #endif STATUSLINE
ClearScreen(screen);
break;
}
***************
*** 617,633 ****
--- 892,922 ----
case CASE_IL:
/* IL */
+ #ifdef STATUSLINE /* michael */
+ /* only if not in status line */
+ if (!screen->instatus) {
+ #endif STATUSLINE
if((c = param[0]) < 1)
c = 1;
InsertLine(screen, c);
+ #ifdef STATUSLINE /* michael */
+ }
+ #endif STATUSLINE
parsestate = groundtable;
break;
case CASE_DL:
/* DL */
+ #ifdef STATUSLINE /* michael */
+ /* only if not in status line */
+ if (!screen->instatus) {
+ #endif STATUSLINE
if((c = param[0]) < 1)
c = 1;
DeleteLine(screen, c);
+ #ifdef STATUSLINE /* michael */
+ }
+ #endif STATUSLINE
parsestate = groundtable;
break;
***************
*** 732,737 ****
--- 1021,1030 ----
case CASE_DECSTBM:
/* DECSTBM */
+ #ifdef STATUSLINE /* michael */
+ /* only if not in status line */
+ if (!screen->instatus) {
+ #endif STATUSLINE
if((top = param[0]) < 1)
top = 1;
if(nparam < 2 || (bot = param[1]) == DEFAULT
***************
*** 745,750 ****
--- 1038,1046 ----
screen->bot_marg = bot-1;
CursorSet(screen, 0, 0, term->flags);
}
+ #ifdef STATUSLINE /* michael */
+ }
+ #endif STATUSLINE
parsestate = groundtable;
break;
***************
*** 800,805 ****
--- 1096,1107 ----
break;
case CASE_GSETS:
+ #ifdef KANJI /* sano & kagotani */
+ if (mbcs) {
+ c |= MBCS;
+ mbcs = 0;
+ }
+ #endif KANJI
screen->gsets[scstype] = c;
parsestate = groundtable;
break;
***************
*** 830,835 ****
--- 1132,1141 ----
case CASE_IND:
/* IND */
+ #ifdef STATUSLINE /* michael */
+ /* only if not in status line */
+ if (!screen->instatus)
+ #endif STATUSLINE
Index(screen, 1);
if(screen->display->qlen > 0 ||
(ioctl(screen->display->fd, FIONREAD, (char *)&arg), arg) > 0)
***************
*** 839,844 ****
--- 1145,1154 ----
case CASE_NEL:
/* NEL */
+ #ifdef STATUSLINE /* michael */
+ /* only if not in status line */
+ if (!screen->instatus)
+ #endif STATUSLINE
Index(screen, 1);
CarriageReturn(screen);
if(screen->display->qlen > 0 ||
***************
*** 855,860 ****
--- 1165,1174 ----
case CASE_RI:
/* RI */
+ #ifdef STATUSLINE /* michael */
+ /* only if not in status line */
+ if (!screen->instatus)
+ #endif STATUSLINE
RevIndex(screen, 1);
parsestate = groundtable;
break;
***************
*** 920,925 ****
--- 1234,1268 ----
parsestate = groundtable;
break;
+ #ifdef STATUSLINE /* michael */
+ case CASE_TO_STATUS:
+ if ((c = param[0]) < 1)
+ c = 1;
+ ToStatus(c - 1);
+ parsestate = groundtable;
+ break ;
+
+ case CASE_FROM_STATUS:
+ FromStatus();
+ parsestate = groundtable;
+ break ;
+
+ case CASE_SHOW_STATUS:
+ ShowStatus();
+ parsestate = groundtable;
+ break ;
+
+ case CASE_HIDE_STATUS:
+ HideStatus();
+ parsestate = groundtable;
+ break ;
+
+ case CASE_ERASE_STATUS:
+ EraseStatus();
+ parsestate = groundtable;
+ break ;
+ #endif STATUSLINE
+
case CASE_XTERM_SAVE:
savemodes(term);
parsestate = groundtable;
***************
*** 930,935 ****
--- 1273,1281 ----
parsestate = groundtable;
break;
}
+ #ifdef KANJI /* sano */
+ }
+ #endif KANJI
}
finput()
***************
*** 1031,1038 ****
--- 1377,1392 ----
if((select_mask & pty_mask) && (eventMode == NORMAL)) {
if(screen->logging)
FlushLog(screen);
+ #ifdef KANJI /* sano */
+ /*
+ * buffer[0] is reserved for the pending_char.
+ */
+ if((bcnt = read(screen->respond, bptr = &buffer[1],
+ BUF_SIZE)) < 0) {
+ #else KANJI
if((bcnt = read(screen->respond, bptr = buffer,
BUF_SIZE)) < 0) {
+ #endif KANJI
if(errno == EIO)
Cleanup (0);
else if(errno != EWOULDBLOCK)
***************
*** 1042,1050 ****
--- 1396,1416 ----
} else if(bcnt == 0)
Panic("input: read returned zero\n", 0);
else {
+ #ifdef KANJI /* sano */
+ if (pending_char) {
+ /*
+ * restore pending_char to the top of
+ * the text which just read.
+ */
+ *--bptr = pending_char;
+ bcnt++;
+ pending_char = 0;
+ }
+ #else KANJI
/* strip parity bit */
for(i = bcnt, cp = bptr ; i > 0 ; i--)
*cp++ &= CHAR;
+ #endif KANJI
if(screen->scrollWidget && screen->scrollinput &&
screen->topline < 0)
/* Scroll to bottom */
***************
*** 1119,1125 ****
--- 1485,1495 ----
dotext(screen, flags, charset, buf, ptr)
register TScreen *screen;
unsigned flags;
+ #ifdef KANJI /* sano */
+ short charset;
+ #else KANJI
char charset;
+ #endif KANJI
char *buf;
char *ptr;
{
***************
*** 1127,1132 ****
--- 1497,1505 ----
register int len;
register int n;
register int next_col;
+ #ifdef KANJI /* sano */
+ register int do_wrap = 0;
+ #endif KANJI
switch (charset) {
case 'A': /* United Kingdom set */
***************
*** 1136,1141 ****
--- 1509,1526 ----
break;
case 'B': /* ASCII set */
+ #ifdef KANJI /* sano */
+ /*
+ * 'H' should be removed here because it is *not*
+ * ascii but Swedish character set. Some Kanji text
+ * still includes ESC-(-H, which does not designate
+ * Romaji nor ascii character set. This is due to
+ * the mis-printing of early JIS documentation.
+ */
+ case 'J':
+ case 'H':
+ case '@':
+ #endif KANJI
break;
case '0': /* special graphics (line drawing) */
***************
*** 1144,1149 ****
--- 1529,1549 ----
*s = *s == 0x5f ? 0x7f : *s - 0x5f;
break;
+ #ifdef KANJI /* sano */
+ case 'I':
+ flags |= KANACS;
+ for (s = buf; s < ptr; ++s)
+ *s &= 0x7f;
+ break;
+ /*
+ * ESC-$-(-@ and ESC-$-(-B designate the Kanji character set.
+ * set KCS flags...
+ */
+ case MBCS|'@':
+ case MBCS|'B':
+ flags |= KCS;
+ break;
+ #endif
default: /* any character sets we don't recognize*/
return;
}
***************
*** 1153,1159 ****
--- 1553,1564 ----
while (len > 0) {
n = screen->max_col-screen->cur_col+1;
if (n <= 1) {
+ #ifdef STATUSLINE /* michael */
+ if (screen->do_wrap && (flags&WRAPAROUND) &&
+ !screen->instatus) {
+ #else STATUSLINE
if (screen->do_wrap && (flags&WRAPAROUND)) {
+ #endif STATUSLINE
Index(screen, 1);
screen->cur_col = 0;
screen->do_wrap = 0;
***************
*** 1163,1168 ****
--- 1568,1585 ----
}
if (len < n)
n = len;
+ #ifdef KANJI
+ if (flags & KCS) {
+ if (n == 1) {
+ if (flags & WRAPAROUND) {
+ n--; do_wrap = 1;
+ } else
+ n++;
+ } else
+ if (n & 1)
+ n--;
+ }
+ #endif
next_col = screen->cur_col + n;
WriteText(screen, ptr, n, flags);
/*
***************
*** 1170,1176 ****
--- 1587,1597 ----
* If screen->cur_col != next_col, we must have
* hit the right margin, so set the do_wrap flag.
*/
+ #ifdef KANJI /* sano */
+ screen->do_wrap = (screen->cur_col < next_col) | do_wrap;
+ #else KANJI
screen->do_wrap = (screen->cur_col < next_col);
+ #endif KANJI
len -= n;
ptr += n;
}
***************
*** 1190,1196 ****
--- 1611,1624 ----
register unsigned fgs = flags;
GC currentGC;
+ #ifdef STATUSLINE /* michael */
+ if(screen->instatus && screen->reversestatus)
+ fgs ^= INVERSE;
+ if(screen->cur_row - screen->topline <= screen->max_row ||
+ screen->instatus) {
+ #else STATUSLINE
if(screen->cur_row - screen->topline <= screen->max_row) {
+ #endif STATUSLINE
/*
if(screen->cur_row == screen->cursor_row && screen->cur_col <=
screen->cursor_col && screen->cursor_col <= screen->cur_col + len - 1)
***************
*** 1203,1208 ****
--- 1631,1667 ----
* make sure that the correct GC is current
*/
+ #ifdef KANJI /* sano */
+ if (fgs & KCS) { /* kanji */
+ if (fgs & BOLD) {
+ if (fgs & INVERSE) {
+ currentGC = screen->w_reverseboldGC;
+ } else {
+ currentGC = screen->w_normalboldGC;
+ }
+ } else {
+ if (fgs & INVERSE) {
+ currentGC = screen->w_reverseGC;
+ } else {
+ currentGC = screen->w_normalGC;
+ }
+ }
+ } else if (fgs & KANACS) { /* kana */
+ if (fgs & BOLD) {
+ if (fgs & INVERSE) {
+ currentGC = screen->r_reverseboldGC;
+ } else {
+ currentGC = screen->r_normalboldGC;
+ }
+ } else {
+ if (fgs & INVERSE) {
+ currentGC = screen->r_reverseGC;
+ } else {
+ currentGC = screen->r_normalGC;
+ }
+ }
+ } else
+ #endif KANJI
if (fgs & BOLD)
if (fgs & INVERSE)
currentGC = screen->reverseboldGC;
***************
*** 1219,1231 ****
FlushScroll(screen);
cx = CursorX(screen, screen->cur_col);
cy = CursorY(screen, screen->cur_row)+screen->fnt_norm->ascent;
XDrawImageString(screen->display, TextWindow(screen), currentGC,
cx, cy, str, len);
if((fgs & BOLD) && screen->enbolden)
! if (currentGC == screen->normalGC || screen->reverseGC)
XDrawString(screen->display, TextWindow(screen),
currentGC,cx + 1, cy, str, len);
if(fgs & UNDERLINE)
XDrawLine(screen->display, TextWindow(screen), currentGC,
--- 1678,1727 ----
FlushScroll(screen);
cx = CursorX(screen, screen->cur_col);
cy = CursorY(screen, screen->cur_row)+screen->fnt_norm->ascent;
+ #ifdef KANJI /* sano & michael */
+ if (fgs & KCS) {
+ /*
+ * Draw Kanji string with currentGC. If no k_boldGC nor
+ * k_reverseboldGC, then overstrike it.
+ */
+ XDrawImageString16(screen->display, TextWindow(screen),
+ currentGC, cx, cy, (XChar2b *)str, len / 2);
+ if ((fgs & BOLD) && screen->w_enbolden)
+ if (currentGC == screen->w_normalGC ||
+ currentGC == screen->w_reverseGC)
+ XDrawString16(screen->display,
+ TextWindow(screen), currentGC,
+ cx + 1, cy, (XChar2b *)str, len / 2);
+ } else if (fgs & KANACS) {
+ /*
+ * Draw Kanji string with currentGC. If no k_boldGC nor
+ * k_reverseboldGC, then overstrike it.
+ */
+ XDrawImageString(screen->display, TextWindow(screen),
+ currentGC, cx, cy, str, len);
+ if ((fgs & BOLD) && screen->r_enbolden)
+ if (currentGC == screen->r_normalGC ||
+ currentGC == screen->r_reverseGC)
+ XDrawString(screen->display,
+ TextWindow(screen), currentGC,
+ cx + 1, cy, str, len);
+ } else {
+ #endif KANJI
XDrawImageString(screen->display, TextWindow(screen), currentGC,
cx, cy, str, len);
if((fgs & BOLD) && screen->enbolden)
! /*
! * Bug fix by michael
! * original: if (currentGC == screen->normalGC || screen->reverseGC)
! */
! if (currentGC == screen->normalGC ||
! currentGC == screen->reverseGC)
XDrawString(screen->display, TextWindow(screen),
currentGC,cx + 1, cy, str, len);
+ #ifdef KANJI /* sano */
+ }
+ #endif KANJI
if(fgs & UNDERLINE)
XDrawLine(screen->display, TextWindow(screen), currentGC,
***************
*** 1309,1314 ****
--- 1805,1813 ----
+ screen->scrollbar,
(Dimension) FontHeight(screen)
* (screen->max_row + 1)
+ #ifdef STATUSLINE /* michael */
+ + screen->statusheight
+ #endif STATUSLINE
+ 2 * screen->border,
&replyWidth, &replyHeight);
***************
*** 1399,1404 ****
--- 1898,1912 ----
else
FromAlternate(screen);
break;
+ #ifdef STATUSLINE /* michael */
+ case 48:
+ j = screen->reversestatus;
+ (*func)(&screen->reversestatus, 1);
+ if (j != screen->reversestatus)
+ ScrnRefresh(screen, screen->max_row + 1, 0, 1,
+ screen->max_col + 1);
+ break;
+ #endif STATUSLINE
case 1000: /* xtem bogus sequence */
if(func == bitset)
screen->send_mouse_pos = 2;
***************
*** 1474,1479 ****
--- 1982,1992 ----
case 47: /* alternate buffer */
screen->save_modes[15] = screen->alternate;
break;
+ #ifdef STATUSLINE /* michael */
+ case 48:
+ screen->save_modes[16] = screen->reversestatus;
+ break;
+ #endif STATUSLINE
case 1000: /* mouse bogus sequence */
case 1001:
screen->save_modes[7] = screen->send_mouse_pos;
***************
*** 1514,1519 ****
--- 2027,2035 ----
+ screen->scrollbar,
(Dimension) FontHeight(screen)
* (screen->max_row + 1)
+ #ifdef STATUSLINE /* michael */
+ + screen->statusheight
+ #endif STATUSLINE
+ 2*screen->border,
&replyWidth, &replyHeight);
***************
*** 1601,1606 ****
--- 2117,2131 ----
else
FromAlternate(screen);
break;
+ #ifdef STATUSLINE /* michael */
+ case 48: /* reverse status line */
+ if (screen->save_modes[16] != screen->reversestatus) {
+ screen->reversestatus = screen->save_modes[16];
+ ScrnRefresh(screen, screen->max_row + 1, 0, 1,
+ screen->max_col + 1);
+ }
+ break;
+ #endif STATUSLINE
case 1000: /* mouse bogus sequence */
case 1001:
screen->send_mouse_pos = screen->save_modes[7];
***************
*** 1695,1702 ****
--- 2220,2232 ----
if(screen->alternate)
return;
if(!screen->altbuf)
+ #ifdef STATUSLINE /* michael */
+ screen->altbuf = Allocate(screen->max_row + 2, screen->max_col
+ + 1);
+ #else STATUSLINE
screen->altbuf = Allocate(screen->max_row + 1, screen->max_col
+ 1);
+ #endif STATUSLINE
SwitchBufs(screen);
screen->alternate = TRUE;
}
***************
*** 1727,1733 ****
--- 2257,2267 ----
if((top = -screen->topline) <= screen->max_row) {
if(screen->scroll_amt)
FlushScroll(screen);
+ #ifdef STATUSLINE /* michael */
+ if(top == 0 && !screen->statusline)
+ #else STATUSLINE
if(top == 0)
+ #endif STATUSLINE
XClearWindow(screen->display, TextWindow(screen));
else
XClearArea(
***************
*** 1846,1852 ****
--- 2380,2397 ----
Widget w;
{
if (XtIsRealized(w))
+ #ifdef STATUSLINE /* kato */
+ {
ScreenResize (&term->screen, term->core.width, term->core.height, &term->flags);
+ XClearWindow(term->screen.display, term->screen.fullVwin.window);
+ ScrnRefresh(&term->screen, 0, 0,
+ term->screen.max_row,
+ term->screen.max_col);
+ }
+ #else STATUSLINE
+ ScreenResize (&term->screen, term->core.width, term->core.height, &term->flags);
+ #endif STATUSLINE
+
}
static Boolean failed = FALSE;
***************
*** 1909,1914 ****
--- 2454,2463 ----
new->screen.always_highlight = request->screen.always_highlight;
new->screen.pointer_cursor = request->screen.pointer_cursor;
new->misc.titeInhibit = request->misc.titeInhibit;
+ #ifdef STATUSLINE /* kato */
+ new->screen.statusline = request->screen.statusline;
+ new->screen.reversestatus = request->screen.reversestatus;
+ #endif STATUSLINE
/*
* set the colors if reverse video; this is somewhat tricky since
***************
*** 1993,1998 ****
--- 2542,2551 ----
TabReset (term->tabs);
+ #ifdef KANJI /* sano */
+ screen->fnt_r_norm = screen->fnt_r_bold =
+ screen->fnt_w_norm = screen->fnt_w_bold =
+ #endif KANJI
screen->fnt_norm = screen->fnt_bold = NULL;
/* do the XFont calls */
***************
*** 2014,2020 ****
--- 2567,2596 ----
screen->fnt_bold = screen->fnt_norm;
screen->enbolden = TRUE; /*no bold font */
}
+ #ifdef KANJI /* sano */
+ if (!term->misc.f_rn ||
+ !(screen->fnt_r_norm =
+ XLoadQueryFont(screen->display, term->misc.f_rn)))
+ screen->fnt_r_norm = screen->fnt_norm;
+ if (!term->misc.f_rb ||
+ !(screen->fnt_r_bold =
+ XLoadQueryFont(screen->display, term->misc.f_rb))) {
+ screen->fnt_r_bold = screen->fnt_r_norm;
+ screen->r_enbolden = TRUE; /* no bold font */
+ }
+ if (!term->misc.f_kn ||
+ !(screen->fnt_w_norm =
+ XLoadQueryFont(screen->display, term->misc.f_kn)))
+ screen->fnt_w_norm = screen->fnt_norm;
+ if (!term->misc.f_kb ||
+ !(screen->fnt_w_bold =
+ XLoadQueryFont(screen->display, term->misc.f_kb))) {
+ screen->fnt_w_bold = screen->fnt_w_norm;
+ screen->w_enbolden = TRUE; /* no bold font */
+ }
+ #endif KANJI
+
/* find the max width and higth of the font */
screen->fullVwin.f_width = screen->fnt_norm->max_bounds.width;
***************
*** 2042,2051 ****
--- 2618,2635 ----
screen->scrollWidget->core.width : 0);
i = 2 * screen->border + scrollbar_width;
j = 2 * screen->border;
+ #ifdef STATUSLINE /* michael */
+ if (screen->statusline)
+ j += (screen->statusheight = screen->fullVwin.f_height + 2);
+ #endif STATUSLINE
/* set defaults */
+ #ifdef KANJI /* ishisone */
+ xpos = 0; ypos = 0; width = 80; height = 24;
+ #else /* KANJI */
xpos = 1; ypos = 1; width = 80; height = 24;
+ #endif /* KANJI */
pr = XParseGeometry(term->misc.geo_metry, &xpos, &ypos, &width, &height);
***************
*** 2064,2069 ****
--- 2648,2656 ----
/* set up size hints for window manager */
sizehints.min_width = 2 * screen->border + scrollbar_width;
sizehints.min_height = 2 * screen->border;
+ #ifdef STATUSLINE /* ishisone */
+ sizehints.min_height += screen->statusheight;
+ #endif
sizehints.width_inc = FontWidth(screen);
sizehints.height_inc = FontHeight(screen);
sizehints.flags = PMinSize|PResizeInc;
***************
*** 2101,2107 ****
--- 2688,2698 ----
if (term->misc.re_verse && (term->core.border_pixel == term->core.background_pixel))
values->border_pixel = term->core.border_pixel = term->screen.foreground;
+ #ifdef STATUSLINE
+ values->bit_gravity = ForgetGravity;
+ #else
values->bit_gravity = NorthWestGravity;
+ #endif
term->screen.fullVwin.window = term->core.window =
XCreateWindow(XtDisplay(term), XtWindow(term->core.parent),
term->core.x, term->core.y,
***************
*** 2122,2127 ****
--- 2713,2732 ----
xgcv.background = term->core.background_pixel;
screen->normalGC = XtGetGC((Widget)term, mask, &xgcv);
+ #ifdef KANJI /* sano */
+ if (screen->fnt_r_norm == screen->fnt_norm) {
+ screen->r_normalGC = screen->normalGC;
+ } else {
+ xgcv.font = screen->fnt_r_norm->fid;
+ screen->r_normalGC = XtGetGC((Widget)term, mask, &xgcv) ;
+ }
+ if (screen->fnt_w_norm == screen->fnt_norm) {
+ screen->w_normalGC = screen->normalGC;
+ } else {
+ xgcv.font = screen->fnt_w_norm->fid;
+ screen->w_normalGC = XtGetGC((Widget)term, mask, &xgcv) ;
+ }
+ #endif KANJI
if (screen->enbolden) { /* there is no bold font */
xgcv.font = screen->fnt_norm->fid;
***************
*** 2130,2135 ****
--- 2735,2756 ----
xgcv.font = screen->fnt_bold->fid;
screen->normalboldGC = XtGetGC((Widget)term, mask, &xgcv);
}
+ #ifdef KANJI /* sano */
+ if (screen->r_enbolden) { /* there is no bold kana font */
+ xgcv.font = screen->fnt_r_norm->fid;
+ screen->r_normalboldGC = screen->r_normalGC;
+ } else {
+ xgcv.font = screen->fnt_r_bold->fid;
+ screen->r_normalboldGC = XtGetGC((Widget)term, mask, &xgcv);
+ }
+ if (screen->w_enbolden) { /* there is no bold kanji font */
+ xgcv.font = screen->fnt_w_norm->fid;
+ screen->w_normalboldGC = screen->w_normalGC;
+ } else {
+ xgcv.font = screen->fnt_w_bold->fid;
+ screen->w_normalboldGC = XtGetGC((Widget)term, mask, &xgcv);
+ }
+ #endif KANJI
xgcv.font = screen->fnt_norm->fid;
xgcv.foreground = term->core.background_pixel;
***************
*** 2137,2142 ****
--- 2758,2778 ----
screen->reverseGC = XtGetGC((Widget)term, mask, &xgcv);
+ #ifdef KANJI /* sano */
+ if (screen->fnt_r_norm == screen->fnt_norm) {
+ screen->r_reverseGC = screen->reverseGC;
+ } else {
+ xgcv.font = screen->fnt_r_norm->fid;
+ screen->r_reverseGC = XtGetGC((Widget)term, mask, &xgcv);
+ }
+ if (screen->fnt_w_norm == screen->fnt_norm) {
+ screen->w_reverseGC = screen->reverseGC;
+ } else {
+ xgcv.font = screen->fnt_w_norm->fid;
+ screen->w_reverseGC = XtGetGC((Widget)term, mask, &xgcv);
+ }
+ #endif KANJI
+
if (screen->enbolden) /* there is no bold font */
xgcv.font = screen->fnt_norm->fid;
else
***************
*** 2144,2149 ****
--- 2780,2801 ----
screen->reverseboldGC = XtGetGC((Widget)term, mask, &xgcv);
+ #ifdef KANJI /* sano */
+ if (screen->r_enbolden) { /* there is no bold kana font */
+ xgcv.font = screen->fnt_r_norm->fid;
+ } else {
+ xgcv.font = screen->fnt_r_bold->fid;
+ }
+ screen->r_reverseboldGC = XtGetGC((Widget)term, mask, &xgcv);
+
+ if (screen->w_enbolden) { /* there is no bold kanji font */
+ xgcv.font = screen->fnt_w_norm->fid;
+ } else {
+ xgcv.font = screen->fnt_w_bold->fid;
+ }
+ screen->w_reverseboldGC = XtGetGC((Widget)term, mask, &xgcv);
+ #endif KANJI
+
/* we also need a set of caret (called a cursor here) gc's */
xgcv.font = screen->fnt_norm->fid;
***************
*** 2198,2208 ****
--- 2850,2908 ----
screen->cursoroutlineGC = (GC) 0;
}
}
+ #ifdef KANJI /* michael */
+ xgcv.font = screen->fnt_r_norm->fid;
+ {
+ unsigned long cc = screen->cursorcolor;
+ unsigned long fg = screen->foreground;
+ unsigned long bg = term->core.background_pixel;
+ if (cc != fg && cc != bg) {
+ /* we have a colored cursor */
+ xgcv.foreground = fg;
+ xgcv.background = cc;
+ screen->r_cursorGC = XtGetGC ((Widget) term, mask, &xgcv);
+
+ xgcv.foreground = bg;
+ xgcv.background = cc;
+ screen->r_reversecursorGC = XtGetGC ((Widget) term, mask, &xgcv);
+ } else {
+ screen->r_cursorGC = (GC) 0;
+ screen->r_reversecursorGC = (GC) 0;
+ }
+ }
+
+ xgcv.font = screen->fnt_w_norm->fid;
+ {
+ unsigned long cc = screen->cursorcolor;
+ unsigned long fg = screen->foreground;
+ unsigned long bg = term->core.background_pixel;
+
+ if (cc != fg && cc != bg) {
+ /* we have a colored cursor */
+ xgcv.foreground = fg;
+ xgcv.background = cc;
+ screen->w_cursorGC = XtGetGC ((Widget) term, mask, &xgcv);
+
+ xgcv.foreground = bg;
+ xgcv.background = cc;
+ screen->w_reversecursorGC = XtGetGC ((Widget) term, mask, &xgcv);
+ } else {
+ screen->w_cursorGC = (GC) 0;
+ screen->w_reversecursorGC = (GC) 0;
+ }
+ }
+ #endif KANJI
+
+
/* Reset variables used by ANSI emulation. */
screen->gsets[0] = 'B'; /* ASCII_G */
+ #ifdef KANJI /* sano */
+ screen->gsets[1] = 'I';
+ #else KANJI
screen->gsets[1] = 'B';
+ #endif KANJI
screen->gsets[2] = 'B'; /* DEC supplemental. */
screen->gsets[3] = 'B';
screen->curgl = 0; /* G0 => GL. */
***************
*** 2230,2240 ****
--- 2930,2969 ----
screen->scrolls = screen->incopy = 0;
/* free((char *)fInfo); */
vp = &VTbox[1];
+ #ifdef R2SERVER
(vp++)->x = FontWidth(screen) - 1;
+ (vp++)->y = screen->fnt_norm->max_bounds.ascent +
+ screen->fnt_norm->max_bounds.descent - 1;
+ (vp++)->x = -(FontWidth(screen) - 1);
+ vp->y = -(screen->fnt_norm->max_bounds.ascent +
+ screen->fnt_norm->max_bounds.descent - 1);
+ #else
+ (vp++)->x = FontWidth(screen) - 1;
(vp++)->y = FontHeight(screen) - 1;
(vp++)->x = -(FontWidth(screen) - 1);
vp->y = -(FontHeight(screen) - 1);
+ #endif
screen->box = VTbox;
+ #ifdef KANJI /* sano */
+ vp = &VTwbox[1];
+ #ifdef R2SERVER
+ (vp++)->x = FontWidth(screen) * 2 - 1;
+ (vp++)->y = screen->fnt_norm->max_bounds.ascent +
+ screen->fnt_norm->max_bounds.descent - 1;
+ (vp++)->x = -(FontWidth(screen) * 2 - 1);
+ vp->y = -(screen->fnt_norm->max_bounds.ascent +
+ screen->fnt_norm->max_bounds.descent - 1);
+ #else
+ (vp++)->x = FontWidth(screen) * 2 - 1;
+ (vp++)->y = FontHeight(screen) - 1;
+ (vp++)->x = -(FontWidth(screen) * 2 - 1);
+ vp->y = -(FontHeight(screen) - 1);
+ #endif
+ screen->w_box = VTwbox;
+ #endif KANJI
+ #ifdef STATUSLINE /* michael */
+ status_box[0].x = screen->border - 1;
+ #endif STATUSLINE
screen->savedlines = 0;
***************
*** 2254,2272 ****
--- 2983,3030 ----
{
register TScreen *screen = &term->screen;
register int x, y, flags;
+ #ifdef KANJI /* sano */
+ register int offset = 0;
+ unsigned char cc[2];
+ #else KANJI
char c;
+ #endif KANJI
GC currentGC;
Boolean in_selection;
if (eventMode != NORMAL) return;
+ #ifdef STATUSLINE /* michael */
+ if (!screen->instatus &&
+ screen->cur_row - screen->topline > screen->max_row)
+ #else STATUSLINE
if (screen->cur_row - screen->topline > screen->max_row)
+ #endif STATUSLINE
return;
+ #ifdef KANJI /* sano */
+ cc[0] = screen->buf[y = 2 * (screen->cursor_row = screen->cur_row)]
+ #else KANJI
c = screen->buf[y = 2 * (screen->cursor_row = screen->cur_row)]
+ #endif KANJI
[x = screen->cursor_col = screen->cur_col];
flags = screen->buf[y + 1][x];
+ #ifdef KANJI /* sano */
+ if (cc[0] == 0) {
+ cc[0] = ' ';
+ flags &= ~(KCS|KANACS);
+ } else if (flags & KCS) {
+ if (flags & KCS1)
+ cc[1] = screen->buf[y][x + 1];
+ else {
+ offset = -1;
+ cc[1] = cc[0];
+ cc[0] = screen->buf[y][x - 1];
+ }
+ }
+ #else KANJI
if (c == 0)
c = ' ';
+ #endif KANJI
if (screen->cur_row > screen->endHRow ||
(screen->cur_row == screen->endHRow &&
***************
*** 2278,2284 ****
--- 3036,3109 ----
else
in_selection = True;
+ #ifdef STATUSLINE /* michael */
+ if(screen->instatus && screen->reversestatus)
+ /* if (screen->instatus) */
+ flags ^= INVERSE;
+ #endif STATUSLINE
+
if(screen->select || screen->always_highlight) {
+ #ifdef KANJI /* sano & micheal */
+ if (flags & KCS) {
+ if (( (flags & INVERSE) && !in_selection) ||
+ (!(flags & INVERSE) && in_selection)){
+ /* text is reverse video */
+ if (screen->w_cursorGC) {
+ currentGC = screen->w_cursorGC;
+ } else {
+ if (flags & BOLD) {
+ currentGC =
+ screen->w_normalboldGC;
+ } else {
+ currentGC =
+ screen->w_normalGC;
+ }
+ }
+ } else { /* normal video */
+ if (screen->w_reversecursorGC) {
+ currentGC = screen->w_reversecursorGC;
+ } else {
+ if (flags & BOLD) {
+ currentGC =
+ screen->w_reverseboldGC;
+ } else {
+ currentGC =
+ screen->w_reverseGC;
+ }
+ }
+
+ }
+ } else if (flags & KANACS) {
+ if (( (flags & INVERSE) && !in_selection) ||
+ (!(flags & INVERSE) && in_selection)){
+ /* text is reverse video */
+ if (screen->r_cursorGC) {
+ currentGC = screen->r_cursorGC;
+ } else {
+ if (flags & BOLD) {
+ currentGC =
+ screen->r_normalboldGC;
+ } else {
+ currentGC =
+ screen->r_normalGC;
+ }
+ }
+ } else { /* normal video */
+ if (screen->r_reversecursorGC) {
+ currentGC = screen->r_reversecursorGC;
+ } else {
+ if (flags & BOLD) {
+ currentGC =
+ screen->r_reverseboldGC;
+ } else {
+ currentGC =
+ screen->r_reverseGC;
+ }
+ }
+
+ }
+ } else
+ #endif KANJI
if (( (flags & INVERSE) && !in_selection) ||
(!(flags & INVERSE) && in_selection)){
/* text is reverse video */
***************
*** 2303,2321 ****
}
}
} else { /* not selected */
if (( (flags & INVERSE) && !in_selection) ||
(!(flags & INVERSE) && in_selection)) {
/* text is reverse video */
! currentGC = screen->reverseGC;
} else { /* normal video */
! currentGC = screen->normalGC;
}
}
x = CursorX (screen, screen->cur_col);
y = CursorY(screen, screen->cur_row) +
screen->fnt_norm->ascent;
XDrawImageString(screen->display, TextWindow(screen), currentGC,
x, y, &c, 1);
--- 3128,3254 ----
}
}
} else { /* not selected */
+ #ifdef KANJI /* sano */
+ if (flags & KCS) {
+ if (( (flags & INVERSE) && !in_selection) ||
+ (!(flags & INVERSE) && in_selection)) {
+ /* text is reverse video */
+ if (screen->w_reversecursorGC) {
+ currentGC = screen->w_reversecursorGC;
+ } else {
+ currentGC = screen->w_reverseGC;
+ }
+ } else { /* normal video */
+ if (screen->w_cursorGC) {
+ currentGC = screen->w_cursorGC;
+ } else {
+ currentGC = screen->w_normalGC;
+ }
+ }
+ } else if (flags & KANACS) {
+ if (( (flags & INVERSE) && !in_selection) ||
+ (!(flags & INVERSE) && in_selection)) {
+ /* text is reverse video */
+ if (screen->r_reversecursorGC) {
+ currentGC = screen->r_reversecursorGC;
+ } else {
+ currentGC = screen->r_reverseGC;
+ }
+ } else { /* normal video */
+ if (screen->r_cursorGC) {
+ currentGC = screen->r_cursorGC;
+ } else {
+ currentGC = screen->r_normalGC;
+ }
+ }
+ } else
+ #endif KANJI
+
+ /*
+ * Bug fix by michael
+ * Originials:
+ * if(flags & INVERSE) { /* is reverse video */
+ /* currentGC = screen->reverseGC;
+ * } else { /* normal video */
+ /* currentGC = screen->normalGC;
+ * }
+ */
if (( (flags & INVERSE) && !in_selection) ||
(!(flags & INVERSE) && in_selection)) {
/* text is reverse video */
! if (screen->reversecursorGC) {
! currentGC = screen->reversecursorGC;
! } else {
! currentGC = screen->reverseGC;
! }
} else { /* normal video */
! if (screen->cursorGC) {
! currentGC = screen->cursorGC;
! } else {
! currentGC = screen->normalGC;
! }
}
}
+
+ #ifdef KANJI /* sano */
+ x = CursorX (screen, screen->cur_col + offset);
+ #else KANJI
x = CursorX (screen, screen->cur_col);
+ #endif KANJI
y = CursorY(screen, screen->cur_row) +
screen->fnt_norm->ascent;
+ #ifdef KANJI /* sano */
+ if (flags & KCS) {
+ /*
+ * If the cursor is on a Kanji character, then it should
+ * be drawn as the double sized cursor. If the screen is
+ * selected, the currentGC should be k_reverseGC or
+ * k_reverseboldGC, and then inversed cursor is obtained.
+ * If the screen is not selected, draw a box with w_box.
+ */
+ XDrawImageString16(screen->display, TextWindow(screen),
+ currentGC, x, y, (XChar2b *)cc, 1);
+ if ((flags & BOLD) && screen->w_enbolden) /* no bold kanji font*/
+ XDrawString16(screen->display, TextWindow(screen),
+ currentGC, x + 1, y, (XChar2b *)cc, 1);
+ if (flags & UNDERLINE)
+ XDrawLine(screen->display, TextWindow(screen),
+ currentGC, x, y + 1,
+ x + FontWidth(screen) * 2, y + 1);
+ if (!screen->select) {
+ screen->w_box->x = x;
+ screen->w_box->y = y - screen->fnt_norm->ascent;
+ XDrawLines(screen->display, TextWindow(screen),
+ currentGC, screen->w_box, NBOX,
+ CoordModePrevious);
+ }
+ } else {
+ XDrawImageString(screen->display, TextWindow(screen),
+ currentGC, x, y, cc, 1);
+ if (flags & KANACS) {
+ if ((flags & BOLD) && screen->r_enbolden) /* no bold */
+ XDrawString(screen->display, TextWindow(screen),
+ currentGC, x + 1, y, cc, 1);
+ } else {
+ if ((flags & BOLD) && screen->enbolden) /* no bold */
+ XDrawString(screen->display, TextWindow(screen),
+ currentGC, x + 1, y, cc, 1);
+ }
+ if (flags & UNDERLINE)
+ XDrawLine(screen->display, TextWindow(screen),
+ currentGC, x, y + 1,
+ x + FontWidth(screen), y + 1);
+ if (!screen->select) {
+ screen->box->x = x;
+ screen->box->y = y - screen->fnt_norm->ascent;
+ XDrawLines(screen->display, TextWindow(screen),
+ currentGC, screen->box,
+ NBOX, CoordModePrevious);
+ }
+ }
+ #else KANJI
XDrawImageString(screen->display, TextWindow(screen), currentGC,
x, y, &c, 1);
***************
*** 2333,2338 ****
--- 3266,3272 ----
: currentGC,
screen->box, NBOX, CoordModePrevious);
}
+ #endif KANJI
screen->cursor_state = ON;
}
***************
*** 2344,2355 ****
--- 3278,3306 ----
register TScreen *screen = &term->screen;
GC currentGC;
register int x, y, flags;
+ #ifdef STATUSLINE /* michael */
+ register int instatus;
+ #endif STATUSLINE
+ #ifdef KANJI /* sano */
+ register offset = 0;
+ unsigned char cc[2];
+ #else KANJI
char c;
+ #endif KANJI
Boolean in_selection;
+ #ifdef STATUSLINE /* michael */
+ if(!(instatus = screen->cursor_row > screen->max_row) &&
+ screen->cursor_row - screen->topline > screen->max_row)
+ #else STATUSLINE
if(screen->cursor_row - screen->topline > screen->max_row)
+ #endif STATUSLINE
return;
+ #ifdef KANJI /* sano */
+ cc[0] = screen->buf[y = 2 * screen->cursor_row][x = screen->cursor_col];
+ #else KANJI
c = screen->buf[y = 2 * screen->cursor_row][x = screen->cursor_col];
+ #endif KANJI
flags = screen->buf[y + 1][x];
if (screen->cursor_row > screen->endHRow ||
***************
*** 2362,2367 ****
--- 3313,3356 ----
else
in_selection = True;
+ #ifdef STATUSLINE /* michael */
+ if(screen->instatus && screen->reversestatus)
+ /* if (screen->instatus) */
+ flags ^= INVERSE;
+ #endif STATUSLINE
+ #ifdef KANJI /* sano */
+ if (flags & KCS) {
+ if (( (flags & INVERSE) && !in_selection) ||
+ (!(flags & INVERSE) && in_selection)) {
+ if (flags & BOLD) {
+ currentGC = screen->w_reverseboldGC;
+ } else {
+ currentGC = screen->w_reverseGC;
+ }
+ } else {
+ if (flags & BOLD) {
+ currentGC = screen->w_normalboldGC;
+ } else {
+ currentGC = screen->w_normalGC;
+ }
+ }
+ } else if (flags & KANACS) {
+ if (( (flags & INVERSE) && !in_selection) ||
+ (!(flags & INVERSE) && in_selection)) {
+ if (flags & BOLD) {
+ currentGC = screen->r_reverseboldGC;
+ } else {
+ currentGC = screen->r_reverseGC;
+ }
+ } else {
+ if (flags & BOLD) {
+ currentGC = screen->r_normalboldGC;
+ } else {
+ currentGC = screen->r_normalGC;
+ }
+ }
+ } else
+ #endif KANJI
if (( (flags & INVERSE) && !in_selection) ||
(!(flags & INVERSE) && in_selection)) {
if(flags & BOLD) {
***************
*** 2377,2388 ****
--- 3366,3430 ----
}
}
+ #ifdef KANJI /* sano */
+ if (cc[0] == 0) {
+ cc[0] = ' ';
+ flags &= ~(KCS|KANACS);
+ } else if (flags & KCS) {
+ if (flags & KCS1)
+ cc[1] = screen->buf[y][x + 1];
+ else {
+ offset = -1;
+ cc[1] = cc[0];
+ cc[0] = screen->buf[y][x - 1];
+ }
+ }
+ #else KANJI
if (c == 0)
c = ' ';
+ #endif KANJI
+ #ifdef KANJI /* sano */
+ x = CursorX (screen, screen->cursor_col + offset);
+ #else KANJI
x = CursorX (screen, screen->cursor_col);
+ #endif KANJI
+ #ifdef STATUSLINE /* michael */
+ y = (instatus ? (screen->cursor_row * FontHeight(screen) + 1) :
+ ((screen->cursor_row - screen->topline) * FontHeight(screen))) +
+ #else STATUSLINE
y = (((screen->cursor_row - screen->topline) * FontHeight(screen))) +
+ #endif STATUSLINE
screen->border;
y = y+screen->fnt_norm->ascent;
+ #ifdef KANJI /* sano */
+ if (flags & KCS) {
+ XDrawImageString16(screen->display, TextWindow(screen),
+ currentGC, x, y, (XChar2b *)cc, 1);
+ if ((flags & BOLD) && screen->w_enbolden)
+ XDrawString16(screen->display, TextWindow(screen),
+ currentGC, x + 1, y, (XChar2b *)cc, 1);
+ if (flags & UNDERLINE)
+ XDrawLine(screen->display, TextWindow(screen),
+ currentGC, x, y + 1,
+ x + FontWidth(screen) * 2, y + 1);
+ } else {
+ XDrawImageString(screen->display, TextWindow(screen),
+ currentGC, x, y, cc, 1);
+ if (flags & KANACS) {
+ if ((flags & BOLD) && screen->r_enbolden)
+ XDrawString(screen->display, TextWindow(screen),
+ currentGC, x + 1, y, cc, 1);
+ } else {
+ if ((flags & BOLD) && screen->enbolden)
+ XDrawString(screen->display, TextWindow(screen),
+ currentGC, x + 1, y, cc, 1);
+ }
+ if (flags & UNDERLINE)
+ XDrawLine(screen->display, TextWindow(screen),
+ currentGC, x, y + 1,
+ x + FontWidth(screen), y + 1);
+ }
+ #else KANJI
XDrawImageString(screen->display, TextWindow(screen), currentGC,
x, y, &c, 1);
if((flags & BOLD) && screen->enbolden)
***************
*** 2391,2396 ****
--- 3433,3439 ----
if(flags & UNDERLINE)
XDrawLine(screen->display, TextWindow(screen), currentGC,
x, y+1, x + FontWidth(screen), y+1);
+ #endif KANJI
screen->cursor_state = OFF;
}
***************
*** 2444,2450 ****
--- 3487,3498 ----
(Dimension) 80*FontWidth(screen)
+ 2 * screen->border + screen->scrollbar,
(Dimension) FontHeight(screen)
+ #ifdef STATUSLINE /* michael */
+ * (screen->max_row + 1) + screen->statusheight +
+ 2 * screen->border,
+ #else STATUSLINE
* (screen->max_row + 1) + 2 * screen->border,
+ #endif STATUSLINE
&junk, &junk);
XSync(screen->display, FALSE); /* synchronize */
if(QLength(screen->display) > 0)
***************
*** 2455,2461 ****
--- 3503,3603 ----
longjmp(vtjmpbuf, 1); /* force ground state in parser */
}
+ #ifdef STATUSLINE /* michael */
+ ToStatus(col)
+ int col;
+ {
+ register TScreen *screen = &term->screen;
+ if (screen->cursor_state)
+ HideCursor();
+ if (col > screen->max_col)
+ col = screen->max_col;
+ if (!screen->instatus) {
+ if (!screen->statusline)
+ ShowStatus();
+ CursorSave(term, &screen->statussc);
+ screen->instatus = TRUE;
+ screen->cur_row = screen->max_row + 1;
+ }
+ screen->cur_col = col;
+ }
+
+ FromStatus()
+ {
+ register TScreen *screen = &term->screen;
+
+ if (!screen->instatus)
+ return;
+ screen->instatus = FALSE;
+ CursorRestore(term, &screen->statussc);
+ }
+
+ ShowStatus()
+ {
+ register TScreen *screen = &term->screen;
+ register int border = 2 * screen->border;
+
+ if (screen->statusline)
+ return;
+ screen->statusline = 1;
+ screen->statusheight = FontHeight(screen) + 2;
+ ResizeScreen(term, border + screen->scrollbar, border);
+ }
+
+ HideStatus()
+ {
+ register TScreen *screen = &term->screen;
+ register int border = 2 * screen->border;
+ register int i, j;
+
+ if (!screen->statusline)
+ return;
+ if (screen->instatus)
+ FromStatus();
+ screen->statusline = 0;
+ screen->statusheight = 0;
+ bzero(screen->buf[i = 2 * (screen->max_row + 1)],
+ j = screen->max_col + 1);
+ bzero(screen->buf[i + 1], j);
+ ResizeScreen(term, border + screen->scrollbar, border);
+ }
+
+ EraseStatus()
+ {
+ register TScreen *screen = &term->screen;
+ register int i, j, pix;
+
+ if (!screen->statusline)
+ return;
+ bzero(screen->buf[i = 2 * (screen->max_row + 1)],
+ j = screen->max_col + 1);
+ bzero(screen->buf[i + 1], j) ;
+ XFillRectangle(screen->display, TextWindow(screen),
+ screen->reversestatus ? screen->normalGC : screen->reverseGC,
+ screen->border - 1 + screen->scrollbar,
+ (screen->max_row + 1) * FontHeight(screen) +
+ screen->border,
+ j * FontWidth(screen) + 2, screen->statusheight);
+ if (!screen->reversestatus)
+ StatusBox(screen);
+ }
+
+ StatusBox(screen)
+ register TScreen *screen;
+ {
+ status_box[0].x = screen->scrollbar;
+ status_box[0].y = (screen->max_row + 1) * FontHeight(screen) +
+ screen->border;
+ status_box[3].x = -(status_box[1].x = (screen->max_col + 1) *
+ FontWidth(screen) + screen->border + 1);
+ status_box[4].y = -(status_box[2].y = FontHeight(screen) + 1);
+ XDrawLines(screen->display, TextWindow(screen), screen->normalGC,
+ status_box, NBOX, CoordModePrevious);
+ }
+ #endif STATUSLINE
+
+
#ifdef MODEMENU
#define MMENU_SCROLLBAR 0
#define MMENU_SCROLL (MMENU_SCROLLBAR+1)
***************
*** 2472,2483 ****
--- 3614,3637 ----
#define MMENU_SCROLLKEY (MMENU_PAD+1)
#endif /* DO_AUTOREPEAT */
#define MMENU_SCROLLINPUT (MMENU_SCROLLKEY+1)
+ #ifdef STATUSLINE /* michael */
+ #define MMENU_STATUS (MMENU_SCROLLINPUT+1)
+ #define MMENU_REVSTATUS (MMENU_STATUS+1)
+ #define MMENU_C132 (MMENU_REVSTATUS+1)
+ #else STATUSLINE
#define MMENU_C132 (MMENU_SCROLLINPUT+1)
+ #endif STATUSLINE
#define MMENU_CURSES (MMENU_C132+1)
#define MMENU_MARGBELL (MMENU_CURSES+1)
#define MMENU_TEKWIN (MMENU_MARGBELL+1)
#define MMENU_ALTERN (MMENU_TEKWIN+1)
+ #ifdef KANJI /* sano */
+ #define MMENU_EUC (MMENU_ALTERN+1)
+ #define MMENU_SJIS (MMENU_EUC+1)
+ #define MMENU_LINE (MMENU_SJIS+1)
+ #else KANJI
#define MMENU_LINE (MMENU_ALTERN+1)
+ #endif KANJI
#define MMENU_RESET (MMENU_LINE+1)
#define MMENU_FULLRESET (MMENU_RESET+1)
#define MMENU_TEKMODE (MMENU_FULLRESET+1)
***************
*** 2497,2507 ****
--- 3651,3669 ----
#endif /* DO_AUTOREPEAT */
"Scroll to bottom on key press",
"Scroll to bottom on tty output",
+ #ifdef STATUSLINE /* michael */
+ "Status Line",
+ "Reverse Status Line",
+ #endif STATUSLINE
"Allow 80/132 switching",
"Curses Emulation",
"Margin Bell",
"Tek Window Showing",
"Alternate Screen",
+ #ifdef KANJI /* sano */
+ "EUC Mode",
+ "Shift-JIS Mode",
+ #endif KANJI
"-",
"Soft Reset",
"Full Reset",
***************
*** 2521,2526 ****
--- 3683,3692 ----
static int tscrollkey;
static int tscrollinput;
static Boolean tshow;
+ #ifdef STATUSLINE /* michael */
+ static int tstatusline;
+ static int trevstatus;
+ #endif STATUSLINE
Menu *setupmenu(menu)
register Menu **menu;
***************
*** 2565,2570 ****
--- 3731,3746 ----
tscrollinput = FALSE;
DisableItem(*menu, MMENU_SCROLLINPUT);
}
+ #ifdef STATUSLINE /* michael */
+ if (tstatusline = screen->statusline) {
+ CheckItem(*menu, MMENU_STATUS);
+ if (trevstatus = screen->reversestatus)
+ CheckItem(*menu, MMENU_REVSTATUS);
+ } else {
+ trevstatus = FALSE;
+ DisableItem(*menu, MMENU_REVSTATUS);
+ }
+ #endif STATUSLINE
if(t132 = screen->c132)
CheckItem(*menu, MMENU_C132);
if(tcurses = screen->curses)
***************
*** 2584,2589 ****
--- 3760,3771 ----
DisableItem(*menu, MMENU_TEKWIN);
DisableItem(*menu, MMENU_TEKMODE);
}
+ #ifdef KANJI /* sano */
+ if (flags & EUC_KANJI)
+ CheckItem(*menu, MMENU_EUC);
+ if (flags & SJIS_KANJI)
+ CheckItem(*menu, MMENU_SJIS);
+ #endif KANJI
menutermflags = flags;
menukbdflags = kflags;
return(*menu);
***************
*** 2625,2630 ****
--- 3807,3825 ----
SetItemCheck(*menu, MMENU_SCROLLINPUT,
tscrollinput = screen->scrollinput);
}
+ #ifdef STATUSLINE /* michael */
+ if (tstatusline != screen->statusline) {
+ SetItemCheck(*menu, MMENU_STATUS,
+ tstatusline = screen->statusline);
+ SetItemDisable(*menu, MMENU_REVSTATUS, !tstatusline);
+ SetItemCheck(*menu, MMENU_REVSTATUS,
+ trevstatus = (tstatusline && screen->reversestatus));
+ } else if (tstatusline) {
+ if (tstatusline != screen->reversestatus)
+ SetItemCheck(*menu, MMENU_REVSTATUS,
+ trevstatus = screen->reversestatus);
+ }
+ #endif STATUSLINE
if(t132 != screen->c132)
SetItemCheck(*menu, MMENU_C132, (t132 = screen->c132));
if(tcurses != screen->curses)
***************
*** 2640,2645 ****
--- 3835,3846 ----
SetItemCheck(*menu, MMENU_ALTERN, (taltern =
screen->alternate));
}
+ #ifdef KANJI /* sano */
+ if (menutermflags & EUC_KANJI)
+ SetItemCheck(*menu, MMENU_EUC, flags & EUC_KANJI);
+ if (menutermflags & SJIS_KANJI)
+ SetItemCheck(*menu, MMENU_SJIS, flags & SJIS_KANJI);
+ #endif KANJI
menutermflags = flags;
menukbdflags = kflags;
return(*menu);
***************
*** 2710,2715 ****
--- 3911,3930 ----
screen->scrollinput = !screen->scrollinput;
break;
+ #ifdef STATUSLINE /* michael */
+ case MMENU_STATUS:
+ if (screen->statusline)
+ HideStatus();
+ else
+ ShowStatus();
+ break;
+
+ case MMENU_REVSTATUS:
+ screen->reversestatus = !screen->reversestatus;
+ ScrnRefresh(screen, screen->max_row + 1, 0, 1,
+ screen->max_col + 1);
+ break;
+ #endif STATUSLINE
case MMENU_C132:
screen->c132 = !screen->c132;
***************
*** 2750,2755 ****
--- 3965,3986 ----
}
reselectwindow(screen);
break;
+ #ifdef KANJI /* sano */
+ case MMENU_EUC:
+ term->flags ^= EUC_KANJI;
+ if (term->flags & EUC_KANJI)
+ /*
+ * Reset SJIS_KANJI mode because
+ * EUC_KANJI and SJIS_KANJI are specified exclusively.
+ */
+ term->flags &= ~SJIS_KANJI;
+ break;
+ case MMENU_SJIS:
+ term->flags ^= SJIS_KANJI;
+ if (term->flags & SJIS_KANJI)
+ term->flags &= ~EUC_KANJI;
+ break;
+ #endif KANJI
}
}
#endif /* MODEMENU */
More information about the Comp.sources.x
mailing list