Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XGS

XGS.m

Go to the documentation of this file.
  1. XGS ;SFISC/VYD - SCREEN PRIMITIVES ;03/16/95 11:00
  1. ;;8.0;KERNEL;;Jul 10, 1995
  1. SAY(R,C,S,A) ;use this for coordinate output instead of WRITE
  1. ;output to screen and update virtual screen (XGSCRN)
  1. ;params: Row (0-IOSL),Col (0-IOM),string,
  1. ;scrn attrib ie. I1R0B1 (optional)
  1. N XGSAVATR,XGESC,XGOUTPUT ;save attribute,escape str,output stream
  1. N %
  1. ;set output stream to either XGSCRN (virtual screen) or some window
  1. S XGOUTPUT=$S($G(XGFLAG("PAINT"),21)=21:"XGSCRN",1:$NA(^TMP("XGS",$J,XGW1)))
  1. S XGSAVATR=XGCURATR ;preserve current attribute to restore later
  1. S $X=C+$L(S)
  1. S XGESC=$S($L($G(A)):$$CHG^XGSA(A),1:"")
  1. S $E(@XGOUTPUT@(R,0),(C+1),$X)=S
  1. S $E(@XGOUTPUT@(R,1),(C+1),$X)=$TR($J("",$L(S))," ",XGCURATR)
  1. ;S $P(%,XGCURATR,$L(S)+1)="",$E(@XGOUTPUT@(R,1),(C+1),$X)=%
  1. I XGOUTPUT="XGSCRN" D I 1 ;if screen painting is to occur
  1. . ;output string in a proper place in proper attribute and restore attr
  1. . ;W $$IOXY(R,C)_XGESC_S_$S($L($G(A)):$$SET^XGSA(XGSAVATR),1:"")
  1. . W $$IOXY(R,C)_XGESC_S_$S(XGSAVATR'=XGCURATR:$$SET^XGSA(XGSAVATR),1:"")
  1. . S $Y=R,$X=C+$L(S)-1
  1. E S XGCURATR=XGSAVATR
  1. Q
  1. ;
  1. ;
  1. SAYU(R,C,S,A) ;use this for coordinate output instead of WRITE
  1. ;output to screen and update virtual screen (XGSCRN)
  1. ;params: Row (0-IOSL),Col (0-IOM),string,
  1. ;scrn attrib ie. I1R0B1 (optional)
  1. N XGSAVATR,XGESC,XGOUTPUT ;save attribute,escape str,output stream
  1. N %,%S,P,P1,P2,X ;P1:piece before &, P2:piece from & to the end
  1. N XGATR
  1. ;set output stream to either XGSCRN (virtual screen) or some window
  1. S XGOUTPUT=$S($G(XGFLAG("PAINT"),21)=21:"XGSCRN",1:$NA(^TMP("XGS",$J,XGW1)))
  1. S P=$L(S,"&&")
  1. F %=1:1:P S $P(X,$C(1),%)=$P(S,"&&",%) ;replace all && with $C(1)
  1. I X["&",$G(A)'["U1",'$$STAT^XGSA("U")!($G(A)["U0") D I 1
  1. . S XGSAVATR=XGCURATR ;preserve current attribute to restore later
  1. . S XGESC=$S($L($G(A)):$$CHG^XGSA(A),1:"")
  1. . S XGATR=XGCURATR ;get pre-underline attributes
  1. . S $X=C+$L(X)-1 ;adjust for a single &, which is not printable
  1. . ;S $E(XGSCRN(R,0),(C+1),$X)=$TR($TR(X,"&",""),$C(1),"&")
  1. . S $E(@XGOUTPUT@(R,0),(C+1),$X)=$TR($P(X,"&")_$P(X,"&",2,999),$C(1),"&")
  1. . S $E(@XGOUTPUT@(R,1),(C+1),$X)=$TR($J("",$X-C)," ",XGCURATR)
  1. . S P1=$TR($P(X,"&"),$C(1),"&"),P2=$TR($P(X,"&",2,999),$C(1),"&")
  1. . S %S=P1_$$CHG^XGSA("U1")_$E(P2) ;preunderline_underlinechar
  1. . S $E(@XGOUTPUT@(R,1),(C+1+$L(P1)))=XGCURATR ;record underlinechar
  1. . ;S %S=%S_$$CHG^XGSA("U0")_$E(P2,2,999) ;%S_postunderline
  1. . S %S=%S_$$SET^XGSA(XGATR)_$E(P2,2,999) ;%S_postunderline
  1. . I XGOUTPUT="XGSCRN" D I 1
  1. . . ;output string in a proper place in proper attribute and restore attr
  1. . . ;W $$IOXY(R,C)_XGESC_%S_$S($L($G(A)):$$SET^XGSA(XGSAVATR),1:"")
  1. . . W $$IOXY(R,C)_XGESC_%S_$S(XGCURATR'=XGSAVATR:$$SET^XGSA(XGSAVATR),1:"")
  1. . . S $Y=R,$X=C+$L(X)-2
  1. . E S XGCURATR=XGSAVATR
  1. E D SAY(R,C,$TR(S,"&"),A):$D(A),SAY(R,C,$TR(S,"&")):'$D(A)
  1. Q
  1. ;
  1. ;
  1. IOXY(R,C) ;cursor positioning WRITE argument instead of execute
  1. ;Row,Col
  1. Q $C(27,91)_((R+1))_$C(59)_((C+1))_$C(72)