fixed wrong OffsetRgn to updateRgn

This commit is contained in:
chombier 2001-03-20 20:25:57 +00:00
parent 801e48437b
commit 866d3dc91f
7 changed files with 300 additions and 304 deletions

View File

@ -39,6 +39,9 @@ static void calculateWindowPosition(WindRec *theScreen,Rect *whereAt, short cols
/* wdefpatch.c */
extern void drawicon (short id, Rect *dest);
#if GENERATINGPOWERPC
extern Boolean gHasSetWindowContentColor;
#endif
extern WindRec *screens;
@ -269,32 +272,27 @@ void RSdrawlocker(short w, RgnHandle visRgn)
}
}
short
RSupdatecontent(
GrafPtr wind,
RgnHandle updRgn )
{
short x1, x2, y1, y2;
short RSupdate
(
GrafPtr wind
)
/* does updating for the specified window, if it's one of mine.
Returns zero iff it is. */
{
short w, x1, x2, y1, y2;
w = RSfindvwind(wind);
if (RSsetwind(w) < 0)
return(-1); /* not one of mine */
BeginUpdate(wind);
RSregnconv /* find bounds of text area needing updating */
(
wind->visRgn,
updRgn,
&x1, &y1, &x2, &y2,
RScurrent->fheight, RScurrent->fwidth
);
if (x2 > x1)
{
VSredraw(w, x1, y1, x2, y2); /* draw that text */
/* We must reset, less we risk looking UGLY as sin... */
VSredraw(RSfindvwind(wind), x1, y1, x2, y2); /* draw that text */
// We must reset, less we risk looking UGLY as sin...
BackPat(PATTERN(qd.white));
PenPat(PATTERN(qd.black));
if (TelInfo->haveColorQuickDraw)
{
PmForeColor(0);
@ -312,20 +310,38 @@ short RSupdate
ForeColor(RScolors[7]); /* normal foreground */
BackColor(RScolors[0]); /* normal Background */
}
} /* if */
//now get that annoying strip on the right (CCP)
}
RSa = -1;
PenMode(patOr);
DrawGrowIcon(wind);
PenMode(patCopy);
//DrawControls(wind);
}
UpdateControls(wind, wind->visRgn);
RSdrawlocker(w, wind->visRgn);
return(0);
}
short RSupdate
(
GrafPtr wind
)
/* does updating for the specified window, if it's one of mine.
Returns zero iff it is. */
{
short w, x1, x2, y1, y2;
w = RSfindvwind(wind);
if (RSsetwind(w) < 0)
return(-1); /* not one of mine */
BeginUpdate(wind);
if ( !EmptyRgn(wind->visRgn) ) {
RSupdatecontent(wind, wind->visRgn);
DrawGrowIcon(wind);
UpdateControls(wind, wind->visRgn);
RSdrawlocker(w, wind->visRgn);
}
EndUpdate(wind);
return(0);
} /* RSupdate */
short RSTextSelected(short w) { /* BYU 2.4.11 */
return(RSlocal[w].selected); /* BYU 2.4.11 */
} /* BYU 2.4.11 */
@ -342,11 +358,11 @@ void RSskip
} /* RSskip */
/*
* This routine is called when the user presses the grow icon, or when the size of
* the window needs to be adjusted (where==NULL, modifiers==0).
* It limits the size of the window to a legal range.
*/
/*
* This routine is called when the user presses the grow icon, or when the size of
* the window needs to be adjusted (where==NULL, modifiers==0).
* It limits the size of the window to a legal range.
*/
short RSsize (GrafPtr window, long *where, long modifiers)
{
@ -463,7 +479,6 @@ short RSsize (GrafPtr window, long *where, long modifiers)
return(-2);
break;
default: //Ok, we can resize; tell host
/* NONO */
cwidth = x2 - x1 + 1;
if ( cwidth > 255 ) {
cwidth = 255;
@ -478,18 +493,6 @@ short RSsize (GrafPtr window, long *where, long modifiers)
ssh_glue_wresize(&screens[screenIndex]);
}
}
/*
if ((x2 - x1 + 1) <= 132) { // bug fix from RAB 6/5/97
RScalcwsize(w,x2 - x1 +1);
if (screenIndexValid && screens[screenIndex].naws)
SendNAWSinfo(&screens[screenIndex], (x2-x1+1), (y2-y1+1));
} else { // RAB 6/5/97
RScalcwsize(w, 132);
if (screenIndexValid && screens[screenIndex].naws)
SendNAWSinfo(&screens[screenIndex], 132, (y2-y1+1));
} // RAB 6/5/97
*/
/* NONO */
return (0);
break;
}
@ -522,7 +525,12 @@ Boolean RSsetcolor
{
if ( !(TelInfo->haveColorQuickDraw) || (RSsetwind(w) < 0) || (n > 15) || (n < 0))
return(FALSE);
#if GENERATINGPOWERPC
if ( n == 1 && gHasSetWindowContentColor ) {
SetWindowContentColor(RScurrent->window, &Color);
}
#endif
SetEntryColor(RScurrent->pal, n, &Color);
SetPort(RScurrent->window);
InvalRect(&RScurrent->window->portRect);
@ -629,17 +637,15 @@ short RSnewwindow
if (RScurrent->window == NULL) {
VSdestroy(w);
return(-2);
}
}
else
{
} else {
RGBColor scratchRGB;
RScurrent->window = NewCWindow(0L, wDims, name, showit, (short)8,kInFront, goaway, (long)w);
if (RScurrent->window == NULL) {
VSdestroy(w);
return(-2);
}
}
//note: the ANSI colors are in the top 8 of the palette. The four telnet colors (settable
//in telnet) are in the lower 4 of the palette. These 4 are set later by a call from
//CreateConnectionFromParams to RSsetColor (ick, but I am not going to add 4 more params to
@ -1743,14 +1749,18 @@ void RSUpdatePalette(void) //called when ANSI colors have changed, and we need
if (RSsetwind(screens[screenIndex].vs) >= 0)
{
int i;
for (i = 0; i < 16; i++)
{
for (i = 0; i < 16; i++) {
RGBColor tempColor;
GetEntryColor(TelInfo->AnsiColors, i, &tempColor);
#if GENERATINGPOWERPC
if ( i == 1 && gHasSetWindowContentColor ) {
SetWindowContentColor(RScurrent->window, &tempColor);
}
#endif
SetEntryColor(RScurrent->pal,i+4, &tempColor); //set the new color
SetPort(screens[screenIndex].wind);
InvalRect(&(RScurrent->window->portRect));//force a redraw
}
SetPort(screens[screenIndex].wind);
InvalRect(&RScurrent->window->portRect); //force a redraw
}
}
}

View File

@ -4,6 +4,7 @@ void RSunload(void);
void RSselect(short w, Point pt, EventRecord theEvent);
void RSzoom(GrafPtr window, short code, short shifted);
void RSdrawlocker(short w, RgnHandle visRgn);
short RSupdatecontent(GrafPtr wind, RgnHandle updRgn);
short RSupdate(GrafPtr wind);
short RSTextSelected(short w);
void RSskip(short w, Boolean on);

View File

@ -116,13 +116,20 @@ extern WindRec *screens;
#include "rsmac.proto.h"
#include <CodeFragments.h>
short MaxRS;
RSdata *RSlocal, *RScurrent;
Rect noConst,
RScur; /* cursor rectangle */
Rect noConst;
RgnHandle RSuRgn; /* update region */
static RgnHandle RSuRgn; /* update region */
static RgnHandle hiddenRgn;
static RgnHandle revealedRgn;
#if GENERATINGPOWERPC
Boolean gHasSetWindowContentColor = 0;
#endif
short RSw=-1, /* last window used */
RSa=0; /* last attrib used */
@ -131,6 +138,10 @@ extern long RScolors[];
// initializes handling of terminal windows
void RSinitall(short max) //max windows to allow
{
#if GENERATINGPOWERPC
OSErr theErr;
CFragConnectionID connID;
#endif
short i;
MaxRS = max;
RSlocal = (RSdata *) myNewPtr(MaxRS * sizeof(RSdata));
@ -144,17 +155,22 @@ void RSinitall(short max) //max windows to allow
RScurrent->cursor.right = 0;
}
RSuRgn = NewRgn();
RScur.left = 0;
RScur.top = 0;
RScur.bottom = 0;
RScur.right = 0;
if (!TelInfo->haveColorQuickDraw)
DisposeHandle((Handle)TelInfo->AnsiColors);
hiddenRgn = NewRgn();
revealedRgn = NewRgn();
#if GENERATINGPOWERPC
// can't use this: updated scrollbars looks ugly.
/*
theErr = GetSharedLibrary("\pWindowsLib", kPowerPCCFragArch, kFindCFrag, &connID, NULL, NULL);
if ( !theErr ) {
gHasSetWindowContentColor = (FindSymbol( connID, "\pSetWindowContentColor", NULL, NULL ) == noErr);
}
*/
gHasSetWindowContentColor = 0;
#endif
} // RSinitall
void RSsetConst
(
short w
@ -193,10 +209,6 @@ short RSsetwind
return(0);
} /* RSsetwind */
void RSvalidateRect(short w)
{
ValidRect(&((RSlocal[w].window)->portRect));
}
void RSbell
(
short w
@ -499,9 +511,9 @@ void RSinvText
if (lb.v - ub.v > 1) /* highlight extends across more than two lines */
{
/* highlight complete in-between lines */
SetRect
MYSETRECT
(
&temp,
temp,
0,
(ub.v + 1) * RScurrent->fheight,
RScurrent->width,
@ -515,6 +527,10 @@ void RSinvText
} /* if */
} /* RSinvText */
/*
* RSdraw
*/
void RSdraw
(
short w, /* window number */
@ -530,12 +546,10 @@ void RSdraw
{
Rect rect;
short ys;
RgnHandle oldClip;
if (RSlocal[w].skip)
return;
RSsetwind(w);
// RSsetattr(0); JMB 2.6.1d4
ys = y * RScurrent->fheight;
MYSETRECT /* set up rectangle bounding text being drawn */
@ -549,45 +563,56 @@ void RSdraw
RSsetattr(a);
if (x <= 0) /* BYU 2.4.12 - Without this, 1 pixel column of reverse */
rect.left = -3; /* BYU 2.4.12 - video text does not clear at left margin */
/* NONO */
oldClip = NewRgn();
if (oldClip) {
GetClip(oldClip);
ClipRect(&rect);
}
/* NONO */
/*
if (rect.bottom == RScurrent->rheight)
rect.bottom += 1; //CCP take care of updating problems while scrolling
*/
EraseRect(&rect);
if (x <= 0)
rect.left = 0;
if (x <= 0) /* BYU 2.4.12 - Okay, just putting it back the way it was */
rect.left = 0; /* BYU 2.4.12 */
EraseRect(&rect);
MoveTo(x * RScurrent->fwidth, ys + RScurrent->fascent);
DrawText(ptr, 0, len);
if (RScurrent->selected)
RSinvText(w, *(Point *) &RScurrent->anchor,
*(Point *) &RScurrent->last, &rect);
ValidRect(&rect);
/* NONO */
if (oldClip) {
SetClip(oldClip);
DisposeRgn(oldClip);
}
/* NONO */
} /* RSdraw */
/*
* ScrollRectInRgn
*/
static void ScrollRectInRgn( WindowPtr window, Rect *inRect, short dh, short dv)
{
/* adjust the update region to track the scrolled window contents */
/* this is actually wrong, we must offset only the
* scrolled rect, not the whole window's update region */
/*OffsetRgn(updRgn, dh, dv);*/
Rect rect = *inRect;
RgnHandle updRgn = ((WindowPeek)window)->updateRgn;
LocalToGlobal( &rect.top );
LocalToGlobal( &rect.bottom );
RectRgn( revealedRgn, &rect );
SectRgn( updRgn, revealedRgn, revealedRgn );
OffsetRgn( revealedRgn, dh, dv );
UnionRgn( revealedRgn, updRgn, updRgn );
ScrollRect(inRect, dh, dv, RSuRgn);
InvalRgn(RSuRgn);
/* doesn't work...
if ( !EmptyRgn(RSuRgn) ) {
OffsetRgn( RSuRgn, inRect->left - rect.left, inRect->top - rect.top );
RSupdatecontent(window, RSuRgn);
DiffRgn( updRgn, RSuRgn, updRgn );
}
*/
}
void RSdelcols
(
short w,
@ -610,21 +635,16 @@ void RSdelcols
RScurrent->width,
RScurrent->height
);
ScrollRect(&rect, -n * RScurrent->fwidth, 0, RSuRgn);
InvalRgn(RSuRgn);
ValidRect(&rect); /* any necessary redrawing in newly-revealed area will be done by caller */
MYSETRECT /* bounds of newly-revealed area */
(
rect,
RScurrent->width - (n * RScurrent->fwidth),
0,
RScurrent->width,
RScurrent->height
);
if (RScurrent->selected)
/* highlight any newly-revealed part of the current selection */
ScrollRectInRgn(RScurrent->window, &rect, -n * RScurrent->fwidth, 0);
if (RScurrent->selected) {
/* bounds of newly-revealed area */
rect.left = RScurrent->width - (n * RScurrent->fwidth);
/* highlight any newly-revealed part of the current selection */
RSinvText(w, *(Point *) &RScurrent->anchor,
*(Point *) &RScurrent->last, &rect);
}
} /* RSdelcols */
void RSdelchars
@ -637,7 +657,7 @@ void RSdelchars
/* deletes the specified number of characters from the specified
position to the right, moving the remainder of the line to the
left. */
{
{
Rect rect;
if (RSlocal[w].skip)
@ -657,10 +677,9 @@ void RSdelchars
EraseRect(&rect);
else
{
/* scroll remainder of line to the left */
ScrollRect(&rect, - RScurrent->fwidth * n, 0, RSuRgn);
InvalRgn(RSuRgn);
ValidRect(&rect); /* leave newly-revealed area blank */
/* scroll remainder of line to the left */
ScrollRectInRgn(RScurrent->window, &rect, - n * RScurrent->fwidth, 0);
if (RScurrent->selected)
{
/* highlight any part of selection which lies in newly-blanked area */
@ -669,10 +688,8 @@ void RSdelchars
HUnlock((Handle) RSuRgn);
} /* if */
} /* if */
/* NONO */
RSsetattr(VSIw->attrib); /* restore mode for text drawing */
/* NONO */
} /* RSdelchars */
} /* RSdelchars */
void RSdellines
(
@ -692,7 +709,6 @@ void RSdellines
stuff in between. */
{
Rect rect;
short RSfheightTimesn, RSfheightTimesbplus1;
if (RSlocal[w].skip)
return;
@ -716,33 +732,18 @@ void RSdellines
} /* if */
} /* if */
/* NONO: scroll 2 pixels more on the left*/
/*rect.left = -1;*/ /* BYU 2.4.12 - necessary */
rect.left = -3;
/* NONO */
rect.right = RScurrent->width;
rect.top = t * RScurrent->fheight;
RSfheightTimesbplus1 = (b + 1) * RScurrent->fheight;
rect.bottom = RSfheightTimesbplus1;
/* adjust the update region to track the scrolled window contents */
RSfheightTimesn = RScurrent->fheight * n;
OffsetRgn(((WindowPeek) RScurrent->window)->updateRgn,
0, -RSfheightTimesn);
ScrollRect(&rect, 0, -RSfheightTimesn, RSuRgn);
RSsetattr(VSIw->attrib); /* restore mode for text drawing */
InvalRgn(RSuRgn);
/* validate the area containing the newly-inserted blank lines. */
/* any necessary redrawing in newly-revealed area will be done by caller */
MYSETRECT
(
rect,
0,
(b - n + 1) * RScurrent->fheight - 1,
-3, /* scroll 3 pixels more on the left */
t * RScurrent->fheight,
RScurrent->width,
RSfheightTimesbplus1 + 1
(b + 1) * RScurrent->fheight
);
ValidRect(&rect);
ScrollRectInRgn(RScurrent->window, &rect, 0, -RScurrent->fheight * n);
RSsetattr(VSIw->attrib); /* restore mode for text drawing */
} /* RSdellines */
void RSerase
@ -762,16 +763,16 @@ void RSerase
return;
RSsetwind(w);
RSsetattr(0); /* avoid funny pen modes */
SetRect
MYSETRECT
(
&rect,
rect,
x1 * RScurrent->fwidth ,
y1 * RScurrent->fheight,
(x2 + 1) * RScurrent->fwidth - 1,
/* NONO removed bottom line from erase */
(y2 + 1) * RScurrent->fheight /*+ 1*/
/* NONO */
(y2 + 1) * RScurrent->fheight
);
if (rect.left <= 0) /* little buffer strip on left */
rect.left = CHO;
if (rect.right >= RScurrent->width - 1)
@ -782,9 +783,9 @@ void RSerase
if (RScurrent->selected)
/* highlight any part of the selection within the cleared area */
RSinvText(w, *(Point *) &RScurrent->anchor, *(Point *) &RScurrent->last, &rect);
/* NONO */
RSsetattr(VSIw->attrib); /* restore mode for text drawing */
/* NONO */
} /* RSerase */
void RSinslines
@ -812,25 +813,19 @@ void RSinslines
*(Point *) &RScurrent->last, &noConst);
RScurrent->selected = 0;
} /* if */
/* NONO: scroll 2 pixels more on the left */
/*rect.left = -1;*/ /* BYU 2.4.12 - necessary */
rect.left = -3;
/* NONO */
rect.right = RScurrent->width;
rect.top = t * RScurrent->fheight;
rect.bottom = (b + 1) * RScurrent->fheight;
/* adjust the update region to track the scrolled window contents */
OffsetRgn(((WindowPeek) RScurrent->window)->updateRgn,
0, RScurrent->fheight * n);
ScrollRect(&rect, 0, RScurrent->fheight * n, RSuRgn);
InvalRgn(RSuRgn);
/* newly-inserted area is already blank -- validate it to avoid redrawing. */
/* any necessary redrawing will be done by caller */
SetRect(&rect, 0, t * RScurrent->fheight /*- 1*/,
RScurrent->width, (t + n) * RScurrent->fheight + 1);
ValidRect(&rect);
MYSETRECT
(
rect,
-3, /* scroll 3 pixels more on the left */
t * RScurrent->fheight,
RScurrent->width,
(b + 1) * RScurrent->fheight
);
ScrollRectInRgn(RScurrent->window, &rect, 0, RScurrent->fheight * n);
RSsetattr(VSIw->attrib); /* restore mode for text drawing */
/* NONO */
} /* RSinslines */
void RSinscols
@ -848,28 +843,22 @@ void RSinscols
if (RSlocal[w].skip)
return;
RSsetwind(w);
SetRect /* bounds of entire text area */
MYSETRECT /* bounds of entire text area */
(
&rect,
rect,
0,
0,
RScurrent->width,
RScurrent->height
);
ScrollRect(&rect, n * RScurrent->fwidth, 0, RSuRgn);
InvalRgn(RSuRgn);
ValidRect(&rect); /* any necessary redrawing in newly-revealed area will be done by caller */
SetRect /* bounds of newly-inserted blank area */
(
&rect,
0,
0,
(n + 1) * RScurrent->fwidth - 1,
RScurrent->height
);
if (RScurrent->selected)
/* highlight any part of the selection in the newly-blanked area */
ScrollRectInRgn(RScurrent->window, &rect, n * RScurrent->fwidth, 0);
if (RScurrent->selected) {
/* highlight any part of the selection in the newly-blanked area */
rect.right = (n + 1) * RScurrent->fwidth - 1;
RSinvText(w, *(Point *) &RScurrent->anchor, *(Point *) &RScurrent->last, &rect);
}
} /* RSinscols */
void RSinsstring
@ -884,45 +873,39 @@ void RSinsstring
/* inserts a string of characters at the specified position, scrolling
the rest of the line to the right. Highlights any part of the newly-
inserted text lying within the current selection. */
{
{
Rect rect;
if (RSlocal[w].skip)
return;
RSsetwind(w);
SetRect /* bounds of part of line from specified position to end of line */
MYSETRECT /* bounds of part of line from specified position to end of line */
(
&rect,
rect,
x * RScurrent->fwidth,
y * RScurrent->fheight,
RScurrent->width,
(y + 1) * RScurrent->fheight
);
ScrollRect(&rect, len * RScurrent->fwidth, 0, RSuRgn); /* scroll remainder of line to the right */
if (RSa != a)
RSsetattr(a);
InvalRgn(RSuRgn);
ValidRect(&rect); /* any necessary redrawing in newly-revealed area will be done by caller */
SetRect /* bounds area to contain inserted string */
(
&rect,
x * RScurrent->fwidth,
y * RScurrent->fheight,
(x + len) * RScurrent->fwidth,
(y + 1) * RScurrent->fheight
);
/* scroll remainder of line to the right */
ScrollRectInRgn(RScurrent->window, &rect, len * RScurrent->fwidth, 0);
/* bounds area to contain inserted string */
rect.right = (x + len) * RScurrent->fwidth;
EraseRect(&rect); /* erase area to appropriate background */
MoveTo
(
x * RScurrent->fwidth,
y * RScurrent->fheight + RScurrent->fascent
rect.left,
rect.top + RScurrent->fascent
);
RSsetattr(a);
DrawText(ptr, 0, len);
if (RScurrent->selected)
/* highlight any part of selection covering the newly-inserted text */
/* highlight any part of selection covering the newly-inserted text */
RSinvText(w, *(Point *) &RScurrent->anchor,
*(Point *) &RScurrent->last, &rect);
} /* RSinsstring */
} /* RSinsstring */
void RSmargininfo
@ -1074,13 +1057,13 @@ Point normalize(Point in, short w, Boolean autoScroll)
if (autoScroll)
VSscrolright(w, 1);
} /* if */
/* in.h = (in.h + Fwidthhalf) / FWidth - 1; */
/* the MPW C 3.0 compiler has a bug in its register allocation */
/* which keeps the above line from working. So, replace it with this: */
/* in.h = (in.h + Fwidthhalf) / FWidth - 1; */
/* the MPW C 3.0 compiler has a bug in its register allocation */
/* which keeps the above line from working. So, replace it with this: */
in.h = in.h + Fwidthhalf;
in.h = in.h / FWidth - 1;
/* note the bug has been fixed in the 3.1 compiler. */
/* convert to virtual screen coordinates */
/* note the bug has been fixed in the 3.1 compiler. */
/* convert to virtual screen coordinates */
in.v += RSlocal[w].topline;
in.h += RSlocal[w].leftmarg;
return(in);
@ -1114,10 +1097,10 @@ void RSsetsize( short w, short v, short h, short screenIndex)
RSlocal[w].rheight = v - 16;
RSlocal[w].rwidth = h - 16;
/*
* Get rid of the scroll bars which were in the old size.
* Hiding them causes the region to be updated later.
*/
/*
* Get rid of the scroll bars which were in the old size.
* Hiding them causes the region to be updated later.
*/
if (RSlocal[w].scroll != NULL )
HideControl(RSlocal[w].scroll);
if (RSlocal[w].left != NULL )
@ -1125,8 +1108,7 @@ void RSsetsize( short w, short v, short h, short screenIndex)
DrawGrowIcon(RSlocal[w].window); /* Draw in the necessary bugger */
/* move the scroll bars to their new positions and sizes, and redisplay them */
/* move the scroll bars to their new positions and sizes, and redisplay them */
SetControlValue(RSlocal[w].scroll, RSlocal[w].current); //because we dont always have this
if (RSlocal[w].scroll != NULL ) {
SizeControl(RSlocal[w].scroll, 16, (v - 13));
@ -1147,8 +1129,7 @@ void RSsetsize( short w, short v, short h, short screenIndex)
ShowControl(RSlocal[w].left);
}
/* draw the locker once the scrollbars has moved */
/* draw the locker once the scrollbars has moved */
RSdrawlocker(w, RSlocal[w].window->visRgn);
SetRect(&RSlocal[w].textrect, 0, 0, RSlocal[w].rwidth, RSlocal[w].rheight);
@ -1179,11 +1160,10 @@ void RSbackground(short w, short value)
SetEntryColor(RSlocal[w].pal,0,&temp2);
SetEntryColor(RSlocal[w].pal,1,&temp1);
}
SetPort(RSlocal[w].window);
InvalRect(&RSlocal[w].window->portRect);
}
}
void RScheckmaxwind(Rect *origRect,short origW,
short origH, short *endW, short *endH)
{

View File

@ -32,4 +32,3 @@ 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);
void RSvalidateRect(short w);

View File

@ -316,30 +316,30 @@ short VSnewscreen
return(-1);
numLines -= 1; //correct for internal use
/*
* Fill initial scrollback buffer and screen storage space.
*
* Memory allocation rules:
* line->mem == 0 if not a memory allocation, line->mem == 1 if it is the first
* VSline in a block (indeterminate size, may be size == 1)
*
* attributes array is ALWAYS allocated as one block. Internally represented and
* manipulated as a linked list of lines, but only one of the lines will have
* line->mem == 1. This list is always supposed to be circular (it is never
* extended, as attributes are never scrolled back).
*
* scrollback and screen line buffer space is allocated in large blocks. Each
* block will have line->mem == 1 if the pointer to that VSline is "free"able.
* This list will either be circular (which means it has reached its full size),
* or it will have a NULL next field at the end. During scrolling, the end may
* be augmented until VSIw->numlines > VSIw->maxlines or we run out of memory.
* Typically allocate memory 100 lines at a time in two blocks, one is the VSline
* list, the other is the mem for the character storage.
*
*/
/*
* Fill initial scrollback buffer and screen storage space.
*
* Memory allocation rules:
* line->mem == 0 if not a memory allocation, line->mem == 1 if it is the first
* VSline in a block (indeterminate size, may be size == 1)
*
* attributes array is ALWAYS allocated as one block. Internally represented and
* manipulated as a linked list of lines, but only one of the lines will have
* line->mem == 1. This list is always supposed to be circular (it is never
* extended, as attributes are never scrolled back).
*
* scrollback and screen line buffer space is allocated in large blocks. Each
* block will have line->mem == 1 if the pointer to that VSline is "free"able.
* This list will either be circular (which means it has reached its full size),
* or it will have a NULL next field at the end. During scrolling, the end may
* be augmented until VSIw->numlines > VSIw->maxlines or we run out of memory.
* Typically allocate memory 100 lines at a time in two blocks, one is the VSline
* list, the other is the mem for the character storage.
*
*/
/* All memory allocation for this function is done at once, to help damage control in
low memory situations */
/* All memory allocation for this function is done at once, to help damage control in
low memory situations */
if ((VSscreens[VSIwn].loc = VSIw = (VSscrn *) myNewPtr(sizeof(VSscrn))) == 0L)
return(-2);
@ -369,7 +369,7 @@ low memory situations */
/* NONO */
/* VSIw->tabs = (char *) myNewPtr(132);*/ /* NCSA: SB - allow 132 column mode */
VSIw->tabs = (char *) myNewPtr(255);
VSIw->tabs = (char *) myNewPtr(255); /* up to 255 comumns */
/* NONO */
if (VSIw->tabs == NULL) /* CCP: Hey? Why not check if we got it?! */
{
@ -380,7 +380,7 @@ low memory situations */
}
/* NONO */
/* VSIw->allwidth = 131;*/ /* NCSA: SB - always allocate max lines */
VSIw->allwidth = 255; /* NCSA: SB - always allocate max lines */
VSIw->allwidth = 255; /* always allocate max lines */
/* NONO */
if (!VSIw->oldScrollback) {
if (screensave)
@ -640,9 +640,9 @@ short VSredraw
if (!VSIclip(&tx1, &ty1, &tx2, &ty2, &tn, &offset)) {
ypt = VSIw->vistop;
for(y=VSIw->Rtop; y<y1; y++)
ypt = ypt->next; // Get pointer to top line we need
ypt = VSIw->vistop;
for(y=VSIw->Rtop; y<y1; y++)
ypt = ypt->next; // Get pointer to top line we need
for (y=ty1; y<=ty2; y++) {
char *pt;
@ -711,12 +711,6 @@ short VSredraw
}
VSIcurson(w, VSIw->x, VSIw->y, 0); /* restore cursor at original position */
/* NONO */
/* ??? what is this for ???
tx1 = ty1 = 0;
tn = 132;
*/
/* NONO */
return(0);
} /* VSredraw */
@ -828,12 +822,6 @@ short VSOredraw
VSIcurson(w, VSIw->x, VSIw->y, 0); /* restore cursor at original position */
/* NONO */
/* ??? what is this for ???
tx1 = ty1 = 0;
tn = 132;
*/
/* NONO */
return(0);
} /* VSOredraw */
@ -2058,6 +2046,7 @@ short VSPulseOne
VSattrlinePtr ypa;
short y;
short tx1, tx2, ty1, ty2, tn, offset;
short cursOff;
if (VSvalids(w) != 0)
return(-3);
@ -2087,54 +2076,66 @@ short VSPulseOne
if (VSIclip(&tx1, &ty1, &tx2, &ty2, &tn, &offset)!=0) return 0; // test clip region
VSIcuroff(w); // temporarily hide cursor
cursOff = 0;
// VSIcuroff(w); // temporarily hide cursor // Nah [NONO] (flicker)
// RSerase(w, tx1, ty1, tx2, ty2); // Erase the offending area // Nah [DJ] (flicker)
// draw visible part of scrollback buffer
tx1 = x1; // Set up to clip redraw area to visible area of scrollback buffer
tx2 = x2;
ty1 = y1;
ty2 = y2; // RAB
tn = -1;
tx1 = x1; // Set up to clip redraw area to visible area of scrollback buffer
tx2 = x2;
ty1 = y1;
ty2 = y2; // RAB
tn = -1;
// RAB BetterTelnet 2.0fc1 - DJ wrote this, but I had to revise it to cover
// the "new" attributes-in-scrollback scenario
if (!VSIclip(&tx1, &ty1, &tx2, &ty2, &tn, &offset)) {
ypt = VSIw->vistop;
for(y=VSIw->Rtop; y<y1; y++)
ypt = ypt->next; // Get pointer to top line we need
for (y=ty1; y<=ty2; y++) {
char *pt;
unsigned short *pa;
unsigned short lasta;
short x, lastx;
if (!VSIclip(&tx1, &ty1, &tx2, &ty2, &tn, &offset)) {
ypt = VSIw->vistop;
for(y=VSIw->Rtop; y<y1; y++)
ypt = ypt->next; // Get pointer to top line we need
pt = ypt->text + VSIw->Rleft;
pa = ypt->attr + VSIw->Rleft;
for (y=ty1; y<=ty2; y++) {
char *pt;
unsigned short *pa;
unsigned short lasta;
short x, lastx;
lastx = tx1;
lasta = pa[tx1];
for(x=tx1+1; x<=tx2; x++) {
if (pa[x]!=lasta && VSisblnk(lasta)) { // Ahah! [DJ]
RSa = 0; // RAB - shouldn't be necessary, but...
RSdraw(w, lastx, y, lasta, x-lastx, pt + lastx);
lastx = x;
lasta = pa[x];
pt = ypt->text + VSIw->Rleft;
pa = ypt->attr + VSIw->Rleft;
lastx = tx1;
lasta = pa[tx1];
for(x=tx1+1; x<=tx2; x++) {
if (pa[x]!=lasta && VSisblnk(lasta)) { // Ahah! [DJ]
if (!cursOff) {
// temporarily hide cursor
cursOff = 1;
VSIcuroff(w);
}
RSa = 0; // RAB - shouldn't be necessary, but...
RSdraw(w, lastx, y, lasta, x-lastx, pt + lastx);
lastx = x;
lasta = pa[x];
}
if (lastx<=tx2 && VSisblnk(lasta)) { // Ditto [DJ]
RSa = 0;
RSdraw(w, lastx, y, lasta, tx2-lastx+1, pt + lastx);
}
ypt = ypt->next;
}
if (lastx<=tx2 && VSisblnk(lasta)) { // Ditto [DJ]
if (!cursOff) {
// temporarily hide cursor
cursOff = 1;
VSIcuroff(w);
}
RSa = 0;
RSdraw(w, lastx, y, lasta, tx2-lastx+1, pt + lastx);
}
ypt = ypt->next;
}
VSIcurson(w, VSIw->x, VSIw->y, 0); /* restore cursor at original position */
}
if ( cursOff ) {
VSIcurson(w, VSIw->x, VSIw->y, 0); /* restore cursor at original position */
}
/* NONO */
/* ??? what is this for ???
tx1 = ty1 = 0;
@ -2157,6 +2158,7 @@ short VSOPulseOne
VSattrlinePtr ypa;
short y;
short tx1, tx2, ty1, ty2, tn, offset;
short cursOff;
if (VSvalids(w) != 0)
return(-3);
@ -2183,7 +2185,8 @@ short VSOPulseOne
if (VSIclip(&tx1, &ty1, &tx2, &ty2, &tn, &offset)!=0) return 0; // test clip region
VSIcuroff(w); // temporarily hide cursor
cursOff = 0;
// VSIcuroff(w); // temporarily hide cursor // Nah [NONO] (flicker)
// RSerase(w, tx1, ty1, tx2, ty2); // Erase the offending area // Nah [DJ] (flicker)
/*
// draw visible part of scrollback buffer
@ -2236,6 +2239,11 @@ short VSOPulseOne
lasta = pa[tx1];
for(x=tx1+1; x<=tx2; x++) {
if (pa[x]!=lasta && VSisblnk(lasta)) { // Ahah! [DJ]
if (!cursOff) {
// temporarily hide cursor
cursOff = 1;
VSIcuroff(w);
}
RSa = 0;
RSdraw(w, lastx, y, lasta, x-lastx, pt + lastx);
lastx = x;
@ -2243,6 +2251,11 @@ short VSOPulseOne
}
}
if (lastx<=tx2 && VSisblnk(lasta)) { // Ditto [DJ]
if (!cursOff) {
// temporarily hide cursor
cursOff = 1;
VSIcuroff(w);
}
RSa = 0;
RSdraw(w, lastx, y, lasta, tx2-lastx+1, pt + lastx);
}
@ -2252,8 +2265,9 @@ short VSOPulseOne
}
}
VSIcurson(w, VSIw->x, VSIw->y, 0); /* restore cursor at original position */
if ( cursOff ) {
VSIcurson(w, VSIw->x, VSIw->y, 0); /* restore cursor at original position */
}
/* NONO */
/* ??? what is this for ???
tx1 = ty1 = 0;

View File

@ -1186,9 +1186,6 @@ void VSIscroll
} /* if */
// if (RSisInFront(VSIwn))
// RSvalidateRect(VSIwn);
} /* VSIscroll */
void VSOscroll
@ -1322,8 +1319,6 @@ void VSOscroll
}
} /* if */
// if (RSisInFront(VSIwn))
// RSvalidateRect(VSIwn);
} /* VSOscroll */

View File

@ -455,17 +455,14 @@ void VSem
} //we've got a line full of text in the virtual screen
//now update the screen to show what we've done
extra += VSIw->x - sx;
if (insert)
if (insert) {
RSinsstring(VSIwn, VSIw->x - extra, VSIw->y,VSIw->attrib, extra, start);
else
{
} 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 (RSisInFront(VSIwn)) //CCP if we are front window, validate the screen
// RSvalidateRect(VSIwn);
VScapture((unsigned char *) start, extra);
} /* while */