home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / usr.bin / groff / libXdvi / DviP.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-30  |  3.7 KB  |  205 lines

  1. /*
  2.  * $XConsortium: DviP.h,v 1.5 89/07/22 19:44:08 keith Exp $
  3.  */
  4.  
  5. /* 
  6.  * DviP.h - Private definitions for Dvi widget
  7.  */
  8.  
  9. #ifndef _XtDviP_h
  10. #define _XtDviP_h
  11.  
  12. #include "Dvi.h"
  13. #include "DviChar.h"
  14.  
  15. /***********************************************************************
  16.  *
  17.  * Dvi Widget Private Data
  18.  *
  19.  ***********************************************************************/
  20.  
  21. /************************************
  22.  *
  23.  *  Class structure
  24.  *
  25.  ***********************************/
  26.  
  27. /*
  28.  * New fields for the Dvi widget class record
  29.  */
  30.  
  31. typedef struct _DviClass {
  32.     int        makes_compiler_happy;  /* not used */
  33. } DviClassPart;
  34.  
  35. /*
  36.  * Full class record declaration
  37.  */
  38.  
  39. typedef struct _DviClassRec {
  40.     CoreClassPart    core_class;
  41.     DviClassPart    command_class;
  42. } DviClassRec;
  43.  
  44. extern DviClassRec dviClassRec;
  45.  
  46. /***************************************
  47.  *
  48.  *  Instance (widget) structure 
  49.  *
  50.  **************************************/
  51.  
  52. /*
  53.  * a list of fonts we've used for this widget
  54.  */
  55.  
  56. typedef struct _dviFontSizeList {
  57.     struct _dviFontSizeList    *next;
  58.     int            size;
  59.     char            *x_name;
  60.     XFontStruct        *font;
  61.     int            doesnt_exist;
  62. } DviFontSizeList;
  63.  
  64. typedef struct _dviFontList {
  65.     struct _dviFontList    *next;
  66.     char            *dvi_name;
  67.     char            *x_name;
  68.     int            dvi_number;
  69.     DviFontSizeList        *sizes;
  70.     DviCharNameMap        *char_map;
  71. } DviFontList;
  72.  
  73. typedef struct _dviFontMap {
  74.     struct _dviFontMap    *next;
  75.     char            *dvi_name;
  76.     char            *x_name;
  77. } DviFontMap;
  78.  
  79. #define DVI_TEXT_CACHE_SIZE    256
  80. #define DVI_CHAR_CACHE_SIZE    1024
  81.  
  82. typedef struct _dviCharCache {
  83.     XTextItem    cache[DVI_TEXT_CACHE_SIZE];
  84.     char        char_cache[DVI_CHAR_CACHE_SIZE];
  85.     int        index;
  86.     int        max;
  87.     int        char_index;
  88.     int        font_size;
  89.     int        font_number;
  90.     XFontStruct    *font;
  91.     int        start_x, start_y;
  92.     int        x, y;
  93. } DviCharCache;
  94.  
  95. typedef struct _dviState {
  96.     struct _dviState    *next;
  97.     int            font_size;
  98.     int            font_number;
  99.     int            x;
  100.     int            y;
  101. } DviState;
  102.  
  103. typedef struct _dviFileMap {
  104.     struct _dviFileMap    *next;
  105.     long            position;
  106.     int            page_number;
  107. } DviFileMap;
  108.  
  109. /*
  110.  * New fields for the Dvi widget record
  111.  */
  112.  
  113. typedef struct {
  114.     /*
  115.      * resource specifiable items
  116.      */
  117.     char        *font_map_string;
  118.     unsigned long    foreground;
  119.     unsigned long    background;
  120.     int        requested_page;
  121.     int        last_page;
  122.     XFontStruct    *default_font;
  123.     FILE        *file;
  124.     Boolean        noPolyText;
  125.     Boolean        seek;        /* file is "seekable" */
  126.     /*
  127.       * private state
  128.       */
  129.     FILE        *tmpFile;    /* used when reading stdin */
  130.     char        readingTmp;    /* reading now from tmp */
  131.     char        ungot;        /* have ungetc'd a char */
  132.     GC        normal_GC;
  133.     GC        fill_GC;
  134.     DviFileMap    *file_map;
  135.     DviFontList    *fonts;
  136.     DviFontMap    *font_map;
  137.     int        current_page;
  138.     int        font_size;
  139.     int        font_number;
  140.     int        device_resolution;
  141.     int        line_thickness;
  142.     int        line_width;
  143.  
  144. #define DVI_FILL_MAX 1000
  145.  
  146.     int        fill;
  147. #define DVI_FILL_WHITE 0
  148. #define DVI_FILL_GRAY 1
  149. #define DVI_FILL_BLACK 2
  150.     int        fill_type;
  151.     Pixmap        gray;
  152.     int        backing_store;
  153.     XFontStruct    *font;
  154.     int        display_enable;
  155.     struct ExposedExtents {
  156.         int x1, y1, x2, y2;
  157.     }        extents;
  158.     DviState    *state;
  159.     DviCharCache    cache;
  160. } DviPart;
  161.  
  162. #define DviGetIn(dw,cp)\
  163.     (dw->dvi.tmpFile ? (\
  164.     DviGetAndPut (dw, cp) \
  165.     ) :\
  166.     (*cp = getc (dw->dvi.file))\
  167. )
  168.  
  169. #define DviGetC(dw, cp)\
  170.     (dw->dvi.readingTmp ? (\
  171.     ((*cp = getc (dw->dvi.tmpFile)) == EOF) ? (\
  172.         fseek (dw->dvi.tmpFile, 0l, 2),\
  173.         (dw->dvi.readingTmp = 0),\
  174.         DviGetIn (dw,cp)\
  175.     ) : (\
  176.         *cp\
  177.     )\
  178.     ) : (\
  179.     DviGetIn(dw,cp)\
  180.     )\
  181. )
  182.  
  183. #define DviUngetC(dw, c)\
  184.     (dw->dvi.readingTmp ? (\
  185.     ungetc (c, dw->dvi.tmpFile)\
  186.     ) : ( \
  187.     (dw->dvi.ungot = 1),\
  188.     ungetc (c, dw->dvi.file)))
  189.  
  190. /*
  191.  * Full widget declaration
  192.  */
  193.  
  194. typedef struct _DviRec {
  195.     CorePart    core;
  196.     DviPart        dvi;
  197. } DviRec;
  198.  
  199. extern XFontStruct    *QueryFont ();
  200.  
  201. extern DviCharNameMap    *QueryFontMap ();
  202. #endif /* _XtDviP_h */
  203.  
  204.  
  205.