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 CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
26 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\${APP_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"
27 # Link to www.lyx.org and to the Wiki
28 WriteINIStr "$SMPROGRAMS\$StartmenuFolder\${APP_WEBPAGE_INFO}.url" "InternetShortcut" "URL" "${APP_WEBPAGE}"
29 WriteINIStr "$SMPROGRAMS\$StartmenuFolder\${APP_WIKI_INFO}.url" "InternetShortcut" "URL" "${APP_WIKI}"
31 ${if} $CreateDesktopIcon == "true"
32 SetOutPath "$INSTDIR\bin"
33 CreateShortCut "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"
36 # Uninstaller information
37 ${If} $MultiUser.InstallMode == "CurrentUser"
38 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayName" "${APP_NAME} ${APP_VERSION} $(TEXT_INSTALL_CURRENTUSER)"
40 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayName" "${APP_NAME} ${APP_VERSION}"
43 WriteRegStr SHCTX ${APP_UNINST_KEY} "UninstallString" '"$INSTDIR\${SETUP_UNINSTALLER}"'
44 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayVersion" "${APP_VERSION}"
45 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayIcon" "$INSTDIR\bin\lyx,0"
46 WriteRegStr SHCTX ${APP_UNINST_KEY} "URLUpdateInfo" "http://www.lyx.org/"
47 WriteRegStr SHCTX ${APP_UNINST_KEY} "URLInfoAbout" "http://www.lyx.org/about/"
48 WriteRegStr SHCTX ${APP_UNINST_KEY} "Publisher" "LyX Team"
49 WriteRegStr SHCTX ${APP_UNINST_KEY} "HelpLink" "http://www.lyx.org/internet/mailing.php"
50 WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoModify" 0x00000001
51 WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoRepair" 0x00000001
52 WriteRegStr SHCTX ${APP_UNINST_KEY} "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
54 # if we install over an existing version, remove the old uninstaller information
55 ${if} $OldVersionNumber != ""
56 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber"
57 # also delete in the case of an emergency release
58 DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber1"
63 #--------------------------------
64 # Write LyX configuration file
68 # Associate .lyx files with LyX for current user of all users
70 ${if} $CreateFileAssociations == "true"
71 WriteRegStr SHCTX "${APP_DIR_REGKEY}" "" "$INSTDIR\${APP_RUN}"
74 # Write information about file type
75 #!define REG_FILETYPE 'WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}"'
77 ${if} $CreateFileAssociations == "true"
78 WriteRegStr SHCTX "${APP_DIR_REGKEY}" "OnlyWithLyX" "Yes${APP_SERIES_KEY}" # special entry to test if they were registered by this LyX version
79 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}" "" "${APP_NAME} Document"
80 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\DefaultIcon" "" "$INSTDIR\${APP_RUN},0"
81 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\Shell\open\command" "" '"$INSTDIR\${APP_RUN}" "%1"'
82 WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "" "${APP_REGNAME_DOC}"
83 WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "Content Type" "${APP_MIME_TYPE}"
85 WriteRegStr SHCTX "Software\Classes\${APP_EXT}13" "" "${APP_REGNAME_DOC}"
86 WriteRegStr SHCTX "Software\Classes\${APP_EXT}13" "Content Type" "${APP_MIME_TYPE}"
88 WriteRegStr SHCTX "Software\Classes\${APP_EXT}14" "" "${APP_REGNAME_DOC}"
89 WriteRegStr SHCTX "Software\Classes\${APP_EXT}14" "Content Type" "${APP_MIME_TYPE}"
91 WriteRegStr SHCTX "Software\Classes\${APP_EXT}15" "" "${APP_REGNAME_DOC}"
92 WriteRegStr SHCTX "Software\Classes\${APP_EXT}15" "Content Type" "${APP_MIME_TYPE}"
93 # .lyx16 don't set this, because this is designed to be opened with LyX 1.6.x
99 # Set path prefix in lyxrc.dist
101 # Install standard lyxrc.dist file
102 #SetOutPath "$INSTDIR\Resources"
103 #File "${FILES_DEPS}\Resources\lyxrc.dist"
105 # create the path prefix
106 # $$ represents a literal $ in an NSIS string
107 StrCpy $PathPrefix "$$LyXDir\bin;$$LyXDir\Python;$$LyXDir\Python\Lib;$$LyXDir\imagemagick"
109 ${if} $PathLaTeX != ""
110 StrCpy $PathPrefix "$PathPrefix;$PathLaTeX"
113 StrCpy $PathPrefix "$PathPrefix;$PSVPath"
115 ${if} $EditorPath != ""
116 StrCpy $PathPrefix "$PathPrefix;$EditorPath"
118 ${if} $ImageEditorPath != ""
119 StrCpy $PathPrefix "$PathPrefix;$ImageEditorPath"
121 ${if} $GhostscriptPath != ""
122 StrCpy $PathPrefix "$PathPrefix;$GhostscriptPath"
125 StrCpy $PathPrefix "$PathPrefix;$SVGPath"
127 ${if} $GnumericPath != ""
128 StrCpy $PathPrefix "$PathPrefix;$GnumericPath"
130 ${if} $PathBibTeXEditor != ""
131 StrCpy $PathPrefix "$PathPrefix;$PathBibTeXEditor"
133 ${if} $LilyPondPath != ""
134 StrCpy $PathPrefix "$PathPrefix;$LilyPondPath"
137 # Set the path prefix in lyxrc.dist
139 Delete "$INSTDIR\Resources\lyxrc.dist"
140 FileOpen $R1 "$INSTDIR\Resources\lyxrc.dist" w
142 FileWrite $R1 'Format 1$\r$\n'
143 # set some general things
144 FileWrite $R1 '\screen_zoom 120$\r$\n'
145 ${if} "$PathPrefix" != ""
146 FileWrite $R1 '\path_prefix "$PathPrefix"$\r$\n'
149 # use pdfview for all types of PDF files
150 FileWrite $R1 '\format "pdf5" "pdf" "PDF (LuaTeX)" "u" "pdfview" "" "document,vector,menu=export"$\r$\n\
151 \format "pdf4" "pdf" "PDF (XeTeX)" "X" "pdfview" "" "document,vector,menu=export"$\r$\n\
152 \format "pdf3" "pdf" "PDF (dvipdfm)" "m" "pdfview" "" "document,vector,menu=export"$\r$\n\
153 \format "pdf2" "pdf" "PDF (pdflatex)" "F" "pdfview" "" "document,vector,menu=export"$\r$\n\
154 \format "pdf" "pdf" "PDF (ps2pdf)" "P" "pdfview" "" "document,vector,menu=export"$\r$\n'
156 # if LilyPondPath was found
157 # we need to add these entris because python scripts can only be executed
158 # if the full path is given
159 ${if} $LilyPondPath != ""
160 FileWrite $R1 '\format "lilypond-book" "lytex" "LilyPond book (LaTeX)" "" "" "auto" "document,menu=export"$\r$\n\
161 \converter "lilypond-book" "pdflatex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=pdflatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
162 \converter "lilypond-book" "xetex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=xelatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
163 \converter "lilypond-book" "luatex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=lualatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
164 \converter "lilypond-book" "latex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --lily-output-dir=ly-eps $$$$i" ""$\r$\n'
168 MessageBox MB_OK|MB_ICONEXCLAMATION "$(ModifyingConfigureFailed)"
173 #--------------------------------
174 # Postscript printer for metafile to EPS converter
178 ${if} $MultiUser.Privileges == "Admin"
179 ${orif} $MultiUser.Privileges == "Power"
181 ExecWait '$PrinterConf /q /dl /n "Metafile to EPS Converter"'
182 # Install printer and driver
183 ExecWait '$PrinterConf /if /f "$WINDIR\inf\ntprint.inf" /b "Metafile to EPS Converter" /r "FILE:" /m "MS Publisher Imagesetter"'
185 MessageBox MB_OK|MB_ICONINFORMATION "$(MetafileNotAvailable)"
190 #--------------------------------
191 # Run the LyX configure.py script, so MiKTeX can download its packages
195 Section -ConfigureScript
197 SetOutPath "$INSTDIR\Resources"
199 # ask to update MiKTeX
200 ${if} $LaTeXInstalled == "MiKTeX"
201 Call UpdateMiKTeX # function from latex.nsh
202 # install all necessary packages at once
203 DetailPrint $(TEXT_CONFIGURE_LYX)
204 ${if} $MultiUser.Privileges != "Admin"
205 ${andif} $MultiUser.Privileges != "Power"
206 # call the non-admin version
207 nsExec::ExecToLog '"$PathLaTeX\mpm.exe" "--verbose" "--install-some=$INSTDIR\Resources\Packages.txt"'
209 ${if} $MiKTeXUser != "HKCU" # call the admin version
210 nsExec::ExecToLog '"$PathLaTeX\mpm.exe" "--admin" "--verbose" "--install-some=$INSTDIR\Resources\Packages.txt"'
212 nsExec::ExecToLog '"$PathLaTeX\mpm.exe" "--verbose" "--install-some=$INSTDIR\Resources\Packages.txt"'
217 DetailPrint $(TEXT_CONFIGURE_LYX)
218 nsExec::ExecToLog '"$INSTDIR\Python\python.exe" "$INSTDIR\Resources\configure.py"'
219 # $ConfigureReturn is "0" if successful, otherwise "1"
220 Pop $ConfigureReturn # Return value
224 #--------------------------------
229 # run LyX in a command line window to give the users feedback about
230 # the time consuming LaTeX package installation
232 #Exec 'cmd /K " "$INSTDIR\bin\lyx.exe""'
233 Exec "$INSTDIR\${APP_RUN}"
237 /*Function CheckDesktopShortcut
239 # Enable desktop icon creation when there is an icon already
240 # Old shortcuts need to be updated
242 ${If} ${FileExists} "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk"
243 ${NSD_SetState} $mui.FinishPage.ShowReadme ${BST_CHECKED}
248 Function CreateDesktopShortcut
250 # Desktop icon creation is an option on the finish page
251 SetOutPath "$INSTDIR\bin"
252 CreateShortCut "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"