source: WorldVistAEHR/trunk/r/AUTOMATED_INFO_COLLECTION_SYS-IBD/IBDFU.m@ 1739

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

initial load of WorldVistAEHR

File size: 6.0 KB
Line 
1IBDFU ;ALB/CJM - ENCOUNTER FORM (utilities) ;NOV 16,1992
2 ;;3.0;AUTOMATED INFO COLLECTION SYS;;APR 24, 1997
3 ;
4DRWBOX(IBY,IBX,W,H) ;draws a box
5 I W=1,H N I D Q
6 .D DRWVLINE(IBY+1,IBX,H-2)
7 I H=1,W D DRWSTR(IBY,IBX,$$HLINE(W),"") Q
8 I W<2,H<2 Q
9 I 'IBDEVICE("LISTMAN") S @IBARRAY("BOXES")@((IBY+IBBLK("Y")),(IBX+IBBLK("X")),IBBLK)=W_"^"_H
10 ;if IBDEVICE("PCL") means boxes will be drawn by PCL, via @IBARRAY("BOXES") array
11 Q:IBDEVICE("PCL")
12 D DRWSTR(IBY,IBX,"A"_$$HLINE(W-2,"B")_"C","G")
13 D DRWSTR(IBY+H-1,IBX,"F"_$$HLINE(W-2,"B")_"E","G")
14 D DRWVLINE(IBY+1,IBX,H-2,"|"),DRWVLINE(IBY+1,IBX+W-1,H-2,"|")
15 Q
16HLINE(L,CHAR) ;returns a horizontal line
17 I $G(CHAR)="" S CHAR="_"
18 N LINE S LINE=""
19 S $P(LINE,CHAR,L)=CHAR
20 Q LINE
21DRWVLINE(IBY,IBX,IBH,CHAR) ;draw vertical line
22 N SAVE
23 S SAVE=IBPRINT("COMPILING_BLOCKS")
24 I IBPRINT("COMPILING_BLOCKS") D CMPVLINE Q:'IBPRINT("WRITE_IF_COMPILING") S IBPRINT("COMPILING_BLOCKS")=0
25 N I
26 I $D(CHAR) D
27 .F I=0:1:IBH-1 D DRWSTR(IBY+I,IBX,CHAR)
28 I '$D(CHAR) F I=0:1:IBH-1 D DRWSTR(IBY+I,IBX,"D","G")
29 S IBPRINT("COMPILING_BLOCKS")=SAVE
30 Q
31 ;
32DRWSTR(IBY,IBX,STRING,OPTIONS,IBW) ;
33 ;IBW is the width over which to apply OPTIONS
34 ;OPTIONS - B=bold,G=graphics,U=underline,R=reverse print,r=expanded reverse print,s=shaded(expanded)
35 ;
36 N UNDRLINE,END,ON,OFF,S,CURLINE
37 S OPTIONS=$G(OPTIONS),STRING=$G(STRING)
38 I '$D(IBW) S IBW=$L(STRING)
39 I (IBW'>0)&(STRING="") Q
40 I IBPRINT("COMPILING_BLOCKS") D CMPSTR Q:'IBPRINT("WRITE_IF_COMPILING")
41 S IBY=IBY+IBBLK("Y"),IBX=IBX+IBBLK("X")
42 I IBDEVICE("LISTMAN"),$G(IBTOPLN),$G(IBBOTLN),((IBY<IBTOPLN)!(IBY>IBBOTLN)) Q
43 S (UNDRLINE,ON,OFF)=""
44 ;
45 I OPTIONS'="" D
46 .I OPTIONS["B" S ON=ON_"B1;",OFF=OFF_"B0;"
47 .I IBDEVICE("LISTMAN"),OPTIONS["U",OPTIONS'["R",OPTIONS'["r",OPTIONS'["s" S ON=ON_"U1;",OFF=OFF_"U0;"
48 .I OPTIONS["R" S ON=ON_"R1,"_IBW_";",OFF=OFF_"R0;"
49 .I OPTIONS["s" S ON=ON_"s1,"_IBW_";",OFF=OFF_"S0"
50 .I OPTIONS["r" S ON=ON_"r1,"_IBW_";",OFF=OFF_"R0;"
51 .I OPTIONS["C",IBDEVICE("LISTMAN") S OFF=OFF_$S((OPTIONS["R")!(OPTIONS["r")!(OPTIONS["s"):"R1;",OPTIONS["U":U1,1:"")
52 .I 'IBDEVICE("LISTMAN"),OPTIONS["U",'IBDEVICE("CRT") S UNDRLINE=1
53 I IBX+$L(STRING)>251 S STRING=$E(STRING,1,251-IBX)
54 I IBX+IBW>251 S IBW=251-IBX
55 ;
56 ;for laser printing - NOT used presently
57 ;I '$G(IBDEVICE("LISTMAN")),$G(IBDEVICE("RASTER")) D Q
58 ;.I ON'="" W ON
59 ;.S DX=IBX,DY=IBY X IOXY
60 ;.W $J($G(STRING),+IBW) I OFF'="" W OFF
61 ;.I UNDRLINE N ARY S ARY="ARY",ARY(IBY,IBX)=$$HLINE(IBW) D RASPRINT^IBDF2F(.ARY)
62 ;
63 I '$G(IBDEVICE("LISTMAN")) D Q
64 .I OPTIONS["G",IBDEVICE("GRAPHICS") S @IBARRAY("GRAPHICS")@(IBY,IBX)=STRING Q
65 .I OPTIONS["G" S STRING=$$GRPHCS(STRING)
66 .S END=IBX+IBW-1
67 .I UNDRLINE D UNDRLINE(IBY,IBX,IBW)
68 .I STRING'="" D
69 ..S CURLINE=$G(@IBARRAY("TEXT")@(IBY))
70 ..S:CURLINE="" CURLINE=$J("",IBFORM("WIDTH"))
71 ..S CURLINE=$$PADRIGHT($E(CURLINE,1,IBX),IBX)_STRING_$E(CURLINE,IBX+1+$L(STRING),IBFORM("WIDTH"))
72 ..S @IBARRAY("TEXT")@(IBY)=CURLINE
73 .I ON'="" S @IBARRAY("CONTROLS")@(IBY,IBX)=$G(@IBARRAY("CONTROLS")@(IBY,IBX))_ON,@IBARRAY("CONTROLS")@(IBY,END+1)=$G(@IBARRAY("CONTROLS")@(IBY,END+1))_OFF
74 ;
75 I $G(IBDEVICE("LISTMAN")) D
76 .I OPTIONS["G" S STRING=$$GRPHCS(STRING)
77 .S CURLINE=$G(@VALMAR@(IBY+1,0))
78 .I CURLINE="" S CURLINE=$J((IBY#1000)+1,3,0)_$J("",IBFORM("WIDTH")) D CNTRL^VALM10(IBY+1,4,1,IORVON,IORVOFF) I (IBY+1)>VALMCNT S VALMCNT=(IBY+1)
79 .S CURLINE=$$PADRIGHT($E(CURLINE,1,IBX+4),IBX+4)_STRING_$E(CURLINE,IBX+5+$L(STRING),IBFORM("WIDTH")+5)
80 .S @VALMAR@(IBY+1,0)=CURLINE
81 .I ON]"" D CNTRL^VALM10(IBY+1,IBX+5,IBW,$$CTRLS(ON),$$CTRLS(OFF))
82 Q
83UNDRLINE(IBY,IBX,W) ; underlining with when not using printers underlining ability
84 N LINE
85 S LINE=$G(@IBARRAY("UNDERLINES")@(IBY))
86 S LINE=$$PADRIGHT($E(LINE,1,IBX),IBX)_$$HLINE(W,"_")_$E(LINE,IBX+W+1,IBFORM("WIDTH"))
87 S @IBARRAY("UNDERLINES")@(IBY)=LINE
88 Q
89PADRIGHT(STR,LEN) ; pad right
90 N B S STR=$E(STR,1,LEN)
91 S:LEN>255 LEN=255
92 S:LEN'=$L(STR) $P(B," ",LEN-$L(STR))=" "
93 Q STR_$G(B)
94 ;
95STRIP(STR) ;strips off leading and trailing spaces
96 N I
97 F I=1:1:$L(STR) I $A(STR,I)>32 Q
98 S STR=$E(STR,I,$L(STR))
99 F I=$L(STR):-1:1 I $A(STR,I)>32 Q
100 S STR=$E(STR,1,I)
101 Q STR
102 ;
103CMPSTR ;saves compiled string write
104 S IBWRTCNT("S")=IBWRTCNT("S")+1
105 S ^IBE(357.1,IBBLK,"S",IBWRTCNT("S"),0)=IBY_"^"_IBX_"^"_OPTIONS_"^"_IBW_"^"_STRING
106 Q
107CMPVLINE ;save compiled vertical line write
108 S IBWRTCNT("V")=IBWRTCNT("V")+1
109 S ^IBE(357.1,IBBLK,"V",IBWRTCNT("V"),0)=IBY_"^"_IBX_"^"_IBH_"^"_$G(CHAR)
110 Q
111CTRLS(CTRLS,IBX,IBY) ;returns the needed escape sequences
112 N I,X,RET,P1,P2 S RET=""
113 F I=1:1 S X=$P(CTRLS,";",I) Q:X="" D
114 .S P1=$P(X,","),P2=$P(X,",",2)
115 .;
116 .I 'IBDEVICE("PCL"),'IBDEVICE("LISTMAN") S P1=$TR(P1,"RrSs","UUUU")
117 .;
118 .;reverse printing is tricky - must draw a rectangle with black fill
119 .;
120 .I IBDEVICE("PCL"),P1="R1",$D(IBX),$D(IBY) W $C(27)_"&f0S",!,$C(27)_"&a"_IBY_"r"_(IBX+.05)_"C",$C(27)_"&a-1R",$C(27)_"*p+10Y",$C(27)_"*c"_(IBDEVICE("COL_WIDTH")*(+P2)-3)_"h"_((IBDEVICE("ROW_HT")-10))_"v0P",$C(27)_"&f1S"
121 .I IBDEVICE("PCL"),P1="r1",$D(IBX),$D(IBY) W $C(27)_"&f0S",!,$C(27)_"&a"_IBY_"r"_(IBX-.5)_"C",$C(27)_"&a-1.005R",$C(27)_"*p+10Y",$C(27)_"*c"_(IBDEVICE("COL_WIDTH")*(+P2+1))_"h"_((IBDEVICE("ROW_HT")-10))_"v0P",$C(27)_"&f1S"
122 .;
123 .;test of dark gray
124 .;I IBDEVICE("PCL"),P1="r1",$D(IBX),$D(IBY) D
125 .;.W $C(27)_"*c70G",$C(27)_"&f0S",!,$C(27)_"&a"_IBY_"r"_(IBX-.5)_"C",$C(27)_"&a-1.005R",$C(27)_"*p+10Y",$C(27)_"*c"_(IBDEVICE("COL_WIDTH")*(+P2+1))_"h"_((IBDEVICE("ROW_HT")-10))_"v2P",$C(27)_"&f1S",$C(27)_"*c35G"
126 .;
127 .I IBDEVICE("PCL"),P1="s1",$D(IBX),$D(IBY) D
128 ..W $C(27)_"*c11G",$C(27)_"&f0S",!,$C(27)_"&a"_IBY_"r"_(IBX-.5)_"C",$C(27)_"&a-1.005R",$C(27)_"*p+10Y",$C(27)_"*c"_(IBDEVICE("COL_WIDTH")*(+P2+1))_"h"_((IBDEVICE("ROW_HT")-10))_"v2P",$C(27)_"&f1S",$C(27)_"*c35G"
129 .;
130 .S RET=RET_$S(P1="B0":IOINORM,P1="B1":IOINHI,P1="U0":IOUOFF_IOINORM,P1="U1":IOUON,P1="G1":IOG1,P1="G0":IOG0,(P1="R1")!(P1="r1"):IORVON,P1="R0":IORVOFF,IBDEVICE("LISTMAN")&(P1="s1"):IORVON,IBDEVICE("LISTMAN")&(P1="S0"):IORVOFF,1:"")
131 Q RET
132 ;
133GRPHCS(GRPHCS) ;returns the needed graphics characters
134 N I,X,RET S RET=""
135 F I=1:1 S X=$E(GRPHCS,I) Q:X="" S RET=RET_$S(X="A":IOTLC,X="B":IOHL,X="C":IOTRC,X="D":IOVL,X="E":IOBRC,X="F":IOBLC,1:"")
136 Q RET
Note: See TracBrowser for help on using the repository browser.