;
; Installer script for Tankbuch installation
; $VER: Install_LCR-P by Ralf Scholl
;
;********* Setup all the messages *********************************************
;

(procedure SetupMessages
 (
  (set DefDest        "LCR:")
  (set FontSrc        "Fonts/")
  (set FontDest       "Fonts:")
  (set DokSrc         "Dok/")
  (set DokDest        "LCR:Dok/Guide")
  (set DefCatalogDir  (tackon "LOCALE:Catalogs" @language))

  (if (= @language "english")
   (
     (set #InstallWhat         "What do you want to install ?")
     (set #InstallChoice1      "Main program + Font")
     (set #InstallChoice2      "Documentation")
     (set #SelectMainDir       "Select the directory where to copy the Main program.")
     (set #CopyingMainProg     "Copying the Main program...")
     (set #ChangeStartup       "Insert path in startup-sequence...")
     (set #CopyFont            "Copying the Font 'XEN' to Fonts:")
     (set #Fixfonts-prompt     "It is a recommendation to run 'FixFont' now.\n(It may run a while!)")
     (set #SelectDocDir        "Select the directory where to copy GUIDE-documentations.")
     (set #CopyingDoc          "Copying documentation...")
   )
  )
  (if (= @language "deutsch")
   (
     (set #InstallWhat         "Was möchten Sie installieren ?")
     (set #InstallChoice1      "Hauptprogramm + Font")
     (set #InstallChoice2      "Dokumentation")
     (set #SelectMainDir       "Wählen Sie das Verzeichnis, in das Sie das Hauptprogramm kopieren möchten.")
     (set #CopyingMainProg     "Kopiere das Hauptprogramm...")
     (set #ChangeStartup       "Füge Pfad in die startup-sequence...")
     (set #CopyFont            "Kopiere den Font 'XEN' nach Fonts:")
     (set #Fixfonts-prompt     "Es wird empfohlen das Tool FixFont nun zu starten.\n(Es kann einige Zeit laufen!)")
     (set #SelectDocDir        "Wählen Sie das Verzeichnis, in das Sie die GUIDE-Dokumentationen kopieren möchten.")
     (set #CopyingDoc          "Kopiere die Dokumentation...")
   )
  )
 )
)
;********* Installiere das Hauptprogramm ************************************
;

(procedure InstallMainProg

 (
  (set MainDir
    (askdir
     (prompt #SelectMainDir)
     (help @askdir-help)
     (default DefDest)
    )
  )

  (copyfiles
    (prompt #CopyingMainprog)
    (help @copyfiles-help)
    (source "LCR-P")
    (dest MainDir)
    (infos)
  )

; *** Kopiere mit Fragen die wichtigen Daten ***

  (Message "\n\nEs wird nun der Font 'XEN' kopiert.\nWenn Sie die Installation hier abbrechen,\nist das Programm LCR-P bereits funktionstüchtig,\njedoch werden die Texte mit dem eingestellten Fenster-Font dargestellt,\nwas nicht immer die optimale Einstellung darstellt.\n\nEs wird empfohlen den Font zu installieren!")
  (copyfiles
    (prompt #CopyFont)
    (help @copyfiles-help)
    (source FontSrc)
    (all)
    (dest FontDest)
    (confirm)
  )
  (run "SYS:System/FixFonts"
    (prompt #fixfonts-prompt)
    (confirm)
    (help #fixfonts-help)
  )
 )
)

;********* Installiere die Anleitung ****************************************
;

(procedure InstallDoc

 (
  (Message "\n\nEs werden nun die Anleitungen im PowerGuide-Format kopiert.\nZu den Dokumentationen wird noch ein Verzeichnis mit Grafiken kopiert, die für die PowerGuide Dokumentation 'LiesMich' benötigt werden, um den Text mit einer Bebilderung auszustatten.")
  (set DocDir
    (askdir
      (prompt #SelectDocDir)
      (help @askdir-help)
      (default DokDest)
    )
  )
  (copyfiles
    (prompt #CopyingDoc)
    (help @copyfiles-help)
    (source DokSrc)
    (all)
    (dest DocDir)
    (infos)
  )
 )
)
;********* 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" "deutsch")
      )
    )
    (set @language (select langnum "english" "deutsch"))
    (SetupMessages)
  )
)
;
;********* Displays the welcome message
;
(user 1)
(welcome)
;
;********* Ask which part is to be installed
;
(set ToInstall
  (askoptions
    (prompt #InstallWhat)
    (help @askoptions-help)
    (choices #InstallChoice1 #InstallChoice2)
  )
)

;******** Install each part
;
(complete 16) (if (BITAND ToInstall  1) (InstallMainProg))
(complete 78) (if (BITAND ToInstall  2) (InstallDoc))
;

;******** End
;
(complete 100)
(exit (quiet))
