Code

added sections for lt, ko, zh_TW, resolution for patch #1399508 (copy README.*)
[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   ; the keyboard tables
403   SetOutPath $INSTDIR\share\screens
404   File /nonfatal /a /r "..\..\inkscape\share\screens\keys.${polng}.svg"  
405   SetOutPath $INSTDIR\share\templates
406   File /nonfatal /a /r "..\..\inkscape\share\templates\default.${polng}.svg"  
407   SetOutPath $INSTDIR\doc
408   File /nonfatal /a /r "..\..\inkscape\doc\keys.${polng}.xml"  
409   File /nonfatal /a /r "..\..\inkscape\doc\keys.${polng}.html"  
410   SectionGetFlags ${SecTutorials} $R1 
411   IntOp $R1 $R1 & ${SF_SELECTED} 
412   IntCmp $R1 ${SF_SELECTED} 0 skip_tutorials 
413     SetOutPath $INSTDIR\share\tutorials
414     File /nonfatal /a "..\..\inkscape\share\tutorials\*.${polng}.*"
415   skip_tutorials:
416 !macroend
418 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
423 ;--------------------------------
424 ; Installer Sections
426 Section -removeInkscape
427   ; check for an old installation and clean that dlls and stuff
428   ClearErrors
429   IfFileExists $INSTDIR\etc 0 doDeleteLib
430     DetailPrint "$INSTDIR\etc exists, will be removed"
431     RmDir /r $INSTDIR\etc
432         IfErrors 0 +4
433       DetailPrint "fatal: failed to delete $INSTDIR\etc"
434       DetailPrint "aborting installation"
435           Abort
436   doDeleteLib:
438   ClearErrors
439   IfFileExists $INSTDIR\lib 0 doDeleteLocale
440     DetailPrint "$INSTDIR\lib exists, will be removed"  
441     RmDir /r $INSTDIR\lib
442         IfErrors 0 +4
443       DetailPrint "fatal: failed to delete $INSTDIR\lib"
444       DetailPrint "aborting installation"
445           Abort
446   doDeleteLocale:
448   ClearErrors
449   IfFileExists $INSTDIR\locale 0 doDeleteDll
450     DetailPrint "$INSTDIR\locale exists, will be removed"
451     RmDir /r $INSTDIR\locale
452         IfErrors 0 +4
453       DetailPrint "fatal: failed to delete $INSTDIR\locale"
454       DetailPrint "aborting installation"
455           Abort
456   doDeleteDll:
458   ClearErrors
459   FindFirst $0 $1 $INSTDIR\*.dll
460     FindNextLoop:
461     StrCmp $1 "" FindNextDone
462     DetailPrint "$INSTDIR\$1 exists, will be removed"
463     Delete $INSTDIR\$1
464     IfErrors 0 +4
465       DetailPrint "fatal: failed to delete $INSTDIR\$1"
466       DetailPrint "aborting installation"
467       Abort
468     FindNext $0 $1
469     Goto FindNextLoop
470   FindNextDone:
471 SectionEnd
473 Section $(lng_Core) SecCore
475   DetailPrint "Installing Inkscape Core Files ..."
477   SectionIn 1 2 3 RO
478   SetOutPath $INSTDIR
479   SetOverwrite on
480   SetAutoClose false
482   File /a "..\..\inkscape\ink*.exe"
483   File /a "..\..\inkscape\AUTHORS"
484   File /a "..\..\inkscape\COPYING"
485   File /a "..\..\inkscape\COPYING.LIB"
486   File /a "..\..\inkscape\NEWS"
487   File /a "..\..\inkscape\HACKING.txt"
488   File /a "..\..\inkscape\README"
489   File /a "..\..\inkscape\README.txt"
490   File /a "..\..\inkscape\TRANSLATORS"
491   File /nonfatal /a /r "..\..\inkscape\data"
492   File /nonfatal /a /r "..\..\inkscape\doc"
493   File /nonfatal /a /r "..\..\inkscape\plugins"
494   File /nonfatal /a /r /x *.??*.???* /x "examples" /x "tutorials" "..\..\inkscape\share"
495   ; this file is added because it slips through the filter
496   SetOutPath $INSTDIR\share\clipart
497   File /a "..\..\inkscape\share\clipart\inkscape.logo.svg"
498   SetOutPath $INSTDIR\modules
499   File /nonfatal /a /r "..\..\inkscape\modules\*.*"
500   SetOutPath $INSTDIR\python
501   File /nonfatal /a /r "..\..\inkscape\python\*.*"
503   
504 SectionEnd
506 Section $(lng_GTKFiles) SecGTK
508   DetailPrint "Installing GTK Files ..."
509   
510   SectionIn 1 2 3 RO
511   SetOutPath $INSTDIR
512   SetOverwrite on
513   File /a /r "..\..\inkscape\*.dll"
514   File /a /r /x "locale" "..\..\inkscape\lib"
515   File /a /r "..\..\inkscape\etc"
516 SectionEnd
518 Section $(lng_Alluser) SecAlluser
519   ; disable this option in Win95/Win98/WinME
520   SectionIn 1 2 3 
521   StrCpy $MultiUser "1"
522 SectionEnd
524 SectionGroup $(lng_Shortcuts) SecShortcuts
526 Section $(lng_Desktop) SecDesktop
527   SectionIn 1 2 3
528   CreateShortCut "$DESKTOP\Inkscape.lnk" "$INSTDIR\inkscape.exe"
529 SectionEnd
531 Section $(lng_Quicklaunch) SecQuicklaunch
532   SectionIn 1 2 3
533   StrCmp $QUICKLAUNCH $TEMP +2
534     CreateShortCut "$QUICKLAUNCH\Inkscape.lnk" "$INSTDIR\inkscape.exe"
535 SectionEnd
537 Section $(lng_SVGWriter) SecSVGWriter 
538   SectionIn 1 2 3
539   ; create file associations, test before if needed
540   DetailPrint "creating file associations"
541   ReadRegStr $0 HKCR ".svg" ""
542   StrCmp $0 "" 0 +3
543     WriteRegStr HKCR ".svg" "" "svgfile"
544     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
545   ReadRegStr $0 HKCR ".svgz" ""
546   StrCmp $0 "" 0 +3
547     WriteRegStr HKCR ".svgz" "" "svgfile"
548     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
549   
550   DetailPrint "creating default editor"
551   ClearErrors
552   ReadRegStr $0 HKCR ".svg" ""
553   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
554   ReadRegStr $0 HKCR ".svgz" ""
555   WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
556   IfErrors 0 +2
557     DetailPrint "Uups! Problems creating default editor"
558 SectionEnd
560 Section $(lng_ContextMenu) SecContextMenu
561   SectionIn 1 2 3
562   ; create file associations, test before if needed
563   DetailPrint "creating file associations"
564   ReadRegStr $0 HKCR ".svg" ""
565   StrCmp $0 "" 0 +3
566     WriteRegStr HKCR ".svg" "" "svgfile"
567     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
568   ReadRegStr $0 HKCR ".svgz" ""
569   StrCmp $0 "" 0 +3
570     WriteRegStr HKCR ".svgz" "" "svgfile"
571     WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
572   
573   DetailPrint "creating context menue"
574   ClearErrors
575   ReadRegStr $0 HKCR ".svg" ""
576   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
577   ReadRegStr $0 HKCR ".svgz" ""
578   WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
579   IfErrors 0 +2
580     DetailPrint "Uups! Problems creating context menue integration"
582 SectionEnd
584 SectionGroupEnd
586 SectionGroup $(lng_Addfiles) SecAddfiles
588 Section $(lng_Examples) SecExamples
589   SectionIn 1 2
590   SetOutPath $INSTDIR\share
591   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\examples"
592 SectionEnd
594 Section $(lng_Tutorials) SecTutorials
595   SectionIn 1 2
596   SetOutPath $INSTDIR\share
597   File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\tutorials"
598 SectionEnd
600 SectionGroupEnd
602 SectionGroup /e $(lng_Languages) SecLanguages
604 Section $(lng_am) SecAmharic
605   !insertmacro Language am am
606 SectionEnd
608 Section $(lng_az) SecAzerbaijani
609   !insertmacro Language az az
610 SectionEnd
612 Section $(lng_be) SecByelorussian
613   !insertmacro Language be be
614 SectionEnd
616 Section $(lng_ca) SecCatalan
617   !insertmacro Language ca ca
618 SectionEnd
620 Section $(lng_cs) SecCzech
621   !insertmacro Language cs cs
622 SectionEnd
624 Section $(lng_da) SecDanish
625   !insertmacro Language da da
626 SectionEnd
628 Section $(lng_de) SecGerman
629   !insertmacro Language 'de' 'de'
630 SectionEnd
632 Section $(lng_el) SecGreek
633   !insertmacro Language el el
634 SectionEnd
636 Section $(lng_en) SecEnglish
637   SectionIn 1 2 3 RO
638 SectionEnd
640 Section $(lng_es) SecSpanish
641   !insertmacro Language 'es' 'es'
642 SectionEnd
644 Section $(lng_es_MX) SecSpanishMexico
645   !insertmacro Language 'es_MX' 'es_MX'
646 SectionEnd
648 Section $(lng_et) SecEstonian
649   !insertmacro Language et et
650 SectionEnd
652 Section $(lng_fr) SecFrench
653   !insertmacro Language 'fr' 'fr'
654 SectionEnd
656 Section $(lng_ga) SecIrish
657   !insertmacro Language ga ga
658 SectionEnd
660 Section $(lng_gl) SecGallegan
661   !insertmacro Language gl gl
662   SectionIn 1 2 3
663 SectionEnd
665 Section $(lng_hu) SecHungarian
666   !insertmacro Language hu hu
667   SectionIn 1 2 3
668 SectionEnd
670 Section $(lng_it) SecItalian
671   !insertmacro Language it it
672   SectionIn 1 2 3
673 SectionEnd
675 Section $(lng_ja) SecJapanese
676   !insertmacro Language 'ja' 'jp'
677 SectionEnd
679 Section $(lng_ko) SecKorean
680   !insertmacro Language 'ko' 'ko'
681 SectionEnd
683 Section $(lng_lt) SecLithuanian
684   !insertmacro Language 'lt' 'lt'
685 SectionEnd
687 Section $(lng_mk) SecMacedonian
688   !insertmacro Language mk mk
689 SectionEnd
691 Section $(lng_nb) SecNorwegianBokmal
692   !insertmacro Language nb nb
693 SectionEnd
695 Section $(lng_nl) SecDutch
696   !insertmacro Language nl nl
697 SectionEnd
699 Section $(lng_nn) SecNorwegianNynorsk
700   !insertmacro Language nn nn
701 SectionEnd
703 Section $(lng_pa) SecPanjabi
704   !insertmacro Language pa pa
705 SectionEnd
707 Section $(lng_pl) SecPolish
708   !insertmacro Language pl pl
709 SectionEnd
711 Section $(lng_pt) SecPortuguese
712   !insertmacro Language pt pt
713 SectionEnd
715 Section $(lng_pt_BR) SecPortugueseBrazil
716   !insertmacro Language pt_BR pt_BR
717 SectionEnd
719 Section $(lng_ru) SecRussian
720   !insertmacro Language ru ru
721 SectionEnd
723 Section $(lng_sk) SecSlovak
724   !insertmacro Language sk sk
725 SectionEnd
727 Section $(lng_sl) SecSlovenian
728   !insertmacro Language sl sl
729 SectionEnd
731 Section $(lng_sr) SecSerbian
732   !insertmacro Language sr sr
733 SectionEnd
735 Section $(lng_sr@Latn) SecSerbianLatin
736   !insertmacro Language 'sr@Latn' 'sr@Latn'
737 SectionEnd
739 Section $(lng_sv) SecSwedish
740   !insertmacro Language sv sv
741 SectionEnd
743 Section $(lng_tr) SecTurkish
744   !insertmacro Language tr tr
745 SectionEnd
747 Section $(lng_uk) SecUkrainian
748   !insertmacro Language uk uk
749 SectionEnd
751 Section $(lng_zh_CN) SecChineseSimplified
752   !insertmacro Language zh_CN zh_CN
753 SectionEnd
755 Section $(lng_zh_TW) SecChineseTaiwan
756   !insertmacro Language zh_TW zh_TW
757 SectionEnd
759 Section -FinalizeInstallation
760   StrCmp $MultiUser "1" "" SingleUser
761     DetailPrint "admin mode, registry root will be HKLM"
762     SetShellVarContext all
763     Goto endSingleUser
764   SingleUser:
765     DetailPrint "single user mode, registry root will be HKCU"
766     SetShellVarContext current
767   endSingleUser:                
769   ; check for writing registry
770   ClearErrors
771   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inkscape.exe"  
772   ;IfErrors 0 +4
773   ;  DetailPrint "fatal: failed to write to ${PRODUCT_DIR_REGKEY}"
774   ;  DetailPrint "aborting installation"
775   ;     Abort
776   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "MultiUser" "$MultiUser"  
777   WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "askMultiUser" "$askMultiUser"  
779   ; start menu entries
780   CreateDirectory "$SMPROGRAMS\Inkscape"
781   CreateShortCut "$SMPROGRAMS\Inkscape\Inkscape.lnk" "$INSTDIR\inkscape.exe"
782   CreateShortCut "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk" "$INSTDIR\uninst.exe"
784   ; uninstall settings
785   WriteUninstaller "$INSTDIR\uninst.exe"
786   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" '"$INSTDIR\uninst.exe"'
787   WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
788   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
789   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0"
790   WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
791   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" "1"
792   WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" "1"
793 SectionEnd
795 SectionGroupEnd
796  
797 ; Last the Descriptions
798 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
799   !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(lng_CoreDesc)
800   !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} $(lng_GTKFilesDesc)
801   !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(lng_ShortcutsDesc)
802   !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} $(lng_AlluserDesc) 
803   !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(lng_DesktopDesc)
804   !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} $(lng_QuicklaunchDesc)
805   !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} $(lng_SVGWriterDesc)
806   !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} $(lng_ContextMenuDesc)
807   !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} $(lng_AddfilesDesc)
808   !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} $(lng_ExamplesDesc)
809   !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} $(lng_TutorialsDesc)
810   !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(lng_LanguagesDesc)
811 !insertmacro MUI_FUNCTION_DESCRIPTION_END
813 !macro Parameter key Section
814   Push ${key}
815   Push ""
816   Call GetParameterValue
817   Pop $1
818   StrCmp $1 "OFF" 0 +5
819     SectionGetFlags ${Section} $0
820     IntOp $2 ${SF_SELECTED} ~
821     IntOp $0 $0 & $2
822     SectionSetFlags ${Section} $0
823   StrCmp $1 "ON" 0 +4
824     SectionGetFlags ${Section} $0
825     IntOp $0 $0 | ${SF_SELECTED}
826     SectionSetFlags ${Section} $0
827 !macroend
829 Function .onInit
830   ;Extract InstallOptions INI files
831   StrCpy $AskMultiUser "1"
832   StrCpy $MultiUser "0"
833   ; this resets AskMultiUser if Win95/98/ME
834   Call GetWindowsVersion
835   Pop $R0
836   DetailPrint "detected operating system $R0"
837   ;MessageBox MB_OK "operating system: $R0; AskMultiuser: $AskMultiUser"
838   
839   ; hide all user section if win98
840   StrCmp $AskMultiUser "1" +2
841     SectionSetText ${SecAlluser} ""
843   ; hide if quick launch if not available
844   StrCmp $QUICKLAUNCH $TEMP 0 +2
845     SectionSetText ${SecQuicklaunch} ""
846         
847   ; proccess command line parameter
848   !insertmacro Parameter "GTK" ${SecGTK}
849   !insertmacro Parameter "SHORTCUTS" ${secShortcuts}
850   !insertmacro Parameter "ALLUSER" ${SecAlluser}
851   !insertmacro Parameter "DESKTOP" ${SecDesktop}
852   !insertmacro Parameter "QUICKLAUNCH" ${SecQUICKlaunch}
853   !insertmacro Parameter "SVGEDITOR" ${SecSVGWriter}
854   !insertmacro Parameter "CONTEXTMENUE" ${SecContextMenu}
855   !insertmacro Parameter "ADDFILES" ${SecAddfiles}
856   !insertmacro Parameter "EXAMPLES" ${SecExamples}
857   !insertmacro Parameter "TUTORIALS" ${SecTutorials}
858   !insertmacro Parameter "LANGUAGES" ${SecLanguages}
859   !insertmacro Parameter "am" ${SecAmharic}
860   !insertmacro Parameter "az" ${SecAzerbaijani}
861   !insertmacro Parameter "be" ${SecByelorussian}
862   !insertmacro Parameter "ca" ${SecCatalan}
863   !insertmacro Parameter "cs" ${SecCzech}
864   !insertmacro Parameter "da" ${SecDanish}
865   !insertmacro Parameter "de" ${SecGerman}
866   !insertmacro Parameter "el" ${SecGreek}
867   !insertmacro Parameter "es" ${SecSpanish}
868   !insertmacro Parameter "es_MX" ${SecSpanishMexico}
869   !insertmacro Parameter "et" ${SecEstonian}
870   !insertmacro Parameter "fr" ${SecFrench}
871   !insertmacro Parameter "ga" ${SecIrish}
872   !insertmacro Parameter "gl" ${SecGallegan}
873   !insertmacro Parameter "hu" ${SecHungarian}
874   !insertmacro Parameter "it" ${SecItalian}
875   !insertmacro Parameter "ja" ${SecJapanese}
876   !insertmacro Parameter "mk" ${SecMacedonian}
877   !insertmacro Parameter "nb" ${SecNorwegianBokmal}
878   !insertmacro Parameter "nl" ${SecDutch}
879   !insertmacro Parameter "nn" ${SecNorwegianNynorsk}
880   !insertmacro Parameter "pa" ${SecPanjabi}
881   !insertmacro Parameter "pl" ${SecPolish}
882   !insertmacro Parameter "pt" ${SecPortuguese}
883   !insertmacro Parameter "pt_BR" ${SecPortugueseBrazil}
884   !insertmacro Parameter "ru" ${SecRussian}
885   !insertmacro Parameter "sk" ${SecSlovak}
886   !insertmacro Parameter "sl" ${SecSlovenian}
887   !insertmacro Parameter "sr" ${SecSerbian}
888   !insertmacro Parameter "sr@Latn" ${SecSerbianLatin}
889   !insertmacro Parameter "sv" ${SecSwedish}
890   !insertmacro Parameter "tr" ${SecTurkish}
891   !insertmacro Parameter "uk" ${SecUkrainian}
892   !insertmacro Parameter "zh_CN" ${SecChineseSimplified}
893   
894   Push "?"
895   Push "TEST"
896   Call GetParameterValue
897   Pop $1
898   StrCmp $1 "TEST" +3
899     MessageBox MB_OK "possible parameters for installer:$\r$\n \
900       /?: this help screen$\r$\n \
901       /S: silent$\r$\n \
902       /D=(directory): where to install inkscape$\r$\n \
903       /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
904       /SHORTCUTS=(OFF/ON): shortcuts to start inkscape$\r$\n \
905       /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
906       /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
907       /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
908       /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
909       /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
910       /ADDFILES=(OFF/ON): additional files$\r$\n \
911       /EXAMPLES=(OFF/ON): examples$\r$\n \
912       /TUTORIALS=(OFF/ON): tutorials$\r$\n \
913       /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
914       /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
915     Abort
916 FunctionEnd
918 Function .onSelChange
919 FunctionEnd
921 ; --------------------------------------------------
923 Function un.CustomPageUninstall
924   !insertmacro MUI_HEADER_TEXT "$(lng_UInstOpt)" "$(lng_UInstOpt1)"
925   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 1" "Text" "$APPDATA\Inkscape\preferences.xml"
926   !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 2" "Text" "$(lng_PurgePrefs)"
928   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall"
929   !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State"
930   DetailPrint "keepfiles = $MultiUser" 
931           ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
933 FunctionEnd
936 Function un.onInit
938   StrCpy $askMultiUser "1"
939   StrCpy $MultiUser "1"
940  
941   ; Test if this was a multiuser installation
942   ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" ""
943   StrCmp $0  "$INSTDIR\inkscape.exe" 0 +4  
944     ReadRegStr $MultiUser HKLM "${PRODUCT_DIR_REGKEY}" "MultiUser"
945     ReadRegStr $askMultiUser HKLM "${PRODUCT_DIR_REGKEY}" "askMultiUser"
946         Goto +3
947   ReadRegStr $MultiUser HKCU "${PRODUCT_DIR_REGKEY}" "MultiUser"
948   ReadRegStr $askMultiUser HKCU "${PRODUCT_DIR_REGKEY}" "askMultiUser"
949           
950   
951  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "inkscape.nsi.uninstall"
953  ;check whether Multi user installation ?
954  SetShellVarContext all
955  StrCmp $MultiUser "0" 0 +2 
956  SetShellVarContext current
957  ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser" 
958    
959 FunctionEnd
961 Section Uninstall
963   ; remove personal settings
964   Delete "$APPDATA\Inkscape\extension-errors.log"
965   StrCmp $MultiUser "0" 0 endPurge  ; multiuser assigned in dialog
966     DetailPrint "purge personal settings in $APPDATA\Inkscape"
967     RMDir /r "$APPDATA\Inkscape"
968   endPurge:
970   ; Remove file associations for svg editor
971   DetailPrint "removing file associations for svg editor"
972   ClearErrors
973   ReadRegStr $0 HKCR ".svg" ""
974   DetailPrint ".svg associated as $0"
975   IfErrors endUninstSVGEdit  
976     ReadRegStr $1 HKCR "$0\shell\edit\command" ""
977         IfErrors 0 +2  
978       DetailPrint "svg editor is $1"
979     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
980       DetailPrint "removing default .svg editor"
981       DeleteRegKey HKCR "$0\shell\edit\command"
982     DeleteRegKey /ifempty HKCR "$0\shell\edit"
983     DeleteRegKey /ifempty HKCR "$0\shell"
984     DeleteRegKey /ifempty HKCR "$0"
985   endUninstSVGEdit:
986   
987   ClearErrors
988   ReadRegStr $2 HKCR ".svgz" ""
989   DetailPrint ".svgz associated as $2"
990   IfErrors endUninstSVGZEdit  
991     ReadRegStr $3 HKCR "$2\shell\edit\command" ""
992     IfErrors 0 +2  
993       DetailPrint "svgz editor is $1"
994     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
995       DetailPrint "removing default .svgz editor"
996       DeleteRegKey HKCR "$2\shell\edit\command"
997     DeleteRegKey /ifempty HKCR "$2\shell\edit"
998     DeleteRegKey /ifempty HKCR "$2\shell"
999     DeleteRegKey /ifempty HKCR "$2"
1000   endUninstSVGZEdit:
1001   
1002   ; Remove file associations for svg editor
1003   DetailPrint "removing file associations for svg editor"
1004   ClearErrors
1005   ReadRegStr $0 HKCR ".svg" ""
1006   IfErrors endUninstSVGView
1007     ReadRegStr $1 HKCR "$0\shell\open\command" ""
1008     IfErrors 0 +2  
1009       DetailPrint "svg viewer is $1"
1010     StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1011       DetailPrint "removing default .svg viewer"
1012       DeleteRegKey HKCR "$0\shell\open\command"
1013     DeleteRegKey /ifempty HKCR "$0\shell\open"
1014     DeleteRegKey /ifempty HKCR "$0\shell"
1015     DeleteRegKey /ifempty HKCR "$0"
1016   endUninstSVGView:
1017   
1018   ClearErrors
1019   ReadRegStr $2 HKCR ".svgz" ""
1020   IfErrors endUninstSVGZView
1021     ReadRegStr $3 HKCR "$2\shell\open\command" ""
1022     IfErrors 0 +2  
1023       DetailPrint "svgz viewer is $1"
1024     StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1025       DetailPrint "removing default .svgz viewer"
1026       DeleteRegKey HKCR "$2\shell\open\command"
1027     DeleteRegKey /ifempty HKCR "$2\shell\open"
1028     DeleteRegKey /ifempty HKCR "$2\shell"
1029     DeleteRegKey /ifempty HKCR "$2"
1030   endUninstSVGZView:
1031   
1032   ; Remove file associations for context menue
1033   DetailPrint "removing file associations for svg editor"
1034   ClearErrors
1035   ReadRegStr $0 HKCR ".svg" ""
1036   IfErrors endUninstSVGContext
1037   DetailPrint "removing default .svg context menue"
1038   DeleteRegKey HKCR "$0\shell\${PRODUCT_NAME}"
1039   DeleteRegKey /ifempty HKCR "$0\shell"
1040   DeleteRegKey /ifempty HKCR "$0"
1041   endUninstSVGContext:
1042   
1043   ClearErrors
1044   ReadRegStr $2 HKCR ".svgz" ""
1045   IfErrors endUninstSVGZContext
1046   DetailPrint "removing default .svgzcontext menue"
1047   DeleteRegKey HKCR "$2\shell\${PRODUCT_NAME}"
1048   DeleteRegKey /ifempty HKCR "$2\shell"
1049   DeleteRegKey /ifempty HKCR "$2"
1050   endUninstSVGZContext:
1052   ReadRegStr $1 HKCR "$0" ""
1053   StrCmp $1 "" 0 +3
1054     DetailPrint "removing filetype .svg $0"
1055     DeleteRegKey HKCR ".svg"
1056   
1057   ReadRegStr $3 HKCR "$2" ""
1058   StrCmp $3 "" 0 +3
1059     DetailPrint "removing filetype .svgz $2"
1060     DeleteRegKey HKCR ".svgz"
1061   
1062     
1063   DetailPrint "removing product regkey"
1064   DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1065   DetailPrint "removing uninstall info"
1066   DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1068   DetailPrint "removing shortcuts"
1069   Delete "$DESKTOP\Inkscape.lnk"
1070   Delete "$QUICKLAUNCH\Inkscape.lnk"
1071   Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1072   Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1073   RMDir  "$SMPROGRAMS\Inkscape"
1075   DetailPrint "removing uninstall info"
1076   RMDir /r "$INSTDIR"
1078   SetAutoClose false
1080 SectionEnd