зеркало из https://github.com/mono/mail-archives.git
183 строки
5.7 KiB
HTML
183 строки
5.7 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<TITLE> [Gtk-sharp-list] Patch for TextBuffer
|
|
</TITLE>
|
|
<LINK REL="Index" HREF="index.html" >
|
|
<LINK REL="made" HREF="mailto:sayao%40brturbo.com">
|
|
<META NAME="robots" CONTENT="index,nofollow">
|
|
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<LINK REL="Previous" HREF="003458.html">
|
|
<LINK REL="Next" HREF="003495.html">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#ffffff">
|
|
<H1>[Gtk-sharp-list] Patch for TextBuffer
|
|
</H1>
|
|
<B>Thiago Milczarek Sayão
|
|
</B>
|
|
<A HREF="mailto:sayao%40brturbo.com"
|
|
TITLE="[Gtk-sharp-list] Patch for TextBuffer">sayao@brturbo.com
|
|
</A><BR>
|
|
<I>Sat, 21 Feb 2004 17:03:17 -0300</I>
|
|
<P><UL>
|
|
<LI> Previous message: <A HREF="003458.html">[Gtk-sharp-list] Patch for TextBuffer
|
|
</A></li>
|
|
<LI> Next message: <A HREF="003495.html">[Gtk-sharp-list] Patch for TextBuffer
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#3460">[ date ]</a>
|
|
<a href="thread.html#3460">[ thread ]</a>
|
|
<a href="subject.html#3460">[ subject ]</a>
|
|
<a href="author.html#3460">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
<HR>
|
|
<!--beginarticle-->
|
|
<PRE>--=-d+XnrUaMgXeMj4h7L2+m
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
On Sat, 2004-02-21 at 15:45, Mike Kestner wrote:
|
|
><i> On Sat, 2004-02-21 at 11:56, Thiago Milczarek Sayão wrote:
|
|
</I>><i> > I did a patch some days ago that got commited. It was the InsertWithTags
|
|
</I>><i> > patch. I didn't notice that the Insert function take 2 arguments, the
|
|
</I>><i> > iter and the text, so i did the InsertWithTags function take just two
|
|
</I>><i> > argument that is the text and the tags (i forgot the iter).
|
|
</I>><i>
|
|
</I>><i> Are you saying you submitted a patch that you didn't test? Please don't
|
|
</I>><i> ever do that. If a patch lands on this list, I'm assuming that it is
|
|
</I>><i> addressing a demonstrated problem, and that when the patch is applied,
|
|
</I>><i> the problem no longer exists.
|
|
</I>><i>
|
|
</I>I did test it. All patches i have sent work fine. I just did the
|
|
stupidity of making the wrong argument list to the function. It
|
|
addresses the problem of not having a gtk_text_buffer_insert_with_tags
|
|
() equivalent function.
|
|
|
|
><i> > This patch corrects the InsertWithTags to take three arguments, the
|
|
</I>><i> > iter, the text and the tags.
|
|
</I>><i>
|
|
</I>><i> Has it been tested?
|
|
</I>><i>
|
|
</I>
|
|
It was tested. The test i did is attached (run it inside the samples
|
|
dir). I've also tested on the gsirc (irc client).
|
|
|
|
><i> > The second patch add alias to the functions Insert, InsertWithTags and
|
|
</I>><i> > InsertPixbuf to automatically take EndIter as the iter argument. I don't
|
|
</I>><i> > know if its a good idea, so i did a separated patch to let mkestner
|
|
</I>><i> > decide :)
|
|
</I>><i>
|
|
</I>><i> Ditto.
|
|
</I>
|
|
Thanks,
|
|
Thiago.
|
|
|
|
|
|
--=-d+XnrUaMgXeMj4h7L2+m
|
|
Content-Disposition: attachment; filename=TestBuffer.cs
|
|
Content-Type: text/x-csharp; name=TestBuffer.cs; charset=UTF-8
|
|
Content-Transfer-Encoding: 7bit
|
|
|
|
using System;
|
|
using Gtk;
|
|
using Gdk;
|
|
|
|
class TestBuffer
|
|
{
|
|
TextView tv;
|
|
|
|
static void Main ()
|
|
{
|
|
new TestBuffer ();
|
|
}
|
|
|
|
TestBuffer ()
|
|
{
|
|
Application.Init ();
|
|
Gtk.Window win = new Gtk.Window ("TextView Test");
|
|
win.SetDefaultSize (400, 300);
|
|
win.DeleteEvent += new DeleteEventHandler (OnWinDelete);
|
|
|
|
VBox vbox = new VBox (false, 0);
|
|
win.Add (vbox);
|
|
|
|
TextTagTable tt = new TextTagTable ();
|
|
|
|
TextTag t1 = new TextTag (null);
|
|
t1.Foreground = "light blue";
|
|
|
|
TextTag t2 = new TextTag (null);
|
|
t2.Foreground = "red";
|
|
|
|
TextTag t3 = new TextTag (null);
|
|
t3.Foreground = "green";
|
|
|
|
TextTag t4 = new TextTag (null);
|
|
t4.Background = "yellow";
|
|
|
|
tt.Add (t1);
|
|
tt.Add (t2);
|
|
tt.Add (t3);
|
|
tt.Add (t4);
|
|
|
|
TextBuffer buf = new TextBuffer (tt);
|
|
tv = new TextView ();
|
|
tv.Buffer = buf;
|
|
|
|
Gdk.Pixbuf pix = new Gdk.Pixbuf ("pixmaps/gtk-sharp-logo.png");
|
|
buf.InsertPixbuf (pix);
|
|
buf.Insert ("Text");
|
|
buf.InsertWithTags ("RED", t2);
|
|
buf.InsertWithTags ("RED FG YELLOW BG", t2, t4);
|
|
buf.InsertWithTags (buf.GetIterAtOffset (5), "Green", t3);
|
|
buf.InsertWithTags (buf.GetIterAtOffset (20), "Green", t3);
|
|
|
|
Gdk.Pixbuf pix2 = new Gdk.Pixbuf ("pixmaps/gtk-sharp-logo.png");
|
|
buf.InsertPixbuf (pix2);
|
|
|
|
int offset = buf.EndIter.Offset;
|
|
|
|
buf.Insert ("Text");
|
|
buf.InsertWithTags ("RED", t2);
|
|
buf.InsertWithTags ("RED FG YELLOW BG", t2, t4);
|
|
buf.InsertWithTags (buf.GetIterAtOffset (offset + 4), "Green", t3);
|
|
buf.InsertWithTags (buf.GetIterAtOffset (offset + 19), "Green", t3);
|
|
|
|
buf.Insert ("\n");
|
|
buf.Insert ("This text is at another line");
|
|
buf.InsertWithTags ("\nThis text is red", t2);
|
|
buf.InsertWithTags ("\nThis text is green", t3);
|
|
|
|
vbox.PackStart (tv, true, true, 0);
|
|
win.ShowAll ();
|
|
Application.Run ();
|
|
}
|
|
|
|
void OnWinDelete (object o, DeleteEventArgs args)
|
|
{
|
|
Application.Quit ();
|
|
}
|
|
}
|
|
|
|
--=-d+XnrUaMgXeMj4h7L2+m--
|
|
|
|
|
|
</PRE>
|
|
<!--endarticle-->
|
|
<HR>
|
|
<P><UL>
|
|
<!--threads-->
|
|
<LI> Previous message: <A HREF="003458.html">[Gtk-sharp-list] Patch for TextBuffer
|
|
</A></li>
|
|
<LI> Next message: <A HREF="003495.html">[Gtk-sharp-list] Patch for TextBuffer
|
|
</A></li>
|
|
<LI> <B>Messages sorted by:</B>
|
|
<a href="date.html#3460">[ date ]</a>
|
|
<a href="thread.html#3460">[ thread ]</a>
|
|
<a href="subject.html#3460">[ subject ]</a>
|
|
<a href="author.html#3460">[ author ]</a>
|
|
</LI>
|
|
</UL>
|
|
</body></html>
|