; ************************************************
; *
; * Install-MovieShop
; *
; * $VER: Install-MovieShop 4.3 (5. May 1997)
; *
; * This is the installation script for DraCo-Motion, VLAB-Motion
; * and MovieShop software.
; *
; * Copyright © 1994-1997 MS MacroSystem Computer GmbH
; * All Rights Reserved
; *
; * written by Claus Bönnhoff & Ibrahim Tertemiz
; *
; ************************************************

; #####################################################################
;
;  Set up some global variables.
;
; #####################################################################


(set MovieShop    "MovieShop")

(set DISK1        "MovieShop1")
(set DISK2        "MovieShop2")
(set DISK3        "MovieShop3")
(set DISK4        "MovieShop4")

; variables for hardware configuration
(set HW_DraCo        0)
(set HW_VLABMotion   0)
(set HW_Toccata      0)

; defines for variables above
(set AMIGA        0)
(set DRACO060        1)
(set DRACO040        2)
(set VLABMOTION   1)
(set NOAUDIO      0)
(set TOCCATA      1)
(set DRACOMOTION  2)
(set BOTHAUDIO    3)

; defines for the part choice
(set PART_MOVIESHOP  1)
(set PART_GUIDE      2)
(set PART_GERMAN     1)
(set PART_ENGLISH    2)

; defines for often used constants
(set FALSE 0)
(set TRUE  1)

; defines for the languages
(set LANG_DEUTSCH 2)
(set LANG_ENGLISH 4)

; get Kickstart version
(set OSVersion    (/ (getversion) 65536))

; what kind of installation is it (New or Update ?)
(set InstallType 0)

; defines for the install type
(set IT_NEW          0)
(set IT_VLABTODRACO  1)
(set IT_DRACOTODRACO 2)

; for the percent counter
(set TotalFiles   0)
(set ActualFiles  0)

; the needed paths
(set DirPath (@default-dest)) ; will be updated to ENVARC:MovieShopPath if found
(set MovieDirPath    "") ; the path to install MovieShop
(set OperatorDirPath "") ; the path for the Operators
(set TimeLineDirPath "") ; the path for the default timelines shipped with MovieShop
(set VideoNormDef "")    ; Unset video norm default

(set VNORM_PAL  0)
(set VNORM_NTSC 1)

; #####################################################################
;
;  text files to create MovieShop.autoupdate file
;
; #####################################################################

; just the header for a MovieShop script file
(set UpdTxt_Header        ("#MovieShop       V4.0\n" "         Autoupdate\n         Revision 1\n*/\n"))

; make a menu entry called Help with the rcommand h key on it
(set UpdTxt_ResetPath (cat ("ALIAS \"Hilfe\" HELP\nASSIGNMENU Hilfe\nASSIGNKEY \'\"rcommand H\"\' Hilfe\n")
                              ("\nSETPATH RESET\n")))

; if update from VLABMotion to DracoMotion adjust the size of the video
(set UpdTxt_SetCCIR_PAL (cat ("FRAMEPOS L 16 T 8\n")
                    ("FRAMESIZE W 688 H 560\n   JPEGQUALITY 90\n   TRANSFERRATE 3000\n")
                    ("TRANSFERLIMIT BOTH\n\n")))
(set UpdTxt_SetCCIR_NTSC (cat ("FRAMEPOS L 16 T 8\n")
                    ("FRAMESIZE W 688 H 560\n   JPEGQUALITY 90\n   TRANSFERRATE 3000\n")
                    ("TRANSFERLIMIT BOTH\n\n")))

; #####################################################################
;
;  Set up some messages.
;
; #####################################################################

(if (patmatch @language "deutsch")
; german language
  (
   (set language LANG_DEUTSCH)

   (set MSG_SELECTPARTS_PROMPT    ("Bitte wählen Sie welche Teile der MovieShop-Software installiert werden sollen."))
   (set HLP_SELECTPARTS_GENERAL   (cat ("Dieser Teil der Installation läßt Sie entscheiden, welche Teile ")
                                  ("der MovieShop-Software sie auf Ihrer Festplatte installieren möchten.\n")
                                  ("\n")))
   (set HLP_SELECTPARTS_MOVIESHOP (cat (("*** %s\n" MovieShop))
                                  ("Dieser Teil beinhaltet das Hauptprogramm, mit welchem Sie ")
                                  ("Videos aufzeichnen, bearbeiten und ")
                                  ("wieder abspielen können.\n")
                                  ("\n")))
   (set HLP_SELECTPARTS_GUIDE     (cat ("*** Online-Hilfe\n")
                                  ("Dieser Teil installiert alle notwendigen Dateien für die Online-Hilfe \n")
                                  ("\n")))

   (set HLP_SETDIRPATH        (cat "Wenn Sie mit dem Installer ein Verzeichnis anlegen, ist es "
                              ("sehr sinnvoll, daß sie in den Namen kein Leerzeichen einfügen. ")
                              ("Dieses erleichtert den späteren Umgang, besonders beim Arbeiten ")
                              ("in der Shell und mit AREXX.\n")))
   (set HLP_COPYLIB           ("Wenn bereits eine Library mit diesem Namen besteht, so wird"
                              "diese nur überschrieben, wenn sie eine ältere Version ist.\n"))
   (set MSG_FALSEOSVERSION    ("%s benötigt unbedingt KickStart 3.00 oder höher.\n" MovieShop))

   (set MSG_DRACOPATH         "Geben Sie bitte das Verzeichnis mit den DraCoTools an...")
   (set MSG_MOVIESHOPPATH     ("Geben Sie bitte das Zielverzeichnis für %s an. Es wird automatisch ein neues MovieShop Verzeichnis angelegt, wenn noch keins existiert." MovieShop))

   (set MSG_GETMOVIESHOPDISK1 (cat ("Bitte legen Sie die Diskette mit dem Namen \"") (DISK1) (":\" in ein beliebiges Laufwerk")))
   (Set HLP_GETMOVIESHOPDISK1 (cat MSG_GETMOVIESHOPDISK1 "\nIch benötige diese Diskette, um die Installation weiterführen zu können !\n"))
   (set MSG_GETMOVIESHOPDISK2 (cat ("Bitte legen Sie die Diskette mit dem Namen \"")(DISK2)(":\" in ein beliebiges Laufwerk")))
   (Set HLP_GETMOVIESHOPDISK2 (cat MSG_GETMOVIESHOPDISK2 "\nIch benötige diese Diskette, um die Installation weiterführen zu können!\n"))
   (set MSG_GETMOVIESHOPDISK3 (cat ("Bitte legen Sie die Diskette mit dem Namen \"")(DISK3)(":\" in ein beliebiges Laufwerk")))
   (Set HLP_GETMOVIESHOPDISK3 (cat MSG_GETMOVIESHOPDISK2 "\nIch benötige diese Diskette, um die Installation weiterführen zu können!\n"))
   (set MSG_GETMOVIESHOPDISK4 (cat ("Bitte legen Sie die Diskette mit dem Namen \"")(DISK4)(":\" in ein beliebiges Laufwerk")))
   (Set HLP_GETMOVIESHOPDISK4 (cat MSG_GETMOVIESHOPDISK2 "\nIch benötige diese Diskette, um die Installation weiterführen zu können!\n"))

   (set MSG_COPYLIB           "Kopiere Library %s nach %s...")
   (set HLP_COPYLIB           ("%s benötigt diese Library um richtig arbeiten zu können.\n" MovieShop))
   (set MSG_COPYFILE          "Kopiere Datei %s nach %s...")
   (set HLP_COPYFILE          ("%s benötigt diese Datei um richtig arbeiten zu können\n" MovieShop))
   (set MSG_ONLINEHELP        "Online-Hilfe")

   (set MSG_VideoNorm  ("Möchten Sie im PAL- oder NTSC-Modus arbeiten?"))
   (set HLP_VideoNorm  (cat ("Wenn Sie nicht wissen, in welchem Modus Ihr Video-Equipment arbeitet,")
                            ("dann fragen Sie bitte den Hersteller dieser Geräte. In Deutschland ist ")
                            ("die PAL-Norm der Standard.\n\n")))
   (set MSG_MAKEENVDIR     ("Erstelle benötigtes Verzeichnis..."))
   (set MSG_MAKEENVCONFIG  ("Erstelle Konfigurationsdatei für %s..." MovieShop))
   (set HLP_End    (cat ("Bitte setzen Sie Ihr System zurück nachdem Sie die Diskette entnommen haben.\n")
                        ("Dies ist notwendig um die so eben installierte Software zu aktivieren.\n")))
   (set MSG_SETENVVAR   ("Erzeuge Umgebungs-Variable"))
  )
; default language
  (
   (set language LANG_ENGLISH)

   (set MSG_SELECTPARTS_PROMPT     ("Select the parts of the MovieShop package you want to install at this time."))
   (set HLP_SELECTPARTS_GENERAL    (cat (("This part of the installation lets you select the parts of the %s " MovieShop))
                                   ("package you want to install at this time.\n")
                                   ("\n")))
   (set HLP_SELECTPARTS_MOVIESHOP  (cat (("*** %s\n" MovieShop))
                                   (("This option lets you install the %s program. With this program " MovieShop))
                                   ("you will do all of your work. It is an non linear video ")
                                   ("and audio editing system.\n")
                                   ("\n")))
   (set HLP_SELECTPARTS_GUIDE      (cat ("*** German Online-Help\n")
                                   ("This option lets you install all needed files for the german online help. \n")
                                   ("\n")))

   (set HLP_SETDIRPATH        (cat "NOTE: If you will using the Installer program's "
                              ("function to create a new directory using \"Make New Drawer...\"")
                              ("it is highly recommended that you DO NOT include ")
                              ("spaces in the drawer name.  Following this advice ")
                              ("will avoid any problems accessing the directory, ")
                              ("especially from ARexx scripts.\n\n")))
   (set HLP_COPYLIB           (cat "If you already have a copy of this library in the selected destination directory, the library "
                              ("included on the distribution disk will be compared to the one you ")
                              ("already have. If your current library is an old version, the newer ")
                              ("version will be installed.\n")))
   (set MSG_FALSEOSVERSION    (cat ("\MovieShop version %s requires at least KickStart 3.00 to run.\n" VersionNum)
                              ("\n")
                              ("Press the Proceed button to stop the installation procedure.\n")))

   (set MSG_MOVIESHOPPATH     (("Please select the directory for the %s program. A new drawer will be created automatically..." MovieShop)))
   (set MSG_DRACOPATH         ("Please select the directory for the DraCoTools..."))

   (set MSG_GETMOVIESHOPDISK1 (cat ("Please insert disk \"")(DISK1)(":\" in any drive...")))
   (set HLP_GETMOVIESHOPDISK1 (cat (MSG_GETMOVIESHOPDISK1) "\nI need this disk to completly install your programs.\n"))
   (set MSG_GETMOVIESHOPDISK2 (cat ("Please insert disk \"")(DISK2)(":\" in any drive...")))
   (set HLP_GETMOVIESHOPDISK2 (cat MSG_GETMOVIESHOPDISK2"\nI need this disk to completly install your programs.\n"))
   (set MSG_GETMOVIESHOPDISK3 (cat ("Please insert disk \"")(DISK3)(":\" in any drive...")))
   (set HLP_GETMOVIESHOPDISK3 (cat MSG_GETMOVIESHOPDISK2"\nI need this disk to completly install your programs.\n"))
   (set MSG_GETMOVIESHOPDISK4 (cat ("Please insert disk \"")(DISK4)(":\" in any drive...")))
   (set HLP_GETMOVIESHOPDISK4 (cat MSG_GETMOVIESHOPDISK2"\nI need this disk to completly install your programs.\n"))

   (set MSG_COPYLIB           "Copying library %s to %s...")
   (set HLP_COPYLIB           ("%s needs this library.\n" MovieShop))
   (set MSG_COPYFILE          "Copying file %s to %s...")
   (set HLP_COPYFILE          ("%s needs this file.\n" MovieShop))
   (set MSG_ONLINEHELP        "German Online-Help")
   (set MSG_MOVIESHOPHELPPATH ("Please select the drawer which contains your %s software." MovieShop))

   (set MSG_VideoNorm  ("Do you want to use PAL- or NTSC-Mode ?"))
   (set HLP_VideoNorm  (cat ("Please choose the video norm you want to use.\n")
                            ("In America you normaly use the NTSC norm\n\n")))
   (set MSG_MAKEENVDIR     ("Creating a needed directory..."))
   (set MSG_MAKEENVCONFIG  ("Creating configuration-file for %s..." MovieShop))
   (set HLP_End    (cat ("Please reset your system after removing the disk.\n")
                        ("This is needed to enable the installed software.\n")))
   (set MSG_SETENVVAR   ("Creating enviroment variable"))
  )
)

; #####################################################################
;
;  Ask the user which parts of the package should be installed.
;
; #####################################################################

(procedure ChooseParts
   (
   (set DefChoice PART_MOVIESHOP)
   (if (= language LANG_DEUTSCH) ; if "deutsch" than install guide
      (set DefChoice (+ DefChoice PART_GUIDE)))
   (set Parts
      (askoptions
         (prompt
            (MSG_SELECTPARTS_PROMPT)
         )
         (help
            (HLP_SELECTPARTS_GENERAL)
            (HLP_SELECTPARTS_MOVIESHOP)
            (HLP_SELECTPARTS_GUIDE)
            @askoptions-help
         )
         (default ("%ld" DefChoice))
         (choices
            ; bit position 0 -- todo & 1
            ;
            ("%s" MovieShop)

            ; bit position 1 -- todo & 2
            ;
            ("%s" MSG_ONLINEHELP)
         )
      )
   )
   )
)

; #####################################################################
;
;  Ask the user for a directory name.
;
;  these variables must be defined before calling this procedure:
;
;    DirPathTitle ; text to ask the user for
;    DirPathHelp  ; help text for the help button
;    DirPath      ; the Path which will be offered
;
; this procedure returns the selected directory in DirPath
;
; #####################################################################

(procedure SetDirPath
   (
   (if (= (exists DirPath) FALSE) ; Directory does not exist ?
      (
      (set DirPath   ; No -> offer to make a new Directory
         (askdir
            (prompt DirPathTitle)
            (help DirPathHelp @askdir-help)
            (newpath DirPath)
            (default DirPath)
         )
      )
      )
      (
      (set DirPath   ; Yes -> just offer this path to the user
         (askdir
            (prompt DirPathTitle)
            (help DirPathHelp @askdir-help)
            (default DirPath)
         )
      )
      )
   )
   )
)

; #####################################################################
;
;  Copy the specific library file to the LIBS: directory.
;
;  these variables must be defined before calling this procedure:
;
;    CopyLibFileName ; Name of the library
;    CopyLibFilePath ; the path to get the library from
;    DirPath         ; the directory to install the library
;
; #####################################################################

(procedure CopyLibFile
   (
;
; workaround for bug in copylib
;
   (if (= (exists (tackon "Libs:" CopyLibFileName)) TRUE) ; library exists ?
      (
         (set vernum (getversion (tackon "Libs:" CopyLibFileName)))
         (set ver_old (/ vernum 65536))               ; get version
         (set rev_old (- vernum (* ver_old 65536)))   ; get revision

         (set vernum (getversion (tackon CopyLibFilePath CopyLibFileName)))
         (set ver_new (/ vernum 65536))               ; get version
         (set rev_new (- vernum (* ver_new 65536)))   ; get revision
      )
      (
         (set ver_old 0) ; make sure library will be installed
         (set ver_new 1)
      )
   )

   (set doit FALSE)  ; look if new library is newer then the old one
   (if (< ver_old ver_new)
      (
         (set doit TRUE)
      )
      (
         (if (= ver_old ver_new)
            (
               (if (< rev_old rev_new)
                  (
                     (set doit TRUE)
                  )
               )
            )
         )
      )
   )

   (if (= doit TRUE) ; if required install new library
      (
         (if (= (exists (tackon DirPath CopyLibFileName)) TRUE) ; make the old library deleteable
            (
               (protect (tackon DirPath CopyLibFileName) "+rwed")
            )
         )
         (copylib
            (prompt  (MSG_COPYLIB CopyLibFileName DirPath))
            (help MSG_COPYLIB @copylib-help)
            (source (tackon CopyLibFilePath CopyLibFileName))
               (dest DirPath)
               (confirm)
         )
      )
   )
   )
)

; #####################################################################
;
;  Set the progress indicator.
;
; #####################################################################

(procedure IncrementMeter
   (
   (set PctDone   (/ (* ActualFiles 100) TotalFiles))
   (set ActualFiles  (+ ActualFiles AddToMeter))
   (complete PctDone)
   )
)

; #####################################################################
;
;  Install all MovieShop files
;
; #####################################################################

(procedure InstallMovieShop
   (
   (set existsrc (getassign DISK1 "a"))
   (if (= existsrc "")
      (askdisk (prompt MSG_GETMOVIESHOPDISK1)
               (help HLP_GETMOVIESHOPDISK1 @askdisk-help)
               (dest DISK1)
      )
   )

   (Set DirPath (tackon @default-dest "MovieShop"))
   (if (exists "ENV:MovieShopPath")
      (
      (set DirPath (getenv ("MovieShopPath")))
      )
   )
   (Set DirPathTitle MSG_MOVIESHOPPATH)
   (Set DirPathHelp  HLP_SETDIRPATH)
   (SetDirPath)
   (if (= (patmatch "#?MovieShop#?" DirPath) FALSE)
      (
         (set DirPath (tackon DirPath "MovieShop"))
      )
   )
   (set @default-dest (DirPath))
   (set MovieDirPath (DirPath))

   (textfile
      (prompt MSG_SETENVVAR)
      (dest "ENVARC:MovieShopPath")
      (append (MovieDirPath))
   )
   (copyfiles
      (source "ENVARC:MovieShopPath")
      (dest   "ENV:")
      (files)
   )

; #1
   (set AddToMeter   1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
; install catalog if necessary
;
; ---------------------------------------------------------------------

   (if (= language LANG_DEUTSCH)
      (
      (if (= VideoNormDef "")
         (Set VideoNormDef VNORM_PAL)    ; germans use PAL video norm
      )
      (if (exists "Locale:Catalogs/deutsch")
         (
            (copyfiles
               (prompt (MSG_COPYFILE "movieshop.catalog" "Locale:catalogs/deutsch/"))
               (help MSG_COPYFILE @copyfiles-help)
               (source (cat (DISK1)(":MovieShop/movieshop.catalog")))
               (dest "Locale:Catalogs/deutsch")
               (files)
               (optional fail force)
            )
         )
         (
            (makedir (tackon DirPath "Catalogs"))
            (makedir (tackon DirPath "Catalogs/Deutsch"))
            (copyfiles
               (prompt (MSG_COPYFILE "movieshop.catalog" DirPath))
               (help MSG_COPYFILE @copyfiles-help)
               (source (cat (DISK1) (":MovieShop/movieshop.catalog")))
               (dest (tackon DirPath "Catalogs/Deutsch/"))
               (files)
               (optional fail force)
            )
         )
      )
      )
   )
   (if (= language LANG_ENGLISH) ; Americans use NTSC normaly
      (
         (if (= VideoNormDef "")
            (Set VideoNormDef VNORM_NTSC)
         )
      )
   )

; #2
   (set AddToMeter   1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
; install BootPic
;
; ---------------------------------------------------------------------

   (copyfiles
      (prompt (MSG_COPYFILE "MovieShop" DirPath))
      (help MSG_COPYFILE @copyfiles-help)
      (source (cat (DISK1)(":MovieShop/MovieShop.pic")))
      (dest DirPath)
      (infos)
      (files)
      (optional fail force)
   )

; #3
   (set AddToMeter   1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
;  install toolbox
;
; ---------------------------------------------------------------------

   (set DirPath MovieDirPath)
   (makedir (tackon DirPath "ToolBox_32×32"))
   (set DirPath (tackon DirPath "ToolBox_32×32"))
   (copyfiles
      (prompt (MSG_COPYFILE DirPath))
      (help MSG_COPYFILE @copyfiles-help)
      (source (cat (DISK1)(":ToolBox_32×32")))
      (pattern "#?")
      (dest DirPath)
      (optional fail force)
   )

; #4
   (set AddToMeter   1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
;  install movieshop.autoupdate.
;
; ---------------------------------------------------------------------

   (Set UpdateFile (cat UpdTxt_HEADER)) ; header is
   (if (= InstallType IT_NEW)
      (
      (Set UpdateFile (cat UpdateFile UpdTxt_ResetPath)) ; reset all paths if new installation
      )
      else
      (
         (if (= VideoNormDef VNORM_PAL)
            (
            (Set UpdateFile (cat UpdateFile UpdTxt_SetCCIR_PAL)) ; set CCIR video size
            )
            (
            (Set UpdateFile (cat UpdateFile UpdTxt_SetCCIR_NTSC)) ; set CCIR video size
            )
         )
      )
   )

; ---------------------------------------------------------------------
;
;  Set Videonorm  (PAL or NTSC) only if new installation
;
; ---------------------------------------------------------------------

   (if (= InstallType IT_NEW )
      (
      (Set HelpStr "\n")
      (Set VideoNorm (askchoice (prompt MSG_VideoNorm)
                     (help HLP_VideoNorm @askchoice-help)
                     (choices "PAL" "NTSC")
                     (default VideoNormDef))
      )
      (select VideoNorm
         (set STR_VideoNorm "PAL")
         (set STR_VideoNorm "NTSC")
      )
      (Set HelpStr    (cat "INPUTVMODE " STR_VideoNorm "\nOUTPUTVMODE AUTO\n"))
      (Set UpdateFile (cat UpdateFile HelpStr))
      )
   )

; #5
   (set AddToMeter   1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
; Install DraCoSetPatch and DraCoBootROM only if DraCo
;
; ---------------------------------------------------------------------

   (if (> HW_DraCo 0)                    ; is this a DraCo system ?
      (
      (if (<> InstallType IT_DRACOTODRACO)   ; is MovieShop3.6 not installed yet ?
         (                                   ; then we have to install DraCoSetPatch
         (Set OldPath DirPath)
         (Set OldPathTitle DirPathTitle)
         (Set OldPathHelp DirPathHelp)
         (Set DirPath "SYS:DraCoTools")
         (Set DirPathTitle MSG_DRACOPATH)
         (Set DirPathHelp  HLP_SETDIRPATH)
         (SetDirPath)
         (copyfiles
            (prompt (MSG_COPYFILE "DraCoSetPatch" DirPath))
            (help MSG_COPYFILE @copyfiles-help)
            (source (cat (DISK1)(":DraCo/DraCoSetPatch")))
            (dest DirPath )
            (files)
            (optional fail force)
         )
         )
      )
      (set CopyLibFilePath (cat (DISK1)(":DraCo/")))
      (set CopyLibFileName "DraCoBootFile")
      (set DirPath "DEVS:")
      (CopyLibFile)
      (run (cat (DISK1)(":DraCo/DraCoSystem Softkick 1")))
      (Set DirPath      OldPath      )
      (Set DirPathTitle OldPathTitle )
      (Set DirPathHelp  OldPathHelp  )
      )
   )

; #6
   (set AddToMeter   1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
;  install ChangeAudio installer script to choose between Toccata
;  and DraCoMotion audio hardware only if both hardware are found
;
; ---------------------------------------------------------------------

   (if(= HW_VLABMotion BOTHAUDIO)
   (
      (copyfiles
         (prompt (MSG_COPYFILE "SetAudio" DirPath))
         (help   MSG_COPYFILE @copyfiles-help)
         (source (cat (DISK1) (":MovieShop")))
         (pattern "#?Audio#?")
         (Dest DirPath)
         (infos)
         (files)
         (noposition)
      )
   )
   )

; #7
   (set AddToMeter   1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
; set audio hardware to use with "ENV:Toccata" variable (t=Toccata;d=DraCoMotion)
;
; ---------------------------------------------------------------------

   (if (<> HW_Toccata NOAUDIO)
      (
      (if(>= HW_Toccata DRACOMOTION)   ; DraCoMotion
         (set UseAudio "d"))
      (if(=  HW_Toccata TOCCATA)          ; Toccata
         (set UseAudio "t"))

      (if (= (exists "ENVARC:Toccata") FALSE)
       (makedir "ENVARC:Toccata"
                (prompt MSG_MAKEENVDIR "ENVARC:Toccata")
                (help   MSG_MAKEENVDIR "ENVARC:Toccata" @makedir-help)
         )
      )
      (textfile (prompt MSG_MAKEENVCONFIG)
             (help MSG_MAKEENVCONFIG @textfile-help)
             (dest "ENVARC:Toccata/HARDWARE")
             (append ("%s" UseAudio))
      )
      )
   )

; #8
   (set AddToMeter   1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
;  create part of movieshop.autoupdate which is only if upgraded
;  from VLAB-Motion to DraCoMotion
;
; ---------------------------------------------------------------------

   (if (= InstallType IT_VLABTODRACO)
      (
      (Set UpdateFile (cat UpdateFile UpdTxt_AdjustSettings))
      (textfile (Prompt MSG_MAKEENVCONFIG)
         (Help MSG_MAKEENVCONFIG @textfile-help)
         (Dest (tackon MovieDirPath "MovieShop.autoupdate"))
         (Append UpdateFile)
      )
      )
   )

; #9
   (set AddToMeter   1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
; install default preferences
;
; ---------------------------------------------------------------------

   (if (= InstallType IT_NEW)
      (
         (makedir "ENVARC:MovieShop")
         (copyfiles
            (prompt (MSG_COPYFILE "movieshop.prefs" "ENVARC:MovieShop/"))
            (help MSG_COPYFILE @copyfiles-help)
            (source (cat (DISK1)(":MovieShop/MovieShop.prefs")))
            (dest "ENVARC:MovieShop/")
            (files)
            (optional fail force)
         )
         (makedir (tackon (MovieDirPath) "Windows"))
         (copyfiles
            (prompt (MSG_COPYFILE "Windows" "MovieShop/Windows"))
            (help MSG_COPYFILE @copyfiles-help)
            (source (cat (DISK1)(":MovieShop/Windows/")))
            (dest (tackon (MovieDirPath) "Windows/"))
            (files)
            (pattern "#?")
            (optional fail force)
         )
         (copyfiles
            (prompt (MSG_COPYFILE "WindowPos" "MovieShop"))
            (help MSG_COPYFILE @copyfiles-help)
            (source (cat (DISK1)(":MovieShop/WindowPos")))
            (dest "EnvArc:MovieShop/")
            (files)
            (optional fail force)
         )
      )
   )

; #10
   (set AddToMeter   1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
; install default macros
;
; ---------------------------------------------------------------------

   (if (= InstallType IT_NEW)
      (
         (copyfiles
            (prompt (MSG_COPYFILE "MovieShop.macros" "ENVARC:MovieShop/"))
            (help MSG_COPYFILE @copyfiles-help)
            (source (cat (DISK1)(":MovieShop/movieshop.macros")))
            (dest ("EnvArc:MovieShop/"))
            (files)
            (optional fail force)
         )
      )
   )

; #11
   (set AddToMeter   1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
; install default icons
;
; ---------------------------------------------------------------------

   (copyfiles
      (prompt (MSG_COPYFILE "Icons" "ENVARC:MovieShop/"))
      (help MSG_COPYFILE @copyfiles-help)
      (source (cat (DISK1)(":MovieShop/")))
      (dest "ENVARC:MovieShop/")
      (files)
      (pattern "def_#?")
      (optional fail force)
   )

; #12
   (set AddToMeter   1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
; install VMInit in WBStartUp
;
; ---------------------------------------------------------------------

   (copyfiles
      (prompt (MSG_COPYFILE "VMInit" "SYS:WBStartup"))
      (help MSG_COPYFILE @copyfiles-help)
      (source (cat (DISK1)(":Tools/VMInit")))
      (dest "SYS:WBStartup")
      (infos)
      (files)
      (optional fail force)
   )

; #13
   (set AddToMeter   1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
; install all needed libraries
;
; ---------------------------------------------------------------------

   (set existsrc (getassign DISK2 "a"))
   (if (= existsrc "")
      (askdisk (prompt MSG_GETMOVIESHOPDISK2)
               (help HLP_GETMOVIESHOPDISK2 @askdisk-help)
               (dest DISK2)
      )
   )
   (set CopyLibFilePath (cat (DISK2)(":Libs")))
   (set DirPath "Libs:")

   (if (> HW_DraCo 0)                              ; is this a DraCo system ?
      (
      (if (= HW_DraCo DRACO060)                    ; is this a 060DraCo system ?
         (
         (set CopyLibFileName "dmotion.library")
         (CopyLibFile)
         )
         (
         (set CopyLibFilePath (cat (DISK2)(":Libs/040")))
         (set CopyLibFileName "dmotion.library")
         (CopyLibFile)
         (set CopyLibFilePath (cat (DISK2)(":Libs")))
         )
      )
      )
   )

; #14
   (set AddToMeter   1)
   (IncrementMeter)

   (set CopyLibFileName "scsisupport.library")
   (CopyLibFile)

   (set CopyLibFileName "vmotion.library")
   (CopyLibFile)
; #15
   (set AddToMeter   1)
   (IncrementMeter)
   (set CopyLibFileName "motioneffect.library")
   (CopyLibFile)
; #16
   (set AddToMeter   1)
   (IncrementMeter)
   (set CopyLibFileName "multipic.library")
   (CopyLibFile)
; #17
   (set AddToMeter   1)
   (set CopyLibFileName "multisnd.library")
   (CopyLibFile)
; #18
   (set AddToMeter   1)
   (IncrementMeter)
   (set CopyLibFileName "pfile.library")
   (CopyLibFile)
; #19
   (set AddToMeter   1)
   (IncrementMeter)
   (set CopyLibFileName "movieshop.library")
   (CopyLibFile)
; #20
   (set AddToMeter   1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
;  install toccata library
;
; ---------------------------------------------------------------------

   (if(<> HW_Toccata NOAUDIO)
      (
      (set CopyLibFileName "toccata.library")
      (CopyLibFile)
      )
   )
; #21
   (set AddToMeter   2)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
; install effect operators
;
; ---------------------------------------------------------------------

   (Set DirPath (tackon MovieDirPath "Operators"))
   (set OperatorDirPath DirPath)

   (copyfiles
      (prompt (MSG_COPYFILE "Operators" DirPath))
      (help MSG_COPYFILE @copyfiles-help)
      (source (cat (DISK2)(":Operators/")))
      (dest DirPath)
      (files)
      (pattern "#?")
      (optional fail force)
   )

; #22
   (set AddToMeter 1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
;  install ext-files for existing operators
;
; ---------------------------------------------------------------------

; Disk 1

   (if (exists (tackon OperatorDirPath "CircleWipe")) ; is operator disk 1 installed ?
      (
         (set DirPath OperatorDirPath)
         (copyfiles
            (prompt (MSG_COPYFILE DirPath))
            (help MSG_COPYFILE @copyfiles-help)
            (source (cat (DISK2)(":OpDisk1")))
            (pattern "#?")
            (dest DirPath)
            (optional fail force)
         )
      )
   )
; #23
   (set AddToMeter   1)
   (IncrementMeter)

; Disk 2

   (if (exists (tackon OperatorDirPath "Triangle")) ; is operator disk 2 installed ?
      (
         (set DirPath OperatorDirPath)
         (copyfiles
            (prompt (MSG_COPYFILE DirPath))
            (help MSG_COPYFILE @copyfiles-help)
            (source (cat (DISK2)(":OpDisk2")))
            (pattern "#?")
            (dest DirPath)
            (optional fail force)
         )
      )
   )
; #24
   (set AddToMeter   1)
   (IncrementMeter)

; Disk 3

   (if (exists (tackon OperatorDirPath "PageTurn")) ; is operator disk 3 installed ?
      (
         (set DirPath OperatorDirPath)
         (copyfiles
            (prompt (MSG_COPYFILE DirPath))
            (help MSG_COPYFILE @copyfiles-help)
            (source (cat (DISK2)(":OpDisk3")))
            (pattern "#?")
            (dest DirPath)
            (optional fail force)
         )
      )
   )

; #25
   (set AddToMeter   1)
   (IncrementMeter)

; Disk 4

   (if (exists (tackon OperatorDirPath "Bouncer")) ; is operator disk 4 installed ?
      (
         (set DirPath OperatorDirPath)
         (copyfiles
            (prompt (MSG_COPYFILE DirPath))
            (help MSG_COPYFILE @copyfiles-help)
            (source (cat (DISK2)(":OpDisk4")))
            (pattern "#?")
            (dest DirPath)
            (optional fail force)
         )
      )
   )

; #26
   (set AddToMeter   1)
   (IncrementMeter)

; Disk 5

   (if (exists (tackon OperatorDirPath "Turnover")) ; is operator disk 5 installed ?
      (
         (set DirPath OperatorDirPath)
         (copyfiles
            (prompt (MSG_COPYFILE DirPath))
            (help MSG_COPYFILE @copyfiles-help)
            (source (cat (DISK2)(":OpDisk5")))
            (pattern "#?")
            (dest DirPath)
            (optional fail force)
         )
      )
   )

; MonumentDesigner

   (if (exists (tackon OperatorDirPath "MonumentDesigner")) ; is operator Monument Designer installed ?
      (
         (set DirPath OperatorDirPath)
         (copyfiles
            (prompt (MSG_COPYFILE DirPath))
            (help MSG_COPYFILE @copyfiles-help)
            (source (cat (DISK2)(":Monument")))
            (pattern "#?")
            (dest DirPath)
            (optional fail force)
         )
      )
   )

; #27
   (set AddToMeter   1)

; ---------------------------------------------------------------------
;
;  install saved timelines
;
; ---------------------------------------------------------------------

   (set existsrc (getassign DISK3 "a"))
   (if (= existsrc "")
      (askdisk (prompt MSG_GETMOVIESHOPDISK3)
               (help HLP_GETMOVIESHOPDISK3 @askdisk-help)
               (dest DISK3)
      )
   )

   (set DirPath MovieDirPath)
   (makedir (tackon DirPath "TimeLines"))
   (set DirPath (tackon DirPath "TimeLines"))
   (copyfiles
      (prompt (MSG_COPYFILE DirPath))
      (help MSG_COPYFILE @copyfiles-help)
      (source (cat (DISK3)(":TimeLines")))
      (pattern "#?")
      (dest DirPath)
      (optional fail force)
   )

; #28
   (set AddToMeter   1)
   (IncrementMeter)

; ---------------------------------------------------------------------
;
;  install Main Programm
;
; ---------------------------------------------------------------------

   (set DirPath MovieDirPath)
   (copyfiles
      (prompt (MSG_COPYFILE DirPath))
      (help MSG_COPYFILE @copyfiles-help)
      (source (cat (DISK3)(":Program")))
      (pattern "#?")
      (dest DirPath)
      (optional fail force)
   )

; #29
   (set AddToMeter   1)
   (IncrementMeter)

   )
)

; #####################################################################
;
;  Install online help
;
; #####################################################################

(procedure InstallGuide
   (
   (set existsrc (getassign DISK4 "a"))
   (if (= existsrc "")
      (askdisk (prompt MSG_GETMOVIESHOPDISK4)
               (help HLP_GETMOVIESHOPDISK4 @askdisk-help)
               (dest DISK4)
      )
   )

; there is no english guide now. Replace this part
; of the script if a new guide is finished.
;
;   (if (= language LANG_DEUTSCH)
;   (
;      (set langdefault 1)
;   )
;   (
;      (set langdefault 2)
;   ))
;
;
;   (
;   (set Parts
;      (askoptions
;         (prompt
;            (MSG_SELECTGUIDEPARTS)
;         )
;         (help
;            (HLP_SELECTGUIDEPARTS1)
;            @askoptions-help
;         )
;         (default langdefault)
;         (choices
;            ; bit position 0 -- todo & 1
;            ;
;            ("%s" MSG_GERMAN)
;            ; bit position 1 -- todo & 2
;            ;
;            ("%s" MSG_ENGLISH)
;         )
;      )
;   )
;   )

(set Parts 1) ; just while there is no english guide

   (if (BITAND Parts PART_GERMAN)
      (
         (if (= ((MovieDirPath) ""))
            (
            (if (exists "ENV:MovieShopPath")
               (
                  (set HelpDirPath (getenv ("MovieShopPath")))
               )
               (
                  (Set DirPath (tackon @default-dest "MovieShop"))
                  (Set DirPathTitle MSG_MOVIESHOPPATH)
                  (Set DirPathHelp  HLP_SETDIRPATH)
                  (SetDirPath)
                  (set HelpDirPath (DirPath))
               )
            )
            )
            (
              (set HelpDirPath (MovieDirPath))
            )
         )
         (makedir (tackon (HelpDirPath)("Help")))
         (makedir (tackon (HelpDirPath)("Help/Deutsch")))
; #1
         (set AddToMeter 1)
         (IncrementMeter)
         (copyfiles
            (prompt (MSG_COPYFILE "Scripte" (tackon (HelpDirPath)("Help/Deutsch"))))
            (help MSG_COPYFILE @copyfiles-help)
            (source (cat (DISK4)(":Guide/Deutsch")))
            (all)
            (dest (tackon (HelpDirPath)("Help/Deutsch")))
            (files)
            (optional fail force)
         )
; #2
         (makeassign "MS_GUIDE" (tackon HelpDirPath "Help/Deutsch"))
         (execute (tackon HelpDirPath "Help/Deutsch/UpdateOps.bat"))

         (set AddToMeter 1)
         (IncrementMeter)
      )
      (
         (set AddToMeter 2)
         (IncrementMeter)
      )
   )
   (if (BITAND Parts PART_ENGLISH)
      (
         (if (= ((MovieDirPath) ""))
            (
            (if (exists "ENV:MovieShopPath")
               (
                  (set HelpDirPath (getenv ("MovieShopPath")))
               )
               (
                  (Set DirPath (tackon @default-dest "MovieShop"))
                  (Set DirPathTitle MSG_MOVIESHOPPATH)
                  (Set DirPathHelp  HLP_SETDIRPATH)
                  (SetDirPath)
                  (set HelpDirPath (DirPath))
               )
            )
            )
            (
              (set HelpDirPath (MovieDirPath))
            )
         )
         (makedir (tackon (HelpDirPath)("Help")))
         (makedir (tackon (HelpDirPath)("Help/English")))
; #3
         (set AddToMeter 1)
         (IncrementMeter)
         (copyfiles
            (prompt (MSG_COPYFILE "Scripte" (tackon (HelpDirPath)("Help/English"))))
            (help MSG_COPYFILE @copyfiles-help)
            (source (cat (DISK4)(":Guide/English")))
            (all)
            (dest (tackon (HelpDirPath)("Help/English")))
            (files)
            (optional fail force)
         )
; #4
         (set AddToMeter 1)
         (IncrementMeter)
      )
      (
         (set AddToMeter 2)
         (IncrementMeter)
      )
   )
   )
)

; #####################################################################
;
; look what expansion cards and software versions are available
;
; #####################################################################

(procedure GetHardwareConfig
   (

   (if (< OSVersion 39)   ; Kick3.0 or higher is required
      (
      (abort (MSG_FALSEOSVERSION))
      )
   )

   (if (exists "libs:vmotion.library") ; get install type
      (
         (set vmver (getversion "libs:vmotion.library"))
         (set vmver (/ vmver 65536))
         (if (< vmver 9)
            (
               (set InstallType IT_VLABTODRACO)
            )
            (
               (set InstallType IT_DRACOTODRACO)
            )
         )
      )
      (
         (set InstallType IT_NEW)
      )
   )

   (set existsrc (getassign DISK1 "a"))
   (if (= existsrc "")
      (askdisk (prompt MSG_GETMOVIESHOPDISK1)
               (help HLP_GETMOVIESHOPDISK1 @askdisk-help)
               (dest DISK1)
      )
   )

   (run (cat DISK1 ":DraCo/DraCoSetPatch"))

   (run (cat DISK1 ":c/CheckSystem"))
   (if (exists "ENV:ToccataFound")
      (set HW_Toccata (getenv ("ToccataFound")))
   )
   (if (exists "ENV:VMotionFound")
   (
      (set HW_VLABMotion (getenv "VMotionFound"))
   )
   )
   (if (exists "ENV:DraCoFound")
      (set HW_DraCo (getenv "DraCoFound"))
   )

   (run (cat DISK1 ":c/CheckVideoNorm"))
   (if (exists  "ENV:MovieShopVNorm")
      (if (= (getenv "MovieShopVNorm") PAL)
         (
            (set VideoNormDef VNORM_PAL)
         )
         (
            (set VideoNormDef VMORM_NTSC)
         )
      )
   )
   )
)

; #####################################################################
;
;  On error - go here when an error occures
;
; #####################################################################

(onerror
   (exit (quiet))
)

; #####################################################################
;
;  Main Startup code is here
;
; #####################################################################

; check hardware configuration
(GetHardWareConfig)

; Choose parts to be installed
(ChooseParts)

; count number of files to be installed
(if (BITAND Parts PART_MOVIESHOP)
   (set TotalFiles (+ TotalFiles 29)))
(if (BITAND Parts PART_GUIDE)
   (set TotalFiles (+ TotalFiles 4)))

(complete 0)

(if (BITAND Parts PART_MOVIESHOP)
   (InstallMovieShop)
)
(if (BITAND Parts PART_GUIDE)
   (InstallGuide)
)

(complete 99)
(message HLP_End)
(complete 100)
