;*
;* $VER: Install_XModule 3.4 (14.6.95) Copyright © 1994,95 Bernardo Innocenti
;*
;* Installer script for XModule
;*

;***************************************************************************
; English strings
;***************************************************************************

(set #askdest		(cat "In which directory should XModule be installed?\n"
					"(A drawer called \"XModule\" will be created)"))

(set #askdest-help	(cat "Please, select the directory or partition in which you would like "
					"XModule installed (a drawer named \"XModule\" will be created "
					"in the directory you have selected).\n\n\n"
					@askdir-help))

(set #askcats		"Which language catalogs should be installed?")

(set #askcats-help	(cat "XModule has built-in english strings. To operate XModule in "
					"a different language a catalog file for that languge is needed. "
					"This catalog will be copied to the directory \"Catalogs/\" in "
					"the XModule drawer.  You need Workbench 2.1 or higher in order "
					"to use this feature.\n\n" @askchoice-help))

(set #askdocformat	"Please select which documentation format(s) to install:")

(set #askpatteditvers "Which version of the Pattern Editor gadget should be installed?")

(set #patteditvers-choice1 "Standard version")
(set #patteditvers-choice2 "68020 or higher only")

(set #askpatteditvers-help (cat "Choose the correct version for your machine.  If you are "
					"unsure what version should be used, pick the 68000 version.\n\n\n"
					@askchoice-help))

(set #askpatteditdest "In which directory should \"pattedit.gadget\" be installed?")

(set #askpatteditdest-help (cat "\"pattedit.gadget\" can be placed in the XModule drawer "
					"(recommended for 2.0-2.1 users) or in the default custom gadgets "
					"directory \"SYS:Classes/Gadgets\", where other programs will be "
					"able to use it.\nInstalling it to another directory may prevent "
					"XModule from finding the gadget.\n\n\n"))

(set #patteditdest-choice1 "Copy to XModule drawer")
(set #patteditdest-choice2 "Copy to \"SYS:Classes/Gadgets/\" drawer")
(set #patteditdest-choice3 "Manual select...")

(set #magicwb-str	(cat "Do you want MagicWB-style icons for XModule?\n"
					"(Requires MagicWB installed in your system)\n\n"
					"MagicWB is a collection of fine 8 color icons made by "
					"Martin Huttenloher.  These icons require a special palette, "
					"otherwise they look awful.\n"))

(set #magicwb-help	"Answer \"Yes\" only if your system preferences are properly set.")

(set #docformat-help (cat "Choose AmigaGuide documentation if you are running "
					"Workbench 2.1 or higher and/or you have Commodore AmigaGuide "
					"hypertext reader installed.  Otherwhise choose the normal "
					"documentation.\n\n"
					@askoptions-help))

(set #toolman-brush (cat "This distribution includes a brush image suitable for ToolManager docks.\n\n"
					"Do you want to copy it to your brush drawer?"))

(set #toolman-help	(cat "ToolManager is a program by Stefan Backer which extends Workbench "
					"usability allowing the user to start applications through AppIcons, AppMenus and "
					"small windows filled with buttons called docks.\n\n"
					"If you answer \"Yes\", you will be asked in which directory the brush image "
					"should be copied.\n\n"))

(set #ask-toolmandir "In which directory should the ToolManager image be copied?")


(set #bad-kick		"Sorry, XModule requires Kickstart version 2.04 or higher.")

(set #makingdir			"Creating XModule Directory...")
(set #copying-xmodule	"Copying XModule...")
(set #copying-players	"Copying Players...")
(set #copying-cats		"Copying Catalogs...")
(set #copying-icons		"Copying Default Icons...")
(set #copying-doc		"Copying ASCII Documentation...")
(set #copying-guide		"Copying AmigaGuide Documentation...")
(set #copying-readme	"Copying Release Notes...")
(set #copying-history	"Copying Revision History...")
(set #copying-brush		"Copying Brush for ToolManager Dock...")
(set #copying-pattedit	"Copying pattedit.gadget...")

(set #bonusmod-str		(cat "XModule distribution contains a fine bonus module "
						"made by FBY (Fabio Barzagli).\n\n"
						"Do you want it copied to your modules drawer?"))

(set #makingmoddir		"Creating Modules Directory...")
(set #copying-mods		"Copying Bonus Modules...")


;***************************************************************************
; Italiano strings
;***************************************************************************

(if (= @language "italiano")
(

(set #askdest		(cat "In quale directory deve essere installato l'XModule?\n"
					"(Sarà creato un cassetto \"XModule\")"))

(set #askdest-help	(cat "Scegli la directory o la partizione nella quale vuoi "
					"installare XModule (sarà creato un cassetto chiamato \"XModule\" "
					"nella directory selezionata).\n\n\n"
					@askdir-help))

(set #askcats		"Quali cataloghi devono essere istallati?")

(set #askcats-help	(cat "XModule usa di default la lingua inglese. Per usare XModule in "
					"una lingua diversa è necessario un catalogo per quella lingua. "
					"Questo catalogo sarà copiato nella directory \"Catalogs/\" nel "
					"cassetto XModule.  Hai bisogno del Workbench 2.1 o superiore per "
					"poter usare la localizzazione.\n\n" @askchoice-help))

(set #askdocformat	"Per favore scegli quale formato/i di documentazione installare:")

(set #askpatteditvers "Quale versione del gadget Pattern Editor deve essere installata?")

(set #patteditvers-choice1 "Versione standard")
(set #patteditvers-choice2 "Solo per 68020 o superiori")

(set #askpatteditvers-help (cat "Scegli la versione corretta per la tua macchina.  Se non sei "
					"sicuro su quale versione usare, prendi quella per 68000.\n\n\n"
					@askchoice-help))

(set #askpatteditdest "In quale directory deve essere installato il \"pattedit.gadget\"?")

(set #askpatteditdest-help (cat "Il \"pattedit.gadget\" puo` essere posto nel cassetto XModule "
					"(raccomandato per gli utenti 2.0-2.1) o nella directory di default per i "
					"gadget custom, \"SYS:Classes/Gadgets\", dove altri programmi potranno "
					"usarlo.\nInstallarlo in un'altra directory potrebbe impedire "
					"ad XModule di trovare il gadget.\n\n\n"))

(set #patteditdest-choice1 "Copia nel cassetto di XModule")
(set #patteditdest-choice2 "Copia nel cassetto \"SYS:Classes/Gadgets/\"")
(set #patteditdest-choice3 "Selezione manuale del cassetto...")

(set #magicwb-str	(cat "Vuoi le icone in stile MagicWB per XModule?\n"
					"(Richiede MagicWB installato nel tuo sistema)\n\n"
					"MagicWB è una collezione di icone a 8 colori fatte da "
					"Martin Huttenloher.  Queste icone richiedono una palette speciale, "
					"altrimenti sono molto brutte a vedersi.\n"))

(set #magicwb-help	"Rispondi \"Sì\" soltanto se le tue preferenze di sistema sono impostate adeguatamente.")

(set #docformat-help (cat "Scegli la documentazione AmigaGuide se usi il "
					"Workbench 2.1 o superiore e/o se hai installato il lettore di "
					"ipertesti AmigaGuide Commodore.  Altrimenti scegli la documentazione "
					"normale.\n\n"
					@askoptions-help))

(set #toolman-brush (cat "Questa distribuzione include un'immagine adeguata ai dock del ToolManager.\n\n"
					"Vuoi copiarla nel tuo cassetto delle immagini?"))

(set #toolman-help	(cat "ToolManager è un programma di Stefan Backer che estende l'usabilità del Workbench "
					"permettendo all'utente di lanciare applicazioni tramite AppIcons, AppMenus e "
					"piccole finestre piene di pulsanti chiamate docks.\n\n"
					"Se rispondi \"Sì\", ti verrà chiesto in quale directory deve essere copiata "
					"l'immagine.\n\n"))

(set #ask-toolmandir "In quale directory deve essere copiata l'immagine per il ToolManager?")


(set #bad-kick		"Spiacente, XModule richiede la versione 2.04 o superiore del Kickstart.")

(set #makingdir			"Creo la directory XModule...")
(set #copying-xmodule	"Copio XModule...")
(set #copying-players	"Copio i Players...")
(set #copying-cats		"Copio i Cataloghi...")
(set #copying-doc		"Copio la documentazione ASCII...")
(set #copying-guide		"Copio la documentazione AmigaGuide...")
(set #copying-readme	"Copio le Release Notes...")
(set #copying-history	"Copio la Revision History...")
(set #copying-brush		"Copio l'immagine per il dock del ToolManager...")
(set #copying-pattedit	"Copio il pattedit.gadget...")

(set #bonusmod-str		(cat "La distribuzione dell'XModule include un buon modulo bonus "
						"fatto da FBY (Fabio Barzagli).\n\n"
						"Vuoi copiarlo nel tuo cassetto Modules?"))

(set #makingmoddir		"Creo la directory Modules...")
(set #copying-mods		"Copio il Modulo Bonus...")

)) ; endif italiano



;***************************************************************************
; Make sure we are running at least under a 2.04 system
;***************************************************************************

(set sys-ver (/ (getversion) 65536))

(if (< sys-ver 37)
	(abort #bad-kick)
)

(set cpu (database "cpu"))


(welcome) ; Say Hi!


;***************************************************************************
; Ask user where he wants the XModule files
;***************************************************************************

(set @target-dir
	(askdir
		(prompt #askdest)
		(help #askdest-help)
		(default @default-dest)
	)
)

(set @target-dir (tackon @target-dir "XModule"))
(set @default-dest @target-dir)


;***************************************************************************
; Make the XModule directory
;***************************************************************************

(complete 0)

(makedir
	@target-dir
	(infos)
	(help @makedir-help)
	(prompt #makingdir)
)

;***************************************************************************
; Ask for MagicWB icons
;***************************************************************************

(complete 5)

(if (askbool
		(prompt #magicwb-str)
		(help #magicwb-help)
		(default 0)
	)

	(set @magic-icons 1)
)


;***************************************************************************
; Copy the XModule executable and its icon
;***************************************************************************

(complete 10)

(copyfiles
	(prompt #copying-xmodule)
	(source "XModule")
	(dest @target-dir)
	(infos)
)

(if (= @magic-icons 1)
	(copyfiles
		(source "MagicWB_Icons/XModule.info")
		(dest @target-dir)
	)
)


;***************************************************************************
; Copy the XModule players
;***************************************************************************

(complete 20)

(copyfiles
	(prompt #copying-players)
	(source "Players/")
	(all)
	(dest (tackon @target-dir "Players"))
)


;***************************************************************************
; Copy pattedit.gadget
;***************************************************************************

(complete 30)

(if (or (= cpu "68000") (= cpu "68010"))
		(set pattedit020 0) ; then
		(set pattedit020 1) ; else
)

(if (> @user-level 0)
	(set pattedit020 (askchoice
		(prompt #askpatteditvers)
		(help #askpatteditvers-help)
		(choices #patteditvers-choice1 #patteditvers-choice2)
		(default pattedit020)
	))
)


(set pattedit-dest (tackon @target-dir "Gadgets"))


(if  (> @user-level 1)
	(if (exists "SYS:Classes/")
		(select
			(askchoice
				(prompt #askpatteditdest #askchoice-help)
				(help #askpatteditdest-help #askchoice)
				(choices #patteditdest-choice1 #patteditdest-choice2 #patteditdest-choice3 "Copy to XModule drawer" "Copy to \"SYS:Classes/Gadgets/\" drawer" "Manual select...")
			)
			(set pattedit-dest (tackon @target-dir "Gadgets"))
			(set pattedit-dest "SYS:Classes/Gadgets")
			(set pattedit-dest
				(askdir
					(prompt #askpatteditdest)
					(help #askpatteditdest-help #askdir-help)
					(default @default-dest)
				)
			)
		)
	)
)


(if (= pattedit020 1)
	(copylib
		(prompt #copying-pattedit)
		(help @copylib-help)
		(source "Gadgets/pattedit.gadget_020")
		(newname "pattedit.gadget")
		(dest pattedit-dest)
		(confirm)
	)

	(copylib
		(prompt #copying-pattedit)
		(help @copylib-help)
		(source "Gadgets/pattedit.gadget")
		(dest pattedit-dest)
		(confirm)
	)
)


;***************************************************************************
; Copy catalog files
;***************************************************************************

(complete 40)

(set cat-choice (askoptions
	(prompt #askcats)
	(help #catalogs-help)
	(choices
		"Italiano"
	)
	(default (if (= @language "italiano") 1 0))
))

(if (<> cat-choice 0)
(
	(makedir (tackon @target-dir "Catalogs"))
))

(if (BITAND cat-choice 1)
(
	(copyfiles
		(prompt #copyingcats)
		(source "Catalogs/Italiano/XModule.catalog")
		(dest (tackon @target-dir "Catalogs/Italiano"))
	)
))



;***************************************************************************
; Copy default icon for modules & instruments
;***************************************************************************

(complete 50)

(if (= @magic-icons 1)
	(
		(copyfiles
			(source "MagicWB_Icons/")
			(choices "def_Module.info" "def_Instrument.info")
			(dest (tackon @target-dir "Icons"))
			(prompt #copying-icons)
		)
	)

	( ; else
		(copyfiles
			(source "Icons/")
			(choices "def_Module.info" "def_Instrument.info")
			(dest (tackon @target-dir "Icons"))
			(prompt #copying-icons)
		)
	)
)

(tooltype
	(dest (tackon @target-dir "Icons/def_Module"))
	(setdefaulttool (tackon @target-dir "XModule"))
	(noposition)
)



;***************************************************************************
; Copy documentation files
;***************************************************************************

(complete 60)

(set doc-choice (askoptions
	(prompt #askdocformat)
	(help #docformat-help)

	(choices
		"AmigaGuide Documentation"
		"ASCII Documentation"
		"Release notes (ReadMe)"
		"Revision History"
	)
	(default (if (OR (exists "SYS:Utilities/AmigaGuide") (exists "SYS:Utilities/MultiView")) 1 2))
))

(if (BITAND doc-choice 1)
(
	(copyfiles
		(prompt #copying-guide)
		(source "XModule.guide")
		(dest @target-dir)
		(infos)
	)

	(if (= @magic-icons 1)
		(copyfiles
			(source "MagicWB_Icons/XModule.guide.info")
			(prompt #copying-guide)
			(dest @target-dir)
		)
	)

	(if (< sys-ver 39)
		(tooltype
			(dest (tackon @target-dir "XModule.guide"))
			(setdefaulttool "SYS:Utlities/AmigaGuide")
		)
	)
))

(if (BITAND doc-choice 2)
(
	(copyfiles
		(prompt #copying-doc)
		(source "XModule.doc")
		(dest @target-dir)
		(infos)
	)

	(if (= @magic-icons 1)
		(copyfiles
			(source "MagicWB_Icons/XModule.doc.info")
			(prompt #copying-xmodule)
			(dest @target-dir)
		)
	)
))


(if (BITAND doc-choice 4)
(
	(copyfiles
		(prompt #copying-readme)
		(source "ReadMe")
		(dest @target-dir)
		(infos)
	)

	(if (= @magic-icons 1)
		(copyfiles
			(source "MagicWB_Icons/ReadMe.info")
			(prompt #copying-xmodule)
			(dest @target-dir)
		)
	)
))

(if (BITAND doc-choice 8)
(
	(copyfiles
		(prompt #copying-history)
		(source "History")
		(dest @target-dir)
		(infos)
	)

	(if (= @magic-icons 1)
		(copyfiles
			(source "MagicWB_Icons/History.info")
			(prompt #copying-xmodule)
			(dest @target-dir)
		)
	)
))


;***************************************************************************
; Copy ToolManager brush
;***************************************************************************

(complete 80)

(if (= @magic-icons 1)
	(if (askbool
			(prompt #toolman-brush)
			(help #toolman-help)
			(default 0))
		(
			(set @brush-dir
				(askdir
					(prompt #ask-toolmandir)
					(help #askdir-help)
					(default "SYS:Prefs/")
				)
			)

			(copyfiles
				(source "MagicWB_Icons/XModule.brush")
				(prompt #copying-brush)
				(help #copyfiles-help)
				(dest @brush-dir)
			)
		)
	)
)


;***************************************************************************
; Copy bonus module
;***************************************************************************

(complete 90)

(if (askbool
		(prompt #bonusmod-str)
		(help @askbool-help)
		(default 1))
	(
		(makedir
			(tackon @target-dir "Modules")
			(infos)
			(prompt #makingmoddir)
			(help @makedir-help)
		)

		(copyfiles
			(prompt #copying-mods)
			(source "BonusModules")
			(dest (tackon @target-dir "Modules"))
			(all)
			(infos)
		)

		(if (= @magic-icons 1)
			(copyfiles
				(source "MagicWB_Icons/def_Module.info")
				(prompt #copying-mods)
				(dest (tackon @target-dir "Modules"))
				(newname "FBY-Winning.mod.info")
			)
		)
	)
)

(complete 100)
