home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / textual / tex / files / !preview / h / d2rd next >
Encoding:
Text File  |  1990-07-24  |  4.1 KB  |  211 lines

  1. /* d2rd.h */
  2.  
  3. #include "wimpt.h"  /* includes wimp.h and os.h */
  4. #include "menu.h"
  5. #include "sprite.h"
  6.  
  7. #undef FALSE
  8. #undef TRUE
  9.  
  10. #define FALSE             (0!=0)
  11. #define TRUE              (0==0)
  12.  
  13. #define PROGRAM_NAME      "Preview"
  14.  
  15. #define HOME_DIRECTORY    "Preview$Dir"
  16.  
  17. #define SAVEAS_OKBUTTON      (0)
  18. #define SAVEAS_FILENAME      (2)
  19. #define SAVEAS_FILEICON      (3)
  20.  
  21. #define ABS(X)               ((X) >= 0 ? (X) : -(X))
  22. #define SGN(X)               ((X) > 0 ? 1 : (X) < 0 ? -1 : 0)
  23.  
  24. /* DVI-82 files have a special filetype, so double-clicking makes d2rd load
  25.    the file automagically.  On a double-click, this _must_ be the file type; 
  26.    on a drag it doesn't matter.  */
  27.  
  28. #define FILE_TYPE_DVI     (0xce4)
  29.  
  30. /*
  31. ** The following numbers define the size of a sheet
  32. ** of paper, in inches.
  33. */
  34. #define A4_WIDTH          8.27
  35. #define A4_HEIGHT         11.69
  36.  
  37. struct text
  38. {
  39.   unsigned int text:24, font:8;
  40.   int x, y, rx, ty;
  41. };
  42.  
  43.  
  44. struct rule
  45. {
  46.   int x, y, w, h;
  47. };
  48.  
  49.  
  50. struct font_use
  51. {
  52.   char *name;
  53.   int size;              /* in 16ths of a point.  */
  54. };
  55.  
  56.  
  57. struct page
  58. {
  59.   struct page *next;
  60.  
  61.   struct text *texts;
  62.   int text_max;
  63.  
  64.   struct rule *rules;
  65.   int rule_max;
  66.  
  67.   char *chars;
  68.   int char_max;
  69.  
  70.   /* Number of things on this page.  This is used to display a percent
  71.      hourglass when building a sprite.  */
  72.   int things;
  73.  
  74.   /* 0 if this pages is not completed yet.  1 otherwise.  */
  75.   int complete;
  76.  
  77.   /* The cardinal number of this page.  */
  78.   int dvi_page;
  79.  
  80.   int tex_pages[10];
  81. };
  82.  
  83.  
  84. struct dvi_file
  85. {
  86.   struct dvi_file *next;
  87.   char *f_name;
  88.   struct font_use *fonts[256];
  89.   struct page *pages;
  90.   int height, width;
  91.   int complete;
  92. };
  93.  
  94.  
  95. struct display
  96. {
  97.   struct display *next;
  98.   struct dvi_file *file;
  99.   struct page *page;
  100.  
  101.   int w_handle;
  102.   char *w_title;
  103.  
  104.   sprite_id sid;
  105.   sprite_area *area;
  106.  
  107.   /*
  108.   ** The size of the page in millipoints
  109.   */
  110.   int hor_size, ver_size;
  111.  
  112.   /*
  113.   ** TeX does not specify the positioning of the information on the page,
  114.   ** but the default assumed is 1 inch offset from the topleft corner.
  115.   ** Expressed in millipoints.
  116.   */
  117.   int hor_offset, ver_offset;
  118.  
  119.   /* MAGSTEP is an index into the array
  120.      TEX_MAGSTEP of magsteps (ordered like the magstep submenu).
  121.      ZOOM is the power of two of the zooming level (default = 0).  */
  122.  
  123.   int magstep, zoom;
  124.  
  125.    /*
  126.    ** Variable, normally 1.0, which may be tweaked by the
  127.    ** main program to change scaling by non-Magstep amounts,
  128.    ** for example to match physical pixels on the screen.
  129.    */
  130.    double mag_tweak;
  131. };
  132.  
  133. /*
  134. ** Definitions of how many of a particular kind of thing
  135. ** there are to an inch.
  136. */
  137. #define MILLIPOINTS 72000
  138.  
  139. extern struct display *windows;
  140. extern struct dvi_file *dvi_files;
  141. extern struct dvi_file *current_dvi_file;
  142.  
  143. /* My task handle.  */
  144.  
  145. extern wimp_t pid;
  146.  
  147.  
  148. /* Our programname$dir thingy.  */
  149.  
  150. extern char *progdir;
  151.  
  152.  
  153. /* The iconhandle of our icon on the iconbar.  */
  154.  
  155. extern wimp_i iconbar_icon;
  156.  
  157.  
  158. /* (buttons.c) WHICH_MENU points to the display structure of the window above
  159.    which this menu popped up.  It is NULL if the menu was the iconbar menu.  */
  160.  
  161. extern struct display *which_menu;
  162.  
  163.  
  164. /* */
  165.  
  166. extern menu goto_page;
  167.  
  168.  
  169. extern wimp_w saveas;
  170.  
  171.  
  172. /* The current screen mode.  */
  173.  
  174. extern int vdu_mode;
  175.  
  176.  
  177.  
  178. extern int monitor_type;
  179. extern int x_os_scale, y_os_scale;
  180. extern char goto_page_buffer[];
  181. extern int loading_a_file;
  182. extern wimp_menustr *iconbar_menu;
  183. extern menu window_menu, mag_menu, saveas_menu;
  184. extern wimp_mousestr menu_pos;
  185. extern char *version_string;
  186. extern int saveas_filetype;
  187. extern char *saveas_buffer;
  188.  
  189.  
  190. /* */
  191.  
  192. extern os_error *err;
  193.  
  194. extern int fatal (const char *, ...);
  195. extern void tfatal (const char *, ...);
  196. extern void *xmalloc (int);
  197. extern void *xcalloc (int, int);
  198. extern void *xrealloc (void *, int);
  199. extern void handle_buttons (wimp_eventdata *);
  200. extern int read_a_file (char *);
  201. extern void dviread_main (int, char **);
  202. extern void do_a_poll (void);
  203. extern void fill_sprite (struct display *);
  204. extern void factors (struct display *, double *, double *);
  205. extern void delete_display (wimp_w);
  206. extern void adjust_window_size (struct display *);
  207. extern int define_sprite (struct display *);
  208. extern void set_window_title (struct display *);
  209.  
  210. /* EOF d2rd.h */
  211.