diff options
author | Andrew Wu <Yang.Wu@sun.com> | 2003-08-13 09:49:54 +0800 |
---|---|---|
committer | Bolian Yin <byin@src.gnome.org> | 2003-08-13 09:49:54 +0800 |
commit | bb2401c0ce0e70dae6a2fcb539a27deb03b40151 (patch) | |
tree | 0664d69867ced1d3f836f3d98de3e4f7650083d1 | |
parent | 7e917e133504b6740aa128d772fb582f58ba6304 (diff) | |
download | gsoc2013-evolution-bb2401c0ce0e70dae6a2fcb539a27deb03b40151.tar gsoc2013-evolution-bb2401c0ce0e70dae6a2fcb539a27deb03b40151.tar.gz gsoc2013-evolution-bb2401c0ce0e70dae6a2fcb539a27deb03b40151.tar.bz2 gsoc2013-evolution-bb2401c0ce0e70dae6a2fcb539a27deb03b40151.tar.lz gsoc2013-evolution-bb2401c0ce0e70dae6a2fcb539a27deb03b40151.tar.xz gsoc2013-evolution-bb2401c0ce0e70dae6a2fcb539a27deb03b40151.tar.zst gsoc2013-evolution-bb2401c0ce0e70dae6a2fcb539a27deb03b40151.zip |
In DayView, Shift+Home, Change the duration to the time that begins the
2003-08-12 Andrew Wu <Yang.Wu@sun.com>
* gui/e-day-view.c
(e_day_view_change_duration_to_start_of_work_day):
In DayView, Shift+Home, Change the duration to the time
that begins the current work day.
(e_day_view_change_duration_to_end_of_work_day):
In DayView, Shift+End, Change the duration to the time
that ends the current work day
svn path=/trunk/; revision=22202
-rw-r--r-- | calendar/ChangeLog | 10 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 93 |
2 files changed, 103 insertions, 0 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 5d24583a83..1988d6ad2a 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,13 @@ +2003-08-12 Andrew Wu <Yang.Wu@sun.com> + + * gui/e-day-view.c + (e_day_view_change_duration_to_start_of_work_day): + In DayView, Shift+Home, Change the duration to the time + that begins the current work day. + (e_day_view_change_duration_to_end_of_work_day): + In DayView, Shift+End, Change the duration to the time + that ends the current work day + 2003-08-12 Hans Petter Jansson <hpj@ximian.com> * gui/e-itip-control.c (html_destroyed): diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index ded89f91f4..dee466955e 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -158,6 +158,8 @@ static gboolean e_day_view_get_visible_time_range (EDayView *day_view, time_t *s static void e_day_view_update_query (EDayView *day_view); static void e_day_view_goto_start_of_work_day (EDayView *day_view); static void e_day_view_goto_end_of_work_day (EDayView *day_view); +static void e_day_view_change_duration_to_start_of_work_day (EDayView *day_view); +static void e_day_view_change_duration_to_end_of_work_day (EDayView *day_view); static void e_day_view_cursor_key_up_shifted (EDayView *day_view, GdkEventKey *event); static void e_day_view_cursor_key_down_shifted (EDayView *day_view, @@ -4816,6 +4818,23 @@ e_day_view_do_key_press (GtkWidget *widget, GdkEventKey *event) return TRUE; } + /* In DayView, Shift+Home/End, Change the duration to the time that begins/ends the current work day */ + if ((keyval == GDK_Home) + &&((event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK) + &&((event->state & GDK_CONTROL_MASK) != GDK_CONTROL_MASK) + &&((event->state & GDK_MOD1_MASK) != GDK_MOD1_MASK)) { + e_day_view_change_duration_to_start_of_work_day (day_view); + return TRUE; + } + if ((keyval == GDK_End) + &&((event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK) + &&((event->state & GDK_CONTROL_MASK) != GDK_CONTROL_MASK) + &&((event->state & GDK_MOD1_MASK) != GDK_MOD1_MASK)) { + e_day_view_change_duration_to_end_of_work_day (day_view); + return TRUE; + } + + /* Handle the cursor keys for moving & extending the selection. */ stop_emission = TRUE; if (event->state & GDK_SHIFT_MASK) { @@ -5000,6 +5019,80 @@ e_day_view_goto_end_of_work_day (EDayView *day_view) gtk_widget_queue_draw (day_view->main_canvas); } +/* Change the duration to the time that begins the current work day */ +static void +e_day_view_change_duration_to_start_of_work_day (EDayView *day_view) +{ + g_return_if_fail(day_view != NULL); + + if (day_view->selection_in_top_canvas) + return; + else { + gint work_start_row,work_end_row,selection_start_row,selection_end_row; + + work_start_row = + e_day_view_convert_time_to_row (day_view, + day_view->work_day_start_hour, + day_view->work_day_start_minute); + work_end_row = + e_day_view_convert_time_to_row (day_view, + day_view->work_day_end_hour - 1, + day_view->work_day_end_minute + 30); + selection_start_row = day_view->selection_start_row; + selection_end_row = day_view->selection_end_row; + if (selection_start_row < work_start_row) + day_view->selection_end_row = work_start_row - 1; + else day_view->selection_start_row = work_start_row; + } + + e_day_view_ensure_rows_visible (day_view, + day_view->selection_start_row, + day_view->selection_end_row); + + e_day_view_update_calendar_selection_time (day_view); + + gtk_widget_queue_draw (day_view->top_canvas); + gtk_widget_queue_draw (day_view->main_canvas); +} + +/* Change the duration to the time that ends the current work day */ +static void +e_day_view_change_duration_to_end_of_work_day (EDayView *day_view) +{ + g_return_if_fail(day_view != NULL); + + if (day_view->selection_in_top_canvas) + return; + else { + gint work_start_row,work_end_row,selection_start_row,selection_end_row; + work_start_row = + e_day_view_convert_time_to_row (day_view, + day_view->work_day_start_hour, + day_view->work_day_start_minute); + work_end_row = e_day_view_convert_time_to_row (day_view, + day_view->work_day_end_hour-1, + day_view->work_day_end_minute+30); + selection_start_row = day_view->selection_start_row; + selection_end_row = day_view->selection_end_row; + if (selection_start_row <= work_end_row) + day_view->selection_end_row = work_end_row; + else { + day_view->selection_start_row = work_end_row + 1; + day_view->selection_end_row = selection_start_row; + } + } + + e_day_view_ensure_rows_visible (day_view, + day_view->selection_start_row, + day_view->selection_end_row); + + e_day_view_update_calendar_selection_time (day_view); + + gtk_widget_queue_draw (day_view->top_canvas); + gtk_widget_queue_draw (day_view->main_canvas); +} + + static void e_day_view_cursor_key_up_shifted (EDayView *day_view, GdkEventKey *event) { |