From 66a7a593e2b1ff539b4acbef0879f9a72edfb787 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 21 Jul 1999 19:45:55 +0000 Subject: [PATCH] Don't display wrap indicators when text is not editable and word wrap is Wed Jul 21 15:47:39 1999 Owen Taylor * gtk/gtktext.c: Don't display wrap indicators when text is not editable and word wrap is on. --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gtk/gtktext.c | 22 +++++++++++++++------- 8 files changed, 50 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index d36ac966d4..745f80fe03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Jul 21 15:47:39 1999 Owen Taylor + + * gtk/gtktext.c: Don't display wrap indicators when + text is not editable and word wrap is on. + Wed Jul 21 08:21:40 1999 Tim Janik * gtk/gtkitemfactory.c (gtk_item_factory_create_item): special case diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index d36ac966d4..745f80fe03 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +Wed Jul 21 15:47:39 1999 Owen Taylor + + * gtk/gtktext.c: Don't display wrap indicators when + text is not editable and word wrap is on. + Wed Jul 21 08:21:40 1999 Tim Janik * gtk/gtkitemfactory.c (gtk_item_factory_create_item): special case diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index d36ac966d4..745f80fe03 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Wed Jul 21 15:47:39 1999 Owen Taylor + + * gtk/gtktext.c: Don't display wrap indicators when + text is not editable and word wrap is on. + Wed Jul 21 08:21:40 1999 Tim Janik * gtk/gtkitemfactory.c (gtk_item_factory_create_item): special case diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index d36ac966d4..745f80fe03 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Wed Jul 21 15:47:39 1999 Owen Taylor + + * gtk/gtktext.c: Don't display wrap indicators when + text is not editable and word wrap is on. + Wed Jul 21 08:21:40 1999 Tim Janik * gtk/gtkitemfactory.c (gtk_item_factory_create_item): special case diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index d36ac966d4..745f80fe03 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Wed Jul 21 15:47:39 1999 Owen Taylor + + * gtk/gtktext.c: Don't display wrap indicators when + text is not editable and word wrap is on. + Wed Jul 21 08:21:40 1999 Tim Janik * gtk/gtkitemfactory.c (gtk_item_factory_create_item): special case diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index d36ac966d4..745f80fe03 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Wed Jul 21 15:47:39 1999 Owen Taylor + + * gtk/gtktext.c: Don't display wrap indicators when + text is not editable and word wrap is on. + Wed Jul 21 08:21:40 1999 Tim Janik * gtk/gtkitemfactory.c (gtk_item_factory_create_item): special case diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index d36ac966d4..745f80fe03 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Wed Jul 21 15:47:39 1999 Owen Taylor + + * gtk/gtktext.c: Don't display wrap indicators when + text is not editable and word wrap is on. + Wed Jul 21 08:21:40 1999 Tim Janik * gtk/gtkitemfactory.c (gtk_item_factory_create_item): special case diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 6f786a3790..417d4456c2 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -792,13 +792,14 @@ gtk_text_real_set_editable (GtkEditable *editable, g_return_if_fail (GTK_IS_TEXT (editable)); text = GTK_TEXT (editable); - + editable->editable = (is_editable != FALSE); - if (is_editable) - draw_cursor (text, TRUE); - else - undraw_cursor (text, TRUE); + if (GTK_WIDGET_REALIZED (text)) + { + recompute_geometry (text); + gtk_widget_queue_draw (GTK_WIDGET (text)); + } } void @@ -4674,7 +4675,8 @@ find_line_params (GtkText* text, GdkFont *font; gdk_window_get_size (text->text_area, (gint*) &max_display_pixels, NULL); - max_display_pixels -= LINE_WRAP_ROOM; + if (GTK_EDITABLE (text)->editable || !text->word_wrap) + max_display_pixels -= LINE_WRAP_ROOM; lp.wraps = 0; lp.tab_cont = *tab_cont; @@ -5064,7 +5066,10 @@ draw_line (GtkText* text, len = 1; gdk_window_get_size (text->text_area, &pixels_remaining, NULL); - pixels_remaining -= (LINE_WRAP_ROOM + running_offset); + if (GTK_EDITABLE (text)->editable || !text->word_wrap) + pixels_remaining -= (LINE_WRAP_ROOM + running_offset); + else + pixels_remaining -= running_offset; space_width = MARK_CURRENT_TEXT_FONT(text, &mark)->char_widths[' ']; @@ -5096,6 +5101,9 @@ draw_line_wrap (GtkText* text, guint height /* baseline height */) GdkPixmap *bitmap; gint bitmap_width; gint bitmap_height; + + if (!GTK_EDITABLE (text)->editable && text->word_wrap) + return; if (text->line_wrap) {