home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / s / stex2-18.zip / SeeTeX / Xtex / DviPageP.h < prev    next >
C/C++ Source or Header  |  1992-06-25  |  5KB  |  240 lines

  1. /*
  2.  * Copyright 1989 Dirk Grunwald
  3.  * 
  4.  * Permission to use, copy, modify, distribute, and sell this software
  5.  * and its documentation for any purpose is hereby granted without fee,
  6.  * provided that the above copyright notice appear in all copies and that
  7.  * both that copyright notice and this permission notice appear in
  8.  * supporting documentation, and that the name of Dirk Grunwald or M.I.T.
  9.  * not be used in advertising or publicity pertaining to distribution of
  10.  * the software without specific, written prior permission.  Dirk
  11.  * Grunwald and M.I.T. makes no representations about the suitability of
  12.  * this software for any purpose.  It is provided "as is" without express
  13.  * or implied warranty.
  14.  * 
  15.  * DIRK GRUNWALD AND M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
  16.  * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
  17.  * FITNESS, IN NO EVENT SHALL M.I.T.  BE LIABLE FOR ANY SPECIAL, INDIRECT
  18.  * OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
  19.  * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  20.  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  21.  * OR PERFORMANCE OF THIS SOFTWARE.
  22.  * 
  23.  * Author:
  24.  *     Dr. Dirk Grunwald
  25.  *     Dept. of Computer Science
  26.  *     Campus Box 430
  27.  *     Univ. of Colorado, Boulder
  28.  *     Boulder, CO 80309
  29.  * 
  30.  *     grunwald@colorado.edu
  31.  *     
  32.  */ 
  33.  
  34. #ifndef _DviPageP_h
  35. #define _DviPageP_h
  36.  
  37. #include "DviPage.h"
  38. /* include superclass private header file */
  39.  
  40. #include <X11/CoreP.h>
  41. #include <X11/Xaw/Label.h>
  42. #include <X11/Shell.h>
  43.  
  44. #ifdef HAVE_DPS
  45. #  include <DPS/XDPSlib.h>
  46. #  include <DPS/dpsXclient.h>
  47. #  include <DPS/dpsexcept.h>
  48. #endif
  49.  
  50. #ifdef HAVE_NEWS
  51. #  include <NeWS/psio.h>
  52. #  include <xvps/pscanvas.h>
  53. #endif
  54.  
  55. #ifdef HAVE_GHOSTSCRIPT
  56. #include <X11/Xmu/Atoms.h>
  57. #include <X11/Xmu/CharSet.h>
  58. #endif
  59.  
  60. typedef struct {
  61. #ifdef HAVE_GHOSTSCRIPT
  62.     AtomPtr ghostview;
  63.     AtomPtr next;
  64.     AtomPtr page;
  65.     AtomPtr done;
  66. #else
  67.     int empty;
  68. #endif
  69. } DviPageClassPart;
  70.  
  71. typedef struct _DviPageClassRec {
  72.     CoreClassPart    core_class;
  73.     DviPageClassPart    dviPage_class;
  74. } DviPageClassRec;
  75.  
  76. extern DviPageClassRec dviPageClassRec;
  77.  
  78.  
  79. typedef struct {
  80.     i32    stack_hh;
  81.     i32    stack_vv;
  82.     i32    h;        /* the saved h */
  83.     i32    v;        /* the saved v */
  84.     i32    w;        /* etc */
  85.     i32    x;
  86.     i32    y;
  87.     i32    z;
  88. } LocalDviStack;
  89.  
  90. typedef struct DviButtonStruct DviButton;
  91.  
  92. #define DVI_REGION_STRLEN 128
  93. struct DviButtonStruct {
  94.     XPoint upperLeft;
  95.     XPoint lowerRight;
  96.     char action[ DVI_REGION_STRLEN ];
  97.     char *longerAction;
  98.     DviButton *next;
  99. };
  100.  
  101. typedef struct {
  102.     Pixel    background;
  103.     Pixel    foreground;
  104.     Pixel    boxColor;
  105.     
  106.     int useBackingStore;    /* backing store type */
  107.     Bool haveBackingStore;
  108.     
  109.     Bool reverseVideo;
  110.     
  111.     XFontStruct *font;
  112.     
  113.     /* private state */
  114.     
  115.     GC invertGC;
  116.     GC paintGC;
  117.     GC clearGC;
  118.     
  119.     Bool redisplay;
  120.     
  121.     char *page;
  122.     
  123.     Dimension pixelsWide;
  124.     Dimension pixelsHigh;
  125.     
  126.     Dimension pixelsPerInchHoriz;
  127.     Dimension pixelsPerInchVert;
  128.     
  129.     float paperWidth;
  130.     float paperHeight;
  131.     
  132.     float topOffset;
  133.     float leftOffset;
  134.     
  135.     char *maxDriftString;    /* in points */
  136.     
  137.     XFontStruct **xFonts;
  138.     
  139.     struct PostAmbleInfo *pai;
  140.     DviFontInfo *dviFonts;
  141.     
  142.     int userMag;
  143.     
  144.     double dpi;
  145.     char *dpiString;
  146.     
  147.     float dpiHoriz;
  148.     float dpiVert;
  149.     
  150.     unsigned long spPerDot;
  151.     
  152.     long fastFromSpValueHoriz;
  153.     long fastFromSpValueVert;
  154.     
  155.     Region updateRegion;
  156.     
  157.     LocalDviStack *dviStack;
  158.     LocalDviStack *dviStackPointer;
  159.     int dviStackSize;
  160.     
  161.     /* for anchors */
  162.     Bool anchored;
  163.     int anchorFromX;
  164.     int anchorFromY;
  165.     int anchorToX;
  166.     int anchorToY;
  167.     
  168.     Widget scalePopup;
  169.     LabelWidget scaleLabel;
  170.     
  171.     ScaleUnits units;
  172.     char *scaleUnitsString;
  173.     
  174.     /* for tpic specials */
  175. #define    MAXPOINTS    300    /* Max points in a path */
  176.     int xx[MAXPOINTS];
  177.     int yy[MAXPOINTS];
  178.     int pathLen;
  179.     int penSize;
  180.     Bool whiten;
  181.     Bool shade;
  182.     Bool blacken;
  183.     
  184. #if defined(HAVE_DPS) || defined(HAVE_NEWS) || defined(HAVE_GHOSTSCRIPT)
  185.     float trueDpi;
  186. #endif
  187.  
  188. #if defined(HAVE_DPS) || defined(HAVE_NEWS) 
  189.     char *dpsPreamble;
  190. #endif
  191.  
  192. #ifdef HAVE_DPS
  193.     /* Display PostScript Extensions */
  194.     Bool dpsVisible;
  195.     DPSContext ctx;
  196.  
  197. #endif    /* HAVE_DPS */
  198.     
  199. #ifdef HAVE_NEWS
  200.     /* NeWS extensions */
  201.  
  202.     PSFILE *newsfile;
  203.     NeWStoken *newstoken;
  204.     
  205. #endif  /* HAVE_NEWS */
  206.  
  207. #ifdef HAVE_GHOSTSCRIPT
  208.     char *gsPreamble;
  209.     String interpreter;            /* ghostscript to use */
  210.     String ghostSearchPath;    /* file search path for gs */
  211.  
  212.     int ghostPID;        /* PID of forked ghostscript process */
  213.     Window ghostMsgWin;        /* ghostscript window to send msgs to */
  214.  
  215.     /* Following for handling text i/o */
  216.     XtInputId ghostInputId, ghostOutputId, ghostErrorId;
  217.     int ghostInputFD, ghostOutputFD, ghostErrorFD;
  218.     XtCallbackList ghostOutput;
  219.  
  220.     /* Following for handling picture output */
  221.     Pixmap ghostPixmap;
  222.     int ghostPixWidth, ghostPixHeight, ghostPixDepth;
  223. #endif
  224.  
  225.     /* for XTeX action buttons */
  226.     DviButton *buttons;
  227.     
  228. } DviPagePart;
  229.  
  230. typedef struct _DviPageRec {
  231.     CorePart        core;
  232.     DviPagePart    dviPage;
  233. } DviPageRec;
  234.  
  235.  
  236. #define fastFromSpVert(w, x) ((x) / (w -> dviPage.fastFromSpValueVert))
  237. #define fastFromSpHoriz(w, x) ((x) / (w -> dviPage.fastFromSpValueHoriz))
  238.  
  239. #endif  _DviPageP_h
  240.