/* Bitmap Client - DMS - June 98 - by Sylvain HUET */ /* rev. October 99 - by Sébastien DENEUX (action start added) + FILLbitmap*/ typeof win=ObjWin;; typeof bmp=ObjBitmap;; typeof origbmp=ObjBitmap;; typeof child=I;; var width=0;; var height=0;; typeof last=RSC;; var globname="";; fun downloadBitmaps(l)= if l==nil then _DMSevent this "in" nil nil else let l -> [tete queue] in (_RSCdownload this tete tete nil 3; downloadBitmaps queue;0);; fun IniDMI(param)= if param!=nil then downloadBitmaps lineextr param else nil;; fun destr(a)=_DMSdelete this;; fun _destroyWin(a,b)=_DMSdelete this;; fun _paintWin(w,b)=_BLTbitmap win bmp 0 0;; fun inibmp(doub,clic)= let _GETbitmapSize bmp -> [w h] in let _GETbitmapSize origbmp -> [ww hh] in if doub then _SCPbitmap bmp 0 0 w-1 h-1 origbmp 0 if clic then hh/2 else 0 ww-1 if clic then hh-1 else (hh/2)-1 nil else _SCPbitmap bmp 0 0 w-1 h-1 origbmp 0 0 ww-1 hh-1 nil;; fun _clickWin(a,doub,x,y,i)= inibmp doub 1; _paintWin nil nil;; fun _unclickWin(a,doub,x,y,i)= inibmp doub 0; _paintWin nil nil; _DMSevent this if i==1 then "clickLeft" else "clickRight" nil nil; _DMSevent this strcat globname if i==1 then ".left" else ".right" nil nil;; fun disp(s,z)= let z->[name doub] in (set last=nil; if s==nil then nil else let _LDbitmap _channel _checkpack s -> bmp0 in let if bmp0==nil then _LDjpeg _channel _checkpack s else bmp0 -> newbmp in if newbmp==nil then nil else (_DSbitmap origbmp; set origbmp=newbmp; if child then (inibmp doub 0; 0) else let _GETbitmapSize origbmp -> [w h] in (_DSwindow win; _DSbitmap bmp; set win=_CRwindow _channel DMSwin 10 10 w if doub then h/2 else h WN_MENU+WN_MINBOX name; set bmp=_CRbitmap _channel w if doub then h/2 else h; inibmp doub 0; _CBwinPaint win @_paintWin 0; _CBwinDestroy win @_destroyWin 0; 0); _CBwinClick win @_clickWin doub; _CBwinUnclick win @_unclickWin doub; _paintWin nil nil)); 0;; var globdoub=0;; fun _resizeI(x,s)= let x->[_ x y w h] in if w<1 || h<1 then nil else (_SIZEwindow win w h x y; _DSbitmap bmp; set bmp=_CRbitmap _channel w h; inibmp globdoub 0; _paintWin nil nil; 0);; fun __get(name,file,doub)= set globdoub=doub; set globname=name; if child!=nil then nil else let _DMSgetZone this "bitmap" nil @_resizeI @destr ->[wn x y w h] in if wn==nil then (set child=0) else (set win=_CRwindow _channel wn x y w h WN_CHILDINSIDE|WN_NOCAPTION|WN_NOBORDER name; set bmp=_CRbitmap _channel w h; _FILLbitmap bmp 0; /*black before bitmap is downloaded*/ _CBwinPaint win @_paintWin 0; _CBwinClick win @_clickWin 0; _CBwinUnclick win @_unclickWin 0; set child=1); _RSCabort this last; set last=_RSCdownload this file file mkfun2 @disp [name doub] 3;;