2007-02-08 21:09:30 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
External Components: MiKTeX, ImageMagick, Ghostscript
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
2007-02-26 16:03:30 +00:00
|
|
|
#--------------------------------
|
|
|
|
#Macros
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
!macro SetComponentState VAR COMPONENT
|
|
|
|
|
|
|
|
${if} ${VAR} == "1"
|
|
|
|
|
|
|
|
StrCpy $Setup${COMPONENT} ${TRUE}
|
|
|
|
|
|
|
|
StrCpy $R1 $Size${COMPONENT}
|
|
|
|
|
|
|
|
${if} $Path${COMPONENT} == ""
|
2007-02-26 16:03:30 +00:00
|
|
|
#Add size of component itself
|
2007-02-08 21:09:30 +00:00
|
|
|
IntOp $R1 $R1 + ${SIZE_${COMPONENT}}
|
|
|
|
${endif}
|
|
|
|
|
|
|
|
SectionSetSize ${External${COMPONENT}} $R1
|
|
|
|
|
|
|
|
${else}
|
|
|
|
|
|
|
|
StrCpy $Setup${COMPONENT} ${FALSE}
|
|
|
|
SectionSetSize ${External${COMPONENT}} 0
|
|
|
|
|
|
|
|
${endif}
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
!macro ExternalComponent COMPONENT
|
|
|
|
|
2007-02-26 16:03:30 +00:00
|
|
|
#Action depending on type of installer
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
${if} $Setup${component} == ${TRUE}
|
|
|
|
|
|
|
|
StrCpy $Path${component} "" ;A new one will be installed
|
|
|
|
|
|
|
|
!ifndef SETUPTYPE_BUNDLE
|
|
|
|
!insertmacro DownloadComponent ${component}
|
|
|
|
!else
|
|
|
|
!insertmacro InstallComponent ${component}
|
|
|
|
!endif
|
|
|
|
|
|
|
|
${endif}
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
!macro SetupComponent COMPONENT
|
|
|
|
|
2007-02-26 16:03:30 +00:00
|
|
|
#Run the setup application for a component
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
install_${COMPONENT}:
|
|
|
|
|
|
|
|
ExecWait '"$PLUGINSDIR\${COMPONENT}Setup.exe"'
|
|
|
|
Call UpdatePathEnvironment
|
|
|
|
Call Search${COMPONENT}
|
|
|
|
|
|
|
|
${if} $Path${COMPONENT} == ""
|
|
|
|
MessageBox MB_YESNO|MB_ICONEXCLAMATION $(TEXT_NOTINSTALLED_${COMPONENT}) IDYES install_${COMPONENT}
|
|
|
|
${endif}
|
|
|
|
|
|
|
|
Delete "$PLUGINSDIR\${COMPONENT}Setup.exe"
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
!ifndef SETUPTYPE_BUNDLE
|
|
|
|
|
|
|
|
!macro DownloadComponent COMPONENT
|
|
|
|
|
|
|
|
download_${COMPONENT}:
|
|
|
|
|
2007-07-25 18:42:22 +00:00
|
|
|
!insertmacro DownloadFile $R0 "${COMPONENT}" "${COMPONENT}Setup.exe" ""
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
${if} $R0 != "OK"
|
2007-02-26 16:03:30 +00:00
|
|
|
#Download failed
|
2007-02-08 21:09:30 +00:00
|
|
|
MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_DOWNLOAD_FAILED_${COMPONENT}) ($R0)" IDYES download_${COMPONENT}
|
|
|
|
Goto noinstall_${COMPONENT}
|
|
|
|
${endif}
|
|
|
|
|
|
|
|
!insertmacro SetupComponent ${COMPONENT}
|
|
|
|
|
|
|
|
noinstall_${COMPONENT}:
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
!else
|
|
|
|
|
|
|
|
!macro InstallComponent COMPONENT
|
|
|
|
|
2007-02-26 16:03:30 +00:00
|
|
|
#Extract
|
2007-02-08 21:09:30 +00:00
|
|
|
File /oname=$PLUGINSDIR\${COMPONENT}Setup.exe ${FILES_BUNDLE}\${INSTALL_${COMPONENT}}
|
|
|
|
|
|
|
|
!insertmacro SetupComponent ${COMPONENT}
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
!endif
|
|
|
|
|
|
|
|
!macro DialogExternalControl component
|
|
|
|
|
2007-02-26 16:03:30 +00:00
|
|
|
#Enable/disable the DirRequest control
|
2007-02-08 21:09:30 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "external_${component}.ini" "Field 3" "State"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "external_${component}.ini" "Field 4" "HWND"
|
|
|
|
EnableWindow $R1 $R0
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_READ $R1 "external_${component}.ini" "Field 4" "HWND2"
|
|
|
|
EnableWindow $R1 $R0
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
!macro DialogExternalShow COMPONENT
|
|
|
|
|
|
|
|
!insertmacro MUI_HEADER_TEXT $(TEXT_EXTERNAL_${COMPONENT}_TITLE) $(TEXT_EXTERNAL_${COMPONENT}_SUBTITLE)
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "external_${COMPONENT}.ini"
|
|
|
|
!insertmacro DialogExternalControl ${COMPONENT}
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_SHOW
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
!macro DialogExternalValidate COMPONENT
|
|
|
|
|
|
|
|
Push $R0
|
|
|
|
Push $R1
|
|
|
|
|
2007-02-26 16:03:30 +00:00
|
|
|
#Next button pressed?
|
2007-02-08 21:09:30 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "external_${COMPONENT}.ini" "Settings" "State"
|
|
|
|
${if} $R0 != "0"
|
|
|
|
!insertmacro DialogExternalControl ${COMPONENT}
|
|
|
|
Abort
|
|
|
|
${endif}
|
|
|
|
|
2007-02-26 16:03:30 +00:00
|
|
|
#Download?
|
2007-02-08 21:09:30 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "external_${COMPONENT}.ini" "Field 2" "State"
|
|
|
|
!insertmacro SetComponentState $R0 ${COMPONENT}
|
|
|
|
|
2007-02-26 16:03:30 +00:00
|
|
|
#Folder?
|
2007-02-08 21:09:30 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "external_${COMPONENT}.ini" "Field 3" "State"
|
|
|
|
|
|
|
|
${if} $R0 == "1"
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "external_${COMPONENT}.ini" "Field 4" "State"
|
|
|
|
${unless} ${FileExists} "$R0\${BIN_${COMPONENT}}"
|
|
|
|
MessageBox MB_OK|MB_ICONEXCLAMATION $(TEXT_EXTERNAL_${COMPONENT}_NOTFOUND)
|
|
|
|
Abort
|
|
|
|
${endif}
|
|
|
|
StrCpy $Path${component} $R0
|
|
|
|
${endif}
|
|
|
|
|
|
|
|
Pop $R1
|
|
|
|
Pop $R0
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
2007-02-26 16:03:30 +00:00
|
|
|
#--------------------------------
|
|
|
|
#Sections
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Section -LaTeX ExternalLaTeX
|
|
|
|
!insertmacro ExternalComponent LaTeX
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
Section -ImageMagick ExternalImageMagick
|
|
|
|
!insertmacro ExternalComponent ImageMagick
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
Section -Ghostscript ExternalGhostscript
|
|
|
|
!insertmacro ExternalComponent Ghostscript
|
|
|
|
SectionEnd
|
|
|
|
|
2007-02-26 16:03:30 +00:00
|
|
|
#--------------------------------
|
|
|
|
#Functions
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Function InitSizeExternal
|
|
|
|
|
2007-02-26 16:03:30 +00:00
|
|
|
#Get sizes of external component installers
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
SectionGetSize ${ExternalLaTeX} $SizeLaTeX
|
|
|
|
SectionGetSize ${ExternalImageMagick} $SizeImageMagick
|
|
|
|
SectionGetSize ${ExternalGhostscript} $SizeGhostscript
|
|
|
|
|
|
|
|
!ifndef SETUPTYPE_BUNDLE
|
2007-02-26 16:03:30 +00:00
|
|
|
#Add download size
|
2007-02-08 21:09:30 +00:00
|
|
|
IntOp $SizeLaTeX $SizeLaTeX + ${SIZE_DOWNLOAD_LATEX}
|
|
|
|
IntOp $SizeImagemagick $SizeImagemagick + ${SIZE_DOWNLOAD_IMAGEMAGICK}
|
|
|
|
IntOp $SizeGhostscript $SizeGhostscript + ${SIZE_DOWNLOAD_GHOSTSCRIPT}
|
|
|
|
!endif
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
2007-02-26 16:03:30 +00:00
|
|
|
#--------------------------------
|
|
|
|
#Page functions
|
2007-02-08 21:09:30 +00:00
|
|
|
|
|
|
|
Function PageExternalLaTeX
|
|
|
|
!insertmacro DialogExternalShow LaTeX
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function PageExternalLaTeXValidate
|
|
|
|
!insertmacro DialogExternalValidate LaTeX
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function PageExternalImageMagick
|
|
|
|
!insertmacro DialogExternalShow ImageMagick
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function PageExternalImageMagickValidate
|
|
|
|
!insertmacro DialogExternalValidate ImageMagick
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function PageExternalGhostscript
|
|
|
|
!insertmacro DialogExternalShow Ghostscript
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
Function PageExternalGhostscriptValidate
|
|
|
|
!insertmacro DialogExternalValidate Ghostscript
|
|
|
|
FunctionEnd
|