home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Workbench / dosdrivers / GTDriver.lha / Distrib / Programming / include / GTDriverMPC.h < prev   
Encoding:
C/C++ Source or Header  |  1994-11-03  |  4.5 KB  |  116 lines

  1. /*---------------------------------------------------------------------------------
  2.   File TabletMPC.h: this file contains definition of constants and structures used
  3.   by programs that want to use GTDriver directly.
  4.   ---------------------------------------------------------------------------------*/
  5.  
  6.  
  7. #define GTDPUBPORTNAME    "GTDPubPort"    /* name of GTDriver public message port        */
  8.  
  9. /* GTDriver expect to receive the following type of messages at its public port.
  10.  * Command must be one of the following MPC definitions, while Data depend on the
  11.  * command.
  12.  * When you PutMsg() the command you must Wait at your replyport. when the reply is
  13.  * back you must check at the Command field: if it is COMMAND_OK your request has been
  14.  * satisfied otherwise Command == COMMAND_FAILED and you may find some more details in
  15.  * Data field.
  16.  */
  17.  
  18. struct TabletCommand{
  19.     struct Message msg;
  20.     UWORD  Command;
  21.     APTR   Data;
  22. };
  23.  
  24. /* Here are the commands. If not mentioned, Data is ignored by GTDriver                */
  25. #define MPC_QUIT             0    /* Quit GTDriver !                                     */
  26.                                 /* The following 4 are used mainly by GTDOptions    */
  27. #define MPC_NEWPREFS         1    /* Load again prefs from "ENV:GTD.Prefs"             */
  28. #define MPC_TESTPREFS         2    /* Load prefs from "T:GTD.temp" but hold old values */
  29. #define MPC_NOTESTPREFS        3    /* Exit from test (resume old values)                */
  30. #define MPC_NEWBUTTONS        4    /* Get new buttons definition. Data must point        */
  31.                                 /*   to the name of the ".but" file.                    */
  32. #define MPC_SERVERMODE        5    /* Switch to server mode: Data is the address of the*/
  33.                                 /* MsgPort of your program where GTDriver has to     */
  34.                                 /*   send events                                    */
  35. #define MPC_DRIVERMODE        6    /* Switch to driver mode                            */
  36. #define MPC_GETPREFS        7   /* Data must point to an istance of GTDPrefs         */
  37.                                 /*   structure. when the command is replied to your    */
  38.                                 /*   program (if no error occurs) the structure will*/
  39.                                 /*   be filled with GTDriver settings. structure    */
  40.                                 /*   GTDPrefs is defined later in this file.        */
  41.  
  42. /* Values for the Command field when you get the reply                                */
  43.  
  44. #define COMMAND_OK        0
  45. #define COMMAND_FAILED    1
  46.  
  47. /* Values for the Data field if Command == COMMAND_ERROR                            */
  48.  
  49. #define CMDERR_SERVER           0 /* The driver is already in server mode (if you sent*/
  50.                                 /* CMD_SERVER) or you are not the client            */
  51.                                 /*   already a server                                 */
  52. #define CMDERR_PREFS_ERROR      1 /* Error while parsing a prefs file                 */
  53. #define CMDERR_PORT_ERROR      2 /* unable to allocate msg port */
  54. #define NO_PUBPORT             -1    /* you can use this if you don't find the GTDPUBPORT*/
  55.  
  56.  
  57. struct GTDPrefs
  58. {
  59.     float Version;            /* Version of the driver                    */
  60.     short Mode;                /* Working mode (see below)                    */
  61.     char  Emulation[64];    /* Name of the emulation in use                */
  62.     short Baud;                /* Baud rate                                */
  63.     char  InitString[256];    /* String sent to the tablet at the start    */
  64.     short Priority;            /* Priority of the driver process            */
  65.     short Pressure;            /* Pressure threshold for left mouse button */
  66.                             /*   emulation (Wacom emulation only)        */
  67.     short DPI;                /* Dot per inch                                */
  68.     short Metric;            /* (See below)                                */
  69.     float XDim;                /* X and Y dimension (expressed in Metric)    */
  70.     float YDim;
  71.     float ULC_x;            /* Upper Left and Lower Right corner of the    */
  72.     float ULC_y;            /* clip rectangle (expressed in metric)        */
  73.     float LRC_x;
  74.     float LRC_y;
  75.     BOOL SwapXY;            /* If TRUE X and Y axes are swapped            */
  76.     BOOL MirrorX;            /* If TRUE X axis is mirrored                */
  77.     BOOL MirrorY;            /* If TRUE Y axis is mirrored                */
  78. };
  79.  
  80. /* These values are  for field "Metric" and "Mode" of truct GTDPrefs    */
  81.  
  82. #define METRIC_CM        0
  83. #define METRIC_INCHES    1
  84. #define MODE_DRIVER        0
  85. #define MODE_SERVER        1
  86.  
  87.  
  88. /* You can use these two factor to convert inches to a cm value and vice versa */
  89.  
  90. #define CONV_INCHES2CM    2.54417
  91. #define CONV_CM2INCHES    0.393055
  92.  
  93.  
  94. /* When the driver is switched to SERVER mode it start sending tablet events to the    */
  95. /* message port specified in the Data field of the command MPC_SERVER                */
  96. /* Events are struct TabletMessage. First of all you must check the type field:        */
  97. /* If type ==  TMTYPE_COORDS it has been generated by moving the stylus on the         */
  98. /* tablet.                                                                             */
  99. /* If type == TMTYPE_PBUTTON a pseudo-button has been pressed on the tablet and you    */
  100. /* can find the associated key in the key field (WARNING: only non-special key are    */
  101. /* copied to the key field                                                            */
  102.  
  103. #define TMTYPE_COORDS     1
  104. #define TMTYPE_PBUTTON     2
  105.  
  106. struct TabletMessage{
  107.     struct Message msg;
  108.     UWORD type;
  109.     UWORD x,y;
  110.     ULONG buttons;
  111.     char  key;
  112.     WORD  pressure;
  113. };
  114.  
  115.  
  116.