Code

7634b1641572142bba01de3f76af6124f02cdd76
[inkscape.git] / packaging / win32 / inkscape.nsi
1 ; #######################################
2 ; Inkscape NSIS installer project file
3 ; Used as of 0.40
4 ; #######################################
6 ; #######################################
7 ; DEFINES
8 ; #######################################
9 !define PRODUCT_NAME "Inkscape"
10 !define PRODUCT_VERSION "0.44+devel"
11 !define PRODUCT_PUBLISHER "Inkscape Organization"
12 !define PRODUCT_WEB_SITE "http://www.inkscape.org"
13 !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\inkscape.exe"
14 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
18 ; #######################################
19 ; MUI   SETTINGS
20 ; #######################################
21 ; MUI 1.67 compatible ------
22 SetCompressor /SOLID lzma
23 !include "MUI.nsh"
24 !include "sections.nsh"
25 !define MUI_ABORTWARNING
26 !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
27 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
28 !define MUI_HEADERIMAGE
29 !define MUI_HEADERIMAGE_BITMAP "header.bmp"
30 !define MUI_COMPONENTSPAGE_SMALLDESC
33 ; Welcome page
34 !insertmacro MUI_PAGE_WELCOME
35 ; License page
36 ; !define MUI_LICENSEPAGE_RADIOBUTTONS
37 LicenseForceSelection off
38 !define MUI_LICENSEPAGE_BUTTON $(lng_LICENSE_BUTTON)
39 !define MUI_LICENSEPAGE_TEXT_BOTTOM $(lng_LICENSE_BOTTOM_TEXT)
40 !insertmacro MUI_PAGE_LICENSE "..\..\Copying"
41 !insertmacro MUI_PAGE_COMPONENTS
42 ; InstType $(lng_Full)
43 ; InstType $(lng_Optimal)
44 ; InstType $(lng_Minimal)
45 ; Directory page
46 !insertmacro MUI_PAGE_DIRECTORY
47 ; Instfiles page
48 !insertmacro MUI_PAGE_INSTFILES
49 ; Finish page
50 !define MUI_FINISHPAGE_RUN "$INSTDIR\inkscape.exe"
51 !insertmacro MUI_PAGE_FINISH
53 ; Uninstaller pages
54 !insertmacro MUI_UNPAGE_CONFIRM
55 UninstPage custom un.CustomPageUninstall
56 !insertmacro MUI_UNPAGE_INSTFILES
57 ShowUninstDetails hide
58 !insertmacro MUI_UNPAGE_FINISH
60 ; #######################################
61 ; STRING   LOCALIZATION
62 ; #######################################
63 ; Thanks to Adib Taraben and Luca Bruno for getting this started
64 ; Add your translation here!  :-)
65 ; I had wanted to list the languages alphabetically, but apparently
66 ; the first is the default.  So putting English first is just being
67 ; practical.  It is not chauvinism or hubris, I swear!  ;-)
68 ; default language first
70 ; Language files
71 !include "english.nsh" 
72 !include "catalan.nsh" 
73 !include "czech.nsh" 
74 !include "french.nsh" 
75 !include "german.nsh" 
76 !include "italian.nsh" 
77 !include "slovak.nsh" 
78 !include "polish.nsh" 
79 !include "spanish.nsh" 
80 !include "slovenian.nsh" 
82 ReserveFile "inkscape.nsi.uninstall"
85 ; #######################################
86 ; SETTINGS
87 ; #######################################
89 Name              "${PRODUCT_NAME} ${PRODUCT_VERSION}"
90 Caption           $(lng_Caption)
91 OutFile           "Inkscape-${PRODUCT_VERSION}-1.win32.exe"
92 InstallDir        "$PROGRAMFILES\Inkscape"
93 InstallDirRegKey  HKLM "${PRODUCT_DIR_REGKEY}" ""
94 ShowInstDetails   hide
95 ShowUnInstDetails hide
97 var askMultiUser
98 Var MultiUser
99 var User
101 ; #######################################
102 ;  I N S T A L L E R    S E C T I O N S
103 ; #######################################
105 ; Turn off old selected section
106 ; GetWindowsVersion
108 ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
109 ; Updated by Joost Verburg
110 ; Updated for Windows 98 SE by Matthew Win Tibbals 5-21-03
112 ; Returns on top of stack
114 ; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003)
115 ; or
116 ; '' (Unknown Windows Version)
118 ; Usage:
119 ;   Call GetWindowsVersion
120 ;   Pop $R0
121 ;   ; at this point $R0 is "NT 4.0" or whatnot
122 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
123 Function GetWindowsVersion
124  
125   Push $R0
126   Push $R1
127  
128   ClearErrors
129  
130   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
131  
132   IfErrors 0 lbl_winnt
133  
134   ; we are not NT
135   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
136  
137   StrCpy $R1 $R0 1
138   StrCmp $R1 '4' 0 lbl_error
139  
140   StrCpy $R1 $R0 3
141  
142   StrCmp $R1 '4.0' lbl_win32_95
143   StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
144  
145   lbl_win32_95:
146     StrCpy $R0 '95'
147         StrCpy $AskMultiUser "0"
148   Goto lbl_done
149  
150   lbl_win32_98:
151     StrCpy $R0 '98'
152         StrCpy $AskMultiUser "0"
153   Goto lbl_done
154   lbl_win32_ME:
155     StrCpy $R0 'ME'
156         StrCpy $AskMultiUser "0"
157   Goto lbl_done
158  
159   lbl_winnt:
160  
161   StrCpy $R1 $R0 1
162  
163   StrCmp $R1 '3' lbl_winnt_x
164   StrCmp $R1 '4' lbl_winnt_x
165  
166   StrCpy $R1 $R0 3
167  
168   StrCmp $R1 '5.0' lbl_winnt_2000
169   StrCmp $R1 '5.1' lbl_winnt_XP
170   StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error
171  
172   lbl_winnt_x:
173     StrCpy $R0 "NT $R0" 6
174   Goto lbl_done
175  
176   lbl_winnt_2000:
177     Strcpy $R0 '2000'
178   Goto lbl_done
179  
180   lbl_winnt_XP:
181     Strcpy $R0 'XP'
182   Goto lbl_done
183  
184   lbl_winnt_2003:
185     Strcpy $R0 '2003'
186   Goto lbl_done
187  
188   lbl_error:
189     Strcpy $R0 ''
190   lbl_done:
191  
192   Pop $R1
193   Exch $R0
195 FunctionEnd
197 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
199  ; StrStr
200  ; input, top of stack = string to search for
201  ;        top of stack-1 = string to search in
202  ; output, top of stack (replaces with the portion of the string remaining)
203  ; modifies no other variables.
204  ;
205  ; Usage:
206  ;   Push "this is a long ass string"
207  ;   Push "ass"
208  ;   Call StrStr
209  ;   Pop $R0
210  ;  ($R0 at this point is "ass string")
212  Function StrStr
213    Exch $R1 ; st=haystack,old$R1, $R1=needle
214    Exch    ; st=old$R1,haystack
215    Exch $R2 ; st=old$R1,old$R2, $R2=haystack
216    Push $R3
217    Push $R4
218    Push $R5
219    StrLen $R3 $R1
220    StrCpy $R4 0
221    ; $R1=needle
222    ; $R2=haystack
223    ; $R3=len(needle)
224    ; $R4=cnt
225    ; $R5=tmp
226    loop:
227      StrCpy $R5 $R2 $R3 $R4
228      StrCmp $R5 $R1 done
229      StrCmp $R5 "" done
230      IntOp $R4 $R4 + 1
231      Goto loop
232  done:
233    StrCpy $R1 $R2 "" $R4
234    Pop $R5
235    Pop $R4
236    Pop $R3
237    Pop $R2
238    Exch $R1
239  FunctionEnd
241 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
243  ; GetParameters
244  ; input, none
245  ; output, top of stack (replaces, with e.g. whatever)
246  ; modifies no other variables.
247  
248  Function GetParameters
249  
250    Push $R0
251    Push $R1
252    Push $R2
253    Push $R3
254    
255    StrCpy $R2 1
256    StrLen $R3 $CMDLINE
257    
258    ;Check for quote or space
259    StrCpy $R0 $CMDLINE $R2
260    StrCmp $R0 '"' 0 +3
261      StrCpy $R1 '"'
262      Goto loop
263    StrCpy $R1 " "
264    
265    loop:
266      IntOp $R2 $R2 + 1
267      StrCpy $R0 $CMDLINE 1 $R2
268      StrCmp $R0 $R1 get
269      StrCmp $R2 $R3 get
270      Goto loop
271    
272    get:
273      IntOp $R2 $R2 + 1
274      StrCpy $R0 $CMDLINE 1 $R2
275      StrCmp $R0 " " get
276      StrCpy $R0 $CMDLINE "" $R2
277    
278    Pop $R3
279    Pop $R2
280    Pop $R1
281    Exch $R0
282  
283  FunctionEnd
285 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
286 ; GetParameterValue
287 ; Chris Morgan<cmorgan@alum.wpi.edu> 5/10/2004
288 ; -Updated 4/7/2005 to add support for retrieving a command line switch
289 ;  and additional documentation
291 ; Searches the command line input, retrieved using GetParameters, for the
292 ; value of an option given the option name.  If no option is found the
293 ; default value is placed on the top of the stack upon function return.
295 ; This function can also be used to detect the existence of just a
296 ; command line switch like /OUTPUT  Pass the default and "OUTPUT"
297 ; on the stack like normal.  An empty return string "" will indicate
298 ; that the switch was found, the default value indicates that
299 ; neither a parameter or switch was found.
301 ; Inputs - Top of stack is default if parameter isn't found,
302 ;  second in stack is parameter to search for, ex. "OUTPUT"
303 ; Outputs - Top of the stack contains the value of this parameter
304 ;  So if the command line contained /OUTPUT=somedirectory, "somedirectory"
305 ;  will be on the top of the stack when this function returns
307 ; Register usage
308 ;$R0 - default return value if the parameter isn't found
309 ;$R1 - input parameter, for example OUTPUT from the above example
310 ;$R2 - the length of the search, this is the search parameter+2
311 ;      as we have '/OUTPUT='
312 ;$R3 - the command line string
313 ;$R4 - result from StrStr calls
314 ;$R5 - search for ' ' or '"'
315  
316 Function GetParameterValue
317   Exch $R0  ; get the top of the stack(default parameter) into R0
318   Exch      ; exchange the top of the stack(default) with
319             ; the second in the stack(parameter to search for)
320   Exch $R1  ; get the top of the stack(search parameter) into $R1
321  
322   ;Preserve on the stack the registers used in this function
323   Push $R2
324   Push $R3
325   Push $R4
326   Push $R5
327  
328   Strlen $R2 $R1+2    ; store the length of the search string into R2
329  
330   Call GetParameters  ; get the command line parameters
331   Pop $R3             ; store the command line string in R3
332  
333   # search for quoted search string
334   StrCpy $R5 '"'      ; later on we want to search for a open quote
335   Push $R3            ; push the 'search in' string onto the stack
336   Push '"/$R1='       ; push the 'search for'
337   Call StrStr         ; search for the quoted parameter value
338   Pop $R4
339   StrCpy $R4 $R4 "" 1   ; skip over open quote character, "" means no maxlen
340   StrCmp $R4 "" "" next ; if we didn't find an empty string go to next
341  
342   # search for non-quoted search string
343   StrCpy $R5 ' '      ; later on we want to search for a space since we
344                       ; didn't start with an open quote '"' we shouldn't
345                       ; look for a close quote '"'
346   Push $R3            ; push the command line back on the stack for searching
347   Push '/$R1='        ; search for the non-quoted search string
348   Call StrStr
349   Pop $R4
350  
351   ; $R4 now contains the parameter string starting at the search string,
352   ; if it was found
353 next:
354   StrCmp $R4 "" check_for_switch ; if we didn't find anything then look for
355                                  ; usage as a command line switch
356   # copy the value after /$R1= by using StrCpy with an offset of $R2,
357   # the length of '/OUTPUT='
358   StrCpy $R0 $R4 "" $R2  ; copy commandline text beyond parameter into $R0
359   # search for the next parameter so we can trim this extra text off
360   Push $R0
361   Push $R5            ; search for either the first space ' ', or the first
362                       ; quote '"'
363                       ; if we found '"/output' then we want to find the
364                       ; ending ", as in '"/output=somevalue"'
365                       ; if we found '/output' then we want to find the first
366                       ; space after '/output=somevalue'
367   Call StrStr         ; search for the next parameter
368   Pop $R4
369   StrCmp $R4 "" done  ; if 'somevalue' is missing, we are done
370   StrLen $R4 $R4      ; get the length of 'somevalue' so we can copy this
371                       ; text into our output buffer
372   StrCpy $R0 $R0 -$R4 ; using the length of the string beyond the value,
373                       ; copy only the value into $R0
374   goto done           ; if we are in the parameter retrieval path skip over
375                       ; the check for a command line switch
376  
377 ; See if the parameter was specified as a command line switch, like '/output'
378 check_for_switch:
379   Push $R3            ; push the command line back on the stack for searching
380   Push '/$R1'         ; search for the non-quoted search string
381   Call StrStr
382   Pop $R4
383   StrCmp $R4 "" done  ; if we didn't find anything then use the default
384   StrCpy $R0 ""       ; otherwise copy in an empty string since we found the
385                       ; parameter, just didn't find a value
386  
387 done:
388   Pop $R5
389   Pop $R4
390   Pop $R3
391   Pop $R2
392   Pop $R1
393   Exch $R0 ; put the value in $R0 at the top of the stack
394 FunctionEnd
396 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
398 !macro Language polng lng
399   SectionIn 1 2 3
400   SetOutPath $INSTDIR
401   File /nonfatal /a "..\..\inkscape\*.${lng}.txt"
402   SetOutPath $INSTDIR\locale
403   File /nonfatal /a /r "..\..\inkscape\locale\${polng}"
404   SetOutPath $INSTDIR\lib\locale
405   File /nonfatal /a /r "..\..\inkscape\lib\locale\${polng}"
406   ; the keyboard tables
407   SetOutPath $INSTDIR\share\screens
408   File /nonfatal /a /r "..\..\inkscape\share\screens\keys.${polng}.svg"  
409   SetOutPath $INSTDIR\share\templates
410   File /nonfatal /a /r "..\..\inkscape\share\templates\default.${polng}.svg"  
411   SetOutPath $INSTDIR\doc
412   File /nonfatal /a /r "..\..\inkscape\doc\keys.${polng}.xml"  
413   File /nonfatal /a /r "..\..\inkscape\doc\keys.${polng}.html"  
414   SectionGetFlags ${SecTutorials} $R1 
415   IntOp $R1 $R1 & ${SF_SELECTED} 
416   IntCmp $R1 ${SF_SELECTED} 0 skip_tutorials 
417     SetOutPath $INSTDIR\share\tutorials
418     File /nonfatal /a "..\..\inkscape\share\tutorials\*.${polng}.*"
419   skip_tutorials:
420 !macroend
422 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
427 ;--------------------------------
428 ; Installer Sections
429 ; @todo better idea is to call the original uninstaller first
430 Section -removeInkscape
431   ; check for an old installation and clean that dlls and stuff
432   ClearErrors
433   IfFileExists $INSTDIR\etc 0 doDeleteLib
434     DetailPrint "$INSTDIR\etc exists, will be removed"
435     RmDir /r $INSTDIR\etc
436         IfErrors 0 +4
437       DetailPrint "fatal: failed to delete $INSTDIR\etc"
438       DetailPrint "aborting installation"
439           Abort
440   doDeleteLib:
442   ClearErrors
443   IfFileExists $INSTDIR\lib 0 doDeleteLocale
444     DetailPrint "$INSTDIR\lib exists, will be removed"  
445     RmDir /r $INSTDIR\lib
446         IfErrors 0 +4
447       DetailPrint "fatal: failed to delete $INSTDIR\lib"
448       DetailPrint "aborting installation"
449           Abort
450   doDeleteLocale:
452   ClearErrors
453   IfFileExists $INSTDIR\locale 0 doDeleteDll
454     DetailPrint "$INSTDIR\locale exists, will be removed"
455     RmDir /r $INSTDIR\locale
456         IfErrors 0 +4
457       DetailPrint "fatal: failed to delete $INSTDIR\locale"
458       DetailPrint "aborting installation"
459           Abort
460   doDeleteDll:
462   ClearErrors
463   FindFirst $0 $1 $INSTDIR\*.dll
464     FindNextLoop:
465     StrCmp $1 "" FindNextDone
466     DetailPrint "$INSTDIR\$1 exists, will be removed"
467     Delete $INSTDIR\$1
468     IfErrors 0 +4
469       DetailPrint "fatal: failed to delete $INSTDIR\$1"
470       DetailPrint "aborting installation"
471       Abort
472     FindNext $0 $1
473     Goto FindNextLoop
474   FindNextDone:
475   
476   ;remove the old inkscape shortcuts from the startmenu
477   ;just in case they are still there
478   SetShellVarContext current
479   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
480   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
481   RMDir  "$SMPROGRAMS\Inkscape"
482   Delete "$SMPROGRAMS\Inkscape.lnk"
483   SetShellVarContext all
484   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
485   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
486   RMDir  "$SMPROGRAMS\Inkscape"
487   Delete "$SMPROGRAMS\Inkscape.lnk"
488   
489 SectionEnd
491 Section $(lng_Core) SecCore
493   DetailPrint "Installing Inkscape Core Files ..."
495   SectionIn 1 2 3 RO
496   SetOutPath $INSTDIR
497   SetOverwrite on
498   SetAutoClose false
500   File /a "..\..\inkscape\ink*.exe"
501   File /a "..\..\inkscape\AUTHORS"
502   File /a "..\..\inkscape\COPYING"
503   File /a "..\..\inkscape\COPYING.LIB"
504   File /a "..\..\inkscape\NEWS"
505   File /a "..\..\inkscape\HACKING.txt"
506   File /a "..\..\inkscape\README"
507   File /a "..\..\inkscape\README.txt"
508   File /a "..\..\inkscape\TRANSLATORS"
509   File /nonfatal /a /r "..\..\inkscape\data"
510   File /nonfatal /a /r "..\..\inkscape\doc"
511   File /nonfatal /a /r "..\..\inkscape\plugins"
512   File /nonfatal /a /r /x *.??*.???* /x "examples" /x "tutorials" "..\..\inkscape\share"
513   ; this files are added because it slips through the filter
514   SetOutPath $INSTDIR\share\clipart
515   File /a "..\..\inkscape\share\clipart\inkscape.logo.svg"
516   ;File /a "..\..\inkscape\share\clipart\inkscape.logo.classic.svg"  
517   SetOutPath $INSTDIR\share\extensions
518   File /a "..\..\inkscape\share\extensions\pdf_output.inx.txt"
519   File /a "..\..\inkscape\share\extensions\pdf_output_via_gs_on_win32.inx.txt"
520   SetOutPath $INSTDIR\modules
521   File /nonfatal /a /r "..\..\inkscape\modules\*.*"
522   SetOutPath $INSTDIR\python
523   File /nonfatal /a /r "..\..\inkscape\python\*.*"
525   
526 SectionEnd
528 Section $(lng_GTKFiles) SecGTK
530   DetailPrint "Installing GTK Files ..."
531   
532   SectionIn 1 2 3 RO
533   SetOutPath $INSTDIR
534   SetOverwrite on
535   File /a /r "..\..\inkscape\*.dll"
536   File /a /r /x "locale" "..\..\inkscape\lib"
537   File /a /r "..\..\inkscape\etc"
538 SectionEnd
540 Section $(lng_Alluser) SecAlluser
541   ; disable this option in Win95/Win98/WinME
542   SectionIn 1 2 3 
543   StrCpy $MultiUser "1"
544   StrCmp $MultiUser "1" "" SingleUser
545     DetailPrint "admin mode, registry root will be HKLM"
546     SetShellVarContext all
547     Goto endSingleUser
548   SingleUser:
549     DetailPrint "single user mode, registry root will be HKCU"
550     SetShellVarContext current
551   endSingleUser:                
552 SectionEnd
554 SectionGroup $(lng_Shortcuts) SecShortcuts
556 Section /o $(lng_Desktop) SecDesktop
557   ClearErrors
558   CreateShortCut "$DESKTOP\Inkscape.lnk" "$INSTDIR\inkscape.exe"
559   IfErrors 0 +2
560     DetailPrint "Uups! Problems creating desktop shortcuts"
561 SectionEnd
563 Section /o $(lng_Quicklaunch) SecQuicklaunch
564   ClearErrors
565   StrCmp $QUICKLAUNCH $TEMP +2
566     CreateShortCut "$QUICKLAUNCH\Inkscape.lnk" "$INSTDIR\inkscape.exe"
567   IfErrors 0 +2
568     DetailPrint "Uups! Problems creating quicklaunch shortcuts"
569 SectionEnd
571 Section $(lng_SVGWriter) SecSVGWriter 
572   SectionIn 1 2 3
573   ; create file associations, test before if needed
574   DetailPrint "creating file associations"
575   ClearErrors
576   ReadRegStr $0 HKCR ".svg" ""
577   StrCmp $0 "" 0 +3
578     WriteRegStr HKCR ".svg" "" "svgfile"
579     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
580   ReadRegStr $0 HKCR ".svgz" ""
581   StrCmp $0 "" 0 +3
582     WriteRegStr HKCR ".svgz" "" "svgfile"
583     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
584   IfErrors 0 +2
585     DetailPrint "Uups! Problems creating file assoziations for svg writer"
586   
587   DetailPrint "creating default editor"
588   ClearErrors
589   ReadRegStr $0 HKCR ".svg" ""
590   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
591   ReadRegStr $0 HKCR ".svgz" ""
592   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
593   IfErrors 0 +2
594     DetailPrint "Uups! Problems creating default editor"
595 SectionEnd
597 Section $(lng_ContextMenu) SecContextMenu
598   SectionIn 1 2 3
599   ; create file associations, test before if needed
600   DetailPrint "creating file associations"
601   ClearErrors
602   ReadRegStr $0 HKCR ".svg" ""
603   StrCmp $0 "" 0 +3
604     WriteRegStr HKCR ".svg" "" "svgfile"
605     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
606   ReadRegStr $0 HKCR ".svgz" ""
607   StrCmp $0 "" 0 +3
608     WriteRegStr HKCR ".svgz" "" "svgfile"
609     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
610   IfErrors 0 +2
611     DetailPrint "Uups! Problems creating file assoziations for context menu"
612   
613   DetailPrint "creating context menue"
614   ClearErrors
615   ReadRegStr $0 HKCR ".svg" ""
616   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
617   ReadRegStr $0 HKCR ".svgz" ""
618   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
619   IfErrors 0 +2
620     DetailPrint "Uups! Problems creating context menue integration"
622 SectionEnd
624 SectionGroupEnd
626 SectionGroup $(lng_Addfiles) SecAddfiles
628 Section $(lng_Examples) SecExamples
629   SectionIn 1 2
630   SetOutPath $INSTDIR\share
631   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\examples"
632 SectionEnd
634 Section $(lng_Tutorials) SecTutorials
635   SectionIn 1 2
636   SetOutPath $INSTDIR\share
637   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\tutorials"
638 SectionEnd
640 SectionGroupEnd
642 SectionGroup /e $(lng_Languages) SecLanguages
644 Section $(lng_am) SecAmharic
645   !insertmacro Language am am
646 SectionEnd
648 Section $(lng_az) SecAzerbaijani
649   !insertmacro Language az az
650 SectionEnd
652 Section $(lng_be) SecByelorussian
653   !insertmacro Language be be
654 SectionEnd
656 Section $(lng_bg) SecBulgarian
657   !insertmacro Language bg bg
658 SectionEnd
660 Section $(lng_ca) SecCatalan
661   !insertmacro Language ca ca
662 SectionEnd
664 Section $(lng_cs) SecCzech
665   !insertmacro Language cs cs
666 SectionEnd
668 Section $(lng_da) SecDanish
669   !insertmacro Language da da
670 SectionEnd
672 Section $(lng_de) SecGerman
673   !insertmacro Language 'de' 'de'
674 SectionEnd
676 Section $(lng_dz) SecDzongkha
677   !insertmacro Language dz dz
678 SectionEnd
680 Section $(lng_el) SecGreek
681   !insertmacro Language el el
682 SectionEnd
684 Section $(lng_en) SecEnglish
685   SectionIn 1 2 3 RO
686 SectionEnd
688 Section $(lng_en_CA) SecEnglishCanadian
689   !insertmacro Language en_CA en_CA
690 SectionEnd
692 Section $(lng_en_GB) SecEnglishBritain
693   !insertmacro Language en_GB en_GB
694 SectionEnd
696 Section $(lng_en_US@piglatin) SecEnglishPiglatin
697   !insertmacro Language en_US@piglatin en_US@Piglatin
698 SectionEnd
700 Section $(lng_es) SecSpanish
701   !insertmacro Language 'es' 'es'
702 SectionEnd
704 Section $(lng_es_MX) SecSpanishMexico
705   !insertmacro Language 'es_MX' 'es_MX'
706 SectionEnd
708 Section $(lng_et) SecEstonian
709   !insertmacro Language et et
710 SectionEnd
712 Section $(lng_fr) SecFrench
713   !insertmacro Language 'fr' 'fr'
714 SectionEnd
716 Section $(lng_fi) SecFinish
717   !insertmacro Language 'fi' 'fi'
718 SectionEnd
720 Section $(lng_ga) SecIrish
721   !insertmacro Language ga ga
722 SectionEnd
724 Section $(lng_gl) SecGallegan
725   !insertmacro Language gl gl
726   SectionIn 1 2 3
727 SectionEnd
729 Section $(lng_hr) SecCroatian
730   !insertmacro Language hr hr
731   SectionIn 1 2 3
732 SectionEnd
734 Section $(lng_hu) SecHungarian
735   !insertmacro Language hu hu
736   SectionIn 1 2 3
737 SectionEnd
739 Section $(lng_it) SecItalian
740   !insertmacro Language it it
741   SectionIn 1 2 3
742 SectionEnd
744 Section $(lng_ja) SecJapanese
745   !insertmacro Language 'ja' 'jp'
746 SectionEnd
748 Section $(lng_ko) SecKorean
749   !insertmacro Language 'ko' 'ko'
750 SectionEnd
752 Section $(lng_lt) SecLithuanian
753   !insertmacro Language 'lt' 'lt'
754 SectionEnd
756 Section $(lng_mn) SecMongolian
757   !insertmacro Language mn mn
758 SectionEnd
760 Section $(lng_mk) SecMacedonian
761   !insertmacro Language mk mk
762 SectionEnd
764 Section $(lng_nb) SecNorwegianBokmal
765   !insertmacro Language nb nb
766 SectionEnd
768 Section $(lng_ne) SecNepali
769   !insertmacro Language ne ne
770 SectionEnd
772 Section $(lng_nl) SecDutch
773   !insertmacro Language nl nl
774 SectionEnd
776 Section $(lng_nn) SecNorwegianNynorsk
777   !insertmacro Language nn nn
778 SectionEnd
780 Section $(lng_pa) SecPanjabi
781   !insertmacro Language pa pa
782 SectionEnd
784 Section $(lng_pl) SecPolish
785   !insertmacro Language pl pl
786 SectionEnd
788 Section $(lng_pt) SecPortuguese
789   !insertmacro Language pt pt
790 SectionEnd
792 Section $(lng_pt_BR) SecPortugueseBrazil
793   !insertmacro Language pt_BR pt_BR
794 SectionEnd
796 Section $(lng_ru) SecRussian
797   !insertmacro Language ru ru
798 SectionEnd
800 Section $(lng_rw) SecKinyarwanda
801   !insertmacro Language rw rw
802 SectionEnd
804 Section $(lng_sk) SecSlovak
805   !insertmacro Language sk sk
806 SectionEnd
808 Section $(lng_sl) SecSlovenian
809   !insertmacro Language sl sl
810 SectionEnd
812 Section $(lng_sq) SecAlbanian
813   !insertmacro Language sq sq
814 SectionEnd
816 Section $(lng_sr) SecSerbian
817   !insertmacro Language sr sr
818 SectionEnd
820 Section $(lng_sr@Latn) SecSerbianLatin
821   !insertmacro Language 'sr@Latn' 'sr@Latn'
822 SectionEnd
824 Section $(lng_sv) SecSwedish
825   !insertmacro Language sv sv
826 SectionEnd
828 Section $(lng_th) SecThai
829   !insertmacro Language th th
830 SectionEnd
832 Section $(lng_tr) SecTurkish
833   !insertmacro Language tr tr
834 SectionEnd
836 Section $(lng_uk) SecUkrainian
837   !insertmacro Language uk uk
838 SectionEnd
840 Section $(lng_vi) SecVietnamese
841   !insertmacro Language vi vi
842 SectionEnd
844 Section $(lng_zh_CN) SecChineseSimplified
845   !insertmacro Language zh_CN zh_CN
846 SectionEnd
848 Section $(lng_zh_TW) SecChineseTaiwan
849   !insertmacro Language zh_TW zh_TW
850 SectionEnd
852 SectionGroupEnd
855 Section -FinalizeInstallation
856   StrCmp $MultiUser "1" "" SingleUser
857     DetailPrint "admin mode, registry root will be HKLM"
858     SetShellVarContext all
859     Goto endSingleUser
860   SingleUser:
861     DetailPrint "single user mode, registry root will be HKCU"
862     SetShellVarContext current
863   endSingleUser:                
865   ; check for writing registry
866   ClearErrors
867   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inkscape.exe"  
868   ;IfErrors 0 +4
869   ;  DetailPrint "fatal: failed to write to ${PRODUCT_DIR_REGKEY}"
870   ;  DetailPrint "aborting installation"
871   ;     Abort
872   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "MultiUser" "$MultiUser"  
873   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "askMultiUser" "$askMultiUser"
874   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "User" "$User"
875   IfErrors 0 +2
876     DetailPrint "fatal: failed to write to registry installation info"
878   ; start menu entries
879   ClearErrors
880   CreateShortCut "$SMPROGRAMS\Inkscape.lnk" "$INSTDIR\inkscape.exe"
881   IfErrors 0 +2
882     DetailPrint "fatal: failed to write to start menu info"
884   ; uninstall settings
885   ClearErrors
886   WriteUninstaller "$INSTDIR\uninst.exe"
887   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" '"$INSTDIR\uninst.exe"'
888   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
889   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
890   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0"
891   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
892   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" "1"
893   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" "1"
894   IfErrors 0 +2
895     DetailPrint "fatal: failed to write to registry un-installation info"
896 SectionEnd
897  
898 ; Last the Descriptions
899 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
900   !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(lng_CoreDesc)
901   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} $(lng_GTKFilesDesc)
902   !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(lng_ShortcutsDesc)
903   !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} $(lng_AlluserDesc) 
904   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(lng_DesktopDesc)
905   !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} $(lng_QuicklaunchDesc)
906   !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} $(lng_SVGWriterDesc)
907   !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} $(lng_ContextMenuDesc)
908   !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} $(lng_AddfilesDesc)
909   !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} $(lng_ExamplesDesc)
910   !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} $(lng_TutorialsDesc)
911   !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(lng_LanguagesDesc)
912 !insertmacro MUI_FUNCTION_DESCRIPTION_END
914 !macro Parameter key Section
915   Push ${key}
916   Push ""
917   Call GetParameterValue
918   Pop $1
919   StrCmp $1 "OFF" 0 +5
920     SectionGetFlags ${Section} $0
921     IntOp $2 ${SF_SELECTED} ~
922     IntOp $0 $0 & $2
923     SectionSetFlags ${Section} $0
924   StrCmp $1 "ON" 0 +4
925     SectionGetFlags ${Section} $0
926     IntOp $0 $0 | ${SF_SELECTED}
927     SectionSetFlags ${Section} $0
928 !macroend
930 Function .onInit
931   ;Extract InstallOptions INI files
932   StrCpy $AskMultiUser "1"
933   StrCpy $MultiUser "0"
934   ; this resets AskMultiUser if Win95/98/ME
935   Call GetWindowsVersion
936   Pop $R0
937   DetailPrint "detected operating system $R0"
938   ;MessageBox MB_OK "operating system: $R0; AskMultiuser: $AskMultiUser"
939   
940   ; hide all user section if win98
941   StrCmp $AskMultiUser "1" +2
942     SectionSetText ${SecAlluser} ""
944   ; hide if quick launch if not available
945   StrCmp $QUICKLAUNCH $TEMP 0 +2
946     SectionSetText ${SecQuicklaunch} ""
948   ;check if user is admin
949   ClearErrors
950         UserInfo::GetName
951         IfErrors info_Win9x
952         Pop $0
953         StrCpy $User $0
954         UserInfo::GetAccountType
955         Pop $1
956         StrCmp $1 "Admin" info_done
958         MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_NO_ADMIN)"
960         Goto info_done
962         info_Win9x:
963                 # This one means you don't need to care about admin or
964                 # not admin because Windows 9x doesn't either
965                 MessageBox MB_OK|MB_ICONEXCLAMATION $(lng_NOT_SUPPORTED)
967         info_done:
969   ;check for previous installation
970   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
971   StrCmp $0 "" +1 +2
972   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
973   ;check user if applicable
974   StrCmp $0 "" +3
975     StrCmp $0 $User +2
976           MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)"
977         
978   ; proccess command line parameter
979   !insertmacro Parameter "GTK" ${SecGTK}
980   !insertmacro Parameter "SHORTCUTS" ${secShortcuts}
981   !insertmacro Parameter "ALLUSER" ${SecAlluser}
982   !insertmacro Parameter "DESKTOP" ${SecDesktop}
983   !insertmacro Parameter "QUICKLAUNCH" ${SecQUICKlaunch}
984   !insertmacro Parameter "SVGEDITOR" ${SecSVGWriter}
985   !insertmacro Parameter "CONTEXTMENUE" ${SecContextMenu}
986   !insertmacro Parameter "ADDFILES" ${SecAddfiles}
987   !insertmacro Parameter "EXAMPLES" ${SecExamples}
988   !insertmacro Parameter "TUTORIALS" ${SecTutorials}
989   !insertmacro Parameter "LANGUAGES" ${SecLanguages}
990   !insertmacro Parameter "am" ${SecAmharic}
991   !insertmacro Parameter "az" ${SecAzerbaijani}
992   !insertmacro Parameter "be" ${SecByelorussian}
993   !insertmacro Parameter "ca" ${SecCatalan}
994   !insertmacro Parameter "cs" ${SecCzech}
995   !insertmacro Parameter "da" ${SecDanish}
996   !insertmacro Parameter "de" ${SecGerman}
997   !insertmacro Parameter "el" ${SecGreek}
998   !insertmacro Parameter "es" ${SecSpanish}
999   !insertmacro Parameter "es_MX" ${SecSpanishMexico}
1000   !insertmacro Parameter "et" ${SecEstonian}
1001   !insertmacro Parameter "fr" ${SecFrench}
1002   !insertmacro Parameter "ga" ${SecIrish}
1003   !insertmacro Parameter "gl" ${SecGallegan}
1004   !insertmacro Parameter "hu" ${SecHungarian}
1005   !insertmacro Parameter "it" ${SecItalian}
1006   !insertmacro Parameter "ja" ${SecJapanese}
1007   !insertmacro Parameter "ko" ${SecKorean}
1008   !insertmacro Parameter "mk" ${SecMacedonian}
1009   !insertmacro Parameter "nb" ${SecNorwegianBokmal}
1010   !insertmacro Parameter "nl" ${SecDutch}
1011   !insertmacro Parameter "nn" ${SecNorwegianNynorsk}
1012   !insertmacro Parameter "pa" ${SecPanjabi}
1013   !insertmacro Parameter "pl" ${SecPolish}
1014   !insertmacro Parameter "pt" ${SecPortuguese}
1015   !insertmacro Parameter "pt_BR" ${SecPortugueseBrazil}
1016   !insertmacro Parameter "ru" ${SecRussian}
1017   !insertmacro Parameter "sk" ${SecSlovak}
1018   !insertmacro Parameter "sl" ${SecSlovenian}
1019   !insertmacro Parameter "sr" ${SecSerbian}
1020   !insertmacro Parameter "sr@Latn" ${SecSerbianLatin}
1021   !insertmacro Parameter "sv" ${SecSwedish}
1022   !insertmacro Parameter "tr" ${SecTurkish}
1023   !insertmacro Parameter "uk" ${SecUkrainian}
1024   !insertmacro Parameter "zh_CN" ${SecChineseSimplified}
1025   !insertmacro Parameter "zh_TW" ${SecChineseTaiwan}
1026   
1027   Push "?"
1028   Push "TEST"
1029   Call GetParameterValue
1030   Pop $1
1031   StrCmp $1 "TEST" +3
1032     MessageBox MB_OK "possible parameters for installer:$\r$\n \
1033       /?: this help screen$\r$\n \
1034       /S: silent$\r$\n \
1035       /D=(directory): where to install inkscape$\r$\n \
1036       /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
1037       /SHORTCUTS=(OFF/ON): shortcuts to start inkscape$\r$\n \
1038       /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
1039       /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
1040       /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
1041       /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
1042       /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
1043       /ADDFILES=(OFF/ON): additional files$\r$\n \
1044       /EXAMPLES=(OFF/ON): examples$\r$\n \
1045       /TUTORIALS=(OFF/ON): tutorials$\r$\n \
1046       /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
1047       /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
1048     Abort
1049 FunctionEnd
1051 Function .onSelChange
1052 FunctionEnd
1054 ; --------------------------------------------------
1056 Function un.CustomPageUninstall
1057   !insertmacro MUI_HEADER_TEXT "$(lng_UInstOpt)" "$(lng_UInstOpt1)"
1058   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 1" "Text" "$APPDATA\Inkscape\preferences.xml"
1059   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 2" "Text" "$(lng_PurgePrefs)"
1061   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall"
1062   !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State"
1063   DetailPrint "keepfiles = $MultiUser" 
1064           ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1066 FunctionEnd
1069 Function un.onInit
1071   ClearErrors
1072   StrCpy $User ""
1073         UserInfo::GetName
1074         IfErrors +3
1075         Pop $0
1076         StrCpy $User $0
1078   StrCpy $askMultiUser "1"
1079   StrCpy $MultiUser "1"
1080  
1081   ; Test if this was a multiuser installation
1082   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" ""
1083   StrCmp $0  "$INSTDIR\inkscape.exe" 0 +5  
1084     ReadRegStr $MultiUser HKLM "${PRODUCT_DIR_REGKEY}" "MultiUser"
1085     ReadRegStr $askMultiUser HKLM "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1086         ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
1087         Goto +4
1088   ReadRegStr $MultiUser HKCU "${PRODUCT_DIR_REGKEY}" "MultiUser"
1089   ReadRegStr $askMultiUser HKCU "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1090   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
1091   ;check user if applicable
1092   StrCmp $0 "" +3
1093     StrCmp $0 $User +2
1094           MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)"
1095     
1096  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "inkscape.nsi.uninstall"
1098  ;check whether Multi user installation ?
1099  SetShellVarContext all
1100  StrCmp $MultiUser "0" 0 +2 
1101  SetShellVarContext current
1102  ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1103    
1104 FunctionEnd
1106 Section Uninstall
1108   ; remove personal settings
1109   Delete "$APPDATA\Inkscape\extension-errors.log"
1110   StrCmp $MultiUser "0" 0 endPurge  ; multiuser assigned in dialog
1111     DetailPrint "purge personal settings in $APPDATA\Inkscape"
1112     RMDir /r "$APPDATA\Inkscape"
1113   endPurge:
1115   ; Remove file associations for svg editor
1116   DetailPrint "removing file associations for svg editor"
1117   ClearErrors
1118   ReadRegStr $0 HKCR ".svg" ""
1119   DetailPrint ".svg associated as $0"
1120   IfErrors endUninstSVGEdit  
1121     ReadRegStr $1 HKCR "$0\shell\edit\command" ""
1122         IfErrors 0 +2  
1123       DetailPrint "svg editor is $1"
1124     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1125       DetailPrint "removing default .svg editor"
1126       DeleteRegKey HKCR "$0\shell\edit\command"
1127     DeleteRegKey /ifempty HKCR "$0\shell\edit"
1128     DeleteRegKey /ifempty HKCR "$0\shell"
1129     DeleteRegKey /ifempty HKCR "$0"
1130   endUninstSVGEdit:
1131   
1132   ClearErrors
1133   ReadRegStr $2 HKCR ".svgz" ""
1134   DetailPrint ".svgz associated as $2"
1135   IfErrors endUninstSVGZEdit  
1136     ReadRegStr $3 HKCR "$2\shell\edit\command" ""
1137     IfErrors 0 +2  
1138       DetailPrint "svgz editor is $1"
1139     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1140       DetailPrint "removing default .svgz editor"
1141       DeleteRegKey HKCR "$2\shell\edit\command"
1142     DeleteRegKey /ifempty HKCR "$2\shell\edit"
1143     DeleteRegKey /ifempty HKCR "$2\shell"
1144     DeleteRegKey /ifempty HKCR "$2"
1145   endUninstSVGZEdit:
1146   
1147   ; Remove file associations for svg editor
1148   DetailPrint "removing file associations for svg editor"
1149   ClearErrors
1150   ReadRegStr $0 HKCR ".svg" ""
1151   IfErrors endUninstSVGView
1152     ReadRegStr $1 HKCR "$0\shell\open\command" ""
1153     IfErrors 0 +2  
1154       DetailPrint "svg viewer is $1"
1155     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1156       DetailPrint "removing default .svg viewer"
1157       DeleteRegKey HKCR "$0\shell\open\command"
1158     DeleteRegKey /ifempty HKCR "$0\shell\open"
1159     DeleteRegKey /ifempty HKCR "$0\shell"
1160     DeleteRegKey /ifempty HKCR "$0"
1161   endUninstSVGView:
1162   
1163   ClearErrors
1164   ReadRegStr $2 HKCR ".svgz" ""
1165   IfErrors endUninstSVGZView
1166     ReadRegStr $3 HKCR "$2\shell\open\command" ""
1167     IfErrors 0 +2  
1168       DetailPrint "svgz viewer is $1"
1169     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1170       DetailPrint "removing default .svgz viewer"
1171       DeleteRegKey HKCR "$2\shell\open\command"
1172     DeleteRegKey /ifempty HKCR "$2\shell\open"
1173     DeleteRegKey /ifempty HKCR "$2\shell"
1174     DeleteRegKey /ifempty HKCR "$2"
1175   endUninstSVGZView:
1176   
1177   ; Remove file associations for context menue
1178   DetailPrint "removing file associations for svg editor"
1179   ClearErrors
1180   ReadRegStr $0 HKCR ".svg" ""
1181   IfErrors endUninstSVGContext
1182   DetailPrint "removing default .svg context menue"
1183   DeleteRegKey HKCR "$0\shell\${PRODUCT_NAME}"
1184   DeleteRegKey /ifempty HKCR "$0\shell"
1185   DeleteRegKey /ifempty HKCR "$0"
1186   endUninstSVGContext:
1187   
1188   ClearErrors
1189   ReadRegStr $2 HKCR ".svgz" ""
1190   IfErrors endUninstSVGZContext
1191   DetailPrint "removing default .svgzcontext menue"
1192   DeleteRegKey HKCR "$2\shell\${PRODUCT_NAME}"
1193   DeleteRegKey /ifempty HKCR "$2\shell"
1194   DeleteRegKey /ifempty HKCR "$2"
1195   endUninstSVGZContext:
1197   ReadRegStr $1 HKCR "$0" ""
1198   StrCmp $1 "" 0 +3
1199     DetailPrint "removing filetype .svg $0"
1200     DeleteRegKey HKCR ".svg"
1201   
1202   ReadRegStr $3 HKCR "$2" ""
1203   StrCmp $3 "" 0 +3
1204     DetailPrint "removing filetype .svgz $2"
1205     DeleteRegKey HKCR ".svgz"
1206   
1207     
1208   SetShellVarContext all
1209   DetailPrint "removing product regkey"
1210   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1211   DetailPrint "removing uninstall info"
1212   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1213   DetailPrint "removing shortcuts"
1214   Delete "$DESKTOP\Inkscape.lnk"
1215   Delete "$QUICKLAUNCH\Inkscape.lnk"
1216   Delete "$SMPROGRAMS\Inkscape.lnk"
1217   ;just in case they are still there
1218   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1219   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1220   RMDir  "$SMPROGRAMS\Inkscape"
1222   SetShellVarContext current
1223   DetailPrint "removing product regkey"
1224   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1225   DetailPrint "removing uninstall info"
1226   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1227   DetailPrint "removing shortcuts"
1228   Delete "$DESKTOP\Inkscape.lnk"
1229   Delete "$QUICKLAUNCH\Inkscape.lnk"
1230   Delete "$SMPROGRAMS\Inkscape.lnk"
1231   ;just in case they are still there
1232   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1233   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1234   RMDir  "$SMPROGRAMS\Inkscape"
1236   DetailPrint "removing uninstall info"
1237   RMDir /r "$INSTDIR"
1239   SetAutoClose false
1241 SectionEnd