; -------------------------------------------------------------------------
; $VER: LJ4Boost-Install 1.04 (19.06.95)
;
; Installer-Script for LJ4Boost V1.04
; Copyright  1995 by Oliver Hitz

; TEXTS -------------------------------------------------------------------

(set #lj4b-install
  (cat "\nLJ4Boost V1.04\n"
       "Installer Script\n\n"
       " 1995 by Oliver Hitz\n\n"
       "Click on >Continue< to proceed!\n"
  )
)

(set #lj4b-install-help
  (cat "This installer script installs the LJ4Boost Printer Driver Package V1.04\n\n")
)

(set #lj4b-icons
  (cat "\nInstall what style of icons?")
)

(set #lj4b-icons-help
  (cat "This option is for people that have installed MagicWB. Instead of copying MagicWB icons over the original icons, you may select MagicWB here, and a special set of icons, especially designed for LJ4Boost will be installed. NOTE: MagicWB is Copyright  1992-1994 by Martin Huttenloher.")
)

(set #lj4b-driver
  (cat "\nCopy the printer driver to DEVS:Printers?")
)

(set #lj4b-driver-help
  (cat "The printer driver is the main program of this package. It is copied to the other printer drivers which are in the directory DEVS:Printers.\n")
)

(set #lj4b-prefs
  (cat "\nCopy the preferences editor to SYS:Prefs?")
)

(set #lj4b-prefs-help
  (cat "The preferences editor lets you take control over some special features that this package offers.\n")
)

(set #lj4b-prefscat
  (cat "\nSelect which catalog files you would like to install.")
)

(set #lj4b-prefscat-help
  (cat "Unfortunately there are only three languages available at the moment. But this will (hopefully) change in future versions.\n")
)

(set #lj4b-drawer
  (cat "\nCreate a new drawer called LJ4Boost?\n"
       "\n(for registration-program and documentation)")
)

(set #lj4b-drawer-help
  (cat "If you select Create, a new drawer will be created. This is very useful, as it helps you to keep your system in order.")
)

(set #lj4b-doc
  (cat "\nInstall the documentation?")
)

(set #lj4b-doc-help
  (cat "Sometimes it is useful to have the documentation ready-to-use somewhere on the hard drive. The documentation is NOT needed by the program.")
)

(set #lj4b-register
  (cat "\nThe LJ4Boost Printer Driver Package\n"
       "is SHAREWARE. If you use it, you HAVE TO pay\n"
       "for it.\n\n"
       "Do you want to install the Registration-Utility?\n"
       "(It is suggested you install it in the same\n"
       "directory as the docs, because it can be started\n"
       "from the documentation)."
  )
)

(set #lj4b-register-help
  (cat "It is strongly recommended to install the Registration-Utility. After you have registered, you can of course delete it...")
)

(set #wrong-kick
  (cat "\nSorry, this package needs at least\n"
       "Kickstart version 2.0!\n\n"
  )
)

; VARS --------------------------------------------------------------------

(set sourcePath (expandpath (pathonly @icon)))

(set ver (/ (getversion "exec.library" (resident)) 65536))

; MAIN --------------------------------------------------------------------

(complete 0)
(if (> ver 36)

    ; Main question -------------------------------------------------

  (if (askbool (prompt #lj4b-install)
               (help #lj4b-install-help)
               (choices "Continue" "End Installation")
               (default 1)
      )
    (

    ; Icon style ----------------------------------------------------

      (set icons (askchoice (prompt #lj4b-icons)
                            (help #lj4b-icons-help)
                            (choices "original Workbench" "MagicWB")
                            (default 0)
                 )
      )

    ; Printer driver ------------------------------------------------

      (if (askbool (prompt #lj4b-driver)
                   (help #lj4b-driver-help)
                   (choices "Copy" "Skip This Part")
                   (default 1)
          )
          (
            (Copyfiles (source (tackon sourcePath "Devs/Printers/LJ4Boost"))
                       (dest "DEVS:Printers")
                       (infos)
            )
            (if (= icons 1)
                (Copyfiles (source (tackon sourcePath "MWBIcons/LJ4Boost.info"))
                           (dest "DEVS:Printers")
                )
            )
          )
      )

    ; Preferences Editor --------------------------------------------

      (complete 25)
      (if (askbool (prompt #lj4b-prefs)
                   (help #lj4b-prefs-help)
                   (choices "Copy" "Skip This Part")
                   (default 1)
          )
          (
            (Copyfiles (source (tackon sourcePath "Prefs/LJ4Boost"))
                       (dest "SYS:Prefs")
                       (infos)
            )
            (if (= icons 1)
                (Copyfiles (source (tackon sourcePath "MWBIcons/LJ4Boost-Prefs.info"))
                           (dest "SYS:Prefs")
                           (newname "LJ4Boost.info")
                )
            )
          )
      )

    ; Catalog files -------------------------------------------------

      (complete 40)
      (set catalogs (askoptions (prompt #lj4b-prefscat)
                                (help #lj4b-prefscat-help)
                                (choices "Deutsch"
                                         "Franais")
                                (default 0)
                    )
      )
      (set n 0)
      (while (set catalog (select n "deutsch"
                                    "franais"
                                    ""
                          )
             )
             (
                (if (IN catalogs n)
                    (
                      (Copyfiles (source (tackon sourcePath (tackon "Locale/Catalogs" (tackon catalog "lj4boostprefs.catalog"))))
                                 (dest (tackon "LOCALE:Catalogs" catalog))
                      )
                    )
                )
                (set n (+ n 1))
             ))


    ; Drawer --------------------------------------------------------

      (complete 50)
      (if (askbool (prompt #lj4b-drawer)
                   (help #lj4b-drawer-help)
                   (choices "Create" "Skip This Part")
                   (default 1)
          )
          (
            (set main-dest (askdir (prompt "Please select where to create a drawer.")
                                   (help @askdir-help)
                                   (default "SYS:Tools")
                           )
            )
            (makedir (tackon main-dest "LJ4Boost"))
            (if (= icons 1)
                (Copyfiles (source (tackon sourcePath "MWBIcons/Drawer.info"))
                           (dest main-dest)
                           (newname "LJ4Boost.info")
                           (infos)
                )
            )
            (set main-dest (tackon main-dest "LJ4Boost"))
          )
      )

    ; Documentation program -----------------------------------------

      (complete 60)
      (if (askbool (prompt #lj4b-doc)
                   (help #lj4b-doc-help)
                   (choices "Copy" "Skip This Part")
                   (default 1)
          )
          (if main-dest
              (
                (Copyfiles (source (tackon sourcePath "LJ4Boost.guide"))
                           (dest main-dest)
                           (infos)
                )
                (if (= icons 1)
                    (Copyfiles (source (tackon sourcePath "MWBIcons/LJ4Boost.guide.info"))
                               (dest main-dest)
                               (infos)
                    )
                )
              )
              (
                (set this-dest (askdir (prompt "Please select a place for the documentation.")
                                       (help @askdir-help)
                                       (default "SYS:Tools")
                               )
                )
                (Copyfiles (source (tackon sourcePath "LJ4Boost.guide"))
                           (dest this-dest)
                           (infos)
                )
                (if (= icons 1)
                    (Copyfiles (source (tackon sourcePath "MWBIcons/LJ4Boost.guide.info"))
                               (dest this-dest)
                               (infos)
                    )
                )
              )
          )
      )

    ; Registration Tool ---------------------------------------------

      (complete 75)
      (if (askbool (prompt #lj4b-register)
                   (help #lj4b-register-help)
                   (choices "Copy" "Skip This Part")
                   (default 1)
          )
          (if main-dest
              (
                (Copyfiles (source (tackon sourcePath "LJ4Boost-Register"))
                           (dest main-dest)
                           (infos)
                )
                (if (= icons 1)
                    (Copyfiles (source (tackon sourcePath "MWBIcons/LJ4Boost-Register.info"))
                               (dest main-dest)
                               (infos)
                    )
                )
              )
              (
                (set this-dest (askdir (prompt "Please select a place for the registration utility.")
                                       (help @askdir-help)
                                       (default this-dest)
                               )
                )
                (Copyfiles (source (tackon sourcePath "LJ4Boost-Register"))
                           (dest this-dest)
                           (infos)
                )
                (if (= icons 1)
                    (Copyfiles (source (tackon sourcePath "MWBIcons/LJ4Boost-Register.info"))
                               (dest this-dest)
                               (infos)
                    )
                )
              )
          )
      )
      (complete 99)
    )
  )
  (abort #wrong-kick)
)
(set @default-dest "DEVS:Printers")

