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