home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / PTDFRAME.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  2.3 KB  |  98 lines

  1. /*
  2.     ptdframe.c    9/15/88
  3.  
  4.     % Map type window border clearing function.
  5.     By Ted.
  6.  
  7.     OWL 1.1
  8.     Copyright (c) 1988, by Oakland Group, Inc.
  9.     ALL RIGHTS RESERVED.
  10.  
  11.     Revision History:
  12.     -----------------
  13.     12/07/88 ted    Fixed off-by-one bug ( < vs. <= ).
  14. */
  15.  
  16. #include "oakhead.h"
  17. #include "disppriv.h"
  18. /* -------------------------------------------------------------------------- */
  19.  
  20. void ptd_ClearFrame(ptd, xoffs, yoffs, width, height, color)
  21.     ptd_struct *ptd;
  22.     opcoord xoffs;
  23.     opcoord yoffs;
  24.     odim width;
  25.     odim height;
  26.     opixval color;
  27. /*
  28.     For when the window is bigger than whatever its contents are,
  29.     this function blanks out the extra area.
  30. */
  31. {
  32.     opbox tbox;
  33.     opcoord xmaxoffs, ymaxoffs;
  34.     ofont_type dfont;
  35.  
  36.     opbox_copy(&tbox, ptd->relboxp);
  37.  
  38.     xmaxoffs = xoffs + width;
  39.     ymaxoffs = yoffs + height;
  40.  
  41.     /* Round win contents inwards to char coords if appropriate */
  42.     if (!disp_TextFree()) {
  43.         dfont = disp_GetDefFont();
  44.         /* Round up instead of down */
  45.         xoffs += ofont_GetWidth(dfont) - 1;
  46.         yoffs += ofont_GetHeight(dfont) - 1;
  47.         opcoord_GridRound(&xoffs, &yoffs, dfont);
  48.         opcoord_GridRound(&xmaxoffs, &ymaxoffs, dfont);
  49.     }
  50. /* top */
  51.     if (ptd->relboxp->ymin < yoffs) {
  52.         if (ptd->relboxp->ymax > yoffs) {
  53.             ptd->relboxp->ymax = yoffs;
  54.         }
  55.         ptd_Clear(ptd, color);
  56.         ptd->relboxp->ymax = tbox.ymax;
  57.     }
  58. /* bottom */
  59.     if (ptd->relboxp->ymax > ymaxoffs) {
  60.         if (ptd->relboxp->ymin < ymaxoffs) {
  61.             ptd->relboxp->ymin = ymaxoffs;
  62.         }
  63.         ptd_Clear(ptd, color);
  64.         ptd->relboxp->ymin = tbox.ymin;
  65.     }
  66. /* don't clear corner boxes twice - truncate side strips */
  67.     if (ptd->relboxp->ymax <= yoffs ||
  68.         ptd->relboxp->ymin >= ymaxoffs) {
  69.         return;
  70.     }
  71.     if (ptd->relboxp->ymin < yoffs) {
  72.         ptd->relboxp->ymin = yoffs;
  73.     }
  74.     if (ptd->relboxp->ymax > ymaxoffs) {
  75.         ptd->relboxp->ymax = ymaxoffs;
  76.     }
  77. /* left */
  78.     if (ptd->relboxp->xmin < xoffs) {
  79.         if (ptd->relboxp->xmax > xoffs) {
  80.             ptd->relboxp->xmax = xoffs;
  81.         }
  82.         ptd_Clear(ptd, color);
  83.         ptd->relboxp->xmax = tbox.xmax;
  84.     }
  85. /* right */
  86.     if (ptd->relboxp->xmax > xmaxoffs) {
  87.         if (ptd->relboxp->xmin < xmaxoffs) {
  88.             ptd->relboxp->xmin = xmaxoffs;
  89.         }
  90.         ptd_Clear(ptd, color);
  91.         ptd->relboxp->xmin = tbox.xmin;
  92.     }
  93.     ptd->relboxp->ymin = tbox.ymin;
  94.     ptd->relboxp->ymax = tbox.ymax;
  95. }
  96. /* -------------------------------------------------------------------------- */
  97.  
  98.