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