[dia] Add librsvg support to the pixbuf loader, enable SVG in standard image object.



commit 2d7d253b26ac7f8f08cae8e9d722e329b948017d
Author: Steffen Macke <sdteffen sdteffen de>
Date:   Wed Jan 13 22:39:17 2010 +0100

    Add librsvg support to the pixbuf loader, enable SVG in standard image object.

 installer/win32/dia.nsi |  167 ++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 150 insertions(+), 17 deletions(-)
---
diff --git a/installer/win32/dia.nsi b/installer/win32/dia.nsi
index a9d1d00..fd43a6b 100644
--- a/installer/win32/dia.nsi
+++ b/installer/win32/dia.nsi
@@ -1,9 +1,9 @@
 ; Dia -- an diagram creation/manipulation program
-; Copyright (C) 1998-2008 Alexander Larsson, Lars Clausen and others
+; Copyright (C) 1998-2010 Alexander Larsson, Lars Clausen and others
 ;  
 ; dia-installer.nsi : Nullsoft Installation System (NSIS) script
 ; Copyright (C) 2000-2004 Herman Bloggs, Steffen Macke
-; Copyright (C) 2005-2009 Steffen Macke <sdteffen sdteffen de>
+; Copyright (C) 2005-2010 Steffen Macke <sdteffen sdteffen de>
 ;  
 ; This program is free software; you can redistribute it and/or modify
 ; it under the terms of the GNU General Public License as published by
@@ -54,6 +54,13 @@ Var GTKBIN
  FileWrite $UninstLog "${PATH}$\r$\n"
 !macroend
 !define SetOutPath "!insertmacro SetOutPath"
+
+!macro ReplaceInFile SOURCE_FILE SEARCH_TEXT REPLACEMENT
+  Push "${SOURCE_FILE}"
+  Push "${SEARCH_TEXT}"
+  Push "${REPLACEMENT}"
+  Call RIF
+!macroend
  
 Section -openlogfile
  SetOutPath "$INSTDIR"
@@ -243,29 +250,29 @@ Section $(DIA_SECTION_TITLE) SecDia
     WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\open\command" "" '"$INSTDIR\bin\dia-win-remote.exe" diaw.exe --integrated "%1"'
     WriteRegStr HKEY_CLASSES_ROOT "diaFile\DefaultIcon" "" "$INSTDIR\etc\dia-diagram.ico,0"
     WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createcgm" "" "Create CGM image"
-    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createcgm\command" "" '"$INSTDIR\bin\dia.exe" -t cgm "%1"'
+    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createcgm\command" "" '"$INSTDIR\bin\diaw.exe" -t cgm "%1"'
     WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createdxf" "" "Create DXF drawing"
-    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createdxf\command" "" '"$INSTDIR\bin\dia.exe" -t dxf "%1"'
+    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createdxf\command" "" '"$INSTDIR\bin\diaw.exe" -t dxf "%1"'
     WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createeps" "" "Create EPS file"
-    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createeps\command" "" '"$INSTDIR\bin\dia.exe" -t eps "%1"'
+    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createeps\command" "" '"$INSTDIR\bin\diaw.exe" -t eps "%1"'
     WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createhpgl" "" "Create HPGL file"
-    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createhpgl\command" "" '"$INSTDIR\bin\dia.exe" -t hpgl "%1"'
+    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createhpgl\command" "" '"$INSTDIR\bin\diaw.exe" -t hpgl "%1"'
     WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createmp" "" "Create TeX Metapost macros"
-    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createmp\command" "" '"$INSTDIR\bin\dia.exe" -t mp "%1"'
+    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createmp\command" "" '"$INSTDIR\bin\diaw.exe" -t mp "%1"'
     WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createpng" "" "Create PNG image"
-    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createpng\command" "" '"$INSTDIR\bin\dia.exe" -t png "%1"'
+    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createpng\command" "" '"$INSTDIR\bin\diaw.exe" -t png "%1"'
     WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createsvg" "" "Create SVG image"
-    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createsvg\command" "" '"$INSTDIR\bin\dia.exe" -t svg "%1"'
+    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createsvg\command" "" '"$INSTDIR\bin\diaw.exe" -t svg "%1"'
     WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createshape" "" "Create dia shape"
-    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createshape\command" "" '"$INSTDIR\bin\dia.exe" -t shape "%1"'
+    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createshape\command" "" '"$INSTDIR\bin\diaw.exe" -t shape "%1"'
     WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createtex" "" "Create TeX PSTricks macros"
-    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createtex\command" "" '"$INSTDIR\bin\dia.exe" -t tex "%1"'
+    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createtex\command" "" '"$INSTDIR\bin\diaw.exe" -t tex "%1"'
     WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createwmf" "" "Create Windows Meta File"
-    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createwmf\command" "" '"$INSTDIR\bin\dia.exe" -t wmf "%1"'
+    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createwmf\command" "" '"$INSTDIR\bin\diaw.exe" -t wmf "%1"'
     WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createwpg" "" "Create WPG image"
-    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createwpg\command" "" '"$INSTDIR\bin\dia.exe" -t wpg "%1"'
+    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createwpg\command" "" '"$INSTDIR\bin\diaw.exe" -t wpg "%1"'
     WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createfig" "" "Create XFig drawing"
-    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createfig\command" "" '"$INSTDIR\bin\dia.exe" -t fig "%1"'
+    WriteRegStr HKEY_CLASSES_ROOT "diaFile\Shell\createfig\command" "" '"$INSTDIR\bin\diaw.exe" -t fig "%1"'
 
 ${SetOutPath} "$INSTDIR"
 ${File} "..\..\data\" "dia-splash.png"
@@ -2347,15 +2354,17 @@ ${SetOutPath} "$INSTDIR\bin"
 ;${File} "..\..\..\bin\" "charset.dll"
 ;${File} "..\..\..\bin\" "gspawn-win32-helper-console.exe"
 ;${File} "..\..\..\bin\" "gspawn-win32-helper.exe"
+${File} "..\..\..\bin\" "bzip2.dll"
 ${File} "..\..\..\bin\" "iconv.dll"
 ;${File} "..\..\..\bin\" "iconv.exe"
 ${File} "..\..\..\bin\" "intl.dll"
 ${File} "..\..\..\bin\" "jpeg62.dll"
 ${File} "..\..\..\bin\" "libatk-1.0-0.dll"
 ${File} "..\..\..\bin\" "libcairo-2.dll"
-;${File} "..\..\..\bin\" "libexpat.dll"
-;${File} "..\..\..\bin\" "libfontconfig-1.dll"
-;${File} "..\..\..\bin\" "freetype6.dll"
+${File} "..\..\..\bin\" "libcroco-0.6-3.dll"
+${File} "..\..\..\bin\" "libexpat-1.dll"
+${File} "..\..\..\bin\" "libfontconfig-1.dll"
+${File} "..\..\..\bin\" "freetype6.dll"
 ; TODO: Remove the following, once gladewin32 has switched to freetype6.dll
 ;${File} "..\..\..\bin\" "libfreetype-6.dll"
 ${File} "..\..\..\bin\" "libgailutil-18.dll"
@@ -2365,6 +2374,7 @@ ${File} "..\..\..\bin\" "libgio-2.0-0.dll"
 ${File} "..\..\..\bin\" "libglib-2.0-0.dll"
 ${File} "..\..\..\bin\" "libgmodule-2.0-0.dll"
 ${File} "..\..\..\bin\" "libgobject-2.0-0.dll"
+${File} "..\..\..\bin\" "libgsf-1-114.dll"
 ${File} "..\..\..\bin\" "libgthread-2.0-0.dll"
 ${File} "..\..\..\bin\" "libgtk-win32-2.0-0.dll"
 ${File} "..\..\..\bin\" "libpango-1.0-0.dll"
@@ -2373,9 +2383,11 @@ ${File} "..\..\..\bin\" "libpangoft2-1.0-0.dll"
 ${File} "..\..\..\bin\" "libpangowin32-1.0-0.dll"
 ;${File} "..\..\..\bin\" "libpng12.dll"
 ${File} "..\..\..\bin\" "libpng12-0.dll"
+${File} "..\..\..\bin\" "librsvg-2-2.dll"
 ;${File} "..\..\..\bin\" "librle3.dll"
 ${File} "..\..\..\bin\" "libtiff3.dll"
 ${File} "..\..\..\bin\" "libxml2.dll"
+CopyFiles "$INSTDIR\bin\libxml2.dll" "$INSTDIR\bin\libxml2-2.dll"
 ${File} "..\..\..\bin\" "pango-querymodules.exe"
 ;${File} "..\..\..\bin\" "xmlparse.dll"
 ;${File} "..\..\..\bin\" "xmltok.dll"
@@ -2385,6 +2397,9 @@ ${SetOutPath} "$INSTDIR\etc"
 ;${File} "..\..\..\etc\fonts\" "fonts.conf"
 ${SetOutPath} "$INSTDIR\etc\gtk-2.0"
 ${File} "..\..\..\etc\gtk-2.0\" "gdk-pixbuf.loaders"
+
+!insertmacro ReplaceInFile "$INSTDIR\etc\gtk-2.0\gdk-pixbuf.loaders" "c:/gtk/dia" "$INSTDIR"
+
 ${File} "..\..\..\etc\gtk-2.0\" "gtk.immodules"
 # Workaround 0.96.1 installer bug
 RMDir "$INSTDIR\etc\gtk-2.0\gtkrc"
@@ -2426,6 +2441,7 @@ ${File} "..\..\..\lib\gtk-2.0\2.10.0\loaders\" "libpixbufloader-tiff.dll"
 ${File} "..\..\..\lib\gtk-2.0\2.10.0\loaders\" "libpixbufloader-wbmp.dll"
 ${File} "..\..\..\lib\gtk-2.0\2.10.0\loaders\" "libpixbufloader-xbm.dll"
 ${File} "..\..\..\lib\gtk-2.0\2.10.0\loaders\" "libpixbufloader-xpm.dll"
+${File} "..\..\..\lib\gtk-2.0\2.10.0\loaders\" "svg_loader.dll"
 
 ${SetOutPath} "$INSTDIR\share"
 ${SetOutPath} "$INSTDIR\share\themes"
@@ -3400,6 +3416,7 @@ Section Uninstall
       SetShellVarContext "all"
 
   cont_uninstall:
+	Delete "$INSTDIR\bin\libxml2-2.dll"
     DeleteRegKey HKEY_CLASSES_ROOT "diaFile"
     DeleteRegKey HKEY_CLASSES_ROOT ".dia"
     
@@ -3964,3 +3981,119 @@ Function LaunchDia
   ExecShell "" "$SMPROGRAMS\Dia\Dia.lnk"
 
 FunctionEnd
+
+;  ReplaceInFile from http://nsis.sourceforge.net/ReplaceInFile 
+
+Function RIF
+ 
+  ClearErrors  ; want to be a newborn
+ 
+  Exch $0      ; REPLACEMENT
+  Exch
+  Exch $1      ; SEARCH_TEXT
+  Exch 2
+  Exch $2      ; SOURCE_FILE
+ 
+  Push $R0     ; SOURCE_FILE file handle
+  Push $R1     ; temporary file handle
+  Push $R2     ; unique temporary file name
+  Push $R3     ; a line to sar/save
+  Push $R4     ; shift puffer
+ 
+  IfFileExists $2 +1 RIF_error      ; knock-knock
+  FileOpen $R0 $2 "r"               ; open the door
+ 
+  GetTempFileName $R2               ; who's new?
+  FileOpen $R1 $R2 "w"              ; the escape, please!
+ 
+  RIF_loop:                         ; round'n'round we go
+    FileRead $R0 $R3                ; read one line
+    IfErrors RIF_leaveloop          ; enough is enough
+    RIF_sar:                        ; sar - search and replace
+      Push "$R3"                    ; (hair)stack
+      Push "$1"                     ; needle
+      Push "$0"                     ; blood
+      Call StrReplace               ; do the bartwalk
+      StrCpy $R4 "$R3"              ; remember previous state
+      Pop $R3                       ; gimme s.th. back in return!
+      StrCmp "$R3" "$R4" +1 RIF_sar ; loop, might change again!
+    FileWrite $R1 "$R3"             ; save the newbie
+  Goto RIF_loop                     ; gimme more
+ 
+  RIF_leaveloop:                    ; over'n'out, Sir!
+    FileClose $R1                   ; S'rry, Ma'am - clos'n now
+    FileClose $R0                   ; me 2
+ 
+    Delete "$2.old"                 ; go away, Sire
+    Rename "$2" "$2.old"            ; step aside, Ma'am
+    Rename "$R2" "$2"               ; hi, baby!
+ 
+    ClearErrors                     ; now i AM a newborn
+    Goto RIF_out                    ; out'n'away
+ 
+  RIF_error:                        ; ups - s.th. went wrong...
+    SetErrors                       ; ...so cry, boy!
+ 
+  RIF_out:                          ; your wardrobe?
+  Pop $R4
+  Pop $R3
+  Pop $R2
+  Pop $R1
+  Pop $R0
+  Pop $2
+  Pop $0
+  Pop $1
+ 
+FunctionEnd
+
+; StrReplace
+; Replaces all ocurrences of a given needle within a haystack with another string
+; Written by dandaman32
+ 
+Var STR_REPLACE_VAR_0
+Var STR_REPLACE_VAR_1
+Var STR_REPLACE_VAR_2
+Var STR_REPLACE_VAR_3
+Var STR_REPLACE_VAR_4
+Var STR_REPLACE_VAR_5
+Var STR_REPLACE_VAR_6
+Var STR_REPLACE_VAR_7
+Var STR_REPLACE_VAR_8
+ 
+Function StrReplace
+  Exch $STR_REPLACE_VAR_2
+  Exch 1
+  Exch $STR_REPLACE_VAR_1
+  Exch 2
+  Exch $STR_REPLACE_VAR_0
+    StrCpy $STR_REPLACE_VAR_3 -1
+    StrLen $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_1
+    StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
+    loop:
+      IntOp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_3 + 1
+      StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_3
+      StrCmp $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_1 found
+      StrCmp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_6 done
+      Goto loop
+    found:
+      StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_3
+      IntOp $STR_REPLACE_VAR_8 $STR_REPLACE_VAR_3 + $STR_REPLACE_VAR_4
+      StrCpy $STR_REPLACE_VAR_7 $STR_REPLACE_VAR_0 "" $STR_REPLACE_VAR_8
+      StrCpy $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_5$STR_REPLACE_VAR_2$STR_REPLACE_VAR_7
+      StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
+      Goto loop
+    done:
+  Pop $STR_REPLACE_VAR_1 ; Prevent "invalid opcode" errors and keep the
+  Pop $STR_REPLACE_VAR_1 ; stack as it was before the function was called
+  Exch $STR_REPLACE_VAR_0
+FunctionEnd
+ 
+!macro _strReplaceConstructor OUT NEEDLE NEEDLE2 HAYSTACK
+  Push "${HAYSTACK}"
+  Push "${NEEDLE}"
+  Push "${NEEDLE2}"
+  Call StrReplace
+  Pop "${OUT}"
+!macroend
+ 
+!define StrReplace '!insertmacro "_strReplaceConstructor"'
\ No newline at end of file



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]