From 08ea9ff68d9b544242dfe7f0f4409e90f2f24ebd Mon Sep 17 00:00:00 2001 From: Damon Chaplin Date: Wed, 17 Jan 2001 18:45:40 +0000 Subject: gui/e-week-view*.c don't use the theme colors at all within the graphical 2001-01-17 Damon Chaplin * gui/e-week-view*.c * gui/e-day-view*.c: don't use the theme colors at all within the graphical parts of the widgets, since they may clash with our colors. May make them configurable in future so people can tweak them to go with their theme. At least the calendars are usable in any theme now, even though the colors may not go well with the theme. Also set the font of all the EText items in style_set. * gui/e-week-view-event-item.c (e_week_view_event_item_draw): don't draw the icons if we are editing the event. * gui/e-day-view.c: * gui/e-week-view.c: reinstated the optimizations so we don't do a complete relayout if the event's dates haven't been changed. (Though we still do a re-layout when recurring events change, since comparing all the RDATES/RRULES/EXDATES/EXRULES is too much hassle.) A side-effect of this change is that the EWeekView won't crash so often - only recurring events will be a problem. * cal-util/cal-component.[hc]: added function to check if the start and end dates of a component match. Used for optimizing the updating of the EDayView & EWeekView. svn path=/trunk/; revision=7593 --- calendar/gui/e-day-view-top-item.c | 55 +++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 19 deletions(-) (limited to 'calendar/gui/e-day-view-top-item.c') diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c index 145809893f..8995832399 100644 --- a/calendar/gui/e-day-view-top-item.c +++ b/calendar/gui/e-day-view-top-item.c @@ -182,7 +182,7 @@ e_day_view_top_item_draw (GnomeCanvasItem *canvas_item, EDayViewTopItem *dvtitem; EDayView *day_view; GtkStyle *style; - GdkGC *fg_gc, *bg_gc, *light_gc, *dark_gc; + GdkGC *gc, *fg_gc, *bg_gc, *light_gc, *dark_gc; gchar buffer[128], *format; GdkRectangle clip_rect; GdkFont *font; @@ -200,6 +200,7 @@ e_day_view_top_item_draw (GnomeCanvasItem *canvas_item, style = GTK_WIDGET (day_view)->style; font = style->font; + gc = day_view->main_gc; fg_gc = style->fg_gc[GTK_STATE_NORMAL]; bg_gc = style->bg_gc[GTK_STATE_NORMAL]; light_gc = style->light_gc[GTK_STATE_NORMAL]; @@ -209,11 +210,6 @@ e_day_view_top_item_draw (GnomeCanvasItem *canvas_item, left_edge = 0; item_height = day_view->top_row_height - E_DAY_VIEW_TOP_CANVAS_Y_GAP; - /* Clear the entire background. */ - gdk_draw_rectangle (drawable, dark_gc, TRUE, - left_edge - x, 0, - canvas_width - left_edge, height); - /* Draw the shadow around the dates. */ gdk_draw_line (drawable, light_gc, left_edge + 1 - x, 1 - y, @@ -221,6 +217,12 @@ e_day_view_top_item_draw (GnomeCanvasItem *canvas_item, gdk_draw_line (drawable, light_gc, left_edge + 1 - x, 2 - y, left_edge + 1 - x, item_height - 1 - y); + gdk_draw_line (drawable, dark_gc, + left_edge + 2 - x, item_height - 1 - y, + canvas_width - 1 - x, item_height - 1 - y); + gdk_draw_line (drawable, dark_gc, + canvas_width - 1 - x, 1 - y, + canvas_width - 1 - x, item_height - 1 - y); /* Draw the background for the dates. */ gdk_draw_rectangle (drawable, bg_gc, TRUE, @@ -228,6 +230,13 @@ e_day_view_top_item_draw (GnomeCanvasItem *canvas_item, canvas_width - left_edge - 3, item_height - 3); + /* Clear the main area background. */ + gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS]); + gdk_draw_rectangle (drawable, gc, TRUE, + left_edge - x, item_height - y, + canvas_width - left_edge, + canvas_height - item_height); + /* Draw the selection background. */ if (GTK_WIDGET_HAS_FOCUS (day_view) && day_view->selection_start_day != -1) { @@ -244,7 +253,8 @@ e_day_view_top_item_draw (GnomeCanvasItem *canvas_item, rect_w = day_view->day_offsets[end_col + 1] - rect_x; rect_h = canvas_height - 1 - rect_y; - gdk_draw_rectangle (drawable, style->white_gc, TRUE, + gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_SELECTED]); + gdk_draw_rectangle (drawable, gc, TRUE, rect_x - x, rect_y - y, rect_w, rect_h); } @@ -302,7 +312,8 @@ e_day_view_top_item_draw (GnomeCanvasItem *canvas_item, /* Draw the lines between each column. */ if (day != 0) { - gdk_draw_line (drawable, style->black_gc, + gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_BG_TOP_CANVAS_GRID]); + gdk_draw_line (drawable, gc, day_view->day_offsets[day] - x, item_height - y, day_view->day_offsets[day] - x, @@ -371,15 +382,17 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem, comp = event->comp; /* Draw the lines across the top & bottom of the entire event. */ - gdk_draw_line (drawable, fg_gc, + gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER]); + gdk_draw_line (drawable, gc, item_x - x, item_y - y, item_x + item_w - 1 - x, item_y - y); - gdk_draw_line (drawable, fg_gc, + gdk_draw_line (drawable, gc, item_x - x, item_y + item_h - 1 - y, item_x + item_w - 1 - x, item_y + item_h - 1 - y); /* Fill it in. */ - gdk_draw_rectangle (drawable, bg_gc, TRUE, + gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BACKGROUND]); + gdk_draw_rectangle (drawable, gc, TRUE, item_x - x, item_y + 1 - y, item_w, item_h - 2); @@ -405,7 +418,8 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem, -E_DAY_VIEW_BAR_WIDTH, item_h); } else { - gdk_draw_line (drawable, fg_gc, + gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER]); + gdk_draw_line (drawable, gc, item_x - x, item_y - y, item_x - x, item_y + item_h - 1 - y); } @@ -419,7 +433,8 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem, E_DAY_VIEW_BAR_WIDTH, item_h); } else { - gdk_draw_line (drawable, fg_gc, + gdk_gc_set_foreground (gc, &day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER]); + gdk_draw_line (drawable, gc, item_x + item_w - 1 - x, item_y - y, item_x + item_w - 1 - x, @@ -565,15 +580,14 @@ e_day_view_top_item_draw_triangle (EDayViewTopItem *dvtitem, { EDayView *day_view; GtkStyle *style; - GdkGC *fg_gc, *bg_gc; + GdkGC *gc; GdkPoint points[3]; gint c1, c2; day_view = dvtitem->day_view; style = GTK_WIDGET (day_view)->style; - fg_gc = style->fg_gc[GTK_STATE_NORMAL]; - bg_gc = style->bg_gc[GTK_STATE_NORMAL]; + gc = day_view->main_gc; points[0].x = x; points[0].y = y; @@ -588,9 +602,12 @@ e_day_view_top_item_draw_triangle (EDayViewTopItem *dvtitem, if (h % 2 == 0) c1--; - gdk_draw_polygon (drawable, bg_gc, TRUE, points, 3); - gdk_draw_line (drawable, fg_gc, x, y, x + w, c1); - gdk_draw_line (drawable, fg_gc, x, y + h - 1, x + w, c2); + 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]); + gdk_draw_line (drawable, gc, x, y, x + w, c1); + gdk_draw_line (drawable, gc, x, y + h - 1, x + w, c2); } -- cgit v1.2.3