mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-12 16:50:39 +00:00
Separate out the searching of the registry stuff so that it is all performed in onInit.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@10045 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8ee40f1208
commit
f81ac590cb
@ -16,6 +16,7 @@
|
||||
|
||||
!insertmacro LYX_DEFFUNC `ReadDownloadValues`
|
||||
!insertmacro LYX_DEFFUNC `EnableBrowseControls`
|
||||
!insertmacro LYX_DEFFUNC `SearchRegistry`
|
||||
!insertmacro LYX_DEFFUNC `DownloadEnter`
|
||||
!insertmacro LYX_DEFFUNC `DownloadLeave`
|
||||
|
||||
@ -133,13 +134,65 @@
|
||||
!macroend
|
||||
|
||||
|
||||
!macro DownloadEnter_Private ExePath RegistryKey RegistrySubKey RemoveFromPath AddtoPath Required DownloadLabel HomeLabel PageHeader PageDescription
|
||||
!define skipBackupLbl "skipBackup_${__LINE__}"
|
||||
!macro SearchRegistry_Private ExePath RegistryKey RegistrySubKey RemoveFromPath AddtoPath
|
||||
|
||||
${if} ${ExePath} == ""
|
||||
ReadRegStr ${ExePath} HKLM "${RegistryKey}" "${RegistrySubKey}"
|
||||
${if} ${ExePath} != ""
|
||||
${StrRep} "${ExePath}" "${ExePath}" "${RemoveFromPath}" ""
|
||||
StrCpy ${ExePath} "${ExePath}${AddtoPath}"
|
||||
${endif}
|
||||
${endif}
|
||||
|
||||
!macroend
|
||||
|
||||
|
||||
!macro LYX_FUNCTION_SearchRegistry
|
||||
!insertmacro LYX_FUNC `SearchRegistry`
|
||||
|
||||
; The stack contains:
|
||||
; TOP
|
||||
; ExePath
|
||||
; RegistryKey
|
||||
; RegistrySubKey
|
||||
; RemoveFromPath
|
||||
; AddtoPath
|
||||
|
||||
; After this point:
|
||||
; $0 = ExePath
|
||||
; $1 = RegistryKey
|
||||
; $2 = RegistrySubKey
|
||||
; $3 = RemoveFromPath
|
||||
; $4 = AddtoPath
|
||||
|
||||
Exch $0
|
||||
Exch
|
||||
Exch $1
|
||||
Exch 2
|
||||
Exch $2
|
||||
Exch 3
|
||||
Exch $3
|
||||
Exch 4
|
||||
Exch $4
|
||||
|
||||
; Use a macro simply to make life understandable.
|
||||
!insertmacro SearchRegistry_Private "$0" "$1" "$2" "$3" "$4"
|
||||
|
||||
; Return output to user.
|
||||
Exch $4
|
||||
Exch 4
|
||||
Exch $3
|
||||
Exch 3
|
||||
Exch $2
|
||||
Exch 2
|
||||
Exch $1
|
||||
Exch
|
||||
Exch $0
|
||||
FunctionEnd
|
||||
!macroend
|
||||
|
||||
|
||||
!macro DownloadEnter_Private ExePath Required DownloadLabel HomeLabel PageHeader PageDescription
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioDownload.ini" "Field 1" "Text" ""
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioDownload.ini" "Field 2" "Text" "$(DownloadPageField2)"
|
||||
|
||||
@ -167,8 +220,6 @@
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioDownload.ini" "Field 4" "State" "1"
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioDownload.ini" "Field 5" "Flags" PATH_MUST_EXIST
|
||||
|
||||
${StrRep} "${ExePath}" "${ExePath}" "${RemoveFromPath}" ""
|
||||
StrCpy ${ExePath} "${ExePath}${AddtoPath}"
|
||||
!insertmacro MUI_INSTALLOPTIONS_WRITE "ioDownload.ini" "Field 5" "State" "${ExePath}"
|
||||
${endif}
|
||||
|
||||
@ -176,7 +227,6 @@
|
||||
|
||||
!insertmacro MUI_HEADER_TEXT "${PageHeader}" "${PageDescription}"
|
||||
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioDownload.ini"
|
||||
!undef skipBackupLbl
|
||||
!macroend
|
||||
|
||||
|
||||
@ -186,10 +236,6 @@
|
||||
; The stack contains:
|
||||
; TOP
|
||||
; ExePath
|
||||
; RegistryKey
|
||||
; RegistrySubKey
|
||||
; RemoveFromPath
|
||||
; AddtoPath
|
||||
; Required
|
||||
; DownloadLabel
|
||||
; HomeLabel
|
||||
@ -198,15 +244,11 @@
|
||||
|
||||
; After this point:
|
||||
; $0 = ExePath
|
||||
; $1 = RegistryKey
|
||||
; $2 = RegistrySubKey
|
||||
; $3 = RemoveFromPath
|
||||
; $4 = AddtoPath
|
||||
; $5 = Required
|
||||
; $6 = DownloadLabel
|
||||
; $7 = HomeLabel
|
||||
; $8 = PageHeader
|
||||
; $9 = PageDescription
|
||||
; $1 = Required
|
||||
; $2 = DownloadLabel
|
||||
; $3 = HomeLabel
|
||||
; $4 = PageHeader
|
||||
; $5 = PageDescription
|
||||
|
||||
Exch $0
|
||||
Exch
|
||||
@ -219,27 +261,11 @@
|
||||
Exch $4
|
||||
Exch 5
|
||||
Exch $5
|
||||
Exch 6
|
||||
Exch $6
|
||||
Exch 7
|
||||
Exch $7
|
||||
Exch 8
|
||||
Exch $8
|
||||
Exch 9
|
||||
Exch $9
|
||||
|
||||
; Use a macro simply to make life understandable.
|
||||
!insertmacro DownloadEnter_Private "$0" "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"
|
||||
!insertmacro DownloadEnter_Private "$0" "$1" "$2" "$3" "$4" "$5"
|
||||
|
||||
; Return output to user.
|
||||
Exch $9
|
||||
Exch 9
|
||||
Exch $8
|
||||
Exch 8
|
||||
Exch $7
|
||||
Exch 7
|
||||
Exch $6
|
||||
Exch 6
|
||||
Exch $5
|
||||
Exch 5
|
||||
Exch $4
|
||||
@ -256,7 +282,6 @@
|
||||
|
||||
|
||||
!macro DownloadLeave_Private DoNotRequire Download FolderPath URL EnterFolder ExeName InvalidFolder
|
||||
!define skipBackupLbl "skipBackup_${__LINE__}"
|
||||
!insertmacro MUI_INSTALLOPTIONS_READ $0 "ioDownload.ini" "Settings" "State"
|
||||
|
||||
StrCmp $0 0 go_on ; Next button?
|
||||
@ -293,7 +318,6 @@ go_on:
|
||||
Abort
|
||||
${endif}
|
||||
${endif}
|
||||
!undef skipBackupLbl
|
||||
!macroend
|
||||
|
||||
|
||||
@ -372,17 +396,32 @@ go_on:
|
||||
!macroend
|
||||
|
||||
|
||||
!macro LYX_FUNCTION_DownloadEnter_Call ExePath RegistryKey RegistrySubKey RemoveFromPath AddtoPath Required DownloadLabel HomeLabel PageHeader PageDescription
|
||||
Push `${PageDescription}`
|
||||
Push `${PageHeader}`
|
||||
Push `${HomeLabel}`
|
||||
Push `${DownloadLabel}`
|
||||
Push `${Required}`
|
||||
!macro LYX_FUNCTION_SearchRegistry_Call ExePath RegistryKey RegistrySubKey RemoveFromPath AddtoPath
|
||||
Push `${AddtoPath}`
|
||||
Push `${RemoveFromPath}`
|
||||
Push `${RegistrySubKey}`
|
||||
Push `${RegistryKey}`
|
||||
Push `${ExePath}`
|
||||
|
||||
Call SearchRegistry
|
||||
; Empty the stack of all the stuff we've just added.
|
||||
; We're not interested in most of it, so just fill $0 repeatedly.
|
||||
|
||||
Pop `${ExePath}`
|
||||
Pop `$0`
|
||||
Pop `$0`
|
||||
Pop `$0`
|
||||
Pop `$0`
|
||||
!macroend
|
||||
|
||||
|
||||
!macro LYX_FUNCTION_DownloadEnter_Call ExePath Required DownloadLabel HomeLabel PageHeader PageDescription
|
||||
Push `${PageDescription}`
|
||||
Push `${PageHeader}`
|
||||
Push `${HomeLabel}`
|
||||
Push `${DownloadLabel}`
|
||||
Push `${Required}`
|
||||
Push `${ExePath}`
|
||||
Call DownloadEnter
|
||||
; Empty the stack of all the stuff we've just added.
|
||||
; We're not interested in keeping it, so just fill $0 repeatedly.
|
||||
@ -392,10 +431,6 @@ go_on:
|
||||
Pop `$0`
|
||||
Pop `$0`
|
||||
Pop `$0`
|
||||
Pop `$0`
|
||||
Pop `$0`
|
||||
Pop `$0`
|
||||
Pop `$0`
|
||||
!macroend
|
||||
|
||||
|
||||
|
@ -63,6 +63,7 @@ ${StrRep}
|
||||
${StrTrim}
|
||||
${ReadDownloadValues}
|
||||
${EnableBrowseControls}
|
||||
${SearchRegistry}
|
||||
${DownloadEnter}
|
||||
${DownloadLeave}
|
||||
|
||||
@ -306,21 +307,19 @@ Function .onInit
|
||||
!undef READ_ONLY
|
||||
${endif}
|
||||
|
||||
StrCpy $MinSYSPath ""
|
||||
StrCpy $PythonPath ""
|
||||
StrCpy $MiKTeXPath ""
|
||||
StrCpy $PerlPath ""
|
||||
StrCpy $GhostscriptPath ""
|
||||
StrCpy $ImageMagickPath ""
|
||||
Call SearchMinSYS
|
||||
Call SearchPython
|
||||
Call SearchMiKTeX
|
||||
Call SearchPerl
|
||||
Call SearchGhostscript
|
||||
Call SearchImageMagick
|
||||
|
||||
ClearErrors
|
||||
FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Function DownloadMinSYS
|
||||
StrCpy $DownloadMinSYS "0"
|
||||
|
||||
Function SearchMinSYS
|
||||
; Search the registry for the MinSYS uninstaller.
|
||||
; If successful, put its location in $2.
|
||||
StrCpy $3 "Software\Microsoft\Windows\CurrentVersion\Uninstall"
|
||||
@ -343,9 +342,19 @@ Function DownloadMinSYS
|
||||
Goto loop
|
||||
done:
|
||||
|
||||
${SearchRegistry} \
|
||||
$MinSYSPath \
|
||||
"$2" \
|
||||
"Inno Setup: App Path" \
|
||||
"" \
|
||||
"\bin"
|
||||
FunctionEnd
|
||||
|
||||
Function DownloadMinSYS
|
||||
StrCpy $DownloadMinSYS "0"
|
||||
|
||||
${DownloadEnter} \
|
||||
$MinSYSPath "$2" "Inno Setup: App Path" \
|
||||
"" "\bin" \
|
||||
$MinSYSPath \
|
||||
0 \
|
||||
"$(MinSYSDownloadLabel)" \
|
||||
"$(MinSYSFolderLabel)" \
|
||||
@ -366,12 +375,20 @@ FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Function SearchPython
|
||||
${SearchRegistry} \
|
||||
$PythonPath \
|
||||
"Software\Microsoft\Windows\CurrentVersion\App Paths\Python.exe" \
|
||||
"" \
|
||||
"\Python.exe" \
|
||||
""
|
||||
FunctionEnd
|
||||
|
||||
Function DownloadPython
|
||||
StrCpy $DownloadPython "0"
|
||||
|
||||
${DownloadEnter} \
|
||||
$PythonPath "Software\Microsoft\Windows\CurrentVersion\App Paths\Python.exe" "" \
|
||||
"\Python.exe" "" \
|
||||
$PythonPath \
|
||||
0 \
|
||||
"$(PythonDownloadLabel)" \
|
||||
"$(PythonFolderLabel)" \
|
||||
@ -392,13 +409,21 @@ FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Function SearchMiKTeX
|
||||
${SearchRegistry} \
|
||||
$MiKTeXPath \
|
||||
"Software\MiK\MiKTeX\CurrentVersion\MiKTeX" \
|
||||
"Install Root" \
|
||||
"" \
|
||||
"\miktex\bin"
|
||||
FunctionEnd
|
||||
|
||||
Function DownloadMiKTeX
|
||||
StrCpy $DoNotRequireMiKTeX "1"
|
||||
StrCpy $DownloadMiKTeX "0"
|
||||
|
||||
${DownloadEnter} \
|
||||
$MiKTeXPath "Software\MiK\MiKTeX\CurrentVersion\MiKTeX" "Install Root" \
|
||||
"" "\miktex\bin" \
|
||||
$MiKTeXPath \
|
||||
1 \
|
||||
"$(MiKTeXDownloadLabel)" \
|
||||
"$(MiKTeXFolderLabel)" \
|
||||
@ -419,13 +444,21 @@ FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Function SearchPerl
|
||||
${SearchRegistry} \
|
||||
$PerlPath \
|
||||
"Software\Perl" \
|
||||
BinDir \
|
||||
"\perl.exe" \
|
||||
""
|
||||
FunctionEnd
|
||||
|
||||
Function DownloadPerl
|
||||
StrCpy $DoNotRequirePerl "1"
|
||||
StrCpy $DownloadPerl "1"
|
||||
|
||||
${DownloadEnter} \
|
||||
$PerlPath "Software\Perl" BinDir \
|
||||
"\perl.exe" "" \
|
||||
$PerlPath \
|
||||
1 \
|
||||
"$(PerlDownloadLabel)" \
|
||||
"$(PerlFolderLabel)" \
|
||||
@ -446,6 +479,23 @@ FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Function SearchGhostscript
|
||||
; Find which version of ghostscript, if any, is installed.
|
||||
EnumRegKey $1 HKLM "Software\AFPL Ghostscript" 0
|
||||
${if} $1 != ""
|
||||
StrCpy $0 "Software\AFPL Ghostscript\$1"
|
||||
${else}
|
||||
StrCpy $0 ""
|
||||
${endif}
|
||||
|
||||
${SearchRegistry} \
|
||||
$GhostscriptPath \
|
||||
"$0" \
|
||||
"GS_DLL" \
|
||||
"\gsdll32.dll" \
|
||||
""
|
||||
FunctionEnd
|
||||
|
||||
Function DownloadGhostscript
|
||||
StrCpy $DoNotRequireGhostscript "1"
|
||||
StrCpy $DownloadGhostscript "0"
|
||||
@ -459,8 +509,7 @@ Function DownloadGhostscript
|
||||
${endif}
|
||||
|
||||
${DownloadEnter} \
|
||||
$GhostscriptPath "$0" "GS_DLL" \
|
||||
"\gsdll32.dll" "" \
|
||||
$GhostscriptPath \
|
||||
1 \
|
||||
"$(GhostscriptDownloadLabel)" \
|
||||
"$(GhostscriptFolderLabel)" \
|
||||
@ -481,13 +530,21 @@ FunctionEnd
|
||||
|
||||
;--------------------------------
|
||||
|
||||
Function SearchImageMagick
|
||||
${SearchRegistry} \
|
||||
$ImageMagickPath \
|
||||
"Software\ImageMagick\Current" \
|
||||
"BinPath" \
|
||||
"" \
|
||||
""
|
||||
FunctionEnd
|
||||
|
||||
Function DownloadImageMagick
|
||||
StrCpy $DoNotRequireImageMagick "1"
|
||||
StrCpy $DownloadImageMagick "0"
|
||||
|
||||
${DownloadEnter} \
|
||||
$ImageMagickPath "Software\ImageMagick\Current" "BinPath" \
|
||||
"" "" \
|
||||
$ImageMagickPath \
|
||||
1 \
|
||||
"$(ImageMagickDownloadLabel)" \
|
||||
"$(ImageMagickFolderLabel)" \
|
||||
|
Loading…
Reference in New Issue
Block a user