4 # create the PathPrefix
5 StrCpy $PathPrefix "$INSTDIR\bin"
6 ${if} $PythonPath != ""
7 StrCpy $PathPrefix "$PathPrefix;$PythonPath"
10 StrCpy $PathPrefix "$PathPrefix;$LatexPath"
12 ${if} $GhostscriptPath != ""
13 StrCpy $PathPrefix "$PathPrefix;$GhostscriptPath"
15 ${if} $ImageMagickPath != ""
16 StrCpy $PathPrefix "$PathPrefix;$ImageMagickPath"
19 StrCpy $PathPrefix "$PathPrefix;$PSVPath"
21 ${if} $EditorPath != ""
22 StrCpy $PathPrefix "$PathPrefix;$EditorPath"
24 ${if} $ImageEditorPath != ""
25 StrCpy $PathPrefix "$PathPrefix;$ImageEditorPath"
28 StrCpy $PathPrefix "$PathPrefix;$SVGPath"
31 # Set a path prefix in lyxrc.dist
33 ${if} "$PathPrefix" != ""
34 Delete "$INSTDIR\Resources\lyxrc.dist"
35 FileOpen $R1 "$INSTDIR\Resources\lyxrc.dist" w
36 FileWrite $R1 '\path_prefix "$PathPrefix"$\r$\n'
39 MessageBox MB_OK|MB_ICONEXCLAMATION "$(ModifyingConfigureFailed)"
42 # Create a batch file to start LyX with the environment variables set
44 Delete "${PRODUCT_BAT}"
45 FileOpen $R1 "${PRODUCT_BAT}" w
46 FileWrite $R1 '@echo off$\r$\n\
47 SET LANG=$LangCode$\r$\n\
48 SET AIK_DATA_DIR=${AiksaurusDir}$\r$\n\
49 start "${PRODUCT_NAME}" "${LAUNCHER_EXE}" %*$\r$\n'
52 MessageBox MB_OK|MB_ICONEXCLAMATION "$(CreateCmdFilesFailed)"
54 # set up the preferences file
55 # if Acrobat or Adobe Reader is used
56 ${if} $Acrobat == "Yes" # used for Acrobat / Adobe Reader
57 # writes settings to the preferences file
58 ${LineFind} "$INSTDIR\Resources\preferences" "$INSTDIR\Resources\preferences" "75" "AcroPref"
59 # ${LineFind} macro from TextFunc.nsh # calls Function AcroPref
62 # if a SVG to PDF converter ws found (e.g. Inkscape) define it in the preferences
64 ${if} $Acrobat == "Yes"
65 # writes settings to the preferences file
66 ${LineFind} "$INSTDIR\Resources\preferences" "$INSTDIR\Resources\preferences" "78" "SVGPref1"
67 # deletes lines from the preferences file
68 ${LineFind} "$INSTDIR\Resources\preferences" "$INSTDIR\Resources\preferences" "87:90" "SVGPref2"
70 # writes settings to the preferences file but 3 lines earlier because the
71 #3 PDF lines are in this case not here
72 ${LineFind} "$INSTDIR\Resources\preferences" "$INSTDIR\Resources\preferences" "75" "SVGPref1"
73 ${LineFind} "$INSTDIR\Resources\preferences" "$INSTDIR\Resources\preferences" "84:87" "SVGPref2"
78 ${if} $CreateFileAssociations == "true"
79 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "${PRODUCT_EXE}"
81 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "RootKey" "$ProductRootKey"
82 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
83 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" "${PRODUCT_UNINSTALL_EXE}"
84 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "${PRODUCT_EXE}"
85 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
86 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
87 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "${PRODUCT_INFO_URL}"
88 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_ABOUT_URL}"
89 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "Publisher" "LyX Team"
90 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "HelpLink" "${PRODUCT_HELP_LINK}"
91 WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" 0x00000001
92 WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" 0x00000001
94 # create start menu entry
95 SetOutPath "$INSTDIR\bin"
96 CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
97 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\${PRODUCT_NAME}.lnk" "${PRODUCT_BAT}" "" "${PRODUCT_EXE}"
99 CreateShortCut "$SMPROGRAMS\$StartmenuFolder\Uninstall.lnk" "${PRODUCT_UNINSTALL_EXE}"
101 # create desktop icon
102 ${if} $CreateDesktopIcon == "true"
103 SetOutPath "$INSTDIR\bin"
104 CreateShortCut "$DESKTOP\LyX ${PRODUCT_VERSION}.lnk" "${PRODUCT_BAT}" "" "${PRODUCT_EXE}"
107 # register the extension .lyx
108 ${if} $CreateFileAssociations == "true"
109 # write informations about file type
110 WriteRegStr SHCTX "Software\Classes\${PRODUCT_REGNAME}" "" "${PRODUCT_NAME} Document"
111 WriteRegStr SHCTX "Software\Classes\${PRODUCT_REGNAME}\DefaultIcon" "" "${PRODUCT_EXE}"
112 WriteRegStr SHCTX "Software\Classes\${PRODUCT_REGNAME}\Shell\open\command" "" '"${PRODUCT_BAT}" "%1"'
113 # write informations about file extensions
114 WriteRegStr SHCTX "Software\Classes\${PRODUCT_EXT}" "" "${PRODUCT_REGNAME}"
115 WriteRegStr SHCTX "Software\Classes\${PRODUCT_EXT}" "Content Type" "${PRODUCT_MIME_TYPE}"
117 System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)'
120 # create the LyX Application Data folder for all users
121 # this folder is automatically created by LyX when it is first started but we want to start LyX with a specific session file,
122 # so we create this folder before LyX starts and copy there the session file
123 Call CreateAppPathSub # function from LyXUtils.nsh
125 # delete unnecessary files
126 ${if} $DelPythonFiles == "True"
127 Delete $INSTDIR\bin\python.exe
128 Delete $INSTDIR\bin\python25.dll
129 Delete $INSTDIR\bin\Python-License.txt
130 RMDir /r $INSTDIR\bin\Lib
131 RMDir /r $INSTDIR\bin\DLLs
133 RMDir /r $INSTDIR\external
135 # create a bat-file to start configure in a console window so that the user see the progress
136 # of the configuration and to have a signal when the configuration is ready to start LyX
137 # this is important when LyX is installed together with MiKTeX or when LyX is installed for the first
138 # time on a computer, because the installation of missing LaTeX-files required by LyX could last minutes
139 # a batch file is needed because simply calling
140 # ExecWait '"$PythonPath\python.exe" "$INSTDIR\Resources\configure.py"'
141 # creates the config files in $PythonPath
142 ${if} $PythonPath == ""
143 StrCpy $PythonPath "$INSTDIR\bin"
145 StrCpy $1 $INSTDIR 2 # get drive letter
146 FileOpen $R1 "$INSTDIR\Resources\configLyX.bat" w
147 FileWrite $R1 '$1$\r$\n\
148 cd $INSTDIR\Resources\$\r$\n\
149 "$PythonPath\python.exe" configure.py'
154 # --------------------------------
157 # writes PDF settings to the preferences file
159 FileWrite $R4 '\format "pdf3" "pdf" "PDF (dvipdfm)" "m" "PDFViewWin" "" "document,vector"$\r$\n\
160 \format "pdf2" "pdf" "PDF (pdflatex)" "F" "PDFViewWin" "" "document,vector"$\r$\n\
161 \format "pdf" "pdf" "PDF (ps2pdf)" "P" "PDFViewWin" "" "document,vector"$\r$\n'
166 # --------------------------------
169 # writes SVG settings to the preferences file
171 FileWrite $R4 '\format "svg" "svg" "SVG" "" "inkscape --file=$$$$i" "inkscape --file=$$$$i" "vector"$\r$\n\
174 # CONVERTERS SECTION ##########################$\r$\n\
177 \converter "svg" "png" "inkscape --without-gui --file=$$$$i --export-png=$$$$o" ""$\r$\n\
178 \converter "svg" "pdf" "inkscape --file=$$$$i --export-area-drawing --without-gui --export-pdf=$$$$o" ""$\r$\n\
179 \converter "svg" "pdf2" "inkscape --file=$$$$i --export-area-drawing --without-gui --export-pdf=$$$$o" ""'
185 # deletes lines from the preferences file