Encapsulate in a function.
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com> * gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate in a function. * gtk/gtktextlayout.c (find_display_line_above): Fixed bug with computing line tops. * gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,13 @@
|
||||
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
|
||||
in a function.
|
||||
|
||||
* gtk/gtktextlayout.c (find_display_line_above): Fixed
|
||||
bug with computing line tops.
|
||||
|
||||
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
|
||||
|
||||
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
|
||||
in a function.
|
||||
|
||||
* gtk/gtktextlayout.c (find_display_line_above): Fixed
|
||||
bug with computing line tops.
|
||||
|
||||
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
|
||||
|
||||
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
|
||||
in a function.
|
||||
|
||||
* gtk/gtktextlayout.c (find_display_line_above): Fixed
|
||||
bug with computing line tops.
|
||||
|
||||
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
|
||||
|
||||
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
|
||||
in a function.
|
||||
|
||||
* gtk/gtktextlayout.c (find_display_line_above): Fixed
|
||||
bug with computing line tops.
|
||||
|
||||
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
|
||||
|
||||
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
|
||||
in a function.
|
||||
|
||||
* gtk/gtktextlayout.c (find_display_line_above): Fixed
|
||||
bug with computing line tops.
|
||||
|
||||
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
|
||||
|
||||
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
|
||||
in a function.
|
||||
|
||||
* gtk/gtktextlayout.c (find_display_line_above): Fixed
|
||||
bug with computing line tops.
|
||||
|
||||
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
|
||||
|
||||
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
Mon May 22 15:47:30 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextview.c (gtk_text_view_get_first_para_iter): Encapsulate
|
||||
in a function.
|
||||
|
||||
* gtk/gtktextlayout.c (find_display_line_above): Fixed
|
||||
bug with computing line tops.
|
||||
|
||||
* gtk/gtktextview.c (changed_handler): Fix < , <= confusion.
|
||||
|
||||
Thu May 18 18:53:31 2000 Owen Taylor <otaylor@redhat.com>
|
||||
|
||||
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Fix up the x_offset
|
||||
|
||||
@@ -1676,21 +1676,28 @@ find_display_line_above (GtkTextLayout *layout,
|
||||
while (line && !found_line)
|
||||
{
|
||||
GtkTextLineDisplay *display = gtk_text_layout_get_line_display (layout, line, TRUE);
|
||||
gint byte_index = 0;
|
||||
GSList *tmp_list = pango_layout_get_lines (display->layout);
|
||||
|
||||
line_top += display->top_margin;
|
||||
PangoRectangle logical_rect;
|
||||
|
||||
gint byte_index = 0;
|
||||
GSList *tmp_list;
|
||||
gint tmp_top;
|
||||
|
||||
line_top -= display->top_margin + display->bottom_margin;
|
||||
pango_layout_get_extents (display->layout, NULL, &logical_rect);
|
||||
line_top -= logical_rect.height / PANGO_SCALE;
|
||||
|
||||
tmp_top = line_top + display->top_margin;
|
||||
|
||||
tmp_list = pango_layout_get_lines (display->layout);
|
||||
while (tmp_list)
|
||||
{
|
||||
PangoRectangle logical_rect;
|
||||
PangoLayoutLine *layout_line = tmp_list->data;
|
||||
|
||||
found_byte = byte_index;
|
||||
|
||||
line_top += logical_rect.height / PANGO_SCALE;
|
||||
tmp_top += logical_rect.height / PANGO_SCALE;
|
||||
|
||||
if (line_top < y)
|
||||
if (tmp_top < y)
|
||||
{
|
||||
found_line = line;
|
||||
found_byte = byte_index;
|
||||
@@ -1701,7 +1708,6 @@ find_display_line_above (GtkTextLayout *layout,
|
||||
tmp_list = tmp_list->next;
|
||||
}
|
||||
|
||||
line_top += display->bottom_margin;
|
||||
gtk_text_layout_free_line_display (layout, display);
|
||||
|
||||
line = gtk_text_line_previous (line);
|
||||
|
||||
@@ -175,6 +175,8 @@ static void gtk_text_view_toggle_overwrite (GtkTextView *text_view);
|
||||
|
||||
|
||||
static void gtk_text_view_validate_onscreen (GtkTextView *text_view);
|
||||
static void gtk_text_view_get_first_para_iter (GtkTextView *text_view,
|
||||
GtkTextIter *iter);
|
||||
static void gtk_text_view_scroll_calc_now (GtkTextView *text_view);
|
||||
static void gtk_text_view_set_values_from_style (GtkTextView *text_view,
|
||||
GtkTextStyleValues *values,
|
||||
@@ -1080,7 +1082,6 @@ gtk_text_view_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GtkTextView *text_view;
|
||||
gchar *mark_name;
|
||||
GtkTextIter first_para;
|
||||
gint y;
|
||||
GtkAdjustment *vadj;
|
||||
@@ -1108,12 +1109,9 @@ gtk_text_view_size_allocate (GtkWidget *widget,
|
||||
gtk_text_view_scroll_calc_now (text_view);
|
||||
|
||||
/* Now adjust the value of the adjustment to keep the cursor at the same place in
|
||||
* the buffer
|
||||
*/
|
||||
mark_name = gtk_text_mark_get_name (text_view->first_para_mark);
|
||||
gtk_text_buffer_get_iter_at_mark (text_view->buffer, &first_para, mark_name);
|
||||
g_free (mark_name);
|
||||
|
||||
* the buffer
|
||||
*/
|
||||
gtk_text_view_get_first_para_iter (text_view, &first_para);
|
||||
y = gtk_text_layout_get_line_y (text_view->layout, &first_para) + text_view->first_para_pixels;
|
||||
|
||||
vadj = text_view->vadjustment;
|
||||
@@ -1142,6 +1140,15 @@ gtk_text_view_size_allocate (GtkWidget *widget,
|
||||
gtk_adjustment_value_changed (vadj);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_get_first_para_iter (GtkTextView *text_view,
|
||||
GtkTextIter *iter)
|
||||
{
|
||||
gchar *mark_name = gtk_text_mark_get_name (text_view->first_para_mark);
|
||||
gtk_text_buffer_get_iter_at_mark (text_view->buffer, iter, mark_name);
|
||||
g_free (mark_name);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_text_view_validate_onscreen (GtkTextView *text_view)
|
||||
{
|
||||
@@ -1150,10 +1157,7 @@ gtk_text_view_validate_onscreen (GtkTextView *text_view)
|
||||
if (widget->allocation.height > 0)
|
||||
{
|
||||
GtkTextIter first_para;
|
||||
gchar *mark_name = gtk_text_mark_get_name (text_view->first_para_mark);
|
||||
gtk_text_buffer_get_iter_at_mark (text_view->buffer, &first_para, mark_name);
|
||||
g_free (mark_name);
|
||||
|
||||
gtk_text_view_get_first_para_iter (text_view, &first_para);
|
||||
gtk_text_layout_validate_yrange (text_view->layout,
|
||||
&first_para,
|
||||
0, text_view->first_para_pixels + widget->allocation.height);
|
||||
@@ -1235,8 +1239,8 @@ changed_handler (GtkTextLayout *layout,
|
||||
if (old_height != new_height)
|
||||
{
|
||||
gboolean yoffset_changed = FALSE;
|
||||
|
||||
if (start_y + old_height < text_view->yoffset - text_view->first_para_pixels)
|
||||
|
||||
if (start_y + old_height <= text_view->yoffset - text_view->first_para_pixels)
|
||||
{
|
||||
text_view->yoffset += new_height - old_height;
|
||||
text_view->vadjustment->value = text_view->yoffset;
|
||||
@@ -1833,15 +1837,48 @@ gtk_text_view_scroll_text (GtkTextView *text_view,
|
||||
GtkAdjustment *adj;
|
||||
gint cursor_x_pos, cursor_y_pos;
|
||||
GtkTextIter new_insert;
|
||||
GtkTextIter anchor;
|
||||
gint y0, y1;
|
||||
|
||||
g_return_if_fail (text_view->vadjustment != NULL);
|
||||
|
||||
adj = text_view->vadjustment;
|
||||
|
||||
newval = adj->value;
|
||||
|
||||
/* Validate the region that will be brought into view by the cursor motion
|
||||
*/
|
||||
switch (type)
|
||||
{
|
||||
default:
|
||||
case GTK_TEXT_SCROLL_TO_TOP:
|
||||
gtk_text_buffer_get_iter_at_char (text_view->buffer, &anchor, 0);
|
||||
y0 = 0;
|
||||
y1 = adj->page_size;
|
||||
break;
|
||||
|
||||
case GTK_TEXT_SCROLL_TO_BOTTOM:
|
||||
gtk_text_buffer_get_last_iter (text_view->buffer, &anchor);
|
||||
y0 = -adj->page_size;
|
||||
y1 = adj->page_size;
|
||||
break;
|
||||
|
||||
case GTK_TEXT_SCROLL_PAGE_DOWN:
|
||||
gtk_text_view_get_first_para_iter (text_view, &anchor);
|
||||
y0 = adj->page_size;
|
||||
y1 = adj->page_size + adj->page_increment;
|
||||
break;
|
||||
|
||||
case GTK_TEXT_SCROLL_PAGE_UP:
|
||||
gtk_text_view_get_first_para_iter (text_view, &anchor);
|
||||
y0 = - adj->page_increment + adj->page_size;
|
||||
y1 = 0;
|
||||
break;
|
||||
}
|
||||
gtk_text_layout_validate_yrange (text_view->layout, &anchor, y0, y1);
|
||||
|
||||
|
||||
gtk_text_view_get_virtual_cursor_pos (text_view, &cursor_x_pos, &cursor_y_pos);
|
||||
|
||||
|
||||
newval = adj->value;
|
||||
switch (type)
|
||||
{
|
||||
case GTK_TEXT_SCROLL_TO_TOP:
|
||||
@@ -2767,7 +2804,10 @@ gtk_text_view_value_changed (GtkAdjustment *adj,
|
||||
}
|
||||
|
||||
if (dx != 0 || dy != 0)
|
||||
gdk_window_scroll (text_view->bin_window, dx, dy);
|
||||
{
|
||||
gdk_window_scroll (text_view->bin_window, dx, dy);
|
||||
gdk_window_process_updates (text_view->bin_window, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user