Code

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