1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
|
/*****************************************************************************\
dj600.cpp : Implimentation for the DJ600 class
Copyright (c) 1996 - 2015, HP Co.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of HP nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PATENT INFRINGEMENT; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\*****************************************************************************/
#ifdef APDK_DJ600
#include "header.h"
#include "dj6xx.h"
#include "dj600.h"
#include "printerproxy.h"
APDK_BEGIN_NAMESPACE
extern uint32_t ulMapDJ600_CCM_K[ 9 * 9 * 9 ];
extern uint32_t ulMapDJ600_CCM_CMY[ 9 * 9 * 9 ];
//
// ** DJ600:Printer CLASS **
//
Mode600::Mode600()
: PrintMode( ulMapDJ600_CCM_CMY )
{
dyeCount=3;
CompatiblePens[0] = COLOR_PEN; // only color pen allowed
}
#ifdef APDK_EXTENDED_MEDIASIZE
Mode600DraftColor::Mode600DraftColor()
: PrintMode( ulMapDJ600_CCM_CMY )
{
dyeCount=3;
CompatiblePens[0] = COLOR_PEN; // only color pen allowed
theQuality = qualityDraft;
pmQuality = QUALITY_DRAFT;
}
Mode600DraftGrayK::Mode600DraftGrayK()
: GrayMode(ulMapDJ600_CCM_K)
{
theQuality = qualityDraft;
pmQuality = QUALITY_DRAFT;
}
Mode600BestGrayK::Mode600BestGrayK()
: GrayMode(ulMapDJ600_CCM_K)
{
theQuality = qualityPresentation;
pmQuality = QUALITY_BEST;
BaseResX = 600;
ResolutionX[0] = 600;
#ifdef APDK_HIGH_RES_MODES
BaseResY = 600;
ResolutionY[0] = 600;
#else
BaseResY = 300;
ResolutionY[0] = 300;
#endif
}
#endif // APDK_EXTENDED_MEDIASIZE
DJ600::DJ600(SystemServices* pSS, BOOL proto)
: DJ6XX(pSS, NUM_DJ6XX_FONTS,proto)
{
if ((!proto) && (IOMode.bDevID))
{
constructor_error = VerifyPenInfo();
CERRCHECK;
}
else
{
ePen=COLOR_PEN; // matches default mode
}
CMYMap = ulMapDJ600_CCM_CMY;
pMode[DEFAULTMODE_INDEX] = new Mode600();
pMode[GRAYMODE_INDEX] = new GrayMode(ulMapDJ600_CCM_K);
#ifdef APDK_EXTENDED_MEDIASIZE
pMode[SPECIALMODE_INDEX] = new Mode600DraftGrayK();
pMode[SPECIALMODE_INDEX+1] = new Mode600DraftColor();
pMode[SPECIALMODE_INDEX+2] = new Mode600BestGrayK();
#endif
DBG1("DeskJet 600 created\n");
}
PEN_TYPE DJ600::DefaultPenSet()
{
return COLOR_PEN;
}
Header600::Header600(Printer* p,PrintContext* pc)
: Header6XX(p,pc)
{ }
DRIVER_ERROR Header600::Send()
// Sends 600-style header to printer.
{ DRIVER_ERROR err;
StartSend();
if (dyeCount==3) // color pen
{
err = ConfigureRasterData();
ERRCHECK;
}
else // black pen
{
err=Simple(); // set color mode and resolution
ERRCHECK;
}
err=Graphics(); // start raster graphics and set compression mode
return err;
}
Header* DJ600::SelectHeader(PrintContext* pc)
{
return new Header600(this,pc);
}
DRIVER_ERROR DJ600::VerifyPenInfo()
{
DRIVER_ERROR err=NO_ERROR;
if(IOMode.bDevID == FALSE)
return err;
err = ParsePenInfo(ePen);
ERRCHECK;
if (ePen == BLACK_PEN || ePen == COLOR_PEN)
// pen was recognized
{
return NO_ERROR;
}
// BLACK_PEN and COLOR_PEN are the only valid pens, so loop and
// display error message until user cancels or a valid pen installed
while(ePen != BLACK_PEN && ePen != COLOR_PEN)
{
pSS->DisplayPrinterStatus(DISPLAY_NO_PEN_DJ600);
if(pSS->BusyWait(500) == JOB_CANCELED)
{
return JOB_CANCELED;
}
err = ParsePenInfo(ePen);
ERRCHECK;
}
pSS->DisplayPrinterStatus(DISPLAY_PRINTING);
// The 600 will report OFFLINE for a while after the
// pen has been installed. Let's wait for it to
// come online and not confuse the user with a potentially
// bogus OFFLINE message
if (pSS->BusyWait((DWORD)1000) == JOB_CANCELED)
return JOB_CANCELED;
return NO_ERROR;
}
DRIVER_ERROR DJ600::ParsePenInfo(PEN_TYPE& ePen, BOOL QueryPrinter)
{
char* c;
DRIVER_ERROR err = SetPenInfo(c, QueryPrinter);
ERRCHECK;
if (*c != '$')
{
return BAD_DEVICE_ID;
}
c++; // skip $
// parse penID
if(c[0] == 'R') // (R)obinhood color
ePen = COLOR_PEN;
else if(c[0] == 'C') // (C)andide black
ePen = BLACK_PEN;
else ePen = NO_PEN;
return NO_ERROR;
}
APDK_END_NAMESPACE
#endif //APDK_DJ600
|