home *** CD-ROM | disk | FTP | other *** search
/ Better Homes & Gardens: …oking for Today - Chicken / Image.iso / pc / utility.dxr / 00001_movie.ls next >
Encoding:
Text File  |  1995-11-20  |  19.4 KB  |  660 lines

  1. on startMovie
  2.   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
  3.   set the textHeight of field "term scroll" to 12
  4.   set the textHeight of field "table text scroll" to 14
  5.   set gPhotoSprite to 16
  6.   set gPhotoTitleSprite to 17
  7.   set gPhotoNumSprite to 18
  8.   set gPhotoLeftSprite to 19
  9.   set gPhotoRightSprite to 20
  10.   set gCaptionSprite to 3
  11.   set gZoomBox to 45
  12.   set gZoomSprite to 46
  13.   set gIndexSprite to 2
  14.   set gUtensilsSprite to 2
  15.   set gNutritionSprite to 2
  16.   set gOtherSprite to 2
  17.   set gTermSprite to 4
  18.   set gTermTitleSprite to 33
  19.   set gUtensilTitleSprite to 16
  20.   set gUtensilPICSprite to 17
  21.   set gUtensilTextSprite to 18
  22.   set gNutritionList to [29, 30, 31, 32, 33, 34, 35, 36, 37, 38]
  23.   set gTableList to [3, 4, 21, 22]
  24.   set gLastTermRecipe to 2
  25.   set gCurrentTermLine to 2
  26.   set gLastUtensilLine to 0
  27.   set gLastFoodLine to 0
  28.   set gLastTableLine to 0
  29.   set gLastRowLine to 0
  30.   set gLastTermsIndexButton to 0
  31.   set gHelpSprite to 48
  32.   helpOff()
  33.   set selection to 3
  34.   if gFromRecipeP then
  35.     DBTermLinks()
  36.     set the textStyle of line 1 of field "term scroll" to "plain"
  37.     put field "recipe terms" into field "term scroll"
  38.   else
  39.     set gHyperTerm to 0
  40.   end if
  41.   set the textStyle of line 1 of field "term scroll" to "underline"
  42.   termsIndex()
  43. end
  44.  
  45. on stopMovie
  46.   cleanLegos()
  47.   set the keyDownScript to EMPTY
  48. end
  49.  
  50. on termsIndex
  51.   global gHyperTerm, gCurrentTermLine
  52.   set the keyDownScript to "keyScroll"
  53.   termOff()
  54.   zoomOff()
  55.   cleanLegos()
  56.   go("terms index")
  57.   makeButtons()
  58.   makeIndexButtons()
  59.   makeIndexScroll()
  60.   if gCurrentTermLine > 2 then
  61.     set selection to gCurrentTermLine
  62.     hyperScroll(selection)
  63.   else
  64.     if stringp(gHyperTerm) then
  65.       set selection to findHyperNum()
  66.       hyperScroll(selection)
  67.     else
  68.       set selection to 3
  69.     end if
  70.   end if
  71.   selectTerm(selection)
  72. end
  73.  
  74. on allterms
  75.   global gCurrentTermLine, gKeySequence, gIndexScroll, gIndexSprite
  76.   set gCurrentTermLine to 2
  77.   set gKeySequence to EMPTY
  78.   termOff()
  79.   set the visible of sprite gIndexSprite to 0
  80.   controlPosition(gIndexScroll, 0.0)
  81.   set the textStyle of line 1 of field "term scroll" to "plain"
  82.   put field "all terms" into field "term scroll"
  83.   set the textStyle of line 1 of field "term scroll" to "underline"
  84.   set the visible of sprite gIndexSprite to 1
  85.   selectTerm(3)
  86. end
  87.  
  88. on recipeterms
  89.   global gCurrentTermLine, gKeySequence, gIndexScroll, gIndexSprite
  90.   set gCurrentTermLine to 2
  91.   set gKeySequence to EMPTY
  92.   DBTermLinks()
  93.   termOff()
  94.   set the visible of sprite gIndexSprite to 0
  95.   controlPosition(gIndexScroll, 0.0)
  96.   set the textStyle of line 1 of field "term scroll" to "plain"
  97.   put field "recipe terms" into field "term scroll"
  98.   set the textStyle of line 1 of field "term scroll" to "underline"
  99.   set the visible of sprite gIndexSprite to 1
  100.   selectTerm(3)
  101. end
  102.  
  103. on utensils
  104.   helpOff()
  105.   utensilOff()
  106.   cleanLegos()
  107.   set the keyDownScript to EMPTY
  108.   go("utensils")
  109.   makeButtons()
  110.   makeUtensilScroll()
  111.   selectUtensil(1)
  112. end
  113.  
  114. on nutrition
  115.   helpOff()
  116.   nutritionOff()
  117.   cleanLegos()
  118.   set the keyDownScript to EMPTY
  119.   go("nutrition")
  120.   makeButtons()
  121.   makeNutritionScroll()
  122.   selectFood(1)
  123. end
  124.  
  125. on substitutions
  126.   helpOff()
  127.   cleanLegos()
  128.   set the keyDownScript to EMPTY
  129.   go("substitution")
  130.   makeButtons()
  131.   makeOtherScroll()
  132. end
  133.  
  134. on conversions
  135.   helpOff()
  136.   cleanLegos()
  137.   set the keyDownScript to EMPTY
  138.   go("conversions")
  139.   makeButtons()
  140.   makeOtherScroll()
  141. end
  142.  
  143. on equivalents
  144.   helpOff()
  145.   cleanLegos()
  146.   set the keyDownScript to EMPTY
  147.   go("equivalents")
  148.   makeButtons()
  149.   makeOtherScroll()
  150. end
  151.  
  152. on tables
  153.   helpOff()
  154.   tableOff()
  155.   cleanLegos()
  156.   set the keyDownScript to EMPTY
  157.   go("tables")
  158.   makeButtons()
  159.   makeTableScroll()
  160.   selectTable(1)
  161. end
  162.  
  163. on selectTerm lineNum
  164.   global gTermScroll, gTermIDDB, gCurrentTermLine
  165.   if lineNum < 3 then
  166.     exit
  167.   end if
  168.   if gCurrentTermLine = lineNum then
  169.     zoomOff()
  170.     selectPhoto(1)
  171.     termOn()
  172.     exit
  173.   end if
  174.   set theTerm to line lineNum of field "term scroll"
  175.   if theTerm = EMPTY then
  176.     exit
  177.   end if
  178.   zoomOff()
  179.   termOff()
  180.   set gCurrentTermLine to lineNum
  181.   controlPosition(gTermScroll, 0.0)
  182.   set termID to getProp(gTermIDDB, theTerm)
  183.   DBTermDefinition(termID)
  184.   put theTerm into field "term title"
  185.   selectPhoto(1)
  186.   termOn()
  187. end
  188.  
  189. on browsePhoto direction
  190.   global gTermPhotoList, gPhotoFile
  191.   set photoCount to count(gTermPhotoList)
  192.   set pos to getPos(gTermPhotoList, gPhotoFile)
  193.   set newPos to pos + direction
  194.   if newPos < 1 then
  195.     set newPos to photoCount
  196.   else
  197.     if newPos > photoCount then
  198.       set newPos to 1
  199.     end if
  200.   end if
  201.   selectPhoto(newPos)
  202. end
  203.  
  204. on selectPhoto num
  205.   global gPhotoSprite, gPhotoTitleSprite, gPhotoNumSprite, gPhotoLeftSprite, gPhotoRightSprite, gTermPhotoList, gPicZoom, gTermFolder, gPhotoFile
  206.   set photoCount to count(gTermPhotoList)
  207.   if photoCount > 0 then
  208.     set aFileName to getAt(gTermPhotoList, num)
  209.     set gPhotoFile to aFileName
  210.     set page to integer(char 4 to 6 of aFileName)
  211.     repeat with i = 1 to 15
  212.       set test to i * 30
  213.       if page < test then
  214.         set folderNum to test - 1
  215.         if folderNum < 100 then
  216.           put "0" before folderNum
  217.         end if
  218.         set gTermFolder to "TERMS" & folderNum
  219.         exit repeat
  220.       end if
  221.     end repeat
  222.     loadLILPIC("TERMS", gTermFolder, aFileName, "term pic")
  223.     set captionID to getOne(gTermPhotoList, gPhotoFile)
  224.     DBPhotoName(captionID)
  225.     put num & " of " & photoCount into field "photo number"
  226.     set the visible of sprite gPhotoSprite to 1
  227.     set the visible of sprite gPhotoTitleSprite to 1
  228.     if photoCount > 1 then
  229.       set the visible of sprite gPhotoNumSprite to 1
  230.       set the visible of sprite gPhotoLeftSprite to 1
  231.       set the visible of sprite gPhotoRightSprite to 1
  232.     end if
  233.   end if
  234. end
  235.  
  236. on selectUtensil lineNum
  237.   global gUtensilIDDB, gLastUtensilLine
  238.   if lineNum < 1 then
  239.     exit
  240.   end if
  241.   if gLastUtensilLine = lineNum then
  242.     utensilOn()
  243.     exit
  244.   end if
  245.   set theUtensil to line lineNum of field "utensils"
  246.   if theUtensil = EMPTY then
  247.     exit
  248.   end if
  249.   utensilOff()
  250.   set gLastUtensilLine to lineNum
  251.   set utensilID to getProp(gUtensilIDDB, theUtensil)
  252.   put theUtensil into field "utensil title"
  253.   DBUtensil(utensilID)
  254.   if utensilID < 10 then
  255.     put "0" before utensilID
  256.   end if
  257.   set aFileName to "UT0" & utensilID
  258.   if utensilID < 40 then
  259.     set aFolder to "UTENSIL1"
  260.   else
  261.     set aFolder to "UTENSIL2"
  262.   end if
  263.   loadPIC("UTENSILS", aFolder, aFileName, "utensil pic")
  264.   utensilOn()
  265. end
  266.  
  267. on selectFood lineNum
  268.   global gFoodIDDB, gLastFoodLine
  269.   if lineNum < 1 then
  270.     exit
  271.   end if
  272.   if gLastFoodLine = lineNum then
  273.     nutritionOn()
  274.     exit
  275.   end if
  276.   set theFood to line lineNum of field "foods"
  277.   if theFood = EMPTY then
  278.     exit
  279.   end if
  280.   nutritionOff()
  281.   set gLastFoodLine to lineNum
  282.   set foodID to getProp(gFoodIDDB, theFood)
  283.   DBFoodNutrition(foodID)
  284.   nutritionOn()
  285. end
  286.  
  287. on selectTable lineNum
  288.   global gTableIDDB, gLastTableLine, gCurrentTableID, gLastRowLine, gTableScroll2, gTableScroll3, gTableScroll4
  289.   if lineNum < 1 then
  290.     exit
  291.   end if
  292.   if gLastTableLine = lineNum then
  293.     tableOn()
  294.     exit
  295.   end if
  296.   set theTable to line lineNum of field "tables"
  297.   if theTable = EMPTY then
  298.     exit
  299.   end if
  300.   tableOff()
  301.   set gLastTableLine to lineNum
  302.   controlPosition(gTableScroll2, 0.0)
  303.   controlPosition(gTableScroll3, 0.0)
  304.   controlPosition(gTableScroll4, 0.0)
  305.   set gCurrentTableID to getProp(gTableIDDB, theTable)
  306.   set the textStyle of line 1 of field "rows" to "plain"
  307.   set gLastRowLine to 0
  308.   DBTableRows()
  309.   selectRow(1)
  310.   tableOn()
  311. end
  312.  
  313. on selectRow lineNum
  314.   global gLastRowLine, gLastTableLine, gTableScroll3
  315.   if lineNum < 1 then
  316.     exit
  317.   end if
  318.   if gLastRowLine = lineNum then
  319.     exit
  320.   end if
  321.   set theRow to line lineNum of field "rows"
  322.   if theRow = EMPTY then
  323.     exit
  324.   end if
  325.   set the textStyle of line gLastRowLine of field "rows" to "plain"
  326.   set gLastRowLine to lineNum
  327.   controlPosition(gTableScroll3, 0.0)
  328.   DBRowItems()
  329.   set the textStyle of line gLastRowLine of field "rows" to "bold"
  330. end
  331.  
  332. on zoomPhoto
  333.   global gCaptionSprite, gZoomBox, gZoomSprite, gTermSprite, gTermTitleSprite, gTermFolder, gPhotoFile, gTermPhotoList
  334.   loadPIC("TERMS", gTermFolder, gPhotoFile, "zoom pic")
  335.   set captionID to getOne(gTermPhotoList, gPhotoFile)
  336.   DBPhotoCaption(captionID)
  337.   set the visible of sprite gTermSprite to 0
  338.   set the visible of sprite gTermTitleSprite to 0
  339.   set the visible of sprite gCaptionSprite to 1
  340.   set the visible of sprite gZoomBox to 1
  341.   set the visible of sprite gZoomSprite to 1
  342. end
  343.  
  344. on zoomRoll
  345.   set roll to the mouseCast
  346.   if the mouseDown then
  347.     if roll = 43 then
  348.       cursor([1023, 1024])
  349.     else
  350.       cursor(-1)
  351.     end if
  352.   else
  353.     if roll = 43 then
  354.       cursor([1021, 1022])
  355.     else
  356.       cursor(-1)
  357.     end if
  358.   end if
  359. end
  360.  
  361. on zoomOff
  362.   global gCaptionSprite, gZoomSprite, gZoomBox
  363.   set the visible of sprite gCaptionSprite to 0
  364.   set the visible of sprite gZoomBox to 0
  365.   set the visible of sprite gZoomSprite to 0
  366. end
  367.  
  368. on indexOn
  369.   global gIndexSprite
  370.   set the visible of sprite gIndexSprite to 1
  371. end
  372.  
  373. on indexOff
  374.   global gIndexSprite
  375.   set the visible of sprite gIndexSprite to 0
  376. end
  377.  
  378. on termOn
  379.   global gTermSprite, gTermTitleSprite, gPhotoSprite, gCurrentTermLine
  380.   set the visible of sprite gTermSprite to 1
  381.   set the visible of sprite gTermTitleSprite to 1
  382.   set the textStyle of line gCurrentTermLine of field "term scroll" to "bold"
  383. end
  384.  
  385. on termOff
  386.   global gTermSprite, gTermTitleSprite, gCurrentTermLine, gPhotoSprite, gPhotoTitleSprite, gPhotoNumSprite, gPhotoLeftSprite, gPhotoRightSprite
  387.   set the textStyle of line gCurrentTermLine of field "term scroll" to "plain"
  388.   set the visible of sprite gTermSprite to 0
  389.   set the visible of sprite gTermTitleSprite to 0
  390.   set the visible of sprite gPhotoSprite to 0
  391.   set the visible of sprite gPhotoTitleSprite to 0
  392.   set the visible of sprite gPhotoNumSprite to 0
  393.   set the visible of sprite gPhotoLeftSprite to 0
  394.   set the visible of sprite gPhotoRightSprite to 0
  395. end
  396.  
  397. on utensilOn
  398.   global gUtensilTitleSprite, gUtensilPICSprite, gUtensilTextSprite, gLastUtensilLine
  399.   set the visible of sprite gUtensilTitleSprite to 1
  400.   set the visible of sprite gUtensilPICSprite to 1
  401.   set the visible of sprite gUtensilTextSprite to 1
  402.   set the textStyle of line gLastUtensilLine of field "utensils" to "bold"
  403. end
  404.  
  405. on utensilOff
  406.   global gUtensilTitleSprite, gUtensilPICSprite, gUtensilTextSprite, gLastUtensilLine
  407.   set the textStyle of line gLastUtensilLine of field "utensils" to "plain"
  408.   set the visible of sprite gUtensilTitleSprite to 0
  409.   set the visible of sprite gUtensilPICSprite to 0
  410.   set the visible of sprite gUtensilTextSprite to 0
  411.   updateStage()
  412. end
  413.  
  414. on nutritionOn
  415.   global gNutritionList, gLastFoodLine
  416.   repeat with i in gNutritionList
  417.     set the visible of sprite i to 1
  418.   end repeat
  419.   set the textStyle of line gLastFoodLine of field "foods" to "bold"
  420. end
  421.  
  422. on nutritionOff
  423.   global gNutritionList, gLastFoodLine
  424.   set the textStyle of line gLastFoodLine of field "foods" to "plain"
  425.   repeat with i in gNutritionList
  426.     set the visible of sprite i to 0
  427.   end repeat
  428. end
  429.  
  430. on tableOn
  431.   global gLastTableLine, gTableList
  432.   repeat with i in gTableList
  433.     set the visible of sprite i to 1
  434.   end repeat
  435.   set the textStyle of line gLastTableLine of field "tables" to "bold"
  436. end
  437.  
  438. on tableOff
  439.   global gLastTableLine, gTableList
  440.   set the textStyle of line gLastTableLine of field "tables" to "plain"
  441.   repeat with i in gTableList
  442.     set the visible of sprite i to 0
  443.   end repeat
  444. end
  445.  
  446. on makeIndexScroll
  447.   global gIndexScroll, gTermScroll, gIndexSprite, gTermSprite
  448.   set track to new("Button", [#spriteChan: 24])
  449.   set ball to new("Button", [#spriteChan: 25, #pressedCast: 66])
  450.   set up to new("Button", [#spriteChan: 26, #pressedCast: 68])
  451.   set down to new("Button", [#spriteChan: 27, #pressedCast: 70])
  452.   set gIndexScroll to new("ScrollBar", [#scrollSprite: gIndexSprite, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
  453.   set track to new("Button", [#spriteChan: 28])
  454.   set ball to new("Button", [#spriteChan: 29, #pressedCast: 66])
  455.   set up to new("Button", [#spriteChan: 30, #pressedCast: 68])
  456.   set down to new("Button", [#spriteChan: 31, #pressedCast: 70])
  457.   set gTermScroll to new("ScrollBar", [#scrollSprite: gTermSprite, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
  458. end
  459.  
  460. on makeUtensilScroll
  461.   global gUtensilScroll, gUtensilsSprite
  462.   set track to new("Button", [#spriteChan: 24])
  463.   set ball to new("Button", [#spriteChan: 25, #pressedCast: 66])
  464.   set up to new("Button", [#spriteChan: 26, #pressedCast: 68])
  465.   set down to new("Button", [#spriteChan: 27, #pressedCast: 70])
  466.   set gUtensilScroll to new("ScrollBar", [#scrollSprite: gUtensilsSprite, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
  467. end
  468.  
  469. on makeNutritionScroll
  470.   global gNutritonScroll, gNutritionSprite
  471.   set track to new("Button", [#spriteChan: 24])
  472.   set ball to new("Button", [#spriteChan: 25, #pressedCast: 66])
  473.   set up to new("Button", [#spriteChan: 26, #pressedCast: 68])
  474.   set down to new("Button", [#spriteChan: 27, #pressedCast: 70])
  475.   set gNutritionScroll to new("ScrollBar", [#scrollSprite: gNutritionSprite, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
  476. end
  477.  
  478. on makeOtherScroll
  479.   global gOtherScroll, gOtherSprite
  480.   set track to new("Button", [#spriteChan: 24])
  481.   set ball to new("Button", [#spriteChan: 25, #pressedCast: 66])
  482.   set up to new("Button", [#spriteChan: 26, #pressedCast: 68])
  483.   set down to new("Button", [#spriteChan: 27, #pressedCast: 70])
  484.   set gOtherScroll to new("ScrollBar", [#scrollSprite: gOtherSprite, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
  485. end
  486.  
  487. on makeTableScroll
  488.   global gTableScroll1, gTableScroll2, gTableScroll3, gTableScroll4
  489.   set track to new("Button", [#spriteChan: 24])
  490.   set ball to new("Button", [#spriteChan: 25, #pressedCast: 66])
  491.   set up to new("Button", [#spriteChan: 26, #pressedCast: 68])
  492.   set down to new("Button", [#spriteChan: 27, #pressedCast: 70])
  493.   set gTableScroll1 to new("ScrollBar", [#scrollSprite: 2, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
  494.   set track to new("Button", [#spriteChan: 28])
  495.   set ball to new("Button", [#spriteChan: 29, #pressedCast: 66])
  496.   set up to new("Button", [#spriteChan: 30, #pressedCast: 68])
  497.   set down to new("Button", [#spriteChan: 31, #pressedCast: 70])
  498.   set gTableScroll2 to new("ScrollBar", [#scrollSprite: 3, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
  499.   set track to new("Button", [#spriteChan: 32])
  500.   set ball to new("Button", [#spriteChan: 33, #pressedCast: 66])
  501.   set up to new("Button", [#spriteChan: 34, #pressedCast: 68])
  502.   set down to new("Button", [#spriteChan: 35, #pressedCast: 70])
  503.   set gTableScroll3 to new("ScrollBar", [#scrollSprite: 4, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
  504.   set track to new("Button", [#spriteChan: 36])
  505.   set ball to new("Button", [#spriteChan: 37, #pressedCast: 66])
  506.   set up to new("Button", [#spriteChan: 38, #pressedCast: 68])
  507.   set down to new("Button", [#spriteChan: 39, #pressedCast: 70])
  508.   set gTableScroll4 to new("ScrollBar", [#scrollField: "table text", #scrollFieldOut: 21, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
  509. end
  510.  
  511. on hyperScroll lineNum
  512.   global gIndexScroll
  513.   set denom to the number of lines in field "term scroll" - 3
  514.   if denom = 0 then
  515.     set aRatio to 0
  516.   else
  517.     set aRatio to float(lineNum - 3) / denom
  518.   end if
  519.   controlPosition(gIndexScroll, aRatio)
  520. end
  521.  
  522. on findHyperNum
  523.   global gHyperTerm
  524.   set hyperLine to 3
  525.   set terms to field "recipe terms"
  526.   set num to the number of lines in terms
  527.   repeat with i = 1 to num
  528.     if gHyperTerm = line i of terms then
  529.       set hyperLine to i
  530.       exit repeat
  531.     end if
  532.   end repeat
  533.   return hyperLine
  534. end
  535.  
  536. on keyScroll
  537.   global gKeySequence, gCurrentTermLine
  538.   if "abcdefghijklmnopqrstuvwxyz " contains the key then
  539.     put the key after gKeySequence
  540.     if length(gKeySequence) > 1 then
  541.       findKeyLine(gCurrentTermLine)
  542.     else
  543.       findKeyLine(3)
  544.     end if
  545.   else
  546.     if the key = BACKSPACE then
  547.       delete char -30000 of gKeySequence
  548.       findKeyLine(3)
  549.     end if
  550.   end if
  551. end
  552.  
  553. on findKeyLine begin
  554.   global gIndexScroll, gKeySequence
  555.   cursor(4)
  556.   set Index to field "term scroll"
  557.   set num to the number of lines in Index
  558.   if gKeySequence <> EMPTY then
  559.     set keyCount to length(gKeySequence)
  560.     repeat with i = begin to num
  561.       if char 1 to keyCount of line i of Index = gKeySequence then
  562.         set keyLine to i
  563.         exit repeat
  564.       end if
  565.     end repeat
  566.   end if
  567.   if keyLine > 2 then
  568.     hyperScroll(keyLine)
  569.     selectTerm(keyLine)
  570.   else
  571.     set gKeySequence to EMPTY
  572.     hyperScroll(3)
  573.     selectTerm(3)
  574.   end if
  575.   cursor(-1)
  576. end
  577.  
  578. on makeButtons
  579.   global gBackButton, gMainButton, gHelpButton, gTermsButton, gUtensilsButton, gSubstitutionsButton, gNutritionButton, gEquivalentsButton, gConversionsButton, gTablesButton
  580.   set gBackButton to birth(script "GACButton", 7)
  581.   set gHelpButton to birth(script "GACButton", 15)
  582.   set gMainButton to birth(script "GACButton", 6)
  583.   set gTermsButton to birth(script "radioButton", 8)
  584.   set gUtensilsButton to birth(script "radioButton", 9)
  585.   set gSubstitutionsButton to birth(script "radioButton", 10)
  586.   set gNutritionButton to birth(script "radioButton", 11)
  587.   set gEquivalentsButton to birth(script "radioButton", 12)
  588.   set gConversionsButton to birth(script "radioButton", 13)
  589.   set gTablesButton to birth(script "radioButton", 14)
  590. end
  591.  
  592. on makeIndexButtons
  593.   global gLeftButton, gRightButton, gAllTermsButton, gRecipeTermsButton, gLastTermsIndexButton, gFromRecipeP
  594.   set gLeftButton to birth(script "GACButton", 19)
  595.   set gRightButton to birth(script "GACButton", 20)
  596.   set gAllTermsButton to birth(script "termsIndexButton", 21)
  597.   set gRecipeTermsButton to birth(script "termsIndexButton", 22)
  598.   if objectp(gLastTermsIndexButton) then
  599.     select(gLastTermsIndexButton)
  600.   else
  601.     if gFromRecipeP then
  602.       select(gRecipeTermsButton)
  603.     else
  604.       select(gAllTermsButton)
  605.     end if
  606.   end if
  607. end
  608.  
  609. on hyperTable
  610.   set aLine to line the mouseLine of field "term text"
  611.   if aLine starts "Click here" then
  612.     delete word 1 to 5 of aLine
  613.     delete char -30001 of aLine
  614.     delete char -30000 of aLine
  615.     tables()
  616.     findTableLine(aLine)
  617.     put aLine
  618.   end if
  619. end
  620.  
  621. on findTableLine aLine
  622.   global gIndexScroll
  623.   cursor(4)
  624.   set Index to field "tables"
  625.   set num to the number of lines in Index
  626.   repeat with i = 1 to num
  627.     if line i of Index = aLine then
  628.       set tableLine to i
  629.       exit repeat
  630.     end if
  631.   end repeat
  632.   hyperTableScroll(tableLine)
  633.   selectTable(tableLine)
  634.   cursor(-1)
  635. end
  636.  
  637. on hyperTableScroll lineNum
  638.   global gTableScroll1
  639.   set aRatio to float(lineNum) / the number of lines in field "tables"
  640.   controlPosition(gTableScroll1, aRatio)
  641. end
  642.  
  643. on helpOn
  644.   global gLastHelp, gHelpLinks, gHelpActive, gHelpSprite
  645.   if gHelpActive then
  646.     helpOff()
  647.   else
  648.     set gHelpActive to 1
  649.     set gLastHelp to 0
  650.     set gHelpLinks to [6: 19, 7: 23, 8: 111, 9: 78, 10: 77, 11: 76, 12: 112, 13: 114, 14: 113, 15: 1]
  651.     if the frame = label("terms index") then
  652.       addProp(gHelpLinks, 21, 73)
  653.       addProp(gHelpLinks, 22, 74)
  654.       addProp(gHelpLinks, 19, 75)
  655.       addProp(gHelpLinks, 20, 75)
  656.     end if
  657.     puppetSprite(gHelpSprite, 1)
  658.   end if
  659. end
  660.