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