/****************************************************************************/ /* 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 HSLB_STATE_OFF =0;; /* off */ var HSLB_STATE_RO =1;; /* highlight */ var HSLB_STATE_ON =2;; /* pushed */ /* SliderBar: HSLBObj2D: l'objet 2D associe HSLBbitmap: bitmap contenant les differents etats de la slidebar HSLBcoords: liste des coordonnees des differents etats de la slidebar HSLBwork : bitmap de travail de la slidebar HSLBflags : les flags de la slidebar HSLBstate: etat de la slidebar HSLBtransparency: couleur de transparence HSLBClickReflex: reflexe utilisateur lors du clic sur la slidebar */ /* struct HSlideBar =[ HSLBchannel : Chn, HSLBObj2D : Obj2D, HSLBbitmap : ObjBitmap, HSLBwork : ObjBitmap, HSLBleftOffset : I, HSLBbarOffset : I, HSLBrightOffset : I, HSLBcursorOffset : I, HSLBbarWidth : I, HSLBcursorWidth : I, HSLBflags : I, HSLBleftState : I, HSLBbarState : I, HSLBrightState : I, HSLBcursorState : I, HSLBtransp : I, HSLBvalue : F, HSLBcursorPos : I, HSLBmini : F, HSLBmaxi : F, HSLBstep : F, HSLBtimer : Timer, HSLBClickReflex : fun [HSlideBar F] HSlideBar ] MkHSlideBar;; */ /*****************************************************************************/ /* Fonctions Internes de la slidebar */ /*****************************************************************************/ /* renvoie les coordonnees de l'etat de la slidebar dans la bitmap globale */ fun rectLeftHSLB (slidebar)= if slidebar.HSLBleftState==HSLB_STATE_RO then [ slidebar.HSLBleftOffset slidebar.HSLBObj2D.O2Dh slidebar.HSLBbarOffset-slidebar.HSLBleftOffset slidebar.HSLBObj2D.O2Dh ] else if slidebar.HSLBleftState==HSLB_STATE_ON then [ slidebar.HSLBleftOffset 2*slidebar.HSLBObj2D.O2Dh slidebar.HSLBbarOffset-slidebar.HSLBleftOffset slidebar.HSLBObj2D.O2Dh ] else [ slidebar.HSLBleftOffset 0 slidebar.HSLBbarOffset-slidebar.HSLBleftOffset slidebar.HSLBObj2D.O2Dh ] ;; fun rectBarHSLB (slidebar)= if slidebar.HSLBbarState==HSLB_STATE_RO then [ slidebar.HSLBbarOffset slidebar.HSLBObj2D.O2Dh slidebar.HSLBrightOffset-slidebar.HSLBbarOffset slidebar.HSLBObj2D.O2Dh ] else if slidebar.HSLBbarState==HSLB_STATE_ON then [ slidebar.HSLBbarOffset 2*slidebar.HSLBObj2D.O2Dh slidebar.HSLBrightOffset-slidebar.HSLBbarOffset slidebar.HSLBObj2D.O2Dh ] else [ slidebar.HSLBbarOffset 0 slidebar.HSLBrightOffset-slidebar.HSLBbarOffset slidebar.HSLBObj2D.O2Dh ] ;; fun rectRightHSLB (slidebar)= if slidebar.HSLBrightState==HSLB_STATE_RO then [ slidebar.HSLBrightOffset slidebar.HSLBObj2D.O2Dh slidebar.HSLBcursorOffset-slidebar.HSLBrightOffset slidebar.HSLBObj2D.O2Dh ] else if slidebar.HSLBrightState==HSLB_STATE_ON then [ slidebar.HSLBrightOffset 2*slidebar.HSLBObj2D.O2Dh slidebar.HSLBcursorOffset-slidebar.HSLBrightOffset slidebar.HSLBObj2D.O2Dh ] else [ slidebar.HSLBrightOffset 0 slidebar.HSLBcursorOffset-slidebar.HSLBrightOffset slidebar.HSLBObj2D.O2Dh ] ;; fun rectCursorHSLB (slidebar)= if slidebar.HSLBcursorState==HSLB_STATE_RO then [ slidebar.HSLBcursorOffset slidebar.HSLBObj2D.O2Dh slidebar.HSLBcursorWidth slidebar.HSLBObj2D.O2Dh ] else if slidebar.HSLBcursorState==HSLB_STATE_ON then [ slidebar.HSLBcursorOffset 2*slidebar.HSLBObj2D.O2Dh slidebar.HSLBcursorWidth slidebar.HSLBObj2D.O2Dh ] else [ slidebar.HSLBcursorOffset 0 slidebar.HSLBcursorWidth slidebar.HSLBObj2D.O2Dh ] ;; fun inCursorHSLB (slidebar, mx, my)= (mx >= slidebar.HSLBObj2D.O2Dx+slidebar.HSLBcursorPos) && (mx <= slidebar.HSLBObj2D.O2Dx+slidebar.HSLBcursorPos+slidebar.HSLBcursorWidth);; fun inLeftHSLB (slidebar, mx, my)= (mx >= slidebar.HSLBObj2D.O2Dx+slidebar.HSLBleftOffset) && (mx <= slidebar.HSLBObj2D.O2Dx+slidebar.HSLBbarOffset);; fun inBarHSLB (slidebar, mx, my)= (mx >= slidebar.HSLBObj2D.O2Dx+slidebar.HSLBbarOffset) && (mx <= slidebar.HSLBObj2D.O2Dx+slidebar.HSLBrightOffset);; fun inRightHSLB (slidebar, mx, my)= (mx >= slidebar.HSLBObj2D.O2Dx+slidebar.HSLBrightOffset) && (mx <= slidebar.HSLBObj2D.O2Dx+slidebar.HSLBcursorOffset);; /* Methode Paint*/ fun PaintHSLB (slidebar)= [slidebar.HSLBwork 0 0 slidebar.HSLBObj2D.O2Dw slidebar.HSLBObj2D.O2Dh slidebar.HSLBtransp];; /* Methode Paint Part */ fun PaintPartOfHSLB (area, slidebar)= let IntersectionRectangle area MkRectangle2D [ MkInt2DPoint [0 0] MkInt2DPoint [slidebar.HSLBObj2D.O2Dw slidebar.HSLBObj2D.O2Dh] ] -> rect in let SizeRectangle rect -> [rw rh] in [ slidebar.HSLBwork rect.RctHG.iptX rect.RctHG.iptY rw rh slidebar.HSLBtransp ] ;; /* Methode IsMouseOnObject */ fun IsMouseOnHSLB (mx, my, slidebar)= let slidebar.HSLBObj2D -> obj in _GETpixel16 slidebar.HSLBwork mx-obj.O2Dx my-obj.O2Dy+obj.O2Dh;; /* Methode Move Out Object*/ fun MoveOutHSLB (mx, my, mousebuttons, slidebar)= _deltimer slidebar.HSLBtimer; set slidebar.HSLBleftState = HSLB_STATE_OFF; set slidebar.HSLBbarState = HSLB_STATE_OFF; set slidebar.HSLBrightState = HSLB_STATE_OFF; set slidebar.HSLBcursorState = HSLB_STATE_OFF; _CPbitmap16 slidebar.HSLBwork slidebar.HSLBleftOffset 0 slidebar.HSLBbitmap slidebar.HSLBleftOffset 0 slidebar.HSLBcursorOffset slidebar.HSLBObj2D.O2Dh slidebar.HSLBtransp; let rectCursorHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; O2D_RedrawObj slidebar.HSLBObj2D; 1;; /* Methode Move Out object with button pushed */ fun MoveOutPushedHSLB (mx, my, mb, slidebar)= _deltimer slidebar.HSLBtimer; set slidebar.HSLBleftState = HSLB_STATE_OFF; set slidebar.HSLBbarState = HSLB_STATE_OFF; set slidebar.HSLBrightState = HSLB_STATE_OFF; set slidebar.HSLBcursorState = HSLB_STATE_OFF; _CPbitmap16 slidebar.HSLBwork slidebar.HSLBleftOffset 0 slidebar.HSLBbitmap slidebar.HSLBleftOffset 0 slidebar.HSLBcursorOffset slidebar.HSLBObj2D.O2Dh slidebar.HSLBtransp; let rectCursorHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; O2D_RedrawObj slidebar.HSLBObj2D; 1;; /* Methode Move In object with button pushed */ fun MoveInPushedHSLB (mousecol, mouselgn, mousebuttons, slidebar)= 1;; /* Methode Click Out */ fun ClickOutHSLB (mousecol, mouselgn, mousebuttons, slidebar)= _deltimer slidebar.HSLBtimer; set slidebar.HSLBleftState = HSLB_STATE_OFF; set slidebar.HSLBbarState = HSLB_STATE_OFF; set slidebar.HSLBrightState = HSLB_STATE_OFF; set slidebar.HSLBcursorState = HSLB_STATE_OFF; _CPbitmap16 slidebar.HSLBwork slidebar.HSLBleftOffset 0 slidebar.HSLBbitmap slidebar.HSLBleftOffset 0 slidebar.HSLBcursorOffset slidebar.HSLBObj2D.O2Dh slidebar.HSLBtransp; let rectCursorHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; O2D_RedrawObj slidebar.HSLBObj2D; 1 ;; fun rflTimerLeftHSLB (timer, slidebar)= if (slidebar.HSLBvalue-.slidebar.HSLBstep) >. slidebar.HSLBmini then { set slidebar.HSLBvalue = slidebar.HSLBvalue -. slidebar.HSLBstep; set slidebar.HSLBcursorPos = slidebar.HSLBbarOffset+ ftoi (itof slidebar.HSLBbarWidth-slidebar.HSLBcursorWidth)*. (slidebar.HSLBvalue-.slidebar.HSLBmini)/.(slidebar.HSLBmaxi-.slidebar.HSLBmini); /* remettre les flèches */ let rectLeftHSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h nil; _CPbitmap16 slidebar.HSLBwork x h slidebar.HSLBbitmap x 3*h w h nil; }; let rectRightHSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h nil; _CPbitmap16 slidebar.HSLBwork x h slidebar.HSLBbitmap x 3*h w h nil; }; let rectBarHSLB slidebar -> [x y w h] in { /* remettre la barre */ _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h nil; /* remettre la barre dans le masque */ _CPbitmap16 slidebar.HSLBwork x h slidebar.HSLBbitmap x 3*h w h nil; }; /* placer le curseur */ let rectCursorHSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; /* placer le curseur dans le masque */ _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos h slidebar.HSLBbitmap x 3*h w h slidebar.HSLBtransp; }; O2D_RedrawObj slidebar.HSLBObj2D; exec slidebar.HSLBClickReflex with [slidebar slidebar.HSLBvalue] } else nil;; fun rflTimerRightHSLB (timer, slidebar)= if (slidebar.HSLBvalue+.slidebar.HSLBstep) <. slidebar.HSLBmaxi then { set slidebar.HSLBvalue = slidebar.HSLBvalue +. slidebar.HSLBstep; set slidebar.HSLBcursorPos = slidebar.HSLBbarOffset+ ftoi (itof slidebar.HSLBbarWidth-slidebar.HSLBcursorWidth)*. (slidebar.HSLBvalue-.slidebar.HSLBmini)/.(slidebar.HSLBmaxi-.slidebar.HSLBmini); /* remettre les flèches */ let rectLeftHSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h nil; _CPbitmap16 slidebar.HSLBwork x h slidebar.HSLBbitmap x 3*h w h nil; }; let rectRightHSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h nil; _CPbitmap16 slidebar.HSLBwork x h slidebar.HSLBbitmap x 3*h w h nil; }; /* remettre les flèches dans le masque */ let rectLeftHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x h slidebar.HSLBbitmap x 3*h w h nil; let rectRightHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x h slidebar.HSLBbitmap x 3*h w h nil; let rectBarHSLB slidebar -> [x y w h] in { /* remettre la barre */ _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h nil; /* remettre la barre dans le masque */ _CPbitmap16 slidebar.HSLBwork x h slidebar.HSLBbitmap x 3*h w h nil; }; /* placer le curseur */ let rectCursorHSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; /* placer le curseur dans le masque */ _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos h slidebar.HSLBbitmap x 3*h w h slidebar.HSLBtransp; }; O2D_RedrawObj slidebar.HSLBObj2D; exec slidebar.HSLBClickReflex with [slidebar slidebar.HSLBvalue] } else nil;; /* Methode Click In */ fun ClickInHSLB (mx, my, mb, slidebar)= if mb==1 then { if inCursorHSLB slidebar mx my then { set slidebar.HSLBcursorState=HSLB_STATE_ON; let rectCursorHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; } else if inLeftHSLB slidebar mx my then { set slidebar.HSLBleftState=HSLB_STATE_ON; set slidebar.HSLBtimer = _rfltimer _starttimer slidebar.HSLBchannel 100 @rflTimerLeftHSLB slidebar; rflTimerLeftHSLB slidebar.HSLBtimer slidebar; let rectLeftHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; } else if inBarHSLB slidebar mx my then { set slidebar.HSLBbarState=HSLB_STATE_ON; set slidebar.HSLBvalue = (itof ftoi (itof (mx-slidebar.HSLBObj2D.O2Dx-slidebar.HSLBbarOffset))*.(slidebar.HSLBmaxi-.slidebar.HSLBmini)/.(itof slidebar.HSLBbarWidth)+.slidebar.HSLBmini /.slidebar.HSLBstep )*.slidebar.HSLBstep; set slidebar.HSLBcursorPos = slidebar.HSLBbarOffset+ ftoi (itof slidebar.HSLBbarWidth-slidebar.HSLBcursorWidth)*. (slidebar.HSLBvalue-.slidebar.HSLBmini)/.(slidebar.HSLBmaxi-.slidebar.HSLBmini); _CPbitmap16 slidebar.HSLBwork slidebar.HSLBleftOffset 0 slidebar.HSLBbitmap slidebar.HSLBleftOffset 0 slidebar.HSLBcursorOffset slidebar.HSLBObj2D.O2Dh nil; _CPbitmap16 slidebar.HSLBwork slidebar.HSLBleftOffset slidebar.HSLBObj2D.O2Dh slidebar.HSLBbitmap slidebar.HSLBleftOffset 3*slidebar.HSLBObj2D.O2Dh slidebar.HSLBcursorOffset slidebar.HSLBObj2D.O2Dh nil; let rectBarHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; let rectCursorHSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos h slidebar.HSLBbitmap x 3*h w h slidebar.HSLBtransp; }; exec slidebar.HSLBClickReflex with [slidebar slidebar.HSLBvalue]; nil } else if inRightHSLB slidebar mx my then { set slidebar.HSLBrightState=HSLB_STATE_ON; set slidebar.HSLBtimer = _rfltimer _starttimer slidebar.HSLBchannel 100 @rflTimerRightHSLB slidebar; rflTimerRightHSLB slidebar.HSLBtimer slidebar; let rectRightHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; } else nil; O2D_RedrawObj slidebar.HSLBObj2D; } else nil; 1 ;; /* Methode UnClick In */ fun UnClickInHSLB (mx, my, mb, slidebar)= if mb==1 then { _deltimer slidebar.HSLBtimer; if slidebar.HSLBleftState == HSLB_STATE_ON then { set slidebar.HSLBleftState = HSLB_STATE_RO; let rectLeftHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; } else nil; if slidebar.HSLBbarState == HSLB_STATE_ON then { set slidebar.HSLBbarState = HSLB_STATE_RO; let rectBarHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; let rectCursorHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; } else nil; if slidebar.HSLBrightState == HSLB_STATE_ON then { set slidebar.HSLBrightState = HSLB_STATE_RO; let rectRightHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; } else nil; if slidebar.HSLBcursorState == HSLB_STATE_ON then { set slidebar.HSLBcursorState = HSLB_STATE_RO; let rectCursorHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; } else nil; O2D_RedrawObj slidebar.HSLBObj2D; } else nil; 1 ;; fun MoveHSLB (mx, my, mb, slidebar)= if slidebar.HSLBcursorState==HSLB_STATE_ON then let (itof ftoi (itof (mx-slidebar.HSLBObj2D.O2Dx-slidebar.HSLBbarOffset))*.(slidebar.HSLBmaxi-.slidebar.HSLBmini)/.(itof slidebar.HSLBbarWidth)+.slidebar.HSLBmini /.slidebar.HSLBstep )*.slidebar.HSLBstep -> newValue in if ((newValue <. slidebar.HSLBvalue) || (newValue >. slidebar.HSLBvalue)) && ((newValue <. (slidebar.HSLBmaxi-.slidebar.HSLBstep)) || ((newValue >. slidebar.HSLBmini+.slidebar.HSLBstep))) then { set slidebar.HSLBvalue = newValue; set slidebar.HSLBcursorPos = slidebar.HSLBbarOffset+ ftoi (itof slidebar.HSLBbarWidth-slidebar.HSLBcursorWidth)*. (slidebar.HSLBvalue-.slidebar.HSLBmini)/.(slidebar.HSLBmaxi-.slidebar.HSLBmini); _CPbitmap16 slidebar.HSLBwork slidebar.HSLBleftOffset 0 slidebar.HSLBbitmap slidebar.HSLBleftOffset 0 slidebar.HSLBcursorOffset slidebar.HSLBObj2D.O2Dh nil; _CPbitmap16 slidebar.HSLBwork slidebar.HSLBleftOffset slidebar.HSLBObj2D.O2Dh slidebar.HSLBbitmap slidebar.HSLBleftOffset 3*slidebar.HSLBObj2D.O2Dh slidebar.HSLBcursorOffset slidebar.HSLBObj2D.O2Dh nil; let rectBarHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; let rectCursorHSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos h slidebar.HSLBbitmap x 3*h w h slidebar.HSLBtransp; }; O2D_RedrawObj slidebar.HSLBObj2D; exec slidebar.HSLBClickReflex with [slidebar slidebar.HSLBvalue]; nil } else nil else if inCursorHSLB slidebar mx my then if slidebar.HSLBcursorState!=HSLB_STATE_RO then { set slidebar.HSLBleftState=HSLB_STATE_OFF; set slidebar.HSLBbarState=HSLB_STATE_OFF; set slidebar.HSLBrightState=HSLB_STATE_OFF; set slidebar.HSLBcursorState=HSLB_STATE_RO; _CPbitmap16 slidebar.HSLBwork slidebar.HSLBleftOffset 0 slidebar.HSLBbitmap slidebar.HSLBleftOffset 0 slidebar.HSLBcursorOffset slidebar.HSLBObj2D.O2Dh slidebar.HSLBtransp; let rectCursorHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; O2D_RedrawObj slidebar.HSLBObj2D; } else nil else if inLeftHSLB slidebar mx my then if slidebar.HSLBleftState!=HSLB_STATE_RO then { set slidebar.HSLBleftState=HSLB_STATE_RO; set slidebar.HSLBbarState=HSLB_STATE_OFF; set slidebar.HSLBrightState=HSLB_STATE_OFF; set slidebar.HSLBcursorState=HSLB_STATE_OFF; _CPbitmap16 slidebar.HSLBwork slidebar.HSLBleftOffset 0 slidebar.HSLBbitmap slidebar.HSLBleftOffset 0 slidebar.HSLBcursorOffset slidebar.HSLBObj2D.O2Dh slidebar.HSLBtransp; let rectLeftHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; let rectCursorHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; O2D_RedrawObj slidebar.HSLBObj2D; } else nil else if inBarHSLB slidebar mx my then if slidebar.HSLBbarState!=HSLB_STATE_RO then { set slidebar.HSLBleftState=HSLB_STATE_OFF; set slidebar.HSLBbarState=HSLB_STATE_RO; set slidebar.HSLBrightState=HSLB_STATE_OFF; set slidebar.HSLBcursorState=HSLB_STATE_OFF; _CPbitmap16 slidebar.HSLBwork slidebar.HSLBleftOffset 0 slidebar.HSLBbitmap slidebar.HSLBleftOffset 0 slidebar.HSLBcursorOffset slidebar.HSLBObj2D.O2Dh slidebar.HSLBtransp; let rectBarHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; let rectCursorHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; O2D_RedrawObj slidebar.HSLBObj2D; } else nil else if inRightHSLB slidebar mx my then if slidebar.HSLBrightState!=HSLB_STATE_RO then { set slidebar.HSLBleftState=HSLB_STATE_OFF; set slidebar.HSLBbarState=HSLB_STATE_OFF; set slidebar.HSLBrightState=HSLB_STATE_RO; set slidebar.HSLBcursorState=HSLB_STATE_OFF; _CPbitmap16 slidebar.HSLBwork slidebar.HSLBleftOffset 0 slidebar.HSLBbitmap slidebar.HSLBleftOffset 0 slidebar.HSLBcursorOffset slidebar.HSLBObj2D.O2Dh slidebar.HSLBtransp; let rectRightHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; let rectCursorHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; O2D_RedrawObj slidebar.HSLBObj2D; } else nil else nil; 1;; /* Methode UnClick Out */ fun UnClickOutHSLB (mousecol, mouselgn, mousebuttons, slidebar)= _deltimer slidebar.HSLBtimer; set slidebar.HSLBleftState = HSLB_STATE_OFF; set slidebar.HSLBbarState = HSLB_STATE_OFF; set slidebar.HSLBrightState = HSLB_STATE_OFF; set slidebar.HSLBcursorState = HSLB_STATE_OFF; let rectLeftHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; let rectBarHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; let rectRightHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; let rectCursorHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; O2D_RedrawObj slidebar.HSLBObj2D; 1 ;; fun IsUserClickAllowedInHSLB()= 0 ;; fun IsUserUnClickAllowedInHSLB()= 0 ;; /* Methode destruction object */ fun DsHSLB (slidebar)= _DSbitmap slidebar.HSLBbitmap; _DSbitmap slidebar.HSLBwork; set slidebar.HSLBbitmap=nil; set slidebar.HSLBwork=nil; set slidebar.HSLBClickReflex=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 HSLB_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 w-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 co h/2 tColor -> work in { _CPbitmap16 work lo 0 bmp lo 0 co h/4 tColor; _CPbitmap16 work cursorPos 0 bmp co 0 cursorWidth h/4 tColor; _CPbitmap16 work lo h/4 bmp lo 3*h/4 co h/4 tColor; _CPbitmap16 work cursorPos h/4 bmp co 3*h/4 cursorWidth h/4 tColor; work } -> work in let O2D_NewObject container father name co h/4 coords flags -> obj in let MkHSlideBar [ chn obj bmp work lo bo ro co barWidth cursorWidth flags HSLB_STATE_OFF HSLB_STATE_OFF HSLB_STATE_OFF HSLB_STATE_OFF tColor value cursorPos mini maxi (itof 1) nil nil ] -> slidebar in { /* les methodes */ O2D_CBDsObject obj slidebar @DsHSLB; O2D_CBPaint obj slidebar @PaintHSLB; O2D_CBPaintPart obj slidebar @PaintPartOfHSLB; O2D_CBIsMouseOnDisplayObject obj slidebar @IsMouseOnHSLB; O2D_CBUserClickAllowed obj slidebar @IsUserClickAllowedInHSLB; O2D_CBUserUnClickAllowed obj slidebar @IsUserUnClickAllowedInHSLB; O2D_CBCursorMove obj slidebar @MoveHSLB; O2D_CBCursorMoveIn obj slidebar @MoveHSLB; O2D_CBCursorMoveOut obj slidebar @MoveOutHSLB; O2D_CBCursorMoveInWithButtonPush obj slidebar @MoveInPushedHSLB; O2D_CBCursorMoveOutWithButtonPush obj slidebar @MoveOutPushedHSLB; O2D_CBObjectClickIn obj slidebar @ClickInHSLB; O2D_CBObjectClickOut obj slidebar @ClickOutHSLB; O2D_CBObjectUnClickIn obj slidebar @UnClickInHSLB; O2D_CBObjectUnClickOut obj slidebar @UnClickOutHSLB; slidebar } else nil;; fun HSLB_Del (slider)= O2D_DelObject slider.HSLBObj2D; slider;; fun HSLB_SetClickReflex (slider, ReflexeClick, ParamClick)= if slider==nil then nil else { set slider.HSLBClickReflex=mkfun3 ReflexeClick ParamClick; slider };; fun HSLB_SetValue (slidebar, value)= if slidebar==nil then nil else { if (value >. slidebar.HSLBmini) && (value <. slidebar.HSLBmaxi) then { set slidebar.HSLBvalue = value; set slidebar.HSLBcursorPos = slidebar.HSLBbarOffset+ ftoi (itof slidebar.HSLBbarWidth-slidebar.HSLBcursorWidth)*. (slidebar.HSLBvalue-.slidebar.HSLBmini)/.(slidebar.HSLBmaxi-.slidebar.HSLBmini); _CPbitmap16 slidebar.HSLBwork slidebar.HSLBleftOffset 0 slidebar.HSLBbitmap slidebar.HSLBleftOffset 0 slidebar.HSLBcursorOffset slidebar.HSLBObj2D.O2Dh nil; _CPbitmap16 slidebar.HSLBwork slidebar.HSLBleftOffset slidebar.HSLBObj2D.O2Dh slidebar.HSLBbitmap slidebar.HSLBleftOffset 3*slidebar.HSLBObj2D.O2Dh slidebar.HSLBcursorOffset slidebar.HSLBObj2D.O2Dh nil; let rectBarHSLB slidebar -> [x y w h] in _CPbitmap16 slidebar.HSLBwork x 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; let rectCursorHSLB slidebar -> [x y w h] in { _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos 0 slidebar.HSLBbitmap x y w h slidebar.HSLBtransp; _CPbitmap16 slidebar.HSLBwork slidebar.HSLBcursorPos h slidebar.HSLBbitmap x 3*h w h slidebar.HSLBtransp; }; O2D_RedrawObj slidebar.HSLBObj2D; } else nil; slidebar };; fun HSLB_GetObject (slider)= slider.HSLBObj2D;; fun HSLB_ChangeDisplayFlags (slider, NewFlag, RedrawFlag, RepaintFlag)= O2D_ChangeObjDisplayFlag slider.HSLBObj2D NewFlag RedrawFlag RepaintFlag; slider;; fun HSLB_ChangeCoordinates (slider, NewCoordinates, RedrawFlag, RepaintFlag)= O2D_ChangeObjCoordinates slider.HSLBObj2D NewCoordinates RedrawFlag RepaintFlag; slider;; fun HSLB_GetCoordinates (slider)= O2D_GetObjCoordinates slider.HSLBObj2D;;