Code

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