; * $VER: Install Picture Converter 2.1
; * Script written by Eckhard Ludwig
;=============================================================================

(complete 0)

(set Opt 2)
(set #welcome
  (cat
	"\n\n\nWelcome to the Picture Converter installation utility.\n\n"
	"This program lets you install PictureConverter 2.1 on your Amiga.\n\n\n"
	"PictureConverter © 1997 Eckhard Ludwig."
  ))

(set #choose-text
  (cat "Please choose a directory where PictureConvert should be installed. A drawer will be created there."
  ))

(set #choose-help
  (cat "In this location a drawer will be created. All files will be installed inside this drawer. The complete installation will require about 1.7MB of free harddisk space."
  ))

(set #inst-main
  (cat "Installing PictureConvert ..."
  ))

(set #inst-Lokale
  (cat "Installing Lokale.exe ..."
  ))

(set #create-maindir
  (cat "Creating PicConvert directory"
  ))

(set #create-bindir
  (cat "Creating Bin dir"
  ))

(set #create-docsdir
  (cat "Creating Docs dir"
  ))

(set #inst-bin
  (cat "Installing Net PBM ..."
  ))

(set #inst-docs
  (cat "Installing program documentation ..."
  ))

(set #inst-fonts
  (cat "Installing XEN Fonts ..."
  ))

(set #Install-Prompt 
  (cat "Which of the following locale should be installed ?\nItems marked as (n/a) are not available in the current installation archive !"
  ))

(set #Locale-Copy   "Copy cataloges ...")

(set #mwb-0 "8-color MWB GUI")

(set #mwb-1 "4-color standard GUI")

(set #mwb-detected-prompt
  (cat "MagicWB 2.0 detected.\nYou can use either MWB-compatible 8-color icons "
       "or the system standard 4-color icons for the PictureConverter GUI.\n\n"
  ))

(set #mwb-detected-help
  (cat "MagicWB 2.0 was detected by the install program. You should use the MagicWB-Style "
       "GUI for PictureConverter, too. But you can also install the standard system look GUI, "
       "if you wish.\n\n".
       @askchoice-help
  ))

(set #mwb-notdetected-prompt
  (cat "MagicWB 2.0 not detected.\nThough you might be able to use the 8-color GUI "
       "(see help for details) it's more likely that you have to install the "
       "standard system look GUI instead.\n\n"
  ))

(set #mwb-notdetected-help
  (cat "MagicWB 2.0 could not be found by the install program. The 8-color GUI in this "
       "package are designed for MagicWB 2.0, but they also work with MagicWB 1.x if you "
       "use a screen with 8 colors exactly. In all other cases you will have to install "
       "the standard system look GUI.\n\n"
       @askchoice-help
  ))

 (SET #exit-Msg 
  (CAT "\n\nMuch fun with Programmes\n wish you\n\n"
                   "Eckhard Ludwig" 
  ))

; deutsche Texte *****************************

(IF (= @language "deutsch")
(
(set Opt 1)
(set #welcome
  (cat
	"\n\n\nWillkommen zu dem Picture Converter Installations Utility.\n\n"
	"Dieses Programm installiert Picture Converter 2.1 auf Ihrem Amiga.\n\n\n"
	"PictureConverter ist ©1997 by Eckhard Ludwig."
  ))

(set #choose-text
  (cat "Bitte wählen Sie das Verzeichniss wohin PictureConvert installiert werden soll. Dieses Installationsscript legt dort selbst eine Schublade an."
  ))

(set #choose-help
  (cat "Bei der Installation werden alle Dateien in dieses Verzeichniss installiert. Die vollständige Installation von PictureConvert belegt auf der Festplatte etwa 1,7MB."
  ))

(set #create-maindir
  (cat "Erstelle PicConvert-Verzeichniss"
  ))

(set #inst-main
  (cat "Installiere Hauptprogramm ..."
  ))

(set #inst-Lokale
  (cat "Installiere Lokale.exe ..."
  ))

(set #create-bindir
  (cat "Erstelle BIN-Verzeichniss"
  ))

(set #create-docsdir
  (cat "Erstelle Docs-Verzeichniss"
  ))

(set #inst-bin
  (cat "Installiere NetPBM ..."
  ))

(set #inst-docs
  (cat "Installiere Programm Dokumentation ..."
  ))

(set #inst-fonts
  (cat "Installiere XEN Fonts ..."
  ))

(set #Install-prompt 
  (cat "Bitte wählen Sie für das Programm die bevorzugte(n) Sprachversion(en).\nMit n/a gekennzeichnete Sprachen sind momentan nicht verfügbar."
  ))

(set #Locale-Copy   "Kopiere Cataloge ...")

(set #mwb-0 "8-farb MWB GUI")

(set #mwb-1 "4-farb Standard GUI")

(set #mwb-detected-prompt
  (cat "MagicWB 2.0 gefunden.\nSie können entweder MWB-kompatible 8-Farb-Icons "
       "oder die Standard System-Icons für die Grafische Benutzeroberfläche von PictureConverter 2.1 verwenden.\n\n"
  ))

(set #mwb-detected-help
  (cat "Das Installationsprogramm hat festgestellt, daß MagicWB 2.0 auf Ihrem "
       "Rechner installiert ist. Sie sollten deshalb auch für das PictureConverter GUI die Icons im MagicWB-Stil verwenden. "
       "Dazu wird eigentlich nichts weiter als das Tooltype 8COLORS gesetzt :-).\n\n"
       @askchoice-help
  ))

(set #mwb-notdetected-prompt
  (cat "MagicWB 2.0 ist nicht installiert.\nUnter bestimmten Umständen können Sie "
       "dennoch das 8-farbige GUI verwenden (siehe Hilfe). In aller Regel werden Sie "
       "aber die Standard System-Farben setzen müssen.\n\n"
  ))

(set #mwb-notdetected-help
  (cat "Das Installationsprogramm konnte MagicWB 2.0 nicht auf Ihrem System finden. "
       "Die 8-farbige Benutzeroberfläche funktioniert nur mit der MagicWB 2.0 korrekt, "
       "ausser Sie verwenden eine Workbench mit exakt 8 Farben und der MagicWB Palette. "
       "In diesem Fall können Sie ebenfalls die 8-farbige Benutzeroberfläche setzen.\n\n"
       @askchoice-help
  ))

(SET #exit-Msg
  (CAT "\n\nViel Spaß mit den Programmen\n wünscht\n\n"
                   "Eckhard Ludwig"
  ))
))
;*********************************************
; Greetings & Path ...

(message #welcome)

(welcome)

(set @default-dest (getassign "Work" "dva"))
  (if (= @default-dest "")
   (set @default-dest "SYS:"))
  
(set @default-dest (askdir
    (prompt #choose-text)
    (help #choose-help)
    (default @default-dest))
  ) 
  
(set @default-dest (tackon @default-dest "PicConvert"))

(makedir @default-dest (prompt #create-maindir)(infos))
  
;*********************************************
; Installation procedure
; 

(copyfiles
	(prompt	#inst-main)
	(help	@copyfiles-help)
	(source "PictureConvert")
	(dest	@default-dest)
        (confirm "EXPERT")
        (optional "force")
	(infos)
)

(complete 5)

(makedir (tackon @default-dest "bin")
 (prompt #create-bindir)
)

(copyfiles
	(prompt	#inst-bin)
	(help	@copyfiles-help)
	(source "bin")
	(dest	(tackon @default-dest "bin"))
   	(pattern "#?")
   	(optional "force")
   	(confirm "EXPERT")
   	(files)
)

(complete 50)

(makedir (tackon @default-dest "Docs")
 (prompt #create-docsdir)
 (infos)
)

(copyfiles
	(prompt	#inst-docs)
	(help	@copyfiles-help)
	(source "Docs")
	(dest	(tackon @default-dest "Docs"))
   	(pattern "#?")
   	(optional "force")
   	(confirm "EXPERT")
   	(files)
	(infos)
)

(complete 70)

(copyfiles
	(prompt	#inst-fonts)
	(help	@copyfiles-help)
	(source "Fonts")
	(dest	"SYS:Fonts")
   	(pattern "#?")
   	(optional "force")
   	(confirm "EXPERT")
   	(files)
)
(copyfiles
	(prompt	#inst-fonts)
	(help	@copyfiles-help)
	(source "Fonts/XEN")
	(dest	"SYS:Fonts/XEN")
   	(pattern "#?")
   	(optional "force")
   	(confirm "EXPERT")
   	(files)
)
(complete 80)

;*********************************************
; copy the locales

(IF (= @language "All")
    (set Opt 511))

(set installchoice
   (askoptions
   (prompt #Install-Prompt)
   (help @askoptions-help)
   (choices "Deutsch" "English" "dansk n/a" "français n/a" "italiano" "nederlands" "norsk n/a" "suomi n/a" "svenska n/a")
   (default Opt)
))

(IF (BITAND installchoice 2)
  (copyfiles
   (prompt #Locale-Copy)
   (help @copyfiles-help)
   (source "Locale/Catalogs/english")
   (dest "SYS:Locale/Catalogs/english")
   (pattern "#?.catalog")
   (confirm "EXPERT")
   (optional "force" "nofail")
  ))

(IF (BITAND installchoice 4)
  (copyfiles
   (prompt #Locale-Copy)
   (help @copyfiles-help)
   (source "Locale/Catalogs/dansk")
   (dest "SYS:Locale/Catalogs/dansk")
   (pattern "#?.catalog")
   (confirm "EXPERT")
   (optional "force" "nofail")
  ))

(IF (BITAND installchoice 8)
  (copyfiles
   (prompt #Locale-Copy)
   (help @copyfiles-help)
   (source "Locale/Catalogs/français")
   (dest "SYS:Locale/Catalogs/français")
   (pattern "#?.catalog")
   (confirm "EXPERT")
   (optional "force" "nofail")
  ))

(IF (BITAND installchoice 16)
  (copyfiles
   (prompt #Locale-Copy)
   (help @copyfiles-help)
   (source "Locale/Catalogs/italiano")
   (dest "SYS:Locale/Catalogs/italiano")
   (pattern "#?.catalog")
   (confirm "EXPERT")
   (optional "force" "nofail")
  ))

(IF (BITAND installchoice 32)
  (copyfiles
   (prompt #Locale-Copy)
   (help @copyfiles-help)
   (source "Locale/Catalogs/nederlands")
   (dest "SYS:Locale/Catalogs/nederlands")
   (pattern "#?.catalog")
   (confirm "EXPERT")
   (optional "force" "nofail")
  ))

(IF (BITAND installchoice 64)
  (copyfiles
   (prompt #Locale-Copy)
   (help @copyfiles-help)
   (source "Locale/Catalogs/norsk")
   (dest "SYS:Locale/Catalogs/norsk")
   (pattern "#?.catalog")
   (confirm "EXPERT")
   (optional "force" "nofail")
  ))

(IF (BITAND installchoice 128)
  (copyfiles
   (prompt #Locale-Copy)
   (help @copyfiles-help)
   (source "Locale/Catalogs/suomi")
   (dest "SYS:Locale/Catalogs/suomi")
   (pattern "#?.catalog")
   (confirm "EXPERT")
   (optional "force" "nofail")
  ))

(IF (BITAND installchoice 256)
  (copyfiles
   (prompt #Locale-Copy)
   (help @copyfiles-help)
   (source "Locale/Catalogs/svenska")
   (dest "SYS:Locale/Catalogs/svenska")
   (pattern "#?.catalog")
   (confirm "EXPERT")
   (optional "force" "nofail")
  ))

(complete 80)

(IF (> installchoice 1)
    (copyfiles
	(prompt	#inst-lokale)
	(help	@copyfiles-help)
	(source "Lokale.exe")
	(dest	@default-dest)
        (confirm "EXPERT")
        (optional "force")
))

(complete 90)

;*********************************************
; Set Loadpath SYS: (Tooltype), falls Work: not exists 

(set @Loadpath (getassign "Work" "dva"))
  (if (= @Loadpath "")
    (tooltype
	(prompt "Set Tooltype")
	(help @askchoice-help)
	(dest (tackon @default-dest "PictureConvert"))
        (confirm "EXPERT")
        (optional "force")
	(settooltype "LOADDIR" "SYS:")
  ))

(complete 95)

;*********************************************
; Set 8 Colors (Tooltype)

(Set magicwb
    (run "ismagicwb")
)

(if (= 5 magicwb)
    (
    (set UseStdGUI (askchoice (prompt #mwb-detected-prompt)
                                (help #mwb-detected-help)
                                (choices #mwb-0 #mwb-1)
                                (default 0)
    )))
    (
    (set UseStdGUI (askchoice (prompt #mwb-notdetected-prompt)
                                (help #mwb-notdetected-help)
                                (choices #mwb-0 #mwb-1)
                                (default 1)
    ))))

 (If (= UseStdGUI 0)
    (tooltype
	(prompt "Set Tooltype")
	(help #mwb-detected-help)
	(dest (tackon @default-dest "PictureConvert"))
        (confirm "EXPERT")
        (optional "force")
	(settooltype "8COLORS" "")
  ))

(complete 100)


(EXIT #exit-Msg )
