Modify the attributes of a print context
int PpPrintSetPC( PpPrintContext_t *pc, int mod_level, int lock, int member, void const * const data);
This function provides a mechanism to modify the attributes of a print context.
Don't modify the print context directly, as the appropriate changed bits won't be set and the application may stop working if the print context structure is redefined in future. |
The arguments are as follows:
Interactive overrides initial, which overrides local, which overrides global.
The PtPrintSel widget reads the Photon printer files and modifies the provided print context with the definitions within those files. The mod_level used for the changes on the print context are dictated by which file the definitions are read from:
If you want to prevent the user from modifying members of the print context you have set, specify a 1 in the lock field when calling PpPrintSetPC().
In the following table:
|
Member | Data |
---|---|
Pp_PC_NAME | String |
Pp_PC_LOCATION | String |
Pp_PC_DEVICE | String |
Pp_PC_DRIVER | String |
Pp_PC_NONPRINT_MARGINS | PhRect_t * |
Pp_PC_PROP_APP | String |
Pp_PC_PREVIEW_APP | String |
Pp_PC_FILENAME | String |
Pp_PC_COMMENT | String |
Pp_PC_DATE | String |
Pp_PC_USER_ID | String |
Pp_PC_PAGE_RANGE | String |
Pp_PC_SOURCE_OFFSET | PhPoint_t * |
Pp_PC_SOURCE_SIZE | PhDim_t * |
Pp_PC_SOURCE_RESOLUTION | PhPoint_t * |
Pp_PC_SOURCE_COLORS | int * |
Pp_PC_SCALE | PhPoint_t * |
Pp_PC_MARGINS | PhRect_t * |
Pp_PC_INTENSITY | int * |
Pp_PC_PRINTER_RESOLUTION | PhPoint_t * |
Pp_PC_PAPER_SIZE | PhDim_t * |
Pp_PC_COLLATING_MODE | char * |
Pp_PC_DITHERING | char * |
Pp_PC_COPIES | char * |
Pp_PC_ORIENTATION | char * |
Pp_PC_DUPLEX | char * |
Pp_PC_PAPER_TYPE | char * |
Pp_PC_PAPER_SOURCE | char * |
Pp_PC_INKTYPE | char * |
Pp_PC_COLOR_MODE | char * |
Pp_PC_DO_PREVIEW | char * |
Pp_PC_JOB_NAME | String |
Pp_PC_CONTROL | Read only: see PpPrintGetPC() |
By default, all members are 0 or NULL.
For example,
PpPrintSetPC( pc, PRINTER_GLOBAL, 0, Pp_PC_COLLATING_MODE, PaperCollateABCABCABC ); // succeeds as it's the first setting PpPrintSetPC( pc, PRINTER_LOCAL, 0, Pp_PC_COLLATING_MODE, PaperCollateAAABBBCCC ); // succeeds because PRINTER_LOCAL supersedes PRINTER_GLOBAL PpPrintSetPC( pc, PRINTER_LOCAL, 0, Pp_PC_COLLATING_MODE, PaperCollateABCABCABC ); // succeeds because changes at the same mod_level // are permitted. PRINTER_LOCAL == PRINTER_LOCAL PpPrintSetPC( pc, PRINTER_GLOBAL, 0, Pp_PC_COLLATING_MODE, PaperCollateAAABBBCCC ); // fails with errno == EPERM because changes by // a lower mod_level are NOT permitted. // PRINTER_GLOBAL < PRINTER_LOCAL
set_my_apps_Pp_prefs( PpPrintContext_t *pc ) { char do_preview = 1, duplex = some_value; PpPrintSetPC( pc, INITIAL_PC, 0, Pp_PC_DO_PREVIEW, &do_preview ); PpPrintSetPC( pc, INITIAL_PC, 0, Pp_PC_DUPLEX, &duplex ); PpPrintSetPC( pc, INITIAL_PC, 0, Pp_PC_COMMENT, "Hey, this is a comment!" ); // etc... }
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PpPrintClose(), PpPrintCreatePC(), PpPrintGetPC(), PpPrintNewPage(), PpPrintOpen(), PpPrintReleasePC(), PpPrintStart(), PpPrintStop(), PpPrintWidget()
Printing in the Programmer's Guide