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