; This is the script to install TSMorph
; $VER: TSMorph-Install 2.2 (3.9.93)

(complete 0)

(set InstallDir
   (askdir
      (prompt "Where do you want to install TSMorph 2.2?")
      (help @askdir-help)
      (default "Work:")
   )
)

(if (> (/ (getversion) 65536) 38)
   (set Kick30 1)
   (set Kick30 0)
)

(Set DestDir 
   (tackon InstallDir "TSMorph")
)

(Set RexxDir 
   (tackon DestDir "Rexx")
)

(Set CursorDir 
   (tackon DestDir "Cursor")
)

(Set BrushDir 
   (tackon DestDir "Brush")
)

(set @default-dest 
   DestDir
)

(makedir
   DestDir 
   (infos)
)

(Set Use040
   (= 
      (database
         "cpu"
      )
      68040
   )
)

(set Use881
   (askbool
      (prompt "Install 68020/030/68881/2/68040 version")
      (help "There are two versions of the TSMorph-render program. "
            "One requires both a 68020 or 68030 CPU with a 68881 or 68882 FPU or a 68040. "
            "The other should run on any processor.")
      (default Use040)
   )
)

(complete 10)

(if Use881
   (
      (copyfiles
         (prompt "Copying TSMorph program and data files")
         (help @copyfiles-help)
         (source "")
         (dest DestDir)
         (choices "TSMorph" "TSMorph-render.881" "TSMorph.guide" "TSMorph-prefs")
         (infos)
         (confirm)
      )
      (delete (tackon DestDir "TSMorph-render"))
      (rename (tackon DestDir "TSMorph-render.881")
              (tackon DestDir "TSMorph-render")
      )
      (delete (tackon DestDir "TSMorph-render.info"))
      (rename (tackon DestDir "TSMorph-render.881.info")
              (tackon DestDir "TSMorph-render.info")
      )
   )
   (copyfiles
      (prompt "Copying TSMorph program and data files")
      (help @copyfiles-help)
      (source "")
      (dest DestDir)
      (choices "TSMorph" "TSMorph-render" "TSMorph.guide" "TSMorph-prefs")
      (infos)
      (confirm)
   )
)

(if Kick30
   (tooltype
      (dest (tackon destdir "TSMorph.guide"))
      (setdefaulttool "MultiView")
   )
)

(complete 30)

(makedir
   RexxDir
   (infos)
)

(copyfiles
   (prompt "Copying example Rexx scripts")
   (help @copyfiles-help)
   (source "Rexx")
   (dest RexxDir)
   (all)
   (infos)
   (confirm)
)

(complete 40)

(makedir "ENVARC:TSMorph")

(copyfiles
   (prompt "Copying Icons to ENVARC:")
   (help @copyfiles-help)
   (source "")
   (dest "ENVARC:TSmorph")
   (choices "ENV/TSMorph/def_points.info"
            "ENV/TSMorph/def_bw16.info"
            "ENV/TSMorph/def_bw256.info"
            "ENV/TSMorph/def_dctv3.info"
            "ENV/TSMorph/def_dctv4.info"
            "ENV/TSMorph/def_ham6.info"
            "ENV/TSMorph/def_ham8.info"
            "ENV/TSMorph/def_iff.info"
            "ENV/TSMorph/def_ilbm.info"
            "ENV/TSMorph/def_jpg.info"
            "ENV/TSMorph/def_ppm.info"
            "ENV/TSMorph/def_prefs.info")
   (confirm)
)

(complete 50)

(makedir "ENV:TSMorph")

(copyfiles
   (prompt "Copying Icons to ENV:")
   (help @copyfiles-help)
   (source "")
   (dest "ENV:TSmorph")
   (choices "ENV/TSMorph/def_points.info"
            "ENV/TSMorph/def_bw16.info"
            "ENV/TSMorph/def_bw256.info"
            "ENV/TSMorph/def_dctv3.info"
            "ENV/TSMorph/def_dctv4.info"
            "ENV/TSMorph/def_ham6.info"
            "ENV/TSMorph/def_ham8.info"
            "ENV/TSMorph/def_iff.info"
            "ENV/TSMorph/def_ilbm.info"
            "ENV/TSMorph/def_jpg.info"
            "ENV/TSMorph/def_ppm.info"
            "ENV/TSMorph/def_prefs.info")
   (confirm)
)

(complete 60)

(if
   (askbool
      (prompt "Copy GUI files?")
      (help "Select 'Yes' to copy the GUI files. "
            "These files may then be changed to allow you to configure the user interface. "
            "Select 'No' if you do not wish to change the interface.")
   )
   (
      (makedir CursorDir)
      (copyfiles
         (prompt "Copying Pointer files")
         (help @copyfiles-help)
         (source "Cursor")
         (dest CursorDir)
         (all)
         (infos)
         (confirm)
      )
      (complete 70)
      (makedir BrushDir)
      (copyfiles
         (prompt "Copying Gadget files")
         (help @copyfiles-help)
         (source "Brush")
         (dest BrushDir)
         (all)
         (infos)
         (confirm)
      )
   )
)

(complete 80)

(startup "TSMorph"
   (prompt "Adding assign TSMorph: to " DestDir " in s:user-startup")
   (help @startup-help)
   (command "Assign TSMorph: " DestDir)
)

(complete 90)

(makeassign "TSMorph" DestDir)

(complete 100)
