Code

remove references to about.bg.svg
[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 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
425 ;;;;;;;;;;;;;;;;;;;;;;;;;;
426 ; Delete prefs
427 ; code taken from the vlc project
428 ;;;;;;;;;;;;;;;;;;;;;;;;;;
429 !macro delprefs
430   StrCpy $0 0
431         DetailPrint "Delete personal preferences ..."
432         DetailPrint "try to find all users ..."
433         delprefs-Loop:
434  ; FIXME
435   ; this will loop through all the logged users and "virtual" windows users
436   ; (it looks like users are only present in HKEY_USERS when they are logged in)
437     ClearErrors
438     EnumRegKey $1 HKU "" $0
439     StrCmp $1 "" delprefs-End
440     IntOp $0 $0 + 1
441     ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
442     StrCmp $2 "" delprefs-Loop
443         DetailPrint "$2\Inkscape will be removed"
444     RMDir /r "$2\Inkscape"
445     Goto delprefs-Loop
446   delprefs-End:
447 !macroend
450 ;--------------------------------
451 ; Installer Sections
452 ; @todo better idea is to call the original uninstaller first
453 Section -removeInkscape
454   ; check for an old installation and clean that dlls and stuff
455   ClearErrors
456   IfFileExists $INSTDIR\etc 0 doDeleteLib
457     DetailPrint "$INSTDIR\etc exists, will be removed"
458     RmDir /r $INSTDIR\etc
459         IfErrors 0 +4
460       DetailPrint "fatal: failed to delete $INSTDIR\etc"
461       DetailPrint "aborting installation"
462           Abort
463   doDeleteLib:
465   ClearErrors
466   IfFileExists $INSTDIR\lib 0 doDeleteLocale
467     DetailPrint "$INSTDIR\lib exists, will be removed"  
468     RmDir /r $INSTDIR\lib
469         IfErrors 0 +4
470       DetailPrint "fatal: failed to delete $INSTDIR\lib"
471       DetailPrint "aborting installation"
472           Abort
473   doDeleteLocale:
475   ClearErrors
476   IfFileExists $INSTDIR\locale 0 doDeleteDll
477     DetailPrint "$INSTDIR\locale exists, will be removed"
478     RmDir /r $INSTDIR\locale
479         IfErrors 0 +4
480       DetailPrint "fatal: failed to delete $INSTDIR\locale"
481       DetailPrint "aborting installation"
482           Abort
483   doDeleteDll:
485   ClearErrors
486   FindFirst $0 $1 $INSTDIR\*.dll
487     FindNextLoop:
488     StrCmp $1 "" FindNextDone
489     DetailPrint "$INSTDIR\$1 exists, will be removed"
490     Delete $INSTDIR\$1
491     IfErrors 0 +4
492       DetailPrint "fatal: failed to delete $INSTDIR\$1"
493       DetailPrint "aborting installation"
494       Abort
495     FindNext $0 $1
496     Goto FindNextLoop
497   FindNextDone:
498   
499   ;remove the old inkscape shortcuts from the startmenu
500   ;just in case they are still there
501   SetShellVarContext current
502   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
503   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
504   RMDir  "$SMPROGRAMS\Inkscape"
505   Delete "$SMPROGRAMS\Inkscape.lnk"
506   SetShellVarContext all
507   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
508   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
509   RMDir  "$SMPROGRAMS\Inkscape"
510   Delete "$SMPROGRAMS\Inkscape.lnk"
511   
512 SectionEnd
514 Section $(lng_Core) SecCore
516   DetailPrint "Installing Inkscape Core Files ..."
518   SectionIn 1 2 3 RO
519   SetOutPath $INSTDIR
520   SetOverwrite on
521   SetAutoClose false
523   File /a "..\..\inkscape\ink*.exe"
524   File /a "..\..\inkscape\AUTHORS"
525   File /a "..\..\inkscape\COPYING"
526   File /a "..\..\inkscape\COPYING.LIB"
527   File /a "..\..\inkscape\NEWS"
528   File /nonfatal /a "..\..\inkscape\HACKING.txt"
529   File /a "..\..\inkscape\README"
530   File /nonfatal /a "..\..\inkscape\README.txt"
531   File /a "..\..\inkscape\TRANSLATORS"
532   File /nonfatal /a /r "..\..\inkscape\data"
533   File /nonfatal /a /r "..\..\inkscape\doc"
534   File /nonfatal /a /r "..\..\inkscape\plugins"
535   File /nonfatal /a /r /x *.??*.???* /x "examples" /x "tutorials" "..\..\inkscape\share"
536   ; this files are added because it slips through the filter
537   SetOutPath $INSTDIR\share\clipart
538   File /a "..\..\inkscape\share\clipart\inkscape.logo.svg"
539   ;File /a "..\..\inkscape\share\clipart\inkscape.logo.classic.svg"  
540   SetOutPath $INSTDIR\share\extensions
541   File /a "..\..\inkscape\share\extensions\pdf_output.inx.txt"
542   File /a "..\..\inkscape\share\extensions\pdf_output_via_gs_on_win32.inx.txt"
543   SetOutPath $INSTDIR\share\icons
544   File /a "..\..\inkscape\share\icons\inkscape.file.png"
545   File /a "..\..\inkscape\share\icons\inkscape.file.svg"
546   SetOutPath $INSTDIR\modules
547   File /nonfatal /a /r "..\..\inkscape\modules\*.*"
548   SetOutPath $INSTDIR\python
549   File /nonfatal /a /r "..\..\inkscape\python\*.*"
551   
552 SectionEnd
554 Section $(lng_GTKFiles) SecGTK
556   DetailPrint "Installing GTK Files ..."
557   
558   SectionIn 1 2 3 RO
559   SetOutPath $INSTDIR
560   SetOverwrite on
561   File /a /r "..\..\inkscape\*.dll"
562   File /a /r /x "locale" "..\..\inkscape\lib"
563   File /a /r "..\..\inkscape\etc"
564 SectionEnd
566 Section $(lng_Alluser) SecAlluser
567   ; disable this option in Win95/Win98/WinME
568   SectionIn 1 2 3 
569   StrCpy $MultiUser "1"
570   StrCmp $MultiUser "1" "" SingleUser
571     DetailPrint "admin mode, registry root will be HKLM"
572     SetShellVarContext all
573     Goto endSingleUser
574   SingleUser:
575     DetailPrint "single user mode, registry root will be HKCU"
576     SetShellVarContext current
577   endSingleUser:                
578 SectionEnd
580 SectionGroup $(lng_Shortcuts) SecShortcuts
582 Section /o $(lng_Desktop) SecDesktop
583   ClearErrors
584   CreateShortCut "$DESKTOP\Inkscape.lnk" "$INSTDIR\inkscape.exe"
585   IfErrors 0 +2
586     DetailPrint "Uups! Problems creating desktop shortcuts"
587 SectionEnd
589 Section /o $(lng_Quicklaunch) SecQuicklaunch
590   ClearErrors
591   StrCmp $QUICKLAUNCH $TEMP +2
592     CreateShortCut "$QUICKLAUNCH\Inkscape.lnk" "$INSTDIR\inkscape.exe"
593   IfErrors 0 +2
594     DetailPrint "Uups! Problems creating quicklaunch shortcuts"
595 SectionEnd
597 Section $(lng_SVGWriter) SecSVGWriter 
598   SectionIn 1 2 3
599   ; create file associations, test before if needed
600   DetailPrint "creating file associations"
601   ClearErrors
602   ReadRegStr $0 HKCR ".svg" ""
603   StrCmp $0 "" 0 +3
604     WriteRegStr HKCR ".svg" "" "svgfile"
605     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
606   ReadRegStr $0 HKCR ".svgz" ""
607   StrCmp $0 "" 0 +3
608     WriteRegStr HKCR ".svgz" "" "svgfile"
609     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
610   IfErrors 0 +2
611     DetailPrint "Uups! Problems creating file assoziations for svg writer"
612   
613   DetailPrint "creating default editor"
614   ClearErrors
615   ReadRegStr $0 HKCR ".svg" ""
616   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
617   ReadRegStr $0 HKCR ".svgz" ""
618   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
619   IfErrors 0 +2
620     DetailPrint "Uups! Problems creating default editor"
621 SectionEnd
623 Section $(lng_ContextMenu) SecContextMenu
624   SectionIn 1 2 3
625   ; create file associations, test before if needed
626   DetailPrint "creating file associations"
627   ClearErrors
628   ReadRegStr $0 HKCR ".svg" ""
629   StrCmp $0 "" 0 +3
630     WriteRegStr HKCR ".svg" "" "svgfile"
631     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
632   ReadRegStr $0 HKCR ".svgz" ""
633   StrCmp $0 "" 0 +3
634     WriteRegStr HKCR ".svgz" "" "svgfile"
635     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
636   IfErrors 0 +2
637     DetailPrint "Uups! Problems creating file assoziations for context menu"
638   
639   DetailPrint "creating context menue"
640   ClearErrors
641   ReadRegStr $0 HKCR ".svg" ""
642   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
643   ReadRegStr $0 HKCR ".svgz" ""
644   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
645   IfErrors 0 +2
646     DetailPrint "Uups! Problems creating context menue integration"
648 SectionEnd
650 SectionGroupEnd
652 Section /o $(lng_DeletePrefs) SecPrefs
653         !insertmacro delprefs
654 SectionEnd
656 SectionGroup $(lng_Addfiles) SecAddfiles
658 Section $(lng_Examples) SecExamples
659   SectionIn 1 2
660   SetOutPath $INSTDIR\share
661   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\examples"
662 SectionEnd
664 Section $(lng_Tutorials) SecTutorials
665   SectionIn 1 2
666   SetOutPath $INSTDIR\share
667   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\tutorials"
668 SectionEnd
670 SectionGroupEnd
672 SectionGroup /e $(lng_Languages) SecLanguages
674 Section $(lng_am) SecAmharic
675   !insertmacro Language am am
676 SectionEnd
678 Section $(lng_az) SecAzerbaijani
679   !insertmacro Language az az
680 SectionEnd
682 Section $(lng_be) SecByelorussian
683   !insertmacro Language be be
684 SectionEnd
686 Section $(lng_bg) SecBulgarian
687   !insertmacro Language bg bg
688 SectionEnd
690 Section $(lng_ca) SecCatalan
691   !insertmacro Language ca ca
692 SectionEnd
694 Section $(lng_cs) SecCzech
695   !insertmacro Language cs cs
696 SectionEnd
698 Section $(lng_da) SecDanish
699   !insertmacro Language da da
700 SectionEnd
702 Section $(lng_de) SecGerman
703   !insertmacro Language 'de' 'de'
704 SectionEnd
706 Section $(lng_dz) SecDzongkha
707   !insertmacro Language dz dz
708 SectionEnd
710 Section $(lng_el) SecGreek
711   !insertmacro Language el el
712 SectionEnd
714 Section $(lng_en) SecEnglish
715   SectionIn 1 2 3 RO
716 SectionEnd
718 Section $(lng_en_CA) SecEnglishCanadian
719   !insertmacro Language en_CA en_CA
720 SectionEnd
722 Section $(lng_en_GB) SecEnglishBritain
723   !insertmacro Language en_GB en_GB
724 SectionEnd
726 Section $(lng_en_US@piglatin) SecEnglishPiglatin
727   !insertmacro Language en_US@piglatin en_US@Piglatin
728 SectionEnd
730 Section $(lng_es) SecSpanish
731   !insertmacro Language 'es' 'es'
732 SectionEnd
734 Section $(lng_es_MX) SecSpanishMexico
735   !insertmacro Language 'es_MX' 'es_MX'
736 SectionEnd
738 Section $(lng_et) SecEstonian
739   !insertmacro Language et et
740 SectionEnd
742 Section $(lng_eu) SecBasque
743   !insertmacro Language eu eu
744 SectionEnd
746 Section $(lng_fr) SecFrench
747   !insertmacro Language 'fr' 'fr'
748 SectionEnd
750 Section $(lng_fi) SecFinish
751   !insertmacro Language 'fi' 'fi'
752 SectionEnd
754 Section $(lng_ga) SecIrish
755   !insertmacro Language ga ga
756 SectionEnd
758 Section $(lng_gl) SecGallegan
759   !insertmacro Language gl gl
760   SectionIn 1 2 3
761 SectionEnd
763 Section $(lng_hr) SecCroatian
764   !insertmacro Language hr hr
765   SectionIn 1 2 3
766 SectionEnd
768 Section $(lng_hu) SecHungarian
769   !insertmacro Language hu hu
770   SectionIn 1 2 3
771 SectionEnd
773 Section $(lng_it) SecItalian
774   !insertmacro Language it it
775   SectionIn 1 2 3
776 SectionEnd
778 Section $(lng_ja) SecJapanese
779   !insertmacro Language 'ja' 'jp'
780 SectionEnd
782 Section $(lng_km) SecKhmer
783   !insertmacro Language km km
784 SectionEnd
786 Section $(lng_ko) SecKorean
787   !insertmacro Language 'ko' 'ko'
788 SectionEnd
790 Section $(lng_lt) SecLithuanian
791   !insertmacro Language 'lt' 'lt'
792 SectionEnd
794 Section $(lng_mn) SecMongolian
795   !insertmacro Language mn mn
796 SectionEnd
798 Section $(lng_mk) SecMacedonian
799   !insertmacro Language mk mk
800 SectionEnd
802 Section $(lng_nb) SecNorwegianBokmal
803   !insertmacro Language nb nb
804 SectionEnd
806 Section $(lng_ne) SecNepali
807   !insertmacro Language ne ne
808 SectionEnd
810 Section $(lng_nl) SecDutch
811   !insertmacro Language nl nl
812 SectionEnd
814 Section $(lng_nn) SecNorwegianNynorsk
815   !insertmacro Language nn nn
816 SectionEnd
818 Section $(lng_pa) SecPanjabi
819   !insertmacro Language pa pa
820 SectionEnd
822 Section $(lng_pl) SecPolish
823   !insertmacro Language pl pl
824 SectionEnd
826 Section $(lng_pt) SecPortuguese
827   !insertmacro Language pt pt
828 SectionEnd
830 Section $(lng_pt_BR) SecPortugueseBrazil
831   !insertmacro Language pt_BR pt_BR
832 SectionEnd
834 Section $(lng_ru) SecRussian
835   !insertmacro Language ru ru
836 SectionEnd
838 Section $(lng_rw) SecKinyarwanda
839   !insertmacro Language rw rw
840 SectionEnd
842 Section $(lng_sk) SecSlovak
843   !insertmacro Language sk sk
844 SectionEnd
846 Section $(lng_sl) SecSlovenian
847   !insertmacro Language sl sl
848 SectionEnd
850 Section $(lng_sq) SecAlbanian
851   !insertmacro Language sq sq
852 SectionEnd
854 Section $(lng_sr) SecSerbian
855   !insertmacro Language sr sr
856 SectionEnd
858 Section $(lng_sr@Latn) SecSerbianLatin
859   !insertmacro Language 'sr@Latn' 'sr@Latn'
860 SectionEnd
862 Section $(lng_sv) SecSwedish
863   !insertmacro Language sv sv
864 SectionEnd
866 Section $(lng_th) SecThai
867   !insertmacro Language th th
868 SectionEnd
870 Section $(lng_tr) SecTurkish
871   !insertmacro Language tr tr
872 SectionEnd
874 Section $(lng_uk) SecUkrainian
875   !insertmacro Language uk uk
876 SectionEnd
878 Section $(lng_vi) SecVietnamese
879   !insertmacro Language vi vi
880 SectionEnd
882 Section $(lng_zh_CN) SecChineseSimplified
883   !insertmacro Language zh_CN zh_CN
884 SectionEnd
886 Section $(lng_zh_TW) SecChineseTaiwan
887   !insertmacro Language zh_TW zh_TW
888 SectionEnd
890 SectionGroupEnd
893 Section -FinalizeInstallation
894   StrCmp $MultiUser "1" "" SingleUser
895     DetailPrint "admin mode, registry root will be HKLM"
896     SetShellVarContext all
897     Goto endSingleUser
898   SingleUser:
899     DetailPrint "single user mode, registry root will be HKCU"
900     SetShellVarContext current
901   endSingleUser:                
903   ; check for writing registry
904   ClearErrors
905   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inkscape.exe"  
906   ;IfErrors 0 +4
907   ;  DetailPrint "fatal: failed to write to ${PRODUCT_DIR_REGKEY}"
908   ;  DetailPrint "aborting installation"
909   ;     Abort
910   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "MultiUser" "$MultiUser"  
911   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "askMultiUser" "$askMultiUser"
912   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "User" "$User"
913   IfErrors 0 +2
914     DetailPrint "fatal: failed to write to registry installation info"
916   ; start menu entries
917   ClearErrors
918   CreateShortCut "$SMPROGRAMS\Inkscape.lnk" "$INSTDIR\inkscape.exe"
919   IfErrors 0 +2
920     DetailPrint "fatal: failed to write to start menu info"
922   ; uninstall settings
923   ClearErrors
924   WriteUninstaller "$INSTDIR\uninst.exe"
925   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" '"$INSTDIR\uninst.exe"'
926   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
927   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
928   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0"
929   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
930   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" "1"
931   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" "1"
932   IfErrors 0 +2
933     DetailPrint "fatal: failed to write to registry un-installation info"
934 SectionEnd
935  
936 ; Last the Descriptions
937 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
938   !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(lng_CoreDesc)
939   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} $(lng_GTKFilesDesc)
940   !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(lng_ShortcutsDesc)
941   !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} $(lng_AlluserDesc) 
942   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(lng_DesktopDesc)
943   !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} $(lng_QuicklaunchDesc)
944   !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} $(lng_SVGWriterDesc)
945   !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} $(lng_ContextMenuDesc)
946   !insertmacro MUI_DESCRIPTION_TEXT ${SecPrefs} $(lng_DeletePrefsDesc)
947   !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} $(lng_AddfilesDesc)
948   !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} $(lng_ExamplesDesc)
949   !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} $(lng_TutorialsDesc)
950   !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(lng_LanguagesDesc)
951 !insertmacro MUI_FUNCTION_DESCRIPTION_END
953 !macro Parameter key Section
954   Push ${key}
955   Push ""
956   Call GetParameterValue
957   Pop $1
958   StrCmp $1 "OFF" 0 +5
959     SectionGetFlags ${Section} $0
960     IntOp $2 ${SF_SELECTED} ~
961     IntOp $0 $0 & $2
962     SectionSetFlags ${Section} $0
963   StrCmp $1 "ON" 0 +4
964     SectionGetFlags ${Section} $0
965     IntOp $0 $0 | ${SF_SELECTED}
966     SectionSetFlags ${Section} $0
967 !macroend
969 Function .onInit
970   ;Extract InstallOptions INI files
971   StrCpy $AskMultiUser "1"
972   StrCpy $MultiUser "0"
973   ; this resets AskMultiUser if Win95/98/ME
974   Call GetWindowsVersion
975   Pop $R0
976   DetailPrint "detected operating system $R0"
977   ;MessageBox MB_OK "operating system: $R0; AskMultiuser: $AskMultiUser"
978   
979   ; hide all user section if win98
980   StrCmp $AskMultiUser "1" +2
981     SectionSetText ${SecAlluser} ""
983   ; hide if quick launch if not available
984   StrCmp $QUICKLAUNCH $TEMP 0 +2
985     SectionSetText ${SecQuicklaunch} ""
987   ;check if user is admin
988   ClearErrors
989         UserInfo::GetName
990         IfErrors info_Win9x
991         Pop $0
992         StrCpy $User $0
993         UserInfo::GetAccountType
994         Pop $1
995         StrCmp $1 "Admin" info_done
997         MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NO_ADMIN)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK info_done IDCANCEL +1
998                 Quit
999                 
1000         Goto info_done
1002         info_Win9x:
1003                 # This one means you don't need to care about admin or
1004                 # not admin because Windows 9x doesn't either
1005                 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NOT_SUPPORTED)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK info_done IDCANCEL +1
1006                         Quit
1007                         
1008         info_done:
1010   ;check for previous installation
1011   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
1012   StrCmp $0 "" +1 +2
1013   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
1014   ;check user if applicable
1015   StrCmp $0 "" diff_user_install_done
1016     StrCmp $0 $User diff_user_install_done
1017           MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK diff_user_install_done IDCANCEL +1
1018                 Quit
1019    diff_user_install_done:
1020           
1021   ; call uninstall first
1022   ; code taken from the vlc project
1023     ReadRegStr $R0  HKLM ${PRODUCT_UNINST_KEY} "UninstallString"
1024         ReadRegStr $R1  HKLM ${PRODUCT_UNINST_KEY} "DisplayName"
1025         StrCmp $R0 "" +1 +3
1026     ReadRegStr $R0  HKCU ${PRODUCT_UNINST_KEY} "UninstallString"
1027         ReadRegStr $R1  HKCU ${PRODUCT_UNINST_KEY} "DisplayName"
1028         StrCmp $R0 "" uninstall_before_done
1029          
1030           MessageBox MB_YESNO|MB_ICONEXCLAMATION $(lng_WANT_UNINSTALL_BEFORE) /SD IDNO IDYES +1 IDNO uninstall_before_done 
1031           ;Run the uninstaller
1032           ;uninst:
1033             ClearErrors
1034             ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
1035           uninstall_before_done:
1036           
1037   ; proccess command line parameter
1038   !insertmacro Parameter "GTK" ${SecGTK}
1039   !insertmacro Parameter "SHORTCUTS" ${secShortcuts}
1040   !insertmacro Parameter "ALLUSER" ${SecAlluser}
1041   !insertmacro Parameter "DESKTOP" ${SecDesktop}
1042   !insertmacro Parameter "QUICKLAUNCH" ${SecQUICKlaunch}
1043   !insertmacro Parameter "SVGEDITOR" ${SecSVGWriter}
1044   !insertmacro Parameter "CONTEXTMENUE" ${SecContextMenu}
1045   !insertmacro Parameter "PREFERENCES" ${SecPrefs}
1046   !insertmacro Parameter "ADDFILES" ${SecAddfiles}
1047   !insertmacro Parameter "EXAMPLES" ${SecExamples}
1048   !insertmacro Parameter "TUTORIALS" ${SecTutorials}
1049   !insertmacro Parameter "LANGUAGES" ${SecLanguages}
1050   !insertmacro Parameter "am" ${SecAmharic}
1051   !insertmacro Parameter "az" ${SecAzerbaijani}
1052   !insertmacro Parameter "be" ${SecByelorussian}
1053   !insertmacro Parameter "bg" ${SecBulgarian}
1054   !insertmacro Parameter "ca" ${SecCatalan}
1055   !insertmacro Parameter "cs" ${SecCzech}
1056   !insertmacro Parameter "da" ${SecDanish}
1057   !insertmacro Parameter "de" ${SecGerman}
1058   !insertmacro Parameter "dz" ${SecDzongkha}
1059   !insertmacro Parameter "el" ${SecGreek}
1060   !insertmacro Parameter "en_CA" ${SecEnglishCanadian}
1061   !insertmacro Parameter "en_GB" ${SecEnglishBritain}
1062   !insertmacro Parameter "en_US@piglatin" ${SecEnglishPiglatin}
1063   !insertmacro Parameter "es" ${SecSpanish}
1064   !insertmacro Parameter "es_MX" ${SecSpanishMexico}
1065   !insertmacro Parameter "et" ${SecEstonian}
1066   !insertmacro Parameter "eu" ${SecBasque}
1067   !insertmacro Parameter "fi" ${SecFinish}
1068   !insertmacro Parameter "fr" ${SecFrench}
1069   !insertmacro Parameter "ga" ${SecIrish}
1070   !insertmacro Parameter "gl" ${SecGallegan}
1071   !insertmacro Parameter "hr" ${SecCroatian}
1072   !insertmacro Parameter "hu" ${SecHungarian}
1073   !insertmacro Parameter "it" ${SecItalian}
1074   !insertmacro Parameter "ja" ${SecJapanese}
1075   !insertmacro Parameter "km" ${SecKhmer}
1076   !insertmacro Parameter "ko" ${SecKorean}
1077   !insertmacro Parameter "lt" ${SecLithuanian}
1078   !insertmacro Parameter "mk" ${SecMacedonian}
1079   !insertmacro Parameter "mn" ${SecMongolian}
1080   !insertmacro Parameter "nb" ${SecNorwegianBokmal}
1081   !insertmacro Parameter "ne" ${SecNepali}
1082   !insertmacro Parameter "nl" ${SecDutch}
1083   !insertmacro Parameter "nn" ${SecNorwegianNynorsk}
1084   !insertmacro Parameter "pa" ${SecPanjabi}
1085   !insertmacro Parameter "pl" ${SecPolish}
1086   !insertmacro Parameter "pt" ${SecPortuguese}
1087   !insertmacro Parameter "pt_BR" ${SecPortugueseBrazil}
1088   !insertmacro Parameter "ru" ${SecRussian}
1089   !insertmacro Parameter "rw" ${SecKinyarwanda}
1090   !insertmacro Parameter "sk" ${SecSlovak}
1091   !insertmacro Parameter "sl" ${SecSlovenian}
1092   !insertmacro Parameter "sq" ${SecAlbanian}
1093   !insertmacro Parameter "sr" ${SecSerbian}
1094   !insertmacro Parameter "sr@Latn" ${SecSerbianLatin}
1095   !insertmacro Parameter "sv" ${SecSwedish}
1096   !insertmacro Parameter "th" ${SecThai}
1097   !insertmacro Parameter "tr" ${SecTurkish}
1098   !insertmacro Parameter "uk" ${SecUkrainian}
1099   !insertmacro Parameter "vi" ${SecVietnamese}
1100   !insertmacro Parameter "zh_CN" ${SecChineseSimplified}
1101   !insertmacro Parameter "zh_TW" ${SecChineseTaiwan}
1102   
1103   Push "?"
1104   Push "TEST"
1105   Call GetParameterValue
1106   Pop $1
1107   StrCmp $1 "TEST" +3
1108     MessageBox MB_OK "possible parameters for installer:$\r$\n \
1109       /?: this help screen$\r$\n \
1110       /S: silent$\r$\n \
1111       /D=(directory): where to install inkscape$\r$\n \
1112       /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
1113       /SHORTCUTS=(OFF/ON): shortcuts to start inkscape$\r$\n \
1114       /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
1115       /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
1116       /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
1117       /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
1118       /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
1119       /PREFERENCES=(OFF/ON): delete users preference files$\r$\n \
1120       /ADDFILES=(OFF/ON): additional files$\r$\n \
1121       /EXAMPLES=(OFF/ON): examples$\r$\n \
1122       /TUTORIALS=(OFF/ON): tutorials$\r$\n \
1123       /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
1124       /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
1125     Abort
1126 FunctionEnd
1128 Function .onSelChange
1129 FunctionEnd
1131 ; --------------------------------------------------
1133 Function un.CustomPageUninstall
1134   !insertmacro MUI_HEADER_TEXT "$(lng_UInstOpt)" "$(lng_UInstOpt1)"
1135   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 1" "Text" "$APPDATA\Inkscape\"
1136   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 2" "Text" "$(lng_PurgePrefs)"
1138   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall"
1139   !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State"
1140   DetailPrint "keepfiles = $MultiUser" 
1141           ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1143 FunctionEnd
1146 Function un.onInit
1147   ClearErrors
1148   StrCpy $User ""
1149         UserInfo::GetName
1150         IfErrors +3
1151         Pop $0
1152         StrCpy $User $0
1154   StrCpy $askMultiUser "1"
1155   StrCpy $MultiUser "1"
1156  
1157   ; Test if this was a multiuser installation
1158   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" ""
1159   StrCmp $0  "$INSTDIR\inkscape.exe" 0 hkcu_user_uninstall  
1160     ReadRegStr $MultiUser HKLM "${PRODUCT_DIR_REGKEY}" "MultiUser"
1161     ReadRegStr $askMultiUser HKLM "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1162         ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
1163         Goto check_user_uninstall
1164   hkcu_user_uninstall:
1165   ReadRegStr $MultiUser HKCU "${PRODUCT_DIR_REGKEY}" "MultiUser"
1166   ReadRegStr $askMultiUser HKCU "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1167   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
1168   ;check user if applicable
1169   check_user_uninstall:
1170   StrCmp $0 "" diff_user_uninstall_done
1171         StrCmp $0 $User diff_user_uninstall_done
1172           MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK diff_user_uninstall_done IDCANCEL +1
1173                 Quit
1174   diff_user_uninstall_done:
1175     
1176  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "inkscape.nsi.uninstall"
1178  ;check whether Multi user installation ?
1179  SetShellVarContext all
1180  StrCmp $MultiUser "0" 0 +2 
1181  SetShellVarContext current
1182  ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1183    
1184 FunctionEnd
1186 Section Uninstall
1188   ; remove personal settings
1189   Delete "$APPDATA\Inkscape\extension-errors.log"
1190   StrCmp $MultiUser "0" 0 endPurge  ; multiuser assigned in dialog
1191     DetailPrint "purge personal settings in $APPDATA\Inkscape"
1192     ;RMDir /r "$APPDATA\Inkscape"
1193         !insertmacro delprefs
1194   endPurge:
1196   ; Remove file associations for svg editor
1197   DetailPrint "removing file associations for svg editor"
1198   ClearErrors
1199   ReadRegStr $0 HKCR ".svg" ""
1200   DetailPrint ".svg associated as $0"
1201   IfErrors endUninstSVGEdit  
1202     ReadRegStr $1 HKCR "$0\shell\edit\command" ""
1203         IfErrors 0 +2  
1204       DetailPrint "svg editor is $1"
1205     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1206       DetailPrint "removing default .svg editor"
1207       DeleteRegKey HKCR "$0\shell\edit\command"
1208     DeleteRegKey /ifempty HKCR "$0\shell\edit"
1209     DeleteRegKey /ifempty HKCR "$0\shell"
1210     DeleteRegKey /ifempty HKCR "$0"
1211   endUninstSVGEdit:
1212   
1213   ClearErrors
1214   ReadRegStr $2 HKCR ".svgz" ""
1215   DetailPrint ".svgz associated as $2"
1216   IfErrors endUninstSVGZEdit  
1217     ReadRegStr $3 HKCR "$2\shell\edit\command" ""
1218     IfErrors 0 +2  
1219       DetailPrint "svgz editor is $1"
1220     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1221       DetailPrint "removing default .svgz editor"
1222       DeleteRegKey HKCR "$2\shell\edit\command"
1223     DeleteRegKey /ifempty HKCR "$2\shell\edit"
1224     DeleteRegKey /ifempty HKCR "$2\shell"
1225     DeleteRegKey /ifempty HKCR "$2"
1226   endUninstSVGZEdit:
1227   
1228   ; Remove file associations for svg editor
1229   DetailPrint "removing file associations for svg editor"
1230   ClearErrors
1231   ReadRegStr $0 HKCR ".svg" ""
1232   IfErrors endUninstSVGView
1233     ReadRegStr $1 HKCR "$0\shell\open\command" ""
1234     IfErrors 0 +2  
1235       DetailPrint "svg viewer is $1"
1236     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1237       DetailPrint "removing default .svg viewer"
1238       DeleteRegKey HKCR "$0\shell\open\command"
1239     DeleteRegKey /ifempty HKCR "$0\shell\open"
1240     DeleteRegKey /ifempty HKCR "$0\shell"
1241     DeleteRegKey /ifempty HKCR "$0"
1242   endUninstSVGView:
1243   
1244   ClearErrors
1245   ReadRegStr $2 HKCR ".svgz" ""
1246   IfErrors endUninstSVGZView
1247     ReadRegStr $3 HKCR "$2\shell\open\command" ""
1248     IfErrors 0 +2  
1249       DetailPrint "svgz viewer is $1"
1250     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1251       DetailPrint "removing default .svgz viewer"
1252       DeleteRegKey HKCR "$2\shell\open\command"
1253     DeleteRegKey /ifempty HKCR "$2\shell\open"
1254     DeleteRegKey /ifempty HKCR "$2\shell"
1255     DeleteRegKey /ifempty HKCR "$2"
1256   endUninstSVGZView:
1257   
1258   ; Remove file associations for context menue
1259   DetailPrint "removing file associations for svg editor"
1260   ClearErrors
1261   ReadRegStr $0 HKCR ".svg" ""
1262   IfErrors endUninstSVGContext
1263   DetailPrint "removing default .svg context menue"
1264   DeleteRegKey HKCR "$0\shell\${PRODUCT_NAME}"
1265   DeleteRegKey /ifempty HKCR "$0\shell"
1266   DeleteRegKey /ifempty HKCR "$0"
1267   endUninstSVGContext:
1268   
1269   ClearErrors
1270   ReadRegStr $2 HKCR ".svgz" ""
1271   IfErrors endUninstSVGZContext
1272   DetailPrint "removing default .svgzcontext menue"
1273   DeleteRegKey HKCR "$2\shell\${PRODUCT_NAME}"
1274   DeleteRegKey /ifempty HKCR "$2\shell"
1275   DeleteRegKey /ifempty HKCR "$2"
1276   endUninstSVGZContext:
1278   ReadRegStr $1 HKCR "$0" ""
1279   StrCmp $1 "" 0 +3
1280     DetailPrint "removing filetype .svg $0"
1281     DeleteRegKey HKCR ".svg"
1282   
1283   ReadRegStr $3 HKCR "$2" ""
1284   StrCmp $3 "" 0 +3
1285     DetailPrint "removing filetype .svgz $2"
1286     DeleteRegKey HKCR ".svgz"
1287   
1288     
1289   SetShellVarContext all
1290   DetailPrint "removing product regkey"
1291   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1292   DetailPrint "removing uninstall info"
1293   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1294   DetailPrint "removing shortcuts"
1295   Delete "$DESKTOP\Inkscape.lnk"
1296   Delete "$QUICKLAUNCH\Inkscape.lnk"
1297   Delete "$SMPROGRAMS\Inkscape.lnk"
1298   ;just in case they are still there
1299   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1300   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1301   RMDir  "$SMPROGRAMS\Inkscape"
1303   SetShellVarContext current
1304   DetailPrint "removing product regkey"
1305   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1306   DetailPrint "removing uninstall info"
1307   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1308   DetailPrint "removing shortcuts"
1309   Delete "$DESKTOP\Inkscape.lnk"
1310   Delete "$QUICKLAUNCH\Inkscape.lnk"
1311   Delete "$SMPROGRAMS\Inkscape.lnk"
1312   ;just in case they are still there
1313   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1314   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1315   RMDir  "$SMPROGRAMS\Inkscape"
1317   DetailPrint "removing uninstall info"
1318   RMDir /r "$INSTDIR"
1320   SetAutoClose false
1322 SectionEnd