]> git.lyx.org Git - features.git/commitdiff
installer infrastructure changes according to Christian's comments
authorUwe Stöhr <uwestoehr@web.de>
Mon, 16 Apr 2007 22:33:53 +0000 (22:33 +0000)
committerUwe Stöhr <uwestoehr@web.de>
Mon, 16 Apr 2007 22:33:53 +0000 (22:33 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@17832 a592a061-630c-0410-9148-cb99ea01b6c8

development/Win32/packaging/installer/LyXWinInstaller/Changelog.txt
development/Win32/packaging/installer/LyXWinInstaller/ConfigLyX.nsh [new file with mode: 0644]
development/Win32/packaging/installer/LyXWinInstaller/Editors.nsh [new file with mode: 0644]
development/Win32/packaging/installer/LyXWinInstaller/InstallActions-complete.nsh
development/Win32/packaging/installer/LyXWinInstaller/InstallActions-small.nsh
development/Win32/packaging/installer/LyXWinInstaller/LaTeX.nsh [new file with mode: 0644]
development/Win32/packaging/installer/LyXWinInstaller/LyX-Installer-Complete.nsi
development/Win32/packaging/installer/LyXWinInstaller/LyX-Installer-Small.nsi
development/Win32/packaging/installer/LyXWinInstaller/LyXUtils.nsh
development/Win32/packaging/installer/LyXWinInstaller/MissingPrograms.nsh
development/Win32/packaging/installer/LyXWinInstaller/Uninstall.nsh

index 67bb812acdc606bebee8746e10d1b2647dfbcff6..122d9ef287f1cf0b8a8dd5a2a76d9ac73bab867a 100644 (file)
@@ -11,6 +11,8 @@
 - add missing math fonts
 - name desktop icon according to the version to avoid interferences
   with other installed LyX-versions
+- only uninstall stuff that was installed together with the current LyX
+  version and not together with other installed LyX versions
 
 - New installer Version "Update" available. With this you don't need to
   reinstall LyX when you have the previous version "LyX 1.5svn-09-04-2007"
diff --git a/development/Win32/packaging/installer/LyXWinInstaller/ConfigLyX.nsh b/development/Win32/packaging/installer/LyXWinInstaller/ConfigLyX.nsh
new file mode 100644 (file)
index 0000000..261b7e1
--- /dev/null
@@ -0,0 +1,112 @@
+Function ConfigureLyX
+ ; configures LyX
+
+  ; create the PathPrefix
+  StrCpy $PathPrefix "$INSTDIR\bin"
+  ${if} $PythonPath != ""
+    StrCpy $PathPrefix "$PathPrefix;$PythonPath"
+  ${endif}
+  ${if} $LatexPath != ""
+    StrCpy $PathPrefix "$PathPrefix;$LatexPath"
+  ${endif}
+  ${if} $GhostscriptPath != ""
+    StrCpy $PathPrefix "$PathPrefix;$GhostscriptPath"
+  ${endif}
+  ${if} $ImageMagickPath != ""
+    StrCpy $PathPrefix "$PathPrefix;$ImageMagickPath"
+  ${endif}
+  ${if} $PSVPath != ""
+    StrCpy $PathPrefix "$PathPrefix;$PSVPath"
+  ${endif}
+  ${if} $EditorPath != ""
+    StrCpy $PathPrefix "$PathPrefix;$EditorPath"
+  ${endif}
+  ${if} $ImageEditorPath != ""
+    StrCpy $PathPrefix "$PathPrefix;$ImageEditorPath"
+  ${endif}
+  
+  ; Set a path prefix in lyxrc.dist
+  ClearErrors
+  ${if} "$PathPrefix" != ""
+   Delete "$INSTDIR\Resources\lyxrc.dist"
+   FileOpen $R1 "$INSTDIR\Resources\lyxrc.dist" w
+   FileWrite $R1 '\path_prefix "$PathPrefix"$\r$\n'
+   FileClose $R1
+   IfErrors 0 +2
+    MessageBox MB_OK|MB_ICONEXCLAMATION "$(ModifyingConfigureFailed)"
+  ${endif}
+
+  ; Create a batch file to start LyX with the environment variables set
+  ClearErrors
+  Delete "${PRODUCT_BAT}"
+  FileOpen $R1 "${PRODUCT_BAT}" w
+  FileWrite $R1 '@echo off$\r$\n\
+                SET LANG=$LangCode$\r$\n\
+                SET AIK_DATA_DIR=${AiksaurusDir}$\r$\n\
+                start "LyX" "lyx.exe" %*$\r$\n'
+  FileClose $R1
+  IfErrors 0 +2
+   MessageBox MB_OK|MB_ICONEXCLAMATION "$(CreateCmdFilesFailed)"
+
+  ; set the preferences file
+  ; (having one preferences file that is modified to fit the needs is possible but not easy to maintain
+  ; therefore simply delete the files that shouldn't be used)
+  ; if not Acrobat or Adobe Reader is used
+  ${if} $Acrobat == "None" ; clear the entries in the preferences file that define PDFViewWin7 or 8 as viewer
+   Rename "$INSTDIR\Resources\preferencesGSview" "$INSTDIR\Resources\preferences"
+   Delete "$INSTDIR\Resources\preferences7"
+   Delete "$INSTDIR\Resources\preferences8"
+  ${endif}
+  ; if Acrobat or Adobe Reader is used
+  ${if} $Acrobat == "7" ; used for all Acrobat (Adobe Reader) versions <= 7
+   Rename "$INSTDIR\Resources\preferences7" "$INSTDIR\Resources\preferences"
+   Delete "$INSTDIR\Resources\preferences8"
+   Delete "$INSTDIR\Resources\preferencesGSview"
+  ${endif}
+  ${if} $Acrobat == "8"
+   Rename "$INSTDIR\Resources\preferences8" "$INSTDIR\Resources\preferences"
+   Delete "$INSTDIR\Resources\preferences7"
+   Delete "$INSTDIR\Resources\preferencesGSview"
+  ${endif}
+
+  ; register LyX
+  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "${PRODUCT_EXE}"
+  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "RootKey" "$ProductRootKey"
+  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
+  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "${PRODUCT_UNINSTALL_EXE}"
+  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "${PRODUCT_EXE}"
+  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
+  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
+  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_INFO_URL}"
+  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_ABOUT_URL}"
+  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "LyX Team"
+  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "HelpLink" "${PRODUCT_HELP_LINK}"
+  WriteRegDWORD ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoModify" 0x00000001
+  WriteRegDWORD ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoRepair" 0x00000001
+
+  ; create start menu entry
+  SetOutPath "$INSTDIR\bin"
+  CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
+  CreateShortCut "$SMPROGRAMS\$StartmenuFolder\${PRODUCT_NAME}.lnk" "${PRODUCT_BAT}" "" "${PRODUCT_EXE}"
+  SetOutPath "$INSTDIR"
+  CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Uninstall.lnk" "${PRODUCT_UNINSTALL_EXE}"
+
+  ; create desktop icon
+  ${if} $CreateDesktopIcon == "true"
+   SetOutPath "$INSTDIR\bin"
+   CreateShortCut "$DESKTOP\LyX ${PRODUCT_VERSION}.lnk" "${PRODUCT_BAT}" "" "${PRODUCT_EXE}"
+  ${endif}
+
+  ; register the extension .lyx
+  ${if} $CreateFileAssociations == "true"
+   ${CreateApplicationAssociation} "${PRODUCT_NAME}" "${PRODUCT_NAME}" "$(FileTypeTitle)" "${PRODUCT_EXE}" "${PRODUCT_BAT}"
+   ${CreateFileAssociation} "${PRODUCT_EXT}" "${PRODUCT_NAME}" "${PRODUCT_MIME_TYPE}"
+  ${endif}
+
+  ; create the LyX Application Data folder for all users
+  ; this folder is automatically created by LyX when it is first started but we want to start LyX with a specific session file,
+  ; so we create this folder before LyX starts and copy there the session file
+  Call CreateAppPathSub ; function from LyXUtils.nsh
+
+FunctionEnd
+
diff --git a/development/Win32/packaging/installer/LyXWinInstaller/Editors.nsh b/development/Win32/packaging/installer/LyXWinInstaller/Editors.nsh
new file mode 100644 (file)
index 0000000..031f745
--- /dev/null
@@ -0,0 +1,88 @@
+Function EditorCheck
+
+  ; test if an editor with syntax-highlighting for LaTeX-files is installed
+  ; (check for jEdit, PSPad, WinShell, ConTEXT, Crimson Editor, Vim, TeXnicCenter, LaTeXEditor, WinEdt, LEd, WinTeX)
+  StrCpy $EditorPath ""
+  StrCpy $0 ""
+  ; check for jEdit
+  ReadRegStr $EditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\jEdit_is1" "InstallLocation"
+  ${if} $EditorPath != ""
+   StrCpy $EditorPath $EditorPath -1 ; remove "\" from the end of the string
+  ${endif}
+  ; check for PSPad
+  StrCpy $0 ""
+  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PSPad editor_is1" "InstallLocation"
+  ${if} $0 != ""
+   StrCpy $0 $0 -1
+   StrCpy $EditorPath "$EditorPath;$0"
+  ${endif}
+  ; check for WinShell
+  StrCpy $0 ""
+  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinShell_is1" "InstallLocation"
+  ${if} $0 != ""
+   StrCpy $0 $0 -1
+   StrCpy $EditorPath "$EditorPath;$0"
+  ${endif}
+  ; check for ConTEXT
+  StrCpy $0 ""
+  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ConTEXTEditor_is1" "InstallLocation"
+  ${if} $0 != ""
+   StrCpy $0 $0 -1
+   StrCpy $EditorPath "$EditorPath;$0"
+  ${endif}
+  ; check for Crimson Editor
+  StrCpy $0 ""
+  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Crimson Editor" "UninstallString"
+  ${if} $0 != ""
+   StrCpy $0 $0 -14 ; remove "\uninstall.exe"
+   StrCpy $EditorPath "$EditorPath;$0"
+  ${endif}
+  ; check for Vim 6.x
+  StrCpy $0 ""
+  ReadRegStr $0 HKLM "Software\Classes\Applications\gvim.exe\shell\edit\command" ""
+  ${if} $0 != ""
+   StrCpy $0 $0 -13 ; remove "gvim.exe "%1""
+   StrCpy $EditorPath "$EditorPath;$0"
+  ${endif}
+  ; check for Vim 7.0
+  StrCpy $0 ""
+  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Vim 7.0" "UninstallString"
+  ${if} $0 != ""
+   StrCpy $0 $0 -18 ; remove "\uninstall-gui.exe"
+   StrCpy $EditorPath "$EditorPath;$0"
+  ${endif}
+  ; check for TeXnicCenter
+  StrCpy $0 ""
+  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TeXnicCenter_is1" "Inno Setup: App Path"
+  ${if} $0 != ""
+   StrCpy $EditorPath "$EditorPath;$0"
+  ${endif}
+  ; check for LaTeXEditor
+  StrCpy $0 ""
+  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LaTeX Editor" "InstallLocation"
+  ${if} $0 != ""
+   StrCpy $EditorPath "$EditorPath;$0"
+  ${endif}
+  ; check for WinEdt
+  StrCpy $0 ""
+  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinEdt_is1" "InstallLocation"
+  ${if} $0 != ""
+   StrCpy $0 $0 -1
+   StrCpy $EditorPath "$EditorPath;$0"
+  ${endif}
+  ; check for LEd
+  StrCpy $0 ""
+  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LEd_is1" "InstallLocation"
+  ${if} $0 != ""
+   StrCpy $0 $0 -1
+   StrCpy $EditorPath "$EditorPath;$0"
+  ${endif}
+  ; check for WinTeX
+  StrCpy $0 ""
+  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinTeX XP" "DisplayIcon"
+  ${if} $0 != ""
+   StrCpy $0 $0 -11 ; remove "\wintex.exe"
+   StrCpy $EditorPath "$EditorPath;$0"
+  ${endif}
+
+FunctionEnd
index 55b4827171d7b3a180a211fb88208cbbc94ea07a..f30b4ccab040aa67d17d837dfee39e72284f0732 100644 (file)
@@ -2,6 +2,7 @@
 ; Sections are entered in order, so the settings above are all
 ; available to SecInstallation
 Section "-Installation actions" SecInstallation
+
   ; extract all files
   SetOutPath "$INSTDIR"
   File /r "${PRODUCT_SOURCEDIR}\bin"
@@ -135,182 +136,18 @@ Section "-Installation actions" SecInstallation
    ${endif}
   ${endif}
 
-  ; create the PathPrefix
-  StrCpy $PathPrefix "$INSTDIR\bin"
-  ${if} $PythonPath != ""
-    StrCpy $PathPrefix "$PathPrefix;$PythonPath"
-  ${endif}
-  ${if} $LatexPath != ""
-    StrCpy $PathPrefix "$PathPrefix;$LatexPath"
-  ${endif}
-  ${if} $GhostscriptPath != ""
-    StrCpy $PathPrefix "$PathPrefix;$GhostscriptPath"
-  ${endif}
-  ${if} $ImageMagickPath != ""
-    StrCpy $PathPrefix "$PathPrefix;$ImageMagickPath"
-  ${endif}
-  ${if} $PSVPath != ""
-    StrCpy $PathPrefix "$PathPrefix;$PSVPath"
-  ${endif}
-  ${if} $EditorPath != ""
-    StrCpy $PathPrefix "$PathPrefix;$EditorPath"
-  ${endif}
-  ${if} $ImageEditorPath != ""
-    StrCpy $PathPrefix "$PathPrefix;$ImageEditorPath"
-  ${endif}
-
   ; install the LaTeX class files that are delivered with LyX
   ; and enable MiKTeX's automatic package installation
-  StrCpy $String $LatexPath
-  StrCpy $Search "miktex\bin"
-  StrLen $3 $String
-  Call StrPoint ; search the LaTeXPath for the phrase "miktex\bin" (function from LyXUtils.nsh)
-  ${if} $Pointer != "-1" ; if something was found
-   IntOp $Pointer $Pointer - 1 ; jump before the first "\" of "\miktex\bin"
-   StrCpy $String $String "$Pointer" ; $String is now the part before "\miktex\bin"
-   ; install LaTeX class files
-   SetOutPath "$String\tex\latex"
-   File "${ClassFileDir}\cv.cls"
-   CreateDirectory "$String\tex\latex\lyx"
-   SetOutPath "$String\tex\latex\lyx"
-   File "${ClassFileDir}\lyxchess.sty"
-   File "${ClassFileDir}\lyxskak.sty"
-   CreateDirectory "$String\tex\latex\revtex"
-   SetOutPath "$String\tex\latex\revtex"
-   File "${ClassFileDir}\revtex.cls"
-   CreateDirectory "$String\tex\latex\hollywood"
-   SetOutPath "$String\tex\latex\hollywood"
-   File "${ClassFileDir}\hollywood.cls"
-   CreateDirectory "$String\tex\latex\broadway"
-   SetOutPath "$String\tex\latex\broadway"
-   File "${ClassFileDir}\broadway.cls"
-   ; install LaTeX-package dvipost (dvipost is not available for MiKTeX)
-   SetOutPath "$String\tex\latex\"
-   File /r "${DVIPostFileDir}"
-
-   ${if} $MiKTeXVersion == "2.4"
-    ; refresh MiKTeX's file name database
-    ExecWait "$String\miktex\bin\initexmf --update-fndb"
-    ; delete MiKTeX 2.4's dvipng executable as it is an old broken version. Then install a working one.
-    Delete "$String\miktex\bin\dvipng.exe"
-    ; Install a new one
-    SetOutPath "$String\miktex\bin"
-    File "${PRODUCT_DIR}\LyX\external\dvipng.exe"
-    ; enable package installation without asking (1=Yes, 0=No, 2=Always Ask Before Installing)                                             
-    WriteRegStr HKCU "SOFTWARE\MiK\MiKTeX\CurrentVersion\MiKTeX" "InstallPackagesOnTheFly" "1"
-    WriteRegStr HKCU "SOFTWARE\MiK\MiKTeX\CurrentVersion\MPM\Settings" "" ""
-    ; Setting package repository (MiKTeX's primary package repository)
-    WriteRegStr HKCU "SOFTWARE\MiK\MiKTeX\CurrentVersion\MPM" "RemotePackageRepository" "${MiKTeXRepo}"
-   
-   ${else} ; if MiKTeX 2.5
-    ; refresh MiKTeX's file name database
-    ExecWait "$LaTeXPath\initexmf --update-fndb"
-    ; enable package installation without asking (t = Yes, f = No)
-    WriteRegStr HKCU "SOFTWARE\MiKTeX.org\MiKTeX\2.5\MPM" "AutoInstall" "1" ; if only for curent user
-    WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "MIKTEX_AUTOINSTALL" "t"
-    ; set package repository (MiKTeX's primary package repository)
-    WriteRegStr HKCU "SOFTWARE\MiKTeX.org\MiKTeX\2.5\MPM" "RemoteRepository" "${MiKTeXRepo}" ; if only for curent user
-    WriteRegStr HKCU "SOFTWARE\MiKTeX.org\MiKTeX\2.5\MPM" "RepositoryType" "remote" ; if only for curent user
-    WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "MIKTEX_REPOSITORY" "${MiKTeXRepo}"
-   ${endif}
-   
-   ; enable MiKTeX's automatic package installation
-   ExecWait '$LaTeXPath\mpm.com --update-fndb'
-; the following feature is planned to be used for a possible CD-version
-;   ; copy LaTeX-packages needed by LyX
-;   SetOutPath "$INSTDIR"
-;   File /r "${LaTeXPackagesDir}" 
-  ${endif} ; end ${if} $Pointer
+  Call ConfigureMiKTeX ; Function from LaTeX.nsh
 
   ; install Aspell dictionaries
   ${if} $LangCode == "nb_NO"
    StrCpy $LangCode "no_NO" ; we only have a norwegian dictionary available
   ${endif}
-  Call InstallAspellDictionary ; function from aspell.nsh
+  Call InstallAspellDictionary ; function from Aspell.nsh
 
   ; configure LyX
-  ; Set a path prefix in lyxrc.dist
-  ClearErrors
-  ${if} "$PathPrefix" != ""
-   Delete "$INSTDIR\Resources\lyxrc.dist"
-   FileOpen $R1 "$INSTDIR\Resources\lyxrc.dist" w
-   FileWrite $R1 '\path_prefix "$PathPrefix"$\r$\n'
-   FileClose $R1
-   IfErrors 0 +2
-    MessageBox MB_OK|MB_ICONEXCLAMATION "$(ModifyingConfigureFailed)"
-  ${endif}
-
-  ; Create a batch file to start LyX with the environment variables set
-  ClearErrors
-  Delete "${PRODUCT_BAT}"
-  FileOpen $R1 "${PRODUCT_BAT}" w
-  FileWrite $R1 '@echo off$\r$\n\
-                SET LANG=$LangCode$\r$\n\
-                SET AIK_DATA_DIR=${AiksaurusDir}$\r$\n\
-                start "LyX" "lyx.exe" %*$\r$\n'
-  FileClose $R1
-  IfErrors 0 +2
-   MessageBox MB_OK|MB_ICONEXCLAMATION "$(CreateCmdFilesFailed)"
-
-  ; set the preferences file
-  ; (having one preferences file that is modified to fit the needs is possible but not easy to maintain
-  ; therefore simply delete the files that shouldn't be used)
-  ; if not Acrobat or Adobe Reader is used
-  ${if} $Acrobat == "None" ; clear the entries in the preferences file that define PDFViewWin7 or 8 as viewer
-   Rename "$INSTDIR\Resources\preferencesGSview" "$INSTDIR\Resources\preferences"
-   Delete "$INSTDIR\Resources\preferences7"
-   Delete "$INSTDIR\Resources\preferences8"
-  ${endif}
-  ; if Acrobat or Adobe Reader is used
-  ${if} $Acrobat == "7" ; used for all Acrobat (Adobe Reader) versions <= 7
-   Rename "$INSTDIR\Resources\preferences7" "$INSTDIR\Resources\preferences"
-   Delete "$INSTDIR\Resources\preferences8"
-   Delete "$INSTDIR\Resources\preferencesGSview"
-  ${endif}
-  ${if} $Acrobat == "8"
-   Rename "$INSTDIR\Resources\preferences8" "$INSTDIR\Resources\preferences"
-   Delete "$INSTDIR\Resources\preferences7"
-   Delete "$INSTDIR\Resources\preferencesGSview"
-  ${endif}
-
-  ; register LyX
-  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "${PRODUCT_EXE}"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "RootKey" "$ProductRootKey"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "${PRODUCT_UNINSTALL_EXE}"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "${PRODUCT_EXE}"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_INFO_URL}"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_ABOUT_URL}"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "LyX Team"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "HelpLink" "${PRODUCT_HELP_LINK}"
-  WriteRegDWORD ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoModify" 0x00000001
-  WriteRegDWORD ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoRepair" 0x00000001
-
-  ; create start menu entry
-  SetOutPath "$INSTDIR\bin"
-  CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
-  CreateShortCut "$SMPROGRAMS\$StartmenuFolder\${PRODUCT_NAME}.lnk" "${PRODUCT_BAT}" "" "${PRODUCT_EXE}"
-  SetOutPath "$INSTDIR"
-  CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Uninstall.lnk" "${PRODUCT_UNINSTALL_EXE}"
-
-  ; create desktop icon
-  ${if} $CreateDesktopIcon == "true"
-   SetOutPath "$INSTDIR\bin"
-   CreateShortCut "$DESKTOP\LyX ${PRODUCT_VERSION}.lnk" "${PRODUCT_BAT}" "" "${PRODUCT_EXE}"
-  ${endif}
-
-  ; register the extension .lyx
-  ${if} $CreateFileAssociations == "true"
-   ${CreateApplicationAssociation} "${PRODUCT_NAME}" "${PRODUCT_NAME}" "$(FileTypeTitle)" "${PRODUCT_EXE}" "${PRODUCT_BAT}"
-   ${CreateFileAssociation} "${PRODUCT_EXT}" "${PRODUCT_NAME}" "${PRODUCT_MIME_TYPE}"
-  ${endif}
-
-  ; create the LyX Application Data folder for all users
-  ; this folder is automatically created by LyX when it is first started but we want to start LyX with a specific session file,
-  ; so we create this folder before LyX starts and copy there the session file
-  Call CreateAppPathSub ; function from LyXUtils.nsh
+  Call ConfigureLyX ; Function from ConfigLyX.nsh
 
   ; delete unnecessary files
   ${if} $DelPythonFiles == "True"
index 7c5359f2e122157be0b230b7c8cea414316eed23..ff17f4bf3c9fd2484d12ab36ec847f0994f7684b 100644 (file)
@@ -2,6 +2,7 @@
 ; Sections are entered in order, so the settings above are all
 ; available to SecInstallation
 Section "-Installation actions" SecInstallation
+
   ; extract all files
   SetOutPath "$INSTDIR"
   File /r "${PRODUCT_SOURCEDIR}\bin"
@@ -73,178 +74,18 @@ Section "-Installation actions" SecInstallation
 ;   WriteRegStr HKLM "Software\Aiksaurus" "Data Path" "${AiksaurusDir}"
   ${endif}
 
-  ; create the PathPrefix
-  StrCpy $PathPrefix "$INSTDIR\bin"
-  ${if} $PythonPath != ""
-    StrCpy $PathPrefix "$PathPrefix;$PythonPath"
-  ${endif}
-  ${if} $LatexPath != ""
-    StrCpy $PathPrefix "$PathPrefix;$LatexPath"
-  ${endif}
-  ${if} $GhostscriptPath != ""
-    StrCpy $PathPrefix "$PathPrefix;$GhostscriptPath"
-  ${endif}
-  ${if} $ImageMagickPath != ""
-    StrCpy $PathPrefix "$PathPrefix;$ImageMagickPath"
-  ${endif}
-  ${if} $PSVPath != ""
-    StrCpy $PathPrefix "$PathPrefix;$PSVPath"
-  ${endif}
-  ${if} $EditorPath != ""
-    StrCpy $PathPrefix "$PathPrefix;$EditorPath"
-  ${endif}
-  ${if} $ImageEditorPath != ""
-    StrCpy $PathPrefix "$PathPrefix;$ImageEditorPath"
-  ${endif}
-
   ; install the LaTeX class files that are delivered with LyX
   ; and enable MiKTeX's automatic package installation
-  StrCpy $String $LatexPath
-  StrCpy $Search "miktex\bin"
-  StrLen $3 $String
-  Call StrPoint ; search the LaTeXPath for the phrase "miktex\bin" (function from LyXUtils.nsh)
-  ${if} $Pointer != "-1" ; if something was found
-   IntOp $Pointer $Pointer - 1 ; jump before the first "\" of "\miktex\bin"
-   StrCpy $String $String "$Pointer" ; $String is now the part before "\miktex\bin"
-   ; install LaTeX class files
-   SetOutPath "$String\tex\latex"
-   File "${ClassFileDir}\cv.cls"
-   CreateDirectory "$String\tex\latex\lyx"
-   SetOutPath "$String\tex\latex\lyx"
-   File "${ClassFileDir}\lyxchess.sty"
-   File "${ClassFileDir}\lyxskak.sty"
-   CreateDirectory "$String\tex\latex\revtex"
-   SetOutPath "$String\tex\latex\revtex"
-   File "${ClassFileDir}\revtex.cls"
-   CreateDirectory "$String\tex\latex\hollywood"
-   SetOutPath "$String\tex\latex\hollywood"
-   File "${ClassFileDir}\hollywood.cls"
-   CreateDirectory "$String\tex\latex\broadway"
-   SetOutPath "$String\tex\latex\broadway"
-   File "${ClassFileDir}\broadway.cls"
-   ; install LaTeX-package dvipost (dvipost is not available for MiKTeX)
-   SetOutPath "$String\tex\latex\"
-   File /r "${DVIPostFileDir}"
-
-   ${if} $MiKTeXVersion == "2.4"
-    ; refresh MiKTeX's file name database
-    ExecWait "$String\miktex\bin\initexmf --update-fndb"
-    ; delete MiKTeX 2.4's dvipng executable as it is an old broken version. Then install a working one.
-    Delete "$String\miktex\bin\dvipng.exe"
-    ; Install a new one
-    SetOutPath "$String\miktex\bin"
-    File "${PRODUCT_DIR}\LyX\external\dvipng.exe"
-    ; enable package installation without asking (1=Yes, 0=No, 2=Always Ask Before Installing)                                             
-    WriteRegStr HKCU "SOFTWARE\MiK\MiKTeX\CurrentVersion\MiKTeX" "InstallPackagesOnTheFly" "1"
-    WriteRegStr HKCU "SOFTWARE\MiK\MiKTeX\CurrentVersion\MPM\Settings" "" ""
-    ; Setting package repository (MiKTeX's primary package repository)
-    WriteRegStr HKCU "SOFTWARE\MiK\MiKTeX\CurrentVersion\MPM" "RemotePackageRepository" "${MiKTeXRepo}"
-   
-   ${else} ; if MiKTeX 2.5
-    ; refresh MiKTeX's file name database
-    ExecWait "$LaTeXPath\initexmf --update-fndb"
-    ; enable package installation without asking (t = Yes, f = No)
-    WriteRegStr HKCU "SOFTWARE\MiKTeX.org\MiKTeX\2.5\MPM" "AutoInstall" "1" ; if only for curent user
-    WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "MIKTEX_AUTOINSTALL" "t"
-    ; set package repository (MiKTeX's primary package repository)
-    WriteRegStr HKCU "SOFTWARE\MiKTeX.org\MiKTeX\2.5\MPM" "RemoteRepository" "${MiKTeXRepo}" ; if only for curent user
-    WriteRegStr HKCU "SOFTWARE\MiKTeX.org\MiKTeX\2.5\MPM" "RepositoryType" "remote" ; if only for curent user
-    WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "MIKTEX_REPOSITORY" "${MiKTeXRepo}"
-   ${endif}
-   
-   ; enable MiKTeX's automatic package installation
-   ExecWait '$LaTeXPath\mpm.com --update-fndb'
-  ${endif} ; end ${if} $Pointer
+  Call ConfigureMiKTeX ; Function from LaTeX.nsh
 
   ; install Aspell dictionaries
   ${if} $LangCode == "nb_NO"
    StrCpy $LangCode "no_NO" ; we only have a norwegian dictionary available
   ${endif}
-  Call InstallAspellDictionary ; function from aspell.nsh
+  Call InstallAspellDictionary ; function from Aspell.nsh
 
   ; configure LyX
-  ; Set a path prefix in lyxrc.dist
-  ClearErrors
-  ${if} "$PathPrefix" != ""
-   Delete "$INSTDIR\Resources\lyxrc.dist"
-   FileOpen $R1 "$INSTDIR\Resources\lyxrc.dist" w
-   FileWrite $R1 '\path_prefix "$PathPrefix"$\r$\n'
-   FileClose $R1
-   IfErrors 0 +2
-    MessageBox MB_OK|MB_ICONEXCLAMATION "$(ModifyingConfigureFailed)"
-  ${endif}
-
-  ; Create a batch file to start LyX with the environment variables set
-  ClearErrors
-  Delete "${PRODUCT_BAT}"
-  FileOpen $R1 "${PRODUCT_BAT}" w
-  FileWrite $R1 '@echo off$\r$\n\
-                SET LANG=$LangCode$\r$\n\
-                SET AIK_DATA_DIR=${AiksaurusDir}$\r$\n\
-                start "LyX" "lyx.exe" %*$\r$\n'
-  FileClose $R1
-  IfErrors 0 +2
-   MessageBox MB_OK|MB_ICONEXCLAMATION "$(CreateCmdFilesFailed)"
-
-  ; set the preferences file
-  ; (having one preferences file that is modified to fit the needs is possible but not easy to maintain
-  ; therefore simply delete the files that shouldn't be used)
-  ; if not Acrobat or Adobe Reader is used
-  ${if} $Acrobat == "None" ; clear the entries in the preferences file that define PDFViewWin7 or 8 as viewer
-   Rename "$INSTDIR\Resources\preferencesGSview" "$INSTDIR\Resources\preferences"
-   Delete "$INSTDIR\Resources\preferences7"
-   Delete "$INSTDIR\Resources\preferences8"
-  ${endif}
-  ; if Acrobat or Adobe Reader is used
-  ${if} $Acrobat == "7" ; used for all Acrobat (Adobe Reader) versions <= 7
-   Rename "$INSTDIR\Resources\preferences7" "$INSTDIR\Resources\preferences"
-   Delete "$INSTDIR\Resources\preferences8"
-   Delete "$INSTDIR\Resources\preferencesGSview"
-  ${endif}
-  ${if} $Acrobat == "8"
-   Rename "$INSTDIR\Resources\preferences8" "$INSTDIR\Resources\preferences"
-   Delete "$INSTDIR\Resources\preferences7"
-   Delete "$INSTDIR\Resources\preferencesGSview"
-  ${endif}
-
-  ; register LyX
-  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "${PRODUCT_EXE}"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "RootKey" "$ProductRootKey"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "${PRODUCT_UNINSTALL_EXE}"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "${PRODUCT_EXE}"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_INFO_URL}"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_ABOUT_URL}"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "LyX Team"
-  WriteRegStr ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "HelpLink" "${PRODUCT_HELP_LINK}"
-  WriteRegDWORD ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoModify" 0x00000001
-  WriteRegDWORD ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "NoRepair" 0x00000001
-
-  ; create start menu entry
-  SetOutPath "$INSTDIR\bin"
-  CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
-  CreateShortCut "$SMPROGRAMS\$StartmenuFolder\${PRODUCT_NAME}.lnk" "${PRODUCT_BAT}" "" "${PRODUCT_EXE}"
-  SetOutPath "$INSTDIR"
-  CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Uninstall.lnk" "${PRODUCT_UNINSTALL_EXE}"
-
-  ; create desktop icon
-  ${if} $CreateDesktopIcon == "true"
-   SetOutPath "$INSTDIR\bin"
-   CreateShortCut "$DESKTOP\LyX ${PRODUCT_VERSION}.lnk" "${PRODUCT_BAT}" "" "${PRODUCT_EXE}"
-  ${endif}
-
-  ; register the extension .lyx
-  ${if} $CreateFileAssociations == "true"
-   ${CreateApplicationAssociation} "${PRODUCT_NAME}" "${PRODUCT_NAME}" "$(FileTypeTitle)" "${PRODUCT_EXE}" "${PRODUCT_BAT}"
-   ${CreateFileAssociation} "${PRODUCT_EXT}" "${PRODUCT_NAME}" "${PRODUCT_MIME_TYPE}"
-  ${endif}
-
-  ; create the LyX Application Data folder for all users
-  ; this folder is automatically created by LyX when it is first started but we want to start LyX with a specific session file,
-  ; so we create this folder before LyX starts and copy there the session file
-  Call CreateAppPathSub ; function from LyXUtils.nsh
+  Call ConfigureLyX ; Function from ConfigLyX.nsh
 
   ; delete unnecessary files
   ${if} $DelPythonFiles == "True"
diff --git a/development/Win32/packaging/installer/LyXWinInstaller/LaTeX.nsh b/development/Win32/packaging/installer/LyXWinInstaller/LaTeX.nsh
new file mode 100644 (file)
index 0000000..c68921f
--- /dev/null
@@ -0,0 +1,142 @@
+Function LaTeXActions
+ ; tests if MiKTeX is installed
+ ; reads the PATH variable via the registry because NSIS' "$%Path%" variable is not updated when the PATH changes
+  ReadRegStr $String HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
+  StrCpy $Search "miktex"
+  Call LaTeXCheck ; sets the path to the latex.exe to $LatexPath ; Function from LyXUtils.nsh
+  ; check if MiKTeX 2.4 or 2.5 is installed
+  StrCpy $String ""
+  ReadRegStr $String HKLM "Software\MiK\MiKTeX\CurrentVersion\MiKTeX" "Install Root"
+  ${if} $String != ""
+   StrCpy $MiKTeXVersion "2.4" ; needed later for the configuration of MiKTeX
+   StrCpy $LaTeXName "MiKTeX 2.4"
+  ${endif}
+  
+  ${if} $LatexPath == "" ; check if MiKTeX is installed only for the current user
+   ; check for MiKTeX 2.5
+   ReadRegStr $String HKCU "Environment" "Path"
+   StrCpy $Search "miktex"
+   Call LaTeXCheck ; function from LyXUtils.nsh
+   ${if} $LatexPath != ""
+    StrCpy $MiKTeXUser "HKCU" ; needed later to for a message about MiKTeX's install folder write permissions, see InstallActions-*.nsh
+   ${endif}
+   ; check for MiKTeX 2.4
+   StrCpy $String ""
+   ReadRegStr $String HKCU "Software\MiK\MiKTeX\CurrentVersion\MiKTeX" "Install Root"
+   ${if} $String != ""
+    StrCpy $MiKTeXVersion "2.4"
+    StrCpy $LaTeXName "MiKTeX 2.4"
+   ${endif}
+  ${endif}
+  
+  ${if} $LatexPath != ""
+   StrCpy $MiKTeXInstalled "yes"
+   ${if} $LaTeXName != "MiKTeX 2.4"
+    StrCpy $LaTeXName "MiKTeX 2.5"
+   ${endif} 
+  ${endif}
+
+  ; test if TeXLive is installed
+  ; as described at TeXLives' homepage there should be an entry in the PATH
+  ${if} $LatexPath == ""
+   ReadRegStr $String HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
+   StrCpy $Search "TeXLive"
+   Call LaTeXCheck ; function from LyXUtils.nsh
+  ${endif}
+  ; check for the current user Path variable (the case when it is a live CD/DVD)
+  ${if} $LatexPath == ""
+   ReadRegStr $String HKCU "Environment" "Path"
+   StrCpy $Search "texlive"
+   StrCpy $2 "TeXLive"
+   Call LaTeXCheck ; function from LyXUtils.nsh
+  ${endif}
+  ; check if the variable TLroot exists (the case when it is installed using the program "tlpmgui")
+  ${if} $LatexPath == ""
+   ReadRegStr $String HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "TLroot"
+   ${if} $String == ""
+    ReadRegStr $String HKCU "Environment" "TLroot" ; the case when installed without admin permissions
+   ${endif}
+   StrCpy $LatexPath "$String\bin\win32"
+   ; check if the latex.exe exists in the $LatexPath folder
+   !insertmacro FileCheck $5 "latex.exe" "$LatexPath" ; macro from LyXUtils.nsh
+   ${if} $5 == "False"
+    StrCpy $LatexPath ""
+   ${endif}
+  ${endif}
+  ${if} $LatexPath != ""
+  ${andif} $LaTeXName != "MiKTeX 2.4"
+  ${andif} $LaTeXName != "MiKTeX 2.5"
+   StrCpy $LaTeXName "TeXLive"
+  ${endif}
+  
+FunctionEnd
+
+; ------------------------------
+
+Function ConfigureMiKTeX
+ ; installs the LaTeX class files that are delivered with LyX
+ ; and enable MiKTeX's automatic package installation
+  StrCpy $String $LatexPath
+  StrCpy $Search "miktex\bin"
+  StrLen $3 $String
+  Call StrPoint ; search the LaTeXPath for the phrase "miktex\bin" (function from LyXUtils.nsh)
+  ${if} $Pointer != "-1" ; if something was found
+   IntOp $Pointer $Pointer - 1 ; jump before the first "\" of "\miktex\bin"
+   StrCpy $String $String "$Pointer" ; $String is now the part before "\miktex\bin"
+   ; install LaTeX class files
+   SetOutPath "$String\tex\latex"
+   File "${ClassFileDir}\cv.cls"
+   CreateDirectory "$String\tex\latex\lyx"
+   SetOutPath "$String\tex\latex\lyx"
+   File "${ClassFileDir}\lyxchess.sty"
+   File "${ClassFileDir}\lyxskak.sty"
+   CreateDirectory "$String\tex\latex\revtex"
+   SetOutPath "$String\tex\latex\revtex"
+   File "${ClassFileDir}\revtex.cls"
+   CreateDirectory "$String\tex\latex\hollywood"
+   SetOutPath "$String\tex\latex\hollywood"
+   File "${ClassFileDir}\hollywood.cls"
+   CreateDirectory "$String\tex\latex\broadway"
+   SetOutPath "$String\tex\latex\broadway"
+   File "${ClassFileDir}\broadway.cls"
+   ; install LaTeX-package dvipost (dvipost is not available for MiKTeX)
+   SetOutPath "$String\tex\latex\"
+   File /r "${DVIPostFileDir}"
+
+   ${if} $MiKTeXVersion == "2.4"
+    ; refresh MiKTeX's file name database
+    ExecWait "$String\miktex\bin\initexmf --update-fndb"
+    ; delete MiKTeX 2.4's dvipng executable as it is an old broken version. Then install a working one.
+    Delete "$String\miktex\bin\dvipng.exe"
+    ; Install a new one
+    SetOutPath "$String\miktex\bin"
+    File "${PRODUCT_DIR}\LyX\external\dvipng.exe"
+    ; enable package installation without asking (1=Yes, 0=No, 2=Always Ask Before Installing)                                             
+    WriteRegStr HKCU "SOFTWARE\MiK\MiKTeX\CurrentVersion\MiKTeX" "InstallPackagesOnTheFly" "1"
+    WriteRegStr HKCU "SOFTWARE\MiK\MiKTeX\CurrentVersion\MPM\Settings" "" ""
+    ; Setting package repository (MiKTeX's primary package repository)
+    WriteRegStr HKCU "SOFTWARE\MiK\MiKTeX\CurrentVersion\MPM" "RemotePackageRepository" "${MiKTeXRepo}"
+   
+   ${else} ; if MiKTeX 2.5
+    ; refresh MiKTeX's file name database
+    ExecWait "$LaTeXPath\initexmf --update-fndb"
+    ; enable package installation without asking (t = Yes, f = No)
+    WriteRegStr HKCU "SOFTWARE\MiKTeX.org\MiKTeX\2.5\MPM" "AutoInstall" "1" ; if only for curent user
+    WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "MIKTEX_AUTOINSTALL" "t"
+    ; set package repository (MiKTeX's primary package repository)
+    WriteRegStr HKCU "SOFTWARE\MiKTeX.org\MiKTeX\2.5\MPM" "RemoteRepository" "${MiKTeXRepo}" ; if only for curent user
+    WriteRegStr HKCU "SOFTWARE\MiKTeX.org\MiKTeX\2.5\MPM" "RepositoryType" "remote" ; if only for curent user
+    WriteRegStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "MIKTEX_REPOSITORY" "${MiKTeXRepo}"
+   ${endif}
+   
+   ; enable MiKTeX's automatic package installation
+   ExecWait '$LaTeXPath\mpm.com --update-fndb'
+   ; the following feature is planned to be used for a possible CD-version
+   ; copy LaTeX-packages needed by LyX
+   ; SetOutPath "$INSTDIR"
+   ; File /r "${LaTeXPackagesDir}" 
+  ${endif} ; end ${if} $Pointer
+  
+FunctionEnd
index 6264230bb6bb1e6222f0463a2714888aaef6f9ef..9412d1a2089eb0fede7ee02ac4d49e59aecd1e91 100644 (file)
 CRCCheck force
 
 ; Make the installer as small as possible.
-SetCompressor lzma
+SetCompressor lzma
 
 ;--------------------------------
 ; You should need to change only these macros...
 
 !define PRODUCT_DIR "D:\LyXPackage1.5"
 !define PRODUCT_NAME "LyX"
-!define PRODUCT_VERSION "1.5svn-15-04-2007"
+!define PRODUCT_VERSION "1.5svn-xx-04-2007"
 !define PRODUCT_VERSION_SHORT "150svn"
 !define PRODUCT_SUBFOLDER "lyx15"
 !define PRODUCT_LICENSE_FILE "${PRODUCT_DIR}\License.txt"
@@ -40,10 +40,10 @@ CRCCheck force
 !define PRODUCT_ABOUT_URL "http://www.lyx.org/about/"
 !define PRODUCT_INFO_URL "http://www.lyx.org/"
 
-BrandingText "LyXWinInstaller v3.12 - Complete"
+BrandingText "LyXWinInstaller v3.13 - Complete"
 !define INSTALLER_VERSION "Complete"
-!define INSTALLER_EXE "LyXWin150svnComplete-3-12.exe"
-!define INSTALLER2_EXE "LyXWin150svnSmall-3-12.exe" ; to check later if this installer version is running at the same time
+!define INSTALLER_EXE "LyXWin150svnComplete-3-13.exe"
+!define INSTALLER2_EXE "LyXWin150svnSmall-3-13.exe" ; to check later if this installer version is running at the same time
 !define VERSION_BITMAP "${PRODUCT_DIR}\icons\lyx_logo_vert${PRODUCT_VERSION_SHORT}.bmp"
 
 ; Replaced by HKLM or HKCU depending on SetShellVarContext.
@@ -78,7 +78,7 @@ BrandingText "LyXWinInstaller v3.12 - Complete"
 !define MiKTeXConfigFolder "MiKTeX\2.5\miktex\config"
 !define MiKTeXDeliveredVersion "MiKTeX 2.5"
 !define MiKTeXInstall "$INSTDIR\external\basic-miktex-2.5.2580.exe"
-!define PRODUCT_VERSION_OLD "none" ; to avoid warning message because this variable is only used for the Update installer version
+!define PRODUCT_VERSION_OLD "none" ; only here to avoid warning message - variable only used in Update installer version
 
 ;--------------------------------
 ; Make some of the information above available to NSIS.
@@ -151,6 +151,12 @@ Var RunNumber
 ; Set of various macros and functions
 !include "LyXUtils.nsh"
 
+; Functions to check and configure the LaTeX-system
+!include "LaTeX.nsh"
+
+; Function to check installed LaTeX-editors
+!include "Editors.nsh"
+
 ; Function to check if needed programs are missing or not
 !include "MissingPrograms.nsh"
 
@@ -158,16 +164,18 @@ Var RunNumber
 ; and LyX's menu language
 !include "LanguageSettings.nsh"
 
-; Function for page to install Aspell dictionaries
-!include "Aspell.nsh"
-
 ; Use the Abiword macros to help set up associations with the file extension in the Registry.
 ; Grabbed from
 ; http://abiword.pchasm.org/source/cvs/abiword-cvs/abi/src/pkg/win/setup/NSISv2/abi_util_fileassoc.nsh
 !include "abi_util_fileassoc.nsh"
 
-;--------------------------------
+; Function to configure LyX
+!include "ConfigLyX.nsh"
 
+; Function for page to install Aspell dictionaries
+!include "Aspell.nsh"
+
+;--------------------------------
 ; Remember the installer language
 !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
@@ -300,6 +308,7 @@ SectionEnd
 !insertmacro MUI_DESCRIPTION_TEXT ${SecInstJabRef} "$(SecInstJabRefDescription)"
 !insertmacro MUI_FUNCTION_DESCRIPTION_END
 
+; the installation section
 !include "InstallActions-complete.nsh"
 
 ;--------------------------------
@@ -353,6 +362,9 @@ Function .onInit
     Abort
   ${endif}
 
+  ; check the LaTeX-system
+  Call LaTeXActions ; Function from LaTeX.nsh
+
   ; check which programs are installed or not
   Call MissingPrograms ; function from MissingPrograms.nsh
 
@@ -376,80 +388,6 @@ FunctionEnd
 ;--------------------------------
 ; The Uninstaller
 
-Function un.onInit
-
-  ; Check that LyX is not currently running
-  FindProcDLL::FindProc "lyx.exe"
-  ${if} $R0 == "1"
-   MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)"
-   Abort
-  ${endif}
-
-  ; Ascertain whether the user has sufficient privileges to uninstall.
-  SetShellVarContext current
-
-  ReadRegStr $0 HKCU "${PRODUCT_UNINST_KEY}" "RootKey"
-  ${if} $0 == ""
-    ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "RootKey"
-    ${if} $0 == ""
-      MessageBox MB_OK|MB_ICONEXCLAMATION "$(UnNotInRegistryLabel)"
-    ${endif}
-  ${endif}
-
-  ; If the user does *not* have administrator privileges, abort
-  StrCpy $Answer ""
-  !insertmacro IsUserAdmin $Answer $UserName ; macro from LyXUtils.nsh
-  ${if} $Answer == "yes"
-    SetShellVarContext all
-  ${else}
-    MessageBox MB_OK|MB_ICONSTOP "$(UnNotAdminLabel)"
-    Abort
-  ${endif}
-
-  ; Macro to investigate name of LyX's preferences folders to be able remove them
-  !insertmacro UnAppPreSuff $AppPre $AppSuff ; macro from LyXUtils.nsh
-
-  ; test if Aspell was installed together with LyX
-  ReadRegStr $0 HKLM "Software\Aspell" "OnlyWithLyX" ; special entry to test if it was installed with LyX
-  ${if} $0 == "Yes${PRODUCT_VERSION_SHORT}"
-   SectionSetText 2 "Aspell" ; names the corersponding uninstaller section (has the index "2" as it is the third section in Uninstall.nsh)
-   StrCpy $AspellInstallYes "Aspell"
-  ${else}
-   SectionSetText 2 "" ; hides the corresponding uninstaller section
-  ${endif}
-
-  ; test if MiKTeX was installed together with LyX
-  ReadRegStr $0 HKLM "SOFTWARE\MiKTeX.org\MiKTeX" "OnlyWithLyX"
-  ${if} $0 == "Yes${PRODUCT_VERSION_SHORT}"
-   SectionSetText 3 "MiKTeX" ; names the corersponding uninstaller section
-   StrCpy $MiKTeXInstalled "MiKTeX"
-  ${else}
-   SectionSetText 3 "" ; hides the corresponding uninstaller section
-  ${endif}
-
-  ; test if JabRef was installed together with LyX
-  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${JabRefVersion}" "OnlyWithLyX"
-  ${if} $0 == "Yes${PRODUCT_VERSION_SHORT}"
-   SectionSetText 4 "JabRef" ; names the corersponding uninstaller section
-   StrCpy $JabRefInstalled "JabRef"
-  ${else}
-   SectionSetText 4 "" ; hides the corresponding uninstaller section
-  ${endif}
-
-  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "$(UnReallyRemoveLabel)" IDYES +2
-  Abort
-
-FunctionEnd
-
-
-Function un.onUninstSuccess
-  HideWindow
-  MessageBox MB_ICONINFORMATION|MB_OK "$(UnRemoveSuccessLabel)"
-  
-FunctionEnd
-
-;----------------------
-;Installer sections
 !include "Uninstall.nsh"
 
 ; eof
index 8e9466c91323f4ed4e5c82c5f02ac7b9976a0e3b..73bc2aa862f894f1837dd2af9d08e7ca66af9f9a 100644 (file)
 CRCCheck force
 
 ; Make the installer as small as possible.
-SetCompressor lzma
+SetCompressor lzma
 
 ;--------------------------------
 ; You should need to change only these macros...
 
 !define PRODUCT_DIR "D:\LyXPackage1.5"
 !define PRODUCT_NAME "LyX"
-!define PRODUCT_VERSION "1.5svn-15-04-2007"
+!define PRODUCT_VERSION "1.5svn-xx-04-2007"
 !define PRODUCT_VERSION_SHORT "150svn"
 !define PRODUCT_SUBFOLDER "lyx15"
 !define PRODUCT_LICENSE_FILE "${PRODUCT_DIR}\License.txt"
@@ -40,10 +40,10 @@ CRCCheck force
 !define PRODUCT_ABOUT_URL "http://www.lyx.org/about/"
 !define PRODUCT_INFO_URL "http://www.lyx.org/"
 
-BrandingText "LyXWinInstaller v3.12 - Small"
+BrandingText "LyXWinInstaller v3.13 - Small"
 !define INSTALLER_VERSION "Small"
-!define INSTALLER_EXE "LyXWin150svnSmall-3-12.exe"
-!define INSTALLER2_EXE "LyXWin150svnComplete-3-12.exe" ; to check later if this installer version is running at the same time
+!define INSTALLER_EXE "LyXWin150svnSmall-3-13.exe"
+!define INSTALLER2_EXE "LyXWin150svnComplete-3-13.exe" ; to check later if this installer version is running at the same time
 !define VERSION_BITMAP "${PRODUCT_DIR}\icons\lyx_logo_vert${PRODUCT_VERSION_SHORT}.bmp"
 
 ; Replaced by HKLM or HKCU depending on SetShellVarContext.
@@ -72,8 +72,8 @@ BrandingText "LyXWinInstaller v3.12 - Small"
 !define DVIPostFileDir "${PRODUCT_SOURCEDIR}\external\dvipost"
 !define MiKTeXRepo "ftp://ftp.tu-chemnitz.de/pub/tex/systems/win32/miktex/tm/packages/"
 !define MiKTeXConfigFolder "MiKTeX\2.5\miktex\config"
-!define MiKTeXDeliveredVersion "MiKTeX not included"
-!define PRODUCT_VERSION_OLD "none" ; to avoid warning message because this variable is only used for the Update installer version
+!define MiKTeXDeliveredVersion "MiKTeX not included" ; only here to avoid warning message - variable only used in Complete installer version
+!define PRODUCT_VERSION_OLD "none" ; only here to avoid warning message - variable only used in Update installer version
 
 ;--------------------------------
 ; Make some of the information above available to NSIS.
@@ -144,6 +144,12 @@ Var RunNumber
 ; Set of various macros and functions
 !include "LyXUtils.nsh"
 
+; Functions to check and configure the LaTeX-system
+!include "LaTeX.nsh"
+
+; Function to check installed LaTeX-editors
+!include "Editors.nsh"
+
 ; Function to check if needed programs are missing or not
 !include "MissingPrograms.nsh"
 
@@ -154,16 +160,18 @@ Var RunNumber
 ; and LyX's menu language
 !include "LanguageSettings.nsh"
 
-; Function for page to install Aspell dictionaries
-!include "Aspell.nsh"
-
 ; Use the Abiword macros to help set up associations with the file extension in the Registry.
 ; Grabbed from
 ; http://abiword.pchasm.org/source/cvs/abiword-cvs/abi/src/pkg/win/setup/NSISv2/abi_util_fileassoc.nsh
 !include "abi_util_fileassoc.nsh"
 
-;--------------------------------
+; Function to configure LyX
+!include "ConfigLyX.nsh"
 
+; Function for page to install Aspell dictionaries
+!include "Aspell.nsh"
+
+;--------------------------------
 ; Remember the installer language
 !define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
 !define MUI_LANGDLL_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
@@ -289,6 +297,7 @@ SectionEnd
 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
 !insertmacro MUI_FUNCTION_DESCRIPTION_END
 
+; the installation section
 !include "InstallActions-small.nsh"
 
 ;--------------------------------
@@ -342,6 +351,9 @@ Function .onInit
     Abort
   ${endif}
 
+  ; check the LaTeX-system
+  Call LaTeXActions ; Function from LaTeX.nsh
+
   ; check which programs are installed or not
   Call MissingPrograms ; function from MissingPrograms.nsh
 
@@ -360,75 +372,6 @@ FunctionEnd
 ;--------------------------------
 ; The Uninstaller
 
-Function un.onInit
-
-  ; Check that LyX is not currently running
-  FindProcDLL::FindProc "lyx.exe"
-  ${if} $R0 == "1"
-   MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)"
-   Abort
-  ${endif}
-
-  ; Ascertain whether the user has sufficient privileges to uninstall.
-  SetShellVarContext current
-
-  ReadRegStr $0 HKCU "${PRODUCT_UNINST_KEY}" "RootKey"
-  ${if} $0 == ""
-    ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "RootKey"
-    ${if} $0 == ""
-      MessageBox MB_OK|MB_ICONEXCLAMATION "$(UnNotInRegistryLabel)"
-    ${endif}
-  ${endif}
-
-  ; If the user does *not* have administrator privileges, abort
-  StrCpy $Answer ""
-  !insertmacro IsUserAdmin $Answer $UserName ; macro from LyXUtils.nsh
-  ${if} $Answer == "yes"
-    SetShellVarContext all
-  ${else}
-    MessageBox MB_OK|MB_ICONSTOP "$(UnNotAdminLabel)"
-    Abort
-  ${endif}
-
-  ; Macro to investigate name of LyX's preferences folders to be able remove them
-  !insertmacro UnAppPreSuff $AppPre $AppSuff ; macro from LyXUtils.nsh
-
-  ; test if Aspell was installed together with LyX
-  ReadRegStr $0 HKLM "Software\Aspell" "OnlyWithLyX" ; special entry to test if it was installed with LyX
-  ${if} $0 == "Yes${PRODUCT_VERSION_SHORT}"
-   SectionSetText 2 "Aspell" ; names the corersponding uninstaller section (has the index "2" as it is the third section in Uninstall.nsh)
-   StrCpy $AspellInstallYes "Aspell"
-  ${else}
-   SectionSetText 2 "" ; hides the corresponding uninstaller section
-  ${endif}
-
-  ; test if MiKTeX was installed together with LyX
-  ReadRegStr $0 HKLM "SOFTWARE\MiKTeX.org\MiKTeX" "OnlyWithLyX"
-  ${if} $0 == "Yes${PRODUCT_VERSION_SHORT}"
-   SectionSetText 3 "MiKTeX" ; names the corersponding uninstaller section
-   StrCpy $MiKTeXInstalled "MiKTeX"
-  ${else}
-   SectionSetText 3 "" ; hides the corresponding uninstaller section
-  ${endif}
-
-  ; ignore JabRef because this could only be installed with the complete installer version
-   SectionSetText 4 "" ; hides the corresponding uninstaller section
-   StrCpy $JabRefInstalled ""
-
-  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "$(UnReallyRemoveLabel)" IDYES +2
-  Abort
-
-FunctionEnd
-
-
-Function un.onUninstSuccess
-  HideWindow
-  MessageBox MB_ICONINFORMATION|MB_OK "$(UnRemoveSuccessLabel)"
-  
-FunctionEnd
-
-;----------------------
-;Installer sections
 !include "Uninstall.nsh"
 
 ; eof
index e7ba59857ebd9a45b603d6e60e0b1d07139094a9..c64a004fff2a85e9ebc836037fe76a75ebaad184 100644 (file)
@@ -29,8 +29,6 @@
 ;
 ; - FileCheck (checks if a given file exists)
 ;
-; - EditorCheck (check for installed editors)
-;
 ;--------------------------
 
 !macro StrPointer FindStr SearchStr Pointer
@@ -508,94 +506,3 @@ Function LaTeXCheck
 
 FunctionEnd
 
-;------------------------------------------
-
-Function EditorCheck
-
-  ; test if an editor with syntax-highlighting for LaTeX-files is installed
-  ; (check for jEdit, PSPad, WinShell, ConTEXT, Crimson Editor, Vim, TeXnicCenter, LaTeXEditor, WinEdt, LEd, WinTeX)
-  StrCpy $EditorPath ""
-  StrCpy $0 ""
-  ; check for jEdit
-  ReadRegStr $EditorPath HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\jEdit_is1" "InstallLocation"
-  ${if} $EditorPath != ""
-   StrCpy $EditorPath $EditorPath -1 ; remove "\" from the end of the string
-  ${endif}
-  ; check for PSPad
-  StrCpy $0 ""
-  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\PSPad editor_is1" "InstallLocation"
-  ${if} $0 != ""
-   StrCpy $0 $0 -1
-   StrCpy $EditorPath "$EditorPath;$0"
-  ${endif}
-  ; check for WinShell
-  StrCpy $0 ""
-  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinShell_is1" "InstallLocation"
-  ${if} $0 != ""
-   StrCpy $0 $0 -1
-   StrCpy $EditorPath "$EditorPath;$0"
-  ${endif}
-  ; check for ConTEXT
-  StrCpy $0 ""
-  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ConTEXTEditor_is1" "InstallLocation"
-  ${if} $0 != ""
-   StrCpy $0 $0 -1
-   StrCpy $EditorPath "$EditorPath;$0"
-  ${endif}
-  ; check for Crimson Editor
-  StrCpy $0 ""
-  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Crimson Editor" "UninstallString"
-  ${if} $0 != ""
-   StrCpy $0 $0 -14 ; remove "\uninstall.exe"
-   StrCpy $EditorPath "$EditorPath;$0"
-  ${endif}
-  ; check for Vim 6.x
-  StrCpy $0 ""
-  ReadRegStr $0 HKLM "Software\Classes\Applications\gvim.exe\shell\edit\command" ""
-  ${if} $0 != ""
-   StrCpy $0 $0 -13 ; remove "gvim.exe "%1""
-   StrCpy $EditorPath "$EditorPath;$0"
-  ${endif}
-  ; check for Vim 7.0
-  StrCpy $0 ""
-  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Vim 7.0" "UninstallString"
-  ${if} $0 != ""
-   StrCpy $0 $0 -18 ; remove "\uninstall-gui.exe"
-   StrCpy $EditorPath "$EditorPath;$0"
-  ${endif}
-  ; check for TeXnicCenter
-  StrCpy $0 ""
-  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\TeXnicCenter_is1" "Inno Setup: App Path"
-  ${if} $0 != ""
-   StrCpy $EditorPath "$EditorPath;$0"
-  ${endif}
-  ; check for LaTeXEditor
-  StrCpy $0 ""
-  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LaTeX Editor" "InstallLocation"
-  ${if} $0 != ""
-   StrCpy $EditorPath "$EditorPath;$0"
-  ${endif}
-  ; check for WinEdt
-  StrCpy $0 ""
-  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinEdt_is1" "InstallLocation"
-  ${if} $0 != ""
-   StrCpy $0 $0 -1
-   StrCpy $EditorPath "$EditorPath;$0"
-  ${endif}
-  ; check for LEd
-  StrCpy $0 ""
-  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LEd_is1" "InstallLocation"
-  ${if} $0 != ""
-   StrCpy $0 $0 -1
-   StrCpy $EditorPath "$EditorPath;$0"
-  ${endif}
-  ; check for WinTeX
-  StrCpy $0 ""
-  ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WinTeX XP" "DisplayIcon"
-  ${if} $0 != ""
-   StrCpy $0 $0 -11 ; remove "\wintex.exe"
-   StrCpy $EditorPath "$EditorPath;$0"
-  ${endif}
-
-FunctionEnd
-
index f722e50ff5a0b885ec614e6a64c4c8e9e2ded2ee..bc0544efb543d6993f5f3df8db9a38a12b53fbb9 100644 (file)
@@ -1,77 +1,8 @@
 Function MissingPrograms
 
+  ; initialize variable, is later set to True when a program was not found
   StrCpy $MissedProg "False"
 
-  ; test if MiKTeX is installed
-  ; read the PATH variable via the registry because NSIS' "$%Path%" variable is not updated when the PATH changes
-  ReadRegStr $String HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
-  StrCpy $Search "miktex"
-  Call LaTeXCheck ; sets the path to the latex.exe to $LatexPath ; function from LyXUtils.nsh
-  ; check if MiKTeX 2.4 or 2.5 is installed
-  StrCpy $String ""
-  ReadRegStr $String HKLM "Software\MiK\MiKTeX\CurrentVersion\MiKTeX" "Install Root"
-  ${if} $String != ""
-   StrCpy $MiKTeXVersion "2.4" ; needed later for the configuration of MiKTeX
-   StrCpy $LaTeXName "MiKTeX 2.4"
-  ${endif}
-  
-  ${if} $LatexPath == "" ; check if MiKTeX is installed only for the current user
-   ; check for MiKTeX 2.5
-   ReadRegStr $String HKCU "Environment" "Path"
-   StrCpy $Search "miktex"
-   Call LaTeXCheck ; function from LyXUtils.nsh
-   ${if} $LatexPath != ""
-    StrCpy $MiKTeXUser "HKCU" ; needed later to for a message about MiKTeX's install folder write permissions, see InstallActions-*.nsh
-   ${endif}
-   ; check for MiKTeX 2.4
-   StrCpy $String ""
-   ReadRegStr $String HKCU "Software\MiK\MiKTeX\CurrentVersion\MiKTeX" "Install Root"
-   ${if} $String != ""
-    StrCpy $MiKTeXVersion "2.4"
-    StrCpy $LaTeXName "MiKTeX 2.4"
-   ${endif}
-  ${endif}
-  
-  ${if} $LatexPath != ""
-   StrCpy $MiKTeXInstalled "yes"
-   ${if} $LaTeXName != "MiKTeX 2.4"
-    StrCpy $LaTeXName "MiKTeX 2.5"
-   ${endif} 
-  ${endif}
-
-  ; test if TeXLive is installed
-  ; as described at TeXLives' homepage there should be an entry in the PATH
-  ${if} $LatexPath == ""
-   ReadRegStr $String HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "Path"
-   StrCpy $Search "TeXLive"
-   Call LaTeXCheck ; function from LyXUtils.nsh
-  ${endif}
-  ; check for the current user Path variable (the case when it is a live CD/DVD)
-  ${if} $LatexPath == ""
-   ReadRegStr $String HKCU "Environment" "Path"
-   StrCpy $Search "texlive"
-   StrCpy $2 "TeXLive"
-   Call LaTeXCheck ; function from LyXUtils.nsh
-  ${endif}
-  ; check if the variable TLroot exists (the case when it is installed using the program "tlpmgui")
-  ${if} $LatexPath == ""
-   ReadRegStr $String HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "TLroot"
-   ${if} $String == ""
-    ReadRegStr $String HKCU "Environment" "TLroot" ; the case when installed without admin permissions
-   ${endif}
-   StrCpy $LatexPath "$String\bin\win32"
-   ; check if the latex.exe exists in the $LatexPath folder
-   !insertmacro FileCheck $5 "latex.exe" "$LatexPath" ; macro from LyXUtils.nsh
-   ${if} $5 == "False"
-    StrCpy $LatexPath ""
-   ${endif}
-  ${endif}
-  ${if} $LatexPath != ""
-  ${andif} $LaTeXName != "MiKTeX 2.4"
-  ${andif} $LaTeXName != "MiKTeX 2.5"
-   StrCpy $LaTeXName "TeXLive"
-  ${endif} 
-
   ; test if Ghostscript is installed
   GSloop:
   EnumRegKey $1 HKLM "Software\AFPL Ghostscript" 0
@@ -166,7 +97,7 @@ Function MissingPrograms
   ReadRegStr $PSVPath HKLM "Software\Microsoft\Windows\CurrentVersion\App Paths\gsview32.exe" "Path"
 
   ; test if an editor with syntax-highlighting for LaTeX-files is installed (function in LyXUtils.nsh)
-  Call EditorCheck ; function from LyXUtils.nsh
+  Call EditorCheck ; function from Editors.nsh
 
   ; test if an image editor is installed (due to LyX's bug 2654 first check for GIMP)
   StrCpy $ImageEditorPath ""
index 580f8c1e60799ba6ccd441918b5048859c55f47c..67b35e29a3659a21efc2641ae9c21efcbe513721 100644 (file)
@@ -1,3 +1,73 @@
+; Uninstaller
+
+; this function is called at first after starting the uninstaller
+Function un.onInit
+
+  ; Check that LyX is not currently running
+  FindProcDLL::FindProc "lyx.exe"
+  ${if} $R0 == "1"
+   MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)"
+   Abort
+  ${endif}
+
+  ; Ascertain whether the user has sufficient privileges to uninstall.
+  SetShellVarContext current
+
+  ReadRegStr $0 HKCU "${PRODUCT_UNINST_KEY}" "RootKey"
+  ${if} $0 == ""
+    ReadRegStr $0 HKLM "${PRODUCT_UNINST_KEY}" "RootKey"
+    ${if} $0 == ""
+      MessageBox MB_OK|MB_ICONEXCLAMATION "$(UnNotInRegistryLabel)"
+    ${endif}
+  ${endif}
+
+  ; If the user does *not* have administrator privileges, abort
+  StrCpy $Answer ""
+  !insertmacro IsUserAdmin $Answer $UserName ; macro from LyXUtils.nsh
+  ${if} $Answer == "yes"
+    SetShellVarContext all
+  ${else}
+    MessageBox MB_OK|MB_ICONSTOP "$(UnNotAdminLabel)"
+    Abort
+  ${endif}
+
+  ; Macro to investigate name of LyX's preferences folders to be able remove them
+  !insertmacro UnAppPreSuff $AppPre $AppSuff ; macro from LyXUtils.nsh
+
+  ; test if Aspell was installed together with LyX
+  ReadRegStr $0 HKLM "Software\Aspell" "OnlyWithLyX" ; special entry to test if it was installed with LyX
+  ${if} $0 == "Yes${PRODUCT_VERSION_SHORT}"
+   SectionSetText 2 "Aspell" ; names the corersponding uninstaller section (has the index "2" as it is the third section in Uninstall.nsh)
+   StrCpy $AspellInstallYes "Aspell"
+  ${else}
+   SectionSetText 2 "" ; hides the corresponding uninstaller section
+  ${endif}
+
+  ; test if MiKTeX was installed together with LyX
+  ReadRegStr $0 HKLM "SOFTWARE\MiKTeX.org\MiKTeX" "OnlyWithLyX"
+  ${if} $0 == "Yes${PRODUCT_VERSION_SHORT}"
+   SectionSetText 3 "MiKTeX" ; names the corersponding uninstaller section
+   StrCpy $MiKTeXInstalled "MiKTeX"
+  ${else}
+   SectionSetText 3 "" ; hides the corresponding uninstaller section
+  ${endif}
+
+  ; ignore JabRef because this could only be installed with the complete installer version
+   SectionSetText 4 "" ; hides the corresponding uninstaller section
+   StrCpy $JabRefInstalled ""
+
+  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "$(UnReallyRemoveLabel)" IDYES +2
+  Abort
+
+FunctionEnd
+
+
+Function un.onUninstSuccess
+  HideWindow
+  MessageBox MB_ICONINFORMATION|MB_OK "$(UnRemoveSuccessLabel)"
+  
+FunctionEnd
+
 ; Uninstall sections
 
 Section "un.LyX" un.SecUnProgramFiles