7e5b765dbbafcbb0975c7ec2e85e53d05bf34d45
1 ; #######################################
2 ; Inkscape NSIS installer project file
3 ; Used as of 0.40
4 ; #######################################
6 ; #######################################
7 ; DEFINES
8 ; #######################################
9 !define PRODUCT_NAME "Inkscape"
10 !define PRODUCT_VERSION "0.47"
11 !define PRODUCT_REVISION 1
12 !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inkscape.exe"
13 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
14 ;!define DUMMYINSTALL ; Define this to make it build quickly, not including any of the files or code in the sections, for quick testing of features of the installer and development thereof.
16 ; #######################################
17 ; MUI SETTINGS
18 ; #######################################
19 ; MUI 1.67 compatible ------
20 SetCompressor /SOLID lzma
21 SetCompressorDictSize 32
22 RequestExecutionLevel admin
23 !include "MUI.nsh"
24 !include "LogicLib.nsh"
25 !include "sections.nsh"
26 !define MUI_ABORTWARNING
27 !define MUI_ICON "..\..\inkscape.ico";${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
28 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
29 !define MUI_HEADERIMAGE
30 !define MUI_HEADERIMAGE_BITMAP "header.bmp"
31 !define MUI_WELCOMEFINISHPAGE_BITMAP "welcomefinish.bmp"
32 !define MUI_COMPONENTSPAGE_SMALLDESC
34 ;..................................................................................................
35 ;Following two definitions required. Uninstall log will use these definitions.
36 ;You may use these definitions also, when you want to set up the InstallDirRagKey,
37 ;store the language selection, store Start Menu folder etc.
38 ;Enter the windows uninstall reg sub key to add uninstall information to Add/Remove Programs also.
40 !define INSTDIR_REG_ROOT HKLM
41 !define INSTDIR_REG_KEY ${PRODUCT_UNINST_KEY}
43 ;include the Uninstall log header
44 !include AdvUninstLog.nsh
45 !insertmacro INTERACTIVE_UNINSTALL
47 ;For md5dll and messagebox
48 !addplugindir .
50 !include FileFunc.nsh
51 !insertmacro GetParameters
52 !insertmacro GetOptions
53 !insertmacro un.GetParent
55 ; Welcome page
56 !insertmacro MUI_PAGE_WELCOME
57 ; License page
58 ; !define MUI_LICENSEPAGE_RADIOBUTTONS
59 LicenseForceSelection off
60 !define MUI_LICENSEPAGE_BUTTON $(lng_LICENSE_BUTTON)
61 !define MUI_LICENSEPAGE_TEXT_BOTTOM $(lng_LICENSE_BOTTOM_TEXT)
62 !insertmacro MUI_PAGE_LICENSE "..\..\Copying"
63 !insertmacro MUI_PAGE_COMPONENTS
64 ; InstType $(lng_Full)
65 ; InstType $(lng_Optimal)
66 ; InstType $(lng_Minimal)
67 ; Directory page
68 !insertmacro MUI_PAGE_DIRECTORY
69 ; Instfiles page
70 !insertmacro MUI_PAGE_INSTFILES
71 ; Finish page
72 !define MUI_FINISHPAGE_RUN "$INSTDIR\inkscape.exe"
73 !insertmacro MUI_PAGE_FINISH
75 ; Uninstaller pages
76 !insertmacro MUI_UNPAGE_CONFIRM
77 UninstPage custom un.CustomPageUninstall
78 !insertmacro MUI_UNPAGE_INSTFILES
79 ShowUninstDetails hide
80 !insertmacro MUI_UNPAGE_FINISH
82 ; #######################################
83 ; STRING LOCALIZATION
84 ; #######################################
85 ; Thanks to Adib Taraben and Luca Bruno for getting this started
86 ; Add your translation here! :-)
87 ; I had wanted to list the languages alphabetically, but apparently
88 ; the first is the default. So putting English first is just being
89 ; practical. It is not chauvinism or hubris, I swear! ;-)
90 ; default language first
92 ; Language files
93 !insertmacro MUI_RESERVEFILE_LANGDLL
94 !include English.nsh
95 !include Breton.nsh
96 !include Catalan.nsh
97 !include Czech.nsh
98 !include Finnish.nsh
99 !include French.nsh
100 !include Galician.nsh
101 !include German.nsh
102 !include Italian.nsh
103 !include Japanese.nsh
104 !include Polish.nsh
105 !include Russian.nsh
106 !include Slovak.nsh
107 !include Slovenian.nsh
108 !include Spanish.nsh
109 !include SimpChinese.nsh
110 !include TradChinese.nsh
112 ReserveFile "inkscape.nsi.uninstall"
113 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
114 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
116 ; #######################################
117 ; SETTINGS
118 ; #######################################
120 Name "${PRODUCT_NAME}"
121 Caption "$(lng_Caption)"
122 BrandingText "$(lng_Caption)"
123 !ifndef PRODUCT_REVISION
124 OutFile "Inkscape-${PRODUCT_VERSION}.exe"
125 !else
126 OutFile "Inkscape-${PRODUCT_VERSION}-${PRODUCT_REVISION}.exe"
127 !endif
128 InstallDir "$PROGRAMFILES\Inkscape"
129 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
131 Var askMultiUser
132 Var filename
133 Var MultiUser
134 Var User
135 Var CMDARGS
137 ; #######################################
138 ; I N S T A L L E R S E C T I O N S
139 ; #######################################
141 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
143 ;;;;;;;;;;;;;;;;;;;;;;;;;;
144 ; Delete prefs
145 ; code originally taken from the vlc project
146 ;;;;;;;;;;;;;;;;;;;;;;;;;;
147 !macro delprefs
148 StrCpy $0 0
149 DetailPrint "Deleting personal preferences..."
150 DetailPrint "Finding all users..."
151 ${Do}
152 ; FIXME
153 ; this will loop through all the logged users and "virtual" windows users
154 ; (it looks like users are only present in HKEY_USERS when they are logged in)
155 ClearErrors
156 EnumRegKey $1 HKU "" $0
157 ${IfThen} $1 == "" ${|} ${ExitDo} ${|}
158 IntOp $0 $0 + 1
159 ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
160 ${IfThen} $2 == "" ${|} ${Continue} ${|}
161 DetailPrint "Removing $2\Inkscape"
162 Delete "$2\Inkscape\preferences.xml"
163 Delete "$2\Inkscape\extension-errors.log"
164 RMDir "$2\Inkscape"
165 ${Loop}
166 !macroend
169 ;--------------------------------
170 ; Installer Sections
171 Section -removeInkscape
172 !ifndef DUMMYINSTALL
173 ;remove the old Inkscape shortcuts from the startmenu
174 ;just in case they are still there
175 SetShellVarContext current
176 Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
177 Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
178 RMDir "$SMPROGRAMS\Inkscape"
179 Delete "$SMPROGRAMS\Inkscape.lnk"
180 SetShellVarContext all
181 Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
182 Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
183 RMDir "$SMPROGRAMS\Inkscape"
184 Delete "$SMPROGRAMS\Inkscape.lnk"
185 !endif
186 SectionEnd
188 Section $(lng_Core) SecCore
189 SectionIn 1 2 3 RO
190 !ifndef DUMMYINSTALL
191 DetailPrint "Installing Inkscape core files..."
192 SetOutPath $INSTDIR
193 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
194 SetOverwrite on
195 SetAutoClose false
197 File /a "..\..\inkscape\ink*.exe"
198 File /a "..\..\inkscape\AUTHORS"
199 File /a "..\..\inkscape\COPYING"
200 File /a "..\..\inkscape\COPYING.LIB"
201 File /a "..\..\inkscape\NEWS"
202 File /a "..\..\inkscape\gspawn-win32-helper.exe"
203 File /a "..\..\inkscape\gspawn-win32-helper-console.exe"
204 File /nonfatal /a "..\..\inkscape\HACKING.txt"
205 File /a "..\..\inkscape\README"
206 File /nonfatal /a "..\..\inkscape\README.txt"
207 File /a "..\..\inkscape\TRANSLATORS"
208 File /nonfatal /a /r "..\..\inkscape\data"
209 File /nonfatal /a /r "..\..\inkscape\doc"
210 File /nonfatal /a /r "..\..\inkscape\plugins"
211 File /nonfatal /a /r /x *.??*.???* /x "examples" /x "tutorials" "..\..\inkscape\share"
212 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
213 ; this files are added because it slips through the filter
214 SetOutPath $INSTDIR\share\clipart
215 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
216 File /a "..\..\inkscape\share\clipart\inkscape.logo.svg"
217 ;File /a "..\..\inkscape\share\clipart\inkscape.logo.classic.svg"
218 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
219 SetOutPath $INSTDIR\share\icons
220 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
221 File /a "..\..\inkscape\share\icons\inkscape.file.png"
222 File /a "..\..\inkscape\share\icons\inkscape.file.svg"
223 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
224 SetOutPath $INSTDIR\modules
225 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
226 File /nonfatal /a /r "..\..\inkscape\modules\*.*"
227 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
228 SetOutPath $INSTDIR\python
229 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
230 File /nonfatal /a /r "..\..\inkscape\python\*.*"
231 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
232 !endif
233 SectionEnd
235 Section $(lng_GTKFiles) SecGTK
236 SectionIn 1 2 3 RO
237 !ifndef DUMMYINSTALL
238 DetailPrint "Installing GTK files..."
239 SetOutPath $INSTDIR
240 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
241 SetOverwrite on
242 File /a /r "..\..\inkscape\*.dll"
243 File /a /r /x "locale" "..\..\inkscape\lib"
244 File /a /r "..\..\inkscape\etc"
245 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
246 !endif
247 SectionEnd
249 Section -SetCurrentUserOnly
250 !ifndef DUMMYINSTALL
251 StrCpy $MultiUser 0
252 SetShellVarContext current
253 !endif
254 SectionEnd
256 Section $(lng_Alluser) SecAlluser
257 SectionIn 1 2 3
258 !ifndef DUMMYINSTALL
259 ; disable this option in Win95/Win98/WinME
260 StrCpy $MultiUser 1
261 DetailPrint "Installing in administrator mode (registry root will be HKLM)"
262 SetShellVarContext all
263 !endif
264 SectionEnd
266 SectionGroup $(lng_Shortcuts) SecShortcuts
268 Section $(lng_Desktop) SecDesktop
269 !ifndef DUMMYINSTALL
270 CreateShortCut "$DESKTOP\Inkscape.lnk" "$INSTDIR\inkscape.exe"
271 !endif
272 SectionEnd
274 Section $(lng_Quicklaunch) SecQuicklaunch
275 !ifndef DUMMYINSTALL
276 ${IfThen} $QUICKLAUNCH != $TEMP ${|} CreateShortCut "$QUICKLAUNCH\Inkscape.lnk" "$INSTDIR\inkscape.exe" ${|}
277 !endif
278 SectionEnd
280 Section $(lng_SVGWriter) SecSVGWriter
281 SectionIn 1 2 3
282 !ifndef DUMMYINSTALL
283 DetailPrint "Associating SVG files with Inkscape"
284 ReadRegStr $0 HKCR ".svg" ""
285 ${If} $0 == ""
286 StrCpy $0 svgfile
287 WriteRegStr HKCR ".svg" "" $0
288 WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
289 ${EndIf}
290 WriteRegStr HKCR "$0\shell\edit\command" "" `"$INSTDIR\Inkscape.exe" "%1"`
292 ReadRegStr $0 HKCR ".svgz" ""
293 ${If} $0 == ""
294 StrCpy $0 svgfile
295 WriteRegStr HKCR ".svgz" "" $0
296 WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
297 ${EndIf}
298 WriteRegStr HKCR "$0\shell\edit\command" "" `"$INSTDIR\Inkscape.exe" "%1"`
299 !endif
300 SectionEnd
302 Section $(lng_ContextMenu) SecContextMenu
303 SectionIn 1 2 3
304 !ifndef DUMMYINSTALL
305 DetailPrint "Adding Inkscape to SVG file context menu"
306 ReadRegStr $0 HKCR ".svg" ""
307 ${If} $0 == ""
308 StrCpy $0 svgfile
309 WriteRegStr HKCR ".svg" "" $0
310 WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
311 ${EndIf}
312 WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" `"$INSTDIR\Inkscape.exe" "%1"`
314 ReadRegStr $0 HKCR ".svgz" ""
315 ${If} $0 == ""
316 StrCpy $0 svgfile
317 WriteRegStr HKCR ".svgz" "" $0
318 WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
319 ${EndIf}
320 WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" `"$INSTDIR\Inkscape.exe" "%1"`
321 !endif
322 SectionEnd
324 SectionGroupEnd
326 Section /o $(lng_DeletePrefs) SecPrefs
327 !ifndef DUMMYINSTALL
328 !insertmacro delprefs
329 !endif
330 SectionEnd
332 SectionGroup $(lng_Addfiles) SecAddfiles
334 Section $(lng_Examples) SecExamples
335 SectionIn 1 2
336 !ifndef DUMMYINSTALL
337 SetOutPath $INSTDIR\share
338 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
339 File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\examples"
340 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
341 !endif
342 SectionEnd
344 Section $(lng_Tutorials) SecTutorials
345 SectionIn 1 2
346 !ifndef DUMMYINSTALL
347 SetOutPath $INSTDIR\share
348 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
349 File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\tutorials"
350 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
351 !endif
352 SectionEnd
354 SectionGroupEnd
356 SectionGroup $(lng_Languages) SecLanguages
357 !macro Language SecName lng
358 Section /o $(lng_${lng}) Sec${SecName}
359 ;SectionIn 1 2 3
360 !ifndef DUMMYINSTALL
361 SetOutPath $INSTDIR
362 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
363 File /nonfatal /a "..\..\inkscape\*.${lng}.txt" ; FIXME: remove this? No such files.
364 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
365 SetOutPath $INSTDIR\locale
366 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
367 File /nonfatal /a /r "..\..\inkscape\locale\${lng}"
368 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
369 SetOutPath $INSTDIR\lib\locale
370 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
371 File /nonfatal /a /r "..\..\inkscape\lib\locale\${lng}"
372 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
373 SetOutPath $INSTDIR\share\clipart
374 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
375 File /nonfatal /a /r "..\..\inkscape\share\clipart\*.${lng}.svg"
376 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
377 ; the keyboard tables
378 SetOutPath $INSTDIR\share\screens
379 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
380 File /nonfatal /a /r "..\..\inkscape\share\screens\*.${lng}.svg"
381 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
382 SetOutPath $INSTDIR\share\templates
383 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
384 File /nonfatal /a /r "..\..\inkscape\share\templates\*.${lng}.svg"
385 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
386 SetOutPath $INSTDIR\doc
387 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
388 File /nonfatal /a /r "..\..\inkscape\doc\keys.${lng}.xml"
389 File /nonfatal /a /r "..\..\inkscape\doc\keys.${lng}.html"
390 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
391 SectionGetFlags ${SecTutorials} $R1
392 IntOp $R1 $R1 & ${SF_SELECTED}
393 ${If} $R1 >= ${SF_SELECTED}
394 SetOutPath $INSTDIR\share\tutorials
395 !insertmacro UNINSTALL.LOG_OPEN_INSTALL
396 File /nonfatal /a "..\..\inkscape\share\tutorials\*.${lng}.*"
397 !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
398 ${EndIf}
399 !endif
400 SectionEnd
401 !macroend
403 !insertmacro Language Amharic am
404 !insertmacro Language Arabic ar
405 !insertmacro Language Azerbaijani az
406 !insertmacro Language Byelorussian be
407 !insertmacro Language Bulgarian bg
408 !insertmacro Language Bengali bn
409 !insertmacro Language Breton br
410 !insertmacro Language Catalan ca
411 !insertmacro Language CatalanValencia ca@valencia
412 !insertmacro Language Czech cs
413 !insertmacro Language Danish da
414 !insertmacro Language German de
415 !insertmacro Language Dzongkha dz
416 !insertmacro Language Greek el
417 !insertmacro Language EnglishAustralian en_AU
418 !insertmacro Language EnglishCanadian en_CA
419 !insertmacro Language EnglishBritain en_GB
420 !insertmacro Language EnglishPiglatin en_US@piglatin
421 !insertmacro Language Esperanto eo
422 !insertmacro Language Spanish es
423 !insertmacro Language SpanishMexico es_MX
424 !insertmacro Language Estonian et
425 !insertmacro Language Basque eu
426 !insertmacro Language French fr
427 !insertmacro Language Finnish fi
428 !insertmacro Language Irish ga
429 !insertmacro Language Gallegan gl
430 !insertmacro Language Hebrew he
431 !insertmacro Language Croatian hr
432 !insertmacro Language Hungarian hu
433 !insertmacro Language Indonesian id
434 !insertmacro Language Italian it
435 !insertmacro Language Japanese ja
436 !insertmacro Language Khmer km
437 !insertmacro Language Korean ko
438 !insertmacro Language Lithuanian lt
439 !insertmacro Language Mongolian mn
440 !insertmacro Language Macedonian mk
441 !insertmacro Language NorwegianBokmal nb
442 !insertmacro Language Nepali ne
443 !insertmacro Language Dutch nl
444 !insertmacro Language NorwegianNynorsk nn
445 !insertmacro Language Panjabi pa
446 !insertmacro Language Polish pl
447 !insertmacro Language Portuguese pt
448 !insertmacro Language PortugueseBrazil pt_BR
449 !insertmacro Language Romanian ro
450 !insertmacro Language Russian ru
451 !insertmacro Language Kinyarwanda rw
452 !insertmacro Language Slovak sk
453 !insertmacro Language Slovenian sl
454 !insertmacro Language Albanian sq
455 !insertmacro Language Serbian sr
456 !insertmacro Language SerbianLatin sr@latin
457 !insertmacro Language Swedish sv
458 !insertmacro Language Thai th
459 !insertmacro Language Turkish tr
460 !insertmacro Language Ukrainian uk
461 !insertmacro Language Vietnamese vi
462 !insertmacro Language ChineseSimplified zh_CN
463 !insertmacro Language ChineseTaiwan zh_TW
464 SectionGroupEnd
467 Section -FinalizeInstallation
468 !ifndef DUMMYINSTALL
469 DetailPrint "Finalizing installation"
470 ${IfThen} $MultiUser = 1 ${|} SetShellVarContext all ${|}
471 ${IfThen} $MultiUser != 1 ${|} SetShellVarContext current ${|}
473 WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inkscape.exe"
474 WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "MultiUser" $MultiUser
475 WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "askMultiUser" $askMultiUser
476 WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "User" $User
478 ; start menu entries
479 CreateShortcut "$SMPROGRAMS\Inkscape.lnk" "$INSTDIR\inkscape.exe"
481 ; uninstall settings
482 ; WriteUninstaller "$INSTDIR\uninst.exe"
483 WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" "${UNINST_EXE}"
484 WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallDir" $INSTDIR
485 WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" $INSTDIR
486 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
487 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0"
488 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
489 WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" 1
490 WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" 1
492 ;create/update log always within .onInstSuccess function
493 !insertmacro UNINSTALL.LOG_UPDATE_INSTALL
495 DetailPrint "Creating MD5 checksums"
496 ClearErrors
497 FileOpen $0 $INSTDIR\Uninstall.dat r
498 FileOpen $9 $INSTDIR\Uninstall.log w
499 ${IfNot} ${Errors}
500 ${Do}
501 ClearErrors
502 FileRead $0 $1
503 ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
504 StrCpy $1 $1 -2
505 md5dll::GetMD5File /NOUNLOAD $1
506 Pop $2
507 ${IfThen} $2 != "" ${|} FileWrite $9 "$2 $1$\r$\n" ${|}
508 ${Loop}
509 ${EndIf}
510 FileClose $0
511 FileClose $9
512 ; Not needed any more
513 Delete $INSTDIR\Uninstall.dat
514 !endif
515 SectionEnd
517 ; Last the Descriptions
518 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
519 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(lng_CoreDesc)
520 !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} $(lng_GTKFilesDesc)
521 !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(lng_ShortcutsDesc)
522 !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} $(lng_AlluserDesc)
523 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(lng_DesktopDesc)
524 !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} $(lng_QuicklaunchDesc)
525 !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} $(lng_SVGWriterDesc)
526 !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} $(lng_ContextMenuDesc)
527 !insertmacro MUI_DESCRIPTION_TEXT ${SecPrefs} $(lng_DeletePrefsDesc)
528 !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} $(lng_AddfilesDesc)
529 !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} $(lng_ExamplesDesc)
530 !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} $(lng_TutorialsDesc)
531 !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(lng_LanguagesDesc)
532 !insertmacro MUI_FUNCTION_DESCRIPTION_END
534 !macro Parameter key Section
535 ${GetOptions} $CMDARGS "/${key}=" $1
536 ${If} $1 == "OFF"
537 SectionGetFlags ${Section} $0
538 IntOp $2 ${SF_SELECTED} ~
539 IntOp $0 $0 & $2
540 SectionSetFlags ${Section} $0
541 ${EndIf}
542 ${If} $1 == "ON"
543 SectionGetFlags ${Section} $0
544 IntOp $0 $0 | ${SF_SELECTED}
545 SectionSetFlags ${Section} $0
546 ${EndIf}
547 !macroend
549 Function .onInit
550 !insertmacro MUI_LANGDLL_DISPLAY
552 !macro LanguageAutoSelect SecName LocaleID
553 ${If} $LANGUAGE = ${LocaleID}
554 SectionGetFlags ${Sec${SecName}} $0
555 IntOp $0 $0 | ${SF_SELECTED}
556 SectionSetFlags ${Sec${SecName}} $0
557 ${EndIf}
558 !macroend
560 ;!insertmacro LanguageAutoSelect English 1033
561 !insertmacro LanguageAutoSelect Breton 1150
562 !insertmacro LanguageAutoSelect Catalan 1027
563 !insertmacro LanguageAutoSelect Czech 1029
564 !insertmacro LanguageAutoSelect Finnish 1035
565 !insertmacro LanguageAutoSelect French 1036
566 !insertmacro LanguageAutoSelect Gallegan 1110 ; Galician, but section is called Gallegan
567 !insertmacro LanguageAutoSelect German 1031
568 !insertmacro LanguageAutoSelect Italian 1040
569 !insertmacro LanguageAutoSelect Japanese 1041
570 !insertmacro LanguageAutoSelect Polish 1045
571 !insertmacro LanguageAutoSelect Russian 1049
572 !insertmacro LanguageAutoSelect Slovak 1051
573 !insertmacro LanguageAutoSelect Slovenian 1060
574 !insertmacro LanguageAutoSelect Spanish 1034
575 !insertmacro LanguageAutoSelect ChineseTaiwan 1028 ; TradChinese, but section is called ChineseTaiwan
577 ${GetParameters} $CMDARGS
578 ;prepare log always within .onInit function
579 !insertmacro UNINSTALL.LOG_PREPARE_INSTALL
581 ;Extract InstallOptions INI files
582 StrCpy $AskMultiUser "1"
583 StrCpy $MultiUser "0"
584 ; this resets AskMultiUser if Win95/98/ME
585 ClearErrors
586 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
587 ${If} ${Errors}
588 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
589 StrCpy $R0 $R0 1
590 ${IfThen} $R0 = 4 ${|} StrCpy $AskMultiUser 0 ${|}
591 ${EndIf}
593 ; hide all user section if ME/9x
594 ${IfThen} $AskMultiUser != 1 ${|} SectionSetText ${SecAlluser} "" ${|}
596 ; hide if quick launch if not available
597 ${IfThen} $QUICKLAUNCH == $TEMP ${|} SectionSetText ${SecQuicklaunch} "" ${|}
599 ;check if user is admin
600 ClearErrors
601 UserInfo::GetName
602 ${If} ${Errors}
603 ; This one means you don't need to care about admin or
604 ; not admin because Windows 9x doesn't either
605 ${IfCmd} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NOT_SUPPORTED)$(lng_OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${||} Quit ${|}
606 ${Else}
607 Pop $User
608 UserInfo::GetAccountType
609 Pop $1
610 ${If} $1 != "Admin"
611 ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NO_ADMIN)$(lng_OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
612 Quit
613 ${EndIf}
614 ${EndIf}
616 ;check for previous installation
617 ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
618 ${IfThen} $0 == "" ${|} ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User" ${|}
619 ;check user if applicable
620 ${If} $0 != ""
621 ${AndIf} $0 != $User
622 ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
623 Quit
624 ${EndIf}
626 ; call uninstall first
627 ; code taken from the vlc project
628 ReadRegStr $R0 HKLM ${PRODUCT_UNINST_KEY} "UninstallString"
629 ReadRegStr $R1 HKLM ${PRODUCT_UNINST_KEY} "DisplayName"
630 ${If} $R0 == ""
631 ReadRegStr $R0 HKCU ${PRODUCT_UNINST_KEY} "UninstallString"
632 ReadRegStr $R1 HKCU ${PRODUCT_UNINST_KEY} "DisplayName"
633 ${EndIf}
634 ${If} $R0 != ""
635 ${AndIf} ${Cmd} ${|} MessageBox MB_YESNO|MB_ICONEXCLAMATION $(lng_WANT_UNINSTALL_BEFORE) /SD IDNO IDYES ${|}
636 ExecWait $R0 ;Was '$R0 _?=$INSTDIR' but we do NOT want it leaving the uninstaller behind.
637 ${EndIf}
639 ; proccess command line parameter
640 !insertmacro Parameter "GTK" ${SecGTK}
641 !insertmacro Parameter "SHORTCUTS" ${secShortcuts}
642 !insertmacro Parameter "ALLUSER" ${SecAlluser}
643 !insertmacro Parameter "DESKTOP" ${SecDesktop}
644 !insertmacro Parameter "QUICKLAUNCH" ${SecQUICKlaunch}
645 !insertmacro Parameter "SVGEDITOR" ${SecSVGWriter}
646 !insertmacro Parameter "CONTEXTMENUE" ${SecContextMenu}
647 !insertmacro Parameter "PREFERENCES" ${SecPrefs}
648 !insertmacro Parameter "ADDFILES" ${SecAddfiles}
649 !insertmacro Parameter "EXAMPLES" ${SecExamples}
650 !insertmacro Parameter "TUTORIALS" ${SecTutorials}
651 !insertmacro Parameter "LANGUAGES" ${SecLanguages}
652 !insertmacro Parameter "am" ${SecAmharic}
653 !insertmacro Parameter "ar" ${SecArabic}
654 !insertmacro Parameter "az" ${SecAzerbaijani}
655 !insertmacro Parameter "be" ${SecByelorussian}
656 !insertmacro Parameter "bg" ${SecBulgarian}
657 !insertmacro Parameter "bn" ${SecBengali}
658 !insertmacro Parameter "br" ${SecBreton}
659 !insertmacro Parameter "ca" ${SecCatalan}
660 !insertmacro Parameter "ca@valencia" ${SecCatalanValencia}
661 !insertmacro Parameter "cs" ${SecCzech}
662 !insertmacro Parameter "da" ${SecDanish}
663 !insertmacro Parameter "de" ${SecGerman}
664 !insertmacro Parameter "dz" ${SecDzongkha}
665 !insertmacro Parameter "el" ${SecGreek}
666 !insertmacro Parameter "en_AU" ${SecEnglishAustralian}
667 !insertmacro Parameter "en_CA" ${SecEnglishCanadian}
668 !insertmacro Parameter "en_GB" ${SecEnglishBritain}
669 !insertmacro Parameter "en_US@piglatin" ${SecEnglishPiglatin}
670 !insertmacro Parameter "eo" ${SecEsperanto}
671 !insertmacro Parameter "es" ${SecSpanish}
672 !insertmacro Parameter "es_MX" ${SecSpanishMexico}
673 !insertmacro Parameter "et" ${SecEstonian}
674 !insertmacro Parameter "eu" ${SecBasque}
675 !insertmacro Parameter "fi" ${SecFinnish}
676 !insertmacro Parameter "fr" ${SecFrench}
677 !insertmacro Parameter "ga" ${SecIrish}
678 !insertmacro Parameter "gl" ${SecGallegan}
679 !insertmacro Parameter "he" ${SecHebrew}
680 !insertmacro Parameter "hr" ${SecCroatian}
681 !insertmacro Parameter "hu" ${SecHungarian}
682 !insertmacro Parameter "id" ${SecIndonesian}
683 !insertmacro Parameter "it" ${SecItalian}
684 !insertmacro Parameter "ja" ${SecJapanese}
685 !insertmacro Parameter "km" ${SecKhmer}
686 !insertmacro Parameter "ko" ${SecKorean}
687 !insertmacro Parameter "lt" ${SecLithuanian}
688 !insertmacro Parameter "mk" ${SecMacedonian}
689 !insertmacro Parameter "mn" ${SecMongolian}
690 !insertmacro Parameter "nb" ${SecNorwegianBokmal}
691 !insertmacro Parameter "ne" ${SecNepali}
692 !insertmacro Parameter "nl" ${SecDutch}
693 !insertmacro Parameter "nn" ${SecNorwegianNynorsk}
694 !insertmacro Parameter "pa" ${SecPanjabi}
695 !insertmacro Parameter "pl" ${SecPolish}
696 !insertmacro Parameter "pt" ${SecPortuguese}
697 !insertmacro Parameter "pt_BR" ${SecPortugueseBrazil}
698 !insertmacro Parameter "ro" ${SecRomanian}
699 !insertmacro Parameter "ru" ${SecRussian}
700 !insertmacro Parameter "rw" ${SecKinyarwanda}
701 !insertmacro Parameter "sk" ${SecSlovak}
702 !insertmacro Parameter "sl" ${SecSlovenian}
703 !insertmacro Parameter "sq" ${SecAlbanian}
704 !insertmacro Parameter "sr" ${SecSerbian}
705 !insertmacro Parameter "sr@latin" ${SecSerbianLatin}
706 !insertmacro Parameter "sv" ${SecSwedish}
707 !insertmacro Parameter "th" ${SecThai}
708 !insertmacro Parameter "tr" ${SecTurkish}
709 !insertmacro Parameter "uk" ${SecUkrainian}
710 !insertmacro Parameter "vi" ${SecVietnamese}
711 !insertmacro Parameter "zh_CN" ${SecChineseSimplified}
712 !insertmacro Parameter "zh_TW" ${SecChineseTaiwan}
714 ClearErrors
715 ${GetOptions} $CMDARGS "/?" $1
716 ${IfNot} ${Errors}
717 MessageBox MB_OK "Possible parameters for installer:$\r$\n \
718 /?: this help screen$\r$\n \
719 /S: silent$\r$\n \
720 /D=(directory): where to install Inkscape$\r$\n \
721 /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
722 /SHORTCUTS=(OFF/ON): shortcuts to start Inkscape$\r$\n \
723 /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
724 /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
725 /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
726 /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
727 /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
728 /PREFERENCES=(OFF/ON): delete users preference files$\r$\n \
729 /ADDFILES=(OFF/ON): additional files$\r$\n \
730 /EXAMPLES=(OFF/ON): examples$\r$\n \
731 /TUTORIALS=(OFF/ON): tutorials$\r$\n \
732 /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
733 /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
734 Abort
735 ${EndIf}
736 FunctionEnd
738 ; --------------------------------------------------
740 Function un.CustomPageUninstall
741 !insertmacro MUI_HEADER_TEXT "$(lng_UInstOpt)" "$(lng_UInstOpt1)"
742 !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 1" "Text" "$APPDATA\Inkscape\"
743 !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 2" "Text" "$(lng_PurgePrefs)"
744 !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall"
745 !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State"
746 FunctionEnd
748 Function un.onInit
749 ;begin uninstall, could be added on top of uninstall section instead
750 ;!insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
751 ${IfNot} ${FileExists} $INSTDIR\uninstall.log
752 MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_UninstallLogNotFound)" /SD IDOK
753 Quit
754 ${EndIf}
755 ClearErrors
756 StrCpy $User ""
757 UserInfo::GetName
758 ${IfNot} ${Errors}
759 Pop $0
760 StrCpy $User $0
761 ${EndIf}
762 StrCpy $askMultiUser 1
763 StrCpy $MultiUser 1
765 ; Test if this was a multiuser installation
766 ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" ""
767 ${If} $0 == "$INSTDIR\inkscape.exe"
768 ReadRegStr $MultiUser HKLM "${PRODUCT_DIR_REGKEY}" "MultiUser"
769 ReadRegStr $askMultiUser HKLM "${PRODUCT_DIR_REGKEY}" "askMultiUser"
770 ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
771 ${Else}
772 ReadRegStr $MultiUser HKCU "${PRODUCT_DIR_REGKEY}" "MultiUser"
773 ReadRegStr $askMultiUser HKCU "${PRODUCT_DIR_REGKEY}" "askMultiUser"
774 ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
775 ${EndIf}
776 ;check user if applicable
777 ${If} $0 != ""
778 ${AndIf} $0 != $User
779 ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
780 Quit
781 ${EndIf}
783 !insertmacro MUI_INSTALLOPTIONS_EXTRACT "inkscape.nsi.uninstall"
785 SetShellVarContext all
786 ${IfThen} $MultiUser = 0 ${|} SetShellVarContext current ${|}
787 FunctionEnd
789 Section Uninstall
790 !ifndef DUMMYINSTALL
791 ; remove personal settings
792 Delete "$APPDATA\Inkscape\extension-errors.log"
793 ${If} $MultiUser = 0
794 DetailPrint "Purging personal settings in $APPDATA\Inkscape"
795 ;RMDir /r "$APPDATA\Inkscape"
796 !insertmacro delprefs
797 ${EndIf}
799 ; Remove file associations for svg editor
800 StrCpy $3 "svg"
801 ${For} $2 0 1
802 ${IfThen} $2 = 1 ${|} StrCpy $3 $3z ${|}
803 DetailPrint "Removing file associations for $3 editor"
804 ClearErrors
805 ReadRegStr $0 HKCR ".$3" ""
806 ${IfNot} ${Errors}
807 ReadRegStr $1 HKCR "$0\shell\edit\command" ""
808 ${If} $1 == `"$INSTDIR\Inkscape.exe" "%1"`
809 DeleteRegKey HKCR "$0\shell\edit\command"
810 ${EndIf}
812 ClearErrors
813 ReadRegStr $1 HKCR "$0\shell\open\command" ""
814 ${If} $1 == `"$INSTDIR\Inkscape.exe" "%1"`
815 DeleteRegKey HKCR "$0\shell\open\command"
816 ${EndIf}
818 DeleteRegKey HKCR "$0\shell\${PRODUCT_NAME}"
819 DeleteRegKey /ifempty HKCR "$0\shell\edit"
820 DeleteRegKey /ifempty HKCR "$0\shell\open"
821 DeleteRegKey /ifempty HKCR "$0\shell"
822 DeleteRegKey /ifempty HKCR "$0"
823 DeleteRegKey /ifempty HKCR ".$3"
824 ${EndIf}
825 ${Next}
827 SetShellVarContext all
828 DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
829 DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
830 Delete "$DESKTOP\Inkscape.lnk"
831 Delete "$QUICKLAUNCH\Inkscape.lnk"
832 Delete "$SMPROGRAMS\Inkscape.lnk"
833 ;just in case they are still there
834 Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
835 Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
836 RMDir "$SMPROGRAMS\Inkscape"
838 SetShellVarContext current
839 DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
840 DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
841 Delete "$DESKTOP\Inkscape.lnk"
842 Delete "$QUICKLAUNCH\Inkscape.lnk"
843 Delete "$SMPROGRAMS\Inkscape.lnk"
844 ;just in case they are still there
845 Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
846 Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
847 RMDir "$SMPROGRAMS\Inkscape"
849 InitPluginsDir
850 SetPluginUnload manual
852 ClearErrors
853 FileOpen $0 $INSTDIR\uninstall.log r
854 ${If} ${Errors} ;else uninstallnotfound
855 MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_UninstallLogNotFound)" /SD IDOK
856 ${Else}
857 ${Do}
858 ClearErrors
859 FileRead $0 $1
860 ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
861 ; cat the line into md5 and filename
862 StrLen $2 $1
863 ${IfThen} $2 <= 35 ${|} ${Continue} ${|}
864 StrCpy $3 $1 32
865 StrCpy $filename $1 $2-36 34 ;remove trailing CR/LF
866 StrCpy $filename $filename -2
867 ; $3 = MD5 when installed, then deletion choice
868 ; $filename = file
869 ; $5 = MD5 now
870 ; $6 = "always"/"never" remove files touched by user
872 ${If} ${FileExists} $filename
873 ${If} $6 == "always"
874 StrCpy $3 2
875 ${Else}
876 md5dll::GetMD5File /NOUNLOAD $filename
877 Pop $5 ;md5 of file
878 ${If} $3 != $5
879 ${AndIf} $6 != "never"
880 ; the md5 sums does not match so we ask
881 messagebox::show MB_DEFBUTTON3|MB_TOPMOST "" "0,103" \
882 "$(lng_FileChanged)" "$(lng_Yes)" "$(lng_AlwaysYes)" "$(lng_No)" "$(lng_AlwaysNo)"
883 Pop $3
884 ${IfThen} $3 = 2 ${|} StrCpy $6 "always" ${|}
885 ${IfThen} $3 = 4 ${|} StrCpy $6 "never" ${|}
886 ${EndIf}
887 ${EndIf}
889 ${If} $3 = 1 ; yes
890 ${OrIf} $3 = 2 ; always
891 ; Remove File
892 ClearErrors
893 Delete $filename
894 ;now recursivly remove the path
895 ${Do}
896 ClearErrors
897 ${un.GetParent} $filename $filename
898 ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
899 RMDir $filename
900 ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
901 ${Loop}
902 ${EndIf}
903 ${EndIf}
904 ${Loop}
905 ${EndIf}
906 FileClose $0
907 Delete "$INSTDIR\uninstall.log"
908 Delete "$INSTDIR\uninstall.exe"
909 ; remove empty directories
910 RMDir "$INSTDIR\data"
911 RMDir "$INSTDIR\doc"
912 RMDir "$INSTDIR\modules"
913 RMDir "$INSTDIR\plugins"
914 RMDir $INSTDIR
915 SetAutoClose false
916 !endif
917 SectionEnd