source: WorldVistAEHR/trunk/r/LIST_MANAGER-VALM/VALM40.m@ 1608

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

initial load of WorldVistAEHR

File size: 4.2 KB
RevLine 
[613]1VALM40 ;ALB/MJK - Screen Malipulation Utilities (cont.) ;01/31/2001 14:45
2 ;;1.0;List Manager;**6**;Aug 13, 1993
3FIND ; -- find text in list
4 N START,BEG,VALMOUT,VALMHIT,X,Y,DIR,DIRUT
5 S DIR(0)="F^2:50",DIR("A")="Search for" S:$D(VALMFIND) DIR("B")=VALMFIND
6 S DIR("?")="Enter from two to fifty characters."
7 D ^DIR I $D(DIRUT) D FINISH^VALM4 Q
8 S VALMFIND=Y,(BEG,START)=VALMBG,FINISH=VALMCNT
9 F D SEARCH(START,FINISH) D D:VALMHIT SELECT^VALM10(VALMHIT,0) Q:$D(VALMOUT)
10 . I 'VALMHIT,BEG=1 D WAIT^VALM1 S VALMOUT="" Q
11 . I VALMHIT,BEG=1,VALMHIT=VALMCNT D WAIT^VALM1 S VALMOUT="" Q
12 . I 'VALMHIT!(VALMHIT=VALMCNT),BEG'=1 D Q
13 . . I '$$BEG S VALMOUT="" Q
14 . . S FINISH=BEG-1,(BEG,START)=1
15 . N DIR,X,Y,DIRUT
16 . W ! S DIR(0)="Y",DIR("B")="Yes",DIR("A")="Find Next '"_VALMFIND_"'"
17 . D ^DIR I 'Y S VALMOUT="" Q
18 . S START=VALMHIT+1
19 D FINISH^VALM4
20 Q
21BEG() ; -- ask if ok to start from top
22 W !!,"<<< End of list >>>"
23 N DIR,X,Y,DIRUT
24 S DIR(0)="Y",DIR("A")="Do you want to start at the beginning of the list",DIR("B")="Yes"
25 D ^DIR
26 Q Y
27SEARCH(START,FINISH) ; -- search to end or first hit
28 ; input: START := line to start search on
29 ; FINISH := line to end search on
30 N Y,X,L,CNT
31 S VALMHIT="",CNT=0
32 S VALMBCK="" D:VALMCC RESET^VALM4 W !,"...searching for '"_VALMFIND_"'"
33 F I=START:1:FINISH S CNT=CNT+1 W:'(CNT#100) "." I $$UP^XLFSTR(@VALMAR@(I,0))[$$UP^XLFSTR(VALMFIND) S VALMHIT=I Q
34 I 'VALMHIT W $C(7),!!,"Text not found." Q
35 I VALMCC D
36 . I VALMHIT<VALMBG!(VALMHIT>VALMLST) S VALMBG=VALMHIT D LST^VALM4,PAINT^VALM4
37 . D UPD(VALMHIT,VALMFIND)
38 D PGUPD^VALM4
39 I 'VALMCC S VALMBG=VALMHIT D REFRESH^VALM
40 Q
41UPD(LINE,TEXT) ; -- set/unset video attribute on text
42 ; input: LINE := number of line
43 ; TEXT := chars to set attribute on
44 N LEN,POS,FIRST
45 D SELECT^VALM10(.LINE,1)
46 I 'VALMCC Q
47 S Y=@VALMAR@(LINE,0),LEN=$L(TEXT),POS=0,FIRST=""
48 F S POS=$F($$UP^XLFSTR(Y),$$UP^XLFSTR(TEXT),POS) Q:'POS D
49 . S:'FIRST FIRST=POS-LEN
50 . D CNTRL^VALM10(.LINE,POS-LEN,.LEN,.IORVON,IORVOFF_IOINHI)
51 I FIRST D
52 . I FIRST'>VALM("FIXED") Q
53 . I FIRST<VALMLFT D LEFT("^^^="_(VALMLFT-FIRST)) Q
54 . I FIRST'>((VALMWD-VALM("FIXED"))+VALMLFT) Q
55 . D RIGHT("^^^="_(FIRST-VALMLFT))
56 D WRITE^VALM10(.LINE)
57 Q
58UP ; -- display last screen (UP)
59 D START^VALM4
60 N Y S Y=VALMBG-1 I Y<1 W $C(7) D FINISH^VALM4 Q
61 S VALMBG=Y D LST^VALM4
62 I VALMCC S DY=VALM("TM")-1 D SCROLL^VALM4,IOIL^VALM4(0,.DY),WRITE^VALM4(VALMBG,0,1,.DY),PLUS^VALM4,RESET^VALM4
63 D PGUPD^VALM4
64 D FINISH^VALM4
65 Q
66DOWN ; -- display next line (DN)
67 D START^VALM4
68 N Y S Y=VALMLST+1 I Y>VALMCNT W $C(7) D FINISH^VALM4 Q
69 S VALMBG=VALMBG+1,VALMLST=Y
70 I VALMCC S DY=VALM("BM")-1 D SCROLL^VALM4,IOXY^VALM4(0,.DY),WRITE^VALM4(VALMLST,1,1,.DY),PLUS^VALM4,RESET^VALM4
71 D PGUPD^VALM4
72 D FINISH^VALM4
73 Q
74RIGHT(VALMNOD) ; -- move view to right
75 D START^VALM4
76 N MOVE,RM
77 S MOVE=$P($P(VALMNOD,U,4),"=",3),RM=VALM("RM")-VALMWD+VALM("FIXED")
78 I VALMLFT=RM W $C(7) D FINISH^VALM4 Q
79 I MOVE?1">".E D
80 . S VALMLFT=RM
81 E D
82 . S MOVE=$S(MOVE:+MOVE,1:VALMWD-VALM("FIXED"))
83 . I (VALMLFT+MOVE)>RM S VALMLFT=RM Q
84 . S VALMLFT=VALMLFT+MOVE
85 I VALMCC S:VALMWD'<$L($G(VALMHDR(VALM("TM")-3))) VALMBCK="P" D REFRESH^VALM
86 D FINISH^VALM4
87 Q
88LEFT(VALMNOD) ; -- move view to left
89 D START^VALM4
90 N MOVE,LM
91 S MOVE=$P($P(VALMNOD,U,4),"=",3),LM=VALM("FIXED")+1
92 I VALMLFT=LM W $C(7) D FINISH^VALM4 Q
93 I MOVE?1"<".E D
94 . S VALMLFT=LM
95 E D
96 . S MOVE=$S(MOVE:+MOVE,1:VALMWD-VALM("FIXED"))
97 . S:(VALMLFT-MOVE)<LM MOVE=VALMLFT-VALM("FIXED")-1
98 . S VALMLFT=VALMLFT-MOVE
99 I VALMCC S:VALMWD'<$L($G(VALMHDR(VALM("TM")-3))) VALMBCK="P" D REFRESH^VALM
100 D FINISH^VALM4
101 Q
102GOTO ; -- go to page #
103 N Y,PAGE,LINE
104 S PAGE=$$PAGE^VALM4(VALMCNT,VALM("LINES"))
105 I PAGE=1 S VALMSG="This list only contains 1 page." G GOTOQ
106 S Y=+$P($P(XQORNOD(0),U,4),"=",3)
107 I Y D I $G(VALMSG)]"" G GOTOQ
108 . I Y>PAGE S VALMSG="Too large. Page #"_Y_" does not exist." Q
109 . I Y<1 S VALMSG="Negative page numbers do not exist." Q
110 . S PAGE=Y
111 I 'Y D
112 . N DIR,X,Y,DIRUT
113 . S DIR(0)="NA^1:"_PAGE,DIR("A")="Go to Page (1-"_PAGE_"): "
114 . W ! D ^DIR S PAGE=+Y
115 I PAGE D
116 . S LINE=((PAGE-1)*VALM("LINES"))+1
117 . I LINE=VALMBG S VALMSG="Your selection is the current screen." Q
118 . I LINE'=VALMBG S VALMBG=LINE D:VALMCC LST^VALM4,PAINT^VALM4 D PGUPD^VALM4
119GOTOQ I $G(VALMSG)]"" S VALMSG=$C(7)_VALMSG
120 D FINISH^VALM4
121 Q
Note: See TracBrowser for help on using the repository browser.