home *** CD-ROM | disk | FTP | other *** search
/ The Electronic Whole Earth Catalog / ElectronicWholeEarthCatalog.img / CRAFT / stack.txt < prev   
Text File  |  1989-02-07  |  26KB  |  937 lines

  1. -- stack: in
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x1000 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 8
  11. -- first background id: 18206
  12. -- card count: 407
  13. -- first card id: 21559
  14. -- list block id: 6168
  15. -- print block id: 72499
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 6
  19. -- free size: 18464 bytes
  20. -- total size: 2138112 bytes
  21. -- stack block size: 25600 bytes
  22. -- created by hypercard version: 0x00000000
  23. -- compacted by hypercard version: 0x01228000
  24. -- modified by hypercard version: 0x01228000
  25. -- opened by hypercard version: 0x01228000
  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: 0x0
  67. ----- HyperTalk script -----
  68. -- final stack script 2/2/89 jdt
  69. ------------------------------ Initialize Stack ------------------------------
  70. on openstack
  71.   hide menuBar
  72.   initStackList
  73.   initSound
  74.   send "initAccUpdate" to bg "Access"    -- for access updating
  75. end openstack
  76.  
  77. on initStackList
  78.   global stackList
  79.  
  80.   -- note: there is no stack 13; MUSIC is #14
  81.   put "COMMUNITY,COMMUNICATIONS,CRAFT,HEALTH" into stackList
  82.   put ",HOUSEHOLD,LEARNING,LIVELIHOOD,MEDIA,NOMADICS" after stackList
  83.   put ",PLACE,WHOLE SYSTEMS,INTRODUCTION,,MUSIC" after stackList
  84. end initStackList
  85.  
  86. --------------------------- Misc HyperCard Msgs ------------------------------
  87. on closeStack
  88.   send "exitAccUpdate" to bg "Access"   -- for access updating
  89. end closeStack
  90.  
  91. on closeCard
  92.   -- turn off sound, if any, before leaving card
  93.   soundCloseCard
  94. end closeCard
  95.  
  96. on doMenu menuChoice
  97.   if menuChoice = "Help" then
  98.     goHelp
  99.   else
  100.     pass doMenu
  101.   end if
  102. end doMenu
  103.  
  104. ------------------------------ Sound Scripts ------------------------------
  105. on initSound
  106.   global curSnd, sndRefNum
  107.  
  108.   put 0 into sndRefNum
  109.   put empty into curSnd
  110. end initSound
  111.  
  112. function openSound shortname
  113. put the long name of this stack into foo
  114. delete first word of foo
  115. delete first char of foo
  116. delete last char of foo
  117. repeat with i = length(foo) down to 1
  118.   if char i of foo is ":" then exit repeat
  119. end repeat
  120. put (char 1 to i of foo) & shortname into bar
  121. return OpenRes(bar)
  122. end openSound
  123.  
  124. on idle
  125.   global curSnd, curChunk
  126.  
  127.   if curSnd is not empty then
  128.     put curSnd & "." & curChunk into chunkName
  129.  
  130.     if the sound is chunkName then
  131.       add 1 to curChunk
  132.       play curSnd & "." & curChunk
  133.     else if the sound is "done" then
  134.       get curSnd
  135.       put empty into curSnd
  136.       set hilite of card button ("Sound " & it) to false
  137.     end if
  138.   end if
  139.  
  140.   pass idle
  141. end idle
  142.  
  143. on playLong sndName
  144.   global curSnd, curChunk, sndRefNum
  145.  
  146.   if curSnd is not empty then
  147.     stopSnd
  148.   else
  149.     put char 1 to 2 of sndName into prefix
  150.     -- special case for down home records
  151.     if prefix is "dh" OR prefix is "DH" then
  152.       put char 3 to 4 of sndName into num
  153.       if num > 35 then put "d2" into prefix
  154.       else put "d1" into prefix
  155.     end if
  156.     put openSound( "SoundFiles:" & prefix & ".chunx" ) into sndRefNum
  157.  
  158.     put sndName into curSnd
  159.     set hilite of card button ("Sound " & curSnd) to true
  160.     put 1 into curChunk
  161.  
  162.     play curSnd & "." & curChunk
  163.  
  164.   end if
  165. end playLong
  166.  
  167. on stopSnd
  168.   global curSnd, curChunk
  169.  
  170.   play stop
  171.  
  172.   if curSnd is not empty
  173.   then
  174.   set hilite of card button ("Sound " & curSnd) to false
  175. end if
  176.  
  177. put empty into curSnd
  178. put 0 into curChunk
  179. end stopSnd
  180.  
  181. on soundCloseCard
  182.   global sndRefNum
  183.  
  184.   stopSnd
  185.   if sndRefNum is not 0 then
  186.     closeRes sndRefNum
  187.   end if
  188.   put 0 into sndRefNum
  189. end soundCloseCard
  190.  
  191. on newSoundBtn sndCode
  192.   -- authoring script to create a new sound button to play 'sndCode' resource
  193.   doMenu "New Button"
  194.   put "Sound" && sndCode into sndBtnName
  195.   set the name of last button to sndBtnName
  196.   set the style of btn sndBtnName to transparent
  197.   set the icon of btn sndBtnName to 13667   -- musical note icon id
  198.   set the rect of btn sndBtnName to "291,301,329,337"
  199.   set the autoHilite of btn sndBtnName to true
  200.   set the showName of btn sndBtnName to false
  201.  
  202.   put "on mouseUp" & return into sndScript
  203.   put "  playLong" && sndCode & return after sndScript
  204.   put "end mouseUp" & return after sndScript
  205.  
  206.   set the script of btn sndBtnName to sndScript
  207.  
  208.   choose Browse tool
  209. end newSoundBtn
  210.  
  211. ---------------------- Misc Hypercard Object Utilities ----------------------
  212. function hasCdField what
  213. repeat with i = 1 to number of cd fields
  214.   if short name of cd field i = what then return true
  215. end repeat
  216. return false
  217. end hasCdField
  218.  
  219. function hasBgField what
  220. repeat with i = 1 to number of bg fields
  221.   if short name of bg field i = what then return true
  222. end repeat
  223. return false
  224. end hasBgField
  225.  
  226. on listFields
  227.   -- handy utility for listing names of all fields on a card
  228.   -- hidden fields are marked with asterisks
  229.   set lockScreen to true
  230.   doMenu "New Field"
  231.   put the number of card fields into here
  232.   set name of card field here to "fieldListing"
  233.   set style of card field "fieldListing" to scrolling
  234.   set the rect of card field "fieldListing" to "0,20,200,300"
  235.   set textFont of card field "fieldListing" to monaco
  236.   set textSize of card field "fieldListing" to 9
  237.   set lockScreen to false
  238.  
  239.   repeat with cntr = 1 to the number of bkgnd fields
  240.     put short name of bg fld cntr into fldName
  241.     get the visible of bg fld cntr
  242.     if it is true then
  243.       put " " && "bg" && "fld" && Quote & fldName & Quote & Return after cd fld "fieldListing"
  244.     else
  245.       put "*" && "bg" && "fld" && Quote & fldName & Quote  & Return after cd fld "fieldListing"
  246.     end if
  247.   end repeat
  248.  
  249.   put Return after card field "fieldListing"
  250.   repeat with cntr = 1 to the number of card fields
  251.     put short name of cd fld cntr into fldName
  252.     get the visible of cd fld cntr
  253.     if it is true then
  254.       put " " && "cd" && "fld" && Quote & fldName & Quote & Return after cd fld "fieldListing"
  255.     else
  256.       put "*" && "cd" && "fld" && Quote & fldName & Quote  & Return after cd fld "fieldListing"
  257.     end if
  258.   end repeat
  259. end listFields
  260.  
  261. on listButtons
  262.   set lockScreen to true
  263.   doMenu "New Field"
  264.   put the number of card fields into here
  265.   set name of card field here to "fieldListing"
  266.   set style of card field "fieldListing" to scrolling
  267.   set the rect of card field "fieldListing" to "0,20,200,300"
  268.   set textFont of card field "fieldListing" to monaco
  269.   set textSize of card field "fieldListing" to 9
  270.   set lockScreen to false
  271.  
  272.   repeat with cntr = 1 to the number of bkgnd buttons
  273.     put short name of bg btn cntr into btnName
  274.     get the visible of bg btn cntr
  275.     if it is true then
  276.       put " " && "bg" && "btn" && Quote & btnName & Quote & Return after cd fld "fieldListing"
  277.     else
  278.       put "*" && "bg" && "btn" && Quote & btnName & Quote  & Return after cd fld "fieldListing"
  279.     end if
  280.   end repeat
  281.  
  282.   put Return after card field "fieldListing"
  283.   repeat with cntr = 1 to the number of card buttons
  284.     put short name of cd btn cntr into btnName
  285.     get the visible of cd btn cntr
  286.     if it is true then
  287.       put " " && "cd" && "btn" && Quote & btnName & Quote & Return after cd fld "fieldListing"
  288.     else
  289.       put "*" && "cd" && "btn" && Quote & btnName & Quote  & Return after cd fld "fieldListing"
  290.     end if
  291.   end repeat
  292. end listButtons
  293.  
  294. ------------------------------ Make New Cards -------------------------------
  295. -- Authoring scripts for creating new article cards.
  296. --
  297. on emptyFields
  298.   -- empties all card and bkgnd fields on the present card
  299.   put number of bg fields into fc
  300.   repeat with i = 1 to fc
  301.     put empty into bg field i
  302.   end repeat
  303.  
  304.   put number of cd fields into fc
  305.   repeat with i = 1 to fc
  306.     put empty into cd field i
  307.   end repeat
  308. end emptyFields
  309.  
  310. on copyFields srcCard, destCard
  311.   go to srcCard
  312.   put number of fields into fc
  313.   repeat with i = 1 to fc
  314.     put short name of fld i into thisFldName
  315.     put fld thisFldName of srcCard into fld thisFldName of destCard
  316.   end repeat
  317.  
  318.   put number of cd fields into fc
  319.   repeat with i = 1 to fc
  320.     put short name of cd fld i into thisFldName
  321.     put cd fld thisFldName of srcCard into cd fld thisFldName of destCard
  322.   end repeat
  323. end copyFields
  324.  
  325. on newReview
  326.   push card
  327.   go to first card of bkgnd "Review"
  328.   put the id of this bg into goodBgID
  329.  
  330.   domenu copy card
  331.   pop card
  332.   domenu paste card
  333.   emptyFields
  334.  
  335.   if the id of this bg is not goodBgID then
  336.     answer "The background ID is bad.  Deleting..." with "OK"
  337.     doMenu "Delete Card"
  338.     exit newReview
  339.   end if
  340.  
  341.   put "Review" into fld "theIdent"
  342.   put "Menu" into field "theHeading"
  343.  
  344.   answer "Do you want?" with "New Title" or "Prev Title"
  345.   if it is "New Title" then
  346.     ask "What Title for this Review?"
  347.     put it into fld "theTitle"
  348.   else
  349.     put fld "theTitle" of prev card into fld "theTitle"
  350.   end if
  351.  
  352.   answer "Use?" with "New Acc#" or "Prev Acc#"
  353.   if it is "New Acc#" then
  354.     ask "What Accession number for this Review?"
  355.     put it into field "Accession"
  356.   else
  357.     put fld "Accession" of prev card into fld "Accession"
  358.   end if
  359. end newReview
  360.  
  361. on newAccess
  362.   push card
  363.   go to first card of bkgnd "Access"
  364.   put the id of this bg into goodBgID
  365.  
  366.   domenu copy card
  367.   pop card
  368.   domenu paste card
  369.   emptyFields
  370.  
  371.   if the id of this bg is not goodBgID then
  372.     answer "The background ID is bad.  Deleting..." with "OK"
  373.     doMenu "Delete Card"
  374.     exit newAccess
  375.   end if
  376.  
  377.   put "Access" into fld "theIdent"
  378.   put "Menu" into field "theHeading"
  379.   put field "theTitle" of previous card into field "theTitle"
  380.   put field "accession" of previous card into field "accession"
  381.   Answer "Does this item require a Survey Acc #?" with "Yes" or "No"
  382.   if it is "Yes" then
  383.     ask "What Survey Accession number for this item?"
  384.     put it into field "SurveyAccession"
  385.   end if
  386. end newAccess
  387.  
  388. on newExcerpt
  389.   push card
  390.   go to first card of bkgnd "Excerpt"
  391.   put the id of this bg into goodBgID
  392.   domenu copy card
  393.   pop card
  394.   domenu paste card
  395.   emptyFields
  396.  
  397.   if the id of this bg is not goodBgID then
  398.     answer "The background ID is bad.  Deleting..." with "OK"
  399.     doMenu "Delete Card"
  400.     exit newExcerpt
  401.   end if
  402.  
  403.   put "Excerpt" into fld "theIdent"
  404.   put "Menu" into field "theHeading"
  405.   put field "theTitle" of previous card into field "theTitle"
  406.   put field "accession" of previous card into field "accession"
  407. end newExcerpt
  408.  
  409. on newPicture
  410.   push card
  411.   go to first card of bkgnd "Picture"
  412.   domenu copy card
  413.   pop card
  414.   domenu paste card
  415.   emptyFields
  416.  
  417.   if the id of this bg is not goodBgID then
  418.     answer "The background ID is bad.  Deleting..." with "OK"
  419.     doMenu "Delete Card"
  420.     exit newPicture
  421.   end if
  422.  
  423.   put "Picture" into fld "theIdent"
  424.   put "Menu" into field "theHeading"
  425.   put field "theTitle" of previous card into field "theTitle"
  426.   put field "accession" of previous card into field "accession"
  427.   Answer "Is this Picture a full-screen graphic?" with "Yes" or "No"
  428.   if it is "Yes" then
  429.     put "X" into fld "fullScreen"
  430.   else
  431.     put empty into fld "fullScreen"
  432.   end if
  433. end newPicture
  434.  
  435. ---------------------------- Lookup Scripts ------------------------------
  436. -- Most of the action in the Catalog consists of jumping from one card to
  437. -- another.  These are the underlying scripts for 'lookup'.
  438.  
  439. function whichstack theAccess
  440. -- Each stack has a unique two-digit identifier.  Thses identifiers are used
  441. -- as prefixes for all accession numbers in the Whole Earth stacks.  By
  442. -- examining the first two digits of any accession number we can deternine
  443. -- what Whole Earth stack contains the article corresponding to an accession
  444. -- number.
  445. global stackList
  446.  
  447. put char 1 to 2 of theAccess into theStack
  448. return item theStack of stackList
  449. end whichstack
  450.  
  451. on lookup theAccess, theEffect
  452.   -- This is the key navigation script.  'theAccess' is either a card id or
  453.   -- an accession number.  If it is a card id, we go there forthwith.
  454.   -- Otherwise it is an accession number and we must find the accession
  455.   -- number in theaccList and then get the card id from the corresponding
  456.   -- line in the idList.
  457.   global accList, idList
  458.  
  459.   lock screen
  460.   if theAccess contains "card id" then     -- theAccess is a card id, go there
  461.     go to theAccess
  462.     unlock screen with theEffect
  463.     exit lookup
  464.   end if
  465.  
  466.   -- it's an accession; check to see if it is in a different stack and if so,
  467.   -- go there.
  468.   put whichStack(theAccess) into theStack
  469.   if theStack is not (short name of this stack) then
  470.     set lockrecent to true
  471.     go to stack theStack
  472.     set lockrecent to false
  473.   end if
  474.  
  475.   -- reload accList and idList
  476.   -- only necessary if 'lookup' is given an accession number
  477.   put char 1 to 2 of theAccess into accStack
  478.   put char 1 to 2 of accList into accListStack
  479.   if accStack <> accListStack then
  480.     put field "theIDs" of card "Contents" into idList
  481.     put field "theAccessions" of card "Contents" into accList
  482.   end if
  483.  
  484.   -- find access number in accList
  485.   put offset(theAccess, accList) into where
  486.   if where is 0 then
  487.     beep
  488.     put "Lookup failed on access #" & theAccess && "..." into errMsg
  489.     answer errMsg with "OK"
  490.   else
  491.     -- calculate its line and get corresponding card id in idList
  492.     put line (where div 9 + 1) of idList into targetID
  493.     go to targetID
  494.     unlock screen with theEffect
  495.   end if
  496. end lookup
  497.  
  498. ----------------------- Navigation on the Fly -------------------------------
  499. -- Normally the navigation buttons ("Map", "Right", "Left", "Up" and "Down")
  500. -- check their corresponding "dest" field for a card id or an accession
  501. -- number and then call 'lookup' with that information.  However, if the
  502. -- "dest" field is empty, the button will call one of the following scripts
  503. -- which calculates the destination on the fly.  This was useful during
  504. -- development when the "dest" fields were empty.
  505. --
  506. function getLastIMap
  507. put empty into lastIMapFld
  508.  
  509. put number of cd flds into cdFldCount
  510. repeat with i = 1 to cdFldCount
  511.   if short name of cd fld i = "iMap" then
  512.     put i into lastIMapFld
  513.   end if
  514. end repeat
  515.  
  516. return lastIMapFld
  517. end getLastIMap
  518.  
  519. on prevSection
  520.   set lockscreen to true
  521.   backupToBG "Cluster Map"
  522.   if bkgnd field "theIdent" of prev card is "Section Map" then
  523.     backupToBG "Cluster Map"
  524.   end if
  525.   unlock screen with scroll right
  526. end prevSection
  527.  
  528. on nextSection
  529.   set lockscreen to true
  530.   go to next card of bkgnd "Cluster Map"
  531.   if bkgnd field "theIdent" of prev card is "Section Map" then
  532.     go to next card of bkgnd "Cluster Map"
  533.   end if
  534.   unlock screen with scroll left
  535. end nextSection
  536.  
  537. on prevMap
  538.   set lockscreen to true
  539.   if bkgnd field "theIdent" of prev card is "Cluster Map" then
  540.     go to next card of bkgnd "Cluster Map"
  541.   end if
  542.   backupToBG "Item Map"
  543.   unlock screen with scroll right
  544. end prevMap
  545.  
  546. on nextMap
  547.   set lockscreen to true
  548.   go to next card of bkgnd "Item Map"
  549.   if bkgnd field "theIdent" of prev card is "Cluster Map" then
  550.     go to prev card
  551.     backupToBG "Cluster Map"
  552.     go to next card of bkgnd "Item Map"
  553.   end if
  554.   unlock screen with scroll left
  555. end nextMap
  556.  
  557. on prevArticle
  558.   lock screen
  559.  
  560.   -- back out of present article by looking for different accession
  561.   put fld "accession" into thisAcc
  562.   repeat while fld "accession" = thisAcc
  563.     set cursor to busy
  564.     go to prev card
  565.   end repeat
  566.  
  567.   -- if in Item Map, go to article in last "iMap" field
  568.   -- else if in prev article, go to page 1
  569.   if short name of this bg is "Item Map" then
  570.     put getLastIMap() into lastIMap
  571.     send mouseUp to cd fld lastIMap
  572.   else
  573.     repeat
  574.       set cursor to busy
  575.       if short name of this bg <> "Picture" then  -- "thePage" is cd fld
  576.         if word 1 of fld "thePage" is "1" then
  577.           exit repeat
  578.         end if
  579.       end if
  580.       go to prev card
  581.     end repeat
  582.   end if
  583.  
  584.   unlock screen with scroll right slow
  585. end prevArticle
  586.  
  587. on nextArticle
  588.   lock screen
  589.   put fld "accession" into thisAcc
  590.  
  591.   -- push forward out of present article
  592.   repeat while fld "accession" = thisAcc
  593.     set cursor to busy
  594.     go to next card
  595.   end repeat
  596.  
  597.   -- if we're in a Review, stop
  598.   -- else we are in a Map bg,
  599.   -- back up to Item Map, then forward one
  600.   if short name of this bg contains "Map" then
  601.     go to prev card    -- in case at "Section Map"
  602.     backupToBG "Item Map"
  603.     go to next card
  604.   end if
  605.  
  606.   unlock screen with scroll left slow
  607. end nextArticle
  608.  
  609. on prevPage                            -- page back in article
  610.   put fld "accession" into thisAcc
  611.   put fld "accession" of prev card into prevAcc
  612.  
  613.   lock screen
  614.   if prevAcc <> thisAcc then    -- wrap from first page to last page
  615.     repeat while fld "accession" of next card = thisAcc
  616.       go to next card
  617.     end repeat
  618.   else
  619.     go to prev card
  620.   end if
  621.   unlock screen with scroll left
  622. end prevPage
  623.  
  624. on nextPage                            -- page forward in article
  625.   put fld "accession" into thisAcc
  626.   put fld "accession" of next card into nextAcc
  627.  
  628.   lock screen
  629.   if nextAcc <> thisAcc then    -- wrap from last page to first page
  630.     repeat while fld "accession" of prev card = thisAcc
  631.       go to prev card
  632.     end repeat
  633.   else
  634.     go to next card
  635.   end if
  636.   unlock screen with scroll left
  637. end nextPage
  638.  
  639. on backupToBG bgName
  640.   repeat with i = (the number of this card -1 ) down to 1
  641.     if (field theIdent of card i) is bgName then exit repeat
  642.     set cursor to busy
  643.   end repeat
  644.   if (field theIdent of card i) is not bgName then
  645.     go to last card
  646.     repeat with i = (the number of this card -1 ) down to 1
  647.       if (field theIdent of card i) is bgName then exit repeat
  648.       set cursor to busy
  649.     end repeat
  650.   end if
  651.   go to card i
  652. end backupToBG
  653.  
  654. -------------------------- Navigation Buttons -------------------------------
  655. -- The Navigation Buttons are the "Map", "Left", and "Right" buttons, and the
  656. -- pager buttons: "Up" and "Down" on the Article cards.  Their scripts are
  657. -- centralized at the stack level (rather than in the buttons themselves)
  658. -- for convenience during development.
  659.  
  660. ---------------------- Cluster Map Navigation Buttons -----------------------
  661. on doClusterMapButton
  662.   if fld "MapDest" is not empty then
  663.     lookup fld "MapDest", "dissolve"
  664.   else
  665.     visual effect dissolve
  666.     go to first card of bg "Section map"
  667.   end if
  668. end doClusterMapButton
  669.  
  670. on doClusterLeftButton
  671.   if fld "LeftDest" is not empty then
  672.     lookup fld "LeftDest", "scroll right"
  673.   else
  674.     prevSection
  675.   end if
  676. end doClusterLeftButton
  677.  
  678. on doClusterRightButton
  679.   if fld "RightDest" is not empty then
  680.     lookup fld "RightDest", "scroll left"
  681.   else
  682.     nextSection
  683.   end if
  684. end doClusterRightButton
  685.  
  686. ------------------------ Item Map Navigation Buttons --------------------------
  687. on doItemMapButton
  688.   if fld "MapDest" is not empty then
  689.     lookup fld "MapDest", "dissolve"
  690.   else
  691.     lock screen
  692.     backUpToBG "Cluster Map"
  693.     unlock screen with dissolve
  694.   end if
  695. end doItemMapButton
  696.  
  697. on doItemLeftButton
  698.   if fld "LeftDest" is not empty then
  699.     lookup fld "LeftDest", "scroll right"
  700.   else
  701.     prevMap
  702.   end if
  703. end doItemLeftButton
  704.  
  705. on doItemRightButton
  706.   if fld "RightDest" is not empty then
  707.     lookup fld "RightDest", "scroll left"
  708.   else
  709.     nextMap
  710.   end if
  711. end doItemRightButton
  712.  
  713. ------------------------ Article Navigation Buttons --------------------------
  714. on doArticleMapButton
  715.   if fld "MapDest" is not empty then
  716.     lookup fld "MapDest", "dissolve"
  717.   else
  718.     lock screen
  719.     backUpToBG "Item Map"
  720.     unlock screen with dissolve
  721.   end if
  722. end doArticleMapButton
  723.  
  724. on doArticleLeftButton
  725.   if fld "LeftDest" is not empty then
  726.     lookup fld "LeftDest", "scroll right slow"
  727.   else
  728.     prevArticle
  729.   end if
  730. end doArticleLeftButton
  731.  
  732. on doArticleRightButton
  733.   if fld "RightDest" is not empty then
  734.     lookup fld "RightDest", "scroll left slow"
  735.   else
  736.     nextArticle
  737.   end if
  738. end doArticleRightButton
  739.  
  740. on doArticleUpButton
  741.   if fld "UpDest" is not empty then
  742.     lookup fld "UpDest", "scroll right"
  743.   else
  744.     prevPage
  745.   end if
  746. end doArticleUpButton
  747.  
  748. on doArticleDownButton
  749.   if fld "DownDest" is not empty then
  750.     lookup fld "DownDest", "scroll left"
  751.   else
  752.     nextPage
  753.   end if
  754. end doArticleDownButton
  755.  
  756. --------------------------- Popdown Menu Scripts -----------------------------
  757. function popMenu itemList, itemCount
  758. -- itemCount is the number of items passed by client
  759. -- put the paramCount
  760. put the short name of this bg into bgName
  761. if bgName is "Access" then
  762.   put ",(-,Help,Contents,Index,Print Article,Print Order Form,Quick Search,Quit" into menuString
  763. else if bgName is in "Review,Excerpt,Picture" then
  764.   put ",(-,Help,Contents,Index,Print Article,(Print Order Form,Quick Search,Quit" into menuString
  765. else
  766.   put ",(-,Help,Contents,Index,(Print Article,(Print Order Form,Quick Search,Quit" into menuString
  767. end if
  768.  
  769. put the rect of target into popRect
  770. add 1 to item 3 of popRect        -- compensate for error in XFCN code
  771. put popDown( itemList & menuString, popRect ) into theCommand
  772.  
  773. -- should client handle the command?
  774. if theCommand <= itemCount
  775. then RETURN theCommand
  776.  
  777. -- otherwise, we should handle it
  778. subtract itemCount+1 from theCommand
  779.  
  780. if theCommand = 1 then
  781.   goHelp
  782. else if theCommand = 2 then
  783.   go to card "contents"
  784. else if theCommand = 3 then
  785.   goIndex
  786. else if theCommand = 4 then
  787.   printArt
  788. else if theCommand = 5 then
  789.   printOrderForm
  790. else if theCommand = 6 then
  791.   go to stack "Quick Search"
  792. else if theCommand = 7 then
  793.   doMenu "Quit Hypercard"
  794. end if
  795.  
  796. return 0
  797. end popMenu
  798.  
  799. on goWholeEarth
  800.   -- called by "Earth" buttons and the popdown menus
  801.   visual effect checkerboard slow
  802.   go to card 2 of stack "WHOLE EARTH"
  803. end goWholeEarth
  804.  
  805. on goIndex
  806.   global indexLetter
  807.  
  808.   if indexLetter is not in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" then
  809.     put "A" into indexLetter
  810.   end if
  811.  
  812.   visual effect checkerboard slow
  813.   do "go to card" && indexLetter && "of stack Index"
  814. end goIndex
  815.  
  816. on printArt
  817.   -- no user control is offered
  818.   -- we just print all the cards of the article in succession
  819.  
  820.   lock screen
  821.   set lockRecent to true
  822.   push card
  823.  
  824.   -- back up just beyond first card of article
  825.   put field "accession" into acc
  826.   repeat while field "accession" = acc
  827.     go to prev card
  828.   end repeat
  829.   -- move ahead to beginning of article
  830.   go to next card
  831.  
  832.   -- print each card of the article
  833.   open printing
  834.   repeat while field "accession" = acc
  835.     print card
  836.     go to next card
  837.   end repeat
  838.   close printing
  839.  
  840.   pop card
  841.   set lockRecent to false
  842.   unlock screen
  843. end printArt
  844.  
  845. on printOrderForm
  846.   go to stack "EWEC Order Form"
  847. end printOrderForm
  848.  
  849. on goHelp
  850.   put short name of this bg into bgName
  851.   if bgname = "Section Map" then
  852.     put "Domain" into bgName
  853.   else if bgName = "Cluster Map" then
  854.     put "Section" into bgName
  855.   else if bgName = "Item Map" then
  856.     put "Cluster" into bgName
  857.   else if bgName = "Picture" then
  858.     if fld "fullScreen" is not empty then
  859.       put "Full Screen Picture" into bgName
  860.     end if
  861.   end if
  862.  
  863.   put showHelp(bgName) into choice
  864.  
  865.   if choice = 1 then
  866.     go to card id 63823 of stack "Introduction"
  867.   else if choice = 2 then
  868.     go to stack "Help"
  869.   end if
  870. end goHelp
  871.  
  872. ------------------------ Popdown Navigation --------------------------------
  873. on popBackToEarth
  874.   visual effect dissolve
  875.   go to card 2 of "WHOLE EARTH"
  876. end popBackToEarth
  877.  
  878. on popBackToDomain
  879.   visual effect dissolve
  880.   go to first card of bg "Section Map"
  881. end popBackToDomain
  882.  
  883. on popBackToClusterMap
  884.   if line 3 of fld "popupDest" is empty then
  885.     visual effect dissolve
  886.     backupToBG "Cluster Map"
  887.   else
  888.     lookup line 3 of fld "popupDest", "dissolve"
  889.   end if
  890. end popBackToClusterMap
  891.  
  892. on popBackToItemMap
  893.   if line 4 of fld "popupDest" is empty then
  894.     visual effect dissolve
  895.     backupToBG "Item Map"
  896.   else
  897.     lookup line 4 of fld "popupDest", "dissolve"
  898.   end if
  899. end popBackToItemMap
  900.  
  901. ---------------------------- Popmenu Scripts ---------------------------------
  902. -- Clicking on the "Menu" field brings up a popdown menu by calling one of the
  903. -- following scripts depending on the card's background.  The only difference
  904. -- is in the number of hierarchy levels above a particular card.  When the
  905. -- chooses to return to a higher level, the script will dissolve to each
  906. -- intervening level until arriving at the chosen level.
  907. --
  908. on popMenuCMap
  909.   get popMenu( field "popup", 2 )
  910.   if it = 0 then exit popMenuCMap
  911.  
  912.   if it <= 2 then popBackToDomain
  913.   if it <= 1 then popBackToEarth
  914. end popMenuCMap
  915.  
  916. on popMenuIMap
  917.   get popMenu( field "popup", 3 )
  918.   if it = 0 then exit popMenuIMap
  919.  
  920.   if it <= 3 then popBackToClusterMap
  921.   if it <= 2 then popBackToDomain
  922.   if it <= 1 then popBackToEarth
  923. end popMenuIMap
  924.  
  925. on popMenuArticle
  926.   get popMenu( field "popup", 4 )
  927.   if it = 0 then exit popMenuArticle
  928.  
  929.   if it <= 4 then popBackToItemMap
  930.   if it <= 3 then popBackToClusterMap
  931.   if it <= 2 then popBackToDomain
  932.   if it <= 1 then popBackToEarth
  933. end popMenuArticle
  934.  
  935.  
  936.  
  937.