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