Tizen 2.1 base
[platform/upstream/hplip.git] / prnt / hpijs / psp100.cpp
1 /*****************************************************************************\
2   psp100.cpp : Implimentation for the PSP100 class
3
4   Copyright (c) 2001, Hewlett-Packard Co.
5   All rights reserved.
6
7   Redistribution and use in source and binary forms, with or without
8   modification, are permitted provided that the following conditions
9   are met:
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.
18
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 \*****************************************************************************/
30
31 #if defined(APDK_PSP100) && defined (APDK_DJ9xxVIP)
32
33 #include "header.h"
34 #include "dj9xxvip.h"
35 #include "psp100.h"
36 #include "printerproxy.h"
37
38 APDK_BEGIN_NAMESPACE
39
40 // PhotoSmart 100 - AtomAnt
41 PSP100::PSP100 (SystemServices* pSS, BOOL proto)
42     : DJ9xxVIP (pSS, proto)
43 {
44
45     for (unsigned int i = 0; i < ModeCount; i++)
46     {
47         if (pMode[i])
48             delete pMode[i];
49         pMode[i] = NULL;
50     }
51
52     ePen = COLOR_PEN;
53
54     if (!proto && IOMode.bDevID)
55     {
56         bCheckForCancelButton = TRUE;
57         constructor_error = VerifyPenInfo ();
58         CERRCHECK;
59     }
60
61     pMode[GRAYMODE_INDEX]    = new GrayModePSP100 ();
62     pMode[DEFAULTMODE_INDEX] = new PSP100Mode ();
63         pMode[SPECIALMODE_INDEX] = new PSP100NormalMode ();
64
65     ModeCount = 3;
66
67 #ifdef APDK_AUTODUPLEX
68     bDuplexCapable = FALSE;
69 #endif
70 #ifdef APDK_EXTENDED_MEDIASIZE
71     pMode[SPECIALMODE_INDEX+1] = new PSP1002400Mode ();
72     ModeCount = 4;
73 #endif
74
75 } //PSP100
76
77
78 GrayModePSP100::GrayModePSP100 ()
79     : PrintMode(NULL)
80 {
81 #if defined(APDK_VIP_COLORFILTERING)
82     Config.bErnie=TRUE;
83 #endif
84
85     Config.bColorImage=FALSE;
86
87 /*
88  *  The resolutions here are set to 300 for better performance from Cameras.
89  *  REVISIT: Must provide a true 600 dpi printmode later.
90  *  12/21/01
91  *
92  *  See not in dj9xxvip.cpp - 1/9/2002 - JLM
93  */
94
95     BaseResX       =
96     BaseResY       =
97     TextRes        =
98     ResolutionX[0] =
99     ResolutionY[0] = VIP_BASE_RES;
100     medium = mediaGlossy;
101     CompatiblePens[0] = COLOR_PEN;
102     theQuality = qualityPresentation;
103     bFontCapable = FALSE;
104     pmColor = GREY_CMY;
105 } //GrayModePSP100
106
107
108 PEN_TYPE PSP100::DefaultPenSet()
109 { return COLOR_PEN; }
110
111
112 PSP100Mode::PSP100Mode () : PrintMode (NULL)
113 {
114
115 /*
116  *  See comments above regarding 300/600 dpi change
117  */
118
119     BaseResX = BaseResY = TextRes = ResolutionX[0] = ResolutionY[0] = VIP_BASE_RES;
120
121 #if defined(APDK_VIP_COLORFILTERING)
122     Config.bErnie = TRUE;
123 #endif
124
125     Config.bColorImage = FALSE;
126
127     medium = mediaGlossy;
128     theQuality = qualityPresentation;
129         pmQuality   = QUALITY_BEST;
130     pmMediaType = MEDIA_PHOTO;
131     CompatiblePens[0] = COLOR_PEN;
132     bFontCapable = FALSE;
133 } //PSP100Mode
134
135 PSP100NormalMode::PSP100NormalMode () : PrintMode (NULL)
136 {
137
138 /*
139  *  See comments above regarding 300/600 dpi change
140  */
141
142     BaseResX = BaseResY = TextRes = ResolutionX[0] = ResolutionY[0] = VIP_BASE_RES;
143
144 #if defined(APDK_VIP_COLORFILTERING)
145     Config.bErnie = TRUE;
146 #endif
147
148     Config.bColorImage = FALSE;
149
150     medium = mediaSpecial;
151     theQuality = qualityNormal;
152     CompatiblePens[0] = COLOR_PEN;
153     bFontCapable = FALSE;
154 } //PSP100Mode
155
156 #ifdef APDK_EXTENDED_MEDIASIZE
157 PSP1002400Mode::PSP1002400Mode () : PrintMode (NULL)
158 {
159
160 /*
161  *  See comments above regarding 300/600 dpi change
162  */
163
164     BaseResX = BaseResY = TextRes = ResolutionX[0] = ResolutionY[0] = 1200;
165
166 #if defined(APDK_VIP_COLORFILTERING)
167     Config.bErnie = TRUE;
168 #endif
169
170     Config.bColorImage = FALSE;
171
172     medium = mediaHighresPhoto;
173     theQuality = qualityPresentation;
174     pmMediaType = MEDIA_PHOTO;
175     pmQuality = QUALITY_HIGHRES_PHOTO;
176     CompatiblePens[0] = COLOR_PEN;
177     bFontCapable = FALSE;
178 } //PSP1002400Mode
179 #endif
180
181 PAPER_SIZE PSP100::MandatoryPaperSize ()
182 {
183     return A6;
184    // return PHOTO_5x7;
185 } //MandantoryPaperSize
186
187
188 BOOL PSP100::UseGUIMode
189 (
190     PrintMode* pPrintMode
191 )
192 {
193     return TRUE;
194 } //UseGUIMode
195
196
197 DRIVER_ERROR PSP100::VerifyPenInfo ()
198 {
199     DRIVER_ERROR err = NO_ERROR;
200
201     if(IOMode.bDevID == FALSE)
202     {
203         return err;
204     }
205     ePen = NO_PEN;
206     char    *str;
207     while (ePen == NO_PEN)
208     {
209         err = SetPenInfo (str, TRUE);
210         ERRCHECK;
211
212         if (*(str-1) == '1' && *(str-2) == '1')
213         {
214             pSS->DisplayPrinterStatus (DISPLAY_NO_PENS);
215         }
216         else
217         {
218             ePen = COLOR_PEN;
219             break;
220         }
221         if (pSS->BusyWait(500) == JOB_CANCELED)
222         {
223             return JOB_CANCELED;
224         }
225     }
226
227     return NO_ERROR;
228 } //VerifyPenInfo
229
230 APDK_END_NAMESPACE
231
232 #endif //APDK_PSP100