From 9585e78fcfb1769092e775649002b869bb527dd4 Mon Sep 17 00:00:00 2001
From: joostverburg
Date: Sat, 26 Oct 2002 12:25:02 +0000
Subject: [PATCH] macro system updates
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1467 212acab6-be3b-0410-9dea-997c60f758d6
---
Contrib/Modern UI/Readme.html | 5 +-
Contrib/Modern UI/System.nsh | 135 ++++++++++++++++++++------
Examples/Modern UI/Basic.nsi | 6 +-
Examples/Modern UI/InstallOptions.nsi | 15 ++-
Examples/Modern UI/MultiLanguage.nsi | 6 +-
5 files changed, 127 insertions(+), 40 deletions(-)
diff --git a/Contrib/Modern UI/Readme.html b/Contrib/Modern UI/Readme.html
index be132a60..b28998e0 100644
--- a/Contrib/Modern UI/Readme.html
+++ b/Contrib/Modern UI/Readme.html
@@ -126,12 +126,15 @@ table
file and recompile NSIS.
- - 1.3 - October 18, 2002
+
- 1.3 - October 26, 2002
- Easier macro system for basic scripts
- New MultiLanguage system using Modern UI Language Files
- New directory structure (header/language files in Contrib\Modern UI)
- Small bugfixes & typo corrections
+
- SetPage function should be set using defines
+
- Different NextPage/PrevPage/FinishHeader macro's for install/uninstall
+
- Icon/UI paths can be set using defines (no MUI_INTERFACE_ABSOLUTEPATH anymore)
- 1.21 - September 30, 2002
diff --git a/Contrib/Modern UI/System.nsh b/Contrib/Modern UI/System.nsh
index 02ec304b..abd40883 100644
--- a/Contrib/Modern UI/System.nsh
+++ b/Contrib/Modern UI/System.nsh
@@ -22,29 +22,20 @@
;User interface
- Icon "${NSISDIR}\Contrib\Icons\${ICON}"
- UninstallIcon "${NSISDIR}\Contrib\Icons\${UNICON}"
- XPStyle On
- ChangeUI all "${NSISDIR}\Contrib\UIs\${UI}"
- SetFont "${FONT}" 8
- CheckBitmap "${NSISDIR}\Contrib\Icons\${CHECKS}"
- InstallColors /windows
- InstProgressFlags "${PROGRESSBAR}"
- BrandingText /TRIMRIGHT
- !define CURRENTPAGE ${CURRENTPAGEVAR}
-
-!macroend
-
-!macro MUI_INTERFACE_ABSOLUTEPATH UI ICON UNICON CHECKS PROGRESSBAR FONT CURRENTPAGEVAR
-
- ;User interface
+ !ifndef MUI_ICONPATH
+ !define MUI_ICONPATH "${NSISDIR}\Contrib\Icons\"
+ !endif
- Icon "${ICON}"
- UninstallIcon "${UNICON}"
+ !ifndef MUI_UIPATH
+ !define MUI_UIPATH "${NSISDIR}\Contrib\UIs\"
+ !endif
+
+ Icon "${MUI_ICONPATH}${ICON}"
+ UninstallIcon "${MUI_ICONPATH}${UNICON}"
XPStyle On
- ChangeUI all "${UI}"
+ ChangeUI all "${MUI_UIPATH}${UI}"
SetFont "${FONT}" 8
- CheckBitmap "${CHECKS}"
+ CheckBitmap "${MUI_ICONPATH}${CHECKS}"
InstallColors /windows
InstProgressFlags "${PROGRESSBAR}"
BrandingText /TRIMRIGHT
@@ -52,12 +43,31 @@
!macroend
-!macro MUI_FINISHHEADER CALL
+!macro MUI_FINISHHEADER
;Finish text on the header (white rectangle)
IntOp ${CURRENTPAGE} ${CURRENTPAGE} + 1
- Call ${CALL}
+
+ !ifndef MUI_SETPAGE_FUNCTIONNAME
+ !error "Modern UI Error: SetPage function name (MUI_SETPAGE_FUNCTIONNAME) not defined!"
+ !endif
+
+ Call "${MUI_SETPAGE_FUNCTIONNAME}"
+
+!macroend
+
+!macro MUI_UNFINISHHEADER
+
+ ;Finish text on the header (white rectangle)
+
+ IntOp ${CURRENTPAGE} ${CURRENTPAGE} + 1
+
+ !ifndef MUI_UNSETPAGE_FUNCTIONNAME
+ !error "Modern UI Error: Uninstall SetPage function name (MUI_UNSETPAGE_FUNCTIONNAME) not defined!"
+ !endif
+
+ Call "${MUI_UNSETPAGE_FUNCTIONNAME}"
!macroend
@@ -97,7 +107,7 @@
!macroend
-!macro MUI_NEXTPAGE CALL
+!macro MUI_NEXTPAGE
;Set backgrounds & fonts for the outer dialog (only once)
StrCmp ${CURRENTPAGE} "" "" no_first_run
@@ -126,15 +136,72 @@
IntOp ${CURRENTPAGE} ${CURRENTPAGE} + 1
- Call "${CALL}"
+ !ifndef MUI_SETPAGE_FUNCTIONNAME
+ !error "Modern UI Error: SetPage function name (MUI_SETPAGE_FUNCTIONNAME) not defined!"
+ !endif
+
+ Call "${MUI_SETPAGE_FUNCTIONNAME}"
!macroend
-!macro MUI_PREVPAGE CALL
+!macro MUI_UNNEXTPAGE
+
+ ;Set backgrounds & fonts for the outer dialog (only once)
+ StrCmp ${CURRENTPAGE} "" "" no_first_run
+
+ Push ${MUI_TEMP1}
+ Push ${MUI_TEMP2}
+
+ GetDlgItem ${MUI_TEMP1} $HWNDPARENT 1037
+ CreateFont ${MUI_TEMP2} "Tahoma" 10 700
+ SendMessage ${MUI_TEMP1} ${WM_SETFONT} ${MUI_TEMP2} 0
+ SetStaticBkColor ${MUI_TEMP1} 0x00FFFFFF
+
+ GetDlgItem ${MUI_TEMP1} $HWNDPARENT 1038
+ SetStaticBkColor ${MUI_TEMP1} 0x00FFFFFF
+
+ GetDlgItem ${MUI_TEMP1} $HWNDPARENT 1034
+ SetStaticBkColor ${MUI_TEMP1} 0x00FFFFFF
+
+ GetDlgItem ${MUI_TEMP1} $HWNDPARENT 1039
+ SetStaticBkColor ${MUI_TEMP1} 0x00FFFFFF
+
+ Pop ${MUI_TEMP2}
+ Pop ${MUI_TEMP1}
+
+ no_first_run:
+
+ IntOp ${CURRENTPAGE} ${CURRENTPAGE} + 1
+
+ !ifndef MUI_UNSETPAGE_FUNCTIONNAME
+ !error "Modern UI Error: Uninstall SetPage function name (MUI_UNSETPAGE_FUNCTIONNAME) not defined!"
+ !endif
+
+ Call "${MUI_UNSETPAGE_FUNCTIONNAME}"
+
+!macroend
+
+!macro MUI_PREVPAGE
IntOp ${CURRENTPAGE} ${CURRENTPAGE} - 1
- Call "${CALL}"
+ !ifndef MUI_SETPAGE_FUNCTIONNAME
+ !error "Modern UI Error: SetPage function name (MUI_SETPAGE_FUNCTIONNAME) not defined!"
+ !endif
+
+ Call "${MUI_SETPAGE_FUNCTIONNAME}"
+
+!macroend
+
+!macro MUI_UNPREVPAGE
+
+ IntOp ${CURRENTPAGE} ${CURRENTPAGE} - 1
+
+ !ifndef MUI_UNSETPAGE_FUNCTIONNAME
+ !error "Modern UI Error: Uninstall SetPage function name (MUI_UNSETPAGE_FUNCTIONNAME) not defined!"
+ !endif
+
+ Call "${MUI_UNSETPAGE_FUNCTIONNAME}"
!macroend
@@ -211,6 +278,7 @@
!macroend
+;--------------------------------
;INSTALL OPTIONS
!macro MUI_INSTALLOPTIONS DIRECTIONVAR NOSETDIRECTIONVAR
@@ -378,17 +446,24 @@
!macroend
-
+;--------------------------------
;BASIC FUNCTIONS
+!macro MUI_BASICFUNCTIONS_INIT
+
+ !define MUI_SETPAGE_FUNCTIONNAME "SetPage"
+ !define MUI_UNSETPAGE_FUNCTIONNAME "un.SetPage"
+
+!macroend
+
!macro MUI_BASICFUNCTIONS
Function .onNextPage
- !insertmacro MUI_NEXTPAGE SetPage
+ !insertmacro MUI_NEXTPAGE
FunctionEnd
Function .onPrevPage
- !insertmacro MUI_PREVPAGE SetPage
+ !insertmacro MUI_PREVPAGE
FunctionEnd
Function .onInitDialog
@@ -494,7 +569,7 @@ FunctionEnd
Function un.onNextPage
- !insertmacro MUI_NEXTPAGE un.SetPage
+ !insertmacro MUI_UNNEXTPAGE
FunctionEnd
diff --git a/Examples/Modern UI/Basic.nsi b/Examples/Modern UI/Basic.nsi
index d9b40e3e..f71d91b2 100644
--- a/Examples/Modern UI/Basic.nsi
+++ b/Examples/Modern UI/Basic.nsi
@@ -12,6 +12,8 @@
;--------------------------------
;Configuration
+ !insertmacro MUI_BASICFUNCTIONS_INIT
+
!define MUI_LICENSEPAGE
!define MUI_COMPONENTPAGE
!define MUI_DIRSELECTPAGE
@@ -57,7 +59,7 @@ SectionEnd
Section ""
;Invisible section to display the Finish header
- !insertmacro MUI_FINISHHEADER SetPage
+ !insertmacro MUI_FINISHHEADER
SectionEnd
@@ -85,7 +87,7 @@ Section "Uninstall"
RMDir "$INSTDIR"
;Display the Finish header
- !insertmacro MUI_FINISHHEADER un.SetPage
+ !insertmacro MUI_UNFINISHHEADER
SectionEnd
diff --git a/Examples/Modern UI/InstallOptions.nsi b/Examples/Modern UI/InstallOptions.nsi
index 996e3d9b..f1c5fe29 100644
--- a/Examples/Modern UI/InstallOptions.nsi
+++ b/Examples/Modern UI/InstallOptions.nsi
@@ -20,6 +20,9 @@
!define MUI_INSTALLBUTTONTEXT_NEXT
!define MUI_ABORTWARNING
!define MUI_UNINSTALLER
+
+ !define MUI_SETPAGE_FUNCTIONNAME "SetPage"
+ !define MUI_UNSETPAGE_FUNCTIONNAME "un.SetPage"
;Language
;English
@@ -88,7 +91,7 @@ SectionEnd
Section ""
;Invisible section to display the Finish header
- !insertmacro MUI_FINISHHEADER SetPage
+ !insertmacro MUI_FINISHHEADER
SectionEnd
@@ -119,14 +122,14 @@ FunctionEnd
Function .onNextPage
!insertmacro MUI_INSTALLOPTIONS_NEXTPAGE
- !insertmacro MUI_NEXTPAGE SetPage
+ !insertmacro MUI_NEXTPAGE
FunctionEnd
Function .onPrevPage
!insertmacro MUI_INSTALLOPTIONS_PREVPAGE
- !insertmacro MUI_PREVPAGE SetPage
+ !insertmacro MUI_PREVPAGE
FunctionEnd
@@ -220,7 +223,7 @@ Section "Uninstall"
RMDir "$INSTDIR"
- !insertmacro MUI_FINISHHEADER un.SetPage
+ !insertmacro MUI_UNFINISHHEADER
SectionEnd
@@ -228,8 +231,10 @@ SectionEnd
;Uninstaller Functions
Function un.onNextPage
+
!insertmacro MUI_INSTALLOPTIONS_NEXTPAGE
- !insertmacro MUI_NEXTPAGE un.SetPage
+ !insertmacro MUI_UNNEXTPAGE
+
FunctionEnd
Function un.SetPage
diff --git a/Examples/Modern UI/MultiLanguage.nsi b/Examples/Modern UI/MultiLanguage.nsi
index c515e2ff..3663c6d9 100644
--- a/Examples/Modern UI/MultiLanguage.nsi
+++ b/Examples/Modern UI/MultiLanguage.nsi
@@ -12,6 +12,8 @@
;--------------------------------
;Configuration
+ !insertmacro MUI_BASICFUNCTIONS_INIT
+
!define MUI_LICENSEPAGE
!define MUI_COMPONENTPAGE
!define MUI_DIRSELECTPAGE
@@ -142,7 +144,7 @@ Section ""
;Invisible section to display the Finish header & write the language to the registry
WriteRegStr HKCU "Software\${NAME}" "Installer Language" $LANGUAGE
- !insertmacro MUI_FINISHHEADER SetPage
+ !insertmacro MUI_FINISHHEADER
SectionEnd
@@ -212,7 +214,7 @@ Section "Uninstall"
DeleteRegValue HKCU "Software\${NAME}" "Installer Language"
;Display the Finish header
- !insertmacro MUI_FINISHHEADER un.SetPage
+ !insertmacro MUI_UNFINISHHEADER
SectionEnd