home *** CD-ROM | disk | FTP | other *** search
/ Fish 'n' More 2 / fishmore-publicdomainlibraryvol.ii1991xetec.iso / dirs / stv_427.lzh / STV / source / main.h < prev    next >
C/C++ Source or Header  |  1991-01-09  |  4KB  |  122 lines

  1. /*********************************
  2. *  MAIN.H  01/02/91
  3. *  Header file for STV
  4. *  © Copyright 1990 Timm Martin
  5. *  All Rights Reserved Worldwide
  6. **********************************/
  7.  
  8. #ifndef STV_MAIN_H
  9. #define STV_MAIN_H
  10.  
  11. #ifndef EXEC_TYPES_H
  12. #include <exec/types.h>
  13. #endif
  14. #ifndef GRAPHICS_TEXT_H
  15. #include <graphics/text.h>
  16. #endif
  17. #ifndef INTUITION_INTUITION_H
  18. #include <intuition/intuition.h>
  19. #endif
  20. #ifndef INTUITION_SCREENS_H
  21. #include <intuition/screens.h>
  22. #endif
  23. #ifndef WORKBENCH_STARTUP_H
  24. #include <workbench/startup.h>
  25. #endif
  26.  
  27. /*--- Argument Structure ---*/
  28. struct Argument
  29. {
  30.   short           Files;      /* number of files to read */
  31.   char **         Names;      /* names of those files */
  32.   struct WBArg *  ArgList;    /* argument list if run from WB */
  33.   short           Left;       /* window left edge */
  34.   short           Top;        /* window top edge */
  35.   short           Width;      /* window width */
  36.   short           Height;     /* window height */
  37.   short           TextColor;  /* FrontPen color of display text */
  38.   struct Screen * Screen;     /* custom screen pointer */
  39. };
  40.  
  41. /* means no argument was specified */
  42. #define NO_ARGUMENT -1
  43.  
  44. /*--- Colors ---*/
  45. #define BLUE  0L
  46. #define WHITE 1L
  47. #define BLACK 2L
  48. #define RED   3L
  49.  
  50. /*--- FileBuffer Structure ---*/
  51. struct FileBuffer
  52. {
  53.   char *  Name;       /* full name of this file (including path) */
  54.   char *  Partial;    /* just the name of the file itself */
  55.   char *  Buffer;     /* buffer holding file in RAM */
  56.   char ** Table;      /* table of line pointers */
  57.   long    BufferSize; /* buffer size in bytes */
  58.   long    FileSize;   /* file size in bytes */
  59.   long    TableSize;  /* table size in bytes */
  60.   long    Lines;      /* number of lines in file */
  61. };
  62.  
  63. /*--- File Selection ---*/
  64. typedef short SELECT;
  65.  
  66. /* corresponding gadget should be disabled */  #define SELECT_NONE -2
  67. /* want to read previous file              */  #define SELECT_PREV -1
  68. /* want to end program                     */  #define SELECT_STOP  0
  69. /* want to read next file                  */  #define SELECT_NEXT  1
  70. /* want some file, but not sure which      */  #define SELECT_SOME  2
  71.  
  72. /*--- Intuition ---*/
  73. #define MENUNUMBER(m,i,s) ((long)(m|(i<<5)|(s<<11)))
  74. #define WAIT_FOR_INPUT    Wait( 1L<<win->UserPort->mp_SigBit );
  75. #define WINDOW_INPUT      (imessage=(struct IntuiMessage *)GetMsg(win->UserPort))
  76.  
  77. /*--- Pointer ---*/
  78. #define   SET_POINTER SetPointer(win,pointer,25L,16L,-7L,-11L)
  79. #define CLEAR_POINTER ClearPointer(win)
  80.  
  81. /*--- Statistics Structure ---*/
  82. struct Statistics
  83. {
  84.   long Top;               /* array element # of top line in display */
  85.   long PrevTop;           /* previous top element # */
  86.   short Rows;             /* number of visible rows in window */
  87.   short Cols;             /* number of visible columns in window */
  88.   short LeftEdge;         /* left edge of first column */
  89.   short RightEdge;        /* right edge of last column */
  90.   short TopEdge;          /* top edge of first row */
  91.   short BottomEdge;       /* bottom edge of last row */
  92.   short VCenter;          /* vertical center of scrolling window */
  93.   struct TextFont *Font;  /* font used for rendering */
  94.   short TextWidth;        /* width of each character */
  95.   short TextHeight;       /* height of each character */
  96.   short Baseline;         /* text baseline */
  97.   long VPropPot;          /* prop pot value */
  98.   long VPropBody;         /* prop body value */
  99.   BOOL Scrolling;         /* if user is scrolling display with mouse */
  100.   BOOL Propping;          /* if user is scrolling display with prop gadget */
  101. };
  102. #define SCROLLING stats.Scrolling
  103. #define PROPPING  stats.Propping
  104.  
  105. /*--- Values ---*/
  106. #define YES 1
  107. #define NO 0
  108. #define REG register
  109. #define LATER NULL
  110.  
  111. /*--- Global Variables ---*/
  112. /* main.c    */  extern struct Argument   arguments;
  113. /* file.c    */  extern struct FileBuffer current_file;
  114. /* pointer.c */  extern USHORT *          pointer;
  115. /* window.c  */  extern struct RastPort * rp;
  116. /* display.c */  extern struct Statistics stats;
  117. /* window.c  */  extern struct TextAttr   text_attr;
  118. /* main.c    */  extern BOOL              wb2;
  119. /* window.c  */  extern struct Window *   win;
  120.  
  121. #endif
  122.