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