Code

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