Home Print dialogs PRINT DIALOG - DELETE (AES 201) PRINT DIALOG - CLOSE WINDOW (AES 203)

2.6.5 PRINT DIALOG - OPEN WINDOW (AES 202)

OPEN WINDOW opens a window with the print dialog. The handle of the window will be returned if no error has arisen. In case of error the return value is 0. The structure <settings> contains the printer settings, which should be saved with each document. If no settings exist for a document yet, one can either create them with pdlg_new_settings() (the memory block belongs to the system) or the application can call Malloc() and subsequently pdlg_dflt_settings() to initialise the memory.

<option_flags> contains information, among other things, whether the dialog is to be displayed as a settings (PDLG_PREFS) or print dialog (PDLG_PRINT). In addition the flags PDLG_ALWAYS_COPIES, PDLG_ALWAYS_ORIENT and PDLG_ALWAYS_SCALE can ensure that the number of copies, landscape printing and scaling options are offered even when the driver does not support them, so that the application has to output the page rotated to the landscape format, for instance. PDLG_EVENODD makes the buttons for even/odd pages selectable.

Declaration:
WORD pdlg_open( PRN_DIALOG *prn_dialog, PRN_SETTINGS *settings,
                BYTE *document_name, WORD option_flags,
                                        WORD x, WORD y );

Call:
whdl = pdlg_open( prn_dialog, settings, "Untitled",
                                  PDLG_PREFS, -1, -1 );

Variable         Argument         Meaning
Inputs:

contrl[0]        202              pdlg_open
contrl[1]        3                Entries in intin
contrl[3]        3                Entries in addrin

intin[0]         option_flags
intin[1]         x                X-coordinates of the window or -1
                                  (centred)
intin[2]         y                Y-coordinates of the window or -1
                                  (centred)

addrin[0]        prn_dialog       Pointer to management structure
addrin[1]        settings         Printer settings
addrin[2]        document_name    Document name

Outputs:

contrl[2]        1                Entries in intout
contrl[4]        0                Entries in addrout

intout[0]        whdl             Handle of the window or 0 (error)


Description of <option_flags>:

#define PDLG_PREFS          0x0000  /* Display settings dialog */
#define PDLG_PRINT          0x0001  /* Display print dialog */

#define PDLG_ALWAYS_COPIES  0x0010  /* Always offer No. of copies */
#define PDLG_ALWAYS_ORIENT  0x0020  /* Always offer landscape format */
#define PDLG_ALWAYS_SCALE   0x0040  /* Always offer scaling */

#define PDLG_EVENODD        0x0100  /* Offer option for even and odd pages */

Description of <settings>:

/* <page_flags> */
#define  PG_EVEN_PAGES  0x0001  /* Only output pages with even page numbers */
#define  PG_ODD_PAGES   0x0002  /* Only output pages with odd page numbers */

/* <first_page/last_page> */
#define  PG_MIN_PAGE    1
#define  PG_MAX_PAGE    9999

/* <orientation> */
#define  PG_UNKNOWN     0x0000  /* Orientation unknown and not adjustable */
#define  PG_PORTRAIT    0x0001  /* Output page in portrait format */
#define  PG_LANDSCAPE   0x0002  /* Output page in landscape format */


typedef struct _prn_settings
{
   LONG  magic;            /* 'pset' */
-->LONG  length;           /* Structure length */
   LONG  format;           /* Structure type */
   LONG  reserved;

-->LONG  page_flags;       /* Flags, inc. even pages, odd pages */
-->WORD  first_page;       /* First page to be printed */
-->WORD  last_page;        /* Last page to be printed */
-->WORD  no_copies;        /* Number of copies */
-->WORD  orientation;      /* Orientation */
-->LONG  scale;            /* Scaling: 0x10000L corresponds to 100% */

-->WORD  driver_id;        /* VDI device number */
   WORD  driver_type;      /* Type of driver set */
   LONG  driver_mode;      /* Flags, inc. for background printing */
   LONG  reserved1;
   LONG  reserved2;

   LONG  printer_id;       /* Printer number */
   LONG  mode_id;          /* Mode number */
   WORD  mode_hdpi;        /* Horizontal resolution in dpi */
   WORD  mode_vdpi;        /* Vertical resolution in dpi */
   LONG  quality_id;       /* Print mode (hardware-dependent quality,
                              e.g. Microweave or Econofast) */

   LONG  color_mode;       /* Colour mode */
   LONG  plane_flags;      /* Flags for colour planes to be output
                              (e.g. cyan only) */
   LONG  dither_mode;      /* Dither process */
   LONG  dither_value;     /* Parameter for the dither process */

   LONG  size_id;          /* Paper format */
   LONG  type_id;          /* Paper type (normal, glossy) */
   LONG  input_id;         /* Paper feed channel */
   LONG  output_id;        /* Paper output channel */

   LONG  contrast;         /* Contrast: 0x10000L corresponds to the
                              normal setting */
   LONG  brightness;       /* Brightness: 0x1000L corresponds to the
                              normal setting */
   LONG  reserved3;
   LONG  reserved4;

   LONG  reserved5;
   LONG  reserved6;
   LONG  reserved7;
   LONG  reserved8;

   BYTE  device[128];      /* File name to be printed */

#ifdef __PRINTING__
   TPrint   mac_settings;  /* Settings of the Mac printer driver */
#else
   struct
   {
      UBYTE inside[120];
   } mac_settings;
#endif

} PRN_SETTINGS;

The structure items marked with --> can be read by the application. All other entries should not be accessed. Data such as the printer resolution or colour planes, for instance, should not be taken from the settings structure but requested from the printer at the start of printing (it is possible, for instance, that the printer driver is forced by a shortage of memory to reduce the print resolution below the value entered in PRN_SETTINGS).


Home Print dialogs PRINT DIALOG - DELETE (AES 201) PRINT DIALOG - CLOSE WINDOW (AES 203)