]> git.lyx.org Git - lyx.git/blobdiff - development/Win32/packaging/installer/setup/configure.nsh
Typo in comment
[lyx.git] / development / Win32 / packaging / installer / setup / configure.nsh
index 0601a1da90def58f931e273d61bec085224f9cd3..4957f4d9168496510113fd0139beb324592344c6 100644 (file)
@@ -22,6 +22,10 @@ Section -InstallData
   
   # Start Menu shortcut
   SetOutPath "$INSTDIR\bin" # this is the folder in which the shortcut is executed
+  # we must assure that the folder is not empty (happens on silent install and can accidentally happen)
+  ${if} $StartmenuFolder == ""
+   StrCpy $StartmenuFolder "${APP_DIR}"
+  ${endif}
   CreateDirectory "$SMPROGRAMS\$StartmenuFolder"
   CreateShortCut "$SMPROGRAMS\$StartmenuFolder\${APP_NAME}.lnk" "$INSTDIR\${APP_RUN}" "" "$INSTDIR\${APP_RUN}" "" "" "" "${APP_INFO}"
   # Link to www.lyx.org and to the Wiki
@@ -43,16 +47,16 @@ Section -InstallData
   WriteRegStr SHCTX ${APP_UNINST_KEY} "UninstallString" '"$INSTDIR\${SETUP_UNINSTALLER}"'
   WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayVersion" "${APP_VERSION}"
   WriteRegStr SHCTX ${APP_UNINST_KEY} "DisplayIcon" "$INSTDIR\bin\lyx,0"
-  WriteRegStr SHCTX ${APP_UNINST_KEY} "URLUpdateInfo" "http://www.lyx.org/"
-  WriteRegStr SHCTX ${APP_UNINST_KEY} "URLInfoAbout" "http://www.lyx.org/about/"
+  WriteRegStr SHCTX ${APP_UNINST_KEY} "URLUpdateInfo" "${APP_WEBPAGE}"
+  WriteRegStr SHCTX ${APP_UNINST_KEY} "URLInfoAbout" "http://www.lyx.org/AboutLyX"
   WriteRegStr SHCTX ${APP_UNINST_KEY} "Publisher" "LyX Team"
-  WriteRegStr SHCTX ${APP_UNINST_KEY} "HelpLink" "http://www.lyx.org/internet/mailing.php"
+  WriteRegStr SHCTX ${APP_UNINST_KEY} "HelpLink" "http://www.lyx.org/MailingLists"
   WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoModify" 0x00000001
   WriteRegDWORD SHCTX ${APP_UNINST_KEY} "NoRepair" 0x00000001
   WriteRegStr SHCTX ${APP_UNINST_KEY} "StartMenu" "$SMPROGRAMS\$StartmenuFolder"
   
-  # if we install over an existing version, remove the old uninstaller information
-  ${if} $OldVersionNumber != ""
+  # if we install over an older existing version, remove the old uninstaller information
+  ${if} $OldVersionNumber < ${APP_SERIES_KEY}
    DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber"
    # also delete in the case of an emergency release
    DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}$OldVersionNumber1"
@@ -65,7 +69,7 @@ SectionEnd
 
 Section -Configure
 
-  # Associate .lyx files with LyX for current user of all users
+  # Associate .lyx files with LyX for current user or all users
 
   ${if} $CreateFileAssociations == "true"
    WriteRegStr SHCTX "${APP_DIR_REGKEY}" "" "$INSTDIR\${APP_RUN}"
@@ -79,6 +83,13 @@ Section -Configure
    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"'
+   # 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
    WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "" "${APP_REGNAME_DOC}"
    WriteRegStr SHCTX "Software\Classes\${APP_EXT}" "Content Type" "${APP_MIME_TYPE}"
    # .lyx13
@@ -93,7 +104,10 @@ Section -Configure
    # .lyx16
    WriteRegStr SHCTX "Software\Classes\${APP_EXT}16" "" "${APP_REGNAME_DOC}"
    WriteRegStr SHCTX "Software\Classes\${APP_EXT}16" "Content Type" "${APP_MIME_TYPE}"
-   # .lyx20 don't set this, because this is designed to be opened with LyX 2.0.x
+   # .lyx20
+   WriteRegStr SHCTX "Software\Classes\${APP_EXT}20" "" "${APP_REGNAME_DOC}"
+   WriteRegStr SHCTX "Software\Classes\${APP_EXT}20" "Content Type" "${APP_MIME_TYPE}"
+   # .lyx21 don't set this, because this is designed to be opened with LyX 2.1.x
   
    # Refresh shell
    ${RefreshShellIcons}
@@ -105,7 +119,7 @@ Section -Configure
 
   # create the path prefix
   # $$ represents a literal $ in an NSIS string
-  StrCpy $PathPrefix "$$LyXDir\bin;$$LyXDir\Python;$$LyXDir\Python\Lib;$$LyXDir\imagemagick"
+  StrCpy $PathPrefix "$$LyXDir\bin;$$LyXDir\Python;$$LyXDir\Python\Lib;$$LyXDir\Perl\bin;$$LyXDir\imagemagick"
   
   ${if} $PathLaTeX != ""
     StrCpy $PathPrefix "$PathPrefix;$PathLaTeX"
@@ -131,6 +145,9 @@ Section -Configure
   ${if} $PathBibTeXEditor != ""
     StrCpy $PathPrefix "$PathPrefix;$PathBibTeXEditor"
   ${EndIf}
+  ${if} $PandocPath != ""
+   StrCpy $PathPrefix "$PathPrefix;$PandocPath"
+  ${endif}
   ${if} $LilyPondPath != ""
    StrCpy $PathPrefix "$PathPrefix;$LilyPondPath"
   ${endif}
@@ -140,29 +157,51 @@ Section -Configure
   Delete "$INSTDIR\Resources\lyxrc.dist"
   FileOpen $R1 "$INSTDIR\Resources\lyxrc.dist" w
   # set the format to the latest LyXRC format
-  FileWrite $R1 'Format 14$\r$\n'
+  FileWrite $R1 'Format 21$\r$\n'
   # set some general things
   FileWrite $R1 '\screen_zoom 120$\r$\n'
   ${if} "$PathPrefix" != ""
    FileWrite $R1 '\path_prefix "$PathPrefix"$\r$\n'
   ${endif}
   
-  # set path to eLyXer
-  FileWrite $R1 '\converter "lyx" "html" "python -tt \"$INSTDIR\Python\Lib\elyxer.py\" --directory $$$$r $$$$i $$$$o" ""$\r$\n\
-                 \converter "lyx" "wordhtml" "python -tt \"$INSTDIR\Python\Lib\elyxer.py\" --html --directory $$$$r $$$$i $$$$o" ""$\r$\n'
-  
   # use pdfview for all types of PDF files
   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'
-
+  
+  # use Inkscape to edit PDF and EPS images
+  ${if} $SVGPath != ""
+   FileWrite $R1 '\format "pdf6" "pdf" "PDF (graphics)" "" "auto" "inkscape" "vector" "application/pdf"$\r$\n\
+                                 \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"'
+  ${endif}
+  
+  # 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}
+  
   # if LilyPondPath was found
-  # we need to add these entris because python scripts can only be executed
-  # if the full path is given
+  # We need to add these entries because python scripts can only be executed
+  # if the full path is given.
   ${if} $LilyPondPath != ""
-   FileWrite $R1 '\format "lilypond-book" "lytex" "LilyPond book (LaTeX)" "" "" "auto" "document,menu=export"$\r$\n\
+   FileWrite $R1 '\format "lilypond-book" "lytex" "LilyPond book (LaTeX)" "" "" "auto" "document,menu=export" ""$\r$\n\
                  \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\
@@ -170,24 +209,16 @@ Section -Configure
   ${endif}
   FileClose $R1
   IfErrors 0 +2
-   MessageBox MB_OK|MB_ICONEXCLAMATION "$(ModifyingConfigureFailed)"
+   MessageBox MB_OK|MB_ICONEXCLAMATION "$(ModifyingConfigureFailed)" /SD IDOK
   ClearErrors
-
-SectionEnd
-
-#--------------------------------
-# Postscript printer for metafile to EPS converter
-
-Section -PSPrinter
-
-  ${if} $MultiUser.Privileges == "Admin"
-  ${orif} $MultiUser.Privileges == "Power"
-   # Delete printer
-   ExecWait '$PrinterConf /q /dl /n "Metafile to EPS Converter"'
-   # Install printer and driver
-   ExecWait '$PrinterConf /if /f "$WINDIR\inf\ntprint.inf" /b "Metafile to EPS Converter" /r "FILE:" /m "MS Publisher Imagesetter"'
+  
+  # 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}
-   MessageBox MB_OK|MB_ICONINFORMATION "$(MetafileNotAvailable)"
+   ${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\Perl\bin"
   ${endif}
 
 SectionEnd
@@ -204,16 +235,20 @@ Section -ConfigureScript
   # ask to update MiKTeX
   ${if} $LaTeXInstalled == "MiKTeX"
    Call UpdateMiKTeX # function from latex.nsh
-   # install all necessary packages at once
+   # install all necessary packages at once because this is much faster then to install the packages one by one
    DetailPrint $(TEXT_CONFIGURE_LYX)
    ${if} $MultiUser.Privileges != "Admin"
    ${andif} $MultiUser.Privileges != "Power"
     # call the non-admin version
+    # at first we need to synchronize the package database
+    nsExec::ExecToLog '"$PathLaTeX\mpm.exe" "--verbose" "--update-db"'
     nsExec::ExecToLog '"$PathLaTeX\mpm.exe" "--verbose" "--install-some=$INSTDIR\Resources\Packages.txt"'
    ${else}
     ${if} $MiKTeXUser != "HKCU" # call the admin version
+     nsExec::ExecToLog '"$PathLaTeX\mpm.exe" "--admin" "--verbose" "--update-db"'
      nsExec::ExecToLog '"$PathLaTeX\mpm.exe" "--admin" "--verbose" "--install-some=$INSTDIR\Resources\Packages.txt"'
     ${else}
+     nsExec::ExecToLog '"$PathLaTeX\mpm.exe" "--verbose" "--update-db"'
      nsExec::ExecToLog '"$PathLaTeX\mpm.exe" "--verbose" "--install-some=$INSTDIR\Resources\Packages.txt"'
     ${endif}
    ${endif}