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