1 /*****************************************************************************\
2 dj600.cpp : Implimentation for the DJ600 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 \*****************************************************************************/
37 #include "printerproxy.h"
41 extern uint32_t ulMapDJ600_CCM_K[ 9 * 9 * 9 ];
42 extern uint32_t ulMapDJ600_CCM_CMY[ 9 * 9 * 9 ];
44 // ** DJ600:Printer CLASS **
48 : PrintMode( ulMapDJ600_CCM_CMY )
51 CompatiblePens[0] = COLOR_PEN; // only color pen allowed
54 #ifdef APDK_EXTENDED_MEDIASIZE
55 Mode600DraftColor::Mode600DraftColor()
56 : PrintMode( ulMapDJ600_CCM_CMY )
59 CompatiblePens[0] = COLOR_PEN; // only color pen allowed
60 theQuality = qualityDraft;
61 pmQuality = QUALITY_DRAFT;
64 Mode600DraftGrayK::Mode600DraftGrayK()
65 : GrayMode(ulMapDJ600_CCM_K)
67 theQuality = qualityDraft;
68 pmQuality = QUALITY_DRAFT;
71 Mode600BestGrayK::Mode600BestGrayK()
72 : GrayMode(ulMapDJ600_CCM_K)
74 theQuality = qualityPresentation;
75 pmQuality = QUALITY_BEST;
78 #ifdef APDK_HIGH_RES_MODES
86 #endif // APDK_EXTENDED_MEDIASIZE
88 DJ600::DJ600(SystemServices* pSS, BOOL proto)
89 : DJ6XX(pSS, NUM_DJ6XX_FONTS,proto)
91 if ((!proto) && (IOMode.bDevID))
93 constructor_error = VerifyPenInfo();
98 ePen=COLOR_PEN; // matches default mode
101 CMYMap = ulMapDJ600_CCM_CMY;
103 pMode[DEFAULTMODE_INDEX] = new Mode600();
104 pMode[GRAYMODE_INDEX] = new GrayMode(ulMapDJ600_CCM_K);
105 #ifdef APDK_EXTENDED_MEDIASIZE
106 pMode[SPECIALMODE_INDEX] = new Mode600DraftGrayK();
107 pMode[SPECIALMODE_INDEX+1] = new Mode600DraftColor();
108 pMode[SPECIALMODE_INDEX+2] = new Mode600BestGrayK();
111 DBG1("DeskJet 600 created\n");
114 PEN_TYPE DJ600::DefaultPenSet()
119 Header600::Header600(Printer* p,PrintContext* pc)
123 DRIVER_ERROR Header600::Send()
124 // Sends 600-style header to printer.
129 if (dyeCount==3) // color pen
131 err = ConfigureRasterData();
136 err=Simple(); // set color mode and resolution
140 err=Graphics(); // start raster graphics and set compression mode
145 Header* DJ600::SelectHeader(PrintContext* pc)
147 return new Header600(this,pc);
150 DRIVER_ERROR DJ600::VerifyPenInfo()
152 DRIVER_ERROR err=NO_ERROR;
154 if(IOMode.bDevID == FALSE)
157 err = ParsePenInfo(ePen);
160 if (ePen == BLACK_PEN || ePen == COLOR_PEN)
161 // pen was recognized
166 // BLACK_PEN and COLOR_PEN are the only valid pens, so loop and
167 // display error message until user cancels or a valid pen installed
168 while(ePen != BLACK_PEN && ePen != COLOR_PEN)
170 pSS->DisplayPrinterStatus(DISPLAY_NO_PEN_DJ600);
172 if(pSS->BusyWait(500) == JOB_CANCELED)
177 err = ParsePenInfo(ePen);
181 pSS->DisplayPrinterStatus(DISPLAY_PRINTING);
183 // The 600 will report OFFLINE for a while after the
184 // pen has been installed. Let's wait for it to
185 // come online and not confuse the user with a potentially
186 // bogus OFFLINE message
188 if (pSS->BusyWait((DWORD)1000) == JOB_CANCELED)
195 DRIVER_ERROR DJ600::ParsePenInfo(PEN_TYPE& ePen, BOOL QueryPrinter)
198 DRIVER_ERROR err = SetPenInfo(c, QueryPrinter);
203 return BAD_DEVICE_ID;
209 if(c[0] == 'R') // (R)obinhood color
211 else if(c[0] == 'C') // (C)andide black