

; Photogenics Installer script. © Almathera 1994-6. All rights reserved.

; $VER: Photogenics_1.2a_AC_Share_Installer 1.00 (25.09.96)

; Authored & Hacked To Death by thp/©!truS'96

;                And now over to Tom with the weather.


; /**************************************************************************/
;                  The "wurdZ": Complicated weirdshit, this.
; /**************************************************************************/

                          ; global messages

(set #GOINGIN
	(cat "\n\nWelcome to the Photogenics (TM) installation system\n\n\n"
	     "Read the file READ.ME on distribution disk 2 for more "
	     "information about Photogenics 1.2a that may have not made "
	     "it into the printed manual."
	     "\n\n\n Photogenics © 1994-6 Paul Nolan & Almathera Systems Ltd."
	     " All Rights Reserved.")
)

(set #TOOSMALLBOX-HELP
	(cat "\n\nWarning:\n\nInstalling Photogenics on a machine"
	     " with a hard drive but no extra FAST memory is *NOT*"
	     " recommended due to the extra memory overheads of the hard"
	     " drive.\n\n"
	     " Adding extra FAST RAM to your machine will improve"
	     " system performance by approximately 2 times, and"
	     " allow you to work with much larger images in Photogenics.")
)

(set #WAYS-TO-INSTALL
	(cat "The ColourFonts are the ones as used in the 'Special text effects"
	     " with Alpha channels' tutorial. They're 8-colour anti-aliased"
	     " fonts, and use a ramped-up greyscale palette. Be warned that"
	     " they're BIG (around 900K) to install, so make sure your hard"
	     " drive has enough free space beforehand.\n\n"
	     "The Tutorial graphics and examples are the images described"
	     " in the manual during the tutorials, plus a cluster of other"
	     " suitable material to feed Photogenics with. Please note that"
	     " these pictures are copyrighted and are supplied for test"
	     " purposes only - they are not for commercial use of any"
	     " nature, unless specifically stated by their respective"
	     " owners.")
)

(set #DOTHEPROGRAMFIRST
	(cat " You need to install the main Photogenics program"
	     " before you can install the optional colourfonts and tutorial"
	     " images! ;->\n\n"
	     " Make sure the checkbox for 'Main program and standard modules'"
	     " is ticked when the main options menu appears on starting this"
	     " installer utility. <You can install everything else at the same"
	     " time, by selecting all checkboxes and hitting Proceed>")
)

(set #OLDBOX-HELP "\n You must be using at least KickStart 3.0 (V39) to install or run Photogenics!")

(set #MAIN-PROMPT
	(cat "Which parts of Photogenics do you wish to install?\n"
	     "(Use the check-boxes to select, then hit Proceed)")
)

(set #CHOICE-MAIN "Main program & standard modules (850K)")

(set #CHOICE-FONTS "Extra ColourFonts (900K)")

(set #CHOICE-GFX "Tutorial & example pictures (760K)")

(set #DISK "Please insert Photogenics disk %s in any drive")

(set #FINAL-MESSAGE
	(cat "\n"
	     "Following this last confirmation is a list of changes,"
	     " updates and enhancements to Photogenics which didn't"
	     " make it into the manual - there is important information"
	     " in the text, so please be sure to read it. Then go ahead"
	     " and start Photogenics by double-clicking on its icon -"
	     " this can be found in the drawer in which you installed"
	     " the package.\n\n( %s )\n\n Spray on, gang.")
)

(set #FONTS-INSTALLED "\n\n\nColourfonts installed.")

(set #GFX-INSTALLED "\n\n\nTutorial and example graphics installed.")

                        ; main code messages

(set #REINCARNATION
	(cat "\n\nA previous installation of the Photogenics package"
	     " has been found in\n\n%s\n\nSelect 'Proceed' to update"
	     " your installation with the new version, or 'Abort' to"
	     " abort the install.")
)

(set #PREFS-OLD
	(cat "\n\nIt looks like you're upgrading your Photogenics installation"
	     " from a pre-v1.1a setup. Unfortunately, due to the way the program"
	     " developed, preference files prior to v1.1a aren't compatible with"
	     " the current release, and yours needs to be deleted. When you next"
	     " start Photogenics up, you'll need to register with your number"
	     " again. If you don't use Proceed to delete the file, you'll have"
	     " to do it manually.")
)

(set #PREFS-SE-OLD
	(cat "\nYou appear to be upgrading from a SE release of Photogenics"
	     " to the 1.2a release - however, the format of the SE preference"
	     " files is different to their 1.2a counterparts, so they must be"
	     " deleted. When you next start Photogenics up, you'll need to"
	     " register with your new 1.2a number.\n\nDeleting: %s\n\n")
)

(set #MAINPROG-PROMPT
	(cat "Where do you wish to install Photogenics?\n"
	     "(A drawer named 'Photogenics' will be created in which the"
	     " program will reside)")
)

(set #MAINPROG-HELP
	(cat "\nThe Photogenics package is extremely modular - effects, loaders and"
	     " savers, brushes and image manipulators are all separate files"
	     " which the main program calls as-and-when it needs to. This makes"
	     " efficient use of memory.\n\n"
	     "When installed, the main program sits at the top of its directory"
	     " tree under which drawers containing the various external modules"
	     " are positioned - these will be installed soon.")
)

(set #SCRATCH-PROMPT
	(cat "Where should Photogenics keep its temporary files?\n"
	     "(Unless you have LARGE amounts of memory this should be"
	     " in a hard disk directory)")
)

(set #SCRATCH-HELP
	(cat "\nPhotogenics can sometimes require extra storage space for"
	     " temporary files created by itself, especially for exporting"
	     " data to other programs - these can be several megabytes in"
	     " size, so unless you have a LOT of RAM <ie over 10 megs of"
	     " FAST>, aim the assignment 'PGStemp:' at a fast hard disk"
	     " directory with lots of free space.\n\n"
	     "This directory you select on the previous page is used for"
	     " 'PGStemp:' and the assignment gets added to S:User-StartUP")
)

(set #DEPLODE "Okay, here it comes...")

(set #SUPPORT-HELP
	(cat "\n\n\n\nThis section installs the generic loader, saver, brush"
	     " and effects modules which the Photogenics main program calls."
	     " These all sit in their various subdirectories, so it's just"
	     " a simple recursive copy with no version-check.")
)

(set #PGXDIR "Creating Photogenics directory...")

(set #PGX-SCRATCHPROMPT "Creating the directory \n%s\n for Photogenics temporary files...")

(set #PGX-CODEPLODE "Installing Photogenics release 1.2a main program...")

(set #GENIXFONT-HELP
	(cat "\n\n\n\n\nInstalling Photogenics font into FONTS: - this is the"
	     " internal font used by the program.")
)

(set #PGX-SCRUB "\n\nDeleting redundant program code:\n\n%s\n\n")

(set #PGX-ICONPROMPT "Installing Photogenics icon...")

(set #PGX-ICONPOSPROMPT "Setting up icon position")

(set #PGX-ENVARC "Creating Photogenics directory in ENVARC:...")

(set #PGX-ENV "Creating Photogenics directory in ENV:...")

(set #PREFS-DELETE "\n\n\n\nYour preferences have been copied into ENV: and ENVARC, so can now be deleted from the Photogenics file tree.")

(set #PREFS-HELP "\n\n\n\n\n\n Installing v1.2a requires you to delete this file.")

(set #PREFS-MOVE
	(cat "\nNow copying your Photogenics preferences into %s\n"
	     "(Photogenics v1.2a uses environmental variables"
	     " instead of the Photogenics file tree)")
)

(set #PGX-DATA-PROMPT "Installing Photogenics data files...")

(set #PGX-FONT-PROMPT "Installing Photogenics font in FONTS:")

(set #PGX-ASL "Checking and updating ASL.library, if needed...")

(set #PGX-DISKFONT "Checking and updating DiskFont.library, if needed...")

(set #PGX-SETPATCH "Checking and updating SetPatch. Photogenics *requires* v40.16")

(set #PGX-MANUAL-PROMPT "Copying manual additions across")

                       ; colourfonts messages

(set #COLOURFONT-PROMPT
	(cat "\n\n\nDo you wish to install the ColourFonts in the"
	     " default system font directory FONTS: which is normally"
	     " assigned to sys:Fonts?")
)

(set #WHEREFONT-HELP
	(cat "\nThe Photogenics 'Text' GIO loader can use Amiga ColourFonts"
	     " which tend to be BIG. These ones are over 900K, so you can"
	     " install them away from the System"
	     " disk <useful if you keep Colourfonts in a special drawer"
	     " or you're running low on System space>. Keeping them in 'FONTS:'"
	     " is simplest but unwieldy, putting them in another directory means"
	     " an extra addition to S:User-StartUP. But it's more organised.\n\n"
	     " Select 'FONTS:' to install to FONTS: or 'Elsewhere' to select your"
	     " own directory.")
)

(set #ELSEWHERE-PROMPT "Okay, choose a directory.\n")

(set #MAKEFONTDIR-PROMPT "Creating the directory '%s' for the ColourFonts...")

(set #INSTALL-COLFONTS
	(cat "Decompressing and installing ColourFonts...\n\n\n\n\n"
	     "(This is a large job, so please bear with us...)")
)

(set #INSTALL-COLFONTS-ERROR
	(cat "\n\n"
	     "The installer couldn't finish decompressing the colourfonts"
	     " into your selected directory."
	     " Make sure your hard disk, has enough free space in it, "
	     " and if the files to be copied already exist, the existing"
	     " files aren't protected from deletion or overwriting.")
)

                       ; userstartup messages

(set #FONTSTARTUP-HELP
	(cat "\nBecause you've not installed the ColourFonts in the standard SYS:Fonts"
	     " directory <pointed at by the FONTS: assignment>, Photogenics won't be able"
	     " to see them for use unless FONTS: has been extended to include your selected"
	     " directory. The 'Assign' command under WorkBench 3.x has the ADD option which"
	     " will extend FONTS: to cover multiple directories - ROM routines will follow"
	     " the full AmigaDOS path, but DOpus and normal filerequesters can't do this.\n\n"
	     "Best way to extend FONTS: is add to S:User-Startup.")
)

(set #USERSTARTUP-HELP
	(cat "\n\nPhotogenics needs an AmigaDOS assignment so it knows where"
	     " to find all its program modules.\n\nThe assignment PHOTOGENICS: is best"
	     " made on bootup - the standard way of doing this being an extra"
	     " few lines in the file S:User-Startup.\n\nThis section of the"
	     " install procedure will add these lines for you.")
)

(set #STARTUP-1
	(cat "\n\n\nDo you want the installer to automatically make"
	     " the required changes for %s to S:User-StartUP?\n\n"
	     "If you don't, it will create a script file containing"
	     " commands which you should add to your S:User-StartUP script.")
)

(set #STARTUP-2
	(cat "\n\n\nNow adding the %s lines to S:User-StartUP.\n\n"
	     "These are:\n\n%s")
)

(set #STARTUP-3
	(cat "\n\n\n\nThe file:\n\n%s\n\nhas been "
	     "generated, which you must add to S:User-StartUP manually.")
)

(set #WAY-COOL-NEW-STUFF
	(cat "\n\n\n\nIn the 1.2a update, there's various new features, tweaks, freaks"
	     " and updates to some of the paintmodes and GIOs - we're about to"
	     " delete one of the obsolete files. This process will take"
	     " approximately 4 of your Earth 'minutes'. Thank you.")
)

(set #BACKWARDS-COMPATIBILITY
	(cat "\n\n\nIf you don't upgrade your current installation,"
	     " you won't be able to use any future expansion modules"
	     " which will rely on the extra functionality of the"
	     " Photogenics revision supplied on this disk set.\n\n\n"
	     "So, like, upgrade. It won't hurt. Honest. ;->\n")
)

                         ; graphics messages

(set #GFXDIR-PROMPT
	(cat "Where do you wish to install the tutorial and\n"
	     "example graphics?\n(A drawer named '%s' will be"
	     " created for them)")
)

(set #MAKE-GFXDIR "Creating a directory for the graphics...")

(set #ALPHACLIPS "Installing Photogenics examples/tutorials...\n\nAlpha channel clipboards")

(set #TEXTURES "Installing Photogenics examples/tutorials...\n\nTexures")

(set #TUTORIALS "Installing Photogenics examples/tutorials...\n\nTutorial images")

(set #DISPLACEMAPS "Installing Photogenics examples/tutorials...\n\nDisplace Maps")

(set #COPYRIGHT "Copying copyright information across")


; /**************************************************************************/
;               Right, ditching old kack we don't need...
; /**************************************************************************/

(procedure scrub
	(
	(if (> (exists (tackon BINARIES OLDKACK) ) 0 )
		(
		(delete (tackon BINARIES OLDKACK)
			(prompt (#PGX-SCRUB (tackon BINARIES OLDKACK) ))
			(help #WAY-COOL-NEW-STUFF)
			(confirm)
			)
		)
	)
	)
)


; /**************************************************************************/
;                   there's something dead in here
; /**************************************************************************/


(procedure do-the-startup
	(
	(if
		(askbool
			(prompt
				(#STARTUP-1 SECTION-NAME)
				)
			(help STARTUP-HELP))
		(startup SECTION-NAME
			(prompt
				(#STARTUP-2 SECTION-NAME ADD-TO-USER-STARTUP)
				)
			(help STARTUP-HELP)
			(command ADD-TO-USER-STARTUP))
		(
		(textfile
			(dest (tackon OUTPUT STARTUP-FILE))
			(append ADD-TO-USER-STARTUP))

		(message
			(#STARTUP-3 (tackon OUTPUT STARTUP-FILE))
			)
		)
	)
	)
)


; /**************************************************************************/
;                          Who? What? Where?
; /**************************************************************************/

(procedure hunt_the_wiener
	(
	(set OLDINSTALL (getassign "photogenics"))

	(if (AND (= OLDINSTALL "") (< (IN WHATTOINSTALL 0) 1 ) )
		(abort #DOTHEPROGRAMFIRST)
		(set RETURNCODE OLDINSTALL)
	)
	)
)


; /**************************************************************************/
;                Install the core program and modules
; /**************************************************************************/

(procedure corebinaries
	(

	(set NEWCODE (+ NEWCODE 2))

	(if (= (getassign "WORK" "v") "" )
		(set NORMAL @default-dest)
		(set NORMAL "WORK:")
	)

	(set CHIP (database "graphics-mem") )
	(set TOTAL (database "total-mem") )

	(if ( <= (- TOTAL CHIP) 0 )
		(
		(message #TOOSMALLBOX-HELP)
		)
	)

	(hunt_the_wiener)
	(set WHEREBINARIES RETURNCODE)

	(if (= WHEREBINARIES "")
		(
		(set BINARIES
			(askdir
				(prompt #MAINPROG-PROMPT)
				(help #MAINPROG-HELP)
				(default NORMAL)
				(disk)
			)
		)
		(set BINARIES (tackon BINARIES "Photogenics"))
		)

		(
		(set BINARIES WHEREBINARIES)
		(set NEWINSTALL
			(askbool
				(prompt (#REINCARNATION BINARIES))
				(help #BACKWARDS-COMPATIBILITY)
				(choices "Proceed" "Abort")
			)
		)

		(if (= 0 NEWINSTALL)
			(
			(exit (quiet))
			)
		)

		(if (exists (tackon BINARIES "Photogenics"))
			(
			(set VERTAG (getsize (tackon BINARIES "Photogenics")))

			; /**** 181704 == v1.1a   243268 == v1.2   ****/

			(if (NOT (OR (= VERTAG 243268)  (= VERTAG 181704) ))
				(
				(delete
					(tackon BINARIES "Data/Preferences")
					(prompt #PREFS-OLD)
					(help #PREFS-HELP)
					(confirm)
				)
				)
			)
			)
		)

		)
	)

	(set @default-dest BINARIES)

	(set PGX-SCRATCH
		(askdir
			(prompt #SCRATCH-PROMPT)
			(help #SCRATCH-HELP)
			(default (tackon @default-dest "Temporary"))
			(newpath)
			(disk)
		)
	)

	(set ADD-TO-USER-STARTUP (cat "assign photogenics: \"" BINARIES "\"\nassign PGStemp: \"" PGX-SCRATCH "\"\n"))

	(copyfiles
		(prompt #DEPLODE)
		(help @copyfiles-help)
		(source "Photogenics_2:c/Deplode")
		(dest "ram:")
	)		

	(askdisk
		(prompt (#DISK "1"))
		(dest "Photogenics_1")
		(help @askdisk-help)
	)

                      ; Copying the main bit...

	(if ( < (exists BINARIES (noreq) ) 2)
		(makedir BINARIES
			(prompt #PGXDIR)
			(help @makedir-help) 
			(infos)
		)
	)

	(if ( < (exists PGX-SCRATCH (noreq) ) 2)
		(makedir PGX-SCRATCH
			(prompt (#PGX-SCRATCHPROMPT (PGX-SCRATCH)))
			(help @makedir-help) 
		)
	)

	(working #PGX-CODEPLODE)

	(run ("ram:Deplode Photogenics_1:Photogenics \"%s\"" (tackon BINARIES "Photogenics") )
		(prompt #PGX-CODEPLODE)
		(help #MAINPROG-HELP)
		(confirm)
	)

	(delete "ram:Deplode")

	(copyfiles
		(prompt #PGX-ICONPROMPT)
		(help #MAINPROG-HELP)
		(source "Photogenics_1:Photogenics.icon")
		(dest BINARIES)
		(newname "Photogenics.info")
	)

	(tooltype
		(prompt #PGX-ICONPOSPROMPT)
		(help #MAINPROG-HELP)
		(dest (tackon BINARIES "Photogenics.info"))
		(noposition)
		(setstack 25000)
	)

;   ENV: is now used for all preference files. GIO and main code...

	(if ( < (exists "envarc:Photogenics" (noreq) ) 2)
		(
		(makedir "envarc:Photogenics"
			(prompt #PGX-ENVARC)
			(help @makedir-help) 
			)

		(makedir "env:Photogenics"
			(prompt #PGX-ENV)
			(help @makedir-help) 
			)
		)
	)

	(if (exists "pgsse:" (noreq))
		(
		(delete "ENVARC:Photogenics/preferences-se"
			(prompt (#PREFS-SE-OLD "ENVARC:Photogenics/preferences-se"))
			(help #PREFS-HELP)
			(confirm)
		)

		(delete"ENV:Photogenics/preferences-se"
			(prompt (#PREFS-SE-OLD "ENV:Photogenics/preferences-se"))
			(help #PREFS-HELP)
			(confirm)
		)
		)
	)

	(if (= 1 (exists (tackon BINARIES "Data/Preferences") (noreq)))
		(
		(copyfiles
			(prompt (#PREFS-MOVE "ENVARC:"))
			(source (tackon BINARIES "Data/Preferences"))
			(dest "ENVARC:Photogenics/")
			(help @copyfiles-help)
			(newname "preferences")
			(confirm)
		)

		(copyfiles
			(prompt (#PREFS-MOVE "ENV:"))
			(source (tackon BINARIES "Data/Preferences"))
			(dest "ENV:Photogenics/")
			(help @copyfiles-help)
			(newname "preferences")
			(confirm)
		)

		(delete (tackon BINARIES "Data/Preferences")
			(prompt #PREFS-DELETE)
			(help #PREFS-HELP)
			(confirm)
		)

		)
	)

; Because of Installer following case of the previous file, and GIOs
; being case sensitive, the only way to be reliable is to zap the lot...

	(set OLDKACK "Data/Paintmodes/Flip-X")
	(scrub)

	(set OLDKACK "Data/Paintmodes/Flip-Y")
	(scrub)

	(set OLDKACK "Data/Paintmodes/AddDust")
	(scrub)

	(set OLDKACK "Data/Paintmodes/NegBright")
	(scrub)

	(set OLDKACK "Data/Paintmodes/LimitMax")
	(scrub)

	(set OLDKACK "Data/Paintmodes/LimitMin")
	(scrub)

	(set OLDKACK "Data/Paintmodes/HeavyBlur")
	(scrub)

	(set OLDKACK "Data/Paintmodes/Maximum")
	(scrub)

	(set OLDKACK "Data/Paintmodes/Minimum")
	(scrub)

	(set OLDKACK "Data/Paintmodes/Highlights")
	(scrub)

	(set OLDKACK "Data/Paintmodes/Lowlights")
	(scrub)

	(set OLDKACK "Data/GIO/ACBM.gio")
	(scrub)

	(set OLDKACK "Data/GIO/AmigaScreen.gio")
	(scrub)

	(set OLDKACK "Data/GIO/Ascii-Art.gio")
	(scrub)

	(set OLDKACK "Data/GIO/Backdrop.gio")
	(scrub)

	(set OLDKACK "Data/GIO/BMP.gio")
	(scrub)

	(set OLDKACK "Data/GIO/CDXL.gio")
	(scrub)

	(set OLDKACK "Data/GIO/ColourNoise.gio")
	(scrub)

	(set OLDKACK "Data/GIO/CyBERgraphics.gio")
	(scrub)

	(set OLDKACK "Data/GIO/GIF.gio")
	(scrub)

	(set OLDKACK "Data/GIO/HAM8.gio")
	(scrub)

	(set OLDKACK "Data/GIO/IFFDeep.gio")
	(scrub)

	(set OLDKACK "Data/GIO/ILBM.gio")
	(scrub)

	(set OLDKACK "Data/GIO/Img.gio")
	(scrub)

	(set OLDKACK "Data/GIO/JPEG.gio")
	(scrub)

	(set OLDKACK "Data/GIO/Opal_HIRES.gio")
	(scrub)

	(set OLDKACK "Data/GIO/Opal_LORES.gio")
	(scrub)

	(set OLDKACK "Data/GIO/Pattern.gio")
	(scrub)

	(set OLDKACK "Data/GIO/PBM.gio")
	(scrub)

	(set OLDKACK "Data/GIO/PCD.gio")
	(scrub)

	(set OLDKACK "Data/GIO/Picasso-II.gio")
	(scrub)

	(set OLDKACK "Data/GIO/Plasma.gio")
	(scrub)

	(set OLDKACK "Data/GIO/PrefsPrinter.gio")
	(scrub)

	(set OLDKACK "Data/GIO/QRT.gio")
	(scrub)

	(set OLDKACK "Data/GIO/QuadAnim.gio")
	(scrub)

	(set OLDKACK "Data/GIO/Raw.gio")
	(scrub)

	(set OLDKACK "Data/GIO/RGB8.gio")
	(scrub)

	(set OLDKACK "Data/GIO/RGBN.gio")
	(scrub)

	(set OLDKACK "Data/GIO/Ripples.gio")
	(scrub)

	(set OLDKACK "Data/GIO/Sculpt.gio")
	(scrub)

	(set OLDKACK "Data/GIO/ShowHam8.gio")
	(scrub)

	(set OLDKACK "Data/GIO/Streaks.gio")
	(scrub)

	(set OLDKACK "Data/GIO/Targa.gio")
	(scrub)

	(set OLDKACK "Data/GIO/Text.gio")
	(scrub)

	(set OLDKACK "Data/GIO/VLab.gio")
	(scrub)

	(set OLDKACK "Data/GIO/WhiteNoise.gio")
	(scrub)

;  Okay, we're in the clear. Nuking from orbit, it's the only way...

	(copyfiles
		(prompt #PGX-DATA-PROMPT)
		(help #SUPPORT-HELP)
		(source "Photogenics_1:Data/")
		(dest (tackon BINARIES "Data") )
		(all)
		(confirm)
	)

	(if (= (exists "FONTS:Photogenics.font" (NOREQ)) 0)
		(
		(copyfiles
			(prompt #PGX-FONT-PROMPT)
			(help #GENIXFONT-HELP)
			(source "Photogenics_1:Fonts/")
			(dest "fonts:")
			(pattern "Photogenics#?")
			(fonts)
			(confirm)
			)
		)
	)

; And other application installers crap up the system libraries sometimes...

	(run ("Protect libs:asl.library +RWED"))

	(copylib
		(prompt #PGX-ASL)
		(help @copylib-help)
		(source "Photogenics_1:libs/asl.library")
		(dest "libs:")
		(confirm)
	)

	(run ("Protect libs:diskfont.library +RWED"))

	(copylib
		(prompt #PGX-DISKFONT)
		(help @copylib-help)
		(source "Photogenics_1:libs/diskfont.library")
		(dest "libs:")
		(confirm)
	)

	(run ("Protect c:SetPatch +RWED"))

	(copylib
		(prompt #PGX-SETPATCH)
		(help @copylib-help)
		(source "Photogenics_1:c/SetPatch")
		(dest "c:")
		(confirm)
	)

	(run "Photogenics_1:c/SetPatch QUIET")

	(askdisk
		(prompt (#DISK "2"))
		(dest "Photogenics_2")
		(help @askdisk-help)
	)

	(copyfiles
		(prompt #PGX-DATA-PROMPT)
		(help #SUPPORT-HELP)
		(source "Photogenics_2:ExtraData/")
		(dest (tackon BINARIES "Data") )
		(all)
		(confirm)
	)

	(copyfiles
		(prompt #PGX-MANUAL-PROMPT)
		(help @copyfiles-help)
		(source "Photogenics_2:READ.ME")
		(dest BINARIES)
		(infos)
	)

	(tooltype 
		(dest ("%s/READ.ME" BINARIES))
		(setdefaulttool "More")
		(setstack 10000)
		(noposition)
	)


	(set SECTION-NAME "Photogenics")
	(set STARTUP-HELP #USERSTARTUP-HELP)
	(set OUTPUT BINARIES)
	(set STARTUP-FILE "add-to-user-startup")
	(do-the-startup)

	(makeassign "photogenics" BINARIES)
	(makeassign "PGStemp" PGX-SCRATCH)

	)

)


; /**************************************************************************/
;                       Install the ColourFonts
; /**************************************************************************/


(procedure colourfonts
	(
	(hunt_the_wiener)
	(set WHEREFONT RETURNCODE)

	(set FONTCHOICE
		(askbool
			(prompt #COLOURFONT-PROMPT)
			(help #WHEREFONT-HELP)
		)
	)

	(if (= 0 FONTCHOICE)
		(

		(set WHEREFONT
			(askdir
				(prompt #ELSEWHERE-PROMPT)
				(help @askdir-help)
				(default @default-dest)
				(newpath)
				(disk)
			)
		)

		(if ( < (exists WHEREFONT (noreq) ) 2)
			(makedir WHEREFONT
				(prompt (#MAKEFONTDIR-PROMPT WHEREFONT))
				(help @makedir-help) 
				(confirm)
			)
		)

		(set ADD-TO-USER-STARTUP (cat "assign fonts: \"" WHEREFONT "\" ADD\n"))
		)

		(
		(set WHEREFONT "fonts:")
		)
	)

	(set @default-dest RETURNCODE)
	(makeassign "pgs_temp" WHEREFONT)

	(askdisk
		(prompt (#DISK "2"))
		(dest "Photogenics_2")
		(help @askdisk-help)
	)

	(working #INSTALL-COLFONTS)

	(set FONTERROR (run "Photogenics_2:c/lhex -qfw=pgs_temp: x Photogenics_2:ColourFonts.lha"))
	(if  ( <> FONTERROR 0)
		(
		(abort #INSTALL-COLFONTS-ERROR)
		)
	)

	(if (= 0 FONTCHOICE)
		(
		(run "c:assign fonts: pgs_temp: add")
		(set SECTION-NAME "Photogenics ColourFonts")
		(set STARTUP-HELP #FONTSTARTUP-HELP)
		(set OUTPUT @default-dest)
		(set STARTUP-FILE "add-fonts-to-user-startup")
		(do-the-startup)
		)
	)
	)
)


; /**************************************************************************/
;            And the test graphics. "Two tits in a canoe"
; /**************************************************************************/

(procedure tutorials
	(
	(hunt_the_wiener)
	(set NORMAL RETURNCODE)
	(set GRAPHICS-DIR "Graphics")

	(set GRAPHICS
		(askdir
			(prompt (#GFXDIR-PROMPT GRAPHICS-DIR ) )
			(help @askdir-help)
			(default NORMAL)
			(newpath)
			(disk)
		)
	)

	(set GRAPHICS (tackon GRAPHICS GRAPHICS-DIR))

	(if ( < (exists GRAPHICS (noreq) ) 2)
		(makedir GRAPHICS
			(prompt #MAKE-GFXDIR)
			(help @makedir-help) 
			(confirm)
			(infos)
		)
	)

	(set @default-dest RETURNCODE)

	(askdisk
		(prompt (#DISK "2"))
		(dest "Photogenics_2")
		(help @askdisk-help)
		)

	(copyfiles
		(prompt "Installing graphics")
		(help @copyfiles-help)
		(source "Photogenics_2:Graphics")
		(dest GRAPHICS)
		(all)
		(confirm)
		)
	)

	(tooltype 
		(dest ("%s/Example Images NOTICE" GRAPHICS))
		(setdefaulttool "More")
		(setstack 10000)
		(noposition)
		)
)


; /**************************************************************************/
;                  Oh no, it's the Central Cavern!
; /**************************************************************************/


(if (< (/ (getversion) 65536) 39)
	((abort #OLDBOX-HELP))
)

(run "Avail >nil: <nil: FLUSH")

(message #GOINGIN)

(set NEWCODE 0)

(set WHATTOINSTALL
	(askoptions
		(prompt #MAIN-PROMPT)
		(help #WAYS-TO-INSTALL)
		(choices #CHOICE-MAIN
		         #CHOICE-FONTS
		         #CHOICE-GFX)
		(default 1)
	)
)

(if (= WHATTOINSTALL 0)
	(exit (quiet))
)

(if (= (IN WHATTOINSTALL 0) 1)
	(corebinaries)
)

(if (= (IN WHATTOINSTALL 1) 2)
	(colourfonts)
)

(if (= (IN WHATTOINSTALL 2) 4)
	(tutorials)
)


; /******************************************************************************/
;                             Right, that's it.
; /******************************************************************************/

(makeassign "pgs_temp")

(if (> NEWCODE 0)
	(

	(askdisk
		(prompt (#DISK "2"))
		(dest "Photogenics_2")
		(help @askdisk-help)
		)

	(message
		( #FINAL-MESSAGE BINARIES )
		)

	(run "run Photogenics_2:c/More Photogenics_2:READ.ME")

	(exit (quiet))
	)
)

(if (= (IN WHATTOINSTALL 1) 2)
	(set FINALREPLY (cat FINALREPLY #FONTS-INSTALLED))
	)

(if (= (IN WHATTOINSTALL 2) 4)
	(set FINALREPLY (cat FINALREPLY #GFX-INSTALLED))
	)

(message FINALREPLY )
(exit (quiet))

