Code

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