2006-07-12 11:03:00 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
External Components: MiKTeX, ImageMagick, Ghostscript
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Macros
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
!macro SetComponentState VAR COMPONENT
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
${if} ${VAR} == "1"
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
StrCpy $Setup${COMPONENT} ${TRUE}
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
StrCpy $R1 $Size${COMPONENT}
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
${if} $Path${COMPONENT} == ""
|
2006-07-12 11:03:00 +00:00
|
|
|
;Add size of component itself
|
2006-10-02 17:21:20 +00:00
|
|
|
IntOp $R1 $R1 + ${SIZE_${COMPONENT}}
|
2006-07-12 11:03:00 +00:00
|
|
|
${endif}
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
SectionSetSize ${External${COMPONENT}} $R1
|
2006-07-12 11:03:00 +00:00
|
|
|
|
|
|
|
${else}
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
StrCpy $Setup${COMPONENT} ${FALSE}
|
|
|
|
SectionSetSize ${External${COMPONENT}} 0
|
2006-07-12 11:03:00 +00:00
|
|
|
|
|
|
|
${endif}
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
!macro ExternalComponent COMPONENT
|
2006-07-12 11:03:00 +00:00
|
|
|
|
|
|
|
;Action depending on type of installer
|
|
|
|
|
|
|
|
${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
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
!macro SetupComponent COMPONENT
|
2006-07-12 11:03:00 +00:00
|
|
|
|
|
|
|
;Run the setup application for a component
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
install_${COMPONENT}:
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
ExecWait '"$PLUGINSDIR\${COMPONENT}Setup.exe"'
|
2006-09-22 22:30:06 +00:00
|
|
|
Call UpdatePathEnvironment
|
2006-10-02 17:21:20 +00:00
|
|
|
Call Search${COMPONENT}
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
${if} $Path${COMPONENT} == ""
|
|
|
|
MessageBox MB_YESNO|MB_ICONEXCLAMATION $(TEXT_NOTINSTALLED_${COMPONENT}) IDYES install_${COMPONENT}
|
2006-07-12 11:03:00 +00:00
|
|
|
${endif}
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
Delete "$PLUGINSDIR\${COMPONENT}Setup.exe"
|
2006-07-12 11:03:00 +00:00
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
!ifndef SETUPTYPE_BUNDLE
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
!macro DownloadComponent COMPONENT
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
download_${COMPONENT}:
|
2006-07-12 11:03:00 +00:00
|
|
|
|
|
|
|
;Download using HTTP
|
2006-11-01 22:56:08 +00:00
|
|
|
InetLoad::load "${DOWNLOAD_${COMPONENT}}" "$PLUGINSDIR\${COMPONENT}Setup.exe" /END
|
2006-07-12 11:03:00 +00:00
|
|
|
Pop $R0
|
|
|
|
|
2006-11-01 22:56:08 +00:00
|
|
|
${if} $R0 != "OK"
|
2006-07-12 11:03:00 +00:00
|
|
|
;Download failed
|
2006-10-02 17:21:20 +00:00
|
|
|
MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(TEXT_DOWNLOAD_FAILED_${COMPONENT}) ($R0)" IDYES download_${COMPONENT}
|
|
|
|
Goto noinstall_${COMPONENT}
|
2006-07-12 11:03:00 +00:00
|
|
|
${endif}
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
!insertmacro SetupComponent ${COMPONENT}
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
noinstall_${COMPONENT}:
|
2006-07-12 11:03:00 +00:00
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
!else
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
!macro InstallComponent COMPONENT
|
2006-07-12 11:03:00 +00:00
|
|
|
|
|
|
|
;Extract
|
2006-10-02 17:21:20 +00:00
|
|
|
File /oname=$PLUGINSDIR\${COMPONENT}Setup.exe ${INSTALL_${COMPONENT}}
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
!insertmacro SetupComponent ${COMPONENT}
|
2006-07-12 11:03:00 +00:00
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
!endif
|
|
|
|
|
|
|
|
!macro DialogExternalControl component
|
|
|
|
|
|
|
|
;Enable/disable the DirRequest control
|
|
|
|
!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
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
!macro DialogExternalShow COMPONENT
|
2006-07-12 11:03:00 +00:00
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
!insertmacro MUI_HEADER_TEXT $(TEXT_EXTERNAL_${COMPONENT}_TITLE) $(TEXT_EXTERNAL_${COMPONENT}_SUBTITLE)
|
|
|
|
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "external_${COMPONENT}.ini"
|
|
|
|
!insertmacro DialogExternalControl ${COMPONENT}
|
2006-07-12 11:03:00 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_SHOW
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
2006-10-02 17:21:20 +00:00
|
|
|
!macro DialogExternalValidate COMPONENT
|
2006-07-12 11:03:00 +00:00
|
|
|
|
|
|
|
Push $R0
|
|
|
|
Push $R1
|
|
|
|
|
|
|
|
;Next button pressed?
|
2006-10-02 17:21:20 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "external_${COMPONENT}.ini" "Settings" "State"
|
2006-07-12 11:03:00 +00:00
|
|
|
${if} $R0 != "0"
|
2006-10-02 17:21:20 +00:00
|
|
|
!insertmacro DialogExternalControl ${COMPONENT}
|
2006-07-12 11:03:00 +00:00
|
|
|
Abort
|
|
|
|
${endif}
|
|
|
|
|
|
|
|
;Download?
|
2006-10-02 17:21:20 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "external_${COMPONENT}.ini" "Field 2" "State"
|
|
|
|
!insertmacro SetComponentState $R0 ${COMPONENT}
|
2006-07-12 11:03:00 +00:00
|
|
|
|
|
|
|
;Folder?
|
2006-10-02 17:21:20 +00:00
|
|
|
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "external_${COMPONENT}.ini" "Field 3" "State"
|
2006-07-12 11:03:00 +00:00
|
|
|
|
|
|
|
${if} $R0 == "1"
|
2006-10-02 17:21:20 +00:00
|
|
|
!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)
|
2006-07-12 11:03:00 +00:00
|
|
|
Abort
|
|
|
|
${endif}
|
|
|
|
StrCpy $Path${component} $R0
|
|
|
|
${endif}
|
|
|
|
|
|
|
|
Pop $R1
|
|
|
|
Pop $R0
|
|
|
|
|
|
|
|
!macroend
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Sections
|
|
|
|
|
|
|
|
Section -LaTeX ExternalLaTeX
|
|
|
|
!insertmacro ExternalComponent LaTeX
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
Section -ImageMagick ExternalImageMagick
|
|
|
|
!insertmacro ExternalComponent ImageMagick
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
Section -Ghostscript ExternalGhostscript
|
|
|
|
!insertmacro ExternalComponent Ghostscript
|
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Functions
|
|
|
|
|
|
|
|
Function InitSizeExternal
|
|
|
|
|
|
|
|
;Get sizes of external component installers
|
|
|
|
|
|
|
|
SectionGetSize ${ExternalLaTeX} $SizeLaTeX
|
|
|
|
SectionGetSize ${ExternalImageMagick} $SizeImageMagick
|
|
|
|
SectionGetSize ${ExternalGhostscript} $SizeGhostscript
|
|
|
|
|
|
|
|
!ifndef SETUPTYPE_BUNDLE
|
|
|
|
;Add download size
|
|
|
|
IntOp $SizeLaTeX $SizeLaTeX + ${SIZE_DOWNLOAD_LATEX}
|
|
|
|
IntOp $SizeImagemagick $SizeImagemagick + ${SIZE_DOWNLOAD_IMAGEMAGICK}
|
|
|
|
IntOp $SizeGhostscript $SizeGhostscript + ${SIZE_DOWNLOAD_GHOSTSCRIPT}
|
|
|
|
!endif
|
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Page functions
|
|
|
|
|
|
|
|
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
|