## Presentation Device Driver Reference for OS/2

[prev][next][parent][TOC]

### OS2_PM_DRV_ENABLE: Subfunction 05h - EnableDeviceContext - Remarks

The value of the return code from this subfunction, if it is not -1, is saved by the system and passed back to the presentation driver on all future calls to this DC instance. This value is expected to be a pointer or handle to the instance data.

The handling routine initializes relevant fields in the instance data to their default values. For example, it calls WinQueryProcessCP to get the initial Code Page ID.

STARTDOC/ABORTDOC/ENDDOC (Hardcopy drivers only)

The hardcopy driver allows the following sequences to GreEscapes within the subfunctions EnableDeviceContext and BeginCloseDC brackets:

GreEscape DEVESC_STARTDOC
GreEscape DEVESC_ENDDOC - spools first job
GreEscape DEVESC_STARTDOC
GreEscape DEVESC_ENDDOC - spools second job
GreEscape DEVESC_STARTDOC
GreEscape DEVESC_ENDDOC
GreEscape DEVESC_STARTDOC
GreEscape DEVESC_ABORTDOC - terminates job
GreEscape DEVESC_STARTDOC
GreEscape DEVESC_ENDDOC - spools first job

Instance data refers to information (such as the name of a spool file and whether a bit map has been created) that applies to a specific instance of a device context. Global data, which applies to all instances of a device context that is using the same presentation driver, is held in the Physical Device Block (PDB). A pointer to this block is passed in the DENPARAMS structure to the EnableDeviceContext routine to be included in the instance data. See Instance Data. A typical example of instance data follows:

    typedef struct _DC {

      USHORT            DCIIdentifier;     /* Contains DC_IDENTIFIER                */

      ULONG             DCIDCType;         /* DC type 0-8                           *

      HDC               DCIhdc;            /* DC handle                             */

      struct _DC *      DCINextEntry;      /* Next instance                         */

      LONG              DCISaveCount;      /* Number of saved DC states             */

      pBitmapHeader     DCISelListEntry;   /* Selected bit-map list entry           */

      USHORT            DCIBitmapType;     /* Current bit-map type                  */

      POINTL            DCICurrPos;        /* Current position                      */

      DCHARBUNDLE       DCICurTxtAts;      /* Current Text attributes bundle        */

      DLINEBUNDLE       DCICurLinAts;      /* Current Line attributes bundle        */

      DAREABUNDLE       DCICurPtnAts;      /* Current Pattern attributes bundle     */

      DIMAGEBUNDLE      DCICurImgAts;      /* Current Image attributes bundle       */

      DMARKERBUNDLE     DCICurMrkAts;      /* Current Marker attributes bundle      */

      USHORT            DCILinePatCnt;     /* Current line pattern count            */

      USHORT            DCILineTypMask;    /* Mask used for line types              */

      POINTL            DCIPatternOrigin;  /* Pattern origin                        */

      pBitmapHeader     DCIMarker;         /* Pointer to marker definition          */

      BOOL              DCIMarkerSimReq;   /* On, if simulation required            */

      USHORT            DCIFontType;       /* Type of current font                  */

      pRealizedFontType DCIRealizedFonts;  /* Font table array                      */

      USHORT            DCIFontTabNum;     /* Number of Font table entries          */

      BOOL              DCIPairKerning;    /* Enabled\disabled state                */

      ULONG             DCICodePage;       /* Currently selected code page          */

      BOOL              DCITextSim;        /* Set if text simulation required       */

      POINTL            DCIOrigin;         /* Current DC origin                     */

      PCOLORTABLE       DCIColorTable;     /* Pointer to color table                */

      BOOL              DCIBackgndDefined; /* Status of CLR_BACKGROUND               */

      BOOL              DCINeutralDefined; /* Status of CLR_NEUTRAL                 */

      USHORT            DCIColTabSize;     /* Color table size                      */

      USHORT            DCIColFormat;      /* Format of color table                 */

      USHORT            DCIColStatus;      /* Status of color table                 */

      USHORT            DCILowIndex;       /* Lowest index in table                 */

      USHORT            DCIHighIndex;      /* Highest   index   in   table                   * /

       USHORT               DCISysColState ;      / *   Latest   state   of   system   colors           * /

       COLORPAIR           DCILineColatts ;      / *   Line   color   indexes                       * /

       COLORPAIR           DCIPattColatts ;      / *   Pattern   colors   indexes                   * /

       COLORPAIR           DCICharColatts ;      / *   Character   colors   indexes                 * /

       COLORPAIR           DCIImagColatts ;      / *   Image   colors   indexes                     * /

       COLORPAIR           DCIMarkColatts ;      / *   Marker   colors   indexes                    * /

       ClipRectangle       DCIClipRects [ CACHED _ CLIPS ] ;

                                               / *   Clip   rectangles                           * /

       BOOL                 ClipChanged ;         / *                                            * /

       USHORT               DCIClipOrder ;        / *   Order   of   clip   rectangles                 * /

       USHORT               DCIClipNum ;          / *   Number   of   clip   rectangles                * /

       RECTL                DCIBoundingClip ;     / *   Current   screen / bit - map   area              * /

       USHORT               DCIEngineClips ;      / *   Clip   regions   in   engine                   * /

       BOOL                 DCIIsDirty ;          / *   Indicates   when   clip   regions              * /

                                               / *   are   invalid

       RECTL                DCIGPIBounds ;        / *   Current   GPI   bounds                       * /

       BOOL                 DCIDefGPIBounds ;     / *   On ,   if   GPI   bounds   are   default           * /

       RECTL                DCIUserBounds ;       / *   Current   user   bounds                      * /

       BOOL                 DCIDefUserBounds ;    / *   On ,   if   user   bounds   are   default          * /

       SHORT                DCIConvFactor ;       / *   For   device ,   conversion                   * /

       BOOL                 DCICorrInvalid ;      / *   Correlation   rectangles   invalid          * /

       RECTL                DCIPickWindowPage ;   / *   Pick   window   in   page   coordinates         * /

       DevRect              DCIPickWindowDevice ;

                                               / *   Pick   window   in   device   coordinates       * /

       PRECTL               DCICorrRects ;        / *   Current   correlation   rectangles          * /

       USHORT               DCICorrNum ;          / *   Number   of   correlation   rectangles        * /

       USHORT               DCICorrSize ;         / *   Number   of   correlation   rectangles   for    * /

                                               / *   which   storage   has   been   allocated        * /

      XFORM             DCITransform;      /* Transformation data                   */

      FONTDETAILS       DCIAvioFonts[CNT_LOADABLE_LCIDS + 1];

                                           /* AVIO loadable font definitions        */

      USHORT            DCIChanged;        /* Shows non-default bundles             */

      USHORT            DCISpacingType;    /* Spacing type of current font          */

      BOOL              DCIXFrmSimple;     /* Transform type                        */

      ULONG             StyleNumber;       /* Line style state and mask             */

      USHORT            DCICommandMask;    /* Used to mask command bits             */

      POINTL            DCICurrPosWorld;   /* Current world position                */

      pBitmapHeader     Pattern;           /* Pattern for direct DC                 */

      AVIOINFO          DCIAvioInfo;       /* Avioparms material                    */

      FONTDETAILS       CurrentFont;       /* Presentation Mgr. format current font */

      PDEVPAL           Palette;           /* Handle/pointer of palette             */

      PRGB2             DCIDeviceDefaultPalette;

                                           /* Device default palette that was       */

                                           /* current the last time color table     */

                                           /* indexes were calculated               */

    } DC;