xref: /inferno-os/appl/acme/frame.m (revision 37da2899f40661e3e9631e497da8dc59b971cbd0)
1*37da2899SCharles.ForsythFramem : module {
2*37da2899SCharles.Forsyth	PATH : con "/dis/acme/frame.dis";
3*37da2899SCharles.Forsyth
4*37da2899SCharles.Forsyth	BACK, HIGH, BORD, TEXT, HTEXT, NCOL : con iota;
5*37da2899SCharles.Forsyth
6*37da2899SCharles.Forsyth	FRTICKW : con 3;
7*37da2899SCharles.Forsyth
8*37da2899SCharles.Forsyth	init : fn(mods : ref Dat->Mods);
9*37da2899SCharles.Forsyth
10*37da2899SCharles.Forsyth	newframe : fn() : ref Frame;
11*37da2899SCharles.Forsyth
12*37da2899SCharles.Forsyth	Frbox : adt {
13*37da2899SCharles.Forsyth		wid : int;					# in pixels
14*37da2899SCharles.Forsyth		nrune : int;				# <0 ==> negate and treat as break char
15*37da2899SCharles.Forsyth		ptr : string;
16*37da2899SCharles.Forsyth		bc : int;		# break char
17*37da2899SCharles.Forsyth		minwid : int;
18*37da2899SCharles.Forsyth	};
19*37da2899SCharles.Forsyth
20*37da2899SCharles.Forsyth	Frame : adt {
21*37da2899SCharles.Forsyth		font : ref Draw->Font;		# of chars in the frame
22*37da2899SCharles.Forsyth		b : ref Draw->Image;		# on which frame appears
23*37da2899SCharles.Forsyth		cols : array of ref Draw->Image;	# colours
24*37da2899SCharles.Forsyth		r : Draw->Rect;				# in which text appears
25*37da2899SCharles.Forsyth		entire : Draw->Rect;			# of full frame
26*37da2899SCharles.Forsyth		box : array of ref Frbox;
27*37da2899SCharles.Forsyth		scroll : int;				# call framescroll function
28*37da2899SCharles.Forsyth		p0 : int;
29*37da2899SCharles.Forsyth		p1 : int;					# selection
30*37da2899SCharles.Forsyth		nbox, nalloc : int;
31*37da2899SCharles.Forsyth		maxtab : int;				# max size of tab, in pixels
32*37da2899SCharles.Forsyth		nchars : int;				# runes in frame
33*37da2899SCharles.Forsyth		nlines : int;				# lines with text
34*37da2899SCharles.Forsyth		maxlines : int;				# total # lines in frame
35*37da2899SCharles.Forsyth		lastlinefull : int;				# last line fills frame
36*37da2899SCharles.Forsyth		modified : int;				# changed since frselect()
37*37da2899SCharles.Forsyth		noglyph : int;				# char to use when a char has 0 width glyph
38*37da2899SCharles.Forsyth		tick : ref Draw->Image;		# typing tick
39*37da2899SCharles.Forsyth		tickback : ref Draw->Image;	# saved image under tick
40*37da2899SCharles.Forsyth		ticked : int;				# is tick on screen ?
41*37da2899SCharles.Forsyth	};
42*37da2899SCharles.Forsyth
43*37da2899SCharles.Forsyth	frcharofpt : fn(f : ref Frame, p : Draw->Point) : int;
44*37da2899SCharles.Forsyth	frptofchar : fn(f : ref Frame, c : int) : Draw->Point;
45*37da2899SCharles.Forsyth	frdelete : fn(f : ref Frame, c1 : int, c2 : int) : int;
46*37da2899SCharles.Forsyth	frinsert : fn(f : ref Frame, s : string, l : int, i : int);
47*37da2899SCharles.Forsyth	frselect : fn(f : ref Frame, m : ref Draw->Pointer);
48*37da2899SCharles.Forsyth	frinit : fn(f : ref Frame, r : Draw->Rect, f : ref Draw->Font, b : ref Draw->Image, cols : array of ref Draw->Image);
49*37da2899SCharles.Forsyth	frsetrects : fn(f : ref Frame, r : Draw->Rect, b : ref Draw->Image);
50*37da2899SCharles.Forsyth	frclear : fn(f : ref Frame, x : int);
51*37da2899SCharles.Forsyth	frdrawsel : fn(f : ref Frame, p : Draw->Point, p0 : int, p1 : int, n : int);
52*37da2899SCharles.Forsyth	frdrawsel0 : fn(f : ref Frame, p : Draw->Point, p0 : int, p1 : int, i1 : ref Draw->Image, i2 : ref Draw->Image);
53*37da2899SCharles.Forsyth	frtick : fn(f : ref Frame, p : Draw->Point, n : int);
54*37da2899SCharles.Forsyth};
55