f6677947c7ff96dd131aa8a7f72655dab01f6849
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
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 "finnish.nsh"
75 !include "french.nsh"
76 !include "german.nsh"
77 !include "italian.nsh"
78 !include "japanese.nsh"
79 !include "polish.nsh"
80 !include "russian.nsh"
81 !include "slovak.nsh"
82 !include "slovenian.nsh"
83 !include "spanish.nsh"
85 ReserveFile "inkscape.nsi.uninstall"
88 ; #######################################
89 ; SETTINGS
90 ; #######################################
92 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
93 Caption $(lng_Caption)
94 OutFile "Inkscape-${PRODUCT_VERSION}-1.win32.exe"
95 InstallDir "$PROGRAMFILES\Inkscape"
96 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
97 ShowInstDetails hide
98 ShowUnInstDetails hide
100 var askMultiUser
101 Var MultiUser
102 var User
104 ; #######################################
105 ; I N S T A L L E R S E C T I O N S
106 ; #######################################
108 ; Turn off old selected section
109 ; GetWindowsVersion
110 ;
111 ; Based on Yazno's function, http://yazno.tripod.com/powerpimpit/
112 ; Updated by Joost Verburg
113 ; Updated for Windows 98 SE by Matthew Win Tibbals 5-21-03
114 ;
115 ; Returns on top of stack
116 ;
117 ; Windows Version (95, 98, ME, NT x.x, 2000, XP, 2003)
118 ; or
119 ; '' (Unknown Windows Version)
120 ;
121 ; Usage:
122 ; Call GetWindowsVersion
123 ; Pop $R0
124 ; ; at this point $R0 is "NT 4.0" or whatnot
125 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
126 Function GetWindowsVersion
128 Push $R0
129 Push $R1
131 ClearErrors
133 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
135 IfErrors 0 lbl_winnt
137 ; we are not NT
138 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber
140 StrCpy $R1 $R0 1
141 StrCmp $R1 '4' 0 lbl_error
143 StrCpy $R1 $R0 3
145 StrCmp $R1 '4.0' lbl_win32_95
146 StrCmp $R1 '4.9' lbl_win32_ME lbl_win32_98
148 lbl_win32_95:
149 StrCpy $R0 '95'
150 StrCpy $AskMultiUser "0"
151 Goto lbl_done
153 lbl_win32_98:
154 StrCpy $R0 '98'
155 StrCpy $AskMultiUser "0"
156 Goto lbl_done
157 lbl_win32_ME:
158 StrCpy $R0 'ME'
159 StrCpy $AskMultiUser "0"
160 Goto lbl_done
162 lbl_winnt:
164 StrCpy $R1 $R0 1
166 StrCmp $R1 '3' lbl_winnt_x
167 StrCmp $R1 '4' lbl_winnt_x
169 StrCpy $R1 $R0 3
171 StrCmp $R1 '5.0' lbl_winnt_2000
172 StrCmp $R1 '5.1' lbl_winnt_XP
173 StrCmp $R1 '5.2' lbl_winnt_2003 lbl_error
175 lbl_winnt_x:
176 StrCpy $R0 "NT $R0" 6
177 Goto lbl_done
179 lbl_winnt_2000:
180 Strcpy $R0 '2000'
181 Goto lbl_done
183 lbl_winnt_XP:
184 Strcpy $R0 'XP'
185 Goto lbl_done
187 lbl_winnt_2003:
188 Strcpy $R0 '2003'
189 Goto lbl_done
191 lbl_error:
192 Strcpy $R0 ''
193 lbl_done:
195 Pop $R1
196 Exch $R0
198 FunctionEnd
200 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
202 ; StrStr
203 ; input, top of stack = string to search for
204 ; top of stack-1 = string to search in
205 ; output, top of stack (replaces with the portion of the string remaining)
206 ; modifies no other variables.
207 ;
208 ; Usage:
209 ; Push "this is a long ass string"
210 ; Push "ass"
211 ; Call StrStr
212 ; Pop $R0
213 ; ($R0 at this point is "ass string")
215 Function StrStr
216 Exch $R1 ; st=haystack,old$R1, $R1=needle
217 Exch ; st=old$R1,haystack
218 Exch $R2 ; st=old$R1,old$R2, $R2=haystack
219 Push $R3
220 Push $R4
221 Push $R5
222 StrLen $R3 $R1
223 StrCpy $R4 0
224 ; $R1=needle
225 ; $R2=haystack
226 ; $R3=len(needle)
227 ; $R4=cnt
228 ; $R5=tmp
229 loop:
230 StrCpy $R5 $R2 $R3 $R4
231 StrCmp $R5 $R1 done
232 StrCmp $R5 "" done
233 IntOp $R4 $R4 + 1
234 Goto loop
235 done:
236 StrCpy $R1 $R2 "" $R4
237 Pop $R5
238 Pop $R4
239 Pop $R3
240 Pop $R2
241 Exch $R1
242 FunctionEnd
244 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
246 ; GetParameters
247 ; input, none
248 ; output, top of stack (replaces, with e.g. whatever)
249 ; modifies no other variables.
251 Function GetParameters
253 Push $R0
254 Push $R1
255 Push $R2
256 Push $R3
258 StrCpy $R2 1
259 StrLen $R3 $CMDLINE
261 ;Check for quote or space
262 StrCpy $R0 $CMDLINE $R2
263 StrCmp $R0 '"' 0 +3
264 StrCpy $R1 '"'
265 Goto loop
266 StrCpy $R1 " "
268 loop:
269 IntOp $R2 $R2 + 1
270 StrCpy $R0 $CMDLINE 1 $R2
271 StrCmp $R0 $R1 get
272 StrCmp $R2 $R3 get
273 Goto loop
275 get:
276 IntOp $R2 $R2 + 1
277 StrCpy $R0 $CMDLINE 1 $R2
278 StrCmp $R0 " " get
279 StrCpy $R0 $CMDLINE "" $R2
281 Pop $R3
282 Pop $R2
283 Pop $R1
284 Exch $R0
286 FunctionEnd
288 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
289 ; GetParameterValue
290 ; Chris Morgan<cmorgan@alum.wpi.edu> 5/10/2004
291 ; -Updated 4/7/2005 to add support for retrieving a command line switch
292 ; and additional documentation
293 ;
294 ; Searches the command line input, retrieved using GetParameters, for the
295 ; value of an option given the option name. If no option is found the
296 ; default value is placed on the top of the stack upon function return.
297 ;
298 ; This function can also be used to detect the existence of just a
299 ; command line switch like /OUTPUT Pass the default and "OUTPUT"
300 ; on the stack like normal. An empty return string "" will indicate
301 ; that the switch was found, the default value indicates that
302 ; neither a parameter or switch was found.
303 ;
304 ; Inputs - Top of stack is default if parameter isn't found,
305 ; second in stack is parameter to search for, ex. "OUTPUT"
306 ; Outputs - Top of the stack contains the value of this parameter
307 ; So if the command line contained /OUTPUT=somedirectory, "somedirectory"
308 ; will be on the top of the stack when this function returns
309 ;
310 ; Register usage
311 ;$R0 - default return value if the parameter isn't found
312 ;$R1 - input parameter, for example OUTPUT from the above example
313 ;$R2 - the length of the search, this is the search parameter+2
314 ; as we have '/OUTPUT='
315 ;$R3 - the command line string
316 ;$R4 - result from StrStr calls
317 ;$R5 - search for ' ' or '"'
319 Function GetParameterValue
320 Exch $R0 ; get the top of the stack(default parameter) into R0
321 Exch ; exchange the top of the stack(default) with
322 ; the second in the stack(parameter to search for)
323 Exch $R1 ; get the top of the stack(search parameter) into $R1
325 ;Preserve on the stack the registers used in this function
326 Push $R2
327 Push $R3
328 Push $R4
329 Push $R5
331 Strlen $R2 $R1+2 ; store the length of the search string into R2
333 Call GetParameters ; get the command line parameters
334 Pop $R3 ; store the command line string in R3
336 # search for quoted search string
337 StrCpy $R5 '"' ; later on we want to search for a open quote
338 Push $R3 ; push the 'search in' string onto the stack
339 Push '"/$R1=' ; push the 'search for'
340 Call StrStr ; search for the quoted parameter value
341 Pop $R4
342 StrCpy $R4 $R4 "" 1 ; skip over open quote character, "" means no maxlen
343 StrCmp $R4 "" "" next ; if we didn't find an empty string go to next
345 # search for non-quoted search string
346 StrCpy $R5 ' ' ; later on we want to search for a space since we
347 ; didn't start with an open quote '"' we shouldn't
348 ; look for a close quote '"'
349 Push $R3 ; push the command line back on the stack for searching
350 Push '/$R1=' ; search for the non-quoted search string
351 Call StrStr
352 Pop $R4
354 ; $R4 now contains the parameter string starting at the search string,
355 ; if it was found
356 next:
357 StrCmp $R4 "" check_for_switch ; if we didn't find anything then look for
358 ; usage as a command line switch
359 # copy the value after /$R1= by using StrCpy with an offset of $R2,
360 # the length of '/OUTPUT='
361 StrCpy $R0 $R4 "" $R2 ; copy commandline text beyond parameter into $R0
362 # search for the next parameter so we can trim this extra text off
363 Push $R0
364 Push $R5 ; search for either the first space ' ', or the first
365 ; quote '"'
366 ; if we found '"/output' then we want to find the
367 ; ending ", as in '"/output=somevalue"'
368 ; if we found '/output' then we want to find the first
369 ; space after '/output=somevalue'
370 Call StrStr ; search for the next parameter
371 Pop $R4
372 StrCmp $R4 "" done ; if 'somevalue' is missing, we are done
373 StrLen $R4 $R4 ; get the length of 'somevalue' so we can copy this
374 ; text into our output buffer
375 StrCpy $R0 $R0 -$R4 ; using the length of the string beyond the value,
376 ; copy only the value into $R0
377 goto done ; if we are in the parameter retrieval path skip over
378 ; the check for a command line switch
380 ; See if the parameter was specified as a command line switch, like '/output'
381 check_for_switch:
382 Push $R3 ; push the command line back on the stack for searching
383 Push '/$R1' ; search for the non-quoted search string
384 Call StrStr
385 Pop $R4
386 StrCmp $R4 "" done ; if we didn't find anything then use the default
387 StrCpy $R0 "" ; otherwise copy in an empty string since we found the
388 ; parameter, just didn't find a value
390 done:
391 Pop $R5
392 Pop $R4
393 Pop $R3
394 Pop $R2
395 Pop $R1
396 Exch $R0 ; put the value in $R0 at the top of the stack
397 FunctionEnd
399 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
401 !macro Language polng lng
402 SectionIn 1 2 3
403 SetOutPath $INSTDIR
404 File /nonfatal /a "..\..\inkscape\*.${lng}.txt"
405 SetOutPath $INSTDIR\locale
406 File /nonfatal /a /r "..\..\inkscape\locale\${polng}"
407 SetOutPath $INSTDIR\lib\locale
408 File /nonfatal /a /r "..\..\inkscape\lib\locale\${polng}"
409 SetOutPath $INSTDIR\share\cliparts
410 File /nonfatal /a /r "..\..\inkscape\share\clipart\*.${polng}.svg"
411 ; the keyboard tables
412 SetOutPath $INSTDIR\share\screens
413 File /nonfatal /a /r "..\..\inkscape\share\screens\*.${polng}.svg"
414 SetOutPath $INSTDIR\share\templates
415 File /nonfatal /a /r "..\..\inkscape\share\templates\*.${polng}.svg"
416 SetOutPath $INSTDIR\doc
417 File /nonfatal /a /r "..\..\inkscape\doc\keys.${polng}.xml"
418 File /nonfatal /a /r "..\..\inkscape\doc\keys.${polng}.html"
419 SectionGetFlags ${SecTutorials} $R1
420 IntOp $R1 $R1 & ${SF_SELECTED}
421 IntCmp $R1 ${SF_SELECTED} 0 skip_tutorials
422 SetOutPath $INSTDIR\share\tutorials
423 File /nonfatal /a "..\..\inkscape\share\tutorials\*.${polng}.*"
424 skip_tutorials:
425 !macroend
427 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
429 ;;;;;;;;;;;;;;;;;;;;;;;;;;
430 ; Delete prefs
431 ; code taken from the vlc project
432 ;;;;;;;;;;;;;;;;;;;;;;;;;;
433 !macro delprefs
434 StrCpy $0 0
435 DetailPrint "Delete personal preferences ..."
436 DetailPrint "try to find all users ..."
437 delprefs-Loop:
438 ; FIXME
439 ; this will loop through all the logged users and "virtual" windows users
440 ; (it looks like users are only present in HKEY_USERS when they are logged in)
441 ClearErrors
442 EnumRegKey $1 HKU "" $0
443 StrCmp $1 "" delprefs-End
444 IntOp $0 $0 + 1
445 ReadRegStr $2 HKU "$1\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" AppData
446 StrCmp $2 "" delprefs-Loop
447 DetailPrint "$2\Inkscape will be removed"
448 RMDir /r "$2\Inkscape"
449 Goto delprefs-Loop
450 delprefs-End:
451 !macroend
454 ;--------------------------------
455 ; Installer Sections
456 ; @todo better idea is to call the original uninstaller first
457 Section -removeInkscape
458 ; check for an old installation and clean that dlls and stuff
459 ClearErrors
460 IfFileExists $INSTDIR\etc 0 doDeleteLib
461 DetailPrint "$INSTDIR\etc exists, will be removed"
462 RmDir /r $INSTDIR\etc
463 IfErrors 0 +4
464 DetailPrint "fatal: failed to delete $INSTDIR\etc"
465 DetailPrint "aborting installation"
466 Abort
467 doDeleteLib:
469 ClearErrors
470 IfFileExists $INSTDIR\lib 0 doDeleteLocale
471 DetailPrint "$INSTDIR\lib exists, will be removed"
472 RmDir /r $INSTDIR\lib
473 IfErrors 0 +4
474 DetailPrint "fatal: failed to delete $INSTDIR\lib"
475 DetailPrint "aborting installation"
476 Abort
477 doDeleteLocale:
479 ClearErrors
480 IfFileExists $INSTDIR\locale 0 doDeleteDll
481 DetailPrint "$INSTDIR\locale exists, will be removed"
482 RmDir /r $INSTDIR\locale
483 IfErrors 0 +4
484 DetailPrint "fatal: failed to delete $INSTDIR\locale"
485 DetailPrint "aborting installation"
486 Abort
487 doDeleteDll:
489 ClearErrors
490 FindFirst $0 $1 $INSTDIR\*.dll
491 FindNextLoop:
492 StrCmp $1 "" FindNextDone
493 DetailPrint "$INSTDIR\$1 exists, will be removed"
494 Delete $INSTDIR\$1
495 IfErrors 0 +4
496 DetailPrint "fatal: failed to delete $INSTDIR\$1"
497 DetailPrint "aborting installation"
498 Abort
499 FindNext $0 $1
500 Goto FindNextLoop
501 FindNextDone:
503 ;remove the old inkscape shortcuts from the startmenu
504 ;just in case they are still there
505 SetShellVarContext current
506 Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
507 Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
508 RMDir "$SMPROGRAMS\Inkscape"
509 Delete "$SMPROGRAMS\Inkscape.lnk"
510 SetShellVarContext all
511 Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
512 Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
513 RMDir "$SMPROGRAMS\Inkscape"
514 Delete "$SMPROGRAMS\Inkscape.lnk"
516 SectionEnd
518 Section $(lng_Core) SecCore
520 DetailPrint "Installing Inkscape Core Files ..."
522 SectionIn 1 2 3 RO
523 SetOutPath $INSTDIR
524 SetOverwrite on
525 SetAutoClose false
527 File /a "..\..\inkscape\ink*.exe"
528 File /a "..\..\inkscape\AUTHORS"
529 File /a "..\..\inkscape\COPYING"
530 File /a "..\..\inkscape\COPYING.LIB"
531 File /a "..\..\inkscape\NEWS"
532 File /nonfatal /a "..\..\inkscape\HACKING.txt"
533 File /a "..\..\inkscape\README"
534 File /nonfatal /a "..\..\inkscape\README.txt"
535 File /a "..\..\inkscape\TRANSLATORS"
536 File /nonfatal /a /r "..\..\inkscape\data"
537 File /nonfatal /a /r "..\..\inkscape\doc"
538 File /nonfatal /a /r "..\..\inkscape\plugins"
539 File /nonfatal /a /r /x *.??*.???* /x "examples" /x "tutorials" "..\..\inkscape\share"
540 ; this files are added because it slips through the filter
541 SetOutPath $INSTDIR\share\clipart
542 File /a "..\..\inkscape\share\clipart\inkscape.logo.svg"
543 ;File /a "..\..\inkscape\share\clipart\inkscape.logo.classic.svg"
544 SetOutPath $INSTDIR\share\extensions
545 File /a "..\..\inkscape\share\extensions\pdf_output.inx.txt"
546 File /a "..\..\inkscape\share\extensions\pdf_output_via_gs_on_win32.inx.txt"
547 SetOutPath $INSTDIR\share\icons
548 File /a "..\..\inkscape\share\icons\inkscape.file.png"
549 File /a "..\..\inkscape\share\icons\inkscape.file.svg"
550 SetOutPath $INSTDIR\modules
551 File /nonfatal /a /r "..\..\inkscape\modules\*.*"
552 SetOutPath $INSTDIR\python
553 File /nonfatal /a /r "..\..\inkscape\python\*.*"
556 SectionEnd
558 Section $(lng_GTKFiles) SecGTK
560 DetailPrint "Installing GTK Files ..."
562 SectionIn 1 2 3 RO
563 SetOutPath $INSTDIR
564 SetOverwrite on
565 File /a /r "..\..\inkscape\*.dll"
566 File /a /r /x "locale" "..\..\inkscape\lib"
567 File /a /r "..\..\inkscape\etc"
568 SectionEnd
570 Section $(lng_Alluser) SecAlluser
571 ; disable this option in Win95/Win98/WinME
572 SectionIn 1 2 3
573 StrCpy $MultiUser "1"
574 StrCmp $MultiUser "1" "" SingleUser
575 DetailPrint "admin mode, registry root will be HKLM"
576 SetShellVarContext all
577 Goto endSingleUser
578 SingleUser:
579 DetailPrint "single user mode, registry root will be HKCU"
580 SetShellVarContext current
581 endSingleUser:
582 SectionEnd
584 SectionGroup $(lng_Shortcuts) SecShortcuts
586 Section /o $(lng_Desktop) SecDesktop
587 ClearErrors
588 CreateShortCut "$DESKTOP\Inkscape.lnk" "$INSTDIR\inkscape.exe"
589 IfErrors 0 +2
590 DetailPrint "Uups! Problems creating desktop shortcuts"
591 SectionEnd
593 Section /o $(lng_Quicklaunch) SecQuicklaunch
594 ClearErrors
595 StrCmp $QUICKLAUNCH $TEMP +2
596 CreateShortCut "$QUICKLAUNCH\Inkscape.lnk" "$INSTDIR\inkscape.exe"
597 IfErrors 0 +2
598 DetailPrint "Uups! Problems creating quicklaunch shortcuts"
599 SectionEnd
601 Section $(lng_SVGWriter) SecSVGWriter
602 SectionIn 1 2 3
603 ; create file associations, test before if needed
604 DetailPrint "creating file associations"
605 ClearErrors
606 ReadRegStr $0 HKCR ".svg" ""
607 StrCmp $0 "" 0 +3
608 WriteRegStr HKCR ".svg" "" "svgfile"
609 WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
610 ReadRegStr $0 HKCR ".svgz" ""
611 StrCmp $0 "" 0 +3
612 WriteRegStr HKCR ".svgz" "" "svgfile"
613 WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
614 IfErrors 0 +2
615 DetailPrint "Uups! Problems creating file assoziations for svg writer"
617 DetailPrint "creating default editor"
618 ClearErrors
619 ReadRegStr $0 HKCR ".svg" ""
620 WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
621 ReadRegStr $0 HKCR ".svgz" ""
622 WriteRegStr HKCR "$0\shell\edit\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
623 IfErrors 0 +2
624 DetailPrint "Uups! Problems creating default editor"
625 SectionEnd
627 Section $(lng_ContextMenu) SecContextMenu
628 SectionIn 1 2 3
629 ; create file associations, test before if needed
630 DetailPrint "creating file associations"
631 ClearErrors
632 ReadRegStr $0 HKCR ".svg" ""
633 StrCmp $0 "" 0 +3
634 WriteRegStr HKCR ".svg" "" "svgfile"
635 WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
636 ReadRegStr $0 HKCR ".svgz" ""
637 StrCmp $0 "" 0 +3
638 WriteRegStr HKCR ".svgz" "" "svgfile"
639 WriteRegStr HKCR "svgfile" "" "Scalable Vector Graphics file"
640 IfErrors 0 +2
641 DetailPrint "Uups! Problems creating file assoziations for context menu"
643 DetailPrint "creating context menue"
644 ClearErrors
645 ReadRegStr $0 HKCR ".svg" ""
646 WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
647 ReadRegStr $0 HKCR ".svgz" ""
648 WriteRegStr HKCR "$0\shell\${PRODUCT_NAME}\command" "" '"$INSTDIR\Inkscape.exe" "%1"'
649 IfErrors 0 +2
650 DetailPrint "Uups! Problems creating context menue integration"
652 SectionEnd
654 SectionGroupEnd
656 Section /o $(lng_DeletePrefs) SecPrefs
657 !insertmacro delprefs
658 SectionEnd
660 SectionGroup $(lng_Addfiles) SecAddfiles
662 Section $(lng_Examples) SecExamples
663 SectionIn 1 2
664 SetOutPath $INSTDIR\share
665 File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\examples"
666 SectionEnd
668 Section $(lng_Tutorials) SecTutorials
669 SectionIn 1 2
670 SetOutPath $INSTDIR\share
671 File /nonfatal /a /r /x "*.??*.???*" "..\..\inkscape\share\tutorials"
672 SectionEnd
674 SectionGroupEnd
676 SectionGroup /e $(lng_Languages) SecLanguages
678 Section $(lng_am) SecAmharic
679 !insertmacro Language am am
680 SectionEnd
682 Section $(lng_az) SecAzerbaijani
683 !insertmacro Language az az
684 SectionEnd
686 Section $(lng_be) SecByelorussian
687 !insertmacro Language be be
688 SectionEnd
690 Section $(lng_bg) SecBulgarian
691 !insertmacro Language bg bg
692 SectionEnd
694 Section $(lng_bn) SecBengali
695 !insertmacro Language bn bn
696 SectionEnd
698 Section $(lng_ca) SecCatalan
699 !insertmacro Language ca ca
700 SectionEnd
702 Section $(lng_cs) SecCzech
703 !insertmacro Language cs cs
704 SectionEnd
706 Section $(lng_da) SecDanish
707 !insertmacro Language da da
708 SectionEnd
710 Section $(lng_de) SecGerman
711 !insertmacro Language 'de' 'de'
712 SectionEnd
714 Section $(lng_dz) SecDzongkha
715 !insertmacro Language dz dz
716 SectionEnd
718 Section $(lng_el) SecGreek
719 !insertmacro Language el el
720 SectionEnd
722 Section $(lng_en) SecEnglish
723 SectionIn 1 2 3 RO
724 SectionEnd
726 Section $(lng_en_AU) SecEnglishAustralian
727 !insertmacro Language en_AU en_AU
728 SectionEnd
730 Section $(lng_en_CA) SecEnglishCanadian
731 !insertmacro Language en_CA en_CA
732 SectionEnd
734 Section $(lng_en_GB) SecEnglishBritain
735 !insertmacro Language en_GB en_GB
736 SectionEnd
738 Section $(lng_en_US@piglatin) SecEnglishPiglatin
739 !insertmacro Language en_US@piglatin en_US@Piglatin
740 SectionEnd
742 Section $(lng_eo) SecEsperanto
743 !insertmacro Language eo eo
744 SectionEnd
746 Section $(lng_es) SecSpanish
747 !insertmacro Language 'es' 'es'
748 SectionEnd
750 Section $(lng_es_MX) SecSpanishMexico
751 !insertmacro Language 'es_MX' 'es_MX'
752 SectionEnd
754 Section $(lng_et) SecEstonian
755 !insertmacro Language et et
756 SectionEnd
758 Section $(lng_eu) SecBasque
759 !insertmacro Language eu eu
760 SectionEnd
762 Section $(lng_fr) SecFrench
763 !insertmacro Language 'fr' 'fr'
764 SectionEnd
766 Section $(lng_fi) SecFinnish
767 !insertmacro Language 'fi' 'fi'
768 SectionEnd
770 Section $(lng_ga) SecIrish
771 !insertmacro Language ga ga
772 SectionEnd
774 Section $(lng_gl) SecGallegan
775 !insertmacro Language gl gl
776 SectionIn 1 2 3
777 SectionEnd
779 Section $(lng_he) SecHebrew
780 !insertmacro Language he he
781 SectionIn 1 2 3
782 SectionEnd
784 Section $(lng_hr) SecCroatian
785 !insertmacro Language hr hr
786 SectionIn 1 2 3
787 SectionEnd
789 Section $(lng_hu) SecHungarian
790 !insertmacro Language hu hu
791 SectionIn 1 2 3
792 SectionEnd
794 Section $(lng_id) SecIndonesian
795 !insertmacro Language id id
796 SectionIn 1 2 3
797 SectionEnd
799 Section $(lng_it) SecItalian
800 !insertmacro Language it it
801 SectionIn 1 2 3
802 SectionEnd
804 Section $(lng_ja) SecJapanese
805 !insertmacro Language 'ja' 'jp'
806 SectionEnd
808 Section $(lng_km) SecKhmer
809 !insertmacro Language km km
810 SectionEnd
812 Section $(lng_ko) SecKorean
813 !insertmacro Language 'ko' 'ko'
814 SectionEnd
816 Section $(lng_lt) SecLithuanian
817 !insertmacro Language 'lt' 'lt'
818 SectionEnd
820 Section $(lng_mn) SecMongolian
821 !insertmacro Language mn mn
822 SectionEnd
824 Section $(lng_mk) SecMacedonian
825 !insertmacro Language mk mk
826 SectionEnd
828 Section $(lng_nb) SecNorwegianBokmal
829 !insertmacro Language nb nb
830 SectionEnd
832 Section $(lng_ne) SecNepali
833 !insertmacro Language ne ne
834 SectionEnd
836 Section $(lng_nl) SecDutch
837 !insertmacro Language nl nl
838 SectionEnd
840 Section $(lng_nn) SecNorwegianNynorsk
841 !insertmacro Language nn nn
842 SectionEnd
844 Section $(lng_pa) SecPanjabi
845 !insertmacro Language pa pa
846 SectionEnd
848 Section $(lng_pl) SecPolish
849 !insertmacro Language pl pl
850 SectionEnd
852 Section $(lng_pt) SecPortuguese
853 !insertmacro Language pt pt
854 SectionEnd
856 Section $(lng_pt_BR) SecPortugueseBrazil
857 !insertmacro Language pt_BR pt_BR
858 SectionEnd
860 Section $(lng_ro) SecRomanian
861 !insertmacro Language ro ro
862 SectionEnd
864 Section $(lng_ru) SecRussian
865 !insertmacro Language ru ru
866 SectionEnd
868 Section $(lng_rw) SecKinyarwanda
869 !insertmacro Language rw rw
870 SectionEnd
872 Section $(lng_sk) SecSlovak
873 !insertmacro Language sk sk
874 SectionEnd
876 Section $(lng_sl) SecSlovenian
877 !insertmacro Language sl sl
878 SectionEnd
880 Section $(lng_sq) SecAlbanian
881 !insertmacro Language sq sq
882 SectionEnd
884 Section $(lng_sr) SecSerbian
885 !insertmacro Language sr sr
886 SectionEnd
888 Section $(lng_sr@Latn) SecSerbianLatin
889 !insertmacro Language 'sr@Latn' 'sr@Latn'
890 SectionEnd
892 Section $(lng_sv) SecSwedish
893 !insertmacro Language sv sv
894 SectionEnd
896 Section $(lng_th) SecThai
897 !insertmacro Language th th
898 SectionEnd
900 Section $(lng_tr) SecTurkish
901 !insertmacro Language tr tr
902 SectionEnd
904 Section $(lng_uk) SecUkrainian
905 !insertmacro Language uk uk
906 SectionEnd
908 Section $(lng_vi) SecVietnamese
909 !insertmacro Language vi vi
910 SectionEnd
912 Section $(lng_zh_CN) SecChineseSimplified
913 !insertmacro Language zh_CN zh_CN
914 SectionEnd
916 Section $(lng_zh_TW) SecChineseTaiwan
917 !insertmacro Language zh_TW zh_TW
918 SectionEnd
920 SectionGroupEnd
923 Section -FinalizeInstallation
924 StrCmp $MultiUser "1" "" SingleUser
925 DetailPrint "admin mode, registry root will be HKLM"
926 SetShellVarContext all
927 Goto endSingleUser
928 SingleUser:
929 DetailPrint "single user mode, registry root will be HKCU"
930 SetShellVarContext current
931 endSingleUser:
933 ; check for writing registry
934 ClearErrors
935 WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\inkscape.exe"
936 ;IfErrors 0 +4
937 ; DetailPrint "fatal: failed to write to ${PRODUCT_DIR_REGKEY}"
938 ; DetailPrint "aborting installation"
939 ; Abort
940 WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "MultiUser" "$MultiUser"
941 WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "askMultiUser" "$askMultiUser"
942 WriteRegStr SHCTX "${PRODUCT_DIR_REGKEY}" "User" "$User"
943 IfErrors 0 +2
944 DetailPrint "fatal: failed to write to registry installation info"
946 ; start menu entries
947 ClearErrors
948 CreateShortCut "$SMPROGRAMS\Inkscape.lnk" "$INSTDIR\inkscape.exe"
949 IfErrors 0 +2
950 DetailPrint "fatal: failed to write to start menu info"
952 ; uninstall settings
953 ClearErrors
954 WriteUninstaller "$INSTDIR\uninst.exe"
955 WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "UninstallString" '"$INSTDIR\uninst.exe"'
956 WriteRegExpandStr SHCTX "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
957 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME} ${PRODUCT_VERSION}"
958 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\Inkscape.exe,0"
959 WriteRegStr SHCTX "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
960 WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoModify" "1"
961 WriteRegDWORD SHCTX "${PRODUCT_UNINST_KEY}" "NoRepair" "1"
962 IfErrors 0 +2
963 DetailPrint "fatal: failed to write to registry un-installation info"
964 SectionEnd
966 ; Last the Descriptions
967 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
968 !insertmacro MUI_DESCRIPTION_TEXT ${SecCore} $(lng_CoreDesc)
969 !insertmacro MUI_DESCRIPTION_TEXT ${SecGTK} $(lng_GTKFilesDesc)
970 !insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} $(lng_ShortcutsDesc)
971 !insertmacro MUI_DESCRIPTION_TEXT ${SecAlluser} $(lng_AlluserDesc)
972 !insertmacro MUI_DESCRIPTION_TEXT ${SecDesktop} $(lng_DesktopDesc)
973 !insertmacro MUI_DESCRIPTION_TEXT ${SecQuicklaunch} $(lng_QuicklaunchDesc)
974 !insertmacro MUI_DESCRIPTION_TEXT ${SecSVGWriter} $(lng_SVGWriterDesc)
975 !insertmacro MUI_DESCRIPTION_TEXT ${SecContextMenu} $(lng_ContextMenuDesc)
976 !insertmacro MUI_DESCRIPTION_TEXT ${SecPrefs} $(lng_DeletePrefsDesc)
977 !insertmacro MUI_DESCRIPTION_TEXT ${SecAddfiles} $(lng_AddfilesDesc)
978 !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} $(lng_ExamplesDesc)
979 !insertmacro MUI_DESCRIPTION_TEXT ${SecTutorials} $(lng_TutorialsDesc)
980 !insertmacro MUI_DESCRIPTION_TEXT ${SecLanguages} $(lng_LanguagesDesc)
981 !insertmacro MUI_FUNCTION_DESCRIPTION_END
983 !macro Parameter key Section
984 Push ${key}
985 Push ""
986 Call GetParameterValue
987 Pop $1
988 StrCmp $1 "OFF" 0 +5
989 SectionGetFlags ${Section} $0
990 IntOp $2 ${SF_SELECTED} ~
991 IntOp $0 $0 & $2
992 SectionSetFlags ${Section} $0
993 StrCmp $1 "ON" 0 +4
994 SectionGetFlags ${Section} $0
995 IntOp $0 $0 | ${SF_SELECTED}
996 SectionSetFlags ${Section} $0
997 !macroend
999 Function .onInit
1000 ;Extract InstallOptions INI files
1001 StrCpy $AskMultiUser "1"
1002 StrCpy $MultiUser "0"
1003 ; this resets AskMultiUser if Win95/98/ME
1004 Call GetWindowsVersion
1005 Pop $R0
1006 DetailPrint "detected operating system $R0"
1007 ;MessageBox MB_OK "operating system: $R0; AskMultiuser: $AskMultiUser"
1009 ; hide all user section if win98
1010 StrCmp $AskMultiUser "1" +2
1011 SectionSetText ${SecAlluser} ""
1013 ; hide if quick launch if not available
1014 StrCmp $QUICKLAUNCH $TEMP 0 +2
1015 SectionSetText ${SecQuicklaunch} ""
1017 ;check if user is admin
1018 ClearErrors
1019 UserInfo::GetName
1020 IfErrors info_Win9x
1021 Pop $0
1022 StrCpy $User $0
1023 UserInfo::GetAccountType
1024 Pop $1
1025 StrCmp $1 "Admin" info_done
1027 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NO_ADMIN)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK info_done IDCANCEL +1
1028 Quit
1030 Goto info_done
1032 info_Win9x:
1033 # This one means you don't need to care about admin or
1034 # not admin because Windows 9x doesn't either
1035 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_NOT_SUPPORTED)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK info_done IDCANCEL +1
1036 Quit
1038 info_done:
1040 ;check for previous installation
1041 ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
1042 StrCmp $0 "" +1 +2
1043 ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
1044 ;check user if applicable
1045 StrCmp $0 "" diff_user_install_done
1046 StrCmp $0 $User diff_user_install_done
1047 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK diff_user_install_done IDCANCEL +1
1048 Quit
1049 diff_user_install_done:
1051 ; call uninstall first
1052 ; code taken from the vlc project
1053 ReadRegStr $R0 HKLM ${PRODUCT_UNINST_KEY} "UninstallString"
1054 ReadRegStr $R1 HKLM ${PRODUCT_UNINST_KEY} "DisplayName"
1055 StrCmp $R0 "" +1 +3
1056 ReadRegStr $R0 HKCU ${PRODUCT_UNINST_KEY} "UninstallString"
1057 ReadRegStr $R1 HKCU ${PRODUCT_UNINST_KEY} "DisplayName"
1058 StrCmp $R0 "" uninstall_before_done
1060 MessageBox MB_YESNO|MB_ICONEXCLAMATION $(lng_WANT_UNINSTALL_BEFORE) /SD IDNO IDYES +1 IDNO uninstall_before_done
1061 ;Run the uninstaller
1062 ;uninst:
1063 ClearErrors
1064 ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
1065 uninstall_before_done:
1067 ; proccess command line parameter
1068 !insertmacro Parameter "GTK" ${SecGTK}
1069 !insertmacro Parameter "SHORTCUTS" ${secShortcuts}
1070 !insertmacro Parameter "ALLUSER" ${SecAlluser}
1071 !insertmacro Parameter "DESKTOP" ${SecDesktop}
1072 !insertmacro Parameter "QUICKLAUNCH" ${SecQUICKlaunch}
1073 !insertmacro Parameter "SVGEDITOR" ${SecSVGWriter}
1074 !insertmacro Parameter "CONTEXTMENUE" ${SecContextMenu}
1075 !insertmacro Parameter "PREFERENCES" ${SecPrefs}
1076 !insertmacro Parameter "ADDFILES" ${SecAddfiles}
1077 !insertmacro Parameter "EXAMPLES" ${SecExamples}
1078 !insertmacro Parameter "TUTORIALS" ${SecTutorials}
1079 !insertmacro Parameter "LANGUAGES" ${SecLanguages}
1080 !insertmacro Parameter "am" ${SecAmharic}
1081 !insertmacro Parameter "az" ${SecAzerbaijani}
1082 !insertmacro Parameter "be" ${SecByelorussian}
1083 !insertmacro Parameter "bg" ${SecBulgarian}
1084 !insertmacro Parameter "bn" ${SecBengali}
1085 !insertmacro Parameter "ca" ${SecCatalan}
1086 !insertmacro Parameter "cs" ${SecCzech}
1087 !insertmacro Parameter "da" ${SecDanish}
1088 !insertmacro Parameter "de" ${SecGerman}
1089 !insertmacro Parameter "dz" ${SecDzongkha}
1090 !insertmacro Parameter "el" ${SecGreek}
1091 !insertmacro Parameter "en_AU" ${SecEnglishAustralian}
1092 !insertmacro Parameter "en_CA" ${SecEnglishCanadian}
1093 !insertmacro Parameter "en_GB" ${SecEnglishBritain}
1094 !insertmacro Parameter "en_US@piglatin" ${SecEnglishPiglatin}
1095 !insertmacro Parameter "eo" ${SecEsperanto}
1096 !insertmacro Parameter "es" ${SecSpanish}
1097 !insertmacro Parameter "es_MX" ${SecSpanishMexico}
1098 !insertmacro Parameter "et" ${SecEstonian}
1099 !insertmacro Parameter "eu" ${SecBasque}
1100 !insertmacro Parameter "fi" ${SecFinnish}
1101 !insertmacro Parameter "fr" ${SecFrench}
1102 !insertmacro Parameter "ga" ${SecIrish}
1103 !insertmacro Parameter "gl" ${SecGallegan}
1104 !insertmacro Parameter "he" ${SecHebrew}
1105 !insertmacro Parameter "hr" ${SecCroatian}
1106 !insertmacro Parameter "hu" ${SecHungarian}
1107 !insertmacro Parameter "id" ${SecIndonesian}
1108 !insertmacro Parameter "it" ${SecItalian}
1109 !insertmacro Parameter "ja" ${SecJapanese}
1110 !insertmacro Parameter "km" ${SecKhmer}
1111 !insertmacro Parameter "ko" ${SecKorean}
1112 !insertmacro Parameter "lt" ${SecLithuanian}
1113 !insertmacro Parameter "mk" ${SecMacedonian}
1114 !insertmacro Parameter "mn" ${SecMongolian}
1115 !insertmacro Parameter "nb" ${SecNorwegianBokmal}
1116 !insertmacro Parameter "ne" ${SecNepali}
1117 !insertmacro Parameter "nl" ${SecDutch}
1118 !insertmacro Parameter "nn" ${SecNorwegianNynorsk}
1119 !insertmacro Parameter "pa" ${SecPanjabi}
1120 !insertmacro Parameter "pl" ${SecPolish}
1121 !insertmacro Parameter "pt" ${SecPortuguese}
1122 !insertmacro Parameter "pt_BR" ${SecPortugueseBrazil}
1123 !insertmacro Parameter "ro" ${SecRomanian}
1124 !insertmacro Parameter "ru" ${SecRussian}
1125 !insertmacro Parameter "rw" ${SecKinyarwanda}
1126 !insertmacro Parameter "sk" ${SecSlovak}
1127 !insertmacro Parameter "sl" ${SecSlovenian}
1128 !insertmacro Parameter "sq" ${SecAlbanian}
1129 !insertmacro Parameter "sr" ${SecSerbian}
1130 !insertmacro Parameter "sr@Latn" ${SecSerbianLatin}
1131 !insertmacro Parameter "sv" ${SecSwedish}
1132 !insertmacro Parameter "th" ${SecThai}
1133 !insertmacro Parameter "tr" ${SecTurkish}
1134 !insertmacro Parameter "uk" ${SecUkrainian}
1135 !insertmacro Parameter "vi" ${SecVietnamese}
1136 !insertmacro Parameter "zh_CN" ${SecChineseSimplified}
1137 !insertmacro Parameter "zh_TW" ${SecChineseTaiwan}
1139 Push "?"
1140 Push "TEST"
1141 Call GetParameterValue
1142 Pop $1
1143 StrCmp $1 "TEST" +3
1144 MessageBox MB_OK "possible parameters for installer:$\r$\n \
1145 /?: this help screen$\r$\n \
1146 /S: silent$\r$\n \
1147 /D=(directory): where to install inkscape$\r$\n \
1148 /GTK=(OFF/ON): GTK+ Runtime environment$\r$\n \
1149 /SHORTCUTS=(OFF/ON): shortcuts to start inkscape$\r$\n \
1150 /ALLUSER=(OFF/ON): for all users on the computer$\r$\n \
1151 /DESKTOP=(OFF/ON): Desktop icon$\r$\n \
1152 /QUICKLAUNCH=(OFF/ON): quick launch icon$\r$\n \
1153 /SVGEDITOR=(OFF/ON): default SVG editor$\r$\n \
1154 /CONTEXTMENUE=(OFF/ON): context menue integration$\r$\n \
1155 /PREFERENCES=(OFF/ON): delete users preference files$\r$\n \
1156 /ADDFILES=(OFF/ON): additional files$\r$\n \
1157 /EXAMPLES=(OFF/ON): examples$\r$\n \
1158 /TUTORIALS=(OFF/ON): tutorials$\r$\n \
1159 /LANGUAGES=(OFF/ON): translated menues, examples, etc.$\r$\n \
1160 /[locale code]=(OFF/ON): e.g am, es, es_MX as in Inkscape supported"
1161 Abort
1162 FunctionEnd
1164 Function .onSelChange
1165 FunctionEnd
1167 ; --------------------------------------------------
1169 Function un.CustomPageUninstall
1170 !insertmacro MUI_HEADER_TEXT "$(lng_UInstOpt)" "$(lng_UInstOpt1)"
1171 !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 1" "Text" "$APPDATA\Inkscape\"
1172 !insertmacro MUI_INSTALLOPTIONS_WRITE "inkscape.nsi.uninstall" "Field 2" "Text" "$(lng_PurgePrefs)"
1174 !insertmacro MUI_INSTALLOPTIONS_DISPLAY "inkscape.nsi.uninstall"
1175 !insertmacro MUI_INSTALLOPTIONS_READ $MultiUser "inkscape.nsi.uninstall" "Field 2" "State"
1176 DetailPrint "keepfiles = $MultiUser"
1177 ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser"
1179 FunctionEnd
1182 Function un.onInit
1183 ClearErrors
1184 StrCpy $User ""
1185 UserInfo::GetName
1186 IfErrors +3
1187 Pop $0
1188 StrCpy $User $0
1190 StrCpy $askMultiUser "1"
1191 StrCpy $MultiUser "1"
1193 ; Test if this was a multiuser installation
1194 ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" ""
1195 StrCmp $0 "$INSTDIR\inkscape.exe" 0 hkcu_user_uninstall
1196 ReadRegStr $MultiUser HKLM "${PRODUCT_DIR_REGKEY}" "MultiUser"
1197 ReadRegStr $askMultiUser HKLM "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1198 ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" "User"
1199 Goto check_user_uninstall
1200 hkcu_user_uninstall:
1201 ReadRegStr $MultiUser HKCU "${PRODUCT_DIR_REGKEY}" "MultiUser"
1202 ReadRegStr $askMultiUser HKCU "${PRODUCT_DIR_REGKEY}" "askMultiUser"
1203 ReadRegStr $0 HKCU "${PRODUCT_DIR_REGKEY}" "User"
1204 ;check user if applicable
1205 check_user_uninstall:
1206 StrCmp $0 "" diff_user_uninstall_done
1207 StrCmp $0 $User diff_user_uninstall_done
1208 MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "$(lng_DIFFERENT_USER)$(lng_OK_CANCEL_DESC)" /SD IDOK IDOK diff_user_uninstall_done IDCANCEL +1
1209 Quit
1210 diff_user_uninstall_done:
1212 !insertmacro MUI_INSTALLOPTIONS_EXTRACT "inkscape.nsi.uninstall"
1214 ;check whether Multi user installation ?
1215 SetShellVarContext all
1216 StrCmp $MultiUser "0" 0 +2
1217 SetShellVarContext current
1218 ;MessageBox MB_OK "adminmode = $MultiUser MultiUserOS = $askMultiUser"
1220 FunctionEnd
1222 Section Uninstall
1224 ; remove personal settings
1225 Delete "$APPDATA\Inkscape\extension-errors.log"
1226 StrCmp $MultiUser "0" 0 endPurge ; multiuser assigned in dialog
1227 DetailPrint "purge personal settings in $APPDATA\Inkscape"
1228 ;RMDir /r "$APPDATA\Inkscape"
1229 !insertmacro delprefs
1230 endPurge:
1232 ; Remove file associations for svg editor
1233 DetailPrint "removing file associations for svg editor"
1234 ClearErrors
1235 ReadRegStr $0 HKCR ".svg" ""
1236 DetailPrint ".svg associated as $0"
1237 IfErrors endUninstSVGEdit
1238 ReadRegStr $1 HKCR "$0\shell\edit\command" ""
1239 IfErrors 0 +2
1240 DetailPrint "svg editor is $1"
1241 StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1242 DetailPrint "removing default .svg editor"
1243 DeleteRegKey HKCR "$0\shell\edit\command"
1244 DeleteRegKey /ifempty HKCR "$0\shell\edit"
1245 DeleteRegKey /ifempty HKCR "$0\shell"
1246 DeleteRegKey /ifempty HKCR "$0"
1247 endUninstSVGEdit:
1249 ClearErrors
1250 ReadRegStr $2 HKCR ".svgz" ""
1251 DetailPrint ".svgz associated as $2"
1252 IfErrors endUninstSVGZEdit
1253 ReadRegStr $3 HKCR "$2\shell\edit\command" ""
1254 IfErrors 0 +2
1255 DetailPrint "svgz editor is $1"
1256 StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1257 DetailPrint "removing default .svgz editor"
1258 DeleteRegKey HKCR "$2\shell\edit\command"
1259 DeleteRegKey /ifempty HKCR "$2\shell\edit"
1260 DeleteRegKey /ifempty HKCR "$2\shell"
1261 DeleteRegKey /ifempty HKCR "$2"
1262 endUninstSVGZEdit:
1264 ; Remove file associations for svg editor
1265 DetailPrint "removing file associations for svg editor"
1266 ClearErrors
1267 ReadRegStr $0 HKCR ".svg" ""
1268 IfErrors endUninstSVGView
1269 ReadRegStr $1 HKCR "$0\shell\open\command" ""
1270 IfErrors 0 +2
1271 DetailPrint "svg viewer is $1"
1272 StrCmp $1 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1273 DetailPrint "removing default .svg viewer"
1274 DeleteRegKey HKCR "$0\shell\open\command"
1275 DeleteRegKey /ifempty HKCR "$0\shell\open"
1276 DeleteRegKey /ifempty HKCR "$0\shell"
1277 DeleteRegKey /ifempty HKCR "$0"
1278 endUninstSVGView:
1280 ClearErrors
1281 ReadRegStr $2 HKCR ".svgz" ""
1282 IfErrors endUninstSVGZView
1283 ReadRegStr $3 HKCR "$2\shell\open\command" ""
1284 IfErrors 0 +2
1285 DetailPrint "svgz viewer is $1"
1286 StrCmp $3 '"$INSTDIR\Inkscape.exe" "%1"' 0 +3
1287 DetailPrint "removing default .svgz viewer"
1288 DeleteRegKey HKCR "$2\shell\open\command"
1289 DeleteRegKey /ifempty HKCR "$2\shell\open"
1290 DeleteRegKey /ifempty HKCR "$2\shell"
1291 DeleteRegKey /ifempty HKCR "$2"
1292 endUninstSVGZView:
1294 ; Remove file associations for context menue
1295 DetailPrint "removing file associations for svg editor"
1296 ClearErrors
1297 ReadRegStr $0 HKCR ".svg" ""
1298 IfErrors endUninstSVGContext
1299 DetailPrint "removing default .svg context menue"
1300 DeleteRegKey HKCR "$0\shell\${PRODUCT_NAME}"
1301 DeleteRegKey /ifempty HKCR "$0\shell"
1302 DeleteRegKey /ifempty HKCR "$0"
1303 endUninstSVGContext:
1305 ClearErrors
1306 ReadRegStr $2 HKCR ".svgz" ""
1307 IfErrors endUninstSVGZContext
1308 DetailPrint "removing default .svgzcontext menue"
1309 DeleteRegKey HKCR "$2\shell\${PRODUCT_NAME}"
1310 DeleteRegKey /ifempty HKCR "$2\shell"
1311 DeleteRegKey /ifempty HKCR "$2"
1312 endUninstSVGZContext:
1314 ReadRegStr $1 HKCR "$0" ""
1315 StrCmp $1 "" 0 +3
1316 DetailPrint "removing filetype .svg $0"
1317 DeleteRegKey HKCR ".svg"
1319 ReadRegStr $3 HKCR "$2" ""
1320 StrCmp $3 "" 0 +3
1321 DetailPrint "removing filetype .svgz $2"
1322 DeleteRegKey HKCR ".svgz"
1325 SetShellVarContext all
1326 DetailPrint "removing product regkey"
1327 DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1328 DetailPrint "removing uninstall info"
1329 DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1330 DetailPrint "removing shortcuts"
1331 Delete "$DESKTOP\Inkscape.lnk"
1332 Delete "$QUICKLAUNCH\Inkscape.lnk"
1333 Delete "$SMPROGRAMS\Inkscape.lnk"
1334 ;just in case they are still there
1335 Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1336 Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1337 RMDir "$SMPROGRAMS\Inkscape"
1339 SetShellVarContext current
1340 DetailPrint "removing product regkey"
1341 DeleteRegKey SHCTX "${PRODUCT_DIR_REGKEY}"
1342 DetailPrint "removing uninstall info"
1343 DeleteRegKey SHCTX "${PRODUCT_UNINST_KEY}"
1344 DetailPrint "removing shortcuts"
1345 Delete "$DESKTOP\Inkscape.lnk"
1346 Delete "$QUICKLAUNCH\Inkscape.lnk"
1347 Delete "$SMPROGRAMS\Inkscape.lnk"
1348 ;just in case they are still there
1349 Delete "$SMPROGRAMS\Inkscape\Uninstall Inkscape.lnk"
1350 Delete "$SMPROGRAMS\Inkscape\Inkscape.lnk"
1351 RMDir "$SMPROGRAMS\Inkscape"
1353 DetailPrint "removing uninstall info"
1354 RMDir /r "$INSTDIR"
1356 SetAutoClose false
1358 SectionEnd