]> git.lyx.org Git - features.git/blob - development/Win32/packaging/installer/include/init.nsh
Windows installer: add 3 new features/bugfixes
[features.git] / development / Win32 / packaging / installer / include / init.nsh
1 /*
2 init.nsh
3
4 Initialization functions
5 */
6
7 #--------------------------------
8 # User initialization
9
10 Var ComponentPath
11 Var LyXLangName
12
13 # COMPONENT can be LaTeX, ImageMagick and Ghostscript
14 !macro EXTERNAL_INIT COMPONENT
15
16   # APP_REGKEY_SETUP = "Software\${APP_NAME}${APP_SERIES_KEY}\Setup"
17   # where ${APP_NAME}${APP_SERIES_KEY} is something like LyX16
18   ReadRegStr $ComponentPath SHELL_CONTEXT "${APP_REGKEY_SETUP}" "${COMPONENT} Path"
19   
20   # BIN_LATEX etc are defined in settings.nsh
21   ${If} ${FileExists} "$ComponentPath\${BIN_${COMPONENT}}"
22     # set variables like PathLaTeX
23     StrCpy $Path${COMPONENT} $ComponentPath
24   ${EndIf}
25
26 !macroend
27
28 Function InitUser
29
30   # Get directories of components from registry
31   
32   !insertmacro EXTERNAL_INIT LaTeX
33   
34   # Get LyX language
35   
36   ReadRegStr $LyXLangName SHELL_CONTEXT "${APP_REGKEY_SETUP}" "LyX Language"
37   
38   ${If} $LyXLangName != ""
39     StrCpy $LangName $LyXLangName
40   ${EndIf}
41   
42 FunctionEnd
43
44 #--------------------------------
45 # visible installer sections
46
47 Section "!${APP_NAME}" SecCore
48  SectionIn RO
49 SectionEnd
50
51 Section "$(SecFileAssocTitle)" SecFileAssoc
52  StrCpy $CreateFileAssociations "true" 
53 SectionEnd
54
55 Section "$(SecDesktopTitle)" SecDesktop
56  StrCpy $CreateDesktopIcon "true"
57 SectionEnd
58
59 !if ${SETUPTYPE} == BUNDLE
60  Section /o "$(SecInstJabRefTitle)" SecInstJabRef
61   AddSize ${SIZE_JABREF}
62   StrCpy $InstallJabRef "true"
63  SectionEnd
64 !endif
65
66 # Expand the list of dictionaries by default as this was requested by several
67 # users. For the thesaurus this is was not requested because this section
68 # is by default empty.
69 SectionGroup /e "Dictionaries" SecDictionaries
70
71 Section /o "Afrikaans" SecDAfrikaans
72  StrCpy $DictCodes "af_ZA,$DictCodes"
73  AddSize 1440
74 SectionEnd
75
76 Section /o "Arabic" SecDArabic
77  StrCpy $DictCodes "ar_DZ,$DictCodes"
78  AddSize 2500
79 SectionEnd
80
81 Section /o "Armenian" SecDArmenian
82  StrCpy $DictCodes "hy_AM,$DictCodes"
83  AddSize 2000
84 SectionEnd
85
86 Section /o "Bahasa Indonesia" SecDIndonesian
87  StrCpy $DictCodes "id_ID,$DictCodes"
88  AddSize 217
89 SectionEnd
90
91 Section /o "Bahasa Melayu" SecDMalayan
92  StrCpy $DictCodes "ms_MY,$DictCodes"
93  AddSize 227
94 SectionEnd
95
96 Section /o "Belarusian" SecDBelarusian 
97  StrCpy $DictCodes "be_BY,$DictCodes"
98  AddSize 1730
99 SectionEnd
100
101 Section /o "Brezhoneg" SecDBreton 
102  StrCpy $DictCodes "br_FR,$DictCodes"
103  AddSize 5510
104 SectionEnd
105
106 Section /o "Bulgarian" SecDBulgarian
107  StrCpy $DictCodes "bg_BG,$DictCodes"
108  AddSize 985
109 SectionEnd
110
111 Section /o "Català" SecDCatalanian
112  StrCpy $DictCodes "ca_ES,$DictCodes"
113  AddSize 1210
114 SectionEnd
115
116 Section /o "Ce\9atina" SecDCzech
117  StrCpy $DictCodes "cs_CZ,$DictCodes"
118  AddSize 2190
119 SectionEnd
120
121 Section /o "Coptic" SecDCoptic
122  StrCpy $DictCodes "cop_EG,$DictCodes"
123  AddSize 151
124 SectionEnd
125
126 Section /o "Cymraeg" SecDWelsh 
127  StrCpy $DictCodes "cy_GB,$DictCodes"
128  AddSize 1540
129 SectionEnd
130
131 Section /o "Dansk" SecDDanish
132  StrCpy $DictCodes "da_DK,$DictCodes"
133  AddSize 2470
134 SectionEnd
135
136 Section /o "German (A)" SecDGermanAT
137  StrCpy $DictCodes "de_AT,$DictCodes"
138  AddSize 3620
139 SectionEnd
140
141 Section /o "German (CH)" SecDGermanCH
142  StrCpy $DictCodes "de_CH,$DictCodes"
143  AddSize 3620
144 SectionEnd
145
146 Section "German (D)" SecDGermanD
147  # already installed by default
148  SectionIn RO
149  #StrCpy $DictCodes "de_DE,$DictCodes"
150  AddSize 3620
151 SectionEnd
152
153 Section /o "Greek" SecDGreek
154  StrCpy $DictCodes "el_GR,$DictCodes"
155  AddSize 6550
156 SectionEnd
157
158 Section /o "Eesti" SecDEstonian
159  StrCpy $DictCodes "et_EE,$DictCodes"
160  AddSize 4400
161 SectionEnd
162
163 Section /o "English (AU)" SecDEnglishAU
164  StrCpy $DictCodes "en_AU,$DictCodes"
165  AddSize 587
166 SectionEnd
167
168 Section /o "English (CA)" SecDEnglishCA
169  StrCpy $DictCodes "en_CA,$DictCodes"
170  AddSize 690
171 SectionEnd
172
173 Section "English (GB)" SecDEnglishGB
174  # already installed by default
175  SectionIn RO
176  #StrCpy $DictCodes "en_GB,$DictCodes"
177  AddSize 757
178 SectionEnd
179
180 Section /o "English (NZ)" SecDEnglishNZ
181  StrCpy $DictCodes "en_NZ,$DictCodes"
182  AddSize 551
183 SectionEnd
184
185 Section "English (US)" SecDEnglishUS
186  # already installed by default
187  SectionIn RO
188  #StrCpy $DictCodes "en_US,$DictCodes"
189  AddSize 688
190 SectionEnd
191
192 Section "Español (ES)" SecDSpanishES
193  # already installed by default
194  SectionIn RO
195  #StrCpy $DictCodes "es_ES,$DictCodes"
196  AddSize 974
197 SectionEnd
198
199 Section "Español (MX)" SecDSpanishMX
200  # already installed by default
201  SectionIn RO
202  #StrCpy $DictCodes "es_MX,$DictCodes"
203  AddSize 924
204 SectionEnd
205
206 Section /o "Esperanto" SecDEsperanto
207  StrCpy $DictCodes "eo_EO,$DictCodes"
208  AddSize 389
209 SectionEnd
210
211 Section /o "Euskara" SecDBasque
212  StrCpy $DictCodes "eu_ES,$DictCodes"
213  AddSize 4850
214 SectionEnd
215
216 Section /o "Farsi" SecDFarsi
217  StrCpy $DictCodes "fa_IR,$DictCodes"
218  AddSize 6710
219 SectionEnd
220
221 Section "Français" SecDFrench
222  # already installed by default
223  SectionIn RO
224  #StrCpy $DictCodes "fr_FR,$DictCodes"
225  AddSize 1200
226 SectionEnd
227
228 Section /o "Français (Canada)" SecDFrenchCanada
229  StrCpy $DictCodes "fr_CA,$DictCodes"
230  AddSize 1390
231 SectionEnd
232
233 Section /o "Gaeilge" SecDGaelic
234  StrCpy $DictCodes "ga_IR,$DictCodes"
235  AddSize 1090
236 SectionEnd
237
238 Section /o "Gàidhlig" SecDScottish
239  StrCpy $DictCodes "gd_GB,$DictCodes"
240  AddSize 2504
241 SectionEnd
242
243 Section /o "Galego" SecDGalician
244  StrCpy $DictCodes "gl_ES,$DictCodes"
245  AddSize 3911
246 SectionEnd
247
248 Section /o "Hebrew" SecDHebrew
249  StrCpy $DictCodes "he_IL,$DictCodes"
250  AddSize 3120
251 SectionEnd
252
253 Section /o "Hrvatski" SecDCroatian
254  StrCpy $DictCodes "hr_HR,$DictCodes"
255  AddSize 2240
256 SectionEnd
257
258 Section /o "Magyar" SecDHungarian
259  StrCpy $DictCodes "hu_HU,$DictCodes"
260  AddSize 3380
261 SectionEnd
262
263 Section /o "Hindi" SecDHindi
264  StrCpy $DictCodes "hi_IN,$DictCodes"
265  AddSize 1900
266 SectionEnd
267
268 Section /o "Interlingua" SecDInterlingua
269  StrCpy $DictCodes "ia_IA,$DictCodes"
270  AddSize 613
271 SectionEnd
272
273 Section /o "Íslenska" SecDIcelandic
274  StrCpy $DictCodes "is_IS,$DictCodes"
275  AddSize 2320
276 SectionEnd
277
278 Section /o "Italiano" SecDItalian
279  StrCpy $DictCodes "it_IT,$DictCodes"
280  AddSize 1380
281 SectionEnd
282
283 Section /o "Kazakh" SecDKazakh
284  StrCpy $DictCodes "kk_KZ,$DictCodes"
285  AddSize 2120
286 SectionEnd
287
288 Section /o "Korean" SecDKorean
289  StrCpy $DictCodes "ko_KR,$DictCodes"
290  AddSize 16540
291 SectionEnd
292
293 Section /o "Latina" SecDLatin
294  StrCpy $DictCodes "la_LA,$DictCodes"
295  AddSize 2040
296 SectionEnd
297
298 Section /o "Lietuviu" SecDLithuanian
299  StrCpy $DictCodes "lt_LT,$DictCodes"
300  AddSize 1320
301 SectionEnd
302
303 Section /o "Latvie\9au" SecDLatvian
304  StrCpy $DictCodes "lv_LV,$DictCodes"
305  AddSize 2243
306 SectionEnd
307
308 Section /o "Marathi" SecDMarathi
309  StrCpy $DictCodes "mr_IN,$DictCodes"
310  AddSize 5290
311 SectionEnd
312
313 Section /o "Nederlands" SecDDutch
314  StrCpy $DictCodes "nl_NL,$DictCodes"
315  AddSize 1820
316 SectionEnd
317
318 Section /o "Norsk (Bokmål)" SecDNorwegianNB
319  StrCpy $DictCodes "nb_NO,$DictCodes"
320  AddSize 3992
321 SectionEnd
322
323 Section /o "Norsk (Nynorsk)" SecDNorwegianNN
324  StrCpy $DictCodes "nn_NO,$DictCodes"
325  AddSize 1515
326 SectionEnd
327
328 Section /o "Occitan" SecDOccitan
329  StrCpy $DictCodes "oc_FR,$DictCodes"
330  AddSize 31710
331 SectionEnd
332
333 Section /o "Polski" SecDPolish
334  StrCpy $DictCodes "pl_PL,$DictCodes"
335  AddSize 4540
336 SectionEnd
337
338 Section /o "Português (BR)" SecDPortugueseBR
339  StrCpy $DictCodes "pt_BR,$DictCodes"
340  AddSize 5280
341 SectionEnd
342
343 Section /o "Português (PT)" SecDPortuguesePT
344  StrCpy $DictCodes "pt_PT,$DictCodes"
345  AddSize 1595
346 SectionEnd
347
348 Section /o "Româna" SecDRomanian
349  StrCpy $DictCodes "ro_RO,$DictCodes"
350  AddSize 2255
351 SectionEnd
352
353 Section /o "Russian" SecDRussian
354  StrCpy $DictCodes "ru_RU,$DictCodes"
355  AddSize 1920
356 SectionEnd
357
358 Section /o "Serb\9acina (Dolno)" SecDSorbianD
359  StrCpy $DictCodes "dsb_DE,$DictCodes"
360  AddSize 1035
361 SectionEnd
362
363 Section /o "Serb\9acina (Horno)" SecDSorbianH
364  StrCpy $DictCodes "hsb_DE,$DictCodes"
365  AddSize 740
366 SectionEnd
367
368 Section /o "Shqipe" SecDAlbanian
369  StrCpy $DictCodes "sq_AL,$DictCodes"
370  AddSize 2400
371 SectionEnd
372
373 Section /o "Sloven\9acina" SecDSlovenian
374  StrCpy $DictCodes "sl_SI,$DictCodes"
375  AddSize 2910
376 SectionEnd
377
378 Section /o "Slovenský" SecDSlovakian
379  StrCpy $DictCodes "sk_SK,$DictCodes"
380  AddSize 3310
381 SectionEnd
382
383 Section /o "Srpski (Cirilica)" SecDSerbianC
384  StrCpy $DictCodes "sr_RS,$DictCodes"
385  AddSize 4401
386 SectionEnd
387
388 Section /o "Srpski (Latinica)" SecDSerbianL
389  StrCpy $DictCodes "sr_RS-Latin,$DictCodes"
390  AddSize 2843
391 SectionEnd
392
393 Section /o "Svenska" SecDSwedish
394  StrCpy $DictCodes "sv_SE,$DictCodes"
395  AddSize 2028
396 SectionEnd
397
398 Section /o "Tamil" SecDTamil
399  StrCpy $DictCodes "ta_IN,$DictCodes"
400  AddSize 5911
401 SectionEnd
402
403 Section /o "Telugu" SecDTelugu
404  StrCpy $DictCodes "te_IN,$DictCodes"
405  AddSize 3400
406 SectionEnd
407  
408 Section /o "Thai" SecDThai
409  StrCpy $DictCodes "th_TH,$DictCodes"
410  AddSize 351
411 SectionEnd
412
413 Section /o "Türkmençe" SecDTurkmen
414  StrCpy $DictCodes "tk_TM,$DictCodes"
415  AddSize 950
416 SectionEnd
417
418 Section /o "Ukrainian" SecDUkrainian
419  StrCpy $DictCodes "uk_UA,$DictCodes"
420  AddSize 3077
421 SectionEnd
422
423 Section /o "Urdu" SecDUrdu
424  StrCpy $DictCodes "ur_PK,$DictCodes"
425  AddSize 1401
426 SectionEnd
427
428 Section /o "Vietnamese" SecDVietnamese
429  StrCpy $DictCodes "vi_VN,$DictCodes"
430  AddSize 40
431 SectionEnd
432
433 SectionGroupEnd
434
435
436 SectionGroup "Thesaurus" SecThesaurus
437
438 Section /o "Bulgarian" SecTBulgarian
439  StrCpy $ThesCodes "bg_BG,$ThesCodes"
440  AddSize 3020
441 SectionEnd
442
443 Section /o "Català" SecTCatalan
444  StrCpy $ThesCodes "ca_ES,$ThesCodes"
445  AddSize 731
446 SectionEnd
447
448 Section /o "Ce\9atina" SecTCzech
449  StrCpy $ThesCodes "cs_CZ,$ThesCodes"
450  AddSize 635
451 SectionEnd
452
453 Section /o "Dansk" SecTDanish
454  StrCpy $ThesCodes "da_DK,$ThesCodes"
455  AddSize 2360
456 SectionEnd
457
458 Section /o "Deutsch (D/A)" SecTGermanDA
459  StrCpy $ThesCodes "de_DE,$ThesCodes"
460  AddSize 14600
461 SectionEnd
462
463 Section /o "Deutsch (CH)" SecTGermanCH
464  StrCpy $ThesCodes "de_CH,$ThesCodes"
465  AddSize 14600
466 SectionEnd
467
468 Section /o "English (GB)" SecTEnglishGB
469  StrCpy $ThesCodes "en_GB,$ThesCodes"
470  AddSize 14300
471 SectionEnd
472
473 Section /o "English (US/AU)" SecTEnglishUSAU
474  StrCpy $ThesCodes "en_US,$ThesCodes"
475  AddSize 21600
476 SectionEnd
477
478 Section /o "Español" SecTSpanish
479  StrCpy $ThesCodes "es_ES,$ThesCodes"
480  AddSize 2860
481 SectionEnd
482
483 Section /o "Français" SecTFrench
484  StrCpy $ThesCodes "fr_FR,$ThesCodes"
485  AddSize 5060
486 SectionEnd
487
488 Section /o "Gaeilge" SecTGaelic
489  StrCpy $ThesCodes "ga_IR,$ThesCodes"
490  AddSize 30600
491 SectionEnd
492
493 Section /o "Galego" SecTGalician
494  StrCpy $ThesCodes "gl_ES,$ThesCodes"
495  AddSize 510
496 SectionEnd
497
498 Section /o "Greek" SecTGreek
499  StrCpy $ThesCodes "el_GR,$ThesCodes"
500  AddSize 903
501 SectionEnd
502
503 Section /o "Íslenska" SecTIcelandic
504  StrCpy $ThesCodes "is_IS,$ThesCodes"
505  AddSize 63
506 SectionEnd
507
508 Section /o "Italiano" SecTItalian
509  StrCpy $ThesCodes "it_IT,$ThesCodes"
510  AddSize 2520
511 SectionEnd
512
513 Section /o "Magyar" SecTHungarian
514  StrCpy $ThesCodes "hu_HU,$ThesCodes"
515  AddSize 632
516 SectionEnd
517
518 Section /o "Norsk (Bokmål)" SecTNorwegianNB
519  StrCpy $ThesCodes "nb_NO,$ThesCodes"
520  AddSize 2535
521 SectionEnd
522
523 Section /o "Polski" SecTPolish
524  StrCpy $ThesCodes "pl_PL,$ThesCodes"
525  AddSize 5580
526 SectionEnd
527
528 Section /o "Português" SecTPortuguese
529  StrCpy $ThesCodes "pt_PT,$ThesCodes"
530  AddSize 860
531 SectionEnd
532
533 Section /o "Româna" SecTRomanian
534  StrCpy $ThesCodes "ro_RO,$ThesCodes"
535  AddSize 3650
536 SectionEnd
537
538 Section /o "Russian" SecTRussian
539  StrCpy $ThesCodes "ru_RU,$ThesCodes"
540  AddSize 2080
541 SectionEnd
542
543 Section /o "Sloven\9acina" SecTSlovenian
544  StrCpy $ThesCodes "sl_SI,$ThesCodes"
545  AddSize 1121
546 SectionEnd
547
548 Section /o "Slovenský" SecTSlovakian
549  StrCpy $ThesCodes "sk_SK,$ThesCodes"
550  AddSize 930
551 SectionEnd
552
553 Section /o "Svenska" SecTSwedish
554  StrCpy $ThesCodes "sv_SE,$ThesCodes"
555  AddSize 720
556 SectionEnd
557
558 Section /o "Ukrainian" SecTUkrainian
559  StrCpy $ThesCodes "uk_UA,$ThesCodes"
560  AddSize 1309
561 SectionEnd
562
563 SectionGroupEnd
564
565 # Section descriptions
566 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
567 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
568 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
569 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
570 !if ${SETUPTYPE} == BUNDLE
571  !insertmacro MUI_DESCRIPTION_TEXT ${SecInstJabRef} "$(SecInstJabRefDescription)"
572 !endif
573 !insertmacro MUI_DESCRIPTION_TEXT ${SecDictionaries} "$(SecDictionariesDescription)"
574 !insertmacro MUI_DESCRIPTION_TEXT ${SecThesaurus} "$(SecThesaurusDescription)"
575 !insertmacro MUI_FUNCTION_DESCRIPTION_END
576
577
578 #--------------------------------
579 # Installer initialization
580
581 !macro PRINTER_INIT
582
583   ${If} ${AtLeastWinVista}
584     StrCpy $PrinterConf "printui.exe"
585   ${Else}
586     StrCpy $PrinterConf "rundll32.exe printui.dll,PrintUIEntry"
587   ${EndIf}
588
589 !macroend
590
591 # .onInit must be here after the section definition because we have to set
592 # the selection states of the dictionary sections
593 Function .onInit
594
595   ${IfNot} ${IsNT}
596   ${OrIfNot} ${AtLeastWinXP}
597     MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows XP or later." /SD IDOK
598     Quit
599   ${EndIf}
600   
601   # check that the installer is not currently running
602   System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${BundleExeFile}.Instance") i .r1 ?e'
603   Pop $R0
604   ${if} $R0 != "0"
605    MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)" /SD IDOK
606    Abort
607   ${endif}
608   System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${ExeFile}.Instance") i .r1 ?e'
609   Pop $R0
610   ${if} $R0 != "0"
611    MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)" /SD IDOK
612    Abort
613   ${endif}
614   
615   # FIXME: check that LyX is not currently running
616   #System::Call 'kernel32::CreateMutexA(i 0, i 0, t "LyX.exe.Instance") i .r1 ?e'
617   #Pop $R0
618   #MessageBox MB_OK "$R0"
619   #${if} $R0 != "0"
620   # MessageBox MB_OK|MB_ICONSTOP "$(LyXRunning)" 
621   # Abort
622   #${endif}
623   
624   !insertmacro MULTIUSER_INIT
625   
626   # check if this LyX version is already installed
627   ${if} $MultiUser.Privileges == "Admin"
628   ${orif} $MultiUser.Privileges == "Power"
629    ReadRegStr $0 HKLM "${APP_UNINST_KEY}" "Publisher"
630   ${else}
631    ReadRegStr $0 HKCU "${APP_UNINST_KEY}" "Publisher"
632    # handle also the case that LyX is already installed in HKLM
633    ${if} $0 == ""
634     ReadRegStr $0 HKLM "${APP_UNINST_KEY}" "Publisher"
635    ${endif}
636   ${endif}
637   ${if} $0 != ""
638    # installing over an existing installation of the same LyX release is not necessary
639    # if the users does this he most probably has a problem with LyX that can better be solved
640    # by reinstalling LyX
641    # for beta and other test releases over-installing can even cause errors
642    MessageBox MB_YESNO|MB_DEFBUTTON2|MB_ICONEXCLAMATION "$(AlreadyInstalled)" /SD IDNO IDYES ForceInstallation 
643    Abort
644    ForceInstallation:
645   ${endif}
646   
647   # check if there is an existing LyX installation of the same LyX series
648   # we usually don't release more than 10 versions so with 20 we are safe to check if a newer version is installed
649   IntOp $4 ${APP_VERSION_REVISION} + 20
650   ${for} $5 0 $4
651    ${if} $MultiUser.Privileges == "Admin"
652    ${orif} $MultiUser.Privileges == "Power"
653     ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5" "DisplayVersion"
654     # also check for an emergency release
655     ${if} $0 == ""
656      ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$51" "DisplayVersion"
657     ${endif}
658    ${else}
659     ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5" "DisplayVersion"
660     # also check for an emergency release
661     ${if} $0 == ""
662      ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$51" "DisplayVersion"
663     ${endif}
664    ${endif}
665    ${if} $0 != ""
666     StrCpy $R5 $0 # store the read version number
667     StrCpy $OldVersionNumber "${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5"
668     # we don't stop here because we want the latest installed version
669    ${endif} 
670   ${next}
671   
672   ${if} $OldVersionNumber > ${APP_SERIES_KEY}
673    # store the version number and reformat it temporarily for the error message
674    StrCpy $R0 $OldVersionNumber
675    StrCpy $OldVersionNumber $R5
676    MessageBox MB_OK|MB_ICONSTOP "$(NewerInstalled)" /SD IDOK
677    StrCpy $OldVersionNumber $R0
678    Abort
679   ${endif}
680
681   !insertmacro PRINTER_INIT
682   
683   # this can be reset to "true" in section SecDesktop
684   StrCpy $CreateDesktopIcon "false"
685   StrCpy $CreateFileAssociations "false"
686  
687   ${IfNot} ${Silent}
688     # Show banner while installer is intializating 
689     Banner::show /NOUNLOAD "Checking system"
690   ${EndIf}
691  
692   Call SearchExternal
693   
694   !if ${SETUPTYPE} == BUNDLE
695    # don't let the installer sections appear when the programs are already installed
696    ${if} $PathBibTeXEditor != ""
697     SectionSetText 3 "" # hides the corresponding uninstaller section, ${SecInstJabRef}
698    ${endif}
699   !endif
700   
701   # select sections of already installed spell-checker dictionaries, make them read-only
702   # and set the necessary size to 0 bytes
703   StrCpy $String $FoundDict
704   StrCpy $Search "af_ZA"
705   Call StrPoint # function from LyXUtils.nsh
706   ${if} $Pointer != "-1"
707    IntOp $0 ${SF_SELECTED} | ${SF_RO}
708    SectionSetFlags ${SecDAfrikaans} $0
709    SectionSetSize ${SecDAfrikaans} 0
710   ${endif}
711   StrCpy $Search "ar_DZ"
712   Call StrPoint
713   ${if} $Pointer != "-1"
714    IntOp $0 ${SF_SELECTED} | ${SF_RO}
715    SectionSetFlags ${SecDArabic} $0
716    SectionSetSize ${SecDArabic} 0
717   ${endif}
718   StrCpy $Search "hy_AM"
719   Call StrPoint
720   ${if} $Pointer != "-1"
721    IntOp $0 ${SF_SELECTED} | ${SF_RO}
722    SectionSetFlags ${SecDArmenian} $0
723    SectionSetSize ${SecDArmenian} 0
724   ${endif}
725   StrCpy $Search "id_ID"
726   Call StrPoint
727   ${if} $Pointer != "-1"
728    IntOp $0 ${SF_SELECTED} | ${SF_RO}
729    SectionSetFlags ${SecDIndonesian} $0
730    SectionSetSize ${SecDIndonesian} 0
731   ${endif}
732   StrCpy $Search "ms_MY"
733   Call StrPoint
734   ${if} $Pointer != "-1"
735    IntOp $0 ${SF_SELECTED} | ${SF_RO}
736    SectionSetFlags ${SecDMalayan} $0
737    SectionSetSize ${SecDMalayan} 0
738   ${endif}
739   StrCpy $Search "be_BY"
740   Call StrPoint
741   ${if} $Pointer != "-1"
742    IntOp $0 ${SF_SELECTED} | ${SF_RO}
743    SectionSetFlags ${SecDBelarusian} $0
744    SectionSetSize ${SecDBelarusian} 0
745   ${endif}
746   StrCpy $Search "br_FR"
747   Call StrPoint
748   ${if} $Pointer != "-1"
749    IntOp $0 ${SF_SELECTED} | ${SF_RO}
750    SectionSetFlags ${SecDBreton} $0
751    SectionSetSize ${SecDBreton} 0
752   ${endif}
753   StrCpy $Search "bg_BG"
754   Call StrPoint
755   ${if} $Pointer != "-1"
756    IntOp $0 ${SF_SELECTED} | ${SF_RO}
757    SectionSetFlags ${SecDBulgarian} $0
758    SectionSetSize ${SecDBulgarian} 0
759   ${endif}
760   StrCpy $Search "ca_ES"
761   Call StrPoint
762   ${if} $Pointer != "-1"
763    IntOp $0 ${SF_SELECTED} | ${SF_RO}
764    SectionSetFlags ${SecDCatalanian} $0
765    SectionSetSize ${SecDCatalanian} 0
766   ${endif}
767   StrCpy $Search "cs_CZ"
768   Call StrPoint
769   ${if} $Pointer != "-1"
770    IntOp $0 ${SF_SELECTED} | ${SF_RO}
771    SectionSetFlags ${SecDCzech} $0
772    SectionSetSize ${SecDCzech} 0
773   ${endif}
774  
775   StrCpy $Search "cop_EG"
776   Call StrPoint
777   ${if} $Pointer != "-1"
778    IntOp $0 ${SF_SELECTED} | ${SF_RO}
779    SectionSetFlags ${SecDCoptic} $0
780    SectionSetSize ${SecDCoptic} 0
781   ${endif}
782   StrCpy $Search "cy_GB"
783   Call StrPoint
784   ${if} $Pointer != "-1"
785    IntOp $0 ${SF_SELECTED} | ${SF_RO}
786    SectionSetFlags ${SecDWelsh} $0
787    SectionSetSize ${SecDWelsh} 0
788   ${endif}
789   StrCpy $Search "da_DK"
790   Call StrPoint
791   ${if} $Pointer != "-1"
792    IntOp $0 ${SF_SELECTED} | ${SF_RO}
793    SectionSetFlags ${SecDDanish} $0
794    SectionSetSize ${SecDDanish} 0
795   ${endif}
796   StrCpy $Search "de_AT"
797   Call StrPoint
798   ${if} $Pointer != "-1"
799    IntOp $0 ${SF_SELECTED} | ${SF_RO}
800    SectionSetFlags ${SecDGermanAT} $0
801    SectionSetSize ${SecDGermanAT} 0
802   ${endif}
803   StrCpy $Search "de_CH"
804   Call StrPoint
805   ${if} $Pointer != "-1"
806    IntOp $0 ${SF_SELECTED} | ${SF_RO}
807    SectionSetFlags ${SecDGermanCH} $0
808    SectionSetSize ${SecDGermanCH} 0
809   ${endif}
810   StrCpy $Search "de_DE"
811   Call StrPoint
812   ${if} $Pointer != "-1"
813    IntOp $0 ${SF_SELECTED} | ${SF_RO}
814    SectionSetFlags ${SecDGermanD} $0
815    SectionSetSize ${SecDGermanD} 0
816   ${endif}
817   StrCpy $Search "el_GR"
818   Call StrPoint
819   ${if} $Pointer != "-1"
820    IntOp $0 ${SF_SELECTED} | ${SF_RO}
821    SectionSetFlags ${SecDGreek} $0
822    SectionSetSize ${SecDGreek} 0
823   ${endif}
824   StrCpy $Search "et_EE"
825   Call StrPoint
826   ${if} $Pointer != "-1"
827    IntOp $0 ${SF_SELECTED} | ${SF_RO}
828    SectionSetFlags ${SecDEstonian} $0
829    SectionSetSize ${SecDEstonian} 0
830   ${endif}
831   StrCpy $Search "en_AU"
832   Call StrPoint
833   ${if} $Pointer != "-1"
834    IntOp $0 ${SF_SELECTED} | ${SF_RO}
835    SectionSetFlags ${SecDEnglishAU} $0
836    SectionSetSize ${SecDEnglishAU} 0
837   ${endif}
838   StrCpy $Search "en_CA"
839   Call StrPoint
840   ${if} $Pointer != "-1"
841    IntOp $0 ${SF_SELECTED} | ${SF_RO}
842    SectionSetFlags ${SecDEnglishCA} $0
843    SectionSetSize ${SecDEnglishCA} 0
844   ${endif}
845   StrCpy $Search "en_GB"
846   Call StrPoint
847   ${if} $Pointer != "-1"
848    IntOp $0 ${SF_SELECTED} | ${SF_RO}
849    SectionSetFlags ${SecDEnglishGB} $0
850    SectionSetSize ${SecDEnglishGB} 0
851   ${endif}
852   StrCpy $Search "en_NZ"
853   Call StrPoint
854   ${if} $Pointer != "-1"
855    IntOp $0 ${SF_SELECTED} | ${SF_RO}
856    SectionSetFlags ${SecDEnglishNZ} $0
857    SectionSetSize ${SecDEnglishNZ} 0
858   ${endif}
859   StrCpy $Search "en_US"
860   Call StrPoint
861   ${if} $Pointer != "-1"
862    IntOp $0 ${SF_SELECTED} | ${SF_RO}
863    SectionSetFlags ${SecDEnglishUS} $0
864    SectionSetSize ${SecDEnglishUS} 0
865   ${endif}
866   StrCpy $Search "es_ES"
867   Call StrPoint
868   ${if} $Pointer != "-1"
869    IntOp $0 ${SF_SELECTED} | ${SF_RO}
870    SectionSetFlags ${SecDSpanishES} $0
871    SectionSetSize ${SecDSpanishES} 0
872   ${endif}
873   StrCpy $Search "es_MX"
874   Call StrPoint
875   ${if} $Pointer != "-1"
876    IntOp $0 ${SF_SELECTED} | ${SF_RO}
877    SectionSetFlags ${SecDSpanishMX} $0
878    SectionSetSize ${SecDSpanishMX} 0
879   ${endif}
880   StrCpy $Search "eo_EO"
881   Call StrPoint
882   ${if} $Pointer != "-1"
883    IntOp $0 ${SF_SELECTED} | ${SF_RO}
884    SectionSetFlags ${SecDEsperanto} $0
885    SectionSetSize ${SecDEsperanto} 0
886   ${endif}
887   StrCpy $Search "eu_ES"
888   Call StrPoint
889   ${if} $Pointer != "-1"
890    IntOp $0 ${SF_SELECTED} | ${SF_RO}
891    SectionSetFlags ${SecDBasque} $0
892    SectionSetSize ${SecDBasque} 0
893   ${endif}
894   StrCpy $Search "fa_IR"
895   Call StrPoint
896   ${if} $Pointer != "-1"
897    IntOp $0 ${SF_SELECTED} | ${SF_RO}
898    SectionSetFlags ${SecDFarsi} $0
899    SectionSetSize ${SecDFarsi} 0
900   ${endif}
901   StrCpy $Search "fr_CA"
902   Call StrPoint
903   ${if} $Pointer != "-1"
904    IntOp $0 ${SF_SELECTED} | ${SF_RO}
905    SectionSetFlags ${SecDFrenchCanada} $0
906    SectionSetSize ${SecDFrenchCanada} 0
907   ${endif}
908   StrCpy $Search "fr_FR"
909   Call StrPoint
910   ${if} $Pointer != "-1"
911    IntOp $0 ${SF_SELECTED} | ${SF_RO}
912    SectionSetFlags ${SecDFrench} $0
913    SectionSetSize ${SecDFrench} 0
914   ${endif}
915   StrCpy $Search "ga_IR"
916   Call StrPoint
917   ${if} $Pointer != "-1"
918    IntOp $0 ${SF_SELECTED} | ${SF_RO}
919    SectionSetFlags ${SecDGaelic} $0
920    SectionSetSize ${SecDGaelic} 0
921   ${endif}
922   StrCpy $Search "gd_GB"
923   Call StrPoint
924   ${if} $Pointer != "-1"
925    IntOp $0 ${SF_SELECTED} | ${SF_RO}
926    SectionSetFlags ${SecDScottish} $0
927    SectionSetSize ${SecDScottish} 0
928   ${endif}
929   StrCpy $Search "gl_ES"
930   Call StrPoint
931   ${if} $Pointer != "-1"
932    IntOp $0 ${SF_SELECTED} | ${SF_RO}
933    SectionSetFlags ${SecDGalician} $0
934    SectionSetSize ${SecDGalician} 0
935   ${endif}
936   StrCpy $Search "he_IL"
937   Call StrPoint
938   ${if} $Pointer != "-1"
939    IntOp $0 ${SF_SELECTED} | ${SF_RO}
940    SectionSetFlags ${SecDHebrew} $0
941    SectionSetSize ${SecDHebrew} 0
942   ${endif}
943   StrCpy $Search "hi_IN"
944   Call StrPoint
945   ${if} $Pointer != "-1"
946    IntOp $0 ${SF_SELECTED} | ${SF_RO}
947    SectionSetFlags ${SecDHindi} $0
948    SectionSetSize ${SecDHindi} 0
949   ${endif}
950   StrCpy $Search "hr_HR"
951   Call StrPoint
952   ${if} $Pointer != "-1"
953    IntOp $0 ${SF_SELECTED} | ${SF_RO}
954    SectionSetFlags ${SecDCroatian} $0
955    SectionSetSize ${SecDCroatian} 0
956   ${endif}
957   StrCpy $Search "hu_HU"
958   Call StrPoint
959   ${if} $Pointer != "-1"
960    IntOp $0 ${SF_SELECTED} | ${SF_RO}
961    SectionSetFlags ${SecDHungarian} $0
962    SectionSetSize ${SecDHungarian} 0
963   ${endif}
964   StrCpy $Search "ia_IA"
965   Call StrPoint
966   ${if} $Pointer != "-1"
967    IntOp $0 ${SF_SELECTED} | ${SF_RO}
968    SectionSetFlags ${SecDInterlingua} $0
969    SectionSetSize ${SecDInterlingua} 0
970   ${endif}
971   StrCpy $Search "is_IS"
972   Call StrPoint
973   ${if} $Pointer != "-1"
974    IntOp $0 ${SF_SELECTED} | ${SF_RO}
975    SectionSetFlags ${SecDIcelandic} $0
976    SectionSetSize ${SecDIcelandic} 0
977   ${endif}
978   StrCpy $Search "it_IT"
979   Call StrPoint
980   ${if} $Pointer != "-1"
981    IntOp $0 ${SF_SELECTED} | ${SF_RO}
982    SectionSetFlags ${SecDItalian} $0
983    SectionSetSize ${SecDItalian} 0
984   ${endif}
985   StrCpy $Search "kk_KZ"
986   Call StrPoint
987   ${if} $Pointer != "-1"
988    IntOp $0 ${SF_SELECTED} | ${SF_RO}
989    SectionSetFlags ${SecDKazakh} $0
990    SectionSetSize ${SecDKazakh} 0
991   ${endif}
992   StrCpy $Search "ko_KR"
993   Call StrPoint
994   ${if} $Pointer != "-1"
995    IntOp $0 ${SF_SELECTED} | ${SF_RO}
996    SectionSetFlags ${SecDKorean} $0
997    SectionSetSize ${SecDKorean} 0
998   ${endif}
999   StrCpy $Search "la_LA"
1000   Call StrPoint
1001   ${if} $Pointer != "-1"
1002    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1003    SectionSetFlags ${SecDLatin} $0
1004    SectionSetSize ${SecDLatin} 0
1005   ${endif}
1006   StrCpy $Search "lt_LT"
1007   Call StrPoint
1008   ${if} $Pointer != "-1"
1009    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1010    SectionSetFlags ${SecDLithuanian} $0
1011    SectionSetSize ${SecDLithuanian} 0
1012   ${endif}
1013   StrCpy $Search "lv_LV"
1014   Call StrPoint
1015   ${if} $Pointer != "-1"
1016    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1017    SectionSetFlags ${SecDLatvian} $0
1018    SectionSetSize ${SecDLatvian} 0
1019   ${endif}
1020   StrCpy $Search "mr_IN"
1021   Call StrPoint
1022   ${if} $Pointer != "-1"
1023    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1024    SectionSetFlags ${SecDMarathi} $0
1025    SectionSetSize ${SecDMarathi} 0
1026   ${endif}
1027   StrCpy $Search "nl_NL"
1028   Call StrPoint
1029   ${if} $Pointer != "-1"
1030    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1031    SectionSetFlags ${SecDDutch} $0
1032    SectionSetSize ${SecDDutch} 0
1033   ${endif}
1034   StrCpy $Search "nb_NO"
1035   Call StrPoint
1036   ${if} $Pointer != "-1"
1037    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1038    SectionSetFlags ${SecDNorwegianNB} $0
1039    SectionSetSize ${SecDNorwegianNB} 0
1040   ${endif}
1041   StrCpy $Search "nn_NO"
1042   Call StrPoint
1043   ${if} $Pointer != "-1"
1044    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1045    SectionSetFlags ${SecDNorwegianNN} $0
1046    SectionSetSize ${SecDNorwegianNN} 0
1047   ${endif}
1048   StrCpy $Search "oc_FR"
1049   Call StrPoint
1050   ${if} $Pointer != "-1"
1051    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1052    SectionSetFlags ${SecDOccitan} $0
1053    SectionSetSize ${SecDOccitan} 0
1054   ${endif}
1055   StrCpy $Search "pl_PL"
1056   Call StrPoint
1057   ${if} $Pointer != "-1"
1058    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1059    SectionSetFlags ${SecDPolish} $0
1060    SectionSetSize ${SecDPolish} 0
1061   ${endif}
1062   StrCpy $Search "pt_BR"
1063   Call StrPoint
1064   ${if} $Pointer != "-1"
1065    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1066    SectionSetFlags ${SecDPortugueseBR} $0
1067    SectionSetSize ${SecDPortugueseBR} 0
1068   ${endif}
1069   StrCpy $Search "pt_PT"
1070   Call StrPoint
1071   ${if} $Pointer != "-1"
1072    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1073    SectionSetFlags ${SecDPortuguesePT} $0
1074    SectionSetSize ${SecDPortuguesePT} 0
1075   ${endif}
1076   StrCpy $Search "ro_RO"
1077   Call StrPoint
1078   ${if} $Pointer != "-1"
1079    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1080    SectionSetFlags ${SecDRomanian} $0
1081    SectionSetSize ${SecDRomanian} 0
1082   ${endif}
1083   StrCpy $Search "ru_RU"
1084   Call StrPoint
1085   ${if} $Pointer != "-1"
1086    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1087    SectionSetFlags ${SecDRussian} $0
1088    SectionSetSize ${SecDRussian} 0
1089   ${endif}
1090   StrCpy $Search "dsb_DE"
1091   Call StrPoint
1092   ${if} $Pointer != "-1"
1093    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1094    SectionSetFlags ${SecDSorbianD} $0
1095    SectionSetSize ${SecDSorbianD} 0
1096   ${endif}
1097   StrCpy $Search "hsb_DE"
1098   Call StrPoint
1099   ${if} $Pointer != "-1"
1100    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1101    SectionSetFlags ${SecDSorbianH} $0
1102    SectionSetSize ${SecDSorbianH} 0
1103   ${endif}
1104   StrCpy $Search "sq_AL"
1105   Call StrPoint
1106   ${if} $Pointer != "-1"
1107    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1108    SectionSetFlags ${SecDAlbanian} $0
1109    SectionSetSize ${SecDAlbanian} 0
1110   ${endif}
1111   StrCpy $Search "sl_SI"
1112   Call StrPoint
1113   ${if} $Pointer != "-1"
1114    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1115    SectionSetFlags ${SecDSlovenian} $0
1116    SectionSetSize ${SecDSlovenian} 0
1117   ${endif}
1118   StrCpy $Search "sk_SK"
1119   Call StrPoint
1120   ${if} $Pointer != "-1"
1121    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1122    SectionSetFlags ${SecDSlovakian} $0
1123    SectionSetSize ${SecDSlovakian} 0
1124   ${endif}
1125   StrCpy $Search "sr_RS"
1126   Call StrPoint
1127   ${if} $Pointer != "-1"
1128    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1129    SectionSetFlags ${SecDSerbianC} $0
1130    SectionSetSize ${SecDSerbianC} 0
1131   ${endif}
1132   StrCpy $Search "sr_RS-Latin"
1133   Call StrPoint
1134   ${if} $Pointer != "-1"
1135    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1136    SectionSetFlags ${SecDSerbianL} $0
1137    SectionSetSize ${SecDSerbianL} 0
1138   ${endif}
1139   StrCpy $Search "sv_SE"
1140   Call StrPoint
1141   ${if} $Pointer != "-1"
1142    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1143    SectionSetFlags ${SecDSwedish} $0
1144    SectionSetSize ${SecDSwedish} 0
1145   ${endif}
1146   StrCpy $Search "ta_IN"
1147   Call StrPoint
1148   ${if} $Pointer != "-1"
1149    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1150    SectionSetFlags ${SecDTamil} $0
1151    SectionSetSize ${SecDTamil} 0
1152   ${endif}
1153   StrCpy $Search "te_IN"
1154   Call StrPoint
1155   ${if} $Pointer != "-1"
1156    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1157    SectionSetFlags ${SecDTelugu} $0
1158    SectionSetSize ${SecDTelugu} 0
1159   ${endif}
1160   StrCpy $Search "th_TH"
1161   Call StrPoint
1162   ${if} $Pointer != "-1"
1163    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1164    SectionSetFlags ${SecDThai} $0
1165    SectionSetSize ${SecDThai} 0
1166   ${endif}
1167   StrCpy $Search "tk_TM"
1168   Call StrPoint
1169   ${if} $Pointer != "-1"
1170    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1171    SectionSetFlags ${SecDTurkmen} $0
1172    SectionSetSize ${SecDTurkmen} 0
1173   ${endif}
1174   StrCpy $Search "uk_UA"
1175   Call StrPoint
1176   ${if} $Pointer != "-1"
1177    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1178    SectionSetFlags ${SecDUkrainian} $0
1179    SectionSetSize ${SecDUkrainian} 0
1180   ${endif}
1181   StrCpy $Search "ur_PK"
1182   Call StrPoint
1183   ${if} $Pointer != "-1"
1184    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1185    SectionSetFlags ${SecDUrdu} $0
1186    SectionSetSize ${SecDUrdu} 0
1187   ${endif}
1188   StrCpy $Search "vi_VN"
1189   Call StrPoint
1190   ${if} $Pointer != "-1"
1191    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1192    SectionSetFlags ${SecDVietnamese} $0
1193    SectionSetSize ${SecDVietnamese} 0
1194   ${endif}
1195   
1196   # select sections of already installed thesaurus dictionaries, make them read-only
1197   # and set the necessary size to 0 bytes
1198   StrCpy $String $FoundThes
1199   StrCpy $Search "bg_BG"
1200   Call StrPoint # function from LyXUtils.nsh
1201   ${if} $Pointer != "-1"
1202    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1203    SectionSetFlags ${SecTBulgarian} $0
1204    SectionSetSize ${SecTBulgarian} 0
1205   ${endif}
1206   StrCpy $Search "ca_ES"
1207   Call StrPoint
1208   ${if} $Pointer != "-1"
1209    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1210    SectionSetFlags ${SecTCatalan} $0
1211    SectionSetSize ${SecTCatalan} 0
1212   ${endif}
1213   StrCpy $Search "cs_CZ"
1214   Call StrPoint
1215   ${if} $Pointer != "-1"
1216    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1217    SectionSetFlags ${SecTCzech} $0
1218    SectionSetSize ${SecTCzech} 0
1219   ${endif}
1220   StrCpy $Search "da_DK"
1221   Call StrPoint
1222   ${if} $Pointer != "-1"
1223    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1224    SectionSetFlags ${SecTDanish} $0
1225    SectionSetSize ${SecTDanish} 0
1226   ${endif}
1227   StrCpy $Search "de_DE"
1228   Call StrPoint
1229   ${if} $Pointer != "-1"
1230    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1231    SectionSetFlags ${SecTGermanDA} $0
1232    SectionSetSize ${SecTGermanDA} 0
1233   ${endif} 
1234   StrCpy $Search "de_CH"
1235   Call StrPoint
1236   ${if} $Pointer != "-1"
1237    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1238    SectionSetFlags ${SecTGermanCH} $0
1239    SectionSetSize ${SecTGermanCH} 0
1240   ${endif}
1241   StrCpy $Search "en_GB"
1242   Call StrPoint
1243   ${if} $Pointer != "-1"
1244    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1245    SectionSetFlags ${SecTEnglishGB} $0
1246    SectionSetSize ${SecTEnglishGB} 0
1247   ${endif} 
1248   StrCpy $Search "en_US"
1249   Call StrPoint
1250   ${if} $Pointer != "-1"
1251    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1252    SectionSetFlags ${SecTEnglishUSAU} $0
1253    SectionSetSize ${SecTEnglishUSAU} 0
1254   ${endif}
1255   StrCpy $Search "es_ES"
1256   Call StrPoint
1257   ${if} $Pointer != "-1"
1258    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1259    SectionSetFlags ${SecTSpanish} $0
1260    SectionSetSize ${SecTSpanish} 0
1261   ${endif}
1262   StrCpy $Search "fr_FR"
1263   Call StrPoint
1264   ${if} $Pointer != "-1"
1265    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1266    SectionSetFlags ${SecTFrench} $0
1267    SectionSetSize ${SecTFrench} 0
1268   ${endif}
1269   StrCpy $Search "ga_IR"
1270   Call StrPoint
1271   ${if} $Pointer != "-1"
1272    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1273    SectionSetFlags ${SecTGaelic} $0
1274    SectionSetSize ${SecTGaelic} 0
1275   ${endif}
1276   StrCpy $Search "gl_ES"
1277   Call StrPoint
1278   ${if} $Pointer != "-1"
1279    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1280    SectionSetFlags ${SecTGalician} $0
1281    SectionSetSize ${SecTGalician} 0
1282   ${endif}
1283   StrCpy $Search "el_GR"
1284   Call StrPoint
1285   ${if} $Pointer != "-1"
1286    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1287    SectionSetFlags ${SecTGreek} $0
1288    SectionSetSize ${SecTGreek} 0
1289   ${endif}
1290   StrCpy $Search "is_IS"
1291   Call StrPoint
1292   ${if} $Pointer != "-1"
1293    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1294    SectionSetFlags ${SecTIcelandic} $0
1295    SectionSetSize ${SecTIcelandic} 0
1296   ${endif}
1297   StrCpy $Search "it_IT"
1298   Call StrPoint
1299   ${if} $Pointer != "-1"
1300    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1301    SectionSetFlags ${SecTItalian} $0
1302    SectionSetSize ${SecTItalian} 0
1303   ${endif}
1304   StrCpy $Search "hu_HU"
1305   Call StrPoint
1306   ${if} $Pointer != "-1"
1307    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1308    SectionSetFlags ${SecTHungarian} $0
1309    SectionSetSize ${SecTHungarian} 0
1310   ${endif}
1311   StrCpy $Search "nb_NO"
1312   Call StrPoint
1313   ${if} $Pointer != "-1"
1314    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1315    SectionSetFlags ${SecTNorwegianNB} $0
1316    SectionSetSize ${SecTNorwegianNB} 0
1317   ${endif}
1318   StrCpy $Search "pl_PL"
1319   Call StrPoint
1320   ${if} $Pointer != "-1"
1321    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1322    SectionSetFlags ${SecTPolish} $0
1323    SectionSetSize ${SecTPolish} 0
1324   ${endif}
1325   StrCpy $Search "pt_PT"
1326   Call StrPoint
1327   ${if} $Pointer != "-1"
1328    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1329    SectionSetFlags ${SecTPortuguese} $0
1330    SectionSetSize ${SecTPortuguese} 0
1331   ${endif}
1332   StrCpy $Search "ro_RO"
1333   Call StrPoint
1334   ${if} $Pointer != "-1"
1335    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1336    SectionSetFlags ${SecTRomanian} $0
1337    SectionSetSize ${SecTRomanian} 0
1338   ${endif}
1339   StrCpy $Search "ru_RU"
1340   Call StrPoint
1341   ${if} $Pointer != "-1"
1342    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1343    SectionSetFlags ${SecTRussian} $0
1344    SectionSetSize ${SecTRussian} 0
1345   ${endif}
1346   StrCpy $Search "sl_SI"
1347   Call StrPoint
1348   ${if} $Pointer != "-1"
1349    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1350    SectionSetFlags ${SecTSlovenian} $0
1351    SectionSetSize ${SecTSlovenian} 0
1352   ${endif}
1353   StrCpy $Search "sk_SK"
1354   Call StrPoint
1355   ${if} $Pointer != "-1"
1356    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1357    SectionSetFlags ${SecTSlovakian} $0
1358    SectionSetSize ${SecTSlovakian} 0
1359   ${endif}
1360   StrCpy $Search "sv_SE"
1361   Call StrPoint
1362   ${if} $Pointer != "-1"
1363    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1364    SectionSetFlags ${SecTSwedish} $0
1365    SectionSetSize ${SecTSwedish} 0
1366   ${endif}
1367   StrCpy $Search "uk_UA"
1368   Call StrPoint
1369   ${if} $Pointer != "-1"
1370    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1371    SectionSetFlags ${SecTUkrainian} $0
1372    SectionSetSize ${SecTUkrainian} 0
1373   ${endif}
1374   
1375   ${IfNot} ${Silent}
1376     Banner::destroy
1377   ${EndIf}
1378
1379 FunctionEnd
1380
1381 # this function is called at first after starting the uninstaller
1382 Function un.onInit
1383
1384   !insertmacro PRINTER_INIT
1385   !insertmacro MULTIUSER_UNINIT
1386
1387   # Check that LyX is not currently running
1388   FindProcDLL::FindProc "lyx.exe"
1389   ${if} $R0 == "1"
1390    MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
1391    Abort
1392   ${endif}
1393
1394   # set registry root key
1395   ${if} $MultiUser.Privileges == "Admin"
1396   ${orif} $MultiUser.Privileges == "Power"
1397     SetShellVarContext all
1398   ${else}
1399    SetShellVarContext current
1400   ${endif}
1401
1402   # Ascertain whether the user has sufficient privileges to uninstall.
1403   # abort when LyX was installed with admin permissions but the user doesn't have administrator privileges
1404   ReadRegStr $0 HKLM "${APP_UNINST_KEY}" "DisplayVersion"
1405   ${if} $0 != ""
1406   ${andif} $MultiUser.Privileges != "Admin"
1407   ${andif} $MultiUser.Privileges != "Power"
1408    MessageBox MB_OK|MB_ICONSTOP "$(UnNotAdminLabel)" /SD IDOK
1409    Abort
1410   ${endif}
1411   # warning when LyX couldn't be found in the registry
1412   ${if} $0 == "" # check in HKCU
1413    ReadRegStr $0 HKCU "${APP_UNINST_KEY}" "DisplayVersion"
1414    ${if} $0 == ""
1415      MessageBox MB_OK|MB_ICONEXCLAMATION "$(UnNotInRegistryLabel)" /SD IDOK
1416    ${endif}
1417   ${endif}
1418   
1419   # Macro to investigate name of LyX's preferences folders to be able remove them
1420   !insertmacro UnAppPreSuff $AppPre $AppSuff # macro from LyXUtils.nsh
1421
1422   # test if MiKTeX was installed together with LyX
1423   ReadRegStr $0 SHCTX "SOFTWARE\MiKTeX.org\MiKTeX" "OnlyWithLyX"
1424   ${if} $0 == "Yes${APP_SERIES_KEY}"
1425    SectionSetText 2 "MiKTeX" # names the corersponding uninstaller section
1426    StrCpy $LaTeXInstalled "MiKTeX"
1427   ${else}
1428    SectionSetText 2 "" # hides the corresponding uninstaller section
1429   ${endif}
1430   
1431   # test if JabRef was installed together with LyX
1432   ReadRegStr $0 SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "OnlyWithLyX"
1433   ${if} $0 == "Yes${APP_SERIES_KEY}"
1434    SectionSetText 3 "JabRef" # names the corersponding uninstaller section
1435    StrCpy $JabRefInstalled "Yes"
1436   ${else}
1437    SectionSetText 3 "" # hides the corresponding uninstaller section
1438   ${endif}
1439
1440   # question message if the user really wants to uninstall LyX
1441   MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "$(UnReallyRemoveLabel)" /SD IDYES IDYES +2 # continue if yes
1442   Abort
1443
1444 FunctionEnd
1445