home *** CD-ROM | disk | FTP | other *** search
- on startMovie
- global gHiliteSprite, gPlanSprite, gCaloriesSprite, gFatSprite, gDayInsert, gMealInsert, gTheDays, gTheMonths, gMonthMax, gDayName, gDayNum, gMonth, gYear, gHelpSprite
- set the textHeight of field "meals" to 14
- set the textHeight of field "meals calories" to 14
- set the textHeight of field "meals fat" to 14
- set the textHeight of field "days" to 14
- set the textHeight of field "days calories" to 14
- set the textHeight of field "days fat" to 14
- set the textHeight of field "dayNotes scroll" to 14
- set the textHeight of field "weekNotes scroll" to 14
- set the textStyle of field "weekNotes scroll" to "plain"
- set the textStyle of field "dayNotes scroll" to "plain"
- set the textStyle of field "meals fat" to "plain"
- set the textStyle of field "meals calories" to "plain"
- set the textStyle of field "days fat" to "plain"
- set the textStyle of field "days calories" to "plain"
- set the textSize of field "weekNotes scroll" to 12
- set the textSize of field "dayNotes scroll" to 12
- set the textSize of field "meals" to 12
- set the textSize of field "meals fat" to 12
- set the textSize of field "meals calories" to 12
- set the textSize of field "days fat" to 12
- set the textSize of field "days calories" to 12
- set the textSize of field "days" to 12
- if the machineType = 256 then
- set the textFont of field "meals" to "arial"
- set the textFont of field "dayNotes scroll" to "arial"
- set the textFont of field "weekNotes scroll" to "arial"
- set the textFont of field "days fat" to "arial"
- set the textFont of field "days calories" to "arial"
- set the textFont of field "meals fat" to "arial"
- set the textFont of field "meals calories" to "arial"
- else
- set the textFont of field "meals" to "helvetica"
- set the textFont of field "dayNotes scroll" to "helvetica"
- set the textFont of field "weekNotes scroll" to "helvetica"
- set the textFont of field "days fat" to "helvetica"
- set the textFont of field "days calories" to "helvetica"
- set the textFont of field "meals fat" to "helvetica"
- set the textFont of field "meals calories" to "helvetica"
- end if
- set gHiliteSprite to 2
- set gPlanSprite to 3
- set gCaloriesSprite to 4
- set gFatSprite to 5
- set the backColor of cast 60 to 243
- set the backColor of cast 50 to 243
- set gDayInsert to 2
- set gMealInsert to 2
- set gTheDays to ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday "]
- set gTheMonths to ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
- set gMonthMax to [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
- set today to the long date
- set name to word 1 of today
- set name to char 1 to length(name) - 1 of name
- set gDayName to getPos(gTheDays, name)
- set day to word 3 of today
- set gDayNum to integer(char 1 to length(day) - 1 of day)
- put gDayNum into field "day"
- set gMonth to integer(char 1 to offset("/", the short date) of the short date)
- put getAt(gTheMonths, gMonth) into field "month"
- set gYear to integer(word 4 of today)
- put gYear into field "year"
- put "Week of" into field "name"
- set gHelpSprite to 42
- helpOff()
- updateRecipes()
- changeDay(1 - gDayName)
- go("weekly")
- makeScrolls()
- makeButtons()
- loadPlanner()
- end
-
- on stopMovie
- savePlanner()
- cleanLegos()
- end
-
- on weekly
- global gDayName
- helpOff()
- savePlanner()
- cleanLegos()
- changeDay(1 - gDayName)
- put "Week of" into field "name"
- go("weekly")
- makeScrolls()
- makeButtons()
- loadPlanner()
- end
-
- on daily
- helpOff()
- savePlanner()
- cleanLegos()
- put " " into field "name"
- setDay()
- go("daily")
- makeScrolls()
- makeButtons()
- loadPlanner()
- end
-
- on updateRecipes
- global gPlannerRecipes
- set sentList to EMPTY
- set number to count(gPlannerRecipes)
- if number = 0 then
- set sentList to "(send recipes here from recipe screen)"
- else
- if number = 1 then
- set sentList to getAt(gPlannerRecipes, 1) & RETURN
- else
- set sentList to getAt(gPlannerRecipes, 1) & RETURN
- repeat with i = 2 to number
- put getAt(gPlannerRecipes, i) & RETURN after sentList
- end repeat
- end if
- end if
- put sentList into field "recipes"
- put sentList into field "sentScroll"
- end
-
- on selectRecipe recipeTitle
- global gPlannerRecipes, gPlannerCalories, gPlannerFat, gDayInsert, gMealInsert
- if not stringp(recipeTitle) then
- set aLine to the mouseLine
- if aLine < 1 then
- exit
- end if
- set recipeTitle to line aLine of field "sentScroll"
- if recipeTitle = EMPTY then
- exit
- end if
- if recipeTitle = "(send recipes here from recipe screen)" then
- exit
- end if
- end if
- DBPlanner(recipeTitle)
- if the frame = label("weekly") then
- if line gDayInsert of field "days" = EMPTY then
- set newLine to RETURN
- else
- set newLine to EMPTY
- end if
- put " " & recipeTitle & newLine into line gDayInsert of field "days"
- put gPlannerCalories & newLine into line gDayInsert of field "days calories"
- put gPlannerFat & newLine into line gDayInsert of field "days fat"
- set gDayInsert to gDayInsert + 1
- dayInsert()
- else
- if the frame = label("daily") then
- if line gMealInsert of field "meals" = EMPTY then
- set newLine to RETURN
- else
- set newLine to EMPTY
- end if
- put " " & recipeTitle & newLine into line gMealInsert of field "meals"
- put gPlannerCalories & newLine into line gMealInsert of field "meals calories"
- put gPlannerFat & newLine into line gMealInsert of field "meals fat"
- set gMealInsert to gMealInsert + 1
- mealInsert()
- end if
- end if
- totalNutrition()
- end
-
- on deleteRecipe
- global gDayInsert, gMealInsert
- if the frame = label("weekly") then
- if line gDayInsert of field "days" = EMPTY then
- exit
- end if
- delete line gDayInsert of field "days"
- delete line gDayInsert of field "days calories"
- delete line gDayInsert of field "days fat"
- else
- if the frame = label("daily") then
- if line gMealInsert of field "meals" = EMPTY then
- exit
- end if
- delete line gMealInsert of field "meals"
- delete line gMealInsert of field "meals calories"
- delete line gMealInsert of field "meals fat"
- end if
- end if
- totalNutrition()
- end
-
- on totalNutrition
- set totalCalories to 0
- set totalFat to 0
- if the frame = label("weekly") then
- set allCalories to field "days calories"
- set allFat to field "days fat"
- set nutritionNum to the number of lines in allCalories
- repeat with i = 1 to nutritionNum
- set calories to integer(line i of allCalories)
- if integerp(calories) then
- set totalCalories to totalCalories + calories
- end if
- set fat to integer(line i of allFat)
- if integerp(fat) then
- set totalFat to totalFat + fat
- end if
- end repeat
- put totalCalories into field "week total calories"
- put totalFat into field "week total fat"
- else
- if the frame = label("daily") then
- set allCalories to field "meals calories"
- set allFat to field "meals fat"
- set nutritionNum to the number of lines in allCalories
- repeat with i = 1 to nutritionNum
- set calories to integer(line i of allCalories)
- if integerp(calories) then
- set totalCalories to totalCalories + calories
- end if
- set fat to integer(line i of allFat)
- if integerp(fat) then
- set totalFat to totalFat + fat
- end if
- end repeat
- put totalCalories into field "day total calories"
- put totalFat into field "day total fat"
- end if
- end if
- end
-
- on selectDayInsert
- global gDayInsert, gTheDays
- set aLine to the mouseLine
- if aLine < 1 then
- exit
- end if
- set inserted to 0
- repeat with i in gTheDays
- if line aLine of field "days" = i then
- set gDayInsert to aLine + 1
- set inserted to 1
- end if
- end repeat
- if not inserted then
- set gDayInsert to aLine
- end if
- dayInsert()
- end
-
- on dayInsert
- global gHiliteSprite, gPlanSprite, gDayInsert, gPlanScroll
- if the machineType = 256 then
- set loc to ((gDayInsert - 1) * 14) + the locV of sprite gPlanSprite
- else
- set loc to ((gDayInsert - 1) * 14) + the locV of sprite gPlanSprite
- end if
- set the locV of sprite gHiliteSprite to loc
- if loc > 300 then
- controlPosition(gPlanScroll, 1.0)
- end if
- end
-
- on selectMealInsert
- global gMealInsert
- set aLine to the mouseLine
- if aLine < 1 then
- exit
- end if
- set meals to ["breakfast", "lunch", "dinner "]
- set inserted to 0
- repeat with i in meals
- if line aLine of field "meals" = i then
- set gMealInsert to aLine + 1
- set inserted to 1
- end if
- end repeat
- if not inserted then
- set gMealInsert to aLine
- end if
- mealInsert()
- end
-
- on mealInsert
- global gHiliteSprite, gPlanSprite, gMealInsert, gPlanScroll
- if the machineType = 256 then
- set loc to ((gMealInsert - 1) * 14) + the locV of sprite gPlanSprite
- else
- set loc to ((gMealInsert - 1) * 14) + the locV of sprite gPlanSprite
- end if
- set the locV of sprite gHiliteSprite to loc
- if loc > 300 then
- controlPosition(gPlanScroll, 1.0)
- end if
- end
-
- on dayButton direction
- savePlanner()
- set doOnce to 1
- if field "name" = "Week of" then
- set direction to direction * 7
- end if
- repeat while the mouseDown or doOnce
- changeDay(direction)
- waste()
- set doOnce to 0
- end repeat
- loadPlanner()
- end
-
- on setDay
- global gDayName, gTheDays
- if gDayName <= 0 then
- set gDayName to gDayName + 7
- else
- if gDayName > 7 then
- set gDayName to gDayName mod 7
- end if
- end if
- if field "name" = "Week of" then
- exit
- end if
- put getAt(gTheDays, gDayName) into field "name"
- end
-
- on changeDay direction
- global gDayName, gDayNum
- set max to getMonth()
- if (gDayNum + direction) > max then
- setMonth(1)
- set gDayNum to gDayNum - max + direction
- else
- if (gDayNum + direction) < 1 then
- setMonth(-1)
- set gDayNum to gDayNum + getMonth() + direction
- else
- set gDayNum to gDayNum + direction
- end if
- end if
- put gDayNum into field "day"
- set gDayName to gDayName + direction
- setDay()
- end
-
- on monthButton direction
- savePlanner()
- set doOnce to 1
- repeat while the mouseDown or doOnce
- changeMonth(direction)
- waste()
- set doOnce to 0
- end repeat
- loadPlanner()
- end
-
- on getMonth
- global gMonth, gMonthMax, gYear
- set max to getAt(gMonthMax, gMonth)
- if (gMonth = 2) and ((gYear mod 4) = 0) then
- set max to max + 1
- end if
- return max
- end
-
- on setMonth direction
- global gMonth, gTheMonths, gYear
- set gMonth to gMonth + direction
- if gMonth > 12 then
- set gMonth to 1
- set gYear to gYear + 1
- put gYear into field "year"
- else
- if gMonth < 1 then
- set gMonth to 12
- set gYear to gYear - 1
- put gYear into field "year"
- end if
- end if
- put getAt(gTheMonths, gMonth) into field "month"
- end
-
- on changeMonth direction
- global gDayName, gDayNum, gMonth, gMonthMax
- if direction > 0 then
- set max to getMonth()
- set gDayName to gDayName + (max mod 7)
- end if
- set oldMax to getAt(gMonthMax, gMonth)
- setMonth(direction)
- set newMax to getAt(gMonthMax, gMonth)
- if (oldMax > newMax) and (gDayNum > newMax) then
- set gDayName to gDayName + (newMax - gDayNum)
- set gDayNum to newMax
- put gDayNum into field "day"
- end if
- if direction < 0 then
- set max to getMonth()
- set gDayName to gDayName - (max mod 7)
- end if
- if field "name" = "Week of" then
- changeDay(1 - gDayName)
- else
- setDay()
- end if
- end
-
- on yearButton direction
- savePlanner()
- set doOnce to 1
- repeat while the mouseDown or doOnce
- changeYear(direction)
- waste()
- set doOnce to 0
- end repeat
- loadPlanner()
- end
-
- on changeYear direction
- global gDayName, gDayNum, gMonth, gYear
- if (gMonth = 2) and (gDayNum = 29) then
- set gYear to gYear + (direction * 4)
- set gDayName to gDayName + (direction * 5)
- else
- if direction < 0 then
- if ((gYear mod 4) = 0) and (gMonth > 2) then
- set gDayName to gDayName - 2
- else
- if (((gYear - 1) mod 4) = 0) and (gMonth < 3) then
- set gDayName to gDayName - 2
- else
- set gDayName to gDayName - 1
- end if
- end if
- else
- if direction > 0 then
- if ((gYear mod 4) = 0) and (gMonth < 3) then
- set gDayName to gDayName + 2
- else
- if (((gYear + 1) mod 4) = 0) and (gMonth > 2) then
- set gDayName to gDayName + 2
- else
- set gDayName to gDayName + 1
- end if
- end if
- end if
- end if
- set gYear to gYear + direction
- put gYear into field "year"
- end if
- if field "name" = "Week of" then
- changeDay(1 - gDayName)
- else
- setDay()
- end if
- end
-
- on waste
- startTimer()
- repeat while the timer < 10
- nothing()
- end repeat
- end
-
- on makeScrolls
- global gHiliteSprite, gPlanSprite, gCaloriesSprite, gFatSprite, gPlanScroll
- set track to new("Button", [#spriteChan: 33])
- set ball to new("Button", [#spriteChan: 34, #pressedCast: 75])
- set up to new("Button", [#spriteChan: 35, #pressedCast: 77])
- set down to new("Button", [#spriteChan: 36, #pressedCast: 79])
- new("ScrollBar", [#scrollField: "recipes", #scrollFieldOut: 16, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
- set spriteList to [gCaloriesSprite, gFatSprite]
- set track to new("Button", [#spriteChan: 37])
- set ball to new("Button", [#spriteChan: 38, #pressedCast: 75])
- set up to new("Button", [#spriteChan: 39, #pressedCast: 77])
- set down to new("Button", [#spriteChan: 40, #pressedCast: 79])
- set gPlanScroll to new("ScrollBar", [#scrollSprite: gPlanSprite, #scrollLinks: spriteList, #handler: "shiftHilite", #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
- puppetSprite(gHiliteSprite, 1)
- end
-
- on shiftHilite ratio
- global gHiliteSprite, gPlanSprite, gDayInsert, gMealInsert
- if the frame = label("weekly") then
- if the machineType = 256 then
- set loc to ((gDayInsert - 1) * 14) + the locV of sprite gPlanSprite
- else
- set loc to ((gDayInsert - 1) * 14) + the locV of sprite gPlanSprite
- end if
- else
- if the machineType = 256 then
- set loc to ((gMealInsert - 1) * 14) + the locV of sprite gPlanSprite
- else
- set loc to ((gMealInsert - 1) * 14) + the locV of sprite gPlanSprite
- end if
- end if
- set the locV of sprite gHiliteSprite to loc
- end
-
- on makeButtons
- global gMainButton, gHelpButton, gBackButton, gNotesButton, gDeleteButton, gPrintButton
- set gBackButton to birth(script "GACButton", 9)
- set gHelpButton to birth(script "GACButton", 8)
- set gMainButton to birth(script "GACButton", 10)
- set gNotesButton to birth(script "GACButton", 12)
- set gDeleteButton to birth(script "GACButton", 13)
- set gPrintButton to birth(script "GACButton", 14)
- end
-
- on notes
- helpOff()
- loadNotes()
- if the frame = label("weekly") then
- weekNotes()
- else
- if the frame = label("daily") then
- dayNotes()
- end if
- end if
- end
-
- on planner
- cleanLegos()
- if the frame = label("weeknotes") then
- go("weekly")
- else
- if the frame = label("daynotes") then
- go("daily")
- end if
- end if
- saveNotes()
- makeScrolls()
- makeButtons()
- end
-
- on dayNotes
- cleanLegos()
- put field "dayNotes" into field "dayNotes scroll"
- go("dayNotes")
- makeDayNotesScroll()
- end
-
- on makeDayNotesScroll
- global gDayNotesScroll, gNotesDoneButton
- set track to new("Button", [#spriteChan: 4])
- set ball to new("Button", [#spriteChan: 5, #pressedCast: 85])
- set up to new("Button", [#spriteChan: 6, #pressedCast: 87])
- set down to new("Button", [#spriteChan: 7, #pressedCast: 89])
- set gDayNotesScroll to new("ScrollBar", [#scrollField: "dayNotes", #scrollFieldOut: 3, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
- set gNotesDoneButton to birth(script "GACButton", 9)
- end
-
- on weekNotes
- cleanLegos()
- put field "weekNotes" into field "weekNotes scroll"
- go("weekNotes")
- makeWeekNotesScroll()
- end
-
- on makeWeekNotesScroll
- global gWeekNotesScroll, gNotesDoneButton
- set track to new("Button", [#spriteChan: 4])
- set ball to new("Button", [#spriteChan: 5, #pressedCast: 85])
- set up to new("Button", [#spriteChan: 6, #pressedCast: 87])
- set down to new("Button", [#spriteChan: 7, #pressedCast: 89])
- set gWeekNotesScroll to new("ScrollBar", [#scrollField: "weekNotes", #scrollFieldOut: 3, #minButton: up, #maxButton: down, #thumbButton: ball, #trackButton: track])
- set gNotesDoneButton to birth(script "GACButton", 9)
- end
-
- on savePlanner
- global gDayNum, gMonth, gYear, gTheDays, gRecipeIDDB
- cursor(4)
- DBBeginSaveSession()
- if gDayNum < 10 then
- set day to "0" & gDayNum
- else
- set day to gDayNum
- end if
- if gMonth < 10 then
- set month to "0" & gMonth
- else
- set month to gMonth
- end if
- set year to char 3 to 4 of string(gYear)
- set lineNumbers to []
- hiliteOff()
- if the frame = label("weekly") then
- set recipes to field "days"
- set recipeNum to the number of lines in recipes
- set oneDay to 7
- set day to integer(day) + 6
- if day < 10 then
- put "0" before day
- end if
- set planID to month & day & year & 4
- repeat with i = recipeNum down to 1
- set aRecipe to line i of recipes
- if (aRecipe <> EMPTY) and (aRecipe <> getAt(gTheDays, oneDay)) then
- add(lineNumbers, i)
- delete char 1 to 3 of aRecipe
- set recipeID to getProp(gRecipeIDDB, aRecipe)
- put "^" & recipeID after planID
- next repeat
- end if
- if aRecipe = getAt(gTheDays, oneDay) then
- if planID contains "^" then
- DBSetRecord("meal plan", planID)
- else
- DBDeleteRecord("meal plan", planID)
- end if
- set oneDay to oneDay - 1
- set day to integer(day) - 1
- if day < 10 then
- put "0" before day
- end if
- set planID to month & day & year & 4
- end if
- end repeat
- else
- if the frame = label("daily") then
- set meals to ["breakfast", "lunch", "dinner "]
- set recipes to field "meals"
- set recipeNum to the number of lines in recipes
- set oneMeal to 3
- set planID to month & day & year & oneMeal
- repeat with i = recipeNum down to 1
- set aRecipe to line i of recipes
- if (aRecipe <> EMPTY) and (aRecipe <> getAt(meals, oneMeal)) then
- add(lineNumbers, i)
- delete char 1 to 3 of aRecipe
- set recipeID to getProp(gRecipeIDDB, aRecipe)
- put "^" & recipeID after planID
- next repeat
- end if
- if aRecipe = getAt(meals, oneMeal) then
- if planID contains "^" then
- DBSetRecord("meal plan", planID)
- else
- DBDeleteRecord("meal plan", planID)
- end if
- set oneMeal to oneMeal - 1
- set planID to month & day & year & oneMeal
- end if
- end repeat
- end if
- end if
- cleanPlan(lineNumbers)
- DBEndSession()
- cursor(-1)
- end
-
- on saveNotes
- global gDayNum, gMonth, gYear
- cursor(4)
- DBBeginSaveSession()
- if gDayNum < 10 then
- set day to "0" & gDayNum
- else
- set day to gDayNum
- end if
- if gMonth < 10 then
- set month to "0" & gMonth
- else
- set month to gMonth
- end if
- set year to char 3 to 4 of string(gYear)
- if the frame = label("weekly") then
- set planID to month & day & year & 6
- set note to removeCarrots(field "weekNotes")
- if removeSpace(note) <> EMPTY then
- put "^" & note after planID
- end if
- if planID contains "^" then
- DBSetRecord(16000, planID)
- else
- DBDeleteRecord(16000, planID)
- end if
- put " " into field "weekNotes"
- put " " into field "weekNotes scroll"
- else
- if the frame = label("daily") then
- set planID to month & day & year & 5
- set note to removeCarrots(field "dayNotes")
- if removeSpace(note) <> EMPTY then
- put "^" & note after planID
- end if
- if planID contains "^" then
- DBSetRecord(16000, planID)
- else
- DBDeleteRecord(16000, planID)
- end if
- put " " into field "dayNotes"
- put " " into field "dayNotes scroll"
- end if
- end if
- DBEndSession()
- cursor(-1)
- end
-
- on loadPlanner
- global gDayNum, gMonth, gYear, gTheDays, gRecipeIDDB, gDayInsert, gMealInsert, gDBResult
- cursor(4)
- DBBeginBothSession()
- if gDayNum < 10 then
- set day to "0" & gDayNum
- else
- set day to gDayNum
- end if
- if gMonth < 10 then
- set month to "0" & gMonth
- else
- set month to gMonth
- end if
- set year to char 3 to 4 of string(gYear)
- if the frame = label("weekly") then
- set day to integer(day) + 7
- repeat with i = 7 down to 1
- set day to integer(day) - 1
- if day < 10 then
- put "0" before day
- end if
- set planID to month & day & year & 4
- set gDayInsert to i * 2
- DBGetSetRecord(planID, 15000)
- if gDBResult = 0 then
- set recipeID to DBGetSetField(15001)
- set recipeTitle to getOne(gRecipeIDDB, integer(recipeID))
- selectRecipe(recipeTitle)
- repeat while 1
- DBNextSetRecord(15000)
- if gDBResult <> 0 then
- exit repeat
- end if
- if integer(DBGetSetField(15000)) <> integer(planID) then
- exit repeat
- end if
- set recipeID to DBGetSetField(15001)
- set recipeTitle to getOne(gRecipeIDDB, integer(recipeID))
- selectRecipe(recipeTitle)
- end repeat
- end if
- end repeat
- else
- if the frame = label("daily") then
- repeat with i = 3 down to 1
- set planID to month & day & year & i
- set gMealInsert to i * 2
- DBGetSetRecord(planID, 15000)
- if gDBResult = 0 then
- set recipeID to DBGetSetField(15001)
- set recipeTitle to getOne(gRecipeIDDB, integer(recipeID))
- selectRecipe(recipeTitle)
- repeat while 1
- DBNextSetRecord(15000)
- if gDBResult <> 0 then
- exit repeat
- end if
- if integer(DBGetSetField(15000)) <> integer(planID) then
- exit repeat
- end if
- set recipeID to DBGetSetField(15001)
- set recipeTitle to getOne(gRecipeIDDB, integer(recipeID))
- selectRecipe(recipeTitle)
- end repeat
- end if
- end repeat
- end if
- end if
- hiliteOn()
- DBEndSession()
- cursor(-1)
- end
-
- on loadNotes
- global gDBResult, gDayNum, gMonth, gYear
- cursor(4)
- DBBeginSaveSession()
- if gDayNum < 10 then
- set day to "0" & gDayNum
- else
- set day to gDayNum
- end if
- if gMonth < 10 then
- set month to "0" & gMonth
- else
- set month to gMonth
- end if
- set year to char 3 to 4 of string(gYear)
- if the frame = label("weekly") then
- set planID to month & day & year & 6
- DBGetSetRecord(planID, 16000)
- if gDBResult = 0 then
- set notes to DBGetSetField(20008)
- put notes into field "weekNotes"
- put notes into field "weekNotes scroll"
- end if
- else
- if the frame = label("daily") then
- set planID to month & day & year & 5
- DBGetSetRecord(planID, 16000)
- if gDBResult = 0 then
- set notes to DBGetSetField(20008)
- put notes into field "dayNotes"
- put notes into field "dayNotes scroll"
- end if
- end if
- end if
- DBEndSession()
- cursor(-1)
- end
-
- on cleanPlan lineNumbers
- if the frame = label("weekly") then
- repeat with lineNum in lineNumbers
- delete line lineNum of field "days"
- delete line lineNum of field "days calories"
- delete line lineNum of field "days fat"
- end repeat
- put 0 into field "week total calories"
- put 0 into field "week total fat"
- else
- if the frame = label("daily") then
- repeat with lineNum in lineNumbers
- delete line lineNum of field "meals"
- delete line lineNum of field "meals calories"
- delete line lineNum of field "meals fat"
- end repeat
- put 0 into field "day total calories"
- put 0 into field "day total fat"
- end if
- end if
- end
-
- on hiliteOn
- global gHiliteSprite, gDayInsert, gMealInsert, gPlanScroll
- if the frame = label("weekly") then
- set gDayInsert to 2
- dayInsert()
- else
- if the frame = label("daily") then
- set gMealInsert to 2
- mealInsert()
- end if
- end if
- controlPosition(gPlanScroll, 0.0)
- set the visible of sprite gHiliteSprite to 1
- end
-
- on hiliteOff
- global gHiliteSprite, gPlanScroll
- set the visible of sprite gHiliteSprite to 0
- controlPosition(gPlanScroll, 0.0)
- end
-
- on helpOn
- global gLastHelp, gHelpLinks, gHelpActive, gHelpSprite
- if gHelpActive then
- helpOff()
- else
- set gHelpActive to 1
- set gLastHelp to 0
- set gHelpLinks to [3: 55, 8: 1, 9: 23, 10: 19, 11: 57, 12: 118, 13: 58, 14: 59, 16: 109, 17: 57]
- repeat with i = 22 to 31
- addProp(gHelpLinks, i, 56)
- end repeat
- puppetSprite(gHelpSprite, 1)
- end if
- end
-