diff options
author | Damon Chaplin <damon@helixcode.com> | 2000-05-20 18:38:19 +0800 |
---|---|---|
committer | Damon Chaplin <damon@src.gnome.org> | 2000-05-20 18:38:19 +0800 |
commit | 4eb47f9a4696877218bf05d53c52f829d2afcdd5 (patch) | |
tree | 81a7adf9cc66caa99031a1908d7317d616ea2b64 /calendar/gui/e-day-view-time-item.c | |
parent | ccd4d84234d933ccf05769e71a3372e149d707d1 (diff) | |
download | gsoc2013-evolution-4eb47f9a4696877218bf05d53c52f829d2afcdd5.tar gsoc2013-evolution-4eb47f9a4696877218bf05d53c52f829d2afcdd5.tar.gz gsoc2013-evolution-4eb47f9a4696877218bf05d53c52f829d2afcdd5.tar.bz2 gsoc2013-evolution-4eb47f9a4696877218bf05d53c52f829d2afcdd5.tar.lz gsoc2013-evolution-4eb47f9a4696877218bf05d53c52f829d2afcdd5.tar.xz gsoc2013-evolution-4eb47f9a4696877218bf05d53c52f829d2afcdd5.tar.zst gsoc2013-evolution-4eb47f9a4696877218bf05d53c52f829d2afcdd5.zip |
new files to implement iCalendar recurrence rules. These are only part
2000-05-20 Damon Chaplin <damon@helixcode.com>
* cal-util/cal-recur.[hc]: new files to implement iCalendar recurrence
rules. These are only part finished, but people may like to check that
the architecture seems OK.
2000-05-17 Damon Chaplin <damon@helixcode.com>
* gui/e-day-view.c (e_day_view_on_delete_occurrence):
* gui/e-week-view.c (e_week_view_on_delete_occurrence): use a copy of
the iCalObject so we detect the change in the "update_event" callback.
Maybe we should just update the view ourselves and then we wouldn't
need to detect any change in the callback.
* cal-util/calobj.c (ical_object_reset_recurrence): new function to
get rid of any recurrence rules. Used when we 'unrecur' an event.
* gui/e-day-view.c (e_day_view_key_press): don't add a new event if it
won't fit, or we end up adding a new event for each key press.
(e_day_view_update_event_label): don't update it if it doesn't have
an EText item (i.e. it isn't visible).
* gui/e-day-view-time-item.c: allow selection of times using this
column.
svn path=/trunk/; revision=3144
Diffstat (limited to 'calendar/gui/e-day-view-time-item.c')
-rw-r--r-- | calendar/gui/e-day-view-time-item.c | 126 |
1 files changed, 121 insertions, 5 deletions
diff --git a/calendar/gui/e-day-view-time-item.c b/calendar/gui/e-day-view-time-item.c index a3b1c35dd3..c2dcf55727 100644 --- a/calendar/gui/e-day-view-time-item.c +++ b/calendar/gui/e-day-view-time-item.c @@ -72,6 +72,14 @@ static void e_day_view_time_item_show_popup_menu (EDayViewTimeItem *dvtmitem, GdkEvent *event); static void e_day_view_time_item_on_set_divisions (GtkWidget *item, EDayViewTimeItem *dvtmitem); +static void e_day_view_time_item_on_button_press (EDayViewTimeItem *dvtmitem, + GdkEvent *event); +static void e_day_view_time_item_on_button_release (EDayViewTimeItem *dvtmitem, + GdkEvent *event); +static void e_day_view_time_item_on_motion_notify (EDayViewTimeItem *dvtmitem, + GdkEvent *event); +static gint e_day_view_time_item_convert_position_to_row (EDayViewTimeItem *dvtmitem, + gint y); static GnomeCanvasItemClass *parent_class; @@ -134,9 +142,9 @@ e_day_view_time_item_class_init (EDayViewTimeItemClass *class) static void -e_day_view_time_item_init (EDayViewTimeItem *dvtmitm) +e_day_view_time_item_init (EDayViewTimeItem *dvtmitem) { - + dvtmitem->dragging_selection = FALSE; } @@ -332,14 +340,22 @@ e_day_view_time_item_event (GnomeCanvasItem *item, switch (event->type) { case GDK_BUTTON_PRESS: - if (event->button.button == 3) { + if (event->button.button == 1) { + e_day_view_time_item_on_button_press (dvtmitem, event); + } else if (event->button.button == 3) { e_day_view_time_item_show_popup_menu (dvtmitem, event); return TRUE; } break; case GDK_BUTTON_RELEASE: + if (event->button.button == 1) + e_day_view_time_item_on_button_release (dvtmitem, + event); + break; case GDK_MOTION_NOTIFY: + e_day_view_time_item_on_motion_notify (dvtmitem, event); + break; default: break; @@ -361,8 +377,6 @@ e_day_view_time_item_show_popup_menu (EDayViewTimeItem *dvtmitem, GSList *group = NULL; gint current_divisions, i; - g_print ("In e_day_view_time_item_show_popup_menu\n"); - day_view = dvtmitem->day_view; g_return_if_fail (day_view != NULL); @@ -413,3 +427,105 @@ e_day_view_time_item_on_set_divisions (GtkWidget *item, "divisions")); e_day_view_set_mins_per_row (day_view, divisions); } + + +static void +e_day_view_time_item_on_button_press (EDayViewTimeItem *dvtmitem, + GdkEvent *event) +{ + EDayView *day_view; + GnomeCanvas *canvas; + gint row; + + day_view = dvtmitem->day_view; + g_return_if_fail (day_view != NULL); + + canvas = GNOME_CANVAS_ITEM (dvtmitem)->canvas; + + row = e_day_view_time_item_convert_position_to_row (dvtmitem, + event->button.y); + + if (row == -1) + return; + + if (!GTK_WIDGET_HAS_FOCUS (day_view)) + gtk_widget_grab_focus (GTK_WIDGET (day_view)); + + if (gdk_pointer_grab (GTK_LAYOUT (canvas)->bin_window, FALSE, + GDK_POINTER_MOTION_MASK + | GDK_BUTTON_RELEASE_MASK, + FALSE, NULL, event->button.time) == 0) { + e_day_view_start_selection (day_view, -1, row); + dvtmitem->dragging_selection = TRUE; + } +} + + +static void +e_day_view_time_item_on_button_release (EDayViewTimeItem *dvtmitem, + GdkEvent *event) +{ + EDayView *day_view; + + day_view = dvtmitem->day_view; + g_return_if_fail (day_view != NULL); + + if (dvtmitem->dragging_selection) { + gdk_pointer_ungrab (event->button.time); + e_day_view_finish_selection (day_view); + e_day_view_stop_auto_scroll (day_view); + } + + dvtmitem->dragging_selection = FALSE; +} + + +static void +e_day_view_time_item_on_motion_notify (EDayViewTimeItem *dvtmitem, + GdkEvent *event) +{ + EDayView *day_view; + GnomeCanvas *canvas; + gdouble window_y; + gint y, row; + + if (!dvtmitem->dragging_selection) + return; + + day_view = dvtmitem->day_view; + g_return_if_fail (day_view != NULL); + + canvas = GNOME_CANVAS_ITEM (dvtmitem)->canvas; + + y = event->motion.y; + row = e_day_view_time_item_convert_position_to_row (dvtmitem, y); + + if (row != -1) { + gnome_canvas_world_to_window (canvas, 0, event->motion.y, + NULL, &window_y); + e_day_view_update_selection (day_view, -1, row); + e_day_view_check_auto_scroll (day_view, -1, (gint) window_y); + } +} + + +/* Returns the row corresponding to the y position, or -1. */ +static gint +e_day_view_time_item_convert_position_to_row (EDayViewTimeItem *dvtmitem, + gint y) +{ + EDayView *day_view; + gint row; + + day_view = dvtmitem->day_view; + g_return_val_if_fail (day_view != NULL, -1); + + if (y < 0) + return -1; + + row = y / day_view->row_height; + if (row >= day_view->rows) + return -1; + + return row; +} |