/* Stats Editor - DMS - feb 98 - by Sylvain HUET */ /* Rev. Aug. '98 - by Marc BARILLEY */ typeof choice=tab [ObjText ObjBox];; typeof statfile=ObjText;; typeof aeBanner =ObjText;; typeof buttonfile = ObjButton;; typeof editWin = ObjWin;; fun getPatt(l)= if l==nil then nil else let l->[q n] in if !strcmp hd q "stat" then ([hd tl q hd tl tl q])::getPatt n else getPatt n;; fun getText(i)= if i==8 then nil else let choice.i -> [tx c] in let _GETtext tx -> s in let if s==nil || (strlen s)==0 then "*" else s -> patt in ("action"::(strcatn "in"::(itoa i)::"_"::patt::nil)::nil):: /* ("event"::(strcatn "out_"::(itoa i)::"_"::patt::nil)::nil):: */ ("stat"::patt::(let _GETcombo c ->[_ m] in m)::nil)::getText i+1;; fun setChoice(l,i)= if l==nil || i>=8 then 0 else let l->[[a b] n] in let choice.i -> [tx c] in (_SETtext tx a; _SSELcombo c b; setChoice n i+1);; fun onechoice(i,x)= let x -> [w h] in ( _CRtext _channel editWin 5 55+i*25 22 15 ET_ALIGN_CENTER itoa i; let _CRcombo _channel editWin w-85 55+i*25 80 150 CB_NOEDIT "" -> c in ( _ADDcombo c 1000 "max"; /* (_ADDcombo c 1000 (_locEditor "390-STATSE-max" nil);*/ _ADDcombo c 1000 "min"; /* _ADDcombo c 1000 (_locEditor "400-STATSE-min" nil);*/ _ADDcombo c 1000 "average"; /* _ADDcombo c 1000 (_locEditor "410-STATSE-average" nil);*/ _ADDcombo c 1000 "count"; /* _ADDcombo c 1000 (_locEditor "420-STATSE-count" nil);*/ _ADDcombo c 1000 "last value"; /* _ADDcombo c 1000 (_locEditor "430-STATSE-lastvalue" nil);*/ _ADDcombo c 1000 "sum"; /* _ADDcombo c 1000 (_locEditor "440-STATSE-sum" nil);*/ [_CReditLine _channel editWin 26 55+i*25 w-115 22 ET_DOWN+ET_AHSCROLL "" c] ) );; 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 -> [line combo] in { _SIZEtext line w-115 23 26 55+i*25; _SIZEcombo combo 80 150 w-85 55+i*25; }; onesize i+1 w h; };; fun rflSizeEditWin (wn, blurp, w, h)= _SIZEtext statfile w-95 20 60 5; _SIZEbutton buttonfile 25 20 w-30 5; _SIZEtext aeBanner w-10 20 5 35; onesize 0 w h;; fun _OpenStat(d,b,s)= let _PtoScol s -> name in if name==nil then nil else _SETtext statfile name;; fun browse (x,b)= let getPathFile _GETtext statfile "" -> [dir _] in _DLGrflopen _DLGOpenFile _channel editWin dir nil "Stat File (*.txt)\0*.txt\0\0" @_OpenStat 0;; fun load (l) = _SETtext statfile getInfo l "file"; setChoice getPatt l 0;; fun save (filename, n)= ("file"::(_GETtext statfile)::nil):: ("action"::"show"::"show"::nil):: ("action"::"hide"::"hide"::nil):: ("event"::"shown"::"shown"::nil):: ("event"::"hidden"::"hidden"::nil):: ("zone"::"Stats"::nil):: ("zoneC"::"Stats"::nil):: getText 0;; fun IniEditor(s)= let [315 260] -> [w h] in let startEditor _channel nil 0 0 w h WN_NORMAL EDITOR_NORMAL s "dms/admin/stats/stats.dmc" nil nil @load @save nil -> ed in ( set editWin = getEditWin ed; /* loc( _CRtext _channel editWin 5 5 50 20 ET_ALIGN_RIGHT "Stats File"; ) */ _CRtext _channel editWin 5 5 50 20 ET_ALIGN_RIGHT (_locEditor "1100-STATSE-statsfile" nil); set statfile=_CReditLine _channel editWin 60 5 w-95 20 ET_DOWN+ET_AHSCROLL nil; set buttonfile = _CBbutton _CRbuttonBitmap _channel editWin _LDbitmap _channel _checkpack "Dms/admin/stats/open.bmp" w-30 5 25 20 0 @browse 0; /* loc( set aeBanner = _CRtext _channel editWin 5 35 w-10 20 ET_ALIGN_CENTER "Actions - Events"; ) */ set aeBanner = _CRtext _channel editWin 5 35 w-10 20 ET_ALIGN_CENTER (_locEditor "1130-STATSE-actions-ev" nil); createChoice w h; _CBwinSize editWin @rflSizeEditWin 0; if s==nil then nil else openDMI ed ); 0;;