]> git.lyx.org Git - lyx.git/blob - development/Win32/packaging/installer/components/user.nsh
Change windows installer comments from ; to #
[lyx.git] / development / Win32 / packaging / installer / components / user.nsh
1 /*
2
3 Install type setting (current user/all users)
4
5 */
6
7 #--------------------------------
8 #Macros
9
10 !macro GetDirExternal COMPONENT
11
12   ReadRegStr $R0 SHELL_CONTEXT "${APP_REGKEY_SETUP}" "${COMPONENT} Path"
13   
14   ${if} ${FileExists} "$R0\${BIN_${COMPONENT}}"
15
16     ${if} $R0 != ""
17       StrCpy $Path${COMPONENT} $R0
18     ${endif}
19   
20   ${endif}
21
22 !macroend
23
24 #--------------------------------
25 #Functions
26
27 Function InitUser
28
29   #Get directories from registry
30
31   ReadRegStr $R0 SHELL_CONTEXT "${APP_REGKEY}" ""
32   
33   ${if} $R0 != ""
34     StrCpy $INSTDIR $R0
35   ${endif}
36
37   !insertmacro GetDirExternal LaTeX
38   !insertmacro GetDirExternal ImageMagick
39   !insertmacro GetDirExternal Ghostscript
40   
41   #Set directories in dialogs
42
43   !insertmacro InitDialogExternalDir latex ${TRUE}
44   !insertmacro InitDialogExternalDir imagemagick ${FALSE}
45   !insertmacro InitDialogExternalDir ghostscript ${FALSE}
46   
47   #Get LyX language
48   
49   ReadRegStr $R0 SHELL_CONTEXT "${APP_REGKEY_SETUP}" "LyX Language"
50   
51   ${if} $R0 != ""
52     !insertmacro MUI_INSTALLOPTIONS_WRITE "langselect.ini" "Field 2" "State" $R0
53   ${endif}
54   
55 FunctionEnd
56
57 #--------------------------------
58 #Page functions
59
60 Function PageUser
61
62   #Only show page if installing for all users is possible
63   ${if} $AdminOrPowerUser == ${FALSE}
64     Call InitUser
65     Abort
66   ${endif}
67   
68   !insertmacro MUI_HEADER_TEXT $(TEXT_USER_TITLE) $(TEXT_USER_SUBTITLE)
69   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "user.ini"
70
71 FunctionEnd
72
73 Function PageUserValidate
74   
75   !insertmacro MUI_INSTALLOPTIONS_READ $R0 "user.ini" "Field 2" "State"
76   
77   ${if} $R0 == "1"
78     SetShellVarContext all
79     StrCpy $CurrentUserInstall ${FALSE}
80   ${else}
81     SetShellVarContext current
82     StrCpy $CurrentUserInstall ${TRUE}
83   ${endif}
84   
85   Call InitUser
86   
87 FunctionEnd