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