DDGLIB0 ;SFISC/MKO-SETUP AND CLEANUP FOR WINDOWS ;1:09 PM 19 Jun 1998
;;22.0;VA FileMan;;Mar 30, 1999
;Per VHA Directive 10-93-142, this routine should not be modified.
INIT() ;Setup required variables
;Set margin to 0
;Turn autowrap off
;Turn type-ahead on
;Variables set:
; DDGLDEL = delimiter for other DDGL variables
; DDGLVID = codes that turn on/off video attributes
; DDGLED = codes for editing
; DDGLCLR = codes to erase characters
; DDGLGRA = codes for graphics characters
; DDGLZOSF = array of code from %ZOSF
; DDGLREF = global where window image is stored
; DDGLKEY = codes for non-alphanumeric keys
; DDGLSCR = array containing list of visible windows on screen
;
N X
I $D(DDGLDEL)[0 D SET Q:$G(DIERR)
S X=0 X ^%ZOSF("RM"),^("TYPE-AHEAD")
W $P(DDGLVID,DDGLDEL,8)
Q
;
SET ;Setup screen handling variables
K DIERR,DDGLSCR
S U="^",DDGLDEL=$C(127)
;
F X="EOFF","EON","TRMOFF","TRMON","TRMRD" D G:$G(DIERR) ABT
. I $D(^%ZOSF(X))#2 S DDGLZOSF(X)=^(X) Q
. D BLD^DIALOG(810)
;
S IOP="HOME" D ^%ZIS I POP D BLD^DIALOG(845) G ABT
I $D(^%ZIS(2)),'$O(^%ZIS(2,+$G(IOST(0)),0)) D BLD^DIALOG(840,"#"_+$G(IOST(0))) G ABT
;
D:$G(IOXY)="" TRMERR("Cursor positioning (XY CRT)")
;
S X="IORVON;IORVOFF;IOELEOL;IOEDEOP;IOUON;IOUOFF;IOSGR0;IOINHI;IOINLOW;IOINORM;IOCUU;IOCUD;IOCUF;IOCUB;IODL;IOIL;IODCH;IOICH;IOEDALL;IOELALL;IORI;IOAWM1;IOAWM0;IOSTBM;IOPF1;IOPF2;IOPF3;IOPF4;IOFIND;IOSELECT;IOINSERT;IOREMOVE;IOPREVSC;IONEXTSC"
N @$TR(X,";",",")
N IOBLC,IOBRC,IOBT,IOG1,IOG0,IOHL,IOLT,IOMT,IORT,IOTLC,IOTRC,IOTT,IOVL
D ENDR^%ZISS,GSET^%ZISS
I $G(IOPREVSC)="","^C-VT220^C-VT320^"[(U_IOST_U) D
. S IOPREVSC=$C(27)_"[5~"
. S IONEXTSC=$C(27)_"[6~"
;
S DDGLVID=IOINHI_DDGLDEL_IOINLOW_DDGLDEL_IOINORM_DDGLDEL_IOUON_DDGLDEL_IOUOFF_DDGLDEL_IORVON_DDGLDEL_IORVOFF_DDGLDEL_IOAWM0_DDGLDEL_IOAWM1_DDGLDEL_$G(IOSGR0)
S DDGLED=$G(IORI)_DDGLDEL_$G(IOSTBM)_DDGLDEL_$G(IOIL)_DDGLDEL_$G(IODL)_DDGLDEL_$G(IOICH)_DDGLDEL_$G(IODCH)
S DDGLCLR=IOELEOL_DDGLDEL_IOEDALL_DDGLDEL_IOEDEOP_DDGLDEL_$G(IOELALL)
S DDGLKEY=U_IOCUU_U_IOCUD_U_IOCUF_U_IOCUB_U_IOPF1_U_IOPF2_U_IOPF3_U_IOPF4_U_$G(IOFIND)_U_$G(IOSELECT)_U_$G(IOINSERT)_U_$G(IOREMOVE)_U_$G(IOPREVSC)_U_$G(IONEXTSC)_U
S DDGLGRA=IOG1_DDGLDEL_IOG0_DDGLDEL_IOHL_DDGLDEL_IOVL_DDGLDEL_IOTLC_DDGLDEL_IOTRC_DDGLDEL_IOBLC_DDGLDEL_IOBRC
S:DDGLDEL_$P(DDGLGRA,DDGLDEL,3,999)_DDGLDEL[(DDGLDEL_DDGLDEL) DDGLGRA=DDGLDEL_DDGLDEL_"-"_DDGLDEL_"|"_DDGLDEL_"+"_DDGLDEL_"+"_DDGLDEL_"+"_DDGLDEL_"+"
;
D:$P(DDGLKEY,U,1,5)_U[(U_U) TRMERR("Cursor keys")
D:U_$P(DDGLKEY,U,6,9)_U[(U_U) TRMERR("PF keys")
D:IOELEOL="" TRMERR("Erase to End of Line")
D:IOEDALL="" TRMERR("Erase Entire Page")
D:IOEDEOP="" TRMERR("Erase to End of Page")
G:$G(DIERR) ABT
;
S DDGLREF="^TMP(""DDGL"",$J,""W"")" K @DDGLREF
;
I "^C-QUME^C-QVT102^C-WYSE75^"[(U_$TR(IOST," ","")_U) D
. S DDGLVAN=1
. S $P(DDGLVID,DDGLDEL,4,7)=$S($TR(IOST," ","")="C-WYSE75":IOINHI_DDGLDEL_IOINLOW_DDGLDEL_IOINHI_DDGLDEL_IOINLOW,1:IOINLOW_DDGLDEL_IOINHI_DDGLDEL_IOINLOW_DDGLDEL_IOINHI)
. S $P(DDGLVID,DDGLDEL,10)=IOINORM
;
D:'$D(^%ZTSK)!($D(^%ZOSF("MGR"))[0) KILL^%ZISS
Q
;
TRMERR(DDGLCH) ;Terminal type errors
N P
S P(1)=DDGLCH,P(2)=IOST
D BLD^DIALOG(842,.P)
Q
;
KILL(DDGLPARM) ;Cleanup variables
;Set margin to IOM
;Turn off type-ahead if New Person file so indicates
;Turn autowrap on
;Reset character attributes
;Turn echo on
;Turn terminators off
N X
I $G(DDGLPARM)'["W" D
. S X=$S($D(IOM)#2:IOM,1:80) X $G(^%ZOSF("RM"))
. I $D(DUZ)#2,$D(^VA(200,DUZ,0))#2,$P($G(^(200)),U,9)'="Y" D
.. I '$G(DUZ("BUF"),1) X $G(^%ZOSF("NO-TYPE-AHEAD"))
. W $P($G(DDGLVID),$G(DDGLDEL),9),$P($G(DDGLVID),$G(DDGLDEL),10)
;
I $G(DDGLPARM)'["T" D
. X $G(DDGLZOSF("EON")),$G(DDGLZOSF("TRMOFF"))
E X $G(DDGLZOSF("EOFF")),$G(DDGLZOSF("TRMON"))
;
ABT K DX,DY,POP
I '$G(DIERR),$G(DDGLPARM)["K" Q
K:$G(DDGLREF)]"" @DDGLREF
D:'$D(^%ZTSK)!($D(^%ZOSF("MGR"))[0) KILL^%ZISS
;
K DDGLDEL,DDGLVID,DDGLED,DDGLCLR,DDGLGRA,DDGLZOSF,DDGLREF
K DDGLKEY,DDGLSCR,DDGLVAN,DDGLH
;
K DIR0
Q
DDGLIB0 ;SFISC/MKO-SETUP AND CLEANUP FOR WINDOWS ;1:09 PM 19 Jun 1998
+1 ;;22.0;VA FileMan;;Mar 30, 1999
+2 ;Per VHA Directive 10-93-142, this routine should not be modified.
INIT() ;Setup required variables
+1 ;Set margin to 0
+2 ;Turn autowrap off
+3 ;Turn type-ahead on
+4 ;Variables set:
+5 ; DDGLDEL = delimiter for other DDGL variables
+6 ; DDGLVID = codes that turn on/off video attributes
+7 ; DDGLED = codes for editing
+8 ; DDGLCLR = codes to erase characters
+9 ; DDGLGRA = codes for graphics characters
+10 ; DDGLZOSF = array of code from %ZOSF
+11 ; DDGLREF = global where window image is stored
+12 ; DDGLKEY = codes for non-alphanumeric keys
+13 ; DDGLSCR = array containing list of visible windows on screen
+14 ;
+15 NEW X
+16 IF $DATA(DDGLDEL)[0
DO SET
IF $GET(DIERR)
QUIT
+17 SET X=0
XECUTE ^%ZOSF("RM")
XECUTE ^("TYPE-AHEAD")
+18 WRITE $PIECE(DDGLVID,DDGLDEL,8)
+19 QUIT
+20 ;
SET ;Setup screen handling variables
+1 KILL DIERR,DDGLSCR
+2 SET U="^"
SET DDGLDEL=$CHAR(127)
+3 ;
+4 FOR X="EOFF","EON","TRMOFF","TRMON","TRMRD"
Begin DoDot:1
+5 IF $DATA(^%ZOSF(X))#2
SET DDGLZOSF(X)=^(X)
QUIT
+6 DO BLD^DIALOG(810)
End DoDot:1
IF $GET(DIERR)
GOTO ABT
+7 ;
+8 SET IOP="HOME"
DO ^%ZIS
IF POP
DO BLD^DIALOG(845)
GOTO ABT
+9 IF $DATA(^%ZIS(2))
IF '$ORDER(^%ZIS(2,+$GET(IOST(0)),0))
DO BLD^DIALOG(840,"#"_+$GET(IOST(0)))
GOTO ABT
+10 ;
+11 IF $GET(IOXY)=""
DO TRMERR("Cursor positioning (XY CRT)")
+12 ;
+13 SET X="IORVON;IORVOFF;IOELEOL;IOEDEOP;IOUON;IOUOFF;IOSGR0;IOINHI;IOINLOW;IOINORM;IOCUU;IOCUD;IOCUF;IOCUB;IODL;IOIL;IODCH;IOICH;IOEDALL;IOELALL;IORI;IOAWM1;IOAWM0;IOSTBM;IOPF1;IOPF2;IOPF3;IOPF4;IOFIND;IOSELECT;IOINSERT;IOREMOVE;IOPREVSC;IONEXTSC
"
+14 NEW @$TRANSLATE(X,";",",")
+15 NEW IOBLC,IOBRC,IOBT,IOG1,IOG0,IOHL,IOLT,IOMT,IORT,IOTLC,IOTRC,IOTT,IOVL
+16 DO ENDR^%ZISS
DO GSET^%ZISS
+17 IF $GET(IOPREVSC)=""
IF "^C-VT220^C-VT320^"[(U_IOST_U)
Begin DoDot:1
+18 SET IOPREVSC=$CHAR(27)_"[5~"
+19 SET IONEXTSC=$CHAR(27)_"[6~"
End DoDot:1
+20 ;
+21 SET DDGLVID=IOINHI_DDGLDEL_IOINLOW_DDGLDEL_IOINORM_DDGLDEL_IOUON_DDGLDEL_IOUOFF_DDGLDEL_IORVON_DDGLDEL_IORVOFF_DDGLDEL_IOAWM0_DDGLDEL_IOAWM1_DDGLDEL_$GET(IOSGR0)
+22 SET DDGLED=$GET(IORI)_DDGLDEL_$GET(IOSTBM)_DDGLDEL_$GET(IOIL)_DDGLDEL_$GET(IODL)_DDGLDEL_$GET(IOICH)_DDGLDEL_$GET(IODCH)
+23 SET DDGLCLR=IOELEOL_DDGLDEL_IOEDALL_DDGLDEL_IOEDEOP_DDGLDEL_$GET(IOELALL)
+24 SET DDGLKEY=U_IOCUU_U_IOCUD_U_IOCUF_U_IOCUB_U_IOPF1_U_IOPF2_U_IOPF3_U_IOPF4_U_$GET(IOFIND)_U_$GET(IOSELECT)_U_$GET(IOINSERT)_U_$GET(IOREMOVE)_U_$GET(IOPREVSC)_U_$GET(IONEXTSC)_U
+25 SET DDGLGRA=IOG1_DDGLDEL_IOG0_DDGLDEL_IOHL_DDGLDEL_IOVL_DDGLDEL_IOTLC_DDGLDEL_IOTRC_DDGLDEL_IOBLC_DDGLDEL_IOBRC
+26 IF DDGLDEL_$PIECE(DDGLGRA,DDGLDEL,3,999)_DDGLDEL[(DDGLDEL_DDGLDEL)
SET DDGLGRA=DDGLDEL_DDGLDEL_"-"_DDGLDEL_"|"_DDGLDEL_"+"_DDGLDEL_"+"_DDGLDEL_"+"_DDGLDEL_"+"
+27 ;
+28 IF $PIECE(DDGLKEY,U,1,5)_U[(U_U)
DO TRMERR("Cursor keys")
+29 IF U_$PIECE(DDGLKEY,U,6,9)_U[(U_U)
DO TRMERR("PF keys")
+30 IF IOELEOL=""
DO TRMERR("Erase to End of Line")
+31 IF IOEDALL=""
DO TRMERR("Erase Entire Page")
+32 IF IOEDEOP=""
DO TRMERR("Erase to End of Page")
+33 IF $GET(DIERR)
GOTO ABT
+34 ;
+35 SET DDGLREF="^TMP(""DDGL"",$J,""W"")"
KILL @DDGLREF
+36 ;
+37 IF "^C-QUME^C-QVT102^C-WYSE75^"[(U_$TRANSLATE(IOST," ","")_U)
Begin DoDot:1
+38 SET DDGLVAN=1
+39 SET $PIECE(DDGLVID,DDGLDEL,4,7)=$SELECT($TRANSLATE(IOST," ","")="C-WYSE75":IOINHI_DDGLDEL_IOINLOW_DDGLDEL_IOINHI_DDGLDEL_IOINLOW,1:IOINLOW_DDGLDEL_IOINHI_DDGLDEL_IOINLOW_DDGLDEL_IOINHI)
+40 SET $PIECE(DDGLVID,DDGLDEL,10)=IOINORM
End DoDot:1
+41 ;
+42 IF '$DATA(^%ZTSK)!($DATA(^%ZOSF("MGR"))[0)
DO KILL^%ZISS
+43 QUIT
+44 ;
TRMERR(DDGLCH) ;Terminal type errors
+1 NEW P
+2 SET P(1)=DDGLCH
SET P(2)=IOST
+3 DO BLD^DIALOG(842,.P)
+4 QUIT
+5 ;
KILL(DDGLPARM) ;Cleanup variables
+1 ;Set margin to IOM
+2 ;Turn off type-ahead if New Person file so indicates
+3 ;Turn autowrap on
+4 ;Reset character attributes
+5 ;Turn echo on
+6 ;Turn terminators off
+7 NEW X
+8 IF $GET(DDGLPARM)'["W"
Begin DoDot:1
+9 SET X=$SELECT($DATA(IOM)#2:IOM,1:80)
XECUTE $GET(^%ZOSF("RM"))
+10 IF $DATA(DUZ)#2
IF $DATA(^VA(200,DUZ,0))#2
IF $PIECE($GET(^(200)),U,9)'="Y"
Begin DoDot:2
+11 IF '$GET(DUZ("BUF"),1)
XECUTE $GET(^%ZOSF("NO-TYPE-AHEAD"))
End DoDot:2
+12 WRITE $PIECE($GET(DDGLVID),$GET(DDGLDEL),9),$PIECE($GET(DDGLVID),$GET(DDGLDEL),10)
End DoDot:1
+13 ;
+14 IF $GET(DDGLPARM)'["T"
Begin DoDot:1
+15 XECUTE $GET(DDGLZOSF("EON"))
XECUTE $GET(DDGLZOSF("TRMOFF"))
End DoDot:1
+16 IF '$TEST
XECUTE $GET(DDGLZOSF("EOFF"))
XECUTE $GET(DDGLZOSF("TRMON"))
+17 ;
ABT KILL DX,DY,POP
+1 IF '$GET(DIERR)
IF $GET(DDGLPARM)["K"
QUIT
+2 IF $GET(DDGLREF)]""
KILL @DDGLREF
+3 IF '$DATA(^%ZTSK)!($DATA(^%ZOSF("MGR"))[0)
DO KILL^%ZISS
+4 ;
+5 KILL DDGLDEL,DDGLVID,DDGLED,DDGLCLR,DDGLGRA,DDGLZOSF,DDGLREF
+6 KILL DDGLKEY,DDGLSCR,DDGLVAN,DDGLH
+7 ;
+8 KILL DIR0
+9 QUIT