]> git.lyx.org Git - features.git/blob - development/Win32/packaging/installer/include/init.nsh
Win installer: update to JabRef 3.x
[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 "$(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 531
171 SectionEnd
172
173 Section "English (GB)" SecDEnglishGB
174  # already installed by default
175  SectionIn RO
176  #StrCpy $DictCodes "en_GB,$DictCodes"
177  AddSize 652
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 530
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 3090
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 1540
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 1490
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 "Türkçe" SecDTurkish
419  StrCpy $DictCodes "tr_TR,$DictCodes"
420  AddSize 8870
421 SectionEnd
422
423 Section /o "Ukrainian" SecDUkrainian
424  StrCpy $DictCodes "uk_UA,$DictCodes"
425  AddSize 3077
426 SectionEnd
427
428 Section /o "Urdu" SecDUrdu
429  StrCpy $DictCodes "ur_PK,$DictCodes"
430  AddSize 1401
431 SectionEnd
432
433 Section /o "Vietnamese" SecDVietnamese
434  StrCpy $DictCodes "vi_VN,$DictCodes"
435  AddSize 40
436 SectionEnd
437
438 SectionGroupEnd
439
440
441 SectionGroup "Thesaurus" SecThesaurus
442
443 Section /o "Bulgarian" SecTBulgarian
444  StrCpy $ThesCodes "bg_BG,$ThesCodes"
445  AddSize 3020
446 SectionEnd
447
448 Section /o "Català" SecTCatalan
449  StrCpy $ThesCodes "ca_ES,$ThesCodes"
450  AddSize 731
451 SectionEnd
452
453 Section /o "Ce\9atina" SecTCzech
454  StrCpy $ThesCodes "cs_CZ,$ThesCodes"
455  AddSize 635
456 SectionEnd
457
458 Section /o "Dansk" SecTDanish
459  StrCpy $ThesCodes "da_DK,$ThesCodes"
460  AddSize 2360
461 SectionEnd
462
463 Section /o "Deutsch (D/A)" SecTGermanDA
464  StrCpy $ThesCodes "de_DE,$ThesCodes"
465  AddSize 14600
466 SectionEnd
467
468 Section /o "Deutsch (CH)" SecTGermanCH
469  StrCpy $ThesCodes "de_CH,$ThesCodes"
470  AddSize 14600
471 SectionEnd
472
473 Section /o "English (GB)" SecTEnglishGB
474  StrCpy $ThesCodes "en_GB,$ThesCodes"
475  AddSize 14300
476 SectionEnd
477
478 Section /o "English (US/AU)" SecTEnglishUSAU
479  StrCpy $ThesCodes "en_US,$ThesCodes"
480  AddSize 21600
481 SectionEnd
482
483 Section /o "Español" SecTSpanish
484  StrCpy $ThesCodes "es_ES,$ThesCodes"
485  AddSize 2860
486 SectionEnd
487
488 Section /o "Français" SecTFrench
489  StrCpy $ThesCodes "fr_FR,$ThesCodes"
490  AddSize 5060
491 SectionEnd
492
493 Section /o "Gaeilge" SecTGaelic
494  StrCpy $ThesCodes "ga_IR,$ThesCodes"
495  AddSize 30600
496 SectionEnd
497
498 Section /o "Galego" SecTGalician
499  StrCpy $ThesCodes "gl_ES,$ThesCodes"
500  AddSize 510
501 SectionEnd
502
503 Section /o "Greek" SecTGreek
504  StrCpy $ThesCodes "el_GR,$ThesCodes"
505  AddSize 903
506 SectionEnd
507
508 Section /o "Íslenska" SecTIcelandic
509  StrCpy $ThesCodes "is_IS,$ThesCodes"
510  AddSize 63
511 SectionEnd
512
513 Section /o "Italiano" SecTItalian
514  StrCpy $ThesCodes "it_IT,$ThesCodes"
515  AddSize 2520
516 SectionEnd
517
518 Section /o "Magyar" SecTHungarian
519  StrCpy $ThesCodes "hu_HU,$ThesCodes"
520  AddSize 632
521 SectionEnd
522
523 Section /o "Norsk (Bokmål)" SecTNorwegianNB
524  StrCpy $ThesCodes "nb_NO,$ThesCodes"
525  AddSize 2535
526 SectionEnd
527
528 Section /o "Polski" SecTPolish
529  StrCpy $ThesCodes "pl_PL,$ThesCodes"
530  AddSize 5580
531 SectionEnd
532
533 Section /o "Português" SecTPortuguese
534  StrCpy $ThesCodes "pt_PT,$ThesCodes"
535  AddSize 860
536 SectionEnd
537
538 Section /o "Româna" SecTRomanian
539  StrCpy $ThesCodes "ro_RO,$ThesCodes"
540  AddSize 3650
541 SectionEnd
542
543 Section /o "Russian" SecTRussian
544  StrCpy $ThesCodes "ru_RU,$ThesCodes"
545  AddSize 2080
546 SectionEnd
547
548 Section /o "Sloven\9acina" SecTSlovenian
549  StrCpy $ThesCodes "sl_SI,$ThesCodes"
550  AddSize 1110
551 SectionEnd
552
553 Section /o "Slovenský" SecTSlovakian
554  StrCpy $ThesCodes "sk_SK,$ThesCodes"
555  AddSize 930
556 SectionEnd
557
558 Section /o "Svenska" SecTSwedish
559  StrCpy $ThesCodes "sv_SE,$ThesCodes"
560  AddSize 720
561 SectionEnd
562
563 Section /o "Ukrainian" SecTUkrainian
564  StrCpy $ThesCodes "uk_UA,$ThesCodes"
565  AddSize 1309
566 SectionEnd
567
568 SectionGroupEnd
569
570 # Section descriptions
571 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
572 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
573 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
574 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
575 !if ${SETUPTYPE} == BUNDLE
576  !insertmacro MUI_DESCRIPTION_TEXT ${SecInstJabRef} "$(SecInstJabRefDescription)"
577 !endif
578 !insertmacro MUI_DESCRIPTION_TEXT ${SecDictionaries} "$(SecDictionariesDescription)"
579 !insertmacro MUI_DESCRIPTION_TEXT ${SecThesaurus} "$(SecThesaurusDescription)"
580 !insertmacro MUI_FUNCTION_DESCRIPTION_END
581
582
583 # .onInit must be here after the section definition because we have to set
584 # the selection states of the dictionary sections
585 Function .onInit
586
587   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
588   ${if} $R0 == "5.0" # 2000
589   ${orif} $R0 == "5.1" # XP
590   ${orif} $R0 == "5.2" # 2003
591     MessageBox MB_OK|MB_ICONSTOP "${APP_NAME} ${APP_VERSION} requires Windows Vista or newer." /SD IDOK
592     Quit
593   ${endif}
594   
595   # check that the installer is not currently running
596   System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${BundleExeFile}.Instance") i .r1 ?e'
597   Pop $R0
598   ${if} $R0 != "0"
599    MessageBox MB_OK|MB_ICONSTOP "$(InstallRunning)" /SD IDOK
600    Abort
601   ${endif}
602   System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${ExeFile}.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   
609   # FIXME: check that LyX is not currently running
610   #System::Call 'kernel32::CreateMutexA(i 0, i 0, t "LyX.exe.Instance") i .r1 ?e'
611   #Pop $R0
612   #MessageBox MB_OK "$R0"
613   #${if} $R0 != "0"
614   # MessageBox MB_OK|MB_ICONSTOP "$(LyXRunning)" 
615   # Abort
616   #${endif}
617   
618   # read the user and computer name
619   ReadRegStr $ComputerName HKLM "System\CurrentControlSet\Control\ComputerName\ActiveComputerName" "ComputerName"
620   System::Call "advapi32::GetUserName(t .r0, *i ${NSIS_MAX_STRLEN} r1) i.r2"
621   StrCpy $UserName $0
622   
623   !insertmacro MULTIUSER_INIT
624   
625   # check if this LyX version is already installed
626   ${if} $MultiUser.Privileges == "Admin"
627   ${orif} $MultiUser.Privileges == "Power"
628    ReadRegStr $0 HKLM "${APP_UNINST_KEY}" "DisplayIcon"
629   ${else}
630    ReadRegStr $0 HKCU "${APP_UNINST_KEY}" "DisplayIcon"
631    # handle also the case that LyX is already installed in HKLM
632    ${if} $0 == ""
633     ReadRegStr $0 HKLM "${APP_UNINST_KEY}" "DisplayIcon"
634    ${endif}
635   ${endif}
636   ${if} $0 != ""
637    # check if the uninstaller was acidentally deleted
638    # if so don't bother the user if he realy wants to install a new LyX over an existing one
639    # because he won't have a chance to deny this
640    StrCpy $4 $0 -10 # remove '\bin\lyx,0'
641    # (for FileCheck the variables $0 and $1 cannot be used)
642    !insertmacro FileCheck $5 "Uninstall-LyX.exe" "$4" # macro from LyXUtils.nsh
643    ${if} $5 == "False"
644     Goto ForceInstallation
645    ${endif}
646    # installing over an existing installation of the same LyX release is not necessary
647    # if the users does this he most probably has a problem with LyX that can better be solved
648    # by reinstalling LyX
649    # for beta and other test releases over-installing can even cause errors
650    MessageBox MB_YESNO|MB_DEFBUTTON2|MB_ICONEXCLAMATION "$(AlreadyInstalled)" /SD IDNO IDYES ForceInstallation 
651    Abort
652    ForceInstallation:
653   ${endif}
654   
655   # check if there is an existing LyX installation of the same LyX series
656   # we usually don't release more than 10 versions so with 20 we are safe to check if a newer version is installed
657   IntOp $4 ${APP_VERSION_REVISION} + 20
658   ${for} $5 0 $4
659    ${if} $MultiUser.Privileges == "Admin"
660    ${orif} $MultiUser.Privileges == "Power"
661     ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5" "DisplayVersion"
662     # also check for an emergency release
663     ${if} $0 == ""
664      ReadRegStr $0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$51" "DisplayVersion"
665     ${endif}
666    ${else}
667     ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5" "DisplayVersion"
668     # also check for an emergency release
669     ${if} $0 == ""
670      ReadRegStr $0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$51" "DisplayVersion"
671     ${endif}
672    ${endif}
673    ${if} $0 != ""
674     StrCpy $R5 $0 # store the read version number
675     StrCpy $OldVersionNumber "${APP_VERSION_MAJOR}${APP_VERSION_MINOR}$5"
676     # we don't stop here because we want the latest installed version
677    ${endif} 
678   ${next}
679   
680   ${if} $OldVersionNumber > ${APP_SERIES_KEY}
681    # store the version number and reformat it temporarily for the error message
682    StrCpy $R0 $OldVersionNumber
683    StrCpy $OldVersionNumber $R5
684    MessageBox MB_OK|MB_ICONSTOP "$(NewerInstalled)" /SD IDOK
685    StrCpy $OldVersionNumber $R0
686    Abort
687   ${endif}
688
689   # this can be reset to "true" in section SecDesktop
690   StrCpy $CreateDesktopIcon "false"
691   StrCpy $CreateFileAssociations "false"
692  
693   ${IfNot} ${Silent}
694     # Show banner while installer is intializating 
695     Banner::show /NOUNLOAD "Checking system"
696   ${EndIf}
697  
698   Call SearchExternal
699   
700   !if ${SETUPTYPE} == BUNDLE
701    # don't let the installer sections appear when the programs are already installed
702    ${if} $PathBibTeXEditor != ""
703     SectionSetText 3 "" # hides the corresponding uninstaller section, ${SecInstJabRef}
704    ${endif}
705   !endif
706   
707   # select sections of already installed spell-checker dictionaries, make them read-only
708   # and set the necessary size to 0 bytes
709   StrCpy $String $FoundDict
710   StrCpy $Search "af_ZA"
711   Call StrPoint # function from LyXUtils.nsh
712   ${if} $Pointer != "-1"
713    IntOp $0 ${SF_SELECTED} | ${SF_RO}
714    SectionSetFlags ${SecDAfrikaans} $0
715    SectionSetSize ${SecDAfrikaans} 0
716   ${endif}
717   StrCpy $Search "ar_DZ"
718   Call StrPoint
719   ${if} $Pointer != "-1"
720    IntOp $0 ${SF_SELECTED} | ${SF_RO}
721    SectionSetFlags ${SecDArabic} $0
722    SectionSetSize ${SecDArabic} 0
723   ${endif}
724   StrCpy $Search "hy_AM"
725   Call StrPoint
726   ${if} $Pointer != "-1"
727    IntOp $0 ${SF_SELECTED} | ${SF_RO}
728    SectionSetFlags ${SecDArmenian} $0
729    SectionSetSize ${SecDArmenian} 0
730   ${endif}
731   StrCpy $Search "id_ID"
732   Call StrPoint
733   ${if} $Pointer != "-1"
734    IntOp $0 ${SF_SELECTED} | ${SF_RO}
735    SectionSetFlags ${SecDIndonesian} $0
736    SectionSetSize ${SecDIndonesian} 0
737   ${endif}
738   StrCpy $Search "ms_MY"
739   Call StrPoint
740   ${if} $Pointer != "-1"
741    IntOp $0 ${SF_SELECTED} | ${SF_RO}
742    SectionSetFlags ${SecDMalayan} $0
743    SectionSetSize ${SecDMalayan} 0
744   ${endif}
745   StrCpy $Search "be_BY"
746   Call StrPoint
747   ${if} $Pointer != "-1"
748    IntOp $0 ${SF_SELECTED} | ${SF_RO}
749    SectionSetFlags ${SecDBelarusian} $0
750    SectionSetSize ${SecDBelarusian} 0
751   ${endif}
752   StrCpy $Search "br_FR"
753   Call StrPoint
754   ${if} $Pointer != "-1"
755    IntOp $0 ${SF_SELECTED} | ${SF_RO}
756    SectionSetFlags ${SecDBreton} $0
757    SectionSetSize ${SecDBreton} 0
758   ${endif}
759   StrCpy $Search "bg_BG"
760   Call StrPoint
761   ${if} $Pointer != "-1"
762    IntOp $0 ${SF_SELECTED} | ${SF_RO}
763    SectionSetFlags ${SecDBulgarian} $0
764    SectionSetSize ${SecDBulgarian} 0
765   ${endif}
766   StrCpy $Search "ca_ES"
767   Call StrPoint
768   ${if} $Pointer != "-1"
769    IntOp $0 ${SF_SELECTED} | ${SF_RO}
770    SectionSetFlags ${SecDCatalanian} $0
771    SectionSetSize ${SecDCatalanian} 0
772   ${endif}
773   StrCpy $Search "cs_CZ"
774   Call StrPoint
775   ${if} $Pointer != "-1"
776    IntOp $0 ${SF_SELECTED} | ${SF_RO}
777    SectionSetFlags ${SecDCzech} $0
778    SectionSetSize ${SecDCzech} 0
779   ${endif}
780  
781   StrCpy $Search "cop_EG"
782   Call StrPoint
783   ${if} $Pointer != "-1"
784    IntOp $0 ${SF_SELECTED} | ${SF_RO}
785    SectionSetFlags ${SecDCoptic} $0
786    SectionSetSize ${SecDCoptic} 0
787   ${endif}
788   StrCpy $Search "cy_GB"
789   Call StrPoint
790   ${if} $Pointer != "-1"
791    IntOp $0 ${SF_SELECTED} | ${SF_RO}
792    SectionSetFlags ${SecDWelsh} $0
793    SectionSetSize ${SecDWelsh} 0
794   ${endif}
795   StrCpy $Search "da_DK"
796   Call StrPoint
797   ${if} $Pointer != "-1"
798    IntOp $0 ${SF_SELECTED} | ${SF_RO}
799    SectionSetFlags ${SecDDanish} $0
800    SectionSetSize ${SecDDanish} 0
801   ${endif}
802   StrCpy $Search "de_AT"
803   Call StrPoint
804   ${if} $Pointer != "-1"
805    IntOp $0 ${SF_SELECTED} | ${SF_RO}
806    SectionSetFlags ${SecDGermanAT} $0
807    SectionSetSize ${SecDGermanAT} 0
808   ${endif}
809   StrCpy $Search "de_CH"
810   Call StrPoint
811   ${if} $Pointer != "-1"
812    IntOp $0 ${SF_SELECTED} | ${SF_RO}
813    SectionSetFlags ${SecDGermanCH} $0
814    SectionSetSize ${SecDGermanCH} 0
815   ${endif}
816   StrCpy $Search "de_DE"
817   Call StrPoint
818   ${if} $Pointer != "-1"
819    IntOp $0 ${SF_SELECTED} | ${SF_RO}
820    SectionSetFlags ${SecDGermanD} $0
821    SectionSetSize ${SecDGermanD} 0
822   ${endif}
823   StrCpy $Search "el_GR"
824   Call StrPoint
825   ${if} $Pointer != "-1"
826    IntOp $0 ${SF_SELECTED} | ${SF_RO}
827    SectionSetFlags ${SecDGreek} $0
828    SectionSetSize ${SecDGreek} 0
829   ${endif}
830   StrCpy $Search "et_EE"
831   Call StrPoint
832   ${if} $Pointer != "-1"
833    IntOp $0 ${SF_SELECTED} | ${SF_RO}
834    SectionSetFlags ${SecDEstonian} $0
835    SectionSetSize ${SecDEstonian} 0
836   ${endif}
837   StrCpy $Search "en_AU"
838   Call StrPoint
839   ${if} $Pointer != "-1"
840    IntOp $0 ${SF_SELECTED} | ${SF_RO}
841    SectionSetFlags ${SecDEnglishAU} $0
842    SectionSetSize ${SecDEnglishAU} 0
843   ${endif}
844   StrCpy $Search "en_CA"
845   Call StrPoint
846   ${if} $Pointer != "-1"
847    IntOp $0 ${SF_SELECTED} | ${SF_RO}
848    SectionSetFlags ${SecDEnglishCA} $0
849    SectionSetSize ${SecDEnglishCA} 0
850   ${endif}
851   StrCpy $Search "en_GB"
852   Call StrPoint
853   ${if} $Pointer != "-1"
854    IntOp $0 ${SF_SELECTED} | ${SF_RO}
855    SectionSetFlags ${SecDEnglishGB} $0
856    SectionSetSize ${SecDEnglishGB} 0
857   ${endif}
858   StrCpy $Search "en_NZ"
859   Call StrPoint
860   ${if} $Pointer != "-1"
861    IntOp $0 ${SF_SELECTED} | ${SF_RO}
862    SectionSetFlags ${SecDEnglishNZ} $0
863    SectionSetSize ${SecDEnglishNZ} 0
864   ${endif}
865   StrCpy $Search "en_US"
866   Call StrPoint
867   ${if} $Pointer != "-1"
868    IntOp $0 ${SF_SELECTED} | ${SF_RO}
869    SectionSetFlags ${SecDEnglishUS} $0
870    SectionSetSize ${SecDEnglishUS} 0
871   ${endif}
872   StrCpy $Search "es_ES"
873   Call StrPoint
874   ${if} $Pointer != "-1"
875    IntOp $0 ${SF_SELECTED} | ${SF_RO}
876    SectionSetFlags ${SecDSpanishES} $0
877    SectionSetSize ${SecDSpanishES} 0
878   ${endif}
879   StrCpy $Search "es_MX"
880   Call StrPoint
881   ${if} $Pointer != "-1"
882    IntOp $0 ${SF_SELECTED} | ${SF_RO}
883    SectionSetFlags ${SecDSpanishMX} $0
884    SectionSetSize ${SecDSpanishMX} 0
885   ${endif}
886   StrCpy $Search "eo_EO"
887   Call StrPoint
888   ${if} $Pointer != "-1"
889    IntOp $0 ${SF_SELECTED} | ${SF_RO}
890    SectionSetFlags ${SecDEsperanto} $0
891    SectionSetSize ${SecDEsperanto} 0
892   ${endif}
893   StrCpy $Search "eu_ES"
894   Call StrPoint
895   ${if} $Pointer != "-1"
896    IntOp $0 ${SF_SELECTED} | ${SF_RO}
897    SectionSetFlags ${SecDBasque} $0
898    SectionSetSize ${SecDBasque} 0
899   ${endif}
900   StrCpy $Search "fa_IR"
901   Call StrPoint
902   ${if} $Pointer != "-1"
903    IntOp $0 ${SF_SELECTED} | ${SF_RO}
904    SectionSetFlags ${SecDFarsi} $0
905    SectionSetSize ${SecDFarsi} 0
906   ${endif}
907   StrCpy $Search "fr_CA"
908   Call StrPoint
909   ${if} $Pointer != "-1"
910    IntOp $0 ${SF_SELECTED} | ${SF_RO}
911    SectionSetFlags ${SecDFrenchCanada} $0
912    SectionSetSize ${SecDFrenchCanada} 0
913   ${endif}
914   StrCpy $Search "fr_FR"
915   Call StrPoint
916   ${if} $Pointer != "-1"
917    IntOp $0 ${SF_SELECTED} | ${SF_RO}
918    SectionSetFlags ${SecDFrench} $0
919    SectionSetSize ${SecDFrench} 0
920   ${endif}
921   StrCpy $Search "ga_IR"
922   Call StrPoint
923   ${if} $Pointer != "-1"
924    IntOp $0 ${SF_SELECTED} | ${SF_RO}
925    SectionSetFlags ${SecDGaelic} $0
926    SectionSetSize ${SecDGaelic} 0
927   ${endif}
928   StrCpy $Search "gd_GB"
929   Call StrPoint
930   ${if} $Pointer != "-1"
931    IntOp $0 ${SF_SELECTED} | ${SF_RO}
932    SectionSetFlags ${SecDScottish} $0
933    SectionSetSize ${SecDScottish} 0
934   ${endif}
935   StrCpy $Search "gl_ES"
936   Call StrPoint
937   ${if} $Pointer != "-1"
938    IntOp $0 ${SF_SELECTED} | ${SF_RO}
939    SectionSetFlags ${SecDGalician} $0
940    SectionSetSize ${SecDGalician} 0
941   ${endif}
942   StrCpy $Search "he_IL"
943   Call StrPoint
944   ${if} $Pointer != "-1"
945    IntOp $0 ${SF_SELECTED} | ${SF_RO}
946    SectionSetFlags ${SecDHebrew} $0
947    SectionSetSize ${SecDHebrew} 0
948   ${endif}
949   StrCpy $Search "hi_IN"
950   Call StrPoint
951   ${if} $Pointer != "-1"
952    IntOp $0 ${SF_SELECTED} | ${SF_RO}
953    SectionSetFlags ${SecDHindi} $0
954    SectionSetSize ${SecDHindi} 0
955   ${endif}
956   StrCpy $Search "hr_HR"
957   Call StrPoint
958   ${if} $Pointer != "-1"
959    IntOp $0 ${SF_SELECTED} | ${SF_RO}
960    SectionSetFlags ${SecDCroatian} $0
961    SectionSetSize ${SecDCroatian} 0
962   ${endif}
963   StrCpy $Search "hu_HU"
964   Call StrPoint
965   ${if} $Pointer != "-1"
966    IntOp $0 ${SF_SELECTED} | ${SF_RO}
967    SectionSetFlags ${SecDHungarian} $0
968    SectionSetSize ${SecDHungarian} 0
969   ${endif}
970   StrCpy $Search "ia_IA"
971   Call StrPoint
972   ${if} $Pointer != "-1"
973    IntOp $0 ${SF_SELECTED} | ${SF_RO}
974    SectionSetFlags ${SecDInterlingua} $0
975    SectionSetSize ${SecDInterlingua} 0
976   ${endif}
977   StrCpy $Search "is_IS"
978   Call StrPoint
979   ${if} $Pointer != "-1"
980    IntOp $0 ${SF_SELECTED} | ${SF_RO}
981    SectionSetFlags ${SecDIcelandic} $0
982    SectionSetSize ${SecDIcelandic} 0
983   ${endif}
984   StrCpy $Search "it_IT"
985   Call StrPoint
986   ${if} $Pointer != "-1"
987    IntOp $0 ${SF_SELECTED} | ${SF_RO}
988    SectionSetFlags ${SecDItalian} $0
989    SectionSetSize ${SecDItalian} 0
990   ${endif}
991   StrCpy $Search "kk_KZ"
992   Call StrPoint
993   ${if} $Pointer != "-1"
994    IntOp $0 ${SF_SELECTED} | ${SF_RO}
995    SectionSetFlags ${SecDKazakh} $0
996    SectionSetSize ${SecDKazakh} 0
997   ${endif}
998   StrCpy $Search "ko_KR"
999   Call StrPoint
1000   ${if} $Pointer != "-1"
1001    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1002    SectionSetFlags ${SecDKorean} $0
1003    SectionSetSize ${SecDKorean} 0
1004   ${endif}
1005   StrCpy $Search "la_LA"
1006   Call StrPoint
1007   ${if} $Pointer != "-1"
1008    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1009    SectionSetFlags ${SecDLatin} $0
1010    SectionSetSize ${SecDLatin} 0
1011   ${endif}
1012   StrCpy $Search "lt_LT"
1013   Call StrPoint
1014   ${if} $Pointer != "-1"
1015    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1016    SectionSetFlags ${SecDLithuanian} $0
1017    SectionSetSize ${SecDLithuanian} 0
1018   ${endif}
1019   StrCpy $Search "lv_LV"
1020   Call StrPoint
1021   ${if} $Pointer != "-1"
1022    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1023    SectionSetFlags ${SecDLatvian} $0
1024    SectionSetSize ${SecDLatvian} 0
1025   ${endif}
1026   StrCpy $Search "mr_IN"
1027   Call StrPoint
1028   ${if} $Pointer != "-1"
1029    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1030    SectionSetFlags ${SecDMarathi} $0
1031    SectionSetSize ${SecDMarathi} 0
1032   ${endif}
1033   StrCpy $Search "nl_NL"
1034   Call StrPoint
1035   ${if} $Pointer != "-1"
1036    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1037    SectionSetFlags ${SecDDutch} $0
1038    SectionSetSize ${SecDDutch} 0
1039   ${endif}
1040   StrCpy $Search "nb_NO"
1041   Call StrPoint
1042   ${if} $Pointer != "-1"
1043    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1044    SectionSetFlags ${SecDNorwegianNB} $0
1045    SectionSetSize ${SecDNorwegianNB} 0
1046   ${endif}
1047   StrCpy $Search "nn_NO"
1048   Call StrPoint
1049   ${if} $Pointer != "-1"
1050    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1051    SectionSetFlags ${SecDNorwegianNN} $0
1052    SectionSetSize ${SecDNorwegianNN} 0
1053   ${endif}
1054   StrCpy $Search "oc_FR"
1055   Call StrPoint
1056   ${if} $Pointer != "-1"
1057    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1058    SectionSetFlags ${SecDOccitan} $0
1059    SectionSetSize ${SecDOccitan} 0
1060   ${endif}
1061   StrCpy $Search "pl_PL"
1062   Call StrPoint
1063   ${if} $Pointer != "-1"
1064    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1065    SectionSetFlags ${SecDPolish} $0
1066    SectionSetSize ${SecDPolish} 0
1067   ${endif}
1068   StrCpy $Search "pt_BR"
1069   Call StrPoint
1070   ${if} $Pointer != "-1"
1071    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1072    SectionSetFlags ${SecDPortugueseBR} $0
1073    SectionSetSize ${SecDPortugueseBR} 0
1074   ${endif}
1075   StrCpy $Search "pt_PT"
1076   Call StrPoint
1077   ${if} $Pointer != "-1"
1078    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1079    SectionSetFlags ${SecDPortuguesePT} $0
1080    SectionSetSize ${SecDPortuguesePT} 0
1081   ${endif}
1082   StrCpy $Search "ro_RO"
1083   Call StrPoint
1084   ${if} $Pointer != "-1"
1085    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1086    SectionSetFlags ${SecDRomanian} $0
1087    SectionSetSize ${SecDRomanian} 0
1088   ${endif}
1089   StrCpy $Search "ru_RU"
1090   Call StrPoint
1091   ${if} $Pointer != "-1"
1092    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1093    SectionSetFlags ${SecDRussian} $0
1094    SectionSetSize ${SecDRussian} 0
1095   ${endif}
1096   StrCpy $Search "dsb_DE"
1097   Call StrPoint
1098   ${if} $Pointer != "-1"
1099    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1100    SectionSetFlags ${SecDSorbianD} $0
1101    SectionSetSize ${SecDSorbianD} 0
1102   ${endif}
1103   StrCpy $Search "hsb_DE"
1104   Call StrPoint
1105   ${if} $Pointer != "-1"
1106    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1107    SectionSetFlags ${SecDSorbianH} $0
1108    SectionSetSize ${SecDSorbianH} 0
1109   ${endif}
1110   StrCpy $Search "sq_AL"
1111   Call StrPoint
1112   ${if} $Pointer != "-1"
1113    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1114    SectionSetFlags ${SecDAlbanian} $0
1115    SectionSetSize ${SecDAlbanian} 0
1116   ${endif}
1117   StrCpy $Search "sl_SI"
1118   Call StrPoint
1119   ${if} $Pointer != "-1"
1120    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1121    SectionSetFlags ${SecDSlovenian} $0
1122    SectionSetSize ${SecDSlovenian} 0
1123   ${endif}
1124   StrCpy $Search "sk_SK"
1125   Call StrPoint
1126   ${if} $Pointer != "-1"
1127    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1128    SectionSetFlags ${SecDSlovakian} $0
1129    SectionSetSize ${SecDSlovakian} 0
1130   ${endif}
1131   StrCpy $Search "sr_RS"
1132   Call StrPoint
1133   ${if} $Pointer != "-1"
1134    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1135    SectionSetFlags ${SecDSerbianC} $0
1136    SectionSetSize ${SecDSerbianC} 0
1137   ${endif}
1138   StrCpy $Search "sr_RS-Latin"
1139   Call StrPoint
1140   ${if} $Pointer != "-1"
1141    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1142    SectionSetFlags ${SecDSerbianL} $0
1143    SectionSetSize ${SecDSerbianL} 0
1144   ${endif}
1145   StrCpy $Search "sv_SE"
1146   Call StrPoint
1147   ${if} $Pointer != "-1"
1148    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1149    SectionSetFlags ${SecDSwedish} $0
1150    SectionSetSize ${SecDSwedish} 0
1151   ${endif}
1152   StrCpy $Search "ta_IN"
1153   Call StrPoint
1154   ${if} $Pointer != "-1"
1155    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1156    SectionSetFlags ${SecDTamil} $0
1157    SectionSetSize ${SecDTamil} 0
1158   ${endif}
1159   StrCpy $Search "te_IN"
1160   Call StrPoint
1161   ${if} $Pointer != "-1"
1162    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1163    SectionSetFlags ${SecDTelugu} $0
1164    SectionSetSize ${SecDTelugu} 0
1165   ${endif}
1166   StrCpy $Search "th_TH"
1167   Call StrPoint
1168   ${if} $Pointer != "-1"
1169    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1170    SectionSetFlags ${SecDThai} $0
1171    SectionSetSize ${SecDThai} 0
1172   ${endif}
1173   StrCpy $Search "tk_TM"
1174   Call StrPoint
1175   ${if} $Pointer != "-1"
1176    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1177    SectionSetFlags ${SecDTurkmen} $0
1178    SectionSetSize ${SecDTurkmen} 0
1179   ${endif}
1180   StrCpy $Search "tr_TR"
1181   Call StrPoint
1182   ${if} $Pointer != "-1"
1183    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1184    SectionSetFlags ${SecDTurkish} $0
1185    SectionSetSize ${SecDTurkish} 0
1186   ${endif}
1187   StrCpy $Search "uk_UA"
1188   Call StrPoint
1189   ${if} $Pointer != "-1"
1190    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1191    SectionSetFlags ${SecDUkrainian} $0
1192    SectionSetSize ${SecDUkrainian} 0
1193   ${endif}
1194   StrCpy $Search "ur_PK"
1195   Call StrPoint
1196   ${if} $Pointer != "-1"
1197    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1198    SectionSetFlags ${SecDUrdu} $0
1199    SectionSetSize ${SecDUrdu} 0
1200   ${endif}
1201   StrCpy $Search "vi_VN"
1202   Call StrPoint
1203   ${if} $Pointer != "-1"
1204    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1205    SectionSetFlags ${SecDVietnamese} $0
1206    SectionSetSize ${SecDVietnamese} 0
1207   ${endif}
1208   
1209   # select sections of already installed thesaurus dictionaries, make them read-only
1210   # and set the necessary size to 0 bytes
1211   StrCpy $String $FoundThes
1212   StrCpy $Search "bg_BG"
1213   Call StrPoint # function from LyXUtils.nsh
1214   ${if} $Pointer != "-1"
1215    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1216    SectionSetFlags ${SecTBulgarian} $0
1217    SectionSetSize ${SecTBulgarian} 0
1218   ${endif}
1219   StrCpy $Search "ca_ES"
1220   Call StrPoint
1221   ${if} $Pointer != "-1"
1222    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1223    SectionSetFlags ${SecTCatalan} $0
1224    SectionSetSize ${SecTCatalan} 0
1225   ${endif}
1226   StrCpy $Search "cs_CZ"
1227   Call StrPoint
1228   ${if} $Pointer != "-1"
1229    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1230    SectionSetFlags ${SecTCzech} $0
1231    SectionSetSize ${SecTCzech} 0
1232   ${endif}
1233   StrCpy $Search "da_DK"
1234   Call StrPoint
1235   ${if} $Pointer != "-1"
1236    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1237    SectionSetFlags ${SecTDanish} $0
1238    SectionSetSize ${SecTDanish} 0
1239   ${endif}
1240   StrCpy $Search "de_DE"
1241   Call StrPoint
1242   ${if} $Pointer != "-1"
1243    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1244    SectionSetFlags ${SecTGermanDA} $0
1245    SectionSetSize ${SecTGermanDA} 0
1246   ${endif} 
1247   StrCpy $Search "de_CH"
1248   Call StrPoint
1249   ${if} $Pointer != "-1"
1250    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1251    SectionSetFlags ${SecTGermanCH} $0
1252    SectionSetSize ${SecTGermanCH} 0
1253   ${endif}
1254   StrCpy $Search "en_GB"
1255   Call StrPoint
1256   ${if} $Pointer != "-1"
1257    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1258    SectionSetFlags ${SecTEnglishGB} $0
1259    SectionSetSize ${SecTEnglishGB} 0
1260   ${endif} 
1261   StrCpy $Search "en_US"
1262   Call StrPoint
1263   ${if} $Pointer != "-1"
1264    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1265    SectionSetFlags ${SecTEnglishUSAU} $0
1266    SectionSetSize ${SecTEnglishUSAU} 0
1267   ${endif}
1268   StrCpy $Search "es_ES"
1269   Call StrPoint
1270   ${if} $Pointer != "-1"
1271    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1272    SectionSetFlags ${SecTSpanish} $0
1273    SectionSetSize ${SecTSpanish} 0
1274   ${endif}
1275   StrCpy $Search "fr_FR"
1276   Call StrPoint
1277   ${if} $Pointer != "-1"
1278    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1279    SectionSetFlags ${SecTFrench} $0
1280    SectionSetSize ${SecTFrench} 0
1281   ${endif}
1282   StrCpy $Search "ga_IR"
1283   Call StrPoint
1284   ${if} $Pointer != "-1"
1285    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1286    SectionSetFlags ${SecTGaelic} $0
1287    SectionSetSize ${SecTGaelic} 0
1288   ${endif}
1289   StrCpy $Search "gl_ES"
1290   Call StrPoint
1291   ${if} $Pointer != "-1"
1292    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1293    SectionSetFlags ${SecTGalician} $0
1294    SectionSetSize ${SecTGalician} 0
1295   ${endif}
1296   StrCpy $Search "el_GR"
1297   Call StrPoint
1298   ${if} $Pointer != "-1"
1299    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1300    SectionSetFlags ${SecTGreek} $0
1301    SectionSetSize ${SecTGreek} 0
1302   ${endif}
1303   StrCpy $Search "is_IS"
1304   Call StrPoint
1305   ${if} $Pointer != "-1"
1306    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1307    SectionSetFlags ${SecTIcelandic} $0
1308    SectionSetSize ${SecTIcelandic} 0
1309   ${endif}
1310   StrCpy $Search "it_IT"
1311   Call StrPoint
1312   ${if} $Pointer != "-1"
1313    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1314    SectionSetFlags ${SecTItalian} $0
1315    SectionSetSize ${SecTItalian} 0
1316   ${endif}
1317   StrCpy $Search "hu_HU"
1318   Call StrPoint
1319   ${if} $Pointer != "-1"
1320    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1321    SectionSetFlags ${SecTHungarian} $0
1322    SectionSetSize ${SecTHungarian} 0
1323   ${endif}
1324   StrCpy $Search "nb_NO"
1325   Call StrPoint
1326   ${if} $Pointer != "-1"
1327    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1328    SectionSetFlags ${SecTNorwegianNB} $0
1329    SectionSetSize ${SecTNorwegianNB} 0
1330   ${endif}
1331   StrCpy $Search "pl_PL"
1332   Call StrPoint
1333   ${if} $Pointer != "-1"
1334    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1335    SectionSetFlags ${SecTPolish} $0
1336    SectionSetSize ${SecTPolish} 0
1337   ${endif}
1338   StrCpy $Search "pt_PT"
1339   Call StrPoint
1340   ${if} $Pointer != "-1"
1341    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1342    SectionSetFlags ${SecTPortuguese} $0
1343    SectionSetSize ${SecTPortuguese} 0
1344   ${endif}
1345   StrCpy $Search "ro_RO"
1346   Call StrPoint
1347   ${if} $Pointer != "-1"
1348    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1349    SectionSetFlags ${SecTRomanian} $0
1350    SectionSetSize ${SecTRomanian} 0
1351   ${endif}
1352   StrCpy $Search "ru_RU"
1353   Call StrPoint
1354   ${if} $Pointer != "-1"
1355    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1356    SectionSetFlags ${SecTRussian} $0
1357    SectionSetSize ${SecTRussian} 0
1358   ${endif}
1359   StrCpy $Search "sl_SI"
1360   Call StrPoint
1361   ${if} $Pointer != "-1"
1362    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1363    SectionSetFlags ${SecTSlovenian} $0
1364    SectionSetSize ${SecTSlovenian} 0
1365   ${endif}
1366   StrCpy $Search "sk_SK"
1367   Call StrPoint
1368   ${if} $Pointer != "-1"
1369    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1370    SectionSetFlags ${SecTSlovakian} $0
1371    SectionSetSize ${SecTSlovakian} 0
1372   ${endif}
1373   StrCpy $Search "sv_SE"
1374   Call StrPoint
1375   ${if} $Pointer != "-1"
1376    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1377    SectionSetFlags ${SecTSwedish} $0
1378    SectionSetSize ${SecTSwedish} 0
1379   ${endif}
1380   StrCpy $Search "uk_UA"
1381   Call StrPoint
1382   ${if} $Pointer != "-1"
1383    IntOp $0 ${SF_SELECTED} | ${SF_RO}
1384    SectionSetFlags ${SecTUkrainian} $0
1385    SectionSetSize ${SecTUkrainian} 0
1386   ${endif}
1387   
1388   ${IfNot} ${Silent}
1389     Banner::destroy
1390   ${EndIf}
1391
1392 FunctionEnd
1393
1394 # this function is called at first after starting the uninstaller
1395 Function un.onInit
1396
1397   !insertmacro MULTIUSER_UNINIT
1398
1399   # Check that LyX is not currently running
1400   FindProcDLL::FindProc "lyx.exe"
1401   ${if} $R0 == "1"
1402    MessageBox MB_OK|MB_ICONSTOP "$(UnInstallRunning)" /SD IDOK
1403    Abort
1404   ${endif}
1405
1406   # set registry root key
1407   ${if} $MultiUser.Privileges == "Admin"
1408   ${orif} $MultiUser.Privileges == "Power"
1409     SetShellVarContext all
1410   ${else}
1411    SetShellVarContext current
1412   ${endif}
1413
1414   # Ascertain whether the user has sufficient privileges to uninstall.
1415   # abort when LyX was installed with admin permissions but the user doesn't have administrator privileges
1416   ReadRegStr $0 HKLM "${APP_UNINST_KEY}" "DisplayVersion"
1417   ${if} $0 != ""
1418   ${andif} $MultiUser.Privileges != "Admin"
1419   ${andif} $MultiUser.Privileges != "Power"
1420    MessageBox MB_OK|MB_ICONSTOP "$(UnNotAdminLabel)" /SD IDOK
1421    Abort
1422   ${endif}
1423   # warning when LyX couldn't be found in the registry
1424   ${if} $0 == "" # check in HKCU
1425    ReadRegStr $0 HKCU "${APP_UNINST_KEY}" "DisplayVersion"
1426    ${if} $0 == ""
1427      MessageBox MB_OK|MB_ICONEXCLAMATION "$(UnNotInRegistryLabel)" /SD IDOK
1428    ${endif}
1429   ${endif}
1430   
1431   # Macro to investigate name of LyX's preferences folders to be able remove them
1432   !insertmacro UnAppPreSuff $AppPre $AppSuff # macro from LyXUtils.nsh
1433
1434   # test if MiKTeX was installed together with LyX
1435   ReadRegStr $0 SHCTX "SOFTWARE\MiKTeX.org\MiKTeX" "OnlyWithLyX"
1436   ${if} $0 == "Yes${APP_SERIES_KEY}"
1437    SectionSetText 2 "MiKTeX" # names the corersponding uninstaller section
1438    StrCpy $LaTeXInstalled "MiKTeX"
1439   ${else}
1440    SectionSetText 2 "" # hides the corresponding uninstaller section
1441   ${endif}
1442   
1443   # test if JabRef was installed together with LyX
1444   ReadRegStr $0 SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef" "OnlyWithLyX"
1445   ${if} $0 == "Yes${APP_SERIES_KEY}"
1446    SectionSetText 3 "JabRef" # names the corersponding uninstaller section
1447    StrCpy $JabRefInstalled "Yes"
1448   ${else}
1449    SectionSetText 3 "" # hides the corresponding uninstaller section
1450   ${endif}
1451
1452   # question message if the user really wants to uninstall LyX
1453   MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "$(UnReallyRemoveLabel)" /SD IDYES IDYES +2 # continue if yes
1454   Abort
1455
1456 FunctionEnd
1457