Code

added inkscape translation to commandline parameters
[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\share\screens
525   File /a "..\..\inkscape\share\screens\about.bg.svg"
526   SetOutPath $INSTDIR\modules
527   File /nonfatal /a /r "..\..\inkscape\modules\*.*"
528   SetOutPath $INSTDIR\python
529   File /nonfatal /a /r "..\..\inkscape\python\*.*"
531   
532 SectionEnd
534 Section $(lng_GTKFiles) SecGTK
536   DetailPrint "Installing GTK Files ..."
537   
538   SectionIn 1 2 3 RO
539   SetOutPath $INSTDIR
540   SetOverwrite on
541   File /a /r "..\..\inkscape\*.dll"
542   File /a /r /x "locale" "..\..\inkscape\lib"
543   File /a /r "..\..\inkscape\etc"
544 SectionEnd
546 Section $(lng_Alluser) SecAlluser
547   ; disable this option in Win95/Win98/WinME
548   SectionIn 1 2 3 
549   StrCpy $MultiUser "1"
550   StrCmp $MultiUser "1" "" SingleUser
551     DetailPrint "admin mode, registry root will be HKLM"
552     SetShellVarContext all
553     Goto endSingleUser
554   SingleUser:
555     DetailPrint "single user mode, registry root will be HKCU"
556     SetShellVarContext current
557   endSingleUser:                
558 SectionEnd
560 SectionGroup $(lng_Shortcuts) SecShortcuts
562 Section /o $(lng_Desktop) SecDesktop
563   ClearErrors
564   CreateShortCut "$DESKTOP\Inkscape.lnk" "$INSTDIR\inkscape.exe"
565   IfErrors 0 +2
566     DetailPrint "Uups! Problems creating desktop shortcuts"
567 SectionEnd
569 Section /o $(lng_Quicklaunch) SecQuicklaunch
570   ClearErrors
571   StrCmp $QUICKLAUNCH $TEMP +2
572     CreateShortCut "$QUICKLAUNCH\Inkscape.lnk" "$INSTDIR\inkscape.exe"
573   IfErrors 0 +2
574     DetailPrint "Uups! Problems creating quicklaunch shortcuts"
575 SectionEnd
577 Section $(lng_SVGWriter) SecSVGWriter 
578   SectionIn 1 2 3
579   ; create file associations, test before if needed
580   DetailPrint "creating file associations"
581   ClearErrors
582   ReadRegStr $0 HKCR ".svg" ""
583   StrCmp $0 "" 0 +3
584     WriteRegStr HKCR ".svg" "" "svgfile"
585     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
586   ReadRegStr $0 HKCR ".svgz" ""
587   StrCmp $0 "" 0 +3
588     WriteRegStr HKCR ".svgz" "" "svgfile"
589     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
590   IfErrors 0 +2
591     DetailPrint "Uups! Problems creating file assoziations for svg writer"
592   
593   DetailPrint "creating default editor"
594   ClearErrors
595   ReadRegStr $0 HKCR ".svg" ""
596   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
597   ReadRegStr $0 HKCR ".svgz" ""
598   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
599   IfErrors 0 +2
600     DetailPrint "Uups! Problems creating default editor"
601 SectionEnd
603 Section $(lng_ContextMenu) SecContextMenu
604   SectionIn 1 2 3
605   ; create file associations, test before if needed
606   DetailPrint "creating file associations"
607   ClearErrors
608   ReadRegStr $0 HKCR ".svg" ""
609   StrCmp $0 "" 0 +3
610     WriteRegStr HKCR ".svg" "" "svgfile"
611     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
612   ReadRegStr $0 HKCR ".svgz" ""
613   StrCmp $0 "" 0 +3
614     WriteRegStr HKCR ".svgz" "" "svgfile"
615     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
616   IfErrors 0 +2
617     DetailPrint "Uups! Problems creating file assoziations for context menu"
618   
619   DetailPrint "creating context menue"
620   ClearErrors
621   ReadRegStr $0 HKCR ".svg" ""
622   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
623   ReadRegStr $0 HKCR ".svgz" ""
624   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
625   IfErrors 0 +2
626     DetailPrint "Uups! Problems creating context menue integration"
628 SectionEnd
630 SectionGroupEnd
632 SectionGroup $(lng_Addfiles) SecAddfiles
634 Section $(lng_Examples) SecExamples
635   SectionIn 1 2
636   SetOutPath $INSTDIR\share
637   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\examples"
638 SectionEnd
640 Section $(lng_Tutorials) SecTutorials
641   SectionIn 1 2
642   SetOutPath $INSTDIR\share
643   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\tutorials"
644 SectionEnd
646 SectionGroupEnd
648 SectionGroup /e $(lng_Languages) SecLanguages
650 Section $(lng_am) SecAmharic
651   !insertmacro Language am am
652 SectionEnd
654 Section $(lng_az) SecAzerbaijani
655   !insertmacro Language az az
656 SectionEnd
658 Section $(lng_be) SecByelorussian
659   !insertmacro Language be be
660 SectionEnd
662 Section $(lng_bg) SecBulgarian
663   !insertmacro Language bg bg
664 SectionEnd
666 Section $(lng_ca) SecCatalan
667   !insertmacro Language ca ca
668 SectionEnd
670 Section $(lng_cs) SecCzech
671   !insertmacro Language cs cs
672 SectionEnd
674 Section $(lng_da) SecDanish
675   !insertmacro Language da da
676 SectionEnd
678 Section $(lng_de) SecGerman
679   !insertmacro Language 'de' 'de'
680 SectionEnd
682 Section $(lng_dz) SecDzongkha
683   !insertmacro Language dz dz
684 SectionEnd
686 Section $(lng_el) SecGreek
687   !insertmacro Language el el
688 SectionEnd
690 Section $(lng_en) SecEnglish
691   SectionIn 1 2 3 RO
692 SectionEnd
694 Section $(lng_en_CA) SecEnglishCanadian
695   !insertmacro Language en_CA en_CA
696 SectionEnd
698 Section $(lng_en_GB) SecEnglishBritain
699   !insertmacro Language en_GB en_GB
700 SectionEnd
702 Section $(lng_en_US@piglatin) SecEnglishPiglatin
703   !insertmacro Language en_US@piglatin en_US@Piglatin
704 SectionEnd
706 Section $(lng_es) SecSpanish
707   !insertmacro Language 'es' 'es'
708 SectionEnd
710 Section $(lng_es_MX) SecSpanishMexico
711   !insertmacro Language 'es_MX' 'es_MX'
712 SectionEnd
714 Section $(lng_et) SecEstonian
715   !insertmacro Language et et
716 SectionEnd
718 Section $(lng_eu) SecBasque
719   !insertmacro Language eu eu
720 SectionEnd
722 Section $(lng_fr) SecFrench
723   !insertmacro Language 'fr' 'fr'
724 SectionEnd
726 Section $(lng_fi) SecFinish
727   !insertmacro Language 'fi' 'fi'
728 SectionEnd
730 Section $(lng_ga) SecIrish
731   !insertmacro Language ga ga
732 SectionEnd
734 Section $(lng_gl) SecGallegan
735   !insertmacro Language gl gl
736   SectionIn 1 2 3
737 SectionEnd
739 Section $(lng_hr) SecCroatian
740   !insertmacro Language hr hr
741   SectionIn 1 2 3
742 SectionEnd
744 Section $(lng_hu) SecHungarian
745   !insertmacro Language hu hu
746   SectionIn 1 2 3
747 SectionEnd
749 Section $(lng_it) SecItalian
750   !insertmacro Language it it
751   SectionIn 1 2 3
752 SectionEnd
754 Section $(lng_ja) SecJapanese
755   !insertmacro Language 'ja' 'jp'
756 SectionEnd
758 Section $(lng_km) SecKhmer
759   !insertmacro Language km km
760 SectionEnd
762 Section $(lng_ko) SecKorean
763   !insertmacro Language 'ko' 'ko'
764 SectionEnd
766 Section $(lng_lt) SecLithuanian
767   !insertmacro Language 'lt' 'lt'
768 SectionEnd
770 Section $(lng_mn) SecMongolian
771   !insertmacro Language mn mn
772 SectionEnd
774 Section $(lng_mk) SecMacedonian
775   !insertmacro Language mk mk
776 SectionEnd
778 Section $(lng_nb) SecNorwegianBokmal
779   !insertmacro Language nb nb
780 SectionEnd
782 Section $(lng_ne) SecNepali
783   !insertmacro Language ne ne
784 SectionEnd
786 Section $(lng_nl) SecDutch
787   !insertmacro Language nl nl
788 SectionEnd
790 Section $(lng_nn) SecNorwegianNynorsk
791   !insertmacro Language nn nn
792 SectionEnd
794 Section $(lng_pa) SecPanjabi
795   !insertmacro Language pa pa
796 SectionEnd
798 Section $(lng_pl) SecPolish
799   !insertmacro Language pl pl
800 SectionEnd
802 Section $(lng_pt) SecPortuguese
803   !insertmacro Language pt pt
804 SectionEnd
806 Section $(lng_pt_BR) SecPortugueseBrazil
807   !insertmacro Language pt_BR pt_BR
808 SectionEnd
810 Section $(lng_ru) SecRussian
811   !insertmacro Language ru ru
812 SectionEnd
814 Section $(lng_rw) SecKinyarwanda
815   !insertmacro Language rw rw
816 SectionEnd
818 Section $(lng_sk) SecSlovak
819   !insertmacro Language sk sk
820 SectionEnd
822 Section $(lng_sl) SecSlovenian
823   !insertmacro Language sl sl
824 SectionEnd
826 Section $(lng_sq) SecAlbanian
827   !insertmacro Language sq sq
828 SectionEnd
830 Section $(lng_sr) SecSerbian
831   !insertmacro Language sr sr
832 SectionEnd
834 Section $(lng_sr@Latn) SecSerbianLatin
835   !insertmacro Language 'sr@Latn' 'sr@Latn'
836 SectionEnd
838 Section $(lng_sv) SecSwedish
839   !insertmacro Language sv sv
840 SectionEnd
842 Section $(lng_th) SecThai
843   !insertmacro Language th th
844 SectionEnd
846 Section $(lng_tr) SecTurkish
847   !insertmacro Language tr tr
848 SectionEnd
850 Section $(lng_uk) SecUkrainian
851   !insertmacro Language uk uk
852 SectionEnd
854 Section $(lng_vi) SecVietnamese
855   !insertmacro Language vi vi
856 SectionEnd
858 Section $(lng_zh_CN) SecChineseSimplified
859   !insertmacro Language zh_CN zh_CN
860 SectionEnd
862 Section $(lng_zh_TW) SecChineseTaiwan
863   !insertmacro Language zh_TW zh_TW
864 SectionEnd
866 SectionGroupEnd
869 Section -FinalizeInstallation
870   StrCmp $MultiUser "1" "" SingleUser
871     DetailPrint "admin mode, registry root will be HKLM"
872     SetShellVarContext all
873     Goto endSingleUser
874   SingleUser:
875     DetailPrint "single user mode, registry root will be HKCU"
876     SetShellVarContext current
877   endSingleUser:                
879   ; check for writing registry
880   ClearErrors
881   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inkscape.exe"  
882   ;IfErrors 0 +4
883   ;  DetailPrint "fatal: failed to write to ${PRODUCT_DIR_REGKEY}"
884   ;  DetailPrint "aborting installation"
885   ;     Abort
886   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "MultiUser" "$MultiUser"  
887   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "askMultiUser" "$askMultiUser"
888   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "User" "$User"
889   IfErrors 0 +2
890     DetailPrint "fatal: failed to write to registry installation info"
892   ; start menu entries
893   ClearErrors
894   CreateShortCut "$SMPROGRAMS\Inkscape.lnk" "$INSTDIR\inkscape.exe"
895   IfErrors 0 +2
896     DetailPrint "fatal: failed to write to start menu info"
898   ; uninstall settings
899   ClearErrors
900   WriteUninstaller "$INSTDIR\uninst.exe"
901   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" '"$INSTDIR\uninst.exe"'
902   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
903   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
904   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0"
905   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
906   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" "1"
907   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" "1"
908   IfErrors 0 +2
909     DetailPrint "fatal: failed to write to registry un-installation info"
910 SectionEnd
911  
912 ; Last the Descriptions
913 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
914   !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(lng_CoreDesc)
915   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} $(lng_GTKFilesDesc)
916   !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(lng_ShortcutsDesc)
917   !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} $(lng_AlluserDesc) 
918   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(lng_DesktopDesc)
919   !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} $(lng_QuicklaunchDesc)
920   !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} $(lng_SVGWriterDesc)
921   !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} $(lng_ContextMenuDesc)
922   !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} $(lng_AddfilesDesc)
923   !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} $(lng_ExamplesDesc)
924   !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} $(lng_TutorialsDesc)
925   !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(lng_LanguagesDesc)
926 !insertmacro MUI_FUNCTION_DESCRIPTION_END
928 !macro Parameter key Section
929   Push ${key}
930   Push ""
931   Call GetParameterValue
932   Pop $1
933   StrCmp $1 "OFF" 0 +5
934     SectionGetFlags ${Section} $0
935     IntOp $2 ${SF_SELECTED} ~
936     IntOp $0 $0 & $2
937     SectionSetFlags ${Section} $0
938   StrCmp $1 "ON" 0 +4
939     SectionGetFlags ${Section} $0
940     IntOp $0 $0 | ${SF_SELECTED}
941     SectionSetFlags ${Section} $0
942 !macroend
944 Function .onInit
945   ;Extract InstallOptions INI files
946   StrCpy $AskMultiUser "1"
947   StrCpy $MultiUser "0"
948   ; this resets AskMultiUser if Win95/98/ME
949   Call GetWindowsVersion
950   Pop $R0
951   DetailPrint "detected operating system $R0"
952   ;MessageBox MB_OK "operating system: $R0; AskMultiuser: $AskMultiUser"
953   
954   ; hide all user section if win98
955   StrCmp $AskMultiUser "1" +2
956     SectionSetText ${SecAlluser} ""
958   ; hide if quick launch if not available
959   StrCmp $QUICKLAUNCH $TEMP 0 +2
960     SectionSetText ${SecQuicklaunch} ""
962   ;check if user is admin
963   ClearErrors
964         UserInfo::GetName
965         IfErrors info_Win9x
966         Pop $0
967         StrCpy $User $0
968         UserInfo::GetAccountType
969         Pop $1
970         StrCmp $1 "Admin" info_done
972         MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_NO_ADMIN)"
974         Goto info_done
976         info_Win9x:
977                 # This one means you don't need to care about admin or
978                 # not admin because Windows 9x doesn't either
979                 MessageBox MB_OK|MB_ICONEXCLAMATION $(lng_NOT_SUPPORTED)
981         info_done:
983   ;check for previous installation
984   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
985   StrCmp $0 "" +1 +2
986   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
987   ;check user if applicable
988   StrCmp $0 "" +3
989     StrCmp $0 $User +2
990           MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)"
991         
992   ; proccess command line parameter
993   !insertmacro Parameter "GTK" ${SecGTK}
994   !insertmacro Parameter "SHORTCUTS" ${secShortcuts}
995   !insertmacro Parameter "ALLUSER" ${SecAlluser}
996   !insertmacro Parameter "DESKTOP" ${SecDesktop}
997   !insertmacro Parameter "QUICKLAUNCH" ${SecQUICKlaunch}
998   !insertmacro Parameter "SVGEDITOR" ${SecSVGWriter}
999   !insertmacro Parameter "CONTEXTMENUE" ${SecContextMenu}
1000   !insertmacro Parameter "ADDFILES" ${SecAddfiles}
1001   !insertmacro Parameter "EXAMPLES" ${SecExamples}
1002   !insertmacro Parameter "TUTORIALS" ${SecTutorials}
1003   !insertmacro Parameter "LANGUAGES" ${SecLanguages}
1004   !insertmacro Parameter "am" ${SecAmharic}
1005   !insertmacro Parameter "az" ${SecAzerbaijani}
1006   !insertmacro Parameter "be" ${SecByelorussian}
1007   !insertmacro Parameter "bg" ${SecBulgarian}
1008   !insertmacro Parameter "ca" ${SecCatalan}
1009   !insertmacro Parameter "cs" ${SecCzech}
1010   !insertmacro Parameter "da" ${SecDanish}
1011   !insertmacro Parameter "de" ${SecGerman}
1012   !insertmacro Parameter "dz" ${SecDzongkha}
1013   !insertmacro Parameter "el" ${SecGreek}
1014   !insertmacro Parameter "en_CA" ${SecEnglishCanadian}
1015   !insertmacro Parameter "en_GB" ${SecEnglishBritain}
1016   !insertmacro Parameter "en_US@piglatin" ${SecEnglishPiglatin}
1017   !insertmacro Parameter "es" ${SecSpanish}
1018   !insertmacro Parameter "es_MX" ${SecSpanishMexico}
1019   !insertmacro Parameter "et" ${SecEstonian}
1020   !insertmacro Parameter "eu" ${SecBasque}
1021   !insertmacro Parameter "fi" ${SecFinish}
1022   !insertmacro Parameter "fr" ${SecFrench}
1023   !insertmacro Parameter "ga" ${SecIrish}
1024   !insertmacro Parameter "gl" ${SecGallegan}
1025   !insertmacro Parameter "hr" ${SecCroatian}
1026   !insertmacro Parameter "hu" ${SecHungarian}
1027   !insertmacro Parameter "it" ${SecItalian}
1028   !insertmacro Parameter "ja" ${SecJapanese}
1029   !insertmacro Parameter "km" ${SecKhmer}
1030   !insertmacro Parameter "ko" ${SecKorean}
1031   !insertmacro Parameter "lt" ${SecLithuanian}
1032   !insertmacro Parameter "mk" ${SecMacedonian}
1033   !insertmacro Parameter "mn" ${SecMongolian}
1034   !insertmacro Parameter "nb" ${SecNorwegianBokmal}
1035   !insertmacro Parameter "ne" ${SecNepali}
1036   !insertmacro Parameter "nl" ${SecDutch}
1037   !insertmacro Parameter "nn" ${SecNorwegianNynorsk}
1038   !insertmacro Parameter "pa" ${SecPanjabi}
1039   !insertmacro Parameter "pl" ${SecPolish}
1040   !insertmacro Parameter "pt" ${SecPortuguese}
1041   !insertmacro Parameter "pt_BR" ${SecPortugueseBrazil}
1042   !insertmacro Parameter "ru" ${SecRussian}
1043   !insertmacro Parameter "rw" ${SecKinyarwanda}
1044   !insertmacro Parameter "sk" ${SecSlovak}
1045   !insertmacro Parameter "sl" ${SecSlovenian}
1046   !insertmacro Parameter "sq" ${SecAlbanian}
1047   !insertmacro Parameter "sr" ${SecSerbian}
1048   !insertmacro Parameter "sr@Latn" ${SecSerbianLatin}
1049   !insertmacro Parameter "sv" ${SecSwedish}
1050   !insertmacro Parameter "th" ${SecThai}
1051   !insertmacro Parameter "tr" ${SecTurkish}
1052   !insertmacro Parameter "uk" ${SecUkrainian}
1053   !insertmacro Parameter "vi" ${SecVietnamese}
1054   !insertmacro Parameter "zh_CN" ${SecChineseSimplified}
1055   !insertmacro Parameter "zh_TW" ${SecChineseTaiwan}
1056   
1057   Push "?"
1058   Push "TEST"
1059   Call GetParameterValue
1060   Pop $1
1061   StrCmp $1 "TEST" +3
1062     MessageBox MB_OK "possible parameters for installer:$\r$\n \
1063       /?: this help screen$\r$\n \
1064       /S: silent$\r$\n \
1065       /D=(directory): where to install inkscape$\r$\n \
1066       /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
1067       /SHORTCUTS=(OFF/ON): shortcuts to start inkscape$\r$\n \
1068       /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
1069       /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
1070       /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
1071       /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
1072       /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
1073       /ADDFILES=(OFF/ON): additional files$\r$\n \
1074       /EXAMPLES=(OFF/ON): examples$\r$\n \
1075       /TUTORIALS=(OFF/ON): tutorials$\r$\n \
1076       /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
1077       /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
1078     Abort
1079 FunctionEnd
1081 Function .onSelChange
1082 FunctionEnd
1084 ; --------------------------------------------------
1086 Function un.CustomPageUninstall
1087   !insertmacro MUI_HEADER_TEXT "$(lng_UInstOpt)" "$(lng_UInstOpt1)"
1088   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 1" "Text" "$APPDATA\Inkscape\preferences.xml"
1089   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 2" "Text" "$(lng_PurgePrefs)"
1091   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall"
1092   !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State"
1093   DetailPrint "keepfiles = $MultiUser" 
1094           ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1096 FunctionEnd
1099 Function un.onInit
1101   ClearErrors
1102   StrCpy $User ""
1103         UserInfo::GetName
1104         IfErrors +3
1105         Pop $0
1106         StrCpy $User $0
1108   StrCpy $askMultiUser "1"
1109   StrCpy $MultiUser "1"
1110  
1111   ; Test if this was a multiuser installation
1112   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" ""
1113   StrCmp $0  "$INSTDIR\inkscape.exe" 0 +5  
1114     ReadRegStr $MultiUser HKLM "${PRODUCT_DIR_REGKEY}" "MultiUser"
1115     ReadRegStr $askMultiUser HKLM "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1116         ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
1117         Goto +4
1118   ReadRegStr $MultiUser HKCU "${PRODUCT_DIR_REGKEY}" "MultiUser"
1119   ReadRegStr $askMultiUser HKCU "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1120   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
1121   ;check user if applicable
1122   StrCmp $0 "" +3
1123     StrCmp $0 $User +2
1124           MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)"
1125     
1126  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "inkscape.nsi.uninstall"
1128  ;check whether Multi user installation ?
1129  SetShellVarContext all
1130  StrCmp $MultiUser "0" 0 +2 
1131  SetShellVarContext current
1132  ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1133    
1134 FunctionEnd
1136 Section Uninstall
1138   ; remove personal settings
1139   Delete "$APPDATA\Inkscape\extension-errors.log"
1140   StrCmp $MultiUser "0" 0 endPurge  ; multiuser assigned in dialog
1141     DetailPrint "purge personal settings in $APPDATA\Inkscape"
1142     RMDir /r "$APPDATA\Inkscape"
1143   endPurge:
1145   ; Remove file associations for svg editor
1146   DetailPrint "removing file associations for svg editor"
1147   ClearErrors
1148   ReadRegStr $0 HKCR ".svg" ""
1149   DetailPrint ".svg associated as $0"
1150   IfErrors endUninstSVGEdit  
1151     ReadRegStr $1 HKCR "$0\shell\edit\command" ""
1152         IfErrors 0 +2  
1153       DetailPrint "svg editor is $1"
1154     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1155       DetailPrint "removing default .svg editor"
1156       DeleteRegKey HKCR "$0\shell\edit\command"
1157     DeleteRegKey /ifempty HKCR "$0\shell\edit"
1158     DeleteRegKey /ifempty HKCR "$0\shell"
1159     DeleteRegKey /ifempty HKCR "$0"
1160   endUninstSVGEdit:
1161   
1162   ClearErrors
1163   ReadRegStr $2 HKCR ".svgz" ""
1164   DetailPrint ".svgz associated as $2"
1165   IfErrors endUninstSVGZEdit  
1166     ReadRegStr $3 HKCR "$2\shell\edit\command" ""
1167     IfErrors 0 +2  
1168       DetailPrint "svgz editor is $1"
1169     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1170       DetailPrint "removing default .svgz editor"
1171       DeleteRegKey HKCR "$2\shell\edit\command"
1172     DeleteRegKey /ifempty HKCR "$2\shell\edit"
1173     DeleteRegKey /ifempty HKCR "$2\shell"
1174     DeleteRegKey /ifempty HKCR "$2"
1175   endUninstSVGZEdit:
1176   
1177   ; Remove file associations for svg editor
1178   DetailPrint "removing file associations for svg editor"
1179   ClearErrors
1180   ReadRegStr $0 HKCR ".svg" ""
1181   IfErrors endUninstSVGView
1182     ReadRegStr $1 HKCR "$0\shell\open\command" ""
1183     IfErrors 0 +2  
1184       DetailPrint "svg viewer is $1"
1185     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1186       DetailPrint "removing default .svg viewer"
1187       DeleteRegKey HKCR "$0\shell\open\command"
1188     DeleteRegKey /ifempty HKCR "$0\shell\open"
1189     DeleteRegKey /ifempty HKCR "$0\shell"
1190     DeleteRegKey /ifempty HKCR "$0"
1191   endUninstSVGView:
1192   
1193   ClearErrors
1194   ReadRegStr $2 HKCR ".svgz" ""
1195   IfErrors endUninstSVGZView
1196     ReadRegStr $3 HKCR "$2\shell\open\command" ""
1197     IfErrors 0 +2  
1198       DetailPrint "svgz viewer is $1"
1199     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1200       DetailPrint "removing default .svgz viewer"
1201       DeleteRegKey HKCR "$2\shell\open\command"
1202     DeleteRegKey /ifempty HKCR "$2\shell\open"
1203     DeleteRegKey /ifempty HKCR "$2\shell"
1204     DeleteRegKey /ifempty HKCR "$2"
1205   endUninstSVGZView:
1206   
1207   ; Remove file associations for context menue
1208   DetailPrint "removing file associations for svg editor"
1209   ClearErrors
1210   ReadRegStr $0 HKCR ".svg" ""
1211   IfErrors endUninstSVGContext
1212   DetailPrint "removing default .svg context menue"
1213   DeleteRegKey HKCR "$0\shell\${PRODUCT_NAME}"
1214   DeleteRegKey /ifempty HKCR "$0\shell"
1215   DeleteRegKey /ifempty HKCR "$0"
1216   endUninstSVGContext:
1217   
1218   ClearErrors
1219   ReadRegStr $2 HKCR ".svgz" ""
1220   IfErrors endUninstSVGZContext
1221   DetailPrint "removing default .svgzcontext menue"
1222   DeleteRegKey HKCR "$2\shell\${PRODUCT_NAME}"
1223   DeleteRegKey /ifempty HKCR "$2\shell"
1224   DeleteRegKey /ifempty HKCR "$2"
1225   endUninstSVGZContext:
1227   ReadRegStr $1 HKCR "$0" ""
1228   StrCmp $1 "" 0 +3
1229     DetailPrint "removing filetype .svg $0"
1230     DeleteRegKey HKCR ".svg"
1231   
1232   ReadRegStr $3 HKCR "$2" ""
1233   StrCmp $3 "" 0 +3
1234     DetailPrint "removing filetype .svgz $2"
1235     DeleteRegKey HKCR ".svgz"
1236   
1237     
1238   SetShellVarContext all
1239   DetailPrint "removing product regkey"
1240   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1241   DetailPrint "removing uninstall info"
1242   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1243   DetailPrint "removing shortcuts"
1244   Delete "$DESKTOP\Inkscape.lnk"
1245   Delete "$QUICKLAUNCH\Inkscape.lnk"
1246   Delete "$SMPROGRAMS\Inkscape.lnk"
1247   ;just in case they are still there
1248   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1249   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1250   RMDir  "$SMPROGRAMS\Inkscape"
1252   SetShellVarContext current
1253   DetailPrint "removing product regkey"
1254   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1255   DetailPrint "removing uninstall info"
1256   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1257   DetailPrint "removing shortcuts"
1258   Delete "$DESKTOP\Inkscape.lnk"
1259   Delete "$QUICKLAUNCH\Inkscape.lnk"
1260   Delete "$SMPROGRAMS\Inkscape.lnk"
1261   ;just in case they are still there
1262   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1263   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1264   RMDir  "$SMPROGRAMS\Inkscape"
1266   DetailPrint "removing uninstall info"
1267   RMDir /r "$INSTDIR"
1269   SetAutoClose false
1271 SectionEnd