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\lyx,0"
50 WriteRegStr SHCTX ${APP_UNINST_KEY} "URLUpdateInfo" "http://www.lyx.org/"
51 WriteRegStr SHCTX ${APP_UNINST_KEY} "URLInfoAbout" "http://www.lyx.org/about/"
52 WriteRegStr SHCTX ${APP_UNINST_KEY} "Publisher" "LyX Team"
53 WriteRegStr SHCTX ${APP_UNINST_KEY} "HelpLink" "http://www.lyx.org/internet/mailing.php"
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 existing version, remove the old uninstaller information
59 ${if} $OldVersionNumber != ""
60 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber"
61 # also delete in the case of an emergency release
62 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber1"
67 #--------------------------------
68 # Write LyX configuration file
72 # Associate .lyx files with LyX for current user of all users
74 ${if} $CreateFileAssociations == "true"
75 WriteRegStr SHCTX "${APP_DIR_REGKEY}" "" "$INSTDIR\${APP_RUN}"
78 # Write information about file type
79 #!define REG_FILETYPE 'WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}"'
81 ${if} $CreateFileAssociations == "true"
82 WriteRegStr SHCTX "${APP_DIR_REGKEY}" "OnlyWithLyX" "Yes${APP_SERIES_KEY}" # special entry to test if they were registered by this LyX version
83 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}" "" "${APP_NAME} Document"
84 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\DefaultIcon" "" "$INSTDIR\${APP_RUN},0"
85 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\Shell\open\command" "" '"$INSTDIR\${APP_RUN}" "%1"'
86 WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "" "${APP_REGNAME_DOC}"
87 WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "Content Type" "${APP_MIME_TYPE}"
89 WriteRegStr SHCTX "Software\Classes\${APP_EXT}13" "" "${APP_REGNAME_DOC}"
90 WriteRegStr SHCTX "Software\Classes\${APP_EXT}13" "Content Type" "${APP_MIME_TYPE}"
92 WriteRegStr SHCTX "Software\Classes\${APP_EXT}14" "" "${APP_REGNAME_DOC}"
93 WriteRegStr SHCTX "Software\Classes\${APP_EXT}14" "Content Type" "${APP_MIME_TYPE}"
95 WriteRegStr SHCTX "Software\Classes\${APP_EXT}15" "" "${APP_REGNAME_DOC}"
96 WriteRegStr SHCTX "Software\Classes\${APP_EXT}15" "Content Type" "${APP_MIME_TYPE}"
98 WriteRegStr SHCTX "Software\Classes\${APP_EXT}16" "" "${APP_REGNAME_DOC}"
99 WriteRegStr SHCTX "Software\Classes\${APP_EXT}16" "Content Type" "${APP_MIME_TYPE}"
100 # .lyx20 don't set this, because this is designed to be opened with LyX 2.0.x
106 # Install standard lyxrc.dist file
107 #SetOutPath "$INSTDIR\Resources"
108 #File "${FILES_DEPS}\Resources\lyxrc.dist"
110 # create the path prefix
111 # $$ represents a literal $ in an NSIS string
112 StrCpy $PathPrefix "$$LyXDir\bin;$$LyXDir\Python;$$LyXDir\Python\Lib;$$LyXDir\Perl\bin;$$LyXDir\imagemagick"
114 ${if} $PathLaTeX != ""
115 StrCpy $PathPrefix "$PathPrefix;$PathLaTeX"
118 StrCpy $PathPrefix "$PathPrefix;$PSVPath"
120 ${if} $EditorPath != ""
121 StrCpy $PathPrefix "$PathPrefix;$EditorPath"
123 ${if} $ImageEditorPath != ""
124 StrCpy $PathPrefix "$PathPrefix;$ImageEditorPath"
126 ${if} $GhostscriptPath != ""
127 StrCpy $PathPrefix "$PathPrefix;$GhostscriptPath"
130 StrCpy $PathPrefix "$PathPrefix;$SVGPath"
132 ${if} $GnumericPath != ""
133 StrCpy $PathPrefix "$PathPrefix;$GnumericPath"
135 ${if} $PathBibTeXEditor != ""
136 StrCpy $PathPrefix "$PathPrefix;$PathBibTeXEditor"
138 ${if} $LilyPondPath != ""
139 StrCpy $PathPrefix "$PathPrefix;$LilyPondPath"
142 # Set the path prefix in lyxrc.dist
144 Delete "$INSTDIR\Resources\lyxrc.dist"
145 FileOpen $R1 "$INSTDIR\Resources\lyxrc.dist" w
146 # set the format to the latest LyXRC format
147 FileWrite $R1 'Format 14$\r$\n'
148 # set some general things
149 FileWrite $R1 '\screen_zoom 120$\r$\n'
150 ${if} "$PathPrefix" != ""
151 FileWrite $R1 '\path_prefix "$PathPrefix"$\r$\n'
155 FileWrite $R1 '\converter "lyx" "html" "python -tt \"$INSTDIR\Python\Lib\elyxer.py\" --directory $$$$r $$$$i $$$$o" ""$\r$\n\
156 \converter "lyx" "wordhtml" "python -tt \"$INSTDIR\Python\Lib\elyxer.py\" --html --directory $$$$r $$$$i $$$$o" ""$\r$\n'
158 # use pdfview for all types of PDF files
159 FileWrite $R1 '\format "pdf5" "pdf" "PDF (LuaTeX)" "u" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
160 \format "pdf4" "pdf" "PDF (XeTeX)" "X" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
161 \format "pdf3" "pdf" "PDF (dvipdfm)" "m" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
162 \format "pdf2" "pdf" "PDF (pdflatex)" "F" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
163 \format "pdf" "pdf" "PDF (ps2pdf)" "P" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n'
165 # if LilyPondPath was found
166 # we need to add these entris because python scripts can only be executed
167 # if the full path is given
168 ${if} $LilyPondPath != ""
169 FileWrite $R1 '\format "lilypond-book" "lytex" "LilyPond book (LaTeX)" "" "" "auto" "document,menu=export" ""$\r$\n\
170 \converter "lilypond-book" "pdflatex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=pdflatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
171 \converter "lilypond-book" "xetex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=xelatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
172 \converter "lilypond-book" "luatex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=lualatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
173 \converter "lilypond-book" "latex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --lily-output-dir=ly-eps $$$$i" ""$\r$\n'
177 MessageBox MB_OK|MB_ICONEXCLAMATION "$(ModifyingConfigureFailed)" /SD IDOK
182 #--------------------------------
183 # Postscript printer for metafile to EPS converter
187 ${if} $MultiUser.Privileges == "Admin"
188 ${orif} $MultiUser.Privileges == "Power"
190 ExecWait '$PrinterConf /q /dl /n "Metafile to EPS Converter"'
191 # Install printer and driver
192 ExecWait '$PrinterConf /if /f "$WINDIR\inf\ntprint.inf" /b "Metafile to EPS Converter" /r "FILE:" /m "MS Publisher Imagesetter"'
194 MessageBox MB_OK|MB_ICONINFORMATION "$(MetafileNotAvailable)" /SD IDOK
199 #--------------------------------
200 # Run the LyX configure.py script, so MiKTeX can download its packages
204 Section -ConfigureScript
206 SetOutPath "$INSTDIR\Resources"
208 # ask to update MiKTeX
209 ${if} $LaTeXInstalled == "MiKTeX"
210 Call UpdateMiKTeX # function from latex.nsh
211 # install all necessary packages at once
212 DetailPrint $(TEXT_CONFIGURE_LYX)
213 ${if} $MultiUser.Privileges != "Admin"
214 ${andif} $MultiUser.Privileges != "Power"
215 # call the non-admin version
216 nsExec::ExecToLog '"$PathLaTeX\mpm.exe" "--verbose" "--install-some=$INSTDIR\Resources\Packages.txt"'
218 ${if} $MiKTeXUser != "HKCU" # call the admin version
219 nsExec::ExecToLog '"$PathLaTeX\mpm.exe" "--admin" "--verbose" "--install-some=$INSTDIR\Resources\Packages.txt"'
221 nsExec::ExecToLog '"$PathLaTeX\mpm.exe" "--verbose" "--install-some=$INSTDIR\Resources\Packages.txt"'
226 DetailPrint $(TEXT_CONFIGURE_LYX)
227 nsExec::ExecToLog '"$INSTDIR\Python\python.exe" "$INSTDIR\Resources\configure.py"'
228 # $ConfigureReturn is "0" if successful, otherwise "1"
229 Pop $ConfigureReturn # Return value
233 #--------------------------------
238 # run LyX in a command line window to give the users feedback about
239 # the time consuming LaTeX package installation
241 #Exec 'cmd /K " "$INSTDIR\bin\lyx.exe""'
242 Exec "$INSTDIR\${APP_RUN}"
246 /*Function CheckDesktopShortcut
248 # Enable desktop icon creation when there is an icon already
249 # Old shortcuts need to be updated
251 ${If} ${FileExists} "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk"
252 ${NSD_SetState} $mui.FinishPage.ShowReadme ${BST_CHECKED}
257 Function CreateDesktopShortcut
259 # Desktop icon creation is an option on the finish page
260 SetOutPath "$INSTDIR\bin"
261 CreateShortCut "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"