/* Nav Window - nov.97 - by Sylvain Huet */ var button1="dms/lib/button1.bmp";; var button2="dms/lib/button2.bmp";; var button3="dms/lib/button3.bmp";; var button3b="dms/lib/button3b.bmp";; struct Nav= [chNav:Chn,winNav:ObjWin,movNav:fun[[I I I] [I I I]] I, bufNav:ObjBitmap,bmp1Nav:ObjBitmap,bmp2Nav:ObjBitmap,bmp3Nav:ObjBitmap, kNav:[I I],vectorNav:[I I I],angularNav:[I I I], refNav:[I I],widthNav:I,heightNav:I,flagNav:I, backcursNav:ObjCursor,frontcursNav:ObjCursor ]mkNav;; var NAV_CHILD=1;; var NAV_RESIZE=2;; var NAV_VERT=4;; var NAV_GAMMA=8;; fun _PaintE(x,b)= _BLTbitmap b.winNav b.bufNav 0 0;; fun _UnclickE(a,b,x,y,button)= set b.vectorNav=set b.angularNav=[0 0 0]; exec b.movNav with [b.vectorNav b.angularNav]; set b.refNav=nil;; fun _ClickE(a,b,x,y,button)= _SETfocus b.winNav ; let if b.flagNav&NAV_VERT then [(b.heightNav - 192)/4 y] else [(b.widthNav - 192)/4 x] -> [l z] in if (mod z 64+l) < l then nil else set b.refNav=[x y];; fun movecurs(b,x,y)= let b.kNav ->[kv ka] in let b.refNav ->[xr yr] in let if b.flagNav&NAV_VERT then [yr*3 b.heightNav b.heightNav*2] else [xr*3 b.widthNav b.widthNav*2] ->[z l1 l2] in (set x=x-xr; set y=yr-y; set b.vectorNav= if z [l z] in if (mod z 64+l) < l then _SETwinCursor b.winNav b.backcursNav else _SETwinCursor b.winNav b.frontcursNav; if b.refNav==nil then nil else (movecurs b x y; exec b.movNav with [b.vectorNav b.angularNav] );; fun _DestroyE(x,b)= _DSbitmap b.bufNav; _DSbitmap b.bmp1Nav; _DSbitmap b.bmp2Nav; _DSbitmap b.bmp3Nav ;; fun calcwin(b)= _FILLbitmap b.bufNav 0; if b.flagNav&NAV_VERT then let (b.heightNav - 192)/4 -> l in (_CPbitmap16 b.bufNav 0 l b.bmp2Nav 0 0 64 64 nil; _CPbitmap16 b.bufNav 0 l+l+64 b.bmp1Nav 0 0 64 64 nil; _CPbitmap16 b.bufNav 0 l+l+l+128 b.bmp3Nav 0 0 64 64 nil ) else let (b.widthNav - 192)/4 -> l in (_CPbitmap16 b.bufNav l 0 b.bmp2Nav 0 0 64 64 nil; _CPbitmap16 b.bufNav l+l+64 0 b.bmp1Nav 0 0 64 64 nil; _CPbitmap16 b.bufNav l+l+l+128 0 b.bmp3Nav 0 0 64 64 nil );; fun _ResizeE(a,b,w,h)= _DSbitmap b.bufNav; set b.bufNav=_CRbitmap b.chNav w h; set b.widthNav=w; set b.heightNav=h; calcwin b; _paintE nil b;; fun iniNav(ch,father,x,y,w,h,title,mov,flag,frontcurs,backcurs)= let _CRwindow ch father x y w h (if flag&NAV_CHILD then WN_CHILDINSIDE|WN_NOCAPTION else WN_MENU+WN_MINBOX)+ (if flag&NAV_RESIZE then WN_SIZEBOX else 0) title -> win in let _CRbitmap ch w h ->buf in let _LDbitmap ch _checkpack button1 ->bmp1 in let _LDbitmap ch _checkpack button2 ->bmp2 in let _LDbitmap ch _checkpack if flag&NAV_GAMMA then button3b else button3 ->bmp3 in let mkNav [ch win mov buf bmp1 bmp2 bmp3 [1 20] nil nil nil w h flag frontcurs backcurs] -> b in (calcwin b; _CBwinDestroy win @_DestroyE b; _CBwinPaint win @_PaintE b; _CBwinSize win @_ResizeE b; _CBwinClick win @_ClickE b; _CBwinUnclick win @_UnclickE b; _CBcursorMove win @_CursorE b; _PaintE nil b; b );; fun setTitleNav(b,s)= _SETwindowName b.winNav s;; fun setInterfNav(b,kv,ka)= set b.kNav=[kv ka];; fun setCBNav(b,mov)= set b.movNav=mov;; fun destroyNav(b)= _DSwindow b.winNav; _DSbitmap b.bufNav; _DSbitmap b.bmp1Nav; _DSbitmap b.bmp2Nav; _DSbitmap b.bmp3Nav;;