home *** CD-ROM | disk | FTP | other *** search
- on startMovie
- global gPhotoSprite, gPhotoTitleSprite, gPhotoNumSprite, gPhotoLeftSprite, gPhotoRightSprite, gCaptionSprite, gZoomBox, gZoomSprite, gIndexSprite, gUtensilsSprite, gNutritionSprite, gOtherSprite, gTermSprite, gTermTitleSprite, gUtensilTitleSprite, gUtensilPICSprite, gUtensilTextSprite, gNutritionList, gTableList, gLastTermRecipe, gCurrentTermLine, gLastUtensilLine, gLastFoodLine, gLastTableLine, gLastRowLine, gLastTermsIndexButton, gHelpSprite, gFromRecipeP, gHyperTerm
- set the textHeight of field "term scroll" to 12
- set the textHeight of field "table text scroll" to 14
- set gPhotoSprite to 16
- set gPhotoTitleSprite to 17
- set gPhotoNumSprite to 18
- set gPhotoLeftSprite to 19
- set gPhotoRightSprite to 20
- set gCaptionSprite to 3
- set gZoomBox to 45
- set gZoomSprite to 46
- set gIndexSprite to 2
- set gUtensilsSprite to 2
- set gNutritionSprite to 2
- set gOtherSprite to 2
- set gTermSprite to 4
- set gTermTitleSprite to 33
- set gUtensilTitleSprite to 16
- set gUtensilPICSprite to 17
- set gUtensilTextSprite to 18
- set gNutritionList to [29, 30, 31, 32, 33, 34, 35, 36, 37, 38]
- set gTableList to [3, 4, 21, 22]
- set gLastTermRecipe to 2
- set gCurrentTermLine to 2
- set gLastUtensilLine to 0
- set gLastFoodLine to 0
- set gLastTableLine to 0
- set gLastRowLine to 0
- set gLastTermsIndexButton to 0
- set gHelpSprite to 48
- helpOff()
- set selection to 3
- if gFromRecipeP then
- DBTermLinks()
- set the textStyle of line 1 of field "term scroll" to "plain"
- put field "recipe terms" into field "term scroll"
- else
- set gHyperTerm to 0
- end if
- set the textStyle of line 1 of field "term scroll" to "underline"
- termsIndex()
- end
-
- on stopMovie
- cleanLegos()
- set the keyDownScript to EMPTY
- end
-
- on termsIndex
- global gHyperTerm, gCurrentTermLine
- set the keyDownScript to "keyScroll"
- termOff()
- zoomOff()
- cleanLegos()
- go("terms index")
- makeButtons()
- makeIndexButtons()
- makeIndexScroll()
- if gCurrentTermLine > 2 then
- set selection to gCurrentTermLine
- hyperScroll(selection)
- else
- if stringp(gHyperTerm) then
- set selection to findHyperNum()
- hyperScroll(selection)
- else
- set selection to 3
- end if
- end if
- selectTerm(selection)
- end
-
- on allterms
- global gCurrentTermLine, gKeySequence, gIndexScroll, gIndexSprite
- set gCurrentTermLine to 2
- set gKeySequence to EMPTY
- termOff()
- set the visible of sprite gIndexSprite to 0
- controlPosition(gIndexScroll, 0.0)
- set the textStyle of line 1 of field "term scroll" to "plain"
- put field "all terms" into field "term scroll"
- set the textStyle of line 1 of field "term scroll" to "underline"
- set the visible of sprite gIndexSprite to 1
- selectTerm(3)
- end
-
- on recipeterms
- global gCurrentTermLine, gKeySequence, gIndexScroll, gIndexSprite
- set gCurrentTermLine to 2
- set gKeySequence to EMPTY
- DBTermLinks()
- termOff()
- set the visible of sprite gIndexSprite to 0
- controlPosition(gIndexScroll, 0.0)
- set the textStyle of line 1 of field "term scroll" to "plain"
- put field "recipe terms" into field "term scroll"
- set the textStyle of line 1 of field "term scroll" to "underline"
- set the visible of sprite gIndexSprite to 1
- selectTerm(3)
- end
-
- on utensils
- helpOff()
- utensilOff()
- cleanLegos()
- set the keyDownScript to EMPTY
- go("utensils")
- makeButtons()
- makeUtensilScroll()
- selectUtensil(1)
- end
-
- on nutrition
- helpOff()
- nutritionOff()
- cleanLegos()
- set the keyDownScript to EMPTY
- go("nutrition")
- makeButtons()
- makeNutritionScroll()
- selectFood(1)
- end
-
- on substitutions
- helpOff()
- cleanLegos()
- set the keyDownScript to EMPTY
- go("substitution")
- makeButtons()
- makeOtherScroll()
- end
-
- on conversions
- helpOff()
- cleanLegos()
- set the keyDownScript to EMPTY
- go("conversions")
- makeButtons()
- makeOtherScroll()
- end
-
- on equivalents
- helpOff()
- cleanLegos()
- set the keyDownScript to EMPTY
- go("equivalents")
- makeButtons()
- makeOtherScroll()
- end
-
- on tables
- helpOff()
- tableOff()
- cleanLegos()
- set the keyDownScript to EMPTY
- go("tables")
- makeButtons()
- makeTableScroll()
- selectTable(1)
- end
-
- on selectTerm lineNum
- global gTermScroll, gTermIDDB, gCurrentTermLine
- if lineNum < 3 then
- exit
- end if
- if gCurrentTermLine = lineNum then
- zoomOff()
- selectPhoto(1)
- termOn()
- exit
- end if
- set theTerm to line lineNum of field "term scroll"
- if theTerm = EMPTY then
- exit
- end if
- zoomOff()
- termOff()
- set gCurrentTermLine to lineNum
- controlPosition(gTermScroll, 0.0)
- set termID to getProp(gTermIDDB, theTerm)
- DBTermDefinition(termID)
- put theTerm into field "term title"
- selectPhoto(1)
- termOn()
- end
-
- on browsePhoto direction
- global gTermPhotoList, gPhotoFile
- set photoCount to count(gTermPhotoList)
- set pos to getPos(gTermPhotoList, gPhotoFile)
- set newPos to pos + direction
- if newPos < 1 then
- set newPos to photoCount
- else
- if newPos > photoCount then
- set newPos to 1
- end if
- end if
- selectPhoto(newPos)
- end
-
- on selectPhoto num
- global gPhotoSprite, gPhotoTitleSprite, gPhotoNumSprite, gPhotoLeftSprite, gPhotoRightSprite, gTermPhotoList, gPicZoom, gTermFolder, gPhotoFile
- set photoCount to count(gTermPhotoList)
- if photoCount > 0 then
- set aFileName to getAt(gTermPhotoList, num)
- set gPhotoFile to aFileName
- set page to integer(char 4 to 6 of aFileName)
- repeat with i = 1 to 15
- set test to i * 30
- if page < test then
- set folderNum to test - 1
- if folderNum < 100 then
- put "0" before folderNum
- end if
- set gTermFolder to "TERMS" & folderNum
- exit repeat
- end if
- end repeat
- loadLILPIC("TERMS", gTermFolder, aFileName, "term pic")
- set captionID to getOne(gTermPhotoList, gPhotoFile)
- DBPhotoName(captionID)
- put num & " of " & photoCount into field "photo number"
- set the visible of sprite gPhotoSprite to 1
- set the visible of sprite gPhotoTitleSprite to 1
- if photoCount > 1 then
- set the visible of sprite gPhotoNumSprite to 1
- set the visible of sprite gPhotoLeftSprite to 1
- set the visible of sprite gPhotoRightSprite to 1
- end if
- end if
- end
-
- on selectUtensil lineNum
- global gUtensilIDDB, gLastUtensilLine
- if lineNum < 1 then
- exit
- end if
- if gLastUtensilLine = lineNum then
- utensilOn()
- exit
- end if
- set theUtensil to line lineNum of field "utensils"
- if theUtensil = EMPTY then
- exit
- end if
- utensilOff()
- set gLastUtensilLine to lineNum
- set utensilID to getProp(gUtensilIDDB, theUtensil)
- put theUtensil into field "utensil title"
- DBUtensil(utensilID)
- if utensilID < 10 then
- put "0" before utensilID
- end if
- set aFileName to "UT0" & utensilID
- if utensilID < 40 then
- set aFolder to "UTENSIL1"
- else
- set aFolder to "UTENSIL2"
- end if
- loadPIC("UTENSILS", aFolder, aFileName, "utensil pic")
- utensilOn()
- end
-
- on selectFood lineNum
- global gFoodIDDB, gLastFoodLine
- if lineNum < 1 then
- exit
- end if
- if gLastFoodLine = lineNum then
- nutritionOn()
- exit
- end if
- set theFood to line lineNum of field "foods"
- if theFood = EMPTY then
- exit
- end if
- nutritionOff()
- set gLastFoodLine to lineNum
- set foodID to getProp(gFoodIDDB, theFood)
- DBFoodNutrition(foodID)
- nutritionOn()
- end
-
- on selectTable lineNum
- global gTableIDDB, gLastTableLine, gCurrentTableID, gLastRowLine, gTableScroll2, gTableScroll3, gTableScroll4
- if lineNum < 1 then
- exit
- end if
- if gLastTableLine = lineNum then
- tableOn()
- exit
- end if
- set theTable to line lineNum of field "tables"
- if theTable = EMPTY then
- exit
- end if
- tableOff()
- set gLastTableLine to lineNum
- controlPosition(gTableScroll2, 0.0)
- controlPosition(gTableScroll3, 0.0)
- controlPosition(gTableScroll4, 0.0)
- set gCurrentTableID to getProp(gTableIDDB, theTable)
- set the textStyle of line 1 of field "rows" to "plain"
- set gLastRowLine to 0
- DBTableRows()
- selectRow(1)
- tableOn()
- end
-
- on selectRow lineNum
- global gLastRowLine, gLastTableLine, gTableScroll3
- if lineNum < 1 then
- exit
- end if
- if gLastRowLine = lineNum then
- exit
- end if
- set theRow to line lineNum of field "rows"
- if theRow = EMPTY then
- exit
- end if
- set the textStyle of line gLastRowLine of field "rows" to "plain"
- set gLastRowLine to lineNum
- controlPosition(gTableScroll3, 0.0)
- DBRowItems()
- set the textStyle of line gLastRowLine of field "rows" to "bold"
- end
-
- on zoomPhoto
- global gCaptionSprite, gZoomBox, gZoomSprite, gTermSprite, gTermTitleSprite, gTermFolder, gPhotoFile, gTermPhotoList
- loadPIC("TERMS", gTermFolder, gPhotoFile, "zoom pic")
- set captionID to getOne(gTermPhotoList, gPhotoFile)
- DBPhotoCaption(captionID)
- set the visible of sprite gTermSprite to 0
- set the visible of sprite gTermTitleSprite to 0
- set the visible of sprite gCaptionSprite to 1
- set the visible of sprite gZoomBox to 1
- set the visible of sprite gZoomSprite to 1
- end
-
- on zoomRoll
- set roll to the mouseCast
- if the mouseDown then
- if roll = 43 then
- cursor([1023, 1024])
- else
- cursor(-1)
- end if
- else
- if roll = 43 then
- cursor([1021, 1022])
- else
- cursor(-1)
- end if
- end if
- end
-
- on zoomOff
- global gCaptionSprite, gZoomSprite, gZoomBox
- set the visible of sprite gCaptionSprite to 0
- set the visible of sprite gZoomBox to 0
- set the visible of sprite gZoomSprite to 0
- end
-
- on indexOn
- global gIndexSprite
- set the visible of sprite gIndexSprite to 1
- end
-
- on indexOff
- global gIndexSprite
- set the visible of sprite gIndexSprite to 0
- end
-
- on termOn
- global gTermSprite, gTermTitleSprite, gPhotoSprite, gCurrentTermLine
- set the visible of sprite gTermSprite to 1
- set the visible of sprite gTermTitleSprite to 1
- set the textStyle of line gCurrentTermLine of field "term scroll" to "bold"
- end
-
- on termOff
- global gTermSprite, gTermTitleSprite, gCurrentTermLine, gPhotoSprite, gPhotoTitleSprite, gPhotoNumSprite, gPhotoLeftSprite, gPhotoRightSprite
- set the textStyle of line gCurrentTermLine of field "term scroll" to "plain"
- set the visible of sprite gTermSprite to 0
- set the visible of sprite gTermTitleSprite to 0
- set the visible of sprite gPhotoSprite to 0
- set the visible of sprite gPhotoTitleSprite to 0
- set the visible of sprite gPhotoNumSprite to 0
- set the visible of sprite gPhotoLeftSprite to 0
- set the visible of sprite gPhotoRightSprite to 0
- end
-
- on utensilOn
- global gUtensilTitleSprite, gUtensilPICSprite, gUtensilTextSprite, gLastUtensilLine
- set the visible of sprite gUtensilTitleSprite to 1
- set the visible of sprite gUtensilPICSprite to 1
- set the visible of sprite gUtensilTextSprite to 1
- set the textStyle of line gLastUtensilLine of field "utensils" to "bold"
- end
-
- on utensilOff
- global gUtensilTitleSprite, gUtensilPICSprite, gUtensilTextSprite, gLastUtensilLine
- set the textStyle of line gLastUtensilLine of field "utensils" to "plain"
- set the visible of sprite gUtensilTitleSprite to 0
- set the visible of sprite gUtensilPICSprite to 0
- set the visible of sprite gUtensilTextSprite to 0
- updateStage()
- end
-
- on nutritionOn
- global gNutritionList, gLastFoodLine
- repeat with i in gNutritionList
- set the visible of sprite i to 1
- end repeat
- set the textStyle of line gLastFoodLine of field "foods" to "bold"
- end
-
- on nutritionOff
- global gNutritionList, gLastFoodLine
- set the textStyle of line gLastFoodLine of field "foods" to "plain"
- repeat with i in gNutritionList
- set the visible of sprite i to 0
- end repeat
- end
-
- on tableOn
- global gLastTableLine, gTableList
- repeat with i in gTableList
- set the visible of sprite i to 1
- end repeat
- set the textStyle of line gLastTableLine of field "tables" to "bold"
- end
-
- on tableOff
- global gLastTableLine, gTableList
- set the textStyle of line gLastTableLine of field "tables" to "plain"
- repeat with i in gTableList
- set the visible of sprite i to 0
- end repeat
- end
-
- on makeIndexScroll
- global gIndexScroll, gTermScroll, gIndexSprite, gTermSprite
- set track to new("Button", [#spriteChan: 24])
- set ball to new("Button", [#spriteChan: 25, #pressedCast: 66])
- set up to new("Button", [#spriteChan: 26, #pressedCast: 68])
- set down to new("Button", [#spriteChan: 27, #pressedCast: 70])
- set gIndexScroll to new("ScrollBar", [#scrollSprite: gIndexSprite, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
- set track to new("Button", [#spriteChan: 28])
- set ball to new("Button", [#spriteChan: 29, #pressedCast: 66])
- set up to new("Button", [#spriteChan: 30, #pressedCast: 68])
- set down to new("Button", [#spriteChan: 31, #pressedCast: 70])
- set gTermScroll to new("ScrollBar", [#scrollSprite: gTermSprite, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
- end
-
- on makeUtensilScroll
- global gUtensilScroll, gUtensilsSprite
- set track to new("Button", [#spriteChan: 24])
- set ball to new("Button", [#spriteChan: 25, #pressedCast: 66])
- set up to new("Button", [#spriteChan: 26, #pressedCast: 68])
- set down to new("Button", [#spriteChan: 27, #pressedCast: 70])
- set gUtensilScroll to new("ScrollBar", [#scrollSprite: gUtensilsSprite, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
- end
-
- on makeNutritionScroll
- global gNutritonScroll, gNutritionSprite
- set track to new("Button", [#spriteChan: 24])
- set ball to new("Button", [#spriteChan: 25, #pressedCast: 66])
- set up to new("Button", [#spriteChan: 26, #pressedCast: 68])
- set down to new("Button", [#spriteChan: 27, #pressedCast: 70])
- set gNutritionScroll to new("ScrollBar", [#scrollSprite: gNutritionSprite, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
- end
-
- on makeOtherScroll
- global gOtherScroll, gOtherSprite
- set track to new("Button", [#spriteChan: 24])
- set ball to new("Button", [#spriteChan: 25, #pressedCast: 66])
- set up to new("Button", [#spriteChan: 26, #pressedCast: 68])
- set down to new("Button", [#spriteChan: 27, #pressedCast: 70])
- set gOtherScroll to new("ScrollBar", [#scrollSprite: gOtherSprite, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
- end
-
- on makeTableScroll
- global gTableScroll1, gTableScroll2, gTableScroll3, gTableScroll4
- set track to new("Button", [#spriteChan: 24])
- set ball to new("Button", [#spriteChan: 25, #pressedCast: 66])
- set up to new("Button", [#spriteChan: 26, #pressedCast: 68])
- set down to new("Button", [#spriteChan: 27, #pressedCast: 70])
- set gTableScroll1 to new("ScrollBar", [#scrollSprite: 2, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
- set track to new("Button", [#spriteChan: 28])
- set ball to new("Button", [#spriteChan: 29, #pressedCast: 66])
- set up to new("Button", [#spriteChan: 30, #pressedCast: 68])
- set down to new("Button", [#spriteChan: 31, #pressedCast: 70])
- set gTableScroll2 to new("ScrollBar", [#scrollSprite: 3, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
- set track to new("Button", [#spriteChan: 32])
- set ball to new("Button", [#spriteChan: 33, #pressedCast: 66])
- set up to new("Button", [#spriteChan: 34, #pressedCast: 68])
- set down to new("Button", [#spriteChan: 35, #pressedCast: 70])
- set gTableScroll3 to new("ScrollBar", [#scrollSprite: 4, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
- set track to new("Button", [#spriteChan: 36])
- set ball to new("Button", [#spriteChan: 37, #pressedCast: 66])
- set up to new("Button", [#spriteChan: 38, #pressedCast: 68])
- set down to new("Button", [#spriteChan: 39, #pressedCast: 70])
- set gTableScroll4 to new("ScrollBar", [#scrollField: "table text", #scrollFieldOut: 21, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
- end
-
- on hyperScroll lineNum
- global gIndexScroll
- set denom to the number of lines in field "term scroll" - 3
- if denom = 0 then
- set aRatio to 0
- else
- set aRatio to float(lineNum - 3) / denom
- end if
- controlPosition(gIndexScroll, aRatio)
- end
-
- on findHyperNum
- global gHyperTerm
- set hyperLine to 3
- set terms to field "recipe terms"
- set num to the number of lines in terms
- repeat with i = 1 to num
- if gHyperTerm = line i of terms then
- set hyperLine to i
- exit repeat
- end if
- end repeat
- return hyperLine
- end
-
- on keyScroll
- global gKeySequence, gCurrentTermLine
- if "abcdefghijklmnopqrstuvwxyz " contains the key then
- put the key after gKeySequence
- if length(gKeySequence) > 1 then
- findKeyLine(gCurrentTermLine)
- else
- findKeyLine(3)
- end if
- else
- if the key = BACKSPACE then
- delete char -30000 of gKeySequence
- findKeyLine(3)
- end if
- end if
- end
-
- on findKeyLine begin
- global gIndexScroll, gKeySequence
- cursor(4)
- set Index to field "term scroll"
- set num to the number of lines in Index
- if gKeySequence <> EMPTY then
- set keyCount to length(gKeySequence)
- repeat with i = begin to num
- if char 1 to keyCount of line i of Index = gKeySequence then
- set keyLine to i
- exit repeat
- end if
- end repeat
- end if
- if keyLine > 2 then
- hyperScroll(keyLine)
- selectTerm(keyLine)
- else
- set gKeySequence to EMPTY
- hyperScroll(3)
- selectTerm(3)
- end if
- cursor(-1)
- end
-
- on makeButtons
- global gBackButton, gMainButton, gHelpButton, gTermsButton, gUtensilsButton, gSubstitutionsButton, gNutritionButton, gEquivalentsButton, gConversionsButton, gTablesButton
- set gBackButton to birth(script "GACButton", 7)
- set gHelpButton to birth(script "GACButton", 15)
- set gMainButton to birth(script "GACButton", 6)
- set gTermsButton to birth(script "radioButton", 8)
- set gUtensilsButton to birth(script "radioButton", 9)
- set gSubstitutionsButton to birth(script "radioButton", 10)
- set gNutritionButton to birth(script "radioButton", 11)
- set gEquivalentsButton to birth(script "radioButton", 12)
- set gConversionsButton to birth(script "radioButton", 13)
- set gTablesButton to birth(script "radioButton", 14)
- end
-
- on makeIndexButtons
- global gLeftButton, gRightButton, gAllTermsButton, gRecipeTermsButton, gLastTermsIndexButton, gFromRecipeP
- set gLeftButton to birth(script "GACButton", 19)
- set gRightButton to birth(script "GACButton", 20)
- set gAllTermsButton to birth(script "termsIndexButton", 21)
- set gRecipeTermsButton to birth(script "termsIndexButton", 22)
- if objectp(gLastTermsIndexButton) then
- select(gLastTermsIndexButton)
- else
- if gFromRecipeP then
- select(gRecipeTermsButton)
- else
- select(gAllTermsButton)
- end if
- end if
- end
-
- on hyperTable
- set aLine to line the mouseLine of field "term text"
- if aLine starts "Click here" then
- delete word 1 to 5 of aLine
- delete char -30001 of aLine
- delete char -30000 of aLine
- tables()
- findTableLine(aLine)
- put aLine
- end if
- end
-
- on findTableLine aLine
- global gIndexScroll
- cursor(4)
- set Index to field "tables"
- set num to the number of lines in Index
- repeat with i = 1 to num
- if line i of Index = aLine then
- set tableLine to i
- exit repeat
- end if
- end repeat
- hyperTableScroll(tableLine)
- selectTable(tableLine)
- cursor(-1)
- end
-
- on hyperTableScroll lineNum
- global gTableScroll1
- set aRatio to float(lineNum) / the number of lines in field "tables"
- controlPosition(gTableScroll1, aRatio)
- end
-
- on helpOn
- global gLastHelp, gHelpLinks, gHelpActive, gHelpSprite
- if gHelpActive then
- helpOff()
- else
- set gHelpActive to 1
- set gLastHelp to 0
- set gHelpLinks to [6: 19, 7: 23, 8: 111, 9: 78, 10: 77, 11: 76, 12: 112, 13: 114, 14: 113, 15: 1]
- if the frame = label("terms index") then
- addProp(gHelpLinks, 21, 73)
- addProp(gHelpLinks, 22, 74)
- addProp(gHelpLinks, 19, 75)
- addProp(gHelpLinks, 20, 75)
- end if
- puppetSprite(gHelpSprite, 1)
- end if
- end
-