; $VER: GoldED Studio 6.2.4 (14.10.1999)

(delopts "oknodelete" "force" "askuser")

; -------------------------------- set constants -------------------------------

(set @studio_found                   1  )
(set @studio_missing                 0  )

(set @studio_installtype_minimum     0  )
(set @studio_installtype_user        1  )
(set @studio_installtype_normal      2  )

(set @studio_components_golded       1  )
(set @studio_components_starter      2  )
(set @studio_components_docs         4  )
(set @studio_components_addons       8  )
(set @studio_components_developer    16 )
(set @studio_components_screenshot   32 )
(set @studio_components_recover      64 )
(set @studio_components_config       128)
(set @studio_components_all          255)

(set @studio_preset_display          1  )
(set @studio_preset_interface        2  )
(set @studio_preset_hunter           4  )
(set @studio_preset_printer          8  )
(set @studio_preset_context          16 )
(set @studio_preset_syntax           32 )
(set @studio_preset_layout           64 )
(set @studio_preset_mouse            128)
(set @studio_preset_menu             256)

(set @studio_preset_api              1  )
(set @studio_preset_project          2  )
(set @studio_preset_references       4  )
(set @studio_preset_gadgets          8  )
(set @studio_preset_tabs             16 )
(set @studio_preset_keyboard         32 )
(set @studio_preset_templates        64 )
(set @studio_preset_misc             128)
(set @studio_preset_dictionary       256)

(set @studio_cpu_68000               0  )
(set @studio_cpu_68020               1  )
(set @studio_cpu_68030               2  )
(set @studio_cpu_68040               3  )
(set @studio_cpu_68060               4  )

(set @studio_addons_envwww           1  )
(set @studio_addons_envgde           2  )
(set @studio_addons_envthe           4  )
(set @studio_addons_envstm           8  )
(set @studio_addons_envsas           16 )
(set @studio_addons_envcpp           32 )

(set @studio_addons_envasm           1  )
(set @studio_addons_envbat           2  )
(set @studio_addons_envfax           4  )
(set @studio_addons_envmdt           8  )
(set @studio_addons_envthr           16 )
(set @studio_addons_envjcy           32 )

(set @studio_addons_envprt           1  )
(set @studio_addons_envrcs           2  )
(set @studio_addons_envins           4  )
(set @studio_addons_envwrp           8  )
(set @studio_addons_envreg           16 )
(set @studio_addons_envswp           32 )

(set @studio_addons_envrex           1  )

(set @updatemode_reinstall           0  )
(set @updatemode_add                 1  )
(set @updatemode_remove              2  )
(set @updatemode_presets             3  )
(set @updatemode_registry            4  )
(set @updatemode_startup             5  )
(set @updatemode_exit                6  )

(set @studio_starter_ed              1  )
(set @studio_starter_appicon         2  )

(set @studio_manual_history          1  )
(set @studio_manual_licence          2  )
(set @studio_manual_order            4  )
(set @studio_manual_english          8  )
(set @studio_manual_german           16 )

; -------------------------------- set variables -------------------------------

(set studio_found         @studio_missing)
(set studio_updatemode    @updatemode_components)
(set studio_registered    0)
(set studio_yourname     "")
(set studio_serial       "")
(set studio_path         "")
(set studio_update       "")
(set studio_language     "")
(set studio_regedit      "")
(set studio_components    0)
(set studio_starter       0)
(set studio_manual        0)
(set studio_addons_a      0)
(set studio_addons_b      0)
(set studio_addons_c      0)
(set studio_addons_d      0)
(set studio_reboot        0)

; -------------------------------- set strings ---------------------------------

(if (= @installer-version 0)

    (set #studio_esc "")
    (set #studio_esc "[2p")
)

(if (= @language "deutsch")

    (
        (set #studio_reboot "Bitte starten Sie den Rechner nach der Installation neu !")

        (set #studio_cderr "Datei nicht gefunden. Das installierte CD-Dateisystem ist fehlerhaft oder inkompatibel. Weitere Informationen finden Sie in der FAQ-Datei.")

        (set #studio_filenotfound "Datei nicht gefunden.")

        (set #studio_demo "GoldED Studio kann nicht ber diese Version installiert werden (Demoversion und Vollversion sind nicht kompatibel). Deinstallieren Sie zuerst GoldED oder installieren Sie in ein anderes Verzeichnis.")

        (set #studio_rexxerr "Warnung: Die ARexx-Installation ist unvollstndig.Die folgende Datei konnte nicht gefunden werden: ")

        (set #studio_overwrite "An dieser Stelle existiert schon ein Verzeichnis mit dem Namen Studio ! Soll mit der Installation in dieses Verzeichnis fortgefahren werden ?")

        (set #studio_overwrite_help "Mglicherweise gehrt dieses Verzeichnis zu einem anderen Programm oder einer lteren unvollstndigen Installation.")

        (set #studio_overwrite_install "Installieren")

        (set #studio_overwrite_cancel "Anderes Verzeichnis whlen")

        (set #studio_badkick "Dieses Programm bentigt AmigaOS 3 !")

        (set #studio_notify "Whrend der letzten Installation ist ein Fehler aufgetreten. Wir empfehlen die Wiederholung einer Minimalinstallation in ein neues Verzeichnis. Beenden Sie bitte vor der erneuten Installation alle laufenden Programme !")

        (set #studio_welcome "Willkommen beim GoldED Studio Setup !\n\nMit diesem Programm wird GoldED Studio auf Ihrem Computer installiert. Es wird dringend empfohlen, alle anderen Programme zu beenden, bevor Sie mit dem Setup fortfahren.\n\nWARNUNG: Diese Software ist durch das nationale und internationale Urheberrecht geschtzt. Unerlaubter Vertrieb oder Verleih der Software oder einer ihrer Komponenten wird verfolgt.")

        (set #studio_installerr "Whrend der Installation ist ein Fehler aufgetraten. Eine Beschreibung der Fehlerursache finden Sie in der Log-Datei im T:-Verzeichnis, sofern Sie zu Beginn der Installation die Option LOGDATEI ERZEUGEN gewhlt haben. Der Fehlercode ist: ")

        (set #studio_yourname "Geben Sie Ihren Namen ein:")

        (set #studio_yourname_help "Die Eingabe des Namens ist zur Produktregistrierung erforderlich. Ohne Registrierung knnen Sie diese Software nicht installieren.")

        (set #studio_serial "Geben Sie die Seriennummer ein:")

        (set #studio_serial_help "Sie finden die Seriennummer auf der Registrierkarte. Die Seriennummer besteht aus 21 Zeichen, die unter Beachtung der Gro- und Kleinschreibung eingegeben werden mssen.")

        (set #studio_check "Ist diese Angabe korrekt ?\n\n%s, %s")

        (set #studio_check_continue "Korrekt")

        (set #studio_check_repeat "Eingabe wiederholen")

        (set #studio_found "Willkommen beim GoldED Studio Setup !\n\nMit diesem Programm wird GoldED Studio auf Ihrem Computer installiert oder aktualisiert. Es wird dringend empfohlen, alle anderen Programme zu beenden, bevor Sie mit dem Setup fortfahren.\n\nDas Programm wurde schon einmal installiert:\nWhlen Sie AKTUALISIEREN, um Komponenten hinzuzufgen oder zu entfernen. Whlen Sie ANDERES VERZEICHNIS, um die Installation an anderer Stelle zu wiederholen.")

        (set #studio_found_help "AKTUALISIEREN\n\nndert die vorhandene Installation. Dort vorhandne Komponenten werden im weiteren Verlauf dieser Installation aktualisiert.\n\nANDERES VERZEICHNIS\n\nDie Installation erfolgt in ein anderes Verzeichnis. Eine vorhandene Installation an anderer Stelle bleibt erhalten. Sie sollten von dieser Mglichkeit nur Gebrauch machen, wenn mit der vorhandenen Installation Probleme auftauchen, die eine Aktualisierung nicht ratsam erscheinen lassen.")

        (set #studio_found_confirm "AKTUALISIEREN")

        (set #studio_found_newinstall "Anderes Verzeichnis")

        (set #studio_path_choose "Whlen Sie einen Pfad fr die Installation. In dem gewhlten Pfad wird ein Verzeichnis fr GoldED Studio erzeugt:")

        (set #studio_path_choose_help "Der Speicherplatzbedarf auf dem gewhlten Medium hngt von dem weiteren Installationsablauf ab. Maximal werden 30 MB Speicherplatz bentigt.")

        (set #studio_installtype "Whlen Sie die gewnschte Installationsart:")

        (set #studio_installtype_help "Sie knnen spter jederzeit einzelen Komponeten nachinstallieren oder installierte Komponenten entfernen, indem Sie das Setup-Programm erneut ausfhren.")

        (set #studio_installtype_minimum "Minimalinstallation (500 KB)")
        (set #studio_installtype_user    "Benutzerdefiniert (bis zu 25 MB)")
        (set #studio_installtype_normal  "Typische Installation (2 MB)")

        (set #studio_checking "berprfen der vorhandenen Installation ...")

        (set #studio_updatemode_reinstall "Installation aktualisieren")
        (set #studio_updatemode_add       "Komponenten hinzufgen")
        (set #studio_updatemode_remove    "Komponenten entfernen")
        (set #studio_updatemode_presets   "Grundeinstellungen installieren")
        (set #studio_updatemode_registry  "Registry wiederherstellen")
        (set #studio_updatemode_startup   "User-Startup korrigieren")
        (set #studio_updatemode_exit      "Setup beenden")

        (set #studio_updatemode_help

            (cat

                "INSTALLATION AKTUALISIEREN\n\n"

                "Die bisher installierten Komponenten (mit Ausnahme der Grundseinstellungen) werden neu installiert.\n\n"

                "KOMPONENTEN HINZUFGEN/ENTFERNEN\n\n"

                "ndert die vorhandene Installation durch Hinzufgen oder Entfernen einzelner Komponenten (Add-Ons, Dokumentationen, usw.).\n\n"

                "GRUNDEINSTELLUNGEN INSTALLIEREN\n\n"

                "Erlaubt die selektive Installation von Einstellungen (Menu, Farben, usw). Der Editor verwendet die Grundeinstellungen, wenn normale Texte bearbeitet werden, fr die kein besonderer Dateityp definiert wurde.\n\n"

                "REGISTRY WIEDERHERSTELLEN\n\n"

                "Stellt die zentrale Konfigurationsdatei wieder her. Sie verlieren dadurch alle globalen Einstellungen im Editor sowie weiterhin alle Dateitypen mit Ausnahme des Dateityps TEXT !\n\n"

                "USER-STARTUP KORRIGIEREN\n\n"

                "Es wird der notwendige Assign auf das Verzeichnis des Editors eingerichtet."
            )
        )

        (set #studio_components_install "Whlen Sie die Komponentengruppen, die installiert werden sollen:")

        (set #studio_components_update "Whlen Sie die Komponentengruppen, die installiert bzw. aktualisiert werden sollen:")

        (set #studio_components_remove "Whlen Sie die Komponentengruppen, die ganz oder teilweise entfernt werden sollen:")

        (set #studio_components_help

            (cat

                "GOLDED (1.76 MB)\n\n"

                "Der Editor GoldED sowie die unmittelbar vom Editor bentigten Dateien und Verzeichnisse.\n\n"

                "STARTER (0 - 15 KB)\n\n"

                "Startprogramme, die die Verwendung des Editors vereinfachen (Drag & Drop).\n\n"

                "DOKUMENTATION (36 K - 700 KB)\n\n"

                "Die Online-Dokumentation.\n\n"

                "ADD-ONS (0 - 25 MB)\n\n"

                "Mitgeliefert werden die Rechtschreibprfung Joyce, ein Thesaurus, Anpassungen an diverse C-Compiler, die HTML-Umgebung Webworld (zur Bearbeitung von HTML-Dateien mit dem Editor), Anpassungen an verschiedene E-Mail-Programme, usw.\n\n"

                "ENTWICKLERUNTERLAGEN (830 KB)\n\n"

                "Material fr die Entwicklung von Erweiterungen fr GoldED: Quelltexte, Autodocs, Includes, Catalogs, usw.\n\n"

                "SCREENSHOT (40 KB)\n\n"

                "Ein Screenshot von GoldED.\n\n"

                "NOTFALLPROGTRAMM (6 KB)\n\n"

                "Stellt nach Betriebssystemabstrzen den zuletzt bearbeiteten Text wieder her.\n\n"
            )
        )

        (set #studio_components_golded     "GoldED")
        (set #studio_components_starter    "Starter")
        (set #studio_components_docs       "Dokumentation")
        (set #studio_components_addons     "Add-On(s)")
        (set #studio_components_developer  "Entwicklerunterlagen")
        (set #studio_components_screenshot "Screenshot")
        (set #studio_components_recover    "Notfallprogramm")

        (set #studio_preset_install_A "Whlen Sie die Grundeinstellungen, die installiert werden sollen (Seite 1 von 2):")
        (set #studio_preset_install_B "Whlen Sie die Grundeinstellungen, die installiert werden sollen (Seite 2 von 2):")

        (set #studio_preset_install_help "Der Editor verwendet die Grundeinstellungen, wenn normale Texte bearbeitet werden, fr die kein besonderer Dateityp definiert wurde.")

        (set #studio_preset_display        "Anzeige")
        (set #studio_preset_interface      "Benutzeroberflche")
        (set #studio_preset_hunter         "Dateisuche")
        (set #studio_preset_printer        "Drucker")
        (set #studio_preset_context        "Kontext")
        (set #studio_preset_syntax         "Farbcodierung")
        (set #studio_preset_layout         "Layout")
        (set #studio_preset_mouse          "Maus")
        (set #studio_preset_menu           "Menu")
        (set #studio_preset_api            "Plug-Ins")
        (set #studio_preset_project        "Projekte")
        (set #studio_preset_references     "Referenzen")
        (set #studio_preset_gadgets        "Symboleisten")
        (set #studio_preset_tabs           "Tabulatoren")
        (set #studio_preset_keyboard       "Tastatur")
        (set #studio_preset_templates      "Templates")
        (set #studio_preset_misc           "Verschiedenes")
        (set #studio_preset_dictionary     "Wrterbcher")

        (set #studio_locale "Whlen Sie eine Sprache fr die Grundeinstellungen:")

        (set #studio_locale_help "Die Bercksichtigung der vom Benutzer bevorzugten Sprache bei der Beschriftung der Eingabefelder erfolgt automatisch. Die Sprache der nderbaren Komponenten (Einstellungen fr Menus, Symbolleisten usw.) mu dagegen whrend der Installation gewhlt werden, damit die entsprechenden Konfigurationsdaten installiert werden knnen.")

        (set #studio_starter_help

            (cat

                "SCHNELLSTARTER (5 KB)\n\n"

                "Das Startprogramm fr den Editor: dieses Programm kann wie ein normaler Editor verwendet werden, bietet aber erweiterte Mglichkeiten, die sie beim direkten Start von GoldED nicht haben. Der direkte Start von GoldED sollte grundstzlich vermieden werden: verwenden Sie immer den Starter, um den Editor zu starten.\n\n"

                "DRAG & DROP STARTER (8 KB)\n\n"

                "Erzeugt ein Drag & Drop-Icon auf der Workbench: Sie knnen auf dieses Symbol klicken, um den Editor zu starten oder Dateien auf dieses Symbol ziehen, um sie im Editor zu ffnen.\n\n"
            )
        )

        (set #studio_starter_ed      "Schnellstarter")
        (set #studio_starter_appicon "Drag & Drop-Starter")

        (set #studio_parts_install     "Whlen Sie die Komponenten dieser Kategorie, die installiert bzw. aktualisiert werden sollen:")

        (set #studio_parts_install_a   "Whlen Sie die Komponenten, die installiert bzw. aktualisiert werden sollen (Seite 1 von 4):")
        (set #studio_parts_install_b   "Whlen Sie die Komponenten, die installiert bzw. aktualisiert werden sollen (Seite 2 von 4):")
        (set #studio_parts_install_c   "Whlen Sie die Komponenten, die installiert bzw. aktualisiert werden sollen (Seite 3 von 4):")
        (set #studio_parts_install_d   "Whlen Sie die Komponenten, die installiert bzw. aktualisiert werden sollen (Seite 4 von 4):")

        (set #studio_parts_uninstall   "Whlen Sie die Komponenten dieser Kategorie, die entfernt werden sollen:")

        (set #studio_parts_uninstall_a "Whlen Sie die Komponenten dieser Kategorie, die entfernt werden sollen (Seite 1 von 4):")
        (set #studio_parts_uninstall_b "Whlen Sie die Komponenten dieser Kategorie, die entfernt werden sollen (Seite 2 von 4):")
        (set #studio_parts_uninstall_c "Whlen Sie die Komponenten dieser Kategorie, die entfernt werden sollen (Seite 3 von 4):")
        (set #studio_parts_uninstall_d "Whlen Sie die Komponenten dieser Kategorie, die entfernt werden sollen (Seite 4 von 4):")

        (set #studio_manual_help

            (cat

                "HISTORY\n\n"

                "Revisionsgeschichte (English)\n\n"

                "LIZENZ\n\n"

                "Lizenzbedingungen.\n\n"

                "BESTELLINFORMATIONEN\n\n"

                "Bezugsquellennachweis fr Updates\n\n"

                "ENGLISCHE/DEUTSCHE DOKUMENTATION\n\n"

                "Online-Dokumentation im AmigaGuide-Format."
            )
        )

        (set #studio_manual_history  "History")
        (set #studio_manual_licence  "Lizenz")
        (set #studio_manual_order    "Bestellinformationen")
        (set #studio_manual_english  "Englische Dokumentation")
        (set #studio_manual_german   "Deutsche Dokumentation")

        (set #studio_registry "ACHTUNG: Beim Wiederherstellen dieser zentralen Konfigurationsdatei verlieren Sie alle globalen Einstellungen im Editor sowie weiterhin alle Dateitypen mit Ausnahme des Dateityps TEXT !")

        (set #studio_registry_restore "Wiederherstellen")
        (set #studio_registry_keep    "Beibehalten")

        (set #studio_registry_help "Die zentrale Konfigurationsdatei (Registry) enthlt alle dateitypunabhngigen globalen Einstellungen inklusive der Dateitypliste.")

        (set #studio_nostartup "Die Datei s:user-startup fehlt oder ist beschdigt !\n")

        (set #startup_ask "Sollen die notwendigen Eintrge in der Startup-Datei des Rechners jetzt erzeugt werden ?")

        (set #startup_ask_help "Es wird der notwendige Assign auf das Verzeichnis des Editors eingerichtet.")

        (set #studio_addons_help

            (cat

                "WEBWORLD\n\n"

                "Erweiterung zur Bearbeitung von Internet-Seiten.\n\n"

                "RECHTSCHREIBPRFUNG JOYCE\n\n"

                "Rechtschreibprfung Deutsch/Englisch. Markiert die Fehler im Text schon beim Schreiben. Belegt 2-4 MB Speicher !\n\n"

                "ROGET'S THESAURUS\n\n"

                "Englisches Thesaurus: Umfangreiches Nachschlagewerk fr Synonyme. Belegt 2 MB Speicher !\n\n"

                "SCRIPTING\n\n"

                "Untersttzung fr die Bearbeitung der StartupSequenz (Farbcodierung).\n\n"

                "AMIGAGUIDE PUBLISHER\n\n"

                "Erweiterung zur Bearbeitung von AmigaGuide-Dateien.\n\n"

                "SUPPORT FR STORMC\n\n"

                "Umfangreicher Support fr den StormC-Compiler: C/C++ Farbhervorhebung, Toolbars, Anzeige der passenden Klammer beim Schreiben, etc.\n\n"

                "SUPPORT FR SAS/C\n\n"

                "Umfangreicher Support fr den SAS/C-Compiler: C/C++ Farbhervorhebung, Toolbars, Anzeige der passenden Klammer beim Schreiben, etc.\n\n"

                "SUPPORT FR ANDERE C-COMPILER\n\n"

                "Untersttzung fr andere C-Compiler.\n\n"

                "SUPPORT FR ASSEMBLER\n\n"

                "Untersttzung fr die Bearbeitung von AssemblerQuelltexten (Farbcodierung).\n\n"

                "FAXVERSAND\n\n"

                "Aktuellen Text als Fax verschicken. Erfordert das Faxprogramm STFax\n\n".

                "UNTERSTTZUNG FR MICRODOT\n\n"

                "Anpassung an Microdot zum Schreiben von E-Mails.\n\n"

                "UNTERSTTZUNG FR THOR\n\n"

                "Anpassung an Thor zum Schreiben von E-Mails.\n\n"

                "DRUCKERERWEITERUNG FR PCL-DRUCKER\n\n"

                "PCL-Druckprogramm. PCL ist dir Druckersprache, die von den meisten Laserdruckern und den meisten HP Tintenstrahldruckern verwendet wird (Gerte von Epson und Canon sind i.d.R. keine PCL-Drucker).\n\n"

                "INSTALLER-ASSISTENT\n\n"

                "Diese Erweiterung erleichert das Erstellen von Installationdateien fr den Amiga Installer. Beispielsweise werden zusammengehrende Klammern in der gleichen Farbe dargestellt, so da Fehler in der Programmstruktur schnell zu finden sind.\n\n"

                "ADD-ON WRAPPER\n\n"

                "Dies ist ein Werkzeug fr Entwickler, die Add-Ons fr GoldED erzeugen und vertreiben mchten.\n\n"

                "TEXTREGISTER\n\n"

                "Dieses Add-On erweitert Editorfenster um eine Knopfleiste, die jeden geffneten Text anzeigt.\n\n"

                "MINESWEEPER\n\n"

                "Ein kleines Spiel zum Zeitvertrieb in den Compilerpausen.\n\n"

                "REXX SCRIPTING\n\n"

                "Diese Erweiterung erleichert das Erstellen von Rexx-Programmen\n\n"
            )
        )

        (set #studio_addons_envwww "Webworld")
        (set #studio_addons_envjcy "Rechtschreibprfung Joyce")
        (set #studio_addons_envthe "Roget's Thesaurus")
        (set #studio_addons_envbat "Scripting")
        (set #studio_addons_envgde "AmigaGuide Publisher")
        (set #studio_addons_envstm "Support fr StormC")
        (set #studio_addons_envsas "Support fr SAS/C")
        (set #studio_addons_envcpp "Support fr andere C-Compiler")
        (set #studio_addons_envasm "Support fr Assembler")
        (set #studio_addons_envfax "Faxversand")
        (set #studio_addons_envmdt "Untersttzung fr Microdot")
        (set #studio_addons_envthr "Untersttzung fr Thor")
        (set #studio_addons_envprt "Druckererweiterung fr PCL-Drucker")
        (set #studio_addons_envrcs "Revisionskontrolle")
        (set #studio_addons_envins "Installer-Assistent")
        (set #studio_addons_envwrp "Add-On Wrapper")
        (set #studio_addons_envreg "Textregister")
        (set #studio_addons_envswp "Minesweeper")
        (set #studio_addons_envrex "Rexx Scripting")

        (set #studio_addons_install "Installation der Add-Ons ...")
        (set #studio_addons_error   "Diese Add-On-Installation wurde abgebrochen und ist unvollstndig !")

        (set #studio_ioerr "Lesefehler auf der Installations-CD !")
    )

    ; english strings

    (
        (set #studio_reboot "Please reboot the computer after installation !")

        (set #studio_cderr "File not fount. The CD-ROM file system installed on this computer is defective or incompatible. More information on this topic can be found in the FAQ file.")

        (set #studio_filenotfound "File not found.")

        (set #studio_demo "GoldED Studio can not be installed over this version (demo version and commercial version are incompatible). Uninstall GoldED and repeat this installation or choose another directory.")

        (set #studio_rexxerr "Warning: ARexx Installation is incomplete. File not found error: ")

        (set #studio_overwrite "A drawer named Studio already exists in this path ! Continue with installation into this drawer ?")

        (set #studio_overwrite_help "This drawer could belong to another program or to a previous incomplete installation.")

        (set #studio_overwrite_install "Install")

        (set #studio_overwrite_cancel  "Choose other path")

        (set #studio_badkick "This program requires AmigaOS 3 !")

        (set #studio_notify "An error has occured during the last installation. We recommend to repeat a minimum installation to another drawer. Please terminate all other programs before you repeat installation !")

        (set #studio_welcome "Welcome to the GoldED Studio Setup !\n\nThis program installs GoldED Studio on your computer. We recommend to terminate all other programs before you continue with the setup !\n\nWARNING: This software is protected by international and national laws. Unauthorized distribution or rental of this software or one of its components are prosecuted to the full extent possible.")

        (set #studio_installer "An error has occured during the installation. An error description can be found in the logfile (see t: directory) if you did enable log file creation. The error code is:")

        (set #studio_yourname "Enter your name:")

        (set #studio_yourname_help "The name is required for product registration. The software can not be installed without registration.")

        (set #studio_serial "Enter the serial code:")

        (set #studio_serial_help "You find the serial code on the registration card. The code must be entered exactly as printed on the registration card.")

        (set #studio_check "Is this correct ?\n\n%s, %s")

        (set #studio_check_continue "Accept")

        (set #studio_check_repeat "Modify")

        (set #studio_found "Welcome to the GoldED Studio Setup !\n\nThis program installs or updates GoldED Studio on your computer. We recommend to terminate all other programs before you continue with the setup !\n\nThis software has been installed before:\nChoose UPDATE to update, add or remove components of the existing installation. Choose OTHER DIRECTORY to install again to another directory.")

        (set #studio_found_help "UPDATE\n\nUpdates the existing installation: update, add or remove its components.\n\nOTHER DIRECTORY\n\nRepeat installation to another directory. Your old installation remains unchanged. You shouldn't use this installation type unless you have problems with your existing installation.")

        (set #studio_found_confirm "UPDATE")

        (set #studio_found_newinstall "Other directory")

        (set #studio_path_choose "Choose a path for installation. The setup program will create a directory for GoldED Studio in the path you specify:")

        (set #studio_path_choose_help "Disk space requirements on the choosen drive depend on the further installation process. About 30 MB are required for a full installation.")

        (set #studio_installtype "Choose the installation type:")

        (set #studio_installtype_help "You can add or remove components after installation by running the setup program again.")

        (set #studio_installtype_minimum "Minimum installation (500 KB)")
        (set #studio_installtype_user    "User defined (up to 25 MB)")
        (set #studio_installtype_normal  "Typical installation (2 MB)")

        (set #studio_checking "Examining existing installation ...")

        (set #studio_updatemode_reinstall "Upgrade installed components")
        (set #studio_updatemode_add       "Add components")
        (set #studio_updatemode_remove    "Remove components")
        (set #studio_updatemode_presets   "Install default configuration")
        (set #studio_updatemode_registry  "Restore registry")
        (set #studio_updatemode_startup   "Fix user startup sequence")
        (set #studio_updatemode_exit      "Leave setup")

        (set #studio_updatemode_help

            (cat

                "UPGRADE INSTALLED COMPONENTS\n\n"

                "Installed components with exception of configuration files are reinstalled.\n\n"

                "ADD/REMOVE COMPONENTS\n\n"

                "Modifies the current installation by adding or removing components (add-ons, manuals, etc.).\n\n"

                "INSTALL DEFAULT CONFIGURATION\n\n"

                "Select the default configuration elements you would like to see reinstalled (menu, colors, etc.). The editor uses the default configuration whenever you load a text which has no specific file type associated with it.\n\n"

                "RESTORE REGISTRY\n\n"

                "Reinstalls the central configuration file. You'll loose all global settings and all filetypes with exception of the type TEXT if you restore the registry !\n\n"

                "FIX USER-STARTUP SEQUENCE\n\n"

                "Adds the assign required by this sofwtare to the user startup sequence of your system.\n\n"
            )
        )

        (set #studio_components_install "Choose the categories to be installed:")

        (set #studio_components_update  "Choose the categories to be updated or installed:")

        (set #studio_components_remove  "Choose the categories to be removed completely or in parts:")

        (set #studio_components_help

            (cat

                "GOLDED (1.76 MB)\n\n"

                "The editor GoldED and the files and directories required by GoldED.\n\n"

                "STARTER (0 - 15 KB)\n\n"

                "Starter programs which simplify usage of the editor (Drag & Drop).\n\n"

                "DOCUMENTATION (36 K - 700 KB)\n\n"

                "Online documentation.\n\n"

                "ADD-ONS (0 - 25 MB)\n\n"

                "Includes the spell checking module Joyce, Roget's thesaurus, support for various C compilers, the HTML environment Webworld (for writing HTML files with the editor), support for various e-mailer, etc.\n\n"

                "DSEVELOPER MATERIAL (830 KB)\n\n"

                "Material for developing extensions for GoldED: source codes, autodocs, includes, catalogs, etc.\n\n"

                "SCREENSHOT (40 KB)\n\n"

                "A screenshot of GoldED.\n\n"

                "EMERGENCY RECOVERY (6 KB)\n\n"

                "Restores a text lost during a system crash.\n\n"
            )
        )

        (set #studio_components_golded     "GoldED")
        (set #studio_components_starter    "Starter")
        (set #studio_components_docs       "Documentation")
        (set #studio_components_addons     "Add-On(s)")
        (set #studio_components_developer  "Developer material")
        (set #studio_components_screenshot "Screenshot")
        (set #studio_components_recover    "Emergency Recovery")

        (set #studio_preset_install_A "Choose the default configuration elements you would like to have installed (page 1 of 2):")
        (set #studio_preset_install_B "Choose the default configuration elements you would like to have installed (page 2 of 2):")

        (set #studio_preset_install_help "The editor uses the default configuration whenever you load a text which has no specific file type associated with it.")

        (set #studio_preset_display        "Display configuration")
        (set #studio_preset_interface      "User interface")
        (set #studio_preset_hunter         "File search")
        (set #studio_preset_printer        "Printer configuration")
        (set #studio_preset_context        "Context")
        (set #studio_preset_syntax         "Syntax highlighting")
        (set #studio_preset_layout         "Formatting")
        (set #studio_preset_mouse          "Mouse")
        (set #studio_preset_menu           "Menu")
        (set #studio_preset_api            "Plug-Ins")
        (set #studio_preset_project        "Projects")
        (set #studio_preset_references     "References")
        (set #studio_preset_gadgets        "Toolbars")
        (set #studio_preset_tabs           "Tabs")
        (set #studio_preset_keyboard       "Keyboard")
        (set #studio_preset_templates      "Templates")
        (set #studio_preset_misc           "Miscellaneous")
        (set #studio_preset_dictionary     "Dictionaries")

        (set #studio_locale "Choose a language for the default configuration:")

        (set #studio_locale_help "While gadget labels are localized automatically, the language for configurable elements (configuration of menus, toolbars, etc.) has to be choosen during the setup so that the correct files can be installed.")

        (set #studio_starter_help

            (cat

                "QUICK STARTER (5 KB)\n\n"

                "The starter for the editor: while this program can be use like a normal editor (GoldED), it offers you features not available when running GoldED directly; you should in fact avoid running GoldED directly and always use the starter.\n\n"

                "DRAG & DROP STARTER (8 KB)\n\n"

                "Creates a drag and drop icon on your workbench where you can drag files to open them in the editor.\n\n"
            )
        )

        (set #studio_starter_ed      "Quick Starter")
        (set #studio_starter_appicon "Drag & Drop Starter")

        (set #studio_parts_install     "Choose the components of this category to be installed or updated:")

        (set #studio_parts_install_a   "Choose the components of this category to be installed or updated (page 1 of 4):")
        (set #studio_parts_install_b   "Choose the components of this category to be installed or updated (page 2 of 4):")
        (set #studio_parts_install_c   "Choose the components of this category to be installed or updated (page 3 of 4):")
        (set #studio_parts_install_d   "Choose the components of this category to be installed or updated (page 4 of 4):")

        (set #studio_parts_uninstall   "Choose the components of this category to be removed:")

        (set #studio_parts_uninstall_a "Choose the components of this category to be removed (page 1 of 4):")
        (set #studio_parts_uninstall_b "Choose the components of this category to be removed (page 2 of 4):")
        (set #studio_parts_uninstall_c "Choose the components of this category to be removed (page 3 of 4):")
        (set #studio_parts_uninstall_d "Choose the components of this category to be removed (page 4 of 4):")

        (set #studio_manual_help

            (cat

                "HISTORY\n\n"

                "Revision history\n\n"

                "LICENCE\n\n"

                "User licence\n\n"

                "ORDERING INFORMATION\n\n"

                "Information for ordering updates\n\n"

                "ENGLISH/GERMAN DOCUMENTATION\n\n"

                "Online documentation in AmigaGuide format.\n\n"
            )
        )

        (set #studio_manual_history  "History")
        (set #studio_manual_licence  "Licence")
        (set #studio_manual_order    "Ordering information")
        (set #studio_manual_english  "English documentation")
        (set #studio_manual_german   "German documentation")

        (set #studio_registry "WARNING: You will loose all global configuration settings and all file types with exception of the type TEXT if you restore the registry !")

        (set #studio_registry_restore "Restore registry")
        (set #studio_registry_keep    "Skip this step")

        (set #studio_registry_help "The central configuration file (registry) contains all file type independent configuration settings including the global list of file types.")

        (set #studio_nostartup "The file s:user-startup is missing or corrupt !\n")

        (set #startup_ask "Should the changes to the system's user startup sequence (as required by this software) be done now ?")

        (set #startup_ask_help "This will add an assign pointing to the installation directory.")

        (set #studio_addons_help

            (cat

                "WEBWORLD\n\n"

                "Add-On for publishing internet (HTML) documents.\n\n"

                "JOYCE SPELL CHECKING\n\n"

                "Spellchecking for English and German. Highlights spelling errors in a text while you are typing. Requires 2-4 MB RAM !\n\n"

                "ROGET'S THESAURUS\n\n"

                "English thesaurus: lists synonyms from a 100000 words database. Requires 2 MB RAM !\n\n"

                "SCRIPTING\n\n"

                "Support for editing the startup sequence (syntax highlighting).\n\n"

                "AMIGAGUIDE PUBLISHER\n\n"

                "Add-On for publishing AmigaGuide documents.\n\n"

                "SUPPORT FOR STORMC\n\n"

                "Support for the StormC compiler: C/C++ syntax highlighting, toolbars, shows the matching bracket while typing, etc.\n\n"

                "SUPPORT FOR SAS/C\n\n"

                "Support for the StormC compiler: C/C++ syntax highlighting, toolbars, shows the matching bracket while typing, etc.\n\n"

                "SUPPORT FOR OTHER C COMPILERS\n\n"

                "C++ syntax highlighting and other extensions.\n\n"

                "SUPPORT FOR ASSEMBLER\n\n"

                "Support for editing assembler source codes.\n\n"

                "FAX\n\n"

                "Sends current text as FAX. Requires the fax program STFax.\n\n"

                "SUPPORT FOR MICRODOT\n\n"

                "Support for writing e-mails with Microdot (syntax highlighting and signature support).\n\n"

                "SUPPORT FOR THOR\n\n"

                "Support for writing e-mails with Thor (syntax highlighting and signature support).\n\n"

                "PCL PRINTING UTILITY\n\n"

                "A printing utility for PCL printers. PCL is the printer command language used by most laser printers and most HP (but not Epson or Canon) inkjets.\n\n"

                "INSTALLER WIZARD\n\n"

                "This add-on simplifies the creation of installer scripts compatible with the Amiga Installer. For example, matching brackets have the same color so that nesting errors can be found quickly.\n\n"

                "ADD-ON WRAPPER\n\n"

                "The Add-On Wrapper is a tool for developers who wish to create and distribute add-ons for GoldED.\n\n"

                "TEXT REGISTER\n\n"

                "This add-on adds a button stripe to editor windows, one button for each open text. Click on one of these buttons to bring the associated text to the front.\n\n"

                "MINESWEEPER\n\n"

                "The error messages of the compiler no longer provide sufficient thrill for you ? Well, now you have the Minesweeper game to kill some time.\n\n"

                "REXX SCRIPTING\n\n"

                "This add-on simplifies the creation of Rexx programs\n\n"
            )
        )

        (set #studio_addons_envwww "Webworld")
        (set #studio_addons_envjcy "Joyce Spell Checking")
        (set #studio_addons_envthe "Roget's Thesaurus")
        (set #studio_addons_envbat "Scripting")
        (set #studio_addons_envgde "AmigaGuide Publisher")
        (set #studio_addons_envstm "Support for StormC")
        (set #studio_addons_envsas "Support for SAS/C")
        (set #studio_addons_envcpp "Support for other C compilers")
        (set #studio_addons_envasm "Support for Assembler")
        (set #studio_addons_envfax "Fax")
        (set #studio_addons_envmdt "Support for Microdot")
        (set #studio_addons_envthr "Support for Thor")
        (set #studio_addons_envprt "PCL printing utility")
        (set #studio_addons_envrcs "Revision control system")
        (set #studio_addons_envins "Installer Wizard")
        (set #studio_addons_envwrp "Add-On Wrapper")
        (set #studio_addons_envreg "Text Register")
        (set #studio_addons_envswp "Minesweeper")
        (set #studio_addons_envrex "Rexx Scripting")

        (set #studio_addons_install "Installation of Add-Ons ...")
        (set #studio_addons_error   "This add-on installation has been aborted and is incomplete !")

        (set #studio_ioerr "Read error on installation CD !")
    )
)

; -------------------------------- check environment ---------------------------

; check if we are running under OS 3

(if (< (/ (getversion) 65536) 39)

    (
        (delete "env:studioinstall")

        (textfile

            (dest "env:studioinstall")

            (append "ERROR")
        )

        (abort #studio_badkick)
    )
)

; check CD ROM file system

(if (not (and (exists "installdata/cpu") (exists "installdata/golded") (exists "installdata/programs")))

    (
        (delete "env:studioinstall")

        (textfile

            (dest "env:studioinstall")

            (append "ERROR")
        )

        (abort #studio_cderr)
    )
)

(if (not (exists "sys:system/rexxmast"))

    (message (cat #studio_rexxerr "sys:system/rexxmast"))
)

(if (not (exists "libs:rexxsyslib.library"))

    (message (cat #studio_rexxerr "libs:rexxsyslib.library"))
)

; --------------------------------- procedures ---------------------------------

; uninstall an add-on (input: <studio_installpath>)

(procedure studio_proc_uninstall

    (
        (set studio_installcmd ("setup path \"%s\" icon \"%s\"" (pathonly studio_installpath) (fileonly studio_installpath)))

        ; request uninstall and run add-on setup

        (delete "env:installoptions")

        (textfile

            (dest "env:installoptions")

            (append "UNINSTALL")
        )

        (run studio_installcmd)
    )
)

; install an add-on (input: <studio_installpath>)

(procedure studio_proc_install

    (
        (set studio_installcmd ("setup path \"%s\" icon \"%s\"" (pathonly studio_installpath) (fileonly studio_installpath)))

        ; set quiet mode

        (working #studio_addons_install)

        (delete "env:installoptions")

        (textfile

            (dest "env:installoptions")

            (append "INSTALLQUIET")
        )

        (run studio_installcmd)

        ; check return code of installation

        (if (exists "env:componentinstall")

            (set studio_installcode (getenv "componentinstall"))

            (set studio_installcode "ERROR")
        )

        (if (<> studio_installcode "OK")

            (message #studio_addons_error)
        )
    )
)

; edit startup sequence

(procedure studio_proc_startup

    (
        (if (exists "s:user-startup")

            (
                ; remove entries from previous installation

                (run "installdata/programs/stripstartup >NIL: LINES=6 SECTIONNAME=HiSpeed")

                (run "installdata/programs/stripstartup >NIL: LINES=6 SECTIONNAME=GED_quick")
            )

            (message #studio_nostartup)
        )

        (startup "GoldED"

            (prompt #startup_ask)

            (help #startup_ask_help)

            (command

                ("assign golded: \"%s\"\n" (expandpath "golded:"))

                ("assign libs:   \"%s\" add\n" (tackon (expandpath "golded:") "etc/libs"))

                ("assign fonts:  \"%s\" add\n" (tackon (expandpath "golded:") "etc/fonts"))
            )
        )
    )
)

; restore registry (input: none)

(procedure studio_proc_registry

    (
        (if (exists "golded:etc/registry/registry")

            (set studio_registry

                (askbool

                    (prompt #studio_registry)

                    (choices

                        #studio_registry_restore
                        #studio_registry_keep
                    )

                    (help #studio_registry_help)
                )
            )

            (set studio_registry 1)
        )

        (if (= studio_registry 1)

            (
                (copyfiles

                    (source "installdata/registry/registry")

                    (dest "golded:etc/registry")
                )

                ; remove write protection for material copied from CD-ROM

                (run "installdata/programs/unprotect basedir=golded:etc/registry")

                ; save install path and serial code in registry

                (run ("golded:add-ons/regedit/regedit SERIAL=\"%s\" INSTALLPATH=\"%s\"" studio_serial (expandpath "")))
            )
        )
    )
)

; cleanup after installation (input: none)

(procedure studio_proc_cleanup

    (
        (delete "env:componentinstall")

        (delete "env:installoptions")
    )
)

; save configuration (input: <studio_yourname>, <studio_language>, <studio_serial>)

(procedure studio_proc_savecfg

    (if (exists "golded:etc/env" (noreq))

        (
            (delete "golded:etc/env/name")

            (textfile

                (dest "golded:etc/env/name")

                (append studio_yourname)
            )

            (delete "golded:etc/env/language")

            (textfile

                (dest "golded:etc/env/language")

                (append studio_language)
            )

            (delete "golded:etc/env/serial")

            (textfile

                (dest "golded:etc/env/serial")

                (append studio_serial)
            )
        )
    )
)

; select subcomponents for installation (input: <studio_components>, output: <studio_starter>, <studio_manual>)

(procedure studio_proc_chooseparts

    (
        ; choose add-ons

        (if (bitand studio_components @studio_components_addons)

            (
                (set studio_addons_a

                    (askoptions

                        (prompt (cat #studio_components_addons "\n\n" #studio_parts_install_a))

                        (help #studio_addons_help)

                        (choices

                            (cat #studio_esc #studio_addons_envwww)
                            (cat #studio_esc #studio_addons_envgde)
                            (cat #studio_esc #studio_addons_envthe)
                            (cat #studio_esc #studio_addons_envstm)
                            (cat #studio_esc #studio_addons_envsas)
                            (cat #studio_esc #studio_addons_envcpp)
                        )   

                        (default studio_addons_a)
                    )
                )

                (set studio_addons_b

                    (askoptions

                        (prompt (cat #studio_components_addons "\n\n" #studio_parts_install_b))

                        (help #studio_addons_help)

                        (choices

                            (cat #studio_esc #studio_addons_envasm)
                            (cat #studio_esc #studio_addons_envbat)
                            (cat #studio_esc #studio_addons_envfax)
                            (cat #studio_esc #studio_addons_envmdt)
                            (cat #studio_esc #studio_addons_envthr)
                            (cat #studio_esc #studio_addons_envjcy)
                        )   

                        (default studio_addons_b)
                    )
                )

                (set studio_addons_c

                    (askoptions

                        (prompt (cat #studio_components_addons "\n\n" #studio_parts_install_c))

                        (help #studio_addons_help)

                        (choices

                            (cat #studio_esc #studio_addons_envprt)
                            (cat #studio_esc #studio_addons_envrcs)
                            (cat #studio_esc #studio_addons_envins)
                            (cat #studio_esc #studio_addons_envwrp)
                            (cat #studio_esc #studio_addons_envreg)
                            (cat #studio_esc #studio_addons_envswp)
                        )   

                        (default studio_addons_c)
                    )
                )

                (set studio_addons_d

                    (askoptions

                        (prompt (cat #studio_components_addons "\n\n" #studio_parts_install_d))

                        (help #studio_addons_help)

                        (choices

                            (cat #studio_esc #studio_addons_envrex)
                        )   

                        (default studio_addons_d)
                    )
                )
            )
        )

        ; choose starter(s)

        (if (bitand studio_components @studio_components_starter)

            (
                (set studio_starter

                    (askoptions

                        (prompt (cat #studio_components_starter "\n\n" #studio_parts_install))

                        (help #studio_starter_help)

                        (choices

                            (cat #studio_esc #studio_starter_ed)
                            (cat #studio_esc #studio_starter_appicon)
                        )

                        (default studio_starter)
                    )
                )
            )
        )

        ; choose documentation

        (if (bitand studio_components @studio_components_docs)

            (
                (set studio_manual

                    (askoptions

                        (prompt (cat #studio_components_docs "\n\n" #studio_parts_install))

                        (help #studio_manual_help)

                        (choices

                            (cat #studio_esc #studio_manual_history)
                            (cat #studio_esc #studio_manual_licence)
                            (cat #studio_esc #studio_manual_order)
                            (cat #studio_esc #studio_manual_english)
                            (cat #studio_esc #studio_manual_german)
                        )   

                        (default studio_manual)
                    )
                )
            )
        )
    )
)

; select subcomponents for removal (input: studio_remove, output: <studio_removeaddons_a>, <studio_removeaddons_b>, <studio_removestarter>, <studio_removemanual>)

(procedure studio_proc_removeparts

    (
        ; remove add-ons

        (if (bitand studio_remove @studio_components_addons)

            (
                (set studio_removeaddons_a

                    (askoptions

                        (prompt (cat #studio_components_addons "\n\n" #studio_parts_uninstall_a))

                        (help #studio_addons_help)

                        (choices

                            (cat #studio_esc #studio_addons_envwww)
                            (cat #studio_esc #studio_addons_envgde)
                            (cat #studio_esc #studio_addons_envthe)
                            (cat #studio_esc #studio_addons_envstm)
                            (cat #studio_esc #studio_addons_envsas)
                            (cat #studio_esc #studio_addons_envcpp)
                        )   

                        (default 0)
                    )
                )

                (set studio_removeaddons_b

                    (askoptions

                        (prompt (cat #studio_components_addons "\n\n" #studio_parts_uninstall_b))

                        (help #studio_addons_help)

                        (choices

                            (cat #studio_esc #studio_addons_envasm)
                            (cat #studio_esc #studio_addons_envbat)
                            (cat #studio_esc #studio_addons_envfax)
                            (cat #studio_esc #studio_addons_envmdt)
                            (cat #studio_esc #studio_addons_envthr)
                            (cat #studio_esc #studio_addons_envjcy)
                        )   

                        (default 0)
                    )
                )

                (set studio_removeaddons_c

                    (askoptions

                        (prompt (cat #studio_components_addons "\n\n" #studio_parts_uninstall_c))

                        (help #studio_addons_help)

                        (choices

                            (cat #studio_esc #studio_addons_envprt)
                            (cat #studio_esc #studio_addons_envrcs)
                            (cat #studio_esc #studio_addons_envins)
                            (cat #studio_esc #studio_addons_envwrp)
                            (cat #studio_esc #studio_addons_envreg)
                            (cat #studio_esc #studio_addons_envswp)
                        )   

                        (default 0)
                    )
                )

                (set studio_removeaddons_d

                    (askoptions

                        (prompt (cat #studio_components_addons "\n\n" #studio_parts_uninstall_d))

                        (help #studio_addons_help)

                        (choices

                            (cat #studio_esc #studio_addons_envrex)
                        )   

                        (default 0)
                    )
                )
            )
        )

        ; remove starter(s)

        (if (bitand studio_remove @studio_components_starter)

            (
                (set studio_removestarter

                    (askoptions

                        (prompt (cat #studio_components_starter "\n\n" #studio_parts_uninstall))

                        (help #studio_starter_help)

                        (choices

                            (cat #studio_esc #studio_starter_ed)
                            (cat #studio_esc #studio_starter_appicon)
                        )

                        (default 0)
                    )
                )
            )
        )

        ; remove documentation

        (if (bitand studio_remove @studio_components_docs)

            (
                (set studio_removemanual

                    (askoptions

                        (prompt (cat #studio_components_docs "\n\n" #studio_parts_uninstall))

                        (help #studio_manual_help)

                        (choices

                            (cat #studio_esc #studio_manual_history)
                            (cat #studio_esc #studio_manual_licence)
                            (cat #studio_esc #studio_manual_order)
                            (cat #studio_esc #studio_manual_english)
                            (cat #studio_esc #studio_manual_german)
                        )   

                        (default 0)
                    )
                )
            )
        )
    )
)

; choose preferred language (input: <studio_language>, output: <studio_language>

(procedure studio_proc_chooselanguage

    (
        (while (not (exists ("installdata/locale/%s/standard.menu" studio_language)))

            (if (= @language "english") (set studio_locale 0))
            (if (= @language "deutsch") (set studio_locale 1))

            (set studio_locale

                (askchoice

                    (prompt #studio_locale)

                    (help #studio_locale_help)

                    (choices

                        (cat #studio_esc "English")
                        (cat #studio_esc "Deutsch")
                    )

                    (default studio_locale)
                )
            )

            (if (= studio_locale 0) (set studio_language "english"))
            (if (= studio_locale 1) (set studio_language "deutsch"))
        )
    )
)

; install registry editor (input: none)

(procedure studio_proc_installregedit

    (
        (if (= studio_regedit "")

            (
                (set studio_regedit "golded:add-ons/regedit/regedit")

                (if (exists studio_regedit)

                    (
                        (set oldver (getversion studio_regedit))

                        (set newver (getversion "installdata/golded/add-ons/regedit/regedit"))

                        (if (> newver oldver)

                            (copyfiles

                                (source "installdata/golded/add-ons/regedit")

                                (dest "golded:add-ons/regedit")

                                (all)
                            )
                        )
                    )

                    (copyfiles

                        (source "installdata/golded/add-ons/regedit")

                        (dest "golded:add-ons/regedit")

                        (all)
                    )
                )
            )
        )
    )
)

; check existing setup (input: <studio_path>, output: <studio_yourname>, <studio_serial>, <studio_components>)

(procedure studio_proc_checksetup

    (
        (working studio_checking)

        (makeassign "golded" studio_path)

        (if (exists "golded:" (noreq))

            (
                ; read env variables from last installation

                (if (exists "golded:etc/env")

                    (
                        (if (= (exists "golded:etc/env/name") 1)

                            (
                                (run "installdata/programs/setenv NAME=NAME FROM=golded:etc/env/name")

                                (set studio_yourname (getenv "NAME"))
                            )
                        )

                        (if (= (exists "golded:etc/env/language") 1)

                            (
                                (run "installdata/programs/setenv NAME=LANGUAGE FROM=golded:etc/env/language")

                                (set studio_language (getenv "LANGUAGE"))
                            )
                        )

                        (if (= (exists "golded:etc/env/serial") 1)

                            (
                                (run "installdata/programs/setenv NAME=SERIAL FROM=golded:etc/env/serial")

                                (set studio_serial (getenv "SERIAL"))
                            )
                        )
                    )
                )

                ; check installed components

                (set studio_components 0)
                (set studio_starter    0)
                (set studio_manual     0)
                (set studio_addons_a   0)
                (set studio_addons_b   0)
                (set studio_addons_c   0)
                (set studio_addons_d   0)

                (if (exists "golded:golded")

                    (set studio_components (+ studio_components @studio_components_golded))
                )

                (if (exists "golded:ed")

                    (set studio_starter (+ studio_starter @studio_starter_ed))
                )

                (if (exists "golded:Drag & drop")

                    (set studio_starter (+ studio_starter @studio_starter_appicon))
                )

                (if (<> studio_starter 0)

                    (set studio_components (+ studio_components @studio_components_starter))
                )

                (if (exists "golded:History")

                    (set studio_manual (+ studio_manual @studio_manual_history))
                )

                (if (exists "golded:Licence")

                    (set studio_manual (+ studio_manual @studio_manual_licence))
                )

                (if (exists "golded:Order")

                    (set studio_manual (+ studio_manual @studio_manual_order))
                )

                (if (exists "golded:Manual")

                    (set studio_manual (+ studio_manual @studio_manual_english))
                )

                (if (exists "golded:Anleitung")

                    (set studio_manual (+ studio_manual @studio_manual_german))
                )

                (if (<> 0 studio_manual)

                    (set studio_components (+ studio_components @studio_components_docs))
                )

                (if (exists "golded:add-ons/webworld")

                    (set studio_addons_a (+ studio_addons_a @studio_addons_envwww))
                )

                (if (exists "golded:add-ons/makeguide")

                    (set studio_addons_a (+ studio_addons_a @studio_addons_envgde))
                )

                (if (exists "golded:add-ons/thesaurus")

                    (set studio_addons_a (+ studio_addons_a @studio_addons_envthe))
                )

                (if (exists "golded:add-ons/stormc")

                    (set studio_addons_a (+ studio_addons_a @studio_addons_envstm))
                )

                (if (exists "golded:add-ons/sas-c")

                    (set studio_addons_a (+ studio_addons_a @studio_addons_envsas))
                )

                (if (exists "golded:add-ons/c++")

                    (set studio_addons_a (+ studio_addons_a @studio_addons_envcpp))
                )

                (if (exists "golded:add-ons/a68k")

                    (set studio_addons_b (+ studio_addons_b @studio_addons_envasm))
                )

                (if (exists "golded:add-ons/scripting")

                    (set studio_addons_b (+ studio_addons_b @studio_addons_envbat))
                )

                (if (exists "golded:add-ons/fax")

                    (set studio_addons_b (+ studio_addons_b @studio_addons_envfax))
                )

                (if (exists "golded:add-ons/microdot")

                    (set studio_addons_b (+ studio_addons_b @studio_addons_envmdt))
                )

                (if (exists "golded:add-ons/thor")

                    (set studio_addons_b (+ studio_addons_b @studio_addons_envthr))
                )

                (if (exists "golded:add-ons/joyce")

                    (set studio_addons_b (+ studio_addons_b @studio_addons_envjcy))
                )

                (if (exists "golded:add-ons/print")

                    (set studio_addons_c (+ studio_addons_c @studio_addons_envprt))
                )

                (if (exists "golded:add-ons/rcs")

                    (set studio_addons_c (+ studio_addons_c @studio_addons_envrcs))
                )

                (if (exists "golded:add-ons/installer")

                    (set studio_addons_c (+ studio_addons_c @studio_addons_envins))
                )

                (if (exists "golded:add-ons/wrapper")

                    (set studio_addons_c (+ studio_addons_c @studio_addons_envwrp))
                )

                (if (exists "golded:add-ons/register")

                    (set studio_addons_c (+ studio_addons_c @studio_addons_envreg))
                )

                (if (exists "golded:add-ons/minesweeper")

                    (set studio_addons_c (+ studio_addons_c @studio_addons_envswp))
                )

                (if (exists "golded:add-ons/rexx")

                    (set studio_addons_d (+ studio_addons_d @studio_addons_envrex))
                )

                (if (or (<> studio_addons_a 0) (<> studio_addons_b 0) (<> studio_addons_c 0) (<> studio_addons_d 0))

                    (set studio_components (+ studio_components @studio_components_addons))
                )
                
                (if (or (exists "golded:developer/api") (exists "golded:developer/catalogs") (exists "golded:developer/include") (exists "golded:developer/registry") (exists "golded:developer/scanner") (exists "golded:developer/source") (exists "golded:developer/syntax"))
                
                    (set studio_components (+ studio_components @studio_components_developer))
                )
                
                (if (exists "golded:screenshot")
                
                    (set studio_components (+ studio_components @studio_components_screenshot))
                )
                
                (if (exists "golded:recover")
                
                    (set studio_components (+ studio_components @studio_components_recover))
                )
            )
        )
    )
)

; install presets (input: none)

(procedure studio_proc_installpresets

    (
        (set studio_preset_install_a

            (askoptions

                (prompt #studio_preset_install_a)

                (choices

                    (cat #studio_esc #studio_preset_display)
                    (cat #studio_esc #studio_preset_interface)
                    (cat #studio_esc #studio_preset_hunter)
                    (cat #studio_esc #studio_preset_printer)
                    (cat #studio_esc #studio_preset_context)
                    (cat #studio_esc #studio_preset_syntax)
                    (cat #studio_esc #studio_preset_layout)
                    (cat #studio_esc #studio_preset_mouse)
                    (cat #studio_esc #studio_preset_menu)
                )

                (default 0)

                (help #studio_preset_install_help)
            )
        )

        (set studio_preset_install_b

            (askoptions

                (prompt #studio_preset_install_b)

                (choices

                    (cat #studio_esc #studio_preset_api)
                    (cat #studio_esc #studio_preset_project)
                    (cat #studio_esc #studio_preset_references)
                    (cat #studio_esc #studio_preset_gadgets)
                    (cat #studio_esc #studio_preset_tabs)
                    (cat #studio_esc #studio_preset_keyboard)
                    (cat #studio_esc #studio_preset_templates)
                    (cat #studio_esc #studio_preset_misc)
                    (cat #studio_esc #studio_preset_dictionary)
                )

                (default 0)

                (help #studio_preset_install_help)
            )
        )

        (if (or studio_preset_install_a studio_preset_install_b)

            (
                (if (bitand studio_preset_install_a (+ @studio_preset_mouse @studio_preset_menu @studio_preset_gadgets))

                    (studio_proc_chooselanguage)
                )

                (if (bitand studio_preset_install_a @studio_preset_display)

                    (
                        (run ("%s PRESET installdata/locale/%s/standard.display" studio_regedit studio_language))

                        ; reset font

                        (run bin "installdata/programs/installfont file=golded:etc/registry/presets/standard.display")
                    )
                )

                (if (bitand studio_preset_install_a @studio_preset_interface)

                    (run ("%s PRESET installdata/registry/presets/standard.interface" studio_regedit))
                )

                (if (bitand studio_preset_install_a @studio_preset_hunter)

                    (run ("%s PRESET installdata/registry/presets/standard.hunter" studio_regedit))
                )

                (if (bitand studio_preset_install_a @studio_preset_printer)

                    (run ("%s PRESET installdata/registry/presets/standard.printer" studio_regedit))
                )

                (if (bitand studio_preset_install_a @studio_preset_context)

                    (run ("%s PRESET installdata/registry/presets/standard.context" studio_regedit))
                )

                (if (bitand studio_preset_install_a @studio_preset_syntax)

                    (run ("%s PRESET installdata/registry/presets/standard.syntax" studio_regedit))
                )

                (if (bitand studio_preset_install_a @studio_preset_layout)

                    (run ("%s PRESET installdata/registry/presets/standard.layout" studio_regedit))
                )

                (if (bitand studio_preset_install_a @studio_preset_mouse)

                    (run ("%s PRESET installdata/locale/%s/standard.mouse" studio_regedit studio_language))
                )

                (if (bitand studio_preset_install_a @studio_preset_menu)

                    (run ("%s PRESET installdata/locale/%s/standard.menu" studio_regedit studio_language))
                )

                (if (bitand studio_preset_install_b @studio_preset_api)

                    (run ("%s PRESET installdata/registry/presets/standard.api" studio_regedit))
                )

                (if (bitand studio_preset_install_b @studio_preset_project)

                    (run ("%s PRESET installdata/registry/presets/standard.project" studio_regedit))
                )

                (if (bitand studio_preset_install_b @studio_preset_references)

                    (run ("%s PRESET installdata/registry/presets/standard.references" studio_regedit))
                )

                (if (bitand studio_preset_install_b @studio_preset_gadgets)

                    (run ("%s PRESET installdata/locale/%s/standard.gadgets" studio_regedit studio_language))
                )

                (if (bitand studio_preset_install_b @studio_preset_tabs)

                    (run ("%s PRESET installdata/registry/presets/standard.tabs" studio_regedit))
                )

                (if (bitand studio_preset_install_b @studio_preset_keyboard)

                    (run ("%s PRESET installdata/registry/presets/standard.keyboard" studio_regedit))
                )

                (if (bitand studio_preset_install_b @studio_preset_templates)

                    (run ("%s PRESET installdata/registry/presets/standard.templates" studio_regedit))
                )

                (if (bitand studio_preset_install_b @studio_preset_misc)

                    (run ("%s PRESET installdata/registry/presets/standard.misc" studio_regedit))
                )

                (if (bitand studio_preset_install_b @studio_preset_dictionary)

                    (run ("%s PRESET installdata/registry/presets/standard.dictionary" studio_regedit))
                )
            )
        )

        (run "installdata/programs/unprotect basedir=golded:etc/registry")
    )
)

; install components (input: <studio_components>, <studio_starter>, <studio_manual>)

(procedure studio_proc_installcomponents

    (
        ; always install reqtools library

        (if (not (exists "golded:etc/libs/reqtools.library"))

            (
                (copyfiles

                    (source "bonus/reqtools/reqtools.library")

                    (dest "golded:etc/libs")
                )

                (run "assign libs: golded:etc/libs add")
            )
        )

        ; install editor

        (if (bitand studio_components @studio_components_golded)

            (
                ; always install 68000 binary (all other versions are optional and untested)

                (set studio_cpu @studio_cpu_68000)

                (if (= studio_cpu @studio_cpu_68000)

                    (set studio_binary "68000")
                )

                (if (= studio_cpu @studio_cpu_68020)

                    (set studio_binary "68020")
                )

                (if (= studio_cpu @studio_cpu_68030)

                    (set studio_binary "68030")
                )

                (if (= studio_cpu @studio_cpu_68040)

                    (set studio_binary "68040")
                )

                (if (= studio_cpu @studio_cpu_68060)

                    (set studio_binary "68060")
                )

                (copyfiles

                    (source (cat "installdata/cpu/" studio_binary "/GoldED"))

                    (dest "golded:")
                )

                (copyfiles

                    (source "installdata/golded/GoldED.info")

                    (dest "golded:")
                )

                (copyfiles

                    (source "installdata/golded/etc")

                    (dest "golded:etc")

                    (all)
                )

                ; copy "demo.readme" (used to detect demo installation)

                (if (exists "installdata/golded/demo.readme")

                    (copyfiles

                        (source "installdata/golded/demo.readme")

                        (dest "golded:")
                    )
                )

                (run "assign fonts: golded:etc/fonts add")

                ; request reboot

                (set studio_reboot 1)
            )
        )

        ; install presets and registry

        (if (bitand studio_components @studio_components_config)

            (
                (studio_proc_chooselanguage)

                (run ("%s PRESET installdata/registry/presets/standard.interface"  studio_regedit))
                (run ("%s PRESET installdata/registry/presets/standard.hunter"     studio_regedit))
                (run ("%s PRESET installdata/registry/presets/standard.printer"    studio_regedit))
                (run ("%s PRESET installdata/registry/presets/standard.context"    studio_regedit))
                (run ("%s PRESET installdata/registry/presets/standard.syntax"     studio_regedit))
                (run ("%s PRESET installdata/registry/presets/standard.layout"     studio_regedit))
                (run ("%s PRESET installdata/registry/presets/standard.api"        studio_regedit))
                (run ("%s PRESET installdata/registry/presets/standard.project"    studio_regedit))
                (run ("%s PRESET installdata/registry/presets/standard.references" studio_regedit))
                (run ("%s PRESET installdata/registry/presets/standard.tabs"       studio_regedit))
                (run ("%s PRESET installdata/registry/presets/standard.keyboard"   studio_regedit))
                (run ("%s PRESET installdata/registry/presets/standard.templates"  studio_regedit))
                (run ("%s PRESET installdata/registry/presets/standard.misc"       studio_regedit))
                (run ("%s PRESET installdata/registry/presets/standard.dictionary" studio_regedit))

                ; localized presets

                (run ("%s PRESET installdata/locale/%s/standard.mouse  " studio_regedit studio_language))
                (run ("%s PRESET installdata/locale/%s/standard.menu   " studio_regedit studio_language))
                (run ("%s PRESET installdata/locale/%s/standard.gadgets" studio_regedit studio_language))
                (run ("%s PRESET installdata/locale/%s/standard.display" studio_regedit studio_language))

                ; choose a font

                (run bin "installdata/programs/installfont file=golded:etc/registry/presets/standard.display")

                ; install registry

                (copyfiles

                    (source "installdata/registry/registry")

                    (dest "golded:etc/registry")
                )

                ; remove write protection for material copied from CD-ROM

                (run "installdata/programs/unprotect basedir=golded:etc/registry")

                ; save install path and serial code in registry

                (run ("golded:add-ons/regedit/regedit SERIAL=\"%s\" INSTALLPATH=\"%s\"" studio_serial (expandpath "")))
            )
        )

        ; install starters

        (if (bitand studio_components @studio_components_starter)

            (
                (if (bitand studio_starter @studio_starter_ed)

                    (copyfiles

                        (source "installdata/golded/ed")

                        (dest "golded:")
                    )
                )

                (if (bitand studio_starter @studio_starter_appicon)

                    (
                        (copyfiles

                            (source "installdata/golded/Drag & Drop")

                            (dest "golded:")
                        )

                        (copyfiles

                            (source "installdata/golded/Drag & Drop.info")

                            (dest "golded:")
                        )
                    )
                )
            )
        )

        ; install documentation

        (if (bitand studio_components @studio_components_docs)

            (
                (if (bitand studio_manual @studio_manual_history)

                    (copyfiles

                        (source "installdata/golded/History")

                        (dest "golded:")
                    )
                )

                (if (bitand studio_manual @studio_manual_licence)

                    (
                        (copyfiles

                            (source "installdata/golded/Licence")

                            (dest "golded:")
                        )

                        (copyfiles

                            (source "installdata/golded/Licence.info")

                            (dest "golded:")
                        )
                    )
                )

                (if (bitand studio_manual @studio_manual_order)

                    (
                        (copyfiles

                            (source "installdata/golded/Order")

                            (dest "golded:")
                        )

                        (copyfiles

                            (source "installdata/golded/Order.info")

                            (dest "golded:")
                        )
                    )
                )

                (if (bitand studio_manual @studio_manual_english)

                    (
                        (copyfiles

                            (source "installdata/golded/Manual")

                            (dest "golded:")
                        )

                        (copyfiles

                            (source "installdata/golded/Manual.info")

                            (dest "golded:")
                        )
                    )
                )

                (if (bitand studio_manual @studio_manual_german)

                    (
                        (copyfiles

                            (source "installdata/golded/Anleitung")

                            (dest "golded:")
                        )

                        (copyfiles

                            (source "installdata/golded/Anleitung.info")

                            (dest "golded:")
                        )
                    )
                )
            )
        )

        ; install screenshot

        (if (bitand studio_components @studio_components_screenshot)

            (
                (copyfiles

                    (source "installdata/golded/Screenshot")

                    (dest "golded:")
                )

                (copyfiles

                    (source "installdata/golded/Screenshot.info")

                    (dest "golded:")
                )
            )
        )

        ; install developer material

        (if (bitand studio_components @studio_components_developer)

            (
                (makedir "golded:developer")

                (copyfiles

                    (source "installdata/golded/developer")

                    (dest "golded:developer")

                    (all)
                )
            )
        )

        ; install recovery program

        (if (bitand studio_components @studio_components_recover)

            (
                (copyfiles

                    (source "installdata/golded/Recover")

                    (dest "golded:")
                )

                (copyfiles

                    (source "installdata/golded/Recover.info")

                    (dest "golded:")
                )
            )
        )

        ; install add-onds (to-do)

        (if (bitand studio_components @studio_components_addons)

            (
                (working #studio_addons_install)

                (if (bitand studio_addons_a @studio_addons_envwww)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envWWW44/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_a @studio_addons_envgde)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envGDE17/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_a @studio_addons_envthe)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envTHE10/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_a @studio_addons_envstm)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envSTM27/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_a @studio_addons_envsas)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envSAS12/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_a @studio_addons_envcpp)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envCPP27/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_b @studio_addons_envasm)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envASM14/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_b @studio_addons_envbat)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envBAT14/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_b @studio_addons_envfax)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envFAX10/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_b @studio_addons_envmdt)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envMDT23/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_b @studio_addons_envthr)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envTHR10/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_b @studio_addons_envjcy)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envJCY51/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_c @studio_addons_envprt)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envPRT63/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_c @studio_addons_envrcs)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envRCS11/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_c @studio_addons_envins)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envINS13/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_c @studio_addons_envwrp)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envWRP11/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_c @studio_addons_envreg)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envREG11/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_c @studio_addons_envswp)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envSWP10/setup")

                        (studio_proc_install)
                    )
                )

                (if (bitand studio_addons_d @studio_addons_envrex)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envREX10/setup")

                        (studio_proc_install)
                    )
                )
            )
        )

        (run "installdata/programs/unprotect basedir=golded:")
    )
)

; remove components (input: <studio_remove>)

(procedure studio_proc_removecomponents

    (
        ; remove editor

        (if (bitand studio_remove @studio_components_golded)

            (delete "golded:GoldED")
        )

        ; remove starters

        (if (bitand studio_remove @studio_components_starter)

            (
                (if (bitand studio_removestarter @studio_starter_ed)

                    (delete "golded:ed")
                )

                (if (bitand studio_removestarter @studio_starter_appicon)

                    (delete "golded:Drag & drop")
                )
            )
        )

        ; remove documentation

        (if (bitand studio_remove @studio_components_docs)

            (
                (if (bitand studio_removemanual @studio_manual_history)

                    (delete "golded:History")
                )

                (if (bitand studio_removemanual @studio_manual_licence)

                    (delete "golded:Licence")
                )

                (if (bitand studio_removemanual @studio_manual_order)

                    (delete "golded:Order")
                )

                (if (bitand studio_removemanual @studio_manual_english)

                    (delete "golded:Manual")
                )

                (if (bitand studio_removemanual @studio_manual_german)

                    (delete "golded:Anleitung")
                )
            )
        )

        ; remove developer material

        (if (bitand studio_remove @studio_components_developer)

            ("run delete golded:developer all quiet")
        )

        ; remove screenshot

        (if (bitand studio_remove @studio_components_screenshot)

            (delete "golded:Screenshot")
        )

        ; remove recovery program

        (if (bitand studio_remove @studio_components_recover)

            (delete "golded:Recover")
        )

        ; remove add-ons

        (if (bitand studio_remove @studio_components_addons)

            (
                (if (bitand studio_removeaddons_a @studio_addons_envwww)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envWWW44/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_a @studio_addons_envgde)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envGDE17/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_a @studio_addons_envthe)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envTHE10/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_a @studio_addons_envstm)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envSTM27/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_a @studio_addons_envsas)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envSAS12/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_a @studio_addons_envcpp)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envCPP27/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_b @studio_addons_envasm)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envASM14/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_b @studio_addons_envbat)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envBAT14/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_b @studio_addons_envfax)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envFAX10/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_b @studio_addons_envmdt)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envMDT23/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_b @studio_addons_envthr)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envTHR10/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_b @studio_addons_envjcy)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envJCY51/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_c @studio_addons_envprt)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envPRT63/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_c @studio_addons_envrcs)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envRCS11/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_c @studio_addons_envins)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envINS13/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_c @studio_addons_envwrp)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envWRP11/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_c @studio_addons_envreg)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envREG11/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_c @studio_addons_envswp)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envSWP10/setup")

                        (studio_proc_uninstall)
                    )
                )

                (if (bitand studio_removeaddons_d @studio_addons_envrex)

                    (
                        (set studio_installpath "installdata/golded/add-ons/envREX10/setup")

                        (studio_proc_uninstall)
                    )
                )
            )
        )
    )
)

; ------------------------------ error handling --------------------------------

(onerror

    (studio_proc_cleanup)

    (if (> @ioerr 0) 

        (
            ; set return code

            (delete "env:studioinstall")

            (textfile

                (dest "env:studioinstall")

                (append "INSTALLERROR")
            )

            (message

                (cat #studio_installerror @ioerr)
            )
        )
    )

    (exit (quiet))
)

; ------------------- check return code of previous installation ---------------

(if (exists "env:studioinstall" (noreq))

    ; (getenv) may not be used without checking if var exists (installer bug)

    (set studio_install_code

        (getenv "studioinstall")
    )

    (set studio_install_code "OK")
)

(if (= studio_install_code "INSTALLERROR")

    (
        (message #studio_notify)
    )
)

(delete "env:studioinstall")

(textfile

    (dest "env:studioinstall")

    (append "INCOMPLETE")
)

; ---------------------------------- check setup -------------------------------

(if (exists "golded6.readme")

    (set studio_commercial 0)
    (set studio_commercial 1)
)

; ----------------------------- find old installation --------------------------

(if (exists "golded:" (noreq))

    (
        (set studio_installdir (pathonly (expandpath "golded:")))

        (set studio_found

            (askbool

                (prompt #studio_found)

                (choices

                    #studio_found_confirm
                    #studio_found_newinstall
                )

                (help #studio_found_help)
            )
        )
    )

    (if (exists "work:" (noreq))

        (set studio_installdir "work:")
        (set studio_installdir "sys:")
    )
)

; ---------------------------------- welcome -----------------------------------

(if (not (exists "env:" (noreq)))

    (
        (makedir "ram:env")

        (makeassign "env" "ram:")
    )
)

(if (= studio_found @studio_missing)

    (
        (message #studio_welcome)

        (welcome)
    )
)

(run "run <>NIL: installdata/programs/stopgolded")

; --------------------------------- choose a path ------------------------------

; create installation directory and temporary assign

(while (= studio_path "")

    (if (= studio_found @studio_found)

        (set studio_path (expandpath "golded:"))

        ; ELSE

        (
            ; keep requesting path until valid choice is made

            (set studio_repeat 1)

            (while (= studio_repeat 1)

                (set studio_installdir

                    (askdir

                        (prompt #studio_path_choose)

                        (help #studio_path_choose_help)

                        (default studio_installdir)
                    )
                )

                (if (exists studio_installdir)

                    (set studio_repeat 0)
                    (set studio_repeat 1)
                )
            )

            (set studio_path (tackon studio_installdir "Studio"))

            (if (exists studio_path)

                (
                    (set studio_overwrite

                        (askbool

                            (prompt #studio_overwrite)

                            (choices

                                #studio_overwrite_install
                                #studio_overwrite_cancel
                            )

                            (help #studio_overwrite_help)
                        )
                    )

                    (if (= studio_overwrite 0)

                        (set studio_path "")
                    )
                )
            )
        )
    )

    (if (<> studio_path "")

        (
            (if (exists (tackon studio_path "GoldED" (noreq)))

                (
                    (if (exists (tackon studio_path "demo.readme"))

                        (set studio_upgradable (= studio_commercial 0))
                        (set studio_upgradable (= studio_commercial 1))
                    )
                )

                (set studio_upgradable 1)
            )

            ; installation of commercial version over demo version (and vice versa) is not supported

            (if (= studio_upgradable 1)

                (
                    (set @default-dest studio_path)

                    ; check existing installation

                    (if (exists studio_path (noreq))

                        (
                            ; fairly complete installation ?

                            (if (and (exists (tackon studio_path "golded")) (exists (tackon studio_path "etc/registry/registry")))

                                (
                                    (set studio_update studio_path)

                                    (studio_proc_checksetup)
                                )

                                (
                                    ; repeat full initial installation

                                    (set studio_update "")
                                )
                            )
                        )

                        (makedir studio_path)
                    )

                    ; create assign

                    (makeassign "golded" studio_path)

                    ; verify assign

                    (if (not (exists "golded:" (noreq)))

                        (
                            (set studio_path "")

                            (set studio_found @studio_missing)
                        )
                    )
                )

                ; ELSE

                (
                    (message #studio_demo)

                    (set studio_path "")

                    (set studio_found @studio_missing)
                )
            )
        )
    )
)

; install drawer icon

(set studio_drawer (cat studio_path ".info"))

(if (not (exists studio_drawer))

    (
        (copyfiles

            (source "installdata/workbench/drawer.info")

            (dest studio_installdir)

            (newname (fileonly studio_drawer))
        )

        (tooltype

            (dest studio_drawer)

            (noposition)
        )
    )
)

; validate directory structure

(makedir "golded:add-ons")
(makedir "golded:add-ons/regedit")
(makedir "golded:etc")
(makedir "golded:etc/api")
(makedir "golded:etc/autorun")
(makedir "golded:etc/catalogs")
(makedir "golded:etc/charsets")
(makedir "golded:etc/env")
(makedir "golded:etc/fonts")
(makedir "golded:etc/images")
(makedir "golded:etc/images/sys")
(makedir "golded:etc/images/toolbar")
(makedir "golded:etc/images/wb")
(makedir "golded:etc/libs")
(makedir "golded:etc/recordings")
(makedir "golded:etc/registry")
(makedir "golded:etc/registry/presets")
(makedir "golded:etc/rexx")
(makedir "golded:etc/scanner")
(makedir "golded:etc/sessions")
(makedir "golded:etc/syntax")
(makedir "golded:etc/uninstall")
(makedir "golded:etc/updates")
(makedir "golded:etc/xref")

; always update registry editor

(studio_proc_installregedit)

; validate disk

(if (= studio_commercial 1)

    (if (<> (getsize "installdata/keyfile/keyfile") 67108864)

        (
            ; set return code

            (delete "env:studioinstall")

            (textfile

                (dest "env:studioinstall")

                (append "INSTALLERROR")
            )

            (abort #studio_ioerr)
        )
    )
)

; ---------------------------------- register ----------------------------------

(if (or (= studio_yourname "") (= studio_serial ""))

    (while (= studio_registered 0)

        (set studio_repeat 1)

        (while (= studio_repeat 1)

            (set studio_yourname

                (askstring

                    (prompt  #studio_yourname)
                    (help    #studio_yourname_help)

                    (default studio_yourname)
                )
            )

            (if (= studio_yourname "")

                (message #studio_yourname_help)
            )

            (if (= studio_yourname "")

                (set studio_repeat 1)
                (set studio_repeat 0)
            )
        )

        ; get serial number

        (if (= studio_commercial 1)

            (
                (set studio_repeat 1)

                (while (= studio_repeat 1)

                    (set studio_serial

                        (askstring

                            (prompt  #studio_serial)
                            (help    #studio_serial_help)
                            (default studio_serial)
                        )
                    )

                    (if (= studio_serial "")

                        (message #studio_serial_help)
                    )

                    (if (= (strlen studio_serial) 21)

                        (set studio_repeat 0)
                        (set studio_repeat 1)
                    )
                )
            )

            ; ELSE

            (set studio_serial "Serial No. 0 (Demo)")
        )

        (set studio_registered

            (askbool

                (prompt (#studio_check studio_yourname studio_serial))

                (choices

                    #studio_check_continue
                    #studio_check_repeat
                )

                (help @askbool-help)
            )
        )
    )
)

; ------------------------------- choose installation mode ---------------------

(set studio_installtype @studio_installtype_normal)

; new installation ?

(if (= studio_update "")

    (set studio_installtype

        (askchoice

            (prompt #studio_installtype)

            (choices

                (cat #studio_esc #studio_installtype_minimum)
                (cat #studio_esc #studio_installtype_user)
                (cat #studio_esc #studio_installtype_normal)
            )

            (help #studio_installtype_help)

            (default studio_installtype)
        )
    )
)

; --------------------------------- choose components --------------------------

(if (= studio_update "")

    ; install new

    (
        (if (= studio_installtype @studio_installtype_minimum)

            (
                (set studio_components @studio_components_golded)
                (set studio_starter    0)
                (set studio_manual     0)
                (set studio_addons_a   0)
                (set studio_addons_b   0)
                (set studio_addons_c   0)
                (set studio_addons_d   0)
            )

            ; typical installation

            (
                (set studio_components (- @studio_components_all @studio_components_addons))
                (set studio_starter    @studio_components_all)
                (set studio_manual     @studio_components_all)
                (set studio_addons_a   0)
                (set studio_addons_b   0)
                (set studio_addons_c   0)
                (set studio_addons_d   0)
            )
        )

        (if (= studio_installtype @studio_installtype_user)

            (
                ; choose categories

                (set studio_components

                    (askoptions

                        (prompt #studio_components_install)

                        (choices

                            (cat #studio_esc #studio_components_golded)
                            (cat #studio_esc #studio_components_starter)
                            (cat #studio_esc #studio_components_docs)
                            (cat #studio_esc #studio_components_addons)
                            (cat #studio_esc #studio_components_developer)
                            (cat #studio_esc #studio_components_screenshot)
                            (cat #studio_esc #studio_components_recover)
                        )

                        (help #studio_components_help)

                        (default studio_components)
                    )
                )

                ; choose subcategories

                (studio_proc_chooseparts)
            )
        )

        ; always install presets and registry when installing the editor

        (if (bitand studio_components @studio_components_golded)

            (
                (studio_proc_chooselanguage)

                (set studio_components (bitor studio_components @studio_components_config))
            )
        )

        ; edit user-startup

        (studio_proc_startup)

        ; install everything

        (studio_proc_installcomponents)

        (run "installdata/programs/moveicons <>NIL: grid dir=golded: dx=70 dy=75 columns=4 files GoldED Screenshot \"Drag & Drop\" Recover Licence Order Anleitung Manual")

        ; install autorun macro

        (copyfiles

            (source "installdata/autorun/golded.rexx")

            (dest "golded:etc/autorun")
        )

        (run "golded:add-ons/regedit/regedit autorunrexx golded:etc/autorun/golded.rexx autodelete")
    )

    ; install over old installation

    (
        ; keep showing update menu

        (while (<> studio_updatemode @updatemode_exit)

            (
                (set studio_updatemode

                    (askchoice

                        (prompt studio_path)

                        (choices

                            (cat #studio_esc #studio_updatemode_reinstall)
                            (cat #studio_esc #studio_updatemode_add)
                            (cat #studio_esc #studio_updatemode_remove)
                            (cat #studio_esc #studio_updatemode_presets)
                            (cat #studio_esc #studio_updatemode_registry)
                            (cat #studio_esc #studio_updatemode_startup)
                            (cat #studio_esc #studio_updatemode_exit)
                        )

                        (default studio_updatemode)

                        (help #studio_updatemode_help)
                    )
                )

                (if (or (= studio_updatemode @updatemode_add) (= studio_updatemode @updatemode_reinstall))

                    (
                        ; set defaults (none in <add> mode, installed components in <update> mode)

                        (if (= studio_updatemode @updatemode_add)

                            (
                                (set studio_components 0)
                                (set studio_starter    0)
                                (set studio_manual     0)
                                (set studio_addons_a   0)
                                (set studio_addons_b   0)
                                (set studio_addons_c   0)
                                (set studio_addons_d   0)
                            )
                        )

                        (set studio_components

                            (askoptions

                                (prompt #studio_components_update)

                                (choices

                                    (cat #studio_esc #studio_components_golded)
                                    (cat #studio_esc #studio_components_starter)
                                    (cat #studio_esc #studio_components_docs)
                                    (cat #studio_esc #studio_components_addons)
                                    (cat #studio_esc #studio_components_developer)
                                    (cat #studio_esc #studio_components_screenshot)
                                    (cat #studio_esc #studio_components_recover)
                                )

                                (help #studio_components_help)

                                (default studio_components)
                            )
                        )

                        (studio_proc_chooseparts)

                        (studio_proc_installcomponents)

                        (studio_proc_checksetup)

                        (run "installdata/programs/moveicons <>NIL: grid dir=golded: dx=70 dy=75 columns=4 files GoldED Screenshot \"Drag & Drop\" Recover Licence Order Anleitung Manual")
                    )
                )

                (if (= studio_updatemode @updatemode_remove)

                    (
                        (set studio_remove

                            (askoptions

                                (prompt #studio_components_remove)

                                (choices

                                    (cat #studio_esc #studio_components_golded)
                                    (cat #studio_esc #studio_components_starter)
                                    (cat #studio_esc #studio_components_docs)
                                    (cat #studio_esc #studio_components_addons)
                                    (cat #studio_esc #studio_components_developer)
                                    (cat #studio_esc #studio_components_screenshot)
                                    (cat #studio_esc #studio_components_recover)
                                )

                                (help #studio_components_help)

                                (default 0)
                            )
                        )

                        (studio_proc_removeparts)

                        (studio_proc_removecomponents)

                        (studio_proc_checksetup)

                        (run "installdata/programs/moveicons <>NIL: grid dir=golded: dx=70 dy=75 columns=4 files GoldED Screenshot \"Drag & Drop\" Recover Licence Order Anleitung Manual")
                    )
                )

                (if (= studio_updatemode @updatemode_presets)

                    (studio_proc_installpresets)
                )

                (if (= studio_updatemode @updatemode_registry)

                    (studio_proc_registry)
                )

                (if (= studio_updatemode @updatemode_startup)

                    (studio_proc_startup)
                )
            )
        )
    )
)

; ------------------------------------- done -----------------------------------

(studio_proc_savecfg)

(studio_proc_cleanup)

; set return code

(delete "env:studioinstall")

(textfile

    (dest "env:studioinstall")

    (append "OK")
)

(complete 100)

(if (= studio_reboot 1)

    (exit #studio_reboot)
    (exit)
)

(welcome)
