2005-01-11 Mike Kestner <mkestner@novell.com>

* 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.

svn path=/trunk/gtk-sharp/; revision=38745
This commit is contained in:
Mike Kestner 2005-01-12 00:11:08 +00:00
commit d944e97bf2
15 changed files with 191 additions and 25 deletions

View file

@ -1,3 +1,16 @@
2005-01-11 Mike Kestner <mkestner@novell.com>
* 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 <mkestner@novell.com>
* gdk/Window.custom : add AddFilterForAll and RemoveFilterForAll

View file

@ -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 \

View file

@ -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"

View file

@ -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

13
doc/en/Gtk.DotNet.xml Normal file
View file

@ -0,0 +1,13 @@
<Namespace Name="Gtk.DotNet" FullName="Gtk.DotNet" FullNameSP="Gtk.DotNet" Maintainer="Mono">
<Docs>
<summary>Extension to the Gtk Widget set for .Net interoperability.</summary>
<remarks>
<para>
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.
</para>
</remarks>
</Docs>
</Namespace>

View file

@ -0,0 +1,38 @@
<Type Name="Graphics" FullName="Gtk.DotNet.Graphics">
<TypeSignature Language="C#" Value="public class Graphics" Maintainer="auto" />
<AssemblyInfo>
<AssemblyName>gtk-dotnet</AssemblyName>
<AssemblyPublicKey>[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]</AssemblyPublicKey>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyCulture>neutral</AssemblyCulture>
<Attributes />
</AssemblyInfo>
<ThreadSafetyStatement>Gtk# is thread aware, but not thread safe; See the <link location="node:gtk-sharp/programming/threads">Gtk# Thread Programming</link> for details.</ThreadSafetyStatement>
<Docs>
<summary>Gdk to System.Drawing.Graphics interoperability.</summary>
<remarks />
</Docs>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Attributes />
<Members>
<Member MemberName="FromDrawable">
<MemberSignature Language="C#" Value="public static System.Drawing.Graphics FromDrawable (Gdk.Drawable drawable);" />
<MemberType>Method</MemberType>
<ReturnValue>
<ReturnType>System.Drawing.Graphics</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="drawable" Type="Gdk.Drawable" />
</Parameters>
<Docs>
<summary>Gets a Graphics context for a drawable.</summary>
<param name="drawable">a <see cref="T:Gdk.Drawable" /></param>
<returns>a <see cref="T:System.Drawing.Graphics" /></returns>
<remarks />
</Docs>
</Member>
</Members>
</Type>

View file

@ -1,8 +1,24 @@
// Graphics.cs - System.Drawing integration with Gtk#
//
// System.Drawing integration with Gtk#
// Author: Miguel de Icaza <miguel@novell.com>
//
// 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);

46
gtkdotnet/Makefile.am Normal file
View file

@ -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

View file

@ -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

View file

@ -0,0 +1,3 @@
<configuration>
<dllmap dll="libgdk-win32-2.0-0.dll" target="libgdk-x11-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
</configuration>

7
gtkdotnet/makefile.win32 Normal file
View file

@ -0,0 +1,7 @@
all: windows
windows:
$(CSC) /unsafe /nowarn:0660,0661 /target:library /out:gtk-dotnet.dll /recurse:*.cs
clean:
rm -f *.dll

View file

@ -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

View file

@ -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)){

View file

@ -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 \

View file

@ -1,6 +0,0 @@
<configuration>
<dllmap dll="libglib-2.0-0.dll" target="libglib-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
<dllmap dll="libgobject-2.0-0.dll" target="libgobject-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
<dllmap dll="libgdk-win32-2.0-0.dll" target="libgdk-x11-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
<dllmap dll="libgdk_pixbuf-2.0-0.dll" target="libgdk_pixbuf-2.0@LIB_PREFIX@.0@LIB_SUFFIX@"/>
</configuration>