]> git.lyx.org Git - features.git/blob - development/Win32/packaging/installer/include/init.nsh
install and configure application/printer for metafile (EMF/WMF) to EPS conversion
[features.git] / development / Win32 / packaging / installer / include / init.nsh
1 /*
2
3 init.nsh
4
5 Initialization function
6
7 */
8
9 #--------------------------------
10 # Installer initialization
11
12 !macro PRINTER_INIT
13
14   ${If} ${AtLeastWinVista}
15     StrCpy $PrinterConf "printui.exe"
16   ${Else}
17     StrCpy $PrinterConf "rundll32.exe printui.dll,PrintUIEntry"
18   ${EndIf}
19
20 !macroend
21
22 Function .onInit
23
24   ${IfNot} ${IsNT}
25   ${OrIfNot} ${AtLeastWin2000}
26     MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows 2000 or later."
27     Quit
28   ${EndIf}
29
30   !insertmacro PRINTER_INIT
31   !insertmacro MULTIUSER_INIT
32   
33   ${unless} ${silent}
34     Banner::show /NOUNLOAD "Checking system"
35   ${EndIf}
36   
37   Call SearchExternal
38   Call InitExternal
39
40   ${unless} ${silent}
41     Banner::destroy
42   ${EndIf}
43
44 FunctionEnd
45
46 Function un.onInit
47
48   !insertmacro PRINTER_INIT
49   !insertmacro MULTIUSER_UNINIT
50
51 FunctionEnd
52
53 #--------------------------------
54 # User initialization
55
56 Var ComponentPath
57 Var LyXPath
58 Var LyXLangName
59
60 # COMPONENT can be LaTeX ImageMagick and Ghostscript
61 !macro EXTERNAL_INIT COMPONENT
62
63   # APP_REGKEY_SETUP = "Software\${APP_NAME}${APP_SERIES_KEY}\Setup"
64   # where ${APP_NAME}${APP_SERIES_KEY} is something like LyX16
65   ReadRegStr $ComponentPath SHELL_CONTEXT "${APP_REGKEY_SETUP}" "${COMPONENT} Path"
66   
67   # BIN_LATEX etc are defined in settings.nsh
68   ${If} ${FileExists} "$ComponentPath\${BIN_${COMPONENT}}"
69     # set variables like PathLaTeX
70     StrCpy $Path${COMPONENT} $ComponentPath
71   ${EndIf}
72
73 !macroend
74
75 Function InitUser
76
77   # Get directories of components from registry
78
79   ReadRegStr $LyXPath SHELL_CONTEXT "${APP_REGKEY}" ""
80   
81   ${If} $LyXPath != ""
82     StrCpy $INSTDIR $LyXPath
83   ${EndIf}
84
85   !insertmacro EXTERNAL_INIT LaTeX
86   !insertmacro EXTERNAL_INIT ImageMagick
87   !insertmacro EXTERNAL_INIT Ghostscript
88   
89   # Get LyX language
90   
91   ReadRegStr $LyXLangName SHELL_CONTEXT "${APP_REGKEY_SETUP}" "LyX Language"
92   
93   ${If} $LyXLangName != ""
94     StrCpy $LangName $LyXLangName
95   ${EndIf}
96   
97 FunctionEnd