Code

installer remembers installed files and uninstaller does not delete user files
[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}" "InstallLocation" "$INSTDIR"
1008   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
1009   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0"
1010   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
1011   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" "1"
1012   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" "1"
1013   IfErrors 0 +2
1014     DetailPrint "fatal: failed to write to registry un-installation info"
1015 SectionEnd
1016  
1017 ; Last the Descriptions
1018 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
1019   !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(lng_CoreDesc)
1020   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} $(lng_GTKFilesDesc)
1021   !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(lng_ShortcutsDesc)
1022   !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} $(lng_AlluserDesc) 
1023   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(lng_DesktopDesc)
1024   !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} $(lng_QuicklaunchDesc)
1025   !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} $(lng_SVGWriterDesc)
1026   !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} $(lng_ContextMenuDesc)
1027   !insertmacro MUI_DESCRIPTION_TEXT ${SecPrefs} $(lng_DeletePrefsDesc)
1028   !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} $(lng_AddfilesDesc)
1029   !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} $(lng_ExamplesDesc)
1030   !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} $(lng_TutorialsDesc)
1031   !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(lng_LanguagesDesc)
1032 !insertmacro MUI_FUNCTION_DESCRIPTION_END
1034 !macro Parameter key Section
1035   Push ${key}
1036   Push ""
1037   Call GetParameterValue
1038   Pop $1
1039   StrCmp $1 "OFF" 0 +5
1040     SectionGetFlags ${Section} $0
1041     IntOp $2 ${SF_SELECTED} ~
1042     IntOp $0 $0 & $2
1043     SectionSetFlags ${Section} $0
1044   StrCmp $1 "ON" 0 +4
1045     SectionGetFlags ${Section} $0
1046     IntOp $0 $0 | ${SF_SELECTED}
1047     SectionSetFlags ${Section} $0
1048 !macroend
1050 Function .onInit
1051   ;prepare log always within .onInit function
1052   !insertmacro UNINSTALL.LOG_PREPARE_INSTALL
1054   ;Extract InstallOptions INI files
1055   StrCpy $AskMultiUser "1"
1056   StrCpy $MultiUser "0"
1057   ; this resets AskMultiUser if Win95/98/ME
1058   Call GetWindowsVersion
1059   Pop $R0
1060   DetailPrint "detected operating system $R0"
1061   ;MessageBox MB_OK "operating system: $R0; AskMultiuser: $AskMultiUser"
1062   
1063   ; hide all user section if win98
1064   StrCmp $AskMultiUser "1" +2
1065     SectionSetText ${SecAlluser} ""
1067   ; hide if quick launch if not available
1068   StrCmp $QUICKLAUNCH $TEMP 0 +2
1069     SectionSetText ${SecQuicklaunch} ""
1071   ;check if user is admin
1072   ClearErrors
1073         UserInfo::GetName
1074         IfErrors info_Win9x
1075         Pop $0
1076         StrCpy $User $0
1077         UserInfo::GetAccountType
1078         Pop $1
1079         StrCmp $1 "Admin" info_done
1081         MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NO_ADMIN)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK info_done IDCANCEL +1
1082                 Quit
1083                 
1084         Goto info_done
1086         info_Win9x:
1087                 # This one means you don't need to care about admin or
1088                 # not admin because Windows 9x doesn't either
1089                 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NOT_SUPPORTED)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK info_done IDCANCEL +1
1090                         Quit
1091                         
1092         info_done:
1094   ;check for previous installation
1095   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
1096   StrCmp $0 "" +1 +2
1097   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
1098   ;check user if applicable
1099   StrCmp $0 "" diff_user_install_done
1100     StrCmp $0 $User diff_user_install_done
1101           MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK diff_user_install_done IDCANCEL +1
1102                 Quit
1103    diff_user_install_done:
1104           
1105   ; call uninstall first
1106   ; code taken from the vlc project
1107     ReadRegStr $R0  HKLM ${PRODUCT_UNINST_KEY} "UninstallString"
1108         ReadRegStr $R1  HKLM ${PRODUCT_UNINST_KEY} "DisplayName"
1109         StrCmp $R0 "" +1 +3
1110     ReadRegStr $R0  HKCU ${PRODUCT_UNINST_KEY} "UninstallString"
1111         ReadRegStr $R1  HKCU ${PRODUCT_UNINST_KEY} "DisplayName"
1112         StrCmp $R0 "" uninstall_before_done
1113          
1114           MessageBox MB_YESNO|MB_ICONEXCLAMATION $(lng_WANT_UNINSTALL_BEFORE) /SD IDNO IDYES +1 IDNO uninstall_before_done 
1115           ;Run the uninstaller
1116           ;uninst:
1117             ClearErrors
1118             ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
1119           uninstall_before_done:
1120           
1121   ; proccess command line parameter
1122   !insertmacro Parameter "GTK" ${SecGTK}
1123   !insertmacro Parameter "SHORTCUTS" ${secShortcuts}
1124   !insertmacro Parameter "ALLUSER" ${SecAlluser}
1125   !insertmacro Parameter "DESKTOP" ${SecDesktop}
1126   !insertmacro Parameter "QUICKLAUNCH" ${SecQUICKlaunch}
1127   !insertmacro Parameter "SVGEDITOR" ${SecSVGWriter}
1128   !insertmacro Parameter "CONTEXTMENUE" ${SecContextMenu}
1129   !insertmacro Parameter "PREFERENCES" ${SecPrefs}
1130   !insertmacro Parameter "ADDFILES" ${SecAddfiles}
1131   !insertmacro Parameter "EXAMPLES" ${SecExamples}
1132   !insertmacro Parameter "TUTORIALS" ${SecTutorials}
1133   !insertmacro Parameter "LANGUAGES" ${SecLanguages}
1134   !insertmacro Parameter "am" ${SecAmharic}
1135   !insertmacro Parameter "az" ${SecAzerbaijani}
1136   !insertmacro Parameter "be" ${SecByelorussian}
1137   !insertmacro Parameter "bg" ${SecBulgarian}
1138   !insertmacro Parameter "bn" ${SecBengali}
1139   !insertmacro Parameter "ca" ${SecCatalan}
1140   !insertmacro Parameter "cs" ${SecCzech}
1141   !insertmacro Parameter "da" ${SecDanish}
1142   !insertmacro Parameter "de" ${SecGerman}
1143   !insertmacro Parameter "dz" ${SecDzongkha}
1144   !insertmacro Parameter "el" ${SecGreek}
1145   !insertmacro Parameter "en_AU" ${SecEnglishAustralian}
1146   !insertmacro Parameter "en_CA" ${SecEnglishCanadian}
1147   !insertmacro Parameter "en_GB" ${SecEnglishBritain}
1148   !insertmacro Parameter "en_US@piglatin" ${SecEnglishPiglatin}
1149   !insertmacro Parameter "eo" ${SecEsperanto}
1150   !insertmacro Parameter "es" ${SecSpanish}
1151   !insertmacro Parameter "es_MX" ${SecSpanishMexico}
1152   !insertmacro Parameter "et" ${SecEstonian}
1153   !insertmacro Parameter "eu" ${SecBasque}
1154   !insertmacro Parameter "fi" ${SecFinnish}
1155   !insertmacro Parameter "fr" ${SecFrench}
1156   !insertmacro Parameter "ga" ${SecIrish}
1157   !insertmacro Parameter "gl" ${SecGallegan}
1158   !insertmacro Parameter "he" ${SecHebrew}
1159   !insertmacro Parameter "hr" ${SecCroatian}
1160   !insertmacro Parameter "hu" ${SecHungarian}
1161   !insertmacro Parameter "id" ${SecIndonesian}
1162   !insertmacro Parameter "it" ${SecItalian}
1163   !insertmacro Parameter "ja" ${SecJapanese}
1164   !insertmacro Parameter "km" ${SecKhmer}
1165   !insertmacro Parameter "ko" ${SecKorean}
1166   !insertmacro Parameter "lt" ${SecLithuanian}
1167   !insertmacro Parameter "mk" ${SecMacedonian}
1168   !insertmacro Parameter "mn" ${SecMongolian}
1169   !insertmacro Parameter "nb" ${SecNorwegianBokmal}
1170   !insertmacro Parameter "ne" ${SecNepali}
1171   !insertmacro Parameter "nl" ${SecDutch}
1172   !insertmacro Parameter "nn" ${SecNorwegianNynorsk}
1173   !insertmacro Parameter "pa" ${SecPanjabi}
1174   !insertmacro Parameter "pl" ${SecPolish}
1175   !insertmacro Parameter "pt" ${SecPortuguese}
1176   !insertmacro Parameter "pt_BR" ${SecPortugueseBrazil}
1177   !insertmacro Parameter "ro" ${SecRomanian}
1178   !insertmacro Parameter "ru" ${SecRussian}
1179   !insertmacro Parameter "rw" ${SecKinyarwanda}
1180   !insertmacro Parameter "sk" ${SecSlovak}
1181   !insertmacro Parameter "sl" ${SecSlovenian}
1182   !insertmacro Parameter "sq" ${SecAlbanian}
1183   !insertmacro Parameter "sr" ${SecSerbian}
1184   !insertmacro Parameter "sr@Latn" ${SecSerbianLatin}
1185   !insertmacro Parameter "sv" ${SecSwedish}
1186   !insertmacro Parameter "th" ${SecThai}
1187   !insertmacro Parameter "tr" ${SecTurkish}
1188   !insertmacro Parameter "uk" ${SecUkrainian}
1189   !insertmacro Parameter "vi" ${SecVietnamese}
1190   !insertmacro Parameter "zh_CN" ${SecChineseSimplified}
1191   !insertmacro Parameter "zh_TW" ${SecChineseTaiwan}
1192   
1193   Push "?"
1194   Push "TEST"
1195   Call GetParameterValue
1196   Pop $1
1197   StrCmp $1 "TEST" +3
1198     MessageBox MB_OK "possible parameters for installer:$\r$\n \
1199       /?: this help screen$\r$\n \
1200       /S: silent$\r$\n \
1201       /D=(directory): where to install inkscape$\r$\n \
1202       /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
1203       /SHORTCUTS=(OFF/ON): shortcuts to start inkscape$\r$\n \
1204       /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
1205       /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
1206       /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
1207       /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
1208       /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
1209       /PREFERENCES=(OFF/ON): delete users preference files$\r$\n \
1210       /ADDFILES=(OFF/ON): additional files$\r$\n \
1211       /EXAMPLES=(OFF/ON): examples$\r$\n \
1212       /TUTORIALS=(OFF/ON): tutorials$\r$\n \
1213       /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
1214       /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
1215     Abort
1216 FunctionEnd
1218 Function .onSelChange
1219 FunctionEnd
1222 Function .onInstSuccess
1223   ;create/update log always within .onInstSuccess function
1224   !insertmacro UNINSTALL.LOG_UPDATE_INSTALL
1225 FunctionEnd
1227 ; --------------------------------------------------
1229 Function un.CustomPageUninstall
1230   !insertmacro MUI_HEADER_TEXT "$(lng_UInstOpt)" "$(lng_UInstOpt1)"
1231   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 1" "Text" "$APPDATA\Inkscape\"
1232   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 2" "Text" "$(lng_PurgePrefs)"
1234   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall"
1235   !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State"
1236   DetailPrint "keepfiles = $MultiUser" 
1237           ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1239 FunctionEnd
1242 Function un.onInit
1243   ;begin uninstall, could be added on top of uninstall section instead
1244   !insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
1246   ClearErrors
1247   StrCpy $User ""
1248         UserInfo::GetName
1249         IfErrors +3
1250         Pop $0
1251         StrCpy $User $0
1253   StrCpy $askMultiUser "1"
1254   StrCpy $MultiUser "1"
1255  
1256   ; Test if this was a multiuser installation
1257   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" ""
1258   StrCmp $0  "$INSTDIR\inkscape.exe" 0 hkcu_user_uninstall  
1259     ReadRegStr $MultiUser HKLM "${PRODUCT_DIR_REGKEY}" "MultiUser"
1260     ReadRegStr $askMultiUser HKLM "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1261         ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
1262         Goto check_user_uninstall
1263   hkcu_user_uninstall:
1264   ReadRegStr $MultiUser HKCU "${PRODUCT_DIR_REGKEY}" "MultiUser"
1265   ReadRegStr $askMultiUser HKCU "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1266   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
1267   ;check user if applicable
1268   check_user_uninstall:
1269   StrCmp $0 "" diff_user_uninstall_done
1270         StrCmp $0 $User diff_user_uninstall_done
1271           MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK diff_user_uninstall_done IDCANCEL +1
1272                 Quit
1273   diff_user_uninstall_done:
1274     
1275  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "inkscape.nsi.uninstall"
1277  ;check whether Multi user installation ?
1278  SetShellVarContext all
1279  StrCmp $MultiUser "0" 0 +2 
1280  SetShellVarContext current
1281  ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1282    
1283 FunctionEnd
1285 Section Uninstall
1287   ; remove personal settings
1288   Delete "$APPDATA\Inkscape\extension-errors.log"
1289   StrCmp $MultiUser "0" 0 endPurge  ; multiuser assigned in dialog
1290     DetailPrint "purge personal settings in $APPDATA\Inkscape"
1291     ;RMDir /r "$APPDATA\Inkscape"
1292         !insertmacro delprefs
1293   endPurge:
1295   ; Remove file associations for svg editor
1296   DetailPrint "removing file associations for svg editor"
1297   ClearErrors
1298   ReadRegStr $0 HKCR ".svg" ""
1299   DetailPrint ".svg associated as $0"
1300   IfErrors endUninstSVGEdit  
1301     ReadRegStr $1 HKCR "$0\shell\edit\command" ""
1302         IfErrors 0 +2  
1303       DetailPrint "svg editor is $1"
1304     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1305       DetailPrint "removing default .svg editor"
1306       DeleteRegKey HKCR "$0\shell\edit\command"
1307     DeleteRegKey /ifempty HKCR "$0\shell\edit"
1308     DeleteRegKey /ifempty HKCR "$0\shell"
1309     DeleteRegKey /ifempty HKCR "$0"
1310   endUninstSVGEdit:
1311   
1312   ClearErrors
1313   ReadRegStr $2 HKCR ".svgz" ""
1314   DetailPrint ".svgz associated as $2"
1315   IfErrors endUninstSVGZEdit  
1316     ReadRegStr $3 HKCR "$2\shell\edit\command" ""
1317     IfErrors 0 +2  
1318       DetailPrint "svgz editor is $1"
1319     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1320       DetailPrint "removing default .svgz editor"
1321       DeleteRegKey HKCR "$2\shell\edit\command"
1322     DeleteRegKey /ifempty HKCR "$2\shell\edit"
1323     DeleteRegKey /ifempty HKCR "$2\shell"
1324     DeleteRegKey /ifempty HKCR "$2"
1325   endUninstSVGZEdit:
1326   
1327   ; Remove file associations for svg editor
1328   DetailPrint "removing file associations for svg editor"
1329   ClearErrors
1330   ReadRegStr $0 HKCR ".svg" ""
1331   IfErrors endUninstSVGView
1332     ReadRegStr $1 HKCR "$0\shell\open\command" ""
1333     IfErrors 0 +2  
1334       DetailPrint "svg viewer is $1"
1335     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1336       DetailPrint "removing default .svg viewer"
1337       DeleteRegKey HKCR "$0\shell\open\command"
1338     DeleteRegKey /ifempty HKCR "$0\shell\open"
1339     DeleteRegKey /ifempty HKCR "$0\shell"
1340     DeleteRegKey /ifempty HKCR "$0"
1341   endUninstSVGView:
1342   
1343   ClearErrors
1344   ReadRegStr $2 HKCR ".svgz" ""
1345   IfErrors endUninstSVGZView
1346     ReadRegStr $3 HKCR "$2\shell\open\command" ""
1347     IfErrors 0 +2  
1348       DetailPrint "svgz viewer is $1"
1349     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1350       DetailPrint "removing default .svgz viewer"
1351       DeleteRegKey HKCR "$2\shell\open\command"
1352     DeleteRegKey /ifempty HKCR "$2\shell\open"
1353     DeleteRegKey /ifempty HKCR "$2\shell"
1354     DeleteRegKey /ifempty HKCR "$2"
1355   endUninstSVGZView:
1356   
1357   ; Remove file associations for context menue
1358   DetailPrint "removing file associations for svg editor"
1359   ClearErrors
1360   ReadRegStr $0 HKCR ".svg" ""
1361   IfErrors endUninstSVGContext
1362   DetailPrint "removing default .svg context menue"
1363   DeleteRegKey HKCR "$0\shell\${PRODUCT_NAME}"
1364   DeleteRegKey /ifempty HKCR "$0\shell"
1365   DeleteRegKey /ifempty HKCR "$0"
1366   endUninstSVGContext:
1367   
1368   ClearErrors
1369   ReadRegStr $2 HKCR ".svgz" ""
1370   IfErrors endUninstSVGZContext
1371   DetailPrint "removing default .svgzcontext menue"
1372   DeleteRegKey HKCR "$2\shell\${PRODUCT_NAME}"
1373   DeleteRegKey /ifempty HKCR "$2\shell"
1374   DeleteRegKey /ifempty HKCR "$2"
1375   endUninstSVGZContext:
1377   ReadRegStr $1 HKCR "$0" ""
1378   StrCmp $1 "" 0 +3
1379     DetailPrint "removing filetype .svg $0"
1380     DeleteRegKey HKCR ".svg"
1381   
1382   ReadRegStr $3 HKCR "$2" ""
1383   StrCmp $3 "" 0 +3
1384     DetailPrint "removing filetype .svgz $2"
1385     DeleteRegKey HKCR ".svgz"
1386   
1387     
1388   SetShellVarContext all
1389   DetailPrint "removing product regkey"
1390   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1391   DetailPrint "removing uninstall info"
1392   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1393   DetailPrint "removing shortcuts"
1394   Delete "$DESKTOP\Inkscape.lnk"
1395   Delete "$QUICKLAUNCH\Inkscape.lnk"
1396   Delete "$SMPROGRAMS\Inkscape.lnk"
1397   ;just in case they are still there
1398   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1399   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1400   RMDir  "$SMPROGRAMS\Inkscape"
1402   SetShellVarContext current
1403   DetailPrint "removing product regkey"
1404   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1405   DetailPrint "removing uninstall info"
1406   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1407   DetailPrint "removing shortcuts"
1408   Delete "$DESKTOP\Inkscape.lnk"
1409   Delete "$QUICKLAUNCH\Inkscape.lnk"
1410   Delete "$SMPROGRAMS\Inkscape.lnk"
1411   ;just in case they are still there
1412   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1413   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1414   RMDir  "$SMPROGRAMS\Inkscape"
1416   DetailPrint "removing uninstall info"
1418   ;uninstall from path, must be repeated for every install logged path individual
1419   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\lib\locale"
1420   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\locale"
1421   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\doc"
1422   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\tutorials"
1423   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\templates"
1424   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\screens"
1425   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\clipart"
1426   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\extensions"
1427   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\icons"
1428   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share"
1429   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\modules"
1430   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\python"
1431   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR"
1433   ;end uninstall, after uninstall from all logged paths has been performed
1434   !insertmacro UNINSTALL.LOG_END_UNINSTALL
1436   ;RMDir /r "$INSTDIR"
1438   SetAutoClose false
1440 SectionEnd