Code

BUG 1519641 + many more languages
[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_ca) SecCatalan
656   !insertmacro Language ca ca
657 SectionEnd
659 Section $(lng_cs) SecCzech
660   !insertmacro Language cs cs
661 SectionEnd
663 Section $(lng_da) SecDanish
664   !insertmacro Language da da
665 SectionEnd
667 Section $(lng_de) SecGerman
668   !insertmacro Language 'de' 'de'
669 SectionEnd
671 Section $(lng_el) SecGreek
672   !insertmacro Language el el
673 SectionEnd
675 Section $(lng_en) SecEnglish
676   SectionIn 1 2 3 RO
677 SectionEnd
679 Section $(lng_en_CA) SecEnglishCanadian
680   !insertmacro Language en_CA en_CA
681 SectionEnd
683 Section $(lng_en_GB) SecEnglishBritain
684   !insertmacro Language en_GB en_GB
685 SectionEnd
687 Section $(lng_es) SecSpanish
688   !insertmacro Language 'es' 'es'
689 SectionEnd
691 Section $(lng_es_MX) SecSpanishMexico
692   !insertmacro Language 'es_MX' 'es_MX'
693 SectionEnd
695 Section $(lng_et) SecEstonian
696   !insertmacro Language et et
697 SectionEnd
699 Section $(lng_fr) SecFrench
700   !insertmacro Language 'fr' 'fr'
701 SectionEnd
703 Section $(lng_fi) SecFinish
704   !insertmacro Language 'fi' 'fi'
705 SectionEnd
707 Section $(lng_ga) SecIrish
708   !insertmacro Language ga ga
709 SectionEnd
711 Section $(lng_gl) SecGallegan
712   !insertmacro Language gl gl
713   SectionIn 1 2 3
714 SectionEnd
716 Section $(lng_hr) SecCroatian
717   !insertmacro Language hr hr
718   SectionIn 1 2 3
719 SectionEnd
721 Section $(lng_hu) SecHungarian
722   !insertmacro Language hu hu
723   SectionIn 1 2 3
724 SectionEnd
726 Section $(lng_it) SecItalian
727   !insertmacro Language it it
728   SectionIn 1 2 3
729 SectionEnd
731 Section $(lng_ja) SecJapanese
732   !insertmacro Language 'ja' 'jp'
733 SectionEnd
735 Section $(lng_ko) SecKorean
736   !insertmacro Language 'ko' 'ko'
737 SectionEnd
739 Section $(lng_lt) SecLithuanian
740   !insertmacro Language 'lt' 'lt'
741 SectionEnd
743 Section $(lng_mn) SecMongolian
744   !insertmacro Language mn mn
745 SectionEnd
747 Section $(lng_mk) SecMacedonian
748   !insertmacro Language mk mk
749 SectionEnd
751 Section $(lng_nb) SecNorwegianBokmal
752   !insertmacro Language nb nb
753 SectionEnd
755 Section $(lng_ne) SecNepali
756   !insertmacro Language ne ne
757 SectionEnd
759 Section $(lng_nl) SecDutch
760   !insertmacro Language nl nl
761 SectionEnd
763 Section $(lng_nn) SecNorwegianNynorsk
764   !insertmacro Language nn nn
765 SectionEnd
767 Section $(lng_pa) SecPanjabi
768   !insertmacro Language pa pa
769 SectionEnd
771 Section $(lng_pl) SecPolish
772   !insertmacro Language pl pl
773 SectionEnd
775 Section $(lng_pt) SecPortuguese
776   !insertmacro Language pt pt
777 SectionEnd
779 Section $(lng_pt_BR) SecPortugueseBrazil
780   !insertmacro Language pt_BR pt_BR
781 SectionEnd
783 Section $(lng_ru) SecRussian
784   !insertmacro Language ru ru
785 SectionEnd
787 Section $(lng_rw) SecKinyarwanda
788   !insertmacro Language rw rw
789 SectionEnd
791 Section $(lng_sk) SecSlovak
792   !insertmacro Language sk sk
793 SectionEnd
795 Section $(lng_sl) SecSlovenian
796   !insertmacro Language sl sl
797 SectionEnd
799 Section $(lng_sq) SecAlbanian
800   !insertmacro Language sq sq
801 SectionEnd
803 Section $(lng_sr) SecSerbian
804   !insertmacro Language sr sr
805 SectionEnd
807 Section $(lng_sr@Latn) SecSerbianLatin
808   !insertmacro Language 'sr@Latn' 'sr@Latn'
809 SectionEnd
811 Section $(lng_sv) SecSwedish
812   !insertmacro Language sv sv
813 SectionEnd
815 Section $(lng_tr) SecTurkish
816   !insertmacro Language tr tr
817 SectionEnd
819 Section $(lng_uk) SecUkrainian
820   !insertmacro Language uk uk
821 SectionEnd
823 Section $(lng_vi) SecVietnamese
824   !insertmacro Language vi vi
825 SectionEnd
827 Section $(lng_zh_CN) SecChineseSimplified
828   !insertmacro Language zh_CN zh_CN
829 SectionEnd
831 Section $(lng_zh_TW) SecChineseTaiwan
832   !insertmacro Language zh_TW zh_TW
833 SectionEnd
835 SectionGroupEnd
838 Section -FinalizeInstallation
839   StrCmp $MultiUser "1" "" SingleUser
840     DetailPrint "admin mode, registry root will be HKLM"
841     SetShellVarContext all
842     Goto endSingleUser
843   SingleUser:
844     DetailPrint "single user mode, registry root will be HKCU"
845     SetShellVarContext current
846   endSingleUser:                
848   ; check for writing registry
849   ClearErrors
850   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inkscape.exe"  
851   ;IfErrors 0 +4
852   ;  DetailPrint "fatal: failed to write to ${PRODUCT_DIR_REGKEY}"
853   ;  DetailPrint "aborting installation"
854   ;     Abort
855   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "MultiUser" "$MultiUser"  
856   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "askMultiUser" "$askMultiUser"
857   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "User" "$User"
858   IfErrors 0 +2
859     DetailPrint "fatal: failed to write to registry installation info"
861   ; start menu entries
862   ClearErrors
863   CreateShortCut "$SMPROGRAMS\Inkscape.lnk" "$INSTDIR\inkscape.exe"
864   IfErrors 0 +2
865     DetailPrint "fatal: failed to write to start menu info"
867   ; uninstall settings
868   ClearErrors
869   WriteUninstaller "$INSTDIR\uninst.exe"
870   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" '"$INSTDIR\uninst.exe"'
871   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
872   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
873   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0"
874   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
875   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" "1"
876   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" "1"
877   IfErrors 0 +2
878     DetailPrint "fatal: failed to write to registry un-installation info"
879 SectionEnd
880  
881 ; Last the Descriptions
882 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
883   !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(lng_CoreDesc)
884   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} $(lng_GTKFilesDesc)
885   !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(lng_ShortcutsDesc)
886   !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} $(lng_AlluserDesc) 
887   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(lng_DesktopDesc)
888   !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} $(lng_QuicklaunchDesc)
889   !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} $(lng_SVGWriterDesc)
890   !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} $(lng_ContextMenuDesc)
891   !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} $(lng_AddfilesDesc)
892   !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} $(lng_ExamplesDesc)
893   !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} $(lng_TutorialsDesc)
894   !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(lng_LanguagesDesc)
895 !insertmacro MUI_FUNCTION_DESCRIPTION_END
897 !macro Parameter key Section
898   Push ${key}
899   Push ""
900   Call GetParameterValue
901   Pop $1
902   StrCmp $1 "OFF" 0 +5
903     SectionGetFlags ${Section} $0
904     IntOp $2 ${SF_SELECTED} ~
905     IntOp $0 $0 & $2
906     SectionSetFlags ${Section} $0
907   StrCmp $1 "ON" 0 +4
908     SectionGetFlags ${Section} $0
909     IntOp $0 $0 | ${SF_SELECTED}
910     SectionSetFlags ${Section} $0
911 !macroend
913 Function .onInit
914   ;Extract InstallOptions INI files
915   StrCpy $AskMultiUser "1"
916   StrCpy $MultiUser "0"
917   ; this resets AskMultiUser if Win95/98/ME
918   Call GetWindowsVersion
919   Pop $R0
920   DetailPrint "detected operating system $R0"
921   ;MessageBox MB_OK "operating system: $R0; AskMultiuser: $AskMultiUser"
922   
923   ; hide all user section if win98
924   StrCmp $AskMultiUser "1" +2
925     SectionSetText ${SecAlluser} ""
927   ; hide if quick launch if not available
928   StrCmp $QUICKLAUNCH $TEMP 0 +2
929     SectionSetText ${SecQuicklaunch} ""
931   ;check if user is admin
932   ClearErrors
933         UserInfo::GetName
934         IfErrors info_Win9x
935         Pop $0
936         StrCpy $User $0
937         UserInfo::GetAccountType
938         Pop $1
939         StrCmp $1 "Admin" info_done
941         MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_NO_ADMIN)"
943         Goto info_done
945         info_Win9x:
946                 # This one means you don't need to care about admin or
947                 # not admin because Windows 9x doesn't either
948                 MessageBox MB_OK|MB_ICONEXCLAMATION $(lng_NOT_SUPPORTED)
950         info_done:
952   ;check for previous installation
953   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
954   StrCmp $0 "" +1 +2
955   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
956   ;check user if applicable
957   StrCmp $0 "" +3
958     StrCmp $0 $User +2
959           MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)"
960         
961   ; proccess command line parameter
962   !insertmacro Parameter "GTK" ${SecGTK}
963   !insertmacro Parameter "SHORTCUTS" ${secShortcuts}
964   !insertmacro Parameter "ALLUSER" ${SecAlluser}
965   !insertmacro Parameter "DESKTOP" ${SecDesktop}
966   !insertmacro Parameter "QUICKLAUNCH" ${SecQUICKlaunch}
967   !insertmacro Parameter "SVGEDITOR" ${SecSVGWriter}
968   !insertmacro Parameter "CONTEXTMENUE" ${SecContextMenu}
969   !insertmacro Parameter "ADDFILES" ${SecAddfiles}
970   !insertmacro Parameter "EXAMPLES" ${SecExamples}
971   !insertmacro Parameter "TUTORIALS" ${SecTutorials}
972   !insertmacro Parameter "LANGUAGES" ${SecLanguages}
973   !insertmacro Parameter "am" ${SecAmharic}
974   !insertmacro Parameter "az" ${SecAzerbaijani}
975   !insertmacro Parameter "be" ${SecByelorussian}
976   !insertmacro Parameter "ca" ${SecCatalan}
977   !insertmacro Parameter "cs" ${SecCzech}
978   !insertmacro Parameter "da" ${SecDanish}
979   !insertmacro Parameter "de" ${SecGerman}
980   !insertmacro Parameter "el" ${SecGreek}
981   !insertmacro Parameter "es" ${SecSpanish}
982   !insertmacro Parameter "es_MX" ${SecSpanishMexico}
983   !insertmacro Parameter "et" ${SecEstonian}
984   !insertmacro Parameter "fr" ${SecFrench}
985   !insertmacro Parameter "ga" ${SecIrish}
986   !insertmacro Parameter "gl" ${SecGallegan}
987   !insertmacro Parameter "hu" ${SecHungarian}
988   !insertmacro Parameter "it" ${SecItalian}
989   !insertmacro Parameter "ja" ${SecJapanese}
990   !insertmacro Parameter "ko" ${SecKorean}
991   !insertmacro Parameter "mk" ${SecMacedonian}
992   !insertmacro Parameter "nb" ${SecNorwegianBokmal}
993   !insertmacro Parameter "nl" ${SecDutch}
994   !insertmacro Parameter "nn" ${SecNorwegianNynorsk}
995   !insertmacro Parameter "pa" ${SecPanjabi}
996   !insertmacro Parameter "pl" ${SecPolish}
997   !insertmacro Parameter "pt" ${SecPortuguese}
998   !insertmacro Parameter "pt_BR" ${SecPortugueseBrazil}
999   !insertmacro Parameter "ru" ${SecRussian}
1000   !insertmacro Parameter "sk" ${SecSlovak}
1001   !insertmacro Parameter "sl" ${SecSlovenian}
1002   !insertmacro Parameter "sr" ${SecSerbian}
1003   !insertmacro Parameter "sr@Latn" ${SecSerbianLatin}
1004   !insertmacro Parameter "sv" ${SecSwedish}
1005   !insertmacro Parameter "tr" ${SecTurkish}
1006   !insertmacro Parameter "uk" ${SecUkrainian}
1007   !insertmacro Parameter "zh_CN" ${SecChineseSimplified}
1008   !insertmacro Parameter "zh_TW" ${SecChineseTaiwan}
1009   
1010   Push "?"
1011   Push "TEST"
1012   Call GetParameterValue
1013   Pop $1
1014   StrCmp $1 "TEST" +3
1015     MessageBox MB_OK "possible parameters for installer:$\r$\n \
1016       /?: this help screen$\r$\n \
1017       /S: silent$\r$\n \
1018       /D=(directory): where to install inkscape$\r$\n \
1019       /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
1020       /SHORTCUTS=(OFF/ON): shortcuts to start inkscape$\r$\n \
1021       /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
1022       /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
1023       /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
1024       /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
1025       /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
1026       /ADDFILES=(OFF/ON): additional files$\r$\n \
1027       /EXAMPLES=(OFF/ON): examples$\r$\n \
1028       /TUTORIALS=(OFF/ON): tutorials$\r$\n \
1029       /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
1030       /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
1031     Abort
1032 FunctionEnd
1034 Function .onSelChange
1035 FunctionEnd
1037 ; --------------------------------------------------
1039 Function un.CustomPageUninstall
1040   !insertmacro MUI_HEADER_TEXT "$(lng_UInstOpt)" "$(lng_UInstOpt1)"
1041   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 1" "Text" "$APPDATA\Inkscape\preferences.xml"
1042   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 2" "Text" "$(lng_PurgePrefs)"
1044   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall"
1045   !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State"
1046   DetailPrint "keepfiles = $MultiUser" 
1047           ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1049 FunctionEnd
1052 Function un.onInit
1054   ClearErrors
1055   StrCpy $User ""
1056         UserInfo::GetName
1057         IfErrors +3
1058         Pop $0
1059         StrCpy $User $0
1061   StrCpy $askMultiUser "1"
1062   StrCpy $MultiUser "1"
1063  
1064   ; Test if this was a multiuser installation
1065   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" ""
1066   StrCmp $0  "$INSTDIR\inkscape.exe" 0 +5  
1067     ReadRegStr $MultiUser HKLM "${PRODUCT_DIR_REGKEY}" "MultiUser"
1068     ReadRegStr $askMultiUser HKLM "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1069         ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
1070         Goto +4
1071   ReadRegStr $MultiUser HKCU "${PRODUCT_DIR_REGKEY}" "MultiUser"
1072   ReadRegStr $askMultiUser HKCU "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1073   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
1074   ;check user if applicable
1075   StrCmp $0 "" +3
1076     StrCmp $0 $User +2
1077           MessageBox MB_OK|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)"
1078     
1079  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "inkscape.nsi.uninstall"
1081  ;check whether Multi user installation ?
1082  SetShellVarContext all
1083  StrCmp $MultiUser "0" 0 +2 
1084  SetShellVarContext current
1085  ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1086    
1087 FunctionEnd
1089 Section Uninstall
1091   ; remove personal settings
1092   Delete "$APPDATA\Inkscape\extension-errors.log"
1093   StrCmp $MultiUser "0" 0 endPurge  ; multiuser assigned in dialog
1094     DetailPrint "purge personal settings in $APPDATA\Inkscape"
1095     RMDir /r "$APPDATA\Inkscape"
1096   endPurge:
1098   ; Remove file associations for svg editor
1099   DetailPrint "removing file associations for svg editor"
1100   ClearErrors
1101   ReadRegStr $0 HKCR ".svg" ""
1102   DetailPrint ".svg associated as $0"
1103   IfErrors endUninstSVGEdit  
1104     ReadRegStr $1 HKCR "$0\shell\edit\command" ""
1105         IfErrors 0 +2  
1106       DetailPrint "svg editor is $1"
1107     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1108       DetailPrint "removing default .svg editor"
1109       DeleteRegKey HKCR "$0\shell\edit\command"
1110     DeleteRegKey /ifempty HKCR "$0\shell\edit"
1111     DeleteRegKey /ifempty HKCR "$0\shell"
1112     DeleteRegKey /ifempty HKCR "$0"
1113   endUninstSVGEdit:
1114   
1115   ClearErrors
1116   ReadRegStr $2 HKCR ".svgz" ""
1117   DetailPrint ".svgz associated as $2"
1118   IfErrors endUninstSVGZEdit  
1119     ReadRegStr $3 HKCR "$2\shell\edit\command" ""
1120     IfErrors 0 +2  
1121       DetailPrint "svgz editor is $1"
1122     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1123       DetailPrint "removing default .svgz editor"
1124       DeleteRegKey HKCR "$2\shell\edit\command"
1125     DeleteRegKey /ifempty HKCR "$2\shell\edit"
1126     DeleteRegKey /ifempty HKCR "$2\shell"
1127     DeleteRegKey /ifempty HKCR "$2"
1128   endUninstSVGZEdit:
1129   
1130   ; Remove file associations for svg editor
1131   DetailPrint "removing file associations for svg editor"
1132   ClearErrors
1133   ReadRegStr $0 HKCR ".svg" ""
1134   IfErrors endUninstSVGView
1135     ReadRegStr $1 HKCR "$0\shell\open\command" ""
1136     IfErrors 0 +2  
1137       DetailPrint "svg viewer is $1"
1138     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1139       DetailPrint "removing default .svg viewer"
1140       DeleteRegKey HKCR "$0\shell\open\command"
1141     DeleteRegKey /ifempty HKCR "$0\shell\open"
1142     DeleteRegKey /ifempty HKCR "$0\shell"
1143     DeleteRegKey /ifempty HKCR "$0"
1144   endUninstSVGView:
1145   
1146   ClearErrors
1147   ReadRegStr $2 HKCR ".svgz" ""
1148   IfErrors endUninstSVGZView
1149     ReadRegStr $3 HKCR "$2\shell\open\command" ""
1150     IfErrors 0 +2  
1151       DetailPrint "svgz viewer is $1"
1152     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1153       DetailPrint "removing default .svgz viewer"
1154       DeleteRegKey HKCR "$2\shell\open\command"
1155     DeleteRegKey /ifempty HKCR "$2\shell\open"
1156     DeleteRegKey /ifempty HKCR "$2\shell"
1157     DeleteRegKey /ifempty HKCR "$2"
1158   endUninstSVGZView:
1159   
1160   ; Remove file associations for context menue
1161   DetailPrint "removing file associations for svg editor"
1162   ClearErrors
1163   ReadRegStr $0 HKCR ".svg" ""
1164   IfErrors endUninstSVGContext
1165   DetailPrint "removing default .svg context menue"
1166   DeleteRegKey HKCR "$0\shell\${PRODUCT_NAME}"
1167   DeleteRegKey /ifempty HKCR "$0\shell"
1168   DeleteRegKey /ifempty HKCR "$0"
1169   endUninstSVGContext:
1170   
1171   ClearErrors
1172   ReadRegStr $2 HKCR ".svgz" ""
1173   IfErrors endUninstSVGZContext
1174   DetailPrint "removing default .svgzcontext menue"
1175   DeleteRegKey HKCR "$2\shell\${PRODUCT_NAME}"
1176   DeleteRegKey /ifempty HKCR "$2\shell"
1177   DeleteRegKey /ifempty HKCR "$2"
1178   endUninstSVGZContext:
1180   ReadRegStr $1 HKCR "$0" ""
1181   StrCmp $1 "" 0 +3
1182     DetailPrint "removing filetype .svg $0"
1183     DeleteRegKey HKCR ".svg"
1184   
1185   ReadRegStr $3 HKCR "$2" ""
1186   StrCmp $3 "" 0 +3
1187     DetailPrint "removing filetype .svgz $2"
1188     DeleteRegKey HKCR ".svgz"
1189   
1190     
1191   SetShellVarContext all
1192   DetailPrint "removing product regkey"
1193   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1194   DetailPrint "removing uninstall info"
1195   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1196   DetailPrint "removing shortcuts"
1197   Delete "$DESKTOP\Inkscape.lnk"
1198   Delete "$QUICKLAUNCH\Inkscape.lnk"
1199   Delete "$SMPROGRAMS\Inkscape.lnk"
1200   ;just in case they are still there
1201   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1202   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1203   RMDir  "$SMPROGRAMS\Inkscape"
1205   SetShellVarContext current
1206   DetailPrint "removing product regkey"
1207   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1208   DetailPrint "removing uninstall info"
1209   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1210   DetailPrint "removing shortcuts"
1211   Delete "$DESKTOP\Inkscape.lnk"
1212   Delete "$QUICKLAUNCH\Inkscape.lnk"
1213   Delete "$SMPROGRAMS\Inkscape.lnk"
1214   ;just in case they are still there
1215   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1216   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1217   RMDir  "$SMPROGRAMS\Inkscape"
1219   DetailPrint "removing uninstall info"
1220   RMDir /r "$INSTDIR"
1222   SetAutoClose false
1224 SectionEnd