      SUBROUTINE RESETREG
      
	  USE WINTERACTER 

      INCLUDE 'TXFRM.COM'

      INCLUDE 'BFILES.I90'
      
      CHARACTER*1 IFLAG


      XORIGMIN=BFMINMAX(NBKFL,1)            
      YORIGMIN=BFMINMAX(NBKFL,2)  
      XORIGMAX=BFMINMAX(NBKFL,3)            
      YORIGMAX=BFMINMAX(NBKFL,4)            

!    get reference point
!       xrefpt
!       yrefpt

      CALL WMessageBox(OKOnly,ExclamationIcon,CommonOK,'Select Fixed Reference point','CHOOSE REFERENCE')

      CALL XYLOC(XTEMP,YTEMP,IFLAG,IBOX)        
       XREFPT = XTEMP*TXSCAL - XS 
       YREFPT = YTEMP*TXSCAL - YS 

!    get start move point
!       xlocs
!       ylocs
      CALL WMessageBox(OKOnly,ExclamationIcon,CommonOK,'Select Starting point','CHOOSE START')

      CALL XYLOC(XTEMP,YTEMP,IFLAG,IBOX)        
       XLOCS = XTEMP*TXSCAL - XS 
       YLOCS = YTEMP*TXSCAL - YS 

!    get finish move point
!       xlocf
!       ylocf
      CALL WMessageBox(OKOnly,ExclamationIcon,CommonOK,'Select Finishing point','CHOOSE FINISH')


      CALL XYLOC(XTEMP,YTEMP,IFLAG,IBOX)        
       XLOCF = XTEMP*TXSCAL - XS 
       YLOCF = YTEMP*TXSCAL - YS 

!    establish x moves

      stscal=(xlocf-xrefpt)/(xlocs-xrefpt)
      xnewmin=xrefpt-(xrefpt-xorigmin)*stscal
      xnewmax=xrefpt+(xorigmax-xrefpt)*stscal       

!    establish y moves

      stscal=(ylocf-yrefpt)/(ylocs-yrefpt)
      ynewmin=yrefpt-(yrefpt-yorigmin)*stscal
      ynewmax=yrefpt+(yorigmax-yrefpt)*stscal 
      
      BFMINMAX(NBKFL,1)=xnewmin            
      BFMINMAX(NBKFL,2)=ynewmin  
      BFMINMAX(NBKFL,3)=xnewmax            
      BFMINMAX(NBKFL,4)=ynewmax            
                
      CALL CLSCRN
      CALL PLOTOT(1)          

      CALL WMessageBox(YesNo,QuestionIcon,CommonOK,'Do you wish to use and save'//&
                            CHAR(13)//'this registration?','CHOOSE REGISTRATION?')
!
!   If answer NO revert
!
      IF (WInfoDialog(4) .EQ. 2) then
        BFMINMAX(NBKFL,1)=XORIGMIN            
        BFMINMAX(NBKFL,2)=YORIGMIN 
        BFMINMAX(NBKFL,3)=XORIGMAX            
        BFMINMAX(NBKFL,4)=YORIGMAX           
        CALL CLSCRN
        CALL PLOTOT(1)          
      else
 !   
 !  otherwise SAVE     

        CALL SAVORG(NBKFL,2)
      END IF
!

      RETURN
      END