home *** CD-ROM | disk | FTP | other *** search
/ Carousel Volume 2 #1 / carousel.iso / mactosh / lang / skel_azt.sha / key.c < prev    next >
Encoding:
C/C++ Source or Header  |  1986-07-08  |  677 b   |  35 lines

  1.  
  2. /*
  3.  *    key.c -- handle keyboard input
  4.  */
  5.  
  6. #include <quickdraw.h>
  7. #include <event.h>
  8. #include <menu.h>
  9. #include <textedit.h>
  10. #include <window.h>
  11.  
  12. #include "def.h"
  13.  
  14. key(ev)
  15. EventRecord    *ev;    /* return value from GetNextEvent */
  16. {
  17.     long                dlr;
  18.     extern    TEHandle    hTE;
  19.     extern    short        lastTE;        /* previous TE command for UNDO */
  20.     long                mkr;
  21.     extern    WindowPtr    wp[NWINDOWS];
  22.     
  23.     if ((ev->modifiers & cmdKey) &&
  24.             (mkr = MenuKey((char)(ev->message & 0xFF)))) {
  25.         Delay(15L, &dlr);
  26.         return(command(mkr));
  27.     }
  28.     else if (wp[1] == FrontWindow() && hTE) {
  29.         TEKey((short)(ev->message & 0xFF), hTE);
  30.         teadjdest();
  31.         lastTE = 0;            /* disable UNDO */
  32.     };
  33.     return(FALSE);
  34. } /* end of key */
  35.