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