home *** CD-ROM | disk | FTP | other *** search
/ Apple Macintosh Fundamentals / MacintoshFundamentals-v2-2.iso / MacFun 2.2 / MFB Tools / stack.txt < prev   
Encoding:
Text File  |  1991-02-19  |  30.2 KB  |  1,025 lines

  1. -- stack: in
  2. -- format: 10 (HyperCard 2)
  3. -- flags: 0x1000 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=64, y1=80, x2=576, y2=422)
  7. -- screen: Rect(x1=0, y1=0, x2=640, y2=480)
  8. -- card dimensions: w=512 h=342
  9. -- scroll: x=0 y=0
  10. -- background count: 1
  11. -- first background id: 2751
  12. -- card count: 1
  13. -- first card id: 2961
  14. -- list block id: 2273
  15. -- print block id: 0
  16. -- font table block id: 3420
  17. -- style table block id: 3109
  18. -- free block count: 0
  19. -- free size: 0 bytes
  20. -- total size: 31584 bytes
  21. -- stack block size: 28672 bytes
  22. -- created by hypercard version: 0x02018000
  23. -- compacted by hypercard version: 0x02018000
  24. -- modified by hypercard version: 0x02018000
  25. -- opened by hypercard version: 0x02018000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x8000000008000000
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0x8888222288882222
  30. -- patterns[4]: 0x88AA22AA88AA22AA
  31. -- patterns[5]: 0xCCAA33AACCAA33AA
  32. -- patterns[6]: 0xEEAABBAAEEAABBAA
  33. -- patterns[7]: 0xEEBBBBEEEEBBBBEE
  34. -- patterns[8]: 0xFFBBFFEEFFBBFFEE
  35. -- patterns[9]: 0xFFBBFFFFFFBBFFFF
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0xDE17C2D2
  67. ----- HyperTalk script -----
  68. ----| Mouse
  69. function lineNo
  70. return selectclickLine()
  71. end lineNo
  72.  
  73. function ClickLine
  74. -- clickline doesn't work with lines that run over (uses clickloc)
  75. return selectClickLine()
  76. end clickLine
  77.  
  78. -- as suggested by KWA 9/27/88 and implemented by SJF
  79. function selectClickLine
  80. lock screen
  81. put the lockText of the target into oldLockText
  82. set the lockText of the target to false
  83. click at the clickLoc
  84. get word 2 of the selectedLine
  85. set the lockText of the target to oldLockText
  86. unlock screen
  87. return it
  88. end selectClickLine
  89.  
  90. ----| Pop up menus
  91. function clickLocH --popMenu appears where user clicks
  92. return (item 1 of the clickLoc) + (item 1 of loc of card window)
  93. end clickLocH
  94. function clickLocV
  95. return (item 2 of the clickLoc) + (item 2 of loc of card window)
  96. end clickLocV
  97. function buttonLocH -- menu item in popMenu appears at loc of button
  98. return (item 1 of rect of target) + (item 1 of loc of card window)
  99. end buttonLocH
  100. function buttonLocV
  101. return (item 2 of rect of target) + (item 2 of loc of card window)
  102. end buttonLocV
  103. function menuLocH -- popMenu appears below, as in a pull down menu
  104. return (item 1 of rect of target+1) + (item 1 of loc of card window)
  105. end menuLocH
  106. function menuLocV
  107. return (item 4 of rect of target+1) + (item 2 of loc of card window)
  108. end menuLocV
  109.  
  110. ----| VISUAL EFFECTS (from...)
  111. on fromYourRight
  112.   global gVisualEffect
  113.   put "wipe right" into gVisualEffect -- kvs reversed dir 8/29
  114. end fromYourRight
  115. on fromYourLeft
  116.   global gVisualEffect
  117.   put "wipe left" into gVisualEffect -- kvs reversed dir 8/29
  118. end fromYourLeft
  119. on fromAbove
  120.   fromAboveTitle -- only come from above for goDown routines.
  121. end fromAbove
  122. on fromBelow
  123.   global gVisualEffect
  124.   put "iris close slow" into gVisualEffect
  125. end fromBelow
  126. on fromAboveTitle -- explicit visuals for entering title card
  127.   -- NOTE: requires bg fld title
  128.   global gVisualEffect
  129.   hide fld title
  130.   unlock screen with iris open slow
  131.   lock screen
  132.   show fld title
  133.   put dissolve into gVisualEffect
  134.   wait 6
  135. end fromAboveTitle
  136. on fromYourLeftTitle -- explicit visuals for entering title card
  137.   -- does nothing, should never be called
  138. end fromYourLeftTitle
  139. on fromYourIntro
  140.   global gVisualEffect
  141.   put "iris open slow" into gVisualEffect
  142. end fromYourIntro
  143. on fromZoomOut
  144.   global gVisualEffect
  145.   put "zoom open" into gVisualEffect
  146. end fromZoomOut
  147. on fromChallengeLeft
  148.   global gVisualEffect
  149.   put "scroll right " into gVisualEffect
  150. end fromChallengeLeft
  151. on fromChallengeRight
  152.   global gVisualEffect
  153.   put "scroll left " into gVisualEffect
  154. end fromChallengeRight
  155. on fromAni
  156.   global gVisualEffect
  157.   put empty into gVisualEffect
  158. end fromAni
  159. on fromAniEnd
  160.   global gVisualEffect
  161.   put "dissolve" into gVisualEffect
  162. end fromAniEnd
  163. on fromIndexList
  164.   global gVisualEffect
  165.   put "dissolve" into gVisualEffect
  166. end fromIndexList
  167. on fromSimulation
  168.   global gVisualEffect
  169.   put "zoom open" into gVisualEffect
  170. end fromSimulation
  171. on fromEffect effectName
  172.   global gVisualEffect
  173.   put effectName into gVisualEffect
  174. end fromEffect
  175. on fromSameCard
  176.   global gVisualEffect
  177.   put "dissolve" into gVisualEffect
  178. end fromSameCard
  179. on doVisualEffect
  180.   global gVisualEffect
  181.   do "visual" && gVisualEffect
  182. end doVisualEffect
  183.  
  184.  
  185. ----| Screen Display
  186. on HideTarg
  187.   hide the target
  188. end HideTarg
  189. on ShowTarg
  190.   show the target
  191. end ShowTarg
  192. on DragTarg
  193.   get xDragreSizeRect( rect of target,"drag" )
  194.   if (item 1 of it && "," && item 2 of it is within "0,0,513,343") and (item 3 of it && "," && item 4 of it is within "0,0,513,343") then set rect of target to it
  195.   else beep
  196. end DragTarg
  197. on ShiftDragTarg
  198.   if the shiftkey is down then
  199.     DragTarg
  200.   end if
  201. end ShiftDragTarg
  202. on DragSizeTarg
  203.   get xDragreSizeRect(rect of target)
  204.   set rect of target to it
  205. end DragSizeTarg
  206. on ToggleTargHilite
  207.   set the hilite of target to not the hilite of target
  208. end ToggleTargHilite
  209. function TargetIsLit
  210. return hilite of the target is true
  211. end TargetIsLit
  212.  
  213. on UnhiliteButtons
  214.   set lockScreen to true
  215.   if the paramcount > 0 then
  216.     repeat with x = 1 to the paramcount
  217.       do "set hilite of bkgnd button" &&  kwote(param(x)) && "to false"
  218.     end repeat
  219.   end if
  220.   set lockScreen to false
  221. end UnhiliteButtons
  222.  
  223. on UnhiliteCardButtons
  224.   set lockScreen to true
  225.   if the paramcount > 0 then
  226.     repeat with x = 1 to the paramcount
  227.       do "set hilite of button" &&  kwote(param(x)) && "to false"
  228.     end repeat
  229.   end if
  230.   set lockScreen to false
  231. end UnhiliteCardButtons
  232.  
  233. on HiliteTarg
  234.   set hilite  of the target to true
  235. end HiliteTarg
  236. on UnHiliteTarg
  237.   set hilite of the target to false
  238. end UnHiliteTarg
  239.  
  240.  
  241. ----| List, Menu, and Array
  242. on radio
  243.   repeat with i = 1 to paramCount()
  244.     set the hilite of btn param(i) to false
  245.   end repeat
  246.   set the hilite of the target to true
  247. end radio
  248. on RadioButton
  249.   repeat with n = 2 to the paramcount
  250.     do "put" && kwote(param(n)) && "into butName"
  251.     do "set" && param(1) && "of btn" && kwote(butName) && "to false"
  252.   end Repeat
  253. end RadioButton
  254. on RadioBkgndButton
  255.   repeat with n = 2 to the paramcount
  256.     do "put" && kwote(param(n)) && "into butName"
  257.     do "set" &&  param(1) && "of bg btn" && kwote(butName) && "to false"
  258.   end Repeat
  259. end RadioBkgndButton
  260.  
  261.  
  262. ----| NAVIGATION HANDLERS
  263. on goPanic
  264.   if the number of this cd is 1 then goHome
  265.   else
  266.     global gCurNode
  267.     --global gLastPlace
  268.     -- put getCardName() into gLastPlace
  269.     -- This causes last mark to return you to the place you did the
  270.     -- gopanic, which testers found confusing. kvs 1/90
  271.     set cursor to watch
  272.  
  273.     lock screen
  274.     go first card
  275.     unlock screen with dissolve
  276.     put the short name of this card into gCurNode
  277.   end if
  278. end goPanic
  279. on goUp
  280.   error "got goUp"
  281. end goUp
  282.  
  283. on goUpTo cardName
  284.   global gCurNode
  285.   set cursor to watch
  286.   doOpenCard cardName, "fromBelow"
  287.   put the short name of this card into gCurNode
  288.  
  289.   exit to hypercard -- pch 7/25/90 clears mouseclick buffer
  290.  
  291. end goUpTo
  292.  
  293. on goDown cardName
  294.   global gCurNode
  295.   set cursor to watch
  296.   doOpenCard cardName, "fromAbove"
  297.   put the short name of this card into gCurNode
  298.  
  299.   exit to hypercard -- pch 7/25/90 clears mouseclick buffer
  300.  
  301. end goDown
  302.  
  303. on goDissolve cardName
  304.   global gCurNode
  305.   doOpenCard cardName, "fromSameCard"
  306.   put the short name of this card into gCurNode
  307.   exit to hypercard -- pch 7/25/90 clears mouseclick buffer
  308. end goDissolve
  309.  
  310. on goPrev cardName
  311.   -- kvs added parameter to specify the card
  312.   if cardName is "" then put the number of prev card into cardName
  313.   doOpenCard cardName,fromYourRight
  314.   exit to hypercard -- pch 7/25/90 clears mouseclick buffer
  315. end goPrev
  316.  
  317. on goNext cardName
  318.   -- kvs added parameter to specify the card
  319.   if cardName is "" then put number of next card into cardName
  320.   -- if cardName is "" then put the id of next card into cardName
  321.   doOpenCard cardName,fromYourLeft
  322.   exit to hypercard -- pch 7/25/90 clears mouseclick buffer
  323. end goNext
  324.  
  325. on GoHome
  326.   --global gLastPlace,gCurNode
  327.   --put getCardName() & "," & gCurNode into gLastPlace
  328.   -- This causes last mark to return you to the place you did the
  329.   -- goHome, which testers found confusing. kvs 1/90
  330.   lock screen
  331.   set cursor to watch
  332.   go cd "MFhome" of Home
  333.   unlock screen with dissolve
  334. end GoHome
  335.  
  336. on goSim cardName
  337.   if cardName is empty then put number of next card into cardName
  338.   doOpenCard cardName, fromSimulation
  339. end goSim
  340. on doOpenCard cardName, fromMsg
  341.   global gVisualEffect
  342.   if cardName is not empty then
  343.     set cursor to watch
  344.     lock screen
  345.     if first word of cardName is not "card"
  346.     then put "card" && kwote(cardName) into cardName
  347.     go cardName
  348.     do "send" && fromMsg && "to this card"
  349.     if gVisualEffect is not empty then
  350.       unlock screen with visual gVisualEffect
  351.     else
  352.       unlock screen
  353.     end if
  354.   end if
  355.   set cursor to arrow
  356.   if fromMsg is "fromYourLeft" or fromMsg is "fromAbove"
  357.   then
  358.   unlock screen with iris open -- extra one if needed for map
  359.   send openAction to this cd
  360. end if
  361. end doOpenCard
  362.  
  363. on openAction
  364.   -- anything on opencard that needs to be visible goes in this routine
  365. end openAction
  366.  
  367. ----|  Text routines
  368. on putText str
  369.   put str into fld "TextDisplay"
  370. end putText
  371. on addText str
  372.   put str after fld "TextDisplay"
  373. end addText
  374.  
  375. -- returns the text
  376. function getText num
  377. put (offset("["& num & "]", field "text")+4) into firstChar
  378. put (offset("[" & (Num + 1) & "]", field "text")-2) into lastChar
  379. if lastChar > 0 then
  380.   return char firstChar to lastChar of field "text"
  381. else
  382.   return ""
  383. end if
  384. end getText
  385.  
  386. -- text currently displayed
  387. function getDisplayText
  388. return fld "textDisplay"
  389. end getDisplayText
  390.  
  391. -- display a piece of text
  392. -- for double digit numbers, you don't want a space or return after "]"
  393. on DisplayText num
  394.   lock screen
  395.   put (offset("["& num & "]", field "text")+4) into firstChar
  396.   put (offset("[" & (Num + 1) & "]", field "text")-2) into lastChar
  397.   if lastChar > 0 then put char firstChar to lastChar of field "text" into field "textdisplay"
  398.   show fld textdisplay
  399.   unlock screen with wipe right
  400. end DisplayText
  401.  
  402. on info1 -- display text when clicking on a click button
  403.   lock screen
  404.   put selectClickLine() into num
  405.   -- make sure there's something in that line before you do anything
  406.   if char 1 of line num of cd fld poplist is "Δí" then
  407.     set cursor to watch
  408.     repeat with x = 1 to the number of lines in cd fld popList
  409.       if char 1 of line x of cd fld popList is "‚àÇ" then
  410.         put "Δí" into char 1 of line x of cd fld popList -- pop out all buttons
  411.       end if
  412.     end repeat
  413.     put "‚àÇ" into char 1 of line num of cd fld popList -- push in the one
  414.     unlock screen
  415.     displayText num
  416.   end if
  417. end info1
  418.  
  419. on info2
  420.   --if the thing is already depressed, do nothing.
  421. end info2
  422.  
  423. on multiCardInfo cardlist
  424.   lock screen
  425.   put selectClickLine() into num
  426.   if char 1 of line num of cd fld popList is "Δí" then
  427.     repeat with x = 1 to the number of lines in cd fld popList
  428.       if char 1 of line x of cd fld popList is "‚àÇ" then
  429.         put "Δí" into char 1 of line x of cd fld popList -- pop out all buttons
  430.       end if
  431.     end repeat
  432.     go cd item num of cardlist
  433.     put "‚àÇ" into char 1 of line num of cd fld popList -- push in the one
  434.     unlock screen with dissolve -- staying on the same card
  435.     send openAction to this cd
  436.   end if
  437. end multiCardInfo
  438.  
  439. on resetSeen -- put all the click buttons back to unclicked state
  440.   put "popList" into fldname
  441.   repeat with x = 1 to the number of lines in cd fld fldname
  442.     if char 1 of line x of cd fld fldname = "‚àÇ" then
  443.       put "Δí" into char 1 of line x of cd fld fldname
  444.     end if
  445.   end repeat
  446.   displayText 0 -- reset the text display as well
  447. end resetSeen
  448.  
  449. -- allows a default message
  450. on displayTextDefault num, str
  451.   get getText( num )
  452.   if it is not empty then putText it
  453.   else putText str
  454. end displayTextDefault
  455.  
  456. on HideLabels b,e
  457.   lock screen
  458.   repeat with n = b to e
  459.     hide cd fld ("label." & n)
  460.   end repeat
  461.   unlock screen
  462. end HideLabels
  463.  
  464. on hideLabel b,e
  465.   lock screen
  466.   repeat with n = b to e
  467.     hide cd fld ("label" && n)
  468.   end repeat
  469.   unlock screen
  470. end hideLabel
  471.  
  472. on WipeLabel labelName, pause, visualEffect
  473.   if pause is empty then put 20 into pause
  474.   if visualEffect is empty then put "wipe right" into visualEffect
  475.   lock screen
  476.   show cd fld labelName
  477.   unlock screen with visual visualEffect
  478.   wait pause
  479. end WipeLabel
  480.  
  481.  
  482. on checkDoubleClick
  483.   send doubleClick to target
  484. end checkDoubleClick
  485.  
  486. function findField fldname
  487. repeat with x = 1 to the number of flds
  488.   if the short name of fld x = fldname then
  489.     return the name of fld x
  490.   end if
  491. end repeat
  492. repeat with x = 1 to the number of cd flds
  493.   if the short name of cd fld x = fldname then
  494.     return the name of cd fld x
  495.   end if
  496. end repeat
  497. return "false"
  498. end findfield
  499.  
  500. on playScene sceneNumber
  501.   send "playScene sceneNumber" to card "VideoList"
  502. end playScene
  503.  
  504. on introScene sceneNumber
  505.   send "introScene sceneNumber" to card "VideoList"
  506. end introScene
  507.  
  508.  
  509.  
  510. ----  STUDENT OPTIONS follow --
  511. |-- the options button calls up a panel of services
  512. on newOptions
  513.   set cursor to watch
  514.   Options
  515. end newOptions
  516. on Options
  517.   set cursor to watch
  518.   -- refix pch 8/27/90
  519.   video getStatus -- XCMD call to voyager
  520.   if the result contains "still" then
  521.     -- do nothing
  522.   else
  523.     videoclosecard -- pch 7/24/90
  524.   end if
  525.   -- end refix
  526.   set cursor to arrow
  527.   get SSPanel()
  528.   set cursor to arrow
  529.   if it is not "cancel" then do it
  530.   -- palette "Student Services"
  531. end Options
  532.  
  533. function SSpanel
  534. set cursor to watch
  535. setWindow 1
  536. NewWindow 217,248,centered,0,2,"SS Dialog",visible
  537. NewItem picture,0,0,217,248,325 -- item 1
  538. NewItem RectButton,20,83,72,133,Active, -1,"invert","Bookmark",noColor,"","" -- Bookmark, item 2
  539. NewItem RectButton,82,83,134,133,Active, -1,"invert","Notebook",noColor,"","" -- Note, item 3
  540. NewItem RectButton,144,83,196,133,Active, -1,"invert","Snapshot",noColor,"","" -- SnapShot,  Item 4
  541. NewItem RectButton,20,143,72,193,Active, -1,"invert","Glossary",noColor,"","" -- Glossary, Item 5
  542. NewItem RectButton,82,143,134,193,Active, -1,"invert","Map",noColor,"","" -- Map, Item 6
  543. NewItem RectButton,144,143,196,193,Active, -1,"invert","Help",noColor,"","" -- Help, Item 7
  544. NewItem RectButton,19,204,110,230,Active, -1,"invert","quitMF",noColor,"","" -- Quit, item 8
  545. NewItem RectButton,124,204,197,230,Active, -1,"invert","cancel",nocolor,"",""  -- Cancel, item 9
  546. set cursor to arrow
  547. get  Display (15,1 )
  548. if it = "timeout" then
  549.   killWindow
  550.   return "" -- do nothing
  551. end if
  552. killWindow -- clean up
  553. return item 4 of it
  554. end SSpanel
  555.  
  556. -- this handler is called from all stacks
  557. on BookMark
  558.   -- closeSSPanel
  559.   -- stuff from MFB MarkPlace
  560.   global gLastPlace,gPlaceNames, gPlaces,gCurNode
  561.   setWindow 1
  562.   NewWindow 290,222,centered,0,1,"Bookmark Dialog",visible
  563.   put "Student Services" & return & "Bookmark" into theText
  564.   NewItem StaticText,59,6,192,48,theText,"B garamond bold",20,plain
  565.   -- item 1
  566.   NewItem RectButton,17,8,61,45, "NotActive",1742,"dontinvert",empty,noColor,"",""
  567.   --  bookmark graphic item 2
  568.   NewItem Rectangle,0,53,290,54,1 -- item 3, decorative rule
  569.   NewItem StaticText,24,60,157,79, "Bookmark in:",Garamond,16,plain -- item 4
  570.   NewItem StaticText,24+3,79,260,95, makeStamp(),"Chicago",12,plain -- item 5
  571.   NewItem Rectangle,24,78,268,97,1 --Item 6
  572.   NewItem StaticText,24,103,268,123, "Bookmark name (optional):",Garamond,16,plain -- item 7
  573.   NewItem EditText,24,120,268,141, empty,"Chicago",12,plain,noScroll,hasCursor -- item 8
  574.   NewItem RoundButton,24,161,140,187, "Create mark",13,noCommand,"" -- item 8
  575.   NewItem RoundButton,152,164,268,184 , "Cancel",charToNum("."),Command,"" -- item 10
  576.   NewItem RoundButton,24,196,140,216, "Go to last mark",14,noCommand,"" -- item 11
  577.   NewItem RoundButton,152,196,268,216, "Select a mark",15,noCommand,"" -- item 12
  578.   set cursor to arrow
  579.   get  Display (180,1)
  580.   -- Kill the window after a timeout
  581.   if it = "timeout" then
  582.     -- delete last item of whereWeCameFrom
  583.     killWindow
  584.     return "cancel"
  585.   end if
  586.  
  587.   -- if it didn't time out, see what the user chose
  588.   put item 4 of it into userPicked
  589.   if userPicked is "Create mark" then -- create a new bookmark
  590.     put item 2 of  GetValue("Item",5) into placename-- the bookmark stamp
  591.     get item 2 of getValue("Item",8) -- the optional title
  592.     if it is not "" then put " ‚Ä¢ " & it after placeName
  593.     if placeName is not empty then
  594.       put placeName & return before gPlaceNames
  595.       put getCardName() into gLastPlace
  596.       put gLastPlace & "," & gCurNode & return before gPlaces
  597.     end if
  598.     killWindow
  599.   else if userPicked is "Go to last mark" then -- go to last mark
  600.     killWindow
  601.     LastPlace
  602.   else if userPicked is "Select a mark" then -- select mark frm bookmark
  603.     killWindow
  604.     goBookMark
  605.   else -- must be Cancel
  606.     killWindow
  607.   end if
  608. end BookMark
  609.  
  610. on LastPlace
  611.   global gLastPlace, gCurNode,gPlaces
  612.   put getCardName() & "," & gCurNode into lastPlace
  613.   get item 1 of gLastPlace
  614.   if it is not "" then
  615.  
  616.     -- begin pch fix 7/30/90
  617.     --go item 1 of gLastPlace
  618.     --put lastPlace into gLastPlace
  619.     go item 1 of line 1 of gPlaces
  620.     -- end pch fix
  621.  
  622.   else
  623.     answer "Sorry, you haven‚Äôt made any Bookmarks." with "OK"
  624.   end if
  625. end LastPlace
  626.  
  627. on goBookMark
  628.   global gLastPlace,gPlaceNames, gPlaces, gRecentPlace,gCurNode
  629.   push card
  630.   put getCardName() & "," & gCurNode into gRecentPlace
  631.   lock screen
  632.   go to card "BookMark" of stack "MF BookMark"
  633.   put gPlaceNames into field "PlaceList"
  634.   unlock screen with visual effect iris open
  635. end goBookMark
  636.  
  637. -- this handler is called from all stacks
  638. on NoteBook
  639.   -- closeSSPanel
  640.   global gStudentName
  641.   setWindow 1
  642.   NewWindow 290,290,centered,0,1,"Note",visible
  643.   put "Student Services" & return & "Note" into theText
  644.   NewItem StaticText,59,6,192,48,theText,"B garamond bold",20,plain
  645.   -- item 1
  646.   NewItem RectButton,17,8,61,45,NotActive, 17526,"dontinvert",empty,noColor,"","" -- Note icon,  Item 2
  647.   NewItem Rectangle,0,53,290,54,1 -- item 3, decorative rule
  648.   NewItem StaticText,24,60,157,79, "Note in:",Garamond,16,plain -- item 4
  649.   NewItem StaticText,24+3,79,260,95, makeStamp(),"Chicago",12,plain -- item 5
  650.   NewItem Rectangle,24,78,268,97,1 --Item 6
  651.   NewItem StaticText,24,103,268,123, "Type note here:",Garamond,16,plain -- Item 7
  652.   NewItem EditText,24,120,269,220, "",Geneva,12,plain,hasScroll,hasCursor -- Item 8
  653.   NewItem RoundButton,24,229,140,255, "Save note",13,noCommand,"" -- item 9
  654.   NewItem RoundButton,152,232,268,252 , "Tell Apple",10,noCommand,"" -- item 10
  655.   NewItem RoundButton,24,264,140,284, "Go to Notebook",11,noCommand,"" -- item 11
  656.   NewItem RoundButton,152,264,268,284 , "Cancel",charToNum("."),Command,"" -- item 12
  657.   set cursor to arrow
  658.   get  Display (3600,1)
  659.  
  660.   -- Kill the window after a timeout
  661.   if it = "timeout" then
  662.     -- delete last item of whereWeCameFrom
  663.     killWindow
  664.     return "cancel"
  665.   end if
  666.  
  667.   -- if it didn't time out, see what the user chose
  668.   put item 4 of it into userPicked
  669.   if userPicked is "Save note" then -- create a new note
  670.     set cursor to watch
  671.     put item 2 of  GetValue("Item",5) into placeName
  672.     -- the note time/place stamp
  673.     put GetValue("Item",8) into noteText -- the actual text
  674.     delete item 1 of noteText -- do this because of text commas
  675.     put stripReturns(noteText) into notetext
  676.     killWindow
  677.     set cursor to watch
  678.     if goStudentStack("ask") is "true" then
  679.       go cd "notebook"
  680.     else
  681.       exit notebook
  682.     end if
  683.     if the number of chars in fld "notes" > 29000 then
  684.       answer "Sorry, your notebook is too full to save any more notes."
  685.     else
  686.       put placeName & return & noteText & return & return after fld "notes"
  687.     end if
  688.     pop card
  689.   else if userPicked is "Tell Apple" then
  690.     -- put the comment into Apple feedback stack (comments)
  691.     -- as well as user notebook
  692.     put item 2 of  GetValue("Item",5) into placeName
  693.     -- the note time/place stamp
  694.     put GetValue("Item",8) into noteText -- the actual text
  695.     delete item 1 of noteText -- do this because of text commas
  696.     put stripReturns(noteText) into notetext
  697.     put the short name of this stack && "*" && the id of this cd into cdname
  698.     killWindow
  699.     set cursor to watch
  700.     beQuiet
  701.     go cd "notebook" of stack "MF Apple Feedback"
  702.     if the result is not "" then
  703.       put "Sorry,the Apple Feedback stack is not available for "&& "taking your comments." into string
  704.       answer string with "OK"
  705.       exit notebook
  706.     end if
  707.     if the number of chars in fld "notes" > 29000 then
  708.       answer "Sorry, the Apple Feedback stack is too full to save any more notes."
  709.     else
  710.       put gStudentName & return && cdname && return after fld "notes"
  711.       put placeName & return & noteText & return & return after fld "notes"
  712.     end if
  713.     returnQuiet
  714.   else if userPicked is "Go to notebook" then -- open the notebook
  715.     set cursor to watch
  716.     put GetValue("Item",8) into noteText -- the actual text
  717.     if noteText is not "" then
  718.       put item 2 of  GetValue("Item",5) into placeName
  719.       delete item 1 of noteText -- do this because of text commas
  720.       put stripReturns(noteText) into notetext
  721.     end if
  722.     killWindow
  723.     if goStudentStack("ask") is false then exit notebook
  724.     go cd "notebook"
  725.     if noteText is not "" then
  726.       put placeName & return & noteText & return & return after fld "notes"
  727.     end if
  728.     unlock screen with iris open
  729.   else -- must be Cancel
  730.     killWindow
  731.   end if
  732. end NoteBook
  733.  
  734. function stripReturns string
  735. repeat
  736.   get last char of string
  737.   if it = return then delete last char of String
  738.   else exit repeat
  739. end repeat
  740. return string
  741. end stripReturns
  742.  
  743. -- this handler is called from all stacks
  744. on Snapshot
  745.   -- closeSSPanel
  746.   setWindow 1
  747.   NewWindow 290,222,centered,0,1,"Snapshot Dialog",visible
  748.   put "Student Services" & return & "Snapshot" into theText
  749.   NewItem StaticText,59,6,192,48,theText,"B garamond bold",20,plain
  750.   -- item 1
  751.   NewItem RectButton,17,8,61,45, "NotActive",26475,"dontinvert",empty,noColor,"",""
  752.   --  bookmark graphic item 2
  753.   NewItem Rectangle,0,53,290,54,1 -- item 3, decorative rule
  754.   NewItem StaticText,24,60,157,79, "Snapshot in:",Garamond,16,plain -- item 4
  755.   NewItem StaticText,24+3,79,260,95, makeStamp(),"Chicago",12,plain -- item 5
  756.   NewItem Rectangle,24,78,268,97,1 --Item 6
  757.   NewItem StaticText,24,103,268,123, "Snapshot name (optional):",Garamond,16,plain -- item 7
  758.   NewItem EditText,24,120,268,141, empty,"Chicago",12,plain,noScroll,hasCursor -- item 8
  759.   NewItem RoundButton,24,161,140,187, "Take Snapshot",13,noCommand,"" -- item 8
  760.   NewItem RoundButton,152,164,268,184 , "Print Card",14,noCommand,"" -- item 9 -- pch fix 7/31/90
  761.   NewItem RoundButton,24,196,140,216, "View Snapshots",14,noCommand,"" -- item 10
  762.   NewItem RoundButton,152,196,268,216, "Cancel",charToNum("."),Command,"" -- item 11
  763.  
  764.   set cursor to arrow
  765.   get  Display (180,1)
  766.  
  767.   -- Kill the window after a timeout
  768.   if it = "timeout" then
  769.     -- delete last item of whereWeCameFrom
  770.     killWindow
  771.     return "cancel"
  772.   end if
  773.  
  774.   -- if it didn't time out, see what the user chose
  775.   put item 4 of it into userPicked
  776.   if userPicked is "Take snapshot" then -- take snapshot
  777.     set cursor to watch
  778.     put item 2 of  GetValue("Item",5) into shotName
  779.     get item 2 of getValue("Item",8)
  780.     if it is not "" then put " ‚Ä¢ " & it after shotName
  781.     killWindow
  782.     makeSnapShot shotName
  783.  
  784.   else if userPicked is "Print Card" then -- pch fix 7/31/90
  785.     domenu "print card" -- print screen
  786.     killWindow
  787.   else if userPicked is "View Snapshots" then -- new snapshot disk
  788.     killWindow
  789.     bequiet
  790.     get goSnapshot()
  791.   else -- must be Cancel
  792.     killWindow
  793.   end if
  794. end Snapshot
  795.  
  796. on makeSnapShot shotName
  797.   set cursor to watch
  798.   beQuiet
  799.   unlock screen -- for refresh, since we're taking a picture of it
  800.   lock screen
  801.   CopyScreen
  802.   if goSnapshot() is true then
  803.     go last cd
  804.     send "takeSnapShot shotName" to this bg
  805.   end if
  806. end makeSnapshot
  807.  
  808. function makeStamp
  809. -- make a module,date and time stack for bookmarks,snapshots and notes
  810. put the short name of this stack into stamp
  811.  
  812. put the short date into today
  813. get the number of chars in today
  814. delete char (it-2) to it of today -- don't need the year
  815. put " ‚Ä¢" && today && "at " after stamp
  816. put the time into timeStamp
  817. get the number of chars in timeStamp
  818. put char (it-1) to it of timeStamp into tod
  819. if tod = "PM" then put "pm" into tod
  820. else if tod = "AM" then put "am" into tod
  821. put tod into char (it-1) to it of timeStamp
  822. put timeStamp after stamp
  823. return stamp
  824. end makeStamp
  825.  
  826. on killWindow
  827.   -- free memory (temporary, until killAll works) **
  828.   SetWindow 1
  829.   NewWindow 50,50,centered,0,1,"",invisible
  830.   go this cd -- kvs added to refresh screen
  831. end killWindow
  832.  
  833. -- MAP
  834. on Map
  835.   -- closeSSPanel
  836.   global gToTheMap
  837.   set cursor to watch
  838.   put getCardName() into gToTheMap
  839.   lock screen
  840.   go "MF Map"
  841.   unlock screen with iris open
  842. end Map
  843.  
  844. --- HELP
  845. on Help
  846.   -- closeSSPanel
  847.   push card
  848.   lock screen
  849.   go stack "MF Help"
  850.   unlock screen with iris open
  851.   send openAction to this cd
  852. end Help
  853.  
  854. on Glossary
  855.   -- closeSSPanel
  856.   push card
  857.   lock screen
  858.   go to card "GlossaryBrowser" of stack "MF Glossary"
  859.   unlock screen with iris open
  860. end Glossary
  861.  
  862. on refresh
  863.   put the lockscreen into saveL
  864.   unlock screen
  865.   go this Cd
  866.   set the lockscreen to saveL
  867. end refresh
  868.  
  869. -- end of student options
  870.  
  871. --/ for selfassessments
  872. --/ All Sell-Assessment backgrounds should be named starting with "√ü√•"
  873.  
  874. on closeBackground
  875.   global gBackgroundName
  876.   put the short name of this bg into gBackgroundName
  877. end closeBackground
  878.  
  879. on openBackground
  880.   global gBackgroundName,gStackName,SAEvalData,gNoDisk
  881.   if gBackgroundName is not empty and SAEvalData is not empty then
  882.     if char 1 to 2 of gBackgroundName is "√ü√•" and char 1 to 2 of the short name of this bg is not "√ü√•" then
  883.       if gNoDisk is not "true" then
  884.         put the short name of this cd into finalcardname
  885.         put the short name of this stack into gStackName
  886.         doWarning -- if they are using a student disk, put up msg
  887.         refresh
  888.         if goStudentStack() is "true" then
  889.           go to cd report
  890.           send listResults to this card
  891.           go to cd finalCardname of gstackname
  892.         end if
  893.         killWarning
  894.       end if
  895.     end if
  896.   end if
  897. end openBackground
  898.  
  899. on doWarning
  900.   if the number of cd flds > 0 then
  901.     if findField("Warning") is not false then
  902.       show cd fld "Warning"
  903.       unlock screen
  904.       exit doWarning
  905.     end if
  906.   end if
  907.   lock screen
  908.   put makeLines( "", "Saving the results of your Self-Assessment...", "please wait.") into menuList
  909.   makeCardField name, "Warning", width, 320, height,82, topLeft, "92,78", lockText, true, textFont, "eras demi", textSize,14,style, "shadow", textalign, left, wideMargins,true
  910.   put menuList into last cd fld
  911.   put "on mouseUp" & return & "hide me" & return & "end mouseUp" into string
  912.   set the script of last cd fld to string
  913.   choose browse tool
  914.   unlock screen
  915. end doWarning
  916.  
  917. on killWarning
  918.   if the short name of last cd fld is "Warning" then
  919.     select cd fld "warning"
  920.     domenu "clear field"
  921.     choose browse tool
  922.   end if
  923. end killWarning
  924. --/ end selfassessments
  925.  
  926. function gostudentStack optAsk
  927. global gStudentStackName,gNoDisk,gStudentName
  928. -- optAsk will override the gNoDisk so they can add the disk at this tiem
  929. if optAsk is "" and gNoDisk is true then exit goStudentStack
  930. bequiet
  931. if gStudentStackName is "" then
  932.   put "Student Disk:MF Student Stack" into gStudentStackName
  933. end if
  934.  
  935. if fileExists(gStudentStackName) then
  936.   go gStudentStackName
  937.   return "true"
  938. else
  939.   put "You need your Student Disk to save your work." && "If you want to use it, insert it into the drive then " & "click ‚ÄúOK.‚Äù" into string
  940.   answer string with "No disk" or "OK"
  941.   if it is "No disk" then
  942.     put "true" into gNoDisk
  943.     return "false" -- no student disk
  944.   else if it is "OK" then
  945.     go gStudentStackName -- just have to have a dialog box
  946.     if the result is "" then
  947.       get checkName()
  948.       if it is true then
  949.         put "false" into gNoDisk
  950.         return "true" -- found it on the second try
  951.       end if
  952.     end if
  953.   end if
  954.   -- if you get here, it's due to a bad student disk or cancel.
  955.   refresh
  956.   put "true" into gNoDisk
  957.   return "false"
  958. end if
  959. end gostudentStack
  960.  
  961. function checkName
  962. global gStudentName
  963. if  name of this bg is not "student stack" then
  964.   go back
  965.   ejectDisk 1
  966.   put "This is not a Student Disk." && "It won‚Äôt be possible to save your work." into string
  967.   answer string with "OK"
  968.   return "false"
  969. end if
  970. put fld "global" of cd "gStudentName" into savedName
  971. if savedName is "" then  -- new stack
  972.   put gStudentName into fld "global" of cd "gStudentName"
  973.   return "true"
  974. end if
  975. if savedName is not gStudentName then
  976.   answer "Is your name ‚Äú" & savedName & "?‚Äù" with "Wrong name" or "Yes"
  977.   if it is "Wrong name" then
  978.     ejectDisk 1
  979.     return false -- no match
  980.   else
  981.     put savedName into gStudentName -- change the global to match the disk
  982.     return true
  983.   end if
  984. end if
  985. return true -- they matched
  986. end checkName
  987.  
  988. function goNotebook
  989. if goStudentStack("") is "true" then
  990.   go cd "notebook"
  991.   return true
  992. else
  993.   return false
  994. end if
  995. end goNotebook
  996.  
  997. function goSnapshot
  998. bequiet
  999. put "Student Disk:Snapshot" into snapName
  1000. if fileExists(snapName) then
  1001.   go snapName
  1002.   return "true"
  1003. else
  1004.   put "You need your Student Disk for snapshots. Please " && "insert it into the drive and click the ‚ÄúOK‚Äù button below." into string
  1005.   answer string with "No disk" or "OK"
  1006.   if it is "OK" then -- try again
  1007.     if fileExists(snapName) then
  1008.       go snapName
  1009.       return "true"
  1010.     else
  1011.       put "Sorry, can‚Äôt locate the Student Disk." into string
  1012.       answer string with "OK"
  1013.       return "false"
  1014.     end if
  1015.   else
  1016.     -- answered no disk
  1017.     return "false"
  1018.   end if
  1019. end if
  1020. end goSnapshot
  1021.  
  1022. on closeSSPanel
  1023.   if there is a window "Student Services" then close window "Student Services"
  1024. end closeSSPanel
  1025.