Code

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