
(SET @default-dest "Work:")
(SET default_lang 0)

; ***** english texts *****

(SET #needKick (CAT "\nPicView need Kickstart Version 39 at least." ) )

(SET #startMsg (CAT "\nWelcom to PicView 2.00 !\n\n"
                     "This script installs PicView on your AMIGA.\n\n") )

(SET #destPrompt ( CAT "Please choose the destination directory for PicView.\n"
                       "No extra directory will be created." ) )

(SET #copyPFiles "Copying program files")

(SET #langPrompt "Select the languages you wish to use with PicView.")

(SET #DocPrompt "Select the directory for the documentation file.")

(SET #RexxPrompt "Select the ARexx scripts you wish to install." )

(SET #IconPrompt "Select an icon set for PicView.")

(SET #NormalIcon "Normal WB Icons (4 Colors)" )

(SET #MWBIcon "Magic WB Icons (8 Colors)" )

(SET #KeyPrompt "Select the directory for the key file.")

(SET #exitMsg (CAT "Much fun with PicView 2.00 wish you\n\n"
                   "Holger Papajewski" ) )


; ***** german texts *****

(IF (= @language "deutsch")
(
(SET default_lang 1)

(SET #needKick ( CAT "\nPicView benötigt mindestens die Kickstart-Version 39." ) )

(SET #startMsg (CAT "\nWillkommen bei PicView 2.00 !\n\n"
                     "Diese Datei installiert PicView auf ihrem AMIGA.\n\n") )

(SET #destPrompt (CAT "Wählen Sie bitte das Zielverzeichnis für PicView.\n"
                      "Es wird kein extra Verzeichnis erzeugt.") )

(SET #copyPFiles "Kopiere Programmdateien")

(SET #langPrompt "Wählen Sie die Sprachen, die Sie mit PicView benutzen wollen.")

(SET #DocPrompt "Wählen Sie ein Verzeichnis, in welches die Dokumentation kopiert werden soll.")

(SET #RexxPrompt "Wählen Sie die ARexx-Programme, die installiert werden sollen." )

(SET #IconPrompt "Wählen Sie die Art der Piktogramme für PicView." )

(SET #NormalIcon "Normale WB Piktorgramme (4 Farben)" )

(SET #MWBIcon "MagicWB Piktogramme (8 Farben)" )

(SET #KeyPrompt "Wählen Sei das Verzeichnis, in welches das Key-File kopiert werden soll.")

(SET #exitMsg (CAT "Viel Spaß mit PicView 2.00 wünscht\n\n"
                   "Holger Papajewski" ) )
)
)

; ***** start installation *****

(if (< (/ (GETVERSION) 65536) 39)
    (ABORT #needKick)
)

(MESSAGE #startMsg)

; ***** get dest dir for PicView *****

(SET @default-dest
    (ASKDIR (PROMPT  #destPrompt)
            (HELP    askdir-help)
            (DEFAULT @default-dest )))

(COPYFILES (SOURCE "PicView")
           (HELP copyfiles-help)
           (DEST @default-dest )
)

; ***** install some languages *****

(SET sprachen (ASKOPTIONS (PROMPT #langPrompt)
                          (HELP   askoptions-help)
                          (CHOICES "english"
                                   "deutsch"
                                   "dansk"
                          )
                          (DEFAULT (+ default_lang 1) )
              )
)

(if (IN sprachen 1)
    (COPYFILES (SOURCE "Locale/deutsch/PicView.catalog")
               (DEST "Locale:Catalogs/deutsch") )
)

(if (IN sprachen 2)
    (COPYFILES (SOURCE "Locale/dansk/PicView.catalog")
               (DEST "Locale:Catalogs/dansk") )
)

; ***** get dest for doc files *****

(SET @DocDir
    (ASKDIR (PROMPT  #DocPrompt)
            (HELP    askdir-help)
            (DEFAULT @default-dest)
            (NEWPATH)
    )
)

; ***** install doc files *****
(SET OForm "Orderform")
(SET AFD   "AFD-COPYRIGHT")

(if (= @language "english")
  (SET SDocDir  "Docs/english")
)
  
(if (= @language "deutsch")
  (
    (SET OForm   "Registrierung")
    (SET AFD     "AFD-COPYRIGHT.de")
    (SET SDocDir "Docs/deutsch")
  )
)

(COPYFILES (SOURCE  SDocDir)
           (DEST    @DocDir)
           (CHOICES "PicView.guide" "ReadMe.mui" OForm AFD)
)

; ***** install ARexx scripts *****

(SET PVrexx (ASKOPTIONS (PROMPT #RexxPrompt)
                          (HELP   askoptions-help)
                          (CHOICES "MakeAscii.rexx" "MakeGuide.rexx" "SlideShow.rexx" )
                          (DEFAULT 7 )
          )
)

(IF (IN PVrexx 1)
  (COPYFILES (SOURCE "rexx/MakeAscii.rexx")
             (DEST   "Rexx:")
  )
)

(IF (IN PVrexx 2)
  (COPYFILES (SOURCE "rexx/MakeGuide.rexx")
             (DEST   "Rexx:")
  )
)

(IF (IN PVrexx 3)
  (COPYFILES (SOURCE "rexx/SlideShow.rexx")
             (DEST   "Rexx:")
  )
)

; ***** install icon set *****

(SET iconSet (ASKCHOICE (PROMPT  #IconPrompt)
                        (HELP    askchoice-help)
                        (CHOICES #NormalIcon #MWBIcon)
                        (DEFAULT 0)
             )
)

(IF (= IconSet 1)
  (
    (COPYFILES (SOURCE "MWB/PicView.info")
               (DEST   @default-dest )
    )
    (COPYFILES (SOURCE  "MWB/guide.info")
               (DEST    @DocDir)
               (NEWNAME "PicView.guide.info")
    )
    (COPYFILES (SOURCE  "MWB/txt.info")
               (DEST    @DocDir)
               (NEWNAME (CAT OForm ".info"))
    )
  )
  ;*** else ***
  (
    (COPYFILES (SOURCE "PicView.info")
               (DEST   @default-dest)
    )
    (COPYFILES (SOURCE  SDocDir)
               (DEST    @DocDir)
               (PATTERN "#?.info")
    )
  )
)

(TOOLTYPE (DEST     (TACKON @default-dest "PicView"))
          (SETSTACK 8192)
          (NOPOSITION)
)
(TOOLTYPE (DEST     (TACKON @DocDir "PicView.guide"))
          (NOPOSITION)
)
(TOOLTYPE (DEST     (TACKON @DocDir OForm))
          (NOPOSITION)
)

; ***** check for key file and copy it *****

(SET @keyFile "Key/PicView.key")
(SET key( EXISTS @keyFile (NOREQ)))

(IF (= key 1)
  (
    (SET ENVexists (EXISTS "ENV:KEYPATH" ))
    (IF (= ENVexists 1)
      (
        (SET KeyPathENV (GETENV "KEYPATH" ))
        (SET ENV-choice (CAT "KEYPATH - " KeyPathENV ))
        (SET KeyDest (ASKCHOICE (PROMPT  #KeyPrompt)
                                (HELP    askchoice-help)
                                (CHOICES @default-dest "S:" ENV-choice)
                                (DEFAULT 0)))
      )
      ; ***** no KEYPATH var found *****
      (
        (SET KeyDest (ASKCHOICE (PROMPT  #KeyPrompt)
                                (HELP    askchoice-help)
                                (CHOICES @default-dest "S:")
                                (DEFAULT 0)))
      )
    )

    (IF (= KeyDest 0)
      (COPYFILES (SOURCE @keyFile)
                 (DEST   @default-dest)
      )
    )

    (IF (= KeyDest 1)
      (COPYFILES (SOURCE @keyFile)
                 (DEST   "S:")
      )
    )

    (IF (= KeyDest 2)
      (COPYFILES (SOURCE @keyFile)
                 (DEST   KeyPathENV)
      )
    )
  )
)

(EXIT #exitMsg )


