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