diff options
author | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-05-04 23:14:24 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-05-04 23:14:24 +0800 |
commit | 5d4006c44c16fae3d9b8a9e2349f4b26e5d74411 (patch) | |
tree | 6658e195237a43ccb7b75d960bb8879e866e101c /calendar/gui/e-week-view.c | |
parent | a9db5c0fc571e914bd11f65927190c6b0cd17a54 (diff) | |
download | gsoc2013-evolution-5d4006c44c16fae3d9b8a9e2349f4b26e5d74411.tar gsoc2013-evolution-5d4006c44c16fae3d9b8a9e2349f4b26e5d74411.tar.gz gsoc2013-evolution-5d4006c44c16fae3d9b8a9e2349f4b26e5d74411.tar.bz2 gsoc2013-evolution-5d4006c44c16fae3d9b8a9e2349f4b26e5d74411.tar.lz gsoc2013-evolution-5d4006c44c16fae3d9b8a9e2349f4b26e5d74411.tar.xz gsoc2013-evolution-5d4006c44c16fae3d9b8a9e2349f4b26e5d74411.tar.zst gsoc2013-evolution-5d4006c44c16fae3d9b8a9e2349f4b26e5d74411.zip |
Committing updated patch for cairo.
svn path=/trunk/; revision=31954
Diffstat (limited to 'calendar/gui/e-week-view.c')
-rw-r--r-- | calendar/gui/e-week-view.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index cc2f88a385..45021ad3f2 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -767,6 +767,36 @@ get_digit_width (PangoLayout *layout) return max_digit_width; } +static GdkColor +e_week_view_get_text_color (EWeekView *week_view, EWeekViewEvent *event, GtkWidget *widget) +{ + GdkColor color, bg_color; + guint16 red, green, blue; + gdouble cc = 65535.0; + + red = week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND].red; + green = week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND].green; + blue = week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND].blue; + + if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)), event->comp_data), + &bg_color)) { + GdkColormap *colormap; + colormap = gtk_widget_get_colormap (GTK_WIDGET (week_view)); + if (gdk_colormap_alloc_color (colormap, &bg_color, TRUE, TRUE)) { + red = bg_color.red; + green = bg_color.green; + blue = bg_color.blue; + } + } + + if ((red/cc > 0.7) || (green/cc > 0.7) || (blue/cc > 0.7 )) + color = widget->style->text[GTK_STATE_NORMAL]; + else + color = widget->style->text[GTK_STATE_ACTIVE]; + + return color; +} + static void e_week_view_style_set (GtkWidget *widget, GtkStyle *previous_style) @@ -2675,8 +2705,12 @@ e_week_view_reshape_event_span (EWeekView *week_view, if (!span->text_item) { ECalComponentText cal_text; GtkWidget *widget; + GdkColor color; widget = (GtkWidget *)week_view; + + color = e_week_view_get_text_color (week_view, event, widget); + e_cal_component_get_summary (comp, &cal_text); span->text_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (week_view->main_canvas)->root), @@ -2687,7 +2721,7 @@ e_week_view_reshape_event_span (EWeekView *week_view, "editable", TRUE, "text", cal_text.value ? cal_text.value : "", "use_ellipsis", TRUE, - "fill_color_gdk", &widget->style->text[GTK_STATE_NORMAL], + "fill_color_gdk", &color, "im_context", E_CANVAS (week_view->main_canvas)->im_context, NULL); |