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