home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
hypercrd
/
hc2_x
/
tongubng.sea
/
TongueBingo
/
background_2590.txt
< prev
next >
Wrap
Text File
|
1991-08-27
|
16KB
|
578 lines
-- background: 2590 from stack: in
-- bmap block id: 3954
-- flags: 4000
-- background id: 0
-- name: Sanasto
----- HyperTalk script -----
on updateScroll
global initScroll
set the scroll of field 2 to initScroll
put the number of lines in field suomi into field "rivejä"
end updateScroll
on tabKey -- siirrytään kentästä toiseen sarkainnäppäimellä
global initScroll
get the selectedLine
put word 2 of it into rivi -- numero
if last word of it is "2" then -- same line
select char 1 to 0 of line rivi of field 3
else -- next line
set the scroll of field 3 to the scroll of field 2
select char 1 to 0 of line rivi+1 of field 2
end if
end tabKey
On openCard
global initScroll, kieli, tuplarivi
put 2 into tuplarivi --> sanaston tarkistus
put 0 into initScroll
set the scroll of field 2 to initScroll
set the scroll of field 3 to initScroll
if the name of this card contains kieli then --nimikkokortti
global aihepiirit, aiheita
put field "Aihevalikko" into aihepiirit
put number of lines in aihepiirit into aiheita
end if
put the number of lines in field "Suomi" into field "rivejä"
end openCard
on aihepiiri aihe-- luo uusi aihepiirikortti, valikkokentän päivitys
global kieli
doMenu "New Card"
put kieli into field "Vieras"
put aihe into field "Aihepiiri"
put aihe&return after field "Aihevalikko" of card kieli of bg "Sanasto"
end aihepiiri
function varattu aihe
global kieli
put offset(aihe,field "Aihevalikko" of card kieli of bg "Sanasto") is not 0 into tulos
if tulos then
answer "This name already in use; pick something else…"
end if
return tulos or luvaton(aihe)
end varattu
function luvaton aihe -- luvattomien merkkien tarkastus
put "/:<(" into nonos
repeat with m=1 to the number of chars in nonos
put char m of nonos is in aihe into tulos
if tulos then
answer quote&char m of nonos"e&& "is illegal character in Glossary name…" with "Uh huh…"
exit repeat
end if
end repeat
return tulos
end luvaton
on deleteCard -- remove references to Glossary
global kieli, aihepiirit
get field "Aihepiiri"
put ID of this card into tämä
go to card kieli of bg "Sanasto" -- kielen alkuun
find it in field "Aihevalikko"
delete the foundLine
put field "Aihevalikko" into aihepiirit
go to card tämä
pass deleteCard
go to card kieli of bg "Sanasto" -- taas kielen alkuun!?
end deleteCard
on openBackground
global v,h -- putkahdusvalikon sijainti
get the rect of bg button ID 9 -- valitse aihe
put (last item of it) + top of card window into v
put (first item of it) + left of card window + 1 into h
end openBackground
-- part 1 (field)
-- low flags: 01
-- high flags: 0004
-- rect: left=241 top=325 right=342 bottom=299
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Rivejè
-- part 2 (field)
-- low flags: 00
-- high flags: 4007
-- rect: left=160 top=102 right=326 bottom=340
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Suomi
-- part 3 (field)
-- low flags: 00
-- high flags: 4007
-- rect: left=318 top=102 right=326 bottom=512
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Muu
----- HyperTalk script -----
on mouseWithin -- vieritä, jos tilanne muuttuu
global initScroll
get the scroll of me
if it is not initScroll then
put it into initScroll
updateScroll
end if
end mouseWithin
-- part 15 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=2 top=108 right=135 bottom=151
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Create new Glossary
----- HyperTalk script -----
on mouseUp
repeat
ask "Enter name for Glossary:" with Subject
if it is empty then exit mouseUp
put it into aihe
if not varattu(aihe) then exit repeat
end repeat
aihepiiri aihe
end mouseUp
-- part 5 (field)
-- low flags: 01
-- high flags: 6001
-- rect: left=0 top=81 right=106 bottom=161
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 5
-- text size: 14
-- style flags: 0
-- line height: 18
-- part name: Aihepiiri
-- part 6 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=450 top=32 right=69 bottom=491
-- title width / last selected line: 0
-- icon id / first selected line: 1011 / 1011
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Kotiin
----- HyperTalk script -----
on mouseUp
go home
end mouseUp
-- part 7 (button)
-- low flags: 00
-- high flags: E006
-- rect: left=0 top=240 right=261 bottom=162
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Native to Foreign
----- HyperTalk script -----
on mouseUp
global Suomesta
flash 1
set hilite of background button "Foreign to native" to false
put true into Suomesta
end mouseUp
-- part 8 (button)
-- low flags: 00
-- high flags: A006
-- rect: left=0 top=262 right=280 bottom=152
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Foreign to Native
----- HyperTalk script -----
on mouseUp
global suomesta
set hilite of background button "Native to foreign" to false
flash 1
put false into suomesta
end mouseUp
-- part 9 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=12 top=62 right=83 bottom=130
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Choose Glossary
----- HyperTalk script -----
on mouseDown
global h,v, aihepiirit, aValinta, aiheita, kieli
if the commandKey is down -- jotta pääsee muokkaamaan valikkoa!
then show field aihevalikko
else if the optionKey is down then hide field aihevalikko
else
if aiheita <2 then
answer "This Tongue is still without further Glossaries — "& "so create Yourself a new one…" with "Not yet…" or "Moment…" or "Soon…"
exit mouseDown
end if
get PopUpMenu(aihepiirit,aValinta,h,v)
if it is empty then exit mouseDown
put it into aValinta
lock screen
put the id of this card into takaisin -- muista missä oltiin
go to card kieli of bg "Sanasto" -- aletaan ko. kielen alusta
put line aValinta of aihepiirit into aihe
find whole aihe in field "Aihepiiri" -- of background "Sanasto"
if the result is "not found" or kieli is not field "vieras" then -- väärään kieleen?
go to takaisin --sinne, mistä lähdettiin hakemaan
answer "Glossary lost…? Menu not up to date!" with "Oops…"
exit MouseDown -- Glossary menu field "Aihepiiri" contains garbage!!
end if
end if -- key
end mouseDown
-- part 10 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=11 top=24 right=55 bottom=178
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Show me your Tongue╔
----- HyperTalk script -----
on mouseUp
global suomesta, mistä, mihin, lukum, kieli
put field "rivejä" into lukum
if lukum < 40 then
flash 2
answer lukum&&"word only is hardly enough to play with…"
exit mouseUp
end if
if suomesta then
put field suomi into mistä
put field muu into mihin
else -- suomeen
put field muu into mistä
put field suomi into mihin
end if
push card
visual effect checkerboard to black
go to card opetuskortti
send mouseUp to button "New Game"
end MouseUp
-- part 11 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=0 top=285 right=316 bottom=154
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Switch Tongue
----- HyperTalk script -----
on mouseUp
global kyrill
put false into kyrill
set textFont of field Muu to "Geneva"
visual effect iris close to black
go card "Aloitus"
end mouseUp
-- part 12 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=1 top=153 right=178 bottom=131
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Open TEXT╨glossary
----- HyperTalk script -----
on mouseUp
global kieli, theFile
put FileName("TEXT") into theFile
if theFile is not empty then
put theFile into aihe
repeat until ":"is not in aihe -- remove directory path
delete char 1 to offset(":",aihe) of aihe
end repeat
Answer "Create new card or update current card?" with "Update" or "New card"
if it is "Uusi kortti" then
repeat
ask "Anna nimi aihepiirille:" with aihe
if it is empty then exit mouseUp
put it into aihe
if not varattu(aihe) then exit repeat
end repeat
aihepiiri aihe
end if
open file theFile
answer "Which delimiter between pairs?" with "…,…" or "…Tab…"
if it is "…,…" then -- pilkku
repeat while it is not empty
set cursor to busy
read from file theFile until return
if item 2 of it is empty then
answer "Second word or delimiter missing:"&&it with "Fix it…"
exit repeat -- ????
end if
put item 1 of it &return after field Suomi
put item 2 of it after field "Muu"
end repeat
else -- Tab
repeat while it is not empty
set cursor to watch
read from file theFile until Tab
if return is in it then
answer "Delimiter missing:"&& line 1 of it with "Fix it…"
exit repeat
end if
put it&return after field Suomi
read from file theFile until return
put it after field "Muu"
end repeat
end if -- erotin
delete last character of field Suomi --return pois lopusta
close file theFile
end if -- theFile
end mouseUp
-- part 16 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=0 top=179 right=204 bottom=130
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Save as TEXT
----- HyperTalk script -----
on mouseUp
global kieli, theFile
put NewFileName("Save glossary as:", kieli&"/"&field "Aihepiiri") into doku
if doku is not empty then
put "Saving: "&&doku
answer "Which delimiter between pairs?" with "…,…" or "…<tab>…"
if it is "…,…" then
put "," into erotin
else
put tab into erotin
end if -- erotin
open file doku
repeat with r=1 to field Rivejä
set cursor to busy
put line r of field "Suomi"&erotin&line r of field "Muu" into rivi
write rivi&return to file doku
put "Rivi:"&&r&&rivi
end repeat
hide message
close file doku
end if -- doku
end mouseUp
-- part 4 (field)
-- low flags: 80
-- high flags: 0007
-- rect: left=16 top=107 right=191 bottom=154
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Aihevalikko
-- part 13 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=324 top=326 right=342 bottom=466
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Check glossary
----- HyperTalk script -----
on mouseUp
global tuplaRivi
answer "Checking for duplicates takes quite a while — "& "depends on Glossary size…" with "Continue" or "Cancel"
if it is "Cancel" then exit mouseUp
repeat with rivi = tuplaRivi to field "Rivejä"
set cursor to busy
select line rivi of field "Suomi"
if the selection is empty then exit repeat
repeat with row = 1 to rivi-1
if line rivi of field "Suomi" is line row of field "Suomi" then
play "Lamb"
answer "'"&line rivi of field "Suomi"&"' on lines:"&&row&& "and"&&rivi with "Fix it!"
put rivi into tuplaRivi
exit mouseUp
end if
end repeat --row
set cursor to busy
select line rivi of field "Muu"
repeat with row = 1 to rivi-1
if line rivi of field "Vieras" is line row of field "Muu" then
play "Lamb"
answer "'"&line rivi of field "Muu"&"' on lines:"&&row&& "and"&&rivi with "Fix it!"
put rivi into tuplaRivi
exit mouseUp
end if
end repeat --row
end repeat --rivi
play "Beethoven5"
end mouseUp
-- part 14 (field)
-- low flags: 01
-- high flags: 2002
-- rect: left=396 top=77 right=102 bottom=481
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 5
-- text size: 14
-- style flags: 0
-- line height: 18
-- part name: Vieras
----- HyperTalk script -----
on mouseUp
visual wipe right to gray
global kieli
go to card kieli of bg "Sanasto"
end mouseUp
-- part 17 (button)
-- low flags: 00
-- high flags: A001
-- rect: left=263 top=83 right=100 bottom=336
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: <-Swap->
----- HyperTalk script -----
on mouseUp -- vaihtaa kentät keskenään
answer "Do you really want to swap the Native and Foreign fields?!" with "Swap!" or "No, ei!!"
if it is "No, ei!!" then exit mouseUp
put field Suomi into vaihto
put field Muu into field Suomi
put vaihto into field Muu
end mouseUp
-- part 18 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=23 top=321 right=338 bottom=118
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Find word
----- HyperTalk script -----
on mouseUp
global kieli,initScroll
ask "Find what word?" with in Finnish
if it is empty then exit mouseUp
put it into hakusana
put the id of this card into takaisin -- muista missä oltiin
lock screen
go to card kieli of bg "Sanasto" -- aletaan ko. kielen alusta
find whole hakusana in field "Suomi" -- of background "Sanasto"
if the result is "not found" or field "vieras" is not kieli then -- väärään kieleen?
go to takaisin --sinne, mistä lähdettiin hakemaan
answer "Not found at the tip of this tongue!" with "Oops…"
else --l├╢ytyi
get scroll of field "Suomi"
if it is not initScroll then
put it into initScroll
set scroll of field "Muu" to initScroll --ei toimi enää!!!
end if
get word 2 of the foundLine --aktivoi sama rivi muu kentästä!
select char 1 to 50 of line it of field "Muu" -- mix ei toimi?!
get line it of field "Muu"
find whole it in field "Muu" -- hätäratkaisu!
end if --result
end mouseUp