1 /* 2 * Lips4Cap.cpp 3 * Copyright 1999-2000 Y.Takagi. All Rights Reserved. 4 */ 5 6 7 #include "Lips4Cap.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 PaperCap tabloid( 68 "Tabloid", 69 false, 70 JobData::kTabloid, 71 BRect(0.0f, 0.0f, TO72DPI(6600.0), TO72DPI(10200.0)), 72 BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(6480.0), TO72DPI(10080.0))); 73 74 const PaperCap executive( 75 "Executive", 76 false, 77 JobData::kExecutive, 78 BRect(0.0f, 0.0f, TO72DPI(4350.0f), TO72DPI(6300.0f)), 79 BRect(TO72DPI(120.0f), TO72DPI(120.0f), TO72DPI(4230.0f), TO72DPI(6180.0f))); 80 81 const PaperCap japanese_envelope_you4( 82 "Japanese Envelope You#4", 83 false, 84 JobData::kJEnvYou4, 85 BRect(0.0f, 0.0f, TO72DPI(2480.0f), TO72DPI(5550.0f)), 86 BRect(TO72DPI(236.0f), TO72DPI(236.0f), TO72DPI(2244.0f), TO72DPI(5314.0f))); 87 /* 88 const PaperCap japanese_envelope_kaku2( 89 "Japanese Envelope Kaku#2", 90 false, 91 JobData::kJEnvKaku2, 92 BRect(0.0f, 0.0f, TO72DPI(5568.0f), TO72DPI(7842.0f)), 93 BRect(TO72DPI(236.0f), TO72DPI(236.0f), TO72DPI(5432.0f), TO72DPI(7606.0f))); 94 */ 95 const PaperSourceCap autobin("Auto", true, JobData::kAuto); 96 const PaperSourceCap manual("Manual", false, JobData::kManual); 97 const PaperSourceCap upper("Upper", false, JobData::kUpper); 98 const PaperSourceCap middle("Middle", false, JobData::kMiddle); 99 const PaperSourceCap lower("Lower", false, JobData::kLower); 100 101 const ResolutionCap dpi1200("1200dpi", false, 0, 1200, 1200); 102 const ResolutionCap dpi600("600dpi", true, 1, 600, 600); 103 const ResolutionCap dpi300("300dpi", false, 2, 300, 300); 104 105 const PrintStyleCap simplex("Simplex", true, JobData::kSimplex); 106 const PrintStyleCap duplex("Duplex", false, JobData::kDuplex); 107 const PrintStyleCap booklet("Booklet", false, JobData::kBooklet); 108 109 const BindingLocationCap longedge1("Long Edge (left)", true, 110 JobData::kLongEdgeLeft); 111 const BindingLocationCap longedge2("Long Edge (right)", false, 112 JobData::kLongEdgeRight); 113 const BindingLocationCap shortedge1("Short Edge (top)", false, 114 JobData::kShortEdgeTop); 115 const BindingLocationCap shortedge2("Short Edge (bottom)", false, 116 JobData::kShortEdgeBottom); 117 118 const PaperCap* papers[] = { 119 &a4, 120 &a3, 121 &a5, 122 &b4, 123 &b5, 124 &letter, 125 &legal, 126 &tabloid, 127 &executive, 128 &japanese_postcard, 129 &japanese_envelope_you4 130 }; 131 132 const PaperSourceCap* papersources[] = { 133 &autobin, 134 &manual, 135 &upper, 136 &middle, 137 &lower 138 }; 139 140 const ResolutionCap* resolutions[] = { 141 &dpi1200, 142 &dpi600, 143 &dpi300 144 }; 145 146 const PrintStyleCap* printstyles[] = { 147 &simplex, 148 &duplex, 149 &booklet 150 }; 151 152 const BindingLocationCap *bindinglocations[] = { 153 &longedge1, 154 &longedge2, 155 &shortedge1, 156 &shortedge2 157 }; 158 159 const ColorCap color("Color", false, JobData::kColor); 160 const ColorCap monochrome("Shades of Gray", true, JobData::kMonochrome); 161 162 const ColorCap* colors[] = { 163 &color, 164 &monochrome 165 }; 166 167 168 int 169 Lips4Cap::CountCap(CapID capid) const 170 { 171 switch (capid) { 172 case kPaper: 173 return sizeof(papers) / sizeof(papers[0]); 174 case kPaperSource: 175 return sizeof(papersources) / sizeof(papersources[0]); 176 case kResolution: 177 return sizeof(resolutions) / sizeof(resolutions[0]); 178 case kPrintStyle: 179 return sizeof(printstyles) / sizeof(printstyles[0]); 180 case kBindingLocation: 181 return sizeof(bindinglocations) / sizeof(bindinglocations[0]); 182 case kColor: 183 return sizeof(colors) / sizeof(colors[0]); 184 default: 185 return 0; 186 } 187 } 188 189 190 const BaseCap** 191 Lips4Cap::GetCaps(CapID capid) const 192 { 193 switch (capid) { 194 case kPaper: 195 return (const BaseCap **)papers; 196 case kPaperSource: 197 return (const BaseCap **)papersources; 198 case kResolution: 199 return (const BaseCap **)resolutions; 200 case kPrintStyle: 201 return (const BaseCap **)printstyles; 202 case kBindingLocation: 203 return (const BaseCap **)bindinglocations; 204 case kColor: 205 return (const BaseCap **)colors; 206 default: 207 return NULL; 208 } 209 } 210 211 212 bool 213 Lips4Cap::Supports(CapID capid) const 214 { 215 switch (capid) { 216 case kPaper: 217 case kPaperSource: 218 case kResolution: 219 case kPrintStyle: 220 case kBindingLocation: 221 case kColor: 222 case kCopyCommand: 223 case kHalftone: 224 return true; 225 default: 226 return false; 227 } 228 } 229