; $VER: MUI.MiamiPanel_Install 9.2 (2.6.2002)

(procedure P_SetMessages

    (if (= "italiano" @language)
        (
            (set #WhatInstallPromptMsg          "Cosa vuoi installare?")
            (set #WhatInstallHelpMsg            "Scegli cosa vuoi installare:\nLibreria - la libreria MUI.MiamiPanel\nClassiMUI - alcune classi MUI\nDocumentazione - la documentazione di MUI.MiamiPanel in formato AmigaGuide")

            (set #WhatInstallLibraryMsg         "Libreria")
            (set #WhatInstallMCCsMsg            "Classi MUI")
            (set #WhatInstallDocumentationMsg   "Documentazione")

            (set #AskLibDirPromptMsg            "Scegli la directory dove installare la libreria")
            (set #AskLibDirHelpMsg              "Nella directory che sceglierai, verrà copiata la libreria MUI.MiamiPanel. Nota che deve essere MIAMI:LIBS")

            (set #AskMCCsDirPromptMsg           "Scegli la directory dove installare alcuni classi MUI")
            (set #AskMCCsDirHelpMsg             "Nella directory che sceglierai, verranno copiate alcune classi MUI. Ovviamente la directory scelta, dovrà essere nell'assegnamento logico LIBS:")

            (set #AskGuideDirPromptMsg          "Scegli la directory dove installare la documentazione di MUI.MiamiPanel")
            (set #AskGuideDirHelpMsg            "Nella directory che sceglierai, verrà copiata la documentazione di MUI.MiamiPanel in formato AmigaGuide. Per poter utilizzare lo help online la guida deve essere installata in MIAMI:")

            (set #CopyingLibMsg                 "Sto copiando la libreria...")
            (set #CopyingMCCsMsg                "Sto copiando le classi MUI...")
            (set #CopyingGuideMsg               "Sto copiando la documentazione...")
        )
        (
            (set #WhatInstallPromptMsg          "What do you want to install?")
            (set #WhatInstallHelpMsg            "Choose what you want to install:\nLibrary - MUI.MiamiPanel library\nMUI classes - some MUI custom classes\nDocumentation - MUI.MiamiPanel documentation in AmigaGuide format\n")

            (set #WhatInstallLibraryMsg         "Library")
            (set #WhatInstallMCCsMsg            "MUI classes")
            (set #WhatInstallDocumentationMsg   "Documentation")

            (set #AskLibDirPromptMsg            "Select the drawer where you want to copy MUI.MiamiPanel library")
            (set #AskLibDirHelpMsg              "In the drawer you supply here, there will be installed MUI.MiamiPanel library. Note that this must be Miami:LIBS.")

            (set #AskMCCsDirPromptMsg           "Select the drawer where you want to copy some MUI classes")
            (set #AskMCCsDirHelpMsg             "In the drawer you supply here, there will be installed some MUI classes. This drawer MUST BE in your LIBS: assignment")

            (set #AskGuideDirPromptMsg          "Select the drawer where you want to install MUI.MiamiPanel AmigaGuide documentation")
            (set #AskGuideDirHelpMsg            "In the drawer you supply here, there will be installed the MUI.MiamiPanel documentation in AmigaGuide format. To use the online help, it must be MIAMI:")

            (set #CopyingLibMsg                 "Copying or Updating library")
            (set #CopyingMCCsMsg                "Copying or Updating MUI classes")
            (set #CopyingGuideMsg               "Copying documentation")
        )
    )
)

(procedure P_ChooseWhatIstall
    (set #WhatInstall
        (askoptions (prompt #WhatInstallPromptMsg)
                    (help #WhatInstallHelpMsg)
                    (choices #WhatInstallLibraryMsg #WhatInstallMCCsMsg #WhatInstallDocumentationMsg)
        )
    )
)

(procedure P_AskLibDir
    (set #libDir
        (askdir
            (prompt #AskLibDirPromptMsg)
            (help #AskLibDirHelpMsg)
            (default "MIAMI:LIBS")
        )
    )
)

(procedure P_AskMCCsDir
    (set #MCCsDir
        (askdir
            (prompt #AskMCCsDirPromptMsg)
            (help #AskMCCsDirHelpMsg)
            (default "MUI:LIBS/MUI/")
        )
    )
)

(procedure P_AskGuideDir
    (set #guideDir
        (askdir
           (prompt #AskGuideDirPromptMsg)
           (help #AskGuideDirHelpMsg)
           (default "MIAMI:")
        )
    )
)

(procedure P_CopyLib
    (working #CopyingLibMsg)
    (set #localLibDir (tackon #source-dir "LIBS/"))
    (foreach #localLibDir "#?"
        (copylib
            (source (tackon #localLibDir @each-name))
            (dest #libDir)
        )
    )
)

(procedure P_CopyMCCs
    (working #CopyingMCCsMsg)
    (set #localMCCSDir (tackon #source-dir "MUI/"))
    (foreach #localMCCsDir "#?"
        (copylib
            (source (tackon #localMCCsDir @each-name))
            (dest #MCCsDir)
        )
    )
)

(procedure P_CopyDocs
    (working #CopyingGuideMsg)
    (set #docsDir (tackon #source-dir (tackon "DOCS" @language)))
    (if (= (exists #docsDir) 0)
        (set #docsDir (tackon #source-dir "DOCS/english"))
    )
    (copyfiles
        (source #docsDir)
        (dest #guideDir)
        (optional force askuser)
        (all)
    )
)

(procedure P_CopyCatalogs
    (set #catSourceDir (tackon #source-dir (tackon "Catalogs" @language)))
    (set #catDestDir (tackon "Locale:" (tackon "Catalogs" @language)))
    (if (= (and (= (exists (#catSourceDir)) 2) (= (exists (#catDestDir)) 2)) 1)
        (foreach #catSourceDir "#?"
            (copylib
                (source (tackon #catSourceDir @each-name))
                (dest #catDestDir)
            )
        )
    )
)

(set @default-dest "MIAMI:LIBS")
(set #source-dir (if (= 1 (exists @icon)) (pathonly (expandpath @icon)) (expandpath @icon)))

(P_SetMessages)

(complete 0)

(P_ChooseWhatIstall)

(if (= 0 #WhatInstall) (exit))
(if (BITAND #WhatInstall  1)  (P_AskLibDir))
(if (BITAND #WhatInstall  2)  (P_AskMCCsDir))
(if (BITAND #WhatInstall  4)  (P_AskGuideDir))

(if (BITAND #WhatInstall  1)
    (
        (P_CopyLib)
        (P_CopyCatalogs)
    )
)
(complete 35)

(if (BITAND #WhatInstall  2)  (P_CopyMCCs))
(complete 80)

(if (BITAND #WhatInstall  4)  (P_CopyDocs))
(complete 100)
