home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / Includes_and_Autodocs_3.5 / include / devices / printer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-30  |  15.2 KB  |  415 lines

  1. #ifndef DEVICES_PRINTER_H
  2. #define DEVICES_PRINTER_H
  3. /*
  4. **    $VER: printer.h 44.1 (19.10.1999)
  5. **    Includes Release 44.1
  6. **
  7. **    printer.device structure definitions
  8. **
  9. **    (C) Copyright 1987-1999 Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13.  
  14. #ifndef EXEC_DEVICES_H
  15. #include <exec/devices.h>
  16. #endif
  17.  
  18. #ifndef INTUITION_INTUITION_H
  19. #include <intuition/intuition.h>
  20. #endif
  21.  
  22. #ifndef UTILITY_TAGITEM_H
  23. #include <utility/tagitem.h>
  24. #endif
  25.  
  26. /****************************************************************************/
  27.  
  28. /* V34-V40 commands */
  29. #define PRD_RAWWRITE        (CMD_NONSTD+0)
  30. #define PRD_PRTCOMMAND        (CMD_NONSTD+1)
  31. #define PRD_DUMPRPORT        (CMD_NONSTD+2)
  32. #define PRD_QUERY        (CMD_NONSTD+3)
  33.  
  34. /* V44 commands */
  35. #define PRD_RESETPREFS        (CMD_NONSTD+4)    /* PRIVATE: do not use! */
  36. #define PRD_LOADPREFS        (CMD_NONSTD+5)    /* PRIVATE: do not use! */
  37. #define PRD_USEPREFS        (CMD_NONSTD+6)    /* PRIVATE: do not use! */
  38. #define PRD_SAVEPREFS        (CMD_NONSTD+7)    /* PRIVATE: do not use! */
  39. #define PRD_READPREFS        (CMD_NONSTD+8)
  40. #define PRD_WRITEPREFS        (CMD_NONSTD+9)
  41. #define PRD_EDITPREFS        (CMD_NONSTD+10)
  42. #define PRD_SETERRHOOK        (CMD_NONSTD+11)
  43. #define PRD_DUMPRPORTTAGS    (CMD_NONSTD+12)
  44.  
  45. /****************************************************************************/
  46.  
  47. /* printer command definitions */
  48.  
  49. #define aRIS    0    /* ESCc  reset                    ISO */
  50. #define aRIN    1    /* ESC#1 initialize               +++ */
  51. #define aIND    2    /* ESCD  lf                       ISO */
  52. #define aNEL    3    /* ESCE  return,lf                ISO */
  53. #define aRI    4    /* ESCM  reverse lf               ISO */
  54.  
  55. #define aSGR0    5    /* ESC[0m normal char set         ISO */
  56. #define aSGR3    6    /* ESC[3m italics on              ISO */
  57. #define aSGR23    7    /* ESC[23m italics off            ISO */
  58. #define aSGR4    8    /* ESC[4m underline on            ISO */
  59. #define aSGR24    9    /* ESC[24m underline off          ISO */
  60. #define aSGR1    10    /* ESC[1m boldface on             ISO */
  61. #define aSGR22    11    /* ESC[22m boldface off           ISO */
  62. #define aSFC    12    /* SGR30-39  set foreground color ISO */
  63. #define aSBC    13    /* SGR40-49  set background color ISO */
  64.  
  65. #define aSHORP0    14    /* ESC[0w normal pitch            DEC */
  66. #define aSHORP2    15    /* ESC[2w elite on                DEC */
  67. #define aSHORP1    16    /* ESC[1w elite off               DEC */
  68. #define aSHORP4    17    /* ESC[4w condensed fine on       DEC */
  69. #define aSHORP3    18    /* ESC[3w condensed off           DEC */
  70. #define aSHORP6    19    /* ESC[6w enlarged on             DEC */
  71. #define aSHORP5    20    /* ESC[5w enlarged off            DEC */
  72.  
  73. #define aDEN6    21    /* ESC[6"z shadow print on        DEC (sort of) */
  74. #define aDEN5    22    /* ESC[5"z shadow print off       DEC */
  75. #define aDEN4    23    /* ESC[4"z doublestrike on        DEC */
  76. #define aDEN3    24    /* ESC[3"z doublestrike off       DEC */
  77. #define aDEN2    25    /* ESC[2"z  NLQ on                DEC */
  78. #define aDEN1    26    /* ESC[1"z  NLQ off               DEC */
  79.  
  80. #define aSUS2    27    /* ESC[2v superscript on          +++ */
  81. #define aSUS1    28    /* ESC[1v superscript off         +++ */
  82. #define aSUS4    29    /* ESC[4v subscript on            +++ */
  83. #define aSUS3    30    /* ESC[3v subscript off           +++ */
  84. #define aSUS0    31    /* ESC[0v normalize the line      +++ */
  85. #define aPLU    32    /* ESCL  partial line up          ISO */
  86. #define aPLD    33    /* ESCK  partial line down        ISO */
  87.  
  88. #define aFNT0    34    /* ESC(B US char set        or Typeface  0 (default) */
  89. #define aFNT1    35    /* ESC(R French char set    or Typeface  1 */
  90. #define aFNT2    36    /* ESC(K German char set    or Typeface  2 */
  91. #define aFNT3    37    /* ESC(A UK char set        or Typeface  3 */
  92. #define aFNT4    38    /* ESC(E Danish I char set  or Typeface  4 */
  93. #define aFNT5    39    /* ESC(H Sweden char set    or Typeface  5 */
  94. #define aFNT6    40    /* ESC(Y Italian char set   or Typeface  6 */
  95. #define aFNT7    41    /* ESC(Z Spanish char set   or Typeface  7 */
  96. #define aFNT8    42    /* ESC(J Japanese char set  or Typeface  8 */
  97. #define aFNT9    43    /* ESC(6 Norweign char set  or Typeface  9 */
  98. #define aFNT10    44    /* ESC(C Danish II char set or Typeface 10 */
  99.  
  100. /*
  101.     Suggested typefaces are:
  102.  
  103.      0 - default typeface.
  104.      1 - Line Printer or equiv.
  105.      2 - Pica or equiv.
  106.      3 - Elite or equiv.
  107.      4 - Helvetica or equiv.
  108.      5 - Times Roman or equiv.
  109.      6 - Gothic or equiv.
  110.      7 - Script or equiv.
  111.      8 - Prestige or equiv.
  112.      9 - Caslon or equiv.
  113.     10 - Orator or equiv.
  114. */
  115.  
  116. #define aPROP2    45    /* ESC[2p  proportional on        +++ */
  117. #define aPROP1    46    /* ESC[1p  proportional off       +++ */
  118. #define aPROP0    47    /* ESC[0p  proportional clear     +++ */
  119. #define aTSS    48    /* ESC[n E set proportional offset ISO */
  120. #define aJFY5    49    /* ESC[5 F auto left justify      ISO */
  121. #define aJFY7    50    /* ESC[7 F auto right justify     ISO */
  122. #define aJFY6    51    /* ESC[6 F auto full justify      ISO */
  123. #define aJFY0    52    /* ESC[0 F auto justify off       ISO */
  124. #define aJFY3    53    /* ESC[3 F letter space (justify) ISO (special) */
  125. #define aJFY1    54    /* ESC[1 F word fill(auto center) ISO (special) */
  126.  
  127. #define aVERP0    55    /* ESC[0z  1/8" line spacing      +++ */
  128. #define aVERP1    56    /* ESC[1z  1/6" line spacing      +++ */
  129. #define aSLPP    57    /* ESC[nt  set form length n      DEC */
  130. #define aPERF    58    /* ESC[nq  perf skip n (n>0)      +++ */
  131. #define aPERF0    59    /* ESC[0q  perf skip off          +++ */
  132.  
  133. #define aLMS    60    /* ESC#9   Left margin set        +++ */
  134. #define aRMS    61    /* ESC#0   Right margin set       +++ */
  135. #define aTMS    62    /* ESC#8   Top margin set         +++ */
  136. #define aBMS    63    /* ESC#2   Bottom marg set        +++ */
  137. #define aSTBM    64    /* ESC[Pn1;Pn2r  T&B margins      DEC */
  138. #define aSLRM    65    /* ESC[Pn1;Pn2s  L&R margin       DEC */
  139. #define aCAM    66    /* ESC#3   Clear margins          +++ */
  140.  
  141. #define aHTS    67    /* ESCH    Set horiz tab          ISO */
  142. #define aVTS    68    /* ESCJ    Set vertical tabs      ISO */
  143. #define aTBC0    69    /* ESC[0g  Clr horiz tab          ISO */
  144. #define aTBC3    70    /* ESC[3g  Clear all h tab        ISO */
  145. #define aTBC1    71    /* ESC[1g  Clr vertical tabs      ISO */
  146. #define aTBC4    72    /* ESC[4g  Clr all v tabs         ISO */
  147. #define aTBCALL    73    /* ESC#4   Clr all h & v tabs     +++ */
  148. #define aTBSALL    74    /* ESC#5   Set default tabs       +++ */
  149. #define aEXTEND    75    /* ESC[Pn"x extended commands     +++ */
  150.  
  151. #define aRAW    76    /*    ESC[Pn"r    Next    'Pn' chars are raw +++ */
  152.  
  153. /****************************************************************************/
  154.  
  155. /* For PRD_PRTCOMMAND */
  156. struct IOPrtCmdReq
  157. {
  158.     struct Message    io_Message;
  159.     struct Device *    io_Device;    /* device node pointer  */
  160.     struct Unit *    io_Unit;    /* unit (driver private)*/
  161.     UWORD        io_Command;    /* device command */
  162.     UBYTE        io_Flags;
  163.     BYTE        io_Error;    /* error or warning num */
  164.     UWORD        io_PrtCommand;    /* printer command */
  165.     UBYTE        io_Parm0;    /* first command parameter */
  166.     UBYTE        io_Parm1;    /* second command parameter */
  167.     UBYTE        io_Parm2;    /* third command parameter */
  168.     UBYTE        io_Parm3;    /* fourth command parameter */
  169. };
  170.  
  171. /****************************************************************************/
  172.  
  173. /* For PRD_DUMPRPORT */
  174. struct IODRPReq
  175. {
  176.     struct Message        io_Message;
  177.     struct Device *        io_Device;    /* device node pointer  */
  178.     struct Unit *        io_Unit;    /* unit (driver private)*/
  179.     UWORD            io_Command;    /* device command */
  180.     UBYTE            io_Flags;
  181.     BYTE            io_Error;    /* error or warning num */
  182.     struct RastPort *    io_RastPort;    /* raster port */
  183.     struct ColorMap *    io_ColorMap;    /* color map */
  184.     ULONG            io_Modes;    /* graphics viewport modes */
  185.     UWORD            io_SrcX;    /* source x origin */
  186.     UWORD            io_SrcY;    /* source y origin */
  187.     UWORD            io_SrcWidth;    /* source x width */
  188.     UWORD            io_SrcHeight;    /* source x height */
  189.     LONG            io_DestCols;    /* destination x width */
  190.     LONG            io_DestRows;    /* destination y height */
  191.     UWORD            io_Special;    /* option flags */
  192. };
  193.  
  194. /****************************************************************************/
  195.  
  196. /* For PRD_DUMPRPORTTAGS (V44) */
  197. struct IODRPTagsReq
  198. {
  199.     struct Message        io_Message;
  200.     struct Device *        io_Device;    /* device node pointer  */
  201.     struct Unit *        io_Unit;    /* unit (driver private)*/
  202.     UWORD            io_Command;    /* device command */
  203.     UBYTE            io_Flags;
  204.     BYTE            io_Error;    /* error or warning num */
  205.     struct RastPort *    io_RastPort;    /* raster port */
  206.     struct ColorMap *    io_ColorMap;    /* color map */
  207.     ULONG            io_Modes;    /* graphics viewport modes */
  208.     UWORD            io_SrcX;    /* source x origin */
  209.     UWORD            io_SrcY;    /* source y origin */
  210.     UWORD            io_SrcWidth;    /* source x width */
  211.     UWORD            io_SrcHeight;    /* source x height */
  212.     LONG            io_DestCols;    /* destination x width */
  213.     LONG            io_DestRows;    /* destination y height */
  214.     UWORD            io_Special;    /* option flags */
  215.     struct TagItem *    io_TagList;    /* tag list with additional info */
  216. };
  217.  
  218. /****************************************************************************/
  219.  
  220. #define SPECIAL_MILCOLS        0x0001    /* DestCols specified in 1/1000" */
  221. #define SPECIAL_MILROWS        0x0002    /* DestRows specified in 1/1000" */
  222. #define SPECIAL_FULLCOLS    0x0004    /* make DestCols maximum possible */
  223. #define SPECIAL_FULLROWS    0x0008    /* make DestRows maximum possible */
  224. #define SPECIAL_FRACCOLS    0x0010    /* DestCols is fraction of FULLCOLS */
  225. #define SPECIAL_FRACROWS    0x0020    /* DestRows is fraction of FULLROWS */
  226. #define SPECIAL_CENTER        0x0040    /* center image on paper */
  227. #define SPECIAL_ASPECT        0x0080    /* ensure correct aspect ratio */
  228. #define SPECIAL_DENSITY1    0x0100    /* lowest resolution (dpi) */
  229. #define SPECIAL_DENSITY2    0x0200    /* next res */
  230. #define SPECIAL_DENSITY3    0x0300    /* next res */
  231. #define SPECIAL_DENSITY4    0x0400    /* next res */
  232. #define SPECIAL_DENSITY5    0x0500    /* next res */
  233. #define SPECIAL_DENSITY6    0x0600    /* next res */
  234. #define SPECIAL_DENSITY7    0x0700    /* highest res */
  235. #define SPECIAL_NOFORMFEED    0x0800    /* don't eject paper on gfx prints */
  236. #define SPECIAL_TRUSTME        0x1000    /* don't reset on gfx prints */
  237.  
  238. /*
  239.     Compute print size, set 'io_DestCols' and 'io_DestRows' in the calling
  240.     program's 'IODRPReq' structure and exit, DON'T PRINT.  This allows the
  241.     calling program to see what the final print size would be in printer
  242.     pixels.  Note that it modifies the 'io_DestCols' and 'io_DestRows'
  243.     fields of your 'IODRPReq' structure.  Also, set the print density and
  244.     update the 'MaxXDots', 'MaxYDots', 'XDotsInch', and 'YDotsInch' fields
  245.     of the 'PrinterExtendedData' structure.
  246. */
  247. #define SPECIAL_NOPRINT        0x2000    /* see above */
  248.  
  249. /****************************************************************************/
  250.  
  251. #define PDERR_NOERR        0    /* clean exit, no errors */
  252. #define PDERR_CANCEL        1    /* user cancelled print */
  253. #define PDERR_NOTGRAPHICS    2    /* printer cannot output graphics */
  254. #define PDERR_INVERTHAM        3    /* OBSOLETE */
  255. #define PDERR_BADDIMENSION    4    /* print dimensions illegal */
  256. #define PDERR_DIMENSIONOVFLOW    5    /* OBSOLETE */
  257. #define PDERR_INTERNALMEMORY    6    /* no memory for internal variables */
  258. #define PDERR_BUFFERMEMORY    7    /* no memory for print buffer */
  259.  
  260. /*
  261.     Note : this is an internal error that can be returned from the render
  262.     function to the printer device.  It is NEVER returned to the user.
  263.     If the printer device sees this error it converts it 'PDERR_NOERR'
  264.     and exits gracefully.  Refer to the document on
  265.     'How to Write a Graphics Printer Driver' for more info.
  266. */
  267. #define PDERR_TOOKCONTROL    8    /* Took control in case 0 of render */
  268.  
  269. #define PDERR_BADPREFERENCES    9    /* preferences file corrupt */
  270.  
  271. /*
  272.     Note: all error codes < 32 are reserved for printer.device.
  273.     All error codes >= 32 and < 127 are reserved for driver specific
  274.     errors. Negative errors are reserved for system use (standard I/O
  275.     errors) and error code 127 is reserved for future expansion.
  276. */
  277. #define PDERR_LASTSTANDARD    31
  278. #define PDERR_FIRSTCUSTOM    32
  279. #define PDERR_LASTCUSTOM    126
  280.  
  281. /* internal use */
  282. #define SPECIAL_DENSITYMASK    0x0700    /* masks out density values */
  283. #define SPECIAL_DIMENSIONSMASK \
  284.     (SPECIAL_MILCOLS|SPECIAL_MILROWS|SPECIAL_FULLCOLS|SPECIAL_FULLROWS\
  285.     |SPECIAL_FRACCOLS|SPECIAL_FRACROWS|SPECIAL_ASPECT)
  286.  
  287. /****************************************************************************/
  288.  
  289. /* The following tags are used for PRD_DUMPRPORTTAGS */
  290.  
  291. #define DRPA_Dummy (TAG_USER + 0x60000)
  292.  
  293. /****************************************************************************/
  294.  
  295. /* The following tags are not implemented but reserved for future use. */
  296.  
  297. #define DRPA_ICCProfile        (DRPA_Dummy+1) /* APTR */
  298. #define DRPA_ICCName        (DRPA_Dummy+2) /* STRPTR */
  299. #define DRPA_NoColCorrect    (DRPA_Dummy+3) /* LBOOL */
  300.  
  301. /****************************************************************************/
  302.  
  303. /* If the following tag is used io_RastPort and io_ColorMap are
  304.    ignored.
  305. */
  306. #define DRPA_SourceHook   (DRPA_Dummy+4) /* struct Hook * */
  307.  
  308. /* The source hook (DRPA_SourceHook) is called with object NULL and
  309.    message is a pointer to the following struct.
  310.  
  311.         VOID hook(struct Hook * hook,
  312.                   APTR dummy,
  313.                   struct DRPSourceMsg * drpm);
  314. */
  315. struct DRPSourceMsg {
  316.     LONG x;
  317.     LONG y;
  318.     LONG width;
  319.     LONG height;
  320.     ULONG *buf; /* fill this buffer with 0x00RRGGBB pixels */
  321. };
  322.  
  323. /****************************************************************************/
  324.  
  325. /* If these tags are used io_Modes is ignored for aspect ratio */
  326.  
  327. #define DRPA_AspectX      (DRPA_Dummy+5) /* ULONG */
  328. #define DRPA_AspectY      (DRPA_Dummy+6) /* ULONG */
  329.  
  330. /****************************************************************************/
  331.  
  332. /* The following tags are used for PRD_EDITPREFS */
  333.  
  334. #define PPRA_Dummy (TAG_USER + 0x70000)
  335.  
  336. /****************************************************************************/
  337.  
  338. /* Request to edit prefs (for PRD_EDITPREFS; V44) */
  339.  
  340. struct IOPrtPrefsReq
  341. {
  342.     struct Message        io_Message;
  343.     struct Device *        io_Device;    /* device node pointer  */
  344.     struct Unit *        io_Unit;    /* unit (driver private)*/
  345.     UWORD            io_Command;    /* device command */
  346.     UBYTE            io_Flags;
  347.     BYTE            io_Error;    /* error or warning num */
  348.     struct  TagItem *    io_TagList;    /* requester tag list */
  349. };
  350.  
  351. #define PPRA_Window    (PPRA_Dummy+1) /* struct Window * */
  352. #define PPRA_Screen    (PPRA_Dummy+2) /* struct Screen * */
  353. #define PPRA_PubScreen    (PPRA_Dummy+3) /* STRPTR */
  354.  
  355. /****************************************************************************/
  356.  
  357. /* Request to set error hook (for PRD_SETERRHOOK; V44)*/
  358.  
  359. #define PDHOOK_NONE    ((struct Hook *) NULL)
  360. #define PDHOOK_STD    ((struct Hook *) 1)
  361.  
  362. struct IOPrtErrReq
  363. {
  364.     struct Message    io_Message;
  365.     struct Device *    io_Device;    /* device node pointer  */
  366.     struct Unit *    io_Unit;    /* unit (driver private)*/
  367.     UWORD        io_Command;    /* device command */
  368.     UBYTE        io_Flags;
  369.     BYTE        io_Error;    /* error or warning num */
  370.     struct Hook *    io_Hook;
  371. };
  372.  
  373. /****************************************************************************/
  374.  
  375. /*
  376.     The error hook is called with the IORequest that caused the error as
  377.     object (2nd Parameter) and a pointer to struct PrtErrMsg as message
  378.     (3rd Parameter):
  379.  
  380.         VOID hook(struct Hook * hook,
  381.                   struct printerIO * ior,
  382.                   struct PrtErrMsg * pem);
  383. */
  384. struct PrtErrMsg
  385. {
  386.     ULONG            pe_Version;    /* Version of this struct */
  387.     ULONG            pe_ErrorLevel;    /* RETURN_WARN, RETURN_ERROR, RETURN_FAIL */
  388.     struct Window *        pe_Window;    /* window for EasyRequest() */
  389.     struct EasyStruct *    pe_ES;
  390.     ULONG *            pe_IDCMP;
  391.     APTR            pe_ArgList;
  392. };
  393.  
  394. #define PDHOOK_VERSION 1
  395.  
  396. /****************************************************************************/
  397.  
  398. /* PRIVATE: Request to change prefs temporary. DO NOT USE! */
  399.  
  400. struct IOPrefsReq
  401. {
  402.     struct Message            io_Message;
  403.     struct Device *            io_Device;    /* device node pointer  */
  404.     struct Unit *            io_Unit;    /* unit (driver private)*/
  405.     UWORD                io_Command;    /* device command */
  406.     UBYTE                io_Flags;
  407.     BYTE                io_Error;    /* error or warning num */
  408.     struct PrinterTxtPrefs *    io_TxtPrefs;
  409.     struct PrinterUnitPrefs *    io_UnitPrefs;
  410.     struct PrinterDeviceUnitPrefs *    io_DevUnitPrefs;
  411.     struct PrinterGfxPrefs *    io_GfxPrefs;
  412. };
  413.  
  414. #endif /* DEVICES_PRINTER_H */
  415.