;
; Installer script for Tankbuch installation
; $VER: Install_LCR-I 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 "deutsch")
   (
     (set #InstallWhat         "Was möchten Sie installieren ?")
     (set #InstallChoice1      "Hauptprogramm + Font")
     (set #InstallChoice2      "Dokumentation")
     (set #SelectCPU           "Art des Prozessors")
     (set #AskChoice1          "68000,020,030")
     (set #AskChoice2          "68040,060")
     (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 SelectProcessor

 (set Prozessor
  (
   (askchoice
    (prompt #SelectCPU)
    (help "Das Programm LCR-I gibt es in zwei Varianten.\nDie eine Variante belastet den Prozessor kaum, nur circa 5% mehr. Die andere Variante zeigt während der Verbindungsdauer fortlaufend die Kosten an, was rechenintensiver ist und den Prozessor um bis zu 20% mehr als normal belastet.\nWollen Sie Ihren Prozessor wenig belasten , wählen Sie den oberen Radiobutton.\nHaben Sie einen schnellen Prozessor, wählen Sie den unteren Radiobutton.")
    (choices #AskChoice1 #AskChoice2)
   )
  )
 )
)

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

(procedure InstallMainProg
 (
  (copyfiles
    (prompt #CopyingMainprog)
    (help @copyfiles-help)
    (if (= Prozessor 0)
        (source "000/LCR-I")
        (source "040/LCR-I")
    )
    (dest MainDir)
    (infos)
  )
 )
)
(procedure InstallMainProgIcon
 (
  (copyfiles
    (prompt #CopyingMainprog)
    (help @copyfiles-help)
    (source "PICX.obj")
    (dest MainDir)
    (infos)
  )
 )
)
(procedure InstallFont
 (
  (copyfiles
    (prompt #CopyFont)
    (help "Es wird der Font 'XEN' kopiert.\nWenn Sie die Installation hier abbrechen oder den Teil überspringen ist das Programm LCR-P bereits funktionstüchtig, jedoch werden die Texte mit dem eingestellten Fenster-Font dargestellt, was nicht immer die optimale Einstellung darstellt.\n\nEs wird empfohlen den Font zu installieren!")
    (source FontSrc)
    (all)
    (dest FontDest)
    (confirm)
  )
 )
)
(procedure InstallFixFont
 (
  (run "SYS:System/FixFonts"
    (prompt #fixfonts-prompt)
    (confirm)
    (help #fixfonts-help)
  )
 )
)
(procedure InstallDoc
 (
  (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 "")
;
;********* Sprache für Meldungen auf Deutsch festsetzen
;
(SetupMessages)
(if (= #InstallWhat "")
  (
    (set @language (select langnum "deutsch"))
    (SetupMessages)
  )
)
;
;********* Displays the welcome message
;
(user 1)
(welcome
   (Message "Hallo Amiga-User !\n\nDas Programm und diese Installationsroutine ist mit viel Aufwand erstellt worden.\nBitte lasst mich wissen, ob in Zukunft an diesen Programmen weitergearbeitet werden soll.\n\nDaher ist das Programm nun Mailware.\n\nMeine email-Adresse lautet:\nralf.scholl@adpag.de\n\nAnhand der empfangenen emails kann ich ermessen, ob das Programm in der Zukunft weiter gepflegt wird.")
)
;
;********* Ask which part is to be installed
;
(set ToInstall
  (askoptions
    (prompt #InstallWhat)
    (help @askoptions-help)
    (choices #InstallChoice1 #InstallChoice2)
  )
)

;******** Fortschrittsanzeige der Installation
;
(complete 13) (if (BITAND ToInstall  1) (SelectProcessor))
(complete 26) (if (BITAND ToInstall  1) (SelectMainDir))
(complete 39) (if (BITAND ToInstall  1) (InstallMainProg))
(complete 52) (if (BITAND ToInstall  1) (InstallMainProgIcon))
(complete 65) (if (BITAND ToInstall  1) (InstallFont))
(complete 78) (if (BITAND ToInstall  1) (InstallFixFont))
(complete 94) (if (BITAND ToInstall  2) (InstallDoc))
;

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