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