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 */ /* wdefpatch.c */
extern void drawicon (short id, Rect *dest); extern void drawicon (short id, Rect *dest);
#if GENERATINGPOWERPC
extern Boolean gHasSetWindowContentColor;
#endif
extern WindRec *screens; 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 */ RSregnconv /* find bounds of text area needing updating */
( (
wind->visRgn, updRgn,
&x1, &y1, &x2, &y2, &x1, &y1, &x2, &y2,
RScurrent->fheight, RScurrent->fwidth RScurrent->fheight, RScurrent->fwidth
); );
if (x2 > x1) if (x2 > x1)
{ {
VSredraw(w, x1, y1, x2, y2); /* draw that text */ VSredraw(RSfindvwind(wind), x1, y1, x2, y2); /* draw that text */
/* We must reset, less we risk looking UGLY as sin... */ // We must reset, less we risk looking UGLY as sin...
BackPat(PATTERN(qd.white)); BackPat(PATTERN(qd.white));
PenPat(PATTERN(qd.black)); PenPat(PATTERN(qd.black));
if (TelInfo->haveColorQuickDraw) if (TelInfo->haveColorQuickDraw)
{ {
PmForeColor(0); PmForeColor(0);
@ -312,20 +310,38 @@ short RSupdate
ForeColor(RScolors[7]); /* normal foreground */ ForeColor(RScolors[7]); /* normal foreground */
BackColor(RScolors[0]); /* normal Background */ BackColor(RScolors[0]); /* normal Background */
} }
} /* if */ }
//now get that annoying strip on the right (CCP)
RSa = -1; RSa = -1;
PenMode(patOr);
DrawGrowIcon(wind);
PenMode(patCopy);
//DrawControls(wind);
} }
UpdateControls(wind, wind->visRgn); return(0);
RSdrawlocker(w, wind->visRgn); }
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); EndUpdate(wind);
return(0); return(0);
} /* RSupdate */ } /* RSupdate */
short RSTextSelected(short w) { /* BYU 2.4.11 */ short RSTextSelected(short w) { /* BYU 2.4.11 */
return(RSlocal[w].selected); /* BYU 2.4.11 */ return(RSlocal[w].selected); /* BYU 2.4.11 */
} /* BYU 2.4.11 */ } /* BYU 2.4.11 */
@ -342,11 +358,11 @@ void RSskip
} /* RSskip */ } /* RSskip */
/* /*
* This routine is called when the user presses the grow icon, or when the size of * 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). * the window needs to be adjusted (where==NULL, modifiers==0).
* It limits the size of the window to a legal range. * It limits the size of the window to a legal range.
*/ */
short RSsize (GrafPtr window, long *where, long modifiers) short RSsize (GrafPtr window, long *where, long modifiers)
{ {
@ -463,7 +479,6 @@ short RSsize (GrafPtr window, long *where, long modifiers)
return(-2); return(-2);
break; break;
default: //Ok, we can resize; tell host default: //Ok, we can resize; tell host
/* NONO */
cwidth = x2 - x1 + 1; cwidth = x2 - x1 + 1;
if ( cwidth > 255 ) { if ( cwidth > 255 ) {
cwidth = 255; cwidth = 255;
@ -478,18 +493,6 @@ short RSsize (GrafPtr window, long *where, long modifiers)
ssh_glue_wresize(&screens[screenIndex]); 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); return (0);
break; break;
} }
@ -522,7 +525,12 @@ Boolean RSsetcolor
{ {
if ( !(TelInfo->haveColorQuickDraw) || (RSsetwind(w) < 0) || (n > 15) || (n < 0)) if ( !(TelInfo->haveColorQuickDraw) || (RSsetwind(w) < 0) || (n > 15) || (n < 0))
return(FALSE); return(FALSE);
#if GENERATINGPOWERPC
if ( n == 1 && gHasSetWindowContentColor ) {
SetWindowContentColor(RScurrent->window, &Color);
}
#endif
SetEntryColor(RScurrent->pal, n, &Color); SetEntryColor(RScurrent->pal, n, &Color);
SetPort(RScurrent->window); SetPort(RScurrent->window);
InvalRect(&RScurrent->window->portRect); InvalRect(&RScurrent->window->portRect);
@ -629,17 +637,15 @@ short RSnewwindow
if (RScurrent->window == NULL) { if (RScurrent->window == NULL) {
VSdestroy(w); VSdestroy(w);
return(-2); return(-2);
}
} }
else } else {
{
RGBColor scratchRGB; RGBColor scratchRGB;
RScurrent->window = NewCWindow(0L, wDims, name, showit, (short)8,kInFront, goaway, (long)w); RScurrent->window = NewCWindow(0L, wDims, name, showit, (short)8,kInFront, goaway, (long)w);
if (RScurrent->window == NULL) { if (RScurrent->window == NULL) {
VSdestroy(w); VSdestroy(w);
return(-2); return(-2);
} }
//note: the ANSI colors are in the top 8 of the palette. The four telnet colors (settable //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 //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 //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) if (RSsetwind(screens[screenIndex].vs) >= 0)
{ {
int i; int i;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++) {
{
RGBColor tempColor; RGBColor tempColor;
GetEntryColor(TelInfo->AnsiColors, i, &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 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 RSselect(short w, Point pt, EventRecord theEvent);
void RSzoom(GrafPtr window, short code, short shifted); void RSzoom(GrafPtr window, short code, short shifted);
void RSdrawlocker(short w, RgnHandle visRgn); void RSdrawlocker(short w, RgnHandle visRgn);
short RSupdatecontent(GrafPtr wind, RgnHandle updRgn);
short RSupdate(GrafPtr wind); short RSupdate(GrafPtr wind);
short RSTextSelected(short w); short RSTextSelected(short w);
void RSskip(short w, Boolean on); void RSskip(short w, Boolean on);

View File

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

View File

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

View File

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

View File

@ -455,17 +455,14 @@ void VSem
} //we've got a line full of text in the virtual screen } //we've got a line full of text in the virtual screen
//now update the screen to show what we've done //now update the screen to show what we've done
extra += VSIw->x - sx; extra += VSIw->x - sx;
if (insert) if (insert) {
RSinsstring(VSIwn, VSIw->x - extra, VSIw->y,VSIw->attrib, extra, start); RSinsstring(VSIwn, VSIw->x - extra, VSIw->y,VSIw->attrib, extra, start);
else } else {
{
short x2,y2,offset, sxCopy=sx,yCopy = VSIw->y, extraCopy = extra; short x2,y2,offset, sxCopy=sx,yCopy = VSIw->y, extraCopy = extra;
if (!VSIclip(&sxCopy, &yCopy, &x2, &y2, &extraCopy, &offset)) if (!VSIclip(&sxCopy, &yCopy, &x2, &y2, &extraCopy, &offset))
RSdraw(VSIwn, sxCopy,yCopy, VSIw->attrib,extraCopy,(char *) (start + 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); VScapture((unsigned char *) start, extra);
} /* while */ } /* while */