146 lines
3.9 KiB
Mathematica
146 lines
3.9 KiB
Mathematica
DIR0 ;SFISC/MKO-FIELD EDITOR ;11:32 AM 15 Feb 1995
|
|
;;22.0;VA FileMan;;Mar 30, 1999
|
|
;Per VHA Directive 10-93-142, this routine should not be modified.
|
|
;
|
|
SM ;
|
|
N DIR0A,DIR0C,DIR0CH,DIR0CHG,DIR0D,DIR0F,DIR0L,DIR0M
|
|
N DIR0P,DIR0QT,DIR0QU,DIR0R,DIR0RJ,DIR0S,DIR0SP,DIR0ST,DIR0SV,DX,DY
|
|
S DIR0P="" D:$D(DIR0("IN"))[0 GETKEY^DIR0K
|
|
S:$P(DIR0,U,6) DIR0RJ=1
|
|
;
|
|
I $G(DDSH) D
|
|
. K DDSH
|
|
. S DY=IOSL-1,DX=0 X IOXY W $P(DDGLCLR,DDGLDEL)
|
|
. I DDO,'DDM W "COMMAND:"
|
|
. S DX=IOM-33 X IOXY W $P(DDGLVID,DDGLDEL,10)_$$EZBLD^DIALOG(8074)
|
|
. S DX=IOM-8 X IOXY
|
|
. W $P(DDGLVID,DDGLDEL,6)_$P($$EZBLD^DIALOG(7002),U,$G(DIR0("REP"))>0+1)_$P(DDGLVID,DDGLDEL,10)
|
|
;
|
|
S (DIR0A,DIR0D)=$G(DIR("B"))
|
|
S DIR0R=$P(DIR0,U),DIR0S=$P(DIR0,U,2),DIR0L=$P(DIR0,U,3),DIR0M=245
|
|
;
|
|
W $P(DDGLVID,DDGLDEL,10)
|
|
S DY=$P(DIR0,U,4),DX=$P(DIR0,U,5)
|
|
I $D(DIR("A"))=11 D
|
|
. N DIX
|
|
. S DIX="" F S DIX=$O(DIR("A",DIX)) Q:DIX="" D
|
|
.. X IOXY W DIR("A",DIX)
|
|
.. S DY=DY+1
|
|
;
|
|
I $D(DIR("A"))#2 D
|
|
. X IOXY W DIR("A")
|
|
. I DDO,DY=IOSL-1 W $P(DDGLCLR,DDGLDEL)
|
|
;
|
|
D INIT,^DIR01
|
|
;
|
|
I $D(DTOUT) W $C(7) S DIR0A=DIR0D
|
|
I DIR0A="@",DIR0D'="@" S DIR0A=""
|
|
S:DIR0CH="QT" DIR0A=DIR0D
|
|
S X=DIR0A
|
|
S:X?1"^".E!(X?1"?".E) DIR0A=DIR0D
|
|
S DIR0N=X=DIR0D S:DIR0A'=DIR0D DIR0("L")=DIR0A
|
|
;
|
|
D END,PAINT
|
|
X DDGLZOSF("EON"),DDGLZOSF("TRMOFF")
|
|
Q
|
|
;
|
|
EN(DIR0R,DIR0S,DIR0L,DIR0NL,DIR0A,DIR0M,DIR0C,DIR0MAP,DIR0FLG,X,Y) ;
|
|
;Field editor
|
|
N DIR0CH,DIR0CHG,DIR0D,DIR0F,DIR0KD,DIR0P,DIR0QT,DIR0QU
|
|
N DIR0RJ,DIR0SP,DIR0ST,DIR0SV,DIR0TO,DX,DY
|
|
;
|
|
D INIT^DDGLIB0()
|
|
;
|
|
I $D(DIR0MAP)<2 D
|
|
. S DIR0P="D"
|
|
. D:$D(DIR0("DIN"))[0 GETKEY^DIR0K
|
|
E D
|
|
. S DIR0P="C"
|
|
. I $O(DIR0MAP(""))!($D(DIR0MAP("IN"))[0) D
|
|
.. D GETKEY^DIR0K
|
|
.. K DIR0MAP S DIR0MAP("IN")=DIR0("CIN"),DIR0MAP("OUT")=DIR0("COUT")
|
|
. E D
|
|
.. S DIR0("CIN")=$G(DIR0MAP("IN")),DIR0("COUT")=$G(DIR0MAP("OUT"))
|
|
.. S:DIR0("CIN")[(U_"KD"_U) DIR0KD=$P(DIR0("COUT"),";",$L($P(DIR0("CIN"),U_"KD"_U),U))
|
|
.. S:DIR0("CIN")[(U_"TO"_U) DIR0TO=$P(DIR0("COUT"),";",$L($P(DIR0("CIN"),U_"TO"_U),U))
|
|
;
|
|
S (DIR0A,DIR0D)=$G(DIR0A)
|
|
S:'$G(DIR0R) DIR0R=0
|
|
S:'$G(DIR0S) DIR0S=0
|
|
S:'$G(DIR0L) DIR0L=IOM-1-DIR0S
|
|
S:'$G(DIR0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