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 WriteRegStr SHCTX ${APP_REGKEY} "" $INSTDIR
20 WriteRegStr SHCTX ${APP_REGKEY} "Version" "${APP_VERSION_NUMBER}"
21 WriteRegStr SHCTX ${APP_REGKEY_SETUP} "LaTeX Path" $PathLaTeX
24 SetOutPath "$INSTDIR\bin" # this is the folder in which the shortcut is executed
25 # we must assure that the folder is not empty (happens on silent install and can accidentally happen)
26 ${if} $StartmenuFolder == ""
27 StrCpy $StartmenuFolder "${APP_DIR}"
29 CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
30 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\${APP_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"
31 # Link to www.lyx.org and to the Wiki
32 WriteINIStr "$SMPROGRAMS\$StartmenuFolder\${APP_WEBPAGE_INFO}.url" "InternetShortcut" "URL" "${APP_WEBPAGE}"
33 WriteINIStr "$SMPROGRAMS\$StartmenuFolder\${APP_WIKI_INFO}.url" "InternetShortcut" "URL" "${APP_WIKI}"
35 ${if} $CreateDesktopIcon == "true"
36 SetOutPath "$INSTDIR\bin"
37 CreateShortCut "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"
40 # Uninstaller information
41 ${If} $MultiUser.InstallMode == "CurrentUser"
42 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayName" "${APP_NAME} ${APP_VERSION} $(TEXT_INSTALL_CURRENTUSER)"
44 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayName" "${APP_NAME} ${APP_VERSION}"
47 WriteRegStr SHCTX ${APP_UNINST_KEY} "UninstallString" '"$INSTDIR\${SETUP_UNINSTALLER}"'
48 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayVersion" "${APP_VERSION}"
49 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayIcon" "$INSTDIR\bin\${APP_NAME_SMALL}.exe"
50 WriteRegStr SHCTX ${APP_UNINST_KEY} "URLUpdateInfo" "${APP_WEBPAGE}"
51 WriteRegStr SHCTX ${APP_UNINST_KEY} "URLInfoAbout" "https://www.lyx.org/AboutLyX"
52 WriteRegStr SHCTX ${APP_UNINST_KEY} "Publisher" "${APP_NAME} Team"
53 WriteRegStr SHCTX ${APP_UNINST_KEY} "HelpLink" "https://www.lyx.org/MailingLists"
54 WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoModify" 0x00000001
55 WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoRepair" 0x00000001
56 WriteRegStr SHCTX ${APP_UNINST_KEY} "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
58 # if we install over an older existing version, remove the old uninstaller information
59 ${if} $OldVersionNumber < ${APP_SERIES_KEY}
60 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber"
61 DeleteRegKey SHCTX "SOFTWARE\${APP_NAME}$OldVersionNumber"
62 # also delete in the case of an emergency release
63 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber1"
64 DeleteRegKey SHCTX "SOFTWARE\${APP_NAME}$OldVersionNumber1"
69 #--------------------------------
70 # Write LyX configuration file
74 # Associate .lyx files with LyX for current user or all users
76 ${if} $CreateFileAssociations == "true"
77 WriteRegStr SHCTX "${APP_DIR_REGKEY}" "" "$INSTDIR\${APP_RUN}"
80 # Write information about file type
81 #!define REG_FILETYPE 'WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}"'
83 ${if} $CreateFileAssociations == "true"
84 WriteRegStr SHCTX "${APP_DIR_REGKEY}" "OnlyWithLyX" "Yes${APP_SERIES_KEY}" # special entry to test if they were registered by this LyX version
85 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}" "" "${APP_NAME} Document"
86 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\DefaultIcon" "" "$INSTDIR\${APP_RUN},0"
87 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\Shell\open\command" "" '"$INSTDIR\${APP_RUN}" "%1"'
88 # we need to update also the automatically created entry about the lyx.exe
89 # otherwise .lyx-files will could be opened with an older LyX version
90 ReadRegStr $0 SHCTX "Software\Classes\Applications\${BIN_LYX}\shell\open\command" ""
91 ${if} $0 != "" # if something was found
92 WriteRegStr SHCTX "Software\Classes\Applications\${BIN_LYX}\shell\open\command" "" '"$INSTDIR\${APP_RUN}" "%1"'
95 WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "" "${APP_REGNAME_DOC}"
96 WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "Content Type" "${APP_MIME_TYPE}"
98 WriteRegStr SHCTX "Software\Classes\${APP_EXT}13" "" "${APP_REGNAME_DOC}"
99 WriteRegStr SHCTX "Software\Classes\${APP_EXT}13" "Content Type" "${APP_MIME_TYPE}"
101 WriteRegStr SHCTX "Software\Classes\${APP_EXT}14" "" "${APP_REGNAME_DOC}"
102 WriteRegStr SHCTX "Software\Classes\${APP_EXT}14" "Content Type" "${APP_MIME_TYPE}"
104 WriteRegStr SHCTX "Software\Classes\${APP_EXT}15" "" "${APP_REGNAME_DOC}"
105 WriteRegStr SHCTX "Software\Classes\${APP_EXT}15" "Content Type" "${APP_MIME_TYPE}"
107 WriteRegStr SHCTX "Software\Classes\${APP_EXT}16" "" "${APP_REGNAME_DOC}"
108 WriteRegStr SHCTX "Software\Classes\${APP_EXT}16" "Content Type" "${APP_MIME_TYPE}"
110 WriteRegStr SHCTX "Software\Classes\${APP_EXT}20" "" "${APP_REGNAME_DOC}"
111 WriteRegStr SHCTX "Software\Classes\${APP_EXT}20" "Content Type" "${APP_MIME_TYPE}"
113 WriteRegStr SHCTX "Software\Classes\${APP_EXT}21" "" "${APP_REGNAME_DOC}"
114 WriteRegStr SHCTX "Software\Classes\${APP_EXT}21" "Content Type" "${APP_MIME_TYPE}"
115 # .lyx22 don't set this, because this is designed to be opened with LyX 2.2.x
121 # Install standard lyxrc.dist file
122 #SetOutPath "$INSTDIR\Resources"
123 #File "${FILES_DEPS}\Resources\lyxrc.dist"
125 # create the path prefix
126 # $$ represents a literal $ in an NSIS string
127 StrCpy $PathPrefix "$$LyXDir\bin;$$LyXDir\Python;$$LyXDir\Python\Lib;$$LyXDir\Perl\bin;$$LyXDir\imagemagick"
129 ${if} $PathLaTeX != ""
130 StrCpy $PathPrefix "$PathPrefix;$PathLaTeX"
133 StrCpy $PathPrefix "$PathPrefix;$PSVPath"
135 ${if} $EditorPath != ""
136 StrCpy $PathPrefix "$PathPrefix;$EditorPath"
138 ${if} $ImageEditorPath != ""
139 StrCpy $PathPrefix "$PathPrefix;$ImageEditorPath"
141 ${if} $GhostscriptPath != ""
142 StrCpy $PathPrefix "$PathPrefix;$GhostscriptPath"
145 StrCpy $PathPrefix "$PathPrefix;$SVGPath"
147 ${if} $GnumericPath != ""
148 StrCpy $PathPrefix "$PathPrefix;$GnumericPath"
150 ${if} $PathBibTeXEditor != ""
151 StrCpy $PathPrefix "$PathPrefix;$PathBibTeXEditor"
153 ${if} $PandocPath != ""
154 StrCpy $PathPrefix "$PathPrefix;$PandocPath"
156 ${if} $LilyPondPath != ""
157 StrCpy $PathPrefix "$PathPrefix;$LilyPondPath"
160 # Set the path prefix in lyxrc.dist
162 Delete "$INSTDIR\Resources\lyxrc.dist"
163 FileOpen $R1 "$INSTDIR\Resources\lyxrc.dist" w
164 # set the format to the latest LyXRC format
165 FileWrite $R1 'Format 24$\r$\n'
166 # set some general things
167 FileWrite $R1 '\screen_zoom 120$\r$\n'
168 ${if} "$PathPrefix" != ""
169 FileWrite $R1 '\path_prefix "$PathPrefix"$\r$\n'
172 # use pdfview for all types of PDF files
173 FileWrite $R1 '\format "pdf5" "pdf" "PDF (LuaTeX)" "u" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
174 \format "pdf4" "pdf" "PDF (XeTeX)" "X" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
175 \format "pdf3" "pdf" "PDF (dvipdfm)" "m" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
176 \format "pdf2" "pdf" "PDF (pdflatex)" "F" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
177 \format "pdf" "pdf" "PDF (ps2pdf)" "P" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n'
179 # use Inkscape to edit PDF and EPS images
181 FileWrite $R1 '\format "pdf6" "pdf" "PDF (graphics)" "" "auto" "inkscape" "vector" "application/pdf"$\r$\n\
182 \format "eps" "eps" "EPS" "" "auto" "inkscape" "vector" "image/x-eps"$\r$\n'
186 ${if} $ImageEditor == "Gimp"
187 FileWrite $R1 '\format "gif" "gif" "GIF" "" "auto" "gimp-2.8" "" "image/gif"$\r$\n\
188 \format "jpg" "jpg, jpeg" "JPEG" "" "auto" "gimp-2.8" "" "image/jpeg"$\r$\n\
189 \format "png" "png" "PNG" "" "auto" "gimp-2.8" "" "image/x-png"'
191 ${if} $ImageEditor == "Krita"
192 FileWrite $R1 '\format "gif" "gif" "GIF" "" "auto" "krita" "" "image/gif"$\r$\n\
193 \format "jpg" "jpg, jpeg" "JPEG" "" "auto" "krita" "" "image/jpeg"$\r$\n\
194 \format "png" "png" "PNG" "" "auto" "krita" "" "image/x-png"'
197 # if Inkscape is not available Imagemagick will be used to convert WMF/EMF files
198 # We need to specify a resolution for the converter otherwise 1024 dpi are used and
199 # eps2pdf takes ages. 300 dpi are a good compromise for speed and size.
201 FileWrite $R1 '\converter "wmf" "eps" "convert -density 300 $$$$i $$$$o" ""$\r$\n\
202 \converter "emf" "eps" "convert -density 300 $$$$i $$$$o" ""$\r$\n'
205 # if LilyPondPath was found
206 # We need to add these entries because python scripts can only be executed
207 # if the full path is given.
208 ${if} $LilyPondPath != ""
209 FileWrite $R1 '\format "lilypond-book" "lytex" "LilyPond book (LaTeX)" "" "" "auto" "document,menu=export" ""$\r$\n\
210 \converter "lilypond-book" "pdflatex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=pdflatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
211 \converter "lilypond-book" "xetex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=xelatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
212 \converter "lilypond-book" "luatex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=lualatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
213 \converter "lilypond-book" "latex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --lily-output-dir=ly-eps $$$$i" ""$\r$\n'
217 MessageBox MB_OK|MB_ICONEXCLAMATION "$(ModifyingConfigureFailed)" /SD IDOK
220 # for texindy the path to the perl.exe must unfortunately be in Windows' PATH variable
221 ${if} $MultiUser.Privileges != "Admin"
222 ${andif} $MultiUser.Privileges != "Power"
223 # call the non-admin version
224 ${EnvVarUpdate} $0 "PATH" "A" "HKCU" "$INSTDIR\Perl\bin"
226 ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\Perl\bin"
231 #--------------------------------
232 # Run the LyX configure.py script, so MiKTeX can download its packages
236 Section -ConfigureScript
238 DetailPrint $(TEXT_CONFIGURE_LYX)
239 nsExec::ExecToLog '"$INSTDIR\Python\python.exe" "$INSTDIR\Resources\configure.py"'
240 # $ConfigureReturn is "0" if successful, otherwise "1"
241 Pop $ConfigureReturn # Return value
245 #--------------------------------
250 # run LyX in a command line window to give the users feedback about
251 # the time consuming LaTeX package installation
253 Exec "$INSTDIR\${APP_RUN}"