; script to install ValCalc
; Should be run from WorkBench by double-clicking on the icon
; Tooltypes for icon:
; APPNAME=ValCalc
; MINUSER=EXPERT
; DEFUSER=EXPERT
; (need to be a project of course ;-)

(set @default-dest "Workbench:tools")

(set progdir (askdir(prompt "Select the location to install ValCalc")
   					(default @default-dest)
       				(help "Choose a destination directory "
           	  	  		  "to contain ValCalc.  The install "
              	  		  "program will put ValCalc and documentation "
						  "in that directory."
        			)
     		)
)

(set @default-dest progdir)

;Ask user wether the high or low icon should be used
(set iconsize
        (askchoice
                (prompt "Do you want to use the high or the low icons ?")
                (choices "High" "Low")
                (help "The only difference between the two set of icons are their "
                      "height. The high icons are recommended if the horisontal "
                      "resolution on your workbench screen is over 256 pixels "
                      "(it problably is if your Amiga is AGA)."
                )
         (default 0)
        )
)

(set fputype
        (askchoice
                (prompt "Which version of ValCalc do you wish to install ?")
                (choices "No fpu" "fpu")
                (help "If you have an fpu or a cpu with a fpu, choose fpu.")
         (default 0)
        )
)

(set catalogs (askoptions (prompt "Please select the languages (catalogs) you wish to install. "
								  "This does only apply for users with Workbench 2.1 (v38) or "
								  "better. If you do not have that, do not select any languages. "
								  "ValCalc has english built-in, so do not select any languages if "
								  "you are using english as the prefered language.")
						  (help "ValCalc is localized which means that it can use "
								"different languages. If the language, you have set in your "
								" preferences, is present, select it and ValCalc will use that "
								"language. Otherwise english will be used")
						  (choices "Dansk" "Français" "Deutsch")
						  (default 0)
			  )
)

(if (BITAND catalogs 1) 
	(copyfiles (source "catalogs/dansk/ValCalc.catalog")
			   (dest "LOCALE:Catalogs/dansk")
	)
)

(if (BITAND catalogs 2) 
	(copyfiles (source "catalogs/français/ValCalc.catalog")
			   (dest "LOCALE:Catalogs/français")
	)
)

(if (BITAND catalogs 4) 
	(copyfiles (source "catalogs/deutsch/ValCalc.catalog")
			   (dest "LOCALE:Catalogs/deutsch")
	)
)

;Copy ValCalc
(if (= fputype 0)
	(copyfiles (source "ValCalc.ieee")
           (dest progdir)
           (newname "ValCalc")
    )
)

(if (= fputype 1)
	(copyfiles (source "ValCalc.fpu")
           (dest progdir)
           (newname "ValCalc")
    )
)

;Copy doc
(copyfiles (source "ValCalc.guide")
           (dest progdir)
           (newname "ValCalc.guide")
)

;Copy prefs-file if it does not exists already
(if (= (exists (cat progdir "/ValCalc.prefs")) 0)
	(copyfiles (source "ValCalc.prefs")
    	(dest progdir)
		(newname "ValCalc.prefs")
	)
)

;Copy icons
(if (= iconsize 0)
   (copyfiles (source "icons/ValCalc.high.info")
              (dest progdir)
              (newname "ValCalc.info")
 )
)
(if (= iconsize 0)
   (copyfiles (source "icons/ValCalc.guide.high.info")
              (dest progdir)
			  (newname "ValCalc.guide.info")
 )
)

(if (= iconsize 1)
   (copyfiles (source "icons/ValCalc.low.info")
              (dest progdir)
              (newname "ValCalc.info")
 )
)

(if (= iconsize 1)
   (copyfiles (source "icons/ValCalc.guide.low.info")
              (dest progdir)
              (newname "ValCalc.guide.info")
 )
)

;Copy libraries
(copylib (source "libs/reqtools.library")
         (dest   "libs:")
)

;Copy font

(copyfiles
  (source "fonts")
  (dest "fonts:")
  (all)
)