home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 8 / Eagles_Nest_Mac_Collection_Disc_8.TOAST / Developer Tools⁄Additions / MacUserProj / MacUser Projects / June / 2GenApp Src / Display.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-04-25  |  2.0 KB  |  69 lines  |  [TEXT/KAHL]

  1. /* *****************************************************************************
  2.     FILE:             Display.c
  3.     
  4.     DESCRIPTION:     Drawing functions
  5.  
  6.     AUTHOR:            Kurt W.G. Matthies
  7.         
  8.     Copyright © 1990 by Code of the West, Inc. All Rights Reserved.
  9.     
  10.     Revision History:
  11.     ==========================================================
  12.     4.26.90    -    June 1990 MacUser Release (modified for multiple windows)
  13.     3.30.90 -    May 1990 MacUser Release
  14.     ==========================================================
  15.  
  16.    ***************************************************************************** */
  17. #include "AppGlobals.h"
  18.  
  19. #include "WindowUtilPr.h"
  20. #include "DisplayPr.h"
  21.  
  22. /*---------------------------------------------------------------------------------
  23.     drawDocContents -    draw the contents of theDoc - you can put your own drawing 
  24.     4.24.90kwgm            routine in here
  25. ----------------------------------------------------------------------------------*/
  26. void 
  27. drawDocContents (theDoc)
  28.     DocPtr             theDoc;
  29. {
  30.     register short    len, portWidth, strWidth, height, lineHeight, portHeight;
  31.     FontInfo        fInfo;
  32.     Rect            frameRect;
  33.     Str255            aStr;
  34.     
  35.     setFrameClip (theDoc, &frameRect);        /* set clip to frame area */
  36.     
  37.     GetFontInfo (&fInfo);            /* get font information */
  38.     GetWTitle (theDoc, aStr);        /* get window title */
  39.     
  40.     len = height = 0;
  41.     lineHeight = fInfo.ascent + fInfo.descent + fInfo.leading;    /* from font info */
  42.     
  43.     /* get the size of the drawing area */
  44.     portWidth = frameRect.right - frameRect.left;
  45.     portHeight = frameRect.bottom - frameRect.top;
  46.     
  47.     strWidth = StringWidth (aStr);        /* get string width in pixels */
  48.  
  49.     MoveTo (0, lineHeight);
  50.     while (height < portHeight)        /* fill drawing are with string */
  51.     {        
  52.         while (len < portWidth)
  53.         {
  54.             DrawString (aStr);
  55.             len += strWidth;
  56.         }
  57.         
  58.         len = 0;
  59.         height += lineHeight;        
  60.  
  61.         MoveTo (0, height);
  62.     }
  63.  
  64. } /* drawDocContents */
  65.  
  66. /* ===============================  EOF  =======================================
  67.     Copyright © 1990 by Code of the West, Inc. All Rights Reserved.
  68. ================================================================================ */
  69.