home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / desklib / !DeskLib / h / PDriver < prev    next >
Encoding:
Text File  |  1993-12-13  |  7.6 KB  |  234 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    PDriver.h
  12.     Author:  Copyright © 1993 Jason Howat (and a bit by Jason Williams)
  13.     Version: 1.10 (14 Jul 1993)
  14.     Purpose: SWI veneers for using printer drivers (the PDriver module)
  15. */
  16.  
  17.  
  18.  
  19. #ifndef __dl_pdriver_h
  20. #define __dl_pdriver_h
  21.  
  22. #ifndef __dl_core_h
  23. #include "Core.h"
  24. #endif
  25.  
  26. #ifndef __dl_wimp_h
  27. #include "Wimp.h"
  28. #endif
  29.  
  30.  
  31.  
  32. typedef int print_job;                  /* actually a RISC OS file handle */
  33.  
  34. typedef struct
  35. {
  36.   int xx;
  37.   int xy;
  38.   int yx;
  39.   int yy;
  40. } print_transformation;                 /* See pg 1554 of the RISC OS 2 PRMs */
  41.  
  42.                                         /* Values for the drivertype field
  43.                                            of printer_info                 */
  44. #define printdriver_POSTSCRIPT          0
  45. #define printdriver_FX80                1
  46. #define printdriver_LASERJET            2
  47. #define printdriver_INTEGREX            3   
  48. #define printdriver_FAXMODEM            4
  49. #define printdriver_DIRECTDRIVELASER    5
  50. #define printdriver_CASPELGRAPHLANG     6
  51. #define printdriver_PDUMPER             7
  52. #define printdriver_EPSONJX             99
  53. #define printdriver_STARLC10            99
  54. #define printdriver_PAINTJET            99
  55.  
  56.  
  57.         /* These #defines represent the bits of the 'features' word */
  58. #define printfeat_COLOUR         0x00000001
  59. #define printfeat_LIMITED        0x00000002
  60. #define printfeat_DISCRETE       0x00000004
  61. #define printfeat_NOFILL         0x00000100
  62. #define printfeat_NOTHICKNESS    0x00000200
  63. #define printfeat_NOOVERWRITE    0x00000400
  64. #define printfeat_TRANSSPRITE    0x00000800
  65. #define printfeat_NEWFONTMANAGER 0x00001000
  66. #define printfeat_SCREENDUMP     0x01000000
  67. #define printfeat_TRANSFORMS     0x02000000
  68. #define printfeat_ILLUSTRATIONS  0x04000000
  69. #define printfeat_MISCOP         0x08000000
  70. #define printfeat_SETDRIVER      0x10000000
  71. #define printfeat_DECLAREFONT    0x20000000
  72.  
  73.  
  74.         /* The 'features' word represented as a structure. */
  75. typedef union
  76. {
  77.   int value;
  78.   struct
  79.   {
  80.     unsigned int colour         : 1;
  81.     unsigned int limited        : 1;
  82.     unsigned int discrete       : 1;
  83.     unsigned int filler1        : 5;   /* reserved */
  84.     unsigned int nofill         : 1;
  85.     unsigned int nothickness    : 1;
  86.     unsigned int nooverwrite    : 1;
  87.     unsigned int transsprite    : 1;
  88.     unsigned int newfontmanager : 1;
  89.     unsigned int filler2        : 3;   /* reserved */
  90.     unsigned int filler3        : 8;   /* reserved */
  91.     unsigned int screendump     : 1;
  92.     unsigned int transforms     : 1;
  93.     unsigned int illustrations  : 1;
  94.     unsigned int miscop         : 1;
  95.     unsigned int setdriver      : 1;
  96.     unsigned int declarefont    : 1;
  97.     unsigned int filler4        : 2;   /* reserved */
  98.   } data;
  99. } print_features;
  100.  
  101.  
  102. typedef struct
  103. {
  104.   unsigned int     version    : 16;
  105.   int              drivertype : 16;
  106.   wimp_point       resolution;
  107.   print_features   features;
  108.   char             *description;
  109.   wimp_point       halftone_res;
  110.   int              id_number;
  111. } printer_info;                  /* info returned by PDriver_Info (pg 1539) */
  112.  
  113.  
  114.  
  115. /* PDriver_Info ------------------------------------------------------------
  116.  * Reads information on the printer driver.
  117.  */
  118. os_error *PDriver_Info(printer_info *block);
  119.  
  120.  
  121. /* PDriver_PrinterName -----------------------------------------------------
  122.  * This function calls PDriver_Info, and returns the Printer name returned
  123.  * by that SWI. If no Printer Driver is installed, it returns NULL.
  124.  *
  125.  * NOTE that the returned string should be treated as READ ONLY, as it
  126.  * is a pointer into the PDriver's RMA workspace!
  127.  */
  128. extern char *PDriver_PrinterName(void);
  129.  
  130.  
  131. /* PDriver_CheckFeatures ---------------------------------------------------
  132.  * Checks the features of a printer and generates an error if appropriate.
  133.  */
  134. os_error *PDriver_CheckFeatures(print_features mask, print_features value);
  135.  
  136.  
  137. /* PDriver_PageSize --------------------------------------------------------
  138.  * Find how large the paper and print area are.
  139.  */
  140. os_error *PDriver_PageSize(wimp_point *size, wimp_rect *printable);
  141.  
  142.  
  143. /* PDriver_SelectJob -------------------------------------------------------
  144.  * Make a given print job the current one.
  145.  */
  146. os_error *PDriver_SelectJob(print_job new, char *title, print_job *old);
  147.  
  148.  
  149. /* PDriver_CurrentJob ------------------------------------------------------
  150.  * Get the handle of the current job.
  151.  */
  152. os_error *PDriver_CurrentJob(print_job *current);
  153.  
  154.  
  155. /* PDriver_EndJob ----------------------------------------------------------
  156.  * End a print job normally.
  157.  */
  158. os_error *PDriver_EndJob(print_job job);
  159.  
  160.  
  161. /* PDriver_AbortJob --------------------------------------------------------
  162.  * End a print job without any further output.
  163.  */
  164. os_error *PDriver_AbortJob(print_job job);
  165.  
  166.  
  167. /* PDriver_GiveRectangle ---------------------------------------------------
  168.  * Specify a rectangle to be printed.
  169.  */
  170. os_error *PDriver_GiveRectangle(int rectangle_id, wimp_rect *rectangle,
  171.                                 print_transformation *matrix,
  172.                                 wimp_point *position, int background_colour);
  173.  
  174.  
  175. /* PDriver_DrawPage --------------------------------------------------------
  176.  * Called to draw the page after all the rectangles have been specified.
  177.  */
  178. os_error *PDriver_DrawPage(int copies, wimp_rect *rectangle_to_print,
  179.                            int sequence_no, char *page,
  180.                            int *finished, int *rectangle_id);
  181.  
  182.  
  183. /* PDriver_GetRectangle ----------------------------------------------------
  184.  * Get the next print rectangle
  185.  */
  186. os_error *PDriver_GetRectangle(wimp_rect *rectangle_to_print,
  187.                                int *finished, int *rectangle_id);
  188.  
  189.  
  190. /* PDriver_CancelJob -------------------------------------------------------
  191.  * Stop the print job from printing.
  192.  */
  193. os_error *PDriver_CancelJob(print_job job);
  194.  
  195.  
  196. /* PDriver_ScreenDump ------------------------------------------------------
  197.  * Output a screen dump to the printer.
  198.  */
  199. os_error *PDriver_ScreenDump(print_job job);
  200.  
  201.  
  202. /* PDriver_EnumerateJobs ---------------------------------------------------
  203.  * List existing print jobs.
  204.  */
  205. os_error *PDriver_EnumerateJobs(print_job *handle);
  206.  
  207.  
  208. /* PDriver_CancelJobWithError ----------------------------------------------
  209.  * Cancels a print job - future attempts to output to it generate an error.
  210.  */
  211. os_error *PDriver_CancelJobWithError(print_job job, os_error *error);
  212.  
  213.  
  214. /* PDriver_SelectIllustration ----------------------------------------------
  215.  * Makes the given print job the current one, and treats it as an
  216.  * illustration.
  217.  */
  218. os_error *PDriver_SelectIllustration(print_job new, char *title,
  219.                                      print_job *old);
  220.  
  221.  
  222. /* PDriver_InsertIllustration ----------------------------------------------
  223.  * Inserts a file containing an illustration into the current job's output.
  224.  *
  225.  * NOTE - the drawpath will be changed from a void * when drawfile support is
  226.  * added to DeskLib.
  227.  */
  228. os_error *PDriver_InsertIllustration(int illustration_handle, void *drawpath,
  229.                                      wimp_point *bottom_left,
  230.                                      wimp_point *bottom_right,
  231.                                      wimp_point *top_left);
  232.  
  233. #endif
  234.