|
|
1.1 root 1: #include <X/mit-copyright.h>
2:
3: /* Copyright Massachusetts Institute of Technology 1984, 1985 */
4:
5: /* $Header: gedit.h,v 10.4 86/02/01 16:19:03 tony Rel $ */
6:
7: #include <stdio.h>
8:
9: #define HELPFILE "GEDIT" /* Name of .DEF file for help */
10:
11: /* types of things we can edit */
12: #define SEGMENT 1 /* straight or curved line segments */
13: #define LABEL 2 /* text */
14: #define OBJECT 3 /* other files included in this one */
15:
16: typedef union widget *gptr; /* pointer to graphics object */
17:
18: struct segment {
19: short type; /* type of this widget == SEGMENT */
20: gptr selink; /* select link */
21: gptr next; /* next widget */
22: struct prototype *parent; /* our ancestor */
23: short x1,y1; /* starting coord */
24: short x2,y2; /* ending coord */
25: short angle; /* angle subtended by chord, 0 => straight line */
26: gptr cache; /* list of line segments for displaying arc */
27: };
28:
29: struct label {
30: short type; /* type of this widget == LABEL */
31: gptr selink; /* select link */
32: gptr next; /* next widget */
33: struct prototype *parent; /* our ancestor */
34: short x,y; /* label point */
35: short orient; /* position wrt to point */
36: char *string; /* the label itself */
37: };
38:
39: struct object {
40: short type; /* type of this widget == OBJECT */
41: gptr selink; /* select link */
42: gptr next; /* next widget */
43: struct prototype *parent; /* our ancestor */
44: short x,y; /* coords of origin */
45: short orient; /* one of eight orientations */
46: struct prototype *proto; /* info about the object itself */
47: short mscale,dscale; /* local scaling parameters */
48: };
49:
50: union widget { /* used for pointing at things */
51: struct segment s;
52: struct label l;
53: struct object o;
54: };
55:
56: #define NORTH 0 /* normal orientations */
57: #define EAST 1
58: #define SOUTH 2
59: #define WEST 3
60: #define RNORTH 4 /* reflected orientations */
61: #define REAST 5
62: #define RSOUTH 6
63: #define RWEST 7
64:
65: /* label orientations */
66: #define CC 0
67: #define TC 1
68: #define BC 2
69: #define CL 3
70: #define TL 4
71: #define BL 5
72: #define CR 6
73: #define TR 7
74: #define BR 8
75:
76: /* line types */
77: #define NORMAL 0
78: #define HIGHLIGHT 1
79:
80: extern char ocomp[8][8]; /* orientation composition matrix */
81: extern char lcomp[8][9];
82:
83: struct state {
84: struct prototype *curobj; /* current prototype, if any */
85: short mscale,dscale; /* display scale */
86: short worgx,worgy; /* coords of lower left corner of window */
87: short wmaxx,wmaxy; /* coords of upper right corner of window */
88: short curx,cury; /* coords of cursor center */
89: short oldx,oldy; /* coords of cursor last time displayed */
90: short csize; /* size of cursor */
91: short grid; /* <>0 if we should display grid points */
92: gptr editee; /* currently selected object(s) */
93: short xoff,yoff; /* offset from cursor to selected object */
94: short lxoff,lyoff; /* offsets from last select/deselect operation */
95: short whichend; /* indicates which end of a selected line */
96: };
97:
98: struct prototype {
99: struct prototype *next; /* linked list of prototypes */
100: char *name; /* name */
101: gptr body; /* what's inside the object */
102: struct state recent; /* copy of most recent edit state, if any */
103: char modified; /* <>0 => modified defn not yet saved */
104: };
105:
106: extern struct state cur_state;
107:
108: extern struct prototype *directory,*read_def();
109:
110: extern short grid; /* <>0 display grid points */
111: extern short incol; /* current text prompt column */
112: extern char *prompt; /* what the current user prompt is */
113: extern char typein[100]; /* user input buffer */
114:
115: typedef int (*fptr)();
116: extern fptr dispatch[];
117:
118: /* various display parameters */
119: extern short wminx,wminy,wmaxx,wmaxy;
120: extern short chrhgt,chrwid;
121:
122: /* command routine return codes */
123: #define MULTIPLIER 0x01 /* don't reset multipler to 1 */
124: #define RECENTER 0x02 /* recenter picture about cursor */
125: #define REDISPLAY 0x04 /* redraw the picture */
126: #define DONE 0x08 /* all done with current picture */
127: #define UPDATE 0x10 /* flags for deselect operation */
128: #define USEOFFSET 0x20
129:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.