xref: /haiku/src/add-ons/print/drivers/canon_lips/lips3/Lips3Cap.cpp (revision 5d9e40fe9252c8f9c5e5e41594545bfa4419fcc7)
1 /*
2  * Lips3Cap.cpp
3  * Copyright 1999-2000 Y.Takagi. All Rights Reserved.
4  */
5 
6 #include "PrinterData.h"
7 #include "Lips3Cap.h"
8 
9 #define TO72DPI(a)	(a * 72.0f / 600.0f)
10 
11 const PaperCap a3(
12 	"A3",
13 	false,
14 	JobData::kA3,
15 	BRect(0.0f,            0.0f,            TO72DPI(7014.0f), TO72DPI(9920.0f)),
16 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6894.0f), TO72DPI(9800.0f)));
17 
18 const PaperCap a4(
19 	"A4",
20 	true,
21 	JobData::kA4,
22 	BRect(0.0f,            0.0f,            TO72DPI(4960.0f), TO72DPI(7014.0f)),
23 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4840.0f), TO72DPI(6894.0f)));
24 
25 const PaperCap a5(
26 	"A5",
27 	false,
28 	JobData::kA5,
29 	BRect(0.0f,            0.0f,            TO72DPI(3506.0f), TO72DPI(4960.0f)),
30 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(3386.0f), TO72DPI(4840.0f)));
31 
32 const PaperCap japanese_postcard(
33 	"Japanese Postcard",
34 	false,
35 	JobData::kJapanesePostcard,
36 	BRect(0.0f,           0.0f,             TO72DPI(2362.0f), TO72DPI(3506.0f)),
37 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(2242.0f), TO72DPI(3386.0f)));
38 
39 const PaperCap b4(
40 	"B4",
41 	false,
42 	JobData::kB4,
43 	BRect(0.0f,            0.0f,            TO72DPI(6070.0f), TO72DPI(8598.0f)),
44 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(5950.0f), TO72DPI(8478.0f)));
45 
46 const PaperCap b5(
47 	"B5",
48 	false,
49 	JobData::kB5,
50 	BRect(0.0f,            0.0f,            TO72DPI(4298.0f), TO72DPI(6070.0f)),
51 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4178.0f), TO72DPI(5950.0f)));
52 
53 const PaperCap letter(
54 	"Letter",
55 	false,
56 	JobData::kLetter,
57 	BRect(0.0f,            0.0f,            TO72DPI(5100.0f), TO72DPI(6600.0f)),
58 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(6480.0f)));
59 
60 const PaperCap legal(
61 	"Legal",
62 	false,
63 	JobData::kLegal,
64 	BRect(0.0f,            0.0f,            TO72DPI(5100.0f), TO72DPI(8400.0f)),
65 	BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4980.0f), TO72DPI(8280.0f)));
66 
67 const PaperSourceCap autobin("Auto",  true,  JobData::kAuto);
68 const PaperSourceCap manual("Manual", false, JobData::kManual);
69 const PaperSourceCap upper("Upper",   false, JobData::kUpper);
70 const PaperSourceCap lower("Lower",   false, JobData::kLower);
71 
72 const ResolutionCap dpi300("300dpi",   true, 300,  300);
73 
74 const PaperCap *papers[] = {
75 	&a4,
76 	&a3,
77 	&a5,
78 	&b4,
79 	&b5,
80 	&letter,
81 	&legal
82 };
83 
84 const PaperSourceCap *papersources[] = {
85 	&autobin,
86 	&manual,
87 	&upper,
88 	&lower
89 };
90 
91 const ResolutionCap *resolutions[] = {
92 	&dpi300
93 };
94 
95 const ColorCap color("Color", false, JobData::kColor);
96 const ColorCap monochrome("Monochrome", true, JobData::kMonochrome);
97 
98 const ColorCap *colors[] = {
99 	&color,
100 	&monochrome
101 };
102 
103 Lips3Cap::Lips3Cap(const PrinterData *printer_data)
104 	: PrinterCap(printer_data)
105 {
106 }
107 
108 int Lips3Cap::countCap(CapID capid) const
109 {
110 	switch (capid) {
111 	case kPaper:
112 		return sizeof(papers) / sizeof(papers[0]);
113 	case kPaperSource:
114 		return sizeof(papersources) / sizeof(papersources[0]);
115 	case kResolution:
116 		return sizeof(resolutions) / sizeof(resolutions[0]);
117 	case kColor:
118 		return sizeof(colors) / sizeof(colors[0]);
119 	default:
120 		return 0;
121 	}
122 }
123 
124 const BaseCap **Lips3Cap::enumCap(CapID capid) const
125 {
126 	switch (capid) {
127 	case kPaper:
128 		return (const BaseCap **)papers;
129 	case kPaperSource:
130 		return (const BaseCap **)papersources;
131 	case kResolution:
132 		return (const BaseCap **)resolutions;
133 	case kColor:
134 		return (const BaseCap **)colors;
135 	default:
136 		return NULL;
137 	}
138 }
139 
140 bool Lips3Cap::isSupport(CapID capid) const
141 {
142 	switch (capid) {
143 	case kPaper:
144 	case kPaperSource:
145 	case kResolution:
146 	case kColor:
147 		return true;
148 	default:
149 		return false;
150 	}
151 }
152