Code

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