]> git.lyx.org Git - features.git/blob - development/Win32/packaging/installer/include/init.nsh
installer: bugfixes, code simplification and documentation
[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 Section "$(SecFileAssocTitle)" SecFileAssoc
51   StrCpy $CreateFileAssociations "true"
52 SectionEnd
53 Section "$(SecDesktopTitle)" SecDesktop
54   StrCpy $CreateDesktopIcon "true"
55 SectionEnd
56
57 !if ${SETUPTYPE} == BUNDLE
58  Section /o "$(SecInstJabRefTitle)" SecInstJabRef
59   AddSize 12400
60   StrCpy $InstallJabRef "true"
61  SectionEnd
62 !endif
63
64 SectionGroup "Dictionaries" SecDictionaries
65
66 Section /o "Afrikaans" SecDAfrikaans
67  StrCpy $DictCodes "af_ZA,$DictCodes"
68  AddSize 1440
69 SectionEnd
70
71 Section /o "Arabic" SecDArabic
72  StrCpy $DictCodes "ar_DZ,$DictCodes"
73  AddSize 2500
74 SectionEnd
75
76 Section /o "Armenian" SecDArmenian
77  StrCpy $DictCodes "hy_AM,$DictCodes"
78  AddSize 2000
79 SectionEnd
80
81 Section /o "Bahasa Indonesia" SecDIndonesian
82  StrCpy $DictCodes "id_ID,$DictCodes"
83  AddSize 217
84 SectionEnd
85
86 Section /o "Bahasa Melayu" SecDMalayan
87  StrCpy $DictCodes "ms_MY,$DictCodes"
88  AddSize 227
89 SectionEnd
90
91 Section /o "Belarusian" SecDBelarusian 
92  StrCpy $DictCodes "be_BY,$DictCodes"
93  AddSize 1730
94 SectionEnd
95
96 Section /o "Brezhoneg" SecDBreton 
97  StrCpy $DictCodes "br_FR,$DictCodes"
98  AddSize 11000
99 SectionEnd
100
101 Section /o "Bulgarian" SecDBulgarian
102  StrCpy $DictCodes "bg_BG,$DictCodes"
103  AddSize 985
104 SectionEnd
105
106 Section /o "Català" SecDCatalanian
107  StrCpy $DictCodes "ca_ES,$DictCodes"
108  AddSize 1210
109 SectionEnd
110
111 Section /o "Ce\9atina" SecDCzech
112  StrCpy $DictCodes "cs_CZ,$DictCodes"
113  AddSize 2190
114 SectionEnd
115
116 # enable this for LyX 2.1!
117 #Section /o "Coptic" SecDCoptic
118 # StrCpy $DictCodes "cop_EG,$DictCodes"
119 # AddSize 151
120 #SectionEnd
121
122 Section /o "Cymraeg" SecDWelsh 
123  StrCpy $DictCodes "cy_GB,$DictCodes"
124  AddSize 1540
125 SectionEnd
126
127 Section /o "Dansk" SecDDanish
128  StrCpy $DictCodes "da_DK,$DictCodes"
129  AddSize 2470
130 SectionEnd
131
132 Section /o "German (A)" SecDGermanAT
133  StrCpy $DictCodes "de_AT,$DictCodes"
134  AddSize 3620
135 SectionEnd
136
137 Section /o "German (CH)" SecDGermanCH
138  StrCpy $DictCodes "de_CH,$DictCodes"
139  AddSize 3620
140 SectionEnd
141
142 Section "German (D)" SecDGermanD
143  # already installed by default
144  SectionIn RO
145  #StrCpy $DictCodes "de_DE,$DictCodes"
146  AddSize 3620
147 SectionEnd
148
149 Section /o "Greek" SecDGreek
150  StrCpy $DictCodes "el_GR,$DictCodes"
151  AddSize 6550
152 SectionEnd
153
154 Section /o "Eesti" SecDEstonian
155  StrCpy $DictCodes "et_EE,$DictCodes"
156  AddSize 4400
157 SectionEnd
158
159 # enable this for LyX 2.1!
160 #Section /o "English (AU)" SecDEnglishAU
161 # StrCpy $DictCodes "en_AU,$DictCodes"
162 # AddSize 587
163 #SectionEnd
164
165 Section /o "English (CA)" SecDEnglishCA
166  StrCpy $DictCodes "en_CA,$DictCodes"
167  AddSize 690
168 SectionEnd
169
170 Section "English (GB)" SecDEnglishGB
171  # already installed by default
172  SectionIn RO
173  #StrCpy $DictCodes "en_GB,$DictCodes"
174  AddSize 757
175 SectionEnd
176
177 # enable this for LyX 2.1!
178 #Section /o "English (NZ)" SecDEnglishNZ
179 # StrCpy $DictCodes "en_NZ,$DictCodes"
180 # AddSize 551
181 #SectionEnd
182
183 Section "English (US)" SecDEnglishUS
184  # already installed by default
185  SectionIn RO
186  #StrCpy $DictCodes "en_US,$DictCodes"
187  AddSize 688
188 SectionEnd
189
190 Section "Español (ES)" SecDSpanishES
191  # already installed by default
192  SectionIn RO
193  #StrCpy $DictCodes "es_ES,$DictCodes"
194  AddSize 974
195 SectionEnd
196
197 Section "Español (MX)" SecDSpanishMX
198  # already installed by default
199  SectionIn RO
200  #StrCpy $DictCodes "es_MX,$DictCodes"
201  AddSize 924
202 SectionEnd
203
204 Section /o "Esperanto" SecDEsperanto
205  StrCpy $DictCodes "eo_EO,$DictCodes"
206  AddSize 389
207 SectionEnd
208
209 Section /o "Euskara" SecDBasque
210  StrCpy $DictCodes "eu_ES,$DictCodes"
211  AddSize 4850
212 SectionEnd
213
214 Section /o "Farsi" SecDFarsi
215  StrCpy $DictCodes "fa_IR,$DictCodes"
216  AddSize 6710
217 SectionEnd
218
219 Section "Français" SecDFrench
220  # already installed by default
221  SectionIn RO
222  #StrCpy $DictCodes "fr_FR,$DictCodes"
223  AddSize 1200
224 SectionEnd
225
226 Section /o "Gaeilge" SecDGaelic
227  StrCpy $DictCodes "ga_IR,$DictCodes"
228  AddSize 1090
229 SectionEnd
230
231 Section /o "Gàidhlig" SecDScottish
232  StrCpy $DictCodes "gd_GB,$DictCodes"
233  AddSize 2460
234 SectionEnd
235
236 Section /o "Galego" SecDGalician
237  StrCpy $DictCodes "gl_ES,$DictCodes"
238  AddSize 916
239 SectionEnd
240
241 Section /o "Hebrew" SecDHebrew
242  StrCpy $DictCodes "he_IL,$DictCodes"
243  AddSize 3120
244 SectionEnd
245
246 Section /o "Hrvatski" SecDCroatian
247  StrCpy $DictCodes "hr_HR,$DictCodes"
248  AddSize 2240
249 SectionEnd
250
251 Section /o "Magyar" SecDHungarian
252  StrCpy $DictCodes "hu_HU,$DictCodes"
253  AddSize 3380
254 SectionEnd
255
256 # enable this for LyX 2.1!
257 #Section /o "Hindi" SecDHindi
258 # StrCpy $DictCodes "hi_IN,$DictCodes"
259 # AddSize 1900
260 #SectionEnd
261
262 Section /o "Interlingua" SecDInterlingua
263  StrCpy $DictCodes "ia_IA,$DictCodes"
264  AddSize 649
265 SectionEnd
266
267 Section /o "Íslenska" SecDIcelandic
268  StrCpy $DictCodes "is_IS,$DictCodes"
269  AddSize 2320
270 SectionEnd
271
272 Section /o "Italiano" SecDItalian
273  StrCpy $DictCodes "it_IT,$DictCodes"
274  AddSize 1300
275 SectionEnd
276
277 Section /o "Kazakh" SecDKazakh
278  StrCpy $DictCodes "kk_KZ,$DictCodes"
279  AddSize 2120
280 SectionEnd
281
282 Section /o "Korean" SecDKorean
283  StrCpy $DictCodes "ko_KR,$DictCodes"
284  AddSize 15200
285 SectionEnd
286
287 Section /o "Latina" SecDLatin
288  StrCpy $DictCodes "la_LA,$DictCodes"
289  AddSize 1250
290 SectionEnd
291
292 Section /o "Lietuviu" SecDLithuanian
293  StrCpy $DictCodes "lt_LT,$DictCodes"
294  AddSize 1320
295 SectionEnd
296
297 Section /o "Latvie\9au" SecDLatvian
298  StrCpy $DictCodes "lv_LV,$DictCodes"
299  AddSize 2140
300 SectionEnd
301
302 Section /o "Nederlands" SecDDutch
303  StrCpy $DictCodes "nl_NL,$DictCodes"
304  AddSize 1820
305 SectionEnd
306
307 Section /o "Norsk (Bokmål)" SecDNorwegianNB
308  StrCpy $DictCodes "nb_NO,$DictCodes"
309  AddSize 4890
310 SectionEnd
311
312 Section /o "Norsk (Nynorsk)" SecDNorwegianNN
313  StrCpy $DictCodes "nn_NO,$DictCodes"
314  AddSize 2890
315 SectionEnd
316
317 # enable this for LyX 2.1!
318 #Section /o "Occitan" SecDOccitan
319 # StrCpy $DictCodes "oc_FR,$DictCodes"
320 # AddSize 31710
321 #SectionEnd
322
323 Section /o "Polski" SecDPolish
324  StrCpy $DictCodes "pl_PL,$DictCodes"
325  AddSize 4540
326 SectionEnd
327
328 Section /o "Português (BR)" SecDPortugueseBR
329  StrCpy $DictCodes "pt_BR,$DictCodes"
330  AddSize 5280
331 SectionEnd
332
333 Section /o "Português (PT)" SecDPortuguesePT
334  StrCpy $DictCodes "pt_PT,$DictCodes"
335  AddSize 1460
336 SectionEnd
337
338 Section /o "Româna" SecDRomanian
339  StrCpy $DictCodes "ro_RO,$DictCodes"
340  AddSize 1930
341 SectionEnd
342
343 Section /o "Russian" SecDRussian
344  StrCpy $DictCodes "ru_RU,$DictCodes"
345  AddSize 1920
346 SectionEnd
347
348 Section /o "Serb\9acina (Dolno)" SecDSorbianD
349  StrCpy $DictCodes "dsb_DE,$DictCodes"
350  AddSize 904
351 SectionEnd
352
353 Section /o "Serb\9acina (Horno)" SecDSorbianH
354  StrCpy $DictCodes "hsb_DE,$DictCodes"
355  AddSize 740
356 SectionEnd
357
358 Section /o "Shqipe" SecDAlbanian
359  StrCpy $DictCodes "sq_AL,$DictCodes"
360  AddSize 2400
361 SectionEnd
362
363 Section /o "Sloven\9acina" SecDSlowenian
364  StrCpy $DictCodes "sl_SI,$DictCodes"
365  AddSize 2840
366 SectionEnd
367
368 Section /o "Slovenský" SecDSlowakian
369  StrCpy $DictCodes "sk_SK$ThesCodes"
370  AddSize 4090
371 SectionEnd
372
373 Section /o "Srpski" SecDSerbian
374  StrCpy $DictCodes "sr_RS,$DictCodes"
375  AddSize 3460
376 SectionEnd
377
378 Section /o "Svenska" SecDSwedish
379  StrCpy $DictCodes "sv_SE,$DictCodes"
380  AddSize 1030
381 SectionEnd
382
383 # enable this for LyX 2.1!
384 #Section /o "Tamil" SecDTamil
385 # StrCpy $DictCodes "ta_IN,$DictCodes"
386 # AddSize 5911
387 #SectionEnd
388
389 # enable this for LyX 2.1!
390 #Section /o "Telugu" SecDTelugu
391 # StrCpy $DictCodes "te_IN,$DictCodes"
392 # AddSize 3400
393 #SectionEnd
394  
395 Section /o "Thai" SecDThai
396  StrCpy $DictCodes "th_TH,$DictCodes"
397  AddSize 351
398 SectionEnd
399
400 Section /o "Ukrainian" SecDUkrainian
401  StrCpy $DictCodes "uk_UA,$DictCodes"
402  AddSize 2620
403 SectionEnd
404
405 # enable this for LyX 2.1!
406 #Section /o "Urdu" SecDUrdu
407 # StrCpy $DictCodes "ur_PK,$DictCodes"
408 # AddSize 1401
409 #SectionEnd
410
411 Section /o "Vietnamese" SecDVietnamese
412  StrCpy $DictCodes "vi_VN,$DictCodes"
413  AddSize 40
414 SectionEnd
415
416 SectionGroupEnd
417
418
419 SectionGroup "Thesaurus" SecThesaurus
420
421 Section /o "Bulgarian" SecTBulgarian
422  StrCpy $ThesCodes "bg_BG$ThesCodes"
423  AddSize 3020
424 SectionEnd
425
426 Section /o "Català" SecTCatalan
427  StrCpy $ThesCodes "ca_ES$ThesCodes"
428  AddSize 731
429 SectionEnd
430
431 Section /o "Ce\9atina" SecTCzech
432  StrCpy $ThesCodes "cs_CZ$ThesCodes"
433  AddSize 635
434 SectionEnd
435
436 Section /o "Dansk" SecTDanish
437  StrCpy $ThesCodes "da_DK$ThesCodes"
438  AddSize 2360
439 SectionEnd
440
441 Section /o "Deutsch (D/A)" SecTGermanDA
442  StrCpy $ThesCodes "de_DE$ThesCodes"
443  AddSize 5360
444 SectionEnd
445
446 Section /o "Deutsch (CH)" SecTGermanCH
447  StrCpy $ThesCodes "de_CH$ThesCodes"
448  AddSize 5360
449 SectionEnd
450
451 Section /o "English (GB)" SecTEnglishGB
452  StrCpy $ThesCodes "en_GB$ThesCodes"
453  AddSize 20600
454 SectionEnd
455
456 Section /o "English (US/AU)" SecTEnglishUSAU
457  StrCpy $ThesCodes "en_US$ThesCodes"
458  AddSize 20600
459 SectionEnd
460
461 Section /o "Español" SecTSpanish
462  StrCpy $ThesCodes "es_ES$ThesCodes"
463  AddSize 2860
464 SectionEnd
465
466 Section /o "Français" SecTFrench
467  StrCpy $ThesCodes "fr_FR$ThesCodes"
468  AddSize 5060
469 SectionEnd
470
471 Section /o "Gaeilge" SecTGaelic
472  StrCpy $ThesCodes "ga_IR$ThesCodes"
473  AddSize 30600
474 SectionEnd
475
476 Section /o "Greek" SecTGreek
477  StrCpy $ThesCodes "el_GR$ThesCodes"
478  AddSize 903
479 SectionEnd
480
481 Section /o "Italiano" SecTItalian
482  StrCpy $ThesCodes "it_IT$ThesCodes"
483  AddSize 2640
484 SectionEnd
485
486 Section /o "Magyar" SecTHungarian
487  StrCpy $ThesCodes "hu_HU$ThesCodes"
488  AddSize 632
489 SectionEnd
490
491 Section /o "Norsk" SecTNorwegian
492  StrCpy $ThesCodes "no_NO$ThesCodes"
493  AddSize 2470
494 SectionEnd
495
496 Section /o "Polski" SecTPolish
497  StrCpy $ThesCodes "pl_PL$ThesCodes"
498  AddSize 5580
499 SectionEnd
500
501 Section /o "Português" SecTPortuguese
502  StrCpy $ThesCodes "pt_PT$ThesCodes"
503  AddSize 855
504 SectionEnd
505
506 Section /o "Româna" SecTRomanian
507  StrCpy $ThesCodes "ro_RO$ThesCodes"
508  AddSize 3640
509 SectionEnd
510
511 Section /o "Russian" SecTRussian
512  StrCpy $ThesCodes "ru_RU$ThesCodes"
513  AddSize 2080
514 SectionEnd
515
516 Section /o "Sloven\9acina" SecTSlowenian
517  StrCpy $ThesCodes "sl_SI$ThesCodes"
518  AddSize 107
519 SectionEnd
520
521 Section /o "Slovenský" SecTSlowakian
522  StrCpy $ThesCodes "sk_SK$ThesCodes"
523  AddSize 907
524 SectionEnd
525
526 Section /o "Svenska" SecTSwedish
527  StrCpy $ThesCodes "sv_SE$ThesCodes"
528  AddSize 720
529 SectionEnd
530
531 SectionGroupEnd
532
533 # Section descriptions
534 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
535 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(SecCoreDescription)"
536 !insertmacro MUI_DESCRIPTION_TEXT ${SecFileAssoc} "$(SecFileAssocDescription)"
537 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(SecDesktopDescription)"
538 !if ${SETUPTYPE} == BUNDLE
539  !insertmacro MUI_DESCRIPTION_TEXT ${SecInstJabRef} "$(SecInstJabRefDescription)"
540 !endif
541 !insertmacro MUI_DESCRIPTION_TEXT ${SecDictionaries} "$(SecDictionariesDescription)"
542 !insertmacro MUI_DESCRIPTION_TEXT ${SecThesaurus} "$(SecThesaurusDescription)"
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   # warning 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   ${else}
1333    SectionSetText 2 "" # hides the corresponding uninstaller section
1334   ${endif}
1335   
1336   # test if JabRef was installed together with LyX
1337   ReadRegStr $0 SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\JabRef ${JabRefVersion}" "OnlyWithLyX"
1338   ${if} $0 == "Yes${APP_SERIES_KEY}"
1339    SectionSetText 3 "JabRef" # names the corersponding uninstaller section
1340    StrCpy $JabRefInstalled "Yes"
1341   ${else}
1342    SectionSetText 3 "" # hides the corresponding uninstaller section
1343   ${endif}
1344
1345   # question message if the user really wants to uninstall LyX
1346   MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "$(UnReallyRemoveLabel)" IDYES +2 # continue if yes
1347   Abort
1348
1349 FunctionEnd
1350