Readme Page Based on MUI License Page: Difference between revisions
mNo edit summary |
mNo edit summary |
||
Line 233: | Line 233: | ||
#This notice may not be removed or altered from any distribution. | #This notice may not be removed or altered from any distribution. | ||
[[Category:Headers]] | [[Category:Headers]] | ||
[[Category:User Interface Functions]] | [[Category:User Interface Functions]] |
Latest revision as of 16:25, 25 July 2007
Author: Red Wine (talk, contrib) |
Description
Shows the user a readme page based on the MUI license page.
Use ${ReadmeLanguage} and ${Un.ReadmeLanguage} to define the strings for individual languages and use
MUI_PAGE_README and/or MUI_UNPAGE_README to show the page, just as you'd show any other MUI page.
A complete usage example is available below.
Note:
Header is tested and fully compatible with NSIS Modern User Interface (MUI).
Please don't ask me how to implement the header with 3rd party UIs.
The Header
# MUI_EXTRAPAGES.nsh # By Red Wine Jan 2007 !verbose push !verbose 3 !ifndef _MUI_EXTRAPAGES_NSH !define _MUI_EXTRAPAGES_NSH !ifmacrondef MUI_EXTRAPAGE_README & MUI_PAGE_README & MUI_UNPAGE_README & ReadmeLangStrings !macro MUI_EXTRAPAGE_README UN ReadmeFile !verbose push !verbose 3 !define MUI_PAGE_HEADER_TEXT "$(${UN}ReadmeHeader)" !define MUI_PAGE_HEADER_SUBTEXT "$(${UN}ReadmeSubHeader)" !define MUI_LICENSEPAGE_TEXT_TOP "$(${UN}ReadmeTextTop)" !define MUI_LICENSEPAGE_TEXT_BOTTOM "$(${UN}ReadmeTextBottom)" !define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)" !insertmacro MUI_${UN}PAGE_LICENSE "${ReadmeFile}" !verbose pop !macroend !define ReadmeRun "!insertmacro MUI_EXTRAPAGE_README" !macro MUI_PAGE_README ReadmeFile !verbose push !verbose 3 ${ReadmeRun} "" "${ReadmeFile}" !verbose pop !macroend !macro MUI_UNPAGE_README ReadmeFile !verbose push !verbose 3 ${ReadmeRun} "UN" "${ReadmeFile}" !verbose pop !macroend !macro ReadmeLangStrings UN MUI_LANG ReadmeHeader ReadmeSubHeader ReadmeTextTop ReadmeTextBottom !verbose push !verbose 3 LangString ${UN}ReadmeHeader ${MUI_LANG} "${ReadmeHeader}" LangString ${UN}ReadmeSubHeader ${MUI_LANG} "${ReadmeSubHeader}" LangString ${UN}ReadmeTextTop ${MUI_LANG} "${ReadmeTextTop}" LangString ${UN}ReadmeTextBottom ${MUI_LANG} "${ReadmeTextBottom}" !verbose pop !macroend !define ReadmeLanguage `!insertmacro ReadmeLangStrings ""` !define Un.ReadmeLanguage `!insertmacro ReadmeLangStrings "UN"` !endif !endif !verbose pop
Usage Example
;NSIS Modern User Interface ;Welcome/Finish Page Example Script ;Written by Joost Verburg ;-------------------------------- ;Include Modern UI !include "MUI.nsh" ;-------------------------------- ;Énclude MUI_EXTRAPAGES header !include "MUI_EXTRAPAGES.nsh" ;-------------------------------- ;General ;Name and file Name "Modern UI Test" OutFile "WelcomeFinish.exe" ;Default installation folder InstallDir "$PROGRAMFILES\Modern UI Test" ;Get installation folder from registry if available InstallDirRegKey HKCU "Software\Modern UI Test" "" ;-------------------------------- ;Interface Settings !define MUI_ABORTWARNING ;-------------------------------- ;Installer Pages !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt" ;Add the install read me page !insertmacro MUI_PAGE_README "${NSISDIR}\Docs\Modern UI\Changelog.txt" !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH ;-------------------------------- ;Uninstaller Pages !insertmacro MUI_UNPAGE_WELCOME ;Add the uninstall read me page !insertmacro MUI_UNPAGE_README '${NSISDIR}\License.txt' !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_UNPAGE_FINISH ;-------------------------------- ;Languages ;Add 1st language !insertmacro MUI_LANGUAGE "English" ;Set up install lang strings for 1st lang ${ReadmeLanguage} "${LANG_ENGLISH}" \ "Read Me" \ "Please review the following important information." \ "About $(^name):" \ "$\n Click on scrollbar arrows or press Page Down to review the entire text." ;Set up uninstall lang strings for 1st lang ${Un.ReadmeLanguage} "${LANG_ENGLISH}" \ "Read Me" \ "Please review the following important Uninstall information." \ "About $(^name) Uninstall:" \ "$\n Click on scrollbar arrows or press Page Down to review the entire text." ;Add 2nd language !insertmacro MUI_LANGUAGE "Greek" ;set up install lang strings for second lang ${ReadmeLanguage} "${LANG_GREEK}" \ "Read Me" \ "Please review the following important information." \ "About $(^name):" \ "$\n Click on scrollbar arrows or press Page Down to review the entire text." ;set up uninstall lang strings for second lang ${Un.ReadmeLanguage} "${LANG_GREEK}" \ "Read Me" \ "Please review the following important Uninstall information." \ "About $(^name) Uninstall:" \ "$\n Click on scrollbar arrows or press Page Down to review the entire text." ;-------------------------------- ;Installer Sections Section "Dummy Section" SecDummy SetOutPath "$INSTDIR" ;ADD YOUR OWN FILES HERE... ;Store installation folder WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR ;Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" SectionEnd ;-------------------------------- ;Descriptions ;Language strings LangString DESC_SecDummy ${LANG_ENGLISH} "A test section." LangString DESC_SecDummy ${LANG_GREEK} "A test section." ;Assign language strings to sections !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy) !insertmacro MUI_FUNCTION_DESCRIPTION_END ;-------------------------------- ;Uninstaller Section Section "Uninstall" ;ADD YOUR OWN FILES HERE... Delete "$INSTDIR\Uninstall.exe" RMDir "$INSTDIR" DeleteRegKey /ifempty HKCU "Software\Modern UI Test" SectionEnd ;------------------------------- ;Functions Function .onInit !insertmacro MUI_LANGDLL_DISPLAY FunctionEnd Function un.onInit !insertmacro MUI_UNGETLANGUAGE FunctionEnd
License
This header file is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of this header file.
Permission is granted to anyone to use this header file for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
- The origin of this header file must not be misrepresented; you must not claim that you wrote the original header file. If you use this header file in a product, an acknowledgment in the product documentation would be appreciated but is not required.
- Altered versions must be plainly marked as such, and must not be misrepresented as being the original header file.
- This notice may not be removed or altered from any distribution.