1 /*****************************************************************************\
2 dj630.cpp : Implimentation for the DJ630 class
4 Copyright (c) 1996 - 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 \*****************************************************************************/
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 ];
47 DJ630::DJ630(SystemServices* pSS, BOOL proto)
48 : Printer(pSS, NUM_DJ6XX_FONTS,proto)
51 if ((!proto) && (IOMode.bDevID))
53 constructor_error = VerifyPenInfo();
58 ePen=COLOR_PEN; // matches default mode
61 CMYMap = ulMapDJ600_CCM_CMY;
63 pMode[DEFAULTMODE_INDEX] = new Mode630Color(); // normal color CMY
64 pMode[SPECIALMODE_INDEX + 0] = new PrintMode(ulMapDJ660_CCM_KCMY); // normal color KCMY
65 pMode[SPECIALMODE_INDEX + 1] = new Mode630Photo(); // photo
66 pMode[GRAYMODE_INDEX] = new GrayMode630(ulMapDJ600_CCM_K); // normal gray K
67 #ifdef APDK_EXTENDED_MEDIASIZE
68 pMode[SPECIALMODE_INDEX+2] = new Mode630DraftGrayK();
69 pMode[SPECIALMODE_INDEX+3] = new Mode630DraftColorKCMY();
70 pMode[SPECIALMODE_INDEX+4] = new Mode630DraftColorCMY();
71 pMode[SPECIALMODE_INDEX+5] = new Mode630BestGrayK();
77 DBG1("DJ630 created\n");
81 PEN_TYPE DJ630::DefaultPenSet()
86 GrayMode630::GrayMode630(uint32_t *map)
89 CompatiblePens[1] = BLACK_PEN;
90 CompatiblePens[2] = MDL_BOTH;
93 DRIVER_ERROR DJ630::VerifyPenInfo()
96 DRIVER_ERROR err=NO_ERROR;
98 if(IOMode.bDevID == FALSE)
101 err = ParsePenInfo(ePen);
104 // check for the normal case
105 if (ePen == BOTH_PENS || ePen == MDL_BOTH || ePen == COLOR_PEN)
108 DBG1("DJ630::VerifyPenInfo(): ePen is not BOTH_PENS, MDL_BOTH, or COLOR_PEN\n");
110 // the 630 printers require the color pen to be installed, so trap
111 // on any pen type that does not include the color pen
112 while ( (ePen != BOTH_PENS) && (ePen != MDL_BOTH) && (ePen != COLOR_PEN) )
114 DBG1("DJ630::VerifyPenInfo(): in while loop\n");
120 // black or photopen installed, need to install color pen
121 pSS->DisplayPrinterStatus(DISPLAY_NO_COLOR_PEN);
124 // neither pen installed
126 pSS->DisplayPrinterStatus(DISPLAY_NO_PENS);
130 if (pSS->BusyWait(500) == JOB_CANCELED)
133 err = ParsePenInfo(ePen);
137 pSS->DisplayPrinterStatus(DISPLAY_PRINTING);
143 DRIVER_ERROR DJ630::ParsePenInfo(PEN_TYPE& ePen, BOOL QueryPrinter)
146 DRIVER_ERROR err = SetPenInfo(str, QueryPrinter);
151 return BAD_DEVICE_ID;
157 // check pen1, assume it is black or MDL, pen2 is color
160 // check for MDL in case someone wedged one in there
161 case 'M': temp_pen1 = MDL_PEN; break; // (M)ulti-Dye load pen
162 case 'C': temp_pen1 = BLACK_PEN; break; // (C)andide black
163 default: temp_pen1 = NO_PEN; break;
169 while((i < DevIDBuffSize) && str[i]!='$') i++; // handles variable length penIDs
170 if (i == DevIDBuffSize)
172 return BAD_DEVICE_ID;
177 if(str[i]=='R') // we have the (R)obinhood color pen,
178 // check what pen1 was
180 if (temp_pen1 == BLACK_PEN)
184 if (temp_pen1 == MDL_PEN)
190 else // no color pen, just set what pen1 was
197 Mode630Photo::Mode630Photo()
198 // print mode for photo pen
199 : PrintMode(ulMapDJ690_CMYK,ulMapDJ690_ClMlxx)
202 medium = mediaSpecial;
203 theQuality = qualityNormal;
207 for (int i=0; i < 6; i++)
210 CompatiblePens[0] = MDL_BOTH;
212 pmQuality=QUALITY_BEST;
213 pmMediaType=MEDIA_PREMIUM;
215 // strcpy(ModeName, "Photo");
219 Mode630Color::Mode630Color()
220 : PrintMode(ulMapDJ600_CCM_CMY)
223 CompatiblePens[0] = COLOR_PEN; // only color pen allowed
225 // strcpy(ModeName, "Color");
228 #ifdef APDK_EXTENDED_MEDIASIZE
229 Mode630DraftColorKCMY::Mode630DraftColorKCMY()
230 : PrintMode( ulMapDJ660_CCM_KCMY )
232 theQuality = qualityDraft;
234 pmQuality = QUALITY_DRAFT;
237 Mode630DraftGrayK::Mode630DraftGrayK()
238 : GrayMode(ulMapDJ600_CCM_K)
240 theQuality = qualityDraft;
241 pmQuality = QUALITY_DRAFT;
244 Mode630DraftColorCMY::Mode630DraftColorCMY()
245 : PrintMode( ulMapDJ600_CCM_CMY )
248 CompatiblePens[0] = COLOR_PEN; // only color pen allowed
249 theQuality = qualityDraft;
250 pmQuality = QUALITY_DRAFT;
253 Mode630BestGrayK::Mode630BestGrayK()
254 : GrayMode(ulMapDJ600_CCM_K)
256 theQuality = qualityPresentation;
257 pmQuality = QUALITY_BEST;
259 ResolutionX[0] = 600;
260 #ifdef APDK_HIGH_RES_MODES
262 ResolutionY[0] = 600;
265 ResolutionY[0] = 300;
268 #endif // APDK_EXTENDED_MEDIASIZE
270 Header630::Header630(Printer* p,PrintContext* pc)
274 Header* DJ630::SelectHeader(PrintContext* pc)
276 return new Header630(this,pc);
279 DRIVER_ERROR Header630::Send()
284 // don't disable black extraction if we are in the color pen only mode
285 // since the printer may actually have both pens so we want the printer
286 // to print the K with the K pen if it actually has one
287 if (thePrintMode->dyeCount != 3)
289 err = thePrinter->Send((const BYTE*)BlackExtractOff,
290 sizeof(BlackExtractOff)); // just pertains to 2-pen
294 err = ConfigureRasterData();
297 if (ResolutionY[0] == 600)
300 sprintf(uom,"%c%c%c%d%c",ESC,'&','u',thePrintMode->ResolutionY[K],'D');
301 err=thePrinter->Send((const BYTE*)uom, 7 );
305 err=Graphics(); // start raster graphics and set compression mode