ed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>

* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
	unconditionally, since we may need to update the horizontal
	scrollbars even if the height didn't change.

	* gtk/gtktextlayout.c (add_preedit_attrs): Always get
	the extra attrs, since some of them affect size.

	* gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
	x_offset correctly.
This commit is contained in:
Owen Taylor 2000-11-15 21:12:58 +00:00
parent c990d4ab1a
commit de49f2ce05
10 changed files with 109 additions and 37 deletions

View File

@ -1,3 +1,15 @@
Wed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
unconditionally, since we may need to update the horizontal
scrollbars even if the height didn't change.
* gtk/gtktextlayout.c (add_preedit_attrs): Always get
the extra attrs, since some of them affect size.
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
x_offset correctly.
2000-11-15 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (set_para_values): If indent is negative,

View File

@ -1,3 +1,15 @@
Wed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
unconditionally, since we may need to update the horizontal
scrollbars even if the height didn't change.
* gtk/gtktextlayout.c (add_preedit_attrs): Always get
the extra attrs, since some of them affect size.
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
x_offset correctly.
2000-11-15 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (set_para_values): If indent is negative,

View File

@ -1,3 +1,15 @@
Wed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
unconditionally, since we may need to update the horizontal
scrollbars even if the height didn't change.
* gtk/gtktextlayout.c (add_preedit_attrs): Always get
the extra attrs, since some of them affect size.
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
x_offset correctly.
2000-11-15 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (set_para_values): If indent is negative,

View File

@ -1,3 +1,15 @@
Wed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
unconditionally, since we may need to update the horizontal
scrollbars even if the height didn't change.
* gtk/gtktextlayout.c (add_preedit_attrs): Always get
the extra attrs, since some of them affect size.
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
x_offset correctly.
2000-11-15 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (set_para_values): If indent is negative,

View File

@ -1,3 +1,15 @@
Wed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
unconditionally, since we may need to update the horizontal
scrollbars even if the height didn't change.
* gtk/gtktextlayout.c (add_preedit_attrs): Always get
the extra attrs, since some of them affect size.
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
x_offset correctly.
2000-11-15 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (set_para_values): If indent is negative,

View File

@ -1,3 +1,15 @@
Wed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
unconditionally, since we may need to update the horizontal
scrollbars even if the height didn't change.
* gtk/gtktextlayout.c (add_preedit_attrs): Always get
the extra attrs, since some of them affect size.
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
x_offset correctly.
2000-11-15 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (set_para_values): If indent is negative,

View File

@ -1,3 +1,15 @@
Wed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
unconditionally, since we may need to update the horizontal
scrollbars even if the height didn't change.
* gtk/gtktextlayout.c (add_preedit_attrs): Always get
the extra attrs, since some of them affect size.
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
x_offset correctly.
2000-11-15 Havoc Pennington <hp@redhat.com>
* gtk/gtktextlayout.c (set_para_values): If indent is negative,

View File

@ -668,8 +668,8 @@ void
gtk_text_layout_draw (GtkTextLayout *layout,
GtkWidget *widget,
GdkDrawable *drawable,
/* Location of the layout
in buffer coordinates */
/* Location of the drawable
in layout coordinates */
gint x_offset,
gint y_offset,
/* Region of the layout to
@ -782,9 +782,9 @@ gtk_text_layout_draw (GtkTextLayout *layout,
gc = widget->style->fg_gc[GTK_STATE_NORMAL];
gdk_draw_line (drawable, gc,
line_display->x_offset + cursor->x,
line_display->x_offset + cursor->x - x_offset,
current_y + line_display->top_margin + cursor->y,
line_display->x_offset + cursor->x,
line_display->x_offset + cursor->x - x_offset,
current_y + line_display->top_margin + cursor->y + cursor->height - 1);
cursor_list = cursor_list->next;

View File

@ -480,17 +480,8 @@ gtk_text_layout_get_size (GtkTextLayout *layout,
gint *width,
gint *height)
{
gint w, h;
g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
gtk_text_btree_get_view_size (_gtk_text_buffer_get_btree (layout->buffer),
layout,
&w, &h);
layout->width = w;
layout->height = h;
if (width)
*width = layout->width;
@ -739,6 +730,14 @@ gtk_text_layout_is_valid (GtkTextLayout *layout)
layout);
}
static void
update_layout_size (GtkTextLayout *layout)
{
gtk_text_btree_get_view_size (_gtk_text_buffer_get_btree (layout->buffer),
layout,
&layout->width, &layout->height);
}
/**
* gtk_text_layout_validate_yrange:
* @layout: a #GtkTextLayout
@ -835,13 +834,17 @@ gtk_text_layout_validate_yrange (GtkTextLayout *layout,
line = gtk_text_line_next (line);
}
/* If we found and validated any invalid lines, emit the changed singal
/* If we found and validated any invalid lines, update size and
* emit the changed signal
*/
if (first_line)
{
gint line_top =
gtk_text_btree_find_line_top (_gtk_text_buffer_get_btree (layout->buffer),
first_line, layout);
gint line_top;
update_layout_size (layout);
line_top = gtk_text_btree_find_line_top (_gtk_text_buffer_get_btree (layout->buffer),
first_line, layout);
gtk_text_layout_changed (layout,
line_top,
@ -874,6 +877,8 @@ gtk_text_layout_validate (GtkTextLayout *layout,
&y, &old_height, &new_height))
{
max_pixels -= new_height;
update_layout_size (layout);
gtk_text_layout_changed (layout, y, old_height, new_height);
}
}
@ -1475,7 +1480,7 @@ add_preedit_attrs (GtkTextLayout *layout,
end = layout->preedit_len;
pango_attr_iterator_get_font (iter, &style->font,
&font_desc, size_only ? NULL : &extra_attrs);
&font_desc, &extra_attrs);
tmp_list = extra_attrs;
while (tmp_list)

View File

@ -2141,11 +2141,11 @@ changed_handler (GtkTextLayout *layout,
yoffset_changed = TRUE;
}
gtk_text_view_scroll_calc_now (text_view);
if (yoffset_changed)
gtk_adjustment_value_changed (get_vadjustment (text_view));
}
gtk_text_view_scroll_calc_now (text_view);
}
static void
@ -3539,25 +3539,8 @@ gtk_text_view_scroll_calc_now (GtkTextView *text_view)
gtk_text_layout_get_size (text_view->layout, &width, &height);
#if 0
/* If the width is less than the screen width (likely
if we have wrapping turned on for the whole widget),
then we want to set the scroll region to the screen
width. If the width is greater (wrapping off) then we
probably want to set the scroll region to the width
of the layout. I guess.
*/
width = MAX (text_view->layout->screen_width, width);
height = height;
#endif
if (text_view->width != width || text_view->height != height)
{
#if 0
printf ("layout size set, widget width is %d\n",
GTK_WIDGET (text_view)->allocation.width);
#endif
text_view->width = width;
text_view->height = height;