2005-04-15 Chris Toshok <toshok@ximian.com>
* Makefile.am: add support for gtk glade files and resources. * DebugAttributes.cs: change the pixbuf object source to GtkVisualizers.PixbufObjectSource from VisualizerObjectSource. * gtk/PixbufVisualizer.cs (PixbufWindow): new class to wrap the glade UI. (PixbufVisualizer): read the data as written by our custom objectsource. (PixbufObjectSource): new class, since Pixbufs aren't serializable, we have to write the data ourselves. svn path=/trunk/monodevelop-visualizers/; revision=43023
This commit is contained in:
Родитель
c832d72ff1
Коммит
87f4701dd6
14
ChangeLog
14
ChangeLog
|
@ -0,0 +1,14 @@
|
||||||
|
2005-04-15 Chris Toshok <toshok@ximian.com>
|
||||||
|
|
||||||
|
* Makefile.am: add support for gtk glade files and resources.
|
||||||
|
|
||||||
|
* DebugAttributes.cs: change the pixbuf object source to
|
||||||
|
GtkVisualizers.PixbufObjectSource from VisualizerObjectSource.
|
||||||
|
|
||||||
|
* gtk/PixbufVisualizer.cs (PixbufWindow): new class to wrap the
|
||||||
|
glade UI.
|
||||||
|
(PixbufVisualizer): read the data as written by our custom
|
||||||
|
objectsource.
|
||||||
|
(PixbufObjectSource): new class, since Pixbufs aren't
|
||||||
|
serializable, we have to write the data ourselves.
|
||||||
|
|
|
@ -2,7 +2,7 @@ using System.Diagnostics;
|
||||||
using MonoDevelop.DebuggerVisualizers;
|
using MonoDevelop.DebuggerVisualizers;
|
||||||
|
|
||||||
[assembly: DebuggerVisualizer (typeof (GtkVisualizers.PixbufVisualizer),
|
[assembly: DebuggerVisualizer (typeof (GtkVisualizers.PixbufVisualizer),
|
||||||
typeof (VisualizerObjectSource),
|
typeof (GtkVisualizers.PixbufObjectSource),
|
||||||
Target = typeof (Gdk.Pixbuf),
|
Target = typeof (Gdk.Pixbuf),
|
||||||
Description = "View Pixbuf")]
|
Description = "View Pixbuf")]
|
||||||
[assembly: DebuggerVisualizer (typeof (CorlibVisualizers.StringVisualizer),
|
[assembly: DebuggerVisualizer (typeof (CorlibVisualizers.StringVisualizer),
|
||||||
|
|
|
@ -5,9 +5,9 @@ GECKO_CSFILES=gecko/HTMLVisualizer.cs \
|
||||||
|
|
||||||
GECKO_FLAGS= -define:ENABLE_GECKO_VISUALIZERS
|
GECKO_FLAGS= -define:ENABLE_GECKO_VISUALIZERS
|
||||||
|
|
||||||
GLADE_FILES=gecko/geckovis.glade
|
GECKO_GLADE_FILES=gecko/geckovis.glade
|
||||||
|
|
||||||
RESOURCES= /resource:./gecko/geckovis.glade,geckovis.glade
|
GECKO_RESOURCES= /resource:./gecko/geckovis.glade,geckovis.glade
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CSFILES=AssemblyInfo.cs \
|
CSFILES=AssemblyInfo.cs \
|
||||||
|
@ -16,6 +16,9 @@ CSFILES=AssemblyInfo.cs \
|
||||||
gtk/PixbufVisualizer.cs \
|
gtk/PixbufVisualizer.cs \
|
||||||
$(GECKO_CSFILES)
|
$(GECKO_CSFILES)
|
||||||
|
|
||||||
|
GLADE_FILES=gtk/pixbufvis.glade $(GECKO_GLADE_FILES)
|
||||||
|
RESOURCES= /resource:./gtk/pixbufvis.glade,pixbufvis.glade $(GECKO_RESOURCES)
|
||||||
|
|
||||||
CSFLAGS=-g $(GECKO_FLAGS)
|
CSFLAGS=-g $(GECKO_FLAGS)
|
||||||
|
|
||||||
noinst_DATA=DebuggerVisualizers.dll
|
noinst_DATA=DebuggerVisualizers.dll
|
||||||
|
|
|
@ -43,7 +43,6 @@ namespace GeckoVisualizers
|
||||||
public Widget CustomWidgetHandler (XML xml, string func_name, string name, string string1, string string2, int int1, int int2)
|
public Widget CustomWidgetHandler (XML xml, string func_name, string name, string string1, string string2, int int1, int int2)
|
||||||
{
|
{
|
||||||
if (func_name.Equals ("CreateGeckoControl")) {
|
if (func_name.Equals ("CreateGeckoControl")) {
|
||||||
Console.WriteLine ("CreateGeckoControl");
|
|
||||||
return new Gecko.WebControl ();
|
return new Gecko.WebControl ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
|
||||||
<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
|
|
||||||
|
|
||||||
<glade-project>
|
|
||||||
<name>Geckovis</name>
|
|
||||||
<program_name>geckovis</program_name>
|
|
||||||
<gnome_support>FALSE</gnome_support>
|
|
||||||
</glade-project>
|
|
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
|
||||||
<!DOCTYPE glade-project SYSTEM "http://glade.gnome.org/glade-project-2.0.dtd">
|
|
||||||
|
|
||||||
<glade-project>
|
|
||||||
<name>Geckovis</name>
|
|
||||||
<program_name>geckovis</program_name>
|
|
||||||
<gnome_support>FALSE</gnome_support>
|
|
||||||
</glade-project>
|
|
|
@ -1,22 +1,99 @@
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
using Gtk;
|
using Gtk;
|
||||||
using Gdk;
|
using Gdk;
|
||||||
|
using Glade;
|
||||||
|
|
||||||
using MonoDevelop.DebuggerVisualizers;
|
using MonoDevelop.DebuggerVisualizers;
|
||||||
|
|
||||||
namespace GtkVisualizers
|
namespace GtkVisualizers
|
||||||
{
|
{
|
||||||
|
class PixbufWindow
|
||||||
|
{
|
||||||
|
[Widget] Gtk.Dialog pixbuf_dialog;
|
||||||
|
[Widget] Gtk.Image pixbuf_image;
|
||||||
|
|
||||||
|
public PixbufWindow (string title, Pixbuf pixbuf)
|
||||||
|
{
|
||||||
|
Glade.XML ui;
|
||||||
|
|
||||||
|
ui = Glade.XML.FromAssembly ("pixbufvis.glade", "pixbuf_dialog", null);
|
||||||
|
ui.Autoconnect (this);
|
||||||
|
|
||||||
|
pixbuf_dialog.Title = title;
|
||||||
|
pixbuf_image.Pixbuf = pixbuf;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Show ()
|
||||||
|
{
|
||||||
|
pixbuf_dialog.Run();
|
||||||
|
pixbuf_dialog.Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Debugger side class
|
||||||
public class PixbufVisualizer : DialogDebuggerVisualizer
|
public class PixbufVisualizer : DialogDebuggerVisualizer
|
||||||
{
|
{
|
||||||
protected override void Show (IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
|
protected override void Show (IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
|
||||||
{
|
{
|
||||||
Gtk.Window window = new Gtk.Window (Gtk.WindowType.Toplevel);
|
Stream pixbuf_stream = objectProvider.GetData();
|
||||||
Gdk.Pixbuf pixbuf = (Gdk.Pixbuf) objectProvider.GetObject ();
|
BinaryReader reader = new BinaryReader (pixbuf_stream);
|
||||||
|
|
||||||
Widget image = new Gtk.Image(pixbuf);
|
bool has_alpha;
|
||||||
|
int bits_per_sample, width, height, rowstride;
|
||||||
|
Gdk.Pixbuf pixbuf;
|
||||||
|
|
||||||
window.Title = "Pixbuf Visualizer";
|
has_alpha = reader.ReadBoolean ();
|
||||||
window.Add (image);
|
bits_per_sample = reader.ReadInt32 ();
|
||||||
|
width = reader.ReadInt32 ();
|
||||||
|
height = reader.ReadInt32 ();
|
||||||
|
rowstride = reader.ReadInt32 ();
|
||||||
|
|
||||||
window.ShowAll ();
|
int size = height * rowstride;
|
||||||
|
|
||||||
|
byte[] pixbuf_data = new byte [size];
|
||||||
|
|
||||||
|
reader.Read (pixbuf_data, 0, size);
|
||||||
|
|
||||||
|
pixbuf = new Pixbuf (Gdk.Colorspace.Rgb, has_alpha, bits_per_sample, width, height);
|
||||||
|
|
||||||
|
Marshal.Copy (pixbuf_data, 0, pixbuf.Pixels, size);
|
||||||
|
|
||||||
|
PixbufWindow win = new PixbufWindow ("Pixbuf Visualizer", pixbuf);
|
||||||
|
|
||||||
|
win.Show ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Debugee side class. This is necessary since Gdk.Pixbuf
|
||||||
|
// isn't serializable, a requirement for
|
||||||
|
// VisualizerObjectSource.
|
||||||
|
public class PixbufObjectSource : VisualizerObjectSource
|
||||||
|
{
|
||||||
|
void WriteBuf (Stream outgoingData, byte[] buf)
|
||||||
|
{
|
||||||
|
outgoingData.Write (buf, 0, buf.Length);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void GetData (object target, Stream outgoingData)
|
||||||
|
{
|
||||||
|
Gdk.Pixbuf pixbuf = (Gdk.Pixbuf)target;
|
||||||
|
|
||||||
|
WriteBuf (outgoingData, BitConverter.GetBytes (pixbuf.HasAlpha));
|
||||||
|
WriteBuf (outgoingData, BitConverter.GetBytes (pixbuf.BitsPerSample));
|
||||||
|
WriteBuf (outgoingData, BitConverter.GetBytes (pixbuf.Width));
|
||||||
|
WriteBuf (outgoingData, BitConverter.GetBytes (pixbuf.Height));
|
||||||
|
WriteBuf (outgoingData, BitConverter.GetBytes (pixbuf.Rowstride));
|
||||||
|
|
||||||
|
int size = pixbuf.Height * pixbuf.Rowstride;
|
||||||
|
|
||||||
|
byte[] pixel_buf = new byte[size];
|
||||||
|
Marshal.Copy (pixbuf.Pixels, pixel_buf, 0, size);
|
||||||
|
|
||||||
|
WriteBuf (outgoingData, pixel_buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,14 @@
|
||||||
|
|
||||||
<glade-interface>
|
<glade-interface>
|
||||||
|
|
||||||
<widget class="GtkDialog" id="gecko_dialog">
|
<widget class="GtkDialog" id="pixbuf_dialog">
|
||||||
<property name="border_width">12</property>
|
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="title" translatable="yes">gecko_dialog</property>
|
<property name="title" translatable="yes">dialog1</property>
|
||||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||||
<property name="modal">True</property>
|
<property name="modal">True</property>
|
||||||
<property name="default_width">200</property>
|
<property name="default_width">300</property>
|
||||||
<property name="default_height">300</property>
|
<property name="default_height">400</property>
|
||||||
<property name="resizable">True</property>
|
<property name="resizable">True</property>
|
||||||
<property name="destroy_with_parent">False</property>
|
<property name="destroy_with_parent">False</property>
|
||||||
<property name="decorated">True</property>
|
<property name="decorated">True</property>
|
||||||
|
@ -55,12 +54,30 @@
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="Custom" id="gecko_control">
|
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="creation_function">CreateGeckoControl</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="int1">0</property>
|
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<property name="int2">0</property>
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<property name="last_modification_time">Fri, 15 Apr 2005 01:01:08 GMT</property>
|
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||||
|
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkViewport" id="viewport1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkImage" id="pixbuf_image">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="xalign">0.5</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
Загрузка…
Ссылка в новой задаче