;*********************************************************
;*                                                       *
;*           $VER: Install 1.24 (08.02.96)               *
;*                                                       *
;*                $Filename: Install $                   *
;*                $Version: 37.30 $                      *
;*                $Date: 08.02.96 $                      *
;*                $Creation: 08.02.96 $                  *
;*                                                       *
;*         Installer script to install Viewer.           *
;*                                                       *
;*     © Copyright 1996 by T&T, all rights reserved      *
;*                                                       *
;*********************************************************

;-------------- language env ------------------
(set @language "Deutsch")
;--------------- version txt ------------------
(set #version "v1.01")
;-------------- kickstart txt -----------------
(set #bad-kick "Viewer laufen nur ab Kickstart 2.04 !")
;------------ default paths -------------------
(set #default_bmp "SYS:Tools/T&TViewer/ViewBMP")
(set #default_iff "SYS:Tools/T&TViewer/ViewIFF")
(set #default_pcx "SYS:Tools/T&TViewer/ViewPCX")
(set #default_intui "SYS:Tools/T&TViewer/IntuiView")
(set #default_guide "SYS:Tools/T&TViewer")
(set #default_lib "libs:")
;-------------- update txt --------------------
(set #update_bmp
   (cat "\n ViewBMP  existiert bereits !\n"
        " Soll die alte Version überschrieben werden ?"
   )
)
(set #update_iff
   (cat "\n ViewIFF  existiert bereits !\n"
        " Soll die alte Version überschrieben werden ?"
   )
)
(set #update_pcx
   (cat "\n ViewPCX  existiert bereits !\n"
        " Soll die alte Version überschrieben werden ?"
   )
)
(set #update.hlp " 1")
;-------------- welcome txt -------------------
(set #infos
   (cat "\nT&TViewer Installation\n"
         "------------------------\n\n"
          "Dieses Script installiert\n"
          "T&TViewer "#version"\n"
          "auf Ihrem Amiga.\n\n\n"
          "T&TViewer ©'96 by T&T\n"
   )
)
;---------------- titles txt ------------------
(set #choices "\nSie haben die Wahl :\n")
(set #dest_viewer "In welches Verzeichnis installieren?")
(set #dest_intui "Wo soll die Intuiview.class installiert werden ?")
(set #dest_guide "Wo soll die Viewer.guide installiert werden ?")
(set #dest_lib "Wo soll die support.library installiert werden ?")
(set #dest_bmp "Wo sollen die BMP Viewer installiert werden ?")
(set #dest_iff "Wo sollen die IFF Viewer installiert werden ?")
(set #dest_pcx "Wo sollen die PCX Viewer installiert werden ?")
;--------------- help txt ---------------------
(set #help_main
   (cat "\n * ViewBMP, ViewIFF und ViewPCX sind\n"
        "   Bildanzeiger für die Formate:\n"
        "   BMP, IFF und PCX\n\n"
        " * IntuiView.class......Konfigurationsfile\n\n"
        " * Viewer.guide.........Dokumentation"
   )
)
(set #help_bmp
   (cat "\n * ViewBMP_pc_low.....ohne Effektmodule, pc relativ\n\n"
        " * ViewBMP_low........ohne Effektmodule\n\n"
        " * ViewBMP+...........mit Effektmodulen\n\n"
        "   (siehe auch Viewer.guide)"
   )
)
(set #help_iff
   (cat "\n * ViewIFF_pc_low.....ohne Effektmodule, pc relativ\n\n"
        " * ViewIFF_low........ohne Effektmodule\n\n"
        " * ViewIFF+...........mit Effektmodulen\n\n"
        "   (siehe auch Viewer.guide)"
   )
)
(set #help_pcx
   (cat "\n * ViewPCX_pc_low.....ohne Effektmodule, pc relativ\n\n"
        " * ViewPCX_low........ohne Effektmodule\n\n"
        " * ViewPCX+...........mit Effektmodulen\n\n"
        "   (siehe auch Viewer.guide)"
   )
)
(set #help_viewer
   (cat "\n Wählen Sie das Verzeichnis, in dem Sie die zuvor "
        "  ausgewählten Komponenten installieren möechten!\n"
        " Mittels Make New Drawer können Sie ein neues\n"
        "  Verzeichnis erstellen."
   )
)
(set #help_intui
   (cat "\n Wählen Sie das Verzeichnis, in dem sich entweder\n"
        "  die alte Intuiview.class befindet oder ein neues!\n"
        " Mittels Make New Drawer können Sie ein neues\n"
        "  Verzeichnis erstellen."
   )
)
(set #help_guide
   (cat "\n Wählen Sie das Verzeichnis, in dem Sie die\n"
        "  Dokumentation installieren möchten!\n"
        "  (Viewer.install wird ebenfalls in dieses\n"
        "   Verzeichnis kopiert)\n"
        " Mittels Make New Drawer können Sie ein neues\n"
        "  Verzeichnis erstellen."
   )
)
(set #help_lib
   (cat "\n Wählen Sie das Verzeichnis, in dem Sie die\n"
        "  support.library installieren möchten!\n"
        " Mittels Make New Drawer können Sie ein neues\n"
        "  Verzeichnis erstellen."
   )
)
;---------- kickstart & workbench --------------
(if (< (/ (getversion) 65536) 37)
   (
     (abort #bad-kick)
   )
)
(set wbversion (/ (getversion "version.library") 65536))

(user 1)				;Voreinstellung user 1
(message #infos "\n\n")			;Titelbild
(welcome)				;  darstellen
;------------ prepare paths --------------------
(if (= @user-level 0)			;nötig, da nur ein directory
   (makedir "SYS:Tools/T&TViewer")	;  created wird (!)
)
;------------ show mainmenu T&TViewer ----------
(set point_main				;Hauptmenu variable
   (askoptions
      (prompt #choices)
      (help #help_main)
      (default #default_file)
      (choices
        " ViewBMP"			;bit  1 
        " ViewIFF"			;bit  2
        " ViewPCX"			;bit  4
        " Intuiview.class"		;bit  5
        " Viewer.guide"			;bit 16
      )
      (default 31)                       ; alles
   )
)
;------------- show submenu ViewBMP ------------
(if (bitand point_main 1)
   (set point_bmp
      (askoptions
         (prompt #choices)
         (help #help_bmp)
         (choices
            "ViewBMP_pc_low"		;bit 1
            "ViewBMP_low"		;bit 2
            "ViewBMP+, support.library"	;bit 4
         )
         (default 7)                    ; alles
      )
   )
)
(if (and (not (bitand point_bmp 0))(bitand point_main 1))
   (set destination
      (askdir
         (prompt #dest_bmp)
         (help #help_bmp)
         (default #default_bmp)
	 (newpath)			;Pfad anzeigen
      )
   )
)
;---------- create default directories ---------
(if (and (= destination #default_bmp)(bitand point_main 1));default path ?
   ((makedir "sys:tools/T&TViewer" (infos))	;create directories
    (makedir "sys:tools/T&TViewer/ViewBMP" (infos))) ;wegen else
)
;---------- copy "ViewBMP_pc_low.#?" -----------
(if (and (bitand point_bmp 1)(bitand point_main 1))
   (copyfiles
      (prompt #dest_bmp)
      (help #help_bmp)
      (source "ViewBMP/ViewBMP_pc_low")
      (dest destination)
      (infos)				;infos kopieren
      (confirm)				;kopierte files anzeigen
      (optional "force")		;überschreibt auch
   )                                    ;  löschgeschützte files
)
(complete 7)
;---------- copy "ViewBMP_low.#?" --------------
(if (and (bitand point_bmp 2)(bitand point_main 1))
   (copyfiles
      (prompt #dest_bmp)
      (help #help_bmp)
      (source "ViewBMP/ViewBMP_low")
      (dest destination)
      (infos)
      (confirm)
      (optional "force")
   )
)
(complete 14)
;---------- copy "ViewBMP+.#?" -----------------
(if (and (bitand point_bmp 4)(bitand point_main 1))
   (copyfiles
      (prompt #dest_bmp)
      (help #help_bmp)
      (source "ViewBMP/ViewBMP+")
      (dest destination)
      (infos)
      (confirm)
      (optional "force")
   )
)
(complete 21)
;--------------- show submenu ViewIFF ----------
(if (bitand point_main 2)
   (set point_iff
      (askoptions
         (prompt #choices)
         (help #help_iff)
         (choices
            "ViewIFF_pc_low"
            "ViewIFF_low"
            "ViewIFF+, support.library"
         )
         (default 7)  ; alles
      )
   )
)
(if (and (not (bitand point_iff 0))(bitand point_main 2))
   (set destination
      (askdir
         (prompt #dest_iff)
         (help #help_iff)
         (default #default_iff)
	 (newpath)
      )
   )
)
;---------- create default directories ---------
(if (and (= destination #default_iff)(bitand point_main 2))
   ((makedir "sys:tools/T&TViewer" (infos))
    (makedir "sys:tools/T&TViewer/ViewIFF" (infos)))
)
;--------- copy "ViewIFF_pc_low.#?" ------------
(if (and (bitand point_iff 1)(bitand point_main 2))
   (copyfiles
      (prompt #dest_iff)
      (help #help_iff)
      (source "ViewIFF/ViewIFF_pc_low")
      (dest destination)
      (infos)
      (confirm)
      (optional "force")
   )
)
(complete 28)
;--------- copy "ViewIFF_low.#?" ---------------
(if (and (bitand point_iff 2)(bitand point_main 2))
   (copyfiles
      (prompt #dest_iff)
      (help #help_iff)
      (source "ViewIFF/ViewIFF_low")
      (dest destination)
      (infos)
      (confirm)
      (optional "force")
   )
)
(complete 35)
;--------- copy "ViewIFF+.#?" ------------------
(if (and (bitand point_iff 4)(bitand point_main 2))
   (copyfiles
      (prompt #dest_iff)
      (help #help_iff)
      (source "ViewIFF/ViewIFF+")
      (dest destination)
      (infos)
      (confirm)
      (optional "force")
   )
)
(complete 42)
;--------- show submenu ViewPCX ----------------
(if (bitand point_main 4)
   (set point_pcx
      (askoptions
         (prompt #choices)
         (help #help_pcx)
         (choices
            "ViewPCX_pc_low"
            "ViewPCX_low"
            "ViewPCX+, support.library"
         )
         (default 7)  ; alles
      )
   )
)
(if (and (not (bitand point_pcx 0))(bitand point_main 4))
   (set destination
      (askdir
         (prompt #dest_pcx)
         (help #help_pcx)
         (default #default_pcx)
         (newpath)
      )
   )
)
;---------- create default directories ---------
(if (and (= destination #default_pcx)(bitand point_main 4))
   ((makedir "sys:tools/T&TViewer" (infos))
    (makedir "sys:tools/T&TViewer/ViewPCX" (infos)))
)
;--------- copy "ViewPCX_pc_low.#?" ------------
(if (and (bitand point_pcx 1)(bitand point_main 4))
   (copyfiles
      (prompt #dest_pcx)
      (help #help_pcx)
      (source "ViewPCX/ViewPCX_pc_low")
      (dest destination)
      (infos)
      (confirm)
      (optional "force")
   )
)
(complete 49)
;--------- copy "ViewPCX_low.#?" ---------------
(if (and (bitand point_pcx 2)(bitand point_main 4))
   (copyfiles
      (prompt #dest_pcx)
      (help #help_pcx)
      (source "ViewPCX/ViewPCX_low")
      (dest destination)
      (infos)
      (confirm)
      (optional "force")
   )
)
(complete 56)
;--------- copy "ViewPCX+.#?" ------------------
(if (and (bitand point_pcx 4)(bitand point_main 4))
   (copyfiles
      (prompt #dest_pcx)
      (help #help_pcx)
      (source "ViewPCX/ViewPCX+")
      (dest destination)
      (infos)
      (confirm)
      (optional "force")
   )
)
(complete 63)
;-------- copy "support.library" (plus) --------
(if (or (bitand point_bmp 4)
        (bitand point_iff 4)
        (bitand point_pcx 4))
   (copyfiles
      (source "libs/support.library")
      (dest #default_lib)
      (optional "force")
   )
)
(complete 70)
;-------------- IntuiView.class ----------------
(if (bitand point_main 8)
   (set destination
      (askdir
         (prompt #dest_intui)
         (help #help_intui)
         (default #default_intui)
	 (newpath)
      )
   )
)
(if (and (= destination #default_intui)(bitand point_main 8))
   ((makedir "sys:tools/T&TViewer" (infos))
    (makedir "sys:tools/T&TViewer/IntuiView" (infos)))
)
;---------- copy Intuiview.class ---------------
(if (bitand point_main 8)
   (copyfiles
      (source "IntuiView/IntuiView.class")
      (dest destination)
      (optional "force")
   )
)
(complete 80)
;---------------- Viewer.guide -----------------
(if (bitand point_main 16)
   (set destination
      (askdir
         (prompt #dest_guide)
         (help #help_guide)
         (default #default_guide)
      )
   )
)
(if (bitand point_main 16)
  ((copyfiles
      (source "Viewer.guide")
      (dest destination)
      (infos)
      (optional "force")
   )
   (copyfiles
      (source "Test.lbm")
      (dest destination)
      (infos)
      (optional "force")
   ))
)
;---------------- 100% complete ----------------
(set @default-dest destination) ;Pfad für logfile setzen
(complete 100)
(exit)
