5 Write registry information and configure LyX
12 #!define SHORTCUT '${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"'
14 #--------------------------------
15 # Registry information
19 # Registry information
20 WriteRegStr SHCTX ${APP_REGKEY} "" $INSTDIR
21 WriteRegStr SHCTX ${APP_REGKEY} "Version" "${APP_VERSION_NUMBER}"
22 WriteRegStr SHCTX ${APP_REGKEY_SETUP} "LaTeX Path" $PathLaTeX
25 # There is only one shortcut to the application, so it should be in the main group
26 CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
27 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\${APP_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"
29 ${if} $CreateDesktopIcon == "true"
30 SetOutPath "$INSTDIR\bin"
31 CreateShortCut "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"
34 # Uninstaller information
35 ${If} $MultiUser.InstallMode == "CurrentUser"
36 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayName" "${APP_NAME} ${APP_VERSION} $(TEXT_INSTALL_CURRENTUSER)"
38 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayName" "${APP_NAME} ${APP_VERSION}"
41 WriteRegStr SHCTX ${APP_UNINST_KEY} "UninstallString" '"$INSTDIR\${SETUP_UNINSTALLER}"'
42 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayVersion" "${APP_VERSION}"
43 WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayIcon" "$INSTDIR\bin\LyXLauncher,0"
44 WriteRegStr SHCTX ${APP_UNINST_KEY} "URLUpdateInfo" "http://www.lyx.org/"
45 WriteRegStr SHCTX ${APP_UNINST_KEY} "URLInfoAbout" "http://www.lyx.org/about/"
46 WriteRegStr SHCTX ${APP_UNINST_KEY} "Publisher" "LyX Team"
47 WriteRegStr SHCTX ${APP_UNINST_KEY} "HelpLink" "http://www.lyx.org/internet/mailing.php"
48 WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoModify" 0x00000001
49 WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoRepair" 0x00000001
50 WriteRegStr SHCTX ${APP_UNINST_KEY} "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
54 #--------------------------------
55 # Write LyX configuration file
59 # Associate .lyx files with LyX for current user of all users
61 ${if} $CreateFileAssociations == "true"
62 WriteRegStr HKLM "${APP_DIR_REGKEY}" "" "$INSTDIR\${APP_RUN}"
65 # Write information about file type
66 #!define REG_FILETYPE 'WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}"'
68 ${if} $CreateFileAssociations == "true"
69 WriteRegStr SHCTX "${APP_DIR_REGKEY}" "OnlyWithLyX" "Yes${APP_SERIES_KEY}" # special entry to test if they were registered by this LyX version
70 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}" "" "${APP_NAME} Document"
71 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\DefaultIcon" "" "$INSTDIR\${APP_RUN},0"
72 WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\Shell\open\command" "" '"$INSTDIR\${APP_RUN}" "%1"'
73 WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "" "${APP_REGNAME_DOC}"
74 WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "Content Type" "${APP_MIME_TYPE}"
76 WriteRegStr SHCTX "Software\Classes\${APP_EXT}13" "" "${APP_REGNAME_DOC}"
77 WriteRegStr SHCTX "Software\Classes\${APP_EXT}13" "Content Type" "${APP_MIME_TYPE}"
79 WriteRegStr SHCTX "Software\Classes\${APP_EXT}14" "" "${APP_REGNAME_DOC}"
80 WriteRegStr SHCTX "Software\Classes\${APP_EXT}14" "Content Type" "${APP_MIME_TYPE}"
82 WriteRegStr SHCTX "Software\Classes\${APP_EXT}15" "" "${APP_REGNAME_DOC}"
83 WriteRegStr SHCTX "Software\Classes\${APP_EXT}15" "Content Type" "${APP_MIME_TYPE}"
84 # .lyx16 don't set this, because this is designed to be opened with LyX 1.6.x
90 # Set path prefix in lyxrc.dist
92 # Install standard lyxrc.dist file
93 #SetOutPath "$INSTDIR\Resources"
94 #File "${FILES_DEPS}\Resources\lyxrc.dist"
96 # create the path prefix
97 # $$ represents a literal $ in an NSIS string
98 StrCpy $PathPrefix "$$LyXDir\bin;$$LyXDir\python;$$LyXDir\imagemagick;$$LyXDir\ghostscript"
100 ${If} $PathLaTeX != ""
101 StrCpy $PathPrefix "$PathPrefix;$PathLaTeX"
104 StrCpy $PathPrefix "$PathPrefix;$PSVPath"
106 ${if} $EditorPath != ""
107 StrCpy $PathPrefix "$PathPrefix;$EditorPath"
109 ${if} $ImageEditorPath != ""
110 StrCpy $PathPrefix "$PathPrefix;$ImageEditorPath"
113 StrCpy $PathPrefix "$PathPrefix;$SVGPath"
116 StrCpy $PathPrefix "$PathPrefix;$WMFPath"
118 ${If} $PathBibTeXEditor != ""
119 StrCpy $PathPrefix "$PathPrefix;$PathBibTeXEditor"
122 # Set the path prefix in lyxrc.dist
124 Delete "$INSTDIR\Resources\lyxrc.dist"
125 FileOpen $R1 "$INSTDIR\Resources\lyxrc.dist" w
127 FileWrite $R1 'Format 1$\r$\n'
128 # set some general things
129 FileWrite $R1 '\screen_zoom 120$\r$\n'
130 ${if} "$PathPrefix" != ""
131 FileWrite $R1 '\path_prefix "$PathPrefix"$\r$\n'
133 ${if} $Acrobat == "Yes" # use pdfview for Acrobat / Adobe Reader
134 FileWrite $R1 '\format "pdf5" "pdf" "PDF (LuaTeX)" "u" "pdfview" "" "document,vector,menu=export"$\r$\n\
135 \format "pdf4" "pdf" "PDF (XeTeX)" "X" "pdfview" "" "document,vector,menu=export"$\r$\n\
136 \format "pdf3" "pdf" "PDF (dvipdfm)" "m" "pdfview" "" "document,vector,menu=export"$\r$\n\
137 \format "pdf2" "pdf" "PDF (pdflatex)" "F" "pdfview" "" "document,vector,menu=export"$\r$\n\
138 \format "pdf" "pdf" "PDF (ps2pdf)" "P" "pdfview" "" "document,vector,menu=export"$\r$\n'
140 # if a SVG to PDF converter ws found (e.g. Inkscape)
142 FileWrite $R1 '\format "svg" "svg" "SVG" "" "inkscape --file=$$$$i" "inkscape --file=$$$$i" "vector"$\r$\n\
143 \converter "svg" "png" "inkscape --without-gui --file=$$$$i --export-png=$$$$o" ""$\r$\n\
144 \converter "svg" "pdf" "inkscape --file=$$$$p/$$$$i --export-area-drawing --without-gui --export-pdf=$$$$p/$$$$o" ""$\r$\n\
145 \converter "svg" "eps" "inkscape --file=$$$$p/$$$$i --export-area-drawing --without-gui --export-eps=$$$$p/$$$$o" ""'
149 MessageBox MB_OK|MB_ICONEXCLAMATION "$(ModifyingConfigureFailed)"
154 #--------------------------------
157 /*Var UpdateFNDBReturn
161 # Install files in local root
163 ${If} $PathLaTeXLocal != ""
165 SetOutPath "$PathLaTeXLocal\tex\latex\dvipost"
166 File "${FILES_DVIPOST_PKG}\dvipost.sty"
167 # LyX files in Resources\tex
168 SetOutPath "$PathLaTeXLocal\tex\latex\lyx"
169 CopyFiles /SILENT "$INSTDIR\Resources\tex\*.*" "$PathLaTeXLocal\tex\latex\lyx"
172 # Update file name database
174 ${If} $PathLaTeX != ""
175 DetailPrint $(TEXT_CONFIGURE_MIKTEXFNDB)
176 nsExec::ExecToLog '"$PathLaTeX\initexmf.exe" --update-fndb'
177 Pop $UpdateFNDBReturn # Return value
182 #--------------------------------
183 # Postscript printer for metafile to EPS converter
187 ${If} $MultiUser.Privileges == "Admin"
188 ${OrIf} $MultiUser.Privileges == "Power"
191 ExecWait '$PrinterConf /q /dl /n "Metafile to EPS Converter"'
192 # Install printer and driver
193 ExecWait '$PrinterConf /if /f "$WINDIR\inf\ntprint.inf" /b "Metafile to EPS Converter" /r "FILE:" /m "MS Publisher Imagesetter"'
194 # Restore DEVMODE with proper settings
195 ExecWait '$PrinterConf /q /Sr /n "Metafile to EPS Converter" /a "$INSTDIR\bin\metafile2eps.dat" g'
201 #--------------------------------
202 # Run the LyX configure.py script, so MiKTeX can download its packages
206 Section -ConfigureScript
208 SetOutPath "$INSTDIR\Resources"
209 DetailPrint $(TEXT_CONFIGURE_LYX)
210 nsExec::ExecToLog '"$INSTDIR\python\python.exe" "$INSTDIR\Resources\configure.py"'
211 Pop $ConfigureReturn # Return value
213 # ask to update MiKTeX
214 ${if} $LaTeXInstalled == "MiKTeX"
215 Call UpdateMiKTeX # function from latex.nsh
220 #--------------------------------
225 # Enable desktop icon creation when there is an icon already
226 # Old shortcuts need to be updated
228 Exec "$INSTDIR\${APP_RUN}"
232 /*Function CheckDesktopShortcut
234 # Enable desktop icon creation when there is an icon already
235 # Old shortcuts need to be updated
237 ${If} ${FileExists} "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk"
238 ${NSD_SetState} $mui.FinishPage.ShowReadme ${BST_CHECKED}
243 Function CreateDesktopShortcut
245 # Desktop icon creation is an option on the finish page
246 SetOutPath "$INSTDIR\bin"
247 CreateShortCut "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"