Code

add ca@valencian language to win32 installer selection
[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_ca@valencia) SecCatalanValencia
756   !insertmacro Language ca@valencia ca@valencia
757 SectionEnd
759 Section $(lng_cs) SecCzech
760   !insertmacro Language cs cs
761 SectionEnd
763 Section $(lng_da) SecDanish
764   !insertmacro Language da da
765 SectionEnd
767 Section $(lng_de) SecGerman
768   !insertmacro Language 'de' 'de'
769 SectionEnd
771 Section $(lng_dz) SecDzongkha
772   !insertmacro Language dz dz
773 SectionEnd
775 Section $(lng_el) SecGreek
776   !insertmacro Language el el
777 SectionEnd
779 Section $(lng_en) SecEnglish
780   SectionIn 1 2 3 RO
781 SectionEnd
783 Section $(lng_en_AU) SecEnglishAustralian
784   !insertmacro Language en_AU en_AU
785 SectionEnd
787 Section $(lng_en_CA) SecEnglishCanadian
788   !insertmacro Language en_CA en_CA
789 SectionEnd
791 Section $(lng_en_GB) SecEnglishBritain
792   !insertmacro Language en_GB en_GB
793 SectionEnd
795 Section $(lng_en_US@piglatin) SecEnglishPiglatin
796   !insertmacro Language en_US@piglatin en_US@Piglatin
797 SectionEnd
799 Section $(lng_eo) SecEsperanto
800   !insertmacro Language eo eo
801 SectionEnd
803 Section $(lng_es) SecSpanish
804   !insertmacro Language 'es' 'es'
805 SectionEnd
807 Section $(lng_es_MX) SecSpanishMexico
808   !insertmacro Language 'es_MX' 'es_MX'
809 SectionEnd
811 Section $(lng_et) SecEstonian
812   !insertmacro Language et et
813 SectionEnd
815 Section $(lng_eu) SecBasque
816   !insertmacro Language eu eu
817 SectionEnd
819 Section $(lng_fr) SecFrench
820   !insertmacro Language 'fr' 'fr'
821 SectionEnd
823 Section $(lng_fi) SecFinnish
824   !insertmacro Language 'fi' 'fi'
825 SectionEnd
827 Section $(lng_ga) SecIrish
828   !insertmacro Language ga ga
829 SectionEnd
831 Section $(lng_gl) SecGallegan
832   !insertmacro Language gl gl
833   SectionIn 1 2 3
834 SectionEnd
836 Section $(lng_he) SecHebrew
837   !insertmacro Language he he
838   SectionIn 1 2 3
839 SectionEnd
841 Section $(lng_hr) SecCroatian
842   !insertmacro Language hr hr
843   SectionIn 1 2 3
844 SectionEnd
846 Section $(lng_hu) SecHungarian
847   !insertmacro Language hu hu
848   SectionIn 1 2 3
849 SectionEnd
851 Section $(lng_id) SecIndonesian
852   !insertmacro Language id id
853   SectionIn 1 2 3
854 SectionEnd
856 Section $(lng_it) SecItalian
857   !insertmacro Language it it
858   SectionIn 1 2 3
859 SectionEnd
861 Section $(lng_ja) SecJapanese
862   !insertmacro Language 'ja' 'jp'
863 SectionEnd
865 Section $(lng_km) SecKhmer
866   !insertmacro Language km km
867 SectionEnd
869 Section $(lng_ko) SecKorean
870   !insertmacro Language 'ko' 'ko'
871 SectionEnd
873 Section $(lng_lt) SecLithuanian
874   !insertmacro Language 'lt' 'lt'
875 SectionEnd
877 Section $(lng_mn) SecMongolian
878   !insertmacro Language mn mn
879 SectionEnd
881 Section $(lng_mk) SecMacedonian
882   !insertmacro Language mk mk
883 SectionEnd
885 Section $(lng_nb) SecNorwegianBokmal
886   !insertmacro Language nb nb
887 SectionEnd
889 Section $(lng_ne) SecNepali
890   !insertmacro Language ne ne
891 SectionEnd
893 Section $(lng_nl) SecDutch
894   !insertmacro Language nl nl
895 SectionEnd
897 Section $(lng_nn) SecNorwegianNynorsk
898   !insertmacro Language nn nn
899 SectionEnd
901 Section $(lng_pa) SecPanjabi
902   !insertmacro Language pa pa
903 SectionEnd
905 Section $(lng_pl) SecPolish
906   !insertmacro Language pl pl
907 SectionEnd
909 Section $(lng_pt) SecPortuguese
910   !insertmacro Language pt pt
911 SectionEnd
913 Section $(lng_pt_BR) SecPortugueseBrazil
914   !insertmacro Language pt_BR pt_BR
915 SectionEnd
917 Section $(lng_ro) SecRomanian
918   !insertmacro Language ro ro
919 SectionEnd
921 Section $(lng_ru) SecRussian
922   !insertmacro Language ru ru
923 SectionEnd
925 Section $(lng_rw) SecKinyarwanda
926   !insertmacro Language rw rw
927 SectionEnd
929 Section $(lng_sk) SecSlovak
930   !insertmacro Language sk sk
931 SectionEnd
933 Section $(lng_sl) SecSlovenian
934   !insertmacro Language sl sl
935 SectionEnd
937 Section $(lng_sq) SecAlbanian
938   !insertmacro Language sq sq
939 SectionEnd
941 Section $(lng_sr) SecSerbian
942   !insertmacro Language sr sr
943 SectionEnd
945 Section $(lng_sr@Latn) SecSerbianLatin
946   !insertmacro Language 'sr@Latn' 'sr@Latn'
947 SectionEnd
949 Section $(lng_sv) SecSwedish
950   !insertmacro Language sv sv
951 SectionEnd
953 Section $(lng_th) SecThai
954   !insertmacro Language th th
955 SectionEnd
957 Section $(lng_tr) SecTurkish
958   !insertmacro Language tr tr
959 SectionEnd
961 Section $(lng_uk) SecUkrainian
962   !insertmacro Language uk uk
963 SectionEnd
965 Section $(lng_vi) SecVietnamese
966   !insertmacro Language vi vi
967 SectionEnd
969 Section $(lng_zh_CN) SecChineseSimplified
970   !insertmacro Language zh_CN zh_CN
971 SectionEnd
973 Section $(lng_zh_TW) SecChineseTaiwan
974   !insertmacro Language zh_TW zh_TW
975 SectionEnd
977 SectionGroupEnd
980 Section -FinalizeInstallation
981   StrCmp $MultiUser "1" "" SingleUser
982     DetailPrint "admin mode, registry root will be HKLM"
983     SetShellVarContext all
984     Goto endSingleUser
985   SingleUser:
986     DetailPrint "single user mode, registry root will be HKCU"
987     SetShellVarContext current
988   endSingleUser:                
990   ; check for writing registry
991   ClearErrors
992   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inkscape.exe"  
993   ;IfErrors 0 +4
994   ;  DetailPrint "fatal: failed to write to ${PRODUCT_DIR_REGKEY}"
995   ;  DetailPrint "aborting installation"
996   ;     Abort
997   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "MultiUser" "$MultiUser"  
998   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "askMultiUser" "$askMultiUser"
999   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "User" "$User"
1000   IfErrors 0 +2
1001     DetailPrint "fatal: failed to write to registry installation info"
1003   ; start menu entries
1004   ClearErrors
1005   CreateShortCut "$SMPROGRAMS\Inkscape.lnk" "$INSTDIR\inkscape.exe"
1006   IfErrors 0 +2
1007     DetailPrint "fatal: failed to write to start menu info"
1009   ; uninstall settings
1010   ClearErrors
1011   ; WriteUninstaller "$INSTDIR\uninst.exe"
1012   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\${UNINST_EXE}"
1013   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallDir" "$INSTDIR"
1014   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
1015   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
1016   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0"
1017   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
1018   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" "1"
1019   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" "1"
1020   IfErrors 0 +2
1021     DetailPrint "fatal: failed to write to registry un-installation info"
1022 SectionEnd
1023  
1024 ; Last the Descriptions
1025 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
1026   !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(lng_CoreDesc)
1027   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} $(lng_GTKFilesDesc)
1028   !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(lng_ShortcutsDesc)
1029   !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} $(lng_AlluserDesc) 
1030   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(lng_DesktopDesc)
1031   !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} $(lng_QuicklaunchDesc)
1032   !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} $(lng_SVGWriterDesc)
1033   !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} $(lng_ContextMenuDesc)
1034   !insertmacro MUI_DESCRIPTION_TEXT ${SecPrefs} $(lng_DeletePrefsDesc)
1035   !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} $(lng_AddfilesDesc)
1036   !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} $(lng_ExamplesDesc)
1037   !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} $(lng_TutorialsDesc)
1038   !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(lng_LanguagesDesc)
1039 !insertmacro MUI_FUNCTION_DESCRIPTION_END
1041 !macro Parameter key Section
1042   Push ${key}
1043   Push ""
1044   Call GetParameterValue
1045   Pop $1
1046   StrCmp $1 "OFF" 0 +5
1047     SectionGetFlags ${Section} $0
1048     IntOp $2 ${SF_SELECTED} ~
1049     IntOp $0 $0 & $2
1050     SectionSetFlags ${Section} $0
1051   StrCmp $1 "ON" 0 +4
1052     SectionGetFlags ${Section} $0
1053     IntOp $0 $0 | ${SF_SELECTED}
1054     SectionSetFlags ${Section} $0
1055 !macroend
1057 Function .onInit
1058   ;prepare log always within .onInit function
1059   !insertmacro UNINSTALL.LOG_PREPARE_INSTALL
1061   ;Extract InstallOptions INI files
1062   StrCpy $AskMultiUser "1"
1063   StrCpy $MultiUser "0"
1064   ; this resets AskMultiUser if Win95/98/ME
1065   Call GetWindowsVersion
1066   Pop $R0
1067   DetailPrint "detected operating system $R0"
1068   ;MessageBox MB_OK "operating system: $R0; AskMultiuser: $AskMultiUser"
1069   
1070   ; hide all user section if win98
1071   StrCmp $AskMultiUser "1" +2
1072     SectionSetText ${SecAlluser} ""
1074   ; hide if quick launch if not available
1075   StrCmp $QUICKLAUNCH $TEMP 0 +2
1076     SectionSetText ${SecQuicklaunch} ""
1078   ;check if user is admin
1079   ClearErrors
1080         UserInfo::GetName
1081         IfErrors info_Win9x
1082         Pop $0
1083         StrCpy $User $0
1084         UserInfo::GetAccountType
1085         Pop $1
1086         StrCmp $1 "Admin" info_done
1088         MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NO_ADMIN)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK info_done IDCANCEL +1
1089                 Quit
1090                 
1091         Goto info_done
1093         info_Win9x:
1094                 # This one means you don't need to care about admin or
1095                 # not admin because Windows 9x doesn't either
1096                 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NOT_SUPPORTED)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK info_done IDCANCEL +1
1097                         Quit
1098                         
1099         info_done:
1101   ;check for previous installation
1102   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
1103   StrCmp $0 "" +1 +2
1104   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
1105   ;check user if applicable
1106   StrCmp $0 "" diff_user_install_done
1107     StrCmp $0 $User diff_user_install_done
1108           MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK diff_user_install_done IDCANCEL +1
1109                 Quit
1110    diff_user_install_done:
1111           
1112   ; call uninstall first
1113   ; code taken from the vlc project
1114     ReadRegStr $R0  HKLM ${PRODUCT_UNINST_KEY} "UninstallString"
1115         ReadRegStr $R1  HKLM ${PRODUCT_UNINST_KEY} "DisplayName"
1116         StrCmp $R0 "" +1 +3
1117     ReadRegStr $R0  HKCU ${PRODUCT_UNINST_KEY} "UninstallString"
1118         ReadRegStr $R1  HKCU ${PRODUCT_UNINST_KEY} "DisplayName"
1119         StrCmp $R0 "" uninstall_before_done
1120          
1121           MessageBox MB_YESNO|MB_ICONEXCLAMATION $(lng_WANT_UNINSTALL_BEFORE) /SD IDNO IDYES +1 IDNO uninstall_before_done 
1122           ;Run the uninstaller
1123           ;uninst:
1124             ClearErrors
1125             ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
1126           uninstall_before_done:
1127           
1128   ; proccess command line parameter
1129   !insertmacro Parameter "GTK" ${SecGTK}
1130   !insertmacro Parameter "SHORTCUTS" ${secShortcuts}
1131   !insertmacro Parameter "ALLUSER" ${SecAlluser}
1132   !insertmacro Parameter "DESKTOP" ${SecDesktop}
1133   !insertmacro Parameter "QUICKLAUNCH" ${SecQUICKlaunch}
1134   !insertmacro Parameter "SVGEDITOR" ${SecSVGWriter}
1135   !insertmacro Parameter "CONTEXTMENUE" ${SecContextMenu}
1136   !insertmacro Parameter "PREFERENCES" ${SecPrefs}
1137   !insertmacro Parameter "ADDFILES" ${SecAddfiles}
1138   !insertmacro Parameter "EXAMPLES" ${SecExamples}
1139   !insertmacro Parameter "TUTORIALS" ${SecTutorials}
1140   !insertmacro Parameter "LANGUAGES" ${SecLanguages}
1141   !insertmacro Parameter "am" ${SecAmharic}
1142   !insertmacro Parameter "az" ${SecAzerbaijani}
1143   !insertmacro Parameter "be" ${SecByelorussian}
1144   !insertmacro Parameter "bg" ${SecBulgarian}
1145   !insertmacro Parameter "bn" ${SecBengali}
1146   !insertmacro Parameter "ca" ${SecCatalan}
1147   !insertmacro Parameter "ca@valencia" ${SecCatalanValencia}
1148   !insertmacro Parameter "cs" ${SecCzech}
1149   !insertmacro Parameter "da" ${SecDanish}
1150   !insertmacro Parameter "de" ${SecGerman}
1151   !insertmacro Parameter "dz" ${SecDzongkha}
1152   !insertmacro Parameter "el" ${SecGreek}
1153   !insertmacro Parameter "en_AU" ${SecEnglishAustralian}
1154   !insertmacro Parameter "en_CA" ${SecEnglishCanadian}
1155   !insertmacro Parameter "en_GB" ${SecEnglishBritain}
1156   !insertmacro Parameter "en_US@piglatin" ${SecEnglishPiglatin}
1157   !insertmacro Parameter "eo" ${SecEsperanto}
1158   !insertmacro Parameter "es" ${SecSpanish}
1159   !insertmacro Parameter "es_MX" ${SecSpanishMexico}
1160   !insertmacro Parameter "et" ${SecEstonian}
1161   !insertmacro Parameter "eu" ${SecBasque}
1162   !insertmacro Parameter "fi" ${SecFinnish}
1163   !insertmacro Parameter "fr" ${SecFrench}
1164   !insertmacro Parameter "ga" ${SecIrish}
1165   !insertmacro Parameter "gl" ${SecGallegan}
1166   !insertmacro Parameter "he" ${SecHebrew}
1167   !insertmacro Parameter "hr" ${SecCroatian}
1168   !insertmacro Parameter "hu" ${SecHungarian}
1169   !insertmacro Parameter "id" ${SecIndonesian}
1170   !insertmacro Parameter "it" ${SecItalian}
1171   !insertmacro Parameter "ja" ${SecJapanese}
1172   !insertmacro Parameter "km" ${SecKhmer}
1173   !insertmacro Parameter "ko" ${SecKorean}
1174   !insertmacro Parameter "lt" ${SecLithuanian}
1175   !insertmacro Parameter "mk" ${SecMacedonian}
1176   !insertmacro Parameter "mn" ${SecMongolian}
1177   !insertmacro Parameter "nb" ${SecNorwegianBokmal}
1178   !insertmacro Parameter "ne" ${SecNepali}
1179   !insertmacro Parameter "nl" ${SecDutch}
1180   !insertmacro Parameter "nn" ${SecNorwegianNynorsk}
1181   !insertmacro Parameter "pa" ${SecPanjabi}
1182   !insertmacro Parameter "pl" ${SecPolish}
1183   !insertmacro Parameter "pt" ${SecPortuguese}
1184   !insertmacro Parameter "pt_BR" ${SecPortugueseBrazil}
1185   !insertmacro Parameter "ro" ${SecRomanian}
1186   !insertmacro Parameter "ru" ${SecRussian}
1187   !insertmacro Parameter "rw" ${SecKinyarwanda}
1188   !insertmacro Parameter "sk" ${SecSlovak}
1189   !insertmacro Parameter "sl" ${SecSlovenian}
1190   !insertmacro Parameter "sq" ${SecAlbanian}
1191   !insertmacro Parameter "sr" ${SecSerbian}
1192   !insertmacro Parameter "sr@Latn" ${SecSerbianLatin}
1193   !insertmacro Parameter "sv" ${SecSwedish}
1194   !insertmacro Parameter "th" ${SecThai}
1195   !insertmacro Parameter "tr" ${SecTurkish}
1196   !insertmacro Parameter "uk" ${SecUkrainian}
1197   !insertmacro Parameter "vi" ${SecVietnamese}
1198   !insertmacro Parameter "zh_CN" ${SecChineseSimplified}
1199   !insertmacro Parameter "zh_TW" ${SecChineseTaiwan}
1200   
1201   Push "?"
1202   Push "TEST"
1203   Call GetParameterValue
1204   Pop $1
1205   StrCmp $1 "TEST" +3
1206     MessageBox MB_OK "possible parameters for installer:$\r$\n \
1207       /?: this help screen$\r$\n \
1208       /S: silent$\r$\n \
1209       /D=(directory): where to install inkscape$\r$\n \
1210       /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
1211       /SHORTCUTS=(OFF/ON): shortcuts to start inkscape$\r$\n \
1212       /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
1213       /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
1214       /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
1215       /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
1216       /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
1217       /PREFERENCES=(OFF/ON): delete users preference files$\r$\n \
1218       /ADDFILES=(OFF/ON): additional files$\r$\n \
1219       /EXAMPLES=(OFF/ON): examples$\r$\n \
1220       /TUTORIALS=(OFF/ON): tutorials$\r$\n \
1221       /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
1222       /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
1223     Abort
1224 FunctionEnd
1226 Function .onSelChange
1227 FunctionEnd
1230 Function .onInstSuccess
1231   ;create/update log always within .onInstSuccess function
1232   !insertmacro UNINSTALL.LOG_UPDATE_INSTALL
1233 FunctionEnd
1235 ; --------------------------------------------------
1237 Function un.CustomPageUninstall
1238   !insertmacro MUI_HEADER_TEXT "$(lng_UInstOpt)" "$(lng_UInstOpt1)"
1239   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 1" "Text" "$APPDATA\Inkscape\"
1240   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 2" "Text" "$(lng_PurgePrefs)"
1242   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall"
1243   !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State"
1244   DetailPrint "keepfiles = $MultiUser" 
1245           ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1247 FunctionEnd
1250 Function un.onInit
1251   ;begin uninstall, could be added on top of uninstall section instead
1252   !insertmacro UNINSTALL.LOG_BEGIN_UNINSTALL
1254   ClearErrors
1255   StrCpy $User ""
1256         UserInfo::GetName
1257         IfErrors +3
1258         Pop $0
1259         StrCpy $User $0
1261   StrCpy $askMultiUser "1"
1262   StrCpy $MultiUser "1"
1263  
1264   ; Test if this was a multiuser installation
1265   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" ""
1266   StrCmp $0  "$INSTDIR\inkscape.exe" 0 hkcu_user_uninstall  
1267     ReadRegStr $MultiUser HKLM "${PRODUCT_DIR_REGKEY}" "MultiUser"
1268     ReadRegStr $askMultiUser HKLM "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1269         ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
1270         Goto check_user_uninstall
1271   hkcu_user_uninstall:
1272   ReadRegStr $MultiUser HKCU "${PRODUCT_DIR_REGKEY}" "MultiUser"
1273   ReadRegStr $askMultiUser HKCU "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1274   ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
1275   ;check user if applicable
1276   check_user_uninstall:
1277   StrCmp $0 "" diff_user_uninstall_done
1278         StrCmp $0 $User diff_user_uninstall_done
1279           MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK diff_user_uninstall_done IDCANCEL +1
1280                 Quit
1281   diff_user_uninstall_done:
1282     
1283  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "inkscape.nsi.uninstall"
1285  ;check whether Multi user installation ?
1286  SetShellVarContext all
1287  StrCmp $MultiUser "0" 0 +2 
1288  SetShellVarContext current
1289  ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
1290    
1291 FunctionEnd
1293 Section Uninstall
1295   ; remove personal settings
1296   Delete "$APPDATA\Inkscape\extension-errors.log"
1297   StrCmp $MultiUser "0" 0 endPurge  ; multiuser assigned in dialog
1298     DetailPrint "purge personal settings in $APPDATA\Inkscape"
1299     ;RMDir /r "$APPDATA\Inkscape"
1300         !insertmacro delprefs
1301   endPurge:
1303   ; Remove file associations for svg editor
1304   DetailPrint "removing file associations for svg editor"
1305   ClearErrors
1306   ReadRegStr $0 HKCR ".svg" ""
1307   DetailPrint ".svg associated as $0"
1308   IfErrors endUninstSVGEdit  
1309     ReadRegStr $1 HKCR "$0\shell\edit\command" ""
1310         IfErrors 0 +2  
1311       DetailPrint "svg editor is $1"
1312     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1313       DetailPrint "removing default .svg editor"
1314       DeleteRegKey HKCR "$0\shell\edit\command"
1315     DeleteRegKey /ifempty HKCR "$0\shell\edit"
1316     DeleteRegKey /ifempty HKCR "$0\shell"
1317     DeleteRegKey /ifempty HKCR "$0"
1318   endUninstSVGEdit:
1319   
1320   ClearErrors
1321   ReadRegStr $2 HKCR ".svgz" ""
1322   DetailPrint ".svgz associated as $2"
1323   IfErrors endUninstSVGZEdit  
1324     ReadRegStr $3 HKCR "$2\shell\edit\command" ""
1325     IfErrors 0 +2  
1326       DetailPrint "svgz editor is $1"
1327     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1328       DetailPrint "removing default .svgz editor"
1329       DeleteRegKey HKCR "$2\shell\edit\command"
1330     DeleteRegKey /ifempty HKCR "$2\shell\edit"
1331     DeleteRegKey /ifempty HKCR "$2\shell"
1332     DeleteRegKey /ifempty HKCR "$2"
1333   endUninstSVGZEdit:
1334   
1335   ; Remove file associations for svg editor
1336   DetailPrint "removing file associations for svg editor"
1337   ClearErrors
1338   ReadRegStr $0 HKCR ".svg" ""
1339   IfErrors endUninstSVGView
1340     ReadRegStr $1 HKCR "$0\shell\open\command" ""
1341     IfErrors 0 +2  
1342       DetailPrint "svg viewer is $1"
1343     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1344       DetailPrint "removing default .svg viewer"
1345       DeleteRegKey HKCR "$0\shell\open\command"
1346     DeleteRegKey /ifempty HKCR "$0\shell\open"
1347     DeleteRegKey /ifempty HKCR "$0\shell"
1348     DeleteRegKey /ifempty HKCR "$0"
1349   endUninstSVGView:
1350   
1351   ClearErrors
1352   ReadRegStr $2 HKCR ".svgz" ""
1353   IfErrors endUninstSVGZView
1354     ReadRegStr $3 HKCR "$2\shell\open\command" ""
1355     IfErrors 0 +2  
1356       DetailPrint "svgz viewer is $1"
1357     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1358       DetailPrint "removing default .svgz viewer"
1359       DeleteRegKey HKCR "$2\shell\open\command"
1360     DeleteRegKey /ifempty HKCR "$2\shell\open"
1361     DeleteRegKey /ifempty HKCR "$2\shell"
1362     DeleteRegKey /ifempty HKCR "$2"
1363   endUninstSVGZView:
1364   
1365   ; Remove file associations for context menue
1366   DetailPrint "removing file associations for svg editor"
1367   ClearErrors
1368   ReadRegStr $0 HKCR ".svg" ""
1369   IfErrors endUninstSVGContext
1370   DetailPrint "removing default .svg context menue"
1371   DeleteRegKey HKCR "$0\shell\${PRODUCT_NAME}"
1372   DeleteRegKey /ifempty HKCR "$0\shell"
1373   DeleteRegKey /ifempty HKCR "$0"
1374   endUninstSVGContext:
1375   
1376   ClearErrors
1377   ReadRegStr $2 HKCR ".svgz" ""
1378   IfErrors endUninstSVGZContext
1379   DetailPrint "removing default .svgzcontext menue"
1380   DeleteRegKey HKCR "$2\shell\${PRODUCT_NAME}"
1381   DeleteRegKey /ifempty HKCR "$2\shell"
1382   DeleteRegKey /ifempty HKCR "$2"
1383   endUninstSVGZContext:
1385   ReadRegStr $1 HKCR "$0" ""
1386   StrCmp $1 "" 0 +3
1387     DetailPrint "removing filetype .svg $0"
1388     DeleteRegKey HKCR ".svg"
1389   
1390   ReadRegStr $3 HKCR "$2" ""
1391   StrCmp $3 "" 0 +3
1392     DetailPrint "removing filetype .svgz $2"
1393     DeleteRegKey HKCR ".svgz"
1394   
1395     
1396   SetShellVarContext all
1397   DetailPrint "removing product regkey"
1398   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1399   DetailPrint "removing uninstall info"
1400   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1401   DetailPrint "removing shortcuts"
1402   Delete "$DESKTOP\Inkscape.lnk"
1403   Delete "$QUICKLAUNCH\Inkscape.lnk"
1404   Delete "$SMPROGRAMS\Inkscape.lnk"
1405   ;just in case they are still there
1406   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1407   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1408   RMDir  "$SMPROGRAMS\Inkscape"
1410   SetShellVarContext current
1411   DetailPrint "removing product regkey"
1412   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1413   DetailPrint "removing uninstall info"
1414   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1415   DetailPrint "removing shortcuts"
1416   Delete "$DESKTOP\Inkscape.lnk"
1417   Delete "$QUICKLAUNCH\Inkscape.lnk"
1418   Delete "$SMPROGRAMS\Inkscape.lnk"
1419   ;just in case they are still there
1420   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1421   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1422   RMDir  "$SMPROGRAMS\Inkscape"
1424   DetailPrint "removing uninstall info"
1426   ;uninstall from path, must be repeated for every install logged path individual
1427   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\lib\locale"
1428   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\locale"
1429   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\doc"
1430   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\tutorials"
1431   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\templates"
1432   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\screens"
1433   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\clipart"
1434   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\extensions"
1435   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share\icons"
1436   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\share"
1437   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\modules"
1438   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR\python"
1439   !insertmacro UNINSTALL.LOG_UNINSTALL "$INSTDIR"
1441   ;end uninstall, after uninstall from all logged paths has been performed
1442   !insertmacro UNINSTALL.LOG_END_UNINSTALL
1444   ;RMDir /r "$INSTDIR"
1446   SetAutoClose false
1448 SectionEnd