;$VER: Install_SoftCinema (2001-01-28)
;by Sebastian Huebner <cyco@baud.de>
;this is a part of the SoftCinema Distribution: SHAREWARE!


(set #scversion   "0.11b (2000-01-24)")

(set #keyfilename "S:SoftCinema.key")
(set #mainprogdir "SYS:Utilities")
(set #docudir     "HELP:")

(set #mainprogfile "SoftCinema")
(set #docuenglish  "SoftCinema_English.guide") 
(set #docufrench   "SoftCinema_Français.guide") 
(set #docupolski   "SoftCinema_Polski.guide") 
(set #regienglish  "Register_form.eng") 
(set #regipolski   "Register_form.pl")
(set #datadir      "codecs") 


;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; #choices-default: %fedcba
;
; a - main program
;
; b - english guide
; c - french guide
; d - polski guide
;
; e - english registration form
; f - polski registration form


;main program, english guide, english registration form
(set #choices-default-english %010011)

;main program, french guide,  english registration form
(set #choices-default-french  %010101)

;main program, polski guide,  polski registration form
(set #choices-default-polski  %101001)

;remove default choices for registration forms
(set #choices-default-noregi  %001111)

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

(complete 0)

;~~~~~~~~~~~~~~~~~~english texts~~~~~~~~~~~~~~~~~~

    (set #introduction
      (cat  "\n"
            "Wellcome to\n"
            "\n"
            "\n"
            "»»» " @app-name " «««\n"
            "\n"
            "\The Ultimate Movie Player for PPC Amigas\n"
            "\n"
            "by Jacek Cybularczyk <noe@webnet.pl>\n"
            "\n"
            "\n"
            "\n"
            "\nVersion to Install: " #scversion )
    )

    (set #what-to-install (cat "Which parts of the " @app-name " distribution do "
                               "want to install?"
                          )
    )

    (set #ask-mainpath (cat "Where should the main program be placed? "
                            "(An additional drawer for the codecs will be created if it doesn't "
                            "exist right now.)"
                       )
    )
    (set #ask-mainpath-help (cat "Please specify a place for the main program "
                                 "\"" @app-name "\". Usually this kind of program "
                                 "lives in \"" #mainprogdir "\". Please notice that "
                                 "an additional drawer for the codecs will be "
                                 "created at that place."
                            )
    )
    (set #ask-docspath (cat "Where should the documentation be placed?\n"
                       )
    )
    (set #ask-docspath-help (cat "Please specify a place for the documentation. "
                                 "Usually AmigaGuides live in \"" #docudir "\"."
                            )
    )
    (set #ask-regfpath (cat "Where should the registration form be placed?\n"
                       )
    )
    (set #ask-regfpath-help (cat "Please specify a place for the registration form. "
                                 "Notice that " @app-name " is Shareware and "
                                 "the unregistered version has many limitations. "
                                 "If you like it, register!"
                            )
    )
    (set #ask-readdocs "\n\n\nDo you want to read the Documentation right now?")
    (set #goodbye (cat "\n\n\n\nGoodbye and have fun with " @app-name "!"))
    (set #goodbye-novice (cat "\n\n\n\nGoodbye and have fun with " @app-name "!\n"
                              "\n\n"
                              "Main Program:  \"" #mainprogdir "\"\n"
                              "Documentation: \"" #docudir "\""
                         )
    )

    ;default choices for installation
    (set #choices-default #choices-default-english)

;~~~~~~~~~~~~~~~~~~polish texts~~~~~~~~~~~~~~~~~~

;(set @language "polski") ;for script testing
(if (= @language "polski")
  (
    (set #introduction
      (cat  "\n"
            "Witaj\n"
            "\n"
            "\n"
            "»»» " @app-name " «««\n"
            "\n"
            "\The Ultimate Movie Player for PPC Amigas\n"
            "\n"
            "by Jacek Cybularczyk <noe@webnet.pl>\n"
            "\n"
            "\n"
            "\n"
            "\nWersja do instalacji: " #scversion )
    )

    (set #what-to-install (cat "Które pliki z dystrybucji " @app-name " chciaîbyô zainstalowaê?"
                          )
    )

    (set #ask-mainpath (cat "Gdzie umieôciê gîówny plik? "
                            "(Bëdzie utworzony dodatkowy katalog dla kodeków.)"
                       )
    )
    (set #ask-mainpath-help (cat "Prosze wskazaê miejsce, gdzie ma byê skopiowany gîówny plik "
                                 "\"" @app-name "\". Proponuje umieôciê go w katalogu "
                                 "\"" #mainprogdir "\". Dodatkowo bëdzie tam utworzony katalog dla "
                                 "kodeków."
                            )
    )
    (set #ask-docspath (cat "Gdzie skopiowaê dokumentacje?\n"
                       )
    )
    (set #ask-docspath-help (cat "Prosze wskazaê miejsce, gdzie ma byê skopiowana dokumentacja. "
                                 "Proponuje umieôciê jâ w katalogu \"" #docudir "\"."
                            )
    )
    (set #ask-regfpath (cat "Gdzie skopiowaê formularz rejestracji?\n"
                       )
    )
    (set #ask-regfpath-help (cat "Prosze wskazaê miejsce, gdzie ma byê skopiowany formularz rejestracji. "
                                 @app-name " jest programem typu Shareware i wersja "
                                 "nie zarejestrowana posiada pewne ograniczenia. "
                                 "Jeûeli masz ochotë, zarejestruj jâ!"
                            )
    )
    (set #ask-readdocs "\n\n\nChciaîbyô przeczytaê teraz dokumentacjë?")
    (set #goodbye (cat "\n\n\n\nÛegnam i ûyczë miîej zabawy z programem " @app-name "!"))
    (set #goodbye-novice (cat "\n\n\n\nÛegnam i ûyczë miîej zabawy z programem " @app-name "!\n"
                              "\n\n"
                              "Program:  \"" #mainprogdir "\"\n"
                              "Dokumentacja: \"" #docudir "\""
                         )
    )

    ;default choices for installation
    (set #choices-default #choices-default-polski)
  )
)

;~~~~~~~~~~~~~~~~~~french texts~~~~~~~~~~~~~~~~~~

;(set @language "français") ;for script testing
(if (= @language "français")
  (
    (set #introduction
      (cat  "\n"
            "Bienvenue to\n"
            "\n"
            "\n"
            "»»» " @app-name " «««\n"
            "\n"
            "\Le visualisateur ultime de vidéos pour Amigas PPC\n"
            "\n"
            "par Jacek Cybularczyk <noe@webnet.pl>\n"
            "\n"
            "\n"
            "\n"
            "\nVersion à installer: " #scversion )
    )

    (set #what-to-install (cat "Quelle parties de " @app-name " la distribution "
                               "désirez-vous installer?"
                          )
    )

    (set #ask-mainpath (cat "Où le programme principal devra-t'il être placé? "
                            "(Un répertoire sera créé pour les codecs si il "
                            "n'existe pas déjà.)"
                       )
    )
    (set #ask-mainpath-help (cat "Spécifiez un emplacement pour le programme principal "
                                 "\"" @app-name "\". Normallement ce genre de programme "
                                 "réside dans \"" #mainprogdir "\". Notez qu'un répertoire "
                                 "sera créé à cet endroit pour le stockage des codecs."
                            )
    )
    (set #ask-docspath (cat "Où la documentation devra-t'elle être placée?\n"
                       )
    )
    (set #ask-docspath-help (cat "Spécifiez un emplacement pour la documentation. "
                                 "Normallement les docs AmigaGuides résident "
                                 "dans \"" #docudir "\"."
                            )
    )
    (set #ask-regfpath (cat "Où le formulaire d'enregistrement devra-t'il être placé?\n"
                       )
    )
    (set #ask-regfpath-help (cat "Spécifiez un emplacement pour le formulaire d'enregistrement. "
                                 "Notez que " @app-name " est Shareware et que "
                                 "la version de démonstration a certaines limitations. "
                                 "Si vous l'appréciez, enregistrez-vous!"
                            )
    )
    (set #ask-readdocs "\n\n\nDésirez-vous lire la documentation maintenant?")
    (set #goodbye (cat "\n\n\n\nAu revoir et amusez-vous avec " @app-name "!"))
    (set #goodbye-novice (cat "\n\n\n\nAu revoir etamusez-vous avec " @app-name "!\n"
                              "\n\n"
                              "Programme principal:  \"" #mainprogdir "\"\n"
                              "Documentation: \"" #docudir "\""
                         )
    )

    ;default choices for installation
    (set #choices-default #choices-default-french)
  )
)



;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Installation~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

;check for keyfile ==> perhaps skip registration form
(if (exists #keyfilename (noreq))
    (set #choices-default (BITAND #choices-default #choices-default-noregi))
)
(complete 1)


; introduction
(message #introduction (all))
(complete 10)


;choose user level
(welcome " ")
;test for user level
(set #novice  (= @user-level 0))
(set #average (= @user-level 1))
(set #expert  (= @user-level 2))
(complete 20)


(if #expert
    (set #choices (askoptions (prompt #what-to-install) (help #what-to-install-help)
                              (choices (cat @app-name " (Main Program)")
                                       "English Guide" "Français Guide" "Polski Guide"
                                       "English Registration Form" "Polski Registration Form")
                              (default #choices-default)
                  )
    )
    (set #choices #choices-default)
)       
(complete 30)


;where to install the main program?
(set #mainpath "")
(if (IN #choices 0)
    (set #mainpath (askdir (prompt #ask-mainpath) (help #ask-mainpath-help)
                           (default #mainprogdir))
    )
)
;keyfile can be placed at S: or PROGDIR:
;check at S: was done in the beginning, so check here at #mainpath
(if (AND (OR #novice #average)
         (exists (tackon #mainpath (fileonly #keyfilename)) (noreq)))
    (set #choices (BITAND #choices #choices-default-noregi))

)
(complete 50)


;where to install the documentation?
(set #docspath "")
(if (OR (IN #choices 1) (IN #choices 2) (IN #choices 3))
    (set #docspath (askdir (prompt #ask-docspath) (help #ask-docspath-help)
                           (default #docudir))
    )
)
(complete 60)


;where to install the registration form (if needed)?
(set #regfpath "")
(if (OR (IN #choices 4)
        (IN #choices 5)
    ) 
    (set #regfpath (askdir (prompt #ask-regfpath) (help #ask-regfpath-help)
                           (default (if (<> "" #mainpath)
                                        #mainpath
                                        #mainprogdir
                                    )
                           )
                   )
    )
)
(complete 70)


;~~~~~~~~~~~~~~~~~~Copy files~~~~~~~~~~~~~~~~~~
(if (IN #choices 0)
  (copyfiles (prompt "") (help "") (source "") (dest #mainpath)
             (pattern (cat "(" #mainprogfile "|" #datadir ")")) (infos) (noposition) (confirm)
  )
)
(complete 75)


(if (IN #choices 1)
  (copyfiles (prompt "") (help "") (source #docuenglish) (dest #docspath)
             (infos) (noposition) (confirm)
  )
)
(complete 80)

(if (IN #choices 2)
  (copyfiles (prompt "") (help "") (source #docufrench) (dest #docspath)
             (infos) (noposition) (confirm)
  )
)
(complete 85)

(if (IN #choices 3)
  (copyfiles (prompt "") (help "") (source #docupolski) (dest #docspath)
             (infos) (noposition) (confirm)
  )
)
(complete 90)


(if (IN #choices 4)
  (copyfiles (prompt "") (help "") (source #regienglish) (dest #regfpath)
             (infos) (noposition) (confirm)
  )
)
(complete 95)

(if (IN #choices 5)
  (copyfiles (prompt "") (help "") (source #regipolski) (dest #regfpath)
             (infos) (noposition) (confirm)
  )
)
(complete 100)

(if (askbool (prompt #ask-readdocs) (help "") (default 1))
    (if (= @language "polski")
        (run (prompt "") (help "") (safe) (cat "MultiView " #docupolski ))
        (if (= @language "français")
            (run (prompt "") (help "") (safe) (cat "MultiView " #docufrench ))
            (run (prompt "") (help "") (safe) (cat "MultiView " #docuenglish))
        )
    )
)

; the end
(set @default-dest #mainpath)
(if #novice
    (exit #goodbye-novice)
    (exit #goodbye)
)
