home *** CD-ROM | disk | FTP | other *** search
- /*
- ptdframe.c 9/15/88
-
- % Map type window border clearing function.
- By Ted.
-
- OWL 1.1
- Copyright (c) 1988, by Oakland Group, Inc.
- ALL RIGHTS RESERVED.
-
- Revision History:
- -----------------
- 12/07/88 ted Fixed off-by-one bug ( < vs. <= ).
- */
-
- #include "oakhead.h"
- #include "disppriv.h"
- /* -------------------------------------------------------------------------- */
-
- void ptd_ClearFrame(ptd, xoffs, yoffs, width, height, color)
- ptd_struct *ptd;
- opcoord xoffs;
- opcoord yoffs;
- odim width;
- odim height;
- opixval color;
- /*
- For when the window is bigger than whatever its contents are,
- this function blanks out the extra area.
- */
- {
- opbox tbox;
- opcoord xmaxoffs, ymaxoffs;
- ofont_type dfont;
-
- opbox_copy(&tbox, ptd->relboxp);
-
- xmaxoffs = xoffs + width;
- ymaxoffs = yoffs + height;
-
- /* Round win contents inwards to char coords if appropriate */
- if (!disp_TextFree()) {
- dfont = disp_GetDefFont();
- /* Round up instead of down */
- xoffs += ofont_GetWidth(dfont) - 1;
- yoffs += ofont_GetHeight(dfont) - 1;
- opcoord_GridRound(&xoffs, &yoffs, dfont);
- opcoord_GridRound(&xmaxoffs, &ymaxoffs, dfont);
- }
- /* top */
- if (ptd->relboxp->ymin < yoffs) {
- if (ptd->relboxp->ymax > yoffs) {
- ptd->relboxp->ymax = yoffs;
- }
- ptd_Clear(ptd, color);
- ptd->relboxp->ymax = tbox.ymax;
- }
- /* bottom */
- if (ptd->relboxp->ymax > ymaxoffs) {
- if (ptd->relboxp->ymin < ymaxoffs) {
- ptd->relboxp->ymin = ymaxoffs;
- }
- ptd_Clear(ptd, color);
- ptd->relboxp->ymin = tbox.ymin;
- }
- /* don't clear corner boxes twice - truncate side strips */
- if (ptd->relboxp->ymax <= yoffs ||
- ptd->relboxp->ymin >= ymaxoffs) {
- return;
- }
- if (ptd->relboxp->ymin < yoffs) {
- ptd->relboxp->ymin = yoffs;
- }
- if (ptd->relboxp->ymax > ymaxoffs) {
- ptd->relboxp->ymax = ymaxoffs;
- }
- /* left */
- if (ptd->relboxp->xmin < xoffs) {
- if (ptd->relboxp->xmax > xoffs) {
- ptd->relboxp->xmax = xoffs;
- }
- ptd_Clear(ptd, color);
- ptd->relboxp->xmax = tbox.xmax;
- }
- /* right */
- if (ptd->relboxp->xmax > xmaxoffs) {
- if (ptd->relboxp->xmin < xmaxoffs) {
- ptd->relboxp->xmin = xmaxoffs;
- }
- ptd_Clear(ptd, color);
- ptd->relboxp->xmin = tbox.xmin;
- }
- ptd->relboxp->ymin = tbox.ymin;
- ptd->relboxp->ymax = tbox.ymax;
- }
- /* -------------------------------------------------------------------------- */
-
-