[evolution-patches] Patch to fix drawing of triangles for multi-day events in calendar
- From: Rodney Dawes <dobey novell com>
- To: evolution-patches lists ximian com
- Subject: [evolution-patches] Patch to fix drawing of triangles for multi-day events in calendar
- Date: Thu, 08 Jul 2004 15:44:49 -0400
This patch fixes the drawing of the triangles for the left and right
sides of multi-day events to match the color of the event's rectangle,
and also fixes a tiny alignment bug that was not as visible before with
most themes.
-- dobey
Index: gui/e-day-view-top-item.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view-top-item.c,v
retrieving revision 1.40
diff -u -r1.40 e-day-view-top-item.c
--- gui/e-day-view-top-item.c 19 Apr 2004 15:19:32 -0000 1.40
+++ gui/e-day-view-top-item.c 7 Jul 2004 19:05:21 -0000
@@ -61,7 +61,8 @@
gint x,
gint y,
gint w,
- gint h);
+ gint h,
+ gint event_num);
static double e_day_view_top_item_point (GnomeCanvasItem *item,
double x,
double y,
@@ -397,7 +398,7 @@
e_day_view_top_item_draw_triangle (dvtitem, drawable,
item_x - x, item_y - y,
-E_DAY_VIEW_BAR_WIDTH,
- item_h);
+ item_h, event_num);
} else {
gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER]);
gdk_draw_line (drawable, gc,
@@ -412,7 +413,7 @@
item_x + item_w - 1 - x,
item_y - y,
E_DAY_VIEW_BAR_WIDTH,
- item_h);
+ item_h, event_num);
} else {
gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER]);
gdk_draw_line (drawable, gc,
@@ -595,11 +596,14 @@
gint x,
gint y,
gint w,
- gint h)
+ gint h,
+ gint event_num)
{
EDayView *day_view;
+ EDayViewEvent *event;
GtkStyle *style;
GdkGC *gc;
+ GdkColor bg_color;
GdkPoint points[3];
gint c1, c2;
@@ -611,7 +615,7 @@
points[0].x = x;
points[0].y = y;
points[1].x = x + w;
- points[1].y = y + (h / 2) - 1;
+ points[1].y = y + (h / 2);
points[2].x = x;
points[2].y = y + h - 1;
@@ -621,7 +625,23 @@
if (h % 2 == 0)
c1--;
- gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND]);
+ event = &g_array_index (day_view->long_events, EDayViewEvent,
+ event_num);
+
+ /* Fill it in. */
+ if (gdk_color_parse (e_cal_model_get_color_for_component (e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)),
+ event->comp_data),
+ &bg_color)) {
+ GdkColormap *colormap;
+
+ colormap = gtk_widget_get_colormap (GTK_WIDGET (day_view));
+ if (gdk_colormap_alloc_color (colormap, &bg_color, TRUE, TRUE))
+ gdk_gc_set_foreground (gc, &bg_color);
+ else
+ gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND]);
+ } else
+ gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND]);
+
gdk_draw_polygon (drawable, gc, TRUE, points, 3);
gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER]);
Index: gui/e-week-view-event-item.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-week-view-event-item.c,v
retrieving revision 1.47
diff -u -r1.47 e-week-view-event-item.c
--- gui/e-week-view-event-item.c 13 May 2004 09:37:40 -0000 1.47
+++ gui/e-week-view-event-item.c 7 Jul 2004 19:05:21 -0000
@@ -725,22 +725,39 @@
gint h)
{
EWeekView *week_view;
+ EWeekViewEvent *event;
GdkGC *gc;
+ GdkColor bg_color;
GdkPoint points[3];
gint c1, c2;
week_view = E_WEEK_VIEW (GTK_WIDGET (GNOME_CANVAS_ITEM (wveitem)->canvas)->parent);
+ event = &g_array_index (week_view->events, EWeekViewEvent,
+ wveitem->event_num);
+
gc = week_view->main_gc;
points[0].x = x;
points[0].y = y;
points[1].x = x + w;
- points[1].y = y + (h / 2) - 1;
+ points[1].y = y + (h / 2);
points[2].x = x;
points[2].y = y + h - 1;
- gdk_gc_set_foreground (gc, &week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND]);
+ 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))
+ gdk_gc_set_foreground (gc, &bg_color);
+ else
+ gdk_gc_set_foreground (gc, &week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND]);
+ } else
+ gdk_gc_set_foreground (gc, &week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND]);
+
gdk_draw_polygon (drawable, gc, TRUE, points, 3);
gdk_gc_set_foreground (gc, &week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BORDER]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]