Angus Leeming wrote:

I'm now able compile it successfully.

Congratulations!

Thanks, but now the surprise:

http://fkurth.de/uwest/LyX/Installer/lyx_setup_136small-v12.exe

This is the installer that includes the LyXWinUtils.
(BTW. could you please move the file to the wiki-page. It is too big for to upload. Thanks in advance.)

I introduced a page to select LyX's menu language. Then a system variable is set. If the user has admin privileges it is valid for all users, if not it is only valid for the actual user. The variable is deleted while uninstalling. I implement the language choice as radio group. It looks nicer if it is in a dropdown list, but the code will then be bigger. Feel free to implement this feature in your version as it is or as dropdown list. BTW. NSIS can't display unicode chars, that's why the "č" for the slovenian and slovakian language is shown as "c". The name of the russian language is therefore written with latin chars.

I also changed some minor things:
- Split the path_prefix i the summary to make it readable.
- Disable the button "Start Now" in the finish-page.
  Because the finish-page appears before LyX's config is ready _and_
  because the menu language will first be shown after the installer is
  finished.

There is only one problem left:
The last entry of the path_prefix shown within LyX's preferences is wrong: E.g. when LyX is installed in C:\LyXTest\LyX the entry is C:\LyXTest\bin, which doesn't exist. The path_prefix generated by the installer is correct. Possibly a problem in the lyx_path_prefix.C. Any idea? (I guess this problem does also occur in your version.)

I attached the diff file between my and your script.

My package repository can be downloaded from

http://fkurth.de/uwest/LyX/Installer/LyXPackage.rar

It includes the .ini file for the language window and a new script to write the evironment variable.

There is now only one thig to do:
Install the math-fonts automatically.
I'm able to copy the files to the font directory but couldn't find the command to install them.

best regards Uwe
--- lyx_installer.nsi	Thu Jun 09 13:48:43 2005
+++ LyXWinUtils.nsi	Sat Jun 11 23:14:26 2005
@@ -1,12 +1,12 @@
 ; Lyx for Windows, NSIS v2 series installer script
 
-; File lyx_installer.nsi
+; File LyXWinUtils.nsi
 ; This file is part of LyX, the document processor.
 ; http://www.lyx.org/
 ; Licence details can be found in the file COPYING or copy at
 ; http://www.lyx.org/about/license.php3
 
-; Author Angus Leeming
+; Author Uwe Stöhr based on the work of Angus Leeming
 ; Full author contact details are available in file CREDITS or copy at
 ; http://www.lyx.org/about/credits.php
 
@@ -19,22 +19,22 @@
 CRCCheck force
 
 ; Make the installer as small as possible.
-SetCompressor lzma
+;SetCompressor lzma
 
 ;--------------------------------
 ; You should need to change only these macros...
 
 !define PRODUCT_NAME "LyX"
 !define PRODUCT_VERSION "1.3.6"
-!define PRODUCT_LICENSE_FILE "..\..\..\..\COPYING"
-!define PRODUCT_SOURCEDIR "J:\Programs\LyX"
+!define PRODUCT_LICENSE_FILE "F:\LyXPackage\License.txt"
+!define PRODUCT_SOURCEDIR "F:\LyXPackage\LyX"
 !define PRODUCT_EXE "$INSTDIR\bin\lyx.exe"
 !define PRODUCT_EXT ".lyx"
 !define PRODUCT_MIME_TYPE "application/lyx"
 !define PRODUCT_UNINSTALL_EXE "$INSTDIR\uninstall.exe"
 
-!define INSTALLER_EXE "lyx_setup_136.exe"
-!define INSTALLER_ICON "..\icons\lyx_32x32.ico"
+!define INSTALLER_EXE "lyx_setup_136small.exe"
+!define INSTALLER_ICON "F:\LyXpackage\icons\lyx_32x32.ico"
 
 ; Replaced by HKLM or HKCU depending on SetShellVarContext.
 !define PRODUCT_ROOT_KEY "SHCTX"
@@ -56,8 +56,9 @@
 !include "strtrim.nsh"
 !include "download.nsh"
 
+
 ; Declare used functions
-${StrLoc}
+;${StrLoc}
 ${StrRep}
 ${StrTrim}
 ${ReadDownloadValues}
@@ -75,22 +76,28 @@
 ; in the Registry.
 !include "abi_util_fileassoc.nsh"
 
+;Grabbed from
+;http://nsis.sourceforge.net/archive/viewpage.php?pageid=137
+;to write environment variables.
+;include "WriteEnvStr.nsh"
+;this is included later
+
 ;--------------------------------
 ; Variables
 
-Var MinSYSPath
-Var DownloadMinSYS
+;Var MinSYSPath
+;Var DownloadMinSYS
 
-Var PythonPath
-Var DownloadPython
+;Var PythonPath
+;Var DownloadPython
 
 Var DoNotRequireMiKTeX
 Var MiKTeXPath
 Var DownloadMiKTeX
 
-Var DoNotRequirePerl
-Var PerlPath
-Var DownloadPerl
+;Var DoNotRequirePerl
+;Var PerlPath
+;Var DownloadPerl
 
 Var DoNotRequireGhostscript
 Var GhostscriptPath
@@ -103,6 +110,11 @@
 Var DoNotInstallLyX
 Var PathPrefix
 
+VAR Tmp
+Var Count
+Var LangName
+Var LangCode
+
 Var CreateFileAssociations
 Var CreateDesktopIcon
 Var StartmenuFolder
@@ -122,13 +134,12 @@
 ; Welcome page
 !insertmacro MUI_PAGE_WELCOME
 
-Page custom DownloadMinSYS DownloadMinSYS_LeaveFunction
-Page custom DownloadPython DownloadPython_LeaveFunction
+;Page custom DownloadMinSYS DownloadMinSYS_LeaveFunction
+;Page custom DownloadPython DownloadPython_LeaveFunction
 Page custom DownloadMiKTeX DownloadMiKTeX_LeaveFunction
-Page custom DownloadPerl DownloadPerl_LeaveFunction
+;Page custom DownloadPerl DownloadPerl_LeaveFunction
 Page custom DownloadGhostscript DownloadGhostscript_LeaveFunction
 Page custom DownloadImageMagick DownloadImageMagick_LeaveFunction
-Page custom SummariseDownloads SummariseDownloads_LeaveFunction
 
 ; Show the license.
 !insertmacro MUI_PAGE_LICENSE "${PRODUCT_LICENSE_FILE}"
@@ -136,6 +147,12 @@
 ; Specify the installation directory.
 !insertmacro MUI_PAGE_DIRECTORY
 
+; Specify LyX's menu language.
+Page custom SelectLanguage SelectLanguage_LeaveFunction
+
+; Show a summary.
+Page custom SummariseDownloads SummariseDownloads_LeaveFunction
+
 ; Define which components to install.
 !insertmacro MUI_PAGE_COMPONENTS
 
@@ -149,8 +166,12 @@
 !insertmacro MUI_PAGE_INSTFILES
 
 !define MUI_FINISHPAGE_TEXT "$(FinishPageMessage)"
-!define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
-!define MUI_FINISHPAGE_RUN "${PRODUCT_EXE}"
+;To see LyX in the chosen language LyX must be started
+;after the installer has finished.
+;Also the finish-page appears before LyX configuration is ready.
+;Therefore I disabled this option.
+;!define MUI_FINISHPAGE_RUN_TEXT "$(FinishPageRun)"
+;!define MUI_FINISHPAGE_RUN "${PRODUCT_EXE}"
 !insertmacro MUI_PAGE_FINISH
 
 ; The uninstaller.
@@ -185,6 +206,8 @@
 ReserveFile "ioDownload.ini"
 ReserveFile "ioSummary.ini"
 !insertmacro MUI_RESERVEFILE_LANGDLL
+ReserveFile "LanguageSet.ini"
+!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
 
 ;--------------------------------
 
@@ -195,8 +218,11 @@
 Section /o "$(SecAllUsersTitle)" SecAllUsers
   SetShellVarContext all
   StrCpy $ProductRootKey "HKLM"
+  !define ALL_USERS
 SectionEnd
 
+  !include "WriteEnvStr.nsh"
+
 Section "$(SecFileAssocTitle)" SecFileAssoc
   StrCpy $CreateFileAssociations "true"
 SectionEnd
@@ -213,6 +239,7 @@
   SetOutPath "$INSTDIR"
   File /r "${PRODUCT_SOURCEDIR}\Resources"
   File /r "${PRODUCT_SOURCEDIR}\bin"
+  File /r "${PRODUCT_SOURCEDIR}\etc"
 
   ${if} "$PathPrefix" != ""
     lyx_path_prefix::set_path_prefix "$INSTDIR\Resources\lyx\configure" "$PathPrefix"
@@ -253,6 +280,11 @@
 
     ${CreateFileAssociation} "${PRODUCT_EXT}" "${PRODUCT_NAME}" "${PRODUCT_MIME_TYPE}"
   ${endif}
+  
+  ;set the LANG environment variable
+  Push "LANG"
+  Push $LangCode
+  Call WriteEnvStr
 
   WriteUninstaller "${PRODUCT_UNINSTALL_EXE}"
 SectionEnd
@@ -275,6 +307,7 @@
 
   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioDownload.ini"
   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioSummary.ini"
+  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "LanguageSet.ini"
 
   ; Default settings
   ; These can be reset to "all" in section SecAllUsers.
@@ -308,7 +341,7 @@
 
 ;--------------------------------
 
-Function DownloadMinSYS
+/* Function DownloadMinSYS
   StrCpy $MinSYSPath ""
   StrCpy $DownloadMinSYS "0"
 
@@ -354,10 +387,10 @@
       "\sh.exe" \
       "$(InvalidMinSYSFolder)"
 FunctionEnd
-
+*/
 ;--------------------------------
 
-Function DownloadPython
+/* Function DownloadPython
   StrCpy $PythonPath ""
   StrCpy $DownloadPython "0"
 
@@ -381,7 +414,7 @@
       "\Python.exe" \
       "$(InvalidPythonFolder)"
 FunctionEnd
-
+*/
 ;--------------------------------
 
 Function DownloadMiKTeX
@@ -412,7 +445,7 @@
 
 ;--------------------------------
 
-Function DownloadPerl
+/* Function DownloadPerl
   StrCpy $DoNotRequirePerl "1"
   StrCpy $PerlPath ""
   StrCpy $DownloadPerl "1"
@@ -437,7 +470,7 @@
       "\perl.exe" \
       "$(InvalidPerlFolder)"
 FunctionEnd
-
+*/
 ;--------------------------------
 
 Function DownloadGhostscript
@@ -504,21 +537,157 @@
 
 ;--------------------------------
 
+Function SelectLanguage
+
+  StrCpy $LangName ""
+
+  ${if} $Language = 1030
+    StrCpy $LangName "Dansk"
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSet.ini" "Field 2" "State" 1
+  ${endif}
+
+  ${if} $Language = 1031
+    StrCpy $LangName "Deutsch"
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSet.ini" "Field 3" "State" 1
+  ${endif}
+
+  ${if} $Language = 1033
+    StrCpy $LangName "English"
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSet.ini" "Field 4" "State" 1
+  ${endif}
+
+  ${if} $Language = 1034
+    StrCpy $LangName "Espagñol"
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSet.ini" "Field 5" "State" 1
+  ${endif}
+
+  ${if} $Language = 1036
+    StrCpy $LangName "Français"
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSet.ini" "Field 7" "State" 1
+  ${endif}
+
+  ${if} $Language = 1043
+    StrCpy $LangName "Nederlands"
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSet.ini" "Field 9" "State" 1
+  ${endif}
+
+  !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSet.ini" "Field 19" "State" $LangName
+
+  !insertmacro MUI_HEADER_TEXT "Selection of LyX's menu language" ""
+  !insertmacro MUI_INSTALLOPTIONS_DISPLAY "LanguageSet.ini"
+
+FunctionEnd
+
+Function SelectLanguage_LeaveFunction
+  
+  StrCpy $Tmp "0"
+  StrCpy $Count "2"
+
+  loop:
+   !insertmacro MUI_INSTALLOPTIONS_READ $Tmp "LanguageSet.ini" "Field $Count" "State"
+   ${if} $Tmp = 1
+    Goto continue
+   ${endif}
+   IntOp $Count $Count + 1
+  Goto loop
+
+  continue:
+ 
+  ;!insertmacro MUI_INSTALLOPTIONS_READ $Tmp "LanguageSet.ini" "Field 19" "State"
+
+  StrCpy $LangCode ""
+
+  ${if} $Count = 2
+    StrCpy $LangCode "da_DK"
+  ${endif}
+
+  ${if} $Count = 3
+    StrCpy $LangCode "de_DE"
+  ${endif}
+
+  ${if} $Count = 4
+    StrCpy $LangCode "en_EN"
+  ${endif}
+
+  ${if} $Count = 5
+    StrCpy $LangCode "es_ES"
+  ${endif}
+
+  ${if} $Count = 6
+    StrCpy $LangCode "eu_EU"
+  ${endif}
+
+  ${if} $Count = 7
+    StrCpy $LangCode "fr_FR"
+  ${endif}
+
+  ${if} $Count = 8
+    StrCpy $LangCode "it_IT"
+  ${endif}
+
+  ${if} $Count = 9
+    StrCpy $LangCode "nl_NL"
+  ${endif}
+
+  ${if} $Count = 10
+    StrCpy $LangCode "no_NO"
+  ${endif}
+
+  ${if} $Count = 11
+    StrCpy $LangCode "no_NY"
+  ${endif}
+
+  ${if} $Count = 12
+    StrCpy $LangCode "pl_PL"
+  ${endif}
+
+  ${if} $Count = 13
+    StrCpy $LangCode "ro_RO"
+  ${endif}
+
+  ${if} $Count = 14
+    StrCpy $LangCode "ru_RU"
+  ${endif}
+
+  ${if} $Count = 15
+    StrCpy $LangCode "sk_SK"
+  ${endif}
+
+  ${if} $Count = 16
+    StrCpy $LangCode "sl_SI"
+  ${endif}
+
+  ${if} $Count = 17
+    StrCpy $LangCode "fi_FI"
+  ${endif}
+
+  ${if} $Count = 18
+    StrCpy $LangCode "tr_TR"
+  ${endif}
+  
+FunctionEnd
+
+;--------------------------------
+
 Function SummariseDownloads
 
-  StrCpy $PathPrefix ""
-  ${if} $MinSYSPath != ""
+  StrCpy $PathPrefix "$INSTDIR\bin"
+
+/*  ${if} $MinSYSPath != ""
     StrCpy $PathPrefix "$PathPrefix;$MinSYSPath"
   ${endif}
   ${if} $PythonPath != ""
     StrCpy $PathPrefix "$PathPrefix;$PythonPath"
   ${endif}
+*/
   ${if} $MiKTeXPath != ""
     StrCpy $PathPrefix "$PathPrefix;$MiKTeXPath"
   ${endif}
-  ${if} $PerlPath != ""
+
+/*  ${if} $PerlPath != ""
     StrCpy $PathPrefix "$PathPrefix;$PerlPath"
   ${endif}
+*/
   ${if} $GhostscriptPath != ""
     StrCpy $PathPrefix "$PathPrefix;$GhostscriptPath"
   ${endif}
@@ -526,20 +695,26 @@
     StrCpy $PathPrefix "$PathPrefix;$ImageMagickPath"
   ${endif}
   ; Remove the leading ';'
-  StrCpy $PathPrefix "$PathPrefix" "" 1
+  ;StrCpy $PathPrefix "$PathPrefix" "" 1
 
-  IntOp $DoNotInstallLyX $DownloadMinSYS + $DownloadPython
+;  IntOp $DoNotInstallLyX $DownloadMinSYS + $DownloadPython
   IntOp $DoNotInstallLyX $DoNotInstallLyX + $DownloadMiKTeX
-  IntOp $DoNotInstallLyX $DoNotInstallLyX + $DownloadPerl
+;  IntOp $DoNotInstallLyX $DoNotInstallLyX + $DownloadPerl
   IntOp $DoNotInstallLyX $DoNotInstallLyX + $DownloadGhostscript
   IntOp $DoNotInstallLyX $DoNotInstallLyX + $DownloadImageMagick
 
   ${if} "$DoNotInstallLyX" == 1
     !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSummary.ini" "Field 1" "Text" "$(SummaryPleaseInstall)"
     !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSummary.ini" "Field 2" "Text" ""
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSummary.ini" "Field 3" "Text" ""
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSummary.ini" "Field 4" "Text" ""
   ${else}
     !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSummary.ini" "Field 1" "Text" "$(SummaryPathPrefix)"
-    !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSummary.ini" "Field 2" "Text" "$PathPrefix"
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSummary.ini" "Field 2" "Text" \
+     "$INSTDIR\bin \r\n$MiKTeXPath \r\n$GhostscriptPath \r\n$ImageMagickPath"
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSummary.ini" "Field 3" "Text" \
+     "LyX's menus will be in $LangName. \r\nTherefore the following environment variable is set:"
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSummary.ini" "Field 4" "Text" "LANG=$LangCode"
   ${endif}
 
   !insertmacro MUI_HEADER_TEXT "$(SummaryTitle)" ""
@@ -593,6 +768,11 @@
 
 
 Section Uninstall
+
+ ;remove the LANG environment variable
+  Push "LANG"
+  Call un.DeleteEnvStr
+
   RMDir /r $INSTDIR
 
   ReadRegStr $0 ${PRODUCT_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "StartMenu"

Reply via email to