home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 18 / forthsup / mousekey.fth < prev    next >
Encoding:
Text File  |  1986-09-18  |  1.2 KB  |  32 lines

  1. \ Sets the mouse to return cursor movement codes when it is moved.
  2. \ This lets you move the cursor around with the mouse.  This works
  3. \ both in Emacs and in the Forth line editor.  Try it out.  I don't
  4. \ like it, but perhaps you will.
  5. \
  6. \ KEYMOUSE  ( -- )    Use mouse to move editing cursor
  7. \ RELMOUSE  ( -- )    Restore normal mouse action
  8.  
  9. \ Don't FORGET this stuff once it's loaded, or the system will hang when
  10. \ you exit (because RELMOUSE is installed in the exit list).
  11.  
  12. decimal
  13. 0 xbios: initmous { a.vec a.param w.type -- }
  14. 34 xbios: kbdvbase { -- a.struct }
  15.  
  16. : keymouse  ( -- )
  17.    th 00041030 pad !
  18.     \ 00xxxxxx 0 at top of screen
  19.     \ xx04xxxx mouse buttons act like keys   
  20.     \ xxxx10xx sensitivity 16 mouse clicks in x direction
  21.     \ xxxxxx30 sensitivity 48 mouse clicks in y direction
  22.    kbdvbase 4 la+ @  ( mouse-vec ) pad 4  initmous  \ keycode mode
  23. ;
  24. : relmouse  ( -- )  \ Puts the mouse back to normal
  25.    th 00000101 pad !
  26.    \ 0 at top, normal buttons, sensitivity 1 in x and y
  27.    kbdvbase 4 la+ @  ( mouse-vec ) pad 1  initmous  \ relative mode
  28. ;
  29.  
  30. \ Automatically reset the mouse back to normal upon exit.
  31. : (bye relmouse (bye ;  ' (bye is bye
  32.