2007-04-16 22:33:53 +00:00
Function ConfigureLyX
2007-05-01 17:55:54 +00:00
# configures LyX
2007-04-16 22:33:53 +00:00
2007-05-01 17:55:54 +00:00
# create the PathPrefix
2007-04-16 22:33:53 +00:00
StrCpy $PathPrefix "$INSTDIR\bin"
${if} $PythonPath != ""
StrCpy $PathPrefix "$PathPrefix;$PythonPath"
${endif}
${if} $LatexPath != ""
StrCpy $PathPrefix "$PathPrefix;$LatexPath"
${endif}
${if} $GhostscriptPath != ""
StrCpy $PathPrefix "$PathPrefix;$GhostscriptPath"
${endif}
${if} $ImageMagickPath != ""
StrCpy $PathPrefix "$PathPrefix;$ImageMagickPath"
${endif}
${if} $PSVPath != ""
StrCpy $PathPrefix "$PathPrefix;$PSVPath"
${endif}
${if} $EditorPath != ""
StrCpy $PathPrefix "$PathPrefix;$EditorPath"
${endif}
${if} $ImageEditorPath != ""
StrCpy $PathPrefix "$PathPrefix;$ImageEditorPath"
${endif}
2007-05-25 09:39:18 +00:00
${if} $SVGPath != ""
StrCpy $PathPrefix "$PathPrefix;$SVGPath"
${endif}
2008-11-12 02:32:02 +00:00
${if} $WMFPath != ""
StrCpy $PathPrefix "$PathPrefix;$WMFPath"
${endif}
2007-04-16 22:33:53 +00:00
2007-05-01 17:55:54 +00:00
# Create a batch file to start LyX with the environment variables set
2007-04-16 22:33:53 +00:00
ClearErrors
Delete "${PRODUCT_BAT}"
FileOpen $R1 "${PRODUCT_BAT}" w
FileWrite $R1 '@echo off$\r$\n\
SET LANG=$LangCode$\r$\n\
SET AIK_DATA_DIR=${AiksaurusDir}$\r$\n\
2007-05-02 19:20:12 +00:00
start "${PRODUCT_NAME}" "${LAUNCHER_EXE}" %*$\r$\n'
2007-04-16 22:33:53 +00:00
FileClose $R1
IfErrors 0 +2
MessageBox MB_OK|MB_ICONEXCLAMATION "$(CreateCmdFilesFailed)"
2008-07-13 21:59:57 +00:00
# Set the path prefix in lyxrc.dist
ClearErrors
Delete "$INSTDIR\Resources\lyxrc.dist"
FileOpen $R1 "$INSTDIR\Resources\lyxrc.dist" w
# set some general things
2009-10-20 02:09:03 +00:00
FileWrite $R1 '\screen_zoom "120"$\r$\n'
2008-07-13 21:59:57 +00:00
${if} "$PathPrefix" != ""
FileWrite $R1 '\path_prefix "$PathPrefix"$\r$\n'
${endif}
2007-05-01 17:55:54 +00:00
# if Acrobat or Adobe Reader is used
2007-05-07 01:19:52 +00:00
${if} $Acrobat == "Yes" # used for Acrobat / Adobe Reader
2008-07-13 21:59:57 +00:00
FileWrite $R1 '\format "pdf3" "pdf" "PDF (dvipdfm)" "m" "pdfview" "" "document,vector"$\r$\n\
\format "pdf2" "pdf" "PDF (pdflatex)" "F" "pdfview" "" "document,vector"$\r$\n\
\format "pdf" "pdf" "PDF (ps2pdf)" "P" "pdfview" "" "document,vector"$\r$\n'
2007-04-16 22:33:53 +00:00
${endif}
2008-07-13 21:59:57 +00:00
# if a SVG to PDF converter ws found (e.g. Inkscape)
2007-05-25 09:39:18 +00:00
${if} $SVGPath != ""
2008-07-13 21:59:57 +00:00
FileWrite $R1 '\format "svg" "svg" "SVG" "" "inkscape --file=$$$$i" "inkscape --file=$$$$i" "vector"$\r$\n\
\converter "svg" "png" "inkscape --without-gui --file=$$$$i --export-png=$$$$o" ""$\r$\n\
\converter "svg" "pdf" "inkscape --file=$$$$i --export-area-drawing --without-gui --export-pdf=$$$$o" ""$\r$\n\
\converter "svg" "pdf2" "inkscape --file=$$$$i --export-area-drawing --without-gui --export-pdf=$$$$o" ""'
${endif}
FileClose $R1
IfErrors 0 +2
2009-11-10 03:29:13 +00:00
MessageBox MB_OK|MB_ICONEXCLAMATION "$(ModifyingConfigureFailed)"
ClearErrors
2007-05-25 09:39:18 +00:00
2007-05-01 17:55:54 +00:00
# register LyX
2007-04-30 00:55:50 +00:00
${if} $CreateFileAssociations == "true"
2007-04-30 01:04:47 +00:00
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "${PRODUCT_EXE}"
2007-04-30 00:55:50 +00:00
${endif}
2007-05-01 14:21:21 +00:00
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "RootKey" "$ProductRootKey"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" "${PRODUCT_UNINSTALL_EXE}"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "${PRODUCT_EXE}"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_INFO_URL}"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_ABOUT_URL}"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "Publisher" "LyX Team"
WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "HelpLink" "${PRODUCT_HELP_LINK}"
WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" 0x00000001
WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" 0x00000001
2007-04-16 22:33:53 +00:00
2007-05-01 17:55:54 +00:00
# create start menu entry
2007-04-16 22:33:53 +00:00
SetOutPath "$INSTDIR\bin"
CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
CreateShortCut "$SMPROGRAMS\$StartmenuFolder\${PRODUCT_NAME}.lnk" "${PRODUCT_BAT}" "" "${PRODUCT_EXE}"
SetOutPath "$INSTDIR"
CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Uninstall.lnk" "${PRODUCT_UNINSTALL_EXE}"
2007-05-01 17:55:54 +00:00
# create desktop icon
2007-04-16 22:33:53 +00:00
${if} $CreateDesktopIcon == "true"
SetOutPath "$INSTDIR\bin"
CreateShortCut "$DESKTOP\LyX ${PRODUCT_VERSION}.lnk" "${PRODUCT_BAT}" "" "${PRODUCT_EXE}"
${endif}
2007-05-01 17:55:54 +00:00
# register the extension .lyx
2007-04-16 22:33:53 +00:00
${if} $CreateFileAssociations == "true"
2008-04-24 01:34:33 +00:00
WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "OnlyWithLyX" "Yes${PRODUCT_VERSION_SHORT}" # special entry to test if they were registered by this LyX version
2007-05-01 17:55:54 +00:00
# write informations about file type
2007-05-01 14:21:21 +00:00
WriteRegStr SHCTX "Software\Classes\${PRODUCT_REGNAME}" "" "${PRODUCT_NAME} Document"
WriteRegStr SHCTX "Software\Classes\${PRODUCT_REGNAME}\DefaultIcon" "" "${PRODUCT_EXE}"
2007-05-02 22:13:27 +00:00
WriteRegStr SHCTX "Software\Classes\${PRODUCT_REGNAME}\Shell\open\command" "" '"${PRODUCT_BAT}" "%1"'
2007-05-01 17:55:54 +00:00
# write informations about file extensions
2007-05-01 14:21:21 +00:00
WriteRegStr SHCTX "Software\Classes\${PRODUCT_EXT}" "" "${PRODUCT_REGNAME}"
2008-10-05 21:48:07 +00:00
WriteRegStr SHCTX "Software\Classes\${PRODUCT_EXT}" "Content Type" "${PRODUCT_MIME_TYPE}"
# .lyx13
WriteRegStr SHCTX "Software\Classes\${PRODUCT_EXT}13" "" "${PRODUCT_REGNAME}"
WriteRegStr SHCTX "Software\Classes\${PRODUCT_EXT}13" "Content Type" "${PRODUCT_MIME_TYPE}"
# .lyx14
WriteRegStr SHCTX "Software\Classes\${PRODUCT_EXT}14" "" "${PRODUCT_REGNAME}"
WriteRegStr SHCTX "Software\Classes\${PRODUCT_EXT}14" "Content Type" "${PRODUCT_MIME_TYPE}"
2009-02-08 19:08:29 +00:00
# .lyx15 don't set this, because this is designed to be opened with LyX 1.5.x
#WriteRegStr SHCTX "Software\Classes\${PRODUCT_EXT}15" "" "${PRODUCT_REGNAME}"
#WriteRegStr SHCTX "Software\Classes\${PRODUCT_EXT}15" "Content Type" "${PRODUCT_MIME_TYPE}"
# .lyx16
WriteRegStr SHCTX "Software\Classes\${PRODUCT_EXT}16" "" "${PRODUCT_REGNAME}"
WriteRegStr SHCTX "Software\Classes\${PRODUCT_EXT}16" "Content Type" "${PRODUCT_MIME_TYPE}"
2007-05-01 17:55:54 +00:00
# refresh shell
2007-05-01 14:21:21 +00:00
System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
2007-04-16 22:33:53 +00:00
${endif}
2007-05-15 22:43:05 +00:00
# delete unnecessary files
${if} $DelPythonFiles == "True"
Delete $INSTDIR\bin\python.exe
2008-10-30 01:20:48 +00:00
Delete $INSTDIR\bin\python26.dll
2007-05-15 22:43:05 +00:00
Delete $INSTDIR\bin\Python-License.txt
RMDir /r $INSTDIR\bin\Lib
RMDir /r $INSTDIR\bin\DLLs
${endif}
RMDir /r $INSTDIR\external
# create a bat-file to start configure in a console window so that the user see the progress
# of the configuration and to have a signal when the configuration is ready to start LyX
# this is important when LyX is installed together with MiKTeX or when LyX is installed for the first
# time on a computer, because the installation of missing LaTeX-files required by LyX could last minutes
# a batch file is needed because simply calling
# ExecWait '"$PythonPath\python.exe" "$INSTDIR\Resources\configure.py"'
# creates the config files in $PythonPath
${if} $PythonPath == ""
StrCpy $PythonPath "$INSTDIR\bin"
${endif}
StrCpy $1 $INSTDIR 2 # get drive letter
FileOpen $R1 "$INSTDIR\Resources\configLyX.bat" w
FileWrite $R1 '$1$\r$\n\
cd $INSTDIR\Resources\$\r$\n\
"$PythonPath\python.exe" configure.py'
FileClose $R1
2007-04-16 22:33:53 +00:00
FunctionEnd