home *** CD-ROM | disk | FTP | other *** search
/ Aminet 18 / aminetcdnumber181997.iso / Aminet / dev / m2 / CycloneModules.lha / modules / txt / InputEvent.def < prev    next >
Text File  |  1995-03-26  |  9KB  |  222 lines

  1. (*$ Implementation- *)
  2. DEFINITION MODULE InputEvent;
  3.  
  4. (* (C) Copyright 1994 Marcel Timmermans. All rights reserved. *)
  5.  
  6. FROM SYSTEM IMPORT ADDRESS;
  7. FROM Timer IMPORT TimeVal;
  8. IMPORT UtilityD;
  9.  
  10. TYPE
  11.   PointerPixelPtr   = POINTER TO PointerPixel;
  12.   PointerTabletPtr  = POINTER TO PointerTablet;
  13.   NewTabletPtr      = POINTER TO NewTablet;
  14.   InputEventPtr     = POINTER TO InputEvent;
  15.  
  16.  Class=(
  17.   null,             (* A NOP input event                              *)
  18.   rawkey,           (* A raw keycode from the keyboard device         *)
  19.   rawmouse,         (* The raw mouse report from the game port        *)
  20.                     (* device                                         *)
  21.   event,            (* A private console event                        *)
  22.   class5,           (* dummy                                          *)
  23.   pointerpos,       (* A Pointer Position report                      *)
  24.   timer,            (* A timer event                                  *)
  25.   gadgetdown,       (* select button pressed down over a Gadget       *)
  26.                     (* (address in ie_EventAddress)                   *)
  27.   gadgetup,         (* select button released over the same Gadget    *)
  28.                     (* (address in ie_EventAddress)                   *)
  29.   requester,        (* some Requester activity has taken place.  See  *)
  30.                     (* Codes REQCLEAR and REQSET                      *)
  31.   menulist,         (* this is a Menu Number transmission (Menu       *)
  32.                     (* number is in ie_Code)                          *)
  33.   closewindow,      (* User has selected the active Window's Close    *)
  34.                     (* Gadget                                         *)
  35.   sizewindow,       (* this Window has a new size                     *)
  36.   refreshwindow,    (* the Window pointed to by ie_EventAddress needs *)
  37.                     (* to be refreshed                                *)
  38.   newprefs,         (* new preferences are available                  *)
  39.   diskremoved,      (* the disk has been removed                      *)
  40.   diskinserted,     (* the disk has been inserted                     *)
  41.   activewindow,     (* the window is about to be been made active     *)
  42.   inactivewindow,   (* the window is about to be made inactive        *)
  43.   newpointerpos,    (* extended-function pointer position report      *)
  44.                     (* (V36)                                          *)
  45.   menuhelp,         (* Help key report during Menu session (V36)      *)
  46.   changewindow      (* the Window has been modified with move, size,  *)
  47.                     (* zoom, or change (V36)                          *)
  48.   );
  49.  
  50. CONST
  51.  classMax=ORD(MAX(Class)); (* the last class                          *) 
  52.  
  53.  
  54. (*  --- InputEvent.subClass --- *)
  55. (*  newpointerpos *)
  56.   compatible = 00H;  (* like pointerpos *)
  57.   pixel      = 01H;  (* InputEvent.eventAddress points to PointerPixel *)
  58.   tablet     = 02H;  (* InputEvent.eventAddress points to PointerTablet *)
  59.   newTablet  = 03H;  (* InputEvent.eventAddress points to NewTablet *)
  60.  
  61. TYPE
  62.   XYRec=RECORD
  63.     X:INTEGER;
  64.     Y:INTEGER;
  65.   END;
  66.  
  67. (* pointed to by InputEvent.eventAddress for newpointerposs,
  68.  * and InputEvent.subClass=pixel.
  69.  *
  70.  * You specify a screen and pixel coordinates in that screen
  71.  * at which you'd like the mouse to be positioned.
  72.  * Intuition will try to oblige, but there will be restrictions
  73.  * to positioning the pointer over offscreen pixels.
  74.  *
  75.  * IEQUALIFIER_RELATIVEMOUSE is supported for IESUBCLASS_PIXEL.
  76.  *)
  77.   PointerPixel=RECORD
  78.     screen:ADDRESS;            (* pointer to an open screen *)
  79.     position:XYRec;            (* pixel coordinates in iepp_Screen *)
  80.   END;
  81.  
  82. (* pointed to by InputEvent.eventAddress for newpointerpos,
  83.  * and InputEvent.subClass=tablet.
  84.  *
  85.  * You specify a range of values and a value within the range
  86.  * independently for each of X and Y (the minimum value of
  87.  * the ranges is always normalized to 0).
  88.  *
  89.  * Intuition will position the mouse proportionally within its
  90.  * natural mouse position rectangle limits.
  91.  *
  92.  * IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_TABLET.
  93.  *)
  94.   PointerTablet=RECORD
  95.     range:XYRec;      (* 0 is min, these are max         *)
  96.     value:XYRec;      (* between 0 and range             *)
  97.     pressure:INTEGER; (* -128 to 127 (unused, set to 0)  *)
  98.   END;
  99.  
  100. (* The ie_EventAddress of an IECLASS_NEWPOINTERPOS event of subclass
  101.  * IESUBCLASS_NEWTABLET points at an IENewTablet structure.
  102.  *
  103.  *
  104.  * IEQUALIFIER_RELATIVEMOUSE is not supported for IESUBCLASS_NEWTABLET.
  105.  *)
  106.  
  107.   NewTablet=RECORD
  108.  
  109.     (* Pointer to a hook you wish to be called back through, in
  110.      * order to handle scaling.  You will be provided with the
  111.      * width and height you are expected to scale your tablet
  112.      * to, perhaps based on some user preferences.
  113.      * If NULL, the tablet's specified range will be mapped directly
  114.      * to that width and height for you, and you will not be
  115.      * called back.
  116.      *)
  117.     callBack:UtilityD.HookPtr;
  118.  
  119.     (* Post-scaling coordinates and fractional coordinates.
  120.      * DO NOT FILL THESE IN AT THE TIME THE EVENT IS WRITTEN!
  121.      * Your driver will be called back and provided information
  122.      * about the width and height of the area to scale the
  123.      * tablet into.  It should scale the tablet coordinates
  124.      * (perhaps based on some preferences controlling aspect
  125.      * ratio, etc.) and place the scaled result into these
  126.      * fields.        The ient_ScaledX and ient_ScaledY fields are
  127.      * in screen-pixel resolution, but the origin ( [0,0]-point )
  128.      * is not defined.        The ient_ScaledXFraction and
  129.      * ient_ScaledYFraction fields represent sub-pixel position
  130.      * information, and should be scaled to fill a UWORD fraction.
  131.      *)
  132.     scaledX         : CARDINAL;
  133.     scaledY         : CARDINAL;
  134.     scaledXFraction : CARDINAL;
  135.     scaledYFraction : CARDINAL;
  136.  
  137.     (* Current tablet coordinates along each axis: *)
  138.     tabletX         : LONGCARD;
  139.     tabletY         : LONGCARD;
  140.  
  141.     (* Tablet range along each axis.  For example, if ient_TabletX
  142.      * can take values 0-999, ient_RangeX should be 1000.
  143.      *)
  144.     rangeX          : LONGCARD;
  145.     rangeY          : LONGCARD;
  146.  
  147.     (* Pointer to tag-list of additional tablet attributes.
  148.      * See <intuition/intuition.h> for the tag values.
  149.      *)
  150.     tagList         : UtilityD.TagPtr;
  151.   END;
  152.  
  153.  
  154. CONST
  155. (*  --- InputEvent.ie_Code --- *)
  156. (*  IECLASS_RAWKEY *)
  157.   upPrefix       = 080H;
  158.   keyCodeFirst   = 000H;
  159.   keyCodeLast    = 077H;
  160.   commCodeFirst  = 078H;
  161.   commCodeLast   = 07FH;
  162.  
  163. (*  IECLASS_ANSI *)
  164.   c0First        = 000H;
  165.   c0Last         = 01FH;
  166.   asciiFirst     = 020H;
  167.   asciiLast      = 07EH;
  168.   asciiDel       = 07FH;
  169.   c1First        = 080H;
  170.   c1Last         = 09FH;
  171.   latin1First    = 0A0H;
  172.   latin1Last     = 0FFH;
  173.  
  174. (*  IECLASS_RAWMOUSE *)
  175.   lButton        = 068H;  (* also uses IECODE_UP_PREFIX *)
  176.   rButton        = 069H;
  177.   mButton        = 06AH;
  178.   noButton       = 0FFH;
  179.  
  180. (*  IECLASS_EVENT (V36) *)
  181.   newActive      = 001H;  (* new active input window *)
  182.   newSize        = 002H;  (* resize of window *)
  183.   refresh        = 003H;  (* refresh of window *)
  184.  
  185. (*  IECLASS_REQUESTER *)
  186. (*  broadcast when the first Requester (not subsequent ones) opens up in *)
  187. (*  the Window *)
  188.   reqSet         = 001H;
  189. (*  broadcast when the last Requester clears out of the Window *)
  190.   reqClear       = 000H;
  191.  
  192.  
  193. TYPE
  194. (*  --- InputEvent.ie_Qualifier --- *)
  195.  Qualifiers=(
  196.   lShift,rShift,capsLock,control,lAlt,rAlt,lCommand,rCommand,
  197.   numericPad,repeat,interrupt,multiBroadcast,midButton,
  198.   rightButton,leftButton,relativeMouse
  199.  );
  200.  QualifierSet=SET OF Qualifiers;
  201.  
  202. (*----- InputEvent -------------------------------------------------*)
  203.  
  204.  InputEvent=RECORD
  205.   nextEvent:InputEventPtr;    (* the chronologically next event *)
  206.   class:Class;                (* the input event class *)
  207.   subClass:Class;             (* optional subclass of the class *)  
  208.   code:CARDINAL;              (* the input event code *)  
  209.   qualifier:QualifierSet;     (* qualifiers in effect for the event*)  
  210.   CASE :INTEGER OF
  211.   |0: x,y:INTEGER;            (* the pointer position for the event*)
  212.   |1: eventAddress:ADDRESS    (* the event address *)
  213.   |2: prev1DownCode:SHORTCARD;(* previous down keys for dead *)
  214.       prev1DownQual:SHORTCARD;(* key translation: the ie_Code *)
  215.       prev2DownCode:SHORTCARD;(* & low byte of ie_Qualifier for *)
  216.       prev2DownQual:SHORTCARD;(* last & second last down keys *)   
  217.   END;
  218.   timeStamp:TimeVal
  219.  END;
  220.  
  221. END InputEvent.
  222.