summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2000-10-02 14:29:24 +0000
committerHavoc Pennington <hp@src.gnome.org>2000-10-02 14:29:24 +0000
commit8ebf77d13be575f37bb5ef34b79bf1d68a7ead77 (patch)
tree5a47b4ede579fb38f2179c621ff308a7248abdf1
parent632fda6f0bd578006226b29badcfb63729f5eba2 (diff)
downloadgtk+-8ebf77d13be575f37bb5ef34b79bf1d68a7ead77.tar.gz
text_window_* weren't static and should have been. Start work on child
2000-10-02 Havoc Pennington <hp@pobox.com> * gtk/gtktextview.c: text_window_* weren't static and should have been. Start work on child widgets; not yet complete, syncing to office computer. * gtk/gtktextchild.h: change this to contain a public interface, starting work on child interfaces. * gtk/gtktextchildprivate.h: move private interfaces here * gtk/Makefile.am: update to reflect gtktextchildprivate.h * gtk/gtktextview.h, gtk/gtktextview.c, gtk/gtktextbuffer.h, gtk/gtktextbuffer.c, gtk/gtktextiter.h, gtk/gtk/textiter.c, gtk/gtktextmark.c: copyright notices * gtk/gtktextmarkprivate.h: reformat, and put _ in front of internal functions * gtk/gtktextchild.c (_pixbuf_segment_new): put _ in front of internal function * gtk/gtktextlayout.c (gtk_text_layout_get_line_display): Reformatting
-rw-r--r--ChangeLog26
-rw-r--r--ChangeLog.pre-2-026
-rw-r--r--ChangeLog.pre-2-1026
-rw-r--r--ChangeLog.pre-2-226
-rw-r--r--ChangeLog.pre-2-426
-rw-r--r--ChangeLog.pre-2-626
-rw-r--r--ChangeLog.pre-2-826
-rw-r--r--gtk/Makefile.am3
-rw-r--r--gtk/gtktextbtree.c22
-rw-r--r--gtk/gtktextbuffer.c64
-rw-r--r--gtk/gtktextbuffer.h41
-rw-r--r--gtk/gtktextchild.c210
-rw-r--r--gtk/gtktextchild.h44
-rw-r--r--gtk/gtktextchildprivate.h90
-rw-r--r--gtk/gtktextiter.c42
-rw-r--r--gtk/gtktextiter.h26
-rw-r--r--gtk/gtktextlayout.c23
-rw-r--r--gtk/gtktextmark.c67
-rw-r--r--gtk/gtktextmark.h49
-rw-r--r--gtk/gtktextmarkprivate.h10
-rw-r--r--gtk/gtktextsegment.h20
-rw-r--r--gtk/gtktexttypes.h2
-rw-r--r--gtk/gtktextview.c421
-rw-r--r--gtk/gtktextview.h46
-rw-r--r--gtk/testtextbuffer.c6
-rw-r--r--tests/testtextbuffer.c6
26 files changed, 1207 insertions, 167 deletions
diff --git a/ChangeLog b/ChangeLog
index 7442c4411b..5178f1dae9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2000-10-02 Havoc Pennington <hp@pobox.com>
+
+ * gtk/gtktextview.c: text_window_* weren't static and should have
+ been.
+ Start work on child widgets; not yet complete, syncing to
+ office computer.
+
+ * gtk/gtktextchild.h: change this to contain a public interface,
+ starting work on child interfaces.
+ * gtk/gtktextchildprivate.h: move private interfaces here
+
+ * gtk/Makefile.am: update to reflect gtktextchildprivate.h
+
+ * gtk/gtktextview.h, gtk/gtktextview.c, gtk/gtktextbuffer.h,
+ gtk/gtktextbuffer.c, gtk/gtktextiter.h, gtk/gtk/textiter.c,
+ gtk/gtktextmark.c: copyright notices
+
+ * gtk/gtktextmarkprivate.h: reformat, and put _ in front of
+ internal functions
+
+ * gtk/gtktextchild.c (_pixbuf_segment_new): put _ in front of
+ internal function
+
+ * gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
+ Reformatting
+
2000-09-30 Havoc Pennington <hp@pobox.com>
* gtk/gtktextbtree.c (gtk_text_btree_get_selection_bounds): Handle
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 7442c4411b..5178f1dae9 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,29 @@
+2000-10-02 Havoc Pennington <hp@pobox.com>
+
+ * gtk/gtktextview.c: text_window_* weren't static and should have
+ been.
+ Start work on child widgets; not yet complete, syncing to
+ office computer.
+
+ * gtk/gtktextchild.h: change this to contain a public interface,
+ starting work on child interfaces.
+ * gtk/gtktextchildprivate.h: move private interfaces here
+
+ * gtk/Makefile.am: update to reflect gtktextchildprivate.h
+
+ * gtk/gtktextview.h, gtk/gtktextview.c, gtk/gtktextbuffer.h,
+ gtk/gtktextbuffer.c, gtk/gtktextiter.h, gtk/gtk/textiter.c,
+ gtk/gtktextmark.c: copyright notices
+
+ * gtk/gtktextmarkprivate.h: reformat, and put _ in front of
+ internal functions
+
+ * gtk/gtktextchild.c (_pixbuf_segment_new): put _ in front of
+ internal function
+
+ * gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
+ Reformatting
+
2000-09-30 Havoc Pennington <hp@pobox.com>
* gtk/gtktextbtree.c (gtk_text_btree_get_selection_bounds): Handle
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 7442c4411b..5178f1dae9 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,29 @@
+2000-10-02 Havoc Pennington <hp@pobox.com>
+
+ * gtk/gtktextview.c: text_window_* weren't static and should have
+ been.
+ Start work on child widgets; not yet complete, syncing to
+ office computer.
+
+ * gtk/gtktextchild.h: change this to contain a public interface,
+ starting work on child interfaces.
+ * gtk/gtktextchildprivate.h: move private interfaces here
+
+ * gtk/Makefile.am: update to reflect gtktextchildprivate.h
+
+ * gtk/gtktextview.h, gtk/gtktextview.c, gtk/gtktextbuffer.h,
+ gtk/gtktextbuffer.c, gtk/gtktextiter.h, gtk/gtk/textiter.c,
+ gtk/gtktextmark.c: copyright notices
+
+ * gtk/gtktextmarkprivate.h: reformat, and put _ in front of
+ internal functions
+
+ * gtk/gtktextchild.c (_pixbuf_segment_new): put _ in front of
+ internal function
+
+ * gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
+ Reformatting
+
2000-09-30 Havoc Pennington <hp@pobox.com>
* gtk/gtktextbtree.c (gtk_text_btree_get_selection_bounds): Handle
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 7442c4411b..5178f1dae9 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,29 @@
+2000-10-02 Havoc Pennington <hp@pobox.com>
+
+ * gtk/gtktextview.c: text_window_* weren't static and should have
+ been.
+ Start work on child widgets; not yet complete, syncing to
+ office computer.
+
+ * gtk/gtktextchild.h: change this to contain a public interface,
+ starting work on child interfaces.
+ * gtk/gtktextchildprivate.h: move private interfaces here
+
+ * gtk/Makefile.am: update to reflect gtktextchildprivate.h
+
+ * gtk/gtktextview.h, gtk/gtktextview.c, gtk/gtktextbuffer.h,
+ gtk/gtktextbuffer.c, gtk/gtktextiter.h, gtk/gtk/textiter.c,
+ gtk/gtktextmark.c: copyright notices
+
+ * gtk/gtktextmarkprivate.h: reformat, and put _ in front of
+ internal functions
+
+ * gtk/gtktextchild.c (_pixbuf_segment_new): put _ in front of
+ internal function
+
+ * gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
+ Reformatting
+
2000-09-30 Havoc Pennington <hp@pobox.com>
* gtk/gtktextbtree.c (gtk_text_btree_get_selection_bounds): Handle
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 7442c4411b..5178f1dae9 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,29 @@
+2000-10-02 Havoc Pennington <hp@pobox.com>
+
+ * gtk/gtktextview.c: text_window_* weren't static and should have
+ been.
+ Start work on child widgets; not yet complete, syncing to
+ office computer.
+
+ * gtk/gtktextchild.h: change this to contain a public interface,
+ starting work on child interfaces.
+ * gtk/gtktextchildprivate.h: move private interfaces here
+
+ * gtk/Makefile.am: update to reflect gtktextchildprivate.h
+
+ * gtk/gtktextview.h, gtk/gtktextview.c, gtk/gtktextbuffer.h,
+ gtk/gtktextbuffer.c, gtk/gtktextiter.h, gtk/gtk/textiter.c,
+ gtk/gtktextmark.c: copyright notices
+
+ * gtk/gtktextmarkprivate.h: reformat, and put _ in front of
+ internal functions
+
+ * gtk/gtktextchild.c (_pixbuf_segment_new): put _ in front of
+ internal function
+
+ * gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
+ Reformatting
+
2000-09-30 Havoc Pennington <hp@pobox.com>
* gtk/gtktextbtree.c (gtk_text_btree_get_selection_bounds): Handle
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 7442c4411b..5178f1dae9 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,29 @@
+2000-10-02 Havoc Pennington <hp@pobox.com>
+
+ * gtk/gtktextview.c: text_window_* weren't static and should have
+ been.
+ Start work on child widgets; not yet complete, syncing to
+ office computer.
+
+ * gtk/gtktextchild.h: change this to contain a public interface,
+ starting work on child interfaces.
+ * gtk/gtktextchildprivate.h: move private interfaces here
+
+ * gtk/Makefile.am: update to reflect gtktextchildprivate.h
+
+ * gtk/gtktextview.h, gtk/gtktextview.c, gtk/gtktextbuffer.h,
+ gtk/gtktextbuffer.c, gtk/gtktextiter.h, gtk/gtk/textiter.c,
+ gtk/gtktextmark.c: copyright notices
+
+ * gtk/gtktextmarkprivate.h: reformat, and put _ in front of
+ internal functions
+
+ * gtk/gtktextchild.c (_pixbuf_segment_new): put _ in front of
+ internal function
+
+ * gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
+ Reformatting
+
2000-09-30 Havoc Pennington <hp@pobox.com>
* gtk/gtktextbtree.c (gtk_text_btree_get_selection_bounds): Handle
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 7442c4411b..5178f1dae9 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,29 @@
+2000-10-02 Havoc Pennington <hp@pobox.com>
+
+ * gtk/gtktextview.c: text_window_* weren't static and should have
+ been.
+ Start work on child widgets; not yet complete, syncing to
+ office computer.
+
+ * gtk/gtktextchild.h: change this to contain a public interface,
+ starting work on child interfaces.
+ * gtk/gtktextchildprivate.h: move private interfaces here
+
+ * gtk/Makefile.am: update to reflect gtktextchildprivate.h
+
+ * gtk/gtktextview.h, gtk/gtktextview.c, gtk/gtktextbuffer.h,
+ gtk/gtktextbuffer.c, gtk/gtktextiter.h, gtk/gtk/textiter.c,
+ gtk/gtktextmark.c: copyright notices
+
+ * gtk/gtktextmarkprivate.h: reformat, and put _ in front of
+ internal functions
+
+ * gtk/gtktextchild.c (_pixbuf_segment_new): put _ in front of
+ internal function
+
+ * gtk/gtktextlayout.c (gtk_text_layout_get_line_display):
+ Reformatting
+
2000-09-30 Havoc Pennington <hp@pobox.com>
* gtk/gtktextbtree.c (gtk_text_btree_get_selection_bounds): Handle
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 173ef56a92..1a90ba304b 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -148,6 +148,7 @@ gtk_public_h_sources = @STRIP_BEGIN@ \
gtktable.h \
gtktearoffmenuitem.h \
gtktextbuffer.h \
+ gtktextchild.h \
gtktextiter.h \
gtktextmark.h \
gtktexttag.h \
@@ -189,7 +190,7 @@ gtk_semipublic_h_sources = @STRIP_BEGIN@ \
# GTK+ header files that don't get installed
gtk_private_h_sources = @STRIP_BEGIN@ \
gtktextbtree.h \
- gtktextchild.h \
+ gtktextchildprivate.h \
gtktextsegment.h \
gtktexttypes.h \
gtktextiterprivate.h \
diff --git a/gtk/gtktextbtree.c b/gtk/gtktextbtree.c
index 7b5985433a..a82f0d1caa 100644
--- a/gtk/gtktextbtree.c
+++ b/gtk/gtktextbtree.c
@@ -447,8 +447,8 @@ gtk_text_btree_new (GtkTextTagTable *table,
tree->selection_bound_mark->body.mark.not_deleteable = TRUE;
- mark_segment_ref(tree->insert_mark);
- mark_segment_ref(tree->selection_bound_mark);
+ _mark_segment_ref(tree->insert_mark);
+ _mark_segment_ref(tree->selection_bound_mark);
}
tree->refcount = 1;
@@ -466,9 +466,9 @@ gtk_text_btree_ref (GtkTextBTree *tree)
}
static void
-mark_destroy_foreach(gpointer key, gpointer value, gpointer user_data)
+mark_destroy_foreach (gpointer key, gpointer value, gpointer user_data)
{
- mark_segment_unref(value);
+ _mark_segment_unref (value);
}
void
@@ -488,8 +488,8 @@ gtk_text_btree_unref (GtkTextBTree *tree)
NULL);
g_hash_table_destroy(tree->mark_table);
- mark_segment_unref(tree->insert_mark);
- mark_segment_unref(tree->selection_bound_mark);
+ _mark_segment_unref(tree->insert_mark);
+ _mark_segment_unref(tree->selection_bound_mark);
gtk_signal_disconnect(GTK_OBJECT(tree->table),
tree->tag_changed_handler);
@@ -1057,7 +1057,7 @@ gtk_text_btree_insert_pixbuf (GtkTextIter *iter,
tree = gtk_text_iter_get_btree(iter);
start_byte_offset = gtk_text_iter_get_line_index(iter);
- seg = gtk_text_pixbuf_segment_new (pixbuf);
+ seg = _pixbuf_segment_new (pixbuf);
prevPtr = gtk_text_line_segment_split(iter);
if (prevPtr == NULL)
@@ -2426,9 +2426,9 @@ real_set_mark(GtkTextBTree *tree,
}
else
{
- mark = mark_segment_new(tree,
- left_gravity,
- name);
+ mark = _mark_segment_new (tree,
+ left_gravity,
+ name);
mark->body.mark.line = gtk_text_iter_get_text_line(&iter);
@@ -2553,7 +2553,7 @@ gtk_text_btree_remove_mark (GtkTextBTree *tree,
if (segment->body.mark.name)
g_hash_table_remove (tree->mark_table, segment->body.mark.name);
- mark_segment_unref (segment);
+ _mark_segment_unref (segment);
segment->body.mark.tree = NULL;
segment->body.mark.line = NULL;
diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c
index a83345b3ce..9a70c78a10 100644
--- a/gtk/gtktextbuffer.c
+++ b/gtk/gtktextbuffer.c
@@ -1,8 +1,30 @@
-/* gtktextbuffer.c - the "model" in the MVC text widget architecture
- * Copyright (c) 2000 Red Hat, Inc.
- * Developed by Havoc Pennington
+/* GTK - The GIMP Toolkit
+ * gtktextbuffer.c Copyright (C) 2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
+
#include <string.h>
#include "gtkclipboard.h"
@@ -1346,6 +1368,42 @@ gtk_text_buffer_get_selection_bound (GtkTextBuffer *buffer)
return gtk_text_buffer_get_mark (buffer, "selection_bound");
}
+
+GtkTextChildAnchor*
+gtk_text_buffer_create_child_anchor (GtkTextBuffer *buffer,
+ const GtkTextIter *where)
+{
+
+
+}
+
+void
+gtk_text_buffer_move_child_anchor (GtkTextBuffer *buffer,
+ GtkTextChildAnchor *anchor,
+ GtkTextIter *where)
+{
+
+
+}
+
+void
+gtk_text_buffer_delete_child_anchor (GtkTextBuffer *buffer,
+ GtkTextChildAnchor *anchor)
+{
+
+
+
+}
+
+void
+gtk_text_buffer_get_iter_at_child_anchor (GtkTextBuffer *buffer,
+ GtkTextIter *iter,
+ GtkTextChildAnchor *anchor)
+{
+
+
+}
+
/**
* gtk_text_buffer_place_cursor:
* @buffer: a #GtkTextBuffer
diff --git a/gtk/gtktextbuffer.h b/gtk/gtktextbuffer.h
index ef50bb96c9..d35eb9a4f7 100644
--- a/gtk/gtktextbuffer.h
+++ b/gtk/gtktextbuffer.h
@@ -1,3 +1,29 @@
+/* GTK - The GIMP Toolkit
+ * gtktextbuffer.h Copyright (C) 2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
#ifndef GTK_TEXT_BUFFER_H
#define GTK_TEXT_BUFFER_H
@@ -5,6 +31,7 @@
#include <gtk/gtktexttagtable.h>
#include <gtk/gtktextiter.h>
#include <gtk/gtktextmark.h>
+#include <gtk/gtktextchild.h>
#ifdef __cplusplus
extern "C" {
@@ -188,6 +215,16 @@ void gtk_text_buffer_delete_mark_by_name (GtkTextBuffer *buffer,
GtkTextMark* gtk_text_buffer_get_insert (GtkTextBuffer *buffer);
GtkTextMark* gtk_text_buffer_get_selection_bound (GtkTextBuffer *buffer);
+/* Child widget anchors */
+
+GtkTextChildAnchor* gtk_text_buffer_create_child_anchor (GtkTextBuffer *buffer,
+ const GtkTextIter *where);
+void gtk_text_buffer_move_child_anchor (GtkTextBuffer *buffer,
+ GtkTextChildAnchor *anchor,
+ GtkTextIter *where);
+void gtk_text_buffer_delete_child_anchor (GtkTextBuffer *buffer,
+ GtkTextChildAnchor *anchor);
+
/* efficiently move insert and selection_bound to same location */
void gtk_text_buffer_place_cursor (GtkTextBuffer *buffer,
@@ -241,7 +278,9 @@ void gtk_text_buffer_get_iter_at_mark (GtkTextBuffer *buffer,
GtkTextIter *iter,
GtkTextMark *mark);
-
+void gtk_text_buffer_get_iter_at_child_anchor (GtkTextBuffer *buffer,
+ GtkTextIter *iter,
+ GtkTextChildAnchor *anchor);
/* There's no get_first_iter because you just get the iter for
line or char 0 */
diff --git a/gtk/gtktextchild.c b/gtk/gtktextchild.c
index cde111384d..88e021b202 100644
--- a/gtk/gtktextchild.c
+++ b/gtk/gtktextchild.c
@@ -1,5 +1,4 @@
/* gtktextchild.c - child pixmaps and widgets
- *
*
* Copyright (c) 1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
@@ -89,7 +88,7 @@ pixbuf_segment_check_func(GtkTextLineSegment *seg,
GtkTextLineSegmentClass gtk_text_pixbuf_type = {
"pixbuf", /* name */
- 0, /* leftGravity */
+ FALSE, /* leftGravity */
NULL, /* splitFunc */
pixbuf_segment_delete_func, /* deleteFunc */
pixbuf_segment_cleanup_func, /* cleanupFunc */
@@ -98,27 +97,15 @@ GtkTextLineSegmentClass gtk_text_pixbuf_type = {
};
-#if 0
-GtkTextLineSegmentClass gtk_text_view_child_type = {
- "child-widget", /* name */
- 0, /* leftGravity */
- child_segment_split_func, /* splitFunc */
- child_segment_delete_func, /* deleteFunc */
- child_segment_cleanup_func, /* cleanupFunc */
- NULL, /* lineChangeFunc */
- child_segment_check_func /* checkFunc */
-};
-#endif
-
#define PIXBUF_SEG_SIZE ((unsigned) (G_STRUCT_OFFSET(GtkTextLineSegment, body) \
+ sizeof(GtkTextPixbuf)))
GtkTextLineSegment *
-gtk_text_pixbuf_segment_new (GdkPixbuf *pixbuf)
+_pixbuf_segment_new (GdkPixbuf *pixbuf)
{
GtkTextLineSegment *seg;
- seg = g_malloc(PIXBUF_SEG_SIZE);
+ seg = g_malloc (PIXBUF_SEG_SIZE);
seg->type = &gtk_text_pixbuf_type;
@@ -134,3 +121,194 @@ gtk_text_pixbuf_segment_new (GdkPixbuf *pixbuf)
return seg;
}
+
+
+static GtkTextLineSegment *
+child_segment_cleanup_func (GtkTextLineSegment *seg,
+ GtkTextLine *line)
+{
+ seg->body.child.line = line;
+
+ return seg;
+}
+
+static int
+child_segment_delete_func (GtkTextLineSegment *seg,
+ GtkTextLine *line,
+ gboolean tree_gone)
+{
+ _widget_segment_unref (seg);
+
+ return 0;
+}
+
+static void
+child_segment_check_func (GtkTextLineSegment *seg,
+ GtkTextLine *line)
+{
+ if (seg->next == NULL)
+ g_error("child segment is the last segment in a line");
+
+ if (seg->byte_count != 3)
+ g_error("child segment has byte count of %d", seg->byte_count);
+
+ if (seg->char_count != 1)
+ g_error("child segment has char count of %d", seg->char_count);
+}
+
+GtkTextLineSegmentClass gtk_text_child_type = {
+ "child-widget", /* name */
+ FALSE, /* leftGravity */
+ NULL, /* splitFunc */
+ child_segment_delete_func, /* deleteFunc */
+ child_segment_cleanup_func, /* cleanupFunc */
+ NULL, /* lineChangeFunc */
+ child_segment_check_func /* checkFunc */
+};
+
+#define WIDGET_SEG_SIZE ((unsigned) (G_STRUCT_OFFSET (GtkTextLineSegment, body) \
+ + sizeof(GtkTextChildBody)))
+
+GtkTextLineSegment *
+_widget_segment_new (void)
+{
+ GtkTextLineSegment *seg;
+
+ seg = g_malloc (WIDGET_SEG_SIZE);
+
+ seg->type = &gtk_text_child_type;
+
+ seg->next = NULL;
+
+ seg->byte_count = 3; /* We convert to the 0xFFFD "unknown character",
+ * a 3-byte sequence in UTF-8
+ */
+ seg->char_count = 1;
+
+ seg->body.child.ref_count = 1;
+ seg->body.child.widgets = NULL;
+ seg->body.child.tree = NULL;
+ seg->body.child.line = NULL;
+
+ return seg;
+}
+
+void
+_widget_segment_add (GtkTextLineSegment *widget_segment,
+ GtkWidget *child)
+{
+ g_assert (widget_segment->type = &gtk_text_child_type);
+
+ widget_segment->body.child.widgets =
+ g_slist_prepend (widget_segment->body.child.widgets,
+ child);
+
+ g_object_ref (G_OBJECT (child));
+}
+
+void
+_widget_segment_remove (GtkTextLineSegment *widget_segment,
+ GtkWidget *child)
+{
+ g_assert (widget_segment->type = &gtk_text_child_type);
+
+ widget_segment->body.child.widgets =
+ g_slist_remove (widget_segment->body.child.widgets,
+ child);
+
+ g_object_unref (G_OBJECT (child));
+}
+
+void
+_widget_segment_ref (GtkTextLineSegment *widget_segment)
+{
+ g_assert (widget_segment->type = &gtk_text_child_type);
+
+ widget_segment->body.child.ref_count += 1;
+}
+
+void
+_widget_segment_unref (GtkTextLineSegment *widget_segment)
+{
+ g_assert (widget_segment->type = &gtk_text_child_type);
+
+ widget_segment->body.child.ref_count -= 1;
+
+ if (widget_segment->body.child.ref_count == 0)
+ {
+ GSList *tmp_list;
+
+ if (widget_segment->body.child.tree == NULL)
+ g_warning ("widget segment destroyed while still in btree");
+
+ tmp_list = widget_segment->body.child.widgets;
+ while (tmp_list)
+ {
+ g_object_unref (G_OBJECT (tmp_list->data));
+
+ tmp_list = g_slist_next (tmp_list);
+ }
+
+ g_slist_free (widget_segment->body.child.widgets);
+
+ g_free (widget_segment);
+ }
+}
+
+void
+gtk_text_child_anchor_ref (GtkTextChildAnchor *anchor)
+{
+ GtkTextLineSegment *seg = (GtkTextLineSegment *) anchor;
+
+ g_return_if_fail (seg->type = &gtk_text_child_type);
+ g_return_if_fail (seg->body.child.ref_count > 0);
+
+ _widget_segment_ref (seg);
+}
+
+void
+gtk_text_child_anchor_unref (GtkTextChildAnchor *anchor)
+{
+ GtkTextLineSegment *seg = (GtkTextLineSegment *) anchor;
+
+ g_return_if_fail (seg->type = &gtk_text_child_type);
+ g_return_if_fail (seg->body.child.ref_count > 0);
+
+ _widget_segment_unref (seg);
+}
+
+GList*
+gtk_text_child_anchor_get_widgets (GtkTextChildAnchor *anchor)
+{
+ GtkTextLineSegment *seg = (GtkTextLineSegment *) anchor;
+ GList *list = NULL;
+ GSList *iter;
+
+ g_return_val_if_fail (seg->type = &gtk_text_child_type, NULL);
+
+ iter = seg->body.child.widgets;
+ while (iter != NULL)
+ {
+ list = g_list_prepend (list, iter->data);
+
+ iter = g_slist_next (iter);
+ }
+
+ /* Order is not relevant, so we don't need to reverse the list
+ * again.
+ */
+ return list;
+}
+
+gboolean
+gtk_text_child_anchor_get_deleted (GtkTextChildAnchor *anchor)
+{
+ GtkTextLineSegment *seg = (GtkTextLineSegment *) anchor;
+
+ g_return_val_if_fail (seg->type = &gtk_text_child_type, TRUE);
+
+ return seg->body.child.tree == NULL;
+}
+
+
+
diff --git a/gtk/gtktextchild.h b/gtk/gtktextchild.h
index 6ea7075f60..9357a3b870 100644
--- a/gtk/gtktextchild.h
+++ b/gtk/gtktextchild.h
@@ -1,20 +1,50 @@
+/* GTK - The GIMP Toolkit
+ * gtktextchild.h Copyright (C) 2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
#ifndef GTK_TEXT_CHILD_H
#define GTK_TEXT_CHILD_H
-#include <gtk/gtktexttypes.h>
+#include <glib.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-typedef struct _GtkTextPixbuf GtkTextPixbuf;
-
-struct _GtkTextPixbuf {
- GdkPixbuf *pixbuf;
-};
+/* A GtkTextChildAnchor is a spot in the buffer where child widgets
+ * can be "anchored" (inserted inline, as if they were characters).
+ * The anchor can have multiple widgets anchored, to allow for multiple
+ * views.
+ */
-GtkTextLineSegment *gtk_text_pixbuf_segment_new(GdkPixbuf *pixbuf);
+typedef struct _GtkTextChildAnchor GtkTextChildAnchor;
+void gtk_text_child_anchor_ref (GtkTextChildAnchor *anchor);
+void gtk_text_child_anchor_unref (GtkTextChildAnchor *anchor);
+GList* gtk_text_child_anchor_get_widgets (GtkTextChildAnchor *anchor);
+gboolean gtk_text_child_anchor_get_deleted (GtkTextChildAnchor *anchor);
#ifdef __cplusplus
}
diff --git a/gtk/gtktextchildprivate.h b/gtk/gtktextchildprivate.h
new file mode 100644
index 0000000000..99ce041004
--- /dev/null
+++ b/gtk/gtktextchildprivate.h
@@ -0,0 +1,90 @@
+/* gtktextchild.c - child pixmaps and widgets
+ *
+ * Copyright (c) 1994 The Regents of the University of California.
+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright (c) 2000 Red Hat, Inc.
+ * Tk -> Gtk port by Havoc Pennington <hp@redhat.com>
+ *
+ * This software is copyrighted by the Regents of the University of
+ * California, Sun Microsystems, Inc., and other parties. The
+ * following terms apply to all files associated with the software
+ * unless explicitly disclaimed in individual files.
+ *
+ * The authors hereby grant permission to use, copy, modify,
+ * distribute, and license this software and its documentation for any
+ * purpose, provided that existing copyright notices are retained in
+ * all copies and that this notice is included verbatim in any
+ * distributions. No written agreement, license, or royalty fee is
+ * required for any of the authorized uses. Modifications to this
+ * software may be copyrighted by their authors and need not follow
+ * the licensing terms described here, provided that the new terms are
+ * clearly indicated on the first page of each file where they apply.
+ *
+ * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY
+ * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
+ * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION,
+ * OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
+ * NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+ * AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
+ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * GOVERNMENT USE: If you are acquiring this software on behalf of the
+ * U.S. government, the Government shall have only "Restricted Rights"
+ * in the software and related documentation as defined in the Federal
+ * Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
+ * are acquiring the software on behalf of the Department of Defense,
+ * the software shall be classified as "Commercial Computer Software"
+ * and the Government shall have only "Restricted Rights" as defined
+ * in Clause 252.227-7013 (c) (1) of DFARs. Notwithstanding the
+ * foregoing, the authors grant the U.S. Government and others acting
+ * in its behalf permission to use and distribute the software in
+ * accordance with the terms specified in this license.
+ *
+ */
+
+#ifndef GTK_TEXT_CHILD_PRIVATE_H
+#define GTK_TEXT_CHILD_PRIVATE_H
+
+#include <gtk/gtktexttypes.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef struct _GtkTextPixbuf GtkTextPixbuf;
+
+struct _GtkTextPixbuf
+{
+ GdkPixbuf *pixbuf;
+};
+
+GtkTextLineSegment *_pixbuf_segment_new (GdkPixbuf *pixbuf);
+
+typedef struct _GtkTextChildBody GtkTextChildBody;
+
+struct _GtkTextChildBody
+{
+ guint ref_count;
+ GSList *widgets;
+ GtkTextBTree *tree;
+ GtkTextLine *line;
+};
+
+GtkTextLineSegment *_widget_segment_new (void);
+void _widget_segment_add (GtkTextLineSegment *widget_segment,
+ GtkWidget *child);
+void _widget_segment_remove (GtkTextLineSegment *widget_segment,
+ GtkWidget *child);
+void _widget_segment_ref (GtkTextLineSegment *widget_segment);
+void _widget_segment_unref (GtkTextLineSegment *widget_segment);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif
diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c
index bc44e02ac4..b2ec510fe8 100644
--- a/gtk/gtktextiter.c
+++ b/gtk/gtktextiter.c
@@ -1,3 +1,29 @@
+/* GTK - The GIMP Toolkit
+ * gtktextiter.c Copyright (C) 2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
#include "gtktextiter.h"
#include "gtktextbtree.h"
#include "gtktextiterprivate.h"
@@ -2962,22 +2988,22 @@ gtk_text_iter_spew (const GtkTextIter *iter, const gchar *desc)
g_return_if_fail(iter != NULL);
if (real->chars_changed_stamp != gtk_text_btree_get_chars_changed_stamp(real->tree))
- g_print(" %20s: <invalidated iterator>\n", desc);
+ g_print (" %20s: <invalidated iterator>\n", desc);
else
{
check_invariants(iter);
- g_print(" %20s: line %d / char %d / line char %d / line byte %d\n",
- desc,
- gtk_text_iter_get_line(iter),
- gtk_text_iter_get_offset(iter),
- gtk_text_iter_get_line_offset(iter),
- gtk_text_iter_get_line_index(iter));
+ g_print (" %20s: line %d / char %d / line char %d / line byte %d\n",
+ desc,
+ gtk_text_iter_get_line(iter),
+ gtk_text_iter_get_offset(iter),
+ gtk_text_iter_get_line_offset(iter),
+ gtk_text_iter_get_line_index(iter));
check_invariants(iter);
}
}
void
-gtk_text_iter_check(const GtkTextIter *iter)
+gtk_text_iter_check (const GtkTextIter *iter)
{
const GtkTextRealIter *real = (const GtkTextRealIter*)iter;
gint line_char_offset, line_byte_offset, seg_char_offset, seg_byte_offset;
diff --git a/gtk/gtktextiter.h b/gtk/gtktextiter.h
index 740533fcbe..45dde30b29 100644
--- a/gtk/gtktextiter.h
+++ b/gtk/gtktextiter.h
@@ -1,3 +1,29 @@
+/* GTK - The GIMP Toolkit
+ * gtktextiter.h Copyright (C) 2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
#ifndef GTK_TEXT_ITER_H
#define GTK_TEXT_ITER_H
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index 5ef74c0017..ff7da5e3b0 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -1334,11 +1334,12 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
{
if (seg->type == &gtk_text_char_type)
{
- /* We don't want to split segments because of marks, so we scan forward
- * for more segments only separated from us by marks. In theory, we
- * should also merge segments with identical styles, even if there
- * are toggles in-between
- */
+ /* We don't want to split segments because of marks,
+ * so we scan forward for more segments only
+ * separated from us by marks. In theory, we should
+ * also merge segments with identical styles, even
+ * if there are toggles in-between
+ */
gint byte_count = 0;
@@ -1365,12 +1366,15 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
seg = seg->next;
}
- add_text_attrs (layout, style, byte_count, attrs, byte_offset - byte_count, size_only);
+ add_text_attrs (layout, style, byte_count, attrs,
+ byte_offset - byte_count, size_only);
}
else
{
- add_pixbuf_attrs (layout, display, style, seg, attrs, byte_offset);
- memcpy (text + byte_offset, gtk_text_unknown_char_utf8, seg->byte_count);
+ add_pixbuf_attrs (layout, display, style,
+ seg, attrs, byte_offset);
+ memcpy (text + byte_offset, gtk_text_unknown_char_utf8,
+ seg->byte_count);
byte_offset += seg->byte_count;
}
}
@@ -1395,7 +1399,8 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout,
if (seg->body.mark.visible)
{
- cursor_byte_offsets = g_slist_prepend (cursor_byte_offsets, GINT_TO_POINTER (byte_offset));
+ cursor_byte_offsets = g_slist_prepend (cursor_byte_offsets,
+ GINT_TO_POINTER (byte_offset));
cursor_segs = g_slist_prepend (cursor_segs, seg);
}
}
diff --git a/gtk/gtktextmark.c b/gtk/gtktextmark.c
index 6cf14624ab..a1a4c6f65f 100644
--- a/gtk/gtktextmark.c
+++ b/gtk/gtktextmark.c
@@ -1,18 +1,53 @@
-/*
- * tkTextMark.c --
- *
- * This file contains the procedure that implement marks for
- * text widgets.
- *
+/* gtktextmark.c - mark segments
+ *
* Copyright (c) 1994 The Regents of the University of California.
* Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright (c) 2000 Red Hat, Inc.
+ * Tk -> Gtk port by Havoc Pennington <hp@redhat.com>
*
- * See the file "license.terms" for information on usage and redistribution
- * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+ * This software is copyrighted by the Regents of the University of
+ * California, Sun Microsystems, Inc., and other parties. The
+ * following terms apply to all files associated with the software
+ * unless explicitly disclaimed in individual files.
+ *
+ * The authors hereby grant permission to use, copy, modify,
+ * distribute, and license this software and its documentation for any
+ * purpose, provided that existing copyright notices are retained in
+ * all copies and that this notice is included verbatim in any
+ * distributions. No written agreement, license, or royalty fee is
+ * required for any of the authorized uses. Modifications to this
+ * software may be copyrighted by their authors and need not follow
+ * the licensing terms described here, provided that the new terms are
+ * clearly indicated on the first page of each file where they apply.
+ *
+ * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY
+ * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
+ * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION,
+ * OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
+ * NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+ * AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
+ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
- * RCS: @(#) $Id$
+ * GOVERNMENT USE: If you are acquiring this software on behalf of the
+ * U.S. government, the Government shall have only "Restricted Rights"
+ * in the software and related documentation as defined in the Federal
+ * Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
+ * are acquiring the software on behalf of the Department of Defense,
+ * the software shall be classified as "Commercial Computer Software"
+ * and the Government shall have only "Restricted Rights" as defined
+ * in Clause 252.227-7013 (c) (1) of DFARs. Notwithstanding the
+ * foregoing, the authors grant the U.S. Government and others acting
+ * in its behalf permission to use and distribute the software in
+ * accordance with the terms specified in this license.
+ *
*/
+
#include "gtktextbtree.h"
gboolean
@@ -43,7 +78,7 @@ gtk_text_mark_ref (GtkTextMark *mark)
seg = (GtkTextLineSegment*)mark;
- mark_segment_ref (seg);
+ _mark_segment_ref (seg);
return mark;
}
@@ -55,7 +90,7 @@ gtk_text_mark_unref (GtkTextMark *mark)
seg = (GtkTextLineSegment*)mark;
- mark_segment_unref (seg);
+ _mark_segment_unref (seg);
}
gboolean
@@ -79,9 +114,9 @@ gtk_text_mark_get_deleted (GtkTextMark *mark)
GtkTextLineSegment*
-mark_segment_new (GtkTextBTree *tree,
- gboolean left_gravity,
- const gchar *name)
+_mark_segment_new (GtkTextBTree *tree,
+ gboolean left_gravity,
+ const gchar *name)
{
GtkTextLineSegment *mark;
@@ -109,7 +144,7 @@ mark_segment_new (GtkTextBTree *tree,
}
void
-mark_segment_ref(GtkTextLineSegment *mark)
+_mark_segment_ref (GtkTextLineSegment *mark)
{
g_return_if_fail (mark != NULL);
g_return_if_fail (mark->type == &gtk_text_right_mark_type ||
@@ -120,7 +155,7 @@ mark_segment_ref(GtkTextLineSegment *mark)
}
void
-mark_segment_unref(GtkTextLineSegment *mark)
+_mark_segment_unref (GtkTextLineSegment *mark)
{
g_return_if_fail (mark != NULL);
g_return_if_fail (mark->type == &gtk_text_right_mark_type ||
diff --git a/gtk/gtktextmark.h b/gtk/gtktextmark.h
index f2a0b5b796..0ee0180639 100644
--- a/gtk/gtktextmark.h
+++ b/gtk/gtktextmark.h
@@ -1,3 +1,52 @@
+/* gtktextmark.h - mark segments
+ *
+ * Copyright (c) 1994 The Regents of the University of California.
+ * Copyright (c) 1994-1997 Sun Microsystems, Inc.
+ * Copyright (c) 2000 Red Hat, Inc.
+ * Tk -> Gtk port by Havoc Pennington <hp@redhat.com>
+ *
+ * This software is copyrighted by the Regents of the University of
+ * California, Sun Microsystems, Inc., and other parties. The
+ * following terms apply to all files associated with the software
+ * unless explicitly disclaimed in individual files.
+ *
+ * The authors hereby grant permission to use, copy, modify,
+ * distribute, and license this software and its documentation for any
+ * purpose, provided that existing copyright notices are retained in
+ * all copies and that this notice is included verbatim in any
+ * distributions. No written agreement, license, or royalty fee is
+ * required for any of the authorized uses. Modifications to this
+ * software may be copyrighted by their authors and need not follow
+ * the licensing terms described here, provided that the new terms are
+ * clearly indicated on the first page of each file where they apply.
+ *
+ * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY
+ * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
+ * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION,
+ * OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
+ * NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
+ * AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
+ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * GOVERNMENT USE: If you are acquiring this software on behalf of the
+ * U.S. government, the Government shall have only "Restricted Rights"
+ * in the software and related documentation as defined in the Federal
+ * Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
+ * are acquiring the software on behalf of the Department of Defense,
+ * the software shall be classified as "Commercial Computer Software"
+ * and the Government shall have only "Restricted Rights" as defined
+ * in Clause 252.227-7013 (c) (1) of DFARs. Notwithstanding the
+ * foregoing, the authors grant the U.S. Government and others acting
+ * in its behalf permission to use and distribute the software in
+ * accordance with the terms specified in this license.
+ *
+ */
+
#ifndef GTK_TEXT_MARK_H
#define GTK_TEXT_MARK_H
diff --git a/gtk/gtktextmarkprivate.h b/gtk/gtktextmarkprivate.h
index 07ebc2aeda..87e862c289 100644
--- a/gtk/gtktextmarkprivate.h
+++ b/gtk/gtktextmarkprivate.h
@@ -25,11 +25,11 @@ struct _GtkTextMarkBody {
guint not_deleteable : 1;
};
-GtkTextLineSegment *mark_segment_new (GtkTextBTree *tree,
- gboolean left_gravity,
- const gchar *name);
-void mark_segment_ref (GtkTextLineSegment *mark);
-void mark_segment_unref (GtkTextLineSegment *mark);
+GtkTextLineSegment *_mark_segment_new (GtkTextBTree *tree,
+ gboolean left_gravity,
+ const gchar *name);
+void _mark_segment_ref (GtkTextLineSegment *mark);
+void _mark_segment_unref (GtkTextLineSegment *mark);
#ifdef __cplusplus
diff --git a/gtk/gtktextsegment.h b/gtk/gtktextsegment.h
index 0dfd05630d..a4b88d739e 100644
--- a/gtk/gtktextsegment.h
+++ b/gtk/gtktextsegment.h
@@ -5,6 +5,7 @@
#include <gtk/gtktextiter.h>
#include <gtk/gtktextmarkprivate.h>
#include <gtk/gtktextchild.h>
+#include <gtk/gtktextchildprivate.h>
#ifdef __cplusplus
extern "C" {
@@ -122,21 +123,22 @@ struct _GtkTextLineSegment {
GtkTextToggleBody toggle; /* Information about tag toggle. */
GtkTextMarkBody mark; /* Information about mark. */
GtkTextPixbuf pixbuf; /* Child pixbuf */
-#if 0
- GtkTextChild child; /* child widget */
-#endif
+ GtkTextChildBody child; /* Child widget */
} body;
};
-GtkTextLineSegment *gtk_text_line_segment_split(const GtkTextIter *iter);
-
-GtkTextLineSegment *char_segment_new(const gchar *text, guint len);
+GtkTextLineSegment *gtk_text_line_segment_split (const GtkTextIter *iter);
-GtkTextLineSegment *char_segment_new_from_two_strings(const gchar *text1, guint len1,
- const gchar *text2, guint len2);
+GtkTextLineSegment *char_segment_new (const gchar *text,
+ guint len);
+GtkTextLineSegment *char_segment_new_from_two_strings (const gchar *text1,
+ guint len1,
+ const gchar *text2,
+ guint len2);
+GtkTextLineSegment *toggle_segment_new (GtkTextTagInfo *info,
+ gboolean on);
-GtkTextLineSegment *toggle_segment_new(GtkTextTagInfo *info, gboolean on);
#ifdef __cplusplus
}
diff --git a/gtk/gtktexttypes.h b/gtk/gtktexttypes.h
index 8c7b34259b..16321afdfc 100644
--- a/gtk/gtktexttypes.h
+++ b/gtk/gtktexttypes.h
@@ -32,7 +32,7 @@ extern GtkTextLineSegmentClass gtk_text_right_mark_type;
/* In gtktextchild.c */
extern GtkTextLineSegmentClass gtk_text_pixbuf_type;
-extern GtkTextLineSegmentClass gtk_text_view_child_type;
+extern GtkTextLineSegmentClass gtk_text_child_type;
/*
* UTF 8 Stubs
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index fffa2bca3a..4bbd655b64 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -1,51 +1,27 @@
-/* gtktext.c - A "view" widget for the GtkTextBuffer object
- *
- * Copyright (c) 1992-1994 The Regents of the University of California.
- * Copyright (c) 1994-1996 Sun Microsystems, Inc.
- * Copyright (c) 1999 by Scriptics Corporation.
- * Copyright (c) 2000 Red Hat, Inc.
- * Tk -> Gtk port by Havoc Pennington <hp@redhat.com>
+/* GTK - The GIMP Toolkit
+ * gtktextview.c Copyright (C) 2000 Red Hat, Inc.
*
- * This software is copyrighted by the Regents of the University of
- * California, Sun Microsystems, Inc., and other parties. The
- * following terms apply to all files associated with the software
- * unless explicitly disclaimed in individual files.
- *
- * The authors hereby grant permission to use, copy, modify,
- * distribute, and license this software and its documentation for any
- * purpose, provided that existing copyright notices are retained in
- * all copies and that this notice is included verbatim in any
- * distributions. No written agreement, license, or royalty fee is
- * required for any of the authorized uses. Modifications to this
- * software may be copyrighted by their authors and need not follow
- * the licensing terms described here, provided that the new terms are
- * clearly indicated on the first page of each file where they apply.
- *
- * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY
- * PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
- * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION,
- * OR ANY DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND
- * NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
- * AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
- * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
*
- * GOVERNMENT USE: If you are acquiring this software on behalf of the
- * U.S. government, the Government shall have only "Restricted Rights"
- * in the software and related documentation as defined in the Federal
- * Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
- * are acquiring the software on behalf of the Department of Defense,
- * the software shall be classified as "Commercial Computer Software"
- * and the Government shall have only "Restricted Rights" as defined
- * in Clause 252.227-7013 (c) (1) of DFARs. Notwithstanding the
- * foregoing, the authors grant the U.S. Government and others acting
- * in its behalf permission to use and distribute the software in
- * accordance with the terms specified in this license.
- *
+ * This library 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 library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include <string.h>
@@ -232,6 +208,44 @@ static void gtk_text_view_set_virtual_cursor_pos (GtkTextView *text_view,
static GtkAdjustment* get_hadjustment (GtkTextView *text_view);
static GtkAdjustment* get_vadjustment (GtkTextView *text_view);
+/* Container methods */
+static void gtk_text_view_add (GtkContainer *container,
+ GtkWidget *child);
+static void gtk_text_view_remove (GtkContainer *container,
+ GtkWidget *child);
+static void gtk_text_view_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data);
+
+/* FIXME probably need the focus methods. */
+
+typedef struct _GtkTextViewChild GtkTextViewChild;
+
+struct _GtkTextViewChild
+{
+ GtkWidget *widget;
+
+ GtkTextChildAnchor *anchor;
+
+ /* These are ignored if anchor != NULL */
+ GtkTextWindowType type;
+ gint x;
+ gint y;
+};
+
+static GtkTextViewChild* text_view_child_new_anchored (GtkWidget *child,
+ GtkTextChildAnchor *anchor);
+static GtkTextViewChild* text_view_child_new_window (GtkWidget *child,
+ GtkTextWindowType type,
+ gint x,
+ gint y);
+static void text_view_child_free (GtkTextViewChild *child);
+
+static void text_view_child_realize (GtkTextView *text_view,
+ GtkTextViewChild *child);
+static void text_view_child_unrealize (GtkTextViewChild *child);
+
struct _GtkTextWindow
{
GtkTextWindowType type;
@@ -242,26 +256,26 @@ struct _GtkTextWindow
GdkRectangle allocation;
};
-GtkTextWindow *text_window_new (GtkTextWindowType type,
- GtkWidget *widget,
- gint width_request,
- gint height_request);
-void text_window_free (GtkTextWindow *win);
-void text_window_realize (GtkTextWindow *win,
- GdkWindow *parent);
-void text_window_unrealize (GtkTextWindow *win);
-void text_window_size_allocate (GtkTextWindow *win,
- GdkRectangle *rect);
-void text_window_scroll (GtkTextWindow *win,
- gint dx,
- gint dy);
-void text_window_invalidate_rect (GtkTextWindow *win,
- GdkRectangle *rect);
-
-gint text_window_get_width (GtkTextWindow *win);
-gint text_window_get_height (GtkTextWindow *win);
-void text_window_get_allocation (GtkTextWindow *win,
- GdkRectangle *rect);
+static GtkTextWindow *text_window_new (GtkTextWindowType type,
+ GtkWidget *widget,
+ gint width_request,
+ gint height_request);
+static void text_window_free (GtkTextWindow *win);
+static void text_window_realize (GtkTextWindow *win,
+ GdkWindow *parent);
+static void text_window_unrealize (GtkTextWindow *win);
+static void text_window_size_allocate (GtkTextWindow *win,
+ GdkRectangle *rect);
+static void text_window_scroll (GtkTextWindow *win,
+ gint dx,
+ gint dy);
+static void text_window_invalidate_rect (GtkTextWindow *win,
+ GdkRectangle *rect);
+
+static gint text_window_get_width (GtkTextWindow *win);
+static gint text_window_get_height (GtkTextWindow *win);
+static void text_window_get_allocation (GtkTextWindow *win,
+ GdkRectangle *rect);
enum {
@@ -336,6 +350,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
GtkBindingSet *binding_set;
parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
@@ -622,6 +637,10 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
widget_class->drag_drop = gtk_text_view_drag_drop;
widget_class->drag_data_received = gtk_text_view_drag_data_received;
+ container_class->add = gtk_text_view_add;
+ container_class->remove = gtk_text_view_remove;
+ container_class->forall = gtk_text_view_forall;
+
klass->move = gtk_text_view_move;
klass->set_anchor = gtk_text_view_set_anchor;
klass->insert = gtk_text_view_insert;
@@ -2178,6 +2197,86 @@ gtk_text_view_draw_focus (GtkWidget *widget)
}
/*
+ * Container
+ */
+
+static void
+gtk_text_view_add (GtkContainer *container,
+ GtkWidget *child)
+{
+ g_return_if_fail (GTK_IS_TEXT_VIEW (container));
+ g_return_if_fail (GTK_IS_WIDGET (child));
+
+ /* This is pretty random. */
+ gtk_text_view_add_child_in_window (GTK_TEXT_VIEW (container),
+ child,
+ GTK_TEXT_WINDOW_WIDGET,
+ 0, 0);
+}
+
+static void
+gtk_text_view_remove (GtkContainer *container,
+ GtkWidget *child)
+{
+ GSList *iter;
+ GtkTextView *text_view;
+ GtkTextViewChild *vc;
+
+ g_return_if_fail (GTK_IS_TEXT_VIEW (container));
+ g_return_if_fail (GTK_IS_WIDGET (child));
+ g_return_if_fail (child->parent == (GtkWidget*) container);
+
+ text_view = GTK_TEXT_VIEW (container);
+
+ vc = NULL;
+ iter = text_view->children;
+
+ while (iter != NULL)
+ {
+ vc = iter->data;
+
+ if (vc->widget == child)
+ break;
+
+ iter = g_slist_next (iter);
+ }
+
+ g_assert (iter != NULL); /* be sure we had the child in the list */
+
+ text_view->children = g_slist_remove (text_view->children, vc);
+
+ gtk_widget_unparent (vc->widget);
+
+ text_view_child_free (vc);
+}
+
+static void
+gtk_text_view_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
+{
+ GSList *iter;
+ GtkTextView *text_view;
+
+ g_return_if_fail (GTK_IS_TEXT_VIEW (container));
+ g_return_if_fail (callback != NULL);
+
+ text_view = GTK_TEXT_VIEW (container);
+
+ iter = text_view->children;
+
+ while (iter != NULL)
+ {
+ GtkTextViewChild *vc = iter->data;
+
+ (* callback) (vc->widget, callback_data);
+
+ iter = g_slist_next (iter);
+ }
+}
+
+/*
* Blink!
*/
@@ -3437,7 +3536,7 @@ gtk_text_view_set_virtual_cursor_pos (GtkTextView *text_view,
/* Child GdkWindows */
-GtkTextWindow*
+static GtkTextWindow*
text_window_new (GtkTextWindowType type,
GtkWidget *widget,
gint width_request,
@@ -3461,7 +3560,7 @@ text_window_new (GtkTextWindowType type,
return win;
}
-void
+static void
text_window_free (GtkTextWindow *win)
{
if (win->window)
@@ -3470,7 +3569,7 @@ text_window_free (GtkTextWindow *win)
g_free (win);
}
-void
+static void
text_window_realize (GtkTextWindow *win,
GdkWindow *parent)
{
@@ -3546,7 +3645,7 @@ text_window_realize (GtkTextWindow *win,
win);
}
-void
+static void
text_window_unrealize (GtkTextWindow *win)
{
if (win->type == GTK_TEXT_WINDOW_TEXT)
@@ -3563,7 +3662,7 @@ text_window_unrealize (GtkTextWindow *win)
win->bin_window = NULL;
}
-void
+static void
text_window_size_allocate (GtkTextWindow *win,
GdkRectangle *rect)
{
@@ -3580,7 +3679,7 @@ text_window_size_allocate (GtkTextWindow *win,
}
}
-void
+static void
text_window_scroll (GtkTextWindow *win,
gint dx,
gint dy)
@@ -3592,26 +3691,26 @@ text_window_scroll (GtkTextWindow *win,
}
}
-void
+static void
text_window_invalidate_rect (GtkTextWindow *win,
GdkRectangle *rect)
{
gdk_window_invalidate_rect (win->bin_window, rect, FALSE);
}
-gint
+static gint
text_window_get_width (GtkTextWindow *win)
{
return win->allocation.width;
}
-gint
+static gint
text_window_get_height (GtkTextWindow *win)
{
return win->allocation.height;
}
-void
+static void
text_window_get_allocation (GtkTextWindow *win,
GdkRectangle *rect)
{
@@ -4070,3 +4169,173 @@ gtk_text_view_set_text_window_size (GtkTextView *text_view,
gtk_widget_queue_resize (GTK_WIDGET (text_view));
}
+/*
+ * Child widgets
+ */
+
+static GtkTextViewChild*
+text_view_child_new_anchored (GtkWidget *child,
+ GtkTextChildAnchor *anchor)
+{
+ GtkTextViewChild *vc;
+
+ vc = g_new (GtkTextViewChild, 1);
+
+ vc->widget = child;
+ vc->anchor = anchor;
+
+ g_object_ref (G_OBJECT (vc->widget));
+ gtk_text_child_anchor_ref (vc->anchor);
+
+ gtk_object_set_data (GTK_OBJECT (child),
+ "gtk-text-view-child",
+ vc);
+
+ return vc;
+}
+
+static GtkTextViewChild*
+text_view_child_new_window (GtkWidget *child,
+ GtkTextWindowType type,
+ gint x,
+ gint y)
+{
+ GtkTextViewChild *vc;
+
+ vc = g_new (GtkTextViewChild, 1);
+
+ vc->widget = child;
+ vc->anchor = NULL;
+
+ g_object_ref (G_OBJECT (vc->widget));
+
+ vc->type = type;
+ vc->x = x;
+ vc->y = y;
+
+ return vc;
+}
+
+static void
+text_view_child_free (GtkTextViewChild *child)
+{
+
+ gtk_object_remove_data (GTK_OBJECT (child->widget),
+ "gtk-text-view-child");
+
+ g_object_unref (G_OBJECT (child->widget));
+ gtk_text_child_anchor_unref (child->anchor);
+
+ g_free (child);
+}
+
+static void
+text_view_child_realize (GtkTextView *text_view,
+ GtkTextViewChild *vc)
+{
+ if (vc->anchor)
+ gtk_widget_set_parent_window (vc->widget,
+ text_view->text_window->bin_window);
+ else
+ {
+ GdkWindow *window;
+ window = gtk_text_view_get_window (text_view,
+ vc->type);
+ gtk_widget_set_parent_window (vc->widget, window);
+ }
+
+ gtk_widget_realize (vc->widget);
+}
+
+static void
+text_view_child_unrealize (GtkTextViewChild *vc)
+{
+ gtk_widget_unrealize (vc->widget);
+}
+
+static void
+add_child (GtkTextView *text_view,
+ GtkTextViewChild *vc)
+{
+ text_view->children = g_slist_prepend (text_view->children,
+ vc);
+
+ gtk_widget_set_parent (vc->widget, GTK_WIDGET (text_view));
+
+ if (GTK_WIDGET_REALIZED (text_view))
+ text_view_child_realize (text_view, vc);
+
+ if (GTK_WIDGET_VISIBLE (text_view) && GTK_WIDGET_VISIBLE (vc->widget))
+ {
+ if (GTK_WIDGET_MAPPED (text_view))
+ gtk_widget_map (vc->widget);
+
+ gtk_widget_queue_resize (vc->widget);
+ }
+}
+
+void
+gtk_text_view_add_child_at_anchor (GtkTextView *text_view,
+ GtkWidget *child,
+ GtkTextChildAnchor *anchor)
+{
+ GtkTextViewChild *vc;
+
+ g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
+ g_return_if_fail (GTK_IS_WIDGET (child));
+ g_return_if_fail (anchor != NULL);
+ g_return_if_fail (child->parent == NULL);
+
+ vc = text_view_child_new_anchored (child, anchor);
+
+ add_child (text_view, vc);
+}
+
+void
+gtk_text_view_add_child_in_window (GtkTextView *text_view,
+ GtkWidget *child,
+ GtkTextWindowType which_window,
+ gint xpos,
+ gint ypos)
+{
+ GtkTextViewChild *vc;
+
+ g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
+ g_return_if_fail (GTK_IS_WIDGET (child));
+ g_return_if_fail (xpos >= 0);
+ g_return_if_fail (ypos >= 0);
+ g_return_if_fail (child->parent == NULL);
+
+ vc = text_view_child_new_window (child, which_window,
+ xpos, ypos);
+
+ add_child (text_view, vc);
+}
+
+void
+gtk_text_view_move_child (GtkTextView *text_view,
+ GtkWidget *child,
+ gint xpos,
+ gint ypos)
+{
+ GtkTextViewChild *vc;
+
+ g_return_if_fail (GTK_IS_TEXT_VIEW (text_view));
+ g_return_if_fail (GTK_IS_WIDGET (child));
+ g_return_if_fail (xpos >= 0);
+ g_return_if_fail (ypos >= 0);
+ g_return_if_fail (child->parent == (GtkWidget*) text_view);
+
+ vc = gtk_object_get_data (GTK_OBJECT (child),
+ "gtk-text-view-child");
+
+ g_assert (vc != NULL);
+
+ vc->x = xpos;
+ vc->y = ypos;
+
+ if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (text_view))
+ gtk_widget_queue_resize (child);
+}
+
+
diff --git a/gtk/gtktextview.h b/gtk/gtktextview.h
index 300e3716c5..3cabdee7a3 100644
--- a/gtk/gtktextview.h
+++ b/gtk/gtktextview.h
@@ -1,3 +1,29 @@
+/* GTK - The GIMP Toolkit
+ * gtktextview.h Copyright (C) 2000 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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 library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GTK+ Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
#ifndef GTK_TEXT_VIEW_H
#define GTK_TEXT_VIEW_H
@@ -89,6 +115,8 @@ struct _GtkTextView {
gint drag_start_x;
gint drag_start_y;
+
+ GSList *children;
};
struct _GtkTextViewClass {
@@ -184,6 +212,24 @@ void gtk_text_view_set_text_window_size (GtkTextView *text_view,
gint height);
+/* Adding child widgets */
+void gtk_text_view_add_child_at_anchor (GtkTextView *text_view,
+ GtkWidget *child,
+ GtkTextChildAnchor *anchor);
+
+void gtk_text_view_add_child_in_window (GtkTextView *text_view,
+ GtkWidget *child,
+ GtkTextWindowType which_window,
+ /* window coordinates */
+ gint xpos,
+ gint ypos);
+
+void gtk_text_view_move_child (GtkTextView *text_view,
+ GtkWidget *child,
+ /* window coordinates */
+ gint xpos,
+ gint ypos);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/gtk/testtextbuffer.c b/gtk/testtextbuffer.c
index f5e065f546..286f9b5fd7 100644
--- a/gtk/testtextbuffer.c
+++ b/gtk/testtextbuffer.c
@@ -65,6 +65,8 @@ main (int argc, char** argv)
g_error ("%d chars, expected 1", n);
run_tests (buffer);
+
+ g_print ("All tests passed.\n");
return 0;
}
@@ -82,7 +84,7 @@ run_tests (GtkTextBuffer *buffer)
gtk_text_buffer_get_bounds (buffer, &start, &end);
- /* Check that walking the tree via chars and via indexes produces
+ /* Check that walking the tree via chars and via iterators produces
* the same number of indexable locations.
*/
num_chars = gtk_text_buffer_get_char_count (buffer);
@@ -224,7 +226,7 @@ run_tests (GtkTextBuffer *buffer)
if (i != gtk_text_buffer_get_line_count (buffer))
g_error ("Counted %d lines, buffer has %d", i,
- gtk_text_buffer_get_line_count (buffer));
+ gtk_text_buffer_get_line_count (buffer));
}
diff --git a/tests/testtextbuffer.c b/tests/testtextbuffer.c
index f5e065f546..286f9b5fd7 100644
--- a/tests/testtextbuffer.c
+++ b/tests/testtextbuffer.c
@@ -65,6 +65,8 @@ main (int argc, char** argv)
g_error ("%d chars, expected 1", n);
run_tests (buffer);
+
+ g_print ("All tests passed.\n");
return 0;
}
@@ -82,7 +84,7 @@ run_tests (GtkTextBuffer *buffer)
gtk_text_buffer_get_bounds (buffer, &start, &end);
- /* Check that walking the tree via chars and via indexes produces
+ /* Check that walking the tree via chars and via iterators produces
* the same number of indexable locations.
*/
num_chars = gtk_text_buffer_get_char_count (buffer);
@@ -224,7 +226,7 @@ run_tests (GtkTextBuffer *buffer)
if (i != gtk_text_buffer_get_line_count (buffer))
g_error ("Counted %d lines, buffer has %d", i,
- gtk_text_buffer_get_line_count (buffer));
+ gtk_text_buffer_get_line_count (buffer));
}