diff --git a/installer/assets/game/iw7/.gitkeep b/installer/assets/game/iw7/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/installer/assets/graphics/assets/banner-iw7-title.bmp b/installer/assets/graphics/assets/banner-iw7-title.bmp new file mode 100644 index 00000000..afd80443 Binary files /dev/null and b/installer/assets/graphics/assets/banner-iw7-title.bmp differ diff --git a/installer/assets/graphics/assets/logo-cropped.bmp b/installer/assets/graphics/assets/logo-cropped.bmp new file mode 100644 index 00000000..a96b0f67 Binary files /dev/null and b/installer/assets/graphics/assets/logo-cropped.bmp differ diff --git a/installer/assets/graphics/assets/logo-cropped.xcf b/installer/assets/graphics/assets/logo-cropped.xcf new file mode 100644 index 00000000..9b08753b Binary files /dev/null and b/installer/assets/graphics/assets/logo-cropped.xcf differ diff --git a/installer/assets/graphics/icons/icon.ico b/installer/assets/graphics/icons/icon.ico new file mode 100644 index 00000000..27cfcfd7 Binary files /dev/null and b/installer/assets/graphics/icons/icon.ico differ diff --git a/installer/assets/graphics/icons/modern-uninstall.ico b/installer/assets/graphics/icons/modern-uninstall.ico new file mode 100644 index 00000000..27cfcfd7 Binary files /dev/null and b/installer/assets/graphics/icons/modern-uninstall.ico differ diff --git a/installer/assets/text/license.txt b/installer/assets/text/license.txt new file mode 100644 index 00000000..e69de29b diff --git a/installer/compile.bat b/installer/compile.bat new file mode 100644 index 00000000..dc46380b --- /dev/null +++ b/installer/compile.bat @@ -0,0 +1,4 @@ +@echo off + +if not exist "build" mkdir "build" +"tools\makensis.exe" "iw7_Installer.nsi" \ No newline at end of file diff --git a/installer/iw7_Installer.nsi b/installer/iw7_Installer.nsi new file mode 100644 index 00000000..05c1145b --- /dev/null +++ b/installer/iw7_Installer.nsi @@ -0,0 +1,118 @@ +!include "MUI2.nsh" +!include "WinVer.nsh" +!include "nsDialogs.nsh" + +; Constants +!define PRODUCT_NAME "IW7-Mod" +!define PRODUCT_DESCRIPTION "Call of Duty Infinite Warfare Client" +!define COPYRIGHT "Installer created by Ahrimdon (FOSS)" +!define PRODUCT_VERSION "1.0.0.0" +!define SETUP_VERSION "1.0.0.0" + +; Attributes +Name "${PRODUCT_NAME}" +OutFile "build\iw7Installer.exe" +InstallDir "$EXEDIR" +RequestExecutionLevel user ; Request user-level execution, not admin + +; Version Info +VIProductVersion "${PRODUCT_VERSION}" +VIAddVersionKey "ProductName" "${PRODUCT_NAME}" +VIAddVersionKey "ProductVersion" "${PRODUCT_VERSION}" +VIAddVersionKey "FileDescription" "${PRODUCT_DESCRIPTION}" +VIAddVersionKey "LegalCopyright" "${COPYRIGHT}" +VIAddVersionKey "FileVersion" "${SETUP_VERSION}" + +; Modern UI Appearance +!define MUI_ICON "assets\graphics\icons\icon.ico" +!define MUI_UNICON "assets\graphics\icons\icon.ico" +!define MUI_HEADERIMAGE +!define MUI_FINISHPAGE_NOAUTOCLOSE +; !define MUI_FINISHPAGE_RUN "$INSTDIR\iw7-mod.exe" +!define MUI_FINISHPAGE_TEXT "Setup has finished installing ${PRODUCT_NAME} on your computer.$\nClick Finish to close this wizard.$\n$\nRun the iw7-mod.exe application from within your Call of Duty Infinite Warfare game folder or use the Desktop shortcut." + +; Modern UI Settings +!define MUI_ABORTWARNING +!define MUI_UNABORTWARNING +!define MUI_FINISHPAGE_SHOWREADME "" +!define MUI_FINISHPAGE_SHOWREADME_CHECKED +!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut" +!define MUI_FINISHPAGE_SHOWREADME_FUNCTION finishpageaction + +; Show details by default +ShowInstDetails show +ShowUninstDetails show + +; Installer Images +!define MUI_WELCOMEFINISHPAGE_BITMAP "assets\graphics\assets\logo-cropped.bmp" +!define MUI_HEADERIMAGE_BITMAP "assets\graphics\assets\banner-iw7-title.bmp" ; For installer header + +; Uninstaller Images +!define MUI_UNHEADERIMAGE_BITMAP "assets\graphics\assets\banner-iw7-title.bmp" ; For uninstaller header +!define MUI_UNWELCOMEFINISHPAGE_BITMAP "assets\graphics\assets\logo-cropped.bmp" ; For uninstaller finish page + +; Pages +!insertmacro MUI_PAGE_WELCOME +; !insertmacro MUI_PAGE_LICENSE "assets\text\license.txt" +!insertmacro MUI_PAGE_DIRECTORY +!insertmacro MUI_PAGE_INSTFILES +!insertmacro MUI_PAGE_FINISH + +; Languages +!insertmacro MUI_LANGUAGE "English" + +Function .onInit + MessageBox MB_OKCANCEL|MB_ICONINFORMATION "Place the installer in your Call of Duty Infinite Warfare game folder. Click OK to continue or Cancel to exit." IDOK done + Abort + done: +FunctionEnd + +; Sections +Section "Main Application" SecMain + SetOutPath $INSTDIR + File "..\build\bin\x64\Release\iw7-mod.exe" + WriteUninstaller "$INSTDIR\Uninstall.exe" +SectionEnd + +Section "Custom Game Files Files" SecData + SetOutPath $INSTDIR\iw7-mod + File /r "..\data\cdata\*.*" +SectionEnd + +Section "Server Config Files" SecConfigData + SetOutPath $INSTDIR\main + File "..\cfg\main\*.*" +SectionEnd + +Section "Batch Files" SecBatchData + SetOutPath $INSTDIR + File "..\cfg\!launch_iw7_mod.bat" + File "..\cfg\!start_mp_server.bat" + File "..\cfg\!start_zm_server.bat" +SectionEnd + +Function finishpageaction + SetOutPath $INSTDIR + CreateShortcut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\iw7-mod.exe" "" "$INSTDIR\iw7-mod.exe" +FunctionEnd + +; Uninstaller Sections +Section "Uninstall" + Delete $INSTDIR\iw7-mod.exe + Delete "$DESKTOP\${PRODUCT_NAME}.lnk" + Delete $INSTDIR\main\server_mp.cfg + Delete $INSTDIR\main\server_zm.cfg + + Delete "$INSTDIR\!launch_iw7_mod.bat" + Delete "$INSTDIR\!start_mp_server.bat" + Delete "$INSTDIR\!start_zm_server.bat" + + RMDir /r $INSTDIR\iw7-mod + + Delete "$INSTDIR\Uninstall.exe" + RMDir $INSTDIR +SectionEnd + +; Create the desktop shortcut based on the checkbox state +; Function .onInstSuccess +; FunctionEnd \ No newline at end of file diff --git a/installer/tools/Bin/makensis.exe b/installer/tools/Bin/makensis.exe new file mode 100644 index 00000000..7c6468b9 Binary files /dev/null and b/installer/tools/Bin/makensis.exe differ diff --git a/installer/tools/Contrib/Language files/English.nlf b/installer/tools/Contrib/Language files/English.nlf new file mode 100644 index 00000000..18da3748 --- /dev/null +++ b/installer/tools/Contrib/Language files/English.nlf @@ -0,0 +1,191 @@ +# Header, don't edit +NLF v6 +# Start editing here +# Language ID +1033 +# Font and size - dash (-) means default +- +- +# Codepage - dash (-) means ASCII code page +- +# RTL - anything else than RTL means LTR +- +# Translation by ..... (any credits should go here) +# ^Branding +IW7-Mod Installer - Free and Open Source Software +# ^SetupCaption +$(^Name) Setup +# ^UninstallCaption +$(^Name) Uninstall +# ^LicenseSubCaption +: License Agreement +# ^ComponentsSubCaption +: Installation Options +# ^DirSubCaption +: Installation Folder +# ^InstallingSubCaption +: Installing +# ^CompletedSubCaption +: Completed +# ^UnComponentsSubCaption +: Uninstallation Options +# ^UnDirSubCaption +: Uninstallation Folder +# ^ConfirmSubCaption +: Confirmation +# ^UninstallingSubCaption +: Uninstalling +# ^UnCompletedSubCaption +: Completed +# ^BackBtn +< &Back +# ^NextBtn +&Next > +# ^AgreeBtn +I &Agree +# ^AcceptBtn +I &accept the terms of the License Agreement +# ^DontAcceptBtn +I &do not accept the terms of the License Agreement +# ^InstallBtn +&Install +# ^UninstallBtn +&Uninstall +# ^CancelBtn +Cancel +# ^CloseBtn +&Close +# ^BrowseBtn +B&rowse... +# ^ShowDetailsBtn +Show &details +# ^ClickNext +Click Next to continue. +# ^ClickInstall +Click Install to start the installation. +# ^ClickUninstall +Click Uninstall to start the uninstallation. +# ^Name +Name +# ^Completed +Completed +# ^LicenseText +Please review the license agreement before installing $(^NameDA). If you accept all terms of the agreement, click I Agree. +# ^LicenseTextCB +Please review the license agreement before installing $(^NameDA). If you accept all terms of the agreement, click the check box below. $_CLICK +# ^LicenseTextRB +Please review the license agreement before installing $(^NameDA). If you accept all terms of the agreement, select the first option below. $_CLICK +# ^UnLicenseText +Please review the license agreement before uninstalling $(^NameDA). If you accept all terms of the agreement, click I Agree. +# ^UnLicenseTextCB +Please review the license agreement before uninstalling $(^NameDA). If you accept all terms of the agreement, click the check box below. $_CLICK +# ^UnLicenseTextRB +Please review the license agreement before uninstalling $(^NameDA). If you accept all terms of the agreement, select the first option below. $_CLICK +# ^Custom +Custom +# ^ComponentsText +Check the components you want to install and uncheck the components you don't want to install. $_CLICK +# ^ComponentsSubText1 +Select the type of install: +# ^ComponentsSubText2_NoInstTypes +Select components to install: +# ^ComponentsSubText2 +Or, select the optional components you wish to install: +# ^UnComponentsText +Check the components you want to uninstall and uncheck the components you don't want to uninstall. $_CLICK +# ^UnComponentsSubText1 +Select the type of uninstall: +# ^UnComponentsSubText2_NoInstTypes +Select components to uninstall: +# ^UnComponentsSubText2 +Or, select the optional components you wish to uninstall: +# ^DirText +Setup will install $(^NameDA) in the following folder. Enter the path to your Call of Duty Infinite Warfare game folder, or click Browse and select the game folder. $_CLICK +# ^DirSubText +Destination Folder +# ^DirBrowseText +Select the folder to install $(^NameDA) in: +# ^UnDirText +Setup will uninstall $(^NameDA) from the following folder. To uninstall from a different folder, click Browse and select another folder. $_CLICK +# ^UnDirSubText +"" +# ^UnDirBrowseText +Select the folder to uninstall $(^NameDA) from: +# ^SpaceAvailable +"Space available: " +# ^SpaceRequired +"Space required: " +# ^UninstallingText +$(^NameDA) will be uninstalled from the following folder. $_CLICK +# ^UninstallingSubText +Uninstalling from: +# ^FileError +Error opening file for writing: \r\n\r\n$0\r\n\r\nClick Abort to stop the installation,\r\nRetry to try again, or\r\nIgnore to skip this file. +# ^FileError_NoIgnore +Error opening file for writing: \r\n\r\n$0\r\n\r\nClick Retry to try again, or\r\nCancel to stop the installation. +# ^CantWrite +"Can't write: " +# ^CopyFailed +Copy failed +# ^CopyTo +"Copy to " +# ^Registering +"Registering: " +# ^Unregistering +"Unregistering: " +# ^SymbolNotFound +"Could not find symbol: " +# ^CouldNotLoad +"Could not load: " +# ^CreateFolder +"Create folder: " +# ^CreateShortcut +"Create shortcut: " +# ^CreatedUninstaller +"Created uninstaller: " +# ^Delete +"Delete file: " +# ^DeleteOnReboot +"Delete on reboot: " +# ^ErrorCreatingShortcut +"Error creating shortcut: " +# ^ErrorCreating +"Error creating: " +# ^ErrorDecompressing +Error decompressing data! Corrupted installer? +# ^ErrorRegistering +Error registering DLL +# ^ExecShell +"ExecShell: " +# ^Exec +"Execute: " +# ^Extract +"Extract: " +# ^ErrorWriting +"Extract: error writing to file " +# ^InvalidOpcode +Installer corrupted: invalid opcode +# ^NoOLE +"No OLE for: " +# ^OutputFolder +"Output folder: " +# ^RemoveFolder +"Remove folder: " +# ^RenameOnReboot +"Rename on reboot: " +# ^Rename +"Rename: " +# ^Skipped +"Skipped: " +# ^CopyDetails +Copy Details To Clipboard +# ^LogInstall +Log install process +# ^Byte +B +# ^Kilo + K +# ^Mega + M +# ^Giga + G diff --git a/installer/tools/Contrib/Language files/English.nsh b/installer/tools/Contrib/Language files/English.nsh new file mode 100644 index 00000000..06478177 --- /dev/null +++ b/installer/tools/Contrib/Language files/English.nsh @@ -0,0 +1,129 @@ +;Language: English (1033) +;By Joost Verburg + +!insertmacro LANGFILE "English" "English" "English" "English" ; See \Include\LangFile.nsh for a description of these parameters + +!ifdef MUI_WELCOMEPAGE + ${LangFileString} MUI_TEXT_WELCOME_INFO_TITLE "Welcome to the $(^NameDA) Setup" + ${LangFileString} MUI_TEXT_WELCOME_INFO_TEXT "Setup will guide you through the installation of the $(^NameDA) Client for Call of Duty Infinite Warfare.$\r$\n$\r$\nIt is recommended that you close all other applications before installing.$\r$\n$\r$\nYou will not need to restart your computer after installation.$\r$\n$\r$\n$_CLICK" +!endif + +!ifdef MUI_UNWELCOMEPAGE + ${LangFileString} MUI_UNTEXT_WELCOME_INFO_TITLE "$(^NameDA) Uninstaller" + ${LangFileString} MUI_UNTEXT_WELCOME_INFO_TEXT "Setup will guide you through the uninstallation of $(^NameDA).$\r$\n$\r$\nBefore starting the uninstallation, make sure $(^NameDA) is not running.$\r$\n$\r$\n$_CLICK" +!endif + +!ifdef MUI_LICENSEPAGE + ${LangFileString} MUI_TEXT_LICENSE_TITLE "License Agreement" + ${LangFileString} MUI_TEXT_LICENSE_SUBTITLE "Please review the license terms before installing $(^NameDA)." + ${LangFileString} MUI_INNERTEXT_LICENSE_BOTTOM "If you accept the terms of the agreement, click I Agree to continue. You must accept the agreement to install $(^NameDA)." + ${LangFileString} MUI_INNERTEXT_LICENSE_BOTTOM_CHECKBOX "If you accept the terms of the agreement, click the check box below. You must accept the agreement to install $(^NameDA). $_CLICK" + ${LangFileString} MUI_INNERTEXT_LICENSE_BOTTOM_RADIOBUTTONS "If you accept the terms of the agreement, select the first option below. You must accept the agreement to install $(^NameDA). $_CLICK" +!endif + +!ifdef MUI_UNLICENSEPAGE + ${LangFileString} MUI_UNTEXT_LICENSE_TITLE "License Agreement" + ${LangFileString} MUI_UNTEXT_LICENSE_SUBTITLE "Please review the license terms before uninstalling $(^NameDA)." + ${LangFileString} MUI_UNINNERTEXT_LICENSE_BOTTOM "If you accept the terms of the agreement, click I Agree to continue. You must accept the agreement to uninstall $(^NameDA)." + ${LangFileString} MUI_UNINNERTEXT_LICENSE_BOTTOM_CHECKBOX "If you accept the terms of the agreement, click the check box below. You must accept the agreement to uninstall $(^NameDA). $_CLICK" + ${LangFileString} MUI_UNINNERTEXT_LICENSE_BOTTOM_RADIOBUTTONS "If you accept the terms of the agreement, select the first option below. You must accept the agreement to uninstall $(^NameDA). $_CLICK" +!endif + +!ifdef MUI_LICENSEPAGE | MUI_UNLICENSEPAGE + ${LangFileString} MUI_INNERTEXT_LICENSE_TOP "Press Page Down to see the rest of the agreement." +!endif + +!ifdef MUI_COMPONENTSPAGE + ${LangFileString} MUI_TEXT_COMPONENTS_TITLE "Choose Components" + ${LangFileString} MUI_TEXT_COMPONENTS_SUBTITLE "Choose which features of $(^NameDA) you want to install." +!endif + +!ifdef MUI_UNCOMPONENTSPAGE + ${LangFileString} MUI_UNTEXT_COMPONENTS_TITLE "Choose Components" + ${LangFileString} MUI_UNTEXT_COMPONENTS_SUBTITLE "Choose which features of $(^NameDA) you want to uninstall." +!endif + +!ifdef MUI_COMPONENTSPAGE | MUI_UNCOMPONENTSPAGE + ${LangFileString} MUI_INNERTEXT_COMPONENTS_DESCRIPTION_TITLE "Description" + !ifndef NSIS_CONFIG_COMPONENTPAGE_ALTERNATIVE + ${LangFileString} MUI_INNERTEXT_COMPONENTS_DESCRIPTION_INFO "Position your mouse over a component to see its description." + !else + ${LangFileString} MUI_INNERTEXT_COMPONENTS_DESCRIPTION_INFO "Select a component to see its description." + !endif +!endif + +!ifdef MUI_DIRECTORYPAGE + ${LangFileString} MUI_TEXT_DIRECTORY_TITLE "Choose Game Location" + ${LangFileString} MUI_TEXT_DIRECTORY_SUBTITLE "Choose your Call of Duty Infinite Warfare game folder in which to install $(^NameDA)." +!endif + +!ifdef MUI_UNDIRECTORYPAGE + ${LangFileString} MUI_UNTEXT_DIRECTORY_TITLE "Choose Uninstall Location" + ${LangFileString} MUI_UNTEXT_DIRECTORY_SUBTITLE "Choose the folder from which to uninstall $(^NameDA)." +!endif + +!ifdef MUI_INSTFILESPAGE + ${LangFileString} MUI_TEXT_INSTALLING_TITLE "Installing" + ${LangFileString} MUI_TEXT_INSTALLING_SUBTITLE "Please wait while $(^NameDA) is being installed." + ${LangFileString} MUI_TEXT_FINISH_TITLE "Installation Complete" + ${LangFileString} MUI_TEXT_FINISH_SUBTITLE "Setup was completed successfully." + ${LangFileString} MUI_TEXT_ABORT_TITLE "Installation Aborted" + ${LangFileString} MUI_TEXT_ABORT_SUBTITLE "Setup was not completed successfully." +!endif + +!ifdef MUI_UNINSTFILESPAGE + ${LangFileString} MUI_UNTEXT_UNINSTALLING_TITLE "Uninstalling" + ${LangFileString} MUI_UNTEXT_UNINSTALLING_SUBTITLE "Please wait while $(^NameDA) is being uninstalled." + ${LangFileString} MUI_UNTEXT_FINISH_TITLE "Uninstallation Complete" + ${LangFileString} MUI_UNTEXT_FINISH_SUBTITLE "Uninstall was completed successfully." + ${LangFileString} MUI_UNTEXT_ABORT_TITLE "Uninstallation Aborted" + ${LangFileString} MUI_UNTEXT_ABORT_SUBTITLE "Uninstall was not completed successfully." +!endif + +!ifdef MUI_FINISHPAGE + ${LangFileString} MUI_TEXT_FINISH_INFO_TITLE "Completing $(^NameDA) Setup" + ${LangFileString} MUI_TEXT_FINISH_INFO_TEXT "$(^NameDA) has been installed on your computer.$\r$\n$\r$\nClick Finish to close Setup." + ${LangFileString} MUI_TEXT_FINISH_INFO_REBOOT "Your computer must be restarted in order to complete the installation of $(^NameDA). Do you want to reboot now?" +!endif + +!ifdef MUI_UNFINISHPAGE + ${LangFileString} MUI_UNTEXT_FINISH_INFO_TITLE "Completing $(^NameDA) Uninstall" + ${LangFileString} MUI_UNTEXT_FINISH_INFO_TEXT "$(^NameDA) has been uninstalled from your computer.$\r$\n$\r$\nClick Finish to close Setup." + ${LangFileString} MUI_UNTEXT_FINISH_INFO_REBOOT "Your computer must be restarted in order to complete the uninstallation of $(^NameDA). Do you want to reboot now?" +!endif + +!ifdef MUI_FINISHPAGE | MUI_UNFINISHPAGE + ${LangFileString} MUI_TEXT_FINISH_REBOOTNOW "Reboot now" + ${LangFileString} MUI_TEXT_FINISH_REBOOTLATER "I want to manually reboot later" + ${LangFileString} MUI_TEXT_FINISH_RUN "&Run $(^NameDA)" + ${LangFileString} MUI_TEXT_FINISH_SHOWREADME "&Show Readme" + ${LangFileString} MUI_BUTTONTEXT_FINISH "&Finish" +!endif + +!ifdef MUI_STARTMENUPAGE + ${LangFileString} MUI_TEXT_STARTMENU_TITLE "Choose Start Menu Folder" + ${LangFileString} MUI_TEXT_STARTMENU_SUBTITLE "Choose a Start Menu folder for the $(^NameDA) shortcuts." + ${LangFileString} MUI_INNERTEXT_STARTMENU_TOP "Select the Start Menu folder in which you would like to create the program's shortcuts. You can also enter a name to create a new folder." + ${LangFileString} MUI_INNERTEXT_STARTMENU_CHECKBOX "Do not create shortcuts" +!endif + +!ifdef MUI_UNCONFIRMPAGE + ${LangFileString} MUI_UNTEXT_CONFIRM_TITLE "Uninstall $(^NameDA)" + ${LangFileString} MUI_UNTEXT_CONFIRM_SUBTITLE "Remove $(^NameDA) from your computer." +!endif + +!ifdef MUI_ABORTWARNING + ${LangFileString} MUI_TEXT_ABORTWARNING "Are you sure you want to quit $(^Name) Setup?" +!endif + +!ifdef MUI_UNABORTWARNING + ${LangFileString} MUI_UNTEXT_ABORTWARNING "Are you sure you want to quit $(^Name) Uninstall?" +!endif + +!ifdef MULTIUSER_INSTALLMODEPAGE + ${LangFileString} MULTIUSER_TEXT_INSTALLMODE_TITLE "Choose Users" + ${LangFileString} MULTIUSER_TEXT_INSTALLMODE_SUBTITLE "Choose for which users you want to install $(^NameDA)." + ${LangFileString} MULTIUSER_INNERTEXT_INSTALLMODE_TOP "Select whether you want to install $(^NameDA) only for yourself or for all users of this computer. $(^ClickNext)" + ${LangFileString} MULTIUSER_INNERTEXT_INSTALLMODE_ALLUSERS "Install for anyone using this computer" + ${LangFileString} MULTIUSER_INNERTEXT_INSTALLMODE_CURRENTUSER "Install just for me" +!endif diff --git a/installer/tools/Contrib/Modern UI 2/Deprecated.nsh b/installer/tools/Contrib/Modern UI 2/Deprecated.nsh new file mode 100644 index 00000000..85339f2b --- /dev/null +++ b/installer/tools/Contrib/Modern UI 2/Deprecated.nsh @@ -0,0 +1,86 @@ +/* + +NSIS Modern User Interface +Deprecated code - display warnings + +*/ + + +!macro MUI_LEGACY_MAP_NOSTRETCH NAME R + !if "${R}" != "" + !ifdef ${NAME}NOSTRETCH + !define /IfNDef ${NAME}STRETCH NoStretchNoCropNoAlign + !endif + !else + !insertmacro ${__MACRO__} ${NAME}BITMAP_ 1 + !insertmacro ${__MACRO__} ${NAME}BITMAP_RTL_ 1 + !insertmacro ${__MACRO__} ${NAME}UNBITMAP_ 1 + !insertmacro ${__MACRO__} ${NAME}UNBITMAP_RTL_ 1 + !endif +!macroend + + +;-------------------------------- +;InstallOptions + +!define INSTALLOPTIONS_ERROR "MUI_INSTALLOPTIONS_* macros are no longer a part of MUI2. Include InstallOptions.nsh and use INSTALLOPTIONS_* macros instead. It is also recommended to upgrade to nsDialogs." + +!macro MUI_INSTALLOPTIONS_EXTRACT FILE + + !error "${INSTALLOPTIONS_ERROR}" + +!macroend + +!macro MUI_INSTALLOPTIONS_EXTRACT_AS FILE FILENAME + + !error "${INSTALLOPTIONS_ERROR}" + +!macroend + +!macro MUI_INSTALLOPTIONS_DISPLAY FILE + + !error "${INSTALLOPTIONS_ERROR}" + +!macroend + +!macro MUI_INSTALLOPTIONS_DISPLAY_RETURN FILE + + !error "${INSTALLOPTIONS_ERROR}" + +!macroend + +!macro MUI_INSTALLOPTIONS_INITDIALOG FILE + + !error "${INSTALLOPTIONS_ERROR}" + +!macroend + +!macro MUI_INSTALLOPTIONS_SHOW + + !error "${INSTALLOPTIONS_ERROR}" + +!macroend + +!macro MUI_INSTALLOPTIONS_SHOW_RETURN + + !error "${INSTALLOPTIONS_ERROR}" + +!macroend + +!macro MUI_INSTALLOPTIONS_READ VAR FILE SECTION KEY + + !error "${INSTALLOPTIONS_ERROR}" + +!macroend + +!macro MUI_INSTALLOPTIONS_WRITE FILE SECTION KEY VALUE + + !error "${INSTALLOPTIONS_ERROR}" + +!macroend + +!macro MUI_RESERVEFILE_INSTALLOPTIONS + + !error `MUI_RESERVEFILE_INSTALLOPTIONS is no longer supported as InstallOptions is no longer used by MUI2. Instead, use "ReserveFile /plugin InstallOptions.dll". It is also recommended to upgrade to nsDialogs.` + +!macroend diff --git a/installer/tools/Contrib/Modern UI 2/Interface.nsh b/installer/tools/Contrib/Modern UI 2/Interface.nsh new file mode 100644 index 00000000..ee858bd0 --- /dev/null +++ b/installer/tools/Contrib/Modern UI 2/Interface.nsh @@ -0,0 +1,363 @@ +/* + +NSIS Modern User Interface +Interface code for all pages + +*/ + +;-------------------------------- +;Variables + +Var mui.Header.Text +Var mui.Header.Text.Font +Var mui.Header.SubText +Var mui.Header.Background +Var mui.Header.Image + +Var mui.Branding.Text +Var mui.Branding.Background + +Var mui.Line.Standard +Var mui.Line.FullWindow + +Var mui.Button.Next +Var mui.Button.Cancel +Var mui.Button.Back + + +;-------------------------------- +;General interface settings + +!macro MUI_INTERFACE + + !ifndef MUI_INTERFACE + + !define MUI_INTERFACE + + ;These values are set after the interface settings in the script, + ;so the script itself can override all values. + + ;Default interface settings in nsisconf.nsh + !ifdef MUI_INSERT_NSISCONF + !insertmacro MUI_NSISCONF + !endif + + ;Default interface settings + !insertmacro MUI_DEFAULT MUI_UI "${NSISDIR}\Contrib\UIs\modern.exe" + !insertmacro MUI_DEFAULT MUI_UI_HEADERIMAGE "${NSISDIR}\Contrib\UIs\modern_headerbmp.exe" + !insertmacro MUI_DEFAULT MUI_UI_HEADERIMAGE_RIGHT "${NSISDIR}\Contrib\UIs\modern_headerbmpr.exe" + !insertmacro MUI_DEFAULT MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" + !insertmacro MUI_DEFAULT MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" + !insertmacro MUI_DEFAULT MUI_BGCOLOR "FFFFFF" + !insertmacro MUI_DEFAULT MUI_TEXTCOLOR "000000" + + ;Map *_NOSTRETCH legacy define to the correct *_STRETCH value + !verbose push 2 + !insertmacro MUI_LEGACY_MAP_NOSTRETCH MUI_HEADERIMAGE_ "" + !insertmacro MUI_LEGACY_MAP_NOSTRETCH MUI_WELCOMEFINISHPAGE_ "" + !insertmacro MUI_LEGACY_MAP_NOSTRETCH MUI_UNWELCOMEFINISHPAGE_ "" + !verbose pop + + ;Default header images + !ifdef MUI_HEADERIMAGE + + !insertmacro MUI_DEFAULT MUI_HEADERIMAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp" + !insertmacro MUI_DEFAULT MUI_HEADERIMAGE_BITMAP_STRETCH "FitControl" + !insertmacro MUI_DEFAULT MUI_HEADERIMAGE_BITMAP_RTL_STRETCH ${MUI_HEADERIMAGE_BITMAP_STRETCH} + + !ifndef MUI_HEADERIMAGE_UNBITMAP + !define MUI_HEADERIMAGE_UNBITMAP "${MUI_HEADERIMAGE_BITMAP}" + !insertmacro MUI_SET MUI_HEADERIMAGE_UNBITMAP_STRETCH ${MUI_HEADERIMAGE_BITMAP_STRETCH} + !endif + + !if "${MUI_HEADERIMAGE_BITMAP}" == "" + !error "Invalid MUI_HEADERIMAGE_BITMAP" + !endif + !if "${MUI_HEADERIMAGE_UNBITMAP}" == "" + !error "Invalid MUI_HEADERIMAGE_UNBITMAP" + !endif + + !ifdef MUI_HEADERIMAGE_BITMAP_RTL + !ifndef MUI_HEADERIMAGE_UNBITMAP_RTL + !define MUI_HEADERIMAGE_UNBITMAP_RTL "${MUI_HEADERIMAGE_BITMAP_RTL}" + !insertmacro MUI_SET MUI_HEADERIMAGE_UNBITMAP_RTL_STRETCH ${MUI_HEADERIMAGE_BITMAP_RTL_STRETCH} + !endif + + !if "${MUI_HEADERIMAGE_BITMAP_RTL}" == "" + !error "Invalid MUI_HEADERIMAGE_BITMAP_RTL" + !endif + !if "${MUI_HEADERIMAGE_UNBITMAP_RTL}" == "" + !error "Invalid MUI_HEADERIMAGE_UNBITMAP_RTL" + !endif + !endif + + !insertmacro MUI_DEFAULT MUI_HEADERIMAGE_UNBITMAP_STRETCH ${MUI_HEADERIMAGE_BITMAP_STRETCH} + !insertmacro MUI_DEFAULT MUI_HEADERIMAGE_UNBITMAP_RTL_STRETCH ${MUI_HEADERIMAGE_BITMAP_RTL_STRETCH} + + !endif + + ;Default texts + !insertmacro MUI_DEFAULT MUI_ABORTWARNING_TEXT "$(MUI_TEXT_ABORTWARNING)" + !insertmacro MUI_DEFAULT MUI_UNABORTWARNING_TEXT "$(MUI_UNTEXT_ABORTWARNING)" + + ;Apply settings + + XPStyle On ;XP style setting in manifest resource + + ;Dialog resources + ChangeUI all "${MUI_UI}" + !ifdef MUI_HEADERIMAGE + !ifndef MUI_HEADERIMAGE_RIGHT + ChangeUI IDD_INST "${MUI_UI_HEADERIMAGE}" + !else + ChangeUI IDD_INST "${MUI_UI_HEADERIMAGE_RIGHT}" + !endif + !endif + + ;Icons + Icon "${MUI_ICON}" + UninstallIcon "${MUI_UNICON}" + + !endif + +!macroend + + +;-------------------------------- +;Abort warning message box + +!macro MUI_ABORTWARNING + + !ifdef MUI_ABORTWARNING_CANCEL_DEFAULT + MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_DEFBUTTON2 "${MUI_ABORTWARNING_TEXT}" IDYES mui.Quit + !else + MessageBox MB_YESNO|MB_ICONEXCLAMATION "${MUI_ABORTWARNING_TEXT}" IDYES mui.Quit + !endif + + Abort + mui.Quit: + +!macroend + +!macro MUI_UNABORTWARNING + + !ifdef MUI_UNABORTWARNING_CANCEL_DEFAULT + MessageBox MB_YESNO|MB_ICONEXCLAMATION|MB_DEFBUTTON2 "${MUI_UNABORTWARNING_TEXT}" IDYES mui.Quit + !else + MessageBox MB_YESNO|MB_ICONEXCLAMATION "${MUI_UNABORTWARNING_TEXT}" IDYES mui.Quit + !endif + + Abort + mui.Quit: + +!macroend + + +;-------------------------------- +;Initialization of GUI + +!macro MUI_HEADERIMAGE_INITHELPER_LOADIMAGEWITHMACRO MACRO + + !ifdef MUI_HEADERIMAGE_RIGHT + !ifndef MUI_OPTIMIZE_ALWAYSLTR ; Undocumented + ${if} $(^RTL) == 1 + !insertmacro ${MACRO} $mui.Header.Image "${PATH}" Left Leak + ${Else} + !insertmacro ${MACRO} $mui.Header.Image "${PATH}" Right Leak + ${EndIf} + !else + !insertmacro ${MACRO} $mui.Header.Image "${PATH}" Right Leak + !endif + !else + !insertmacro ${MACRO} $mui.Header.Image "${PATH}" Auto Leak + !endif + +!macroend +!macro MUI_HEADERIMAGE_INITHELPER_LOADIMAGE UN RTL IMGRESID PATH + + GetDlgItem $mui.Header.Image $HWNDPARENT ${IMGRESID} ; This variable is not used by every mode but we have to reference it to avoid a compiler warning. + + !if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" == "NoStretchNoCropNoAlign" + + SetBrandingImage /IMGID=${IMGRESID} "${PATH}" + + !else if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" == "NoStretchNoCrop" + + !insertmacro MUI_HEADERIMAGE_INITHELPER_LOADIMAGEWITHMACRO \ + MUI_LOADANDXALIGNIMAGE + + !else if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" == "AspectFitHeight" + + !insertmacro MUI_HEADERIMAGE_INITHELPER_LOADIMAGEWITHMACRO \ + MUI_LOADANDASPECTSTRETCHIMAGETOCONTROLHEIGHT + + !else + + !if "${MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH}" != "FitControl" + !warning 'MUI_HEADERIMAGE_${UN}BITMAP${RTL}_STRETCH set to unknown value, defaulting to FitControl' + !endif + SetBrandingImage /IMGID=${IMGRESID} /RESIZETOFIT "${PATH}" + + !endif + +!macroend + +!macro MUI_HEADERIMAGE_INIT UN IMGRESID + + ;Load and display header image + + !ifdef MUI_HEADERIMAGE + + InitPluginsDir + + !ifdef MUI_HEADERIMAGE_${UN}BITMAP_RTL + ${if} $(^RTL) == 1 + + File "/oname=$PLUGINSDIR\modern-header.bmp" "${MUI_HEADERIMAGE_${UN}BITMAP_RTL}" + !pragma verifyloadimage "${MUI_HEADERIMAGE_${UN}BITMAP_RTL}" + !insertmacro MUI_HEADERIMAGE_INITHELPER_LOADIMAGE "${UN}" "_RTL" ${IMGRESID} "$PLUGINSDIR\modern-header.bmp" + + ${else} + !endif + + File "/oname=$PLUGINSDIR\modern-header.bmp" "${MUI_HEADERIMAGE_${UN}BITMAP}" + !pragma verifyloadimage "${MUI_HEADERIMAGE_${UN}BITMAP}" + !insertmacro MUI_HEADERIMAGE_INITHELPER_LOADIMAGE "${UN}" "" ${IMGRESID} "$PLUGINSDIR\modern-header.bmp" + + !ifdef MUI_HEADERIMAGE_${UN}BITMAP_RTL + ${endif} + !endif + + !endif + +!macroend + +!macro MUI_GUIINIT_OUTERDIALOG UNINSTALLER + + ;Initialize outer dialog (fonts & colors) + + ;Header + GetDlgItem $mui.Header.Text $HWNDPARENT 1037 + CreateFont $mui.Header.Text.Font "$(^Font)" "$(^FontSize)" "700" + SendMessage $mui.Header.Text ${WM_SETFONT} $mui.Header.Text.Font 0 + + GetDlgItem $mui.Header.SubText $HWNDPARENT 1038 + + !ifndef MUI_HEADER_TRANSPARENT_TEXT + SetCtlColors $mui.Header.Text "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}" + SetCtlColors $mui.Header.SubText "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}" + !else + SetCtlColors $mui.Header.Text "${MUI_TEXTCOLOR}" "transparent" + SetCtlColors $mui.Header.SubText "${MUI_TEXTCOLOR}" "transparent" + !endif + + ;Header image + !insertmacro MUI_HEADERIMAGE_INIT "${UNINSTALLER}" 1046 + + ;Header background + GetDlgItem $mui.Header.Background $HWNDPARENT 1034 + SetCtlColors $mui.Header.Background "" "${MUI_BGCOLOR}" + + ;Header icon image background + !ifndef MUI_HEADERIMAGE + GetDlgItem $mui.Header.Image $HWNDPARENT 1039 + SetCtlColors $mui.Header.Image "" "${MUI_BGCOLOR}" + !endif + + ;Branding text + GetDlgItem $mui.Branding.Background $HWNDPARENT 1028 + SetCtlColors $mui.Branding.Background /BRANDING + GetDlgItem $mui.Branding.Text $HWNDPARENT 1256 + SetCtlColors $mui.Branding.Text /BRANDING + SendMessage $mui.Branding.Text ${WM_SETTEXT} 0 "STR:$(^Branding) " + + ;Lines + GetDlgItem $mui.Line.Standard $HWNDPARENT 1035 + GetDlgItem $mui.Line.FullWindow $HWNDPARENT 1045 + + ;Buttons + GetDlgItem $mui.Button.Next $HWNDPARENT 1 + GetDlgItem $mui.Button.Cancel $HWNDPARENT 2 + GetDlgItem $mui.Button.Back $HWNDPARENT 3 + +!macroend + + +;-------------------------------- +;Interface functions + +!macro MUI_FUNCTION_GUIINIT + + Function .onGUIInit + + !insertmacro MUI_GUIINIT_OUTERDIALOG "" + + !ifdef MUI_PAGE_FUNCTION_GUIINIT + Call "${MUI_PAGE_FUNCTION_GUIINIT}" + !endif + + !ifdef MUI_CUSTOMFUNCTION_GUIINIT + Call "${MUI_CUSTOMFUNCTION_GUIINIT}" + !endif + + FunctionEnd + +!macroend + +!macro MUI_UNFUNCTION_GUIINIT + + Function un.onGUIInit + + !insertmacro MUI_GUIINIT_OUTERDIALOG UN + + !ifdef MUI_UNPAGE_FUNCTION_GUIINIT + Call "${MUI_UNPAGE_FUNCTION_GUIINIT}" + !endif + + !ifdef MUI_CUSTOMFUNCTION_UNGUIINIT + Call "${MUI_CUSTOMFUNCTION_UNGUIINIT}" + !endif + + FunctionEnd + +!macroend + +!macro MUI_FUNCTION_ABORTWARNING + + Function .onUserAbort + + !ifdef MUI_PAGE_FUNCTION_ABORTWARNING + Call ${MUI_PAGE_FUNCTION_ABORTWARNING} + !endif + + !ifdef MUI_ABORTWARNING + !insertmacro MUI_ABORTWARNING + !endif + + !ifdef MUI_CUSTOMFUNCTION_ABORT + Call "${MUI_CUSTOMFUNCTION_ABORT}" + !endif + + FunctionEnd + +!macroend + +!macro MUI_FUNCTION_UNABORTWARNING + + Function un.onUserAbort + + !ifdef MUI_UNPAGE_FUNCTION_ABORTWARNING + Call ${MUI_UNPAGE_FUNCTION_ABORTWARNING} + !endif + + !ifdef MUI_UNABORTWARNING + !insertmacro MUI_UNABORTWARNING + !endif + + !ifdef MUI_CUSTOMFUNCTION_UNABORT + Call "${MUI_CUSTOMFUNCTION_UNABORT}" + !endif + + FunctionEnd + +!macroend diff --git a/installer/tools/Contrib/Modern UI 2/Localization.nsh b/installer/tools/Contrib/Modern UI 2/Localization.nsh new file mode 100644 index 00000000..1f02b187 --- /dev/null +++ b/installer/tools/Contrib/Modern UI 2/Localization.nsh @@ -0,0 +1,198 @@ +/* + +NSIS Modern User Interface +Localization + +*/ + +;-------------------------------- +;Variables + +!macro MUI_LANGDLL_VARIABLES + + !ifdef MUI_LANGDLL_REGISTRY_ROOT & MUI_LANGDLL_REGISTRY_KEY & MUI_LANGDLL_REGISTRY_VALUENAME + !ifndef MUI_LANGDLL_REGISTRY_VARIABLES + !define MUI_LANGDLL_REGISTRY_VARIABLES + + ;/GLOBAL because the macros are included in a function + Var /GLOBAL mui.LangDLL.RegistryLanguage + + !endif + !endif + +!macroend + + +;-------------------------------- +;Include language files + +!macro MUI_LANGUAGEEX LangDir NLFID + + !verbose push ${MUI_VERBOSE} + + !ifndef MUI_PAGE_UNINSTALLER_PREFIX + !ifndef MUI_DISABLE_INSERT_LANGUAGE_AFTER_PAGES_WARNING ; Define this to avoid the warning if you only have custom pages + !warning "MUI_LANGUAGE[EX] should be inserted after the MUI_[UN]PAGE_* macros" + !endif + !endif + + !insertmacro MUI_INSERT + + ;Include a language + LoadLanguageFile "${LangDir}\${NLFID}.nlf" + + ;Include MUI language file + !insertmacro LANGFILE_INCLUDE_WITHDEFAULT \ + "${LangDir}\${NLFID}.nsh" "${NSISDIR}\Contrib\Language files\English.nsh" + + ;Add language to list of languages for selection dialog + !define /ifndef MUI_LANGDLL_LANGUAGES "" + !define /redef MUI_LANGDLL_LANGUAGES \ + `"${LANGFILE_${NLFID}_LANGDLL}" "${LANG_${NLFID}}" ${MUI_LANGDLL_LANGUAGES}` + !define /ifndef MUI_LANGDLL_LANGUAGES_CP "" + !define /redef MUI_LANGDLL_LANGUAGES_CP \ + `"${LANGFILE_${NLFID}_LANGDLL}" "${LANG_${NLFID}}" "${LANG_${NLFID}_CP}" ${MUI_LANGDLL_LANGUAGES_CP}` + + !verbose pop + +!macroend + +!macro MUI_LANGUAGE NLFID + + !verbose push ${MUI_VERBOSE} + + !insertmacro MUI_LANGUAGEEX "${NSISDIR}\Contrib\Language files" "${NLFID}" + + !verbose pop + +!macroend + + +;-------------------------------- +;Language selection + +!macro MUI_LANGDLL_DISPLAY + + !verbose push + !verbose ${MUI_VERBOSE} + + !ifndef MUI_LANGDLL_LANGUAGES + !warning "MUI_LANGDLL_DISPLAY should only be used after inserting the MUI_LANGUAGE macro(s)" + !endif + + !insertmacro MUI_LANGDLL_VARIABLES + + !insertmacro MUI_DEFAULT MUI_LANGDLL_WINDOWTITLE "Installer Language" + !insertmacro MUI_DEFAULT MUI_LANGDLL_INFO "Please select a language." + + !ifdef MUI_LANGDLL_REGISTRY_VARIABLES + + ReadRegStr $mui.LangDLL.RegistryLanguage "${MUI_LANGDLL_REGISTRY_ROOT}" "${MUI_LANGDLL_REGISTRY_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}" + + ${if} $mui.LangDLL.RegistryLanguage != "" + ;Set default language to registry language + StrCpy $LANGUAGE $mui.LangDLL.RegistryLanguage + ${endif} + + !endif + + !ifdef NSIS_CONFIG_SILENT_SUPPORT + ${unless} ${Silent} + !endif + + !ifndef MUI_LANGDLL_ALWAYSSHOW + !ifdef MUI_LANGDLL_REGISTRY_VARIABLES + ${if} $mui.LangDLL.RegistryLanguage == "" + !endif + !endif + + ;Show language selection dialog + !ifdef MUI_LANGDLL_ALLLANGUAGES + LangDLL::LangDialog "${MUI_LANGDLL_WINDOWTITLE}" "${MUI_LANGDLL_INFO}" A ${MUI_LANGDLL_LANGUAGES} "" + !else + LangDLL::LangDialog "${MUI_LANGDLL_WINDOWTITLE}" "${MUI_LANGDLL_INFO}" AC ${MUI_LANGDLL_LANGUAGES_CP} "" + !endif + + Pop $LANGUAGE + ${if} $LANGUAGE == "cancel" + Abort + ${endif} + + !ifndef MUI_LANGDLL_ALWAYSSHOW + !ifdef MUI_LANGDLL_REGISTRY_VARIABLES + ${endif} + !endif + !endif + + + !ifdef NSIS_CONFIG_SILENT_SUPPORT + ${endif} + !endif + + !verbose pop + +!macroend + +!macro MUI_LANGDLL_SAVELANGUAGE + + ;Save language in registry + + !ifndef MUI_PAGE_UNINSTALLER + + IfAbort mui.langdllsavelanguage_abort + + !ifdef MUI_LANGDLL_REGISTRY_ROOT & MUI_LANGDLL_REGISTRY_KEY & MUI_LANGDLL_REGISTRY_VALUENAME + WriteRegStr "${MUI_LANGDLL_REGISTRY_ROOT}" "${MUI_LANGDLL_REGISTRY_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}" $LANGUAGE + !endif + + mui.langdllsavelanguage_abort: + + !endif + +!macroend + +!macro MUI_UNGETLANGUAGE + + ;Get language from registry in uninstaller + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_LANGDLL_VARIABLES + + !ifdef MUI_LANGDLL_REGISTRY_ROOT & MUI_LANGDLL_REGISTRY_KEY & MUI_LANGDLL_REGISTRY_VALUENAME + + ReadRegStr $mui.LangDLL.RegistryLanguage "${MUI_LANGDLL_REGISTRY_ROOT}" "${MUI_LANGDLL_REGISTRY_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}" + + ${if} $mui.LangDLL.RegistryLanguage = "" + + !endif + + !insertmacro MUI_LANGDLL_DISPLAY + + !ifdef MUI_LANGDLL_REGISTRY_ROOT & MUI_LANGDLL_REGISTRY_KEY & MUI_LANGDLL_REGISTRY_VALUENAME + + ${else} + StrCpy $LANGUAGE $mui.LangDLL.RegistryLanguage + ${endif} + + !endif + + !verbose pop + +!macroend + + +;-------------------------------- +;Rerserve LangDLL file + +!macro MUI_RESERVEFILE_LANGDLL + + !verbose push + !verbose ${MUI_VERBOSE} + + ReserveFile /plugin LangDLL.dll + + !verbose pop + +!macroend diff --git a/installer/tools/Contrib/Modern UI 2/MUI2.nsh b/installer/tools/Contrib/Modern UI 2/MUI2.nsh new file mode 100644 index 00000000..94cea269 --- /dev/null +++ b/installer/tools/Contrib/Modern UI 2/MUI2.nsh @@ -0,0 +1,117 @@ +/* + +NSIS Modern User Interface - Version 2.1 +Copyright 2002-2023 Joost Verburg +Contributors: Amir Szekely, Anders Kjersem + +*/ + +!ifndef MUI_INCLUDED +!verbose push 3 +!define MUI_INCLUDED +!define MUI_SYSVERSION "2.1" +!verbose pop +!echo "NSIS Modern User Interface version ${MUI_SYSVERSION} - Copyright 2002-2023 Joost Verburg" + +;-------------------------------- +!verbose push 3 +!define /IfNDef MUI_VERBOSE 3 +!verbose ${MUI_VERBOSE} + +!addincludedir "${NSISDIR}\Contrib\Modern UI 2" + +;-------------------------------- +;Header files required by MUI + +!include WinMessages.nsh +!include LogicLib.nsh +!include nsDialogs.nsh +!include LangFile.nsh + + +;-------------------------------- +;Macros for compile-time defines + +!macro MUI_DEFAULT SYMBOL CONTENT + + ;Define symbol if not yet defined + ;For setting default values + + !ifndef "${SYMBOL}" + !define "${SYMBOL}" "${CONTENT}" + !endif + +!macroend + +!macro MUI_SET SYMBOL CONTENT + + ;Define symbol and undefine if necessary + + !insertmacro MUI_UNSET "${SYMBOL}" + !define "${SYMBOL}" "${CONTENT}" + +!macroend + +!macro MUI_UNSET SYMBOL + + ;Undefine symbol if defined + + !ifdef "${SYMBOL}" + !undef "${SYMBOL}" + !endif + +!macroend + + +;-------------------------------- +;MUI interface + +!include "Deprecated.nsh" +!include "Interface.nsh" +!include "Localization.nsh" +!include "Pages.nsh" + + +;-------------------------------- +;Pages + +!include "Pages\Components.nsh" +!include "Pages\Directory.nsh" +!include "Pages\Finish.nsh" +!include "Pages\InstallFiles.nsh" +!include "Pages\License.nsh" +!include "Pages\StartMenu.nsh" +!include "Pages\UninstallConfirm.nsh" +!include "Pages\Welcome.nsh" + + +;-------------------------------- +;Insert MUI code in script + +!macro MUI_INSERT + + !ifndef MUI_INSERT + !define MUI_INSERT + + ;This macro is included when the first language file is included, + ;after the pages. + + ;Interface settings + !insertmacro MUI_INTERFACE + + ;Interface functions - Installer + !insertmacro MUI_FUNCTION_GUIINIT + !insertmacro MUI_FUNCTION_ABORTWARNING + + ;Interface functions - Uninstaller + !ifdef MUI_UNINSTALLER + !insertmacro MUI_UNFUNCTION_GUIINIT + !insertmacro MUI_FUNCTION_UNABORTWARNING + !endif + + !endif + +!macroend + +!verbose pop +!endif ;~ MUI_INCLUDED diff --git a/installer/tools/Contrib/Modern UI 2/Pages.nsh b/installer/tools/Contrib/Modern UI 2/Pages.nsh new file mode 100644 index 00000000..7a3c3778 --- /dev/null +++ b/installer/tools/Contrib/Modern UI 2/Pages.nsh @@ -0,0 +1,324 @@ +/* + +NSIS Modern User Interface +Support code for all pages + +*/ + +;-------------------------------- +;Page initialization + +!macro MUI_PAGE_INIT + + !ifdef MUI_INSERT + !warning "MUI_PAGE_* inserted after MUI_LANGUAGE" + !endif + + ;Include interface settings if necessary + !insertmacro MUI_INTERFACE + + ;Define settings for installer page + !insertmacro MUI_UNSET MUI_PAGE_UNINSTALLER + !insertmacro MUI_UNSET MUI_PAGE_UNINSTALLER_PREFIX + !insertmacro MUI_UNSET MUI_PAGE_UNINSTALLER_FUNCPREFIX + + !insertmacro MUI_SET MUI_PAGE_UNINSTALLER_PREFIX "" + !insertmacro MUI_SET MUI_PAGE_UNINSTALLER_FUNCPREFIX "" + + ;Generate unique ID + !insertmacro MUI_UNSET MUI_UNIQUEID + !define MUI_UNIQUEID ${__LINE__} + +!macroend + +!macro MUI_UNPAGE_INIT + + !ifdef MUI_INSERT + !warning "MUI_UNPAGE_* inserted after MUI_LANGUAGE" + !endif + + ;Include interface settings + !insertmacro MUI_INTERFACE + + ;Define prefixes for uninstaller page + !insertmacro MUI_SET MUI_UNINSTALLER "" + + !insertmacro MUI_SET MUI_PAGE_UNINSTALLER "" + !insertmacro MUI_SET MUI_PAGE_UNINSTALLER_PREFIX "UN" + !insertmacro MUI_SET MUI_PAGE_UNINSTALLER_FUNCPREFIX "un." + + ;Generate unique ID + !insertmacro MUI_UNSET MUI_UNIQUEID + !define MUI_UNIQUEID ${__LINE__} + +!macroend + + +;-------------------------------- +;Header text for standard MUI page + +!macro MUI_HEADER_TEXT_PAGE TEXT SUBTEXT + + !ifdef MUI_PAGE_HEADER_TEXT & MUI_PAGE_HEADER_SUBTEXT + !insertmacro MUI_HEADER_TEXT "${MUI_PAGE_HEADER_TEXT}" "${MUI_PAGE_HEADER_SUBTEXT}" + !else ifdef MUI_PAGE_HEADER_TEXT + !insertmacro MUI_HEADER_TEXT "${MUI_PAGE_HEADER_TEXT}" "${SUBTEXT}" + !else ifdef MUI_PAGE_HEADER_SUBTEXT + !insertmacro MUI_HEADER_TEXT "${TEXT}" "${MUI_PAGE_HEADER_SUBTEXT}" + !else + !insertmacro MUI_HEADER_TEXT "${TEXT}" "${SUBTEXT}" + !endif + + !insertmacro MUI_UNSET MUI_PAGE_HEADER_TEXT + !insertmacro MUI_UNSET MUI_PAGE_HEADER_SUBTEXT + +!macroend + + +;-------------------------------- +;Header text for custom page + +!macro MUI_HEADER_TEXT TEXT SUBTEXT ;Called from script + + !verbose push + !verbose ${MUI_VERBOSE} + + !ifdef MUI_HEADER_TRANSPARENT_TEXT + LockWindow on + !endif + + SendMessage $mui.Header.Text ${WM_SETTEXT} 0 "STR:${TEXT}" + SendMessage $mui.Header.SubText ${WM_SETTEXT} 0 "STR:${SUBTEXT}" + + !ifdef MUI_HEADER_TRANSPARENT_TEXT + LockWindow off + !endif + + !verbose pop + +!macroend + + +;-------------------------------- +;Custom page functions + +!macro MUI_PAGE_FUNCTION_CUSTOM TYPE + + !ifdef MUI_PAGE_CUSTOMFUNCTION_${TYPE} + Call "${MUI_PAGE_CUSTOMFUNCTION_${TYPE}}" + !undef MUI_PAGE_CUSTOMFUNCTION_${TYPE} + !endif + +!macroend + + +;-------------------------------- +;Support for full window pages (like welcome/finish page) + +!macro MUI_PAGE_FUNCTION_FULLWINDOW + + !ifndef MUI_${MUI_PAGE_UNINSTALLER_PREFIX}PAGE_FUNCTION_FULLWINDOW + !define MUI_${MUI_PAGE_UNINSTALLER_PREFIX}PAGE_FUNCTION_FULLWINDOW + + Function ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}muiPageLoadFullWindow + + LockWindow on + + ;The branding text needs to be hidden because the full windows page + ;overlaps with it. + ShowWindow $mui.Branding.Background ${SW_HIDE} + ShowWindow $mui.Branding.Text ${SW_HIDE} + + ;The texts need to be hidden because otherwise they may show through + ;the page above when the Alt key is pressed. + ShowWindow $mui.Header.Text ${SW_HIDE} + ShowWindow $mui.Header.SubText ${SW_HIDE} + ShowWindow $mui.Header.Image ${SW_HIDE} + + ;Show line below full width of page + ShowWindow $mui.Line.Standard ${SW_HIDE} + ShowWindow $mui.Line.FullWindow ${SW_NORMAL} + + LockWindow off + + FunctionEnd + + Function ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}muiPageUnloadFullWindow + + ;Set everything back to normal again + + LockWindow on + + ShowWindow $mui.Branding.Background ${SW_NORMAL} + ShowWindow $mui.Branding.Text ${SW_NORMAL} + + ShowWindow $mui.Header.Text ${SW_NORMAL} + ShowWindow $mui.Header.SubText ${SW_NORMAL} + ShowWindow $mui.Header.Image ${SW_NORMAL} + + ShowWindow $mui.Line.Standard ${SW_NORMAL} + ShowWindow $mui.Line.FullWindow ${SW_HIDE} + + LockWindow off + + FunctionEnd + + !endif + +!macroend + +!macro MUI_INTERNAL_FULLWINDOW_LOADWIZARDIMAGE _un _hwndImg _ImgPath _RetImgHandle + + !ifdef MUI_${_un}WELCOMEFINISHPAGE_BITMAP_NOSTRETCH + !insertmacro MUI_DEFAULT MUI_${_un}WELCOMEFINISHPAGE_BITMAP_STRETCH NoStretchNoCropNoAlign ; Legacy compatibility + !endif + !insertmacro MUI_DEFAULT MUI_${_un}WELCOMEFINISHPAGE_BITMAP_STRETCH FitControl + + !if "${MUI_${_un}WELCOMEFINISHPAGE_BITMAP_STRETCH}" == "NoStretchNoCropNoAlign" + + ${NSD_SetImage} ${_hwndImg} "${_ImgPath}" "${_RetImgHandle}" + + !else if "${MUI_${_un}WELCOMEFINISHPAGE_BITMAP_STRETCH}" == "NoStretchNoCrop" + + !insertmacro MUI_LOADANDXALIGNIMAGE ${_hwndImg} "${_ImgPath}" Auto "${_RetImgHandle}" + + !else if "${MUI_${_un}WELCOMEFINISHPAGE_BITMAP_STRETCH}" == "AspectFitHeight" + + !insertmacro MUI_LOADANDASPECTSTRETCHIMAGETOCONTROLHEIGHT ${_hwndImg} "${_ImgPath}" Auto "${_RetImgHandle}" + + !else + + !if "${MUI_${_un}WELCOMEFINISHPAGE_BITMAP_STRETCH}" != "FitControl" + !warning 'MUI_${_un}WELCOMEFINISHPAGE_BITMAP_STRETCH set to unknown value, defaulting to FitControl' + !endif + ${NSD_SetStretchedImage} ${_hwndImg} "${_ImgPath}" "${_RetImgHandle}" + + !endif + +!macroend + + +;-------------------------------- +;Helper macros + +!include Util.nsh + +!macro MUI_INTERNAL_LOADANDSIZEIMAGE _macro _hwndImg _ImgPath _XAlign _RetImgHandle + !if "${_XAlign}" == "Auto" + ${if} $(^RTL) == 1 + Push "*${_ImgPath}" + ${Else} + Push "${_ImgPath}" + ${EndIf} + !else if "${_XAlign}" == "Right" + Push "*${_ImgPath}" + !else + Push "${_ImgPath}" + !endif + Push "${_hwndImg}" + ${CallArtificialFunction} ${_macro} + !if "${_RetImgHandle}" == "Leak" + !insertmacro _LOGICLIB_TEMP + Pop $_LOGICLIB_TEMP + !else if "${_RetImgHandle}" != "Stack" + Pop ${_RetImgHandle} + !endif +!macroend + +!macro MUI_LOADANDXALIGNIMAGE _hwndImg _ImgPath _XAlign _RetImgHandle +!insertmacro MUI_INTERNAL_LOADANDSIZEIMAGE \ + MUI_INTERNAL_LOADANDXALIGNIMAGE "${_hwndImg}" "${_ImgPath}" "${_XAlign}" "${_RetImgHandle}" +!macroend +!macro MUI_INTERNAL_LOADANDXALIGNIMAGE + System::Store "S" + System::Call 'USER32::GetWindowRect(psr0,@r1)' + System::Call 'USER32::MapWindowPoints(p0,p$hwndparent,pr1,i2)' ; Note: Assuming control is not in inner dialog + System::Call '*$1(i.r5,i.r6,i.r7,i.r8)' + IntOp $7 $7 - $5 + IntOp $8 $8 - $6 + + Pop $1 + StrCpy $3 $1 1 + ${If} $3 == "*" ; Move control to the right? + StrCpy $1 $1 "" 1 + ${Endif} + System::Call 'USER32::LoadImage(p0,tr1,i${IMAGE_BITMAP},i0,i0,i${LR_LOADFROMFILE})p.r2' + SendMessage $0 ${STM_SETIMAGE} ${IMAGE_BITMAP} $2 $1 + Push $2 ; Return value + System::Call 'GDI32::DeleteObject(pr1)' ; Note: Assuming the previous image (if any) was a bitmap + System::Call 'USER32::GetClientRect(pr0,@r1)' + System::Call '*$1(i,i,i.r1,i.r2)' + + ${If} $3 == "*" + ${AndIf} $1 < $7 ; ImgW < CtlW + IntOp $3 $7 - $1 + IntOp $5 $5 + $3 + System::Call 'USER32::SetWindowPos(pr0,p0,ir5,ir6,i,i,i0x15)' + ${EndIf} + + System::Store "L" +!macroend + +!macro MUI_LOADANDASPECTSTRETCHIMAGETOCONTROLHEIGHT _hwndImg _ImgPath _XAlign _RetImgHandle +!insertmacro MUI_INTERNAL_LOADANDSIZEIMAGE \ + MUI_INTERNAL_LOADANDASPECTSTRETCHIMAGETOCONTROLHEIGHT "${_hwndImg}" "${_ImgPath}" "${_XAlign}" "${_RetImgHandle}" +!macroend +!macro MUI_INTERNAL_LOADANDASPECTSTRETCHIMAGETOCONTROLHEIGHT + System::Store "S" + System::Call 'USER32::GetWindowRect(psr0,@r1)' + System::Call 'USER32::MapWindowPoints(p0,p$hwndparent,pr1,i2)' ; Note: Assuming control is not in inner dialog + System::Call '*$1(i.r5,i.r6,i.r7,i.r8)' + IntOp $7 $7 - $5 + IntOp $8 $8 - $6 + + Pop $1 + StrCpy $3 $1 1 + ${If} $3 == "*" ; Move control to the right? + StrCpy $1 $1 "" 1 + ${Endif} + System::Call 'USER32::LoadImage(p0,tr1,i${IMAGE_BITMAP},i0,i0,i${LR_LOADFROMFILE})p.r2' + SendMessage $0 ${STM_SETIMAGE} ${IMAGE_BITMAP} $2 $1 + Push $2 ; Return value + System::Call 'GDI32::DeleteObject(pr1)' ; Note: Assuming the previous image (if any) was a bitmap + System::Call 'USER32::GetClientRect(pr0,@r1)' + System::Call '*$1(i,i,i.r1,i.r2)' + + IntOp $R7 $7 * 10000 + IntOp $R8 $8 * 10000 + IntOp $R1 $1 * 10000 + IntOp $R2 $2 * 10000 + IntOp $R3 $R1 / $2 + StrCpy $R4 10000 + ${If} $R1 > $R2 + StrCpy $R3 10000 + IntOp $R4 $R2 / $1 + ${EndIf} + + ${DoWhile} $R2 > $R8 ; ImgH > CtlH + IntOp $R1 $R1 - $R3 + IntOp $R2 $R2 - $R4 + ${Loop} + ${DoWhile} $R2 < $R8 ; ImgH < CtlH + IntOp $R1 $R1 + $R3 + IntOp $R2 $R2 + $R4 + ${Loop} + IntOp $1 $R1 / 10000 + IntOp $2 $R2 / 10000 + + ${If} $1 < $7 + ${AndIf} $3 == "*" + IntOp $R3 $7 - $1 + IntOp $5 $5 + $R3 + ${EndIf} + + ${DoWhile} $2 > $8 ; Non-aspect-maintained stretch to make it a pixel perfect match + IntOp $2 $2 - 1 + IntOp $1 $1 - 1 + ${IfThen} $3 == "*" ${|} IntOp $5 $5 + 1 ${|} + ${Loop} + + System::Call 'USER32::SetWindowPos(pr0,p0,ir5,ir6,ir1,ir2,i0x14)' + System::Store "L" +!macroend + + diff --git a/installer/tools/Contrib/Modern UI 2/Pages/Components.nsh b/installer/tools/Contrib/Modern UI 2/Pages/Components.nsh new file mode 100644 index 00000000..5003e5ef --- /dev/null +++ b/installer/tools/Contrib/Modern UI 2/Pages/Components.nsh @@ -0,0 +1,242 @@ +/* + +NSIS Modern User Interface +Components page + +*/ + +;-------------------------------- +;Page interface settings and variables + +!macro MUI_COMPONENTSPAGE_INTERFACE + + !ifndef MUI_COMPONENTSPAGE_INTERFACE + !define MUI_COMPONENTSPAGE_INTERFACE + Var mui.ComponentsPage + + Var mui.ComponentsPage.Text + Var mui.ComponentsPage.InstTypesText + Var mui.ComponentsPage.ComponentsText + + Var mui.ComponentsPage.InstTypes + Var mui.ComponentsPage.Components + + Var mui.ComponentsPage.DescriptionTitle + Var mui.ComponentsPage.DescriptionText.Info + Var mui.ComponentsPage.DescriptionText + + Var mui.ComponentsPage.SpaceRequired + + !insertmacro MUI_DEFAULT MUI_COMPONENTSPAGE_CHECKBITMAP "${NSISDIR}\Contrib\Graphics\Checks\modern.bmp" + + !insertmacro MUI_DEFAULT MUI_UI_COMPONENTSPAGE_SMALLDESC "${NSISDIR}\Contrib\UIs\modern_smalldesc.exe" + !insertmacro MUI_DEFAULT MUI_UI_COMPONENTSPAGE_NODESC "${NSISDIR}\Contrib\UIs\modern_nodesc.exe" + + ;Apply settings + + !ifdef MUI_COMPONENTSPAGE_SMALLDESC + ChangeUI IDD_SELCOM "${MUI_UI_COMPONENTSPAGE_SMALLDESC}" + !else ifdef MUI_COMPONENTSPAGE_NODESC + ChangeUI IDD_SELCOM "${MUI_UI_COMPONENTSPAGE_NODESC}" + !endif + + CheckBitmap "${MUI_COMPONENTSPAGE_CHECKBITMAP}" + + !endif + +!macroend + + +;-------------------------------- +;Page declaration + +!macro MUI_PAGEDECLARATION_COMPONENTS + + !insertmacro MUI_SET MUI_${MUI_PAGE_UNINSTALLER_PREFIX}COMPONENTSPAGE "" + !insertmacro MUI_COMPONENTSPAGE_INTERFACE + + !insertmacro MUI_DEFAULT MUI_COMPONENTSPAGE_TEXT_TOP "" + !insertmacro MUI_DEFAULT MUI_COMPONENTSPAGE_TEXT_COMPLIST "" + !insertmacro MUI_DEFAULT MUI_COMPONENTSPAGE_TEXT_INSTTYPE "" + !insertmacro MUI_DEFAULT MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_TITLE "$(MUI_INNERTEXT_COMPONENTS_DESCRIPTION_TITLE)" + !insertmacro MUI_DEFAULT MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_INFO "$(MUI_INNERTEXT_COMPONENTS_DESCRIPTION_INFO)" + + PageEx ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}components + + PageCallbacks ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.ComponentsPre_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.ComponentsShow_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.ComponentsLeave_${MUI_UNIQUEID} + + Caption " " + + ComponentText "${MUI_COMPONENTSPAGE_TEXT_TOP}" "${MUI_COMPONENTSPAGE_TEXT_INSTTYPE}" "${MUI_COMPONENTSPAGE_TEXT_COMPLIST}" + + PageExEnd + + !insertmacro MUI_FUNCTION_COMPONENTSPAGE ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.ComponentsPre_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.ComponentsShow_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.ComponentsLeave_${MUI_UNIQUEID} + + !undef MUI_COMPONENTSPAGE_TEXT_TOP + !undef MUI_COMPONENTSPAGE_TEXT_COMPLIST + !undef MUI_COMPONENTSPAGE_TEXT_INSTTYPE + !insertmacro MUI_UNSET MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_TITLE + !insertmacro MUI_UNSET MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_INFO + +!macroend + +!macro MUI_PAGE_COMPONENTS + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_PAGE_INIT + !insertmacro MUI_PAGEDECLARATION_COMPONENTS + + !verbose pop + +!macroend + +!macro MUI_UNPAGE_COMPONENTS + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_UNPAGE_INIT + !insertmacro MUI_PAGEDECLARATION_COMPONENTS + + !verbose pop + +!macroend + + +;-------------------------------- +;Page functions + +!macro MUI_FUNCTION_COMPONENTSPAGE PRE SHOW LEAVE + + Function "${PRE}" + !insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE + !insertmacro MUI_HEADER_TEXT_PAGE $(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_COMPONENTS_TITLE) $(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_COMPONENTS_SUBTITLE) + FunctionEnd + + Function "${SHOW}" + + ;Get control handles + FindWindow $mui.ComponentsPage "#32770" "" $HWNDPARENT + GetDlgItem $mui.ComponentsPage.Text $mui.ComponentsPage 1006 + GetDlgItem $mui.ComponentsPage.InstTypesText $mui.ComponentsPage 1021 + GetDlgItem $mui.ComponentsPage.ComponentsText $mui.ComponentsPage 1022 + GetDlgItem $mui.ComponentsPage.InstTypes $mui.ComponentsPage 1017 + GetDlgItem $mui.ComponentsPage.Components $mui.ComponentsPage 1032 + GetDlgItem $mui.ComponentsPage.DescriptionTitle $mui.ComponentsPage 1042 + GetDlgItem $mui.ComponentsPage.DescriptionText $mui.ComponentsPage 1043 + GetDlgItem $mui.ComponentsPage.SpaceRequired $mui.ComponentsPage 1023 + + ;Default text in description textbox + SendMessage $mui.ComponentsPage.DescriptionTitle ${WM_SETTEXT} 0 "STR:${MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_TITLE}" + EnableWindow $mui.ComponentsPage.DescriptionText 0 + SendMessage $mui.ComponentsPage.DescriptionText ${WM_SETTEXT} 0 "STR:${MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_INFO}" + + StrCpy $mui.ComponentsPage.DescriptionText.Info "${MUI_COMPONENTSPAGE_TEXT_DESCRIPTION_INFO}" ;Text for current components page + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW + + FunctionEnd + + Function "${LEAVE}" + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE + + FunctionEnd + +!macroend + + +;-------------------------------- +;Script functions for components descriptions + +!macro MUI_DESCRIPTION_BEGIN + + ${if} $0 == -1 + ;No mouse hover over component in list + SendMessage $mui.ComponentsPage.DescriptionText ${WM_SETTEXT} 0 "STR:" + EnableWindow $mui.ComponentsPage.DescriptionText 0 + SendMessage $mui.ComponentsPage.DescriptionText ${WM_SETTEXT} 0 "STR:$mui.ComponentsPage.DescriptionText.Info" + +!macroend + +!macro MUI_DESCRIPTION_TEXT VAR TEXT + + !verbose push + !verbose ${MUI_VERBOSE} + + ${elseif} $0 == ${VAR} + SendMessage $mui.ComponentsPage.DescriptionText ${WM_SETTEXT} 0 "STR:" + EnableWindow $mui.ComponentsPage.DescriptionText 1 + SendMessage $mui.ComponentsPage.DescriptionText ${WM_SETTEXT} 0 "STR:${TEXT}" + + !verbose pop + +!macroend + +!macro MUI_DESCRIPTION_END + + !verbose push + !verbose ${MUI_VERBOSE} + + ${endif} + + !verbose pop + +!macroend + +!macro MUI_FUNCTION_DESCRIPTION_BEGIN + + !verbose push + !verbose ${MUI_VERBOSE} + + Function .onMouseOverSection + !insertmacro MUI_DESCRIPTION_BEGIN + + !verbose pop + +!macroend + +!macro MUI_FUNCTION_DESCRIPTION_END + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_DESCRIPTION_END + !ifdef MUI_CUSTOMFUNCTION_ONMOUSEOVERSECTION + Call "${MUI_CUSTOMFUNCTION_ONMOUSEOVERSECTION}" + !endif + FunctionEnd + + !verbose pop + +!macroend + +!macro MUI_UNFUNCTION_DESCRIPTION_BEGIN + + !verbose push + !verbose ${MUI_VERBOSE} + + Function un.onMouseOverSection + !insertmacro MUI_DESCRIPTION_BEGIN + + !verbose pop + +!macroend + +!macro MUI_UNFUNCTION_DESCRIPTION_END + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_DESCRIPTION_END + !ifdef MUI_CUSTOMFUNCTION_UNONMOUSEOVERSECTION + Call "${MUI_CUSTOMFUNCTION_UNONMOUSEOVERSECTION}" + !endif + FunctionEnd + + !verbose pop + +!macroend diff --git a/installer/tools/Contrib/Modern UI 2/Pages/Directory.nsh b/installer/tools/Contrib/Modern UI 2/Pages/Directory.nsh new file mode 100644 index 00000000..62093571 --- /dev/null +++ b/installer/tools/Contrib/Modern UI 2/Pages/Directory.nsh @@ -0,0 +1,126 @@ +/* + +NSIS Modern User Interface +Directory page + +*/ + +;-------------------------------- +;Page interface settings and variables + +!macro MUI_DIRECTORYPAGE_INTERFACE + + !ifndef MUI_DIRECTORYPAGE_INTERFACE + !define MUI_DIRECTORYPAGE_INTERFACE + Var mui.DirectoryPage + + Var mui.DirectoryPage.Text + + Var mui.DirectoryPage.DirectoryBox + Var mui.DirectoryPage.Directory + Var mui.DirectoryPage.BrowseButton + + Var mui.DirectoryPage.SpaceRequired + Var mui.DirectoryPage.SpaceAvailable + !endif + +!macroend + + +;-------------------------------- +;Page declaration + +!macro MUI_PAGEDECLARATION_DIRECTORY + + !insertmacro MUI_SET MUI_${MUI_PAGE_UNINSTALLER_PREFIX}DIRECTORYPAGE "" + !insertmacro MUI_DIRECTORYPAGE_INTERFACE + + !insertmacro MUI_DEFAULT MUI_DIRECTORYPAGE_TEXT_TOP "" + !insertmacro MUI_DEFAULT MUI_DIRECTORYPAGE_TEXT_DESTINATION "" + + PageEx ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}directory + + PageCallbacks ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.DirectoryPre_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.DirectoryShow_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.DirectoryLeave_${MUI_UNIQUEID} + + Caption " " + + DirText "${MUI_DIRECTORYPAGE_TEXT_TOP}" "${MUI_DIRECTORYPAGE_TEXT_DESTINATION}" + + !ifdef MUI_DIRECTORYPAGE_VARIABLE + DirVar "${MUI_DIRECTORYPAGE_VARIABLE}" + !endif + + !ifdef MUI_DIRECTORYPAGE_VERIFYONLEAVE + DirVerify leave + !endif + + PageExEnd + + !insertmacro MUI_FUNCTION_DIRECTORYPAGE ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.DirectoryPre_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.DirectoryShow_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.DirectoryLeave_${MUI_UNIQUEID} + + !undef MUI_DIRECTORYPAGE_TEXT_TOP + !undef MUI_DIRECTORYPAGE_TEXT_DESTINATION + !insertmacro MUI_UNSET MUI_DIRECTORYPAGE_VARIABLE + !insertmacro MUI_UNSET MUI_DIRECTORYPAGE_VERIFYONLEAVE + +!macroend + +!macro MUI_PAGE_DIRECTORY + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_PAGE_INIT + !insertmacro MUI_PAGEDECLARATION_DIRECTORY + + !verbose pop + +!macroend + +!macro MUI_UNPAGE_DIRECTORY + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_UNPAGE_INIT + !insertmacro MUI_PAGEDECLARATION_DIRECTORY + + !verbose pop + +!macroend + + +;-------------------------------- +;Page functions + +!macro MUI_FUNCTION_DIRECTORYPAGE PRE SHOW LEAVE + + Function "${PRE}" + !insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE + !insertmacro MUI_HEADER_TEXT_PAGE $(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_DIRECTORY_TITLE) $(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_DIRECTORY_SUBTITLE) + FunctionEnd + + Function "${SHOW}" + + ;Get control handles + FindWindow $mui.DirectoryPage "#32770" "" $HWNDPARENT + GetDlgItem $mui.DirectoryPage.Text $mui.DirectoryPage 1006 + GetDlgItem $mui.DirectoryPage.DirectoryBox $mui.DirectoryPage 1020 + GetDlgItem $mui.DirectoryPage.Directory $mui.DirectoryPage 1019 + GetDlgItem $mui.DirectoryPage.BrowseButton $mui.DirectoryPage 1001 + GetDlgItem $mui.DirectoryPage.SpaceRequired $mui.DirectoryPage 1023 + GetDlgItem $mui.DirectoryPage.SpaceAvailable $mui.DirectoryPage 1024 + + !ifdef MUI_DIRECTORYPAGE_BGCOLOR + !insertmacro MUI_DEFAULT MUI_DIRECTORYPAGE_TEXTCOLOR "" + SetCtlColors $mui.DirectoryPage.Directory "${MUI_DIRECTORYPAGE_TEXTCOLOR}" "${MUI_DIRECTORYPAGE_BGCOLOR}" + !endif + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW + FunctionEnd + + Function "${LEAVE}" + !insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE + FunctionEnd + +!macroend diff --git a/installer/tools/Contrib/Modern UI 2/Pages/Finish.nsh b/installer/tools/Contrib/Modern UI 2/Pages/Finish.nsh new file mode 100644 index 00000000..493c1e06 --- /dev/null +++ b/installer/tools/Contrib/Modern UI 2/Pages/Finish.nsh @@ -0,0 +1,510 @@ + /* + +NSIS Modern User Interface +Finish page (implemented using nsDialogs) + +*/ + +;-------------------------------- +;Page interface settings and variables + +!macro MUI_FINISHPAGE_INTERFACE + + !ifndef MUI_FINISHPAGE_INTERFACE + !define MUI_FINISHPAGE_INTERFACE + Var mui.FinishPage + + Var mui.FinishPage.Image + Var mui.FinishPage.Image.Bitmap + + Var mui.FinishPage.Title + Var mui.FinishPage.Title.Font + + Var mui.FinishPage.Text + !endif + + !ifndef MUI_FINISHPAGE_NOREBOOTSUPPORT + !ifndef MUI_FINISHPAGE_RETURNVALUE_VARIABLES + !define MUI_FINISHPAGE_RETURNVALUE_VARIABLES + Var mui.FinishPage.ReturnValue + !endif + !else ifdef MUI_FINISHPAGE_RUN | MUI_FINISHPAGE_SHOWREADME + !ifndef MUI_FINISHPAGE_RETURNVALUE_VARIABLES + !define MUI_FINISHPAGE_RETURNVALUE_VARIABLES + Var mui.FinishPage.ReturnValue + !endif + !endif + + !ifdef MUI_FINISHPAGE_CANCEL_ENABLED + !ifndef MUI_FINISHPAGE_CANCEL_ENABLED_VARIABLES + !define MUI_FINISHPAGE_CANCEL_ENABLED_VARIABLES + Var mui.FinishPage.DisableAbortWarning + !endif + !endif + + !ifdef MUI_FINISHPAGE_RUN + !ifndef MUI_FINISHPAGE_RUN_VARIABLES + !define MUI_FINISHPAGE_RUN_VARIABLES + Var mui.FinishPage.Run + !endif + !endif + + !ifdef MUI_FINISHPAGE_SHOWREADME + !ifndef MUI_FINISHPAGE_SHOWREADME_VARIABLES + !define MUI_FINISHPAGE_SHOWREADME_VARIABLES + Var mui.FinishPage.ShowReadme + !endif + !endif + + !ifdef MUI_FINISHPAGE_LINK + !ifndef MUI_FINISHPAGE_LINK_VARIABLES + !define MUI_FINISHPAGE_LINK_VARIABLES + Var mui.FinishPage.Link + !endif + !endif + + !ifndef MUI_FINISHPAGE_NOREBOOTSUPPORT + !ifndef MUI_FINISHPAGE_REBOOT_VARIABLES + !define MUI_FINISHPAGE_REBOOT_VARIABLES + Var mui.FinishPage.RebootNow + Var mui.FinishPage.RebootLater + !endif + !endif + + !insertmacro MUI_DEFAULT MUI_${MUI_PAGE_UNINSTALLER_PREFIX}WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\win.bmp" + !if "${MUI_${MUI_PAGE_UNINSTALLER_PREFIX}WELCOMEFINISHPAGE_BITMAP}" == "" + !error "Invalid MUI_${MUI_PAGE_UNINSTALLER_PREFIX}WELCOMEFINISHPAGE_BITMAP" + !endif + +!macroend + + +;-------------------------------- +;Interface initialization + +!macro MUI_FINISHPAGE_GUIINIT + + !ifndef MUI_${MUI_PAGE_UNINSTALLER_PREFIX}WELCOMEFINISHPAGE_GUINIT + !define MUI_${MUI_PAGE_UNINSTALLER_PREFIX}WELCOMEFINISHPAGE_GUINIT + + Function ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.FinishPage.GUIInit + + InitPluginsDir + File "/oname=$PLUGINSDIR\modern-wizard.bmp" "${MUI_${MUI_PAGE_UNINSTALLER_PREFIX}WELCOMEFINISHPAGE_BITMAP}" + !pragma verifyloadimage "${MUI_${MUI_PAGE_UNINSTALLER_PREFIX}WELCOMEFINISHPAGE_BITMAP}" + + !ifdef MUI_${MUI_PAGE_UNINSTALLER_PREFIX}PAGE_FUNCTION_GUIINIT + Call "${MUI_${MUI_PAGE_UNINSTALLER_PREFIX}PAGE_FUNCTION_GUIINIT}" + !endif + + !ifndef MUI_${MUI_PAGE_UNINSTALLER_PREFIX}FINISHPAGE_NOAUTOCLOSE + SetAutoClose true + !endif + + FunctionEnd + + !insertmacro MUI_SET MUI_${MUI_PAGE_UNINSTALLER_PREFIX}PAGE_FUNCTION_GUIINIT ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.FinishPage.GUIInit + + !endif + +!macroend + + +;-------------------------------- +;Abort warning + +!macro MUI_FINISHPAGE_ABORTWARNING + + !ifdef MUI_FINISHPAGE_CANCEL_ENABLED + + !ifndef MUI_${MUI_PAGE_UNINSTALLER_PREFIX}FINISHPAGE_ABORTWARNING + !define MUI_${MUI_PAGE_UNINSTALLER_PREFIX}FINISHPAGE_ABORTWARNING + + Function ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.FinishPage.AbortWarning + + ${if} $mui.FinishPage.DisableAbortWarning == "1" + Quit + ${endif} + + !ifdef MUI_${MUI_PAGE_UNINSTALLER_PREFIX}PAGE_FUNCTION_ABORTWARNING + Call ${MUI_${MUI_PAGE_UNINSTALLER_PREFIX}PAGE_FUNCTION_ABORTWARNING} + !endif + + FunctionEnd + + !insertmacro MUI_SET MUI_${MUI_PAGE_UNINSTALLER_PREFIX}PAGE_FUNCTION_ABORTWARNING ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.FinishPage.AbortWarning + + !endif + + !endif + +!macroend + + +;-------------------------------- +;Page declaration + +!macro MUI_PAGEDECLARATION_FINISH + + !insertmacro MUI_SET MUI_${MUI_PAGE_UNINSTALLER_PREFIX}FINISHPAGE "" + !insertmacro MUI_FINISHPAGE_INTERFACE + + !insertmacro MUI_FINISHPAGE_GUIINIT + !insertmacro MUI_FINISHPAGE_ABORTWARNING + + !insertmacro MUI_DEFAULT MUI_FINISHPAGE_TITLE "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_FINISH_INFO_TITLE)" + !insertmacro MUI_DEFAULT MUI_FINISHPAGE_TEXT "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_FINISH_INFO_TEXT)" + !insertmacro MUI_DEFAULT MUI_FINISHPAGE_BUTTON "$(MUI_BUTTONTEXT_FINISH)" + !insertmacro MUI_DEFAULT MUI_FINISHPAGE_TEXT_REBOOT "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_FINISH_INFO_REBOOT)" + !insertmacro MUI_DEFAULT MUI_FINISHPAGE_TEXT_REBOOTNOW "$(MUI_TEXT_FINISH_REBOOTNOW)" + !insertmacro MUI_DEFAULT MUI_FINISHPAGE_TEXT_REBOOTLATER "$(MUI_TEXT_FINISH_REBOOTLATER)" + !insertmacro MUI_DEFAULT MUI_FINISHPAGE_RUN_TEXT "$(MUI_TEXT_FINISH_RUN)" + !insertmacro MUI_DEFAULT MUI_FINISHPAGE_SHOWREADME_TEXT "$(MUI_TEXT_FINISH_SHOWREADME)" + !insertmacro MUI_DEFAULT MUI_FINISHPAGE_LINK_COLOR "000080" + + !insertmacro MUI_PAGE_FUNCTION_FULLWINDOW + + PageEx ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}custom + + PageCallbacks ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.FinishPage.Pre_${MUI_UNIQUEID} \ + ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.FinishPage.Leave_${MUI_UNIQUEID} + + Caption " " + + PageExEnd + + !insertmacro MUI_FUNCTION_FINISHPAGE ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.FinishPage.Pre_${MUI_UNIQUEID} \ + ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.FinishPage.Leave_${MUI_UNIQUEID} \ + ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.FinishPage.Link_${MUI_UNIQUEID} + + !insertmacro MUI_UNSET MUI_FINISHPAGE_TITLE + !insertmacro MUI_UNSET MUI_FINISHPAGE_TITLE_3LINES + !insertmacro MUI_UNSET MUI_FINISHPAGE_TEXT + !insertmacro MUI_UNSET MUI_FINISHPAGE_TEXT_LARGE + !insertmacro MUI_UNSET MUI_FINISHPAGE_BUTTON + !insertmacro MUI_UNSET MUI_FINISHPAGE_CANCEL_ENABLED + !insertmacro MUI_UNSET MUI_FINISHPAGE_TEXT_REBOOT + !insertmacro MUI_UNSET MUI_FINISHPAGE_TEXT_REBOOTNOW + !insertmacro MUI_UNSET MUI_FINISHPAGE_TEXT_REBOOTLATER + !insertmacro MUI_UNSET MUI_FINISHPAGE_REBOOTLATER_DEFAULT + !insertmacro MUI_UNSET MUI_FINISHPAGE_RUN + !insertmacro MUI_UNSET MUI_FINISHPAGE_RUN_TEXT + !insertmacro MUI_UNSET MUI_FINISHPAGE_RUN_PARAMETERS + !insertmacro MUI_UNSET MUI_FINISHPAGE_RUN_NOTCHECKED + !insertmacro MUI_UNSET MUI_FINISHPAGE_RUN_FUNCTION + !insertmacro MUI_UNSET MUI_FINISHPAGE_SHOWREADME + !insertmacro MUI_UNSET MUI_FINISHPAGE_SHOWREADME_TEXT + !insertmacro MUI_UNSET MUI_FINISHPAGE_SHOWREADME_NOTCHECKED + !insertmacro MUI_UNSET MUI_FINISHPAGE_SHOWREADME_FUNCTION + !insertmacro MUI_UNSET MUI_FINISHPAGE_LINK + !insertmacro MUI_UNSET MUI_FINISHPAGE_LINK_LOCATION + !insertmacro MUI_UNSET MUI_FINISHPAGE_LINK_COLOR + !insertmacro MUI_UNSET MUI_FINISHPAGE_NOREBOOTSUPPORT + + !insertmacro MUI_UNSET MUI_FINISHPAGE_ABORTWARNINGCHECK + !insertmacro MUI_UNSET MUI_FINISHPAGE_CURFIELD_TOP + !insertmacro MUI_UNSET MUI_FINISHPAGE_CURFIELD_BOTTOM + +!macroend + +!macro MUI_PAGE_FINISH + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_PAGE_INIT + !insertmacro MUI_PAGEDECLARATION_FINISH + + !verbose pop + +!macroend + +!macro MUI_UNPAGE_FINISH + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_UNPAGE_INIT + !insertmacro MUI_PAGEDECLARATION_FINISH + + !verbose pop + +!macroend + + +;-------------------------------- +;Page functions + +!macro MUI_FUNCTION_FINISHPAGE PRE LEAVE LINK + + !ifdef MUI_FINISHPAGE_LINK + + Function "${LINK}" + + ExecShell open "${MUI_FINISHPAGE_LINK_LOCATION}" + + FunctionEnd + + !endif + + Function "${PRE}" + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE + + ;Set text on Next button + SendMessage $mui.Button.Next ${WM_SETTEXT} 0 "STR:${MUI_FINISHPAGE_BUTTON}" + + ;Enable cancel button if set in script + !ifdef MUI_FINISHPAGE_CANCEL_ENABLED + EnableWindow $mui.Button.Cancel 1 + !endif + + ;Create dialog + nsDialogs::Create 1044 + Pop $mui.FinishPage + nsDialogs::SetRTL $(^RTL) + SetCtlColors $mui.FinishPage "" "${MUI_BGCOLOR}" + + ;Image control + ${NSD_CreateBitmap} 0u 0u 109u 193u "" + Pop $mui.FinishPage.Image + !insertmacro MUI_INTERNAL_FULLWINDOW_LOADWIZARDIMAGE "${MUI_PAGE_UNINSTALLER_PREFIX}" $mui.FinishPage.Image $PLUGINSDIR\modern-wizard.bmp $mui.FinishPage.Image.Bitmap + + ;Positiong of controls + + ;Title + !ifndef MUI_FINISHPAGE_TITLE_3LINES + !define MUI_FINISHPAGE_TITLE_HEIGHT 28 + !else + !define MUI_FINISHPAGE_TITLE_HEIGHT 38 + !endif + + ;Text + ;17 = 10 (top margin) + 7 (distance between texts) + !define /math MUI_FINISHPAGE_TEXT_TOP 17 + ${MUI_FINISHPAGE_TITLE_HEIGHT} + + ;Height if space required for radio buttons or check boxes + !ifndef MUI_FINISHPAGE_TEXT_LARGE + !define MUI_FINISHPAGE_TEXT_HEIGHT_BUTTONS 40 + !else + !define MUI_FINISHPAGE_TEXT_HEIGHT_BUTTONS 60 + !endif + + !define /math MUI_FINISHPAGE_TEXT_BOTTOM_BUTTONS ${MUI_FINISHPAGE_TEXT_TOP} + ${MUI_FINISHPAGE_TEXT_HEIGHT_BUTTONS} + + ;Positioning of radio buttons to ask for a reboot + !ifndef MUI_FINISHPAGE_NOREBOOTSUPPORT + !define /math MUI_FINISHPAGE_REBOOTNOW_TOP ${MUI_FINISHPAGE_TEXT_BOTTOM_BUTTONS} + 5 ;Distance between text and options + ;25 = 10 (height of first radio button) + 15 (distance between buttons) + !define /math MUI_FINISHPAGE_REBOOTLATER_TOP ${MUI_FINISHPAGE_REBOOTNOW_TOP} + 25 + !endif + + ;Positioning of checkboxes + !ifdef MUI_FINISHPAGE_RUN + !define /math MUI_FINISHPAGE_RUN_TOP ${MUI_FINISHPAGE_TEXT_BOTTOM_BUTTONS} + 5 ;Distance between text and options + !endif + !ifdef MUI_FINISHPAGE_SHOWREADME + !ifdef MUI_FINISHPAGE_RUN + ;25 = 10 (height of run checkbox) + 10 (distance between checkboxes) + !define /math MUI_FINISHPAGE_SHOWREADME_TOP ${MUI_FINISHPAGE_RUN_TOP} + 20 + !else + !define /math MUI_FINISHPAGE_SHOWREADME_TOP ${MUI_FINISHPAGE_TEXT_BOTTOM_BUTTONS} + 5 ;Distance between text and options + !endif + !endif + + !ifndef MUI_FINISHPAGE_RUN & MUI_FINISHPAGE_SHOWREADME + ;Height if full space is available for text and link + !ifndef MUI_FINISHPAGE_LINK + !define MUI_FINISHPAGE_TEXT_HEIGHT 130 + !else + !define MUI_FINISHPAGE_TEXT_HEIGHT 120 + !endif + !endif + + !ifndef MUI_FINISHPAGE_NOREBOOTSUPPORT + + ${if} ${RebootFlag} + + ;Title text + ${NSD_CreateLabel} 120u 10u 195u ${MUI_FINISHPAGE_TITLE_HEIGHT}u "${MUI_FINISHPAGE_TITLE}" + Pop $mui.FinishPage.Title + SetCtlColors $mui.FinishPage.Title "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}" + CreateFont $mui.FinishPage.Title.Font "$(^Font)" "12" "700" + SendMessage $mui.FinishPage.Title ${WM_SETFONT} $mui.FinishPage.Title.Font 0 + + ;Finish text + ${NSD_CreateLabel} 120u ${MUI_FINISHPAGE_TEXT_TOP}u 195u ${MUI_FINISHPAGE_TEXT_HEIGHT_BUTTONS}u "${MUI_FINISHPAGE_TEXT_REBOOT}" + Pop $mui.FinishPage.Text + SetCtlColors $mui.FinishPage.Text "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}" + + ;Radio buttons for reboot page + ${NSD_CreateRadioButton} 120u ${MUI_FINISHPAGE_REBOOTNOW_TOP}u 195u 10u "${MUI_FINISHPAGE_TEXT_REBOOTNOW}" + Pop $mui.FinishPage.RebootNow + SetCtlColors $mui.FinishPage.RebootNow "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}" + ${NSD_CreateRadioButton} 120u ${MUI_FINISHPAGE_REBOOTLATER_TOP}u 195u 10u "${MUI_FINISHPAGE_TEXT_REBOOTLATER}" + Pop $mui.FinishPage.RebootLater + SetCtlColors $mui.FinishPage.RebootLater "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}" + !ifndef MUI_FINISHPAGE_REBOOTLATER_DEFAULT + SendMessage $mui.FinishPage.RebootNow ${BM_SETCHECK} ${BST_CHECKED} 0 + !else + SendMessage $mui.FinishPage.RebootLater ${BM_SETCHECK} ${BST_CHECKED} 0 + !endif + ${NSD_SetFocus} $mui.FinishPage.RebootNow + + ${else} + + !endif + + ;Title text + ${NSD_CreateLabel} 120u 10u 195u ${MUI_FINISHPAGE_TITLE_HEIGHT}u "${MUI_FINISHPAGE_TITLE}" + Pop $mui.FinishPage.Title + SetCtlColors $mui.FinishPage.Title "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}" + CreateFont $mui.FinishPage.Title.Font "$(^Font)" "12" "700" + SendMessage $mui.FinishPage.Title ${WM_SETFONT} $mui.FinishPage.Title.Font 0 + + ;Finish text + !ifndef MUI_FINISHPAGE_RUN & MUI_FINISHPAGE_SHOWREADME + ${NSD_CreateLabel} 120u ${MUI_FINISHPAGE_TEXT_TOP}u 195u ${MUI_FINISHPAGE_TEXT_HEIGHT}u "${MUI_FINISHPAGE_TEXT}" + !else + ${NSD_CreateLabel} 120u ${MUI_FINISHPAGE_TEXT_TOP}u 195u ${MUI_FINISHPAGE_TEXT_HEIGHT_BUTTONS}u "${MUI_FINISHPAGE_TEXT}" + !endif + Pop $mui.FinishPage.Text + SetCtlColors $mui.FinishPage.Text "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}" + + ;Checkboxes + !ifdef MUI_FINISHPAGE_RUN + ${NSD_CreateCheckbox} 120u ${MUI_FINISHPAGE_RUN_TOP}u 195u 10u "${MUI_FINISHPAGE_RUN_TEXT}" + Pop $mui.FinishPage.Run + SetCtlColors $mui.FinishPage.Run "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}" + !ifndef MUI_FINISHPAGE_RUN_NOTCHECKED + SendMessage $mui.FinishPage.Run ${BM_SETCHECK} ${BST_CHECKED} 0 + !endif + ${NSD_SetFocus} $mui.FinishPage.Run + !endif + !ifdef MUI_FINISHPAGE_SHOWREADME + ${NSD_CreateCheckbox} 120u ${MUI_FINISHPAGE_SHOWREADME_TOP}u 195u 10u "${MUI_FINISHPAGE_SHOWREADME_TEXT}" + Pop $mui.FinishPage.ShowReadme + SetCtlColors $mui.FinishPage.ShowReadme "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}" + !ifndef MUI_FINISHPAGE_SHOWREADME_NOTCHECKED + SendMessage $mui.FinishPage.ShowReadme ${BM_SETCHECK} ${BST_CHECKED} 0 + !endif + !ifndef MUI_FINISHPAGE_RUN + ${NSD_SetFocus} $mui.FinishPage.ShowReadme + !endif + !endif + + ;Link + !ifdef MUI_FINISHPAGE_LINK + ${NSD_CreateLink} 120u 175u 195u 10u "${MUI_FINISHPAGE_LINK}" + Pop $mui.FinishPage.Link + SetCtlColors $mui.FinishPage.Link "${MUI_FINISHPAGE_LINK_COLOR}" "${MUI_BGCOLOR}" + ${NSD_OnClick} $mui.FinishPage.Link "${LINK}" + !endif + + !ifndef MUI_FINISHPAGE_NOREBOOTSUPPORT + ${endif} + !endif + + !ifdef MUI_FINISHPAGE_CANCEL_ENABLED + StrCpy $mui.FinishPage.DisableAbortWarning "1" + !endif + + !ifndef MUI_FORCECLASSICCONTROLS + ${If} ${IsHighContrastModeActive} + !endif + ; SetCtlColors does not change the check/radio text color (bug #443) + !ifndef MUI_FINISHPAGE_NOREBOOTSUPPORT + System::Call 'UXTHEME::SetWindowTheme(p$mui.FinishPage.RebootNow,w" ",w" ")' + System::Call 'UXTHEME::SetWindowTheme(p$mui.FinishPage.RebootLater,w" ",w" ")' + !endif + !ifdef MUI_FINISHPAGE_RUN + System::Call 'UXTHEME::SetWindowTheme(p$mui.FinishPage.Run,w" ",w" ")' + !endif + !ifdef MUI_FINISHPAGE_SHOWREADME + System::Call 'UXTHEME::SetWindowTheme(p$mui.FinishPage.ShowReadme,w" ",w" ")' + !endif + !ifndef MUI_FORCECLASSICCONTROLS + ${EndIf} + !endif + + ;Show page + Call ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}muiPageLoadFullWindow + !insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW + nsDialogs::Show + !insertmacro MUI_PAGE_FUNCTION_CUSTOM DESTROYED + Call ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}muiPageUnloadFullWindow + + !ifdef MUI_FINISHPAGE_CANCEL_ENABLED + StrCpy $mui.FinishPage.DisableAbortWarning "" + !endif + + ;Delete image from memory + ${NSD_FreeImage} $mui.FinishPage.Image.Bitmap + + !insertmacro MUI_UNSET MUI_FINISHPAGE_TITLE_HEIGHT + !insertmacro MUI_UNSET MUI_FINISHPAGE_TEXT_TOP + !insertmacro MUI_UNSET MUI_FINISHPAGE_TEXT_HEIGHT + !insertmacro MUI_UNSET MUI_FINISHPAGE_TEXT_HEIGHT_BUTTONS + !insertmacro MUI_UNSET MUI_FINISHPAGE_TEXT_BOTTOM_BUTTONS + !insertmacro MUI_UNSET MUI_FINISHPAGE_REBOOTNOW_TOP + !insertmacro MUI_UNSET MUI_FINISHPAGE_REBOOTLATER_TOP + !insertmacro MUI_UNSET MUI_FINISHPAGE_RUN_TOP + !insertmacro MUI_UNSET MUI_FINISHPAGE_SHOWREADME_TOP + + FunctionEnd + + Function "${LEAVE}" + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE + + !ifndef MUI_FINISHPAGE_NOREBOOTSUPPORT + + ;Check whether the user has chosen to reboot the computer + ${if} ${RebootFlag} + SendMessage $mui.FinishPage.RebootNow ${BM_GETCHECK} 0 0 $mui.FinishPage.ReturnValue + ${if} $mui.FinishPage.ReturnValue = ${BST_CHECKED} + Reboot + ${else} + Return + ${endif} + ${endif} + + !endif + + ;Run functions depending on checkbox state + + !ifdef MUI_FINISHPAGE_RUN + + SendMessage $mui.FinishPage.Run ${BM_GETCHECK} 0 0 $mui.FinishPage.ReturnValue + + ${if} $mui.FinishPage.ReturnValue = ${BST_CHECKED} + !ifndef MUI_FINISHPAGE_RUN_FUNCTION + !ifndef MUI_FINISHPAGE_RUN_PARAMETERS + Exec "$\"${MUI_FINISHPAGE_RUN}$\"" + !else + Exec "$\"${MUI_FINISHPAGE_RUN}$\" ${MUI_FINISHPAGE_RUN_PARAMETERS}" + !endif + !else + Call "${MUI_FINISHPAGE_RUN_FUNCTION}" + !endif + ${endif} + + !endif + + !ifdef MUI_FINISHPAGE_SHOWREADME + + SendMessage $mui.FinishPage.ShowReadme ${BM_GETCHECK} 0 0 $mui.FinishPage.ReturnValue + + ${if} $mui.FinishPage.ReturnValue = ${BST_CHECKED} + !ifndef MUI_FINISHPAGE_SHOWREADME_FUNCTION + ExecShell open "${MUI_FINISHPAGE_SHOWREADME}" + !else + Call "${MUI_FINISHPAGE_SHOWREADME_FUNCTION}" + !endif + ${endif} + + !endif + + FunctionEnd + +!macroend diff --git a/installer/tools/Contrib/Modern UI 2/Pages/InstallFiles.nsh b/installer/tools/Contrib/Modern UI 2/Pages/InstallFiles.nsh new file mode 100644 index 00000000..868ae17c --- /dev/null +++ b/installer/tools/Contrib/Modern UI 2/Pages/InstallFiles.nsh @@ -0,0 +1,149 @@ +/* + +NSIS Modern User Interface +InstallFiles page + +*/ + +;-------------------------------- +;Page interface settings and variables + +!macro MUI_INSTFILESPAGE_INTERFACE + + !ifndef MUI_INSTFILESYPAGE_INTERFACE + !define MUI_INSTFILESYPAGE_INTERFACE + + !insertmacro MUI_DEFAULT MUI_INSTFILESPAGE_COLORS "/windows" + !insertmacro MUI_DEFAULT MUI_INSTFILESPAGE_PROGRESSBAR "smooth" + + Var mui.InstFilesPage + + Var mui.InstFilesPage.Text + Var mui.InstFilesPage.ProgressBar + Var mui.InstFilesPage.ShowLogButton + Var mui.InstFilesPage.Log + + ;Apply settings + InstallColors ${MUI_INSTFILESPAGE_COLORS} + InstProgressFlags ${MUI_INSTFILESPAGE_PROGRESSBAR} + SubCaption 4 " " + UninstallSubCaption 2 " " + !endif + +!macroend + + +;-------------------------------- +;Page declaration + +!macro MUI_PAGEDECLARATION_INSTFILES + + !insertmacro MUI_SET MUI_${MUI_PAGE_UNINSTALLER_PREFIX}INSTFILESPAGE "" + !insertmacro MUI_INSTFILESPAGE_INTERFACE + + PageEx ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}instfiles + + PageCallbacks ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.InstFilesPre_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.InstFilesShow_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.InstFilesLeave_${MUI_UNIQUEID} + + Caption " " + + PageExEnd + + !insertmacro MUI_FUNCTION_INSTFILESPAGE ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.InstFilesPre_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.InstFilesShow_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.InstFilesLeave_${MUI_UNIQUEID} + + !insertmacro MUI_UNSET MUI_INSTFILESPAGE_FINISHHEADER_TEXT + !insertmacro MUI_UNSET MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT + !insertmacro MUI_UNSET MUI_INSTFILESPAGE_ABORTWARNING_TEXT + !insertmacro MUI_UNSET MUI_INSTFILESPAGE_ABORTWARNING_SUBTEXT + +!macroend + +!macro MUI_PAGE_INSTFILES + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_PAGE_INIT + !insertmacro MUI_PAGEDECLARATION_INSTFILES + + !verbose pop + +!macroend + +!macro MUI_UNPAGE_INSTFILES + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_UNPAGE_INIT + !insertmacro MUI_PAGEDECLARATION_INSTFILES + + !verbose pop + +!macroend + + +;-------------------------------- +;Page functions + +!macro MUI_FUNCTION_INSTFILESPAGE PRE SHOW LEAVE + + Function "${PRE}" + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE + !insertmacro MUI_HEADER_TEXT_PAGE $(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_${MUI_PAGE_UNINSTALLER_PREFIX}INSTALLING_TITLE) $(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_${MUI_PAGE_UNINSTALLER_PREFIX}INSTALLING_SUBTITLE) + + FunctionEnd + + Function "${SHOW}" + + ;Get controls handles + FindWindow $mui.InstFilesPage "#32770" "" $HWNDPARENT + GetDlgItem $mui.InstFilesPage.Text $mui.InstFilesPage 1006 + GetDlgItem $mui.InstFilesPage.ProgressBar $mui.InstFilesPage 1004 + GetDlgItem $mui.InstFilesPage.ShowLogButton $mui.InstFilesPage 1027 + GetDlgItem $mui.InstFilesPage.Log $mui.InstFilesPage 1016 + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW + + FunctionEnd + + Function "${LEAVE}" + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE + + ;Set text on completed page header + + IfAbort mui.endheader_abort + + !ifdef MUI_INSTFILESPAGE_FINISHHEADER_TEXT & MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT + !insertmacro MUI_HEADER_TEXT "${MUI_INSTFILESPAGE_FINISHHEADER_TEXT}" "${MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT}" + !else ifdef MUI_INSTFILESPAGE_FINISHHEADER_TEXT + !insertmacro MUI_HEADER_TEXT "${MUI_INSTFILESPAGE_FINISHHEADER_TEXT}" "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_FINISH_SUBTITLE)" + !else ifdef MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT + !insertmacro MUI_HEADER_TEXT "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_FINISH_TITLE)" "${MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT}" + !else + !insertmacro MUI_HEADER_TEXT "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_FINISH_TITLE)" "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_FINISH_SUBTITLE)" + !endif + + Goto mui.endheader_done + + mui.endheader_abort: + + !ifdef MUI_INSTFILESPAGE_ABORTHEADER_TEXT & MUI_INSTFILESPAGE_ABORTHEADER_SUBTEXT + !insertmacro MUI_HEADER_TEXT "${MUI_INSTFILESPAGE_ABORTHEADER_TEXT}" "${MUI_INSTFILESPAGE_ABORTHEADER_SUBTEXT}" + !else ifdef MUI_INSTFILESPAGE_ABORTHEADER_TEXT + !insertmacro MUI_HEADER_TEXT "${MUI_INSTFILESPAGE_ABORTHEADER_TEXT}" "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_ABORT_SUBTITLE)" + !else ifdef MUI_INSTFILESPAGE_ABORTHEADER_SUBTEXT + !insertmacro MUI_HEADER_TEXT "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_ABORT_TITLE)" "${MUI_INSTFILESPAGE_ABORTHEADER_SUBTEXT}" + !else + !insertmacro MUI_HEADER_TEXT "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_ABORT_TITLE)" "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_ABORT_SUBTITLE)" + !endif + + mui.endheader_done: + + !insertmacro MUI_LANGDLL_SAVELANGUAGE + + FunctionEnd + +!macroend diff --git a/installer/tools/Contrib/Modern UI 2/Pages/License.nsh b/installer/tools/Contrib/Modern UI 2/Pages/License.nsh new file mode 100644 index 00000000..a74214a0 --- /dev/null +++ b/installer/tools/Contrib/Modern UI 2/Pages/License.nsh @@ -0,0 +1,143 @@ +/* + +NSIS Modern User Interface +License page + +*/ + +;-------------------------------- +;Page interface settings and variables + +!macro MUI_LICENSEPAGE_INTERFACE + + !ifndef MUI_LICENSEPAGE_INTERFACE + !define MUI_LICENSEPAGE_INTERFACE + Var mui.LicensePage + + Var mui.Licensepage.TopText + Var mui.Licensepage.Text + Var mui.Licensepage.LicenseText + + !insertmacro MUI_DEFAULT MUI_LICENSEPAGE_BGCOLOR "/windows" + + ;Apply settings + LicenseBkColor "${MUI_LICENSEPAGE_BGCOLOR}" + !endif + +!macroend + + +;-------------------------------- +;Page declaration + +!macro MUI_PAGEDECLARATION_LICENSE LICENSEDATA + + !insertmacro MUI_SET MUI_${MUI_PAGE_UNINSTALLER_PREFIX}LICENSEPAGE "" + !insertmacro MUI_LICENSEPAGE_INTERFACE + + !insertmacro MUI_DEFAULT MUI_LICENSEPAGE_TEXT_TOP "$(MUI_INNERTEXT_LICENSE_TOP)" + !insertmacro MUI_DEFAULT MUI_LICENSEPAGE_BUTTON "" + !insertmacro MUI_DEFAULT MUI_LICENSEPAGE_CHECKBOX_TEXT "" + !insertmacro MUI_DEFAULT MUI_LICENSEPAGE_RADIOBUTTONS_TEXT_ACCEPT "" + !insertmacro MUI_DEFAULT MUI_LICENSEPAGE_RADIOBUTTONS_TEXT_DECLINE "" + + PageEx ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}license + + PageCallbacks ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.LicensePre_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.LicenseShow_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.LicenseLeave_${MUI_UNIQUEID} + + Caption " " + + LicenseData "${LICENSEDATA}" + + !ifndef MUI_LICENSEPAGE_TEXT_BOTTOM + !ifndef MUI_LICENSEPAGE_CHECKBOX & MUI_LICENSEPAGE_RADIOBUTTONS + LicenseText "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}INNERTEXT_LICENSE_BOTTOM)" "${MUI_LICENSEPAGE_BUTTON}" + !else ifdef MUI_LICENSEPAGE_CHECKBOX + LicenseText "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}INNERTEXT_LICENSE_BOTTOM_CHECKBOX)" "${MUI_LICENSEPAGE_BUTTON}" + !else + LicenseText "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}INNERTEXT_LICENSE_BOTTOM_RADIOBUTTONS)" "${MUI_LICENSEPAGE_BUTTON}" + !endif + !else + LicenseText "${MUI_LICENSEPAGE_TEXT_BOTTOM}" "${MUI_LICENSEPAGE_BUTTON}" + !endif + + !ifdef MUI_LICENSEPAGE_CHECKBOX + LicenseForceSelection checkbox "${MUI_LICENSEPAGE_CHECKBOX_TEXT}" + !else ifdef MUI_LICENSEPAGE_RADIOBUTTONS + LicenseForceSelection radiobuttons "${MUI_LICENSEPAGE_RADIOBUTTONS_TEXT_ACCEPT}" "${MUI_LICENSEPAGE_RADIOBUTTONS_TEXT_DECLINE}" + !endif + + PageExEnd + + !insertmacro MUI_FUNCTION_LICENSEPAGE ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.LicensePre_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.LicenseShow_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.LicenseLeave_${MUI_UNIQUEID} + + !insertmacro MUI_UNSET MUI_LICENSEPAGE_TEXT_TOP + !insertmacro MUI_UNSET MUI_LICENSEPAGE_TEXT_BOTTOM + !insertmacro MUI_UNSET MUI_LICENSEPAGE_BUTTON + !insertmacro MUI_UNSET MUI_LICENSEPAGE_CHECKBOX + !insertmacro MUI_UNSET MUI_LICENSEPAGE_CHECKBOX_TEXT + !insertmacro MUI_UNSET MUI_LICENSEPAGE_RADIOBUTTONS + !insertmacro MUI_UNSET MUI_LICENSEPAGE_CHECKBOX_TEXT_ACCEPT + !insertmacro MUI_UNSET MUI_LICENSEPAGE_CHECKBOX_TEXT_DECLINE + +!macroend + +!macro MUI_PAGE_LICENSE LICENSEDATA + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_PAGE_INIT + !insertmacro MUI_PAGEDECLARATION_LICENSE "${LICENSEDATA}" + + !verbose pop + +!macroend + +!macro MUI_UNPAGE_LICENSE LICENSEDATA + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_UNPAGE_INIT + !insertmacro MUI_PAGEDECLARATION_LICENSE "${LICENSEDATA}" + + !verbose pop + +!macroend + + +;-------------------------------- +;Page functions + +!macro MUI_FUNCTION_LICENSEPAGE PRE SHOW LEAVE + + Function "${PRE}" + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE + !insertmacro MUI_HEADER_TEXT_PAGE $(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_LICENSE_TITLE) $(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_LICENSE_SUBTITLE) + + FunctionEnd + + Function "${SHOW}" + + ;Get control handles + FindWindow $mui.LicensePage "#32770" "" $HWNDPARENT + GetDlgItem $mui.LicensePage.TopText $mui.LicensePage 1040 + GetDlgItem $mui.LicensePage.Text $mui.LicensePage 1006 + GetDlgItem $mui.LicensePage.LicenseText $mui.LicensePage 1000 + + ;Top text + SendMessage $mui.LicensePage.TopText ${WM_SETTEXT} 0 "STR:${MUI_LICENSEPAGE_TEXT_TOP}" + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW + + FunctionEnd + + Function "${LEAVE}" + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE + + FunctionEnd + +!macroend diff --git a/installer/tools/Contrib/Modern UI 2/Pages/StartMenu.nsh b/installer/tools/Contrib/Modern UI 2/Pages/StartMenu.nsh new file mode 100644 index 00000000..71c41bb6 --- /dev/null +++ b/installer/tools/Contrib/Modern UI 2/Pages/StartMenu.nsh @@ -0,0 +1,236 @@ +/* + +NSIS Modern User Interface +Start Menu folder page + +*/ + +;-------------------------------- +;Page interface settings and variables + +!macro MUI_STARTMENUPAGE_INTERFACE + + !ifndef MUI_STARTMENUPAGE_INTERFACE + !define MUI_STARTMENUPAGE_INTERFACE + Var mui.StartMenuPage + Var mui.StartMenuPage.Location + Var mui.StartMenuPage.FolderList + + Var mui.StartMenuPage.Temp + !endif + + !ifdef MUI_STARTMENUPAGE_REGISTRY_ROOT & MUI_STARTMENUPAGE_REGISTRY_KEY & MUI_STARTMENUPAGE_REGISTRY_VALUENAME + !ifndef MUI_STARTMENUPAGE_REGISTRY_VARIABLES + !define MUI_STARTMENUPAGE_REGISTRY_VARIABLES + Var mui.StartMenuPage.RegistryLocation + !endif + !endif + +!macroend + + +;-------------------------------- +;Page declaration + +!macro MUI_PAGEDECLARATION_STARTMENU ID VAR + + !insertmacro MUI_SET MUI_${MUI_PAGE_UNINSTALLER_PREFIX}STARTMENUPAGE "" + !insertmacro MUI_STARTMENUPAGE_INTERFACE + + !insertmacro MUI_DEFAULT MUI_STARTMENUPAGE_DEFAULTFOLDER "$(^Name)" + !insertmacro MUI_DEFAULT MUI_STARTMENUPAGE_TEXT_TOP "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}INNERTEXT_STARTMENU_TOP)" + !insertmacro MUI_DEFAULT MUI_STARTMENUPAGE_TEXT_CHECKBOX "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}INNERTEXT_STARTMENU_CHECKBOX)" + + !define MUI_STARTMENUPAGE_VARIABLE "${VAR}" + !define "MUI_STARTMENUPAGE_${ID}_VARIABLE" "${MUI_STARTMENUPAGE_VARIABLE}" + !define "MUI_STARTMENUPAGE_${ID}_DEFAULTFOLDER" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}" + !ifdef MUI_STARTMENUPAGE_REGISTRY_ROOT + !define "MUI_STARTMENUPAGE_${ID}_REGISTRY_ROOT" "${MUI_STARTMENUPAGE_REGISTRY_ROOT}" + !endif + !ifdef MUI_STARTMENUPAGE_REGISTRY_KEY + !define "MUI_STARTMENUPAGE_${ID}_REGISTRY_KEY" "${MUI_STARTMENUPAGE_REGISTRY_KEY}" + !endif + !ifdef MUI_STARTMENUPAGE_REGISTRY_VALUENAME + !define "MUI_STARTMENUPAGE_${ID}_REGISTRY_VALUENAME" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}" + !endif + + PageEx ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}custom + + PageCallbacks ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.StartmenuPre_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.StartmenuLeave_${MUI_UNIQUEID} + + Caption " " + + PageExEnd + + !insertmacro MUI_FUNCTION_STARTMENUPAGE ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.StartmenuPre_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.StartmenuLeave_${MUI_UNIQUEID} + + !undef MUI_STARTMENUPAGE_VARIABLE + !undef MUI_STARTMENUPAGE_TEXT_TOP + !undef MUI_STARTMENUPAGE_TEXT_CHECKBOX + !undef MUI_STARTMENUPAGE_DEFAULTFOLDER + !insertmacro MUI_UNSET MUI_STARTMENUPAGE_NODISABLE + !insertmacro MUI_UNSET MUI_STARTMENUPAGE_REGISTRY_ROOT + !insertmacro MUI_UNSET MUI_STARTMENUPAGE_REGISTRY_KEY + !insertmacro MUI_UNSET MUI_STARTMENUPAGE_REGISTRY_VALUENAME + +!macroend + +!macro MUI_PAGE_STARTMENU ID VAR + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_PAGE_INIT + !insertmacro MUI_PAGEDECLARATION_STARTMENU "${ID}" "${VAR}" + + !verbose pop + +!macroend + +;-------------------------------- +;Page functions + +!macro MUI_FUNCTION_STARTMENUPAGE PRE LEAVE + + Function "${PRE}" + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE + + !ifdef MUI_STARTMENUPAGE_REGISTRY_ROOT & MUI_STARTMENUPAGE_REGISTRY_KEY & MUI_STARTMENUPAGE_REGISTRY_VALUENAME + + ;Get Start Menu location from registry + + ${if} "${MUI_STARTMENUPAGE_VARIABLE}" == "" + + ReadRegStr $mui.StartMenuPage.RegistryLocation "${MUI_STARTMENUPAGE_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}" + ${if} $mui.StartMenuPage.RegistryLocation != "" + StrCpy "${MUI_STARTMENUPAGE_VARIABLE}" $mui.StartMenuPage.RegistryLocation + ${endif} + + ClearErrors + + ${endif} + + !endif + + !insertmacro MUI_HEADER_TEXT_PAGE $(MUI_TEXT_STARTMENU_TITLE) $(MUI_TEXT_STARTMENU_SUBTITLE) + + ${if} $(^RTL) == "0" + !ifndef MUI_STARTMENUPAGE_NODISABLE + StartMenu::Init /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" /checknoshortcuts "${MUI_STARTMENUPAGE_TEXT_CHECKBOX}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}" + !else + StartMenu::Init /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}" + !endif + ${else} + !ifndef MUI_STARTMENUPAGE_NODISABLE + StartMenu::Init /rtl /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" /checknoshortcuts "${MUI_STARTMENUPAGE_TEXT_CHECKBOX}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}" + !else + StartMenu::Init /rtl /noicon /autoadd /text "${MUI_STARTMENUPAGE_TEXT_TOP}" /lastused "${MUI_STARTMENUPAGE_VARIABLE}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}" + !endif + ${endif} + + Pop $mui.StartMenuPage + + ;Get control handles + GetDlgItem $mui.StartMenuPage.Location $mui.StartMenuPage 1002 + GetDlgItem $mui.StartMenuPage.FolderList $mui.StartMenuPage 1004 + + !ifdef MUI_STARTMENUPAGE_BGCOLOR + !insertmacro MUI_DEFAULT MUI_STARTMENUPAGE_TEXTCOLOR "" + SetCtlColors $mui.StartMenuPage.Location "${MUI_STARTMENUPAGE_TEXTCOLOR}" "${MUI_STARTMENUPAGE_BGCOLOR}" + SetCtlColors $mui.StartMenuMenu.FolderList "${MUI_STARTMENUPAGE_TEXTCOLOR}" "${MUI_STARTMENUPAGE_BGCOLOR}" + !endif + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW + StartMenu::Show + !insertmacro MUI_PAGE_FUNCTION_CUSTOM DESTROYED + + Pop $mui.StartMenuPage.Temp + ${if} $mui.StartMenuPage.Temp == "success" + Pop "${MUI_STARTMENUPAGE_VARIABLE}" + ${endif} + + FunctionEnd + + Function "${LEAVE}" + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE + + FunctionEnd + +!macroend + + +;-------------------------------- +;Script macros to get Start Menu folder + +!macro MUI_STARTMENU_GETFOLDER ID VAR + + !verbose push + !verbose ${MUI_VERBOSE} + + ;Get Start Menu folder from registry + ;Can be called from the script in the uninstaller + + !ifdef MUI_STARTMENUPAGE_${ID}_REGISTRY_ROOT & MUI_STARTMENUPAGE_${ID}_REGISTRY_KEY & MUI_STARTMENUPAGE_${ID}_REGISTRY_VALUENAME + + ReadRegStr $mui.StartMenuPage.RegistryLocation "${MUI_STARTMENUPAGE_${ID}_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_${ID}_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_${ID}_REGISTRY_VALUENAME}" + + ${if} $mui.StartMenuPage.RegistryLocation != "" + StrCpy "${VAR}" $mui.StartMenuPage.RegistryLocation + ${else} + StrCpy "${VAR}" "${MUI_STARTMENUPAGE_${ID}_DEFAULTFOLDER}" + ${endif} + + !else + + StrCpy "${VAR}" "${MUI_STARTMENUPAGE_${ID}_DEFAULTFOLDER}" + + !endif + + !verbose pop + +!macroend + +!macro MUI_STARTMENU_WRITE_BEGIN ID + + ;The code in the script to write the shortcuts should be put between the + ;MUI_STARTMENU_WRITE_BEGIN and MUI_STARTMENU_WRITE_END macros + + !verbose push + !verbose ${MUI_VERBOSE} + + !define MUI_STARTMENUPAGE_CURRENT_ID "${ID}" + + StrCpy $mui.StartMenuPage.Temp "${MUI_STARTMENUPAGE_${MUI_STARTMENUPAGE_CURRENT_ID}_VARIABLE}" 1 + + ;If the folder start with >, the user has chosen not to create a shortcut + ${if} $mui.StartMenuPage.Temp != ">" + + ${if} "${MUI_STARTMENUPAGE_${MUI_STARTMENUPAGE_CURRENT_ID}_VARIABLE}" == "" + ;Get folder from registry if the variable doesn't contain anything + !insertmacro MUI_STARTMENU_GETFOLDER "${MUI_STARTMENUPAGE_CURRENT_ID}" "${MUI_STARTMENUPAGE_${MUI_STARTMENUPAGE_CURRENT_ID}_VARIABLE}" + ${endif} + + !verbose pop + +!macroend + +!macro MUI_STARTMENU_WRITE_END + + !verbose push + !verbose ${MUI_VERBOSE} + + !ifdef MUI_STARTMENUPAGE_${MUI_STARTMENUPAGE_CURRENT_ID}_REGISTRY_ROOT & MUI_STARTMENUPAGE_${MUI_STARTMENUPAGE_CURRENT_ID}_REGISTRY_KEY & MUI_STARTMENUPAGE_${MUI_STARTMENUPAGE_CURRENT_ID}_REGISTRY_VALUENAME + ;Write folder to registry + WriteRegStr "${MUI_STARTMENUPAGE_${MUI_STARTMENUPAGE_CURRENT_ID}_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_${MUI_STARTMENUPAGE_CURRENT_ID}_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_${MUI_STARTMENUPAGE_CURRENT_ID}_REGISTRY_VALUENAME}" "${MUI_STARTMENUPAGE_${MUI_STARTMENUPAGE_CURRENT_ID}_VARIABLE}" + !endif + + ${endif} + + !undef MUI_STARTMENUPAGE_CURRENT_ID + + !verbose pop + +!macroend + diff --git a/installer/tools/Contrib/Modern UI 2/Pages/UninstallConfirm.nsh b/installer/tools/Contrib/Modern UI 2/Pages/UninstallConfirm.nsh new file mode 100644 index 00000000..1ebe927d --- /dev/null +++ b/installer/tools/Contrib/Modern UI 2/Pages/UninstallConfirm.nsh @@ -0,0 +1,100 @@ +/* + +NSIS Modern User Interface +Uninstall confirmation page + +*/ + +;-------------------------------- +;Page interface settings and variables + +!macro MUI_UNCONFIRMPAGE_INTERFACE + + !ifndef MUI_UNCONFIRMPAGE_INTERFACE + !define MUI_UNCONFIRMPAGE_INTERFACE + Var mui.UnConfirmPage + + Var mui.UnConfirmPage.Text + Var mui.UnConfirmPage.DirectoryText + Var mui.UnConfirmPage.Directory + !endif + +!macroend + + +;-------------------------------- +;Page declaration + +!macro MUI_PAGEDECLARATION_CONFIRM + + !insertmacro MUI_SET MUI_UNCONFIRMPAGE "" + !insertmacro MUI_UNCONFIRMPAGE_INTERFACE + + !insertmacro MUI_DEFAULT MUI_UNCONFIRMPAGE_TEXT_TOP "" + !insertmacro MUI_DEFAULT MUI_UNCONFIRMPAGE_TEXT_LOCATION "" + + PageEx un.uninstConfirm + + PageCallbacks un.mui.ConfirmPre_${MUI_UNIQUEID} un.mui.ConfirmShow_${MUI_UNIQUEID} un.mui.ConfirmLeave_${MUI_UNIQUEID} + + Caption " " + + UninstallText "${MUI_UNCONFIRMPAGE_TEXT_TOP}" "${MUI_UNCONFIRMPAGE_TEXT_LOCATION}" + + !ifdef MUI_UNCONFIRMPAGE_VARIABLE + DirVar "${MUI_UNCONFIRMPAGE_VARIABLE}" + !endif + + PageExEnd + + !insertmacro MUI_UNFUNCTION_CONFIRMPAGE un.mui.ConfirmPre_${MUI_UNIQUEID} un.mui.ConfirmShow_${MUI_UNIQUEID} un.mui.ConfirmLeave_${MUI_UNIQUEID} + + !insertmacro MUI_UNSET MUI_UNCONFIRMPAGE_TEXT_TOP + !insertmacro MUI_UNSET MUI_UNCONFIRMPAGE_TEXT_LOCATION + +!macroend + +!macro MUI_UNPAGE_CONFIRM + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_UNPAGE_INIT + !insertmacro MUI_PAGEDECLARATION_CONFIRM + + !verbose pop + +!macroend + + +;-------------------------------- +;Page functions + +!macro MUI_UNFUNCTION_CONFIRMPAGE PRE SHOW LEAVE + + Function "${PRE}" + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE + !insertmacro MUI_HEADER_TEXT_PAGE $(MUI_UNTEXT_CONFIRM_TITLE) $(MUI_UNTEXT_CONFIRM_SUBTITLE) + + FunctionEnd + + Function "${SHOW}" + + ;Get controls handles + FindWindow $mui.UnConfirmPage "#32770" "" $HWNDPARENT + GetDlgItem $mui.UnConfirmPage.Text $mui.UnConfirmPage 1006 + GetDlgItem $mui.UnConfirmPage.DirectoryText $mui.UnConfirmPage 1029 + GetDlgItem $mui.UnConfirmPage.Directory $mui.UnConfirmPage 1000 + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW + + FunctionEnd + + Function "${LEAVE}" + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE + + FunctionEnd + +!macroend diff --git a/installer/tools/Contrib/Modern UI 2/Pages/Welcome.nsh b/installer/tools/Contrib/Modern UI 2/Pages/Welcome.nsh new file mode 100644 index 00000000..0839b949 --- /dev/null +++ b/installer/tools/Contrib/Modern UI 2/Pages/Welcome.nsh @@ -0,0 +1,181 @@ +/* + +NSIS Modern User Interface +Welcome page (implemented using nsDialogs) + +*/ + +;-------------------------------- +;Page interface settings and variables + +!macro MUI_WELCOMEPAGE_INTERFACE + + !ifndef MUI_WELCOMEPAGE_INTERFACE + !define MUI_WELCOMEPAGE_INTERFACE + Var mui.WelcomePage + + Var mui.WelcomePage.Image + Var mui.WelcomePage.Image.Bitmap + + Var mui.WelcomePage.Title + Var mui.WelcomePage.Title.Font + + Var mui.WelcomePage.Text + !endif + + !insertmacro MUI_DEFAULT MUI_${MUI_PAGE_UNINSTALLER_PREFIX}WELCOMEFINISHPAGE_BITMAP "${NSISDIR}\Contrib\Graphics\Wizard\win.bmp" + !if "${MUI_${MUI_PAGE_UNINSTALLER_PREFIX}WELCOMEFINISHPAGE_BITMAP}" == "" + !error "Invalid MUI_${MUI_PAGE_UNINSTALLER_PREFIX}WELCOMEFINISHPAGE_BITMAP" + !endif + +!macroend + + +;-------------------------------- +;Interface initialization + +!macro MUI_WELCOMEPAGE_GUIINIT + + !ifndef MUI_${MUI_PAGE_UNINSTALLER_PREFIX}WELCOMEWELCOMEPAGE_GUINIT + !define MUI_${MUI_PAGE_UNINSTALLER_PREFIX}WELCOMEWELCOMEPAGE_GUINIT + + Function ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.WelcomePage.GUIInit + + InitPluginsDir + File "/oname=$PLUGINSDIR\modern-wizard.bmp" "${MUI_${MUI_PAGE_UNINSTALLER_PREFIX}WELCOMEFINISHPAGE_BITMAP}" + !pragma verifyloadimage "${MUI_${MUI_PAGE_UNINSTALLER_PREFIX}WELCOMEFINISHPAGE_BITMAP}" + + !ifdef MUI_${MUI_PAGE_UNINSTALLER_PREFIX}PAGE_FUNCTION_GUIINIT + Call "${MUI_${MUI_PAGE_UNINSTALLER_PREFIX}PAGE_FUNCTION_GUIINIT}" + !endif + + FunctionEnd + + !insertmacro MUI_SET MUI_${MUI_PAGE_UNINSTALLER_PREFIX}PAGE_FUNCTION_GUIINIT ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.WelcomePage.GUIInit + + !endif + +!macroend + + +;-------------------------------- +;Page declaration + +!macro MUI_PAGEDECLARATION_WELCOME + + !insertmacro MUI_SET MUI_${MUI_PAGE_UNINSTALLER_PREFIX}WELCOMEPAGE "" + !insertmacro MUI_WELCOMEPAGE_INTERFACE + + !insertmacro MUI_WELCOMEPAGE_GUIINIT + + !insertmacro MUI_DEFAULT MUI_WELCOMEPAGE_TITLE "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_WELCOME_INFO_TITLE)" + !insertmacro MUI_DEFAULT MUI_WELCOMEPAGE_TEXT "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_WELCOME_INFO_TEXT)" + + !insertmacro MUI_PAGE_FUNCTION_FULLWINDOW + + PageEx ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}custom + + PageCallbacks ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.WelcomePre_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.WelcomeLeave_${MUI_UNIQUEID} + + PageExEnd + + !insertmacro MUI_FUNCTION_WELCOMEPAGE ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.WelcomePre_${MUI_UNIQUEID} ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}mui.WelcomeLeave_${MUI_UNIQUEID} + + !insertmacro MUI_UNSET MUI_WELCOMEPAGE_TITLE + !insertmacro MUI_UNSET MUI_WELCOMEPAGE_TITLE_3LINES + !insertmacro MUI_UNSET MUI_WELCOMEPAGE_TEXT + +!macroend + +!macro MUI_PAGE_WELCOME + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_PAGE_INIT + !insertmacro MUI_PAGEDECLARATION_WELCOME + + !verbose pop + +!macroend + +!macro MUI_UNPAGE_WELCOME + + !verbose push + !verbose ${MUI_VERBOSE} + + !insertmacro MUI_UNPAGE_INIT + !insertmacro MUI_PAGEDECLARATION_WELCOME + + !verbose pop + +!macroend + + +;-------------------------------- +;Page functions + +!macro MUI_FUNCTION_WELCOMEPAGE PRE LEAVE + + Function "${PRE}" + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM PRE + + ;Create dialog + nsDialogs::Create 1044 + Pop $mui.WelcomePage + nsDialogs::SetRTL $(^RTL) + SetCtlColors $mui.WelcomePage "" "${MUI_BGCOLOR}" + + ;Image control + ${NSD_CreateBitmap} 0u 0u 109u 193u "" + Pop $mui.WelcomePage.Image + !insertmacro MUI_INTERNAL_FULLWINDOW_LOADWIZARDIMAGE "${MUI_PAGE_UNINSTALLER_PREFIX}" $mui.WelcomePage.Image $PLUGINSDIR\modern-wizard.bmp $mui.WelcomePage.Image.Bitmap + + ;Positiong of controls + + ;Title + !ifndef MUI_WELCOMEPAGE_TITLE_3LINES + !define MUI_WELCOMEPAGE_TITLE_HEIGHT 28 + !else + !define MUI_WELCOMEPAGE_TITLE_HEIGHT 38 + !endif + + ;Text + ;17 = 10 (top margin) + 7 (distance between texts) + !define /math MUI_WELCOMEPAGE_TEXT_TOP 17 + ${MUI_WELCOMEPAGE_TITLE_HEIGHT} + + ;Title + ${NSD_CreateLabel} 120u 10u 195u ${MUI_WELCOMEPAGE_TITLE_HEIGHT}u "${MUI_WELCOMEPAGE_TITLE}" + Pop $mui.WelcomePage.Title + SetCtlColors $mui.WelcomePage.Title "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}" + CreateFont $mui.WelcomePage.Title.Font "$(^Font)" "12" "700" + SendMessage $mui.WelcomePage.Title ${WM_SETFONT} $mui.WelcomePage.Title.Font 0 + + ;Welcome text + ${NSD_CreateLabel} 120u ${MUI_WELCOMEPAGE_TEXT_TOP}u 195u 130u "${MUI_WELCOMEPAGE_TEXT}" + Pop $mui.WelcomePage.Text + SetCtlColors $mui.WelcomePage.Text "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}" + + ;Show page + Call ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}muiPageLoadFullWindow + !insertmacro MUI_PAGE_FUNCTION_CUSTOM SHOW + nsDialogs::Show + !insertmacro MUI_PAGE_FUNCTION_CUSTOM DESTROYED + Call ${MUI_PAGE_UNINSTALLER_FUNCPREFIX}muiPageUnloadFullWindow + + ;Delete image from memory + ${NSD_FreeImage} $mui.WelcomePage.Image.Bitmap + + !insertmacro MUI_UNSET MUI_WELCOMEPAGE_TITLE_HEIGHT + !insertmacro MUI_UNSET MUI_WELCOMEPAGE_TEXT_TOP + + FunctionEnd + + Function "${LEAVE}" + + !insertmacro MUI_PAGE_FUNCTION_CUSTOM LEAVE + + FunctionEnd + +!macroend diff --git a/installer/tools/Contrib/UIs/modern.exe b/installer/tools/Contrib/UIs/modern.exe new file mode 100644 index 00000000..45db1de6 Binary files /dev/null and b/installer/tools/Contrib/UIs/modern.exe differ diff --git a/installer/tools/Contrib/UIs/modern_headerbmp.exe b/installer/tools/Contrib/UIs/modern_headerbmp.exe new file mode 100644 index 00000000..7ccc53bf Binary files /dev/null and b/installer/tools/Contrib/UIs/modern_headerbmp.exe differ diff --git a/installer/tools/Include/LangFile.nsh b/installer/tools/Include/LangFile.nsh new file mode 100644 index 00000000..767028b0 --- /dev/null +++ b/installer/tools/Include/LangFile.nsh @@ -0,0 +1,191 @@ +/* + +LangFile.nsh + +Header file to create language files that can be +included with a single command. + +Copyright 2008-2023 Joost Verburg, Anders Kjersem + +* Either LANGFILE_INCLUDE or LANGFILE_INCLUDE_WITHDEFAULT + can be called from the script to include a language file. + + - LANGFILE_INCLUDE takes the language file name as parameter. + - LANGFILE_INCLUDE_WITHDEFAULT takes as additional second + parameter, the default language file to load missing strings from. + +* Language strings in the language file have the format: + ${LangFileString} LANGSTRING_NAME "Text" + +* There are two types of language header files: + + - NSIS multi-lang support; these must start with the LANGFILE macro and + provide strings for features like MUI and MultiUser. If you are adding + support for a new language to NSIS you should make a copy of English.nsh + and translate this .nsh along with the .nlf. + - Custom installer strings; these must start with the LANGFILE_EXT macro and + contain translated versions of + custom strings used in a particular installer. + This is useful if you want to put the translations for each language in + their own separate file. + +* Example: + + ; Setup.nsi + !include "MUI.nsh" + !insertmacro MUI_PAGE_INSTFILES + !insertmacro MUI_LANGUAGE "Danish" + !insertmacro LANGFILE_INCLUDE "DanishExtra.nsh" + !insertmacro MUI_LANGUAGE "Swedish" + !insertmacro LANGFILE_INCLUDE "SwedishExtra.nsh" + Section + MessageBox MB_OK "$(myCustomString)" + SectionEnd + + ; SwedishExtra.nsh + !insertmacro LANGFILE_EXT Swedish + ${LangFileString} myCustomString "Bork bork" + +*/ + +!ifndef LANGFILE_INCLUDED +!define LANGFILE_INCLUDED + +!macro LANGFILE_INCLUDE FILENAME + + ;Called from script: include a language file + + !ifdef LangFileString + !undef LangFileString + !endif + + !define LangFileString "!insertmacro LANGFILE_SETSTRING" + + !define LANGFILE_SETNAMES + !include "${FILENAME}" + !undef LANGFILE_SETNAMES + + ;Create language strings + !define /redef LangFileString "!insertmacro LANGFILE_LANGSTRING" + !include "${FILENAME}" + +!macroend + +!macro LANGFILE_INCLUDE_WITHDEFAULT FILENAME FILENAME_DEFAULT + + ;Called from script: include a language file + ;Obtains missing strings from a default file + + !ifdef LangFileString + !undef LangFileString + !endif + + !define LangFileString "!insertmacro LANGFILE_SETSTRING" + + !define LANGFILE_SETNAMES + !include "${FILENAME}" + !undef LANGFILE_SETNAMES + + ;Include default language for missing strings + !define LANGFILE_PRIV_INCLUDEISFALLBACK "${FILENAME_DEFAULT}" + !include "${FILENAME_DEFAULT}" + !undef LANGFILE_PRIV_INCLUDEISFALLBACK + + ;Create language strings + !define /redef LangFileString "!insertmacro LANGFILE_LANGSTRING" + !include "${FILENAME_DEFAULT}" + +!macroend + +!macro LANGFILE NLFID ENGNAME NATIVENAME NATIVEASCIINAME + + ;Start of standard NSIS language file + + ; NLFID: Must match the name of the .nlf file + ; ENGNAME: English name of language, "=" if it is the same as NLFID + ; NATIVENAME: Native name of language. (In Unicode) + ; NATIVEASCIINAME: Native name of language using only ASCII, "=" if it is the same as NATIVENAME + + ; Example: LANGFILE "Swedish" = "Svenska" = (This is the same as LANGFILE "Swedish" "Swedish" "Svenska" "Svenska") + ; For more examples, see French.nsh, Greek.nsh and PortugueseBR.nsh + + !ifdef LANGFILE_SETNAMES + + !ifdef LANGFILE_IDNAME + !undef LANGFILE_IDNAME + !endif + + !define LANGFILE_IDNAME "${NLFID}" + + ; ModernUI or the .nsi can change LANGFILE_LANGDLL_FMT if desired + !ifndef LANGFILE_LANGDLL_FMT + !ifndef NSIS_UNICODE + !define LANGFILE_LANGDLL_FMT "%ENGNAME% / %NATIVEASCIINAME%" + !endif + !define /ifndef LANGFILE_LANGDLL_FMT "%NATIVENAME%" + !endif + + !ifndef "LANGFILE_${NLFID}_NAME" + !if "${ENGNAME}" == "=" + !define /redef ENGNAME "${NLFID}" + !endif + !if "${NATIVEASCIINAME}" == "=" + !define /redef NATIVEASCIINAME "${NATIVENAME}" + !endif + + !define "LANGFILE_${NLFID}_ENGLISHNAME" "${ENGNAME}" + !ifdef NSIS_UNICODE + !define "LANGFILE_${NLFID}_NAME" "${NATIVENAME}" + !else + !define "LANGFILE_${NLFID}_NAME" "${NATIVEASCIINAME}" + !endif + + !searchreplace LANGFILE_${NLFID}_LANGDLL "${LANGFILE_LANGDLL_FMT}" %NATIVEASCIINAME% "${NATIVEASCIINAME}" + !searchreplace LANGFILE_${NLFID}_LANGDLL "${LANGFILE_${NLFID}_LANGDLL}" %NATIVENAME% "${NATIVENAME}" + !searchreplace LANGFILE_${NLFID}_LANGDLL "${LANGFILE_${NLFID}_LANGDLL}" %ENGNAME% "${ENGNAME}" + + !endif + + !endif + +!macroend + +!macro LANGFILE_EXT IDNAME + + ;Start of installer language file + + !ifdef LANGFILE_SETNAMES + + !ifdef LANGFILE_IDNAME + !undef LANGFILE_IDNAME + !endif + + !define LANGFILE_IDNAME "${IDNAME}" + + !endif + +!macroend + +!macro LANGFILE_SETSTRING NAME VALUE + + ;Set define with translated string + + !ifndef ${NAME} + !define "${NAME}" "${VALUE}" + !ifdef LANGFILE_PRIV_INCLUDEISFALLBACK + !warning 'LangString "${NAME}" for language ${LANGFILE_IDNAME} is missing, using fallback from "${LANGFILE_PRIV_INCLUDEISFALLBACK}"' + !endif + !endif + +!macroend + +!macro LANGFILE_LANGSTRING NAME DUMMY + + ;Create a language string from a define and undefine + + LangString "${NAME}" "${LANG_${LANGFILE_IDNAME}}" "${${NAME}}" + !undef "${NAME}" + +!macroend + +!endif diff --git a/installer/tools/Include/LogicLib.nsh b/installer/tools/Include/LogicLib.nsh new file mode 100644 index 00000000..c338852d --- /dev/null +++ b/installer/tools/Include/LogicLib.nsh @@ -0,0 +1,899 @@ +; NSIS LOGIC LIBRARY - LogicLib.nsh +; Version 2.6 - 08/12/2007 +; By dselkirk@hotmail.com +; and eccles@users.sf.net +; with IfNot support added by Message +; +; Questions/Comments - +; See http://forums.winamp.com/showthread.php?s=&postid=1116241 +; +; Description: +; Provides the use of various logic statements within NSIS. +; +; Usage: +; The following "statements" are available: +; If|IfNot|Unless..{ElseIf|ElseIfNot|ElseUnless}..[Else]..EndIf|EndUnless +; - Conditionally executes a block of statements, depending on the value +; of an expression. IfNot and Unless are equivalent and +; interchangeable, as are ElseIfNot and ElseUnless. +; AndIf|AndIfNot|AndUnless|OrIf|OrIfNot|OrUnless +; - Adds any number of extra conditions to If, IfNot, Unless, ElseIf, +; ElseIfNot and ElseUnless statements. +; IfThen|IfNotThen..|..| +; - Conditionally executes an inline statement, depending on the value +; of an expression. +; IfCmd..||..| +; - Conditionally executes an inline statement, depending on a true +; value of the provided NSIS function. +; Select..{Case[2|3|4|5]}..[CaseElse|Default]..EndSelect +; - Executes one of several blocks of statements, depending on the value +; of an expression. +; Switch..{Case|CaseElse|Default}..EndSwitch +; - Jumps to one of several labels, depending on the value of an +; expression. +; Do[While|Until]..{ExitDo|Continue|Break}..Loop[While|Until] +; - Repeats a block of statements until stopped, or depending on the +; value of an expression. +; While..{ExitWhile|Continue|Break}..EndWhile +; - An alias for DoWhile..Loop (for backwards-compatibility) +; For[Each]..{ExitFor|Continue|Break}..Next +; - Repeats a block of statements varying the value of a variable. +; +; The following "expressions" are available: +; Standard (built-in) string tests (which are case-insensitive): +; a == b; a != b +; Additional case-insensitive string tests (using System.dll): +; a S< b; a S>= b; a S> b; a S<= b +; Case-sensitive string tests: +; a S== b; a S!= b +; Standard (built-in) signed integer tests: +; a = b; a <> b; a < b; a >= b; a > b; a <= b; a & b +; Standard (built-in) unsigned integer tests: +; a U< b; a U>= b; a U> b; a U<= b +; 64-bit integer tests (using System.dll): +; a L= b; a L<> b; a L< b; a L>= b; a L> b; a L<= b +; ptrdiff_t integer tests +; a P= b; a P<> b; a P< b; a P>= b; a P> b; a P<= b +; size_t integer tests +; a Z= b; a Z<> b; a Z< b; a Z>= b; a Z> b; a Z<= b +; Built-in NSIS flag tests: +; ${Abort}; ${Errors}; ${RebootFlag}; ${Silent}; ${RtlLanguage}; +; ${ShellVarContextAll} +; Built-in NSIS other tests: +; ${FileExists} a +; Any conditional NSIS instruction test: +; ${Cmd} a +; Section flag tests: +; ${SectionIsSelected} a; ${SectionIsSectionGroup} a; +; ${SectionIsSectionGroupEnd} a; ${SectionIsBold} a; +; ${SectionIsReadOnly} a; ${SectionIsExpanded} a; +; ${SectionIsPartiallySelected} a +; Additional tests: +; HK RegKeyIsEmpty SubKey +; +; Examples: +; See LogicLib.nsi in the Examples folder for lots of example usage. + +!verbose push +!verbose 3 +!ifndef LOGICLIB_VERBOSITY + !define LOGICLIB_VERBOSITY 3 +!endif +!define _LOGICLIB_VERBOSITY ${LOGICLIB_VERBOSITY} +!undef LOGICLIB_VERBOSITY +!verbose ${_LOGICLIB_VERBOSITY} + +!ifndef LOGICLIB + !define LOGICLIB + !define | "'" + !define || "' '" + !define LOGICLIB_COUNTER 0 + + !include Sections.nsh + + !macro _LOGICLIB_TEMP + !ifndef _LOGICLIB_TEMP + !define _LOGICLIB_TEMP + Var /GLOBAL _LOGICLIB_TEMP ; Temporary variable to aid the more elaborate logic tests + !endif + !macroend + + !macro LogicLib_JumpToBranch _Jump _Skip + !if `${_Jump}${_Skip}` != `` + StrCmp "" "" `${_Jump}` ${_Skip} + !endif + !macroend + + !macro _IncreaseCounter + !define /redef /math LOGICLIB_COUNTER `${LOGICLIB_COUNTER}` + 1 + !macroend + + !macro _PushLogic + !insertmacro _PushScope Logic _LogicLib_Label_${LOGICLIB_COUNTER} + !insertmacro _IncreaseCounter + !macroend + + !macro _PopLogic + !insertmacro _PopScope Logic + !macroend + + !macro _PushScope Type label + !ifdef _${Type} ; If we already have a statement + !define _Cur${Type} ${_${Type}} + !undef _${Type} + !define _${Type} ${label} + !define ${_${Type}}Prev${Type} ${_Cur${Type}} ; Save the current logic + !undef _Cur${Type} + !else + !define _${Type} ${label} ; Initialise for first statement + !endif + !macroend + + !macro _PopScope Type + !ifndef _${Type} + !error "Cannot use _Pop${Type} without a preceding _Push${Type}" + !endif + !ifdef ${_${Type}}Prev${Type} ; If a previous statement was active then restore it + !define _Cur${Type} ${_${Type}} + !undef _${Type} + !define _${Type} ${${_Cur${Type}}Prev${Type}} + !undef ${_Cur${Type}}Prev${Type} + !undef _Cur${Type} + !else + !undef _${Type} + !endif + !macroend + + !macro _LogicLib_AlwaysTrue _a _b _t _f + !insertmacro LogicLib_JumpToBranch `${_t}` `${_f}` + !macroend + !macro _LogicLib_AlwaysFalse _a _b _t _f + !insertmacro LogicLib_JumpToBranch `${_f}` `${_t}` + !macroend + + ; String tests + !macro _== _a _b _t _f + StrCmp `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + + !macro _!= _a _b _t _f + !insertmacro _== `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + ; Case-sensitive string tests + !macro _S== _a _b _t _f + StrCmpS `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + + !macro _S!= _a _b _t _f + !insertmacro _S== `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + ; Extra string tests (cannot do these case-sensitively - I tried and lstrcmp still ignored the case) + !macro _StrCmpI _a _b _e _l _m + !insertmacro _LOGICLIB_TEMP + System::Call `kernel32::lstrcmpi(ts, ts) i.s` `${_a}` `${_b}` + Pop $_LOGICLIB_TEMP + IntCmp $_LOGICLIB_TEMP 0 `${_e}` `${_l}` `${_m}` + !macroend + + !macro _S< _a _b _t _f + !insertmacro _StrCmpI `${_a}` `${_b}` `${_f}` `${_t}` `${_f}` + !macroend + + !macro _S>= _a _b _t _f + !insertmacro _S< `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + !macro _S> _a _b _t _f + !insertmacro _StrCmpI `${_a}` `${_b}` `${_f}` `${_f}` `${_t}` + !macroend + + !macro _S<= _a _b _t _f + !insertmacro _S> `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + ; Integer tests + !macro _= _a _b _t _f + IntCmp `${_a}` `${_b}` `${_t}` `${_f}` `${_f}` + !macroend + + !macro _<> _a _b _t _f + !insertmacro _= `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + !macro _< _a _b _t _f + IntCmp `${_a}` `${_b}` `${_f}` `${_t}` `${_f}` + !macroend + + !macro _>= _a _b _t _f + !insertmacro _< `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + !macro _> _a _b _t _f + IntCmp `${_a}` `${_b}` `${_f}` `${_f}` `${_t}` + !macroend + + !macro _<= _a _b _t _f + !insertmacro _> `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + !macro _& _a _b _t _f + !insertmacro _LOGICLIB_TEMP + IntOp $_LOGICLIB_TEMP `${_a}` & `${_b}` + !insertmacro _<> $_LOGICLIB_TEMP 0 `${_t}` `${_f}` + !macroend + + ; Unsigned integer tests (NB: no need for extra equality tests) + !macro _U< _a _b _t _f + IntCmpU `${_a}` `${_b}` `${_f}` `${_t}` `${_f}` + !macroend + + !macro _U>= _a _b _t _f + !insertmacro _U< `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + !macro _U> _a _b _t _f + IntCmpU `${_a}` `${_b}` `${_f}` `${_f}` `${_t}` + !macroend + + !macro _U<= _a _b _t _f + !insertmacro _U> `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + ; Int64 tests + !macro _Int64Cmp _a _o _b _t _f + !insertmacro _LOGICLIB_TEMP + System::Int64Op `${_a}` `${_o}` `${_b}` + Pop $_LOGICLIB_TEMP + !insertmacro _= $_LOGICLIB_TEMP 0 `${_f}` `${_t}` + !macroend + + !macro _L= _a _b _t _f + !insertmacro _Int64Cmp `${_a}` = `${_b}` `${_t}` `${_f}` + !macroend + + !macro _L<> _a _b _t _f + !insertmacro _L= `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + !macro _L< _a _b _t _f + !insertmacro _Int64Cmp `${_a}` < `${_b}` `${_t}` `${_f}` + !macroend + + !macro _L>= _a _b _t _f + !insertmacro _L< `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + !macro _L> _a _b _t _f + !insertmacro _Int64Cmp `${_a}` > `${_b}` `${_t}` `${_f}` + !macroend + + !macro _L<= _a _b _t _f + !insertmacro _L> `${_a}` `${_b}` `${_f}` `${_t}` + !macroend + + ; ptrdiff_t & size_t tests + !macro LogicLib_PtrDiffTest _o _a _b _t _f + !if "${NSIS_PTR_SIZE}" <= 4 + !insertmacro _${_o} `${_a}` `${_b}` `${_t}` `${_f}` + !else + !insertmacro _L${_o} `${_a}` `${_b}` `${_t}` `${_f}` + !endif + !macroend + !macro _P= _a _b _t _f + !insertmacro LogicLib_PtrDiffTest = `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + !macro _P<> _a _b _t _f + !insertmacro LogicLib_PtrDiffTest <> `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + !macro _P< _a _b _t _f + !insertmacro LogicLib_PtrDiffTest < `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + !macro _P>= _a _b _t _f + !insertmacro LogicLib_PtrDiffTest >= `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + !macro _P> _a _b _t _f + !insertmacro LogicLib_PtrDiffTest > `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + !macro _P<= _a _b _t _f + !insertmacro LogicLib_PtrDiffTest <= `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + !include Util.nsh + !macro _Z= _a _b _t _f + !insertmacro LogicLib_PtrDiffTest = `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + !macro _Z<> _a _b _t _f + !insertmacro LogicLib_PtrDiffTest <> `${_a}` `${_b}` `${_t}` `${_f}` + !macroend + !macro _Z< _a _b _t _f + !insertmacro IntPtrCmpU `${_a}` `${_b}` `${_f}` `${_t}` `${_f}` + !macroend + !macro _Z>= _a _b _t _f + !insertmacro IntPtrCmpU `${_a}` `${_b}` `${_t}` `${_f}` `${_t}` + !macroend + !macro _Z> _a _b _t _f + !insertmacro IntPtrCmpU `${_a}` `${_b}` `${_f}` `${_f}` `${_t}` + !macroend + !macro _Z<= _a _b _t _f + !insertmacro IntPtrCmpU `${_a}` `${_b}` `${_t}` `${_t}` `${_f}` + !macroend + + ; Flag tests + !macro _Abort _a _b _t _f + IfAbort `${_t}` `${_f}` + !macroend + !define Abort `"" Abort ""` + + !macro _Errors _a _b _t _f + IfErrors `${_t}` `${_f}` + !macroend + !define Errors `"" Errors ""` + + !macro _FileExists _a _b _t _f + IfFileExists `${_b}` `${_t}` `${_f}` + !macroend + !define FileExists `"" FileExists` + + !macro _RebootFlag _a _b _t _f + IfRebootFlag `${_t}` `${_f}` + !macroend + !define RebootFlag `"" RebootFlag ""` + + !macro _Silent _a _b _t _f + IfSilent `${_t}` `${_f}` + !macroend + !define Silent `"" Silent ""` + + !macro _ShellVarContextAll _a _b _t _f + IfShellVarContextAll `${_t}` `${_f}` + !macroend + !define ShellVarContextAll `"" ShellVarContextAll ""` + + !macro _RtlLanguage _a _b _t _f + IfRtlLanguage `${_t}` `${_f}` + !macroend + !define RtlLanguage `"" RtlLanguage ""` + + !macro _AltRegView _a _b _t _f + IfAltRegView `${_t}` `${_f}` + !macroend + !define AltRegView `"" AltRegView ""` + + !macro _RegKeyIsEmpty _a _b _t _f + !insertmacro _LOGICLIB_TEMP + ClearErrors + EnumRegValue $_LOGICLIB_TEMP ${_a} `${_b}` "" + !if `${_f}` != `` + IfErrors "" `${_f}` ; Skip calls to EnumRegKey and _== if possible + !else + IfErrors +3 + StrCpy $_LOGICLIB_TEMP "1" ; The default value is also named "", make sure we don't mistake it as empty + Goto +2 + !endif + EnumRegKey $_LOGICLIB_TEMP ${_a} `${_b}` "" + !insertmacro _== $_LOGICLIB_TEMP "" `${_t}` `${_f}` + !macroend + !define RegKeyIsEmpty `RegKeyIsEmpty` + + ; "Any instruction" test + !macro _Cmd _a _b _t _f + !define _t=${_t} + !ifdef _t= ; If no true label then make one + !define __t _LogicLib_Label_${LOGICLIB_COUNTER} + !insertmacro _IncreaseCounter + !else + !define __t ${_t} + !endif + ${_b} ${__t} + !define _f=${_f} + !ifndef _f= ; If a false label then go there + Goto ${_f} + !endif + !undef _f=${_f} + !ifdef _t= ; If we made our own true label then place it + ${__t}: + !endif + !undef __t + !undef _t=${_t} + !macroend + !define Cmd `"" Cmd` + + ; Section flag test + !macro _SectionFlagIsSet _a _b _t _f + !insertmacro _LOGICLIB_TEMP + SectionGetFlags `${_b}` $_LOGICLIB_TEMP + IntOp $_LOGICLIB_TEMP $_LOGICLIB_TEMP & `${_a}` + !insertmacro _= $_LOGICLIB_TEMP `${_a}` `${_t}` `${_f}` + !macroend + !define SectionIsSelected `${SF_SELECTED} SectionFlagIsSet` + !define SectionIsSubSection `${SF_SUBSEC} SectionFlagIsSet` + !define SectionIsSubSectionEnd `${SF_SUBSECEND} SectionFlagIsSet` + !define SectionIsSectionGroup `${SF_SECGRP} SectionFlagIsSet` + !define SectionIsSectionGroupEnd `${SF_SECGRPEND} SectionFlagIsSet` + !define SectionIsBold `${SF_BOLD} SectionFlagIsSet` + !define SectionIsReadOnly `${SF_RO} SectionFlagIsSet` + !define SectionIsExpanded `${SF_EXPAND} SectionFlagIsSet` + !define SectionIsPartiallySelected `${SF_PSELECTED} SectionFlagIsSet` + + !define IfCmd `!insertmacro _IfThen "" Cmd ${|}` + + !macro _If _c _a _o _b + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !insertmacro _PushLogic + !define ${_Logic}If + !define ${_Logic}Else _LogicLib_ElseLabel_${LOGICLIB_COUNTER} ; Get a label for the Else + !insertmacro _IncreaseCounter + !define _c=${_c} + !ifdef _c=true ; If is true + !insertmacro _${_o} `${_a}` `${_b}` "" ${${_Logic}Else} + !else ; If condition is false + !insertmacro _${_o} `${_a}` `${_b}` ${${_Logic}Else} "" + !endif + !undef _c=${_c} + !verbose pop + !macroend + !define If `!insertmacro _If true` + !define Unless `!insertmacro _If false` + !define IfNot `!insertmacro _If false` + + !macro _And _c _a _o _b + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}If + !error "Cannot use And without a preceding If or IfNot/Unless" + !endif + !ifndef ${_Logic}Else + !error "Cannot use And following an Else" + !endif + !define _c=${_c} + !ifdef _c=true ; If is true + !insertmacro _${_o} `${_a}` `${_b}` "" ${${_Logic}Else} + !else ; If condition is false + !insertmacro _${_o} `${_a}` `${_b}` ${${_Logic}Else} "" + !endif + !undef _c=${_c} + !verbose pop + !macroend + !define AndIf `!insertmacro _And true` + !define AndUnless `!insertmacro _And false` + !define AndIfNot `!insertmacro _And false` + + !macro _Or _c _a _o _b + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}If + !error "Cannot use Or without a preceding If or IfNot/Unless" + !endif + !ifndef ${_Logic}Else + !error "Cannot use Or following an Else" + !endif + !define _label _LogicLib_Label_${LOGICLIB_COUNTER} ; Skip this test as we already + !insertmacro _IncreaseCounter + Goto ${_label} ; have a successful result + ${${_Logic}Else}: ; Place the Else label + !undef ${_Logic}Else ; and remove it + !define ${_Logic}Else _LogicLib_ElseLabel_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new If + !insertmacro _IncreaseCounter + !define _c=${_c} + !ifdef _c=true ; If is true + !insertmacro _${_o} `${_a}` `${_b}` "" ${${_Logic}Else} + !else ; If condition is false + !insertmacro _${_o} `${_a}` `${_b}` ${${_Logic}Else} "" + !endif + !undef _c=${_c} + ${_label}: + !undef _label + !verbose pop + !macroend + !define OrIf `!insertmacro _Or true` + !define OrUnless `!insertmacro _Or false` + !define OrIfNot `!insertmacro _Or false` + + !macro _Else + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}If + !error "Cannot use Else without a preceding If or IfNot/Unless" + !endif + !ifndef ${_Logic}Else + !error "Cannot use Else following an Else" + !endif + !ifndef ${_Logic}EndIf ; First Else for this If? + !define ${_Logic}EndIf _LogicLib_EndIfLabel_${LOGICLIB_COUNTER} ; Get a label for the EndIf + !insertmacro _IncreaseCounter + !endif + Goto ${${_Logic}EndIf} ; Go to the EndIf + ${${_Logic}Else}: ; Place the Else label + !undef ${_Logic}Else ; and remove it + !verbose pop + !macroend + !define Else `!insertmacro _Else` + + !macro _ElseIf _c _a _o _b + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${Else} ; Perform the Else + !define ${_Logic}Else _LogicLib_ElseLabel_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new If + !insertmacro _IncreaseCounter + !define _c=${_c} + !ifdef _c=true ; If is true + !insertmacro _${_o} `${_a}` `${_b}` "" ${${_Logic}Else} + !else ; If condition is false + !insertmacro _${_o} `${_a}` `${_b}` ${${_Logic}Else} "" + !endif + !undef _c=${_c} + !verbose pop + !macroend + !define ElseIf `!insertmacro _ElseIf true` + !define ElseUnless `!insertmacro _ElseIf false` + !define ElseIfNot `!insertmacro _ElseIf false` + + !macro _EndIf _n + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}If + !error "Cannot use End${_n} without a preceding If or IfNot/Unless" + !endif + !ifdef ${_Logic}Else + ${${_Logic}Else}: ; Place the Else label + !undef ${_Logic}Else ; and remove it + !endif + !ifdef ${_Logic}EndIf + ${${_Logic}EndIf}: ; Place the EndIf + !undef ${_Logic}EndIf ; and remove it + !endif + !undef ${_Logic}If + !insertmacro _PopLogic + !verbose pop + !macroend + !define EndIf `!insertmacro _EndIf If` + !define EndUnless `!insertmacro _EndIf Unless` + + !macro _IfThen _a _o _b _t + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${If} `${_a}` `${_o}` `${_b}` + ${_t} + ${EndIf} + !verbose pop + !macroend + !define IfThen `!insertmacro _IfThen` + + !macro _IfNotThen _a _o _b _t + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${IfNot} `${_a}` `${_o}` `${_b}` + ${_t} + ${EndIf} + !verbose pop + !macroend + !define IfNotThen `!insertmacro _IfNotThen` + + !macro _ForEach _v _f _t _o _s + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + StrCpy "${_v}" "${_f}" ; Assign the initial value + Goto +2 ; Skip the loop expression for the first iteration + !define _DoLoopExpression `IntOp "${_v}" "${_v}" "${_o}" "${_s}"` ; Define the loop expression + !define _o=${_o} + !ifdef _o=+ ; Check the loop expression operator + !define __o > ; to determine the correct loop condition + !else ifdef _o=- + !define __o < + !else + !error "Unsupported ForEach step operator (must be + or -)" + !endif + !undef _o=${_o} + !insertmacro _Do For false `${_v}` `${__o}` `${_t}` ; Let Do do the rest + !undef __o + !verbose pop + !macroend + !define ForEach `!insertmacro _ForEach` + + !macro _For _v _f _t + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${ForEach} `${_v}` `${_f}` `${_t}` + 1 ; Pass on to ForEach + !verbose pop + !macroend + !define For `!insertmacro _For` + + !define ExitFor `!insertmacro _Goto ExitFor For` + + !define Next `!insertmacro _Loop For Next "" "" "" ""` + + !define While `!insertmacro _Do While true` + + !define ExitWhile `!insertmacro _Goto ExitWhile While` + + !define EndWhile `!insertmacro _Loop While EndWhile "" "" "" ""` + + !macro _Do _n _c _a _o _b + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !insertmacro _PushLogic + !define ${_Logic}${_n} _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the start of the loop + !insertmacro _IncreaseCounter + ${${_Logic}${_n}}: + !insertmacro _PushScope Exit${_n} _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the end of the loop + !insertmacro _IncreaseCounter + !insertmacro _PushScope Break ${_Exit${_n}} ; Break goes to the end of the loop + !ifdef _DoLoopExpression + ${_DoLoopExpression} ; Special extra parameter for inserting code + !undef _DoLoopExpression ; between the Continue label and the loop condition + !endif + !define _c=${_c} + !ifdef _c= ; No starting condition + !insertmacro _PushScope Continue _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for Continue at the end of the loop + !insertmacro _IncreaseCounter + !else + !insertmacro _PushScope Continue ${${_Logic}${_n}} ; Continue goes to the start of the loop + !ifdef _c=true ; If is true + !insertmacro _${_o} `${_a}` `${_b}` "" ${_Exit${_n}} + !else ; If condition is false + !insertmacro _${_o} `${_a}` `${_b}` ${_Exit${_n}} "" + !endif + !endif + !undef _c=${_c} + !define ${_Logic}Condition ${_c} ; Remember the condition used + !verbose pop + !macroend + !define Do `!insertmacro _Do Do "" "" "" ""` + !define DoWhile `!insertmacro _Do Do true` + !define DoUntil `!insertmacro _Do Do false` + + !macro _Goto _n _s + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _${_n} + !error "Cannot use ${_n} without a preceding ${_s}" + !endif + Goto ${_${_n}} + !verbose pop + !macroend + !define ExitDo `!insertmacro _Goto ExitDo Do` + + !macro _Loop _n _e _c _a _o _b + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}${_n} + !error "Cannot use ${_e} without a preceding ${_n}" + !endif + !define _c=${${_Logic}Condition} + !ifdef _c= ; If Do had no condition place the Continue label + ${_Continue}: + !endif + !undef _c=${${_Logic}Condition} + !define _c=${_c} + !ifdef _c= ; No ending condition + Goto ${${_Logic}${_n}} + !else ifdef _c=true ; If condition is true + !insertmacro _${_o} `${_a}` `${_b}` ${${_Logic}${_n}} ${_Exit${_n}} + !else ; If condition is false + !insertmacro _${_o} `${_a}` `${_b}` ${_Exit${_n}} ${${_Logic}${_n}} + !endif + !undef _c=${_c} + Goto ${_Continue} ; Just to ensure it is referenced at least once + Goto ${_Exit${_n}} ; Just to ensure it is referenced at least once + ${_Exit${_n}}: ; Place the loop exit point + !undef ${_Logic}Condition + !insertmacro _PopScope Continue + !insertmacro _PopScope Break + !insertmacro _PopScope Exit${_n} + !undef ${_Logic}${_n} + !insertmacro _PopLogic + !verbose pop + !macroend + !define Loop `!insertmacro _Loop Do Loop "" "" "" ""` + !define LoopWhile `!insertmacro _Loop Do LoopWhile true` + !define LoopUntil `!insertmacro _Loop Do LoopUntil false` + + !define Continue `!insertmacro _Goto Continue "For or Do or While"` + !define Break `!insertmacro _Goto Break "For or Do or While"` + + !macro _Select _a + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !insertmacro _PushLogic + !define ${_Logic}Select `${_a}` ; Remember the left hand side of the comparison + !verbose pop + !macroend + !define Select `!insertmacro _Select` + + !macro _Select_CaseElse + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}Select + !error "Cannot use Case without a preceding Select" + !endif + !ifdef ${_Logic}EndSelect ; This is set only after the first case + !ifndef ${_Logic}Else + !error "Cannot use Case following a CaseElse" + !endif + Goto ${${_Logic}EndSelect} ; Go to EndSelect (Ends the previous Case) + !define /IfNDef _LogicLib_EndSelectLabelUsed_${_Logic} + ${${_Logic}Else}: ; Place the Else label + !undef ${_Logic}Else ; and remove it + !else + !define ${_Logic}EndSelect _LogicLib_EndSelectLabel_${LOGICLIB_COUNTER} ; Get a label for the EndSelect + !insertmacro _IncreaseCounter + !endif + !verbose pop + !macroend + !define CaseElse `!insertmacro _CaseElse` + !define Case_Else `!insertmacro _CaseElse` ; Compatibility with 2.2 and earlier + !define Default `!insertmacro _CaseElse` ; For the C-minded + + !macro _Select_Case _a + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${CaseElse} ; Perform the CaseElse + !define ${_Logic}Else _LogicLib_NextSelectCaseLabel_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case + !insertmacro _IncreaseCounter + !insertmacro _== `${${_Logic}Select}` `${_a}` "" ${${_Logic}Else} + !verbose pop + !macroend + !define Case `!insertmacro _Case` + + !macro _Case2 _a _b + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${CaseElse} ; Perform the CaseElse + !define ${_Logic}Else _LogicLib_NextSelectCaseLabel_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case + !insertmacro _IncreaseCounter + !insertmacro _== `${${_Logic}Select}` `${_a}` +2 "" + !insertmacro _== `${${_Logic}Select}` `${_b}` "" ${${_Logic}Else} + !verbose pop + !macroend + !define Case2 `!insertmacro _Case2` + + !macro _Case3 _a _b _c + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${CaseElse} ; Perform the CaseElse + !define ${_Logic}Else _LogicLib_NextSelectCaseLabel_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case + !insertmacro _IncreaseCounter + !insertmacro _== `${${_Logic}Select}` `${_a}` +3 "" + !insertmacro _== `${${_Logic}Select}` `${_b}` +2 "" + !insertmacro _== `${${_Logic}Select}` `${_c}` "" ${${_Logic}Else} + !verbose pop + !macroend + !define Case3 `!insertmacro _Case3` + + !macro _Case4 _a _b _c _d + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${CaseElse} ; Perform the CaseElse + !define ${_Logic}Else _LogicLib_NextSelectCaseLabel_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case + !insertmacro _IncreaseCounter + !insertmacro _== `${${_Logic}Select}` `${_a}` +4 "" + !insertmacro _== `${${_Logic}Select}` `${_b}` +3 "" + !insertmacro _== `${${_Logic}Select}` `${_c}` +2 "" + !insertmacro _== `${${_Logic}Select}` `${_d}` "" ${${_Logic}Else} + !verbose pop + !macroend + !define Case4 `!insertmacro _Case4` + + !macro _Case5 _a _b _c _d _e + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + ${CaseElse} ; Perform the CaseElse + !define ${_Logic}Else _LogicLib_NextSelectCaseLabel_${LOGICLIB_COUNTER} ; Get a label for the next Else and perform the new Case + !insertmacro _IncreaseCounter + !insertmacro _== `${${_Logic}Select}` `${_a}` +5 "" + !insertmacro _== `${${_Logic}Select}` `${_b}` +4 "" + !insertmacro _== `${${_Logic}Select}` `${_c}` +3 "" + !insertmacro _== `${${_Logic}Select}` `${_d}` +2 "" + !insertmacro _== `${${_Logic}Select}` `${_e}` "" ${${_Logic}Else} + !verbose pop + !macroend + !define Case5 `!insertmacro _Case5` + + !macro _EndSelect + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}Select + !error "Cannot use EndSelect without a preceding Select" + !endif + !ifdef ${_Logic}Else + ${${_Logic}Else}: ; Place the Else label + !undef ${_Logic}Else ; and remove it + !endif + !ifdef ${_Logic}EndSelect ; This won't be set if there weren't any cases + !ifdef _LogicLib_EndSelectLabelUsed_${_Logic} ; There is no jump to ${${_Logic}EndSelect}: if there is only one Case + ${${_Logic}EndSelect}: ; Place the EndSelect + !undef _LogicLib_EndSelectLabelUsed_${_Logic} + !endif + !undef ${_Logic}EndSelect ; and remove it + !endif + !undef ${_Logic}Select + !insertmacro _PopLogic + !verbose pop + !macroend + !define EndSelect `!insertmacro _EndSelect` + + !macro _Switch _a + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !insertmacro _PushLogic + !insertmacro _PushScope Switch ${_Logic} ; Keep a separate stack for switch data + !insertmacro _PushScope Break _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for beyond the end of the switch + !insertmacro _IncreaseCounter + !define ${_Switch}Var `${_a}` ; Remember the left hand side of the comparison + !tempfile ${_Switch}Tmp ; Create a temporary file + !if "${NSIS_CHAR_SIZE}" > 1 + !appendfile /CHARSET=UTF8SIG "${${_Switch}Tmp}" "" ; Make sure the file uses Unicode + !endif + !define ${_Logic}Switch _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the end of the switch + !insertmacro _IncreaseCounter + Goto ${${_Logic}Switch} ; and go there + !verbose pop + !macroend + !define Switch `!insertmacro _Switch` + + !macro _Case _a + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifdef _Logic & ${_Logic}Select ; Check for an active Select + !insertmacro _Select_Case `${_a}` + !else ifndef _Switch ; If not then check for an active Switch + !error "Cannot use Case without a preceding Select or Switch" + !else + !define _label _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for this case, + !insertmacro _IncreaseCounter + ${_label}: ; place it and add it's check to the temp file + !appendfile "${${_Switch}Tmp}" `!insertmacro _== $\`${${_Switch}Var}$\` $\`${_a}$\` ${_label} ""$\n` + !undef _label + !endif + !verbose pop + !macroend + + !macro _CaseElse + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifdef _Logic & ${_Logic}Select ; Check for an active Select + !insertmacro _Select_CaseElse + !else ifndef _Switch ; If not then check for an active Switch + !error "Cannot use Case without a preceding Select or Switch" + !else ifdef ${_Switch}Else ; Already had a default case? + !error "Cannot use CaseElse following a CaseElse" + !else + !define ${_Switch}Else _LogicLib_Label_${LOGICLIB_COUNTER} ; Get a label for the default case, + !insertmacro _IncreaseCounter + ${${_Switch}Else}: ; and place it + !endif + !verbose pop + !macroend + + !macro _EndSwitch + !verbose push + !verbose ${LOGICLIB_VERBOSITY} + !ifndef _Logic | ${_Logic}Switch + !error "Cannot use EndSwitch without a preceding Switch" + !endif + Goto ${_Break} ; Skip the jump table + ${${_Logic}Switch}: ; Place the end of the switch + !undef ${_Logic}Switch + !include "${${_Switch}Tmp}" ; Include the jump table + !delfile "${${_Switch}Tmp}" ; and clear it up + !ifdef ${_Switch}Else ; Was there a default case? + Goto ${${_Switch}Else} ; then go there if all else fails + !undef ${_Switch}Else + !endif + !undef ${_Switch}Tmp + !undef ${_Switch}Var + ${_Break}: ; Place the break label + !insertmacro _PopScope Break + !insertmacro _PopScope Switch + !insertmacro _PopLogic + !verbose pop + !macroend + !define EndSwitch `!insertmacro _EndSwitch` + +!endif ; LOGICLIB +!verbose 3 +!define LOGICLIB_VERBOSITY ${_LOGICLIB_VERBOSITY} +!undef _LOGICLIB_VERBOSITY +!verbose pop diff --git a/installer/tools/Include/MUI2.nsh b/installer/tools/Include/MUI2.nsh new file mode 100644 index 00000000..0e76adbf --- /dev/null +++ b/installer/tools/Include/MUI2.nsh @@ -0,0 +1 @@ +!include "${NSISDIR}\Contrib\Modern UI 2\MUI2.nsh" \ No newline at end of file diff --git a/installer/tools/Include/Sections.nsh b/installer/tools/Include/Sections.nsh new file mode 100644 index 00000000..7ae9f682 --- /dev/null +++ b/installer/tools/Include/Sections.nsh @@ -0,0 +1,310 @@ +; Sections.nsh +; +; Defines and macros for section control +; +; Include in your script using: +; !include "Sections.nsh" + +;-------------------------------- + +!ifndef SECTIONS_INCLUDED + +!define SECTIONS_INCLUDED + +;-------------------------------- + +; Generic section defines + +# section or section group is selected +!define SF_SELECTED 1 +# section group +!define SF_SECGRP 2 +!define SF_SUBSEC 2 # deprecated +# section group end marker +!define SF_SECGRPEND 4 +!define SF_SUBSECEND 4 # deprecated +# bold text (Section !blah) +!define SF_BOLD 8 +# read only (SectionIn RO) +!define SF_RO 16 +# expanded section group (SectionGroup /e blah) +!define SF_EXPAND 32 +# section group is partially selected +!define SF_PSELECTED 64 # internal +# internal +!define SF_TOGGLED 128 # internal +!define SF_NAMECHG 256 # internal + +# mask to toggle off the selected flag +!define SECTION_OFF 0xFFFFFFFE + +;-------------------------------- + +; Select / unselect / reserve section + +!macro SelectSection SECTION + + Push $0 + Push $1 + StrCpy $1 "${SECTION}" + SectionGetFlags $1 $0 + IntOp $0 $0 | ${SF_SELECTED} + SectionSetFlags $1 $0 + Pop $1 + Pop $0 + +!macroend + +!macro UnselectSection SECTION + + Push $0 + Push $1 + StrCpy $1 "${SECTION}" + SectionGetFlags $1 $0 + IntOp $0 $0 & ${SECTION_OFF} + SectionSetFlags $1 $0 + Pop $1 + Pop $0 + +!macroend + +; If section selected, will unselect, if unselected, will select + +!macro ReverseSection SECTION + + Push $0 + Push $1 + StrCpy $1 "${SECTION}" + SectionGetFlags $1 $0 + IntOp $0 $0 ^ ${SF_SELECTED} + SectionSetFlags $1 $0 + Pop $1 + Pop $0 + +!macroend + +;-------------------------------- + +; Macros for mutually exclusive section selection +; Written by Tim Gallagher +; +; See one-section.nsi for an example of usage + +; Starts the Radio Button Block +; You should pass a variable that keeps the selected section +; as the first parameter for this macro. This variable should +; be initialized to the default section's index. +; +; As this macro uses $R0 and $R1 you can't use those two as the +; variable which will keep the selected section. + +!macro StartRadioButtons var + + !define StartRadioButtons_Var "${var}" + + Push $R0 + + SectionGetFlags "${StartRadioButtons_Var}" $R0 + IntOp $R0 $R0 & ${SECTION_OFF} + SectionSetFlags "${StartRadioButtons_Var}" $R0 + + Push $R1 + + StrCpy $R1 "${StartRadioButtons_Var}" + +!macroend + +; A radio button + +!macro RadioButton SECTION_NAME + + SectionGetFlags ${SECTION_NAME} $R0 + IntOp $R0 $R0 & ${SF_SELECTED} + IntCmp $R0 ${SF_SELECTED} 0 +2 +2 + StrCpy "${StartRadioButtons_Var}" ${SECTION_NAME} + +!macroend + +; Ends the radio button block + +!macro EndRadioButtons + + StrCmp $R1 "${StartRadioButtons_Var}" 0 +4 ; selection hasn't changed + SectionGetFlags "${StartRadioButtons_Var}" $R0 + IntOp $R0 $R0 | ${SF_SELECTED} + SectionSetFlags "${StartRadioButtons_Var}" $R0 + + Pop $R1 + Pop $R0 + + !undef StartRadioButtons_Var + +!macroend + +;-------------------------------- + +; These are two macros you can use to set a Section in an InstType +; or clear it from an InstType. +; +; Written by Robert Kehl +; +; For details, see https://nsis.sourceforge.io/wiki/SetSectionInInstType%2C_ClearSectionInInstType +; +; Use the defines below for the WANTED_INSTTYPE parameter. + +!define INSTTYPE_1 1 +!define INSTTYPE_2 2 +!define INSTTYPE_3 4 +!define INSTTYPE_4 8 +!define INSTTYPE_5 16 +!define INSTTYPE_6 32 +!define INSTTYPE_7 64 +!define INSTTYPE_8 128 +!define INSTTYPE_9 256 +!define INSTTYPE_10 512 +!define INSTTYPE_11 1024 +!define INSTTYPE_12 2048 +!define INSTTYPE_13 4096 +!define INSTTYPE_14 8192 +!define INSTTYPE_15 16384 +!define INSTTYPE_16 32768 +!define INSTTYPE_17 65536 +!define INSTTYPE_18 131072 +!define INSTTYPE_19 262144 +!define INSTTYPE_20 524288 +!define INSTTYPE_21 1048576 +!define INSTTYPE_22 2097152 +!define INSTTYPE_23 4194304 +!define INSTTYPE_24 8388608 +!define INSTTYPE_25 16777216 +!define INSTTYPE_26 33554432 +!define INSTTYPE_27 67108864 +!define INSTTYPE_28 134217728 +!define INSTTYPE_29 268435456 +!define INSTTYPE_30 536870912 +!define INSTTYPE_31 1073741824 +!define INSTTYPE_32 2147483648 + +!macro SetSectionInInstType SECTION_NAME WANTED_INSTTYPE + + Push $0 + Push $1 + StrCpy $1 "${SECTION_NAME}" + SectionGetInstTypes $1 $0 + IntOp $0 $0 | ${WANTED_INSTTYPE} + SectionSetInstTypes $1 $0 + Pop $1 + Pop $0 + +!macroend + +!macro ClearSectionInInstType SECTION_NAME WANTED_INSTTYPE + + Push $0 + Push $1 + Push $2 + StrCpy $2 "${SECTION_NAME}" + SectionGetInstTypes $2 $0 + StrCpy $1 ${WANTED_INSTTYPE} + IntOp $1 $1 ~ + IntOp $0 $0 & $1 + SectionSetInstTypes $2 $0 + Pop $2 + Pop $1 + Pop $0 + +!macroend + +;-------------------------------- + +; Set / clear / check bits in a section's flags +; Written by derekrprice + +; Set one or more bits in a sections's flags + +!macro SetSectionFlag SECTION BITS + + Push $R0 + Push $R1 + StrCpy $R1 "${SECTION}" + SectionGetFlags $R1 $R0 + IntOp $R0 $R0 | "${BITS}" + SectionSetFlags $R1 $R0 + Pop $R1 + Pop $R0 + +!macroend + +; Clear one or more bits in section's flags + +!macro ClearSectionFlag SECTION BITS + + Push $R0 + Push $R1 + Push $R2 + StrCpy $R2 "${SECTION}" + SectionGetFlags $R2 $R0 + IntOp $R1 "${BITS}" ~ + IntOp $R0 $R0 & $R1 + SectionSetFlags $R2 $R0 + Pop $R2 + Pop $R1 + Pop $R0 + +!macroend + +; Check if one or more bits in section's flags are set +; If they are, jump to JUMPIFSET +; If not, jump to JUMPIFNOTSET + +!macro SectionFlagIsSet SECTION BITS JUMPIFSET JUMPIFNOTSET + Push $R0 + SectionGetFlags "${SECTION}" $R0 + IntOp $R0 $R0 & "${BITS}" + IntCmp $R0 "${BITS}" +3 + Pop $R0 + StrCmp "" "${JUMPIFNOTSET}" +3 "${JUMPIFNOTSET}" + Pop $R0 + Goto "${JUMPIFSET}" +!macroend + +;-------------------------------- + +; Removes a section by unselecting and hiding it + +!macro RemoveSection SECTION + + Push $R0 + Push $R1 + StrCpy $R1 `${SECTION}` + SectionGetFlags $R1 $R0 + IntOp $R0 $R0 & ${SECTION_OFF} + SectionSetFlags $R1 $R0 + SectionSetText $R1 `` + Pop $R1 + Pop $R0 + +!macroend + +; Undoes the RemoveSection action + +!macro UnremoveSection SECTION SECTION_TEXT + + Push $R0 + Push $R1 + Push $R2 + StrCpy $R1 `${SECTION}` + StrCpy $R2 `${SECTION_TEXT}` + SectionGetFlags $R1 $R0 + IntOp $R0 $R0 | ${SF_SELECTED} + SectionSetFlags $R1 $R0 + SectionSetText $R1 $R2 + Pop $R2 + Pop $R1 + Pop $R0 + +!macroend + +;-------------------------------- + +!endif \ No newline at end of file diff --git a/installer/tools/Include/Util.nsh b/installer/tools/Include/Util.nsh new file mode 100644 index 00000000..30d03a50 --- /dev/null +++ b/installer/tools/Include/Util.nsh @@ -0,0 +1,184 @@ +; --------------------- +; Util.nsh +; --------------------- +; +; Voodoo macros to make end-user usage easier. This may be documented someday. + +!verbose push 3 +!ifndef ___UTIL__NSH___ +!define ___UTIL__NSH___ + +# CallArtificialFunction, see WinVer.nsh and *Func.nsh for usage examples +!macro CallArtificialFunctionHelper TYPE NAME + !verbose pop + Call :.${NAME}${TYPE} + !ifndef ${NAME}${TYPE}_DEFINED + !verbose push 2 + Goto ${NAME}${TYPE}_DONE + !define ${NAME}${TYPE}_DEFINED + !verbose pop + .${NAME}${TYPE}: + !insertmacro ${NAME} + Return + ${NAME}${TYPE}_DONE: + !endif + !verbose push 2 +!macroend + +!macro CallArtificialFunction NAME + !verbose push 2 + !ifdef __UNINSTALL__ + !insertmacro CallArtificialFunctionHelper uninst ${NAME} + !else + !insertmacro CallArtificialFunctionHelper inst ${NAME} + !endif + !verbose pop +!macroend +!define CallArtificialFunction `!insertmacro CallArtificialFunction` + +!macro CallArtificialFunction2 NAME ; Retained for v2.4x..v3.0b0 compatibility + ${CallArtificialFunction} ${NAME} +!macroend +!define CallArtificialFunction2 `!insertmacro CallArtificialFunction` + + +!define Int32Op '!insertmacro Int32Op ' +!define Int64Op '!insertmacro Int64Op ' +!define IntPtrOp '!insertmacro IntPtrOp ' +!macro Int32Op r a o b +IntOp `${r}` `${a}` `${o}` ${b} +!macroend +!macro Int64Op r a o b +!echo "Int64Op ${r}=${a}${o}${b}" +!verbose push 2 +System::Int64Op `${a}` `${o}` ${b} +Pop ${r} +!verbose pop +!macroend +!macro IntPtrOp r a o b +IntPtrOp `${r}` `${a}` `${o}` `${b}` +!macroend + +!define Int32Cmp '!insertmacro Int32Cmp ' +!define Int64Cmp '!insertmacro Int64Cmp ' +!define IntPtrCmp '!insertmacro IntPtrCmp ' +!macro Int32Cmp a b jeek jles jgtr +IntCmp `${a}` `${b}` `${jeek}` `${jles}` `${jgtr}` +!macroend +!macro Int64Cmp a b jeek jles jgtr +!if ${NSIS_PTR_SIZE} <= 4 +!ifmacrondef _LOGICLIB_TEMP +!include LogicLib.nsh +!endif +!echo "Int64Cmp ${a}:${b} =${jeek}, <${jles}, >${jgtr}" +!verbose push 2 +${IfThen} ${a} L= ${b} ${|} Goto ${jeek} ${|} +!insertmacro _L< ${a} ${b} `${jles}` `${jgtr}` +!verbose pop +!else +Int64Cmp `${a}` `${b}` `${jeek}` `${jles}` `${jgtr}` +!endif +!macroend +!macro IntPtrCmp a b jeek jles jgtr +IntPtrCmp `${a}` `${b}` `${jeek}` `${jles}` `${jgtr}` +!macroend + +!define Int32CmpU '!insertmacro Int32CmpU ' +!define Int64CmpU '!insertmacro Int64CmpU ' +!define IntPtrCmpU '!insertmacro IntPtrCmpU ' +!macro Int32CmpU a b jeek jles jgtr +IntCmpU `${a}` `${b}` `${jeek}` `${jles}` `${jgtr}` +!macroend +!macro Int64CmpUHelper +; This macro performs "$_LOGICLIB_TEMP = a < b ? -1 : a > b ? 1 : 0" but System::Int64Op does not support unsigned operations so we have to perform multiple steps +!ifmacrondef _LOGICLIB_TEMP +!include LogicLib.nsh +!endif +!insertmacro _LOGICLIB_TEMP +Exch $2 ; b +Exch +Exch $1 ; a +; if (a == b) return 0; +; if (a < 0) +; { +; if (b >= 0) return 1 +; } +; else +; { +; if (b < 0) return -1 +; } +; return a < b ? -1 : 1 +System::Int64Op $1 ^ $2 ; Using xor so $_LOGICLIB_TEMP ends up as 0 when they are equal +Pop $_LOGICLIB_TEMP +StrCmp $_LOGICLIB_TEMP 0 ret ; NOTE: Must use StrCmp, IntCmp fails on "0x8000000000000001 Z> 1" +System::Int64Op $1 < 0 +Pop $_LOGICLIB_TEMP +StrCmp $_LOGICLIB_TEMP 0 checkNegOther +System::Int64Op $2 < 0 ; System::Int64Op does not support the >= operator so we invert the operation +Pop $_LOGICLIB_TEMP +StrCmp $_LOGICLIB_TEMP 0 retPos finalCmp +retPos: +StrCpy $_LOGICLIB_TEMP "1" +Goto ret +checkNegOther: +System::Int64Op $2 < 0 +Pop $_LOGICLIB_TEMP +StrCmp $_LOGICLIB_TEMP 0 finalCmp retNeg +retNeg: +StrCpy $_LOGICLIB_TEMP "-1" +Goto ret +finalCmp: +System::Int64Op $1 < $2 +Pop $_LOGICLIB_TEMP +StrCmp $_LOGICLIB_TEMP 0 retPos retNeg +ret: +Pop $1 +Pop $2 +!macroend +!macro Int64CmpU a b jeek jles jgtr +!if ${NSIS_PTR_SIZE} <= 4 +!echo "Int64CmpU ${a}:${b} =${jeek}, <${jles}, >${jgtr}" +!verbose push 2 +Push `${a}` +Push `${b}` +!insertmacro CallArtificialFunction Int64CmpUHelper +IntCmp $_LOGICLIB_TEMP 0 `${jeek}` `${jles}` `${jgtr}` +!verbose pop +!else +Int64CmpU `${a}` `${b}` `${jeek}` `${jles}` `${jgtr}` +!endif +!macroend +!macro IntPtrCmpU a b jeek jles jgtr +IntPtrCmpU `${a}` `${b}` `${jeek}` `${jles}` `${jgtr}` +!macroend + + +!define MakeARPInstallDate "!insertmacro MakeARPInstallDate " +!macro MakeARPInstallDate _outvar +System::Call 'KERNEL32::GetDateFormat(i0x409,i0,p0,t"yyyyMMdd",t.s,i${NSIS_MAX_STRLEN})' +Pop ${_outvar} +!macroend + + +!define /IfNDef SPI_GETHIGHCONTRAST 0x42 +!define /IfNDef HCF_HIGHCONTRASTON 0x01 +!define /IfNDef /math SYSSIZEOF_HIGHCONTRAST 8 + ${NSIS_PTR_SIZE} +!define IsHighContrastModeActive '"" IsHighContrastModeActive ""' +!macro _IsHighContrastModeActive _lhs _rhs _t _f +!ifmacrondef _LOGICLIB_TEMP +!include LogicLib.nsh +!endif +!insertmacro _LOGICLIB_TEMP +Push $1 +System::Call '*(i${SYSSIZEOF_HIGHCONTRAST},i0,p)p.r1' +System::Call 'USER32::SystemParametersInfo(i${SPI_GETHIGHCONTRAST},i${SYSSIZEOF_HIGHCONTRAST},pr1,i0)' +System::Call '*$1(i,i.s)' +Pop $_LOGICLIB_TEMP +System::Free $1 +Pop $1 +!insertmacro _& $_LOGICLIB_TEMP ${HCF_HIGHCONTRASTON} `${_t}` `${_f}` +!macroend + + +!endif # !___UTIL__NSH___ +!verbose pop diff --git a/installer/tools/Include/WinMessages.nsh b/installer/tools/Include/WinMessages.nsh new file mode 100644 index 00000000..47d09dcd --- /dev/null +++ b/installer/tools/Include/WinMessages.nsh @@ -0,0 +1,890 @@ +/* +_____________________________________________________________________________ + + List of common Windows Messages +_____________________________________________________________________________ + + 2005 Shengalts Aleksander aka Instructor (Shengalts@mail.ru) + + +Usage example: +--------------------------------------------------- +Name "Output" +OutFile "Output.exe" + +!include "WinMessages.nsh" + +Section + FindWindow $0 '#32770' '' $HWNDPARENT + GetDlgItem $1 $0 1027 + SendMessage $1 ${WM_SETTEXT} 0 'STR:MyText' +SectionEnd +--------------------------------------------------- + + +Prefix Message category +------------------------- +SW ShowWindow Commands +CCM Generic Common Control +BM Button control +CB Combo box control +EM Edit control +LB List box control +WM General window +ABM Application desktop toolbar +DBT Device +DM Default push button control +HDM Header control +LVM List view control +SB Status bar window +SBM Scroll bar control +STM Static control +TCM Tab control +PBM Progress bar +ACM Animation control +TBM Track bar +UDM Up-down control +HKM Hot key control +IPM IP address control +NCM Network address control +----------------------------------- + +NOT included messages (WM_USER + X) +----------------------------------- +CBEM Extended combo box control +CDM Common dialog box +DL Drag list box +PGM Pager control +PSM Property sheet +RB Rebar control +TB Toolbar +TTM Tooltip control +TVM Tree-view control +----------------------------------- +*/ + + +!ifndef WINMESSAGES_INCLUDED +!define WINMESSAGES_INCLUDED +!verbose push +!verbose 3 + +!define _NSIS_DEFAW '!insertmacro _NSIS_DEFAW ' +!macro _NSIS_DEFAW d +!ifdef NSIS_UNICODE +!define ${d} "${${d}W}" +!else +!define ${d} "${${d}A}" +!endif +!macroend + +!define HWND_BROADCAST 0xFFFF + +#ShowWindow Commands# +!define SW_HIDE 0 +!define SW_SHOWNORMAL 1 +!define SW_NORMAL 1 +!define SW_SHOWMINIMIZED 2 +!define SW_SHOWMAXIMIZED 3 +!define SW_MAXIMIZE 3 +!define SW_SHOWNOACTIVATE 4 +!define SW_SHOW 5 +!define SW_MINIMIZE 6 +!define SW_SHOWMINNOACTIVE 7 +!define SW_SHOWNA 8 +!define SW_RESTORE 9 +!define SW_SHOWDEFAULT 10 +!define SW_FORCEMINIMIZE 11 +!define SW_MAX 11 + +#Generic Common Control Messages# +!define CCM_FIRST 0x2000 +!define /math CCM_SETBKCOLOR ${CCM_FIRST} + 0x1 ; IE4 +!define /math CCM_SETUNICODEFORMAT ${CCM_FIRST} + 0x5 +!define /math CCM_GETUNICODEFORMAT ${CCM_FIRST} + 0x6 +!define /math CCM_SETVERSION ${CCM_FIRST} + 0x7 ; IE5 +!define /math CCM_GETVERSION ${CCM_FIRST} + 0x8 +!define /math CCM_SETWINDOWTHEME ${CCM_FIRST} + 0xB ; WinXP +!define /math CCM_DPISCALE ${CCM_FIRST} + 0xC +!define WM_USER 0x400 + +!define CCS_TOP 1 +!define CCS_BOTTOM 3 +!define CCS_NODIVIDER 64 +!define CCS_LEFT 129 +!define CCS_RIGHT 131 + +!define I_IMAGENONE -2 + +#Button Control Messages# +!define BM_CLICK 0x00F5 +!define BM_GETCHECK 0x00F0 +!define BM_GETIMAGE 0x00F6 +!define BM_GETSTATE 0x00F2 +!define BM_SETCHECK 0x00F1 +!define BM_SETIMAGE 0x00F7 +!define BM_SETSTATE 0x00F3 +!define BM_SETSTYLE 0x00F4 +!define BCM_SETSHIELD 0x160C ; WinVista + ComCtl32 v6 + +!define BST_UNCHECKED 0 +!define BST_CHECKED 1 +!define BST_INDETERMINATE 2 +!define BST_PUSHED 4 +!define BST_FOCUS 8 + +#Combo Box Messages# +!define CB_ADDSTRING 0x0143 +!define CB_DELETESTRING 0x0144 +!define CB_DIR 0x0145 +!define CB_FINDSTRING 0x014C +!define CB_FINDSTRINGEXACT 0x0158 +!define CB_GETCOUNT 0x0146 +!define CB_GETCURSEL 0x0147 +!define CB_GETDROPPEDCONTROLRECT 0x0152 +!define CB_GETDROPPEDSTATE 0x0157 +!define CB_GETDROPPEDWIDTH 0x015f +!define CB_GETEDITSEL 0x0140 +!define CB_GETEXTENDEDUI 0x0156 +!define CB_GETHORIZONTALEXTENT 0x015d +!define CB_GETITEMDATA 0x0150 +!define CB_GETITEMHEIGHT 0x0154 +!define CB_GETLBTEXT 0x0148 +!define CB_GETLBTEXTLEN 0x0149 +!define CB_GETLOCALE 0x015A +!define CB_GETTOPINDEX 0x015b +!define CB_INITSTORAGE 0x0161 +!define CB_INSERTSTRING 0x014A +!define CB_LIMITTEXT 0x0141 +!define CB_MSGMAX 0x015B # 0x0162 0x0163 +!define CB_MULTIPLEADDSTRING 0x0163 +!define CB_RESETCONTENT 0x014B +!define CB_SELECTSTRING 0x014D +!define CB_SETCURSEL 0x014E +!define CB_SETDROPPEDWIDTH 0x0160 +!define CB_SETEDITSEL 0x0142 +!define CB_SETEXTENDEDUI 0x0155 +!define CB_SETHORIZONTALEXTENT 0x015e +!define CB_SETITEMDATA 0x0151 +!define CB_SETITEMHEIGHT 0x0153 +!define CB_SETLOCALE 0x0159 +!define CB_SETTOPINDEX 0x015c +!define CB_SHOWDROPDOWN 0x014F +!define CBM_FIRST 0x1700 ; Vista+ +!define /math CB_SETMINVISIBLE ${CBM_FIRST} + 1 +!define /math CB_GETMINVISIBLE ${CBM_FIRST} + 2 +!define /math CB_SETCUEBANNER ${CBM_FIRST} + 3 +!define /math CB_GETCUEBANNER ${CBM_FIRST} + 4 + +!define CB_ERR -1 + +#Edit Control Messages# +!define EM_CANUNDO 0x00C6 +!define EM_CHARFROMPOS 0x00D7 +!define EM_EMPTYUNDOBUFFER 0x00CD +!define EM_FMTLINES 0x00C8 +!define EM_GETFIRSTVISIBLELINE 0x00CE +!define EM_GETHANDLE 0x00BD +!define EM_GETIMESTATUS 0x00D9 +!define EM_GETLIMITTEXT 0x00D5 +!define EM_GETLINE 0x00C4 +!define EM_GETLINECOUNT 0x00BA +!define EM_GETMARGINS 0x00D4 +!define EM_GETMODIFY 0x00B8 +!define EM_GETPASSWORDCHAR 0x00D2 +!define EM_GETRECT 0x00B2 +!define EM_GETSEL 0x00B0 +!define EM_GETTHUMB 0x00BE +!define EM_GETWORDBREAKPROC 0x00D1 +!define EM_LIMITTEXT 0x00C5 +!define EM_LINEFROMCHAR 0x00C9 +!define EM_LINEINDEX 0x00BB +!define EM_LINELENGTH 0x00C1 +!define EM_LINESCROLL 0x00B6 +!define EM_POSFROMCHAR 0x00D6 +!define EM_REPLACESEL 0x00C2 +!define EM_SCROLL 0x00B5 +!define EM_SCROLLCARET 0x00B7 +!define EM_SETHANDLE 0x00BC +!define EM_SETIMESTATUS 0x00D8 +!define EM_SETLIMITTEXT 0x00C5 # Same as EM_LIMITTEXT +!define EM_SETMARGINS 0x00D3 +!define EM_SETMODIFY 0x00B9 +!define EM_SETPASSWORDCHAR 0x00CC +!define EM_SETREADONLY 0x00CF +!define EM_SETRECT 0x00B3 +!define EM_SETRECTNP 0x00B4 +!define EM_SETSEL 0x00B1 +!define EM_SETTABSTOPS 0x00CB +!define EM_SETWORDBREAKPROC 0x00D0 +!define EM_UNDO 0x00C7 +!define ECM_FIRST 0x1500 ; CC6+ +!define /math EM_SETCUEBANNER ${ECM_FIRST} + 1 + +#RichEdit Messages# +!define /math EM_EXGETSEL ${WM_USER} + 52 +!define /math EM_EXLIMITTEXT ${WM_USER} + 53 +!define /math EM_EXLINEFROMCHAR ${WM_USER} + 54 +!define /math EM_GETEVENTMASK ${WM_USER} + 59 +!define /math EM_GETOLEINTERFACE ${WM_USER} + 60 +!define /math EM_HIDESELECTION ${WM_USER} + 63 +!define /math EM_SETBKGNDCOLOR ${WM_USER} + 67 +!define /math EM_SETEVENTMASK ${WM_USER} + 69 +!define /math EM_STREAMIN ${WM_USER} + 73 +!define /math EM_STREAMOUT ${WM_USER} + 74 +!define /math EM_GETTEXTRANGE ${WM_USER} + 75 +!define /math EM_SETOPTIONS ${WM_USER} + 77 +!define /math EM_GETOPTIONS ${WM_USER} + 78 +!define /math EM_SETUNDOLIMIT ${WM_USER} + 82 ; v2+ +!define /math EM_AUTOURLDETECT ${WM_USER} + 91 +!define /Math EM_SETTEXTEX ${WM_USER} + 97 ; v3+ +!define /math EM_SETEDITSTYLE ${WM_USER} + 204 +!define /math EM_SETFONTSIZE ${WM_USER} + 223 + +!define EN_MSGFILTER 0x0700 +!define EN_SELCHANGE 0x0702 +!define EN_LINK 0x070b + +!define ENM_NONE 0x00000000 +!define ENM_CHANGE 0x00000001 +!define ENM_UPDATE 0x00000002 +!define ENM_SCROLL 0x00000004 +!define ENM_SCROLLEVENTS 0x00000008 +!define ENM_KEYEVENTS 0x00010000 +!define ENM_MOUSEEVENTS 0x00020000 +!define ENM_SELCHANGE 0x00080000 +!define ENM_LINK 0x04000000 ; v2+ + +#Listbox Messages# +!define LB_ADDFILE 0x0196 +!define LB_ADDSTRING 0x0180 +!define LB_DELETESTRING 0x0182 +!define LB_DIR 0x018D +!define LB_FINDSTRING 0x018F +!define LB_FINDSTRINGEXACT 0x01A2 +!define LB_GETANCHORINDEX 0x019D +!define LB_GETCARETINDEX 0x019F +!define LB_GETCOUNT 0x018B +!define LB_GETCURSEL 0x0188 +!define LB_GETHORIZONTALEXTENT 0x0193 +!define LB_GETITEMDATA 0x0199 +!define LB_GETITEMHEIGHT 0x01A1 +!define LB_GETITEMRECT 0x0198 +!define LB_GETLOCALE 0x01A6 +!define LB_GETSEL 0x0187 +!define LB_GETSELCOUNT 0x0190 +!define LB_GETSELITEMS 0x0191 +!define LB_GETTEXT 0x0189 +!define LB_GETTEXTLEN 0x018A +!define LB_GETTOPINDEX 0x018E +!define LB_INITSTORAGE 0x01A8 +!define LB_INSERTSTRING 0x0181 +!define LB_ITEMFROMPOINT 0x01A9 +!define LB_MSGMAX 0x01A8 # 0x01B0 0x01B1 +!define LB_MULTIPLEADDSTRING 0x01B1 +!define LB_RESETCONTENT 0x0184 +!define LB_SELECTSTRING 0x018C +!define LB_SELITEMRANGE 0x019B +!define LB_SELITEMRANGEEX 0x0183 +!define LB_SETANCHORINDEX 0x019C +!define LB_SETCARETINDEX 0x019E +!define LB_SETCOLUMNWIDTH 0x0195 +!define LB_SETCOUNT 0x01A7 +!define LB_SETCURSEL 0x0186 +!define LB_SETHORIZONTALEXTENT 0x0194 +!define LB_SETITEMDATA 0x019A +!define LB_SETITEMHEIGHT 0x01A0 +!define LB_SETLOCALE 0x01A5 +!define LB_SETSEL 0x0185 +!define LB_SETTABSTOPS 0x0192 +!define LB_SETTOPINDEX 0x0197 + +!define LB_ERR -1 + +#Window Messages# +!define WM_ACTIVATE 0x0006 +!define WM_ACTIVATEAPP 0x001C +!define WM_AFXFIRST 0x0360 +!define WM_AFXLAST 0x037F +!define WM_APP 0x8000 +!define WM_APPCOMMAND 0x0319 +!define WM_ASKCBFORMATNAME 0x030C +!define WM_CANCELJOURNAL 0x004B +!define WM_CANCELMODE 0x001F +!define WM_CAPTURECHANGED 0x0215 +!define WM_CHANGECBCHAIN 0x030D +!define WM_CHANGEUISTATE 0x0127 +!define WM_CHAR 0x0102 +!define WM_CHARTOITEM 0x002F +!define WM_CHILDACTIVATE 0x0022 +!define WM_CLEAR 0x0303 +!define WM_CLOSE 0x0010 +!define WM_COMMAND 0x0111 +!define WM_COMMNOTIFY 0x0044 # no longer supported +!define WM_COMPACTING 0x0041 +!define WM_COMPAREITEM 0x0039 +!define WM_CONTEXTMENU 0x007B +!define WM_CONVERTREQUESTEX 0x108 +!define WM_COPY 0x0301 +!define WM_COPYDATA 0x004A +!define WM_CREATE 0x0001 +!define WM_CTLCOLOR 0x0019 +!define WM_CTLCOLORBTN 0x0135 +!define WM_CTLCOLORDLG 0x0136 +!define WM_CTLCOLOREDIT 0x0133 +!define WM_CTLCOLORLISTBOX 0x0134 +!define WM_CTLCOLORMSGBOX 0x0132 +!define WM_CTLCOLORSCROLLBAR 0x0137 +!define WM_CTLCOLORSTATIC 0x0138 +!define WM_CUT 0x0300 +!define WM_DDE_FIRST 0x3E0 +!define WM_DEADCHAR 0x0103 +!define WM_DELETEITEM 0x002D +!define WM_DESTROY 0x0002 +!define WM_DESTROYCLIPBOARD 0x0307 +!define WM_DEVICECHANGE 0x0219 +!define WM_DEVMODECHANGE 0x001B +!define WM_DISPLAYCHANGE 0x007E +!define WM_DRAWCLIPBOARD 0x0308 +!define WM_DRAWITEM 0x002B +!define WM_DROPFILES 0x0233 +!define WM_ENABLE 0x000A +!define WM_ENDSESSION 0x0016 +!define WM_ENTERIDLE 0x0121 +!define WM_ENTERMENULOOP 0x0211 +!define WM_ENTERSIZEMOVE 0x0231 +!define WM_ERASEBKGND 0x0014 +!define WM_EXITMENULOOP 0x0212 +!define WM_EXITSIZEMOVE 0x0232 +!define WM_FONTCHANGE 0x001D +!define WM_GETDLGCODE 0x0087 +!define WM_GETFONT 0x0031 +!define WM_GETHOTKEY 0x0033 +!define WM_GETICON 0x007F +!define WM_GETMINMAXINFO 0x0024 +!define WM_GETOBJECT 0x003D +!define WM_GETTEXT 0x000D +!define WM_GETTEXTLENGTH 0x000E +!define WM_HANDHELDFIRST 0x0358 +!define WM_HANDHELDLAST 0x035F +!define WM_HELP 0x0053 +!define WM_HOTKEY 0x0312 +!define WM_HSCROLL 0x0114 +!define WM_HSCROLLCLIPBOARD 0x030E +!define WM_ICONERASEBKGND 0x0027 +!define WM_IME_CHAR 0x0286 +!define WM_IME_COMPOSITION 0x010F +!define WM_IME_COMPOSITIONFULL 0x0284 +!define WM_IME_CONTROL 0x0283 +!define WM_IME_ENDCOMPOSITION 0x010E +!define WM_IME_KEYDOWN 0x0290 +!define WM_IME_KEYLAST 0x010F +!define WM_IME_KEYUP 0x0291 +!define WM_IME_NOTIFY 0x0282 +!define WM_IME_REQUEST 0x0288 +!define WM_IME_SELECT 0x0285 +!define WM_IME_SETCONTEXT 0x0281 +!define WM_IME_STARTCOMPOSITION 0x010D +!define WM_INITDIALOG 0x0110 +!define WM_INITMENU 0x0116 +!define WM_INITMENUPOPUP 0x0117 +!define WM_INPUT 0x00FF +!define WM_INPUTLANGCHANGE 0x0051 +!define WM_INPUTLANGCHANGEREQUEST 0x0050 +!define WM_KEYDOWN 0x0100 +!define WM_KEYFIRST 0x0100 +!define WM_KEYLAST 0x0108 +!define WM_KEYUP 0x0101 +!define WM_KILLFOCUS 0x0008 +!define WM_LBUTTONDBLCLK 0x0203 +!define WM_LBUTTONDOWN 0x0201 +!define WM_LBUTTONUP 0x0202 +!define WM_MBUTTONDBLCLK 0x0209 +!define WM_MBUTTONDOWN 0x0207 +!define WM_MBUTTONUP 0x0208 +!define WM_MDIACTIVATE 0x0222 +!define WM_MDICASCADE 0x0227 +!define WM_MDICREATE 0x0220 +!define WM_MDIDESTROY 0x0221 +!define WM_MDIGETACTIVE 0x0229 +!define WM_MDIICONARRANGE 0x0228 +!define WM_MDIMAXIMIZE 0x0225 +!define WM_MDINEXT 0x0224 +!define WM_MDIREFRESHMENU 0x0234 +!define WM_MDIRESTORE 0x0223 +!define WM_MDISETMENU 0x0230 +!define WM_MDITILE 0x0226 +!define WM_MEASUREITEM 0x002C +!define WM_MENUCHAR 0x0120 +!define WM_MENUCOMMAND 0x0126 +!define WM_MENUDRAG 0x0123 +!define WM_MENUGETOBJECT 0x0124 +!define WM_MENURBUTTONUP 0x0122 +!define WM_MENUSELECT 0x011F +!define WM_MOUSEACTIVATE 0x0021 +!define WM_MOUSEFIRST 0x0200 +!define WM_MOUSEHOVER 0x02A1 +!define WM_MOUSELAST 0x0209 # 0x020A 0x020D +!define WM_MOUSELEAVE 0x02A3 +!define WM_MOUSEMOVE 0x0200 +!define WM_MOUSEWHEEL 0x020A +!define WM_MOVE 0x0003 +!define WM_MOVING 0x0216 +!define WM_NCACTIVATE 0x0086 +!define WM_NCCALCSIZE 0x0083 +!define WM_NCCREATE 0x0081 +!define WM_NCDESTROY 0x0082 +!define WM_NCHITTEST 0x0084 +!define WM_NCLBUTTONDBLCLK 0x00A3 +!define WM_NCLBUTTONDOWN 0x00A1 +!define WM_NCLBUTTONUP 0x00A2 +!define WM_NCMBUTTONDBLCLK 0x00A9 +!define WM_NCMBUTTONDOWN 0x00A7 +!define WM_NCMBUTTONUP 0x00A8 +!define WM_NCMOUSEHOVER 0x02A0 +!define WM_NCMOUSELEAVE 0x02A2 +!define WM_NCMOUSEMOVE 0x00A0 +!define WM_NCPAINT 0x0085 +!define WM_NCRBUTTONDBLCLK 0x00A6 +!define WM_NCRBUTTONDOWN 0x00A4 +!define WM_NCRBUTTONUP 0x00A5 +!define WM_NCXBUTTONDBLCLK 0x00AD +!define WM_NCXBUTTONDOWN 0x00AB +!define WM_NCXBUTTONUP 0x00AC +!define WM_NEXTDLGCTL 0x0028 +!define WM_NEXTMENU 0x0213 +!define WM_NOTIFY 0x004E +!define WM_NOTIFYFORMAT 0x0055 +!define WM_NULL 0x0000 +!define WM_PAINT 0x000F +!define WM_PAINTCLIPBOARD 0x0309 +!define WM_PAINTICON 0x0026 +!define WM_PALETTECHANGED 0x0311 +!define WM_PALETTEISCHANGING 0x0310 +!define WM_PARENTNOTIFY 0x0210 +!define WM_PASTE 0x0302 +!define WM_PENWINFIRST 0x0380 +!define WM_PENWINLAST 0x038F +!define WM_POWER 0x0048 +!define WM_POWERBROADCAST 0x0218 +!define WM_PRINT 0x0317 +!define WM_PRINTCLIENT 0x0318 +!define WM_QUERYDRAGICON 0x0037 +!define WM_QUERYENDSESSION 0x0011 +!define WM_QUERYNEWPALETTE 0x030F +!define WM_QUERYOPEN 0x0013 +!define WM_QUERYUISTATE 0x0129 +!define WM_QUEUESYNC 0x0023 +!define WM_QUIT 0x0012 +!define WM_RBUTTONDBLCLK 0x0206 +!define WM_RBUTTONDOWN 0x0204 +!define WM_RBUTTONUP 0x0205 +!define WM_RASDIALEVENT 0xCCCD +!define WM_RENDERALLFORMATS 0x0306 +!define WM_RENDERFORMAT 0x0305 +!define WM_SETCURSOR 0x0020 +!define WM_SETFOCUS 0x0007 +!define WM_SETFONT 0x0030 +!define WM_SETHOTKEY 0x0032 +!define WM_SETICON 0x0080 +!define WM_SETREDRAW 0x000B +!define WM_SETTEXT 0x000C +!define WM_SETTINGCHANGE 0x001A # Same as WM_WININICHANGE +!define WM_SHOWWINDOW 0x0018 +!define WM_SIZE 0x0005 +!define WM_SIZECLIPBOARD 0x030B +!define WM_SIZING 0x0214 +!define WM_SPOOLERSTATUS 0x002A +!define WM_STYLECHANGED 0x007D +!define WM_STYLECHANGING 0x007C +!define WM_SYNCPAINT 0x0088 +!define WM_SYSCHAR 0x0106 +!define WM_SYSCOLORCHANGE 0x0015 +!define WM_SYSCOMMAND 0x0112 +!define WM_SYSDEADCHAR 0x0107 +!define WM_SYSKEYDOWN 0x0104 +!define WM_SYSKEYUP 0x0105 +!define WM_TABLET_FIRST 0x02C0 +!define WM_TABLET_LAST 0x02DF +!define WM_THEMECHANGED 0x031A +!define WM_TCARD 0x0052 +!define WM_TIMECHANGE 0x001E +!define WM_TIMER 0x0113 +!define WM_UNDO 0x0304 +!define WM_UNICHAR 0x0109 +!define WM_UNINITMENUPOPUP 0x0125 +!define WM_UPDATEUISTATE 0x0128 +!define WM_USERCHANGED 0x0054 +!define WM_VKEYTOITEM 0x002E +!define WM_VSCROLL 0x0115 +!define WM_VSCROLLCLIPBOARD 0x030A +!define WM_WINDOWPOSCHANGED 0x0047 +!define WM_WINDOWPOSCHANGING 0x0046 +!define WM_WININICHANGE 0x001A +!define WM_WTSSESSION_CHANGE 0x02B1 +!define WM_XBUTTONDBLCLK 0x020D +!define WM_XBUTTONDOWN 0x020B +!define WM_XBUTTONUP 0x020C + + +#Application desktop toolbar# +!define ABM_ACTIVATE 0x00000006 # lParam == TRUE/FALSE means activate/deactivate +!define ABM_GETAUTOHIDEBAR 0x00000007 +!define ABM_GETSTATE 0x00000004 +!define ABM_GETTASKBARPOS 0x00000005 +!define ABM_NEW 0x00000000 +!define ABM_QUERYPOS 0x00000002 +!define ABM_REMOVE 0x00000001 +!define ABM_SETAUTOHIDEBAR 0x00000008 # This can fail, you MUST check the result +!define ABM_SETPOS 0x00000003 +!define ABM_WINDOWPOSCHANGED 0x0000009 + +#Device# +!define DBT_APPYBEGIN 0x0000 +!define DBT_APPYEND 0x0001 +!define DBT_CONFIGCHANGECANCELED 0x0019 +!define DBT_CONFIGCHANGED 0x0018 +!define DBT_CONFIGMGAPI32 0x0022 +!define DBT_CONFIGMGPRIVATE 0x7FFF +!define DBT_CUSTOMEVENT 0x8006 # User-defined event +!define DBT_DEVICEARRIVAL 0x8000 # System detected a new device +!define DBT_DEVICEQUERYREMOVE 0x8001 # Wants to remove, may fail +!define DBT_DEVICEQUERYREMOVEFAILED 0x8002 # Removal aborted +!define DBT_DEVICEREMOVECOMPLETE 0x8004 # Device is gone +!define DBT_DEVICEREMOVEPENDING 0x8003 # About to remove, still avail. +!define DBT_DEVICETYPESPECIFIC 0x8005 # Type specific event +!define DBT_DEVNODES_CHANGED 0x0007 +!define DBT_DEVTYP_DEVICEINTERFACE 0x00000005 # Device interface class +!define DBT_DEVTYP_DEVNODE 0x00000001 # Devnode number +!define DBT_DEVTYP_HANDLE 0x00000006 # File system handle +!define DBT_DEVTYP_NET 0x00000004 # Network resource +!define DBT_DEVTYP_OEM 0x00000000 # Oem-defined device type +!define DBT_DEVTYP_PORT 0x00000003 # Serial, parallel +!define DBT_DEVTYP_VOLUME 0x00000002 # Logical volume +!define DBT_LOW_DISK_SPACE 0x0048 +!define DBT_MONITORCHANGE 0x001B +!define DBT_NO_DISK_SPACE 0x0047 +!define DBT_QUERYCHANGECONFIG 0x0017 +!define DBT_SHELLLOGGEDON 0x0020 +!define DBT_USERDEFINED 0xFFFF +!define DBT_VOLLOCKLOCKFAILED 0x8043 +!define DBT_VOLLOCKLOCKRELEASED 0x8045 +!define DBT_VOLLOCKLOCKTAKEN 0x8042 +!define DBT_VOLLOCKQUERYLOCK 0x8041 +!define DBT_VOLLOCKQUERYUNLOCK 0x8044 +!define DBT_VOLLOCKUNLOCKFAILED 0x8046 +!define DBT_VPOWERDAPI 0x8100 # VPOWERD API for Win95 +!define DBT_VXDINITCOMPLETE 0x0023 + +#Default push button control# +!define DM_BITSPERPEL 0x00040000 +!define DM_COLLATE 0x00008000 +!define DM_COLOR 0x00000800 +!define DM_COPIES 0x00000100 +!define DM_DEFAULTSOURCE 0x00000200 +!define DM_DISPLAYFLAGS 0x00200000 +!define DM_DISPLAYFREQUENCY 0x00400000 +!define DM_DITHERTYPE 0x04000000 +!define DM_DUPLEX 0x00001000 +!define DM_FORMNAME 0x00010000 +!define DM_GRAYSCALE 0x00000001 # This flag is no longer valid +!define DM_ICMINTENT 0x01000000 +!define DM_ICMMETHOD 0x00800000 +!define DM_INTERLACED 0x00000002 # This flag is no longer valid +!define DM_LOGPIXELS 0x00020000 +!define DM_MEDIATYPE 0x02000000 +!define DM_NUP 0x00000040 +!define DM_ORIENTATION 0x00000001 +!define DM_PANNINGHEIGHT 0x10000000 +!define DM_PANNINGWIDTH 0x08000000 +!define DM_PAPERLENGTH 0x00000004 +!define DM_PAPERSIZE 0x00000002 +!define DM_PAPERWIDTH 0x00000008 +!define DM_PELSHEIGHT 0x00100000 +!define DM_PELSWIDTH 0x00080000 +!define DM_POSITION 0x00000020 +!define DM_PRINTQUALITY 0x00000400 +!define DM_SCALE 0x00000010 +!define DM_SPECVERSION 0x0320 # 0x0400 0x0401 +!define DM_TTOPTION 0x00004000 +!define DM_YRESOLUTION 0x00002000 + +#Header control# +!define HDM_FIRST 0x1200 + +#List view control# +!define LVS_SINGLESEL 4 +!define LVS_SHOWSELALWAYS 8 +!define LVS_SORTASCENDING 0x10 +!define LVS_SORTDESCENDING 0x20 +!define LVS_SHAREIMAGELISTS 0x40 +!define LVS_EDITLABELS 0x200 +!define LVS_NOSCROLL 0x2000 +!define LVS_NOCOLUMNHEADER 0x4000 +!define LVS_NOSORTHEADER 0x8000 +!define LVS_ICON 0 +!define LVS_REPORT 1 +!define LVS_SMALLICON 2 +!define LVS_LIST 3 +!define LVS_EX_CHECKBOXES 4 +!define LVS_EX_FULLROWSELECT 0x20 +!define LVS_EX_INFOTIP 0x400 +!define LVS_EX_LABELTIP 0x4000 +!define LVS_EX_DOUBLEBUFFER 0x10000 +!define LVIF_TEXT 1 +!define LVIF_IMAGE 2 +!define LVIF_PARAM 4 +!define LVIF_STATE 8 +!define LVIS_STATEIMAGEMASK 0xF000 +!define LVCF_FMT 1 +!define LVCF_WIDTH 2 +!define LVCF_TEXT 4 +!define LVCF_SUBITEM 8 +!define SYSSTRUCT_LVITEM_V1 (i,i,i,i,&i${NSIS_PTR_SIZE},t,i,i,p) +!define SYSSTRUCT_LVITEM_V2 (i,i,i,i,&i${NSIS_PTR_SIZE},t,i,i,p,i) ; IE3 +!define SYSSTRUCT_LVITEM_V3 (i,i,i,i,&i${NSIS_PTR_SIZE},t,i,i,p,i,i,i,i) ; WinXP + ComCtl32 v6 +!define SYSSTRUCT_LVITEM_V4 (i,i,i,i,&i${NSIS_PTR_SIZE},t,i,i,p,i,i,i,i,i,i) ; WinVista + ComCtl32 v6 +!define LVSCW_AUTOSIZE -1 +!define LVSCW_AUTOSIZE_USEHEADER -2 +!define LVM_FIRST 0x00001000 +!define /math LVM_GETIMAGELIST ${LVM_FIRST} + 2 +!define /math LVM_SETIMAGELIST ${LVM_FIRST} + 3 +!define /math LVM_GETITEMCOUNT ${LVM_FIRST} + 4 +!define /math LVM_GETITEMA ${LVM_FIRST} + 5 +!define /math LVM_SETITEMA ${LVM_FIRST} + 6 +!define /math LVM_INSERTITEMA ${LVM_FIRST} + 7 +!define /math LVM_DELETEITEM ${LVM_FIRST} + 8 +!define /math LVM_DELETEALLITEMS ${LVM_FIRST} + 9 +!define /math LVM_INSERTCOLUMNA ${LVM_FIRST} + 27 +!define /math LVM_SETCOLUMNWIDTH ${LVM_FIRST} + 30 +!define /math LVM_SETITEMSTATE ${LVM_FIRST} + 43 +!define /math LVM_GETITEMSTATE ${LVM_FIRST} + 44 +!define /math LVM_GETITEMTEXTA ${LVM_FIRST} + 45 +!define /math LVM_SETITEMTEXTA ${LVM_FIRST} + 46 +!define /math LVM_SETITEMCOUNT ${LVM_FIRST} + 47 +!define /math LVM_SORTITEMS ${LVM_FIRST} + 48 +!define /math LVM_SETEXTENDEDLISTVIEWSTYLE ${LVM_FIRST} + 54 +!define /math LVM_GETEXTENDEDLISTVIEWSTYLE ${LVM_FIRST} + 55 +!define /math LVM_GETITEMW ${LVM_FIRST} + 75 +!define /math LVM_SETITEMW ${LVM_FIRST} + 76 +!define /math LVM_INSERTITEMW ${LVM_FIRST} + 77 +!define /math LVM_INSERTCOLUMNW ${LVM_FIRST} + 97 +!define /math LVM_GETITEMTEXTW ${LVM_FIRST} + 115 +!define /math LVM_SETITEMTEXTW ${LVM_FIRST} + 116 +!define /math LVM_SETSELECTEDCOLUMN ${LVM_FIRST} + 140 +${_NSIS_DEFAW} LVM_GETITEM +${_NSIS_DEFAW} LVM_SETITEM +${_NSIS_DEFAW} LVM_INSERTITEM +${_NSIS_DEFAW} LVM_INSERTCOLUMN +${_NSIS_DEFAW} LVM_GETITEMTEXT +${_NSIS_DEFAW} LVM_SETITEMTEXT + +#Status bar window# +!define SB_SIMPLEID 0x00ff + +#Scroll bar control# +!define SBM_ENABLE_ARROWS 0x00E4 # Not in win3.1 +!define SBM_GETPOS 0x00E1 # Not in win3.1 +!define SBM_GETRANGE 0x00E3 # Not in win3.1 +!define SBM_GETSCROLLINFO 0x00EA +!define SBM_SETPOS 0x00E0 # Not in win3.1 +!define SBM_SETRANGE 0x00E2 # Not in win3.1 +!define SBM_SETRANGEREDRAW 0x00E6 # Not in win3.1 +!define SBM_SETSCROLLINFO 0x00E9 + +#Static control# +!define STM_SETICON 0x0170 +!define STM_GETICON 0x0171 +!define STM_SETIMAGE 0x0172 +!define STM_GETIMAGE 0x0173 +!define STM_MSGMAX 0x0174 + +#Tab control# +!define TCS_SCROLLOPPOSITE 0x0001 +!define TCIF_TEXT 1 +!define TCIF_PARAM 8 +!define SYSSTRUCT_TCITEM (i,i,&i${NSIS_PTR_SIZE},t,i,i,p) +!define TCM_FIRST 0x1300 +!define /math TCM_INSERTITEMA ${TCM_FIRST} + 7 +!define /math TCM_GETCURSEL ${TCM_FIRST} + 11 +!define /math TCM_ADJUSTRECT ${TCM_FIRST} + 40 +!define /math TCM_INSERTITEMW ${TCM_FIRST} + 62 +!define TCN_SELCHANGE -551 +!define TCN_SELCHANGING -552 +${_NSIS_DEFAW} TCM_INSERTITEM + +#Progress bar control# +!define PBM_SETRANGE 0x401 +!define PBM_SETPOS 0x402 +!define PBM_DELTAPOS 0x403 +!define PBM_SETSTEP 0x404 +!define PBM_STEPIT 0x405 +!define PBM_SETRANGE32 0x406 ; IE3 + ComCtl32 v4.70 +!define PBM_GETRANGE 0x407 +!define PBM_GETPOS 0x408 +!define PBM_SETBARCOLOR 0x409 ; IE4 + ComCtl32 v4.71 +!define PBM_SETBKCOLOR ${CCM_SETBKCOLOR} +!define PBM_SETMARQUEE 0x40A ; WinXP + ComCtl32 v6 +!define PBM_GETSTEP 0x40D ; WinVista +!define PBM_GETBKCOLOR 0x40E +!define PBM_GETBARCOLOR 0x40F +!define PBM_SETSTATE 0x410 +!define PBM_GETSTATE 0x411 + +!define PBST_NORMAL 1 +!define PBST_ERROR 2 +!define PBST_PAUSED 3 + +#Animation control# +!define /math ACM_OPENA ${WM_USER} + 100 +!define /math ACM_PLAY ${WM_USER} + 101 +!define /math ACM_STOP ${WM_USER} + 102 +!define /math ACM_OPENW ${WM_USER} + 103 +${_NSIS_DEFAW} ACM_OPEN + +#TrackBar control# +!define /math TBM_GETPOS ${WM_USER} + 0 +!define /math TBM_GETRANGEMIN ${WM_USER} + 1 +!define /math TBM_GETRANGEMAX ${WM_USER} + 2 +!define /math TBM_GETTIC ${WM_USER} + 3 +!define /math TBM_SETTIC ${WM_USER} + 4 +!define /math TBM_SETPOS ${WM_USER} + 5 +!define /math TBM_SETRANGE ${WM_USER} + 6 +!define /math TBM_SETRANGEMIN ${WM_USER} + 7 +!define /math TBM_SETRANGEMAX ${WM_USER} + 8 +!define /math TBM_CLEARTICS ${WM_USER} + 9 +!define /math TBM_SETSEL ${WM_USER} + 10 +!define /math TBM_SETSELSTART ${WM_USER} + 11 +!define /math TBM_SETSELEND ${WM_USER} + 12 +!define /math TBM_GETPTICS ${WM_USER} + 14 +!define /math TBM_GETTICPOS ${WM_USER} + 15 +!define /math TBM_GETNUMTICS ${WM_USER} + 16 +!define /math TBM_GETSELSTART ${WM_USER} + 17 +!define /math TBM_GETSELEND ${WM_USER} + 18 +!define /math TBM_CLEARSEL ${WM_USER} + 19 +!define /math TBM_SETTICFREQ ${WM_USER} + 20 ; TBS_AUTOTICKS required +!define /math TBM_SETPAGESIZE ${WM_USER} + 21 +!define /math TBM_GETPAGESIZE ${WM_USER} + 22 +!define /math TBM_SETLINESIZE ${WM_USER} + 23 +!define /math TBM_GETLINESIZE ${WM_USER} + 24 +!define /math TBM_GETTHUMBRECT ${WM_USER} + 25 +!define /math TBM_GETCHANNELRECT ${WM_USER} + 26 +!define /math TBM_SETTHUMBLENGTH ${WM_USER} + 27 +!define /math TBM_GETTHUMBLENGTH ${WM_USER} + 28 +!define /math TBM_SETTOOLTIPS ${WM_USER} + 29 ; IE3 +!define /math TBM_GETTOOLTIPS ${WM_USER} + 30 ; IE3 +!define /math TBM_SETTIPSIDE ${WM_USER} + 31 ; IE3 +!define /math TBM_SETBUDDY ${WM_USER} + 32 ; IE3 +!define /math TBM_GETBUDDY ${WM_USER} + 33 ; IE3 +!define TBM_SETUNICODEFORMAT ${CCM_SETUNICODEFORMAT} ; IE4 +!define TBM_GETUNICODEFORMAT ${CCM_GETUNICODEFORMAT} ; IE4 +!define /math TBM_SETPOSNOTIFY ${WM_USER} + 34 ; 7? + +#UpDown controls# +!define /math UDM_SETRANGE ${WM_USER} + 101 +!define /math UDM_GETRANGE ${WM_USER} + 102 +!define /math UDM_SETPOS ${WM_USER} + 103 +!define /math UDM_GETPOS ${WM_USER} + 104 +!define /math UDM_SETBUDDY ${WM_USER} + 105 +!define /math UDM_GETBUDDY ${WM_USER} + 106 +!define /math UDM_SETACCEL ${WM_USER} + 107 +!define /math UDM_GETACCEL ${WM_USER} + 108 +!define /math UDM_SETBASE ${WM_USER} + 109 +!define /math UDM_GETBASE ${WM_USER} + 110 +!define /math UDM_SETRANGE32 ${WM_USER} + 111 ; IE4 +!define /math UDM_GETRANGE32 ${WM_USER} + 112 ; IE4 +!define UDM_SETUNICODEFORMAT ${CCM_SETUNICODEFORMAT} ; IE4 +!define UDM_GETUNICODEFORMAT ${CCM_GETUNICODEFORMAT} ; IE4 +!define /math UDM_SETPOS32 ${WM_USER} + 113 ; IE5 +!define /math UDM_GETPOS32 ${WM_USER} + 114 ; IE5 + +#HotKey control# +!define /math HKM_SETHOTKEY ${WM_USER} + 1 +!define /math HKM_GETHOTKEY ${WM_USER} + 2 +!define /math HKM_SETRULES ${WM_USER} + 3 +!define /IfNDef HOTKEYF_SHIFT 0x01 +!define /IfNDef HOTKEYF_CONTROL 0x02 +!define /IfNDef HOTKEYF_ALT 0x04 +!define /IfNDef HOTKEYF_EXT 0x08 +!define HKCOMB_NONE 0x01 +!define HKCOMB_S 0x02 +!define HKCOMB_C 0x04 +!define HKCOMB_A 0x08 +!define HKCOMB_SC 0x10 +!define HKCOMB_SA 0x20 +!define HKCOMB_CA 0x40 +!define HKCOMB_SCA 0x80 + +#IPAddress control# +!define /math IPM_CLEARADDRESS ${WM_USER} + 100 +!define /math IPM_SETADDRESS ${WM_USER} + 101 +!define /math IPM_GETADDRESS ${WM_USER} + 102 +!define /math IPM_SETRANGE ${WM_USER} + 103 +!define /math IPM_SETFOCUS ${WM_USER} + 104 +!define /math IPM_ISBLANK ${WM_USER} + 105 + +#NetworkAddress control# +!define /math NCM_GETADDRESS ${WM_USER} + 1 ; Vista+ +!define /math NCM_SETALLOWTYPE ${WM_USER} + 2 +!define /math NCM_GETALLOWTYPE ${WM_USER} + 3 +!define /math NCM_DISPLAYERRORTIP ${WM_USER} + 4 + +#Month calendar control# +!define MCM_FIRST 0x1000 +!define /math MCM_GETCURSEL ${MCM_FIRST} + 1 +!define /math MCM_SETCURSEL ${MCM_FIRST} + 2 +!define /math MCM_GETMAXSELCOUNT ${MCM_FIRST} + 3 +!define /math MCM_SETMAXSELCOUNT ${MCM_FIRST} + 4 +!define /math MCM_GETSELRANGE ${MCM_FIRST} + 5 +!define /math MCM_SETSELRANGE ${MCM_FIRST} + 6 +!define /math MCM_GETMONTHRANGE ${MCM_FIRST} + 7 +!define /math MCM_SETDAYSTATE ${MCM_FIRST} + 8 +!define /math MCM_GETMINREQRECT ${MCM_FIRST} + 9 +!define /math MCM_SETCOLOR ${MCM_FIRST} + 10 +!define /math MCM_GETCOLOR ${MCM_FIRST} + 11 +!define /math MCM_SETTODAY ${MCM_FIRST} + 12 +!define /math MCM_GETTODAY ${MCM_FIRST} + 13 +!define /math MCM_HITTEST ${MCM_FIRST} + 14 +!define /math MCM_SETFIRSTDAYOFWEEK ${MCM_FIRST} + 15 +!define /math MCM_GETFIRSTDAYOFWEEK ${MCM_FIRST} + 16 +!define /math MCM_GETRANGE ${MCM_FIRST} + 17 +!define /math MCM_SETRANGE ${MCM_FIRST} + 18 +!define /math MCM_GETMONTHDELTA ${MCM_FIRST} + 19 +!define /math MCM_SETMONTHDELTA ${MCM_FIRST} + 20 +!define /math MCM_GETMAXTODAYWIDTH ${MCM_FIRST} + 21 +!define MCM_SETUNICODEFORMAT ${CCM_SETUNICODEFORMAT} ; IE4+ +!define MCM_GETUNICODEFORMAT ${CCM_SETUNICODEFORMAT} ; IE4+ +!define /math MCM_GETCURRENTVIEW ${MCM_FIRST} + 22 ; Vista+ +!define /math MCM_GETCALENDARCOUNT ${MCM_FIRST} + 23 +!define /math MCM_GETCALENDARGRIDINFO ${MCM_FIRST} + 24 +!define /math MCM_GETCALID ${MCM_FIRST} + 27 +!define /math MCM_SETCALID ${MCM_FIRST} + 28 +!define /math MCM_SIZERECTTOMIN ${MCM_FIRST} + 29 +!define /math MCM_SETCALENDARBORDER ${MCM_FIRST} + 30 +!define /math MCM_GETCALENDARBORDER ${MCM_FIRST} + 31 +!define /math MCM_SETCURRENTVIEW ${MCM_FIRST} + 32 +!define MCN_SELCHANGE -749 +!define MCN_GETDAYSTATE -747 +!define MCN_SELECT -746 +!define MCN_VIEWCHANGE -750 ; Vista+? + +#DateTime control# +!define DTM_FIRST 0x1000 +!define /math DTM_GETSYSTEMTIME ${DTM_FIRST} + 1 +!define /math DTM_SETSYSTEMTIME ${DTM_FIRST} + 2 +!define /math DTM_SETFORMATA ${DTM_FIRST} + 5 +!define /math DTM_SETFORMATW ${DTM_FIRST} + 50 +${_NSIS_DEFAW} DTM_SETFORMAT +!define /math DTM_GETMONTHCAL ${DTM_FIRST} + 8 +!define /math DTM_SETMCFONT ${DTM_FIRST} + 9 ; IE4+? +!define /math DTM_GETMCFONT ${DTM_FIRST} + 10 ; IE4+? +!define /math DTM_SETMCSTYLE ${DTM_FIRST} + 11 ; Vista+? +!define /math DTM_GETMCSTYLE ${DTM_FIRST} + 12 ; Vista+? +!define /math DTM_CLOSEMONTHCAL ${DTM_FIRST} + 13 ; Vista+? +!define DTN_DATETIMECHANGE -759 +!define /IfNDef GDT_ERROR -1 +!define /IfNDef GDT_VALID 0 +!define /IfNDef GDT_NONE 1 + +!verbose pop +!endif diff --git a/installer/tools/Include/WinVer.nsh b/installer/tools/Include/WinVer.nsh new file mode 100644 index 00000000..32564ed7 --- /dev/null +++ b/installer/tools/Include/WinVer.nsh @@ -0,0 +1,703 @@ +; --------------------- +; WinVer.nsh +; --------------------- +; +; LogicLib extensions for handling Windows versions and service packs. +; +; IsNT checks if the installer is running on Windows NT family (NT4, 2000, XP, etc.) +; +; ${If} ${IsNT} +; DetailPrint "Running on NT. Installing Unicode enabled application." +; ${Else} +; DetailPrint "Not running on NT. Installing ANSI application." +; ${EndIf} +; +; IsServerOS checks if the installer is running on a server version of Windows (2000, 2003, 2008, etc.) +; IsDomainController checks if the server is a domain controller +; +; AtLeastWin checks if the installer is running on Windows version at least as specified. +; IsWin checks if the installer is running on Windows version exactly as specified. +; AtMostWin checks if the installer is running on Windows version at most as specified. +; AtLeastBuild checks if the installer is running on a Windows version with a minimum build number. +; AtMostBuild checks if the installer is running on a Windows version with a maximum build number. +; AtLeastWaaS and AtMostWaaS checks Windows 10 "friendly names" against the build number. +; +; can be replaced with the following values: +; +; 95 +; 98 +; ME +; +; NT4 +; 2000 +; XP +; 2003 +; Vista +; 2008 +; 7 +; 2008R2 +; 8 +; 2012 +; 8.1 +; 2012R2 +; 10 +; 11 +; +; Note: Windows 8.1 and later will be detected as Windows 8 unless ManifestSupportedOS is set correctly! +; +; AtLeastServicePack checks if the installer is running on Windows service pack version at least as specified. +; IsServicePack checks if the installer is running on Windows service pack version exactly as specified. +; AtMostServicePack checks if the installer is running on Windows service version pack at most as specified. +; +; Usage examples: +; +; ${If} ${IsNT} +; DetailPrint "Running on NT family." +; DetailPrint "Surely not running on 95, 98 or ME." +; ${AndIf} ${AtLeastWinNT4} +; DetailPrint "Running on NT4 or better. Could even be 2003." +; ${EndIf} +; +; ${If} ${AtLeastWinXP} +; DetailPrint "Running on XP or better." +; ${EndIf} +; +; ${If} ${IsWin2000} +; DetailPrint "Running on 2000." +; ${EndIf} +; +; ${If} ${IsWin2000} +; ${AndIf} ${AtLeastServicePack} 3 +; ${OrIf} ${AtLeastWinXP} +; DetailPrint "Running Win2000 SP3 or above" +; ${EndIf} +; +; ${If} ${AtMostWinXP} +; DetailPrint "Running on XP or older. Surely not running on Vista. Maybe 98, or even 95." +; ${EndIf} +; +; Warning: +; +; Windows 95 and NT both use the same version number. To avoid getting NT4 misidentified +; as Windows 95 and vice-versa or 98 as a version higher than NT4, always use IsNT to +; check if running on the NT family. +; +; ${If} ${AtLeastWin95} +; ${AndIf} ${AtMostWinME} +; DetailPrint "Running 95, 98 or ME." +; DetailPrint "Actually, maybe it's NT4?" +; ${If} ${IsNT} +; DetailPrint "Yes, it's NT4! oops..." +; ${Else} +; DetailPrint "Nope, not NT4. phew..." +; ${EndIf} +; ${EndIf} +; +; +; Other useful extensions are: +; +; * IsWin2003R2 +; * IsStarterEdition +; * OSHasMediaCenter +; * OSHasTabletSupport +; + +!verbose push +!verbose 3 + +!ifndef ___WINVER__NSH___ +!define ___WINVER__NSH___ + +!include LogicLib.nsh +!include Util.nsh + +# masks for our variables + +!define _WINVER_VERXBIT 0x00000001 ; Used to boost $__WINVERV +!define _WINVER_MASKVMAJ 0x7F000000 ; $__WINVERV mask +!define _WINVER_MASKVMIN 0x00FF0000 ; $__WINVERV mask +!define _WINVER_NTMASK 0x7FFFFFFF ; $__WINVERV mask used by AtMost/AtLeast +!define _WINVER_NTBIT 0x80000000 ; $__WINVERV bit used by Is and $__WINVERSP bit used by IsNT +!define _WINVER_NTSRVBIT 0x40000000 ; $__WINVERSP bit for !VER_NT_WORKSTATION +!define _WINVER_NTDCBIT 0x20000000 ; $__WINVERSP bit for VER_NT_DOMAIN_CONTROLLER +!define _WINVER_MASKVBLD 0x0000FFFF ; $__WINVERSP mask for OS build number +!define _WINVER_MASKSP 0x000F0000 ; $__WINVERSP mask for OS service pack + +# possible variable values for different versions + +!define WINVER_95_NT 0x04000000 ;4.00.0950 +!define WINVER_95 0x04000000 ;4.00.0950 +!define WINVER_98_NT 0x040a0000 ;4.10.1998 +!define WINVER_98 0x040a0000 ;4.10.1998 +;define WINVER_98SE 0x040a0000 ;4.10.2222 +!define WINVER_ME_NT 0x045a0000 ;4.90.3000 +!define WINVER_ME 0x045a0000 ;4.90.3000 +;define WINVER_NT3.51 ;3.51.1057 +!define WINVER_NT4_NT 0x84000000 ;4.00.1381 +!define WINVER_NT4 0x04000000 ;4.00.1381 +!define WINVER_2000_NT 0x85000000 ;5.00.2195 +!define WINVER_2000 0x05000000 ;5.00.2195 +!define WINVER_XP_NT 0x85010000 ;5.01.2600 +!define WINVER_XP 0x05010000 ;5.01.2600 +;define WINVER_XP64 ;5.02.3790 +!define WINVER_2003_NT 0x85020000 ;5.02.3790 +!define WINVER_2003 0x05020000 ;5.02.3790 +!define WINVER_VISTA_NT 0x86000000 ;6.00.6000 +!define WINVER_VISTA 0x06000000 ;6.00.6000 +!define WINVER_2008_NT 0x86000001 ;6.00.6001 +!define WINVER_2008 0x06000001 ;6.00.6001 +!define WINVER_7_NT 0x86010000 ;6.01.7600 +!define WINVER_7 0x06010000 ;6.01.7600 +!define WINVER_2008R2_NT 0x86010001 ;6.01.7600 +!define WINVER_2008R2 0x06010001 ;6.01.7600 +!define WINVER_8_NT 0x86020000 ;6.02.9200 +!define WINVER_8 0x06020000 ;6.02.9200 +!define WINVER_2012_NT 0x86020001 ;6.02.9200 +!define WINVER_2012 0x06020001 ;6.02.9200 +!define WINVER_8.1_NT 0x86030000 ;6.03.9600 +!define WINVER_8.1 0x06030000 ;6.03.9600 +!define WINVER_2012R2_NT 0x86030001 ;6.03.9600 +!define WINVER_2012R2 0x06030001 ;6.03.9600 +!define WINVER_10_NT 0x8A000000 ;10.0.10240 +!define WINVER_10 0x0A000000 ;10.0.10240 +!define WINVER_2016_NT 0x8A000001 ;10.0.14393 +!define WINVER_2016 0x0A000001 ;10.0.14393 + + +# use this to make all nt > 9x + +!ifdef WINVER_NT4_OVER_W95 + !define /redef /math WINVER_NT4 ${WINVER_NT4} | ${_WINVER_VERXBIT} +!endif + +# some definitions from header files + +!define OSVERSIONINFOW_SIZE 276 +!define OSVERSIONINFOEXW_SIZE 284 +!define OSVERSIONINFOA_SIZE 148 +!define OSVERSIONINFOEXA_SIZE 156 +!define /ifndef VER_PLATFORM_WIN32_NT 2 +!define /ifndef VER_NT_WORKSTATION 1 +!define /ifndef VER_NT_DOMAIN_CONTROLLER 2 +!define /ifndef VER_NT_SERVER 3 + +!define SM_TABLETPC 86 +!define SM_MEDIACENTER 87 +!define SM_STARTER 88 +!define SM_SERVERR2 89 + +# variable declaration + +!macro __WinVer_DeclareVars + + !ifndef __WINVER_VARS_DECLARED + + !define __WINVER_VARS_DECLARED + + Var /GLOBAL __WINVERV + Var /GLOBAL __WINVERSP + + !endif + +!macroend + +!macro __WinVer_Optimize +!ifndef __WINVER_NOOPTIMIZE +!if "${NSIS_CHAR_SIZE}" > 1 +!define /ReDef AtMostWin95 '"" LogicLib_AlwaysFalse ""' +!define /ReDef AtMostWin98 '"" LogicLib_AlwaysFalse ""' +!define /ReDef AtMostWinME '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWin95 '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWin98 '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWinME '"" LogicLib_AlwaysFalse ""' +!endif +!if "${NSIS_PTR_SIZE}" > 4 +!define /ReDef AtMostWin95 '"" LogicLib_AlwaysFalse ""' +!define /ReDef AtMostWin98 '"" LogicLib_AlwaysFalse ""' +!define /ReDef AtMostWinME '"" LogicLib_AlwaysFalse ""' +!define /ReDef AtMostWinNT4 '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWin95 '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWin98 '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWinME '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWinNT4 '"" LogicLib_AlwaysFalse ""' +!define /ReDef AtLeastWin95 '"" LogicLib_AlwaysTrue ""' +!define /ReDef AtLeastWin98 '"" LogicLib_AlwaysTrue ""' +!define /ReDef AtLeastWinME '"" LogicLib_AlwaysTrue ""' +!define /ReDef AtLeastWinNT4 '"" LogicLib_AlwaysTrue ""' +!define /ReDef AtLeastWin2000 '"" LogicLib_AlwaysTrue ""' +!endif +!ifdef NSIS_ARM | NSIS_ARM32 | NSIS_ARMNT | NSIS_ARM64 +!define /ReDef AtMostWin2000 '"" LogicLib_AlwaysFalse ""' +!define /ReDef AtMostWinXP '"" LogicLib_AlwaysFalse ""' +!define /ReDef AtMostWin2003 '"" LogicLib_AlwaysFalse ""' +!define /ReDef AtMostWinVista '"" LogicLib_AlwaysFalse ""' +!define /ReDef AtMostWin7 '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWin95 '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWin98 '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWinME '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWinNT4 '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWin2000 '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWinXP '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWin2003 '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWinVista '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWin2008 '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWin7 '"" LogicLib_AlwaysFalse ""' +!define /ReDef IsWin2008R2 '"" LogicLib_AlwaysFalse ""' +!define /ReDef AtLeastWin95 '"" LogicLib_AlwaysTrue ""' +!define /ReDef AtLeastWin98 '"" LogicLib_AlwaysTrue ""' +!define /ReDef AtLeastWinME '"" LogicLib_AlwaysTrue ""' +!define /ReDef AtLeastWinNT4 '"" LogicLib_AlwaysTrue ""' +!define /ReDef AtLeastWin2000 '"" LogicLib_AlwaysTrue ""' +!define /ReDef AtLeastWinXP '"" LogicLib_AlwaysTrue ""' +!define /ReDef AtLeastWin2003 '"" LogicLib_AlwaysTrue ""' +!define /ReDef AtLeastWinVista '"" LogicLib_AlwaysTrue ""' +!define /ReDef AtLeastWin2008 '"" LogicLib_AlwaysTrue ""' +!define /ReDef AtLeastWin7 '"" LogicLib_AlwaysTrue ""' +!define /ReDef AtLeastWin2008R2 '"" LogicLib_AlwaysTrue ""' +!define /ReDef AtLeastWin8 '"" LogicLib_AlwaysTrue ""' +!endif +!endif +!macroend + +# lazy initialization macro + +!define /IfNDef __WinVer_GWV GetWinVer + +!macro __WinVer_InitVars_NEW + !insertmacro __WinVer_DeclareVars + !insertmacro __WinVer_Optimize + + # only calculate version once + StrCmp $__WINVERV "" _winver_noveryet + Return + _winver_noveryet: + + Push $0 + ${__WinVer_GWV} $0 Product + ${__WinVer_GWV} $__WINVERV NTDDIMajMin + IntOp $__WINVERV $__WINVERV << 16 ; _WINVER_MASKVMAJ & _WINVER_MASKVMIN + IntOp $__WINVERSP $0 & 2 + IntOp $__WINVERSP $__WINVERSP << 29 ; _WINVER_NTSRVBIT & _WINVER_NTDCBIT + !ifndef NSIS_ARM64 + IntCmp $__WINVERSP 0 notServer + IntCmpU 0x06000000 $__WINVERV "" "" not2008 ; ${If} $__WINVERV U>= 0x06000000 + IntCmpU 0x09000000 $__WINVERV not2008 not2008 "" ; ${AndIf} $__WINVERV U< 0x09000000 + IntOp $__WINVERV $__WINVERV | ${_WINVER_VERXBIT} ; Extra bit so Server 2008 comes after Vista SP1 that has the same minor version, same for Win7 vs 2008R2 + not2008: + Goto endServer + notServer: + IntCmp $__WINVERV 0x05020000 "" notXP64 notXP64 + StrCpy $__WINVERV 0x05010000 ; Change XP 64-bit from 5.2 to 5.1 so it's still XP + notXP64: + endServer: + !endif + + IntCmp $0 0 notNT +!if "${NSIS_PTR_SIZE}" <= 4 +!ifdef WINVER_NT4_OVER_W95 + IntCmp $__WINVERV 0x04000000 "" nt4eq95 nt4eq95 + IntOp $__WINVERV $__WINVERV | ${_WINVER_VERXBIT} ; change NT 4.0.reserved.0 to 4.0.reserved.1 + nt4eq95: +!endif +!endif + IntOp $__WINVERSP $__WINVERSP | ${_WINVER_NTBIT} ; _WINVER_NTBIT + IntOp $__WINVERV $__WINVERV | ${_WINVER_NTBIT} ; _WINVER_NTBIT + notNT: + + ${__WinVer_GWV} $0 Build + IntOp $__WINVERSP $__WINVERSP | $0 ; _WINVER_MASKVBLD + ${__WinVer_GWV} $0 ServicePack + IntOp $0 $0 << 16 + IntOp $__WINVERSP $__WINVERSP | $0 ; _WINVER_MASKSP + Pop $0 +!macroend + +!ifmacrondef __WinVer_Call_GetVersionEx + + !macro __WinVer_Call_GetVersionEx STRUCT_SIZE + + System::Call '*$0(i ${STRUCT_SIZE})' + System::Call kernel32::GetVersionEx(pr0)i.r3 + + !macroend + +!endif + +!macro __WinVer_InitVars_OLD + # variables + !insertmacro __WinVer_DeclareVars + !insertmacro __WinVer_Optimize + + # only calculate version once + StrCmp $__WINVERV "" _winver_noveryet + Return + _winver_noveryet: + + # push used registers on the stack + Push $0 + Push $1 ;maj + Push $2 ;min + Push $3 ;bld + Push $R0 ;temp + + # a plugin call will lock the Unicode mode, it is now safe to set the struct size + !ifdef NSIS_UNICODE + !define /redef OSVERSIONINFO_SIZE ${OSVERSIONINFOW_SIZE} + !define /redef OSVERSIONINFOEX_SIZE ${OSVERSIONINFOEXW_SIZE} + !else + !define /redef OSVERSIONINFO_SIZE ${OSVERSIONINFOA_SIZE} + !define /redef OSVERSIONINFOEX_SIZE ${OSVERSIONINFOEXA_SIZE} + !endif + + # allocate memory + System::Call '*(&i${OSVERSIONINFOEX_SIZE})p.r0' + + # use OSVERSIONINFOEX + !insertmacro __WinVer_Call_GetVersionEx ${OSVERSIONINFOEX_SIZE} + + IntCmp $3 0 "" _winver_ex _winver_ex + # OSVERSIONINFOEX not allowed (Win9x or NT4 w/SP < 6), use OSVERSIONINFO + !insertmacro __WinVer_Call_GetVersionEx ${OSVERSIONINFO_SIZE} + _winver_ex: + + # get results from struct + System::Call '*$0(i.s,i.r1,i.r2,i.r3,i.s,&t128.s,&i2.s,&i2,&i2,&i1.s,&i1)' + + # free struct + System::Free $0 + + # win9x has major and minor info in high word of dwBuildNumber - remove it + IntOp $3 $3 & 0xFFFF + + # get dwOSVersionInfoSize + Pop $R0 + + # get dwPlatformId + Pop $0 + + # NT? + IntCmp $0 ${VER_PLATFORM_WIN32_NT} "" _winver_notnt _winver_notnt + IntOp $__WINVERSP $__WINVERSP | ${_WINVER_NTBIT} + IntOp $__WINVERV $__WINVERV | ${_WINVER_NTBIT} + _winver_notnt: +!ifndef NSIS_UNICODE +!if "${NSIS_PTR_SIZE}" <= 4 + # get service pack information + IntCmp $0 ${VER_PLATFORM_WIN32_NT} _winver_nt "" _winver_nt # win9x + + # get szCSDVersion + Pop $0 + + # copy second char + StrCpy $0 $0 1 1 + + # discard invalid wServicePackMajor and wProductType + Pop $R0 + Pop $R0 + + # switch + StrCmp $0 'A' "" +3 + StrCpy $0 1 + Goto _winver_sp_done + StrCmp $0 'B' "" +3 + StrCpy $0 2 + Goto _winver_sp_done + StrCmp $0 'C' "" +3 + StrCpy $0 3 + Goto _winver_sp_done + StrCpy $0 0 + Goto _winver_sp_done + + _winver_nt: # nt +!endif #~ 32-bit +!endif #~ ANSI + IntCmp $R0 ${OSVERSIONINFOEX_SIZE} "" _winver_sp_noex _winver_sp_noex + + # discard szCSDVersion + Pop $0 + + # get wProductType + Exch + Pop $0 + + # is server? + IntCmp $0 ${VER_NT_WORKSTATION} _winver_nt_notsrv + IntOp $__WINVERSP $__WINVERSP | ${_WINVER_NTSRVBIT} + IntCmp $0 ${VER_NT_DOMAIN_CONTROLLER} "" _winver_nt_notdc _winver_nt_notdc + IntOp $__WINVERSP $__WINVERSP | ${_WINVER_NTDCBIT} + _winver_nt_notdc: + _winver_nt_notsrv: + + # get wServicePackMajor + Pop $0 + + # done with sp + Goto _winver_sp_done + + _winver_sp_noex: # OSVERSIONINFO, not OSVERSIONINFOEX + + #### TODO + ## For IsServerOS to support < NT4SP6, we need to check the registry + ## here to see if we are a server and/or DC + + # get szCSDVersion + Pop $0 + + # discard invalid wServicePackMajor and wProductType + Pop $R0 + Pop $R0 + + # get service pack number from text + StrCpy $R0 $0 13 + StrCmp $R0 "Service Pack " "" +3 + StrCpy $0 $0 "" 13 # cut "Service Pack " + Goto +2 + StrCpy $0 0 # no service pack + +!ifdef WINVER_NT4_OVER_W95 + IntOp $__WINVERV $__WINVERV | ${_WINVER_VERXBIT} ; change NT 4.0.reserved.0 to 4.0.reserved.1 +!endif + + _winver_sp_done: + + # store service pack + IntOp $0 $0 << 16 + IntOp $__WINVERSP $__WINVERSP | $0 + + ### now for the version + + # is server? + IntOp $0 $__WINVERSP & ${_WINVER_NTSRVBIT} + + # windows xp x64? + IntCmp $0 0 "" _winver_not_xp_x64 _winver_not_xp_x64 # not server + IntCmp $1 5 "" _winver_not_xp_x64 _winver_not_xp_x64 # maj 5 + IntCmp $2 2 "" _winver_not_xp_x64 _winver_not_xp_x64 # min 2 + # change XP x64 from 5.2 to 5.1 so it's still XP + StrCpy $2 1 + _winver_not_xp_x64: + + # server 2008? + IntCmp $0 0 _winver_not_ntserver # server + IntCmp 6 $1 "" "" _winver_not_ntserver # maj 6 + # extra bit so Server 2008 comes after Vista SP1 that has the same minor version, same for Win7 vs 2008R2 + IntOp $__WINVERV $__WINVERV | ${_WINVER_VERXBIT} + _winver_not_ntserver: + + # pack version + IntOp $1 $1 << 24 # VerMajor + IntOp $__WINVERV $__WINVERV | $1 + IntOp $0 $2 << 16 + IntOp $__WINVERV $__WINVERV | $0 # VerMinor + IntOp $__WINVERSP $__WINVERSP | $3 # VerBuild + + # restore registers + Pop $R0 + Pop $3 + Pop $2 + Pop $1 + Pop $0 + +!macroend + +!macro __WinVer_InitVars + !ifndef WinVer_v3_7 + !insertmacro __WinVer_InitVars_NEW + !else + !insertmacro __WinVer_InitVars_OLD + !endif +!macroend + +# version comparison LogicLib macros + +!macro _WinVerAtLeast _a _b _t _f + !insertmacro _LOGICLIB_TEMP + ${CallArtificialFunction} __WinVer_InitVars + IntOp $_LOGICLIB_TEMP $__WINVERV & ${_WINVER_NTMASK} + !insertmacro _>= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}` +!macroend +!macro _WinVerIs _a _b _t _f + ${CallArtificialFunction} __WinVer_InitVars + !insertmacro _= $__WINVERV `${_b}` `${_t}` `${_f}` +!macroend +!macro _WinVerAtMost _a _b _t _f + !insertmacro _LOGICLIB_TEMP + ${CallArtificialFunction} __WinVer_InitVars + IntOp $_LOGICLIB_TEMP $__WINVERV & ${_WINVER_NTMASK} + !insertmacro _<= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}` +!macroend + +!macro __WinVer_DefineOSTest Test OS Suffix + !define ${Test}Win${OS} `"" WinVer${Test} ${WINVER_${OS}${Suffix}}` +!macroend + +!macro __WinVer_DefineOSTests Test Suffix + !insertmacro __WinVer_DefineOSTest ${Test} 95 '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} 98 '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} ME '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} NT4 '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} 2000 '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} XP '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} 2003 '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} VISTA '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} 2008 '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} 7 '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} 2008R2 '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} 8 '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} 2012 '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} 8.1 '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} 2012R2 '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} 10 '${Suffix}' + !insertmacro __WinVer_DefineOSTest ${Test} 2016 '${Suffix}' + !define /IfNDef AtLeastWin11 'U>= WinVer_BuildNumCheck 22000' + !define /IfNDef AtMostWin11 'U<= WinVer_BuildNumCheck 22000' +!macroend + +!insertmacro __WinVer_DefineOSTests AtLeast "" +!insertmacro __WinVer_DefineOSTests Is _NT +!insertmacro __WinVer_DefineOSTests AtMost "" + +# version feature LogicLib macros + +!macro __WinVer_LL_IsBitSet _v _b _t _f + !insertmacro _LOGICLIB_TEMP + ${CallArtificialFunction} __WinVer_InitVars + IntOp $_LOGICLIB_TEMP ${_v} & ${_b} + !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}` +!macroend + +!define IsNT `$__WINVERSP _WinVer_LL_IsBitSet ${_WINVER_NTBIT}` +!define IsServerOS `$__WINVERSP _WinVer_LL_IsBitSet ${_WINVER_NTSRVBIT}` +!define IsDomainController `$__WINVERSP _WinVer_LL_IsBitSet ${_WINVER_NTDCBIT}` + +# service pack macros + +!macro _WinVer_GetServicePackLevel OUTVAR + !ifndef WinVer_v3_7 + ${__WinVer_GWV} ${OUTVAR} ServicePack + !else + ${CallArtificialFunction} __WinVer_InitVars + IntOp ${OUTVAR} $__WINVERSP & ${_WINVER_MASKSP} + IntOp ${OUTVAR} ${OUTVAR} >> 16 + !endif +!macroend +!define WinVerGetServicePackLevel '!insertmacro _WinVer_GetServicePackLevel ' + +!macro _AtLeastServicePack _a _b _t _f + !insertmacro _LOGICLIB_TEMP + ${WinVerGetServicePackLevel} $_LOGICLIB_TEMP + !insertmacro _>= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}` +!macroend +!define AtLeastServicePack `"" AtLeastServicePack` + +!macro _AtMostServicePack _a _b _t _f + !insertmacro _LOGICLIB_TEMP + ${WinVerGetServicePackLevel} $_LOGICLIB_TEMP + !insertmacro _<= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}` +!macroend +!define AtMostServicePack `"" AtMostServicePack` + +!macro _IsServicePack _a _b _t _f + !insertmacro _LOGICLIB_TEMP + ${WinVerGetServicePackLevel} $_LOGICLIB_TEMP + !insertmacro _= $_LOGICLIB_TEMP `${_b}` `${_t}` `${_f}` +!macroend +!define IsServicePack `"" IsServicePack` + +# special feature LogicLib macros + +!macro _WinVer_SysMetricCheck m _b _t _f + !insertmacro _LOGICLIB_TEMP + System::Call user32::GetSystemMetrics(i${m})i.s + pop $_LOGICLIB_TEMP + !insertmacro _!= $_LOGICLIB_TEMP 0 `${_t}` `${_f}` +!macroend + +!define IsWin2003R2 `${SM_SERVERR2} WinVer_SysMetricCheck ""` +!define IsStarterEdition `${SM_STARTER} WinVer_SysMetricCheck ""` +!define OSHasMediaCenter `${SM_MEDIACENTER} WinVer_SysMetricCheck ""` +!define OSHasTabletSupport `${SM_TABLETPC} WinVer_SysMetricCheck ""` +!define IsSafeBootMode `67 WinVer_SysMetricCheck ""` + +# version retrieval macros + +!macro __WinVer_GetVer var rshift mask outvar + ${CallArtificialFunction} __WinVer_InitVars + !if "${mask}" != "" + IntOp ${outvar} ${var} & ${mask} + !if "${rshift}" != "" + IntOp ${outvar} ${outvar} >> ${rshift} + !endif + !else + IntOp ${outvar} ${var} >> ${rshift} + !endif +!macroend + +!define WinVerGetMajor '!insertmacro __WinVer_GetVer $__WINVERV 24 ${_WINVER_MASKVMAJ}' +!define WinVerGetMinor '!insertmacro __WinVer_GetVer $__WINVERV 16 ${_WINVER_MASKVMIN}' +!ifndef WinVer_v3_7 +!macro __WinVer_GetVerBuild outvar + ${__WinVer_GWV} ${outvar} Build +!macroend +!define WinVerGetBuild '!insertmacro __WinVer_GetVerBuild ' +!else +!define WinVerGetBuild '!insertmacro __WinVer_GetVer $__WINVERSP "" ${_WINVER_MASKVBLD}' +!endif + +!macro _WinVer_BuildNumCheck op num _t _f + !insertmacro _LOGICLIB_TEMP + ${WinVerGetBuild} $_LOGICLIB_TEMP + !insertmacro _${op} $_LOGICLIB_TEMP ${num} `${_t}` `${_f}` +!macroend +!define AtLeastBuild `U>= WinVer_BuildNumCheck ` +!define AtMostBuild `U<= WinVer_BuildNumCheck ` + +# Windows as a Service macros + +!macro WinVer_WaaS id build fu codename marketingname + !if "${id}" == "?" + # Ignore + !else if "${id}" == ${fu} + !define WinVer_WaaS_Build ${build} + !else if "${id}" == "${codename}" + !define WinVer_WaaS_Build ${build} + !else if "${id}" == "${marketingname}" + !define WinVer_WaaS_Build ${build} + !endif +!macroend + +!macro _WinVer_WaaS op id _t _f + !insertmacro WinVer_WaaS "${id}" 10240 1507 "Threshold" "Windows 10" ; 10240.16384 + !insertmacro WinVer_WaaS "${id}" 10586 1511 "Threshold 2" "November Update" ; 10586.0? + !insertmacro WinVer_WaaS "${id}" 14393 1607 "Redstone" "Anniversary Update" ; 14393.10 + !insertmacro WinVer_WaaS "${id}" 15063 1703 "Redstone 2" "Creators Update" ; 15063.13 + !insertmacro WinVer_WaaS "${id}" 16299 1709 "Redstone 3" "Fall Creators Update" ; 16299.19 + !insertmacro WinVer_WaaS "${id}" 17134 1803 "Redstone 4" "April 2018 Update" ; 17134.1 + !insertmacro WinVer_WaaS "${id}" 17763 1809 "Redstone 5" "October 2018 Update" ; 17763.1 + !insertmacro WinVer_WaaS "${id}" 18362 1903 "19H1" "May 2019 Update" ; 18362.116 + !insertmacro WinVer_WaaS "${id}" 18363 1909 "19H2" "November 2019 Update" ; 18363.418 + !insertmacro WinVer_WaaS "${id}" 19041 2004 "20H1" "May 2020 Update" ; 19041.264? + !insertmacro WinVer_WaaS "${id}" 19042 20H2 "20H2" "October 2020 Update" ; 19042.572? A.K.A. 2009 + !insertmacro WinVer_WaaS "${id}" 19043 21H1 "21H1" "May 2021 Update" ; 19043.928 + !insertmacro WinVer_WaaS "${id}" 19044 21H2 "21H2" "November 2021 Update" ; 19044.1288 + !insertmacro WinVer_WaaS "${id}" 19045 "?" "?" "October 2022 Update" ; 19045.2130 22H2 + !insertmacro WinVer_WaaS "${id}" 22000 "?" "Sun Valley" "Windows 11" ; 10.0.22000.194 21H2 + !insertmacro WinVer_WaaS "${id}" 22621 22H2 "Sun Valley 2" "2022 Update" ; 10.0.22621.521 + + !ifmacrodef WinVerExternal_WaaS_MapToBuild + !insertmacro WinVerExternal_WaaS_MapToBuild ${op} "${id}" WinVer_WaaS_Build + !endif + !define /IfNDef WinVer_WaaS_Build 0 + !if "${WinVer_WaaS_Build}" <= 9600 + !error 'WinVer: Unknown WaaS name: ${id}' + !endif + !insertmacro _WinVer_BuildNumCheck ${op} ${WinVer_WaaS_Build} `${_t}` `${_f}` + !undef WinVer_WaaS_Build +!macroend + +!define AtLeastWaaS `U>= WinVer_WaaS ` +!define AtMostWaaS `U<= WinVer_WaaS ` + +!endif # !___WINVER__NSH___ + +!verbose pop diff --git a/installer/tools/Include/nsDialogs.nsh b/installer/tools/Include/nsDialogs.nsh new file mode 100644 index 00000000..6fc27821 --- /dev/null +++ b/installer/tools/Include/nsDialogs.nsh @@ -0,0 +1,1249 @@ +/* + +nsDialogs.nsh +Header file for creating custom installer pages with nsDialogs + +*/ + +!ifndef NSDIALOGS_INCLUDED +!verbose push 2 +!define NSDIALOGS_INCLUDED +!verbose 3 + +!include LogicLib.nsh +!include WinMessages.nsh + +!define /ifndef WS_EX_DLGMODALFRAME 0x00000001 +!define /ifndef WS_EX_NOPARENTNOTIFY 0x00000004 +!define /ifndef WS_EX_TOPMOST 0x00000008 +!define /ifndef WS_EX_ACCEPTFILES 0x00000010 +!define /ifndef WS_EX_TRANSPARENT 0x00000020 +!define /ifndef WS_EX_MDICHILD 0x00000040 +!define /ifndef WS_EX_TOOLWINDOW 0x00000080 +!define /ifndef WS_EX_WINDOWEDGE 0x00000100 +!define /ifndef WS_EX_CLIENTEDGE 0x00000200 +!define /ifndef WS_EX_CONTEXTHELP 0x00000400 +!define /ifndef WS_EX_RIGHT 0x00001000 +!define /ifndef WS_EX_LEFT 0x00000000 +!define /ifndef WS_EX_RTLREADING 0x00002000 +!define /ifndef WS_EX_LTRREADING 0x00000000 +!define /ifndef WS_EX_LEFTSCROLLBAR 0x00004000 +!define /ifndef WS_EX_RIGHTSCROLLBAR 0x00000000 +!define /ifndef WS_EX_CONTROLPARENT 0x00010000 +!define /ifndef WS_EX_STATICEDGE 0x00020000 +!define /ifndef WS_EX_APPWINDOW 0x00040000 + +!define /ifndef WS_CHILD 0x40000000 +!define /ifndef WS_VISIBLE 0x10000000 +!define /ifndef WS_DISABLED 0x08000000 +!define /ifndef WS_CLIPSIBLINGS 0x04000000 +!define /ifndef WS_CLIPCHILDREN 0x02000000 +!define /ifndef WS_MAXIMIZE 0x01000000 +!define /ifndef WS_BORDER 0x00800000 +!define /ifndef WS_VSCROLL 0x00200000 +!define /ifndef WS_HSCROLL 0x00100000 +!define /ifndef WS_GROUP 0x00020000 +!define /ifndef WS_MINIMIZEBOX 0x00020000 +!define /ifndef WS_MAXIMIZEBOX 0x00010000 +!define /ifndef WS_TABSTOP 0x00010000 + +!define ES_LEFT 0x00000000 +!define ES_CENTER 0x00000001 +!define ES_RIGHT 0x00000002 +!define ES_MULTILINE 0x00000004 +!define ES_UPPERCASE 0x00000008 +!define ES_LOWERCASE 0x00000010 +!define ES_PASSWORD 0x00000020 +!define ES_AUTOVSCROLL 0x00000040 +!define ES_AUTOHSCROLL 0x00000080 +!define ES_NOHIDESEL 0x00000100 +!define ES_OEMCONVERT 0x00000400 +!define ES_READONLY 0x00000800 +!define ES_WANTRETURN 0x00001000 +!define ES_NUMBER 0x00002000 +!define ES_SAVESEL 0x00008000 + +!define SS_LEFT 0x00000000 +!define SS_CENTER 0x00000001 +!define SS_RIGHT 0x00000002 +!define SS_ICON 0x00000003 +!define SS_BLACKRECT 0x00000004 +!define SS_GRAYRECT 0x00000005 +!define SS_WHITERECT 0x00000006 +!define SS_BLACKFRAME 0x00000007 +!define SS_GRAYFRAME 0x00000008 +!define SS_WHITEFRAME 0x00000009 +!define SS_USERITEM 0x0000000A +!define SS_SIMPLE 0x0000000B +!define SS_LEFTNOWORDWRAP 0x0000000C +!define SS_OWNERDRAW 0x0000000D +!define SS_BITMAP 0x0000000E +!define SS_ENHMETAFILE 0x0000000F +!define SS_ETCHEDHORZ 0x00000010 +!define SS_ETCHEDVERT 0x00000011 +!define SS_ETCHEDFRAME 0x00000012 +!define SS_TYPEMASK 0x0000001F +!define SS_REALSIZECONTROL 0x00000040 +!define SS_NOPREFIX 0x00000080 +!define SS_NOTIFY 0x00000100 +!define SS_CENTERIMAGE 0x00000200 +!define SS_RIGHTJUST 0x00000400 +!define SS_REALSIZEIMAGE 0x00000800 +!define SS_SUNKEN 0x00001000 +!define SS_EDITCONTROL 0x00002000 +!define SS_ENDELLIPSIS 0x00004000 +!define SS_PATHELLIPSIS 0x00008000 +!define SS_WORDELLIPSIS 0x0000C000 +!define SS_ELLIPSISMASK 0x0000C000 + +!define BS_PUSHBUTTON 0x00000000 +!define BS_DEFPUSHBUTTON 0x00000001 +!define BS_CHECKBOX 0x00000002 +!define BS_AUTOCHECKBOX 0x00000003 +!define BS_RADIOBUTTON 0x00000004 +!define BS_3STATE 0x00000005 +!define BS_AUTO3STATE 0x00000006 +!define BS_GROUPBOX 0x00000007 +!define BS_USERBUTTON 0x00000008 +!define BS_AUTORADIOBUTTON 0x00000009 +!define BS_PUSHBOX 0x0000000A +!define BS_OWNERDRAW 0x0000000B +!define BS_TYPEMASK 0x0000000F +!define BS_LEFTTEXT 0x00000020 +!define BS_TEXT 0x00000000 +!define BS_ICON 0x00000040 +!define BS_BITMAP 0x00000080 +!define BS_LEFT 0x00000100 +!define BS_RIGHT 0x00000200 +!define BS_CENTER 0x00000300 +!define BS_TOP 0x00000400 +!define BS_BOTTOM 0x00000800 +!define BS_VCENTER 0x00000C00 +!define BS_PUSHLIKE 0x00001000 +!define BS_MULTILINE 0x00002000 +!define BS_NOTIFY 0x00004000 +!define BS_FLAT 0x00008000 +!define BS_RIGHTBUTTON ${BS_LEFTTEXT} + +!define CBS_SIMPLE 0x0001 +!define CBS_DROPDOWN 0x0002 +!define CBS_DROPDOWNLIST 0x0003 +!define CBS_OWNERDRAWFIXED 0x0010 +!define CBS_OWNERDRAWVARIABLE 0x0020 +!define CBS_AUTOHSCROLL 0x0040 +!define CBS_OEMCONVERT 0x0080 +!define CBS_SORT 0x0100 +!define CBS_HASSTRINGS 0x0200 +!define CBS_NOINTEGRALHEIGHT 0x0400 +!define CBS_DISABLENOSCROLL 0x0800 +!define CBS_UPPERCASE 0x2000 +!define CBS_LOWERCASE 0x4000 + +!define LBS_NOTIFY 0x0001 +!define LBS_SORT 0x0002 +!define LBS_NOREDRAW 0x0004 +!define LBS_MULTIPLESEL 0x0008 +!define LBS_OWNERDRAWFIXED 0x0010 +!define LBS_OWNERDRAWVARIABLE 0x0020 +!define LBS_HASSTRINGS 0x0040 +!define LBS_USETABSTOPS 0x0080 +!define LBS_NOINTEGRALHEIGHT 0x0100 +!define LBS_MULTICOLUMN 0x0200 +!define LBS_WANTKEYBOARDINPUT 0x0400 +!define LBS_EXTENDEDSEL 0x0800 +!define LBS_DISABLENOSCROLL 0x1000 +!define LBS_NODATA 0x2000 +!define LBS_NOSEL 0x4000 +!define LBS_COMBOBOX 0x8000 + +!define ACS_CENTER 0x0001 +!define ACS_TRANSPARENT 0x0002 ; The parent of the animation control must not have the WS_CLIPCHILDREN style +!define ACS_AUTOPLAY 0x0004 +!define ACS_TIMER 0x0008 ; < CC6 + +!define TBS_AUTOTICKS 0x0001 +!define TBS_VERT 0x0002 +!define TBS_HORZ 0x0000 +!define TBS_TOP 0x0004 +!define TBS_BOTTOM 0x0000 +!define TBS_LEFT 0x0004 +!define TBS_RIGHT 0x0000 +!define TBS_BOTH 0x0008 +!define TBS_NOTICKS 0x0010 +!define TBS_ENABLESELRANGE 0x0020 +!define TBS_FIXEDLENGTH 0x0040 +!define TBS_NOTHUMB 0x0080 +!define TBS_TOOLTIPS 0x0100 ; IE3 +!define TBS_REVERSED 0x0200 ; IE5 +!define TBS_DOWNISLEFT 0x0400 ; _WIN32_IE >= 0x0501 +!define TBS_NOTIFYBEFOREMOVE 0x0800 ; IE6? +!define TBS_TRANSPARENTBKGND 0x1000 ; Vista + +!define UDS_WRAP 0x0001 +!define UDS_SETBUDDYINT 0x0002 +!define UDS_ALIGNRIGHT 0x0004 +!define UDS_ALIGNLEFT 0x0008 +!define UDS_AUTOBUDDY 0x0010 +!define UDS_ARROWKEYS 0x0020 +!define UDS_HORZ 0x0040 +!define UDS_NOTHOUSANDS 0x0080 +!define UDS_HOTTRACK 0x0100 ; 98+ + +!define MCS_DAYSTATE 0x0001 +!define MCS_MULTISELECT 0x0002 +!define MCS_WEEKNUMBERS 0x0004 +!define MCS_NOTODAYCIRCLE 0x0008 +!define MCS_NOTODAY 0x0010 ; IE4+? +!define MCS_NOTRAILINGDATES 0x0040 ; Vista+ +!define MCS_SHORTDAYSOFWEEK 0x0080 ; Vista+ +!define MCS_NOSELCHANGEONNAV 0x0100 ; Vista+ + +!define DTS_UPDOWN 0x01 +!define DTS_SHOWNONE 0x02 +!define DTS_SHORTDATEFORMAT 0x00 +!define DTS_LONGDATEFORMAT 0x04 +!define DTS_SHORTDATECENTURYFORMAT 0x0C +!define DTS_TIMEFORMAT 0x09 +!define DTS_APPCANPARSE 0x10 +!define DTS_RIGHTALIGN 0x20 + +!define /ifndef LR_DEFAULTCOLOR 0x0000 +!define /ifndef LR_MONOCHROME 0x0001 +!define /ifndef LR_COLOR 0x0002 +!define /ifndef LR_COPYRETURNORG 0x0004 +!define /ifndef LR_COPYDELETEORG 0x0008 +!define /ifndef LR_LOADFROMFILE 0x0010 +!define /ifndef LR_LOADTRANSPARENT 0x0020 +!define /ifndef LR_DEFAULTSIZE 0x0040 +!define /ifndef LR_VGACOLOR 0x0080 +!define /ifndef LR_LOADMAP3DCOLORS 0x1000 +!define /ifndef LR_CREATEDIBSECTION 0x2000 +!define /ifndef LR_COPYFROMRESOURCE 0x4000 +!define /ifndef LR_SHARED 0x8000 + +!define /ifndef IMAGE_BITMAP 0 +!define /ifndef IMAGE_ICON 1 +!define /ifndef IMAGE_CURSOR 2 +!define /ifndef IMAGE_ENHMETAFILE 3 + +!define /ifndef GWL_STYLE -16 +!define /ifndef GWL_EXSTYLE -20 + +#define /ifndef ICC_LISTVIEW_CLASSES 0x0001 ; SysListView32 and SysHeader32 +#define /ifndef ICC_TREEVIEW_CLASSES 0x0002 ; SysTabControl32 and tooltips_class32 +#define /ifndef ICC_BAR_CLASSES 0x0004 ; ToolbarWindow32, msctls_statusbar32, msctls_trackbar32 and tooltips_class32 +#define /ifndef ICC_TAB_CLASSES 0x0008 ; SysTabControl32 and tooltips_class32 +#define /ifndef ICC_UPDOWN_CLASS 0x0010 ; msctls_updown32 +#define /ifndef ICC_PROGRESS_CLASS 0x0020 ; msctls_progress32 +#define /ifndef ICC_HOTKEY_CLASS 0x0040 ; msctls_hotkey32 +#define /ifndef ICC_ANIMATE_CLASS 0x0080 ; SysAnimate32 +#define /ifndef ICC_WIN95_CLASSES 0x00FF +!define /ifndef ICC_DATE_CLASSES 0x0100 ; CC4.70+ (NT4+/IE3.1+/Win95 OSR2) SysDateTimePick32, SysMonthCal32 and CC6.10+(Vista+) DropDown +!define /ifndef ICC_USEREX_CLASSES 0x0200 ; CC4.??+ (NT4+/IE3.?+/Win95 OSR2) ComboBoxEx32 +!define /ifndef ICC_COOL_CLASSES 0x0400 ; CC4.70+ (NT4+/IE3.1+/Win95 OSR2) ReBarWindow32 +!define /ifndef ICC_INTERNET_CLASSES 0x0800 ; CC4.71+ (IE4+) SysIPAddress32 +!define /ifndef ICC_PAGESCROLLER_CLASS 0x1000 ; CC4.71+ (IE4+) SysPager +!define /ifndef ICC_NATIVEFNTCTL_CLASS 0x2000 ; CC4.71+ (IE4+) NativeFontCtl +!define /ifndef ICC_STANDARD_CLASSES 0x4000 ; WinXP+ Button, Static, Edit, ListBox, ComboBox, ComboLBox, ScrollBar and ReaderModeCtl +!define /ifndef ICC_LINK_CLASS 0x8000 ; WinXP+ SysLink + + +!define DEFAULT_STYLES ${WS_CHILD}|${WS_VISIBLE}|${WS_CLIPSIBLINGS} + +!define __NSD_HLine_CLASS STATIC +!define __NSD_HLine_STYLE ${DEFAULT_STYLES}|${SS_ETCHEDHORZ}|${SS_SUNKEN} +!define __NSD_HLine_EXSTYLE ${WS_EX_TRANSPARENT} + +!define __NSD_VLine_CLASS STATIC +!define __NSD_VLine_STYLE ${DEFAULT_STYLES}|${SS_ETCHEDVERT}|${SS_SUNKEN} +!define __NSD_VLine_EXSTYLE ${WS_EX_TRANSPARENT} + +!define __NSD_Label_CLASS STATIC +!define __NSD_Label_STYLE ${DEFAULT_STYLES}|${SS_NOTIFY} +!define __NSD_Label_EXSTYLE ${WS_EX_TRANSPARENT} + +!define __NSD_Icon_CLASS STATIC +!define __NSD_Icon_STYLE ${DEFAULT_STYLES}|${SS_ICON}|${SS_NOTIFY} +!define __NSD_Icon_EXSTYLE 0 + +!define __NSD_Bitmap_CLASS STATIC +!define __NSD_Bitmap_STYLE ${DEFAULT_STYLES}|${SS_BITMAP}|${SS_NOTIFY} +!define __NSD_Bitmap_EXSTYLE 0 + +!define __NSD_BrowseButton_CLASS BUTTON +!define __NSD_BrowseButton_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP} +!define __NSD_BrowseButton_EXSTYLE 0 + +!define __NSD_Link_CLASS LINK +!define __NSD_Link_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${BS_OWNERDRAW} +!define __NSD_Link_EXSTYLE 0 + +!define __NSD_Button_CLASS BUTTON +!define __NSD_Button_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP} +!define __NSD_Button_EXSTYLE 0 + +!define __NSD_GroupBox_CLASS BUTTON +!define __NSD_GroupBox_STYLE ${DEFAULT_STYLES}|${BS_GROUPBOX} +!define __NSD_GroupBox_EXSTYLE ${WS_EX_TRANSPARENT} + +!define __NSD_CheckBox_CLASS BUTTON +!define __NSD_CheckBox_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${BS_TEXT}|${BS_VCENTER}|${BS_AUTOCHECKBOX}|${BS_MULTILINE} +!define __NSD_CheckBox_EXSTYLE 0 + +!define __NSD_RadioButton_CLASS BUTTON +!define __NSD_RadioButton_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${BS_TEXT}|${BS_VCENTER}|${BS_AUTORADIOBUTTON}|${BS_MULTILINE} +!define __NSD_RadioButton_EXSTYLE 0 + +!define __NSD_FirstRadioButton_CLASS ${__NSD_RadioButton_CLASS} +!define __NSD_FirstRadioButton_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${WS_GROUP}|${BS_TEXT}|${BS_VCENTER}|${BS_AUTORADIOBUTTON}|${BS_MULTILINE} +!define __NSD_FirstRadioButton_EXSTYLE ${__NSD_RadioButton_EXSTYLE} + +!define __NSD_AdditionalRadioButton_CLASS ${__NSD_RadioButton_CLASS} +!define __NSD_AdditionalRadioButton_STYLE ${DEFAULT_STYLES}|${BS_TEXT}|${BS_VCENTER}|${BS_AUTORADIOBUTTON}|${BS_MULTILINE} +!define __NSD_AdditionalRadioButton_EXSTYLE ${__NSD_RadioButton_EXSTYLE} + +!define __NSD_Text_CLASS EDIT +!define __NSD_Text_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL} +!define __NSD_Text_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} + +!define __NSD_MLText_CLASS EDIT +!define __NSD_MLText_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}|${ES_AUTOVSCROLL}|${ES_MULTILINE}|${ES_WANTRETURN}|${WS_HSCROLL}|${WS_VSCROLL} +!define __NSD_MLText_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} + +!define __NSD_Password_CLASS EDIT +!define __NSD_Password_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}|${ES_PASSWORD} +!define __NSD_Password_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} + +!define __NSD_Number_CLASS EDIT +!define __NSD_Number_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}|${ES_NUMBER} +!define __NSD_Number_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} + +!define __NSD_FileRequest_CLASS EDIT +!define __NSD_FileRequest_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL} +!define __NSD_FileRequest_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} + +!define __NSD_DirRequest_CLASS EDIT +!define __NSD_DirRequest_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL} +!define __NSD_DirRequest_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} + +!define __NSD_RichEdit_CLASS_10 "RICHEDIT" ; 1.0 (Riched32.dll) Win95/NT4 +!define __NSD_RichEdit_CLASS_20A "RICHEDIT20A" ; 2.0 (Riched20.dll) Win98/NT4 (NSIS makes sure this is registered even on Windows 95) +!define __NSD_RichEdit_CLASS_20W "RICHEDIT20W" +!define __NSD_RichEdit_CLASS_41W "RICHEDIT50W" ; 4.1 (MsftEdit.DLL) WinXP.SP1 +!ifdef NSIS_UNICODE +!define /ifndef __NSD_RichEdit_CLASS ${__NSD_RichEdit_CLASS_20W} +!else +!define /ifndef __NSD_RichEdit_CLASS ${__NSD_RichEdit_CLASS_20A} +!endif +!define __NSD_RichEdit_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${ES_AUTOHSCROLL}|${ES_AUTOVSCROLL}|${ES_MULTILINE}|${ES_WANTRETURN}|${ES_SAVESEL}|${WS_HSCROLL}|${WS_VSCROLL} +!define __NSD_RichEdit_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} + +!define __NSD_ComboBox_CLASS COMBOBOX +!define __NSD_ComboBox_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${WS_VSCROLL}|${WS_CLIPCHILDREN}|${CBS_AUTOHSCROLL}|${CBS_HASSTRINGS}|${CBS_DROPDOWN} +!define __NSD_ComboBox_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} + +!define __NSD_DropList_CLASS COMBOBOX +!define __NSD_DropList_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${WS_VSCROLL}|${WS_CLIPCHILDREN}|${CBS_AUTOHSCROLL}|${CBS_HASSTRINGS}|${CBS_DROPDOWNLIST} +!define __NSD_DropList_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} + +!define __NSD_ListBox_CLASS LISTBOX +!define __NSD_ListBox_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${WS_VSCROLL}|${LBS_DISABLENOSCROLL}|${LBS_HASSTRINGS}|${LBS_NOINTEGRALHEIGHT}|${LBS_NOTIFY} +!define __NSD_ListBox_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} + +!define __NSD_SortedListBox_CLASS LISTBOX +!define __NSD_SortedListBox_STYLE ${__NSD_ListBox_STYLE}|${LBS_SORT} +!define __NSD_SortedListBox_EXSTYLE ${__NSD_ListBox_EXSTYLE} + +!define __NSD_ProgressBar_CLASS msctls_progress32 +!define __NSD_ProgressBar_STYLE ${DEFAULT_STYLES} +!define __NSD_ProgressBar_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} + +!define __NSD_Animation_CLASS SysAnimate32 +!define __NSD_Animation_STYLE ${DEFAULT_STYLES}|${ACS_TRANSPARENT}|${ACS_AUTOPLAY} +!define __NSD_Animation_EXSTYLE 0 + +!define __NSD_HTrackBar_CLASS msctls_trackbar32 +!define __NSD_HTrackBar_STYLE ${DEFAULT_STYLES}|${TBS_HORZ}|${TBS_AUTOTICKS}|${TBS_TOOLTIPS} +!define __NSD_HTrackBar_EXSTYLE 0 + +!define __NSD_VTrackBar_CLASS msctls_trackbar32 +!define __NSD_VTrackBar_STYLE ${DEFAULT_STYLES}|${TBS_VERT}|${TBS_AUTOTICKS}|${TBS_TOOLTIPS} +!define __NSD_VTrackBar_EXSTYLE 0 + +!define __NSD_UpDown_CLASS msctls_updown32 +!define __NSD_UpDown_STYLE ${DEFAULT_STYLES}|${UDS_SETBUDDYINT}|${UDS_ARROWKEYS}|${UDS_NOTHOUSANDS}|${UDS_ALIGNRIGHT} +!define __NSD_UpDown_EXSTYLE 0 + +!define __NSD_AutoUpDown_CLASS msctls_updown32 +!define __NSD_AutoUpDown_STYLE ${__NSD_UpDown_STYLE}|${UDS_AUTOBUDDY} +!define __NSD_AutoUpDown_EXSTYLE ${__NSD_UpDown_EXSTYLE} + +!define __NSD_HotKey_CLASS msctls_hotkey32 +!define __NSD_HotKey_STYLE ${DEFAULT_STYLES} +!define __NSD_HotKey_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} + +!define __NSD_Calendar_CLASS SysMonthCal32 +!define __NSD_Calendar_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP} +!define __NSD_Calendar_EXSTYLE 0 + +!define __NSD_DatePicker_CLASS SysDateTimePick32 +!define __NSD_DatePicker_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP} +!define __NSD_DatePicker_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} + +!define __NSD_TimePicker_CLASS SysDateTimePick32 +!define __NSD_TimePicker_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP}|${DTS_TIMEFORMAT} +!define __NSD_TimePicker_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} + +!define __NSD_IPAddress_CLASS SysIPAddress32 ; IE4+/CC4.71+ +!define __NSD_IPAddress_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP} +!define __NSD_IPAddress_EXSTYLE 0 + +!define __NSD_NetAddress_CLASS msctls_netaddress ; Vista+ +!define __NSD_NetAddress_STYLE ${DEFAULT_STYLES}|${WS_TABSTOP} +!define __NSD_NetAddress_EXSTYLE ${WS_EX_WINDOWEDGE}|${WS_EX_CLIENTEDGE} + + +!macro __NSD_DefineControl NAME + !define NSD_Create${NAME} "nsDialogs::CreateControl ${__NSD_${Name}_CLASS} ${__NSD_${Name}_STYLE} ${__NSD_${Name}_EXSTYLE}" +!macroend +!insertmacro __NSD_DefineControl HLine +!insertmacro __NSD_DefineControl VLine +!insertmacro __NSD_DefineControl Label +!insertmacro __NSD_DefineControl Icon +!insertmacro __NSD_DefineControl Bitmap +!insertmacro __NSD_DefineControl BrowseButton +!insertmacro __NSD_DefineControl Link +!insertmacro __NSD_DefineControl Button +!insertmacro __NSD_DefineControl GroupBox +!insertmacro __NSD_DefineControl CheckBox +!insertmacro __NSD_DefineControl RadioButton +!insertmacro __NSD_DefineControl FirstRadioButton +!insertmacro __NSD_DefineControl AdditionalRadioButton +!insertmacro __NSD_DefineControl Text +!insertmacro __NSD_DefineControl MLText +!insertmacro __NSD_DefineControl Password +!insertmacro __NSD_DefineControl Number +!insertmacro __NSD_DefineControl FileRequest +!insertmacro __NSD_DefineControl DirRequest +!insertmacro __NSD_DefineControl RichEdit +!insertmacro __NSD_DefineControl ComboBox +!insertmacro __NSD_DefineControl DropList +!insertmacro __NSD_DefineControl ListBox +!insertmacro __NSD_DefineControl SortedListBox +!insertmacro __NSD_DefineControl ProgressBar +!insertmacro __NSD_DefineControl Animation +!insertmacro __NSD_DefineControl HTrackBar +!insertmacro __NSD_DefineControl VTrackBar +!insertmacro __NSD_DefineControl UpDown +!insertmacro __NSD_DefineControl AutoUpDown +!insertmacro __NSD_DefineControl HotKey +!insertmacro __NSD_DefineControl Calendar +!insertmacro __NSD_DefineControl DatePicker +!insertmacro __NSD_DefineControl TimePicker +!insertmacro __NSD_DefineControl IPAddress +!insertmacro __NSD_DefineControl NetAddress + + +!macro __NSD_OnControlEvent EVENT HWND FUNCTION + Push $0 + Push $1 + + StrCpy $1 "${HWND}" + + GetFunctionAddress $0 "${FUNCTION}" + nsDialogs::On${EVENT} $1 $0 + + Pop $1 + Pop $0 +!macroend + +!macro __NSD_DefineControlCallback EVENT + !define NSD_On${EVENT} `!insertmacro __NSD_OnControlEvent ${EVENT} ` +!macroend + +!macro __NSD_OnDialogEvent EVENT FUNCTION + Push $0 + + GetFunctionAddress $0 "${FUNCTION}" + nsDialogs::On${EVENT} $0 + + Pop $0 +!macroend + +!macro __NSD_DefineDialogCallback EVENT + !define NSD_On${EVENT} `!insertmacro __NSD_OnDialogEvent ${EVENT} ` +!macroend +!insertmacro __NSD_DefineControlCallback Click +!insertmacro __NSD_DefineControlCallback Change +!insertmacro __NSD_DefineControlCallback Notify +!insertmacro __NSD_DefineDialogCallback Back + +!define NSD_Return "!insertmacro NSD_Return " +!macro NSD_Return val +StrCpy $_OUTDIR ${val} +SetSilent silent +Return +!macroend + + +!define __NSD_MkCtlCmd "!insertmacro __NSD_MkCtlCmd " +!macro __NSD_MkCtlCmd msg wp lp hCtl +SendMessage ${hCtl} ${${msg}} ${wp} ${lp} +!macroend +!define __NSD_MkCtlCmd_WP "!insertmacro __NSD_MkCtlCmd_WP " +!macro __NSD_MkCtlCmd_WP msg lp hCtl wp +SendMessage ${hCtl} ${${msg}} ${wp} ${lp} +!macroend +!define __NSD_MkCtlCmd_LP "!insertmacro __NSD_MkCtlCmd_LP " +!macro __NSD_MkCtlCmd_LP msg wp hCtl lp +SendMessage ${hCtl} ${${msg}} ${wp} ${lp} +!macroend +!define __NSD_MkCtlCmd_WPLP "!insertmacro __NSD_MkCtlCmd_WPLP " +!macro __NSD_MkCtlCmd_WPLP msg hCtl wp lp +SendMessage ${hCtl} ${${msg}} ${wp} ${lp} +!macroend +!define __NSD_MkCtlCmd_RV "!insertmacro __NSD_MkCtlCmd_RV " +!macro __NSD_MkCtlCmd_RV msg wp lp hCtl VAR +SendMessage ${hCtl} ${${msg}} ${wp} ${lp} ${VAR} +!macroend + + +!define NSD_InitCommonControlsEx "!insertmacro __NSD_InitCommonControlsEx " +!macro __NSD_InitCommonControlsEx ICC +!pragma warning push +!pragma warning disable 7070 ; Invalid number +!if ${ICC} <> 0 +!define /ReDef /IntFmt NSD_InitCommonControlsEx_TEMP "0x%X" ${ICC} +System::Call 'COMCTL32::InitCommonControlsEx(*l${NSD_InitCommonControlsEx_TEMP}00000008)' +!undef NSD_InitCommonControlsEx_TEMP +!else +System::Int64Op ${ICC} << 32 +System::Int64Op 8 | +System::Call 'COMCTL32::InitCommonControlsEx(*ls)' ; INITCOMMONCONTROLSEX as UINT64 +!endif +!pragma warning pop +!macroend +!define NSD_InitCommonControl_IPAddress `${NSD_InitCommonControlsEx} ${ICC_INTERNET_CLASSES}` +!define NSD_InitCommonControl_NetAddress `System::Call SHELL32::InitNetworkAddressControl()i` +!define NSD_InitCommonControl_SysLink `${NSD_InitCommonControlsEx} ${ICC_LINK_CLASS}` + + +!define NSD_CreateTimer `!insertmacro _NSD_CreateTimer ` +!macro _NSD_CreateTimer FUNCTION INTERVAL + Push $0 + + GetFunctionAddress $0 "${FUNCTION}" + nsDialogs::CreateTimer $0 "${INTERVAL}" + + Pop $0 +!macroend + + +!define NSD_KillTimer `!insertmacro _NSD_KillTimer ` +!macro _NSD_KillTimer FUNCTION + Push $0 + + GetFunctionAddress $0 "${FUNCTION}" + nsDialogs::KillTimer $0 + + Pop $0 +!macroend + + +!define NSD_AddStyle "!insertmacro _NSD_GWLAddFlags ${GWL_STYLE} " +!define NSD_AddExStyle "!insertmacro _NSD_GWLAddFlags ${GWL_EXSTYLE} " +!macro _NSD_GWLAddFlags GWL HWND DATA + System::Call "user32::GetWindowLong(p${HWND},i${GWL})p.s" + System::Int64Op "${DATA}" | + System::Call "user32::SetWindowLong(p${HWND},p${GWL},ps)" +!macroend + +!define NSD_RemoveStyle "!insertmacro _NSD_GWLRemoveFlags ${GWL_STYLE} " +!define NSD_RemoveExStyle "!insertmacro _NSD_GWLRemoveFlags ${GWL_EXSTYLE} " +!macro _NSD_GWLRemoveFlags GWL HWND DATA +System::Call "user32::GetWindowLong(p${HWND},i${GWL})p.s" +System::Int64Op "${DATA}" ~ & ; Perform ~ and prepare the stack for & +System::Int64Op ; Perform & +System::Call "user32::SetWindowLong(p${HWND},i${GWL},ps)" +!macroend + +!define NSD_GetStyle "!insertmacro _NSD_GWLGetFlags ${GWL_STYLE} " +!define NSD_GetExStyle "!insertmacro _NSD_GWLGetFlags ${GWL_EXSTYLE} " +!macro _NSD_GWLGetFlags GWL HWND RET +System::Call "user32::GetWindowLong(p${HWND},i${GWL})p.s" +Pop ${RET} +!macroend + +!macro __NSD_GetStyleBit GWL BIT HWND RET +!insertmacro _NSD_GWLGetFlags ${GWL} ${HWND} ${RET} +IntOp ${RET} ${RET} & ${BIT} +!macroend + + +!define NSD_SetFocus `!insertmacro __NSD_SetFocus ` +!macro __NSD_SetFocus HWND + System::Call "user32::SetFocus(p${HWND})" +!macroend + + +!define NSD_GetText "!insertmacro __NSD_GetText " +!macro __NSD_GetText CONTROL VAR + System::Call user32::GetWindowText(p${CONTROL},t.s,i${NSIS_MAX_STRLEN}) + Pop ${VAR} +!macroend + + +!define NSD_SetText "!insertmacro __NSD_SetText " +!macro __NSD_SetText CONTROL TEXT + SendMessage ${CONTROL} ${WM_SETTEXT} 0 `STR:${TEXT}` +!macroend + + +### Edit ### + +!define NSD_Edit_GetTextLimit `${__NSD_MkCtlCmd_RV} EM_GETLIMITTEXT 0 0 ` +!define NSD_Edit_SetTextLimit `${__NSD_MkCtlCmd_WP} EM_SETLIMITTEXT 0 ` +!define NSD_Edit_SetPasswordChar `${__NSD_MkCtlCmd_WP} EM_SETPASSWORDCHAR 0 ` +!define NSD_Edit_GetReadOnly `!insertmacro __NSD_GetStyleBit ${GWL_STYLE} ${ES_READONLY} ` ; Non-zero if read-only +!define NSD_Edit_SetReadOnly `${__NSD_MkCtlCmd_WP} EM_SETREADONLY 0 ` ; Toggles the ES_READONLY style +!define NSD_Edit_GetModify `${__NSD_MkCtlCmd_RV} EM_GETMODIFY 0 0 ` +!define NSD_Edit_SetModify `${__NSD_MkCtlCmd_WP} EM_SETMODIFY 0 ` +!define NSD_Edit_EmptyUndoBuffer `${__NSD_MkCtlCmd} EM_EMPTYUNDOBUFFER 0 0 ` +!define NSD_Edit_CanUndo `${__NSD_MkCtlCmd_RV} EM_CANUNDO 0 0 ` +!define NSD_Edit_ScrollCaret `${__NSD_MkCtlCmd} EM_SCROLLCARET 0 0 ` +!define NSD_Edit_LineScroll `${__NSD_MkCtlCmd_WPLP} EM_LINESCROLL ` +!define NSD_Edit_SetSel `${__NSD_MkCtlCmd_WPLP} EM_SETSEL ` ; WP:Start LP:End + +!define NSD_Edit_SetCueBannerText "!insertmacro __NSD_Edit_SetCueBannerText " ; CC6+ +!macro __NSD_Edit_SetCueBannerText CONTROL SHOWWHENFOCUSED TEXT +!if ${NSIS_CHAR_SIZE} > 1 + SendMessage ${CONTROL} ${EM_SETCUEBANNER} ${SHOWWHENFOCUSED} `STR:${TEXT}` +!else + System::Call 'USER32::SendMessage(p${CONTROL},i${EM_SETCUEBANNER},p${SHOWWHENFOCUSED},ws)' `${TEXT}` ; Must be PWSTR +!endif +!macroend + +!define NSD_Edit_GetLineCount `${__NSD_MkCtlCmd_RV} EM_GETLINECOUNT 0 0 ` +!define NSD_Edit_GetLine "!insertmacro __NSD_Edit_GetLine " +!macro __NSD_Edit_GetLine CONTROL LINEINDEX OUTPUT + System::Call '*(&i2 ${NSIS_MAX_STRLEN},&t${NSIS_MAX_STRLEN})p.s' + System::Call 'USER32::SendMessage(p${CONTROL},i${EM_GETLINE},p${LINEINDEX},pss)' + System::Call 'KERNEL32::lstrcpyn(t.s,pss,i${NSIS_MAX_STRLEN})' + Pop ${OUTPUT} + System::Free +!macroend + +!define NSD_SetTextLimit `${NSD_Edit_SetTextLimit} ` ; Legacy alias + + +### RichEdit ### + +!define NSD_RichEd_SetTextLimit `${__NSD_MkCtlCmd_LP} EM_EXLIMITTEXT 0 ` +!define NSD_RichEd_GetEventMask `${__NSD_MkCtlCmd_RV} EM_GETEVENTMASK 0 0 ` +!define NSD_RichEd_SetEventMask `${__NSD_MkCtlCmd_LP} EM_SETEVENTMASK 0 ` ; LP:ENM_* +!define NSD_RichEd_SetSystemBackgroundColor `${__NSD_MkCtlCmd} EM_SETBKGNDCOLOR 1 0 ` ; COLOR_WINDOW +!define NSD_RichEd_SetCustomBackgroundColor `${__NSD_MkCtlCmd_LP} EM_SETBKGNDCOLOR 0 ` ; LP:COLORREF +!define NSD_RichEd_SetHideSelection `${__NSD_MkCtlCmd_WP} EM_HIDESELECTION 0 ` ; WP(BOOL):HideSelWithoutFocus (Toggles ES_NOHIDESEL & TXTBIT_HIDESELECTION) + + +### CheckBox ### + +!define NSD_GetState `!insertmacro __NSD_GetState ` +!macro __NSD_GetState CONTROL VAR + SendMessage ${CONTROL} ${BM_GETCHECK} 0 0 ${VAR} +!macroend + + +!define NSD_SetState `!insertmacro __NSD_SetState ` +!macro __NSD_SetState CONTROL STATE + SendMessage ${CONTROL} ${BM_SETCHECK} ${STATE} 0 +!macroend + +!define NSD_Check `!insertmacro __NSD_Check ` +!macro __NSD_Check CONTROL + ${NSD_SetState} ${CONTROL} ${BST_CHECKED} +!macroend + + +!define NSD_Uncheck `!insertmacro __NSD_Uncheck ` +!macro __NSD_Uncheck CONTROL + ${NSD_SetState} ${CONTROL} ${BST_UNCHECKED} +!macroend + +!define NSD_GetChecked `!insertmacro __NSD_GetState ` +!define NSD_SetChecked `!insertmacro __NSD_SetState ` + + +### ComboBox ### + +!define NSD_CB_AddString "!insertmacro _NSD_CB_AddString " +!macro _NSD_CB_AddString CONTROL STRING + SendMessage ${CONTROL} ${CB_ADDSTRING} 0 `STR:${STRING}` +!macroend + + +!define NSD_CB_InsertString "!insertmacro _NSD_CB_InsertString " +!macro _NSD_CB_InsertString CONTROL INDEX STRING +SendMessage ${CONTROL} ${CB_INSERTSTRING} ${INDEX} `STR:${STRING}` +!macroend + +!define NSD_CB_PrependString "!insertmacro _NSD_CB_PrependString " +!macro _NSD_CB_PrependString CONTROL STRING +SendMessage ${CONTROL} ${CB_INSERTSTRING} 0 `STR:${STRING}` +!macroend + +!define NSD_CB_AppendString "!insertmacro _NSD_CB_AppendString " +!macro _NSD_CB_AppendString CONTROL STRING +SendMessage ${CONTROL} ${CB_INSERTSTRING} -1 `STR:${STRING}` +!macroend + + +!define NSD_CB_SelectString "!insertmacro _NSD_CB_SelectString " +!macro _NSD_CB_SelectString CONTROL STRING + SendMessage ${CONTROL} ${CB_SELECTSTRING} -1 `STR:${STRING}` +!macroend + + +!define NSD_CB_GetSelectionIndex `!insertmacro __NSD_CB_GetSelectionIndex ` +!macro __NSD_CB_GetSelectionIndex CONTROL VAR + SendMessage ${CONTROL} ${CB_GETCURSEL} 0 0 ${VAR} +!macroend + + +!define NSD_CB_SetSelectionIndex `!insertmacro __NSD_CB_SetSelectionIndex ` +!macro __NSD_CB_SetSelectionIndex CONTROL INDEX + SendMessage ${CONTROL} ${CB_SETCURSEL} ${INDEX} 0 +!macroend + + +!define NSD_CB_GetItemData `!insertmacro __NSD_CB_GetItemData ` +!macro __NSD_CB_GetItemData CONTROL INDEX VAR +SendMessage ${CONTROL} ${CB_GETITEMDATA} ${INDEX} 0 ${VAR} +!macroend +!define NSD_CB_SetItemData `${__NSD_MkCtlCmd_WPLP} CB_SETITEMDATA ` ; Index Data + + +!define NSD_CB_DelItem `${__NSD_MkCtlCmd_WP} CB_DELETESTRING 0 ` +!define NSD_CB_LimitText `${__NSD_MkCtlCmd_WP} CB_LIMITTEXT 0 ` +!define /IfNDef NSD_CB_Clear `${__NSD_MkCtlCmd} CB_RESETCONTENT 0 0 ` +!define /IfNDef NSD_CB_GetCount `${__NSD_MkCtlCmd_RV} CB_GETCOUNT 0 0 ` +!ifndef NSD_CB_DelString +!define NSD_CB_DelString `!insertmacro __NSD_CB_DelString ` +!macro __NSD_CB_DelString CONTROL STRING + System::Call 'USER32::SendMessage(p${CONTROL},i${CB_FINDSTRINGEXACT},p-1,ts)p.s' `${STRING}` + System::Call 'USER32::SendMessage(p${CONTROL},i${CB_DELETESTRING},ps,p0)' +!macroend +!endif +;define /IfNDef NSD_CB_GetSelection + + +### ListBox ### + +!define NSD_LB_AddString "!insertmacro _NSD_LB_AddString " +!macro _NSD_LB_AddString CONTROL STRING + SendMessage ${CONTROL} ${LB_ADDSTRING} 0 `STR:${STRING}` +!macroend + + +!define NSD_LB_InsertString "!insertmacro _NSD_LB_InsertString " +!macro _NSD_LB_InsertString CONTROL INDEX STRING +SendMessage ${CONTROL} ${LB_INSERTSTRING} ${INDEX} `STR:${STRING}` +!macroend + +!define NSD_LB_PrependString "!insertmacro _NSD_LB_PrependString " +!macro _NSD_LB_PrependString CONTROL STRING +SendMessage ${CONTROL} ${LB_INSERTSTRING} 0 `STR:${STRING}` +!macroend + +!define NSD_LB_AppendString "!insertmacro _NSD_LB_AppendString " +!macro _NSD_LB_AppendString CONTROL STRING +SendMessage ${CONTROL} ${LB_INSERTSTRING} -1 `STR:${STRING}` +!macroend + + +!define NSD_LB_DelString `!insertmacro __NSD_LB_DelString ` +!macro __NSD_LB_DelString CONTROL STRING + System::Call 'USER32::SendMessage(p${CONTROL},i${LB_FINDSTRINGEXACT},p-1,ts)p.s' `${STRING}` + System::Call 'USER32::SendMessage(p${CONTROL},i${LB_DELETESTRING},ps,p0)' +!macroend + + +!define NSD_LB_DelItem "!insertmacro __NSD_LB_DelItem " +!macro __NSD_LB_DelItem CONTROL INDEX + SendMessage ${CONTROL} ${LB_DELETESTRING} ${INDEX} 0 +!macroend + + +!define NSD_LB_Clear `${__NSD_MkCtlCmd} LB_RESETCONTENT 0 0 ` + + +!define NSD_LB_GetCount `!insertmacro __NSD_LB_GetCount ` +!macro __NSD_LB_GetCount CONTROL VAR + SendMessage ${CONTROL} ${LB_GETCOUNT} 0 0 ${VAR} +!macroend + + +!define NSD_LB_SelectString "!insertmacro _NSD_LB_SelectString " +!macro _NSD_LB_SelectString CONTROL STRING + SendMessage ${CONTROL} ${LB_SELECTSTRING} -1 `STR:${STRING}` +!macroend + + +!define NSD_LB_GetSelection `!insertmacro __NSD_LB_GetSelection ` +!macro __NSD_LB_GetSelection CONTROL VAR + SendMessage ${CONTROL} ${LB_GETCURSEL} 0 0 ${VAR} + System::Call 'user32::SendMessage(p ${CONTROL}, i ${LB_GETTEXT}, p ${VAR}, t .s)' + Pop ${VAR} +!macroend + + +!define NSD_LB_GetSelectionIndex `!insertmacro __NSD_LB_GetSelectionIndex ` +!macro __NSD_LB_GetSelectionIndex CONTROL VAR + SendMessage ${CONTROL} ${LB_GETCURSEL} 0 0 ${VAR} +!macroend + + +!define NSD_LB_SetSelectionIndex `!insertmacro __NSD_LB_SetSelectionIndex ` +!macro __NSD_LB_SetSelectionIndex CONTROL INDEX + SendMessage ${CONTROL} ${LB_SETCURSEL} ${INDEX} 0 +!macroend + + +!define NSD_LB_GetSelectionCount `!insertmacro __NSD_LB_GetSelectionCount ` +!macro __NSD_LB_GetSelectionCount CONTROL VAR + SendMessage ${CONTROL} ${LB_GETSELCOUNT} 0 0 ${VAR} +!macroend + + +!define NSD_LB_GetItemText `!insertmacro __NSD_LB_GetItemText ` +!macro __NSD_LB_GetItemText CONTROL INDEX VAR + System::Call 'user32::SendMessage(p${CONTROL}, i${LB_GETTEXT}, p${INDEX}, t.s)' + Pop ${VAR} +!macroend + + +!define NSD_LB_GetItemData `!insertmacro __NSD_LB_GetItemData ` +!macro __NSD_LB_GetItemData CONTROL INDEX VAR +SendMessage ${CONTROL} ${LB_GETITEMDATA} ${INDEX} 0 ${VAR} +!macroend +!define NSD_LB_SetItemData `${__NSD_MkCtlCmd_WPLP} LB_SETITEMDATA ` ; Index Data + + +!define NSD_LB_FindStringPrefix `!insertmacro __NSD_LB_FindStringPrefix ` +!macro __NSD_LB_FindStringPrefix CONTROL STRING VAR + SendMessage ${CONTROL} ${LB_FINDSTRING} -1 `STR:${STRING}` ${VAR} +!macroend + + +!define NSD_LB_FindStringExact `!insertmacro __NSD_LB_FindStringExact ` +!macro __NSD_LB_FindStringExact CONTROL STRING VAR + SendMessage ${CONTROL} ${LB_FINDSTRINGEXACT} -1 `STR:${STRING}` ${VAR} +!macroend + + +### ProgressBar ### + +!define NSD_ProgressBar_SetPos `${__NSD_MkCtlCmd_WP} PBM_SETPOS 0 ` +!define NSD_ProgressBar_SetStep `${__NSD_MkCtlCmd_WP} PBM_SETSTEP 0 ` +!define NSD_ProgressBar_StepIt `${__NSD_MkCtlCmd} PBM_STEPIT 0 0 ` +!define NSD_ProgressBar_AdvanceBy `${__NSD_MkCtlCmd_WP} PBM_DELTAPOS 0 ` +!define NSD_ProgressBar_SetPackedRange `${__NSD_MkCtlCmd_LP} PBM_SETRANGE 0 ` ; LP(DWORD):MAKELONG(min,max) +!define NSD_ProgressBar_SetRange32 `${__NSD_MkCtlCmd_WPLP} PBM_SETRANGE32 ` ; [IE3+] WP:min LP:max +!define NSD_ProgressBar_GetPos `${__NSD_MkCtlCmd_RV} PBM_GETPOS 0 0 ` ; [IE3+] + + +### Animation ### + +!define NSD_Anim_Close `${__NSD_MkCtlCmd} ACM_OPEN 0 0 ` +!define NSD_Anim_Play `${__NSD_MkCtlCmd} ACM_PLAY -1 0xFFFF0000 ` +!define NSD_Anim_PlayLoops `${__NSD_MkCtlCmd_WP} ACM_PLAY 0xFFFF0000 ` ; WP(UINT16):LoopCount +!define NSD_Anim_Stop `${__NSD_MkCtlCmd} ACM_STOP 0 0 ` +!define NSD_Anim_IsPlaying `${__NSD_MkCtlCmd_RV} ACM_ISPLAYING 0 0 ` + +!define NSD_Anim_OpenFile `!insertmacro __NSD_Anim_OpenFile ` +!macro __NSD_Anim_OpenFile CONTROL PATH + SendMessage ${CONTROL} ${ACM_OPEN} 0 "STR:${PATH}" +!macroend + +!define NSD_Anim_OpenResource `!insertmacro __NSD_Anim_OpenResource ` +!macro __NSD_Anim_OpenResource CONTROL HINSTANCE_CC471 RESID + SendMessage ${CONTROL} ${ACM_OPEN} "${HINSTANCE_CC471}" "${RESID}" +!macroend + + +### TrackBar ### + +!define NSD_TrackBar_GetPos `${__NSD_MkCtlCmd_RV} TBM_GETPOS 0 0 ` +!define NSD_TrackBar_SetPos `${__NSD_MkCtlCmd_LP} TBM_SETPOS 1 ` +!define NSD_TrackBar_SetRangeMin `${__NSD_MkCtlCmd_LP} TBM_SETRANGEMIN 1 ` +!define NSD_TrackBar_SetRangeMax `${__NSD_MkCtlCmd_LP} TBM_SETRANGEMAX 1 ` +!define NSD_TrackBar_GetLineSize `${__NSD_MkCtlCmd_RV} TBM_GETLINESIZE 0 0 ` +!define NSD_TrackBar_SetLineSize `${__NSD_MkCtlCmd_LP} TBM_SETLINESIZE 0 ` +!define NSD_TrackBar_GetPageSize `${__NSD_MkCtlCmd_RV} TBM_GETPAGESIZE 0 0 ` +!define NSD_TrackBar_SetPageSize `${__NSD_MkCtlCmd_LP} TBM_SETPAGESIZE 0 ` +!define NSD_TrackBar_ClearTics `${__NSD_MkCtlCmd} TBM_CLEARTICS 0 0 ` +!define NSD_TrackBar_GetNumTics `${__NSD_MkCtlCmd_RV} TBM_GETNUMTICS 0 0 ` +!define NSD_TrackBar_SetTic `${__NSD_MkCtlCmd_LP} TBM_SETTIC 0 ` +!define NSD_TrackBar_SetTicFreq `${__NSD_MkCtlCmd_WP} TBM_SETTICFREQ 0 ` +!define NSD_TrackBar_GetThumbLength `${__NSD_MkCtlCmd_RV} TBM_GETTHUMBLENGTH 0 0 ` +!define NSD_TrackBar_SetBuddy `${__NSD_MkCtlCmd_WPLP} TBM_SETBUDDY ` ; WP(BOOL):Left/Right LP:HWND + + +### UpDown ### + +!define NSD_UD_SetBuddy `${__NSD_MkCtlCmd_WP} UDM_SETBUDDY 0 ` +!define NSD_UD_GetPos `${__NSD_MkCtlCmd_RV} UDM_GETPOS 0 0 ` +!define NSD_UD_SetPos `${__NSD_MkCtlCmd_LP} UDM_SETPOS 0 ` +!define NSD_UD_GetPackedRange `${__NSD_MkCtlCmd_RV} UDM_GETRANGE 0 0 ` +!define NSD_UD_SetPackedRange `${__NSD_MkCtlCmd_LP} UDM_SETRANGE 0 ` ; LP(DWORD):MAKELONG(min,max) +!define NSD_UD_GetPos32 `${__NSD_MkCtlCmd_RV} UDM_GETPOS32 0 0 ` +!define NSD_UD_SetPos32 `${__NSD_MkCtlCmd_LP} UDM_SETPOS32 0 ` +!define NSD_UD_SetRange32 `${__NSD_MkCtlCmd_WPLP} UDM_SETRANGE32 ` ; WP(INT32):min LP(INT32):max + +!define NSD_UD_GetRange32 `!insertmacro __NSD_UD_GetRange32 ` +!macro __NSD_UD_GetRange32 CONTROL OUTLO OUTHI + System::Call 'USER32::SendMessage(p${CONTROL},i${UDM_GETRANGE32},*i.s,*i.s)' + Pop ${OUTLO} + Pop ${OUTHI} +!macroend + +!define NSD_UD_SetStaticRange `!insertmacro __NSD_UD_SetStaticRange ` +!macro __NSD_UD_SetStaticRange CONTROL MI MA + !define /redef /math MI ${MI} << 16 + !define /redef /math MA ${MA} & 0xffff + !define /redef /math MA ${MI} | ${MA} + SendMessage ${CONTROL} ${UDM_SETRANGE} 0 ${MA} +!macroend + + +### HotKey ### + +!define NSD_HK_GetHotKey `${__NSD_MkCtlCmd_RV} HKM_GETHOTKEY 0 0 ` ; RV(WORD):MAKEWORD(VK,HOTKEYF) +!define NSD_HK_SetHotKey `${__NSD_MkCtlCmd_WP} HKM_SETHOTKEY 0 ` +!define NSD_HK_SetRules `${__NSD_MkCtlCmd_WPLP} HKM_SETRULES ` + + +### IP Address ### + +!define NSD_IPAddress_Clear `${__NSD_MkCtlCmd} IPM_CLEARADDRESS 0 0 ` +!define NSD_IPAddress_SetPackedIPv4 `${__NSD_MkCtlCmd_LP} IPM_SETADDRESS 0 ` +!define NSD_IPAddress_IsBlank `${__NSD_MkCtlCmd_RV} IPM_ISBLANK 0 0 ` + +!define NSD_IPAddress_GetPackedIPv4 `!insertmacro __NSD_IPAddress_GetPackedIPv4 ` +!macro __NSD_IPAddress_GetPackedIPv4 CONTROL VAR +System::Call 'USER32::SendMessage(p${CONTROL},i${IPM_GETADDRESS},p0,*i0s)' +Pop ${VAR} +!macroend + + +### Date ### +!define NSD_Date_GetDateFields `!insertmacro __NSD_Date_GetDateFields ` +!macro __NSD_Date_GetDateFields CONTROL +Push $0 +System::Call 'USER32::SendMessage(p${CONTROL},i${DTM_GETSYSTEMTIME},p0,@r0)' +System::Call '*$0(&i2.s,&i2.s,&i2,&i2.s)' +Exch 3 +Pop $0 +!macroend + +!define NSD_Time_GetTimeFields `!insertmacro __NSD_Time_GetTimeFields ` +!macro __NSD_Time_GetTimeFields CONTROL +Push $0 +System::Call 'USER32::SendMessage(p${CONTROL},i${DTM_GETSYSTEMTIME},p0,@r0)' +System::Call '*$0(&i2,&i2,&i2,&i2,&i2.s,&i2.s,&i2.s)' +Exch 3 +Pop $0 +Exch +!macroend + + +### Static ### + +!macro __NSD_LoadAndSetImage _LIHINSTMODE _IMGTYPE _LIHINSTSRC _LIFLAGS CONTROL IMAGE HANDLE + !if "${_LIHINSTMODE}" == "exeresource" + LoadAndSetImage /EXERESOURCE /STRINGID "${CONTROL}" ${_IMGTYPE} ${_LIFLAGS} "${IMAGE}" ${HANDLE} + !else #if "${_LIHINSTMODE}" == "file" + LoadAndSetImage /STRINGID "${CONTROL}" ${_IMGTYPE} ${_LIFLAGS} "${IMAGE}" ${HANDLE} + !endif +!macroend + +!macro __NSD_SetIconFromExeResource CONTROL IMAGE HANDLE + LoadAndSetImage /EXERESOURCE /STRINGID "${CONTROL}" ${IMAGE_ICON} ${LR_DEFAULTSIZE} "${IMAGE}" ${HANDLE} +!macroend + +!macro __NSD_SetIconFromInstaller CONTROL HANDLE + LoadAndSetImage /EXERESOURCE "${CONTROL}" ${IMAGE_ICON} ${LR_DEFAULTSIZE} 103 ${HANDLE} +!macroend + +!define NSD_SetImage `!insertmacro __NSD_LoadAndSetImage file ${IMAGE_BITMAP} 0 "${LR_LOADFROMFILE}" ` +!define NSD_SetBitmap `${NSD_SetImage} ` + +!define NSD_SetIcon `!insertmacro __NSD_LoadAndSetImage file ${IMAGE_ICON} 0 "${LR_LOADFROMFILE}|${LR_DEFAULTSIZE}" ` +!define NSD_SetIconFromExeResource `!insertmacro __NSD_SetIconFromExeResource ` +!define NSD_SetIconFromInstaller `!insertmacro __NSD_SetIconFromInstaller ` + + +!define NSD_SetStretchedImage `!insertmacro __NSD_SetStretchedImage ` +!define NSD_SetStretchedBitmap `!insertmacro __NSD_SetStretchedImage ` +!macro __NSD_SetStretchedImage CONTROL IMAGE HANDLE + LoadAndSetImage /STRINGID /RESIZETOFIT "${CONTROL}" ${IMAGE_BITMAP} ${LR_LOADFROMFILE} "${IMAGE}" ${HANDLE} +!macroend + + +!define NSD_FreeImage `!insertmacro __NSD_FreeImage ` +!define NSD_FreeBitmap `${NSD_FreeImage} ` +!macro __NSD_FreeImage IMAGE + ${If} ${IMAGE} P<> 0 + System::Call gdi32::DeleteObject(ps) ${IMAGE} + ${EndIf} +!macroend + + +!define NSD_FreeIcon `!insertmacro __NSD_FreeIcon ` +!macro __NSD_FreeIcon IMAGE + System::Call user32::DestroyIcon(ps) ${IMAGE} +!macroend + + +!define NSD_ClearImage `!insertmacro __NSD_ClearImage ${IMAGE_BITMAP} ` +!define NSD_ClearBitmap `${NSD_ClearImage} ` +!define NSD_ClearIcon `!insertmacro __NSD_ClearImage ${IMAGE_ICON} ` +!macro __NSD_ClearImage _IMGTYPE CONTROL + SendMessage ${CONTROL} ${STM_SETIMAGE} ${_IMGTYPE} 0 +!macroend + + +### INI ### + +!define /IfNDef NSD_Debug `System::Call kernel32::OutputDebugString(ts)` + +!macro __NSD_ControlCase TYPE + ${Case} ${TYPE} + ${NSD_Create${TYPE}} $R3u $R4u $R5u $R6u $R7 + Pop $R9 + ${Break} +!macroend + +!macro __NSD_ControlCaseEx TYPE + ${Case} ${TYPE} + Call ${TYPE} + ${Break} +!macroend + +!macro NSD_FUNCTION_INIFILE + !insertmacro NSD_INIFILE "" +!macroend + +!macro NSD_UNFUNCTION_INIFILE + !insertmacro NSD_INIFILE un. +!macroend + +!macro NSD_INIFILE UNINSTALLER_FUNCPREFIX + + ;Functions to create dialogs based on old InstallOptions INI files + + Function ${UNINSTALLER_FUNCPREFIX}CreateDialogFromINI + + # $0 = ini + + ReadINIStr $R0 $0 Settings RECT + ${If} $R0 == "" + StrCpy $R0 1018 + ${EndIf} + + nsDialogs::Create $R0 + Pop $R9 + + ReadINIStr $R0 $0 Settings RTL + nsDialogs::SetRTL $R0 + + ReadINIStr $R0 $0 Settings NumFields + + ${NSD_Debug} "NumFields = $R0" + + ${For} $R1 1 $R0 + ${NSD_Debug} "Creating field $R1" + ReadINIStr $R2 $0 "Field $R1" Type + ${NSD_Debug} " Type = $R2" + ReadINIStr $R3 $0 "Field $R1" Left + ${NSD_Debug} " Left = $R3" + ReadINIStr $R4 $0 "Field $R1" Top + ${NSD_Debug} " Top = $R4" + ReadINIStr $R5 $0 "Field $R1" Right + ${NSD_Debug} " Right = $R5" + ReadINIStr $R6 $0 "Field $R1" Bottom + ${NSD_Debug} " Bottom = $R6" + IntOp $R5 $R5 - $R3 + ${NSD_Debug} " Width = $R5" + IntOp $R6 $R6 - $R4 + ${NSD_Debug} " Height = $R6" + ReadINIStr $R7 $0 "Field $R1" Text + ${NSD_Debug} " Text = $R7" + ${Switch} $R2 + !insertmacro __NSD_ControlCase HLine + !insertmacro __NSD_ControlCase VLine + !insertmacro __NSD_ControlCase Label + !insertmacro __NSD_ControlCase Icon + !insertmacro __NSD_ControlCase Bitmap + !insertmacro __NSD_ControlCaseEx Link + !insertmacro __NSD_ControlCase Button + !insertmacro __NSD_ControlCase GroupBox + !insertmacro __NSD_ControlCase CheckBox + !insertmacro __NSD_ControlCase RadioButton + !insertmacro __NSD_ControlCase Text + !insertmacro __NSD_ControlCase Password + !insertmacro __NSD_ControlCaseEx FileRequest + !insertmacro __NSD_ControlCaseEx DirRequest + !insertmacro __NSD_ControlCase ComboBox + !insertmacro __NSD_ControlCase DropList + !insertmacro __NSD_ControlCase ListBox + ${EndSwitch} + + WriteINIStr $0 "Field $R1" HWND $R9 + ${Next} + + nsDialogs::Show + + FunctionEnd + + Function ${UNINSTALLER_FUNCPREFIX}UpdateINIState + + ${NSD_Debug} "Updating INI state" + + ReadINIStr $R0 $0 Settings NumFields + + ${NSD_Debug} "NumField = $R0" + + ${For} $R1 1 $R0 + ReadINIStr $R2 $0 "Field $R1" HWND + ReadINIStr $R3 $0 "Field $R1" "Type" + ${Switch} $R3 + ${Case} "CheckBox" + ${Case} "RadioButton" + ${NSD_Debug} " HWND = $R2" + ${NSD_GetState} $R2 $R2 + ${NSD_Debug} " Window selection = $R2" + ${Break} + ${CaseElse} + ${NSD_Debug} " HWND = $R2" + ${NSD_GetText} $R2 $R2 + ${NSD_Debug} " Window text = $R2" + ${Break} + ${EndSwitch} + WriteINIStr $0 "Field $R1" STATE $R2 + ${Next} + + FunctionEnd + + Function ${UNINSTALLER_FUNCPREFIX}FileRequest + + IntOp $R5 $R5 - 15 + IntOp $R8 $R3 + $R5 + + ${NSD_CreateBrowseButton} $R8u $R4u 15u $R6u ... + Pop $R8 + + nsDialogs::SetUserData $R8 $R1 # remember field id + + WriteINIStr $0 "Field $R1" HWND2 $R8 + + ${NSD_OnClick} $R8 ${UNINSTALLER_FUNCPREFIX}OnFileBrowseButton + + ReadINIStr $R9 $0 "Field $R1" State + + ${NSD_CreateFileRequest} $R3u $R4u $R5u $R6u $R9 + Pop $R9 + + FunctionEnd + + Function ${UNINSTALLER_FUNCPREFIX}DirRequest + + IntOp $R5 $R5 - 15 + IntOp $R8 $R3 + $R5 + + ${NSD_CreateBrowseButton} $R8u $R4u 15u $R6u ... + Pop $R8 + + nsDialogs::SetUserData $R8 $R1 # remember field id + + WriteINIStr $0 "Field $R1" HWND2 $R8 + + ${NSD_OnClick} $R8 ${UNINSTALLER_FUNCPREFIX}OnDirBrowseButton + + ReadINIStr $R9 $0 "Field $R1" State + + ${NSD_CreateFileRequest} $R3u $R4u $R5u $R6u $R9 + Pop $R9 + + FunctionEnd + + Function ${UNINSTALLER_FUNCPREFIX}OnFileBrowseButton + + Pop $R0 + + nsDialogs::GetUserData $R0 + Pop $R1 + + ReadINIStr $R2 $0 "Field $R1" HWND + ReadINIStr $R4 $0 "Field $R1" Filter + + ${NSD_GetText} $R2 $R3 + + nsDialogs::SelectFileDialog save $R3 $R4 + Pop $R3 + + ${If} $R3 != "" + SendMessage $R2 ${WM_SETTEXT} 0 STR:$R3 + ${EndIf} + + FunctionEnd + + Function ${UNINSTALLER_FUNCPREFIX}OnDirBrowseButton + + Pop $R0 + + nsDialogs::GetUserData $R0 + Pop $R1 + + ReadINIStr $R2 $0 "Field $R1" HWND + ReadINIStr $R3 $0 "Field $R1" Text + + ${NSD_GetText} $R2 $R4 + + nsDialogs::SelectFolderDialog $R3 $R4 + Pop $R3 + + ${If} $R3 != error + SendMessage $R2 ${WM_SETTEXT} 0 STR:$R3 + ${EndIf} + + FunctionEnd + + Function ${UNINSTALLER_FUNCPREFIX}Link + + ${NSD_CreateLink} $R3u $R4u $R5u $R6u $R7 + Pop $R9 + + nsDialogs::SetUserData $R9 $R1 # remember field id + + ${NSD_OnClick} $R9 ${UNINSTALLER_FUNCPREFIX}OnLink + + FunctionEnd + + Function ${UNINSTALLER_FUNCPREFIX}OnLink + + Pop $R0 + + nsDialogs::GetUserData $R0 + Pop $R1 + + ReadINIStr $R1 $0 "Field $R1" STATE + + ExecShell "" $R1 + + FunctionEnd + +!macroend + +!verbose pop +!endif diff --git a/installer/tools/Plugins/x86-unicode/System.dll b/installer/tools/Plugins/x86-unicode/System.dll new file mode 100644 index 00000000..921bc86e Binary files /dev/null and b/installer/tools/Plugins/x86-unicode/System.dll differ diff --git a/installer/tools/Plugins/x86-unicode/nsDialogs.dll b/installer/tools/Plugins/x86-unicode/nsDialogs.dll new file mode 100644 index 00000000..90740b34 Binary files /dev/null and b/installer/tools/Plugins/x86-unicode/nsDialogs.dll differ diff --git a/installer/tools/Stubs/lzma-x86-unicode b/installer/tools/Stubs/lzma-x86-unicode new file mode 100644 index 00000000..df2860f7 Binary files /dev/null and b/installer/tools/Stubs/lzma-x86-unicode differ diff --git a/installer/tools/Stubs/uninst b/installer/tools/Stubs/uninst new file mode 100644 index 00000000..90d7d225 Binary files /dev/null and b/installer/tools/Stubs/uninst differ diff --git a/installer/tools/Stubs/zlib-x86-unicode b/installer/tools/Stubs/zlib-x86-unicode new file mode 100644 index 00000000..14b3b544 Binary files /dev/null and b/installer/tools/Stubs/zlib-x86-unicode differ diff --git a/installer/tools/makensis.exe b/installer/tools/makensis.exe new file mode 100644 index 00000000..20628c7e Binary files /dev/null and b/installer/tools/makensis.exe differ diff --git a/installer/tools/nsisconf.nsh b/installer/tools/nsisconf.nsh new file mode 100644 index 00000000..716522fa --- /dev/null +++ b/installer/tools/nsisconf.nsh @@ -0,0 +1,63 @@ +;------------------------ +;DEFAULT NSIS CONFIG FILE +;------------------------ + +;This header file will be included when compiling any NSIS installer, +;you can use it to add script code to every installer you compile. + +;This file is treated as if it is in the directory of your script. +;When using relative paths, the files have to be in your build directory. + +;------------------------ +;EXAMPLES +;------------------------ + +;Compress installer exehead with an executable compressor (such as UPX / Petite). + +;Paths should be absolute to allow building from any location. +;Note that your executable compressor should not compress the first icon. + +;!packhdr temp.dat '"C:\Program Files\upx\upx" -9 -q temp.dat' +;!packhdr temp.dat '"C:\Program Files\petite\petite" -9 -b0 -r** -p0 -y temp.dat' + +;------------------------ + +;Set default compressor + +SetCompressor lzma +; etCompressor bzip2 + +;------------------------ + +;Change the default icons + +;Icon "${NSISDIR}\Contrib\Graphics\Icons\arrow-install.ico" +;UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\arrow-uninstall.ico" + +;------------------------ + +;Define symbols + +;!define COMPANYNAME "bla" + +;------------------------ +;MODERN UI +;------------------------ + +;The Modern UI will insert the MUI_NSISCONF macro just before processing the settings. +;Here you can set default settings for the Modern UI. + +;------------------------ + +!define MUI_INSERT_NSISCONF + +!macro MUI_NSISCONF + + ;Example: Change the default Modern UI icons + + ;!ifndef MUI_ICON & MUI_UNICON + ; !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\arrow-install.ico" + ; !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\arrow-uninstall.ico" + ;!endif + +!macroend \ No newline at end of file