From fddc57d2aa1a6e4220d3e1357eb71791c52deef9 Mon Sep 17 00:00:00 2001
From: joostverburg
Date: Mon, 7 Apr 2003 18:05:12 +0000
Subject: [PATCH] new macro's: get uninstaller language, delete shortcuts, new
languages
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2452 212acab6-be3b-0410-9dea-997c60f758d6
---
Contrib/Modern UI/Changelog.txt | 3 +-
Contrib/Modern UI/Readme.html | 18 +++++++++-
Contrib/Modern UI/System.nsh | 52 ++++++++++++++++++++++++++--
Examples/Modern UI/MultiLanguage.nsi | 37 +++-----------------
Examples/Modern UI/StartMenu.nsi | 7 ++--
5 files changed, 76 insertions(+), 41 deletions(-)
diff --git a/Contrib/Modern UI/Changelog.txt b/Contrib/Modern UI/Changelog.txt
index db1ae264..d2597f15 100644
--- a/Contrib/Modern UI/Changelog.txt
+++ b/Contrib/Modern UI/Changelog.txt
@@ -1,12 +1,13 @@
NSIS Modern User Interface - VERSION HISTORY
-1.64 - March 26, 2003
+1.64 - April 7, 2003
* Support for license page with checkbox or radiobuttons to let the
user accept the agreement or not
* Macro's for finish headers don't have to be inserted anymore
* Language preference stored when installation has completed,
no problems anymore when the users selects the wrong language
* Header text for aborted installation
+* New macro's: get language for uninstaller, delete shortcuts
* Language files have to be updated
1.63 - March 9, 2003
diff --git a/Contrib/Modern UI/Readme.html b/Contrib/Modern UI/Readme.html
index d0bffada..08821293 100644
--- a/Contrib/Modern UI/Readme.html
+++ b/Contrib/Modern UI/Readme.html
@@ -206,6 +206,12 @@ 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:
+
+!insertmacro MUI_STARTMENU_DELETE_BEGIN $R0 ;You can also use another variable
+ Delete "$SMPROGRAMS\$R0\Your Shortcut.lnk"
+!insertmacro MUI_STARTMENU_DELETE_END
+
MUI_FINISHPAGE
Show the finish page. The finish page tells that the installation is succesful.
@@ -353,6 +359,15 @@ FunctionEnd
The registry key to store the language. The users preference will be remembered.
You can also use it in the uninstaller to display the right language. Don't forget
to remove this key in the uninstaller.
+ In the uninstaller, insert the MUI_UNGETLANGUAGE macro in un.onInit to get the stored language
+ preference:
+
+Function un.onInit
+
+ !insertmacro MUI_UNGETLANGUAGE
+
+FunctionEnd
+
Insert the description macro's to set the descriptions
for the sections. These descriptions will be displayed on the component
@@ -584,7 +599,7 @@ MUI_UNCUSTOMFUNCTION_INSTFILES_LEAVE
-- 1.64 - March 26, 2003
+
- 1.64 - April 7, 2003
- Support for license page with checkbox or radiobuttons to
let the user accept the agreement or not
@@ -592,6 +607,7 @@ MUI_UNCUSTOMFUNCTION_INSTFILES_LEAVE
- Language preference stored when installation has completed,
no problems anymore when the users selects the wrong language
- Header text for aborted installation
+ - New macro's: get language for uninstaller, delete shortcuts
- Language files have to be updated
diff --git a/Contrib/Modern UI/System.nsh b/Contrib/Modern UI/System.nsh
index 4906d551..f969c5bb 100644
--- a/Contrib/Modern UI/System.nsh
+++ b/Contrib/Modern UI/System.nsh
@@ -436,7 +436,7 @@
Push ${MUI_TEMP1}
StrCpy ${MUI_TEMP1} ${MUI_STARTMENUPAGE_VARIABLE} 1
- StrCmp ${MUI_TEMP1} ">" no_startmenu_shortcuts
+ StrCmp ${MUI_TEMP1} ">" mui.startmenu_write_done
Pop ${MUI_TEMP1}
@@ -452,7 +452,28 @@
WriteRegStr "${MUI_STARTMENUPAGE_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}" "${MUI_STARTMENUPAGE_VARIABLE}"
!endif
- no_startmenu_shortcuts:
+ mui.startmenu_write_done:
+
+ !verbose 4
+
+!macroend
+
+!macro MUI_STARTMENU_DELETE_BEGIN VAR
+
+ !verbose 3
+
+ ReadRegStr "${VAR}" "${MUI_STARTMENUPAGE_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}"
+ StrCmp "${VAR}" "" mui.startmenu_delete_done
+
+ !verbose 4
+
+!macroend
+
+!macro MUI_STARTMENU_DELETE_END
+
+ !verbose 3
+
+ mui.startmenu_delete_done:
!verbose 4
@@ -508,6 +529,33 @@
!macroend
+!macro MUI_UNGETLANGUAGE
+
+ !ifndef MUI_MANUALVERBOSE
+ !verbose 4
+ !endif
+
+ Push ${MUI_TEMP1}
+
+ ReadRegStr ${MUI_TEMP1} "${MUI_LANGDLL_REGISTRY_ROOT}" "${MUI_LANGDLL_REGISTRY_KEY}" "${MUI_LANGDLL_REGISTRY_VALUENAME}"
+
+ StrCmp ${MUI_TEMP1} "" 0 mui.ungetlanguage_setlang
+ !insertmacro MUI_LANGDLL_DISPLAY
+ Goto mui.ungetlanguage_done
+
+ mui.ungetlanguage_setlang:
+ StrCpy $LANGUAGE ${MUI_TEMP1}
+
+ mui.ungetlanguage_done:
+
+ Pop ${MUI_TEMP1}
+
+ !ifndef MUI_MANUALVERBOSE
+ !verbose 4
+ !endif
+
+!macroend
+
;--------------------------------
;PAGE COMMANDS
diff --git a/Examples/Modern UI/MultiLanguage.nsi b/Examples/Modern UI/MultiLanguage.nsi
index 25cece24..4a08a14c 100644
--- a/Examples/Modern UI/MultiLanguage.nsi
+++ b/Examples/Modern UI/MultiLanguage.nsi
@@ -27,7 +27,6 @@
;--------------------------------
;Modern UI Configuration
- !define MUI_LICENSEPAGE
!define MUI_COMPONENTSPAGE
!define MUI_DIRECTORYPAGE
@@ -64,6 +63,8 @@
!insertmacro MUI_LANGUAGE "Romanian"
!insertmacro MUI_LANGUAGE "Macedonian"
!insertmacro MUI_LANGUAGE "Turkish"
+ !insertmacro MUI_LANGUAGE "Lithuanian"
+ !insertmacro MUI_LANGUAGE "Catalan"
;--------------------------------
;Language Strings
@@ -94,35 +95,8 @@
LangString DESC_SecCopyUI ${LANG_ROMANIAN} "modern.exe: Romanian description"
LangString DESC_SecCopyUI ${LANG_MACEDONIAN} "modern.exe: Macedonian description"
LangString DESC_SecCopyUI ${LANG_TURKISH} "modern.exe: Turkish description"
-
-;--------------------------------
-;Data
-
- LicenseData /LANG=${LANG_ENGLISH} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_FRENCH} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_GERMAN} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_SPANISH} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_SIMPCHINESE} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_TRADCHINESE} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_JAPANESE} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_KOREAN} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_ITALIAN} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_DUTCH} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_DANISH} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_GREEK} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_RUSSIAN} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_PORTUGUESEBR} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_POLISH} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_UKRAINIAN} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_CZECH} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_SLOVAK} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_CROATIAN} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_BULGARIAN} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_HUNGARIAN} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_THAI} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_ROMANIAN} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_MACEDONIAN} "${NSISDIR}\Contrib\Modern UI\License.txt"
- LicenseData /LANG=${LANG_TURKISH} "${NSISDIR}\Contrib\Modern UI\License.txt"
+ LangString DESC_SecCopyUI ${LANG_LITHUANIAN} "modern.exe: Lithuanian description"
+ LangString DESC_SecCopyUI ${LANG_CATALAN} "modern.exe: Catalan description"
;--------------------------------
;Reserve Files
@@ -185,7 +159,6 @@ SectionEnd
Function un.onInit
- ;Get language from registry
- ReadRegStr $LANGUAGE HKCU "Software\${MUI_PRODUCT}" "Installer Language"
+ !insertmacro MUI_UNGETLANGUAGE
FunctionEnd
\ No newline at end of file
diff --git a/Examples/Modern UI/StartMenu.nsi b/Examples/Modern UI/StartMenu.nsi
index 894816b5..2e9fd248 100644
--- a/Examples/Modern UI/StartMenu.nsi
+++ b/Examples/Modern UI/StartMenu.nsi
@@ -106,16 +106,13 @@ Section "Uninstall"
Delete "$INSTDIR\modern.exe"
Delete "$INSTDIR\Uninstall.exe"
- ;Remove shortcut
- ReadRegStr ${TEMP} "${MUI_STARTMENUPAGE_REGISTRY_ROOT}" "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}"
-
- StrCmp ${TEMP} "" noshortcuts
+ !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
- noshortcuts:
+ !insertmacro MUI_STARTMENU_DELETE_END
RMDir "$INSTDIR"