;*********************************************************
;*                                                       *
;*         $VER: Viewer.install 1.1 (03.11.96)           *
;*                                                       *
;*              $Filename: Viewer.install $              *
;*              $Version: 1.1 $                          *
;*              $Date: 03.11.96 $                        *
;*              $Creation: 03.11.96 $                    *
;*                                                       *
;*        Installer script to install Viewer             *
;*        for CyberGraphX or Picasso2 direct             *
;*                                                       *
;*     © Copyright 1996 by T&T, all rights reserved      *
;*                                                       *
;*********************************************************

;-------------- Neudefinitionen ---------------
(set os_ver (/ (getversion "LIBS:version.library") 65536))
(if (= os_ver 37)
  (set workbench "2.0")
)
(if (= os_ver 38)
  (set workbench "2.1")
)
(if (= os_ver 39)
  (set workbench "3.0")
)
(if (= os_ver 40)
  (set workbench "3.1")
)
(if (= os_ver 41)
  (set workbench "4.0")
)
(set cpu (database "cpu"))
(set chip_mem (database "graphics-mem"))
(set all_mem (database "total-mem"))
(set fast_mem (- all_mem chip_mem))
(set #sys_info (cat " \nRechnerkonfiguration:\n\n\n"
                    " OS-Version: " workbench "\n\n"
                    " Prozessor: " cpu "\n\n"
                    " verfügbarer ChipRAM: " chip_mem " Byte\n"
                    "             FastRAM: " fast_mem " Byte")
)
(set @abort-button "Abbruch")
(set @user-level 1) 
;-------------- language env ------------------
(set @language "Deutsch")
;-------------- version txt ------------------
(set #version "v1.1")
;-------------- kickstart txt -----------------
(set #bad-kick "Viewer laufen nur ab Kickstart 2.04 !")
;-------------- system txt ------------------
(set #bad-system (cat "     Es ist weder eine Picasso 2,\n"
                      "    noch 'CyberGraphX' auf diesem\n"
                      "   Rechner installiert !!!\n\n\n"
                      "*-----------------------------------------*\n"
                      "| Bitte Viewer.guide - Einleitung lesen ! |\n"
                      "*-----------------------------------------*")
)
;-------------- default paths -------------------
(set #Picasso "Picasso2/")
(set #CyberGraphX "CyberGraphX/")
(set #source_test_pic "Test.lbm")
(set #source_viewer_guide "Viewer.guide")
(set #source_tools_ScrModeID "tools/ScrModeID")
(set #source_tools_Switcher "tools/Switcher.install")
(set #source_library "libs/support.library")
(set #source_intui "IntuiView/IntuiView.class")
(set #source_bmp_low "ViewBMP/ViewBMP_low")
(set #source_bmp_pc_low "ViewBMP/ViewBMP_pc_low")
(set #source_bmp_plus "ViewBMP/ViewBMP+")
(set #source_iff_low "ViewIFF/ViewIFF_low")
(set #source_iff_pc_low "ViewIFF/ViewIFF_pc_low")
(set #source_iff_plus "ViewIFF/ViewIFF+")
(set #source_pcx_low "ViewPCX/ViewPCX_low")
(set #source_pcx_pc_low "ViewPCX/ViewPCX_pc_low")
(set #source_pcx_plus "ViewPCX/ViewPCX+")
(set #default_path "SYS:Tools/T&TViewer")
(set #default_tools "SYS:Tools/T&TViewer/tools")
(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_lib "libs:")
;-------------- 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 #gfx 
   (cat "\nFür welchen Treiber ?\n"
        "(selektierter Treiber wurde automatisch erkannt)"
   )
)
(set #choices "\nSie haben die Wahl :\n")
(set #dest_viewer "In welches Verzeichnis installieren?")
(set #dest_intui "Installationsverzeichnis 'Intuiview.class':")
(set #dest_guide "Installationsverzeichnis 'Viewer.guide':")
(set #dest_tools "Installationsverzeichnis tools:")
(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_gfx
   (cat "\n * Es werden Bildanzeiger speziell\n"
        "   für die Picasso 2 oder CyberGraphX\n"
        "   installiert.\n\n"
        "   Die Voreinstellung entspricht dem\n"
        "   auf Ihrem Rechner installierten\n"
        "   Treiber.\n\n"
        "   Bei Wahl eines anderen Treibers,\n"
        "   kann es zu Fehlfunktionen kommen !"
   )
)
(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......Konfigurationsdatei\n"
        "                        für IntuiView\n\n"
        " * Viewer.guide.........Dokumentation\n\n"
        " * tools................Hilfsprogramme"
   )
)
(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\n"
        "  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"
        " 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."
   )
)
(set #help_tools
   (cat "\n * Es werden folgende Hilfsprogramme\n"
        "   installiert:\n\n"
        "    * ScrModeID (zeigt DisplayID)\n"
        "    * Switcher.install (schaltet\n"
        "       zwischen Picasso2 und CyberGraphX -\n"
        "       Treibern um)"
   )
)
;-------------- kickstart & workbench --------------
(if (< (/ (getversion) 65536) 37)
   (abort #bad-kick)
)
;-------------- Picasso oder CyberGraphX ? ---------------------
(if (and (< (exists ("libs:cybergraphics.library")) 1)(< (exists ("sys:expansion/village.library")) 1))
   (abort #bad-system) ;Viewer werden nicht installiert !
)
(if (> (exists ("libs:cybergraphics.library")) 0)
   (set driver 0) ;"cybergraphics.library" in "libs:" vorhanden
)
(if (> (exists ("sys:expansion/village.library")) 0)
   (set driver 1) ;"village.library" in "sys:expansion" vorhanden
)
(user 1)                                ;Voreinstellung user 1
(message #infos "\n\n")                 ;Titelbild
(message #sys_info)			;Systeminformation
(welcome)                               ;Installationsmethode
;-------------- prepare paths --------------------
(if (= @user-level 0)                   ;nötig, da nur ein directory
   (makedir "SYS:Tools/T&TViewer")      ;  erzeugt wird (!)
)
;-------------- show mainmenu T&TViewer ----------
(set radio_driver                       ;Hauptmenu variable
   (askchoice
      (prompt #gfx)
      (help #help_gfx)
      (choices
        " CyberGraphX"                  ;bit  1
        " Picasso 2"                    ;bit  2
      )
      (default driver)
   )
)
;-------------- show viewer menu ----------------
(set point_main                         ;Hauptmenu variable
   (askoptions
      (prompt #choices)
      (help #help_main)
      (choices
        " ViewBMP"                      ;bit 1 
        " ViewIFF"                      ;bit 2
        " ViewPCX"                      ;bit 3
        " Intuiview.class"              ;bit 4
        " Viewer.guide"                 ;bit 5
	" tools"			;bit 6
      )
      (default 63)                      ; 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
      )
   )
)
;--------------- path for BMP viewer --------------------
(if (and (not (bitand point_bmp 0))(bitand point_main 1))
   (set destination
      (askdir
         (prompt #dest_bmp)
         (help #help_viewer)
         (default #default_bmp)
         (newpath)
      )
   )
;-------------- create default directories ---------
   (if (= destination #default_bmp) ;default path ?
      ((makedir #default_path (infos)) ;create directories
       (makedir #default_bmp (infos))) ;wegen else
   )
)
;-------------- copy "ViewBMP_pc_low.#?" -----------
(if (and (bitand point_bmp 1)(bitand point_main 1))
   (copyfiles
      (prompt #dest_bmp)
      (help #help_bmp)
      (if (= radio_driver 0)
         (source (cat #CyberGraphX #source_bmp_pc_low))
      )
      (if (= radio_driver 1)
         (source (cat #Picasso #source_bmp_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)
      (if (= radio_driver 0)
         (source (cat #CyberGraphX #source_bmp_low))
      )
      (if (= radio_driver 1)
         (source (cat #Picasso #source_bmp_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)
      (if (= radio_driver 0)
         (source (cat #CyberGraphX #source_bmp_plus))
      )
      (if (= radio_driver 1)
         (source (cat #Picasso #source_bmp_plus))
      )
      (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
      )
   )
)
;--------------- path for IFF viewer --------------------
(if (and (not (bitand point_iff 0))(bitand point_main 2))
   (set destination
      (askdir
         (prompt #dest_iff)
         (help #help_viewer)
         (default #default_iff)
         (newpath)
      )
   )
;-------------- create default directories ---------
   (if (= destination #default_iff)
      ((makedir #default_path (infos))
       (makedir #default_iff (infos)))
   )
)
;-------------- copy "ViewIFF_pc_low.#?" ------------
(if (and (bitand point_iff 1)(bitand point_main 2))
   (copyfiles
      (prompt #dest_iff)
      (help #help_iff)
      (if (= radio_driver 0)
         (source (cat #CyberGraphX #source_iff_pc_low))
      )
      (if (= radio_driver 1)
         (source (cat #Picasso #source_iff_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)
      (if (= radio_driver 0)
         (source (cat #CyberGraphX #source_iff_low))
      )
      (if (= radio_driver 1)
         (source (cat #Picasso #source_iff_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)
      (if (= radio_driver 0)
         (source (cat #CyberGraphX #source_iff_plus))
      )
      (if (= radio_driver 1)
         (source (cat #Picasso #source_iff_plus))
      )
      (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
      )
   )
)
;--------------- path for PCX viewer --------------------
(if (and (not (bitand point_pcx 0))(bitand point_main 4))
   (set destination
      (askdir
         (prompt #dest_pcx)
         (help #help_viewer)
         (default #default_pcx)
         (newpath)
      )
   )
;-------------- create default directories ---------
   (if (= destination #default_pcx)
      ((makedir #default_path (infos))
       (makedir #default_pcx (infos)))
   )
)
;-------------- copy "ViewPCX_pc_low.#?" ------------
(if (and (bitand point_pcx 1)(bitand point_main 4))
   (copyfiles
      (prompt #dest_pcx)
      (help #help_pcx)
      (if (= radio_driver 0)
         (source (cat #CyberGraphX #source_pcx_pc_low))
      )
      (if (= radio_driver 1)
         (source (cat #Picasso #source_pcx_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)
      (if (= radio_driver 0)
         (source (cat #CyberGraphX #source_pcx_low))
      )
      (if (= radio_driver 1)
         (source (cat #Picasso #source_pcx_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)
      (if (= radio_driver 0)
         (source (cat #CyberGraphX #source_pcx_plus))
      )
      (if (= radio_driver 1)
         (source (cat #Picasso #source_pcx_plus))
      )
      (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 #source_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)
      )
   )
;-------------- create directories --------------------------
   (if (= destination #default_intui)
      ((makedir #default_path (infos))
       (makedir #default_intui (infos)))
   )
)
;-------------- copy Intuiview.class ---------------
(if (bitand point_main 8)
   (copyfiles
      (source #source_intui)
      (dest destination)
      (optional "force")
   )
)
(complete 80)
;-------------- path for Viewer.guide ------------
(if (bitand point_main 16)
   (set destination
      (askdir
         (prompt #dest_guide)
         (help #help_guide)
         (default #default_path)
      )
   )
)
;-------------- copy guide --------
(if (bitand point_main 16)
  ((copyfiles
      (source #source_viewer_guide)
      (dest destination)
      (infos)
      (optional "force")
   )
(complete 90)
;-------------- copy "ViewIFF+.#?" ------------------
   (copyfiles
      (prompt #dest_iff)
      (help #help_iff)
      (if (= radio_driver 0)
         (source (cat #CyberGraphX #source_iff_plus))
      )
      (if (= radio_driver 1)
         (source (cat #Picasso #source_iff_plus))
      )
      (dest destination)
      (confirm)
      (optional "force")
   )
;-------------- copy test_pic --------
   (copyfiles
      (source #source_test_pic)
      (dest destination)
      (infos)
      (optional "force")
   ))
)
;-------------- tools ----------------
(if (bitand point_main 32)
   ((set destination
      (askdir
         (prompt #dest_tools)
         (help #help_tools)
         (default #default_tools)
         (newpath)
      )
    )
    (if (= destination #default_tools)
       ((makedir #default_path (infos))
        (makedir #default_tools (infos)))
    )
    (copyfiles
       (source #source_tools_ScrModeID)
       (dest destination)
       (infos)
       (optional "force")
    )
    (copyfiles
       (source #source_tools_Switcher)
       (dest destination)
       (infos)
       (optional "force")
    )
   )
)
;-------------- 100% complete ----------------
(set @default-dest destination) ;Pfad für logfile setzen
(complete 100)
(exit)
;-------------- installation finished -------------------
