Code

some changes bcs of the name of uninstall.exe
[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
32 ;..................................................................................................
33 ;Following two definitions required. Uninstall log will use these definitions.
34 ;You may use these definitions also, when you want to set up the InstallDirRagKey,
35 ;store the language selection, store Start Menu folder etc.
36 ;Enter the windows uninstall reg sub key to add uninstall information to Add/Remove Programs also.
38 !define INSTDIR_REG_ROOT "HKLM"
39 !define INSTDIR_REG_KEY PRODUCT_UNINST_KEY
41 ;include the Uninstall log header
42 !include AdvUninstLog.nsh
44 ;Specify the preferred uninstaller operation mode, either unattended or interactive.
45 ;You have to type either !insertmacro UNATTENDED_UNINSTALL, or !insertmacro INTERACTIVE_UNINSTALL.
46 ;Be aware only one of the following two macros has to be inserted, neither both, neither none.
48 ;!insertmacro UNATTENDED_UNINSTALL
49 !insertmacro INTERACTIVE_UNINSTALL
52 ; Welcome page
53 !insertmacro MUI_PAGE_WELCOME
54 ; License page
55 ; !define MUI_LICENSEPAGE_RADIOBUTTONS
56 LicenseForceSelection off
57 !define MUI_LICENSEPAGE_BUTTON $(lng_LICENSE_BUTTON)
58 !define MUI_LICENSEPAGE_TEXT_BOTTOM $(lng_LICENSE_BOTTOM_TEXT)
59 !insertmacro MUI_PAGE_LICENSE "..\..\Copying"
60 !insertmacro MUI_PAGE_COMPONENTS
61 ; InstType $(lng_Full)
62 ; InstType $(lng_Optimal)
63 ; InstType $(lng_Minimal)
64 ; Directory page
65 !insertmacro MUI_PAGE_DIRECTORY
66 ; Instfiles page
67 !insertmacro MUI_PAGE_INSTFILES
68 ; Finish page
69 !define MUI_FINISHPAGE_RUN "$INSTDIR\inkscape.exe"
70 !insertmacro MUI_PAGE_FINISH
72 ; Uninstaller pages
73 !insertmacro MUI_UNPAGE_CONFIRM
74 UninstPage custom un.CustomPageUninstall
75 !insertmacro MUI_UNPAGE_INSTFILES
76 ShowUninstDetails hide
77 !insertmacro MUI_UNPAGE_FINISH
79 ; #######################################
80 ; STRING   LOCALIZATION
81 ; #######################################
82 ; Thanks to Adib Taraben and Luca Bruno for getting this started
83 ; Add your translation here!  :-)
84 ; I had wanted to list the languages alphabetically, but apparently
85 ; the first is the default.  So putting English first is just being
86 ; practical.  It is not chauvinism or hubris, I swear!  ;-)
87 ; default language first
89 ; Language files
90 !include "english.nsh" 
91 ; !include "catalan.nsh" the catalan support has been abandoned by NSIS as of version 2.28
92 !include "czech.nsh" 
93 !include "finnish.nsh" 
94 !include "french.nsh" 
95 !include "german.nsh" 
96 !include "italian.nsh" 
97 !include "japanese.nsh"
98 !include "polish.nsh" 
99 !include "russian.nsh" 
100 !include "slovak.nsh" 
101 !include "slovenian.nsh" 
102 !include "spanish.nsh" 
104 ReserveFile "inkscape.nsi.uninstall"
107 ; #######################################
108 ; SETTINGS
109 ; #######################################
111 Name              "${PRODUCT_NAME} ${PRODUCT_VERSION}"
112 Caption           $(lng_Caption)
113 OutFile           "Inkscape-${PRODUCT_VERSION}-1.win32.exe"
114 InstallDir        "$PROGRAMFILES\Inkscape"
115 InstallDirRegKey  HKLM "${PRODUCT_DIR_REGKEY}" ""
116 ShowInstDetails   hide
117 ShowUnInstDetails hide
119 var askMultiUser
120 Var MultiUser
121 var User
123 ; #######################################
124 ;  I N S T A L L E R    S E C T I O N S
125 ; #######################################
127 ; Turn off old selected section
128 ; GetWindowsVersion
130 ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
131 ; Updated by Joost Verburg
132 ; Updated for Windows 98 SE by Matthew Win Tibbals 5-21-03
134 ; Returns on top of stack
136 ; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003)
137 ; or
138 ; '' (Unknown Windows Version)
140 ; Usage:
141 ;   Call GetWindowsVersion
142 ;   Pop $R0
143 ;   ; at this point $R0 is "NT 4.0" or whatnot
144 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
145 Function GetWindowsVersion
146  
147   Push $R0
148   Push $R1
149  
150   ClearErrors
151  
152   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
153  
154   IfErrors 0 lbl_winnt
155  
156   ; we are not NT
157   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
158  
159   StrCpy $R1 $R0 1
160   StrCmp $R1 '4' 0 lbl_error
161  
162   StrCpy $R1 $R0 3
163  
164   StrCmp $R1 '4.0' lbl_win32_95
165   StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
166  
167   lbl_win32_95:
168     StrCpy $R0 '95'
169         StrCpy $AskMultiUser "0"
170   Goto lbl_done
171  
172   lbl_win32_98:
173     StrCpy $R0 '98'
174         StrCpy $AskMultiUser "0"
175   Goto lbl_done
176   lbl_win32_ME:
177     StrCpy $R0 'ME'
178         StrCpy $AskMultiUser "0"
179   Goto lbl_done
180  
181   lbl_winnt:
182  
183   StrCpy $R1 $R0 1
184  
185   StrCmp $R1 '3' lbl_winnt_x
186   StrCmp $R1 '4' lbl_winnt_x
187  
188   StrCpy $R1 $R0 3
189  
190   StrCmp $R1 '5.0' lbl_winnt_2000
191   StrCmp $R1 '5.1' lbl_winnt_XP
192   StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error
193  
194   lbl_winnt_x:
195     StrCpy $R0 "NT $R0" 6
196   Goto lbl_done
197  
198   lbl_winnt_2000:
199     Strcpy $R0 '2000'
200   Goto lbl_done
201  
202   lbl_winnt_XP:
203     Strcpy $R0 'XP'
204   Goto lbl_done
205  
206   lbl_winnt_2003:
207     Strcpy $R0 '2003'
208   Goto lbl_done
209  
210   lbl_error:
211     Strcpy $R0 ''
212   lbl_done:
213  
214   Pop $R1
215   Exch $R0
217 FunctionEnd
219 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
221  ; StrStr
222  ; input, top of stack = string to search for
223  ;        top of stack-1 = string to search in
224  ; output, top of stack (replaces with the portion of the string remaining)
225  ; modifies no other variables.
226  ;
227  ; Usage:
228  ;   Push "this is a long ass string"
229  ;   Push "ass"
230  ;   Call StrStr
231  ;   Pop $R0
232  ;  ($R0 at this point is "ass string")
234  Function StrStr
235    Exch $R1 ; st=haystack,old$R1, $R1=needle
236    Exch    ; st=old$R1,haystack
237    Exch $R2 ; st=old$R1,old$R2, $R2=haystack
238    Push $R3
239    Push $R4
240    Push $R5
241    StrLen $R3 $R1
242    StrCpy $R4 0
243    ; $R1=needle
244    ; $R2=haystack
245    ; $R3=len(needle)
246    ; $R4=cnt
247    ; $R5=tmp
248    loop:
249      StrCpy $R5 $R2 $R3 $R4
250      StrCmp $R5 $R1 done
251      StrCmp $R5 "" done
252      IntOp $R4 $R4 + 1
253      Goto loop
254  done:
255    StrCpy $R1 $R2 "" $R4
256    Pop $R5
257    Pop $R4
258    Pop $R3
259    Pop $R2
260    Exch $R1
261  FunctionEnd
263 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
265  ; GetParameters
266  ; input, none
267  ; output, top of stack (replaces, with e.g. whatever)
268  ; modifies no other variables.
269  
270  Function GetParameters
271  
272    Push $R0
273    Push $R1
274    Push $R2
275    Push $R3
276    
277    StrCpy $R2 1
278    StrLen $R3 $CMDLINE
279    
280    ;Check for quote or space
281    StrCpy $R0 $CMDLINE $R2
282    StrCmp $R0 '"' 0 +3
283      StrCpy $R1 '"'
284      Goto loop
285    StrCpy $R1 " "
286    
287    loop:
288      IntOp $R2 $R2 + 1
289      StrCpy $R0 $CMDLINE 1 $R2
290      StrCmp $R0 $R1 get
291      StrCmp $R2 $R3 get
292      Goto loop
293    
294    get:
295      IntOp $R2 $R2 + 1
296      StrCpy $R0 $CMDLINE 1 $R2
297      StrCmp $R0 " " get
298      StrCpy $R0 $CMDLINE "" $R2
299    
300    Pop $R3
301    Pop $R2
302    Pop $R1
303    Exch $R0
304  
305  FunctionEnd
307 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
308 ; GetParameterValue
309 ; Chris Morgan<cmorgan@alum.wpi.edu> 5/10/2004
310 ; -Updated 4/7/2005 to add support for retrieving a command line switch
311 ;  and additional documentation
313 ; Searches the command line input, retrieved using GetParameters, for the
314 ; value of an option given the option name.  If no option is found the
315 ; default value is placed on the top of the stack upon function return.
317 ; This function can also be used to detect the existence of just a
318 ; command line switch like /OUTPUT  Pass the default and "OUTPUT"
319 ; on the stack like normal.  An empty return string "" will indicate
320 ; that the switch was found, the default value indicates that
321 ; neither a parameter or switch was found.
323 ; Inputs - Top of stack is default if parameter isn't found,
324 ;  second in stack is parameter to search for, ex. "OUTPUT"
325 ; Outputs - Top of the stack contains the value of this parameter
326 ;  So if the command line contained /OUTPUT=somedirectory, "somedirectory"
327 ;  will be on the top of the stack when this function returns
329 ; Register usage
330 ;$R0 - default return value if the parameter isn't found
331 ;$R1 - input parameter, for example OUTPUT from the above example
332 ;$R2 - the length of the search, this is the search parameter+2
333 ;      as we have '/OUTPUT='
334 ;$R3 - the command line string
335 ;$R4 - result from StrStr calls
336 ;$R5 - search for ' ' or '"'
337  
338 Function GetParameterValue
339   Exch $R0  ; get the top of the stack(default parameter) into R0
340   Exch      ; exchange the top of the stack(default) with
341             ; the second in the stack(parameter to search for)
342   Exch $R1  ; get the top of the stack(search parameter) into $R1
343  
344   ;Preserve on the stack the registers used in this function
345   Push $R2
346   Push $R3
347   Push $R4
348   Push $R5
349  
350   Strlen $R2 $R1+2    ; store the length of the search string into R2
351  
352   Call GetParameters  ; get the command line parameters
353   Pop $R3             ; store the command line string in R3
354  
355   # search for quoted search string
356   StrCpy $R5 '"'      ; later on we want to search for a open quote
357   Push $R3            ; push the 'search in' string onto the stack
358   Push '"/$R1='       ; push the 'search for'
359   Call StrStr         ; search for the quoted parameter value
360   Pop $R4
361   StrCpy $R4 $R4 "" 1   ; skip over open quote character, "" means no maxlen
362   StrCmp $R4 "" "" next ; if we didn't find an empty string go to next
363  
364   # search for non-quoted search string
365   StrCpy $R5 ' '      ; later on we want to search for a space since we
366                       ; didn't start with an open quote '"' we shouldn't
367                       ; look for a close quote '"'
368   Push $R3            ; push the command line back on the stack for searching
369   Push '/$R1='        ; search for the non-quoted search string
370   Call StrStr
371   Pop $R4
372  
373   ; $R4 now contains the parameter string starting at the search string,
374   ; if it was found
375 next:
376   StrCmp $R4 "" check_for_switch ; if we didn't find anything then look for
377                                  ; usage as a command line switch
378   # copy the value after /$R1= by using StrCpy with an offset of $R2,
379   # the length of '/OUTPUT='
380   StrCpy $R0 $R4 "" $R2  ; copy commandline text beyond parameter into $R0
381   # search for the next parameter so we can trim this extra text off
382   Push $R0
383   Push $R5            ; search for either the first space ' ', or the first
384                       ; quote '"'
385                       ; if we found '"/output' then we want to find the
386                       ; ending ", as in '"/output=somevalue"'
387                       ; if we found '/output' then we want to find the first
388                       ; space after '/output=somevalue'
389   Call StrStr         ; search for the next parameter
390   Pop $R4
391   StrCmp $R4 "" done  ; if 'somevalue' is missing, we are done
392   StrLen $R4 $R4      ; get the length of 'somevalue' so we can copy this
393                       ; text into our output buffer
394   StrCpy $R0 $R0 -$R4 ; using the length of the string beyond the value,
395                       ; copy only the value into $R0
396   goto done           ; if we are in the parameter retrieval path skip over
397                       ; the check for a command line switch
398  
399 ; See if the parameter was specified as a command line switch, like '/output'
400 check_for_switch:
401   Push $R3            ; push the command line back on the stack for searching
402   Push '/$R1'         ; search for the non-quoted search string
403   Call StrStr
404   Pop $R4
405   StrCmp $R4 "" done  ; if we didn't find anything then use the default
406   StrCpy $R0 ""       ; otherwise copy in an empty string since we found the
407                       ; parameter, just didn't find a value
408  
409 done:
410   Pop $R5
411   Pop $R4
412   Pop $R3
413   Pop $R2
414   Pop $R1
415   Exch $R0 ; put the value in $R0 at the top of the stack
416 FunctionEnd
418 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
420 !macro Language polng lng
421   SectionIn 1 2 3
422   SetOutPath $INSTDIR
423   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
424   File /nonfatal /a "..\..\inkscape\*.${lng}.txt"
425   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
426   SetOutPath $INSTDIR\locale
427   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
428   File /nonfatal /a /r "..\..\inkscape\locale\${polng}"
429   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
430   SetOutPath $INSTDIR\lib\locale
431   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
432   File /nonfatal /a /r "..\..\inkscape\lib\locale\${polng}"
433   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
434   SetOutPath $INSTDIR\share\clipart
435   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
436   File /nonfatal /a /r "..\..\inkscape\share\clipart\*.${polng}.svg"  
437   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
438   ; the keyboard tables
439   SetOutPath $INSTDIR\share\screens
440   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
441   File /nonfatal /a /r "..\..\inkscape\share\screens\*.${polng}.svg"  
442   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
443   SetOutPath $INSTDIR\share\templates
444   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
445   File /nonfatal /a /r "..\..\inkscape\share\templates\*.${polng}.svg"  
446   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
447   SetOutPath $INSTDIR\doc
448   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
449   File /nonfatal /a /r "..\..\inkscape\doc\keys.${polng}.xml"  
450   File /nonfatal /a /r "..\..\inkscape\doc\keys.${polng}.html"  
451   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
452   SectionGetFlags ${SecTutorials} $R1 
453   IntOp $R1 $R1 & ${SF_SELECTED} 
454   IntCmp $R1 ${SF_SELECTED} 0 skip_tutorials 
455     SetOutPath $INSTDIR\share\tutorials
456     !insertmacro UNINSTALL.LOG_OPEN_INSTALL
457     File /nonfatal /a "..\..\inkscape\share\tutorials\*.${polng}.*"
458     !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
459   skip_tutorials:
460 !macroend
462 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
464 ;;;;;;;;;;;;;;;;;;;;;;;;;;
465 ; Delete prefs
466 ; code taken from the vlc project
467 ;;;;;;;;;;;;;;;;;;;;;;;;;;
468 !macro delprefs
469   StrCpy $0 0
470         DetailPrint "Delete personal preferences ..."
471         DetailPrint "try to find all users ..."
472         delprefs-Loop:
473  ; FIXME
474   ; this will loop through all the logged users and "virtual" windows users
475   ; (it looks like users are only present in HKEY_USERS when they are logged in)
476     ClearErrors
477     EnumRegKey $1 HKU "" $0
478     StrCmp $1 "" delprefs-End
479     IntOp $0 $0 + 1
480     ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
481     StrCmp $2 "" delprefs-Loop
482         DetailPrint "$2\Inkscape will be removed"
483     RMDir /r "$2\Inkscape"
484     Goto delprefs-Loop
485   delprefs-End:
486 !macroend
489 ;--------------------------------
490 ; Installer Sections
491 ; @todo better idea is to call the original uninstaller first
492 Section -removeInkscape
493   ; check for an old installation and clean that dlls and stuff
494   ClearErrors
495   IfFileExists $INSTDIR\etc 0 doDeleteLib
496     DetailPrint "$INSTDIR\etc exists, will be removed"
497     RmDir /r $INSTDIR\etc
498         IfErrors 0 +4
499       DetailPrint "fatal: failed to delete $INSTDIR\etc"
500       DetailPrint "aborting installation"
501           Abort
502   doDeleteLib:
504   ClearErrors
505   IfFileExists $INSTDIR\lib 0 doDeleteLocale
506     DetailPrint "$INSTDIR\lib exists, will be removed"  
507     RmDir /r $INSTDIR\lib
508         IfErrors 0 +4
509       DetailPrint "fatal: failed to delete $INSTDIR\lib"
510       DetailPrint "aborting installation"
511           Abort
512   doDeleteLocale:
514   ClearErrors
515   IfFileExists $INSTDIR\locale 0 doDeleteDll
516     DetailPrint "$INSTDIR\locale exists, will be removed"
517     RmDir /r $INSTDIR\locale
518         IfErrors 0 +4
519       DetailPrint "fatal: failed to delete $INSTDIR\locale"
520       DetailPrint "aborting installation"
521           Abort
522   doDeleteDll:
524   ClearErrors
525   FindFirst $0 $1 $INSTDIR\*.dll
526     FindNextLoop:
527     StrCmp $1 "" FindNextDone
528     DetailPrint "$INSTDIR\$1 exists, will be removed"
529     Delete $INSTDIR\$1
530     IfErrors 0 +4
531       DetailPrint "fatal: failed to delete $INSTDIR\$1"
532       DetailPrint "aborting installation"
533       Abort
534     FindNext $0 $1
535     Goto FindNextLoop
536   FindNextDone:
537   
538   ;remove the old inkscape shortcuts from the startmenu
539   ;just in case they are still there
540   SetShellVarContext current
541   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
542   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
543   RMDir  "$SMPROGRAMS\Inkscape"
544   Delete "$SMPROGRAMS\Inkscape.lnk"
545   SetShellVarContext all
546   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
547   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
548   RMDir  "$SMPROGRAMS\Inkscape"
549   Delete "$SMPROGRAMS\Inkscape.lnk"
550   
551 SectionEnd
553 Section $(lng_Core) SecCore
555   DetailPrint "Installing Inkscape Core Files ..."
557   SectionIn 1 2 3 RO
558   SetOutPath $INSTDIR
559   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
560   SetOverwrite on
561   SetAutoClose false
563   File /a "..\..\inkscape\ink*.exe"
564   File /a "..\..\inkscape\AUTHORS"
565   File /a "..\..\inkscape\COPYING"
566   File /a "..\..\inkscape\COPYING.LIB"
567   File /a "..\..\inkscape\NEWS"
568   File /nonfatal /a "..\..\inkscape\HACKING.txt"
569   File /a "..\..\inkscape\README"
570   File /nonfatal /a "..\..\inkscape\README.txt"
571   File /a "..\..\inkscape\TRANSLATORS"
572   File /nonfatal /a /r "..\..\inkscape\data"
573   File /nonfatal /a /r "..\..\inkscape\doc"
574   File /nonfatal /a /r "..\..\inkscape\plugins"
575   File /nonfatal /a /r /x *.??*.???* /x "examples" /x "tutorials" "..\..\inkscape\share"
576   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
577   ; this files are added because it slips through the filter
578   SetOutPath $INSTDIR\share\clipart
579   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
580   File /a "..\..\inkscape\share\clipart\inkscape.logo.svg"
581   ;File /a "..\..\inkscape\share\clipart\inkscape.logo.classic.svg"  
582   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
583   SetOutPath $INSTDIR\share\extensions
584   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
585   File /a "..\..\inkscape\share\extensions\pdf_output.inx.txt"
586   File /a "..\..\inkscape\share\extensions\pdf_output_via_gs_on_win32.inx.txt"
587   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
588   SetOutPath $INSTDIR\share\icons
589   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
590   File /a "..\..\inkscape\share\icons\inkscape.file.png"
591   File /a "..\..\inkscape\share\icons\inkscape.file.svg"
592   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
593   SetOutPath $INSTDIR\modules
594   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
595   File /nonfatal /a /r "..\..\inkscape\modules\*.*"
596   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
597   SetOutPath $INSTDIR\python
598   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
599   File /nonfatal /a /r "..\..\inkscape\python\*.*" 
600   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
601 SectionEnd
603 Section $(lng_GTKFiles) SecGTK
605   DetailPrint "Installing GTK Files ..."
606   
607   SectionIn 1 2 3 RO
608   SetOutPath $INSTDIR
609   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
610   SetOverwrite on
611   File /a /r "..\..\inkscape\*.dll"
612   File /a /r /x "locale" "..\..\inkscape\lib"
613   File /a /r "..\..\inkscape\etc"
614   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
615 SectionEnd
617 Section $(lng_Alluser) SecAlluser
618   ; disable this option in Win95/Win98/WinME
619   SectionIn 1 2 3 
620   StrCpy $MultiUser "1"
621   StrCmp $MultiUser "1" "" SingleUser
622     DetailPrint "admin mode, registry root will be HKLM"
623     SetShellVarContext all
624     Goto endSingleUser
625   SingleUser:
626     DetailPrint "single user mode, registry root will be HKCU"
627     SetShellVarContext current
628   endSingleUser:                
629 SectionEnd
631 SectionGroup $(lng_Shortcuts) SecShortcuts
633 Section /o $(lng_Desktop) SecDesktop
634   ClearErrors
635   CreateShortCut "$DESKTOP\Inkscape.lnk" "$INSTDIR\inkscape.exe"
636   IfErrors 0 +2
637     DetailPrint "Uups! Problems creating desktop shortcuts"
638 SectionEnd
640 Section /o $(lng_Quicklaunch) SecQuicklaunch
641   ClearErrors
642   StrCmp $QUICKLAUNCH $TEMP +2
643     CreateShortCut "$QUICKLAUNCH\Inkscape.lnk" "$INSTDIR\inkscape.exe"
644   IfErrors 0 +2
645     DetailPrint "Uups! Problems creating quicklaunch shortcuts"
646 SectionEnd
648 Section $(lng_SVGWriter) SecSVGWriter 
649   SectionIn 1 2 3
650   ; create file associations, test before if needed
651   DetailPrint "creating file associations"
652   ClearErrors
653   ReadRegStr $0 HKCR ".svg" ""
654   StrCmp $0 "" 0 +3
655     WriteRegStr HKCR ".svg" "" "svgfile"
656     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
657   ReadRegStr $0 HKCR ".svgz" ""
658   StrCmp $0 "" 0 +3
659     WriteRegStr HKCR ".svgz" "" "svgfile"
660     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
661   IfErrors 0 +2
662     DetailPrint "Uups! Problems creating file assoziations for svg writer"
663   
664   DetailPrint "creating default editor"
665   ClearErrors
666   ReadRegStr $0 HKCR ".svg" ""
667   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
668   ReadRegStr $0 HKCR ".svgz" ""
669   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
670   IfErrors 0 +2
671     DetailPrint "Uups! Problems creating default editor"
672 SectionEnd
674 Section $(lng_ContextMenu) SecContextMenu
675   SectionIn 1 2 3
676   ; create file associations, test before if needed
677   DetailPrint "creating file associations"
678   ClearErrors
679   ReadRegStr $0 HKCR ".svg" ""
680   StrCmp $0 "" 0 +3
681     WriteRegStr HKCR ".svg" "" "svgfile"
682     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
683   ReadRegStr $0 HKCR ".svgz" ""
684   StrCmp $0 "" 0 +3
685     WriteRegStr HKCR ".svgz" "" "svgfile"
686     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
687   IfErrors 0 +2
688     DetailPrint "Uups! Problems creating file assoziations for context menu"
689   
690   DetailPrint "creating context menue"
691   ClearErrors
692   ReadRegStr $0 HKCR ".svg" ""
693   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
694   ReadRegStr $0 HKCR ".svgz" ""
695   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
696   IfErrors 0 +2
697     DetailPrint "Uups! Problems creating context menue integration"
699 SectionEnd
701 SectionGroupEnd
703 Section /o $(lng_DeletePrefs) SecPrefs
704         !insertmacro delprefs
705 SectionEnd
707 SectionGroup $(lng_Addfiles) SecAddfiles
709 Section $(lng_Examples) SecExamples
710   SectionIn 1 2
711   SetOutPath $INSTDIR\share
712   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
713   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\examples"
714   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
715 SectionEnd
717 Section $(lng_Tutorials) SecTutorials
718   SectionIn 1 2
719   SetOutPath $INSTDIR\share
720   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
721   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\tutorials"
722   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
723 SectionEnd
725 SectionGroupEnd
727 SectionGroup /e $(lng_Languages) SecLanguages
729 Section $(lng_am) SecAmharic
730   !insertmacro Language am am
731 SectionEnd
733 Section $(lng_az) SecAzerbaijani
734   !insertmacro Language az az
735 SectionEnd
737 Section $(lng_be) SecByelorussian
738   !insertmacro Language be be
739 SectionEnd
741 Section $(lng_bg) SecBulgarian
742   !insertmacro Language bg bg
743 SectionEnd
745 Section $(lng_bn) SecBengali
746   !insertmacro Language bn bn
747 SectionEnd
749 Section $(lng_ca) SecCatalan
750   !insertmacro Language ca ca
751 SectionEnd
753 Section $(lng_cs) SecCzech
754   !insertmacro Language cs cs
755 SectionEnd
757 Section $(lng_da) SecDanish
758   !insertmacro Language da da
759 SectionEnd
761 Section $(lng_de) SecGerman
762   !insertmacro Language 'de' 'de'
763 SectionEnd
765 Section $(lng_dz) SecDzongkha
766   !insertmacro Language dz dz
767 SectionEnd
769 Section $(lng_el) SecGreek
770   !insertmacro Language el el
771 SectionEnd
773 Section $(lng_en) SecEnglish
774   SectionIn 1 2 3 RO
775 SectionEnd
777 Section $(lng_en_AU) SecEnglishAustralian
778   !insertmacro Language en_AU en_AU
779 SectionEnd
781 Section $(lng_en_CA) SecEnglishCanadian
782   !insertmacro Language en_CA en_CA
783 SectionEnd
785 Section $(lng_en_GB) SecEnglishBritain
786   !insertmacro Language en_GB en_GB
787 SectionEnd
789 Section $(lng_en_US@piglatin) SecEnglishPiglatin
790   !insertmacro Language en_US@piglatin en_US@Piglatin
791 SectionEnd
793 Section $(lng_eo) SecEsperanto
794   !insertmacro Language eo eo
795 SectionEnd
797 Section $(lng_es) SecSpanish
798   !insertmacro Language 'es' 'es'
799 SectionEnd
801 Section $(lng_es_MX) SecSpanishMexico
802   !insertmacro Language 'es_MX' 'es_MX'
803 SectionEnd
805 Section $(lng_et) SecEstonian
806   !insertmacro Language et et
807 SectionEnd
809 Section $(lng_eu) SecBasque
810   !insertmacro Language eu eu
811 SectionEnd
813 Section $(lng_fr) SecFrench
814   !insertmacro Language 'fr' 'fr'
815 SectionEnd
817 Section $(lng_fi) SecFinnish
818   !insertmacro Language 'fi' 'fi'
819 SectionEnd
821 Section $(lng_ga) SecIrish
822   !insertmacro Language ga ga
823 SectionEnd
825 Section $(lng_gl) SecGallegan
826   !insertmacro Language gl gl
827   SectionIn 1 2 3
828 SectionEnd
830 Section $(lng_he) SecHebrew
831   !insertmacro Language he he
832   SectionIn 1 2 3
833 SectionEnd
835 Section $(lng_hr) SecCroatian
836   !insertmacro Language hr hr
837   SectionIn 1 2 3
838 SectionEnd
840 Section $(lng_hu) SecHungarian
841   !insertmacro Language hu hu
842   SectionIn 1 2 3
843 SectionEnd
845 Section $(lng_id) SecIndonesian
846   !insertmacro Language id id
847   SectionIn 1 2 3
848 SectionEnd
850 Section $(lng_it) SecItalian
851   !insertmacro Language it it
852   SectionIn 1 2 3
853 SectionEnd
855 Section $(lng_ja) SecJapanese
856   !insertmacro Language 'ja' 'jp'
857 SectionEnd
859 Section $(lng_km) SecKhmer
860   !insertmacro Language km km
861 SectionEnd
863 Section $(lng_ko) SecKorean
864   !insertmacro Language 'ko' 'ko'
865 SectionEnd
867 Section $(lng_lt) SecLithuanian
868   !insertmacro Language 'lt' 'lt'
869 SectionEnd
871 Section $(lng_mn) SecMongolian
872   !insertmacro Language mn mn
873 SectionEnd
875 Section $(lng_mk) SecMacedonian
876   !insertmacro Language mk mk
877 SectionEnd
879 Section $(lng_nb) SecNorwegianBokmal
880   !insertmacro Language nb nb
881 SectionEnd
883 Section $(lng_ne) SecNepali
884   !insertmacro Language ne ne
885 SectionEnd
887 Section $(lng_nl) SecDutch
888   !insertmacro Language nl nl
889 SectionEnd
891 Section $(lng_nn) SecNorwegianNynorsk
892   !insertmacro Language nn nn
893 SectionEnd
895 Section $(lng_pa) SecPanjabi
896   !insertmacro Language pa pa
897 SectionEnd
899 Section $(lng_pl) SecPolish
900   !insertmacro Language pl pl
901 SectionEnd
903 Section $(lng_pt) SecPortuguese
904   !insertmacro Language pt pt
905 SectionEnd
907 Section $(lng_pt_BR) SecPortugueseBrazil
908   !insertmacro Language pt_BR pt_BR
909 SectionEnd
911 Section $(lng_ro) SecRomanian
912   !insertmacro Language ro ro
913 SectionEnd
915 Section $(lng_ru) SecRussian
916   !insertmacro Language ru ru
917 SectionEnd
919 Section $(lng_rw) SecKinyarwanda
920   !insertmacro Language rw rw
921 SectionEnd
923 Section $(lng_sk) SecSlovak
924   !insertmacro Language sk sk
925 SectionEnd
927 Section $(lng_sl) SecSlovenian
928   !insertmacro Language sl sl
929 SectionEnd
931 Section $(lng_sq) SecAlbanian
932   !insertmacro Language sq sq
933 SectionEnd
935 Section $(lng_sr) SecSerbian
936   !insertmacro Language sr sr
937 SectionEnd
939 Section $(lng_sr@Latn) SecSerbianLatin
940   !insertmacro Language 'sr@Latn' 'sr@Latn'
941 SectionEnd
943 Section $(lng_sv) SecSwedish
944   !insertmacro Language sv sv
945 SectionEnd
947 Section $(lng_th) SecThai
948   !insertmacro Language th th
949 SectionEnd
951 Section $(lng_tr) SecTurkish
952   !insertmacro Language tr tr
953 SectionEnd
955 Section $(lng_uk) SecUkrainian
956   !insertmacro Language uk uk
957 SectionEnd
959 Section $(lng_vi) SecVietnamese
960   !insertmacro Language vi vi
961 SectionEnd
963 Section $(lng_zh_CN) SecChineseSimplified
964   !insertmacro Language zh_CN zh_CN
965 SectionEnd
967 Section $(lng_zh_TW) SecChineseTaiwan
968   !insertmacro Language zh_TW zh_TW
969 SectionEnd
971 SectionGroupEnd
974 Section -FinalizeInstallation
975   StrCmp $MultiUser "1" "" SingleUser
976     DetailPrint "admin mode, registry root will be HKLM"
977     SetShellVarContext all
978     Goto endSingleUser
979   SingleUser:
980     DetailPrint "single user mode, registry root will be HKCU"
981     SetShellVarContext current
982   endSingleUser:                
984   ; check for writing registry
985   ClearErrors
986   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inkscape.exe"  
987   ;IfErrors 0 +4
988   ;  DetailPrint "fatal: failed to write to ${PRODUCT_DIR_REGKEY}"
989   ;  DetailPrint "aborting installation"
990   ;     Abort
991   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "MultiUser" "$MultiUser"  
992   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "askMultiUser" "$askMultiUser"
993   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "User" "$User"
994   IfErrors 0 +2
995     DetailPrint "fatal: failed to write to registry installation info"
997   ; start menu entries
998   ClearErrors
999   CreateShortCut "$SMPROGRAMS\Inkscape.lnk" "$INSTDIR\inkscape.exe"
1000   IfErrors 0 +2
1001     DetailPrint "fatal: failed to write to start menu info"
1003   ; uninstall settings
1004   ClearErrors
1005   ; WriteUninstaller "$INSTDIR\uninst.exe"
1006   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\${UNINST_EXE}"
1007   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallDir" "$INSTDIR"
1008   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
1009   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
1010   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0"
1011   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
1012   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" "1"
1013   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" "1"
1014   IfErrors 0 +2
1015     DetailPrint "fatal: failed to write to registry un-installation info"
1016 SectionEnd
1017  
1018 ; Last the Descriptions
1019 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
1020   !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(lng_CoreDesc)
1021   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} $(lng_GTKFilesDesc)
1022   !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(lng_ShortcutsDesc)
1023   !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} $(lng_AlluserDesc) 
1024   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(lng_DesktopDesc)
1025   !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} $(lng_QuicklaunchDesc)
1026   !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} $(lng_SVGWriterDesc)
1027   !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} $(lng_ContextMenuDesc)
1028   !insertmacro MUI_DESCRIPTION_TEXT ${SecPrefs} $(lng_DeletePrefsDesc)
1029   !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} $(lng_AddfilesDesc)
1030   !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} $(lng_ExamplesDesc)
1031   !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} $(lng_TutorialsDesc)
1032   !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(lng_LanguagesDesc)
1033 !insertmacro MUI_FUNCTION_DESCRIPTION_END
1035 !macro Parameter key Section
1036   Push ${key}
1037   Push ""
1038   Call GetParameterValue
1039   Pop $1
1040   StrCmp $1 "OFF" 0 +5
1041     SectionGetFlags ${Section} $0
1042     IntOp $2 ${SF_SELECTED} ~
1043     IntOp $0 $0 & $2
1044     SectionSetFlags ${Section} $0
1045   StrCmp $1 "ON" 0 +4
1046     SectionGetFlags ${Section} $0
1047     IntOp $0 $0 | ${SF_SELECTED}
1048     SectionSetFlags ${Section} $0
1049 !macroend
1051 Function .onInit
1052   ;prepare log always within .onInit function
1053   !insertmacro UNINSTALL.LOG_PREPARE_INSTALL
1055   ;Extract InstallOptions INI files
1056   StrCpy $AskMultiUser "1"
1057   StrCpy $MultiUser "0"
1058   ; this resets AskMultiUser if Win95/98/ME
1059   Call GetWindowsVersion
1060   Pop $R0
1061   DetailPrint "detected operating system $R0"
1062   ;MessageBox MB_OK "operating system: $R0; AskMultiuser: $AskMultiUser"
1063   
1064   ; hide all user section if win98
1065   StrCmp $AskMultiUser "1" +2
1066     SectionSetText ${SecAlluser} ""
1068   ; hide if quick launch if not available
1069   StrCmp $QUICKLAUNCH $TEMP 0 +2
1070     SectionSetText ${SecQuicklaunch} ""
1072   ;check if user is admin
1073   ClearErrors
1074         UserInfo::GetName
1075         IfErrors info_Win9x
1076         Pop $0
1077         StrCpy $User $0
1078         UserInfo::GetAccountType
1079         Pop $1
1080         StrCmp $1 "Admin" info_done
1082         MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NO_ADMIN)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK info_done IDCANCEL +1
1083                 Quit
1084                 
1085         Goto info_done
1087         info_Win9x:
1088                 # This one means you don't need to care about admin or
1089                 # not admin because Windows 9x doesn't either
1090                 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NOT_SUPPORTED)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK info_done IDCANCEL +1
1091                         Quit
1092                         
1093         info_done:
1095   ;check for previous installation
1096   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
1097   StrCmp $0 "" +1 +2
1098   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
1099   ;check user if applicable
1100   StrCmp $0 "" diff_user_install_done
1101     StrCmp $0 $User diff_user_install_done
1102           MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK diff_user_install_done IDCANCEL +1
1103                 Quit
1104    diff_user_install_done:
1105           
1106   ; call uninstall first
1107   ; code taken from the vlc project
1108     ReadRegStr $R0  HKLM ${PRODUCT_UNINST_KEY} "UninstallString"
1109         ReadRegStr $R1  HKLM ${PRODUCT_UNINST_KEY} "DisplayName"
1110         StrCmp $R0 "" +1 +3
1111     ReadRegStr $R0  HKCU ${PRODUCT_UNINST_KEY} "UninstallString"
1112         ReadRegStr $R1  HKCU ${PRODUCT_UNINST_KEY} "DisplayName"
1113         StrCmp $R0 "" uninstall_before_done
1114          
1115           MessageBox MB_YESNO|MB_ICONEXCLAMATION $(lng_WANT_UNINSTALL_BEFORE) /SD IDNO IDYES +1 IDNO uninstall_before_done 
1116           ;Run the uninstaller
1117           ;uninst:
1118             ClearErrors
1119             ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
1120           uninstall_before_done:
1121           
1122   ; proccess command line parameter
1123   !insertmacro Parameter "GTK" ${SecGTK}
1124   !insertmacro Parameter "SHORTCUTS" ${secShortcuts}
1125   !insertmacro Parameter "ALLUSER" ${SecAlluser}
1126   !insertmacro Parameter "DESKTOP" ${SecDesktop}
1127   !insertmacro Parameter "QUICKLAUNCH" ${SecQUICKlaunch}
1128   !insertmacro Parameter "SVGEDITOR" ${SecSVGWriter}
1129   !insertmacro Parameter "CONTEXTMENUE" ${SecContextMenu}
1130   !insertmacro Parameter "PREFERENCES" ${SecPrefs}
1131   !insertmacro Parameter "ADDFILES" ${SecAddfiles}
1132   !insertmacro Parameter "EXAMPLES" ${SecExamples}
1133   !insertmacro Parameter "TUTORIALS" ${SecTutorials}
1134   !insertmacro Parameter "LANGUAGES" ${SecLanguages}
1135   !insertmacro Parameter "am" ${SecAmharic}
1136   !insertmacro Parameter "az" ${SecAzerbaijani}
1137   !insertmacro Parameter "be" ${SecByelorussian}
1138   !insertmacro Parameter "bg" ${SecBulgarian}
1139   !insertmacro Parameter "bn" ${SecBengali}
1140   !insertmacro Parameter "ca" ${SecCatalan}
1141   !insertmacro Parameter "cs" ${SecCzech}
1142   !insertmacro Parameter "da" ${SecDanish}
1143   !insertmacro Parameter "de" ${SecGerman}
1144   !insertmacro Parameter "dz" ${SecDzongkha}
1145   !insertmacro Parameter "el" ${SecGreek}
1146   !insertmacro Parameter "en_AU" ${SecEnglishAustralian}
1147   !insertmacro Parameter "en_CA" ${SecEnglishCanadian}
1148   !insertmacro Parameter "en_GB" ${SecEnglishBritain}
1149   !insertmacro Parameter "en_US@piglatin" ${SecEnglishPiglatin}
1150   !insertmacro Parameter "eo" ${SecEsperanto}
1151   !insertmacro Parameter "es" ${SecSpanish}
1152   !insertmacro Parameter "es_MX" ${SecSpanishMexico}
1153   !insertmacro Parameter "et" ${SecEstonian}
1154   !insertmacro Parameter "eu" ${SecBasque}
1155   !insertmacro Parameter "fi" ${SecFinnish}
1156   !insertmacro Parameter "fr" ${SecFrench}
1157   !insertmacro Parameter "ga" ${SecIrish}
1158   !insertmacro Parameter "gl" ${SecGallegan}
1159   !insertmacro Parameter "he" ${SecHebrew}
1160   !insertmacro Parameter "hr" ${SecCroatian}
1161   !insertmacro Parameter "hu" ${SecHungarian}
1162   !insertmacro Parameter "id" ${SecIndonesian}
1163   !insertmacro Parameter "it" ${SecItalian}
1164   !insertmacro Parameter "ja" ${SecJapanese}
1165   !insertmacro Parameter "km" ${SecKhmer}
1166   !insertmacro Parameter "ko" ${SecKorean}
1167   !insertmacro Parameter "lt" ${SecLithuanian}
1168   !insertmacro Parameter "mk" ${SecMacedonian}
1169   !insertmacro Parameter "mn" ${SecMongolian}
1170   !insertmacro Parameter "nb" ${SecNorwegianBokmal}
1171   !insertmacro Parameter "ne" ${SecNepali}
1172   !insertmacro Parameter "nl" ${SecDutch}
1173   !insertmacro Parameter "nn" ${SecNorwegianNynorsk}
1174   !insertmacro Parameter "pa" ${SecPanjabi}
1175   !insertmacro Parameter "pl" ${SecPolish}
1176   !insertmacro Parameter "pt" ${SecPortuguese}
1177   !insertmacro Parameter "pt_BR" ${SecPortugueseBrazil}
1178   !insertmacro Parameter "ro" ${SecRomanian}
1179   !insertmacro Parameter "ru" ${SecRussian}
1180   !insertmacro Parameter "rw" ${SecKinyarwanda}
1181   !insertmacro Parameter "sk" ${SecSlovak}
1182   !insertmacro Parameter "sl" ${SecSlovenian}
1183   !insertmacro Parameter "sq" ${SecAlbanian}
1184   !insertmacro Parameter "sr" ${SecSerbian}
1185   !insertmacro Parameter "sr@Latn" ${SecSerbianLatin}
1186   !insertmacro Parameter "sv" ${SecSwedish}
1187   !insertmacro Parameter "th" ${SecThai}
1188   !insertmacro Parameter "tr" ${SecTurkish}
1189   !insertmacro Parameter "uk" ${SecUkrainian}
1190   !insertmacro Parameter "vi" ${SecVietnamese}
1191   !insertmacro Parameter "zh_CN" ${SecChineseSimplified}
1192   !insertmacro Parameter "zh_TW" ${SecChineseTaiwan}
1193   
1194   Push "?"
1195   Push "TEST"
1196   Call GetParameterValue
1197   Pop $1
1198   StrCmp $1 "TEST" +3
1199     MessageBox MB_OK "possible parameters for installer:$\r$\n \
1200       /?: this help screen$\r$\n \
1201       /S: silent$\r$\n \
1202       /D=(directory): where to install inkscape$\r$\n \
1203       /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
1204       /SHORTCUTS=(OFF/ON): shortcuts to start inkscape$\r$\n \
1205       /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
1206       /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
1207       /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
1208       /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
1209       /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
1210       /PREFERENCES=(OFF/ON): delete users preference files$\r$\n \
1211       /ADDFILES=(OFF/ON): additional files$\r$\n \
1212       /EXAMPLES=(OFF/ON): examples$\r$\n \
1213       /TUTORIALS=(OFF/ON): tutorials$\r$\n \
1214       /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
1215       /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
1216     Abort
1217 FunctionEnd
1219 Function .onSelChange
1220 FunctionEnd
1223 Function .onInstSuccess
1224   ;create/update log always within .onInstSuccess function
1225   !insertmacro UNINSTALL.LOG_UPDATE_INSTALL
1226 FunctionEnd
1228 ; --------------------------------------------------
1230 Function un.CustomPageUninstall
1231   !insertmacro MUI_HEADER_TEXT "$(lng_UInstOpt)" "$(lng_UInstOpt1)"
1232   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 1" "Text" "$APPDATA\Inkscape\"
1233   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 2" "Text" "$(lng_PurgePrefs)"
1235   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall"
1236   !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State"
1237   DetailPrint "keepfiles = $MultiUser" 
1238           ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1240 FunctionEnd
1243 Function un.onInit
1244   ;begin uninstall, could be added on top of uninstall section instead
1245   !insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
1247   ClearErrors
1248   StrCpy $User ""
1249         UserInfo::GetName
1250         IfErrors +3
1251         Pop $0
1252         StrCpy $User $0
1254   StrCpy $askMultiUser "1"
1255   StrCpy $MultiUser "1"
1256  
1257   ; Test if this was a multiuser installation
1258   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" ""
1259   StrCmp $0  "$INSTDIR\inkscape.exe" 0 hkcu_user_uninstall  
1260     ReadRegStr $MultiUser HKLM "${PRODUCT_DIR_REGKEY}" "MultiUser"
1261     ReadRegStr $askMultiUser HKLM "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1262         ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
1263         Goto check_user_uninstall
1264   hkcu_user_uninstall:
1265   ReadRegStr $MultiUser HKCU "${PRODUCT_DIR_REGKEY}" "MultiUser"
1266   ReadRegStr $askMultiUser HKCU "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1267   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
1268   ;check user if applicable
1269   check_user_uninstall:
1270   StrCmp $0 "" diff_user_uninstall_done
1271         StrCmp $0 $User diff_user_uninstall_done
1272           MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK diff_user_uninstall_done IDCANCEL +1
1273                 Quit
1274   diff_user_uninstall_done:
1275     
1276  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "inkscape.nsi.uninstall"
1278  ;check whether Multi user installation ?
1279  SetShellVarContext all
1280  StrCmp $MultiUser "0" 0 +2 
1281  SetShellVarContext current
1282  ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1283    
1284 FunctionEnd
1286 Section Uninstall
1288   ; remove personal settings
1289   Delete "$APPDATA\Inkscape\extension-errors.log"
1290   StrCmp $MultiUser "0" 0 endPurge  ; multiuser assigned in dialog
1291     DetailPrint "purge personal settings in $APPDATA\Inkscape"
1292     ;RMDir /r "$APPDATA\Inkscape"
1293         !insertmacro delprefs
1294   endPurge:
1296   ; Remove file associations for svg editor
1297   DetailPrint "removing file associations for svg editor"
1298   ClearErrors
1299   ReadRegStr $0 HKCR ".svg" ""
1300   DetailPrint ".svg associated as $0"
1301   IfErrors endUninstSVGEdit  
1302     ReadRegStr $1 HKCR "$0\shell\edit\command" ""
1303         IfErrors 0 +2  
1304       DetailPrint "svg editor is $1"
1305     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1306       DetailPrint "removing default .svg editor"
1307       DeleteRegKey HKCR "$0\shell\edit\command"
1308     DeleteRegKey /ifempty HKCR "$0\shell\edit"
1309     DeleteRegKey /ifempty HKCR "$0\shell"
1310     DeleteRegKey /ifempty HKCR "$0"
1311   endUninstSVGEdit:
1312   
1313   ClearErrors
1314   ReadRegStr $2 HKCR ".svgz" ""
1315   DetailPrint ".svgz associated as $2"
1316   IfErrors endUninstSVGZEdit  
1317     ReadRegStr $3 HKCR "$2\shell\edit\command" ""
1318     IfErrors 0 +2  
1319       DetailPrint "svgz editor is $1"
1320     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1321       DetailPrint "removing default .svgz editor"
1322       DeleteRegKey HKCR "$2\shell\edit\command"
1323     DeleteRegKey /ifempty HKCR "$2\shell\edit"
1324     DeleteRegKey /ifempty HKCR "$2\shell"
1325     DeleteRegKey /ifempty HKCR "$2"
1326   endUninstSVGZEdit:
1327   
1328   ; Remove file associations for svg editor
1329   DetailPrint "removing file associations for svg editor"
1330   ClearErrors
1331   ReadRegStr $0 HKCR ".svg" ""
1332   IfErrors endUninstSVGView
1333     ReadRegStr $1 HKCR "$0\shell\open\command" ""
1334     IfErrors 0 +2  
1335       DetailPrint "svg viewer is $1"
1336     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1337       DetailPrint "removing default .svg viewer"
1338       DeleteRegKey HKCR "$0\shell\open\command"
1339     DeleteRegKey /ifempty HKCR "$0\shell\open"
1340     DeleteRegKey /ifempty HKCR "$0\shell"
1341     DeleteRegKey /ifempty HKCR "$0"
1342   endUninstSVGView:
1343   
1344   ClearErrors
1345   ReadRegStr $2 HKCR ".svgz" ""
1346   IfErrors endUninstSVGZView
1347     ReadRegStr $3 HKCR "$2\shell\open\command" ""
1348     IfErrors 0 +2  
1349       DetailPrint "svgz viewer is $1"
1350     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1351       DetailPrint "removing default .svgz viewer"
1352       DeleteRegKey HKCR "$2\shell\open\command"
1353     DeleteRegKey /ifempty HKCR "$2\shell\open"
1354     DeleteRegKey /ifempty HKCR "$2\shell"
1355     DeleteRegKey /ifempty HKCR "$2"
1356   endUninstSVGZView:
1357   
1358   ; Remove file associations for context menue
1359   DetailPrint "removing file associations for svg editor"
1360   ClearErrors
1361   ReadRegStr $0 HKCR ".svg" ""
1362   IfErrors endUninstSVGContext
1363   DetailPrint "removing default .svg context menue"
1364   DeleteRegKey HKCR "$0\shell\${PRODUCT_NAME}"
1365   DeleteRegKey /ifempty HKCR "$0\shell"
1366   DeleteRegKey /ifempty HKCR "$0"
1367   endUninstSVGContext:
1368   
1369   ClearErrors
1370   ReadRegStr $2 HKCR ".svgz" ""
1371   IfErrors endUninstSVGZContext
1372   DetailPrint "removing default .svgzcontext menue"
1373   DeleteRegKey HKCR "$2\shell\${PRODUCT_NAME}"
1374   DeleteRegKey /ifempty HKCR "$2\shell"
1375   DeleteRegKey /ifempty HKCR "$2"
1376   endUninstSVGZContext:
1378   ReadRegStr $1 HKCR "$0" ""
1379   StrCmp $1 "" 0 +3
1380     DetailPrint "removing filetype .svg $0"
1381     DeleteRegKey HKCR ".svg"
1382   
1383   ReadRegStr $3 HKCR "$2" ""
1384   StrCmp $3 "" 0 +3
1385     DetailPrint "removing filetype .svgz $2"
1386     DeleteRegKey HKCR ".svgz"
1387   
1388     
1389   SetShellVarContext all
1390   DetailPrint "removing product regkey"
1391   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1392   DetailPrint "removing uninstall info"
1393   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1394   DetailPrint "removing shortcuts"
1395   Delete "$DESKTOP\Inkscape.lnk"
1396   Delete "$QUICKLAUNCH\Inkscape.lnk"
1397   Delete "$SMPROGRAMS\Inkscape.lnk"
1398   ;just in case they are still there
1399   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1400   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1401   RMDir  "$SMPROGRAMS\Inkscape"
1403   SetShellVarContext current
1404   DetailPrint "removing product regkey"
1405   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1406   DetailPrint "removing uninstall info"
1407   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1408   DetailPrint "removing shortcuts"
1409   Delete "$DESKTOP\Inkscape.lnk"
1410   Delete "$QUICKLAUNCH\Inkscape.lnk"
1411   Delete "$SMPROGRAMS\Inkscape.lnk"
1412   ;just in case they are still there
1413   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1414   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1415   RMDir  "$SMPROGRAMS\Inkscape"
1417   DetailPrint "removing uninstall info"
1419   ;uninstall from path, must be repeated for every install logged path individual
1420   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\lib\locale"
1421   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\locale"
1422   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\doc"
1423   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\tutorials"
1424   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\templates"
1425   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\screens"
1426   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\clipart"
1427   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\extensions"
1428   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\icons"
1429   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share"
1430   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\modules"
1431   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\python"
1432   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR"
1434   ;end uninstall, after uninstall from all logged paths has been performed
1435   !insertmacro UNINSTALL.LOG_END_UNINSTALL
1437   ;RMDir /r "$INSTDIR"
1439   SetAutoClose false
1441 SectionEnd