version 2003
PA_GetPluginProperties (params; props)
Parameter | Type | Description | |
params | PA_PluginParameters | Parameters received in PluginMain | |
props | PA_PluginProperties* | Pointer the the area properties |
Description
The routine PA_GetPluginProperties returns the area settings in the PA_PluginProperties pointed to by props.
params is the PA_PluginParameters the plug-in received in its PluginMain routine.
props points to a structure of type PA_PluginProperties. This structure holds various information concerning the area: the font, size, face, color set by the user in the Design environment, drag and drop availability, and information while the area is printed.
IMPORTANT NOTE
This routine can be called only at initialization, when PA_GetAreaEvent returns eAE_Init or eAE_DesignUpdate. Otherwise, PA_GetLastError() returns eER_BadEventCall. If the plug-in needs to use the properties at any other time (MouseDown, update) it must duplicate the properties in a private structure.
This structure is defined in the "PublicTypes.h" header file as:
typedef struct PA_PluginProperties { short fVersion; short fFontID; // Macintosh font ID short fJustification; char fFontSize; char fFontFace; long fForeColor; long fBackColor; void* fAdvancedProperties; long fAdvancedPropertiesSize; char fPageMode; char fPrintingMode; short fPage; short fTable; long fUnused; char fDraggable; char fDroppable; short fLook; void* fMacWindow; void* fMacPort; void* fWinHWND; void* fWinHDC; char fInterProcessVariable; } PA_PluginProperties;
Examples
(1) Is the area an interprocess ?
char IsAreaInterprocess(PA_PluginParams params) { PA_PluginProperties props; PA_GetPluginProperties(params, &props); return props.fInterProcessVariable; }
(2) Save the properties at initialization
typedef struct { PA_PluginProperties props; /* . . . other fields of this private structure . . . */ } AREA, *AREAPTR; void PluginMain (long selector, PA_PluginParameters params) { switch (selector) { /* . . . */ case 11: // in this sample, the area is 11th routine MyArea(params); break; /* . . . */ } } void MyArea(PA_PluginParameters params) { AE_AreaEvent event; event = PA_GetAreaEvent( params ); switch ( event ) { /* . . . */ case eAE_Init : { // Allocate our private data AREA area = malloc(sizeof(AREA); if(area) { // Get the properties. At Runtime, the properties can only be // retrieved at initialization PA_GetPluginProperties(params, &area.props); /* . . . initialize the other fields . . . */ } // "link" the reference to our private data PA_SetPluginReference(params, area); } break; /* . . . next code . . .*/ }
See Also
Create and use an external area, PA_GetAreaEvent.
Error Handling
Use PA_GetLastError to see if an error occurred