summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--ChangeLog.pre-2-109
-rw-r--r--ChangeLog.pre-2-49
-rw-r--r--ChangeLog.pre-2-69
-rw-r--r--ChangeLog.pre-2-89
-rw-r--r--gdk/gdkpango.c19
-rw-r--r--gtk/gtktextdisplay.c57
-rw-r--r--gtk/gtktextview.c10
8 files changed, 131 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 7a23521f9d..5dd31ede6b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Sun Feb 29 16:35:23 2004 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkpango.c gtk/gtktextdisplay.c: Implement
+ PANGO_UNDERLINE_ERROR (Based on a patch by
+ Nicolas Setton, #114237)
+
+ * gtk/gtktextview.c: Add a error-underline-color style
+ property.
+
Sun Feb 29 19:04:33 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkrange.c (_gtk_range_get_wheel_delta): New internal
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 7a23521f9d..5dd31ede6b 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,12 @@
+Sun Feb 29 16:35:23 2004 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkpango.c gtk/gtktextdisplay.c: Implement
+ PANGO_UNDERLINE_ERROR (Based on a patch by
+ Nicolas Setton, #114237)
+
+ * gtk/gtktextview.c: Add a error-underline-color style
+ property.
+
Sun Feb 29 19:04:33 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkrange.c (_gtk_range_get_wheel_delta): New internal
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 7a23521f9d..5dd31ede6b 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,12 @@
+Sun Feb 29 16:35:23 2004 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkpango.c gtk/gtktextdisplay.c: Implement
+ PANGO_UNDERLINE_ERROR (Based on a patch by
+ Nicolas Setton, #114237)
+
+ * gtk/gtktextview.c: Add a error-underline-color style
+ property.
+
Sun Feb 29 19:04:33 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkrange.c (_gtk_range_get_wheel_delta): New internal
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 7a23521f9d..5dd31ede6b 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,12 @@
+Sun Feb 29 16:35:23 2004 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkpango.c gtk/gtktextdisplay.c: Implement
+ PANGO_UNDERLINE_ERROR (Based on a patch by
+ Nicolas Setton, #114237)
+
+ * gtk/gtktextview.c: Add a error-underline-color style
+ property.
+
Sun Feb 29 19:04:33 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkrange.c (_gtk_range_get_wheel_delta): New internal
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 7a23521f9d..5dd31ede6b 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,12 @@
+Sun Feb 29 16:35:23 2004 Owen Taylor <otaylor@redhat.com>
+
+ * gdk/gdkpango.c gtk/gtktextdisplay.c: Implement
+ PANGO_UNDERLINE_ERROR (Based on a patch by
+ Nicolas Setton, #114237)
+
+ * gtk/gtktextview.c: Add a error-underline-color style
+ property.
+
Sun Feb 29 19:04:33 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkrange.c (_gtk_range_get_wheel_delta): New internal
diff --git a/gdk/gdkpango.c b/gdk/gdkpango.c
index 24ec81b615..35a0a49685 100644
--- a/gdk/gdkpango.c
+++ b/gdk/gdkpango.c
@@ -186,6 +186,25 @@ draw_underline (GdkDrawable *drawable,
start_x, baseline_y + 1,
end_x, baseline_y + 1);
break;
+ case PANGO_UNDERLINE_ERROR:
+ {
+ int point_x, point_y;
+ int counter = 0;
+
+ for (point_x = start_x;
+ point_x <= end_x;
+ point_x += 2)
+ {
+ point_y = counter ? baseline_y + 1 : baseline_y + 2;
+
+ gdk_draw_line (drawable, gc,
+ point_x, point_y,
+ MIN (point_x + 1, end_x), point_y);
+
+ counter = (counter + 1) % 2;
+ }
+ }
+ break;
case PANGO_UNDERLINE_LOW:
gdk_draw_line (drawable, gc,
start_x, low_y + 1,
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c
index f5937298be..889b62171d 100644
--- a/gtk/gtktextdisplay.c
+++ b/gtk/gtktextdisplay.c
@@ -92,6 +92,7 @@ struct _GtkTextRenderState
GtkTextAppearance *last_bg_appearance;
GdkGC *fg_gc;
GdkGC *bg_gc;
+ GdkGC *error_gc;
GdkRectangle clip_rect;
};
@@ -116,6 +117,7 @@ gtk_text_render_state_new (GtkWidget *widget,
state->widget = widget;
state->fg_gc = gdk_gc_new (drawable);
state->bg_gc = gdk_gc_new (drawable);
+
state->clip_rect = *clip_rect;
return state;
@@ -126,6 +128,8 @@ gtk_text_render_state_destroy (GtkTextRenderState *state)
{
g_object_unref (state->fg_gc);
g_object_unref (state->bg_gc);
+ if (state->error_gc)
+ g_object_unref (state->error_gc);
g_free (state);
}
@@ -204,6 +208,36 @@ gtk_text_render_state_update (GtkTextRenderState *state,
state->last_appearance = new_appearance;
}
+static GdkGC *
+gtk_text_render_state_get_error_gc (GtkTextRenderState *state)
+{
+ if (!state->error_gc)
+ {
+ static const GdkColor red = { 0, 0xffff, 0, 0 };
+
+ GdkGCValues gc_values;
+ GdkGCValuesMask gc_values_mask;
+ GdkColor *underline_color;
+ GtkWidget *widget = state->widget;
+
+ gtk_widget_style_get (widget, "error-underline_color", &underline_color, NULL);
+
+ gc_values_mask = GDK_GC_FOREGROUND;
+ if (underline_color)
+ {
+ gc_values.foreground = *underline_color;
+ gdk_color_free (underline_color);
+ }
+ else
+ gc_values.foreground = red;
+
+ gdk_rgb_find_color (widget->style->colormap, &gc_values.foreground);
+ state->error_gc = gdk_gc_new_with_values (widget->window, &gc_values, gc_values_mask);
+ }
+
+ return state->error_gc;
+}
+
static void
get_shape_extents (PangoLayoutRun *run,
PangoRectangle *ink_rect,
@@ -423,6 +457,29 @@ render_layout_line (GdkDrawable *drawable,
x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE,
risen_y + 1);
break;
+ case PANGO_UNDERLINE_ERROR:
+ g_assert (need_ink);
+ {
+ GdkGC *error_gc = gtk_text_render_state_get_error_gc (render_state);
+
+ int point_x, point_y;
+ int counter = 0;
+ int end_x = x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE;
+
+ for (point_x = x + (x_off + ink_rect.x) / PANGO_SCALE - 1;
+ point_x <= end_x;
+ point_x += 2)
+ {
+ point_y = counter ? risen_y + 1 : risen_y + 2;
+
+ gdk_draw_line (drawable, error_gc,
+ point_x, point_y,
+ MIN (point_x + 1, end_x), point_y);
+
+ counter = (counter + 1) % 2;
+ }
+ }
+ break;
case PANGO_UNDERLINE_LOW:
g_assert (need_ink);
gdk_draw_line (drawable, fg_gc,
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 7609831225..a1e9377473 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -676,6 +676,16 @@ gtk_text_view_class_init (GtkTextViewClass *klass)
G_PARAM_READWRITE));
/*
+ * Style properties
+ */
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_boxed ("error-underline-color",
+ P_("Error Underline Color"),
+ P_("Color with which to error-indication underlines"),
+ GDK_TYPE_COLOR,
+ G_PARAM_READABLE));
+
+ /*
* Signals
*/