(complete 0)
(set @default-dest "SYS:WBStartup")

;********************************************************************

(set #warn-kickstart-text
(cat	"\nBAD VERSION OF KICKSTART\n\n"
	"SwazInfo requires KickStart 2.0 (V37) or higher. It will not work on earlier versions.\n"
	"You currently are running KickStart V%ld.\n\n"
	"Continue with installation?"
))

;********************************************************************

(set #path-text
(cat "\nSelect directory to install to"
))

(set #path-help
(cat "\nThis section lets you choose where to install SwazInfo "
     "on your hard disk. This should normally go in the Workbench "
     "Startup drawer - SYS:WBStartup.\n\n"
     @askdir-help
))

;********************************************************************

(set #lang-install-text
(cat "Installing locale catalogs"
))

(set #lang-which-text
(cat "Which languages should be installed?"
))

(set #lang-which-help
(cat "Check the boxes of the languages you wish to have available with BlankerServer."
     "\n\n" @askoptions-help
))

;********************************************************************

(set #libs-working-text
(cat "Installing required libraries"
))

(set #libs-mxlib-text
(cat "Installing matrix.library"
))

(set #libs-mxlib-help
(cat "Matrix.library is written by David Swasbrook. It contains the GUI and file handling routines, plus many"
     " many more smaller routines."
     "\n\n" @copylib-help
))

;********************************************************************

(set #main-copy-text
(cat "Installing BlankerServer executable"
))

;********************************************************************

(set #icon-install-text
(cat "Installing icons..."
))

;********************************************************************

(set #doc-dir-choose
(cat "\nWhich parts of documentation do you wish to install?"
))

(set #doc-dir-choose-help
(cat "\nSelect which of the following files are to be installed:\n\n"
     "  SwazInfo.cd    - catalog translation file\n"
     "  SwazInfo.guide - documentation\n"
     "  SwazInfo.i     - programming include\n\n"
     @askdir-help
))

(set #install-docs
(cat "\nInstall documentation?"
     "\n\n"
     "This consists of the following files:\n\n"
     "AmigaGuide documentation\n"
     "Locale catalog translation file\n"
     "Include to interface to SwazInfo\n"
))

(set #install-docs-help
(cat "\nYou may need help or wish to write a locale translation for SwazInfo at a later date...\n\n"
     @askbool-help
))

;********************************************************************

(set #goodbye
(cat "\nPlease remember that SwazInfo is SHAREWARE.\n\n"
     "If you use this program you should register by sending $10 US ($20 NZ) to:\n\n"
))

(set #my-address
(cat	"David Swasbrook,\n"
	"PO Box 54134,\n"
	"Bucklands Beach,\n"
	"Auckland,\n"
	"NEW ZEALAND.\n"
))

;********************************************************************


;********************************************************************
;**** END OF TEXT
;********************************************************************

;********************************
;**** CHECK THE KICKSTART VERSION
;****

(set ver (/ (getversion) 65536) )
(if (< ver 37) (
	(set warning (#warn-kickstart-text ver) ) (message warning)
))


;******************************
;**** CHECK THE DESTINATION DIR
;****
(complete 15)

(set target
(askdir (prompt #path-text) (help #path-help) (default @default-dest) (newpath)
))
(set @default-dest target)


;******************************
;**** LIBS
;****
(complete 30) (working #libs-working-text)
(complete 31) (copylib (prompt #libs-mxlib-text) (help #libs-mxlib-help) (source "matrix.library") (dest "LIBS:") (confirm)
)

;******************************
;**** MAIN
;****
(complete 40) (working #main-copy-text)

(copyfiles
	(prompt "Copying to " #target )
	(help @copyfiles-help)
	(source "")
	(dest (cat target) )
	(choices "SwazInfo")
	(infos)
)

;******************************
;**** LOCALE
;****
(set def-lang 0)

(complete 60) (working #lang-install-text)

(set lang
(askoptions
	(prompt #lang-which-text)
	(help #lang-which-help)
	(choices "Dansk" "Deutsch" "Français" )
	(default def-lang)
))

(complete 63)

(set n 0)

(while (set language (select n "dansk" "deutsch" "français" "" ) )
(
	(if (IN lang n)
		(copyfiles
			(source (cat "locale/" language ".catalog" ))
			(dest (cat "LOCALE:catalogs/" language "/matrix" ))
			(newname "swazinfo.catalog")
		)
	)
	(set n (+ n 1))
))

;********************************
;**** APP ICONS
;****

(complete 70) (working #icon-install-text)
(copyfiles	(source "MagicIcons")
		(choices "SwazInfoApp.info" "SwazInfoX.info" "SwazInfoY.info" )
		(dest "env:matrix/swazinfo")
)

(complete 75)

(copyfiles	(source "MagicIcons")
		(choices "SwazInfoApp.info" "SwazInfoX.info" "SwazInfoY.info" )
		(dest "envarc:matrix/swazinfo")
)

;********************************
;**** DOCUMENTATION
;****

(complete 80)

(set docs (askbool (prompt #install-docs)
		(help #install-docs-help)
		(choices "YES" "NO")
	  )
)

(complete 90)

(if (= docs 1)
	(copyfiles
	   (prompt #doc-dir-choose)
	   (help #doc-dir-choose-help)
	   (source "docs" )
	   (dest "Sys:SwazInfo")
	   (infos)
	   (confirm)
	   (all)
	)
)

(complete 100) (message #goodbye #my-address)

