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