diff options
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/gui/cal-editor-utils.c | 5 | ||||
-rw-r--r-- | calendar/gui/calendar-view-factory.c | 14 | ||||
-rw-r--r-- | calendar/gui/dialogs/cancel-comp.c | 5 | ||||
-rw-r--r-- | calendar/gui/e-week-view-event-item.c | 73 | ||||
-rw-r--r-- | calendar/gui/e-week-view-layout.c | 22 | ||||
-rw-r--r-- | calendar/gui/ea-cal-view-event.c | 49 | ||||
-rw-r--r-- | calendar/gui/ea-day-view-main-item.c | 11 | ||||
-rw-r--r-- | calendar/gui/ea-week-view-main-item.c | 200 | ||||
-rw-r--r-- | calendar/gui/print.c | 131 |
9 files changed, 340 insertions, 170 deletions
diff --git a/calendar/gui/cal-editor-utils.c b/calendar/gui/cal-editor-utils.c index 4258e2ce01..c49e648883 100644 --- a/calendar/gui/cal-editor-utils.c +++ b/calendar/gui/cal-editor-utils.c @@ -99,7 +99,10 @@ open_component_editor (EShell *shell, break; default: if (error) - *error = g_error_new (E_CALENDAR_ERROR, E_CALENDAR_STATUS_INVALID_OBJECT, "%s", _("Invalid object")); + *error = g_error_new ( + E_CALENDAR_ERROR, + E_CALENDAR_STATUS_INVALID_OBJECT, + "%s", _("Invalid object")); break; } diff --git a/calendar/gui/calendar-view-factory.c b/calendar/gui/calendar-view-factory.c index 34e8344a88..fb48a5559a 100644 --- a/calendar/gui/calendar-view-factory.c +++ b/calendar/gui/calendar-view-factory.c @@ -41,11 +41,15 @@ struct _CalendarViewFactoryPrivate { -static void calendar_view_factory_finalize (GObject *object); - -static const gchar *calendar_view_factory_get_title (GalViewFactory *factory); -static const gchar *calendar_view_factory_get_type_code (GalViewFactory *factory); -static GalView *calendar_view_factory_new_view (GalViewFactory *factory, const gchar *name); +static void calendar_view_factory_finalize (GObject *object); +static const gchar * + calendar_view_factory_get_title (GalViewFactory *factory); +static const gchar * + calendar_view_factory_get_type_code + (GalViewFactory *factory); +static GalView * + calendar_view_factory_new_view (GalViewFactory *factory, + const gchar *name); G_DEFINE_TYPE (CalendarViewFactory, calendar_view_factory, GAL_VIEW_FACTORY_TYPE) diff --git a/calendar/gui/dialogs/cancel-comp.c b/calendar/gui/dialogs/cancel-comp.c index 2c827afacf..fe85119dae 100644 --- a/calendar/gui/dialogs/cancel-comp.c +++ b/calendar/gui/dialogs/cancel-comp.c @@ -64,7 +64,10 @@ is_past_event (ECalComponent *comp) * Return value: TRUE if the user clicked Yes, FALSE otherwise. **/ gboolean -cancel_component_dialog (GtkWindow *parent, ECal *client, ECalComponent *comp, gboolean deleting) +cancel_component_dialog (GtkWindow *parent, + ECal *client, + ECalComponent *comp, + gboolean deleting) { ECalComponentVType vtype; const gchar *id; diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c index 3054201e34..7971ebb2a8 100644 --- a/calendar/gui/e-week-view-event-item.c +++ b/calendar/gui/e-week-view-event-item.c @@ -137,8 +137,14 @@ week_view_event_item_double_click (EWeekViewEventItem *event_item, week_view->events, EWeekViewEvent, week_view->editing_event_num); - /* do not call edit of the component, if double clicked on the component, which is not on the server */ - if (editing && event && editing->comp_data == event->comp_data && (!event->comp_data || !is_icalcomp_on_the_server (event->comp_data->icalcomp, event->comp_data->client))) + /* Do not call edit of the component, if double clicked + * on the component, which is not on the server. */ + if (editing && event && + editing->comp_data == event->comp_data && + (!event->comp_data || + !is_icalcomp_on_the_server ( + event->comp_data->icalcomp, + event->comp_data->client))) return TRUE; } @@ -371,7 +377,8 @@ week_view_event_item_draw_icons (EWeekViewEventItem *event_item, event = &g_array_index (week_view->events, EWeekViewEvent, event_item->priv->event_num); comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); + e_cal_component_set_icalcomponent ( + comp, icalcomponent_new_clone (event->comp_data->icalcomp)); gc = week_view->main_gc; cr = gdk_cairo_create (drawable); @@ -470,9 +477,11 @@ week_view_event_item_draw_triangle (EWeekViewEventItem *event_item, gint h, GdkRegion *draw_region) { + ECalModel *model; EWeekView *week_view; EWeekViewEvent *event; GdkPoint points[3]; + const gchar *color_spec; gint c1, c2; cairo_t *cr; @@ -493,21 +502,34 @@ week_view_event_item_draw_triangle (EWeekViewEventItem *event_item, points[2].x = x; points[2].y = y + h - 1; - 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)) { + model = e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)); + + color_spec = + e_cal_model_get_color_for_component (model, event->comp_data); + + if (gdk_color_parse (color_spec, &bg_color)) { GdkColormap *colormap; colormap = gtk_widget_get_colormap (GTK_WIDGET (week_view)); if (gdk_colormap_alloc_color (colormap, &bg_color, TRUE, TRUE)) { gdk_cairo_set_source_color (cr, &bg_color); - } - else { - gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND]); + } else { + EWeekViewColors wvc; + GdkColor *color; - } + wvc = E_WEEK_VIEW_COLOR_EVENT_BACKGROUND; + color = &week_view->colors[wvc]; + + gdk_cairo_set_source_color (cr, color); + } } else { - gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BACKGROUND]); + EWeekViewColors wvc; + GdkColor *color; + + wvc = E_WEEK_VIEW_COLOR_EVENT_BACKGROUND; + color = &week_view->colors[wvc]; + + gdk_cairo_set_source_color (cr, color); } cairo_save (cr); @@ -638,6 +660,7 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item, EWeekView *week_view; EWeekViewEvent *event; EWeekViewEventSpan *span; + ECalModel *model; GdkGC *gc; gint x1, y1, x2, y2, time_x, time_y; gint icon_x, icon_y, time_width, min_end_time_x, max_icon_x; @@ -656,6 +679,7 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item, gdouble cc = 65535.0; GdkRegion *draw_region; GdkRectangle rect; + const gchar *color_spec; event_item = E_WEEK_VIEW_EVENT_ITEM (canvas_item); week_view = E_WEEK_VIEW (GTK_WIDGET (canvas_item->canvas)->parent); @@ -669,7 +693,9 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item, event = &g_array_index (week_view->events, EWeekViewEvent, event_item->priv->event_num); - g_return_if_fail (event->spans_index + event_item->priv->span_num < week_view->spans->len); + g_return_if_fail ( + event->spans_index + event_item->priv->span_num < + week_view->spans->len); span = &g_array_index (week_view->spans, EWeekViewEventSpan, event->spans_index + event_item->priv->span_num); @@ -715,8 +741,13 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item, one_day_event = e_week_view_is_one_day_event (week_view, event_item->priv->event_num); + model = e_calendar_view_get_model (E_CALENDAR_VIEW (week_view)); + + color_spec = + e_cal_model_get_color_for_component (model, event->comp_data); + bg_color = 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)) { + if (gdk_color_parse (color_spec, &bg_color)) { GdkColormap *colormap; colormap = gtk_widget_get_colormap (GTK_WIDGET (week_view)); @@ -905,8 +936,14 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item, x1 + E_WEEK_VIEW_EVENT_L_PAD + 2, y1, -3, y2 - y1 + 1, draw_region); } else if (can_draw_in_region (draw_region, rect_x, y1, 1, y2 - y1)) { + EWeekViewColors wvc; + GdkColor *color; + + wvc = E_WEEK_VIEW_COLOR_EVENT_BORDER; + color = &week_view->colors[wvc]; + cairo_save (cr); - gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BORDER]); + gdk_cairo_set_source_color (cr, color); cairo_set_line_width (cr, 0.7); cairo_move_to (cr, rect_x, y1); cairo_line_to (cr, rect_x, y2); @@ -920,8 +957,14 @@ week_view_event_item_draw (GnomeCanvasItem *canvas_item, x2 - E_WEEK_VIEW_EVENT_R_PAD - 2, y1, 3, y2 - y1 + 1, draw_region); } else if (can_draw_in_region (draw_region, rect_x2, y2, 1, 1)) { + EWeekViewColors wvc; + GdkColor *color; + + wvc = E_WEEK_VIEW_COLOR_EVENT_BORDER; + color = &week_view->colors[wvc]; + cairo_save (cr); - gdk_cairo_set_source_color (cr, &week_view->colors[E_WEEK_VIEW_COLOR_EVENT_BORDER]); + gdk_cairo_set_source_color (cr, color); cairo_set_line_width (cr, 0.7); /* rect_x2 is used uninitialized here */ cairo_move_to (cr, rect_x2, y2); diff --git a/calendar/gui/e-week-view-layout.c b/calendar/gui/e-week-view-layout.c index f28f77a020..8962d81610 100644 --- a/calendar/gui/e-week-view-layout.c +++ b/calendar/gui/e-week-view-layout.c @@ -189,7 +189,9 @@ e_week_view_layout_event (EWeekViewEvent *event, span.background_item = NULL; span.text_item = NULL; if (event->num_spans > span_num) { - old_span = &g_array_index (old_spans, EWeekViewEventSpan, event->spans_index + span_num); + old_span = &g_array_index ( + old_spans, EWeekViewEventSpan, + event->spans_index + span_num); span.background_item = old_span->background_item; span.text_item = old_span->text_item; old_span->background_item = NULL; @@ -327,7 +329,14 @@ e_week_view_layout_get_day_position (gint day, } } else { #define wk(x) ( ( working_days & (days [ ((x) + display_start_day) % 7 ]) ) ? 1 : 0) - CalWeekdays days [] = {CAL_MONDAY, CAL_TUESDAY, CAL_WEDNESDAY, CAL_THURSDAY, CAL_FRIDAY, CAL_SATURDAY, CAL_SUNDAY}; + CalWeekdays days[] = { + CAL_MONDAY, + CAL_TUESDAY, + CAL_WEDNESDAY, + CAL_THURSDAY, + CAL_FRIDAY, + CAL_SATURDAY, + CAL_SUNDAY }; CalWeekdays working_days; gint arr[4] = {1, 1, 1, 1}; gint edge, i, wd, m, M; @@ -442,10 +451,13 @@ e_week_view_layout_get_span_position (EWeekViewEvent *event, } } else { gint day_x, day_y, rows = 0; - e_week_view_layout_get_day_position (end_day_of_week, multi_week_view, 1, display_start_day, compress_weekend, - &day_x, &day_y, &rows); + e_week_view_layout_get_day_position ( + end_day_of_week, multi_week_view, 1, + display_start_day, compress_weekend, + &day_x, &day_y, &rows); - if (((rows / 2) * rows_per_cell) + ((rows % 2) * rows_per_compressed_cell) <= span->row) + if (((rows / 2) * rows_per_cell) + ((rows % 2) * + rows_per_compressed_cell) <= span->row) return FALSE; } } diff --git a/calendar/gui/ea-cal-view-event.c b/calendar/gui/ea-cal-view-event.c index 4fbc93e3e2..230d7ca84f 100644 --- a/calendar/gui/ea-cal-view-event.c +++ b/calendar/gui/ea-cal-view-event.c @@ -27,29 +27,42 @@ #include <text/e-text.h> #include <glib/gi18n.h> -static void ea_cal_view_event_class_init (EaCalViewEventClass *klass); -static void ea_cal_view_event_init (EaCalViewEvent *a11y); - -static void ea_cal_view_event_dispose (GObject *object); -static G_CONST_RETURN gchar * ea_cal_view_event_get_name (AtkObject *accessible); -static G_CONST_RETURN gchar * ea_cal_view_event_get_description (AtkObject *accessible); -static AtkObject* ea_cal_view_event_get_parent (AtkObject *accessible); -static gint ea_cal_view_event_get_index_in_parent (AtkObject *accessible); -static AtkStateSet *ea_cal_view_event_ref_state_set (AtkObject *accessible); +static void ea_cal_view_event_class_init (EaCalViewEventClass *klass); +static void ea_cal_view_event_init (EaCalViewEvent *a11y); +static void ea_cal_view_event_dispose (GObject *object); +static G_CONST_RETURN gchar * + ea_cal_view_event_get_name (AtkObject *accessible); +static G_CONST_RETURN gchar * + ea_cal_view_event_get_description + (AtkObject *accessible); +static AtkObject * + ea_cal_view_event_get_parent (AtkObject *accessible); +static gint ea_cal_view_event_get_index_in_parent + (AtkObject *accessible); +static AtkStateSet * + ea_cal_view_event_ref_state_set (AtkObject *accessible); /* component interface */ -static void atk_component_interface_init (AtkComponentIface *iface); -static void ea_cal_view_get_extents (AtkComponent *component, - gint *x, gint *y, gint *width, gint *height, - AtkCoordType coord_type); +static void atk_component_interface_init (AtkComponentIface *iface); +static void ea_cal_view_get_extents (AtkComponent *component, + gint *x, + gint *y, + gint *width, + gint *height, + AtkCoordType coord_type); /* action interface */ -static void atk_action_interface_init (AtkActionIface *iface); -static gboolean ea_cal_view_event_do_action (AtkAction *action, gint i); -static gint ea_cal_view_event_get_n_actions (AtkAction *action); -static G_CONST_RETURN gchar * ea_cal_view_event_action_get_name (AtkAction *action, gint i); +static void atk_action_interface_init (AtkActionIface *iface); +static gboolean ea_cal_view_event_do_action (AtkAction *action, + gint i); +static gint ea_cal_view_event_get_n_actions (AtkAction *action); +static G_CONST_RETURN gchar * + ea_cal_view_event_action_get_name + (AtkAction *action, + gint i); #ifdef ACC_DEBUG -static gint n_ea_cal_view_event_created = 0, n_ea_cal_view_event_destroyed = 0; +static gint n_ea_cal_view_event_created = 0; +static gint n_ea_cal_view_event_destroyed = 0; static void ea_cal_view_finalize (GObject *object); #endif diff --git a/calendar/gui/ea-day-view-main-item.c b/calendar/gui/ea-day-view-main-item.c index 9d277287f6..861b83746b 100644 --- a/calendar/gui/ea-day-view-main-item.c +++ b/calendar/gui/ea-day-view-main-item.c @@ -29,11 +29,14 @@ #include <glib/gi18n.h> /* EaDayViewMainItem */ -static void ea_day_view_main_item_class_init (EaDayViewMainItemClass *klass); +static void ea_day_view_main_item_class_init(EaDayViewMainItemClass *klass); -static void ea_day_view_main_item_finalize (GObject *object); -static G_CONST_RETURN gchar * ea_day_view_main_item_get_name (AtkObject *accessible); -static G_CONST_RETURN gchar * ea_day_view_main_item_get_description (AtkObject *accessible); +static void ea_day_view_main_item_finalize (GObject *object); +static G_CONST_RETURN gchar * + ea_day_view_main_item_get_name (AtkObject *accessible); +static G_CONST_RETURN gchar * + ea_day_view_main_item_get_description + (AtkObject *accessible); static gint ea_day_view_main_item_get_n_children (AtkObject *obj); static AtkObject* ea_day_view_main_item_ref_child (AtkObject *obj, diff --git a/calendar/gui/ea-week-view-main-item.c b/calendar/gui/ea-week-view-main-item.c index e7749f6a70..1db4d8b5be 100644 --- a/calendar/gui/ea-week-view-main-item.c +++ b/calendar/gui/ea-week-view-main-item.c @@ -28,80 +28,115 @@ #include <glib/gi18n.h> /* EaWeekViewMainItem */ -static void ea_week_view_main_item_class_init (EaWeekViewMainItemClass *klass); - -static void ea_week_view_main_item_finalize (GObject *object); -static G_CONST_RETURN gchar * ea_week_view_main_item_get_name (AtkObject *accessible); -static G_CONST_RETURN gchar * ea_week_view_main_item_get_description (AtkObject *accessible); - -static gint ea_week_view_main_item_get_n_children (AtkObject *obj); -static AtkObject* ea_week_view_main_item_ref_child (AtkObject *obj, - gint i); -static AtkObject * ea_week_view_main_item_get_parent (AtkObject *accessible); -static gint ea_week_view_main_item_get_index_in_parent (AtkObject *accessible); +static void ea_week_view_main_item_class_init + (EaWeekViewMainItemClass *class); +static void ea_week_view_main_item_finalize (GObject *object); +static G_CONST_RETURN gchar * + ea_week_view_main_item_get_name (AtkObject *accessible); +static G_CONST_RETURN gchar * + ea_week_view_main_item_get_description + (AtkObject *accessible); +static gint ea_week_view_main_item_get_n_children + (AtkObject *accessible); +static AtkObject * + ea_week_view_main_item_ref_child(AtkObject *accessible, + gint i); +static AtkObject * + ea_week_view_main_item_get_parent + (AtkObject *accessible); +static gint ea_week_view_main_item_get_index_in_parent + (AtkObject *accessible); /* callbacks */ -static void ea_week_view_main_item_dates_change_cb (GnomeCalendar *gcal, gpointer data); -static void ea_week_view_main_item_time_change_cb (EWeekView *week_view, gpointer data); +static void ea_week_view_main_item_dates_change_cb + (GnomeCalendar *gcal, + gpointer data); +static void ea_week_view_main_item_time_change_cb + (EWeekView *week_view, + gpointer data); /* component interface */ -static void atk_component_interface_init (AtkComponentIface *iface); -static void component_interface_get_extents (AtkComponent *component, - gint *x, gint *y, - gint *width, gint *height, - AtkCoordType coord_type); +static void atk_component_interface_init (AtkComponentIface *iface); +static void component_interface_get_extents (AtkComponent *component, + gint *x, + gint *y, + gint *width, + gint *height, + AtkCoordType coord_type); /* atk table interface */ -static void atk_table_interface_init (AtkTableIface *iface); -static gint table_interface_get_index_at (AtkTable *table, - gint row, - gint column); -static gint table_interface_get_column_at_index (AtkTable *table, - gint index); -static gint table_interface_get_row_at_index (AtkTable *table, - gint index); -static AtkObject* table_interface_ref_at (AtkTable *table, - gint row, - gint column); -static gint table_interface_get_n_rows (AtkTable *table); -static gint table_interface_get_n_columns (AtkTable *table); -static gint table_interface_get_column_extent_at (AtkTable *table, - gint row, - gint column); -static gint table_interface_get_row_extent_at (AtkTable *table, - gint row, - gint column); - -static gboolean table_interface_is_row_selected (AtkTable *table, - gint row); -static gboolean table_interface_is_column_selected (AtkTable *table, - gint row); -static gboolean table_interface_is_selected (AtkTable *table, - gint row, - gint column); -static gint table_interface_get_selected_rows (AtkTable *table, - gint **rows_selected); -static gint table_interface_get_selected_columns (AtkTable *table, - gint **columns_selected); -static gboolean table_interface_add_row_selection (AtkTable *table, gint row); -static gboolean table_interface_remove_row_selection (AtkTable *table, - gint row); -static gboolean table_interface_add_column_selection (AtkTable *table, - gint column); -static gboolean table_interface_remove_column_selection (AtkTable *table, - gint column); -static AtkObject* table_interface_get_row_header (AtkTable *table, gint row); -static AtkObject* table_interface_get_column_header (AtkTable *table, - gint in_col); -static AtkObject* table_interface_get_caption (AtkTable *table); +static void atk_table_interface_init (AtkTableIface *iface); +static gint table_interface_get_index_at (AtkTable *table, + gint row, + gint column); +static gint table_interface_get_column_at_index + (AtkTable *table, + gint index); +static gint table_interface_get_row_at_index(AtkTable *table, + gint index); +static AtkObject * + table_interface_ref_at (AtkTable *table, + gint row, + gint column); +static gint table_interface_get_n_rows (AtkTable *table); +static gint table_interface_get_n_columns (AtkTable *table); +static gint table_interface_get_column_extent_at + (AtkTable *table, + gint row, + gint column); +static gint table_interface_get_row_extent_at + (AtkTable *table, + gint row, + gint column); + +static gboolean table_interface_is_row_selected (AtkTable *table, + gint row); +static gboolean table_interface_is_column_selected + (AtkTable *table, + gint row); +static gboolean table_interface_is_selected (AtkTable *table, + gint row, + gint column); +static gint table_interface_get_selected_rows + (AtkTable *table, + gint **rows_selected); +static gint table_interface_get_selected_columns + (AtkTable *table, + gint **columns_selected); +static gboolean table_interface_add_row_selection + (AtkTable *table, + gint row); +static gboolean table_interface_remove_row_selection + (AtkTable *table, + gint row); +static gboolean table_interface_add_column_selection + (AtkTable *table, + gint column); +static gboolean table_interface_remove_column_selection + (AtkTable *table, + gint column); +static AtkObject * + table_interface_get_row_header (AtkTable *table, + gint row); +static AtkObject * + table_interface_get_column_header + (AtkTable *table, + gint in_col); +static AtkObject * + table_interface_get_caption (AtkTable *table); static G_CONST_RETURN gchar * -table_interface_get_column_description (AtkTable *table, gint in_col); + table_interface_get_column_description + (AtkTable *table, + gint in_col); static G_CONST_RETURN gchar * -table_interface_get_row_description (AtkTable *table, gint row); + table_interface_get_row_description + (AtkTable *table, + gint row); -static AtkObject* table_interface_get_summary (AtkTable *table); +static AtkObject * + table_interface_get_summary (AtkTable *table); /* atk selection interface */ static void atk_selection_interface_init (AtkSelectionIface *iface); @@ -116,24 +151,27 @@ static gboolean selection_interface_is_child_selected (AtkSelection *selection, /* helpers */ static EaCellTable * -ea_week_view_main_item_get_cell_data (EaWeekViewMainItem *ea_main_item); - -static void -ea_week_view_main_item_destory_cell_data (EaWeekViewMainItem *ea_main_item); - -static gint -ea_week_view_main_item_get_child_index_at (EaWeekViewMainItem *ea_main_item, - gint row, gint column); -static gint -ea_week_view_main_item_get_row_at_index (EaWeekViewMainItem *ea_main_item, - gint index); -static gint -ea_week_view_main_item_get_column_at_index (EaWeekViewMainItem *ea_main_item, - gint index); -static gint -ea_week_view_main_item_get_row_label (EaWeekViewMainItem *ea_main_item, - gint row, gchar *buffer, - gint buffer_size); + ea_week_view_main_item_get_cell_data + (EaWeekViewMainItem *ea_main_item); + +static void ea_week_view_main_item_destory_cell_data + (EaWeekViewMainItem *ea_main_item); + +static gint ea_week_view_main_item_get_child_index_at + (EaWeekViewMainItem *ea_main_item, + gint row, + gint column); +static gint ea_week_view_main_item_get_row_at_index + (EaWeekViewMainItem *ea_main_item, + gint index); +static gint ea_week_view_main_item_get_column_at_index + (EaWeekViewMainItem *ea_main_item, + gint index); +static gint ea_week_view_main_item_get_row_label + (EaWeekViewMainItem *ea_main_item, + gint row, + gchar *buffer, + gint buffer_size); #ifdef ACC_DEBUG static gint n_ea_week_view_main_item_created = 0; diff --git a/calendar/gui/print.c b/calendar/gui/print.c index e4b9f01b03..d51f4cee0e 100644 --- a/calendar/gui/print.c +++ b/calendar/gui/print.c @@ -223,10 +223,10 @@ convert_timet_to_struct_tm (time_t time, icaltimezone *zone) return &my_tm; } -/* Fills the 42-element days array with the day numbers for the specified month. Slots outside the - * bounds of the month are filled with zeros. The starting and ending indexes of the days are - * returned in the start and end arguments. - */ +/* Fills the 42-element days array with the day numbers for the specified + * month. Slots outside the bounds of the month are filled with zeros. + * The starting and ending indexes of the days are returned in the start + * and end arguments. */ static void build_month (gint month, gint year, gint *days, gint *start, gint *end) { @@ -554,7 +554,10 @@ format_date(time_t time, gint flags, gchar *buffer, gint bufflen) } static gboolean -instance_cb (ECalComponent *comp, time_t instance_start, time_t instance_end, gpointer data) +instance_cb (ECalComponent *comp, + time_t instance_start, + time_t instance_end, + gpointer data) { gboolean *found = ((ECalModelGenerateInstancesData *) data)->cb_data; @@ -717,7 +720,9 @@ bound_text (GtkPrintContext *context, pango_layout_get_size (layout, &layout_width, &layout_height); - if (last_page_start && y1 + pango_units_to_double (layout_height) > y2 + (*last_page_start)) { + if (last_page_start && + y1 + pango_units_to_double (layout_height) > + y2 + (*last_page_start)) { /* draw this on new page */ if (pages) *pages = *pages + 1; @@ -1033,7 +1038,9 @@ print_attendees (GtkPrintContext *context, PangoFontDescription *font, cairo_t * cairo_show_page (cr); } - top = bound_text (context, font, text->str, -1, left + 40.0, top, right, bottom, FALSE, NULL, pages); + top = bound_text ( + context, font, text->str, -1, left + 40.0, + top, right, bottom, FALSE, NULL, pages); g_string_free (text, TRUE); } @@ -1067,10 +1074,16 @@ get_summary_with_location (icalcomponent *icalcomp) } static void -print_day_long_event (GtkPrintContext *context, PangoFontDescription *font, - double left, double right, double top, double bottom, - double row_height, EDayViewEvent *event, - struct pdinfo *pdi, ECalModel *model) +print_day_long_event (GtkPrintContext *context, + PangoFontDescription *font, + gdouble left, + gdouble right, + gdouble top, + gdouble bottom, + gdouble row_height, + EDayViewEvent *event, + struct pdinfo *pdi, + ECalModel *model) { gdouble x1, x2, y1, y2; gdouble left_triangle_width = -1.0, right_triangle_width = -1.0; @@ -1095,7 +1108,8 @@ print_day_long_event (GtkPrintContext *context, PangoFontDescription *font, y1 = top + event->start_row_or_col * row_height + 1; y2 = y1 + row_height - 1; red = green = blue = 0.95; - e_cal_model_get_rgb_color_for_component (model, event->comp_data, &red, &green, &blue); + e_cal_model_get_rgb_color_for_component ( + model, event->comp_data, &red, &green, &blue); print_border_with_triangles (context, x1, x2, y1, y2, 0.5, red, green, blue, left_triangle_width, right_triangle_width); @@ -1169,7 +1183,8 @@ print_day_event (GtkPrintContext *context, PangoFontDescription *font, start_row = MAX (0, start_row); end_row = (end_offset - 1) / pdi->mins_per_row; end_row = MIN (pdi->rows - 1, end_row); - col_width = (right - left) / pdi->cols_per_row[event->start_minute / pdi->mins_per_row]; + col_width = (right - left) / + pdi->cols_per_row[event->start_minute / pdi->mins_per_row]; if (start_offset != start_row * pdi->mins_per_row || end_offset != (end_row + 1) * pdi->mins_per_row) @@ -1187,7 +1202,8 @@ print_day_event (GtkPrintContext *context, PangoFontDescription *font, #endif red = green = blue = 0.95; - e_cal_model_get_rgb_color_for_component (model, event->comp_data, &red, &green, &blue); + e_cal_model_get_rgb_color_for_component ( + model, event->comp_data, &red, &green, &blue); print_border_rgb (context, x1, x2, y1, y2, 1.0, red, green, blue); text = get_summary_with_location (event->comp_data->icalcomp); @@ -1309,8 +1325,10 @@ print_day_details (GtkPrintContext *context, GnomeCalendar *gcal, time_t whence, for (i = 0; i < rows_in_top_display && i < pdi.long_events->len; i++) { event = &g_array_index (pdi.long_events, EDayViewEvent, i); - print_day_long_event (context, font, left, right, top + LONG_DAY_EVENTS_TOP_SPACING, bottom, - DAY_VIEW_ROW_HEIGHT, event, &pdi, model); + print_day_long_event ( + context, font, left, right, + top + LONG_DAY_EVENTS_TOP_SPACING, bottom, + DAY_VIEW_ROW_HEIGHT, event, &pdi, model); } if (rows_in_top_display < pdi.long_events->len) { @@ -1333,7 +1351,9 @@ print_day_details (GtkPrintContext *context, GnomeCalendar *gcal, time_t whence, x = right - gdk_pixbuf_get_width (pixbuf) * 0.5 - 10; /* Placing '...' over the last all day event entry printed. '-1 -1' comes from print_long_day_event (top/bottom spacing in each cell) */ - y = top + LONG_DAY_EVENTS_TOP_SPACING + DAY_VIEW_ROW_HEIGHT * (i - 1) + (DAY_VIEW_ROW_HEIGHT - 1 - 1) * 0.5; + y = top + LONG_DAY_EVENTS_TOP_SPACING + + DAY_VIEW_ROW_HEIGHT * (i - 1) + + (DAY_VIEW_ROW_HEIGHT - 1 - 1) * 0.5; cairo_save (cr); cairo_scale (cr, 0.5, 0.5); @@ -1349,13 +1369,16 @@ print_day_details (GtkPrintContext *context, GnomeCalendar *gcal, time_t whence, cr = gtk_print_context_get_cairo_context (context); cairo_set_source_rgb (cr, 0, 0, 0); - print_border (context, left, right, - top, - top + rows_in_top_display * DAY_VIEW_ROW_HEIGHT + LONG_DAY_EVENTS_TOP_SPACING + LONG_DAY_EVENTS_BOTTOM_SPACING, - 1.0, -1.0); + print_border ( + context, left, right, + top, top + rows_in_top_display * DAY_VIEW_ROW_HEIGHT + + LONG_DAY_EVENTS_TOP_SPACING + LONG_DAY_EVENTS_BOTTOM_SPACING, + 1.0, -1.0); /* Adjust the area containing the main display. */ - top += rows_in_top_display * DAY_VIEW_ROW_HEIGHT + LONG_DAY_EVENTS_TOP_SPACING + LONG_DAY_EVENTS_BOTTOM_SPACING; + top += rows_in_top_display * DAY_VIEW_ROW_HEIGHT + + LONG_DAY_EVENTS_TOP_SPACING + + LONG_DAY_EVENTS_BOTTOM_SPACING; /* Draw the borders, lines, and times down the left. */ print_day_background (context, gcal, whence, &pdi, @@ -1430,9 +1453,9 @@ print_week_long_event (GtkPrintContext *context, PangoFontDescription *font, if (event->end > psi->day_starts[span->start_day + span->num_days]) right_triangle_width = 4; - print_border_with_triangles (context, x1, x2, y1, y1 + row_height, 0.0, red, green, blue, - left_triangle_width, - right_triangle_width); + print_border_with_triangles ( + context, x1, x2, y1, y1 + row_height, 0.0, red, green, blue, + left_triangle_width, right_triangle_width); /* If the event starts after the first day being printed, we need to print the start time. */ @@ -1449,7 +1472,9 @@ print_week_long_event (GtkPrintContext *context, PangoFontDescription *font, buffer, sizeof (buffer)); x1 += 4; - x1 += print_text_size (context, buffer, PANGO_ALIGN_LEFT, x1, x2, y1, y1 + row_height); + x1 += print_text_size ( + context, buffer, PANGO_ALIGN_LEFT, + x1, x2, y1, y1 + row_height); } /* If the event ends before the end of the last day being printed, @@ -1467,7 +1492,9 @@ print_week_long_event (GtkPrintContext *context, PangoFontDescription *font, buffer, sizeof (buffer)); x2 -= 4; - x2 -= print_text_size (context, buffer, PANGO_ALIGN_RIGHT, x1, x2, y1, y1 + row_height); + x2 -= print_text_size ( + context, buffer, PANGO_ALIGN_RIGHT, + x1, x2, y1, y1 + row_height); } x1 += 4; @@ -1496,7 +1523,9 @@ print_week_day_event (GtkPrintContext *context, PangoFontDescription *font, e_time_format_time (&date_tm, psi->use_24_hour_format, FALSE, buffer, sizeof (buffer)); print_rectangle (context, x1, y1, x2 - x1, row_height, red, green, blue); - x1 += print_text_size (context, buffer, PANGO_ALIGN_LEFT, x1, x2, y1, y1 + row_height) + 4; + x1 += print_text_size ( + context, buffer, PANGO_ALIGN_LEFT, + x1, x2, y1, y1 + row_height) + 4; if (psi->weeks_shown <= 2) { date_tm.tm_hour = event->end_minute / 60; @@ -1506,10 +1535,14 @@ print_week_day_event (GtkPrintContext *context, PangoFontDescription *font, buffer, sizeof (buffer)); print_rectangle (context, x1, y1, x2 - x1, row_height, red, green, blue); - x1 += print_text_size (context, buffer, PANGO_ALIGN_LEFT, x1, x2, y1, y1 + row_height) + 4; + x1 += print_text_size ( + context, buffer, PANGO_ALIGN_LEFT, + x1, x2, y1, y1 + row_height) + 4; } - print_text_size (context, text, PANGO_ALIGN_LEFT, x1, x2, y1, y1 + row_height); + print_text_size ( + context, text, PANGO_ALIGN_LEFT, + x1, x2, y1, y1 + row_height); } static void @@ -1574,7 +1607,8 @@ print_week_event (GtkPrintContext *context, PangoFontDescription *font, red = .9; green = .9; blue = .9; - e_cal_model_get_rgb_color_for_component (model, event->comp_data, &red, &green, &blue); + e_cal_model_get_rgb_color_for_component ( + model, event->comp_data, &red, &green, &blue); if (print_is_one_day_week_event (event, span, psi->day_starts)) { print_week_day_event (context, font, psi, @@ -1605,7 +1639,10 @@ print_week_event (GtkPrintContext *context, PangoFontDescription *font, if (end_day_of_week == 5 || end_day_of_week == 6) { /* Sat or Sun */ - y1 = y1 + (psi->rows_per_compressed_cell - psi->rows_per_cell) * psi->row_height - 3.0; + y1 = y1 + + (psi->rows_per_compressed_cell - + psi->rows_per_cell) * + psi->row_height - 3.0; } } @@ -2022,7 +2059,8 @@ print_todo_details (GtkPrintContext *context, GnomeCalendar *gcal, continue; comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp)); + e_cal_component_set_icalcomponent ( + comp, icalcomponent_new_clone (comp_data->icalcomp)); e_cal_component_get_summary (comp, &summary); if (!summary.value) { @@ -2504,7 +2542,8 @@ print_comp_draw_real (GtkPrintOperation *operation, top = 0.0; - /* either draw only the right page or do not draw anything when calculating number of pages */ + /* Either draw only the right page or do not draw + * anything when calculating number of pages. */ if (page_nr != -1) top = top - ((page_nr) * height); else @@ -2572,10 +2611,14 @@ print_comp_draw_real (GtkPrintOperation *operation, /* Attendees */ if ((page_nr == 0) && e_cal_component_has_attendees (comp)) { - top = bound_text (context, font, _("Attendees: "), -1, 0.0, top, width, height, FALSE, &page_start, &pages); + top = bound_text ( + context, font, _("Attendees: "), -1, 0.0, + top, width, height, FALSE, &page_start, &pages); pango_font_description_free (font); font = get_font_for_size (12, PANGO_WEIGHT_NORMAL); - top = print_attendees (context, font, cr, 0.0, width, top, height, comp, page_nr, &pages); + top = print_attendees ( + context, font, cr, 0.0, width, + top, height, comp, page_nr, &pages); top += get_font_size (font) - 6; } @@ -2626,9 +2669,13 @@ print_comp_draw_real (GtkPrintOperation *operation, if (priority && *priority >= 0) { gchar *pri_text; - pri_text = g_strdup_printf (_("Priority: %s"), e_cal_util_priority_to_string (*priority)); - top = bound_text (context, font, pri_text, -1, - 0.0, top, width, height, FALSE, &page_start, &pages); + pri_text = g_strdup_printf ( + _("Priority: %s"), + e_cal_util_priority_to_string (*priority)); + top = bound_text ( + context, font, pri_text, -1, + 0.0, top, width, height, FALSE, + &page_start, &pages); top += get_font_size (font) - 6; g_free (pri_text); } @@ -2702,7 +2749,11 @@ print_comp_draw_real (GtkPrintOperation *operation, for (line = ptext->value; line != NULL; line = next_line) { next_line = strchr (line, '\n'); - top = bound_text (context, font, line, next_line ? next_line - line : -1, 0.0, top + 3, width, height, TRUE, &page_start, &pages); + top = bound_text ( + context, font, line, + next_line ? next_line - line : -1, + 0.0, top + 3, width, height, TRUE, + &page_start, &pages); if (next_line) { next_line ++; |