xref: /haiku/src/add-ons/print/drivers/canon_lips/lips4/Lips4Cap.cpp (revision ba499cdc3336fb89429027418871bf263f1f5e14)
1 /*
2  * Lips4Cap.cpp
3  * Copyright 1999-2000 Y.Takagi. All Rights Reserved.
4  */
5 
6 #include "Lips4Cap.h"
7 
8 #define TO72DPI(a)	(a * 72.0f / 600.0f)
9 
10 const PaperCap a3(
11 	"A3",
12 	false,
13 	JobData::kA3,
14 	BRect(0.0f,            0.0f,            TO72DPI(7014.0f), TO72DPI(9920.0f)),
15 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f)));
16 
17 const PaperCap a4(
18 	"A4",
19 	true,
20 	JobData::kA4,
21 	BRect(0.0f,            0.0f,            TO72DPI(4960.0f), TO72DPI(7014.0f)),
22 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f)));
23 
24 const PaperCap a5(
25 	"A5",
26 	false,
27 	JobData::kA5,
28 	BRect(0.0f,            0.0f,            TO72DPI(3506.0f), TO72DPI(4960.0f)),
29 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f)));
30 
31 const PaperCap japanese_postcard(
32 	"Japanese Postcard",
33 	false,
34 	JobData::kJapanesePostcard,
35 	BRect(0.0f,           0.0f,             TO72DPI(2362.0f), TO72DPI(3506.0f)),
36 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f)));
37 
38 const PaperCap b4(
39 	"B4",
40 	false,
41 	JobData::kB4,
42 	BRect(0.0f,            0.0f,            TO72DPI(6070.0f), TO72DPI(8598.0f)),
43 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f)));
44 
45 const PaperCap b5(
46 	"B5",
47 	false,
48 	JobData::kB5,
49 	BRect(0.0f,            0.0f,            TO72DPI(4298.0f), TO72DPI(6070.0f)),
50 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f)));
51 
52 const PaperCap letter(
53 	"Letter",
54 	false,
55 	JobData::kLetter,
56 	BRect(0.0f,            0.0f,            TO72DPI(5100.0f), TO72DPI(6600.0f)),
57 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f)));
58 
59 const PaperCap legal(
60 	"Legal",
61 	false,
62 	JobData::kLegal,
63 	BRect(0.0f,            0.0f,            TO72DPI(5100.0f), TO72DPI(8400.0f)),
64 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f)));
65 
66 const PaperCap tabloid(
67 	"Tabloid",
68 	false,
69 	JobData::kTabloid,
70 	BRect(0.0f,            0.0f,            TO72DPI(6600.0), TO72DPI(10200.0)),
71 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6480.0), TO72DPI(10080.0)));
72 
73 const PaperCap executive(
74 	"Executive",
75 	false,
76 	JobData::kExecutive,
77 	BRect(0.0f,            0.0f,            TO72DPI(4350.0f), TO72DPI(6300.0f)),
78 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4230.0f), TO72DPI(6180.0f)));
79 
80 const PaperCap japanese_envelope_you4(
81 	"Japanese Envelope You#4",
82 	false,
83 	JobData::kJEnvYou4,
84 	BRect(0.0f,            0.0f,            TO72DPI(2480.0f), TO72DPI(5550.0f)),
85 	BRect(TO72DPI(236.0f), TO72DPI(236.0f), TO72DPI(2244.0f), TO72DPI(5314.0f)));
86 /*
87 const PaperCap japanese_envelope_kaku2(
88 	"Japanese Envelope Kaku#2",
89 	false,
90 	JobData::kJEnvKaku2,
91 	BRect(0.0f,            0.0f,            TO72DPI(5568.0f), TO72DPI(7842.0f)),
92 	BRect(TO72DPI(236.0f), TO72DPI(236.0f), TO72DPI(5432.0f), TO72DPI(7606.0f)));
93 */
94 const PaperSourceCap autobin("Auto",  true,  JobData::kAuto);
95 const PaperSourceCap manual("Manual", false, JobData::kManual);
96 const PaperSourceCap upper("Upper",   false, JobData::kUpper);
97 const PaperSourceCap middle("Middle", false, JobData::kMiddle);
98 const PaperSourceCap lower("Lower",   false, JobData::kLower);
99 
100 const ResolutionCap dpi1200("1200dpi", false, 1200, 1200);
101 const ResolutionCap dpi600("600dpi",   true,  600,  600);
102 const ResolutionCap dpi300("300dpi",   false, 300,  300);
103 
104 const PrintStyleCap simplex("Simplex", true,  JobData::kSimplex);
105 const PrintStyleCap duplex("Duplex",   false, JobData::kDuplex);
106 const PrintStyleCap booklet("Booklet", false, JobData::kBooklet);
107 
108 const BindingLocationCap longedge1("Long Edge (left)",     true,  JobData::kLongEdgeLeft);
109 const BindingLocationCap longedge2("Long Edge (right)",    false, JobData::kLongEdgeRight);
110 const BindingLocationCap shortedge1("Short Edge (top)",    false, JobData::kShortEdgeTop);
111 const BindingLocationCap shortedge2("Short Edge (bottom)", false, JobData::kShortEdgeBottom);
112 
113 const PaperCap *papers[] = {
114 	&a4,
115 	&a3,
116 	&a5,
117 	&b4,
118 	&b5,
119 	&letter,
120 	&legal,
121 	&tabloid,
122 	&executive,
123 	&japanese_postcard,
124 	&japanese_envelope_you4
125 };
126 
127 const PaperSourceCap *papersources[] = {
128 	&autobin,
129 	&manual,
130 	&upper,
131 	&middle,
132 	&lower
133 };
134 
135 const ResolutionCap *resolutions[] = {
136 	&dpi1200,
137 	&dpi600,
138 	&dpi300
139 };
140 
141 const PrintStyleCap *printstyles[] = {
142 	&simplex,
143 	&duplex,
144 	&booklet
145 };
146 
147 const BindingLocationCap *bindinglocations[] = {
148 	&longedge1,
149 	&longedge2,
150 	&shortedge1,
151 	&shortedge2
152 };
153 
154 const ColorCap color("Color", false, JobData::kColor);
155 const ColorCap monochrome("Shades of Gray", true, JobData::kMonochrome);
156 
157 const ColorCap *colors[] = {
158 	&color,
159 	&monochrome
160 };
161 
162 
163 int Lips4Cap::countCap(CapID capid) const
164 {
165 	switch (capid) {
166 	case kPaper:
167 		return sizeof(papers) / sizeof(papers[0]);
168 	case kPaperSource:
169 		return sizeof(papersources) / sizeof(papersources[0]);
170 	case kResolution:
171 		return sizeof(resolutions) / sizeof(resolutions[0]);
172 	case kPrintStyle:
173 		return sizeof(printstyles) / sizeof(printstyles[0]);
174 	case kBindingLocation:
175 		return sizeof(bindinglocations) / sizeof(bindinglocations[0]);
176 	case kColor:
177 		return sizeof(colors) / sizeof(colors[0]);
178 	default:
179 		return 0;
180 	}
181 }
182 
183 const BaseCap **Lips4Cap::enumCap(CapID capid) const
184 {
185 	switch (capid) {
186 	case kPaper:
187 		return (const BaseCap **)papers;
188 	case kPaperSource:
189 		return (const BaseCap **)papersources;
190 	case kResolution:
191 		return (const BaseCap **)resolutions;
192 	case kPrintStyle:
193 		return (const BaseCap **)printstyles;
194 	case kBindingLocation:
195 		return (const BaseCap **)bindinglocations;
196 	case kColor:
197 		return (const BaseCap **)colors;
198 	default:
199 		return NULL;
200 	}
201 }
202 
203 bool Lips4Cap::isSupport(CapID capid) const
204 {
205 	switch (capid) {
206 	case kPaper:
207 	case kPaperSource:
208 	case kResolution:
209 	case kPrintStyle:
210 	case kBindingLocation:
211 	case kColor:
212 	case kCopyCommand:
213 		return true;
214 	default:
215 		return false;
216 	}
217 }
218