home *** CD-ROM | disk | FTP | other *** search
/ Chip: Special Computer Graphics & Animation / Chip-Special-Computergrafik.bin / programs / povray / povsrc.sea / POVSRC / SOURCE / Printf2Window.h < prev    next >
Text File  |  1994-02-04  |  5KB  |  160 lines

  1. /*
  2. ==============================================================================
  3. Project:    POV-Ray
  4.  
  5. Version:    2.2
  6.  
  7. File Name:    Printf2Window.h
  8.  
  9. Description:
  10.     General-purpose printf-capturing routines that allow a console-like
  11.     output window for c programs that otherwise prefer to use printf/fprintf.
  12.     This code was "inspired heavily" from sources such as MacDTS'es TESample,
  13.     MacApp's Transcript window, and previous code of mine.  It is fairly well
  14.     self-contained, and works in MPW C 3.2 and Think C 5.0.
  15.  
  16.     This file contains global definitions used by the p2w routines.
  17.     It is expected to be included only by source files that are
  18.     Macintosh-toolbox-aware.
  19.  
  20. Related Files:
  21.     Stdio_p2w.h        - generic header for sources that would otherwise use <stdio.h>
  22.     Printf2Window.h    - Mac-specific header for p2w routines
  23.     Printf2Window.c    - the main source for the p2w routines
  24. ------------------------------------------------------------------------------
  25. Author:
  26.     Eduard [esp] Schwan
  27. ------------------------------------------------------------------------------
  28.     from Persistence of Vision Raytracer
  29.     Copyright 1993 Persistence of Vision Team
  30. ------------------------------------------------------------------------------
  31.     NOTICE: This source code file is provided so that users may experiment
  32.     with enhancements to POV-Ray and to port the software to platforms other 
  33.     than those supported by the POV-Ray Team.  There are strict rules under
  34.     which you are permitted to use this file.  The rules are in the file
  35.     named POVLEGAL.DOC which should be distributed with this file. If 
  36.     POVLEGAL.DOC is not available or for more info please contact the POV-Ray
  37.     Team Coordinator by leaving a message in CompuServe's Graphics Developer's
  38.     Forum.  The latest version of POV-Ray may be found there as well.
  39.  
  40.     This program is based on the popular DKB raytracer version 2.12.
  41.     DKBTrace was originally written by David K. Buck.
  42.     DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
  43. ------------------------------------------------------------------------------
  44. More Info:
  45.     This Macintosh version of POV-Ray was created and compiled by Jim Nitchals
  46.     (Think 5.0) and Eduard Schwan (MPW 3.2), based (loosely) on the original
  47.     port by Thomas Okken and David Lichtman, with some help from Glenn Sugden.
  48.  
  49.     For bug reports regarding the Macintosh version, you should contact:
  50.     Eduard [esp] Schwan
  51.         CompuServe: 71513,2161
  52.         Internet: jl.tech@applelink.apple.com
  53.         AppleLink: jl.tech
  54.     Jim Nitchals
  55.         Compuserve: 73117,3020
  56.         America Online: JIMN8
  57.         Internet: jimn8@aol.com -or- jimn8@applelink.apple.com
  58.         AppleLink: JIMN8
  59. ------------------------------------------------------------------------------
  60. Change History:
  61.     920318    [esp]    Created.
  62.     920325    [esp]    Added prototypes for Std C routines
  63.     920330    [esp]    Updated file header with copyright & related files info
  64.     920401    [esp]    Added p2wSignature to window record for safety checking
  65.     920529    [esp]    Changed type defs to have trailing _t for ANSI consistency
  66.     920621    [esp]    Changed file header definition to _PRINTF2WINDOW_H_ for ANSI consistency
  67.     920816    [esp]    Added p2w_SelectAll routine
  68.     920912    [esp]    Added windID parm to NewWindow call
  69.     931001    [esp]    version 2.0 finished (Released on 10/4/93)
  70. ==============================================================================
  71. */
  72.  
  73. #if !defined(PRINTF2WINDOW_H)
  74. #define PRINTF2WINDOW_H
  75.  
  76.  
  77. // include our minimal stuff
  78.  
  79. #include "stdio_p2w.h"
  80.  
  81. #include <types.h>        // Boolean
  82. #include <windows.h>    // WindowRecord
  83. #include <textedit.h>    // TEHandle
  84.  
  85.  
  86. // ==== Extended p2w window record
  87.  
  88. typedef struct
  89.     {
  90.     WindowRecord    p2wWindowRec;        // our window/grafport record
  91.     OSType            p2wSignature;        // Magic value that identifies this as a true p2w window
  92.     Boolean            p2wOpenedOK;        // true if p2wWindowRec is valid, for p2w_DisposeWindow
  93.     TEHandle        p2wTEHandle;        // the TE record we use
  94.     ControlHandle    p2wVScroller;        // the vertical scrollbar in the window
  95.     ControlHandle    p2wHScroller;        // the horizontal scrollbar in the window
  96.     ProcPtr            p2wClickHandler;    // the autoscroll routine (not yet)
  97.     short            p2wMaxDocWidth;        // TE record's max wrap width
  98.     Boolean            p2wAlwaysScrollToBottom;    // true means always stay scrolled to bottom of TE
  99.     }
  100.     p2w_WindowRecord_t,
  101.     *p2w_WindowPtr_t,
  102.     **p2w_WindowHandle_t;
  103.  
  104.  
  105.  
  106. // ==== Public p2w library routines
  107.  
  108. OSErr p2w_Init(void);
  109.  
  110. OSErr p2w_Terminate(void);
  111.  
  112. p2w_WindowPtr_t p2w_NewWindow
  113.                     (const    short                windID,
  114.                     const    Rect                *windBounds,
  115.                     const    Str255                windTitle,
  116.                     const    Boolean                windIsVisible,
  117.                     const    int                    windFont,
  118.                     const    short                windFontSize,
  119.                             OSErr                *anError);
  120.  
  121. void p2w_DisposeWindow
  122.                     (        p2w_WindowPtr_t        the_p2wPtr);
  123.  
  124. void p2w_SetTextFont
  125.                     (        p2w_WindowPtr_t        the_p2wPtr,
  126.                             short                newFontType,
  127.                             short                newFontSize);
  128.  
  129. OSErr p2w_AddCString
  130.                     (        p2w_WindowPtr_t        the_p2wPtr,
  131.                     const    char                *theCStrPtr);
  132.  
  133. void p2w_DrawWindow
  134.                     (const    p2w_WindowPtr_t        the_p2wPtr);
  135.  
  136. void p2w_DoUpdate
  137.                     (const    p2w_WindowPtr_t        thep2wWindow);
  138.  
  139. void p2w_DoActivate
  140.                     (const    p2w_WindowPtr_t        thep2wWindow,
  141.                             Boolean                becomingActive);
  142.  
  143. void p2w_DoGrow
  144.                     (const    p2w_WindowPtr_t        thep2wWindow,
  145.                             EventRecord            *theEvent);
  146.  
  147. void p2w_DoZoom
  148.                     (const    p2w_WindowPtr_t        thep2wWindow,
  149.                             short                thePart);
  150.  
  151. void p2w_SelectAll
  152.                     (const    p2w_WindowPtr_t        thep2wWindow);
  153.  
  154. void p2w_DoContentClick
  155.                     (const    p2w_WindowPtr_t        thep2wWindow,
  156.                             EventRecord            *theEvent);
  157.  
  158.  
  159. #endif // PRINTF2WINDOW_H
  160.