added double size support

This commit is contained in:
chombier 2001-04-30 09:36:00 +00:00
parent 93cdf90460
commit 7d34860cf0
11 changed files with 516 additions and 227 deletions

View File

@ -119,7 +119,7 @@ void RSselect( short w, Point pt, EventRecord theEvent)
}
else if (theEvent.modifiers & cmdKey)
{ // a command click means we should look for a url
if ((RSlocal[w].selected)&(PointInSelection(curr, w))) //we have a selection already
if ( RSTextSelected(w) && PointInSelection(curr, w) ) //we have a selection already
HandleURL(w);
else
{ // we need to find the url around this pnt
@ -134,6 +134,7 @@ void RSselect( short w, Point pt, EventRecord theEvent)
lastClickLoc = curr;
if (RSlocal[w].selected) {
if (!shift) {
RSlocal[w].selected = 0;
/* unhighlight current selection */
RSinvText(w, RSlocal[ w].anchor, RSlocal[w].last, &noConst);
/* start new selection */
@ -152,7 +153,6 @@ void RSselect( short w, Point pt, EventRecord theEvent)
{
/* start new selection */
curr = RSlocal[w].anchor = RSlocal[w].last = normalize(pt, w,TRUE);
RSlocal[w].selected = 1;
}
while (StillDown())
@ -168,9 +168,8 @@ void RSselect( short w, Point pt, EventRecord theEvent)
} /* while */
}
if (EqualPt(RSlocal[w].anchor, RSlocal[w].last)) RSlocal[w].selected = 0;
else RSlocal[w].selected = 1;
RSlocal[w].selected = !EqualPt(RSlocal[w].anchor, RSlocal[w].last);
SetMenusForSelection((short)RSlocal[w].selected);
} /* RSselect */
@ -185,8 +184,8 @@ void RSselect( short w, Point pt, EventRecord theEvent)
RSinvText(w, RSlocal[ w].anchor, RSlocal[w].last, &noConst);
}
}
Boolean PointInSelection(Point curr, short w)
{
Boolean PointInSelection(Point curr, short w)
{
long beg_offset, end_offset, current_offset;
short columns;
columns = VSgetcols(w);
@ -199,8 +198,9 @@ void RSselect( short w, Point pt, EventRecord theEvent)
return TRUE;
else
return FALSE;
}
void RSzoom
}
void RSzoom
(
GrafPtr window, /* window to zoom */
short code, /* inZoomIn or inZoomOut */
@ -1440,13 +1440,7 @@ static void HandleDoubleClick(short w, short modifiers)
}
if (leftLoc.h != rightLoc.h) { /* we selected something */
#if 0
RSlocal[w].anchor = leftLoc; /* new left bound */
RSlocal[w].last = rightLoc; /* and a matching new right bound */
RSlocal[w].selected = 1; /* give me credit for the selection I just made */
RSinvText(w, RSlocal[w].anchor, /* time to show it off */
RSlocal[w].last, &noConst);
#endif
HiliteThis(w, leftLoc, rightLoc);
if (modifiers & cmdKey) // Possible URL selection

View File

@ -37,7 +37,7 @@
* Macintosh only Routines:
* NI RSregnconv( *) - Convert region to rect coords
* NI RSsetwind(w) - Set the port and vars to window w
* NI RSsetattr(a) - Set font/text style to a
* NI RSsetattr(la, a) - Set font/text style to a
* NI RSsetConst(w)
* ML RSattach(w,wind) - Attach the RS (w) to window wind
* ML RSdetach(w) - Ready window for go-away
@ -133,6 +133,7 @@ Boolean gHasSetWindowContentColor = 0;
#endif
short RSw=-1; /* last window used */
short RSla=0; /* last line attrib used */
VSAttrib RSa=0; /* last attrib used */
extern long RScolors[];
@ -204,6 +205,7 @@ short RSsetwind
RScurrent = RSlocal + w;
RSw = w;
RSa = -1; /* attributes will need setting */
RSla = 0;
SetPort(RScurrent->window);
return(1);
}
@ -265,24 +267,42 @@ void RScursoff
void RScurson
(
short w,
short la,
short x,
short y
)
/* displays the text cursor for the specified window, at the
specified position. Assumes it isn't currently being shown. */
{
short xw;
if ( RSlocal[w].skip || RSlocal[w].cursorstate )
return;
RSsetwind(w);
RScurrent->cursor.left = x * RScurrent->fwidth;
xw = RScurrent->fwidth;
if ((la & 3)) {
// double width
xw <<= 1;
if (x > ((VSIw->maxwidth + 1) >> 1) - 1) {
x = ((VSIw->maxwidth + 1) >> 1) - 1;
}
}
RScurrent->cursor.left = x * xw;
RScurrent->cursor.top = y * RScurrent->fheight;
switch (RScurrent->cursType) {
case UNDERSCORECURSOR:
RScurrent->cursor.top += RScurrent->fheight;
RScurrent->cursor.right = RScurrent->cursor.left + RScurrent->fwidth;
RScurrent->cursor.right = RScurrent->cursor.left + xw;
RScurrent->cursor.bottom = RScurrent->cursor.top + 1;
break;
case VERTICALCURSOR:
@ -295,23 +315,23 @@ void RScurson
RScurrent->cursor.bottom = RScurrent->cursor.top;
break;
case LOWER_THIRDCURSOR:
RScurrent->cursor.right = RScurrent->cursor.left + RScurrent->fwidth;
RScurrent->cursor.right = RScurrent->cursor.left + xw;
RScurrent->cursor.bottom = RScurrent->cursor.top + RScurrent->fheight;
RScurrent->cursor.top += 2 * RScurrent->fheight / 3;
break;
case LOWER_HALFCURSOR:
RScurrent->cursor.right = RScurrent->cursor.left + RScurrent->fwidth;
RScurrent->cursor.right = RScurrent->cursor.left + xw;
RScurrent->cursor.bottom = RScurrent->cursor.top + RScurrent->fheight;
RScurrent->cursor.top += RScurrent->fheight / 2;
break;
case TWO_THIRDSCURSOR:
RScurrent->cursor.right = RScurrent->cursor.left + RScurrent->fwidth;
RScurrent->cursor.right = RScurrent->cursor.left + xw;
RScurrent->cursor.bottom = RScurrent->cursor.top + RScurrent->fheight;
RScurrent->cursor.top += RScurrent->fheight / 3;
break;
case BLOCKCURSOR:
default:
RScurrent->cursor.right = RScurrent->cursor.left + RScurrent->fwidth;
RScurrent->cursor.right = RScurrent->cursor.left + xw;
RScurrent->cursor.bottom = RScurrent->cursor.top + RScurrent->fheight;
break;
}
@ -334,24 +354,38 @@ void RScurson
} /* RScurson */
void RSsetattr(VSAttrib a)
void RSsetattr(short la, VSAttrib a)
{
short fg, bg, tempFontID; // RAB BetterTelnet 1.0fc4
short fg;
short bg;
short tempFontID;
short size;
short face;
static GrafPtr lastPort;
if (RSa!=-1 && RSa==a && qd.thePort==lastPort) return;
if ( RSa != -1 && RSla == la && RSa == a && qd.thePort == lastPort )
return;
lastPort = qd.thePort;
RSla = la;
RSa = a;
if (VSisgrph(a)) {
size = ((la & 3)) ? RScurrent->fsiz * 2 : RScurrent->fsiz;
if ( VSisgrph(a) ) {
//GetFNum("\p%NCSA VT", &tempFontID); // RAB BetterTelnet 1.0fc4
//TextFont(tempFontID); /* use "NCSA VT" (74) font for special graphics */
TextFont(gNCSAFontID);
TextFont( gNCSAFontID );
} else {
RSTextFont(RScurrent->fnum,RScurrent->fsiz,VSisbold(a) && RScurrent->allowBold); /* BYU - use user-selected text font */
RSTextFont( RScurrent->fnum, size, VSisbold(a) && RScurrent->allowBold );
/*
if ((la & 3)) {
GetFNum( (la & 2) ? "\pANSI/PC Bottom" : "\pANSI/PC Top", &tempFontID);
RSTextFont(tempFontID,RScurrent->fsiz,VSisbold(a) && RScurrent->allowBold);
} else {
RSTextFont(RScurrent->fnum,RScurrent->fsiz,VSisbold(a) && RScurrent->allowBold);
}
*/
}
TextSize(RScurrent->fsiz);
TextSize(size);
face = VSisundl(a) ? underline : 0;
if ( VSisbold(a) && RScurrent->allowBold && RScurrent->realbold ) {
@ -454,15 +488,15 @@ short tempFontID; // RAB BetterTelnet 1.0fc4
#define LMSetHiliteMode(HiliteModeValue) ((* (unsigned char *) 0x0938) = (HiliteModeValue))
#endif
void DoHiliteMode(void) /* BYU LSC */
void DoHiliteMode(void)
/* enables use of highlighting in place of simple color inversion
for next QuickDraw operation. */
{
{
LMSetHiliteMode(LMGetHiliteMode() & 0x7F);
// char *p = (char *) 0x938; /* pointer to HiliteMode low-memory global */
// *p = *p & 0x7f; /* clear the HiliteBit */
} /* HiliteMode */
} /* DoHiliteMode */
void RSinvText
(
@ -479,28 +513,29 @@ void RSinvText
RSsetwind(w);
/* normalize coordinates with respect to visible area of virtual screen */
curr.v -= RScurrent->topline;
curr.h -= RScurrent->leftmarg;
last.v -= RScurrent->topline;
last.h -= RScurrent->leftmarg;
/* normalize colors */
RSsetattr(0);
//VSIGetLineStart( w, RScurrent->anchor.v)[RScurrent->anchor.h]
if ( !RSlocal[w].selected ) {
/* FIXME: we should use the background color of every char */
/* normalize colors */
RSsetattr(0, 0);
//RSsetattr(VSIGetLineStart( w, RScurrent->anchor.v)->attr[RScurrent->anchor.h]);
}
if (curr.v == last.v)
{
if (curr.v == last.v) {
/* highlighted text all on one line */
if (curr.h < last.h) /* get bounds the right way round */
{
if (curr.h < last.h) {
ub = curr;
lb = last;
}
else
{
} else {
ub = last;
lb = curr;
} /* if */
} /* if */
MYSETRECT /* set up rectangle bounding area to be highlighted */
(
temp,
@ -512,10 +547,10 @@ void RSinvText
SectRect(&temp, constrain, &temp2); /* clip to constraint rectangle */
DoHiliteMode(); /* BYU LSC */
InvertRect(&temp2);
}
else
{
/* highlighting across more than one line */
} else {
/* highlighting across more than one line */
if (curr.v < last.v)
ub = curr;
else
@ -547,8 +582,8 @@ void RSinvText
DoHiliteMode(); /* BYU LSC */
InvertRect(&temp2);
if (lb.v - ub.v > 1) /* highlight extends across more than two lines */
{
if (lb.v - ub.v > 1) {
/* highlight extends across more than two lines */
/* highlight complete in-between lines */
MYSETRECT
(
@ -562,12 +597,12 @@ void RSinvText
DoHiliteMode(); /* BYU LSC */
InvertRect(&temp2);
} /* if */
} /* if */
} /* if */
} /* if */
RSsetattr(VSIw->attrib);
RSsetattr(VSIw->lattrib, VSIw->attrib);
} /* RSinvText */
} /* RSinvText */
/*
@ -579,6 +614,7 @@ void RSdraw
short w, /* window number */
short x, /* starting column */
short y, /* line on which to draw */
short la, /* line attribute */
VSAttrib a, /* text attributes */
short len, /* length of text to draw */
char *ptr /* pointer to text */
@ -588,6 +624,7 @@ void RSdraw
within the current selection, it will be highlighted. */
{
Rect rect;
short xw;
short ys;
RgnHandle oldClip;
@ -595,17 +632,24 @@ void RSdraw
return;
RSsetwind(w);
xw = RScurrent->fwidth;
if ((la & 3)) {
// double width
xw <<= 1;
}
ys = y * RScurrent->fheight;
MYSETRECT /* set up rectangle bounding text being drawn */
(
rect,
x * RScurrent->fwidth,
x * xw,
ys,
(x + len) * RScurrent->fwidth,
(x + len) * xw,
ys + RScurrent->fheight
);
RSsetattr(a);
RSsetattr(la, a);
if (rect.left <= 0) /* little buffer strip on left */
rect.left = CHO;
@ -623,7 +667,12 @@ void RSdraw
if (rect.bottom >= RScurrent->height)
rect.bottom = RScurrent->height;
MoveTo(x * RScurrent->fwidth, ys + RScurrent->fascent);
if ((la & 1)) {
// Upper part
ys += RScurrent->fheight;
}
MoveTo(rect.left, ys + RScurrent->fascent);
oldClip = NewRgn();
GetClip(oldClip);
@ -634,22 +683,15 @@ void RSdraw
SetClip(oldClip);
DisposeRgn(oldClip);
/*
if ( rect.bottom < RScurrent->height || !VSisundl(a) ) {
DrawText(ptr, 0, len);
} else {
++rect.right;
TETextBox(ptr, len, &rect, teJustLeft);
--rect.right;
}
*/
if (RScurrent->selected) {
/* highlight any part of selection covering the newly-inserted text */
RSinvText(w, RScurrent->anchor, RScurrent->last, &rect);
}
ValidRect(&rect);
} /* RSdraw */
} /* RSdraw */
/*
* ScrollRectInRgn
@ -693,9 +735,9 @@ void RSdefaultattr(short w)
short screenIndex;
if ( screens[findbyVS(w)].vtemulation < 2 )
RSsetattr(0);
RSsetattr(VSIw->lattrib, 0);
else
RSsetattr(VSIw->attrib);
RSsetattr(VSIw->lattrib, VSIw->attrib);
}
/*
@ -711,11 +753,20 @@ void RSdelcols
specified number of columns to the left, blanking out
the newly-revealed area. */
{
short xw;
Rect rect;
if (RSlocal[w].skip)
return;
RSsetwind(w);
xw = RScurrent->fwidth;
/*
if ((la & 3)) {
// double width
xw <<= 1;
}
*/
MYSETRECT /* bounds of entire text area, for scrolling */
(
rect,
@ -725,11 +776,11 @@ void RSdelcols
RScurrent->height
);
ScrollRectInRgn(RScurrent->window, &rect, - (n * RScurrent->fwidth), 0);
ScrollRectInRgn(RScurrent->window, &rect, - (n * xw), 0);
if ( RScurrent->selected ) {
/* bounds of newly-revealed area */
rect.left = RScurrent->width - (n * RScurrent->fwidth);
rect.left = RScurrent->width - (n * xw);
/* highlight any newly-revealed part of the current selection */
RSinvText(w, RScurrent->anchor, RScurrent->last, &rect);
}
@ -743,6 +794,7 @@ void RSdelcols
void RSdelchars
(
short w, /* affected window */
short la, /* line attributes */
short x, /* column to delete from */
short y, /* line on which to do deletion */
short n /* number of characters to delete */
@ -751,28 +803,35 @@ void RSdelchars
position to the right, moving the remainder of the line to the
left. */
{
short xw;
Rect rect;
if (RSlocal[w].skip)
return;
RSsetwind(w);
// RSsetattr(0); /* avoid funny pen modes */
// RSsetattr(VSIw->lattrib, 0); /* avoid funny pen modes */
RSdefaultattr(w);
xw = RScurrent->fwidth;
if ((la & 3)) {
// double width
xw <<= 1;
}
MYSETRECT /* bounds of area from starting column to end of line */
(
rect,
x * RScurrent->fwidth,
x * xw,
y * RScurrent->fheight,
RScurrent->width,
(y + 1) * RScurrent->fheight
);
if ((x + n) * RScurrent->fwidth > RScurrent->width) {
if ((x + n) * xw > RScurrent->width) {
/* deleting to end of line */
EraseRect(&rect);
} else {
/* scroll remainder of line to the left */
ScrollRectInRgn(RScurrent->window, &rect, - (n * RScurrent->fwidth), 0);
ScrollRectInRgn(RScurrent->window, &rect, - (n * xw), 0);
if ( RScurrent->selected ) {
HLock((Handle) RSuRgn);
RSinvText(w, RScurrent->anchor, RScurrent->last, &((*RSuRgn)->rgnBBox));
@ -780,22 +839,22 @@ void RSdelchars
if ( RScurrent->anchor.v <= y && y <= RScurrent->last.v ) {
if ( x <= RScurrent->anchor.h ) {
// deselect left part
rect.left = (RScurrent->anchor.h + 1 - n) * RScurrent->fwidth;
rect.right = (RScurrent->anchor.h + 1) * RScurrent->fwidth;
rect.left = (RScurrent->anchor.h + 1 - n) * xw;
rect.right = (RScurrent->anchor.h + 1) * xw;
DoHiliteMode();
InvertRect(&rect);
}
if ( x <= RScurrent->last.h ) {
// select right part
rect.left = (RScurrent->last.h + 1 - n) * RScurrent->fwidth;
rect.right = (RScurrent->last.h + 1) * RScurrent->fwidth;
rect.left = (RScurrent->last.h + 1 - n) * xw;
rect.right = (RScurrent->last.h + 1) * xw;
DoHiliteMode();
InvertRect(&rect);
}
}
}
}
RSsetattr(VSIw->attrib); /* restore mode for text drawing */
RSsetattr(VSIw->lattrib, VSIw->attrib); /* restore mode for text drawing */
} /* RSdelchars */
void RSdellines
@ -822,7 +881,7 @@ void RSdellines
RSsetwind(w);
RSsetConst(w);
// RSsetattr(0); /* avoid funny pen modes */
// RSsetattr(VSIw->lattrib, 0); /* avoid funny pen modes */
RSdefaultattr(w);
if (scrolled)
@ -850,7 +909,7 @@ void RSdellines
ScrollRectInRgn(RScurrent->window, &rect, 0, -RScurrent->fheight * n);
RSsetattr(VSIw->attrib); /* restore mode for text drawing */
RSsetattr(VSIw->lattrib, VSIw->attrib); /* restore mode for text drawing */
} /* RSdellines */
void RSerase
@ -870,7 +929,7 @@ void RSerase
return;
RSsetwind(w);
// RSsetattr(0); /* avoid funny pen modes */
// RSsetattr(VSIw->lattrib, 0); /* avoid funny pen modes */
RSdefaultattr(w);
MYSETRECT
@ -893,7 +952,7 @@ void RSerase
/* highlight any part of the selection within the cleared area */
RSinvText(w, RScurrent->anchor, RScurrent->last, &rect);
RSsetattr(VSIw->attrib); /* restore mode for text drawing */
RSsetattr(VSIw->lattrib, VSIw->attrib); /* restore mode for text drawing */
} /* RSerase */
@ -914,7 +973,7 @@ void RSinslines
return;
RSsetwind(w);
RSsetConst(w);
// RSsetattr(0); /* avoid funny pen modes */
// RSsetattr(VSIw->lattrib, 0); /* avoid funny pen modes */
RSdefaultattr(w);
if (RScurrent->selected && (scrolled < 0))
@ -934,7 +993,7 @@ void RSinslines
ScrollRectInRgn(RScurrent->window, &rect, 0, RScurrent->fheight * n);
RSsetattr(VSIw->attrib); /* restore mode for text drawing */
RSsetattr(VSIw->lattrib, VSIw->attrib); /* restore mode for text drawing */
} /* RSinslines */
void RSinscols
@ -952,6 +1011,14 @@ void RSinscols
if (RSlocal[w].skip)
return;
RSsetwind(w);
/*
if ((VSIw->lattrib & 3)) {
// double width
xw <<= 1;
}
*/
MYSETRECT /* bounds of entire text area */
(
rect,
@ -975,6 +1042,7 @@ void RSinsstring
short w, /* affected window */
short x, /* starting column at which to insert */
short y, /* line on which to insert */
short la, /* line attribute */
VSAttrib a, /* attributes for inserted text */
short len, /* length of inserted text */
char *ptr /* pointer to inserted text */
@ -983,33 +1051,54 @@ void RSinsstring
the rest of the line to the right. Highlights any part of the newly-
inserted text lying within the current selection. */
{
short xw;
short ys;
Rect rect;
RgnHandle oldClip;
if (RSlocal[w].skip)
return;
RSsetwind(w);
xw = RScurrent->fwidth;
if ((la & 3)) {
// double width
xw <<= 1;
}
ys = y * RScurrent->fheight;
MYSETRECT /* bounds of part of line from specified position to end of line */
(
rect,
x * RScurrent->fwidth,
y * RScurrent->fheight,
x * xw,
ys,
RScurrent->width,
(y + 1) * RScurrent->fheight
);
/* scroll remainder of line to the right */
ScrollRectInRgn(RScurrent->window, &rect, len * RScurrent->fwidth, 0);
ScrollRectInRgn(RScurrent->window, &rect, len * xw, 0);
RSsetattr(la, a);
/* bounds area to contain inserted string */
rect.right = (x + len) * RScurrent->fwidth;
rect.right = (x + len) * xw;
if (rect.left <= 0) /* little buffer strip on left */
rect.left = CHO;
EraseRect(&rect); /* erase area to appropriate background */
MoveTo
(
rect.left,
rect.top + RScurrent->fascent
);
RSsetattr(a);
if (rect.left <= 0)
rect.left = 0;
if ((la & 1)) {
// Upper part
ys += RScurrent->fheight;
}
MoveTo( rect.left, ys + RScurrent->fascent );
oldClip = NewRgn();
GetClip(oldClip);
@ -1020,20 +1109,13 @@ void RSinsstring
SetClip(oldClip);
DisposeRgn(oldClip);
/*
if ( rect.bottom < RScurrent->height || !VSisundl(a) ) {
DrawText(ptr, 0, len);
} else {
++rect.right;
TETextBox(ptr, len, &rect, teJustLeft);
--rect.right;
}
*/
if (RScurrent->selected)
if (RScurrent->selected) {
/* highlight any part of selection covering the newly-inserted text */
RSinvText(w, RScurrent->anchor, RScurrent->last, &rect);
}
ValidRect(&rect);
} /* RSinsstring */

View File

@ -8,31 +8,26 @@ void RSsetConst(short w);
short RSsetwind(short w);
void RSbell(short w);
void RScursoff(short w);
void RScurson(short w, short x, short y);
void RSsetattr(VSAttrib a);
void RScurson(short w, short la, short x, short y);
void RSsetattr(short la, VSAttrib a);
void DoHiliteMode(void);
void RSinvText(short w, Point curr, Point last, RectPtr constrain);
void RSdraw(short w, short x, short y, VSAttrib a, short len, char *ptr);
void RSdraw(short w, short x, short y, short la, VSAttrib a, short len, char *ptr);
void RSdefaultattr(short w);
void RSdelcols(short w, short n);
void RSdelchars(short w, short x, short y, short n);
void RSdelchars(short w, short la, short x, short y, short n);
void RSdellines(short w, short t, short b, short n, short scrolled);
void RSerase(short w, short x1, short y1, short x2, short y2);
void RSinslines(short w, short t, short b, short n, short scrolled);
void RSinscols(short w, short n);
void RSinsstring(short w, short x, short y, VSAttrib a, short len, char *ptr);
void RSinsstring(short w, short x, short y, short la, VSAttrib a, short len, char *ptr);
void RSmargininfo(short w, short total, short current);
void RSbufinfo(short w, short total, short current, short bottom);
void RSattach(short w, GrafPtr wind);
void RSdetach(short w);
short RSfindscroll(ControlHandle control, short *n);
void RSregnconv(RgnHandle regn, short *x1, short *y1, short *x2, short *y2, short fh, short fw);
short RSupdprint(WindowPeek wind);
Point normalize(Point in_long, short w, Boolean autoScroll);
void RSsortAnchors(short w);
void RSsetsize(short w, short v, short h, short screenIndex);
void RSdrawsep(short w, short y1, short draw);
void RSbackground(short w, short value);
void RScheckmaxwind(Rect *origRect, short origW, short origH, short *endW, short *endH);
void RSTextFont(short myfnum, short myfsiz, short myface);
Boolean SelectURLAroundPoint(Point current);

View File

@ -32,6 +32,8 @@ typedef struct VSline
struct VSline /* doubly-linked list of lines */
*next, /* Pointer to next line */
*prev; /* Pointer to previous line */
short
lattr; /* line attributes */
char // Text for the line -- may be part of a block
*text; /* of memory containing more than one line */
VSAttrib
@ -47,6 +49,8 @@ typedef struct VSattrline //CCP 2.7 ANSI needs shorts
/* doubly-linked list of lines */
*next, /* Pointer to next line */
*prev; /* Pointer to previous line */
short
lattr; /* line attributes */
VSAttrib // macblue, now use 16 bit attribute; 8 for normal, 8 for ansi color
*text; /* of memory containing more than one line */
char
@ -76,6 +80,7 @@ struct VSscrn {
forcesave, /* NCSA 2.5: always force lines to be saved off top */
possibleForce, //we have receive a "move to 0,0"; if next is EEOl, forcesave
ESscroll; /* Scroll screen when ES received */
short lattrib; /* current lineattributes */
VSAttrib attrib; /* current character writing attributes */
short x,y; /* current cursor positon */
short Px,Py; /* saved cursor position and writing attributes */

View File

@ -77,10 +77,11 @@ unsigned short VSIkpnums[] = // RAB BetterTelnet 2.0b5 - macro numbers
70, 72, 73, 50, 51, 52, 53 };
*/
unsigned short VSIkpnums[] = // RAB BetterTelnet 2.0b5 - macro numbers
{ 24, 25, 26, 22, 27, 28, 0, 40, 0, 42, 0, 43, 0, 29, 0, 41,
0, 44, 58, 56, 54, 59, 23, 57, 21, 55, 20, 27, 0, 0, 0, 0,
0, 90, 91, 93, 92, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 81,
80, 82, 83, 50, 51, 52, 53 };
{ 24, 25, 26, 22, 27, 28, 0, 40, 0, 42, 0,
43, 0, 29, 0, 41, 0, 44, 58, 56, 54, 59,
23, 57, 21, 55, 20, 27, 0, 0, 0, 0, 0,
90, 91, 93, 92, 70, 71, 72, 73, 74, 75, 76,
77, 78, 79, 81, 80, 82, 83, 50, 51, 52, 53 };
extern TelInfoRec *TelInfo;
extern WindRec *screens;
@ -274,10 +275,13 @@ void VSIclrbuf
register VSAttrib *ta;
for (i = 0; i <= VSIw->lines; i++)
{
if (VSIw->oldScrollback)
if (VSIw->oldScrollback) {
VSIw->attrst[i]->lattr = 0;
ta = &VSIw->attrst[i]->text[0];
else
} else {
VSIw->linest[i]->lattr = 0;
ta = &VSIw->linest[i]->attr[0];
}
tx = &VSIw->linest[i]->text[0];
for (j = 0; j <= VSIw->allwidth; j++)
{
@ -528,10 +532,13 @@ void VSrealloc(short w)
}
savedTextPtr = savedTextBlock;
for (i = 0; i <= VSIw->lines; i++) {
if (VSIw->oldScrollback)
if (VSIw->oldScrollback) {
savedTextPtr->lattr = VSIw->attrst[i]->lattr;
BlockMoveData(VSIw->attrst[i]->text, savedTextPtr->attr, (VSIw->allwidth + 1) * sizeof(VSAttrib));
else
} else {
savedTextPtr->lattr = VSIw->linest[i]->lattr;
BlockMoveData(VSIw->linest[i]->attr, savedTextPtr->attr, (VSIw->allwidth + 1) * sizeof(VSAttrib));
}
if (savedTextPtr->next) savedTextPtr = savedTextPtr->next;
}
@ -625,7 +632,7 @@ short VSredraw
ty2 = y2;
tn = -1; // so we include more than 1 line
if (VSIclip(&tx1, &ty1, &tx2, &ty2, &tn, &offset)!=0) return 0; // test clip region
// if (VSIclip(&tx1, &ty1, &tx2, &ty2, &tn, &offset)!=0) return 0; // test clip region
if (VSIcursorenabled())
VSIcuroff(w); // temporarily hide cursor
@ -654,18 +661,30 @@ short VSredraw
pt = ypt->text + VSIw->Rleft;
pa = ypt->attr + VSIw->Rleft;
// if double size, we must shift width
if (ypt->lattr & 3) {
tx1 >>= 1;
tx2 >>= 1;
}
lastx = tx1;
lasta = pa[tx1];
for(x=tx1+1; x<=tx2; x++) {
if (pa[x]!=lasta) {
RSdraw(w, lastx, y, lasta, x-lastx, pt + lastx);
RSdraw(w, lastx, y, ypt->lattr, lasta, x-lastx, pt + lastx);
lastx = x;
lasta = pa[x];
}
}
if (lastx<=tx2)
RSdraw(w, lastx, y, lasta, tx2-lastx+1, pt + lastx);
RSdraw(w, lastx, y, ypt->lattr, lasta, tx2-lastx+1, pt + lastx);
// if double size, we must shift width
if (ypt->lattr & 3) {
tx1 <<= 1;
tx2 <<= 1;
}
ypt = ypt->next;
}
}
@ -682,7 +701,7 @@ short VSredraw
tn = -1;
if (!VSIclip(&tx1, &ty1, &tx2, &ty2, &tn, &offset)) {
ypt = VSIw->linest[VSIw->Rtop+ty1];
for (y=ty1; y<=ty2; y++) {
@ -694,18 +713,30 @@ short VSredraw
pt = ypt->text + VSIw->Rleft;
pa = ypt->attr + VSIw->Rleft;
// if double size, we must shift width
if (ypt->lattr & 3) {
tx1 >>= 1;
tx2 >>= 1;
}
lastx = tx1;
lasta = pa[tx1];
for(x=tx1+1; x<=tx2; x++) {
if (pa[x]!=lasta) {
RSdraw(w, lastx, y, lasta, x-lastx, pt + lastx);
RSdraw(w, lastx, y, ypt->lattr, lasta, x-lastx, pt + lastx);
lastx = x;
lasta = pa[x];
}
}
if (lastx<=tx2)
RSdraw(w, lastx, y, lasta, tx2-lastx+1, pt + lastx);
RSdraw(w, lastx, y, ypt->lattr, lasta, tx2-lastx+1, pt + lastx);
// if double size, we must shift width
if (ypt->lattr & 3) {
tx1 <<= 1;
tx2 <<= 1;
}
ypt = ypt->next;
}
}
@ -754,7 +785,7 @@ short VSOredraw
ty2 = y2;
tn = -1; // so we include more than 1 line
if (VSIclip(&tx1, &ty1, &tx2, &ty2, &tn, &offset)!=0) return 0; // test clip region
// if (VSIclip(&tx1, &ty1, &tx2, &ty2, &tn, &offset)!=0) return 0; // test clip region
if (VSIcursorenabled())
VSIcuroff(w); // temporarily hide cursor
@ -776,7 +807,21 @@ short VSOredraw
ypt = ypt->next; // Get pointer to top line we need
for (y=ty1; y<=ty2; y++) {
RSdraw(w, tx1, y, 0, tn, ypt->text + VSIw->Rleft +tx1);
// if double size, we must shift width
if (ypt->lattr & 3) {
tx1 >>= 1;
tx2 >>= 1;
}
RSdraw(w, tx1, y, ypt->lattr, 0, tn, ypt->text + VSIw->Rleft +tx1);
// if double size, we must shift width
if (ypt->lattr & 3) {
tx1 <<= 1;
tx2 <<= 1;
}
ypt = ypt->next;
}
}
@ -806,18 +851,31 @@ short VSOredraw
pt = ypt->text + VSIw->Rleft;
pa = ypa->text + VSIw->Rleft;
// if double size, we must shift width
if (ypa->lattr & 3) {
tx1 >>= 1;
tx2 >>= 1;
}
lastx = tx1;
lasta = pa[tx1];
for(x=tx1+1; x<=tx2; x++) {
if (pa[x]!=lasta) {
RSdraw(w, lastx, y, lasta, x-lastx, pt + lastx);
RSdraw(w, lastx, y, ypa->lattr, lasta, x-lastx, pt + lastx);
lastx = x;
lasta = pa[x];
}
}
if (lastx<=tx2)
RSdraw(w, lastx, y, lasta, tx2-lastx+1, pt + lastx);
RSdraw(w, lastx, y, ypa->lattr, lasta, tx2-lastx+1, pt + lastx);
// if double size, we must shift width
if (ypa->lattr & 3) {
tx1 <<= 1;
tx2 <<= 1;
}
ypt = ypt->next;
ypa = ypa->next;
}
@ -1069,7 +1127,8 @@ void VSpossend
if (VSIcursorenabled())
VSIcurson(w, VSIw->x, VSIw->y, 1); /* Force Move */
} /* if */
} /* VSpossend */
} /* VSpossend */
char VSkbsend
(
@ -1123,8 +1182,9 @@ char VSkbsend
return 0; // RAB BetterTelnet 2.0b5 - rest is for special keys
}
/* Keypad (Not Application Mode): 0-9 , - . Enter */ // was (k < VSF1)
if ((k > VSLT) && (k < VSKE) && (!VSIw->DECPAM)) { // 2.0b5 - handle VSKE below
/* Keypad (Not Application Mode): 0-9 , - . Enter */ // was (k < VSPF1)
if ((k > VSLT) && (k < VSKC) && (!VSIw->DECPAM)) { // 2.0b5 - handle VSKE below
RSsendstring(w, &VSIkpxlate[0][k - VSUP], 1);
if (echo)
VSwrite(w, &VSIkpxlate[0][k - VSUP], 1);
@ -1153,7 +1213,7 @@ char VSkbsend
else // BYU 2.4.13
vskptr[1] = 91; // BYU 2.4.13
} // BYU 2.4.13
else if (k < VSF1) // BYU 2.4.12
else if (k < VSPF1) // BYU 2.4.12
vskptr = VSkbkn; // BYU 2.4.12
else // BYU 2.4.12
vskptr = VSkbfn; // BYU 2.4.12
@ -1485,6 +1545,25 @@ void VSbeepcontrol
VSIw->ignoreBeeps = beep;
}
/*
* VSenableblink
*/
void VSenableblink
(
short w,
Boolean enableBlink
)
{
if (VSvalids(w) != 0) return;
VSIw->realBlink = enableBlink;
VSPulseOne(w, 0, 0, VSIw->maxwidth, VSIw->lines);
}
short VSgetrgn
(
short w,
@ -1994,6 +2073,8 @@ short VSOsetlines
/* initialize the new screen lines to blank text and no attributes */
for (i = 0; i <= lines; i++)
{
VSIw->attrst[i]->lattr = 0;
VSIw->linest[i]->lattr = 0;
tempa = VSIw->attrst[i]->text;
temp = VSIw->linest[i]->text;
for (j = 0; j <= VSIw->allwidth; j++)
@ -2051,16 +2132,12 @@ short VSPulseOne(short w, short x1, short y1,short x2, short y2);
void VSPulseAll(void)
{
short i;
short i;
for ( i=0; i < VSmax; i++ )
for ( i = 0; i < VSmax; i++ ) {
if ( VSscreens[i].stat == 1 && VSscreens[i].loc->realBlink )
VSPulseOne(i, 0, 0,
VSscreens[i].loc->maxwidth, VSscreens[i].loc->lines);
/*
VSscreens[i].loc->Rright - VSscreens[i].loc->Rleft,
VSscreens[i].loc->Rbottom - VSscreens[i].loc->Rtop);
*/
VSPulseOne(i, 0, 0, VSscreens[i].loc->maxwidth, VSscreens[i].loc->lines);
}
}
short VSPulseOne
@ -2126,6 +2203,12 @@ short VSPulseOne
pt = ypt->text + VSIw->Rleft;
pa = ypt->attr + VSIw->Rleft;
// if double size, we must shift width
if (ypt->lattr & 3) {
tx1 >>= 1;
tx2 >>= 1;
}
lastx = tx1;
lasta = pa[tx1];
for( x = tx1+1; x <= tx2; x++ ) {
@ -2136,7 +2219,7 @@ short VSPulseOne
cursOff = 1;
VSIcuroff(w);
}
RSdraw(w, lastx, y, lasta, x-lastx, pt + lastx);
RSdraw(w, lastx, y, ypt->lattr, lasta, x-lastx, pt + lastx);
if ( cursOff ) {
// restore cursor at original position
cursOff = 0;
@ -2153,15 +2236,26 @@ short VSPulseOne
cursOff = 1;
VSIcuroff(w);
}
RSdraw(w, lastx, y, lasta, tx2-lastx+1, pt + lastx);
RSdraw(w, lastx, y, ypt->lattr, lasta, tx2-lastx+1, pt + lastx);
if ( cursOff ) {
// restore cursor at original position
cursOff = 0;
VSIcurson(w, VSIw->x, VSIw->y, 0);
}
}
// if double size, we must shift width
if (ypt->lattr & 3) {
tx1 <<= 1;
tx2 <<= 1;
}
ypt = ypt->next;
}
/* back to default window colors */
RSsetattr( 0, 0 );
return 0;
}
@ -2234,6 +2328,12 @@ short VSOPulseOne
pt = ypt->text + VSIw->Rleft;
pa = ypa->text + VSIw->Rleft;
// if double size, we must shift width
if (ypa->lattr & 3) {
tx1 >>= 1;
tx2 >>= 1;
}
lastx = tx1;
lasta = pa[tx1];
for( x = tx1+1; x <= tx2; x++ ) {
@ -2244,7 +2344,7 @@ short VSOPulseOne
cursOff = 1;
VSIcuroff(w);
}
RSdraw(w, lastx, y, lasta, x-lastx, pt + lastx);
RSdraw(w, lastx, y, ypa->lattr, lasta, x-lastx, pt + lastx);
if ( cursOff ) {
// restore cursor at original position
cursOff = 0;
@ -2261,17 +2361,28 @@ short VSOPulseOne
cursOff = 1;
VSIcuroff(w);
}
RSdraw(w, lastx, y, lasta, tx2-lastx+1, pt + lastx);
RSdraw(w, lastx, y, ypa->lattr, lasta, tx2-lastx+1, pt + lastx);
if ( cursOff ) {
// restore cursor at original position
cursOff = 0;
VSIcurson(w, VSIw->x, VSIw->y, 0);
}
}
// if double size, we must shift width
if (ypa->lattr & 3) {
tx1 <<= 1;
tx2 <<= 1;
}
ypt = ypt->next;
ypa = ypa->next;
}
}
}
/* back to default window colors */
RSsetattr( 0, 0 );
return 0;
}

View File

@ -33,6 +33,7 @@ short VSscrolforward(short w, short n);
short VSsetrgn(short w, short x1, short y1, short x2, short y2);
short VSscrolcontrol(short w, short scrolon, short offtop);
void VSbeepcontrol(short, short);
void VSenableblink(short w, Boolean enableBlink);
short VSgetrgn(short w, short *x1, short *y1, short *x2, short *y2);
short VSsnapshot(short w);
short VSmaxwidth(short w);

View File

@ -167,36 +167,41 @@ void VSIcurson
y2,
n = 1,
offset;
short lattr;
if (!VSIw->DECCM) return; // Bri 970610
if (VSIw->disableCursor) return; // RAB BetterTelnet 2.0b4
if (!VSIclip(&x, &y, &x2, &y2, &n, &offset))
/* cursor already lies within visible region */
RScurson(w, x, y); /* just make it visible */
else if (ForceMove)
{
if (VSIw->oldScrollback) {
lattr = VSIw->attrst[y]->lattr;
} else {
lattr = VSIw->linest[y]->lattr;
}
if (!VSIclip(&x, &y, &x2, &y2, &n, &offset)) {
/* cursor already lies within visible region */
RScurson(w, lattr, x, y); /* just make it visible */
} else if (ForceMove) {
/* scroll to make cursor visible */
x2 = VSIw->Rbottom - VSIw->Rtop;
if (x2 >= VSIw->lines)
/* visible region is big enough to show entire screen--
if (x2 >= VSIw->lines) {
/* visible region is big enough to show entire screen--
make sure I don't scroll off the bottom of the screen.
This call will also do any appropriate scrolling and
redisplaying of the cursor. */
VSsetrgn(VSIwn, VSIw->Rleft, VSIw->lines - x2,
VSIw->Rright, VSIw->lines);
else
{
/* x & y have been normalized relative to left & top
} else {
/* x & y have been normalized relative to left & top
of current visible region. Just call the appropriate scroll
routine, which will also redisplay the cursor. */
if (y > 0)
VSscrolforward(VSIwn, y);
else
VSscrolback(VSIwn, -y);
} /* if */
} /* if */
} /* VSIcurson */
} /* if */
} /* if */
} /* VSIcurson */
void VSIcuroff
(
@ -305,6 +310,7 @@ VSlinePtr VSInewlines
// Loop through the elements, initializing each one.
for(i = 0; i < nlines; i++) {
linePtr->lattr = 0;
linePtr->mem = 0;
linePtr->text = textPtr;
linePtr->attr = attrPtr;
@ -373,6 +379,7 @@ VSlinePtr VSOnewlines
for (i = 1; i < nlines; i++)
{
t += (VSIw->allwidth + 1)* elementSize; /* inc to next text space for a line */
t2[i].lattr = 0;
t2[i].mem = 0; /* don't DisposePtr any of these */
t2[i].text = t;
t2[i].prev = t2 + i - 1; /* point back one */
@ -622,10 +629,13 @@ void VSIelo
if (s < 0)
s = VSIw->y;
if (VSIw->oldScrollback)
if (VSIw->oldScrollback) {
VSIw->attrst[s]->lattr = 0;
ta = &VSIw->attrst[s]->text[0];
else
} else {
VSIw->linest[s]->lattr = 0;
ta = &VSIw->linest[s]->attr[0];
}
tt = &VSIw->linest[s]->text[0];
for (i = 0; i <= VSIw->allwidth; i++)
{
@ -808,6 +818,7 @@ void VSIdellines
for (i = 0; i < n; i++)
{
itt->lattr = 0;
ta = itt->attr;
tt = itt->text;
for (j = 0; j <= VSIw->allwidth; j++)
@ -890,6 +901,8 @@ void VSOdellines
for (i = 0; i < n; i++)
{
ta = ((VSattrlinePtr)ita)->text;
ita->lattr = 0;
itt->lattr = 0;
tt = itt->text;
for (j = 0; j <= VSIw->allwidth; j++)
{
@ -1048,6 +1061,8 @@ void VSOinslines
{
tt = itt->text;
ta = ita->text;
itt->lattr = 0;
ita->lattr = 0;
for (j = 0; j <= VSIw->allwidth; j++)
{
*tt++ = ' ';
@ -1297,6 +1312,8 @@ void VSOscroll
else
VSIw->vistop = VSIw->vistop->next; /* consistent with changed display */
/* blank out newly-revealed bottom line */
VSIw->attrst[VSIw->lines]->lattr = 0;
VSIw->linest[VSIw->lines]->lattr = 0;
tempa = VSIw->attrst[VSIw->lines]->text;
temp = VSIw->linest[VSIw->lines]->text;
for (i = 0; i <= VSIw->allwidth; i++)
@ -1369,7 +1386,10 @@ void VSIindex
}
else if (VSIw->y < VSIw->lines) /* BYU - added "if ... " */
VSIw->y++;
} /* VSIindex */
VSIw->lattrib = 0;
} /* VSIindex */
void VSIwrapnow(short *xp, short *yp)
/* checks current cursor position for VSIw to see if
@ -1377,7 +1397,14 @@ void VSIwrapnow(short *xp, short *yp)
Returns correct cursor position in either case in *xp
and *yp. */
{
if (VSIw->x > VSIw->maxwidth)
short mw = VSIw->maxwidth;
if ((VSIw->lattrib & 3)) {
mw >>= 1;
if ( !(VSIw->maxwidth & 1) )
mw -= 1;
}
if (VSIw->x > mw)
{
VSIw->x = 0;
VSIindex();
@ -1421,10 +1448,13 @@ void VSIeeol
}
savedTextPtr = savedTextBlock;
for (i = 0; i <= VSIw->lines; i++) {
if (VSIw->oldScrollback)
if (VSIw->oldScrollback) {
savedTextPtr->lattr = VSIw->attrst[i]->lattr;
BlockMoveData(VSIw->attrst[i]->text, savedTextPtr->attr, (VSIw->allwidth + 1) * sizeof(VSAttrib));
else
} else {
savedTextPtr->lattr = VSIw->linest[i]->lattr;
BlockMoveData(VSIw->linest[i]->attr, savedTextPtr->attr, (VSIw->allwidth + 1) * sizeof(VSAttrib));
}
if (savedTextPtr->next) savedTextPtr = savedTextPtr->next;
}
@ -1437,10 +1467,13 @@ void VSIeeol
}
savedTextPtr = savedTextBlock;
for (i = 0; i <= VSIw->lines; i++) {
if (VSIw->oldScrollback)
if (VSIw->oldScrollback) {
VSIw->attrst[i]->lattr = savedTextPtr->lattr;
BlockMoveData(savedTextPtr->attr, VSIw->attrst[i]->text, (VSIw->allwidth + 1) * sizeof(VSAttrib));
else
} else {
VSIw->linest[i]->lattr = savedTextPtr->lattr;
BlockMoveData(savedTextPtr->attr, VSIw->linest[i]->attr, (VSIw->allwidth + 1) * sizeof(VSAttrib));
}
if (savedTextPtr->next) savedTextPtr = savedTextPtr->next;
}
DisposePtr((Ptr) savedTextBlock); // VSIfreelinelist adds un-needed overhead here
@ -1449,9 +1482,13 @@ void VSIeeol
VSIwrapnow(&x1, &y1);
y2 = y1;
/* clear out screen line */
if (VSIw->oldScrollback)
if (VSIw->oldScrollback) {
VSIw->attrst[y1]->lattr = 0;
ta = &VSIw->attrst[y1]->text[x1];
else ta = &VSIw->linest[y1]->attr[x1];
} else {
VSIw->linest[y1]->lattr = 0;
ta = &VSIw->linest[y1]->attr[x1];
}
tt = &VSIw->linest[y1]->text[x1];
for (i = VSIw->allwidth - x1 + 1; i > 0; i--)
{
@ -1483,15 +1520,21 @@ void VSIdelchars
*temp;
VSAttrib
*tempa;
short
lattr;
VSIwrapnow(&x1, &y1);
y2 = y1;
if (x > VSIw->maxwidth)
x = VSIw->maxwidth;
if (VSIw->oldScrollback)
if (VSIw->oldScrollback) {
tempa = VSIw->attrst[y1]->text;
else tempa = VSIw->linest[y1]->attr;
lattr = VSIw->attrst[y1]->lattr;
} else {
tempa = VSIw->linest[y1]->attr;
lattr = VSIw->linest[y1]->lattr;
}
temp = VSIw->linest[y1]->text;
for (i = x1; i <= VSIw->maxwidth - x; i++)
{
@ -1507,7 +1550,7 @@ void VSIdelchars
}
/* update display */
if (!VSIclip(&x1, &y1, &x2, &y2, &n, &offset))
RSdelchars(VSIwn, x1, y1, x);
RSdelchars(VSIwn, lattr, x1, y1, x);
} /* VSIdelchars */
void VSIfreelinelist
@ -1592,10 +1635,13 @@ void VSIebol
VSIwrapnow(&x2, &y1);
y2 = y1;
/* clear from beginning of line to cursor */
if (VSIw->oldScrollback)
if (VSIw->oldScrollback) {
//VSIw->attrst[y1]->lattr = 0;
ta = &VSIw->attrst[y1]->text[0];
else
} else {
//VSIw->attrst[y1]->lattr = 0;
ta = &VSIw->linest[y1]->attr[0];
}
tt = &VSIw->linest[y1]->text[0];
for (i = 0; i <= x2; i++)
{
@ -1625,9 +1671,13 @@ void VSIel
x1 = 0;
}
/* clear out line */
if (VSIw->oldScrollback)
if (VSIw->oldScrollback) {
//VSIw->attrst[s]->lattr = 0;
ta = &VSIw->attrst[s]->text[0];
else ta = &VSIw->linest[s]->attr[0];
} else {
//VSIw->linest[s]->lattr = 0;
ta = &VSIw->linest[s]->attr[0];
}
tt = &VSIw->linest[s]->text[0];
for(i = 0; i <= VSIw->allwidth; i++)
{
@ -1721,10 +1771,17 @@ void VSIrange
/* constrains cursor position to valid range (somewhere on the screen). */
{
short wrap = (VSIw->DECAWM) ? 1 : 0;
short mw = VSIw->maxwidth;
if ((VSIw->lattrib & 3)) {
mw >>= 1;
if ( !(VSIw->maxwidth & 1) )
mw -= 1;
}
if (VSIw->x < 0)
VSIw->x = 0;
if (VSIw->x > VSIw->maxwidth + wrap)
VSIw->x = VSIw->maxwidth + wrap;
if (VSIw->x > mw + wrap)
VSIw->x = mw + wrap;
if (VSIw->y < 0)
VSIw->y = 0;
if (VSIw->y > VSIw->lines)
@ -1744,8 +1801,15 @@ void VTsendpos( void )
short
x = VSIw->x,
y = VSIw->y;
short mw = VSIw->maxwidth;
if (x > VSIw->maxwidth) {
if ((VSIw->lattrib & 3)) {
mw >>= 1;
if ( !(VSIw->maxwidth & 1) )
mw -= 1;
}
if (x > mw) {
/* autowrap pending */
x = 0;
y++;
@ -1844,6 +1908,7 @@ void VTalign
VSIes(); /* erase the screen */
for (j = 0; j < VSIw->lines; j++)
{
VSIw->linest[j]->lattr = 0;
tt = &VSIw->linest[j]->text[0];
for (i = 0; i <= VSIw->maxwidth; i++)
*tt++ = 'E';
@ -1992,7 +2057,7 @@ void VSIinsstring
(VSIw->x - len). */
{
RSinsstring(VSIwn, VSIw->x - len, VSIw->y,
VSIw->attrib, len, start);
VSIw->lattrib, VSIw->attrib, len, start);
} /* VSIinsstring */
void VSIsave
@ -2029,6 +2094,7 @@ void VSIdraw
short VSIwn, /* window number */
short x, /* starting column */
short y, /* line on which to draw */
short la,
VSAttrib a, /* text attributes */
short len, /* length of text to draw */
char *c /* pointer to text */
@ -2041,7 +2107,7 @@ void VSIdraw
short x2, y2, offset;
if (!VSIclip(&x, &y, &x2, &y2, &len, &offset))
RSdraw(VSIwn, x, y, a, len, (char *) (c + offset)); /* BYU LSC */
RSdraw(VSIwn, x, y, la, a, len, (char *) (c + offset)); /* BYU LSC */
} /* VSIdraw */
short VSIgetblinkflag(void)

View File

@ -54,7 +54,7 @@ void VSIinschar(short x);
void VSIinsstring(short len, char *start);
void VSIsave(void);
void VSIrestore(void);
void VSIdraw(short VSIwn, short x, short y, VSAttrib a, short len, char *c);
void VSIdraw(short VSIwn, short x, short y, short la, VSAttrib a, short len, char *c);
void VSIflush(void);
void VSIcursdisable();
void VSIcursenable();

View File

@ -68,10 +68,10 @@
#define VSKP 145 /* Keypad . */
#define VSKE 146 /* Keypad Enter */
#define VSF1 147 /* Function 1 */ /* Mac Keypad Clear */
#define VSF2 148 /* Function 2 */ /* Mac Keypad = */
#define VSF3 149 /* Function 3 */ /* Mac Keypad / */
#define VSF4 150 /* Function 4 */ /* Mac Keypad * */
#define VSPF1 147 /* Function 1 */ /* Mac Keypad Clear */
#define VSPF2 148 /* Function 2 */ /* Mac Keypad = */
#define VSPF3 149 /* Function 3 */ /* Mac Keypad / */
#define VSPF4 150 /* Function 4 */ /* Mac Keypad * */
#ifdef VSMASTER
@ -94,8 +94,8 @@ extern unsigned char *VSIkplen; /* BYU 2.4.12 */
* Definition of attribute bits in the Virtual Screen
*
* 0 - Bold
* 1 - faint (used internally for 2nd ansi foreground color)
* 2 - italic (used internally for 2nd ansi background color)
* 1 - faint
* 2 - italic
* 3 - Underline
* 4 - slowly Blinking
* 5 - rapidly Blinking

View File

@ -45,6 +45,10 @@ static char munger[255];
extern short scrn;
extern WindRec *screens;
extern Boolean authOK; // true if authentication driver available
extern Boolean encryptOK; // true if des encryption routines available
#include "parse.proto.h"
static char *getcname(struct WindRec *tw);
@ -787,7 +791,7 @@ static void telnet_do(struct WindRec *tw, short option)
case N_AUTHENTICATION: /* do auth */
if (!tw->myopts[OPT_AUTHENTICATION-MHOPTS_BASE]) {
if (tw->authenticate) {
if (tw->authenticate && authOK) {
(tw->myopts)[OPT_AUTHENTICATION-MHOPTS_BASE] = 1;
send_will(tw->port, N_AUTHENTICATION);
}
@ -799,7 +803,7 @@ static void telnet_do(struct WindRec *tw, short option)
case N_ENCRYPT: /* do encrypt */
if (!tw->myopts[OPT_ENCRYPT-MHOPTS_BASE]) {
if (tw->encrypt) {
if (tw->encrypt && encryptOK && tw->authenticate && authOK) {
(tw->myopts)[OPT_ENCRYPT-MHOPTS_BASE] = 1;
send_will(tw->port, N_ENCRYPT);
} else {
@ -903,7 +907,7 @@ static void telnet_will(struct WindRec *tw, short option)
case N_ENCRYPT: /* will encrypt */
if (!tw->hisopts[OPT_ENCRYPT-MHOPTS_BASE]) {
if (tw->encrypt) {
if (tw->encrypt && encryptOK && tw->authenticate && authOK) {
(tw->hisopts)[OPT_ENCRYPT-MHOPTS_BASE] = 1;
send_do(tw->port, N_ENCRYPT);
} else {

View File

@ -162,7 +162,7 @@ void VSprOFF(void)
PrRecHandle = PrintSetupRecord();
GetWTitle ((GrafPtr) RSgetwindow(VSIwn),Title);
SetCursor(theCursors[normcurs]);
setLastCursor(theCursors[normcurs]);
if (PrJobDialog(PrRecHandle)) { /* Cancel the print if FALSE */
if ((sts=PrError()) != noErr){
@ -293,6 +293,7 @@ void VSem
short savedY;
unsigned char savedChar;
long val;
short mw;
escflg = VSIw->escflg;
@ -314,8 +315,16 @@ void VSem
#endif
screen = &screens[findbyVS(VSIwn)];
while (ctr > 0) {
mw = VSIw->maxwidth;
if ((VSIw->lattrib & 3)) {
mw >>= 1;
if ( !(VSIw->maxwidth & 1) )
mw -= 1;
}
if (VSIw->prredirect) /* PR - printer redirection? */
VSpr(&c,&ctr); /* PR -if yes, call VSpr */
/* PR - when we return from VSpr there may (ctr!=0) É */
@ -423,27 +432,30 @@ void VSem
//loop around, printing lines of text one at a time
start = &VSIw->linest[VSIw->y]->text[VSIw->x]; /* start of area needing redrawing */
current = start; /* where to put next char */
if (VSIw->oldScrollback)
if (VSIw->oldScrollback) {
acurrent = &VSIw->attrst[VSIw->y]->text[VSIw->x];
else
} else {
acurrent = &VSIw->linest[VSIw->y]->attr[VSIw->x]; /* where to put corresponding attribute byte */
}
attrib = VSIw->attrib; /* current writing attribute */
insert = VSIw->IRM; /* insert mode (boolean) */
offend = 0; /* wrapped to next line (boolean) */
extra = 0; /* overwriting last character of line */
sx = VSIw->x; /* starting column of area needing redrawing */
if (VSIw->x > VSIw->maxwidth) {
if (VSIw->x > mw) {
if (VSIw->DECAWM) { // wrap to next line
VSIw->x = 0;
VSIindex();
} else //stay at right margin
VSIw->x = VSIw->maxwidth;
VSIw->x = mw;
current = start = &VSIw->linest[VSIw->y]->text[VSIw->x];
if (VSIw->oldScrollback)
acurrent = &VSIw->attrst[VSIw->y]->text[VSIw->x];
else acurrent = &VSIw->linest[VSIw->y]->attr[VSIw->x];
else
acurrent = &VSIw->linest[VSIw->y]->attr[VSIw->x];
sx = VSIw->x;
} /* if */
@ -460,7 +472,7 @@ void VSem
*acurrent = attrib;
c++;
ctr--;
if (VSIw->x < VSIw->maxwidth) {
if (VSIw->x < mw) {
//advance the cursor position
acurrent++;
current++;
@ -473,7 +485,7 @@ void VSem
offend = 1; // terminate inner loop
} else {
//stay at right margin
VSIw->x = VSIw->maxwidth;
VSIw->x = mw;
extra = 1; // cursor position doesn't advance
}
}
@ -482,12 +494,12 @@ void VSem
//now update the screen to show what we've done
extra += VSIw->x - sx;
if (insert) {
RSinsstring(VSIwn, VSIw->x - extra, VSIw->y,VSIw->attrib, extra, start);
RSinsstring(VSIwn, VSIw->x - extra, VSIw->y, VSIw->lattrib, VSIw->attrib, extra, start);
} else {
short x2,y2,offset, sxCopy=sx,yCopy = VSIw->y, extraCopy = extra;
if (!VSIclip(&sxCopy, &yCopy, &x2, &y2, &extraCopy, &offset))
RSdraw(VSIwn, sxCopy,yCopy, VSIw->attrib,extraCopy,(char *) (start + offset));
if (!VSIclip(&sxCopy, &yCopy, &x2, &y2, &extraCopy, &offset)) {
RSdraw(VSIwn, sxCopy,yCopy, VSIw->lattrib, VSIw->attrib,extraCopy,(char *) (start + offset));
}
}
if (!captured)
VScapture((unsigned char *) start, extra);
@ -566,6 +578,7 @@ void VSem
} /* while */
while ( escflg == 2 && ctr > 0 ) {
/* "control sequence" processing */
switch (*c) {
case 0x08:
@ -666,22 +679,22 @@ void VSem
case 'C': /* cursor right */
sx = VSIw->parms[0];
if (sx < 1) sx = 1;
if (VSIw->DECAWM && VSIw->x >= VSIw->maxwidth) {
if (VSIw->DECAWM && VSIw->x >= mw) {
// autowrap
if (VSIw->y >= VSIw->lines)
goto ShortCut;
VSIw->y++;
VSIw->x = (VSIw->x > VSIw->maxwidth) ? 0 : -1;
VSIw->x = (VSIw->x > mw) ? 0 : -1;
}
VSIw->x += sx;
VSIrange();
if (VSIw->x > VSIw->maxwidth)
VSIw->x = VSIw->maxwidth;
if (VSIw->x > mw)
VSIw->x = mw;
goto ShortCut; /* BYU 2.4.12 */
case 'd': /* Y cursor position ? */
VSIw->y = VSIw->parms[0] - 1;
if (VSIw->DECAWM && VSIw->x > VSIw->maxwidth)
if (VSIw->DECAWM && VSIw->x > mw)
VSIw->x = 0;
if (VSIw->y < 0)
VSIw->y = 0;
@ -697,14 +710,14 @@ void VSem
if (VSIw->y <= 0)
goto ShortCut;
VSIw->y--;
VSIw->x = VSIw->maxwidth + 1;
VSIw->x = mw + 1;
}
VSIw->x -= sx;
VSIrange();
goto ShortCut; /* BYU 2.4.12 */
case 'G': /* X cursor position ? */
if (VSIw->DECAWM && VSIw->x > VSIw->maxwidth) {
if (VSIw->DECAWM && VSIw->x > mw) {
// autowrap
if (VSIw->y >= VSIw->lines)
goto ShortCut;
@ -713,8 +726,8 @@ void VSem
VSIw->x = VSIw->parms[0] - 1;
if (VSIw->x < 0)
VSIw->x = 0;
if (VSIw->x > VSIw->maxwidth)
VSIw->x = VSIw->maxwidth;
if (VSIw->x > mw)
VSIw->x = mw;
goto ShortCut;
case 'f':
@ -730,8 +743,8 @@ void VSem
we are past screen edge. This causes "resize" to break */
if (VSIw->x < 0) /* JMB 2.6 */
VSIw->x = 0; /* JMB 2.6 */
if (VSIw->x > VSIw->maxwidth) /* JMB 2.6 */
VSIw->x = VSIw->maxwidth; /* JMB 2.6 */
if (VSIw->x > mw) /* JMB 2.6 */
VSIw->x = mw; /* JMB 2.6 */
if (VSIw->y < 0) /* JMB 2.6 */
VSIw->y = 0; /* JMB 2.6 */
if (VSIw->y > VSIw->lines) /* JMB 2.6 */
@ -1027,6 +1040,7 @@ VSvalids(sx);
while ( escflg == 3 && ctr > 0 ) {
/* "#" handling */
short lattrib = -1;
switch (*c) {
case 0x08:
VSIw->x--;
@ -1034,19 +1048,36 @@ VSvalids(sx);
VSIw->x = 0;
break;
case '3': /* Double Height Line (DECDHL) Top Half */
goto ShortCut;
/* applies to the whole line */
lattrib = 1;
break;
case '4': /* Double Height Line (DECDHL) Bottom Half */
goto ShortCut;
/* applies to the whole line */
lattrib = 2;
break;
case '5': /* Single-Width Line (DECSWL) */
goto ShortCut;
lattrib = 0;
break;
case '6': /* Double-Width Line (DECDWL) */
goto ShortCut;
lattrib = 4;
break;
case '8': /* alignment display */
VTalign();
goto ShortCut; /* BYU 2.4.12 */
goto ShortCut;
default:
goto ShortCut; /* BYU 2.4.12 */
goto ShortCut;
} /* switch */
if ( lattrib != -1 ) {
VSIw->lattrib = lattrib;
if (VSIw->oldScrollback) {
VSIw->attrst[VSIw->y]->lattr = lattrib;
} else {
VSIw->linest[VSIw->y]->lattr = lattrib;
}
/* refresh line with new width */
VSredrawLine(VSIwn);
goto ShortCut;
}
c++;
ctr--;
} /* while */