remember previously selected sections

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4990 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2007-03-10 14:41:05 +00:00
parent f6849b6bec
commit 2969aa40fc
5 changed files with 666 additions and 49 deletions

77
Examples/Memento.nsi Normal file
View file

@ -0,0 +1,77 @@
!include LogicLib.nsh
!include Memento.nsh
Name Memento
OutFile Memento.exe
XPStyle on
ShowInstDetails show
Page components
Page instfiles
# settings
!define MEMENTO_REGISTRY_ROOT HKLM
!define MEMENTO_REGISTRY_KEY "Software\NSIS\Memento Test"
# restore
Function .onInit
${If} ${Cmd} `MessageBox MB_YESNO "Would you like to load an example state?" IDYES`
DeleteRegKey HKLM "Software\NSIS\Memento Test"
WriteRegStr HKLM "Software\NSIS\Memento Test" MementoSectionUsed ""
WriteRegDWORD HKLM "Software\NSIS\Memento Test" MementoSection_sec_horse 1
WriteRegDWORD HKLM "Software\NSIS\Memento Test" MementoSection_sec_chicken 1
WriteRegDWORD HKLM "Software\NSIS\Memento Test" MementoSection_sec_donkey 0
WriteRegDWORD HKLM "Software\NSIS\Memento Test" MementoSection_sec_croc 0
${EndIf}
${MementoSectionRestore}
FunctionEnd
# sections
${MementoSection} horse sec_horse
${MementoSectionEnd}
${MementoSection} donkey sec_donkey
${MementoSectionEnd}
${MementoSection} chicken sec_chicken
${MementoSectionEnd}
SectionGroup /e group
SectionGroup /e group
${MementoSection} croc sec_croc
${MementoSectionEnd}
${MementoSection} cow sec_cow
${MementoSectionEnd}
SectionGroupEnd
SectionGroupEnd
${MementoUnselectedSection} dinosaur sec_dinosaur
${MementoSectionEnd}
# done...
${MementoSectionDone}
# save
Function .onInstSuccess
${MementoSectionSave}
FunctionEnd

View file

@ -11,6 +11,7 @@ examples = Split("""
LogicLib.nsi
makensis.ini
makensis.nsi
Memento.nsi
one-section.nsi
primes.nsi
rtest.nsi

View file

@ -31,6 +31,7 @@ RequestExecutionLevel admin
!include "MUI.nsh"
!include "Sections.nsh"
!include "LogicLib.nsh"
!include "Memento.nsh"
;--------------------------------
;Definitions
@ -45,6 +46,10 @@ RequestExecutionLevel admin
Name "NSIS"
Caption "NSIS ${VERSION} Setup"
;Memento Settings
!define MEMENTO_REGISTRY_ROOT HKLM
!define MEMENTO_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\NSIS"
;Interface Settings
!define MUI_ABORTWARNING
@ -97,7 +102,7 @@ Page custom PageReinstall PageLeaveReinstall
;--------------------------------
;Installer Sections
Section "NSIS Core Files (required)" SecCore
${MementoSection} "NSIS Core Files (required)" SecCore
SetDetailsPrint textonly
DetailPrint "Installing NSIS Core Files..."
@ -142,6 +147,7 @@ Section "NSIS Core Files (required)" SecCore
File ..\Include\WordFunc.nsh
File ..\Include\WinVer.nsh
File ..\Include\x64.nsh
File ..\Include\Memento.nsh
SetOutPath $INSTDIR\Docs\StrFunc
File ..\Docs\StrFunc\StrFunc.txt
@ -203,9 +209,9 @@ Section "NSIS Core Files (required)" SecCore
System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)'
SectionEnd
${MementoSectionEnd}
Section "Script Examples" SecExample
${MementoSection} "Script Examples" SecExample
SetDetailsPrint textonly
DetailPrint "Installing Script Examples..."
@ -240,17 +246,17 @@ Section "Script Examples" SecExample
File ..\Examples\WordFunc.nsi
File ..\Examples\WordFunc.ini
File ..\Examples\WordFuncTest.nsi
SectionEnd
${MementoSectionEnd}
!ifndef NO_STARTMENUSHORTCUTS
Section "Start Menu and Desktop Shortcuts" SecShortcuts
${MementoSection} "Start Menu and Desktop Shortcuts" SecShortcuts
SetDetailsPrint textonly
DetailPrint "Installing Start Menu and Desktop Shortcuts..."
SetDetailsPrint listonly
!else
Section "Desktop Shortcut" SecShortcuts
${MementoSection} "Desktop Shortcut" SecShortcuts
SetDetailsPrint textonly
DetailPrint "Installing Desktop Shortcut..."
@ -274,11 +280,11 @@ Section "Desktop Shortcut" SecShortcuts
CreateShortCut "$DESKTOP\Nullsoft Install System.lnk" "$INSTDIR\NSIS.exe"
SectionEnd
${MementoSectionEnd}
SectionGroup "User Interfaces" SecInterfaces
Section "Modern User Interface" SecInterfacesModernUI
${MementoSection} "Modern User Interface" SecInterfacesModernUI
SetDetailsPrint textonly
DetailPrint "Installing User Interfaces | Modern User Interface..."
@ -323,9 +329,9 @@ Section "Modern User Interface" SecInterfacesModernUI
SetOutPath $INSTDIR\Include
File "..\Include\MUI.nsh"
SectionEnd
${MementoSectionEnd}
Section "Default User Interface" SecInterfacesDefaultUI
${MementoSection} "Default User Interface" SecInterfacesDefaultUI
SetDetailsPrint textonly
DetailPrint "Installing User Interfaces | Default User Interface..."
@ -336,9 +342,9 @@ Section "Default User Interface" SecInterfacesDefaultUI
SetOutPath "$INSTDIR\Contrib\UIs"
File "..\Contrib\UIs\default.exe"
SectionEnd
${MementoSectionEnd}
Section "Tiny User Interface" SecInterfacesTinyUI
${MementoSection} "Tiny User Interface" SecInterfacesTinyUI
SetDetailsPrint textonly
DetailPrint "Installing User Interfaces | Tiny User Interface..."
@ -349,11 +355,11 @@ Section "Tiny User Interface" SecInterfacesTinyUI
SetOutPath "$INSTDIR\Contrib\UIs"
File "..\Contrib\UIs\sdbarker_tiny.exe"
SectionEnd
${MementoSectionEnd}
SectionGroupEnd
Section "Graphics" SecGraphics
${MementoSection} "Graphics" SecGraphics
SetDetailsPrint textonly
DetailPrint "Installing Graphics..."
@ -367,9 +373,9 @@ Section "Graphics" SecGraphics
SetOutPath $INSTDIR\Contrib\Graphics
File /r "..\Contrib\Graphics\*.ico"
File /r "..\Contrib\Graphics\*.bmp"
SectionEnd
${MementoSectionEnd}
Section "Language Files" SecLangFiles
${MementoSection} "Language Files" SecLangFiles
SetDetailsPrint textonly
DetailPrint "Installing Language Files..."
@ -389,11 +395,11 @@ Section "Language Files" SecLangFiles
File "..\Contrib\Modern UI\Language files\*.nsh"
nomui:
SectionEnd
${MementoSectionEnd}
SectionGroup "Tools" SecTools
Section "Zip2Exe" SecToolsZ2E
${MementoSection} "Zip2Exe" SecToolsZ2E
SetDetailsPrint textonly
DetailPrint "Installing Tools | Zip2Exe..."
@ -408,13 +414,13 @@ Section "Zip2Exe" SecToolsZ2E
File ..\Contrib\zip2exe\Modern.nsh
File ..\Contrib\zip2exe\Classic.nsh
SectionEnd
${MementoSectionEnd}
SectionGroupEnd
SectionGroup "Plug-ins" SecPluginsPlugins
Section "Banner" SecPluginsBanner
${MementoSection} "Banner" SecPluginsBanner
SetDetailsPrint textonly
DetailPrint "Installing Plug-ins | Banner..."
@ -428,9 +434,9 @@ Section "Banner" SecPluginsBanner
File ..\Docs\Banner\Readme.txt
SetOutPath $INSTDIR\Examples\Banner
File ..\Examples\Banner\Example.nsi
SectionEnd
${MementoSectionEnd}
Section "Language DLL" SecPluginsLangDLL
${MementoSection} "Language DLL" SecPluginsLangDLL
SetDetailsPrint textonly
DetailPrint "Installing Plug-ins | Language DLL..."
@ -439,9 +445,9 @@ Section "Language DLL" SecPluginsLangDLL
SectionIn 1
SetOutPath $INSTDIR\Plugins
File ..\Plugins\LangDLL.dll
SectionEnd
${MementoSectionEnd}
Section "nsExec" SecPluginsnsExec
${MementoSection} "nsExec" SecPluginsnsExec
SetDetailsPrint textonly
DetailPrint "Installing Plug-ins | nsExec..."
@ -455,9 +461,9 @@ Section "nsExec" SecPluginsnsExec
File ..\Docs\nsExec\nsExec.txt
SetOutPath $INSTDIR\Examples\nsExec
File ..\Examples\nsExec\test.nsi
SectionEnd
${MementoSectionEnd}
Section "Splash" SecPluginsSplash
${MementoSection} "Splash" SecPluginsSplash
SetDetailsPrint textonly
DetailPrint "Installing Plug-ins | Splash..."
@ -471,9 +477,9 @@ Section "Splash" SecPluginsSplash
File ..\Docs\Splash\splash.txt
SetOutPath $INSTDIR\Examples\Splash
File ..\Examples\Splash\Example.nsi
SectionEnd
${MementoSectionEnd}
Section "AdvSplash" SecPluginsSplashT
${MementoSection} "AdvSplash" SecPluginsSplashT
SetDetailsPrint textonly
DetailPrint "Installing Plug-ins | AdvSplash..."
@ -487,9 +493,9 @@ Section "AdvSplash" SecPluginsSplashT
File ..\Docs\AdvSplash\advsplash.txt
SetOutPath $INSTDIR\Examples\AdvSplash
File ..\Examples\AdvSplash\Example.nsi
SectionEnd
${MementoSectionEnd}
Section "BgImage" SecPluginsBgImage
${MementoSection} "BgImage" SecPluginsBgImage
SetDetailsPrint textonly
DetailPrint "Installing Plug-ins | BgImage..."
@ -503,9 +509,9 @@ Section "BgImage" SecPluginsBgImage
File ..\Docs\BgImage\BgImage.txt
SetOutPath $INSTDIR\Examples\BgImage
File ..\Examples\BgImage\Example.nsi
SectionEnd
${MementoSectionEnd}
Section "InstallOptions" SecPluginsIO
${MementoSection} "InstallOptions" SecPluginsIO
SetDetailsPrint textonly
DetailPrint "Installing Plug-ins | InstallOptions..."
@ -527,9 +533,9 @@ Section "InstallOptions" SecPluginsIO
File ..\Examples\InstallOptions\testlink.nsi
File ..\Examples\InstallOptions\testnotify.ini
File ..\Examples\InstallOptions\testnotify.nsi
SectionEnd
${MementoSectionEnd}
Section "Math" SecPluginsMath
${MementoSection} "Math" SecPluginsMath
SetDetailsPrint textonly
DetailPrint "Installing Plug-ins | Math..."
@ -547,9 +553,9 @@ Section "Math" SecPluginsMath
File ..\Examples\Math\mathtest.nsi
File ..\Examples\Math\mathtest.ini
SectionEnd
${MementoSectionEnd}
Section "NSISdl" SecPluginsNSISDL
${MementoSection} "NSISdl" SecPluginsNSISDL
SetDetailsPrint textonly
DetailPrint "Installing Plug-ins | NSISdl..."
@ -562,9 +568,9 @@ Section "NSISdl" SecPluginsNSISDL
SetOutPath $INSTDIR\Docs\NSISdl
File ..\Docs\NSISdl\ReadMe.txt
File ..\Docs\NSISdl\License.txt
SectionEnd
${MementoSectionEnd}
Section "System" SecPluginsSystem
${MementoSection} "System" SecPluginsSystem
SetDetailsPrint textonly
DetailPrint "Installing Plug-ins | System..."
@ -582,9 +588,9 @@ Section "System" SecPluginsSystem
File ..\Examples\System\SysFunc.nsh
File ..\Examples\System\System.nsh
File ..\Examples\System\System.nsi
SectionEnd
${MementoSectionEnd}
Section "StartMenu" SecPluginsStartMenu
${MementoSection} "StartMenu" SecPluginsStartMenu
SetDetailsPrint textonly
DetailPrint "Installing Plug-ins | StartMenu..."
@ -598,9 +604,9 @@ Section "StartMenu" SecPluginsStartMenu
File ..\Docs\StartMenu\Readme.txt
SetOutPath $INSTDIR\Examples\StartMenu
File ..\Examples\StartMenu\Example.nsi
SectionEnd
${MementoSectionEnd}
Section "UserInfo" SecPluginsUserInfo
${MementoSection} "UserInfo" SecPluginsUserInfo
SetDetailsPrint textonly
DetailPrint "Installing Plug-ins | UserInfo..."
@ -612,9 +618,9 @@ Section "UserInfo" SecPluginsUserInfo
File ..\Plugins\UserInfo.dll
SetOutPath $INSTDIR\Examples\UserInfo
File ..\Examples\UserInfo\UserInfo.nsi
SectionEnd
${MementoSectionEnd}
Section "Dialer" SecPluginsDialer
${MementoSection} "Dialer" SecPluginsDialer
SetDetailsPrint textonly
DetailPrint "Installing Plug-ins | Dialer..."
@ -626,9 +632,9 @@ Section "Dialer" SecPluginsDialer
File ..\Plugins\Dialer.dll
SetOutPath $INSTDIR\Docs\Dialer
File ..\Docs\Dialer\Dialer.txt
SectionEnd
${MementoSectionEnd}
Section "VPatch" SecPluginsVPatch
${MementoSection} "VPatch" SecPluginsVPatch
SetDetailsPrint textonly
DetailPrint "Installing Plug-ins | VPatch..."
@ -649,7 +655,9 @@ Section "VPatch" SecPluginsVPatch
File ..\Bin\GenPat.exe
SetOutPath $INSTDIR\Include
File ..\Include\VPatchLib.nsh
SectionEnd
${MementoSectionEnd}
${MementoSectionDone}
SectionGroupEnd
@ -797,6 +805,8 @@ Section -post
WriteUninstaller $INSTDIR\uninst-nsis.exe
${MementoSectionSave}
SetDetailsPrint both
SectionEnd
@ -836,14 +846,20 @@ SectionEnd
;--------------------------------
;Installer Functions
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
Function .onInit
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "makensis.ini"
!endif
${MementoSectionRestore}
FunctionEnd
!ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
Function PageReinstall
ReadRegStr $R0 HKLM "Software\NSIS" ""