home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc1_2_x / bokbindr.sit / Bookbinder / background_4755.txt < prev    next >
Text File  |  1990-07-24  |  18KB  |  765 lines

  1. -- background: 4755 from stack: in
  2. -- bmap block id: 3717
  3. -- flags: 0000
  4. -- background id: 0
  5. -- name: page
  6. ----- HyperTalk script -----
  7. on openCard
  8.   updateBookmarks (the number of this card)
  9.   send showBookmarks
  10.   send showFootnotes
  11.   pass openCard
  12. end openCard
  13.  
  14. on showBookmarks
  15.   global bookmark1
  16.   global bookmark2
  17.   get the id of this card
  18.   if it is bookmark1 or it is bookmark2 then
  19.     show background button "mark"
  20.   else
  21.     hide background button "mark"
  22.   end if
  23. end showBookmarks
  24.  
  25. on showFootnotes
  26.   get field "footnote1"
  27.   if it is not "" then
  28.     show field "footnote1"
  29.   else
  30.     hide field "footnote1"
  31.   end if
  32.   get field "footnote2"
  33.   if it is not "" then
  34.     show field "footnote2"
  35.   else
  36.     hide field "footnote2"
  37.   end if
  38. end showFootnotes
  39.  
  40. on arrowKey choice
  41.   put false into dontScroll
  42.   if visible of background button "Done Changes" is true then
  43.     beep
  44.     put true into dontScroll
  45.   end if
  46.   if (the name of this card is the name of card "index") or (the name of this card is the name of card "contents") then
  47.     if visible of card button "Done Changes" is true then
  48.       beep
  49.       put true into dontScroll
  50.     end if
  51.   end if
  52.   if dontScroll is false then
  53.     if choice is "left" then
  54.       visual scroll right
  55.     else
  56.       visual scroll left
  57.     end if
  58.     pass arrowKey
  59.   end if
  60. end arrowKey
  61.  
  62. on updatePageNumbers
  63.   set cursor to watch
  64.   put the number of card "contents" into presentCard
  65.   repeat for the number of cards in this background
  66.     put presentCard into field "page no" of card presentCard
  67.     updateFootnotes presentCard
  68.     add 1 to presentCard
  69.   end repeat
  70. end updatePageNumbers
  71.  
  72. on updateFootnotes presentCard
  73.   global deletedCard
  74.   get line 1 of field "topic" of card presentCard
  75.   put it into field "footnote1" of card presentCard
  76.   if it is not "" then
  77.     get line 1 of field "card id" of card presentCard
  78.     if it is not "" then
  79.       if it is word 3 of deletedCard then
  80.         put "" into line 1 of field "card id" of card presentCard
  81.       else
  82.         get the number of card id it
  83.         put " - p" & it after field "footnote1" of card presentCard
  84.       end if
  85.     end if
  86.   end if
  87.   get line 2 of field "topic" of card presentCard
  88.   put it into field "footnote2" of card presentCard
  89.   if it is not "" then
  90.     get line 2 of field "card id" of card presentCard
  91.     if it is not "" then
  92.       if it is word 3 of deletedCard then
  93.         put "" into line 2 of field "card id" of card presentCard
  94.       else
  95.         get the number of card id it
  96.         put " - p" & it after field "footnote2" of card presentCard
  97.       end if
  98.     end if
  99.   end if
  100. end updateFootnotes
  101.  
  102. on updateBookmarks presentCard
  103.   global deletedCard
  104.   global bookmark1
  105.   global bookmark2
  106.   if bookmark1 is not 0 then
  107.     if bookmark1 is deletedCard then
  108.       put 0 into bookmark1
  109.       hide background button "bookmark1"
  110.       hide field "bookmark1"
  111.       put "" into field "bookmark1" of card presentCard
  112.     else
  113.       get number of bookmark1
  114.       put "p" & it into field "bookmark1" of card presentCard
  115.     end if
  116.   else
  117.     put "" into field "bookmark1" of card presentCard
  118.   end if
  119.   if bookmark2 is not 0 then
  120.     if bookmark2 is deletedCard then
  121.       put 0 into bookmark2
  122.       hide background button "bookmark2"
  123.       hide field "bookmark2"
  124.       put "" into field "bookmark2" of card presentCard
  125.     else
  126.       get number of bookmark2
  127.       put "p" & it into field "bookmark2" of card presentCard
  128.     end if
  129.   else
  130.     put "" into field "bookmark2" of card presentCard
  131.   end if
  132. end updateBookmarks
  133.  
  134. on idle
  135.   global cardJustPasted
  136.   global cardJustDeleted
  137.   global deletedCard
  138.   if cardJustDeleted then
  139.     put false into cardJustDeleted
  140.     updateBookmarks (the number of this card)
  141.     send showBookmarks
  142.     send showFootnotes
  143.   else
  144.     if cardJustPasted then
  145.       put false into cardJustPasted
  146.       set lockScreen to true
  147.       push card
  148.       go card "contents"
  149.       get the id of this background
  150.       pop card
  151.       set lockScreen to false
  152.       if it is not the id of this background then
  153.         -- i.e. this is not a true "page" card
  154.         answer "Background has changed; delete this card!" with "OK"
  155.       else
  156.         if the id of this card is deletedCard then
  157.           put "" into deletedCard
  158.         end if
  159.       end if
  160.     end if
  161.   end if
  162.   pass idle
  163. end idle
  164.  
  165. on openBackground
  166.   global xrefdepth
  167.   if xrefdepth is 0 then
  168.     hide background button "return"
  169.   end if
  170. end openBackground
  171.  
  172.  
  173.  
  174. -- part 1 (button)
  175. -- low flags: 00
  176. -- high flags: 0000
  177. -- rect: left=424 top=314 right=337 bottom=453
  178. -- title width / last selected line: 0
  179. -- icon id / first selected line: 1014 / 1014
  180. -- text alignment: 1
  181. -- font id: 0
  182. -- text size: 12
  183. -- style flags: 0
  184. -- line height: 16
  185. -- part name: 
  186. ----- HyperTalk script -----
  187. on mouseDown
  188.   global alreadyPaged
  189.   put false into alreadyPaged
  190.   pass mouseDown
  191. end mouseDown
  192.  
  193. on mouseStillDown
  194.   global alreadyPaged
  195.   wait 10
  196.   visual effect scroll right
  197.   put true into alreadyPaged
  198.   go to previous card
  199. end mouseStillDown
  200.  
  201. on mouseUp
  202.   global alreadyPaged
  203.   if alreadyPaged is false then
  204.     visual effect scroll right
  205.     go to previous card
  206.   end if
  207. end mouseUp
  208.  
  209.  
  210.  
  211. -- part 2 (button)
  212. -- low flags: 00
  213. -- high flags: 0000
  214. -- rect: left=480 top=314 right=337 bottom=508
  215. -- title width / last selected line: 0
  216. -- icon id / first selected line: 1013 / 1013
  217. -- text alignment: 1
  218. -- font id: 0
  219. -- text size: 12
  220. -- style flags: 0
  221. -- line height: 16
  222. -- part name: 
  223. ----- HyperTalk script -----
  224. on mouseDown
  225.   global alreadyPaged
  226.   put false into alreadyPaged
  227.   pass mouseDown
  228. end mouseDown
  229.  
  230. on mouseStillDown
  231.   global alreadyPaged
  232.   wait 10
  233.   visual effect scroll left
  234.   put true into alreadyPaged
  235.   go to next card
  236. end mouseStillDown
  237.  
  238. on mouseUp
  239.   global alreadyPaged
  240.   if alreadyPaged is false then
  241.     visual effect scroll left
  242.     go to next card
  243.   end if
  244. end mouseUp
  245.  
  246.  
  247.  
  248. -- part 3 (button)
  249. -- low flags: 80
  250. -- high flags: 0000
  251. -- rect: left=400 top=316 right=339 bottom=427
  252. -- title width / last selected line: 0
  253. -- icon id / first selected line: 1012 / 1012
  254. -- text alignment: 1
  255. -- font id: 0
  256. -- text size: 12
  257. -- style flags: 0
  258. -- line height: 16
  259. -- part name: return
  260. ----- HyperTalk script -----
  261. on mouseUp
  262.   global xrefdepth
  263.   subtract 1 from xrefdepth
  264.   if xrefdepth = 0 then
  265.     hide background button "return"
  266.   end if
  267.   visual effect iris close
  268.   pop card
  269. end mouseUp
  270.  
  271.  
  272.  
  273. -- part 4 (field)
  274. -- low flags: 01
  275. -- high flags: 0000
  276. -- rect: left=14 top=60 right=300 bottom=494
  277. -- title width / last selected line: 0
  278. -- icon id / first selected line: 0 / 0
  279. -- text alignment: 0
  280. -- font id: 2
  281. -- text size: 10
  282. -- style flags: 0
  283. -- line height: 13
  284. -- part name: text
  285.  
  286.  
  287. -- part 6 (field)
  288. -- low flags: 01
  289. -- high flags: 0000
  290. -- rect: left=14 top=29 right=57 bottom=328
  291. -- title width / last selected line: 0
  292. -- icon id / first selected line: 0 / 0
  293. -- text alignment: 0
  294. -- font id: 2
  295. -- text size: 18
  296. -- style flags: 0
  297. -- line height: 24
  298. -- part name: heading
  299. ----- HyperTalk script -----
  300. on closeField
  301.   if cardInContents() then
  302.     put the userLevel into currentLevel
  303.     set the userLevel to 5
  304.     set lockScreen to true
  305.     doMenu "New Field"
  306.     put the number of card fields into numFields
  307.     choose browse tool
  308.     set the style of card field numFields to shadow
  309.     put "Updating Table of Contents." & numToChar(13) & "Please wait..." into card field numFields
  310.     set lockScreen to false
  311.     send updateContents to card "contents"
  312.     set lockScreen to true
  313.     choose field tool
  314.     click at the loc of card field numFields
  315.     doMenu "Clear Field"
  316.     choose browse tool
  317.     set lockScreen to false
  318.     set the userLevel to currentLevel
  319.   end if
  320.   pass closeField
  321. end closeField
  322.  
  323. function cardInContents
  324. set the cursor to watch
  325. get word 3 of the id of this card
  326. put false into inContents
  327. repeat with x = 1 to the number of lines in card field "content list" of card "contents"
  328.   if (line x of card field "content list" of card "contents") is it then
  329.     put true into inContents
  330.   end if
  331. end repeat
  332. return inContents
  333. end cardInContents
  334.  
  335.  
  336.  
  337.  
  338. -- part 7 (field)
  339. -- low flags: 01
  340. -- high flags: 0000
  341. -- rect: left=461 top=33 right=51 bottom=494
  342. -- title width / last selected line: 0
  343. -- icon id / first selected line: 0 / 0
  344. -- text alignment: 65535
  345. -- font id: 2
  346. -- text size: 10
  347. -- style flags: 0
  348. -- line height: 13
  349. -- part name: page no
  350.  
  351.  
  352. -- part 8 (button)
  353. -- low flags: 00
  354. -- high flags: 0000
  355. -- rect: left=8 top=311 right=334 bottom=39
  356. -- title width / last selected line: 0
  357. -- icon id / first selected line: 13081 / 13081
  358. -- text alignment: 1
  359. -- font id: 0
  360. -- text size: 12
  361. -- style flags: 0
  362. -- line height: 16
  363. -- part name: Contents
  364. ----- HyperTalk script -----
  365. on mouseUp
  366.   visual iris close
  367.   go card "contents"
  368. end mouseUp
  369.  
  370.  
  371.  
  372. -- part 9 (button)
  373. -- low flags: 00
  374. -- high flags: 0000
  375. -- rect: left=453 top=313 right=338 bottom=480
  376. -- title width / last selected line: 0
  377. -- icon id / first selected line: 0 / 0
  378. -- text alignment: 1
  379. -- font id: 0
  380. -- text size: 12
  381. -- style flags: 0
  382. -- line height: 16
  383. -- part name: book
  384. ----- HyperTalk script -----
  385. on mouseUp
  386.   -- Actually, to be really consistent we should update the bookmarks
  387.   -- of ALL pages here, so that when you Print Report they are all
  388.   -- correct.  However, this would slow things down for the reader.
  389.   global bookmark1
  390.   global bookmark2
  391.   get the id of this card
  392.   if bookmark1 = 0 then
  393.     put it into bookmark1
  394.     updateBookmarks (the number of this card)
  395.     show background button "bookmark1"
  396.     show field "bookmark1"
  397.     send showBookmarks
  398.   else
  399.     if bookmark2 = 0 then
  400.       put it into bookmark2
  401.       updateBookmarks (the number of this card)
  402.       show background button "bookmark2"
  403.       show field "bookmark2"
  404.       send showBookmarks
  405.     else
  406.       answer "Out of bookmarks!" with "OK"
  407.     end if
  408.   end if
  409. end mouseUp
  410.  
  411.  
  412.  
  413.  
  414. -- part 11 (button)
  415. -- low flags: 80
  416. -- high flags: 0000
  417. -- rect: left=451 top=313 right=338 bottom=476
  418. -- title width / last selected line: 0
  419. -- icon id / first selected line: 18951 / 18951
  420. -- text alignment: 1
  421. -- font id: 0
  422. -- text size: 12
  423. -- style flags: 0
  424. -- line height: 16
  425. -- part name: mark
  426. ----- HyperTalk script -----
  427. on mouseUp
  428.   global bookmark1
  429.   global bookmark2
  430.   get the id of this card
  431.   if it is bookmark1 then
  432.     put 0 into bookmark1
  433.     hide background button "bookmark1"
  434.     hide field "bookmark1"
  435.   end if
  436.   if it is bookmark2 then
  437.     put 0 into bookmark2
  438.     hide background button "bookmark2"
  439.     hide field "bookmark2"
  440.   end if
  441.   updateBookmarks (the number of this card)
  442.   send showBookmarks
  443. end mouseUp
  444.  
  445.  
  446.  
  447. -- part 17 (field)
  448. -- low flags: 01
  449. -- high flags: 0002
  450. -- rect: left=367 top=326 right=340 bottom=394
  451. -- title width / last selected line: 0
  452. -- icon id / first selected line: 0 / 0
  453. -- text alignment: 1
  454. -- font id: 4
  455. -- text size: 9
  456. -- style flags: 0
  457. -- line height: 12
  458. -- part name: bookmark1
  459.  
  460.  
  461. -- part 18 (field)
  462. -- low flags: 81
  463. -- high flags: 0002
  464. -- rect: left=337 top=326 right=340 bottom=364
  465. -- title width / last selected line: 0
  466. -- icon id / first selected line: 0 / 0
  467. -- text alignment: 1
  468. -- font id: 4
  469. -- text size: 9
  470. -- style flags: 0
  471. -- line height: 12
  472. -- part name: bookmark2
  473.  
  474.  
  475. -- part 13 (button)
  476. -- low flags: 80
  477. -- high flags: 0000
  478. -- rect: left=336 top=300 right=339 bottom=362
  479. -- title width / last selected line: 0
  480. -- icon id / first selected line: 6179 / 6179
  481. -- text alignment: 1
  482. -- font id: 0
  483. -- text size: 12
  484. -- style flags: 0
  485. -- line height: 16
  486. -- part name: bookmark2
  487. ----- HyperTalk script -----
  488. on mouseUp
  489.   global bookmark1
  490.   global bookmark2
  491.   if the id of this card is not bookmark2 then
  492.     if (the name of this card is not the name of card "contents") and (the id of this card is not bookmark1) then
  493.       global xrefdepth
  494.       add 1 to xrefdepth
  495.       push card
  496.       show background button "return"
  497.     end if
  498.     visual effect iris open
  499.     go bookmark2
  500.   end if
  501. end mouseUp
  502.  
  503.  
  504.  
  505. -- part 12 (button)
  506. -- low flags: 00
  507. -- high flags: 0000
  508. -- rect: left=366 top=300 right=339 bottom=392
  509. -- title width / last selected line: 0
  510. -- icon id / first selected line: 6179 / 6179
  511. -- text alignment: 1
  512. -- font id: 0
  513. -- text size: 12
  514. -- style flags: 0
  515. -- line height: 16
  516. -- part name: bookmark1
  517. ----- HyperTalk script -----
  518. on mouseUp
  519.   global bookmark1
  520.   global bookmark2
  521.   if the id of this card is not bookmark1 then
  522.     if (the name of this card is not the name of card "contents") and (the id of this card is not bookmark2) then
  523.       global xrefdepth
  524.       add 1 to xrefdepth
  525.       push card
  526.       show background button "return"
  527.     end if
  528.     visual effect iris open
  529.     go bookmark1
  530.   end if
  531. end mouseUp
  532.  
  533.  
  534.  
  535. -- part 20 (field)
  536. -- low flags: 81
  537. -- high flags: 0002
  538. -- rect: left=54 top=309 right=324 bottom=321
  539. -- title width / last selected line: 0
  540. -- icon id / first selected line: 0 / 0
  541. -- text alignment: 0
  542. -- font id: 2
  543. -- text size: 10
  544. -- style flags: 0
  545. -- line height: 13
  546. -- part name: footnote1
  547. ----- HyperTalk script -----
  548. on mouseUp
  549.   get line 1 of field "card id"
  550.   if it is not "" then
  551.     global xrefdepth
  552.     add 1 to xrefdepth
  553.     push card
  554.     show background button "return"
  555.     visual iris open
  556.     get last word of me
  557.     put "" into first char of it
  558.     go card it
  559.   end if
  560. end mouseUp
  561.  
  562.  
  563.  
  564. -- part 23 (field)
  565. -- low flags: 81
  566. -- high flags: 0002
  567. -- rect: left=54 top=325 right=340 bottom=321
  568. -- title width / last selected line: 0
  569. -- icon id / first selected line: 0 / 0
  570. -- text alignment: 0
  571. -- font id: 2
  572. -- text size: 10
  573. -- style flags: 0
  574. -- line height: 13
  575. -- part name: footnote2
  576. ----- HyperTalk script -----
  577. on mouseUp
  578.   get line 2 of field "card id"
  579.   if it is not "" then
  580.     global xrefdepth
  581.     add 1 to xrefdepth
  582.     push card
  583.     show background button "return"
  584.     visual iris open
  585.     get last word of me
  586.     put "" into first char of it
  587.     go card it
  588.   end if
  589. end mouseUp
  590.  
  591.  
  592.  
  593. -- part 30 (button)
  594. -- low flags: 80
  595. -- high flags: 0000
  596. -- rect: left=1 top=21 right=340 bottom=510
  597. -- title width / last selected line: 0
  598. -- icon id / first selected line: 0 / 0
  599. -- text alignment: 1
  600. -- font id: 0
  601. -- text size: 12
  602. -- style flags: 0
  603. -- line height: 16
  604. -- part name: beep
  605. ----- HyperTalk script -----
  606. on mouseUp
  607.   beep
  608. end mouseUp
  609.  
  610.  
  611.  
  612. -- part 26 (button)
  613. -- low flags: 80
  614. -- high flags: A003
  615. -- rect: left=367 top=26 right=43 bottom=470
  616. -- title width / last selected line: 0
  617. -- icon id / first selected line: 0 / 0
  618. -- text alignment: 1
  619. -- font id: 0
  620. -- text size: 12
  621. -- style flags: 0
  622. -- line height: 16
  623. -- part name: Done Changes
  624. ----- HyperTalk script -----
  625. on mouseUp
  626.   hide background button "beep"
  627.   hide background button "Topic"
  628.   hide background button "Card ID (optional)"
  629.   hide field "topic"
  630.   hide field "card id"
  631.   hide background button "Done Changes"
  632.   show background button "Add Footnote"
  633.   updateFootnotes (the number of this card)
  634.   send showFootnotes
  635. end mouseUp
  636.  
  637.  
  638.  
  639. -- part 25 (button)
  640. -- low flags: 00
  641. -- high flags: A003
  642. -- rect: left=366 top=26 right=43 bottom=467
  643. -- title width / last selected line: 0
  644. -- icon id / first selected line: 0 / 0
  645. -- text alignment: 1
  646. -- font id: 0
  647. -- text size: 12
  648. -- style flags: 0
  649. -- line height: 16
  650. -- part name: Add Footnote
  651. ----- HyperTalk script -----
  652. on mouseUp
  653.   show background button "beep"
  654.   show background button "Topic"
  655.   show background button "Card ID (optional)"
  656.   show field "topic"
  657.   show field "card id"
  658.   hide background button "Add Footnote"
  659.   show background button "Done Changes"
  660. end mouseUp
  661.  
  662.  
  663.  
  664. -- part 28 (button)
  665. -- low flags: 80
  666. -- high flags: 8002
  667. -- rect: left=51 top=111 right=133 bottom=318
  668. -- title width / last selected line: 0
  669. -- icon id / first selected line: 0 / 0
  670. -- text alignment: 1
  671. -- font id: 0
  672. -- text size: 12
  673. -- style flags: 0
  674. -- line height: 16
  675. -- part name: Topic
  676.  
  677.  
  678. -- part 31 (button)
  679. -- low flags: 80
  680. -- high flags: 8002
  681. -- rect: left=317 top=111 right=133 bottom=448
  682. -- title width / last selected line: 0
  683. -- icon id / first selected line: 0 / 0
  684. -- text alignment: 1
  685. -- font id: 0
  686. -- text size: 12
  687. -- style flags: 0
  688. -- line height: 16
  689. -- part name: Card ID (optional)
  690.  
  691.  
  692. -- part 27 (field)
  693. -- low flags: 80
  694. -- high flags: 0002
  695. -- rect: left=51 top=132 right=162 bottom=318
  696. -- title width / last selected line: 0
  697. -- icon id / first selected line: 0 / 0
  698. -- text alignment: 0
  699. -- font id: 4
  700. -- text size: 9
  701. -- style flags: 0
  702. -- line height: 12
  703. -- part name: topic
  704.  
  705.  
  706. -- part 29 (field)
  707. -- low flags: 80
  708. -- high flags: 0002
  709. -- rect: left=317 top=132 right=162 bottom=448
  710. -- title width / last selected line: 0
  711. -- icon id / first selected line: 0 / 0
  712. -- text alignment: 0
  713. -- font id: 4
  714. -- text size: 9
  715. -- style flags: 0
  716. -- line height: 12
  717. -- part name: card id
  718.  
  719.  
  720. -- part 33 (button)
  721. -- low flags: 80
  722. -- high flags: A003
  723. -- rect: left=356 top=44 right=61 bottom=477
  724. -- title width / last selected line: 0
  725. -- icon id / first selected line: 0 / 0
  726. -- text alignment: 1
  727. -- font id: 0
  728. -- text size: 12
  729. -- style flags: 0
  730. -- line height: 16
  731. -- part name: Update Page Nos
  732. ----- HyperTalk script -----
  733. on mouseUp
  734.   global deletedCard
  735.   hide background button "Update Page Nos"
  736.   put the userLevel into currentLevel
  737.   set the userLevel to 5
  738.   set lockScreen to true
  739.   doMenu "New Field"
  740.   put the number of card fields into numFields
  741.   choose browse tool
  742.   set the style of card field numFields to shadow
  743.   put "Updating page numbers." & numToChar(13) & "Please wait..." into card field numFields
  744.   set lockScreen to false
  745.   send updatePageNumbers
  746.   send showFootnotes
  747.   updateBookmarks (the number of this card)
  748.   -- Actually, to be really consistent we should update ALL the
  749.   -- bookmarks here, so that when you Print Report they are all
  750.   -- correct.  However, bookmarks are not that important.
  751.   send showBookmarks
  752.   send updateContents to card "contents"
  753.   send updateIndex to card "index"
  754.   set lockScreen to true
  755.   choose field tool
  756.   click at the loc of card field numFields
  757.   doMenu "Clear Field"
  758.   choose browse tool
  759.   set lockScreen to false
  760.   set the userLevel to currentLevel
  761.   put "" into deletedCard
  762.   beep
  763. end mouseUp
  764.  
  765.