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