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

  1. /*
  2.     bcwin.c    4/22/89
  3.  
  4.     % Blank char window object
  5.     used for unsaved default window etc.
  6.     By Ted.
  7.  
  8.     OWL 1.1
  9.     Copyright (c) 1989 by Oakland Group, Inc.
  10.     ALL RIGHTS RESERVED.
  11.  
  12.     Revision History:
  13.     -----------------
  14. */
  15.  
  16. #include "oakhead.h"
  17. #include "disppriv.h"
  18. #include "cmwinod.h"
  19. #include "cmwinobj.h"
  20.  
  21. OSTATIC void OWLPRIV bcwin_PlotBox(_arg2(ptd_struct *, bcwin_od *));
  22. /* -------------------------------------------------------------------------- */
  23.  
  24. int bcwin_Class(objdata, msg, indata, outdata)
  25.     VOID *objdata;            /* object instance data pointer */
  26.     int msg;                /* message */
  27.     VOID *indata;            /* message input data */
  28.     VOID *outdata;            /* message output data */
  29. /* 
  30.     Blank char window object dispatch function
  31. */
  32. {
  33.     bcwin_od    *bcwd;
  34.     win_type    win;
  35.     ptd_struct    *ptd;
  36.     ptd_struct  inptd;        /* for use in inner-coordinate computations */
  37.     opbox         inbox;        /* ditto; gets hooked in by ptd_SetInner */
  38.     int            rval;
  39.  
  40.     bcwd = (bcwin_od *) objdata;
  41.  
  42.     switch(msg) {
  43.     case OBJM_GETDATASIZE:
  44.         ((ogds_struct *) outdata)->odsize = sizeof(bcwin_od);
  45.         ((ogds_struct *) outdata)->xdsize = sizeof(bcwin_xd);
  46.         ((ogds_struct *) outdata)->id = ID_BCWIN;
  47.         break;
  48.  
  49.     case OBJM_OPEN:
  50.         win = bcwinod_GetSelf(bcwd);
  51.  
  52.         /* Initialize the char to be repeatedly painted in this window. */
  53.         bcwin_SetChar(win, ' ');
  54.  
  55.         /* Send OPEN msg to win superclass */
  56.         rval = win_DoRaw(&(bcwd->wd), msg, indata, outdata);
  57.  
  58.         /* Override default: allow any pix size for pmwin's */
  59.         win_SetCharSize(win, FALSE);
  60.  
  61.         return(rval);
  62.  
  63.     case OBJM_WHO:
  64.         /* Identify ourselves */
  65.         if (*((int *) indata) == ID_BCWIN) {
  66.             return(TRUE);
  67.         }
  68.         return(win_DoRaw(&(bcwd->wd), msg, indata, outdata));
  69.  
  70.     case WINM_SCROLL:
  71.         break;                /* don't bother scrolling- it's blank anyway */
  72.  
  73.     case WINM_PAINT:
  74.         ptd = (ptd_struct *)indata;
  75.         if (ptd_SetInner(ptd, &inptd, &inbox)) {
  76.             bcwin_PlotBox(&inptd, bcwd);
  77.         }
  78.         /* No break; send msg to win superclass */
  79.     default:
  80.         return(win_DoRaw(&(bcwd->wd), msg, indata, outdata));
  81.     }
  82.     return(TRUE);
  83. }
  84. /* -------------------------------------------------------------------------- */
  85.  
  86. static void OWLPRIV bcwin_PlotBox(ptd, bcwd)
  87.     ptd_struct *ptd;
  88.     bcwin_od *bcwd;
  89. /*
  90.     Plots a region of a cmap window to the display.
  91. */
  92. {
  93.     win_type win;
  94.     char bchar;
  95.     byte attr;
  96.     ocbox relcbox;
  97.     opcoord xpix, ypix;
  98.     int row, cwidth;
  99.     ofont_type font;
  100.     odim fheight;
  101.  
  102.     win = bcwinod_GetSelf(bcwd);
  103.     bchar = bcwin_GetChar(win);
  104.     attr = win_GetAttr(win);
  105.  
  106.     font = win_GetFont(ptd->win);
  107.  
  108.     opbox_charcoords(ptd->relboxp, font, &relcbox);
  109.  
  110.     xpix = (relcbox.leftcol) * ofont_GetWidth(font);
  111.     fheight = ofont_GetHeight(font);
  112.     ypix = (relcbox.toprow + 1) * fheight;
  113.     cwidth = ocbox_GetWidth(&relcbox);
  114.  
  115.     for (row = ocbox_GetHeight(&relcbox); row > 0; row--, ypix += fheight) {
  116.         ptd_PlotChar(ptd, xpix, ypix, bchar, attr, cwidth);
  117.     }
  118. }
  119. /* -------------------------------------------------------------------------- */
  120.  
  121.