Code

typo in Product uninst key
[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 /nonfatal /a "..\..\inkscape\HACKING.txt"
571   File /a "..\..\inkscape\README"
572   File /nonfatal /a "..\..\inkscape\README.txt"
573   File /a "..\..\inkscape\TRANSLATORS"
574   File /nonfatal /a /r "..\..\inkscape\data"
575   File /nonfatal /a /r "..\..\inkscape\doc"
576   File /nonfatal /a /r "..\..\inkscape\plugins"
577   File /nonfatal /a /r /x *.??*.???* /x "examples" /x "tutorials" "..\..\inkscape\share"
578   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
579   ; this files are added because it slips through the filter
580   SetOutPath $INSTDIR\share\clipart
581   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
582   File /a "..\..\inkscape\share\clipart\inkscape.logo.svg"
583   ;File /a "..\..\inkscape\share\clipart\inkscape.logo.classic.svg"  
584   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
585   SetOutPath $INSTDIR\share\extensions
586   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
587   File /a "..\..\inkscape\share\extensions\pdf_output.inx.txt"
588   File /a "..\..\inkscape\share\extensions\pdf_output_via_gs_on_win32.inx.txt"
589   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
590   SetOutPath $INSTDIR\share\icons
591   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
592   File /a "..\..\inkscape\share\icons\inkscape.file.png"
593   File /a "..\..\inkscape\share\icons\inkscape.file.svg"
594   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
595   SetOutPath $INSTDIR\modules
596   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
597   File /nonfatal /a /r "..\..\inkscape\modules\*.*"
598   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
599   SetOutPath $INSTDIR\python
600   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
601   File /nonfatal /a /r "..\..\inkscape\python\*.*" 
602   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
603 SectionEnd
605 Section $(lng_GTKFiles) SecGTK
607   DetailPrint "Installing GTK Files ..."
608   
609   SectionIn 1 2 3 RO
610   SetOutPath $INSTDIR
611   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
612   SetOverwrite on
613   File /a /r "..\..\inkscape\*.dll"
614   File /a /r /x "locale" "..\..\inkscape\lib"
615   File /a /r "..\..\inkscape\etc"
616   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
617 SectionEnd
619 Section $(lng_Alluser) SecAlluser
620   ; disable this option in Win95/Win98/WinME
621   SectionIn 1 2 3 
622   StrCpy $MultiUser "1"
623   StrCmp $MultiUser "1" "" SingleUser
624     DetailPrint "admin mode, registry root will be HKLM"
625     SetShellVarContext all
626     Goto endSingleUser
627   SingleUser:
628     DetailPrint "single user mode, registry root will be HKCU"
629     SetShellVarContext current
630   endSingleUser:                
631 SectionEnd
633 SectionGroup $(lng_Shortcuts) SecShortcuts
635 Section /o $(lng_Desktop) SecDesktop
636   ClearErrors
637   CreateShortCut "$DESKTOP\Inkscape.lnk" "$INSTDIR\inkscape.exe"
638   IfErrors 0 +2
639     DetailPrint "Uups! Problems creating desktop shortcuts"
640 SectionEnd
642 Section /o $(lng_Quicklaunch) SecQuicklaunch
643   ClearErrors
644   StrCmp $QUICKLAUNCH $TEMP +2
645     CreateShortCut "$QUICKLAUNCH\Inkscape.lnk" "$INSTDIR\inkscape.exe"
646   IfErrors 0 +2
647     DetailPrint "Uups! Problems creating quicklaunch shortcuts"
648 SectionEnd
650 Section $(lng_SVGWriter) SecSVGWriter 
651   SectionIn 1 2 3
652   ; create file associations, test before if needed
653   DetailPrint "creating file associations"
654   ClearErrors
655   ReadRegStr $0 HKCR ".svg" ""
656   StrCmp $0 "" 0 +3
657     WriteRegStr HKCR ".svg" "" "svgfile"
658     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
659   ReadRegStr $0 HKCR ".svgz" ""
660   StrCmp $0 "" 0 +3
661     WriteRegStr HKCR ".svgz" "" "svgfile"
662     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
663   IfErrors 0 +2
664     DetailPrint "Uups! Problems creating file assoziations for svg writer"
665   
666   DetailPrint "creating default editor"
667   ClearErrors
668   ReadRegStr $0 HKCR ".svg" ""
669   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
670   ReadRegStr $0 HKCR ".svgz" ""
671   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
672   IfErrors 0 +2
673     DetailPrint "Uups! Problems creating default editor"
674 SectionEnd
676 Section $(lng_ContextMenu) SecContextMenu
677   SectionIn 1 2 3
678   ; create file associations, test before if needed
679   DetailPrint "creating file associations"
680   ClearErrors
681   ReadRegStr $0 HKCR ".svg" ""
682   StrCmp $0 "" 0 +3
683     WriteRegStr HKCR ".svg" "" "svgfile"
684     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
685   ReadRegStr $0 HKCR ".svgz" ""
686   StrCmp $0 "" 0 +3
687     WriteRegStr HKCR ".svgz" "" "svgfile"
688     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
689   IfErrors 0 +2
690     DetailPrint "Uups! Problems creating file assoziations for context menu"
691   
692   DetailPrint "creating context menue"
693   ClearErrors
694   ReadRegStr $0 HKCR ".svg" ""
695   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
696   ReadRegStr $0 HKCR ".svgz" ""
697   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
698   IfErrors 0 +2
699     DetailPrint "Uups! Problems creating context menue integration"
701 SectionEnd
703 SectionGroupEnd
705 Section /o $(lng_DeletePrefs) SecPrefs
706         !insertmacro delprefs
707 SectionEnd
709 SectionGroup $(lng_Addfiles) SecAddfiles
711 Section $(lng_Examples) SecExamples
712   SectionIn 1 2
713   SetOutPath $INSTDIR\share
714   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
715   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\examples"
716   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
717 SectionEnd
719 Section $(lng_Tutorials) SecTutorials
720   SectionIn 1 2
721   SetOutPath $INSTDIR\share
722   !insertmacro UNINSTALL.LOG_OPEN_INSTALL
723   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\tutorials"
724   !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
725 SectionEnd
727 SectionGroupEnd
729 SectionGroup /e $(lng_Languages) SecLanguages
731 Section $(lng_am) SecAmharic
732   !insertmacro Language am am
733 SectionEnd
735 Section $(lng_az) SecAzerbaijani
736   !insertmacro Language az az
737 SectionEnd
739 Section $(lng_be) SecByelorussian
740   !insertmacro Language be be
741 SectionEnd
743 Section $(lng_bg) SecBulgarian
744   !insertmacro Language bg bg
745 SectionEnd
747 Section $(lng_bn) SecBengali
748   !insertmacro Language bn bn
749 SectionEnd
751 Section $(lng_ca) SecCatalan
752   !insertmacro Language ca ca
753 SectionEnd
755 Section $(lng_cs) SecCzech
756   !insertmacro Language cs cs
757 SectionEnd
759 Section $(lng_da) SecDanish
760   !insertmacro Language da da
761 SectionEnd
763 Section $(lng_de) SecGerman
764   !insertmacro Language 'de' 'de'
765 SectionEnd
767 Section $(lng_dz) SecDzongkha
768   !insertmacro Language dz dz
769 SectionEnd
771 Section $(lng_el) SecGreek
772   !insertmacro Language el el
773 SectionEnd
775 Section $(lng_en) SecEnglish
776   SectionIn 1 2 3 RO
777 SectionEnd
779 Section $(lng_en_AU) SecEnglishAustralian
780   !insertmacro Language en_AU en_AU
781 SectionEnd
783 Section $(lng_en_CA) SecEnglishCanadian
784   !insertmacro Language en_CA en_CA
785 SectionEnd
787 Section $(lng_en_GB) SecEnglishBritain
788   !insertmacro Language en_GB en_GB
789 SectionEnd
791 Section $(lng_en_US@piglatin) SecEnglishPiglatin
792   !insertmacro Language en_US@piglatin en_US@Piglatin
793 SectionEnd
795 Section $(lng_eo) SecEsperanto
796   !insertmacro Language eo eo
797 SectionEnd
799 Section $(lng_es) SecSpanish
800   !insertmacro Language 'es' 'es'
801 SectionEnd
803 Section $(lng_es_MX) SecSpanishMexico
804   !insertmacro Language 'es_MX' 'es_MX'
805 SectionEnd
807 Section $(lng_et) SecEstonian
808   !insertmacro Language et et
809 SectionEnd
811 Section $(lng_eu) SecBasque
812   !insertmacro Language eu eu
813 SectionEnd
815 Section $(lng_fr) SecFrench
816   !insertmacro Language 'fr' 'fr'
817 SectionEnd
819 Section $(lng_fi) SecFinnish
820   !insertmacro Language 'fi' 'fi'
821 SectionEnd
823 Section $(lng_ga) SecIrish
824   !insertmacro Language ga ga
825 SectionEnd
827 Section $(lng_gl) SecGallegan
828   !insertmacro Language gl gl
829   SectionIn 1 2 3
830 SectionEnd
832 Section $(lng_he) SecHebrew
833   !insertmacro Language he he
834   SectionIn 1 2 3
835 SectionEnd
837 Section $(lng_hr) SecCroatian
838   !insertmacro Language hr hr
839   SectionIn 1 2 3
840 SectionEnd
842 Section $(lng_hu) SecHungarian
843   !insertmacro Language hu hu
844   SectionIn 1 2 3
845 SectionEnd
847 Section $(lng_id) SecIndonesian
848   !insertmacro Language id id
849   SectionIn 1 2 3
850 SectionEnd
852 Section $(lng_it) SecItalian
853   !insertmacro Language it it
854   SectionIn 1 2 3
855 SectionEnd
857 Section $(lng_ja) SecJapanese
858   !insertmacro Language 'ja' 'jp'
859 SectionEnd
861 Section $(lng_km) SecKhmer
862   !insertmacro Language km km
863 SectionEnd
865 Section $(lng_ko) SecKorean
866   !insertmacro Language 'ko' 'ko'
867 SectionEnd
869 Section $(lng_lt) SecLithuanian
870   !insertmacro Language 'lt' 'lt'
871 SectionEnd
873 Section $(lng_mn) SecMongolian
874   !insertmacro Language mn mn
875 SectionEnd
877 Section $(lng_mk) SecMacedonian
878   !insertmacro Language mk mk
879 SectionEnd
881 Section $(lng_nb) SecNorwegianBokmal
882   !insertmacro Language nb nb
883 SectionEnd
885 Section $(lng_ne) SecNepali
886   !insertmacro Language ne ne
887 SectionEnd
889 Section $(lng_nl) SecDutch
890   !insertmacro Language nl nl
891 SectionEnd
893 Section $(lng_nn) SecNorwegianNynorsk
894   !insertmacro Language nn nn
895 SectionEnd
897 Section $(lng_pa) SecPanjabi
898   !insertmacro Language pa pa
899 SectionEnd
901 Section $(lng_pl) SecPolish
902   !insertmacro Language pl pl
903 SectionEnd
905 Section $(lng_pt) SecPortuguese
906   !insertmacro Language pt pt
907 SectionEnd
909 Section $(lng_pt_BR) SecPortugueseBrazil
910   !insertmacro Language pt_BR pt_BR
911 SectionEnd
913 Section $(lng_ro) SecRomanian
914   !insertmacro Language ro ro
915 SectionEnd
917 Section $(lng_ru) SecRussian
918   !insertmacro Language ru ru
919 SectionEnd
921 Section $(lng_rw) SecKinyarwanda
922   !insertmacro Language rw rw
923 SectionEnd
925 Section $(lng_sk) SecSlovak
926   !insertmacro Language sk sk
927 SectionEnd
929 Section $(lng_sl) SecSlovenian
930   !insertmacro Language sl sl
931 SectionEnd
933 Section $(lng_sq) SecAlbanian
934   !insertmacro Language sq sq
935 SectionEnd
937 Section $(lng_sr) SecSerbian
938   !insertmacro Language sr sr
939 SectionEnd
941 Section $(lng_sr@Latn) SecSerbianLatin
942   !insertmacro Language 'sr@Latn' 'sr@Latn'
943 SectionEnd
945 Section $(lng_sv) SecSwedish
946   !insertmacro Language sv sv
947 SectionEnd
949 Section $(lng_th) SecThai
950   !insertmacro Language th th
951 SectionEnd
953 Section $(lng_tr) SecTurkish
954   !insertmacro Language tr tr
955 SectionEnd
957 Section $(lng_uk) SecUkrainian
958   !insertmacro Language uk uk
959 SectionEnd
961 Section $(lng_vi) SecVietnamese
962   !insertmacro Language vi vi
963 SectionEnd
965 Section $(lng_zh_CN) SecChineseSimplified
966   !insertmacro Language zh_CN zh_CN
967 SectionEnd
969 Section $(lng_zh_TW) SecChineseTaiwan
970   !insertmacro Language zh_TW zh_TW
971 SectionEnd
973 SectionGroupEnd
976 Section -FinalizeInstallation
977   StrCmp $MultiUser "1" "" SingleUser
978     DetailPrint "admin mode, registry root will be HKLM"
979     SetShellVarContext all
980     Goto endSingleUser
981   SingleUser:
982     DetailPrint "single user mode, registry root will be HKCU"
983     SetShellVarContext current
984   endSingleUser:                
986   ; check for writing registry
987   ClearErrors
988   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inkscape.exe"  
989   ;IfErrors 0 +4
990   ;  DetailPrint "fatal: failed to write to ${PRODUCT_DIR_REGKEY}"
991   ;  DetailPrint "aborting installation"
992   ;     Abort
993   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "MultiUser" "$MultiUser"  
994   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "askMultiUser" "$askMultiUser"
995   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "User" "$User"
996   IfErrors 0 +2
997     DetailPrint "fatal: failed to write to registry installation info"
999   ; start menu entries
1000   ClearErrors
1001   CreateShortCut "$SMPROGRAMS\Inkscape.lnk" "$INSTDIR\inkscape.exe"
1002   IfErrors 0 +2
1003     DetailPrint "fatal: failed to write to start menu info"
1005   ; uninstall settings
1006   ClearErrors
1007   ; WriteUninstaller "$INSTDIR\uninst.exe"
1008   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\${UNINST_EXE}"
1009   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallDir" "$INSTDIR"
1010   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
1011   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
1012   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0"
1013   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
1014   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" "1"
1015   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" "1"
1016   IfErrors 0 +2
1017     DetailPrint "fatal: failed to write to registry un-installation info"
1018 SectionEnd
1019  
1020 ; Last the Descriptions
1021 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
1022   !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(lng_CoreDesc)
1023   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} $(lng_GTKFilesDesc)
1024   !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(lng_ShortcutsDesc)
1025   !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} $(lng_AlluserDesc) 
1026   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(lng_DesktopDesc)
1027   !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} $(lng_QuicklaunchDesc)
1028   !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} $(lng_SVGWriterDesc)
1029   !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} $(lng_ContextMenuDesc)
1030   !insertmacro MUI_DESCRIPTION_TEXT ${SecPrefs} $(lng_DeletePrefsDesc)
1031   !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} $(lng_AddfilesDesc)
1032   !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} $(lng_ExamplesDesc)
1033   !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} $(lng_TutorialsDesc)
1034   !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(lng_LanguagesDesc)
1035 !insertmacro MUI_FUNCTION_DESCRIPTION_END
1037 !macro Parameter key Section
1038   Push ${key}
1039   Push ""
1040   Call GetParameterValue
1041   Pop $1
1042   StrCmp $1 "OFF" 0 +5
1043     SectionGetFlags ${Section} $0
1044     IntOp $2 ${SF_SELECTED} ~
1045     IntOp $0 $0 & $2
1046     SectionSetFlags ${Section} $0
1047   StrCmp $1 "ON" 0 +4
1048     SectionGetFlags ${Section} $0
1049     IntOp $0 $0 | ${SF_SELECTED}
1050     SectionSetFlags ${Section} $0
1051 !macroend
1053 Function .onInit
1054   ;prepare log always within .onInit function
1055   !insertmacro UNINSTALL.LOG_PREPARE_INSTALL
1057   ;Extract InstallOptions INI files
1058   StrCpy $AskMultiUser "1"
1059   StrCpy $MultiUser "0"
1060   ; this resets AskMultiUser if Win95/98/ME
1061   Call GetWindowsVersion
1062   Pop $R0
1063   DetailPrint "detected operating system $R0"
1064   ;MessageBox MB_OK "operating system: $R0; AskMultiuser: $AskMultiUser"
1065   
1066   ; hide all user section if win98
1067   StrCmp $AskMultiUser "1" +2
1068     SectionSetText ${SecAlluser} ""
1070   ; hide if quick launch if not available
1071   StrCmp $QUICKLAUNCH $TEMP 0 +2
1072     SectionSetText ${SecQuicklaunch} ""
1074   ;check if user is admin
1075   ClearErrors
1076         UserInfo::GetName
1077         IfErrors info_Win9x
1078         Pop $0
1079         StrCpy $User $0
1080         UserInfo::GetAccountType
1081         Pop $1
1082         StrCmp $1 "Admin" info_done
1084         MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NO_ADMIN)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK info_done IDCANCEL +1
1085                 Quit
1086                 
1087         Goto info_done
1089         info_Win9x:
1090                 # This one means you don't need to care about admin or
1091                 # not admin because Windows 9x doesn't either
1092                 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NOT_SUPPORTED)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK info_done IDCANCEL +1
1093                         Quit
1094                         
1095         info_done:
1097   ;check for previous installation
1098   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
1099   StrCmp $0 "" +1 +2
1100   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
1101   ;check user if applicable
1102   StrCmp $0 "" diff_user_install_done
1103     StrCmp $0 $User diff_user_install_done
1104           MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK diff_user_install_done IDCANCEL +1
1105                 Quit
1106    diff_user_install_done:
1107           
1108   ; call uninstall first
1109   ; code taken from the vlc project
1110     ReadRegStr $R0  HKLM ${PRODUCT_UNINST_KEY} "UninstallString"
1111         ReadRegStr $R1  HKLM ${PRODUCT_UNINST_KEY} "DisplayName"
1112         StrCmp $R0 "" +1 +3
1113     ReadRegStr $R0  HKCU ${PRODUCT_UNINST_KEY} "UninstallString"
1114         ReadRegStr $R1  HKCU ${PRODUCT_UNINST_KEY} "DisplayName"
1115         StrCmp $R0 "" uninstall_before_done
1116          
1117           MessageBox MB_YESNO|MB_ICONEXCLAMATION $(lng_WANT_UNINSTALL_BEFORE) /SD IDNO IDYES +1 IDNO uninstall_before_done 
1118           ;Run the uninstaller
1119           ;uninst:
1120             ClearErrors
1121             ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
1122           uninstall_before_done:
1123           
1124   ; proccess command line parameter
1125   !insertmacro Parameter "GTK" ${SecGTK}
1126   !insertmacro Parameter "SHORTCUTS" ${secShortcuts}
1127   !insertmacro Parameter "ALLUSER" ${SecAlluser}
1128   !insertmacro Parameter "DESKTOP" ${SecDesktop}
1129   !insertmacro Parameter "QUICKLAUNCH" ${SecQUICKlaunch}
1130   !insertmacro Parameter "SVGEDITOR" ${SecSVGWriter}
1131   !insertmacro Parameter "CONTEXTMENUE" ${SecContextMenu}
1132   !insertmacro Parameter "PREFERENCES" ${SecPrefs}
1133   !insertmacro Parameter "ADDFILES" ${SecAddfiles}
1134   !insertmacro Parameter "EXAMPLES" ${SecExamples}
1135   !insertmacro Parameter "TUTORIALS" ${SecTutorials}
1136   !insertmacro Parameter "LANGUAGES" ${SecLanguages}
1137   !insertmacro Parameter "am" ${SecAmharic}
1138   !insertmacro Parameter "az" ${SecAzerbaijani}
1139   !insertmacro Parameter "be" ${SecByelorussian}
1140   !insertmacro Parameter "bg" ${SecBulgarian}
1141   !insertmacro Parameter "bn" ${SecBengali}
1142   !insertmacro Parameter "ca" ${SecCatalan}
1143   !insertmacro Parameter "cs" ${SecCzech}
1144   !insertmacro Parameter "da" ${SecDanish}
1145   !insertmacro Parameter "de" ${SecGerman}
1146   !insertmacro Parameter "dz" ${SecDzongkha}
1147   !insertmacro Parameter "el" ${SecGreek}
1148   !insertmacro Parameter "en_AU" ${SecEnglishAustralian}
1149   !insertmacro Parameter "en_CA" ${SecEnglishCanadian}
1150   !insertmacro Parameter "en_GB" ${SecEnglishBritain}
1151   !insertmacro Parameter "en_US@piglatin" ${SecEnglishPiglatin}
1152   !insertmacro Parameter "eo" ${SecEsperanto}
1153   !insertmacro Parameter "es" ${SecSpanish}
1154   !insertmacro Parameter "es_MX" ${SecSpanishMexico}
1155   !insertmacro Parameter "et" ${SecEstonian}
1156   !insertmacro Parameter "eu" ${SecBasque}
1157   !insertmacro Parameter "fi" ${SecFinnish}
1158   !insertmacro Parameter "fr" ${SecFrench}
1159   !insertmacro Parameter "ga" ${SecIrish}
1160   !insertmacro Parameter "gl" ${SecGallegan}
1161   !insertmacro Parameter "he" ${SecHebrew}
1162   !insertmacro Parameter "hr" ${SecCroatian}
1163   !insertmacro Parameter "hu" ${SecHungarian}
1164   !insertmacro Parameter "id" ${SecIndonesian}
1165   !insertmacro Parameter "it" ${SecItalian}
1166   !insertmacro Parameter "ja" ${SecJapanese}
1167   !insertmacro Parameter "km" ${SecKhmer}
1168   !insertmacro Parameter "ko" ${SecKorean}
1169   !insertmacro Parameter "lt" ${SecLithuanian}
1170   !insertmacro Parameter "mk" ${SecMacedonian}
1171   !insertmacro Parameter "mn" ${SecMongolian}
1172   !insertmacro Parameter "nb" ${SecNorwegianBokmal}
1173   !insertmacro Parameter "ne" ${SecNepali}
1174   !insertmacro Parameter "nl" ${SecDutch}
1175   !insertmacro Parameter "nn" ${SecNorwegianNynorsk}
1176   !insertmacro Parameter "pa" ${SecPanjabi}
1177   !insertmacro Parameter "pl" ${SecPolish}
1178   !insertmacro Parameter "pt" ${SecPortuguese}
1179   !insertmacro Parameter "pt_BR" ${SecPortugueseBrazil}
1180   !insertmacro Parameter "ro" ${SecRomanian}
1181   !insertmacro Parameter "ru" ${SecRussian}
1182   !insertmacro Parameter "rw" ${SecKinyarwanda}
1183   !insertmacro Parameter "sk" ${SecSlovak}
1184   !insertmacro Parameter "sl" ${SecSlovenian}
1185   !insertmacro Parameter "sq" ${SecAlbanian}
1186   !insertmacro Parameter "sr" ${SecSerbian}
1187   !insertmacro Parameter "sr@Latn" ${SecSerbianLatin}
1188   !insertmacro Parameter "sv" ${SecSwedish}
1189   !insertmacro Parameter "th" ${SecThai}
1190   !insertmacro Parameter "tr" ${SecTurkish}
1191   !insertmacro Parameter "uk" ${SecUkrainian}
1192   !insertmacro Parameter "vi" ${SecVietnamese}
1193   !insertmacro Parameter "zh_CN" ${SecChineseSimplified}
1194   !insertmacro Parameter "zh_TW" ${SecChineseTaiwan}
1195   
1196   Push "?"
1197   Push "TEST"
1198   Call GetParameterValue
1199   Pop $1
1200   StrCmp $1 "TEST" +3
1201     MessageBox MB_OK "possible parameters for installer:$\r$\n \
1202       /?: this help screen$\r$\n \
1203       /S: silent$\r$\n \
1204       /D=(directory): where to install inkscape$\r$\n \
1205       /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
1206       /SHORTCUTS=(OFF/ON): shortcuts to start inkscape$\r$\n \
1207       /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
1208       /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
1209       /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
1210       /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
1211       /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
1212       /PREFERENCES=(OFF/ON): delete users preference files$\r$\n \
1213       /ADDFILES=(OFF/ON): additional files$\r$\n \
1214       /EXAMPLES=(OFF/ON): examples$\r$\n \
1215       /TUTORIALS=(OFF/ON): tutorials$\r$\n \
1216       /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
1217       /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
1218     Abort
1219 FunctionEnd
1221 Function .onSelChange
1222 FunctionEnd
1225 Function .onInstSuccess
1226   ;create/update log always within .onInstSuccess function
1227   !insertmacro UNINSTALL.LOG_UPDATE_INSTALL
1228 FunctionEnd
1230 ; --------------------------------------------------
1232 Function un.CustomPageUninstall
1233   !insertmacro MUI_HEADER_TEXT "$(lng_UInstOpt)" "$(lng_UInstOpt1)"
1234   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 1" "Text" "$APPDATA\Inkscape\"
1235   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 2" "Text" "$(lng_PurgePrefs)"
1237   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall"
1238   !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State"
1239   DetailPrint "keepfiles = $MultiUser" 
1240           ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1242 FunctionEnd
1245 Function un.onInit
1246   ;begin uninstall, could be added on top of uninstall section instead
1247   !insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
1249   ClearErrors
1250   StrCpy $User ""
1251         UserInfo::GetName
1252         IfErrors +3
1253         Pop $0
1254         StrCpy $User $0
1256   StrCpy $askMultiUser "1"
1257   StrCpy $MultiUser "1"
1258  
1259   ; Test if this was a multiuser installation
1260   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" ""
1261   StrCmp $0  "$INSTDIR\inkscape.exe" 0 hkcu_user_uninstall  
1262     ReadRegStr $MultiUser HKLM "${PRODUCT_DIR_REGKEY}" "MultiUser"
1263     ReadRegStr $askMultiUser HKLM "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1264         ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
1265         Goto check_user_uninstall
1266   hkcu_user_uninstall:
1267   ReadRegStr $MultiUser HKCU "${PRODUCT_DIR_REGKEY}" "MultiUser"
1268   ReadRegStr $askMultiUser HKCU "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1269   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
1270   ;check user if applicable
1271   check_user_uninstall:
1272   StrCmp $0 "" diff_user_uninstall_done
1273         StrCmp $0 $User diff_user_uninstall_done
1274           MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK diff_user_uninstall_done IDCANCEL +1
1275                 Quit
1276   diff_user_uninstall_done:
1277     
1278  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "inkscape.nsi.uninstall"
1280  ;check whether Multi user installation ?
1281  SetShellVarContext all
1282  StrCmp $MultiUser "0" 0 +2 
1283  SetShellVarContext current
1284  ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1285    
1286 FunctionEnd
1288 Section Uninstall
1290   ; remove personal settings
1291   Delete "$APPDATA\Inkscape\extension-errors.log"
1292   StrCmp $MultiUser "0" 0 endPurge  ; multiuser assigned in dialog
1293     DetailPrint "purge personal settings in $APPDATA\Inkscape"
1294     ;RMDir /r "$APPDATA\Inkscape"
1295         !insertmacro delprefs
1296   endPurge:
1298   ; Remove file associations for svg editor
1299   DetailPrint "removing file associations for svg editor"
1300   ClearErrors
1301   ReadRegStr $0 HKCR ".svg" ""
1302   DetailPrint ".svg associated as $0"
1303   IfErrors endUninstSVGEdit  
1304     ReadRegStr $1 HKCR "$0\shell\edit\command" ""
1305         IfErrors 0 +2  
1306       DetailPrint "svg editor is $1"
1307     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1308       DetailPrint "removing default .svg editor"
1309       DeleteRegKey HKCR "$0\shell\edit\command"
1310     DeleteRegKey /ifempty HKCR "$0\shell\edit"
1311     DeleteRegKey /ifempty HKCR "$0\shell"
1312     DeleteRegKey /ifempty HKCR "$0"
1313   endUninstSVGEdit:
1314   
1315   ClearErrors
1316   ReadRegStr $2 HKCR ".svgz" ""
1317   DetailPrint ".svgz associated as $2"
1318   IfErrors endUninstSVGZEdit  
1319     ReadRegStr $3 HKCR "$2\shell\edit\command" ""
1320     IfErrors 0 +2  
1321       DetailPrint "svgz editor is $1"
1322     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1323       DetailPrint "removing default .svgz editor"
1324       DeleteRegKey HKCR "$2\shell\edit\command"
1325     DeleteRegKey /ifempty HKCR "$2\shell\edit"
1326     DeleteRegKey /ifempty HKCR "$2\shell"
1327     DeleteRegKey /ifempty HKCR "$2"
1328   endUninstSVGZEdit:
1329   
1330   ; Remove file associations for svg editor
1331   DetailPrint "removing file associations for svg editor"
1332   ClearErrors
1333   ReadRegStr $0 HKCR ".svg" ""
1334   IfErrors endUninstSVGView
1335     ReadRegStr $1 HKCR "$0\shell\open\command" ""
1336     IfErrors 0 +2  
1337       DetailPrint "svg viewer is $1"
1338     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1339       DetailPrint "removing default .svg viewer"
1340       DeleteRegKey HKCR "$0\shell\open\command"
1341     DeleteRegKey /ifempty HKCR "$0\shell\open"
1342     DeleteRegKey /ifempty HKCR "$0\shell"
1343     DeleteRegKey /ifempty HKCR "$0"
1344   endUninstSVGView:
1345   
1346   ClearErrors
1347   ReadRegStr $2 HKCR ".svgz" ""
1348   IfErrors endUninstSVGZView
1349     ReadRegStr $3 HKCR "$2\shell\open\command" ""
1350     IfErrors 0 +2  
1351       DetailPrint "svgz viewer is $1"
1352     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1353       DetailPrint "removing default .svgz viewer"
1354       DeleteRegKey HKCR "$2\shell\open\command"
1355     DeleteRegKey /ifempty HKCR "$2\shell\open"
1356     DeleteRegKey /ifempty HKCR "$2\shell"
1357     DeleteRegKey /ifempty HKCR "$2"
1358   endUninstSVGZView:
1359   
1360   ; Remove file associations for context menue
1361   DetailPrint "removing file associations for svg editor"
1362   ClearErrors
1363   ReadRegStr $0 HKCR ".svg" ""
1364   IfErrors endUninstSVGContext
1365   DetailPrint "removing default .svg context menue"
1366   DeleteRegKey HKCR "$0\shell\${PRODUCT_NAME}"
1367   DeleteRegKey /ifempty HKCR "$0\shell"
1368   DeleteRegKey /ifempty HKCR "$0"
1369   endUninstSVGContext:
1370   
1371   ClearErrors
1372   ReadRegStr $2 HKCR ".svgz" ""
1373   IfErrors endUninstSVGZContext
1374   DetailPrint "removing default .svgzcontext menue"
1375   DeleteRegKey HKCR "$2\shell\${PRODUCT_NAME}"
1376   DeleteRegKey /ifempty HKCR "$2\shell"
1377   DeleteRegKey /ifempty HKCR "$2"
1378   endUninstSVGZContext:
1380   ReadRegStr $1 HKCR "$0" ""
1381   StrCmp $1 "" 0 +3
1382     DetailPrint "removing filetype .svg $0"
1383     DeleteRegKey HKCR ".svg"
1384   
1385   ReadRegStr $3 HKCR "$2" ""
1386   StrCmp $3 "" 0 +3
1387     DetailPrint "removing filetype .svgz $2"
1388     DeleteRegKey HKCR ".svgz"
1389   
1390     
1391   SetShellVarContext all
1392   DetailPrint "removing product regkey"
1393   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1394   DetailPrint "removing uninstall info"
1395   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1396   DetailPrint "removing shortcuts"
1397   Delete "$DESKTOP\Inkscape.lnk"
1398   Delete "$QUICKLAUNCH\Inkscape.lnk"
1399   Delete "$SMPROGRAMS\Inkscape.lnk"
1400   ;just in case they are still there
1401   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1402   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1403   RMDir  "$SMPROGRAMS\Inkscape"
1405   SetShellVarContext current
1406   DetailPrint "removing product regkey"
1407   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1408   DetailPrint "removing uninstall info"
1409   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1410   DetailPrint "removing shortcuts"
1411   Delete "$DESKTOP\Inkscape.lnk"
1412   Delete "$QUICKLAUNCH\Inkscape.lnk"
1413   Delete "$SMPROGRAMS\Inkscape.lnk"
1414   ;just in case they are still there
1415   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1416   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1417   RMDir  "$SMPROGRAMS\Inkscape"
1419   DetailPrint "removing uninstall info"
1421   ;uninstall from path, must be repeated for every install logged path individual
1422   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\lib\locale"
1423   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\locale"
1424   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\doc"
1425   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\tutorials"
1426   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\templates"
1427   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\screens"
1428   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\clipart"
1429   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\extensions"
1430   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\icons"
1431   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share"
1432   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\modules"
1433   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\python"
1434   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR"
1436   ;end uninstall, after uninstall from all logged paths has been performed
1437   !insertmacro UNINSTALL.LOG_END_UNINSTALL
1439   ;RMDir /r "$INSTDIR"
1441   SetAutoClose false
1443 SectionEnd