/****************************************************************************/ /* Slide Bar written by Marc BARILLEY */ /****************************************************************************/ /* SLB_New */ /* SLB_Del */ /* SLB_SetPrecisionStep [SlideBar F] SlideBar */ /* sets the step for buttons */ /* SLB_SetMax [SlideBar F] SlideBar */ /* sets the upper limit of the scale */ /* SLB_SetMin [SlideBar F] SlideBar */ /* sets the lower limit of the scale */ /* SLB_SetLeft [SlideBar F] SlideBar */ /* sets the position for the left cursor */ /* SLB_SetRight [SlideBar F] SlideBar */ /* sets the position for the right cursor */ /* SLB_SetPrecisionMark [SlideBar I] SlideBar */ /* indicates how many decimals are to be shown */ /* SLB_SetClickReflex */ /* SLB_GetObject */ /* SLB_ChangeDisplayFlags */ /* SLB_ChangeCoordinates */ /* SLB_GetCoordinates */ /****************************************************************************/ /* librairy used: _jint2D _jobj2dlib.pkg */ /****************************************************************************/ /* les differents etats des boutons et barre */ var VSLB_STATE_OFF =0;; /* off */ var VSLB_STATE_RO =1;; /* highlight */ var VSLB_STATE_ON =2;; /* pushed */ /* SliderBar: VSLBObj2D: l'objet 2D associe VSLBbitmap: bitmap contenant les differents etats de la slidebar VSLBcoords: liste des coordonnees des differents etats de la slidebar VSLBwork : bitmap de travail de la slidebar VSLBflags : les flags de la slidebar VSLBstate: etat de la slidebar VSLBtransparency: couleur de transparence VSLBClickReflex: reflexe utilisateur lors du clic sur la slidebar */ /* struct VSlideBar =[ VSLBchannel : Chn, VSLBObj2D : Obj2D, VSLBbitmap : ObjBitmap, VSLBwork : ObjBitmap, VSLBleftOffset : I, VSLBbarOffset : I, VSLBrightOffset : I, VSLBcursorOffset : I, VSLBbarWidth : I, VSLBcursorWidth : I, VSLBflags : I, VSLBleftState : I, VSLBbarState : I, VSLBrightState : I, VSLBcursorState : I, VSLBtransp : I, VSLBvalue : F, VSLBcursorPos : I, VSLBmini : F, VSLBmaxi : F, VSLBstep : F, VSLBtimer : Timer, VSLBClickReflex : fun [VSlideBar F] VSlideBar ] MkVSlideBar;; */ /*****************************************************************************/ /* Fonctions Internes de la slidebar */ /*****************************************************************************/ /* renvoie les coordonnees de l'etat de la slidebar dans la bitmap globale */ fun rectLeftVSLB (slidebar)= if slidebar.VSLBleftState==VSLB_STATE_RO then [ slidebar.VSLBObj2D.O2Dw slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBbarOffset-slidebar.VSLBleftOffset ] else if slidebar.VSLBleftState==VSLB_STATE_ON then [ 2*slidebar.VSLBObj2D.O2Dw slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBbarOffset-slidebar.VSLBleftOffset ] else [ 0 slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBbarOffset-slidebar.VSLBleftOffset ] ;; fun rectBarVSLB (slidebar)= if slidebar.VSLBbarState==VSLB_STATE_RO then [ slidebar.VSLBObj2D.O2Dw slidebar.VSLBbarOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBrightOffset-slidebar.VSLBbarOffset ] else if slidebar.VSLBbarState==VSLB_STATE_ON then [ 2*slidebar.VSLBObj2D.O2Dw slidebar.VSLBbarOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBrightOffset-slidebar.VSLBbarOffset ] else [ 0 slidebar.VSLBbarOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBrightOffset-slidebar.VSLBbarOffset ] ;; fun rectRightVSLB (slidebar)= if slidebar.VSLBrightState==VSLB_STATE_RO then [ slidebar.VSLBObj2D.O2Dw slidebar.VSLBrightOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset-slidebar.VSLBrightOffset ] else if slidebar.VSLBrightState==VSLB_STATE_ON then [ 2*slidebar.VSLBObj2D.O2Dw slidebar.VSLBrightOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset-slidebar.VSLBrightOffset ] else [ 0 slidebar.VSLBrightOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset-slidebar.VSLBrightOffset ] ;; fun rectCursorVSLB (slidebar)= if slidebar.VSLBcursorState==VSLB_STATE_RO then [ slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorWidth ] else if slidebar.VSLBcursorState==VSLB_STATE_ON then [ 2*slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorWidth ] else [ 0 slidebar.VSLBcursorOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorWidth ] ;; fun inCursorVSLB (slidebar, mx, my)= (my >= slidebar.VSLBObj2D.O2Dy+slidebar.VSLBcursorPos) && (my <= slidebar.VSLBObj2D.O2Dy+slidebar.VSLBcursorPos+slidebar.VSLBcursorWidth);; fun inLeftVSLB (slidebar, mx, my)= (my >= slidebar.VSLBObj2D.O2Dy+slidebar.VSLBleftOffset) && (my <= slidebar.VSLBObj2D.O2Dy+slidebar.VSLBbarOffset);; fun inBarVSLB (slidebar, mx, my)= (my >= slidebar.VSLBObj2D.O2Dy+slidebar.VSLBbarOffset) && (my <= slidebar.VSLBObj2D.O2Dy+slidebar.VSLBrightOffset);; fun inRightVSLB (slidebar, mx, my)= (my >= slidebar.VSLBObj2D.O2Dy+slidebar.VSLBrightOffset) && (my <= slidebar.VSLBObj2D.O2Dy+slidebar.VSLBcursorOffset);; /* Methode Paint*/ fun PaintVSLB (slidebar)= [slidebar.VSLBwork 0 0 slidebar.VSLBObj2D.O2Dw slidebar.VSLBObj2D.O2Dh slidebar.VSLBtransp];; /* Methode Paint Part */ fun PaintPartOfVSLB (area, slidebar)= let IntersectionRectangle area MkRectangle2D [ MkInt2DPoint [0 0] MkInt2DPoint [slidebar.VSLBObj2D.O2Dw slidebar.VSLBObj2D.O2Dh] ] -> rect in let SizeRectangle rect -> [rw rh] in [ slidebar.VSLBwork rect.RctHG.iptX rect.RctHG.iptY rw rh slidebar.VSLBtransp ];; /* Methode IsMouseOnObject */ fun IsMouseOnVSLB (mx, my, slidebar)= let slidebar.VSLBObj2D -> obj in _GETpixel16 slidebar.VSLBwork mx-obj.O2Dx+obj.O2Dw my-obj.O2Dy;; /* Methode Move Out Object*/ fun MoveOutVSLB (mx, my, mousebuttons, slidebar)= _deltimer slidebar.VSLBtimer; set slidebar.VSLBleftState = VSLB_STATE_OFF; set slidebar.VSLBbarState = VSLB_STATE_OFF; set slidebar.VSLBrightState = VSLB_STATE_OFF; set slidebar.VSLBcursorState = VSLB_STATE_OFF; _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBleftOffset slidebar.VSLBbitmap 0 slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset slidebar.VSLBtransp; let rectCursorVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBcursorPos slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; O2D_RedrawObj slidebar.VSLBObj2D; 1;; /* Methode Move Out object with button pushed */ fun MoveOutPushedVSLB (mx, my, mb, slidebar)= _deltimer slidebar.VSLBtimer; set slidebar.VSLBleftState = VSLB_STATE_OFF; set slidebar.VSLBbarState = VSLB_STATE_OFF; set slidebar.VSLBrightState = VSLB_STATE_OFF; set slidebar.VSLBcursorState = VSLB_STATE_OFF; _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBleftOffset slidebar.VSLBbitmap 0 slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset slidebar.VSLBtransp; let rectCursorVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBcursorPos slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; O2D_RedrawObj slidebar.VSLBObj2D; 1;; /* Methode Move In object with button pushed */ fun MoveInPushedVSLB (mousecol, mouselgn, mousebuttons, slidebar)= 1;; /* Methode Click Out */ fun ClickOutVSLB (mousecol, mouselgn, mousebuttons, slidebar)= _deltimer slidebar.VSLBtimer; set slidebar.VSLBleftState = VSLB_STATE_OFF; set slidebar.VSLBbarState = VSLB_STATE_OFF; set slidebar.VSLBrightState = VSLB_STATE_OFF; set slidebar.VSLBcursorState = VSLB_STATE_OFF; _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBleftOffset slidebar.VSLBbitmap 0 slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset slidebar.VSLBtransp; let rectCursorVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBcursorPos slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; O2D_RedrawObj slidebar.VSLBObj2D; 1 ;; fun rflTimerLeftVSLB (timer, slidebar)= if (slidebar.VSLBvalue-.slidebar.VSLBstep) >. slidebar.VSLBmini then { set slidebar.VSLBvalue = slidebar.VSLBvalue -. slidebar.VSLBstep; set slidebar.VSLBcursorPos = slidebar.VSLBbarOffset+ ftoi (itof slidebar.VSLBbarWidth-slidebar.VSLBcursorWidth)*. (slidebar.VSLBvalue-.slidebar.VSLBmini)/.(slidebar.VSLBmaxi-.slidebar.VSLBmini); /* remettre les flèches */ let rectLeftVSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h nil; _CPbitmap16 slidebar.VSLBwork w y slidebar.VSLBbitmap 3*w y w h nil; }; let rectRightVSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h nil; _CPbitmap16 slidebar.VSLBwork w y slidebar.VSLBbitmap 3*w y w h nil; }; let rectBarVSLB slidebar -> [x y w h] in { /* remettre la barre */ _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h nil; /* remettre la barre dans le masque */ _CPbitmap16 slidebar.VSLBwork w y slidebar.VSLBbitmap 3*w y w h nil; }; /* placer le curseur */ let rectCursorVSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBcursorPos slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; /* placer le curseur dans le masque */ _CPbitmap16 slidebar.VSLBwork w slidebar.VSLBcursorPos slidebar.VSLBbitmap 3*w y w h slidebar.VSLBtransp; }; O2D_RedrawObj slidebar.VSLBObj2D; exec slidebar.VSLBClickReflex with [slidebar slidebar.VSLBvalue] } else nil;; fun rflTimerRightVSLB (timer, slidebar)= if (slidebar.VSLBvalue+.slidebar.VSLBstep) <. slidebar.VSLBmaxi then { set slidebar.VSLBvalue = slidebar.VSLBvalue +. slidebar.VSLBstep; set slidebar.VSLBcursorPos = slidebar.VSLBbarOffset+ ftoi (itof slidebar.VSLBbarWidth-slidebar.VSLBcursorWidth)*. (slidebar.VSLBvalue-.slidebar.VSLBmini)/.(slidebar.VSLBmaxi-.slidebar.VSLBmini); /* remettre les flèches */ let rectLeftVSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h nil; _CPbitmap16 slidebar.VSLBwork w y slidebar.VSLBbitmap 3*w y w h nil; }; let rectRightVSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h nil; _CPbitmap16 slidebar.VSLBwork w y slidebar.VSLBbitmap 3*w y w h nil; }; /* remettre les flèches dans le masque */ let rectLeftVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork w y slidebar.VSLBbitmap 3*w y w h nil; let rectRightVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork w y slidebar.VSLBbitmap 3*w y w h nil; let rectBarVSLB slidebar -> [x y w h] in { /* remettre la barre */ _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h nil; /* remettre la barre dans le masque */ _CPbitmap16 slidebar.VSLBwork w y slidebar.VSLBbitmap 3*w y w h nil; }; /* placer le curseur */ let rectCursorVSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBcursorPos slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; /* placer le curseur dans le masque */ _CPbitmap16 slidebar.VSLBwork w slidebar.VSLBcursorPos slidebar.VSLBbitmap 3*w y w h slidebar.VSLBtransp; }; O2D_RedrawObj slidebar.VSLBObj2D; exec slidebar.VSLBClickReflex with [slidebar slidebar.VSLBvalue] } else nil;; /* Methode Click In */ fun ClickInVSLB (mx, my, mb, slidebar)= if mb==1 then { if inCursorVSLB slidebar mx my then { set slidebar.VSLBcursorState=VSLB_STATE_ON; let rectCursorVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBcursorPos slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; } else if inLeftVSLB slidebar mx my then { set slidebar.VSLBleftState=VSLB_STATE_ON; set slidebar.VSLBtimer = _rfltimer _starttimer slidebar.VSLBchannel 100 @rflTimerLeftVSLB slidebar; rflTimerLeftVSLB slidebar.VSLBtimer slidebar; let rectLeftVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; } else if inBarVSLB slidebar mx my then { set slidebar.VSLBbarState=VSLB_STATE_ON; set slidebar.VSLBvalue = (itof ftoi (itof (my-slidebar.VSLBObj2D.O2Dy-slidebar.VSLBbarOffset))*.(slidebar.VSLBmaxi-.slidebar.VSLBmini)/.(itof slidebar.VSLBbarWidth)+.slidebar.VSLBmini /.slidebar.VSLBstep )*.slidebar.VSLBstep; set slidebar.VSLBcursorPos = slidebar.VSLBbarOffset+ ftoi (itof slidebar.VSLBbarWidth-slidebar.VSLBcursorWidth)*. (slidebar.VSLBvalue-.slidebar.VSLBmini)/.(slidebar.VSLBmaxi-.slidebar.VSLBmini); _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBleftOffset slidebar.VSLBbitmap 0 slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset nil; _CPbitmap16 slidebar.VSLBwork slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dh slidebar.VSLBbitmap 3*slidebar.VSLBObj2D.O2Dw slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset nil; let rectBarVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; let rectCursorVSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBcursorPos slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; _CPbitmap16 slidebar.VSLBwork w slidebar.VSLBcursorPos slidebar.VSLBbitmap 3*w y w h slidebar.VSLBtransp; }; exec slidebar.VSLBClickReflex with [slidebar slidebar.VSLBvalue]; nil } else if inRightVSLB slidebar mx my then { set slidebar.VSLBrightState=VSLB_STATE_ON; set slidebar.VSLBtimer = _rfltimer _starttimer slidebar.VSLBchannel 100 @rflTimerRightVSLB slidebar; rflTimerRightVSLB slidebar.VSLBtimer slidebar; let rectRightVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; } else nil; O2D_RedrawObj slidebar.VSLBObj2D; } else nil; 1 ;; /* Methode UnClick In */ fun UnClickInVSLB (mx, my, mb, slidebar)= if mb==1 then { _deltimer slidebar.VSLBtimer; if slidebar.VSLBleftState == VSLB_STATE_ON then { set slidebar.VSLBleftState = VSLB_STATE_RO; let rectLeftVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; } else nil; if slidebar.VSLBbarState == VSLB_STATE_ON then { set slidebar.VSLBbarState = VSLB_STATE_RO; let rectBarVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; let rectCursorVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBcursorPos slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; } else nil; if slidebar.VSLBrightState == VSLB_STATE_ON then { set slidebar.VSLBrightState = VSLB_STATE_RO; let rectRightVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; } else nil; if slidebar.VSLBcursorState == VSLB_STATE_ON then { set slidebar.VSLBcursorState = VSLB_STATE_RO; let rectCursorVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork slidebar.VSLBcursorPos 0 slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; } else nil; O2D_RedrawObj slidebar.VSLBObj2D; } else nil; 1 ;; fun MoveVSLB (mx, my, mb, slidebar)= if slidebar.VSLBcursorState==VSLB_STATE_ON then let (itof ftoi (itof (my-slidebar.VSLBObj2D.O2Dy-slidebar.VSLBbarOffset))*.(slidebar.VSLBmaxi-.slidebar.VSLBmini)/.(itof slidebar.VSLBbarWidth)+.slidebar.VSLBmini /.slidebar.VSLBstep )*.slidebar.VSLBstep -> newValue in if ((newValue <. slidebar.VSLBvalue) || (newValue >. slidebar.VSLBvalue)) && ((newValue <. (slidebar.VSLBmaxi-.slidebar.VSLBstep)) || ((newValue >. slidebar.VSLBmini+.slidebar.VSLBstep))) then { set slidebar.VSLBvalue = newValue; set slidebar.VSLBcursorPos = slidebar.VSLBbarOffset+ ftoi (itof slidebar.VSLBbarWidth-slidebar.VSLBcursorWidth)*. (slidebar.VSLBvalue-.slidebar.VSLBmini)/.(slidebar.VSLBmaxi-.slidebar.VSLBmini); _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBleftOffset slidebar.VSLBbitmap 0 slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset nil; _CPbitmap16 slidebar.VSLBwork slidebar.VSLBObj2D.O2Dw slidebar.VSLBleftOffset slidebar.VSLBbitmap 3*slidebar.VSLBObj2D.O2Dw slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset nil; let rectBarVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; let rectCursorVSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBcursorPos slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; _CPbitmap16 slidebar.VSLBwork w slidebar.VSLBcursorPos slidebar.VSLBbitmap 3*w y w h slidebar.VSLBtransp; }; O2D_RedrawObj slidebar.VSLBObj2D; exec slidebar.VSLBClickReflex with [slidebar slidebar.VSLBvalue]; nil } else nil else if inCursorVSLB slidebar mx my then if slidebar.VSLBcursorState!=VSLB_STATE_RO then { set slidebar.VSLBleftState=VSLB_STATE_OFF; set slidebar.VSLBbarState=VSLB_STATE_OFF; set slidebar.VSLBrightState=VSLB_STATE_OFF; set slidebar.VSLBcursorState=VSLB_STATE_RO; _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBleftOffset slidebar.VSLBbitmap 0 slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset slidebar.VSLBtransp; let rectCursorVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBcursorPos slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; O2D_RedrawObj slidebar.VSLBObj2D; } else nil else if inLeftVSLB slidebar mx my then if slidebar.VSLBleftState!=VSLB_STATE_RO then { set slidebar.VSLBleftState=VSLB_STATE_RO; set slidebar.VSLBbarState=VSLB_STATE_OFF; set slidebar.VSLBrightState=VSLB_STATE_OFF; set slidebar.VSLBcursorState=VSLB_STATE_OFF; _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBleftOffset slidebar.VSLBbitmap 0 slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset slidebar.VSLBtransp; let rectLeftVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; let rectCursorVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBcursorPos slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; O2D_RedrawObj slidebar.VSLBObj2D; } else nil else if inBarVSLB slidebar mx my then if slidebar.VSLBbarState!=VSLB_STATE_RO then { set slidebar.VSLBleftState=VSLB_STATE_OFF; set slidebar.VSLBbarState=VSLB_STATE_RO; set slidebar.VSLBrightState=VSLB_STATE_OFF; set slidebar.VSLBcursorState=VSLB_STATE_OFF; _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBleftOffset slidebar.VSLBbitmap 0 slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset slidebar.VSLBtransp; let rectBarVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; let rectCursorVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBcursorPos slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; O2D_RedrawObj slidebar.VSLBObj2D; } else nil else if inRightVSLB slidebar mx my then if slidebar.VSLBrightState!=VSLB_STATE_RO then { set slidebar.VSLBleftState=VSLB_STATE_OFF; set slidebar.VSLBbarState=VSLB_STATE_OFF; set slidebar.VSLBrightState=VSLB_STATE_RO; set slidebar.VSLBcursorState=VSLB_STATE_OFF; _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBleftOffset slidebar.VSLBbitmap 0 slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset slidebar.VSLBtransp; let rectRightVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; let rectCursorVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBcursorPos slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; O2D_RedrawObj slidebar.VSLBObj2D; } else nil else nil; 1;; /* Methode UnClick Out */ fun UnClickOutVSLB (mousecol, mouselgn, mousebuttons, slidebar)= _deltimer slidebar.VSLBtimer; set slidebar.VSLBleftState = VSLB_STATE_OFF; set slidebar.VSLBbarState = VSLB_STATE_OFF; set slidebar.VSLBrightState = VSLB_STATE_OFF; set slidebar.VSLBcursorState = VSLB_STATE_OFF; let rectLeftVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; let rectBarVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; let rectRightVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; let rectCursorVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBcursorPos slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; O2D_RedrawObj slidebar.VSLBObj2D; 1 ;; fun IsUserClickAllowedInVSLB()= 0 ;; fun IsUserUnClickAllowedInVSLB()= 0 ;; /* Methode destruction object */ fun DsVSLB (slidebar)= _DSbitmap slidebar.VSLBbitmap; _DSbitmap slidebar.VSLBwork; set slidebar.VSLBbitmap=nil; set slidebar.VSLBwork=nil; set slidebar.VSLBClickReflex=nil; 1 ;; /*****************************************************************************/ /* Fonctions externes de la slidebar */ /*****************************************************************************/ /* Constructeur de la slidebar chn : canal de construction container : container auquel appartient le rollover father : l'objet pere coords : coordonnees de l'objet par rapport au pere flags : flag de construction (O2D_ENABLE,O2D_DISABLE,O2D_HIDE) name : Nom de l'objet bmp : bitmap pour construire l'objet offsets : 4-uple des offsets des éléments dans le bitmap [left bar right cursor] tCoords : coordonnees de transparence mini : valeur minimale de la slidbar (float) maxi : valeur maximale de la slidbar (float) */ fun VSLB_New (chn, container, father, coords, flags, name, bmp, offsets, tCoords, mini, maxi)= if container!=nil then let tCoords -> [tx ty] in let if tCoords == nil then nil else _GETpixel16 bmp tx ty -> tColor in let offsets -> [lo bo ro co] in let _GETbitmapSize bmp -> [w h] in let h-co -> cursorWidth in let ro-bo -> barWidth in let (maxi+.mini)/.(itof 2) -> value in let bo-(cursorWidth/2)+(ftoi (itof barWidth)*.(value-.mini)/.(maxi-.mini)) -> cursorPos in let let _FILLbitmap _CRbitmap chn w/2 co tColor -> work in { _CPbitmap16 work 0 lo bmp 0 lo w/4 co tColor; _CPbitmap16 work 0 cursorPos bmp 0 co w/4 cursorWidth tColor; _CPbitmap16 work w/4 lo bmp 3*w/4 lo w/4 co tColor; _CPbitmap16 work w/4 cursorPos bmp 3*w/4 co w/4 cursorWidth tColor; work } -> work in let O2D_NewObject container father name w/4 co coords flags -> obj in let MkVSlideBar [ chn obj bmp work lo bo ro co barWidth cursorWidth flags VSLB_STATE_OFF VSLB_STATE_OFF VSLB_STATE_OFF VSLB_STATE_OFF tColor value cursorPos mini maxi (itof 1) nil nil ] -> slidebar in { /* les methodes */ O2D_CBDsObject obj slidebar @DsVSLB; O2D_CBPaint obj slidebar @PaintVSLB; O2D_CBPaintPart obj slidebar @PaintPartOfVSLB; O2D_CBIsMouseOnDisplayObject obj slidebar @IsMouseOnVSLB; O2D_CBUserClickAllowed obj slidebar @IsUserClickAllowedInVSLB; O2D_CBUserUnClickAllowed obj slidebar @IsUserUnClickAllowedInVSLB; O2D_CBCursorMove obj slidebar @MoveVSLB; O2D_CBCursorMoveIn obj slidebar @MoveVSLB; O2D_CBCursorMoveOut obj slidebar @MoveOutVSLB; O2D_CBCursorMoveInWithButtonPush obj slidebar @MoveInPushedVSLB; O2D_CBCursorMoveOutWithButtonPush obj slidebar @MoveOutPushedVSLB; O2D_CBObjectClickIn obj slidebar @ClickInVSLB; O2D_CBObjectClickOut obj slidebar @ClickOutVSLB; O2D_CBObjectUnClickIn obj slidebar @UnClickInVSLB; O2D_CBObjectUnClickOut obj slidebar @UnClickOutVSLB; slidebar } else nil;; fun VSLB_Del (slider)= O2D_DelObject slider.VSLBObj2D; slider ;; fun VSLB_SetClickReflex (slider, ReflexeClick, ParamClick)= if slider==nil then nil else { set slider.VSLBClickReflex=mkfun3 ReflexeClick ParamClick; slider };; fun VSLB_SetValue (slidebar, value)= if slidebar==nil then nil else { if (value >. slidebar.VSLBmini) && (value <. slidebar.VSLBmaxi) then { set slidebar.VSLBvalue = value; set slidebar.VSLBcursorPos = slidebar.VSLBbarOffset+ ftoi (itof slidebar.VSLBbarWidth-slidebar.VSLBcursorWidth)*. (slidebar.VSLBvalue-.slidebar.VSLBmini)/.(slidebar.VSLBmaxi-.slidebar.VSLBmini); _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBleftOffset slidebar.VSLBbitmap 0 slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset nil; _CPbitmap16 slidebar.VSLBwork slidebar.VSLBObj2D.O2Dw slidebar.VSLBleftOffset slidebar.VSLBbitmap 3*slidebar.VSLBObj2D.O2Dw slidebar.VSLBleftOffset slidebar.VSLBObj2D.O2Dw slidebar.VSLBcursorOffset nil; let rectBarVSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.VSLBwork 0 y slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; let rectCursorVSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.VSLBwork 0 slidebar.VSLBcursorPos slidebar.VSLBbitmap x y w h slidebar.VSLBtransp; _CPbitmap16 slidebar.VSLBwork w slidebar.VSLBcursorPos slidebar.VSLBbitmap 3*w y w h slidebar.VSLBtransp; }; O2D_RedrawObj slidebar.VSLBObj2D; } else nil; slidebar };; fun VSLB_GetObject (slider)= slider.VSLBObj2D;; fun VSLB_ChangeDisplayFlags (slider, NewFlag, RedrawFlag, RepaintFlag)= O2D_ChangeObjDisplayFlag slider.VSLBObj2D NewFlag RedrawFlag RepaintFlag; slider;; fun VSLB_ChangeCoordinates (slider, NewCoordinates, RedrawFlag, RepaintFlag)= O2D_ChangeObjCoordinates slider.VSLBObj2D NewCoordinates RedrawFlag RepaintFlag; slider;; fun VSLB_GetCoordinates (slider)= O2D_GetObjCoordinates slider.VSLBObj2D;;