home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / POV-Ray 3.0.2 / src / MacSource / Printf2Window.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-14  |  5.4 KB  |  158 lines  |  [TEXT/CWIE]

  1. /*
  2. ==============================================================================
  3. Project:    POV-Ray
  4.  
  5. Version:    3
  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(tm) Ray Tracer
  29.     Copyright 1996 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. Change History:
  45.     920318    [esp]    Created.
  46.     920325    [esp]    Added prototypes for Std C routines
  47.     920330    [esp]    Updated file header with copyright & related files info
  48.     920401    [esp]    Added p2wSignature to window record for safety checking
  49.     920529    [esp]    Changed type defs to have trailing _t for ANSI consistency
  50.     920621    [esp]    Changed file header definition to _PRINTF2WINDOW_H_ for ANSI consistency
  51.     920816    [esp]    Added p2w_SelectAll routine
  52.     920912    [esp]    Added windID parm to NewWindow call
  53.     931001    [esp]    version 2.0 finished (Released on 10/4/93)
  54. ==============================================================================
  55. */
  56.  
  57. #if !defined(PRINTF2WINDOW_H)
  58. #define PRINTF2WINDOW_H
  59.  
  60. // include our minimal stuff
  61.  
  62. #include "stdio_p2w.h"
  63.  
  64. #include <types.h>        // Boolean
  65. #include <windows.h>    // WindowRecord
  66. #include <textedit.h>    // TEHandle
  67.  
  68.  
  69. // ==== Extended p2w window record
  70.  
  71. typedef struct
  72.     {
  73.     WindowRecord    p2wWindowRec;        // our window/grafport record
  74.     OSType            p2wSignature;        // Magic value that identifies this as a true p2w window
  75.     Boolean            p2wOpenedOK;        // true if p2wWindowRec is valid, for p2w_DisposeWindow
  76.     TEHandle        p2wTEHandle;        // the TE record we use
  77.     ControlHandle    p2wVScroller;        // the vertical scrollbar in the window
  78.     ControlHandle    p2wHScroller;        // the horizontal scrollbar in the window
  79.     ProcPtr            p2wClickHandler;    // the autoscroll routine (not yet)
  80.     short            p2wMaxDocWidth;        // TE record's max wrap width
  81.     Boolean            p2wAlwaysScrollToBottom;    // true means always stay scrolled to bottom of TE
  82.     }
  83.     p2w_WindowRecord_t,
  84.     *p2w_WindowPtr_t,
  85.     **p2w_WindowHandle_t;
  86.  
  87.  
  88.  
  89. // ==== Public p2w library routines
  90.  
  91. OSErr p2w_Init(void);
  92.  
  93. OSErr p2w_Terminate(void);
  94.  
  95. p2w_WindowPtr_t p2w_NewWindow
  96.                     (const    short                windID,
  97.                     const    Rect                *windBounds,
  98.                     const    Str255                windTitle,
  99.                     const    Boolean                windIsVisible,
  100.                     const    int                    windFont,
  101.                     const    short                windFontSize,
  102.                             OSErr                *anError);
  103.  
  104. void p2w_DisposeWindow
  105.                     (        p2w_WindowPtr_t        the_p2wPtr);
  106.  
  107. void p2w_SetTextFont
  108.                     (        p2w_WindowPtr_t        the_p2wPtr,
  109.                             short                newFontType,
  110.                             short                newFontSize);
  111.  
  112. void p2w_AlwaysScrollToBottom(p2w_WindowPtr_t the_p2wPtr, Boolean alwaysScroll);
  113. Boolean p2w_AlwaysScrollToBottomState(p2w_WindowPtr_t the_p2wPtr);
  114.  
  115. void p2w_ScrollHome(p2w_WindowPtr_t            the_p2wPtr);
  116. void p2w_ScrollEnd(p2w_WindowPtr_t            the_p2wPtr);
  117. void p2w_ScrollPageUp(p2w_WindowPtr_t        the_p2wPtr);
  118. void p2w_ScrollPageDown(p2w_WindowPtr_t        the_p2wPtr);
  119. void p2w_ScrollLineUp(p2w_WindowPtr_t        the_p2wPtr);
  120. void p2w_ScrollLineDown(p2w_WindowPtr_t        the_p2wPtr);
  121. void p2w_ScrollLeft(p2w_WindowPtr_t            the_p2wPtr);
  122. void p2w_ScrollRight(p2w_WindowPtr_t        the_p2wPtr);
  123.  
  124. OSErr p2w_AddCString
  125.                     (        p2w_WindowPtr_t        the_p2wPtr,
  126.                     const    char                *theCStrPtr,
  127.                             short                size);
  128.  
  129. void p2w_DrawWindow
  130.                     (const    p2w_WindowPtr_t        the_p2wPtr);
  131.  
  132. void p2w_DoUpdate
  133.                     (const    p2w_WindowPtr_t        thep2wWindow);
  134.  
  135. void p2w_DoActivate
  136.                     (const    p2w_WindowPtr_t        thep2wWindow,
  137.                             Boolean                becomingActive);
  138.  
  139. void p2w_DoGrow
  140.                     (const    p2w_WindowPtr_t        thep2wWindow,
  141.                             EventRecord            *theEvent);
  142.  
  143. void p2w_DoZoom
  144.                     (const    p2w_WindowPtr_t        thep2wWindow,
  145.                             short                thePart);
  146.  
  147. void p2w_SelectAll
  148.                     (const    p2w_WindowPtr_t        thep2wWindow);
  149.  
  150. void p2w_DoContentClick
  151.                     (const    p2w_WindowPtr_t        thep2wWindow,
  152.                             EventRecord            *theEvent);
  153.  
  154. void p2w_DoKeyDown    (const    p2w_WindowPtr_t        the_p2wPtr,
  155.                             short                theKeyCode);
  156.  
  157. #endif // PRINTF2WINDOW_H
  158.