From aaf63af9f6ac74730ccdeae5163947a0829833fa Mon Sep 17 00:00:00 2001 From: joostverburg Date: Wed, 8 Oct 2003 15:28:44 +0000 Subject: [PATCH] updated reserve file macros git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3003 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Modern UI/Readme.html | 45 ++++++++++++++------------- Contrib/Modern UI/System.nsh | 34 -------------------- Examples/Modern UI/Basic.nsi | 2 +- Examples/Modern UI/HeaderBitmap.nsi | 8 ----- Examples/Modern UI/InstallOptions.nsi | 21 +++++++------ Examples/Modern UI/MultiLanguage.nsi | 17 +++++----- Examples/Modern UI/StartMenu.nsi | 9 +----- Examples/Modern UI/WelcomeFinish.nsi | 11 +------ Examples/makensis.nsi | 7 ----- 9 files changed, 47 insertions(+), 107 deletions(-) diff --git a/Contrib/Modern UI/Readme.html b/Contrib/Modern UI/Readme.html index 8bf135d8..d84d75b5 100644 --- a/Contrib/Modern UI/Readme.html +++ b/Contrib/Modern UI/Readme.html @@ -520,7 +520,21 @@ FunctionEnd 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.

-

6. Set the descriptions for the sections

+

6. Reserve files

+

If you are using BZIP2 (solid) compression, it's important that +files which are being extracted in init- or page functions function are located +before other files in the data block, because this will make your installer faster.

+

If there are File commands in your sections or functions above +the init- or page functions, add the reserve file macros above your sections and +functions.

+
ReserveFile "ioFile.ini" ;Your own InstallOptions INI files
+!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ;InstallOptions plug-in
+!insertmacro MUI_RESERVEFILE_LANGDLL ;Language selection dialog
+
+

7. Your own sections and functions

+

Add your installer sections and functions. + See the NSIS Users Manual for details.

+

8. Set the descriptions for the sections

The descriptions of sections will be displayed on the components page, when the user hovers the mouse over a section. If you don't want to use descriptions, use the MUI_COMPONENTSPAGE_NODESC @@ -545,9 +559,15 @@ LangString DESC_Section2 ${LANG_ENGLISH} "Description of section 2."

For the uninstaller, use the MUI_UNFUNCTION_DESCRIPTION_BEGIN and MUI_UNFUNCTIONS_DESCRIPTION_END macros

-

7. Reserve Files

-

If you are using BZIP2 (solid) compression, you might need to -insert ReserveFile commands. More info...

+
+ReserveFile "ioFile.ini" ;Your own InstallOptions INI files
+ReserveFile "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp" ;Your header bitmap
+
+!insertmacro MUI_RESERVEFILE_WELCOMEFINISHPAGE ;Welcome- or Finish page
+!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ;InstallOptions
+!insertmacro MUI_RESERVEFILE_LANGDLL ;LangDLL (language selection dialog)
+!insertmacro MUI_RESERVEFILE_STARTMENU ;Start Menu Folder page
+

Custom pages

Custom page commands

If you want add custom pages to your installer, you should insert your @@ -634,23 +654,6 @@ to get the user input:

!insertmacro MUI_INSTALLOPTIONS_READ $R0 "ioFile.ini" "Field 1" "State"

For more details about InstallOptions, validation of user input etc., check the InstallOptions documentation.

-

Reserve files

- -

If you are using BZIP2 compression, it's important that -files which are being extracted in init- or page functions functions are first in -the data block, because this will make your installer start faster.

-

If there are File commands in your script above Modern UI settings -or above your own init- or page functions, you have to reserve files.

-
-ReserveFile "ioFile.ini" ;Your own InstallOptions INI files
-ReserveFile "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp" ;Your header bitmap
-ReserveFile "${NSISDIR}\Contrib\Graphics\Wizard\win.bmp" ;Special bitmap
-
-!insertmacro MUI_RESERVEFILE_WELCOMEFINISHPAGE ;Welcome- or Finish page
-!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS ;InstallOptions
-!insertmacro MUI_RESERVEFILE_LANGDLL ;LangDLL (language selection dialog)
-!insertmacro MUI_RESERVEFILE_STARTMENU ;Start Menu Folder page
-

Examples

Basic: Basic.nsi
Welcome/Finish page: WelcomeFinish.nsi
diff --git a/Contrib/Modern UI/System.nsh b/Contrib/Modern UI/System.nsh index 462a3462..a970ac27 100644 --- a/Contrib/Modern UI/System.nsh +++ b/Contrib/Modern UI/System.nsh @@ -1982,18 +1982,6 @@ Var MUI_TEMP2 ;-------------------------------- ;RESERVE FILES -!macro MUI_RESERVEFILE_WELCOMEFINISHPAGE - - !verbose push - !verbose 3 - - !insertmacro MUI_RESERVEFILE_SPECIALINI - !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS - - !verbose pop - -!macroend - !macro MUI_RESERVEFILE_INSTALLOPTIONS !verbose push @@ -2005,17 +1993,6 @@ Var MUI_TEMP2 !macroend -!macro MUI_RESERVEFILE_SPECIALINI - - !verbose push - !verbose 3 - - ReserveFile "${NSISDIR}\Contrib\Modern UI\ioSpecial.ini" - - !verbose pop - -!macroend - !macro MUI_RESERVEFILE_LANGDLL !verbose push @@ -2027,17 +2004,6 @@ Var MUI_TEMP2 !macroend -!macro MUI_RESERVEFILE_STARTMENU - - !verbose push - !verbose 3 - - ReserveFile "${NSISDIR}\Plugins\StartMenu.dll" - - !verbose pop - -!macroend - ;-------------------------------- ;INSERT ALL CODE diff --git a/Examples/Modern UI/Basic.nsi b/Examples/Modern UI/Basic.nsi index a84a13b0..1faa5d19 100644 --- a/Examples/Modern UI/Basic.nsi +++ b/Examples/Modern UI/Basic.nsi @@ -21,7 +21,7 @@ InstallDirRegKey HKCU "Software\Modern UI Test" "" ;-------------------------------- -;Modern UI Configuration +;Interface Settings !define MUI_ABORTWARNING diff --git a/Examples/Modern UI/HeaderBitmap.nsi b/Examples/Modern UI/HeaderBitmap.nsi index e2e9b297..33b0e7aa 100644 --- a/Examples/Modern UI/HeaderBitmap.nsi +++ b/Examples/Modern UI/HeaderBitmap.nsi @@ -42,14 +42,6 @@ !insertmacro MUI_LANGUAGE "English" -;-------------------------------- -;Reserve Files - - ;Things that need to be extracted on first (keep these lines before any File command!) - ;Only for BZIP2 compression - - ReserveFile "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp" - ;-------------------------------- ;Installer Sections diff --git a/Examples/Modern UI/InstallOptions.nsi b/Examples/Modern UI/InstallOptions.nsi index d7fb49c3..78204e4b 100644 --- a/Examples/Modern UI/InstallOptions.nsi +++ b/Examples/Modern UI/InstallOptions.nsi @@ -20,11 +20,6 @@ ;Get install folder from registry if available InstallDirRegKey HKCU "Software\Modern UI Test" "" -;-------------------------------- -;Variables - - Var MUI_TEMP - ;-------------------------------- ;Pages @@ -40,7 +35,7 @@ !insertmacro MUI_UNPAGE_INSTFILES ;-------------------------------- -;Modern UI Configuration +;Interface Settings !define MUI_ABORTWARNING @@ -52,14 +47,20 @@ ;-------------------------------- ;Reserve Files - ;Things that need to be extracted on first (keep these lines before any File command!) - ;Only for BZIP2 compression + ;These files should be inserted before other files in the data block + ;Keep these lines before any File command + ;Only for BZIP2 (solid) compression ReserveFile "ioA.ini" ReserveFile "ioB.ini" ReserveFile "ioC.ini" !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS +;-------------------------------- +;Variables + + Var INI_VALUE + ;-------------------------------- ;Installer Sections @@ -76,10 +77,10 @@ Section "Dummy Section" SecDummy WriteUninstaller "$INSTDIR\Uninstall.exe" ;Read a value from an InstallOptions INI file - !insertmacro MUI_INSTALLOPTIONS_READ $MUI_TEMP "ioC.ini" "Field 2" "State" + !insertmacro MUI_INSTALLOPTIONS_READ $INI_VALUE "ioC.ini" "Field 2" "State" ;Display a messagebox if check box was checked - StrCmp $MUI_TEMP "1" "" +2 + StrCmp $INI_VALUE "1" "" +2 MessageBox MB_OK "You checked the check box, here is the MessageBox..." SectionEnd diff --git a/Examples/Modern UI/MultiLanguage.nsi b/Examples/Modern UI/MultiLanguage.nsi index f02398b8..799602e4 100644 --- a/Examples/Modern UI/MultiLanguage.nsi +++ b/Examples/Modern UI/MultiLanguage.nsi @@ -21,12 +21,7 @@ InstallDirRegKey HKCU "Software\Modern UI Test" "" ;-------------------------------- -;Modern UI Configuration - - ;Remember the installer language - !define MUI_LANGDLL_REGISTRY_ROOT "HKCU" - !define MUI_LANGDLL_REGISTRY_KEY "Software\Modern UI Test" - !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" +;Interface Settings !define MUI_ABORTWARNING @@ -78,8 +73,9 @@ ;-------------------------------- ;Reserve Files - ;Things that need to be extracted on first (keep these lines before any File command!) - ;Only for BZIP2 compression + ;These files should be inserted before other files in the data block + ;Keep these lines before any File command + ;Only for BZIP2 (solid) compression !insertmacro MUI_RESERVEFILE_LANGDLL ;-------------------------------- @@ -104,6 +100,11 @@ SectionEnd Function .onInit + ;Remember the installer language + !define MUI_LANGDLL_REGISTRY_ROOT "HKCU" + !define MUI_LANGDLL_REGISTRY_KEY "Software\Modern UI Test" + !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language" + !insertmacro MUI_LANGDLL_DISPLAY FunctionEnd diff --git a/Examples/Modern UI/StartMenu.nsi b/Examples/Modern UI/StartMenu.nsi index b2f3f80d..319b658b 100644 --- a/Examples/Modern UI/StartMenu.nsi +++ b/Examples/Modern UI/StartMenu.nsi @@ -26,7 +26,7 @@ Var MUI_TEMP ;-------------------------------- -;Modern UI Configuration +;Interface Settings !define MUI_ABORTWARNING @@ -54,13 +54,6 @@ !insertmacro MUI_LANGUAGE "English" -;-------------------------------- -;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 diff --git a/Examples/Modern UI/WelcomeFinish.nsi b/Examples/Modern UI/WelcomeFinish.nsi index dd4a299b..ba9b93bc 100644 --- a/Examples/Modern UI/WelcomeFinish.nsi +++ b/Examples/Modern UI/WelcomeFinish.nsi @@ -21,7 +21,7 @@ InstallDirRegKey HKCU "Software\Modern UI Test" "" ;-------------------------------- -;Modern UI Configuration +;Interface Settings !define MUI_ABORTWARNING @@ -43,15 +43,6 @@ !insertmacro MUI_LANGUAGE "English" -;-------------------------------- -;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 - ReserveFile "${NSISDIR}\Contrib\Graphics\Wizard\win.bmp" - ;-------------------------------- ;Installer Sections diff --git a/Examples/makensis.nsi b/Examples/makensis.nsi index 12bb40c5..4228323f 100644 --- a/Examples/makensis.nsi +++ b/Examples/makensis.nsi @@ -72,13 +72,6 @@ Caption "NSIS ${VER_DISPLAY} Setup" !insertmacro MUI_LANGUAGE "English" -;-------------------------------- -;Reserve Files - - !insertmacro MUI_RESERVEFILE_WELCOMEFINISHPAGE - ReserveFile "${NSISDIR}\Contrib\Graphics\Wizard\win.bmp" - ReserveFile "${NSISDIR}\Contrib\Graphics\Header\nsis.bmp" - ;-------------------------------- ;Installer Sections