source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DDW7.m@ 1432

Last change on this file since 1432 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.0 KB
RevLine 
[613]1DDW7 ;SFISC/MKO-MARK TEXT ;2:30 PM 27 Jul 2000
2 ;;22.0;VA FileMan;**18**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5MARK ;Mark the text
6 I $D(DDWMARK) D
7 . D BOUND
8 E D
9 . S DDWMARK=DDWA+DDWRW_U_DDWC_U_(DDWA+DDWRW)_U_$$MAX(DDWC,$L(DDWN))
10 . D PAINT(DDWMARK,1),IND(1)
11 Q
12 ;
13BOUND ;Mark ending boundary, highlight selected text
14 N DDWI,DDWX,DDWY
15 ;
16 S DDWI=DDWA+DDWRW_U_DDWC
17 S DDWX=$P(DDWMARK,U,1,2)
18 S DDWY=$P(DDWMARK,U,3,4)
19 ;
20 I $$ISLESS(DDWI,DDWX) D
21 . D PAINT(DDWX_U_DDWY)
22 . D PAINT(DDWI_U_DDWX,1)
23 . S DDWMARK=DDWI_U_DDWX
24 E D
25 . I $$ISLESS(DDWI,DDWY) D
26 .. D PAINT(DDWI_U_DDWY),PAINT(DDWI_U_DDWI,1)
27 . E D PAINT(DDWY_U_DDWI,1)
28 . S DDWMARK=DDWX_U_DDWI
29 D CUP(DDWRW,DDWC-DDWOFS)
30 Q
31 ;
32UNMARK ;Unmark the text
33 D:$D(DDWMARK) PAINT(DDWMARK),IND()
34 K DDWMARK
35 Q
36 ;
37PAINT(DDWMARK,DDWREV) ;Paint selected text
38 N DDWI,DDWE1,DDWE2,DDWL1,DDWL2,DDWR1,DDWC1,DDWR2,DDWC2
39 S DDWR1=$P(DDWMARK,U,1),DDWC1=$P(DDWMARK,U,2)
40 S DDWR2=$P(DDWMARK,U,3),DDWC2=$P(DDWMARK,U,4)
41 S DDWL1=$$MAX(DDWR1-DDWA,1),DDWL2=$$MIN(DDWR2-DDWA,DDWMR)
42 Q:DDWL1>DDWL2
43 ;
44 W:$G(DDWREV) $P(DDGLVID,DDGLDEL,6)
45 F DDWI=DDWL1:1:DDWL2 D
46 . S DDWE1=$$MAX($S(DDWI+DDWA=DDWR1:DDWC1,1:1),DDWOFS+1)
47 . S DDWE2=$$MIN($S(DDWI+DDWA=DDWR2:DDWC2,1:999),IOM+DDWOFS)
48 . Q:DDWE1>DDWE2
49 . D CUP(DDWI,DDWE1-DDWOFS)
50 . W $E(DDWL(DDWI),DDWE1,DDWE2)
51 W:$G(DDWREV) $P(DDGLVID,DDGLDEL,10)
52 Q
53 ;
54IND(DDWX) ;Paint indicator
55 S DY=$G(DDWBM,IOSL)-1,DX=IOM-7 X IOXY
56 W $S($G(DDWX):$P(DDGLVID,DDGLDEL,6)_"Select"_$P(DDGLVID,DDGLDEL,10),1:$P(DDGLCLR,DDGLDEL))
57 D CUP(DDWRW,DDWC-DDWOFS)
58 Q
59 ;
60CUP(Y,X) ;
61 S DY=IOTM+Y-2,DX=X-1 X IOXY
62 Q
63 ;
64POS(R,C,F) ;Pos cursor based on char pos C
65 N DDWX
66 S:$G(C)="E" C=$L($G(DDWL(R)))+1
67 S:$G(F)["N" DDWN=$G(DDWL(R))
68 S:$G(F)["R" DDWRW=R,DDWC=C
69 ;
70 S DDWX=C-DDWOFS
71 I DDWX>IOM!(DDWX<1) D SHIFT^DDW3(C,.DDWOFS)
72 S DY=IOTM+R-2,DX=C-DDWOFS-1 X IOXY
73 Q
74 ;
75ISLESS(X,Y) ;Is coordinate X less than coordinate Y
76 N R1,C1,R2,C2
77 S R1=$P(X,U),C1=$P(X,U,2)
78 S R2=$P(Y,U),C2=$P(Y,U,2)
79 ;
80 Q:R1>R2 0
81 Q:R1<R2 1
82 Q:C1>C2 0
83 Q 1
84 ;
85MIN(X,Y) ;
86 Q $S(X<Y:X,1:Y)
87 ;
88MAX(X,Y) ;
89 Q $S(X>Y:X,1:Y)
Note: See TracBrowser for help on using the repository browser.