Angus Leeming wrote:

I see that Christian has made this available on the uploads pages. I'd rather that this was removed. Why? Not because I'm nasty (I hope) but because I'm worried that we're going to end up splitting our efforts. Not to say getting confused by user reports on two different, concurrent versions.

You are right. I'll remove the link on the wiki page. But I need some space to store it.

I'd much rather we work to combine the two installers in some way. Let's work as a team rather than in competition.

Didn't we do so? I wouldn't compete against you.
That's why I don't delete the stuff I don't need for my installer version but uncomment them. This makes it easy to merge our efforts. The next time I wont announce my version on the wiki page until the merge.

Attached the actual diff-file against your version.

Here's my new version:

http://fkurth.de/uwest/LyX/Installer/lyx_setup_136small-version12-2.exe
and
http://fkurth.de/uwest/LyX/Installer/LyXPackage.rar

It still uses radiobuttons for the languages.

> Nice! I'll try the dropdown version, for consistency with the initial
> language selection.

Could you do this and send me the diff file?

> I'd have a look in lyx_path_prefix.C. Remember that you have to move
> your generated .dll to the NSIS Plugins folder before running
> makensis...

It is there.

> Hmmmm. If you do this then you should package the latex-xft fonts
> rather
> than the bakoma ones. Maybe give the user the chance to download the
> bakoma fonts, but explain that the licence is restrictive.

I implement this now as follows:
The package comes with both versions.
If the math fonts are already installed, the user isn't bothered with the font install. If the fonts aren't installed, the user can choose between the fonts. To make it clear that the BaKoMa fonts aren't free for commercial use, I added a Link to the license file in the installer.

>> I'm able to copy the files to the font directory but couldn't find
>> the command to install them.
>
> Perhaps ask on the NSIS forum at
> http://forums.winamp.com/forumdisplay.php?s=&forumid=65

I'll do so. At the moment I just copy the files to the $Fonts directory. That should be enough as Win updates the registry automatically. I can also write the rekeys manually but Win2000 and WinXP stores the key in different reg folders. The problem is that it last some time till the regisry change is done. For example delete/deinstall thefonts and copy/install them immediately don't work. So could you please test the new font installer (deinstall the current fonts first).

> Thought: rather than have two separate installers doing essentially
> the same thing, I think we should have a single installer that
> combines them: ...
>
> I'd rather see the three python, minsys and perl pages retained but
> give the user the opportunity to download your stripped down versions
> as an alternative to downloading the full, official packages.

Both installers should base on the same NSIS code _and_ the same package repository (including the necessary perl etc. files).
What about two radio buttons:
If the user chooses to install all packages the three pages for python etc. appear. The then unnecessary files in the install repository will be deleted to avoid conflicts between the installed and stripped versions. If the user chooses the small version the pages don't appear and the files from the package repository are used.
This could be implement easily.

----

ToDo:
- Check if acrobat/acroread is installed
  (can be done easily)
- If it is, set it as default for pdf in LyX's preferences
  (I don't know how to do this)

regards Uwe
--- lyx_installer.nsi	Thu Jun 09 13:48:43 2005
+++ LyXWinUtils.nsi	Sun Jun 12 17:45:19 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
 
@@ -26,15 +26,15 @@
 
 !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,29 @@
 ; 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 after section
+;Section /o "$(SecAllUsersTitle)" SecAllUsers
+
 ;--------------------------------
 ; 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 +111,14 @@
 Var DoNotInstallLyX
 Var PathPrefix
 
+Var Handle
+Var FileExists
+Var Tmp
+Var FontChoice
+Var Count
+Var LangName
+Var LangCode
+
 Var CreateFileAssociations
 Var CreateDesktopIcon
 Var StartmenuFolder
@@ -122,13 +138,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 +151,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 +170,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's 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 +210,10 @@
 ReserveFile "ioDownload.ini"
 ReserveFile "ioSummary.ini"
 !insertmacro MUI_RESERVEFILE_LANGDLL
+ReserveFile "LanguageSet.ini"
+!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
+ReserveFile "LanguageSetNoFont.ini"
+!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
 
 ;--------------------------------
 
@@ -195,8 +224,12 @@
 Section /o "$(SecAllUsersTitle)" SecAllUsers
   SetShellVarContext all
   StrCpy $ProductRootKey "HKLM"
+; Script option for WriteEnvStr.nsh
+  !define ALL_USERS
 SectionEnd
 
+  !include "WriteEnvStr.nsh"
+
 Section "$(SecFileAssocTitle)" SecFileAssoc
   StrCpy $CreateFileAssociations "true"
 SectionEnd
@@ -213,6 +246,9 @@
   SetOutPath "$INSTDIR"
   File /r "${PRODUCT_SOURCEDIR}\Resources"
   File /r "${PRODUCT_SOURCEDIR}\bin"
+  File /r "${PRODUCT_SOURCEDIR}\etc"
+  File /r "${PRODUCT_SOURCEDIR}\BaKoMaFonts"
+  File /r "${PRODUCT_SOURCEDIR}\LaTeX-XFTFonts"
 
   ${if} "$PathPrefix" != ""
     lyx_path_prefix::set_path_prefix "$INSTDIR\Resources\lyx\configure" "$PathPrefix"
@@ -254,6 +290,22 @@
     ${CreateFileAssociation} "${PRODUCT_EXT}" "${PRODUCT_NAME}" "${PRODUCT_MIME_TYPE}"
   ${endif}
 
+  ;install the fonts
+  ${if} $ProductRootKey == "HKLM"
+  ${andif} $FileExists == "False"
+   ${if} $FontChoice == "BaKoMa"
+    CopyFiles $INSTDIR\BaKoMaFonts\*.ttf $FONTS
+   ${endif}
+   ${if} $FontChoice == "XFT"
+    CopyFiles $INSTDIR\LaTeX-XFTFonts\*.ttf $FONTS
+   ${endif}
+  ${endif}
+ 
+  ;set the LANG environment variable
+  Push "LANG"
+  Push $LangCode
+  Call WriteEnvStr
+
   WriteUninstaller "${PRODUCT_UNINSTALL_EXE}"
 SectionEnd
 
@@ -275,6 +327,8 @@
 
   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioDownload.ini"
   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioSummary.ini"
+  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "LanguageSet.ini"
+  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "LanguageSetNoFont.ini"
 
   ; Default settings
   ; These can be reset to "all" in section SecAllUsers.
@@ -308,7 +362,7 @@
 
 ;--------------------------------
 
-Function DownloadMinSYS
+/* Function DownloadMinSYS
   StrCpy $MinSYSPath ""
   StrCpy $DownloadMinSYS "0"
 
@@ -354,10 +408,10 @@
       "\sh.exe" \
       "$(InvalidMinSYSFolder)"
 FunctionEnd
-
+*/
 ;--------------------------------
 
-Function DownloadPython
+/* Function DownloadPython
   StrCpy $PythonPath ""
   StrCpy $DownloadPython "0"
 
@@ -381,7 +435,7 @@
       "\Python.exe" \
       "$(InvalidPythonFolder)"
 FunctionEnd
-
+*/
 ;--------------------------------
 
 Function DownloadMiKTeX
@@ -412,7 +466,7 @@
 
 ;--------------------------------
 
-Function DownloadPerl
+/* Function DownloadPerl
   StrCpy $DoNotRequirePerl "1"
   StrCpy $PerlPath ""
   StrCpy $DownloadPerl "1"
@@ -437,7 +491,7 @@
       "\perl.exe" \
       "$(InvalidPerlFolder)"
 FunctionEnd
-
+*/
 ;--------------------------------
 
 Function DownloadGhostscript
@@ -504,21 +558,199 @@
 
 ;--------------------------------
 
+Function SelectLanguage
+
+  StrCpy $LangName ""
+
+  ${if} $Language = 1030
+    StrCpy $LangName "Dansk"
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSet.ini" "Field 2" "State" 1
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSetNoFont.ini" "Field 2" "State" 1
+  ${endif}
+
+  ${if} $Language = 1031
+    StrCpy $LangName "Deutsch"
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSet.ini" "Field 3" "State" 1
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSetNoFont.ini" "Field 3" "State" 1
+  ${endif}
+
+  ${if} $Language = 1033
+    StrCpy $LangName "English"
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSet.ini" "Field 4" "State" 1
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSetNoFont.ini" "Field 4" "State" 1
+  ${endif}
+
+  ${if} $Language = 1034
+    StrCpy $LangName "Espagñol"
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSet.ini" "Field 5" "State" 1
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSetNoFont.ini" "Field 5" "State" 1
+  ${endif}
+
+  ${if} $Language = 1036
+    StrCpy $LangName "Français"
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSet.ini" "Field 7" "State" 1
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSetNoFont.ini" "Field 7" "State" 1
+  ${endif}
+
+  ${if} $Language = 1043
+    StrCpy $LangName "Nederlands"
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSet.ini" "Field 9" "State" 1
+    !insertmacro MUI_INSTALLOPTIONS_WRITE "LanguageSetNoFont.ini" "Field 9" "State" 1
+  ${endif}
+
+  ;check if the fonts are already installed
+  StrCpy $Handle ""
+  StrCPY $FileExists ""
+
+  FileOpen $Handle $FONTS\cmex10.ttf r
+  ${if} $Handle = ""
+   StrCPY $FileExists "False"
+  ${Else}
+   StrCPY $FileExists "True"
+  ${endif}
+  FileClose $Handle
+
+  ${if} $FileExists == "False"
+   !insertmacro MUI_HEADER_TEXT "Selection of LyX's" "menu language and math fonts"
+   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "LanguageSet.ini"
+  ${Else}
+   !insertmacro MUI_HEADER_TEXT "Selection of LyX's" "menu language"
+   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "LanguageSetNoFont.ini"
+  ${endif}
+
+FunctionEnd
+
+Function SelectLanguage_LeaveFunction
+
+  StrCpy $FontChoice ""
+
+  ${if} $FileExists == "False"
+   StrCpy $Tmp "0"
+   !insertmacro MUI_INSTALLOPTIONS_Read $Tmp "LanguageSet.ini" "Field 20" "State"
+   ${if} $Tmp = "1"
+    StrCpy $FontChoice "BaKoMa"
+   ${Else}
+    StrCpy $FontChoice "XFT"
+   ${endif}
+  ${endif}
+  
+  
+  StrCpy $Tmp "0"
+  StrCpy $Count "2"
+
+  ${if} $FileExists == "False"
+   loop:
+    !insertmacro MUI_INSTALLOPTIONS_READ $Tmp "LanguageSet.ini" "Field $Count" "State"
+    ${if} $Tmp = 1
+     Goto continue
+    ${endif}
+    IntOp $Count $Count + 1
+   Goto loop
+  ${else}
+   loopa:
+    !insertmacro MUI_INSTALLOPTIONS_READ $Tmp "LanguageSetNoFont.ini" "Field $Count" "State"
+    ${if} $Tmp = 1
+     Goto continue
+    ${endif}
+    IntOp $Count $Count + 1
+   Goto loopa
+  ${endif}
+
+  continue:
+ 
+  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 +758,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 +831,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"
@@ -605,6 +848,16 @@
   DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
 
   ${RemoveFileAssociation} "${PRODUCT_EXT}" "${PRODUCT_NAME}"
+
+  ;Delete the installed math fonts
+
+  Delete $FONTS\cmr10.ttf
+  Delete $FONTS\cmsy10.ttf
+  Delete $FONTS\cmmi10.ttf
+  Delete $FONTS\cmex10.ttf
+  Delete $FONTS\msam10.ttf
+  Delete $FONTS\msbm10.ttf
+  Delete $FONTS\wasy10.ttf
 
   SetAutoClose true
 SectionEnd

Reply via email to