From d4e91dd83b32dc0ab70a08a7265c1a00b46fb869 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Fri, 13 Aug 2004 17:33:46 +0000 Subject: [PATCH] 2004-08-13 Mike Kestner * gtk/Gtk.metadata : hide Insert and SetText for manual impl. * gtk/TextBuffer.custom : pass -1 for length to Insert and SetText. Adapted from a patch by borsanza@yahoo.es (Borja Sanchez Zamorano). [Fixes #62985] svn path=/trunk/gtk-sharp/; revision=32317 --- ChangeLog | 7 +++++++ gtk/Gtk.metadata | 2 ++ gtk/TextBuffer.custom | 27 ++++++++++++++++++++++++--- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 81ae22fb0..5b342ed1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-08-13 Mike Kestner + + * gtk/Gtk.metadata : hide Insert and SetText for manual impl. + * gtk/TextBuffer.custom : pass -1 for length to Insert and SetText. + Adapted from a patch by borsanza@yahoo.es (Borja Sanchez Zamorano). + [Fixes #62985] + 2004-08-04 Raja R Harinath * configure.in (GTKHTML): Use SOVERSION=11 for GtkHTML 3.1.18. diff --git a/gtk/Gtk.metadata b/gtk/Gtk.metadata index e0e4d763d..1f25e2df2 100644 --- a/gtk/Gtk.metadata +++ b/gtk/Gtk.metadata @@ -212,6 +212,8 @@ out out out + 1 + 1 MoveMark RemoveTag TagApplied diff --git a/gtk/TextBuffer.custom b/gtk/TextBuffer.custom index c623f0d47..3150da5fc 100644 --- a/gtk/TextBuffer.custom +++ b/gtk/TextBuffer.custom @@ -1,3 +1,8 @@ +// TextBuffer.custom - customizations to Gtk.TextBuffer. +// +// Authors: Mike Kestner +// +// 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 @@ -13,14 +18,16 @@ // Free Software Foundation, Inc., 59 Temple Place - Suite 330, // Boston, MA 02111-1307, USA. + +[DllImport("libgtk-win32-2.0-0.dll")] +static extern void gtk_text_buffer_set_text (IntPtr raw, string text, int len); + public string Text { get { return GetText (StartIter, EndIter, false); } - set { - gtk_text_buffer_set_text (Handle, value, - System.Text.Encoding.UTF8.GetByteCount(value)); + gtk_text_buffer_set_text (Handle, value, -1); } } @@ -32,11 +39,20 @@ public void Clear () // overload to paste clipboard contents at cursor editable by default. [DllImport("libgtk-win32-2.0-0.dll")] static extern void gtk_text_buffer_paste_clipboard (IntPtr raw, IntPtr clip, IntPtr iter, bool default_edit); + public void PasteClipboard (Gtk.Clipboard clipboard) { gtk_text_buffer_paste_clipboard(Handle, clipboard.Handle, IntPtr.Zero, true); } +[DllImport("libgtk-win32-2.0-0.dll")] +static extern void gtk_text_buffer_insert (IntPtr raw, ref Gtk.TextIter iter, string text, int len); + +public void Insert (Gtk.TextIter iter, string text) +{ + gtk_text_buffer_insert (Handle, ref iter, text, -1); +} + public void InsertWithTags (TextIter iter, string text, params TextTag[] tags) { TextIter start; @@ -50,3 +66,8 @@ public void InsertWithTags (TextIter iter, string text, params TextTag[] tags) this.ApplyTag (t, start, iter); } +public void SetText (string text) +{ + gtk_text_buffer_set_text (Handle, text, -1); +} +