; INSTALLERSCRIPT for DITO 4.0+
; (C)opyright by Dirk Holtwick, 1996
; -----------------------------------------

(message
   "\nDITO 4.0\n\n"
   "© Dirk Holtwick, 1996\n"
   "MUI © Stefan Stuntz, 1992-1996\n"
   "TextField © Mark Thomas, 1995\n"
   "Config © Adam Daves, 1996\n\n"
   "DITO is a very flexible learning system for "
   "languages. Notice that it is SHAREWARE and that "
   "you have to pay a fee of 30 DM or $20 to the author, if you "
   "want to use it frequently. In the demo version some "
   "functions are not fully functional.\n\n"
   "Enjoy it, Dirk"
)

;
; dito.library
; ------------

(complete 0)

(copylib
   (prompt "Copying dito.library")
   (help @copylib-help)
   (source "dito.library")
   (dest "LIBS:")
   (confirm)
)

;
; textfield.gadget
; ----------------

(complete 10)

(copylib
   (prompt "Copying TextField.gadget")
   (help @copylib-help)
   (source "gadgets/textfield.gadget")
   (dest "SYS:Classes/Gadgets/")
   (confirm)
)

;
; phonetics.font
; --------------

(complete 20)

(set #fonts-prompt "Do you want to install the \"phonetics.font\"?")
(set #fonts-help
   (cat "This font will be used as the default font of the \"phonetics"
      " gadget\". If you want to use this feature, it is recommended to"
      " install this font\n"
   )
)
(set #fixfonts-prompt "The FixFonts utility will be run to make the newly added fonts available.")
(set #fixfonts-help
   (cat "The FixFonts utility is needed to make the newly added fonts available to the system.\n\n"
      "If you intend to use the fonts from this archive, you are strongly encouraged to "
      "run FixFonts now.\n\n"
      "Note that running this program may take a while."
   )
)

; Only ask if fonts should be installed in expert mode
(if
   (< @user-level 2)
   (set #fonts 1)
   (set #fonts
      (askbool
         (prompt #fonts-prompt)
         (help #fonts-help)
         (choices "Yes" "No")
         (default 1)
      )
   )
)
(if
   (> #fonts 0)
   (
      (copyfiles
         (source "Fonts")
         (dest "Fonts:")
         (choices "phonetics")
         (prompt "Installing font")
      )
      (run "SYS:System/FixFonts"
         (confirm)
         (prompt #fixfonts-prompt)
         (help #fixfonts-help)
      )
   )
)

;
; Copy all files
; --------------

(complete 50)

(set destname
   (askdir
      (prompt "Where do you want to install DITO (a directory will be created)")
      (help @askdir-help)
      (default "Work:")
   )
)

(set destname (tackon destname "DITO"))

(makedir
   destname
   (infos)
)

(copyfiles
   (prompt "Copying all files")
   (help @copyfiles-help)
   (pattern "~(dito.library|gadgets|fonts|install#?|readme#?)")
   (source "")
   (dest destname)
)

;
; Modify Startup-Sequence
; -----------------------

(complete 95)

(startup "DITO"
   (prompt
      "One ASSIGN has to be added to the \"S:user-startup\" so that your system will be properly configured to use DITO.")
   (help "An assign called DITO: will be added. If you don't use this "
      "option, your system may not work properly on your machine.")
   (command "assign DITO: " destname "\n")
)

;
; Exit
; ----

(exit
   "The installation is now complete. Please don't forget to "
   "register:)\n\n"
   "If you have problems, just press HELP in any application.\n\n"
   "Yours Dirk"
)

