home *** CD-ROM | disk | FTP | other *** search
- PROGRAM PGDEM6
- C-----------------------------------------------------------------------
- C Test program for PGPLOT: test of Cursor
- C-----------------------------------------------------------------------
- INTEGER PGBEG, PGCURS
- INTEGER JUNK
- CHARACTER*1 CH
- REAL X,Y
- C
- WRITE(*,*) ' This program demonstrates the use of routine',
- : ' PGCURS. It'
- WRITE(*,*) ' requires a graphics device with a cursor.',
- : ' Position the cursor'
- WRITE(*,*) ' anywhere in the window. Press any key (or a mouse',
- : ' button if'
- WRITE(*,*) ' the device has a mouse supported by PGPLOT); the',
- : ' program'
- WRITE(*,*) ' draws a marker at the current cursor position and',
- : ' reports the'
- WRITE(*,*) ' current cursor position [bottom left corner is',
- : ' (0,0); top'
- WRITE(*,*) ' right is (1,1)] and the ASCII code of the key',
- : ' that you'
- WRITE(*,*) ' pressed. To exit from the program, type a slash',
- : ' (/), ctrl-D,'
- WRITE(*,*) ' or ctrl-Z.'
- C
- C Open device for graphics.
- C
- IF (PGBEG(0,'?',1,1) .NE. 1) STOP
- C
- C Clear the screen. Draw a frame at the physical extremities of the
- C plot, using full-screen viewport and standard window.
- C
- CALL PGPAGE
- CALL PGSVP(0.0,1.0,0.0,1.0)
- CALL PGSWIN(0.0,1.0,0.0,1.0)
- CALL PGBOX('bcts',0.1,5,'bcts',0.1,5)
- C
- C Loop to read and display cursor position. Initial position for cursor
- C is center of viewport.
- C
- X = 0.5
- Y = 0.5
- 10 CONTINUE
- JUNK = PGCURS(X,Y,CH)
- CALL PGPT(1, X, Y, ICHAR(CH))
- WRITE (*, '(2F8.3,I4)') X,Y,ICHAR(CH)
- IF (CH.NE.'/'.AND. CH.NE.CHAR(0) .AND. CH.NE.CHAR(4) .AND.
- : CH.NE.CHAR(26)) GOTO 10
- C
- C Close the device and exit.
- C
- CALL PGEND
- END
-