1 /*****************************************************************************\
2 apollo2xxx.cpp : Implimentation for the Apollo2xxx class
4 Copyright (c) 2000, 2001, Hewlett-Packard Co.
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions
10 1. Redistributions of source code must retain the above copyright
11 notice, this list of conditions and the following disclaimer.
12 2. Redistributions in binary form must reproduce the above copyright
13 notice, this list of conditions and the following disclaimer in the
14 documentation and/or other materials provided with the distribution.
15 3. Neither the name of Hewlett-Packard nor the names of its
16 contributors may be used to endorse or promote products derived
17 from this software without specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
20 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
22 NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
24 TO, PATENT INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
25 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 \*****************************************************************************/
32 #ifdef APDK_APOLLO2XXX
35 #include "apollo2xxx.h"
36 #include "printerproxy.h"
40 extern uint32_t ulMapDJ690_CMYK[ 9 * 9 * 9 ];
41 extern uint32_t ulMapDJ690_ClMlxx[ 9 * 9 * 9 ];
42 extern uint32_t ulMapDJ660_CCM_KCMY[ 9 * 9 * 9 ];
43 extern uint32_t ulMapDJ600_CCM_K[ 9 * 9 * 9 ];
44 extern uint32_t ulMapDJ600_CCM_CMY[ 9 * 9 * 9 ];
46 Apollo2xxx::Apollo2xxx(SystemServices* pSS, BOOL proto)
47 : Printer(pSS, NUM_DJ6XX_FONTS,proto)
50 if ((!proto) && (IOMode.bDevID))
52 constructor_error = VerifyPenInfo();
55 else ePen=BOTH_PENS; // matches default mode
57 CMYMap = ulMapDJ600_CCM_CMY; // used in Mode2xxxColor
59 pMode[DEFAULTMODE_INDEX] = new PrintMode(ulMapDJ660_CCM_KCMY); // normal color kcmy
60 pMode[SPECIALMODE_INDEX] = new Mode2xxxColor(); // normal color cmy
61 pMode[SPECIALMODE_INDEX+1] = new Mode2xxxPhoto(); // photo
62 pMode[GRAYMODE_INDEX] = new GrayMode2xxx(); // normal gray k
63 #ifdef APDK_EXTENDED_MEDIASIZE
64 pMode[SPECIALMODE_INDEX+2] = new Mode2xxxDraftGrayK();
65 pMode[SPECIALMODE_INDEX+3] = new Mode2xxxDraftColorKCMY();
66 pMode[SPECIALMODE_INDEX+4] = new Mode2xxxDraftColorCMY();
67 pMode[SPECIALMODE_INDEX+5] = new Mode2xxxBestGrayK();
73 DBG1("AP2xxx created\n");
77 DRIVER_ERROR Apollo2xxx::VerifyPenInfo()
79 DRIVER_ERROR err=NO_ERROR;
81 if(IOMode.bDevID == FALSE)
84 err = ParsePenInfo(ePen);
87 // check for the normal case
88 if (ePen == BOTH_PENS || ePen == MDL_BOTH || ePen == COLOR_PEN || ePen == BLACK_PEN)
91 DBG1("Apollo2xxx::VerifyPenInfo(): ePen is not BOTH_PENS, MDL_BOTH, COLOR_PEN, or BLACK_PEN\n");
93 // the 2100 printers require the color pen OR the black pen to be installed, so trap
94 // on any pen type that does not include either the color pen or black pen
95 while ( (ePen != BOTH_PENS) && (ePen != MDL_BOTH) && (ePen != COLOR_PEN) && (ePen != BLACK_PEN))
97 DBG1("Apollo2xxx::VerifyPenInfo(): in while loop\n");
102 // photopen installed, need to install color pen
103 pSS->DisplayPrinterStatus(DISPLAY_NO_COLOR_PEN);
106 // neither pen installed
108 pSS->DisplayPrinterStatus(DISPLAY_NO_PENS);
112 if (pSS->BusyWait(500) == JOB_CANCELED)
115 err = ParsePenInfo(ePen);
119 pSS->DisplayPrinterStatus(DISPLAY_PRINTING);
125 DRIVER_ERROR Apollo2xxx::ParsePenInfo(PEN_TYPE& ePen, BOOL QueryPrinter)
128 DRIVER_ERROR err = SetPenInfo(str, QueryPrinter);
133 return BAD_DEVICE_ID;
139 // check pen1, assume it is black or MDL, pen2 is color
142 // check for MDL in case someone wedged one in there
143 case 'M': temp_pen1 = MDL_PEN; break; // (M)ulti-Dye load pen
144 case 'C': temp_pen1 = BLACK_PEN; break; // (C)andide black
145 default: temp_pen1 = NO_PEN; break;
151 while(i < DevIDBuffSize && str[i]!='$') i++; // handles variable length penIDs
153 if (i == DevIDBuffSize)
155 return BAD_DEVICE_ID;
160 if(str[i]=='R') // we have the (R)obinhood color pen,
161 // check what pen1 was
163 if (temp_pen1 == BLACK_PEN)
167 if (temp_pen1 == MDL_PEN)
173 else // no color pen, just set what pen1 was
180 Mode2xxxPhoto::Mode2xxxPhoto()
181 // print mode for photo pen
182 : PrintMode(ulMapDJ690_CMYK,ulMapDJ690_ClMlxx)
185 medium = mediaSpecial;
186 theQuality = qualityNormal;
188 pmQuality=QUALITY_BEST;
189 pmMediaType=MEDIA_PREMIUM;
193 for (int i=0; i < 6; i++)
196 CompatiblePens[0] = MDL_BOTH;
198 // strcpy(ModeName, "Photo");
202 Mode2xxxColor::Mode2xxxColor()
203 : PrintMode(ulMapDJ600_CCM_CMY)
206 CompatiblePens[0] = COLOR_PEN; // only color pen allowed
208 // strcpy(ModeName, "Color");
211 GrayMode2xxx::GrayMode2xxx()
212 // print mode for photo pen
213 : PrintMode( ulMapDJ600_CCM_K )
215 CompatiblePens[1] = MDL_BOTH;
222 #ifdef APDK_EXTENDED_MEDIASIZE
223 Mode2xxxDraftColorKCMY::Mode2xxxDraftColorKCMY()
224 : PrintMode( ulMapDJ660_CCM_KCMY )
226 theQuality = qualityDraft;
228 pmQuality = QUALITY_DRAFT;
231 Mode2xxxDraftGrayK::Mode2xxxDraftGrayK()
232 : PrintMode(ulMapDJ600_CCM_K)
234 CompatiblePens[1] = MDL_BOTH;
237 theQuality = qualityDraft;
238 pmQuality = QUALITY_DRAFT;
241 Mode2xxxDraftColorCMY::Mode2xxxDraftColorCMY()
242 : PrintMode( ulMapDJ600_CCM_CMY )
245 CompatiblePens[0] = COLOR_PEN; // only color pen allowed
246 theQuality = qualityDraft;
247 pmQuality = QUALITY_DRAFT;
250 Mode2xxxBestGrayK::Mode2xxxBestGrayK()
251 : GrayMode(ulMapDJ600_CCM_K)
253 theQuality = qualityPresentation;
254 pmQuality = QUALITY_BEST;
255 BaseResX = BaseResY = 600;
256 ResolutionX[0] = ResolutionY[0] = 600;
258 #endif // APDK_EXTENDED_MEDIASIZE
260 Header2xxx::Header2xxx(Printer* p,PrintContext* pc)
265 Header* Apollo2xxx::SelectHeader(PrintContext* pc)
267 return new Header2xxx(this,pc);
270 DRIVER_ERROR Header2xxx::Send()
275 // don't disable black extraction if we are in the color pen only mode
276 // since the printer may actually have both pens so we want the printer
277 // to print the K with the K pen if it actually has one
279 if (thePrintMode->dyeCount != 3)
281 err = thePrinter->Send((const BYTE*)BlackExtractOff,
282 sizeof(BlackExtractOff));
286 err = ConfigureRasterData();
289 if (ResolutionY[0] == 600)
292 sprintf(uom,"%c%c%c%d%c",ESC,'&','u',thePrintMode->ResolutionY[K],'D');
293 err=thePrinter->Send((const BYTE*)uom, 7 );
297 err=Graphics(); // start raster graphics and set compression mode
304 #endif //APDK_APOLLO2XXX