From d77e30386a099aa11502e2c7b62418a85bbbf537 Mon Sep 17 00:00:00 2001 From: joostverburg Date: Mon, 10 Nov 2003 13:21:22 +0000 Subject: [PATCH] start menu variable > page macro parameter git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3118 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Modern UI/Readme.html | 28 ++++++++++++++++++---------- Contrib/Modern UI/System.nsh | 8 ++------ Examples/Modern UI/StartMenu.nsi | 3 +-- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Contrib/Modern UI/Readme.html b/Contrib/Modern UI/Readme.html index 0cdc4e78..258a3f76 100644 --- a/Contrib/Modern UI/Readme.html +++ b/Contrib/Modern UI/Readme.html @@ -149,8 +149,8 @@ settings. Others (e.g. MUI_UI) can be used to define a specific value.

If you want a certain value (e.g. a text) to be language-specific, set a language string (using LangString) and define $(STRINGNAME) as value. Use a license language string (LicenseLangString) for the license text.

-

When adding " or ` to a Modern UI string, you should always escape ($\" or $\`), because the -Modern UI macros use " and ` to separate parameters.

+

If you want to add " to a Modern UI string, you should always escape it: $\" because the Modern +UI macros use " separate parameters.

1. Header file

 !include "MUI.nsh"
@@ -335,15 +335,18 @@ multiple folders).

 !insertmacro MUI_PAGE_LICENSE "License.rtf"
 !insertmacro MUI_PAGE_COMPONENTS
-!insertmacro MUI_PAGE_STARTMENU "Application" ;Unique ID for page
+
+Var STARTMENU_FOLDER
+!insertmacro MUI_PAGE_STARTMENU "Application" $STARTMENU_FOLDER
 
-

You need the page ID for the Start Menu Folder page when using the Start Menu Folder macros.

+

You need the page ID for the Start Menu Folder page when using the Start Menu Folder macros. The +Start Menu Forder will be stored in the specified variable.

Installer Pages
MUI_PAGE_WELCOME
MUI_PAGE_LICENSE text/rtf_file
MUI_PAGE_COMPONENTS
MUI_PAGE_DIRECTORY
-MUI_PAGE_STARTMENU page_id
+MUI_PAGE_STARTMENU page_id variable
MUI_PAGE_INSTFILES
MUI_PAGE_FINISH

Uninstaller Pages
@@ -354,9 +357,17 @@ MUI_UNPAGE_COMPONENTS
MUI_UNPAGE_DIRECTORY
MUI_UNPAGE_INSTFILES
MUI_UNPAGE_FINISH

+

Page Settings apply to a single page and should be set before inserting a page macro. Example:

+
+;Add a directory page to let the user specify a plug-ins folder
+;Store the folder in $PLUGINS_FOLDER
+
+Var PLUGINS_FOLDER
+!define MUI_DIRECTORYPAGE_VARIABLE $PLUGINS_FOLDER
+!insertmacro MUI_PAGE_DIRECTORY
+

Page Settings

-

Page Settings apply to a single page and should be set before inserting a page macro.

General Page Settings

MUI_PAGE_HEADER_TEXT text
@@ -437,9 +448,6 @@ shortcuts you want to write.

Text to display on the top of the page.

MUI_STARTMENUPAGE_TEXT_CHECKBOX text
Text to display next to the checkbox to disable the Start Menu folder creation.

-

MUI_STARTMENUPAGE_VARIABLE variable
-Variable to store the current Start Menu Folder. You cannot use this variable in your script (or -you should Push/Pop it), therefore using a user variable is recommended.

MUI_STARTMENUPAGE_DEFAULTFOLDER folder
The default Start Menu Folder.

MUI_STARTMENUPAGE_NODISABLE
@@ -720,7 +728,7 @@ FunctionEnd

If you need the InstallOptions return value (success, back, cancel, error), use the MUI_INSTALLOPTIONS_DISPLAY_RETURN or MUI_INSTALLOPTIONS_SHOW_RETURN macro. The return value will be added to the stack, so you can use the Pop command to get it.

-

Use these macros to read or write INI file values.

+

Use these macros to read or write INI file values:

 !insertmacro MUI_INSTALLOPTIONS_READ $VAR "ioFile.ini" "Field #" "Value Name"
 !insertmacro MUI_INSTALLOPTIONS_WRITE "ioFile.ini" "Field #" "Value Name" "Value"
diff --git a/Contrib/Modern UI/System.nsh b/Contrib/Modern UI/System.nsh
index f522fbb2..2590ff57 100644
--- a/Contrib/Modern UI/System.nsh	
+++ b/Contrib/Modern UI/System.nsh	
@@ -774,7 +774,7 @@ Var MUI_TEMP2
   
 !macroend
 
-!macro MUI_PAGE_STARTMENU ID
+!macro MUI_PAGE_STARTMENU ID VAR
 
   !verbose push
   !verbose 3
@@ -786,12 +786,8 @@ Var MUI_TEMP2
   !insertmacro MUI_DEFAULT MUI_STARTMENUPAGE_DEFAULTFOLDER "$(^Name)"
   !insertmacro MUI_DEFAULT MUI_STARTMENUPAGE_TEXT_TOP "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}INNERTEXT_STARTMENU_TOP)"
   !insertmacro MUI_DEFAULT MUI_STARTMENUPAGE_TEXT_CHECKBOX "$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}INNERTEXT_STARTMENU_CHECKBOX)"
-  
-  !ifndef MUI_STARTMENUPAGE_VARIABLE
-    Var MUI_STARTMENU_FOLDER
-    !define MUI_STARTMENUPAGE_VARIABLE "$MUI_STARTMENU_FOLDER"
-  !endif
 
+  !define MUI_STARTMENUPAGE_VARIABLE "${VAR}"
   !define "MUI_STARTMENUPAGE_${ID}_VARIABLE" "${MUI_STARTMENUPAGE_VARIABLE}"
   !define "MUI_STARTMENUPAGE_${ID}_DEFAULTFOLDER" "${MUI_STARTMENUPAGE_DEFAULTFOLDER}"
   !ifdef MUI_STARTMENUPAGE_REGISTRY_ROOT
diff --git a/Examples/Modern UI/StartMenu.nsi b/Examples/Modern UI/StartMenu.nsi
index 7af28e21..2e0acea3 100644
--- a/Examples/Modern UI/StartMenu.nsi	
+++ b/Examples/Modern UI/StartMenu.nsi	
@@ -39,12 +39,11 @@
   !insertmacro MUI_PAGE_DIRECTORY
   
   ;Start Menu Folder Page Configuration
-  !define MUI_STARTMENUPAGE_VARIABLE "$STARTMENU_FOLDER"
   !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" 
   !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Modern UI Test" 
   !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
   
-  !insertmacro MUI_PAGE_STARTMENU Application
+  !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
   
   !insertmacro MUI_PAGE_INSTFILES