From 5aa3a8f6322d9924ecb2fd4189b3bd020803034d Mon Sep 17 00:00:00 2001
From: joostverburg
Date: Sat, 14 Jun 2003 12:49:33 +0000
Subject: [PATCH] Improved registry storage for Start Menu folder; ReserveFile
macro for StartMenu plug-in; Added MUI_LANGDLL_ALWAYSSHOW option; Checkboxes
on Finish page can be used to call a function; example fixes
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2646 212acab6-be3b-0410-9dea-997c60f758d6
---
Contrib/Modern UI/Changelog.txt | 6 +-
Contrib/Modern UI/Readme.html | 23 +++-
Contrib/Modern UI/System.nsh | 172 +++++++++++++++------------
Examples/Modern UI/StartMenu.nsi | 14 ++-
Examples/Modern UI/WelcomeFinish.nsi | 9 +-
5 files changed, 138 insertions(+), 86 deletions(-)
diff --git a/Contrib/Modern UI/Changelog.txt b/Contrib/Modern UI/Changelog.txt
index c7c63900..74d89de9 100644
--- a/Contrib/Modern UI/Changelog.txt
+++ b/Contrib/Modern UI/Changelog.txt
@@ -1,10 +1,14 @@
NSIS Modern User Interface - VERSION HISTORY
-1.65 - May 25, 2003
+1.65 - June 14, 2003
* New page configuration system, no different system for installers
with custom pages
* Default windows color for the license text background
* New format for example scripts
+* Improved registry storage for Start Menu folder
+* ReserveFile macro for StartMenu plug-in
+* Added MUI_LANGDLL_ALWAYSSHOW option
+* Checkboxes on Finish page can be used to call a function
1.64 - April 27, 2003
* Support for license page with checkbox or radiobuttons to let the
diff --git a/Contrib/Modern UI/Readme.html b/Contrib/Modern UI/Readme.html
index fc3ba034..7c9ff312 100644
--- a/Contrib/Modern UI/Readme.html
+++ b/Contrib/Modern UI/Readme.html
@@ -238,7 +238,7 @@ follow these steps:
remember the users preference. You should also use it in the uninstaller to
remove the Start Menu folders. Don't forget to remove this key in the
uninstaller.
- In the uninstaller, use these macro's to remove the shortcuts:
+ In the uninstaller, these macro to get the Start Menu folder:
!insertmacro MUI_STARTMENU_DELETE_BEGIN $R0 ;You can also use another variable
Delete "$SMPROGRAMS\$R0\Your Shortcut.lnk"
@@ -256,6 +256,10 @@ follow these steps:
quotes in the value (use $\").
MUI_FINISHPAGE_RUN_NOTCHECKED
Do not check the 'Run program' checkbox by default
+ MUI_FINISHPAGE_RUN_FUNCTION function_name
+ Call a function instead of executing an application (define MUI_FINISHPAGE_RUN without parameters).
+ You can use the function to exectute multiple applications or you can change the checkbox name and
+ use it for other things.
MUI_FINISHPAGE_SHOWREADME file/url
File or website which the user can select to view (using a checkbox).
@@ -264,6 +268,10 @@ follow these steps:
MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
Do not check the 'Show Readme' checkbox by default
+
MUI_FINISHPAGE_SHOWREADME_FUNCTION function_name
+ Call a function instead of showing a file (define MUI_FINISHPAGE_SHOWREADME without parameters).
+ You can use the function to show multiple files or you can change the checkbox name and
+ use it for other things.
MUI_FINISHPAGE_NOAUTOCLOSE
Do not automatically jump to the finish page, to allow the user to
@@ -399,6 +407,9 @@ Function un.onInit
FunctionEnd
+ MUI_LANGDLL_ALWAYSSHOW
+ Always show the language selection dialog, even if a language has been stored in the registry.
+ The language stored in the registry will be selected by default.
Insert the description macro's to set the descriptions
for the sections. These descriptions will be displayed on the component
@@ -526,10 +537,12 @@ start faster.
insert the ReserveFile commands or macro's above other File commands:
ReserveFile "ioFile.ini" ;Your own InstallOptions INI files
+ReserveFile "${NSISDIR}\Contrib\Icons\modern-header.bmp" ;Your header bitmap
!insertmacro MUI_RESERVEFILE_WELCOMEFINISHPAGE ;Welcome- or Finish page
-!insertmacro MUI_RESERVEFILE_INSTALLOPTION ;InstallOptions
+!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ;InstallOptions
!insertmacro MUI_RESERVEFILE_LANGDLL ;LangDLL (language selection dialog)
+!insertmacro MUI_RESERVEFILE_STARTMENU ;Start Menu folder selection page
Basic: Basic.nsi
@@ -630,12 +643,16 @@ MUI_UNCUSTOMFUNCTION_INSTFILES_LEAVE
-- 1.65 - May 25, 2003
+
- 1.65 - June 14, 2003
- New page configuration system, no different system for installers
with custom pages
- Default windows color for the license text background
- New format for example scripts
+ - Improved registry storage for Start Menu folder
+ - ReserveFile macro for StartMenu plug-in
+ - Added MUI_LANGDLL_ALWAYSSHOW option
+ - Checkboxes on Finish page can be used to call a function
diff --git a/Contrib/Modern UI/System.nsh b/Contrib/Modern UI/System.nsh
index 236cbbe9..ae4fe1ea 100644
--- a/Contrib/Modern UI/System.nsh
+++ b/Contrib/Modern UI/System.nsh
@@ -409,6 +409,48 @@
!macroend
+!macro MUI_STARTMENU_INITDEFINES
+
+ ;Check defines
+ !ifndef MUI_STARTMENUPAGE_VARIABLE
+ !define MUI_STARTMENUPAGE_VARIABLE "$9"
+ !endif
+
+ !ifndef MUI_STARTMENUPAGE_DEFAULTFOLDER
+ !define MUI_STARTMENUPAGE_DEFAULTFOLDER "${MUI_PRODUCT}"
+ !endif
+
+!macroend
+
+!macro MUI_STARTMENU_GETFOLDER VAR
+
+ !ifdef MUI_STARTMENUPAGE_REGISTRY_ROOT & MUI_STARTMENUPAGE_REGISTRY_KEY & MUI_STARTMENUPAGE_REGISTRY_VALUENAME
+
+ ReadRegStr ${MUI_TEMP1} "${MUI_STARTMENUPAGE_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}"
+ StrCmp ${MUI_TEMP1} "" +3
+ StrCpy "${VAR}" ${MUI_TEMP1}
+ Goto +2
+
+ StrCpy "${VAR}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
+
+ !else
+
+ StrCpy "${VAR}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
+
+ !endif
+
+!macroend
+
+!macro MUI_STARTMENU_GETFOLDER_IFEMPTY VAR
+
+ StrCmp ${VAR} "" 0 mui.startmenu_writebegin_notempty
+
+ !insertmacro MUI_STARTMENU_GETFOLDER ${VAR}
+
+ mui.startmenu_writebegin_notempty:
+
+!macroend
+
!macro MUI_STARTMENU_WRITE_BEGIN
!ifndef MUI_MANUALVERBOSE
@@ -420,28 +462,7 @@
StrCpy ${MUI_TEMP1} ${MUI_STARTMENUPAGE_VARIABLE} 1
StrCmp ${MUI_TEMP1} ">" mui.startmenu_write_done
- StrCmp ${MUI_STARTMENUPAGE_VARIABLE} "" 0 mui.startmenu_writebegin_notempty
-
- !ifdef MUI_STARTMENUPAGE_REGISTRY_ROOT & MUI_STARTMENUPAGE_REGISTRY_KEY & MUI_STARTMENUPAGE_REGISTRY_VALUENAME
-
- StrCmp "${MUI_STARTMENUPAGE_VARIABLE}" "" 0 +6
-
- ReadRegStr ${MUI_TEMP1} "${MUI_STARTMENUPAGE_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}"
- StrCmp ${MUI_TEMP1} "" +3
- StrCpy "${MUI_STARTMENUPAGE_VARIABLE}" ${MUI_TEMP1}
- Goto +2
-
- StrCpy "${MUI_STARTMENUPAGE_VARIABLE}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
-
- !else
-
- StrCpy "${MUI_STARTMENUPAGE_VARIABLE}" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
-
- !endif
-
- mui.startmenu_writebegin_notempty:
-
- Pop ${MUI_TEMP1}
+ !insertmacro MUI_STARTMENU_GETFOLDER_IFEMPTY ${MUI_STARTMENUPAGE_VARIABLE}
!ifndef MUI_MANUALVERBOSE
!verbose 4
@@ -461,6 +482,8 @@
mui.startmenu_write_done:
+ Pop ${MUI_TEMP1}
+
!ifndef MUI_MANUALVERBOSE
!verbose 4
!endif
@@ -469,31 +492,16 @@
!macro MUI_STARTMENU_DELETE_BEGIN VAR
- !ifndef MUI_MANUALVERBOSE
- !verbose 3
- !endif
+ Push ${MUI_TEMP1}
- ReadRegStr "${VAR}" "${MUI_STARTMENUPAGE_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}"
- StrCmp "${VAR}" "" mui.startmenu_delete_done
+ !insertmacro MUI_STARTMENU_GETFOLDER ${VAR}
- !ifndef MUI_MANUALVERBOSE
- !verbose 4
- !endif
-
!macroend
!macro MUI_STARTMENU_DELETE_END
- !ifndef MUI_MANUALVERBOSE
- !verbose 3
- !endif
+ Pop ${MUI_TEMP1}
- mui.startmenu_delete_done:
-
- !ifndef MUI_MANUALVERBOSE
- !verbose 4
- !endif
-
!macroend
!macro MUI_LANGDLL_DISPLAY
@@ -516,7 +524,9 @@
ReadRegStr ${MUI_TEMP1} "${MUI_LANGDLL_REGISTRY_ROOT}" "${MUI_LANGDLL_REGISTRY_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}"
StrCmp ${MUI_TEMP1} "" showlangdialog
StrCpy $LANGUAGE ${MUI_TEMP1}
- Goto mui.langdll_done
+ !ifndef MUI_LANGDLL_ALWAYSSHOW
+ Goto mui.langdll_done
+ !endif
showlangdialog:
Pop ${MUI_TEMP1}
@@ -527,9 +537,11 @@
Pop $LANGUAGE
StrCmp $LANGUAGE "cancel" 0 +2
Abort
-
- !ifdef MUI_LANGDLL_REGISTRY_ROOT & MUI_LANGDLL_REGISTRY_KEY & MUI_LANGDLL_REGISTRY_VALUENAME
- mui.langdll_done:
+
+ !ifndef MUI_LANGDLL_ALWAYSSHOW
+ !ifdef MUI_LANGDLL_REGISTRY_ROOT & MUI_LANGDLL_REGISTRY_KEY & MUI_LANGDLL_REGISTRY_VALUENAME
+ mui.langdll_done:
+ !endif
!endif
!ifndef MUI_MANUALVERBOSE
@@ -883,19 +895,6 @@
!macroend
-!macro MUI_STARTMENU_INITDEFINES
-
- ;Check defines
- !ifndef MUI_STARTMENUPAGE_VARIABLE
- !define MUI_STARTMENUPAGE_VARIABLE "$9"
- !endif
-
- !ifndef MUI_STARTMENUPAGE_DEFAULTFOLDER
- !define MUI_STARTMENUPAGE_DEFAULTFOLDER "${MUI_PRODUCT}"
- !endif
-
-!macroend
-
;--------------------------------
;FUNCTIONS
@@ -1356,33 +1355,40 @@
!insertmacro MUI_INSTALLOPTIONS_READ ${MUI_TEMP1} "ioSpecial.ini" "Field 4" "State"
- StrCmp ${MUI_TEMP1} "1" "" +3
- !ifndef MUI_FINISHPAGE_RUN_PARAMETERS
- StrCpy ${MUI_TEMP1} "$\"${MUI_FINISHPAGE_RUN}$\""
+ StrCmp ${MUI_TEMP1} "1" 0 mui.finish_norun
+ !ifndef MUI_FINISHPAGE_RUN_FUNCTION
+ !ifndef MUI_FINISHPAGE_RUN_PARAMETERS
+ StrCpy ${MUI_TEMP1} "$\"${MUI_FINISHPAGE_RUN}$\""
+ !else
+ StrCpy ${MUI_TEMP1} "$\"${MUI_FINISHPAGE_RUN}$\" ${MUI_FINISHPAGE_RUN_PARAMETERS}"
+ !endif
+ Exec "${MUI_TEMP1}"
!else
- StrCpy ${MUI_TEMP1} "$\"${MUI_FINISHPAGE_RUN}$\" ${MUI_FINISHPAGE_RUN_PARAMETERS}"
+ Call "${MUI_FINISHPAGE_RUN_FUNCTION}"
!endif
- Exec "${MUI_TEMP1}"
- !ifdef MUI_FINISHPAGE_SHOWREADME
+ mui.finish_norun:
+
+ !endif
+
+ !ifdef MUI_FINISHPAGE_SHOWREADME
+ !ifdef MUI_FINISHPAGE_RUN
!insertmacro MUI_INSTALLOPTIONS_READ ${MUI_TEMP1} "ioSpecial.ini" "Field 5" "State"
-
- StrCmp ${MUI_TEMP1} "1" "" +2
- ExecShell "open" "${MUI_FINISHPAGE_SHOWREADME}"
-
+ !else
+ !insertmacro MUI_INSTALLOPTIONS_READ ${MUI_TEMP1} "ioSpecial.ini" "Field 4" "State"
!endif
-
- !else ifdef MUI_FINISHPAGE_SHOWREADME
-
- !insertmacro MUI_INSTALLOPTIONS_READ ${MUI_TEMP1} "ioSpecial.ini" "Field 4" "State"
- StrCmp ${MUI_TEMP1} "1" "" +2
+ StrCmp ${MUI_TEMP1} "1" 0 mui.finish_noshowreadme
+ !ifndef MUI_FINISHPAGE_SHOWREADME_FUNCTION
ExecShell "open" "${MUI_FINISHPAGE_SHOWREADME}"
-
- !endif
-
- !endif
+ !else
+ Call "${MUI_FINISHPAGE_SHOWREADME_FUNCTION}"
+ !endif
+
+ mui.finish_noshowreadme:
+
+ !endif
mui.finish_done:
@@ -1595,6 +1601,20 @@
!macroend
+!macro MUI_RESERVEFILE_STARTMENU
+
+ !ifndef MUI_MANUALVERBOSE
+ !verbose 3
+ !endif
+
+ ReserveFile "${NSISDIR}\Plugins\StartMenu.dll"
+
+ !ifndef MUI_MANUALVERBOSE
+ !verbose 4
+ !endif
+
+!macroend
+
;--------------------------------
;INSERT ALL CODE
diff --git a/Examples/Modern UI/StartMenu.nsi b/Examples/Modern UI/StartMenu.nsi
index a379871b..b22aebf6 100644
--- a/Examples/Modern UI/StartMenu.nsi
+++ b/Examples/Modern UI/StartMenu.nsi
@@ -66,6 +66,13 @@
LicenseData "${NSISDIR}\Contrib\Modern UI\License.txt"
+;--------------------------------
+;Reserve Files
+
+ ;Things that need to be extracted on first (keep these lines before any File command!)
+ ;Only for BZIP2 compression
+ !insertmacro MUI_RESERVEFILE_STARTMENU
+
;--------------------------------
;Installer Sections
@@ -110,15 +117,12 @@ Section "Uninstall"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
-
- DeleteRegKey /ifempty HKCU "Software\${MUI_PRODUCT}"
!insertmacro MUI_STARTMENU_DELETE_BEGIN ${TEMP}
-
- Delete "$SMPROGRAMS\${TEMP}\Modern UI.lnk"
Delete "$SMPROGRAMS\${TEMP}\Uninstall.lnk"
RMDir "$SMPROGRAMS\${TEMP}" ;Only if empty, so it won't delete other shortcuts
-
!insertmacro MUI_STARTMENU_DELETE_END
+ DeleteRegKey /ifempty HKCU "Software\${MUI_PRODUCT}"
+
SectionEnd
\ No newline at end of file
diff --git a/Examples/Modern UI/WelcomeFinish.nsi b/Examples/Modern UI/WelcomeFinish.nsi
index 9898f4d4..aafe8f2c 100644
--- a/Examples/Modern UI/WelcomeFinish.nsi
+++ b/Examples/Modern UI/WelcomeFinish.nsi
@@ -42,7 +42,6 @@
;Modern UI Configuration
!define MUI_ABORTWARNING
- !define MUI_FINISHPAGE_RUN "$INSTDIR\modern.exe"
;--------------------------------
;Languages
@@ -54,6 +53,14 @@
LicenseData "${NSISDIR}\Contrib\Modern UI\License.txt"
+;--------------------------------
+;Reserve Files
+
+ ;Things that need to be extracted on first (keep these lines before any File command!)
+ ;Only for BZIP2 compression
+
+ !insertmacro MUI_RESERVEFILE_WELCOMEFINISHPAGE
+
;--------------------------------
;Installer Sections