Code

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