home *** CD-ROM | disk | FTP | other *** search
- property ioFieldList, iFieldFocus, ioFIeldFocus, iCurrentMotionStyleIndex, iCurrentVisualStyleIndex, ikMotionIn, ikMotionOut, ikMotionOutThenIn, ikMotionInThenOut, iFirstTime, iSaveSeconds, iSaveFPS, iSaveBaseline, iSaveDelayEnter, iSaveDelayHold, iSaveMark, iSaveCycles, iSaveSizeMin, iSaveSizeMax
-
- on birth me
- global goZoomsText, goSeconds, goFPS, goBaseline, goSizeMin, goSizeMax, goDelayEnter, goDelayHold, goCycles
- set ioFieldList to [goZoomsText, goSeconds, goFPS, goSizeMin, goSizeMax, goBaseline, goDelayEnter, goDelayHold, goCycles]
- set ikMotionIn to 1
- set ikMotionOut to 2
- set ikMotionOutThenIn to 3
- set ikMotionInThenOut to 4
- set iCurrentMotionStyleIndex to ikMotionIn
- set iCurrentVisualStyleIndex to 1
- set iFieldFocus to 1
- set iFirstTime to 1
- return me
- end
-
- on mInit me
- global goSeconds, goFPS, goBaseline, goSizeMin, goSizeMax, goDelayEnter, goDelayHold, goCycles, goZooms, goMarkFrame, goVisualStyles, goMotionStyles, goScoreMgr
- mInit(goMarkFrame, 4)
- if iFirstTime then
- mSetValue(goSeconds, 5)
- mSetValue(goFPS, 5)
- set defaultBaseLine to integer(mGetStageHeight(goScoreMgr) / 2)
- mSetValue(goBaseline, defaultBaseLine)
- mSetValue(goSizeMin, 1)
- mSetValue(goSizeMax, 100)
- mSetValue(goDelayEnter, 0)
- mSetValue(goDelayHold, 0)
- mSetValue(goCycles, 1)
- mSetValue(goMarkFrame, 1)
- set iFirstTime to 0
- else
- mSetValue(goSeconds, iSaveSeconds)
- mSetValue(goFPS, iSaveFPS)
- mSetValue(goBaseline, iSaveBaseline)
- mSetValue(goSizeMin, iSaveSizeMin)
- mSetValue(goSizeMax, iSaveSizeMax)
- mSetValue(goDelayEnter, iSaveDelayEnter)
- mSetValue(goDelayHold, iSaveDelayHold)
- mSetValue(goCycles, iSaveCycles)
- mSetValue(goMarkFrame, iSaveMark)
- end if
- set ioFIeldFocus to getAt(ioFieldList, iFieldFocus)
- set goMotionStyles to 0
- set goMotionStyles to birth(script "RadioButton", 26, 4, 0, iCurrentMotionStyleIndex)
- if the machineType < 256 then
- mInit(goVisualStyles, the number of member "ZoomsVisualStylesMac", iCurrentVisualStyleIndex, 8, 19)
- else
- mInit(goVisualStyles, the number of member "ZoomsVisualStylesPC", iCurrentVisualStyleIndex, 8, 19)
- end if
- set the keyDownScript to "mCheckKey(goZooms)"
- end
-
- on mSetFieldFocus me, oWhom
- set where to getOne(ioFieldList, oWhom)
- if where = 0 then
- alert("Internal error - mSetFieldFocus could not find object")
- return
- end if
- set iFieldFocus to where
- set ioFIeldFocus to getAt(ioFieldList, iFieldFocus)
- end
-
- on mCheckKey me
- if the key = TAB then
- set iFieldFocus to IncrMod(iFieldFocus, count(ioFieldList))
- set ioFIeldFocus to getAt(ioFieldList, iFieldFocus)
- pass()
- else
- if iFieldFocus = 1 then
- pass()
- else
- if (offset(the key, "0123456789") > 0) or (the key = BACKSPACE) then
- pass()
- else
- dontPassEvent()
- end if
- end if
- end if
- end
-
- on mSetNewMotionStyle me, theNewStyleIndex
- set iCurrentMotionStyleIndex to theNewStyleIndex
- end
-
- on mSetNewVisualStyle me, theNewStyleIndex
- set iCurrentVisualStyleIndex to theNewStyleIndex
- end
-
- on mValidate me
- global goSizeMin, goSizeMax
- if mGetValue(goSizeMin) > mGetValue(goSizeMax) then
- alert("The minimum size must be less than the maximum size.")
- return 0
- end if
- set lastFieldOKFlag to mValidate(ioFIeldFocus)
- return lastFieldOKFlag
- end
-
- on mCreate me
- global goMarkFrame, goMotionStyles, goVisualStyles, goScoreMgr, goCastMgr, gDevelopmentFlag, gCastNumTextAsBitmap, goPlatform
- if not mValidate(me) then
- return
- end if
- if field "ZoomsText" = EMPTY then
- alert("Please enter some text for the Zoom.")
- return
- end if
- tell the stage
- set theStageFrame to the frame
- end tell
- set castNumVisualStyle to mGetCastNum(goVisualStyles, iCurrentVisualStyleIndex)
- set theVisualStyleName to the name of cast castNumVisualStyle
- set theFont to word 2 of theVisualStyleName
- set theSize to word 3 of theVisualStyleName
- set theSeconds to integer(field "Seconds")
- set fps to integer(field "FPS")
- set baseLine to integer(field "BaseLine")
- set delayEnter to integer(field "DelayEnter")
- set delayHold to integer(field "DelayHold")
- set nCycles to integer(field "Cycles")
- set markFirst to mGetValue(goMarkFrame)
- set sizeMin to integer(field "SizeMin")
- set sizeMax to integer(field "SizeMax")
- set nFrames to integer(theSeconds * fps)
- if delayHold > 0 then
- set nTotalFrames to (nFrames + 1) * nCycles
- else
- set nTotalFrames to nFrames * nCycles
- end if
- if not mInit(goScoreMgr, nTotalFrames, 1) then
- return
- end if
- set theCh to mGetNextSelectedChannel(goScoreMgr)
- set theFrameNum to mGetStartFrame(goScoreMgr)
- set castNumSource to mModifyRichTextCM(goCastMgr, the text of field "ZoomsText", theFont, theSize)
- if castNumSource = 0 then
- return
- end if
- set the picture of member gCastNumTextAsBitmap to the picture of member castNumSource
- set widthOfTextAsBitmap to float(the width of member gCastNumTextAsBitmap)
- set heightOfTextAsBitmap to float(the height of member gCastNumTextAsBitmap)
- set pctMin to float(sizeMin) / 100.0
- set pctMax to float(sizeMax) / 100.0
- set pctInc to (pctMax - pctMin) / float(nFrames - 1)
- if (iCurrentMotionStyleIndex = ikMotionIn) or (iCurrentMotionStyleIndex = ikMotionOut) then
- set nFrames1 to nFrames
- set nFrames2 to 0
- else
- set nFrames1 to integer(nFrames / 2)
- set nFrames2 to nFrames - nFrames1
- set pctInc to pctInc * 2
- end if
- if (iCurrentMotionStyleIndex = ikMotionIn) or (iCurrentMotionStyleIndex = ikMotionInThenOut) then
- set pctStart1 to pctMin
- set pctInc1 to pctInc
- set pctStart2 to pctMax
- set pctInc2 to pctInc * -1.0
- else
- set pctStart1 to pctMax
- set pctInc1 to pctInc * -1.0
- set pctStart2 to pctMin
- set pctInc2 to pctInc
- end if
- set theForeColor to 255
- set theBackColor to 0
- set castNumTarget to mFindFreeCastRun(goCastMgr, 1, 1)
- copyToClipBoard(member gCastNumTextAsBitmap)
- tell the stage
- pasteClipBoardInto(member castNumTarget)
- set the name of member castNumTarget to "BitMap" && string(the ticks)
- end tell
- set frameList to []
- repeat with i = theFrameNum to theFrameNum + nTotalFrames - 1
- add(frameList, [i])
- end repeat
- if markFirst then
- set firstFrame to getAt(frameList, 1)
- set theLabel to "AW.Zoom." & word 1 of the text of field "ZoomsText" & " " & mGetGeneratedScoreSelection(goScoreMgr)
- add(firstFrame, [#label, theLabel])
- setAt(frameList, 1, firstFrame)
- end if
- set relFrameCount to 1
- repeat with thisCycle = 1 to nCycles
- set xLoc to round(mGetStageWidth(goScoreMgr) / 2)
- set yLoc to baseLine
- set currentPct to pctStart1
- set theWidth to currentPct * widthOfTextAsBitmap
- set theHeight to currentPct * heightOfTextAsBitmap
- set firstFrame to getAt(frameList, relFrameCount)
- set secondFrame to getAt(frameList, relFrameCount + 1)
- if delayEnter > 0 then
- add(firstFrame, [#tempo, -delayEnter])
- add(secondFrame, [#tempo, fps])
- else
- add(firstFrame, [#tempo, fps])
- add(secondFrame, [#tempo, 0])
- end if
- setAt(frameList, relFrameCount, firstFrame)
- setAt(frameList, relFrameCount + 1, secondFrame)
- repeat with thisFrame = 1 to nFrames1
- set theWidth to integer(theWidth + 0.49000000000000005)
- set theHeight to integer(theHeight + 0.49000000000000005)
- set currentFrame to getAt(frameList, relFrameCount)
- add(currentFrame, [#sprite, theCh, castNumTarget, theForeColor, theBackColor, xLoc, yLoc, theWidth, theHeight])
- setAt(frameList, relFrameCount, currentFrame)
- set theFrameNum to theFrameNum + 1
- set currentPct to currentPct + pctInc1
- set theWidth to currentPct * widthOfTextAsBitmap
- set theHeight to currentPct * heightOfTextAsBitmap
- set relFrameCount to relFrameCount + 1
- end repeat
- if delayHold > 0 then
- set currentFrame to getAt(frameList, relFrameCount)
- add(currentFrame, [#tempo, -delayHold])
- set theWidth to integer(theWidth + 0.49000000000000005)
- set theHeight to integer(theHeight + 0.49000000000000005)
- add(currentFrame, [#sprite, theCh, castNumTarget, theForeColor, theBackColor, xLoc, yLoc, theWidth, theHeight])
- setAt(frameList, relFrameCount, currentFrame)
- set theFrameNum to theFrameNum + 1
- set relFrameCount to relFrameCount + 1
- end if
- if nFrames2 > 0 then
- set currentPct to pctStart2
- set theWidth to currentPct * widthOfTextAsBitmap
- set theHeight to currentPct * heightOfTextAsBitmap
- repeat with thisFrame = 1 to nFrames2
- set theWidth to integer(theWidth + 0.49000000000000005)
- set theHeight to integer(theHeight + 0.49000000000000005)
- set currentFrame to getAt(frameList, relFrameCount)
- add(currentFrame, [#sprite, theCh, castNumTarget, theForeColor, theBackColor, xLoc, yLoc, theWidth, theHeight])
- setAt(frameList, relFrameCount, currentFrame)
- set theFrameNum to theFrameNum + 1
- set currentPct to currentPct + pctInc2
- set theWidth to currentPct * widthOfTextAsBitmap
- set theHeight to currentPct * heightOfTextAsBitmap
- set relFrameCount to relFrameCount + 1
- end repeat
- end if
- end repeat
- mWriteFrame(goScoreMgr, frameList)
- set labelName to "Zooms" & goPlatform
- go(label(labelName) + 2)
- if not gDevelopmentFlag then
- tell the stage
- go(theStageFrame)
- end tell
- end if
- mClean(goScoreMgr)
- end
-
- on mCleanUp me
- global goMotionStyles, goSeconds, goFPS, goBaseline, goSizeMin, goSizeMax, goDelayEnter, goDelayHold, goCycles, goMarkFrame
- mCleanUp(goMotionStyles)
- set iSaveSeconds to mGetValue(goSeconds)
- set iSaveFPS to mGetValue(goFPS)
- set iSaveBaseline to mGetValue(goBaseline)
- set iSaveSizeMin to mGetValue(goSizeMin)
- set iSaveSizeMax to mGetValue(goSizeMax)
- set iSaveDelayEnter to mGetValue(goDelayEnter)
- set iSaveDelayHold to mGetValue(goDelayHold)
- set iSaveCycles to mGetValue(goCycles)
- set iSaveMark to mGetValue(goMarkFrame)
- mCleanUp(goMarkFrame)
- end
-