home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-04-18 | 35.5 KB | 131 lines | [TEXT/CWIE] |
- /*
- *
- * Virtual Screen Kernel Internal Routines
- * (vsintern.c)
- * National Center for Supercomputing Applications
- *
- * by Gaige B. Paulsen
- *
- * This file contains the private internal calls for the NCSA
- * Virtual Screen Kernel.
- *
- * Version Date Notes
- * ------- ------ ---------------------------------------------------
- * 0.01 861102 Initial coding -GBP
- * 0.50 861113 First compiled edition -GBP
- * 0.70 861114 Internal operation confirmed -GBP
- * 2.1 871130 NCSA Telnet 2.1 -GBP
- * 2.2 880715 NCSA Telnet 2.2 -GBP
- */
-
- #ifdef MPW
- #pragma segment VS
- #endif
-
-
- #include "vsdata.h"
- #include "vskeys.h"
- #include "vsinterf.proto.h"
- #include "rsmac.proto.h"
- #include "rsinterf.proto.h"
- #include "maclook.proto.h"
- #include "wind.h"
-
- #define ScrollbackQuantum 100
-
- #define VSIclrattrib 0
-
- #include "vsintern.proto.h"
-
- extern short TempItemsVRefNum;
- extern long TempItemsDirID;
- extern WindRec *screens;
-
- short VSIclip
- (
- short *x1, /* starting column */
- short *y1, /* line on which to draw (assumed to lie within visible region) */
- short *x2, /* ending column (inclusive) (output if *n >= 0) */
- short *y2, /* ending line (inclusive) (output if *n >= 0) */
- short *n, /* length of text to draw (input and output) */
- short *offset /* length of initial part of text to skip (output) */
- )
- /* clips a text string to the visible region, given the starting
- line and column in screen coordinates at which it is to be drawn.
- If the length of the string is given, will also compute the ending
- line and column. On return, these coordinates will be normalized
- to the current visible region. Returns a nonzero function result
- iff the string is completely invisible. */
- {
- if (*n >= 0)
- {
- /* compute ending line and column (inclusive) */
- *x2 = *x1 + *n - 1;
- *y2 = *y1;
- }
- /* else take these as given */
-
- if ((*x1 > VSIw->Rright) || (*y2 < VSIw->Rtop))
- return (-1); /* nothing to draw */
-
- if (*x2 > VSIw->Rright)
- *x2 = VSIw->Rright;
- if (*y2 > VSIw->Rbottom)
- *y2 = VSIw->Rbottom;
- /* normal of characters
- at the current cursor position. The text has already been
- inserted into the screen buffer. Also, the cursor position has
- already been updated, so the part needing redrawing begins at column
- (VSIw->x - len). */
- {
- RSinsstring(VSIwn, VSIw->x - len, VSIw->y,
- VSIw->attrib, len, start);
- } /* VSIinsstring */
-
- void VSIsave
- (
- void
- )
- /* saves the current cursor position and attribute settings. */
- {
- VSIw->Px = VSIw->x;
- VSIw->Py = VSIw->y;
- VSIw->Pattrib = VSIw->attrib;
- } /* VSIsave */
-
- void VSIrestore
- (
- void
- )
- /* restores the last-saved cursor position and attribute settings. */
- {
- if (VSIw->Pattrib < 0)
- /* no previous save */
- return;
-
- VSIw->x = VSIw->Px;
- VSIw->y = VSIw->Py;
- VSIrange();
- VSIw->attrib = VSinattr(VSIw->Pattrib); /* hmm, this will clear the graphics character set selection */
- } /* VSIrestore */
-
- void VSIdraw
- (
- short VSIwn, /* window number */
- short x, /* starting column */
- short y, /* line on which to draw */
- short a, /* text attributes */
- short len, /* length of text to draw */
- char *c /* pointer to text */
- )
- /* displays a piece of text (assumed to fit on a single line) on a
- screen, using the specified attributes, and clipping to the
- current visible region. Highlights any part of the text lying
- within the current selection. */
- {
- short x2, y2, offset;
-
- if (!VSIclip(&x, &y, &x2, &y2, &len, &offset))
- RSdraw(VSIwn, x, y, a, len, (char *) (c + offset)); /* BYU LSC */
- } /* VSIdraw */
-