;---------------------------------------
; $VER: Install-djpegGUI 37.1 (25/07/93)
;---------------------------------------

(transcript "djpegGUI Installation by Geoff Seeley")

(set @default-dest "")

;----------------
; Setup defaults
;----------------

(set guidir   "Work:") ; default program dir
(set docdir   "Work:") ; default docs dir
(set djpegdir "Work:") ; default djpeg path
(set tempdir  "Work:") ;
(set tempdir2 "Work:") ;

(set doctype  0)       ; default AmigaGuide docs
(set dotool   0)       ; default don't set tool type

;-----------
; Tooltypes
;-----------

(set djpegtool "DJPEGPATH")	; path to djpeg
(set helptool  "HELP")          ; path to amigaguide docs
(set wintool   "WINDOW")        ; window placement

;-------
; Icons
;-------

(set appname   "djpegGUI")

;-----------
; Doc types
;-----------

(set amigaguide "AmigaGuide Documentation")
(set ascii      "ASCII Documentation")
(set djpegdoc   "djpeg manual page")

(complete 0)

;-------------------------------------------------------------
; Get user's preferred installation directory for the program
;-------------------------------------------------------------

(set guidir 
   (askdir (prompt "Where would you like to put the djpegGUI application?")
   (help "djpegGUI will be installed in the directory that you "
         "choose. A good place would be where you keep your "
	 "other graphics programs.\n\n"
	 @askdir-help)
   (default guidir)))

;---------------------------------------------------------
; Copy the program and icon (checking for older versions)
;---------------------------------------------------------

(copylib (source "djpegGUI")
   (dest guidir)
   (prompt "About to copy djpegGUI")
   (help @copylib-help)
   (infos)
   (confirm))

(complete 25)

;---------------------------------------------------
; Ask user which documentation they want to install
;---------------------------------------------------

(set doctype 
   (askoptions (prompt "Select the type of documentation you wish to install"
   (help amigaguide " - Documentation suitable for viewing with AmigaGuide.\n"
                    "\n"
         ascii      " - Documentation suitable for viewing with More.\n"
                    "\n"
         djpegdoc   " - Documentation for the djpeg command line program.\n\n"
	 @askoptions-help)
   (choices amigaguide ascii djpegdoc)
   (default -1))))

;-------------------------------------------------------------------
; Get user's preferred installation directory for the documentation
;-------------------------------------------------------------------

(if (> doctype 0)
   (set docdir
    (askdir (prompt "Where would you like to put the djpegGUI documentation?")
    (help "The djpegGUI documentation will be installed in the directory "
         "you choose. (All files selected)\n\n"
	 @askdir-help)
    (default docdir))
   )
)

;------------------------
; Copy the documentation
;------------------------

(if (IN doctype 0)
   (
      ;----------------------
      ; Copy AmigaGuide docs
      ;----------------------

      (copylib (source "djpegGUI.guide") (dest docdir)
         (prompt "About to copy djpegGUI.guide")
         (help @copylib-help)
         (infos)
         (confirm)
      )

      (set tempdir  (tackon guidir appname))
      (set tempdir2 (tackon docdir "djpegGUI.guide"))

      ;----------------------
      ; Set tooltype to docs
      ;----------------------

      (tooltype (prompt "Setting " helptool " tooltype")
          (help "The HELP tool type specifies the path to the AmigaGuide file.")
          (dest tempdir)
          (settooltype helptool tempdir2)
          (noposition)
          (confirm)
      )
   )
)

(if (IN doctype 1)
   ( 
      ;-------------------
      ; Copy regular docs
      ;-------------------

      (copylib (source "djpegGUI.doc") (dest docdir)
         (prompt "About to copy djpegGUI.doc")
         (help @copylib-help)
         (infos)
         (confirm)
      )
   )
)

(complete 50)

(if (IN doctype 2)
   (
      ;---------------------
      ; Copy djpeg man page
      ;---------------------

      (copyfiles (source "djpeg.man") (dest docdir)
         (prompt "About to copy djpeg.man")
         (help "Documentation for the djpeg command line program.\n\n"
            @copyfiles-help)
         (infos)
         (confirm)
      )
   )
)

(complete 75)

;---------------------------
; Install djpeg program
;---------------------------

(set dodjpeg (askbool (prompt "Should I install the \"djpeg\" program?")
	(help "The \"djpeg\" command line program will be copied to the "
	      "directory you specify. If you already have \"djpeg\" "
              "installed, you may skip this part.\n\n"
	      @askbool-help)
	(default 1))
)

(complete 90)

(if (= 1 dodjpeg)
   (
      ;-------------------------
      ; Get directory for djpeg
      ;-------------------------

      (set djpegdir (askdir (prompt "Select a directory to install \"djpeg\" in")
         (help "Select the directory you would like to install the \"djpeg\" command line program in."
            "\n\n"
            @askdir-help)
         (default djpegdir))
      )
      ;--------------
      ; Copy "djpeg"
      ;--------------

      (copyfiles (source "djpeg") (dest djpegdir)
         (prompt "About to copy \"djpeg\"")
         (help @copyfiles-help)
         (infos)
         (confirm)
      )
      ;--------------
      ; Set tooltype
      ;--------------

      (set tempdir  (tackon guidir appname))

      (tooltype (prompt "Setting " djpegtool " tooltype")
         (help "The DJPEGPATH tooltype specifies the path to the djpeg "
            "command line program.")
	 (dest tempdir)
	 (settooltype djpegtool djpegdir)
         (noposition)
         (confirm)
      )
   ) ; else
   (
      (set dopath (askbool (prompt "Would you like to specify a path to the \"djpeg\" program?")
	(help "The \"djpeg\" command line program must either be in your "
	      "current Workbench path, or you must specify the path by "
              "setting the DJPEGPATH tooltype.\n\n"
	      @askbool-help)
	(default 1))
      )
      
      (if (= 1 dopath)
         (
            ;-------------------
            ; Get path to djpeg
            ;-------------------

            (set djpegdir (askdir (prompt "Select path to \"djpeg\":")
               (help "Select the full path to the \"djpeg\" command line program."
                     "\n\n"
	             @askdir-help)
            (default djpegdir))
            )

            (set tempdir  (tackon guidir appname))

            (tooltype (prompt "Setting " djpegtool " tooltype")
               (help "The DJPEGPATH tooltype specifies the path to the djpeg "
                     "command line program.")
	       (dest tempdir)
	       (settooltype djpegtool djpegdir)
               (noposition)
               (confirm)
            )
         )
      )
   )
)

(complete 100)
