XPDID ;SFISC/VYD,RSD - Display Install Progress ;05/14/98  10:29
 ;;8.0;KERNEL;**81**;Jul 10, 1995
 ;;
 Q
INIT ;initialize progress screen
 N X,XPDSTR
 I IO'=IO(0)!(IOST'["C-VT") S XPDIDVT=0 Q
 I $T(PREP^XGF)="" S XPDIDVT=0 Q
 ;S X="XGF" X ^%ZOSF("TEST") E  S XPDIDVT=0 Q
 D PREP^XGF
 S XPDIDVT=1,X="IOSTBM",XPDSTR="             25             50             75               "
 D ENDR^%ZISS
 S IOTM=3,IOBM=IOSL-4
 W @IOSTBM
 D FRAME^XGF(IOTM-2,0,IOTM-2,IOM-1)
 D FRAME^XGF(IOBM,0,IOBM,IOM-1)
 D FRAME^XGF(IOBM+1,10,IOBM+3,71)
 D SAY^XGF(IOBM+2,11,XPDSTR)
 D SAY^XGF(IOBM+2,0,$J("0",5)_"%")
 D SAY^XGF(IOBM+3,0,"Complete")
 D IOXY^XGF(IOTM-2,0)
 Q
 ;
EXIT(XPDM) ;exit progress screen restore screen to normal
 I $G(XPDIDVT) D
 .S IOTM=1,IOBM=IOSL
 .W @IOSTBM,@IOF
 .W:$G(XPDM)]"" !!,XPDM,!!
 .D CLEAN^XGF
 K IOTM,IOBM,IOSTBM,XPDIDCNT,XPDIDMOD,XPDIDTOT,XPDIDVT
 Q
 ;
TITLE(X) ;display title X
 Q:'XPDIDVT
 N XPDOX,XPDOY
 S XPDOX=$X,XPDOY=$Y
 D SAY^XGF(0,0,$$CJ^XLFSTR(X,IOM_"T")),CURSOR
 Q
 ;
SETTOT(X) ;X=file # from build
 Q:'$D(XPDIDVT)
 S XPDIDTOT=$S(X=4:+$P($G(^XTMP("XPDI",XPDA,"BLD",XPDBLD,4,0)),U,4),X=9.8:+$G(^XTMP("XPDI",XPDA,"RTN")),1:+$P($G(^XTMP("XPDI",XPDA,"BLD",XPDBLD,"KRN",X,"NM",0)),U,4))
 S XPDIDMOD=$S(XPDIDTOT<60:1,1:XPDIDTOT\60),XPDIDCNT=0
 Q:'XPDIDVT
 D UPDATE(0)
 Q
 ;
UPDATE(XPDN) ;update the progress bar
 I 'XPDIDVT W "." Q
 N XPDLEN,XPDMC,XPDOX,XPDOY,XPDS,XPDSTR
 S XPDOX=$X,XPDOY=$Y,XPDMC=60,XPDSTR="             25             50             75               "
 S XPDLEN=$S(XPDIDTOT:XPDN/XPDIDTOT*XPDMC\1,1:0),XPDS=$E(XPDSTR,1,XPDLEN)
 D SAY^XGF(IOBM+2,11,XPDS,"R1")
 S XPDS=$E(XPDSTR,XPDLEN+1,XPDMC)
 D SAY^XGF(IOBM+2,11+XPDLEN,XPDS)
 D SAY^XGF(IOBM+2,0,$J(XPDLEN/XPDMC*100,5,0)),CURSOR
 Q
 ;
CURSOR ;put cursor back
 S:XPDOY>(IOBM-1) XPDOY=IOBM-1
 D IOXY^XGF(XPDOY,XPDOX)
 Q
