1 /*****************************************************************************\
2 dj540.cpp : Implimentation for the DJ540 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 \*****************************************************************************/
38 #include "printerproxy.h"
42 extern uint32_t ulMapDJ600_CCM_K[ 9 * 9 * 9 ];
43 extern uint32_t ulMapDJ600_CCM_CMY[ 9 * 9 * 9 ];
45 // ** DJ540:Printer CLASS **
47 DJ540::DJ540(SystemServices* pSS, BOOL proto)
48 : DJ6XX(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;
62 pMode[DEFAULTMODE_INDEX] = new Mode600();
63 pMode[GRAYMODE_INDEX] = new GrayMode(ulMapDJ600_CCM_K);
64 #ifdef APDK_EXTENDED_MEDIASIZE
65 pMode[SPECIALMODE_INDEX] = new Mode600DraftGrayK();
66 pMode[SPECIALMODE_INDEX+1] = new Mode600DraftColor();
72 DBG1("DeskJet 540 created\n");
75 PEN_TYPE DJ540::DefaultPenSet()
80 Header540::Header540(Printer* p,PrintContext* pc)
84 DRIVER_ERROR Header540::Send()
85 // Sends 540-style header to printer.
86 // Identical to 600 Send except StartSend() has been removed.
87 // Removed ConfigureRasterData() to be downword compatable with 400 (uni-di only). des
90 // modes & margins are specified in StartSend - which the 540 doesn't call
91 err=Modes(); // Set media source, type, size and quality modes.
94 err=Margins(); // set margins
97 err=Simple(); // set color mode and resolution
100 err=Graphics(); // start raster graphics and set compression mode
105 Header* DJ540::SelectHeader(PrintContext* pc)
107 return new Header540(this,pc);
110 DRIVER_ERROR DJ540::VerifyPenInfo()
111 // note: this function is identical to 600::VerifyPenInfo
113 DRIVER_ERROR err = NO_ERROR;
115 if(IOMode.bDevID == FALSE)
118 err = ParsePenInfo(ePen);
121 if(ePen == BLACK_PEN || ePen == COLOR_PEN)
122 // pen was recognized
127 // BLACK_PEN and COLOR_PEN are the only valid pens, so loop and
128 // display error message until user cancels or a valid pen installed
129 while(ePen != BLACK_PEN && ePen != COLOR_PEN)
131 pSS->DisplayPrinterStatus(DISPLAY_NO_PEN_DJ600);
133 if(pSS->BusyWait(500) == JOB_CANCELED)
138 err = ParsePenInfo(ePen);
142 pSS->DisplayPrinterStatus(DISPLAY_PRINTING);
144 // The 600/?540? will report OFFLINE for a while after the
145 // pen has been installed. Let's wait for it to
146 // come online and not confuse the user with a potentially
147 // bogus OFFLINE message
149 if (pSS->BusyWait((DWORD)1000) == JOB_CANCELED)
157 DRIVER_ERROR DJ540::ParsePenInfo(PEN_TYPE& ePen, BOOL QueryPrinter)
160 DRIVER_ERROR err = SetPenInfo(c, QueryPrinter);
165 return BAD_DEVICE_ID;
172 if(c[0] == 'D') // D = kukla color pen
176 else if(c[0] == 'E') // E = triad black pen