home *** CD-ROM | disk | FTP | other *** search
/ Inventor Labs: Technology / INVENTORLABS_TECHNOLOGY.BIN / mac / FILES / TIMELN.DIR / 00003_Script_TimeLineParent < prev    next >
Text File  |  1997-05-26  |  8KB  |  230 lines

  1. --p TimeLine
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8. -- All three sprite use
  9. property pStartSprite, pEndSprite, pTLrectDB, pRowIndex, pRectPos
  10. property pCurrRolloverSprite, pActiveRect, pBoxLoc, pActiveItem
  11.  
  12. -- Rollover Text
  13. property pRolloverBoxSprite,pRolloverBoxOffset
  14.  
  15. -- click box
  16. property pBoxActive, pBoxStartCast, pBoxSprite, pBoxOffset, pRolloverStartCast, pInvRolloverStartCast
  17.  
  18. -- text box
  19. property pTextSpriteOffset, pTextSpriteNum, pTimelineText,pTextCast
  20.  
  21. property pInventorSym, pEdisonRollStrCst
  22.  
  23. global gUtilityObj
  24. -----------------------------------------------------------------------------------------------------------------------
  25. on mInit me, TLrectDB,TimelineText, RolloverStartCast, InventorSym
  26.   
  27.   
  28.   set pTLrectDB = value(the text of cast TLrectDB)
  29.   set pTimelineText = the text of cast TimelineText
  30.   set pRolloverStartCast = the number of cast RolloverStartCast
  31.   
  32.   set pInventorSym = InventorSym
  33.   set pEdisonRollStrCst = the number of cast "TEINV1.PIC"
  34.   
  35.   set pRolloverBoxOffset = point(94,61)  --20
  36.   set pTextSpriteOffset = point(-80,49)
  37.   set pBoxOffset = point(0,59)
  38.   
  39.   set pTextCast = the number of cast "TimeLineDisplayText"
  40.   set the textheight of field "TimeLineDisplayText" = 13
  41.   
  42.   set pBoxStartCast = the number of cast "TDLBK.PIC"
  43.   
  44.   -- sprites
  45.   set pStartSprite = 4
  46.   set pEndSprite = pStartSprite + 4
  47.   set pTextSpriteNum = pStartSprite + 8 
  48.   
  49.   set pBoxSprite = pStartSprite + 7 
  50.   set pRolloverBoxSprite = pStartSprite + 6
  51.   
  52.   
  53.   puppetsprite pTextSpriteNum, TRUE
  54.   puppetsprite pBoxSprite, TRUE
  55.   puppetsprite pRolloverBoxSprite, TRUE
  56.   
  57.   -- Initial States
  58.   set pCurrRolloverSprite = 0
  59.   set pActiveRect = 0
  60.   set pRectPos = 0
  61.   set pActiveItem = 0
  62.   set pBoxActive = FALSE
  63.   
  64.   -- Rollover To Index Cast
  65.   set pRowIndex = []
  66.   set indexnum = 0
  67.   repeat with currlist in pTLrectDB
  68.     append(pRowIndex, indexnum)
  69.     set indexnum = indexnum + count(currlist)
  70.   end repeat
  71.   
  72.   return( me )
  73.   
  74. end mInit
  75. -----------------------------------------------------------------------------------------------------------------------
  76. on mPerform me
  77.   
  78.   if not pBoxActive then 
  79.     set done = FALSE
  80.     if (pCurrRolloverSprite <> 0) then 
  81.       if rollover(pCurrRolloverSprite) then set done = TRUE
  82.     end if
  83.     
  84.     if not done then 
  85.       
  86.       set SpriteToCheck = pStartSprite
  87.       repeat while (not done) and (SpriteToCheck <= pEndSprite)
  88.         if rollover( SpriteToCheck ) then set done = TRUE
  89.         else set SpriteToCheck = SpriteToCheck + 1
  90.       end repeat
  91.       
  92.       if done then set pCurrRolloverSprite = SpriteToCheck
  93.       else set pCurrRolloverSprite = 0
  94.       
  95.     end if
  96.     
  97.     if (pCurrRolloverSprite = 0) then 
  98.       set pActiveRect = 0
  99.       mPlaceBox ( me, pActiveRect, 0 )
  100.     else mGetTimeRect( me, getat( pTLrectDB, pCurrRolloverSprite - pStartSprite + 1 ) )
  101.     
  102.   end if
  103.   
  104. end mPerform
  105. -----------------------------------------------------------------------------------------------------------------------
  106. on mGetTimeRect me, RectList
  107.   
  108.   set mouseloc = point(the mouseh,the mousev)
  109.   set RectFound = #FALSE
  110.   if (pActiveRect <> 0) then
  111.     if inside(mouseloc, pActiveRect) then set RectFound = #PREV
  112.   end if
  113.   
  114.   if not  (RectFound = #PREV) then
  115.     set pRectPos = 1
  116.     set NumOfPositions = count( RectList )                             -- Linear Iteration due to time constraints: Quicksort on mouseH
  117.     repeat while ( RectFound = #FALSE) and (pRectPos <= NumOfPositions)
  118.       set PossibleRect = getat(RectList ,pRectPos)
  119.       if inside(mouseloc, PossibleRect) then 
  120.         set RectFound = #TRUE
  121.       else set pRectPos = pRectPos + 1
  122.     end repeat
  123.     
  124.     
  125.     if (RectFound = #FALSE) then set pActiveRect = 0
  126.     else set pActiveRect = PossibleRect
  127.     
  128.     mPlaceBox ( me, pActiveRect )
  129.   end if
  130.   
  131. end mGetTimeRect
  132. -----------------------------------------------------------------------------------------------------------------------
  133. on mPlaceBox me, RectOver
  134.   
  135.   if (rectOver <> 0) then
  136.     set loch = getat(RectOver,1)
  137.     set locv = getat(RectOver,2)
  138.     
  139.     if loch >= 380 then set loch = loch - 182
  140.     
  141.     if locv >= 360 then set locv = locv - 111          -- Inventor
  142.     else if locv >= 300 then                                    -- Science
  143.       
  144.       set locv = locv - 111
  145.       if loch <= 380 then set loch = loch + 1
  146.       
  147.     else  if locv >= 220 then                                     -- Arts                     
  148.       
  149.       set locv = locv - 4
  150.       if loch <= 380 then set loch = loch + 1
  151.       else  set loch = loch - 2
  152.       
  153.     else if locv >= 170 then 
  154.       
  155.       if loch <= 380 then set loch = loch + 1
  156.       
  157.     end if
  158.     
  159.     set pBoxLoc = point(loch,locv) + pRolloverBoxOffset
  160.     set the loc of sprite pRolloverBoxSprite = pBoxLoc
  161.     
  162.     if (pInventorSym = #EDISON) and ((pCurrRolloverSprite - pStartSprite) + 1) = 5 then
  163.       set pActiveItem =  pRectPos - 1
  164.       set the castnum of sprite pRolloverBoxSprite = pActiveItem + pEdisonRollStrCst
  165.     else 
  166.       set pActiveItem = getat(pRowIndex,(pCurrRolloverSprite - pStartSprite) + 1) + pRectPos - 1
  167.       set the castnum of sprite pRolloverBoxSprite = pActiveItem + pRolloverStartCast 
  168.     end if
  169.     mSetCursors( gUtilityObj, [2:#TMLN])
  170.   else 
  171.     mUnSetCursors( gUtilityObj )
  172.     set the locv of sprite pRolloverBoxSprite = -1000
  173.   end if
  174.   
  175. end mPlaceBox
  176. ----------------------------------------------------------------------------------------------------------------------
  177. on mClick me
  178.   
  179.   
  180.   if pBoxActive then
  181.     
  182.     set pActiveRect = 0
  183.     set pBoxActive = FALSE
  184.     set the locv of sprite pBoxSprite = -1000
  185.     set the locv of sprite pTextSpriteNum = -1000
  186.     set the locv of sprite pRolloverBoxSprite = -1000
  187.     set pCurrRolloverSprite = 0
  188.     updatestage
  189.     
  190.   else if (pActiveRect <> 0) then
  191.     
  192.     set the castnum of sprite pBoxSprite = pBoxStartCast + (pCurrRolloverSprite - pStartSprite)
  193.     
  194.     if (pCurrRolloverSprite >= pStartSprite + 3) then
  195.       set boxoffset =  point(0,98)
  196.       set the loc of sprite pRolloverBoxSprite = pBoxLoc -boxoffset
  197.       set the loc of sprite pBoxSprite = pBoxLoc + pBoxOffset  - boxoffset
  198.       set the loc of sprite pTextSpriteNum = pBoxLoc + pTextSpriteOffset   - boxoffset
  199.       set the loc of sprite pTextSpriteNum = pBoxLoc + pTextSpriteOffset  -boxoffset
  200.     else 
  201.       set the loc of sprite pBoxSprite = pBoxLoc + pBoxOffset
  202.       set the loc of sprite pTextSpriteNum = pBoxLoc + pTextSpriteOffset
  203.     end if
  204.     
  205.     if (pInventorSym = #EDISON) and ((pCurrRolloverSprite - pStartSprite) + 1) = 5 then
  206.       set EdisonTempActive = pActiveItem
  207.       set pActiveItem = getat(pRowIndex,(pCurrRolloverSprite - pStartSprite) + 1) + pRectPos  -- one off likely in db
  208.     end if
  209.     set whatline =  (pActiveItem * 2) + 2
  210.     set pActiveItem = EdisonTempActive
  211.     set the text of cast pTextCast = line whatline to whatline of pTimelineText
  212.     set the castnum of sprite pTextSpriteNum = pTextCast
  213.     set pBoxActive = TRUE
  214.     mSetCursors( gUtilityObj, [2:#RETURN])
  215.     
  216.   end if
  217.   
  218. end mClick
  219. ----------------------------------------------------------------------------------------------------------------------
  220. on mClose me
  221.   
  222.   puppetsprite pTextSpriteNum, FALSE
  223.   puppetsprite pBoxSprite, FALSE
  224.   puppetsprite pRolloverBoxSprite, FALSE
  225.   mUnSetCursors( gUtilityObj)
  226.   
  227. end mClose
  228. -----------------------------------------------------------------------------------------------------------------------
  229. --1790 on come up on the left
  230. -- Science & Tech below comup on the bottom