home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name wnputbor -- Display a border surrounding a rectangular
- * region.
- *
- * Synopsis result = wnputbor(pdim,pborder,pwhere);
- *
- * int result 0 if the border is actually written,
- * 1 if not.
- * DIM *pdim Pointer to DIM structure denoting
- * dimensions of rectangle to surround.
- * WHERE *pwhere Pointer to WHERE structure denoting
- * display device, page, and location of
- * upper left corner of rectangular region.
- * BORDER *pbord Pointer to BORDER structure denoting
- * type of border to put around rectangle.
- *
- * Description This function tries to display a border around a
- * rectangular region on a given video device and display
- * page.
- *
- * The device and display page are made current (selected
- * for I/O).
- *
- * If the display device or page or the dimensions of the
- * rectangle are illegal, no border is actually displayed
- * and 1 is returned as the value of the function.
- *
- * Results result 0 if the border is actually written,
- * 1 if not.
- * b_device Current display device.
- * b_curpage Current display page.
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1986
- *
- **/
-
- #include <bwindow.h>
-
- int wnputbor(pdim,pborder,pwhere)
- DIM *pdim;
- BORDER *pborder;
- WHERE *pwhere;
- {
- int old_npage;
- int bottom_row,right_column;
- int mode,columns,act_page;
-
- if (wnseldev(pwhere,pdim,&old_npage))
- return 1;
-
- bottom_row = pwhere->corner.row + pdim->h;
- right_column = pwhere->corner.col + pdim->w;
-
- if (pborder->type == 0
- || pwhere->corner.row <= 0
- || pwhere->corner.col <= 0
- || bottom_row >= scrows()
- || (scmode(&mode,&columns,&act_page),
- (right_column >= columns)))
- return 1; /* No border actually written. */
-
- return scbox(pwhere->corner.row - 1,
- pwhere->corner.col - 1,
- bottom_row,
- right_column,
- ((pborder->type == -1) ? -1 : pborder->type - 1),
- pborder->ch,
- pborder->attr);
- }