]> git.lyx.org Git - lyx.git/blob - development/Win32/packaging/installer/LyXWinInstaller/Uninstall.nsh
Change windows installer comments from ; to #
[lyx.git] / development / Win32 / packaging / installer / LyXWinInstaller / Uninstall.nsh
1 # Uninstall sections
2
3 Section "un.LyX" un.SecUnProgramFiles
4
5   SectionIn RO
6
7   # delete LaTeX class files that were installed together with LyX
8   FileOpen $R5 "$INSTDIR\Resources\uninstallPaths.dat" r
9   FileRead $R5 $LatexPath
10   FileClose $R5
11   StrCpy $String $LatexPath
12   StrCpy $Search "miktex\bin"
13   StrLen $3 $String
14   Call un.StrPoint ; search the LaTeXPath for the phrase "miktex\bin" (function from LyXUtils.nsh)
15   ${if} $Pointer != "-1" ; if something was found
16    IntOp $Pointer $Pointer - 1 ; jump before the first "\" of "\miktex\bin"
17    StrCpy $String $String "$Pointer" ; $String is now the part before "\miktex\bin"
18    Delete "$String\tex\latex\cv.cls"
19    RMDir /r "$String\tex\latex\lyx"
20    RMDir /r "$String\tex\latex\revtex"
21    RMDir /r "$String\tex\latex\hollywood"
22    RMDir /r "$String\tex\latex\broadway"
23    ExecWait "$LatexPath\initexmf --update-fndb"
24   ${endif}
25
26   # delete LyX's installation folder
27   RMDir /r $INSTDIR
28   # delete start menu folder
29   ReadRegStr $0 ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "StartMenu"
30   RMDir /r "$0"
31   # delete desktop icon
32   Delete "$DESKTOP\${PRODUCT_NAME}.lnk"
33   # delete registry entries
34   DeleteRegKey HKCU "${PRODUCT_UNINST_KEY}"
35   DeleteRegKey ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
36   DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
37   DeleteRegKey HKCR "Applications\lyx.exe"
38   DeleteRegKey HKCR "Applications\lyx.bat"
39
40   # Aiksaurus
41   !insertmacro FileCheck $5 "meanings.dat" "${AiksaurusDir}" ; macro from LyXUtils.nsh
42   ${if} $5 == "True"
43    RMDir /r "${AiksaurusDir}"
44   ${endif}
45 #  StrCpy $0 ""
46 #  ReadRegStr $0 HKLM "Software\Aiksaurus" "OnlyWithLyX" ; special entry to test if it was installed with LyX
47 #  ${if} $0 == "Yes" 
48 #   ; unregister Aiksaurus
49 #   ReadRegStr $1 HKLM "Software\Aiksaurus" "Data Path"
50 #   RMDir /r "$1"
51 #   DeleteRegKey HKLM "SOFTWARE\Aiksaurus"
52 #  ${endif}
53
54   # ImageMagick
55   StrCpy $0 ""
56   ReadRegStr $0 HKLM "Software\ImageMagick" "OnlyWithLyX" ; special entry to test if it was installed with LyX
57   ${if} $0 == "Yes" 
58    # unregister ImageMagick
59    DeleteRegValue HKLM "SOFTWARE\Classes\Applications" "AutoRun"
60    DeleteRegKey HKLM "SOFTWARE\ImageMagick"
61   ${endif}
62   
63   # Ghostscript and GSview
64   StrCpy $0 ""
65   StrCpy $5 ""
66   ReadRegStr $0 HKLM "SOFTWARE\GPL Ghostscript" "OnlyWithLyX" ; special entry to test if it was installed with LyX
67   ${if} $0 == "Yes"
68    # unregister Ghostscript
69    DeleteRegKey HKLM "SOFTWARE\GPL Ghostscript"
70    # test if GSview is installed
71    EnumRegValue $5 HKLM "Software\Ghostgum\GSview" 0
72    ${if} $5 != ""
73     # unregister GSview
74     MessageBox MB_ICONINFORMATION|MB_OK "$(UnGSview)"
75     ReadRegStr $3 HKLM "Software\Ghostgum\GSview" "$5"
76     ReadRegStr $4 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\GSview $5" "UninstallString"
77     ExecWait "$4"
78    ${endif}
79   ${endif}
80   
81   # MiKTeX specific LyX setting 
82   DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "MIKTEX_AUTOINSTALL"
83   DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "MIKTEX_REPOSITORY"
84   
85   # remove extension .lyx
86   ${RemoveFileAssociation} "${PRODUCT_EXT}" "${PRODUCT_NAME}"
87   DeleteRegKey HKCR "${PRODUCT_NAME}"
88   
89   # clear info that programs were installed together with LyX
90   DeleteRegValue HKLM "SOFTWARE\MiKTeX.org\MiKTeX" "OnlyWithLyX"
91   DeleteRegValue HKLM "Software\Aspell" "OnlyWithLyX"
92   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${JabRefVersion}" "OnlyWithLyX"
93   
94   SetAutoClose true
95
96 SectionEnd
97
98 #---------------------------------
99 # user preferences
100 Section "un.$(UnLyXPreferencesTitle)" un.SecUnPreferences
101
102  # remove LyX's config files
103  Call un.DelAppPathSub ; function from LyXUtils.nsh
104   
105 SectionEnd
106
107 #---------------------------------
108 # Aspell
109 Section "un.Aspell" un.SecUnAspell
110
111  ${if} $AspellInstallYes == "Aspell" ; only uninstall Aspell when it was installed together with LyX 
112   Call un.UninstAspell ; Function from Aspell.nsh
113  ${endif}
114
115 SectionEnd
116
117 #---------------------------------
118 # MiKTeX
119 Section "un.MiKTeX" un.SecUnMiKTeX
120
121  ${if} $MiKTeXInstalled == "MiKTeX" ; only uninstall MiKTeX when it was installed together with LyX 
122   ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MiKTeXDeliveredVersion}" "UninstallString"
123   ExecWait "$1" ; run MiKTeX's uninstaller
124  ${endif}
125
126 SectionEnd
127
128 #---------------------------------
129 # JabRef
130 Section "un.JabRef" un.SecUnJabRef
131
132  ${if} $JabRefInstalled == "JabRef" ; only uninstall JabRef when it was installed together with LyX 
133   ReadRegStr $1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${JabRefVersion}" "UninstallString"
134   ExecWait "$1" ; run JabRef's uninstaller
135  ${endif}
136
137 SectionEnd
138
139 #---------------------------------
140 # Section descriptions
141 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
142 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnAspell} "$(SecUnAspellDescription)"
143 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnMiKTeX} "$(SecUnMiKTeXDescription)"
144 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnJabRef} "$(SecUnJabRefDescription)"
145 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnPreferences} "$(SecUnPreferencesDescription)"
146 !insertmacro MUI_DESCRIPTION_TEXT ${un.SecUnProgramFiles} "$(SecUnProgramFilesDescription)"
147 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
148