home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tongubng.sea / TongueBingo / background_2590.txt < prev    next >
Text File  |  1991-08-27  |  16KB  |  578 lines

  1. -- background: 2590 from stack: in
  2. -- bmap block id: 3954
  3. -- flags: 4000
  4. -- background id: 0
  5. -- name: Sanasto
  6. ----- HyperTalk script -----
  7. on updateScroll
  8.   global initScroll
  9.   set the scroll of field 2 to initScroll
  10.   put the number of lines in field suomi into field "rivej├ñ"
  11. end updateScroll
  12.  
  13. on tabKey -- siirryt├ñ├ñn kent├ñst├ñ toiseen sarkainn├ñpp├ñimell├ñ
  14.   global initScroll
  15.   get the selectedLine
  16.   put word 2 of it into rivi -- numero
  17.   if last word of it is "2" then -- same line
  18.     select char 1 to 0 of line rivi of field 3
  19.   else -- next line
  20.     set the scroll of field 3 to the scroll of field 2
  21.     select char 1 to 0 of line rivi+1 of field 2
  22.   end if
  23. end tabKey
  24.  
  25. On openCard
  26.   global initScroll, kieli, tuplarivi
  27.   put 2 into tuplarivi --> sanaston tarkistus
  28.   put 0 into initScroll
  29.   set the scroll of field 2 to initScroll
  30.   set the scroll of field 3 to initScroll
  31.   if the name of this card contains kieli then --nimikkokortti
  32.     global aihepiirit, aiheita
  33.     put field "Aihevalikko" into aihepiirit
  34.     put number of lines in aihepiirit into aiheita
  35.   end if
  36.   put the number of lines in field "Suomi" into field "rivej├ñ"
  37. end openCard
  38.  
  39. on aihepiiri aihe-- luo uusi aihepiirikortti, valikkokent├ñn p├ñivitys
  40.   global kieli
  41.   doMenu "New Card"
  42.   put kieli into field "Vieras"
  43.   put aihe into field "Aihepiiri"
  44.   put aihe&return after field "Aihevalikko" of card kieli of bg "Sanasto"
  45. end aihepiiri
  46.  
  47. function varattu aihe
  48. global kieli
  49. put offset(aihe,field "Aihevalikko" of card kieli of bg "Sanasto") is not 0 into tulos
  50. if tulos then
  51.   answer "This name already in use; pick something elseΓǪ"
  52. end if
  53. return tulos or luvaton(aihe)
  54. end varattu
  55.  
  56. function luvaton aihe -- luvattomien merkkien tarkastus
  57. put "/:<(" into nonos
  58. repeat with m=1 to the number of chars in nonos
  59.   put char m of nonos is in aihe into tulos
  60.   if tulos then
  61.     answer quote&char m of nonos"e&& "is illegal character in Glossary nameΓǪ" with "Uh huhΓǪ"
  62.     exit repeat
  63.   end if
  64. end repeat
  65. return tulos
  66. end luvaton
  67.  
  68. on deleteCard  -- remove references to Glossary
  69.   global kieli, aihepiirit
  70.   get field "Aihepiiri"
  71.   put ID of this card into t├ñm├ñ
  72.   go to card kieli of bg "Sanasto" --  kielen alkuun
  73.   find it in field "Aihevalikko"
  74.   delete the foundLine
  75.   put field "Aihevalikko" into aihepiirit
  76.   go to card t├ñm├ñ
  77.   pass deleteCard
  78.   go to card kieli of bg "Sanasto" --  taas kielen alkuun!?
  79. end deleteCard
  80.  
  81. on openBackground
  82.   global v,h -- putkahdusvalikon sijainti
  83.   get the rect of bg button ID 9 -- valitse aihe
  84.   put (last item of it) + top of card window into v
  85.   put (first item of it) + left of card window + 1 into h
  86. end openBackground
  87.  
  88.  
  89.  
  90. -- part 1 (field)
  91. -- low flags: 01
  92. -- high flags: 0004
  93. -- rect: left=241 top=325 right=342 bottom=299
  94. -- title width / last selected line: 0
  95. -- icon id / first selected line: 0 / 0
  96. -- text alignment: 0
  97. -- font id: 3
  98. -- text size: 12
  99. -- style flags: 0
  100. -- line height: 16
  101. -- part name: Rivejè
  102.  
  103.  
  104. -- part 2 (field)
  105. -- low flags: 00
  106. -- high flags: 4007
  107. -- rect: left=160 top=102 right=326 bottom=340
  108. -- title width / last selected line: 0
  109. -- icon id / first selected line: 0 / 0
  110. -- text alignment: 0
  111. -- font id: 3
  112. -- text size: 12
  113. -- style flags: 0
  114. -- line height: 16
  115. -- part name: Suomi
  116.  
  117.  
  118. -- part 3 (field)
  119. -- low flags: 00
  120. -- high flags: 4007
  121. -- rect: left=318 top=102 right=326 bottom=512
  122. -- title width / last selected line: 0
  123. -- icon id / first selected line: 0 / 0
  124. -- text alignment: 0
  125. -- font id: 3
  126. -- text size: 12
  127. -- style flags: 0
  128. -- line height: 16
  129. -- part name: Muu
  130. ----- HyperTalk script -----
  131. on mouseWithin   -- vierit├ñ, jos tilanne muuttuu
  132.   global initScroll
  133.   get the scroll of me
  134.   if it is not initScroll then
  135.     put it into initScroll
  136.     updateScroll
  137.   end if
  138. end mouseWithin
  139.  
  140.  
  141. -- part 15 (button)
  142. -- low flags: 00
  143. -- high flags: A003
  144. -- rect: left=2 top=108 right=135 bottom=151
  145. -- title width / last selected line: 0
  146. -- icon id / first selected line: 0 / 0
  147. -- text alignment: 1
  148. -- font id: 0
  149. -- text size: 12
  150. -- style flags: 0
  151. -- line height: 16
  152. -- part name: Create new Glossary
  153. ----- HyperTalk script -----
  154. on mouseUp
  155.   repeat
  156.     ask "Enter name for Glossary:" with Subject
  157.     if it is empty then exit mouseUp
  158.     put it into aihe
  159.     if not varattu(aihe) then exit repeat
  160.   end repeat
  161.   aihepiiri aihe
  162. end mouseUp
  163.  
  164.  
  165. -- part 5 (field)
  166. -- low flags: 01
  167. -- high flags: 6001
  168. -- rect: left=0 top=81 right=106 bottom=161
  169. -- title width / last selected line: 0
  170. -- icon id / first selected line: 0 / 0
  171. -- text alignment: 1
  172. -- font id: 5
  173. -- text size: 14
  174. -- style flags: 0
  175. -- line height: 18
  176. -- part name: Aihepiiri
  177.  
  178.  
  179. -- part 6 (button)
  180. -- low flags: 00
  181. -- high flags: 0000
  182. -- rect: left=450 top=32 right=69 bottom=491
  183. -- title width / last selected line: 0
  184. -- icon id / first selected line: 1011 / 1011
  185. -- text alignment: 1
  186. -- font id: 0
  187. -- text size: 12
  188. -- style flags: 0
  189. -- line height: 16
  190. -- part name: Kotiin
  191. ----- HyperTalk script -----
  192. on mouseUp
  193.   go home
  194. end mouseUp
  195.  
  196.  
  197.  
  198.  
  199. -- part 7 (button)
  200. -- low flags: 00
  201. -- high flags: E006
  202. -- rect: left=0 top=240 right=261 bottom=162
  203. -- title width / last selected line: 0
  204. -- icon id / first selected line: 0 / 0
  205. -- text alignment: 1
  206. -- font id: 0
  207. -- text size: 12
  208. -- style flags: 0
  209. -- line height: 16
  210. -- part name: Native to Foreign
  211. ----- HyperTalk script -----
  212. on mouseUp
  213.   global Suomesta
  214.   flash 1
  215.   set hilite of background button "Foreign to native" to false
  216.   put true into Suomesta
  217. end mouseUp
  218.  
  219.  
  220.  
  221. -- part 8 (button)
  222. -- low flags: 00
  223. -- high flags: A006
  224. -- rect: left=0 top=262 right=280 bottom=152
  225. -- title width / last selected line: 0
  226. -- icon id / first selected line: 0 / 0
  227. -- text alignment: 1
  228. -- font id: 0
  229. -- text size: 12
  230. -- style flags: 0
  231. -- line height: 16
  232. -- part name: Foreign to Native
  233. ----- HyperTalk script -----
  234. on mouseUp
  235.   global suomesta
  236.   set hilite of background button "Native to foreign" to false
  237.   flash 1
  238.   put false into suomesta
  239. end mouseUp
  240.  
  241.  
  242.  
  243. -- part 9 (button)
  244. -- low flags: 00
  245. -- high flags: A004
  246. -- rect: left=12 top=62 right=83 bottom=130
  247. -- title width / last selected line: 0
  248. -- icon id / first selected line: 0 / 0
  249. -- text alignment: 1
  250. -- font id: 0
  251. -- text size: 12
  252. -- style flags: 0
  253. -- line height: 16
  254. -- part name: Choose Glossary
  255. ----- HyperTalk script -----
  256. on mouseDown
  257.   global h,v, aihepiirit, aValinta, aiheita, kieli
  258.   if the commandKey is down -- jotta p├ñ├ñsee muokkaamaan valikkoa!
  259.   then show field aihevalikko
  260. else if the optionKey is down then hide field aihevalikko
  261. else
  262.   if aiheita <2 then
  263.     answer "This Tongue is still without further Glossaries ΓÇö "& "so create Yourself a new oneΓǪ" with "Not yetΓǪ" or "MomentΓǪ" or "SoonΓǪ"
  264.     exit mouseDown
  265.   end if
  266.   get PopUpMenu(aihepiirit,aValinta,h,v)
  267.   if it is empty then exit mouseDown
  268.   put it into aValinta
  269.   lock screen
  270.   put the id of this card into takaisin -- muista miss├ñ oltiin
  271.   go to card kieli of bg "Sanasto" -- aletaan ko. kielen alusta
  272.   put line aValinta of aihepiirit into aihe
  273.   find whole aihe in field "Aihepiiri" -- of background "Sanasto"
  274.   if the result is "not found" or kieli is not field "vieras" then -- v├ñ├ñr├ñ├ñn kieleen?
  275.     go to takaisin --sinne, mist├ñ l├ñhdettiin hakemaan
  276.     answer "Glossary lostΓǪ? Menu not up to date!" with "OopsΓǪ"
  277.     exit MouseDown -- Glossary menu field "Aihepiiri" contains garbage!!
  278.   end if
  279. end if -- key
  280. end mouseDown
  281.  
  282.  
  283. -- part 10 (button)
  284. -- low flags: 00
  285. -- high flags: A003
  286. -- rect: left=11 top=24 right=55 bottom=178
  287. -- title width / last selected line: 0
  288. -- icon id / first selected line: 0 / 0
  289. -- text alignment: 1
  290. -- font id: 0
  291. -- text size: 12
  292. -- style flags: 0
  293. -- line height: 16
  294. -- part name: Show me your Tongue╔
  295. ----- HyperTalk script -----
  296. on mouseUp
  297.   global suomesta, mist├ñ, mihin, lukum, kieli
  298.   put field "rivej├ñ" into lukum
  299.   if lukum < 40 then
  300.     flash 2
  301.     answer lukum&&"word only is hardly enough to play withΓǪ"
  302.     exit mouseUp
  303.   end if
  304.   if suomesta then
  305.     put field suomi into mist├ñ
  306.     put field muu into mihin
  307.   else -- suomeen
  308.     put field muu into mist├ñ
  309.     put field suomi into mihin
  310.   end if
  311.   push card
  312.   visual effect checkerboard to black
  313.   go to card opetuskortti
  314.   send mouseUp to button "New Game"
  315. end MouseUp
  316.  
  317.  
  318.  
  319. -- part 11 (button)
  320. -- low flags: 00
  321. -- high flags: A003
  322. -- rect: left=0 top=285 right=316 bottom=154
  323. -- title width / last selected line: 0
  324. -- icon id / first selected line: 0 / 0
  325. -- text alignment: 1
  326. -- font id: 0
  327. -- text size: 12
  328. -- style flags: 0
  329. -- line height: 16
  330. -- part name: Switch Tongue
  331. ----- HyperTalk script -----
  332. on mouseUp
  333.   global kyrill
  334.   put false into kyrill
  335.   set textFont of field Muu to "Geneva"
  336.   visual effect iris close to black
  337.   go card "Aloitus"
  338. end mouseUp
  339.  
  340.  
  341. -- part 12 (button)
  342. -- low flags: 00
  343. -- high flags: A003
  344. -- rect: left=1 top=153 right=178 bottom=131
  345. -- title width / last selected line: 0
  346. -- icon id / first selected line: 0 / 0
  347. -- text alignment: 1
  348. -- font id: 0
  349. -- text size: 12
  350. -- style flags: 0
  351. -- line height: 16
  352. -- part name: Open TEXT╨glossary
  353. ----- HyperTalk script -----
  354. on mouseUp
  355.   global kieli, theFile
  356.   put FileName("TEXT") into theFile
  357.   if theFile is not empty then
  358.     put theFile into aihe
  359.     repeat until ":"is not in aihe -- remove directory path
  360.       delete char 1 to offset(":",aihe) of aihe
  361.     end repeat
  362.     Answer "Create new card or update current card?" with "Update" or "New card"
  363.     if it is "Uusi kortti" then
  364.       repeat
  365.         ask "Anna nimi aihepiirille:" with aihe
  366.         if it is empty then exit mouseUp
  367.         put it into aihe
  368.         if not varattu(aihe) then exit repeat
  369.       end repeat
  370.       aihepiiri aihe
  371.     end if
  372.     open file theFile
  373.     answer "Which delimiter between pairs?" with "ΓǪ,ΓǪ" or "ΓǪTabΓǪ"
  374.     if it is "ΓǪ,ΓǪ" then -- pilkku
  375.       repeat while it is not empty
  376.         set cursor to busy
  377.         read from file theFile until return
  378.         if item 2 of it is empty then
  379.           answer "Second word or delimiter missing:"&&it with "Fix itΓǪ"
  380.           exit repeat -- ????
  381.         end if
  382.         put item 1 of it &return after field Suomi
  383.         put item 2 of it after field "Muu"
  384.       end repeat
  385.     else -- Tab
  386.       repeat while it is not empty
  387.         set cursor to watch
  388.         read from file theFile until Tab
  389.         if return is in it then
  390.           answer "Delimiter missing:"&& line 1 of it with "Fix itΓǪ"
  391.           exit repeat
  392.         end if
  393.         put it&return after field Suomi
  394.         read from file theFile until return
  395.         put it after field "Muu"
  396.       end repeat
  397.     end if -- erotin
  398.     delete last character of field Suomi --return pois lopusta
  399.     close file theFile
  400.   end if -- theFile
  401. end mouseUp
  402.  
  403.  
  404. -- part 16 (button)
  405. -- low flags: 00
  406. -- high flags: A003
  407. -- rect: left=0 top=179 right=204 bottom=130
  408. -- title width / last selected line: 0
  409. -- icon id / first selected line: 0 / 0
  410. -- text alignment: 1
  411. -- font id: 0
  412. -- text size: 12
  413. -- style flags: 0
  414. -- line height: 16
  415. -- part name: Save as TEXT
  416. ----- HyperTalk script -----
  417. on mouseUp
  418.   global kieli, theFile
  419.   put NewFileName("Save glossary as:", kieli&"/"&field "Aihepiiri") into doku
  420.   if doku is not empty then
  421.     put "Saving: "&&doku
  422.     answer "Which delimiter between pairs?" with "ΓǪ,ΓǪ" or "ΓǪ<tab>ΓǪ"
  423.     if it is "ΓǪ,ΓǪ" then
  424.       put "," into erotin
  425.     else
  426.       put tab into erotin
  427.     end if -- erotin
  428.     open file doku
  429.     repeat with r=1 to field Rivej├ñ
  430.       set cursor to busy
  431.       put line r of field "Suomi"&erotin&line r of field "Muu" into rivi
  432.       write rivi&return to file doku
  433.       put "Rivi:"&&r&&rivi
  434.     end repeat
  435.     hide message
  436.     close file doku
  437.   end if -- doku
  438. end mouseUp
  439.  
  440.  
  441. -- part 4 (field)
  442. -- low flags: 80
  443. -- high flags: 0007
  444. -- rect: left=16 top=107 right=191 bottom=154
  445. -- title width / last selected line: 0
  446. -- icon id / first selected line: 0 / 0
  447. -- text alignment: 0
  448. -- font id: 0
  449. -- text size: 12
  450. -- style flags: 0
  451. -- line height: 16
  452. -- part name: Aihevalikko
  453.  
  454.  
  455. -- part 13 (button)
  456. -- low flags: 00
  457. -- high flags: A003
  458. -- rect: left=324 top=326 right=342 bottom=466
  459. -- title width / last selected line: 0
  460. -- icon id / first selected line: 0 / 0
  461. -- text alignment: 1
  462. -- font id: 0
  463. -- text size: 12
  464. -- style flags: 0
  465. -- line height: 16
  466. -- part name: Check glossary
  467. ----- HyperTalk script -----
  468. on mouseUp
  469.   global tuplaRivi
  470.   answer "Checking for duplicates takes quite a while ΓÇö "& "depends on Glossary sizeΓǪ" with "Continue" or "Cancel"
  471.   if it is "Cancel" then exit mouseUp
  472.   repeat with rivi = tuplaRivi to field "Rivej├ñ"
  473.     set cursor to busy
  474.     select line rivi of field "Suomi"
  475.     if the selection is empty then exit repeat
  476.     repeat with row = 1 to rivi-1
  477.       if line rivi of field "Suomi" is line row of field "Suomi" then
  478.         play "Lamb"
  479.         answer "'"&line rivi of field "Suomi"&"' on lines:"&&row&& "and"&&rivi with "Fix it!"
  480.         put rivi into tuplaRivi
  481.         exit mouseUp
  482.       end if
  483.     end repeat --row
  484.     set cursor to busy
  485.     select line rivi of field "Muu"
  486.     repeat with row = 1 to rivi-1
  487.       if line rivi of field "Vieras" is line row of field "Muu" then
  488.         play "Lamb"
  489.         answer "'"&line rivi of field "Muu"&"' on lines:"&&row&& "and"&&rivi with "Fix it!"
  490.         put rivi into tuplaRivi
  491.         exit mouseUp
  492.       end if
  493.     end repeat --row
  494.   end repeat --rivi
  495.   play "Beethoven5"
  496. end mouseUp
  497.  
  498.  
  499. -- part 14 (field)
  500. -- low flags: 01
  501. -- high flags: 2002
  502. -- rect: left=396 top=77 right=102 bottom=481
  503. -- title width / last selected line: 0
  504. -- icon id / first selected line: 0 / 0
  505. -- text alignment: 0
  506. -- font id: 5
  507. -- text size: 14
  508. -- style flags: 0
  509. -- line height: 18
  510. -- part name: Vieras
  511. ----- HyperTalk script -----
  512. on mouseUp
  513.   visual wipe right to gray
  514.   global kieli
  515.   go to card kieli of bg "Sanasto"
  516. end mouseUp
  517.  
  518.  
  519. -- part 17 (button)
  520. -- low flags: 00
  521. -- high flags: A001
  522. -- rect: left=263 top=83 right=100 bottom=336
  523. -- title width / last selected line: 0
  524. -- icon id / first selected line: 0 / 0
  525. -- text alignment: 1
  526. -- font id: 0
  527. -- text size: 12
  528. -- style flags: 0
  529. -- line height: 16
  530. -- part name: <-Swap->
  531. ----- HyperTalk script -----
  532. on mouseUp -- vaihtaa kent├ñt kesken├ñ├ñn
  533.   answer "Do you really want to swap the Native and Foreign fields?!" with "Swap!" or "No, ei!!"
  534.   if it is "No, ei!!" then exit mouseUp
  535.   put field Suomi into vaihto
  536.   put field Muu into field Suomi
  537.   put vaihto into field Muu
  538. end mouseUp
  539.  
  540.  
  541. -- part 18 (button)
  542. -- low flags: 00
  543. -- high flags: A003
  544. -- rect: left=23 top=321 right=338 bottom=118
  545. -- title width / last selected line: 0
  546. -- icon id / first selected line: 0 / 0
  547. -- text alignment: 1
  548. -- font id: 0
  549. -- text size: 12
  550. -- style flags: 0
  551. -- line height: 16
  552. -- part name: Find word
  553. ----- HyperTalk script -----
  554. on mouseUp
  555.   global kieli,initScroll
  556.   ask "Find what word?" with in Finnish
  557.   if it is empty then exit mouseUp
  558.   put it into hakusana
  559.   put the id of this card into takaisin -- muista miss├ñ oltiin
  560.   lock screen
  561.   go to card kieli of bg "Sanasto" -- aletaan ko. kielen alusta
  562.   find whole hakusana in field "Suomi" -- of background "Sanasto"
  563.   if the result is "not found" or field "vieras" is not kieli then -- v├ñ├ñr├ñ├ñn kieleen?
  564.     go to takaisin --sinne, mist├ñ l├ñhdettiin hakemaan
  565.     answer "Not found at the tip of this tongue!" with "OopsΓǪ"
  566.   else --l├╢ytyi
  567.     get scroll of field "Suomi"
  568.     if it is not initScroll then
  569.       put it into initScroll
  570.       set scroll of field "Muu" to initScroll --ei toimi en├ñ├ñ!!!
  571.     end if
  572.     get word 2 of the foundLine --aktivoi sama rivi muu kent├ñst├ñ!
  573.     select char 1 to 50 of line it of field "Muu" -- mix ei toimi?!
  574.     get line it of field "Muu"
  575.     find whole it in field "Muu" -- h├ñt├ñratkaisu!
  576.   end if --result
  577. end mouseUp
  578.