      subroutine gen_line(x1,y1,x2,y2)
c
c James Blake
c @(#)genline.f	1.1  4/3/89 
c
      integer x,y,xlist(10),ylist(10),valid,choice
      integer ix(2), iy(2)
      character*80 string
c
c
c Initialize the graphics input devices and numbers.
c
      call getpoint(x1,y1,ib)
      ix(1) = screenx(x1)
      iy(1) = screeny(y1)
      ix(2) = ix(1)
      iy(2) = iy(1)
      x = ix(1)
      y = iy(1)
      call cfinitlid(0,1,x,y,xlist,ylist,n,val,choice,
     $               string,segid,pickid)
c
c Associate mouse buttons to the event.
c
      call cfassoc(2,0,1)
      call cftrackon(0,1,1,0,0,10000,10000,x,y,xlist,ylist,n,
     $               val,choice,string,segid,pickid)
c     
c Enable tracing of the mouse position.
c
      call cfassoc(5,0,1)
c
c set a good color and XOR drawing mode.
c
      call newpen(3)
      call cfsgldrawmode(4)
c
      valid = 0
      itrig = 0
c
c Loop while the user is moving the mouse.
c
      call cfpolyline(ix,iy,2)
      do while (valid .eq. 0 .and. itrig .ne. 2)
         call cfreqinp(0,1,-1,valid,itrig,x,y,xlist,ylist,n,
     $                 val,choice,string,segid,itrig,pickid)
c
         call cfpolyline(ix,iy,2)
         ix(2) = x 
         iy(2) = y
         call cfpolyline(ix,iy,2)
      enddo
c
c Dissociate the buttons and release the device.
c
      call cfpolyline(ix,iy,2)
      call cfsgldrawmode(0)
      call cfdissoc(2,0,1)
      call cfdissoc(5,0,1)
      call cfrelidev(0,1)
      call newpen(1)
      x1 = page_x(ix(1))
      y1 = page_y(iy(1))
      x2 = page_x(ix(2))
      y2 = page_y(iy(2))
      return
      end
