Code

ff22af02e220a115805186e0cd6a3ff32065761c
[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.43+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
33 ; Welcome page
34 !insertmacro MUI_PAGE_WELCOME
35 ; License page
36 ; !define MUI_LICENSEPAGE_RADIOBUTTONS
37 LicenseForceSelection off
38 !define MUI_LICENSEPAGE_BUTTON $(lng_LICENSE_BUTTON)
39 !define MUI_LICENSEPAGE_TEXT_BOTTOM $(lng_LICENSE_BOTTOM_TEXT)
40 !insertmacro MUI_PAGE_LICENSE "..\..\Copying"
41 !insertmacro MUI_PAGE_COMPONENTS
42 ; InstType $(lng_Full)
43 ; InstType $(lng_Optimal)
44 ; InstType $(lng_Minimal)
45 ; Directory page
46 !insertmacro MUI_PAGE_DIRECTORY
47 ; Instfiles page
48 !insertmacro MUI_PAGE_INSTFILES
49 ; Finish page
50 !define MUI_FINISHPAGE_RUN "$INSTDIR\inkscape.exe"
51 !insertmacro MUI_PAGE_FINISH
53 ; Uninstaller pages
54 !insertmacro MUI_UNPAGE_CONFIRM
55 UninstPage custom un.CustomPageUninstall
56 !insertmacro MUI_UNPAGE_INSTFILES
57 ShowUninstDetails hide
58 !insertmacro MUI_UNPAGE_FINISH
60 ; #######################################
61 ; STRING   LOCALIZATION
62 ; #######################################
63 ; Thanks to Adib Taraben and Luca Bruno for getting this started
64 ; Add your translation here!  :-)
65 ; I had wanted to list the languages alphabetically, but apparently
66 ; the first is the default.  So putting English first is just being
67 ; practical.  It is not chauvinism or hubris, I swear!  ;-)
68 ; default language first
70 ; Language files
71 !include "english.nsh" 
72 ;!include "catalan.nsh" 
73 ;!include "czech.nsh" 
74 ;!include "french.nsh" 
75 !include "german.nsh" 
76 ;!include "italian.nsh" 
77 ;!include "polish.nsh" 
79 ReserveFile "inkscape.nsi.uninstall"
82 ; #######################################
83 ; SETTINGS
84 ; #######################################
86 Name              "${PRODUCT_NAME} ${PRODUCT_VERSION}"
87 Caption           $(lng_Caption)
88 OutFile           "Inkscape-${PRODUCT_VERSION}-1.win32.exe"
89 InstallDir        "$PROGRAMFILES\Inkscape"
90 InstallDirRegKey  HKLM "${PRODUCT_DIR_REGKEY}" ""
91 ShowInstDetails   hide
92 ShowUnInstDetails hide
94 var askMultiUser
95 Var MultiUser
97 ; #######################################
98 ;  I N S T A L L E R    S E C T I O N S
99 ; #######################################
101 ; Turn off old selected section
102 ; GetWindowsVersion
104 ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
105 ; Updated by Joost Verburg
106 ; Updated for Windows 98 SE by Matthew Win Tibbals 5-21-03
108 ; Returns on top of stack
110 ; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003)
111 ; or
112 ; '' (Unknown Windows Version)
114 ; Usage:
115 ;   Call GetWindowsVersion
116 ;   Pop $R0
117 ;   ; at this point $R0 is "NT 4.0" or whatnot
118 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
119 Function GetWindowsVersion
120  
121   Push $R0
122   Push $R1
123  
124   ClearErrors
125  
126   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
127  
128   IfErrors 0 lbl_winnt
129  
130   ; we are not NT
131   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
132  
133   StrCpy $R1 $R0 1
134   StrCmp $R1 '4' 0 lbl_error
135  
136   StrCpy $R1 $R0 3
137  
138   StrCmp $R1 '4.0' lbl_win32_95
139   StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
140  
141   lbl_win32_95:
142     StrCpy $R0 '95'
143         StrCpy $AskMultiUser "0"
144   Goto lbl_done
145  
146   lbl_win32_98:
147     StrCpy $R0 '98'
148         StrCpy $AskMultiUser "0"
149   Goto lbl_done
150   lbl_win32_ME:
151     StrCpy $R0 'ME'
152         StrCpy $AskMultiUser "0"
153   Goto lbl_done
154  
155   lbl_winnt:
156  
157   StrCpy $R1 $R0 1
158  
159   StrCmp $R1 '3' lbl_winnt_x
160   StrCmp $R1 '4' lbl_winnt_x
161  
162   StrCpy $R1 $R0 3
163  
164   StrCmp $R1 '5.0' lbl_winnt_2000
165   StrCmp $R1 '5.1' lbl_winnt_XP
166   StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error
167  
168   lbl_winnt_x:
169     StrCpy $R0 "NT $R0" 6
170   Goto lbl_done
171  
172   lbl_winnt_2000:
173     Strcpy $R0 '2000'
174   Goto lbl_done
175  
176   lbl_winnt_XP:
177     Strcpy $R0 'XP'
178   Goto lbl_done
179  
180   lbl_winnt_2003:
181     Strcpy $R0 '2003'
182   Goto lbl_done
183  
184   lbl_error:
185     Strcpy $R0 ''
186   lbl_done:
187  
188   Pop $R1
189   Exch $R0
191 FunctionEnd
193 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
195  ; StrStr
196  ; input, top of stack = string to search for
197  ;        top of stack-1 = string to search in
198  ; output, top of stack (replaces with the portion of the string remaining)
199  ; modifies no other variables.
200  ;
201  ; Usage:
202  ;   Push "this is a long ass string"
203  ;   Push "ass"
204  ;   Call StrStr
205  ;   Pop $R0
206  ;  ($R0 at this point is "ass string")
208  Function StrStr
209    Exch $R1 ; st=haystack,old$R1, $R1=needle
210    Exch    ; st=old$R1,haystack
211    Exch $R2 ; st=old$R1,old$R2, $R2=haystack
212    Push $R3
213    Push $R4
214    Push $R5
215    StrLen $R3 $R1
216    StrCpy $R4 0
217    ; $R1=needle
218    ; $R2=haystack
219    ; $R3=len(needle)
220    ; $R4=cnt
221    ; $R5=tmp
222    loop:
223      StrCpy $R5 $R2 $R3 $R4
224      StrCmp $R5 $R1 done
225      StrCmp $R5 "" done
226      IntOp $R4 $R4 + 1
227      Goto loop
228  done:
229    StrCpy $R1 $R2 "" $R4
230    Pop $R5
231    Pop $R4
232    Pop $R3
233    Pop $R2
234    Exch $R1
235  FunctionEnd
237 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
239  ; GetParameters
240  ; input, none
241  ; output, top of stack (replaces, with e.g. whatever)
242  ; modifies no other variables.
243  
244  Function GetParameters
245  
246    Push $R0
247    Push $R1
248    Push $R2
249    Push $R3
250    
251    StrCpy $R2 1
252    StrLen $R3 $CMDLINE
253    
254    ;Check for quote or space
255    StrCpy $R0 $CMDLINE $R2
256    StrCmp $R0 '"' 0 +3
257      StrCpy $R1 '"'
258      Goto loop
259    StrCpy $R1 " "
260    
261    loop:
262      IntOp $R2 $R2 + 1
263      StrCpy $R0 $CMDLINE 1 $R2
264      StrCmp $R0 $R1 get
265      StrCmp $R2 $R3 get
266      Goto loop
267    
268    get:
269      IntOp $R2 $R2 + 1
270      StrCpy $R0 $CMDLINE 1 $R2
271      StrCmp $R0 " " get
272      StrCpy $R0 $CMDLINE "" $R2
273    
274    Pop $R3
275    Pop $R2
276    Pop $R1
277    Exch $R0
278  
279  FunctionEnd
281 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
282 ; GetParameterValue
283 ; Chris Morgan<cmorgan@alum.wpi.edu> 5/10/2004
284 ; -Updated 4/7/2005 to add support for retrieving a command line switch
285 ;  and additional documentation
287 ; Searches the command line input, retrieved using GetParameters, for the
288 ; value of an option given the option name.  If no option is found the
289 ; default value is placed on the top of the stack upon function return.
291 ; This function can also be used to detect the existence of just a
292 ; command line switch like /OUTPUT  Pass the default and "OUTPUT"
293 ; on the stack like normal.  An empty return string "" will indicate
294 ; that the switch was found, the default value indicates that
295 ; neither a parameter or switch was found.
297 ; Inputs - Top of stack is default if parameter isn't found,
298 ;  second in stack is parameter to search for, ex. "OUTPUT"
299 ; Outputs - Top of the stack contains the value of this parameter
300 ;  So if the command line contained /OUTPUT=somedirectory, "somedirectory"
301 ;  will be on the top of the stack when this function returns
303 ; Register usage
304 ;$R0 - default return value if the parameter isn't found
305 ;$R1 - input parameter, for example OUTPUT from the above example
306 ;$R2 - the length of the search, this is the search parameter+2
307 ;      as we have '/OUTPUT='
308 ;$R3 - the command line string
309 ;$R4 - result from StrStr calls
310 ;$R5 - search for ' ' or '"'
311  
312 Function GetParameterValue
313   Exch $R0  ; get the top of the stack(default parameter) into R0
314   Exch      ; exchange the top of the stack(default) with
315             ; the second in the stack(parameter to search for)
316   Exch $R1  ; get the top of the stack(search parameter) into $R1
317  
318   ;Preserve on the stack the registers used in this function
319   Push $R2
320   Push $R3
321   Push $R4
322   Push $R5
323  
324   Strlen $R2 $R1+2    ; store the length of the search string into R2
325  
326   Call GetParameters  ; get the command line parameters
327   Pop $R3             ; store the command line string in R3
328  
329   # search for quoted search string
330   StrCpy $R5 '"'      ; later on we want to search for a open quote
331   Push $R3            ; push the 'search in' string onto the stack
332   Push '"/$R1='       ; push the 'search for'
333   Call StrStr         ; search for the quoted parameter value
334   Pop $R4
335   StrCpy $R4 $R4 "" 1   ; skip over open quote character, "" means no maxlen
336   StrCmp $R4 "" "" next ; if we didn't find an empty string go to next
337  
338   # search for non-quoted search string
339   StrCpy $R5 ' '      ; later on we want to search for a space since we
340                       ; didn't start with an open quote '"' we shouldn't
341                       ; look for a close quote '"'
342   Push $R3            ; push the command line back on the stack for searching
343   Push '/$R1='        ; search for the non-quoted search string
344   Call StrStr
345   Pop $R4
346  
347   ; $R4 now contains the parameter string starting at the search string,
348   ; if it was found
349 next:
350   StrCmp $R4 "" check_for_switch ; if we didn't find anything then look for
351                                  ; usage as a command line switch
352   # copy the value after /$R1= by using StrCpy with an offset of $R2,
353   # the length of '/OUTPUT='
354   StrCpy $R0 $R4 "" $R2  ; copy commandline text beyond parameter into $R0
355   # search for the next parameter so we can trim this extra text off
356   Push $R0
357   Push $R5            ; search for either the first space ' ', or the first
358                       ; quote '"'
359                       ; if we found '"/output' then we want to find the
360                       ; ending ", as in '"/output=somevalue"'
361                       ; if we found '/output' then we want to find the first
362                       ; space after '/output=somevalue'
363   Call StrStr         ; search for the next parameter
364   Pop $R4
365   StrCmp $R4 "" done  ; if 'somevalue' is missing, we are done
366   StrLen $R4 $R4      ; get the length of 'somevalue' so we can copy this
367                       ; text into our output buffer
368   StrCpy $R0 $R0 -$R4 ; using the length of the string beyond the value,
369                       ; copy only the value into $R0
370   goto done           ; if we are in the parameter retrieval path skip over
371                       ; the check for a command line switch
372  
373 ; See if the parameter was specified as a command line switch, like '/output'
374 check_for_switch:
375   Push $R3            ; push the command line back on the stack for searching
376   Push '/$R1'         ; search for the non-quoted search string
377   Call StrStr
378   Pop $R4
379   StrCmp $R4 "" done  ; if we didn't find anything then use the default
380   StrCpy $R0 ""       ; otherwise copy in an empty string since we found the
381                       ; parameter, just didn't find a value
382  
383 done:
384   Pop $R5
385   Pop $R4
386   Pop $R3
387   Pop $R2
388   Pop $R1
389   Exch $R0 ; put the value in $R0 at the top of the stack
390 FunctionEnd
392 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
394 !macro Language polng lng
395   SectionIn 1 2 3
396   SetOutPath $INSTDIR
397   File /nonfatal /a "..\..\inkscape\*.${lng}.txt"
398   SetOutPath $INSTDIR\locale
399   File /nonfatal /a /r "..\..\inkscape\locale\${polng}"
400   SetOutPath $INSTDIR\lib\locale
401   File /nonfatal /a /r "..\..\inkscape\lib\locale\${polng}" 
402   SectionGetFlags ${SecTutorials} $R1 
403   IntOp $R1 $R1 & ${SF_SELECTED} 
404   IntCmp $R1 ${SF_SELECTED} 0 skip_tutorials 
405     SetOutPath $INSTDIR\share\tutorials
406     File /nonfatal /a "..\..\inkscape\share\tutorials\*.${lng}.*"
407   skip_tutorials:
408 !macroend
410 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
415 ;--------------------------------
416 ; Installer Sections
418 Section -removeInkscape
419   ; check for an old installation and clean that dlls and stuff
420   ClearErrors
421   IfFileExists $INSTDIR\etc 0 doDeleteLib
422     DetailPrint "$INSTDIR\etc exists, will be removed"
423     RmDir /r $INSTDIR\etc
424         IfErrors 0 +4
425       DetailPrint "fatal: failed to delete $INSTDIR\etc"
426       DetailPrint "aborting installation"
427           Abort
428   doDeleteLib:
430   ClearErrors
431   IfFileExists $INSTDIR\lib 0 doDeleteLocale
432     DetailPrint "$INSTDIR\lib exists, will be removed"  
433     RmDir /r $INSTDIR\lib
434         IfErrors 0 +4
435       DetailPrint "fatal: failed to delete $INSTDIR\lib"
436       DetailPrint "aborting installation"
437           Abort
438   doDeleteLocale:
440   ClearErrors
441   IfFileExists $INSTDIR\locale 0 doDeleteDll
442     DetailPrint "$INSTDIR\locale exists, will be removed"
443     RmDir /r $INSTDIR\locale
444         IfErrors 0 +4
445       DetailPrint "fatal: failed to delete $INSTDIR\locale"
446       DetailPrint "aborting installation"
447           Abort
448   doDeleteDll:
450   ClearErrors
451   FindFirst $0 $1 $INSTDIR\*.dll
452     FindNextLoop:
453     StrCmp $1 "" FindNextDone
454     DetailPrint "$INSTDIR\$1 exists, will be removed"
455     Delete $INSTDIR\$1
456     IfErrors 0 +4
457       DetailPrint "fatal: failed to delete $INSTDIR\$1"
458       DetailPrint "aborting installation"
459       Abort
460     FindNext $0 $1
461     Goto FindNextLoop
462   FindNextDone:
463 SectionEnd
465 Section $(lng_Core) SecCore
467   DetailPrint "Installing Inkscape Core Files ..."
469   SectionIn 1 2 3 RO
470   SetOutPath $INSTDIR
471   SetOverwrite on
472   SetAutoClose false
474   File /a "..\..\inkscape\ink*.exe"
475   File /a "..\..\inkscape\AUTHORS"
476   File /a "..\..\inkscape\COPYING"
477   File /a "..\..\inkscape\COPYING.LIB"
478   File /a "..\..\inkscape\NEWS"
479   File /a "..\..\inkscape\HACKING.txt"
480   File /a "..\..\inkscape\README"
481   File /a "..\..\inkscape\TRANSLATORS"
482   File /nonfatal /a /r "..\..\inkscape\data"
483   File /nonfatal /a /r "..\..\inkscape\doc"
484   File /nonfatal /a /r "..\..\inkscape\plugins"
485   File /nonfatal /a /r /x *.??*.???* /x "examples" /x "tutorials" "..\..\inkscape\share"
486   SetOutPath $INSTDIR\modules
487   File /nonfatal /a /r "..\..\inkscape\modules\*.*"
489   
490 SectionEnd
492 Section $(lng_GTKFiles) SecGTK
494   DetailPrint "Installing GTK Files ..."
495   
496   SectionIn 1 2 3 RO
497   SetOutPath $INSTDIR
498   SetOverwrite on
499   File /a /r "..\..\inkscape\*.dll"
500   File /a /r /x "locale" "..\..\inkscape\lib"
501   File /a /r "..\..\inkscape\etc"
502 SectionEnd
504 Section $(lng_Alluser) SecAlluser
505   ; disable this option in Win95/Win98/WinME
506   SectionIn 1 2 3 
507   StrCpy $MultiUser "1"
508 SectionEnd
510 SectionGroup $(lng_Shortcuts) SecShortcuts
512 Section $(lng_Desktop) SecDesktop
513   SectionIn 1 2 3
514   CreateShortCut "$DESKTOP\Inkscape.lnk" "$INSTDIR\inkscape.exe"
515 SectionEnd
517 Section $(lng_Quicklaunch) SecQuicklaunch
518   SectionIn 1 2 3
519   StrCmp $QUICKLAUNCH $TEMP +2
520     CreateShortCut "$QUICKLAUNCH\Inkscape.lnk" "$INSTDIR\inkscape.exe"
521 SectionEnd
523 Section $(lng_SVGWriter) SecSVGWriter 
524   SectionIn 1 2 3
525   ; create file associations, test before if needed
526   DetailPrint "creating file associations"
527   ReadRegStr $0 HKCR ".svg" ""
528   StrCmp $0 "" 0 +3
529     WriteRegStr HKCR ".svg" "" "svgfile"
530     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
531   ReadRegStr $0 HKCR ".svgz" ""
532   StrCmp $0 "" 0 +3
533     WriteRegStr HKCR ".svgz" "" "svgfile"
534     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
535   
536   DetailPrint "creating default editor"
537   ClearErrors
538   ReadRegStr $0 HKCR ".svg" ""
539   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
540   ReadRegStr $0 HKCR ".svgz" ""
541   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
542   IfErrors 0 +2
543     DetailPrint "Uups! Problems creating default editor"
544 SectionEnd
546 Section $(lng_ContextMenu) SecContextMenu
547   SectionIn 1 2 3
548   ; create file associations, test before if needed
549   DetailPrint "creating file associations"
550   ReadRegStr $0 HKCR ".svg" ""
551   StrCmp $0 "" 0 +3
552     WriteRegStr HKCR ".svg" "" "svgfile"
553     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
554   ReadRegStr $0 HKCR ".svgz" ""
555   StrCmp $0 "" 0 +3
556     WriteRegStr HKCR ".svgz" "" "svgfile"
557     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
558   
559   DetailPrint "creating context menue"
560   ClearErrors
561   ReadRegStr $0 HKCR ".svg" ""
562   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
563   ReadRegStr $0 HKCR ".svgz" ""
564   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
565   IfErrors 0 +2
566     DetailPrint "Uups! Problems creating context menue integration"
568 SectionEnd
570 SectionGroupEnd
572 SectionGroup $(lng_Addfiles) SecAddfiles
574 Section $(lng_Examples) SecExamples
575   SectionIn 1 2
576   SetOutPath $INSTDIR\share
577   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\examples"
578 SectionEnd
580 Section $(lng_Tutorials) SecTutorials
581   SectionIn 1 2
582   SetOutPath $INSTDIR\share
583   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\tutorials"
584 SectionEnd
586 SectionGroupEnd
588 SectionGroup /e $(lng_Languages) SecLanguages
590 Section $(lng_am) SecAmharic
591   !insertmacro Language am am
592 SectionEnd
594 Section $(lng_az) SecAzerbaijani
595   !insertmacro Language az az
596 SectionEnd
598 Section $(lng_be) SecByelorussian
599   !insertmacro Language be be
600 SectionEnd
602 Section $(lng_ca) SecCatalan
603   !insertmacro Language ca ca
604 SectionEnd
606 Section $(lng_cs) SecCzech
607   !insertmacro Language cs cs
608 SectionEnd
610 Section $(lng_da) SecDanish
611   !insertmacro Language da da
612 SectionEnd
614 Section $(lng_de) SecGerman
615   !insertmacro Language 'de' 'de'
616 SectionEnd
618 Section $(lng_el) SecGreek
619   !insertmacro Language el el
620 SectionEnd
622 Section $(lng_en) SecEnglish
623   SectionIn 1 2 3 RO
624 SectionEnd
626 Section $(lng_es) SecSpanish
627   !insertmacro Language 'es' 'es'
628 SectionEnd
630 Section $(lng_es_MX) SecSpanishMexico
631   !insertmacro Language 'es_MX' 'es_MX'
632 SectionEnd
634 Section $(lng_et) SecEstonian
635   !insertmacro Language et et
636 SectionEnd
638 Section $(lng_fr) SecFrench
639   !insertmacro Language 'fr' 'fr'
640 SectionEnd
642 Section $(lng_ga) SecIrish
643   !insertmacro Language ga ga
644 SectionEnd
646 Section $(lng_gl) SecGallegan
647   !insertmacro Language gl gl
648   SectionIn 1 2 3
649 SectionEnd
651 Section $(lng_hu) SecHungarian
652   !insertmacro Language hu hu
653   SectionIn 1 2 3
654 SectionEnd
656 Section $(lng_it) SecItalian
657   !insertmacro Language it it
658   SectionIn 1 2 3
659 SectionEnd
661 Section $(lng_ja) SecJapanese
662   !insertmacro Language 'ja' 'jp'
663 SectionEnd
665 Section $(lng_mk) SecMacedonian
666   !insertmacro Language mk mk
667 SectionEnd
669 Section $(lng_nb) SecNorwegianBokmal
670   !insertmacro Language nb nb
671 SectionEnd
673 Section $(lng_nl) SecDutch
674   !insertmacro Language nl nl
675 SectionEnd
677 Section $(lng_nn) SecNorwegianNynorsk
678   !insertmacro Language nn nn
679 SectionEnd
681 Section $(lng_pa) SecPanjabi
682   !insertmacro Language pa pa
683 SectionEnd
685 Section $(lng_pl) SecPolish
686   !insertmacro Language pl pl
687 SectionEnd
689 Section $(lng_pt) SecPortuguese
690   !insertmacro Language pt pt
691 SectionEnd
693 Section $(lng_pt_BR) SecPortugueseBrazil
694   !insertmacro Language pt_BR pt_BR
695 SectionEnd
697 Section $(lng_ru) SecRussian
698   !insertmacro Language ru ru
699 SectionEnd
701 Section $(lng_sk) SecSlovak
702   !insertmacro Language sk sk
703 SectionEnd
705 Section $(lng_sl) SecSlovenian
706   !insertmacro Language sl sl
707 SectionEnd
709 Section $(lng_sr) SecSerbian
710   !insertmacro Language sr sr
711 SectionEnd
713 Section $(lng_sr@Latn) SecSerbianLatin
714   !insertmacro Language 'sr@Latn' 'sr@Latn'
715 SectionEnd
717 Section $(lng_sv) SecSwedish
718   !insertmacro Language sv sv
719 SectionEnd
721 Section $(lng_tr) SecTurkish
722   !insertmacro Language tr tr
723 SectionEnd
725 Section $(lng_uk) SecUkrainian
726   !insertmacro Language uk uk
727 SectionEnd
729 Section $(lng_zh_CN) SecChineseSimplified
730   !insertmacro Language zh_CN zh_CN
731 SectionEnd
733 Section -FinalizeInstallation
734   StrCmp $MultiUser "1" "" SingleUser
735     DetailPrint "admin mode, registry root will be HKLM"
736     SetShellVarContext all
737     Goto endSingleUser
738   SingleUser:
739     DetailPrint "single user mode, registry root will be HKCU"
740     SetShellVarContext current
741   endSingleUser:                
743   ; check for writing registry
744   ClearErrors
745   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inkscape.exe"  
746   ;IfErrors 0 +4
747   ;  DetailPrint "fatal: failed to write to ${PRODUCT_DIR_REGKEY}"
748   ;  DetailPrint "aborting installation"
749   ;     Abort
750   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "MultiUser" "$MultiUser"  
751   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "askMultiUser" "$askMultiUser"  
753   ; start menu entries
754   CreateDirectory "$SMPROGRAMS\Inkscape"
755   CreateShortCut "$SMPROGRAMS\Inkscape\Inkscape.lnk" "$INSTDIR\inkscape.exe"
756   CreateShortCut "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk" "$INSTDIR\uninst.exe"
758   ; uninstall settings
759   WriteUninstaller "$INSTDIR\uninst.exe"
760   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" '"$INSTDIR\uninst.exe"'
761   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
762   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
763   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0"
764   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
765   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" "1"
766   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" "1"
767 SectionEnd
769 SectionGroupEnd
770  
771 ; Last the Descriptions
772 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
773   !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(lng_CoreDesc)
774   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} $(lng_GTKFilesDesc)
775   !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(lng_ShortcutsDesc)
776   !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} $(lng_AlluserDesc) 
777   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(lng_DesktopDesc)
778   !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} $(lng_QuicklaunchDesc)
779   !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} $(lng_SVGWriterDesc)
780   !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} $(lng_ContextMenuDesc)
781   !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} $(lng_AddfilesDesc)
782   !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} $(lng_ExamplesDesc)
783   !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} $(lng_TutorialsDesc)
784   !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(lng_LanguagesDesc)
785 !insertmacro MUI_FUNCTION_DESCRIPTION_END
787 !macro Parameter key Section
788   Push ${key}
789   Push ""
790   Call GetParameterValue
791   Pop $1
792   StrCmp $1 "OFF" 0 +5
793     SectionGetFlags ${Section} $0
794     IntOp $2 ${SF_SELECTED} ~
795     IntOp $0 $0 & $2
796     SectionSetFlags ${Section} $0
797   StrCmp $1 "ON" 0 +4
798     SectionGetFlags ${Section} $0
799     IntOp $0 $0 | ${SF_SELECTED}
800     SectionSetFlags ${Section} $0
801 !macroend
803 Function .onInit
804   ;Extract InstallOptions INI files
805   StrCpy $AskMultiUser "1"
806   StrCpy $MultiUser "0"
807   ; this resets AskMultiUser if Win95/98/ME
808   Call GetWindowsVersion
809   Pop $R0
810   DetailPrint "detected operating system $R0"
811   ;MessageBox MB_OK "operating system: $R0; AskMultiuser: $AskMultiUser"
812   
813   ; hide all user section if win98
814   StrCmp $AskMultiUser "1" +2
815     SectionSetText ${SecAlluser} ""
817   ; hide if quick launch if not available
818   StrCmp $QUICKLAUNCH $TEMP 0 +2
819     SectionSetText ${SecQuicklaunch} ""
821   ; proccess command line parameter
822   !insertmacro Parameter "GTK" ${SecGTK}
823   !insertmacro Parameter "SHORTCUTS" ${secShortcuts}
824   !insertmacro Parameter "ALLUSER" ${SecAlluser}
825   !insertmacro Parameter "DESKTOP" ${SecDesktop}
826   !insertmacro Parameter "QUICKLAUNCH" ${SecQUICKlaunch}
827   !insertmacro Parameter "SVGEDITOR" ${SecSVGWriter}
828   !insertmacro Parameter "CONTEXTMENUE" ${SecContextMenu}
829   !insertmacro Parameter "ADDFILES" ${SecAddfiles}
830   !insertmacro Parameter "EXAMPLES" ${SecExamples}
831   !insertmacro Parameter "TUTORIALS" ${SecTutorials}
832   !insertmacro Parameter "LANGUAGES" ${SecLanguages}
833   !insertmacro Parameter "am" ${SecAmharic}
834   !insertmacro Parameter "az" ${SecAzerbaijani}
835   !insertmacro Parameter "be" ${SecByelorussian}
836   !insertmacro Parameter "ca" ${SecCatalan}
837   !insertmacro Parameter "cs" ${SecCzech}
838   !insertmacro Parameter "da" ${SecDanish}
839   !insertmacro Parameter "de" ${SecGerman}
840   !insertmacro Parameter "el" ${SecGreek}
841   !insertmacro Parameter "es" ${SecSpanish}
842   !insertmacro Parameter "es_MX" ${SecSpanishMexico}
843   !insertmacro Parameter "et" ${SecEstonian}
844   !insertmacro Parameter "fr" ${SecFrench}
845   !insertmacro Parameter "ga" ${SecIrish}
846   !insertmacro Parameter "gl" ${SecGallegan}
847   !insertmacro Parameter "hu" ${SecHungarian}
848   !insertmacro Parameter "it" ${SecItalian}
849   !insertmacro Parameter "ja" ${SecJapanese}
850   !insertmacro Parameter "mk" ${SecMacedonian}
851   !insertmacro Parameter "nb" ${SecNorwegianBokmal}
852   !insertmacro Parameter "nl" ${SecDutch}
853   !insertmacro Parameter "nn" ${SecNorwegianNynorsk}
854   !insertmacro Parameter "pa" ${SecPanjabi}
855   !insertmacro Parameter "pl" ${SecPolish}
856   !insertmacro Parameter "pt" ${SecPortuguese}
857   !insertmacro Parameter "pt_BR" ${SecPortugueseBrazil}
858   !insertmacro Parameter "ru" ${SecRussian}
859   !insertmacro Parameter "sk" ${SecSlovak}
860   !insertmacro Parameter "sl" ${SecSlovenian}
861   !insertmacro Parameter "sr" ${SecSerbian}
862   !insertmacro Parameter "sr@Latn" ${SecSerbianLatin}
863   !insertmacro Parameter "sv" ${SecSwedish}
864   !insertmacro Parameter "tr" ${SecTurkish}
865   !insertmacro Parameter "uk" ${SecUkrainian}
866   !insertmacro Parameter "zh_CN" ${SecChineseSimplified}
867   
868   Push "?"
869   Push "TEST"
870   Call GetParameterValue
871   Pop $1
872   StrCmp $1 "TEST" +3
873     MessageBox MB_OK "possible parameters for installer:$\r$\n \
874       /?: this help screen$\r$\n \
875       /S: silent$\r$\n \
876       /D=(directory): where to install inkscape$\r$\n \
877       /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
878       /SHORTCUTS=(OFF/ON): shortcuts to start inkscape$\r$\n \
879       /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
880       /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
881       /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
882       /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
883       /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
884       /ADDFILES=(OFF/ON): additional files$\r$\n \
885       /EXAMPLES=(OFF/ON): examples$\r$\n \
886       /TUTORIALS=(OFF/ON): tutorials$\r$\n \
887       /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
888       /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
889     Abort
890 FunctionEnd
892 Function .onSelChange
893 FunctionEnd
895 ; --------------------------------------------------
897 Function un.CustomPageUninstall
898   !insertmacro MUI_HEADER_TEXT "$(lng_UInstOpt)" "$(lng_UInstOpt1)"
899   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 1" "Text" "$APPDATA\Inkscape\preferences.xml"
900   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 2" "Text" "$(lng_PurgePrefs)"
902   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall"
903   !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State"
904   DetailPrint "keepfiles = $MultiUser" 
905           ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
907 FunctionEnd
910 Function un.onInit
912   StrCpy $askMultiUser "1"
913   StrCpy $MultiUser "1"
914  
915   ; Test if this was a multiuser installation
916   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" ""
917   StrCmp $0  "$INSTDIR\inkscape.exe" 0 +4  
918     ReadRegStr $MultiUser HKLM "${PRODUCT_DIR_REGKEY}" "MultiUser"
919     ReadRegStr $askMultiUser HKLM "${PRODUCT_DIR_REGKEY}" "askMultiUser"
920         Goto +3
921   ReadRegStr $MultiUser HKCU "${PRODUCT_DIR_REGKEY}" "MultiUser"
922   ReadRegStr $askMultiUser HKCU "${PRODUCT_DIR_REGKEY}" "askMultiUser"
923           
924   
925  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "inkscape.nsi.uninstall"
927  ;check whether Multi user installation ?
928  SetShellVarContext all
929  StrCmp $MultiUser "0" 0 +2 
930  SetShellVarContext current
931  ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
932    
933 FunctionEnd
935 Section Uninstall
937   ; remove personal settings
938   Delete "$APPDATA\Inkscape\extension-errors.log"
939   StrCmp $MultiUser "0" 0 endPurge  ; multiuser assigned in dialog
940     DetailPrint "purge personal settings in $APPDATA\Inkscape"
941     RMDir /r "$APPDATA\Inkscape"
942   endPurge:
944   ; Remove file associations for svg editor
945   DetailPrint "removing file associations for svg editor"
946   ClearErrors
947   ReadRegStr $0 HKCR ".svg" ""
948   DetailPrint ".svg associated as $0"
949   IfErrors endUninstSVGEdit  
950     ReadRegStr $1 HKCR "$0\shell\edit\command" ""
951         IfErrors 0 +2  
952       DetailPrint "svg editor is $1"
953     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
954       DetailPrint "removing default .svg editor"
955       DeleteRegKey HKCR "$0\shell\edit\command"
956     DeleteRegKey /ifempty HKCR "$0\shell\edit"
957     DeleteRegKey /ifempty HKCR "$0\shell"
958     DeleteRegKey /ifempty HKCR "$0"
959   endUninstSVGEdit:
960   
961   ClearErrors
962   ReadRegStr $2 HKCR ".svgz" ""
963   DetailPrint ".svgz associated as $2"
964   IfErrors endUninstSVGZEdit  
965     ReadRegStr $3 HKCR "$2\shell\edit\command" ""
966     IfErrors 0 +2  
967       DetailPrint "svgz editor is $1"
968     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
969       DetailPrint "removing default .svgz editor"
970       DeleteRegKey HKCR "$2\shell\edit\command"
971     DeleteRegKey /ifempty HKCR "$2\shell\edit"
972     DeleteRegKey /ifempty HKCR "$2\shell"
973     DeleteRegKey /ifempty HKCR "$2"
974   endUninstSVGZEdit:
975   
976   ; Remove file associations for svg editor
977   DetailPrint "removing file associations for svg editor"
978   ClearErrors
979   ReadRegStr $0 HKCR ".svg" ""
980   IfErrors endUninstSVGView
981     ReadRegStr $1 HKCR "$0\shell\open\command" ""
982     IfErrors 0 +2  
983       DetailPrint "svg viewer is $1"
984     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
985       DetailPrint "removing default .svg viewer"
986       DeleteRegKey HKCR "$0\shell\open\command"
987     DeleteRegKey /ifempty HKCR "$0\shell\open"
988     DeleteRegKey /ifempty HKCR "$0\shell"
989     DeleteRegKey /ifempty HKCR "$0"
990   endUninstSVGView:
991   
992   ClearErrors
993   ReadRegStr $2 HKCR ".svgz" ""
994   IfErrors endUninstSVGZView
995     ReadRegStr $3 HKCR "$2\shell\open\command" ""
996     IfErrors 0 +2  
997       DetailPrint "svgz viewer is $1"
998     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
999       DetailPrint "removing default .svgz viewer"
1000       DeleteRegKey HKCR "$2\shell\open\command"
1001     DeleteRegKey /ifempty HKCR "$2\shell\open"
1002     DeleteRegKey /ifempty HKCR "$2\shell"
1003     DeleteRegKey /ifempty HKCR "$2"
1004   endUninstSVGZView:
1005   
1006   ; Remove file associations for context menue
1007   DetailPrint "removing file associations for svg editor"
1008   ClearErrors
1009   ReadRegStr $0 HKCR ".svg" ""
1010   IfErrors endUninstSVGContext
1011   DetailPrint "removing default .svg context menue"
1012   DeleteRegKey HKCR "$0\shell\${PRODUCT_NAME}"
1013   DeleteRegKey /ifempty HKCR "$0\shell"
1014   DeleteRegKey /ifempty HKCR "$0"
1015   endUninstSVGContext:
1016   
1017   ClearErrors
1018   ReadRegStr $2 HKCR ".svgz" ""
1019   IfErrors endUninstSVGZContext
1020   DetailPrint "removing default .svgzcontext menue"
1021   DeleteRegKey HKCR "$2\shell\${PRODUCT_NAME}"
1022   DeleteRegKey /ifempty HKCR "$2\shell"
1023   DeleteRegKey /ifempty HKCR "$2"
1024   endUninstSVGZContext:
1026   ReadRegStr $1 HKCR "$0" ""
1027   StrCmp $1 "" 0 +3
1028     DetailPrint "removing filetype .svg $0"
1029     DeleteRegKey HKCR ".svg"
1030   
1031   ReadRegStr $3 HKCR "$2" ""
1032   StrCmp $3 "" 0 +3
1033     DetailPrint "removing filetype .svgz $2"
1034     DeleteRegKey HKCR ".svgz"
1035   
1036     
1037   DetailPrint "removing product regkey"
1038   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1039   DetailPrint "removing uninstall info"
1040   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1042   DetailPrint "removing shortcuts"
1043   Delete "$DESKTOP\Inkscape.lnk"
1044   Delete "$QUICKLAUNCH\Inkscape.lnk"
1045   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1046   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1047   RMDir  "$SMPROGRAMS\Inkscape"
1049   DetailPrint "removing uninstall info"
1050   RMDir /r "$INSTDIR"
1052   SetAutoClose false
1054 SectionEnd