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"
56 #--------------------------------
57 # Write LyX configuration file
61 # Associate .lyx files with LyX for current user of all users
63 ${if} $CreateFileAssociations == "true"
64 WriteRegStr SHCTX "${APP_DIR_REGKEY}" "" "$INSTDIR\${APP_RUN}"
67 # Write information about file type
68 #!define REG_FILETYPE 'WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}"'
70 ${if} $CreateFileAssociations == "true"
71 WriteRegStr SHCTX "${APP_DIR_REGKEY}" "OnlyWithLyX" "Yes${APP_SERIES_KEY}" # special entry to test if they were registered by this LyX version
72 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}" "" "${APP_NAME} Document"
73 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\DefaultIcon" "" "$INSTDIR\${APP_RUN},0"
74 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\Shell\open\command" "" '"$INSTDIR\${APP_RUN}" "%1"'
75 WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "" "${APP_REGNAME_DOC}"
76 WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "Content Type" "${APP_MIME_TYPE}"
78 WriteRegStr SHCTX "Software\Classes\${APP_EXT}13" "" "${APP_REGNAME_DOC}"
79 WriteRegStr SHCTX "Software\Classes\${APP_EXT}13" "Content Type" "${APP_MIME_TYPE}"
81 WriteRegStr SHCTX "Software\Classes\${APP_EXT}14" "" "${APP_REGNAME_DOC}"
82 WriteRegStr SHCTX "Software\Classes\${APP_EXT}14" "Content Type" "${APP_MIME_TYPE}"
84 WriteRegStr SHCTX "Software\Classes\${APP_EXT}15" "" "${APP_REGNAME_DOC}"
85 WriteRegStr SHCTX "Software\Classes\${APP_EXT}15" "Content Type" "${APP_MIME_TYPE}"
86 # .lyx16 don't set this, because this is designed to be opened with LyX 1.6.x
92 # Set path prefix in lyxrc.dist
94 # Install standard lyxrc.dist file
95 #SetOutPath "$INSTDIR\Resources"
96 #File "${FILES_DEPS}\Resources\lyxrc.dist"
98 # create the path prefix
99 # $$ represents a literal $ in an NSIS string
100 StrCpy $PathPrefix "$$LyXDir\bin;$$LyXDir\Python;$$LyXDir\Python\Lib;$$LyXDir\imagemagick"
102 ${if} $PathLaTeX != ""
103 StrCpy $PathPrefix "$PathPrefix;$PathLaTeX"
106 StrCpy $PathPrefix "$PathPrefix;$PSVPath"
108 ${if} $EditorPath != ""
109 StrCpy $PathPrefix "$PathPrefix;$EditorPath"
111 ${if} $ImageEditorPath != ""
112 StrCpy $PathPrefix "$PathPrefix;$ImageEditorPath"
114 ${if} $GhostscriptPath != ""
115 StrCpy $PathPrefix "$PathPrefix;$GhostscriptPath"
118 StrCpy $PathPrefix "$PathPrefix;$SVGPath"
121 StrCpy $PathPrefix "$PathPrefix;$WMFPath"
123 ${if} $GnumericPath != ""
124 StrCpy $PathPrefix "$PathPrefix;$GnumericPath"
126 ${if} $PathBibTeXEditor != ""
127 StrCpy $PathPrefix "$PathPrefix;$PathBibTeXEditor"
129 ${if} $LilyPondPath != ""
130 StrCpy $PathPrefix "$PathPrefix;$LilyPondPath"
133 # Set the path prefix in lyxrc.dist
135 Delete "$INSTDIR\Resources\lyxrc.dist"
136 FileOpen $R1 "$INSTDIR\Resources\lyxrc.dist" w
138 FileWrite $R1 'Format 1$\r$\n'
139 # set some general things
140 FileWrite $R1 '\screen_zoom 120$\r$\n'
141 ${if} "$PathPrefix" != ""
142 FileWrite $R1 '\path_prefix "$PathPrefix"$\r$\n'
144 ${if} $Acrobat == "Yes" # use pdfview for Acrobat / Adobe Reader
145 FileWrite $R1 '\format "pdf5" "pdf" "PDF (LuaTeX)" "u" "pdfview" "" "document,vector,menu=export"$\r$\n\
146 \format "pdf4" "pdf" "PDF (XeTeX)" "X" "pdfview" "" "document,vector,menu=export"$\r$\n\
147 \format "pdf3" "pdf" "PDF (dvipdfm)" "m" "pdfview" "" "document,vector,menu=export"$\r$\n\
148 \format "pdf2" "pdf" "PDF (pdflatex)" "F" "pdfview" "" "document,vector,menu=export"$\r$\n\
149 \format "pdf" "pdf" "PDF (ps2pdf)" "P" "pdfview" "" "document,vector,menu=export"$\r$\n'
151 # if LilyPondPath was found
152 # we need to add these entris because python scripts can only be executed
153 # if the full path is given
154 ${if} $LilyPondPath != ""
155 FileWrite $R1 '\format "lilypond-book" "lytex" "LilyPond book (LaTeX)" "" "" "auto" "document,menu=export"$\r$\n\
156 \converter "lilypond-book" "pdflatex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=pdflatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
157 \converter "lilypond-book" "xetex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=xelatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
158 \converter "lilypond-book" "luatex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=lualatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
159 \converter "lilypond-book" "latex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --lily-output-dir=ly-eps $$$$i" ""$\r$\n'
163 MessageBox MB_OK|MB_ICONEXCLAMATION "$(ModifyingConfigureFailed)"
168 #--------------------------------
169 # Postscript printer for metafile to EPS converter
173 ${if} $MultiUser.Privileges == "Admin"
174 ${orif} $MultiUser.Privileges == "Power"
176 ExecWait '$PrinterConf /q /dl /n "Metafile to EPS Converter"'
177 # Install printer and driver
178 ExecWait '$PrinterConf /if /f "$WINDIR\inf\ntprint.inf" /b "Metafile to EPS Converter" /r "FILE:" /m "MS Publisher Imagesetter"'
180 MessageBox MB_OK|MB_ICONINFORMATION "$(MetafileNotAvailable)"
185 #--------------------------------
186 # Run the LyX configure.py script, so MiKTeX can download its packages
190 Section -ConfigureScript
192 SetOutPath "$INSTDIR\Resources"
193 DetailPrint $(TEXT_CONFIGURE_LYX)
194 nsExec::ExecToLog '"$INSTDIR\Python\python.exe" "$INSTDIR\Resources\configure.py"'
195 Pop $ConfigureReturn # Return value
197 # ask to update MiKTeX
198 ${if} $LaTeXInstalled == "MiKTeX"
199 Call UpdateMiKTeX # function from latex.nsh
200 # for new installations a second run is necessary to give the users feedback about
201 # the ongoing installation of LaTeX packages
202 # a new installed MiKTeX needs some time until it is ready to install packages
203 !if ${SETUPTYPE} == BUNDLE
204 nsExec::ExecToLog '"$INSTDIR\Python\python.exe" "$INSTDIR\Resources\configure.py"'
205 !endif # end if == BUNDLE
210 #--------------------------------
215 # run LyX in a command line window to give the users feedback about
216 # the time consuming LaTeX package installation
218 #Exec 'cmd /K " "$INSTDIR\bin\lyx.exe""'
219 Exec "$INSTDIR\${APP_RUN}"
223 /*Function CheckDesktopShortcut
225 # Enable desktop icon creation when there is an icon already
226 # Old shortcuts need to be updated
228 ${If} ${FileExists} "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk"
229 ${NSD_SetState} $mui.FinishPage.ShowReadme ${BST_CHECKED}
234 Function CreateDesktopShortcut
236 # Desktop icon creation is an option on the finish page
237 SetOutPath "$INSTDIR\bin"
238 CreateShortCut "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"