aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Wu <Yang.Wu@sun.com>2003-08-12 16:48:19 +0800
committerBolian Yin <byin@src.gnome.org>2003-08-12 16:48:19 +0800
commit7001706f5f99bb007006659b5cceb9a546d29b5a (patch)
tree051c98088b89867f82b1840f421fd6c2d8322722
parent4692d881f316f6e09c3825790df5d8145a414332 (diff)
downloadgsoc2013-evolution-7001706f5f99bb007006659b5cceb9a546d29b5a.tar
gsoc2013-evolution-7001706f5f99bb007006659b5cceb9a546d29b5a.tar.gz
gsoc2013-evolution-7001706f5f99bb007006659b5cceb9a546d29b5a.tar.bz2
gsoc2013-evolution-7001706f5f99bb007006659b5cceb9a546d29b5a.tar.lz
gsoc2013-evolution-7001706f5f99bb007006659b5cceb9a546d29b5a.tar.xz
gsoc2013-evolution-7001706f5f99bb007006659b5cceb9a546d29b5a.tar.zst
gsoc2013-evolution-7001706f5f99bb007006659b5cceb9a546d29b5a.zip
In the WeekView, Navigation through days with arrow keys.
2003-08-12 Andrew Wu <Yang.Wu@sun.com> * gui/e-week-view.c (e_week_view_on_key_up): (e_week_view_on_key_down): (e_week_view_on_key_left): (e_week_view_on_key_right): In the WeekView, Navigation through days with arrow keys. svn path=/trunk/; revision=22184
-rw-r--r--calendar/ChangeLog9
-rw-r--r--calendar/gui/e-week-view.c195
2 files changed, 204 insertions, 0 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 29d0750a44..a1556e285a 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,12 @@
+2003-08-12 Andrew Wu <Yang.Wu@sun.com>
+
+ * gui/e-week-view.c
+ (e_week_view_on_key_up):
+ (e_week_view_on_key_down):
+ (e_week_view_on_key_left):
+ (e_week_view_on_key_right):
+ In the WeekView, Navigation through days with arrow keys.
+
2003-08-12 Harry Lu <harry.lu@sun.com>
** fixes #47464.
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 19ef3147e4..fb91cd22d3 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -178,6 +178,10 @@ static gboolean e_week_view_on_jump_button_event (GnomeCanvasItem *item,
static gboolean e_week_view_key_press (GtkWidget *widget, GdkEventKey *event);
static gboolean e_week_view_do_key_press (GtkWidget *widget,
GdkEventKey *event);
+static void e_week_view_on_key_up (EWeekView *week_view, GdkEventKey *event);
+static void e_week_view_on_key_down (EWeekView *week_view, GdkEventKey *event);
+static void e_week_view_on_key_left (EWeekView *week_view, GdkEventKey *event);
+static void e_week_view_on_key_right (EWeekView *week_view, GdkEventKey *event);
static gboolean e_week_view_popup_menu (GtkWidget *widget);
static gboolean e_week_view_update_event_cb (EWeekView *week_view,
@@ -3331,6 +3335,24 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
}
#endif
+ /*Navigation through days with arrow keys*/
+ switch (event->keyval) {
+ case GDK_Up:
+ e_week_view_on_key_up (week_view, event);
+ return TRUE;
+ case GDK_Down:
+ e_week_view_on_key_down (week_view, event);
+ return TRUE;
+ case GDK_Left:
+ e_week_view_on_key_left (week_view, event);
+ return TRUE;
+ case GDK_Right:
+ e_week_view_on_key_right (week_view, event);
+ return TRUE;
+ default:
+ break;
+ }
+
if (week_view->selection_start_day == -1)
return FALSE;
@@ -3390,6 +3412,179 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
return TRUE;
}
+static void
+e_week_view_on_key_up (EWeekView *week_view, GdkEventKey *event)
+{
+ gint selection_start_day, selection_end_day;
+
+ selection_start_day = week_view->selection_start_day;
+ selection_end_day = week_view->selection_end_day;
+
+ if (selection_start_day == -1) {
+ selection_start_day = 0;
+ selection_end_day = 0;
+ }
+
+ if (week_view->multi_week_view) {
+ if (selection_end_day < 7) {
+ g_date_subtract_days (&(week_view->first_day_shown), 7);
+ } else
+ selection_end_day -= 7;
+ }
+ else {
+ if (selection_start_day == selection_end_day) {
+ if (selection_end_day == 0) {
+ g_date_subtract_days (&(week_view->first_day_shown), 7);
+ selection_end_day = 6;
+ } else
+ selection_end_day--;
+ } else {
+ selection_end_day =
+ (selection_start_day + selection_end_day)/2;
+ }
+ }
+
+ week_view->selection_start_day = selection_end_day;
+ week_view->selection_end_day = selection_end_day;
+
+ gtk_widget_queue_draw (week_view->main_canvas);
+}
+
+static void
+e_week_view_on_key_down (EWeekView *week_view, GdkEventKey *event)
+{
+ gint selection_start_day, selection_end_day;
+
+ selection_start_day = week_view->selection_start_day;
+ selection_end_day = week_view->selection_end_day;
+
+ if (selection_start_day == -1) {
+ selection_start_day = 0;
+ selection_end_day = 0;
+ }
+
+ if (week_view->multi_week_view) {
+ if ((selection_end_day+7) / 7 >= week_view->weeks_shown) {
+ g_date_add_days (&(week_view->first_day_shown), 7);
+ } else
+ selection_end_day += 7;
+ }
+ else {
+ if (selection_start_day == selection_end_day) {
+ if (selection_end_day == 6) {
+ g_date_add_days (&(week_view->first_day_shown), 7);
+ selection_end_day = 0;
+ } else
+ selection_end_day++;
+ } else {
+ selection_end_day =
+ (selection_start_day + selection_end_day)/2;
+ }
+ }
+
+ week_view->selection_start_day = selection_end_day;
+ week_view->selection_end_day = selection_end_day;
+
+ gtk_widget_queue_draw (week_view->main_canvas);
+}
+
+static void
+e_week_view_on_key_left (EWeekView *week_view, GdkEventKey *event)
+{
+ gint selection_start_day, selection_end_day;
+
+ selection_start_day = week_view->selection_start_day;
+ selection_end_day = week_view->selection_end_day;
+
+ if (selection_start_day == -1) {
+ selection_start_day = 0;
+ selection_end_day = 0;
+ }
+
+ if (week_view->multi_week_view) {
+ if (selection_end_day == 0) {
+ g_date_subtract_days (&(week_view->first_day_shown), 7);
+ selection_end_day = 6;
+ } else
+ selection_end_day -= 1;
+ }
+ else {
+ switch (selection_end_day) {
+ case 0:
+ case 1:
+ case 2:
+ g_date_subtract_days (&(week_view->first_day_shown), 7);
+ selection_end_day += 3;
+ break;
+ case 3:
+ case 4:
+ case 5:
+ selection_end_day -= 3;
+ break;
+ case 6:
+ selection_end_day -= 4;
+ break;
+ default:
+ break;
+ }
+ }
+
+ week_view->selection_start_day = selection_end_day;
+ week_view->selection_end_day = selection_end_day;
+
+ gtk_widget_queue_draw (week_view->main_canvas);
+
+}
+
+static void
+e_week_view_on_key_right (EWeekView *week_view, GdkEventKey *event)
+{
+
+ gint selection_start_day, selection_end_day;
+
+ selection_start_day = week_view->selection_start_day;
+ selection_end_day = week_view->selection_end_day;
+
+ if (selection_start_day == -1) {
+ selection_start_day = 0;
+ selection_end_day = 0;
+ }
+
+ if (week_view->multi_week_view) {
+ if (selection_end_day == week_view->weeks_shown*7 -1 ) {
+ g_date_add_days (&(week_view->first_day_shown), 7);
+ selection_end_day -= 6;
+ } else
+ selection_end_day++;
+ }
+ else {
+ switch (selection_end_day) {
+ case 0:
+ case 1:
+ case 2:
+ selection_end_day += 3;
+ break;
+ case 3:
+ case 4:
+ case 5:
+ g_date_add_days (&(week_view->first_day_shown), 7);
+ selection_end_day -= 3;
+ break;
+ case 6:
+ g_date_add_days (&(week_view->first_day_shown), 7);
+ selection_end_day -= 4;
+ break;
+ default:
+ break;
+ }
+ }
+
+ week_view->selection_start_day = selection_end_day;
+ week_view->selection_end_day = selection_end_day;
+
+ gtk_widget_queue_draw (week_view->main_canvas);
+}
+
static gboolean
e_week_view_key_press (GtkWidget *widget, GdkEventKey *event)
{