home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lifeos2.zip / LIFE-1.02 / DEMO / XTOOLS_U.LF < prev   
Text File  |  1996-06-04  |  2KB  |  67 lines

  1. % FILE. . . . . /usr/local-europa/hak/life/xtools_utils.lf
  2. % EDIT BY . . . Hassan Ait-Kaci
  3. % ON MACHINE. . Europa
  4. % STARTED ON. . Mon Apr 18 16:18:14 1994
  5.  
  6. % Last modified on Wed Nov 16 19:56:34 1994 by Hak
  7.  
  8. module("xtools_utils") ?
  9. public(frame_box,padded_box,fancy_text_box,reset_text,reset_state,
  10.        play, strcat) ?
  11.  
  12. import("xtools") ?
  13.  
  14. frame_box(B,padding=>P) -> frame
  15.     containing
  16.       vc_list [v_box(P),
  17.            hc_list [h_box(P),B,h_box(P)],
  18.            v_box(P)].
  19.  
  20. padded_box(B,padding=>P) -> box
  21.     containing
  22.       vc_list [v_box(P),
  23.            hc_list [h_box(P),B,h_box(P)],
  24.            v_box(P)].
  25.  
  26. fancy_text_box(text => Text:string,
  27.            font => F,
  28.            colors => Colors:list) -> hc_list
  29.     map2wrap(make_box(font=>F),str2list(Text),Colors).
  30.  
  31. make_box(Char,Color,font=>F) -> text_box(text=>Char,
  32.                      font_id=>F,
  33.                      text_color_id=>Color).
  34.  
  35. map2wrap(F,L1:list,L2:list) -> map2w(F,L1,L2,L2).
  36.  
  37. map2w(F,[],list,list) -> [].
  38. %%% MJV 17-08-95: Added the following to avoid holes in the coloring, due
  39. %%% to spaces.
  40. map2w(F,[" "|T1],L1:[H2|T2],L2:list) -> [F(" ",H2)|map2w(F,T1,L1,L2)].
  41. map2w(F,[H1|T1],[H2|T2],L:list) -> [F(H1,H2)|map2w(F,T1,T2,L)].
  42. map2w(F,[H1|T1],[],L:[H2|T2]) -> [F(H1,H2)|map2w(F,T1,T2,L)].
  43.  
  44. str2list("") -> [].
  45. str2list(S:string) -> [substr(S,1,1)|str2list(substr(S,2,strlen(S)))].
  46.  
  47. reset_text(B:@(text => T),Text) :- T <<- Text, refresh_look(B).
  48.  
  49. reset_state(B:@(frame_state => S),State) :- S <<- State, refresh_look(B).
  50.  
  51.  
  52. %% play actually plays a soundfile at a certain volume (85 by default)
  53. %% set play to true if no audio is available.
  54.  
  55. play.
  56.  
  57. %play :- !.
  58. %play(S:string, N:{85; int}) :- !,
  59. %    @ = system(strcat("rsh muenster /usr/bin/audioplay -v ", psi2str(N),
  60. %              " /usr/home/demo/Life/Demo/Sounds/", S, ".au &")).
  61.  
  62. S:strcat -> strcat2(feature_values(S)).
  63.     
  64. strcat2([H|T]) -> strcon(H, strcat2(T)).
  65. strcat2([]) -> "".
  66.  
  67.