;$VER: Install-LogicSim v1.1 (05.06.96)


;/// German strings

(if (= @language "deutsch")
(

(set #guidelang
(cat "Bitte wählen Sie die Sprache für die AmigaGuide Online-Hilfe"
))

(set #proglang
(cat "Bitte wählen Sie die Sprache für das Programm LogicSim"
))

(set #destdir
(cat "Bitte wählen Sie das Zielverzeichnis für LogicSim.\n"
     "Ein Unterverzeichnis \"LogicSim\" wird erzeugt."
))

(set #copying
(cat "Kopiere ..."
))

(set #selectiffviewer
(cat "Bitte wählen Sie einen iff-Anzeiger für die Grafik in der AmigaGuide-Dokumentation aus. Er sollte ein Fenster auf der Workbench benutzen (z.B. multiview oder wdisplay)"
))

(set #createscript
(cat "Erzeuge Show-Script für AmigaGuide ..."
))

(set #showerror
(cat "Fehler beim Anzeigen der Iff-Datei"
))

(set #installasl
(cat "Achtung: Sie müssen die asl.library oder die reqtools.library installieren !"
))

(set #oldinstall
(cat "Es befindet sich eine ältere Installation von LogicSim in diesem Verzeichnis. Ich werde es in LogicSim_old umbenennen."
))


))

;///

;/// English strings

(if (= @language "english")
(

(set #guidelang
(cat "Please select the language for the AmigaGuide Online-Help"
))

(set #proglang
(cat "Please select the language for the program LogicSim"
))

(set #destdir
(cat "Please select the destination directory for LogicSim.\n"
     "A sub-directory \"LogicSim\" will be created."
))

(set #copying
(cat "Copying ..."
))

(set #selectiffviewer
(cat "Please select your favorite iff-viewer for the graphics in the AmigaGuide-documentation. It should be viewer which uses a window on the workbench (e.g. multiview or wdisplay)."
))

(set #createscript
(cat "Creating Show-Script for AmigaGuide ..."
))

(set #showerror
(cat "Error while showing iff file"
))

(set #installasl
(cat "Note: You have to install the asl.library or reqtools.library !"
))

(set #oldinstall
(cat "There is an older installation of LogicSim in the same directory. I'll rename it to LogicSim_old, so you can delete it later."
))

))

;///

(complete 1)

;/// create destination dir

(set destination
    (askdir (prompt #destdir)
            (default @default-dest)
            (help @askdir-help)
    )
)

(set @default-dest destination)

(set destination (expandpath destination))
(set destination (tackon destination "LogicSim"))

(if (<> 0 (exists destination))
(
    (message #oldinstall)
    (run (cat "rename \"" destination "\" \"" destination "_old\""))
    (run (cat "delete \"" destination ".info\" >nil:"))
))

(makedir destination)
(run (cat "copy " "/LogicSim.info \"" destination ".info\""))

;///

(complete 10)

;/// copy main program
(copyfiles
        (prompt #copying)
        (source "")
        (pattern "L#?")
        (dest destination)
        (help @copyfiles-help)
)

;///

(complete 30)

;/// copy example circuits

(makedir (cat destination "/Circuits"))

(copyfiles
        (prompt #copying)
        (source "Circuits/")
        (pattern "#?")
        (infos)
        (dest (cat destination "/Circuits"))
        (help @copyfiles-help)
)
;///

(complete 50)

;/// copy docs

(set choice
        (askchoice
            (prompt #guidelang)
            (choices "English" "Deutsch")
            (default 0)
            (help @askoptions-help)
        )
)

(set doc_file
        (select choice
                "LogicSim.guide"
                "LogicSim_deutsch.guide"
        )
)


(makedir (cat destination "/doc"))

(copyfiles
        (prompt #copying)
        (source (cat "doc/" doc_file))
        (dest (cat destination "/doc"))
        (infos)
        (newname "LogicSim.guide")
        (help @copyfiles-help)
)

(makedir (cat destination "/doc/gfx"))

(copyfiles
        (prompt #copying)
        (source "doc/gfx/")
        (pattern "#?")
        (dest (cat destination "/doc/gfx/"))
        (help @copyfiles-help)
)

;///

(complete 80)

;/// copy font


;(if (<> 0 (exists "FONTS:TinyTxt.font"))
; (
  (makedir "FONTS:TinyTxt")

  (copyfiles
         (prompt #copying)
         (source "fonts/TinyTxt.font")
         (dest "FONTS:")
         (help @copyfiles-help)
  )

  (copyfiles
         (prompt #copying)
         (source "fonts/TinyTxt/")
         (pattern "#?")
         (dest "FONTS:TinyTxt/")
         (help @copyfiles-help)
  )
; ))

;///

(complete 85)

;/// copy catalog


;(if (<> 0 (exists "LOCALE:" (noreq)))

 (set choice
         (askchoice
             (prompt #proglang)
             (choices "English" "Deutsch" "Español" "Svenska")
             (default 0)
             (help @askoptions-help)
         )
 )

 (if (= 1 choice)
  (copyfiles
          (prompt #copying)
          (source "catalogs/deutsch/LogicSimulator.catalog")
          (dest "LOCALE:catalogs/deutsch/")
          (help @copyfiles-help)
  )
 )

 (if (= 2 choice)
  (copyfiles
          (prompt #copying)
          (source "catalogs/español/LogicSimulator.catalog")
          (dest "LOCALE:catalogs/español/")
          (help @copyfiles-help)
  )
 )

 (if (= 3 choice)
  (copyfiles
          (prompt #copying)
          (source "catalogs/svenska/LogicSimulator.catalog")
          (dest "LOCALE:catalogs/svenska/")
          (help @copyfiles-help)
  )
 )


;)



;///

(complete 90)

;/// create SHOW-script

(set iffviewer "c:multiview")

(set iffviewer
    (askfile (prompt #selectiffviewer)
             (default "sys:utilities/multiview")
             (help #askfile-help)
    )
)


(textfile
        (prompt #createscript)
        (dest (cat destination "/doc/gfx/Show"))
        (append (cat ".key filename\nfailat 21\n" iffviewer " <filename>\nif WARN\n Requestchoice \"Info\" \"" #showerror "\" \"OK\"\nendif\n"))
)

;///

(complete 95)

;/// look for asl.library

(if (= 0 (exists "LIBS:asl.library"))
 (if (= 0 (exists "LIBS:reqtools.library"))
  (message #installasl)
 )
)

;///

(complete 100)
