2018-02-18 14:52:57 +00:00
|
|
|
/*
|
2008-03-30 21:37:53 +00:00
|
|
|
|
|
|
|
configure.nsh
|
|
|
|
|
|
|
|
Write registry information and configure LyX
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
Var PathPrefix
|
|
|
|
|
2011-05-23 04:12:10 +00:00
|
|
|
#!define SHORTCUT '${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"'
|
2008-03-30 21:37:53 +00:00
|
|
|
|
|
|
|
#--------------------------------
|
|
|
|
# Registry information
|
|
|
|
|
|
|
|
Section -InstallData
|
|
|
|
|
|
|
|
# Registry information
|
2011-05-23 04:12:10 +00:00
|
|
|
WriteRegStr SHCTX ${APP_REGKEY} "" $INSTDIR
|
|
|
|
WriteRegStr SHCTX ${APP_REGKEY} "Version" "${APP_VERSION_NUMBER}"
|
|
|
|
WriteRegStr SHCTX ${APP_REGKEY_SETUP} "LaTeX Path" $PathLaTeX
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
# Start Menu shortcut
|
2012-07-02 23:42:30 +00:00
|
|
|
SetOutPath "$INSTDIR\bin" # this is the folder in which the shortcut is executed
|
2014-02-19 00:14:20 +00:00
|
|
|
# we must assure that the folder is not empty (happens on silent install and can accidentally happen)
|
|
|
|
${if} $StartmenuFolder == ""
|
|
|
|
StrCpy $StartmenuFolder "${APP_DIR}"
|
|
|
|
${endif}
|
2011-05-23 04:12:10 +00:00
|
|
|
CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
|
|
|
|
CreateShortCut "$SMPROGRAMS\$StartmenuFolder\${APP_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"
|
2012-07-08 13:48:26 +00:00
|
|
|
# Link to www.lyx.org and to the Wiki
|
|
|
|
WriteINIStr "$SMPROGRAMS\$StartmenuFolder\${APP_WEBPAGE_INFO}.url" "InternetShortcut" "URL" "${APP_WEBPAGE}"
|
|
|
|
WriteINIStr "$SMPROGRAMS\$StartmenuFolder\${APP_WIKI_INFO}.url" "InternetShortcut" "URL" "${APP_WIKI}"
|
2011-05-23 04:12:10 +00:00
|
|
|
# create desktop icon
|
|
|
|
${if} $CreateDesktopIcon == "true"
|
|
|
|
SetOutPath "$INSTDIR\bin"
|
|
|
|
CreateShortCut "$DESKTOP\${APP_NAME} ${APP_SERIES_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"
|
|
|
|
${endif}
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2011-05-23 04:12:10 +00:00
|
|
|
# Uninstaller information
|
2008-03-30 21:37:53 +00:00
|
|
|
${If} $MultiUser.InstallMode == "CurrentUser"
|
2011-05-23 04:12:10 +00:00
|
|
|
WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayName" "${APP_NAME} ${APP_VERSION} $(TEXT_INSTALL_CURRENTUSER)"
|
2008-03-30 21:37:53 +00:00
|
|
|
${Else}
|
2011-05-23 04:12:10 +00:00
|
|
|
WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayName" "${APP_NAME} ${APP_VERSION}"
|
2008-03-30 21:37:53 +00:00
|
|
|
${EndIf}
|
|
|
|
|
2011-05-23 04:12:10 +00:00
|
|
|
WriteRegStr SHCTX ${APP_UNINST_KEY} "UninstallString" '"$INSTDIR\${SETUP_UNINSTALLER}"'
|
|
|
|
WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayVersion" "${APP_VERSION}"
|
2019-10-20 21:06:21 +00:00
|
|
|
WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayIcon" "$INSTDIR\bin\${APP_NAME_SMALL}.exe"
|
2016-02-12 01:52:36 +00:00
|
|
|
WriteRegStr SHCTX ${APP_UNINST_KEY} "URLUpdateInfo" "${APP_WEBPAGE}"
|
2017-12-06 14:31:10 +00:00
|
|
|
WriteRegStr SHCTX ${APP_UNINST_KEY} "URLInfoAbout" "https://www.lyx.org/AboutLyX"
|
|
|
|
WriteRegStr SHCTX ${APP_UNINST_KEY} "Publisher" "${APP_NAME} Team"
|
|
|
|
WriteRegStr SHCTX ${APP_UNINST_KEY} "HelpLink" "https://www.lyx.org/MailingLists"
|
2011-05-23 04:12:10 +00:00
|
|
|
WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoModify" 0x00000001
|
|
|
|
WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoRepair" 0x00000001
|
|
|
|
WriteRegStr SHCTX ${APP_UNINST_KEY} "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2014-04-19 16:58:22 +00:00
|
|
|
# if we install over an older existing version, remove the old uninstaller information
|
|
|
|
${if} $OldVersionNumber < ${APP_SERIES_KEY}
|
2012-11-11 06:12:43 +00:00
|
|
|
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber"
|
2019-10-20 21:06:21 +00:00
|
|
|
DeleteRegKey SHCTX "SOFTWARE\${APP_NAME}$OldVersionNumber"
|
2013-05-02 23:11:32 +00:00
|
|
|
# also delete in the case of an emergency release
|
2020-07-08 05:58:49 +00:00
|
|
|
${For} $7 0 20
|
|
|
|
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber$7"
|
|
|
|
DeleteRegKey SHCTX "SOFTWARE\${APP_NAME}\$OldVersionNumber$7"
|
|
|
|
${Next}
|
2012-11-11 06:12:43 +00:00
|
|
|
${endif}
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
SectionEnd
|
|
|
|
|
|
|
|
#--------------------------------
|
|
|
|
# Write LyX configuration file
|
|
|
|
|
|
|
|
Section -Configure
|
|
|
|
|
2014-03-29 00:50:18 +00:00
|
|
|
# Associate .lyx files with LyX for current user or all users
|
2011-05-23 04:12:10 +00:00
|
|
|
|
|
|
|
${if} $CreateFileAssociations == "true"
|
2012-07-02 23:42:30 +00:00
|
|
|
WriteRegStr SHCTX "${APP_DIR_REGKEY}" "" "$INSTDIR\${APP_RUN}"
|
2011-05-23 04:12:10 +00:00
|
|
|
${endif}
|
|
|
|
|
|
|
|
# Write information about file type
|
|
|
|
#!define REG_FILETYPE 'WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}"'
|
|
|
|
|
|
|
|
${if} $CreateFileAssociations == "true"
|
|
|
|
WriteRegStr SHCTX "${APP_DIR_REGKEY}" "OnlyWithLyX" "Yes${APP_SERIES_KEY}" # special entry to test if they were registered by this LyX version
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}" "" "${APP_NAME} Document"
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\DefaultIcon" "" "$INSTDIR\${APP_RUN},0"
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_REGNAME_DOC}\Shell\open\command" "" '"$INSTDIR\${APP_RUN}" "%1"'
|
2014-03-30 03:33:55 +00:00
|
|
|
# we need to update also the automatically created entry about the lyx.exe
|
|
|
|
# otherwise .lyx-files will could be opened with an older LyX version
|
|
|
|
ReadRegStr $0 SHCTX "Software\Classes\Applications\${BIN_LYX}\shell\open\command" ""
|
|
|
|
${if} $0 != "" # if something was found
|
|
|
|
WriteRegStr SHCTX "Software\Classes\Applications\${BIN_LYX}\shell\open\command" "" '"$INSTDIR\${APP_RUN}" "%1"'
|
|
|
|
${endif}
|
|
|
|
# .lyx
|
2011-05-23 04:12:10 +00:00
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "" "${APP_REGNAME_DOC}"
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "Content Type" "${APP_MIME_TYPE}"
|
|
|
|
# .lyx13
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_EXT}13" "" "${APP_REGNAME_DOC}"
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_EXT}13" "Content Type" "${APP_MIME_TYPE}"
|
|
|
|
# .lyx14
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_EXT}14" "" "${APP_REGNAME_DOC}"
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_EXT}14" "Content Type" "${APP_MIME_TYPE}"
|
2011-06-08 16:41:48 +00:00
|
|
|
# .lyx15
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_EXT}15" "" "${APP_REGNAME_DOC}"
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_EXT}15" "Content Type" "${APP_MIME_TYPE}"
|
2013-05-31 02:27:08 +00:00
|
|
|
# .lyx16
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_EXT}16" "" "${APP_REGNAME_DOC}"
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_EXT}16" "Content Type" "${APP_MIME_TYPE}"
|
2015-11-26 23:39:38 +00:00
|
|
|
# .lyx20
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_EXT}20" "" "${APP_REGNAME_DOC}"
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_EXT}20" "Content Type" "${APP_MIME_TYPE}"
|
2017-11-02 20:51:36 +00:00
|
|
|
# .lyx21
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_EXT}21" "" "${APP_REGNAME_DOC}"
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${APP_EXT}21" "Content Type" "${APP_MIME_TYPE}"
|
|
|
|
# .lyx22 don't set this, because this is designed to be opened with LyX 2.2.x
|
2011-05-23 04:12:10 +00:00
|
|
|
|
|
|
|
# Refresh shell
|
|
|
|
${RefreshShellIcons}
|
|
|
|
${endif}
|
|
|
|
|
2011-02-17 19:26:53 +00:00
|
|
|
# Install standard lyxrc.dist file
|
2011-05-23 04:12:10 +00:00
|
|
|
#SetOutPath "$INSTDIR\Resources"
|
|
|
|
#File "${FILES_DEPS}\Resources\lyxrc.dist"
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2011-05-23 04:12:10 +00:00
|
|
|
# create the path prefix
|
2011-02-17 19:27:56 +00:00
|
|
|
# $$ represents a literal $ in an NSIS string
|
2014-03-09 17:19:58 +00:00
|
|
|
StrCpy $PathPrefix "$$LyXDir\bin;$$LyXDir\Python;$$LyXDir\Python\Lib;$$LyXDir\Perl\bin;$$LyXDir\imagemagick"
|
2008-05-01 18:33:36 +00:00
|
|
|
|
2011-08-12 15:19:36 +00:00
|
|
|
${if} $PathLaTeX != ""
|
2008-03-30 21:37:53 +00:00
|
|
|
StrCpy $PathPrefix "$PathPrefix;$PathLaTeX"
|
|
|
|
${EndIf}
|
2011-05-23 04:12:10 +00:00
|
|
|
${if} $PSVPath != ""
|
|
|
|
StrCpy $PathPrefix "$PathPrefix;$PSVPath"
|
|
|
|
${endif}
|
|
|
|
${if} $EditorPath != ""
|
|
|
|
StrCpy $PathPrefix "$PathPrefix;$EditorPath"
|
|
|
|
${endif}
|
|
|
|
${if} $ImageEditorPath != ""
|
|
|
|
StrCpy $PathPrefix "$PathPrefix;$ImageEditorPath"
|
2011-09-05 06:09:13 +00:00
|
|
|
${endif}
|
2012-11-10 21:08:43 +00:00
|
|
|
${if} $GhostscriptPath != ""
|
2011-09-05 06:09:13 +00:00
|
|
|
StrCpy $PathPrefix "$PathPrefix;$GhostscriptPath"
|
2011-05-23 04:12:10 +00:00
|
|
|
${endif}
|
|
|
|
${if} $SVGPath != ""
|
|
|
|
StrCpy $PathPrefix "$PathPrefix;$SVGPath"
|
|
|
|
${endif}
|
2011-12-14 00:14:30 +00:00
|
|
|
${if} $GnumericPath != ""
|
|
|
|
StrCpy $PathPrefix "$PathPrefix;$GnumericPath"
|
|
|
|
${endif}
|
2011-08-12 15:19:36 +00:00
|
|
|
${if} $PathBibTeXEditor != ""
|
2008-05-02 15:53:14 +00:00
|
|
|
StrCpy $PathPrefix "$PathPrefix;$PathBibTeXEditor"
|
2011-08-12 15:19:36 +00:00
|
|
|
${EndIf}
|
2016-02-08 23:31:57 +00:00
|
|
|
${if} $PandocPath != ""
|
|
|
|
StrCpy $PathPrefix "$PathPrefix;$PandocPath"
|
|
|
|
${endif}
|
2011-08-12 15:19:36 +00:00
|
|
|
${if} $LilyPondPath != ""
|
|
|
|
StrCpy $PathPrefix "$PathPrefix;$LilyPondPath"
|
2012-11-10 06:09:20 +00:00
|
|
|
${endif}
|
|
|
|
|
2011-05-23 04:12:10 +00:00
|
|
|
# Set the path prefix in lyxrc.dist
|
|
|
|
ClearErrors
|
|
|
|
Delete "$INSTDIR\Resources\lyxrc.dist"
|
|
|
|
FileOpen $R1 "$INSTDIR\Resources\lyxrc.dist" w
|
2013-12-03 23:02:42 +00:00
|
|
|
# set the format to the latest LyXRC format
|
2017-11-02 20:51:36 +00:00
|
|
|
FileWrite $R1 'Format 24$\r$\n'
|
2011-05-23 04:12:10 +00:00
|
|
|
# set some general things
|
2011-07-29 03:14:33 +00:00
|
|
|
FileWrite $R1 '\screen_zoom 120$\r$\n'
|
2011-05-23 04:12:10 +00:00
|
|
|
${if} "$PathPrefix" != ""
|
|
|
|
FileWrite $R1 '\path_prefix "$PathPrefix"$\r$\n'
|
|
|
|
${endif}
|
2012-11-20 20:53:35 +00:00
|
|
|
|
|
|
|
# use pdfview for all types of PDF files
|
2013-06-03 22:55:55 +00:00
|
|
|
FileWrite $R1 '\format "pdf5" "pdf" "PDF (LuaTeX)" "u" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
|
|
|
|
\format "pdf4" "pdf" "PDF (XeTeX)" "X" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
|
|
|
|
\format "pdf3" "pdf" "PDF (dvipdfm)" "m" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
|
|
|
|
\format "pdf2" "pdf" "PDF (pdflatex)" "F" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n\
|
|
|
|
\format "pdf" "pdf" "PDF (ps2pdf)" "P" "pdfview" "" "document,vector,menu=export" "application/pdf"$\r$\n'
|
2016-02-08 23:31:57 +00:00
|
|
|
|
|
|
|
# use Inkscape to edit PDF and EPS images
|
|
|
|
${if} $SVGPath != ""
|
|
|
|
FileWrite $R1 '\format "pdf6" "pdf" "PDF (graphics)" "" "auto" "inkscape" "vector" "application/pdf"$\r$\n\
|
2016-02-11 00:33:34 +00:00
|
|
|
\format "eps" "eps" "EPS" "" "auto" "inkscape" "vector" "image/x-eps"$\r$\n'
|
|
|
|
${endif}
|
|
|
|
|
|
|
|
# set image editors
|
|
|
|
${if} $ImageEditor == "Gimp"
|
|
|
|
FileWrite $R1 '\format "gif" "gif" "GIF" "" "auto" "gimp-2.8" "" "image/gif"$\r$\n\
|
|
|
|
\format "jpg" "jpg, jpeg" "JPEG" "" "auto" "gimp-2.8" "" "image/jpeg"$\r$\n\
|
|
|
|
\format "png" "png" "PNG" "" "auto" "gimp-2.8" "" "image/x-png"'
|
|
|
|
${endif}
|
|
|
|
${if} $ImageEditor == "Krita"
|
|
|
|
FileWrite $R1 '\format "gif" "gif" "GIF" "" "auto" "krita" "" "image/gif"$\r$\n\
|
|
|
|
\format "jpg" "jpg, jpeg" "JPEG" "" "auto" "krita" "" "image/jpeg"$\r$\n\
|
|
|
|
\format "png" "png" "PNG" "" "auto" "krita" "" "image/x-png"'
|
2016-02-08 23:31:57 +00:00
|
|
|
${endif}
|
|
|
|
|
2015-12-01 23:47:05 +00:00
|
|
|
# if Inkscape is not available Imagemagick will be used to convert WMF/EMF files
|
|
|
|
# We need to specify a resolution for the converter otherwise 1024 dpi are used and
|
|
|
|
# eps2pdf takes ages. 300 dpi are a good compromise for speed and size.
|
|
|
|
${if} $SVGPath == ""
|
|
|
|
FileWrite $R1 '\converter "wmf" "eps" "convert -density 300 $$$$i $$$$o" ""$\r$\n\
|
|
|
|
\converter "emf" "eps" "convert -density 300 $$$$i $$$$o" ""$\r$\n'
|
|
|
|
${endif}
|
2015-11-26 23:39:38 +00:00
|
|
|
|
2011-08-12 15:19:36 +00:00
|
|
|
# if LilyPondPath was found
|
2017-06-09 17:15:58 +00:00
|
|
|
# We need to add these entries because python scripts can only be executed
|
2015-12-01 23:47:05 +00:00
|
|
|
# if the full path is given.
|
2011-08-12 15:19:36 +00:00
|
|
|
${if} $LilyPondPath != ""
|
2014-03-19 22:08:07 +00:00
|
|
|
FileWrite $R1 '\format "lilypond-book" "lytex" "LilyPond book (LaTeX)" "" "" "auto" "document,menu=export" ""$\r$\n\
|
2012-11-20 20:53:35 +00:00
|
|
|
\converter "lilypond-book" "pdflatex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=pdflatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
|
|
|
|
\converter "lilypond-book" "xetex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=xelatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
|
|
|
|
\converter "lilypond-book" "luatex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --pdf --latex-program=lualatex --lily-output-dir=ly-pdf $$$$i" ""$\r$\n\
|
|
|
|
\converter "lilypond-book" "latex" "python \"$LilyPondPath\\lilypond-book.py\" --safe --lily-output-dir=ly-eps $$$$i" ""$\r$\n'
|
2011-05-23 04:12:10 +00:00
|
|
|
${endif}
|
|
|
|
FileClose $R1
|
|
|
|
IfErrors 0 +2
|
2014-02-18 01:15:53 +00:00
|
|
|
MessageBox MB_OK|MB_ICONEXCLAMATION "$(ModifyingConfigureFailed)" /SD IDOK
|
2011-05-23 04:12:10 +00:00
|
|
|
ClearErrors
|
2015-11-16 03:04:11 +00:00
|
|
|
|
|
|
|
# for texindy the path to the perl.exe must unfortunately be in Windows' PATH variable
|
|
|
|
${if} $MultiUser.Privileges != "Admin"
|
|
|
|
${andif} $MultiUser.Privileges != "Power"
|
|
|
|
# call the non-admin version
|
|
|
|
${EnvVarUpdate} $0 "PATH" "A" "HKCU" "$INSTDIR\Perl\bin"
|
|
|
|
${else}
|
|
|
|
${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\Perl\bin"
|
|
|
|
${endif}
|
2008-03-30 21:37:53 +00:00
|
|
|
|
|
|
|
SectionEnd
|
|
|
|
|
2008-04-07 17:26:02 +00:00
|
|
|
#--------------------------------
|
|
|
|
# Run the LyX configure.py script, so MiKTeX can download its packages
|
|
|
|
|
2008-05-01 18:33:36 +00:00
|
|
|
Var ConfigureReturn
|
2008-04-07 17:26:02 +00:00
|
|
|
|
|
|
|
Section -ConfigureScript
|
|
|
|
|
2013-01-28 01:54:31 +00:00
|
|
|
DetailPrint $(TEXT_CONFIGURE_LYX)
|
2020-06-10 10:38:48 +00:00
|
|
|
SetShellVarContext current
|
|
|
|
SetOutPath "$APPDATA\${APP_DIR_USERDATA}"
|
2013-01-28 01:54:31 +00:00
|
|
|
nsExec::ExecToLog '"$INSTDIR\Python\python.exe" "$INSTDIR\Resources\configure.py"'
|
|
|
|
# $ConfigureReturn is "0" if successful, otherwise "1"
|
|
|
|
Pop $ConfigureReturn # Return value
|
2018-09-09 16:33:09 +00:00
|
|
|
# Should we do something with that?
|
2011-05-23 04:12:10 +00:00
|
|
|
|
2008-04-07 17:26:02 +00:00
|
|
|
SectionEnd
|
|
|
|
|
2008-03-30 21:37:53 +00:00
|
|
|
#--------------------------------
|
2017-12-06 14:31:10 +00:00
|
|
|
#
|
2008-03-30 21:37:53 +00:00
|
|
|
|
2020-07-12 16:54:56 +00:00
|
|
|
#Function StartLyX
|
2011-05-23 04:12:10 +00:00
|
|
|
|
2011-12-21 01:12:43 +00:00
|
|
|
# run LyX in a command line window to give the users feedback about
|
|
|
|
# the time consuming LaTeX package installation
|
2011-05-23 04:12:10 +00:00
|
|
|
|
2020-07-12 16:54:56 +00:00
|
|
|
# Exec "$INSTDIR\${APP_RUN}"
|
2011-05-23 04:12:10 +00:00
|
|
|
|
2020-07-12 16:54:56 +00:00
|
|
|
#FunctionEnd
|