Code

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