source: trunk/GDE/PHYLIP/draw.h

Last change on this file was 19480, checked in by westram, 15 months ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.0 KB
Line 
1
2#include "phylip.h"
3
4#ifdef X
5#include <X11/Xlib.h>
6#include <X11/Intrinsic.h>
7#include <X11/StringDefs.h>
8#include <X11/Xaw/Label.h>
9#include <X11/Xatom.h>
10#include <X11/Shell.h>
11#include <X11/Xaw/SimpleMenu.h>
12#include <X11/Xaw/Paned.h>
13#include <X11/Xaw/Box.h>
14#include <X11/Xaw/MenuButton.h>
15#include <X11/Xaw/SmeBSB.h>
16#include <X11/Xaw/Form.h>
17#include <X11/Xaw/Dialog.h>
18#include <X11/Xlib.h>
19#include <X11/Xutil.h>
20#endif
21
22#ifdef MAC
23#include "interface.h"
24#endif
25
26/* Added by Dan F. for bmp code */
27#include "math.h" 
28#define  DEFAULT_STRIPE_HEIGHT 20
29
30#define maxnodes        1200
31#define minus           '-'
32#define stripewidth     3000L
33#define maxstripedepth  3500
34#define fontsize        3800
35#define pi              3.1415926535897932384626433
36#define epsilond        0.00001
37#define ebcdic          EBCDIC
38#define segments        40
39#define xstart          10
40#define ystart          35
41#define LF              10
42#define CR              13
43#define escape  (ebcdic ?  '\'' :  '\033')
44#define null  '\000'
45#define AFMDIR "/usr/lib/transcript/" /* note trailing slash */
46
47typedef unsigned char byte;
48/*typedef char byte; */
49typedef enum {treepen, labelpen} pentype;
50typedef enum {lw,hp,tek,ibm,mac,houston,decregis,epson,oki,fig,
51                citoh,toshiba,pcx,pcl,pict,ray,pov,xpreview,xbm,bmp,
52                gif,idraw,vrml,winpreview,other} plottertype;
53typedef enum {vertical, horizontal} growth;
54typedef enum {cladogram,phenogram,curvogram,
55              eurogram,swoopogram,circular} treestyle;
56typedef enum {penup,pendown} pensttstype;
57typedef enum {plotnow, changeparms, quitnow} winactiontype;
58typedef short fonttype[fontsize];
59typedef Char *striparray;
60typedef striparray striptype[maxstripedepth];
61
62struct LOC_plottext {              /* Local variables for plottext: */
63  double height, compress;
64  short *font;
65  short coord;
66  double heightfont, xfactor, yfactor, xfont, yfont, xplot, yplot, sinslope,
67         cosslope, xx, yy;
68  pensttstype penstatus;
69} ;
70
71typedef struct colortype {
72  const char *name;
73  double red, green, blue;
74} colortype;
75
76typedef struct vrmllighttype {
77  double intensity, x, y, z;
78} vrmllighttype;
79
80double lengthtext(char *, long, char *, fonttype);
81double heighttext(fonttype, char *);
82void plotrparms(long ntips);
83void   clearit(void);
84void   getplotter(void);
85void   getpreview(void);
86const char *figfontname(int id);
87boolean isfigfont(char *);
88void   plot(pensttstype, double, double);
89void   curvespline(double, double, double, double, boolean, long);
90void swoopspline(double x1, double y1, double x2, double y2, double x3,
91                 double y3, boolean sense, long segs);
92void changepen(pentype pen);
93void plottext(Char *pstring,long nchars,double height_,double cmpress2,
94               double x,double y,double slope,short *font_,char *fontname);
95void loadfont(short *font, char *application);
96long allocstripe(striptype stripe, long x, long y);
97boolean plotpreview(char *, double *, double *, double *, long , node *);
98void initplotter(long ntips);
99void drawit(char *fontname, double *xoffset, double *yoffset,
100                        long numlines, node *root);
101void   finishplotter(void);
102void   write_bmp_header(FILE *, int, int);
103void   turn_rows(byte *, int, int);
104void   write_full_pic(byte *, int);
105void translate_stripe_to_bmp(striptype *stripe, byte *full_pic,
106                           int increment, int width, int div, int *total_bytes);
107void   plottree(node *, node *);
108void plotlabels(char *fontname);
109void   pout(long);
110double computeAngle(double oldx, double oldy, double newx, double newy);
111boolean plot_without_preview(double *, double *, double *, long);
112
113
114/* For povray, added by Dan F. */
115#define TREE_TEXTURE "T_Tree\0"
116#define NAME_TEXTURE "T_Name\0"
117
118
119
120#ifdef X
121Display *display;               /* the X display */
122extern Window  mainwin;         /* the main display window */
123int x, y;                       /* the corner of the window */
124unsigned int width, height;     /* the width and height of the window */
125#define FONT "-*-new century schoolbook-medium-r-*-*-14-*"
126char *fontrsc;                  /* the font resource */
127XFontStruct *fontst;            /* the font strcture for the font */
128XGCValues gcv;                  /* graphics context values */
129GC gc1;                         /* a graphics context */
130XtAppContext appcontext;
131Widget toplevel;
132int nargc;
133char** nargv;
134extern String res[16];
135
136#define DEFGEOMETRY "600x400+20+50"
137#endif
138#define LARGE_BUF_LENGTH 500
139extern char fontname[LARGE_BUF_LENGTH]; /* the font name to use */
140
141#ifdef WIN32
142#define DEFPLOTTER lw
143#define DEFPREV winpreview
144#endif
145#ifdef DOS
146#define DEFPLOTTER lw
147#define DEFPREV ibm
148#endif   
149#ifdef MAC
150#define DEFPLOTTER pict
151#define DEFPREV mac
152#endif   
153#ifdef VMS
154#define DEFPLOTTER lw
155#define DEFPREV decregis
156#endif
157#ifndef DOS
158#ifndef MAC
159#ifndef VMS
160#ifndef WIN32
161#define DEFPLOTTER lw
162#ifdef X
163#define DEFPREV xpreview
164#endif
165#ifndef X
166#define DEFPREV tek
167#endif
168#endif
169#endif   
170#endif   
171#endif   
172
173/* Define SEEK_SET (needed for fseek()) for machines that haven't
174   got it already, */
175#ifndef SEEK_SET
176#define SEEK_SET 0
177#endif
178
Note: See TracBrowser for help on using the repository browser.