      subroutine thermometre(string,nchar,origx,origy,dx,dy,iopt,idir
     &                      ,icol1,icol2,icol3,icol4,ibord,irc)
      INCLUDE 'Parametres.f'
      character*1 string(*)
      character*21 interromp
      save
c
      if (iopt.eq.0) then
        iorigx = origine_x + facteur_en_x*origx
        iorigy = origine_y + facteur_en_y*origy
        ibx = iabs(nint(dx*facteur_en_x))
        iby = iabs(nint(dy*facteur_en_y))
        if (idir.eq.0) then
          ilarg = ibx
          ihaut = iby
          angletherm = 0.
        else
          ihaut = ibx
          ilarg = iby
          if (idir.gt.0) then
            angletherm = 90.
          else
            angletherm = -90.
          endif
        endif
        ibb  = ibord
        ibbb = ibord
        ilarg0 = ilarg-2*ibb
        ihaut0 = ihaut-2*ibb
        ilarg2 = ilarg0
        ihaut2 = ihaut0
        iorigx0 = iorigx
        iorigy0 = iorigy
        iorigy1 = iorigy0-ihaut
        iorigxb = iorigx-ilarg0/2
        iorigyb = iorigy-ihaut0/2
        ic1 = icol1
        ic2 = icol2
        ic3 = icol3
        ic4 = icol4
        image = -1
        icentre = 5
        interromp = 'Cliquez pour annuler'//char(0)
      else
        if (iopt.lt.0) then
          call x11loadcolor(ic4)
          icoul_courante = ic4
          call x11txtsrnrot3(interromp,20,iorigx0,iorigy1,icol3
     &                      ,angletherm,icentre,image)
          call getxycx11c(iev,ixposcurs,iyposcurs
     &         ,ixposcurs_root,iyposcurs_root)
          if (iev.ge.251.and.iev.le.253.and.
     &        ixposcurs.ge.ix0_zone_click.and.
     &        ixposcurs.le.ix1_zone_click.and.
     &        iyposcurs.ge.iy0_zone_click.and.
     &        iyposcurs.le.iy1_zone_click) then
            call x11thermoini(iorigxb,iorigyb,ilarg0,ihaut0,ibb
     &                       ,ic2,ic1,ic3)
            call x11loadcolor(ic4)
            string(nchar+1) = char(0)
            call x11txtsrnrot3(string,nchar,iorigx0,iorigy0,ic3
     &                        ,angletherm,icentre,image)
            call x11loadcolor(1)
            icoul_courante = 1
            call x11linsrn(iorigxb,iorigyb
     &                    ,iorigxb+ilarg0,iorigyb+ihaut0)
            call x11linsrn(iorigxb,iorigyb+ihaut0
     &                    ,iorigxb+ilarg0,iorigyb)
            call viderbuff2
            tempsaperdre = 2.
            call perddutemps(tempsaperdre)
            irc = 1
            ipostscript = 1
            call viderbuff2
            return
          endif
          ii = -iopt
        else
          ii = iopt
        endif
        if (idir.eq.0) then
          ilarg2 = nint(.01*real(ii*ilarg0))
        else
          ihaut2 = nint(.01*real(ii*ihaut0))
        endif
        ibbb = 0
      endif
      call x11thermoini(iorigxb,iorigyb,ilarg2,ihaut2,ibbb
     &                 ,icol1,icol2,icol3)
      call x11loadcolor(icol4)
      icoul_courante = icol4
      string(nchar+1) = char(0)
      call x11txtsrnrot3(string,nchar,iorigx0,iorigy0,icol3
     &                  ,angletherm,icentre,image)
      call viderbuff2
      irc = 0
      end
C===============================================================
      subroutine thermometre0(string,nchar,origx,origy,dx,dy,iopt,idir
     &                      ,icol1,icol2,icol3,icol4,ibord,irc)
      INCLUDE 'Parametres.f'
      character*1 string(*)
      save
      if (iopt.eq.0) then
        call x11textextendall(string,nchar,ilarg,ihaut,ibase)
        iorigx = origine_x + facteur_en_x*origx
        iorigy = origine_y + facteur_en_y*origy
        ibx = iabs(nint(dx*facteur_en_x))
        iby = iabs(nint(dy*facteur_en_y))
        if (idir.eq.0) then
          ilarg = ilarg+2*ibx
          ihaut = ihaut+2*iby
          iorigy = iorigy - ihaut
          iorigcx = iorigx + ibx
          iorigcy = iorigy + ihaut - iby - ibase
        else
          ii = ihaut+2*ibx
          ihaut = ilarg+2*iby
          ilarg = ii
          iorigcx = iorigx - ibx - ibase
          iorigcy = iorigy - iby
          iorigx = iorigx - ilarg
          iorigy = iorigy - ihaut
        endif
        ibb = ibord
        ilarg2 = ilarg
        ihaut2 = ihaut
        iorigx0 = iorigx
        iorigy0 = iorigy
        ic1 = icol1
        ic2 = icol2
        ic3 = icol3
        ic4 = icol4
      else
c        call x11press
        call getxycx11c(iev,ixposcurs,iyposcurs
     &         ,ixposcurs_root,iyposcurs_root)
c        call x11allevents
        if (iev.ge.251.and.iev.le.253.and.
     &      ixposcurs.ge.ix0_zone_click.and.
     &      ixposcurs.le.ix1_zone_click.and.
     &      iyposcurs.ge.iy0_zone_click.and.
     &      iyposcurs.le.iy1_zone_click) then
          call x11thermoini(iorigx0,iorigy0,ilarg,ihaut,ibord
     &                     ,ic2,ic1,ic3)
          call x11loadcolor(ic4)
          string(nchar+1) = char(0)
          if (idir.eq.0.) then
            call x11txtsrn(string,nchar,iorigcx,iorigcy)
          else
            a = 90.
            call x11txtsrnrot(string,nchar,iorigcx,iorigcy,a)
          endif
          irc = 1
          ipostscript = 1
          call viderbuff2
          return
        endif
        ibb = 0
        if (idir.eq.0) then
          ilarg2 = nint(.01*real(iopt*ilarg))+(iorigx0-iorigx)
        else
          ihaut2 = nint(.01*real(iopt*ihaut))+(iorigy0-iorigy)
        endif
      endif
      call x11thermoini(iorigx,iorigy,ilarg2,ihaut2,ibb
     &                 ,icol1,icol2,icol3)
      call x11loadcolor(icol4)
      string(nchar+1) = char(0)
      if (idir.eq.0) then
        call x11txtsrn(string,nchar,iorigcx,iorigcy)
      else
        a = 90.
        call x11txtsrnrot(string,nchar,iorigcx,iorigcy,a)
      endif
      if (iopt.ne.0) then
        if (idir.eq.0) then
          iorigx = iorigx+ilarg2
        else
          iorigy = iorigy+ihaut2
        endif      
      endif
      irc = 0
      end
