subroutine event_display_button_query( . ixmouse, iymouse, mouse_button, in_button) c c ********************************************************************** c c figure out if a mouse click just received was in one of my display control c buttons. return 0 if not, and button number if yes. Input arguments c are x and y of pixel, and mouse button if mouse was clicked. c c George Gollin, CPPM (Marseille) and univerisyt of Illinois (Urbana-Champaign) c g-gollin@uiuc.edu, 1999 c c ********************************************************************** c c include files holding common blocks and parameter statements go here: c note that they're in the same directory as this file. c #include "event_display.inc" c c ********************************************************************** c c non-common type definitions and array definitions go here: c c ********************************************************************** c c data statements go here: c c ********************************************************************** c c c store the info about the previously detected mouse event if we got a click c this time: if(mouse_button .ge. 1 .and. mouse_button .le. 3) then iprevious_mouse_button=icurrent_mouse_button iprevious_button=icurrent_button iprevious_click_pixel_x=icurrent_click_pixel_x iprevious_click_pixel_y=icurrent_click_pixel_y c c update the current mouse button info: icurrent_mouse_button=mouse_button icurrent_click_pixel_x=ixmouse icurrent_click_pixel_y=iymouse c end if c c in any case, store the sample pixel information: iprevious_sample_pixel_x=icurrent_sample_pixel_x iprevious_sample_pixel_y=icurrent_sample_pixel_y icurrent_sample_pixel_x=ixmouse icurrent_sample_pixel_y=iymouse c now see if the position is inside one of my buttons... in_button=-99 c if(number_of_buttons .gt. 0) then x=ixmouse y=iymouse do i=1,number_of_buttons if(x .ge. button_left(i) .and. . x .le. button_right(i) .and. . y .ge. button_top(i) .and. . y .le. button_bot(i) ) then c in_button=i go to 99 end if end do c end if c c 99 continue c c c only update the variable in common if we got a mouse click... if(mouse_button .ge. 1 .and. mouse_button .le. 3) . icurrent_button=in_button c c return end