1C*PGQVP -- inquire viewport size and position
2C%void cpgqvp(int units, float *x1, float *x2, float *y1, float *y2);
3C+
4      SUBROUTINE PGQVP (UNITS, X1, X2, Y1, Y2)
5      INTEGER UNITS
6      REAL    X1, X2, Y1, Y2
7C
8C Inquiry routine to determine the current viewport setting.
9C The values returned may be normalized device coordinates, inches, mm,
10C or pixels, depending on the value of the input parameter CFLAG.
11C
12C Arguments:
13C  UNITS  (input)  : used to specify the units of the output parameters:
14C                    UNITS = 0 : normalized device coordinates
15C                    UNITS = 1 : inches
16C                    UNITS = 2 : millimeters
17C                    UNITS = 3 : pixels
18C                    Other values give an error message, and are
19C                    treated as 0.
20C  X1     (output) : the x-coordinate of the bottom left corner of the
21C                    viewport.
22C  X2     (output) : the x-coordinate of the top right corner of the
23C                    viewport.
24C  Y1     (output) : the y-coordinate of the bottom left corner of the
25C                    viewport.
26C  Y2     (output) : the y-coordinate of the top right corner of the
27C                    viewport.
28C--
29C 26-Sep-1985 - new routine (TJP).
30C-----------------------------------------------------------------------
31      INCLUDE 'pgplot.inc'
32      REAL SX, SY
33C
34      IF (UNITS.EQ.0) THEN
35          SX = PGXSZ(PGID)
36          SY = PGYSZ(PGID)
37      ELSE IF (UNITS.EQ.1) THEN
38          SX = PGXPIN(PGID)
39          SY = PGYPIN(PGID)
40      ELSE IF (UNITS.EQ.2) THEN
41          SX = (PGXPIN(PGID)/25.4)
42          SY = (PGYPIN(PGID)/25.4)
43      ELSE IF (UNITS.EQ.3) THEN
44          SX = 1.0
45          SY = 1.0
46      ELSE
47          CALL GRWARN(
48     1        'Illegal value for parameter UNITS in routine PGQVP')
49          SX = PGXSZ(PGID)
50          SY = PGYSZ(PGID)
51      END IF
52      X1 = PGXVP(PGID)/SX
53      X2 = (PGXVP(PGID)+PGXLEN(PGID))/SX
54      Y1 = PGYVP(PGID)/SY
55      Y2 = (PGYVP(PGID)+PGYLEN(PGID))/SY
56      END
57