From b2cda1d0c6d44f53f71bad9e256f41188677dfba Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 1 Oct 2008 20:56:04 +0000 Subject: Merge revisions 36016:36533 from trunk. svn path=/branches/kill-bonobo/; revision=36534 --- calendar/gui/e-day-view-main-item.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'calendar/gui/e-day-view-main-item.c') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index 7987d8bad6..1d0b052440 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -1,25 +1,23 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - /* - * Author : - * Damon Chaplin - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see + * + * + * Authors: + * Damon Chaplin + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 - * USA */ /* -- cgit v1.2.3 From 14f54991f36d5d3556af1dde53ddb7a8aceafa3a Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 27 Oct 2008 20:28:57 +0000 Subject: Disable parts of my previous calendar work, such that all modules now load! svn path=/branches/kill-bonobo/; revision=36690 --- calendar/gui/e-day-view-main-item.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'calendar/gui/e-day-view-main-item.c') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index 1d0b052440..76529d9533 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -111,7 +111,9 @@ e_day_view_main_item_class_init (EDayViewMainItemClass *class) G_PARAM_WRITABLE)); /* init the accessibility support for e_day_view */ +#if 0 /* KILL-BONOBO */ e_day_view_main_item_a11y_init (); +#endif } -- cgit v1.2.3 From fee5916b60c605ff5086d8fdc2a85c5ea21351f6 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 31 Jan 2009 19:03:12 +0000 Subject: Merge revisions 37108:37199 from trunk. svn path=/branches/kill-bonobo/; revision=37200 --- calendar/gui/e-day-view-main-item.c | 180 +++++++++++++++++++----------------- 1 file changed, 93 insertions(+), 87 deletions(-) (limited to 'calendar/gui/e-day-view-main-item.c') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index 76529d9533..f96e6cc5ed 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -602,7 +602,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, GdkGC *gc; GdkColor bg_color; ECalComponent *comp; - gint num_icons, icon_x, icon_y, icon_x_inc, icon_y_inc; + gint num_icons, icon_x, icon_y, icon_x_inc = 0, icon_y_inc = 0; gint max_icon_w, max_icon_h; gboolean draw_reminder_icon, draw_recurrence_icon, draw_timezone_icon, draw_meeting_icon; gboolean draw_attach_icon; @@ -995,92 +995,6 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, else if (bar_y2 < scroll_flag) event->end_minute -= day_view->mins_per_row; - if (!short_event) - { - if (event->start_minute % day_view->mins_per_row != 0 - || (day_view->show_event_end_times - && event->end_minute % day_view->mins_per_row != 0)) { - offset = day_view->first_hour_shown * 60 - + day_view->first_minute_shown; - show_span = TRUE; - } else { - offset = 0; - } - start_minute = offset + event->start_minute; - end_minute = offset + event->end_minute; - - format_time = (((end_minute - start_minute)/day_view->mins_per_row) >= 2) ? TRUE : FALSE; - - start_hour = start_minute / 60; - start_minute = start_minute % 60; - - end_hour = end_minute / 60; - end_minute = end_minute % 60; - - e_day_view_convert_time_to_display (day_view, start_hour, - &start_display_hour, - &start_suffix, - &start_suffix_width); - e_day_view_convert_time_to_display (day_view, end_hour, - &end_display_hour, - &end_suffix, - &end_suffix_width); - - if (e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (day_view))) { - if (day_view->show_event_end_times && show_span) { - /* 24 hour format with end time. */ - text = g_strdup_printf - ("%2i:%02i-%2i:%02i", - start_display_hour, start_minute, - end_display_hour, end_minute); - } else { - if (format_time) { - /* 24 hour format without end time. */ - text = g_strdup_printf - ("%2i:%02i", - start_display_hour, start_minute); - } - } - } else { - if (day_view->show_event_end_times && show_span) { - /* 12 hour format with end time. */ - text = g_strdup_printf - ("%2i:%02i%s-%2i:%02i%s", - start_display_hour, start_minute, - start_suffix, - end_display_hour, end_minute, end_suffix); - } else { - /* 12 hour format without end time. */ - text = g_strdup_printf - ("%2i:%02i%s", - start_display_hour, start_minute, - start_suffix); - } - } - - cairo_save (cr); - cairo_rectangle (cr, item_x + E_DAY_VIEW_BAR_WIDTH + 1.75, item_y + 2.75, - item_w - E_DAY_VIEW_BAR_WIDTH - 4.5, - 14); - cairo_clip (cr); - cairo_new_path (cr); - if (resize_flag) - cairo_move_to (cr, item_x + E_DAY_VIEW_BAR_WIDTH + 10, item_y + 13); - else - cairo_move_to (cr, item_x + E_DAY_VIEW_BAR_WIDTH + 14, item_y + 13); - if ((red/cc > 0.7) || (green/cc > 0.7) || (blue/cc > 0.7 )) - cairo_set_source_rgb (cr, 0, 0, 0); - else - cairo_set_source_rgb (cr, 1, 1, 1); - cairo_set_font_size (cr, 14.0); - cairo_set_font_options (cr, font_options); - cairo_show_text (cr, text); - cairo_close_path (cr); - cairo_restore (cr); - } - - if (font_options) - cairo_font_options_destroy (font_options); comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); @@ -1298,6 +1212,98 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, e_cal_component_free_categories_list (categories_list); } + if (!short_event) + { + if (event->start_minute % day_view->mins_per_row != 0 + || (day_view->show_event_end_times + && event->end_minute % day_view->mins_per_row != 0)) { + offset = day_view->first_hour_shown * 60 + + day_view->first_minute_shown; + show_span = TRUE; + } else { + offset = 0; + } + start_minute = offset + event->start_minute; + end_minute = offset + event->end_minute; + + format_time = (((end_minute - start_minute)/day_view->mins_per_row) >= 2) ? TRUE : FALSE; + + start_hour = start_minute / 60; + start_minute = start_minute % 60; + + end_hour = end_minute / 60; + end_minute = end_minute % 60; + + e_day_view_convert_time_to_display (day_view, start_hour, + &start_display_hour, + &start_suffix, + &start_suffix_width); + e_day_view_convert_time_to_display (day_view, end_hour, + &end_display_hour, + &end_suffix, + &end_suffix_width); + + if (e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (day_view))) { + if (day_view->show_event_end_times && show_span) { + /* 24 hour format with end time. */ + text = g_strdup_printf + ("%2i:%02i-%2i:%02i", + start_display_hour, start_minute, + end_display_hour, end_minute); + } else { + if (format_time) { + /* 24 hour format without end time. */ + text = g_strdup_printf + ("%2i:%02i", + start_display_hour, start_minute); + } + } + } else { + if (day_view->show_event_end_times && show_span) { + /* 12 hour format with end time. */ + text = g_strdup_printf + ("%2i:%02i%s-%2i:%02i%s", + start_display_hour, start_minute, + start_suffix, + end_display_hour, end_minute, end_suffix); + } else { + /* 12 hour format without end time. */ + text = g_strdup_printf + ("%2i:%02i%s", + start_display_hour, start_minute, + start_suffix); + } + } + + cairo_save (cr); + cairo_rectangle (cr, item_x + E_DAY_VIEW_BAR_WIDTH + 1.75, item_y + 2.75, + item_w - E_DAY_VIEW_BAR_WIDTH - 4.5, + 14); + + cairo_clip (cr); + cairo_new_path (cr); + + if (icon_x_inc == 0) + icon_x += 14; + + if (resize_flag) + cairo_move_to (cr, item_x + E_DAY_VIEW_BAR_WIDTH + 10, item_y + 13); + else + cairo_move_to (cr, icon_x, item_y + 13); + if ((red/cc > 0.7) || (green/cc > 0.7) || (blue/cc > 0.7 )) + cairo_set_source_rgb (cr, 0, 0, 0); + else + cairo_set_source_rgb (cr, 1, 1, 1); + cairo_set_font_size (cr, 14.0); + cairo_set_font_options (cr, font_options); + cairo_show_text (cr, text); + cairo_close_path (cr); + cairo_restore (cr); + } + + if (font_options) + cairo_font_options_destroy (font_options); + g_free (text); g_object_unref (comp); cairo_destroy (cr); -- cgit v1.2.3 From f4cf9af33ccde3142a3011e8b2dbcfb4cbc9ae81 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Wed, 20 May 2009 16:50:00 +0200 Subject: Use -no-undefined on Linux too There still left two things opened, search for KILL-BONOBO to find them. One is in calendar's Makefile.am, one in composer. --- calendar/gui/e-day-view-main-item.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/e-day-view-main-item.c') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index f96e6cc5ed..3718725c08 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -32,7 +32,7 @@ #include "e-util/e-categories-config.h" #include "e-day-view-layout.h" #include "e-day-view-main-item.h" -#include "ea-calendar.h" +#include "a11y/ea-calendar.h" #include "e-calendar-view.h" #include "comp-util.h" #include -- cgit v1.2.3 From e4afd3f9fb962ea1295a0657ec9f83a427829171 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 26 May 2009 23:21:02 -0400 Subject: Remove trailing whitespace, again. --- calendar/gui/e-day-view-main-item.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/e-day-view-main-item.c') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index 97f5ab59f6..e161477eec 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -10,7 +10,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see + * License along with the program; if not, see * * * Authors: -- cgit v1.2.3 From 948235c3d1076dbe6ed2e57a24c16a083bbd9f01 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 27 May 2009 10:29:19 -0400 Subject: Prefer GLib basic types over C types. --- calendar/gui/e-day-view-main-item.c | 56 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'calendar/gui/e-day-view-main-item.c') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index 86b723903f..c8449c0854 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -44,38 +44,38 @@ static void e_day_view_main_item_set_property (GObject *object, GParamSpec *pspec); static void e_day_view_main_item_update (GnomeCanvasItem *item, double *affine, - ArtSVP *clip_path, int flags); + ArtSVP *clip_path, gint flags); static void e_day_view_main_item_draw (GnomeCanvasItem *item, GdkDrawable *drawable, - int x, int y, - int width, int height); + gint x, gint y, + gint width, gint height); static double e_day_view_main_item_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, + gint cx, gint cy, GnomeCanvasItem **actual_item); static gint e_day_view_main_item_event (GnomeCanvasItem *item, GdkEvent *event); static void e_day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *dvmitem, GdkDrawable *drawable, - int x, - int y, - int width, - int height); + gint x, + gint y, + gint width, + gint height); static void e_day_view_main_item_draw_events_in_vbars (EDayViewMainItem *dvmitem, GdkDrawable *drawable, - int x, int y, - int width, int height, + gint x, gint y, + gint width, gint height, gint day); static void e_day_view_main_item_draw_day_events (EDayViewMainItem *dvmitem, GdkDrawable *drawable, - int x, int y, - int width, int height, + gint x, gint y, + gint width, gint height, gint day); static void e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, GdkDrawable *drawable, - int x, int y, - int width, int height, + gint x, gint y, + gint width, gint height, gint day, gint event_num); /* The arguments we take */ @@ -148,7 +148,7 @@ static void e_day_view_main_item_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, - int flags) + gint flags) { if (GNOME_CANVAS_ITEM_CLASS (e_day_view_main_item_parent_class)->update) (* GNOME_CANVAS_ITEM_CLASS (e_day_view_main_item_parent_class)->update) (item, affine, clip_path, flags); @@ -166,7 +166,7 @@ e_day_view_main_item_update (GnomeCanvasItem *item, */ static void e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, - int x, int y, int width, int height) + gint x, gint y, gint width, gint height) { EDayViewMainItem *dvmitem; EDayView *day_view; @@ -362,7 +362,7 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, if (e_day_view_get_show_marcus_bains (day_view)) { icaltimezone *zone; struct icaltimetype time_now, day_start; - int marcus_bains_y; + gint marcus_bains_y; GdkColor mb_color; cairo_save (cr); @@ -404,8 +404,8 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, static void e_day_view_main_item_draw_events_in_vbars (EDayViewMainItem *dvmitem, GdkDrawable *drawable, - int x, int y, - int width, int height, + gint x, gint y, + gint width, gint height, gint day) { EDayView *day_view; @@ -485,8 +485,8 @@ e_day_view_main_item_draw_events_in_vbars (EDayViewMainItem *dvmitem, static void e_day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *dvmitem, GdkDrawable *drawable, - int x, int y, - int width, int height) + gint x, gint y, + gint width, gint height) { EDayView *day_view; EDayViewEvent *event; @@ -574,7 +574,7 @@ e_day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *dvmitem, static void e_day_view_main_item_draw_day_events (EDayViewMainItem *dvmitem, GdkDrawable *drawable, - int x, int y, int width, int height, + gint x, gint y, gint width, gint height, gint day) { EDayView *day_view; @@ -593,7 +593,7 @@ e_day_view_main_item_draw_day_events (EDayViewMainItem *dvmitem, static void e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, GdkDrawable *drawable, - int x, int y, int width, int height, + gint x, gint y, gint width, gint height, gint day, gint event_num) { EDayView *day_view; @@ -627,8 +627,8 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, gint offset, interval; const gchar *start_suffix; const gchar *end_suffix; - char *text = NULL; - int scroll_flag = 0; + gchar *text = NULL; + gint scroll_flag = 0; gint row_y; GConfClient *gconf; @@ -1176,11 +1176,11 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, /* draw categories icons */ for (elem = categories_list; elem; elem = elem->next) { - char *category; + gchar *category; GdkPixmap *pixmap = NULL; GdkBitmap *mask = NULL; - category = (char *) elem->data; + category = (gchar *) elem->data; if (!e_categories_config_get_icon_for (category, &pixmap, &mask)) continue; @@ -1317,7 +1317,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, This is needed so that we get button/motion events. */ static double e_day_view_main_item_point (GnomeCanvasItem *item, double x, double y, - int cx, int cy, + gint cx, gint cy, GnomeCanvasItem **actual_item) { *actual_item = item; -- cgit v1.2.3 From 14f8eee012382f04090ea9277e9567d5f32e8bf0 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 28 May 2009 13:06:29 -0400 Subject: Whitespace cleanup. --- calendar/gui/e-day-view-main-item.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'calendar/gui/e-day-view-main-item.c') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index c8449c0854..2a705b809f 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -112,7 +112,7 @@ e_day_view_main_item_class_init (EDayViewMainItemClass *class) /* init the accessibility support for e_day_view */ #if 0 /* KILL-BONOBO */ - e_day_view_main_item_a11y_init (); + e_day_view_main_item_a11y_init (); #endif } @@ -643,7 +643,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, gconf = gconf_client_get_default (); alpha = gconf_client_get_float (gconf, - "/apps/evolution/calendar/display/events_transparency", + "/apps/evolution/calendar/display/events_transparency", NULL); gradient = gconf_client_get_bool (gconf, @@ -790,7 +790,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, /* Black border */ cairo_save (cr); x0 = item_x + E_DAY_VIEW_BAR_WIDTH + 9; - y0 = item_y + 10; + y0 = item_y + 10; rect_width = MAX (item_w - E_DAY_VIEW_BAR_WIDTH - 7, 0); rect_height = item_h - 7; @@ -1219,7 +1219,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, { if (event->start_minute % day_view->mins_per_row != 0 || (day_view->show_event_end_times - && event->end_minute % day_view->mins_per_row != 0)) { + && event->end_minute % day_view->mins_per_row != 0)) { offset = day_view->first_hour_shown * 60 + day_view->first_minute_shown; show_span = TRUE; -- cgit v1.2.3 From 433eac7844481b8ceda0bae8bf08f6bb623185b0 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Mon, 1 Jun 2009 19:09:19 -0400 Subject: More code cleanup. --- calendar/gui/e-day-view-main-item.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'calendar/gui/e-day-view-main-item.c') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index 2a705b809f..c97db277d8 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -620,7 +620,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, gdouble date_fraction; gboolean short_event = FALSE, resize_flag = FALSE; const gchar *end_resize_suffix; - gchar *end_resize_time; + gchar *end_regsizeime; gint start_hour, start_display_hour, start_minute, start_suffix_width; gint end_hour, end_display_hour, end_minute, end_suffix_width; gboolean show_span = FALSE, format_time; @@ -972,12 +972,12 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, if (e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (day_view))) { cairo_translate (cr, item_x + item_w - E_DAY_VIEW_BAR_WIDTH - 32, item_y + item_h - 8); - end_resize_time = g_strdup_printf ("%2i:%02i", + end_regsizeime = g_strdup_printf ("%2i:%02i", end_display_hour, end_minute); } else { cairo_translate (cr, item_x + item_w - E_DAY_VIEW_BAR_WIDTH - 48, item_y + item_h - 8); - end_resize_time = g_strdup_printf ("%2i:%02i%s", + end_regsizeime = g_strdup_printf ("%2i:%02i%s", end_display_hour, end_minute, end_resize_suffix); } @@ -987,7 +987,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, else cairo_set_source_rgb (cr, 1, 1, 1); cairo_set_font_options (cr, font_options); - cairo_show_text (cr, end_resize_time); + cairo_show_text (cr, end_regsizeime); cairo_close_path (cr); cairo_restore (cr); } @@ -1021,7 +1021,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, cairo_restore (cr); /* This is for achieving the white stripes in vbar across event color */ - for (i = 0; i <= (bar_y2 - bar_y1) ; i+=4) { + for (i = 0; i <= (bar_y2 - bar_y1); i+=4) { cairo_set_source_rgb (cr, 1, 1, 1); cairo_set_line_width (cr, 0.3); cairo_move_to (cr, item_x + 1, bar_y1 + i); -- cgit v1.2.3 From c6911b3029629f1032dd594249c099d79efe9fe1 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 18 Jun 2009 16:06:05 -0400 Subject: Fix "make distcheck" errors. --- calendar/gui/e-day-view-main-item.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/e-day-view-main-item.c') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index c97db277d8..bcd1ca705e 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -32,7 +32,7 @@ #include "e-util/e-categories-config.h" #include "e-day-view-layout.h" #include "e-day-view-main-item.h" -#include "a11y/ea-calendar.h" +/*#include "a11y/ea-calendar.h"*/ /* KILL-BONOBO */ #include "e-calendar-view.h" #include "comp-util.h" #include -- cgit v1.2.3 From 374bd42f69aca2e132fd854c9619f3d7491f1f96 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sun, 12 Jul 2009 23:33:07 -0400 Subject: Fix excessive whitespace. --- calendar/gui/e-day-view-main-item.c | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'calendar/gui/e-day-view-main-item.c') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index acbc192218..b55dba425c 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -116,14 +116,12 @@ e_day_view_main_item_class_init (EDayViewMainItemClass *class) #endif } - static void e_day_view_main_item_init (EDayViewMainItem *dvtitem) { dvtitem->day_view = NULL; } - static void e_day_view_main_item_set_property (GObject *object, guint property_id, @@ -143,7 +141,6 @@ e_day_view_main_item_set_property (GObject *object, G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); } - static void e_day_view_main_item_update (GnomeCanvasItem *item, double *affine, @@ -160,7 +157,6 @@ e_day_view_main_item_update (GnomeCanvasItem *item, item->y2 = INT_MAX; } - /* * DRAWING ROUTINES - functions to paint the canvas item. */ @@ -371,7 +367,6 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, day); } - if (e_day_view_get_show_marcus_bains (day_view)) { icaltimezone *zone; struct icaltimetype time_now, day_start; @@ -413,7 +408,6 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, cairo_destroy (cr); } - static void e_day_view_main_item_draw_events_in_vbars (EDayViewMainItem *dvmitem, GdkDrawable *drawable, @@ -455,7 +449,6 @@ e_day_view_main_item_draw_events_in_vbars (EDayViewMainItem *dvmitem, } } - comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); @@ -494,7 +487,6 @@ e_day_view_main_item_draw_events_in_vbars (EDayViewMainItem *dvmitem, cairo_destroy (cr); } - static void e_day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *dvmitem, GdkDrawable *drawable, @@ -583,7 +575,6 @@ e_day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *dvmitem, cairo_destroy (cr); } - static void e_day_view_main_item_draw_day_events (EDayViewMainItem *dvmitem, GdkDrawable *drawable, @@ -1013,7 +1004,6 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, else if (bar_y2 < scroll_flag) event->end_minute -= day_view->mins_per_row; - comp = e_cal_component_new (); e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); @@ -1174,7 +1164,6 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, icon_y += icon_y_inc; } - if (draw_meeting_icon && fit_in_event ()) { max_icon_w = item_x + item_w - icon_x - E_DAY_VIEW_EVENT_BORDER_WIDTH; @@ -1342,7 +1331,6 @@ e_day_view_main_item_point (GnomeCanvasItem *item, double x, double y, return 0.0; } - static gint e_day_view_main_item_event (GnomeCanvasItem *item, GdkEvent *event) { @@ -1360,4 +1348,3 @@ e_day_view_main_item_event (GnomeCanvasItem *item, GdkEvent *event) return FALSE; } - -- cgit v1.2.3 From 41569bb778e228d4f5a04cb1e15bfa5b49bb044b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 28 Jul 2009 21:01:08 -0400 Subject: Trimming redundancy. --- calendar/gui/e-day-view-main-item.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'calendar/gui/e-day-view-main-item.c') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index b55dba425c..9f63d25b93 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -602,6 +602,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, { EDayView *day_view; EDayViewEvent *event; + ECalModel *model; gint item_x, item_y, item_w, item_h, bar_y1, bar_y2; GdkGC *gc; GdkColor bg_color; @@ -637,6 +638,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, GConfClient *gconf; day_view = dvmitem->day_view; + model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)); cr = gdk_cairo_create (drawable); gdk_cairo_set_source_color (cr, @@ -976,7 +978,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, cairo_clip (cr); cairo_new_path (cr); - if (e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (day_view))) { + if (e_cal_model_get_use_24_hour_format (model)) { cairo_translate (cr, item_x + item_w - E_DAY_VIEW_BAR_WIDTH - 32, item_y + item_h - 8); end_regsizeime = g_strdup_printf ("%2i:%02i", end_display_hour, end_minute); @@ -1253,7 +1255,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, &end_suffix, &end_suffix_width); - if (e_calendar_view_get_use_24_hour_format (E_CALENDAR_VIEW (day_view))) { + if (e_cal_model_get_use_24_hour_format (model)) { if (day_view->show_event_end_times && show_span) { /* 24 hour format with end time. */ text = g_strdup_printf -- cgit v1.2.3 From 2fe24b4c136b4d5f255af3571c3d6e1082071809 Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 30 Jul 2009 12:38:24 -0400 Subject: Add properties to calendar classes. So we can bind them to EShellSettings and kill off EDayViewConfig and similar GConf notification classes. --- calendar/gui/e-day-view-main-item.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/e-day-view-main-item.c') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index 9f63d25b93..afa4e8b5c6 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -367,7 +367,7 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, day); } - if (e_day_view_get_show_marcus_bains (day_view)) { + if (e_day_view_marcus_bains_get_show_line (day_view)) { icaltimezone *zone; struct icaltimetype time_now, day_start; gint marcus_bains_y; -- cgit v1.2.3 From aa8a700dd924a83e1dcd8eb374df777fb0a83b66 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 30 Jul 2009 11:22:59 +0200 Subject: Bug #300567 - Calendar drawing optimizations --- calendar/gui/e-day-view-main-item.c | 448 +++++++++++++++--------------------- 1 file changed, 187 insertions(+), 261 deletions(-) (limited to 'calendar/gui/e-day-view-main-item.c') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index afa4e8b5c6..298831d60b 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -35,6 +35,7 @@ /*#include "a11y/ea-calendar.h"*/ /* KILL-BONOBO */ #include "e-calendar-view.h" #include "comp-util.h" +#include "calendar-config.h" #include #include @@ -61,22 +62,22 @@ static void e_day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *dv gint x, gint y, gint width, - gint height); + gint height, GdkRegion *draw_region); static void e_day_view_main_item_draw_events_in_vbars (EDayViewMainItem *dvmitem, GdkDrawable *drawable, gint x, gint y, gint width, gint height, - gint day); + gint day, GdkRegion *draw_region); static void e_day_view_main_item_draw_day_events (EDayViewMainItem *dvmitem, GdkDrawable *drawable, gint x, gint y, gint width, gint height, - gint day); + gint day, GdkRegion *draw_region); static void e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, GdkDrawable *drawable, gint x, gint y, gint width, gint height, - gint day, gint event_num); + gint day, gint event_num, GdkRegion *draw_region); /* The arguments we take */ enum { @@ -157,6 +158,36 @@ e_day_view_main_item_update (GnomeCanvasItem *item, item->y2 = INT_MAX; } +static gboolean +can_draw_in_region (GdkRegion *draw_region, gint x, gint y, gint width, gint height) +{ + GdkRectangle rect; + + g_return_val_if_fail (draw_region != NULL, FALSE); + + rect.x = x; + rect.y = y; + rect.width = width; + rect.height = height; + + return gdk_region_rect_in (draw_region, &rect) != GDK_OVERLAP_RECTANGLE_OUT; +} + +static gboolean +icalcomp_is_transparent (icalcomponent *icalcomp) +{ + icalproperty *transp_prop; + icalproperty_transp ical_transp = ICAL_TRANSP_NONE; + + g_return_val_if_fail (icalcomp != NULL, TRUE); + + transp_prop = icalcomponent_get_first_property (icalcomp, ICAL_TRANSP_PROPERTY); + if (transp_prop) + ical_transp = icalproperty_get_transp (transp_prop); + + return transp_prop && (ical_transp == ICAL_TRANSP_TRANSPARENT || ical_transp == ICAL_TRANSP_TRANSPARENTNOCONFLICT); +} + /* * DRAWING ROUTINES - functions to paint the canvas item. */ @@ -177,6 +208,8 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, gint weekday; cairo_t *cr; gboolean today = FALSE; + GdkRegion *draw_region; + GdkRectangle rect; cr = gdk_cairo_create (drawable); @@ -190,6 +223,11 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, g_return_if_fail (day_view != NULL); style = gtk_widget_get_style (GTK_WIDGET (day_view)); + rect.x = 0; + rect.y = 0; + rect.width = width; + rect.height = height; + draw_region = gdk_region_rectangle (&rect); /* Paint the background colors. */ work_day_start_y = e_day_view_convert_time_to_position (day_view, day_view->work_day_start_hour, day_view->work_day_start_minute) - y; @@ -210,13 +248,13 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, day_w = day_view->day_widths[day]; if (work_day) { - cairo_save (cr); - gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_BG_NOT_WORKING]); - - cairo_rectangle (cr, day_x, 0 - y, day_w, - work_day_start_y - (0 - y)); - cairo_fill (cr); - cairo_restore (cr); + if (can_draw_in_region (draw_region, day_x, 0 - y, day_w, work_day_start_y - (0 - y))) { + cairo_save (cr); + gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_BG_NOT_WORKING]); + cairo_rectangle (cr, day_x, 0 - y, day_w, work_day_start_y - (0 - y)); + cairo_fill (cr); + cairo_restore (cr); + } if (day_view->days_shown > 1) { /* Check if we are drawing today */ @@ -227,25 +265,24 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, today = FALSE; } - cairo_save (cr); - gdk_cairo_set_source_color (cr, &day_view->colors[today ? E_DAY_VIEW_COLOR_BG_MULTIDAY_TODAY : E_DAY_VIEW_COLOR_BG_WORKING]); - - cairo_rectangle (cr, day_x, work_day_start_y, day_w, - work_day_end_y - work_day_start_y); - cairo_fill (cr); - cairo_restore (cr); - - cairo_save (cr); - gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_BG_NOT_WORKING]); + if (can_draw_in_region (draw_region, day_x, work_day_start_y, day_w, work_day_end_y - work_day_start_y)) { + cairo_save (cr); + gdk_cairo_set_source_color (cr, &day_view->colors[today ? E_DAY_VIEW_COLOR_BG_MULTIDAY_TODAY : E_DAY_VIEW_COLOR_BG_WORKING]); + cairo_rectangle (cr, day_x, work_day_start_y, day_w, work_day_end_y - work_day_start_y); + cairo_fill (cr); + cairo_restore (cr); + } - cairo_rectangle (cr, day_x, work_day_end_y, day_w, - height - work_day_end_y); - cairo_fill (cr); - cairo_restore (cr); - } else { + if (can_draw_in_region (draw_region, day_x, work_day_end_y, day_w, height - work_day_end_y)) { + cairo_save (cr); + gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_BG_NOT_WORKING]); + cairo_rectangle (cr, day_x, work_day_end_y, day_w, height - work_day_end_y); + cairo_fill (cr); + cairo_restore (cr); + } + } else if (can_draw_in_region (draw_region, day_x, 0, day_w, height)) { cairo_save (cr); gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_BG_NOT_WORKING]); - cairo_rectangle (cr, day_x, 0, day_w, height); cairo_fill (cr); cairo_restore (cr); @@ -274,20 +311,10 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, rect_y = start_row * day_view->row_height - y; rect_height = (end_row - start_row + 1) * day_view->row_height; - if (GTK_WIDGET_HAS_FOCUS(day_view)) { - cairo_save (cr); - gdk_cairo_set_source_color (cr, - &day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED]); - cairo_rectangle (cr, rect_x, rect_y, rect_width, - rect_height); - cairo_fill (cr); - cairo_restore (cr); - } else { + if (can_draw_in_region (draw_region, rect_x, rect_y, rect_width, rect_height)) { cairo_save (cr); - gdk_cairo_set_source_color (cr, - &day_view->colors[E_DAY_VIEW_COLOR_BG_SELECTED_UNFOCUSSED]); - cairo_rectangle (cr, rect_x, rect_y, rect_width, - rect_height); + gdk_cairo_set_source_color (cr, &day_view->colors[GTK_WIDGET_HAS_FOCUS(day_view) ? E_DAY_VIEW_COLOR_BG_SELECTED : E_DAY_VIEW_COLOR_BG_SELECTED_UNFOCUSSED]); + cairo_rectangle (cr, rect_x, rect_y, rect_width, rect_height); cairo_fill (cr); cairo_restore (cr); } @@ -351,20 +378,20 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, e_day_view_main_item_draw_events_in_vbars (dvmitem, drawable, x, y, width, height, - day); + day, draw_region); } /* Fill in the vertical bars corresponding to the busy times from the long events. */ e_day_view_main_item_draw_long_events_in_vbars (dvmitem, drawable, - x, y, width, height); + x, y, width, height, draw_region); /* Draw the event borders and backgrounds, and the vertical bars down the left edges. */ for (day = 0; day < day_view->days_shown; day++) { e_day_view_main_item_draw_day_events (dvmitem, drawable, x, y, width, height, - day); + day, draw_region); } if (e_day_view_marcus_bains_get_show_line (day_view)) { @@ -406,6 +433,7 @@ e_day_view_main_item_draw (GnomeCanvasItem *canvas_item, GdkDrawable *drawable, cairo_restore (cr); } cairo_destroy (cr); + gdk_region_destroy (draw_region); } static void @@ -413,56 +441,24 @@ e_day_view_main_item_draw_events_in_vbars (EDayViewMainItem *dvmitem, GdkDrawable *drawable, gint x, gint y, gint width, gint height, - gint day) + gint day, GdkRegion *draw_region) { EDayView *day_view; EDayViewEvent *event; gint grid_x, event_num, bar_y, bar_h; - ECalComponentTransparency transparency; - cairo_t *cr; + cairo_t *cr = NULL; GdkColor bg_color; day_view = dvmitem->day_view; - cr = gdk_cairo_create (drawable); - cairo_save (cr); - - gdk_cairo_set_source_color (cr, - &day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND]); - grid_x = day_view->day_offsets[day] + 1 - x; /* Draw the busy times corresponding to the events in the day. */ - for (event_num = 0; event_num < day_view->events[day]->len; - event_num++) { - ECalComponent *comp; - - event = &g_array_index (day_view->events[day], EDayViewEvent, - event_num); - 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_cairo_set_source_color (cr, - &bg_color); - } - } - - comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - - /* If the event is TRANSPARENT, skip it. */ - e_cal_component_get_transparency (comp, &transparency); - if (transparency == E_CAL_COMPONENT_TRANSP_TRANSPARENT) { - g_object_unref (comp); - continue; - } + for (event_num = 0; event_num < day_view->events[day]->len; event_num++) { + event = &g_array_index (day_view->events[day], EDayViewEvent, event_num); /* We can skip the events in the first column since they will draw over this anyway. */ if (event->num_columns > 0 && event->start_row_or_col == 0) { - g_object_unref (comp); continue; } @@ -471,66 +467,62 @@ e_day_view_main_item_draw_events_in_vbars (EDayViewMainItem *dvmitem, bar_y -= y; /* Skip it if it isn't visible. */ - if (bar_y >= height || bar_y + bar_h <= 0) { - g_object_unref (comp); + if (bar_y >= height || bar_y + bar_h <= 0 || !can_draw_in_region (draw_region, grid_x, bar_y, E_DAY_VIEW_BAR_WIDTH - 2, bar_h)) { + continue; + } + + /* If the event is TRANSPARENT, skip it. */ + if (icalcomp_is_transparent (event->comp_data->icalcomp)) { continue; } - cairo_rectangle (cr, grid_x, bar_y, - E_DAY_VIEW_BAR_WIDTH - 2, bar_h); + if (!cr) { + cr = gdk_cairo_create (drawable); + cairo_save (cr); + + gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND]); + } + + 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_cairo_set_source_color (cr, &bg_color); + } + } + + cairo_rectangle (cr, grid_x, bar_y, E_DAY_VIEW_BAR_WIDTH - 2, bar_h); cairo_fill (cr); + } - g_object_unref (comp); + if (cr) { + cairo_restore (cr); + cairo_destroy (cr); } - cairo_restore (cr); - cairo_destroy (cr); } static void e_day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *dvmitem, GdkDrawable *drawable, gint x, gint y, - gint width, gint height) + gint width, gint height, GdkRegion *draw_region) { EDayView *day_view; EDayViewEvent *event; gint event_num, start_day, end_day, day, bar_y1, bar_y2, grid_x; - ECalComponentTransparency transparency; - cairo_t *cr; + cairo_t *cr = NULL; GdkColor bg_color; day_view = dvmitem->day_view; - cr = gdk_cairo_create (drawable); - cairo_save (cr); - - gdk_cairo_set_source_color (cr, - &day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND]); - - for (event_num = 0; event_num < day_view->long_events->len; - event_num++) { - ECalComponent *comp; - - event = &g_array_index (day_view->long_events, EDayViewEvent, - event_num); - 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_cairo_set_source_color (cr, &bg_color); - } - } - - comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); + for (event_num = 0; event_num < day_view->long_events->len; event_num++) { + gboolean first = TRUE; + event = &g_array_index (day_view->long_events, EDayViewEvent, event_num); /* If the event is TRANSPARENT, skip it. */ - e_cal_component_get_transparency (comp, &transparency); - if (transparency == E_CAL_COMPONENT_TRANSP_TRANSPARENT) { - g_object_unref (comp); + if (icalcomp_is_transparent (event->comp_data->icalcomp)) { continue; } @@ -538,7 +530,6 @@ e_day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *dvmitem, day_view->days_shown, day_view->day_starts, &start_day, &end_day)) { - g_object_unref (comp); continue; } @@ -562,24 +553,43 @@ e_day_view_main_item_draw_long_events_in_vbars (EDayViewMainItem *dvmitem, bar_y2 = event->end_minute * day_view->row_height / day_view->mins_per_row - y; } - if (bar_y1 < height && bar_y2 > 0 && bar_y2 > bar_y1) { - cairo_rectangle (cr, grid_x, bar_y1, - E_DAY_VIEW_BAR_WIDTH - 2, bar_y2 - bar_y1); + if (bar_y1 < height && bar_y2 > 0 && bar_y2 > bar_y1 && can_draw_in_region (draw_region, grid_x, bar_y1, E_DAY_VIEW_BAR_WIDTH - 2, bar_y2 - bar_y1)) { + if (!cr) { + cr = gdk_cairo_create (drawable); + cairo_save (cr); + gdk_cairo_set_source_color (cr, &day_view->colors[E_DAY_VIEW_COLOR_EVENT_BACKGROUND]); + } + if (first) { + first = FALSE; + + 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_cairo_set_source_color (cr, &bg_color); + } + } + } + + cairo_rectangle (cr, grid_x, bar_y1, E_DAY_VIEW_BAR_WIDTH - 2, bar_y2 - bar_y1); cairo_fill (cr); } } - g_object_unref (comp); } - cairo_restore (cr); - cairo_destroy (cr); + + if (cr) { + cairo_restore (cr); + cairo_destroy (cr); + } } static void e_day_view_main_item_draw_day_events (EDayViewMainItem *dvmitem, GdkDrawable *drawable, gint x, gint y, gint width, gint height, - gint day) + gint day, GdkRegion *draw_region) { EDayView *day_view; gint event_num; @@ -590,7 +600,7 @@ e_day_view_main_item_draw_day_events (EDayViewMainItem *dvmitem, event_num++) { e_day_view_main_item_draw_day_event (dvmitem, drawable, x, y, width, height, - day, event_num); + day, event_num, draw_region); } } @@ -598,7 +608,7 @@ static void e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, GdkDrawable *drawable, gint x, gint y, gint width, gint height, - gint day, gint event_num) + gint day, gint event_num, GdkRegion *draw_region) { EDayView *day_view; EDayViewEvent *event; @@ -611,7 +621,6 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, gint max_icon_w, max_icon_h; gboolean draw_reminder_icon, draw_recurrence_icon, draw_timezone_icon, draw_meeting_icon; gboolean draw_attach_icon; - GSList *categories_list, *elem; ECalComponentTransparency transparency; cairo_t *cr; cairo_pattern_t *pat; @@ -635,35 +644,13 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, gchar *text = NULL; gint scroll_flag = 0; gint row_y; - GConfClient *gconf; day_view = dvmitem->day_view; model = e_calendar_view_get_model (E_CALENDAR_VIEW (day_view)); - cr = gdk_cairo_create (drawable); - gdk_cairo_set_source_color (cr, - &day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR]); - - gc = day_view->main_gc; - - gconf = gconf_client_get_default (); - - alpha = gconf_client_get_float (gconf, - "/apps/evolution/calendar/display/events_transparency", - NULL); - - gradient = gconf_client_get_bool (gconf, - "/apps/evolution/calendar/display/events_gradient", - NULL); - - g_object_unref (gconf); - - font_options = get_font_options (); - /* If the event is currently being dragged, don't draw it. It will be drawn in the special drag items. */ - if (day_view->drag_event_day == day - && day_view->drag_event_num == event_num) + if (day_view->drag_event_day == day && day_view->drag_event_num == event_num) return; /* Get the position of the event. If it is not shown skip it.*/ @@ -675,6 +662,20 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, item_x -= x; item_y -= y; + if (!can_draw_in_region (draw_region, item_x, item_y, item_w, item_h)) + return; + + cr = gdk_cairo_create (drawable); + gdk_cairo_set_source_color (cr, + &day_view->colors[E_DAY_VIEW_COLOR_EVENT_VBAR]); + + gc = day_view->main_gc; + + gradient = calendar_config_get_display_events_gradient (); + alpha = calendar_config_get_display_events_alpha (); + + font_options = get_font_options (); + event = &g_array_index (day_view->events[day], EDayViewEvent, event_num); @@ -1042,6 +1043,8 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, /* Draw the reminder & recurrence icons, if needed. */ if (!resize_flag && (!is_editing || text_x_offset > E_DAY_VIEW_ICON_X_PAD)) { + GSList *categories_pixbufs = NULL, *pixbufs; + num_icons = 0; draw_reminder_icon = FALSE; draw_recurrence_icon = FALSE; @@ -1077,8 +1080,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, num_icons++; } - num_icons += cal_comp_util_get_n_icons (comp); - e_cal_component_get_categories_list (comp, &categories_list); + num_icons += cal_comp_util_get_n_icons (comp, &categories_pixbufs); if (num_icons != 0) { if (item_h >= (E_DAY_VIEW_ICON_HEIGHT + E_DAY_VIEW_ICON_Y_PAD) * num_icons) { @@ -1091,137 +1093,61 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, icon_y_inc = 0; } - #define fit_in_event() icon_x + icon_x_inc < item_x + item_w && icon_y + icon_y_inc < item_y + item_h + #define fit_in_event() (icon_x + icon_x_inc < item_x + item_w && icon_y + icon_y_inc < item_y + item_h) + #define draw_pixbuf(pf) \ + max_icon_w = item_x + item_w - icon_x - E_DAY_VIEW_EVENT_BORDER_WIDTH; \ + max_icon_h = item_y + item_h - icon_y - E_DAY_VIEW_EVENT_BORDER_HEIGHT; \ + \ + if (can_draw_in_region (draw_region, icon_x, icon_y, max_icon_w, max_icon_h)) { \ + cairo_save (cr); \ + cairo_rectangle (cr, icon_x, icon_y, max_icon_w, max_icon_h); \ + cairo_clip (cr); \ + cairo_new_path (cr); \ + gdk_cairo_set_source_pixbuf (cr, pf, icon_x, icon_y); \ + cairo_paint (cr); \ + cairo_close_path (cr); \ + cairo_restore (cr); \ + } \ + \ + icon_x += icon_x_inc; \ + icon_y += icon_y_inc; if (draw_reminder_icon && fit_in_event ()) { - max_icon_w = item_x + item_w - icon_x - - E_DAY_VIEW_EVENT_BORDER_WIDTH; - max_icon_h = item_y + item_h - icon_y - - E_DAY_VIEW_EVENT_BORDER_HEIGHT; - - cairo_save (cr); - cairo_rectangle (cr, icon_x, icon_y, max_icon_w, max_icon_h); - cairo_clip (cr); - cairo_new_path (cr); - gdk_cairo_set_source_pixbuf (cr, day_view->reminder_icon, icon_x, icon_y); - cairo_paint (cr); - cairo_close_path (cr); - cairo_restore (cr); - - icon_x += icon_x_inc; - icon_y += icon_y_inc; + draw_pixbuf (day_view->reminder_icon); } if (draw_recurrence_icon && fit_in_event ()) { - max_icon_w = item_x + item_w - icon_x - - E_DAY_VIEW_EVENT_BORDER_WIDTH; - max_icon_h = item_y + item_h - icon_y - - E_DAY_VIEW_EVENT_BORDER_HEIGHT; - - cairo_save (cr); - cairo_rectangle (cr, icon_x, icon_y, max_icon_w, max_icon_h); - cairo_clip (cr); - cairo_new_path (cr); - gdk_cairo_set_source_pixbuf (cr, day_view->recurrence_icon, icon_x, icon_y); - cairo_paint (cr); - cairo_close_path (cr); - cairo_restore (cr); - - icon_x += icon_x_inc; - icon_y += icon_y_inc; + draw_pixbuf (day_view->recurrence_icon); } if (draw_attach_icon && fit_in_event ()) { - max_icon_w = item_x + item_w - icon_x - - E_DAY_VIEW_EVENT_BORDER_WIDTH; - max_icon_h = item_y + item_h - icon_y - - E_DAY_VIEW_EVENT_BORDER_HEIGHT; - - cairo_save (cr); - cairo_rectangle (cr, icon_x, icon_y, max_icon_w, max_icon_h); - cairo_clip (cr); - cairo_new_path (cr); - gdk_cairo_set_source_pixbuf (cr, day_view->attach_icon, icon_x, icon_y); - cairo_paint (cr); - cairo_close_path (cr); - cairo_restore (cr); - icon_x += icon_x_inc; - icon_y += icon_y_inc; + draw_pixbuf (day_view->attach_icon); } if (draw_timezone_icon && fit_in_event ()) { - max_icon_w = item_x + item_w - icon_x - - E_DAY_VIEW_EVENT_BORDER_WIDTH; - max_icon_h = item_y + item_h - icon_y - - E_DAY_VIEW_EVENT_BORDER_HEIGHT; - - cairo_save (cr); - cairo_rectangle (cr, icon_x, icon_y, max_icon_w, max_icon_h); - cairo_clip (cr); - cairo_new_path (cr); - gdk_cairo_set_source_pixbuf (cr, day_view->timezone_icon, icon_x, icon_y); - cairo_paint (cr); - cairo_close_path (cr); - cairo_restore (cr); - - icon_x += icon_x_inc; - icon_y += icon_y_inc; + draw_pixbuf (day_view->timezone_icon); } if (draw_meeting_icon && fit_in_event ()) { - max_icon_w = item_x + item_w - icon_x - - E_DAY_VIEW_EVENT_BORDER_WIDTH; - max_icon_h = item_y + item_h - icon_y - - E_DAY_VIEW_EVENT_BORDER_HEIGHT; - - cairo_save (cr); - gdk_cairo_set_source_pixbuf (cr, day_view->meeting_icon, icon_x, icon_y); - cairo_paint (cr); - cairo_restore (cr); - - icon_x += icon_x_inc; - icon_y += icon_y_inc; + draw_pixbuf (day_view->meeting_icon); } /* draw categories icons */ - for (elem = categories_list; elem && fit_in_event (); elem = elem->next) { - gchar *category; - GdkPixmap *pixmap = NULL; - GdkBitmap *mask = NULL; - - category = (gchar *) elem->data; - if (!e_categories_config_get_icon_for (category, &pixmap, &mask)) - continue; - - max_icon_w = item_x + item_w - icon_x - - E_DAY_VIEW_EVENT_BORDER_WIDTH; - max_icon_h = item_y + item_h - icon_y - - E_DAY_VIEW_EVENT_BORDER_HEIGHT; - - gdk_gc_set_clip_origin (gc, icon_x, icon_y); - if (mask != NULL) - gdk_gc_set_clip_mask (gc, mask); - gdk_draw_drawable (drawable, gc, - pixmap, - 0, 0, icon_x, icon_y, - MIN (E_DAY_VIEW_ICON_WIDTH, - max_icon_w), - MIN (E_DAY_VIEW_ICON_HEIGHT, - max_icon_h)); - - g_object_unref (pixmap); - if (mask != NULL) - g_object_unref (mask); - - icon_x += icon_x_inc; - icon_y += icon_y_inc; + for (pixbufs = categories_pixbufs; + pixbufs && fit_in_event (); + pixbufs = pixbufs->next) { + GdkPixbuf *pixbuf = pixbufs->data; + + draw_pixbuf (pixbuf); } - #undef fit_in_event + #undef draw_pixbuf + #undef fit_in_event gdk_gc_set_clip_mask (gc, NULL); } /* free memory */ - e_cal_component_free_categories_list (categories_list); + g_slist_foreach (categories_pixbufs, (GFunc)g_object_unref, NULL); + g_slist_free (categories_pixbufs); } if (!short_event) -- cgit v1.2.3 From 14eb2a884dd98fec4864e9454ae8d3e771c5656c Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 3 Aug 2009 23:24:04 +0200 Subject: Bug #587468 - Show meeting icon for component with attendees only --- calendar/gui/e-day-view-main-item.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'calendar/gui/e-day-view-main-item.c') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index 298831d60b..f0e988ac61 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -1075,7 +1075,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, num_icons++; } - if (e_cal_component_has_organizer (comp)) { + if (e_cal_component_has_attendees (comp)) { draw_meeting_icon = TRUE; num_icons++; } -- cgit v1.2.3 From e8382099228d46ebef684c5384bab6ec710283ce Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 28 Aug 2009 09:12:46 -0400 Subject: Re-enable more calendar code. --- calendar/gui/e-day-view-main-item.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'calendar/gui/e-day-view-main-item.c') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index f0e988ac61..a3f951b276 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -32,7 +32,7 @@ #include "e-util/e-categories-config.h" #include "e-day-view-layout.h" #include "e-day-view-main-item.h" -/*#include "a11y/ea-calendar.h"*/ /* KILL-BONOBO */ +#include "ea-calendar.h" #include "e-calendar-view.h" #include "comp-util.h" #include "calendar-config.h" @@ -112,9 +112,7 @@ e_day_view_main_item_class_init (EDayViewMainItemClass *class) G_PARAM_WRITABLE)); /* init the accessibility support for e_day_view */ -#if 0 /* KILL-BONOBO */ e_day_view_main_item_a11y_init (); -#endif } static void -- cgit v1.2.3