/* ev_key.c * * Contains the evnt_keybd() * and evnt_multi() * functions used for the * RightMouse demo program. * * George Crissman * 4/06/98 */ short clicks_mb() { short clicks = EITHER | DOUBLE_CLICK ; short mask = MOUSE_BOTH ; short result = EMPTY ; short state = EMPTY ; short b = EMPTY ; short s = EMPTY ; short x = EMPTY ; short y = EMPTY ; short *mouse_x = &x ; short *mouse_y = &y ; short *button = &b ; short *shiftkey = &s ; result = evnt_button( clicks, mask, state, mouse_x, mouse_y, button, shiftkey ) ; return( *button ) ; } short mult_mb() { short done = NOT_YET ; short mouse_evnt = NOT_YET ; short result = OK ; short placeholder = OK ; short active_msg = ( MU_KEYBD | MU_MESAG | MU_BUTTON ) ; short timer_low = UNUSED ; short timer_high = UNUSED ; short box_1_flag = UNUSED ; short box_1_x = UNUSED ; short box_1_y = UNUSED ; short box_1_w = UNUSED ; short box_1_h = UNUSED ; short box_2_flag = UNUSED ; short box_2_x = UNUSED ; short box_2_y = UNUSED ; short box_2_w = UNUSED ; short box_2_h = UNUSED ; short user_clicks = EITHER | DOUBLE_CLICK ; short user_button = MOUSE_BOTH ; short user_state = EMPTY ; short key_value = CLEAR ; short b ; short c ; short x ; short y ; short *mouse_buttons = &b ; /* Odd pointer definitions req'd by Lattice */ short *mouse_clicks = &c ; short *mouse_x = &x ; short *mouse_y = &y ; short *key_in = &key_value ; short *shift_keys = &placeholder ; short gem_message[ GEM_MSG_LEN ] ; while( ( done == NOT_YET ) && ( mouse_evnt == NOT_YET ) ) { result = evnt_multi( active_msg, /* Check For Menu Messages */ user_clicks, user_button, user_state, /* evnt_button parameters */ box_1_flag, box_1_x, box_1_y, box_1_w, box_1_h, /* evnt_mouse1 parameters */ box_2_flag, box_2_x, box_2_y, box_2_w, box_2_h, /* evnt_mouse2 parameters */ gem_message, /* actual message from GEM */ timer_low, timer_high, /* evnt_timer parameters */ mouse_x, mouse_y, /* mouse x,y values */ mouse_buttons, /* mouse button value */ shift_keys, /* shift key values */ key_in, /* actual key pressed */ mouse_clicks ) ; /* mouse button clicks */ if( result & MU_MESAG) done = (short)handle_message( gem_message ) ; if( result & MU_KEYBD) done = (short)handle_keyboard( key_value ) ; if( result & MU_BUTTON ) return( *mouse_buttons ) ; } return( FALSE ) ; /* Ignore done == TRUE from MU_MESAG | MU_KEYBD */ /* 'Quit', [ Esc ], ^C, ^Q exits test mode only */ /* 'Quit' et. al. work properly after exiting mode */ } void print_code() { short count = EMPTY ; short length = FMSIZE ; short position = EMPTY ; short result = EMPTY ; char temp = ' ' ; /* Use KB_SPACE As Initial Character */ for( count = EMPTY; count < MAX_LINES; count++ ) /* For each line... */ { result = Cprnos() ; /* Check printer ... ready ? */ if( result == DEV_READY ) { for( position = EMPTY; (position < length) && (temp != '\0') ; position++ ) /* For each character in the line... */ { temp = text_win[ count ][ position ] ; Cprnout( temp ) ; result = Cprnos() ; } Cprnout( '\r' ) ; /* Carriage Return */ Cprnout( '\n' ) ; /* Line Feed */ temp = ' ' ; /* Clear Null From Variable */ } } }