Code

Put Indonesian translation into the Win32 installer.
[inkscape.git] / packaging / win32 / inkscape.nsi
1 ; Instructions for compilers
2 ; ==========================
3 ; This file generates the Inkscape installer, which is currently the
4 ; preferred deployment method on Windows.
5 ; 1. Install NSIS 2.46 or later on Windows (2.45 has a !searchparse bug
6 ;    which breaks it and earlier doesn't support Windows 7 properly, and
7 ;    cross-compilation probably won't work due to some !system magic)
8 ; 2. Compile Inkscape (http://wiki.inkscape.org/wiki/index.php/Win32Port)
9 ; 3. Compile this file with NSIS. There should be no need to set version
10 ;    numbers in this file as it gets them from the Bazaar branch info and
11 ;    ..\..\src\inkscape-version.cpp. However, if the version number comes
12 ;    out wrong or this script didn't compile properly then you can define
13 ;    INKSCAPE_VERSION by uncommenting the next line and setting the correct
14 ;    value:
15 ;      !define INKSCAPE_VERSION "0.48"
16 ;    If you ever need to do a second, third or Nth release of the build or
17 ;    of the installer, then change the RELEASE_REVISION value below:
18        !define RELEASE_REVISION 1
20 ; There should never be any need for packagers to touch anything below
21 ; this line.  That's my job - Chris Morgan
23 ; Installer code {{{1
24 ; Compression and admin requirement {{{2
25 SetCompressor /SOLID lzma
26 SetCompressorDictSize 32
27 RequestExecutionLevel admin
29 ; Include required files {{{2
30 !include RequireLatestNSIS.nsh
31 !include ifexist.nsh
32 !include VersionCompleteXXXX.nsh
33 !include LogicLib.nsh
34 !include Sections.nsh
36 !macro !redef VAR VAL
37   !define _!redef_${VAR} `${VAL}`
38   !ifdef ${VAR}
39     !undef ${VAR}
40   !endif
41   !define ${VAR} `${VAL}`
42   !undef _!redef_${VAR}
43 !macroend
44 !define !redef `!insertmacro !redef`
46 ; Advanced Uninstall Log {{{3
47 ; We're abusing this script terribly and it's time to fix the broken uninstaller.
48 ; However, for the moment, this is what we're using.
49 !define INSTDIR_REG_ROOT HKLM
50 !define INSTDIR_REG_KEY "${UNINST_KEY}"
51 !include AdvUninstLog.nsh
52 !insertmacro INTERACTIVE_UNINSTALL
54 ; Initialise NSIS plug-ins {{{3
55 ; The plugins used are md5dll and messagebox
56 !addplugindir .
58 ; FileFunc bits and pieces {{{3
59 !include FileFunc.nsh
60 !insertmacro GetParameters
61 !insertmacro GetOptions
62 !insertmacro un.GetParent
64 ; User interface {{{3
65 !include MUI.nsh
66 ; MUI Configuration {{{4
67 !define MUI_ABORTWARNING
68 !define MUI_ICON ..\..\inkscape.ico
69 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
70 !define MUI_HEADERIMAGE
71 !define MUI_HEADERIMAGE_BITMAP header.bmp
72 !define MUI_WELCOMEFINISHPAGE_BITMAP welcomefinish.bmp
73 !define MUI_COMPONENTSPAGE_SMALLDESC
75 ; Pages {{{4
76 ; Installer pages {{{5
77 ; Welcome page {{{6
78 !insertmacro MUI_PAGE_WELCOME
79 ; License page {{{6
80 LicenseForceSelection off
81 ;!define MUI_LICENSEPAGE_RADIOBUTTONS
82 !define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)"
83 !define MUI_LICENSEPAGE_TEXT_BOTTOM "$(LICENSE_BOTTOM_TEXT)"
84 !insertmacro MUI_PAGE_LICENSE ..\..\Copying
85 ; Components page {{{6
86 !insertmacro MUI_PAGE_COMPONENTS
87 ; InstType "$(Full)"
88 ; InstType "$(Optimal)"
89 ; InstType "$(Minimal)"
90 ; Directory page {{{6
91 !insertmacro MUI_PAGE_DIRECTORY
92 ; Instfiles page {{{6
93 !insertmacro MUI_PAGE_INSTFILES
94 ; Finish page {{{6
95 !define MUI_FINISHPAGE_RUN "$INSTDIR\inkscape.exe"
96 !insertmacro MUI_PAGE_FINISH
98 ; Uninstaller pages {{{5
99 !insertmacro MUI_UNPAGE_CONFIRM
100 UninstPage custom un.CustomPageUninstall
101 !insertmacro MUI_UNPAGE_INSTFILES
102 ShowUninstDetails hide
103 !insertmacro MUI_UNPAGE_FINISH
105 ; Localization {{{3
106 ; See also the "Languages sections" SectionGroup lower down.
107 !insertmacro MUI_RESERVEFILE_LANGDLL
108 ;TODO: check if `!insertmacro LANGFILE "English" "English"`-style lines are needed (don't think it should be due to MUI_LANGUAGE)
109 !echo `Loading language files...`
110 !verbose push
111 !verbose 3
112 !insertmacro MUI_LANGUAGE "English"
113 !insertmacro LANGFILE_INCLUDE "languages\English.nsh"
114 !macro INKLANGFILE _LANG
115   !insertmacro MUI_LANGUAGE "${_LANG}"
116   !insertmacro LANGFILE_INCLUDE_WITHDEFAULT "languages\${_LANG}.nsh" "languages\English.nsh"
117 !macroend
118 !insertmacro INKLANGFILE Breton
119 !insertmacro INKLANGFILE Catalan
120 !insertmacro INKLANGFILE Czech
121 !insertmacro INKLANGFILE Dutch
122 !insertmacro INKLANGFILE Finnish
123 !insertmacro INKLANGFILE French
124 !insertmacro INKLANGFILE Galician
125 !insertmacro INKLANGFILE German
126 !insertmacro INKLANGFILE Indonesian
127 !insertmacro INKLANGFILE Italian
128 !insertmacro INKLANGFILE Japanese
129 !insertmacro INKLANGFILE Polish
130 !insertmacro INKLANGFILE Romanian
131 !insertmacro INKLANGFILE Russian
132 !insertmacro INKLANGFILE Slovak
133 !insertmacro INKLANGFILE Slovenian
134 !insertmacro INKLANGFILE Spanish
135 !insertmacro INKLANGFILE SimpChinese
136 !insertmacro INKLANGFILE TradChinese
137 !verbose pop
139 ReserveFile inkscape.nsi.uninstall
140 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
141 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
143 ; #######################################
144 ; SETTINGS
145 ; #######################################
147 ; Product details (version, name, registry keys etc.) {{{2
148 ; Find the version number in inkscape-version.cpp (e.g. 0.47+devel) {{{3
149 !ifndef INKSCAPE_VERSION
150   ; Official release format (no newlines)
151   !searchparse /noerrors /file ..\..\src\inkscape-version.cpp `namespace Inkscape {  char const *version_string = "` INKSCAPE_VERSION ` r` BZR_REVISION `";  }`
152   !ifndef INKSCAPE_VERSION
153     ; Other format; sorry, it has to be done in two steps.
154     !searchparse /noerrors /file ..\..\src\inkscape-version.cpp `char const *version_string = "` INKSCAPE_VERSION `";`
155     !searchparse /noerrors `${INKSCAPE_VERSION}` `` INKSCAPE_VERSION ` r` BZR_REVISION
156     !ifndef INKSCAPE_VERSION
157       !error "INKSCAPE_VERSION not defined and unable to get version number from ..\..\src\inkscape-version.cpp!"
158     !endif
159   !endif
160 !endif
161 !echo `Got version number from ..\..\src\inkscape-version.cpp: ${INKSCAPE_VERSION}`
162 !define FILENAME Inkscape-${INKSCAPE_VERSION}
163 !define BrandingText `Inkscape ${INKSCAPE_VERSION}`
165 ; Check for the Bazaar revision number for lp:inkscape {{{3
166 ${!ifexist} ..\..\.bzr\branch\last-revision
167   !if `${BZR_REVISION}` == ``
168     !undef BZR_REVISION
169   !endif
170   !ifndef BZR_REVISION
171     !searchparse /noerrors /file ..\..\.bzr\branch\last-revision "" BZR_REVISION " "
172   !endif
173 !endif
175 ; Check for devel builds and clear up bzr revision number define {{{3
176 !searchparse /noerrors ${INKSCAPE_VERSION} "" INKSCAPE_VERSION_NUMBER "+devel"
177 !if ${INKSCAPE_VERSION_NUMBER} != ${INKSCAPE_VERSION}
178   !define DEVEL
179 !endif
180 !if `${BZR_REVISION}` == ``
181   !undef BZR_REVISION
182 !endif
183 ; For releases like 0.48pre1, throw away the preN. It's too tricky to deal with
184 ; it properly so I'll leave it alone. It's just a pre-release, so it doesn't
185 ; really matter. So long as the final release works properly.
186 !ifndef DEVEL
187   !undef INKSCAPE_VERSION_NUMBER
188   !searchparse /noerrors ${INKSCAPE_VERSION} "" INKSCAPE_VERSION_NUMBER "pre" PRE_NUMBER
189 !endif
191 ; Handle display version number and complete X.X version numbers into X.X.X.X {{{3
192 !ifdef DEVEL & BZR_REVISION
193   ${!redef} FILENAME `${FILENAME}-r${BZR_REVISION}`
194   ${!redef} BrandingText `${BrandingText} r${BZR_REVISION}`
195   !define VERSION_X.X.X.X_REVISION ${BZR_REVISION}
196 ; Handle the installer revision number {{{4
197 !else ifdef RELEASE_REVISION
198   ${!redef} FILENAME `${FILENAME}-${RELEASE_REVISION}`
199   ; If we wanted the branding text to be like "Inkscape 0.48pre1 r9505" this'd do it.
200   ;!ifdef BZR_REVISION
201   ;  ${!redef} BrandingText `${BrandingText} r${BZR_REVISION}`
202   ;!endif
203   !if `${RELEASE_REVISION}` != `1`
204     ${!redef} BrandingText `${BrandingText}, revision ${RELEASE_REVISION}`
205   !endif
206   !define VERSION_X.X.X.X_REVISION ${RELEASE_REVISION}
207 !else
208   !define VERSION_X.X.X.X_REVISION 0
209 !endif
211 ${VersionCompleteXXXN} ${INKSCAPE_VERSION_NUMBER} VERSION_X.X.X.X ${VERSION_X.X.X.X_REVISION}
213 ; Product definitions {{{3
214 !define PRODUCT_NAME "Inkscape" ; TODO: fix up the language files to not use this and kill this line
215 !define INSTDIR_KEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inkscape.exe"
216 !define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Inkscape"
217 ;!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.
218 !define _FILENAME ${FILENAME}.exe
219 !undef FILENAME
220 !define FILENAME ${_FILENAME}
221 !undef _FILENAME
223 ; Product information {{{3
224 Name              `Inkscape`
225 Caption           `Inkscape - $(CaptionDescription)`
226 BrandingText      `${BrandingText}`
227 OutFile           `${FILENAME}`
228 InstallDir        "$PROGRAMFILES\Inkscape"
229 InstallDirRegKey  HKLM "${INSTDIR_KEY}" ""
231 ; Version information {{{3
232 VIProductVersion ${VERSION_X.X.X.X}
233 VIAddVersionKey ProductName Inkscape
234 VIAddVersionKey Comments "Licensed under the GNU GPL"
235 VIAddVersionKey CompanyName inkscape.org
236 VIAddVersionKey LegalCopyright "© 2009 Inkscape"
237 VIAddVersionKey FileDescription Inkscape
238 VIAddVersionKey FileVersion ${VERSION_X.X.X.X}
239 VIAddVersionKey ProductVersion ${VERSION_X.X.X.X}
240 VIAddVersionKey InternalName Inkscape
242 ; Variables {{{2
243 Var askMultiUser
244 Var filename
245 Var MultiUser
246 Var User
247 Var CMDARGS
249 !macro delprefs ; Delete preferences (originally from VLC) {{{2
250   StrCpy $0 0
251   DetailPrint "Deleting personal preferences..."
252   DetailPrint "Finding all users..."
253   ${Do}
254   ; this will loop through all the logged users and "virtual" windows users
255   ; (it looks like users are only present in HKEY_USERS when they are logged in)
256     ClearErrors
257     EnumRegKey $1 HKU "" $0
258     ${IfThen} $1 == "" ${|} ${ExitDo} ${|}
259     IntOp $0 $0 + 1
260     ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
261     ${IfThen} $2 == "" ${|} ${Continue} ${|}
262     DetailPrint "Removing $2\Inkscape"
263     Delete $2\Inkscape\preferences.xml
264     Delete $2\Inkscape\extension-errors.log
265     RMDir  $2\Inkscape
266   ${Loop}
267 !macroend
269 ; Sections (these do the work) {{{2
271 Section -removeInkscape ; Hidden, mandatory section to clean a previous installation {{{
272 !ifndef DUMMYINSTALL
273   ;remove the old Inkscape shortcuts from the startmenu
274   ;just in case they are still there
275   SetShellVarContext current
276   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
277   Delete  $SMPROGRAMS\Inkscape\Inkscape.lnk
278   RMDir   $SMPROGRAMS\Inkscape
279   Delete  $SMPROGRAMS\Inkscape.lnk
280   SetShellVarContext all
281   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
282   Delete  $SMPROGRAMS\Inkscape\Inkscape.lnk
283   RMDir   $SMPROGRAMS\Inkscape
284   Delete  $SMPROGRAMS\Inkscape.lnk
285 !endif
286 SectionEnd ; -removeInkscape }}}
288 Section $(Core) SecCore ; Mandatory Inkscape core files section {{{
289   SectionIn 1 2 3 RO
290 !ifndef DUMMYINSTALL
291   DetailPrint "Installing Inkscape core files..."
292   SetOutPath $INSTDIR
293   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
294   SetOverwrite on
295   SetAutoClose false
297   File           /a    ..\..\inkscape\ink*.exe
298   File           /a    ..\..\inkscape\AUTHORS
299   File           /a    ..\..\inkscape\COPYING
300   File           /a    ..\..\inkscape\COPYING.LIB
301   File           /a    ..\..\inkscape\NEWS
302   File           /a    ..\..\inkscape\gspawn-win32-helper.exe
303   File           /a    ..\..\inkscape\gspawn-win32-helper-console.exe
304   File /nonfatal /a    ..\..\inkscape\HACKING.txt
305   File           /a    ..\..\inkscape\README
306   File /nonfatal /a    ..\..\inkscape\README.txt
307   File           /a    ..\..\inkscape\TRANSLATORS
308   File /nonfatal /a /r ..\..\inkscape\data
309   File /nonfatal /a /r ..\..\inkscape\doc
310   File /nonfatal /a /r ..\..\inkscape\plugins
311   File /nonfatal /a /r /x *.??*.???* /x examples /x tutorials ..\..\inkscape\share
312   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
313   ; this files are added because it slips through the filter
314   SetOutPath $INSTDIR\share\clipart
315   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
316   File /a ..\..\inkscape\share\clipart\inkscape.logo.svg
317   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
318   SetOutPath $INSTDIR\share\icons
319   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
320   File /a ..\..\inkscape\share\icons\inkscape.file.png
321   File /a ..\..\inkscape\share\icons\inkscape.file.svg
322   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
323   SetOutPath $INSTDIR\modules
324   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
325   File /nonfatal /a /r ..\..\inkscape\modules\*.*
326   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
327   SetOutPath $INSTDIR\python
328   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
329   File /nonfatal /a /r ..\..\inkscape\python\*.*
330   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
331 !endif
332 SectionEnd ; SecCore }}}
334 Section $(GTKFiles) SecGTK ; Mandatory GTK files section {{{
335   SectionIn 1 2 3 RO
336 !ifndef DUMMYINSTALL
337   DetailPrint "Installing GTK files..."
338   SetOutPath $INSTDIR
339   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
340   SetOverwrite on
341   File /a /r ..\..\inkscape\*.dll
342   File /a /r /x locale ..\..\inkscape\lib
343   File /a /r ..\..\inkscape\etc
344   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
345 !endif
346 SectionEnd ; SecGTK }}}
348 Section -SetCurrentUserOnly ; Set the installation to "current user" only by default {{{
349 !ifndef DUMMYINSTALL
350   StrCpy $MultiUser 0
351   SetShellVarContext current
352 !endif
353 SectionEnd ; -SetCurrentUserOnly }}}
355 Section $(Alluser) SecAlluser ; Then offer the user the option to make it global (default) {{{
356   SectionIn 1 2 3
357 !ifndef DUMMYINSTALL
358   ; disable this option in Win95/Win98/WinME
359   StrCpy $MultiUser 1
360   DetailPrint "Installing in administrator mode (registry root will be HKLM)"
361   SetShellVarContext all
362 !endif
363 SectionEnd ; SecAllUser }}}
365 SectionGroup "$(Shortcuts)" SecShortcuts ; Create shortcuts for the user {{{
367 Section $(Desktop) SecDesktop ; Desktop shortcut {{{
368 !ifndef DUMMYINSTALL
369   CreateShortCut $DESKTOP\Inkscape.lnk $INSTDIR\inkscape.exe
370 !endif
371 SectionEnd ; SecDesktop }}}
373 Section $(Quicklaunch) SecQuickLaunch ; Quick Launch shortcut {{{
374 !ifndef DUMMYINSTALL
375   ${IfThen} $QUICKLAUNCH != $TEMP ${|} CreateShortCut $QUICKLAUNCH\Inkscape.lnk $INSTDIR\inkscape.exe ${|}
376 !endif
377 SectionEnd ; SecQuickLaunch }}}
379 Section $(SVGWriter) SecSVGWriter ; Register Inkscape as the default application for .svg[z] {{{
380   SectionIn 1 2 3
381 !ifndef DUMMYINSTALL
382   DetailPrint "Associating SVG files with Inkscape"
383   StrCpy $3 svg
384   ${For} $2 0 1
385     ${IfThen} $2 = 1 ${|} StrCpy $3 $3z ${|}
386     ReadRegStr $0 HKCR ".$3" ""
387     ${If} $0 == ""
388       StrCpy $0 "$3file"
389       WriteRegStr HKCR ".$3" "" $0
390       WriteRegStr HKCR $0 "" "Scalable Vector Graphics file"
391     ${EndIf}
392     WriteRegStr HKCR $0\shell\edit\command "" `"$INSTDIR\Inkscape.exe" "%1"`
393   ${Next}
394 !endif
395 SectionEnd ; SecSVGWriter }}}
397 Section $(ContextMenu) SecContextMenu ; Put Inkscape in the .svg[z] context menus (but not as default) {{{
398   SectionIn 1 2 3
399 !ifndef DUMMYINSTALL
400   DetailPrint "Adding Inkscape to SVG file context menu"
401   ReadRegStr $0 HKCR .svg ""
402   ${If} $0 == ""
403     StrCpy $0 svgfile
404     WriteRegStr HKCR .svg "" $0
405     WriteRegStr HKCR $0 "" "Scalable Vector Graphics file"
406   ${EndIf}
407   WriteRegStr HKCR $0\shell\Inkscape\command "" `"$INSTDIR\Inkscape.exe" "%1"`
409   ReadRegStr $0 HKCR .svgz ""
410   ${If} $0 == ""
411     StrCpy $0 svgzfile
412     WriteRegStr HKCR .svgz "" $0
413     WriteRegStr HKCR $0 "" "Scalable Vector Graphics file"
414   ${EndIf}
415   WriteRegStr HKCR $0\shell\Inkscape\command "" `"$INSTDIR\Inkscape.exe" "%1"`
416 !endif
417 SectionEnd ; SecContextMenu }}}
419 SectionGroupEnd ; SecShortcuts }}}
421 Section /o "$(DeletePrefs)" SecPrefs ; Delete user preferences before installation {{{
422 !ifndef DUMMYINSTALL
423   !insertmacro delprefs
424 !endif
425 SectionEnd ; SecPrefs }}}
427 SectionGroup "$(Addfiles)" SecAddfiles ; Additional files {{{
429 Section $(Examples) SecExamples ; Install example SVG files {{{
430   SectionIn 1 2
431 !ifndef DUMMYINSTALL
432   SetOutPath $INSTDIR\share
433   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
434   File /nonfatal /a /r /x *.??*.???* ..\..\inkscape\share\examples
435   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
436 !endif
437 SectionEnd ; SecExamples }}}
439 Section $(Tutorials) SecTutorials ; Install tutorials {{{
440   SectionIn 1 2
441 !ifndef DUMMYINSTALL
442   SetOutPath $INSTDIR\share
443   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
444   File /nonfatal /a /r /x *.??*.???* ..\..\inkscape\share\tutorials
445   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
446 !endif
447 SectionEnd ; SecTutorials }}}
449 SectionGroupEnd ; SecAddfiles }}}
451 SectionGroup "$(Languages)" SecLanguages ; Languages sections {{{
452   !macro Language SecName lng ; A macro to create each section {{{
453     Section /o "$(lng_${lng}) (${lng})" Sec${SecName}
454       ;SectionIn 1 2 3
455     !ifndef DUMMYINSTALL
456       SetOutPath $INSTDIR
457       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
458       File /nonfatal /a ..\..\inkscape\*.${lng}.txt ; FIXME: remove this?  No such files.
459       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
460       SetOutPath $INSTDIR\locale
461       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
462       File /nonfatal /a /r ..\..\inkscape\locale\${lng}
463       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
464       SetOutPath $INSTDIR\lib\locale
465       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
466       File /nonfatal /a /r ..\..\inkscape\lib\locale\${lng}
467       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
468       SetOutPath $INSTDIR\share\clipart
469       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
470       File /nonfatal /a /r ..\..\inkscape\share\clipart\*.${lng}.svg
471       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
472       ; the keyboard tables
473       SetOutPath $INSTDIR\share\screens
474       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
475       File /nonfatal /a /r ..\..\inkscape\share\screens\*.${lng}.svg
476       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
477       SetOutPath $INSTDIR\share\templates
478       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
479       File /nonfatal /a /r ..\..\inkscape\share\templates\*.${lng}.svg
480       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
481       SetOutPath $INSTDIR\doc
482       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
483       File /nonfatal /a /r ..\..\inkscape\doc\keys.${lng}.xml
484       File /nonfatal /a /r ..\..\inkscape\doc\keys.${lng}.html
485       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
486       SectionGetFlags ${SecTutorials} $R1
487       IntOp $R1 $R1 & ${SF_SELECTED}
488       ${If} $R1 >= ${SF_SELECTED}
489         SetOutPath $INSTDIR\share\tutorials
490         !insertmacro UNINSTALL.LOG_OPEN_INSTALL
491         File /nonfatal /a ..\..\inkscape\share\tutorials\*.${lng}.*
492         !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
493       ${EndIf}
494     !endif
495     SectionEnd
496   !macroend ; Language }}}
498   ; Now create each section with the Language macro {{{
499   !insertmacro Language Amharic           am
500   !insertmacro Language Arabic            ar
501   !insertmacro Language Azerbaijani       az
502   !insertmacro Language Byelorussian      be
503   !insertmacro Language Bulgarian         bg
504   !insertmacro Language Bengali           bn
505   !insertmacro Language Breton            br
506   !insertmacro Language Catalan           ca
507   !insertmacro Language CatalanValencia   ca@valencia
508   !insertmacro Language Czech             cs
509   !insertmacro Language Danish            da
510   !insertmacro Language German            de
511   !insertmacro Language Dzongkha          dz
512   !insertmacro Language Greek             el
513   !insertmacro Language EnglishAustralian en_AU
514   !insertmacro Language EnglishCanadian   en_CA
515   !insertmacro Language EnglishBritain    en_GB
516   !insertmacro Language EnglishPiglatin   en_US@piglatin
517   !insertmacro Language Esperanto         eo
518   !insertmacro Language Spanish           es
519   !insertmacro Language SpanishMexico     es_MX
520   !insertmacro Language Estonian          et
521   !insertmacro Language Basque            eu
522   !insertmacro Language French            fr
523   !insertmacro Language Finnish           fi
524   !insertmacro Language Irish             ga
525   !insertmacro Language Gallegan          gl
526   !insertmacro Language Hebrew            he
527   !insertmacro Language Croatian          hr
528   !insertmacro Language Hungarian         hu
529   !insertmacro Language Indonesian        id
530   !insertmacro Language Italian           it
531   !insertmacro Language Japanese          ja
532   !insertmacro Language Khmer             km
533   !insertmacro Language Korean            ko
534   !insertmacro Language Lithuanian        lt
535   !insertmacro Language Mongolian         mn
536   !insertmacro Language Macedonian        mk
537   !insertmacro Language NorwegianBokmal   nb
538   !insertmacro Language Nepali            ne
539   !insertmacro Language Dutch             nl
540   !insertmacro Language NorwegianNynorsk  nn
541   !insertmacro Language Panjabi           pa
542   !insertmacro Language Polish            pl
543   !insertmacro Language Portuguese        pt
544   !insertmacro Language PortugueseBrazil  pt_BR
545   !insertmacro Language Romanian          ro
546   !insertmacro Language Russian           ru
547   !insertmacro Language Kinyarwanda       rw
548   !insertmacro Language Slovak            sk
549   !insertmacro Language Slovenian         sl
550   !insertmacro Language Albanian          sq
551   !insertmacro Language Serbian           sr
552   !insertmacro Language SerbianLatin      sr@latin
553   !insertmacro Language Swedish           sv
554   !insertmacro Language Thai              th
555   !insertmacro Language Turkish           tr
556   !insertmacro Language Ukrainian         uk
557   !insertmacro Language Vietnamese        vi
558   !insertmacro Language ChineseSimplified zh_CN
559   !insertmacro Language ChineseTaiwan     zh_TW
560   ; }}}
561 SectionGroupEnd ; SecLanguages }}}
563 Section -FinalizeInstallation ; Hidden, mandatory section to finalize installation {{{
564 !ifndef DUMMYINSTALL
565   DetailPrint "Finalizing installation"
566   ${IfThen} $MultiUser  = 1 ${|} SetShellVarContext all ${|}
567   ${IfThen} $MultiUser != 1 ${|} SetShellVarContext current ${|}
569   WriteRegStr SHCTX "${INSTDIR_KEY}" ""           $INSTDIR\inkscape.exe
570   WriteRegStr SHCTX "${INSTDIR_KEY}" MultiUser    $MultiUser
571   WriteRegStr SHCTX "${INSTDIR_KEY}" askMultiUser $askMultiUser
572   WriteRegStr SHCTX "${INSTDIR_KEY}" User         $User
574   ; start menu entries
575   CreateShortcut $SMPROGRAMS\Inkscape.lnk $INSTDIR\inkscape.exe
577   ; uninstall settings
578   ; WriteUninstaller $INSTDIR\uninst.exe
579   WriteRegExpandStr SHCTX "${UNINST_KEY}" UninstallString ${UNINST_EXE}
580   WriteRegExpandStr SHCTX "${UNINST_KEY}" InstallDir      $INSTDIR
581   WriteRegExpandStr SHCTX "${UNINST_KEY}" InstallLocation $INSTDIR
582   WriteRegStr       SHCTX "${UNINST_KEY}" DisplayName     "Inkscape ${INKSCAPE_VERSION}"
583   WriteRegStr       SHCTX "${UNINST_KEY}" DisplayIcon     $INSTDIR\Inkscape.exe,0
584   WriteRegStr       SHCTX "${UNINST_KEY}" DisplayVersion  ${INKSCAPE_VERSION}
585   WriteRegDWORD     SHCTX "${UNINST_KEY}" NoModify        1
586   WriteRegDWORD     SHCTX "${UNINST_KEY}" NoRepair        1
588   ;create/update log always within .onInstSuccess function
589   !insertmacro UNINSTALL.LOG_UPDATE_INSTALL
591   DetailPrint "Creating MD5 checksums"
592   ClearErrors
593   FileOpen $0 $INSTDIR\Uninstall.dat r
594   FileOpen $9 $INSTDIR\Uninstall.log w
595   ${IfNot} ${Errors}
596     ${Do}
597       ClearErrors
598       FileRead $0 $1
599       ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
600       StrCpy $1 $1 -2
601       md5dll::GetMD5File /NOUNLOAD $1
602       Pop $2
603       ${IfThen} $2 != "" ${|} FileWrite $9 "$2  $1$\r$\n" ${|}
604     ${Loop}
605   ${EndIf}
606   FileClose $0
607   FileClose $9
608   ; Not needed any more
609   Delete $INSTDIR\Uninstall.dat
610 !endif
611 SectionEnd ; -FinalizeInstallation }}}
613 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN ; Section descriptions {{{
614   !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(CoreDesc)"
615   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} "$(GTKFilesDesc)"
616   !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} "$(ShortcutsDesc)"
617   !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} "$(AlluserDesc)"
618   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(DesktopDesc)"
619   !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} "$(QuicklaunchDesc)"
620   !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} "$(SVGWriterDesc)"
621   !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} "$(ContextMenuDesc)"
622   !insertmacro MUI_DESCRIPTION_TEXT ${SecPrefs} "$(DeletePrefsDesc)"
623   !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} "$(AddfilesDesc)"
624   !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} "$(ExamplesDesc)"
625   !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} "$(TutorialsDesc)"
626   !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} "$(LanguagesDesc)"
627 !insertmacro MUI_FUNCTION_DESCRIPTION_END ; Section descriptions }}}
630 Function .onInit ; initialise the installer {{{2
631   ; This code will be executed before the sections, but due to the
632   ; language code in the sections it must come after it in the code.
634   ; Language detection {{{
635   !insertmacro MUI_LANGDLL_DISPLAY
637   !macro LanguageAutoSelect SecName LocaleID
638     ${If} $LANGUAGE = ${LocaleID}
639       SectionGetFlags ${Sec${SecName}} $0
640       IntOp $0 $0 | ${SF_SELECTED}
641       SectionSetFlags ${Sec${SecName}} $0
642     ${EndIf}
643   !macroend
645   ; No need for English to be detected as it's the default
646   !insertmacro LanguageAutoSelect Breton        1150
647   !insertmacro LanguageAutoSelect Catalan       1027
648   !insertmacro LanguageAutoSelect Czech         1029
649   !insertmacro LanguageAutoSelect Finnish       1035
650   !insertmacro LanguageAutoSelect French        1036
651   !insertmacro LanguageAutoSelect Gallegan      1110 ; Galician, but section is called Gallegan
652   !insertmacro LanguageAutoSelect German        1031
653   !insertmacro LanguageAutoSelect Indonesian    1057
654   !insertmacro LanguageAutoSelect Italian       1040
655   !insertmacro LanguageAutoSelect Japanese      1041
656   !insertmacro LanguageAutoSelect Polish        1045
657   !insertmacro LanguageAutoSelect Romanian      1048
658   !insertmacro LanguageAutoSelect Russian       1049
659   !insertmacro LanguageAutoSelect Slovak        1051
660   !insertmacro LanguageAutoSelect Slovenian     1060
661   !insertmacro LanguageAutoSelect Spanish       1034
662   !insertmacro LanguageAutoSelect ChineseTaiwan 1028 ; TradChinese, but section is called ChineseTaiwan
663   ; End of language detection }}}
665   !insertmacro UNINSTALL.LOG_PREPARE_INSTALL ; prepare advanced uninstallation log script
667   ;Extract InstallOptions INI files
668   StrCpy $AskMultiUser 1
669   StrCpy $MultiUser 0
670   ; this resets AskMultiUser if Win95/98/ME
671   ClearErrors
672   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
673   ${If} ${Errors}
674     ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
675     StrCpy $R0 $R0 1
676     ${IfThen} $R0 = 4 ${|} StrCpy $AskMultiUser 0 ${|}
677   ${EndIf}
679   ; hide all user section if ME/9x
680   ${IfThen} $AskMultiUser != 1 ${|} SectionSetText ${SecAlluser} "" ${|}
682   ; hide if quick launch if not available
683   ${IfThen} $QUICKLAUNCH == $TEMP ${|} SectionSetText ${SecQuicklaunch} "" ${|}
685   ; Check for administrative privileges {{{
686   ClearErrors
687   UserInfo::GetName
688   ${If} ${Errors}
689     ; This one means you don't need to care about admin or
690     ; not admin because Windows 9x doesn't either
691     ${IfCmd} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(NOT_SUPPORTED)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${||} Quit ${|}
692   ${Else}
693     Pop $User
694     UserInfo::GetAccountType
695     Pop $1
696     ${If} $1 != Admin
697     ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(NO_ADMIN)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
698       Quit
699     ${EndIf}
700   ${EndIf} ; }}}
702   ; Detect an Inkscape installation by another user {{{
703   ReadRegStr $0 HKLM "${INSTDIR_KEY}" User                              ; first global...
704   ${IfThen} $0 == "" ${|} ReadRegStr $0 HKCU "${INSTDIR_KEY}" User ${|} ; then current user
705   ${If} $0 != ""
706   ${AndIf} $0 != $User
707   ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(DIFFERENT_USER)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
708     Quit
709   ${EndIf} ; }}}
711   ; Request uninstallation of an old Inkscape installation {{{
712   ReadRegStr $R0 HKLM "${UNINST_KEY}" UninstallString
713   ${IfThen} $R0 == "" ${|} ReadRegStr $R0 HKCU "${UNINST_KEY}" UninstallString ${|}
714   ${If} $R0 != ""
715   ${AndIf} ${Cmd} ${|} MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(WANT_UNINSTALL_BEFORE)" /SD IDNO IDYES ${|}
716     ExecWait $R0
717   ${EndIf} ; }}}
719   ; Process command-line arguments (for automation) {{{
720   !echo `Creating code to process command-line arguments...`
721   !verbose push
722   !verbose 3
723   ${GetParameters} $CMDARGS
725   !macro Parameter key Section
726     ${GetOptions} $CMDARGS /${key}= $1
727     ${If} $1 == OFF
728       SectionGetFlags ${Section} $0
729       IntOp $2 ${SF_SELECTED} ~
730       IntOp $0 $0 & $2
731       SectionSetFlags ${Section} $0
732     ${EndIf}
733     ${If} $1 == ON
734       SectionGetFlags ${Section} $0
735       IntOp $0 $0 | ${SF_SELECTED}
736       SectionSetFlags ${Section} $0
737     ${EndIf}
738   !macroend
740   !insertmacro Parameter GTK            ${SecGTK}
741   !insertmacro Parameter SHORTCUTS      ${secShortcuts}
742   !insertmacro Parameter ALLUSER        ${SecAlluser}
743   !insertmacro Parameter DESKTOP        ${SecDesktop}
744   !insertmacro Parameter QUICKLAUNCH    ${SecQUICKlaunch}
745   !insertmacro Parameter SVGEDITOR      ${SecSVGWriter}
746   !insertmacro Parameter CONTEXTMENUE   ${SecContextMenu}
747   !insertmacro Parameter PREFERENCES    ${SecPrefs}
748   !insertmacro Parameter ADDFILES       ${SecAddfiles}
749   !insertmacro Parameter EXAMPLES       ${SecExamples}
750   !insertmacro Parameter TUTORIALS      ${SecTutorials}
751   !insertmacro Parameter LANGUAGES      ${SecLanguages}
752   !insertmacro Parameter am             ${SecAmharic}
753   !insertmacro Parameter ar             ${SecArabic}
754   !insertmacro Parameter az             ${SecAzerbaijani}
755   !insertmacro Parameter be             ${SecByelorussian}
756   !insertmacro Parameter bg             ${SecBulgarian}
757   !insertmacro Parameter bn             ${SecBengali}
758   !insertmacro Parameter br             ${SecBreton}
759   !insertmacro Parameter ca             ${SecCatalan}
760   !insertmacro Parameter ca@valencia    ${SecCatalanValencia}
761   !insertmacro Parameter cs             ${SecCzech}
762   !insertmacro Parameter da             ${SecDanish}
763   !insertmacro Parameter de             ${SecGerman}
764   !insertmacro Parameter dz             ${SecDzongkha}
765   !insertmacro Parameter el             ${SecGreek}
766   !insertmacro Parameter en_AU          ${SecEnglishAustralian}
767   !insertmacro Parameter en_CA          ${SecEnglishCanadian}
768   !insertmacro Parameter en_GB          ${SecEnglishBritain}
769   !insertmacro Parameter en_US@piglatin ${SecEnglishPiglatin}
770   !insertmacro Parameter eo             ${SecEsperanto}
771   !insertmacro Parameter es             ${SecSpanish}
772   !insertmacro Parameter es_MX          ${SecSpanishMexico}
773   !insertmacro Parameter et             ${SecEstonian}
774   !insertmacro Parameter eu             ${SecBasque}
775   !insertmacro Parameter fi             ${SecFinnish}
776   !insertmacro Parameter fr             ${SecFrench}
777   !insertmacro Parameter ga             ${SecIrish}
778   !insertmacro Parameter gl             ${SecGallegan}
779   !insertmacro Parameter he             ${SecHebrew}
780   !insertmacro Parameter hr             ${SecCroatian}
781   !insertmacro Parameter hu             ${SecHungarian}
782   !insertmacro Parameter id             ${SecIndonesian}
783   !insertmacro Parameter it             ${SecItalian}
784   !insertmacro Parameter ja             ${SecJapanese}
785   !insertmacro Parameter km             ${SecKhmer}
786   !insertmacro Parameter ko             ${SecKorean}
787   !insertmacro Parameter lt             ${SecLithuanian}
788   !insertmacro Parameter mk             ${SecMacedonian}
789   !insertmacro Parameter mn             ${SecMongolian}
790   !insertmacro Parameter nb             ${SecNorwegianBokmal}
791   !insertmacro Parameter ne             ${SecNepali}
792   !insertmacro Parameter nl             ${SecDutch}
793   !insertmacro Parameter nn             ${SecNorwegianNynorsk}
794   !insertmacro Parameter pa             ${SecPanjabi}
795   !insertmacro Parameter pl             ${SecPolish}
796   !insertmacro Parameter pt             ${SecPortuguese}
797   !insertmacro Parameter pt_BR          ${SecPortugueseBrazil}
798   !insertmacro Parameter ro             ${SecRomanian}
799   !insertmacro Parameter ru             ${SecRussian}
800   !insertmacro Parameter rw             ${SecKinyarwanda}
801   !insertmacro Parameter sk             ${SecSlovak}
802   !insertmacro Parameter sl             ${SecSlovenian}
803   !insertmacro Parameter sq             ${SecAlbanian}
804   !insertmacro Parameter sr             ${SecSerbian}
805   !insertmacro Parameter sr@latin       ${SecSerbianLatin}
806   !insertmacro Parameter sv             ${SecSwedish}
807   !insertmacro Parameter th             ${SecThai}
808   !insertmacro Parameter tr             ${SecTurkish}
809   !insertmacro Parameter uk             ${SecUkrainian}
810   !insertmacro Parameter vi             ${SecVietnamese}
811   !insertmacro Parameter zh_CN          ${SecChineseSimplified}
812   !insertmacro Parameter zh_TW          ${SecChineseTaiwan}
814   ClearErrors
815   ${GetOptions} $CMDARGS /? $1
816   ${IfNot} ${Errors}
817     MessageBox MB_OK "Possible parameters for installer:$\r$\n \
818       /?: this help screen$\r$\n \
819       /S: silent$\r$\n \
820       /D=(directory): where to install Inkscape$\r$\n \
821       /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
822       /SHORTCUTS=(OFF/ON): shortcuts to start Inkscape$\r$\n \
823       /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
824       /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
825       /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
826       /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
827       /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
828       /PREFERENCES=(OFF/ON): delete users preference files$\r$\n \
829       /ADDFILES=(OFF/ON): additional files$\r$\n \
830       /EXAMPLES=(OFF/ON): examples$\r$\n \
831       /TUTORIALS=(OFF/ON): tutorials$\r$\n \
832       /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
833       /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
834     Abort
835     !verbose pop
836   ${EndIf} ; }}}
837 FunctionEnd ; .onInit }}}
838 ; Uninstaller code {{{1
839 Function un.onInit ; initialise uninstaller {{{
840   ;begin uninstall, could be added on top of uninstall section instead
841   ;!insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
842   ${IfNot} ${FileExists} $INSTDIR\uninstall.log
843     MessageBox MB_OK|MB_ICONEXCLAMATION "$(UninstallLogNotFound)" /SD IDOK
844     Quit
845   ${EndIf}
846   ClearErrors
847   StrCpy $User ""
848   UserInfo::GetName
849   ${IfNot} ${Errors}
850     Pop $0
851     StrCpy $User $0
852   ${EndIf}
853   StrCpy $askMultiUser 1
854   StrCpy $MultiUser 1
856   ; Test if this was a multiuser installation
857     ReadRegStr $0            HKLM "${INSTDIR_KEY}" ""
858   ${If} $0 == $INSTDIR\inkscape.exe
859     ReadRegStr $MultiUser    HKLM "${INSTDIR_KEY}" MultiUser
860     ReadRegStr $askMultiUser HKLM "${INSTDIR_KEY}" askMultiUser
861     ReadRegStr $0            HKLM "${INSTDIR_KEY}" User
862   ${Else}
863     ReadRegStr $MultiUser    HKCU "${INSTDIR_KEY}" MultiUser
864     ReadRegStr $askMultiUser HKCU "${INSTDIR_KEY}" askMultiUser
865     ReadRegStr $0            HKCU "${INSTDIR_KEY}" User
866   ${EndIf}
867   ;check user if applicable
868   ${If} $0 != ""
869   ${AndIf} $0 != $User
870   ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(DIFFERENT_USER)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
871     Quit
872   ${EndIf}
874   !insertmacro MUI_INSTALLOPTIONS_EXTRACT inkscape.nsi.uninstall
876   SetShellVarContext all
877   ${IfThen} $MultiUser = 0 ${|} SetShellVarContext current ${|}
878 FunctionEnd ; un.onInit }}}
880 Function un.CustomPageUninstall ; {{{
881   !insertmacro MUI_HEADER_TEXT "$(UInstOpt)" "$(UInstOpt1)"
882   !insertmacro MUI_INSTALLOPTIONS_WRITE inkscape.nsi.uninstall "Field 1" Text "$APPDATA\Inkscape\"
883   !insertmacro MUI_INSTALLOPTIONS_WRITE inkscape.nsi.uninstall "Field 2" Text "$(PurgePrefs)"
884   !insertmacro MUI_INSTALLOPTIONS_DISPLAY inkscape.nsi.uninstall
885   !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser inkscape.nsi.uninstall "Field 2" State
886 FunctionEnd ; un.CustomPageUninstall }}}
888 Section Uninstall ; do the uninstalling {{{
889 !ifndef DUMMYINSTALL
890   ; remove personal settings
891   Delete $APPDATA\Inkscape\extension-errors.log
892   ${If} $MultiUser = 0
893     DetailPrint "Purging personal settings in $APPDATA\Inkscape"
894     ;RMDir /r $APPDATA\Inkscape
895     !insertmacro delprefs
896   ${EndIf}
898   ; Remove file associations for svg editor
899   StrCpy $3 svg
900   ${For} $2 0 1
901     ${IfThen} $2 = 1 ${|} StrCpy $3 $3z ${|}
902     DetailPrint "Removing file associations for $3 editor"
903     ClearErrors
904     ReadRegStr $0 HKCR .$3 ""
905     ${IfNot} ${Errors}
906       ReadRegStr $1 HKCR $0\shell\edit\command ""
907       ${If} $1 == `"$INSTDIR\Inkscape.exe" "%1"`
908         DeleteRegKey HKCR $0\shell\edit\command
909       ${EndIf}
911       ClearErrors
912       ReadRegStr $1 HKCR $0\shell\open\command ""
913       ${If} $1 == `"$INSTDIR\Inkscape.exe" "%1"`
914         DeleteRegKey HKCR $0\shell\open\command
915       ${EndIf}
917       DeleteRegKey HKCR $0\shell\Inkscape
918       DeleteRegKey /ifempty HKCR $0\shell\edit
919       DeleteRegKey /ifempty HKCR $0\shell\open
920       DeleteRegKey /ifempty HKCR $0\shell
921       DeleteRegKey /ifempty HKCR $0
922       DeleteRegKey /ifempty HKCR .$3
923     ${EndIf}
924   ${Next}
926   SetShellVarContext all
927   DeleteRegKey SHCTX "${INSTDIR_KEY}"
928   DeleteRegKey SHCTX "${UNINST_KEY}"
929   Delete $DESKTOP\Inkscape.lnk
930   Delete $QUICKLAUNCH\Inkscape.lnk
931   Delete $SMPROGRAMS\Inkscape.lnk
932   ;just in case they are still there
933   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
934   Delete  $SMPROGRAMS\Inkscape\Inkscape.lnk
935   RMDir   $SMPROGRAMS\Inkscape
937   SetShellVarContext current
938   DeleteRegKey SHCTX "${INSTDIR_KEY}"
939   DeleteRegKey SHCTX "${UNINST_KEY}"
940   Delete $DESKTOP\Inkscape.lnk
941   Delete $QUICKLAUNCH\Inkscape.lnk
942   Delete $SMPROGRAMS\Inkscape.lnk
943   ;just in case they are still there
944   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
945   Delete $SMPROGRAMS\Inkscape\Inkscape.lnk
946   RMDir  $SMPROGRAMS\Inkscape
948   InitPluginsDir
949   SetPluginUnload manual
951   ClearErrors
952   FileOpen $0 $INSTDIR\uninstall.log r
953   ${If} ${Errors} ;else uninstallnotfound
954     MessageBox MB_OK|MB_ICONEXCLAMATION "$(UninstallLogNotFound)" /SD IDOK
955   ${Else}
956     ${Do}
957       ClearErrors
958       FileRead $0 $1
959       ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
960       ; cat the line into md5 and filename
961       StrLen $2 $1
962       ${IfThen} $2 <= 35 ${|} ${Continue} ${|}
963       StrCpy $3 $1 32
964       StrCpy $filename $1 $2-36 34 ;remove trailing CR/LF
965       StrCpy $filename $filename -2
966       ; $3 = MD5 when installed, then deletion choice
967       ; $filename = file
968       ; $5 = MD5 now
969       ; $6 = always/never remove files touched by user
971       ${If} ${FileExists} $filename
972         ${If} $6 == always
973           StrCpy $3 2
974         ${Else}
975           md5dll::GetMD5File /NOUNLOAD $filename
976           Pop $5 ;md5 of file
977           ${If} $3 == $5
978             StrCpy $3 1 ; yes
979           ${ElseIf} $6 != never
980             ; the md5 sums does not match so we ask
981             messagebox::show MB_DEFBUTTON3|MB_TOPMOST "" 0,103 \
982               "$(FileChanged)" "$(Yes)" "$(AlwaysYes)" "$(No)" "$(AlwaysNo)"
983             Pop $3
984             ${IfThen} $3 = 2 ${|} StrCpy $6 always ${|}
985             ${IfThen} $3 = 4 ${|} StrCpy $6 never ${|}
986           ${EndIf}
987         ${EndIf}
989         ${If}   $3 = 1 ; yes
990         ${OrIf} $3 = 2 ; always
991           ; Remove File
992           ClearErrors
993           Delete $filename
994           ;now recursivly remove the path
995           ${Do}
996             ClearErrors
997             ${un.GetParent} $filename $filename
998             ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
999             RMDir $filename
1000             ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
1001           ${Loop}
1002         ${EndIf}
1003       ${EndIf}
1004     ${Loop}
1005   ${EndIf}
1006   FileClose $0
1007   Delete $INSTDIR\uninstall.log
1008   Delete $INSTDIR\uninstall.exe
1009   ; remove empty directories
1010   RMDir $INSTDIR\lib\locale
1011   RMDir $INSTDIR\lib
1012   RMDir $INSTDIR\data
1013   RMDir $INSTDIR\doc
1014   RMDir $INSTDIR\modules
1015   RMDir $INSTDIR\plugins
1016   RMDir $INSTDIR
1017   SetAutoClose false
1018 !endif
1019 SectionEnd ; Uninstall }}}
1020 ; }}}
1022 ; This file has been optimised for use in Vim with folding.
1023 ; (If you can't cope, :set nofoldenable) vim:fen:fdm=marker