1 /* 2 * PCL6Cap.cpp 3 * Copyright 1999-2000 Y.Takagi. All Rights Reserved. 4 */ 5 6 #include "PrinterData.h" 7 #include "PCL6Cap.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 69 const ResolutionCap dpi300("300dpi", true, 300, 300); 70 const ResolutionCap dpi600("600dpi", false, 600, 600); 71 const ResolutionCap dpi1200("1200dpi", false, 1200, 1200); 72 73 const PaperCap *papers[] = { 74 &a4, 75 &a3, 76 &a5, 77 &b4, 78 &b5, 79 &letter, 80 &legal 81 }; 82 83 const PaperSourceCap *papersources[] = { 84 &autobin, 85 }; 86 87 const ResolutionCap *resolutions[] = { 88 &dpi300, 89 &dpi600, 90 &dpi1200, 91 }; 92 93 const ColorCap color("Color", false, JobData::kColor); 94 const ColorCap monochrome("Monochrome", true, JobData::kMonochrome); 95 96 const ColorCap *colors[] = { 97 &color, 98 &monochrome 99 }; 100 101 PCL6Cap::PCL6Cap(const PrinterData *printer_data) 102 : PrinterCap(printer_data) 103 { 104 } 105 106 int PCL6Cap::countCap(CapID capid) const 107 { 108 switch (capid) { 109 case kPaper: 110 return sizeof(papers) / sizeof(papers[0]); 111 case kPaperSource: 112 return sizeof(papersources) / sizeof(papersources[0]); 113 case kResolution: 114 return sizeof(resolutions) / sizeof(resolutions[0]); 115 case kColor: 116 return sizeof(colors) / sizeof(colors[0]); 117 default: 118 return 0; 119 } 120 } 121 122 const BaseCap **PCL6Cap::enumCap(CapID capid) const 123 { 124 switch (capid) { 125 case kPaper: 126 return (const BaseCap **)papers; 127 case kPaperSource: 128 return (const BaseCap **)papersources; 129 case kResolution: 130 return (const BaseCap **)resolutions; 131 case kColor: 132 return (const BaseCap **)colors; 133 default: 134 return NULL; 135 } 136 } 137 138 bool PCL6Cap::isSupport(CapID capid) const 139 { 140 switch (capid) { 141 case kPaper: 142 case kPaperSource: 143 case kResolution: 144 case kColor: 145 return true; 146 default: 147 return false; 148 } 149 } 150