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

XGF.m

Go to the documentation of this file.
  1. XGF ;SFISC/VYD - Graphics Functions ;11/06/2002 11:10
  1. ;;8.0;KERNEL;**269**;Jul 10, 1995
  1. PREP ;prepair graphics environment
  1. D PREP^XGSETUP Q
  1. ;
  1. ;
  1. IOXY(R,C) ;cursor positioning R:row, C:col
  1. D ADJRC
  1. W $$IOXY^XGS(R,C)
  1. S $Y=R,$X=C
  1. Q
  1. ;
  1. ;
  1. SAY(R,C,S,A) ;coordinate output instead of WRITE
  1. D ADJRC
  1. S:C+$L(S)>IOM S=$E(S,1,IOM-C) ;truncate if longer than screen
  1. I $L($G(A)) S A=$$UP^XLFSTR(A) D SAY^XGS(R,C,S,$S($$ATRSYNTX(A):A,1:"")) I 1
  1. E D SAY^XGS(R,C,S)
  1. Q
  1. ;
  1. ;
  1. SAYU(R,C,S,A) ;coordinate output w/ underline instead of WRITE
  1. D ADJRC
  1. I $L($G(A)) S A=$$UP^XLFSTR(A) D SAYU^XGS(R,C,S,$S($$ATRSYNTX(A):A,1:"")) I 1
  1. E D SAYU^XGS(R,C,S)
  1. Q
  1. ;
  1. ;
  1. ADJRC ;adjust row and column R and C are assumed to exist
  1. S R=$S($G(R)="":$Y,1:R),C=$S($G(C)="":$X,1:C) ;use current coords if none are passed
  1. S:"+-"[$E(R) R=$Y+$S(R="+":1,R="-":-1,1:R) ;increment/decrement
  1. S:"+-"[$E(C) C=$X+$S(C="+":1,C="-":-1,1:C)
  1. S R=$S(R<0:0,1:R\1),C=$S(C<0:0,1:C\1) ;make sure only pos int
  1. Q
  1. ;
  1. ;
  1. SETA(XGATR) ;set screen attribute(s) regardless of previous state
  1. ;XGATR=1 char when converted to binary represents all new attr
  1. N XGOLDX,XGOLDY
  1. S XGOLDX=$X,XGOLDY=$Y ;save $X $Y
  1. W $$SET^XGSA(XGATR)
  1. S $X=XGOLDX,$Y=XGOLDY ;restore $X $Y
  1. Q
  1. ;
  1. ;
  1. CHGA(XGATR) ;change screen attribute(s) w/ respect to previous state
  1. ;XGNEWATR=string of attr to change eg. "B0U1" or "E1"
  1. N XGOLDX,XGOLDY,XGSYNTX,XGACODE,%
  1. S XGATR=$$UP^XLFSTR(XGATR) ;make sure all attr codes are in upper case
  1. D:$$ATRSYNTX(XGATR)
  1. . S XGOLDX=$X,XGOLDY=$Y ;save $X $Y
  1. . W $$CHG^XGSA(XGATR)
  1. . S $X=XGOLDX,$Y=XGOLDY ;restore $X $Y
  1. Q
  1. ;
  1. ;
  1. ATRSYNTX(XGATR) ;check attribute code syntax
  1. ;proper attr is 1 or more (char from {BIRGUE} concat w/ 1 or 0)
  1. N XGSYNTX,%
  1. S XGSYNTX=$S($L(XGATR)&($L(XGATR)#2=0):1,1:0) ;even # of chars
  1. F %=1:2:$L(XGATR) S:"B1B0I1I0R1R0G1G0U1U0E1"'[$E(XGATR,%,%+1) XGSYNTX=0
  1. Q XGSYNTX
  1. ;
  1. ;
  1. RESTORE(S) ;restore screen region TOP,LEFT,BOTTOM,RIGHT,SAVE ROOT
  1. D RESTORE^XGSW(S) Q
  1. K @S
  1. ;
  1. ;
  1. SAVE(T,L,B,R,S) ;save screen region TOP,LEFT,BOTTOM,RIGHT,SAVE ROOT
  1. D SAVE^XGSW(T,L,B,R,S) Q
  1. ;
  1. ;
  1. WIN(T,L,B,R,S) ;put up a window TOP,LEFT,BOTTOM,RIGHT[,SAVE ROOT]
  1. ;window style is not yet implemented
  1. I $L($G(S)) D WIN^XGSW(T,L,B,R,S) I 1
  1. E D WIN^XGSW(T,L,B,R)
  1. Q
  1. ;
  1. ;
  1. FRAME(T,L,B,R) ;put a frame without clearing the inside TOP,LEFT,BOTTOM,RIGHT
  1. D FRAME^XGSBOX(T,L,B,R) Q
  1. ;
  1. ;
  1. CLEAR(T,L,B,R) ;clear screen portion TOP,LEFT,BOTTOM,RIGHT
  1. D CLEAR^XGSBOX(T,L,B,R) Q
  1. ;
  1. ;
  1. CLEAN ;clean up and destroy graphics environment
  1. D CLEAN^XGSETUP Q
  1. ;
  1. ;
  1. INITKB(XGTRM) ;initialize keyboard
  1. ;turn escape processing on, turn on passed terminators (if any)
  1. D INIT^XGKB($G(XGTRM)) Q
  1. ;
  1. ;
  1. READ(XGCHARS,XGTO) ;read the keyboard
  1. ;XGCHARS:number of chars to read, XGTO:timeout
  1. Q $$READ^XGKB($G(XGCHARS),$G(XGTO))
  1. ;
  1. ;
  1. RESETKB ;reset keyboard(escape processing off, terminators off)
  1. D EXIT^XGKB Q