/* Module EXPOPHOTO version 1.0 february 2004 */ /* part Editor, by iri : info@irizone.net */ /* rev 1.1 - by iri - march 2004 - fixes bugs */ typeof editWin = ObjWin;; typeof ll = ObjListTab;; typeof oldpath = S;; typeof links = [[S S S] r1];; typeof addbut = ObjButton;; typeof delbut = ObjButton;; typeof currentSel = I;; fun _paintWn(w, b) = _BLTbitmap w b 0 0;; fun _endWn(w, b) = _DSbitmap b;; fun updatel2 (l, i)= if l == nil then ll else let hd l -> [alias file title] in { _ADDlistTabItem ll i i file; _SETlistTabItem ll i 1 alias; _SETlistTabItem ll i 2 title; updatel2 tl l i+1; };; fun updatel ()= _RSTlistTab ll; updatel2 links 0;; fun addr2(t, p)= let p -> [s [name w b]] in ( _DSwindow w; _DSbitmap b; set links = listcat links [s name t]::nil; updatel; 0 );; fun addr(s, p)= let p -> [name w b] in if s == nil then ( _DSwindow w; _DSbitmap b; nil ) else iniEnterBox _channel w 100 150 (_locEditor "NEW_BMP" nil) mkfun2 @addr2 [s p] (_locEditor "ENTER_TITLE" nil); 0;; fun _OpenBmp(d, b, s)= let _PtoScol s -> name in if name == nil then nil else ( let getPathFile name "" -> [dir _] in set oldpath=dir; let _LDbitmap _channel s -> bmp0 in let if bmp0 == nil then _LDjpeg _channel s else bmp0 -> newbmp in if newbmp == nil then (_DLGMessageBox _channel editWin (_locEditor "WARNING" nil) (_locEditor "NOBMP" nil) 0;nil) else let _GETbitmapSize newbmp -> [w h] in let _CRwindow _channel editWin 10 10 w h WN_MENU+WN_MINBOX name -> win2 in (_CBwinPaint win2 @_paintWn newbmp; _CBwinDestroy win2 @_endWn newbmp; _paintWn win2 newbmp; if b then nil else iniEnterBox _channel win2 100 150 (_locEditor "NEW_BMP" nil) mkfun2 @addr [name win2 newbmp] (_locEditor "ENTER_ALIAS" nil); 0));; fun _add(a, b)= _DLGrflopen _DLGOpenFile _channel editWin oldpath nil "bitmap (*.bmp,*.jpg)\0*.BMP;*.JPG\0\0" @_OpenBmp 0;; fun _del(x, b)= if currentSel == nil then nil else let nth_list links currentSel -> a in (set links = remove_from_list links a; updatel);; fun rflSelectLL (lb, blurp, id)= set currentSel = id;; fun rflDClickLL (lb, blurp, id, i)= let nth_list links id -> [a p _] in _OpenBmp nil 1 _checkpack p;; fun rflSizeEditWin (wn, p, w, h)= _SIZElistTab ll w/2-5 h-60 5 30; _SIZEbutton addbut (w-15)/2 20 5 h-25; _SIZEbutton delbut (w-15)/2 20 ((w-15)/2)+5 h-25; if currentSel==nil then nil else rflSelectLL nil 0 currentSel;; fun suppevent(l)= if l==nil then nil else let l->[[a b c] n] in ("action"::a::nil):: ("bmp"::a::b::c::nil):: ("eventC"::(strcat a ".left")::nil):: ("eventC"::(strcat a ".right")::nil):: suppevent n;; fun listbmp(l)= if l==nil then nil else let l->[[_ b _] n] in b::listbmp n;; fun save (filename, n)= ("registerF"::listbmp links):: ("action"::"destroy"::"destroy"::nil):: ("action"::"start"::"start"::nil):: ("eventC"::"in"::nil):: ("eventC"::"clickLeft"::nil):: ("eventC"::"clickRight"::nil):: ("zoneC"::"bitmap"::nil):: suppevent links;; fun fdlink(a, b)= if strcmp hd a "bmp" then 0 else let a->[_ [x[y[z _]]]] in (set links=listcat links [x y z]::nil; 0);; fun load (l) = set links = nil; apply_on_list l @fdlink 0; updatel; 0;; fun IniEditor(s)= let [315 220] -> [w h] in let startEditor _channel nil nil nil w h WN_MENU EDITOR_NORMAL s "dms/tools/expophoto/expophoto.dmc" nil nil @load @save nil -> ed in ( set editWin = getEditWin ed; set ll = _CRlistTab _channel editWin 5 5 w-10 h-35 LV_DOWN|LV_SINGLESEL; _ADDlistTabColumn ll 0 (w-10)/3 ET_ALIGN_CENTER (_locEditor "BITMAP" nil); _ADDlistTabColumn ll 1 (w-10)/3 ET_ALIGN_CENTER (_locEditor "ALIAS" nil); _ADDlistTabColumn ll 2 (w-10)/3 ET_ALIGN_CENTER (_locEditor "TITLE" nil); set addbut = _CBbutton _CRbutton _channel editWin 5 h-25 (w-15)/2 20 0 (_locEditor "ADD" nil) @_add 0; set delbut = _CBbutton _CRbutton _channel editWin ((w-15)/2)+5 h-25 (w-15)/2 20 0 (_locEditor "DEL" nil) @_del 0; _CBwinSize editWin @rflSizeEditWin 0; _CBlistTabSelect ll @rflSelectLL 0; _CBlistTabDClick ll @rflDClickLL 0; if s==nil then nil else openDMI ed ); 0;;