/* soundAlert Editor - DMS - Jul. '98 - by Marc BARILLEY */ /* Rev. Aug. '98 - by Marc BARILLEY */ typeof choice=tab [ObjText ObjText ObjButton];; /* alias line */ typeof aliasBanner = ObjText;; typeof filesBanner = ObjText;; typeof editWin = ObjWin;; fun openSound (ob, alias_line, pack)= if pack==nil then nil else let alias_line -> [alias line] in let _PtoScol pack -> fname in let _GETtext alias -> al in { if (strlen al)==0 || (al == nil) then _SETtext alias fname else nil; _SETtext line fname };; fun rflOpenSound (b, alias_line)= let alias_line -> [alias line] in let _GETtext line -> str in let getPathFile str "" -> [dir file] in _DLGrflopen _DLGOpenFile _channel editWin dir nil "Sound (*.wav;*.mid;*.rmi)\0*.wav;*.mid;*.rmi\0\0" @openSound alias_line;; fun onechoice(i,x)= let x -> [w h] in ( _CRtext _channel editWin 5 25+i*25 20 20 ET_ALIGN_CENTER itoa i; let _CReditLine _channel editWin 30 25+i*25 w/2-30 20 ET_DOWN+ET_AHSCROLL "" -> alias in let _CReditLine _channel editWin w/2+5 25+i*25 w/2-40 20 ET_DOWN+ET_AHSCROLL "" -> line in let _CRbuttonBitmap _channel editWin _LDbitmap _channel _checkpack "Dms/admin/soundalert/open.bmp" w-30 25+i*25 25 20 0 -> b in [alias line _CBbutton b @rflOpenSound [alias line]] ) ;; fun createChoice(w, h)= set choice=create_tab 8 @onechoice [w h];; fun onesize (i,w,h)= if i >= 8 then 0 else { let choice.i -> [alias line button] in { _SIZEtext alias w/2-30 20 30 25+i*25; _SIZEtext line w/2-40 20 w/2+5 25+i*25; _SIZEbutton button 25 20 w-30 25+i*25; }; onesize i+1 w h }; 0;; fun rflSizeEditWin (wn, blurp, w, h)= _SIZEtext aliasBanner w/2-30 20 30 5; _SIZEtext filesBanner w/2-40 20 w/2 5; onesize 0 w h; 0;; fun setChoice (l, i)= if l==nil || i>=8 then 0 else let l->[[fi al] n] in let choice.i -> [alias line b] in { _SETtext alias if al==nil then fi else al; _SETtext line fi; setChoice n i+1 };; fun getChoice (l)= if l==nil then nil else let l->[q n] in if !strcmp hd q "alert" then [hd tl q hd tl tl q]::getChoice n else getChoice n;; fun load (l) = setChoice getChoice l 0;; fun saveText(i)= if i==8 then nil else let choice.i -> [alias line b] in let _GETtext alias -> al in let _GETtext line -> li in if 0 == strlen li then saveText i+1 else ("action"::al::nil):: ("event"::al::nil):: ("alert"::li::al::nil):: saveText i+1;; fun save (filename, n)= ("action"::"start"::"start"::nil):: ("action"::"destroy"::"destroy"::nil):: ("event"::"entering"::"entering"::nil):: ("event"::"destroyed"::"destroyed"::nil):: ("rule"::"1"::"SoundAlert"::"1"::"alert"::"2"::"Log"::"1"::"log"::nil):: saveText 0;; fun IniEditor(filename)= let [315 225] -> [w h] in let startEditor _channel nil nil nil w h WN_NORMAL EDITOR_NORMAL filename "dms/admin/soundalert/soundalert.dmc" nil nil @load @save nil -> ed in ( set editWin = getEditWin ed; set aliasBanner = _CRtext _channel editWin 30 5 w/2-30 20 ET_ALIGN_CENTER _locEditor "1290-SOUNDA-alias" nil; set filesBanner = _CRtext _channel editWin w/2 5 w/2-40 20 ET_ALIGN_CENTER _locEditor "1300-SOUNDA-soundfiles" nil; _CBwinSize editWin @rflSizeEditWin 0; createChoice w h; if filename==nil then nil else openDMI ed ); 0;;