From: <and...@us...> - 2008-07-24 14:01:58
|
Revision: 8584 http://plplot.svn.sourceforge.net/plplot/?rev=8584&view=rev Author: andrewross Date: 2008-07-24 14:02:07 +0000 (Thu, 24 Jul 2008) Log Message: ----------- Add support for PLGraphicsIn to f95 (use f90 type). Add support for plGetCursor. Update example 20 to use new plgetcursor subroutine. Modified Paths: -------------- trunk/bindings/f95/plstubs.h trunk/bindings/f95/scstubs.c trunk/bindings/f95/sfstubsf95.f90 trunk/examples/f95/x20f.f90 Modified: trunk/bindings/f95/plstubs.h =================================================================== --- trunk/bindings/f95/plstubs.h 2008-07-24 14:00:27 UTC (rev 8583) +++ trunk/bindings/f95/plstubs.h 2008-07-24 14:02:07 UTC (rev 8584) @@ -195,6 +195,7 @@ #define PLGDIDEV FNAME(PLGDIDEV,plgdidev) #define PLGDIORI FNAME(PLGDIORI,plgdiori) #define PLGDIPLT FNAME(PLGDIPLT,plgdiplt) +#define PLGETCURSOR FNAME(PLGETCURSOR,plgetcursor) #define PLGFAM FNAME(PLGFAM,plgfam) #define PLGFNAM7 FNAME(PLGFNAM7,plgfnam7) #define PLGLEVEL FNAME(PLGLEVEL,plglevel) Modified: trunk/bindings/f95/scstubs.c =================================================================== --- trunk/bindings/f95/scstubs.c 2008-07-24 14:00:27 UTC (rev 8583) +++ trunk/bindings/f95/scstubs.c 2008-07-24 14:02:07 UTC (rev 8584) @@ -289,6 +289,12 @@ } void +PLGETCURSOR(PLGraphicsIn *gin) +{ + plGetCursor(gin); +} + +void PLGFAM(PLINT *fam, PLINT *num, PLINT *bmax) { c_plgfam(fam, num, bmax); Modified: trunk/bindings/f95/sfstubsf95.f90 =================================================================== --- trunk/bindings/f95/sfstubsf95.f90 2008-07-24 14:00:27 UTC (rev 8583) +++ trunk/bindings/f95/sfstubsf95.f90 2008-07-24 14:02:07 UTC (rev 8584) @@ -113,9 +113,25 @@ include 'sfstubs.f90' end module plplotp + module plplot_types + use plplot_flt + type :: PLGraphicsIn + integer type ! of event (CURRENTLY UNUSED) + integer state ! key or button mask + integer keysym ! key selected + integer button ! mouse button selected + integer subwindow ! subwindow (alias subpage, alias subplot) number + character(len=16) string ! translated string + integer pX, pY ! absolute device coordinates of pointer + real(kind=plflt) dX, dY ! relative device coordinates of pointer + real(kind=plflt) wX, wY ! world coordinates of pointer + end type PLGraphicsIn + end module plplot_types + module plplot use plplotp use plplot_flt + use plplot_types ! ! To be added: renaming list ! @@ -338,6 +354,14 @@ end interface interface + subroutine plgetcursor( gin ) + use plplot_flt + use plplot_types + type(PLGraphicsIn) :: gin + end subroutine plgetcursor + end interface + + interface subroutine plgfam( fam, num, bmax ) integer :: fam, num, bmax end subroutine plgfam Modified: trunk/examples/f95/x20f.f90 =================================================================== --- trunk/examples/f95/x20f.f90 2008-07-24 14:00:27 UTC (rev 8583) +++ trunk/examples/f95/x20f.f90 2008-07-24 14:02:07 UTC (rev 8584) @@ -452,12 +452,14 @@ real(kind=plflt) xi, xe, yi, ye -! PLGraphicsIn gin - integer gin - real(kind=plflt) xxi, yyi, xxe, yye, t + type(PLGraphicsIn) :: gin + real(kind=plflt) :: xxi, yyi, xxe, yye, t logical st, start real(kind=plflt) sx(5), sy(5) + integer PLK_Return + parameter(PLK_Return = Z'0D') + xxi = xi yyi = yi xxe = xe @@ -469,54 +471,55 @@ ! Driver has xormod capability, continue if (st) then - 100 continue + do while (.true.) - call plxormod(.false., st) -!C call plGetCursor(gin) - call plxormod(.true., st) - -!C if (gin.button == 1) { -!C xxi = gin.wX -!C yyi = gin.wY - if (start) then + call plxormod(.false., st) + call plgetcursor(gin) + call plxormod(.true., st) + + if (gin%button .eq. 1) then + xxi = gin%wX + yyi = gin%wY + if (start) then !C clear previous rectangle call plline(sx, sy) - endif - - start = .false. - - sx(1) = xxi - sy(1) = yyi - sx(5) = xxi - sy(5) = yyi -!C endif - -!C if (gin.state & 0x100) then -!C xxe = gin.wX -!C yye = gin.wY - if (start) then + endif + + start = .false. + + sx(1) = xxi + sy(1) = yyi + sx(5) = xxi + sy(5) = yyi + endif + + if (iand(gin%state,Z'100').ne.0) then + xxe = gin%wX + yye = gin%wY + if (start) then ! Clear previous rectangle call plline(sx, sy) - endif - start = .true. + endif + start = .true. + + sx(3) = xxe + sy(3) = yye + sx(2) = xxe + sy(2) = yyi + sx(4) = xxi + sy(4) = yye +! Draw new rectangle + call plline(sx, sy) + endif - sx(3) = xxe - sy(3) = yye - sx(2) = xxe - sy(2) = yyi - sx(4) = xxi - sy(4) = yye -! Draw new rectangle - call plline(sx, sy) -!C endif - -!C if (gin.button == 3 || gin.keysym == PLK_Return || gin.keysym == 'Q') then - if (start) then + if ((gin%button .eq. 3).or.(gin%keysym .eq. PLK_Return).or.(gin%keysym .eq. ichar('Q'))) then + if (start) then ! Clear previous rectangle call plline(sx, sy) goto 110 - endif -!C endif + endif + endif + enddo 110 continue ! Leave xor mode @@ -539,8 +542,8 @@ ye = yye yi = yyi -!C get_clip = gin.keysym == 'Q' - get_clip = .false. + get_clip = (gin%keysym .eq. ichar('Q')) +! get_clip = .false. else ! driver has no xormod capability, just do nothing get_clip = .false. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |