xref: /inferno-os/appl/grid/lib/browser.m (revision 37da2899f40661e3e9631e497da8dc59b971cbd0)
1*37da2899SCharles.ForsythBrowser: module {
2*37da2899SCharles.Forsyth
3*37da2899SCharles.Forsyth	PATH: con "/dis/scheduler/browser.dis";
4*37da2899SCharles.Forsyth
5*37da2899SCharles.Forsyth	DESELECT: con 0;
6*37da2899SCharles.Forsyth	SELECT: con 1;
7*37da2899SCharles.Forsyth	TOGGLE: con 2;
8*37da2899SCharles.Forsyth	OPEN: con 3;
9*37da2899SCharles.Forsyth	CLOSE: con 4;
10*37da2899SCharles.Forsyth
11*37da2899SCharles.Forsyth	init: fn ();
12*37da2899SCharles.Forsyth	dialog: fn (ctxt: ref draw->Context, oldtop: ref Tk->Toplevel, butlist: list of string, title, msg: string): int;
13*37da2899SCharles.Forsyth	prevpath: fn (path: string): string;
14*37da2899SCharles.Forsyth	setcentre: fn (top1, top2: ref Tk->Toplevel);
15*37da2899SCharles.Forsyth
16*37da2899SCharles.Forsyth	Browse: adt {
17*37da2899SCharles.Forsyth		new: fn (top: ref Tk->Toplevel, tkchanname, root, rlabel: string, nopanes: int, reader: PathReader): ref Browse;
18*37da2899SCharles.Forsyth		refresh: fn (b: self ref Browse);
19*37da2899SCharles.Forsyth		defaultaction: fn (b: self ref Browse, lst: list of string, f: ref File);
20*37da2899SCharles.Forsyth		getpath: fn (b: self ref Browse, tkpath: string): ref File;
21*37da2899SCharles.Forsyth		opendir: fn (b: self ref Browse, file: File, tkpath: string, action: int): int;
22*37da2899SCharles.Forsyth		newroot: fn (b: self ref Browse, root, rlabel: string);
23*37da2899SCharles.Forsyth		changeview: fn (b: self ref Browse, nopanes: int);
24*37da2899SCharles.Forsyth		selectfile: fn (b: self ref Browse, pane, action: int, file: File, tkpath: string);
25*37da2899SCharles.Forsyth		gotoselectfile: fn (b: self ref Browse, file: File): string;
26*37da2899SCharles.Forsyth		gotopath: fn (b: self ref Browse, dir: File, openfinal: int): (File, string);
27*37da2899SCharles.Forsyth		getselected: fn (b: self ref Browse, pane: int): File;
28*37da2899SCharles.Forsyth		addopened: fn (b: self ref Browse, file: File, add: int);
29*37da2899SCharles.Forsyth		showpath: fn (b: self ref Browse, on: int);
30*37da2899SCharles.Forsyth		resize: fn (b: self ref Browse);
31*37da2899SCharles.Forsyth		top: ref Tk->Toplevel;
32*37da2899SCharles.Forsyth		tkchan: string;
33*37da2899SCharles.Forsyth		bgnorm, bgselect: string;
34*37da2899SCharles.Forsyth		nopanes: int;
35*37da2899SCharles.Forsyth		selected: array of Selected;
36*37da2899SCharles.Forsyth		opened: list of File;
37*37da2899SCharles.Forsyth		root, rlabel: string;
38*37da2899SCharles.Forsyth		reader: PathReader;
39*37da2899SCharles.Forsyth		pane1: File;
40*37da2899SCharles.Forsyth		pane0width: string;
41*37da2899SCharles.Forsyth		width: int;
42*37da2899SCharles.Forsyth		showpathlabel: int;
43*37da2899SCharles.Forsyth		released: int;
44*37da2899SCharles.Forsyth	};
45*37da2899SCharles.Forsyth
46*37da2899SCharles.Forsyth	SELECTED: con 0;
47*37da2899SCharles.Forsyth	UNSELECTED: con 1;
48*37da2899SCharles.Forsyth	ALL: con 2;
49*37da2899SCharles.Forsyth
50*37da2899SCharles.Forsyth	Select: adt {
51*37da2899SCharles.Forsyth		new: fn (top: ref Tk->Toplevel, tkchanname: string): ref Select;
52*37da2899SCharles.Forsyth		addframe: fn (s: self ref Select, fname, title: string);
53*37da2899SCharles.Forsyth		showframe: fn (s: self ref Select, fname: string);
54*37da2899SCharles.Forsyth		delframe: fn (s: self ref Select, fname: string);
55*37da2899SCharles.Forsyth		addselection: fn (s: self ref Select, fname, text: string, lp: list of ref Parameter, allowdups: int): string;
56*37da2899SCharles.Forsyth		delselection: fn (s: self ref Select, fname, tkpath: string);
57*37da2899SCharles.Forsyth		getselection: fn (s: self ref Select, fname: string): list of (string, list of ref Parameter);
58*37da2899SCharles.Forsyth		getselected: fn (s: self ref Select, fname: string): string;
59*37da2899SCharles.Forsyth		select: fn (s: self ref Select, fname, tkpath: string, action: int);
60*37da2899SCharles.Forsyth		defaultaction: fn (s: self ref Select, lst: list of string);
61*37da2899SCharles.Forsyth		resize: fn (s: self ref Select, width, height: int);
62*37da2899SCharles.Forsyth		setscrollr: fn (s: self ref Select, fname: string);
63*37da2899SCharles.Forsyth		top: ref Tk->Toplevel;
64*37da2899SCharles.Forsyth		tkchan: string;
65*37da2899SCharles.Forsyth		currfname, currfid: string;
66*37da2899SCharles.Forsyth		frames: list of ref Frame;
67*37da2899SCharles.Forsyth	};
68*37da2899SCharles.Forsyth
69*37da2899SCharles.Forsyth	Frame: adt {
70*37da2899SCharles.Forsyth		name: string;
71*37da2899SCharles.Forsyth		path: string;
72*37da2899SCharles.Forsyth		selected: string;
73*37da2899SCharles.Forsyth	};
74*37da2899SCharles.Forsyth
75*37da2899SCharles.Forsyth	Parameter: adt {
76*37da2899SCharles.Forsyth		pick {
77*37da2899SCharles.Forsyth		ArgIn =>
78*37da2899SCharles.Forsyth			name, initval: string;
79*37da2899SCharles.Forsyth		ArgOut =>
80*37da2899SCharles.Forsyth			name, val: string;
81*37da2899SCharles.Forsyth		IntIn =>
82*37da2899SCharles.Forsyth			min, max, initval: int;
83*37da2899SCharles.Forsyth		IntOut =>
84*37da2899SCharles.Forsyth			val: int;
85*37da2899SCharles.Forsyth		}
86*37da2899SCharles.Forsyth	};
87*37da2899SCharles.Forsyth
88*37da2899SCharles.Forsyth	File: adt {
89*37da2899SCharles.Forsyth		eq: fn (a,b: File): int;
90*37da2899SCharles.Forsyth		path, qid: string;
91*37da2899SCharles.Forsyth	};
92*37da2899SCharles.Forsyth
93*37da2899SCharles.Forsyth	Selected: adt {
94*37da2899SCharles.Forsyth		file: File;
95*37da2899SCharles.Forsyth		tkpath: string;
96*37da2899SCharles.Forsyth	};
97*37da2899SCharles.Forsyth};