summaryrefslogtreecommitdiff
path: root/gtk/gtktextiter.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2001-09-08 19:33:06 +0000
committerHavoc Pennington <hp@src.gnome.org>2001-09-08 19:33:06 +0000
commit9ddcb3e07ec94a4526377d07e6f785e81d9166a0 (patch)
treefe22e908eba247683a67d6436b78f9bb67a5c61e /gtk/gtktextiter.c
parent9e1fc3a7babc6c6b611024a1856573ab12c65386 (diff)
downloadgtk+-9ddcb3e07ec94a4526377d07e6f785e81d9166a0.tar.gz
default xscale/yscale to 0.0, not 0.5, 0.5 isn't useful
2001-09-08 Havoc Pennington <hp@pobox.com> * gtk/gtkalignment.c (gtk_alignment_class_init): default xscale/yscale to 0.0, not 0.5, 0.5 isn't useful * tests/testtextbuffer.c: fix usage of gtk_text_iter_spew * gtk/gtktextiter.c: fix docs (gtk_text_iter_spew): get rid of this * gtk/gtklayout.c: docs * gtk/gtkbutton.c (gtk_button_construct_child): add an alignment to center image and label together, instead of having image on left and label centered, patch/suggestion from Jacob * gtk/gtkdialog.c: docs 2001-09-08 Havoc Pennington <hp@pobox.com> * gtk/tmpl/gtklayout.sgml: docs * gdk-pixbuf/gdk-pixbuf.sgml: remove the section on compiling gdk-pixbuf since it isn't a standalone package anymore * gtk/building.sgml: section on compiling GTK itself
Diffstat (limited to 'gtk/gtktextiter.c')
-rw-r--r--gtk/gtktextiter.c88
1 files changed, 62 insertions, 26 deletions
diff --git a/gtk/gtktextiter.c b/gtk/gtktextiter.c
index ae52c76d17..2d5ecc8b5a 100644
--- a/gtk/gtktextiter.c
+++ b/gtk/gtktextiter.c
@@ -699,6 +699,17 @@ gtk_text_iter_get_line_index (const GtkTextIter *iter)
return real->line_byte_offset;
}
+/**
+ * gtk_text_iter_get_visible_line_offset:
+ * @iter: a #GtkTextIter
+ *
+ * Returns the offset in characters from the start of the
+ * line to the given @iter, not counting characters that
+ * are invisible due to tags with the "invisible" flag
+ * toggled on.
+ *
+ * Return value: offset in visible characters from the start of the line
+ **/
gint
gtk_text_iter_get_visible_line_offset (const GtkTextIter *iter)
{
@@ -750,6 +761,18 @@ gtk_text_iter_get_visible_line_offset (const GtkTextIter *iter)
return vis_offset;
}
+
+/**
+ * gtk_text_iter_get_visible_line_index:
+ * @iter: a #GtkTextIter
+ *
+ * Returns the number of bytes from the start of the
+ * line to the given @iter, not counting bytes that
+ * are invisible due to tags with the "invisible" flag
+ * toggled on.
+ *
+ * Return value: byte index of @iter with respect to the start of the line
+ **/
gint
gtk_text_iter_get_visible_line_index (const GtkTextIter *iter)
{
@@ -2499,6 +2522,22 @@ gtk_text_iter_backward_line (GtkTextIter *iter)
return TRUE;
}
+
+/**
+ * gtk_text_iter_forward_lines:
+ * @iter: a #GtkTextIter
+ * @count: number of lines to move forward
+ *
+ * Moves @count lines forward, if possible (if @count would move
+ * past the start or end of the buffer, moves to the start or end of
+ * the buffer). The return value indicates whether the iterator moved
+ * onto a dereferenceable position; if the iterator didn't move, or
+ * moved onto the end iterator, then FALSE is returned. If @count is 0,
+ * the function does nothing and returns FALSE. If @count is negative,
+ * moves backward by 0 - @count lines.
+ *
+ * Return value: whether @iter moved and is dereferenceable
+ **/
gboolean
gtk_text_iter_forward_lines (GtkTextIter *iter, gint count)
{
@@ -2530,6 +2569,21 @@ gtk_text_iter_forward_lines (GtkTextIter *iter, gint count)
}
}
+/**
+ * gtk_text_iter_backward_lines:
+ * @iter: a #GtkTextIter
+ * @count: number of lines to move backward
+ *
+ * Moves @count lines backward, if possible (if @count would move
+ * past the start or end of the buffer, moves to the start or end of
+ * the buffer). The return value indicates whether the iterator moved
+ * onto a dereferenceable position; if the iterator didn't move, or
+ * moved onto the end iterator, then FALSE is returned. If @count is 0,
+ * the function does nothing and returns FALSE. If @count is negative,
+ * moves forward by 0 - @count lines.
+ *
+ * Return value: whether @iter moved and is dereferenceable
+ **/
gboolean
gtk_text_iter_backward_lines (GtkTextIter *iter, gint count)
{
@@ -2838,7 +2892,7 @@ gtk_text_iter_forward_word_end (GtkTextIter *iter)
}
/**
- * gtk_text_iter_forward_word_end:
+ * gtk_text_iter_backward_word_start:
* @iter: a #GtkTextIter
*
* Moves backward to the next word start. (If @iter is currently on a
@@ -3075,7 +3129,9 @@ gtk_text_iter_backward_sentence_start (GtkTextIter *iter)
* @iter: a #GtkTextIter
* @count: number of sentences to move
*
- * Calls gtk_text_iter_forward_sentence_end() up to @count times.
+ * Calls gtk_text_iter_forward_sentence_end() @count times (or until
+ * gtk_text_iter_forward_sentence_end() returns %FALSE). If @count is
+ * negative, moves backward instead of forward.
*
* Return value: %TRUE if @iter moved and is not the end iterator
**/
@@ -3105,11 +3161,13 @@ gtk_text_iter_forward_sentence_ends (GtkTextIter *iter,
}
/**
- * gtk_text_iter_forward_sentence_ends:
+ * gtk_text_iter_backward_sentence_starts:
* @iter: a #GtkTextIter
* @count: number of sentences to move
*
- * Calls gtk_text_iter_backward_sentence_start() up to @count times.
+ * Calls gtk_text_iter_backward_sentence_start() up to @count times,
+ * or until it returns %FALSE. If @count is negative, moves forward
+ * instead of backward.
*
* Return value: %TRUE if @iter moved and is not the end iterator
**/
@@ -4936,28 +4994,6 @@ _gtk_text_btree_get_end_iter (GtkTextBTree *tree,
}
void
-gtk_text_iter_spew (const GtkTextIter *iter, const gchar *desc)
-{
- GtkTextRealIter *real = (GtkTextRealIter*)iter;
-
- 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);
- 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));
- check_invariants (iter);
- }
-}
-
-void
_gtk_text_iter_check (const GtkTextIter *iter)
{
const GtkTextRealIter *real = (const GtkTextRealIter*)iter;