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

  1. /*
  2.     ptdchar.c    7/11/88
  3.  
  4.     % Character oriented window painting code for use by border windows.
  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.      7/27/88 jmd    Converted DrawLine to take an opbox
  14.      8/22/88 jmd    Fixed HZ line bug in DrawLine
  15.      9/08/89 gam    Added minimum check in call to ptd_PlotTextBuf
  16. */
  17.  
  18. #include "oakhead.h"
  19. #include "disppriv.h"
  20. /* -------------------------------------------------------------------------- */
  21.  
  22. void ptd_DrawString(ptd, row, col, string, attr, slen)
  23.     ptd_struct *ptd;
  24.     int row;
  25.     int col;
  26.     char *string;
  27.     byte attr;
  28.     int slen;
  29. {
  30. /*
  31.     Draws string into window ptd->win, clipped into box ptd->relboxp,
  32.     at row, col. Pads string w/ blanks out to slen, or clips it at slen.
  33. */
  34.     ofont_type font;
  35.     opcoord x, y;
  36.     int len;
  37.  
  38.     font = win_GetFont(ptd->win);
  39.  
  40.     x = col * ofont_GetWidth(font);
  41.     y = (row+1) * ofont_GetHeight(font);
  42.  
  43.     len = strlen(string);
  44.     ptd_PlotTextbuf(ptd, x, y, string, attr, omin(len, slen));
  45.  
  46.     if (slen > len) {
  47.         x += len * ofont_GetWidth(font);
  48.         ptd_PlotChar(ptd, x, y, ' ', attr, slen - len);
  49.     }
  50. }
  51. /* -------------------------------------------------------------------------- */
  52.  
  53.