summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2002-01-17 22:38:18 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-01-17 22:38:18 +0000
commit9e404f2a1e04e9ea17742b9e2823b50189104a54 (patch)
tree2362e3efce1cc927610984593457b8a1224f222d
parentcf25093441d43b9225ae0a1a7eceaa31ef3a3d49 (diff)
downloadgtk+-9e404f2a1e04e9ea17742b9e2823b50189104a54.tar.gz
new function (which I then decided not to use but I think it's needed to
2002-01-17 Havoc Pennington <hp@redhat.com> * gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new function (which I then decided not to use but I think it's needed to fix #68963 * gtk/gtktextview.c: add page_horizontally action signal and implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig, hackily modified to avoid adding GTK_MOVEMENT_ API. Part of #53934 * gtk/gtkmarshalers.list: add NONE:INT,BOOL
-rw-r--r--ChangeLog13
-rw-r--r--ChangeLog.pre-2-013
-rw-r--r--ChangeLog.pre-2-1013
-rw-r--r--ChangeLog.pre-2-213
-rw-r--r--ChangeLog.pre-2-413
-rw-r--r--ChangeLog.pre-2-613
-rw-r--r--ChangeLog.pre-2-813
-rw-r--r--docs/reference/gtk/tmpl/gtk-unused.sgml6
-rw-r--r--docs/reference/gtk/tmpl/gtkmenu.sgml6
-rw-r--r--docs/reference/gtk/tmpl/gtknotebook.sgml2
-rw-r--r--docs/reference/gtk/tmpl/gtkpaned.sgml7
-rw-r--r--docs/reference/gtk/tmpl/gtktextview.sgml9
-rw-r--r--gtk/gtkmarshalers.list1
-rw-r--r--gtk/gtktextlayout.c39
-rw-r--r--gtk/gtktextlayout.h4
-rw-r--r--gtk/gtktextview.c175
-rw-r--r--gtk/gtktextview.h12
17 files changed, 332 insertions, 20 deletions
diff --git a/ChangeLog b/ChangeLog
index 1e10abcd7c..b301f95861 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2002-01-17 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new
+ function (which I then decided not to use but I think it's needed
+ to fix #68963
+
+ * gtk/gtktextview.c: add page_horizontally action signal and
+ implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig,
+ hackily modified to avoid adding GTK_MOVEMENT_ API. Part of
+ #53934
+
+ * gtk/gtkmarshalers.list: add NONE:INT,BOOL
+
Thu Jan 17 17:02:38 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_real_unrealize): Call
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 1e10abcd7c..b301f95861 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,16 @@
+2002-01-17 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new
+ function (which I then decided not to use but I think it's needed
+ to fix #68963
+
+ * gtk/gtktextview.c: add page_horizontally action signal and
+ implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig,
+ hackily modified to avoid adding GTK_MOVEMENT_ API. Part of
+ #53934
+
+ * gtk/gtkmarshalers.list: add NONE:INT,BOOL
+
Thu Jan 17 17:02:38 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_real_unrealize): Call
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 1e10abcd7c..b301f95861 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,16 @@
+2002-01-17 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new
+ function (which I then decided not to use but I think it's needed
+ to fix #68963
+
+ * gtk/gtktextview.c: add page_horizontally action signal and
+ implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig,
+ hackily modified to avoid adding GTK_MOVEMENT_ API. Part of
+ #53934
+
+ * gtk/gtkmarshalers.list: add NONE:INT,BOOL
+
Thu Jan 17 17:02:38 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_real_unrealize): Call
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 1e10abcd7c..b301f95861 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,16 @@
+2002-01-17 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new
+ function (which I then decided not to use but I think it's needed
+ to fix #68963
+
+ * gtk/gtktextview.c: add page_horizontally action signal and
+ implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig,
+ hackily modified to avoid adding GTK_MOVEMENT_ API. Part of
+ #53934
+
+ * gtk/gtkmarshalers.list: add NONE:INT,BOOL
+
Thu Jan 17 17:02:38 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_real_unrealize): Call
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 1e10abcd7c..b301f95861 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,16 @@
+2002-01-17 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new
+ function (which I then decided not to use but I think it's needed
+ to fix #68963
+
+ * gtk/gtktextview.c: add page_horizontally action signal and
+ implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig,
+ hackily modified to avoid adding GTK_MOVEMENT_ API. Part of
+ #53934
+
+ * gtk/gtkmarshalers.list: add NONE:INT,BOOL
+
Thu Jan 17 17:02:38 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_real_unrealize): Call
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 1e10abcd7c..b301f95861 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,16 @@
+2002-01-17 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new
+ function (which I then decided not to use but I think it's needed
+ to fix #68963
+
+ * gtk/gtktextview.c: add page_horizontally action signal and
+ implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig,
+ hackily modified to avoid adding GTK_MOVEMENT_ API. Part of
+ #53934
+
+ * gtk/gtkmarshalers.list: add NONE:INT,BOOL
+
Thu Jan 17 17:02:38 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_real_unrealize): Call
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 1e10abcd7c..b301f95861 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,16 @@
+2002-01-17 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtktextlayout.c (_gtk_text_layout_get_line_xrange): new
+ function (which I then decided not to use but I think it's needed
+ to fix #68963
+
+ * gtk/gtktextview.c: add page_horizontally action signal and
+ implement Ctrl+PgUp, Ctrl+PgDown based on patch from Padraig,
+ hackily modified to avoid adding GTK_MOVEMENT_ API. Part of
+ #53934
+
+ * gtk/gtkmarshalers.list: add NONE:INT,BOOL
+
Thu Jan 17 17:02:38 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_real_unrealize): Call
diff --git a/docs/reference/gtk/tmpl/gtk-unused.sgml b/docs/reference/gtk/tmpl/gtk-unused.sgml
index 456bfeb3dd..a3bb8b493e 100644
--- a/docs/reference/gtk/tmpl/gtk-unused.sgml
+++ b/docs/reference/gtk/tmpl/gtk-unused.sgml
@@ -2550,12 +2550,6 @@ Internal function used by #GtkHPaned and #GtkVPaned
@child1_req:
@child2_req:
-<!-- ##### MACRO gtk_paned_handle_size ##### -->
-<para>
-Old name for gtk_paned_set_handle_size().
-</para>
-
-
<!-- ##### FUNCTION gtk_paned_set_handle_size ##### -->
<para>
Set the the handle size to @size x @size pixels.
diff --git a/docs/reference/gtk/tmpl/gtkmenu.sgml b/docs/reference/gtk/tmpl/gtkmenu.sgml
index c060e31b92..f0db72f47a 100644
--- a/docs/reference/gtk/tmpl/gtkmenu.sgml
+++ b/docs/reference/gtk/tmpl/gtkmenu.sgml
@@ -96,9 +96,9 @@ Creates a new #GtkMenu.
Adds a new #GtkMenuItem to the end of the menu's item list.
</para>
+<!-- # Unused Parameters # -->
@menu: a #GtkMenu.
@child: The #GtkMenuItem to add.
-<!-- # Unused Parameters # -->
@m:
@c:
@@ -108,9 +108,9 @@ Adds a new #GtkMenuItem to the end of the menu's item list.
Adds a new #GtkMenuItem to the beginning of the menu's item list.
</para>
+<!-- # Unused Parameters # -->
@menu: a #GtkMenu.
@child: The #GtkMenuItem to add.
-<!-- # Unused Parameters # -->
@menu_child:
@m:
@c:
@@ -122,10 +122,10 @@ Adds a new #GtkMenuItem to the menu's item list at the position
indicated by @position.
</para>
+<!-- # Unused Parameters # -->
@menu: a #GtkMenu.
@child: The #GtkMenuItem to add.
@pos:
-<!-- # Unused Parameters # -->
@position: The position in the item list where @child is added.
Positions are numbered from 0 to n-1.
diff --git a/docs/reference/gtk/tmpl/gtknotebook.sgml b/docs/reference/gtk/tmpl/gtknotebook.sgml
index c4f727b782..96c321bbcb 100644
--- a/docs/reference/gtk/tmpl/gtknotebook.sgml
+++ b/docs/reference/gtk/tmpl/gtknotebook.sgml
@@ -407,6 +407,7 @@ gtk_notebook_set_current_page() instead.
@notebook: the object which received the signal.
@arg1:
+@Returns:
<!-- ##### SIGNAL GtkNotebook::focus-tab ##### -->
<para>
@@ -423,6 +424,7 @@ gtk_notebook_set_current_page() instead.
@notebook: the object which received the signal.
@arg1:
+@Returns:
<!-- ##### SIGNAL GtkNotebook::switch-page ##### -->
<para>
diff --git a/docs/reference/gtk/tmpl/gtkpaned.sgml b/docs/reference/gtk/tmpl/gtkpaned.sgml
index 1e3b1df6b8..33f24283a3 100644
--- a/docs/reference/gtk/tmpl/gtkpaned.sgml
+++ b/docs/reference/gtk/tmpl/gtkpaned.sgml
@@ -95,6 +95,13 @@ parameters. This is equivalent to
@child: the child to add
+<!-- ##### MACRO gtk_paned_handle_size ##### -->
+<para>
+Old name for gtk_paned_set_handle_size().
+</para>
+
+
+
<!-- ##### MACRO gtk_paned_gutter_size ##### -->
<para>
Old name for gtk_paned_set_gutter_size().
diff --git a/docs/reference/gtk/tmpl/gtktextview.sgml b/docs/reference/gtk/tmpl/gtktextview.sgml
index 51ab152f35..6e6617c87c 100644
--- a/docs/reference/gtk/tmpl/gtktextview.sgml
+++ b/docs/reference/gtk/tmpl/gtktextview.sgml
@@ -648,6 +648,15 @@ in an idle job in the background.
@textview: the object which received the signal.
@arg1:
+<!-- ##### SIGNAL GtkTextView::page-horizontally ##### -->
+<para>
+
+</para>
+
+@textview: the object which received the signal.
+@arg1:
+@arg2:
+
<!-- ##### SIGNAL GtkTextView::paste-clipboard ##### -->
<para>
diff --git a/gtk/gtkmarshalers.list b/gtk/gtkmarshalers.list
index 659b626f3b..d1e9159590 100644
--- a/gtk/gtkmarshalers.list
+++ b/gtk/gtkmarshalers.list
@@ -36,6 +36,7 @@ INT:POINTER
NONE:BOOLEAN
NONE:ENUM
NONE:INT
+NONE:INT,BOOL
NONE:INT,INT
NONE:NONE
NONE:STRING,INT,POINTER
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index 4a85903a6b..d6bfbd0877 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -2249,6 +2249,45 @@ gtk_text_layout_get_line_yrange (GtkTextLayout *layout,
}
}
+/**
+ * _gtk_text_layout_get_line_xrange:
+ * @layout: a #GtkTextLayout
+ * @iter: a #GtkTextIter
+ * @x: location to store the top of the paragraph in pixels,
+ * or %NULL.
+ * @width location to store the height of the paragraph in pixels,
+ * or %NULL.
+ *
+ * Find the range of X coordinates for the paragraph containing
+ * the given iter. Private for 2.0 due to API freeze, could
+ * be made public for 2.2.
+ **/
+void
+_gtk_text_layout_get_line_xrange (GtkTextLayout *layout,
+ const GtkTextIter *iter,
+ gint *x,
+ gint *width)
+{
+ GtkTextLine *line;
+
+ g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
+ g_return_if_fail (_gtk_text_iter_get_btree (iter) == _gtk_text_buffer_get_btree (layout->buffer));
+
+ line = _gtk_text_iter_get_text_line (iter);
+
+ if (x)
+ *x = 0; /* FIXME This is wrong; should represent the first available cursor position */
+
+ if (width)
+ {
+ GtkTextLineData *line_data = _gtk_text_line_get_data (line, layout);
+ if (line_data)
+ *width = line_data->width;
+ else
+ *width = 0;
+ }
+}
+
void
gtk_text_layout_get_iter_location (GtkTextLayout *layout,
const GtkTextIter *iter,
diff --git a/gtk/gtktextlayout.h b/gtk/gtktextlayout.h
index 5e52f7d32b..9418b974d2 100644
--- a/gtk/gtktextlayout.h
+++ b/gtk/gtktextlayout.h
@@ -345,6 +345,10 @@ void gtk_text_layout_get_line_yrange (GtkTextLayout *layout,
const GtkTextIter *iter,
gint *y,
gint *height);
+void _gtk_text_layout_get_line_xrange (GtkTextLayout *layout,
+ const GtkTextIter *iter,
+ gint *x,
+ gint *width);
void gtk_text_layout_get_cursor_locations (GtkTextLayout *layout,
GtkTextIter *iter,
GdkRectangle *strong_pos,
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index e862ac9d03..7f3f79e3b1 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -109,6 +109,7 @@ enum
SET_SCROLL_ADJUSTMENTS,
POPULATE_POPUP,
MOVE_CURSOR,
+ PAGE_HORIZONTALLY,
SET_ANCHOR,
INSERT_AT_CURSOR,
DELETE_FROM_CURSOR,
@@ -223,13 +224,18 @@ static void gtk_text_view_set_scroll_adjustments (GtkTextView *text_view,
GtkAdjustment *vadj);
static void gtk_text_view_popup_menu (GtkWidget *widget);
-static void gtk_text_view_move_cursor (GtkTextView *text_view,
- GtkMovementStep step,
- gint count,
- gboolean extend_selection);
+static void gtk_text_view_move_cursor (GtkTextView *text_view,
+ GtkMovementStep step,
+ gint count,
+ gboolean extend_selection);
+static void gtk_text_view_page_horizontally (GtkTextView *text_view,
+ gint count,
+ gboolean extend_selection);
static void gtk_text_view_set_anchor (GtkTextView *text_view);
static void gtk_text_view_scroll_pages (GtkTextView *text_view,
gint count);
+static void gtk_text_view_scroll_hpages (GtkTextView *text_view,
+ gint count);
static void gtk_text_view_insert_at_cursor (GtkTextView *text_view,
const gchar *str);
static void gtk_text_view_delete_from_cursor (GtkTextView *text_view,
@@ -508,6 +514,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
container_class->forall = gtk_text_view_forall;
klass->move_cursor = gtk_text_view_move_cursor;
+ klass->page_horizontally = gtk_text_view_page_horizontally;
klass->set_anchor = gtk_text_view_set_anchor;
klass->insert_at_cursor = gtk_text_view_insert_at_cursor;
klass->delete_from_cursor = gtk_text_view_delete_from_cursor;
@@ -649,6 +656,14 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
_gtk_marshal_VOID__ENUM_INT_BOOLEAN,
GTK_TYPE_NONE, 3, GTK_TYPE_MOVEMENT_STEP, GTK_TYPE_INT, GTK_TYPE_BOOL);
+ signals[PAGE_HORIZONTALLY] =
+ gtk_signal_new ("page_horizontally",
+ GTK_RUN_LAST | GTK_RUN_ACTION,
+ GTK_CLASS_TYPE (object_class),
+ GTK_SIGNAL_OFFSET (GtkTextViewClass, page_horizontally),
+ _gtk_marshal_VOID__INT_BOOLEAN,
+ GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_BOOL);
+
signals[SET_ANCHOR] =
gtk_signal_new ("set_anchor",
GTK_RUN_LAST | GTK_RUN_ACTION,
@@ -735,7 +750,7 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
*/
binding_set = gtk_binding_set_by_class (klass);
-
+
/* Moving the insertion point */
add_move_binding (binding_set, GDK_Right, 0,
GTK_MOVEMENT_VISUAL_POSITIONS, 1);
@@ -845,6 +860,46 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
add_move_binding (binding_set, GDK_KP_Page_Down, 0,
GTK_MOVEMENT_PAGES, 1);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_Page_Up, GDK_CONTROL_MASK,
+ "page_horizontally", 2,
+ GTK_TYPE_INT, -1,
+ GTK_TYPE_BOOL, FALSE);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_Page_Up, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
+ "page_horizontally", 2,
+ GTK_TYPE_INT, -1,
+ GTK_TYPE_BOOL, TRUE);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_KP_Page_Up, GDK_CONTROL_MASK,
+ "page_horizontally", 2,
+ GTK_TYPE_INT, -1,
+ GTK_TYPE_BOOL, FALSE);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_KP_Page_Up, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
+ "page_horizontally", 2,
+ GTK_TYPE_INT, -1,
+ GTK_TYPE_BOOL, TRUE);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_Page_Down, GDK_CONTROL_MASK,
+ "page_horizontally", 2,
+ GTK_TYPE_INT, 1,
+ GTK_TYPE_BOOL, FALSE);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_Page_Down, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
+ "page_horizontally", 2,
+ GTK_TYPE_INT, 1,
+ GTK_TYPE_BOOL, TRUE);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_KP_Page_Down, GDK_CONTROL_MASK,
+ "page_horizontally", 2,
+ GTK_TYPE_INT, 1,
+ GTK_TYPE_BOOL, FALSE);
+
+ gtk_binding_entry_add_signal (binding_set, GDK_KP_Page_Down, GDK_CONTROL_MASK | GDK_SHIFT_MASK,
+ "page_horizontally", 2,
+ GTK_TYPE_INT, 1,
+ GTK_TYPE_BOOL, TRUE);
/* Setting the cut/paste/copy anchor */
gtk_binding_entry_add_signal (binding_set, GDK_space, GDK_CONTROL_MASK,
@@ -4329,11 +4384,16 @@ gtk_text_view_move_iter_by_lines (GtkTextView *text_view,
}
}
+/* FIXME when we are unfrozen and can change GtkMovementStep,
+ * fix this
+ */
+#define PAGE_HORIZONTALLY_HACK_VALUE 57
+
static void
-gtk_text_view_move_cursor (GtkTextView *text_view,
- GtkMovementStep step,
- gint count,
- gboolean extend_selection)
+gtk_text_view_move_cursor_internal (GtkTextView *text_view,
+ GtkMovementStep step,
+ gint count,
+ gboolean extend_selection)
{
GtkTextIter insert;
GtkTextIter newplace;
@@ -4348,6 +4408,12 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
gtk_text_view_pend_cursor_blink (text_view);
return;
}
+ else if (step == PAGE_HORIZONTALLY_HACK_VALUE)
+ {
+ gtk_text_view_scroll_hpages (text_view, count);
+ gtk_text_view_pend_cursor_blink (text_view);
+ return;
+ }
gtk_text_buffer_get_iter_at_mark (get_buffer (text_view), &insert,
gtk_text_buffer_get_mark (get_buffer (text_view),
@@ -4413,7 +4479,7 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
else if (count < 0)
gtk_text_buffer_get_iter_at_offset (get_buffer (text_view), &newplace, 0);
break;
-
+
default:
break;
}
@@ -4443,6 +4509,24 @@ gtk_text_view_move_cursor (GtkTextView *text_view,
}
static void
+gtk_text_view_move_cursor (GtkTextView *text_view,
+ GtkMovementStep step,
+ gint count,
+ gboolean extend_selection)
+{
+ gtk_text_view_move_cursor_internal (text_view, step, count, extend_selection);
+}
+
+static void
+gtk_text_view_page_horizontally (GtkTextView *text_view,
+ gint count,
+ gboolean extend_selection)
+{
+ gtk_text_view_move_cursor_internal (text_view, PAGE_HORIZONTALLY_HACK_VALUE,
+ count, extend_selection);
+}
+
+static void
gtk_text_view_set_anchor (GtkTextView *text_view)
{
GtkTextIter insert;
@@ -4528,6 +4612,77 @@ gtk_text_view_scroll_pages (GtkTextView *text_view,
"insert"));
}
+static void
+gtk_text_view_scroll_hpages (GtkTextView *text_view,
+ gint count)
+{
+ gdouble newval;
+ gdouble oldval;
+ GtkAdjustment *adj;
+ gint cursor_x_pos, cursor_y_pos;
+ GtkTextIter new_insert;
+ gint y, height;
+ gint x, width;
+
+ g_return_if_fail (text_view->hadjustment != NULL);
+
+ adj = text_view->hadjustment;
+
+ /* Validate the line that we're moving within.
+ */
+ gtk_text_buffer_get_iter_at_mark (get_buffer (text_view),
+ &new_insert,
+ gtk_text_buffer_get_mark (get_buffer (text_view), "insert"));
+ gtk_text_layout_get_line_yrange (text_view->layout, &new_insert, &y, &height);
+ gtk_text_layout_validate_yrange (text_view->layout, &new_insert, y, y + height);
+ /* FIXME do we need to update the adjustment ranges here? */
+
+ if (count < 0 && adj->value <= (adj->lower + 1e-12))
+ {
+ /* already at far left, just be sure we are at offset 0 */
+ gtk_text_iter_set_line_offset (&new_insert, 0);
+ gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
+ }
+ else if (count > 0 && adj->value >= (adj->upper - adj->page_size - 1e-12))
+ {
+ /* already at far right, just be sure we are at the end */
+ gtk_text_iter_forward_to_line_end (&new_insert);
+ gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
+ }
+ else
+ {
+ gtk_text_view_get_virtual_cursor_pos (text_view, &cursor_x_pos, &cursor_y_pos);
+
+ newval = adj->value;
+ oldval = adj->value;
+
+ newval += count * adj->page_increment;
+
+ set_adjustment_clamped (adj, newval);
+ cursor_x_pos += adj->value - oldval;
+
+ gtk_text_layout_get_iter_at_pixel (text_view->layout, &new_insert, cursor_x_pos, cursor_y_pos);
+ clamp_iter_onscreen (text_view, &new_insert);
+ gtk_text_buffer_place_cursor (get_buffer (text_view), &new_insert);
+
+ gtk_text_view_set_virtual_cursor_pos (text_view, cursor_x_pos, cursor_y_pos);
+ }
+
+ /* FIXME for lines shorter than the overall widget width, this results in a
+ * "bounce" effect as we scroll to the right of the widget, then scroll
+ * back to get the end of the line onscreen.
+ * http://bugzilla.gnome.org/show_bug.cgi?id=68963
+ */
+
+ /* Adjust to have the cursor _entirely_ onscreen, move_mark_onscreen
+ * only guarantees 1 pixel onscreen.
+ */
+ DV(g_print (G_STRLOC": scrolling onscreen\n"));
+ gtk_text_view_scroll_mark_onscreen (text_view,
+ gtk_text_buffer_get_mark (get_buffer (text_view),
+ "insert"));
+}
+
static gboolean
whitespace (gunichar ch, gpointer user_data)
{
diff --git a/gtk/gtktextview.h b/gtk/gtktextview.h
index b52ca6d12b..df8abe7802 100644
--- a/gtk/gtktextview.h
+++ b/gtk/gtktextview.h
@@ -168,6 +168,15 @@ struct _GtkTextViewClass
GtkMovementStep step,
gint count,
gboolean extend_selection);
+
+ /* FIXME should be deprecated in favor of adding GTK_MOVEMENT_HORIZONTAL_PAGES
+ * or something in GTK 2.2, was put in to avoid adding enum values during
+ * the freeze.
+ */
+ void (* page_horizontally) (GtkTextView *text_view,
+ gint count,
+ gboolean extend_selection);
+
/* move the "anchor" (what Emacs calls the mark) to the cursor position */
void (* set_anchor) (GtkTextView *text_view);
@@ -187,7 +196,8 @@ struct _GtkTextViewClass
/* propagates to GtkWindow move_focus */
void (* move_focus) (GtkTextView *text_view,
- GtkDirectionType direction);
+ GtkDirectionType direction);
+
GtkFunction pad1;
GtkFunction pad2;