home *** CD-ROM | disk | FTP | other *** search
/ Millennium Time Capsule / AC2000.BIN / disks / ac10disk / r_mouse / ev_key.c next >
Encoding:
Text File  |  1998-04-10  |  3.9 KB  |  135 lines

  1. /* ev_key.c
  2.  *
  3.  * Contains the evnt_keybd()
  4.  * and evnt_multi()
  5.  * functions used for the
  6.  * RightMouse demo program.
  7.  *
  8.  * George Crissman
  9.  * 4/06/98
  10.  */
  11.  
  12.  
  13. short clicks_mb()
  14.  
  15. { short clicks = EITHER | DOUBLE_CLICK ;
  16.   short mask   = MOUSE_BOTH ;
  17.   short result = EMPTY ;
  18.   short state  = EMPTY ;
  19.  
  20.   short b = EMPTY ;
  21.   short s = EMPTY ;
  22.   short x = EMPTY ;
  23.   short y = EMPTY ;
  24.   
  25.   short *mouse_x  = &x ;
  26.   short *mouse_y  = &y ;
  27.   short *button   = &b ;
  28.   short *shiftkey = &s ;
  29.  
  30.  
  31.   result = evnt_button( clicks, mask, state, mouse_x, mouse_y,
  32.                         button, shiftkey ) ;
  33.  
  34.   return( *button ) ;
  35.  
  36. }
  37.  
  38.  
  39. short mult_mb()
  40.  
  41. { short done = NOT_YET ;
  42.   short mouse_evnt = NOT_YET ;
  43.   short result = OK ;
  44.   short placeholder = OK ;
  45.  
  46.   short active_msg = ( MU_KEYBD | MU_MESAG | MU_BUTTON ) ;
  47.  
  48.   short timer_low  = UNUSED ;
  49.   short timer_high = UNUSED ;
  50.  
  51.   short box_1_flag = UNUSED ;
  52.   short box_1_x = UNUSED ;
  53.   short box_1_y = UNUSED ;
  54.   short box_1_w = UNUSED ;
  55.   short box_1_h = UNUSED ;
  56.  
  57.   short box_2_flag = UNUSED ;
  58.   short box_2_x = UNUSED ;
  59.   short box_2_y = UNUSED ;
  60.   short box_2_w = UNUSED ;
  61.   short box_2_h = UNUSED ;
  62.  
  63.   short user_clicks = EITHER | DOUBLE_CLICK ;
  64.   short user_button = MOUSE_BOTH ;
  65.   short user_state  = EMPTY ;
  66.  
  67.   short key_value = CLEAR ;
  68.  
  69.   short b ;
  70.   short c ;
  71.   short x ;
  72.   short y ;
  73.  
  74.   short *mouse_buttons = &b ; /* Odd pointer definitions req'd by Lattice */
  75.   short *mouse_clicks  = &c ;
  76.   short *mouse_x       = &x ;
  77.   short *mouse_y       = &y ;
  78.  
  79.   short *key_in        = &key_value ;
  80.   short *shift_keys    = &placeholder ;
  81.  
  82.   short gem_message[ GEM_MSG_LEN ] ;
  83.  
  84.   while( ( done == NOT_YET ) && ( mouse_evnt == NOT_YET ) )
  85.   { result = evnt_multi( active_msg,        /* Check For Menu Messages */
  86.              user_clicks, user_button, 
  87.                           user_state,       /* evnt_button parameters */
  88.              box_1_flag, box_1_x, box_1_y,
  89.                          box_1_w, box_1_h,  /* evnt_mouse1 parameters */
  90.              box_2_flag, box_2_x, box_2_y,
  91.                          box_2_w, box_2_h,  /* evnt_mouse2 parameters */
  92.              gem_message,                   /* actual message from GEM */
  93.              timer_low, timer_high,         /* evnt_timer parameters */
  94.              mouse_x, mouse_y,              /* mouse x,y values */
  95.              mouse_buttons,                 /* mouse button value */
  96.              shift_keys,                    /* shift key values */
  97.              key_in,                        /* actual key pressed */
  98.              mouse_clicks ) ;               /* mouse button clicks */
  99.  
  100.     if( result & MU_MESAG) done = (short)handle_message( gem_message ) ;
  101.     if( result & MU_KEYBD) done = (short)handle_keyboard( key_value ) ;
  102.     if( result & MU_BUTTON ) return( *mouse_buttons ) ;
  103.  
  104.   }
  105.  
  106.   return( FALSE ) ; /* Ignore done == TRUE from MU_MESAG | MU_KEYBD */
  107.                     /* 'Quit', [ Esc ], ^C, ^Q exits test mode only */
  108.                  /* 'Quit' et. al. work properly after exiting mode */
  109. }
  110.  
  111.  
  112. void print_code()
  113.  
  114. { short count = EMPTY ;
  115.   short length = FMSIZE ;
  116.   short position = EMPTY ;
  117.   short result = EMPTY ;
  118.  
  119.   char temp = ' ' ;                /* Use KB_SPACE As Initial Character */
  120.  
  121.   for( count = EMPTY; count < MAX_LINES; count++ )  /* For each line... */
  122.      { result = Cprnos() ;                 /* Check printer ... ready ? */
  123.        if( result == DEV_READY )
  124.        { for( position = EMPTY; (position < length) && (temp != '\0') ; 
  125.               position++ )         /* For each character in the line... */
  126.             { temp = text_win[ count ][ position ] ;
  127.               Cprnout( temp ) ;
  128.               result = Cprnos() ;
  129.             }
  130.          Cprnout( '\r' ) ;               /* Carriage Return */
  131.          Cprnout( '\n' ) ;               /* Line Feed       */
  132.          temp = ' ' ;                    /* Clear Null From Variable */
  133.        }
  134.      }
  135. }