home *** CD-ROM | disk | FTP | other *** search
/ Star Trek Starfleet Academy Mini Omnipedia / MINI_OMNI.ISO / pc / omni_v2.dxr / 00399_SliderManagerTall.ls < prev    next >
Encoding:
Text File  |  1996-04-15  |  2.3 KB  |  72 lines

  1. property ancestor
  2. global gTxtScrSprsBeg
  3.  
  4. on birth me, pSliderMin, pSliderMax, pSlideAction, pChan, pTop, pBottom, pBarChan, pBTop, pBBottom, pStartVal, pRestoreToStart
  5.   set vHalfKnobSize to (pBottom - pTop + 0.0) / 2
  6.   set vScrnMin to pBTop + vHalfKnobSize
  7.   set vScrnMax to pBBottom - vHalfKnobSize
  8.   set vScale to vScrnMax - vScrnMin + 0.0
  9.   set ancestor to birth(script "SliderManagerAncestor", pSliderMin, pSliderMax, vScrnMin, vScrnMax, pChan, pBarChan, vScale, vHalfKnobSize, pSlideAction, pStartVal, pRestoreToStart)
  10.   return me
  11. end
  12.  
  13. on mShiftSlider me
  14.   set vloc to the mouseV
  15.   if (vloc >= the iScreenMin of me) and (vloc <= the iScreenMax of me) then
  16.     set the locV of sprite the iSliderChan of me to vloc
  17.   else
  18.     if vloc < the iScreenMin of me then
  19.       set the locV of sprite the iSliderChan of me to the iScreenMin of me
  20.     else
  21.       set the locV of sprite the iSliderChan of me to the iScreenMax of me
  22.     end if
  23.   end if
  24. end
  25.  
  26. on mVoiCallPage me, pDir
  27.   global oIndexScroller
  28.   set Ldist to the iPageHeightK of oIndexScroller * pDir
  29.   mNudgeSlider(me, Ldist)
  30.   mEndIndexToLine(oIndexScroller)
  31. end
  32.  
  33. on mRestoreSlider me, pDoScript
  34.   if not (the puppet of sprite the iSliderChan of me) then
  35.     puppetSprite(the iSliderChan of me, 1)
  36.   end if
  37.   set the locV of sprite the iSliderChan of me to mSliderValToLoc(me)
  38.   if pDoScript then
  39.     do(the iSliderScript of me)
  40.   end if
  41. end
  42.  
  43. on mSliderBarPage me, pDist
  44.   if the mouseV > the bottom of sprite the iSliderChan of me then
  45.     mNudgeSlider(me, pDist)
  46.     repeat while the stillDown
  47.       if the mouseV > the bottom of sprite the iSliderChan of me then
  48.         mNudgeSlider(me, pDist)
  49.       end if
  50.     end repeat
  51.   else
  52.     mNudgeSlider(me, -1 * pDist)
  53.     repeat while the stillDown
  54.       if the mouseV < the top of sprite the iSliderChan of me then
  55.         mNudgeSlider(me, -1 * pDist)
  56.       end if
  57.     end repeat
  58.   end if
  59. end
  60.  
  61. on mCalcSliderVal me
  62.   set vSliderLoc to the locV of sprite the iSliderChan of me - the iScreenMin of me
  63.   set the iSliderVal of me to the iSliderMin of me + integer(vSliderLoc / the iIncrements of me)
  64.   if the iSliderVal of me > the iSliderMax of me then
  65.     set the iSliderVal of me to the iSliderMax of me
  66.   end if
  67. end
  68.  
  69. on mSliderValToLoc me
  70.   return the iScreenMin of me + ((the iSliderVal of me - the iSliderMin of me) * the iIncrements of me)
  71. end
  72.