2007-02-08 21:09:30 +00:00
|
|
|
/*
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
init.nsh
|
|
|
|
|
|
|
|
Initialization function
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
2007-02-26 16:03:30 +00:00
|
|
|
#--------------------------------
|
2008-03-30 21:37:53 +00:00
|
|
|
# Installer initialization
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-04-05 19:12:37 +00:00
|
|
|
!macro PRINTER_INIT
|
|
|
|
|
|
|
|
${If} ${AtLeastWinVista}
|
|
|
|
StrCpy $PrinterConf "printui.exe"
|
|
|
|
${Else}
|
|
|
|
StrCpy $PrinterConf "rundll32.exe printui.dll,PrintUIEntry"
|
|
|
|
${EndIf}
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
2007-02-08 21:09:30 +00:00
|
|
|
Function .onInit
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${IfNot} ${IsNT}
|
|
|
|
${OrIfNot} ${AtLeastWin2000}
|
|
|
|
MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows 2000 or later."
|
|
|
|
Quit
|
|
|
|
${EndIf}
|
|
|
|
|
2008-04-05 19:12:37 +00:00
|
|
|
!insertmacro PRINTER_INIT
|
2008-03-30 21:37:53 +00:00
|
|
|
!insertmacro MULTIUSER_INIT
|
|
|
|
|
2007-02-08 21:09:30 +00:00
|
|
|
${unless} ${silent}
|
|
|
|
Banner::show /NOUNLOAD "Checking system"
|
2008-03-30 21:37:53 +00:00
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
Call SearchExternal
|
|
|
|
Call InitExternal
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
${unless} ${silent}
|
|
|
|
Banner::destroy
|
2008-03-30 21:37:53 +00:00
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function un.onInit
|
|
|
|
|
2008-04-05 19:12:37 +00:00
|
|
|
!insertmacro PRINTER_INIT
|
2008-03-30 21:37:53 +00:00
|
|
|
!insertmacro MULTIUSER_UNINIT
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
FunctionEnd
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
#--------------------------------
|
|
|
|
# User initialization
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
Var ComponentPath
|
|
|
|
Var LyXPath
|
|
|
|
Var LyXLangName
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# COMPONENT can be LaTeX ImageMagick and Ghostscript
|
|
|
|
!macro EXTERNAL_INIT COMPONENT
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# APP_REGKEY_SETUP = "Software\${APP_NAME}${APP_SERIES_KEY}\Setup"
|
|
|
|
# where ${APP_NAME}${APP_SERIES_KEY} is something like LyX16
|
|
|
|
ReadRegStr $ComponentPath SHELL_CONTEXT "${APP_REGKEY_SETUP}" "${COMPONENT} Path"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# BIN_LATEX etc are defined in settings.nsh
|
|
|
|
${If} ${FileExists} "$ComponentPath\${BIN_${COMPONENT}}"
|
|
|
|
# set variables like PathLaTeX
|
|
|
|
StrCpy $Path${COMPONENT} $ComponentPath
|
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
!macroend
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
Function InitUser
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# Get directories of components from registry
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
ReadRegStr $LyXPath SHELL_CONTEXT "${APP_REGKEY}" ""
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${If} $LyXPath != ""
|
|
|
|
StrCpy $INSTDIR $LyXPath
|
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
!insertmacro EXTERNAL_INIT LaTeX
|
|
|
|
!insertmacro EXTERNAL_INIT ImageMagick
|
|
|
|
!insertmacro EXTERNAL_INIT Ghostscript
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# Get LyX language
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
ReadRegStr $LyXLangName SHELL_CONTEXT "${APP_REGKEY_SETUP}" "LyX Language"
|
2007-02-08 21:09:30 +00:00
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
${If} $LyXLangName != ""
|
|
|
|
StrCpy $LangName $LyXLangName
|
|
|
|
${EndIf}
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
FunctionEnd
|