5 Write registry information and configure LyX
11 #!define SHORTCUT '${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"'
13 #--------------------------------
14 # Registry information
18 # Registry information
19 ReadRegStr $0 SHCTX ${APP_REGFOLDER} "latestVersion"
20 ${If} $0 < ${APP_SERIES_KEY}
21 WriteRegStr SHCTX ${APP_REGFOLDER} "latestVersion" ${APP_SERIES_KEY}
23 WriteRegStr SHCTX ${APP_REGKEY} "" $INSTDIR
24 WriteRegStr SHCTX ${APP_REGKEY} "Version" "${APP_VERSION_NUMBER}"
25 WriteRegStr SHCTX ${APP_REGKEY_SETUP} "LaTeX Path" $PathLaTeX
28 SetOutPath "$INSTDIR\bin" # this is the folder in which the shortcut is executed
29 # we must assure that the folder is not empty (happens on silent install and can accidentally happen)
30 ${if} $StartmenuFolder == ""
31 StrCpy $StartmenuFolder "${APP_DIR}"
33 CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
34 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\${APP_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"
35 # Link to www.lyx.org and to the Wiki
36 WriteINIStr "$SMPROGRAMS\$StartmenuFolder\${APP_WEBPAGE_INFO}.url" "InternetShortcut" "URL" "${APP_WEBPAGE}"
37 WriteINIStr "$SMPROGRAMS\$StartmenuFolder\${APP_WIKI_INFO}.url" "InternetShortcut" "URL" "${APP_WIKI}"
39 ${if} $CreateDesktopIcon == "true"
40 SetOutPath "$INSTDIR\bin"
41 CreateShortCut "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"
44 # Uninstaller information
45 ${If} $MultiUser.InstallMode == "CurrentUser"
46 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayName" "${APP_NAME} ${APP_VERSION} $(TEXT_INSTALL_CURRENTUSER)"
48 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayName" "${APP_NAME} ${APP_VERSION}"
51 WriteRegStr SHCTX ${APP_UNINST_KEY} "UninstallString" '"$INSTDIR\${SETUP_UNINSTALLER}"'
52 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayVersion" "${APP_VERSION}"
53 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayIcon" "$INSTDIR\bin\${APP_NAME_SMALL}.exe"
54 WriteRegStr SHCTX ${APP_UNINST_KEY} "URLUpdateInfo" "${APP_WEBPAGE}"
55 WriteRegStr SHCTX ${APP_UNINST_KEY} "URLInfoAbout" "https://www.lyx.org/AboutLyX"
56 WriteRegStr SHCTX ${APP_UNINST_KEY} "Publisher" "${APP_NAME} Team"
57 WriteRegStr SHCTX ${APP_UNINST_KEY} "HelpLink" "https://www.lyx.org/MailingLists"
58 WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoModify" 0x00000001
59 WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoRepair" 0x00000001
60 WriteRegStr SHCTX ${APP_UNINST_KEY} "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
61 # if we install over an older existing version, remove the old uninstaller information
62 ${if} $OldVersionNumber != ""
63 ${AndIf} $OldVersionNumber < ${APP_SERIES_KEY}
64 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber"
65 DeleteRegKey SHCTX "SOFTWARE\${APP_NAME}\$OldVersionNumber"
66 # also delete in the case of an emergency release
68 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber$7"
69 DeleteRegKey SHCTX "SOFTWARE\${APP_NAME}\$OldVersionNumber$7"
74 #--------------------------------
75 # Write LyX configuration file
79 # Associate .lyx files with LyX for current user or all users
81 ${if} $CreateFileAssociations == "true"
82 WriteRegStr SHCTX "${APP_DIR_REGKEY}" "" "$INSTDIR\${APP_RUN}"
85 # Write information about file type
86 #!define REG_FILETYPE 'WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}"'
88 ${if} $CreateFileAssociations == "true"
89 WriteRegStr SHCTX "${APP_DIR_REGKEY}" "OnlyWithLyX" "Yes${APP_SERIES_KEY}" # special entry to test if they were registered by this LyX version
90 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}" "" "${APP_NAME} Document"
91 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\DefaultIcon" "" "$INSTDIR\${APP_RUN},0"
92 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\Shell\open\command" "" '"$INSTDIR\${APP_RUN}" "%1"'
93 # we need to update also the automatically created entry about the lyx.exe
94 # otherwise .lyx-files will could be opened with an older LyX version
95 ReadRegStr $0 SHCTX "Software\Classes\Applications\${BIN_LYX}\shell\open\command" ""
96 ${if} $0 != "" # if something was found
97 WriteRegStr SHCTX "Software\Classes\Applications\${BIN_LYX}\shell\open\command" "" '"$INSTDIR\${APP_RUN}" "%1"'
100 WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "" "${APP_REGNAME_DOC}"
101 WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "Content Type" "${APP_MIME_TYPE}"
103 WriteRegStr SHCTX "Software\Classes\${APP_EXT}13" "" "${APP_REGNAME_DOC}"
104 WriteRegStr SHCTX "Software\Classes\${APP_EXT}13" "Content Type" "${APP_MIME_TYPE}"
106 WriteRegStr SHCTX "Software\Classes\${APP_EXT}14" "" "${APP_REGNAME_DOC}"
107 WriteRegStr SHCTX "Software\Classes\${APP_EXT}14" "Content Type" "${APP_MIME_TYPE}"
109 WriteRegStr SHCTX "Software\Classes\${APP_EXT}15" "" "${APP_REGNAME_DOC}"
110 WriteRegStr SHCTX "Software\Classes\${APP_EXT}15" "Content Type" "${APP_MIME_TYPE}"
112 WriteRegStr SHCTX "Software\Classes\${APP_EXT}16" "" "${APP_REGNAME_DOC}"
113 WriteRegStr SHCTX "Software\Classes\${APP_EXT}16" "Content Type" "${APP_MIME_TYPE}"
115 WriteRegStr SHCTX "Software\Classes\${APP_EXT}20" "" "${APP_REGNAME_DOC}"
116 WriteRegStr SHCTX "Software\Classes\${APP_EXT}20" "Content Type" "${APP_MIME_TYPE}"
118 WriteRegStr SHCTX "Software\Classes\${APP_EXT}21" "" "${APP_REGNAME_DOC}"
119 WriteRegStr SHCTX "Software\Classes\${APP_EXT}21" "Content Type" "${APP_MIME_TYPE}"
120 # .lyx22 don't set this, because this is designed to be opened with LyX 2.2.x
126 # Install standard lyxrc.dist file
127 #SetOutPath "$INSTDIR\Resources"
128 #File "${FILES_DEPS}\Resources\lyxrc.dist"
130 # create the path prefix
131 # $$ represents a literal $ in an NSIS string
132 StrCpy $PathPrefix "$$LyXDir\bin;$$LyXDir\Python;$$LyXDir\Python\Lib;$$LyXDir\Perl\bin;$$LyXDir\imagemagick"
134 ${if} $PathLaTeX != ""
135 StrCpy $PathPrefix "$PathPrefix;$PathLaTeX"
138 StrCpy $PathPrefix "$PathPrefix;$PSVPath"
140 ${if} $EditorPath != ""
141 StrCpy $PathPrefix "$PathPrefix;$EditorPath"
143 ${if} $ImageEditorPath != ""
144 StrCpy $PathPrefix "$PathPrefix;$ImageEditorPath"
146 ${if} $GhostscriptPath != ""
147 StrCpy $PathPrefix "$PathPrefix;$GhostscriptPath"
150 StrCpy $PathPrefix "$PathPrefix;$SVGPath"
152 ${if} $GnumericPath != ""
153 StrCpy $PathPrefix "$PathPrefix;$GnumericPath"
155 ${if} $PathBibTeXEditor != ""
156 StrCpy $PathPrefix "$PathPrefix;$PathBibTeXEditor"
158 ${if} $PandocPath != ""
159 StrCpy $PathPrefix "$PathPrefix;$PandocPath"
161 ${if} $LilyPondPath != ""
162 StrCpy $PathPrefix "$PathPrefix;$LilyPondPath"
165 # Set the path prefix in lyxrc.dist
167 FileOpen $R1 "$INSTDIR\Resources\lyxrc.dist" a
169 # set some general things
170 FileWrite $R1 '\screen_zoom 120$\r$\n'
171 ${if} "$PathPrefix" != ""
172 FileWrite $R1 '\path_prefix "$PathPrefix"$\r$\n'
175 # use pdfview for all types of PDF files
176 FileWrite $R1 '\format "pdf5" "pdf" "PDF (LuaTeX)" "u" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
177 \format "pdf4" "pdf" "PDF (XeTeX)" "X" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
178 \format "pdf3" "pdf" "PDF (dvipdfm)" "m" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
179 \format "pdf2" "pdf" "PDF (pdflatex)" "F" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
180 \format "pdf" "pdf" "PDF (ps2pdf)" "P" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n'
182 # use Inkscape to edit PDF and EPS images
184 FileWrite $R1 '\format "pdf6" "pdf" "PDF (graphics)" "" "auto" "inkscape" "vector" "application/pdf"$\r$\n\
185 \format "eps" "eps" "EPS" "" "auto" "inkscape" "vector" "image/x-eps"$\r$\n'
189 ${if} $ImageEditor == "Gimp"
190 FileWrite $R1 '\format "gif" "gif" "GIF" "" "auto" "gimp-2.8" "" "image/gif"$\r$\n\
191 \format "jpg" "jpg, jpeg" "JPEG" "" "auto" "gimp-2.8" "" "image/jpeg"$\r$\n\
192 \format "png" "png" "PNG" "" "auto" "gimp-2.8" "" "image/x-png"'
194 ${if} $ImageEditor == "Krita"
195 FileWrite $R1 '\format "gif" "gif" "GIF" "" "auto" "krita" "" "image/gif"$\r$\n\
196 \format "jpg" "jpg, jpeg" "JPEG" "" "auto" "krita" "" "image/jpeg"$\r$\n\
197 \format "png" "png" "PNG" "" "auto" "krita" "" "image/x-png"'
200 # if Inkscape is not available Imagemagick will be used to convert WMF/EMF files
201 # We need to specify a resolution for the converter otherwise 1024 dpi are used and
202 # eps2pdf takes ages. 300 dpi are a good compromise for speed and size.
204 FileWrite $R1 '\converter "wmf" "eps" "convert -density 300 $$$$i $$$$o" ""$\r$\n\
205 \converter "emf" "eps" "convert -density 300 $$$$i $$$$o" ""$\r$\n'
208 # if LilyPondPath was found
209 # We need to add these entries because python scripts can only be executed
210 # if the full path is given.
211 ${if} $LilyPondPath != ""
212 FileWrite $R1 '\format "lilypond-book" "lytex" "LilyPond book (LaTeX)" "" "" "auto" "document,menu=export" ""$\r$\n\
213 \converter "lilypond-book" "pdflatex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=pdflatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
214 \converter "lilypond-book" "xetex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=xelatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
215 \converter "lilypond-book" "luatex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=lualatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
216 \converter "lilypond-book" "latex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --lily-output-dir=ly-eps $$$$i" ""$\r$\n'
220 MessageBox MB_OK|MB_ICONEXCLAMATION "$(ModifyingConfigureFailed)" /SD IDOK
223 # for texindy the path to the perl.exe must unfortunately be in Windows' PATH variable
224 ${if} $LaTeXInstalled != "TeXLive"
225 ${if} $MultiUser.Privileges != "Admin"
226 ${andif} $MultiUser.Privileges != "Power"
227 # call the non-admin version
228 ${EnvVarUpdate} $0 "PATH" "A" "HKCU" "$INSTDIR\Perl\bin"
230 ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\Perl\bin"
236 #--------------------------------
237 # Run the LyX configure.py script, so MiKTeX can download its packages
241 Section -ConfigureScript
243 DetailPrint $(TEXT_CONFIGURE_LYX)
244 SetShellVarContext current
245 SetOutPath "$APPDATA\${APP_DIR_USERDATA}"
246 nsExec::ExecToLog '"$INSTDIR\Python\python.exe" "$INSTDIR\Resources\configure.py"'
247 # $ConfigureReturn is "0" if successful, otherwise "1"
248 Pop $ConfigureReturn # Return value
252 #--------------------------------
257 # run LyX in a command line window to give the users feedback about
258 # the time consuming LaTeX package installation
260 # Exec "$INSTDIR\${APP_RUN}"