C TBGTXY    SOURCE    KK2000    05/05/30    21:15:58     5096
c subroutine utilisee dans tableau
        SUBROUTINE TBGTXY (IPX,IPY,TABTR,IX,IY,FX,FY)
c attend un click de l'utilisateur et renvoie les coordonnées
c de la case relative et de la case absolues.
      IMPLICIT INTEGER(I-N)
-inc TMNTAB

-INC PPARAM
-INC CCOPTIO
        integer         ipx,ipy
        integer         ix,iy,fx,fy
        real          rxpos,rypos
        integer         ideb,ifin,ih
*
        call trdig  (rxpos,rypos,inouse)
        fx = ((rxpos+3.6)/3.75)
        if (ZHORIZ) then
          fy = (-(rypos-21.2)/0.65)
        else
          fy = (-(rypos-29.9)/0.65)
        endif
        fy = fy + 1

        ideb = tabtr.csgx (ipx,ipy)
        ifin = tabtr.cidx (ipx,ipy)
        dfx  = tabtr.ihdec(ipx,ipy)
        if (fx.lt.(1+dfx)) ix=0
        if (fx.eq.(1+dfx)) ix=1
        if (fx.gt.(1+dfx)) ix=ideb+fx-dfx-2
        if (ix.gt.ifin+1) ix=0

        ideb = tabtr.csgy(ipx,ipy)
        ifin = tabtr.cidy(ipx,ipy)
        dfy  = tabtr.ivdec(ipx,ipy)
        ih   = tabtr.ihtcol
        if (fy.lt.(ih+4+dfy)) iy=0
        if (fy.eq.(ih+4+dfy)) iy=1
        if (fy.gt.(ih+4+dfy)) iy=ideb+fy-dfy-5-ih
        if (iy.gt.ifin+1) iy=0

*
        end



