home *** CD-ROM | disk | FTP | other *** search
/ PC Open 22 / pcopen22.iso / SuperCap / data / CITTA.DXR / 00388_movie4.ls < prev    next >
Encoding:
Text File  |  1998-05-18  |  7.5 KB  |  259 lines

  1. on initScroll BarSprt, UpSprt, ThumbSprt, DwnSprt, FirstSp, LastSp
  2.   global ScrollData
  3.   set ScrollData to BarSprt & "," & UpSprt & "," & DwnSprt & "," & ThumbSprt & "," & FirstSp & "," & LastSp & "," & the locV of sprite FirstSp & "," & GetGroupWidth(FirstSp, LastSp) - 15
  4.   puppetSprite(ThumbSprt, 1)
  5.   puppetAll(FirstSp, LastSp, 1)
  6. end
  7.  
  8. on endscroll
  9.   global ScrollData
  10.   set BarSprt to integer(item 1 of ScrollData)
  11.   set UpSprt to integer(item 2 of ScrollData)
  12.   set DwnSprt to integer(item 3 of ScrollData)
  13.   set ThumbSprt to integer(item 4 of ScrollData)
  14.   set FirstSp to integer(item 5 of ScrollData)
  15.   set LastSp to integer(item 6 of ScrollData)
  16.   set FirstPos to integer(item 7 of ScrollData)
  17.   set WidthOfAll to integer(item 8 of ScrollData)
  18.   puppetSprite(ThumbSprt, 0)
  19.   puppetAll(FirstSp, LastSp, 0)
  20. end
  21.  
  22. on puppetAll FirstSp, LastSp, BooleanVal
  23.   repeat with i = FirstSp to LastSp
  24.     puppetSprite(i, BooleanVal)
  25.   end repeat
  26. end
  27.  
  28. on OffsetAll FirstSp, LastSp, IntValue
  29.   repeat with i = FirstSp to LastSp
  30.     set the locV of sprite i to the locV of sprite i + IntValue
  31.   end repeat
  32. end
  33.  
  34. on CursorAll FirstSp, LastSp, Curs
  35.   repeat with i = FirstSp to LastSp
  36.     set the cursor of sprite i to Curs
  37.   end repeat
  38. end
  39.  
  40. on GetGroupWidth FirstSp, LastSp
  41.   set TheTopOfAll to the top of sprite FirstSp
  42.   set TheBottomOfAll to the bottom of sprite FirstSp
  43.   repeat with i = FirstSp to LastSp
  44.     if the top of sprite i < TheTopOfAll then
  45.       set TheTopOfAll to the top of sprite i
  46.     end if
  47.     if the bottom of sprite i > TheBottomOfAll then
  48.       set TheBottomOfAll to the bottom of sprite i
  49.     end if
  50.   end repeat
  51.   return TheBottomOfAll - TheTopOfAll
  52. end
  53.  
  54. on SetScrollTo Part, Total
  55.   global ScrollData
  56.   set BarSprt to integer(item 1 of ScrollData)
  57.   set UpSprt to integer(item 2 of ScrollData)
  58.   set DwnSprt to integer(item 3 of ScrollData)
  59.   set ThumbSprt to integer(item 4 of ScrollData)
  60.   set FirstSp to integer(item 5 of ScrollData)
  61.   set LastSp to integer(item 6 of ScrollData)
  62.   set FirstPos to integer(item 7 of ScrollData)
  63.   set WidthOfAll to integer(item 8 of ScrollData)
  64.   if Total = "Pixels" then
  65.     set Total to WidthOfAll
  66.   end if
  67.   if Part > Total then
  68.     set Part to Total
  69.   end if
  70.   if Part < 0 then
  71.     set Part to 0
  72.   end if
  73.   set Origin to the top of sprite BarSprt
  74.   set max to the height of sprite BarSprt - the height of sprite ThumbSprt
  75.   set HalfThumb to the height of sprite ThumbSprt / 2
  76.   set Temp to max * Part
  77.   set Temp to (Temp / Total) + Origin + HalfThumb
  78.   set the locV of sprite ThumbSprt to Temp
  79.   set Temp to WidthOfAll * Part
  80.   set Temp to Temp / Total
  81.   set Delta to FirstPos - the locV of sprite FirstSp - Temp
  82.   OffsetAll(FirstSp, LastSp, Delta)
  83.   updateStage()
  84. end
  85.  
  86. on SetScrollBar Part, Total
  87.   global ScrollData
  88.   set BarSprt to integer(item 1 of ScrollData)
  89.   set UpSprt to integer(item 2 of ScrollData)
  90.   set DwnSprt to integer(item 3 of ScrollData)
  91.   set ThumbSprt to integer(item 4 of ScrollData)
  92.   set FirstSp to integer(item 5 of ScrollData)
  93.   set LastSp to integer(item 6 of ScrollData)
  94.   set FirstPos to integer(item 7 of ScrollData)
  95.   set WidthOfAll to integer(item 8 of ScrollData)
  96.   if Total = "Pixels" then
  97.     set Total to WidthOfAll
  98.   end if
  99.   if Part > Total then
  100.     set Part to Total
  101.   end if
  102.   if Part < 0 then
  103.     set Part to 0
  104.   end if
  105.   set Origin to the top of sprite BarSprt
  106.   set max to the height of sprite BarSprt - the height of sprite ThumbSprt
  107.   set HalfThumb to the height of sprite ThumbSprt / 2
  108.   set Temp to max * Part
  109.   set Temp to (Temp / Total) + Origin + HalfThumb
  110.   set the locV of sprite ThumbSprt to Temp
  111. end
  112.  
  113. on SetScrollingData Part, Total
  114.   global ScrollData
  115.   set BarSprt to integer(item 1 of ScrollData)
  116.   set UpSprt to integer(item 2 of ScrollData)
  117.   set DwnSprt to integer(item 3 of ScrollData)
  118.   set ThumbSprt to integer(item 4 of ScrollData)
  119.   set FirstSp to integer(item 5 of ScrollData)
  120.   set LastSp to integer(item 6 of ScrollData)
  121.   set FirstPos to integer(item 7 of ScrollData)
  122.   set WidthOfAll to integer(item 8 of ScrollData)
  123.   if Total = "Pixels" then
  124.     set Total to WidthOfAll
  125.   end if
  126.   if Part > Total then
  127.     set Part to Total
  128.   end if
  129.   if Part < 0 then
  130.     set Part to 0
  131.   end if
  132.   set Temp to WidthOfAll * Part
  133.   set Temp to Temp / Total
  134.   set Delta to FirstPos - the locV of sprite FirstSp - Temp
  135.   OffsetAll(FirstSp, LastSp, Delta)
  136. end
  137.  
  138. on GetScroll Total
  139.   global ScrollData
  140.   set FirstSp to integer(item 5 of ScrollData)
  141.   set FirstPos to integer(item 7 of ScrollData)
  142.   set WidthOfAll to integer(item 8 of ScrollData)
  143.   if Total = "Pixels" then
  144.     set Total to WidthOfAll
  145.   end if
  146.   set Temp to (FirstPos - the locV of sprite FirstSp) * Total
  147.   set Temp to Temp / WidthOfAll
  148.   return Temp
  149. end
  150.  
  151. on GetScrollbarMax
  152.   global ScrollData
  153.   set BarSprt to integer(item 1 of ScrollData)
  154.   set ThumbSprt to integer(item 4 of ScrollData)
  155.   return the height of sprite BarSprt - the height of sprite ThumbSprt
  156. end
  157.  
  158. on SetScrollFromMouse
  159.   global ScrollData
  160.   set BarSprt to integer(item 1 of ScrollData)
  161.   set ThumbSprt to integer(item 4 of ScrollData)
  162.   SetScrollTo(the mouseV - the top of sprite BarSprt - (the height of sprite ThumbSprt / 2), the height of sprite BarSprt - the height of sprite ThumbSprt)
  163. end
  164.  
  165. on ScrollDown x
  166.   set Curr to GetScroll("pixels")
  167.   SetScrollTo(Curr + x, "pixels")
  168. end
  169.  
  170. on ScrollUp x
  171.   set Curr to GetScroll("pixels")
  172.   SetScrollTo(Curr - x, "pixels")
  173. end
  174.  
  175. on HandleThumb
  176.   repeat while not (the mouseUp)
  177.     SetScrollFromMouse()
  178.   end repeat
  179. end
  180.  
  181. on HandleScrollDown x
  182.   repeat while not (the mouseUp)
  183.     ScrollDown(x)
  184.   end repeat
  185. end
  186.  
  187. on HandleScrollUp x
  188.   repeat while not (the mouseUp)
  189.     ScrollUp(x)
  190.   end repeat
  191. end
  192.  
  193. on DragItems
  194.   global ScrollData
  195.   set BarSprt to integer(item 1 of ScrollData)
  196.   set ThumbSprt to integer(item 4 of ScrollData)
  197.   set FirstSp to integer(item 5 of ScrollData)
  198.   set FirstPos to integer(item 7 of ScrollData)
  199.   set SaveMouse to the mouseV
  200.   set StPt to FirstPos - the locV of sprite FirstSp + SaveMouse
  201.   repeat while not (the mouseUp)
  202.     set SaveOld to SaveMouse
  203.     set SaveMouse to the mouseV
  204.     SetScrollTo(StPt - SaveMouse, "pixels")
  205.   end repeat
  206.   set ExitFlag to 0
  207.   set Delta to SaveMouse - SaveOld
  208.   repeat while (Delta <> 0) and the mouseUp
  209.     set SaveMouse to SaveMouse + Delta
  210.     SetScrollTo(StPt - SaveMouse, "pixels")
  211.     set Delta to 4 * Delta / 5
  212.     if Delta = 1 then
  213.       set Delta to 0
  214.     end if
  215.   end repeat
  216. end
  217.  
  218. on ThumbPressed
  219.   global ScrollData
  220.   set ThumbSprt to integer(item 4 of ScrollData)
  221.   set NormalIcon to the number of member "Thumb"
  222.   set HilitedIcon to the number of member "PressedThumb"
  223.   if (HilitedIcon <> -1) and (NormalIcon <> -1) then
  224.     set the castNum of sprite ThumbSprt to HilitedIcon
  225.   end if
  226.   HandleThumb()
  227.   if NormalIcon <> -1 then
  228.     set the castNum of sprite ThumbSprt to NormalIcon
  229.   end if
  230. end
  231.  
  232. on DownArrowPressed x
  233.   global ScrollData
  234.   set DwnSprt to integer(item 3 of ScrollData)
  235.   set NormalIcon to the number of member "DownArrow"
  236.   set HilitedIcon to the number of member "PressedDownArrow"
  237.   if (HilitedIcon <> -1) and (NormalIcon <> -1) then
  238.     set the castNum of sprite DwnSprt to HilitedIcon
  239.   end if
  240.   HandleScrollDown(x)
  241.   if NormalIcon <> -1 then
  242.     set the castNum of sprite DwnSprt to NormalIcon
  243.   end if
  244. end
  245.  
  246. on UpArrowPressed x
  247.   global ScrollData
  248.   set UpSprt to integer(item 2 of ScrollData)
  249.   set NormalIcon to the number of member "UpArrow"
  250.   set HilitedIcon to the number of member "PressedUpArrow"
  251.   if (HilitedIcon <> -1) and (NormalIcon <> -1) then
  252.     set the castNum of sprite UpSprt to HilitedIcon
  253.   end if
  254.   HandleScrollUp(x)
  255.   if NormalIcon <> -1 then
  256.     set the castNum of sprite UpSprt to NormalIcon
  257.   end if
  258. end
  259.