diff options
author | JP Rosevear <jpr@ximian.com> | 2002-09-07 05:40:38 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2002-09-07 05:40:38 +0800 |
commit | e1a2491881b488a87dc2374ce459ead0b443ae84 (patch) | |
tree | ca8df6b91eca169edde395ebf7943553b2d4a575 /calendar/gui/e-day-view.c | |
parent | 9e0e4a3fbf5218ad2e764bd2816070a2eb94e91a (diff) | |
download | gsoc2013-evolution-e1a2491881b488a87dc2374ce459ead0b443ae84.tar.gz gsoc2013-evolution-e1a2491881b488a87dc2374ce459ead0b443ae84.tar.zst gsoc2013-evolution-e1a2491881b488a87dc2374ce459ead0b443ae84.zip |
kill warning
2002-09-06 JP Rosevear <jpr@ximian.com>
* gui/gnome-cal.c (gnome_calendar_edit_object): kill warning
* gui/e-week-view.h: new proto
* gui/e-week-view.c (e_week_view_set_selected_time_range_visible):
select a range of time in the currently visible area, if out side
the visible area, select as much as possible
(e_week_view_on_text_item_event): call above
* gui/e-week-view-event-item.c
(e_week_view_event_item_button_press): call above
* gui/e-day-view.c
(e_day_view_set_selected_time_range_in_top_visible): select a
range of time in the currently visible area, if out side the
visible area, select as much as possible
(e_day_view_set_selected_time_range_visible): the same for the
main canvas
(e_day_view_on_long_event_button_press): call above
(e_day_view_on_event_button_press): ditto
svn path=/trunk/; revision=18010
Diffstat (limited to 'calendar/gui/e-day-view.c')
-rw-r--r-- | calendar/gui/e-day-view.c | 88 |
1 files changed, 65 insertions, 23 deletions
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 9965707db4..31b71e473c 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -2220,7 +2220,7 @@ e_day_view_set_selected_time_range (EDayView *day_view, } else { lower = e_day_view_find_work_week_start (day_view, start_time); } - + /* See if we need to change the days shown. */ if (lower != day_view->lower) { e_day_view_recalc_day_starts (day_view, lower); @@ -2272,32 +2272,15 @@ e_day_view_set_selected_time_range (EDayView *day_view, } static void -e_day_view_set_selected_time_range_in_top (EDayView *day_view, - time_t start_time, - time_t end_time) +e_day_view_set_selected_time_range_in_top_visible (EDayView *day_view, + time_t start_time, + time_t end_time) { - time_t lower; gint start_row, start_col, end_row, end_col; gboolean need_redraw = FALSE, start_in_grid, end_in_grid; g_return_if_fail (E_IS_DAY_VIEW (day_view)); - /* Calculate the first day that should be shown, based on start_time - and the days_shown setting. If we are showing 1 day it is just the - start of the day given by start_time, otherwise it is the previous - work-week start day. */ - if (!day_view->work_week_view) { - lower = time_day_begin_with_zone (start_time, day_view->zone); - } else { - lower = e_day_view_find_work_week_start (day_view, start_time); - } - - /* See if we need to change the days shown. */ - if (lower != day_view->lower) { - e_day_view_recalc_day_starts (day_view, lower); - update_query (day_view); - } - /* Set the selection. */ start_in_grid = e_day_view_convert_time_to_grid_position (day_view, start_time, @@ -2308,6 +2291,11 @@ e_day_view_set_selected_time_range_in_top (EDayView *day_view, &end_col, &end_row); + if (!start_in_grid) + start_col = 0; + if (!end_in_grid) + end_col = day_view->days_shown - 1; + if (start_row != day_view->selection_start_row || start_col != day_view->selection_start_day) { need_redraw = TRUE; @@ -2330,6 +2318,60 @@ e_day_view_set_selected_time_range_in_top (EDayView *day_view, } } +static void +e_day_view_set_selected_time_range_visible (EDayView *day_view, + time_t start_time, + time_t end_time) +{ + gint start_row, start_col, end_row, end_col; + gboolean need_redraw = FALSE, start_in_grid, end_in_grid; + + g_return_if_fail (E_IS_DAY_VIEW (day_view)); + + /* Set the selection. */ + start_in_grid = e_day_view_convert_time_to_grid_position (day_view, + start_time, + &start_col, + &start_row); + end_in_grid = e_day_view_convert_time_to_grid_position (day_view, + end_time - 60, + &end_col, + &end_row); + + /* If either of the times isn't in the grid, or the selection covers + an entire day, we set the selection to 1 row from the start of the + working day, in the day corresponding to the start time. */ + if (!start_in_grid || !end_in_grid + || (start_row == 0 && end_row == day_view->rows - 1)) { + end_col = start_col; + + start_row = e_day_view_convert_time_to_row (day_view, day_view->work_day_start_hour, day_view->work_day_start_minute); + start_row = CLAMP (start_row, 0, day_view->rows - 1); + end_row = start_row; + } + + if (start_row != day_view->selection_start_row + || start_col != day_view->selection_start_day) { + need_redraw = TRUE; + day_view->selection_in_top_canvas = FALSE; + day_view->selection_start_row = start_row; + day_view->selection_start_day = start_col; + } + + if (end_row != day_view->selection_end_row + || end_col != day_view->selection_end_day) { + need_redraw = TRUE; + day_view->selection_in_top_canvas = FALSE; + day_view->selection_end_row = end_row; + day_view->selection_end_day = end_col; + } + + if (need_redraw) { + gtk_widget_queue_draw (day_view->top_canvas); + gtk_widget_queue_draw (day_view->main_canvas); + } +} + /* Finds the start of the working week which includes the given time. */ static time_t @@ -3269,7 +3311,7 @@ e_day_view_on_long_event_button_press (EDayView *day_view, if (!destroyed) { gtk_signal_disconnect (GTK_OBJECT (e->comp), id); - e_day_view_set_selected_time_range_in_top (day_view, e->start, e->end); + e_day_view_set_selected_time_range_in_top_visible (day_view, e->start, e->end); e_day_view_on_event_right_click (day_view, event, E_DAY_VIEW_LONG_EVENT, @@ -3321,7 +3363,7 @@ e_day_view_on_event_button_press (EDayView *day_view, if (!destroyed) { gtk_signal_disconnect (GTK_OBJECT (e->comp), id); - e_day_view_set_selected_time_range (day_view, e->start, e->end); + e_day_view_set_selected_time_range_visible (day_view, e->start, e->end); e_day_view_on_event_right_click (day_view, event, day, event_num); |