/* ********** Wacom Tablet Driver Interface Definitions ********* */
/*                                                                */
/*                        	Copyright (C) 1992                    */
/*                      	WACOM Technologies, Inc.              */
/*                          All Rights Reserved                   */
/*                                                                */
/*                                                                */
/* ************************************************************** */


#ifndef __WACOM__
#define __WACOM__
#endif

#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=mac68k
#endif



/* ***** Standard Data Structure For Tablet Access *****
 *
 *       Based on  Apple Tech. Note #266 version #2
 *
 */


#define MAXIMUM_TRANSDUCERS 2

struct transRecord {
    /* *** Transducer info *** */
    char	DOFTrans;			/* degrees of freedom and transducer type */
    char	orientFlag;			/* type of orientation information */
    short	pressLevels;		/* pressure support and number of levels */
    unsigned short	xScale;		/* x scale factor for screen mapping */
    short	xTrans;				/* x translation factor for screen */
    unsigned short	yScale;		/* y scale factor for screen mapping */
    short	yTrans;				/* y translation factor for screen */
    char	flags;				/* proximity, update flag, and # buttons */
    unsigned char pressThresh;	/* pressure threshold - normally unused */
    short	buttonMask;			/* button mask of driver-reserved buttons */
    short	errorFlag;			/* error code generated */
    short	buttons;			/* buttons pressed */
    short	tangPress;			/* tangential pressure level */
    short	pressure;			/* normal pressure level */
    long	timeStamp;			/* ticks at latest update */
    long	xCoord;				/* x coordinate in resolution units */
    long	yCoord;				/* y coordinate in resolution units */
    long	zCoord;				/* z coordinate in resolution units */
    short	xTilt;				/* x tilt */
    short	yTilt;				/* y tilt */
    short	unused[8];			/* remainder of unused attitude matrix */
};

typedef struct transRecord transRecord;



struct AppleRecord {
    /* *** Header section *** */
    char	version;			/* version of this data format */
    char	semaphore;			/* for future use -- tells if drvr is enabled */
    char	cursors;			/* number of cursors with tablet */
    char	updateFlags;		/* flags used when updating structure */
    short	angleRes;			/* metric bit & angular resolution */
    short	spaceRes;			/* spatial resolution of the tablet */
    long	xDimension;			/* x dimension in resolution units */
    long	yDimension;			/* y dimension in resolution units */
    long	zDimension;			/* z dimension in resolution units */
    long	xDisplace;			/* x displacement - minimum x value */
    long	yDisplace;			/* y displacement - minimum y value */
    long	zDisplace;			/* z displacement - minimum z value */
    Ptr		resvPtr;			/* resvPtr... */
    long	tabletID;			/* contains 'TBLT' identifying the device */
    /* cursor section */
	transRecord	trans[MAXIMUM_TRANSDUCERS];		/* data for 5 transducers */
								/* 1 for SD and ADB, 2 for UD in multimode, 5 for Meeting Staff */
};

typedef struct AppleRecord AppleRecord;
typedef AppleRecord *AppleRecordPtr;


/* ***** Standard Data Structure For Tablet Access *****
 *
 *  Based on:
 *            "Proposed ADB Tablet Memory Structure"
 *                        Dec. 19, 1988
 *                 Dave Fleck, GTCO Corporation
 *
 *	This structure is incorrect with regard to Tech. Note #266
 *	However this structure is maintained for compatibility with
 *	existing applications.
 *	Parsing the ADB table or calling the driver with CSCode 47
 * 	will yield the AppleRecord.
 *
 */



typedef struct tabletRecord {

    /* *** Header section *** */
    
    char	version;			/* version of this data format */
    char	semaphore;			/* for future use -- tells if drvr is enabled */
    char	cursors;			/* number of cursors with tablet */
    char	updateFlags;		/* flags used when updating structure */
    short	angleRes;			/* metric bit & angular resolution */
    short	spaceRes;			/* spatial resolution of the tablet */
    long	xDimension;			/* x dimension in resolution units */
    long	yDimension;			/* y dimension in resolution units */
    long	zDimension;			/* z dimension in resolution units */
    long	xDisplace;			/* x displacement - minimum x value */
    long	yDisplace;			/* y displacement - minimum y value */
    long	zDisplace;			/* z displacement - minimum z value */
    short	relative;			/* RELATIVE - relative value */
    short	dummyInt;			/* RELATIVE - extra bytes for resvPtr... */
    long	tabletID;			/* contains 'TBLT' identifying the device */
    
    /* *** Cursor section *** */
    
    char	DOFTrans;			/* degrees of freedom and transducer type */
    char	orientFlag;			/* type of orientation information */
    short	pressLevels;		/* pressure support and number of levels */
    unsigned short	xScale;		/* x scale factor for screen mapping */
    short	xTrans;				/* x translation factor for screen */
    unsigned short	yScale;		/* y scale factor for screen mapping */
    short	yTrans;				/* y translation factor for screen */
    char	flags;				/* proximity, update flag, and # buttons */
    unsigned char pressThresh;	/* pressure threshold - normally unused */
    short	buttonMask;			/* button mask of driver-reserved buttons */
    short	errorFlag;			/* error code generated */
    short	buttons;			/* buttons pressed */
    short	tangPress;			/* tangential pressure level */
    short	pressure;			/* normal pressure level */
    long	timeStamp;			/* ticks at latest update */
    long	xCoord;				/* x coordinate in resolution units */
    long	yCoord;				/* y coordinate in resolution units */
    long	zCoord;				/* z coordinate in resolution units */
    short	xTilt;				/* x tilt */
    short	yTilt;				/* y tilt */
    							/* the specification calls for 8 more */
    							/* ...integers containing an attitude */
    							/* ...matrix.  This driver does not use */
    							/* ...the attitude matrix so these 16  */
    							/* ...bytes are re-allocated as described */
    unsigned short		tabXMin;			/* minimum tablet x dimension mapped */
    unsigned short		tabYMin;			/* minimum tablet y dimension mapped */
    unsigned short		tabXMax;			/* maximum tablet x dimension mapped */
    unsigned short		tabYMax;			/* maximum tablet y dimension mapped */
    unsigned short		screenXMin;			/* minimum screen x dimension mapped */
    unsigned short		screenYMin;			/* minimum screen y dimension mapped */
    unsigned short		screenXMax;			/* maximum screen x dimension mapped */
    unsigned short		screenYMax;			/* maximum screen y dimension mapped */

} tabletRecord;

typedef struct myCntrlParam 
{			/* handy substitute due to long params */
    QElemPtr qLink;                     /* queue link in header */
    short qType;                        /* type byte for safety check */
    short ioTrap;                       /* FS: the Trap */
    Ptr ioCmdAddr;                      /* FS: address to dispatch to */
    ProcPtr ioCompletion;               /* completion routine addr (0 for synch calls) */
    OSErr ioResult;                     /* result code */
    StringPtr ioNamePtr;                /* ptr to Vol:FileName string */
    short ioVRefNum;                    /* volume refnum (DrvNum for Eject and MountVol) */

	short	ioCRefNum;					/* refNum for I/O operation */
	short	csCode;						/* word for control status code */
	Ptr		csParam[6];					/* operation-defined parameters */
} myCntrlParam;

/* ***** Flags used within a TABLETRECORD *****
 *
 */

        /* updateFlags flags */
#define FRESHDATA	0x04		/* new data loaded */
#define FRESHATTR	0x08		/* new attributes loaded */
#define CHANGEDDATA	0x40		/* application has changed data */
#define CHANGEDATTR	0x80		/* application has changed attributes */

        /* tranducer types */
#define UNKNOWN		0x00
#define PEN			0x10
#define CURSOR		0x20
#define ERASER 		0x30

        /* degrees of freedom flags and transducer masks */
#define TRANSMASK	0x30
#define DOFX		0x04
#define DOFY		0x02
#define DOFZ		0x01

        /* orientation type flags */
#define NOATTITUDE	0x00		/* no transducer orientation info */
#define ATTITUDE	0x01		/* structure contains attitude matrix */
#define TILT		0x02		/* tilt information is available */

        /* general flags */
#define PROXIMITY	0x80		/* is the transducer within proximity */
#define TRACKING	0x40		/* is driver tracking the mouse cursor; 0 = YES */

		/* errorFlag's used by the Wacom driver */
#define NOERROR		0x00		/* no error has occurred */
#define PORTERROR	0x01		/* error in controlling the serial port */
#define NORESPONSE	0x02		/* tablet is not responding */




/*****
 *  SD Model Information
 *
 */
#define SD510		0
#define		SD510MAXX	4640
#define		SD510MAXY	3020
#define		SD510RES	508
#define SD210		1
#define		SD210MAXX	31750
#define		SD210MAXY	23100
#define		SD210RES	1270
#define SD31XL		2
#define		SD31XMAXX	21200
#define		SD31XMAXY	15000
#define		SD31XLRES	1270
#define SD31XE		3
#define		SD31XEMAXX	22860
#define		SD31XEMAXY	15240
#define		SD31XERES	1270
#define SD320		4
#define		SD320MAXX	19050
#define		SD320MAXY	19050
#define		SD320RES	1270
#define SD420		5
#define		SD420MAXX	15240
#define		SD420MAXY	15240
#define		SD420RES	1270
#define SD013A		6
#define		SD013AMAXX	59650
#define		SD013AMAXY	44450
#define		SD013ARES	1270
#define SD113A		7
#define		SD113AMAXX	49600
#define		SD113AMAXY	36900
#define		SD113ARES	1270
#define UDSeries	8
#define SmallUDSeries	14
#define		UDSeriesRES	1270
#define UD0608		9
#define		UD0608MAXX	8192
#define		UD0608MAXY	6144
#define		UD0608RES	1016
#define PL100V		10
#define		PL100VMAXX	8192
#define		PL100VMAXY	6144
#define		PL100VRES	508
#define MS200X		11
#define		MS200XMAXX	4157
#define		MS200XMAXY	3118
#define		MS200XRES	79
#define SD010L		12
#define		SD010LMAXX	59690
#define		SD010LMAXY	44450
#define		SD010LRES	1270
#define SD110L		13
#define		SD110LMAXX	44450
#define		SD110LMAXY	31750
#define		SD110LRES	1270



/* ***** csCode's *****
 *
 */

#define GET_RECORD	20					/* requests the address of the */
										/* ...current tablet record */

#if PRAGMA_ALIGN_SUPPORTED
#pragma options align=reset
#endif

/* ********************************************************************* */
/*                                                                       */
/*                            End of Wacom.h                             */
/*                                                                       */
/* ********************************************************************* */
