;$VER: MetaView Install 2.3 (12.10.1997)
;Copyright ©1996/97 Henk Jonas

(set @app-name "MetaView V2.3")
(set @sourcedir (pathonly @icon))
(set #wbversion (getversion "libs:version.library"))
(set #wbversion (/ #wbversion 65536))

(if (< #wbversion 37)
  (abort "\n\nAmigaDOS 2.0 or better is needed this software.")
)

(message "Henk Jonas\n"
         "present:\n\n"
         "MetaView\n\n"
         "This programm show and convert gfx-metafiles,\n"
         "use the amigametaformat.library\n"
         "and is Shareware.")
(set #user-level @user-level)
(user 2)
(set @parentdir
  (askdir
    (prompt "Please choice the destination for MetaView.\n"
            "I will create a drawer with name MetaView there,\n"
            "if he not exist.")
    (help @askdir-help)
    (default "RAM:")
    (disk)
  )
)
(user #user-level)

(set @default-dest (tackon @parentdir "MetaView"))

(makedir @default-dest
  (prompt "I create the drawer 'MetaView'.")
  (help @makedir-help)
  (infos)
)

(complete 5)

(copylib 
  (prompt "Now i install the 'amigametaformat.library'.")
  (source (tackon @sourcedir "libs/amigametaformat.library"))
  (dest  "libs:")
  (optional "nofail" "force" "askuser")
  (help "This library are needed for this programm.\n"
        "It is very importent to install this!")
)

(complete 10)

(set #driver
  (askoptions
    (prompt "Now i install the different Outputdrivers for the 'amigametaformat.library'.")
    (choices "Strip" "AMF" "CGM" "EPS" "GEM" "WordWorth" "DR2D" "HPGL" "AI" "JMF" "WMF")
    (help "the options:\n"
          "* Strip     : the driver for all renderings, like screen, ILBM, printer etc.\n"
          "* AMF       : are for output as Amiga Metafile Format.\n"
          "* CGM       : are for output as Computer Graphics Metafile.\n"
          "* EPS       : are for output as Encapsulated PostScript.\n"
          "* GEM       : are for output as GEM Metafile.\n"
          "* WordWorth : create ARexx scripts, for use in WordWorth.\n"
          "* DR2D      : are for output as DR2D (for PageStream, DrawStudio...)\n"
          "* HPGL      : are for output as HPGL (for Plotters)\n"
          "* AI        : are for output as AdobeIllustrator\n"
          "* JMF       : are for output as JavaMetaFile (for www-publishing)\n"
          "* WMF       : are for output as WindowsMetaFile\n")
  )
)

(complete 20)

(makedir "libs:AMF")

(if (IN #driver 0)
  (copylib 
    (prompt "Now i install the stripdriver for 'amigametaformat.library'.")
    (source (tackon @sourcedir "libs/AMF/amigametaformat-strip.driver"))
    (dest  "libs:AMF/")
    (optional "nofail" "force" "askuser")
    (help "strip for all renderings on screen, printer and ILBM-output\n")
  )
)

(complete 21)

(if (IN #driver 1)
  (copylib 
    (prompt "Now i install the filedriver for 'amigametaformat.library'.")
    (source (tackon @sourcedir "libs/AMF/amigametaformat-file.driver"))
    (dest  "libs:AMF/")
    (optional "nofail" "force" "askuser")
    (help "file for saving as Amiga Meta Format Metafile\n")
  )
)

(complete 22)

(if (IN #driver 2)
  (copylib 
    (prompt "Now i install the CGMdriver for 'amigametaformat.library'.")
    (source (tackon @sourcedir "libs/AMF/amigametaformat-cgm.driver"))
    (dest  "libs:AMF/")
    (optional "nofail" "force" "askuser")
    (help "CGM for saving as Computer Graphics Metafile\n")
  )
)

(complete 23)

(if (IN #driver 3)
  (copylib 
    (prompt "Now i install the EPSdriver for 'amigametaformat.library'.")
    (source (tackon @sourcedir "libs/AMF/amigametaformat-eps.driver"))
    (dest  "libs:AMF/")
    (optional "nofail" "force" "askuser")
    (help "EPS for saving as Encapsulated PostScript\n")
  )
)

(complete 24)

(if (IN #driver 4)
  (copylib 
    (prompt "Now i install the GEMdriver for 'amigametaformat.library'.")
    (source (tackon @sourcedir "libs/AMF/amigametaformat-gem.driver"))
    (dest  "libs:AMF/")
    (optional "nofail" "force" "askuser")
    (help "GEM for saving as GEM Metafile\n")
  )
)

(complete 25)

(if (IN #driver 5)
  (copylib 
    (prompt "Now i install the WordWorth-ARexx-driver for 'amigametaformat.library'.")
    (source (tackon @sourcedir "libs/AMF/amigametaformat-ww.driver"))
    (dest  "libs:AMF/")
    (optional "nofail" "force" "askuser")
    (help "WordWorth-ARexx-driver for creating WordWorth-ARexx-script\n")
  )
)

(complete 26)

(if (IN #driver 6)
  (copylib 
    (prompt "Now i install the DR2D-driver for 'amigametaformat.library'.")
    (source (tackon @sourcedir "libs/AMF/amigametaformat-dr2d.driver"))
    (dest  "libs:AMF/")
    (optional "nofail" "force" "askuser")
    (help "DR2D-driver for creating DR2D-Output\n")
  )
)

(complete 27)

(if (IN #driver 7)
  (copylib 
    (prompt "Now i install the HPGL-driver for 'amigametaformat.library'.")
    (source (tackon @sourcedir "libs/AMF/amigametaformat-hpgl.driver"))
    (dest  "libs:AMF/")
    (optional "nofail" "force" "askuser")
    (help "HPGL-driver for creating HPGL-Output\n")
  )
)

(complete 28)

(if (IN #driver 8)
  (copylib 
    (prompt "Now i install the AI-driver for 'amigametaformat.library'.")
    (source (tackon @sourcedir "libs/AMF/amigametaformat-ai.driver"))
    (dest  "libs:AMF/")
    (optional "nofail" "force" "askuser")
    (help "AI-driver for creating AI-Output\n")
  )
)

(complete 29)

(if (IN #driver 9)
  (copylib 
    (prompt "Now i install the JMF-driver for 'amigametaformat.library'.")
    (source (tackon @sourcedir "libs/AMF/amigametaformat-jmf.driver"))
    (dest  "libs:AMF/")
    (optional "nofail" "force" "askuser")
    (help "JMF-driver for creating JMF-Output\n")
  )
)

(complete 30)

(if (IN #driver 10)
  (copylib 
    (prompt "Now i install the WMF-driver for 'amigametaformat.library'.")
    (source (tackon @sourcedir "libs/AMF/amigametaformat-wmf.driver"))
    (dest  "libs:AMF/")
    (optional "nofail" "force" "askuser")
    (help "WMF-driver for creating WMF-Output\n")
  )
)

(complete 40)

(copyfiles
  (prompt "copy programm")
  (source (tackon @sourcedir "MetaView"))
  (dest @default-dest)
  (infos)
  (help "Now, i want copy the programm.")
)

(complete 50)

(copyfiles
  (prompt "copy MetaView.doc")
  (source (tackon @sourcedir "MetaView.doc"))
  (dest @default-dest)
  (infos)
  (help "Now, i want copy the MetaView.doc.")
)

(complete 60)

(set #language
  (askoptions
    (prompt "Now i copy the guide for MetaView.\n"
            "What is your favorite language?")
    (choices "English" "Deutsch" "Español" "Polski")
    (help @askoptions-help)
  )
)

(complete 61)

(if (IN #language 0)
  (copyfiles
    (prompt "copy english MetaView.guide")
    (source (tackon @sourcedir "MetaView.guide"))
    (dest @default-dest)
    (infos)
    (help "Now, i want copy the english MetaView.guide.")
  )
)

(complete 62)

(if (IN #language 1)
  (copyfiles
    (prompt "copy german MetaView.guide")
    (source (tackon @sourcedir "translations/MetaView_deutsch.guide"))
    (dest @default-dest)
    (infos)
    (help "Now, i want copy the german MetaView.guide.")
  )
)

(complete 63)

(if (IN #language 2)
  (copyfiles
    (prompt "copy spanish MetaView.guide")
    (source (tackon @sourcedir "translations/MetaView_espanol.guide"))
    (dest @default-dest)
    (infos)
    (help "Now, i want copy the spanish MetaView.guide.")
  )
)

(complete 64)

(if (IN #language 3)
  (copyfiles
    (prompt "copy polish MetaView.guide")
    (source (tackon @sourcedir "translations/MetaView_polski.guide"))
    (dest @default-dest)
    (infos)
    (help "Now, i want copy the polish MetaView.guide.")
  )
)

(complete 70)

(copyfiles
  (prompt "copy amigametaformat.readme")
  (source (tackon @sourcedir "libs/amigametaformat.readme"))
  (dest @default-dest)
  (infos)
  (help "Now, i want copy the amigametaformat.readme.")
)

(complete 80)

(copyfiles
  (prompt "copy ARexx-Examples")
  (source (tackon @sourcedir "ARexx-Examples"))
  (dest (tackon @default-dest "ARexx-Examples"))
  (files)
  (all)
  (infos)
  (help "Now, i want copy some ARexx-Examples.")
)

(user 2)
(if (= 1 (askbool
            (prompt "Do you have DrawStudio installed?")
            (choices "Yes" "No")
            (help "I want install to ARexx scripts for import and export "
                  "graphics in DrawStudio with MetaView")
         )
    )
    (
       (set #dspath
          (askdir
            (prompt "Please choice the DrawStudio drawer.")
            (help "I want install to ARexx scripts for import and export "
                  "graphics in DrawStudio with MetaView")
            (default "RAM:")
            (disk)
          )
       )
       (copyfiles
         (prompt "copy DrawStudio import script")
         (source (tackon @sourcedir "ARexx-Examples/DrawStudio_Import.dsrx"))
         (dest (tackon #dspath "Rexx"))
       )
       (copyfiles
         (prompt "copy DrawStudio export script")
         (source (tackon @sourcedir "ARexx-Examples/DrawStudio_Export.dsrx"))
         (dest (tackon #dspath "Rexx"))
       )
    )
)
(user #user-level)


(if (= 1 (askbool
            (prompt "Should i copy the example files?")
            (choices "Copy" "Skip")
            (help @askbool-help)
            (default 1)
         )
    )
    (copyfiles
      (prompt "copy Examples")
      (source (tackon @sourcedir "Examples"))
      (dest (tackon @default-dest "Examples"))
      (files)
      (all)
      (infos)
      (help "Now, i want copy some Examples.")
    )
)

(complete 85)

(set #osvernum (getversion))
(set #osver (/ #osvernum 65536))
(set #osrev (- #osvernum (* #osver 65536) ) )
(set #oldpatchvernum (getversion "c:SetPatch"))
(set #newpatchvernum (getversion (tackon @sourcedir "SetPatch43_5/SetPatch")))

(if (AND (> #osver 39) (< #oldpatchvernum #newpatchvernum))
  (if (= 1 (askbool
              (prompt "I want copy a new SetPatch (43.5) to your 'c:' directory.\n"
                      "This Software are published from Amiga Technologie and\n"
                      "fix also a bug on 'mathieeesingbas.library' in Kick 3.1.\n"
                      "The old 'c:SetPatch' will renamed to 'c:SetPatch.old'.")
              (choices "Copy" "Skip")
              (help "Press 'Copy' for install the new SetPatch and 'Skip' for not install.\n"
                    "I think you should install this Patch.\n"
                    "But if you get a GURU on MetaView-startup you must!")
              (default 1)
           )
      )
      (
        (rename "c:SetPatch" "c:SetPatch.old")
        (copylib
          (prompt "copy new SetPatch")
          (source (tackon @sourcedir "SetPatch43_5/SetPatch"))
          (dest  "c:")
          (optional "nofail" "force" "askuser")
          (help @copylib-help)
        )
      )
  )
)

(if (> #osver 38)
  (copylib
     (prompt "copy tabs.gadget")
     (source (tackon @sourcedir "libs/gadgets/tabs.gadget"))
     (dest  "libs:gadgets/")
     (optional "nofail" "force" "askuser")
     (help @copylib-help)
  )
)

(complete 90)

(if (= 1 (exists ("envarc:MetaView.path")))
  (if (= 1 (askbool
              (prompt "Should i update the MetaView.path environment variable?")
              (choices "Update" "Skip")
              (help "The ARexxScript and the MetaView.datatype will use the variable for locate the executable.")
              (default 1)
           )
      )
    (
      (textfile
        (prompt "Create ENVARC: variable with path of MetaView")
        (dest "envarc:MetaView.path")
        (append (tackon @default-dest "Metaview"))
        (help "The ARexxScript and the Metaview.datatype will use the variable for locate the executable.")
      )
      (textfile
        (prompt "Create ENV: variable with path of MetaView")
        (dest "env:MetaView.path")
        (append (tackon @default-dest "Metaview"))
        (help "The ARexxScript and the Metaview.datatype will use the variable for locate the executable.")
      )
    )
  )
)

(complete 95)

(user 2)
(if (= 1 (exists (tackon @sourcedir "keyfile.metaview")))
    (copyfiles
      (prompt "copy keyfile")
      (source (tackon @sourcedir "keyfile.metaview"))
      (dest @default-dest)
      (infos)
      (help "Now i copy the keyfile.")
    )
)
(if (= 0 (exists (tackon @default-dest "keyfile.metaview")))
    (message
       "Don`t forget to register!\n\n"
       "Please send $20 or 30,- DM to me:\n\n"
       "Henk Jonas\n"
       "Zionskirchstr. 28\n"
       "10119 Berlin\n"
       "Germany"
       (help "Look at MetaView.readme, MetaView.doc "
             "or MetaView.guide for register")
    )
)
(if (= 1 (exists (tackon @default-dest "keyfile.metaview")))
    (message
      "Thank you for register MetaView!"
    )
)

(complete 100)

