diff options
author | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-04-26 13:23:39 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-04-26 13:23:39 +0800 |
commit | 7a39173f57d7d37ab856638b983a20b739fbdabc (patch) | |
tree | 293235c8753a68169e18e39f86873db9e04b343e /calendar | |
parent | 8005d60cfbdfdf7781bce52b66fcb158340ea67c (diff) | |
download | gsoc2013-evolution-7a39173f57d7d37ab856638b983a20b739fbdabc.tar gsoc2013-evolution-7a39173f57d7d37ab856638b983a20b739fbdabc.tar.gz gsoc2013-evolution-7a39173f57d7d37ab856638b983a20b739fbdabc.tar.bz2 gsoc2013-evolution-7a39173f57d7d37ab856638b983a20b739fbdabc.tar.lz gsoc2013-evolution-7a39173f57d7d37ab856638b983a20b739fbdabc.tar.xz gsoc2013-evolution-7a39173f57d7d37ab856638b983a20b739fbdabc.tar.zst gsoc2013-evolution-7a39173f57d7d37ab856638b983a20b739fbdabc.zip |
Cairo updates to calendar
svn path=/trunk/; revision=31894
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 10 | ||||
-rw-r--r-- | calendar/gui/e-day-view-main-item.c | 44 | ||||
-rw-r--r-- | calendar/gui/e-day-view-top-item.c | 60 | ||||
-rw-r--r-- | calendar/gui/e-week-view-event-item.c | 38 |
4 files changed, 62 insertions, 90 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 53cf440365..65a2403dfe 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,13 @@ +2006-04-26 Srinivasa Ragavan <sragavan@novell.com> + + Cairo Updates from Rajeev. Now it draws a solid border around the + event. + + * gui/e-day-view-main-item.c: + (e_day_view_main_item_draw_day_event): + * gui/e-day-view-top-item.c: (e_day_view_top_item_draw_long_event): + * gui/e-week-view-event-item.c: (e_week_view_event_item_draw): + 2006-04-24 Srinivasa Ragavan <sragavan@novell.com> Cairo support for Calendar (Rajeev Ramanathan) diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index caa7a882cc..27f7c552ad 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -655,10 +655,10 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, /* Draw the background of the event with white to play with transparency */ cairo_save (cr); - x0 = item_x + E_DAY_VIEW_BAR_WIDTH; - y0 = item_y + 1; - rect_width = MAX (item_w - E_DAY_VIEW_BAR_WIDTH - 1, 0); - rect_height = item_h - 2.; + x0 = item_x + E_DAY_VIEW_BAR_WIDTH + 1; + y0 = item_y + 2; + rect_width = MAX (item_w - E_DAY_VIEW_BAR_WIDTH - 3, 0); + rect_height = item_h - 4.; radius = 16; @@ -669,22 +669,6 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, cairo_restore (cr); - /* second inner border */ - cairo_save (cr); - - x0 = item_x + E_DAY_VIEW_BAR_WIDTH + 1.; - y0 = item_y + 2.; - rect_width = item_w - E_DAY_VIEW_BAR_WIDTH - 3.; - rect_height = item_h - 4.; - - radius = 12; - - draw_curved_rectangle (cr, x0, y0, rect_width, rect_height, radius); - cairo_set_source_rgba (cr, red/cc, green/cc, blue/cc, 0); - cairo_set_line_width (cr, 0.6); - cairo_stroke (cr); - cairo_restore (cr); - /* Here we draw the border in event color */ cairo_save (cr); @@ -696,7 +680,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, radius = 16; draw_curved_rectangle (cr, x0, y0, rect_width,rect_height, radius); - cairo_set_line_width (cr, 1.0); + cairo_set_line_width (cr, 2.); cairo_set_source_rgb (cr, red/cc, green/cc, blue/cc); cairo_stroke (cr); cairo_restore (cr); @@ -705,22 +689,26 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, cairo_save (cr); - x0 = item_x + E_DAY_VIEW_BAR_WIDTH + 1.5; - y0 = item_y + 2.5; - rect_width = item_w - E_DAY_VIEW_BAR_WIDTH - 4.; - rect_height = item_h - 5.; + x0 = item_x + E_DAY_VIEW_BAR_WIDTH + 1.75; + y0 = item_y + 2.75; + rect_width = item_w - E_DAY_VIEW_BAR_WIDTH - 4.5; + rect_height = item_h - 5.5; radius = 14; draw_curved_rectangle (cr, x0, y0, rect_width, rect_height, radius); - pat = cairo_pattern_create_linear (item_x + E_DAY_VIEW_BAR_WIDTH + 2.5, item_y + 3.5, - item_x + E_DAY_VIEW_BAR_WIDTH + 2.5, item_y + item_h - 4); + pat = cairo_pattern_create_linear (item_x + E_DAY_VIEW_BAR_WIDTH + 1.75, item_y + 2.75, + item_x + E_DAY_VIEW_BAR_WIDTH + 1.75, item_y + item_h - 2.75); cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8); cairo_pattern_add_color_stop_rgba (pat, 0, red/cc, green/cc, blue/cc, 0.4); cairo_set_source (cr, pat); - cairo_fill (cr); + cairo_fill_preserve (cr); cairo_pattern_destroy (pat); + + cairo_set_source_rgba (cr, red/cc, green/cc, blue/cc, 0.2); + cairo_set_line_width (cr, 0.5); + cairo_stroke (cr); cairo_restore (cr); /* Draw the right edge of the vertical bar. */ diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c index f953c605f9..77138eedf1 100644 --- a/calendar/gui/e-day-view-top-item.c +++ b/calendar/gui/e-day-view-top-item.c @@ -385,16 +385,6 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem, comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - /* Draw the lines across the top & bottom of the entire event. */ - cairo_save (cr); - gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER]); - cairo_move_to (cr, item_x - x, item_y + item_h - 1 - y); - cairo_line_to (cr, item_x + item_w - 1 - x, item_y - y); - cairo_move_to (cr, item_x - x, item_y + item_h - 1 - y); - cairo_line_to (cr, item_x + item_w - 1 - x, item_y + item_h - 1 - y); - cairo_stroke (cr); - cairo_restore (cr); - 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)) { @@ -418,9 +408,9 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem, /* Fill the background with white to play with transparency */ cairo_save (cr); - x0 = item_x - x + 2; + x0 = item_x - x + 4; y0 = item_y + 1 - y; - rect_width = item_w - 5; + rect_width = item_w - 8; rect_height = item_h - 2; radius = 12; @@ -435,20 +425,17 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem, /* Draw the border around the event */ cairo_save (cr); - x0 = item_x - x + 2; + x0 = item_x - x + 4; y0 = item_y + 1 - y; - rect_width = item_w - 5; + rect_width = item_w - 8; rect_height = item_h - 2; radius = 12; draw_curved_rectangle (cr, x0, y0, rect_width, rect_height, radius); - cairo_set_source_rgba (cr, 1, 1, 1, alpha); - cairo_fill_preserve (cr); - cairo_set_source_rgb (cr, red/cc, green/cc, blue/cc); - cairo_set_line_width (cr, 1.0); + cairo_set_line_width (cr, 1.5); cairo_stroke (cr); cairo_restore (cr); @@ -456,17 +443,17 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem, cairo_save (cr); - x0 = item_x - x + 3.75; - y0 = item_y + 2.75 - y; - rect_width = item_w - 8.5; - rect_height = item_h - 5.5; + x0 = item_x - x + 5.5; + y0 = item_y + 2.5 - y; + rect_width = item_w - 11; + rect_height = item_h - 5; - radius = 6; + radius = 10; draw_curved_rectangle (cr, x0, y0, rect_width, rect_height, radius); - pat = cairo_pattern_create_linear (item_x - x, item_y + 1 - y, - item_x - x , item_y - y + item_h - 1); + pat = cairo_pattern_create_linear (item_x - x + 5.5, item_y + 2.5 - y, + item_x - x + 5, item_y - y + item_h + 7.5); cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8); cairo_pattern_add_color_stop_rgba (pat, 0, red/cc, green/cc, blue/cc, 0.4); cairo_set_source (cr, pat); @@ -491,38 +478,23 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem, draw_end_triangle = FALSE; } - /* If the event starts before the first day shown, draw a triangle, - else just draw a vertical line down the left. */ + /* If the event starts before the first day shown, draw a triangle */ if (draw_start_triangle && event->start < day_view->day_starts[start_day]) { e_day_view_top_item_draw_triangle (dvtitem, drawable, - item_x - x, item_y - y, + item_x - x + 4, item_y - y, -E_DAY_VIEW_BAR_WIDTH, item_h, event_num); - } else { - cairo_save (cr); - gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER]); - cairo_move_to (cr, item_x - x, item_y - y); - cairo_line_to (cr, item_x - x, item_y + item_h - 1 - y); - cairo_stroke (cr); - cairo_restore (cr); } /* Similar for the event end. */ if (draw_end_triangle && event->end > day_view->day_starts[end_day + 1]) { e_day_view_top_item_draw_triangle (dvtitem, drawable, - item_x + item_w - 1 - x, + item_x + item_w - 4 - x, item_y - y, E_DAY_VIEW_BAR_WIDTH, item_h, event_num); - } else { - cairo_save (cr); - gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_LONG_EVENT_BORDER]); - cairo_move_to (cr, item_x + item_w - 1 - x, item_y - y); - cairo_line_to (cr, item_x + item_w - 1 - x, item_y + item_h - 1 - y); - cairo_stroke (cr); - cairo_restore (cr); } /* If we are editing the event we don't show the icons or the start @@ -656,7 +628,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem, icon_x -= icon_x_inc; } - /* draw categories icons */ /* categories alone - yet to be cairo - ified */ + /* draw categories icons */ e_cal_component_get_categories_list (comp, &categories_list); for (elem = categories_list; elem; elem = elem->next) { char *category; diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c index 0aa69c3530..3250c72595 100644 --- a/calendar/gui/e-week-view-event-item.c +++ b/calendar/gui/e-week-view-event-item.c @@ -326,7 +326,7 @@ e_week_view_event_item_draw (GnomeCanvasItem *canvas_item, draw_curved_rectangle (cr, cx0, cy0, rect_width, rect_height, radius); - cairo_set_line_width (cr, 1.0); + cairo_set_line_width (cr, 2.0); cairo_set_source_rgb (cr, red/cc, green/cc, blue/cc); cairo_stroke (cr); cairo_restore (cr); @@ -335,12 +335,12 @@ e_week_view_event_item_draw (GnomeCanvasItem *canvas_item, cairo_save (cr); - cx0 = rect_x + 2; + cx0 = rect_x + 1.5; cy0 = y1 + 2.75; - rect_width = rect_w - 3.5; + rect_width = rect_w - 3.; rect_height = y2 - y1 - 4.5; - radius = 6; + radius = 8; draw_curved_rectangle (cr, cx0, cy0, rect_width, rect_height, radius); @@ -349,8 +349,12 @@ e_week_view_event_item_draw (GnomeCanvasItem *canvas_item, cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8); cairo_pattern_add_color_stop_rgba (pat, 0, red/cc, green/cc, blue/cc, 0.4); cairo_set_source (cr, pat); - cairo_fill (cr); + cairo_fill_preserve (cr); cairo_pattern_destroy (pat); + + cairo_set_source_rgba (cr, red/cc, green/cc, blue/cc, 0.2); + cairo_set_line_width (cr, 0.5); + cairo_stroke (cr); cairo_restore (cr); /* Draw the start and end times, as required. */ @@ -456,7 +460,7 @@ e_week_view_event_item_draw (GnomeCanvasItem *canvas_item, draw_curved_rectangle (cr, cx0, cy0, rect_width, rect_height, radius); - cairo_set_line_width (cr, 1.0); + cairo_set_line_width (cr, 2.0); cairo_set_source_rgb (cr, red/cc, green/cc, blue/cc); cairo_stroke (cr); cairo_restore (cr); @@ -464,30 +468,28 @@ e_week_view_event_item_draw (GnomeCanvasItem *canvas_item, /* Here we fill it in the event*/ cairo_save (cr); - cx0 = rect_x + 2; + + cx0 = rect_x + 1.5; cy0 = y1 + 2.75; - rect_width = rect_w - 3.5; + rect_width = rect_w - 3.; rect_height = y2 - y1 - 4.5; - radius = 6; + radius = 8; draw_curved_rectangle (cr, cx0, cy0, rect_width, rect_height, radius); - pat = cairo_pattern_create_linear (rect_x + 1, y1 + 1, - rect_x + 1, y2); + pat = cairo_pattern_create_linear (rect_x + 2, y1 + 1, + rect_x + 2, y2 - 7.25); cairo_pattern_add_color_stop_rgba (pat, 1, red/cc, green/cc, blue/cc, 0.8); cairo_pattern_add_color_stop_rgba (pat, 0, red/cc, green/cc, blue/cc, 0.4); cairo_set_source (cr, pat); cairo_fill_preserve (cr); cairo_pattern_destroy (pat); - cairo_restore (cr); - gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BORDER]); - rect_x2 = rect_x + rect_w - 1; - cairo_move_to (cr, rect_x, y1); - cairo_line_to (cr, rect_x2, y1); - cairo_move_to (cr, rect_x, y2); - cairo_line_to (cr, rect_x2, y2); + cairo_set_source_rgba (cr, red/cc, green/cc, blue/cc, 0.2); + cairo_set_line_width (cr, 0.5); + cairo_stroke (cr); + cairo_restore (cr); if (draw_start_triangle) { e_week_view_event_item_draw_triangle (wveitem, drawable, x1 + E_WEEK_VIEW_EVENT_L_PAD + 2, y1, -3, y2 - y1 + 1); |