;
; Installer script for MultiView installation
; $VER: Install_MultiView 1.0 (07.07.97) by Szczepan/SubBlaBla
;
;********* Initialisations ****************************************************
;
(set MainDir            "")
(set SourceDir          "")
(set FileIDSourceDir    "Libs")
;
;********* Setup all the messages *********************************************
;
(procedure SetupMessages
 (
  (set DefDocDir       "HELP:")
  (set DefCatalogDir   (tackon "LOCALE:Catalogs" @language))

  (if (= @language "english")
    (
      (set #InstallWhat         "What do you want to install ?")
      (set #InstallChoice1      "Main program")
      (set #InstallChoice2      "Documentation")
      (set #InstallChoice3      "FileID.library")
      (set #InstallChoice4      "Deutsch MultiView.catalog")
      (set #SelectMainDir       "Select the directory where to copy the Main program.")
      (set #CopyingMainProg     "Copying the Main program...")
      (set #SelectDocDir        "Select the directory where to copy documentation.")
      (set #CopyingDoc          "Copying documentation...")
      (set #SelectFileIDDir     "Select the directory where to copy FileID.library.")
      (set #CopyingFileID       "Copying FileID.library...")
      (set #SelectCatalogDir    "Select the directory where to copy the catalog file.")
      (set #CopyingCatalog      "Copying catalog file...")
    )
  )
  (if (= @language "polski")
    (
      (set #InstallWhat         "Które czėōci pakietu chcesz zainstalowaź ?")
      (set #InstallChoice1      "Gīówny program")
      (set #InstallChoice2      "Documentacja")
      (set #InstallChoice3      "FileID.library")
      (set #InstallChoice4      "MultiView.catalog")
      (set #SelectMainDir       "Wybierz katalog, do którego chcesz skopiowaź gīowny program.")
      (set #CopyingMainProg     "Kopiujė gīówny program...")
      (set #SelectDocDir        "Wybierz katalog, do którego chcesz skopiowaź dokumentacjė.")
      (set #CopyingDoc          "Kopiujė dokumentacjė...")
      (set #SelectFileIDDir     "Wybierz katalog, do którego chcesz skopiowaź FileID.library.")
      (set #CopyingFileID       "Kopiujė FileID.library...")
      (set #SelectCatalogDir    "Wybierz katalog, do którego chcesz skopiowaź MultiView.catalog.")
      (set #CopyingCatalog      "Kopiujė MultiView.catalog...")
    )
  )
 )
)
;
;********* Install the main program *******************************************
;
(procedure InstallMainProg
 (
  (set MainDir
    (askdir
      (prompt #SelectMainDir)
      (help @askdir-help)
      (default "SYS:Utilities")
    )
  )
  (copyfiles
    (prompt #CopyingMainprog)
    (help @copyfiles-help)
    (source "MultiView")
    (dest MainDir)
    (infos)
  )
 )
)
;
;********* Install the Doc files **********************************************
;
(procedure InstallDoc
 (
  (set DocDir
    (askdir
      (prompt #SelectDocDir)
      (help @askdir-help)
      (default DefDocDir)
    )
  )
  (copyfiles
    (prompt #CopyingDoc)
    (help @copyfiles-help)
    (source (tackon (tackon SourceDir (tackon "Docs/" @language)) "MultiView.guide"))
    (dest DocDir)
  )
 )
)
;
;********* Install FileID library ************************************************
;
(procedure InstallFileID
 (
  (set FileIDDir
    (askdir
      (prompt #SelectFileIDDir)
      (help @askdir-help)
      (default "LIBS:")
    )
  )
  (copylib
    (prompt #CopyingFileID)
    (help @copylib-help)
    (source (tackon SourceDir "Libs/FileID.library"))
    (dest FileIDDir)
    (confirm)
  )
 )
)
;
;********* Install the catalogs ***********************************************
;
(procedure InstallCatalog
 (
  (set CatalogDir
    (askdir
      (prompt #SelectCatalogDir)
      (help @askdir-help)
      (default DefCatalogDir)
    )
  )
  (if (= @language "english")
    (set #language "deutsch")
  )
  (copylib
    (prompt #CopyingCatalog)
    (help @copyfiles-help)
    (source (tackon (tackon (tackon SourceDir "Locale/Catalogs") @language) "MultiView.catalog"))
    (dest CatalogDir)
    (confirm)
  )
 )
)
;
;********* Start of the installation program **********************************
;
(complete 0)
(user 2)
(set #InstallWhat "")
;
;********* Setup messages and check language
;
(SetupMessages)
(if (= #InstallWhat "")
  (
    (set langnum
      (askchoice
	(prompt "Which language do you speak ?")
	(help @askoptions-help)
	(choices "english" "polski")
      )
    )
    (set @language (select langnum "english" "polski"))
    (SetupMessages)
  )
)
;
;********* Displays the welcome message
;
(user 0)
(welcome)
;
;********* Ask which part is to be installed
;
(set ToInstall
  (askoptions
    (prompt #InstallWhat)
    (help @askoptions-help)
    (if (= #InstallChoice4 "")
	(choices #InstallChoice1 #InstallChoice2 #InstallChoice3)
	(choices #InstallChoice1 #InstallChoice2 #InstallChoice3 #InstallChoice4)
    )
  )
)
;
;******** Install each part
;
(complete 15)
(if (BITAND ToInstall  1) (InstallMainProg))
(complete 30)
(if (BITAND ToInstall  2) (InstallDoc))
(complete 60)
(if (BITAND ToInstall  4) (InstallFileID))
(complete 75)
(if (BITAND ToInstall  8) (InstallCatalog))
(complete 90)
;
;******** End
;
(complete 100)
(exit)

