1 /*****************************************************************************\ 2 global_types.h : global types, enums, and #defines for APDK 3 4 Copyright (c) 1996 - 2008, HP 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 HP 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 32 /*! \addtogroup globals 33 Definitions for global variables, types, and #defines 34 @{ 35 */ 36 37 // 38 // Definitions and structures needed by applications 39 // 40 // This file does not include C++ class definitions etc. so it can 41 // be included by calling C or C++ source files 42 43 #ifndef APDK_GLOBAL_TYPES_H 44 #define APDK_GLOBAL_TYPES_H 45 46 #include "models.h" 47 #include "modes.h" 48 49 #define APDK_INVALID_VALUE -9999 50 51 #if APDK_AUTO_INCLUDE 52 #include "auto-include.h" 53 #else 54 typedef unsigned long uint32_t; 55 #endif 56 57 // ** Defines 58 59 #ifdef APDK_NOTHROW 60 #include <new> 61 //#define NOTHROW (std::nothrow) 62 #define new new(std::nothrow) 63 #endif 64 65 // Camera compiler warns about NULL at different locations each time. 66 // So, force a definition here. 67 68 #ifdef NULL 69 #undef NULL 70 #endif 71 72 #ifndef NULL 73 #define NULL 0 74 #endif 75 76 #ifndef BOOL 77 typedef int BOOL; 78 #define TRUE 1 79 #define FALSE 0 80 #endif 81 82 /* 83 #ifndef BOOL 84 #define BOOL bool 85 #endif 86 #ifndef TRUE 87 #define TRUE true 88 #endif 89 #ifndef FALSE 90 #define FALSE false 91 #endif 92 */ 93 94 typedef unsigned char BYTE; 95 96 typedef unsigned short WORD; 97 98 typedef uint32_t DWORD; 99 100 #ifndef LOWORD 101 #define LOWORD(l) ((WORD) (l)) 102 #endif 103 104 #ifndef HIWORD 105 #define HIWORD(l) ((WORD) (((DWORD) (l) >> 16) & 0xFFFF)) 106 #endif 107 108 #ifndef ABS 109 #define ABS(x) ( ((x)<0) ? -(x) : (x) ) 110 #endif 111 112 #ifdef BLACK_PEN 113 #undef BLACK_PEN 114 #endif 115 116 #ifdef NO_ERROR 117 #undef NO_ERROR 118 #endif 119 120 APDK_BEGIN_NAMESPACE 121 122 123 //! \internal For use in connection with PCL media-type command. Values are PCL codes. 124 enum MediaType 125 { 126 mediaAuto = -1, 127 mediaPlain = 0, 128 mediaBond = 0, 129 mediaSpecial = 2, 130 mediaGlossy = 3, 131 mediaTransparency = 4, 132 mediaHighresPhoto = 3, // used by vip printers for 2400 mode 133 mediaCDDVD = 7, 134 mediaBrochure = 8 135 }; 136 137 138 //! \internal For use in connection with PCL media-size command. Values are PCL codes. 139 enum MediaSize 140 { 141 sizeUSLetter = 2, 142 sizeUSLegal = 3, 143 sizeA4 = 26, 144 sizeNum10Env = 81, 145 sizeA2Env = 109, 146 sizeC6Env = 92, 147 sizeDLEnv = 90, 148 size3JPNEnv = 110, 149 size4JPNEnv = 111, 150 sizePhoto = 74, // 4x6 Index Card / Photo paper 151 sizeA6 = 73, // used to be 24, full-bleed support is for 73 only. Is same size though 152 sizeB4 = 46, 153 sizeB5 = 45, 154 sizeOUFUKU = 72, 155 sizeHAGAKI = 71, 156 sizeA3 = 27, 157 sizeA5 = 25, 158 sizeSuperB = 16, 159 sizeLedger = 6, 160 sizeFLSA = 10, 161 sizeExecutive = 1, 162 sizeCustom = 101, 163 size5x7 = 122, 164 sizeCDDVD80 = 98, 165 sizeCDDVD120 = 99 166 }; 167 168 //! \internal For use in connection with PCL media-source command. Values are PCL codes. 169 enum MediaSource 170 { 171 sourceTrayMin = -2, 172 sourceBanner = -1, 173 sourceTray1 = 1, 174 sourceManual = 2, 175 sourceManualEnv = 3, 176 sourceTray2 = 4, 177 sourceDuplexerNHagakiFeed = 5, 178 sourceOptionalEnv = 6, 179 sourceTrayPhoto = 6, 180 sourceTrayAuto = 7, 181 sourceTrayCDDVD = 14, 182 sourceTrayMax = 50 183 }; 184 185 186 //! \internal For use in connection with PCL quality-mode command. Values are PCL codes. 187 enum Quality 188 { 189 qualityAuto = -3, 190 qualityFastDraft = -2, 191 qualityDraft = -1, 192 qualityNormal = 0, 193 qualityPresentation = 1, 194 qualityMarvellous = 2, 195 qualityFastNormal = 3 196 }; 197 198 //! \internal For use in connection with fullbleed support. Values are type of fullbleed. 199 enum FullbleedType 200 { 201 fullbleedNotSupported = 0, 202 fullbleed3EdgeAllMedia = 1, 203 fullbleed3EdgePhotoMedia = 2, 204 fullbleed3EdgeNonPhotoMedia = 3, 205 fullbleed4EdgeAllMedia = 4, 206 fullbleed4EdgePhotoMedia = 5, 207 fullbleed4EdgeNonPhotoMedia = 6 208 }; 209 210 enum FontIndex 211 { 212 COURIER_INDEX = 1, 213 CGTIMES_INDEX = 2, 214 LETTERGOTHIC_INDEX = 3, 215 UNIVERS_INDEX = 4 216 }; 217 218 const int MAX_CHAR_SET = 5; 219 220 const int MAX_POINTSIZES = 5; 221 222 const int MAXCOLORDEPTH = 3; 223 224 const int MAXCOLORPLANES = 6; // current max anticipated, 6 for 690 photopen 225 226 const int MAXCOLORROWS = 2; // multiple of high-to-low for mixed-resolution cases 227 228 // ** JOB related structures/enums 229 230 //! Possible pen combinations 231 enum PEN_TYPE 232 { 233 BLACK_PEN, //!< Only BLACK pen in the printer 234 COLOR_PEN, //!< Only COLOR pen in the printer 235 BOTH_PENS, //!< BLACK & COLOR pens in printer 236 MDL_PEN, //!< Photo pen in the printer 237 MDL_BOTH, //!< COLOR and Photo pen in printer 238 MDL_AND_BLACK_PENS, //!< BLACK and Photo pen in printer 239 MDL_BLACK_AND_COLOR_PENS, //!< BLACK, COLOR and Photo pen in printer 240 GREY_PEN, //!< Only GREY pen in the printer 241 GREY_BOTH, //!< COLOR and GREY pen in the printer 242 MDL_AND_GREY_PENS, //!< GREY and Photo pen in printer 243 MDL_GREY_AND_COLOR_PENS, //!< GREY, COLOR, and Photo pen in the printer 244 UNKNOWN_PEN, //!< New Pen type that we have no knowledge yet 245 // if more pen or pen combos are added then add them here and point MAX_PEN_TYPE to the last one 246 NO_PEN, //!< No pens in the printer 247 DUMMY_PEN, //!< Not a possible value - used for initialization 248 MAX_PEN_TYPE = UNKNOWN_PEN //!< base 0, ending with MDL_BOTH (NOT NO_PEN) 249 }; 250 //const int MAX_PEN_TYPE = 4; 251 252 253 //! Supported Paper sizes 254 /* 255 The PAPER_SIZE enum is directly supported by PSM in PrintContext 256 do not change the order of the PAPER_SIZE enum. The static array in 257 PrintContext depends on this order. Any changes to this enum may require 258 changes to the PSM array. 259 */ 260 typedef enum // typedef'ed for C interface 261 { 262 UNSUPPORTED_SIZE =-1, //!< Not supported paper size (also used as mandatory flag) 263 LETTER = 0, //!< 8.5 x 11 in. 264 A4 = 1, //!< 210 x 297 mm. 265 LEGAL = 2, //!< 8.25 x 14 in. 266 PHOTO_SIZE = 3, //!< 4x6 Photo with tear-off tab 267 A6 = 4, //!< 105 x 148 mm. 268 CARD_4x6 = 5, //!< 4x6 photo/card without tear-off tab 269 B4 = 6, //!< 250 x 353 mm. 270 B5 = 7, //!< 176 x 250 mm. 271 OUFUKU = 8, //!< 148 x 200 mm. 272 OFUKU = 8, //!< Misspelled - here for backwards compatibility 273 HAGAKI = 9, //!< 100 x 148 mm. 274 A6_WITH_TEAR_OFF_TAB = 10, //!< A6 with tear-off tab 275 #ifdef APDK_EXTENDED_MEDIASIZE 276 A3 = 11, //!< 294 x 419.8 mm. 277 A5 = 12, //!< 148 x 210 mm. 278 LEDGER = 13, //!< 11 x 17 in. 279 SUPERB_SIZE = 14, //!< 13 x 19 in. 280 EXECUTIVE = 15, //!< 7.25 x 10.5 in. 281 FLSA = 16, //!< 8.5 x 13 in. 282 CUSTOM_SIZE = 17, //!< Custom 283 ENVELOPE_NO_10 = 18, //!< No. 10 Envelope (4.12 x 9.5 in.) 284 ENVELOPE_A2 = 19, //!< A2 Envelope (4.37 x 5.75 in.) 285 ENVELOPE_C6 = 20, //!< C6 Envelope (114 x 162 mm) 286 ENVELOPE_DL = 21, //!< DL Envelope (110 x 220 mm) 287 ENVELOPE_JPN3 = 22, //!< Japanese Envelope #3 (120 x 235 mm) 288 ENVELOPE_JPN4 = 23, //!< Japanese Envelope #4 (90 x 205 mm) 289 #endif 290 PHOTO_5x7, //!< 5x7 Photo 291 CDDVD_80, //!< 3 in. CD or DVD 292 CDDVD_120, //!< 5 in. CD or DVD 293 #ifdef APDK_EXTENDED_MEDIASIZE 294 PHOTO_4x8, //!< Panorama 4 in. x 8 in. 295 PHOTO_4x12, //!< Panorama 4 in. x 12 in. 296 L, //!< Japanese card (3.5 in. x 5 in.) 297 #endif 298 MAX_PAPER_SIZE //!< Only for array size and loops 299 } PAPER_SIZE; 300 301 302 typedef enum // typedef'ed for C interface 303 { 304 CLEAN_PEN = 0 305 } PRINTER_FUNC; 306 307 308 // ** TEXT related structures/enums 309 310 //! Supported Text colors for device text 311 typedef enum // typedef'ed for C interface 312 { 313 WHITE_TEXT, //!< White 314 CYAN_TEXT, //!< Cyan 315 MAGENTA_TEXT, //!< Magenta 316 BLUE_TEXT, //!< Blue 317 YELLOW_TEXT, //!< Yellow 318 GREEN_TEXT, //!< Green 319 RED_TEXT, //!< Red 320 BLACK_TEXT //!< Black 321 } TEXTCOLOR; 322 323 324 // currently only portrait fonts are supported 325 enum TEXTORIENT 326 { 327 PORTRAIT, 328 LANDSCAPE, 329 BOTH 330 }; 331 332 const int MAX_FONT_SIZES = 10; // max # of fonts to be realized at one time 333 334 335 // ** I/O related stuff 336 337 const int TIMEOUTVAL = 500; // in msec, ie 0.5 sec 338 339 typedef WORD PORTID; 340 typedef void * PORTHANDLE; 341 342 enum MODE1284 343 { 344 COMPATIBILITY, 345 NIBBLE, 346 ECP 347 }; 348 349 350 enum HALFTONING_ALGORITHM 351 { 352 FED, 353 MATRIX 354 }; 355 356 357 //! Color modes for SelectPrintMode 358 typedef enum // typedef'ed for C interface 359 { 360 GREY_K, //!< Use the BLACK pen to print B&W only 361 GREY_CMY, //!< Use the COLOR pen to print grey scale 362 COLOR, //!< Use the COLOR pen to print color 363 MAX_COLORMODE 364 } COLORMODE; 365 366 367 //! Quality modes for SelectPrintMode 368 typedef enum // typedef'ed for C interface 369 { 370 QUALITY_NORMAL, //!< Normal quality print mode (probably 300x300) 371 QUALITY_DRAFT, //!< Draft print mode - the same or faster than normal 372 QUALITY_BEST, //!< Probably slower and possible higher resolution 373 QUALITY_HIGHRES_PHOTO, //!< 1200 dpi - currently 9xxvip, linux only 374 QUALITY_FASTDRAFT, //!< True draft, 300 dpi - newer VIP printers only 375 QUALITY_AUTO, //!< Printer selects optimum resolution - 05 and later VIP printers only 376 QUALITY_FASTNORMAL, //!< Normal quality print mode - faster than Normal 377 MAX_QUALITY_MODE 378 } QUALITY_MODE; 379 380 381 //! Media types for SelectPrintMode 382 typedef enum // typedef'ed for C interface 383 { 384 MEDIA_PLAIN, //!< Plain paper 385 MEDIA_PREMIUM, //!< Premium paper - for use with 6xx series 386 MEDIA_PHOTO, //!< Photo paper - for use with photo quality printers 387 MEDIA_TRANSPARENCY, //!< Transparency film 388 MEDIA_HIGHRES_PHOTO, //!< Premium photo paper 389 MEDIA_AUTO, //!< Printer uses media sense to determine media type 390 MEDIA_ADVANCED_PHOTO, //!< Advanced photo paper 391 MEDIA_CDDVD = 7, //!< CD or DVD media 392 MEDIA_BROCHURE = 8, //!< Glossy brochure paper 393 MAX_MEDIATYPE 394 } MEDIATYPE; 395 396 //! PhotoTray status 397 typedef enum // typedef'ed for C interface 398 { 399 UNKNOWN = -1, //!< Unknown State 400 DISENGAGED = 0, //!< Photo Tray is nor engaged 401 ENGAGED = 1 //!< Photo Tray is engaged 402 } PHOTOTRAY_STATE; 403 404 ////////////////////////////////////////////////////////////////////////////////////// 405 // values of DRIVER_ERROR 406 // first of 2 hex digits indicates category 407 408 typedef enum // typedef'ed for C interface 409 { 410 411 // general or system errors 412 NO_ERROR = 0x00, //!< everything okay 413 JOB_CANCELED = 0x01, //!< CANCEL chosen by user 414 SYSTEM_ERROR = 0x02, //!< something bad that should not have happened 415 ALLOCMEM_ERROR = 0x03, //!< failed to allocate memory 416 NO_PRINTER_SELECTED = 0x04, //!< indicates improper calling sequence or unidi 417 INDEX_OUT_OF_RANGE = 0x05, //!< what it says 418 ILLEGAL_RESOLUTION = 0x06, //!< tried to set resolution at unacceptable value 419 NULL_POINTER = 0x07, //!< supplied ptr was null 420 MISSING_PENS = 0x08, //!< one or more printhead/pen missing 421 422 // build-related 423 // (items either absent from current build, or just bad index from client code) 424 UNSUPPORTED_PRINTER = 0x10, //!< selected printer-type unsupported in build 425 UNSUPPORTED_PEN = 0x11, //!< selected pen-type unsupported 426 TEXT_UNSUPPORTED = 0x12, //!< no text allowed in current build, UsePageWidth is false 427 GRAPHICS_UNSUPPORTED = 0x13, //!< no graphics allowed in current build 428 UNSUPPORTED_FONT = 0x14, //!< font selection failed 429 ILLEGAL_COORDS = 0x15, //!< bad (x,y) passed to TextOut 430 UNSUPPORTED_FUNCTION = 0x16, //!< bad selection for PerformPrinterFunction 431 BAD_INPUT_WIDTH = 0x18, //!< inputwidth is 0 and 432 OUTPUTWIDTH_EXCEEDS_PAGEWIDTH = 0x19, //!< inputwidth exceeds printable width 433 UNSUPPORTED_SCALING = 0x1a, //!< inputwidth exceeds outputwidth, can't shrink output 434 435 // I/O related 436 IO_ERROR = 0x20, //!< I/O error communicating with printer 437 BAD_DEVICE_ID = 0x21, //!< bad or garbled device id from printer 438 CONTINUE_FROM_BLOCK = 0x22, //!< continue from blocked state for printers with no buttons 439 440 // Run time related 441 PLUGIN_LIBRARY_MISSING = 0x30, //!< a required plugin (dynamic) library is missing 442 443 // WARNINGS 444 // convention is that values < 0 can be ignored (at user's peril) 445 WARN_MODE_MISMATCH = -1, //!< printmode selection incompatible with pen, tray, etc. 446 WARN_DUPLEX = -2, //!< duplexer installed; our driver can't use it 447 WARN_LOW_INK_BOTH_PENS= -3, //!< sensor says pens below threshold 448 WARN_LOW_INK_BLACK = -4, //!< sensor says black pen below threshold 449 WARN_LOW_INK_COLOR = -5, //!< sensor says color pen below threshold 450 451 WARN_LOW_INK_PHOTO = -10, //!< sensor says photo pen below threshold 452 WARN_LOW_INK_GREY = -11, //!< sensor says grey pen below threshold 453 WARN_LOW_INK_BLACK_PHOTO = -12, //!< sensor says black and photo pens below threshold 454 WARN_LOW_INK_COLOR_PHOTO = -13, //!< sensor says color and photo pens below threshold 455 WARN_LOW_INK_GREY_PHOTO = -14, //!< sensor says grey and photo pens below threshold 456 WARN_LOW_INK_COLOR_GREY = -15, //!< sensor says color and grey pens below threshold 457 WARN_LOW_INK_COLOR_GREY_PHOTO = -16, //!< sensor says color, photo, and grey pens below threshold 458 WARN_LOW_INK_COLOR_BLACK_PHOTO = -17, //!< sensor says color, photo, and black pens below threshold 459 WARN_LOW_INK_CYAN = -18, //!< sensor says cyan ink below threshold 460 WARN_LOW_INK_MAGENTA = -19, //!< sensor says magenta ink below threshold 461 WARN_LOW_INK_YELLOW = -20, //!< sensor says yellow ink below threshold 462 WARN_LOW_INK_MULTIPLE_PENS = - 21, //!< sensor says more than one pen below threshold 463 WARN_FULL_BLEED_UNSUPPORTED = -6,//!< device does not support full-bleed printing 464 WARN_FULL_BLEED_3SIDES = -7, //!< full bleed on only 3 sides 465 WARN_FULL_BLEED_PHOTOPAPER_ONLY = -30, //!< device only support full-bleed on photo paper 466 WARN_FULL_BLEED_3SIDES_PHOTOPAPER_ONLY = -31, //!< device only support 3 sided full-bleed on photo paper 467 WARN_ILLEGAL_PAPERSIZE = -8, //!< papersize illegal for given hardware 468 ILLEGAL_PAPERSIZE = -8, 469 WARN_INVALID_MEDIA_SOURCE = -9 //!< media source tray is invalid 470 } DRIVER_ERROR; //DRIVER_ERROR 471 472 473 /////////////////////////////////////////////////////////////////////////////////////// 474 475 // ** Printer Status return values 476 477 478 enum DISPLAY_STATUS 479 { // used for DisplayPrinterStatus 480 NODISPLAYSTATUS = -1, 481 DISPLAY_PRINTING, 482 DISPLAY_PRINTING_COMPLETE, 483 DISPLAY_PRINTING_CANCELED, 484 DISPLAY_OFFLINE, 485 DISPLAY_BUSY, 486 DISPLAY_OUT_OF_PAPER, 487 DISPLAY_TOP_COVER_OPEN, 488 DISPLAY_ERROR_TRAP, 489 DISPLAY_NO_PRINTER_FOUND, 490 DISPLAY_NO_PEN_DJ400, 491 DISPLAY_NO_PEN_DJ600, 492 DISPLAY_NO_COLOR_PEN, 493 DISPLAY_NO_BLACK_PEN, 494 DISPLAY_NO_PENS, 495 DISPLAY_PHOTO_PEN_WARN, 496 DISPLAY_PRINTER_NOT_SUPPORTED, 497 DISPLAY_COMM_PROBLEM, 498 DISPLAY_CANT_ID_PRINTER, 499 DISPLAY_OUT_OF_PAPER_NEED_CONTINUE, 500 DISPLAY_PAPER_JAMMED, 501 DISPLAY_PHOTOTRAY_MISMATCH, 502 503 // internal driver use only 504 505 ACCEPT_DEFAULT, 506 DISPLAY_PRINTCONTEXT_WARN, 507 DISPLAY_PRINTMODE_WARN, 508 DISPLAY_JOB_WARN 509 }; 510 511 512 // ** move these to internal.h 513 // items from wtv_interp.h 514 515 const int NUMBER_PLANES = 3; 516 517 // must be #define instead of const int for C interface 518 #define NUMBER_RASTERS 3 // The number of Rasters to Buffer 519 520 #ifdef APDK_AUTODUPLEX 521 enum DUPLEXMODE 522 { 523 DUPLEXMODE_NONE, 524 DUPLEXMODE_TABLET, 525 DUPLEXMODE_BOOK 526 }; 527 #endif 528 529 typedef enum 530 { 531 SPEED_MECH_HINT, 532 PAGES_IN_DOC_HINT, 533 EXTRA_DRYTIME_HINT, 534 MAX_FILE_SIZE_HINT, 535 RED_EYE_REMOVAL_HINT, 536 PHOTO_FIX_HINT, 537 LEFT_OVERSPRAY_HINT, 538 RIGHT_OVERSPRAY_HINT, 539 TOP_OVERSPRAY_HINT, 540 BOTTOM_OVERSPRAY_HINT 541 } PRINTER_HINT; 542 543 APDK_END_NAMESPACE 544 545 /*! @} */ // end globals group (documentation) 546 547 #endif //APDK_GLOBAL_TYPES_H 548