; Install PhotoFolio
; $VER: Install-PhotoFolio V2.0 (22.1.2000)
; © 2000 Steeple Software

(set #catalog 0) ; english language is default

; Find the current language
(set #i 0)
(while (set #thisfile (select #i
		"english" "italiano" "deutsch" "espańol" "czech" "catalŕ" "dansk" "français"
		"hrvatski" "nederlands" "norsk" "polski" "portuguęs"
		"russian" "srpski" "suomi" "svenska" "ĂeÓtina"
		""))
	(
		(if (= @language #thisfile)
			(
				(set #catalog #i)
				(set #catalogname #thisfile)
			)
		)
		(set #i (+ #i 1))
	)
)

; Query user for their language, using system as default
(set #catalog
	(askchoice
		(prompt "Select your native language (language for installer)")
		(help @askoptions-help)
		(choices "English" "Italiano" "Deutsch" "Espańol" "Czech")
		(default #catalog)
	)
)

; Reset #catalogname as the user may have changed the language above
(if (< #catalog 5)
	(
		(set #catalogname (select #catalog "english" "italiano" "deutsch" "espańol" "czech"))
	)
)

; Some string defaults common for all languages
(set #HOMEPAGE "http://mafeking.scouts.org.au/photofolio")
(set #BLANK "\n")


; ************************** English texts ******************************
(set #INITIAL_MESSAGE
  (cat "\nWelcome to the PhotoFolio installer\n\n\n"
	"The authors, Steve Quartly and Paul Huxham\n"
	"would like to thank you\n"
	"for choosing and using PhotoFolio\n\n\n"
	"You can obtain updates, mailing list and other information\nabout PhotoFolio at the PhotoFolio homepage\n"
	#HOMEPAGE)
)
(set #WRONG_INSTALLER_VERSION "\n\n\n\nYou need at least version 42.9 of Installer\nto install PhotoFolio")
(set #WRONG_CPU "\n\n\n\nYou need a 68020 CPU or better\nto run PhotoFolio")
(set #WRONG_OS_VERSION "\n\n\n\nYou need at least AmigaOS V3.0\nto run PhotoFolio")
(set #PROMPT_INSTALL_MUI "\nMUI installation is required to use PhotoFolio.\n\nDo you want to run the MUI installer now?")
(set #REBOOT_REQUIRED "\n\n\n\nA reboot is required after a MUI installation")
(set #INSTALL_CANCELLED "\n\n\n\nInstallation of PhotoFolio has been cancelled")
(set #INSTALLING_LIBRARIES "\nInstalling PhotoFolio library")
(set #INSTALLING_MCC "\nInstalling MUI custom class")
(set #SELECT_INSTALL_DIRECTORY "Select a directory to install PhotoFolio into.\n(If you want PhotoFolio in its own directory - create one now)")
(set #CHECKING_SYSTEM "\n\n\n\nChecking system...")
(set #PROMPT_INSTALL_IMAGEIOPREFS "\nInstall imageio.library prefs?\n\n(Used to alter the loading formats and\nother parameters of image loading)")
(set #INSTALLING_IMAGEIOPREFS "\nInstalling imageio.library prefs")
(set #INSTALL_MYSTICVIEW "\nInstall mysticview.library?\n\n(Optional library used as an alternate image viewer)")
(set #INSTALLING_PROGRAM "\n\n\n\nInstalling PhotoFolio program")
(set #PROMPT_INSTALL_DOCS "\nInstall PhotoFolio documentation?")
(set #INSTALLING_DOCS "\nInstalling PhotoFolio documentation")
(set #PROMPT_INSTALL_CATALOG "\nWhich language catalogs would you like to install?")
(set #INSTALLING_CATALOG "\nInstalling PhotoFolio catalog")
(set #PROMPT_INSTALL_VLABGRAB "\nInstall vlab.mcc?\n\n(Optional MUI custom class for grabbing images\nfrom VLab directly into PhotoFolio)")
(set #INSTALLING_VLABGRAB "\nInstalling vlab.mcc")
(set #PROMPT_INSTALL_OPENURL "\nInstall openurl.library?\n\n(Optional browser support library)")
(set #PROMPT_INSTALL_OPENURLPREFS "\nInstall OpenURL preferences?")
(set #PROMPT_INSTALL_AREXX "\nInstall ARexx scripts?\n\n(Optional ARexx scripts for use in PhotoFolio)")
(set #INSTALLING_AREXX "\nInstalling ARexx scripts")
(set #UPDATES_AVAILABLE "\nUpdates of PhotoFolio and its required libraries\n\nare available from the PhotoFolio home page")
(set #YES "Yes")
(set #NO "No")

; ************************** Italiano texts *****************************
(if (= #catalog 1)
(
(set #INITIAL_MESSAGE
  (cat "\nBenvenuto nell'installazione di PhotoFolio\n\n\n"
     "Gli autori, Steve Quartly e Paul Huxham\n"
     "desiderano ringrazziarti per aver\n"
     "scelto e deciso di usare PhotoFolio\n\n\n"
     "Puoi ottenere gli aggiornamenti, la mailing list e altre informazioni\nsu PhotoFolio alla homepage di PhotoFolio.\n"
     #HOMEPAGE)
)
(set #WRONG_INSTALLER_VERSION "\n\n\n\nNecessiti almeno della versione 42.9 dell'Installer\nper installare PhotoFolio")
(set #WRONG_CPU "\n\n\n\nNecessiti di una CPU 68020 o superiore\nper usare PhotoFolio")
(set #WRONG_OS_VERSION "\n\n\n\nNecessiti almeno di AmigaOS V3.0\nper usare PhotoFolio")
(set #PROMPT_INSTALL_MUI "\nL'installazione MUI č richiesta per usare PhotoFolio.\n\nVuoi lanciare l'installazione MUI adesso?")
(set #REBOOT_REQUIRED "\n\n\n\nČ necessario un riavviamento dopo l'installazione MUI")
(set #INSTALL_CANCELLED "\n\n\n\nL'installazione di PhotoFolio č stata annullata")
(set #INSTALLING_LIBRARIES "\nInstallazione PhotoFolio library in corso")
(set #INSTALLING_MCC "\nInstallazione classi MUI in corso")
(set #SELECT_INSTALL_DIRECTORY "Seleziona una directory nella quale installare PhotoFolio.\n(Se vuoi PhotoFolio in una sua specifica directory - creane una adesso)")
(set #CHECKING_SYSTEM "\n\n\n\nSto controllando il sistema...")
(set #PROMPT_INSTALL_IMAGEIOPREFS "\nInstallare preferenze per l'imageio.library?\n\n(Usata per alterare i formati di caricamento e\naltri paramentri del caricamento delle immagini)")
(set #INSTALLING_IMAGEIOPREFS "\nInstallazione preferenze imageio.library in corso")
(set #INSTALL_MYSTICVIEW "\nInstalla mysticview.library?\n\n(Libreria opzionale usata come visualizzatore immagini alternativo)")
(set #INSTALLING_PROGRAM "\n\n\n\nInstallazione programma PhotoFolio in corso")
(set #PROMPT_INSTALL_DOCS "\nInstalla documentazione PhotoFolio?")
(set #INSTALLING_DOCS "\nInstallazione documentazione PhotoFolio in corso")
(set #PROMPT_INSTALL_CATALOG "\nQuale catalogo della lingua desideri installare?")
(set #INSTALLING_CATALOG "\nInstallazione catalogo PhotoFolio")
(set #PROMPT_INSTALL_VLABGRAB "\nInstalla vlab.mcc?\n\n(Classe MUI esterna e opzionale per acquisire le immagini\nda VLab direttamente in PhotoFolio)")
(set #INSTALLING_VLABGRAB "\nInstallazione vlab.mcc in corso")
(set #PROMPT_INSTALL_OPENURL "\nInstalla openurl.library?\n\n(Libreria opzionale di supporto ai browser WWW)")
(set #PROMPT_INSTALL_OPENURLPREFS "\nInstallare preferenze OpenURL?")
(set #PROMPT_INSTALL_AREXX "\nInstallare gli script ARexx?\n\n(Script ARexxx opzionali da usare in PhotoFolio)")
(set #INSTALLING_AREXX "\nInstallazione script ARexx in corso")
(set #UPDATES_AVAILABLE "\nAggiornamenti di PhotoFolio e le librarie richieste\n\nsono disponibili sulla home page di PhotoFolio")
(set #YES "Sě")
(set #NO "No")
)
)

; ************************** Deutsch texts ******************************
(if (= #catalog 2)
(
(set #INITIAL_MESSAGE
  (cat "\nWillkommen zur Installation von PhotoFolio\n\n\n"
    "Die Autoren, Steve Quartly und Paul Huxham\n"
    "möchten Ihnen danken, dass\n"
    "Sie sich für PhotoFolio entschieden haben\n\n\n"
    "Updates, eine Mailingliste und weitere Information\nüber PhotoFolio gibt es auf der PhotoFolio Homepage\n"
    #HOMEPAGE)
)
(set #WRONG_INSTALLER_VERSION "\n\n\n\nSie benötigen mind. Version 42.9 des Installers\num PhotoFolio zu installieren")
(set #WRONG_CPU "\n\n\n\nSie benötigen einen 68020 oder höher\num PhotoFolio ausführen zu können")
(set #WRONG_OS_VERSION "\n\n\n\nSie benötigen mind. AmigaOS V3.0\num PhotoFolio ausführen zu können")
(set #PROMPT_INSTALL_MUI "\nPhotoFolio benötigt ein installiertes MUI.\n\nWollen Sie MUI jetzt installieren?")
(set #REBOOT_REQUIRED "\n\n\n\nNach der Installation von MUI müssen Sie Ihren Amiga neu starten")
(set #INSTALL_CANCELLED "\n\n\n\nDie Installation von PhotoFolio wurde abgebrochen")
(set #INSTALLING_LIBRARIES "\nPhotoFolio Library wird installiert")
(set #INSTALLING_MCC "\nMUI Custom Class wird installiert")
(set #SELECT_INSTALL_DIRECTORY "Wählen Sie ein Verzeichnis in das Sie PhotoFolio installieren wollen.\n(Falls Sie PhotoFolio in ein eigenes Verzeichnis installieren wollen müssen Sie es jetzt erstellen)")
(set #CHECKING_SYSTEM "\n\n\n\nÜberprüfe System...")
(set #PROMPT_INSTALL_IMAGEIOPREFS "\nImageio.library Prefs installieren?\n\n(Zum Ändern des Ladeformats und\nanderer Parameter des Ladens von Bildern)")
(set #INSTALLING_IMAGEIOPREFS "\nImageio.library Prefs wird installiert")
(set #INSTALL_MYSTICVIEW "\nMysticview.library installieren?\n\n(Optionale Library zur Anzeige von Bildern)")
(set #INSTALLING_PROGRAM "\n\n\n\nPhotoFolio Programm wird installiert")
(set #PROMPT_INSTALL_DOCS "\nPhotoFolio Dokumentation installieren?")
(set #INSTALLING_DOCS "\nPhotoFolio Dokumentation wird installiert")
(set #PROMPT_INSTALL_CATALOG "\nWelche Sprachen wollen Sie installieren?")
(set #INSTALLING_CATALOG "\nPhotoFolio Sprachdatei wird installiert")
(set #PROMPT_INSTALL_VLABGRAB "\nVlab.mcc installieren?\n\n(Optionale MUI Klasse zur Übertragung von Bildern\nüber eine VLab direkt in PhotoFolio)")
(set #INSTALLING_VLABGRAB "\nInstalling vlab.mcc")
(set #PROMPT_INSTALL_OPENURL "\nOpenurl.library installieren?\n\n(Optionale Library zur Unterstützung von Internet-Software)")
(set #PROMPT_INSTALL_OPENURLPREFS "\nInstall OpenURL preferences?")
(set #PROMPT_INSTALL_AREXX "\nARexx Skripte installieren?\n\n(Optionale ARexx Skripte für PhotoFolio)")
(set #INSTALLING_AREXX "\nARexx Skripte werden installiert")
(set #UPDATES_AVAILABLE "\nUpdates für PhotoFolio und den dazugehörigen libraries\n\ngibt es auf der PhotoFolio Homepage")
(set #YES "Ja")
(set #NO "Nein")
)
)

; ************************** Espańol texts ******************************
(if (= #catalog 3)
(
(set #INITIAL_MESSAGE
  (cat "\nBienvenido a la instalación de PhotoFolio\n\n\n"
	"Los autores, Steve Quartly y Paul Huxham\n"
	"te dan las gracias\n"
	"por elegir y utilizar PhotoFolio\n\n\n"
	"Podrás obtener actualizaciones, acceder a listas de correo y tener más información\nsobre PhotoFolio en la página web de PhotoFolio\n"
	#HOMEPAGE)
)
(set #WRONG_INSTALLER_VERSION "\n\n\n\nNecesitas al menos la versión 42.9 del Installer\npara instalar PhotoFolio")
(set #WRONG_CPU "\n\n\n\nNecesitas un 68020 o superior\npara utilizar PhotoFolio")
(set #WRONG_OS_VERSION "\n\n\n\nNecesitas al menos AmigaOS V3.0\npara utilizar PhotoFolio")
(set #PROMPT_INSTALL_MUI "\nLa instalación de MUI es necesaria para utilizar PhotoFolio.\n\nżQuieres ejecutar el instalador de MUI ahora?")
(set #REBOOT_REQUIRED "\n\n\n\nDebes resetear después de instalar MUI")
(set #INSTALL_CANCELLED "\n\n\n\nLa Instalación de PhotoFolio ha sido cancelada")
(set #INSTALLING_LIBRARIES "\nInstalando librerías de PhotoFolio")
(set #INSTALLING_MCC "\nInstalando MUI custom class")
(set #SELECT_INSTALL_DIRECTORY "Elige el directorio donde quieres instalar PhotoFolio.\n(Si quieres que PhotoFolio tenga su propio cajón - debes crear uno ahora)")
(set #CHECKING_SYSTEM "\n\n\n\nChequeando el sistema...")
(set #PROMPT_INSTALL_IMAGEIOPREFS "\nżInstalo imageio.library prefs?\n\n(Utilizada para los diferentes formatos y\notros parámetros de carga de imágenes)")
(set #INSTALLING_IMAGEIOPREFS "\nInstalando preferencias de imageio.library")
(set #INSTALL_MYSTICVIEW "\nżInstalo mysticview.library?\n\n(Librería opcional para utilizar un visor alternativo)")
(set #INSTALLING_PROGRAM "\n\n\n\nInstalando el programa PhotoFolio")
(set #PROMPT_INSTALL_DOCS "\nżInstalo la documentación de PhotoFolio?")
(set #INSTALLING_DOCS "\nInstalando la documentación de PhotoFolio")
(set #PROMPT_INSTALL_CATALOG "\nżQué catalogos (lenguajes) quieres instalar?")
(set #INSTALLING_CATALOG "\nInstalando catálogo de PhotoFolio")
(set #PROMPT_INSTALL_VLABGRAB "\nżInstalo vlab.mcc?\n\n(Custom class opcional de MUI para capturar imágenes\ncon PhotoFolio desde tarjetas VLab)")
(set #INSTALLING_VLABGRAB "\nInstalando vlab.mcc")
(set #PROMPT_INSTALL_OPENURL "\nżInstalo openurl.library?\n\n(Librería opcional con soporte para navegador)")
(set #PROMPT_INSTALL_OPENURLPREFS "\nżInstalo las preferencias de OpenURL?")
(set #PROMPT_INSTALL_AREXX "\nżInstalo los scripts ARexx?\n\n(Scripts ARexx opcionales para PhotoFolio)")
(set #INSTALLING_AREXX "\nInstalando scripts ARexx")
(set #UPDATES_AVAILABLE "\nLas actualizaciones de PhotoFolio y librerías necesarias\n\nestán disponibles en la página web de PhotoFolio")
(set #YES "Sí")
(set #NO "No")
)
)

; ************************** Czech texts ******************************
(if (= #catalog 4)
(
(set #INITIAL_MESSAGE
  (cat "\nVítejte pęi instalaci programu PhotoFolio!\n\n\n"
	"Autoęi programu, Steve Quartly and Paul Huxham,\n"
	"by vám rádi podëkovali za jeho pouůívání"
	"Dalîí informace, kontakt na ostatní uůivatele a aktualizace\nműůete zdarma získat staůením z domovské stránky\n"
	#HOMEPAGE)
)
(set #WRONG_INSTALLER_VERSION "\n\n\n\nK instalaci programu Photofolio\npotęebujete Installer V42.9 nebo vyîîí")
(set #WRONG_CPU "\n\n\n\nKe spuîtëní programu Photofolio\npotęebujete alespoń CPU68020 nebo lepîí")
(set #WRONG_OS_VERSION "\n\n\n\nProgram Photofolio vyůaduje\nke spuîtëní AmigaOS V3.0")
(set #PROMPT_INSTALL_MUI "\n\n\n\nProgram Photofolio vyůaduje\nke spuîtëní uůivatelské rozhraní MUI.\n\nChcete provést instalaci MUI ihned?")
(set #REBOOT_REQUIRED "\n\n\n\nPo instalaci MUI je vyůadován restart")
(set #INSTALL_CANCELLED "\n\n\n\nInstalace programu PhotoFolio byla pęeruîena")
(set #INSTALLING_LIBRARIES "\nInstalace knihoven programu PhotoFolio")
(set #INSTALLING_MCC "\nInstalace vlastních tęíd MUI")
(set #SELECT_INSTALL_DIRECTORY "Vyberte adresáę, do kterého chcete nainstalovat Photofolio.\n(adresáę NEBUDE vytvoęen, pęípadný nový si vytvoęte sami)")
(set #CHECKING_SYSTEM "\n\n\n\nZjiîďování informací o systému...")
(set #PROMPT_INSTALL_IMAGEIOPREFS "\nInstall imageio.library prefs?\n\n(Used to alter the loading formats and\nother parameters of image loading)")
(set #INSTALLING_IMAGEIOPREFS "\nInstalace nastavení knihovny imageio.library")
(set #INSTALL_MYSTICVIEW "\nChcete nainstalovat knihovnu mysticview.library?\n\n(volitelná knihovna, kterou lze pouůít jako\nalternativní prohlíůeç)")
(set #INSTALLING_PROGRAM "\n\n\n\nInstalace programu PhotoFolio")
(set #PROMPT_INSTALL_DOCS "\n\n\n\nChcete nainstalovat dokumentaci?\n\n(Amigaguide)")
(set #INSTALLING_DOCS "\n\n\n\nInstalace dokumentace programu PhotoFolio")
(set #PROMPT_INSTALL_CATALOG "\nKterý z pęekladű chcete nainstalovat?")
(set #INSTALLING_CATALOG "\nInstalace pęekladu programu PhotoFolio")
(set #PROMPT_INSTALL_VLABGRAB "\nChcete nainstalovat vlab.mcc?\n\n(volitelná vlastní tęída MUI ke snímání obrázkű\nz karty VLab pęímo do programu PhotoFolio)")
(set #INSTALLING_VLABGRAB "\nInstalace tęídy vlab.mcc")
(set #PROMPT_INSTALL_OPENURL "\nChcete nainstalovat openurl.library?\n\n(volitelná knihovna pro podporu prohlíůeçű WWW)")
(set #PROMPT_INSTALL_OPENURLPREFS "\nChcete nainstalovat nastavení pro OpenURL?")
(set #PROMPT_INSTALL_AREXX "\nChcete nainstalovat arexxové skripty?\n\n(arexxové skripty pro program PhotoFolio)")
(set #INSTALLING_AREXX "\nInstalace arexxových skriptű")
(set #UPDATES_AVAILABLE "\n\nAktualizace programu PhotoFolio a pęísluîných\n\nknihoven jsou dostupné z domovské stránky")
(set #YES "Ano")
(set #NO "Ne")
)
)


; ************************* Global procedures ***************************
(procedure P_copylib lib destpath newlibname
	(
		(copylib
			(prompt (cat (cat #INSTALLING_LIBRARIES " ") (fileonly newlibname)))
			(help @copylib-help)
			(newname newlibname)
			(source lib)
			(dest destpath)
			(confirm expert)
		)
	)
)

(procedure P_copymcc mcc destpath
	(
		(copylib
			(prompt (cat (cat #INSTALLING_MCC " ") (fileonly mcc)))
			(help @copylib-help)
			(source mcc)
			(dest destpath)
			(confirm expert)
		)
	)
)


; *********************** PhotoFolio install

(if (< @installer-version (+ (* 65536 42) 9))
	(abort #WRONG_INSTALLER_VERSION)
)

(if (< (database "cpu") 68020 )
	(abort #WRONG_CPU)
)

(set os_version (/ (getversion "exec.library" (resident)) 65536))
(if (< os_version 39)
	(abort #WRONG_OS_VERSION)
)

; *********************** Install MUI ?
(set muiinstall_required 0)
(if (= (exists "MUI:" (noreq)) 0)
	(
		(set muiinstall_required 1)
	)
	(
		(set mui_version (getversion "MUI:Libs/muimaster.library" ))
		(if (< mui_version 1245219)
			(
				(set muiinstall_required 1)
			)
		)
	)
)

(if (= muiinstall_required 1)
	(
		(if (=
			(askchoice
				(help @askchoice-help)
				(prompt #PROMPT_INSTALL_MUI)
				(choices #YES #NO)
				(default 0)
			)	0 )
			(
				(textfile
					(help @textfile-help)
					(dest "t:PF-InstallMUI")
					(append "CD PhotoFolio_2.0:MUI\n")
					(append "Installer433 SCRIPT Install-MUI APPNAME MUI MINUSER NOVICE DEFUSER AVERAGE LOGFILE t:install.log")
					(safe)
				)

				(execute "t:PF-InstallMUI" (safe))
				(abort #REBOOT_REQUIRED)
			)
			(
				(abort #INSTALL_CANCELLED)
			)
		)
	)
)

; All essential version numbers are correct, continue installation
(message #INITIAL_MESSAGE)


; *********************** Set destination directory

; Set destination directory for install
(set destination
	(askdir
		(prompt #SELECT_INSTALL_DIRECTORY)
		(help @askdir-help)
		(default @default-dest)
	)
)

(set @default-dest destination)

(complete 0)


; *********************** Sort out what the user has where

(working #CHECKING_SYSTEM)

; Establish default MUI install location
(if (= (exists "MUI:Libs/mui") 0)
	(
		(set #muipath (tackon destination "mui"))
		(makedir #muipath)
	)
	(
		(set #muipath "MUI:Libs/mui")
	)
)

; Establish CPU type

(set #i 0)
(while (set #thiscpu (select #i "68020" "68030" "68040" "68060" ""))
	(
		(if (= (database "cpu") #thiscpu) (set #ourcpu #i))
		(set #i (+ #i 1))
	)
)

(complete 8)


; *********************** Install nlist.mcc

(working (cat #INSTALLING_MCC " nlist"))

(set #i 0)
(while (set #thismcc (select #i "Support/MCC_NList/Libs/MUI/NFloattext.mcc" "Support/MCC_NList/Libs/MUI/NList.mcc" "Support/MCC_NList/Libs/MUI/NListview.mcc" "Support/MCC_NList/Libs/MUI/NListviews.mcp" ""))
	(
		(if (<> #thismcc "")
			(P_copymcc #thismcc #muipath)
		)
		(set #i (+ #i 1))
	)
)

(complete 16)


; *********************** Install listtree.mcc

(working (cat #INSTALLING_MCC " listtree"))

(set #i 0)
(while (set #thismcc (select #i "Support/MCC_Listtree/Libs/MUI/Listtree.mcc" "Support/MCC_Listtree/Libs/MUI/Listtree.mcp" ""))
	(
		(if (<> #thismcc "")
			(P_copymcc #thismcc #muipath)
		)
		(set #i (+ #i 1))
	)
)

(complete 24)


; *********************** Install guigfx.library

(P_copylib (select #ourcpu "Support/guigfx.library/libs/guigfx.library" "Support/guigfx.library/libs/guigfx.library" "Support/guigfx.library/libs/guigfx.library_68040" "Support/guigfx.library/libs/guigfx.library_68060") "LIBS:" "guigfx.library")

(complete 32)


; *********************** Install render.library

(P_copylib (select #ourcpu "Support/render.library/libs/render.library" "Support/render.library/libs/render.library" "Support/render.library/libs/render.library_68040" "Support/render.library/libs/render.library_68060") "LIBS:" "render.library")

(complete 40)


; *********************** Install imageio.library

(P_copylib (select #ourcpu "Support/imageio.library/libs/imageio.library_020" "Support/imageio.library/libs/imageio.library_020" "Support/imageio.library/libs/imageio.library_040" "Support/imageio.library/libs/imageio.library_060") "LIBS:" "imageio.library")

; Set up prefs in envarc
(if (not (exists "ENVARC:imageio.library"))
	(makedir "ENVARC:imageio.library")
)

(textfile
	(help @textfile-help)
	(dest "ENVARC:imageio.library/AllowUUDecoding")
	(append "0\n")
)

; Set up prefs in env
(if (not (exists "ENV:imageio.library"))
	(makedir "ENV:imageio.library")
)

(textfile
	(help @textfile-help)
	(dest "ENV:imageio.library/AllowUUDecoding")
	(append "0\n")
)

(if (=
	(askchoice
		(help @askchoice-help)
		(prompt #PROMPT_INSTALL_IMAGEIOPREFS)
		(choices #YES #NO)
		(default 0)
	)	0 )
	(
		(copyfiles
			(prompt #INSTALLING_IMAGEIOPREFS)
			(source "Support/imageio.library/prefs")
			(choices "ImageIOLibraryPrefs" "ImageIOLibraryPrefs.info" )
	    (help @copyfiles-help)
			(dest @default-dest)
			(files)
			(noposition)
			(optional askuser)
			(confirm expert)
		)
	)
)

(complete 48)


; *********************** Install jpeg.library

(P_copylib (select #ourcpu "Support/jpeg.library/libs/jpeg.library_020" "Support/jpeg.library/libs/jpeg.library_020" "Support/jpeg.library/libs/jpeg.library_040" "Support/jpeg.library/libs/jpeg.library_060") "LIBS:" "jpeg.library")

(complete 56)


; *********************** Install proof.library

(P_copylib (select #ourcpu "Support/proof.library/libs/proof.library_020" "Support/proof.library/libs/proof.library_020" "Support/proof.library/libs/proof.library_040" "Support/proof.library/libs/proof.library_060") "LIBS:" "proof.library")

; Set up prefs in envarc
(if (not (exists "ENVARC:proof.library"))
	(makedir "ENVARC:proof.library")
)

(textfile
	(help @textfile-help)
	(dest "ENVARC:proof.library/Test_Proof_By_Protection")
	(append "no\n")
)

; Set up prefs in env
(if (not (exists "ENV:proof.library"))
	(makedir "ENV:proof.library")
)

(textfile
	(help @textfile-help)
	(dest "ENV:proof.library/Test_Proof_By_Protection")
	(append "no\n")
)

(complete 64)


; *********************** Install mysticview.library

(if (=
	(askchoice
		(help @askchoice-help)
		(prompt #INSTALL_MYSTICVIEW)
		(choices #YES #NO)
		(default 0)
	)	0 )
	(
		(P_copylib (select #ourcpu "Support/mysticview.library/libs/mysticview.library" "Support/mysticview.library/libs/mysticview.library" "Support/mysticview.library/libs/mysticview.library" "Support/mysticview.library/libs/mysticview.library_68060") "LIBS:" "mysticview.library")
	)
)

(complete 72)


; *********************** Install vlab.mcc

(set vlab_version (/ (getversion "vlab.library") 65536))

(if (<> vlab_version 0)
	(
		(if (=
			(askchoice
				(help @askchoice-help)
				(prompt #PROMPT_INSTALL_VLABGRAB)
				(choices #YES #NO)
				(default 0)
			)	0 )
			(
				(copyfiles
					(prompt #INSTALLING_VLABGRAB)
					(source "Support/MCC_Vlab/libs/mui")
					(choices "VLab.mcc" "VLab.mcp")
			    (help @copyfiles-help)
					(dest #muipath)
					(files)
					(optional askuser)
					(confirm expert)
				)
			)
		)
	)
)

(complete 80)


; *********************** Install openurl.library

(if (=
	(askchoice
		(help @askchoice-help)
		(prompt #PROMPT_INSTALL_OPENURL)
		(choices #YES #NO)
		(default 0)
	)	0 )
	(
		(P_copylib "Support/OpenURL/Libs/openurl.library" "LIBS:" "openurl.library")
		(P_copylib "Support/OpenURL/L/OpenURL-handler" "L:" "OpenURL-Handler")

		(working (cat #INSTALLING_MCC " required for openurl.library"))

		(set #i 0)
		(while (set #thismcc (select #i "Support/OpenURL/Libs/MUI/Popplaceholder.mcc" "Support/OpenURL/Libs/MUI/Popport.mcc" ""))
			(
				(if (<> #thismcc "")
					(P_copymcc #thismcc #muipath)
				)
				(set #i (+ #i 1))
			)
		)

		(copyfiles
			(prompt #PROMPT_INSTALL_OPENURLPREFS)
			(source "Support/OpenURL/Prefs")
			(choices "OpenURL" "OpenURL.info" )
 		  (help @copyfiles-help)
			(dest @default-dest)
			(files)
			(noposition)
			(optional askuser)
			(confirm expert)
		)
	)
)

(complete 85)


; *********************** Install main program and icon

; Install executable and icon
(copyfiles
	(prompt #INSTALLING_PROGRAM)
	(source "")
	(choices "PhotoFolio" "PhotoFolio.info")
	(help @copyfiles-help)
	(dest @default-dest)
	(files)
	(noposition)
	(optional askuser)
)


; *********************** Install documentation

(if (=
	(askchoice
		(help @askchoice-help)
		(prompt #PROMPT_INSTALL_DOCS)
		(choices #YES #NO)
		(default 0)
	)	0 )
	(
		(set #doclangfound -1) ; Flags if the docs were found in their language

		(set #i 0)
		(while (set #thiscat (select #i "English" "-" "Deutsch" "Espańol" "-" ""))
			(
				(if (= #i #catalog)
					(
						(if (<> #thiscat "-")
							(
								(set #doclangfound #catalog)
							)
						)
					)
				)
				(set #i (+ #i 1))
			)
		)

		(if (<> #doclangfound -1)
			(
				(set #docs (tackon "Documentation" (select #catalog "English" "Italiano" "Deutsch" "Espańol")))
				(copyfiles
					(prompt #INSTALLING_DOCS)
					(choices "PhotoFolio.guide" "PhotoFolio.guide.info")
					(source #docs)
			    (help @copyfiles-help)
					(dest @default-dest)
					(files)
					(noposition)
					(optional askuser)
					(confirm expert)
				)
			)
			(
				; Havent got their language, install English instead
				(copyfiles
					(prompt #INSTALLING_DOCS)
					(choices "PhotoFolio.guide" "PhotoFolio.guide.info")
					(source "Documentation/English")
			    (help @copyfiles-help)
					(dest @default-dest)
					(files)
					(noposition)
					(optional askuser)
					(confirm expert)
				)
			)
		)

		; Install ARexx documentation
		(copyfiles
			(prompt #INSTALLING_DOCS)
			(choices "PhotoFolio_ARexx.guide" "PhotoFolio_ARexx.guide.info")
			(source "Documentation/English")
	    (help @copyfiles-help)
			(dest @default-dest)
			(files)
			(noposition)
			(optional askuser)
			(confirm expert)
		)
	)
)

(complete 90)


; *********************** Install locale catalog


(set #localedest "LOCALE:Catalogs")

(if (<> #catalog 0)
	(
		(set #localesrc 1) ; Defaults to first entry
		(set #i 0)
		(while (set #thiscat (select #i "italiano" "deutsch" "espańol" "czech" ""))
			(
				(if (= #catalogname #thiscat)
					(
						(set #x #i)
						(while (> #x 0)
							(set #localesrc (* #localesrc 2))

							(set #x (- #x 1))
						)
					)
				)

				(set #i (+ #i 1))
			)
		)
	)
	(
		(set #localesrc 0)
	)
)

(set #installcat
	(askoptions
		(prompt #PROMPT_INSTALL_CATALOG)
		(choices "Italiano" "Deutsch" "Espańol" "Czech")
		(default #localesrc)
		(help @askoptions-help)
	)
)

(set #i 0)
(while (< #i 4)
	(set #x #i)
	(set #y 1)

	(while (> #x 0)
		(set #y (* #y 2))

		(set #x (- #x 1))
	)

	(if (bitand #installcat #y)
		(
			(set #localecat (select #i "Italiano" "Deutsch" "Espańol" "Czech"))

			(copyfiles
				(prompt (cat (cat #INSTALLING_CATALOG " " ) #localecat))
				(help @copyfiles-help)
				(source (tackon "Catalogs" #localecat))
				(choices "PhotoFolio.catalog")
				(dest (tackon #localedest #localecat))
				(confirm expert)
				(optional askuser)
				(files)
			)
		)
	)

	(set #i (+ #i 1))
)

(complete 95)


; *********************** Install ARexx scripts

(if (=
	(askchoice
		(help @askchoice-help)
		(prompt #PROMPT_INSTALL_AREXX)
		(choices #YES #NO)
		(default 0)
	)	0 )
	(
		(copyfiles
			(prompt #INSTALLING_AREXX)
	    (help @copyfiles-help)
			(source "Rexx")
			(dest (tackon destination "Rexx"))
			(all)
			(confirm expert)
		)
	)
)

(complete 100)


; Finished installation
(message (cat #UPDATES_AVAILABLE #BLANK #BLANK #HOMEPAGE))
