summaryrefslogtreecommitdiff
path: root/module/gr.m
blob: 9227fbf631da815b0be932f8c4b2feff265c775f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
GR: module{
	PATH:	con "/dis/math/gr.dis";

	OP: adt{
		code, n: int;
		x, y: array of real;
		t: string;
	};

	open:	fn(ctxt: ref Draw->Context, title: string): ref Plot;

	Plot: adt{
		bye:	fn(p: self ref Plot);
		equalxy:fn(p: self ref Plot);
		graph:	fn(p: self ref Plot, x, y: array of real);
		paint: 	fn(p: self ref Plot, xlabel, xunit, ylabel, yunit: string);
		pen:	fn(p: self ref Plot, nib: int);
		text:	fn(p: self ref Plot, justify: int, s: string, x, y: real);

		op: list of OP;
		xmin, xmax, ymin, ymax: real;
		textsize: real;
		t: ref Tk->Toplevel;		# window containing .fc.c canvas
		titlechan: chan of string;	# Wm titlebar
		canvaschan: chan of string;	# button clicks for measurements
	};

	# op code
	GRAPH:		con 1;
	TEXT:		con 2;
	PEN:		con 3;

	# pen
	CIRCLE:		con 101;
	CROSS:		con 102;
	SOLID:		con 103;
	DASHED:		con 104;
	INVIS:		con 105;
	REFERENCE:	con 106;
	DOTTED:		con 107;

	# text justify
	LJUST:		con 8r00;
	CENTER:		con 8r01;
	RJUST:		con 8r02;
	HIGH:		con 8r00;
	MED:		con 8r10;
	BASE:		con 8r20;
	LOW:		con 8r30;
	UP:		con 8r100;
};