home *** CD-ROM | disk | FTP | other *** search
- global HDDir
-
- on startMovie
- end
-
- on closeWindow
- set the visible of sprite 12 to 0
- set the visible of sprite 14 to 0
- if the frame > 2 then
- save()
- end if
- end
-
- on idle
- set CursorList to [3, 4, 6, 7, 8, 9, 10, 13, 15]
- repeat with i in CursorList
- if rollOver(i) then
- if (i < 15) or ((the frame = 2) and (the mouseLine > 0)) then
- cursor([50, 51])
- exit
- end if
- end if
- end repeat
- cursor(-1)
- end
-
- on Drag str
- cursor([10, 11])
- repeat while the stillDown
- nothing()
- end repeat
- cursor(-1)
- set M to the mouseCast
- if (M > 18) and (M < 39) then
- set MW to the mouseLine
- if MW > 0 then
- set OldText to the text of member M
- put str after line MW of OldText
- set the text of member M to OldText
- else
- set the text of member M to str
- end if
- end if
- end
-
- on Pag n
- go(marker(0) - 1 + n)
- set the text of field "Pag" to string(n)
- end
-
- on OKNomeFile
- set NF to the text of field "Nomefile"
- if the last char in NF = RETURN then
- set the text of field "NomeFile" to char 1 to length(NF) - 1 of NF
- end if
- if the text of field "ListaFile" & RETURN contains NF & RETURN then
- Load()
- else
- new()
- end if
- set the text of field "Pag" to "1"
- go(the frame + 1)
- end
-
- on new
- repeat with i = 1 to 10
- set the text of field ("Pag" & i) to EMPTY
- end repeat
- end
-
- on save
- set file to the text of field "NomeFile"
- if the frame < label("Big") then
- set BigString to EMPTY
- else
- set BigString to "Big"
- end if
- delNOT(file)
- set xFile to new(xtra("FileIo"))
- openFile(xFile, HDDir & "Passport.NOT", 0)
- if Status(xFile) <> 0 then
- createFile(xFile, HDDir & "Passport.NOT")
- openFile(xFile, HDDir & "Passport.NOT", 0)
- end if
- if Status(xFile) = 0 then
- readFile(xFile)
- writeString(xFile, "~**~" & file & RETURN)
- repeat with i = 1 to 10
- set Pag to the text of field ("pag" & i & BigString)
- writeString(xFile, MultiReplace(Pag, ["~", "§", "\"], ["\~", "\§", "\\"]))
- writeString(xFile, "§§§\\§§§")
- end repeat
- writeString(xFile, RETURN)
- closeFile(xFile)
- else
- alert("Errore di salvataggio:" && Status(xFile))
- end if
- set xFile to EMPTY
- end
-
- on Load
- set file to HDDir & "Passport.NOT"
- set xFile to new(xtra("FileIo"))
- openFile(xFile, file, 1)
- if Status(xFile) <> 0 then
- exit
- end if
- if findNOT(xFile) then
- set s to readFile(xFile)
- closeFile(xFile)
- set xFile to EMPTY
- repeat with i = 1 to 10
- set x to offset("§§§\\§§§", s)
- if x > 1 then
- set the text of field ("pag" & i) to MultiReplace(char 1 to x - 1 of s, ["\~", "\§", "\\"], ["~", "§", "\"])
- else
- set the text of field ("pag" & i) to EMPTY
- end if
- delete char 1 to x + 7 of s
- end repeat
- else
- new()
- end if
- end
-
- on WinMov
- end
-
- on Replace Src, Fnd, rep
- set ret to EMPTY
- set n to the number of chars in Fnd - 1
- repeat while 1
- set x to offset(Fnd, Src)
- if x = 0 then
- exit repeat
- next repeat
- end if
- if x > 1 then
- put char 1 to x - 1 of Src after ret
- end if
- delete char 1 to x + n of Src
- put rep after ret
- end repeat
- return ret & Src
- end
-
- on MultiReplace Src, Fnd, rep
- repeat with i = 1 to count(Fnd)
- set Src to Replace(Src, getAt(Fnd, i), getAt(rep, i))
- end repeat
- return Src
- end
-
- on findNOT xFile, NomeFile
- set L to EMPTY
- if voidp(NomeFile) then
- set NomeFile to the text of field "NomeFile"
- end if
- set n to "~**~" & NomeFile & RETURN
- repeat while L <> n
- set L to readLine(xFile)
- if (Status(xFile) <> 0) or (L = EMPTY) then
- return 0
- end if
- end repeat
- return 1
- end
-
- on listNot
- set ret to EMPTY
- set Lst to []
- set file to HDDir & "Passport.NOT"
- set xFile to new(xtra("FileIo"))
- openFile(xFile, file, 1)
- set L to "*"
- repeat while (Status(xFile) = 0) and (L <> EMPTY)
- set L to readLine(xFile)
- if (L <> EMPTY) and (L starts "~**~") then
- delete char 1 to 4 of L
- delete char -30000 of L
- add(Lst, L)
- end if
- end repeat
- set xFile to 0
- sort(Lst)
- repeat with L in Lst
- put L & RETURN after ret
- end repeat
- delete char -30000 of ret
- return ret
- end
-
- on delNOT file
- set xFile1 to new(xtra("FileIO"))
- set xFile2 to new(xtra("FileIO"))
- openFile(xFile1, HDDir & "Passport.NOT", 1)
- createFile(xFile2, HDDir & "Temp.NOT")
- openFile(xFile2, HDDir & "Temp.NOT", 0)
- set L to EMPTY
- set n to "~**~" & file & RETURN
- repeat while 1
- set L to readLine(xFile1)
- if (L <> n) and (L <> EMPTY) then
- writeString(xFile2, L)
- next repeat
- end if
- exit repeat
- end repeat
- set L to "*"
- repeat while not (L starts "~**~") and (L <> EMPTY)
- set L to readLine(xFile1)
- end repeat
- if L <> EMPTY then
- writeString(xFile2, L)
- repeat while L <> EMPTY
- set L to readLine(xFile1)
- writeString(xFile2, L)
- end repeat
- end if
- setPosition(xFile2, 0)
- delete(xFile1)
- createFile(xFile1, HDDir & "Passport.NOT")
- openFile(xFile1, HDDir & "Passport.NOT", 2)
- set L to "*"
- repeat while (Status(xFile1) = 0) and (L <> EMPTY)
- set L to readLine(xFile2)
- writeString(xFile1, L)
- end repeat
- closeFile(xFile1)
- delete(xFile2)
- end
-