#!/bin/sh # MetaCard 2.4 stack # The following is not ASCII text, # so now would be a good time to q out of more exec mc $0 "$@" 8 Fiches cuisine 3!Non resizeStack revUpdateGeometry SetVScrollbars "2,3,5,6,11,12,13,14" -- end resizeStack ----------------------------------- on scrollBarDrag set the repeatRate to 50 end scrollBarDrag ----------------------------------- --on openStack -- local tRect -- ----- -- put the windowBoundingRect into tRect -- subtract 250 from item 3 of tRect -- set the windowBoundingRect to tRect --end openStack ----------------------------------- on preOpenStack if the short name of this stack <> the short name of me then exit preOpenStack put appFolder() & "Prefs" into tPrefFileName if there is a file tPrefFileName then -- set cursor to 4 put url("file:" & tPrefFileName) into tPrefs set the rect of this stack to line 1 of tPrefs if there is a file line 2 of tPrefs then openBook line 2 of tPrefs,true -- if line 3 of tPrefs <> empty then set the hilitedLine of fld "RecipeList" to lineOffset(line 3 of tPrefs,fld "RecipeList") else set the hilitedLine of fld "RecipeList" to 1 DisplayRecipe -- end if end if end preOpenStack ----------------------------------- on closeStack local tPrefs ----- if the short name of this stack <> the short name of me then exit closeStack ----- put the rect of this stack into tPrefs put cr & the uCurBookFilePath of this stack after tPrefs put cr & the uCurRecipe of this stack after tPrefs put tPrefs into url("file:" & appFolder() & "Prefs") -- end closeStack ----------------------------------- on linkClicked pLink local tLineNum ----- lock screen put lineOffset(InternationalToUpper(pLink),fld "RecipeList") into tLineNum if tLineNum = 0 then put lineOffset(InternationalToUpper(pLink),the uCurBook of this stack) into tLineNum if tLineNum <> 0 then put the uCurBook of this stack into fld "RecipeList" put the number of lines of fld "RecipeList" into fld "RecipeNumLabel" put "Toutes les recettes" into fld "Type" SetVScrollbars "6" -- else exit linkClicked end if else if tLineNum = the hilitedLine of fld "RecipeList" then put lineOffset(InternationalToUpper(pLink),fld "RecipeList",tLineNum) + tLineNum into tLineNum if tLineNum = 0 then exit linkClicked end if end if set the hilitedLine of fld "RecipeList" to tLineNum DisplayRecipe -- unlock screen end linkClicked ----------------------------------- on commandKeyDown pKey switch pKey case "b" case "i" case "u" put the selectedChunk into tChunk if tChunk <> empty then if not the lockText of the selectedField then if word 4 of tChunk >= word 2 of tChunk then put item itemOffset(pKey,"b,i,u") of "bold,italic,underline" into tNewStyle put the textStyle of the selectedChunk into tOldStyle ----- if tNewStyle <> tOldStyle then set the textStyle of the selectedChunk to tNewStyle else set the textStyle of the selectedChunk to "plain" end if end if end if break default pass commandKeyDown end switch end commandKeyDown ----------------------------------- on setTextStyle pStyle get the textStyle of the selectedChunk if pStyle is in it then delete item itemOffset(pStyle,it) of it set the TextStyle of the selectedChunk to it else if it = plain then set the TextStyle of the selectedChunk to pStyle else put comma&pStyle after it set the TextStyle of the selectedChunk to it end if end if end setTextStyle ----------------------------------- on arrowKey pKey -- local tCurRecipeNum,tNextRecipeNum -- ----- -- put the hilitedLine of fld "RecipeList" of stack (the mainStack of this stack) into tCurRecipeNum -- if tCurRecipeNum = empty then exit arrowkey -- if the selectedField <> empty then send "closeField" to the selectedField -- ----- -- switch pKey -- case "Left" -- if tCurRecipeNum = 1 then put the number of lines of fld "RecipeList" of stack (the mainStack of this stack) into tNextRecipeNum -- else put tCurRecipeNum - 1 into tNextRecipeNum -- break -- case "right" -- if tCurRecipeNum = the number of lines of fld "RecipeList" of stack (the mainStack of this stack) then put 1 into tNextRecipeNum -- else put tCurRecipeNum + 1 into tNextRecipeNum -- break -- case "up" -- put 1 into tNextRecipeNum -- break -- case "down" -- put the number of lines of fld "RecipeList" of stack (the mainStack of this stack) into tNextRecipeNum -- end switch -- ----- -- set the hilitedLine of fld "RecipeList" to tNextRecipeNum -- DisplayRecipe -- S end arrowKey ----------------------------------- function GetAnswer pPrompt,pAlertType,pBtn1,pDefaultBtn put the defaultStack into tDefaultStack set the defaultStack to the mainStack of this stack ----- put pPrompt into fld "ConvertToHTML" set the textStyle of line 1 of fld "ConvertToHTML" to bold set the textStyle of line 2 of fld "ConvertToHTML" to italic set the textSize of line 2 of fld "ConvertToHTML" to 12 put the htmlText of fld "ConvertToHTML" into tPrompt ----- set the defaultStack to tDefaultStack switch pAlertType -- can't put it into a variable !!! case "info" if pDefaultBtn = empty then answer information tPrompt with pBtn1 as sheet else answer information tPrompt with pBtn1 or pDefaultBtn as sheet break case "question" if pDefaultBtn = empty then answer question tPrompt with pBtn1 as sheet else answer question tPrompt with pBtn1 or pDefaultBtn as sheet break case "error" if pDefaultBtn = empty then answer error tPrompt with pBtn1 as sheet else answer error tPrompt with pBtn1 or pDefaultBtn as sheet break case "warning" if pDefaultBtn = empty then answer warning tPrompt with pBtn1 as sheet else answer warning tPrompt with pBtn1 or pDefaultBtn as sheet break default if pDefaultBtn = empty then answer tPrompt with pBtn1 as sheet else answer tPrompt with pBtn1 or pDefaultBtn as sheet end switch return it end GetAnswer ----------------------------------- on CleanStack set the uCurBook of this stack to empty set the uCurRecipe of this stack to empty set the uCurBookFilePath of this stack to empty ----- put empty into fld "RecipeList" put empty into fld "RecipeNumLabel" put empty into fld "Book" put empty into fld "RecipeName" put empty into fld "Type" put empty into fld "Search" put empty into fld "FoldersList" of stack "NewBook" put btn "Tabs" into tItems repeat with i = 1 to 3 put empty into fld (line i of tItems) put empty into fld ((line i of tItems) & 2) end repeat ----- disable btn "Tabs" hide btn "RecipePopUp" hide btn "StopSearch" hide grp "Commands" hide grp "NavArrows" hide grp "Search" ----- SetVScrollbars "2,3,5,6,11,12,13,14" -- ----- set the htmlText of fld "Title" of stack "PrintA4" to empty set the htmlText of fld "Ingredients" of stack "PrintA4" to empty set the htmlText of fld "Recipe" of stack "PrintA4" to empty put empty into fld "Infos" of stack "PrintA4" ----- if the environment = "development" then save this stack end CleanStack --------------------------------------- on OpenBook pPath,pFlag local tBookName ----- set the itemDel to slash put last item of pPath into tBookName ----- put url("file:" & pPath) into tBook set the itemDel to tab if "PREF_" & space is not in item 2 of tBook then beep put quote & tBookName & quote && "n'est pas un livre de cuisine." \ & cr & "Recherchez-en un autre." into tPrompt put GetAnswer(tPrompt,"error","OK") into tAnswer -- else lock screen set cursor to 4 ----- sort tBook international put tBook into fld "RecipeList" put tBookName into fld "Book" put "Toutes les recettes" into fld "Type" set the uCurBook of this stack to tBook put the number of lines of tBook into fld "RecipeNumLabel" ------ if not pFlag then set the hilitedLine of fld "RecipeList" to 1 DisplayRecipe -- S end if ------ enable btn "Tabs" show btn "RecipePopUp" show grp "Commands" show grp "NavArrows" show grp "Search" unlock screen SetTypePopUp tBook -- set the uCurBookFilePath of this stack to pPath end if end OpenBook ----------------------------------- on DisplayNewRecipe lock screen set the itemDel to tab put the defaultStack into tDefaultStack set the defaultStack to the mainStack of this stack put the uNewRecipe of this stack into tStandardRecipe put the short system date into word 2 of item 15 of tStandardRecipe put the short system date into word 2 of item 16 of tStandardRecipe ----- put the uCurBook of this stack into tBook if tStandardRecipe is among the lines of tBook then put tBook into fld "RecipeList" put the number of lines of tBook into fld "RecipeNumLabel" put "Toutes les recettes" into fld "Type" set the hilitedLine of fld "RecipeList" to lineOffset(tStandardRecipe,tBook) DisplayRecipe -- unlock screen beep exit DisplayNewRecipe end if if tBook <> empty then put cr & tStandardRecipe after tBook else put tStandardRecipe into tBook sort tBook set the uCurBook of this stack to tBook ----- put tBook into fld "RecipeList" put the number of lines of tBook into fld "RecipeNumLabel" put "Toutes les recettes" into fld "Type" set the hilitedLine of fld "RecipeList" to lineOffset(tStandardRecipe,tBook) DisplayRecipe -- S ----- if (the icon of btn "EditRecipe" of stack "Tools" <> 1054) then set the icon of btn "EditRecipe" of stack "Tools" to 1054 EditFields -- S select text of fld "RecipeName" if "Tools" is not among the lines of the windows then DisplayRecipeInfos -- S set the height of stack "Tools" to the height of this stack - 40 drawer stack "Tools" at right of this stack aligned to top end if unlock screen with visual wipe right very fast set the defaultStack to tDefaultStack ----- end DisplayNewRecipe ----------------------------------- on DisplayRecipe local tRecipe ----- set the defaultStack to me put the hilitedText of fld "RecipeList" into tRecipe set the itemDel to tab ----- lock screen put item 1 of tRecipe into fld "RecipeName" ----- repeat with i = 3 to 5 put ConvertReturns(word 2 to -1 of item i of tRecipe) into tText put (line (i-2) of btn "Tabs") into tFldName set the htmlText of fld tFldName to tText set the htmlText of fld (tFldName & 2) to tText end repeat ----- if "Tools" is among the lines of the windows then DisplayRecipeInfos tRecipe -- ----- SetVScrollbars "2,3,5,6,11,12,13,14" -- unlock screen set the uCurRecipe of this stack to tRecipe end DisplayRecipe ---------------------------- on DisplayRecipeInfos pRecipe set the itemDel to tab ----- if pRecipe = empty then set the hilite of btn "Preferred" of stack "Tools" to false ----- put empty into fld "Type" of stack "Tools" ----- set the hilite of btn "Hot" of stack "Tools" to false set the hilite of btn "Cold" of stack "Tools" to false ----- put empty into fld "TimePrep" of stack "Tools" put empty into fld "TimeCook" of stack "Tools" ----- DisplayStars 1019,true,0 -- DisplayStars 1027,true,0 -- DisplayStars 1044,true,0 -- DisplayStars 1052,true,0 -- DisplayStars 1060,true,0 -- ----- put empty into fld "CreationDate" of stack "Tools" put empty into fld "ModifDate" of stack "Tools" else set the hilite of btn "Preferred" of stack "Tools" to word 2 of item 2 of pRecipe ----- put word 2 to -1 of item 6 of pRecipe into fld "Type" of stack "Tools" ----- set the hilite of btn "Hot" of stack "Tools" to word 2 of item 7 of pRecipe set the hilite of btn "Cold" of stack "Tools" to word 3 of item 7 of pRecipe ----- put word 2 to -1 of item 8 of pRecipe into fld "TimePrep" of stack "Tools" put word 2 to -1 of item 9 of pRecipe into fld "TimeCook" of stack "Tools" ----- DisplayStars 1019,true,word 2 of item 10 of pRecipe -- DisplayStars 1027,true,word 2 of item 11 of pRecipe -- DisplayStars 1044,true,word 2 of item 12 of pRecipe -- DisplayStars 1052,true,word 2 of item 13 of pRecipe -- DisplayStars 1060,true,word 2 of item 14 of pRecipe -- ----- put word 2 of item 15 of pRecipe into fld "CreationDate" of stack "Tools" put word 2 of item 16 of pRecipe into fld "ModifDate" of stack "Tools" end if end DisplayRecipeInfos ---------------------------- on DisplayStars pID,pFlag,pNumOfStars local tNumOfStars ----- if not pFlag then put howManyStars() into tNumOfStars else put pNumOfStars into tNumOfStars repeat with i = pID to (pID + 4) if i - (pID - 1) <= tNumOfStars then set the icon of btn ID i of stack "Tools" to 1017 else set the icon of btn ID i of stack "Tools" to 1018 end repeat end DisplayStars ---------------------------- on UpDateBook pLineNum local tBook,tRecipe ----- set the itemDel to tab put the short system date into fld "ModifDate" of stack "Tools" put the short system date into word 2 of item 16 of line pLineNum of fld "RecipeList" of stack (the mainStack of this stack) set the hilitedLine of fld "RecipeList" of stack (the mainStack of this stack) to pLineNum ----- put the uCurBook of stack (the mainStack of this stack) into tBook put line pLineNum of fld "RecipeList" of stack (the mainStack of this stack) into tRecipe put tRecipe into line lineOffset(the uCurRecipe of stack (the mainStack of this stack),tBook) of tBook set the uCurBook of stack (the mainStack of this stack) to tBook set the uCurRecipe of stack (the mainStack of this stack) to tRecipe ----- SaveBook -- end UpDateBook ---------------------------- on SaveBook put the uCurBook of stack (the mainStack of this stack) into url("file:" & the uCurBookFilePath of stack (the mainStack of this stack)) end SaveBook ---------------------------- on UpdateText pPrefix,pItem local tLineNum ----- if the hilitedText of fld "RecipeList" = empty then exit UpdateText ----- set the itemDel to tab put the hilitedLine of fld "RecipeList" into tLineNum ----- lock screen put pPrefix && ConvertReturns(the htmlText of the target) into item pItem of line tLineNum of fld "RecipeList" UpDateBook tLineNum -- MS unlock screen end UpdateText ---------------------------- on UpdateStars pID,pItemNum local i,tNumOfStars,tLineNum ----- if the hilitedText of fld "RecipeList" of stack (the mainStack of this stack) = empty then exit UpdateStars ----- repeat with i = pID to (pID + 4) if the icon of btn ID i of stack "Tools" = 1018 then exit repeat add 1 to tNumOfStars end repeat ----- set the itemDel to tab put the hilitedLine of fld "RecipeList" of stack (the mainStack of this stack) into tLineNum put word 2 of item pItemNum of line tLineNum of fld "RecipeList" of stack (the mainStack of this stack) into tCurData if tCurData <> tNumOfStars then lock screen put tNumOfStars into word 2 of item pItemNum of line tLineNum of fld "RecipeList" of stack (the mainStack of this stack) UpDateBook tLineNum -- MS unlock screen end if end UpdateStars ---------------------------- function howManyStars put the left of the target + 29 into tPos if the mouseH < tPos then return 1 else put (the mouseH - tPos) div 15 + 2 into tNum if tNum > 5 then return 5 else return tNum end if end howManyStars ----------------------------------- on SetVScrollbars pFldNumbers local tNum ----- repeat for each item tNum in pFldNumbers set the vScrollbar of fld tNum to (the formattedHeight of fld tNum > the height of fld tNum) end repeat end SetVScrollbars ----------------------------------- on EditFields local tEditFlag,tFldNumbers,tNum ----- -- if the selectedField <> empty then send "closeField" to the selectedField ----- put the defaultStack into tDefaultStack set the defaultStack to me ----- put (the icon of btn "EditRecipe" of stack "Tools" = 1054) into tEditFlag ----- put "1,2,3,5,11,12,13,14" into tFldNumbers lock screen repeat for each item tNum in tFldNumbers set the lockText of fld tNum to not tEditFlag end repeat if (the icon of btn "EditRecipe" of stack "Tools" = 1054) then set the icon of btn "AddDate" to 1088 else set the icon of btn "AddDate" to 1090 set the visible of btn "AddDate" to (the menuHistory of btn "Tabs" = 3) select empty unlock screen set the defaultStack to tDefaultStack set the visible of btn "Mask" of stack "Tools" to not tEditFlag ----- end EditFields --------------------------------------- on SetTypePopUp pBook local tLine,tTypeItem,tTypeList,tItems,tStartLine,tEndLine ----- set the itemDel to tab repeat for each line tLine in pBook put word 2 to -1 of item 6 of tLine into tTypeItem if tab & tTypeItem is not among the lines of tTypeList then put tab & tTypeItem & cr after tTypeList end repeat delete last char of tTypeList sort tTypeList international ----- put btn "RecipeList" of stack (the mainStack of this stack) into tItems put lineOffset("Type",tItems) + 1 into tStartLine if tStartLine = 1 then put lineOffset("(Type",tItems) + 1 into tStartLine put lineOffset("Temprature",tItems) - 1 into tEndLine put tTypeList into line tStartLine to tEndLine of tItems ----- if the number of lines of tTypeList = 1 then put "(Type" into line (tStartLine - 1) of tItems else put "Type" into line (tStartLine - 1) of tItems end if ----- put tItems into btn "RecipeList" of stack (the mainStack of this stack) end SetTypePopUp ----------------------------------- function ConvertReturns pText if "¬" is in pText then replace "¬" with "
" & cr & "" in pText else replace "
" & cr & "" with "¬" in pText return pText end ConvertReturns ----------------------------------- function StripExtension pList local tLine,tStrippedList ----- repeat for each line tLine in pList put char 1 to (offset(".",tLine) - 1) of tLine & cr after tStrippedList end repeat delete last char of tStrippedList return tStrippedList end StripExtension ----------------------------------- function SwitchList pList if comma is in pList then replace comma with cr in pList else replace cr with comma in pList return pList end SwitchList ----------------------------------- function AppFolder local tAppFolderName ----- put the value of word 2 of the long name of me into tAppFolderName set the itemDel to slash return item 1 to -2 of tAppFolderName & slash end AppFolder ----------------------------------- function CleanList pList local tLine,tCleanedList ----- repeat for each line tLine in pList if char 1 of tLine <> "." then put tLine & cr after tCleanedList end repeat delete last char of tCleanedList return tCleanedList end CleanList ----------------------------------- function InternationalToUpper pText local tChar,tText ----- repeat for each char tChar in pText put chartoNum(tChar) into tASCIIVal ----- if tASCIIVal >= 90 then if tASCIIVal >= 97 and tASCIIVal <= 122 then put numToChar(tASCIIVal-32) after tText else if tASCIIVal = 141 then put numToChar(130) after tText else if tASCIIVal = 142 then put numToChar(131) after tText else if tASCIIVal = 143 then put numToChar(233) after tText else if tASCIIVal = 136 then put numToChar(203) after tText else if tASCIIVal = 137 then put numToChar(229) after tText else if tASCIIVal = 144 then put numToChar(230) after tText else if tASCIIVal = 143 then put numToChar(233) after tText else if tASCIIVal = 207 then put numToChar(206) after tText else if tASCIIVal = 153 then put numToChar(239) after tText end if else put tChar after tText end if end repeat ----- return tText end InternationalToUpper 2 uCurBook uLibName BibliothqueuCurRecipe uCurBookFilePath uNewRecipe eSANS TITRE PREF_ false ING_
Pour x personnes :¬¬
REC_Préparation : x mn¬Cuisson : x mn¬¬Préparation :¬
NOTES_Origine : ¬
TYPE_ ? HOT_ false false PREPTIME_ ? mn COOKTIME_ ? mn EASY_ 0 MONEY_ 0 SPEED_ 0 ADVANCE_ 0 RATING_ 0 CREATION_ 20/05/02 MODIF_ 09/09/04 _ U Georgia U Georgia W Georgia U Lucida Grande U Lucida Grande,Japanese W Lucida Grande U Lucida Grande W Lucida Grande U Lucida Grande U Lucida Grande W Lucida Grande W Lucida Grande U Lucida Grande U Lucida Grande U Lucida Grande,Japanese U Helvetica U Lucida Grande U Lucida Grande U Tekton U Tekton W Tekton U Tekton U Tekton U Tekton W Lucida Grande U Lucida Grande U Lucida Grande U Lucida Grande,Greek @U Lucida Grande cRevStandaloneSettings 7scriptLibraries Internet Geometry PrintingMacOSX true OSX,name Fiches cuisineMacOS,documentType UNIX,fileSelector trueWindows falseWindows,LegalCopyright #2004 All rights reserved worldwideMacOS,longVersion Fiches cuisine 1.0.0.0UNIX,pageSetup trueOSX,documentType Linux falseOdt falseinclusions searchWindows,documenticonFile 8/Applications/Revolution 2.5/Sample Icons/genericdoc.ico answerDialog trueSPARC false SolIntel falseOSX,documentExtension Windows,FileDescription "Fiches cuisine 1.0.0.0 for WindowsOSX,longVersion Fiches cuisine 1.0.0.0OSX,copyright #2004 All rights reserved worldwideUNIX,printerChooser trueMacOS,MinimumSize 15000MacOS,versionnumber1 1MacOS,versionnumber2 0MacOS,Release Finalname Fiches cuisineMacOS,versionnumber3 0Hp9k700 falsers6000 false MacOS,Region 1OSX,shortVersion 1.0.0.0Windows,fileversion1 1Windows,productversion1 1Windows,fileversion2 0Windows,productversion2 0Windows,fileversion3 0Bsd falsecursors falseWindows,productversion3 0Windows,fileversion4 0Windows,productversion4 0 OSX,info Fiches cuisine Version 1.0.0.0MacOS,dynamicMemory trueIris false askDialog trueOSX,signature ????Windows,iconFile 8/Applications/Revolution 2.5/Sample Icons/genericapp.icoMacOS,PreferredSize 15000Windows,ProductName Fiches cuisineUNIX,colorChooser true MacOSPPC falseWindows,companyname SolSparc falseMacOS,creator ???? cREVGeneral @ scriptChecksum QD>hA1 debugObjects Ibutton id 1067 of group id 1025 of card id 1002 of stack "Fiches cuisine"handlerList presizeStack scrollBarDrag preOpenStack closeStack linkClicked commandKeyDown setTextStyle arrowKey GetAnswer CleanStack OpenBook DisplayNewRecipe DisplayRecipe DisplayRecipeInfos DisplayStars UpDateBook SaveBook UpdateText UpdateStars howManyStars SetVScrollbars EditFields SetTypePopUp ConvertReturns StripExtension SwitchList AppFolder CleanList InternationalToUpperbreakPoints scriptSelection char 1245 to 1244 bookmarks prevHandler preOpenStacktempScript script _on resizeStack
revUpdateGeometry
SetVScrollbars "2,3,5,6,11,12,13,14" --
end resizeStack
-----------------------------------
on scrollBarDrag
set the repeatRate to 50
end scrollBarDrag
-----------------------------------
--on openStack
-- local tRect
-- -----
-- put the windowBoundingRect into tRect
-- subtract 250 from item 3 of tRect
-- set the windowBoundingRect to tRect
--end openStack
-----------------------------------
on preOpenStack
if the short name of this stack <> the short name of me then exit preOpenStack
put appFolder() & "Prefs" into tPrefFileName
if there is a file tPrefFileName then --
set cursor to 4
put url("file:" & tPrefFileName) into tPrefs
set the rect of this stack to line 1 of tPrefs
if there is a file line 2 of tPrefs then
openBook line 2 of tPrefs,true --
if line 3 of tPrefs <> empty then
set the hilitedLine of fld "RecipeList" to lineOffset(line 3 of tPrefs,fld "RecipeList")
else set the hilitedLine of fld "RecipeList" to 1
DisplayRecipe --
end if
end if
end preOpenStack
-----------------------------------
on closeStack
local tPrefs
-----
if the short name of this stack <> the short name of me then exit closeStack
-----
put the rect of this stack into tPrefs
put cr & the uCurBookFilePath of this stack after tPrefs
put cr & the uCurRecipe of this stack after tPrefs
put tPrefs into url("file:" & appFolder() & "Prefs") --
end closeStack
-----------------------------------
on linkClicked pLink
local tLineNum
-----
lock screen
put lineOffset(InternationalToUpper(pLink),fld "RecipeList") into tLineNum
if tLineNum = 0 then
put lineOffset(InternationalToUpper(pLink),the uCurBook of this stack) into tLineNum
if tLineNum <> 0 then
put the uCurBook of this stack into fld "RecipeList"
put the number of lines of fld "RecipeList" into fld "RecipeNumLabel"
put "Toutes les recettes" into fld "Type"
SetVScrollbars "6" --
else
exit linkClicked
end if
else if tLineNum = the hilitedLine of fld "RecipeList" then
put lineOffset(InternationalToUpper(pLink),fld "RecipeList",tLineNum) + tLineNum into tLineNum
if tLineNum = 0 then
exit linkClicked
end if
end if
set the hilitedLine of fld "RecipeList" to tLineNum
DisplayRecipe --
unlock screen
end linkClicked
-----------------------------------
on commandKeyDown pKey
switch pKey
case "b"
case "i"
case "u"
put the selectedChunk into tChunk
if tChunk <> empty then
if not the lockText of the selectedField then
if word 4 of tChunk >= word 2 of tChunk then
put item itemOffset(pKey,"b,i,u") of "bold,italic,underline" into tNewStyle
put the textStyle of the selectedChunk into tOldStyle
-----
if tNewStyle <> tOldStyle then
set the textStyle of the selectedChunk to tNewStyle
else set the textStyle of the selectedChunk to "plain"
end if
end if
end if
break
default
pass commandKeyDown
end switch
end commandKeyDown
-----------------------------------
on setTextStyle pStyle
get the textStyle of the selectedChunk
if pStyle is in it then
delete item itemOffset(pStyle,it) of it
set the TextStyle of the selectedChunk to it
else
if it = plain then set the TextStyle of the selectedChunk to pStyle
else
put comma&pStyle after it
set the TextStyle of the selectedChunk to it
end if
end if
end setTextStyle
-----------------------------------
on arrowKey pKey
-- local tCurRecipeNum,tNextRecipeNum
-- -----
-- put the hilitedLine of fld "RecipeList" of stack (the mainStack of this stack) into tCurRecipeNum
-- if tCurRecipeNum = empty then exit arrowkey
-- if the selectedField <> empty then send "closeField" to the selectedField
-- -----
-- switch pKey
-- case "Left"
-- if tCurRecipeNum = 1 then put the number of lines of fld "RecipeList" of stack (the mainStack of this stack) into tNextRecipeNum
-- else put tCurRecipeNum - 1 into tNextRecipeNum
-- break
-- case "right"
-- if tCurRecipeNum = the number of lines of fld "RecipeList" of stack (the mainStack of this stack) then put 1 into tNextRecipeNum
-- else put tCurRecipeNum + 1 into tNextRecipeNum
-- break
-- case "up"
-- put 1 into tNextRecipeNum
-- break
-- case "down"
-- put the number of lines of fld "RecipeList" of stack (the mainStack of this stack) into tNextRecipeNum
-- end switch
-- -----
-- set the hilitedLine of fld "RecipeList" to tNextRecipeNum
-- DisplayRecipe -- S
end arrowKey
-----------------------------------
function GetAnswer pPrompt,pAlertType,pBtn1,pDefaultBtn
put the defaultStack into tDefaultStack
set the defaultStack to the mainStack of this stack
-----
put pPrompt into fld "ConvertToHTML"
set the textStyle of line 1 of fld "ConvertToHTML" to bold
set the textStyle of line 2 of fld "ConvertToHTML" to italic
set the textSize of line 2 of fld "ConvertToHTML" to 12
put the htmlText of fld "ConvertToHTML" into tPrompt
-----
set the defaultStack to tDefaultStack
switch pAlertType -- can't put it into a variable !!!
case "info"
if pDefaultBtn = empty then answer information tPrompt with pBtn1 as sheet
else answer information tPrompt with pBtn1 or pDefaultBtn as sheet
break
case "question"
if pDefaultBtn = empty then answer question tPrompt with pBtn1 as sheet
else answer question tPrompt with pBtn1 or pDefaultBtn as sheet
break
case "error"
if pDefaultBtn = empty then answer error tPrompt with pBtn1 as sheet
else answer error tPrompt with pBtn1 or pDefaultBtn as sheet
break
case "warning"
if pDefaultBtn = empty then answer warning tPrompt with pBtn1 as sheet
else answer warning tPrompt with pBtn1 or pDefaultBtn as sheet
break
default
if pDefaultBtn = empty then answer tPrompt with pBtn1 as sheet
else answer tPrompt with pBtn1 or pDefaultBtn as sheet
end switch
return it
end GetAnswer
-----------------------------------
on CleanStack
set the uCurBook of this stack to empty
set the uCurRecipe of this stack to empty
set the uCurBookFilePath of this stack to empty
-----
put empty into fld "RecipeList"
put empty into fld "RecipeNumLabel"
put empty into fld "Book"
put empty into fld "RecipeName"
put empty into fld "Type"
put empty into fld "Search"
put empty into fld "FoldersList" of stack "NewBook"
put btn "Tabs" into tItems
repeat with i = 1 to 3
put empty into fld (line i of tItems)
put empty into fld ((line i of tItems) & 2)
end repeat
-----
disable btn "Tabs"
hide btn "RecipePopUp"
hide btn "StopSearch"
hide grp "Commands"
hide grp "NavArrows"
hide grp "Search"
-----
SetVScrollbars "2,3,5,6,11,12,13,14" --
-----
set the htmlText of fld "Title" of stack "PrintA4" to empty
set the htmlText of fld "Ingredients" of stack "PrintA4" to empty
set the htmlText of fld "Recipe" of stack "PrintA4" to empty
put empty into fld "Infos" of stack "PrintA4"
-----
if the environment = "development" then save this stack
end CleanStack
---------------------------------------
on OpenBook pPath,pFlag
local tBookName
-----
set the itemDel to slash
put last item of pPath into tBookName
-----
put url("file:" & pPath) into tBook
set the itemDel to tab
if "PREF_" & space is not in item 2 of tBook then
beep
put quote & tBookName & quote && "n'est pas un livre de cuisine." \
& cr & "Recherchez-en un autre." into tPrompt
put GetAnswer(tPrompt,"error","OK") into tAnswer --
else
lock screen
set cursor to 4
-----
sort tBook international
put tBook into fld "RecipeList"
put tBookName into fld "Book"
put "Toutes les recettes" into fld "Type"
set the uCurBook of this stack to tBook
put the number of lines of tBook into fld "RecipeNumLabel"
------
if not pFlag then
set the hilitedLine of fld "RecipeList" to 1
DisplayRecipe -- S
end if
------
enable btn "Tabs"
show btn "RecipePopUp"
show grp "Commands"
show grp "NavArrows"
show grp "Search"
unlock screen
SetTypePopUp tBook --
set the uCurBookFilePath of this stack to pPath
end if
end OpenBook
-----------------------------------
on DisplayNewRecipe
lock screen
set the itemDel to tab
put the defaultStack into tDefaultStack
set the defaultStack to the mainStack of this stack
put the uNewRecipe of this stack into tStandardRecipe
put the short system date into word 2 of item 15 of tStandardRecipe
put the short system date into word 2 of item 16 of tStandardRecipe
-----
put the uCurBook of this stack into tBook
if tStandardRecipe is among the lines of tBook then
put tBook into fld "RecipeList"
put the number of lines of tBook into fld "RecipeNumLabel"
put "Toutes les recettes" into fld "Type"
set the hilitedLine of fld "RecipeList" to lineOffset(tStandardRecipe,tBook)
DisplayRecipe --
unlock screen
beep
exit DisplayNewRecipe
end if
if tBook <> empty then put cr & tStandardRecipe after tBook
else put tStandardRecipe into tBook
sort tBook
set the uCurBook of this stack to tBook
-----
put tBook into fld "RecipeList"
put the number of lines of tBook into fld "RecipeNumLabel"
put "Toutes les recettes" into fld "Type"
set the hilitedLine of fld "RecipeList" to lineOffset(tStandardRecipe,tBook)
DisplayRecipe -- S
-----
if (the icon of btn "EditRecipe" of stack "Tools" <> 1054) then set the icon of btn "EditRecipe" of stack "Tools" to 1054
EditFields -- S
select text of fld "RecipeName"
if "Tools" is not among the lines of the windows then
DisplayRecipeInfos -- S
set the height of stack "Tools" to the height of this stack - 40
drawer stack "Tools" at right of this stack aligned to top
end if
unlock screen with visual wipe right very fast
set the defaultStack to tDefaultStack
-----
end DisplayNewRecipe
-----------------------------------
on DisplayRecipe
local tRecipe
-----
set the defaultStack to me
put the hilitedText of fld "RecipeList" into tRecipe
set the itemDel to tab
-----
lock screen
put item 1 of tRecipe into fld "RecipeName"
-----
repeat with i = 3 to 5
put ConvertReturns(word 2 to -1 of item i of tRecipe) into tText
put (line (i-2) of btn "Tabs") into tFldName
set the htmlText of fld tFldName to tText
set the htmlText of fld (tFldName & 2) to tText
end repeat
-----
if "Tools" is among the lines of the windows then DisplayRecipeInfos tRecipe --
-----
SetVScrollbars "2,3,5,6,11,12,13,14" --
unlock screen
set the uCurRecipe of this stack to tRecipe
end DisplayRecipe
----------------------------
on DisplayRecipeInfos pRecipe
set the itemDel to tab
-----
if pRecipe = empty then
set the hilite of btn "Preferred" of stack "Tools" to false
-----
put empty into fld "Type" of stack "Tools"
-----
set the hilite of btn "Hot" of stack "Tools" to false
set the hilite of btn "Cold" of stack "Tools" to false
-----
put empty into fld "TimePrep" of stack "Tools"
put empty into fld "TimeCook" of stack "Tools"
-----
DisplayStars 1019,true,0 --
DisplayStars 1027,true,0 --
DisplayStars 1044,true,0 --
DisplayStars 1052,true,0 --
DisplayStars 1060,true,0 --
-----
put empty into fld "CreationDate" of stack "Tools"
put empty into fld "ModifDate" of stack "Tools"
else
set the hilite of btn "Preferred" of stack "Tools" to word 2 of item 2 of pRecipe
-----
put word 2 to -1 of item 6 of pRecipe into fld "Type" of stack "Tools"
-----
set the hilite of btn "Hot" of stack "Tools" to word 2 of item 7 of pRecipe
set the hilite of btn "Cold" of stack "Tools" to word 3 of item 7 of pRecipe
-----
put word 2 to -1 of item 8 of pRecipe into fld "TimePrep" of stack "Tools"
put word 2 to -1 of item 9 of pRecipe into fld "TimeCook" of stack "Tools"
-----
DisplayStars 1019,true,word 2 of item 10 of pRecipe --
DisplayStars 1027,true,word 2 of item 11 of pRecipe --
DisplayStars 1044,true,word 2 of item 12 of pRecipe --
DisplayStars 1052,true,word 2 of item 13 of pRecipe --
DisplayStars 1060,true,word 2 of item 14 of pRecipe --
-----
put word 2 of item 15 of pRecipe into fld "CreationDate" of stack "Tools"
put word 2 of item 16 of pRecipe into fld "ModifDate" of stack "Tools"
end if
end DisplayRecipeInfos
----------------------------
on DisplayStars pID,pFlag,pNumOfStars
local tNumOfStars
-----
if not pFlag then
put howManyStars() into tNumOfStars
else put pNumOfStars into tNumOfStars
repeat with i = pID to (pID + 4)
if i - (pID - 1) <= tNumOfStars then set the icon of btn ID i of stack "Tools" to 1017
else set the icon of btn ID i of stack "Tools" to 1018
end repeat
end DisplayStars
----------------------------
on UpDateBook pLineNum
local tBook,tRecipe
-----
set the itemDel to tab
put the short system date into fld "ModifDate" of stack "Tools"
put the short system date into word 2 of item 16 of line pLineNum of fld "RecipeList" of stack (the mainStack of this stack)
set the hilitedLine of fld "RecipeList" of stack (the mainStack of this stack) to pLineNum
-----
put the uCurBook of stack (the mainStack of this stack) into tBook
put line pLineNum of fld "RecipeList" of stack (the mainStack of this stack) into tRecipe
put tRecipe into line lineOffset(the uCurRecipe of stack (the mainStack of this stack),tBook) of tBook
set the uCurBook of stack (the mainStack of this stack) to tBook
set the uCurRecipe of stack (the mainStack of this stack) to tRecipe
-----
SaveBook --
end UpDateBook
----------------------------
on SaveBook
put the uCurBook of stack (the mainStack of this stack) into url("file:" & the uCurBookFilePath of stack (the mainStack of this stack))
end SaveBook
----------------------------
on UpdateText pPrefix,pItem
local tLineNum
-----
if the hilitedText of fld "RecipeList" = empty then exit UpdateText
-----
set the itemDel to tab
put the hilitedLine of fld "RecipeList" into tLineNum
-----
lock screen
put pPrefix && ConvertReturns(the htmlText of the target) into item pItem of line tLineNum of fld "RecipeList"
UpDateBook tLineNum -- MS
unlock screen
end UpdateText
----------------------------
on UpdateStars pID,pItemNum
local i,tNumOfStars,tLineNum
-----
if the hilitedText of fld "RecipeList" of stack (the mainStack of this stack) = empty then exit UpdateStars
-----
repeat with i = pID to (pID + 4)
if the icon of btn ID i of stack "Tools" = 1018 then exit repeat
add 1 to tNumOfStars
end repeat
-----
set the itemDel to tab
put the hilitedLine of fld "RecipeList" of stack (the mainStack of this stack) into tLineNum
put word 2 of item pItemNum of line tLineNum of fld "RecipeList" of stack (the mainStack of this stack) into tCurData
if tCurData <> tNumOfStars then
lock screen
put tNumOfStars into word 2 of item pItemNum of line tLineNum of fld "RecipeList" of stack (the mainStack of this stack)
UpDateBook tLineNum -- MS
unlock screen
end if
end UpdateStars
----------------------------
function howManyStars
put the left of the target + 29 into tPos
if the mouseH < tPos then return 1
else
put (the mouseH - tPos) div 15 + 2 into tNum
if tNum > 5 then return 5
else return tNum
end if
end howManyStars
-----------------------------------
on SetVScrollbars pFldNumbers
local tNum
-----
repeat for each item tNum in pFldNumbers
set the vScrollbar of fld tNum to (the formattedHeight of fld tNum > the height of fld tNum)
end repeat
end SetVScrollbars
-----------------------------------
on EditFields
local tEditFlag,tFldNumbers,tNum
-----
-- if the selectedField <> empty then send "closeField" to the selectedField
-----
put the defaultStack into tDefaultStack
set the defaultStack to me
-----
put (the icon of btn "EditRecipe" of stack "Tools" = 1054) into tEditFlag
-----
put "1,2,3,5,11,12,13,14" into tFldNumbers
lock screen
repeat for each item tNum in tFldNumbers
set the lockText of fld tNum to not tEditFlag
end repeat
if (the icon of btn "EditRecipe" of stack "Tools" = 1054) then set the icon of btn "AddDate" to 1088
else set the icon of btn "AddDate" to 1090
set the visible of btn "AddDate" to (the menuHistory of btn "Tabs" = 3)
select empty
unlock screen
set the defaultStack to tDefaultStack
set the visible of btn "Mask" of stack "Tools" to not tEditFlag
-----
end EditFields
---------------------------------------
on SetTypePopUp pBook
local tLine,tTypeItem,tTypeList,tItems,tStartLine,tEndLine
-----
set the itemDel to tab
repeat for each line tLine in pBook
put word 2 to -1 of item 6 of tLine into tTypeItem
if tab & tTypeItem is not among the lines of tTypeList then put tab & tTypeItem & cr after tTypeList
end repeat
delete last char of tTypeList
sort tTypeList international
-----
put btn "RecipeList" of stack (the mainStack of this stack) into tItems
put lineOffset("Type",tItems) + 1 into tStartLine
if tStartLine = 1 then put lineOffset("(Type",tItems) + 1 into tStartLine
put lineOffset("Température",tItems) - 1 into tEndLine
put tTypeList into line tStartLine to tEndLine of tItems
-----
if the number of lines of tTypeList = 1 then
put "(Type" into line (tStartLine - 1) of tItems
else
put "Type" into line (tStartLine - 1) of tItems
end if
-----
put tItems into btn "RecipeList" of stack (the mainStack of this stack)
end SetTypePopUp
-----------------------------------
function ConvertReturns pText
if "¬" is in pText then replace "¬" with "</p>" & cr & "<p>" in pText
else replace "</p>" & cr & "<p>" with "¬" in pText
return pText
end ConvertReturns
-----------------------------------
function StripExtension pList
local tLine,tStrippedList
-----
repeat for each line tLine in pList
put char 1 to (offset(".",tLine) - 1) of tLine & cr after tStrippedList
end repeat
delete last char of tStrippedList
return tStrippedList
end StripExtension
-----------------------------------
function SwitchList pList
if comma is in pList then replace comma with cr in pList
else replace cr with comma in pList
return pList
end SwitchList
-----------------------------------
function AppFolder
local tAppFolderName
-----
put the value of word 2 of the long name of me into tAppFolderName
set the itemDel to slash
return item 1 to -2 of tAppFolderName & slash
end AppFolder
-----------------------------------
function CleanList pList
local tLine,tCleanedList
-----
repeat for each line tLine in pList
if char 1 of tLine <> "." then put tLine & cr after tCleanedList
end repeat
delete last char of tCleanedList
return tCleanedList
end CleanList
-----------------------------------
function InternationalToUpper pText
local tChar,tText
-----
repeat for each char tChar in pText
put chartoNum(tChar) into tASCIIVal
-----
if tASCIIVal >= 90 then
if tASCIIVal >= 97 and tASCIIVal <= 122 then
put numToChar(tASCIIVal-32) after tText
else if tASCIIVal = 141 then
put numToChar(130) after tText
else if tASCIIVal = 142 then
put numToChar(131) after tText
else if tASCIIVal = 143 then
put numToChar(233) after tText
else if tASCIIVal = 136 then
put numToChar(203) after tText
else if tASCIIVal = 137 then
put numToChar(229) after tText
else if tASCIIVal = 144 then
put numToChar(230) after tText
else if tASCIIVal = 143 then
put numToChar(233) after tText
else if tASCIIVal = 207 then
put numToChar(206) after tText
else if tASCIIVal = 153 then
put numToChar(239) after tText
end if
else
put tChar after tText
end if
end repeat
-----
return tText
end InternationalToUpper
cREVGeometryCache stackID 4152 @ cREVGeneral bookmarks handlerList scriptSelection char 1 to 0prevHandler tempScript script cREVGeometryCacheIDs F1094112340258 11141093549952253 10551093620712883 10431093522859653 10361094114514045 11211093510162273 10241093537176734 10491093685077446 10841093697998805 10871093698030030 10891094112999212 11181093443423038 10201093511790111 10261093536318970 10461093440401923 10111093678427836 10741093549952136 10541094054324566 10711094054324567 10761093441636031 10141094650477070 10791094650477069 10861093441636184 10821093508428442 10231094650477071 10811093678427690 10721094553969569 19881093527130492 10421093679907553 10771093685077510 10851093640651346 10631093522149178 10331094034007342 11011093523412943 10381093697998866 10881093536357350 10481093537176817 10501093680497623 10801094650483831 26931093441635969 10131093441636235 10831093620832059 10591094197603675 11631093522450211 10351093522875953 10371093640401357 10621094036506089 11021093441636084 10151093510703840 10251093678427909 10751093700181551 10901093433989226 10031094732794332 36451093521389399 10321093681319978 10821094054422820 11091093681319979 10831093437705696 10081093536742770 10511093678427762 10731094028101743 10671093522269092 10341094112837199 11161093536311268 10451093527868953 10441093679907631 10781093435093262 10061094112373434 11151093441636135 10161093895900873 1092 cREVGeometrycache order 1093510162273 1093640651346 1093511790111 1093440401923 1093437705696 1093510703840 1093521389399 1094054422820 1094112999212 1094114514045 1094650483831 1093443423038 1093523412943 1094112340258 1094112837199 1094650477071 1093435093262 1093433989226total 70 ' : ; 0 1 2 3 5 6 8 < = ? @ A B D M N U [ = Title i # cREVGeometry Master,expectedRect 16,5,428,40Master,scalebottomDistance Master,movevDistance falseMaster,movehDistance falseMaster trueMaster,scalerightAbsolute trueMaster,scaleright trueMaster,scalerightDistance -266Master,scalerightObjectRef 1093510703840Master,scalerightObjectSide rightMaster,cardRanking 0Master,scaleleftDistance Master,scaletopDistance cREVGeneral revUniqueID 1093435093262 RecipeName + fon closeField local tLineNum ----- if the hilitedText of fld "RecipeList" of stack (the mainStack of this stack) = empty then exit closeField ----- set the itemDel to tab if target = empty then beep put item 1 of the hilitedText of fld "RecipeList" of stack (the mainStack of this stack) into target select text of the target exit closeField end if ----- put InternationalToUpper(target) into target ----- put the hilitedLine of fld "RecipeList" of stack (the mainStack of this stack) into tLineNum put item 1 of line tLineNum of fld "RecipeList" of stack (the mainStack of this stack) into tCurData ----- if tCurData <> target then lock screen put target into item 1 of line tLineNum of fld "RecipeList" of stack (the mainStack of this stack) UpDateBook tLineNum -- MS unlock screen end if end closeField @ &