home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 337.lha / Helper_v.07 / DoRawTbl.def < prev    next >
Encoding:
Modula Definition  |  1990-01-26  |  2.5 KB  |  54 lines

  1. DEFINITION MODULE DoRawTbl;
  2.  
  3. (*======================================================================*)
  4. (*                        Helper version v0.07                          *)
  5. (*======================================================================*)
  6. (*           Copyright © 1989 Mike Cargal, All Rights Reserved          *)
  7. (*======================================================================*)
  8. (*      Version: 0.07           Author : Mike Cargal                    *)
  9. (*      Date   : 20-Jun-89      Changes: Original                       *)
  10. (*======================================================================*)
  11.  
  12.  
  13. FROM InputEvents IMPORT IEQualifierSet;
  14. FROM Intuition   IMPORT WindowPtr;
  15.  
  16. TYPE
  17.   RawEnt = RECORD
  18.     Cd   : CARDINAL;
  19.     Qual : IEQualifierSet;
  20.   END;
  21.  
  22.   RawTbl    = ARRAY [0..255] OF RawEnt;
  23.   RawTblPtr = POINTER TO RawTbl;
  24.   
  25. PROCEDURE BuildRawTbl() : RawTblPtr;
  26.  
  27.   (*-------------------------------------------------------------\
  28.    |                                                             |
  29.    | Using current Key Map, generate table of Raw Key Codes      |
  30.    |  and Qualifiers indexed by the character they generate      |
  31.    |  (if the key combination produces a single character).      |
  32.    |                                                             |
  33.    | Then use code like the following to translate back to       |
  34.    |  Raw key codes.                                             |
  35.    |                                                             |
  36.    | i : CHAR                                                    |
  37.    |                                                             |
  38.    |     ieCode      := MyRawTbl^[CARDINAL(i)].Cd                |
  39.    |     ieQualifier := MyRawTbl^[CARDINAL(i)].Qual              |
  40.    |                                                             |
  41.    | These values can be used to feed raw key events into the    |
  42.    |  input device.                                              |
  43.    |                                                             |
  44.    | NOTE:  This routine and the RawTbl structure could be       |
  45.    |  modified to do better validation, since it is possible     |
  46.    |  to translate a CHAR for which *NO* Raw Key code/Qualifier  |
  47.    |  exists.  The current implementation would generate a       |
  48.    |  Raw Key code 0 with no Qualifier (this is valid, but       |
  49.    |  is probably not what you intended).                        |
  50.    |                                                             |
  51.    \-------------------------------------------------------------*)
  52.  
  53.  
  54. END DoRawTbl.