xref: /inferno-os/module/print.m (revision 46439007cf417cbd9ac8049bb4122c890097a0fa)
1*46439007SCharles.ForsythPrint: module
2*46439007SCharles.Forsyth{
3*46439007SCharles.Forsyth	PATH: con "/dis/lib/print/print.dis";
4*46439007SCharles.Forsyth	CONFIG_PATH: con "/lib/print/";
5*46439007SCharles.Forsyth
6*46439007SCharles.Forsyth	init: fn(): int;
7*46439007SCharles.Forsyth	set_printfd: fn(fd: ref Sys->FD);
8*46439007SCharles.Forsyth	print_image: fn(p: ref Printer, display: ref Draw->Display, im: ref Draw->Image, pcwidth: int, cancel: chan of int): int;
9*46439007SCharles.Forsyth	print_textfd: fn(p: ref Printer, fd: ref Sys->FD, ps: real, pr: int, wrap: int): int;
10*46439007SCharles.Forsyth	get_defprinter: fn(): ref Printer;
11*46439007SCharles.Forsyth	set_defprinter: fn(p: ref Printer);
12*46439007SCharles.Forsyth	get_size: fn(p: ref Printer): (int, int, int);	# dpi, xpixels, ypixels
13*46439007SCharles.Forsyth	get_printers: fn(): list of ref Printer;
14*46439007SCharles.Forsyth	get_papers: fn(): list of ref Paper;
15*46439007SCharles.Forsyth	save_settings: fn(): int;
16*46439007SCharles.Forsyth
17*46439007SCharles.Forsyth	# Printer types
18*46439007SCharles.Forsyth
19*46439007SCharles.Forsyth	Ptype: adt {
20*46439007SCharles.Forsyth		name: string;
21*46439007SCharles.Forsyth		desc: string;
22*46439007SCharles.Forsyth		modes: list of ref Pmode;
23*46439007SCharles.Forsyth		driver: string;
24*46439007SCharles.Forsyth		hpmapfile: string;
25*46439007SCharles.Forsyth	};
26*46439007SCharles.Forsyth
27*46439007SCharles.Forsyth	# Paper sizes
28*46439007SCharles.Forsyth
29*46439007SCharles.Forsyth	Paper: adt {
30*46439007SCharles.Forsyth		name: string;
31*46439007SCharles.Forsyth		hpcode: string;
32*46439007SCharles.Forsyth		width_inches: real;
33*46439007SCharles.Forsyth		height_inches: real;
34*46439007SCharles.Forsyth	};
35*46439007SCharles.Forsyth
36*46439007SCharles.Forsyth	# Print modes
37*46439007SCharles.Forsyth
38*46439007SCharles.Forsyth	Pmode: adt {
39*46439007SCharles.Forsyth		name: string;
40*46439007SCharles.Forsyth		desc: string;
41*46439007SCharles.Forsyth		resx: int;
42*46439007SCharles.Forsyth		resy: int;
43*46439007SCharles.Forsyth		blackdepth: int;
44*46439007SCharles.Forsyth		coldepth: int;
45*46439007SCharles.Forsyth		blackresmult: int;
46*46439007SCharles.Forsyth	};
47*46439007SCharles.Forsyth
48*46439007SCharles.Forsyth	# Print options
49*46439007SCharles.Forsyth
50*46439007SCharles.Forsyth	Popt: adt {
51*46439007SCharles.Forsyth		name: string;
52*46439007SCharles.Forsyth		mode: ref Pmode;
53*46439007SCharles.Forsyth		paper: ref Paper;
54*46439007SCharles.Forsyth		orientation: int;
55*46439007SCharles.Forsyth		duplex: int;
56*46439007SCharles.Forsyth	};
57*46439007SCharles.Forsyth
58*46439007SCharles.Forsyth	# Printer instance
59*46439007SCharles.Forsyth
60*46439007SCharles.Forsyth	PORTRAIT: con 0;
61*46439007SCharles.Forsyth	LANDSCAPE: con 1;
62*46439007SCharles.Forsyth
63*46439007SCharles.Forsyth	DUPLEX_OFF: con 0;
64*46439007SCharles.Forsyth	DUPLEX_LONG: con 1;
65*46439007SCharles.Forsyth	DUPLEX_SHORT: con 2;
66*46439007SCharles.Forsyth
67*46439007SCharles.Forsyth	Printer: adt {
68*46439007SCharles.Forsyth		name: string;
69*46439007SCharles.Forsyth		ptype: ref Ptype;
70*46439007SCharles.Forsyth		device: string;
71*46439007SCharles.Forsyth		popt: ref Popt;
72*46439007SCharles.Forsyth		pdriver: Pdriver;
73*46439007SCharles.Forsyth	};
74*46439007SCharles.Forsyth
75*46439007SCharles.Forsyth};
76*46439007SCharles.Forsyth
77*46439007SCharles.Forsyth
78*46439007SCharles.ForsythPdriver: module
79*46439007SCharles.Forsyth{
80*46439007SCharles.Forsyth	PATHPREFIX: con "/dis/lib/print/";
81*46439007SCharles.Forsyth	DATAPREFIX: con "/lib/print/";
82*46439007SCharles.Forsyth
83*46439007SCharles.Forsyth	init: fn(debug: int);
84*46439007SCharles.Forsyth	sendimage: fn(p: ref Print->Printer, tfd: ref Sys->FD, display: ref Draw->Display, im: ref Draw->Image, width: int, lmargin: int, cancel: chan of int): int;
85*46439007SCharles.Forsyth	sendtextfd: fn(p: ref Print->Printer, pfd, tfd: ref Sys->FD, ps: real, pr: int, wrap: int): int;
86*46439007SCharles.Forsyth	printable_pixels: fn(p: ref Print->Printer): (int, int);
87*46439007SCharles.Forsyth
88*46439007SCharles.Forsyth};
89