home *** CD-ROM | disk | FTP | other *** search
- /* ==( mip/wmisc.c )== */
- /* ----------------------------------------------- */
- /* Pro-C Copyright (C) 1988 - 1990 Vestronix Inc. */
- /* Modification to this source is not supported */
- /* by Vestronix Inc. */
- /* All Rights Reserved */
- /* ----------------------------------------------- */
- /* Written Geo 26-Aug-88 */
- /* Modified Geo 18-Jul-90 See comments below */
- /* ----------------------------------------------- */
- /* %W% (%H% %T%) */
-
- /*
- * Modifications
- *
- * 18-Jul-90 Geo - Overhauled
- * 25-Oct-89 Geo - 1.32 Merge
- *
- *
- */
-
- /*
- * Repeated display functions
- * setting, boxes
- */
-
- # include <stdio.h>
- # include <bench.h>
-
- extern char *sysbase; /* wbase.c */
-
- /*
- * Repeat character and attribute
- * len times within current window,
- * horizontally
- */
- void rephoriz_w(row, col, attr, len, ch)
- int row, col, attr, len, ch;
- {
- /* Still to reduce this code says Geo */
- if (len > 0)
- {
- poke_w(row, col++, attr, ch); /* redundant col++ for direct */
- while (--len)
- {
- # ifdef WDEBUG
- poke_w(row, col++, attr, ch);
- # else
- ADDPOKE(attr, ch);
- # endif
- }
- }
- }
-
- /*
- * Repeat character and attribute
- * len times within current window,
- * vertically
- */
- void repvert_w(row, col, attr, len, ch)
- register int row;
- int col, attr;
- register int len;
- int ch;
- {
- while (len--)
- poke_w(row++, col, attr, ch);
- }
-
- /*
- * Sets all characters and attributes
- * in the current window
- */
- void set_w(attr, ch)
- register int attr, ch;
- {
- fill_w(1, 1, attr, winptr->wabs.height, winptr->wabs.width2>>1, ch);
- }
-
- /*
- * Fills a region with a character
- * and attribute
- */
- void fill_w(row, col, attr, height, width, ch)
- register int row;
- int col, attr;
- register int height;
- int width, ch;
- {
- while (height--)
- rephoriz_w(row++, col, attr, width, ch);
- }
-
- /*
- * Writes a box border
- * around the current window
- * - does not alter global BOXSET
- */
- void border_w(bset, attr)
- int bset, attr;
- {
- int svboxset = boxset;
-
- /* Use this new boxset value */
- # ifdef MSDOS
- boxset = bset;
- # endif
-
- /* all the edges with box lines */
- box_w(1, 1, attr, winptr->wabs.height, winptr->wabs.width2/2);
-
- /* Restore boxset */
- boxset = svboxset;
- }
-
- /*
- * Box within a window with attribute
- */
- void box_w(row, col, attr, height, width)
- int row, col, attr, height, width;
- {
- int lcol = col + width - 1;
- int lrow = row + height - 1;
-
- /* Much as I hate doing this, it makes auto boxes easier - GEO */
- /* Cannot have border for 2x2 */
- if (winptr->wabs.height < 2 || winptr->wabs.width2 < 4)
- return;
-
- attr |= GRAPHIC;
-
- poke_w(row, col, attr , BULEFT(boxset));
- rephoriz_w(row, col+1, attr, width-2, BHORIZ(boxset));
- poke_w(row, lcol, attr , BURIGHT(boxset));
-
- poke_w(lrow, col, attr, BLLEFT(boxset));
- rephoriz_w(lrow, col+1, attr, width-2, BHORIZ(boxset));
- poke_w(lrow, lcol, attr , BLRIGHT(boxset));
-
- repvert_w(row+1,col, attr, height-2, BVERT(boxset));
- repvert_w(row+1,lcol, attr, height-2, BVERT(boxset));
- }
-
- /*
- * Horizontal box line with 2 end T pieces
- */
- void underln_w(row, col, attr, width)
- int row, col, attr, width;
- {
- attr |= GRAPHIC;
-
- poke_w(row, col, attr , BLEFTT(boxset));
- rephoriz_w(row, col+1, attr, width-2, BHORIZ(boxset));
- poke_w(row, col+width-1, attr , BRIGHTT(boxset));
- }
-
- /*
- * Vertical box line with 2 end T pieces
- */
- void upperln_w(row, col, attr, height)
- int row, col, attr, height;
- {
- attr |= GRAPHIC;
-
- poke_w(row, col, attr , BTOPT(boxset));
- repvert_w(row+1, col, attr, height-2, BVERT(boxset));
- poke_w(row+height-1, col, attr , BBOTTY(boxset));
- }
-
-