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

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

  (if (= @language "english")
   (
     (set #InstallWhat         "What do you want to install ? \n The font 'XEN' will be installed in any case.")
     (set #InstallChoice1      "Main program")
     (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 ? \n Der Font 'XEN' wird in jedem Falle installiert.")
     (set #InstallChoice1      "Hauptprogramm")
     (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")
    (dest MainDir)
    (infos)
  )
  (copyfiles
    (prompt #CopyingMainprog)
    (help @copyfiles-help)
    (source "PICX.obj")
    (dest MainDir)
    (infos)
  )
; *** Füge LCR: in startup-sequence ein ***

(startup "LCR © Ralf Scholl"
  (prompt #ChangeStartup)
  (help @ChangeStartup)
  (command "c:assign LCR: \"" MainDir "\"\n")
)
(makeassign "LCR" MainDir)

; *** Kopiere ohne Fragen die wichtigen Daten ***

  (Message "\n\nEs wird nun der Font 'XEN' kopiert.\nWenn Sie die Installation hier abbrechen,\nist das Programm LCR 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))
