home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d6xx / d642 / editkeys.lha / EditKeys / EditKeys.Doc < prev    next >
Text File  |  1992-04-26  |  21KB  |  457 lines

  1.  
  2.                 EditKeys v1.2
  3.                 -------------
  4.  
  5.                  © 1991 David Kinder
  6.                  -------------------
  7.  
  8. Introduction
  9. ------------
  10.  
  11. About a year ago, I was trying to find a program to allow me to edit the
  12. system keymap files. There were a few that let you put strings on keys, but
  13. none gave total control over all the features of keymaps. So I decided to
  14. write my own editor. I mean, how hard could it be..?
  15.  
  16. The result is EditKeys, a keymap editing program designed to work under
  17. both AmigaDOS 1.3 and 2.0. EditKeys is written in machine code and compiled
  18. using HiSoft's Devpac v3 assembler, though it should not be that difficult
  19. to compile under other assemblers. EditKeys is freely distributable,
  20. provided that no more is charged than a nominal fee for copying and disk
  21. media. If you want to use a keymap created with EditKeys in a PD or
  22. commercial package then the only condition I impose is that I receive a
  23. credit somewhere in the program or its documentation.
  24.  
  25. Files
  26. -----
  27.     Program     - EditKeys
  28.               EditKeys.info
  29.     Documentation    - EditKeys.Doc
  30.     Disk Library    - arp.library (must be in LIBS: if you
  31.                        are using AmigaDOS 1.3)
  32.     Source files    - EditKeys.s
  33.               Graphics.s
  34.               xdef.i
  35.               xref.i
  36.  
  37. About EditKeys
  38. --------------
  39.  
  40. EditKeys allows you to edit or create keymap files (They are found in the
  41. devs/keymaps/ directory of the system disk, which is only accessible from
  42. the CLI; there are no Workbench icons). If you don't know about these files,
  43. then perhaps I should explain.
  44.  
  45. When you press a key on the Amiga's keyboard, the key press is translated by
  46. the keymap file that the system is using (This will probably be 'gb'; the
  47. following assumes you are using a British Amiga). To see the effect of a
  48. keymap, boot with a standard 1.3 system disk, open a CLI window then type
  49.  
  50.     SYS:System/SetMap usa1
  51.  
  52. Now press the key marked with a hash '#'. Instead of the hash you expect, you
  53. get an apostrophe (which is what an American user would expect from that
  54. key).
  55.  
  56. A British 1.3 system disk contains two keymaps; 'gb' and 'usa1'. More keymaps
  57. can be found in the devs/keymaps/ directory of the Extras disk.
  58.  
  59. More radical changes to the keys could be made; you could redefine the
  60. numerical keypad to produce alphabetic characters if you wanted to, or you
  61. can configure keys to output strings (useful for disk-menus etc.).
  62.  
  63. Please note that any changes made using EditKeys do NOT come into effect
  64. until you enter the SetMap command at the CLI prompt; only when you select
  65. 'Save' in EditKeys is a suitable keymap structure constructed and saved to
  66. disk so that the Amiga OS can use it.
  67.  
  68. Keymap Specifications
  69. ---------------------
  70.  
  71. At this point, perhaps I should define some of the terms I will use:
  72.  
  73.   Qualifier Key - CTRL, ALT or SHIFT keys. Do not produce output on their
  74.           own but qualify the output of other keys (eg Shift-f
  75.           produces 'F').
  76.  
  77.   Physical Key    - An actual key on the keyboard, the thing that you touch
  78.           when you type.
  79.  
  80.   Key        - A combination of a physical key and a qualifier, eg q is
  81.           a key, as is Shift-q, Alt-q, Shift-Alt-q, etc. Note that
  82.           Alt-q is an abreiviation for holding down the ALT key
  83.           while tapping the 'q' key.
  84.  
  85. Keymaps contain quite a lot of information, none of which appears in the user
  86. manuals but appears in the RKM under 'console.device' (Makes sense to put
  87. info about the keyboard in a programmer's manual eh?). Therefore I shall
  88. attempt to briefly describe what is possible.
  89.  
  90. Keys can be redefined to produce any character when pressed with one of the
  91. qualifiers, and also keys can produce strings of up to 32 characters.
  92. Physical keys with a STRING key on them may not have DEAD or MODIFIABLE keys
  93. on them (see below).
  94.  
  95. Some keys repeat when held down (eg all alphabetic keys), while others do not
  96. (eg the <RETURN> key). Physical keys which repeat are referred to as
  97. REPEATABLE (fairly obvious). Whether a key repeats or not is controlled by
  98. the keymap. Similarly, the keymap controls whether a key is CAPSABLE or not.
  99. When the 'Caps Lock' light is on, some keys produce their Shifted values (eg
  100. 'q'), while the numerical keys produce their normal values.
  101.  
  102. Some keys are DEAD, while others are MODIFIABLE. For an example of this, open
  103. a CLI window, then hold down ALT while tapping the 'f' key (From now on
  104. abrieviated to Alt-f); nothing happens. Now tap the 'a' key, the result is
  105. an a with an accent over it: 'á'. The key Alt-f is a DEAD key, while 'a' is a
  106. MODIFIABLE key. When you type Alt-f, the Amiga stores the deadkey, which it
  107. then uses to modify the output of the 'a' key. Not all keys are MODIFIABLE,
  108. Alt-f followed by 'q' just produces 'q'. A physical key with DEAD or
  109. MODIFIABLE keys on it may NOT have STRING keys on it.
  110.  
  111. There is a further limitation in that those physical keys that are not DEAD
  112. or MODIFIABLE use only 4 bytes for their definition, eg on the 'A' key on
  113. your keyboard there is 'a', 'A', 'æ' and 'Æ'. However, there are 8 different
  114. permutations of the Shift, Alt and Control qualifiers with the key, so not
  115. every combination of physical key with qualifier can be uniquely defined.
  116. Why didn't Commodore use 8 bytes for each key??? (sigh). There is one other
  117. point; if a physical key has definitions for Shift and Alt (and thus
  118. Shift-Alt) then we can configure the key so that the Control qualifier
  119. outputs the value that would appear without the Control key being pressed,
  120. but with bits 6 and 7 cleared (eg Control-c). Confused? You're not the only
  121. one... But playing around with EditKeys should make all this clear (or at
  122. least clearer than it is at present).
  123.  
  124. To install a keymap in the system, you use the 'SetMap' program found in the
  125. System drawer of a standard Workbench disk. It is worth noting before I start
  126. on a discussion of EditKeys that once you have loaded a keymap into AmigaDOS
  127. with SetMap, it will not flush it from memory until you reboot (this is
  128. because the system expects keymaps not to change). So if you used say
  129. 'SetMap gb' (as in a UK Startup-Sequence), then edited 'gb' using EditKeys
  130. and reissued a 'SetMap gb' command at the CLI, then you would not get your
  131. new keymap, as the system would just use the version of 'gb' loaded first. To
  132. get around this simply save the edited keymap under a new name eg. 'gb2'.
  133. Furthermore, a keymap should have its name embedded in it, so if you rename
  134. a keymap EditKeys will no longer believe that it really is a keymap (although
  135. it will still work with the 1.3 SetMap command).
  136.  
  137. The Program
  138. -----------
  139.  
  140. EditKeys allows you to modify all the above features of a keymap. Keys may be
  141. made DEAD or MODIFIABLE, or have STRING definitions put on them, as well as
  142. being redefined. The program may be started from CLI or Workbench:
  143.  
  144. From Workbench: Just double click on the program's icon. A file requester
  145.         will appear for you to select a keymap to load. Click on
  146.         a keymap or 'Cancel'.
  147.  
  148. From CLI:    1) Just type the program's name, ie
  149.  
  150.             1> EditKeys
  151.  
  152.         The program will attempt to display a file requester
  153.         prompting you for a keymap to load. Select a keymap or
  154.         click on 'Cancel' to start the program without a keymap
  155.         loaded. Or,
  156.  
  157.         2) Pass a keymap name to the program, ie.
  158.  
  159.             EditKeys [<keymap>] [NOMAP]
  160.  
  161.            eg    1> EditKeys gb
  162.            or    1> EditKeys NOMAP
  163.  
  164.         You do not need to specify the path of the keymap as EditKeys
  165.         will automatically look in DEVS:keymaps/. If you specify the
  166.         NOMAP option then EditKeys will start without loading a
  167.         keymap. Or,
  168.  
  169.         3) Enter the line
  170.  
  171.             1> EditKeys ?
  172.  
  173.         Which will bring up a template. Entering a further ? will
  174.         prompt you with a small help message. Enter a keymap name
  175.         or NOMAP (see above).
  176.  
  177. When the program has loaded it will open a window on the Workbench screen.
  178. In the titlebar is the name of the keymap being edited; below that is a
  179. representation of the A500/A2000 keyboard with the keymap you chose. Note
  180. that it may appear to you that the keyboard has acquired two extra keys
  181. (one to the right of the left Shift key and the other to the left of the
  182. Return key), but the Rom Kernel Manual assures me that they are on all
  183. keyboards except UK and American ones...
  184.  
  185. Furthermore, the representation of the keymap usually shows what is output
  186. by that key, but for certain keys (eg Esc, Help, Del, F1-F10) I have chosen
  187. to use a little graphic which never changes as this looks better. If you need
  188. to be certain what a key outputs, click on it; its output will be displayed
  189. at the bottom to the EditKeys window.
  190.  
  191. Qualifier keys (Shift etc.) displayed on the screen work as expected; click
  192. on Shift to see the effect. The program is run using the menu and the five
  193. mode gadgets displayed below the keyboard; each gadget represents a different
  194. aspect of the keymap that can be edited. To choose a mode, simply click on
  195. its gadget. The five modes are:
  196.  
  197.     KeyMap       - Used to (re)define output of any key
  198.     Capsable   - Used to determine which keys are capsable
  199.     Repeatable - Used to determine which keys repeat
  200.     Modifiable - Used to define which keys are modifiable
  201.     Deadkeys   - Used to define dead keys
  202.  
  203. I will deal with these sections in increasing order of complexity.
  204.  
  205. Capsable
  206. --------
  207.  
  208. As explained above, physical keys can be CAPSABLE or not, and this mode lets
  209. you set this function for each physical key. If the key is highlighed then
  210. that key is capsable; if it is not then the physical key isn't. The qualifier
  211. gadgets are ghosted as they serve no purpose in this mode. Simply click on a
  212. key with the mouse to change it's state.
  213.  
  214. Repeatable
  215. ----------
  216.  
  217. Basically the same as the above Capsable mode, except that this mode is used
  218. to control which keys are REPEATABLE or not. Works in exactly the same way as
  219. above.
  220.  
  221. Deadkeys
  222. --------
  223.  
  224. As expained above, keymaps can contain DEAD keys, and this mode allows you to
  225. set them. Click on a key to make it dead or turn it back to normal. Deadkeys
  226. don't do anything immediately when pressed; thus when you turn a dead back to
  227. normal the key is blank. Since each particular key can be DEAD or not, the
  228. qualifiers are active.
  229.  
  230. If you make a key dead, and the physical key that key is on already has
  231. another deadkey, then you can make the second deadkey act in the same way as
  232. the first. This isn't too useful, but it's implemented in the CBM keymaps, so
  233. here it is.
  234.  
  235. Deadkey definitions are stored within the keymap in a completely diffent way
  236. to ordinary keys, so if a physical key has deadkeys on it, then it can be
  237. defined for any combination of qualifiers. As expained earlier, this is not
  238. so for ordinary keys. If you turn a deadkey back to normal and it is the last
  239. deadkey on that physical key, EditKeys will try to resolve this without
  240. destroying any definitions; but if it can't a requester will appear asking
  241. you which definitions you want to get rid of. As a general rule the least
  242. useful set of definitions are those with the Control qualifier, so I'd remove
  243. these first if I were you, but it's your choice. As also explained above, if
  244. a normal key has definitions for Shift, Alt and Shift-Alt, then the Control
  245. key may have a special effect on it - it may clear bits 6&7 of the normaly
  246. output character (eg if you enter Control-c in the string gadget, you get
  247. a capital C in reverse (try it and see)). If it is possible to do this with
  248. the key as we convert it from dead to normal, a requester will appear asking
  249. whether you want this feature or not (As a general rule, in the CBM supplied
  250. keymaps it is turned on for most alphabetic keys).
  251.  
  252. You can have a maximum of 15 deadkeys, a limitation imposed by the keymap,
  253. not me. 15 should be enough anyway. If you define 15 diffent deadkeys then
  254. all non-dead keys will be ghosted as no more can be defined. Turn a deadkey
  255. back to a normal key to de-ghost all the other keys. Physical keys with
  256. STRING keys on them cannot also have DEAD keys on them; thus all string keys
  257. are ghosted and unselectable. Physical keys with MODIFIABLE keys on them may
  258. also have DEAD keys on them.
  259.  
  260. Modifiable
  261. ----------
  262.  
  263. This mode works in exactly the same way as the above 'Deadkeys', except that
  264. it allows you to select which keys are MODIFIABLE. Note that I have imposed
  265. an arbitrary limit of 256 modifiable keys in any one keymap, but I doubt that
  266. you would ever need anything like this figure.
  267.  
  268. KeyMap
  269. ------
  270.  
  271. This is the mode you will probably most often use; it allows you to redefine
  272. what each key outputs when pressed. Since this bit is quite complex, I'll
  273. split it into several sections.
  274.  
  275. Click on the qualifiers and a key to select which key you want to edit. The
  276. selected key will appear highlighted (ie yellow lettering on a black
  277. background), and the cursor in the string gadget below the keyboard will
  278. activate. If you now type something, it will appear in this gadget (since it
  279. is just an Intuition string gadget you can also just click inside it to
  280. re-activate it). There are various types of keys in a keymap (as detailed
  281. previously) so I shall explain how the editing fuctions affect each one:
  282.  
  283. Deadkeys    - Since deadkeys do not output anything themselves but change
  284.           the output of other keys, you cannot edit a deadkey and so
  285.           such keys are ghosted in this mode. However they are used
  286.           in conjuction with modifiable keys (see section below).
  287.           Since physical keys with deadkeys on them may also have
  288.           keys that work normally (eg Alt-f is a deadkey; Shift-f and
  289.           f just work as normal) such keys (eg f) can be edited as
  290.           detailed below with the restriction that such keys may NOT
  291.           have strings on them.
  292.  
  293. Ordinary keys    - This is the majority of keys, which have no special
  294.           features (eg deadkeys). When you click on such a key, the
  295.           character output by this key will appear in the little box
  296.           to the left of the string gadget below the keymap.
  297.  
  298.           If you enter a single character into the string gadget,
  299.           then this will become the character output by the selected
  300.           key, and the picture of the keymap will change to reflect
  301.           this. As not all combinations of qualifier and physical key
  302.           can be uniquely redefined, at certain times (especially if
  303.           you edit a key with the Control qualifier (eg Control-q)) a
  304.           requester will appear telling you that some definitions
  305.           will have to be lost in order to allow your editing, and
  306.           giving you the option of aborting or letting EditKeys
  307.           remove some of the other definitions on that physical key.
  308.  
  309.           Futhermore, the combination of Shift-Alt-Control-key cannot
  310.           be defined at all for ordinary keys. If you try this
  311.           EditKeys will tell you that this is not possible.
  312.  
  313.           If you enter more than one character into the string
  314.           gadget, EditKeys will convert that key into a STRING type
  315.           key (see below).
  316.  
  317. Modifiable keys - Modifiable keys (eg a) can have their output modified by
  318.           deadkeys (eg Alt-f followed by a produces á). Such keys
  319.           can be edited as above except that strings are not
  320.           permissible on such keys, thus you can redefine what 'a'
  321.           outputs. But what if you want to redefine what Alt-f
  322.           followed by 'a' outputs?
  323.  
  324.           If you double click the right mouse button, a requester
  325.           titled 'Select deadkey' will appear. This allows you to
  326.           choose a deadkey to be used in editing modifiable keys.
  327.           The requester has gadgets to accept the current deadkey,
  328.           quit without changing anything, or clearing the current
  329.           deadkey. To select a deadkey simply type it in at the
  330.           keyboard (eg hold down Alt and press f). The text 'A-f'
  331.           will appear in the box. Enter another deadkey if you want
  332.           to change or press the 'Clear' gadget if you don't want to
  333.           use a deadkey anymore, then click 'Use this deadkey'. The
  334.           name of the deadkey (eg A-f (which is short for Alt-f))
  335.           will now appear in the far left box at the bottom of the
  336.           EditKeys window. Now click on a modifiable key (eg a) and
  337.           the character output by the combination of the selected
  338.           deadkey and the selected modifiable key will appear in the
  339.           box to the left of the string gadget (if you are using my
  340.           example an 'á' will appear there). Now when you enter a
  341.           character into the string gadget will edit what is output
  342.           by the combination of the selected deadkey and the selected
  343.           modifiable key. Try it - it is fairly obvious once you're
  344.           used to it.
  345.  
  346. String keys    - Lastly, string keys. If you click on a string key (or
  347.           change an ordinary key into one by entering more than one
  348.           character into the string gadget) then the box to the left
  349.           of the string gadget turns yellow. String keys may be
  350.           edited in the normal way, except that you may enter up to
  351.           32 characters to be output by each key (Some keymaps seem
  352.           to have more than this, but the RKM seems to suggest 32 is
  353.           the safe limit for the console buffer, so 32 it is).
  354.  
  355.           Note that string keys are usually displayed by EditKeys on
  356.           its picture of the keymap as the letters 'STR' where
  357.           possible (eg 'Help' is a string key but it always appears
  358.           as 'Help' in the little picture as this looks neater).
  359.  
  360.           If you edit a physical key with strings on it so that each
  361.           string is only one character, EditKeys will give you the
  362.           option of converting that physical key back to an ordinary
  363.           key (which saves memory). As usual, EditKeys may have to
  364.           remove some definitions to accomodate this; a requester
  365.           will appear to warn you if this is the case.
  366.  
  367.           Note that if at any time you want to put a carriage return
  368.           in a string, use control-m (a reversed M will appear in the
  369.           string gadget). This is useful for eg. putting common CLI
  370.           commands on function keys. Thus, if you put
  371.  
  372.             list*
  373.  
  374.           (where * represents control-m) on F1, then with this keymap
  375.           in use via SetMap, pressing F1 will send a list command to
  376.           the CLI as if you had typed it in and pressed <RETURN>.
  377.  
  378. There is one further point - to the right of the string gadget is a gadget
  379. marked <CSI>. What does this mean? Well, if you click a key such as F1 (with
  380. a standard CBM keymap loaded), you will get something like *0~ where * is a
  381. little square box. This box is used for characters that are not specifically
  382. defined for that font, and in this case the character is $9B hex, which is
  383. known as the 'Control Sequence Inducer', or <CSI> for short. <CSI> is used to
  384. indicate that what follows is not to be output directly but is to be
  385. interpreted by the Amiga to eg. change the text colour etc. There are too
  386. many sequences to document here (they are in the RKM under 'console.device').
  387. Since you can't enter the character $9B directly using a CBM keymap, clicking
  388. the <CSI> gadget puts this character as the first character in the string
  389. gadget, from there there it behaves as any other characater.
  390.  
  391. The Menu
  392. --------
  393.  
  394. The remaining functions of EditKeys are accessed through the pull-down
  395. menu. These are:
  396.  
  397. New    - Completely clears all information from EditKeys, so allowing you
  398.       to create a keymap completely from scratch (but believe me, it's
  399.       easier to edit an existing one!).
  400.  
  401. Load    - A file requester appears to allow you to select a keymap to load
  402.       in. Note that the keymap does not have to be in DEVS:keymaps/ for
  403.       to you to be able to load it in.
  404.  
  405. Save    - Saves the current keymap. The keymap is saved to the name of the
  406.       keymap last loaded. Note that any previous keymap of the same name
  407.       is overwritten (so be carefull!!).
  408.  
  409. Save As - A file requester appears to allow you to select the filename that
  410.       you wish the current keymap to be saved to. Again, you do not need
  411.       to save to the DEVS:keymaps/ directory, but if you don't, you won't
  412.       be able to SetMap the keymap without moving it elsewhere or playing
  413.       around with the Assign command.
  414.  
  415. About    - Guess.
  416.  
  417. Sleep    - Since the EditKeys window is rather large, you can use this option
  418.       to shrink EditKeys out of the way. Under AmigaDOS 1.3, EditKeys
  419.       opens a tiny window with just one gadget in it. Click on this
  420.       gadget to make EditKeys reopen its main window and resume normal
  421.       operations.
  422.       Under AmigaDOS 2.0, this option closes the main EditKeys window
  423.       and adds an 'EditKeys' menu item to the Workbench Tools menu. If
  424.       you select this item EditKeys will restart.
  425.  
  426. Quit    - Guess... A requester checks that you are sure before quiting (any
  427.       unsaved keymaps will be lost if you quit!).
  428.  
  429. Well, I think that's it. I think (hope!) the program is easier to use that
  430. this file is to understand, so just use EditKeys and all should become clear.
  431.  
  432. If for any reason you want to contact me about EditKeys, the address is
  433.  
  434.       David Kinder,
  435.       28, Langholm Rd.,
  436.       Garswood,
  437.       Ashton-in-Makerfield,
  438.       Lancs.
  439.       WN4 0SG.
  440.       ENGLAND.
  441.  
  442. History
  443. -------
  444.  
  445. v1.0      First release.
  446.  
  447. v1.1      Improved appearance under AmigaDOS 2.0.
  448.  
  449. v1.2      Removed need for 'arp.library' under AmigaDOS 2.0.
  450.       Renamed 'Iconify' menu option to 'Sleep' to reflect that with
  451.       AmigaDOS 2.0 'Sleep' closes EditKeys down to an item in the
  452.       Workbench Tools menu.
  453.  
  454.  
  455.       "Rise and Reverberate"
  456.  
  457.