/* Listbox Editor - DMS - Aug. '98 - by Marc BARILLEY */ /* Rev. June '01 - by Julien ZORKO */ typeof bannerlbox = ObjText;; typeof lbox = ObjList;; typeof addlbox = ObjButton;; typeof dellbox = ObjButton;; typeof samelbox = ObjCheck;; typeof sendItemsBox = ObjCheck;; typeof elem = [S r1];; typeof editWin = ObjWin;; fun rflEnd (s)= if s==nil then nil else let _GETlist lbox -> [i _] in let if i==nil then 0 else i -> i in { _ADDlist lbox i+1 s; set elem = add_nth_in_list elem i s; }; 0;; fun rflAdd (b, blurp)= /* loc( iniEnterBox _channel editWin 0 0 "Enter an item" @rflEnd "Enter an item";; ) */ iniEnterBox _channel editWin 0 0 (_locEditor "240-LISTBO-enteranite" nil) @rflEnd (_locEditor "240-LISTBO-enteranite" nil);; fun rflDel (b, blurp)= let _GETlist lbox -> [i _] in if i==nil then nil else { _DELlist lbox i; set elem = remove_nth_from_list elem i; };; fun fill (l)= if l==nil then lbox else { _ADDlist lbox _GETlistCount lbox hd l; set elem = listcat elem (hd l)::nil; fill tl l };; fun loadItems (l)= if l==nil then nil else let hd l -> [keyword [p _]] in if !strcmp keyword "item" then p::loadItems tl l else loadItems tl l;; fun load (l) = _SETcheck samelbox atoi getInfo l "same"; let atoi getInfo l "sendItems" -> sendItems in if sendItems == nil then _SETcheck sendItemsBox 1 else _SETcheck sendItemsBox sendItems; _RSTlist lbox; set elem = nil; fill mirror loadItems l; 0;; fun saveItems (l)= if l==nil then nil else ("eventC"::(strcat "click " hd l)::nil):: ("eventC"::(strcat "dclick " hd l)::nil):: ("item"::(hd l)::nil):: saveItems tl l;; fun save (filename, n)= ("action"::"start"::nil):: ("action"::"kill"::nil):: ("action"::"sort"::nil):: ("action"::"del"::nil):: ("action"::"add"::nil):: ("eventC"::"click"::nil):: ("eventC"::"dclick"::nil):: ("event"::"started"::nil):: ("event"::"killed"::nil):: ("zoneC"::"Listbox"::nil):: ("same"::(itoa _GETcheck samelbox)::nil):: ("sendItems"::(itoa _GETcheck sendItemsBox)::nil):: saveItems elem;; fun rflSizeEditWin (wn, blurp, w, h)= _SIZEtext bannerlbox w-10 20 5 0; _SIZElist lbox w-10 h-105 5 25; _SIZEbutton addlbox 70 20 5 h-75; _SIZEbutton dellbox 70 20 w-75 h-75; _SIZEcheck samelbox w-10 20 5 h-50; _SIZEcheck sendItemsBox w-10 20 5 h-25;; fun IniEditor(s)= let [315 175] -> [w h] in let startEditor _channel nil nil nil w h WN_MENU EDITOR_NORMAL s "dms/interf/listbox/listbox.dmc" nil nil @load @save nil -> ed in ( set editWin = getEditWin ed; _CBwinSize editWin @rflSizeEditWin 0; /* loc( set bannerlbox = _CRtext _channel editWin 5 0 w-10 20 ET_ALIGN_LEFT "You may add items to the list at startup :"; ) */ set bannerlbox = _CRtext _channel editWin 5 0 w-10 20 ET_ALIGN_LEFT (_locEditor "1090-LISTBO-youmayaddi" nil); set lbox = _CRlist _channel editWin 5 25 w-10 h-105 LB_DOWN|LB_VSCROLL; /* loc( set addlbox = _CBbutton _CRbutton _channel editWin 5 h-50 70 20 0 "Add" @rflAdd 0; ) */ set addlbox = _CBbutton _CRbutton _channel editWin 5 h-75 70 20 0 (_locEditor "1110-LISTBO-add" nil) @rflAdd 0; /* loc( set dellbox = _CBbutton _CRbutton _channel editWin w-75 h-50 70 20 0 "Del" @rflDel 0; ) */ set dellbox = _CBbutton _CRbutton _channel editWin w-75 h-75 70 20 0 (_locEditor "1120-LISTBO-del" nil) @rflDel 0; /* loc( set samelbox = _CRcheck _channel editWin 5 h-25 w-10 20 0 "Same list for all clients"; ) */ set samelbox = _CRcheck _channel editWin 5 h-50 w-10 20 0 (_locEditor "1130-LISTBO-samelistfo" nil); set sendItemsBox = _CRcheck _channel editWin 5 h-25 w-10 20 0 (_locEditor "SendItemsOnLink" nil); if s==nil then nil else openDMI ed ); 0;;