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-01 17:55:54 +00:00
|
|
|
# Set a path prefix in lyxrc.dist
|
2007-04-16 22:33:53 +00:00
|
|
|
ClearErrors
|
|
|
|
${if} "$PathPrefix" != ""
|
|
|
|
Delete "$INSTDIR\Resources\lyxrc.dist"
|
|
|
|
FileOpen $R1 "$INSTDIR\Resources\lyxrc.dist" w
|
|
|
|
FileWrite $R1 '\path_prefix "$PathPrefix"$\r$\n'
|
|
|
|
FileClose $R1
|
|
|
|
IfErrors 0 +2
|
|
|
|
MessageBox MB_OK|MB_ICONEXCLAMATION "$(ModifyingConfigureFailed)"
|
|
|
|
${endif}
|
|
|
|
|
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-01 14:21:21 +00:00
|
|
|
start "${PRODUCT_NAME}" "${LAUNCHER_NAME}" %*$\r$\n'
|
2007-04-16 22:33:53 +00:00
|
|
|
FileClose $R1
|
|
|
|
IfErrors 0 +2
|
|
|
|
MessageBox MB_OK|MB_ICONEXCLAMATION "$(CreateCmdFilesFailed)"
|
|
|
|
|
2007-05-01 17:55:54 +00:00
|
|
|
# set the preferences file
|
|
|
|
# (having one preferences file that is modified to fit the needs is possible but not easy to maintain
|
|
|
|
# therefore simply delete the files that shouldn't be used)
|
|
|
|
# if not Acrobat or Adobe Reader is used
|
2007-05-01 18:21:56 +00:00
|
|
|
${if} $Acrobat == "None" # clear the entries in the preferences file that define PDFView or PDFViewWin8 as viewer
|
2007-04-16 22:33:53 +00:00
|
|
|
Rename "$INSTDIR\Resources\preferencesGSview" "$INSTDIR\Resources\preferences"
|
|
|
|
Delete "$INSTDIR\Resources\preferences7"
|
|
|
|
Delete "$INSTDIR\Resources\preferences8"
|
|
|
|
${endif}
|
2007-05-01 17:55:54 +00:00
|
|
|
# if Acrobat or Adobe Reader is used
|
|
|
|
${if} $Acrobat == "7" # used for all Acrobat (Adobe Reader) versions <= 7
|
2007-04-16 22:33:53 +00:00
|
|
|
Rename "$INSTDIR\Resources\preferences7" "$INSTDIR\Resources\preferences"
|
|
|
|
Delete "$INSTDIR\Resources\preferences8"
|
|
|
|
Delete "$INSTDIR\Resources\preferencesGSview"
|
|
|
|
${endif}
|
|
|
|
${if} $Acrobat == "8"
|
|
|
|
Rename "$INSTDIR\Resources\preferences8" "$INSTDIR\Resources\preferences"
|
|
|
|
Delete "$INSTDIR\Resources\preferences7"
|
|
|
|
Delete "$INSTDIR\Resources\preferencesGSview"
|
|
|
|
${endif}
|
|
|
|
|
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"
|
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}"
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${PRODUCT_REGNAME}\Shell\open\command" "" '"${LAUNCHER_EXE}" "%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}"
|
|
|
|
WriteRegStr SHCTX "Software\Classes\${PRODUCT_EXT}" "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-01 17:55:54 +00:00
|
|
|
# create the LyX Application Data folder for all users
|
|
|
|
# this folder is automatically created by LyX when it is first started but we want to start LyX with a specific session file,
|
|
|
|
# so we create this folder before LyX starts and copy there the session file
|
|
|
|
Call CreateAppPathSub # function from LyXUtils.nsh
|
2007-04-16 22:33:53 +00:00
|
|
|
|
|
|
|
FunctionEnd
|
|
|
|
|