head     1.2;
branch   ;
access   ;
symbols  ;
locks    gtoal:1.2;
comment  @ * @;


1.2
date     91.03.02.13.59.42;  author gtoal;  state Exp;
branches ;
next     1.1;

1.1
date     91.03.02.13.56.32;  author gtoal;  state Exp;
branches ;
next     ;


desc
@Initial release
@


1.2
log
@IAY's update
@
text
@/* d2rd.h */

#include "wimpt.h"  /* includes wimp.h and os.h */
#include "menu.h"
#include "sprite.h"

#undef FALSE
#undef TRUE

#define FALSE             (0!=0)
#define TRUE              (0==0)

#define PROGRAM_NAME      "Preview"

#define HOME_DIRECTORY    "Preview$Dir"

#define SAVEAS_OKBUTTON      (0)
#define SAVEAS_FILENAME      (2)
#define SAVEAS_FILEICON      (3)

#define ABS(X)               ((X) >= 0 ? (X) : -(X))
#define SGN(X)               ((X) > 0 ? 1 : (X) < 0 ? -1 : 0)

/* DVI-82 files have a special filetype, so double-clicking makes d2rd load
   the file automagically.  On a double-click, this _must_ be the file type; 
   on a drag it doesn't matter.  */

#define FILE_TYPE_DVI     (0xce4)

/*
** The following numbers define the size of a sheet
** of paper, in inches.
*/
#define A4_WIDTH          8.27
#define A4_HEIGHT         11.69

struct text
{
  unsigned int text:24, font:8;
  int x, y, rx, ty;
};


struct rule
{
  int x, y, w, h;
};


struct font_use
{
  char *name;
  int size;              /* in 16ths of a point.  */
};


struct page
{
  struct page *next;

  struct text *texts;
  int text_max;

  struct rule *rules;
  int rule_max;

  char *chars;
  int char_max;

  /* Number of things on this page.  This is used to display a percent
     hourglass when building a sprite.  */
  int things;

  /* 0 if this pages is not completed yet.  1 otherwise.  */
  int complete;

  /* The cardinal number of this page.  */
  int dvi_page;

  int tex_pages[10];
};


struct dvi_file
{
  struct dvi_file *next;
  char *f_name;
  struct font_use *fonts[256];
  struct page *pages;
  int height, width;
  int complete;
};


struct display
{
  struct display *next;
  struct dvi_file *file;
  struct page *page;

  int w_handle;
  char *w_title;

  sprite_id sid;
  sprite_area *area;

  /*
  ** The size of the page in millipoints
  */
  int hor_size, ver_size;

  /*
  ** TeX does not specify the positioning of the information on the page,
  ** but the default assumed is 1 inch offset from the topleft corner.
  ** Expressed in millipoints.
  */
  int hor_offset, ver_offset;

  /* MAGSTEP is an index into the array
     TEX_MAGSTEP of magsteps (ordered like the magstep submenu).
     ZOOM is the power of two of the zooming level (default = 0).  */

  int magstep, zoom;

   /*
   ** Variable, normally 1.0, which may be tweaked by the
   ** main program to change scaling by non-Magstep amounts,
   ** for example to match physical pixels on the screen.
   */
   double mag_tweak;
};

/*
** Definitions of how many of a particular kind of thing
** there are to an inch.
*/
#define MILLIPOINTS 72000

extern struct display *windows;
extern struct dvi_file *dvi_files;
extern struct dvi_file *current_dvi_file;

/* My task handle.  */

extern wimp_t pid;


/* Our programname$dir thingy.  */

extern char *progdir;


/* The iconhandle of our icon on the iconbar.  */

extern wimp_i iconbar_icon;


/* (buttons.c) WHICH_MENU points to the display structure of the window above
   which this menu popped up.  It is NULL if the menu was the iconbar menu.  */

extern struct display *which_menu;


/* */

extern menu goto_page;


extern wimp_w saveas;


/* The current screen mode.  */

extern int vdu_mode;



extern int monitor_type;
extern int x_os_scale, y_os_scale;
extern char goto_page_buffer[];
extern int loading_a_file;
extern wimp_menustr *iconbar_menu;
extern menu window_menu, mag_menu, saveas_menu;
extern wimp_mousestr menu_pos;
extern char *version_string;
extern int saveas_filetype;
extern char *saveas_buffer;


/* */

extern os_error *err;

extern int fatal (const char *, ...);
extern void tfatal (const char *, ...);
extern void *xmalloc (int);
extern void *xcalloc (int, int);
extern void *xrealloc (void *, int);
extern void handle_buttons (wimp_eventdata *);
extern int read_a_file (char *);
extern void dviread_main (int, char **);
extern void do_a_poll (void);
extern void fill_sprite (struct display *);
extern void factors (struct display *, double *, double *);
extern void delete_display (wimp_w);
extern void adjust_window_size (struct display *);
extern int define_sprite (struct display *);
extern void set_window_title (struct display *);

/* EOF d2rd.h */
@


1.1
log
@Initial revision
@
text
@a16 2
#define ONE_OS_INCH       (180)

d30 6
a35 7

#define XA4_AT_95DPI      784

#define YA4_AT_95DPI      1104


#define MAGNIFICATION_DIVISOR (90000.0)   /* which is 90 dpi * magstep0.  */
a36 1

d107 3
a109 2
  /* The size of the page in pixels.  */

d112 5
a116 4
  /* TeX does not specify the positioning of the information on the page,
     but the default assumed is 1 inch offset from the topleft corner
     Unit = 1/72000th inch.  */

d119 1
a119 1
  /* DPI is straight the dots per inch.  MAGSTEP is an index into the array
d123 1
a123 2
  int dpi, magstep, zoom;
};
d125 13
a184 1
extern int tex_magstep[];
d204 1
a204 1
extern void factors (struct display *, int *, int *);
@
