aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog11
-rw-r--r--calendar/gui/e-day-view-top-item.c32
-rw-r--r--calendar/gui/e-week-view-event-item.c21
3 files changed, 56 insertions, 8 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 10fae83455..7f3060190a 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,14 @@
+2004-07-09 Rodney Dawes <dobey@novell.com>
+
+ * gui/e-day-view-top-item.c (e_day_view_top_item_draw_triangle):
+ Add an argument for the event_num so we can get the event object
+ Draw the left/right triangles with the right color for the event
+ Fix a small alignment bug with the triangle points
+
+ * gui/e-week-view-event-item.c (e_week_view_event_item_draw_triangle):
+ Draw the left/right triangles with the right color for the event
+ Fix a small alignment bug with the triangle points
+
2004-07-09 Rodrigo Moya <rodrigo@novell.com>
Fixes #60289
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index fc8d3930c3..c15278a3c8 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -61,7 +61,8 @@ static void e_day_view_top_item_draw_triangle (EDayViewTopItem *dvtitem,
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_long_event (EDayViewTopItem *dvtitem,
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 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
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 @@ e_day_view_top_item_draw_triangle (EDayViewTopItem *dvtitem,
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 @@ e_day_view_top_item_draw_triangle (EDayViewTopItem *dvtitem,
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 @@ e_day_view_top_item_draw_triangle (EDayViewTopItem *dvtitem,
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]);
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index 22f33ebe43..ff07eea6ba 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -725,22 +725,39 @@ e_week_view_event_item_draw_triangle (EWeekViewEventItem *wveitem,
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]);