[Previous] [Contents] [Index] [Next]

PpPrintSetPC()

Modify the attributes of a print context

Synopsis:

int PpPrintSetPC( PpPrintContext_t *pc, 
                  int mod_level,
                  int lock,
                  int member, 
                  void const * const data);

Description:

This function provides a mechanism to modify the attributes of a print context.


Note: 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:

pc
The print context, created by PpPrintCreatePC()
mod_level
A value indicating the modifier of the context. The possible values are:

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().

lock
If nonzero, the PtPrintSel widget and properties applications won't override or allow modification of the member. Its value is locked. Locked members have their controls dimmed and inactive in the PtPrintSel widget or PtPrintSelection() dialog.
data
A pointer to the data to be assigned to the specified print context member.
member
The member of the print context to modify, as given in the table below. (For a description of the members, see the chapter on Printing in the Programmer's Guide.)

Note: In the following table:
  • "String" indicates a char * pointer to a null-terminated sequence of characters
  • "char *" indicates a char * pointer to a value in the range 0x0 to 0xFF

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.

Returns:

0
Success.
-1
An error occurred. See errno for details.

Errors:

EPERM
The specified member was set by a modification level that supersedes mod_level:

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
    
EACCES
The specified member couldn't be changed because it's locked.
ESRCH
An unknown member was specified.

Examples:

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...
    }

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PpPrintClose(), PpPrintCreatePC(), PpPrintGetPC(), PpPrintNewPage(), PpPrintOpen(), PpPrintReleasePC(), PpPrintStart(), PpPrintStop(), PpPrintWidget()

Printing in the Programmer's Guide


[Previous] [Contents] [Index] [Next]