; $VER: Install NewEdit 1.15 © Uwe Röhm (20. September 1995)

(complete 0)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; NAMING SECTION
;
; first of all I set some vars to file names. This will help me changing
; names easily.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
( set #NewEdit "NewEdit" )           ; name of the game
( set #Calculus "calculus.library" ) ; name of help library

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; LANGUAGE SECTION
;
; to support more than only one language, there is a special section for
; each supported language.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
(if (AND (<> @language "english") (<> @language "deutsch"))
   (set @language "english")
)

;=============================================================================
; English strings
;=============================================================================
(if (= @language "english") (

   (set default_lang 4)

   (set #bad-kick
   (cat "You must use at least Kickstart 2.0 to install " #NewEdit
   ))

   (set #introduction
   (cat "This program will install the commodity " #NewEdit ", "
        "which improves the functionality of all string gadgets "
        "in the system. Please read the guide for details.\n\n"
        "The installation takes care of the operating system "
        "version and doesn't change any important file or directory "
        "without your permission."
   ))

   (set #ask-installdir
   (cat "Please choose a directory, where " #NewEdit
        " should be installed."
   ))

   (set #ask-installdir-help
   (cat "You have to choose a directory, where the software will be copied. "
        "This directory must exist. Please create one, if necessary. "
   ))

   (set #ask-catalogdir
   (cat "Please choose a directory, where " #NewEdit "'s catalog"
        " should be installed."
   ))

   (set #ask-catalogdir-help
   (cat "You have to choose a directory, where the catalog file will be copied. "
        "This directory must exist. Please create one, if necessary. "
   ))

   (set #ask-guidedir
   (cat "Please choose a directory, where " #NewEdit "'s documentation"
        " should be installed."
   ))

   (set #ask-guidedir-help
   (cat "You have to choose a directory, where the documentation will be copied. "
        "This directory must exist. Please create one, if necessary.\n\n"
        "At the moment there's only a german AmigaGuide file. The english "
        "documentation is only available as a text file. Sorry ;-)"
   ))

   (set #ask-libsdir
   (cat "Please choose the directory, where the " #Calculus
        " should be installed."
   ))

   (set #ask-libsdir-help
   (cat "You have to choose a directory, where the " #Calculus " will be copied. "
        "Normally this will be \"libs:\".\n\n"
        "The choosed directory must exist. Please create one, if necessary."
   ))

   (set #ask-tooltypemask
   (cat "Which options of " #NewEdit " do you want to enable?"
   ))

   (set #ask-tooltypemask-help
   (cat #NewEdit " can be configurated with 10 options. "
        "Here the first four are presented.\n\n"
        "As some key combinations may be in use by other tools too, "
        "you can disable the use of the right Alt or the right Amiga key as "
        "command invoking key. The same holds for the control key. "
        "Additionally you can switch off the Escape key, which " #NewEdit
        " would normally use to leave a string gadget."
   ))

   (set #No-Right-Alt   "Don't use right Alt key")
   (set #No-Right-Amiga "Don't use right Amiga key")
   (set #No-Control     "Disable Control-key-commands")
   (set #No-Escape      "No leaving of gadgets with Escape")
   
   (set #ask-clipunit
   (cat "Please specify the clipboard unit to use for the "
        "copy/paste feature of " #NewEdit
   ))
   
   (set #ask-clipunit-help
   (cat #NewEdit " extends the string gadgets so that text can "
        "be exchanged between them and the clipboard. The clipboard "
        "is organised into different units from 0 to 255. Unit 0 "
        "is the default unit used by most programs and AmigaOS itself. "
        "I would recommend to leave the clip unit 0 which is the "
        "default value in " #NewEdit"."
   ))

   (set #ask-keys 
   (cat "Do you want to customize the command keys of " #NewEdit "?" 
   ))
   (set #ask-keys-help 
   (cat "There are five functions of " #NewEdit " for which you can specify "
        "the command keys. If you answer with 'Yes' you will be asked for "
        "these five keys. Else the default settings are used."
   ))

   (set #ask-calc-key
   (cat "Which key should be used to evaluate a string gadgets contents "
        "as mathematical expression?"
   ))

   (set #ask-calc-key-help
   (cat "Please enter one single character as the command key to evaluate "
        "a string gadgets contents as a mathematical expression. "
        "Normally this function will be invoked with the combination 'right Alt e' "
        "or 'right Amiga e'.\n\n"
        "Currently you can only enter one character to alter the command key "
        "of the function. Especially the command qualifiers 'right Alt' or "
        "'right Amiga' can not bechanged."
   ))

   (set #ask-case-key
   (cat "With which key do you want to toggle the case of single characters?"
   ))

   (set #ask-case-key-help
   (cat "Please enter one single character as the command key to toggle "
        "the case of characters in a string gadget. "
        "Normally this function will be invoked with the combination 'right Alt g' "
        "or 'right Amiga g'.\n\n"
        "Currently you can only enter one character to alter the command key "
        "of the function. Especially the command qualifiers 'right Alt' or "
        "'right Amiga' can not bechanged."
   ))

   (set #ask-count-key
   (cat "With which key do you want to increase and decrease a numbered file name?"
   ))

   (set #ask-count-key-help
   (cat "Please enter one single character as the command key to increase or "
        "decrease the count of a numbered file name."
        "Normally this function will be invoked with the combination 'right Alt i' "
        "or 'right Amiga i'.\n\n"
        "Currently you can only enter one character to alter the command key "
        "of the function. Especially the command qualifiers 'right Alt' or "
        "'right Amiga' can not bechanged."
   ))

   (set #ask-date-key
   (cat "Which key should insert the current date?"
   ))

   (set #ask-date-key-help
   (cat "Please enter one single character as the command key to insert "
        "the current date in a string gadget. "
        "Normally this function will be invoked with the combination 'right Alt d' "
        "or 'right Amiga d'.\n\n"
        "Currently you can only enter one character to alter the command key "
        "of the function. Especially the command qualifiers 'right Alt' or "
        "'right Amiga' can not bechanged."
   ))

   (set #ask-time-key
   (cat "Which key should insert the current time?"
   ))

   (set #ask-time-key-help
   (cat "Please enter one single character as the command key to insert "
        "the current time into a string gadget."
        "Normally this function will be invoked with the combination 'right Alt t' "
        "or 'right Amiga t'.\n\n"
        "Currently you can only enter one character to alter the command key "
        "of the function. Especially the command qualifiers 'right Alt' or "
        "'right Amiga' can not bechanged."
   ))

   )
) ; if english

;=============================================================================
; German strings
;=============================================================================
(if (= @language "deutsch") (

   (set default_lang 2)

   (set #bad-kick
   (cat "Sie müssen Kickstart 2.0 (oder höher) zum Installieren von "
        #NewEdit " benutzen."
   ))

   (set #introduction
   (cat "Sie installieren nun das Hilfsprogramm " #NewEdit ", "
        "das die Fähigkeiten aller Texteingabefelder im System "
        "erweitert. Näheres steht in der beiliegenden Anleitung.\n\n"
        "Die Installation nimmt alle notwendigen Schritte vor "
        "und beachtet auch die aktuelle Betriebssystemversion. "
        "Es werden bei der Installation ohne Nachfrage keine System-Dateien "
        "verändert."
   ))

   (set #ask-installdir
   (cat "Bitte geben Sie ein Verzeichnis an, in welchem " #NewEdit
        " installiert werden soll."
   ))

   (set #ask-installdir-help
   (cat #NewEdit " wird in das Verzeichnis kopiert, das Sie angeben. "
        "Sollte das Verzeichnis noch nicht existieren, legen Sie "
        "es bitte an."
   ))

   (set #ask-catalogdir
   (cat "Bitte geben Sie ein Verzeichnis an, in welches die Catalog-Datei "
        "zu " #NewEdit " kopiert werden soll."
   ))

   (set #ask-catalogdir-help
   (cat "Damit " #NewEdit " deutsche Fehlermeldungen und Texte ausgibt, "
        "benötigt es seine deutsche Catalog-Datei. Diese wird normalerweise "
        "in \"Locale:Catalogs/deutsch/\" gespeichert.\n\n"
        "Sollte das gewünschte Verzeichnis noch nicht existieren, legen Sie "
        "es bitte an."
   ))

   (set #ask-guidedir
   (cat "Bitte geben Sie ein Verzeichnis an, in welches die Dokumentation "
        "zu " #NewEdit " kopiert werden soll."
   ))

   (set #ask-guidedir-help
   (cat "Die Dokumentation liegt im AmigaGuide-Format vor. Sie wird "
        "in das Verzeichnis kopiert, das Sie angeben. "
        "Sollte das Verzeichnis noch nicht existieren, legen Sie "
        "es bitte an."
   ))

   (set #ask-libsdir
   (cat "Bitte geben Sie ein Verzeichnis an, in welches die " #Calculus
       " kopiert werden soll."
   ))

   (set #ask-libsdir-help
   (cat "Um mathematische Formeln in Eingabefeldern ausrechnen zu können, "
        "benötigt " #NewEdit " die " #Calculus ". Das Programm kann aber auch "
        "ohne diese Library verwendet werden.\n\n"
        "Die " #Calculus " wird in das Verzeichnis kopiert, das Sie angeben, "
        "sofern nicht bereits eine neuere Version installiert ist. "
        "Normalerweise sollte es \"libs:\" sein. Sollte das gewünschte "
        "Verzeichnis noch nicht existieren, legen Sie es bitte an."
   ))

   (set #ask-tooltypemask
   (cat "Welche Optionen von " #NewEdit " wollen Sie ändern?"
   ))
   (set #ask-tooltypemask-help
   (cat #NewEdit " kann mit insgesamt zehn Optionen konfiguriert werden. "
        "Sie können hier die ersten vier an Ihre Bedürfnisse anpassen.\n\n"
        "Da einige Tastenkombinationen auch von anderen Programmen belegt "
        "sein können, können Sie die Verwendung der rechten Alt und/oder "
        "der rechten Amiga Taste als Kommandotaste abschalten. Dasselbe "
        "gilt für die zusätzlichen Funktionen von " #NewEdit ", die mit "
        "der Control-Taste aufgerufen werden. Außerdem können Sie verhindern, "
        "daß man mit der Escape-Taste ein Texteingabefeld verlassen kann."
   ))

   (set #No-Right-Alt   "Rechte Alt-Taste nicht verwenden")
   (set #No-Right-Amiga "Rechte Amiga-Taste nicht verwenden")
   (set #No-Control     "Control-Tastenkomandos nicht verwenden")
   (set #No-Escape      "Kein Eingabeende mit Escape")
   
   (set #ask-clipunit
   (cat "Bitte geben Sie die Einheit des Clipboards an, die "
        "für das Kopieren von Text zwischen Eingabefeldern "
        "verwendet werden soll."
   ))
   
   (set #ask-clipunit-help
   (cat #NewEdit " erweitert Texteingabefelder um die Möglichkeit, "
        "Texte zwischen ihnen über das Clipboard auszutauschen. Das "
        "Clipboard bietet dazu mehrere Einheiten an, in die Texte "
        "gespeichert werden können. Per Voreinstellung würde " #NewEdit
        " Einheit 0 verwenden, die auch sonst im System im allgemeinen "
        "zum Datenaustausch benutzt wird."
   ))

   (set #ask-keys 
   (cat "Möchten Sie die " #NewEdit "s Tastenbelegung ändern?" 
   ))
   (set #ask-keys-help 
   (cat "Derzeit können die Tasten von fünf Funktionen, die " #NewEdit 
        " anbietet, frei konfiguriert werden. Wenn Sie jetzt mit 'Ja' "
        "antworten, werden Sie nach den alternativen Belegungen für diese "
        "fünf Funktionen befragt. Sonst benutzt " #NewEdit " die Vorgabewerte.\n\n"
        "Für alle Tasten kann derzeit nur ein Buchstabe angegeben werden, "
        "die jeweiligen Kommandotasten (rechte Alt und rechte Amiga) können "
        "nicht geändert werden." 
   ))

   (set #ask-calc-key
   (cat "Mit welche Taste soll das Auswerten des Inhalts eines Textfeldes "
        "als mathematischer Ausdruck gestartet werden?"
   ))

   (set #ask-calc-key-help
   (cat "Bitte geben Sie die Taste an, mit der der jeweilige Inhalt eines "
        "Texteingabefeldes als mathematischer Ausdruck ausgewertet und "
        "durch sein Ergebnis ersetzt werden soll. Normalerweise wird dies "
        "mit der Kombination 'rechte Alt e' oder 'rechte Amiga e' erreicht.\n\n"
        "Sie können derzeit nur den einen Buchstaben verändern, "
        "die jeweiligen Kommandotasten (rechte Alt und rechte Amiga) können "
        "nicht geändert werden." 
   ))

   (set #ask-case-key
   (cat "Mit welche Taste wollen Sie die Groß-/Kleinschreibung "
        "von Buchstaben ändern können?"
   ))

   (set #ask-case-key-help
   (cat "Bitte geben Sie eine einzelne Taste an, mit der Sie zwischen Groß- "
        "und Kleinschreibung einzelner Buchstaben umschalten wollen. "
        "Normalerweise wird dies mit der Kombination 'rechte Alt g' oder "
        "'rechte Amiga g' erreicht.\n\n"
        "Sie können derzeit nur den einen Buchstaben verändern, "
        "die jeweiligen Kommandotasten (rechte Alt und rechte Amiga) können "
        "nicht geändert werden." 
   ))

   (set #ask-count-key
   (cat "Mit welche Taste wollen Sie nummerierte Dateinamen erhöhen, "
        "bzw. erniedrigen?"
   ))

   (set #ask-count-key-help
   (cat "Bitte geben Sie eine einzelne Taste an, mit der Sie die Nummer "
        "eines durchnummerierten Dateinamens hoch- und runterzählen können. "
        "Normalerweise wird dies mit der Kombination 'rechte Alt i' oder "
        "'rechte Amiga i' erreicht.\n\n"
        "Sie können derzeit nur den einen Buchstaben verändern, "
        "die jeweiligen Kommandotasten (rechte Alt und rechte Amiga) können "
        "nicht geändert werden." 
   ))

   (set #ask-date-key
   (cat "Mit welche Taste wollen Sie das aktuelle Datum einfügen?"
   ))

   (set #ask-date-key-help
   (cat "Bitte geben Sie eine einzelne Taste an, mit der Sie das jeweils "
        "aktuelle Datum in ein Texteingabefeld einfügen können. "
        "Normalerweise ist dies mit der Kombination 'rechte Alt d' oder "
        "'rechte Amiga d' möglich.\n\n"
        "Sie können derzeit nur den einen Buchstaben verändern, "
        "die jeweiligen Kommandotasten (rechte Alt und rechte Amiga) können "
        "nicht geändert werden." 
   ))

   (set #ask-time-key
   (cat "Mit welche Taste wollen Sie die aktuelle Uhrzeit einfügen?"
   ))

   (set #ask-time-key-help
   (cat "Bitte geben Sie eine einzelne Taste an, mit der Sie die jeweils "
        "aktuelle Uhrzeit in ein Texteingabefeld einfügen können. "
       "Normalerweise ist dies mit der Kombination 'rechte Alt t' oder "
        "'rechte Amiga t' möglich.\n\n"
        "Sie können derzeit nur den einen Buchstaben verändern, "
        "die jeweiligen Kommandotasten (rechte Alt und rechte Amiga) können "
        "nicht geändert werden." 
   ))
   )
) ; if deutsch


;=============================================================================
; make sure we are running under V37

(if (< (/ (getversion) 65536) 37) (abort #bad-kick))

;******************************************************************
;******************* FULL INSTALL *********************************
;******************************************************************

;=============================================================================
; say hi!
;=============================================================================
(welcome)

;=============================================================================
; what we will do the next time together
;=============================================================================
(message #introduction)

;=============================================================================
; first we will get the dirs we need
;=============================================================================
(set old_level @user-level)
(set sourcedir (pathonly @icon))
(set #defaulttarget "Sys:WBStartup")
(set target (askdir (prompt  #ask-installdir)
                    (help    #ask-installdir-help)
                    (default #defaulttarget)
            )
)
(set @default-dest target)

;=============================================================================
; copy the program itself
;=============================================================================
(copyfiles (source "NewEdit")
           (dest   target)
           (infos)
)
(complete 10)

;=============================================================================
; copy the catalog file(s)
;=============================================================================
(if (<> @language "english") 
  (

    (set #defcattarget (tackon "Locale:Catalogs/" @language))
    (set cattarget (askdir (prompt  #ask-catalogdir)
                           (help    #ask-catalogdir-help)
                           (default #defcattarget)
                   )
    )
    (copyfiles (source (tackon "catalogs/" (tackon @language "NewEdit.catalog")))
               (dest   cattarget)
    )
  )
)
(complete 20)

;=============================================================================
; ask for the options to use
;=============================================================================
(if (>= @user-level 1)
  (
    (set tooltypemask (askoptions (prompt  #ask-tooltypemask)
                                  (help    #ask-tooltypemask-help)
                                  (choices #No-Right-Alt
                                           #No-Right-Amiga
                                           #No-Control
                                           #No-Escape
                                  )
                                  (default %0000)
                      )
    )
    (if (IN tooltypemask 0)
        (tooltype (settooltype "NOALT" "1")
                  (dest        (tackon target #NewEdit))
        ) 
    )
    (if (IN tooltypemask 1)
        (tooltype (settooltype "NOAMIGA" "1")
                  (dest        (tackon target #NewEdit))
        ) 
    )
    (if (IN tooltypemask 2)
        (tooltype (settooltype "NOCONTROL" "1")
                  (dest        (tackon target #NewEdit))
        ) 
    )
    (if (IN tooltypemask 3)
        (tooltype (settooltype "NOESC" "1")
                  (dest        (tackon target #NewEdit))
        ) 
    )

    (complete 30)

    ;=============================================================================
    ; ask for the clipboard unit
    ;=============================================================================
    (set unit     (asknumber  (prompt  #ask-clipunit)
                              (help    #ask-clipunit-help)
                              (range   0 255)
                              (default 0)
                  )
    )
    (if (<> unit 0)
        (tooltype (settooltype "CLIPUNIT" ("%s" unit))
                  (dest        (tackon target #NewEdit))
        ) 
    )

    (complete 40)

    ;=========================================================================
    ; ask for alternate keys
    ;=========================================================================
    (if (askbool    (prompt  #ask-keys)
                    (help    #ask-keys-help)
                    (default 0)
        )
    (
        ;=====================================================================
        ; ask for Calculus-Key
        ;=====================================================================
        (set key (askstring (prompt #ask-calc-key)
                            (help   #ask-calc-key-help)
                            (default "e")
                 )
        )
        (if (<> key "e")
            (tooltype (settooltype "CALCKEY" key)
                      (dest        (tackon target #NewEdit))
            )
        ) 
        (complete 48)

        ;=====================================================================
        ; ask for Case-Key
        ;=====================================================================
        (set key (askstring (prompt #ask-case-key)
                            (help   #ask-case-key-help)
                            (default "g")
                     )
        )
        (if (<> key "g")
            (tooltype (settooltype "CASEKEY" key)
                      (dest        (tackon target #NewEdit))
            )
        ) 
        (complete 56)

        ;=====================================================================
        ; ask for Count-Key
        ;=====================================================================
        (set key (askstring (prompt #ask-count-key)
                            (help   #ask-count-key-help)
                            (default "i")
                 )
        )
        (if (<> key "i")
            (tooltype (settooltype "COUNTKEY" key)
                      (dest        (tackon target #NewEdit))
            )
        ) 
        (complete 64)

        ;=====================================================================
        ; ask for Date-Key
        ;=====================================================================
        (set key (askstring (prompt #ask-date-key)
                            (help   #ask-date-key-help)
                            (default "d")
                 )
        )
        (if (<> key "d")
            (tooltype (settooltype "DATEKEY" key)
                      (dest        (tackon target #NewEdit))
            )
        ) 
        (complete 72)

        ;=====================================================================
        ; ask for Time-Key
        ;=====================================================================
        (set key (askstring (prompt #ask-time-key)
                            (help   #ask-time-key-help)
                            (default "t")
                 )
        )
        (if (<> key "t")
            (tooltype (settooltype "TIMEKEY" key)
                      (dest        (tackon target #NewEdit))
            )
        ) 
    )
    )

  ); IF user >= 1
)
(complete 80)

;=============================================================================
; copy the AmigaGuide documentation
;=============================================================================
(if (= @language "english") 
   (copyfiles (prompt  #ask-guidedir)
              (help    #ask-guidedir-help)
              (confirm "average")
              (source  "NewEdit.doc")
              (dest    target)
              (infos)
   )
   (copyfiles (prompt  #ask-guidedir)
              (help    #ask-guidedir-help)
              (confirm "average")
              (source  "NewEdit.guide")
              (dest    target)
              (infos)
   )
)
(complete 90)

;=============================================================================
; eventually copy the calculus.library
;=============================================================================
(copylib (prompt  #ask-libsdir)
         (help    #ask-libsdir-help)
         (confirm "average")
         (source  "libs/calculus.library")
         (dest    "Libs:")
)
(complete 100)

; **************************************************************************
; **************************************************************************
; **************************************************************************
(exit)
