diff --git a/ChangeLog b/ChangeLog index 73722c341..9bb17c64b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-01-11 Mike Kestner + + * configure.in : add test for System.Drawing. expand gtkdotnet. + * Makefile.am : add gtkdotnet. + * makefile.win32 : add gtkdotnet. + * gtkdotnet/* : new .Net extensions assembly. Moved the sample + sysdraw.cs Graphics class in here under the Gtk.DotNet namespace. + * sample/sysdraw.cs : moved to gtkdotnet/Graphics.cs. + * sample/drawing-sample.exe.config.in : killed. + * sample/DrawingSample.cs : use Gtk.DotNet.Graphics. + * sample/Makefile.am : make drawing-sample.exe build conditional + on gtk-dotnet presence. + 2005-01-11 Mike Kestner * gdk/Window.custom : add AddFilterForAll and RemoveFilterForAll diff --git a/Makefile.am b/Makefile.am index d742ad58f..aea223aa3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = sources generator parser glib pango atk gdk gtk glade art gnomevfs gnome gda gnomedb gtkhtml gconf rsvg vte sample doc +SUBDIRS = sources generator parser glib pango atk gdk gtk glade art gnomevfs gnome gda gnomedb gtkhtml gconf rsvg vte gtkdotnet sample doc EXTRA_DIST = \ gtk-sharp.snk \ diff --git a/configure.in b/configure.in index 8d3b7a208..d31581e16 100644 --- a/configure.in +++ b/configure.in @@ -102,6 +102,13 @@ if test "x$GACUTIL" = "xno" ; then AC_MSG_ERROR([No gacutil tool found]) fi +SDCHECK="`$GACUTIL /l |grep ^System.Drawing, |cut -f1 -d','`" +if test "x$SDCHECK" = "xSystem.Drawing"; then + enable_dotnet=yes +else + enable_dotnet=no +fi + AC_SUBST(RUNTIME) AC_SUBST(CSC) AC_SUBST(GACUTIL) @@ -199,7 +206,7 @@ AM_CONDITIONAL(ENABLE_RSVG, test "x$enable_rsvg" = "xyes") AM_CONDITIONAL(ENABLE_GTKHTML, test "x$enable_gtkhtml" = "xyes") AM_CONDITIONAL(ENABLE_VTE, test "x$enable_vte" = "xyes") AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_monodoc" = "xyes") - +AM_CONDITIONAL(ENABLE_DOTNET, test "x$enable_dotnet" = "xyes") AC_SUBST(CFLAGS) @@ -265,6 +272,9 @@ rsvg/rsvg-sharp-2.0.pc vte/Makefile vte/vte-sharp.dll.config vte/vte-sharp-2.0.pc +gtkdotnet/Makefile +gtkdotnet/gtk-dotnet.dll.config +gtkdotnet/gtk-dotnet-2.0.pc doc/Makefile doc/updater/Makefile sample/GtkDemo/Makefile @@ -274,7 +284,6 @@ sample/gnomevfs/Makefile sample/pixmaps/Makefile sample/rsvg/Makefile sample/test/Makefile -sample/drawing-sample.exe.config sample/cairo-sample.exe.config ]) @@ -295,6 +304,7 @@ echo " * gnomedb-sharp.dll: $enable_gnomedb" echo " * rsvg-sharp.dll: $enable_rsvg " echo " * gtkhtml-sharp.dll: $enable_gtkhtml " echo " * vte-sharp.dll: $enable_vte " +echo " * gtk-dotnet.dll: $enable_dotnet " echo "" echo " NOTE: if any of the above say 'no' you may install the" echo " corresponding development packages for them, rerun" diff --git a/doc/Makefile.am b/doc/Makefile.am index b66391d24..1caf56734 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -51,8 +51,14 @@ else VTE_DIR = endif -UPDATE_DIRS=glib pango atk gdk gtk glade $(GNOME_VFS_DIR) $(GNOME_DIR) $(GDA_DIR) $(GNOMEDB_DIR) $(RSVG_DIR) $(GTKHTML_DIR) $(VTE_DIR) -NAMESPACES=GLib Pango Atk Gdk Gtk Glade Art Gnome.Vfs Gnome Gda GnomeDb GConf GConf.PropertyEditors Rsvg Vte +if ENABLE_DOTNET +DOTNET_DIR = gtkdotnet +else +DOTNET_DIR = +endif + +UPDATE_DIRS=glib pango atk gdk gtk glade $(GNOME_VFS_DIR) $(GNOME_DIR) $(GDA_DIR) $(GNOMEDB_DIR) $(RSVG_DIR) $(GTKHTML_DIR) $(VTE_DIR) $(DOTNET_DIR) +NAMESPACES=GLib Pango Atk Gdk Gtk Gtk.DotNet Glade Art Gnome.Vfs Gnome Gda GnomeDb GConf GConf.PropertyEditors Rsvg Vte assemble: gtk-sharp-docs.zip gtk-sharp-docs.tree diff --git a/doc/en/Gtk.DotNet.xml b/doc/en/Gtk.DotNet.xml new file mode 100644 index 000000000..14b6737ab --- /dev/null +++ b/doc/en/Gtk.DotNet.xml @@ -0,0 +1,13 @@ + + + Extension to the Gtk Widget set for .Net interoperability. + + + The functionality provided in this namespace is aimed at utilizing + the power of the non-ECMA portions of .Net like System.Drawing and + System.Data for the development of Gtk applications. This namespace + is provided by the gtk-dotnet assembly. + + + + diff --git a/doc/en/Gtk.DotNet/Graphics.xml b/doc/en/Gtk.DotNet/Graphics.xml new file mode 100644 index 000000000..9b81242a9 --- /dev/null +++ b/doc/en/Gtk.DotNet/Graphics.xml @@ -0,0 +1,38 @@ + + + + gtk-dotnet + [00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 71 EB 6C 55 75 52 9C BF 72 44 F7 A6 EA 05 62 84 F9 EA E0 3B CF F2 CC 13 2C 9C 49 0A B3 09 EA B0 B5 6B CE 44 9D F5 03 D9 C0 A8 1E 52 05 85 CD BE 70 E2 FB 90 43 4B AC 04 FA 62 22 A8 00 98 B7 A1 A7 B3 AF 99 1A 41 23 24 BB 43 25 F6 B8 65 BB 64 EB F6 D1 C2 06 D5 73 2D DF BC 70 A7 38 9E E5 3E 0C 24 6E 32 79 74 1A D0 05 03 E4 98 42 E1 9B F3 7B 19 8B 40 21 26 CB 36 89 C2 EA 64 96 A4 7C B4] + 2.0.0.0 + neutral + + + Gtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details. + + Gdk to System.Drawing.Graphics interoperability. + + + + System.Object + + + + + + + Method + + System.Drawing.Graphics + + + + + + Gets a Graphics context for a drawable. + a + a + + + + + diff --git a/sample/sysdraw.cs b/gtkdotnet/Graphics.cs similarity index 61% rename from sample/sysdraw.cs rename to gtkdotnet/Graphics.cs index cc04674dc..5109f9008 100644 --- a/sample/sysdraw.cs +++ b/gtkdotnet/Graphics.cs @@ -1,8 +1,24 @@ +// Graphics.cs - System.Drawing integration with Gtk# // -// System.Drawing integration with Gtk# +// Author: Miguel de Icaza // -// Miguel de Icaza +// Copyright (c) 2004 Novell, Inc. // +// This program is free software; you can redistribute it and/or +// modify it under the terms of version 2 of the Lesser GNU General +// Public License as published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + + // API issues: // Maybe make the translation `out' parameters so they are explicit and the user knows about it? // Add a way to copy a Graphics into a drawable? @@ -12,9 +28,11 @@ using System; using System.Reflection; using System.Runtime.InteropServices; -namespace Gdk { +namespace Gtk.DotNet { public class Graphics { + private Graphics () {} + [DllImport("libgdk-win32-2.0-0.dll")] internal static extern IntPtr gdk_x11_drawable_get_xdisplay (IntPtr raw); @@ -27,9 +45,9 @@ namespace Gdk { int x_off = 0, y_off = 0; - if (drawable is Gdk.Window){ + if (drawable is Gdk.Window) ((Gdk.Window) drawable).GetInternalPaintInfo(out drawable, out x_off, out y_off); - } + x_drawable = drawable.Handle; IntPtr display = gdk_x11_drawable_get_xdisplay (x_drawable); diff --git a/gtkdotnet/Makefile.am b/gtkdotnet/Makefile.am new file mode 100644 index 000000000..fe54e3127 --- /dev/null +++ b/gtkdotnet/Makefile.am @@ -0,0 +1,46 @@ +if ENABLE_DOTNET +TARGET = $(ASSEMBLY) $(ASSEMBLY).config +pkgconfigdir=$(libdir)/pkgconfig +pkgconfig_DATA=gtk-dotnet-2.0.pc +else +TARGET = +endif + +ASSEMBLY = $(ASSEMBLY_NAME).dll +ASSEMBLY_NAME = gtk-dotnet +noinst_DATA = $(TARGET) +CLEANFILES = $(ASSEMBLY) gtk-sharp.snk +DISTCLEANFILES = $(ASSEMBLY).config + +references = ../gdk/gdk-sharp.dll +build_references = $(addprefix -r:, $(references)) -r:System.Drawing + +sources = \ + Graphics.cs + +build_sources = $(addprefix $(srcdir)/, $(sources)) ../AssemblyInfo.cs + +EXTRA_DIST = \ + $(sources) \ + $(ASSEMBLY).config.in \ + gtk-dotnet-2.0.pc.in \ + makefile.win32 + +gtk-sharp.snk: $(top_srcdir)/gtk-sharp.snk + cp $(top_srcdir)/gtk-sharp.snk . + +$(ASSEMBLY): $(build_sources) $(references) gtk-sharp.snk + $(CSC) /nowarn:0612 /out:$(ASSEMBLY) /target:library $(build_references) $(build_sources) + +install-data-local: + @if test -n '$(TARGET)'; then \ + echo "$(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS)"; \ + $(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS) || exit 1; \ + fi + +uninstall-local: + @if test -n '$(TARGET)'; then \ + echo "$(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS)"; \ + $(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS) || exit 1; \ + fi + diff --git a/gtkdotnet/gtk-dotnet-2.0.pc.in b/gtkdotnet/gtk-dotnet-2.0.pc.in new file mode 100644 index 000000000..f40fb20bd --- /dev/null +++ b/gtkdotnet/gtk-dotnet-2.0.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib + + +Name: Gtk.DotNet +Description: .NET Extensions for Gtk +Version: @VERSION@ +Requires:gtk-sharp-2.0 +Libs: -r:${libdir}/mono/@PACKAGE_VERSION@/gtk-dotnet.dll diff --git a/gtkdotnet/gtk-dotnet.dll.config.in b/gtkdotnet/gtk-dotnet.dll.config.in new file mode 100644 index 000000000..75550978e --- /dev/null +++ b/gtkdotnet/gtk-dotnet.dll.config.in @@ -0,0 +1,3 @@ + + + diff --git a/gtkdotnet/makefile.win32 b/gtkdotnet/makefile.win32 new file mode 100644 index 000000000..e4be0d482 --- /dev/null +++ b/gtkdotnet/makefile.win32 @@ -0,0 +1,7 @@ +all: windows + +windows: + $(CSC) /unsafe /nowarn:0660,0661 /target:library /out:gtk-dotnet.dll /recurse:*.cs + +clean: + rm -f *.dll diff --git a/makefile.win32 b/makefile.win32 index d902cca8b..e6c2e47f0 100755 --- a/makefile.win32 +++ b/makefile.win32 @@ -1,4 +1,4 @@ -DIRS=generator parser glib pango atk gdk gtk glade +DIRS=generator parser glib pango atk gdk gtk glade gtkdotnet ROOT=/cygdrive/$(subst \,/,$(subst :\,/,$(SYSTEMROOT))) CSC=$(ROOT)/microsoft.net/framework/v1.0.3705/csc.exe /d:WIN32 diff --git a/sample/DrawingSample.cs b/sample/DrawingSample.cs index 6560ce5bb..37bc118af 100644 --- a/sample/DrawingSample.cs +++ b/sample/DrawingSample.cs @@ -54,7 +54,7 @@ class X { Gdk.EventExpose ev = args.Event; Gdk.Window window = ev.Window; - using (Graphics g = Gdk.Graphics.FromDrawable (window)){ + using (Graphics g = Gtk.DotNet.Graphics.FromDrawable (window)){ g.TranslateTransform (ev.Area.X, ev.Area.Y); using (Pen p = new Pen (Color.Red)){ g.DrawPie (p, 0, 0, rect.Width, rect.Height, 50, 90); @@ -75,7 +75,7 @@ class PrettyGraphic : DrawingArea { protected override bool OnExposeEvent (Gdk.EventExpose args) { - using (Graphics g = Gdk.Graphics.FromDrawable (args.Window)){ + using (Graphics g = Gtk.DotNet.Graphics.FromDrawable (args.Window)){ Pen p = new Pen (Color.Blue, 1.0f); for (int i = 0; i < 600; i += 60) @@ -105,7 +105,7 @@ class MovingText : DrawingArea { protected override bool OnExposeEvent (Gdk.EventExpose args) { - using (Graphics g = Gdk.Graphics.FromDrawable (args.Window)){ + using (Graphics g = Gtk.DotNet.Graphics.FromDrawable (args.Window)){ using (Brush back = new SolidBrush (Color.White), fore = new SolidBrush (Color.Red)){ diff --git a/sample/Makefile.am b/sample/Makefile.am index 604b2e5ec..c7d76a5c3 100755 --- a/sample/Makefile.am +++ b/sample/Makefile.am @@ -32,7 +32,15 @@ VTE_TARGETS= VTE_ASSEMBLY= endif -TARGETS = custom-notebook.exe drawing-sample.exe custom-widget.exe custom-cellrenderer.exe gtk-hello-world.exe button.exe calendar.exe subclass.exe menu.exe size.exe scribble.exe scribble-xinput.exe treeviewdemo.exe managedtreeviewdemo.exe nodeviewdemo.exe testdnd.exe actions.exe $(GNOMEVFS_TARGETS) $(GNOME_TARGETS) $(GLADE_TARGETS) $(VTE_TARGETS) +if ENABLE_DOTNET +DOTNET_TARGETS=drawing-sample.exe +DOTNET_ASSEMBLY=../gtkdotnet/gtk-dotnet.dll +else +DOTNET_TARGETS= +DOTNET_ASSEMBLY= +endif + +TARGETS = custom-notebook.exe custom-widget.exe custom-cellrenderer.exe gtk-hello-world.exe button.exe calendar.exe subclass.exe menu.exe size.exe scribble.exe scribble-xinput.exe treeviewdemo.exe managedtreeviewdemo.exe nodeviewdemo.exe testdnd.exe actions.exe $(GNOMEVFS_TARGETS) $(GNOME_TARGETS) $(GLADE_TARGETS) $(VTE_TARGETS) $(DOTNET_TARGETS) DEBUGS = $(addsuffix .mdb, $(TARGETS)) @@ -105,8 +113,10 @@ vte-example.exe: $(srcdir)/VteTest.cs $(assemblies) custom-cellrenderer.exe: $(srcdir)/CustomCellRenderer.cs $(assemblies) $(CSC) /debug /out:custom-cellrenderer.exe $(references) $(srcdir)/CustomCellRenderer.cs -drawing-sample.exe: $(srcdir)/DrawingSample.cs $(srcdir)/sysdraw.cs $(assemblies) - $(CSC) /debug /out:drawing-sample.exe $(references) $(srcdir)/DrawingSample.cs $(srcdir)/sysdraw.cs /r:System.Drawing +dotnet_references = $(references) $(addprefix -r:, $(DOTNET_ASSEMBLY)) -r:System.Drawing + +drawing-sample.exe: $(srcdir)/DrawingSample.cs $(assemblies) $(DOTNET_ASSEMBLIES) + $(CSC) /debug /out:drawing-sample.exe $(dotnet_references) $(srcdir)/DrawingSample.cs custom-widget.exe: $(srcdir)/CustomWidget.cs $(assemblies) $(CSC) /debug /out:custom-widget.exe $(references) $(srcdir)/CustomWidget.cs @@ -144,8 +154,6 @@ EXTRA_DIST = \ VteTest.cs \ CustomCellRenderer.cs \ DrawingSample.cs \ - sysdraw.cs \ - drawing-sample.exe.config \ cairo-sample.exe.config \ CustomWidget.cs \ Actions.cs \ diff --git a/sample/drawing-sample.exe.config.in b/sample/drawing-sample.exe.config.in deleted file mode 100644 index 0924374e0..000000000 --- a/sample/drawing-sample.exe.config.in +++ /dev/null @@ -1,6 +0,0 @@ - - - - - -