Code

Packaging. New Brazilian Portuguese NSH file. Set trunk package date to 2011.
[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 BrazilianPortuguese
119 !insertmacro INKLANGFILE Breton
120 !insertmacro INKLANGFILE Catalan
121 !insertmacro INKLANGFILE Czech
122 !insertmacro INKLANGFILE Dutch
123 !insertmacro INKLANGFILE Finnish
124 !insertmacro INKLANGFILE French
125 !insertmacro INKLANGFILE Galician
126 !insertmacro INKLANGFILE German
127 !insertmacro INKLANGFILE Indonesian
128 !insertmacro INKLANGFILE Italian
129 !insertmacro INKLANGFILE Japanese
130 !insertmacro INKLANGFILE Polish
131 !insertmacro INKLANGFILE Romanian
132 !insertmacro INKLANGFILE Russian
133 !insertmacro INKLANGFILE Slovak
134 !insertmacro INKLANGFILE Slovenian
135 !insertmacro INKLANGFILE Spanish
136 !insertmacro INKLANGFILE SimpChinese
137 !insertmacro INKLANGFILE TradChinese
138 !insertmacro INKLANGFILE Ukrainian
139 !verbose pop
141 ReserveFile inkscape.nsi.uninstall
142 ReserveFile "${NSISDIR}\Plugins\UserInfo.dll"
143 !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
145 ; #######################################
146 ; SETTINGS
147 ; #######################################
149 ; Product details (version, name, registry keys etc.) {{{2
150 ; Find the version number in inkscape-version.cpp (e.g. 0.47+devel) {{{3
151 !ifndef INKSCAPE_VERSION
152   ; Official release format (no newlines)
153   !searchparse /noerrors /file ..\..\src\inkscape-version.cpp `namespace Inkscape {  char const *version_string = "` INKSCAPE_VERSION ` r` BZR_REVISION `";  }`
154   !ifndef INKSCAPE_VERSION
155     ; Other format; sorry, it has to be done in two steps.
156     !searchparse /noerrors /file ..\..\src\inkscape-version.cpp `char const *version_string = "` INKSCAPE_VERSION `";`
157     !searchparse /noerrors `${INKSCAPE_VERSION}` `` INKSCAPE_VERSION ` r` BZR_REVISION
158     !ifndef INKSCAPE_VERSION
159       !error "INKSCAPE_VERSION not defined and unable to get version number from ..\..\src\inkscape-version.cpp!"
160     !endif
161   !endif
162 !endif
163 !echo `Got version number from ..\..\src\inkscape-version.cpp: ${INKSCAPE_VERSION}`
164 !define FILENAME Inkscape-${INKSCAPE_VERSION}
165 !define BrandingText `Inkscape ${INKSCAPE_VERSION}`
167 ; Check for the Bazaar revision number for lp:inkscape {{{3
168 ${!ifexist} ..\..\.bzr\branch\last-revision
169   !if `${BZR_REVISION}` == ``
170     !undef BZR_REVISION
171   !endif
172   !ifndef BZR_REVISION
173     !searchparse /noerrors /file ..\..\.bzr\branch\last-revision "" BZR_REVISION " "
174   !endif
175 !endif
177 ; Check for devel builds and clear up bzr revision number define {{{3
178 !searchparse /noerrors ${INKSCAPE_VERSION} "" INKSCAPE_VERSION_NUMBER "+devel"
179 !if ${INKSCAPE_VERSION_NUMBER} != ${INKSCAPE_VERSION}
180   !define DEVEL
181 !endif
182 !if `${BZR_REVISION}` == ``
183   !undef BZR_REVISION
184 !endif
185 ; For releases like 0.48pre1, throw away the preN. It's too tricky to deal with
186 ; it properly so I'll leave it alone. It's just a pre-release, so it doesn't
187 ; really matter. So long as the final release works properly.
188 !ifndef DEVEL
189   !undef INKSCAPE_VERSION_NUMBER
190   !searchparse /noerrors ${INKSCAPE_VERSION} "" INKSCAPE_VERSION_NUMBER "pre" PRE_NUMBER
191 !endif
193 ; Handle display version number and complete X.X version numbers into X.X.X.X {{{3
194 !ifdef DEVEL & BZR_REVISION
195   ${!redef} FILENAME `${FILENAME}-r${BZR_REVISION}`
196   ${!redef} BrandingText `${BrandingText} r${BZR_REVISION}`
197   !define VERSION_X.X.X.X_REVISION ${BZR_REVISION}
198 ; Handle the installer revision number {{{4
199 !else ifdef RELEASE_REVISION
200   ${!redef} FILENAME `${FILENAME}-${RELEASE_REVISION}`
201   ; If we wanted the branding text to be like "Inkscape 0.48pre1 r9505" this'd do it.
202   ;!ifdef BZR_REVISION
203   ;  ${!redef} BrandingText `${BrandingText} r${BZR_REVISION}`
204   ;!endif
205   !if `${RELEASE_REVISION}` != `1`
206     ${!redef} BrandingText `${BrandingText}, revision ${RELEASE_REVISION}`
207   !endif
208   !define VERSION_X.X.X.X_REVISION ${RELEASE_REVISION}
209 !else
210   !define VERSION_X.X.X.X_REVISION 0
211 !endif
213 ${VersionCompleteXXXN} ${INKSCAPE_VERSION_NUMBER} VERSION_X.X.X.X ${VERSION_X.X.X.X_REVISION}
215 ; Product definitions {{{3
216 !define PRODUCT_NAME "Inkscape" ; TODO: fix up the language files to not use this and kill this line
217 !define INSTDIR_KEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inkscape.exe"
218 !define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Inkscape"
219 ;!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.
220 !define _FILENAME ${FILENAME}.exe
221 !undef FILENAME
222 !define FILENAME ${_FILENAME}
223 !undef _FILENAME
225 ; Product information {{{3
226 Name              `Inkscape`
227 Caption           `Inkscape - $(CaptionDescription)`
228 BrandingText      `${BrandingText}`
229 OutFile           `${FILENAME}`
230 InstallDir        "$PROGRAMFILES\Inkscape"
231 InstallDirRegKey  HKLM "${INSTDIR_KEY}" ""
233 ; Version information {{{3
234 VIProductVersion ${VERSION_X.X.X.X}
235 VIAddVersionKey ProductName Inkscape
236 VIAddVersionKey Comments "Licensed under the GNU GPL"
237 VIAddVersionKey CompanyName inkscape.org
238 VIAddVersionKey LegalCopyright "© 2011 Inkscape"
239 VIAddVersionKey FileDescription Inkscape
240 VIAddVersionKey FileVersion ${VERSION_X.X.X.X}
241 VIAddVersionKey ProductVersion ${VERSION_X.X.X.X}
242 VIAddVersionKey InternalName Inkscape
244 ; Variables {{{2
245 Var askMultiUser
246 Var filename
247 Var MultiUser
248 Var User
249 Var CMDARGS
251 !macro delprefs ; Delete preferences (originally from VLC) {{{2
252   StrCpy $0 0
253   DetailPrint "Deleting personal preferences..."
254   DetailPrint "Finding all users..."
255   ${Do}
256   ; this will loop through all the logged users and "virtual" windows users
257   ; (it looks like users are only present in HKEY_USERS when they are logged in)
258     ClearErrors
259     EnumRegKey $1 HKU "" $0
260     ${IfThen} $1 == "" ${|} ${ExitDo} ${|}
261     IntOp $0 $0 + 1
262     ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
263     ${IfThen} $2 == "" ${|} ${Continue} ${|}
264     DetailPrint "Removing $2\Inkscape"
265     Delete $2\Inkscape\preferences.xml
266     Delete $2\Inkscape\extension-errors.log
267     RMDir  $2\Inkscape
268   ${Loop}
269 !macroend
271 ; Sections (these do the work) {{{2
273 Section -removeInkscape ; Hidden, mandatory section to clean a previous installation {{{
274 !ifndef DUMMYINSTALL
275   ;remove the old Inkscape shortcuts from the startmenu
276   ;just in case they are still there
277   SetShellVarContext current
278   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
279   Delete  $SMPROGRAMS\Inkscape\Inkscape.lnk
280   RMDir   $SMPROGRAMS\Inkscape
281   Delete  $SMPROGRAMS\Inkscape.lnk
282   SetShellVarContext all
283   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
284   Delete  $SMPROGRAMS\Inkscape\Inkscape.lnk
285   RMDir   $SMPROGRAMS\Inkscape
286   Delete  $SMPROGRAMS\Inkscape.lnk
287 !endif
288 SectionEnd ; -removeInkscape }}}
290 Section $(Core) SecCore ; Mandatory Inkscape core files section {{{
291   SectionIn 1 2 3 RO
292 !ifndef DUMMYINSTALL
293   DetailPrint "Installing Inkscape core files..."
294   SetOutPath $INSTDIR
295   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
296   SetOverwrite on
297   SetAutoClose false
299   File           /a    ..\..\inkscape\ink*.exe
300   File           /a    ..\..\inkscape\inkscape.com
301   File           /a    ..\..\inkscape\AUTHORS
302   File           /a    ..\..\inkscape\COPYING
303   File           /a    ..\..\inkscape\COPYING.LIB
304   File           /a    ..\..\inkscape\NEWS
305   File           /a    ..\..\inkscape\gspawn-win32-helper.exe
306   File           /a    ..\..\inkscape\gspawn-win32-helper-console.exe
307   File /nonfatal /a    ..\..\inkscape\HACKING.txt
308   File           /a    ..\..\inkscape\README
309   File /nonfatal /a    ..\..\inkscape\README.txt
310   File           /a    ..\..\inkscape\TRANSLATORS
311   File /nonfatal /a /r ..\..\inkscape\data
312   File /nonfatal /a /r ..\..\inkscape\doc
313   File /nonfatal /a /r ..\..\inkscape\plugins
314   File /nonfatal /a /r /x *.??*.???* /x examples /x tutorials ..\..\inkscape\share
315   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
316   ; this files are added because it slips through the filter
317   SetOutPath $INSTDIR\share\clipart
318   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
319   File /a ..\..\inkscape\share\clipart\inkscape.logo.svg
320   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
321   SetOutPath $INSTDIR\share\icons
322   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
323   File /a ..\..\inkscape\share\icons\inkscape.file.png
324   File /a ..\..\inkscape\share\icons\inkscape.file.svg
325   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
326   SetOutPath $INSTDIR\modules
327   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
328   File /nonfatal /a /r ..\..\inkscape\modules\*.*
329   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
330   SetOutPath $INSTDIR\python
331   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
332   File /nonfatal /a /r ..\..\inkscape\python\*.*
333   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
334 !endif
335 SectionEnd ; SecCore }}}
337 Section $(GTKFiles) SecGTK ; Mandatory GTK files section {{{
338   SectionIn 1 2 3 RO
339 !ifndef DUMMYINSTALL
340   DetailPrint "Installing GTK files..."
341   SetOutPath $INSTDIR
342   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
343   SetOverwrite on
344   File /a /r ..\..\inkscape\*.dll
345   File /a /r /x locale ..\..\inkscape\lib
346   File /a /r ..\..\inkscape\etc
347   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
348 !endif
349 SectionEnd ; SecGTK }}}
351 Section -SetCurrentUserOnly ; Set the installation to "current user" only by default {{{
352 !ifndef DUMMYINSTALL
353   StrCpy $MultiUser 0
354   SetShellVarContext current
355 !endif
356 SectionEnd ; -SetCurrentUserOnly }}}
358 Section $(Alluser) SecAlluser ; Then offer the user the option to make it global (default) {{{
359   SectionIn 1 2 3
360 !ifndef DUMMYINSTALL
361   ; disable this option in Win95/Win98/WinME
362   StrCpy $MultiUser 1
363   DetailPrint "Installing in administrator mode (registry root will be HKLM)"
364   SetShellVarContext all
365 !endif
366 SectionEnd ; SecAllUser }}}
368 SectionGroup "$(Shortcuts)" SecShortcuts ; Create shortcuts for the user {{{
370 Section $(Desktop) SecDesktop ; Desktop shortcut {{{
371 !ifndef DUMMYINSTALL
372   CreateShortCut $DESKTOP\Inkscape.lnk $INSTDIR\inkscape.exe
373 !endif
374 SectionEnd ; SecDesktop }}}
376 Section $(Quicklaunch) SecQuickLaunch ; Quick Launch shortcut {{{
377 !ifndef DUMMYINSTALL
378   ${IfThen} $QUICKLAUNCH != $TEMP ${|} CreateShortCut $QUICKLAUNCH\Inkscape.lnk $INSTDIR\inkscape.exe ${|}
379 !endif
380 SectionEnd ; SecQuickLaunch }}}
382 Section $(SVGWriter) SecSVGWriter ; Register Inkscape as the default application for .svg[z] {{{
383   SectionIn 1 2 3
384 !ifndef DUMMYINSTALL
385   DetailPrint "Associating SVG files with Inkscape"
386   StrCpy $3 svg
387   ${For} $2 0 1
388     ${IfThen} $2 = 1 ${|} StrCpy $3 $3z ${|}
389     ReadRegStr $0 HKCR ".$3" ""
390     ${If} $0 == ""
391       StrCpy $0 "$3file"
392       WriteRegStr HKCR ".$3" "" $0
393       WriteRegStr HKCR $0 "" "Scalable Vector Graphics file"
394     ${EndIf}
395     WriteRegStr HKCR $0\shell\edit\command "" `"$INSTDIR\Inkscape.exe" "%1"`
396   ${Next}
397 !endif
398 SectionEnd ; SecSVGWriter }}}
400 Section $(ContextMenu) SecContextMenu ; Put Inkscape in the .svg[z] context menus (but not as default) {{{
401   SectionIn 1 2 3
402 !ifndef DUMMYINSTALL
403   DetailPrint "Adding Inkscape to SVG file context menu"
404   ReadRegStr $0 HKCR .svg ""
405   ${If} $0 == ""
406     StrCpy $0 svgfile
407     WriteRegStr HKCR .svg "" $0
408     WriteRegStr HKCR $0 "" "Scalable Vector Graphics file"
409   ${EndIf}
410   WriteRegStr HKCR $0\shell\Inkscape\command "" `"$INSTDIR\Inkscape.exe" "%1"`
412   ReadRegStr $0 HKCR .svgz ""
413   ${If} $0 == ""
414     StrCpy $0 svgzfile
415     WriteRegStr HKCR .svgz "" $0
416     WriteRegStr HKCR $0 "" "Scalable Vector Graphics file"
417   ${EndIf}
418   WriteRegStr HKCR $0\shell\Inkscape\command "" `"$INSTDIR\Inkscape.exe" "%1"`
419 !endif
420 SectionEnd ; SecContextMenu }}}
422 SectionGroupEnd ; SecShortcuts }}}
424 Section /o "$(DeletePrefs)" SecPrefs ; Delete user preferences before installation {{{
425 !ifndef DUMMYINSTALL
426   !insertmacro delprefs
427 !endif
428 SectionEnd ; SecPrefs }}}
430 SectionGroup "$(Addfiles)" SecAddfiles ; Additional files {{{
432 Section $(Examples) SecExamples ; Install example SVG files {{{
433   SectionIn 1 2
434 !ifndef DUMMYINSTALL
435   SetOutPath $INSTDIR\share
436   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
437   File /nonfatal /a /r /x *.??*.???* ..\..\inkscape\share\examples
438   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
439 !endif
440 SectionEnd ; SecExamples }}}
442 Section $(Tutorials) SecTutorials ; Install tutorials {{{
443   SectionIn 1 2
444 !ifndef DUMMYINSTALL
445   SetOutPath $INSTDIR\share
446   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
447   File /nonfatal /a /r /x *.??*.???* ..\..\inkscape\share\tutorials
448   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
449 !endif
450 SectionEnd ; SecTutorials }}}
452 SectionGroupEnd ; SecAddfiles }}}
454 SectionGroup "$(Languages)" SecLanguages ; Languages sections {{{
455   !macro Language SecName lng ; A macro to create each section {{{
456     Section /o "$(lng_${lng}) (${lng})" Sec${SecName}
457       ;SectionIn 1 2 3
458     !ifndef DUMMYINSTALL
459       SetOutPath $INSTDIR
460       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
461       File /nonfatal /a ..\..\inkscape\*.${lng}.txt ; FIXME: remove this?  No such files.
462       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
463       SetOutPath $INSTDIR\locale
464       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
465       File /nonfatal /a /r ..\..\inkscape\locale\${lng}
466       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
467       SetOutPath $INSTDIR\lib\locale
468       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
469       File /nonfatal /a /r ..\..\inkscape\lib\locale\${lng}
470       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
471       SetOutPath $INSTDIR\share\clipart
472       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
473       File /nonfatal /a /r ..\..\inkscape\share\clipart\*.${lng}.svg
474       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
475       ; the keyboard tables
476       SetOutPath $INSTDIR\share\screens
477       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
478       File /nonfatal /a /r ..\..\inkscape\share\screens\*.${lng}.svg
479       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
480       SetOutPath $INSTDIR\share\templates
481       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
482       File /nonfatal /a /r ..\..\inkscape\share\templates\*.${lng}.svg
483       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
484       SetOutPath $INSTDIR\doc
485       !insertmacro UNINSTALL.LOG_OPEN_INSTALL
486       File /nonfatal /a /r ..\..\inkscape\doc\keys.${lng}.xml
487       File /nonfatal /a /r ..\..\inkscape\doc\keys.${lng}.html
488       !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
489       SectionGetFlags ${SecTutorials} $R1
490       IntOp $R1 $R1 & ${SF_SELECTED}
491       ${If} $R1 >= ${SF_SELECTED}
492         SetOutPath $INSTDIR\share\tutorials
493         !insertmacro UNINSTALL.LOG_OPEN_INSTALL
494         File /nonfatal /a ..\..\inkscape\share\tutorials\*.${lng}.*
495         !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
496       ${EndIf}
497     !endif
498     SectionEnd
499   !macroend ; Language }}}
501   ; Now create each section with the Language macro {{{
502   !insertmacro Language Amharic           am
503   !insertmacro Language Arabic            ar
504   !insertmacro Language Azerbaijani       az
505   !insertmacro Language Byelorussian      be
506   !insertmacro Language Bulgarian         bg
507   !insertmacro Language Bengali           bn
508   !insertmacro Language Breton            br
509   !insertmacro Language Catalan           ca
510   !insertmacro Language CatalanValencia   ca@valencia
511   !insertmacro Language Czech             cs
512   !insertmacro Language Danish            da
513   !insertmacro Language German            de
514   !insertmacro Language Dzongkha          dz
515   !insertmacro Language Greek             el
516   !insertmacro Language EnglishAustralian en_AU
517   !insertmacro Language EnglishCanadian   en_CA
518   !insertmacro Language EnglishBritain    en_GB
519   !insertmacro Language EnglishPiglatin   en_US@piglatin
520   !insertmacro Language Esperanto         eo
521   !insertmacro Language Spanish           es
522   !insertmacro Language SpanishMexico     es_MX
523   !insertmacro Language Estonian          et
524   !insertmacro Language Basque            eu
525   !insertmacro Language Farsi             fa
526   !insertmacro Language French            fr
527   !insertmacro Language Finnish           fi
528   !insertmacro Language Irish             ga
529   !insertmacro Language Galician          gl
530   !insertmacro Language Hebrew            he
531   !insertmacro Language Croatian          hr
532   !insertmacro Language Hungarian         hu
533   !insertmacro Language Indonesian        id
534   !insertmacro Language Italian           it
535   !insertmacro Language Japanese          ja
536   !insertmacro Language Khmer             km
537   !insertmacro Language Korean            ko
538   !insertmacro Language Lithuanian        lt
539   !insertmacro Language Mongolian         mn
540   !insertmacro Language Macedonian        mk
541   !insertmacro Language NorwegianBokmal   nb
542   !insertmacro Language Nepali            ne
543   !insertmacro Language Dutch             nl
544   !insertmacro Language NorwegianNynorsk  nn
545   !insertmacro Language Panjabi           pa
546   !insertmacro Language Polish            pl
547   !insertmacro Language Portuguese        pt
548   !insertmacro Language PortugueseBrazil  pt_BR
549   !insertmacro Language Romanian          ro
550   !insertmacro Language Russian           ru
551   !insertmacro Language Kinyarwanda       rw
552   !insertmacro Language Slovak            sk
553   !insertmacro Language Slovenian         sl
554   !insertmacro Language Albanian          sq
555   !insertmacro Language Serbian           sr
556   !insertmacro Language SerbianLatin      sr@latin
557   !insertmacro Language Swedish           sv
558   !insertmacro Language Telugu            te_IN
559   !insertmacro Language Thai              th
560   !insertmacro Language Turkish           tr
561   !insertmacro Language Ukrainian         uk
562   !insertmacro Language Vietnamese        vi
563   !insertmacro Language SimpChinese       zh_CN
564   !insertmacro Language TradChinese       zh_TW
565   ; }}}
566 SectionGroupEnd ; SecLanguages }}}
568 Section -FinalizeInstallation ; Hidden, mandatory section to finalize installation {{{
569 !ifndef DUMMYINSTALL
570   DetailPrint "Finalizing installation"
571   ${IfThen} $MultiUser  = 1 ${|} SetShellVarContext all ${|}
572   ${IfThen} $MultiUser != 1 ${|} SetShellVarContext current ${|}
574   WriteRegStr SHCTX "${INSTDIR_KEY}" ""           $INSTDIR\inkscape.exe
575   WriteRegStr SHCTX "${INSTDIR_KEY}" MultiUser    $MultiUser
576   WriteRegStr SHCTX "${INSTDIR_KEY}" askMultiUser $askMultiUser
577   WriteRegStr SHCTX "${INSTDIR_KEY}" User         $User
579   ; start menu entries
580   CreateShortcut $SMPROGRAMS\Inkscape.lnk $INSTDIR\inkscape.exe
582   ; uninstall settings
583   ; WriteUninstaller $INSTDIR\uninst.exe
584   WriteRegExpandStr SHCTX "${UNINST_KEY}" UninstallString ${UNINST_EXE}
585   WriteRegExpandStr SHCTX "${UNINST_KEY}" InstallDir      $INSTDIR
586   WriteRegExpandStr SHCTX "${UNINST_KEY}" InstallLocation $INSTDIR
587   WriteRegStr       SHCTX "${UNINST_KEY}" DisplayName     "Inkscape ${INKSCAPE_VERSION}"
588   WriteRegStr       SHCTX "${UNINST_KEY}" DisplayIcon     $INSTDIR\Inkscape.exe,0
589   WriteRegStr       SHCTX "${UNINST_KEY}" DisplayVersion  ${INKSCAPE_VERSION}
590   WriteRegDWORD     SHCTX "${UNINST_KEY}" NoModify        1
591   WriteRegDWORD     SHCTX "${UNINST_KEY}" NoRepair        1
593   ;create/update log always within .onInstSuccess function
594   !insertmacro UNINSTALL.LOG_UPDATE_INSTALL
596   DetailPrint "Creating MD5 checksums"
597   ClearErrors
598   FileOpen $0 $INSTDIR\Uninstall.dat r
599   FileOpen $9 $INSTDIR\Uninstall.log w
600   ${IfNot} ${Errors}
601     ${Do}
602       ClearErrors
603       FileRead $0 $1
604       ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
605       StrCpy $1 $1 -2
606       md5dll::GetMD5File /NOUNLOAD $1
607       Pop $2
608       ${IfThen} $2 != "" ${|} FileWrite $9 "$2  $1$\r$\n" ${|}
609     ${Loop}
610   ${EndIf}
611   FileClose $0
612   FileClose $9
613   ; Not needed any more
614   Delete $INSTDIR\Uninstall.dat
615 !endif
616 SectionEnd ; -FinalizeInstallation }}}
618 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN ; Section descriptions {{{
619   !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} "$(CoreDesc)"
620   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} "$(GTKFilesDesc)"
621   !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} "$(ShortcutsDesc)"
622   !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} "$(AlluserDesc)"
623   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} "$(DesktopDesc)"
624   !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} "$(QuicklaunchDesc)"
625   !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} "$(SVGWriterDesc)"
626   !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} "$(ContextMenuDesc)"
627   !insertmacro MUI_DESCRIPTION_TEXT ${SecPrefs} "$(DeletePrefsDesc)"
628   !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} "$(AddfilesDesc)"
629   !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} "$(ExamplesDesc)"
630   !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} "$(TutorialsDesc)"
631   !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} "$(LanguagesDesc)"
632 !insertmacro MUI_FUNCTION_DESCRIPTION_END ; Section descriptions }}}
635 Function .onInit ; initialise the installer {{{2
636   ; This code will be executed before the sections, but due to the
637   ; language code in the sections it must come after it in the code.
639   ; Language detection {{{
640   !insertmacro MUI_LANGDLL_DISPLAY
642   !macro LanguageAutoSelect SecName LocaleID
643     ${If} $LANGUAGE = ${LocaleID}
644       SectionGetFlags ${Sec${SecName}} $0
645       IntOp $0 $0 | ${SF_SELECTED}
646       SectionSetFlags ${Sec${SecName}} $0
647     ${EndIf}
648   !macroend
650   ; No need for English to be detected as it's the default
651   !insertmacro LanguageAutoSelect BrPortuguese  1046
652   !insertmacro LanguageAutoSelect Breton        1150
653   !insertmacro LanguageAutoSelect Catalan       1027
654   !insertmacro LanguageAutoSelect Czech         1029
655   !insertmacro LanguageAutoSelect Dutch         1043
656   !insertmacro LanguageAutoSelect Finnish       1035
657   !insertmacro LanguageAutoSelect French        1036
658   !insertmacro LanguageAutoSelect Galician      1110
659   !insertmacro LanguageAutoSelect German        1031
660   !insertmacro LanguageAutoSelect Indonesian    1057
661   !insertmacro LanguageAutoSelect Italian       1040
662   !insertmacro LanguageAutoSelect Japanese      1041
663   !insertmacro LanguageAutoSelect Polish        1045
664   !insertmacro LanguageAutoSelect Romanian      1048
665   !insertmacro LanguageAutoSelect Russian       1049
666   !insertmacro LanguageAutoSelect Slovak        1051
667   !insertmacro LanguageAutoSelect Slovenian     1060
668   !insertmacro LanguageAutoSelect Spanish       1034
669   !insertmacro LanguageAutoSelect SimpChinese   2052
670   !insertmacro LanguageAutoSelect TradChinese   1028
671   !insertmacro LanguageAutoSelect Ukrainian     1058
672   ; End of language detection }}}
674   !insertmacro UNINSTALL.LOG_PREPARE_INSTALL ; prepare advanced uninstallation log script
676   ;Extract InstallOptions INI files
677   StrCpy $AskMultiUser 1
678   StrCpy $MultiUser 0
679   ; this resets AskMultiUser if Win95/98/ME
680   ClearErrors
681   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
682   ${If} ${Errors}
683     ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
684     StrCpy $R0 $R0 1
685     ${IfThen} $R0 = 4 ${|} StrCpy $AskMultiUser 0 ${|}
686   ${EndIf}
688   ; hide all user section if ME/9x
689   ${IfThen} $AskMultiUser != 1 ${|} SectionSetText ${SecAlluser} "" ${|}
691   ; hide if quick launch if not available
692   ${IfThen} $QUICKLAUNCH == $TEMP ${|} SectionSetText ${SecQuicklaunch} "" ${|}
694   ; Check for administrative privileges {{{
695   ClearErrors
696   UserInfo::GetName
697   ${If} ${Errors}
698     ; This one means you don't need to care about admin or
699     ; not admin because Windows 9x doesn't either
700     ${IfCmd} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(NOT_SUPPORTED)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${||} Quit ${|}
701   ${Else}
702     Pop $User
703     UserInfo::GetAccountType
704     Pop $1
705     ${If} $1 != Admin
706     ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(NO_ADMIN)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
707       Quit
708     ${EndIf}
709   ${EndIf} ; }}}
711   ; Detect an Inkscape installation by another user {{{
712   ReadRegStr $0 HKLM "${INSTDIR_KEY}" User                              ; first global...
713   ${IfThen} $0 == "" ${|} ReadRegStr $0 HKCU "${INSTDIR_KEY}" User ${|} ; then current user
714   ${If} $0 != ""
715   ${AndIf} $0 != $User
716   ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(DIFFERENT_USER)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
717     Quit
718   ${EndIf} ; }}}
720   ; Request uninstallation of an old Inkscape installation {{{
721   ReadRegStr $R0 HKLM "${UNINST_KEY}" UninstallString
722   ${IfThen} $R0 == "" ${|} ReadRegStr $R0 HKCU "${UNINST_KEY}" UninstallString ${|}
723   ${If} $R0 != ""
724   ${AndIf} ${Cmd} ${|} MessageBox MB_YESNO|MB_ICONEXCLAMATION "$(WANT_UNINSTALL_BEFORE)" /SD IDNO IDYES ${|}
725     ExecWait $R0
726   ${EndIf} ; }}}
728   ; Process command-line arguments (for automation) {{{
729   !echo `Creating code to process command-line arguments...`
730   !verbose push
731   !verbose 3
732   ${GetParameters} $CMDARGS
734   !macro Parameter key Section
735     ${GetOptions} $CMDARGS /${key}= $1
736     ${If} $1 == OFF
737       SectionGetFlags ${Section} $0
738       IntOp $2 ${SF_SELECTED} ~
739       IntOp $0 $0 & $2
740       SectionSetFlags ${Section} $0
741     ${EndIf}
742     ${If} $1 == ON
743       SectionGetFlags ${Section} $0
744       IntOp $0 $0 | ${SF_SELECTED}
745       SectionSetFlags ${Section} $0
746     ${EndIf}
747   !macroend
749   !insertmacro Parameter GTK            ${SecGTK}
750   !insertmacro Parameter SHORTCUTS      ${secShortcuts}
751   !insertmacro Parameter ALLUSER        ${SecAlluser}
752   !insertmacro Parameter DESKTOP        ${SecDesktop}
753   !insertmacro Parameter QUICKLAUNCH    ${SecQUICKlaunch}
754   !insertmacro Parameter SVGEDITOR      ${SecSVGWriter}
755   !insertmacro Parameter CONTEXTMENUE   ${SecContextMenu}
756   !insertmacro Parameter PREFERENCES    ${SecPrefs}
757   !insertmacro Parameter ADDFILES       ${SecAddfiles}
758   !insertmacro Parameter EXAMPLES       ${SecExamples}
759   !insertmacro Parameter TUTORIALS      ${SecTutorials}
760   !insertmacro Parameter LANGUAGES      ${SecLanguages}
761   !insertmacro Parameter am             ${SecAmharic}
762   !insertmacro Parameter ar             ${SecArabic}
763   !insertmacro Parameter az             ${SecAzerbaijani}
764   !insertmacro Parameter be             ${SecByelorussian}
765   !insertmacro Parameter bg             ${SecBulgarian}
766   !insertmacro Parameter bn             ${SecBengali}
767   !insertmacro Parameter br             ${SecBreton}
768   !insertmacro Parameter ca             ${SecCatalan}
769   !insertmacro Parameter ca@valencia    ${SecCatalanValencia}
770   !insertmacro Parameter cs             ${SecCzech}
771   !insertmacro Parameter da             ${SecDanish}
772   !insertmacro Parameter de             ${SecGerman}
773   !insertmacro Parameter dz             ${SecDzongkha}
774   !insertmacro Parameter el             ${SecGreek}
775   !insertmacro Parameter en_AU          ${SecEnglishAustralian}
776   !insertmacro Parameter en_CA          ${SecEnglishCanadian}
777   !insertmacro Parameter en_GB          ${SecEnglishBritain}
778   !insertmacro Parameter en_US@piglatin ${SecEnglishPiglatin}
779   !insertmacro Parameter eo             ${SecEsperanto}
780   !insertmacro Parameter es             ${SecSpanish}
781   !insertmacro Parameter es_MX          ${SecSpanishMexico}
782   !insertmacro Parameter et             ${SecEstonian}
783   !insertmacro Parameter eu             ${SecBasque}
784   !insertmacro Parameter fa             ${SecFarsi}
785   !insertmacro Parameter fi             ${SecFinnish}
786   !insertmacro Parameter fr             ${SecFrench}
787   !insertmacro Parameter ga             ${SecIrish}
788   !insertmacro Parameter gl             ${SecGalician}
789   !insertmacro Parameter he             ${SecHebrew}
790   !insertmacro Parameter hr             ${SecCroatian}
791   !insertmacro Parameter hu             ${SecHungarian}
792   !insertmacro Parameter id             ${SecIndonesian}
793   !insertmacro Parameter it             ${SecItalian}
794   !insertmacro Parameter ja             ${SecJapanese}
795   !insertmacro Parameter km             ${SecKhmer}
796   !insertmacro Parameter ko             ${SecKorean}
797   !insertmacro Parameter lt             ${SecLithuanian}
798   !insertmacro Parameter mk             ${SecMacedonian}
799   !insertmacro Parameter mn             ${SecMongolian}
800   !insertmacro Parameter nb             ${SecNorwegianBokmal}
801   !insertmacro Parameter ne             ${SecNepali}
802   !insertmacro Parameter nl             ${SecDutch}
803   !insertmacro Parameter nn             ${SecNorwegianNynorsk}
804   !insertmacro Parameter pa             ${SecPanjabi}
805   !insertmacro Parameter pl             ${SecPolish}
806   !insertmacro Parameter pt             ${SecPortuguese}
807   !insertmacro Parameter pt_BR          ${SecPortugueseBrazil}
808   !insertmacro Parameter ro             ${SecRomanian}
809   !insertmacro Parameter ru             ${SecRussian}
810   !insertmacro Parameter rw             ${SecKinyarwanda}
811   !insertmacro Parameter sk             ${SecSlovak}
812   !insertmacro Parameter sl             ${SecSlovenian}
813   !insertmacro Parameter sq             ${SecAlbanian}
814   !insertmacro Parameter sr             ${SecSerbian}
815   !insertmacro Parameter sr@latin       ${SecSerbianLatin}
816   !insertmacro Parameter sv             ${SecSwedish}
817   !insertmacro Parameter te_IN          ${SecTelugu}
818   !insertmacro Parameter th             ${SecThai}
819   !insertmacro Parameter tr             ${SecTurkish}
820   !insertmacro Parameter uk             ${SecUkrainian}
821   !insertmacro Parameter vi             ${SecVietnamese}
822   !insertmacro Parameter zh_CN          ${SecSimpChinese}
823   !insertmacro Parameter zh_TW          ${SecTradChinese}
825   ClearErrors
826   ${GetOptions} $CMDARGS /? $1
827   ${IfNot} ${Errors}
828     MessageBox MB_OK "Possible parameters for installer:$\r$\n \
829       /?: this help screen$\r$\n \
830       /S: silent$\r$\n \
831       /D=(directory): where to install Inkscape$\r$\n \
832       /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
833       /SHORTCUTS=(OFF/ON): shortcuts to start Inkscape$\r$\n \
834       /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
835       /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
836       /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
837       /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
838       /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
839       /PREFERENCES=(OFF/ON): delete users preference files$\r$\n \
840       /ADDFILES=(OFF/ON): additional files$\r$\n \
841       /EXAMPLES=(OFF/ON): examples$\r$\n \
842       /TUTORIALS=(OFF/ON): tutorials$\r$\n \
843       /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
844       /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
845     Abort
846     !verbose pop
847   ${EndIf} ; }}}
848 FunctionEnd ; .onInit }}}
849 ; Uninstaller code {{{1
850 Function un.onInit ; initialise uninstaller {{{
851   ;begin uninstall, could be added on top of uninstall section instead
852   ;!insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
853   ${IfNot} ${FileExists} $INSTDIR\uninstall.log
854     MessageBox MB_OK|MB_ICONEXCLAMATION "$(UninstallLogNotFound)" /SD IDOK
855     Quit
856   ${EndIf}
857   ClearErrors
858   StrCpy $User ""
859   UserInfo::GetName
860   ${IfNot} ${Errors}
861     Pop $0
862     StrCpy $User $0
863   ${EndIf}
864   StrCpy $askMultiUser 1
865   StrCpy $MultiUser 1
867   ; Test if this was a multiuser installation
868     ReadRegStr $0            HKLM "${INSTDIR_KEY}" ""
869   ${If} $0 == $INSTDIR\inkscape.exe
870     ReadRegStr $MultiUser    HKLM "${INSTDIR_KEY}" MultiUser
871     ReadRegStr $askMultiUser HKLM "${INSTDIR_KEY}" askMultiUser
872     ReadRegStr $0            HKLM "${INSTDIR_KEY}" User
873   ${Else}
874     ReadRegStr $MultiUser    HKCU "${INSTDIR_KEY}" MultiUser
875     ReadRegStr $askMultiUser HKCU "${INSTDIR_KEY}" askMultiUser
876     ReadRegStr $0            HKCU "${INSTDIR_KEY}" User
877   ${EndIf}
878   ;check user if applicable
879   ${If} $0 != ""
880   ${AndIf} $0 != $User
881   ${AndIf} ${Cmd} ${|} MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(DIFFERENT_USER)$(OK_CANCEL_DESC)" /SD IDOK IDCANCEL ${|}
882     Quit
883   ${EndIf}
885   !insertmacro MUI_INSTALLOPTIONS_EXTRACT inkscape.nsi.uninstall
887   SetShellVarContext all
888   ${IfThen} $MultiUser = 0 ${|} SetShellVarContext current ${|}
889 FunctionEnd ; un.onInit }}}
891 Function un.CustomPageUninstall ; {{{
892   !insertmacro MUI_HEADER_TEXT "$(UInstOpt)" "$(UInstOpt1)"
893   !insertmacro MUI_INSTALLOPTIONS_WRITE inkscape.nsi.uninstall "Field 1" Text "$APPDATA\Inkscape\"
894   !insertmacro MUI_INSTALLOPTIONS_WRITE inkscape.nsi.uninstall "Field 2" Text "$(PurgePrefs)"
895   !insertmacro MUI_INSTALLOPTIONS_DISPLAY inkscape.nsi.uninstall
896   !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser inkscape.nsi.uninstall "Field 2" State
897 FunctionEnd ; un.CustomPageUninstall }}}
899 Section Uninstall ; do the uninstalling {{{
900 !ifndef DUMMYINSTALL
901   ; remove personal settings
902   Delete $APPDATA\Inkscape\extension-errors.log
903   ${If} $MultiUser = 0
904     DetailPrint "Purging personal settings in $APPDATA\Inkscape"
905     ;RMDir /r $APPDATA\Inkscape
906     !insertmacro delprefs
907   ${EndIf}
909   ; Remove file associations for svg editor
910   StrCpy $3 svg
911   ${For} $2 0 1
912     ${IfThen} $2 = 1 ${|} StrCpy $3 $3z ${|}
913     DetailPrint "Removing file associations for $3 editor"
914     ClearErrors
915     ReadRegStr $0 HKCR .$3 ""
916     ${IfNot} ${Errors}
917       ReadRegStr $1 HKCR $0\shell\edit\command ""
918       ${If} $1 == `"$INSTDIR\Inkscape.exe" "%1"`
919         DeleteRegKey HKCR $0\shell\edit\command
920       ${EndIf}
922       ClearErrors
923       ReadRegStr $1 HKCR $0\shell\open\command ""
924       ${If} $1 == `"$INSTDIR\Inkscape.exe" "%1"`
925         DeleteRegKey HKCR $0\shell\open\command
926       ${EndIf}
928       DeleteRegKey HKCR $0\shell\Inkscape
929       DeleteRegKey /ifempty HKCR $0\shell\edit
930       DeleteRegKey /ifempty HKCR $0\shell\open
931       DeleteRegKey /ifempty HKCR $0\shell
932       DeleteRegKey /ifempty HKCR $0
933       DeleteRegKey /ifempty HKCR .$3
934     ${EndIf}
935   ${Next}
937   SetShellVarContext all
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   SetShellVarContext current
949   DeleteRegKey SHCTX "${INSTDIR_KEY}"
950   DeleteRegKey SHCTX "${UNINST_KEY}"
951   Delete $DESKTOP\Inkscape.lnk
952   Delete $QUICKLAUNCH\Inkscape.lnk
953   Delete $SMPROGRAMS\Inkscape.lnk
954   ;just in case they are still there
955   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
956   Delete $SMPROGRAMS\Inkscape\Inkscape.lnk
957   RMDir  $SMPROGRAMS\Inkscape
959   InitPluginsDir
960   SetPluginUnload manual
962   ClearErrors
963   FileOpen $0 $INSTDIR\uninstall.log r
964   ${If} ${Errors} ;else uninstallnotfound
965     MessageBox MB_OK|MB_ICONEXCLAMATION "$(UninstallLogNotFound)" /SD IDOK
966   ${Else}
967     ${Do}
968       ClearErrors
969       FileRead $0 $1
970       ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
971       ; cat the line into md5 and filename
972       StrLen $2 $1
973       ${IfThen} $2 <= 35 ${|} ${Continue} ${|}
974       StrCpy $3 $1 32
975       StrCpy $filename $1 $2-36 34 ;remove trailing CR/LF
976       StrCpy $filename $filename -2
977       ; $3 = MD5 when installed, then deletion choice
978       ; $filename = file
979       ; $5 = MD5 now
980       ; $6 = always/never remove files touched by user
982       ${If} ${FileExists} $filename
983         ${If} $6 == always
984           StrCpy $3 2
985         ${Else}
986           md5dll::GetMD5File /NOUNLOAD $filename
987           Pop $5 ;md5 of file
988           ${If} $3 == $5
989             StrCpy $3 1 ; yes
990           ${ElseIf} $6 != never
991             ; the md5 sums does not match so we ask
992             messagebox::show MB_DEFBUTTON3|MB_TOPMOST "" 0,103 \
993               "$(FileChanged)" "$(Yes)" "$(AlwaysYes)" "$(No)" "$(AlwaysNo)"
994             Pop $3
995             ${IfThen} $3 = 2 ${|} StrCpy $6 always ${|}
996             ${IfThen} $3 = 4 ${|} StrCpy $6 never ${|}
997           ${EndIf}
998         ${EndIf}
1000         ${If}   $3 = 1 ; yes
1001         ${OrIf} $3 = 2 ; always
1002           ; Remove File
1003           ClearErrors
1004           Delete $filename
1005           ;now recursivly remove the path
1006           ${Do}
1007             ClearErrors
1008             ${un.GetParent} $filename $filename
1009             ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
1010             RMDir $filename
1011             ${IfThen} ${Errors} ${|} ${ExitDo} ${|}
1012           ${Loop}
1013         ${EndIf}
1014       ${EndIf}
1015     ${Loop}
1016   ${EndIf}
1017   FileClose $0
1018   Delete $INSTDIR\uninstall.log
1019   Delete $INSTDIR\uninstall.exe
1020   ; remove empty directories
1021   RMDir $INSTDIR\lib\locale
1022   RMDir $INSTDIR\lib
1023   RMDir $INSTDIR\data
1024   RMDir $INSTDIR\doc
1025   RMDir $INSTDIR\modules
1026   RMDir $INSTDIR\plugins
1027   RMDir $INSTDIR
1028   SetAutoClose false
1029 !endif
1030 SectionEnd ; Uninstall }}}
1031 ; }}}
1033 ; This file has been optimised for use in Vim with folding.
1034 ; (If you can't cope, :set nofoldenable) vim:fen:fdm=marker